(function(n,t){typeof exports=="object"&&typeof module!="undefined"?module.exports=t():typeof define=="function"&&define.amd?define(t):(n=typeof globalThis!="undefined"?globalThis:n||self,n.videojs=t())})(this,function(){"use strict";function hb(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=sb(n,t),t.createLogger=function(t){return hb(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 ht?[].concat(ht):[]},t.history.filter=function(n){return(ht||[]).filter(function(t){return new RegExp(".*"+n+".*").test(t[0])})},t.history.clear=function(){ht&&(ht.length=0)},t.history.disable=function(){ht!==null&&(ht.length=0,ht=null)},t.history.enable=function(){ht===null&&(ht=[])},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 vr(n,t){return t={exports:{}},n(t,t.exports),t.exports}function cu(n,t){lb(n).forEach(function(i){return t(n[i],i)})}function bot(n,t,i){return i===void 0&&(i=0),lb(n).reduce(function(i,r){return t(i,n[r],r)},i)}function v(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?hi.apply(void 0,[n].concat(r)):(r.forEach(function(t){t&&cu(t,function(t,i){n[i]=t})}),n)}function ki(n){return!!n&&typeof n=="object"}function fe(n){return ki(n)&&wot.call(n)==="[object Object]"&&n.constructor===Object}function ee(n,t){if(!n||!t)return"";if(typeof getComputedStyle=="function"){var i;try{i=window.getComputedStyle(n)}catch(r){return""}return i?i.getPropertyValue(t)||i[t]:""}return""}function kb(n){return typeof n=="string"&&Boolean(n.trim())}function db(n){if(n.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters");}function nst(n){return new RegExp("(^|\\s)"+n+"($|\\s)")}function au(){return document===window.document}function vu(n){return ki(n)&&n.nodeType===1}function gb(){try{return window.parent!==window.self}catch(n){return!0}}function nk(n){return function(t,i){if(!kb(t))return document[n](null);kb(i)&&(i=document.querySelector(i));var r=vu(i)?i:document;return r[n]&&r[n](t)}}function s(n,t,i,r){n===void 0&&(n="div");t===void 0&&(t={});i===void 0&&(i={});var u=document.createElement(n);return Object.getOwnPropertyNames(t).forEach(function(n){var i=t[n];n.indexOf("aria-")!==-1||n==="role"||n==="type"?(o.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 "+i+".")),u.setAttribute(n,i)):n==="textContent"?yr(u,i):(u[n]!==i||n==="tabIndex")&&(u[n]=i)}),Object.getOwnPropertyNames(i).forEach(function(n){u.setAttribute(n,i[n])}),r&&dl(u,r),u}function yr(n,t){return typeof n.textContent=="undefined"?n.innerText=t:n.textContent=t,n}function bl(n,t){t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n)}function pr(n,t){return(db(t),n.classList)?n.classList.contains(t):nst(t).test(n.className)}function nr(n,t){return n.classList?n.classList.add(t):pr(n,t)||(n.className=(n.className+" "+t).trim()),n}function he(n,t){return n?(n.classList?n.classList.remove(t):(db(t),n.className=n.className.split(/\s+/).filter(function(n){return n!==t}).join(" ")),n):(o.warn("removeClass was called with an element that doesn't exist"),null)}function tk(n,t,i){var r=pr(n,t);if(typeof i=="function"&&(i=i(n,t)),typeof i!="boolean"&&(i=!r),i!==r)return i?nr(n,t):he(n,t),n}function ik(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 tr(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 rk(n,t){return n.getAttribute(t)}function yu(n,t,i){n.setAttribute(t,i)}function os(n,t){n.removeAttribute(t)}function uk(){document.body.focus();document.onselectstart=function(){return!1}}function fk(){document.onselectstart=function(){return!0}}function pu(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(ee(n,"height"))),t.width||(t.width=parseFloat(ee(n,"width"))),t}}function ce(n){if(!n||n&&!n.offsetParent)return{left:0,top:0,width:0,height:0};for(var r=n.offsetWidth,u=n.offsetHeight,t=0,i=0;n.offsetParent&&n!==document[is.fullscreenElement];)t+=n.offsetLeft,i+=n.offsetTop,n=n.offsetParent;return{left:t,top:i,width:r,height:u}}function ss(n,t){var i={x:0,y:0},r,f,e,o;if(ct)for(r=n;r&&r.nodeName.toLowerCase()!=="html";)f=ee(r,"transform"),/^matrix/.test(f)?(e=f.slice(7,-1).split(/,\s/).map(Number),i.x+=e[4],i.y+=e[5]):/^matrix3d/.test(f)&&(o=f.slice(9,-1).split(/,\s/).map(Number),i.x+=o[12],i.y+=o[13]),r=r.parentNode;var s={},l=ce(t.target),u=ce(n),a=u.width,v=u.height,h=t.offsetY-(u.top-l.top),c=t.offsetX-(u.left-l.left);return t.changedTouches&&(c=t.changedTouches[0].pageX-u.left,h=t.changedTouches[0].pageY+u.top,ct&&(c-=i.x,h-=i.y)),s.y=1-Math.max(0,Math.min(1,h/v)),s.x=Math.max(0,Math.min(1,c/a)),s}function ek(n){return ki(n)&&n.nodeType===3}function kl(n){while(n.firstChild)n.removeChild(n.firstChild);return n}function ok(n){return typeof n=="function"&&(n=n()),(Array.isArray(n)?n:[n]).map(function(n){return(typeof n=="function"&&(n=n()),vu(n)||ek(n))?n:typeof n=="string"&&/\S/.test(n)?document.createTextNode(n):void 0}).filter(function(n){return n})}function dl(n,t){return ok(t).forEach(function(t){return n.appendChild(t)}),n}function sk(n,t){return dl(kl(n),t)}function le(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 na(n,t){au()&&(t&&(gl=t),window.setTimeout(tst,n))}function ta(){lk=!0;window.removeEventListener("load",ta)}function cr(){return ist++}function pk(n,t){if(it.has(n)){var i=it.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&&it["delete"](n)}}function ia(n,t,i,r){i.forEach(function(i){n(t,i,r)})}function hs(n){function f(){return!0}function e(){return!1}var t,i,r,u;if(n.fixed_)return n;if(!n||!n.isPropagationStopped||!n.isImmediatePropagationStopped){t=n||window.event;n={};for(i in t)i!=="layerX"&&i!=="layerY"&&i!=="keyLocation"&&i!=="webkitMovementX"&&i!=="webkitMovementY"&&(i==="returnValue"&&t.preventDefault||(n[i]=t[i]));n.target||(n.target=n.srcElement||document);n.relatedTarget||(n.relatedTarget=n.fromElement===n.target?n.toElement:n.fromElement);n.preventDefault=function(){t.preventDefault&&t.preventDefault();n.returnValue=!1;t.returnValue=!1;n.defaultPrevented=!0};n.defaultPrevented=!1;n.stopPropagation=function(){t.stopPropagation&&t.stopPropagation();n.cancelBubble=!0;t.cancelBubble=!0;n.isPropagationStopped=f};n.isPropagationStopped=e;n.stopImmediatePropagation=function(){t.stopImmediatePropagation&&t.stopImmediatePropagation();n.isImmediatePropagationStopped=f;n.stopPropagation()};n.isImmediatePropagationStopped=e;n.clientX!==null&&n.clientX!==undefined&&(r=document.documentElement,u=document.body,n.pageX=n.clientX+(r&&r.scrollLeft||u&&u.scrollLeft||0)-(r&&r.clientLeft||u&&u.clientLeft||0),n.pageY=n.clientY+(r&&r.scrollTop||u&&u.scrollTop||0)-(r&&r.clientTop||u&&u.clientTop||0));n.which=n.charCode||n.keyCode;n.button!==null&&n.button!==undefined&&(n.button=n.button&1?0:n.button&4?1:n.button&2?2:0)}return n.fixed_=!0,n}function bt(n,t,i){var r,u;if(Array.isArray(t))return ia(bt,n,t,i);it.has(n)||it.set(n,{});r=it.get(n);r.handlers||(r.handlers={});r.handlers[t]||(r.handlers[t]=[]);i.guid||(i.guid=cr());r.handlers[t].push(i);r.dispatcher||(r.disabled=!1,r.dispatcher=function(t,i){var f,e,u,s;if(!r.disabled&&(t=hs(t),f=r.handlers[t.type],f))for(e=f.slice(0),u=0,s=e.length;u<s;u++)if(t.isImmediatePropagationStopped())break;else try{e[u].call(n,t,i)}catch(h){o.error(h)}});r.handlers[t].length===1&&(n.addEventListener?(u=!1,wk()&&bk.indexOf(t)>-1&&(u={passive:!0}),n.addEventListener(t,r.dispatcher,u)):n.attachEvent&&n.attachEvent("on"+t,r.dispatcher))}function rt(n,t,i){var r,e,o,u,f;if(it.has(n)&&(r=it.get(n),r.handlers)){if(Array.isArray(t))return ia(rt,n,t,i);if(e=function(n,t){r.handlers[t]=[];pk(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);pk(n,t)}}}function wu(n,t,i){var f=it.has(n)?it.get(n):{},r=n.parentNode||n.ownerDocument,u;return typeof t=="string"?t={type:t,target:n}:t.target||(t.target=n),t=hs(t),f.dispatcher&&f.dispatcher.call(n,t,i),r&&!t.isPropagationStopped()&&t.bubbles===!0?wu.call(null,r,t,i):!r&&!t.defaultPrevented&&t.target&&t.target[t.type]&&(it.has(t.target)||it.set(t.target,{}),u=it.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 ls(n,t,i){if(Array.isArray(t))return ia(ls,n,t,i);var r=function r(){rt(n,t,r);i.apply(this,arguments)};r.guid=i.guid=i.guid||cr();bt(n,t,r)}function kk(n,t,i){var r=function r(){rt(n,t,r);i.apply(this,arguments)};r.guid=i.guid=i.guid||cr();bt(n,t,r)}function fa(n,t){t===void 0&&(t={});var r=t,i=r.eventBusKey;if(i){if(!n[i].nodeName)throw new Error('The eventBusKey "'+i+'" does not refer to an element.');n.eventBusEl_=n[i]}else n.eventBusEl_=s("span",{className:"vjs-event-bus"});v(n,est);n.eventedCallbacks&&n.eventedCallbacks.forEach(function(n){n()});n.on("dispose",function(){n.off();[n,n.el_,n.eventBusEl_].forEach(function(n){n&&it.has(n)&&it["delete"](n)});window.setTimeout(function(){n.eventBusEl_=null},0)});return n}function td(n,t){if(v(n,nd),n.state=v({},n.state,t),typeof n.handleStateChanged=="function"&&rr(n))n.on("statechanged",n.handleStateChanged);return n}function l(){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&&cu(t,function(t,i){if(!fe(t)){n[i]=t;return}fe(n[i])||(n[i]={});n[i]=l(n[i],t)})}),n}function lst(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function ast(n,t){n.prototype=Object.create(t.prototype);n.prototype.constructor=n;n.__proto__=t}function vst(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 id(n,t,i,r){return vst(n,r,i.length-1),i[r][t]}function oa(n){var t;return t=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:id.bind(null,"start",0,n),end:id.bind(null,"end",1,n)},window.Symbol&&window.Symbol.iterator&&(t[window.Symbol.iterator]=function(){return(n||[]).values()}),t}function br(n,t){return Array.isArray(n)?oa(n):n===undefined||t===undefined?oa():oa([[n,t]])}function rd(n,t){var u=0,f,r,i;if(!t)return 0;for(n&&n.length||(n=br(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 lt(n){if(n instanceof lt)return n;typeof n=="number"?this.code=n:typeof n=="string"?this.message=n:ki(n)&&(typeof n.code=="number"&&(this.code=n.code),v(this,n));this.message||(this.message=lt.defaultMessages[this.code]||"")}function yst(n,t){var i,r=null;try{i=JSON.parse(n,t)}catch(u){r=u}return[r,i]}function ve(n){return n!==undefined&&n!==null&&typeof n.then=="function"}function ci(n){ve(n)&&n.then(null,function(){})}function eht(n){if(!n)return!1;var t=fht.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 oht(n){return n===void 0&&(n=""),n.toLowerCase().split(";").reduce(function(n,t){var i=t.split("="),r=i[0],u=i[1];return r.trim()==="charset"?u.trim():n},"utf-8")}function cht(n,t){for(var i=0;i<n.length;i++)t(n[i])}function lht(n){for(var t in n)if(n.hasOwnProperty(t))return!1;return!0}function vd(n,t,i){var r=n;return uht(t)?(i=t,typeof n=="string"&&(r={uri:n})):r=hi({},t,{uri:n}),r.callback=i,r}function li(n,t,i){return t=vd(n,t,i),yd(t)}function yd(n){function w(){t.readyState===4&&setTimeout(v,0)}function b(){var n=undefined;if(n=t.response?t.response:t.responseText||aht(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=sht(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 li.XDomainRequest:new li.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&&!lht(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 aht(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 vht(){}function dt(n,t){this.name="ParsingError";this.code=n.code;this.message=t||n.message}function ba(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 we(){this.values=bs(null)}function be(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 yht(n,t,i){function f(){var t=ba(n);if(t===null)throw new dt(dt.Errors.BadTimeStamp,"Malformed timestamp: "+u);return n=n.replace(/^[^\sa-zA-Z-]+/,""),t}function e(n,t){var r=new we;be(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 dt(dt.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 rg(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 ka.innerHTML=n,n=ka.textContent,ka.textContent="",n}function a(n,t){return!ig[t.localName]||ig[t.localName]===n.localName}function v(t,i){var f=pht[t],r,u;return f?(r=n.document.createElement(f),u=wht[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=ba(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;tg.hasOwnProperty(r)&&(u=t?"background-color":"color",f=tg[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 bht(n){for(var i,t=0;t<da.length;t++)if(i=da[t],n>=i[0]&&n<=i[1])return!0;return!1}function kht(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),bht(f))return"rtl";return"ltr"}function dht(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 ks(){}function ds(n,t,i){var u,r;ks.call(this);this.cue=t;this.cueDiv=rg(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:kht(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 at(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 ght(n,t,i,r){function y(n,t){for(var f,e,o=new at(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 at(n),s=f);n=new at(o)}return e||o}var o=new at(t),e=t.cue,f=dht(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 at(t)}v=y(o,u);t.move(v.toCSSCompatValues(i))}function ku(){}function oct(n){if(typeof n!="string")return!1;var t=fct[n.toLowerCase()];return t?n.toLowerCase():!1}function ga(n){if(typeof n!="string")return!1;var t=ect[n.toLowerCase()];return t?n.toLowerCase():!1}function ug(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=oct(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!==uct)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=ga(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=ga(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=ga(n);if(!t)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");w=t;this.hasBeenReset=!0}}});this.displayState=undefined}function sct(n){if(typeof n!="string")return!1;var t=eg[n.toLowerCase()];return t?n.toLowerCase():!1}function ke(n){return typeof n=="number"&&n>=0&&n<=100}function hct(){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(!ke(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(!ke(n))throw new Error("RegionAnchorX must be between 0 and 100.");r=n}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(n){if(!ke(n))throw new Error("RegionAnchorY must be between 0 and 100.");i=n}},viewportAnchorY:{enumerable:!0,get:function(){return f},set:function(n){if(!ke(n))throw new Error("ViewportAnchorY must be between 0 and 100.");f=n}},viewportAnchorX:{enumerable:!0,get:function(){return u},set:function(n){if(!ke(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=sct(n);t===!1?console.warn("Scroll: an invalid or illegal string was specified."):e=t}}})}function cct(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 ut.text.TrackClass(u),e.addTrack(f),f}function lct(n,t){tu[n]=tu[n]||[];tu[n].push(t)}function act(n,t,i){n.setTimeout(function(){return iu(t,tu[t.type],i,n)},1)}function vct(n,t){n.forEach(function(n){return n.setTech&&n.setTech(t)})}function yct(n,t,i){return n.reduceRight(tv(i),t[i]())}function pct(n,t,i,r){return t[i](n.reduce(tv(i),r))}function sg(n,t,i,r){r===void 0&&(r=null);var o="call"+y(i),u=n.reduce(tv(o),r),f=u===gs,e=f?null:t[i](u);return kct(n,i,e,f),e}function tv(n){return function(t,i){return t===gs?gs:i[n]?i[n](t):t}}function kct(n,t,i,r){for(var f,u=n.length-1;u>=0;u--)f=n[u],f[t]&&f[t](r,i)}function dct(n){nv[n.id()]=null}function gct(n,t){var r=nv[n.id()],i=null,u;if(r===undefined||r===null)return i=t(n),nv[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 iu(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")iu(n,tu[s],i,r,u,f);else if(s){if(o=gct(r,s),!o.setSource)return u.push(o),iu(n,e,i,r,u,f);o.setSource(v({},n),function(t,s){if(t)return iu(n,e,i,r,u,f);u.push(o);iu(s,n.type===s.type?e:tu[s.type],i,r,u,f)})}else e.length?iu(n,e,i,r,u,f):f?i(n,u):iu(n,tu["*"],i,r,u,!0)}function lg(n){if(!n.type){var t=nh(n.src);t&&(n.type=t)}return n}function iv(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 rv(n,t,i){try{n.style[t]=i}catch(r){return}}function rlt(n){th=n}function ult(){th=ev}function gu(n,t){return t===void 0&&(t=n),th(n,t)}function kn(n,t){return t&&(n=t(n)),n&&n!=="none"?n:void 0}function flt(n,t){var i=n.options[n.options.selectedIndex].value;return kn(i,t)}function elt(n,t,i){if(t)for(var r=0;r<n.options.length;r++)if(kn(n.options[r].value,i)===t){n.selectedIndex=r;break}}function alt(){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 wlt(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&&ay(n,t)}function n(i,r,u){var e=n.getPlayer(i),f,s;if(e)return r&&o.warn('Player "'+i+'" is already initialised. Options will not be applied.'),u&&e.ready(u),e;if(f=typeof i=="string"?hr("#"+stt(i)):i,!vu(f))throw new TypeError("The element or ID supplied is not valid. (videojs)");return f.ownerDocument.defaultView&&f.ownerDocument.body.contains(f)||o.warn("The element supplied is not included in the DOM"),r=r||{},sr("beforesetup").forEach(function(n){var t=n(f,l(r));if(!ki(t)||Array.isArray(t)){o.error("please return an object in beforesetup hooks");return}r=l(r,t)}),s=t.getComponent("Player"),e=new s(f,r,u),sr("setup").forEach(function(n){return n(e)}),e}function glt(n){for(var i=dlt(n),r=new Uint8Array(i.length),t=0;t<i.length;t++)r[t]=i.charCodeAt(t);return r}function vat(n){for(var i=aat(n),r=new Uint8Array(i.length),t=0;t<i.length;t++)r[t]=i.charCodeAt(t);return r}function by(n,t){return t===undefined&&(t=Object),t&&typeof t.freeze=="function"?t.freeze(n):n}function bat(n){return n!==""}function kat(n){return n?n.split(/[\t\n\f\r ]+/).filter(bat):[]}function dat(n,t){return n.hasOwnProperty(t)||(n[t]=!0),n}function ktt(n){if(!n)return[];var t=kat(n);return Object.keys(t.reduce(dat,{}))}function gat(n){return function(t){return n&&n.indexOf(t)!==-1}}function fo(n,t){for(var i in n)t[i]=n[i]}function yt(n,t){var r=n.prototype,i;r instanceof t||(i=function(){},i.prototype=t.prototype,i=new i,fo(r,i),n.prototype=r=i);r.constructor!=n&&(typeof n!="function"&&console.error("unknown Class:"+n),r.constructor=n)}function ou(n,t){if(t instanceof Error)var i=t;else i=this,Error.call(this,d[n]),this.message=d[n],Error.captureStackTrace&&Error.captureStackTrace(this,ou);return i.code=n,t&&(this.message=this.message+": "+t),i}function fr(){}function sf(n,t){this._node=n;this._refresh=t;dy(this)}function dy(n){var i=n._node._inc||n._node.ownerDocument._inc,t;n._inc!=i&&(t=n._refresh(n._node),git(n,"length",t.length),fo(t,n),n._inc=i)}function sc(){}function eit(n,t){for(var i=n.length;i--;)if(n[i]===t)return i}function oit(n,t,i,r){if(r?t[eit(t,r)]=i:t[t.length++]=i,n){i.ownerElement=n;var u=n.ownerDocument;u&&(r&&lit(u,n,r),ivt(u,n,i))}}function sit(n,t,i){var r=eit(t,i),u,f;if(r>=0){for(u=t.length-1;r<u;)t[r]=t[++r];t.length=u;n&&(f=n.ownerDocument,f&&(lit(f,n,i),i.ownerElement=null))}else throw ou(fit,new Error(n.tagName+"@"+i));}function hit(){}function et(){}function cit(n){return n=="<"&&"&lt;"||n==">"&&"&gt;"||n=="&"&&"&amp;"||n=='"'&&"&quot;"||"&#"+n.charCodeAt()+";"}function eo(n,t){if(t(n))return!0;if(n=n.firstChild)do if(eo(n,t))return!0;while(n=n.nextSibling)}function oo(){}function ivt(n,t,i){n&&n._inc++;var r=i.namespaceURI;r===uo.XMLNS&&(t._nsMap[i.prefix?i.localName:""]=i.value)}function lit(n,t,i){n&&n._inc++;var r=i.namespaceURI;r===uo.XMLNS&&delete t._nsMap[i.prefix?i.localName:""]}function gy(n,t,i){var r,u,f;if(n&&n._inc)if(n._inc++,r=t.childNodes,i)r[r.length++]=i;else{for(u=t.firstChild,f=0;u;)r[f++]=u,u=u.nextSibling;r.length=f}}function ait(n,t){var i=t.previousSibling,r=t.nextSibling;return i?i.nextSibling=r:n.firstChild=r,r?r.previousSibling=i:n.lastChild=i,gy(n.ownerDocument,n),t}function vit(n,t,i){var e=t.parentNode,r,u,f;if(e&&e.removeChild(t),t.nodeType===ur){if(r=t.firstChild,r==null)return t;u=t.lastChild}else r=u=t;f=i?i.previousSibling:n.lastChild;r.previousSibling=f;u.nextSibling=i;f?f.nextSibling=r:n.firstChild=r;i==null?n.lastChild=u:i.previousSibling=u;do r.parentNode=n;while(r!==u&&(r=r.nextSibling));return gy(n.ownerDocument||n,n),t.nodeType==ur&&(t.firstChild=t.lastChild=null),t}function rvt(n,t){var r=t.parentNode,i;return r&&(i=n.lastChild,r.removeChild(t),i=n.lastChild),i=n.lastChild,t.parentNode=n,t.previousSibling=i,t.nextSibling=null,i?i.nextSibling=t:n.firstChild=t,n.lastChild=t,gy(n.ownerDocument,n,t),t}function su(){this._nsMap={}}function hc(){}function so(){}function np(){}function tp(){}function ip(){}function cc(){}function yit(){}function pit(){}function rp(){}function lc(){}function up(){}function wit(){}function bit(n,t){var f=[],i=this.nodeType==9&&this.documentElement||this,r=i.prefix,u=i.namespaceURI,e;return u&&r==null&&(r=i.lookupPrefix(u),r==null&&(e=[{namespace:u,prefix:null}])),hf(this,f,n,t,e),f.join("")}function kit(n,t,i){var e=n.prefix||"",r=n.namespaceURI,u,f;if(!r||e==="xml"&&r===uo.XML||r===uo.XMLNS)return!1;for(u=i.length;u--;)if(f=i[u],f.prefix===e)return f.namespace!==r;return!0}function fp(n,t,i){n.push(" ",t,'="',i.replace(/[<&"]/g,cit),'"')}function hf(n,t,i,r,u){var p,b,w,o,s,h,e,c,v,f,k,l,d;if(u||(u=[]),r)if(n=r(n),n){if(typeof n=="string"){t.push(n);return}}else return;switch(n.nodeType){case ei:var a=n.attributes,g=a.length,f=n.firstChild,y=n.tagName;if(i=uo.isHTML(n.namespaceURI)||i,p=y,!i&&!n.prefix&&n.namespaceURI){for(w=0;w<a.length;w++)if(a.item(w).name==="xmlns"){b=a.item(w).value;break}if(!b)for(o=u.length-1;o>=0;o--)if(s=u[o],s.prefix===""&&s.namespace===n.namespaceURI){b=s.namespace;break}if(b!==n.namespaceURI)for(o=u.length-1;o>=0;o--)if(s=u[o],s.namespace===n.namespaceURI){s.prefix&&(p=s.prefix+":"+y);break}}for(t.push("<",p),h=0;h<g;h++)e=a.item(h),e.prefix=="xmlns"?u.push({prefix:e.localName,namespace:e.value}):e.nodeName=="xmlns"&&u.push({prefix:"",namespace:e.value});for(h=0;h<g;h++)e=a.item(h),kit(e,i,u)&&(c=e.prefix||"",v=e.namespaceURI,fp(t,c?"xmlns:"+c:"xmlns",v),u.push({prefix:c,namespace:v})),hf(e,t,i,r,u);if(y===p&&kit(n,i,u)&&(c=n.prefix||"",v=n.namespaceURI,fp(t,c?"xmlns:"+c:"xmlns",v),u.push({prefix:c,namespace:v})),f||i&&!/^(?:meta|link|img|br|hr|input)$/i.test(y)){if(t.push(">"),i&&/^script$/i.test(y))while(f)f.data?t.push(f.data):hf(f,t,i,r,u.slice()),f=f.nextSibling;else while(f)hf(f,t,i,r,u.slice()),f=f.nextSibling;t.push("<\/",p,">")}else t.push("/>");return;case iit:case ur:for(f=n.firstChild;f;)hf(f,t,i,r,u.slice()),f=f.nextSibling;return;case of:return fp(t,n.name,n.value);case oc:return t.push(n.data.replace(/[<&]/g,cit).replace(/]]>/g,"]]&gt;"));case dtt:return t.push("<![CDATA[",n.data,"]\]>");case tit:return t.push("<!--",n.data,"-->");case rit:k=n.publicId;l=n.systemId;t.push("<!DOCTYPE ",n.name);k?(t.push(" PUBLIC ",k),l&&l!="."&&t.push(" ",l),t.push(">")):l&&l!="."?t.push(" SYSTEM ",l,">"):(d=n.internalSubset,d&&t.push(" [",d,"]"),t.push(">"));return;case nit:return t.push("<?",n.target," ",n.data,"?>");case gtt:return t.push("&",n.nodeName,";");default:t.push("??",n.nodeName)}}function dit(n,t,i){var r,u;switch(t.nodeType){case ei:r=t.cloneNode(!1);r.ownerDocument=n;break;case of:i=!0}if(r||(r=t.cloneNode(!1)),r.ownerDocument=n,r.parentNode=null,i)for(u=t.firstChild;u;)r.appendChild(dit(n,u,i)),u=u.nextSibling;return r}function ep(n,t,i){var r=new t.constructor,f,e,o,u;for(f in t)e=t[f],typeof e!="object"&&e!=r[f]&&(r[f]=e);t.childNodes&&(r.childNodes=new fr);r.ownerDocument=n;switch(r.nodeType){case ei:var s=t.attributes,h=r.attributes=new sc,c=s.length;for(h._ownerElement=r,o=0;o<c;o++)r.setAttributeNode(ep(n,s.item(o),!0));break;case of:i=!0}if(i)for(u=t.firstChild;u;)r.appendChild(ep(n,u,i)),u=u.nextSibling;return r}function git(n,t,i){n[t]=i}function vf(n,t){this.message=n;this.locator=t;Error.captureStackTrace&&Error.captureStackTrace(this,vf)}function irt(){}function lvt(n,t,i,r,u){function st(n){if(n>65535){n-=65536;var t=55296+(n>>10),i=56320+(n&1023);return String.fromCharCode(t,i)}return String.fromCharCode(n)}function p(n){var t=n.slice(1,-1);return t in i?i[t]:t.charAt(0)==="#"?st(parseInt(t.substr(1).replace("x","0x"))):(u.error("entity not found:"+n),n)}function tt(t){if(t>s){var i=n.substring(s,t).replace(/&#?\w+;/g,p);c&&v(s);r.characters(i,0,t-s);s=t}}function v(t,i){while(t>=it&&(i=ht.exec(n)))w=i.index,it=w+i[0].length,c.lineNumber++;c.columnNumber=t-w+1}for(var w=0,it=0,ht=/.*(?:\r\n?|\n)|.*$/g,c=r.locator,a=[{currentNSMap:t}],ct={},s=0,f,b,k,ft,ot,y,g;;){try{if(f=n.indexOf("<",s),f<0){n.substr(s).match(/^\s*$/)||(b=r.doc,k=b.createTextNode(n.substr(s)),b.appendChild(k),r.currentElement=k);return}f>s&&tt(f);switch(n.charAt(f+1)){case"/":var e=n.indexOf(">",f+3),h=n.substring(f+2,e).replace(/[ \t\n\r]+$/g,""),l=a.pop();e<0?(h=n.substring(f+2).replace(/[\s<].*/,""),u.error("end tag name: "+h+" is not complete:"+l.tagName),e=f+1+h.length):h.match(/\s</)&&(h=h.replace(/[\s<].*/,""),u.error("end tag name: "+h+" maybe not complete"),e=f+1+h.length);var rt=l.localNSMap,ut=l.tagName==h,lt=ut||l.tagName&&l.tagName.toLowerCase()==h.toLowerCase();if(lt){if(r.endElement(l.uri,l.localName,h),rt)for(ft in rt)r.endPrefixMapping(ft);ut||u.fatalError("end tag name: "+h+" is not match the current start tagName:"+l.tagName)}else a.push(l);e++;break;case"?":c&&v(f);e=wvt(n,f,r);break;case"!":c&&v(f);e=pvt(n,f,r,u);break;default:c&&v(f);var o=new ert,d=a[a.length-1].currentNSMap,e=avt(n,f,o,d,p,u),et=o.length;if(!o.closed&&yvt(n,e,o.tagName,ct)&&(o.closed=!0,i.nbsp||u.warning("unclosed xml attribute")),c&&et){for(ot=rrt(c,{}),y=0;y<et;y++)g=o[y],v(g.offset),g.locator=rrt(c,{});r.locator=ot;urt(o,r,d)&&a.push(o);r.locator=c}else urt(o,r,d)&&a.push(o);co.isHTML(o.uri)&&!o.closed?e=vvt(n,e,o.tagName,p,r):e++}}catch(nt){if(nt instanceof vf)throw nt;u.error("element parse error: "+nt);e=-1}e>s?s=e:tt(Math.max(f,s)+1)}}function rrt(n,t){return t.lineNumber=n.lineNumber,t.columnNumber=n.columnNumber,t}function avt(n,t,i,r,u,f){function l(n,t,r){i.attributeNames.hasOwnProperty(n)&&f.fatalError("Attribute "+n+" redefined");i.addValue(n,t,r)}for(var h,o=++t,e=lo,c,s;;){c=n.charAt(o);switch(c){case"=":if(e===lr)h=n.slice(t,o),e=ao;else if(e===cf)e=ao;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(e===ao||e===lr)if(e===lr&&(f.warning('attribute value must after "="'),h=n.slice(t,o)),t=o+1,o=n.indexOf(c,t),o>0)s=n.slice(t,o).replace(/&#?\w+;/g,u),l(h,s,t-1),e=af;else throw new Error("attribute value no end '"+c+"' match");else if(e==lf)s=n.slice(t,o).replace(/&#?\w+;/g,u),l(h,s,t),f.warning('attribute "'+h+'" missed start quot('+c+")!!"),t=o+1,e=af;else throw new Error('attribute value must after "="');break;case"/":switch(e){case lo:i.setTagName(n.slice(t,o));case af:case vo:case ac:e=ac;i.closed=!0;case lf:case lr:case cf:break;default:throw new Error("attribute invalid close char('/')");}break;case"":return f.error("unexpected end of input"),e==lo&&i.setTagName(n.slice(t,o)),o;case">":switch(e){case lo:i.setTagName(n.slice(t,o));break;case lf:case lr:s=n.slice(t,o);s.slice(-1)==="/"&&(i.closed=!0,s=s.slice(0,-1));case cf:e===cf&&(s=h);e==lf?(f.warning('attribute "'+s+'" missed quot(")!'),l(h,s.replace(/&#?\w+;/g,u),t)):(co.isHTML(r[""])&&s.match(/^(?:disabled|checked|selected)$/i)||f.warning('attribute "'+s+'" missed value!! "'+s+'" instead!!'),l(s,s,t));break;case ao:throw new Error("attribute value missed!!");}return o;case"":c=" ";default:if(c<=" ")switch(e){case lo:i.setTagName(n.slice(t,o));e=vo;break;case lr:h=n.slice(t,o);e=cf;break;case lf:s=n.slice(t,o).replace(/&#?\w+;/g,u);f.warning('attribute "'+s+'" missed quot(")!!');l(h,s,t);case af:e=vo}else switch(e){case cf:i.tagName;co.isHTML(r[""])&&h.match(/^(?:disabled|checked|selected)$/i)||f.warning('attribute "'+h+'" missed value!! "'+h+'" instead2!!');l(h,h,t);t=o;e=lr;break;case af:f.warning('attribute space is required"'+h+'"!!');case vo:e=lr;t=o;break;case ao:e=lf;t=o;break;case ac:throw new Error("elements closed character '/' and '>' must be connected to");}}o++}}function urt(n,t,i){for(var o=n.tagName,s=null,h=n.length,r,f,a;h--;){var u=n[h],c=u.qName,v=u.value,f=c.indexOf(":");if(f>0)var r=u.prefix=c.slice(0,f),e=c.slice(f+1),l=r==="xmlns"&&e;else e=c,r=null,l=c==="xmlns"&&"";u.localName=e;l!==!1&&(s==null&&(s={},frt(i,i={})),i[l]=s[l]=v,u.uri=co.XMLNS,t.startPrefixMapping(l,v))}for(h=n.length;h--;)u=n[h],r=u.prefix,r&&(r==="xml"&&(u.uri=co.XML),r!=="xmlns"&&(u.uri=i[r||""]));if(f=o.indexOf(":"),f>0?(r=n.prefix=o.slice(0,f),e=n.localName=o.slice(f+1)):(r=null,e=n.localName=o),a=n.uri=i[r||""],t.startElement(a,e,o,n),n.closed){if(t.endElement(a,e,o),s)for(r in s)t.endPrefixMapping(r)}else return n.currentNSMap=i,n.localNSMap=s,!0}function vvt(n,t,i,r,u){if(/^(?:script|textarea)$/i.test(i)){var e=n.indexOf("<\/"+i+">",t),f=n.substring(t+1,e);if(/[&<]/.test(f))return/^script$/i.test(i)?(u.characters(f,0,f.length),e):(f=f.replace(/&#?\w+;/g,r),u.characters(f,0,f.length),e)}return t+1}function yvt(n,t,i,r){var u=r[i];return u==null&&(u=n.lastIndexOf("<\/"+i+">"),u<t&&(u=n.lastIndexOf("<\/"+i)),r[i]=u),u<t}function frt(n,t){for(var i in n)t[i]=n[i]}function pvt(n,t,i,r){var c=n.charAt(t+2),f,u,e,s;switch(c){case"-":return n.charAt(t+3)==="-"?(f=n.indexOf("-->",t+4),f>t?(i.comment(n,t+4,f-t-4),f+3):(r.error("Unclosed comment"),-1)):-1;default:if(n.substr(t+3,6)=="CDATA[")return f=n.indexOf("]\]>",t+9),i.startCDATA(),i.characters(n,t+9,f-t-9),i.endCDATA(),f+3;if(u=bvt(n,t),e=u.length,e>1&&/!doctype/i.test(u[0][0])){var l=u[1][0],h=!1,o=!1;return e>3&&(/^public$/i.test(u[2][0])?(h=u[3][0],o=e>4&&u[4][0]):/^system$/i.test(u[2][0])&&(o=u[3][0])),s=u[e-1],i.startDTD(l,h,o),i.endDTD(),s.index+s[0].length}}return-1}function wvt(n,t,i){var u=n.indexOf("?>",t),r;return u?(r=n.substring(t,u).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/),r?(r[0].length,i.processingInstruction(r[1],r[2]),u+2):-1):-1}function ert(){this.attributeNames={}}function bvt(n,t){var i,u=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(r.lastIndex=t,r.exec(n);i=r.exec(n);)if(u.push(i),i[1])return u}function hrt(n){this.options=n||{locator:{}}}function iyt(n,t,i){function r(t){var r=n[t];!r&&f&&(r=n.length==2?function(i){n(t,i)}:n);u[t]=r&&function(n){r("[xmldom "+t+"]\t"+n+cp(i))}||function(){}}if(!n){if(t instanceof yo)return t;n=t}var u={},f=n instanceof Function;return i=i||{},r("warning"),r("error"),r("fatalError"),u}function yo(){this.cdata=!1}function yf(n,t){t.lineNumber=n.lineNumber;t.columnNumber=n.columnNumber}function cp(n){if(n)return"\n@"+(n.systemId||"")+"#[line:"+n.lineNumber+",col:"+n.columnNumber+"]"}function crt(n,t,i){return typeof n=="string"?n.substr(t,i):n.length>=t+i||t?new java.lang.String(n,t,i)+"":n}function vc(n,t){n.currentElement?n.currentElement.appendChild(t):n.doc.appendChild(t)}function er(){}for(var ue,ht,sb,yk,it,cs,wk,bk,ae,nd,f,i,kr,ud,ps,dr,gr,ed,ld,ad,kt,nu,ut,ng,pa,pe,wa,bs,da,fg,eg,og,du,h,ag,de,vg,pg,wg,ri,uv,bg,fv,ev,th,ru,ih,rh,kg,uh,dg,ov,ge,fh,eh,gg,nn,oh,sv,cv,lv,av,rn,un,fn,vv,no,yv,en,pv,wv,bv,hh,ch,on,nf,tf,kv,uu,dv,lh,ah,vh,yh,ph,gv,wh,ny,ty,bh,iy,ry,sn,to,uy,dn,gn,ntt,ttt,kh,ftt,p,rf,ay,io,rc,uit,fit,ky,op,vot,fb="7.17.3",bi={},sr=function(n,t){return bi[n]=bi[n]||[],t&&(bi[n]=bi[n].concat(t)),bi[n]},yot=function(n,t){sr(n,t)},eb=function(n,t){var i=sr(n).indexOf(t);return i<=-1?!1:(bi[n]=bi[n].slice(),bi[n].splice(i,1),!0)},pot=function(n,t){sr(n,[].concat(t).map(function(t){var i=function i(){return eb(n,i),t.apply(void 0,arguments)};return i}))},is={prefixed:!0},rs=[["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"]],ob=rs[0],re,us=0;us<rs.length;us++)if(rs[us][1]in document){re=rs[us];break}if(re){for(ue=0;ue<re.length;ue++)is[ob[ue]]=re[ue];is.prefixed=re[0]!==ob[0]}ht=[];sb=function(n,t){return function(i,r,u){var o=t.levels[r],s=new RegExp("^("+o+")$"),e,f;(i!=="log"&&u.unshift(i.toUpperCase()+":"),u.unshift(n+":"),ht&&(ht.push([].concat(u)),e=ht.length-1e3,ht.splice(0,e>0?e:0)),window.console)&&(f=window.console[i],f||i!=="debug"||(f=window.console.info||window.console.log),f&&o&&s.test(i))&&f[Array.isArray(u)?"apply":"call"](window.console,u)}};var o=hb("VIDEOJS"),cb=o.createLogger,fs=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};var hi=vr(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}),wot=Object.prototype.toString,lb=function(n){return ki(n)?Object.keys(n):[]};var b=window.navigator&&window.navigator.userAgent||"",ab=/AppleWebKit\/([\d.]+)/i.exec(b),kot=ab?parseFloat(ab.pop()):null,vb=/iPod/i.test(b),dot=function(){var n=b.match(/OS (\d+)_/i);return n&&n[1]?n[1]:null}(),di=/Android/i.test(b),vl=function(){var n=b.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}(),yb=di&&vl<5&&kot<537,pb=/Firefox/i.test(b),oe=/Edg/i.test(b),gi=!oe&&(/Chrome/i.test(b)||/CriOS/i.test(b)),wb=function(){var n=b.match(/(Chrome|CriOS)\/(\d+)/);return n&&n[2]?parseFloat(n[2]):null}(),se=function(){var t=/MSIE\s(\d+)\.\d/.exec(b),n=t&&parseFloat(t[1]);return!n&&/Trident\/7.0/i.test(b)&&/rv:11.0/.test(b)&&(n=11),n}(),yl=/Safari/i.test(b)&&!gi&&!di&&!oe,bb=/Windows/i.test(b),lu=Boolean(au()&&("ontouchstart"in window||window.navigator.maxTouchPoints||window.DocumentTouch&&window.document instanceof window.DocumentTouch)),pl=/iPad/i.test(b)||yl&&lu&&!/iPhone/i.test(b),wl=/iPhone/i.test(b)&&!pl,ct=wl||pl||vb,es=(yl||ct)&&!gi,got=Object.freeze({__proto__:null,IS_IPOD:vb,IOS_VERSION:dot,IS_ANDROID:di,ANDROID_VERSION:vl,IS_NATIVE_ANDROID:yb,IS_FIREFOX:pb,IS_EDGE:oe,IS_CHROME:gi,CHROME_VERSION:wb,IE_VERSION:se,IS_SAFARI:yl,IS_WINDOWS:bb,TOUCH_ENABLED:lu,IS_IPAD:pl,IS_IPHONE:wl,IS_IOS:ct,IS_ANY_SAFARI:es});var hr=nk("querySelector"),hk=nk("querySelectorAll"),ck=Object.freeze({__proto__:null,isReal:au,isEl:vu,isInFrame:gb,createEl:s,textContent:yr,prependTo:bl,hasClass:pr,addClass:nr,removeClass:he,toggleClass:tk,setAttributes:ik,getAttributes:tr,getAttribute:rk,setAttribute:yu,removeAttribute:os,blockTextSelection:uk,unblockTextSelection:fk,getBoundingClientRect:pu,findPosition:ce,getPointerPosition:ss,isTextNode:ek,emptyEl:kl,normalizeContent:ok,appendContent:dl,insertContent:sk,isSingleLeftClick:le,$:hr,$$:hk}),lk=!1,gl,tst=function(){var i,r,n,u;if(gl.options.autoSetup!==!1){var f=Array.prototype.slice.call(document.getElementsByTagName("video")),e=Array.prototype.slice.call(document.getElementsByTagName("audio")),o=Array.prototype.slice.call(document.getElementsByTagName("video-js")),t=f.concat(e,o);if(t&&t.length>0)for(i=0,r=t.length;i<r;i++)if(n=t[i],n&&n.getAttribute)n.player===undefined&&(u=n.getAttribute("data-setup"),u!==null&&gl(n));else{na(1);break}else lk||na(1)}};au()&&(document.readyState==="complete"?ta():window.addEventListener("load",ta));var ak=function(n){var t=document.createElement("style");return t.className=n,t},vk=function(n,t){n.styleSheet?n.styleSheet.cssText=t:n.textContent=t},ist=3;window.WeakMap||(yk=function(){function t(){this.vdata="vdata"+Math.floor(window.performance&&window.performance.now()||Date.now());this.data={}}var n=t.prototype;return n.set=function(n,t){var i=n[this.vdata]||cr();return n[this.vdata]||(n[this.vdata]=i),this.data[i]=t,this},n.get=function(n){var t=n[this.vdata];return t?this.data[t]:(o("We have no data for this element",n),undefined)},n.has=function(n){var t=n[this.vdata];return t in this.data},n["delete"]=function(n){var t=n[this.vdata];t&&(delete this.data[t],delete n[this.vdata])},t}());it=window.WeakMap?new WeakMap:new yk;wk=function(){if(typeof cs!="boolean"){cs=!1;try{var n=Object.defineProperty({},"passive",{get:function(){cs=!0}});window.addEventListener("test",null,n);window.removeEventListener("test",null,n)}catch(i){}}return cs};bk=["touchstart","touchmove"];var rst=Object.freeze({__proto__:null,fixEvent:hs,on:bt,off:rt,trigger:wu,one:ls,any:kk}),ui=30,c=function(n,t,i){t.guid||(t.guid=cr());var r=t.bind(n);return r.guid=i?i+"_"+t.guid:t.guid,r},ir=function(n,t){var i=window.performance.now();return function(){var r=window.performance.now();r-i>=t&&(n.apply(void 0,arguments),i=r)}},ust=function(n,t,i,r){r===void 0&&(r=window);var u,e=function(){r.clearTimeout(u);u=null},f=function(){var f=this,e=arguments,o=function(){u=null;o=null;i||n.apply(f,e)};!u&&i&&n.apply(f,e);r.clearTimeout(u);u=r.setTimeout(o,t)};return f.cancel=e,f},k=function(){};k.prototype.allowedEvents_={};k.prototype.on=function(n,t){var i=this.addEventListener;this.addEventListener=function(){};bt(this,n,t);this.addEventListener=i};k.prototype.addEventListener=k.prototype.on;k.prototype.off=function(n,t){rt(this,n,t)};k.prototype.removeEventListener=k.prototype.off;k.prototype.one=function(n,t){var i=this.addEventListener;this.addEventListener=function(){};ls(this,n,t);this.addEventListener=i};k.prototype.any=function(n,t){var i=this.addEventListener;this.addEventListener=function(){};kk(this,n,t);this.addEventListener=i};k.prototype.trigger=function(n){var t=n.type||n;typeof n=="string"&&(n={type:t});n=hs(n);this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](n);wu(this,n)};k.prototype.dispatchEvent=k.prototype.trigger;k.prototype.queueTrigger=function(n){var r=this,i,t,u,f;ae||(ae=new Map);i=n.type||n;t=ae.get(this);t||(t=new Map,ae.set(this,t));u=t.get(i);t["delete"](i);window.clearTimeout(u);f=window.setTimeout(function(){t.size===0&&(t=null,ae["delete"](r));r.trigger(n)},0);t.set(i,f)};var as=function(n){return typeof n.name=="function"?n.name():typeof n.name=="string"?n.name:n.name_?n.name_:n.constructor&&n.constructor.name?n.constructor.name:typeof n},rr=function(n){return n instanceof k||!!n.eventBusEl_&&["on","one","off","trigger"].every(function(t){return typeof n[t]=="function"})},fst=function(n,t){rr(n)?t():(n.eventedCallbacks||(n.eventedCallbacks=[]),n.eventedCallbacks.push(t))},ra=function(n){return typeof n=="string"&&/\S/.test(n)||Array.isArray(n)&&!!n.length},vs=function(n,t,i){if(!n||!n.nodeName&&!rr(n))throw new Error("Invalid target for "+as(t)+"#"+i+"; must be a DOM node or evented object.");},dk=function(n,t,i){if(!ra(n))throw new Error("Invalid event type for "+as(t)+"#"+i+"; must be a non-empty string or array.");},gk=function(n,t,i){if(typeof n!="function")throw new Error("Invalid listener for "+as(t)+"#"+i+"; must be a function.");},ua=function(n,t,i){var e=t.length<3||t[0]===n||t[0]===n.eventBusEl_,u,f,r;return e?(u=n.eventBusEl_,t.length>=3&&t.shift(),f=t[0],r=t[1]):(u=t[0],f=t[1],r=t[2]),vs(u,n,i),dk(f,n,i),gk(r,n,i),r=c(n,r),{isTargetingSelf:e,target:u,type:f,listener:r}},wr=function(n,t,i,r){vs(n,n,t);n.nodeName?rst[t](n,i,r):n[t](i,r)},est={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=ua(this,s,"on"),c=t.isTargetingSelf,u=t.target,h=t.type,i=t.listener;wr(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,wr(this,"on","dispose",r),wr(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=ua(this,o,"one"),h=t.isTargetingSelf,r=t.target,u=t.type,f=t.listener;h?wr(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,wr(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=ua(this,o,"any"),h=t.isTargetingSelf,r=t.target,u=t.type,f=t.listener;h?wr(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,wr(r,"any",u,i))},off:function(n,t,i){if(!n||ra(n))rt(this.eventBusEl_,n,t);else{var r=n,u=t;vs(r,this,"off");dk(u,this,"off");gk(i,this,"off");i=c(this,i);this.off("dispose",i);r.nodeName?(rt(r,u,i),rt(r,"dispose",i)):rr(r)&&(r.off(u,i),r.off("dispose",i))}},trigger:function(n,t){var r,i;if(vs(this.eventBusEl_,this,"trigger"),r=n&&typeof n!="string"?n.type:n,!ra(r))if(i="Invalid event type for "+as(this)+"#trigger; must be a non-empty string or object with a type key that has a non-empty value.",n)(this.log||o).error(i);else throw new Error(i);return wu(this.eventBusEl_,n,t)}};nd={state:{},setState:function(n){var i=this,t;return typeof n=="function"&&(n=n()),cu(n,function(n,r){i.state[r]!==n&&(t=t||{},t[r]={from:i.state[r],to:n});i.state[r]=n}),t&&rr(this)&&this.trigger({changes:t,type:"statechanged"}),t}};var ys=function(n){return typeof n!="string"?n:n.replace(/./,function(n){return n.toLowerCase()})},y=function(n){return typeof n!="string"?n:n.replace(/./,function(n){return n.toUpperCase()})},ost=function(n,t){return y(n)===y(t)};var sst=function(){function t(){this.map_={}}var n=t.prototype;return n.has=function(n){return n in this.map_},n["delete"]=function(n){var t=this.has(n);return delete this.map_[n],t},n.set=function(n,t){return this.map_[n]=t,this},n.forEach=function(n,t){for(var i in this.map_)n.call(t,this.map_[i],i,this)},t}(),hst=window.Map?window.Map:sst,cst=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}(),ea=window.Set?window.Set:cst,t=function(){function t(n,t,i){if(this.player_=!n&&this.play?n=this:n,this.isDisposed_=!1,this.parentComponent_=null,this.options_=l({},this.options_),t=this.options_=l(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){var r=n&&n.id&&n.id()||"no_player";this.id_=r+"_component_"+cr()}if(this.name_=t.name||null,t.el?this.el_=t.el:t.createEl!==!1&&(this.el_=this.createEl()),t.evented!==!1){fa(this,{eventBusKey:this.el_?"el_":null});this.handleLanguagechange=this.handleLanguagechange.bind(this);this.on(this.player_,"languagechange",this.handleLanguagechange)}td(this,this.constructor.defaultState);this.children_=[];this.childIndex_={};this.childNameIndex_={};this.setTimeoutIds_=new ea;this.setIntervalIds_=new ea;this.rafIds_=new ea;this.namedRafs_=new hst;this.clearingTimersOnDispose_=!1;t.initChildren!==!1&&this.initChildren();this.ready(i);t.reportTouchActivity!==!1&&this.enableTouchActivity()}var n=t.prototype;return n.dispose=function(){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),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_),this.el_=null);this.player_=null}},n.isDisposed=function(){return Boolean(this.isDisposed_)},n.player=function(){return this.player_},n.options=function(n){return n?(this.options_=l(this.options_,n),this.options_):this.options_},n.el=function(){return this.el_},n.createEl=function(n,t,i){return s(n,t,i)},n.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},n.handleLanguagechange=function(){},n.contentEl=function(){return this.contentEl_||this.el_},n.id=function(){return this.id_},n.name=function(){return this.name_},n.children=function(){return this.children_},n.getChildById=function(n){return this.childIndex_[n]},n.getChild=function(n){if(n)return this.childNameIndex_[n]},n.getDescendant=function(){for(var n,r,u=arguments.length,t=new Array(u),i=0;i<u;i++)t[i]=arguments[i];for(t=t.reduce(function(n,t){return n.concat(t)},[]),n=this,r=0;r<t.length;r++)if(n=n.getChild(t[r]),!n||!n.getChild)return;return n},n.addChild=function(n,i,r){var u,f,s,e,o;if(i===void 0&&(i={}),r===void 0&&(r=this.children_.length),typeof n=="string"){if(f=y(n),s=i.componentClass||f,i.name=f,e=t.getComponent(s),!e)throw new Error("Component "+s+" does not exist");if(typeof e!="function")return null;u=new e(this.player_||this,i)}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&&y(u.name()),f&&(this.childNameIndex_[f]=u,this.childNameIndex_[ys(f)]=u),typeof u.el=="function"&&u.el()&&(o=null,this.children_[r+1]&&(this.children_[r+1].el_?o=this.children_[r+1].el_:vu(this.children_[r+1])&&(o=this.children_[r+1])),this.contentEl().insertBefore(u.el(),o)),u},n.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_[y(n.name())]=null,this.childNameIndex_[ys(n.name())]=null,r=n.el(),r&&r.parentNode===this.contentEl()&&this.contentEl().removeChild(n.el()))}},n.initChildren=function(){var i=this,n=this.options_.children;if(n){var u=this.options_,f=function(n){var r=n.name,t=n.opts,f;(u[r]!==undefined&&(t=u[r]),t!==!1)&&(t===!0&&(t={}),t.playerOptions=i.options_.playerOptions,f=i.addChild(r,t),f&&(i[r]=f))},r,e=t.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(t){var r,u;return typeof t=="string"?(r=t,u=n[r]||i.options_[r]||{}):(r=t.name,u=t),{name:r,opts:u}}).filter(function(n){var i=t.getComponent(n.opts.componentClass||y(n.name));return i&&!e.isTech(i)}).forEach(f)}},n.buildCSSClass=function(){return""},n.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)}},n.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)},n.$=function(n,t){return hr(n,t||this.contentEl())},n.$$=function(n,t){return hk(n,t||this.contentEl())},n.hasClass=function(n){return pr(this.el_,n)},n.addClass=function(n){nr(this.el_,n)},n.removeClass=function(n){he(this.el_,n)},n.toggleClass=function(n,t){tk(this.el_,n,t)},n.show=function(){this.removeClass("vjs-hidden")},n.hide=function(){this.addClass("vjs-hidden")},n.lockShowing=function(){this.addClass("vjs-lock-showing")},n.unlockShowing=function(){this.removeClass("vjs-lock-showing")},n.getAttribute=function(n){return rk(this.el_,n)},n.setAttribute=function(n,t){yu(this.el_,n,t)},n.removeAttribute=function(n){os(this.el_,n)},n.width=function(n,t){return this.dimension("width",n,t)},n.height=function(n,t){return this.dimension("height",n,t)},n.dimensions=function(n,t){this.width(n,!0);this.height(t)},n.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"+y(n)],10)},n.currentDimension=function(n){var t=0,i;if(n!=="width"&&n!=="height")throw new Error("currentDimension only accepts width or height value");return t=ee(this.el_,n),t=parseFloat(t),(t===0||isNaN(t))&&(i="offset"+y(n),t=this.el_[i]),t},n.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},n.currentWidth=function(){return this.currentDimension("width")},n.currentHeight=function(){return this.currentDimension("height")},n.focus=function(){this.el_.focus()},n.blur=function(){this.el_.blur()},n.handleKeyDown=function(n){this.player_&&(n.stopPropagation(),this.player_.handleKeyDown(n))},n.handleKeyPress=function(n){this.handleKeyDown(n)},n.emitTapEvents=function(){var r=0,n=null,u=10,f=200,t,i;this.on("touchstart",function(i){i.touches.length===1&&(n={pageX:i.touches[0].pageX,pageY:i.touches[0].pageY},r=window.performance.now(),t=!0)});this.on("touchmove",function(i){if(i.touches.length>1)t=!1;else if(n){var r=i.touches[0].pageX-n.pageX,f=i.touches[0].pageY-n.pageY,e=Math.sqrt(r*r+f*f);e>u&&(t=!1)}});i=function(){t=!1};this.on("touchleave",i);this.on("touchcancel",i);this.on("touchend",function(i){if(n=null,t===!0){var u=window.performance.now()-r;u<f&&(i.preventDefault(),this.trigger("tap"))}})},n.enableTouchActivity=function(){var n,t,i;if(this.player()&&this.player().reportUserActivity){n=c(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)}},n.setTimeout=function(n,t){var r=this,i;return n=c(this,n),this.clearTimersOnDispose_(),i=window.setTimeout(function(){r.setTimeoutIds_.has(i)&&r.setTimeoutIds_["delete"](i);n()},t),this.setTimeoutIds_.add(i),i},n.clearTimeout=function(n){return this.setTimeoutIds_.has(n)&&(this.setTimeoutIds_["delete"](n),window.clearTimeout(n)),n},n.setInterval=function(n,t){n=c(this,n);this.clearTimersOnDispose_();var i=window.setInterval(n,t);return this.setIntervalIds_.add(i),i},n.clearInterval=function(n){return this.setIntervalIds_.has(n)&&(this.setIntervalIds_["delete"](n),window.clearInterval(n)),n},n.requestAnimationFrame=function(n){var i=this,t;return this.supportsRaf_?(this.clearTimersOnDispose_(),n=c(this,n),t=window.requestAnimationFrame(function(){i.rafIds_.has(t)&&i.rafIds_["delete"](t);n()}),this.rafIds_.add(t),t):this.setTimeout(n,1e3/60)},n.requestNamedAnimationFrame=function(n,t){var i=this,r;if(!this.namedRafs_.has(n))return this.clearTimersOnDispose_(),t=c(this,t),r=this.requestAnimationFrame(function(){t();i.namedRafs_.has(n)&&i.namedRafs_["delete"](n)}),this.namedRafs_.set(n,r),n},n.cancelNamedAnimationFrame=function(n){this.namedRafs_.has(n)&&(this.cancelAnimationFrame(this.namedRafs_.get(n)),this.namedRafs_["delete"](n))},n.cancelAnimationFrame=function(n){return this.supportsRaf_?(this.rafIds_.has(n)&&(this.rafIds_["delete"](n),window.cancelAnimationFrame(n)),n):this.clearTimeout(n)},n.clearTimersOnDispose_=function(){var n=this;if(!this.clearingTimersOnDispose_){this.clearingTimersOnDispose_=!0;this.one("dispose",function(){[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(function(t){var i=t[0],r=t[1];n[i].forEach(function(t,i){return n[r](i)})});n.clearingTimersOnDispose_=!1})}},t.registerComponent=function(n,i){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=t.getComponent("Tech"),o=e&&e.isTech(i),h=t===i||t.prototype.isPrototypeOf(i.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=y(n),t.components_||(t.components_={}),r=t.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 t.components_[n]=i,t.components_[ys(n)]=i,i},t.getComponent=function(n){if(n&&t.components_)return t.components_[n]},t}();for(t.prototype.supportsRaf_=typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function",t.registerComponent("Component",t),f=lst,i=ast,lt.prototype.code=0,lt.prototype.message="",lt.prototype.status=null,lt.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],lt.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."},kr=0;kr<lt.errorTypes.length;kr++)lt[lt.errorTypes[kr]]=kr,lt.prototype[lt.errorTypes[kr]]=kr;ud=yst;var sa=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}})})},pst=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=sa(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(sa))},wst=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()},fd={textTracksToJson:pst,jsonToTextTracks:wst,trackToJson_:sa},e=vr(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]});e.code;e.codes;e.aliases;e.names;e.title;ps="vjs-modal-dialog";dr=function(n){function r(t,i){var r;return r=n.call(this,t,i)||this,r.handleKeyDown_=function(n){return r.handleKeyDown(n)},r.close_=function(n){return r.close(n)},r.opened_=r.hasBeenOpened_=r.hasBeenFilled_=!1,r.closeable(!r.options_.uncloseable),r.content(r.options_.content),r.contentEl_=s("div",{className:ps+"-content"},{role:"document"}),r.descEl_=s("p",{className:ps+"-description vjs-control-text",id:r.el().getAttribute("aria-describedby")}),yr(r.descEl_,r.description()),r.el_.appendChild(r.descEl_),r.el_.appendChild(r.contentEl_),r}i(r,n);var t=r.prototype;return t.createEl=function(){return n.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})},t.dispose=function(){this.contentEl_=null;this.descEl_=null;this.previouslyActiveEl_=null;n.prototype.dispose.call(this)},t.buildCSSClass=function(){return ps+" vjs-hidden "+n.prototype.buildCSSClass.call(this)},t.label=function(){return this.localize(this.options_.label||"Modal Window")},t.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},t.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}},t.opened=function(n){return typeof n=="boolean"&&this[n?"open":"close"](),this.opened_},t.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()}},t.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_},t.fill=function(){this.fillWith(this.content())},t.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();sk(t,n);this.trigger("modalfill");u?i.insertBefore(t,u):i.appendChild(t);r=this.getChild("closeButton");r&&i.appendChild(r.el_)},t.empty=function(){this.trigger("beforemodalempty");kl(this.contentEl());this.trigger("modalempty")},t.content=function(n){return typeof n!="undefined"&&(this.content_=n),this.content_},t.conditionalFocus_=function(){var n=document.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null;(t.contains(n)||t===n)&&(this.previouslyActiveEl_=n,this.focus())},t.conditionalBlur_=function(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)},t.handleKeyDown=function(n){var t,u,r,i;if(n.stopPropagation(),e.isEventKey(n,"Escape")&&this.closeable()){n.preventDefault();this.close();return}if(e.isEventKey(n,"Tab")){for(t=this.focusableEls_(),u=this.el_.querySelector(":focus"),i=0;i<t.length;i++)if(u===t[i]){r=i;break}document.activeElement===this.el_&&(r=0);n.shiftKey&&r===0?(t[t.length-1].focus(),n.preventDefault()):n.shiftKey||r!==t.length-1||(t[0].focus(),n.preventDefault())}},t.focusableEls_=function(){var n=this.el_.querySelectorAll("*");return Array.prototype.filter.call(n,function(n){return(n instanceof window.HTMLAnchorElement||n instanceof window.HTMLAreaElement)&&n.hasAttribute("href")||(n instanceof window.HTMLInputElement||n instanceof window.HTMLSelectElement||n instanceof window.HTMLTextAreaElement||n instanceof window.HTMLButtonElement)&&!n.hasAttribute("disabled")||n instanceof window.HTMLIFrameElement||n instanceof window.HTMLObjectElement||n instanceof window.HTMLEmbedElement||n.hasAttribute("tabindex")&&n.getAttribute("tabindex")!==-1||n.hasAttribute("contenteditable")})},r}(t);dr.prototype.options_={pauseOnOpen:!0,temporary:!0};t.registerComponent("ModalDialog",dr);gr=function(n){function t(t){var i,r;for(t===void 0&&(t=[]),i=n.call(this)||this,i.tracks_=[],Object.defineProperty(f(i),"length",{get:function(){return this.tracks_.length}}),r=0;r<t.length;r++)i.addTrack(t[r]);return i}i(t,n);var r=t.prototype;return r.addTrack=function(n){var i=this,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}));n.labelchange_=function(){i.trigger({track:n,type:"labelchange",target:i})};rr(n)&&n.addEventListener("labelchange",n.labelchange_)},r.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})},r.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}(k);gr.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(ed in gr.prototype.allowedEvents_)gr.prototype["on"+ed]=null;var ha=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)},bst=function(n){function t(t){var r,i;for(t===void 0&&(t=[]),i=t.length-1;i>=0;i--)if(t[i].enabled){ha(t,t[i]);break}return r=n.call(this,t)||this,r.changing_=!1,r}i(t,n);var r=t.prototype;return r.addTrack=function(t){var i=this;(t.enabled&&ha(this,t),n.prototype.addTrack.call(this,t),t.addEventListener)&&(t.enabledChange_=function(){i.changing_||(i.changing_=!0,ha(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("enabledchange",t.enabledChange_))},r.removeTrack=function(t){n.prototype.removeTrack.call(this,t);t.removeEventListener&&t.enabledChange_&&(t.removeEventListener("enabledchange",t.enabledChange_),t.enabledChange_=null)},t}(gr),ca=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)},kst=function(n){function t(t){var r,i;for(t===void 0&&(t=[]),i=t.length-1;i>=0;i--)if(t[i].selected){ca(t,t[i]);break}return r=n.call(this,t)||this,r.changing_=!1,Object.defineProperty(f(r),"selectedIndex",{get:function(){for(var n=0;n<this.length;n++)if(this[n].selected)return n;return-1},set:function(){}}),r}i(t,n);var r=t.prototype;return r.addTrack=function(t){var i=this;(t.selected&&ca(this,t),n.prototype.addTrack.call(this,t),t.addEventListener)&&(t.selectedChange_=function(){i.changing_||(i.changing_=!0,ca(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("selectedchange",t.selectedChange_))},r.removeTrack=function(t){n.prototype.removeTrack.call(this,t);t.removeEventListener&&t.selectedChange_&&(t.removeEventListener("selectedchange",t.selectedChange_),t.selectedChange_=null)},t}(gr),od=function(n){function t(){return n.apply(this,arguments)||this}i(t,n);var r=t.prototype;return r.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_)},r.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}(gr),dst=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}(),sd=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}(),gst={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},nht={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},tht={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},hd={disabled:"disabled",hidden:"hidden",showing:"showing"},la=function(n){function t(t){var i,e;t===void 0&&(t={});i=n.call(this)||this;var u={id:t.id||"vjs_track_"+cr(),kind:t.kind||"",language:t.language||""},r=t.label||"",o=function(n){Object.defineProperty(f(i),n,{get:function(){return u[n]},set:function(){}})};for(e in u)o(e);return Object.defineProperty(f(i),"label",{get:function(){return r},set:function(n){n!==r&&(r=n,this.trigger("labelchange"))}}),i}return i(t,n),t}(k),aa=function(n){var r=["protocol","hostname","port","pathname","search","hash","host"],u=document.createElement("a"),t,i;for(u.href=n,t={},i=0;i<r.length;i++)t[r[i]]=u[r[i]];return t.protocol==="http:"&&(t.host=t.host.replace(/:80$/,"")),t.protocol==="https:"&&(t.host=t.host.replace(/:443$/,"")),t.protocol||(t.protocol=window.location.protocol),t.host||(t.host=window.location.host),t},cd=function(n){if(!n.match(/^https?:\/\//)){var t=document.createElement("a");t.href=n;n=t.href}return n},va=function(n){if(typeof n=="string"){var t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(n);if(t)return t.pop().toLowerCase()}return""},ws=function(n,t){t===void 0&&(t=window.location);var i=aa(n),r=i.protocol===":"?t.protocol:i.protocol;return r+i.host!==t.protocol+t.host},iht=Object.freeze({__proto__:null,parseUrl:aa,getAbsoluteURL:cd,getFileExtension:va,isCrossOrigin:ws}),rht=typeof window!="undefined"?window:typeof fs!="undefined"?fs:typeof self!="undefined"?self:{};var ti=rht,uht=eht,fht=Object.prototype.toString;ld=function(n,t){return t===void 0&&(t=!1),function(i,r,u){var f,e;if(i){n(i);return}if(r.statusCode>=400&&r.statusCode<=599){if(f=u,t)if(ti.TextDecoder){e=oht(r.headers&&r.headers["content-type"]);try{f=new TextDecoder(e).decode(u)}catch(o){}}else f=String.fromCharCode.apply(null,new Uint8Array(u));n({cause:f});return}n(null,u)}};ad=ld;li.httpHandler=ad;var sht=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},ya=li,hht=li;li.XMLHttpRequest=ti.XMLHttpRequest||vht;li.XDomainRequest="withCredentials"in new li.XMLHttpRequest?li.XMLHttpRequest:ti.XDomainRequest;cht(["get","put","post","patch","head","delete"],function(n){li[n==="delete"?"del":n]=function(t,i,r){return i=vd(t,i,r),i.method=n.toUpperCase(),yd(i)}});ya["default"]=hht;var pd=function(n,t){var i=new window.WebVTT.Parser(window,window.vttjs,window.WebVTT.StringDecoder()),r=[];i.oncue=function(n){t.addCue(n)};i.onparsingerror=function(n){r.push(n)};i.onflush=function(){t.trigger({type:"loadeddata",target:t})};i.parse(n);r.length>0&&(window.console&&window.console.groupCollapsed&&window.console.groupCollapsed("Text Track parsing errors for "+t.src),r.forEach(function(n){return o.error(n)}),window.console&&window.console.groupEnd&&window.console.groupEnd());i.flush()},wd=function(n,t){var i={uri:n},u=ws(n),r;u&&(i.cors=u);r=t.tech_.crossOrigin()==="use-credentials";r&&(i.withCredentials=r);ya(i,c(this,function(n,i,r){if(n)return o.error(n,i);t.loaded_=!0;typeof WebVTT!="function"?t.tech_&&t.tech_.any(["vttjsloaded","vttjserror"],function(n){if(n.type==="vttjserror"){o.error("vttjs failed to load, stopping trying to process "+t.src);return}return pd(r,t)}):pd(r,t)}))},ye=function(n){function t(t){var i;if(t===void 0&&(t={}),!t.tech)throw new Error("A tech was not provided.");var r=l(t,{kind:tht[t.kind]||"subtitles",language:t.language||t.srclang||""}),u=hd[r.mode]||"disabled",h=r["default"];(r.kind==="metadata"||r.kind==="chapters")&&(u="hidden");i=n.call(this,r)||this;i.tech_=r.tech;i.cues_=[];i.activeCues_=[];i.preload_=i.tech_.preloadTextTracks!==!1;var a=new sd(i.cues_),s=new sd(i.activeCues_),e=!1,o=c(f(i),function(){this.tech_.isReady_&&!this.tech_.isDisposed()&&(this.activeCues=this.activeCues,e&&(this.trigger("cuechange"),e=!1))}),v=function(){i.tech_.off("timeupdate",o)};i.tech_.one("dispose",v);if(u!=="disabled")i.tech_.on("timeupdate",o);return Object.defineProperties(f(i),{"default":{get:function(){return h},set:function(){}},mode:{get:function(){return u},set:function(n){if(hd[n]&&u!==n){if(u=n,this.preload_||u==="disabled"||this.cues.length!==0||wd(this.src,this),this.tech_.off("timeupdate",o),u!=="disabled")this.tech_.on("timeupdate",o);this.trigger("modechange")}}},cues:{get:function(){return this.loaded_?a:null},set:function(){}},activeCues:{get:function(){var i,t,r,f,n,u;if(!this.loaded_)return null;if(this.cues.length===0)return s;for(i=this.tech_.currentTime(),t=[],r=0,f=this.cues.length;r<f;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(e=!1,t.length!==this.activeCues_.length)e=!0;else for(u=0;u<t.length;u++)this.activeCues_.indexOf(t[u])===-1&&(e=!0);return this.activeCues_=t,s.setCues_(this.activeCues_),s},set:function(){}}}),r.src?(i.src=r.src,i.preload_||(i.loaded_=!0),(i.preload_||r.kind!=="subtitles"&&r.kind!=="captions")&&wd(i.src,f(i))):i.loaded_=!0,i}i(t,n);var r=t.prototype;return r.addCue=function(n){var t=n,r,u,i;if(window.vttjs&&!(n instanceof window.vttjs.VTTCue)){t=new window.vttjs.VTTCue(n.startTime,n.endTime,n.text);for(r in n)r in t||(t[r]=n[r]);t.id=n.id;t.originalCue_=n}for(u=this.tech_.textTracks(),i=0;i<u.length;i++)u[i]!==this&&u[i].removeCue(t);this.cues_.push(t);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}},t}(la);ye.prototype.allowedEvents_={cuechange:"cuechange"};var bd=function(n){function t(t){var i,r,u;return t===void 0&&(t={}),r=l(t,{kind:nht[t.kind]||""}),i=n.call(this,r)||this,u=!1,Object.defineProperty(f(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 i(t,n),t}(la),kd=function(n){function t(t){var i,r,u;return t===void 0&&(t={}),r=l(t,{kind:gst[t.kind]||""}),i=n.call(this,r)||this,u=!1,Object.defineProperty(f(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 i(t,n),t}(la),dd=0,gd=2,bu=function(n){function t(t){var i,u,r;return t===void 0&&(t={}),i=n.call(this)||this,r=new ye(t),i.kind=r.kind,i.src=r.src,i.srclang=r.language,i.label=r.label,i["default"]=r["default"],Object.defineProperties(f(i),{readyState:{get:function(){return u}},track:{get:function(){return r}}}),u=dd,r.addEventListener("loadeddata",function(){u=gd;i.trigger({type:"load",target:f(i)})}),i}return i(t,n),t}(k);bu.prototype.allowedEvents_={load:"load"};bu.NONE=dd;bu.LOADING=1;bu.LOADED=gd;bu.ERROR=3;kt={audio:{ListClass:bst,TrackClass:bd,capitalName:"Audio"},video:{ListClass:kst,TrackClass:kd,capitalName:"Video"},text:{ListClass:od,TrackClass:ye,capitalName:"Text"}};Object.keys(kt).forEach(function(n){kt[n].getterName=n+"Tracks";kt[n].privateName=n+"Tracks_"});nu={remoteText:{ListClass:od,TrackClass:ye,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:dst,TrackClass:bu,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}};ut=hi({},kt,nu);nu.names=Object.keys(nu);kt.names=Object.keys(kt);ut.names=[].concat(nu.names).concat(kt.names);ng={};pa=typeof fs!="undefined"?fs:typeof window!="undefined"?window:{};typeof document!="undefined"?pe=document:(pe=pa["__GLOBAL_DOCUMENT_CACHE@4"],pe||(pe=pa["__GLOBAL_DOCUMENT_CACHE@4"]=ng));wa=pe;bs=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}}();dt.prototype=bs(Error.prototype);dt.prototype.constructor=dt;dt.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};we.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){return t.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(t=parseFloat(t),t>=0&&t<=100)?(this.set(n,t),!0):!1}};var ka=wa.createElement&&wa.createElement("textarea"),pht={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},tg={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)"},wht={v:"title",lang:"lang"},ig={rt:"ruby"};da=[[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]];ks.prototype.applyStyles=function(n,t){t=t||this.div;for(var i in n)n.hasOwnProperty(i)&&(t.style[i]=n[i])};ks.prototype.formatStyle=function(n,t){return n===0?0:n+t};ds.prototype=bs(ks.prototype);ds.prototype.constructor=ds;at.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}};at.prototype.overlaps=function(n){return this.left<n.right&&this.right>n.left&&this.top<n.bottom&&this.bottom>n.top};at.prototype.overlapsAny=function(n){for(var t=0;t<n.length;t++)if(this.overlaps(n[t]))return!0;return!1};at.prototype.within=function(n){return this.top>=n.top&&this.bottom<=n.bottom&&this.left>=n.left&&this.right<=n.right};at.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}};at.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)};at.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}};at.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}};ku.StringDecoder=function(){return{decode:function(n){if(!n)return"";if(typeof n!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(n))}}};ku.convertCueToDOMTree=function(n,t){return!n||!t?null:rg(n,t)};var nct=.05,tct="sans-serif",ict="1.5%";ku.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=ict,i.appendChild(r),!o(t)){for(u=0;u<t.length;u++)r.appendChild(t[u].displayState);return}var f=[],e=at.getSimpleBoxPosition(r),s=Math.round(e.height*nct*100)/100,h={font:s+"px "+tct};(function(){for(var i,u,o=0;o<t.length;o++)u=t[o],i=new ds(n,u,h),r.appendChild(i.div),ght(n,i,e,f),u.displayState=i.div,f.push(at.getSimpleBoxPosition(i))})()};ku.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=[]};ku.Parser.prototype={reportOrThrowError:function(n){if(n instanceof dt)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 we,r;be(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 we,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 we;be(n,function(n,t){switch(n){case"MPEGT":i.integer(n+"S",t);break;case"LOCA":i.set(n+"L",ba(t))}},/[^\d]:/,/,/);t.ontimestampmap&&t.ontimestampmap({MPEGTS:i.get("MPEGTS"),LOCAL:i.get("LOCAL")})}function c(n){n.match(/X-TIMESTAMP-MAP/)?be(n,function(n,t){switch(n){case"X-TIMESTAMP-MAP":h(t)}},/=/):be(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 dt(dt.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{yht(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 dt(dt.Errors.BadSignature);}catch(t){n.reportOrThrowError(t)}return n.onflush&&n.onflush(),this}};var rct=ku,uct="auto",fct={"":1,lr:1,rl:1},ect={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};ug.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};fg=ug;eg={"":!0,up:!0};og=hct;du=vr(function(n){var t=n.exports={WebVTT:rct,VTTCue:fg,VTTRegion:og};ti.vttjs=t;ti.WebVTT=t.WebVTT;var i=t.VTTCue,r=t.VTTRegion,u=ti.VTTCue,f=ti.VTTRegion;t.shim=function(){ti.VTTCue=i;ti.VTTRegion=r};t.restore=function(){ti.VTTCue=u;ti.VTTRegion=f};ti.VTTCue||t.shim()});du.WebVTT;du.VTTCue;du.VTTRegion;h=function(n){function r(t,i){var r;t===void 0&&(t={});i===void 0&&(i=function(){});t.reportTouchActivity=!1;r=n.call(this,null,t,i)||this;r.onDurationChange_=function(n){return r.onDurationChange(n)};r.trackProgress_=function(n){return r.trackProgress(n)};r.trackCurrentTime_=function(n){return r.trackCurrentTime(n)};r.stopTrackingCurrentTime_=function(n){return r.stopTrackingCurrentTime(n)};r.disposeSourceHandler_=function(n){return r.disposeSourceHandler(n)};r.hasStarted_=!1;r.on("playing",function(){this.hasStarted_=!0});r.on("loadstart",function(){this.hasStarted_=!1});return ut.names.forEach(function(n){var i=ut[n];t&&t[i.getterName]&&(r[i.privateName]=t[i.getterName])}),r.featuresProgressEvents||r.manualProgressOn(),r.featuresTimeupdateEvents||r.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(function(n){t["native"+n+"Tracks"]===!1&&(r["featuresNative"+n+"Tracks"]=!1)}),t.nativeCaptions===!1||t.nativeTextTracks===!1?r.featuresNativeTextTracks=!1:(t.nativeCaptions===!0||t.nativeTextTracks===!0)&&(r.featuresNativeTextTracks=!0),r.featuresNativeTextTracks||r.emulateTextTracks(),r.preloadTextTracks=t.preloadTextTracks!==!1,r.autoRemoteTextTracks_=new ut.text.ListClass,r.initTrackListeners(),t.nativeControlsForTouch||r.emitTapEvents(),r.constructor&&(r.name_=r.constructor.name||"Unknown Tech"),r}i(r,n);var t=r.prototype;return t.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"})},t.manualProgressOn=function(){this.on("durationchange",this.onDurationChange_);this.manualProgress=!0;this.one("ready",this.trackProgress_)},t.manualProgressOff=function(){this.manualProgress=!1;this.stopTrackingProgress();this.off("durationchange",this.onDurationChange_)},t.trackProgress=function(){this.stopTrackingProgress();this.progressInterval=this.setInterval(c(this,function(){var n=this.bufferedPercent();this.bufferedPercent_!==n&&this.trigger("progress");this.bufferedPercent_=n;n===1&&this.stopTrackingProgress()}),500)},t.onDurationChange=function(){this.duration_=this.duration()},t.buffered=function(){return br(0,0)},t.bufferedPercent=function(){return rd(this.buffered(),this.duration_)},t.stopTrackingProgress=function(){this.clearInterval(this.progressInterval)},t.manualTimeUpdatesOn=function(){this.manualTimeUpdates=!0;this.on("play",this.trackCurrentTime_);this.on("pause",this.stopTrackingCurrentTime_)},t.manualTimeUpdatesOff=function(){this.manualTimeUpdates=!1;this.stopTrackingCurrentTime();this.off("play",this.trackCurrentTime_);this.off("pause",this.stopTrackingCurrentTime_)},t.trackCurrentTime=function(){this.currentTimeInterval&&this.stopTrackingCurrentTime();this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)},t.stopTrackingCurrentTime=function(){this.clearInterval(this.currentTimeInterval);this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},t.dispose=function(){this.clearTracks(kt.names);this.manualProgress&&this.manualProgressOff();this.manualTimeUpdates&&this.manualTimeUpdatesOff();n.prototype.dispose.call(this)},t.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)})},t.cleanupAutoTextTracks=function(){for(var n=this.autoRemoteTextTracks_||[],t=n.length,i;t--;)i=n[t],this.removeRemoteTextTrack(i)},t.reset=function(){},t.crossOrigin=function(){},t.setCrossOrigin=function(){},t.error=function(n){return n!==undefined&&(this.error_=new lt(n),this.trigger("error")),this.error_},t.played=function(){return this.hasStarted_?br(0,0):br()},t.play=function(){},t.setScrubbing=function(){},t.scrubbing=function(){},t.setCurrentTime=function(){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},t.initTrackListeners=function(){var n=this;kt.names.forEach(function(t){var u=kt[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)})})},t.addWebVttScript_=function(){var t=this,n;if(!window.WebVTT)if(document.body.contains(this.el())){if(!this.options_["vtt.js"]&&fe(du)&&Object.keys(du).length>0){this.trigger("vttjsloaded");return}n=document.createElement("script");n.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js";n.onload=function(){t.trigger("vttjsloaded")};n.onerror=function(){t.trigger("vttjserror")};this.on("dispose",function(){n.onload=null;n.onerror=null});window.WebVTT=!0;this.el().parentNode.appendChild(n)}else this.ready(this.addWebVttScript_)},t.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)})},t.addTextTrack=function(n,t,i){if(!n)throw new Error("TextTrack kind is required but was not provided");return cct(this,n,t,i)},t.createRemoteTextTrack=function(n){var t=l(n,{tech:this});return new nu.remoteTextEl.TrackClass(t)},t.addRemoteTextTrack=function(n,t){var r=this,i;return n===void 0&&(n={}),i=this.createRemoteTextTrack(n),t!==!0&&t!==!1&&(o.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},t.removeRemoteTextTrack=function(n){var t=this.remoteTextTrackEls().getTrackElementByTrack_(n);this.remoteTextTrackEls().removeTrackElement_(t);this.remoteTextTracks().removeTrack(n);this.autoRemoteTextTracks_.removeTrack(n)},t.getVideoPlaybackQuality=function(){return{}},t.requestPictureInPicture=function(){var n=this.options_.Promise||window.Promise;if(n)return n.reject()},t.disablePictureInPicture=function(){return!0},t.setDisablePictureInPicture=function(){},t.setPoster=function(){},t.playsinline=function(){},t.setPlaysinline=function(){},t.overrideNativeAudioTracks=function(){},t.overrideNativeVideoTracks=function(){},t.canPlayType=function(){return""},r.canPlayType=function(){return""},r.canPlaySource=function(n){return r.canPlayType(n.type)},r.isTech=function(n){return n.prototype instanceof r||n instanceof r||n===r},r.registerTech=function(n,t){if(r.techs_||(r.techs_={}),!r.isTech(t))throw new Error("Tech "+n+" must be a Tech");if(!r.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!r.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return n=y(n),r.techs_[n]=t,r.techs_[ys(n)]=t,n!=="Tech"&&r.defaultTechOrder_.push(n),t},r.getTech=function(n){if(n)return r.techs_&&r.techs_[n]?r.techs_[n]:(n=y(n),window&&window.videojs&&window.videojs[n]?(o.warn("The "+n+" tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)"),window.videojs[n]):void 0)},r}(t);ut.names.forEach(function(n){var t=ut[n];h.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}});h.prototype.featuresVolumeControl=!0;h.prototype.featuresMuteControl=!0;h.prototype.featuresFullscreenResize=!1;h.prototype.featuresPlaybackRate=!1;h.prototype.featuresProgressEvents=!1;h.prototype.featuresSourceset=!1;h.prototype.featuresTimeupdateEvents=!1;h.prototype.featuresNativeTextTracks=!1;h.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:o.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)}};t.registerComponent("Tech",h);h.registerTech("Tech",h);h.defaultTechOrder_=[];var tu={},nv={},gs={};var wct={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},bct={setCurrentTime:1,setMuted:1,setVolume:1},hg={play:1,pause:1};var nlt={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},nh=function(n){n===void 0&&(n="");var t=va(n),i=nlt[t.toLowerCase()];return i||""},tlt=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 nh(t)},cg=function cg(n){if(Array.isArray(n)){var t=[];n.forEach(function(n){n=cg(n);Array.isArray(n)?t=t.concat(n):ki(n)&&t.push(n)});n=t}else n=typeof n=="string"&&n.trim()?[lg({src:n})]:ki(n)&&typeof n.src=="string"&&n.src&&n.src.trim()?[lg(n)]:[];return n};ag=function(n){function r(i,r,u){var c,a=l({createEl:!1},r),e,s,f,o;if(c=n.call(this,i,a,u)||this,r.playerOptions.sources&&r.playerOptions.sources.length!==0)i.src(r.playerOptions.sources);else for(e=0,s=r.playerOptions.techOrder;e<s.length;e++)if(f=y(s[e]),o=h.getTech(f),f||(o=t.getComponent(f)),o&&o.isSupported()){i.loadTech_(f);break}return c}return i(r,n),r}(t);t.registerComponent("MediaLoader",ag);de=function(n){function r(t,i){var r;return r=n.call(this,t,i)||this,r.handleMouseOver_=function(n){return r.handleMouseOver(n)},r.handleMouseOut_=function(n){return r.handleMouseOut(n)},r.handleClick_=function(n){return r.handleClick(n)},r.handleKeyDown_=function(n){return r.handleKeyDown(n)},r.emitTapEvents(),r.enable(),r}i(r,n);var t=r.prototype;return t.createEl=function(n,t,i){n===void 0&&(n="div");t===void 0&&(t={});i===void 0&&(i={});t=v({className:this.buildCSSClass(),tabIndex:0},t);n==="button"&&o.error("Creating a ClickableComponent with an HTML element of "+n+" is not supported; use a Button instead.");i=v({role:"button"},i);this.tabIndex_=t.tabIndex;var r=s(n,t,i);return r.appendChild(s("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r},t.dispose=function(){this.controlTextEl_=null;n.prototype.dispose.call(this)},t.createControlTextEl=function(n){return this.controlTextEl_=s("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;yr(this.controlTextEl_,i);this.nonIconControl||this.player_.options_.noUITitleAttributes||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.handleLanguagechange=function(){this.controlText(this.controlText_)},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)},r}(t);t.registerComponent("ClickableComponent",de);vg=function(n){function r(t,i){var r;r=n.call(this,t,i)||this;r.update();r.update_=function(n){return r.update(n)};t.on("posterchange",r.update_);return r}i(r,n);var t=r.prototype;return t.dispose=function(){this.player().off("posterchange",this.update_);n.prototype.dispose.call(this)},t.createEl=function(){return s("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(){if(this.player_.controls()){var n=this.player_.usingPlugin("eme")&&this.player_.eme.sessions&&this.player_.eme.sessions.length>0;!this.player_.tech(!0)||(se||oe)&&n||this.player_.tech(!0).focus();this.player_.paused()?ci(this.player_.play()):this.player_.pause()}},r}(de);t.registerComponent("PosterImage",vg);var ii="#222",yg="#ccc",ilt={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'};pg=function(n){function r(t,i,r){var u,e;u=n.call(this,t,i,r)||this;e=function(n){return u.updateDisplay(n)};t.on("loadstart",function(n){return u.toggleDisplay(n)});t.on("texttrackchange",e);t.on("loadedmetadata",function(n){return u.preselectTrack(n)});return t.ready(c(f(u),function(){var i,n;if(t.tech_&&t.tech_.featuresNativeTextTracks){this.hide();return}t.on("fullscreenchange",e);t.on("playerresize",e);window.addEventListener("orientationchange",e);t.on("dispose",function(){return window.removeEventListener("orientationchange",e)});for(i=this.options_.playerOptions.tracks||[],n=0;n<i.length;n++)this.player_.addRemoteTextTrack(i[n],!0);this.preselectTrack()})),u}i(r,n);var t=r.prototype;return t.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")},t.toggleDisplay=function(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()},t.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-text-track-display"},{translate:"yes","aria-live":"off","aria-atomic":"true"})},t.clearDisplay=function(){typeof WebVTT=="function"&&window.WebVTT.processCues(window,[],this.el_)},t.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))},t.updateDisplayState=function(n){for(var t=this.player_.textTrackSettings.getValues(),u=n.activeCues,f=u.length,r,i,e;f--;)(r=u[f],r)&&(i=r.displayState,t.color&&(i.firstChild.style.color=t.color),t.textOpacity&&rv(i.firstChild,"color",iv(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(i.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&rv(i.firstChild,"backgroundColor",iv(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?rv(i,"backgroundColor",iv(t.windowColor,t.windowOpacity)):i.style.backgroundColor=t.windowColor),t.edgeStyle&&(t.edgeStyle==="dropshadow"?i.firstChild.style.textShadow="2px 2px 3px "+ii+", 2px 2px 4px "+ii+", 2px 2px 5px "+ii:t.edgeStyle==="raised"?i.firstChild.style.textShadow="1px 1px "+ii+", 2px 2px "+ii+", 3px 3px "+ii:t.edgeStyle==="depressed"?i.firstChild.style.textShadow="1px 1px "+yg+", 0 1px "+yg+", -1px -1px "+ii+", 0 -1px "+ii:t.edgeStyle==="uniform"&&(i.firstChild.style.textShadow="0 0 4px "+ii+", 0 0 4px "+ii+", 0 0 4px "+ii+", 0 0 4px "+ii)),t.fontPercent&&t.fontPercent!==1&&(e=window.parseFloat(i.style.fontSize),i.style.fontSize=e*t.fontPercent+"px",i.style.height="auto",i.style.top="auto"),t.fontFamily&&t.fontFamily!=="default"&&(t.fontFamily==="small-caps"?i.firstChild.style.fontVariant="small-caps":i.firstChild.style.fontFamily=ilt[t.fontFamily]))},t.updateForTrack=function(n){var o,r,s,u,i,t,f,e;if(Array.isArray(n)||(n=[n]),typeof WebVTT=="function"&&!n.every(function(n){return!n.activeCues})){for(o=[],r=0;r<n.length;++r)for(s=n[r],u=0;u<s.activeCues.length;++u)o.push(s.activeCues[u]);for(window.WebVTT.processCues(window,o,this.el_),i=0;i<n.length;++i){for(t=n[i],f=0;f<t.activeCues.length;++f)e=t.activeCues[f].displayState,nr(e,"vjs-text-track-cue"),nr(e,"vjs-text-track-cue-"+(t.language?t.language:i)),t.language&&yu(e,"lang",t.language);this.player_.textTrackSettings&&this.updateDisplayState(t)}}},r}(t);t.registerComponent("TextTrackDisplay",pg);wg=function(n){function t(){return n.apply(this,arguments)||this}i(t,n);var r=t.prototype;return r.createEl=function(){var i=this.player_.isAudio(),r=this.localize(i?"Audio Player":"Video Player"),u=s("span",{className:"vjs-control-text",textContent: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}(t);t.registerComponent("LoadingSpinner",wg);ri=function(n){function u(){return n.apply(this,arguments)||this}i(u,n);var r=u.prototype;return r.createEl=function(n,t,i){t===void 0&&(t={});i===void 0&&(i={});n="button";t=v({className:this.buildCSSClass()},t);i=v({type:"button"},i);var r=s(n,t,i);return r.appendChild(s("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r},r.addChild=function(n,i){i===void 0&&(i={});var r=this.constructor.name;return o.warn("Adding an actionable (user controllable) child to a Button ("+r+") is not supported; use a ClickableComponent instead."),t.prototype.addChild.call(this,n,i)},r.enable=function(){n.prototype.enable.call(this);this.el_.removeAttribute("disabled")},r.disable=function(){n.prototype.disable.call(this);this.el_.setAttribute("disabled","disabled")},r.handleKeyDown=function(t){if(e.isEventKey(t,"Space")||e.isEventKey(t,"Enter")){t.stopPropagation();return}n.prototype.handleKeyDown.call(this,t)},u}(de);t.registerComponent("Button",ri);uv=function(n){function r(t,i){var r;r=n.call(this,t,i)||this;r.mouseused_=!1;r.on("mousedown",function(n){return r.handleMouseDown(n)});return r}i(r,n);var t=r.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;ci(t);!this.player_.tech(!0)||(se||oe)&&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()};ve(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},r}(ri);uv.prototype.controlText_="Play Video";t.registerComponent("BigPlayButton",uv);bg=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}i(t,n);var r=t.prototype;return r.buildCSSClass=function(){return"vjs-close-button "+n.prototype.buildCSSClass.call(this)},r.handleClick=function(){this.trigger({type:"close",bubbles:!1})},r.handleKeyDown=function(t){e.isEventKey(t,"Esc")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):n.prototype.handleKeyDown.call(this,t)},t}(ri);t.registerComponent("CloseButton",bg);fv=function(n){function r(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",function(n){return r.handlePlay(n)});r.on(t,"pause",function(n){return r.handlePause(n)});if(i.replay)r.on(t,"ended",function(n){return r.handleEnded(n)});return r}i(r,n);var t=r.prototype;return t.buildCSSClass=function(){return"vjs-play-control "+n.prototype.buildCSSClass.call(this)},t.handleClick=function(){this.player_.paused()?ci(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(){var n=this;this.removeClass("vjs-playing");this.addClass("vjs-ended");this.controlText("Replay");this.one(this.player_,"seeked",function(t){return n.handleSeeked(t)})},r}(ri);fv.prototype.controlText_="Play";t.registerComponent("PlayToggle",fv);ev=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};th=ev;ru=function(n){function r(t,i){var r=n.call(this,t,i)||this;r.on(t,["timeupdate","ended"],function(n){return r.updateContent(n)});return r.updateTextNode_(),r}i(r,n);var t=r.prototype;return t.createEl=function(){var i=this.buildCSSClass(),t=n.prototype.createEl.call(this,"div",{className:i+" vjs-time-control vjs-control"}),r=s("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+" "},{role:"presentation"});return t.appendChild(r),this.contentEl_=s("span",{className:i+"-display"},{"aria-live":"off",role:"presentation"}),t.appendChild(this.contentEl_),t},t.dispose=function(){this.contentEl_=null;this.textNode_=null;n.prototype.dispose.call(this)},t.updateTextNode_=function(n){var t=this;(n===void 0&&(n=0),n=gu(n),this.formattedTime_!==n)&&(this.formattedTime_=n,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",function(){if(t.contentEl_){var n=t.textNode_;(n&&t.contentEl_.firstChild!==n&&(n=null,o.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),t.textNode_=document.createTextNode(t.formattedTime_),t.textNode_)&&(n?t.contentEl_.replaceChild(t.textNode_,n):t.contentEl_.appendChild(t.textNode_))}}))},t.updateContent=function(){},r}(t);ru.prototype.labelText_="Time";ru.prototype.controlText_="Time";t.registerComponent("TimeDisplay",ru);ih=function(n){function t(){return n.apply(this,arguments)||this}i(t,n);var r=t.prototype;return r.buildCSSClass=function(){return"vjs-current-time"},r.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}(ru);ih.prototype.labelText_="Current Time";ih.prototype.controlText_="Current Time";t.registerComponent("CurrentTimeDisplay",ih);rh=function(n){function t(t,i){var r,u;r=n.call(this,t,i)||this;u=function(n){return r.updateContent(n)};r.on(t,"durationchange",u);r.on(t,"loadstart",u);r.on(t,"loadedmetadata",u);return r}i(t,n);var r=t.prototype;return r.buildCSSClass=function(){return"vjs-duration"},r.updateContent=function(){var n=this.player_.duration();this.updateTextNode_(n)},t}(ru);rh.prototype.labelText_="Duration";rh.prototype.controlText_="Duration";t.registerComponent("DurationDisplay",rh);kg=function(n){function t(){return n.apply(this,arguments)||this}i(t,n);var r=t.prototype;return r.createEl=function(){var t=n.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),i=n.prototype.createEl.call(this,"div"),r=n.prototype.createEl.call(this,"span",{textContent:"/"});return i.appendChild(r),t.appendChild(i),t},t}(t);t.registerComponent("TimeDivider",kg);uh=function(n){function t(t,i){var r=n.call(this,t,i)||this;r.on(t,"durationchange",function(n){return r.updateContent(n)});return r}i(t,n);var r=t.prototype;return r.buildCSSClass=function(){return"vjs-remaining-time"},r.createEl=function(){var t=n.prototype.createEl.call(this);return t.insertBefore(s("span",{},{"aria-hidden":!0},"-"),this.contentEl_),t},r.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}(ru);uh.prototype.labelText_="Remaining Time";uh.prototype.controlText_="Remaining Time";t.registerComponent("RemainingTimeDisplay",uh);dg=function(n){function t(t,i){var r;r=n.call(this,t,i)||this;r.updateShowing();r.on(r.player(),"durationchange",function(n){return r.updateShowing(n)});return r}i(t,n);var r=t.prototype;return r.createEl=function(){var t=n.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});return this.contentEl_=s("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(s("span",{className:"vjs-control-text",textContent:this.localize("Stream Type")+" "})),this.contentEl_.appendChild(document.createTextNode(this.localize("LIVE"))),t.appendChild(this.contentEl_),t},r.dispose=function(){this.contentEl_=null;n.prototype.dispose.call(this)},r.updateShowing=function(){this.player().duration()===Infinity?this.show():this.hide()},t}(t);t.registerComponent("LiveDisplay",dg);ov=function(n){function r(t,i){var r;if(r=n.call(this,t,i)||this,r.updateLiveEdgeStatus(),r.player_.liveTracker){r.updateLiveEdgeStatusHandler_=function(n){return r.updateLiveEdgeStatus(n)};r.on(r.player_.liveTracker,"liveedgechange",r.updateLiveEdgeStatusHandler_)}return r}i(r,n);var t=r.prototype;return t.createEl=function(){var t=n.prototype.createEl.call(this,"button",{className:"vjs-seek-to-live-control vjs-control"});return this.textEl_=s("span",{className:"vjs-seek-to-live-text",textContent: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.updateLiveEdgeStatusHandler_);this.textEl_=null;n.prototype.dispose.call(this)},r}(ri);ov.prototype.controlText_="Seek to live, currently playing live";t.registerComponent("SeekToLive",ov);ge=function(n,t,i){return n=Number(n),Math.min(i,Math.max(t,isNaN(n)?t:n))};fh=function(n){function r(t,i){var r;return r=n.call(this,t,i)||this,r.handleMouseDown_=function(n){return r.handleMouseDown(n)},r.handleMouseUp_=function(n){return r.handleMouseUp(n)},r.handleKeyDown_=function(n){return r.handleKeyDown(n)},r.handleClick_=function(n){return r.handleClick(n)},r.handleMouseMove_=function(n){return r.handleMouseMove(n)},r.update_=function(n){return r.update(n)},r.bar=r.getChild(r.options_.barName),r.vertical(!!r.options_.vertical),r.enable(),r}i(r,n);var t=r.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=v({tabIndex:0},i),r=v({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"||gi||n.preventDefault();uk();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,!0)},t.handleMouseMove=function(){},t.handleMouseUp=function(){var n=this.bar.el_.ownerDocument;fk();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.requestNamedAnimationFrame("Slider#update",function(){var i=t.vertical()?"height":"width";t.bar.el().style[i]=(n*100).toFixed(2)+"%"}),n)},t.getProgress=function(){return Number(ge(this.getPercent(),0,1).toFixed(4))},t.calculateDistance=function(n){var t=ss(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")},r}(t);t.registerComponent("Slider",fh);eh=function(n,t){return ge(n/t*100,0,100).toFixed(2)+"%"};gg=function(n){function t(t,i){var r;r=n.call(this,t,i)||this;r.partEls_=[];r.on(t,"progress",function(n){return r.update(n)});return r}i(t,n);var r=t.prototype;return r.createEl=function(){var i=n.prototype.createEl.call(this,"div",{className:"vjs-load-progress"}),t=s("span",{className:"vjs-control-text"}),r=s("span",{textContent:this.localize("Loaded")}),u=document.createTextNode(": ");return this.percentageEl_=s("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),i.appendChild(t),t.appendChild(r),t.appendChild(u),t.appendChild(this.percentageEl_),i},r.dispose=function(){this.partEls_=null;this.percentageEl_=null;n.prototype.dispose.call(this)},r.update=function(){var n=this;this.requestNamedAnimationFrame("LoadProgressBar#update",function(){var h=n.player_.liveTracker,r=n.player_.buffered(),a=h&&h.isLive()?h.seekableEnd():n.player_.duration(),c=n.player_.bufferedEnd(),u=n.partEls_,f=eh(c,a),i,o;for(n.percent_!==f&&(n.el_.style.width=f,yr(n.percentageEl_,f),n.percent_=f),i=0;i<r.length;i++){var e=r.start(i),l=r.end(i),t=u[i];(t||(t=n.el_.appendChild(s()),u[i]=t),t.dataset.start!==e||t.dataset.end!==l)&&(t.dataset.start=e,t.dataset.end=l,t.style.left=eh(e,c),t.style.width=eh(l-e,c))}for(o=u.length;o>r.length;o--)n.el_.removeChild(u[o-1]);u.length=r.length})},t}(t);t.registerComponent("LoadProgressBar",gg);nn=function(n){function r(t,i){var r;return r=n.call(this,t,i)||this,r.update=ir(c(f(r),r.update),ui),r}i(r,n);var t=r.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=ce(this.el_),f=pu(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);r=Math.round(r);this.el_.style.right="-"+r+"px";this.write(i)}},t.write=function(n){yr(this.el_,n)},t.updateTime=function(n,t,i,r){var u=this;this.requestNamedAnimationFrame("TimeTooltip#updateTime",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?"":"-")+gu(o,f)):e=gu(i,s);u.update(n,t,e);r&&r()})},r}(t);t.registerComponent("TimeTooltip",nn);oh=function(n){function t(t,i){var r;return r=n.call(this,t,i)||this,r.update=ir(c(f(r),r.update),ui),r}i(t,n);var r=t.prototype;return r.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})},r.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}(t);oh.prototype.options_={children:[]};ct||di||oh.prototype.options_.children.push("timeTooltip");t.registerComponent("PlayProgressBar",oh);sv=function(n){function t(t,i){var r;return r=n.call(this,t,i)||this,r.update=ir(c(f(r),r.update),ui),r}i(t,n);var r=t.prototype;return r.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},r.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}(t);sv.prototype.options_={children:["timeTooltip"]};t.registerComponent("MouseTimeDisplay",sv);var sh=5,tn=12,hv=function(n){function r(t,i){var r;return r=n.call(this,t,i)||this,r.setEventHandlers_(),r}i(r,n);var t=r.prototype;return t.setEventHandlers_=function(){var n=this;this.update_=c(this,this.update);this.update=ir(this.update_,ui);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.enableIntervalHandler_=function(t){return n.enableInterval_(t)};this.disableIntervalHandler_=function(t){return n.disableInterval_(t)};this.on(this.player_,["playing"],this.enableIntervalHandler_);this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_);if("hidden"in document&&"visibilityState"in document)this.on(document,"visibilitychange",this.toggleVisibility_)},t.toggleVisibility_=function(n){document.visibilityState==="hidden"?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(n)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())},t.enableInterval_=function(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,ui))},t.disableInterval_=function(n){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&n&&n.type!=="ended"||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)},t.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},t.update=function(){var t=this,i;if(document.visibilityState!=="hidden")return i=n.prototype.update.call(this),this.requestNamedAnimationFrame("SeekBar#update",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}",[gu(r,n),gu(n,n)],"{1} of {2}")),t.currentTime_=r,t.duration_=n);t.bar&&t.bar.update(pu(t.el()),t.getProgress())}),i},t.userSeek_=function(n){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser();this.player_.currentTime(n)},t.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()},t.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},t.handleMouseDown=function(t){le(t)&&(t.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),n.prototype.handleMouseDown.call(this,t))},t.handleMouseMove=function(n,t){var i,u,r,f,e;if(t===void 0&&(t=!1),le(n)){if(t||this.player_.scrubbing()||this.player_.scrubbing(!0),u=this.calculateDistance(n),r=this.player_.liveTracker,r&&r.isLive()){if(u>=.99){r.seekToLiveEdge();return}if(f=r.seekableStart(),e=r.liveCurrentTime(),i=f+u*r.liveWindow(),i>=e&&(i=e),i<=f&&(i=f+.1),i===Infinity)return}else i=u*this.player_.duration(),i===this.player_.duration()&&(i=i-.1);this.userSeek_(i)}},t.enable=function(){n.prototype.enable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.show()},t.disable=function(){n.prototype.disable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.hide()},t.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?ci(this.player_.play()):this.update_()},t.stepForward=function(){this.userSeek_(this.player_.currentTime()+sh)},t.stepBack=function(){this.userSeek_(this.player_.currentTime()-sh)},t.handleAction=function(){this.player_.paused()?this.player_.play():this.player_.pause()},t.handleKeyDown=function(t){var i=this.player_.liveTracker,r;e.isEventKey(t,"Space")||e.isEventKey(t,"Enter")?(t.preventDefault(),t.stopPropagation(),this.handleAction(t)):e.isEventKey(t,"Home")?(t.preventDefault(),t.stopPropagation(),this.userSeek_(0)):e.isEventKey(t,"End")?(t.preventDefault(),t.stopPropagation(),i&&i.isLive()?this.userSeek_(i.liveCurrentTime()):this.userSeek_(this.player_.duration())):/^[0-9]$/.test(e(t))?(t.preventDefault(),t.stopPropagation(),r=(e.codes[e(t)]-e.codes["0"])/10,i&&i.isLive()?this.userSeek_(i.seekableStart()+i.liveWindow()*r):this.userSeek_(this.player_.duration()*r)):e.isEventKey(t,"PgDn")?(t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()-sh*tn)):e.isEventKey(t,"PgUp")?(t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()+sh*tn)):n.prototype.handleKeyDown.call(this,t)},t.dispose=function(){this.disableInterval_();this.off(this.player_,["ended","durationchange","timeupdate"],this.update);this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update);this.off(this.player_,["playing"],this.enableIntervalHandler_);this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_);"hidden"in document&&"visibilityState"in document&&this.off(document,"visibilitychange",this.toggleVisibility_);n.prototype.dispose.call(this)},r}(fh);hv.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"};ct||di||hv.prototype.options_.children.splice(1,0,"mouseTimeDisplay");t.registerComponent("SeekBar",hv);cv=function(n){function r(t,i){var r;return r=n.call(this,t,i)||this,r.handleMouseMove=ir(c(f(r),r.handleMouseMove),ui),r.throttledHandleMouseSeek=ir(c(f(r),r.handleMouseSeek),ui),r.handleMouseUpHandler_=function(n){return r.handleMouseUp(n)},r.handleMouseDownHandler_=function(n){return r.handleMouseDown(n)},r.enable(),r}i(r,n);var t=r.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=ce(f),u=ss(f,n).x;u=ge(u,0,1);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(){if((this.children().forEach(function(n){return n.disable&&n.disable()}),this.enabled())&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){var n=this.getChild("seekBar");this.player_.scrubbing(!1);n.videoWasPlaying&&ci(this.player_.play())}},t.enable=function(){if(this.children().forEach(function(n){return n.enable&&n.enable()}),!this.enabled()){this.on(["mousedown","touchstart"],this.handleMouseDownHandler_);this.on(this.el_,"mousemove",this.handleMouseMove);this.removeClass("disabled");this.enabled_=!0}},t.removeListenersAddedOnMousedownAndTouchstart=function(){var n=this.el_.ownerDocument;this.off(n,"mousemove",this.throttledHandleMouseSeek);this.off(n,"touchmove",this.throttledHandleMouseSeek);this.off(n,"mouseup",this.handleMouseUpHandler_);this.off(n,"touchend",this.handleMouseUpHandler_)},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.handleMouseUpHandler_);this.on(t,"touchend",this.handleMouseUpHandler_)},t.handleMouseUp=function(n){var t=this.getChild("seekBar");t&&t.handleMouseUp(n);this.removeListenersAddedOnMousedownAndTouchstart()},r}(t);cv.prototype.options_={children:["seekBar"]};t.registerComponent("ProgressControl",cv);lv=function(n){function r(t,i){var r=n.call(this,t,i)||this;r.on(t,["enterpictureinpicture","leavepictureinpicture"],function(n){return r.handlePictureInPictureChange(n)});r.on(t,["disablepictureinpicturechanged","loadedmetadata"],function(n){return r.handlePictureInPictureEnabledChange(n)});return r.disable(),r}i(r,n);var t=r.prototype;return t.buildCSSClass=function(){return"vjs-picture-in-picture-control "+n.prototype.buildCSSClass.call(this)},t.handlePictureInPictureEnabledChange=function(){document.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1?this.enable():this.disable()},t.handlePictureInPictureChange=function(){this.player_.isInPictureInPicture()?this.controlText("Exit Picture-in-Picture"):this.controlText("Picture-in-Picture");this.handlePictureInPictureEnabledChange()},t.handleClick=function(){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()},r}(ri);lv.prototype.controlText_="Picture-in-Picture";t.registerComponent("PictureInPictureToggle",lv);av=function(n){function t(t,i){var r=n.call(this,t,i)||this;r.on(t,"fullscreenchange",function(n){return r.handleFullscreenChange(n)});return document[t.fsApi_.fullscreenEnabled]===!1&&r.disable(),r}i(t,n);var r=t.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()},t}(ri);av.prototype.controlText_="Fullscreen";t.registerComponent("FullscreenToggle",av);rn=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")})};un=function(n){function t(){return n.apply(this,arguments)||this}i(t,n);var r=t.prototype;return r.createEl=function(){var t=n.prototype.createEl.call(this,"div",{className:"vjs-volume-level"});return t.appendChild(n.prototype.createEl.call(this,"span",{className:"vjs-control-text"})),t},t}(t);t.registerComponent("VolumeLevel",un);fn=function(n){function r(t,i){var r;return r=n.call(this,t,i)||this,r.update=ir(c(f(r),r.update),ui),r}i(r,n);var t=r.prototype;return t.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})},t.update=function(n,t,i,r){if(!i){var f=pu(this.el_),e=pu(this.player_.el()),o=n.width*t;if(!e||!f)return;var s=n.left-e.left+o,h=n.width-o+(e.right-n.right),u=f.width/2;s<u?u+=u-s:h<u&&(u=h);u<0?u=0:u>f.width&&(u=f.width);this.el_.style.right="-"+u+"px"}this.write(r+"%")},t.write=function(n){yr(this.el_,n)},t.updateVolume=function(n,t,i,r,u){var f=this;this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",function(){f.update(n,t,i,r.toFixed(0));u&&u()})},r}(t);t.registerComponent("VolumeLevelTooltip",fn);vv=function(n){function t(t,i){var r;return r=n.call(this,t,i)||this,r.update=ir(c(f(r),r.update),ui),r}i(t,n);var r=t.prototype;return r.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},r.update=function(n,t,i){var r=this,u=100*t;this.getChild("volumeLevelTooltip").updateVolume(n,t,i,u,function(){i?r.el_.style.bottom=n.height*t+"px":r.el_.style.left=n.width*t+"px"})},t}(t);vv.prototype.options_={children:["volumeLevelTooltip"]};t.registerComponent("MouseVolumeLevelDisplay",vv);no=function(n){function r(t,i){var r=n.call(this,t,i)||this;r.on("slideractive",function(n){return r.updateLastVolume_(n)});r.on(t,"volumechange",function(n){return r.updateARIAAttributes(n)});return t.ready(function(){return r.updateARIAAttributes()}),r}i(r,n);var t=r.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){le(t)&&n.prototype.handleMouseDown.call(this,t)},t.handleMouseMove=function(n){var i=this.getChild("mouseVolumeLevelDisplay");if(i){var r=this.el(),f=pu(r),u=this.vertical(),t=ss(r,n);t=u?t.y:t.x;t=ge(t,0,1);i.update(f,t,u)}le(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)})},r}(fh);no.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};ct||di||no.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");no.prototype.playerEvent="volumechange";t.registerComponent("VolumeBar",no);yv=function(n){function r(t,i){var r;i===void 0&&(i={});i.vertical=i.vertical||!1;(typeof i.volumeBar=="undefined"||fe(i.volumeBar))&&(i.volumeBar=i.volumeBar||{},i.volumeBar.vertical=i.vertical);r=n.call(this,t,i)||this;rn(f(r),t);r.throttledHandleMouseMove=ir(c(f(r),r.handleMouseMove),ui);r.handleMouseUpHandler_=function(n){return r.handleMouseUp(n)};r.on("mousedown",function(n){return r.handleMouseDown(n)});r.on("touchstart",function(n){return r.handleMouseDown(n)});r.on("mousemove",function(n){return r.handleMouseMove(n)});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}i(r,n);var t=r.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.handleMouseUpHandler_);this.on(n,"touchend",this.handleMouseUpHandler_)},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.handleMouseUpHandler_);this.off(n,"touchend",this.handleMouseUpHandler_)},t.handleMouseMove=function(n){this.volumeBar.handleMouseMove(n)},r}(t);yv.prototype.options_={children:["volumeBar"]};t.registerComponent("VolumeControl",yv);en=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")})};pv=function(n){function r(t,i){var r;r=n.call(this,t,i)||this;en(f(r),t);r.on(t,["loadstart","volumechange"],function(n){return r.update(n)});return r}i(r,n);var t=r.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(ct&&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++)he(this.el_,"vjs-vol-"+t);nr(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)},r}(ri);pv.prototype.controlText_="Mute";t.registerComponent("MuteToggle",pv);wv=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"||fe(i.volumeControl))&&(i.volumeControl=i.volumeControl||{},i.volumeControl.vertical=!i.inline);r=n.call(this,t,i)||this;r.handleKeyPressHandler_=function(n){return r.handleKeyPress(n)};r.on(t,["loadstart"],function(n){return r.volumePanelState_(n)});r.on(r.muteToggle,"keyup",function(n){return r.handleKeyPress(n)});r.on(r.volumeControl,"keyup",function(n){return r.handleVolumeControlKeyUp(n)});r.on("keydown",function(n){return r.handleKeyPress(n)});r.on("mouseover",function(n){return r.handleMouseOver(n)});r.on("mouseout",function(n){return r.handleMouseOut(n)});r.on(r.volumeControl,["slideractive"],r.sliderActive_);r.on(r.volumeControl,["sliderinactive"],r.sliderInactive_);return r}i(r,n);var t=r.prototype;return t.sliderActive_=function(){this.addClass("vjs-slider-active")},t.sliderInactive_=function(){this.removeClass("vjs-slider-active")},t.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")},t.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})},t.dispose=function(){this.handleMouseOut();n.prototype.dispose.call(this)},t.handleVolumeControlKeyUp=function(n){e.isEventKey(n,"Esc")&&this.muteToggle.focus()},t.handleMouseOver=function(){this.addClass("vjs-hover");bt(document,"keyup",this.handleKeyPressHandler_)},t.handleMouseOut=function(){this.removeClass("vjs-hover");rt(document,"keyup",this.handleKeyPressHandler_)},t.handleKeyPress=function(n){e.isEventKey(n,"Esc")&&this.handleMouseOut()},r}(t);wv.prototype.options_={children:["muteToggle","volumeControl"]};t.registerComponent("VolumePanel",wv);bv=function(n){function u(t,i){var r;r=n.call(this,t,i)||this;i&&(r.menuButton_=i.menuButton);r.focusedChild_=-1;r.on("keydown",function(n){return r.handleKeyDown(n)});return r.boundHandleBlur_=function(n){return r.handleBlur(n)},r.boundHandleTapClick_=function(n){return r.handleTapClick(n)},r}i(u,n);var r=u.prototype;return r.addEventListenerForItem=function(n){if(n instanceof t){this.on(n,"blur",this.boundHandleBlur_);this.on(n,["tap","click"],this.boundHandleTapClick_)}},r.removeEventListenerForItem=function(n){n instanceof t&&(this.off(n,"blur",this.boundHandleBlur_),this.off(n,["tap","click"],this.boundHandleTapClick_))},r.removeChild=function(t){typeof t=="string"&&(t=this.getChild(t));this.removeEventListenerForItem(t);n.prototype.removeChild.call(this,t)},r.addItem=function(n){var t=this.addChild(n);t&&this.addEventListenerForItem(t)},r.createEl=function(){var i=this.options_.contentElType||"ul",t;return this.contentEl_=s(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_),bt(t,"click",function(n){n.preventDefault();n.stopImmediatePropagation()}),t},r.dispose=function(){this.contentEl_=null;this.boundHandleBlur_=null;this.boundHandleTapClick_=null;n.prototype.dispose.call(this)},r.handleBlur=function(n){var i=n.relatedTarget||document.activeElement,t;this.children().some(function(n){return n.el()===i})||(t=this.menuButton_,t&&t.buttonPressed_&&i!==t.el().firstChild&&t.unpressButton())},r.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()}},r.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())},r.stepForward=function(){var n=0;this.focusedChild_!==undefined&&(n=this.focusedChild_+1);this.focus(n)},r.stepBack=function(){var n=0;this.focusedChild_!==undefined&&(n=this.focusedChild_-1);this.focus(n)},r.focus=function(n){n===void 0&&(n=0);var t=this.children().slice(),i=t.length&&t[0].hasClass("vjs-menu-title");i&&t.shift();t.length>0&&(n<0?n=0:n>=t.length&&(n=t.length-1),this.focusedChild_=n,t[n].el_.focus())},u}(t);t.registerComponent("Menu",bv);hh=function(n){function u(t,i){var r,f,u;i===void 0&&(i={});r=n.call(this,t,i)||this;r.menuButton_=new ri(t,i);r.menuButton_.controlText(r.controlText_);r.menuButton_.el_.setAttribute("aria-haspopup","true");f=ri.prototype.buildCSSClass();r.menuButton_.el_.className=r.buildCSSClass()+" "+f;r.menuButton_.removeClass("vjs-control");r.addChild(r.menuButton_);r.update();r.enabled_=!0;u=function(n){return r.handleClick(n)};r.handleMenuKeyUp_=function(n){return r.handleMenuKeyUp(n)};r.on(r.menuButton_,"tap",u);r.on(r.menuButton_,"click",u);r.on(r.menuButton_,"keydown",function(n){return r.handleKeyDown(n)});r.on(r.menuButton_,"mouseenter",function(){r.addClass("vjs-hover");r.menu.show();bt(document,"keyup",r.handleMenuKeyUp_)});r.on("mouseleave",function(n){return r.handleMouseLeave(n)});r.on("keydown",function(n){return r.handleSubmenuKeyDown(n)});return r}i(u,n);var r=u.prototype;return r.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()},r.createMenu=function(){var i=new bv(this.player_,{menuButton:this}),r,u,n;if(this.hideThreshold_=0,this.options_.title&&(r=s("li",{className:"vjs-menu-title",textContent:y(this.options_.title),tabIndex:-1}),u=new t(this.player_,{el:r}),i.addItem(u)),this.items=this.createItems(),this.items)for(n=0;n<this.items.length;n++)i.addItem(this.items[n]);return i},r.createItems=function(){},r.createEl=function(){return n.prototype.createEl.call(this,"div",{className:this.buildWrapperCSSClass()},{})},r.buildWrapperCSSClass=function(){var t="vjs-menu-button",i;return t+=this.options_.inline===!0?"-inline":"-popup",i=ri.prototype.buildCSSClass(),"vjs-menu-button "+t+" "+i+" "+n.prototype.buildCSSClass.call(this)},r.buildCSSClass=function(){var t="vjs-menu-button";return t+=this.options_.inline===!0?"-inline":"-popup","vjs-menu-button "+t+" "+n.prototype.buildCSSClass.call(this)},r.controlText=function(n,t){return t===void 0&&(t=this.menuButton_.el()),this.menuButton_.controlText(n,t)},r.dispose=function(){this.handleMouseLeave();n.prototype.dispose.call(this)},r.handleClick=function(){this.buttonPressed_?this.unpressButton():this.pressButton()},r.handleMouseLeave=function(){this.removeClass("vjs-hover");rt(document,"keyup",this.handleMenuKeyUp_)},r.focus=function(){this.menuButton_.focus()},r.blur=function(){this.menuButton_.blur()},r.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()))},r.handleMenuKeyUp=function(n){(e.isEventKey(n,"Esc")||e.isEventKey(n,"Tab"))&&this.removeClass("vjs-hover")},r.handleSubmenuKeyPress=function(n){this.handleSubmenuKeyDown(n)},r.handleSubmenuKeyDown=function(n){(e.isEventKey(n,"Esc")||e.isEventKey(n,"Tab"))&&(this.buttonPressed_&&this.unpressButton(),e.isEventKey(n,"Tab")||(n.preventDefault(),this.menuButton_.focus()))},r.pressButton=function(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),ct&&gb())return;this.menu.focus()}},r.unpressButton=function(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))},r.disable=function(){this.unpressButton();this.enabled_=!1;this.addClass("vjs-disabled");this.menuButton_.disable()},r.enable=function(){this.enabled_=!0;this.removeClass("vjs-disabled");this.menuButton_.enable()},u}(t);t.registerComponent("MenuButton",hh);ch=function(n){function t(t,i){var r,e=i.tracks,u;if(r=n.call(this,t,i)||this,r.items.length<=1&&r.hide(),!e)return f(r);u=c(f(r),r.update);e.addEventListener("removetrack",u);e.addEventListener("addtrack",u);e.addEventListener("labelchange",u);r.player_.on("ready",u);r.player_.on("dispose",function(){e.removeEventListener("removetrack",u);e.removeEventListener("addtrack",u);e.removeEventListener("labelchange",u)});return r}return i(t,n),t}(hh);t.registerComponent("TrackButton",ch);on=["Tab","Esc","Up","Down","Right","Left"];nf=function(n){function r(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}i(r,n);var t=r.prototype;return t.createEl=function(t,i,r){this.nonIconControl=!0;var u=n.prototype.createEl.call(this,"li",v({className:"vjs-menu-item",tabIndex:-1},i),r);return u.replaceChild(s("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)}),u.querySelector(".vjs-icon-placeholder")),u},t.handleKeyDown=function(t){on.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))},r}(de);t.registerComponent("MenuItem",nf);tf=function(n){function r(t,i){var r,s=i.track,u=t.textTracks(),e,h,o;i.label=s.label||s.language||"Unknown";i.selected=s.mode==="showing";r=n.call(this,t,i)||this;r.track=s;r.kinds=(i.kinds||[i.kind||r.track.kind]).filter(Boolean);e=function(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];r.handleTracksChange.apply(f(r),i)};h=function(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];r.handleSelectedLanguageChange.apply(f(r),i)};t.on(["loadstart","texttrackchange"],e);u.addEventListener("change",e);u.addEventListener("selectedlanguagechange",h);r.on("dispose",function(){t.off(["loadstart","texttrackchange"],e);u.removeEventListener("change",e);u.removeEventListener("selectedlanguagechange",h)});if(u.onchange===undefined)r.on(["tap","click"],function(){if(typeof Event!="object")try{o=new window.Event("change")}catch(n){}o||(o=document.createEvent("Event"),o.initEvent("change",!0,!0));u.dispatchEvent(o)});return r.handleTracksChange(),r}i(r,n);var t=r.prototype;return t.handleClick=function(t){var f=this.track,u=this.player_.textTracks(),r,i;if(n.prototype.handleClick.call(this,t),u)for(r=0;r<u.length;r++)(i=u[r],this.kinds.indexOf(i.kind)!==-1)&&(i===f?i.mode!=="showing"&&(i.mode="showing"):i.mode!=="disabled"&&(i.mode="disabled"))},t.handleTracksChange=function(){var n=this.track.mode==="showing";n!==this.isSelected_&&this.selected(n)},t.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}}},t.dispose=function(){this.track=null;n.prototype.dispose.call(this)},r}(nf);t.registerComponent("TextTrackMenuItem",tf);kv=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}i(t,n);var r=t.prototype;return r.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)},r.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}(tf);t.registerComponent("OffTextTrackMenuItem",kv);uu=function(n){function t(t,i){return i===void 0&&(i={}),i.tracks=t.textTracks(),n.call(this,t,i)||this}i(t,n);var r=t.prototype;return r.createItems=function(n,t){var e,u,i,r,f;for(n===void 0&&(n=[]),t===void 0&&(t=tf),this.label_&&(e=this.label_+" off"),n.push(new kv(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}(ch);t.registerComponent("TextTrackButton",uu);dv=function(n){function t(t,i){var r,e=i.track,u=i.cue,o=t.currentTime();return i.selectable=!0,i.multiSelectable=!1,i.label=u.text,i.selected=u.startTime<=o&&o<u.endTime,r=n.call(this,t,i)||this,r.track=e,r.cue=u,e.addEventListener("cuechange",c(f(r),r.update)),r}i(t,n);var r=t.prototype;return r.handleClick=function(){n.prototype.handleClick.call(this);this.player_.currentTime(this.cue.startTime);this.update(this.cue.startTime)},r.update=function(){var n=this.cue,t=this.player_.currentTime();this.selected(n.startTime<=t&&t<n.endTime)},t}(nf);t.registerComponent("ChaptersTrackMenuItem",dv);lh=function(n){function r(t,i,r){return n.call(this,t,i,r)||this}i(r,n);var t=r.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(y(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 dv(this.player_,{track:this.track_,cue:u}),i.push(f);return i},r}(uu);lh.prototype.kind_="chapters";lh.prototype.controlText_="Chapters";t.registerComponent("ChaptersButton",lh);ah=function(n){function t(t,i,r){var u,e,o;u=n.call(this,t,i,r)||this;e=t.textTracks();o=c(f(u),u.handleTracksChange);e.addEventListener("change",o);u.on("dispose",function(){e.removeEventListener("change",o)});return u}i(t,n);var r=t.prototype;return r.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()},r.buildCSSClass=function(){return"vjs-descriptions-button "+n.prototype.buildCSSClass.call(this)},r.buildWrapperCSSClass=function(){return"vjs-descriptions-button "+n.prototype.buildWrapperCSSClass.call(this)},t}(uu);ah.prototype.kind_="descriptions";ah.prototype.controlText_="Descriptions";t.registerComponent("DescriptionsButton",ah);vh=function(n){function t(t,i,r){return n.call(this,t,i,r)||this}i(t,n);var r=t.prototype;return r.buildCSSClass=function(){return"vjs-subtitles-button "+n.prototype.buildCSSClass.call(this)},r.buildWrapperCSSClass=function(){return"vjs-subtitles-button "+n.prototype.buildWrapperCSSClass.call(this)},t}(uu);vh.prototype.kind_="subtitles";vh.prototype.controlText_="Subtitles";t.registerComponent("SubtitlesButton",vh);yh=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}i(t,n);var r=t.prototype;return r.handleClick=function(){this.player().getChild("textTrackSettings").open()},t}(tf);t.registerComponent("CaptionSettingsMenuItem",yh);ph=function(n){function t(t,i,r){return n.call(this,t,i,r)||this}i(t,n);var r=t.prototype;return r.buildCSSClass=function(){return"vjs-captions-button "+n.prototype.buildCSSClass.call(this)},r.buildWrapperCSSClass=function(){return"vjs-captions-button "+n.prototype.buildWrapperCSSClass.call(this)},r.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new yh(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),n.prototype.createItems.call(this,t)},t}(uu);ph.prototype.kind_="captions";ph.prototype.controlText_="Captions";t.registerComponent("CaptionsButton",ph);gv=function(n){function t(){return n.apply(this,arguments)||this}i(t,n);var r=t.prototype;return r.createEl=function(t,i,r){var u=n.prototype.createEl.call(this,t,i,r),f=u.querySelector(".vjs-menu-item-text");return this.options_.track.kind==="captions"&&(f.appendChild(s("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),f.appendChild(s("span",{className:"vjs-control-text",textContent:" "+this.localize("Captions")}))),u},t}(tf);t.registerComponent("SubsCapsMenuItem",gv);wh=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(y(r.label_)),r}i(t,n);var r=t.prototype;return r.buildCSSClass=function(){return"vjs-subs-caps-button "+n.prototype.buildCSSClass.call(this)},r.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+n.prototype.buildWrapperCSSClass.call(this)},r.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new yh(this.player_,{kind:this.label_})),this.hideThreshold_+=1),n.prototype.createItems.call(this,t,gv)},t}(uu);wh.prototype.kinds_=["captions","subtitles"];wh.prototype.controlText_="Subtitles";t.registerComponent("SubsCapsButton",wh);ny=function(n){function t(t,i){var r,u=i.track,o=t.audioTracks(),e;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");e=function(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];r.handleTracksChange.apply(f(r),i)};o.addEventListener("change",e);r.on("dispose",function(){o.removeEventListener("change",e)});return r}i(t,n);var r=t.prototype;return r.createEl=function(t,i,r){var u=n.prototype.createEl.call(this,t,i,r),f=u.querySelector(".vjs-menu-item-text");return this.options_.track.kind==="main-desc"&&(f.appendChild(s("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),f.appendChild(s("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),u},r.handleClick=function(t){var u,i,r;if(n.prototype.handleClick.call(this,t),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks)for(u=this.player_.audioTracks(),i=0;i<u.length;i++)(r=u[i],r!==this.track)&&(r.enabled=r===this.track)},r.handleTracksChange=function(){this.selected(this.track.enabled)},t}(nf);t.registerComponent("AudioTrackMenuItem",ny);ty=function(n){function t(t,i){return i===void 0&&(i={}),i.tracks=t.audioTracks(),n.call(this,t,i)||this}i(t,n);var r=t.prototype;return r.buildCSSClass=function(){return"vjs-audio-button "+n.prototype.buildCSSClass.call(this)},r.buildWrapperCSSClass=function(){return"vjs-audio-button "+n.prototype.buildWrapperCSSClass.call(this)},r.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 ny(this.player_,{track:r,selectable:!0,multiSelectable:!1}));return n},t}(ch);ty.prototype.controlText_="Audio Track";t.registerComponent("AudioTrackButton",ty);bh=function(n){function t(t,i){var r,u=i.rate,f=parseFloat(u,10);i.label=u;i.selected=f===t.playbackRate();i.selectable=!0;i.multiSelectable=!1;r=n.call(this,t,i)||this;r.label=u;r.rate=f;r.on(t,"ratechange",function(n){return r.update(n)});return r}i(t,n);var r=t.prototype;return r.handleClick=function(){n.prototype.handleClick.call(this);this.player().playbackRate(this.rate)},r.update=function(){this.selected(this.player().playbackRate()===this.rate)},t}(nf);bh.prototype.contentElType="button";t.registerComponent("PlaybackRateMenuItem",bh);iy=function(n){function r(t,i){var r;r=n.call(this,t,i)||this;r.menuButton_.el_.setAttribute("aria-describedby",r.labelElId_);r.updateVisibility();r.updateLabel();r.on(t,"loadstart",function(n){return r.updateVisibility(n)});r.on(t,"ratechange",function(n){return r.updateLabel(n)});r.on(t,"playbackrateschange",function(n){return r.handlePlaybackRateschange(n)});return r}i(r,n);var t=r.prototype;return t.createEl=function(){var t=n.prototype.createEl.call(this);return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=s("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"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.createItems=function(){for(var t=this.playbackRates(),i=[],n=t.length-1;n>=0;n--)i.push(new bh(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.handlePlaybackRateschange=function(){this.update()},t.playbackRates=function(){var n=this.player();return n.playbackRates&&n.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_.textContent=this.player().playbackRate()+"x")},r}(hh);iy.prototype.controlText_="Playback Rate";t.registerComponent("PlaybackRateMenuButton",iy);ry=function(n){function t(){return n.apply(this,arguments)||this}i(t,n);var r=t.prototype;return r.buildCSSClass=function(){return"vjs-spacer "+n.prototype.buildCSSClass.call(this)},r.createEl=function(t,i,r){return t===void 0&&(t="div"),i===void 0&&(i={}),r===void 0&&(r={}),i.className||(i.className=this.buildCSSClass()),n.prototype.createEl.call(this,t,i,r)},t}(t);t.registerComponent("Spacer",ry);sn=function(n){function t(){return n.apply(this,arguments)||this}i(t,n);var r=t.prototype;return r.buildCSSClass=function(){return"vjs-custom-control-spacer "+n.prototype.buildCSSClass.call(this)},r.createEl=function(){return n.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),textContent:" "})},t}(ry);t.registerComponent("CustomControlSpacer",sn);to=function(n){function t(){return n.apply(this,arguments)||this}i(t,n);var r=t.prototype;return r.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"})},t}(t);to.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]};"exitPictureInPicture"in document&&to.prototype.options_.children.splice(to.prototype.options_.children.length-1,0,"pictureInPictureToggle");t.registerComponent("ControlBar",to);uy=function(n){function t(t,i){var r=n.call(this,t,i)||this;r.on(t,"error",function(n){return r.open(n)});return r}i(t,n);var r=t.prototype;return r.buildCSSClass=function(){return"vjs-error-display "+n.prototype.buildCSSClass.call(this)},r.content=function(){var n=this.player().error();return n?this.localize(n.message):""},t}(dr);uy.prototype.options_=hi({},dr.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});t.registerComponent("ErrorDisplay",uy);var fy="vjs-text-track-settings",hn=["#000","Black"],cn=["#00F","Blue"],ln=["#0FF","Cyan"],an=["#0F0","Green"],vn=["#F0F","Magenta"],yn=["#F00","Red"],pn=["#FFF","White"],wn=["#FF0","Yellow"],ey=["1","Opaque"],oy=["0.5","Semi-Transparent"],bn=["0","Transparent"],fu={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[hn,pn,yn,an,cn,wn,vn,ln]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[ey,oy,bn]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[pn,hn,yn,an,cn,wn,vn,ln]},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:[ey,oy]},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:[bn,oy,ey]}};fu.windowColor.options=fu.backgroundColor.options;dn=function(n){function r(t,i){var r;i.temporary=!1;r=n.call(this,t,i)||this;r.updateDisplay=r.updateDisplay.bind(f(r));r.fill();r.hasBeenOpened_=r.hasBeenFilled_=!0;r.endDialog=s("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 cu(fu,function(n){r.on(r.$(n.selector),"change",r.updateDisplay)}),r.options_.persistTextTrackSettings&&r.restoreSettings(),r}i(r,n);var t=r.prototype;return t.dispose=function(){this.endDialog=null;n.prototype.dispose.call(this)},t.createElSelect_=function(n,t,i){var e=this;t===void 0&&(t="");i===void 0&&(i="label");var r=fu[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("")},t.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("")},t.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("")},t.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("")},t.createElColors_=function(){return s("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})},t.createElFont_=function(){return s("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("")})},t.createElControls_=function(){var n=this.localize("restore all settings to the default values");return s("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("")})},t.content=function(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]},t.label=function(){return this.localize("Caption Settings Dialog")},t.description=function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")},t.buildCSSClass=function(){return n.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"},t.getValues=function(){var n=this;return bot(fu,function(t,i,r){var u=flt(n.$(i.selector),i.parser);return u!==undefined&&(t[r]=u),t},{})},t.setValues=function(n){var t=this;cu(fu,function(i,r){elt(t.$(i.selector),n[r],i.parser)})},t.setDefaults=function(){var n=this;cu(fu,function(t){var i=t.hasOwnProperty("default")?t["default"]:0;n.$(t.selector).selectedIndex=i})},t.restoreSettings=function(){var n;try{n=JSON.parse(window.localStorage.getItem(fy))}catch(t){o.warn(t)}n&&this.setValues(n)},t.saveSettings=function(){if(this.options_.persistTextTrackSettings){var n=this.getValues();try{Object.keys(n).length?window.localStorage.setItem(fy,JSON.stringify(n)):window.localStorage.removeItem(fy)}catch(t){o.warn(t)}}},t.updateDisplay=function(){var n=this.player_.getChild("textTrackDisplay");n&&n.updateDisplay()},t.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}(dr);t.registerComponent("TextTrackSettings",dn);gn=function(n){function t(t,i){var r,u=i.ResizeObserver||window.ResizeObserver,e;if(i.ResizeObserver===null&&(u=!1),e=l({createEl:!u,reportTouchActivity:!1},i),r=n.call(this,t,e)||this,r.ResizeObserver=i.ResizeObserver||window.ResizeObserver,r.loadListener_=null,r.resizeObserver_=null,r.debouncedHandler_=ust(function(){r.resizeHandler()},100,!1,f(r)),u)r.resizeObserver_=new r.ResizeObserver(r.debouncedHandler_),r.resizeObserver_.observe(t.el());else{r.loadListener_=function(){if(r.el_&&r.el_.contentWindow){var t=r.debouncedHandler_,n=r.unloadListener_=function(){rt(this,"resize",t);rt(this,"unload",n);n=null};bt(r.el_.contentWindow,"unload",n);bt(r.el_.contentWindow,"resize",t)}};r.one("load",r.loadListener_)}return r}i(t,n);var r=t.prototype;return r.createEl=function(){return n.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;n.prototype.dispose.call(this)},t}(t);t.registerComponent("ResizeManager",gn);ntt={trackingThreshold:20,liveTolerance:15};ttt=function(n){function r(t,i){var r,u=l(ntt,i,{createEl:!1});r=n.call(this,t,u)||this;r.handleVisibilityChange_=function(n){return r.handleVisibilityChange(n)};r.trackLiveHandler_=function(){return r.trackLive_()};r.handlePlay_=function(n){return r.handlePlay(n)};r.handleFirstTimeupdate_=function(n){return r.handleFirstTimeupdate(n)};r.handleSeeked_=function(n){return r.handleSeeked(n)};r.seekToLiveEdge_=function(n){return r.seekToLiveEdge(n)};r.reset_();r.on(r.player_,"durationchange",function(n){return r.handleDurationchange(n)});r.on(r.player_,"canplay",function(){return r.toggleTracking()});if(se&&"hidden"in document&&"visibilityState"in document)r.on(document,"visibilitychange",r.handleVisibilityChange_);return r}i(r,n);var t=r.prototype;return t.handleVisibilityChange=function(){this.player_.duration()===Infinity&&(document.hidden?this.stopTracking():this.startTracking())},t.trackLive_=function(){var i=this.player_.seekable(),n,r;if(i&&i.length){n=Number(window.performance.now().toFixed(4));r=this.lastTime_===-1?0:(n-this.lastTime_)/1e3;this.lastTime_=n;this.pastSeekEnd_=this.pastSeekEnd()+r;var u=this.liveCurrentTime(),f=this.player_.currentTime(),t=this.player_.paused()||this.seekedBehindLive_||Math.abs(u-f)>this.options_.liveTolerance;this.timeupdateSeen_&&u!==Infinity||(t=!1);t!==this.behindLiveEdge_&&(this.behindLiveEdge_=t,this.trigger("liveedgechange"))}},t.handleDurationchange=function(){this.toggleTracking()},t.toggleTracking=function(){this.player_.duration()===Infinity&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())},t.startTracking=function(){if(!this.isTracking()){this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted());this.trackingInterval_=this.setInterval(this.trackLiveHandler_,ui);this.trackLive_();this.on(this.player_,["play","pause"],this.trackLiveHandler_);if(this.timeupdateSeen_)this.on(this.player_,"seeked",this.handleSeeked_);else{this.one(this.player_,"play",this.handlePlay_);this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)}}},t.handleFirstTimeupdate=function(){this.timeupdateSeen_=!0;this.on(this.player_,"seeked",this.handleSeeked_)},t.handleSeeked=function(){var n=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&n>2;this.nextSeekedFromUser_=!1;this.trackLive_()},t.handlePlay=function(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)},t.reset_=function(){this.lastTime_=-1;this.pastSeekEnd_=0;this.lastSeekEnd_=-1;this.behindLiveEdge_=!0;this.timeupdateSeen_=!1;this.seekedBehindLive_=!1;this.nextSeekedFromUser_=!1;this.clearInterval(this.trackingInterval_);this.trackingInterval_=null;this.off(this.player_,["play","pause"],this.trackLiveHandler_);this.off(this.player_,"seeked",this.handleSeeked_);this.off(this.player_,"play",this.handlePlay_);this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_);this.off(this.player_,"timeupdate",this.seekToLiveEdge_)},t.nextSeekedFromUser=function(){this.nextSeekedFromUser_=!0},t.stopTracking=function(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))},t.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},t.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},t.liveWindow=function(){var n=this.liveCurrentTime();return n===Infinity?0:n-this.seekableStart()},t.isLive=function(){return this.isTracking()},t.atLiveEdge=function(){return!this.behindLiveEdge()},t.liveCurrentTime=function(){return this.pastSeekEnd()+this.seekableEnd()},t.pastSeekEnd=function(){var n=this.seekableEnd();return this.lastSeekEnd_!==-1&&n!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=n,this.pastSeekEnd_},t.behindLiveEdge=function(){return this.behindLiveEdge_},t.isTracking=function(){return typeof this.trackingInterval_=="number"},t.seekToLiveEdge=function(){(this.seekedBehindLive_=!1,this.atLiveEdge())||(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))},t.dispose=function(){this.off(document,"visibilitychange",this.handleVisibilityChange_);this.stopTracking();n.prototype.dispose.call(this)},r}(t);t.registerComponent("LiveTracker",ttt);var sy=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},olt=Object.defineProperty({},"innerHTML",{get:function(){return this.cloneNode(!0).innerHTML},set:function(n){var t=document.createElement(this.nodeName.toLowerCase()),i;for(t.innerHTML=n,i=document.createDocumentFragment();t.childNodes.length;)i.appendChild(t.childNodes[0]);return this.innerText="",window.Element.prototype.appendChild.call(this,i),this.innerHTML}}),itt=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},slt=function(n){return itt([n.el(),window.HTMLMediaElement.prototype,window.Element.prototype,olt],"innerHTML")},rtt=function(n){var t=n.el();if(!t.resetSourceWatch_){var i={},r=slt(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),sy(n),e}};["append","appendChild","insertAdjacentHTML"].forEach(function(n){t[n]&&(i[n]=t[n],t[n]=u(i[n]))});Object.defineProperty(t,"innerHTML",l(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_)}},hlt=Object.defineProperty({},"src",{get:function(){return this.hasAttribute("src")?cd(window.Element.prototype.getAttribute.call(this,"src")):""},set:function(n){return window.Element.prototype.setAttribute.call(this,"src",n),n}}),clt=function(n){return itt([n.el(),window.HTMLMediaElement.prototype,hlt],"src")},llt=function(n){var t;if(n.featuresSourceset&&(t=n.el(),!t.resetSourceset_)){var i=clt(n),r=t.setAttribute,u=t.load;Object.defineProperty(t,"src",l(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 sy(n)||(n.triggerSourceset(""),rtt(n)),i};t.currentSrc?n.triggerSourceset(t.currentSrc):sy(n)||rtt(n);t.resetSourceset_=function(){t.resetSourceset_=null;t.load=u;t.setAttribute=r;Object.defineProperty(t,"src",i);t.resetSourceWatch_&&t.resetSourceWatch_()}}},hy=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)},r=function(n){function r(t,i){var r,f,e,u,a,s;if(r=n.call(this,t,i)||this,f=t.source,e=!1,f&&(r.el_.currentSrc!==f.src||t.tag&&t.tag.initNetworkState_===3)?r.setSource(f):r.handleLateInit_(r.el_),t.enableSourceset&&r.setupSourcesetHandling_(),r.isScrubbing_=!1,r.el_.hasChildNodes()){for(var c=r.el_.childNodes,l=c.length,h=[];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")||!ws(u.src)||(e=!0)):h.push(u));for(s=0;s<h.length;s++)r.el_.removeChild(h[s])}return r.proxyNativeTracks_(),r.featuresNativeTextTracks&&e&&o.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_(),(lu||wl||yb)&&t.nativeControlsForTouch===!0&&r.setControls(!0),r.proxyWebkitFullscreen_(),r.triggerReady(),r}i(r,n);var t=r.prototype;return t.dispose=function(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_();r.disposeMediaElement(this.el_);this.options_=null;n.prototype.dispose.call(this)},t.setupSourcesetHandling_=function(){llt(this)},t.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)})},t.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))},t.overrideNativeAudioTracks=function(n){this.overrideNative_("Audio",n)},t.overrideNativeVideoTracks=function(n){this.overrideNative_("Video",n)},t.proxyNativeTracksForType_=function(n){var f=this,r=kt[n],i=this.el()[r.getterName],t=this[r.getterName](),u,e;if(this["featuresNative"+r.capitalName+"Tracks"]&&i&&i.addEventListener){u={change:function(){var i={type:"change",target:t,currentTarget:t,srcElement:t};t.trigger(i);n==="text"&&f[nu.remoteText.getterName]().trigger(i)},addtrack:function(n){t.addTrack(n.track)},removetrack:function(n){t.removeTrack(n.track)}};e=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);f.on("dispose",function(){return i.removeEventListener(n,t)})});this.on("loadstart",e);this.on("dispose",function(){return f.off("loadstart",e)})}},t.proxyNativeTracks_=function(){var n=this;kt.names.forEach(function(t){n.proxyNativeTracksForType_(t)})},t.createEl=function(){var n=this.options_.tag,f,s,e,o,i,t,u;for(n&&(this.options_.playerElIngest||this.movingMediaElementInDOM)||(n?(f=n.cloneNode(!0),n.parentNode&&n.parentNode.insertBefore(f,n),r.disposeMediaElement(n),n=f):(n=document.createElement("video"),s=this.options_.tag&&tr(this.options_.tag),e=l({},s),lu&&this.options_.nativeControlsForTouch===!0||delete e.controls,ik(n,v(e,{id:this.options_.techId,"class":"vjs-tech"}))),n.playerId=this.options_.playerId),typeof this.options_.preload!="undefined"&&yu(n,"preload",this.options_.preload),this.options_.disablePictureInPicture!==undefined&&(n.disablePictureInPicture=this.options_.disablePictureInPicture),o=["loop","muted","playsinline","autoplay"],i=0;i<o.length;i++)t=o[i],u=this.options_[t],typeof u!="undefined"&&(u?yu(n,t,t):os(n,t),n[t]=u);return n},t.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)})}},t.setScrubbing=function(n){this.isScrubbing_=n},t.scrubbing=function(){return this.isScrubbing_},t.setCurrentTime=function(n){try{this.isScrubbing_&&this.el_.fastSeek&&es?this.el_.fastSeek(n):this.el_.currentTime=n}catch(t){o(t,"Video is not ready. (Video.js)")}},t.duration=function(){var n=this,t;if(this.el_.duration===Infinity&&di&&gi&&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},t.width=function(){return this.el_.offsetWidth},t.height=function(){return this.el_.offsetHeight},t.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,nativeIOSFullscreen:!0})}};this.on("webkitbeginfullscreen",t);this.on("dispose",function(){i.off("webkitbeginfullscreen",t);i.off("webkitendfullscreen",n)})}},t.supportsFullScreen=function(){if(typeof this.el_.webkitEnterFullScreen=="function"){var n=window.navigator&&window.navigator.userAgent||"";if(/Android/.test(n)||!/Chrome|Mac OS X 10.5/.test(n))return!0}return!1},t.enterFullScreen=function(){var n=this.el_;if(n.paused&&n.networkState<=n.HAVE_METADATA)ci(this.el_.play()),this.setTimeout(function(){n.pause();try{n.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}},0);else try{n.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}},t.exitFullScreen=function(){if(!this.el_.webkitDisplayingFullscreen){this.trigger("fullscreenerror",new Error("The video is not fullscreen"));return}this.el_.webkitExitFullScreen()},t.requestPictureInPicture=function(){return this.el_.requestPictureInPicture()},t.src=function(n){if(n===undefined)return this.el_.src;this.setSrc(n)},t.reset=function(){r.resetMediaElement(this.el_)},t.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},t.setControls=function(n){this.el_.controls=!!n},t.addTextTrack=function(t,i,r){return this.featuresNativeTextTracks?this.el_.addTextTrack(t,i,r):n.prototype.addTextTrack.call(this,t,i,r)},t.createRemoteTextTrack=function(t){if(!this.featuresNativeTextTracks)return n.prototype.createRemoteTextTrack.call(this,t);var i=document.createElement("track");return t.kind&&(i.kind=t.kind),t.label&&(i.label=t.label),(t.language||t.srclang)&&(i.srclang=t.language||t.srclang),t["default"]&&(i["default"]=t["default"]),t.id&&(i.id=t.id),t.src&&(i.src=t.src),i},t.addRemoteTextTrack=function(t,i){var r=n.prototype.addRemoteTextTrack.call(this,t,i);return this.featuresNativeTextTracks&&this.el().appendChild(r),r},t.removeRemoteTextTrack=function(t){if(n.prototype.removeRemoteTextTrack.call(this,t),this.featuresNativeTextTracks)for(var i=this.$$("track"),r=i.length;r--;)(t===i[r]||t===i[r].track)&&this.el().removeChild(i[r])},t.getVideoPlaybackQuality=function(){if(typeof this.el().getVideoPlaybackQuality=="function")return this.el().getVideoPlaybackQuality();var n={};return typeof this.el().webkitDroppedFrameCount!="undefined"&&typeof this.el().webkitDecodedFrameCount!="undefined"&&(n.droppedVideoFrames=this.el().webkitDroppedFrameCount,n.totalVideoFrames=this.el().webkitDecodedFrameCount),window.performance&&typeof window.performance.now=="function"?n.creationTime=window.performance.now():window.performance&&window.performance.timing&&typeof window.performance.timing.navigationStart=="number"&&(n.creationTime=window.Date.now()-window.performance.timing.navigationStart),n},r}(h);hy(r,"TEST_VID",function(){if(au()){var t=document.createElement("video"),n=document.createElement("track");return n.kind="captions",n.srclang="en",n.label="English",t.appendChild(n),t}});r.isSupported=function(){try{r.TEST_VID.volume=.5}catch(n){return!1}return!!(r.TEST_VID&&r.TEST_VID.canPlayType)};r.canPlayType=function(n){return r.TEST_VID.canPlayType(n)};r.canPlaySource=function(n){return r.canPlayType(n.type)};r.canControlVolume=function(){var n,t;try{return(n=r.TEST_VID.volume,r.TEST_VID.volume=n/2+.1,t=n!==r.TEST_VID.volume,t&&ct)?(window.setTimeout(function(){r&&r.prototype&&(r.prototype.featuresVolumeControl=n!==r.TEST_VID.volume)}),!1):t}catch(i){return!1}};r.canMuteVolume=function(){try{var n=r.TEST_VID.muted;return r.TEST_VID.muted=!n,r.TEST_VID.muted?yu(r.TEST_VID,"muted","muted"):os(r.TEST_VID,"muted","muted"),n!==r.TEST_VID.muted}catch(t){return!1}};r.canControlPlaybackRate=function(){if(di&&gi&&wb<58)return!1;try{var n=r.TEST_VID.playbackRate;return r.TEST_VID.playbackRate=n/2+.1,n!==r.TEST_VID.playbackRate}catch(t){return!1}};r.canOverrideAttributes=function(){try{var n=function(){};Object.defineProperty(document.createElement("video"),"src",{get:n,set:n});Object.defineProperty(document.createElement("audio"),"src",{get:n,set:n});Object.defineProperty(document.createElement("video"),"innerHTML",{get:n,set:n});Object.defineProperty(document.createElement("audio"),"innerHTML",{get:n,set:n})}catch(t){return!1}return!0};r.supportsNativeTextTracks=function(){return es||ct&&gi};r.supportsNativeVideoTracks=function(){return!!(r.TEST_VID&&r.TEST_VID.videoTracks)};r.supportsNativeAudioTracks=function(){return!!(r.TEST_VID&&r.TEST_VID.audioTracks)};r.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"];[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function(n){var t=n[0],i=n[1];hy(r.prototype,t,function(){return r[i]()},!0)});r.prototype.featuresVolumeControl=r.canControlVolume();r.prototype.movingMediaElementInDOM=!ct;r.prototype.featuresFullscreenResize=!0;r.prototype.featuresProgressEvents=!0;r.prototype.featuresTimeupdateEvents=!0;r.patchCanPlayType=function(){vl>=4&&!pb&&!gi&&(kh=r.TEST_VID&&r.TEST_VID.constructor.prototype.canPlayType,r.TEST_VID.constructor.prototype.canPlayType=function(n){return n&&/^application\/(?:x-|vnd\.apple\.)mpegurl/i.test(n)?"maybe":kh.call(this,n)})};r.unpatchCanPlayType=function(){var n=r.TEST_VID.constructor.prototype.canPlayType;return kh&&(r.TEST_VID.constructor.prototype.canPlayType=kh),n};r.patchCanPlayType();r.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){}}()}};r.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){r.prototype[n]=function(){return this.el_[n]||this.el_.hasAttribute(n)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(n){r.prototype["set"+y(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","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(n){r.prototype[n]=function(){return this.el_[n]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(n){r.prototype["set"+y(n)]=function(t){this.el_[n]=t}});["pause","load","play"].forEach(function(n){r.prototype[n]=function(){return this.el_[n]()}});h.withSourceHandlers(r);r.nativeSourceHandler={};r.nativeSourceHandler.canPlayType=function(n){try{return r.TEST_VID.canPlayType(n)}catch(t){return""}};r.nativeSourceHandler.canHandleSource=function(n){if(n.type)return r.nativeSourceHandler.canPlayType(n.type);if(n.src){var t=va(n.src);return r.nativeSourceHandler.canPlayType("video/"+t)}return""};r.nativeSourceHandler.handleSource=function(n,t){t.setSrc(n.src)};r.nativeSourceHandler.dispose=function(){};r.registerSourceHandler(r.nativeSourceHandler);h.registerTech("Html5",r);var utt=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],cy={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},ly=["tiny","xsmall","small","medium","large","xlarge","huge"],dh={};ly.forEach(function(n){var t=n.charAt(0)==="x"?"x-"+n.substring(1):n;dh[n]="vjs-layout-"+t});ftt={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:Infinity};p=function(n){function u(t,i,r){var e,s,o,h,c,a;if(t.id=t.id||i.id||"vjs_video_"+cr(),i=v(u.getTagSettings(t),i),i.initChildren=!1,i.createEl=!1,i.evented=!1,i.reportTouchActivity=!1,!i.language)if(typeof t.closest=="function")s=t.closest("[lang]"),s&&s.getAttribute&&(i.language=s.getAttribute("lang"));else for(o=t;o&&o.nodeType===1;){if(tr(o).hasOwnProperty("lang")){i.language=o.getAttribute("lang");break}o=o.parentNode}if(e=n.call(this,null,i,r)||this,e.boundDocumentFullscreenChange_=function(n){return e.documentFullscreenChange_(n)},e.boundFullWindowOnEscKey_=function(n){return e.fullWindowOnEscKey(n)},e.boundUpdateStyleEl_=function(n){return e.updateStyleEl_(n)},e.boundApplyInitTime_=function(n){return e.applyInitTime_(n)},e.boundUpdateCurrentBreakpoint_=function(n){return e.updateCurrentBreakpoint_(n)},e.boundHandleTechClick_=function(n){return e.handleTechClick_(n)},e.boundHandleTechDoubleClick_=function(n){return e.handleTechDoubleClick_(n)},e.boundHandleTechTouchStart_=function(n){return e.handleTechTouchStart_(n)},e.boundHandleTechTouchMove_=function(n){return e.handleTechTouchMove_(n)},e.boundHandleTechTouchEnd_=function(n){return e.handleTechTouchEnd_(n)},e.boundHandleTechTap_=function(n){return e.handleTechTap_(n)},e.isFullscreen_=!1,e.log=cb(e.id_),e.fsApi_=is,e.isPosterFromTech_=!1,e.queuedCallbacks_=[],e.isReady_=!1,e.hasStarted_=!1,e.userActive_=!1,e.debugEnabled_=!1,!e.options_||!e.options_.techOrder||!e.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(e.tag=t,e.tagAttributes=t&&tr(t),e.language(e.options_.language),i.languages?(h={},Object.getOwnPropertyNames(i.languages).forEach(function(n){h[n.toLowerCase()]=i.languages[n]}),e.languages_=h):e.languages_=u.prototype.options_.languages,e.resetCache_(),e.poster_=i.poster||"",e.controls_=!!i.controls,t.controls=!1,t.removeAttribute("controls"),e.changingSrc_=!1,e.playCallbacks_=[],e.playTerminatedQueue_=[],t.hasAttribute("autoplay")?e.autoplay(!0):e.autoplay(e.options_.autoplay),i.plugins&&Object.keys(i.plugins).forEach(function(n){if(typeof e[n]!="function")throw new Error('plugin "'+n+'" does not exist');}),e.scrubbing_=!1,e.el_=e.createEl(),fa(f(e),{eventBusKey:"el_"}),e.fsApi_.requestFullscreen){bt(document,e.fsApi_.fullscreenchange,e.boundDocumentFullscreenChange_);e.on(e.fsApi_.fullscreenchange,e.boundDocumentFullscreenChange_)}if(e.fluid_)e.on(["playerreset","resize"],e.boundUpdateStyleEl_);c=l(e.options_);i.plugins&&Object.keys(i.plugins).forEach(function(n){e[n](i.plugins[n])});i.debug&&e.debug(!0);e.options_.playerOptions=c;e.middleware_=[];e.playbackRates(i.playbackRates);e.initChildren();e.isAudio(t.nodeName.toLowerCase()==="audio");e.controls()?e.addClass("vjs-controls-enabled"):e.addClass("vjs-controls-disabled");e.el_.setAttribute("role","region");e.isAudio()?e.el_.setAttribute("aria-label",e.localize("Audio Player")):e.el_.setAttribute("aria-label",e.localize("Video Player"));e.isAudio()&&e.addClass("vjs-audio");e.flexNotSupported_()&&e.addClass("vjs-no-flex");lu&&e.addClass("vjs-touch-enabled");ct||e.addClass("vjs-workinghover");u.players[e.id_]=f(e);a=fb.split(".")[0];e.addClass("vjs-v"+a);e.userActive(!0);e.reportUserActivity();e.one("play",function(n){return e.listenForUserActivity_(n)});e.on("stageclick",function(n){return e.handleStageClick_(n)});e.on("keydown",function(n){return e.handleKeyDown(n)});e.on("languagechange",function(n){return e.handleLanguagechange(n)});return e.breakpoints(e.options_.breakpoints),e.responsive(e.options_.responsive),e}i(u,n);var r=u.prototype;return r.dispose=function(){var t=this;this.trigger("dispose");this.off("dispose");rt(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_);rt(document,"keydown",this.boundFullWindowOnEscKey_);this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null);u.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);dct(this);ut.names.forEach(function(n){var r=ut[n],i=t[r.getterName]();i&&i.off&&i.off()});n.prototype.dispose.call(this)},r.createEl=function(){var t=this.tag,i,e=this.playerElIngest_=t.parentNode&&t.parentNode.hasAttribute&&t.parentNode.hasAttribute("data-vjs-player"),u=this.tag.tagName.toLowerCase()==="video-js",r,o,s,h,f,c;if(e?i=this.el_=t.parentNode:u||(i=this.el_=n.prototype.createEl.call(this,"div")),r=tr(t),u){for(i=this.el_=t,t=this.tag=document.createElement("video");i.children.length;)t.appendChild(i.firstChild);pr(i,"video-js")||nr(i,"video-js");i.appendChild(t);e=this.playerElIngest_=i;Object.keys(i).forEach(function(n){try{t[n]=i[n]}catch(r){}})}for(t.setAttribute("tabindex","-1"),r.tabindex="-1",(se||gi&&bb)&&(t.setAttribute("role","application"),r.role="application"),t.removeAttribute("width"),t.removeAttribute("height"),("width"in r)&&delete r.width,("height"in r)&&delete r.height,Object.getOwnPropertyNames(r).forEach(function(n){u&&n==="class"||i.setAttribute(n,r[n]);u&&t.setAttribute(n,r[n])}),t.playerId=t.id,t.id+="_html5_api",t.className="vjs-tech",t.player=i.player=this,this.addClass("vjs-paused"),window.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&(this.styleEl_=ak("vjs-styles-dimensions"),o=hr(".vjs-styles-defaults"),s=hr("head"),s.insertBefore(this.styleEl_,o?o.nextSibling:s.firstChild)),this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin),h=t.getElementsByTagName("a"),f=0;f<h.length;f++)c=h.item(f),nr(c,"vjs-hidden"),c.setAttribute("hidden","hidden");return t.initNetworkState_=t.networkState,t.parentNode&&!e&&t.parentNode.insertBefore(i,t),bl(t,i),this.children_.unshift(t),this.el_.setAttribute("lang",this.language_),this.el_.setAttribute("translate","no"),this.el_=i,i},r.crossOrigin=function(n){if(!n)return this.techGet_("crossOrigin");if(n!=="anonymous"&&n!=="use-credentials"){o.warn('crossOrigin must be "anonymous" or "use-credentials", given "'+n+'"');return}this.techCall_("setCrossOrigin",n);return},r.width=function(n){return this.dimension("width",n)},r.height=function(n){return this.dimension("height",n)},r.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)){o.error('Improper value "'+t+'" supplied for for '+n);return}this[i]=r;this.updateStyleEl_()},r.fluid=function(n){var t=this;if(n===undefined)return!!this.fluid_;this.fluid_=!!n;rr(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_);n?(this.addClass("vjs-fluid"),this.fill(!1),fst(this,function(){t.on(["playerreset","resize"],t.boundUpdateStyleEl_)})):this.removeClass("vjs-fluid");this.updateStyleEl_()},r.fill=function(n){if(n===undefined)return!!this.fill_;this.fill_=!!n;n?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")},r.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_()},r.updateStyleEl_=function(){var r,o,s,n,u,t;if(window.VIDEOJS_NO_DYNAMIC_STYLE===!0){var f=typeof this.width_=="number"?this.width_:this.options_.width,e=typeof this.height_=="number"?this.height_:this.options_.height,i=this.tech_&&this.tech_.el();i&&(f>=0&&(i.width=f),e>=0&&(i.height=e));return}s=this.aspectRatio_!==undefined&&this.aspectRatio_!=="auto"?this.aspectRatio_:this.videoWidth()>0?this.videoWidth()+":"+this.videoHeight():"16:9";u=s.split(":");t=u[1]/u[0];r=this.width_!==undefined?this.width_:this.height_!==undefined?this.height_/t:this.videoWidth()||300;o=this.height_!==undefined?this.height_:r*t;n=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions";this.addClass(n);vk(this.styleEl_,"\n      ."+n+" {\n        width: "+r+"px;\n        height: "+o+"px;\n      }\n\n      ."+n+".vjs-fluid {\n        padding-top: "+t*100+"%;\n      }\n    ")},r.loadTech_=function(n,t){var i=this,u,f,e,r,o;if(this.tech_&&this.unloadTech_(),u=y(n),f=n.charAt(0).toLowerCase()+n.slice(1),u!=="Html5"&&this.tag&&(h.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=u,this.isReady_=!1,e=this.autoplay(),(typeof this.autoplay()=="string"||this.autoplay()===!0&&this.options_.normalizeAutoplay)&&(e=!1),r={source:t,autoplay:e,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+"_"+f+"_api",playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset,Promise:this.options_.Promise},ut.names.forEach(function(n){var t=ut[n];r[t.getterName]=i[t.privateName]}),v(r,this.options_[u]),v(r,this.options_[f]),v(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),o=h.getTech(n),!o)throw new Error("No Tech named '"+u+"' exists! '"+u+"' should be registered using videojs.registerTech()'");this.tech_=new o(r);this.tech_.ready(c(this,this.handleTechReady_),!0);fd.jsonToTextTracks(this.textTracksJson_||[],this.tech_);utt.forEach(function(n){i.on(i.tech_,n,function(t){return i["handleTech"+y(n)+"_"](t)})});Object.keys(cy).forEach(function(n){i.on(i.tech_,n,function(t){if(i.tech_.playbackRate()===0&&i.tech_.seeking()){i.queuedCallbacks_.push({callback:i["handleTech"+cy[n]+"_"].bind(i),event:t});return}i["handleTech"+cy[n]+"_"](t)})});this.on(this.tech_,"loadstart",function(n){return i.handleTechLoadStart_(n)});this.on(this.tech_,"sourceset",function(n){return i.handleTechSourceset_(n)});this.on(this.tech_,"waiting",function(n){return i.handleTechWaiting_(n)});this.on(this.tech_,"ended",function(n){return i.handleTechEnded_(n)});this.on(this.tech_,"seeking",function(n){return i.handleTechSeeking_(n)});this.on(this.tech_,"play",function(n){return i.handleTechPlay_(n)});this.on(this.tech_,"firstplay",function(n){return i.handleTechFirstPlay_(n)});this.on(this.tech_,"pause",function(n){return i.handleTechPause_(n)});this.on(this.tech_,"durationchange",function(n){return i.handleTechDurationChange_(n)});this.on(this.tech_,"fullscreenchange",function(n,t){return i.handleTechFullscreenChange_(n,t)});this.on(this.tech_,"fullscreenerror",function(n,t){return i.handleTechFullscreenError_(n,t)});this.on(this.tech_,"enterpictureinpicture",function(n){return i.handleTechEnterPictureInPicture_(n)});this.on(this.tech_,"leavepictureinpicture",function(n){return i.handleTechLeavePictureInPicture_(n)});this.on(this.tech_,"error",function(n){return i.handleTechError_(n)});this.on(this.tech_,"posterchange",function(n){return i.handleTechPosterChange_(n)});this.on(this.tech_,"textdata",function(n){return i.handleTechTextData_(n)});this.on(this.tech_,"ratechange",function(n){return i.handleTechRateChange_(n)});this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_);this.usingNativeControls(this.techGet_("controls"));this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_();this.tech_.el().parentNode===this.el()||u==="Html5"&&this.tag||bl(this.tech_.el(),this.el());this.tag&&(this.tag.player=null,this.tag=null)},r.unloadTech_=function(){var n=this;ut.names.forEach(function(t){var i=ut[t];n[i.privateName]=n[i.getterName]()});this.textTracksJson_=fd.textTracksToJson(this.tech_);this.isReady_=!1;this.tech_.dispose();this.tech_=!1;this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange"));this.isPosterFromTech_=!1},r.tech=function(n){return n===undefined&&o.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_},r.addTechControlsListeners_=function(){this.removeTechControlsListeners_();this.on(this.tech_,"click",this.boundHandleTechClick_);this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_);this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_);this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_);this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_);this.on(this.tech_,"tap",this.boundHandleTechTap_)},r.removeTechControlsListeners_=function(){this.off(this.tech_,"tap",this.boundHandleTechTap_);this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_);this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_);this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_);this.off(this.tech_,"click",this.boundHandleTechClick_);this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)},r.handleTechReady_=function(){this.triggerReady();this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume);this.handleTechPosterChange_();this.handleTechDurationChange_()},r.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()===!0&&this.options_.normalizeAutoplay?"play":this.autoplay())},r.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(),ve(i))return i["catch"](function(t){n();throw new Error("Rejection at manualAutoplay. Restoring muted value. "+(t?t:""));})},n!=="any"||this.muted()?i=n!=="muted"||this.muted()?this.play():r():(i=this.play(),ve(i)&&(i=i["catch"](r))),!ve(i))?void 0:i.then(function(){t.trigger({type:"autoplay-success",autoplay:n})})["catch"](function(){t.trigger({type:"autoplay-failure",autoplay:n})})},r.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=tlt(this,t));this.cache_.source=l({},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=tr(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},r.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"})},r.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"))},r.handleTechPlay_=function(){this.removeClass("vjs-ended");this.removeClass("vjs-paused");this.addClass("vjs-playing");this.hasStarted(!0);this.trigger("play")},r.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")},r.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)},r.handleTechCanPlay_=function(){this.removeClass("vjs-waiting");this.trigger("canplay")},r.handleTechCanPlayThrough_=function(){this.removeClass("vjs-waiting");this.trigger("canplaythrough")},r.handleTechPlaying_=function(){this.removeClass("vjs-waiting");this.trigger("playing")},r.handleTechSeeking_=function(){this.addClass("vjs-seeking");this.trigger("seeking")},r.handleTechSeeked_=function(){this.removeClass("vjs-seeking");this.removeClass("vjs-ended");this.trigger("seeked")},r.handleTechFirstPlay_=function(){this.options_.starttime&&(o.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")},r.handleTechPause_=function(){this.removeClass("vjs-playing");this.addClass("vjs-paused");this.trigger("pause")},r.handleTechEnded_=function(){this.addClass("vjs-ended");this.removeClass("vjs-waiting");this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause();this.trigger("ended")},r.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))},r.handleTechClick_=function(n){this.controls_&&(this.options_===undefined||this.options_.userActions===undefined||this.options_.userActions.click===undefined||this.options_.userActions.click!==!1)&&(this.options_!==undefined&&this.options_.userActions!==undefined&&typeof this.options_.userActions.click=="function"?this.options_.userActions.click.call(this,n):this.paused()?ci(this.play()):this.pause())},r.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())}},r.handleTechTap_=function(){this.userActive(!this.userActive())},r.handleTechTouchStart_=function(){this.userWasActive=this.userActive()},r.handleTechTouchMove_=function(){this.userWasActive&&this.reportUserActivity()},r.handleTechTouchEnd_=function(n){n.cancelable&&n.preventDefault()},r.handleStageClick_=function(){this.reportUserActivity()},r.toggleFullscreenClass_=function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")},r.documentFullscreenChange_=function(n){var r=n.target.player,t,i;r&&r!==this||(t=this.el(),i=document[this.fsApi_.fullscreenElement]===t,!i&&t.matches?i=t.matches(":"+this.fsApi_.fullscreen):!i&&t.msMatchesSelector&&(i=t.msMatchesSelector(":"+this.fsApi_.fullscreen)),this.isFullscreen(i))},r.handleTechFullscreenChange_=function(n,t){t&&(t.nativeIOSFullscreen&&this.toggleClass("vjs-ios-native-fs"),this.isFullscreen(t.isFullscreen))},r.handleTechFullscreenError_=function(n,t){this.trigger("fullscreenerror",t)},r.togglePictureInPictureClass_=function(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")},r.handleTechEnterPictureInPicture_=function(){this.isInPictureInPicture(!0)},r.handleTechLeavePictureInPicture_=function(){this.isInPictureInPicture(!1)},r.handleTechError_=function(){var n=this.tech_.error();this.error(n)},r.handleTechTextData_=function(){var n=null;arguments.length>1&&(n=arguments[1]);this.trigger("textdata",n)},r.getCache=function(){return this.cache_},r.resetCache_=function(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}},r.techCall_=function(n,t){this.ready(function(){if(n in bct)return pct(this.middleware_,this.tech_,n,t);if(n in hg)return sg(this.middleware_,this.tech_,n,t);try{this.tech_&&this.tech_[n](t)}catch(i){o(i);throw i;}},!0)},r.techGet_=function(n){if(this.tech_&&this.tech_.isReady_){if(n in wct)return yct(this.middleware_,this.tech_,n);if(n in hg)return sg(this.middleware_,this.tech_,n);try{return this.tech_[n]()}catch(t){if(this.tech_[n]===undefined){o("Video.js: "+n+" method not defined for "+this.techName_+" playback technology.",t);throw t;}if(t.name==="TypeError"){o("Video.js: "+n+" unavailable on "+this.techName_+" playback technology element.",t);this.tech_.isReady_=!1;throw t;}o(t);throw t;}}},r.play=function(){var t=this,n=this.options_.Promise||window.Promise;return n?new n(function(n){t.play_(n)}):this.play_()},r.play_=function(n){var r=this,t,i;if(n===void 0&&(n=ci),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&&(es||ct)&&this.load();return}i=this.techGet_("play");i===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(i)},r.runPlayTerminatedQueue_=function(){var n=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[];n.forEach(function(n){n()})},r.runPlayCallbacks_=function(n){var t=this.playCallbacks_.slice(0);this.playCallbacks_=[];this.playTerminatedQueue_=[];t.forEach(function(t){t(n)})},r.pause=function(){this.techCall_("pause")},r.paused=function(){return this.techGet_("paused")===!1?!1:!0},r.played=function(){return this.techGet_("played")||br(0,0)},r.scrubbing=function(n){if(typeof n=="undefined")return this.scrubbing_;this.scrubbing_=!!n;this.techCall_("setScrubbing",this.scrubbing_);n?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")},r.currentTime=function(n){if(typeof n!="undefined"){if(n<0&&(n=0),!this.isReady_||this.changingSrc_||!this.tech_||!this.tech_.isReady_){this.cache_.initTime=n;this.off("canplay",this.boundApplyInitTime_);this.one("canplay",this.boundApplyInitTime_);return}this.techCall_("setCurrentTime",n);this.cache_.initTime=0;return}return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime},r.applyInitTime_=function(){this.currentTime(this.cache_.initTime)},r.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.removeClass("vjs-live"),isNaN(n)||this.trigger("durationchange"))},r.remainingTime=function(){return this.duration()-this.currentTime()},r.remainingTimeDisplay=function(){return Math.floor(this.duration())-Math.floor(this.currentTime())},r.buffered=function(){var n=this.techGet_("buffered");return n&&n.length||(n=br(0,0)),n},r.bufferedPercent=function(){return rd(this.buffered(),this.duration())},r.bufferedEnd=function(){var t=this.buffered(),i=this.duration(),n=t.end(t.length-1);return n>i&&(n=i),n},r.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},r.muted=function(n){if(n!==undefined){this.techCall_("setMuted",n);return}return this.techGet_("muted")||!1},r.defaultMuted=function(n){return n!==undefined?this.techCall_("setDefaultMuted",n):this.techGet_("defaultMuted")||!1},r.lastVolume_=function(n){if(n!==undefined&&n!==0){this.cache_.lastVolume=n;return}return this.cache_.lastVolume},r.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1},r.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_},r.requestFullscreen=function(n){var i=this.options_.Promise||window.Promise,t;return i?(t=this,new i(function(i,r){function u(){t.off("fullscreenerror",o);t.off("fullscreenchange",e)}function e(){u();i()}function o(n,t){u();r(t)}t.one("fullscreenchange",e);t.one("fullscreenerror",o);var f=t.requestFullscreenHelper_(n);f&&(f.then(u,u),f.then(i,r))})):this.requestFullscreenHelper_()},r.requestFullscreenHelper_=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.options_.preferFullWindow==!0?this.techCall_("enterFullScreen"):this.enterFullWindow()},r.exitFullscreen=function(){var t=this.options_.Promise||window.Promise,n;return t?(n=this,new t(function(t,i){function r(){n.off("fullscreenerror",e);n.off("fullscreenchange",f)}function f(){r();t()}function e(n,t){r();i(t)}n.one("fullscreenchange",f);n.one("fullscreenerror",e);var u=n.exitFullscreenHelper_();u&&(u.then(r,r),u.then(t,i))})):this.exitFullscreenHelper_()},r.exitFullscreenHelper_=function(){var t=this,n;if(this.fsApi_.requestFullscreen)return n=document[this.fsApi_.exitFullscreen](),n&&ci(n.then(function(){return t.isFullscreen(!1)})),n;this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow==!0?this.techCall_("exitFullScreen"):this.exitFullWindow()},r.enterFullWindow=function(){this.isFullscreen(!0);this.isFullWindow=!0;this.docOrigOverflow=document.documentElement.style.overflow;bt(document,"keydown",this.boundFullWindowOnEscKey_);document.documentElement.style.overflow="hidden";nr(document.body,"vjs-full-window");this.trigger("enterFullWindow")},r.fullWindowOnEscKey=function(n){e.isEventKey(n,"Esc")&&this.isFullscreen()===!0&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())},r.exitFullWindow=function(){this.isFullscreen(!1);this.isFullWindow=!1;rt(document,"keydown",this.boundFullWindowOnEscKey_);document.documentElement.style.overflow=this.docOrigOverflow;he(document.body,"vjs-full-window");this.trigger("exitFullWindow")},r.disablePictureInPicture=function(n){if(n===undefined)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",n);this.options_.disablePictureInPicture=n;this.trigger("disablepictureinpicturechanged")},r.isInPictureInPicture=function(n){if(n!==undefined){this.isInPictureInPicture_=!!n;this.togglePictureInPictureClass_();return}return!!this.isInPictureInPicture_},r.requestPictureInPicture=function(){if("pictureInPictureEnabled"in document&&this.disablePictureInPicture()===!1)return this.techGet_("requestPictureInPicture")},r.exitPictureInPicture=function(){if("pictureInPictureEnabled"in document)return document.exitPictureInPicture()},r.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)))},r.handleHotkeys=function(n){var i=this.options_.userActions?this.options_.userActions.hotkeys:{},r=i.fullscreenKey,c=r===void 0?function(n){return e.isEventKey(n,"f")}:r,u=i.muteKey,l=u===void 0?function(n){return e.isEventKey(n,"m")}:u,f=i.playPauseKey,a=f===void 0?function(n){return e.isEventKey(n,"k")||e.isEventKey(n,"Space")}:f,o,s,h;c.call(this,n)?(n.preventDefault(),n.stopPropagation(),o=t.getComponent("FullscreenToggle"),document[this.fsApi_.fullscreenEnabled]!==!1&&o.prototype.handleClick.call(this,n)):l.call(this,n)?(n.preventDefault(),n.stopPropagation(),s=t.getComponent("MuteToggle"),s.prototype.handleClick.call(this,n)):a.call(this,n)&&(n.preventDefault(),n.stopPropagation(),h=t.getComponent("PlayToggle"),h.prototype.handleClick.call(this,n))},r.canPlayType=function(n){for(var r,i,u,f=0,e=this.options_.techOrder;f<e.length;f++){if(r=e[f],i=h.getTech(r),i||(i=t.getComponent(r)),!i){o.error('The "'+r+'" tech is undefined. Skipped browser support check for that tech.');continue}if(i.isSupported()&&(u=i.canPlayType(n),u))return u}return""},r.selectSource=function(n){var f=this,t=this.options_.techOrder.map(function(n){return[n,h.getTech(n)]}).filter(function(n){var i=n[0],t=n[1];return t?t.isSupported():(o.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},r.handleSrc_=function(n,t){var i=this,r,u,f;if(typeof n=="undefined")return this.cache_.src||"";if(this.resetRetryOnError_&&this.resetRetryOnError_(),r=cg(n),!r.length){this.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})},0);return}if(this.changingSrc_=!0,t||(this.cache_.sources=r),this.updateSourceCaches_(r[0]),act(this,r[0],function(n,u){i.middleware_=u;t||(i.cache_.sources=r);i.updateSourceCaches_(n);var f=i.src_(n);if(f){if(r.length>1)return i.handleSrc_(r.slice(1));i.changingSrc_=!1;i.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})},0);i.triggerReady();return}vct(u,i.tech_)}),this.options_.retryOnError&&r.length>1){u=function(){i.error(null);i.handleSrc_(r.slice(1),!0)};f=function(){i.off("error",u)};this.one("error",u);this.one("playing",f);this.resetRetryOnError_=function(){i.off("error",u);i.off("playing",f)}}},r.src=function(n){return this.handleSrc_(n,!1)},r.src_=function(n){var i=this,t=this.selectSource([n]);return t?ost(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},r.load=function(){this.techCall_("load")},r.reset=function(){var t=this,i=this.options_.Promise||window.Promise,n;this.paused()||!i?this.doReset_():(n=this.play(),ci(n.then(function(){return t.doReset_()})))},r.doReset_=function(){this.tech_&&this.tech_.clearTracks("text");this.resetCache_();this.poster("");this.loadTech_(this.options_.techOrder[0],null);this.techCall_("reset");this.resetControlBarUI_();rr(this)&&this.trigger("playerreset")},r.resetControlBarUI_=function(){this.resetProgressBar_();this.resetPlaybackRate_();this.resetVolumeBar_()},r.resetProgressBar_=function(){this.currentTime(0);var n=this.controlBar,t=n.durationDisplay,i=n.remainingTimeDisplay;t&&t.updateContent();i&&i.updateContent()},r.resetPlaybackRate_=function(){this.playbackRate(this.defaultPlaybackRate());this.handleTechRateChange_()},r.resetVolumeBar_=function(){this.volume(1);this.trigger("volumechange")},r.currentSources=function(){var n=this.currentSource(),t=[];return Object.keys(n).length!==0&&t.push(n),this.cache_.sources||t},r.currentSource=function(){return this.cache_.source||{}},r.currentSrc=function(){return this.currentSource()&&this.currentSource().src||""},r.currentType=function(){return this.currentSource()&&this.currentSource().type||""},r.preload=function(n){if(n!==undefined){this.techCall_("setPreload",n);this.options_.preload=n;return}return this.techGet_("preload")},r.autoplay=function(n){if(n===undefined)return this.options_.autoplay||!1;var t;typeof n=="string"&&/(any|play|muted)/.test(n)||n===!0&&this.options_.normalizeAutoplay?(this.options_.autoplay=n,this.manualAutoplay_(typeof n=="string"?n:"play"),t=!1):this.options_.autoplay=n?!0:!1;t=typeof t=="undefined"?this.options_.autoplay:t;this.tech_&&this.techCall_("setAutoplay",t)},r.playsinline=function(n){return n!==undefined?(this.techCall_("setPlaysinline",n),this.options_.playsinline=n,this):this.techGet_("playsinline")},r.loop=function(n){if(n!==undefined){this.techCall_("setLoop",n);this.options_.loop=n;return}return this.techGet_("loop")},r.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"))},r.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"))}},r.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_()))},r.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")))},r.error=function(n){var t=this,i;if(n===undefined)return this.error_||null;if(sr("beforeerror").forEach(function(i){var r=i(t,n);if(!(ki(r)&&!Array.isArray(r)||typeof r=="string"||typeof r=="number"||r===null)){t.log.error("please return a value that MediaError expects in beforeerror hooks");return}n=r}),this.options_.suppressNotSupportedError&&n&&n.code===4){i=function(){this.error(n)};this.options_.suppressNotSupportedError=!1;this.any(["click","touchstart"],i);this.one("loadstart",function(){this.off(["click","touchstart"],i)});return}if(n===null){this.error_=n;this.removeClass("vjs-error");this.errorDisplay&&this.errorDisplay.close();return}this.error_=new lt(n);this.addClass("vjs-error");o.error("(CODE:"+this.error_.code+" "+lt.errorTypes[this.error_.code]+")",this.error_.message,this.error_);this.trigger("error");sr("error").forEach(function(n){return n(t,t.error_)});return},r.reportUserActivity=function(){this.userActivity_=!0},r.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")}},r.listenForUserActivity_=function(){var i,r,u,n=c(this,this.reportUserActivity),o=function(t){(t.screenX!==r||t.screenY!==u)&&(r=t.screenX,u=t.screenY,n())},s=function(){n();this.clearInterval(i);i=this.setInterval(n,250)},f=function(){n();this.clearInterval(i)},t,e;this.on("mousedown",s);this.on("mousemove",o);this.on("mouseup",f);this.on("mouseleave",f);if(t=this.getChild("controlBar"),t&&!ct&&!di){t.on("mouseenter",function(){this.player().options_.inactivityTimeout!==0&&(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)},r.playbackRate=function(n){if(n!==undefined){this.techCall_("setPlaybackRate",n);return}return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1},r.defaultPlaybackRate=function(n){return n!==undefined?this.techCall_("setDefaultPlaybackRate",n):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1},r.isAudio=function(n){if(n!==undefined){this.isAudio_=!!n;return}return!!this.isAudio_},r.addTextTrack=function(n,t,i){if(this.tech_)return this.tech_.addTextTrack(n,t,i)},r.addRemoteTextTrack=function(n,t){if(this.tech_)return this.tech_.addRemoteTextTrack(n,t)},r.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},r.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")},r.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0},r.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0},r.language=function(n){if(n===undefined)return this.language_;this.language_!==String(n).toLowerCase()&&(this.language_=String(n).toLowerCase(),rr(this)&&this.trigger("languagechange"))},r.languages=function(){return l(u.prototype.options_.languages,this.languages_)},r.toJSON=function(){var i=l(this.options_),r=i.tracks,n,t;for(i.tracks=[],n=0;n<r.length;n++)t=r[n],t=l(t),t.player=undefined,i.tracks[n]=t;return i},r.createModal=function(n,t){var r=this,i;t=t||{};t.content=n||"";i=new dr(this,t);this.addChild(i);i.on("dispose",function(){r.removeChild(i)});return i.open(),i},r.updateCurrentBreakpoint_=function(){var t,r,i,n,u;if(this.responsive())for(t=this.currentBreakpoint(),r=this.currentWidth(),i=0;i<ly.length;i++)if(n=ly[i],u=this.breakpoints_[n],r<=u){if(t===n)return;t&&this.removeClass(dh[t]);this.addClass(dh[n]);this.breakpoint_=n;break}},r.removeCurrentBreakpoint_=function(){var n=this.currentBreakpointClass();this.breakpoint_="";n&&this.removeClass(n)},r.breakpoints=function(n){return n===undefined?v(this.breakpoints_):(this.breakpoint_="",this.breakpoints_=v({},ftt,n),this.updateCurrentBreakpoint_(),v(this.breakpoints_))},r.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.boundUpdateCurrentBreakpoint_);this.updateCurrentBreakpoint_()}else this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_();return n}},r.currentBreakpoint=function(){return this.breakpoint_},r.currentBreakpointClass=function(){return dh[this.breakpoint_]||""},r.loadMedia=function(n,t){var e=this;if(n&&typeof n=="object"){this.reset();this.cache_.media=l(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:nh(i)}]);u&&this.src(u);i&&this.poster(i);Array.isArray(f)&&f.forEach(function(n){return e.addRemoteTextTrack(n,!1)});this.ready(t)}},r.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:nh(n.poster)}]),n}return l(this.cache_.media)},u.getTagSettings=function(n){var i={sources:[],tracks:[]},t=tr(n),s=t["data-setup"],f,r,l,u,e;if(pr(n,"vjs-fill")&&(t.fill=!0),pr(n,"vjs-fluid")&&(t.fluid=!0),s!==null){var h=ud(s||"{}"),c=h[0],a=h[1];c&&o.error(c);v(t,a)}if(v(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(tr(u)):e==="track"&&i.tracks.push(tr(u));return i},r.flexNotSupported_=function(){var n=document.createElement("i");return!("flexBasis"in n.style||"webkitFlexBasis"in n.style||"mozFlexBasis"in n.style||"msFlexBasis"in n.style||"msFlexOrder"in n.style)},r.debug=function(n){if(n===undefined)return this.debugEnabled_;n?(this.trigger("debugon"),this.previousLogLevel_=this.log.level,this.log.level("debug"),this.debugEnabled_=!0):(this.trigger("debugoff"),this.log.level(this.previousLogLevel_),this.previousLogLevel_=undefined,this.debugEnabled_=!1)},r.playbackRates=function(n){if(n===undefined)return this.cache_.playbackRates;Array.isArray(n)&&n.every(function(n){return typeof n=="number"})&&(this.cache_.playbackRates=n,this.trigger("playbackrateschange"))},u}(t);ut.names.forEach(function(n){var t=ut[n];p.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}});p.prototype.crossorigin=p.prototype.crossOrigin;p.players={};rf=window.navigator;p.prototype.options_={techOrder:h.defaultTechOrder_,html5:{},inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:rf&&(rf.languages&&rf.languages[0]||rf.userLanguage||rf.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1};["ended","seeking","seekable","networkState","readyState"].forEach(function(n){p.prototype[n]=function(){return this.techGet_(n)}});utt.forEach(function(n){p.prototype["handleTech"+y(n)+"_"]=function(){return this.trigger(n)}});t.registerComponent("Player",p);ay=vr(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});var vlt=alt,ylt=vr(function(n){function t(){return n.exports=vlt()?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&&ay(u,i.prototype),u},t.apply(null,arguments)}n.exports=t}),gh="plugin",uf="activePlugins_",ff={},nc=function(n){return ff.hasOwnProperty(n)},tc=function(n){return nc(n)?ff[n]:undefined},ett=function(n,t){n[uf]=n[uf]||{};n[uf][t]=!0},ic=function(n,t,i){var r=(i?"before":"")+"pluginsetup";n.trigger(r,t);n.trigger(r+":"+t.name,t)},plt=function(n,t){var i=function(){ic(this,{name:n,plugin:t,instance:null},!0);var i=t.apply(this,arguments);return ett(this,n),ic(this,{name:n,plugin:t,instance:i}),i};return Object.keys(t).forEach(function(n){i[n]=t[n]}),i},ott=function(n,t){return t.prototype.name=n,function(){var r;ic(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=ylt(t,[this].concat(f)),this[n]=function(){return r},ic(this,r.getEventHash()),r}},ai=function(){function n(t){if(this.constructor===n)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=t;this.log||(this.log=this.player.log.createLogger(this.name));fa(this);delete this.trigger;td(this,this.constructor.defaultState);ett(t,this.name);this.dispose=this.dispose.bind(this);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={}),wu(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[uf][n]=!1;this.player=this.state=null;t[n]=ott(n,ff[n])},n.isBasic=function(t){var i=typeof t=="string"?tc(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(nc(t))o.warn('A plugin named "'+t+'" already exists. You may want to avoid re-registering plugins!');else if(p.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 ff[t]=i,t!==gh&&(p.prototype[t]=n.isBasic(i)?plt(t,i):ott(t,i)),i},n.deregisterPlugin=function(n){if(n===gh)throw new Error("Cannot de-register base plugin.");nc(n)&&(delete ff[n],delete p.prototype[n])},n.getPlugins=function(n){n===void 0&&(n=Object.keys(ff));var t;return n.forEach(function(n){var i=tc(n);i&&(t=t||{},t[n]=i)}),t},n.getPluginVersion=function(n){var t=tc(n);return t&&t.VERSION||""},n}();ai.getPlugin=tc;ai.BASE_PLUGIN_NAME=gh;ai.registerPlugin(gh,ai);p.prototype.usingPlugin=function(n){return!!this[uf]&&this[uf][n]===!0};p.prototype.hasPlugin=function(n){return!!nc(n)};var blt=wlt,klt=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);blt(i,n);n&&(i.super_=n);for(u in r)r.hasOwnProperty(u)&&(i.prototype[u]=r[u]);return i},stt=function(n){return n.indexOf("#")===0?n.slice(1):n};n.hooks_=bi;n.hooks=sr;n.hook=yot;n.hookOnce=pot;n.removeHook=eb;window.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&au()&&(io=hr(".vjs-styles-defaults"),io||(io=ak("vjs-styles-defaults"),rc=hr("head"),rc&&rc.insertBefore(io,rc.firstChild),vk(io,"\n      .video-js {\n        width: 300px;\n        height: 150px;\n      }\n\n      .vjs-fluid {\n        padding-top: 56.25%\n      }\n    ")));na(1,n);n.VERSION=fb;n.options=p.prototype.options_;n.getPlayers=function(){return p.players};n.getPlayer=function(n){var i=p.players,t,r,u;if(typeof n=="string"){if(r=stt(n),u=i[r],u)return u;t=hr("#"+r)}else t=n;if(vu(t)){var f=t,e=f.player,o=f.playerId;if(e||i[o])return e||i[o]}};n.getAllPlayers=function(){return Object.keys(p.players).map(function(n){return p.players[n]}).filter(Boolean)};n.players=p.players;n.getComponent=t.getComponent;n.registerComponent=function(n,i){h.isTech(i)&&o.warn("The "+n+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)");t.registerComponent.call(t,n,i)};n.getTech=h.getTech;n.registerTech=h.registerTech;n.use=lct;Object.defineProperty(n,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(n.middleware,"TERMINATOR",{value:gs,writeable:!1,enumerable:!0});n.browser=got;n.TOUCH_ENABLED=lu;n.extend=klt;n.mergeOptions=l;n.bind=c;n.registerPlugin=ai.registerPlugin;n.deregisterPlugin=ai.deregisterPlugin;n.plugin=function(n,t){return o.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),ai.registerPlugin(n,t)};n.getPlugins=ai.getPlugins;n.getPlugin=ai.getPlugin;n.getPluginVersion=ai.getPluginVersion;n.addLanguage=function(t,i){var r;return t=(""+t).toLowerCase(),n.options.languages=l(n.options.languages,(r={},r[t]=i,r)),n.options.languages[t]};n.log=o;n.createLogger=cb;n.createTimeRange=n.createTimeRanges=br;n.formatTime=gu;n.setFormatTime=rlt;n.resetFormatTime=ult;n.parseUrl=aa;n.isCrossOrigin=ws;n.EventTarget=k;n.on=bt;n.one=ls;n.off=rt;n.trigger=wu;n.xhr=ya;n.TextTrack=ye;n.AudioTrack=bd;n.VideoTrack=kd;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(function(t){n[t]=function(){return o.warn("videojs."+t+"() is deprecated; use videojs.dom."+t+"() instead"),ck[t].apply(null,arguments)}});n.computedStyle=ee;n.dom=ck;n.url=iht;n.defineLazyProperty=hy;n.addLanguage("en",{"Non-Fullscreen":"Exit Fullscreen"});var htt=vr(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})()}),ctt="http://example.com",uc=function(n,t){var i;if(/^[a-z]+:/i.test(t))return t;/^data:/.test(n)&&(n=window.location&&window.location.href||"");var r=typeof URL=="function",u=/^\/\//.test(n),f=!window.location&&!/\/\//i.test(n);return(r?n=new window.URL(n,window.location||ctt):/\/\//i.test(n)||(n=htt.buildAbsoluteURL(window.location&&window.location.href||"",n)),r)?(i=new URL(t,n),f)?i.href.slice(ctt.length):u?i.href.slice(i.protocol.length):i.href:htt.buildAbsoluteURL(n,t)},vy=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]=this.listeners[n].slice(0),this.listeners[n].splice(i,1),i>-1},n.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.dispose=function(){this.listeners={}},n.pipe=function(n){this.on("data",function(t){n.push(t)})},t}(),dlt=function(n){return window.atob?window.atob(n):Buffer.from(n,"base64").toString("binary")};var nat=function(n){function t(){var t;return t=n.call(this)||this,t.buffer="",t}i(t,n);var r=t.prototype;return r.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}(vy),tat=String.fromCharCode(9),yy=function(n){var t=/([0-9.]*)?@?([0-9.]*)?/.exec(n||""),i={};return t[1]&&(i.length=parseInt(t[1],10)),t[2]&&(i.offset=parseInt(t[2],10)),i},iat=function(){return new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')},fi=function(n){for(var i=n.split(iat()),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},rat=function(n){function t(){var t;return t=n.call(this)||this,t.customParsers=[],t.tagMappers=[],t}i(t,n);var r=t.prototype;return r.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=/^#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:?(.*)?$/.exec(n),i){t=hi(yy(i[1]),{type:"tag",tagType:"byterange"});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){t={type:"tag",tagType:"map"};i[1]&&(u=fi(i[1]),u.URI&&(t.uri=u.URI),u.BYTERANGE&&(t.byterange=yy(u.BYTERANGE)));r.trigger("data",t);return}if(i=/^#EXT-X-STREAM-INF:?(.*)$/.exec(n),i){t={type:"tag",tagType:"stream-inf"};i[1]&&(t.attributes=fi(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=fi(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=fi(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=fi(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}if(i=/^#EXT-X-SKIP:(.*)$/.exec(n),i&&i[1]){t={type:"tag",tagType:"skip"};t.attributes=fi(i[1]);t.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(t.attributes["SKIPPED-SEGMENTS"]=parseInt(t.attributes["SKIPPED-SEGMENTS"],10));t.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(t.attributes["RECENTLY-REMOVED-DATERANGES"]=t.attributes["RECENTLY-REMOVED-DATERANGES"].split(tat));r.trigger("data",t);return}if(i=/^#EXT-X-PART:(.*)$/.exec(n),i&&i[1]){t={type:"tag",tagType:"part"};t.attributes=fi(i[1]);["DURATION"].forEach(function(n){t.attributes.hasOwnProperty(n)&&(t.attributes[n]=parseFloat(t.attributes[n]))});["INDEPENDENT","GAP"].forEach(function(n){t.attributes.hasOwnProperty(n)&&(t.attributes[n]=/YES/.test(t.attributes[n]))});t.attributes.hasOwnProperty("BYTERANGE")&&(t.attributes.byterange=yy(t.attributes.BYTERANGE));r.trigger("data",t);return}if(i=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(n),i&&i[1]){t={type:"tag",tagType:"server-control"};t.attributes=fi(i[1]);["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(n){t.attributes.hasOwnProperty(n)&&(t.attributes[n]=parseFloat(t.attributes[n]))});["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(n){t.attributes.hasOwnProperty(n)&&(t.attributes[n]=/YES/.test(t.attributes[n]))});r.trigger("data",t);return}if(i=/^#EXT-X-PART-INF:(.*)$/.exec(n),i&&i[1]){t={type:"tag",tagType:"part-inf"};t.attributes=fi(i[1]);["PART-TARGET"].forEach(function(n){t.attributes.hasOwnProperty(n)&&(t.attributes[n]=parseFloat(t.attributes[n]))});r.trigger("data",t);return}if(i=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(n),i&&i[1]){t={type:"tag",tagType:"preload-hint"};t.attributes=fi(i[1]);["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(n){if(t.attributes.hasOwnProperty(n)){t.attributes[n]=parseInt(t.attributes[n],10);var i=n==="BYTERANGE-LENGTH"?"length":"offset";t.attributes.byterange=t.attributes.byterange||{};t.attributes.byterange[i]=t.attributes[n];delete t.attributes[n]}});r.trigger("data",t);return}if(i=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(n),i&&i[1]){t={type:"tag",tagType:"rendition-report"};t.attributes=fi(i[1]);["LAST-MSN","LAST-PART"].forEach(function(n){t.attributes.hasOwnProperty(n)&&(t.attributes[n]=parseInt(t.attributes[n],10))});r.trigger("data",t);return}r.trigger("data",{type:"tag",data:n.slice(4)})})}},r.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})},r.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}(vy),uat=function(n){return n.toLowerCase().replace(/-(\w)/g,function(n){return n[1].toUpperCase()})},ef=function(n){var t={};return Object.keys(n).forEach(function(i){t[uat(i)]=n[i]}),t},py=function(n){var t=n.serverControl,o=n.targetDuration,u=n.partTargetDuration;if(t){var e="#EXT-X-SERVER-CONTROL",f="holdBack",i="partHoldBack",r=o&&o*3,s=u&&u*2;o&&!t.hasOwnProperty(f)&&(t[f]=r,this.trigger("info",{message:e+" defaulting HOLD-BACK to targetDuration * 3 ("+r+")."}));r&&t[f]<r&&(this.trigger("warn",{message:e+" clamping HOLD-BACK ("+t[f]+") to targetDuration * 3 ("+r+")"}),t[f]=r);u&&!t.hasOwnProperty(i)&&(t[i]=u*3,this.trigger("info",{message:e+" defaulting PART-HOLD-BACK to partTargetDuration * 3 ("+t[i]+")."}));u&&t[i]<s&&(this.trigger("warn",{message:e+" clamping PART-HOLD-BACK ("+t[i]+") to partTargetDuration * 2 ("+s+")."}),t[i]=s)}},fat=function(n){function r(){var i,h,e;i=n.call(this)||this;i.lineStream=new nat;i.parseStream=new rat;i.lineStream.pipe(i.parseStream);var c=f(i),s=[],t={},u,r,l=!1,v=function(){},a={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},y="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",o=0;i.manifest={allowCache:!0,discontinuityStarts:[],segments:[]};h=0;e=0;i.on("end",function(){!t.uri&&(t.parts||t.preloadHints)&&(!t.map&&u&&(t.map=u),!t.key&&r&&(t.key=r),t.timeline||typeof o!="number"||(t.timeline=o),i.manifest.preloadSegment=t)});i.parseStream.on("data",function(n){var f,i;({tag:function(){({version:function(){n.version&&(this.manifest.version=n.version)},"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||(n.offset=h));"offset"in n&&(t.byterange=i,i.offset=n.offset);h=i.offset+i.length},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=s},key:function(){if(!n.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(n.attributes.METHOD==="NONE"){r=null;return}if(!n.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(n.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{};this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:n.attributes};return}if(n.attributes.KEYFORMAT===y){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=this.manifest.contentProtection||{};this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:n.attributes.KEYFORMAT,keyId:n.attributes.KEYID.substring(2)},pssh:glt(n.attributes.URI.split(",")[1])};return}n.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"});r={method:n.attributes.METHOD||"AES-128",uri:n.attributes.URI};typeof n.attributes.IV!="undefined"&&(r.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;o=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(){u={};n.uri&&(u.uri=n.uri);n.byterange&&(u.byterange=n.byterange);r&&(u.key=r)},"stream-inf":function(){if(this.manifest.playlists=s,this.manifest.mediaGroups=this.manifest.mediaGroups||a,!n.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}t.attributes||(t.attributes={});hi(t.attributes,n.attributes)},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||a,!(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"]]||{};f=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));f[n.attributes.NAME]=i},discontinuity:function(){o+=1;t.discontinuity=!0;this.manifest.discontinuityStarts.push(s.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;py.call(this,this.manifest)},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},skip:function(){this.manifest.skip=ef(n.attributes);this.warnOnMissingAttributes_("#EXT-X-SKIP",n.attributes,["SKIPPED-SEGMENTS"])},part:function(){var f=this,r,i,u;l=!0;r=this.manifest.segments.length;i=ef(n.attributes);t.parts=t.parts||[];t.parts.push(i);i.byterange&&(i.byterange.hasOwnProperty("offset")||(i.byterange.offset=e),e=i.byterange.offset+i.byterange.length);u=t.parts.length-1;this.warnOnMissingAttributes_("#EXT-X-PART #"+u+" for segment #"+r,n.attributes,["URI","DURATION"]);this.manifest.renditionReports&&this.manifest.renditionReports.forEach(function(n,t){n.hasOwnProperty("lastPart")||f.trigger("warn",{message:"#EXT-X-RENDITION-REPORT #"+t+" lacks required attribute(s): LAST-PART"})})},"server-control":function(){var t=this.manifest.serverControl=ef(n.attributes);t.hasOwnProperty("canBlockReload")||(t.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"}));py.call(this,this.manifest);t.canSkipDateranges&&!t.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint":function(){var o=this.manifest.segments.length,i=ef(n.attributes),s=i.type&&i.type==="PART",u,r,f;if(t.preloadHints=t.preloadHints||[],t.preloadHints.push(i),i.byterange&&(i.byterange.hasOwnProperty("offset")||(i.byterange.offset=s?e:0,s&&(e=i.byterange.offset+i.byterange.length))),u=t.preloadHints.length-1,this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #"+u+" for segment #"+o,n.attributes,["TYPE","URI"]),i.type)for(r=0;r<t.preloadHints.length-1;r++)(f=t.preloadHints[r],f.type)&&f.type===i.type&&this.trigger("warn",{message:"#EXT-X-PRELOAD-HINT #"+u+" for segment #"+o+" has the same TYPE "+i.type+" as preload hint #"+r})},"rendition-report":function(){var r=ef(n.attributes),i,t;this.manifest.renditionReports=this.manifest.renditionReports||[];this.manifest.renditionReports.push(r);i=this.manifest.renditionReports.length-1;t=["LAST-MSN","URI"];l&&t.push("LAST-PART");this.warnOnMissingAttributes_("#EXT-X-RENDITION-REPORT #"+i,n.attributes,t)},"part-inf":function(){this.manifest.partInf=ef(n.attributes);this.warnOnMissingAttributes_("#EXT-X-PART-INF",n.attributes,["PART-TARGET"]);this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget);py.call(this,this.manifest)}}[n.tagType]||v).call(c)},uri:function(){t.uri=n.uri;s.push(t);!this.manifest.targetDuration||"duration"in t||(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),t.duration=this.manifest.targetDuration);r&&(t.key=r);t.timeline=o;u&&(t.map=u);e=0;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(c)});return i}i(r,n);var t=r.prototype;return t.warnOnMissingAttributes_=function(n,t,i){var r=[];i.forEach(function(n){t.hasOwnProperty(n)||r.push(n)});r.length&&this.trigger("warn",{message:n+" lacks required attribute(s): "+r.join(", ")})},t.push=function(n){this.lineStream.push(n)},t.end=function(){this.lineStream.push("\n");this.trigger("end")},t.addParser=function(n){this.parseStream.addParser(n)},t.addTagMapper=function(n){this.parseStream.addTagMapper(n)},r}(vy),eu={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},eat=["video","audio","text"],ltt=["Video","Audio","Text"],att=function(n){return n?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}):n},vi=function(n){n===void 0&&(n="");var i=n.split(","),t=[];return i.forEach(function(n){n=n.trim();var i;eat.forEach(function(r){var u=eu[r].exec(n.toLowerCase()),f,e;!u||u.length<=1||(i=r,f=n.substring(0,u[1].length),e=n.replace(f,""),t.push({type:f,details:e,mediaType:r}))});i||t.push({type:n,details:"",mediaType:"unknown"})}),t},oat=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 vi(r.playlists[0].attributes.CODECS);return null},vtt=function(n){return n===void 0&&(n=""),eu.audio.test(n.trim().toLowerCase())},sat=function(n){return n===void 0&&(n=""),eu.text.test(n.trim().toLowerCase())},ro=function(n){var t,r,i;if(n&&typeof n=="string")return t=n.toLowerCase().split(",").map(function(n){return att(n.trim())}),r="video",t.length===1&&vtt(t[0])?r="audio":t.length===1&&sat(t[0])&&(r="application"),i="mp4",t.every(function(n){return eu.mp4.test(n)})?i="mp4":t.every(function(n){return eu.webm.test(n)})?i="webm":t.every(function(n){return eu.ogg.test(n)})&&(i="ogg"),r+"/"+i+';codecs="'+n+'"'},fc=function(n){return n===void 0&&(n=""),window.MediaSource&&window.MediaSource.isTypeSupported&&window.MediaSource.isTypeSupported(ro(n))||!1},wy=function(n){return n===void 0&&(n=""),n.toLowerCase().split(",").every(function(n){var t,i;for(n=n.trim(),t=0;t<ltt.length;t++)if(i=ltt[t],eu["muxer"+i].test(n))return!0;return!1})},ytt="mp4a.40.2",hat="avc1.4d400d",cat=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,lat=/^application\/dash\+xml/i,ptt=function(n){return cat.test(n)?"hls":lat.test(n)?"dash":n==="application/vnd.videojs.vhs+json"?"vhs-json":null},aat=function(n){return window.atob?window.atob(n):Buffer.from(n,"base64").toString("binary")};var wtt=by({HTML:"text/html",isHTML:function(n){return n===wtt.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),btt=by({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(n){return n===btt.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"}),yat=by,pat=wtt,wat=btt,ec={freeze:yat,MIME_TYPE:pat,NAMESPACE:wat},uo=ec.NAMESPACE;var pt={},ei=pt.ELEMENT_NODE=1,of=pt.ATTRIBUTE_NODE=2,oc=pt.TEXT_NODE=3,dtt=pt.CDATA_SECTION_NODE=4,gtt=pt.ENTITY_REFERENCE_NODE=5,nvt=pt.ENTITY_NODE=6,nit=pt.PROCESSING_INSTRUCTION_NODE=7,tit=pt.COMMENT_NODE=8,iit=pt.DOCUMENT_NODE=9,rit=pt.DOCUMENT_TYPE_NODE=10,ur=pt.DOCUMENT_FRAGMENT_NODE=11,tvt=pt.NOTATION_NODE=12,ft={},d={};ft.INDEX_SIZE_ERR=(d[1]="Index size error",1);ft.DOMSTRING_SIZE_ERR=(d[2]="DOMString size error",2);uit=ft.HIERARCHY_REQUEST_ERR=(d[3]="Hierarchy request error",3);ft.WRONG_DOCUMENT_ERR=(d[4]="Wrong document",4);ft.INVALID_CHARACTER_ERR=(d[5]="Invalid character",5);ft.NO_DATA_ALLOWED_ERR=(d[6]="No data allowed",6);ft.NO_MODIFICATION_ALLOWED_ERR=(d[7]="No modification allowed",7);fit=ft.NOT_FOUND_ERR=(d[8]="Not found",8);ft.NOT_SUPPORTED_ERR=(d[9]="Not supported",9);ky=ft.INUSE_ATTRIBUTE_ERR=(d[10]="Attribute in use",10);ft.INVALID_STATE_ERR=(d[11]="Invalid state",11);ft.SYNTAX_ERR=(d[12]="Syntax error",12);ft.INVALID_MODIFICATION_ERR=(d[13]="Invalid modification",13);ft.NAMESPACE_ERR=(d[14]="Invalid namespace",14);ft.INVALID_ACCESS_ERR=(d[15]="Invalid access",15);ou.prototype=Error.prototype;fo(ft,ou);fr.prototype={length:0,item:function(n){return this[n]||null},toString:function(n,t){for(var r=[],i=0;i<this.length;i++)hf(this[i],r,n,t);return r.join("")}};sf.prototype.item=function(n){return dy(this),this[n]};yt(sf,fr);sc.prototype={length:0,item:fr.prototype.item,getNamedItem:function(n){for(var i=this.length,t;i--;)if(t=this[i],t.nodeName==n)return t},setNamedItem:function(n){var i=n.ownerElement,t;if(i&&i!=this._ownerElement)throw new ou(ky);return t=this.getNamedItem(n.nodeName),oit(this._ownerElement,this,n,t),t},setNamedItemNS:function(n){var i=n.ownerElement,t;if(i&&i!=this._ownerElement)throw new ou(ky);return t=this.getNamedItemNS(n.namespaceURI,n.localName),oit(this._ownerElement,this,n,t),t},removeNamedItem:function(n){var t=this.getNamedItem(n);return sit(this._ownerElement,this,t),t},removeNamedItemNS:function(n,t){var i=this.getNamedItemNS(n,t);return sit(this._ownerElement,this,i),i},getNamedItemNS:function(n,t){for(var r=this.length,i;r--;)if(i=this[r],i.localName==t&&i.namespaceURI==n)return i;return null}};hit.prototype={hasFeature:function(){return!0},createDocument:function(n,t,i){var r=new oo,u;return r.implementation=this,r.childNodes=new fr,r.doctype=i||null,i&&r.appendChild(i),t&&(u=r.createElementNS(n,t),r.appendChild(u)),r},createDocumentType:function(n,t,i){var r=new cc;return r.name=n,r.nodeName=n,r.publicId=t||"",r.systemId=i||"",r}};et.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(n,t){return vit(this,n,t)},replaceChild:function(n,t){this.insertBefore(n,t);t&&this.removeChild(t)},removeChild:function(n){return ait(this,n)},appendChild:function(n){return this.insertBefore(n,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(n){return ep(this.ownerDocument||this,this,n)},normalize:function(){for(var n=this.firstChild,t;n;)t=n.nextSibling,t&&t.nodeType==oc&&n.nodeType==oc?(this.removeChild(t),n.appendData(t.data)):(n.normalize(),n=t)},isSupported:function(n,t){return this.ownerDocument.implementation.hasFeature(n,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(n){for(var t=this,i,r;t;){if(i=t._nsMap,i)for(r in i)if(i[r]==n)return r;t=t.nodeType==of?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(n){for(var t=this,i;t;){if(i=t._nsMap,i&&n in i)return i[n];t=t.nodeType==of?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(n){var t=this.lookupPrefix(n);return t==null}};fo(pt,et);fo(pt,et.prototype);oo.prototype={nodeName:"#document",nodeType:iit,doctype:null,documentElement:null,_inc:1,insertBefore:function(n,t){var i,r;if(n.nodeType==ur){for(i=n.firstChild;i;)r=i.nextSibling,this.insertBefore(i,t),i=r;return n}return this.documentElement==null&&n.nodeType==ei&&(this.documentElement=n),vit(this,n,t),n.ownerDocument=this,n},removeChild:function(n){return this.documentElement==n&&(this.documentElement=null),ait(this,n)},importNode:function(n,t){return dit(this,n,t)},getElementById:function(n){var t=null;return eo(this.documentElement,function(i){if(i.nodeType==ei&&i.getAttribute("id")==n)return t=i,!0}),t},getElementsByClassName:function(n){var t=ktt(n);return new sf(this,function(i){var r=[];return t.length>0&&eo(i.documentElement,function(u){var f,e,o;u!==i&&u.nodeType===ei&&(f=u.getAttribute("class"),f&&(e=n===f,e||(o=ktt(f),e=t.every(gat(o))),e&&r.push(u)))}),r})},createElement:function(n){var t=new su,i;return t.ownerDocument=this,t.nodeName=n,t.tagName=n,t.localName=n,t.childNodes=new fr,i=t.attributes=new sc,i._ownerElement=t,t},createDocumentFragment:function(){var n=new lc;return n.ownerDocument=this,n.childNodes=new fr,n},createTextNode:function(n){var t=new np;return t.ownerDocument=this,t.appendData(n),t},createComment:function(n){var t=new tp;return t.ownerDocument=this,t.appendData(n),t},createCDATASection:function(n){var t=new ip;return t.ownerDocument=this,t.appendData(n),t},createProcessingInstruction:function(n,t){var i=new up;return i.ownerDocument=this,i.tagName=i.target=n,i.nodeValue=i.data=t,i},createAttribute:function(n){var t=new hc;return t.ownerDocument=this,t.name=n,t.nodeName=n,t.localName=n,t.specified=!0,t},createEntityReference:function(n){var t=new rp;return t.ownerDocument=this,t.nodeName=n,t},createElementNS:function(n,t){var i=new su,r=t.split(":"),u=i.attributes=new sc;return i.childNodes=new fr,i.ownerDocument=this,i.nodeName=t,i.tagName=t,i.namespaceURI=n,r.length==2?(i.prefix=r[0],i.localName=r[1]):i.localName=t,u._ownerElement=i,i},createAttributeNS:function(n,t){var i=new hc,r=t.split(":");return i.ownerDocument=this,i.nodeName=t,i.name=t,i.namespaceURI=n,i.specified=!0,r.length==2?(i.prefix=r[0],i.localName=r[1]):i.localName=t,i}};yt(oo,et);su.prototype={nodeType:ei,hasAttribute:function(n){return this.getAttributeNode(n)!=null},getAttribute:function(n){var t=this.getAttributeNode(n);return t&&t.value||""},getAttributeNode:function(n){return this.attributes.getNamedItem(n)},setAttribute:function(n,t){var i=this.ownerDocument.createAttribute(n);i.value=i.nodeValue=""+t;this.setAttributeNode(i)},removeAttribute:function(n){var t=this.getAttributeNode(n);t&&this.removeAttributeNode(t)},appendChild:function(n){return n.nodeType===ur?this.insertBefore(n,null):rvt(this,n)},setAttributeNode:function(n){return this.attributes.setNamedItem(n)},setAttributeNodeNS:function(n){return this.attributes.setNamedItemNS(n)},removeAttributeNode:function(n){return this.attributes.removeNamedItem(n.nodeName)},removeAttributeNS:function(n,t){var i=this.getAttributeNodeNS(n,t);i&&this.removeAttributeNode(i)},hasAttributeNS:function(n,t){return this.getAttributeNodeNS(n,t)!=null},getAttributeNS:function(n,t){var i=this.getAttributeNodeNS(n,t);return i&&i.value||""},setAttributeNS:function(n,t,i){var r=this.ownerDocument.createAttributeNS(n,t);r.value=r.nodeValue=""+i;this.setAttributeNode(r)},getAttributeNodeNS:function(n,t){return this.attributes.getNamedItemNS(n,t)},getElementsByTagName:function(n){return new sf(this,function(t){var i=[];return eo(t,function(r){r!==t&&r.nodeType==ei&&(n==="*"||r.tagName==n)&&i.push(r)}),i})},getElementsByTagNameNS:function(n,t){return new sf(this,function(i){var r=[];return eo(i,function(u){u!==i&&u.nodeType===ei&&(n==="*"||u.namespaceURI===n)&&(t==="*"||u.localName==t)&&r.push(u)}),r})}};oo.prototype.getElementsByTagName=su.prototype.getElementsByTagName;oo.prototype.getElementsByTagNameNS=su.prototype.getElementsByTagNameNS;yt(su,et);hc.prototype.nodeType=of;yt(hc,et);so.prototype={data:"",substringData:function(n,t){return this.data.substring(n,n+t)},appendData:function(n){n=this.data+n;this.nodeValue=this.data=n;this.length=n.length},insertData:function(n,t){this.replaceData(n,0,t)},appendChild:function(){throw new Error(d[uit]);},deleteData:function(n,t){this.replaceData(n,t,"")},replaceData:function(n,t,i){var r=this.data.substring(0,n),u=this.data.substring(n+t);i=r+i+u;this.nodeValue=this.data=i;this.length=i.length}};yt(so,et);np.prototype={nodeName:"#text",nodeType:oc,splitText:function(n){var t=this.data,r=t.substring(n),i;return t=t.substring(0,n),this.data=this.nodeValue=t,this.length=t.length,i=this.ownerDocument.createTextNode(r),this.parentNode&&this.parentNode.insertBefore(i,this.nextSibling),i}};yt(np,so);tp.prototype={nodeName:"#comment",nodeType:tit};yt(tp,so);ip.prototype={nodeName:"#cdata-section",nodeType:dtt};yt(ip,so);cc.prototype.nodeType=rit;yt(cc,et);yit.prototype.nodeType=tvt;yt(yit,et);pit.prototype.nodeType=nvt;yt(pit,et);rp.prototype.nodeType=gtt;yt(rp,et);lc.prototype.nodeName="#document-fragment";lc.prototype.nodeType=ur;yt(lc,et);up.prototype.nodeType=nit;yt(up,et);wit.prototype.serializeToString=function(n,t,i){return bit.call(n,t,i)};et.prototype.toString=bit;try{Object.defineProperty&&(op=function op(n){switch(n.nodeType){case ei:case ur:var t=[];for(n=n.firstChild;n;)n.nodeType!==7&&n.nodeType!==8&&t.push(op(n)),n=n.nextSibling;return t.join("");default:return n.nodeValue}},Object.defineProperty(sf.prototype,"length",{get:function(){return dy(this),this.$$length}}),Object.defineProperty(et.prototype,"textContent",{get:function(){return op(this)},set:function(n){switch(this.nodeType){case ei:case ur:while(this.firstChild)this.removeChild(this.firstChild);(n||String(n))&&this.appendChild(this.ownerDocument.createTextNode(n));break;default:this.data=n;this.value=n;this.nodeValue=n}}}),git=function(n,t,i){n["$$"+t]=i})}catch(afi){}var uvt=cc,fvt=ou,evt=hit,ovt=su,svt=et,hvt=fr,cvt=wit,sp={DocumentType:uvt,DOMException:fvt,DOMImplementation:evt,Element:ovt,Node:svt,NodeList:hvt,XMLSerializer:cvt},ho=vr(function(n,t){var i=ec.freeze;t.XML_ENTITIES=i({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});t.HTML_ENTITIES=i({lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"});t.entityMap=t.HTML_ENTITIES});ho.XML_ENTITIES;ho.HTML_ENTITIES;ho.entityMap;var co=ec.NAMESPACE,hp=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,nrt=new RegExp("[\\-\\.0-9"+hp.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),trt=new RegExp("^"+hp.source+nrt.source+"*(?::"+hp.source+nrt.source+"*)?$"),lo=0,lr=1,cf=2,ao=3,lf=4,af=5,vo=6,ac=7;vf.prototype=new Error;vf.prototype.name=vf.name;irt.prototype={parse:function(n,t,i){var r=this.domBuilder;r.startDocument();frt(t,t={});lvt(n,t,i,r,this.errorHandler);r.endDocument()}};ert.prototype={setTagName:function(n){if(!trt.test(n))throw new Error("invalid tagName:"+n);this.tagName=n},addValue:function(n,t,i){if(!trt.test(n))throw new Error("invalid attribute:"+n);this.attributeNames[n]=this.length;this[this.length++]={qName:n,value:t,offset:i}},length:0,getLocalName:function(n){return this[n].localName},getLocator:function(n){return this[n].locator},getQName:function(n){return this[n].qName},getURI:function(n){return this[n].uri},getValue:function(n){return this[n].value}};var kvt=irt,dvt=vf,ort={XMLReader:kvt,ParseError:dvt},gvt=sp.DOMImplementation,srt=ec.NAMESPACE,nyt=ort.ParseError,tyt=ort.XMLReader;hrt.prototype.parseFromString=function(n,t){var i=this.options,r=new tyt,u=i.domBuilder||new yo,s=i.errorHandler,e=i.locator,f=i.xmlns||{},o=/\/x?html?$/.test(t),h=o?ho.HTML_ENTITIES:ho.XML_ENTITIES;return e&&u.setDocumentLocator(e),r.errorHandler=iyt(s,u,e),r.domBuilder=i.domBuilder||u,o&&(f[""]=srt.HTML),f.xml=f.xml||srt.XML,n&&typeof n=="string"?r.parse(n,f,h):r.errorHandler.error("invalid doc source"),u.doc};yo.prototype={startDocument:function(){this.doc=(new gvt).createDocument(null,null,null);this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(n,t,i,r){var o=this.doc,f=o.createElementNS(n,i||t),s=r.length,u;for(vc(this,f),this.currentElement=f,this.locator&&yf(this.locator,f),u=0;u<s;u++){var n=r.getURI(u),h=r.getValue(u),i=r.getQName(u),e=o.createAttributeNS(n,i);this.locator&&yf(r.getLocator(u),e);e.value=e.nodeValue=h;f.setAttributeNode(e)}},endElement:function(){var n=this.currentElement;n.tagName;this.currentElement=n.parentNode},startPrefixMapping:function(){},endPrefixMapping:function(){},processingInstruction:function(n,t){var i=this.doc.createProcessingInstruction(n,t);this.locator&&yf(this.locator,i);vc(this,i)},ignorableWhitespace:function(){},characters:function(n){var t;n=crt.apply(this,arguments);n&&(t=this.cdata?this.doc.createCDATASection(n):this.doc.createTextNode(n),this.currentElement?this.currentElement.appendChild(t):/^\s*$/.test(n)&&this.doc.appendChild(t),this.locator&&yf(this.locator,t))},skippedEntity:function(){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(n){(this.locator=n)&&(n.lineNumber=0)},comment:function(n){n=crt.apply(this,arguments);var t=this.doc.createComment(n);this.locator&&yf(this.locator,t);vc(this,t)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(n,t,i){var u=this.doc.implementation,r;u&&u.createDocumentType&&(r=u.createDocumentType(n,t,i),this.locator&&yf(this.locator,r),vc(this,r),this.doc.doctype=r)},warning:function(n){console.warn("[xmldom warning]\t"+n,cp(this.locator))},error:function(n){console.error("[xmldom error]\t"+n,cp(this.locator))},fatalError:function(n){throw new nyt(n,this.locator);}};"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(n){yo.prototype[n]=function(){return null}});var ryt=yo,uyt=hrt,fyt=sp.DOMImplementation,eyt=sp.XMLSerializer,oyt={__DOMHandler:ryt,DOMParser:uyt,DOMImplementation:fyt,XMLSerializer:eyt},syt=oyt.DOMParser,lrt=function(n){return!!n&&typeof n=="object"},ot=function ot(){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 typeof t!="object"?n:(Object.keys(t).forEach(function(i){n[i]=Array.isArray(n[i])&&Array.isArray(t[i])?n[i].concat(t[i]):lrt(n[i])&&lrt(t[i])?ot(n[i],t[i]):t[i]}),n)},{})},hyt=function(n){return Object.keys(n).map(function(t){return n[t]})},cyt=function(n,t){for(var r=[],i=n;i<t;i++)r.push(i);return r},yc=function(n){return n.reduce(function(n,t){return n.concat(t)},[])},art=function(n){var i,t;if(!n.length)return[];for(i=[],t=0;t<n.length;t++)i.push(n[t]);return i},lyt=function(n,t){return n.reduce(function(n,i,r){return i[t]&&n.push(r),n},[])},pf={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"},po=function(n){var e=n.baseUrl,v=e===void 0?"":e,o=n.source,s=o===void 0?"":o,h=n.range,f=h===void 0?"":h,c=n.indexRange,l=c===void 0?"":c,a={uri:s,resolvedUri:uc(v||"",s)},r;if(f||l){var y=f?f:l,u=y.split("-"),t=window.BigInt?window.BigInt(u[0]):parseInt(u[0],10),i=window.BigInt?window.BigInt(u[1]):parseInt(u[1],10);t<Number.MAX_SAFE_INTEGER&&typeof t=="bigint"&&(t=Number(t));i<Number.MAX_SAFE_INTEGER&&typeof i=="bigint"&&(i=Number(i));r=typeof i=="bigint"||typeof t=="bigint"?window.BigInt(i)-window.BigInt(t)+window.BigInt(1):i-t+1;typeof r=="bigint"&&r<Number.MAX_SAFE_INTEGER&&(r=Number(r));a.byterange={length:r,offset:t}}return a},ayt=function(n){var t;return t=typeof n.offset=="bigint"||typeof n.length=="bigint"?window.BigInt(n.offset)+window.BigInt(n.length)-window.BigInt(1):n.offset+n.length-1,n.offset+"-"+t},vrt=function(n){return(n&&typeof n!="number"&&(n=parseInt(n,10)),isNaN(n))?null:n},vyt={"static":function(n){var f=n.duration,t=n.timescale,e=t===void 0?1:t,o=n.sourceDuration,i=n.periodDuration,r=vrt(n.endNumber),u=f/e;return typeof r=="number"?{start:0,end:r}:typeof i=="number"?{start:0,end:i/u}:{start:0,end:o/u}},dynamic:function(n){var c=n.NOW,l=n.clientOffset,a=n.availabilityStartTime,f=n.timescale,t=f===void 0?1:f,i=n.duration,e=n.start,v=e===void 0?0:e,o=n.minimumUpdatePeriod,y=o===void 0?0:o,s=n.timeShiftBufferDepth,p=s===void 0?Infinity:s,h=vrt(n.endNumber),r=(c+l)/1e3,u=a+v,w=r+y,b=w-u,k=Math.ceil(b*t/i),d=Math.floor((r-u-p)*t/i),g=Math.floor((r-u)*t/i);return{start:Math.max(0,d),end:typeof h=="number"?h:Math.min(k,g)}}},yyt=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}}},lp=function(n){var r=n.type,s=n.duration,u=n.timescale,h=u===void 0?1:u,f=n.periodDuration,c=n.sourceDuration,e=vyt[r](n),l=e.start,a=e.end,t=cyt(l,a).map(yyt(n)),i,o;return r==="static"&&(i=t.length-1,o=typeof f=="number"?f:c,t[i].duration=o-s/h*i),t},yrt=function(n){var i=n.baseUrl,u=n.initialization,f=u===void 0?{}:u,e=n.sourceDuration,o=n.indexRange,h=o===void 0?"":o,c=n.duration,s,t,r;if(!i)throw new Error(pf.NO_BASE_URL);return s=po({baseUrl:i,source:f.sourceURL,range:f.range}),t=po({baseUrl:i,source:i,indexRange:h}),t.map=s,c?(r=lp(n),r.length&&(t.duration=r[0].duration,t.timeline=r[0].timeline)):e&&(t.duration=e,t.timeline=0),t.number=0,[t]},ap=function(n,t,i){for(var e=n.sidx.map?n.sidx.map:null,v=n.sidx.duration,o=n.timeline||0,s=n.sidx.byterange,h=s.offset+s.length,y=t.timescale,p=t.references.filter(function(n){return n.referenceType!==1}),c=[],w=n.endList?"static":"dynamic",r=typeof t.firstOffset=="bigint"?window.BigInt(h)+t.firstOffset:h+t.firstOffset,u=0;u<p.length;u++){var l=t.references[u],f=l.referencedSize,b=l.subsegmentDuration,k=typeof r=="bigint"?r+window.BigInt(f)-window.BigInt(1):r+f-1;var d=r+"-"+k,g={baseUrl:i,timescale:y,timeline:o,periodIndex:o,duration:b,sourceDuration:v,indexRange:d,type:w},a=yrt(g)[0];e&&(a.map=e);c.push(a);r+=typeof r=="bigint"?window.BigInt(f):f}return n.segments=c,n},pc=function(n){return n&&n.uri+"-"+ayt(n.byterange)},prt=function(n){var t=hyt(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=lyt(n.segments,"discontinuity"),n})},vp=function(n,t){var i=pc(n.sidx),r=i&&t[i]&&t[i].sidx;return r&&ap(n,r,n.sidx.resolvedUri),n},pyt=function(n,t){if(t===void 0&&(t={}),!Object.keys(t).length)return n;for(var i in n)n[i]=vp(n[i],t);return n},wyt=function(n,t){var u,i=n.attributes,f=n.segments,e=n.sidx,r={attributes:(u={NAME:i.id,BANDWIDTH:i.bandwidth,CODECS:i.codecs},u["PROGRAM-ID"]=1,u),uri:"",endList:i.type==="static",timeline:i.periodIndex,resolvedUri:"",targetDuration:i.duration,segments:f,mediaSequence:f.length?f[0].number:1};return i.contentProtection&&(r.contentProtection=i.contentProtection),e&&(r.sidx=e),t&&(r.attributes.AUDIO="audio",r.attributes.SUBTITLES="subs"),r},byt=function(n){var r,t=n.attributes,i=n.segments,u;return typeof i=="undefined"&&(i=[{uri:t.baseUrl,timeline:t.periodIndex,resolvedUri:t.baseUrl||"",duration:t.sourceDuration,number:0}],t.duration=t.sourceDuration),u=(r={NAME:t.id,BANDWIDTH:t.bandwidth},r["PROGRAM-ID"]=1,r),t.codecs&&(u.CODECS=t.codecs),{attributes:u,uri:"",endList:t.type==="static",timeline:t.periodIndex,resolvedUri:t.baseUrl||"",targetDuration:t.duration,segments:i,mediaSequence:i.length?i[0].number:1}},kyt=function(n,t,i){var r,u,f;return t===void 0&&(t={}),i===void 0&&(i=!1),u=n.reduce(function(n,u){var f=u.attributes.role&&u.attributes.role.value||"",o=u.attributes.lang||"",e=u.attributes.label||"main",s,h;return o&&!u.attributes.label&&(s=f?" ("+f+")":"",e=""+u.attributes.lang+s),n[e]||(n[e]={language:o,autoselect:!0,"default":f==="main",playlists:[],uri:""}),h=vp(wyt(u,i),t),n[e].playlists.push(h),typeof r=="undefined"&&f==="main"&&(r=u,r["default"]=!0),n},{}),r||(f=Object.keys(u)[0],u[f]["default"]=!0),u},dyt=function(n,t){return t===void 0&&(t={}),n.reduce(function(n,i){var r=i.attributes.lang||"text";return n[r]||(n[r]={language:r,"default":!1,autoselect:!1,playlists:[],uri:""}),n[r].playlists.push(vp(byt(i),t)),n},{})},gyt=function(n){return n.reduce(function(n,t){return t?(t.forEach(function(t){var r=t.channel,i=t.language;n[i]={autoselect:!1,"default":!1,instreamId:r,language:i};t.hasOwnProperty("aspectRatio")&&(n[i].aspectRatio=t.aspectRatio);t.hasOwnProperty("easyReader")&&(n[i].easyReader=t.easyReader);t.hasOwnProperty("3D")&&(n[i]["3D"]=t["3D"])}),n):n},{})},npt=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",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},tpt=function(n){var t=n.attributes;return t.mimeType==="video/mp4"||t.mimeType==="video/webm"||t.contentType==="video"},ipt=function(n){var t=n.attributes;return t.mimeType==="audio/mp4"||t.mimeType==="audio/webm"||t.contentType==="audio"},rpt=function(n){var t=n.attributes;return t.mimeType==="text/vtt"||t.contentType==="text"},upt=function(n,t,i){var u,c;if(i===void 0&&(i={}),!n.length)return{};var f=n[0].attributes,l=f.sourceDuration,a=f.type,v=f.suggestedPresentationDelay,e=f.minimumUpdatePeriod,y=prt(n.filter(tpt)).map(npt),o=prt(n.filter(ipt)),s=n.filter(rpt),h=n.map(function(n){return n.attributes.captionServices}).filter(Boolean),r={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:(u={AUDIO:{},VIDEO:{}},u["CLOSED-CAPTIONS"]={},u.SUBTITLES={},u),uri:"",duration:l,playlists:pyt(y,i)};return e>=0&&(r.minimumUpdatePeriod=e*1e3),t&&(r.locations=t),a==="dynamic"&&(r.suggestedPresentationDelay=v),c=r.playlists.length===0,o.length&&(r.mediaGroups.AUDIO.audio=kyt(o,i,c)),s.length&&(r.mediaGroups.SUBTITLES.subs=dyt(s,i)),h.length&&(r.mediaGroups["CLOSED-CAPTIONS"].cc=gyt(h)),r},fpt=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)},wrt=function(n,t){for(var o,c,k,s,d=n.type,l=n.minimumUpdatePeriod,g=l===void 0?0:l,a=n.media,nt=a===void 0?"":a,tt=n.sourceDuration,v=n.timescale,y=v===void 0?1:v,p=n.startNumber,w=p===void 0?1:p,it=n.periodIndex,u=[],i=-1,f=0;f<t.length;f++){var h=t[f],r=h.d,b=h.r||0,e=h.t||0;for(i<0&&(i=e),e&&e>i&&(i=e),o=void 0,b<0?(c=f+1,o=c===t.length?d==="dynamic"&&g>0&&nt.indexOf("$Number$")>0?fpt(n,i,r):(tt*y-i)/r:(t[c].t-i)/r):o=b+1,k=w+u.length+o,s=w+u.length;s<k;)u.push({number:s,duration:r/y,time:i,timeline:it}),i+=r,s++}return u},ept=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,opt=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}},brt=function(n,t){return n.replace(ept,opt(t))},spt=function(n,t){return!n.duration&&!t?[{number:n.startNumber||1,duration:n.sourceDuration,time:0,timeline:n.periodIndex}]:n.duration?lp(n):wrt(n,t)},hpt=function(n,t){var i={RepresentationID:n.id,Bandwidth:n.bandwidth||0},r=n.initialization,u=r===void 0?{sourceURL:"",range:""}:r,f=po({baseUrl:n.baseUrl,source:brt(u.sourceURL,i),range:u.range}),e=spt(n,t);return e.map(function(t){i.Number=t.number;i.Time=t.time;var r=brt(n.media||"",i),u=n.timescale||1,e=n.presentationTimeOffset||0,o=n.periodStart+(t.time-e)/u;return{uri:r,timeline:t.timeline,duration:t.duration,resolvedUri:uc(n.baseUrl||"",r),map:f,number:t.number,presentationTime:o}})},cpt=function(n,t){var i=n.baseUrl,r=n.initialization,u=r===void 0?{}:r,e=po({baseUrl:i,source:u.sourceURL,range:u.range}),f=po({baseUrl:i,source:t.media,range:t.mediaRange});return f.map=e,f},lpt=function(n,t){var i=n.duration,f=n.segmentUrls,e=f===void 0?[]:f,o=n.periodStart,r,u;if(!i&&!t||i&&t)throw new Error(pf.SEGMENT_TIME_UNSPECIFIED);return r=e.map(function(t){return cpt(n,t)}),i&&(u=lp(n)),t&&(u=wrt(n,t)),u.map(function(t,i){if(r[i]){var u=r[i],f=n.timescale||1,e=n.presentationTimeOffset||0;return u.timeline=t.timeline,u.duration=t.duration,u.number=t.number,u.presentationTime=o+(t.time-e)/f,u}}).filter(function(n){return n})},apt=function(n){var e=n.attributes,i=n.segmentInfo,t,u,r,f;if(i.template?(u=hpt,t=ot(e,i.template)):i.base?(u=yrt,t=ot(e,i.base)):i.list&&(u=lpt,t=ot(e,i.list)),r={attributes:e},!u)return r;if(f=u(t,i.segmentTimeline),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},vpt=function(n){return n.map(apt)},w=function(n,t){return art(n.childNodes).filter(function(n){var i=n.tagName;return i===t})},yp=function(n){return n.textContent.trim()},wf=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)},ypt=function(n){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(n)&&(n+="Z"),Date.parse(n)},krt={mediaPresentationDuration:function(n){return wf(n)},availabilityStartTime:function(n){return ypt(n)/1e3},minimumUpdatePeriod:function(n){return wf(n)},suggestedPresentationDelay:function(n){return wf(n)},type:function(n){return n},timeShiftBufferDepth:function(n){return wf(n)},start:function(n){return wf(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)},presentationTimeOffset:function(n){return parseInt(n,10)},duration:function(n){var t=parseInt(n,10);return isNaN(t)?wf(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}},st=function(n){return(n&&n.attributes)?art(n.attributes).reduce(function(n,t){var i=krt[t.name]||krt.DEFAULT;return n[t.name]=i(t.value),n},{}):{}},ppt={"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"},wc=function(n,t){return t.length?yc(n.map(function(n){return t.map(function(t){return uc(n,yp(t))})})):n},pp=function(n){var f=w(n,"SegmentTemplate")[0],i=w(n,"SegmentList")[0],c=i&&w(i,"SegmentURL").map(function(n){return ot({tag:"SegmentURL"},st(n))}),e=w(n,"SegmentBase")[0],o=i||f,s=o&&w(o,"SegmentTimeline")[0],h=i||e||f,r=h&&w(h,"Initialization")[0],t=f&&st(f),u;return t&&r?t.initialization=r&&st(r):t&&t.initialization&&(t.initialization={sourceURL:t.initialization}),u={template:t,segmentTimeline:s&&w(s,"S").map(function(n){return st(n)}),list:i&&ot(st(i),{segmentUrls:c,initialization:st(r)}),base:e&&ot(st(e),{initialization:st(r)})},Object.keys(u).forEach(function(n){u[n]||delete u[n]}),u},wpt=function(n,t,i){return function(r){var u=w(r,"BaseURL"),f=wc(t,u),e=ot(n,st(r)),o=pp(r);return f.map(function(n){return{segmentInfo:ot(i,o),attributes:ot(e,{baseUrl:n})}})}},bpt=function(n){return n.reduce(function(n,t){var f=st(t),i=ppt[f.schemeIdUri],r,u,e;return i&&(n[i]={attributes:f},r=w(t,"cenc:pssh")[0],r&&(u=yp(r),e=u&&vat(u),n[i].pssh=e)),n},{})},kpt=function(n){var t,i;return n.schemeIdUri==="urn:scte:dash:cc:cea-608:2015"?(t=typeof n.value!="string"?[]:n.value.split(";"),t.map(function(n){var t,i,r;return i=n,/^CC\d=/.test(n)?(r=n.split("="),t=r[0],i=r[1]):/^CC\d$/.test(n)&&(t=n),{channel:t,language:i}})):n.schemeIdUri==="urn:scte:dash:cc:cea-708:2015"?(i=typeof n.value!="string"?[]:n.value.split(";"),i.map(function(n){var t={channel:undefined,language:undefined,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(n)){var i=n.split("="),u=i[0],r=i[1],f=r===void 0?"":r;t.channel=u;t.language=n;f.split(",").forEach(function(n){var u=n.split(":"),i=u[0],r=u[1];i==="lang"?t.language=r:i==="er"?t.easyReader=Number(r):i==="war"?t.aspectRatio=Number(r):i==="3D"&&(t["3D"]=Number(r))})}else t.language=n;return t.channel&&(t.channel="SERVICE"+t.channel),t})):void 0},dpt=function(n,t,i){return function(r){var h=st(r),c=wc(t,w(r,"BaseURL")),l=w(r,"Role")[0],a={role:st(l)},u=ot(n,h,a),v=w(r,"Accessibility")[0],o=kpt(st(v)),f,s,e;o&&(u=ot(u,{captionServices:o}));f=w(r,"Label")[0];f&&f.childNodes.length&&(s=f.childNodes[0].nodeValue.trim(),u=ot(u,{label:s}));e=bpt(w(r,"ContentProtection"));Object.keys(e).length&&(u=ot(u,{contentProtection:e}));var y=pp(r),p=w(r,"Representation"),b=ot(i,y);return yc(p.map(wpt(u,c,b)))}},gpt=function(n,t){return function(i,r){var s=wc(t,w(i.node,"BaseURL")),u=parseInt(i.attributes.id,10),h=window.isNaN(u)?r:u,f=ot(n,{periodIndex:h,periodStart:i.attributes.start}),e,o;return typeof i.attributes.duration=="number"&&(f.periodDuration=i.attributes.duration),e=w(i.node,"AdaptationSet"),o=pp(i.node),yc(e.map(dpt(f,s,o)))}},nwt=function(n){var i=n.attributes,t=n.priorPeriodAttributes,r=n.mpdType;return typeof i.start=="number"?i.start:t&&typeof t.start=="number"&&typeof t.duration=="number"?t.start+t.duration:!t&&r==="static"?0:null},twt=function(n,t){var r;t===void 0&&(t={});var u=t,f=u.manifestUri,c=f===void 0?"":f,e=u.NOW,l=e===void 0?Date.now():e,o=u.clientOffset,a=o===void 0?0:o,s=w(n,"Period");if(!s.length)throw new Error(pf.INVALID_NUMBER_OF_PERIOD);var h=w(n,"Location"),i=st(n),v=wc([c],w(n,"BaseURL"));return i.type=i.type||"static",i.sourceDuration=i.mediaPresentationDuration||0,i.NOW=l,i.clientOffset=a,h.length&&(i.locations=h.map(yp)),r=[],s.forEach(function(n,t){var u=st(n),f=r[t-1];u.start=nwt({attributes:u,priorPeriodAttributes:f?f.attributes:null,mpdType:i.type});r.push({node:n,attributes:u})}),{locations:i.locations,representationInfo:yc(r.map(gpt(i,v)))}},drt=function(n){if(n==="")throw new Error(pf.DASH_EMPTY_MANIFEST);var r=new syt,i,t;try{i=r.parseFromString(n,"application/xml");t=i&&i.documentElement.tagName==="MPD"?i.documentElement:null}catch(u){}if(!t||t&&t.getElementsByTagName("parsererror").length>0)throw new Error(pf.DASH_INVALID_XML);return t},iwt=function(n){var i=w(n,"UTCTiming")[0],t;if(!i)return null;t=st(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(pf.UNSUPPORTED_UTC_TIMING_SCHEME);}return t},rwt=function(n,t){t===void 0&&(t={});var i=twt(drt(n),t),r=vpt(i.representationInfo);return upt(r,i.locations,t.sidxMapping)},uwt=function(n){return iwt(drt(n))},grt=Math.pow(2,32),fwt=function(n){var t=new DataView(n.buffer,n.byteOffset,n.byteLength),i;return t.getBigUint64?(i=t.getBigUint64(0),i<Number.MAX_SAFE_INTEGER)?Number(i):i:t.getUint32(0)*grt+t.getUint32(4)},ewt={getUint64:fwt,MAX_UINT32:grt},nut=ewt.getUint64,owt=function(n){var i=new DataView(n.buffer,n.byteOffset,n.byteLength),r={version:n[0],flags:new Uint8Array(n.subarray(1,4)),references:[],referenceId:i.getUint32(4),timescale:i.getUint32(8)},t=12,u;for(r.version===0?(r.earliestPresentationTime=i.getUint32(t),r.firstOffset=i.getUint32(t+4),t+=8):(r.earliestPresentationTime=nut(n.subarray(t)),r.firstOffset=nut(n.subarray(t+8)),t+=16),t+=2,u=i.getUint16(t),t+=2;u>0;t+=12,u--)r.references.push({referenceType:(n[t]&128)>>>7,referencedSize:i.getUint32(t)&2147483647,subsegmentDuration:i.getUint32(t+4),startsWithSap:!!(n[t+8]&128),sapType:(n[t+8]&112)>>>4,sapDeltaTime:i.getUint32(t+8)&268435455});return r},swt=owt,hwt=function(n){return n.toString(2).length},cwt=function(n){return Math.ceil(hwt(n)/8)},lwt=function(n){return ArrayBuffer.isView(n)},u=function(n){return n instanceof Uint8Array?n:(Array.isArray(n)||lwt(n)||n instanceof ArrayBuffer||(n=typeof n!="number"||typeof n=="number"&&n!==n?0:[n]),new Uint8Array(n&&n.buffer||n,n&&n.byteOffset||0,n&&n.byteLength||0))},nt=window.BigInt||Number,wp=[nt("0x1"),nt("0x100"),nt("0x10000"),nt("0x1000000"),nt("0x100000000"),nt("0x10000000000"),nt("0x1000000000000"),nt("0x100000000000000"),nt("0x10000000000000000")],awt=function(n,t){var e=t===void 0?{}:t,o=e.signed,c=o===void 0?!1:o,s=e.le,h=s===void 0?!1:s,r;n=u(n);var f=h?"reduce":"reduceRight",l=n[f]?n[f]:Array.prototype[f],i=l.call(n,function(t,i,r){var u=h?r:Math.abs(r+1-n.length);return t+nt(i)*wp[u]},nt(0));return c&&(r=wp[n.length]/nt(2)-nt(1),i=nt(i),i>r&&(i-=r,i-=r,i-=nt(2))),Number(i)},vwt=function(n,t){var o=t===void 0?{}:t,e=o.le,s=e===void 0?!1:e,f,i,r,u;for((typeof n!="bigint"&&typeof n!="number"||typeof n=="number"&&n!==n)&&(n=0),n=nt(n),f=cwt(n),i=new Uint8Array(new ArrayBuffer(f)),r=0;r<f;r++)u=s?r:Math.abs(r+1-i.length),i[u]=Number(n/wp[r]&nt(255)),n<0&&(i[u]=Math.abs(~i[u]),i[u]-=r===0?1:2);return i},tut=function(n,t){var r,i;if(typeof n!="string"&&n&&typeof n.toString=="function"&&(n=n.toString()),typeof n!="string")return new Uint8Array;for(t||(n=unescape(encodeURIComponent(n))),r=new Uint8Array(n.length),i=0;i<n.length;i++)r[i]=n.charCodeAt(i);return r},ywt=function(){for(var i=arguments.length,n=new Array(i),t=0;t<i;t++)n[t]=arguments[t];if(n=n.filter(function(n){return n&&(n.byteLength||n.length)&&typeof n!="string"}),n.length<=1)return u(n[0]);var e=n.reduce(function(n,t){return n+(t.byteLength||t.length)},0),r=new Uint8Array(e),f=0;return n.forEach(function(n){n=u(n);r.set(n,f);f+=n.byteLength}),r},a=function(n,t,i){var f=i===void 0?{}:i,e=f.offset,r=e===void 0?0:e,o=f.mask,s=o===void 0?[]:o,h;return n=u(n),t=u(t),h=t.every?t.every:Array.prototype.every,t.length&&n.length-r>=t.length&&h.call(t,function(t,i){var u=s[i]?s[i]&n[r+i]:n[r+i];return t===u})},pwt=u([73,68,51]),wwt=function(n,t){t===void 0&&(t=0);n=u(n);var r=n[t+5],i=n[t+6]<<21|n[t+7]<<14|n[t+8]<<7|n[t+9],f=(r&16)>>4;return f?i+20:i+10},bf=function bf(n,t){return(t===void 0&&(t=0),n=u(n),n.length-t<10||!a(n,pwt,{offset:t}))?t:(t+=wwt(n,t),bf(n,t))},iut=function(n){return typeof n=="string"?tut(n):(typeof n=="number",n)},bwt=function(n){return Array.isArray(n)?n.map(function(n){return iut(n)}):[iut(n)]},rut=function rut(n,t,i){var f,r,o,h,e,s;if(i===void 0&&(i=!1),t=bwt(t),n=u(n),f=[],!t.length)return f;for(r=0;r<n.length;){if(o=(n[r]<<24|n[r+1]<<16|n[r+2]<<8|n[r+3])>>>0,h=n.subarray(r+4,r+8),o===0)break;if(e=r+o,e>n.length){if(i)break;e=n.length}s=n.subarray(r+8,e);a(h,t[0])&&(t.length===1?f.push(s):f.push.apply(f,rut(s,t.slice(1),i)));r=e}return f},bc={EBML:u([26,69,223,163]),DocType:u([66,130]),Segment:u([24,83,128,103]),SegmentInfo:u([21,73,169,102]),Tracks:u([22,84,174,107]),Track:u([174]),TrackNumber:u([215]),DefaultDuration:u([35,227,131]),TrackEntry:u([174]),TrackType:u([131]),FlagDefault:u([136]),CodecID:u([134]),CodecPrivate:u([99,162]),VideoTrack:u([224]),AudioTrack:u([225]),Cluster:u([31,67,182,117]),Timestamp:u([231]),TimestampScale:u([42,215,177]),BlockGroup:u([160]),BlockDuration:u([155]),Block:u([161]),SimpleBlock:u([163])},bp=[128,64,32,16,8,4,2,1],kwt=function(n){for(var i=1,t=0;t<bp.length;t++){if(n&bp[t])break;i++}return i},kc=function(n,t,i,r){i===void 0&&(i=!0);r===void 0&&(r=!1);var u=kwt(n[t]),f=n.subarray(t,t+u);return i&&(f=Array.prototype.slice.call(n,t,t+u),f[0]^=bp[u-1]),{length:u,value:awt(f,{signed:r}),bytes:f}},kp=function kp(n){return typeof n=="string"?n.match(/.{1,2}/g).map(function(n){return kp(n)}):typeof n=="number"?vwt(n):n},dwt=function(n){return Array.isArray(n)?n.map(function(n){return kp(n)}):[kp(n)]},uut=function uut(n,t,i){var r,u;return i>=t.length?t.length:(r=kc(t,i,!1),a(n.bytes,r.bytes))?i:(u=kc(t,i+r.length),uut(n,t,i+u.length+u.value+r.length))},dp=function dp(n,t){var r,f,h,s,c;if(t=dwt(t),n=u(n),r=[],!t.length)return r;for(f=0;f<n.length;){var e=kc(n,f,!1),i=kc(n,f+e.length),o=f+e.length+i.length;i.value===127&&(i.value=uut(e,n,o),i.value!==n.length&&(i.value-=o));h=o+i.value>n.length?n.length:o+i.value;s=n.subarray(o,h);a(t[0],e.bytes)&&(t.length===1?r.push(s):r=r.concat(dp(s,t.slice(1))));c=e.length+i.length+s.length;f+=c}return r},gwt=u([0,0,0,1]),nbt=u([0,0,1]),tbt=u([0,0,3]),ibt=function(n){for(var i=[],t=1;t<n.length-2;)a(n.subarray(t,t+3),tbt)&&(i.push(t+2),t++),t++;if(i.length===0)return n;var u=n.length-i.length,f=new Uint8Array(u),r=0;for(t=0;t<u;r++,t++)r===i[0]&&(r++,i.shift()),f[t]=n[r];return f},fut=function(n,t,i,r){var f,o,h,e,s;for(r===void 0&&(r=Infinity),n=u(n),i=[].concat(i),f=0,h=0;f<n.length&&(h<r||o);){if(e=void 0,a(n.subarray(f),gwt)?e=4:a(n.subarray(f),nbt)&&(e=3),!e){f++;continue}if(h++,o)return ibt(n.subarray(o,f));s=void 0;t==="h264"?s=n[f+e]&31:t==="h265"&&(s=n[f+e]>>1&63);i.indexOf(s)!==-1&&(o=f+e);f+=e+(t==="h264"?1:2)}return n.subarray(0,0)},rbt=function(n,t,i){return fut(n,"h264",t,i)},ubt=function(n,t,i){return fut(n,"h265",t,i)},vt={webm:u([119,101,98,109]),matroska:u([109,97,116,114,111,115,107,97]),flac:u([102,76,97,67]),ogg:u([79,103,103,83]),ac3:u([11,119]),riff:u([82,73,70,70]),avi:u([65,86,73]),wav:u([87,65,86,69]),"3gp":u([102,116,121,112,51,103]),mp4:u([102,116,121,112]),fmp4:u([115,116,121,112]),mov:u([102,116,121,112,113,116]),moov:u([109,111,111,118]),moof:u([109,111,111,102])},kf={aac:function(n){var t=bf(n);return a(n,[255,16],{offset:t,mask:[255,22]})},mp3:function(n){var t=bf(n);return a(n,[255,2],{offset:t,mask:[255,6]})},webm:function(n){var t=dp(n,[bc.EBML,bc.DocType])[0];return a(t,vt.webm)},mkv:function(n){var t=dp(n,[bc.EBML,bc.DocType])[0];return a(t,vt.matroska)},mp4:function(n){return kf["3gp"](n)||kf.mov(n)?!1:a(n,vt.mp4,{offset:4})||a(n,vt.fmp4,{offset:4})?!0:a(n,vt.moof,{offset:4})||a(n,vt.moov,{offset:4})?!0:void 0},mov:function(n){return a(n,vt.mov,{offset:4})},"3gp":function(n){return a(n,vt["3gp"],{offset:4})},ac3:function(n){var t=bf(n);return a(n,vt.ac3,{offset:t})},ts:function(n){if(n.length<189&&n.length>=1)return n[0]===71;for(var t=0;t+188<n.length&&t<188;){if(n[t]===71&&n[t+188]===71)return!0;t+=1}return!1},flac:function(n){var t=bf(n);return a(n,vt.flac,{offset:t})},ogg:function(n){return a(n,vt.ogg)},avi:function(n){return a(n,vt.riff)&&a(n,vt.avi,{offset:8})},wav:function(n){return a(n,vt.riff)&&a(n,vt.wav,{offset:8})},h264:function(n){return rbt(n,7,3).length},h265:function(n){return ubt(n,[32,33],3).length}},gp=Object.keys(kf).filter(function(n){return n!=="ts"&&n!=="h264"&&n!=="h265"}).concat(["ts","h264","h265"]);gp.forEach(function(n){var t=kf[n];kf[n]=function(n){return t(u(n))}});var fbt=kf,nw=function(n){var t,i;for(n=u(n),t=0;t<gp.length;t++)if(i=gp[t],fbt[i](n))return i;return""},ebt=function(n){return rut(n,["moof"]).length>0},tw=9e4,iw,rw,dc,uw,eut,out,sut;iw=function(n){return n*tw};rw=function(n,t){return n*t};dc=function(n){return n/tw};uw=function(n,t){return n/t};eut=function(n,t){return iw(uw(n,t))};out=function(n,t){return rw(dc(n),t)};sut=function(n,t,i){return dc(i?n:n-t)};var obt={ONE_SECOND_IN_TS:tw,secondsToVideoTs:iw,secondsToAudioTs:rw,videoTsToSeconds:dc,audioTsToSeconds:uw,audioTsToVideoTs:eut,videoTsToAudioTs:out,metadataTsToSeconds:sut},gc=obt.ONE_SECOND_IN_TS,oi=uc,nl=function(n,t,i){return n&&i&&i.responseURL&&t!==i.responseURL?i.responseURL:t},si=function(t){return n.log.debug?n.log.debug.bind(n,"VHS:",t+" >"):function(){}},ar=1/30,yi=ar*3,hut=function(t,i){var u=[],r;if(t&&t.length)for(r=0;r<t.length;r++)i(t.start(r),t.end(r))&&u.push([t.start(r),t.end(r)]);return n.createTimeRanges(u)},df=function(n,t){return hut(n,function(n,i){return n-yi<=t&&i+yi>=t})},tl=function(n,t){return hut(n,function(n){return n-ar>=t})},sbt=function(t){var r,i,u,f;if(t.length<2)return n.createTimeRanges();for(r=[],i=1;i<t.length;i++)u=t.end(i-1),f=t.start(i),r.push([u,f]);return n.createTimeRanges(r)},hbt=function(t,i){var f=null,e=null,o=0,u=[],s=[],r;if(!t||!t.length||!i||!i.length)return n.createTimeRange();for(r=t.length;r--;)u.push({time:t.start(r),type:"start"}),u.push({time:t.end(r),type:"end"});for(r=i.length;r--;)u.push({time:i.start(r),type:"start"}),u.push({time:i.end(r),type:"end"});for(u.sort(function(n,t){return n.time-t.time}),r=0;r<u.length;r++)u[r].type==="start"?(o++,o===2&&(f=u[r].time)):u[r].type==="end"&&(o--,o===1&&(e=u[r].time)),f!==null&&e!==null&&(s.push([f,e]),f=null,e=null);return n.createTimeRanges(s)},cut=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(", ")},cbt=function(n,t,i){i===void 0&&(i=1);var r=n.length?n.end(n.length-1):0;return(r-t)/i},hu=function(n){for(var i=[],t=0;t<n.length;t++)i.push({start:n.start(t),end:n.end(t)});return i},lbt=function(n,t){if(n===t)return!1;if(!n&&t||!t&&n||n.length!==t.length)return!0;for(var i=0;i<n.length;i++)if(n.start(i)!==t.start(i)||n.end(i)!==t.end(i))return!0;return!1},lut=function(n){if(n&&n.length&&n.end)return n.end(n.length-1)},fw=function(n,t){var u=0,i,f,r;if(!n||!n.length)return u;for(i=0;i<n.length;i++)if(f=n.start(i),r=n.end(i),!(t>r)){if(t>f&&t<=r){u+=r-t;continue}u+=r-f}return u},aut=n.createTimeRange,ew=function(n,t){if(!t.preload)return t.duration;var i=0;return(t.parts||[]).forEach(function(n){i+=n.duration}),(t.preloadHints||[]).forEach(function(t){t.type==="PART"&&(i+=n.partTargetDuration)}),i},ow=function(n){return(n.segments||[]).reduce(function(n,t,i){return t.parts?t.parts.forEach(function(r,u){n.push({duration:r.duration,segmentIndex:i,partIndex:u,part:r,segment:t})}):n.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),n},[])},vut=function(n){var t=n.segments&&n.segments.length&&n.segments[n.segments.length-1];return t&&t.parts||[]},yut=function(n){var t=n.preloadSegment;if(t){var i=t.parts,r=t.preloadHints,u=(r||[]).reduce(function(n,t){return n+(t.type==="PART"?1:0)},0);return u+(i&&i.length?i.length:0)}},put=function(n,t){if(t.endList)return 0;if(n&&n.suggestedPresentationDelay)return n.suggestedPresentationDelay;var i=vut(t).length>0;return i&&t.serverControl&&t.serverControl.partHoldBack?t.serverControl.partHoldBack:i&&t.partTargetDuration?t.partTargetDuration*3:t.serverControl&&t.serverControl.holdBack?t.serverControl.holdBack:t.targetDuration?t.targetDuration*3:0},abt=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+=ew(n,i),typeof i.start!="undefined")return{result:r+i.start,precise:!0}}return{result:r,precise:!1}},vbt=function(n,t){for(var r=0,i,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+=ew(n,i),typeof i.end!="undefined")return{result:i.end-r,precise:!0}}return{result:-1,precise:!1}},wut=function(n,t,i){var r,u;return(typeof t=="undefined"&&(t=n.mediaSequence+n.segments.length),t<n.mediaSequence)?0:(r=abt(n,t),r.precise)?r.result:(u=vbt(n,t),u.precise)?u.result:r.result+i},but=function(n,t,i){if(!n)return 0;if(typeof i!="number"&&(i=0),typeof t=="undefined"){if(n.totalDuration)return n.totalDuration;if(!n.endList)return window.Infinity}return wut(n,t,i)},wo=function(n){var o=n.defaultDuration,s=n.durationList,t=n.startIndex,i=n.endIndex,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+=o;t=0}for(r=t;r<i;r++)u+=s[r].duration;return u},kut=function(n,t,i,r){if(!n||!n.segments)return null;if(n.endList)return but(n);if(t===null)return null;t=t||0;var u=wut(n,n.mediaSequence+n.segments.length,t);return i&&(r=typeof r=="number"?r:put(null,n),u-=r),Math.max(0,u)},ybt=function(n,t,i){var u=t||0,r=kut(n,t,!0,i);return r===null?aut():aut(u,r)},pbt=function(n){for(var h,u,c,v,f,l,e=n.playlist,o=n.currentTime,w=n.startingSegmentIndex,y=n.startingPartIndex,a=n.startTime,p=n.experimentalExactManifestTimings,i=o-a,t=ow(e),r=0,s=0;s<t.length;s++)if((h=t[s],w===h.segmentIndex)&&(typeof y!="number"||typeof h.partIndex!="number"||y===h.partIndex)){r=s;break}if(i<0){if(r>0)for(u=r-1;u>=0;u--){if(c=t[u],i+=c.duration,p){if(i<0)continue}else if(i+ar<=0)continue;return{partIndex:c.partIndex,segmentIndex:c.segmentIndex,startTime:a-wo({defaultDuration:e.targetDuration,durationList:t,startIndex:r,endIndex:u})}}return{partIndex:t[0]&&t[0].partIndex||null,segmentIndex:t[0]&&t[0].segmentIndex||0,startTime:o}}if(r<0){for(v=r;v<0;v++)if(i-=e.targetDuration,i<0)return{partIndex:t[0]&&t[0].partIndex||null,segmentIndex:t[0]&&t[0].segmentIndex||0,startTime:o};r=0}for(f=r;f<t.length;f++){if(l=t[f],i-=l.duration,p){if(i>0)continue}else if(i-ar>=0)continue;return{partIndex:l.partIndex,segmentIndex:l.segmentIndex,startTime:a+wo({defaultDuration:e.targetDuration,durationList:t,startIndex:r,endIndex:f})}}return{segmentIndex:t[t.length-1].segmentIndex,partIndex:t[t.length-1].partIndex,startTime:o}},dut=function(n){return n.excludeUntil&&n.excludeUntil>Date.now()},sw=function(n){return n.excludeUntil&&n.excludeUntil===Infinity},il=function(n){var t=dut(n);return!n.disabled&&!t},wbt=function(n){return n.disabled},bbt=function(n){for(var t=0;t<n.segments.length;t++)if(n.segments[t].key)return!0;return!1},gut=function(n,t){return t.attributes&&t.attributes[n]},kbt=function(n,t,i,r){if(r===void 0&&(r=0),!gut("BANDWIDTH",i))return NaN;var u=n*i.attributes.BANDWIDTH;return(u-r*8)/t},hw=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 il(n)?(n.attributes.BANDWIDTH||0)<i:!1}).length===0},cw=function(n,t){return!n&&!t||!n&&t||n&&!t?!1:n===t?!0:n.id&&t.id&&n.id===t.id?!0:n.resolvedUri&&t.resolvedUri&&n.resolvedUri===t.resolvedUri?!0:n.uri&&t.uri&&n.uri===t.uri?!0:!1},nft=function(n,t){var r=n&&n.mediaGroups&&n.mediaGroups.AUDIO||{},i=!1,u,f;for(u in r){for(f in r[u])if(i=t(r[u][f]),i)break;if(i)break}return!!i},bo=function(n){var r,t,i;if(!n||!n.playlists||!n.playlists.length)return nft(n,function(n){return n.playlists&&n.playlists.length||n.uri});for(r=function(t){var i=n.playlists[t],r=i.attributes&&i.attributes.CODECS,u;return r&&r.split(",").every(function(n){return vtt(n)})?"continue":(u=nft(n,function(n){return cw(i,n)}),u)?"continue":{v:!1}},t=0;t<n.playlists.length;t++)if((i=r(t),i!=="continue")&&typeof i=="object")return i.v;return!0},wt={liveEdgeDelay:put,duration:but,seekable:ybt,getMediaInfoForTime:pbt,isEnabled:il,isDisabled:wbt,isBlacklisted:dut,isIncompatible:sw,playlistEnd:kut,isAes:bbt,hasAttribute:gut,estimateSegmentRequestTime:kbt,isLowestEnabledRendition:hw,isAudioOnly:bo,playlistMatch:cw,segmentDurationWithParts:ew},tft=n.log,lw=function(n,t){return n+"-"+t},dbt=function(n){var r=n.onwarn,o=n.oninfo,c=n.manifestString,s=n.customTagParsers,l=s===void 0?[]:s,h=n.customTagMappers,a=h===void 0?[]:h,v=n.experimentalLLHLS,i=new fat,t,u,f,e;if(r)i.on("warn",r);if(o)i.on("info",o);return l.forEach(function(n){return i.addParser(n)}),a.forEach(function(n){return i.addTagMapper(n)}),i.push(c),i.end(),t=i.manifest,v||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(n){t.hasOwnProperty(n)&&delete t[n]}),t.segments&&t.segments.forEach(function(n){["parts","preloadHints"].forEach(function(t){n.hasOwnProperty(t)&&delete n[t]})})),t.targetDuration||(u=10,t.segments&&t.segments.length&&(u=t.segments.reduce(function(n,t){return Math.max(n,t.duration)},0)),r&&r("manifest has no targetDuration defaulting to "+u),t.targetDuration=u),f=vut(t),f.length&&!t.partTargetDuration&&(e=f.reduce(function(n,t){return Math.max(n,t.duration)},0),r&&(r("manifest has no partTargetDuration defaulting to "+e),tft.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),t.partTargetDuration=e),t},ko=function(n,t){n.mediaGroups&&["AUDIO","SUBTITLES"].forEach(function(i){var r,u,f;if(n.mediaGroups[i])for(r in n.mediaGroups[i])for(u in n.mediaGroups[i][r])f=n.mediaGroups[i][r][u],t(f,i,r,u)})},ift=function(n){var t=n.playlist,i=n.uri,r=n.id;t.id=r;t.playlistErrors_=0;i&&(t.uri=i);t.attributes=t.attributes||{}},gbt=function(n){for(var i=n.playlists.length,t;i--;)t=n.playlists[i],ift({playlist:t,id:lw(i,t.uri)}),t.resolvedUri=oi(n.uri,t.uri),n.playlists[t.id]=t,n.playlists[t.uri]=t,t.attributes.BANDWIDTH||tft.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")},nkt=function(n){ko(n,function(t){t.uri&&(t.resolvedUri=oi(n.uri,t.uri))})},tkt=function(n,t){var r=lw(0,t),i={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:window.location.href,resolvedUri:window.location.href,playlists:[{uri:t,id:r,resolvedUri:t,attributes:{}}]};return i.playlists[r]=i.playlists[0],i.playlists[t]=i.playlists[0],i},rft=function(n,t){var i,r,u;for(n.uri=t,i=0;i<n.playlists.length;i++)n.playlists[i].uri||(r="placeholder-uri-"+i,n.playlists[i].uri=r);u=bo(n);ko(n,function(t,i,r,f){var s="placeholder-uri-"+i+"-"+r+"-"+f,e,o;if(!t.playlists||!t.playlists.length){if(u&&i==="AUDIO"&&!t.uri)for(e=0;e<n.playlists.length;e++)if(o=n.playlists[e],o.attributes&&o.attributes.AUDIO&&o.attributes.AUDIO===r)return;t.playlists=[hi({},t)]}t.playlists.forEach(function(t,i){var r=lw(i,s);t.uri?t.resolvedUri=t.resolvedUri||oi(n.uri,t.uri):(t.uri=i===0?s:r,t.resolvedUri=t.uri);t.id=t.id||r;t.attributes=t.attributes||{};n.playlists[t.id]=t;n.playlists[t.uri]=t})});gbt(n);nkt(n)},rl=n.mergeOptions,ikt=n.EventTarget,rkt=function(n,t){var i,u,f,e,r,o;return t.endList||!t.serverControl?n:(i={},t.serverControl.canBlockReload&&(u=t.preloadSegment,f=t.mediaSequence+t.segments.length,u&&(e=u.parts||[],r=yut(t)-1,r>-1&&r!==e.length-1&&(i._HLS_part=r),(r>-1||e.length)&&f--),i._HLS_msn=f),t.serverControl&&t.serverControl.canSkipUntil&&(i._HLS_skip=t.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(i).length&&(o=new window.URL(n),["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(n){i.hasOwnProperty(n)&&o.searchParams.set(n,i[n])}),n=o.toString()),n)},ukt=function(n,t){var i,r;if(!n)return t;if(i=rl(n,t),n.preloadHints&&!t.preloadHints&&delete i.preloadHints,n.parts&&!t.parts)delete i.parts;else if(n.parts&&t.parts)for(r=0;r<t.parts.length;r++)n.parts&&n.parts[r]&&(i.parts[r]=rl(n.parts[r],t.parts[r]));return!n.skipped&&t.skipped&&(i.skipped=!1),n.preload&&!t.preload&&(i.preload=!1),i},fkt=function(n,t,i){var h=n.slice(),s=t.slice(),f,e,r,o,u;for(i=i||0,f=[],r=0;r<s.length;r++)o=h[r+i],u=s[r],o?(e=o.map||e,f.push(ukt(o,u))):(e&&!u.map&&(u.map=e),f.push(u));return f},uft=function(n,t){!n.resolvedUri&&n.uri&&(n.resolvedUri=oi(t,n.uri));n.key&&!n.key.resolvedUri&&(n.key.resolvedUri=oi(t,n.key.uri));n.map&&!n.map.resolvedUri&&(n.map.resolvedUri=oi(t,n.map.uri));n.map&&n.map.key&&!n.map.key.resolvedUri&&(n.map.key.resolvedUri=oi(t,n.map.key.uri));n.parts&&n.parts.length&&n.parts.forEach(function(n){n.resolvedUri||(n.resolvedUri=oi(t,n.uri))});n.preloadHints&&n.preloadHints.length&&n.preloadHints.forEach(function(n){n.resolvedUri||(n.resolvedUri=oi(t,n.uri))})},fft=function(n){var r=n.segments||[],t=n.preloadSegment,i;if(t&&t.parts&&t.parts.length){if(t.preloadHints)for(i=0;i<t.preloadHints.length;i++)if(t.preloadHints[i].type==="MAP")return r;t.duration=n.targetDuration;t.preload=!0;r.push(t)}return r},eft=function(n,t){return n===t||n.segments&&t.segments&&n.segments.length===t.segments.length&&n.endList===t.endList&&n.mediaSequence===t.mediaSequence&&n.preloadSegment===t.preloadSegment},aw=function(n,t,i){var u,f,r,o,e;if((i===void 0&&(i=eft),u=rl(n,{}),f=u.playlists[t.id],!f)||i(f,t))return null;if(t.segments=fft(t),r=rl(f,t),r.preloadSegment&&!t.preloadSegment&&delete r.preloadSegment,f.segments){if(t.skip)for(t.segments=t.segments||[],o=0;o<t.skip.skippedSegments;o++)t.segments.unshift({skipped:!0});r.segments=fkt(f.segments,t.segments,t.mediaSequence-f.mediaSequence)}for(r.segments.forEach(function(n){uft(n,r.resolvedUri)}),e=0;e<u.playlists.length;e++)u.playlists[e].id===t.id&&(u.playlists[e]=r);return u.playlists[t.id]=r,u.playlists[t.uri]=r,ko(n,function(n){if(n.playlists)for(var i=0;i<n.playlists.length;i++)t.id===n.playlists[i].id&&(n.playlists[i]=t)}),u},vw=function(n,t){var r=n.segments||[],i=r[r.length-1],u=i&&i.parts&&i.parts[i.parts.length-1],f=u&&u.duration||i&&i.duration;return t&&f?f*1e3:(n.partTargetDuration||n.targetDuration||10)*500},gf=function(t){function u(i,r,u){var e,o;if(u===void 0&&(u={}),e=t.call(this)||this,!i)throw new Error("A non-empty playlist URL or object is required");e.logger_=si("PlaylistLoader");var s=u,h=s.withCredentials,l=h===void 0?!1:h,c=s.handleManifestRedirects,a=c===void 0?!1:c;e.src=i;e.vhs_=r;e.withCredentials=l;e.handleManifestRedirects=a;o=r.options_;e.customTagParsers=o&&o.customTagParsers||[];e.customTagMappers=o&&o.customTagMappers||[];e.experimentalLLHLS=o&&o.experimentalLLHLS||!1;n.browser.IE_VERSION&&(e.experimentalLLHLS=!1);e.state="HAVE_NOTHING";e.handleMediaupdatetimeout_=e.handleMediaupdatetimeout_.bind(f(e));e.on("mediaupdatetimeout",e.handleMediaupdatetimeout_);return e}i(u,t);var r=u.prototype;return r.handleMediaupdatetimeout_=function(){var n=this,i,t;this.state==="HAVE_METADATA"&&(i=this.media(),t=oi(this.master.uri,i.uri),this.experimentalLLHLS&&(t=rkt(t,i)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials},function(t){if(n.request){if(t)return n.playlistRequestError(n.request,n.media(),"HAVE_METADATA");n.haveMetadata({playlistString:n.request.responseText,url:n.media().uri,id:n.media().id})}}))},r.playlistRequestError=function(n,t,i){var r=t.uri,u=t.id;this.request=null;i&&(this.state=i);this.error={playlist:this.master.playlists[u],status:n.status,message:"HLS playlist request error at URL: "+r+".",responseText:n.responseText,code:n.status>=500?4:2};this.trigger("error")},r.parseManifest_=function(n){var t=this,i=n.url,r=n.manifestString;return dbt({onwarn:function(n){var r=n.message;return t.logger_("m3u8-parser warn for "+i+": "+r)},oninfo:function(n){var r=n.message;return t.logger_("m3u8-parser info for "+i+": "+r)},manifestString:r,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,experimentalLLHLS:this.experimentalLLHLS})},r.haveMetadata=function(n){var f=n.playlistString,e=n.playlistObject,r=n.url,u=n.id,t,i;this.request=null;this.state="HAVE_METADATA";t=e||this.parseManifest_({url:r,manifestString:f});t.lastRequest=Date.now();ift({playlist:t,uri:r,id:u});i=aw(this.master,t);this.targetDuration=t.partTargetDuration||t.targetDuration;this.pendingMedia_=null;i?(this.master=i,this.media_=this.master.playlists[u]):this.trigger("playlistunchanged");this.updateMediaUpdateTimeout_(vw(this.media(),!!i));this.trigger("loadedplaylist")},r.dispose=function(){this.trigger("dispose");this.stopRequest();window.clearTimeout(this.mediaUpdateTimeout);window.clearTimeout(this.finalRenditionTimeout);this.off()},r.stopRequest=function(){if(this.request){var n=this.request;this.request=null;n.onreadystatechange=null;n.abort()}},r.media=function(n,t){var i=this,u;if(!n)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);if(typeof n=="string"){if(!this.master.playlists[n])throw new Error("Unknown playlist URI: "+n);n=this.master.playlists[n]}if(window.clearTimeout(this.finalRenditionTimeout),t){u=(n.partTargetDuration||n.targetDuration)*500||5e3;this.finalRenditionTimeout=window.setTimeout(this.media.bind(this,n,!1),u);return}var r=this.state,f=!this.media_||n.id!==this.media_.id,e=this.master.playlists[n.id];if(e&&e.endList||n.endList&&n.segments.length){this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null);this.state="HAVE_METADATA";this.media_=n;f&&(this.trigger("mediachanging"),r==="HAVE_MASTER"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(vw(n,!0)),f){if(this.state="SWITCHING_MEDIA",this.request){if(n.resolvedUri===this.request.url)return;this.request.onreadystatechange=null;this.request.abort();this.request=null}this.media_&&this.trigger("mediachanging");this.pendingMedia_=n;this.request=this.vhs_.xhr({uri:n.resolvedUri,withCredentials:this.withCredentials},function(t,u){if(i.request){if(n.lastRequest=Date.now(),n.resolvedUri=nl(i.handleManifestRedirects,n.resolvedUri,u),t)return i.playlistRequestError(i.request,n,r);i.haveMetadata({playlistString:u.responseText,url:n.uri,id:n.id});r==="HAVE_MASTER"?i.trigger("loadedmetadata"):i.trigger("mediachange")}})}},r.pause=function(){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);this.stopRequest();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")},r.load=function(n){var i=this,t,r;if(this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),t=this.media(),n){r=t?(t.partTargetDuration||t.targetDuration)*500:5e3;this.mediaUpdateTimeout=window.setTimeout(function(){i.mediaUpdateTimeout=null;i.load()},r);return}if(!this.started){this.start();return}t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")},r.updateMediaUpdateTimeout_=function(n){var t=this;(this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList)&&(this.mediaUpdateTimeout=window.setTimeout(function(){t.mediaUpdateTimeout=null;t.trigger("mediaupdatetimeout");t.updateMediaUpdateTimeout_(n)},n))},r.start=function(){var n=this;if(this.started=!0,typeof this.src=="object"){this.src.uri||(this.src.uri=window.location.href);this.src.resolvedUri=this.src.uri;setTimeout(function(){n.setupInitialPlaylist(n.src)},0);return}this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},function(t,i){if(n.request){if(n.request=null,t)return n.error={status:i.status,message:"HLS playlist request error at URL: "+n.src+".",responseText:i.responseText,code:2},n.state==="HAVE_NOTHING"&&(n.started=!1),n.trigger("error");n.src=nl(n.handleManifestRedirects,n.src,i);var r=n.parseManifest_({manifestString:i.responseText,url:n.src});n.setupInitialPlaylist(r)}})},r.srcUri=function(){return typeof this.src=="string"?this.src:this.src.uri},r.setupInitialPlaylist=function(n){if(this.state="HAVE_MASTER",n.playlists){this.master=n;rft(this.master,this.srcUri());n.playlists.forEach(function(n){n.segments=fft(n);n.segments.forEach(function(t){uft(t,n.resolvedUri)})});this.trigger("loadedplaylist");this.request||this.media(this.master.playlists[0]);return}var t=this.srcUri()||window.location.href;this.master=tkt(n,t);this.haveMetadata({playlistObject:n,url:t,id:this.master.playlists[0].id});this.trigger("loadedmetadata")},u}(ikt),ekt=n.xhr,okt=n.mergeOptions,yw=function(n,t,i,r){var u=n.responseType==="arraybuffer"?n.response:n.responseText;!t&&u&&(n.responseTime=Date.now(),n.roundTripTime=n.responseTime-n.requestTime,n.bytesReceived=u.byteLength||u.length,n.bandwidth||(n.bandwidth=Math.floor(n.bytesReceived/n.roundTripTime*8e3)));i.headers&&(n.responseHeaders=i.headers);t&&t.code==="ETIMEDOUT"&&(n.timedout=!0);t||n.aborted||i.statusCode===200||i.statusCode===206||i.statusCode===0||(t=new Error("XHR Failed with a response of: "+(n&&(u||n.responseText))));r(t,n)},oft=function(){var t=function i(t,r){var f,e;t=okt({timeout:45e3},t);f=i.beforeRequest||n.Vhs.xhr.beforeRequest;f&&typeof f=="function"&&(e=f(t),e&&(t=e));var o=n.Vhs.xhr.original===!0?ekt:n.Vhs.xhr,u=o(t,function(n,t){return yw(u,n,t,r)}),s=u.abort;return u.abort=function(){return u.aborted=!0,s.apply(u,arguments)},u.uri=t.uri,u.requestTime=Date.now(),u};return t.original=!0,t},skt=function(n){var t,i=n.offset;return t=typeof n.offset=="bigint"||typeof n.length=="bigint"?window.BigInt(n.offset)+window.BigInt(n.length)-window.BigInt(1):n.offset+n.length-1,"bytes="+i+"-"+t},pw=function(n){var t={};return n.byterange&&(t.Range=skt(n.byterange)),t},hkt=function(n,t){return n.start(t)+"-"+n.end(t)},ckt=function(n,t){var i=n.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")},lkt=function(n){return n>=32&&n<126?String.fromCharCode(n):"."},sft=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},ul=function(n){var t=n.byterange||{length:Infinity,offset:0};return[t.length,t.offset,n.resolvedUri].join(",")},hft=function(n){return n.resolvedUri},cft=function(n){for(var r=Array.prototype.slice.call(n),t=16,u="",f,e,i=0;i<r.length/t;i++)f=r.slice(i*t,i*t+t).map(ckt).join(""),e=r.slice(i*t,i*t+t).map(lkt).join(""),u+=f+" "+e+"\n";return u},akt=function(n){var t=n.bytes;return cft(t)},vkt=function(n){for(var i="",t=0;t<n.length;t++)i+=hkt(n,t)+" ";return i},ykt=Object.freeze({__proto__:null,createTransferableMessage:sft,initSegmentId:ul,segmentKeyId:hft,hexDump:cft,tagDump:akt,textRanges:vkt}),lft=.25,pkt=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)},wkt=function(n){return n.transmuxedPresentationEnd-n.transmuxedPresentationStart-n.transmuxerPrependedSeconds},bkt=function(n,t){var u,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?wkt(r.videoTimingInfo):r.duration+r.duration*lft,h=new Date(o.getTime()+s*1e3);return u>h?null:(u>o&&(i=r),{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:wt.duration(t,t.mediaSequence+t.segments.indexOf(i)),type:i.videoTimingInfo?"accurate":"estimate"})},kkt=function(n,t){var r,i,f,u;if(!t||!t.segments||t.segments.length===0)return null;for(r=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*lft)return null;i=u}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:r-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}},dkt=function(n,t){var i,r,u,f;try{i=new Date(n);r=new Date(t)}catch(e){}return u=i.getTime(),f=r.getTime(),(f-u)/1e3},gkt=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},ndt=function(n){var e=n.playlist,o=n.time,r=o===void 0?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=kkt(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=pkt(r,i.segment),f&&(u.programDateTime=f.toISOString()),t(null,u))},aft=function aft(n){var i=n.programTime,r=n.playlist,h=n.retryCount,c=h===void 0?2:h,e=n.seekTo,l=n.pauseAfterSeek,a=l===void 0?!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(!gkt(r))return t({message:"programDateTime tags must be provided in the manifest "+r.resolvedUri});if(f=bkt(i,r),!f)return t({message:i+" was not found in the stream"});if(o=f.segment,s=dkt(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(){aft({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)},ww=function(n,t){if(n.readyState===4)return t()},tdt=function(n,t,i){var r=[],f,e=!1,u=function(n,t,r,u){return t.abort(),e=!0,i(n,t,r,u)},o=function(n,t){var o,i;if(!e)return n?u(n,t,"",r):(o=t.responseText.substring(r&&r.byteLength||0,t.responseText.length),r=ywt(r,tut(o,!0)),f=f||bf(r),r.length<10||f&&r.length<f+2)?ww(t,function(){return u(n,t,"",r)}):(i=nw(r),i==="ts"&&r.length<188)?ww(t,function(){return u(n,t,"",r)}):!i&&r.length<376?ww(t,function(){return u(n,t,"",r)}):u(null,t,i,r)},h={uri:n,beforeSend:function(n){n.overrideMimeType("text/plain; charset=x-user-defined");n.addEventListener("progress",function(t){return t.total,t.loaded,yw(n,null,{statusCode:n.status},o)})}},s=t(h,function(n,t){return yw(s,n,t,o)});return s},idt=n.EventTarget,vft=n.mergeOptions,yft=function(n,t){var i,f,e,r,u;if(!eft(n,t)||n.sidx&&t.sidx&&(n.sidx.offset!==t.sidx.offset||n.sidx.length!==t.sidx.length)||!n.sidx&&t.sidx||n.sidx&&!t.sidx||n.segments&&!t.segments||!n.segments&&t.segments)return!1;if(!n.segments&&!t.segments)return!0;for(i=0;i<n.segments.length;i++){if(f=n.segments[i],e=t.segments[i],f.uri!==e.uri)return!1;if((f.byterange||e.byterange)&&((r=f.byterange,u=e.byterange,r&&!u||!r&&u)||r.offset!==u.offset||r.length!==u.length))return!1}return!0},rdt=function(n){var r=n.masterXml,t=n.srcUrl,u=n.clientOffset,f=n.sidxMapping,i=rwt(r,{manifestUri:t,clientOffset:u,sidxMapping:f});return rft(i,t),i},udt=function(n,t,i){for(var u,e,s,f=!0,r=vft(n,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod}),o=0;o<t.playlists.length;o++)u=t.playlists[o],u.sidx&&(e=pc(u.sidx),i&&i[e]&&i[e].sidx&&ap(u,i[e].sidx,u.sidx.resolvedUri)),s=aw(r,u,yft),s&&(r=s,f=!1);return(ko(t,function(n,t,i,u){if(n.playlists&&n.playlists.length){var o=n.playlists[0].id,e=aw(r,n.playlists[0],yft);e&&(r=e,r.mediaGroups[t][i][u].playlists[0]=r.playlists[o],f=!1)}}),t.minimumUpdatePeriod!==n.minimumUpdatePeriod&&(f=!1),f)?null:r},fdt=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},pft=function(n,t){var u={},f,e,r,i,o;for(f in n)if(e=n[f],r=e.sidx,r){if(i=pc(r),!t[i])break;o=t[i].sidxInfo;fdt(o,r)&&(u[i]=t[i])}return u},edt=function(n,t){var r=pft(n.playlists,t),i=r;return ko(n,function(n){if(n.playlists&&n.playlists.length){var r=n.playlists;i=vft(i,pft(r,t))}}),i},bw=function(n){function r(t,i,r,u){var e;r===void 0&&(r={});e=n.call(this)||this;e.masterPlaylistLoader_=u||f(e);u||(e.isMaster_=!0);var o=r,s=o.withCredentials,c=s===void 0?!1:s,h=o.handleManifestRedirects,l=h===void 0?!1:h;if(e.vhs_=i,e.withCredentials=c,e.handleManifestRedirects=l,!t)throw new Error("A non-empty playlist URL or object is required");e.on("minimumUpdatePeriod",function(){e.refreshXml_()});e.on("mediaupdatetimeout",function(){e.refreshMedia_(e.media().id)});return e.state="HAVE_NOTHING",e.loadedPlaylists_={},e.logger_=si("DashPlaylistLoader"),e.isMaster_?(e.masterPlaylistLoader_.srcUrl=t,e.masterPlaylistLoader_.sidxMapping_={}):e.childPlaylist_=t,e}i(r,n);var t=r.prototype;return t.requestErrored_=function(n,t,i){return this.request?(this.request=null,n?(this.error=typeof n=="object"&&!(n instanceof Error)?n:{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2},i&&(this.state=i),this.trigger("error"),!0):void 0):!0},t.addSidxSegments_=function(n,t,i){var r=this,o=n.sidx&&pc(n.sidx),e,f;if(!n.sidx||!o||this.masterPlaylistLoader_.sidxMapping_[o]){this.mediaRequest_=window.setTimeout(function(){return i(!1)},0);return}e=nl(this.handleManifestRedirects,n.sidx.resolvedUri);f=function(f,e){if(!r.requestErrored_(f,e,t)){var h=r.masterPlaylistLoader_.sidxMapping_,s;try{s=swt(u(e.response).subarray(8))}catch(c){r.requestErrored_(c,e,t);return}return h[o]={sidxInfo:n.sidx,sidx:s},ap(n,s,n.sidx.resolvedUri),i(!0)}};this.request=tdt(e,this.vhs_.xhr,function(t,i,u,o){if(t)return f(t,i);if(!u||u!=="mp4")return f({status:i.status,message:"Unsupported "+(u||"unknown")+" container type for sidx segment at URL: "+e,response:"",playlist:n,internal:!0,blacklistDuration:Infinity,code:2},i);var h=n.sidx.byterange,s=h.offset,c=h.length;if(o.length>=c+s)return f(t,{response:o.subarray(s,s+c),status:i.status,uri:i.uri});r.request=r.vhs_.xhr({uri:e,responseType:"arraybuffer",headers:pw({byterange:n.sidx.byterange})},f)})},t.dispose=function(){this.trigger("dispose");this.stopRequest();this.loadedPlaylists_={};window.clearTimeout(this.minimumUpdatePeriodTimeout_);window.clearTimeout(this.mediaRequest_);window.clearTimeout(this.mediaUpdateTimeout);this.mediaUpdateTimeout=null;this.mediaRequest_=null;this.minimumUpdatePeriodTimeout_=null;this.masterPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_),this.masterPlaylistLoader_.createMupOnMedia_=null);this.off()},t.hasPendingRequest=function(){return this.request||this.mediaRequest_},t.stopRequest=function(){if(this.request){var n=this.request;this.request=null;n.onreadystatechange=null;n.abort()}},t.media=function(n){var r=this,i,t;if(!n)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);if(i=this.state,typeof n=="string"){if(!this.masterPlaylistLoader_.master.playlists[n])throw new Error("Unknown playlist URI: "+n);n=this.masterPlaylistLoader_.master.playlists[n]}if(t=!this.media_||n.id!==this.media_.id,t&&this.loadedPlaylists_[n.id]&&this.loadedPlaylists_[n.id].endList){this.state="HAVE_METADATA";this.media_=n;t&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}t&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(n,i,function(){r.haveMetadata({startingState:i,playlist:n})}))},t.haveMetadata=function(n){var i=n.startingState,t=n.playlist;this.state="HAVE_METADATA";this.loadedPlaylists_[t.id]=t;this.mediaRequest_=null;this.refreshMedia_(t.id);i==="HAVE_MASTER"?this.trigger("loadedmetadata"):this.trigger("mediachange")},t.pause=function(){this.masterPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_),this.masterPlaylistLoader_.createMupOnMedia_=null);this.stopRequest();window.clearTimeout(this.mediaUpdateTimeout);this.mediaUpdateTimeout=null;this.isMaster_&&(window.clearTimeout(this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_),this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_=null);this.state==="HAVE_NOTHING"&&(this.started=!1)},t.load=function(n){var r=this,t,i;if(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,t=this.media(),n){i=t?t.targetDuration*500:5e3;this.mediaUpdateTimeout=window.setTimeout(function(){return r.load()},i);return}if(!this.started){this.start();return}t&&!t.endList?(this.isMaster_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist")},t.start=function(){var n=this;if(this.started=!0,!this.isMaster_){this.mediaRequest_=window.setTimeout(function(){return n.haveMaster_()},0);return}this.requestMaster_(function(){n.haveMaster_();n.hasPendingRequest()||n.media_||n.media(n.masterPlaylistLoader_.master.playlists[0])})},t.requestMaster_=function(n){var t=this;this.request=this.vhs_.xhr({uri:this.masterPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},function(i,r){if(t.requestErrored_(i,r)){t.state==="HAVE_NOTHING"&&(t.started=!1);return}var u=r.responseText!==t.masterPlaylistLoader_.masterXml_;if(t.masterPlaylistLoader_.masterXml_=r.responseText,t.masterLoaded_=r.responseHeaders&&r.responseHeaders.date?Date.parse(r.responseHeaders.date):Date.now(),t.masterPlaylistLoader_.srcUrl=nl(t.handleManifestRedirects,t.masterPlaylistLoader_.srcUrl,r),u){t.handleMaster_();t.syncClientServerClock_(function(){return n(r,u)});return}return n(r,u)})},t.syncClientServerClock_=function(n){var i=this,t=uwt(this.masterPlaylistLoader_.masterXml_);if(t===null)return this.masterPlaylistLoader_.clientOffset_=this.masterLoaded_-Date.now(),n();if(t.method==="DIRECT")return this.masterPlaylistLoader_.clientOffset_=t.value-Date.now(),n();this.request=this.vhs_.xhr({uri:oi(this.masterPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials},function(r,u){if(i.request){if(r)return i.masterPlaylistLoader_.clientOffset_=i.masterLoaded_-Date.now(),n();var f;f=t.method==="HEAD"?u.responseHeaders&&u.responseHeaders.date?Date.parse(u.responseHeaders.date):i.masterLoaded_:Date.parse(u.responseText);i.masterPlaylistLoader_.clientOffset_=f-Date.now();n()}})},t.haveMaster_=function(){this.state="HAVE_MASTER";this.isMaster_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)},t.handleMaster_=function(){var n,t,i;return this.mediaRequest_=null,n=rdt({masterXml:this.masterPlaylistLoader_.masterXml_,srcUrl:this.masterPlaylistLoader_.srcUrl,clientOffset:this.masterPlaylistLoader_.clientOffset_,sidxMapping:this.masterPlaylistLoader_.sidxMapping_}),t=this.masterPlaylistLoader_.master,t&&(n=udt(t,n,this.masterPlaylistLoader_.sidxMapping_)),this.masterPlaylistLoader_.master=n?n:t,i=this.masterPlaylistLoader_.master.locations&&this.masterPlaylistLoader_.master.locations[0],i&&i!==this.masterPlaylistLoader_.srcUrl&&(this.masterPlaylistLoader_.srcUrl=i),(!t||n&&n.minimumUpdatePeriod!==t.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),Boolean(n)},t.updateMinimumUpdatePeriodTimeout_=function(){var n=this.masterPlaylistLoader_,t;if(n.createMupOnMedia_&&(n.off("loadedmetadata",n.createMupOnMedia_),n.createMupOnMedia_=null),n.minimumUpdatePeriodTimeout_&&(window.clearTimeout(n.minimumUpdatePeriodTimeout_),n.minimumUpdatePeriodTimeout_=null),t=n.master&&n.master.minimumUpdatePeriod,t===0)if(n.media())t=n.media().targetDuration*1e3;else{n.createMupOnMedia_=n.updateMinimumUpdatePeriodTimeout_;n.one("loadedmetadata",n.createMupOnMedia_)}if(typeof t!="number"||t<=0){t<0&&this.logger_("found invalid minimumUpdatePeriod of "+t+", not setting a timeout");return}this.createMUPTimeout_(t)},t.createMUPTimeout_=function(n){var t=this.masterPlaylistLoader_;t.minimumUpdatePeriodTimeout_=window.setTimeout(function(){t.minimumUpdatePeriodTimeout_=null;t.trigger("minimumUpdatePeriod");t.createMUPTimeout_(n)},n)},t.refreshXml_=function(){var n=this;this.requestMaster_(function(t,i){i&&(n.media_&&(n.media_=n.masterPlaylistLoader_.master.playlists[n.media_.id]),n.masterPlaylistLoader_.sidxMapping_=edt(n.masterPlaylistLoader_.master,n.masterPlaylistLoader_.sidxMapping_),n.addSidxSegments_(n.media(),n.state,function(){n.refreshMedia_(n.media().id)}))})},t.refreshMedia_=function(n){var t=this,i,r,u;if(!n)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMaster_&&this.handleMaster_();i=this.masterPlaylistLoader_.master.playlists;r=!this.media_||this.media_!==i[n];r?this.media_=i[n]:this.trigger("playlistunchanged");this.mediaUpdateTimeout||(u=function u(){t.media().endList||(t.mediaUpdateTimeout=window.setTimeout(function(){t.trigger("mediaupdatetimeout");u()},vw(t.media(),Boolean(r))))},u());this.trigger("loadedplaylist")},r}(idt),g={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30},odt=function(n){for(var i=new Uint8Array(new ArrayBuffer(n.length)),t=0;t<n.length;t++)i[t]=n.charCodeAt(t);return i.buffer},wft=function(n){return n.on=n.addEventListener,n.off=n.removeEventListener,n},sdt=function(n){try{return URL.createObjectURL(new Blob([n],{type:"application/javascript"}))}catch(i){var t=new BlobBuilder;return t.append(n),URL.createObjectURL(t.getBlob())}},bft=function(n){return function(){var i=sdt(n),t=wft(new Worker(i)),r;return t.objURL=i,r=t.terminate,t.on=t.addEventListener,t.off=t.removeEventListener,t.terminate=function(){return URL.revokeObjectURL(i),r.call(this)},t}},kft=function(n){return"var browserWorkerPolyFill = "+wft.toString()+";\nbrowserWorkerPolyFill(self);\n"+n},dft=function(n){return n.toString().replace(/^function.+?{/,"").slice(0,-1)},hdt=kft(dft(function(){var b=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={}}}},ot,f,er,ui,or,pf,wf,ei,ht,bf;b.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};b.prototype.push=function(n){this.trigger("data",n)};b.prototype.flush=function(n){this.trigger("done",n)};b.prototype.partialFlush=function(n){this.trigger("partialdone",n)};b.prototype.endTimeline=function(n){this.trigger("endedtimeline",n)};b.prototype.reset=function(n){this.trigger("reset",n)};var h=b,vr=Math.pow(2,32),ke=function(n){var t=new DataView(n.buffer,n.byteOffset,n.byteLength),i;return t.getBigUint64?(i=t.getBigUint64(0),i<Number.MAX_SAFE_INTEGER)?Number(i):i:t.getUint32(0)*vr+t.getUint32(4)},yi={getUint64:ke,MAX_UINT32:vr},yr=yi.MAX_UINT32,t,pr,wr,pi,br,kr,dr,gr,wi,nu,tu,iu,ru,uu,fu,eu,ou,su,hu,cu,lu,bi,n,ki,au,vu,yu,pu,wu,bu,ku,du,vt,gu,nf,tf;(function(){var t;if(n={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(t in n)n.hasOwnProperty(t)&&(n[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);ki=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]);vu=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]);au=new Uint8Array([0,0,0,1]);yu=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]);pu=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]);wu={video:yu,audio:pu};du=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]);ku=new Uint8Array([0,0,0,0,0,0,0,0]);vt=new Uint8Array([0,0,0,0,0,0,0,0]);gu=vt;nf=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]);tf=vt;bu=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})();t=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};pr=function(){return t(n.dinf,t(n.dref,du))};wr=function(i){return t(n.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,i.audioobjecttype<<3|i.samplingfrequencyindex>>>1,i.samplingfrequencyindex<<7|i.channelcount<<3,6,1,2]))};pi=function(){return t(n.ftyp,ki,au,ki,vu)};eu=function(i){return t(n.hdlr,wu[i])};br=function(i){return t(n.mdat,i)};fu=function(i){var r=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,i.duration>>>24&255,i.duration>>>16&255,i.duration>>>8&255,i.duration&255,85,196,0,0]);return i.samplerate&&(r[12]=i.samplerate>>>24&255,r[13]=i.samplerate>>>16&255,r[14]=i.samplerate>>>8&255,r[15]=i.samplerate&255),t(n.mdhd,r)};uu=function(i){return t(n.mdia,fu(i),eu(i.type),dr(i))};kr=function(i){return t(n.mfhd,new Uint8Array([0,0,0,0,(i&4278190080)>>24,(i&16711680)>>16,(i&65280)>>8,i&255]))};dr=function(i){return t(n.minf,i.type==="video"?t(n.vmhd,bu):t(n.smhd,ku),pr(),su(i))};gr=function(i,r){for(var f=[],u=r.length;u--;)f[u]=cu(r[u]);return t.apply(null,[n.moof,kr(i)].concat(f))};wi=function(i){for(var r=i.length,u=[];r--;)u[r]=iu(i[r]);return t.apply(null,[n.moov,tu(4294967295)].concat(u).concat(nu(i)))};nu=function(i){for(var r=i.length,u=[];r--;)u[r]=lu(i[r]);return t.apply(null,[n.mvex].concat(u))};tu=function(i){var r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(i&4278190080)>>24,(i&16711680)>>16,(i&65280)>>8,i&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 t(n.mvhd,r)};ou=function(i){for(var f=i.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 t(n.sdtp,e)};su=function(i){return t(n.stbl,hu(i),t(n.stts,tf),t(n.stsc,gu),t(n.stsz,nf),t(n.stco,vt))},function(){var i,r;hu=function(u){return t(n.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),u.type==="video"?i(u):r(u))};i=function(i){for(var u=i.sps||[],f=i.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=[n.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,(i.width&65280)>>8,i.width&255,(i.height&65280)>>8,i.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]),t(n.avcC,new Uint8Array([1,i.profileIdc,i.profileCompatibility,i.levelIdc,255].concat([u.length],e,[f.length],o))),t(n.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],i.sarRatio&&(s=i.sarRatio[0],h=i.sarRatio[1],c.push(t(n.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])))),t.apply(null,c)};r=function(i){return t(n.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(i.channelcount&65280)>>8,i.channelcount&255,(i.samplesize&65280)>>8,i.samplesize&255,0,0,0,0,(i.samplerate&65280)>>8,i.samplerate&255,0,0]),wr(i))}}();ru=function(i){var r=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(i.id&4278190080)>>24,(i.id&16711680)>>16,(i.id&65280)>>8,i.id&255,0,0,0,0,(i.duration&4278190080)>>24,(i.duration&16711680)>>16,(i.duration&65280)>>8,i.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,(i.width&65280)>>8,i.width&255,0,0,(i.height&65280)>>8,i.height&255,0,0]);return t(n.tkhd,r)};cu=function(i){var e,o,f,s,h,r,u;return(e=t(n.tfhd,new Uint8Array([0,0,0,58,(i.id&4278190080)>>24,(i.id&16711680)>>16,(i.id&65280)>>8,i.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),r=Math.floor(i.baseMediaDecodeTime/yr),u=Math.floor(i.baseMediaDecodeTime%yr),o=t(n.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,i.type==="audio")?(f=bi(i,h),t(n.traf,e,o,f)):(s=ou(i),f=bi(i,s.length+h),t(n.traf,e,o,f,s))};iu=function(i){return i.duration=i.duration||4294967295,t(n.trak,ru(i),uu(i))};lu=function(i){var r=new Uint8Array([0,0,0,0,(i.id&4278190080)>>24,(i.id&16711680)>>16,(i.id&65280)>>8,i.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return i.type!=="video"&&(r[r.length-1]=0),t(n.trex,r)},function(){var r,u,i;i=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,h,s,f,c;for(s=r.samples||[],u+=20+16*s.length,h=i(s,u),e=new Uint8Array(h.length+s.length*16),e.set(h),o=h.length,c=0;c<s.length;c++)f=s[c],e[o++]=(f.duration&4278190080)>>>24,e[o++]=(f.duration&16711680)>>>16,e[o++]=(f.duration&65280)>>>8,e[o++]=f.duration&255,e[o++]=(f.size&4278190080)>>>24,e[o++]=(f.size&16711680)>>>16,e[o++]=(f.size&65280)>>>8,e[o++]=f.size&255,e[o++]=f.flags.isLeading<<2|f.flags.dependsOn,e[o++]=f.flags.isDependedOn<<6|f.flags.hasRedundancy<<4|f.flags.paddingValue<<1|f.flags.isNonSyncSample,e[o++]=f.flags.degradationPriority&61440,e[o++]=f.flags.degradationPriority&15,e[o++]=(f.compositionTimeOffset&4278190080)>>>24,e[o++]=(f.compositionTimeOffset&16711680)>>>16,e[o++]=(f.compositionTimeOffset&65280)>>>8,e[o++]=f.compositionTimeOffset&255;return t(n.trun,e)};r=function(r,u){var f,e,h,s,o,c;for(s=r.samples||[],u+=20+8*s.length,h=i(s,u),f=new Uint8Array(h.length+s.length*8),f.set(h),e=h.length,c=0;c<s.length;c++)o=s[c],f[e++]=(o.duration&4278190080)>>>24,f[e++]=(o.duration&16711680)>>>16,f[e++]=(o.duration&65280)>>>8,f[e++]=o.duration&255,f[e++]=(o.size&4278190080)>>>24,f[e++]=(o.size&16711680)>>>16,f[e++]=(o.size&65280)>>>8,f[e++]=o.size&255;return t(n.trun,f)};bi=function(n,t){return n.type==="audio"?r(n,t):u(n,t)}}();var ut={ftyp:pi,mdat:br,moof:gr,moov:wi,initSegment:function(n){var i=pi(),r=wi(n),t;return t=new Uint8Array(i.byteLength+r.byteLength),t.set(i),t.set(r,i.byteLength),t}},de=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},ge=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},no=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},to=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},rf=function(n,t){var i=to();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},io=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=rf(e,o),o+=u.size,s.push(u);return s},ro=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},uo=function(n,t){var i,u=t||0,r=[];return i=rf(n,u),r.push(i),r},fo=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},ft={groupNalsIntoFrames:de,groupFramesIntoGops:ge,extendFirstKeyFrame:no,generateSampleTable:io,concatenateNalData:ro,generateSampleTableForFrame:uo,concatenateNalDataForFrame:fo},w=[33,16,5,32,164,27],di=[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},eo=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},{})},gi,oo=function(){if(!gi){var n={96e3:[w,[227,64],r(154),[56]],88200:[w,[231],r(170),[56]],64e3:[w,[248,192],r(240),[56]],48e3:[w,[255,192],r(268),[55,148,128],r(54),[112]],44100:[w,[255,192],r(268),[55,163,128],r(84),[112]],32e3:[w,[255,192],r(268),[55,234],r(226),[112]],24e3:[w,[255,192],r(268),[55,255,128],r(268),[111,112],r(126),[224]],16e3:[w,[255,192],r(268),[55,255,128],r(268),[111,255],r(269),[223,108],r(195),[1,192]],12e3:[di,r(268),[3,127,248],r(268),[6,255,240],r(268),[13,255,224],r(268),[27,253,128],r(259),[56]],11025:[di,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:[di,r(268),[3,121,16],r(47),[7]]};gi=eo(n)}return gi},nr=9e4,tr,ir,yt,rr,uf,ff,ef;tr=function(n){return n*nr};ir=function(n,t){return n*t};yt=function(n){return n/nr};rr=function(n,t){return n/t};uf=function(n,t){return tr(rr(n,t))};ff=function(n,t){return ir(yt(n),t)};ef=function(n,t,i){return yt(i?n:n-t)};var i={ONE_SECOND_IN_TS:nr,secondsToVideoTs:tr,secondsToAudioTs:ir,videoTsToSeconds:yt,audioTsToSeconds:rr,audioTsToVideoTs:uf,videoTsToAudioTs:ff,metadataTsToSeconds:ef},so=function(n){for(var i,r=0,t=0;t<n.length;t++)i=n[t],r+=i.data.byteLength;return r},ho=function(n,t,r,u){var l,f=0,a=0,e=0,o=0,s,h,c;if(t.length&&(l=i.audioTsToVideoTs(n.baseMediaDecodeTime,n.samplerate),f=Math.ceil(i.ONE_SECOND_IN_TS/(n.samplerate/1024)),r&&u&&(a=l-Math.max(r,u),e=Math.floor(a/f),o=e*f),!(e<1)&&!(o>i.ONE_SECOND_IN_TS/2))){for(s=oo()[n.samplerate],s||(s=t[0].data),h=0;h<e;h++)c=t[0],t.splice(0,0,{data:s,dts:c.dts-f,pts:c.pts-f});return n.baseMediaDecodeTime-=Math.floor(i.videoTsToAudioTs(o,n.samplerate)),o}},co=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}))},lo=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},ao=function(n){for(var i,r=0,u=new Uint8Array(so(n)),t=0;t<n.length;t++)i=n[t],u.set(i.data,r),r+=i.data.byteLength;return u},pt={prefixWithSilence:ho,trimAdtsFramesByEarliestDts:co,generateSampleTable:lo,concatenateFrameData:ao},vo=i.ONE_SECOND_IN_TS,yo=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))},po=function(n){delete n.minSegmentDts;delete n.maxSegmentDts;delete n.minSegmentPts;delete n.maxSegmentPts},wo=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/vo,i*=r,i=Math.floor(i)),i},a={clearDtsInfo:po,calculateTrackBaseMediaDecodeTime:wo,collectDtsInfo:yo},of=4,bo=128,ko=function(n){for(var t=0,i={payloadType:-1,payloadSize:0},u=0,r=0,f;t<n.byteLength;){if(n[t]===bo)break;while(n[t]===255)u+=255,t++;for(u+=n[t++];n[t]===255;)r+=255,t++;if(r+=n[t++],!i.payload&&u===of)if(f=String.fromCharCode(n[t+3],n[t+4],n[t+5],n[t+6]),f==="GA94"){i.payloadType=u;i.payloadSize=r;i.payload=n.subarray(t,t+r);break}else i.payload=void 0;t+=r;u=0;r=0}return i},go=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)},ns=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},ts=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},et={parseSei:ko,parseUserData:go,parseCaptionPackets:ns,discardEmulationPreventionBytes:ts,USER_DATA_REGISTERED_ITU_T_T35:of},l=function se(n){if(n=n||{},se.prototype.init.call(this),this.parse708captions_=typeof n.parse708captions=="boolean"?n.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new o(0,0),new o(0,1),new o(1,0),new o(1,1)],this.parse708captions_&&(this.cc708Stream_=new f({captionServices:n.captionServices})),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),this.parse708captions_){this.cc708Stream_.on("data",this.trigger.bind(this,"data"));this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone"));this.cc708Stream_.on("done",this.trigger.bind(this,"done"))}};l.prototype=new h;l.prototype.push=function(n){var t,i,r;if(n.nalUnitType==="sei_rbsp"&&(t=et.parseSei(n.escapedRBSP),t.payload)&&t.payloadType===et.USER_DATA_REGISTERED_ITU_T_T35&&(i=et.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=et.parseCaptionPackets(n.pts,i);this.captionPackets_=this.captionPackets_.concat(r);this.latestDts_!==n.dts&&(this.numSameDts_=0);this.numSameDts_++;this.latestDts_=n.dts}};l.prototype.flushCCStreams=function(n){this.ccStreams_.forEach(function(t){return n==="flush"?t.flush():t.partialFlush()},this)};l.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.dispatchCea708Packet(n)},this);this.captionPackets_.length=0;this.flushCCStreams(n)};l.prototype.flush=function(){return this.flushStream("flush")};l.prototype.partialFlush=function(){return this.flushStream("partialFlush")};l.prototype.reset=function(){this.latestDts_=null;this.ignoreNextEqualDts_=!1;this.numSameDts_=0;this.activeCea608Channel_=[null,null];this.ccStreams_.forEach(function(n){n.reset()})};l.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)};l.prototype.setsChannel1Active=function(n){return(n.ccData&30720)==4096};l.prototype.setsChannel2Active=function(n){return(n.ccData&30720)==6144};l.prototype.setsTextOrXDSActive=function(n){return(n.ccData&28928)==256||(n.ccData&30974)==4138||(n.ccData&30974)==6186};l.prototype.dispatchCea708Packet=function(n){this.parse708captions_&&this.cc708Stream_.push(n)};var is={127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600},rs=function(n){var t=is[n]||n;return n&4096&&n===t?"":String.fromCharCode(t)},wt=function(n){return 32<=n&&n<=127||160<=n&&n<=255},y=function(n){this.windowNum=n;this.reset()};y.prototype.reset=function(){this.clearText();this.pendingNewLine=!1;this.winAttr={};this.penAttr={};this.penLoc={};this.penColor={};this.visible=0;this.rowLock=0;this.columnLock=0;this.priority=0;this.relativePositioning=0;this.anchorVertical=0;this.anchorHorizontal=0;this.anchorPoint=0;this.rowCount=1;this.virtualRowCount=this.rowCount+1;this.columnCount=41;this.windowStyle=0;this.penStyle=0};y.prototype.getText=function(){return this.rows.join("\n")};y.prototype.clearText=function(){this.rows=[""];this.rowIdx=0};y.prototype.newLine=function(n){for(this.rows.length>=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(n),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--};y.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1};y.prototype.addText=function(n){this.rows[this.rowIdx]+=n};y.prototype.backspace=function(){if(!this.isEmpty()){var n=this.rows[this.rowIdx];this.rows[this.rowIdx]=n.substr(0,n.length-1)}};ot=function(n,t,i){this.serviceNum=n;this.text="";this.currentWindow=new y(-1);this.windows=[];this.stream=i;typeof t=="string"&&this.createTextDecoder(t)};ot.prototype.init=function(n,t){this.startPts=n;for(var i=0;i<8;i++)this.windows[i]=new y(i),typeof t=="function"&&(this.windows[i].beforeRowOverflow=t)};ot.prototype.setCurrentWindow=function(n){this.currentWindow=this.windows[n]};ot.prototype.createTextDecoder=function(n){if(typeof TextDecoder=="undefined")this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(n)}catch(t){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+n+" encoding. "+t})}};f=function f(n){n=n||{};f.prototype.init.call(this);var t=this,i=n.captionServices||{},r={},u;Object.keys(i).forEach(function(n){u=i[n];/^SERVICE/.test(n)&&(r[n]=u.encoding)});this.serviceEncodings=r;this.current708Packet=null;this.services={};this.push=function(n){n.type===3?(t.new708Packet(),t.add708Bytes(n)):(t.current708Packet===null&&t.new708Packet(),t.add708Bytes(n))}};f.prototype=new h;f.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet();this.current708Packet={data:[],ptsVals:[]}};f.prototype.add708Bytes=function(n){var t=n.ccData,i=t>>>8,r=t&255;this.current708Packet.ptsVals.push(n.pts);this.current708Packet.data.push(i);this.current708Packet.data.push(r)};f.prototype.push708Packet=function(){var f=this.current708Packet,r=f.data,u=null,i=null,n=0,t=r[n++];for(f.seq=t>>6,f.sizeCode=t&63;n<r.length;n++)t=r[n++],u=t>>5,i=t&31,u===7&&i>0&&(t=r[n++],u=t),this.pushServiceBlock(u,n,i),i>0&&(n+=i-1)};f.prototype.pushServiceBlock=function(n,t,i){var u,r=t,e=this.current708Packet.data,f=this.services[n];for(f||(f=this.initService(n,r));r<t+i&&r<e.length;r++)u=e[r],wt(u)?r=this.handleText(r,f):u===24?r=this.multiByteCharacter(r,f):u===16?r=this.extendedCommands(r,f):128<=u&&u<=135?r=this.setCurrentWindow(r,f):152<=u&&u<=159?r=this.defineWindow(r,f):u===136?r=this.clearWindows(r,f):u===140?r=this.deleteWindows(r,f):u===137?r=this.displayWindows(r,f):u===138?r=this.hideWindows(r,f):u===139?r=this.toggleWindows(r,f):u===151?r=this.setWindowAttributes(r,f):u===144?r=this.setPenAttributes(r,f):u===145?r=this.setPenColor(r,f):u===146?r=this.setPenLocation(r,f):u===143?f=this.reset(r,f):u===8?f.currentWindow.backspace():u===12?f.currentWindow.clearText():u===13?f.currentWindow.pendingNewLine=!0:u===14?f.currentWindow.clearText():u===141&&r++};f.prototype.extendedCommands=function(n,t){var i=this.current708Packet.data,r=i[++n];return wt(r)&&(n=this.handleText(n,t,{isExtended:!0})),n};f.prototype.getPts=function(n){return this.current708Packet.ptsVals[Math.floor(n/2)]};f.prototype.initService=function(n,t){var r="SERVICE"+n,i=this,u;return r in this.serviceEncodings&&(u=this.serviceEncodings[r]),this.services[n]=new ot(n,u,i),this.services[n].init(this.getPts(t),function(t){i.flushDisplayed(t,i.services[n])}),this.services[n]};f.prototype.handleText=function(n,t,i){var o=i&&i.isExtended,h=i&&i.isMultiByte,s=this.current708Packet.data,c=o?4096:0,u=s[n],l=s[n+1],r=t.currentWindow,f,e;return t.textDecoder_&&!o?(h?(e=[u,l],n++):e=[u],f=t.textDecoder_.decode(new Uint8Array(e))):f=rs(c|u),r.pendingNewLine&&!r.isEmpty()&&r.newLine(this.getPts(n)),r.pendingNewLine=!1,r.addText(f),n};f.prototype.multiByteCharacter=function(n,t){var i=this.current708Packet.data,r=i[n+1],u=i[n+2];return wt(r)&&wt(u)&&(n=this.handleText(++n,t,{isMultiByte:!0})),n};f.prototype.setCurrentWindow=function(n,t){var i=this.current708Packet.data,r=i[n],u=r&7;return t.setCurrentWindow(u),n};f.prototype.defineWindow=function(n,t){var u=this.current708Packet.data,i=u[n],f=i&7,r;return t.setCurrentWindow(f),r=t.currentWindow,i=u[++n],r.visible=(i&32)>>5,r.rowLock=(i&16)>>4,r.columnLock=(i&8)>>3,r.priority=i&7,i=u[++n],r.relativePositioning=(i&128)>>7,r.anchorVertical=i&127,i=u[++n],r.anchorHorizontal=i,i=u[++n],r.anchorPoint=(i&240)>>4,r.rowCount=i&15,i=u[++n],r.columnCount=i&63,i=u[++n],r.windowStyle=(i&56)>>3,r.penStyle=i&7,r.virtualRowCount=r.rowCount+1,n};f.prototype.setWindowAttributes=function(n,t){var u=this.current708Packet.data,i=u[n],r=t.currentWindow.winAttr;return i=u[++n],r.fillOpacity=(i&192)>>6,r.fillRed=(i&48)>>4,r.fillGreen=(i&12)>>2,r.fillBlue=i&3,i=u[++n],r.borderType=(i&192)>>6,r.borderRed=(i&48)>>4,r.borderGreen=(i&12)>>2,r.borderBlue=i&3,i=u[++n],r.borderType+=(i&128)>>5,r.wordWrap=(i&64)>>6,r.printDirection=(i&48)>>4,r.scrollDirection=(i&12)>>2,r.justify=i&3,i=u[++n],r.effectSpeed=(i&240)>>4,r.effectDirection=(i&12)>>2,r.displayEffect=i&3,n};f.prototype.flushDisplayed=function(n,t){for(var r=[],i=0;i<8;i++)t.windows[i].visible&&!t.windows[i].isEmpty()&&r.push(t.windows[i].getText());t.endPts=n;t.text=r.join("\n\n");this.pushCaption(t);t.startPts=n};f.prototype.pushCaption=function(n){n.text!==""&&(this.trigger("data",{startPts:n.startPts,endPts:n.endPts,text:n.text,stream:"cc708_"+n.serviceNum}),n.text="",n.startPts=n.endPts)};f.prototype.displayWindows=function(n,t){var r=this.current708Packet.data,u=r[++n],f=this.getPts(n),i;for(this.flushDisplayed(f,t),i=0;i<8;i++)u&1<<i&&(t.windows[i].visible=1);return n};f.prototype.hideWindows=function(n,t){var r=this.current708Packet.data,u=r[++n],f=this.getPts(n),i;for(this.flushDisplayed(f,t),i=0;i<8;i++)u&1<<i&&(t.windows[i].visible=0);return n};f.prototype.toggleWindows=function(n,t){var r=this.current708Packet.data,u=r[++n],f=this.getPts(n),i;for(this.flushDisplayed(f,t),i=0;i<8;i++)u&1<<i&&(t.windows[i].visible^=1);return n};f.prototype.clearWindows=function(n,t){var r=this.current708Packet.data,u=r[++n],f=this.getPts(n),i;for(this.flushDisplayed(f,t),i=0;i<8;i++)u&1<<i&&t.windows[i].clearText();return n};f.prototype.deleteWindows=function(n,t){var r=this.current708Packet.data,u=r[++n],f=this.getPts(n),i;for(this.flushDisplayed(f,t),i=0;i<8;i++)u&1<<i&&t.windows[i].reset();return n};f.prototype.setPenAttributes=function(n,t){var u=this.current708Packet.data,i=u[n],r=t.currentWindow.penAttr;return i=u[++n],r.textTag=(i&240)>>4,r.offset=(i&12)>>2,r.penSize=i&3,i=u[++n],r.italics=(i&128)>>7,r.underline=(i&64)>>6,r.edgeType=(i&56)>>3,r.fontStyle=i&7,n};f.prototype.setPenColor=function(n,t){var u=this.current708Packet.data,i=u[n],r=t.currentWindow.penColor;return i=u[++n],r.fgOpacity=(i&192)>>6,r.fgRed=(i&48)>>4,r.fgGreen=(i&12)>>2,r.fgBlue=i&3,i=u[++n],r.bgOpacity=(i&192)>>6,r.bgRed=(i&48)>>4,r.bgGreen=(i&12)>>2,r.bgBlue=i&3,i=u[++n],r.edgeRed=(i&48)>>4,r.edgeGreen=(i&12)>>2,r.edgeBlue=i&3,n};f.prototype.setPenLocation=function(n,t){var r=this.current708Packet.data,i=r[n],u=t.currentWindow.penLoc;return t.currentWindow.pendingNewLine=!0,i=r[++n],u.row=i&15,i=r[++n],u.column=i&63,n};f.prototype.reset=function(n,t){var i=this.getPts(n);return this.flushDisplayed(i,t),this.initService(t.serviceNum,n)};var us={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},bt=function(n){return n===null?"":(n=us[n]||n,String.fromCharCode(n))},kt=14,fs=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],k=function(){for(var n=[],t=kt+1;t--;)n.push("");return n},o=function o(n,t){o.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_=k()):t===this.ERASE_NON_DISPLAYED_MEMORY_?this.nonDisplayed_=k():t===this.RESUME_DIRECT_CAPTIONING_?(this.mode_!=="paintOn"&&(this.flushDisplayed(n.pts),this.displayed_=k()),this.mode_="paintOn",this.startPts_=n.pts):this.isSpecialCharacter(r,i)?(r=(r&3)<<8,u=bt(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=bt(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=fs.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=bt(r),u+=bt(i),this[this.mode_](n.pts,u),this.column_+=u.length))}};o.prototype=new h;o.prototype.flushDisplayed=function(n){var t=this.displayed_.map(function(n,t){try{return n.trim()}catch(i){return this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+t+"."}),""}},this).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:n,text:t,stream:this.name_})};o.prototype.reset=function(){this.mode_="popOn";this.topRow_=0;this.startPts_=0;this.displayed_=k();this.nonDisplayed_=k();this.lastControlCode_=null;this.column_=0;this.row_=kt;this.rollUpRows_=2;this.formatting_=[]};o.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};o.prototype.isSpecialCharacter=function(n,t){return n===this.EXT_&&t>=48&&t<=63};o.prototype.isExtCharacter=function(n,t){return(n===this.EXT_+1||n===this.EXT_+2)&&t>=32&&t<=63};o.prototype.isMidRowCode=function(n,t){return n===this.EXT_&&t>=32&&t<=47};o.prototype.isOffsetControlCode=function(n,t){return n===this.OFFSET_&&t>=33&&t<=35};o.prototype.isPAC=function(n,t){return n>=this.BASE_&&n<this.BASE_+8&&t>=64&&t<=127};o.prototype.isColorPAC=function(n){return n>=64&&n<=79||n>=96&&n<=127};o.prototype.isNormalChar=function(n){return n>=32&&n<=127};o.prototype.setRollUp=function(n,t){if(this.mode_!=="rollUp"&&(this.row_=kt,this.mode_="rollUp",this.flushDisplayed(n),this.nonDisplayed_=k(),this.displayed_=k()),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};o.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)};o.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)}};o.prototype.popOn=function(n,t){var i=this.nonDisplayed_[this.row_];i+=t;this.nonDisplayed_[this.row_]=i};o.prototype.rollUp=function(n,t){var i=this.displayed_[this.row_];i+=t;this.displayed_[this.row_]=i};o.prototype.shiftRowsUp_=function(){for(var n=0;n<this.topRow_;n++)this.displayed_[n]="";for(n=this.row_+1;n<kt+1;n++)this.displayed_[n]="";for(n=this.topRow_;n<this.row_;n++)this.displayed_[n]=this.displayed_[n+1];this.displayed_[this.row_]=""};o.prototype.paintOn=function(n,t){var i=this.displayed_[this.row_];i+=t;this.displayed_[this.row_]=i};var dt={CaptionStream:l,Cea608Stream:o,Cea708Stream:f},s={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},es=8589934592,os=4294967296,sf="shared",ur=function(n,t){var i=1;for(n>t&&(i=-1);Math.abs(t-n)>os;)n+=i*es;return n},hf=function vf(n){var i,t;vf.prototype.init.call(this);this.type_=n||sf;this.push=function(n){(this.type_===sf||n.type===this.type_)&&(t===undefined&&(t=n.dts),n.dts=ur(n.dts,t),n.pts=ur(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")}};hf.prototype=new h;var cf={TimestampRolloverStream:hf,handleRollover:ur},lf=function(n,t,i){for(var u="",r=t;r<i;r++)u+="%"+("00"+n[r].toString(16)).slice(-2);return u},gt=function(n,t,i){return decodeURIComponent(lf(n,t,i))},ss=function(n,t,i){return unescape(lf(n,t,i))},ni=function(n){return n[0]<<21|n[1]<<14|n[2]<<7|n[3]},af={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=gt(n.data,1,t);n.value=gt(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=gt(n.data,1,t);n.url=gt(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=ss(n.data,0,t);break}n.privateData=n.data.subarray(t+1);n.data=n.privateData}},ti;ti=function(n){var f={descriptor:n&&n.descriptor},i=0,t=[],r=0,u;if(ti.prototype.init.call(this),this.dispatchType=s.METADATA_STREAM_TYPE.toString(16),f.descriptor)for(u=0;u<f.descriptor.length;u++)this.dispatchType+=("00"+f.descriptor[u].toString(16)).slice(-2);this.push=function(n){var u,f,h,e,s,l,o,c;if(n.type==="timed-metadata"){if(n.dataAlignmentIndicator&&(r=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))){this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});return}if(t.push(n),r+=n.data.byteLength,t.length===1&&(i=ni(n.data.subarray(6,10))+10),!(r<i)){for(u={data:new Uint8Array(i),frames:[],pts:t[0].pts,dts:t[0].dts},s=0;s<i;)u.data.set(t[0].data.subarray(0,i-s),s),s+=t[0].data.byteLength,r-=t[0].data.byteLength,t.shift();f=10;u.data[5]&64&&(f+=4,f+=ni(u.data.subarray(10,14)),i-=ni(u.data.subarray(16,20)));do{if(h=ni(u.data.subarray(f+4,f+8)),h<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping metadata parsing."});return}l=String.fromCharCode(u.data[f],u.data[f+1],u.data[f+2],u.data[f+3]);e={id:l,data:u.data.subarray(f+10,f+h+10)};e.key=e.id;af[e.id]&&(af[e.id](e),e.owner==="com.apple.streaming.transportStreamTimestamp"&&(o=e.data,c=(o[3]&1)<<30|o[4]<<22|o[5]<<14|o[6]<<6|o[7]>>>2,c*=4,c+=o[7]&3,e.timeStamp=c,u.pts===undefined&&u.dts===undefined&&(u.pts=e.timeStamp,u.dts=e.timeStamp),this.trigger("timestamp",e)));u.frames.push(e);f+=10;f+=h}while(f<i);this.trigger("data",u)}}}};ti.prototype=new h;var hs=ti,vf=cf.TimestampRolloverStream,ii,st,ri,tt=188,fr=71;ii=function(){var t=new Uint8Array(tt),n=0;ii.prototype.init.call(this);this.push=function(i){var u=0,f=tt,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]===fr&&r[f]===fr){this.trigger("data",r.subarray(u,f));u+=tt;f+=tt;continue}u++;f++}u<r.byteLength&&(t.set(r.subarray(u),0),n=r.byteLength-u)};this.flush=function(){n===tt&&t[0]===fr&&(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")}};ii.prototype=new h;st=function(){var t,i,r,n;st.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,o,h,r,u,f;if(t[5]&1){for(n.programMapTable={video:null,audio:null,"timed-metadata":{}},e=(t[1]&15)<<8|t[2],o=3+e-4,h=(t[10]&15)<<8|t[11],r=12+h;r<o;)u=t[r],f=(t[r+1]&31)<<8|t[r+2],u===s.H264_STREAM_TYPE&&n.programMapTable.video===null?n.programMapTable.video=f:u===s.ADTS_STREAM_TYPE&&n.programMapTable.audio===null?n.programMapTable.audio=f:u===s.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?s.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?s.ADTS_STREAM_TYPE:this.programMapTable["timed-metadata"][i.pid];i.type="pes";i.data=n.subarray(t);this.trigger("data",i)}};st.prototype=new h;st.STREAM_TYPES={h264:27,adts:15};ri=function(){var u=this,f=!1,t={data:[],size:0},i={data:[],size:0},e={data:[],size:0},n,o=function(n,t){var i,r=n[0]<<16|n[1]<<8|n[2];(t.data=new Uint8Array,r===1)&&(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,e=!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;o(h,r);e=t==="video"||r.packetLength<=n.size;(i||e)&&(n.size=0,n.data.length=0);e&&u.trigger("data",r)}};ri.prototype.init.call(this);this.push=function(o){({pat:function(){},pes:function(){var n,u;switch(o.streamType){case s.H264_STREAM_TYPE:n=t;u="video";break;case s.ADTS_STREAM_TYPE:n=i;u="audio";break;case s.METADATA_STREAM_TYPE:n=e;u="timed-metadata";break;default:return}o.payloadUnitStartIndicator&&r(n,u,!0);n.data.push(o);n.size+=o.data.byteLength},pmt:function(){var t={type:"metadata",tracks:[]};n=o.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"});f=!0;u.trigger("data",t)}})[o.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(e,"timed-metadata")};this.flush=function(){if(!f&&n){var t={type:"metadata",tracks:[]};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)}f=!1;this.flushStreams_();this.trigger("done")}};ri.prototype=new h;er={PAT_PID:0,MP2T_PACKET_LENGTH:tt,TransportPacketStream:ii,TransportParseStream:st,ElementaryStream:ri,TimestampRolloverStream:vf,CaptionStream:dt.CaptionStream,Cea608Stream:dt.Cea608Stream,Cea708Stream:dt.Cea708Stream,MetadataStream:hs};for(ui in s)s.hasOwnProperty(ui)&&(er[ui]=s[ui]);var p=er,cs=i.ONE_SECOND_IN_TS,fi,yf=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];fi=function(n){var t,i=0;fi.prototype.init.call(this);this.skipWarn_=function(n,t){this.trigger("log",{level:"warn",message:"adts skiping bytes "+n+" to "+t+" in frame "+i+" outside syncword"})};this.push=function(r){var u=0,e,c,o,s,h,f;if(n||(i=0),r.type==="audio"){for(t&&t.length?(o=t,t=new Uint8Array(o.byteLength+r.data.byteLength),t.set(o),t.set(r.data,o.byteLength)):t=r.data;u+7<t.length;){if(t[u]!==255||(t[u+1]&246)!=240){typeof f!="number"&&(f=u);u++;continue}if(typeof f=="number"&&(this.skipWarn_(f,u),f=null),c=(~t[u+1]&1)*2,e=(t[u+3]&3)<<11|t[u+4]<<3|(t[u+5]&224)>>5,s=((t[u+6]&3)+1)*1024,h=s*cs/yf[(t[u+2]&60)>>>2],t.byteLength-u<e)break;this.trigger("data",{pts:r.pts+i*h,dts:r.dts+i*h,sampleCount:s,audioobjecttype:(t[u+2]>>>6&3)+1,channelcount:(t[u+2]&1)<<2|(t[u+3]&192)>>>6,samplerate:yf[(t[u+2]&60)>>>2],samplingfrequencyindex:(t[u+2]&60)>>>2,samplesize:16,data:t.subarray(u+7+c,u+e)});i++;u+=e}typeof f=="number"&&(this.skipWarn_(f,u),f=null);t=t.subarray(u)}};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")}};fi.prototype=new h;or=fi;pf=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()};wf=pf;ht=function(){var i=0,t,n;ht.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")}};ht.prototype=new h;bf={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0};ei=function(){var n=new ht,t,u,f,e,i,o,r;ei.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,nalUnitTypeCode:n[0]&31};switch(r.nalUnitTypeCode){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,t,f,v,y,e,o,p,w,b,s,k,i=[1,1],d,u;if(t=new wf(n),f=t.readUnsignedByte(),y=t.readUnsignedByte(),v=t.readUnsignedByte(),t.skipUnsignedExpGolomb(),bf[f]&&(e=t.readUnsignedExpGolomb(),e===3&&t.skipBits(1),t.skipUnsignedExpGolomb(),t.skipUnsignedExpGolomb(),t.skipBits(1),t.readBoolean()))for(k=e!==3?8:12,u=0;u<k;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(),p=t.readUnsignedExpGolomb(),u=0;u<p;u++)t.skipExpGolomb();if(t.skipUnsignedExpGolomb(),t.skipBits(1),w=t.readUnsignedExpGolomb(),b=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()){d=t.readUnsignedByte();switch(d){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&&i[0]/i[1]}return{profileIdc:f,levelIdc:v,profileCompatibility:y,width:(w+1)*16-h*2-c*2,height:(2-s)*(b+1)*16-l*2-a*2,sarRatio:i}}};ei.prototype=new h;var ls={H264Stream:ei,NalByteStream:ht},as=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],kf=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(i=i>=0?i:0,u)?i+20:i+10},df=function df(n,t){return n.length-t<10||n[t]!=="I".charCodeAt(0)||n[t+1]!=="D".charCodeAt(0)||n[t+2]!=="3".charCodeAt(0)?t:(t+=kf(n,t),df(n,t))},vs=function(n){var t=df(n,0);return n.length>=t+2&&(n[t]&255)==255&&(n[t+1]&240)==240&&(n[t+1]&22)==16},gf=function(n){return n[0]<<21|n[1]<<14|n[2]<<7|n[3]},ys=function(n,t,i){for(var u="",r=t;r<i;r++)u+="%"+("00"+n[r].toString(16)).slice(-2);return u},ps=function(n,t,i){return unescape(ys(n,t,i))},ws=function(n,t){var i=(n[t+5]&224)>>5,r=n[t+4]<<3,u=n[t+3]&6144;return u|r|i},bs=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},ks=function(n){for(var t=0;t+5<n.length;){if(n[t]!==255||(n[t+1]&246)!=240){t++;continue}return as[(n[t+2]&60)>>>2]}return null},ds=function(n){var t,f,u,o,r,s,i,e;t=10;n[5]&64&&(t+=4,t+=gf(n.subarray(10,14)));do{if(f=gf(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=ps(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},oi={isLikelyAacData:vs,parseId3TagSize:kf,parseAdtsSize:ws,parseType:bs,parseSampleRate:ks,parseAacTimestamp:ds},si;si=function(){var n=new Uint8Array,t=0;si.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=oi.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=oi.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")}};si.prototype=new h;var gs=si,sr=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],hr=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],nh=ls.H264Stream,th=oi.isLikelyAacData,ih=i.ONE_SECOND_IN_TS,ct,it,hi,d,rh=function(n,t){t.stream=n;this.trigger("log",t)},ne=function(n,t){for(var i,u=Object.keys(t),r=0;r<u.length;r++)if(i=u[r],i!=="headOfPipeline"&&t[i].on)t[i].on("log",rh.bind(n,i))},te=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},cr=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}};it=function(n,t){var r=[],u,f=0,e=0,o=Infinity;t=t||{};u=t.firstSequenceNumber||0;it.prototype.init.call(this);this.push=function(t){a.collectDtsInfo(n,t);n&&sr.forEach(function(i){n[i]=t[i]});r.push(t)};this.setEarliestDts=function(n){f=n};this.setVideoBaseMediaDecodeTime=function(n){o=n};this.setAudioAppendStart=function(n){e=n};this.flush=function(){var s,h,v,c,y,l,p;if(r.length===0){this.trigger("done","AudioSegmentStream");return}s=pt.trimAdtsFramesByEarliestDts(r,n,f);n.baseMediaDecodeTime=a.calculateTrackBaseMediaDecodeTime(n,t.keepOriginalTimestamps);p=pt.prefixWithSilence(n,s,e,o);n.samples=pt.generateSampleTable(s);v=ut.mdat(pt.concatenateFrameData(s));r=[];h=ut.moof(u,[n]);c=new Uint8Array(h.byteLength+v.byteLength);u++;c.set(h);c.set(v,h.byteLength);a.clearDtsInfo(n);y=Math.ceil(ih*1024/n.samplerate);s.length&&(l=s.length*y,this.trigger("segmentTimingInfo",cr(i.audioTsToVideoTs(n.baseMediaDecodeTime,n.samplerate),s[0].dts,s[0].pts,s[0].dts+l,s[0].pts+l,p||0)),this.trigger("timingInfo",{start:s[0].pts,end:s[0].pts+l}));this.trigger("data",{track:n,boxes:c});this.trigger("done","AudioSegmentStream")};this.reset=function(){a.clearDtsInfo(n);r=[];this.trigger("reset")}};it.prototype=new h;ct=function(n,t){var f,i=[],r=[],u,e;t=t||{};f=t.firstSequenceNumber||0;ct.prototype.init.call(this);delete n.minPTS;this.gopCache_=[];this.push=function(t){a.collectDtsInfo(n,t);t.nalUnitType!=="seq_parameter_set_rbsp"||u||(u=t.config,n.sps=[t.data],hr.forEach(function(t){n[t]=u[t]},this));t.nalUnitType!=="pic_parameter_set_rbsp"||e||(e=t.data,n.pps=[t.data]);i.push(t)};this.flush=function(){for(var y,e,u,s,c,h,p=0,l,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=ft.groupNalsIntoFrames(i),u=ft.groupFramesIntoGops(y),u[0][0].keyFrame||(e=this.getGopForFusion_(i[0],n),e?(p=e.duration,u.unshift(e),u.byteLength+=e.byteLength,u.nalCount+=e.nalCount,u.pts=e.pts,u.dts=e.dts,u.duration+=e.duration):u=ft.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}a.clearDtsInfo(n);u=v}a.collectDtsInfo(n,u);n.samples=ft.generateSampleTable(u);c=ut.mdat(ft.concatenateNalData(u));n.baseMediaDecodeTime=a.calculateTrackBaseMediaDecodeTime(n,t.keepOriginalTimestamps);this.trigger("processedGopsInfo",u.map(function(n){return{pts:n.pts,dts:n.dts,byteLength:n.byteLength}}));l=u[0];o=u[u.length-1];this.trigger("segmentTimingInfo",cr(n.baseMediaDecodeTime,l.dts,l.pts,o.dts+o.duration,o.pts+o.duration,p));this.trigger("timingInfo",{start:u[0].pts,end:u[u.length-1].pts+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);s=ut.moof(f,[n]);h=new Uint8Array(s.byteLength+c.byteLength);f++;h.set(s);h.set(c,s.byteLength);this.trigger("data",{track:n,boxes:h});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(){a.clearDtsInfo(n);u=undefined;e=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&&te(n.pps[0],r.pps[0])&&n.sps&&te(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}};ct.prototype=new h;d=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;d.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))}};d.prototype=new h;d.prototype.flush=function(n){var s=0,r={captions:[],captionStreams:{},metadata:[],info:{}},u,f,o,e=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?(e=this.videoTrack.timelineStartInfo.pts,hr.forEach(function(n){r.info[n]=this.videoTrack[n]},this)):this.audioTrack&&(e=this.audioTrack.timelineStartInfo.pts,sr.forEach(function(n){r.info[n]=this.audioTrack[n]},this)),this.videoTrack||this.audioTrack){for(r.type=this.pendingTracks.length===1?this.pendingTracks[0].type:"combined",this.emittedTracks+=this.pendingTracks.length,o=ut.initSegment(this.pendingTracks),r.initSegment=new Uint8Array(o.byteLength),r.initSegment.set(o),r.data=new Uint8Array(this.pendingBytes),t=0;t<this.pendingBoxes.length;t++)r.data.set(this.pendingBoxes[t],s),s+=this.pendingBoxes[t].byteLength;for(t=0;t<this.pendingCaptions.length;t++)u=this.pendingCaptions[t],u.startTime=i.metadataTsToSeconds(u.startPts,e,this.keepOriginalTimestamps),u.endTime=i.metadataTsToSeconds(u.endPts,e,this.keepOriginalTimestamps),r.captionStreams[u.stream]=!0,r.captions.push(u);for(t=0;t<this.pendingMetadata.length;t++)f=this.pendingMetadata[t],f.cueTime=i.metadataTsToSeconds(f.pts,e,this.keepOriginalTimestamps),r.metadata.push(f);for(r.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",r),t=0;t<r.captions.length;t++)u=r.captions[t],this.trigger("caption",u);for(t=0;t<r.metadata.length;t++)f=r.metadata[t],this.trigger("id3Frame",f)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)};d.prototype.setRemux=function(n){this.remuxTracks=n};hi=function(n){var t=this,u=!0,r,i;hi.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 p.MetadataStream;u.aacStream=new gs;u.audioTimestampRolloverStream=new p.TimestampRolloverStream("audio");u.timedMetadataTimestampRolloverStream=new p.TimestampRolloverStream("timed-metadata");u.adtsStream=new or;u.coalesceStream=new d(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"||f.type==="audio")&&!u.audioSegmentStream){i=i||{timelineStartInfo:{baseMediaDecodeTime:t.baseMediaDecodeTime},codec:"adts",type:"audio"};u.coalesceStream.numberOfTracks++;u.audioSegmentStream=new it(i,n);u.audioSegmentStream.on("log",t.getLogTrigger_("audioSegmentStream"));u.audioSegmentStream.on("timingInfo",t.trigger.bind(t,"audioTimingInfo"));u.adtsStream.pipe(u.audioSegmentStream).pipe(u.coalesceStream);t.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!r})}});u.coalesceStream.on("data",this.trigger.bind(this,"data"));u.coalesceStream.on("done",this.trigger.bind(this,"done"));ne(this,u)};this.setupTsPipeline=function(){var u={};this.transmuxPipeline_=u;u.type="ts";u.metadataStream=new p.MetadataStream;u.packetStream=new p.TransportPacketStream;u.parseStream=new p.TransportParseStream;u.elementaryStream=new p.ElementaryStream;u.timestampRolloverStream=new p.TimestampRolloverStream;u.adtsStream=new or;u.h264Stream=new nh;u.captionStream=new p.CaptionStream(n);u.coalesceStream=new d(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"?i||f.tracks[e].type!=="audio"||(i=f.tracks[e],i.timelineStartInfo.baseMediaDecodeTime=t.baseMediaDecodeTime):(r=f.tracks[e],r.timelineStartInfo.baseMediaDecodeTime=t.baseMediaDecodeTime);if(r&&!u.videoSegmentStream){u.coalesceStream.numberOfTracks++;u.videoSegmentStream=new ct(r,n);u.videoSegmentStream.on("log",t.getLogTrigger_("videoSegmentStream"));u.videoSegmentStream.on("timelineStartInfo",function(r){i&&!n.keepOriginalTimestamps&&(i.timelineStartInfo=r,u.audioSegmentStream.setEarliestDts(r.dts-t.baseMediaDecodeTime))});u.videoSegmentStream.on("processedGopsInfo",t.trigger.bind(t,"gopInfo"));u.videoSegmentStream.on("segmentTimingInfo",t.trigger.bind(t,"videoSegmentTimingInfo"));u.videoSegmentStream.on("baseMediaDecodeTime",function(n){i&&u.audioSegmentStream.setVideoBaseMediaDecodeTime(n)});u.videoSegmentStream.on("timingInfo",t.trigger.bind(t,"videoTimingInfo"));u.h264Stream.pipe(u.videoSegmentStream).pipe(u.coalesceStream)}if(i&&!u.audioSegmentStream){u.coalesceStream.numberOfTracks++;u.audioSegmentStream=new it(i,n);u.audioSegmentStream.on("log",t.getLogTrigger_("audioSegmentStream"));u.audioSegmentStream.on("timingInfo",t.trigger.bind(t,"audioTimingInfo"));u.audioSegmentStream.on("segmentTimingInfo",t.trigger.bind(t,"audioSegmentTimingInfo"));u.adtsStream.pipe(u.audioSegmentStream).pipe(u.coalesceStream)}t.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!r})}});u.coalesceStream.on("data",this.trigger.bind(this,"data"));u.coalesceStream.on("id3Frame",function(n){n.dispatchType=u.metadataStream.dispatchType;t.trigger("id3Frame",n)});u.coalesceStream.on("caption",this.trigger.bind(this,"caption"));u.coalesceStream.on("done",this.trigger.bind(this,"done"));ne(this,u)};this.setBaseMediaDecodeTime=function(t){var u=this.transmuxPipeline_;n.keepOriginalTimestamps||(this.baseMediaDecodeTime=t);i&&(i.timelineStartInfo.dts=undefined,i.timelineStartInfo.pts=undefined,a.clearDtsInfo(i),u.audioTimestampRolloverStream&&u.audioTimestampRolloverStream.discontinuity());r&&(u.videoSegmentStream&&(u.videoSegmentStream.gopCache_=[]),r.timelineStartInfo.dts=undefined,r.timelineStartInfo.pts=undefined,a.clearDtsInfo(r),u.captionStream.reset());u.timestampRolloverStream&&u.timestampRolloverStream.discontinuity()};this.setAudioAppendStart=function(n){i&&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.getLogTrigger_=function(n){var t=this;return function(i){i.stream=n;t.trigger("log",i)}};this.push=function(n){if(u){var t=th(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()}};hi.prototype=new h;var uh={Transmuxer:hi,VideoSegmentStream:ct,AudioSegmentStream:it,AUDIO_PROPERTIES:sr,VIDEO_PROPERTIES:hr,generateSegmentTimingInfo:cr},fh=function(n){return n>>>0},eh=function(n){return("00"+n.toString(16)).slice(-2)},ci={toUnsigned:fh,toHexString:eh},oh=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])},g=oh,sh=ci.toUnsigned,ie=function ie(n,t){var r=[],i,f,o,u,e;if(!t.length)return null;for(i=0;i<n.byteLength;)f=sh(n[i]<<24|n[i+1]<<16|n[i+2]<<8|n[i+3]),o=g(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=ie(n.subarray(i+8,u),t.slice(1)),e.length&&(r=r.concat(e)))),i=u;return r},e=ie,hh=ci.toUnsigned,ch=yi.getUint64,lh=function(n){var t={version:n[0],flags:new Uint8Array(n.subarray(1,4))};return t.baseMediaDecodeTime=t.version===1?ch(n.subarray(4)):hh(n[4]<<24|n[5]<<16|n[6]<<8|n[7]),t},re=lh,ah=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]}},ue=ah,vh=function(n){var i={version:n[0],flags:new Uint8Array(n.subarray(1,4)),samples:[]},u=new DataView(n.buffer,n.byteOffset,n.byteLength),h=i.flags[2]&1,c=i.flags[2]&4,e=i.flags[1]&1,o=i.flags[1]&2,l=i.flags[1]&4,s=i.flags[1]&8,f=u.getUint32(4),t=8,r;for(h&&(i.dataOffset=u.getInt32(t),t+=4),c&&f&&(r={flags:ue(n.subarray(t,t+4))},t+=4,e&&(r.duration=u.getUint32(t),t+=4),o&&(r.size=u.getUint32(t),t+=4),s&&(r.compositionTimeOffset=i.version===1?u.getInt32(t):u.getUint32(t),t+=4),i.samples.push(r),f--);f--;)r={},e&&(r.duration=u.getUint32(t),t+=4),o&&(r.size=u.getUint32(t),t+=4),l&&(r.flags=ue(n.subarray(t,t+4)),t+=4),s&&(r.compositionTimeOffset=i.version===1?u.getInt32(t):u.getUint32(t),t+=4),i.samples.push(r);return i},fe=vh,yh=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},ee=yh,oe=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},ph=typeof window!="undefined"?window:typeof oe!="undefined"?oe:typeof self!="undefined"?self:{};var lt=ph,wh=et.discardEmulationPreventionBytes,se=dt.CaptionStream,bh=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},kh=function(n,t,i){for(var c=new DataView(n.buffer,n.byteOffset,n.byteLength),s={logs:[],seiNals:[]},u,f,o,h,e,r=0;r+4<n.length;r+=f)if(f=c.getUint32(r),r+=4,!(f<=0))switch(n[r]&31){case 6:if(h=n.subarray(r+1,r+1+f),e=bh(r,t),u={nalUnitType:"sei_rbsp",size:f,data:h,escapedRBSP:wh(h),trackId:i},e)u.pts=e.pts,u.dts=e.dts,o=e;else if(o)u.pts=o.pts,u.dts=o.dts;else{s.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+r+" for trackId "+i+". See mux.js#223."});break}s.seiNals.push(u)}return s},dh=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=fe(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);typeof r=="bigint"?(n.pts=r+lt.BigInt(n.compositionTimeOffset),r+=lt.BigInt(n.duration)):(n.pts=r+n.compositionTimeOffset,r+=n.duration)});u=u.concat(t)}),u},gh=function(n,t){var u=e(n,["moof","traf"]),f=e(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 l=n.mdat,u=n.traf,a=e(u,["tfhd"]),o=ee(a[0]),r=o.trackId,s=e(u,["tfdt"]),v=s.length>0?re(s[0]).baseMediaDecodeTime:0,h=e(u,["trun"]),c,f;t===r&&h.length>0&&(c=dh(h,v,o),f=kh(l,c,r),i[r]||(i[r]={seiNals:[],logs:[]}),i[r].seiNals=i[r].seiNals.concat(f.seiNals),i[r].logs=i[r].logs.concat(f.logs))}),i},nc=function(n,t,i){var u,r;return t===null?null:(u=gh(n,t),r=u[t]||{},{seiNals:r.seiNals,logs:r.logs,timescale:i})},tc=function(){var f=!1,t,u,i,r,n,e;this.isInitialized=function(){return f};this.init=function(i){t=new se;f=!0;e=i?i.isPartial:!1;t.on("data",function(t){t.startTime=t.startPts/r;t.endTime=t.endPts/r;n.captions.push(t);n.captionStreams[t.stream]=!0});t.on("log",function(t){n.logs.push(t)})};this.isNewInit=function(n,t){return n&&n.length===0||t&&typeof t=="object"&&Object.keys(t).length===0?!1:i!==n[0]||r!==t[i]};this.parse=function(t,f,e){var o,s;if(this.isInitialized())if(f&&e){if(this.isNewInit(f,e))i=f[0],r=e[i];else if(i===null||!r)return u.push(t),null}else return null;else return null;while(u.length>0)s=u.shift(),this.parse(s,f,e);return(o=nc(t,i,r),o&&o.logs&&(n.logs=n.logs.concat(o.logs)),o===null||!o.seiNals)?n.logs.length?{logs:n.logs,captions:[],captionStreams:[]}:null:(this.pushNals(o.seiNals),this.flushStream(),n)};this.pushNals=function(n){if(!this.isInitialized()||!n||n.length===0)return null;n.forEach(function(n){t.push(n)})};this.flushStream=function(){if(!this.isInitialized())return null;e?t.partialFlush():t.flush()};this.clearParsedCaptions=function(){n.captions=[];n.captionStreams={};n.logs=[]};this.resetCaptionStream=function(){if(!this.isInitialized())return null;t.reset()};this.clearAllCaptions=function(){this.clearParsedCaptions();this.resetCaptionStream()};this.reset=function(){u=[];i=null;r=null;n?this.clearParsedCaptions():n={captions:[],captionStreams:{},logs:[]};this.resetCaptionStream()};this.reset()},ic=tc,li=ci.toUnsigned,at=ci.toHexString,rc=yi.getUint64,he,ce,le,ae,ve,lr;he=function(n){var t=e(n,["moov","trak"]);return t.reduce(function(n,t){var r,f,i,o,u;return(r=e(t,["tkhd"])[0],!r)?null:(f=r[0],i=f===0?12:20,o=li(r[i]<<24|r[i+1]<<16|r[i+2]<<8|r[i+3]),u=e(t,["mdia","mdhd"])[0],!u)?null:(f=u[0],i=f===0?12:20,n[o]=li(u[i]<<24|u[i+1]<<16|u[i+2]<<8|u[i+3]),n)},{})};ce=function(n,t){var r,i;return r=e(t,["moof","traf"]),i=r.reduce(function(t,i){var o=e(i,["tfhd"])[0],h=li(o[4]<<24|o[5]<<16|o[6]<<8|o[7]),s=n[h]||9e4,f=e(i,["tfdt"])[0],c=new DataView(f.buffer,f.byteOffset,f.byteLength),u,r;return u=f[0]===1?rc(f.subarray(4,12)):c.getUint32(4),typeof u=="bigint"?r=u/lt.BigInt(s):typeof u!="number"||isNaN(u)||(r=u/s),r<Number.MAX_SAFE_INTEGER&&(r=Number(r)),r<t&&(t=r),t},Infinity),typeof i=="bigint"||isFinite(i)?i:0};le=function(n,t){var r=e(t,["moof","traf"]),s=0,u=0,h,v,y,f,o,i;if(r&&r.length){var c=e(r[0],["tfhd"])[0],l=e(r[0],["trun"])[0],a=e(r[0],["tfdt"])[0];c&&(v=ee(c),h=v.trackId);a&&(y=re(a),s=y.baseMediaDecodeTime);l&&(f=fe(l),f.samples&&f.samples.length&&(u=f.samples[0].compositionTimeOffset||0))}return o=n[h]||9e4,typeof s=="bigint"&&(u=lt.BigInt(u),o=lt.BigInt(o)),i=(s+u)/o,typeof i=="bigint"&&i<Number.MAX_SAFE_INTEGER&&(i=Number(i)),i};ae=function(n){var i=e(n,["moov","trak"]),t=[];return i.forEach(function(n){var i=e(n,["mdia","hdlr"]),r=e(n,["tkhd"]);i.forEach(function(n,i){var s=g(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};lr=function(n){var i=n[0],t=i===0?12:20;return li(n[t]<<24|n[t+1]<<16|n[t+2]<<8|n[t+3])};ve=function(n){var i=e(n,["moov","trak"]),t=[];return i.forEach(function(n){var i={},u=e(n,["tkhd"])[0],f,y,c,o,l,a,s,r,h,v;u&&(f=new DataView(u.buffer,u.byteOffset,u.byteLength),y=f.getUint8(0),i.id=y===0?f.getUint32(12):f.getUint32(20));c=e(n,["mdia","hdlr"])[0];c&&(o=g(c.subarray(8,12)),i.type=o==="vide"?"video":o==="soun"?"audio":o);l=e(n,["mdia","minf","stbl","stsd"])[0];l&&(a=l.subarray(8),i.codec=g(a.subarray(4,8)),s=e(a,[i.codec])[0],s&&(/^[asm]vc[1-9]$/i.test(i.codec)?(r=s.subarray(78),h=g(r.subarray(4,8)),h==="avcC"&&r.length>11?(i.codec+=".",i.codec+=at(r[9]),i.codec+=at(r[10]),i.codec+=at(r[11])):i.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(i.codec)?(r=s.subarray(28),h=g(r.subarray(4,8)),h==="esds"&&r.length>20&&r[19]!==0?(i.codec+="."+at(r[19]),i.codec+="."+at(r[20]>>>2&63).replace(/^0/,"")):i.codec="mp4a.40.2"):i.codec=i.codec.toLowerCase()));v=e(n,["mdia","mdhd"])[0];v&&(i.timescale=lr(v));t.push(i)}),t};var ye={findBox:e,parseType:g,timescale:he,startTime:ce,compositionStartTime:le,videoTrackIds:ae,tracks:ve,getTimescaleFromMediaHeader:lr},pe=function(n){var t=n[1]&31;return t<<=8,t|n[2]},ai=function(n){return!!(n[1]&64)},vi=function(n){var t=0;return(n[3]&48)>>>4>1&&(t+=n[4]+1),t},uc=function(n,t){var i=pe(n);return i===0?"pat":i===t?"pmt":t?"pes":null},fc=function(n){var i=ai(n),t=4+vi(n);return i&&(t+=n[t]+1),(n[t+10]&31)<<8|n[t+11]},ec=function(n){var u={},s=ai(n),t=4+vi(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}},oc=function(n,t){var i=pe(n),r=t[i];switch(r){case s.H264_STREAM_TYPE:return"video";case s.ADTS_STREAM_TYPE:return"audio";case s.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},sc=function(n){var u=ai(n),t,i,r;return u?(t=4+vi(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},ar=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}},hc=function(n){for(var e=4+vi(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=ar(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=ar(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=ar(i[r+3]&31),u==="slice_layer_without_partitioning_rbsp_idr"&&(f=!0)),f},cc={parseType:uc,parsePat:fc,parsePmt:ec,parsePayloadUnitStartIndicator:ai,parsePesType:oc,parsePesTime:sc,videoPacketContainsKeyFrame:hc},rt=cf.handleRollover,u={};u.ts=cc;u.aac=oi;var nt=i.ONE_SECOND_IN_TS,c=188,v=71,lc=function(n,t){for(var r=0,i=c,f,o,e;i<n.byteLength;){if(n[r]===v&&n[i]===v){f=n.subarray(r,i);o=u.ts.parseType(f,t.pid);switch(o){case"pat":t.pid=u.ts.parsePat(f);break;case"pmt":e=u.ts.parsePmt(f);t.table=t.table||{};Object.keys(e).forEach(function(n){t.table[n]=e[n]})}r+=c;i+=c;continue}r++;i++}},we=function(n,t,i){for(var f=0,r=c,e,h,l,a,o,s=!1;r<=n.byteLength;){if(n[f]===v&&(n[r]===v||r===n.byteLength)){e=n.subarray(f,r);h=u.ts.parseType(e,t.pid);switch(h){case"pes":l=u.ts.parsePesType(e,t.table);a=u.ts.parsePayloadUnitStartIndicator(e);l==="audio"&&a&&(o=u.ts.parsePesTime(e),o&&(o.type="audio",i.audio.push(o),s=!0))}if(s)break;f+=c;r+=c;continue}f++;r++}for(r=n.byteLength,f=r-c,s=!1;f>=0;){if(n[f]===v&&(n[r]===v||r===n.byteLength)){e=n.subarray(f,r);h=u.ts.parseType(e,t.pid);switch(h){case"pes":l=u.ts.parsePesType(e,t.table);a=u.ts.parsePayloadUnitStartIndicator(e);l==="audio"&&a&&(o=u.ts.parsePesTime(e),o&&(o.type="audio",i.audio.push(o),s=!0))}if(s)break;f-=c;r-=c;continue}f--;r--}},ac=function(n,t,i){for(var e=0,f=c,r,a,y,l,o,p,w,b,h=!1,s={data:[],size:0},k;f<n.byteLength;){if(n[e]===v&&n[f]===v){r=n.subarray(e,f);a=u.ts.parseType(r,t.pid);switch(a){case"pes":if(y=u.ts.parsePesType(r,t.table),l=u.ts.parsePayloadUnitStartIndicator(r),y==="video"&&(l&&!h&&(o=u.ts.parsePesTime(r),o&&(o.type="video",i.video.push(o),h=!0)),!i.firstKeyFrame)){if(l&&s.size!==0){for(p=new Uint8Array(s.size),w=0;s.data.length;)b=s.data.shift(),p.set(b,w),w+=b.byteLength;u.ts.videoPacketContainsKeyFrame(p)&&(k=u.ts.parsePesTime(p),k?(i.firstKeyFrame=k,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."));s.size=0}s.data.push(r);s.size+=r.byteLength}}if(h&&i.firstKeyFrame)break;e+=c;f+=c;continue}e++;f++}for(f=n.byteLength,e=f-c,h=!1;e>=0;){if(n[e]===v&&n[f]===v){r=n.subarray(e,f);a=u.ts.parseType(r,t.pid);switch(a){case"pes":y=u.ts.parsePesType(r,t.table);l=u.ts.parsePayloadUnitStartIndicator(r);y==="video"&&l&&(o=u.ts.parsePesTime(r),o&&(o.type="video",i.video.push(o),h=!0))}if(h)break;e-=c;f-=c;continue}e--;f--}},vc=function(n,t){var u,r,i;n.audio&&n.audio.length&&(u=t,(typeof u=="undefined"||isNaN(u))&&(u=n.audio[0].dts),n.audio.forEach(function(n){n.dts=rt(n.dts,u);n.pts=rt(n.pts,u);n.dtsTime=n.dts/nt;n.ptsTime=n.pts/nt}));n.video&&n.video.length&&(r=t,(typeof r=="undefined"||isNaN(r))&&(r=n.video[0].dts),n.video.forEach(function(n){n.dts=rt(n.dts,r);n.pts=rt(n.pts,r);n.dtsTime=n.dts/nt;n.ptsTime=n.pts/nt}),n.firstKeyFrame&&(i=n.firstKeyFrame,i.dts=rt(i.dts,r),i.pts=rt(i.pts,r),i.dtsTime=i.dts/nt,i.ptsTime=i.pts/nt))},yc=function(n){for(var f=!1,s=0,e=null,r=null,i=0,t=0,o,c,h,l;n.length-t>=3;){c=u.aac.parseType(n,t);switch(c){case"timed-metadata":if(n.length-t<10){f=!0;break}if(i=u.aac.parseId3TagSize(n,t),i>n.length){f=!0;break}r===null&&(o=n.subarray(t,t+i),r=u.aac.parseAacTimestamp(o));t+=i;break;case"audio":if(n.length-t<7){f=!0;break}if(i=u.aac.parseAdtsSize(n,t),i>n.length){f=!0;break}e===null&&(o=n.subarray(t,t+i),e=u.aac.parseSampleRate(o));s++;t+=i;break;default:t++}if(f)return null}return e===null||r===null?null:(h=nt/e,l={audio:[{type:"audio",dts:r,pts:r},{type:"audio",dts:r+s*1024*h,pts:r+s*1024*h}]},l)},pc=function(n){var i={pid:null,table:null},t={},r,u;lc(n,i);for(r in i.table)if(i.table.hasOwnProperty(r)){u=i.table[r];switch(u){case s.H264_STREAM_TYPE:t.video=[];ac(n,i,t);t.video.length===0&&delete t.video;break;case s.ADTS_STREAM_TYPE:t.audio=[];we(n,i,t);t.audio.length===0&&delete t.audio}}return t},wc=function(n,t){var r=u.aac.isLikelyAacData(n),i;return(i=r?yc(n):pc(n),!i||!i.audio&&!i.video)?null:(vc(i,t),i)},bc={inspect:wc,parseAudioPes_:we},kc=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])});t.on("done",function(){n.postMessage({action:"done"})});t.on("gopInfo",function(t){n.postMessage({action:"gopInfo",gopInfo:t})});t.on("videoSegmentTimingInfo",function(t){var r={start:{decode:i.videoTsToSeconds(t.start.dts),presentation:i.videoTsToSeconds(t.start.pts)},end:{decode:i.videoTsToSeconds(t.end.dts),presentation:i.videoTsToSeconds(t.end.pts)},baseMediaDecodeTime:i.videoTsToSeconds(t.baseMediaDecodeTime)};t.prependedContentDuration&&(r.prependedContentDuration=i.videoTsToSeconds(t.prependedContentDuration));n.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:r})});t.on("audioSegmentTimingInfo",function(t){var r={start:{decode:i.videoTsToSeconds(t.start.dts),presentation:i.videoTsToSeconds(t.start.pts)},end:{decode:i.videoTsToSeconds(t.end.dts),presentation:i.videoTsToSeconds(t.end.pts)},baseMediaDecodeTime:i.videoTsToSeconds(t.baseMediaDecodeTime)};t.prependedContentDuration&&(r.prependedContentDuration=i.videoTsToSeconds(t.prependedContentDuration));n.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:r})});t.on("id3Frame",function(t){n.postMessage({action:"id3Frame",id3Frame:t})});t.on("caption",function(t){n.postMessage({action:"caption",caption:t})});t.on("trackinfo",function(t){n.postMessage({action:"trackinfo",trackInfo:t})});t.on("audioTimingInfo",function(t){n.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:i.videoTsToSeconds(t.start),end:i.videoTsToSeconds(t.end)}})});t.on("videoTimingInfo",function(t){n.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:i.videoTsToSeconds(t.start),end:i.videoTsToSeconds(t.end)}})});t.on("log",function(t){n.postMessage({action:"log",log:t})})},be=function(){function t(n,t){this.options=t||{};this.self=n;this.init()}var n=t.prototype;return n.init=function(){this.transmuxer&&this.transmuxer.dispose();this.transmuxer=new uh.Transmuxer(this.options);kc(this.self,this.transmuxer)},n.pushMp4Captions=function(n){this.captionParser||(this.captionParser=new ic,this.captionParser.init());var i=new Uint8Array(n.data,n.byteOffset,n.byteLength),t=this.captionParser.parse(i,n.trackIds,n.timescales);this.self.postMessage({action:"mp4Captions",captions:t&&t.captions||[],logs:t&&t.logs||[],data:i.buffer},[i.buffer])},n.probeMp4StartTime=function(n){var i=n.timescales,t=n.data,r=ye.startTime(i,t);this.self.postMessage({action:"probeMp4StartTime",startTime:r,data:t},[t.buffer])},n.probeMp4Tracks=function(n){var t=n.data,i=ye.tracks(t);this.self.postMessage({action:"probeMp4Tracks",tracks:i,data:t},[t.buffer])},n.probeTs=function(n){var u=n.data,f=n.baseStartTime,e=typeof f=="number"&&!isNaN(f)?f*i.ONE_SECOND_IN_TS:void 0,t=bc.inspect(u,e),r=null;t&&(r={hasVideo:t.video&&t.video.length===2||!1,hasAudio:t.audio&&t.audio.length===2||!1},r.hasVideo&&(r.videoStart=t.video[0].ptsTime),r.hasAudio&&(r.audioStart=t.audio[0].ptsTime));this.self.postMessage({action:"probeTs",result:r,data:u},[u.buffer])},n.clearAllMp4Captions=function(){this.captionParser&&this.captionParser.clearAllCaptions()},n.clearParsedMp4Captions=function(){this.captionParser&&this.captionParser.clearParsedCaptions()},n.push=function(n){var t=new Uint8Array(n.data,n.byteOffset,n.byteLength);this.transmuxer.push(t)},n.reset=function(){this.transmuxer.reset()},n.setTimestampOffset=function(n){var t=n.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(i.secondsToVideoTs(t)))},n.setAudioAppendStart=function(n){this.transmuxer.setAudioAppendStart(Math.ceil(i.secondsToVideoTs(n.appendStart)))},n.setRemux=function(n){this.transmuxer.setRemux(n.remux)},n.flush=function(){this.transmuxer.flush();self.postMessage({action:"done",type:"transmuxed"})},n.endTimeline=function(){this.transmuxer.endTimeline();self.postMessage({action:"endedtimeline",type:"transmuxed"})},n.alignGopsWith=function(n){this.transmuxer.alignGopsWith(n.gopsToAlignWith.slice())},t}();self.onmessage=function(n){if(n.data.action==="init"&&n.data.options){this.messageHandlers=new be(self,n.data.options);return}this.messageHandlers||(this.messageHandlers=new be(self));n.data&&n.data.action&&n.data.action!=="init"&&this.messageHandlers[n.data.action]&&this.messageHandlers[n.data.action](n.data)}})),cdt=bft(hdt),ldt=function(n,t,i){var r=n.data.segment,h=r.type,e=r.initSegment,c=r.captions,l=r.captionStreams,a=r.metadata,o=r.videoFrameDtsTime,s=r.videoFramePtsTime,u,f;t.buffer.push({captions:c,captionStreams:l,metadata:a});u=n.data.segment.boxes||{data:n.data.segment.data};f={type:h,data:new Uint8Array(u.data,u.data.byteOffset,u.data.byteLength),initSegment:new Uint8Array(e.data,e.byteOffset,e.byteLength)};typeof o!="undefined"&&(f.videoFrameDtsTime=o);typeof s!="undefined"&&(f.videoFramePtsTime=s);i(f)},adt=function(n){var t=n.transmuxedData,i=n.callback;t.buffer=[];i(t)},vdt=function(n,t){t.gopInfo=n.data.gopInfo},gft=function(n){var t=n.transmuxer,i=n.bytes,f=n.audioAppendStart,e=n.gopsToAlignWith,o=n.remux,l=n.onData,a=n.onTrackInfo,v=n.onAudioTimingInfo,y=n.onVideoTimingInfo,p=n.onVideoSegmentTimingInfo,w=n.onAudioSegmentTimingInfo,b=n.onId3,k=n.onCaptions,d=n.onDone,g=n.onEndedTimeline,nt=n.onTransmuxerLog,s=n.isEndOfTimeline,r={buffer:[]},h=s,tt=function(i){t.currentTransmux===n&&(i.data.action==="data"&&ldt(i,r,l),i.data.action==="trackinfo"&&a(i.data.trackInfo),i.data.action==="gopInfo"&&vdt(i,r),i.data.action==="audioTimingInfo"&&v(i.data.audioTimingInfo),i.data.action==="videoTimingInfo"&&y(i.data.videoTimingInfo),i.data.action==="videoSegmentTimingInfo"&&p(i.data.videoSegmentTimingInfo),i.data.action==="audioSegmentTimingInfo"&&w(i.data.audioSegmentTimingInfo),i.data.action==="id3Frame"&&b([i.data.id3Frame],i.data.id3Frame.dispatchType),i.data.action==="caption"&&k(i.data.caption),i.data.action==="endedtimeline"&&(h=!1,g()),i.data.action==="log"&&nt(i.data.log),i.data.type==="transmuxed")&&(h||(t.onmessage=null,adt({transmuxedData:r,callback:d}),net(t)))},u,c;t.onmessage=tt;f&&t.postMessage({action:"setAudioAppendStart",appendStart:f});Array.isArray(e)&&t.postMessage({action:"alignGopsWith",gopsToAlignWith:e});typeof o!="undefined"&&t.postMessage({action:"setRemux",remux:o});i.byteLength&&(u=i instanceof ArrayBuffer?i:i.buffer,c=i instanceof ArrayBuffer?0:i.byteOffset,t.postMessage({action:"push",data:u,byteOffset:c,byteLength:i.byteLength},[u]));s&&t.postMessage({action:"endTimeline"});t.postMessage({action:"flush"})},net=function(n){n.currentTransmux=null;n.transmuxQueue.length&&(n.currentTransmux=n.transmuxQueue.shift(),typeof n.currentTransmux=="function"?n.currentTransmux():gft(n.currentTransmux))},tet=function(n,t){n.postMessage({action:t});net(n)},iet=function(n,t){if(!t.currentTransmux){t.currentTransmux=n;tet(t,n);return}t.transmuxQueue.push(tet.bind(null,t,n))},ydt=function(n){iet("reset",n)},pdt=function(n){iet("endTimeline",n)},ret=function(n){if(!n.transmuxer.currentTransmux){n.transmuxer.currentTransmux=n;gft(n);return}n.transmuxer.transmuxQueue.push(n)},wdt=function(n){var t=new cdt,i;return t.currentTransmux=null,t.transmuxQueue=[],i=t.terminate,t.terminate=function(){return t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)},t.postMessage({action:"init",options:n}),t},kw={reset:ydt,endTimeline:pdt,transmux:ret,createTransmuxer:wdt},fl=function(n){var t=n.transmuxer,e=n.endAction||n.action,o=n.callback,i=hi({},n,{endAction:null,transmuxer:null,callback:null}),u=function u(i){i.data.action===e&&(t.removeEventListener("message",u),i.data.data&&(i.data.data=new Uint8Array(i.data.data,n.byteOffset||0,n.byteLength||i.data.data.byteLength),n.data&&(n.data=i.data.data)),o(i.data))},r,f;t.addEventListener("message",u);n.data?(r=n.data instanceof ArrayBuffer,i.byteOffset=r?0:n.data.byteOffset,i.byteLength=n.data.byteLength,f=[r?n.data:n.data.buffer],t.postMessage(i,f)):t.postMessage(i)},pi={FAILURE:2,TIMEOUT:-101,ABORTED:-102},dw=function(n){n.forEach(function(n){n.abort()})},bdt=function(n){return{bandwidth:n.bandwidth,bytesReceived:n.bytesReceived||0,roundTripTime:n.roundTripTime||0}},kdt=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},gw=function(n,t){return t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:pi.TIMEOUT,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:pi.ABORTED,xhr:t}:n?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:pi.FAILURE,xhr:t}:t.responseType==="arraybuffer"&&t.response.byteLength===0?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:pi.FAILURE,xhr:t}:null},uet=function(n,t,i){return function(r,u){var o=u.response,s=gw(r,u),f,h,e;if(s)return i(s,n);if(o.byteLength!==16)return i({status:u.status,message:"Invalid HLS key at URL: "+u.uri,code:pi.FAILURE,xhr:u},n);for(f=new DataView(o),h=new Uint32Array([f.getUint32(0),f.getUint32(4),f.getUint32(8),f.getUint32(12)]),e=0;e<t.length;e++)t[e].bytes=h;return i(null,n)}},fet=function(n,t){var i=nw(n.map.bytes),r;if(i!=="mp4")return r=n.map.resolvedUri||n.map.uri,t({internal:!0,message:"Found unsupported "+(i||"unknown")+" container for initialization segment at URL: "+r,code:pi.FAILURE});fl({action:"probeMp4Tracks",data:n.map.bytes,transmuxer:n.transmuxer,callback:function(i){var r=i.tracks,u=i.data;return n.map.bytes=u,r.forEach(function(t){(n.map.tracks=n.map.tracks||{},n.map.tracks[t.type])||(n.map.tracks[t.type]=t,typeof t.id=="number"&&t.timescale&&(n.map.timescales=n.map.timescales||{},n.map.timescales[t.id]=t.timescale))}),t(null)}})},ddt=function(n){var t=n.segment,i=n.finishProcessingFn;return function(n,r){var f=gw(n,r),u;if(f)return i(f,t);if(u=new Uint8Array(r.response),t.map.key)return t.map.encryptedBytes=u,i(null,t);t.map.bytes=u;fet(t,function(n){if(n)return n.xhr=r,n.status=r.status,i(n,t);i(null,t)})}},gdt=function(n){var t=n.segment,i=n.finishProcessingFn,r=n.responseType;return function(n,u){var e=gw(n,u),f;return e?i(e,t):(f=r==="arraybuffer"||!u.responseText?u.response:odt(u.responseText.substring(t.lastReachedChar||0)),t.stats=bdt(u),t.key?t.encryptedBytes=new Uint8Array(f):t.bytes=new Uint8Array(f),i(null,t))}},ngt=function(n){var t=n.segment,o=n.bytes,u=n.trackInfoFn,f=n.timingInfoFn,a=n.videoSegmentTimingInfoFn,v=n.audioSegmentTimingInfoFn,y=n.id3Fn,p=n.captionsFn,w=n.isEndOfTimeline,b=n.endedTimelineFn,k=n.dataFn,s=n.doneFn,d=n.onTransmuxerLog,h=t.map&&t.map.tracks||{},e=Boolean(h.audio&&h.video),i=f.bind(null,t,"audio","start"),c=f.bind(null,t,"audio","end"),r=f.bind(null,t,"video","start"),l=f.bind(null,t,"video","end"),g=function(){return ret({bytes:o,transmuxer:t.transmuxer,audioAppendStart:t.audioAppendStart,gopsToAlignWith:t.gopsToAlignWith,remux:e,onData:function(n){n.type=n.type==="combined"?"video":n.type;k(t,n)},onTrackInfo:function(n){u&&(e&&(n.isMuxed=!0),u(t,n))},onAudioTimingInfo:function(n){i&&typeof n.start!="undefined"&&(i(n.start),i=null);c&&typeof n.end!="undefined"&&c(n.end)},onVideoTimingInfo:function(n){r&&typeof n.start!="undefined"&&(r(n.start),r=null);l&&typeof n.end!="undefined"&&l(n.end)},onVideoSegmentTimingInfo:function(n){a(n)},onAudioSegmentTimingInfo:function(n){v(n)},onId3:function(n,i){y(t,n,i)},onCaptions:function(n){p(t,[n])},isEndOfTimeline:w,onEndedTimeline:function(){b()},onTransmuxerLog:d,onDone:function(n){s&&(n.type=n.type==="combined"?"video":n.type,s(null,t,n))}})};fl({action:"probeTs",transmuxer:t.transmuxer,data:o,baseStartTime:t.baseStartTime,callback:function(n){t.bytes=o=n.data;var f=n.result;f&&(u(t,{hasAudio:f.hasAudio,hasVideo:f.hasVideo,isMuxed:e}),u=null,f.hasAudio&&!e&&i(f.audioStart),f.hasVideo&&r(f.videoStart),i=null,r=null);g()}})},eet=function(t){var i=t.segment,e=t.bytes,s=t.trackInfoFn,h=t.timingInfoFn,y=t.videoSegmentTimingInfoFn,p=t.audioSegmentTimingInfoFn,w=t.id3Fn,l=t.captionsFn,b=t.isEndOfTimeline,k=t.endedTimelineFn,a=t.dataFn,o=t.doneFn,v=t.onTransmuxerLog,f=new Uint8Array(e),r,u,c;if(ebt(f)){i.isFmp4=!0;r=i.map.tracks;u={isFmp4:!0,hasVideo:!!r.video,hasAudio:!!r.audio};r.audio&&r.audio.codec&&r.audio.codec!=="enca"&&(u.audioCodec=r.audio.codec);r.video&&r.video.codec&&r.video.codec!=="encv"&&(u.videoCodec=r.video.codec);r.video&&r.audio&&(u.isMuxed=!0);s(i,u);c=function(n){a(i,{data:f,type:u.hasAudio&&!u.isMuxed?"audio":"video"});n&&n.length&&l(i,n);o(null,i,{})};fl({action:"probeMp4StartTime",timescales:i.map.timescales,data:f,transmuxer:i.transmuxer,callback:function(t){var o=t.data,s=t.startTime;if(e=o.buffer,i.bytes=f=o,u.hasAudio&&!u.isMuxed&&h(i,"audio","start",s),u.hasVideo&&h(i,"video","start",s),!r.video||!o.byteLength||!i.transmuxer){c();return}fl({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:i.transmuxer,data:f,timescales:i.map.timescales,trackIds:[r.video.id],callback:function(t){e=t.data.buffer;i.bytes=f=t.data;t.logs.forEach(function(t){v(n.mergeOptions(t,{stream:"mp4CaptionParser"}))});c(t.captions)}})}});return}if(!i.transmuxer){o(null,i,{});return}if(typeof i.container=="undefined"&&(i.container=nw(f)),i.container!=="ts"&&i.container!=="aac"){s(i,{hasAudio:!1,hasVideo:!1});o(null,i,{});return}ngt({segment:i,bytes:e,trackInfoFn:s,timingInfoFn:h,videoSegmentTimingInfoFn:y,audioSegmentTimingInfoFn:p,id3Fn:w,captionsFn:l,isEndOfTimeline:b,endedTimelineFn:k,dataFn:a,doneFn:o,onTransmuxerLog:v})},oet=function(n,t){var f=n.id,i=n.key,e=n.encryptedBytes,r=n.decryptionWorker,o=function o(n){if(n.data.source===f){r.removeEventListener("message",o);var i=n.data.decrypted;t(new Uint8Array(i.bytes,i.byteOffset,i.byteLength))}},u;r.addEventListener("message",o);u=i.bytes.slice?i.bytes.slice():new Uint32Array(Array.prototype.slice.call(i.bytes));r.postMessage(sft({source:f,encrypted:e,key:u,iv:i.iv}),[e.buffer,u.buffer])},tgt=function(n){var i=n.decryptionWorker,t=n.segment,r=n.trackInfoFn,u=n.timingInfoFn,f=n.videoSegmentTimingInfoFn,e=n.audioSegmentTimingInfoFn,o=n.id3Fn,s=n.captionsFn,h=n.isEndOfTimeline,c=n.endedTimelineFn,l=n.dataFn,a=n.doneFn,v=n.onTransmuxerLog;oet({id:t.requestId,key:t.key,encryptedBytes:t.encryptedBytes,decryptionWorker:i},function(n){t.bytes=n;eet({segment:t,bytes:t.bytes,trackInfoFn:r,timingInfoFn:u,videoSegmentTimingInfoFn:f,audioSegmentTimingInfoFn:e,id3Fn:o,captionsFn:s,isEndOfTimeline:h,endedTimelineFn:c,dataFn:l,doneFn:a,onTransmuxerLog:v})})},igt=function(n){var i=n.activeXhrs,r=n.decryptionWorker,u=n.trackInfoFn,f=n.timingInfoFn,e=n.videoSegmentTimingInfoFn,o=n.audioSegmentTimingInfoFn,s=n.id3Fn,h=n.captionsFn,c=n.isEndOfTimeline,l=n.endedTimelineFn,a=n.dataFn,t=n.doneFn,v=n.onTransmuxerLog,y=0,p=!1;return function(n,w){if(!p){if(n)return p=!0,dw(i),t(n,w);if(y+=1,y===i.length){var b=function(){if(w.encryptedBytes)return tgt({decryptionWorker:r,segment:w,trackInfoFn:u,timingInfoFn:f,videoSegmentTimingInfoFn:e,audioSegmentTimingInfoFn:o,id3Fn:s,captionsFn:h,isEndOfTimeline:c,endedTimelineFn:l,dataFn:a,doneFn:t,onTransmuxerLog:v});eet({segment:w,bytes:w.bytes,trackInfoFn:u,timingInfoFn:f,videoSegmentTimingInfoFn:e,audioSegmentTimingInfoFn:o,id3Fn:s,captionsFn:h,isEndOfTimeline:c,endedTimelineFn:l,dataFn:a,doneFn:t,onTransmuxerLog:v})};if(w.endOfAllRequests=Date.now(),w.map&&w.map.encryptedBytes&&!w.map.bytes)return oet({decryptionWorker:r,id:w.requestId+"-init",encryptedBytes:w.map.encryptedBytes,key:w.map.key},function(n){w.map.bytes=n;fet(w,function(n){if(n)return dw(i),t(n,w);b()})});b()}}}},rgt=function(n){var t=n.loadendState,i=n.abortFn;return function(n){var r=n.target;r.aborted&&i&&!t.calledAbortFn&&(i(),t.calledAbortFn=!0)}},ugt=function(t){var i=t.segment,r=t.progressFn;return t.trackInfoFn,t.timingInfoFn,t.videoSegmentTimingInfoFn,t.audioSegmentTimingInfoFn,t.id3Fn,t.captionsFn,t.isEndOfTimeline,t.endedTimelineFn,t.dataFn,function(t){var u=t.target;if(!u.aborted)return i.stats=n.mergeOptions(i.stats,kdt(t)),!i.stats.firstBytesReceivedAt&&i.stats.bytesReceived&&(i.stats.firstBytesReceivedAt=Date.now()),r(t,i)}},fgt=function(t){var u=t.xhr,f=t.xhrOptions,nt=t.decryptionWorker,i=t.segment,tt=t.abortFn,it=t.progressFn,s=t.trackInfoFn,h=t.timingInfoFn,c=t.videoSegmentTimingInfoFn,l=t.audioSegmentTimingInfoFn,a=t.id3Fn,v=t.captionsFn,y=t.isEndOfTimeline,p=t.endedTimelineFn,w=t.dataFn,rt=t.doneFn,ut=t.onTransmuxerLog,r=[],e=igt({activeXhrs:r,decryptionWorker:nt,trackInfoFn:s,timingInfoFn:h,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:l,id3Fn:a,captionsFn:v,isEndOfTimeline:y,endedTimelineFn:p,dataFn:w,doneFn:rt,onTransmuxerLog:ut}),o,b,g;if(i.key&&!i.key.bytes){o=[i.key];i.map&&!i.map.bytes&&i.map.key&&i.map.key.resolvedUri===i.key.resolvedUri&&o.push(i.map.key);var ft=n.mergeOptions(f,{uri:i.key.resolvedUri,responseType:"arraybuffer"}),et=uet(i,o,e),ot=u(ft,et);r.push(ot)}if(i.map&&!i.map.bytes){if(b=i.map.key&&(!i.key||i.key.resolvedUri!==i.map.key.resolvedUri),b){var st=n.mergeOptions(f,{uri:i.map.key.resolvedUri,responseType:"arraybuffer"}),ht=uet(i,[i.map.key],e),ct=u(st,ht);r.push(ct)}var lt=n.mergeOptions(f,{uri:i.map.resolvedUri,responseType:"arraybuffer",headers:pw(i.map)}),at=ddt({segment:i,finishProcessingFn:e}),vt=u(lt,at);r.push(vt)}var k=n.mergeOptions(f,{uri:i.part&&i.part.resolvedUri||i.resolvedUri,responseType:"arraybuffer",headers:pw(i)}),yt=gdt({segment:i,finishProcessingFn:e,responseType:k.responseType}),d=u(k,yt);return d.addEventListener("progress",ugt({segment:i,progressFn:it,trackInfoFn:s,timingInfoFn:h,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:l,id3Fn:a,captionsFn:v,isEndOfTimeline:y,endedTimelineFn:p,dataFn:w})),r.push(d),g={},r.forEach(function(n){n.addEventListener("loadend",rgt({loadendState:g,abortFn:tt}))}),function(){return dw(r)}},egt=si("CodecUtils"),ogt=function(n){var t=n.attributes||{};if(t.CODECS)return vi(t.CODECS)},set=function(n,t){var i=t.attributes||{};return n&&n.mediaGroups&&n.mediaGroups.AUDIO&&i.AUDIO&&n.mediaGroups.AUDIO[i.AUDIO]},sgt=function(n,t){var u,i,r;if(!set(n,t))return!0;u=t.attributes||{};i=n.mediaGroups.AUDIO[u.AUDIO];for(r in i)if(!i[r].uri&&!i[r].playlists)return!0;return!1},el=function(n){var t={};return n.forEach(function(n){var i=n.mediaType,r=n.type,u=n.details;t[i]=t[i]||[];t[i].push(att(""+r+u))}),Object.keys(t).forEach(function(n){if(t[n].length>1){egt("multiple "+n+" codecs found as attributes: "+t[n].join(", ")+". Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.");t[n]=null;return}t[n]=t[n][0]}),t},het=function(n){var t=0;return n.audio&&t++,n.video&&t++,t},go=function(n,t){var u=t.attributes||{},i=el(ogt(t)||[]),r;return set(n,t)&&!i.audio&&(sgt(n,t)||(r=el(oat(n,u.AUDIO)||[]),r.audio&&(i.audio=r.audio))),i},ol=si("PlaylistSelector"),cet=function(n){if(n&&n.playlist){var t=n.playlist;return JSON.stringify({id:t.id,bandwidth:n.bandwidth,width:n.width,height:n.height,codecs:t.attributes&&t.attributes.CODECS||""})}},sl=function(n,t){if(!n)return"";var i=window.getComputedStyle(n);return i?i[t]:""},ne=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})},nb=function(n,t){var i,r;return n.attributes.BANDWIDTH&&(i=n.attributes.BANDWIDTH),i=i||window.Number.MAX_VALUE,t.attributes.BANDWIDTH&&(r=t.attributes.BANDWIDTH),r=r||window.Number.MAX_VALUE,i-r},hgt=function(n,t){var i,r;return(n.attributes.RESOLUTION&&n.attributes.RESOLUTION.width&&(i=n.attributes.RESOLUTION.width),i=i||window.Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(r=t.attributes.RESOLUTION.width),r=r||window.Number.MAX_VALUE,i===r&&n.attributes.BANDWIDTH&&t.attributes.BANDWIDTH)?n.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-r},aet=function(n,t,i,r,u,f){var h,tt,e,o,l,w,a,b,k,d,nt,it,rt,ut,v,s;if(n){h={bandwidth:t,width:i,height:r,limitRenditionByPlayerDimensions:u};tt=n.playlists;wt.isAudioOnly(n)&&(tt=f.getAudioTrackPlaylists_(),h.audioOnly=!0);e=tt.map(function(n){var t,i=n.attributes&&n.attributes.RESOLUTION&&n.attributes.RESOLUTION.width,r=n.attributes&&n.attributes.RESOLUTION&&n.attributes.RESOLUTION.height;return t=n.attributes&&n.attributes.BANDWIDTH,t=t||window.Number.MAX_VALUE,{bandwidth:t,width:i,height:r,playlist:n}});ne(e,function(n,t){return n.bandwidth-t.bandwidth});e=e.filter(function(n){return!wt.isIncompatible(n.playlist)});o=e.filter(function(n){return wt.isEnabled(n.playlist)});o.length||(o=e.filter(function(n){return!wt.isDisabled(n.playlist)}));var y=o.filter(function(n){return n.bandwidth*g.BANDWIDTH_VARIANCE<t}),c=y[y.length-1],p=y.filter(function(n){return n.bandwidth===c.bandwidth})[0];return u===!1?(l=p||o[0]||e[0],l&&l.playlist)?(w="sortedPlaylistReps",p&&(w="bandwidthBestRep"),o[0]&&(w="enabledPlaylistReps"),ol("choosing "+cet(l)+" using "+w+" with options",h),l.playlist):(ol("could not choose a playlist with options",h),null):(a=y.filter(function(n){return n.width&&n.height}),ne(a,function(n,t){return n.width-t.width}),b=a.filter(function(n){return n.width===i&&n.height===r}),c=b[b.length-1],k=b.filter(function(n){return n.bandwidth===c.bandwidth})[0],k||(d=a.filter(function(n){return n.width>i||n.height>r}),nt=d.filter(function(n){return n.width===d[0].width&&n.height===d[0].height}),c=nt[nt.length-1],it=nt.filter(function(n){return n.bandwidth===c.bandwidth})[0]),f.experimentalLeastPixelDiffSelector&&(ut=a.map(function(n){return n.pixelDiff=Math.abs(n.width-i)+Math.abs(n.height-r),n}),ne(ut,function(n,t){return n.pixelDiff===t.pixelDiff?t.bandwidth-n.bandwidth:n.pixelDiff-t.pixelDiff}),rt=ut[0]),v=rt||it||k||p||o[0]||e[0],v&&v.playlist)?(s="sortedPlaylistReps",rt?s="leastPixelDiffRep":it?s="resolutionPlusOneRep":k?s="resolutionBestRep":p?s="bandwidthBestRep":o[0]&&(s="enabledPlaylistReps"),ol("choosing "+cet(v)+" using "+s+" with options",h),v.playlist):(ol("could not choose a playlist with options",h),null)}},vet=function(){var n=this.useDevicePixelRatio?window.devicePixelRatio||1:1;return aet(this.playlists.master,this.systemBandwidth,parseInt(sl(this.tech_.el(),"width"),10)*n,parseInt(sl(this.tech_.el(),"height"),10)*n,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)},cgt=function(n){var t=-1,i=-1;if(n<0||n>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){var r=this.useDevicePixelRatio?window.devicePixelRatio||1:1;return t<0&&(t=this.systemBandwidth,i=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==i&&(t=n*this.systemBandwidth+(1-n)*t,i=this.systemBandwidth),aet(this.playlists.master,t,parseInt(sl(this.tech_.el(),"width"),10)*r,parseInt(sl(this.tech_.el(),"height"),10)*r,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)}},lgt=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!wt.isIncompatible(n)}),t=u.filter(wt.isEnabled);t.length||(t=u.filter(function(n){return!wt.isDisabled(n)}));var v=t.filter(wt.hasAttribute.bind(null,"BANDWIDTH")),i=v.map(function(n){var t=a.getSyncPoint(n,s,l,e),i=t?1:2,r=wt.estimateSegmentRequestTime(h,o,n),u=r*i-c;return{playlist:n,rebufferingImpact:u}}),r=i.filter(function(n){return n.rebufferingImpact<=0});return(ne(r,function(n,t){return nb(t.playlist,n.playlist)}),r.length)?r[0]:(ne(i,function(n,t){return n.rebufferingImpact-t.rebufferingImpact}),i[0]||null)},agt=function(){var i=this,n=this.playlists.master.playlists.filter(wt.isEnabled),t;return ne(n,function(n,t){return nb(n,t)}),t=n.filter(function(n){return!!go(i.playlists.master,n).video}),t[0]||null},vgt=function(n){var i=0,t;return n.bytes&&(t=new Uint8Array(n.bytes),n.segments.forEach(function(n){t.set(n,i);i+=n.byteLength})),t},ygt=function(n,t,i){var r,f;if(!n[i])if(t.trigger({type:"usage",name:"vhs-608"}),t.trigger({type:"usage",name:"hls-608"}),r=i,/^cc708_/.test(i)&&(r="SERVICE"+i.split("_")[1]),f=t.textTracks().getTrackById(r),f)n[i]=f;else{var h=t.options_.vhs&&t.options_.vhs.captionServices||{},e=i,o=i,s=!1,u=h[r];u&&(e=u.label,o=u.language,s=u["default"]);n[i]=t.addRemoteTextTrack({kind:"captions",id:r,"default":s,label:e,language:o},!1).track}},pgt=function(n){var u=n.inbandTextTracks,t=n.captionArray,i=n.timestampOffset,r;t&&(r=window.WebKitDataCue||window.VTTCue,t.forEach(function(n){var t=n.stream;u[t].addCue(new r(n.startTime+i,n.endTime+i,n.text))}))},wgt=function(t){Object.defineProperties(t.frame,{id:{get:function(){return n.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),t.value.key}},value:{get:function(){return n.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),t.value.data}},privateData:{get:function(){return n.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),t.value.data}}})},bgt=function(n){var h=n.inbandTextTracks,o=n.metadataArray,c=n.timestampOffset,l=n.videoDuration,s,t,r,u,i,f,e;if(o&&(s=window.WebKitDataCue||window.VTTCue,t=h.metadataTrack_,t)&&(o.forEach(function(n){var i=n.cueTime+c;typeof i!="number"||window.isNaN(i)||i<0||!(i<Infinity)||n.frames.forEach(function(n){var r=new s(i,i,n.value||n.url||n.data||"");r.frame=n;r.value=n;wgt(r);t.addCue(r)})}),t.cues&&t.cues.length)){for(r=t.cues,u=[],i=0;i<r.length;i++)r[i]&&u.push(r[i]);f=u.reduce(function(n,t){var i=n[t.startTime]||[];return i.push(t),n[t.startTime]=i,n},{});e=Object.keys(f).sort(function(n,t){return Number(n)-Number(t)});e.forEach(function(n,t){var i=f[n],r=Number(e[t+1])||l;i.forEach(function(n){n.endTime=r})})}},kgt=function(n,t,i){n.metadataTrack_||(n.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,n.metadataTrack_.inBandMetadataTrackDispatchType=t)},ns=function(n,t,i){var u,r;if(i&&i.cues)for(u=i.cues.length;u--;)r=i.cues[u],r.startTime>=n&&r.endTime<=t&&i.removeCue(r)},dgt=function(n){var t=n.cues,r,u,f,i;if(t)for(r=0;r<t.length;r++){for(u=[],f=0,i=0;i<t.length;i++)t[r].startTime===t[i].startTime&&t[r].endTime===t[i].endTime&&t[r].text===t[i].text&&(f++,f>1&&u.push(t[i]));u.length&&u.forEach(function(t){return n.removeCue(t)})}},ggt=function(n,t,i){if(typeof t=="undefined"||t===null||!n.length)return[];for(var u=Math.ceil((t-i+3)*gc),r=0;r<n.length;r++)if(n[r].pts>u)break;return n.slice(r)},nnt=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)},tnt=function(n,t,i,r){for(var o=Math.ceil((t-r)*gc),s=Math.ceil((i-r)*gc),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},int=function(n,t){var r,f,i,u;if(!n&&!t||!n&&t||n&&!t)return!1;if(n===t)return!0;if(r=Object.keys(n).sort(),f=Object.keys(t).sort(),r.length!==f.length)return!1;for(i=0;i<r.length;i++)if((u=r[i],u!==f[i])||n[u]!==t[u])return!1;return!0},yet=22,rnt=function(n,t,i){var u,f,r,e;for(t=t||[],u=[],f=0,r=0;r<t.length;r++)if(e=t[r],n===e.timeline&&(u.push(r),f+=e.duration,f>i))return r;return u.length===0?0:u[u.length-1]},ts=1,unt=500,pet=function(n){return typeof n=="number"&&isFinite(n)},hl=1/60,fnt=function(n,t,i){return n!=="main"||!t||!i?null:!i.hasAudio&&!i.hasVideo?"Neither audio nor video found in segment.":t.hasVideo&&!i.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!t.hasVideo&&i.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null},ent=function(n,t,i){var r=t-g.BACK_BUFFER_LENGTH,u;return n.length&&(r=Math.max(r,n.start(0))),u=t-i,Math.min(u,r)},te=function(n){var h=n.startOfSegment,c=n.duration,i=n.segment,f=n.part,r=n.playlist,e=r.mediaSequence,l=r.id,o=r.segments,a=o===void 0?[]:o,v=n.mediaIndex,s=n.partIndex,y=n.timeline,p=a.length-1,t="mediaIndex/partIndex increment";n.getMediaInfoForTime?t="getMediaInfoForTime ("+n.getMediaInfoForTime+")":n.isSyncRequest&&(t="getSyncSegmentCandidate (isSyncRequest)");n.independent&&(t+=" with independent "+n.independent);var u=typeof s=="number",w=n.segment.uri?"segment":"pre-segment",b=u?yut({preloadSegment:i})-1:0;return w+" ["+(e+v)+"/"+(e+p)+"]"+(u?" part ["+s+"/"+b+"]":"")+(" segment start/end ["+i.start+" => "+i.end+"]")+(u?" part start/end ["+f.start+" => "+f.end+"]":"")+(" startOfSegment ["+h+"]")+(" duration ["+c+"]")+(" timeline ["+y+"]")+(" selected by ["+t+"]")+(" playlist ["+l+"]")},wet=function(n){return n+"TimingInfo"},ont=function(n){var i=n.segmentTimeline,r=n.currentTimeline,u=n.startOfSegment,t=n.buffered,f=n.overrideCheck;return!f&&i===r?null:i<r?u:t.length?t.end(t.length-1):u},bet=function(n){var u=n.timelineChangeController,e=n.currentTimeline,t=n.segmentTimeline,f=n.loaderType,o=n.audioDisabled,i,r;return e===t?!1:f==="audio"?(i=u.lastTimelineChange({type:"main"}),!i||i.to!==t):f==="main"&&o?(r=u.pendingTimelineChange({type:"audio"}),r&&r.to===t)?!1:!0:!1},snt=function(n){var t=0;return["video","audio"].forEach(function(i){var e=n[i+"TimingInfo"],r,u,f;e&&(r=e.start,u=e.end,typeof r=="bigint"||typeof u=="bigint"?f=window.BigInt(u)-window.BigInt(r):typeof r=="number"&&typeof u=="number"&&(f=u-r),typeof f!="undefined"&&f>t&&(t=f))}),typeof t=="bigint"&&t<Number.MAX_SAFE_INTEGER&&(t=Number(t)),t},ket=function(n){var t=n.segmentDuration,i=n.maxDuration;return t?Math.round(t)>i+ar:!1},hnt=function(n,t){var i;if(t!=="hls"||(i=snt({audioTimingInfo:n.audioTimingInfo,videoTimingInfo:n.videoTimingInfo}),!i))return null;var r=n.playlist.targetDuration,u=ket({segmentDuration:i,maxDuration:r*2}),f=ket({segmentDuration:i,maxDuration:r}),e="Segment with index "+n.mediaIndex+" "+("from playlist "+n.playlist.id+" ")+("has a duration of "+i+" ")+("when the reported duration is "+n.duration+" ")+("and the target duration is "+r+". ")+"For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1";return u||f?{severity:u?"warn":"info",message:e}:null},tb=function(t){function u(i){var r;if(r=t.call(this)||this,!i)throw new TypeError("Initialization settings are required");if(typeof i.currentTime!="function")throw new TypeError("No currentTime getter specified");if(!i.mediaSource)throw new TypeError("No MediaSource specified");r.bandwidth=i.bandwidth;r.throughput={rate:0,count:0};r.roundTrip=NaN;r.resetStats_();r.mediaIndex=null;r.partIndex=null;r.hasPlayed_=i.hasPlayed;r.currentTime_=i.currentTime;r.seekable_=i.seekable;r.seeking_=i.seeking;r.duration_=i.duration;r.mediaSource_=i.mediaSource;r.vhs_=i.vhs;r.loaderType_=i.loaderType;r.currentMediaInfo_=void 0;r.startingMediaInfo_=void 0;r.segmentMetadataTrack_=i.segmentMetadataTrack;r.goalBufferLength_=i.goalBufferLength;r.sourceType_=i.sourceType;r.sourceUpdater_=i.sourceUpdater;r.inbandTextTracks_=i.inbandTextTracks;r.state_="INIT";r.timelineChangeController_=i.timelineChangeController;r.shouldSaveSegmentTimingInfo_=!0;r.parse708captions_=i.parse708captions;r.captionServices_=i.captionServices;r.experimentalExactManifestTimings=i.experimentalExactManifestTimings;r.checkBufferTimeout_=null;r.error_=void 0;r.currentTimeline_=-1;r.pendingSegment_=null;r.xhrOptions_=null;r.pendingSegments_=[];r.audioDisabled_=!1;r.isPendingTimestampOffset_=!1;r.gopBuffer_=[];r.timeMapping_=0;r.safeAppend_=n.browser.IE_VERSION>=11;r.appendInitSegment_={audio:!0,video:!0};r.playlistOfLastInitSegment_={audio:null,video:null};r.callQueue_=[];r.loadQueue_=[];r.metadataQueue_={id3:[],caption:[]};r.waitingOnRemove_=!1;r.quotaExceededErrorRetryTimeout_=null;r.activeInitSegmentId_=null;r.initSegments_={};r.cacheEncryptionKeys_=i.cacheEncryptionKeys;r.keyCache_={};r.decrypter_=i.decrypter;r.syncController_=i.syncController;r.syncPoint_={segmentIndex:0,time:0};r.transmuxer_=r.createTransmuxer_();r.triggerSyncInfoUpdate_=function(){return r.trigger("syncinfoupdate")};r.syncController_.on("syncinfoupdate",r.triggerSyncInfoUpdate_);r.mediaSource_.addEventListener("sourceopen",function(){r.isEndOfStream_()||(r.ended_=!1)});r.fetchAtBuffer_=!1;r.logger_=si("SegmentLoader["+r.loaderType_+"]");Object.defineProperty(f(r),"state",{get:function(){return this.state_},set:function(n){n!==this.state_&&(this.logger_(this.state_+" -> "+n),this.state_=n,this.trigger("statechange"))}});r.sourceUpdater_.on("ready",function(){r.hasEnoughInfoToAppend_()&&r.processCallQueue_()});if(r.loaderType_==="main")r.timelineChangeController_.on("pendingtimelinechange",function(){r.hasEnoughInfoToAppend_()&&r.processCallQueue_()});if(r.loaderType_==="audio")r.timelineChangeController_.on("timelinechange",function(){r.hasEnoughInfoToLoad_()&&r.processLoadQueue_();r.hasEnoughInfoToAppend_()&&r.processCallQueue_()});return r}i(u,t);var r=u.prototype;return r.createTransmuxer_=function(){return kw.createTransmuxer({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})},r.resetStats_=function(){this.mediaBytesTransferred=0;this.mediaRequests=0;this.mediaRequestsAborted=0;this.mediaRequestsTimedout=0;this.mediaRequestsErrored=0;this.mediaTransferDuration=0;this.mediaSecondsLoaded=0;this.mediaAppends=0},r.dispose=function(){this.trigger("dispose");this.state="DISPOSED";this.pause();this.abort_();this.transmuxer_&&this.transmuxer_.terminate();this.resetStats_();this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_);this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_);this.off()},r.setAudio=function(n){this.audioDisabled_=!n;n?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())},r.abort=function(){if(this.state!=="WAITING"){this.pendingSegment_&&(this.pendingSegment_=null);return}this.abort_();this.state="READY";this.paused()||this.monitorBuffer_()},r.abort_=function(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests();this.pendingSegment_=null;this.callQueue_=[];this.loadQueue_=[];this.metadataQueue_.id3=[];this.metadataQueue_.caption=[];this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);this.waitingOnRemove_=!1;window.clearTimeout(this.quotaExceededErrorRetryTimeout_);this.quotaExceededErrorRetryTimeout_=null},r.checkForAbort_=function(n){return this.state==="APPENDING"&&!this.pendingSegment_?(this.state="READY",!0):!this.pendingSegment_||this.pendingSegment_.requestId!==n?!0:!1},r.error=function(n){return typeof n!="undefined"&&(this.logger_("error occurred:",n),this.error_=n),this.pendingSegment_=null,this.error_},r.endOfStream=function(){this.ended_=!0;this.transmuxer_&&kw.reset(this.transmuxer_);this.gopBuffer_.length=0;this.pause();this.trigger("ended")},r.buffered_=function(){var t=this.getMediaInfo_();if(!this.sourceUpdater_||!t)return n.createTimeRanges();if(this.loaderType_==="main"){var r=t.hasAudio,i=t.hasVideo,u=t.isMuxed;if(i&&r&&!this.audioDisabled_&&!u)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()},r.initSegmentForMap=function(n,t){if(t===void 0&&(t=!1),!n)return null;var r=ul(n),i=this.initSegments_[r];return t&&!i&&n.bytes&&(this.initSegments_[r]=i={resolvedUri:n.resolvedUri,byterange:n.byterange,bytes:n.bytes,tracks:n.tracks,timescales:n.timescales}),i||n},r.segmentKey=function(n,t){var r,i,u;return(t===void 0&&(t=!1),!n)?null:(r=hft(n),i=this.keyCache_[r],this.cacheEncryptionKeys_&&t&&!i&&n.bytes&&(this.keyCache_[r]=i={resolvedUri:n.resolvedUri,bytes:n.bytes}),u={resolvedUri:(i||n).resolvedUri},i&&(u.bytes=i.bytes),u)},r.couldBeginLoading_=function(){return this.playlist_&&!this.paused()},r.load=function(){if(this.monitorBuffer_(),this.playlist_){if(this.state==="INIT"&&this.couldBeginLoading_())return this.init_();this.couldBeginLoading_()&&(this.state==="READY"||this.state==="INIT")&&(this.state="READY")}},r.init_=function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()},r.playlist=function(n,t){var r,i,u,f,e,o;if(t===void 0&&(t={}),n){if(r=this.playlist_,i=this.pendingSegment_,this.playlist_=n,this.xhrOptions_=t,this.state==="INIT"&&(n.syncInfo={mediaSequence:n.mediaSequence,time:0},this.loaderType_==="main"&&this.syncController_.setDateTimeMappingForStart(n)),u=null,r&&(r.id?u=r.id:r.uri&&(u=r.uri)),this.logger_("playlist update ["+u+" => "+(n.id||n.uri)+"]"),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!r||r.uri!==n.uri){this.mediaIndex!==null&&(n.endList?this.resyncLoader():this.resetLoader());this.currentMediaInfo_=void 0;this.trigger("playlistupdate");return}f=n.mediaSequence-r.mediaSequence;this.logger_("live window shift ["+f+"]");this.mediaIndex!==null&&(this.mediaIndex-=f,this.mediaIndex<0?(this.mediaIndex=null,this.partIndex=null):(e=this.playlist_.segments[this.mediaIndex],!this.partIndex||e.parts&&e.parts.length&&e.parts[this.partIndex]||(o=this.mediaIndex,this.logger_("currently processing part (index "+this.partIndex+") no longer exists."),this.resetLoader(),this.mediaIndex=o)));i&&(i.mediaIndex-=f,i.mediaIndex<0?(i.mediaIndex=null,i.partIndex=null):(i.mediaIndex>=0&&(i.segment=n.segments[i.mediaIndex]),i.partIndex>=0&&i.segment.parts&&(i.part=i.segment.parts[i.partIndex])));this.syncController_.saveExpiredSegmentInfo(r,n)}},r.pause=function(){this.checkBufferTimeout_&&(window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)},r.paused=function(){return this.checkBufferTimeout_===null},r.resetEverything=function(n){this.ended_=!1;this.appendInitSegment_={audio:!0,video:!0};this.resetLoader();this.remove(0,Infinity,n);this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))},r.resetLoader=function(){this.fetchAtBuffer_=!1;this.resyncLoader()},r.resyncLoader=function(){this.transmuxer_&&kw.reset(this.transmuxer_);this.mediaIndex=null;this.partIndex=null;this.syncPoint_=null;this.isPendingTimestampOffset_=!1;this.callQueue_=[];this.loadQueue_=[];this.metadataQueue_.id3=[];this.metadataQueue_.caption=[];this.abort();this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})},r.remove=function(n,t,i,r){var u,f,e;if(i===void 0&&(i=function(){}),r===void 0&&(r=!1),t===Infinity&&(t=this.duration_()),t<=n){this.logger_("skipping remove because end ${end} is <= start ${start}");return}if(!this.sourceUpdater_||!this.getMediaInfo_()){this.logger_("skipping remove because no source updater or starting media info");return}u=1;f=function(){u--;u===0&&i()};(r||!this.audioDisabled_)&&(u++,this.sourceUpdater_.removeAudio(n,t,f));(r||this.loaderType_==="main")&&(this.gopBuffer_=tnt(this.gopBuffer_,n,t,this.timeMapping_),u++,this.sourceUpdater_.removeVideo(n,t,f));for(e in this.inbandTextTracks_)ns(n,t,this.inbandTextTracks_[e]);ns(n,t,this.segmentMetadataTrack_);f()},r.monitorBuffer_=function(){this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_);this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),1)},r.monitorBufferTick_=function(){this.state==="READY"&&this.fillBuffer_();this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_);this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),unt)},r.fillBuffer_=function(){if(!this.sourceUpdater_.updating()){var n=this.chooseNextRequest_();n&&(typeof n.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:n.timeline})),this.loadSegment_(n))}},r.isEndOfStream_=function(n,t,i){if(n===void 0&&(n=this.mediaIndex),t===void 0&&(t=this.playlist_),i===void 0&&(i=this.partIndex),!t||!this.mediaSource_)return!1;var r=typeof n=="number"&&t.segments[n],u=n+1===t.segments.length,f=!r||!r.parts||i+1===r.parts.length;return t.endList&&this.mediaSource_.readyState==="open"&&u&&f},r.chooseNextRequest_=function(){var l=this.buffered_(),e=lut(l)||0,o=fw(l,this.currentTime_()),v=!this.hasPlayed_()&&o>=1,y=o>=this.goalBufferLength_(),i=this.playlist_.segments,n,u,s,t,f,r,c,a;if(!i.length||v||y)return null;if(this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_()),n={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)},n.isSyncRequest)n.mediaIndex=rnt(this.currentTimeline_,i,e);else if(this.mediaIndex!==null)u=i[this.mediaIndex],s=typeof this.partIndex=="number"?this.partIndex:-1,n.startOfSegment=u.end?u.end:e,u.parts&&u.parts[s+1]?(n.mediaIndex=this.mediaIndex,n.partIndex=s+1):n.mediaIndex=this.mediaIndex+1;else{var h=wt.getMediaInfoForTime({experimentalExactManifestTimings:this.experimentalExactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?e:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time}),p=h.segmentIndex,w=h.startTime,b=h.partIndex;n.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd "+e:"currentTime "+this.currentTime_();n.mediaIndex=p;n.startOfSegment=w;n.partIndex=b}return(t=i[n.mediaIndex],f=t&&typeof n.partIndex=="number"&&t.parts&&t.parts[n.partIndex],!t||typeof n.partIndex=="number"&&!f)?null:(typeof n.partIndex!="number"&&t.parts&&(n.partIndex=0,f=t.parts[0]),o||!f||f.independent||(n.partIndex===0?(r=i[n.mediaIndex-1],c=r.parts&&r.parts.length&&r.parts[r.parts.length-1],c&&c.independent&&(n.mediaIndex-=1,n.partIndex=r.parts.length-1,n.independent="previous segment")):t.parts[n.partIndex-1].independent&&(n.partIndex-=1,n.independent="previous part")),a=this.mediaSource_&&this.mediaSource_.readyState==="ended",n.mediaIndex>=i.length-1&&a&&!this.seeking_())?null:this.generateSegmentInfo_(n)},r.generateSegmentInfo_=function(n){var c=n.independent,e=n.playlist,o=n.mediaIndex,s=n.startOfSegment,l=n.isSyncRequest,u=n.partIndex,h=n.forceTimestampOffset,a=n.getMediaInfoForTime,t=e.segments[o],i=typeof u=="number"&&t.parts[u],r={requestId:"segment-loader-"+Math.random(),uri:i&&i.resolvedUri||t.resolvedUri,mediaIndex:o,partIndex:i?u:null,isSyncRequest:l,startOfSegment:s,playlist:e,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:t.timeline,duration:i&&i.duration||t.duration,segment:t,part:i,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:a,independent:c},v=typeof h!="undefined"?h:this.isPendingTimestampOffset_,f;return r.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:t.timeline,currentTimeline:this.currentTimeline_,startOfSegment:s,buffered:this.buffered_(),overrideCheck:v}),f=lut(this.sourceUpdater_.audioBuffered()),typeof f=="number"&&(r.audioAppendStart=f-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(r.gopsToAlignWith=ggt(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),r},r.timestampOffsetForSegment_=function(n){return ont(n)},r.earlyAbortWhenNeeded_=function(n){var t;if(!this.vhs_.tech_.paused()&&this.xhrOptions_.timeout&&this.playlist_.attributes.BANDWIDTH&&!(Date.now()-(n.firstBytesReceivedAt||Date.now())<1e3)){var r=this.currentTime_(),u=n.bandwidth,f=this.pendingSegment_.duration,e=wt.estimateSegmentRequestTime(f,u,this.playlist_,n.bytesReceived),i=cbt(this.buffered_(),r,this.vhs_.tech_.playbackRate())-1;if(!(e<=i)&&(t=lgt({master:this.vhs_.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;(i<=ar&&(o=1),!t.playlist||t.playlist.uri===this.playlist_.uri||h<o)||(this.bandwidth=t.playlist.attributes.BANDWIDTH*g.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}}},r.handleAbort_=function(n){this.logger_("Aborting "+te(n));this.mediaRequestsAborted+=1},r.handleProgress_=function(n,t){(this.earlyAbortWhenNeeded_(t.stats),this.checkForAbort_(t.requestId))||this.trigger("progress")},r.handleTrackInfo_=function(n,t){(this.earlyAbortWhenNeeded_(n.stats),this.checkForAbort_(n.requestId))||this.checkForIllegalMediaSwitch(t)||(t=t||{},int(this.currentMediaInfo_,t)||(this.appendInitSegment_={audio:!0,video:!0},this.startingMediaInfo_=t,this.currentMediaInfo_=t,this.logger_("trackinfo update",t),this.trigger("trackinfo")),this.checkForAbort_(n.requestId))||(this.pendingSegment_.trackInfo=t,this.hasEnoughInfoToAppend_()&&this.processCallQueue_())},r.handleTimingInfo_=function(n,t,i,r){if(this.earlyAbortWhenNeeded_(n.stats),!this.checkForAbort_(n.requestId)){var u=this.pendingSegment_,f=wet(t);u[f]=u[f]||{};u[f][i]=r;this.logger_("timinginfo: "+t+" - "+i+" - "+r);this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}},r.handleCaptions_=function(n,t){var u=this,f,r,i;if(this.earlyAbortWhenNeeded_(n.stats),!this.checkForAbort_(n.requestId)){if(t.length===0){this.logger_("SegmentLoader received no captions from a caption event");return}if(f=this.pendingSegment_,!f.hasAppendedData_){this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,n,t));return}r=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();i={};t.forEach(function(n){i[n.stream]=i[n.stream]||{startTime:Infinity,captions:[],endTime:0};var t=i[n.stream];t.startTime=Math.min(t.startTime,n.startTime+r);t.endTime=Math.max(t.endTime,n.endTime+r);t.captions.push(n)});Object.keys(i).forEach(function(n){var t=i[n],e=t.startTime,o=t.endTime,s=t.captions,f=u.inbandTextTracks_;u.logger_("adding cues from "+e+" -> "+o+" for "+n);ygt(f,u.vhs_.tech_,n);ns(e,o,f[n]);pgt({captionArray:s,inbandTextTracks:f,timestampOffset:r})});this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}},r.handleId3_=function(n,t,i){var r,u;if(this.earlyAbortWhenNeeded_(n.stats),!this.checkForAbort_(n.requestId)){if(r=this.pendingSegment_,!r.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,n,t,i));return}u=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();kgt(this.inbandTextTracks_,i,this.vhs_.tech_);bgt({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:u,videoDuration:this.duration_()})}},r.processMetadataQueue_=function(){this.metadataQueue_.id3.forEach(function(n){return n()});this.metadataQueue_.caption.forEach(function(n){return n()});this.metadataQueue_.id3=[];this.metadataQueue_.caption=[]},r.processCallQueue_=function(){var n=this.callQueue_;this.callQueue_=[];n.forEach(function(n){return n()})},r.processLoadQueue_=function(){var n=this.loadQueue_;this.loadQueue_=[];n.forEach(function(n){return n()})},r.hasEnoughInfoToLoad_=function(){if(this.loaderType_!=="audio")return!0;var n=this.pendingSegment_;return n?this.getCurrentMediaInfo_()?bet({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:n.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_})?!1:!0:!0:!1},r.getCurrentMediaInfo_=function(n){return n===void 0&&(n=this.pendingSegment_),n&&n.trackInfo||this.currentMediaInfo_},r.getMediaInfo_=function(n){return n===void 0&&(n=this.pendingSegment_),this.getCurrentMediaInfo_(n)||this.startingMediaInfo_},r.hasEnoughInfoToAppend_=function(){var n,t;if(!this.sourceUpdater_.ready()||this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_||(n=this.pendingSegment_,t=this.getCurrentMediaInfo_(),!n||!t))return!1;var i=t.hasAudio,r=t.hasVideo,u=t.isMuxed;return r&&!n.videoTimingInfo?!1:i&&!this.audioDisabled_&&!u&&!n.audioTimingInfo?!1:bet({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:n.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_})?!1:!0},r.handleData_=function(n,t){var i,r,u,e,f;if(this.earlyAbortWhenNeeded_(n.stats),!this.checkForAbort_(n.requestId)){if(this.callQueue_.length||!this.hasEnoughInfoToAppend_()){this.callQueue_.push(this.handleData_.bind(this,n,t));return}if(i=this.pendingSegment_,this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),this.mediaSource_.readyState!=="closed"){if(n.map&&(n.map=this.initSegmentForMap(n.map,!0),i.segment.map=n.map),n.key&&this.segmentKey(n.key,!0),i.isFmp4=n.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4?(this.trigger("fmp4"),i.timingInfo.start=i[wet(t.type)].start):(r=this.getCurrentMediaInfo_(),u=this.loaderType_==="main"&&r&&r.hasVideo,u&&(e=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:u,firstVideoFrameTimeForData:e,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})),this.updateAppendInitSegmentStatus(i,t.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){if(this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:this.loaderType_==="main"}),f=this.chooseNextRequest_(),f.mediaIndex!==i.mediaIndex||f.partIndex!==i.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0;this.processMetadataQueue_();this.appendData_(i,t)}}},r.updateAppendInitSegmentStatus=function(n,t){this.loaderType_!=="main"||typeof n.timestampOffset!="number"||n.changedTimestampOffset||(this.appendInitSegment_={audio:!0,video:!0});this.playlistOfLastInitSegment_[t]!==n.playlist&&(this.appendInitSegment_[t]=!0)},r.getInitSegmentAndUpdateState_=function(n){var t=n.type,i=n.initSegment,r=n.map,f=n.playlist,u;if(r){if(u=ul(r),this.activeInitSegmentId_===u)return null;i=this.initSegmentForMap(r,!0).bytes;this.activeInitSegmentId_=u}return i&&this.appendInitSegment_[t]?(this.playlistOfLastInitSegment_[t]=f,this.appendInitSegment_[t]=!1,this.activeInitSegmentId_=null,i):null},r.handleQuotaExceededError_=function(n){var r=this,o=n.segmentInfo,s=n.type,f=n.bytes,t=this.sourceUpdater_.audioBuffered(),i=this.sourceUpdater_.videoBuffered(),e,u;t.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+hu(t).join(", "));i.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+hu(i).join(", "));var h=t.length?t.start(0):0,c=t.length?t.end(t.length-1):0,l=i.length?i.start(0):0,a=i.length?i.end(i.length-1):0;if(c-h<=ts&&a-l<=ts){this.logger_("On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. "+("Appended byte length: "+f.byteLength+", ")+("audio buffer: "+hu(t).join(", ")+", ")+("video buffer: "+hu(i).join(", ")+", "));this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:Infinity});this.trigger("error");return}this.waitingOnRemove_=!0;this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:o,type:s,bytes:f}));e=this.currentTime_();u=e-ts;this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to "+u);this.remove(0,u,function(){r.logger_("On QUOTA_EXCEEDED_ERR, retrying append in "+ts+"s");r.waitingOnRemove_=!1;r.quotaExceededErrorRetryTimeout_=window.setTimeout(function(){r.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue");r.quotaExceededErrorRetryTimeout_=null;r.processCallQueue_()},ts*1e3)},!0)},r.handleAppendError_=function(n,t){var i=n.segmentInfo,r=n.type,u=n.bytes;if(t){if(t.code===yet){this.handleQuotaExceededError_({segmentInfo:i,type:r,bytes:u});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",t);this.error(r+" append of "+u.length+"b failed for segment "+("#"+i.mediaIndex+" in playlist "+i.playlist.id));this.trigger("appenderror")}},r.appendToSourceBuffer_=function(n){var f=n.segmentInfo,e=n.type,i=n.initSegment,o=n.data,t=n.bytes,r,u;t||(r=[o],u=o.byteLength,i&&(r.unshift(i),u+=i.byteLength),t=vgt({bytes:u,segments:r}));this.sourceUpdater_.appendBuffer({segmentInfo:f,type:e,bytes:t},this.handleAppendError_.bind(this,{segmentInfo:f,type:e,bytes:t}))},r.handleSegmentTimingInfo_=function(n,t,i){if(this.pendingSegment_&&t===this.pendingSegment_.requestId){var r=this.pendingSegment_.segment,u=n+"TimingInfo";r[u]||(r[u]={});r[u].transmuxerPrependedSeconds=i.prependedContentDuration||0;r[u].transmuxedPresentationStart=i.start.presentation;r[u].transmuxedDecodeStart=i.start.decode;r[u].transmuxedPresentationEnd=i.end.presentation;r[u].transmuxedDecodeEnd=i.end.decode;r[u].baseMediaDecodeTime=i.baseMediaDecodeTime}},r.appendData_=function(n,t){var i=t.type,r=t.data,u;r&&r.byteLength&&(i==="audio"&&this.audioDisabled_||(u=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:n.playlist,map:n.isFmp4?n.segment.map:null}),this.appendToSourceBuffer_({segmentInfo:n,type:i,initSegment:u,data:r})))},r.loadSegment_=function(n){var t=this;if(this.state="WAITING",this.pendingSegment_=n,this.trimBackBuffer_(n),typeof n.timestampOffset=="number"&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),!this.hasEnoughInfoToLoad_()){this.loadQueue_.push(function(){var i=hi({},n,{forceTimestampOffset:!0});hi(n,t.generateSegmentInfo_(i));t.isPendingTimestampOffset_=!1;t.updateTransmuxerAndRequestSegment_(n)});return}this.updateTransmuxerAndRequestSegment_(n)},r.updateTransmuxerAndRequestSegment_=function(n){var i=this;this.shouldUpdateTransmuxerTimestampOffset_(n.timestampOffset)&&(this.gopBuffer_.length=0,n.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:n.timestampOffset}));var t=this.createSimplifiedSegmentObj_(n),r=this.isEndOfStream_(n.mediaIndex,n.playlist,n.partIndex),u=this.mediaIndex!==null,f=n.timeline!==this.currentTimeline_&&n.timeline>0,e=r||u&&f;this.logger_("Requesting "+te(n));t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0});n.abortRequests=fgt({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,abortFn:this.handleAbort_.bind(this,n),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",n.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",n.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:e,endedTimelineFn:function(){i.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:function(t){var r=t.message,u=t.level,f=t.stream;i.logger_(te(n)+" logged from transmuxer stream "+f+" as a "+u+": "+r)}})},r.trimBackBuffer_=function(){var n=ent(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);n>0&&this.remove(0,n)},r.createSimplifiedSegmentObj_=function(n){var t=n.segment,u=n.part,i={resolvedUri:u?u.resolvedUri:t.resolvedUri,byterange:u?u.byterange:t.byterange,requestId:n.requestId,transmuxer:n.transmuxer,audioAppendStart:n.audioAppendStart,gopsToAlignWith:n.gopsToAlignWith,part:n.part},r=n.playlist.segments[n.mediaIndex-1],f;return r&&r.timeline===t.timeline&&(r.videoTimingInfo?i.baseStartTime=r.videoTimingInfo.transmuxedDecodeEnd:r.audioTimingInfo&&(i.baseStartTime=r.audioTimingInfo.transmuxedDecodeEnd)),t.key&&(f=t.key.iv||new Uint32Array([0,0,0,n.mediaIndex+n.playlist.mediaSequence]),i.key=this.segmentKey(t.key),i.key.iv=f),t.map&&(i.map=this.initSegmentForMap(t.map)),i},r.saveTransferStats_=function(n){this.mediaRequests+=1;n&&(this.mediaBytesTransferred+=n.bytesReceived,this.mediaTransferDuration+=n.roundTripTime)},r.saveBandwidthRelatedStats_=function(n,t){if(this.pendingSegment_.byteLength=t.bytesReceived,n<hl){this.logger_("Ignoring segment's bandwidth because its duration of "+n+(" is less than the min to record "+hl));return}this.bandwidth=t.bandwidth;this.roundTrip=t.roundTripTime},r.handleTimeout_=function(){this.mediaRequestsTimedout+=1;this.bandwidth=1;this.roundTrip=NaN;this.trigger("bandwidthupdate")},r.segmentRequestFinished_=function(n,t,i){if(this.callQueue_.length){this.callQueue_.push(this.segmentRequestFinished_.bind(this,n,t,i));return}if((this.saveTransferStats_(t.stats),this.pendingSegment_)&&t.requestId===this.pendingSegment_.requestId){if(n){if(this.pendingSegment_=null,this.state="READY",n.code===pi.ABORTED)return;if(this.pause(),n.code===pi.TIMEOUT){this.handleTimeout_();return}this.mediaRequestsErrored+=1;this.error(n);this.trigger("error");return}var r=this.pendingSegment_;this.saveBandwidthRelatedStats_(r.duration,t.stats);r.endOfAllRequests=t.endOfAllRequests;i.gopInfo&&(this.gopBuffer_=nnt(this.gopBuffer_,i.gopInfo,this.safeAppend_));this.state="APPENDING";this.trigger("appending");this.waitForAppendsToComplete_(r)}},r.setTimeMapping_=function(n){var t=this.syncController_.mappingForTimeline(n);t!==null&&(this.timeMapping_=t)},r.updateMediaSecondsLoaded_=function(n){this.mediaSecondsLoaded+=typeof n.start=="number"&&typeof n.end=="number"?n.end-n.start:n.duration},r.shouldUpdateTransmuxerTimestampOffset_=function(n){return n===null?!1:this.loaderType_==="main"&&n!==this.sourceUpdater_.videoTimestampOffset()?!0:!this.audioDisabled_&&n!==this.sourceUpdater_.audioTimestampOffset()?!0:!1},r.trueSegmentStart_=function(n){var i=n.currentStart,f=n.playlist,r=n.mediaIndex,u=n.firstVideoFrameTimeForData,e=n.currentVideoTimestampOffset,o=n.useVideoTimingInfo,s=n.videoTimingInfo,h=n.audioTimingInfo,t;return typeof i!="undefined"?i:o?(t=f.segments[r-1],r===0||!t||typeof t.start=="undefined"||t.end!==u+e)?u:s.start:h.start},r.waitForAppendsToComplete_=function(n){var t=this.getCurrentMediaInfo_(n);if(!t){this.error({message:"No starting media returned, likely due to an unsupported media format.",blacklistDuration:Infinity});this.trigger("error");return}var u=t.hasAudio,f=t.hasVideo,e=t.isMuxed,i=this.loaderType_==="main"&&f,r=!this.audioDisabled_&&u&&!e;if(n.waitingOnAppends=0,!n.hasAppendedData_){n.timingInfo||typeof n.timestampOffset!="number"||(this.isPendingTimestampOffset_=!0);n.timingInfo={start:0};n.waitingOnAppends++;this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(n),this.processMetadataQueue_());this.checkAppendsDone_(n);return}i&&n.waitingOnAppends++;r&&n.waitingOnAppends++;i&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,n));r&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,n))},r.checkAppendsDone_=function(n){this.checkForAbort_(n.requestId)||(n.waitingOnAppends--,n.waitingOnAppends===0&&this.handleAppendsDone_())},r.checkForIllegalMediaSwitch=function(n){var t=fnt(this.loaderType_,this.getCurrentMediaInfo_(),n);return t?(this.error({message:t,blacklistDuration:Infinity}),this.trigger("error"),!0):!1},r.updateSourceBufferTimestampOffset_=function(n){if(n.timestampOffset!==null&&typeof n.timingInfo.start=="number"&&!n.changedTimestampOffset&&this.loaderType_==="main"){var t=!1;n.timestampOffset-=n.timingInfo.start;n.changedTimestampOffset=!0;n.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(n.timestampOffset),t=!0);n.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(n.timestampOffset),t=!0);t&&this.trigger("timestampoffset")}},r.updateTimingInfoEnd_=function(n){n.timingInfo=n.timingInfo||{};var i=this.getMediaInfo_(),r=this.loaderType_==="main"&&i&&i.hasVideo,t=r&&n.videoTimingInfo?n.videoTimingInfo:n.audioTimingInfo;t&&(n.timingInfo.end=typeof t.end=="number"?t.end:t.start+n.duration)},r.handleAppendsDone_=function(){var t,i,e;if(this.pendingSegment_&&this.trigger("appendsdone"),!this.pendingSegment_){this.state="READY";this.paused()||this.monitorBuffer_();return}if(t=this.pendingSegment_,this.updateTimingInfoEnd_(t),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:t,shouldSaveTimelineMapping:this.loaderType_==="main"}),i=hnt(t,this.sourceType_),i&&(i.severity==="warn"?n.log.warn(i.message):this.logger_(i.message)),this.recordThroughput_(t),this.pendingSegment_=null,this.state="READY",t.isSyncRequest&&(this.trigger("syncinfoupdate"),!t.hasAppendedData_)){this.logger_("Throwing away un-appended sync request "+te(t));return}this.logger_("Appended "+te(t));this.addSegmentMetadataCue_(t);this.fetchAtBuffer_=!0;this.currentTimeline_!==t.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:t.timeline}),this.loaderType_!=="main"||this.audioDisabled_||this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:t.timeline}));this.currentTimeline_=t.timeline;this.trigger("syncinfoupdate");var u=t.segment,r=t.part,f=u.end&&this.currentTime_()-u.end>t.playlist.targetDuration*3,o=r&&r.end&&this.currentTime_()-r.end>t.playlist.partTargetDuration*3;if(f||o){this.logger_("bad "+(f?"segment":"part")+" "+te(t));this.resetEverything();return}e=this.mediaIndex!==null;e&&this.trigger("bandwidthupdate");this.trigger("progress");this.mediaIndex=t.mediaIndex;this.partIndex=t.partIndex;this.isEndOfStream_(t.mediaIndex,t.playlist,t.partIndex)&&this.endOfStream();this.trigger("appended");t.hasAppendedData_&&this.mediaAppends++;this.paused()||this.monitorBuffer_()},r.recordThroughput_=function(n){if(n.duration<hl){this.logger_("Ignoring segment's throughput because its duration of "+n.duration+(" is less than the min to record "+hl));return}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},r.addSegmentMetadataCue_=function(n){if(this.segmentMetadataTrack_){var t=n.segment,i=t.start,r=t.end;if(pet(i)&&pet(r)){ns(i,r,this.segmentMetadataTrack_);var e=window.WebKitDataCue||window.VTTCue,u={custom:t.custom,dateTimeObject:t.dateTimeObject,dateTimeString:t.dateTimeString,bandwidth:n.playlist.attributes.BANDWIDTH,resolution:n.playlist.attributes.RESOLUTION,codecs:n.playlist.attributes.CODECS,byteLength:n.byteLength,uri:n.uri,timeline:n.timeline,playlist:n.playlist.id,start:i,end:r},o=JSON.stringify(u),f=new e(i,r,o);f.value=u;this.segmentMetadataTrack_.addCue(f)}}},u}(n.EventTarget);var det=function(n){return typeof n!="string"?n:n.replace(/./,function(n){return n.toUpperCase()})},cnt=["video","audio"],ib=function(n,t){var i=t[n+"Buffer"];return i&&i.updating||t.queuePending[n]},lnt=function(n,t){for(var r,i=0;i<t.length;i++){if(r=t[i],r.type==="mediaSource")return null;if(r.type===n)return i}return null},ie=function ie(n,t){if(t.queue.length!==0){var r=0,i=t.queue[r];if(i.type==="mediaSource"){t.updating()||t.mediaSource.readyState==="closed"||(t.queue.shift(),i.action(t),i.doneFn&&i.doneFn(),ie("audio",t),ie("video",t));return}if(n!=="mediaSource"&&t.ready()&&t.mediaSource.readyState!=="closed"&&!ib(n,t)){if(i.type!==n){if(r=lnt(n,t.queue),r===null)return;i=t.queue[r]}if(t.queue.splice(r,1),t.queuePending[n]=i,i.action(n,t),!i.doneFn){t.queuePending[n]=null;ie(n,t);return}}}},get=function(n,t){var i=t[n+"Buffer"],r=det(n);i&&(i.removeEventListener("updateend",t["on"+r+"UpdateEnd_"]),i.removeEventListener("error",t["on"+r+"Error_"]),t.codecs[n]=null,t[n+"Buffer"]=null)},wi=function(n,t){return n&&t&&Array.prototype.indexOf.call(n.sourceBuffers,t)!==-1},gt={appendBuffer:function(n,t,i){return function(r,u){var e=u[r+"Buffer"];if(wi(u.mediaSource,e)){u.logger_("Appending segment "+t.mediaIndex+"'s "+n.length+" bytes to "+r+"Buffer");try{e.appendBuffer(n)}catch(f){u.logger_("Error with code "+f.code+" "+(f.code===yet?"(QUOTA_EXCEEDED_ERR) ":"")+("when appending segment "+t.mediaIndex+" to "+r+"Buffer"));u.queuePending[r]=null;i(f)}}}},remove:function(n,t){return function(i,r){var u=r[i+"Buffer"];if(wi(r.mediaSource,u)){r.logger_("Removing "+n+" to "+t+" from "+i+"Buffer");try{u.remove(n,t)}catch(f){r.logger_("Remove "+n+" to "+t+" from "+i+"Buffer failed")}}}},timestampOffset:function(n){return function(t,i){var r=i[t+"Buffer"];wi(i.mediaSource,r)&&(i.logger_("Setting "+t+"timestampOffset to "+n),r.timestampOffset=n)}},callback:function(n){return function(){n()}},endOfStream:function(t){return function(i){if(i.mediaSource.readyState==="open"){i.logger_("Calling mediaSource endOfStream("+(t||"")+")");try{i.mediaSource.endOfStream(t)}catch(r){n.log.warn("Failed to call media source endOfStream",r)}}}},duration:function(t){return function(i){i.logger_("Setting mediaSource duration to "+t);try{i.mediaSource.duration=t}catch(r){n.log.warn("Failed to set media source duration",r)}}},abort:function(){return function(t,i){if(i.mediaSource.readyState==="open"){var r=i[t+"Buffer"];if(wi(i.mediaSource,r)){i.logger_("calling abort on "+t+"Buffer");try{r.abort()}catch(u){n.log.warn("Failed to abort on "+t+"Buffer",u)}}}}},addSourceBuffer:function(n,t){return function(i){var u=det(n),f=ro(t),r;i.logger_("Adding "+n+"Buffer with codec "+t+" to mediaSource");r=i.mediaSource.addSourceBuffer(f);r.addEventListener("updateend",i["on"+u+"UpdateEnd_"]);r.addEventListener("error",i["on"+u+"Error_"]);i.codecs[n]=t;i[n+"Buffer"]=r}},removeSourceBuffer:function(t){return function(i){var r=i[t+"Buffer"];if(get(t,i),wi(i.mediaSource,r)){i.logger_("Removing "+t+"Buffer with codec "+i.codecs[t]+" from mediaSource");try{i.mediaSource.removeSourceBuffer(r)}catch(u){n.log.warn("Failed to removeSourceBuffer "+t+"Buffer",u)}}}},changeType:function(n){return function(t,i){var r=i[t+"Buffer"],u=ro(n);wi(i.mediaSource,r)&&i.codecs[t]!==n&&(i.logger_("changing "+t+"Buffer codec from "+i.codecs[t]+" to "+n),r.changeType(u),i.codecs[t]=n)}}},ni=function(n){var t=n.type,i=n.sourceUpdater,r=n.action,u=n.doneFn,f=n.name;i.queue.push({type:t,action:r,doneFn:u,name:f});ie(t,i)},not=function(n,t){return function(){if(t.queuePending[n]){var i=t.queuePending[n].doneFn;t.queuePending[n]=null;i&&i(t[n+"Error_"])}ie(n,t)}},tot=function(t){function u(n){var i;return i=t.call(this)||this,i.mediaSource=n,i.sourceopenListener_=function(){return ie("mediaSource",f(i))},i.mediaSource.addEventListener("sourceopen",i.sourceopenListener_),i.logger_=si("SourceUpdater"),i.audioTimestampOffset_=0,i.videoTimestampOffset_=0,i.queue=[],i.queuePending={audio:null,video:null},i.delayedAudioAppendQueue_=[],i.videoAppendQueued_=!1,i.codecs={},i.onVideoUpdateEnd_=not("video",f(i)),i.onAudioUpdateEnd_=not("audio",f(i)),i.onVideoError_=function(n){i.videoError_=n},i.onAudioError_=function(n){i.audioError_=n},i.createdSourceBuffers_=!1,i.initializedEme_=!1,i.triggeredReady_=!1,i}i(u,t);var r=u.prototype;return r.initializedEme=function(){this.initializedEme_=!0;this.triggerReady()},r.hasCreatedSourceBuffers=function(){return this.createdSourceBuffers_},r.hasInitializedAnyEme=function(){return this.initializedEme_},r.ready=function(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()},r.createSourceBuffers=function(n){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(n),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())},r.triggerReady=function(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))},r.addSourceBuffer=function(n,t){ni({type:"mediaSource",sourceUpdater:this,action:gt.addSourceBuffer(n,t),name:"addSourceBuffer"})},r.abort=function(n){ni({type:n,sourceUpdater:this,action:gt.abort(n),name:"abort"})},r.removeSourceBuffer=function(t){if(!this.canRemoveSourceBuffer()){n.log.error("removeSourceBuffer is not supported!");return}ni({type:"mediaSource",sourceUpdater:this,action:gt.removeSourceBuffer(t),name:"removeSourceBuffer"})},r.canRemoveSourceBuffer=function(){return!n.browser.IE_VERSION&&!n.browser.IS_FIREFOX&&window.MediaSource&&window.MediaSource.prototype&&typeof window.MediaSource.prototype.removeSourceBuffer=="function"},u.canChangeType=function(){return window.SourceBuffer&&window.SourceBuffer.prototype&&typeof window.SourceBuffer.prototype.changeType=="function"},r.canChangeType=function(){return this.constructor.canChangeType()},r.changeType=function(t,i){if(!this.canChangeType()){n.log.error("changeType is not supported!");return}ni({type:t,sourceUpdater:this,action:gt.changeType(i),name:"changeType"})},r.addOrChangeSourceBuffers=function(n){var t=this;if(!n||typeof n!="object"||Object.keys(n).length===0)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(n).forEach(function(i){var r=n[i];if(!t.hasCreatedSourceBuffers())return t.addSourceBuffer(i,r);t.canChangeType()&&t.changeType(i,r)})},r.appendBuffer=function(n,t){var u=this,o=n.segmentInfo,i=n.type,f=n.bytes,e,r;if(this.processedAppend_=!0,i==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([n,t]);this.logger_("delayed audio append of "+f.length+" until video append");return}if(e=t,ni({type:i,sourceUpdater:this,action:gt.appendBuffer(f,o||{mediaIndex:-1},e),doneFn:t,name:"appendBuffer"}),i==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;r=this.delayedAudioAppendQueue_.slice();this.logger_("queuing delayed audio "+r.length+" appendBuffers");this.delayedAudioAppendQueue_.length=0;r.forEach(function(n){u.appendBuffer.apply(u,n)})}},r.audioBuffered=function(){return wi(this.mediaSource,this.audioBuffer)?this.audioBuffer.buffered?this.audioBuffer.buffered:n.createTimeRange():n.createTimeRange()},r.videoBuffered=function(){return wi(this.mediaSource,this.videoBuffer)?this.videoBuffer.buffered?this.videoBuffer.buffered:n.createTimeRange():n.createTimeRange()},r.buffered=function(){var n=wi(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=wi(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!n?this.audioBuffered():n&&!t?this.videoBuffered():hbt(this.audioBuffered(),this.videoBuffered())},r.setDuration=function(n,t){t===void 0&&(t=er);ni({type:"mediaSource",sourceUpdater:this,action:gt.duration(n),name:"duration",doneFn:t})},r.endOfStream=function(n,t){n===void 0&&(n=null);t===void 0&&(t=er);typeof n!="string"&&(n=undefined);ni({type:"mediaSource",sourceUpdater:this,action:gt.endOfStream(n),name:"endOfStream",doneFn:t})},r.removeAudio=function(n,t,i){if(i===void 0&&(i=er),!this.audioBuffered().length||this.audioBuffered().end(0)===0){i();return}ni({type:"audio",sourceUpdater:this,action:gt.remove(n,t),doneFn:i,name:"remove"})},r.removeVideo=function(n,t,i){if(i===void 0&&(i=er),!this.videoBuffered().length||this.videoBuffered().end(0)===0){i();return}ni({type:"video",sourceUpdater:this,action:gt.remove(n,t),doneFn:i,name:"remove"})},r.updating=function(){return ib("audio",this)||ib("video",this)?!0:!1},r.audioTimestampOffset=function(n){return typeof n!="undefined"&&this.audioBuffer&&this.audioTimestampOffset_!==n&&(ni({type:"audio",sourceUpdater:this,action:gt.timestampOffset(n),name:"timestampOffset"}),this.audioTimestampOffset_=n),this.audioTimestampOffset_},r.videoTimestampOffset=function(n){return typeof n!="undefined"&&this.videoBuffer&&this.videoTimestampOffset!==n&&(ni({type:"video",sourceUpdater:this,action:gt.timestampOffset(n),name:"timestampOffset"}),this.videoTimestampOffset_=n),this.videoTimestampOffset_},r.audioQueueCallback=function(n){this.audioBuffer&&ni({type:"audio",sourceUpdater:this,action:gt.callback(n),name:"callback"})},r.videoQueueCallback=function(n){this.videoBuffer&&ni({type:"video",sourceUpdater:this,action:gt.callback(n),name:"callback"})},r.dispose=function(){var n=this;this.trigger("dispose");cnt.forEach(function(t){n.abort(t);n.canRemoveSourceBuffer()?n.removeSourceBuffer(t):n[t+"QueueCallback"](function(){return get(t,n)})});this.videoAppendQueued_=!1;this.delayedAudioAppendQueue_.length=0;this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_);this.off()},u}(n.EventTarget),iot=function(n){return decodeURIComponent(escape(String.fromCharCode.apply(null,n)))},rot=new Uint8Array("\n\n".split("").map(function(n){return n.charCodeAt(0)})),ant=function(t){function u(n,i){var r;return i===void 0&&(i={}),r=t.call(this,n,i)||this,r.mediaSource_=null,r.subtitlesTrack_=null,r.loaderType_="subtitle",r.featuresNativeTextTracks_=n.featuresNativeTextTracks,r.shouldSaveSegmentTimingInfo_=!1,r}i(u,t);var r=u.prototype;return r.createTransmuxer_=function(){return null},r.buffered_=function(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return n.createTimeRanges();var t=this.subtitlesTrack_.cues,i=t[0].startTime,r=t[t.length-1].startTime;return n.createTimeRanges([[i,r]])},r.initSegmentForMap=function(n,t){var u,i,f,r;return(t===void 0&&(t=!1),!n)?null:(u=ul(n),i=this.initSegments_[u],t&&!i&&n.bytes&&(f=rot.byteLength+n.bytes.byteLength,r=new Uint8Array(f),r.set(n.bytes),r.set(rot,n.bytes.byteLength),this.initSegments_[u]=i={resolvedUri:n.resolvedUri,byterange:n.byterange,bytes:r}),i||n)},r.couldBeginLoading_=function(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()},r.init_=function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()},r.track=function(n){return typeof n=="undefined"?this.subtitlesTrack_:(this.subtitlesTrack_=n,this.state==="INIT"&&this.couldBeginLoading_()&&this.init_(),this.subtitlesTrack_)},r.remove=function(n,t){ns(n,t,this.subtitlesTrack_)},r.fillBuffer_=function(){var n=this,t=this.chooseNextRequest_(),i;if(t){if(this.syncController_.timestampOffsetForTimeline(t.timeline)===null){i=function(){n.state="READY";n.paused()||n.monitorBuffer_()};this.syncController_.one("timestampoffset",i);this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(t)}},r.timestampOffsetForSegment_=function(){return null},r.chooseNextRequest_=function(){return this.skipEmptySegments_(t.prototype.chooseNextRequest_.call(this))},r.skipEmptySegments_=function(n){while(n&&n.segment.empty){if(n.mediaIndex+1>=n.playlist.segments.length){n=null;break}n=this.generateSegmentInfo_({playlist:n.playlist,mediaIndex:n.mediaIndex+1,startOfSegment:n.startOfSegment+n.duration,isSyncRequest:n.isSyncRequest})}return n},r.stopForError=function(n){this.error(n);this.state="READY";this.pause();this.trigger("error")},r.segmentRequestFinished_=function(n,t,i){var u=this,r,f,e,o;if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_){this.state="READY";this.mediaRequestsAborted+=1;return}if(n){n.code===pi.TIMEOUT&&this.handleTimeout_();n.code===pi.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1;this.stopForError(n);return}if(r=this.pendingSegment_,this.saveBandwidthRelatedStats_(r.duration,t.stats),this.state="APPENDING",this.trigger("appending"),f=r.segment,f.map&&(f.map.bytes=t.map.bytes),r.bytes=t.bytes,typeof WebVTT!="function"&&this.subtitlesTrack_&&this.subtitlesTrack_.tech_){o=function(){u.subtitlesTrack_.tech_.off("vttjsloaded",e);u.stopForError({message:"Error loading vtt.js"});return};e=function(){u.subtitlesTrack_.tech_.off("vttjserror",o);u.segmentRequestFinished_(n,t,i)};this.state="WAITING_ON_VTTJS";this.subtitlesTrack_.tech_.one("vttjsloaded",e);this.subtitlesTrack_.tech_.one("vttjserror",o);return}f.requested=!0;try{this.parseVTTCues_(r)}catch(s){this.stopForError({message:s.message});return}if(this.updateTimeMapping_(r,this.syncController_.timelines[r.timeline],this.playlist_),r.timingInfo=r.cues.length?{start:r.cues[0].startTime,end:r.cues[r.cues.length-1].endTime}:{start:r.startOfSegment,end:r.startOfSegment+r.duration},r.isSyncRequest){this.trigger("syncinfoupdate");this.pendingSegment_=null;this.state="READY";return}r.byteLength=r.bytes.byteLength;this.mediaSecondsLoaded+=f.duration;r.cues.forEach(function(n){u.subtitlesTrack_.addCue(u.featuresNativeTextTracks_?new window.VTTCue(n.startTime,n.endTime,n.text):n)});dgt(this.subtitlesTrack_);this.handleAppendsDone_()},r.handleData_=function(){},r.updateTimingInfoEnd_=function(){},r.parseVTTCues_=function(t){var f,e=!1,i,r,u;typeof TextDecoder=="function"?f=new window.TextDecoder("utf8"):(f=window.WebVTT.StringDecoder(),e=!0);i=new window.WebVTT.Parser(window,window.vttjs,f);t.cues=[];t.timestampmap={MPEGTS:0,LOCAL:0};i.oncue=t.cues.push.bind(t.cues);i.ontimestampmap=function(n){t.timestampmap=n};i.onparsingerror=function(t){n.log.warn("Error encountered when parsing cues: "+t.message)};t.segment.map&&(r=t.segment.map.bytes,e&&(r=iot(r)),i.parse(r));u=t.bytes;e&&(u=iot(u));i.parse(u);i.flush()},r.updateTimeMapping_=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/gc-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)})}},u}(tb),vnt=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},ynt=function(n,t,i){var u,r,e,f;if(i===void 0&&(i=0),n.segments)for(u=i,e=0;e<n.segments.length;e++){if(f=n.segments[e],r||(r=vnt(t,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 window.VTTCue(u,u+f.duration,f.cueOut),r.adStartTime=u,r.adEndTime=u+parseFloat(f.cueOut),t.addCue(r)),"cueOutCont"in f){var o=f.cueOutCont.split("/").map(parseFloat),s=o[0],h=o[1];r=new window.VTTCue(u,u+f.duration,"");r.adStartTime=u-s;r.adEndTime=r.adStartTime+h;t.addCue(r)}u+=f.duration}},pnt=86400,uot=[{name:"VOD",run:function(n,t,i){return i!==Infinity?{time:0,segmentIndex:0,partIndex:null}:null}},{name:"ProgramDateTime",run:function(n,t,i,r,u){var f,p,s,h,c;if(!Object.keys(n.timelineToDatetimeMappings).length)return null;var v=null,l=null,a=ow(t);for(u=u||0,f=0;f<a.length;f++){var w=t.endList||u===0?f:a.length-(f+1),e=a[w],o=e.segment,y=n.timelineToDatetimeMappings[o.timeline];if(y&&o.dateTimeObject){if(p=o.dateTimeObject.getTime()/1e3,s=p+y,o.parts&&typeof e.partIndex=="number")for(h=0;h<e.partIndex;h++)s+=o.parts[h].duration;if(c=Math.abs(u-s),l!==null&&(c===0||l<c))break;l=c;v={time:s,segmentIndex:e.segmentIndex,partIndex:e.partIndex}}}return v}},{name:"Segment",run:function(n,t,i,r,u){var c=null,f=null,s,e,h;for(u=u||0,s=ow(t),e=0;e<s.length;e++){var v=t.endList||u===0?e:s.length-(e+1),o=s[v],l=o.segment,a=o.part&&o.part.start||l&&l.start;if(l.timeline===r&&typeof a!="undefined"){if(h=Math.abs(u-a),f!==null&&f<h)break;(!c||f===null||f>=h)&&(f=h,c={time:a,segmentIndex:o.segmentIndex,partIndex:o.partIndex})}}return c}},{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,partIndex:null})}}return s}},{name:"Playlist",run:function(n,t){return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}}],wnt=function(t){function u(){var n;return n=t.call(this)||this,n.timelines=[],n.discontinuities=[],n.timelineToDatetimeMappings={},n.logger_=si("SyncController"),n}i(u,t);var r=u.prototype;return r.getSyncPoint=function(n,t,i,r){var u=this.runStrategies_(n,t,i,r);return u.length?this.selectSyncPoint_(u,{key:"time",value:r}):null},r.getExpiredTime=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+wo({defaultDuration:n.targetDuration,durationList:n.segments,startIndex:i.segmentIndex,endIndex:0})))},r.runStrategies_=function(n,t,i,r){for(var u,f,o=[],e=0;e<uot.length;e++)u=uot[e],f=u.run(this,n,t,i,r),f&&(f.strategy=u.name,o.push({strategy:u.name,syncPoint:f}));return o},r.selectSyncPoint_=function(n,t){for(var u,i=n[0].syncPoint,f=Math.abs(n[0].syncPoint[t.key]-t.value),e=n[0].strategy,r=1;r<n.length;r++)u=Math.abs(n[r].syncPoint[t.key]-t.value),u<f&&(f=u,i=n[r].syncPoint,e=n[r].strategy);return this.logger_("syncPoint for ["+t.key+": "+t.value+"] chosen with strategy"+(" ["+e+"]: [time:"+i.time+",")+(" segmentIndex:"+i.segmentIndex)+(typeof i.partIndex=="number"?",partIndex:"+i.partIndex:"")+"]"),i},r.saveExpiredSegmentInfo=function(t,i){var f=i.mediaSequence-t.mediaSequence,r,u;if(f>pnt){n.log.warn("Not saving expired segment info. Media sequence gap "+f+" is too large.");return}for(r=f-1;r>=0;r--)if(u=t.segments[r],u&&typeof u.start!="undefined"){i.syncInfo={mediaSequence:t.mediaSequence+r,time:u.start};this.logger_("playlist refresh sync: [time:"+i.syncInfo.time+","+(" mediaSequence: "+i.syncInfo.mediaSequence+"]"));this.trigger("syncinfoupdate");break}},r.setDateTimeMappingForStart=function(n){if(this.timelineToDatetimeMappings={},n.segments&&n.segments.length&&n.segments[0].dateTimeObject){var t=n.segments[0],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}},r.saveSegmentTimingInfo=function(n){var t=n.segmentInfo,u=n.shouldSaveTimelineMapping,f=this.calculateSegmentTimeMapping_(t,t.timingInfo,u),i=t.segment,r;f&&(this.saveDiscontinuitySyncInfo_(t),t.playlist.syncInfo||(t.playlist.syncInfo={mediaSequence:t.playlist.mediaSequence+t.mediaIndex,time:i.start}));r=i.dateTimeObject;i.discontinuity&&u&&r&&(this.timelineToDatetimeMappings[i.timeline]=-(r.getTime()/1e3))},r.timestampOffsetForTimeline=function(n){return typeof this.timelines[n]=="undefined"?null:this.timelines[n].time},r.mappingForTimeline=function(n){return typeof this.timelines[n]=="undefined"?null:this.timelines[n].mapping},r.calculateSegmentTimeMapping_=function(n,t,i){var f=n.segment,o=n.part,r=this.timelines[n.timeline],u,e;if(typeof n.timestampOffset=="number")r={time:n.startOfSegment,mapping:n.startOfSegment-t.start},i&&(this.timelines[n.timeline]=r,this.trigger("timestampoffset"),this.logger_("time mapping for timeline "+n.timeline+": "+("[time: "+r.time+"] [mapping: "+r.mapping+"]"))),u=n.startOfSegment,e=t.end+r.mapping;else if(r)u=t.start+r.mapping,e=t.end+r.mapping;else return!1;return o&&(o.start=u,o.end=e),(!f.start||u<f.start)&&(f.start=u),f.end=e,!0},r.saveDiscontinuitySyncInfo_=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-wo({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:n.mediaIndex,endIndex:u}):i.end+wo({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:n.mediaIndex+1,endIndex:u}),this.discontinuities[f]={time:e,accuracy:s})}},r.dispose=function(){this.trigger("dispose");this.off()},u}(n.EventTarget),bnt=function(n){function r(){var t;return t=n.call(this)||this,t.pendingTimelineChanges_={},t.lastTimelineChanges_={},t}i(r,n);var t=r.prototype;return t.clearPendingTimelineChange=function(n){this.pendingTimelineChanges_[n]=null;this.trigger("pendingtimelinechange")},t.pendingTimelineChange=function(n){var t=n.type,i=n.from,r=n.to;return typeof i=="number"&&typeof r=="number"&&(this.pendingTimelineChanges_[t]={type:t,from:i,to:r},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[t]},t.lastTimelineChange=function(n){var t=n.type,i=n.from,r=n.to;return typeof i=="number"&&typeof r=="number"&&(this.lastTimelineChanges_[t]={type:t,from:i,to:r},delete this.pendingTimelineChanges_[t],this.trigger("timelinechange")),this.lastTimelineChanges_[t]},t.dispose=function(){this.trigger("dispose");this.pendingTimelineChanges_={};this.lastTimelineChanges_={};this.off()},r}(n.EventTarget),knt=kft(dft(function(){function i(n,t,i){return i={path:t,exports:{},require:function(n,t){return u(n,t===undefined||t===null?i.path:t)}},n(i,i.exports),i.exports}function u(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs");}function s(n){return n.subarray(0,n.byteLength-n[n.byteLength-1])}var f=i(function(n){function t(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)}function i(n,i,r){return i&&t(n.prototype,i),r&&t(n,r),n}n.exports=i;n.exports["default"]=n.exports;n.exports.__esModule=!0}),e=i(function(n){function t(i,r){return n.exports=t=Object.setPrototypeOf||function(n,t){return n.__proto__=t,n},n.exports["default"]=n.exports,n.exports.__esModule=!0,t(i,r)}n.exports=t;n.exports["default"]=n.exports;n.exports.__esModule=!0}),o=i(function(n){function t(n,t){n.prototype=Object.create(t.prototype);n.prototype.constructor=n;e(n,t)}n.exports=t;n.exports["default"]=n.exports;n.exports.__esModule=!0}),r=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]=this.listeners[n].slice(0),this.listeners[n].splice(i,1),i>-1},n.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.dispose=function(){this.listeners={}},n.pipe=function(n){this.on("data",function(t){n.push(t)})},t}(),h=function(){for(var h=[[[],[],[],[],[]],[[],[],[],[],[]]],f=h[0],e=h[1],l=f[4],p=e[4],i,r,u=[],a=[],c,v,y,t,o,s,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},n=null,c=function(){function t(t){var e,l;n||(n=h());this._tables=[[n[0][0].slice(),n[0][1].slice(),n[0][2].slice(),n[0][3].slice(),n[0][4].slice()],[n[1][0].slice(),n[1][1].slice(),n[1][2].slice(),n[1][3].slice(),n[1][4].slice()]];var r,o,i,f=this._tables[0][4],s=this._tables[1],u=t.length,c=1;if(u!==4&&u!==6&&u!==8)throw new Error("Invalid aes key size");for(e=t.slice(0),l=[],this._key=[e,l],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^c<<24,c=c<<1^(c>>7)*283)),e[r]=e[r-u]^i;for(o=0;r;o++,r--)i=e[o&3?r:r-4],l[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]]}var i=t.prototype;return i.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,g,nt,tt=e.length/4-2,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},t}(),l=function(n){function t(){var t;return t=n.call(this,r)||this,t.jobs=[],t.delay=1,t.timeout_=null,t}o(t,n);var i=t.prototype;return i.processJob_=function(){this.jobs.shift()();this.timeout_=this.jobs.length?setTimeout(this.processJob_.bind(this),this.delay):null},i.push=function(n){this.jobs.push(n);this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},t}(r),t=function(n){return n<<24|(n&65280)<<8|(n&16711680)>>8|n>>>24},a=function(n,i,r){var e=new Int32Array(n.buffer,n.byteOffset,n.byteLength>>2),b=new c(Array.prototype.slice.call(i)),w=new Uint8Array(n.byteLength),f=new Int32Array(w.buffer),o,s,h,l,a,v,y,p,u;for(o=r[0],s=r[1],h=r[2],l=r[3],u=0;u<e.length;u+=4)a=t(e[u]),v=t(e[u+1]),y=t(e[u+2]),p=t(e[u+3]),b.decrypt(a,v,y,p,f,u),f[u]=t(f[u]^o),f[u+1]=t(f[u+1]^s),f[u+2]=t(f[u+2]^h),f[u+3]=t(f[u+3]^l),o=a,s=v,h=y,l=p;return w},v=function(){function n(i,r,u,f){var h=n.STEP,o=new Int32Array(i.buffer),c=new Uint8Array(i.byteLength),e=0;for(this.asyncStream_=new l,this.asyncStream_.push(this.decryptChunk_(o.subarray(e,e+h),r,u,c)),e=h;e<o.length;e+=h)u=new Uint32Array([t(o[e-4]),t(o[e-3]),t(o[e-2]),t(o[e-1])]),this.asyncStream_.push(this.decryptChunk_(o.subarray(e,e+h),r,u,c));this.asyncStream_.push(function(){f(null,s(c))})}var i=n.prototype;return i.decryptChunk_=function(n,t,i,r){return function(){var u=a(n,t,i);r.set(u,n.byteOffset)}},f(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};self.onmessage=function(n){var t=n.data,i=new Uint8Array(t.encrypted.bytes,t.encrypted.byteOffset,t.encrypted.byteLength),r=new Uint32Array(t.key.bytes,t.key.byteOffset,t.key.byteLength/4),u=new Uint32Array(t.iv.bytes,t.iv.byteOffset,t.iv.byteLength/4);new v(i,r,u,function(n,i){self.postMessage(y({source:t.source,decrypted:i}),[i.buffer])})}})),dnt=bft(knt),gnt=function(n){var t=n["default"]?"main":"alternative";return n.characteristics&&n.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},cl=function(n,t){n.abort();n.pause();t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},rb=function(n,t){t.activePlaylistLoader=n;n.load()},nti=function(n,t){return function(){var u=t.segmentLoaders,f=u[n],o=u.main,i=t.mediaTypes[n],s=i.activeTrack(),r=i.getActiveGroup(),h=i.activePlaylistLoader,e=i.lastGroup_;if((!r||!e||r.id!==e.id)&&(i.lastGroup_=r,i.lastTrack_=s,cl(f,i),r&&!r.isMasterPlaylist)){if(!r.playlistLoader){h&&o.resetEverything();return}f.resyncLoader();rb(r.playlistLoader,i)}}},tti=function(n,t){return function(){var i=t.segmentLoaders[n],r=t.mediaTypes[n];r.lastGroup_=null;i.abort();i.pause()}},iti=function(n,t){return function(){var l=t.masterPlaylistLoader,c=t.segmentLoaders,f=c[n],o=c.main,i=t.mediaTypes[n],r=i.activeTrack(),u=i.getActiveGroup(),a=i.activePlaylistLoader,e=i.lastTrack_,s,h;if((!e||!r||e.id!==r.id)&&(i.lastGroup_=u,i.lastTrack_=r,cl(f,i),u)){if(u.isMasterPlaylist){if(!r||!e||r.id===e.id)return;if(s=t.vhs.masterPlaylistController_,h=s.selectPlaylist(),s.media()===h)return;i.logger_("track change. Switching master audio from "+e.id+" to "+r.id);l.pause();o.resetEverything();s.fastQualityChange_(h);return}if(n==="AUDIO"){if(!u.playlistLoader){o.setAudio(!0);o.resetEverything();return}f.setAudio(!0);o.setAudio(!1)}if(a===u.playlistLoader){rb(u.playlistLoader,i);return}f.track&&f.track(r);f.resetEverything();rb(u.playlistLoader,i)}}},ll={AUDIO:function(t,i){return function(){var o=i.segmentLoaders[t],r=i.mediaTypes[t],s=i.blacklistCurrentPlaylist,u;cl(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}n.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(t,i){return function(){var f=i.segmentLoaders[t],r=i.mediaTypes[t],u;n.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");cl(f,r);u=r.activeTrack();u&&(u.mode="disabled");r.onTrackChanged()}}},fot={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",ll[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",ll[n](n,i))}},rti={AUDIO:function(t,i){var s=i.vhs,v=i.sourceType,b=i.segmentLoaders[t],h=i.requestOptions,f=i.master.mediaGroups,c=i.mediaTypes[t],l=c.groups,y=c.tracks,k=c.logger_,a=i.masterPlaylistLoader,p=bo(a.master),e,u,r,o,w;f[t]&&Object.keys(f[t]).length!==0||(f[t]={main:{"default":{"default":!0}}},p&&(f[t].main["default"].playlists=a.master.playlists));for(e in f[t]){l[e]||(l[e]=[]);for(u in f[t][e])r=f[t][e][u],o=void 0,p?(k("AUDIO group '"+e+"' label '"+u+"' is a master playlist"),r.isMasterPlaylist=!0,o=null):o=v==="vhs-json"&&r.playlists?new gf(r.playlists[0],s,h):r.resolvedUri?new gf(r.resolvedUri,s,h):r.playlists&&v==="dash"?new bw(r.playlists[0],s,h,a):null,r=n.mergeOptions({id:u,playlistLoader:o},r),fot[t](t,r.playlistLoader,i),l[e].push(r),typeof y[u]=="undefined"&&(w=new n.AudioTrack({id:u,kind:gnt(r),enabled:!1,language:r.language,"default":r["default"],label:u}),y[u]=w)}b.on("error",ll[t](t,i))},SUBTITLES:function(t,i){var w=i.tech,s=i.vhs,h=i.sourceType,b=i.segmentLoaders[t],c=i.requestOptions,o=i.master.mediaGroups,a=i.mediaTypes[t],l=a.groups,v=a.tracks,k=i.masterPlaylistLoader,f,u,r,e,y,p;for(f in o[t]){l[f]||(l[f]=[]);for(u in o[t][f])if(!o[t][f][u].forced){if(r=o[t][f][u],e=void 0,h==="hls")e=new gf(r.resolvedUri,s,c);else if(h==="dash"){if(y=r.playlists.filter(function(n){return n.excludeUntil!==Infinity}),!y.length)return;e=new bw(r.playlists[0],s,c,k)}else h==="vhs-json"&&(e=new gf(r.playlists?r.playlists[0]:r.resolvedUri,s,c));r=n.mergeOptions({id:u,playlistLoader:e},r);fot[t](t,r.playlistLoader,i);l[f].push(r);typeof v[u]=="undefined"&&(p=w.addRemoteTextTrack({id:u,kind:"subtitles","default":r["default"]&&r.autoselect,language:r.language,label:u},!1).track,v[u]=p)}}b.on("error",ll[t](t,i))},"CLOSED-CAPTIONS":function(t,i){var o=i.tech,s=i.master.mediaGroups,l=i.mediaTypes[t],h=l.groups,a=l.tracks,f,e,u,c,r,v;for(f in s[t]){h[f]||(h[f]=[]);for(e in s[t][f])(u=s[t][f][e],/^(?:CC|SERVICE)/.test(u.instreamId))&&(c=o.options_.vhs&&o.options_.vhs.captionServices||{},r={label:e,language:u.language,instreamId:u.instreamId,"default":u["default"]&&u.autoselect},c[r.instreamId]&&(r=n.mergeOptions(r,c[r.instreamId])),r["default"]===undefined&&delete r["default"],h[f].push(n.mergeOptions({id:e},u)),typeof a[e]=="undefined"&&(v=o.addRemoteTextTrack({id:r.instreamId,kind:"captions","default":r["default"],language:r.language,label:r.label},!1).track,a[e]=v))}}},eot=function eot(n,t){for(var i=0;i<n.length;i++)if(cw(t,n[i])||n[i].playlists&&eot(n[i].playlists,t))return!0;return!1},uti=function(n,t){return function(i){var h=t.masterPlaylistLoader,u=t.mediaTypes[n].groups,e=h.media(),r,f,o,s;if(!e)return null;if(r=null,e.attributes[n]&&(r=u[e.attributes[n]]),f=Object.keys(u),!r)if(n==="AUDIO"&&f.length>1&&bo(t.master)){for(o=0;o<f.length;o++)if(s=u[f[o]],eot(s,e)){r=s;break}}else u.main?r=u.main:f.length===1&&(r=u[f[0]]);return typeof i=="undefined"?r:i===null||!r?null:r.filter(function(n){return n.id===i.id})[0]||null}},fti={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"||i[r].mode==="hidden")return i[r];return null}}},eti=function(n,t){var i=t.mediaTypes;return function(){var t=i[n].activeTrack();return t?i[n].activeGroup(t):null}},oti=function(n){var r,s,h,u,c;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(t){rti[t](t,n)});var t=n.mediaTypes,f=n.masterPlaylistLoader,i=n.tech,l=n.vhs,e=n.segmentLoaders,a=e.AUDIO,o=e.main;["AUDIO","SUBTITLES"].forEach(function(i){t[i].activeGroup=uti(i,n);t[i].activeTrack=fti[i](i,n);t[i].onGroupChanged=nti(i,n);t[i].onGroupChanging=tti(i,n);t[i].onTrackChanged=iti(i,n);t[i].getActiveGroup=eti(i,n)});r=t.AUDIO.activeGroup();r&&(s=(r.filter(function(n){return n["default"]})[0]||r[0]).id,t.AUDIO.tracks[s].enabled=!0,t.AUDIO.onGroupChanged(),t.AUDIO.onTrackChanged(),h=t.AUDIO.getActiveGroup(),h.playlistLoader?(o.setAudio(!1),a.setAudio(!0)):o.setAudio(!0));f.on("mediachange",function(){["AUDIO","SUBTITLES"].forEach(function(n){return t[n].onGroupChanged()})});f.on("mediachanging",function(){["AUDIO","SUBTITLES"].forEach(function(n){return t[n].onGroupChanging()})});u=function(){t.AUDIO.onTrackChanged();i.trigger({type:"usage",name:"vhs-audio-change"});i.trigger({type:"usage",name:"hls-audio-change"})};i.audioTracks().addEventListener("change",u);i.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged);l.on("dispose",function(){i.audioTracks().removeEventListener("change",u);i.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)});i.clearTracks("audio");for(c in t.AUDIO.tracks)i.audioTracks().addTrack(t.AUDIO.tracks[c])},sti=function(){var n={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(t){n[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:er,activeTrack:er,getActiveGroup:er,onGroupChanged:er,onTrackChanged:er,lastTrack_:null,logger_:si("MediaGroups["+t+"]")}}),n},hti=120,or,cti=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],lti=function(n){return this.audioSegmentLoader_[n]+this.mainSegmentLoader_[n]},ati=function(t){var r=t.currentPlaylist,v=t.buffered,y=t.currentTime,h=t.nextPlaylist,p=t.bufferLowWaterLine,w=t.bufferHighWaterLine,b=t.duration,f=t.experimentalBufferBasedABR,u=t.log,i,k,e,c,o,s,l,a;return h?(i="allowing switch "+(r&&r.id||"null")+" -> "+h.id,!r)?(u(i+" as current playlist is not set"),!0):h.id===r.id?!1:(k=Boolean(df(v,y).length),!r.endList)?!k&&typeof r.partTargetDuration=="number"?(u("not "+i+" as current playlist is live llhls, but currentTime isn't in buffered."),!1):(u(i+" as current playlist is live"),!0):(e=fw(v,y),c=f?g.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:g.MAX_BUFFER_LOW_WATER_LINE,b<c)?(u(i+" as duration < max low water line ("+b+" < "+c+")"),!0):(o=h.attributes.BANDWIDTH,s=r.attributes.BANDWIDTH,o<s&&(!f||e<w))?(l=i+" as next bandwidth < current bandwidth ("+o+" < "+s+")",f&&(l+=" and forwardBuffer < bufferHighWaterLine ("+e+" < "+w+")"),u(l),!0):(!f||o>s)&&e>=p?(a=i+" as forwardBuffer >= bufferLowWaterLine ("+e+" >= "+p+")",f&&(a+=" and next bandwidth > current bandwidth ("+o+" > "+s+")"),u(a),!0):(u("not "+i+" as no switching criteria met"),!1):(n.log.warn("We received no playlist to switch to. Please check your stream."),!1)},vti=function(t){function u(i){var r,u,e,c;r=t.call(this)||this;var o=i.src,l=i.handleManifestRedirects,h=i.withCredentials,s=i.tech,a=i.bandwidth,v=i.externVhs,y=i.useCueTags,p=i.blacklistDuration,w=i.enableLowInitialPlaylist,b=i.sourceType,k=i.cacheEncryptionKeys,d=i.experimentalBufferBasedABR,g=i.experimentalLeastPixelDiffSelector,nt=i.captionServices;if(!o)throw new Error("A non-empty playlist URL or JSON manifest string is required");u=i.maxPlaylistRetries;(u===null||typeof u=="undefined")&&(u=Infinity);or=v;r.experimentalBufferBasedABR=Boolean(d);r.experimentalLeastPixelDiffSelector=Boolean(g);r.withCredentials=h;r.tech_=s;r.vhs_=s.vhs;r.sourceType_=b;r.useCueTags_=y;r.blacklistDuration=p;r.maxPlaylistRetries=u;r.enableLowInitialPlaylist=w;r.useCueTags_&&(r.cueTagsTrack_=r.tech_.addTextTrack("metadata","ad-cues"),r.cueTagsTrack_.inBandMetadataTrackDispatchType="");r.requestOptions_={withCredentials:h,handleManifestRedirects:l,maxPlaylistRetries:u,timeout:null};r.on("error",r.pauseLoading);if(r.mediaTypes_=sti(),r.mediaSource=new window.MediaSource,r.handleDurationChange_=r.handleDurationChange_.bind(f(r)),r.handleSourceOpen_=r.handleSourceOpen_.bind(f(r)),r.handleSourceEnded_=r.handleSourceEnded_.bind(f(r)),r.mediaSource.addEventListener("durationchange",r.handleDurationChange_),r.mediaSource.addEventListener("sourceopen",r.handleSourceOpen_),r.mediaSource.addEventListener("sourceended",r.handleSourceEnded_),r.seekable_=n.createTimeRanges(),r.hasPlayed_=!1,r.syncController_=new wnt(i),r.segmentMetadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,r.decrypter_=new dnt,r.sourceUpdater_=new tot(r.mediaSource),r.inbandTextTracks_={},r.timelineChangeController_=new bnt,e={vhs:r.vhs_,parse708captions:i.parse708captions,captionServices:nt,mediaSource:r.mediaSource,currentTime:r.tech_.currentTime.bind(r.tech_),seekable:function(){return r.seekable()},seeking:function(){return r.tech_.seeking()},duration:function(){return r.duration()},hasPlayed:function(){return r.hasPlayed_},goalBufferLength:function(){return r.goalBufferLength()},bandwidth:a,syncController:r.syncController_,decrypter:r.decrypter_,sourceType:r.sourceType_,inbandTextTracks:r.inbandTextTracks_,cacheEncryptionKeys:k,sourceUpdater:r.sourceUpdater_,timelineChangeController:r.timelineChangeController_,experimentalExactManifestTimings:i.experimentalExactManifestTimings},r.masterPlaylistLoader_=r.sourceType_==="dash"?new bw(o,r.vhs_,r.requestOptions_):new gf(o,r.vhs_,r.requestOptions_),r.setupMasterPlaylistLoaderListeners_(),r.mainSegmentLoader_=new tb(n.mergeOptions(e,{segmentMetadataTrack:r.segmentMetadataTrack_,loaderType:"main"}),i),r.audioSegmentLoader_=new tb(n.mergeOptions(e,{loaderType:"audio"}),i),r.subtitleSegmentLoader_=new ant(n.mergeOptions(e,{loaderType:"vtt",featuresNativeTextTracks:r.tech_.featuresNativeTextTracks}),i),r.setupSegmentLoaderListeners_(),r.experimentalBufferBasedABR){r.masterPlaylistLoader_.one("loadedplaylist",function(){return r.startABRTimer_()});r.tech_.on("pause",function(){return r.stopABRTimer_()});r.tech_.on("play",function(){return r.startABRTimer_()})}if(cti.forEach(function(n){r[n+"_"]=lti.bind(f(r),n)}),r.logger_=si("MPC"),r.triggeredFmp4Usage=!1,r.tech_.preload()==="none"){r.loadOnPlay_=function(){r.loadOnPlay_=null;r.masterPlaylistLoader_.load()};r.tech_.one("play",r.loadOnPlay_)}else r.masterPlaylistLoader_.load();r.timeToLoadedData__=-1;r.mainAppendsToLoadedData__=-1;r.audioAppendsToLoadedData__=-1;c=r.tech_.preload()==="none"?"play":"loadstart";r.tech_.one(c,function(){var n=Date.now();r.tech_.one("loadeddata",function(){r.timeToLoadedData__=Date.now()-n;r.mainAppendsToLoadedData__=r.mainSegmentLoader_.mediaAppends;r.audioAppendsToLoadedData__=r.audioSegmentLoader_.mediaAppends})});return r}i(u,t);var r=u.prototype;return r.mainAppendsToLoadedData_=function(){return this.mainAppendsToLoadedData__},r.audioAppendsToLoadedData_=function(){return this.audioAppendsToLoadedData__},r.appendsToLoadedData_=function(){var n=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return n===-1||t===-1?-1:n+t},r.timeToLoadedData_=function(){return this.timeToLoadedData__},r.checkABR_=function(){var n=this.selectPlaylist();n&&this.shouldSwitchToMedia_(n)&&this.switchMedia_(n,"abr")},r.switchMedia_=function(n,t,i){var r=this.media(),u=r&&(r.id||r.uri),f=n.id||n.uri;u&&u!==f&&(this.logger_("switch media "+u+" -> "+f+" from "+t),this.tech_.trigger({type:"usage",name:"vhs-rendition-change-"+t}));this.masterPlaylistLoader_.media(n,i)},r.startABRTimer_=function(){var n=this;this.stopABRTimer_();this.abrTimer_=window.setInterval(function(){return n.checkABR_()},250)},r.stopABRTimer_=function(){this.tech_.scrubbing&&this.tech_.scrubbing()||(window.clearInterval(this.abrTimer_),this.abrTimer_=null)},r.getAudioTrackPlaylists_=function(){var n=this.master(),s=n&&n.playlists||[],t,h,u,c,l,i,e,r,o,f;if(!n||!n.mediaGroups||!n.mediaGroups.AUDIO)return s;if(t=n.mediaGroups.AUDIO,h=Object.keys(t),Object.keys(this.mediaTypes_.AUDIO.groups).length)u=this.mediaTypes_.AUDIO.activeTrack();else{c=t.main||h.length&&t[h[0]];for(l in c)if(c[l]["default"]){u={label:l};break}}if(!u)return s;i=[];for(e in t)if(t[e][u.label])if(r=t[e][u.label],r.playlists&&r.playlists.length)i.push.apply(i,r.playlists);else if(r.uri)i.push(r);else if(n.playlists.length)for(o=0;o<n.playlists.length;o++)f=n.playlists[o],f.attributes&&f.attributes.AUDIO&&f.attributes.AUDIO===e&&i.push(f);return i.length?i:s},r.setupMasterPlaylistLoaderListeners_=function(){var n=this;this.masterPlaylistLoader_.on("loadedmetadata",function(){var t=n.masterPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;if(n.requestOptions_.timeout=hw(n.masterPlaylistLoader_.master,n.masterPlaylistLoader_.media())?0:i,t.endList&&n.tech_.preload()!=="none"&&(n.mainSegmentLoader_.playlist(t,n.requestOptions_),n.mainSegmentLoader_.load()),oti({sourceType:n.sourceType_,segmentLoaders:{AUDIO:n.audioSegmentLoader_,SUBTITLES:n.subtitleSegmentLoader_,main:n.mainSegmentLoader_},tech:n.tech_,requestOptions:n.requestOptions_,masterPlaylistLoader:n.masterPlaylistLoader_,vhs:n.vhs_,master:n.master(),mediaTypes:n.mediaTypes_,blacklistCurrentPlaylist:n.blacklistCurrentPlaylist.bind(n)}),n.triggerPresenceUsage_(n.master(),t),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,t,r;if(n.loadOnPlay_&&n.tech_.off("play",n.loadOnPlay_),i=n.masterPlaylistLoader_.media(),!i){if(n.excludeUnsupportedVariants_(),n.enableLowInitialPlaylist&&(t=n.selectInitialPlaylist()),t||(t=n.selectPlaylist()),!t||!n.shouldSwitchToMedia_(t))return;if(n.initialMedia_=t,n.switchMedia_(n.initialMedia_,"initial"),r=n.sourceType_==="vhs-json"&&n.initialMedia_.segments,!r)return;i=n.initialMedia_}n.handleUpdatedMediaPlaylist(i)});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=hw(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;t.lastExcludeReason_!=="playlist-unchanged"&&(i=n.stuckAtPlaylistEnd_(t),i&&(n.blacklistCurrentPlaylist({message:"Playlist no longer updating.",reason:"playlist-unchanged"}),n.tech_.trigger("playliststuck")))});this.masterPlaylistLoader_.on("renditiondisabled",function(){n.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"});n.tech_.trigger({type:"usage",name:"hls-rendition-disabled"})});this.masterPlaylistLoader_.on("renditionenabled",function(){n.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"});n.tech_.trigger({type:"usage",name:"hls-rendition-enabled"})})},r.handleUpdatedMediaPlaylist=function(n){this.useCueTags_&&this.updateAdCues_(n);this.mainSegmentLoader_.playlist(n,this.requestOptions_);this.updateDuration(!n.endList);this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())},r.triggerPresenceUsage_=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:"vhs-demuxed"}),this.tech_.trigger({type:"usage",name:"hls-demuxed"}));Object.keys(i.SUBTITLES).length&&(this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),this.tech_.trigger({type:"usage",name:"hls-webvtt"}));or.Playlist.isAes(t)&&(this.tech_.trigger({type:"usage",name:"vhs-aes"}),this.tech_.trigger({type:"usage",name:"hls-aes"}));f.length&&Object.keys(i.AUDIO[f[0]]).length>1&&(this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.tech_.trigger({type:"usage",name:"hls-alternate-audio"}));this.useCueTags_&&(this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"}),this.tech_.trigger({type:"usage",name:"hls-playlist-cue-tags"}))},r.shouldSwitchToMedia_=function(n){var t=this.masterPlaylistLoader_.media()||this.masterPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),r=this.bufferLowWaterLine(),u=this.bufferHighWaterLine(),f=this.tech_.buffered();return ati({buffered:f,currentTime:i,currentPlaylist:t,nextPlaylist:n,bufferLowWaterLine:r,bufferHighWaterLine:u,duration:this.duration(),experimentalBufferBasedABR:this.experimentalBufferBasedABR,log:this.logger_})},r.setupSegmentLoaderListeners_=function(){var n=this,t;if(!this.experimentalBufferBasedABR){this.mainSegmentLoader_.on("bandwidthupdate",function(){var t=n.selectPlaylist();n.shouldSwitchToMedia_(t)&&n.switchMedia_(t,"bandwidthupdate");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("appenderror",function(){n.error=n.mainSegmentLoader_.error_;n.trigger("error")});this.mainSegmentLoader_.on("syncinfoupdate",function(){n.onSyncInfoUpdate_()});this.mainSegmentLoader_.on("timestampoffset",function(){n.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"});n.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})});this.audioSegmentLoader_.on("syncinfoupdate",function(){n.onSyncInfoUpdate_()});this.audioSegmentLoader_.on("appenderror",function(){n.error=n.audioSegmentLoader_.error_;n.trigger("error")});this.mainSegmentLoader_.on("ended",function(){n.logger_("main segment loader ended");n.onEndOfStream()});this.mainSegmentLoader_.on("earlyabort",function(){n.experimentalBufferBasedABR||(n.delegateLoaders_("all",["abort"]),n.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},hti))});t=function(){if(!n.sourceUpdater_.hasCreatedSourceBuffers())return n.tryToCreateSourceBuffers_();var t=n.getCodecsOrExclude_();t&&n.sourceUpdater_.addOrChangeSourceBuffers(t)};this.mainSegmentLoader_.on("trackinfo",t);this.audioSegmentLoader_.on("trackinfo",t);this.mainSegmentLoader_.on("fmp4",function(){n.triggeredFmp4Usage||(n.tech_.trigger({type:"usage",name:"vhs-fmp4"}),n.tech_.trigger({type:"usage",name:"hls-fmp4"}),n.triggeredFmp4Usage=!0)});this.audioSegmentLoader_.on("fmp4",function(){n.triggeredFmp4Usage||(n.tech_.trigger({type:"usage",name:"vhs-fmp4"}),n.tech_.trigger({type:"usage",name:"hls-fmp4"}),n.triggeredFmp4Usage=!0)});this.audioSegmentLoader_.on("ended",function(){n.logger_("audioSegmentLoader ended");n.onEndOfStream()})},r.mediaSecondsLoaded_=function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)},r.load=function(){this.mainSegmentLoader_.load();this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load();this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()},r.smoothQualityChange_=function(n){n===void 0&&(n=this.selectPlaylist());this.fastQualityChange_(n)},r.fastQualityChange_=function(t){var i=this;if(t===void 0&&(t=this.selectPlaylist()),t===this.masterPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(t,"fast-quality");this.mainSegmentLoader_.resetEverything(function(){n.browser.IE_VERSION||n.browser.IS_EDGE?i.tech_.setCurrentTime(i.tech_.currentTime()+.04):i.tech_.setCurrentTime(i.tech_.currentTime())})},r.play=function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.tech_.setCurrentTime(0);this.hasPlayed_&&this.load();var n=this.tech_.seekable();if(this.tech_.duration()===Infinity&&this.tech_.currentTime()<n.start(0))return this.tech_.setCurrentTime(n.end(n.length-1))}},r.setupFirstPlay=function(){var i=this,r=this.masterPlaylistLoader_.media(),t;if(!r||this.tech_.paused()||this.hasPlayed_)return!1;if(!r.endList){if(t=this.seekable(),!t.length)return!1;if(n.browser.IE_VERSION&&this.tech_.readyState()===0){this.tech_.one("loadedmetadata",function(){i.trigger("firstplay");i.tech_.setCurrentTime(t.end(0));i.hasPlayed_=!0});return!1}this.trigger("firstplay");this.tech_.setCurrentTime(t.end(0))}return this.hasPlayed_=!0,this.load(),!0},r.handleSourceOpen_=function(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){var n=this.tech_.play();typeof n!="undefined"&&typeof n.then=="function"&&n.then(null,function(){})}this.trigger("sourceopen")},r.handleSourceEnded_=function(){var n,t;this.inbandTextTracks_.metadataTrack_&&(n=this.inbandTextTracks_.metadataTrack_.cues,n&&n.length)&&(t=this.duration(),n[n.length-1].endTime=isNaN(t)||Math.abs(t)===Infinity?Number.MAX_VALUE:t)},r.handleDurationChange_=function(){this.tech_.trigger("durationchange")},r.onEndOfStream=function(){var n=this.mainSegmentLoader_.ended_,t;(this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.mainSegmentLoader_.getCurrentMediaInfo_(),n=!t||t.hasVideo?n&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_),n)&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())},r.stuckAtPlaylistEnd_=function(n){var e=this.seekable(),t,r;if(!e.length||(t=this.syncController_.getExpiredTime(n,this.duration()),t===null))return!1;var u=or.Playlist.playlistEnd(n,t),f=this.tech_.currentTime(),i=this.tech_.buffered();return i.length?(r=i.end(i.length-1),r-f<=yi&&u-r<=yi):u-f<=yi},r.blacklistCurrentPlaylist=function(t,i){var r,o,h,u,c,l,a,v;if(t===void 0&&(t={}),r=t.playlist||this.masterPlaylistLoader_.media(),i=i||t.blacklistDuration||this.blacklistDuration,!r){this.error=t;this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}r.playlistErrors_++;var f=this.masterPlaylistLoader_.master.playlists,s=f.filter(il),e=s.length===1&&s[0]===r;if(f.length===1&&i!==Infinity)return n.log.warn("Problem encountered with playlist "+r.id+". Trying again since it is the only playlist."),this.tech_.trigger("retryplaylist"),this.masterPlaylistLoader_.load(e);if(e&&(o=!1,f.forEach(function(n){if(n!==r){var t=n.excludeUntil;typeof t!="undefined"&&t!==Infinity&&(o=!0,delete n.excludeUntil)}}),o&&(n.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))),h=r.playlistErrors_>this.maxPlaylistRetries?Infinity:Date.now()+i*1e3,r.excludeUntil=h,t.reason&&(r.lastExcludeReason_=t.reason),this.tech_.trigger("blacklistplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-blacklisted"}),this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"}),u=this.selectPlaylist(),!u){this.error="Playback cannot continue. No available working or supported playlists.";this.trigger("error");return}return c=t.internal?this.logger_:n.log.warn,l=t.message?" "+t.message:"",c((t.internal?"Internal problem":"Problem")+" encountered with playlist "+r.id+"."+(l+" Switching to playlist "+u.id+".")),u.attributes.AUDIO!==r.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),u.attributes.SUBTITLES!==r.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]),a=u.targetDuration*500||5e3,v=typeof u.lastRequest=="number"&&Date.now()-u.lastRequest<=a,this.switchMedia_(u,"exclude",e||v)},r.pauseLoading=function(){this.delegateLoaders_("all",["abort","pause"]);this.stopABRTimer_()},r.delegateLoaders_=function(n,t){var u=this,r=[],f=n==="all",i;(f||n==="main")&&r.push(this.masterPlaylistLoader_);i=[];(f||n==="audio")&&i.push("AUDIO");(f||n==="subtitle")&&(i.push("CLOSED-CAPTIONS"),i.push("SUBTITLES"));i.forEach(function(n){var t=u.mediaTypes_[n]&&u.mediaTypes_[n].activePlaylistLoader;t&&r.push(t)});["main","audio","subtitle"].forEach(function(t){var i=u[t+"SegmentLoader_"];i&&(n===t||n==="all")&&r.push(i)});r.forEach(function(n){return t.forEach(function(t){typeof n[t]=="function"&&n[t]()})})},r.setCurrentTime=function(n){var t=df(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()},r.duration=function(){if(!this.masterPlaylistLoader_)return 0;var n=this.masterPlaylistLoader_.media();return n?n.endList?this.mediaSource?this.mediaSource.duration:or.Playlist.duration(n):Infinity:0},r.seekable=function(){return this.seekable_},r.onSyncInfoUpdate_=function(){var i,r,u,f,t,e,o;if(this.masterPlaylistLoader_&&(r=this.masterPlaylistLoader_.media(),r)&&(u=this.syncController_.getExpiredTime(r,this.duration()),u!==null)&&(f=this.masterPlaylistLoader_.master,t=or.Playlist.seekable(r,u,or.Playlist.liveEdgeDelay(f,r)),t.length!==0)){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(r=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),u=this.syncController_.getExpiredTime(r,this.duration()),u===null)return;if(i=or.Playlist.seekable(r,u,or.Playlist.liveEdgeDelay(f,r)),i.length===0)return}(this.seekable_&&this.seekable_.length&&(e=this.seekable_.end(0),o=this.seekable_.start(0)),this.seekable_=i?i.start(0)>t.end(0)||t.start(0)>i.end(0)?t:n.createTimeRanges([[i.start(0)>t.start(0)?i.start(0):t.start(0),i.end(0)<t.end(0)?i.end(0):t.end(0)]]):t,this.seekable_&&this.seekable_.length&&this.seekable_.end(0)===e&&this.seekable_.start(0)===o)||(this.logger_("seekable updated ["+cut(this.seekable_)+"]"),this.tech_.trigger("seekablechanged"))}},r.updateDuration=function(n){var t,r,i;if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,n);this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(n){if(t=this.seekable(),!t.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<t.end(t.length-1))&&this.sourceUpdater_.setDuration(t.end(t.length-1));return}r=this.tech_.buffered();i=or.Playlist.duration(this.masterPlaylistLoader_.media());r.length>0&&(i=Math.max(i,r.end(r.length-1)));this.mediaSource.duration!==i&&this.sourceUpdater_.setDuration(i)},r.dispose=function(){var n=this;this.trigger("dispose");this.decrypter_.terminate();this.masterPlaylistLoader_.dispose();this.mainSegmentLoader_.dispose();this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);["AUDIO","SUBTITLES"].forEach(function(t){var i=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();this.sourceUpdater_.dispose();this.timelineChangeController_.dispose();this.stopABRTimer_();this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_);this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_);this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_);this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_);this.off()},r.master=function(){return this.masterPlaylistLoader_.master},r.media=function(){return this.masterPlaylistLoader_.media()||this.initialMedia_},r.areMediaTypesKnown_=function(){var n=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=n?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!t||!i?!1:!0},r.getCodecsOrExclude_=function(){var u=this,n={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},h,i,e,o,c,r;n.video=n.main;var f=go(this.master(),this.media()),t={},s=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(n.main.hasVideo&&(t.video=f.video||n.main.videoCodec||hat),n.main.isMuxed&&(t.video+=","+(f.audio||n.main.audioCodec||ytt)),(n.main.hasAudio&&!n.main.isMuxed||n.audio.hasAudio||s)&&(t.audio=f.audio||n.main.audioCodec||n.audio.audioCodec||ytt,n.audio.isFmp4=n.main.hasAudio&&!n.main.isMuxed?n.main.isFmp4:n.audio.isFmp4),!t.audio&&!t.video){this.blacklistCurrentPlaylist({playlist:this.media(),message:"Could not determine codecs for playlist.",blacklistDuration:Infinity});return}if(h=function(n,t){return n?fc(t):wy(t)},i={},["video","audio"].forEach(function(r){if(t.hasOwnProperty(r)&&!h(n[r].isFmp4,t[r])){var u=n[r].isFmp4?"browser":"muxer";i[u]=i[u]||[];i[u].push(t[r]);r==="audio"&&(e=u)}}),s&&e&&this.media().attributes.AUDIO&&(o=this.media().attributes.AUDIO,this.master().playlists.forEach(function(n){var t=n.attributes&&n.attributes.AUDIO;t===o&&n!==u.media()&&(n.excludeUntil=Infinity)}),this.logger_("excluding audio group "+o+" as "+e+' does not support codec(s): "'+t.audio+'"')),Object.keys(i).length){c=Object.keys(i).reduce(function(n,t){return n&&(n+=", "),n+(t+' does not support codec(s): "'+i[t].join(",")+'"')},"")+".";this.blacklistCurrentPlaylist({playlist:this.media(),internal:!0,message:c,blacklistDuration:Infinity});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()&&(r=[],["video","audio"].forEach(function(n){var i=(vi(u.sourceUpdater_.codecs[n]||"")[0]||{}).type,f=(vi(t[n]||"")[0]||{}).type;i&&f&&i.toLowerCase()!==f.toLowerCase()&&r.push('"'+u.sourceUpdater_.codecs[n]+'" -> "'+t[n]+'"')}),r.length)){this.blacklistCurrentPlaylist({playlist:this.media(),message:"Codec switching not supported: "+r.join(", ")+".",blacklistDuration:Infinity,internal:!0});return}return t},r.tryToCreateSourceBuffers_=function(){var n,t;this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||this.areMediaTypesKnown_()&&(n=this.getCodecsOrExclude_(),n)&&(this.sourceUpdater_.createSourceBuffers(n),t=[n.video,n.audio].filter(Boolean).join(","),this.excludeIncompatibleVariants_(t))},r.excludeUnsupportedVariants_=function(){var n=this,t=this.master().playlists,i=[];Object.keys(t).forEach(function(r){var e=t[r],u,f;i.indexOf(e.id)===-1&&(i.push(e.id),u=go(n.master,e),f=[],!u.audio||wy(u.audio)||fc(u.audio)||f.push("audio codec "+u.audio),!u.video||wy(u.video)||fc(u.video)||f.push("video codec "+u.video),u.text&&u.text==="stpp.ttml.im1t"&&f.push("text codec "+u.text),f.length&&(e.excludeUntil=Infinity,n.logger_("excluding "+e.id+" for unsupported: "+f.join(", "))))})},r.excludeIncompatibleVariants_=function(n){var i=this,f=[],e=this.master().playlists,t=el(vi(n)),o=het(t),r=t.video&&vi(t.video)[0]||null,u=t.audio&&vi(t.audio)[0]||null;Object.keys(e).forEach(function(n){var s=e[n],c,l;if(f.indexOf(s.id)===-1&&s.excludeUntil!==Infinity){f.push(s.id);var h=[],t=go(i.masterPlaylistLoader_.master,s),a=het(t);(t.audio||t.video)&&(a!==o&&h.push('codec count "'+a+'" !== "'+o+'"'),i.sourceUpdater_.canChangeType()||(c=t.video&&vi(t.video)[0]||null,l=t.audio&&vi(t.audio)[0]||null,c&&r&&c.type.toLowerCase()!==r.type.toLowerCase()&&h.push('video codec "'+c.type+'" !== "'+r.type+'"'),l&&u&&l.type.toLowerCase()!==u.type.toLowerCase()&&h.push('audio codec "'+l.type+'" !== "'+u.type+'"')),h.length&&(s.excludeUntil=Infinity,i.logger_("blacklisting "+s.id+": "+h.join(" && "))))}})},r.updateAdCues_=function(n){var t=0,i=this.seekable();i.length&&(t=i.start(0));ynt(n,this.cueTagsTrack_,t)},r.goalBufferLength=function(){var t=this.tech_.currentTime(),n=g.GOAL_BUFFER_LENGTH,i=g.GOAL_BUFFER_LENGTH_RATE,r=Math.max(n,g.MAX_GOAL_BUFFER_LENGTH);return Math.min(n+t*i,r)},r.bufferLowWaterLine=function(){var t=this.tech_.currentTime(),n=g.BUFFER_LOW_WATER_LINE,i=g.BUFFER_LOW_WATER_LINE_RATE,r=Math.max(n,g.MAX_BUFFER_LOW_WATER_LINE),u=Math.max(n,g.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(n+t*i,this.experimentalBufferBasedABR?u:r)},r.bufferHighWaterLine=function(){return g.BUFFER_HIGH_WATER_LINE},u}(n.EventTarget),yti=function(n,t,i){return function(r){var u=n.master.playlists[t],e=sw(u),f=il(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)}},pti=function(n,t,i){var u=n.masterPlaylistController_,f=n.options_.smoothQualityChange,e=f?"smooth":"fast",o=u[e+"QualityChange_"].bind(u),r;t.attributes&&(r=t.attributes.RESOLUTION,this.width=r&&r.width,this.height=r&&r.height,this.bandwidth=t.attributes.BANDWIDTH);this.codecs=go(u.master(),t);this.playlist=t;this.id=i;this.enabled=yti(n.playlists,t.id,o)},wti=function(n){n.representations=function(){var t=n.masterPlaylistController_.master(),i=bo(t)?n.masterPlaylistController_.getAudioTrackPlaylists_():t.playlists;return i?i.filter(function(n){return!sw(n)}).map(function(t){return new pti(n,t,t.id)}):[]}},oot=["seeking","seeked","pause","playing","error"],bti=function(){function t(n){var t=this,u;this.masterPlaylistController_=n.masterPlaylistController;this.tech_=n.tech;this.seekable=n.seekable;this.allowSeeksWithinUnsafeLiveWindow=n.allowSeeksWithinUnsafeLiveWindow;this.liveRangeSafeTimeDelta=n.liveRangeSafeTimeDelta;this.media=n.media;this.consecutiveUpdates=0;this.lastRecordedTime=null;this.timer_=null;this.checkCurrentTimeTimeout_=null;this.logger_=si("PlaybackWatcher");this.logger_("initialize");var f=function(){return t.monitorCurrentTime_()},e=function(){return t.monitorCurrentTime_()},o=function(){return t.techWaiting_()},s=function(){return t.cancelTimer_()},r=this.masterPlaylistController_,h=["main","subtitle","audio"],i={};h.forEach(function(n){i[n]={reset:function(){return t.resetSegmentDownloads_(n)},updateend:function(){return t.checkSegmentDownloads_(n)}};r[n+"SegmentLoader_"].on("appendsdone",i[n].updateend);r[n+"SegmentLoader_"].on("playlistupdate",i[n].reset);t.tech_.on(["seeked","seeking"],i[n].reset)});u=function(n){["main","audio"].forEach(function(i){r[i+"SegmentLoader_"][n]("appended",t.seekingAppendCheck_)})};this.seekingAppendCheck_=function(){t.fixesBadSeeks_()&&(t.consecutiveUpdates=0,t.lastRecordedTime=t.tech_.currentTime(),u("off"))};this.clearSeekingAppendCheck_=function(){return u("off")};this.watchForBadSeeking_=function(){t.clearSeekingAppendCheck_();u("on")};this.tech_.on("seeked",this.clearSeekingAppendCheck_);this.tech_.on("seeking",this.watchForBadSeeking_);this.tech_.on("waiting",o);this.tech_.on(oot,s);this.tech_.on("canplay",e);this.tech_.one("play",f);this.dispose=function(){t.clearSeekingAppendCheck_();t.logger_("dispose");t.tech_.off("waiting",o);t.tech_.off(oot,s);t.tech_.off("canplay",e);t.tech_.off("play",f);t.tech_.off("seeking",t.watchForBadSeeking_);t.tech_.off("seeked",t.clearSeekingAppendCheck_);h.forEach(function(n){r[n+"SegmentLoader_"].off("appendsdone",i[n].updateend);r[n+"SegmentLoader_"].off("playlistupdate",i[n].reset);t.tech_.off(["seeked","seeking"],i[n].reset)});t.checkCurrentTimeTimeout_&&window.clearTimeout(t.checkCurrentTimeTimeout_);t.cancelTimer_()}}var n=t.prototype;return n.monitorCurrentTime_=function(){this.checkCurrentTime_();this.checkCurrentTimeTimeout_&&window.clearTimeout(this.checkCurrentTimeTimeout_);this.checkCurrentTimeTimeout_=window.setTimeout(this.monitorCurrentTime_.bind(this),250)},n.resetSegmentDownloads_=function(n){var t=this.masterPlaylistController_[n+"SegmentLoader_"];this[n+"StalledDownloads_"]>0&&this.logger_("resetting possible stalled download count for "+n+" loader");this[n+"StalledDownloads_"]=0;this[n+"Buffered_"]=t.buffered_()},n.checkSegmentDownloads_=function(n){var r=this.masterPlaylistController_,t=r[n+"SegmentLoader_"],i=t.buffered_(),u=lbt(this[n+"Buffered_"],i);if(this[n+"Buffered_"]=i,u){this.resetSegmentDownloads_(n);return}(this[n+"StalledDownloads_"]++,this.logger_("found #"+this[n+"StalledDownloads_"]+" "+n+" appends that did not increase buffer (possible stalled download)",{playlistId:t.playlist_&&t.playlist_.id,buffered:hu(i)}),this[n+"StalledDownloads_"]<10)||(this.logger_(n+" loader stalled download exclusion"),this.resetSegmentDownloads_(n),this.tech_.trigger({type:"usage",name:"vhs-"+n+"-download-exclusion"}),n!=="subtitle")&&r.blacklistCurrentPlaylist({message:"Excessive "+n+" segment downloading detected."},Infinity)},n.checkCurrentTime_=function(){if(!this.tech_.paused()&&!this.tech_.seeking()){var n=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===n&&(!t.length||n+yi>=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)}},n.cancelTimer_=function(){this.consecutiveUpdates=0;this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_));this.timer_=null},n.fixesBadSeeks_=function(){var l=this.tech_.seeking(),h,e,r,c,f;if(!l)return!1;var t=this.seekable(),i=this.tech_.currentTime(),a=this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow),n;if(a&&(h=t.end(t.length-1),n=h),this.beforeSeekableWindow_(t,i)&&(e=t.start(0),n=e+(e===t.end(0)?0:yi)),typeof n!="undefined")return this.logger_("Trying to seek outside of seekable at time "+i+" with "+("seekable range "+cut(t)+". Seeking to ")+(n+".")),this.tech_.setCurrentTime(n),!0;var u=this.masterPlaylistController_.sourceUpdater_,v=this.tech_.buffered(),y=u.audioBuffer?u.audioBuffered():null,p=u.videoBuffer?u.videoBuffered():null,o=this.media(),w=o.partTargetDuration?o.partTargetDuration:(o.targetDuration-ar)*2,s=[y,p];for(r=0;r<s.length;r++)if(s[r]&&(c=fw(s[r],i),c<w))return!1;return(f=tl(v,i),f.length===0)?!1:(n=f.start(0)+yi,this.logger_("Buffered region starts ("+f.start(0)+") "+(" just beyond seek point ("+i+"). Seeking to "+n+".")),this.tech_.setCurrentTime(n),!0)},n.waiting_=function(){if(!this.techWaiting_()){var n=this.tech_.currentTime(),i=this.tech_.buffered(),t=df(i,n);if(t.length&&n+3<=t.end(0)){this.cancelTimer_();this.tech_.setCurrentTime(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:"vhs-unknown-waiting"});this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"});return}}},n.techWaiting_=function(){var i=this.seekable(),n=this.tech_.currentTime(),r,t,u;if(this.tech_.seeking()||this.timer_!==null)return!0;if(this.beforeSeekableWindow_(i,n))return 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.tech_.setCurrentTime(r),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0;var f=this.tech_.vhs.masterPlaylistController_.sourceUpdater_,e=this.tech_.buffered(),o=this.videoUnderflow_({audioBuffered:f.audioBuffered(),videoBuffered:f.videoBuffered(),currentTime:n});return o?(this.cancelTimer_(),this.tech_.setCurrentTime(n),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),this.tech_.trigger({type:"usage",name:"hls-video-underflow"}),!0):(t=tl(e,n),t.length>0)?(u=t.start(0)-n,this.logger_("Stopped at "+n+", setting timer for "+u+", seeking "+("to "+t.start(0))),this.cancelTimer_(),this.timer_=setTimeout(this.skipTheGap_.bind(this),u*1e3,n),!0):!1},n.afterSeekableWindow_=function(n,t,i,r){if(r===void 0&&(r=!1),!n.length)return!1;var u=n.end(n.length-1)+yi,f=!i.endList;return(f&&r&&(u=n.end(n.length-1)+i.targetDuration*3),t>u)?!0:!1},n.beforeSeekableWindow_=function(n,t){return n.length&&n.start(0)>0&&t<n.start(0)-this.liveRangeSafeTimeDelta?!0:!1},n.videoUnderflow_=function(n){var t=n.videoBuffered,u=n.audioBuffered,i=n.currentTime,r,o;if(t){if(t.length&&u.length){var f=df(t,i-3),s=df(t,i),e=df(u,i);e.length&&!s.length&&f.length&&(r={start:f.end(0),end:e.end(0)})}else o=tl(t,i),o.length||(r=this.gapFromVideoUnderflow_(t,i));return r?(this.logger_("Encountered a gap in video from "+r.start+" to "+r.end+". "+("Seeking to current time "+i)),!0):!1}},n.skipTheGap_=function(n){var r=this.tech_.buffered(),t=this.tech_.currentTime(),i=tl(r,t);(this.cancelTimer_(),i.length!==0&&t===n)&&(this.logger_("skipTheGap_:","currentTime:",t,"scheduled currentTime:",n,"nextRange start:",i.start(0)),this.tech_.setCurrentTime(i.start(0)+ar),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"}),this.tech_.trigger({type:"usage",name:"hls-gap-skip"}))},n.gapFromVideoUnderflow_=function(n,t){for(var r,f,u=sbt(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}(),kti={errorInterval:30,getSource:function(n){var t=this.tech({IWillNotUseThisInPlugins:!0}),i=t.currentSource_||this.currentSource();return n(i)}},sot=function sot(t,i){var e=0,u=0,r=n.mergeOptions(kti,i);t.ready(function(){t.trigger({type:"usage",name:"vhs-error-reload-initialized"});t.trigger({type:"usage",name:"hls-error-reload-initialized"})});var o=function(){u&&t.currentTime(u)},h=function(n){if(n!==null&&n!==undefined){u=t.duration()!==Infinity&&t.currentTime()||0;t.one("loadedmetadata",o);t.src(n);t.trigger({type:"usage",name:"vhs-error-reload"});t.trigger({type:"usage",name:"hls-error-reload"});t.play()}},s=function(){if(Date.now()-e<r.errorInterval*1e3){t.trigger({type:"usage",name:"vhs-error-reload-canceled"});t.trigger({type:"usage",name:"hls-error-reload-canceled"});return}if(!r.getSource||typeof r.getSource!="function"){n.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return e=Date.now(),r.getSource.call(t,h)},f=function f(){t.off("loadedmetadata",o);t.off("error",s);t.off("dispose",f)},c=function(n){f();sot(t,n)};t.on("error",s);t.on("dispose",f);t.reloadSourceOnError=c},dti=function(n){sot(this,n)},hot="2.12.1",gti="6.0.0",nii="0.20.0",tii="4.7.0",iii="3.1.2",tt={PlaylistLoader:gf,Playlist:wt,utils:ykt,STANDARD_PLAYLIST_SELECTOR:vet,INITIAL_PLAYLIST_SELECTOR:agt,lastBandwidthSelector:vet,movingAverageBandwidthSelector:cgt,comparePlaylistBandwidth:nb,comparePlaylistResolution:hgt,xhr:oft()};Object.keys(g).forEach(function(t){Object.defineProperty(tt,t,{get:function(){return n.log.warn("using Vhs."+t+" is UNSAFE be sure you know what you are doing"),g[t]},set:function(i){if(n.log.warn("using Vhs."+t+" is UNSAFE be sure you know what you are doing"),typeof i!="number"||i<0){n.log.warn("value of Vhs."+t+" must be greater than or equal to 0");return}g[t]=i}})});var cot="videojs-vhs",lot=function(n,t){for(var u=t.media(),r=-1,i=0;i<n.length;i++)if(n[i].id===u.id){r=i;break}n.selectedIndex_=r;n.trigger({selectedIndex:r,type:"change"})},rii=function(n,t){t.representations().forEach(function(t){n.addQualityLevel(t)});lot(n,t.playlists)};tt.canPlaySource=function(){return n.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var uii=function(t,i,r){var e,u;if(!t)return t;e={};i&&i.attributes&&i.attributes.CODECS&&(e=el(vi(i.attributes.CODECS)));r&&r.attributes&&r.attributes.CODECS&&(e.audio=r.attributes.CODECS);var o=ro(e.video),s=ro(e.audio),f={};for(u in t)f[u]={},s&&(f[u].audioContentType=s),o&&(f[u].videoContentType=o),i.contentProtection&&i.contentProtection[u]&&i.contentProtection[u].pssh&&(f[u].pssh=i.contentProtection[u].pssh),typeof t[u]=="string"&&(f[u].url=t[u]);return n.mergeOptions(t,f)},fii=function(n,t){return n.reduce(function(n,i){if(!i.contentProtection)return n;var r=t.reduce(function(n,t){var r=i.contentProtection[t];return r&&r.pssh&&(n[t]={pssh:r.pssh}),n},{});return Object.keys(r).length&&n.push(r),n},[])},eii=function(n){var t=n.player,e=n.sourceKeySystems,i=n.audioMedia,r=n.mainPlaylists;if(!t.eme.initializeMediaKeys)return Promise.resolve();var o=i?r.concat([i]):r,s=fii(o,Object.keys(e)),u=[],f=[];return s.forEach(function(n){f.push(new Promise(function(n){t.tech_.one("keysessioncreated",n)}));u.push(new Promise(function(i,r){t.eme.initializeMediaKeys({keySystems:n},function(n){if(n){r(n);return}i()})}))}),Promise.race([Promise.all(u),Promise.race(f)])},oii=function(t){var r=t.player,u=t.sourceKeySystems,f=t.media,e=t.audioMedia,i=uii(u,f,e);return i?(r.currentSource().keySystems=i,i&&!r.eme)?(n.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0:!1},aot=function(){if(!window.localStorage)return null;var n=window.localStorage.getItem(cot);if(!n)return null;try{return JSON.parse(n)}catch(t){return null}},sii=function(t){if(!window.localStorage)return!1;var i=aot();i=i?n.mergeOptions(i,t):t;try{window.localStorage.setItem(cot,JSON.stringify(i))}catch(r){return!1}return i},hii=function(n){return n.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(n.substring(n.indexOf(",")+1)):n};tt.supportsNativeHls=function(){var t,i;return!document||!document.createElement?!1:(t=document.createElement("video"),!n.getTech("Html5").isSupported())?!1:(i=["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"],i.some(function(n){return/maybe|probably/i.test(t.canPlayType(n))}))}();tt.supportsNativeDash=function(){return!document||!document.createElement||!n.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(document.createElement("video").canPlayType("application/dash+xml"))}();tt.supportsTypeNatively=function(n){return n==="hls"?tt.supportsNativeHls:n==="dash"?tt.supportsNativeDash:!1};tt.isSupported=function(){return n.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var cii=n.getComponent("Component"),ub=function(t){function u(i,r,u){var e,o;if(e=t.call(this,r,n.mergeOptions(u.hls,u.vhs))||this,u.hls&&Object.keys(u.hls).length&&n.log.warn("Using hls options is deprecated. Use vhs instead."),typeof u.initialBandwidth=="number"&&(e.options_.bandwidth=u.initialBandwidth),e.logger_=si("VhsHandler"),r.options_&&r.options_.playerId&&(o=n(r.options_.playerId),o.hasOwnProperty("hls")||Object.defineProperty(o,"hls",{get:function(){return n.log.warn("player.hls is deprecated. Use player.tech().vhs instead."),r.trigger({type:"usage",name:"hls-player-access"}),f(e)},configurable:!0}),o.hasOwnProperty("vhs")||Object.defineProperty(o,"vhs",{get:function(){return n.log.warn("player.vhs is deprecated. Use player.tech().vhs instead."),r.trigger({type:"usage",name:"vhs-player-access"}),f(e)},configurable:!0}),o.hasOwnProperty("dash")||Object.defineProperty(o,"dash",{get:function(){return n.log.warn("player.dash is deprecated. Use player.tech().vhs instead."),f(e)},configurable:!0}),e.player_=o),e.tech_=r,e.source_=i,e.stats={},e.ignoreNextSeekingEvent_=!1,e.setOptions_(),e.options_.overrideNative&&r.overrideNativeAudioTracks&&r.overrideNativeVideoTracks)r.overrideNativeAudioTracks(!0),r.overrideNativeVideoTracks(!0);else if(e.options_.overrideNative&&(r.featuresNativeVideoTracks||r.featuresNativeAudioTracks))throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB");e.on(document,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],function(){var n=document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;n&&n.contains(e.tech_.el())?e.masterPlaylistController_.fastQualityChange_():e.masterPlaylistController_.checkABR_()});e.on(e.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())});e.on(e.tech_,"error",function(){this.tech_.error()&&this.masterPlaylistController_&&this.masterPlaylistController_.pauseLoading()});e.on(e.tech_,"play",e.play);return e}i(u,t);var r=u.prototype;return r.setOptions_=function(){var t=this,n;this.options_.withCredentials=this.options_.withCredentials||!1;this.options_.handleManifestRedirects=this.options_.handleManifestRedirects===!1?!1:!0;this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions===!1?!1:!0;this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1;this.options_.smoothQualityChange=this.options_.smoothQualityChange||!1;this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage!="undefined"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1;this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!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=aot(),n&&n.bandwidth&&(this.options_.bandwidth=n.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"}),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:"vhs-throughput-from-local-storage"}),this.tech_.trigger({type:"usage",name:"hls-throughput-from-local-storage"})));typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=g.INITIAL_BANDWIDTH);this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===g.INITIAL_BANDWIDTH;["withCredentials","useDevicePixelRatio","limitRenditionByPlayerDimensions","bandwidth","smoothQualityChange","customTagParsers","customTagMappers","handleManifestRedirects","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","experimentalBufferBasedABR","liveRangeSafeTimeDelta","experimentalLLHLS","useNetworkInformationApi","experimentalExactManifestTimings","experimentalLeastPixelDiffSelector"].forEach(function(n){typeof t.source_[n]!="undefined"&&(t.options_[n]=t.source_[n])});this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions;this.useDevicePixelRatio=this.options_.useDevicePixelRatio},r.src=function(t,i){var r=this,u,f;if(t){this.setOptions_();this.options_.src=hii(this.source_.src);this.options_.tech=this.tech_;this.options_.externVhs=tt;this.options_.sourceType=ptt(i);this.options_.seekTo=function(n){r.tech_.setCurrentTime(n)};this.options_.smoothQualityChange&&n.log.warn("smoothQualityChange is deprecated and will be removed in the next major version");this.masterPlaylistController_=new vti(this.options_);u=n.mergeOptions({liveRangeSafeTimeDelta:yi},this.options_,{seekable:function(){return r.seekable()},media:function(){return r.masterPlaylistController_.media()},masterPlaylistController:this.masterPlaylistController_});this.playbackWatcher_=new bti(u);this.masterPlaylistController_.on("error",function(){var i=n.players[r.tech_.options_.playerId],t=r.masterPlaylistController_.error;typeof t!="object"||t.code?typeof t=="string"&&(t={message:t,code:3}):t.code=3;i.error(t)});f=this.options_.experimentalBufferBasedABR?tt.movingAverageBandwidthSelector(.55):tt.STANDARD_PLAYLIST_SELECTOR;this.masterPlaylistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):f.bind(this);this.masterPlaylistController_.selectInitialPlaylist=tt.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(){var n=this.masterPlaylistController_.mainSegmentLoader_.bandwidth,i=window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection,r=1e7,t;return this.options_.useNetworkInformationApi&&i&&(t=i.downlink*1e6,n=t>=r&&n>=r?Math.max(n,t):t),n},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;return n=this.throughput>0?1/this.throughput:0,Math.floor(1/(t+n))},set:function(){n.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},mediaAppends:{get:function(){return r.masterPlaylistController_.mediaAppends_()||0},enumerable:!0},mainAppendsToLoadedData:{get:function(){return r.masterPlaylistController_.mainAppendsToLoadedData_()||0},enumerable:!0},audioAppendsToLoadedData:{get:function(){return r.masterPlaylistController_.audioAppendsToLoadedData_()||0},enumerable:!0},appendsToLoadedData:{get:function(){return r.masterPlaylistController_.appendsToLoadedData_()||0},enumerable:!0},timeToLoadedData:{get:function(){return r.masterPlaylistController_.timeToLoadedData_()||0},enumerable:!0},buffered:{get:function(){return hu(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 hu(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&&sii({bandwidth:r.bandwidth,throughput:Math.round(r.throughput)})});this.masterPlaylistController_.on("selectedinitialmedia",function(){wti(r)});this.masterPlaylistController_.sourceUpdater_.on("createdsourcebuffers",function(){r.setupEme_()});this.on(this.masterPlaylistController_,"progress",function(){this.tech_.trigger("progress")});this.on(this.masterPlaylistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0});(this.setupQualityLevels_(),this.tech_.el())&&(this.mediaSourceUrl_=window.URL.createObjectURL(this.masterPlaylistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}},r.setupEme_=function(){var t=this,i=this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader,r=oii({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:i&&i.media()});this.player_.tech_.on("keystatuschange",function(n){n.status==="output-restricted"&&t.masterPlaylistController_.blacklistCurrentPlaylist({playlist:t.masterPlaylistController_.media(),message:"DRM keystatus changed to "+n.status+". Playlist will fail to play. Check for HDCP content.",blacklistDuration:Infinity})});if(n.browser.IE_VERSION===11||!r){this.masterPlaylistController_.sourceUpdater_.initializedEme();return}this.logger_("waiting for EME key session creation");eii({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:i&&i.media(),mainPlaylists:this.playlists.master.playlists}).then(function(){t.logger_("created EME key session");t.masterPlaylistController_.sourceUpdater_.initializedEme()})["catch"](function(n){t.logger_("error while creating EME key session",n);t.player_.error({message:"Failed to initialize media keys for EME",code:3})})},r.setupQualityLevels_=function(){var t=this,i=n.players[this.tech_.options_.playerId];if(i&&i.qualityLevels&&!this.qualityLevels_){this.qualityLevels_=i.qualityLevels();this.masterPlaylistController_.on("selectedinitialmedia",function(){rii(t.qualityLevels_,t)});this.playlists.on("mediachange",function(){lot(t.qualityLevels_,t.playlists)})}},u.version=function(){return{"@videojs/http-streaming":hot,"mux.js":gti,"mpd-parser":nii,"m3u8-parser":tii,"aes-decrypter":iii}},r.version=function(){return this.constructor.version()},r.canChangeType=function(){return tot.canChangeType()},r.play=function(){this.masterPlaylistController_.play()},r.setCurrentTime=function(n){this.masterPlaylistController_.setCurrentTime(n)},r.duration=function(){return this.masterPlaylistController_.duration()},r.seekable=function(){return this.masterPlaylistController_.seekable()},r.dispose=function(){this.playbackWatcher_&&this.playbackWatcher_.dispose();this.masterPlaylistController_&&this.masterPlaylistController_.dispose();this.qualityLevels_&&this.qualityLevels_.dispose();this.player_&&(delete this.player_.vhs,delete this.player_.dash,delete this.player_.hls);this.tech_&&this.tech_.vhs&&delete this.tech_.vhs;this.tech_&&delete this.tech_.hls;this.mediaSourceUrl_&&window.URL.revokeObjectURL&&(window.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null);t.prototype.dispose.call(this)},r.convertToProgramTime=function(n,t){return ndt({playlist:this.masterPlaylistController_.media(),time:n,callback:t})},r.seekToProgramTime=function(n,t,i,r){return i===void 0&&(i=!0),r===void 0&&(r=2),aft({programTime:n,playlist:this.masterPlaylistController_.media(),retryCount:r,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})},u}(cii),al={name:"videojs-http-streaming",VERSION:hot,canHandleSource:function(t,i){i===void 0&&(i={});var r=n.mergeOptions(n.options,i);return al.canPlayType(t.type,r)},handleSource:function(t,i,r){r===void 0&&(r={});var u=n.mergeOptions(n.options,r);return i.vhs=new ub(t,i,u),n.hasOwnProperty("hls")||Object.defineProperty(i,"hls",{get:function(){return n.log.warn("player.tech().hls is deprecated. Use player.tech().vhs instead."),i.vhs},configurable:!0}),i.vhs.xhr=oft(),i.vhs.src(t.src,t.type),i.vhs},canPlayType:function(t,i){var f,r;i===void 0&&(i={});f=n.mergeOptions(n.options,i);r=f.vhs;r=r===void 0?{}:r;var e=r.overrideNative,h=e===void 0?!n.browser.IS_ANY_SAFARI:e,u=f.hls;u=u===void 0?{}:u;var o=u.overrideNative,c=o===void 0?!1:o,s=ptt(t),l=s&&(!tt.supportsTypeNatively(s)||c||h);return l?"maybe":""}},lii=function(){return fc("avc1.4d400d,mp4a.40.2")};return lii()&&n.getTech("Html5").registerSourceHandler(al,0),n.VhsHandler=ub,Object.defineProperty(n,"HlsHandler",{get:function(){return n.log.warn("videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead."),ub},configurable:!0}),n.VhsSourceHandler=al,Object.defineProperty(n,"HlsSourceHandler",{get:function(){return n.log.warn("videojs.HlsSourceHandler is deprecated. Use videojs.VhsSourceHandler instead."),al},configurable:!0}),n.Vhs=tt,Object.defineProperty(n,"Hls",{get:function(){return n.log.warn("videojs.Hls is deprecated. Use videojs.Vhs instead."),tt},configurable:!0}),n.use||(n.registerComponent("Hls",tt),n.registerComponent("Vhs",tt)),n.options.vhs=n.options.vhs||{},n.options.hls=n.options.hls||{},n.getPlugin&&n.getPlugin("reloadSourceOnError")||(vot=n.registerPlugin||n.plugin,vot("reloadSourceOnError",dti)),n});!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.videojsContribQualityLevels=t(n.videojs)}(this,function(n){"use strict";function r(n){if(void 0===n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}var t=function(n){function f(){var i,t=r(r(i=n.call(this)||this));return t.levels_=[],t.selectedIndex_=-1,Object.defineProperty(t,"selectedIndex",{get:function(){return t.selectedIndex_}}),Object.defineProperty(t,"length",{get:function(){return t.levels_.length}}),t||r(i)}var i,u,t;return u=n,(i=f).prototype=Object.create(u.prototype),i.prototype.constructor=i,i.__proto__=u,t=f.prototype,t.addQualityLevel=function(n){var t=this.getQualityLevelById(n.id),i;return t?t:(i=this.levels_.length,t=new function(n){var t=this;return t.id=n.id,t.label=t.id,t.width=n.width,t.height=n.height,t.bitrate=n.bandwidth,t.frameRate=n.frameRate,t.enabled_=n.enabled,Object.defineProperty(t,"enabled",{get:function(){return t.enabled_()},set:function(n){t.enabled_(n)}}),t}(n),""+i in this||Object.defineProperty(this,i,{get:function(){return this.levels_[i]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t)},t.removeQualityLevel=function(n){for(var i=null,t=0,r=this.length;t<r;t++)if(this[t]===n){i=this.levels_.splice(t,1)[0];this.selectedIndex_===t?this.selectedIndex_=-1:this.selectedIndex_>t&&this.selectedIndex_--;break}return i&&this.trigger({qualityLevel:n,type:"removequalitylevel"}),i},t.getQualityLevelById=function(n){for(var i,t=0,r=this.length;t<r;t++)if(i=this[t],i.id===n)return i;return null},t.dispose=function(){this.selectedIndex_=-1;this.levels_.length=0},f}((n=n&&n.hasOwnProperty("default")?n.default:n).EventTarget),u,i;for(u in t.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"},t.prototype.allowedEvents_)t.prototype["on"+u]=null;return i=function(i){return r=this,n.mergeOptions({},i),f=r.qualityLevels,u=new t,r.on("dispose",function n(){u.dispose();r.qualityLevels=f;r.off("dispose",n)}),r.qualityLevels=function(){return u},r.qualityLevels.VERSION="2.2.0",u;var r,f,u},(n.registerPlugin||n.plugin)("qualityLevels",i),i.VERSION="2.2.0",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(n.eventType,{category:"NTG Video",label:window.top.VM.Scroll.details.title,value: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))},_qualityLevelChange:function(){var n=this,t=this.player_.qualityLevels(),i=t[t.selectedIndex_];n._asData.hitValue=i.height;n._sendHit("resolutionchanged",!1);n._asData.hitValue=i.bitrate;n._sendHit("bitratechanged",!1)},_sendHit:function(n,t){this._asData.eventType=n;this._asData.hitValue=n.match(/milestone|complete|qualitylevelchange/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);this.on("qualitylevelchange",this._qualityLevelChange)}}},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={embedded:!1,base:null,animation:null,adRequested:!1,vastTag: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 t=this,i=0,r,u;n&&(t.vastTag=VM.AmsVideo.getVastTag(document.getElementById("vjs")),r={adTagUrl:t.vastTag},pbjs&&pbjs.version&&(u=new URL(t.vastTag).searchParams.get("iu"),pbjs.que.push(function(){pbjs.rp.requestVideoBids({adSlotName:u,playerSize:[640,480],callback:VM.AmsVideo.invokePlayer})}),i=3500));setTimeout(function(){t.invokePlayer(r)},i)},invokePlayer:function(n){var i=VM.AmsVideo,t,r;i.adRequested||(i.adRequested=!0,t=document.getElementById("vjs"),r=i.embedded?window.frameElement.classList.contains("media-embed-autoplay"):!1,t&&(t.setAttribute("class","video-js vjs-default-skin vjs-big-play-centered"),t.setAttribute("playsinline",""),r&&(t.setAttribute("autoplay",!0),t.setAttribute("muted",!0)),videojs(t,{controls:!0,width:"auto",height:"auto",aspectRatio:"16:9",fluid:!0,html5:{vhs:{overrideNative:!videojs.browser.IS_SAFARI,experimentalBufferBasedABR:!0},nativeTextTracks:!1,nativeAudioTracks:!1,nativeVideoTracks:!1}}).ready(function(){var r=this,o=t.getAttribute("data-audio")=="true",s=i.vastTag,c,e,u,f,h,l;n&&n.adTagUrl&&(s=n.adTagUrl);s&&(c={adTagUrl:s},r.ima(c),e=document.getElementById("vjs_video_html5_api"),e&&(navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i))&&e.hasAttribute("controls")&&e.removeAttribute("controls"),u=document.getElementById("vjs"),f=function(){u.removeEventListener("click",f);u.removeEventListener("touchend",f)},u.addEventListener("click",f),u.addEventListener("touchend",f));h=t.getAttribute("data-vtt-src");h&&(l=r.addRemoteTextTrack({src:h,language:"English"},!1),t.getAttribute("data-vtt-hide")!="true"&&l.addEventListener("load",function(){i.loadTranscription()}));r.qualityLevels().on("addqualitylevel",function(n){var t=n.qualityLevel;t.enabled=t.height<=720});r.qualityLevels().on("change",function(){r.trigger("qualitylevelchange")});r.on("play",function(){var n=document.querySelector(".vjs-share");n&&document.querySelector(".vjs-share").classList.add("hidden");o&&VM.AmsVideo.toggleAnimation("play")});r.on("pause",function(){o&&VM.AmsVideo.toggleAnimation("pause")});r.on("ended",function(){o&&VM.AmsVideo.toggleAnimation("ended");r.vast&&r.vast.adUnit||i.loadShare()})})))},loadAudioAnimation:function(){var r;if(!document.querySelector(".vjs-audio-animation")&&(r=VM.AmsVideo.base.querySelector(".nav.nav-table.sc.sc-expanded"),r)){var t=document.createElement("div"),i=document.createElement("div"),n=document.createElement("div");i.classList.add("audio-animation-container");n.setAttribute("id","audio-animation");n.classList.add("audio-animation");n.classList.add("audio-animation-paused");t.classList.add("vjs-audio-animation");t.classList.add("hidden");i.appendChild(n);t.appendChild(i);VM.AmsVideo.animation=n;document.getElementById("vjs").insertBefore(t,document.querySelector(".vjs-control-bar"))}},toggleAnimation:function(n){var t,i;if(VM.AmsVideo.animation||VM.AmsVideo.loadAudioAnimation(),t=VM.AmsVideo.animation,t){i=t.closest(".vjs-audio-animation");switch(n){case"play":i.classList.remove("hidden");t.classList.remove("audio-animation-paused");break;case"pause":t.classList.add("audio-animation-paused");break;case"ended":t.classList.add("audio-animation-paused");i.classList.add("hidden")}}},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"),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 t=this,r=videojs.players.vjs.remoteTextTracks(),u=document.querySelector(".details-file").getAttribute("id"),i,n,s,h;if(r.length>0){for(n=0;n<r.length;n++)if(r[n].kind=="subtitles"&&r[n].language=="English"){i=r[n];break}if(i!=undefined&&i.cues.length>0){t.embedded&&t.base.querySelector(".embed.embed-ams#"+u).classList.add("ams-transcription");var f=document.querySelector(".details-file"),e=document.createElement("div"),o="";for(n=0;n<i.cues.length;n++)s=i.cues[n].startTime,h=i.cues[n].text.split(" ").map(function(n){return"<span class='transcription-word' data-start-time='"+s+"'>"+n+"<\/span>"}),o+=h.join("");e.innerHTML='<div id="transcription" class="row"><div class="col-md-4"><button type="button" id="transcriptionbutton" class="btn btn-muted btn-block"><span id="show-transcript">Show transcript<\/span><\/button><\/div><div class="col-md-8"><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>  <div id="transcription-wrapper" class="hidden"><div id="transcription-container" class="transcription-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>';f.parentNode.insertBefore(e,f.nextSibling);document.getElementById("transcription-results").innerHTML=o;document.getElementById("search-transcription").addEventListener("click",function(){t.searchTrancription(document.getElementById("search-box").value)});document.getElementById("search-box").addEventListener("keyup",function(n){n.key==="Enter"&&(n.preventDefault(),t.searchTrancription(document.getElementById("search-box").value))});document.getElementById("next-search-result").addEventListener("click",function(){t.nextResult(1)});document.getElementById("previous-search-result").addEventListener("click",function(){t.nextResult(-1)});document.getElementById("transcriptionbutton").addEventListener("click",function(){var i=document.getElementById("transcription-wrapper"),n=t.base.querySelector(".embed.embed-ams#"+u);i.classList.contains("hidden")?(i.classList.remove("hidden"),document.getElementById("search-box").focus(),document.getElementById("show-transcript").innerHTML="Hide transcript",t.embedded&&(n.style.height=document.getElementById("ams-embed").offsetHeight+45+"px",n.classList.add("pb-0"))):(i.classList.add("hidden"),document.getElementById("show-transcript").innerHTML="Show transcript",t.embedded&&(n.style.height="",n.classList.remove("pb-0")))});document.addEventListener("click",function(n){if(n.target.matches(".transcription-word")&&n.target.parentNode.classList.contains("transcription-search-result")){var i=document.querySelectorAll(".transcription-search-result"),r=[].indexOf.call(i,n.target.parentNode),u=n.target.getAttribute("data-start-time");document.querySelector(".current").classList.remove("current");t.setButtons(i.length,r);n.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)},getVastTag:function(n){var u=VM.AmsVideo,t=n.getAttribute("data-vast-tag"),r=window.top.document.getElementById("ams-embed-settings"),i;return(u.embedded&&r&&t.length===0&&(t=r.getAttribute("data-vast-tag")),t)?(i=new URL(t.replace(/&amp;/g,"&")),i.searchParams.set("correlator",Math.floor(Math.random()*9e4)+1e4),i.toString()):t}};$(function(){VM.AmsVideo.preinit();VM.AmsVideo.init(!VM.AmsVideo.base.querySelector("body").classList.contains("noads")&&!VM.AmsVideo.base.querySelector("body").classList.contains("novideoads"))})