");return;case T:case E:for(var u=e.firstChild;u;)ey(u,t,i,r,s.slice()),u=u.nextSibling;return;case m:return ef(t,e.name,e.value);case g:return t.push(e.data.replace(/[<&>]/g,$));case f:return t.push("");case v:return t.push("<\!--",e.data,"-->");case S:var x=e.publicId,A=e.systemId;if(t.push("");else if(A&&"."!=A)t.push(" SYSTEM ",A,">");else{var P=e.internalSubset;P&&t.push(" [",P,"]"),t.push(">")}return;case b:return t.push("",e.target," ",e.data,"?>");case y:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function e_(e,t,i){e[t]=i}k.INVALID_STATE_ERR=(C[11]="Invalid state",11),k.SYNTAX_ERR=(C[12]="Syntax error",12),k.INVALID_MODIFICATION_ERR=(C[13]="Invalid modification",13),k.NAMESPACE_ERR=(C[14]="Invalid namespace",14),k.INVALID_ACCESS_ERR=(C[15]="Invalid access",15),L.prototype=Error.prototype,d(k,L),O.prototype={length:0,item:function(e){return e>=0&&e0},lookupPrefix:function(e){for(var t=this;t;){var i=t._nsMap;if(i){for(var r in i)if(Object.prototype.hasOwnProperty.call(i,r)&&i[r]===e)return r}t=t.nodeType==m?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var i=t._nsMap;if(i&&Object.prototype.hasOwnProperty.call(i,e))return i[e];t=t.nodeType==m?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},d(c,j),d(c,j.prototype),H.prototype={nodeName:"#document",nodeType:T,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==E){for(var i=e.firstChild;i;){var r=i.nextSibling;this.insertBefore(i,t),i=r}return e}return ee(this,e,t),e.ownerDocument=this,null===this.documentElement&&e.nodeType===p&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),G(this,e)},replaceChild:function(e,t){ee(this,e,t,Z),e.ownerDocument=this,t&&this.removeChild(t),X(e)&&(this.documentElement=e)},importNode:function(e,t){return function e(t,i,r){var s;switch(i.nodeType){case p:(s=i.cloneNode(!1)).ownerDocument=t;case E:break;case m:r=!0}if(s||(s=i.cloneNode(!1)),s.ownerDocument=t,s.parentNode=null,r)for(var n=i.firstChild;n;)s.appendChild(e(t,n,r)),n=n.nextSibling;return s}(this,e,t)},getElementById:function(e){var t=null;return V(this.documentElement,function(i){if(i.nodeType==p&&i.getAttribute("id")==e)return t=i,!0}),t},getElementsByClassName:function(e){var t=u(e);return new R(this,function(i){var r=[];return t.length>0&&V(i.documentElement,function(s){if(s!==i&&s.nodeType===p){var n=s.getAttribute("class");if(n){var a=e===n;if(!a){var o=u(n);a=t.every(function(e){return o&&-1!==o.indexOf(e)})}a&&r.push(s)}}}),r})},createElement:function(e){var t=new et;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new O,(t.attributes=new N)._ownerElement=t,t},createDocumentFragment:function(){var e=new eh;return e.ownerDocument=this,e.childNodes=new O,e},createTextNode:function(e){var t=new es;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new en;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new ea;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var i=new ec;return i.ownerDocument=this,i.tagName=i.nodeName=i.target=e,i.nodeValue=i.data=t,i},createAttribute:function(e){var t=new ei;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new ed;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var i=new et,r=t.split(":"),s=i.attributes=new N;return i.childNodes=new O,i.ownerDocument=this,i.nodeName=t,i.tagName=t,i.namespaceURI=e,2==r.length?(i.prefix=r[0],i.localName=r[1]):i.localName=t,s._ownerElement=i,i},createAttributeNS:function(e,t){var i=new ei,r=t.split(":");return i.ownerDocument=this,i.nodeName=t,i.name=t,i.namespaceURI=e,i.specified=!0,2==r.length?(i.prefix=r[0],i.localName=r[1]):i.localName=t,i}},h(H,j),et.prototype={nodeType:p,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var i=this.ownerDocument.createAttribute(e);i.value=i.nodeValue=""+t,this.setAttributeNode(i)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===E?this.insertBefore(e,null):(e.parentNode&&e.parentNode.removeChild(e),e.parentNode=this,e.previousSibling=this.lastChild,e.nextSibling=null,e.previousSibling?e.previousSibling.nextSibling=e:this.firstChild=e,this.lastChild=e,W(this.ownerDocument,this,e),e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var i=this.getAttributeNodeNS(e,t);i&&this.removeAttributeNode(i)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var i=this.getAttributeNodeNS(e,t);return i&&i.value||""},setAttributeNS:function(e,t,i){var r=this.ownerDocument.createAttributeNS(e,t);r.value=r.nodeValue=""+i,this.setAttributeNode(r)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new R(this,function(t){var i=[];return V(t,function(r){r!==t&&r.nodeType==p&&("*"===e||r.tagName==e)&&i.push(r)}),i})},getElementsByTagNameNS:function(e,t){return new R(this,function(i){var r=[];return V(i,function(s){s!==i&&s.nodeType===p&&("*"===e||s.namespaceURI===e)&&("*"===t||s.localName==t)&&r.push(s)}),r})}},H.prototype.getElementsByTagName=et.prototype.getElementsByTagName,H.prototype.getElementsByTagNameNS=et.prototype.getElementsByTagNameNS,h(et,j),ei.prototype.nodeType=m,h(ei,j),er.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw Error(C[I])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,i){i=this.data.substring(0,e)+i+this.data.substring(e+t),this.nodeValue=this.data=i,this.length=i.length}},h(er,j),es.prototype={nodeName:"#text",nodeType:g,splitText:function(e){var t=this.data,i=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var r=this.ownerDocument.createTextNode(i);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}},h(es,er),en.prototype={nodeName:"#comment",nodeType:v},h(en,er),ea.prototype={nodeName:"#cdata-section",nodeType:f},h(ea,er),eo.prototype.nodeType=S,h(eo,j),el.prototype.nodeType=w,h(el,j),eu.prototype.nodeType=_,h(eu,j),ed.prototype.nodeType=y,h(ed,j),eh.prototype.nodeName="#document-fragment",eh.prototype.nodeType=E,h(eh,j),ec.prototype.nodeType=b,h(ec,j),ep.prototype.serializeToString=function(e,t,i){return em.call(e,t,i)},j.prototype.toString=em;try{Object.defineProperty&&(Object.defineProperty(R.prototype,"length",{get:function(){return M(this),this.$$length}}),Object.defineProperty(j.prototype,"textContent",{get:function(){return function e(t){switch(t.nodeType){case p:case E:var i=[];for(t=t.firstChild;t;)7!==t.nodeType&&8!==t.nodeType&&i.push(e(t)),t=t.nextSibling;return i.join("");default:return t.nodeValue}}(this)},set:function(e){switch(this.nodeType){case p:case E:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),e_=function(e,t,i){e["$$"+t]=i})}catch(e){}i=q,r=ep}),L("2NAtx",function(e,t){D(e.exports,"XML_ENTITIES",()=>i,e=>i=e),D(e.exports,"HTML_ENTITIES",()=>r,e=>r=e);var i,r,s=P("hkG9E").freeze;i=s({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),r=s({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"\uD835\uDD04",afr:"\uD835\uDD1E",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"\uD835\uDD38",aopf:"\uD835\uDD52",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"\uD835\uDC9C",ascr:"\uD835\uDCB6",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"\uD835\uDD05",bfr:"\uD835\uDD1F",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"\uD835\uDD39",bopf:"\uD835\uDD53",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"\uD835\uDCB7",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"\uD835\uDD20",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"\uD835\uDD54",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"\uD835\uDC9E",cscr:"\uD835\uDCB8",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"\uD835\uDD07",dfr:"\uD835\uDD21",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"\uD835\uDD3B",dopf:"\uD835\uDD55",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"\uD835\uDC9F",dscr:"\uD835\uDCB9",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"\uD835\uDD08",efr:"\uD835\uDD22",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"\uD835\uDD3C",eopf:"\uD835\uDD56",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"\uD835\uDD09",ffr:"\uD835\uDD23",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"\uD835\uDD3D",fopf:"\uD835\uDD57",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"\uD835\uDCBB",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"\uD835\uDD0A",gfr:"\uD835\uDD24",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"\uD835\uDD3E",gopf:"\uD835\uDD58",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"\uD835\uDCA2",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"\uD835\uDD25",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"\uD835\uDD59",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"\uD835\uDCBD",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"\uD835\uDD26",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"\uD835\uDD40",iopf:"\uD835\uDD5A",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"\uD835\uDCBE",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"\uD835\uDD0D",jfr:"\uD835\uDD27",jmath:"ȷ",Jopf:"\uD835\uDD41",jopf:"\uD835\uDD5B",Jscr:"\uD835\uDCA5",jscr:"\uD835\uDCBF",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"\uD835\uDD0E",kfr:"\uD835\uDD28",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"\uD835\uDD42",kopf:"\uD835\uDD5C",Kscr:"\uD835\uDCA6",kscr:"\uD835\uDCC0",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"\uD835\uDD0F",lfr:"\uD835\uDD29",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"\uD835\uDD43",lopf:"\uD835\uDD5D",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"\uD835\uDCC1",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"\uD835\uDD10",mfr:"\uD835\uDD2A",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"\uD835\uDD44",mopf:"\uD835\uDD5E",mp:"∓",Mscr:"ℳ",mscr:"\uD835\uDCC2",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"\uD835\uDD11",nfr:"\uD835\uDD2B",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"\uD835\uDD5F",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"\uD835\uDCA9",nscr:"\uD835\uDCC3",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"\uD835\uDD12",ofr:"\uD835\uDD2C",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"\uD835\uDD46",oopf:"\uD835\uDD60",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"\uD835\uDCAA",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"\uD835\uDD13",pfr:"\uD835\uDD2D",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"\uD835\uDD61",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"\uD835\uDCAB",pscr:"\uD835\uDCC5",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"\uD835\uDD14",qfr:"\uD835\uDD2E",qint:"⨌",Qopf:"ℚ",qopf:"\uD835\uDD62",qprime:"⁗",Qscr:"\uD835\uDCAC",qscr:"\uD835\uDCC6",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"\uD835\uDD2F",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"\uD835\uDD63",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"\uD835\uDCC7",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"\uD835\uDD16",sfr:"\uD835\uDD30",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"\uD835\uDD4A",sopf:"\uD835\uDD64",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"\uD835\uDCAE",sscr:"\uD835\uDCC8",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"\uD835\uDD17",tfr:"\uD835\uDD31",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"\uD835\uDD4B",topf:"\uD835\uDD65",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"\uD835\uDCAF",tscr:"\uD835\uDCC9",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"\uD835\uDD18",ufr:"\uD835\uDD32",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"\uD835\uDD4C",uopf:"\uD835\uDD66",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"\uD835\uDCB0",uscr:"\uD835\uDCCA",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"\uD835\uDD19",vfr:"\uD835\uDD33",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"\uD835\uDD4D",vopf:"\uD835\uDD67",vprop:"∝",vrtri:"⊳",Vscr:"\uD835\uDCB1",vscr:"\uD835\uDCCB",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"\uD835\uDD1A",wfr:"\uD835\uDD34",Wopf:"\uD835\uDD4E",wopf:"\uD835\uDD68",wp:"℘",wr:"≀",wreath:"≀",Wscr:"\uD835\uDCB2",wscr:"\uD835\uDCCC",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"\uD835\uDD1B",xfr:"\uD835\uDD35",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"\uD835\uDD4F",xopf:"\uD835\uDD69",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"\uD835\uDCB3",xscr:"\uD835\uDCCD",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"\uD835\uDD1C",yfr:"\uD835\uDD36",YIcy:"Ї",yicy:"ї",Yopf:"\uD835\uDD50",yopf:"\uD835\uDD6A",Yscr:"\uD835\uDCB4",yscr:"\uD835\uDCCE",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"\uD835\uDD37",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"\uD835\uDD6B",Zscr:"\uD835\uDCB5",zscr:"\uD835\uDCCF",zwj:"",zwnj:""})}),L("1fO4L",function(e,t){D(e.exports,"XMLReader",()=>i,e=>i=e),D(e.exports,"ParseError",()=>r,e=>r=e);var i,r,s=P("hkG9E").NAMESPACE,n=/[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]/,a=RegExp("[\\-\\.0-9"+n.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),o=RegExp("^"+n.source+a.source+"*(?::"+n.source+a.source+"*)?$");function l(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,l)}function u(){}function d(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function h(e,t,i){for(var r=e.tagName,n=null,a=e.length;a--;){var o=e[a],l=o.qName,u=o.value,d=l.indexOf(":");if(d>0)var h=o.prefix=l.slice(0,d),p=l.slice(d+1),m="xmlns"===h&&p;else p=l,h=null,m="xmlns"===l&&"";o.localName=p,!1!==m&&(null==n&&(n={},c(i,i={})),i[m]=n[m]=u,o.uri=s.XMLNS,t.startPrefixMapping(m,u))}for(var a=e.length;a--;){var h=(o=e[a]).prefix;h&&("xml"===h&&(o.uri=s.XML),"xmlns"!==h&&(o.uri=i[h||""]))}var d=r.indexOf(":");d>0?(h=e.prefix=r.slice(0,d),p=e.localName=r.slice(d+1)):(h=null,p=e.localName=r);var g=e.uri=i[h||""];if(t.startElement(g,p,r,e),!e.closed)return e.currentNSMap=i,e.localNSMap=n,!0;if(t.endElement(g,p,r),n)for(h in n)Object.prototype.hasOwnProperty.call(n,h)&&t.endPrefixMapping(h)}function c(e,t){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}function p(){this.attributeNames={}}l.prototype=Error(),l.prototype.name=l.name,u.prototype={parse:function(e,t,i){var r=this.domBuilder;r.startDocument(),c(t,t={}),function(e,t,i,r,n){function a(e){var t,r=e.slice(1,-1);return Object.hasOwnProperty.call(i,r)?i[r]:"#"===r.charAt(0)?(t=parseInt(r.substr(1).replace("x","0x")))>65535?String.fromCharCode(55296+((t-=65536)>>10),56320+(1023&t)):String.fromCharCode(t):(n.error("entity not found:"+e),e)}function o(t){if(t>b){var i=e.substring(b,t).replace(/?\w+;/g,a);f&&u(b),r.characters(i,0,t-b),b=t}}function u(t,i){for(;t>=m&&(i=g.exec(e));)m=(c=i.index)+i[0].length,f.lineNumber++;f.columnNumber=t-c+1}for(var c=0,m=0,g=/.*(?:\r\n?|\n)|.*$/g,f=r.locator,y=[{currentNSMap:t}],_={},b=0;;){try{var v=e.indexOf("<",b);if(v<0){if(!e.substr(b).match(/^\s*$/)){var T=r.doc,S=T.createTextNode(e.substr(b));T.appendChild(S),r.currentElement=S}return}switch(v>b&&o(v),e.charAt(v+1)){case"/":var E=e.indexOf(">",v+3),w=e.substring(v+2,E).replace(/[ \t\n\r]+$/g,""),k=y.pop();E<0?(w=e.substring(v+2).replace(/[\s<].*/,""),n.error("end tag name: "+w+" is not complete:"+k.tagName),E=v+1+w.length):w.match(/\s)&&(w=w.replace(/[\s<].*/,""),n.error("end tag name: "+w+" maybe not complete"),E=v+1+w.length);var C=k.localNSMap,D=k.tagName==w;if(D||k.tagName&&k.tagName.toLowerCase()==w.toLowerCase()){if(r.endElement(k.uri,k.localName,w),C)for(var I in C)Object.prototype.hasOwnProperty.call(C,I)&&r.endPrefixMapping(I);D||n.fatalError("end tag name: "+w+" is not match the current start tagName:"+k.tagName)}else y.push(k);E++;break;case"?":f&&u(v),E=function(e,t,i){var r=e.indexOf("?>",t);if(r){var s=e.substring(t,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(s)return s[0].length,i.processingInstruction(s[1],s[2]),r+2}return -1}(e,v,r);break;case"!":f&&u(v),E=function(e,t,i,r){if("-"===e.charAt(t+2)){if("-"===e.charAt(t+3)){var s=e.indexOf("-->",t+4);if(s>t)return i.comment(e,t+4,s-t-4),s+3;r.error("Unclosed comment")}}else{if("CDATA["==e.substr(t+3,6)){var s=e.indexOf("]]>",t+9);return i.startCDATA(),i.characters(e,t+9,s-t-9),i.endCDATA(),s+3}var n=function(e,t){var i,r=[],s=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(s.lastIndex=t,s.exec(e);i=s.exec(e);)if(r.push(i),i[1])return r}(e,t),a=n.length;if(a>1&&/!doctype/i.test(n[0][0])){var o=n[1][0],l=!1,u=!1;a>3&&(/^public$/i.test(n[2][0])?(l=n[3][0],u=a>4&&n[4][0]):/^system$/i.test(n[2][0])&&(u=n[3][0]));var d=n[a-1];return i.startDTD(o,l,u),i.endDTD(),d.index+d[0].length}}return -1}(e,v,r,n);break;default:f&&u(v);var x=new p,A=y[y.length-1].currentNSMap,E=function(e,t,i,r,n,a){function o(e,t,r){i.attributeNames.hasOwnProperty(e)&&a.fatalError("Attribute "+e+" redefined"),i.addValue(e,t.replace(/[\t\n\r]/g," ").replace(/?\w+;/g,n),r)}for(var l,u,d=++t,h=0;;){var c=e.charAt(d);switch(c){case"=":if(1===h)l=e.slice(t,d),h=3;else if(2===h)h=3;else throw Error("attribute equal must after attrName");break;case"'":case'"':if(3===h||1===h){if(1===h&&(a.warning('attribute value must after "="'),l=e.slice(t,d)),t=d+1,(d=e.indexOf(c,t))>0)o(l,u=e.slice(t,d),t-1),h=5;else throw Error("attribute value no end '"+c+"' match")}else if(4==h)o(l,u=e.slice(t,d),t),a.warning('attribute "'+l+'" missed start quot('+c+")!!"),t=d+1,h=5;else throw Error('attribute value must after "="');break;case"/":switch(h){case 0:i.setTagName(e.slice(t,d));case 5:case 6:case 7:h=7,i.closed=!0;case 4:case 1:break;case 2:i.closed=!0;break;default:throw Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),0==h&&i.setTagName(e.slice(t,d)),d;case">":switch(h){case 0:i.setTagName(e.slice(t,d));case 5:case 6:case 7:break;case 4:case 1:"/"===(u=e.slice(t,d)).slice(-1)&&(i.closed=!0,u=u.slice(0,-1));case 2:2===h&&(u=l),4==h?(a.warning('attribute "'+u+'" missed quot(")!'),o(l,u,t)):(s.isHTML(r[""])&&u.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),o(u,u,t));break;case 3:throw Error("attribute value missed!!")}return d;case"":c=" ";default:if(c<=" ")switch(h){case 0:i.setTagName(e.slice(t,d)),h=6;break;case 1:l=e.slice(t,d),h=2;break;case 4:var u=e.slice(t,d);a.warning('attribute "'+u+'" missed quot(")!!'),o(l,u,t);case 5:h=6}else switch(h){case 2:i.tagName,s.isHTML(r[""])&&l.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),o(l,l,t),t=d,h=1;break;case 5:a.warning('attribute space is required"'+l+'"!!');case 6:h=1,t=d;break;case 3:h=4,t=d;break;case 7:throw Error("elements closed character '/' and '>' must be connected to")}}d++}}(e,v,x,A,a,n),P=x.length;if(!x.closed&&function(e,t,i,r){var s=r[i];return null==s&&((s=e.lastIndexOf(""+i+">"))",t),a=e.substring(t+1,n);if(/[&<]/.test(a))return/^script$/i.test(i)||(a=a.replace(/?\w+;/g,r)),s.characters(a,0,a.length),n}return t+1}(e,E,x.tagName,a,r):E++}}catch(e){if(e instanceof l)throw e;n.error("element parse error: "+e),E=-1}E>b?b=E:o(Math.max(v,b)+1)}}(e,t,i,r,this.errorHandler),r.endDocument()}},p.prototype={setTagName:function(e){if(!o.test(e))throw Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,i){if(!o.test(e))throw Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:i}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},i=u,r=l});var O={};O=JSON.parse('{"name":"@srgssr/pillarbox-web","description":"Pillarbox is the modern SRG SSR player","version":"1.12.0","type":"module","module":"dist/pillarbox.es.js","main":"dist/pillarbox.cjs.js","style":"./dist/pillarbox.min.css","types":"./dist/types/build.es.d.ts","exports":{".":{"import":"./dist/pillarbox.es.js","require":"./dist/pillarbox.cjs.js"}},"files":["dist/*","scss/*"],"directories":{"doc":"docs"},"targets":{"main":false,"github-page":{"publicUrl":"./","isLibrary":false,"outputFormat":"esmodule"}},"scripts":{"build":"npm run build:lib && npm run build:typings && npm run build:css","build:css":"sass ./scss/pillarbox.scss:dist/pillarbox.min.css --style compressed --source-map --load-path node_modules","build:lib":"rollup -c","build:typings":"npx -p typescript tsc","eslint":"eslint --ext .js src","generate:docs":"jsdoc --configure docs/api/jsdoc.json --verbose","github:page":"parcel build index.html --target github-page && npm run generate:docs","outdated":"npm outdated","prebuild":"rimraf dist","release:ci":"semantic-release","start":"parcel -p 6969 index.html","stylelint":"stylelint **/*.scss --custom-syntax --allow-empty-input","stylelint:fix":"stylelint **/*.scss --fix","test":"jest --verbose","test:watch":"jest --watch --verbose"},"keywords":[],"author":"","license":"MIT","bugs":{"url":"https://github.com/SRGSSR/pillarbox-web/issues"},"repository":{"type":"git","url":"git+https://github.com/SRGSSR/pillarbox-web.git"},"publishConfig":{"registry":"https://npm.pkg.github.com/","access":"public"},"devDependencies":{"@babel/core":"^7.24.1","@babel/preset-env":"^7.24.1","@commitlint/cli":"^18.4.3","@commitlint/config-conventional":"^18.4.3","@parcel/transformer-sass":"^2.11.0","@rollup/plugin-babel":"^6.0.4","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-terser":"^0.4.4","@semantic-release/changelog":"^6.0.3","@semantic-release/git":"^10.0.1","@semantic-release/github":"^ 9.2.5","@semantic-release/npm":"^11.0.2","@types/jest":"^29.5.12","babel-jest":"^29.5.0","better-docs":"^2.7.3","buffer":"^6.0.3","clean-jsdoc-theme":"^4.2.17","eslint":"^8.55.0","eslint-plugin-jest":"^27.2.2","husky":"^8.0.3","jest":"^29.5.0","jest-environment-jsdom":"^29.6.1","jsdoc":"^4.0.2","jsdoc-tsimport-plugin":"^1.0.5","parcel":"^2.11.0","rimraf":"^5.0.5","rollup":"^4.9.6","rollup-plugin-filesize":"^10.0.0","sass":"^1.70.0","semantic-release":"^23.0.0","stylelint":"^16.2.1","stylelint-config-rational-order":"^0.1.2","stylelint-order":"^6.0.4","typescript":"^5.3.3"},"dependencies":{"video.js":"^8.13.0","videojs-contrib-eme":"^3.11.2"}}');var R=P("eDick"),M=P("7pNCM"),N=P("jZhQX"),U={};U=function(e,t){var i,r=null;try{i=JSON.parse(e,t)}catch(e){r=e}return[r,i]};var B={},R=P("eDick"),F={};function q(){return(F=q=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&(r=setTimeout(function(){if(!i){i=!0,l.abort("timeout");var e=Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",a(e)}},e.timeout)),l.setRequestHeader)for(t in c)c.hasOwnProperty(t)&&l.setRequestHeader(t,c[t]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(l.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(l),l.send(h||null),l}(B=z).default=z,z.XMLHttpRequest=R.XMLHttpRequest||function(){},z.XDomainRequest="withCredentials"in new z.XMLHttpRequest?z.XMLHttpRequest:R.XDomainRequest,function(e,t){for(var i=0;i-1},t.trigger=function(e){var t=this.listeners[e];if(t){if(2==arguments.length)for(var i=t.length,r=0;r0)throw Error("Invalid string. Length must be a multiple of 4");var i=e.indexOf("=");-1===i&&(i=t);var r=i===t?0:4-i%4;return[i,r]}(e),s=r[0],n=r[1],a=new en((s+n)*3/4-n),o=0,l=n>0?s-4:s;for(i=0;i>16&255,a[o++]=t>>8&255,a[o++]=255&t;return 2===n&&(t=es[e.charCodeAt(i)]<<2|es[e.charCodeAt(i+1)]>>4,a[o++]=255&t),1===n&&(t=es[e.charCodeAt(i)]<<10|es[e.charCodeAt(i+1)]<<4|es[e.charCodeAt(i+2)]>>2,a[o++]=t>>8&255,a[o++]=255&t),a},m=function(e){for(var t,i=e.length,r=i%3,s=[],n=0,a=i-r;n>18&63]+er[r>>12&63]+er[r>>6&63]+er[63&r]);return s.join("")}(e,n,n+16383>a?a:n+16383));return 1===r?s.push(er[(t=e[i-1])>>2]+er[t<<4&63]+"=="):2===r&&s.push(er[(t=(e[i-2]<<8)+e[i-1])>>10]+er[t>>4&63]+er[t<<2&63]+"="),s.join("")};for(var er=[],es=[],en="undefined"!=typeof Uint8Array?Uint8Array:Array,ea="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",eo=0,el=ea.length;eo>1,d=-7,h=i?s-1:0,c=i?-1:1,p=e[t+h];for(h+=c,n=p&(1<<-d)-1,p>>=-d,d+=o;d>0;n=256*n+e[t+h],h+=c,d-=8);for(a=n&(1<<-d)-1,n>>=-d,d+=r;d>0;a=256*a+e[t+h],h+=c,d-=8);if(0===n)n=1-u;else{if(n===l)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),n-=u}return(p?-1:1)*a*Math.pow(2,n-r)},f=function(e,t,i,r,s,n){var a,o,l,u=8*n-s-1,d=(1<>1,c=23===s?5960464477539062e-23:0,p=r?0:n-1,m=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(isNaN(t=Math.abs(t))||t===1/0?(o=isNaN(t)?1:0,a=d):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+h>=1?t+=c/l:t+=c*Math.pow(2,1-h),t*l>=2&&(a++,l/=2),a+h>=d?(o=0,a=d):a+h>=1?(o=(t*l-1)*Math.pow(2,s),a+=h):(o=t*Math.pow(2,h-1)*Math.pow(2,s),a=0));s>=8;e[i+p]=255&o,p+=m,o/=256,s-=8);for(a=a<0;e[i+p]=255&a,p+=m,a/=256,u-=8);e[i+p-m]|=128*g};const eu="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function ed(e){if(e>2147483647)throw RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,eh.prototype),t}function eh(e,t,i){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return em(e)}return ec(e,t,i)}function ec(e,t,i){if("string"==typeof e)return function(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!eh.isEncoding(t))throw TypeError("Unknown encoding: "+t);let i=0|e_(e,t),r=ed(i),s=r.write(e,t);return s!==i&&(r=r.slice(0,s)),r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(ej(e,Uint8Array)){let t=new Uint8Array(e);return ef(t.buffer,t.byteOffset,t.byteLength)}return eg(e)}(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(ej(e,ArrayBuffer)||e&&ej(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(ej(e,SharedArrayBuffer)||e&&ej(e.buffer,SharedArrayBuffer)))return ef(e,t,i);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');let r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return eh.from(r,t,i);let s=function(e){var t;if(eh.isBuffer(e)){let t=0|ey(e.length),i=ed(t);return 0===i.length||e.copy(i,0,0,t),i}return void 0!==e.length?"number"!=typeof e.length||(t=e.length)!=t?ed(0):eg(e):"Buffer"===e.type&&Array.isArray(e.data)?eg(e.data):void 0}(e);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return eh.from(e[Symbol.toPrimitive]("string"),t,i);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function ep(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function em(e){return ep(e),ed(e<0?0:0|ey(e))}function eg(e){let t=e.length<0?0:0|ey(e.length),i=ed(t);for(let r=0;r=2147483647)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function e_(e,t){if(eh.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||ej(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let i=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===i)return 0;let s=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":return eB(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return eF(e).length;default:if(s)return r?-1:eB(e).length;t=(""+t).toLowerCase(),s=!0}}function eb(e,t,i){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===i||i>this.length)&&(i=this.length),i<=0||(i>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,i){let r=e.length;(!t||t<0)&&(t=0),(!i||i<0||i>r)&&(i=r);let s="";for(let r=t;r2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),(n=i=+i)!=n&&(i=s?0:e.length-1),i<0&&(i=e.length+i),i>=e.length){if(s)return -1;i=e.length-1}else if(i<0){if(!s)return -1;i=0}if("string"==typeof t&&(t=eh.from(t,r)),eh.isBuffer(t))return 0===t.length?-1:eS(e,t,i,r,s);if("number"==typeof t)return(t&=255,"function"==typeof Uint8Array.prototype.indexOf)?s?Uint8Array.prototype.indexOf.call(e,t,i):Uint8Array.prototype.lastIndexOf.call(e,t,i):eS(e,[t],i,r,s);throw TypeError("val must be string, number or Buffer")}function eS(e,t,i,r,s){let n,a=1,o=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return -1;a=2,o/=2,l/=2,i/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(s){let r=-1;for(n=i;no&&(i=o-l),n=i;n>=0;n--){let i=!0;for(let r=0;r239?4:t>223?3:t>191?2:1;if(s+a<=i){let i,r,o,l;switch(a){case 1:t<128&&(n=t);break;case 2:(192&(i=e[s+1]))==128&&(l=(31&t)<<6|63&i)>127&&(n=l);break;case 3:i=e[s+1],r=e[s+2],(192&i)==128&&(192&r)==128&&(l=(15&t)<<12|(63&i)<<6|63&r)>2047&&(l<55296||l>57343)&&(n=l);break;case 4:i=e[s+1],r=e[s+2],o=e[s+3],(192&i)==128&&(192&r)==128&&(192&o)==128&&(l=(15&t)<<18|(63&i)<<12|(63&r)<<6|63&o)>65535&&l<1114112&&(n=l)}}null===n?(n=65533,a=1):n>65535&&(n-=65536,r.push(n>>>10&1023|55296),n=56320|1023&n),r.push(n),s+=a}return function(e){let t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);let i="",r=0;for(;ri)throw RangeError("Trying to access beyond buffer length")}function ek(e,t,i,r,s,n){if(!eh.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>s||te.length)throw RangeError("Index out of range")}function eC(e,t,i,r,s){eR(t,r,s,e,i,7);let n=Number(t&BigInt(4294967295));e[i++]=n,n>>=8,e[i++]=n,n>>=8,e[i++]=n,n>>=8,e[i++]=n;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[i++]=a,a>>=8,e[i++]=a,a>>=8,e[i++]=a,a>>=8,e[i++]=a,i}function eD(e,t,i,r,s){eR(t,r,s,e,i,7);let n=Number(t&BigInt(4294967295));e[i+7]=n,n>>=8,e[i+6]=n,n>>=8,e[i+5]=n,n>>=8,e[i+4]=n;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[i+3]=a,a>>=8,e[i+2]=a,a>>=8,e[i+1]=a,a>>=8,e[i]=a,i+8}function eI(e,t,i,r,s,n){if(i+r>e.length||i<0)throw RangeError("Index out of range")}function ex(e,t,i,r,s){return t=+t,i>>>=0,s||eI(e,t,i,4,34028234663852886e22,-34028234663852886e22),f(e,t,i,r,23,4),i+4}function eA(e,t,i,r,s){return t=+t,i>>>=0,s||eI(e,t,i,8,17976931348623157e292,-17976931348623157e292),f(e,t,i,r,52,8),i+8}eh.TYPED_ARRAY_SUPPORT=function(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),eh.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(eh.prototype,"parent",{enumerable:!0,get:function(){if(eh.isBuffer(this))return this.buffer}}),Object.defineProperty(eh.prototype,"offset",{enumerable:!0,get:function(){if(eh.isBuffer(this))return this.byteOffset}}),eh.poolSize=8192,eh.from=function(e,t,i){return ec(e,t,i)},Object.setPrototypeOf(eh.prototype,Uint8Array.prototype),Object.setPrototypeOf(eh,Uint8Array),eh.alloc=function(e,t,i){return(ep(e),e<=0)?ed(e):void 0!==t?"string"==typeof i?ed(e).fill(t,i):ed(e).fill(t):ed(e)},eh.allocUnsafe=function(e){return em(e)},eh.allocUnsafeSlow=function(e){return em(e)},eh.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==eh.prototype},eh.compare=function(e,t){if(ej(e,Uint8Array)&&(e=eh.from(e,e.offset,e.byteLength)),ej(t,Uint8Array)&&(t=eh.from(t,t.offset,t.byteLength)),!eh.isBuffer(e)||!eh.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let i=e.length,r=t.length;for(let s=0,n=Math.min(i,r);sr.length?(eh.isBuffer(t)||(t=eh.from(t)),t.copy(r,s)):Uint8Array.prototype.set.call(r,t,s);else if(eh.isBuffer(t))t.copy(r,s);else throw TypeError('"list" argument must be an Array of Buffers');s+=t.length}return r},eh.byteLength=e_,eh.prototype._isBuffer=!0,eh.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t50&&(e+=" ... "),""},eu&&(eh.prototype[eu]=eh.prototype.inspect),eh.prototype.compare=function(e,t,i,r,s){if(ej(e,Uint8Array)&&(e=eh.from(e,e.offset,e.byteLength)),!eh.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===i&&(i=e?e.length:0),void 0===r&&(r=0),void 0===s&&(s=this.length),t<0||i>e.length||r<0||s>this.length)throw RangeError("out of range index");if(r>=s&&t>=i)return 0;if(r>=s)return -1;if(t>=i)return 1;if(t>>>=0,i>>>=0,r>>>=0,s>>>=0,this===e)return 0;let n=s-r,a=i-t,o=Math.min(n,a),l=this.slice(r,s),u=e.slice(t,i);for(let e=0;e>>=0,isFinite(i)?(i>>>=0,void 0===r&&(r="utf8")):(r=i,i=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let c=this.length-t;if((void 0===i||i>c)&&(i=c),e.length>0&&(i<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let p=!1;for(;;)switch(r){case"hex":return function(e,t,i,r){let s;i=Number(i)||0;let n=e.length-i;r?(r=Number(r))>n&&(r=n):r=n;let a=t.length;for(r>a/2&&(r=a/2),s=0;s>8,s.push(i%256),s.push(r);return s}(e,this.length-d),this,d,h);default:if(p)throw TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),p=!0}},eh.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},eh.prototype.slice=function(e,t){let i=this.length;e=~~e,t=void 0===t?i:~~t,e<0?(e+=i)<0&&(e=0):e>i&&(e=i),t<0?(t+=i)<0&&(t=0):t>i&&(t=i),t>>=0,t>>>=0,i||ew(e,t,this.length);let r=this[e],s=1,n=0;for(;++n>>=0,t>>>=0,i||ew(e,t,this.length);let r=this[e+--t],s=1;for(;t>0&&(s*=256);)r+=this[e+--t]*s;return r},eh.prototype.readUint8=eh.prototype.readUInt8=function(e,t){return e>>>=0,t||ew(e,1,this.length),this[e]},eh.prototype.readUint16LE=eh.prototype.readUInt16LE=function(e,t){return e>>>=0,t||ew(e,2,this.length),this[e]|this[e+1]<<8},eh.prototype.readUint16BE=eh.prototype.readUInt16BE=function(e,t){return e>>>=0,t||ew(e,2,this.length),this[e]<<8|this[e+1]},eh.prototype.readUint32LE=eh.prototype.readUInt32LE=function(e,t){return e>>>=0,t||ew(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},eh.prototype.readUint32BE=eh.prototype.readUInt32BE=function(e,t){return e>>>=0,t||ew(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},eh.prototype.readBigUInt64LE=eV(function(e){eM(e>>>=0,"offset");let t=this[e],i=this[e+7];(void 0===t||void 0===i)&&eN(e,this.length-8);let r=t+256*this[++e]+65536*this[++e]+16777216*this[++e],s=this[++e]+256*this[++e]+65536*this[++e]+16777216*i;return BigInt(r)+(BigInt(s)<>>=0,"offset");let t=this[e],i=this[e+7];(void 0===t||void 0===i)&&eN(e,this.length-8);let r=16777216*t+65536*this[++e]+256*this[++e]+this[++e],s=16777216*this[++e]+65536*this[++e]+256*this[++e]+i;return(BigInt(r)<>>=0,t>>>=0,i||ew(e,t,this.length);let r=this[e],s=1,n=0;for(;++n=(s*=128)&&(r-=Math.pow(2,8*t)),r},eh.prototype.readIntBE=function(e,t,i){e>>>=0,t>>>=0,i||ew(e,t,this.length);let r=t,s=1,n=this[e+--r];for(;r>0&&(s*=256);)n+=this[e+--r]*s;return n>=(s*=128)&&(n-=Math.pow(2,8*t)),n},eh.prototype.readInt8=function(e,t){return(e>>>=0,t||ew(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},eh.prototype.readInt16LE=function(e,t){e>>>=0,t||ew(e,2,this.length);let i=this[e]|this[e+1]<<8;return 32768&i?4294901760|i:i},eh.prototype.readInt16BE=function(e,t){e>>>=0,t||ew(e,2,this.length);let i=this[e+1]|this[e]<<8;return 32768&i?4294901760|i:i},eh.prototype.readInt32LE=function(e,t){return e>>>=0,t||ew(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},eh.prototype.readInt32BE=function(e,t){return e>>>=0,t||ew(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},eh.prototype.readBigInt64LE=eV(function(e){eM(e>>>=0,"offset");let t=this[e],i=this[e+7];return(void 0===t||void 0===i)&&eN(e,this.length-8),(BigInt(this[e+4]+256*this[e+5]+65536*this[e+6]+(i<<24))<>>=0,"offset");let t=this[e],i=this[e+7];return(void 0===t||void 0===i)&&eN(e,this.length-8),(BigInt((t<<24)+65536*this[++e]+256*this[++e]+this[++e])<>>=0,t||ew(e,4,this.length),g(this,e,!0,23,4)},eh.prototype.readFloatBE=function(e,t){return e>>>=0,t||ew(e,4,this.length),g(this,e,!1,23,4)},eh.prototype.readDoubleLE=function(e,t){return e>>>=0,t||ew(e,8,this.length),g(this,e,!0,52,8)},eh.prototype.readDoubleBE=function(e,t){return e>>>=0,t||ew(e,8,this.length),g(this,e,!1,52,8)},eh.prototype.writeUintLE=eh.prototype.writeUIntLE=function(e,t,i,r){if(e=+e,t>>>=0,i>>>=0,!r){let r=Math.pow(2,8*i)-1;ek(this,e,t,i,r,0)}let s=1,n=0;for(this[t]=255&e;++n>>=0,i>>>=0,!r){let r=Math.pow(2,8*i)-1;ek(this,e,t,i,r,0)}let s=i-1,n=1;for(this[t+s]=255&e;--s>=0&&(n*=256);)this[t+s]=e/n&255;return t+i},eh.prototype.writeUint8=eh.prototype.writeUInt8=function(e,t,i){return e=+e,t>>>=0,i||ek(this,e,t,1,255,0),this[t]=255&e,t+1},eh.prototype.writeUint16LE=eh.prototype.writeUInt16LE=function(e,t,i){return e=+e,t>>>=0,i||ek(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},eh.prototype.writeUint16BE=eh.prototype.writeUInt16BE=function(e,t,i){return e=+e,t>>>=0,i||ek(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},eh.prototype.writeUint32LE=eh.prototype.writeUInt32LE=function(e,t,i){return e=+e,t>>>=0,i||ek(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},eh.prototype.writeUint32BE=eh.prototype.writeUInt32BE=function(e,t,i){return e=+e,t>>>=0,i||ek(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},eh.prototype.writeBigUInt64LE=eV(function(e,t=0){return eC(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),eh.prototype.writeBigUInt64BE=eV(function(e,t=0){return eD(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),eh.prototype.writeIntLE=function(e,t,i,r){if(e=+e,t>>>=0,!r){let r=Math.pow(2,8*i-1);ek(this,e,t,i,r-1,-r)}let s=0,n=1,a=0;for(this[t]=255&e;++s>0)-a&255;return t+i},eh.prototype.writeIntBE=function(e,t,i,r){if(e=+e,t>>>=0,!r){let r=Math.pow(2,8*i-1);ek(this,e,t,i,r-1,-r)}let s=i-1,n=1,a=0;for(this[t+s]=255&e;--s>=0&&(n*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/n>>0)-a&255;return t+i},eh.prototype.writeInt8=function(e,t,i){return e=+e,t>>>=0,i||ek(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},eh.prototype.writeInt16LE=function(e,t,i){return e=+e,t>>>=0,i||ek(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},eh.prototype.writeInt16BE=function(e,t,i){return e=+e,t>>>=0,i||ek(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},eh.prototype.writeInt32LE=function(e,t,i){return e=+e,t>>>=0,i||ek(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},eh.prototype.writeInt32BE=function(e,t,i){return e=+e,t>>>=0,i||ek(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},eh.prototype.writeBigInt64LE=eV(function(e,t=0){return eC(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),eh.prototype.writeBigInt64BE=eV(function(e,t=0){return eD(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),eh.prototype.writeFloatLE=function(e,t,i){return ex(this,e,t,!0,i)},eh.prototype.writeFloatBE=function(e,t,i){return ex(this,e,t,!1,i)},eh.prototype.writeDoubleLE=function(e,t,i){return eA(this,e,t,!0,i)},eh.prototype.writeDoubleBE=function(e,t,i){return eA(this,e,t,!1,i)},eh.prototype.copy=function(e,t,i,r){if(!eh.isBuffer(e))throw TypeError("argument should be a Buffer");if(i||(i=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw RangeError("Index out of range");if(r<0)throw RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,i=void 0===i?this.length:i>>>0,e||(e=0),"number"==typeof e)for(s=t;s=r+4;i-=3)t=`_${e.slice(i-3,i)}${t}`;return`${e.slice(0,i)}${t}`}function eR(e,t,i,r,s,n){if(e>i||e3?0===t||t===BigInt(0)?`>= 0${s} and < 2${s} ** ${(n+1)*8}${s}`:`>= -(2${s} ** ${(n+1)*8-1}${s}) and < 2 ** ${(n+1)*8-1}${s}`:`>= ${t}${s} and <= ${i}${s}`,new eP.ERR_OUT_OF_RANGE("value",r,e)}eM(s,"offset"),(void 0===r[s]||void 0===r[s+n])&&eN(s,r.length-(n+1))}function eM(e,t){if("number"!=typeof e)throw new eP.ERR_INVALID_ARG_TYPE(t,"number",e)}function eN(e,t,i){if(Math.floor(e)!==e)throw eM(e,i),new eP.ERR_OUT_OF_RANGE(i||"offset","an integer",e);if(t<0)throw new eP.ERR_BUFFER_OUT_OF_BOUNDS;throw new eP.ERR_OUT_OF_RANGE(i||"offset",`>= ${i?1:0} and <= ${t}`,e)}eL("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),eL("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),eL("ERR_OUT_OF_RANGE",function(e,t,i){let r=`The value of "${e}" is out of range.`,s=i;return Number.isInteger(i)&&Math.abs(i)>4294967296?s=eO(String(i)):"bigint"==typeof i&&(s=String(i),(i>BigInt(2)**BigInt(32)||i<-(BigInt(2)**BigInt(32)))&&(s=eO(s)),s+="n"),r+=` It must be ${t}. Received ${s}`},RangeError);const eU=/[^+/0-9A-Za-z-_]/g;function eB(e,t){let i;t=t||1/0;let r=e.length,s=null,n=[];for(let a=0;a55295&&i<57344){if(!s){if(i>56319||a+1===r){(t-=3)>-1&&n.push(239,191,189);continue}s=i;continue}if(i<56320){(t-=3)>-1&&n.push(239,191,189),s=i;continue}i=(s-55296<<10|i-56320)+65536}else s&&(t-=3)>-1&&n.push(239,191,189);if(s=null,i<128){if((t-=1)<0)break;n.push(i)}else if(i<2048){if((t-=2)<0)break;n.push(i>>6|192,63&i|128)}else if(i<65536){if((t-=3)<0)break;n.push(i>>12|224,i>>6&63|128,63&i|128)}else if(i<1114112){if((t-=4)<0)break;n.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}else throw Error("Invalid code point")}return n}function eF(e){return p(function(e){if((e=(e=e.split("=")[0]).trim().replace(eU,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function eq(e,t,i,r){let s;for(s=0;s=t.length)&&!(s>=e.length);++s)t[s+i]=e[s];return s}function ej(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}const e$=function(){let e="0123456789abcdef",t=Array(256);for(let i=0;i<16;++i){let r=16*i;for(let s=0;s<16;++s)t[r+s]=e[i]+e[s]}return t}();function eV(e){return"undefined"==typeof BigInt?eH:e}function eH(){throw Error("BigInt not supported")}class ez extends ei{constructor(){super(),this.buffer=""}push(e){let t;for(this.buffer+=e,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)}}const eW=function(e){let t=/([0-9.]*)?@?([0-9.]*)?/.exec(e||""),i={};return t[1]&&(i.length=parseInt(t[1],10)),t[2]&&(i.offset=parseInt(t[2],10)),i},eG=function(e){let t;let i={};if(!e)return i;let r=e.split(RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),s=r.length;for(;s--;)""!==r[s]&&((t=/([^=]*)=(.*)/.exec(r[s]).slice(1))[0]=t[0].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^['"](.*)['"]$/g,"$1"),i[t[0]]=t[1]);return i};class eK extends ei{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,i;if(0!==(e=e.trim()).length){if("#"!==e[0]){this.trigger("data",{type:"uri",uri:e});return}this.tagMappers.reduce((t,i)=>{let r=i(e);return r===e?t:t.concat([r])},[e]).forEach(e=>{for(let t=0;te),this.customParsers.push(s=>{if(e.exec(s))return this.trigger("data",{type:"custom",data:i(s),customType:t,segment:r}),!0})}addTagMapper({expression:e,map:t}){this.tagMappers.push(i=>e.test(i)?t(i):i)}}const eX=e=>e.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),eY=function(e){let t={};return Object.keys(e).forEach(function(i){t[eX(i)]=e[i]}),t},eQ=function(e){let{serverControl:t,targetDuration:i,partTargetDuration:r}=e;if(!t)return;let s="#EXT-X-SERVER-CONTROL",n="holdBack",a="partHoldBack",o=i&&3*i,l=r&&2*r;i&&!t.hasOwnProperty(n)&&(t[n]=o,this.trigger("info",{message:`${s} defaulting HOLD-BACK to targetDuration * 3 (${o}).`})),o&&t[n]{!s.uri&&(s.parts||s.preloadHints)&&(!s.map&&e&&(s.map=e),!s.key&&t&&(s.key=t),s.timeline||"number"!=typeof l||(s.timeline=l),this.manifest.preloadSegment=s)}),this.parseStream.on("data",function(c){let p,m;({tag(){(({version(){c.version&&(this.manifest.version=c.version)},"allow-cache"(){this.manifest.allowCache=c.allowed,"allowed"in c||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){let e={};"length"in c&&(s.byterange=e,e.length=c.length,"offset"in c||(c.offset=u)),"offset"in c&&(s.byterange=e,e.offset=c.offset),u=e.offset+e.length},endlist(){this.manifest.endList=!0},inf(){"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"})),c.title&&(s.title=c.title),c.duration>0&&(s.duration=c.duration),0===c.duration&&(s.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=r},key(){if(!c.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if("NONE"===c.attributes.METHOD){t=null;return}if(!c.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if("com.apple.streamingkeydelivery"===c.attributes.KEYFORMAT){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:c.attributes};return}if("com.microsoft.playready"===c.attributes.KEYFORMAT){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:c.attributes.URI};return}if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===c.attributes.KEYFORMAT){if(-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(c.attributes.METHOD)){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if("SAMPLE-AES-CENC"===c.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==c.attributes.URI.substring(0,23)){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(c.attributes.KEYID&&"0x"===c.attributes.KEYID.substring(0,2))){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:c.attributes.KEYFORMAT,keyId:c.attributes.KEYID.substring(2)},pssh:function(e){for(var t=I(R).atob?I(R).atob(e):eh.from(e,"base64").toString("binary"),i=new Uint8Array(t.length),r=0;r(t.programDateTime=e-1e3*t.duration,t.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(c.duration)||c.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+c.duration});return}this.manifest.targetDuration=c.duration,eQ.call(this,this.manifest)},start(){if(!c.attributes||isNaN(c.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:c.attributes["TIME-OFFSET"],precise:c.attributes.PRECISE}},"cue-out"(){s.cueOut=c.data},"cue-out-cont"(){s.cueOutCont=c.data},"cue-in"(){s.cueIn=c.data},skip(){this.manifest.skip=eY(c.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",c.attributes,["SKIPPED-SEGMENTS"])},part(){n=!0;let e=this.manifest.segments.length,t=eY(c.attributes);s.parts=s.parts||[],s.parts.push(t),t.byterange&&(t.byterange.hasOwnProperty("offset")||(t.byterange.offset=d),d=t.byterange.offset+t.byterange.length);let i=s.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${i} for segment #${e}`,c.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((e,t)=>{e.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${t} lacks required attribute(s): LAST-PART`})})},"server-control"(){let e=this.manifest.serverControl=eY(c.attributes);e.hasOwnProperty("canBlockReload")||(e.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),eQ.call(this,this.manifest),e.canSkipDateranges&&!e.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"(){let e=this.manifest.segments.length,t=eY(c.attributes),i=t.type&&"PART"===t.type;s.preloadHints=s.preloadHints||[],s.preloadHints.push(t),t.byterange&&!t.byterange.hasOwnProperty("offset")&&(t.byterange.offset=i?d:0,i&&(d=t.byterange.offset+t.byterange.length));let r=s.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${r} for segment #${e}`,c.attributes,["TYPE","URI"]),t.type)for(let i=0;ie.id===t.id);this.manifest.dateRanges[e]=I(F)(this.manifest.dateRanges[e],t),h[t.id]=I(F)(h[t.id],t),this.manifest.dateRanges.pop()}else h[t.id]=t},"independent-segments"(){this.manifest.independentSegments=!0},"content-steering"(){this.manifest.contentSteering=eY(c.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",c.attributes,["SERVER-URI"])}})[c.tagType]||a).call(i)},uri(){s.uri=c.uri,r.push(s),!this.manifest.targetDuration||"duration"in s||(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),s.duration=this.manifest.targetDuration),t&&(s.key=t),s.timeline=l,e&&(s.map=e),d=0,null!==this.lastProgramDateTime&&(s.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=1e3*s.duration),s={}},comment(){},custom(){c.segment?(s.custom=s.custom||{},s.custom[c.customType]=c.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[c.customType]=c.data)}})[c.type].call(i)})}warnOnMissingAttributes_(e,t,i){let r=[];i.forEach(function(e){t.hasOwnProperty(e)||r.push(e)}),r.length&&this.trigger("warn",{message:`${e} lacks required attribute(s): ${r.join(", ")}`})}push(e){this.lineStream.push(e)}end(){this.lineStream.push("\n"),this.manifest.dateRanges.length&&null===this.lastProgramDateTime&&this.trigger("warn",{message:"A playlist with EXT-X-DATERANGE tag must contain atleast one EXT-X-PROGRAM-DATE-TIME tag"}),this.lastProgramDateTime=null,this.trigger("end")}addParser(e){this.parseStream.addParser(e)}addTagMapper(e){this.parseStream.addTagMapper(e)}}var R=P("eDick"),eZ={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^/},e0=["video","audio","text"],e1=["Video","Audio","Text"],e2=function(e){return e?e.replace(/avc1\.(\d+)\.(\d+)/i,function(e,t,i){return"avc1."+("00"+Number(t).toString(16)).slice(-2)+"00"+("00"+Number(i).toString(16)).slice(-2)}):e},e4=function(e){void 0===e&&(e="");var t=e.split(","),i=[];return t.forEach(function(e){var t;e=e.trim(),e0.forEach(function(r){var s=eZ[r].exec(e.toLowerCase());if(s&&!(s.length<=1)){t=r;var n=e.substring(0,s[1].length),a=e.replace(n,"");i.push({type:n,details:a,mediaType:r})}}),t||i.push({type:e,details:"",mediaType:"unknown"})}),i},e8=function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i=e.mediaGroups.AUDIO[t];if(!i)return null;for(var r in i){var s=i[r];if(s.default&&s.playlists)return e4(s.playlists[0].attributes.CODECS)}return null},e5=function(e){return void 0===e&&(e=""),eZ.audio.test(e.trim().toLowerCase())},e3=function(e){if(e&&"string"==typeof e){var t,i=e.toLowerCase().split(",").map(function(e){return e2(e.trim())}),r="video";1===i.length&&e5(i[0])?r="audio":1===i.length&&(void 0===(t=i[0])&&(t=""),eZ.text.test(t.trim().toLowerCase()))&&(r="application");var s="mp4";return i.every(function(e){return eZ.mp4.test(e)})?s="mp4":i.every(function(e){return eZ.webm.test(e)})?s="webm":i.every(function(e){return eZ.ogg.test(e)})&&(s="ogg"),r+"/"+s+';codecs="'+e+'"'}},e6=function(e){return void 0===e&&(e=""),I(R).MediaSource&&I(R).MediaSource.isTypeSupported&&I(R).MediaSource.isTypeSupported(e3(e))||!1},e7=function(e){return void 0===e&&(e=""),e.toLowerCase().split(",").every(function(e){e=e.trim();for(var t=0;tl&&(o-=l,o-=l,o-=tn(2))}return Number(o)},tl=function(e,t){var i=(void 0===t?{}:t).le,r=void 0!==i&&i;("bigint"!=typeof e&&"number"!=typeof e||"number"==typeof e&&e!=e)&&(e=0);for(var s=Math.ceil((e=tn(e)).toString(2).length/8),n=new Uint8Array(new ArrayBuffer(s)),a=0;a=t.length&&l.call(t,function(t,i){return t===(o[i]?o[i]&e[n+i]:e[n+i])})},R=P("eDick"),tp=function(e,t,i){t.forEach(function(t){for(var r in e.mediaGroups[t])for(var s in e.mediaGroups[t][r])i(e.mediaGroups[t][r][s],t,r,s)})},R=P("eDick"),tm=P("2YubT");tm.DOMImplementation,tm.XMLSerializer,y=P("c1Wy2").DOMParser;const tg=e=>!!e&&"object"==typeof e,tf=(...e)=>e.reduce((e,t)=>("object"!=typeof t||Object.keys(t).forEach(i=>{Array.isArray(e[i])&&Array.isArray(t[i])?e[i]=e[i].concat(t[i]):tg(e[i])&&tg(t[i])?e[i]=tf(e[i],t[i]):e[i]=t[i]}),e),{}),ty=e=>Object.keys(e).map(t=>e[t]),t_=(e,t)=>{let i=[];for(let r=e;re.reduce((e,t)=>e.concat(t),[]),tv=e=>{if(!e.length)return[];let t=[];for(let i=0;ie.reduce((e,i,r)=>(i[t]&&e.push(r),e),[]),tS=(e,t)=>ty(e.reduce((e,i)=>(i.forEach(i=>{e[t(i)]=i}),e),{}));var tE={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",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const tw=({baseUrl:e="",source:t="",range:i="",indexRange:r=""})=>{let s={uri:t,resolvedUri:et(e||"",t)};if(i||r){let e;let t=(i||r).split("-"),n=I(R).BigInt?I(R).BigInt(t[0]):parseInt(t[0],10),a=I(R).BigInt?I(R).BigInt(t[1]):parseInt(t[1],10);n{let t;return t="bigint"==typeof e.offset||"bigint"==typeof e.length?I(R).BigInt(e.offset)+I(R).BigInt(e.length)-I(R).BigInt(1):e.offset+e.length-1,`${e.offset}-${t}`},tC=e=>(e&&"number"!=typeof e&&(e=parseInt(e,10)),isNaN(e))?null:e,tD={static(e){let{duration:t,timescale:i=1,sourceDuration:r,periodDuration:s}=e,n=tC(e.endNumber),a=t/i;return"number"==typeof n?{start:0,end:n}:"number"==typeof s?{start:0,end:s/a}:{start:0,end:r/a}},dynamic(e){let{NOW:t,clientOffset:i,availabilityStartTime:r,timescale:s=1,duration:n,periodStart:a=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:l=1/0}=e,u=tC(e.endNumber),d=(t+i)/1e3,h=r+a;return{start:Math.max(0,Math.floor((d-h-l)*s/n)),end:"number"==typeof u?u:Math.min(Math.ceil((d+o-h)*s/n),Math.floor((d-h)*s/n))}}},tI=e=>t=>{let{duration:i,timescale:r=1,periodStart:s,startNumber:n=1}=e;return{number:n+t,duration:i/r,timeline:s,time:t*i}},tx=e=>{let{type:t,duration:i,timescale:r=1,periodDuration:s,sourceDuration:n}=e,{start:a,end:o}=tD[t](e),l=t_(a,o).map(tI(e));if("static"===t){let e=l.length-1;l[e].duration=("number"==typeof s?s:n)-i/r*e}return l},tA=e=>{let{baseUrl:t,initialization:i={},sourceDuration:r,indexRange:s="",periodStart:n,presentationTime:a,number:o=0,duration:l}=e;if(!t)throw Error(tE.NO_BASE_URL);let u=tw({baseUrl:t,source:i.sourceURL,range:i.range}),d=tw({baseUrl:t,source:t,indexRange:s});if(d.map=u,l){let t=tx(e);t.length&&(d.duration=t[0].duration,d.timeline=t[0].timeline)}else r&&(d.duration=r,d.timeline=n);return d.presentationTime=a||n,d.number=o,[d]},tP=(e,t,i)=>{let r;let s=e.sidx.map?e.sidx.map:null,n=e.sidx.duration,a=e.timeline||0,o=e.sidx.byterange,l=o.offset+o.length,u=t.timescale,d=t.references.filter(e=>1!==e.referenceType),h=[],c=e.endList?"static":"dynamic",p=e.sidx.timeline,m=p,g=e.mediaSequence||0;r="bigint"==typeof t.firstOffset?I(R).BigInt(l)+t.firstOffset:l+t.firstOffset;for(let e=0;etS(e,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),tM=(e,t)=>{for(let i=0;i{let t=[];return tp(e,tL,(e,i,r,s)=>{t=t.concat(e.playlists||[])}),t},tU=({playlist:e,mediaSequence:t})=>{e.mediaSequence=t,e.segments.forEach((t,i)=>{t.number=e.mediaSequence+i})},tB=({oldPlaylists:e,newPlaylists:t,timelineStarts:i})=>{t.forEach(t=>{t.discontinuitySequence=i.findIndex(function({timeline:e}){return e===t.timeline});let r=tM(e,t.attributes.NAME);if(!r||t.sidx)return;let s=t.segments[0],n=r.segments.findIndex(function(e){return Math.abs(e.presentationTime-s.presentationTime)r.timeline||r.segments.length&&t.timeline>r.segments[r.segments.length-1].timeline)&&t.discontinuitySequence--;return}r.segments[n].discontinuity&&!s.discontinuity&&(s.discontinuity=!0,t.discontinuityStarts.unshift(0),t.discontinuitySequence--),tU({playlist:t,mediaSequence:r.segments[n].number})})},tF=({oldManifest:e,newManifest:t})=>{let i=e.playlists.concat(tN(e)),r=t.playlists.concat(tN(t));return t.timelineStarts=tR([e.timelineStarts,t.timelineStarts]),tB({oldPlaylists:i,newPlaylists:r,timelineStarts:t.timelineStarts}),t},tq=e=>e&&e.uri+"-"+tk(e.byterange),tj=e=>{let t=e.reduce(function(e,t){return e[t.attributes.baseUrl]||(e[t.attributes.baseUrl]=[]),e[t.attributes.baseUrl].push(t),e},{}),i=[];return Object.values(t).forEach(e=>{let t=ty(e.reduce((e,t)=>{let i=t.attributes.id+(t.attributes.lang||"");return e[i]?(t.segments&&(t.segments[0]&&(t.segments[0].discontinuity=!0),e[i].segments.push(...t.segments)),t.attributes.contentProtection&&(e[i].attributes.contentProtection=t.attributes.contentProtection)):(e[i]=t,e[i].attributes.timelineStarts=[]),e[i].attributes.timelineStarts.push({start:t.attributes.periodStart,timeline:t.attributes.periodStart}),e},{}));i=i.concat(t)}),i.map(e=>(e.discontinuityStarts=tT(e.segments||[],"discontinuity"),e))},t$=(e,t)=>{let i=tq(e.sidx),r=i&&t[i]&&t[i].sidx;return r&&tP(e,r,e.sidx.resolvedUri),e},tV=(e,t={})=>{if(!Object.keys(t).length)return e;for(let i in e)e[i]=t$(e[i],t);return e},tH=({attributes:e,segments:t,sidx:i,mediaSequence:r,discontinuitySequence:s,discontinuityStarts:n},a)=>{let o={attributes:{NAME:e.id,BANDWIDTH:e.bandwidth,CODECS:e.codecs,"PROGRAM-ID":1},uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,discontinuitySequence:s,discontinuityStarts:n,timelineStarts:e.timelineStarts,mediaSequence:r,segments:t};return e.contentProtection&&(o.contentProtection=e.contentProtection),e.serviceLocation&&(o.attributes.serviceLocation=e.serviceLocation),i&&(o.sidx=i),a&&(o.attributes.AUDIO="audio",o.attributes.SUBTITLES="subs"),o},tz=({attributes:e,segments:t,mediaSequence:i,discontinuityStarts:r,discontinuitySequence:s})=>{void 0===t&&(t=[{uri:e.baseUrl,timeline:e.periodStart,resolvedUri:e.baseUrl||"",duration:e.sourceDuration,number:0}],e.duration=e.sourceDuration);let n={NAME:e.id,BANDWIDTH:e.bandwidth,"PROGRAM-ID":1};e.codecs&&(n.CODECS=e.codecs);let a={attributes:n,uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,timelineStarts:e.timelineStarts,discontinuityStarts:r,discontinuitySequence:s,mediaSequence:i,segments:t};return e.serviceLocation&&(a.attributes.serviceLocation=e.serviceLocation),a},tW=(e,t={},i=!1)=>{let r;let s=e.reduce((e,s)=>{let n=s.attributes.role&&s.attributes.role.value||"",a=s.attributes.lang||"",o=s.attributes.label||"main";if(a&&!s.attributes.label){let e=n?` (${n})`:"";o=`${s.attributes.lang}${e}`}e[o]||(e[o]={language:a,autoselect:!0,default:"main"===n,playlists:[],uri:""});let l=t$(tH(s,i),t);return e[o].playlists.push(l),void 0===r&&"main"===n&&((r=s).default=!0),e},{});if(!r){let e=Object.keys(s)[0];s[e].default=!0}return s},tG=(e,t={})=>e.reduce((e,i)=>{let r=i.attributes.label||i.attributes.lang||"text";return e[r]||(e[r]={language:r,default:!1,autoselect:!1,playlists:[],uri:""}),e[r].playlists.push(t$(tz(i),t)),e},{}),tK=e=>e.reduce((e,t)=>(t&&t.forEach(t=>{let{channel:i,language:r}=t;e[r]={autoselect:!1,default:!1,instreamId:i,language:r},t.hasOwnProperty("aspectRatio")&&(e[r].aspectRatio=t.aspectRatio),t.hasOwnProperty("easyReader")&&(e[r].easyReader=t.easyReader),t.hasOwnProperty("3D")&&(e[r]["3D"]=t["3D"])}),e),{}),tX=({attributes:e,segments:t,sidx:i,discontinuityStarts:r})=>{let s={attributes:{NAME:e.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:e.width,height:e.height},CODECS:e.codecs,BANDWIDTH:e.bandwidth,"PROGRAM-ID":1},uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,discontinuityStarts:r,timelineStarts:e.timelineStarts,segments:t};return e.frameRate&&(s.attributes["FRAME-RATE"]=e.frameRate),e.contentProtection&&(s.contentProtection=e.contentProtection),e.serviceLocation&&(s.attributes.serviceLocation=e.serviceLocation),i&&(s.sidx=i),s},tY=({attributes:e})=>"video/mp4"===e.mimeType||"video/webm"===e.mimeType||"video"===e.contentType,tQ=({attributes:e})=>"audio/mp4"===e.mimeType||"audio/webm"===e.mimeType||"audio"===e.contentType,tJ=({attributes:e})=>"text/vtt"===e.mimeType||"text"===e.contentType,tZ=(e,t)=>{e.forEach(e=>{e.mediaSequence=0,e.discontinuitySequence=t.findIndex(function({timeline:t}){return t===e.timeline}),e.segments&&e.segments.forEach((e,t)=>{e.number=t})})},t0=e=>e?Object.keys(e).reduce((t,i)=>{let r=e[i];return t.concat(r.playlists)},[]):[],t1=({dashPlaylists:e,locations:t,contentSteering:i,sidxMapping:r={},previousManifest:s,eventStream:n})=>{if(!e.length)return{};let{sourceDuration:a,type:o,suggestedPresentationDelay:l,minimumUpdatePeriod:u}=e[0].attributes,d=tj(e.filter(tY)).map(tX),h=tj(e.filter(tQ)),c=tj(e.filter(tJ)),p=e.map(e=>e.attributes.captionServices).filter(Boolean),m={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:a,playlists:tV(d,r)};u>=0&&(m.minimumUpdatePeriod=1e3*u),t&&(m.locations=t),i&&(m.contentSteering=i),"dynamic"===o&&(m.suggestedPresentationDelay=l),n&&n.length>0&&(m.eventStream=n);let g=0===m.playlists.length,f=h.length?tW(h,r,g):null,y=c.length?tG(c,r):null,_=d.concat(t0(f),t0(y)),b=_.map(({timelineStarts:e})=>e);return(m.timelineStarts=tR(b),tZ(_,m.timelineStarts),f&&(m.mediaGroups.AUDIO.audio=f),y&&(m.mediaGroups.SUBTITLES.subs=y),p.length&&(m.mediaGroups["CLOSED-CAPTIONS"].cc=tK(p)),s)?tF({oldManifest:s,newManifest:m}):m},t2=(e,t,i)=>{let{NOW:r,clientOffset:s,availabilityStartTime:n,timescale:a=1,periodStart:o=0,minimumUpdatePeriod:l=0}=e;return Math.ceil((((r+s)/1e3+l-(n+o))*a-t)/i)},t4=(e,t)=>{let{type:i,minimumUpdatePeriod:r=0,media:s="",sourceDuration:n,timescale:a=1,startNumber:o=1,periodStart:l}=e,u=[],d=-1;for(let h=0;hd&&(d=f),g<0){let o=h+1;c=o===t.length?"dynamic"===i&&r>0&&s.indexOf("$Number$")>0?t2(e,d,m):(n*a-d)/m:(t[o].t-d)/m}else c=g+1;let y=o+u.length+c,_=o+u.length;for(;_(t,i,r,s)=>{if("$$"===t)return"$";if(void 0===e[i])return t;let n=""+e[i];return"RepresentationID"===i?n:(s=r?parseInt(s,10):1,n.length>=s)?n:`${Array(s-n.length+1).join("0")}${n}`},t3=(e,t)=>e.replace(t8,t5(t)),t6=(e,t)=>e.duration||t?e.duration?tx(e):t4(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodStart}],t7=(e,t)=>{let i={RepresentationID:e.id,Bandwidth:e.bandwidth||0},{initialization:r={sourceURL:"",range:""}}=e,s=tw({baseUrl:e.baseUrl,source:t3(r.sourceURL,i),range:r.range});return t6(e,t).map(t=>{i.Number=t.number,i.Time=t.time;let r=t3(e.media||"",i),n=e.timescale||1,a=e.presentationTimeOffset||0,o=e.periodStart+(t.time-a)/n;return{uri:r,timeline:t.timeline,duration:t.duration,resolvedUri:et(e.baseUrl||"",r),map:s,number:t.number,presentationTime:o}})},t9=(e,t)=>{let{baseUrl:i,initialization:r={}}=e,s=tw({baseUrl:i,source:r.sourceURL,range:r.range}),n=tw({baseUrl:i,source:t.media,range:t.mediaRange});return n.map=s,n},ie=(e,t)=>{let i;let{duration:r,segmentUrls:s=[],periodStart:n}=e;if(!r&&!t||r&&t)throw Error(tE.SEGMENT_TIME_UNSPECIFIED);let a=s.map(t=>t9(e,t));return r&&(i=tx(e)),t&&(i=t4(e,t)),i.map((t,i)=>{if(a[i]){let r=a[i],s=e.timescale||1,o=e.presentationTimeOffset||0;return r.timeline=t.timeline,r.duration=t.duration,r.number=t.number,r.presentationTime=n+(t.time-o)/s,r}}).filter(e=>e)},it=({attributes:e,segmentInfo:t})=>{let i,r;t.template?(r=t7,i=tf(e,t.template)):t.base?(r=tA,i=tf(e,t.base)):t.list&&(r=ie,i=tf(e,t.list));let s={attributes:e};if(!r)return s;let n=r(i,t.segmentTimeline);if(i.duration){let{duration:e,timescale:t=1}=i;i.duration=e/t}else n.length?i.duration=n.reduce((e,t)=>Math.max(e,Math.ceil(t.duration)),0):i.duration=0;return s.attributes=i,s.segments=n,t.base&&i.indexRange&&(s.sidx=n[0],s.segments=[]),s},ii=e=>e.map(it),ir=(e,t)=>tv(e.childNodes).filter(({tagName:e})=>e===t),is=e=>e.textContent.trim(),ia=e=>parseFloat(e.split("/").reduce((e,t)=>e/t)),io=e=>{let t=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);if(!t)return 0;let[i,r,s,n,a,o]=t.slice(1);return 31536e3*parseFloat(i||0)+2592e3*parseFloat(r||0)+86400*parseFloat(s||0)+3600*parseFloat(n||0)+60*parseFloat(a||0)+parseFloat(o||0)},il=e=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(e)&&(e+="Z"),Date.parse(e)),iu={mediaPresentationDuration:e=>io(e),availabilityStartTime:e=>il(e)/1e3,minimumUpdatePeriod:e=>io(e),suggestedPresentationDelay:e=>io(e),type:e=>e,timeShiftBufferDepth:e=>io(e),start:e=>io(e),width:e=>parseInt(e,10),height:e=>parseInt(e,10),bandwidth:e=>parseInt(e,10),frameRate:e=>ia(e),startNumber:e=>parseInt(e,10),timescale:e=>parseInt(e,10),presentationTimeOffset:e=>parseInt(e,10),duration(e){let t=parseInt(e,10);return isNaN(t)?io(e):t},d:e=>parseInt(e,10),t:e=>parseInt(e,10),r:e=>parseInt(e,10),presentationTime:e=>parseInt(e,10),DEFAULT:e=>e},id=e=>e&&e.attributes?tv(e.attributes).reduce((e,t)=>{let i=iu[t.name]||iu.DEFAULT;return e[t.name]=i(t.value),e},{}):{},ih={"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","urn:mpeg:dash:mp4protection:2011":"mp4protection"},ic=(e,t)=>t.length?tb(e.map(function(e){return t.map(function(t){let i=is(t),r=et(e.baseUrl,i),s=tf(id(t),{baseUrl:r});return r!==i&&!s.serviceLocation&&e.serviceLocation&&(s.serviceLocation=e.serviceLocation),s})})):e,ip=e=>{let t=ir(e,"SegmentTemplate")[0],i=ir(e,"SegmentList")[0],r=i&&ir(i,"SegmentURL").map(e=>tf({tag:"SegmentURL"},id(e))),s=ir(e,"SegmentBase")[0],n=i||t,a=n&&ir(n,"SegmentTimeline")[0],o=i||s||t,l=o&&ir(o,"Initialization")[0],u=t&&id(t);u&&l?u.initialization=l&&id(l):u&&u.initialization&&(u.initialization={sourceURL:u.initialization});let d={template:u,segmentTimeline:a&&ir(a,"S").map(e=>id(e)),list:i&&tf(id(i),{segmentUrls:r,initialization:id(l)}),base:s&&tf(id(s),{initialization:id(l)})};return Object.keys(d).forEach(e=>{d[e]||delete d[e]}),d},im=(e,t,i)=>r=>{let s=ic(t,ir(r,"BaseURL")),n=tf(e,id(r)),a=ip(r);return s.map(e=>({segmentInfo:tf(i,a),attributes:tf(n,e)}))},ig=e=>e.reduce((e,t)=>{let i=id(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());let r=ih[i.schemeIdUri];if(r){e[r]={attributes:i};let s=ir(t,"cenc:pssh")[0];if(s){let t=is(s);e[r].pssh=t&&function(e){for(var t=I(R).atob?I(R).atob(e):eh.from(e,"base64").toString("binary"),i=new Uint8Array(t.length),r=0;r"urn:scte:dash:cc:cea-608:2015"===e.schemeIdUri?("string"!=typeof e.value?[]:e.value.split(";")).map(e=>{let t,i;return i=e,/^CC\d=/.test(e)?[t,i]=e.split("="):/^CC\d$/.test(e)&&(t=e),{channel:t,language:i}}):"urn:scte:dash:cc:cea-708:2015"===e.schemeIdUri?("string"!=typeof e.value?[]:e.value.split(";")).map(e=>{let t={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(e)){let[i,r=""]=e.split("=");t.channel=i,t.language=e,r.split(",").forEach(e=>{let[i,r]=e.split(":");"lang"===i?t.language=r:"er"===i?t.easyReader=Number(r):"war"===i?t.aspectRatio=Number(r):"3D"===i&&(t["3D"]=Number(r))})}else t.language=e;return t.channel&&(t.channel="SERVICE"+t.channel),t}):void 0,i_=e=>tb(ir(e.node,"EventStream").map(t=>{let i=id(t),r=i.schemeIdUri;return ir(t,"Event").map(t=>{let s=id(t),n=s.presentationTime||0,a=i.timescale||1,o=s.duration||0,l=n/a+e.attributes.start;return{schemeIdUri:r,value:i.value,id:s.id,start:l,end:l+o/a,messageData:is(t)||s.messageData,contentEncoding:i.contentEncoding,presentationTimeOffset:i.presentationTimeOffset||0}})})),ib=(e,t,i)=>r=>{let s=id(r),n=ic(t,ir(r,"BaseURL")),a=tf(e,s,{role:id(ir(r,"Role")[0])}),o=iy(id(ir(r,"Accessibility")[0]));o&&(a=tf(a,{captionServices:o}));let l=ir(r,"Label")[0];l&&l.childNodes.length&&(a=tf(a,{label:l.childNodes[0].nodeValue.trim()}));let u=ig(ir(r,"ContentProtection"));Object.keys(u).length&&(a=tf(a,{contentProtection:u}));let d=ip(r),h=ir(r,"Representation"),c=tf(i,d);return tb(h.map(im(a,n,c)))},iv=(e,t)=>(i,r)=>{let s=ic(t,ir(i.node,"BaseURL")),n=tf(e,{periodStart:i.attributes.start});"number"==typeof i.attributes.duration&&(n.periodDuration=i.attributes.duration);let a=ir(i.node,"AdaptationSet"),o=ip(i.node);return tb(a.map(ib(n,s,o)))},iT=(e,t)=>{if(e.length>1&&t({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!e.length)return null;let i=tf({serverURL:is(e[0])},id(e[0]));return i.queryBeforeStart="true"===i.queryBeforeStart,i},iS=({attributes:e,priorPeriodAttributes:t,mpdType:i})=>"number"==typeof e.start?e.start:t&&"number"==typeof t.start&&"number"==typeof t.duration?t.start+t.duration:t||"static"!==i?null:0,iE=(e,t={})=>{let{manifestUri:i="",NOW:r=Date.now(),clientOffset:s=0,eventHandler:n=function(){}}=t,a=ir(e,"Period");if(!a.length)throw Error(tE.INVALID_NUMBER_OF_PERIOD);let o=ir(e,"Location"),l=id(e),u=ic([{baseUrl:i}],ir(e,"BaseURL")),d=ir(e,"ContentSteering");l.type=l.type||"static",l.sourceDuration=l.mediaPresentationDuration||0,l.NOW=r,l.clientOffset=s,o.length&&(l.locations=o.map(is));let h=[];return a.forEach((e,t)=>{let i=id(e),r=h[t-1];i.start=iS({attributes:i,priorPeriodAttributes:r?r.attributes:null,mpdType:l.type}),h.push({node:e,attributes:i})}),{locations:l.locations,contentSteeringInfo:iT(d,n),representationInfo:tb(h.map(iv(l,u))),eventStream:tb(h.map(i_))}},iw=e=>{let t,i;if(""===e)throw Error(tE.DASH_EMPTY_MANIFEST);let r=new y;try{i=(t=r.parseFromString(e,"application/xml"))&&"MPD"===t.documentElement.tagName?t.documentElement:null}catch(e){}if(!i||i&&i.getElementsByTagName("parsererror").length>0)throw Error(tE.DASH_INVALID_XML);return i},ik=e=>{let t=ir(e,"UTCTiming")[0];if(!t)return null;let i=id(t);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.value);break;default:throw Error(tE.UNSUPPORTED_UTC_TIMING_SCHEME)}return i},iC=(e,t={})=>{let i=iE(iw(e),t);return t1({dashPlaylists:ii(i.representationInfo),locations:i.locations,contentSteering:i.contentSteeringInfo,sidxMapping:t.sidxMapping,previousManifest:t.previousManifest,eventStream:i.eventStream})},iD=e=>ik(iw(e));var iI={},ix=function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.getBigUint64?(t=i.getBigUint64(0))0;r+=12,s--)i.references.push({referenceType:(128&e[r])>>>7,referencedSize:2147483647&t.getUint32(r),subsegmentDuration:t.getUint32(r+4),startsWithSap:!!(128&e[r+8]),sapType:(112&e[r+8])>>>4,sapDeltaTime:268435455&t.getUint32(r+8)});return i};var iA=ts([73,68,51]),iP=function(e,t){void 0===t&&(t=0);var i=(e=ts(e))[t+5],r=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&i)>>4?r+20:r+10},iL=function e(t,i){return(void 0===i&&(i=0),(t=ts(t)).length-i<10||!tc(t,iA,{offset:i}))?i:(i+=iP(t,i),e(t,i))};new Uint8Array([79,112,117,115,72,101,97,100]);var iO=function(e){return"string"==typeof e?td(e):e},iR=function(e){e=ts(e);for(var t=[],i=0;e.length>i;){var r=e[i],s=0,n=0,a=e[++n];for(n++;128&a;)s=(127&a)<<7,a=e[n],n++;s+=127&a;for(var o=0;o<_.length;o++){var l=_[o],u=l.id,d=l.parser;if(r===u){t.push(d(e.subarray(n,n+s)));break}}i+=s+n}return t};_=[{id:3,parser:function(e){var t={tag:3,id:e[0]<<8|e[1],flags:e[2],size:3,dependsOnEsId:0,ocrEsId:0,descriptors:[],url:""};if(128&t.flags&&(t.dependsOnEsId=e[t.size]<<8|e[t.size+1],t.size+=2),64&t.flags){var i=e[t.size];t.url=tu(e.subarray(t.size+1,t.size+1+i)),t.size+=i}return 32&t.flags&&(t.ocrEsId=e[t.size]<<8|e[t.size+1],t.size+=2),t.descriptors=iR(e.subarray(t.size))||[],t}},{id:4,parser:function(e){return{tag:4,oti:e[0],streamType:e[1],bufferSize:e[2]<<16|e[3]<<8|e[4],maxBitrate:e[5]<<24|e[6]<<16|e[7]<<8|e[8],avgBitrate:e[9]<<24|e[10]<<16|e[11]<<8|e[12],descriptors:iR(e.subarray(13))}}},{id:5,parser:function(e){return{tag:5,bytes:e}}},{id:6,parser:function(e){return{tag:6,bytes:e}}}];var iM=function e(t,i,r){void 0===r&&(r=!1),i=Array.isArray(s=i)?s.map(function(e){return iO(e)}):[iO(s)],t=ts(t);var s,n=[];if(!i.length)return n;for(var a=0;a>>0,l=t.subarray(a+4,a+8);if(0===o)break;var u=a+o;if(u>t.length){if(r)break;u=t.length}var d=t.subarray(a+8,u);tc(l,i[0])&&(1===i.length?n.push(d):n.push.apply(n,e(d,i.slice(1),r))),a=u}return n},iN={EBML:ts([26,69,223,163]),DocType:ts([66,130]),Segment:ts([24,83,128,103]),SegmentInfo:ts([21,73,169,102]),Tracks:ts([22,84,174,107]),Track:ts([174]),TrackNumber:ts([215]),DefaultDuration:ts([35,227,131]),TrackEntry:ts([174]),TrackType:ts([131]),FlagDefault:ts([136]),CodecID:ts([134]),CodecPrivate:ts([99,162]),VideoTrack:ts([224]),AudioTrack:ts([225]),Cluster:ts([31,67,182,117]),Timestamp:ts([231]),TimestampScale:ts([42,215,177]),BlockGroup:ts([160]),BlockDuration:ts([155]),Block:ts([161]),SimpleBlock:ts([163])},iU=[128,64,32,16,8,4,2,1],iB=function(e){for(var t=1,i=0;i=i.length)return i.length;var s=iF(i,r,!1);if(tc(t.bytes,s.bytes))return r;var n=iF(i,r+s.length);return e(t,i,r+n.length+n.value+s.length)},i$=function e(t,i){i=Array.isArray(r=i)?r.map(function(e){return iq(e)}):[iq(r)],t=ts(t);var r,s=[];if(!i.length)return s;for(var n=0;nt.length?t.length:l+o.value,d=t.subarray(l,u);tc(i[0],a.bytes)&&(1===i.length?s.push(d):s=s.concat(e(d,i.slice(1)))),n+=a.length+o.length+d.length}return s},iV=ts([0,0,0,1]),iH=ts([0,0,1]),iz=ts([0,0,3]),iW=function(e){for(var t=[],i=1;i>1&63),-1!==i.indexOf(l)&&(s=n+o),n+=o+("h264"===t?1:2)}return e.subarray(0,0)},iK={webm:ts([119,101,98,109]),matroska:ts([109,97,116,114,111,115,107,97]),flac:ts([102,76,97,67]),ogg:ts([79,103,103,83]),ac3:ts([11,119]),riff:ts([82,73,70,70]),avi:ts([65,86,73]),wav:ts([87,65,86,69]),"3gp":ts([102,116,121,112,51,103]),mp4:ts([102,116,121,112]),fmp4:ts([115,116,121,112]),mov:ts([102,116,121,112,113,116]),moov:ts([109,111,111,118]),moof:ts([109,111,111,102])},iX={aac:function(e){var t=iL(e);return tc(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=iL(e);return tc(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){return tc(i$(e,[iN.EBML,iN.DocType])[0],iK.webm)},mkv:function(e){return tc(i$(e,[iN.EBML,iN.DocType])[0],iK.matroska)},mp4:function(e){return!(iX["3gp"](e)||iX.mov(e))&&(!!(tc(e,iK.mp4,{offset:4})||tc(e,iK.fmp4,{offset:4})||tc(e,iK.moof,{offset:4})||tc(e,iK.moov,{offset:4}))||void 0)},mov:function(e){return tc(e,iK.mov,{offset:4})},"3gp":function(e){return tc(e,iK["3gp"],{offset:4})},ac3:function(e){var t=iL(e);return tc(e,iK.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return 71===e[0];for(var t=0;t+188(r,s,n)=>{let a=t.levels[s],o=RegExp(`^(${a})$`),l=e;if("log"!==r&&n.unshift(r.toUpperCase()+":"),i&&(l=`%c${e}`,n.unshift(i)),n.unshift(l+":"),i3){i3.push([].concat(n));let e=i3.length-1e3;i3.splice(0,e>0?e:0)}if(!I(R).console)return;let u=I(R).console[r];u||"debug"!==r||(u=I(R).console.info||I(R).console.log),u&&a&&o.test(r)&&u[Array.isArray(n)?"apply":"call"](I(R).console,n)},i7=function e(t,i=":",r=""){let s,n="info",a=function(...e){s("log",n,e)};return s=i6(t,a,r),a.createLogger=(s,n,a)=>{let o=void 0!==n?n:i;return e(`${t} ${o} ${s}`,o,void 0!==a?a:r)},a.createNewLogger=(t,i,r)=>e(t,i,r),a.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:n},a.level=e=>{if("string"==typeof e){if(!a.levels.hasOwnProperty(e))throw Error(`"${e}" in not a valid log level`);n=e}return n},a.history=()=>i3?[].concat(i3):[],a.history.filter=e=>(i3||[]).filter(t=>RegExp(`.*${e}.*`).test(t[0])),a.history.clear=()=>{i3&&(i3.length=0)},a.history.disable=()=>{null!==i3&&(i3.length=0,i3=null)},a.history.enable=()=>{null===i3&&(i3=[])},a.error=(...e)=>s("error",n,e),a.warn=(...e)=>s("warn",n,e),a.debug=(...e)=>s("debug",n,e),a}("VIDEOJS"),i9=i7.createLogger,re=Object.prototype.toString,rt=function(e){return rs(e)?Object.keys(e):[]};function ri(e,t){rt(e).forEach(i=>t(e[i],i))}function rr(e,t,i=0){return rt(e).reduce((i,r)=>t(i,e[r],r),i)}function rs(e){return!!e&&"object"==typeof e}function rn(e){return rs(e)&&"[object Object]"===re.call(e)&&e.constructor===Object}function ra(...e){let t={};return e.forEach(e=>{e&&ri(e,(e,i)=>{if(!rn(e)){t[i]=e;return}rn(t[i])||(t[i]={}),t[i]=ra(t[i],e)})}),t}function ro(e={}){let t=[];for(let i in e)if(e.hasOwnProperty(i)){let r=e[i];t.push(r)}return t}function rl(e,t,i,r=!0){let s=i=>Object.defineProperty(e,t,{value:i,enumerable:!0,writable:!0}),n={configurable:!0,enumerable:!0,get(){let e=i();return s(e),e}};return r&&(n.set=s),Object.defineProperty(e,t,n)}var ru=Object.freeze({__proto__:null,each:ri,reduce:rr,isObject:rs,isPlain:rn,merge:ra,values:ro,defineLazyProperty:rl});let rd=!1,rh=null,rc=!1,rp=!1,rm=!1,rg=!1,rf=!1,ry=null,r_=null,rb=null,rv=!1,rT=!1,rS=!1,rE=!1,rw=!1,rk=!1,rC=!1;const rD=!!(rO()&&("ontouchstart"in I(R)||I(R).navigator.maxTouchPoints||I(R).DocumentTouch&&I(R).document instanceof I(R).DocumentTouch)),rI=I(R).navigator&&I(R).navigator.userAgentData;if(rI&&rI.platform&&rI.brands&&(rc="Android"===rI.platform,rm=!!rI.brands.find(e=>"Microsoft Edge"===e.brand),rg=!!rI.brands.find(e=>"Chromium"===e.brand),rf=!rm&&rg,ry=r_=(rI.brands.find(e=>"Chromium"===e.brand)||{}).version||null,rT="Windows"===rI.platform),!rg){let e=I(R).navigator&&I(R).navigator.userAgent||"";rd=/iPod/i.test(e),rh=function(){let t=e.match(/OS (\d+)_/i);return t&&t[1]?t[1]:null}(),rc=/Android/i.test(e),t=function(){let t=e.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!t)return null;let i=t[1]&&parseFloat(t[1]),r=t[2]&&parseFloat(t[2]);return i&&r?parseFloat(t[1]+"."+t[2]):i||null}(),rp=/Firefox/i.test(e),rm=/Edg/i.test(e),rg=/Chrome/i.test(e)||/CriOS/i.test(e),rf=!rm&&rg,ry=r_=function(){let t=e.match(/(Chrome|CriOS)\/(\d+)/);return t&&t[2]?parseFloat(t[2]):null}(),rb=function(){let t=/MSIE\s(\d+)\.\d/.exec(e),i=t&&parseFloat(t[1]);return!i&&/Trident\/7.0/i.test(e)&&/rv:11.0/.test(e)&&(i=11),i}(),rw=/Tizen/i.test(e),rk=/Web0S/i.test(e),rC=rw||rk,rv=/Safari/i.test(e)&&!rf&&!rc&&!rm&&!rC,rT=/Windows/i.test(e),rS=/iPad/i.test(e)||rv&&rD&&!/iPhone/i.test(e),rE=/iPhone/i.test(e)&&!rS}const rx=rE||rS||rd,rA=(rv||rx)&&!rf;var rP=Object.freeze({__proto__:null,get IS_IPOD(){return rd},get IOS_VERSION(){return rh},get IS_ANDROID(){return rc},get ANDROID_VERSION(){return t},get IS_FIREFOX(){return rp},get IS_EDGE(){return rm},get IS_CHROMIUM(){return rg},get IS_CHROME(){return rf},get CHROMIUM_VERSION(){return ry},get CHROME_VERSION(){return r_},get IE_VERSION(){return rb},get IS_SAFARI(){return rv},get IS_WINDOWS(){return rT},get IS_IPAD(){return rS},get IS_IPHONE(){return rE},get IS_TIZEN(){return rw},get IS_WEBOS(){return rk},get IS_SMART_TV(){return rC},TOUCH_ENABLED:rD,IS_IOS:rx,IS_ANY_SAFARI:rA});function rL(e){return"string"==typeof e&&!!e.trim()}function rO(){return I(M)===I(R).document}function rR(e){return rs(e)&&1===e.nodeType}function rM(){try{return I(R).parent!==I(R).self}catch(e){return!0}}function rN(e){return function(t,i){if(!rL(t))return I(M)[e](null);rL(i)&&(i=I(M).querySelector(i));let r=rR(i)?i:I(M);return r[e]&&r[e](t)}}function rU(e="div",t={},i={},r){let s=I(M).createElement(e);return Object.getOwnPropertyNames(t).forEach(function(e){let i=t[e];"textContent"===e?rB(s,i):(s[e]!==i||"tabIndex"===e)&&(s[e]=i)}),Object.getOwnPropertyNames(i).forEach(function(e){s.setAttribute(e,i[e])}),r&&r4(s,r),s}function rB(e,t){return void 0===e.textContent?e.innerText=t:e.textContent=t,e}function rF(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function rq(e,t){return!function(e){if(e.indexOf(" ")>=0)throw Error("class has illegal whitespace characters")}(t),e.classList.contains(t)}function rj(e,...t){return e.classList.add(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e}function r$(e,...t){return e?(e.classList.remove(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e):(i7.warn("removeClass was called with an element that doesn't exist"),null)}function rV(e,t,i){return"function"==typeof i&&(i=i(e,t)),"boolean"!=typeof i&&(i=void 0),t.split(/\s+/).forEach(t=>e.classList.toggle(t,i)),e}function rH(e,t){Object.getOwnPropertyNames(t).forEach(function(i){let r=t[i];null==r||!1===r?e.removeAttribute(i):e.setAttribute(i,!0===r?"":r)})}function rz(e){let t={},i=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(e&&e.attributes&&e.attributes.length>0){let r=e.attributes;for(let e=r.length-1;e>=0;e--){let s=r[e].name,n=r[e].value;i.includes(s)&&(n=null!==n),t[s]=n}}return t}function rW(e,t){return e.getAttribute(t)}function rG(e,t,i){e.setAttribute(t,i)}function rK(e,t){e.removeAttribute(t)}function rX(){I(M).body.focus(),I(M).onselectstart=function(){return!1}}function rY(){I(M).onselectstart=function(){return!0}}function rQ(e){if(e&&e.getBoundingClientRect&&e.parentNode){let t=e.getBoundingClientRect(),i={};return["bottom","height","left","right","top","width"].forEach(e=>{void 0!==t[e]&&(i[e]=t[e])}),i.height||(i.height=parseFloat(r7(e,"height"))),i.width||(i.width=parseFloat(r7(e,"width"))),i}}function rJ(e){if(!e||e&&!e.offsetParent)return{left:0,top:0,width:0,height:0};let t=e.offsetWidth,i=e.offsetHeight,r=0,s=0;for(;e.offsetParent&&e!==I(M)[i4.fullscreenElement];)r+=e.offsetLeft,s+=e.offsetTop,e=e.offsetParent;return{left:r,top:s,width:t,height:i}}function rZ(e,t){let i={x:0,y:0};if(rx){let t=e;for(;t&&"html"!==t.nodeName.toLowerCase();){let e=r7(t,"transform");if(/^matrix/.test(e)){let t=e.slice(7,-1).split(/,\s/).map(Number);i.x+=t[4],i.y+=t[5]}else if(/^matrix3d/.test(e)){let t=e.slice(9,-1).split(/,\s/).map(Number);i.x+=t[12],i.y+=t[13]}t=t.parentNode}}let r={},s=rJ(t.target),n=rJ(e),a=n.width,o=n.height,l=t.offsetY-(n.top-s.top),u=t.offsetX-(n.left-s.left);return t.changedTouches&&(u=t.changedTouches[0].pageX-n.left,l=t.changedTouches[0].pageY+n.top,rx&&(u-=i.x,l-=i.y)),r.y=1-Math.max(0,Math.min(1,l/o)),r.x=Math.max(0,Math.min(1,u/a)),r}function r0(e){return rs(e)&&3===e.nodeType}function r1(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function r2(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map(e=>("function"==typeof e&&(e=e()),rR(e)||r0(e))?e:"string"==typeof e&&/\S/.test(e)?I(M).createTextNode(e):void 0).filter(e=>e)}function r4(e,t){return r2(t).forEach(t=>e.appendChild(t)),e}function r8(e,t){return r4(r1(e),t)}function r5(e){return void 0===e.button&&void 0===e.buttons||0===e.button&&void 0===e.buttons||"mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons}const r3=rN("querySelector"),r6=rN("querySelectorAll");function r7(e,t){if(!e||!t)return"";if("function"==typeof I(R).getComputedStyle){let i;try{i=I(R).getComputedStyle(e)}catch(e){return""}return i?i.getPropertyValue(t)||i[t]:""}return""}function r9(e){[...I(M).styleSheets].forEach(t=>{try{let i=[...t.cssRules].map(e=>e.cssText).join(""),r=I(M).createElement("style");r.textContent=i,e.document.head.appendChild(r)}catch(r){let i=I(M).createElement("link");i.rel="stylesheet",i.type=t.type,i.media=t.media.mediaText,i.href=t.href,e.document.head.appendChild(i)}})}var se=Object.freeze({__proto__:null,isReal:rO,isEl:rR,isInFrame:rM,createEl:rU,textContent:rB,prependTo:rF,hasClass:rq,addClass:rj,removeClass:r$,toggleClass:rV,setAttributes:rH,getAttributes:rz,getAttribute:rW,setAttribute:rG,removeAttribute:rK,blockTextSelection:rX,unblockTextSelection:rY,getBoundingClientRect:rQ,findPosition:rJ,getPointerPosition:rZ,isTextNode:r0,emptyEl:r1,normalizeContent:r2,appendContent:r4,insertContent:r8,isSingleLeftClick:r5,$:r3,$$:r6,computedStyle:r7,copyStyleSheetsToWindow:r9});let st=!1;const si=function(){if(!1===i.options.autoSetup)return;let e=Array.prototype.slice.call(I(M).getElementsByTagName("video")),t=Array.prototype.slice.call(I(M).getElementsByTagName("audio")),r=Array.prototype.slice.call(I(M).getElementsByTagName("video-js")),s=e.concat(t,r);if(s&&s.length>0)for(let e=0,t=s.length;e-1&&(i={passive:!0}),e.addEventListener(t,r.dispatcher,i)}else e.attachEvent&&e.attachEvent("on"+t,r.dispatcher)}}function sg(e,t,i){if(!so.has(e))return;let r=so.get(e);if(!r.handlers)return;if(Array.isArray(t))return sd(sg,e,t,i);let s=function(e,t){r.handlers[t]=[],su(e,t)};if(void 0===t){for(let t in r.handlers)Object.prototype.hasOwnProperty.call(r.handlers||{},t)&&s(e,t);return}let n=r.handlers[t];if(n){if(!i){s(e,t);return}if(i.guid)for(let e=0;e=t&&(e(...r),i=s)}},sS=function(e,t,i,r=I(R)){let s;let n=function(){let n=this,a=arguments,o=function(){s=null,o=null,i||e.apply(n,a)};!s&&i&&e.apply(n,a),r.clearTimeout(s),s=r.setTimeout(o,t)};return n.cancel=()=>{r.clearTimeout(s),s=null},n};var sE=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:30,bind_:sv,throttle:sT,debounce:sS});class sw{on(e,t){let i=this.addEventListener;this.addEventListener=()=>{},sm(this,e,t),this.addEventListener=i}off(e,t){sg(this,e,t)}one(e,t){let i=this.addEventListener;this.addEventListener=()=>{},sy(this,e,t),this.addEventListener=i}any(e,t){let i=this.addEventListener;this.addEventListener=()=>{},s_(this,e,t),this.addEventListener=i}trigger(e){let t=e.type||e;"string"==typeof e&&(e={type:t}),e=sh(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),sf(this,e)}queueTrigger(e){s||(s=new Map);let t=e.type||e,i=s.get(this);i||(i=new Map,s.set(this,i));let r=i.get(t);i.delete(t),I(R).clearTimeout(r);let n=I(R).setTimeout(()=>{i.delete(t),0===i.size&&(i=null,s.delete(this)),this.trigger(e)},0);i.set(t,n)}}sw.prototype.allowedEvents_={},sw.prototype.addEventListener=sw.prototype.on,sw.prototype.removeEventListener=sw.prototype.off,sw.prototype.dispatchEvent=sw.prototype.trigger;const sk=e=>"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_?e.name_:e.constructor&&e.constructor.name?e.constructor.name:typeof e,sC=e=>e instanceof sw||!!e.eventBusEl_&&["on","one","off","trigger"].every(t=>"function"==typeof e[t]),sD=(e,t)=>{sC(e)?t():(e.eventedCallbacks||(e.eventedCallbacks=[]),e.eventedCallbacks.push(t))},sI=e=>"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length,sx=(e,t,i)=>{if(!e||!e.nodeName&&!sC(e))throw Error(`Invalid target for ${sk(t)}#${i}; must be a DOM node or evented object.`)},sA=(e,t,i)=>{if(!sI(e))throw Error(`Invalid event type for ${sk(t)}#${i}; must be a non-empty string or array.`)},sP=(e,t,i)=>{if("function"!=typeof e)throw Error(`Invalid listener for ${sk(t)}#${i}; must be a function.`)},sL=(e,t,i)=>{let r,s,n;let a=t.length<3||t[0]===e||t[0]===e.eventBusEl_;return a?(r=e.eventBusEl_,t.length>=3&&t.shift(),[s,n]=t):[r,s,n]=t,sx(r,e,i),sA(s,e,i),sP(n,e,i),{isTargetingSelf:a,target:r,type:s,listener:n=sv(e,n)}},sO=(e,t,i,r)=>{sx(e,e,t),e.nodeName?sb[t](e,i,r):e[t](i,r)},sR={on(...e){let{isTargetingSelf:t,target:i,type:r,listener:s}=sL(this,e,"on");if(sO(i,"on",r,s),!t){let e=()=>this.off(i,r,s);e.guid=s.guid;let t=()=>this.off("dispose",e);t.guid=s.guid,sO(this,"on","dispose",e),sO(i,"on","dispose",t)}},one(...e){let{isTargetingSelf:t,target:i,type:r,listener:s}=sL(this,e,"one");if(t)sO(i,"one",r,s);else{let e=(...t)=>{this.off(i,r,e),s.apply(null,t)};e.guid=s.guid,sO(i,"one",r,e)}},any(...e){let{isTargetingSelf:t,target:i,type:r,listener:s}=sL(this,e,"any");if(t)sO(i,"any",r,s);else{let e=(...t)=>{this.off(i,r,e),s.apply(null,t)};e.guid=s.guid,sO(i,"any",r,e)}},off(e,t,i){!e||sI(e)?sg(this.eventBusEl_,e,t):(sx(e,this,"off"),sA(t,this,"off"),sP(i,this,"off"),i=sv(this,i),this.off("dispose",i),e.nodeName?(sg(e,t,i),sg(e,"dispose",i)):sC(e)&&(e.off(t,i),e.off("dispose",i)))},trigger(e,t){if(sx(this.eventBusEl_,this,"trigger"),!sI(e&&"string"!=typeof e?e.type:e))throw Error(`Invalid event type for ${sk(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return sf(this.eventBusEl_,e,t)}};function sM(e,t={}){let{eventBusKey:i}=t;if(i){if(!e[i].nodeName)throw Error(`The eventBusKey "${i}" does not refer to an element.`);e.eventBusEl_=e[i]}else e.eventBusEl_=rU("span",{className:"vjs-event-bus"});return Object.assign(e,sR),e.eventedCallbacks&&e.eventedCallbacks.forEach(e=>{e()}),e.on("dispose",()=>{e.off(),[e,e.el_,e.eventBusEl_].forEach(function(e){e&&so.has(e)&&so.delete(e)}),I(R).setTimeout(()=>{e.eventBusEl_=null},0)}),e}const sN={state:{},setState(e){let t;return"function"==typeof e&&(e=e()),ri(e,(e,i)=>{this.state[i]!==e&&((t=t||{})[i]={from:this.state[i],to:e}),this.state[i]=e}),t&&sC(this)&&this.trigger({changes:t,type:"statechanged"}),t}};function sU(e,t){return Object.assign(e,sN),e.state=Object.assign({},e.state,t),"function"==typeof e.handleStateChanged&&sC(e)&&e.on("statechanged",e.handleStateChanged),e}const sB=function(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toLowerCase())},sF=function(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toUpperCase())},sq=function(e,t){return sF(e)===sF(t)};var sj=Object.freeze({__proto__:null,toLowerCase:sB,toTitleCase:sF,titleCaseEquals:sq});class s${constructor(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=ra({},this.options_),t=this.options_=ra(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){let t=e&&e.id&&e.id()||"no_player";this.id_=`${t}_component_${sl++}`}this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(e=>this.addClass(e)),["on","off","one","any","trigger"].forEach(e=>{this[e]=void 0}),!1!==t.evented&&(sM(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),sU(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,this.clearingTimersOnDispose_=!1,!1!==t.initChildren&&this.initChildren(),this.ready(i),!1!==t.reportTouchActivity&&this.enableTouchActivity()}on(e,t){}off(e,t){}one(e,t){}any(e,t){}trigger(e,t){}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let e=this.children_.length-1;e>=0;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return!!this.isDisposed_}player(){return this.player_}options(e){return e&&(this.options_=ra(this.options_,e)),this.options_}el(){return this.el_}createEl(e,t,i){return rU(e,t,i)}localize(e,t,i=e){let r=this.player_.language&&this.player_.language(),s=this.player_.languages&&this.player_.languages(),n=s&&s[r],a=r&&r.split("-")[0],o=s&&s[a],l=i;return n&&n[e]?l=n[e]:o&&o[e]&&(l=o[e]),t&&(l=l.replace(/\{(\d+)\}/g,function(e,i){let r=t[i-1],s=r;return void 0===r&&(s=e),s})),l}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...e){e=e.reduce((e,t)=>e.concat(t),[]);let t=this;for(let i=0;i=0;i--)if(this.children_[i]===e){t=!0,this.children_.splice(i,1);break}if(!t)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[sF(e.name())]=null,this.childNameIndex_[sB(e.name())]=null;let i=e.el();i&&i.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){let e=this.options_.children;if(e){let t;let i=this.options_,r=s$.getComponent("Tech");(t=Array.isArray(e)?e:Object.keys(e)).concat(Object.keys(this.options_).filter(function(e){return!t.some(function(t){return"string"==typeof t?e===t:e===t.name})})).map(t=>{let i,r;return"string"==typeof t?r=e[i=t]||this.options_[i]||{}:(i=t.name,r=t),{name:i,opts:r}}).filter(e=>{let t=s$.getComponent(e.opts.componentClass||sF(e.name));return t&&!r.isTech(t)}).forEach(e=>{let t=e.name,r=e.opts;if(void 0!==i[t]&&(r=i[t]),!1===r)return;!0===r&&(r={}),r.playerOptions=this.options_.playerOptions;let s=this.addChild(t,r);s&&(this[t]=s)})}}buildCSSClass(){return""}ready(e,t=!1){if(e){if(!this.isReady_){this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e);return}t?e.call(this):this.setTimeout(e,1)}}triggerReady(){this.isReady_=!0,this.setTimeout(function(){let e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(e){e.call(this)},this),this.trigger("ready")},1)}$(e,t){return r3(e,t||this.contentEl())}$$(e,t){return r6(e,t||this.contentEl())}hasClass(e){return rq(this.el_,e)}addClass(...e){rj(this.el_,...e)}removeClass(...e){r$(this.el_,...e)}toggleClass(e,t){rV(this.el_,e,t)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(e){return rW(this.el_,e)}setAttribute(e,t){rG(this.el_,e,t)}removeAttribute(e){rK(this.el_,e)}width(e,t){return this.dimension("width",e,t)}height(e,t){return this.dimension("height",e,t)}dimensions(e,t){this.width(e,!0),this.height(t)}dimension(e,t,i){if(void 0!==t){(null===t||t!=t)&&(t=0),-1!==(""+t).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:"auto"===t?this.el_.style[e]="":this.el_.style[e]=t+"px",i||this.trigger("componentresize");return}if(!this.el_)return 0;let r=this.el_.style[e],s=r.indexOf("px");return -1!==s?parseInt(r.slice(0,s),10):parseInt(this.el_["offset"+sF(e)],10)}currentDimension(e){let t=0;if("width"!==e&&"height"!==e)throw Error("currentDimension only accepts width or height value");if(0===(t=parseFloat(t=r7(this.el_,e)))||isNaN(t)){let i=`offset${sF(e)}`;t=this.el_[i]}return t}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}getPositions(){let e=this.el_.getBoundingClientRect();return{boundingClientRect:{x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left},center:{x:e.left+e.width/2,y:e.top+e.height/2,width:0,height:0,top:e.top+e.height/2,right:e.left+e.width/2,bottom:e.top+e.height/2,left:e.left+e.width/2}}}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&(I(N).isEventKey(e,"Tab")||this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled||e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e,t=0,i=null;this.on("touchstart",function(r){1===r.touches.length&&(i={pageX:r.touches[0].pageX,pageY:r.touches[0].pageY},t=I(R).performance.now(),e=!0)}),this.on("touchmove",function(t){if(t.touches.length>1)e=!1;else if(i){let r=t.touches[0].pageX-i.pageX,s=t.touches[0].pageY-i.pageY;Math.sqrt(r*r+s*s)>10&&(e=!1)}});let r=function(){e=!1};this.on("touchleave",r),this.on("touchcancel",r),this.on("touchend",function(r){i=null,!0===e&&I(R).performance.now()-t<200&&(r.preventDefault(),this.trigger("tap"))})}enableTouchActivity(){let e;if(!this.player()||!this.player().reportUserActivity)return;let t=sv(this.player(),this.player().reportUserActivity);this.on("touchstart",function(){t(),this.clearInterval(e),e=this.setInterval(t,250)});let i=function(i){t(),this.clearInterval(e)};this.on("touchmove",t),this.on("touchend",i),this.on("touchcancel",i)}setTimeout(e,t){var i;return e=sv(this,e),this.clearTimersOnDispose_(),i=I(R).setTimeout(()=>{this.setTimeoutIds_.has(i)&&this.setTimeoutIds_.delete(i),e()},t),this.setTimeoutIds_.add(i),i}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),I(R).clearTimeout(e)),e}setInterval(e,t){e=sv(this,e),this.clearTimersOnDispose_();let i=I(R).setInterval(e,t);return this.setIntervalIds_.add(i),i}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),I(R).clearInterval(e)),e}requestAnimationFrame(e){var t;return this.clearTimersOnDispose_(),e=sv(this,e),t=I(R).requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){if(this.namedRafs_.has(e))return;this.clearTimersOnDispose_(),t=sv(this,t);let i=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)});return this.namedRafs_.set(e,i),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),I(R).cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,t])=>{this[e].forEach((e,i)=>this[t](i))}),this.clearingTimersOnDispose_=!1}))}getIsDisabled(){return!!this.el_.disabled}getIsExpresslyInert(){return this.el_.inert&&!this.el_.ownerDocument.documentElement.inert}getIsFocusable(e){return(e||this.el_).tabIndex>=0&&!(this.getIsDisabled()||this.getIsExpresslyInert())}getIsAvailableToBeFocused(e){var t;function i(e){let t=I(R).getComputedStyle(e,null),i=t.getPropertyValue("visibility");return"none"!==t.getPropertyValue("display")&&!["hidden","collapse"].includes(i)}return e||(e=this.el()),!!(function(e){if(e.offsetWidth+e.offsetHeight+e.getBoundingClientRect().height+e.getBoundingClientRect().width===0)return!1;let t={x:e.getBoundingClientRect().left+e.offsetWidth/2,y:e.getBoundingClientRect().top+e.offsetHeight/2};if(t.x<0||t.x>(I(M).documentElement.clientWidth||I(R).innerWidth)||t.y<0||t.y>(I(M).documentElement.clientHeight||I(R).innerHeight))return!1;let i=I(M).elementFromPoint(t.x,t.y);for(;i;){if(i===e)return!0;if(!i.parentNode)return!1;i=i.parentNode}}(e)&&i((t=e).parentElement)&&i(t)&&"0"!==t.style.opacity&&"0px"!==I(R).getComputedStyle(t).height&&"0px"!==I(R).getComputedStyle(t).width)&&(!e.parentElement||e.tabIndex>=0)}static registerComponent(e,t){if("string"!=typeof e||!e)throw Error(`Illegal component name, "${e}"; must be a non-empty string.`);let i=s$.getComponent("Tech"),r=i&&i.isTech(t),s=s$===t||s$.prototype.isPrototypeOf(t.prototype);if(r||!s){let t;throw t=r?"techs must be registered using Tech.registerTech()":"must be a Component subclass",Error(`Illegal component, "${e}"; ${t}.`)}e=sF(e),s$.components_||(s$.components_={});let n=s$.getComponent("Player");if("Player"===e&&n&&n.players){let e=n.players,t=Object.keys(e);if(e&&t.length>0&&t.map(t=>e[t]).every(Boolean))throw Error("Can not register Player component after player has been created.")}return s$.components_[e]=t,s$.components_[sB(e)]=t,t}static getComponent(e){if(e&&s$.components_)return s$.components_[e]}}function sV(e,t,i,r){return!function(e,t,i){if("number"!=typeof t||t<0||t>i)throw Error(`Failed to execute '${e}' on 'TimeRanges': The index provided (${t}) is non-numeric or out of bounds (0-${i}).`)}(e,r,i.length-1),i[r][t]}function sH(e){let t;return t=void 0===e||0===e.length?{length:0,start(){throw Error("This TimeRanges object is empty")},end(){throw Error("This TimeRanges object is empty")}}:{length:e.length,start:sV.bind(null,"start",0,e),end:sV.bind(null,"end",1,e)},I(R).Symbol&&I(R).Symbol.iterator&&(t[I(R).Symbol.iterator]=()=>(e||[]).values()),t}function sz(e,t){return Array.isArray(e)?sH(e):void 0===e||void 0===t?sH():sH([[e,t]])}s$.registerComponent("Component",s$);const sW=function(e,t){let i=Math.floor((e=e<0?0:e)%60),r=Math.floor(e/60%60),s=Math.floor(e/3600);return(isNaN(e)||e===1/0)&&(s=r=i="-"),r=(((s=s>0||Math.floor(t/3600)>0?s+":":"")||Math.floor(t/60%60)>=10)&&r<10?"0"+r:r)+":",s+r+(i=i<10?"0"+i:i)};let sG=sW;function sK(e){sG=e}function sX(){sG=sW}function sY(e,t=e){return sG(e,t)}var sQ=Object.freeze({__proto__:null,createTimeRanges:sz,createTimeRange:sz,setFormatTime:sK,resetFormatTime:sX,formatTime:sY});function sJ(e,t){let i,r,s=0;if(!t)return 0;e&&e.length||(e=sz(0,0));for(let n=0;nt&&(r=t),s+=r-i;return s/t}function sZ(e){if(e instanceof sZ)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:rs(e)&&("number"==typeof e.code&&(this.code=e.code),Object.assign(this,e)),this.message||(this.message=sZ.defaultMessages[this.code]||"")}function s0(e){return null!=e&&"function"==typeof e.then}function s1(e){s0(e)&&e.then(null,e=>{})}sZ.prototype.code=0,sZ.prototype.message="",sZ.prototype.status=null,sZ.prototype.metadata=null,sZ.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],sZ.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."},sZ.MEDIA_ERR_CUSTOM=0,sZ.prototype.MEDIA_ERR_CUSTOM=0,sZ.MEDIA_ERR_ABORTED=1,sZ.prototype.MEDIA_ERR_ABORTED=1,sZ.MEDIA_ERR_NETWORK=2,sZ.prototype.MEDIA_ERR_NETWORK=2,sZ.MEDIA_ERR_DECODE=3,sZ.prototype.MEDIA_ERR_DECODE=3,sZ.MEDIA_ERR_SRC_NOT_SUPPORTED=4,sZ.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4,sZ.MEDIA_ERR_ENCRYPTED=5,sZ.prototype.MEDIA_ERR_ENCRYPTED=5;const s2=function(e){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((t,i,r)=>(e[i]&&(t[i]=e[i]),t),{cues:e.cues&&Array.prototype.map.call(e.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})};var s4=function(e){let t=e.$$("track"),i=Array.prototype.map.call(t,e=>e.track);return Array.prototype.map.call(t,function(e){let t=s2(e.track);return e.src&&(t.src=e.src),t}).concat(Array.prototype.filter.call(e.textTracks(),function(e){return -1===i.indexOf(e)}).map(s2))};const s8="vjs-modal-dialog";class s5 extends s${constructor(e,t){super(e,t),this.handleKeyDown_=e=>this.handleKeyDown(e),this.close_=e=>this.close(e),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=rU("div",{className:`${s8}-content`},{role:"document"}),this.descEl_=rU("p",{className:`${s8}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),rB(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":`${this.id()}_description`,"aria-hidden":"true","aria-label":this.label(),role:"dialog","aria-live":"polite"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return`${s8} vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){if(this.opened_){this.options_.fillAlways&&this.fill();return}let e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,!this.options_.fillAlways&&(this.hasBeenOpened_||this.hasBeenFilled_)||this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}opened(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_}close(){if(!this.opened_)return;let e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger({type:"modalclose",bubbles:!0}),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(e){if("boolean"==typeof e){let t=this.closeable_=!!e,i=this.getChild("closeButton");if(t&&!i){let e=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=e,this.on(i,"close",this.close_)}!t&&i&&(this.off(i,"close",this.close_),this.removeChild(i),i.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){let t=this.contentEl(),i=t.parentNode,r=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),r8(t,e),this.trigger("modalfill"),r?i.insertBefore(t,r):i.appendChild(t);let s=this.getChild("closeButton");s&&i.appendChild(s.el_)}empty(){this.trigger("beforemodalempty"),r1(this.contentEl()),this.trigger("modalempty")}content(e){return void 0!==e&&(this.content_=e),this.content_}conditionalFocus_(){let e=I(M).activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,(t.contains(e)||t===e)&&(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){let t;if(this.trigger({type:"modalKeydown",originalEvent:e,target:this,bubbles:!0}),e.stopPropagation(),I(N).isEventKey(e,"Escape")&&this.closeable()){e.preventDefault(),this.close();return}if(!I(N).isEventKey(e,"Tab"))return;let i=this.focusableEls_(),r=this.el_.querySelector(":focus");for(let e=0;e(e instanceof I(R).HTMLAnchorElement||e instanceof I(R).HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof I(R).HTMLInputElement||e instanceof I(R).HTMLSelectElement||e instanceof I(R).HTMLTextAreaElement||e instanceof I(R).HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof I(R).HTMLIFrameElement||e instanceof I(R).HTMLObjectElement||e instanceof I(R).HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable"))}}s5.prototype.options_={pauseOnOpen:!0,temporary:!0},s$.registerComponent("ModalDialog",s5);class s3 extends sw{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let t=0;t{this.trigger({track:e,type:"labelchange",target:this})},sC(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let i=0,r=this.length;ithis.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_),-1===["metadata","chapters"].indexOf(e.kind)&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}}class ne{constructor(e){ne.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){let t=this.length||0,i=0,r=e.length;this.cues_=e,this.length_=e.length;let s=function(e){""+e in this||Object.defineProperty(this,""+e,{get(){return this.cues_[e]}})};if(tt[e],set(){}});Object.defineProperty(this,"label",{get:()=>i,set(e){e!==i&&(i=e,this.trigger("labelchange"))}})}}const na=function(e){let t=["protocol","hostname","port","pathname","search","hash","host"],i=I(M).createElement("a");i.href=e;let r={};for(let e=0;e0&&(I(R).console&&I(R).console.groupCollapsed&&I(R).console.groupCollapsed(`Text Track parsing errors for ${t.src}`),r.forEach(e=>i7.error(e)),I(R).console&&I(R).console.groupEnd&&I(R).console.groupEnd()),i.flush()},nc=function(e,t){let i={uri:e},r=nu(e);r&&(i.cors=r);let s="use-credentials"===t.tech_.crossOrigin();s&&(i.withCredentials=s),I(B)(i,sv(this,function(e,i,r){if(e)return i7.error(e,i);t.loaded_=!0,"function"!=typeof I(R).WebVTT?t.tech_&&t.tech_.any(["vttjsloaded","vttjserror"],e=>{if("vttjserror"===e.type){i7.error(`vttjs failed to load, stopping trying to process ${t.src}`);return}return nh(r,t)}):nh(r,t)}))};class np extends nn{constructor(e={}){if(!e.tech)throw Error("A tech was not provided.");let t=ra(e,{kind:nr[e.kind]||"subtitles",language:e.language||e.srclang||""}),i=ns[t.mode]||"disabled",r=t.default;("metadata"===t.kind||"chapters"===t.kind)&&(i="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=!1!==this.tech_.preloadTextTracks;let s=new ne(this.cues_),n=new ne(this.activeCues_),a=!1;this.timeupdateHandler=sv(this,function(e={}){if(!this.tech_.isDisposed()){if(!this.tech_.isReady_){"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,a&&(this.trigger("cuechange"),a=!1),"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}}),this.tech_.one("dispose",()=>{this.stopTracking()}),"disabled"!==i&&this.startTracking(),Object.defineProperties(this,{default:{get:()=>r,set(){}},mode:{get:()=>i,set(e){ns[e]&&i!==e&&(i=e,this.preload_||"disabled"===i||0!==this.cues.length||nc(this.src,this),this.stopTracking(),"disabled"!==i&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?s:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(0===this.cues.length)return n;let e=this.tech_.currentTime(),t=[];for(let i=0,r=this.cues.length;i=e&&t.push(r)}if(a=!1,t.length!==this.activeCues_.length)a=!0;else for(let e=0;ei,set(e){"boolean"==typeof e&&e!==i&&(i=e,this.trigger("enabledchange"))}}),t.enabled&&(this.enabled=t.enabled),this.loaded_=!0}}class ng extends nn{constructor(e={}){let t=ra(e,{kind:nt[e.kind]||""});super(t);let i=!1;Object.defineProperty(this,"selected",{get:()=>i,set(e){"boolean"==typeof e&&e!==i&&(i=e,this.trigger("selectedchange"))}}),t.selected&&(this.selected=t.selected)}}class nf extends sw{constructor(e={}){let t;super();let i=new np(e);this.kind=i.kind,this.src=i.src,this.srclang=i.language,this.label=i.label,this.default=i.default,Object.defineProperties(this,{readyState:{get:()=>t},track:{get:()=>i}}),t=nf.NONE,i.addEventListener("loadeddata",()=>{t=nf.LOADED,this.trigger({type:"load",target:this})})}}nf.prototype.allowedEvents_={load:"load"},nf.NONE=0,nf.LOADING=1,nf.LOADED=2,nf.ERROR=3;const ny={audio:{ListClass:class extends s3{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].enabled){s6(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&s6(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,s6(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}},TrackClass:nm,capitalName:"Audio"},video:{ListClass:class extends s3{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].selected){s7(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let e=0;e{this.changing_||(this.changing_=!0,s7(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}},TrackClass:ng,capitalName:"Video"},text:{ListClass:s9,TrackClass:np,capitalName:"Text"}};Object.keys(ny).forEach(function(e){ny[e].getterName=`${e}Tracks`,ny[e].privateName=`${e}Tracks_`});const n_={remoteText:{ListClass:s9,TrackClass:np,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:class{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,i=e.length;tthis.onDurationChange(e),this.trackProgress_=e=>this.trackProgress(e),this.trackCurrentTime_=e=>this.trackCurrentTime(e),this.stopTrackingCurrentTime_=e=>this.stopTrackingCurrentTime(e),this.disposeSourceHandler_=e=>this.disposeSourceHandler(e),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),nb.names.forEach(t=>{let i=nb[t];e&&e[i.getterName]&&(this[i.privateName]=e[i.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(t=>{!1===e[`native${t}Tracks`]&&(this[`featuresNative${t}Tracks`]=!1)}),!1===e.nativeCaptions||!1===e.nativeTextTracks?this.featuresNativeTextTracks=!1:(!0===e.nativeCaptions||!0===e.nativeTextTracks)&&(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=!1!==e.preloadTextTracks,this.autoRemoteTextTracks_=new nb.text.ListClass,this.initTrackListeners(),e.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(sv(this,function(){let e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),this.bufferedPercent_=e,1===e&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return sz(0,0)}bufferedPercent(){return sJ(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(ny.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){(e=[].concat(e)).forEach(e=>{let t=this[`${e}Tracks`]()||[],i=t.length;for(;i--;){let r=t[i];"text"===e&&this.removeRemoteTextTrack(r),t.removeTrack(r)}})}cleanupAutoTextTracks(){let e=this.autoRemoteTextTracks_||[],t=e.length;for(;t--;){let i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return void 0!==e&&(this.error_=new sZ(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?sz(0,0):sz()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){ny.names.forEach(e=>{let t=ny[e],i=()=>{this.trigger(`${e}trackchange`)},r=this[t.getterName]();r.addEventListener("removetrack",i),r.addEventListener("addtrack",i),this.on("dispose",()=>{r.removeEventListener("removetrack",i),r.removeEventListener("addtrack",i)})})}addWebVttScript_(){if(!I(R).WebVTT){if(I(M).body.contains(this.el())){if(!this.options_["vtt.js"]&&rn(I(G))&&Object.keys(I(G)).length>0){this.trigger("vttjsloaded");return}let e=I(M).createElement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",e.onload=()=>{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),I(R).WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}}emulateTextTracks(){let e=this.textTracks(),t=this.remoteTextTracks(),i=t=>e.addTrack(t.track),r=t=>e.removeTrack(t.track);t.on("addtrack",i),t.on("removetrack",r),this.addWebVttScript_();let s=()=>this.trigger("texttrackchange"),n=()=>{s();for(let t=0;tthis.autoRemoteTextTracks_.addTrack(i.track)),i}removeRemoteTextTrack(e){let t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){let t=sl++;return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return nv.canPlayType(e.type)}static isTech(e){return e.prototype instanceof nv||e instanceof nv||e===nv}static registerTech(e,t){if(nv.techs_||(nv.techs_={}),!nv.isTech(t))throw Error(`Tech ${e} must be a Tech`);if(!nv.canPlayType)throw Error("Techs must have a static canPlayType method on them");if(!nv.canPlaySource)throw Error("Techs must have a static canPlaySource method on them");return e=sF(e),nv.techs_[e]=t,nv.techs_[sB(e)]=t,"Tech"!==e&&nv.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(nv.techs_&&nv.techs_[e])return nv.techs_[e];if(e=sF(e),I(R)&&I(R).videojs&&I(R).videojs[e])return i7.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),I(R).videojs[e]}}}nb.names.forEach(function(e){let t=nb[e];nv.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}}),nv.prototype.featuresVolumeControl=!0,nv.prototype.featuresMuteControl=!0,nv.prototype.featuresFullscreenResize=!1,nv.prototype.featuresPlaybackRate=!1,nv.prototype.featuresProgressEvents=!1,nv.prototype.featuresSourceset=!1,nv.prototype.featuresTimeupdateEvents=!1,nv.prototype.featuresNativeTextTracks=!1,nv.prototype.featuresVideoFrameCallback=!1,nv.withSourceHandlers=function(e){e.registerSourceHandler=function(t,i){let r=e.sourceHandlers;r||(r=e.sourceHandlers=[]),void 0===i&&(i=r.length),r.splice(i,0,t)},e.canPlayType=function(t){let i;let r=e.sourceHandlers||[];for(let e=0;e=0;s--){let n=e[s];n[t]&&n[t](r,i)}}(e,i,o,a),o}const nk={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},nC={setCurrentTime:1,setMuted:1,setVolume:1},nD={play:1,pause:1};function nI(e){return(t,i)=>t===nE?nE:i[e]?i[e](t):t}const nx={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",mpd:"application/dash+xml",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},nA=function(e=""){return nx[nl(e).toLowerCase()]||""},nP=(e,t)=>{if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;let i=e.cache_.sources.filter(e=>e.src===t);if(i.length)return i[0].type;let r=e.$$("source");for(let e=0;e{this.focus(this.updateFocusableComponents()[0])}),this.player_.on("modalclose",()=>{this.refocusComponent()}),this.player_.on("focusin",this.handlePlayerFocus_.bind(this)),this.player_.on("focusout",this.handlePlayerBlur_.bind(this)),this.isListening_=!0)}stop(){this.player_.off("keydown",this.onKeyDown_),this.isListening_=!1}onKeyDown_(e){let t=e.originalEvent?e.originalEvent:e;if(I(N).isEventKey(t,"left")||I(N).isEventKey(t,"up")||I(N).isEventKey(t,"right")||I(N).isEventKey(t,"down")){if(this.isPaused_)return;t.preventDefault();let e=I(N)(t);this.move(e)}else if(nM.isEventKey(t,"play")||nM.isEventKey(t,"pause")||nM.isEventKey(t,"ff")||nM.isEventKey(t,"rw")){t.preventDefault();let e=nM.getEventName(t);this.performMediaAction_(e)}else nM.isEventKey(t,"Back")&&e.target&&e.target.closeable()&&(t.preventDefault(),e.target.close())}performMediaAction_(e){if(this.player_)switch(e){case"play":this.player_.paused()&&this.player_.play();break;case"pause":this.player_.paused()||this.player_.pause();break;case"ff":this.userSeek_(this.player_.currentTime()+5);break;case"rw":this.userSeek_(this.player_.currentTime()-5)}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}pause(){this.isPaused_=!0}resume(){this.isPaused_=!1}handlePlayerBlur_(e){let t=e.relatedTarget,i=null,r=this.getCurrentComponent(e.target);t&&(i=!!t.closest(".video-js"),t.classList.contains("vjs-text-track-settings")&&!this.isPaused_&&this.searchForTrackSelect_()),(!e.currentTarget.contains(e.relatedTarget)&&!i||!t)&&("CloseButton"===r.name()?this.refocusComponent():(this.pause(),r&&r.el()&&(this.lastFocusedComponent_=r)))}handlePlayerFocus_(){this.getCurrentComponent()&&this.getCurrentComponent().getIsFocusable()&&this.resume()}updateFocusableComponents(){let e=this.player_,t=[];function i(e){for(let r of e)r.hasOwnProperty("el_")&&r.getIsFocusable()&&r.getIsAvailableToBeFocused(r.el())&&t.push(r),r.hasOwnProperty("children_")&&r.children_.length>0&&i(r.children_)}return e.children_.forEach(e=>{if(e.hasOwnProperty("el_")){if(e.getIsFocusable&&e.getIsAvailableToBeFocused&&e.getIsFocusable()&&e.getIsAvailableToBeFocused(e.el())){t.push(e);return}e.hasOwnProperty("children_")&&e.children_.length>0?i(e.children_):e.hasOwnProperty("items")&&e.items.length>0?i(e.items):this.findSuitableDOMChild(e)&&t.push(e)}}),this.focusableComponents=t,this.focusableComponents}findSuitableDOMChild(e){return function t(i){if(e.getIsFocusable(i)&&e.getIsAvailableToBeFocused(i))return i;for(let e=0;e0&&(this.focusableComponents=[],this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents}))}move(e){let t=this.getCurrentComponent();if(!t)return;let i=t.getPositions(),r=this.focusableComponents.filter(r=>r!==t&&this.isInDirection_(i.boundingClientRect,r.getPositions().boundingClientRect,e)),s=this.findBestCandidate_(i.center,r,e);s?this.focus(s):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:t})}findBestCandidate_(e,t,i){let r=1/0,s=null;for(let n of t){let t=n.getPositions().center,a=this.calculateDistance_(e,t,i);a=e.right;case"left":return t.right<=e.left;case"down":return t.top>=e.bottom;case"up":return t.bottom<=e.top;default:return!1}}refocusComponent(){if(this.lastFocusedComponent_){this.player_.userActive()||this.player_.userActive(!0),this.updateFocusableComponents();for(let e=0;ethis.handleMouseOver(e),this.handleMouseOut_=e=>this.handleMouseOut(e),this.handleClick_=e=>this.handleClick(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.emitTapEvents(),this.enable()}createEl(e="div",t={},i={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),"button"===e&&i7.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),i=Object.assign({role:"button"},i),this.tabIndex_=t.tabIndex;let r=rU(e,t,i);return this.player_.options_.experimentalSvgIcons||r.appendChild(rU("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=rU("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(void 0===e)return this.controlText_||"Need Text";let i=this.localize(e);this.controlText_=e,rB(this.controlTextEl_,i),this.nonIconControl||this.player_.options_.noUITitleAttributes||t.setAttribute("title",i)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),void 0!==this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),void 0!==this.tabIndex_&&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_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){I(N).isEventKey(e,"Space")||I(N).isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}s$.registerComponent("ClickableComponent",nU);class nB extends nU{constructor(e,t){super(e,t),this.update(),this.update_=e=>this.update(e),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return rU("div",{className:"vjs-poster"})}crossOrigin(e){if(void 0===e)return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;if(null!==e&&"anonymous"!==e&&"use-credentials"!==e){this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.$("img")&&(this.$("img").crossOrigin=e)}update(e){let t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){if(!e){this.el_.textContent="";return}this.$("img")||this.el_.appendChild(rU("picture",{className:"vjs-poster",tabIndex:-1},{},rU("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?s1(this.player_.play()):this.player_.pause())}}nB.prototype.crossorigin=nB.prototype.crossOrigin,s$.registerComponent("PosterImage",nB);const nF="#222",nq="#ccc",nj={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function n$(e,t){let i;if(4===e.length)i=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else if(7===e.length)i=e.slice(1);else throw Error("Invalid color code provided, "+e+"; 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 nV(e,t,i){try{e.style[t]=i}catch(e){return}}function nH(e){return e?`${e}px`:""}s$.registerComponent("TextTrackDisplay",class extends s${constructor(e,t,i){super(e,t,i);let r=e=>{this.updateDisplayOverlay(),this.updateDisplay(e)};e.on("loadstart",e=>this.toggleDisplay(e)),e.on("texttrackchange",e=>this.updateDisplay(e)),e.on("loadedmetadata",e=>{this.updateDisplayOverlay(),this.preselectTrack(e)}),e.ready(sv(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",r),e.on("playerresize",r);let t=I(R).screen.orientation||I(R),i=I(R).screen.orientation?"change":"orientationchange";t.addEventListener(i,r),e.on("dispose",()=>t.removeEventListener(i,r));let s=this.options_.playerOptions.tracks||[];for(let e=0;e.1&&(i>r?s=Math.round((e-t*r)/2):n=Math.round((t-e/r)/2)),nV(this.el_,"insetInline",nH(s)),nV(this.el_,"insetBlock",nH(n))}updateDisplayState(e){let t=this.player_.textTrackSettings.getValues(),i=e.activeCues,r=i.length;for(;r--;){let e=i[r];if(!e)continue;let s=e.displayState;if(t.color&&(s.firstChild.style.color=t.color),t.textOpacity&&nV(s.firstChild,"color",n$(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(s.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&nV(s.firstChild,"backgroundColor",n$(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?nV(s,"backgroundColor",n$(t.windowColor,t.windowOpacity)):s.style.backgroundColor=t.windowColor),t.edgeStyle&&("dropshadow"===t.edgeStyle?s.firstChild.style.textShadow=`2px 2px 3px ${nF}, 2px 2px 4px ${nF}, 2px 2px 5px ${nF}`:"raised"===t.edgeStyle?s.firstChild.style.textShadow=`1px 1px ${nF}, 2px 2px ${nF}, 3px 3px ${nF}`:"depressed"===t.edgeStyle?s.firstChild.style.textShadow=`1px 1px ${nq}, 0 1px ${nq}, -1px -1px ${nF}, 0 -1px ${nF}`:"uniform"===t.edgeStyle&&(s.firstChild.style.textShadow=`0 0 4px ${nF}, 0 0 4px ${nF}, 0 0 4px ${nF}, 0 0 4px ${nF}`)),t.fontPercent&&1!==t.fontPercent){let e=I(R).parseFloat(s.style.fontSize);s.style.fontSize=e*t.fontPercent+"px",s.style.height="auto",s.style.top="auto"}t.fontFamily&&"default"!==t.fontFamily&&("small-caps"===t.fontFamily?s.firstChild.style.fontVariant="small-caps":s.firstChild.style.fontFamily=nj[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),"function"!=typeof I(R).WebVTT||e.every(e=>!e.activeCues))return;let t=[];for(let i=0;ithis.handleMouseDown(e))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){let t=this.player_.play();if(this.mouseused_&&"clientX"in e&&"clientY"in e){s1(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();return}let i=this.player_.getChild("controlBar"),r=i&&i.getChild("playToggle");if(!r){this.player_.tech(!0).focus();return}let s=()=>r.focus();s0(t)?t.then(s,()=>{}):this.setTimeout(s,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}nW.prototype.controlText_="Play Video",s$.registerComponent("BigPlayButton",nW),s$.registerComponent("CloseButton",class extends nz{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return`vjs-close-button ${super.buildCSSClass()}`}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){I(N).isEventKey(e,"Esc")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}});class nG extends nz{constructor(e,t={}){super(e,t),t.replay=void 0===t.replay||t.replay,this.setIcon("play"),this.on(e,"play",e=>this.handlePlay(e)),this.on(e,"pause",e=>this.handlePause(e)),t.replay&&this.on(e,"ended",e=>this.handleEnded(e))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?s1(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",e=>this.handleSeeked(e))}}nG.prototype.controlText_="Play",s$.registerComponent("PlayToggle",nG);class nK extends s${constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],e=>this.update(e)),this.updateTextNode_()}createEl(){let e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),i=rU("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)}\u00a0`},{role:"presentation"});return t.appendChild(i),this.contentEl_=rU("span",{className:`${e}-display`},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}update(e){(this.player_.options_.enableSmoothSeeking||"seeking"!==e.type)&&this.updateContent(e)}updateTextNode_(e=0){e=sY(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(!this.contentEl_)return;let e=this.textNode_;e&&this.contentEl_.firstChild!==e&&(e=null,i7.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=I(M).createTextNode(this.formattedTime_),this.textNode_&&(e?this.contentEl_.replaceChild(this.textNode_,e):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}nK.prototype.labelText_="Time",nK.prototype.controlText_="Time",s$.registerComponent("TimeDisplay",nK);class nX extends nK{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}nX.prototype.labelText_="Current Time",nX.prototype.controlText_="Current Time",s$.registerComponent("CurrentTimeDisplay",nX);class nY extends nK{constructor(e,t){super(e,t);let i=e=>this.updateContent(e);this.on(e,"durationchange",i),this.on(e,"loadstart",i),this.on(e,"loadedmetadata",i)}buildCSSClass(){return"vjs-duration"}updateContent(e){let t=this.player_.duration();this.updateTextNode_(t)}}nY.prototype.labelText_="Duration",nY.prototype.controlText_="Duration",s$.registerComponent("DurationDisplay",nY),s$.registerComponent("TimeDivider",class extends s${createEl(){let e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),i=super.createEl("span",{textContent:"/"});return t.appendChild(i),e.appendChild(t),e}});class nQ extends nK{constructor(e,t){super(e,t),this.on(e,"durationchange",e=>this.updateContent(e))}buildCSSClass(){return"vjs-remaining-time"}createEl(){let e=super.createEl();return!1!==this.options_.displayNegative&&e.insertBefore(rU("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){let t;"number"==typeof this.player_.duration()&&(t=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(t))}}nQ.prototype.labelText_="Remaining Time",nQ.prototype.controlText_="Remaining Time",s$.registerComponent("RemainingTimeDisplay",nQ),s$.registerComponent("LiveDisplay",class extends s${constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",e=>this.updateShowing(e))}createEl(){let e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=rU("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(rU("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")}\u00a0`})),this.contentEl_.appendChild(I(M).createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}});class nJ extends nz{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=e=>this.updateLiveEdgeStatus(e),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){let e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=rU("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!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"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}function nZ(e,t,i){return Math.min(i,Math.max(t,isNaN(e=Number(e))?t:e))}nJ.prototype.controlText_="Seek to live, currently playing live",s$.registerComponent("SeekToLive",nJ);var n0=Object.freeze({__proto__:null,clamp:nZ});class n1 extends s${constructor(e,t){super(e,t),this.handleMouseDown_=e=>this.handleMouseDown(e),this.handleMouseUp_=e=>this.handleMouseUp(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.handleClick_=e=>this.handleClick(e),this.handleMouseMove_=e=>this.handleMouseMove(e),this.update_=e=>this.update(e),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){if(!this.enabled())return;let e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}createEl(e,t={},i={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),i=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},i),super.createEl(e,t,i)}handleMouseDown(e){let t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||rf||e.preventDefault(),rX(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){let t=this.bar.el_.ownerDocument;rY(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(!this.el_||!this.bar)return;let e=this.getProgress();return e===this.progress_||(this.progress_=e,this.requestNamedAnimationFrame("Slider#update",()=>{let t=this.vertical()?"height":"width";this.bar.el().style[t]=(100*e).toFixed(2)+"%"})),e}getProgress(){return Number(nZ(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){let t=rZ(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){let t=this.options_.playerOptions.spatialNavigation,i=t&&t.enabled,r=t&&t.horizontalSeek;i?r&&I(N).isEventKey(e,"Left")||!r&&I(N).isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepBack()):r&&I(N).isEventKey(e,"Right")||!r&&I(N).isEventKey(e,"Up")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e):I(N).isEventKey(e,"Left")||I(N).isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepBack()):I(N).isEventKey(e,"Right")||I(N).isEventKey(e,"Up")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}s$.registerComponent("Slider",n1);const n2=(e,t)=>nZ(e/t*100,0,100).toFixed(2)+"%";s$.registerComponent("LoadProgressBar",class extends s${constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",e=>this.update(e))}createEl(){let e=super.createEl("div",{className:"vjs-load-progress"}),t=rU("span",{className:"vjs-control-text"}),i=rU("span",{textContent:this.localize("Loaded")}),r=I(M).createTextNode(": ");return this.percentageEl_=rU("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),t.appendChild(r),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{let e=this.player_.liveTracker,t=this.player_.buffered(),i=e&&e.isLive()?e.seekableEnd():this.player_.duration(),r=this.player_.bufferedEnd(),s=this.partEls_,n=n2(r,i);this.percent_!==n&&(this.el_.style.width=n,rB(this.percentageEl_,n),this.percent_=n);for(let e=0;et.length;e--)this.el_.removeChild(s[e-1]);s.length=t.length})}}),s$.registerComponent("TimeTooltip",class extends s${constructor(e,t){super(e,t),this.update=sT(sv(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,i){let r=rJ(this.el_),s=rQ(this.player_.el()),n=e.width*t;if(!s||!r)return;let a=e.left-s.left+n,o=e.width-n+(s.right-e.right);o||(o=e.width-n,a=n);let l=r.width/2;ar.width&&(l=r.width),l=Math.round(l),this.el_.style.right=`-${l}px`,this.write(i)}write(e){rB(this.el_,e)}updateTime(e,t,i,r){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let s;let n=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){let e=this.player_.liveTracker.liveWindow(),i=e-t*e;s=(i<1?"":"-")+sY(i,e)}else s=sY(i,n);this.update(e,t,s),r&&r()})}});class n4 extends s${constructor(e,t){super(e,t),this.setIcon("circle"),this.update=sT(sv(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){let i=this.getChild("timeTooltip");if(!i)return;let r=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();i.updateTime(e,t,r)}}n4.prototype.options_={children:[]},rx||rc||n4.prototype.options_.children.push("timeTooltip"),s$.registerComponent("PlayProgressBar",n4);class n8 extends s${constructor(e,t){super(e,t),this.update=sT(sv(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){let i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,()=>{this.el_.style.left=`${e.width*t}px`})}}n8.prototype.options_={children:["timeTooltip"]},s$.registerComponent("MouseTimeDisplay",n8);class n5 extends n1{constructor(e,t){super(e,t),this.setEventHandlers_()}setEventHandlers_(){this.update_=sv(this,this.update),this.update=sT(this.update_,30),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in I(M)&&"visibilityState"in I(M)&&this.on(I(M),"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){"hidden"===I(M).visibilityState?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,30))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||!this.updateInterval||(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if("hidden"===I(M).visibilityState)return;let t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{let e=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),i=this.player_.liveTracker,r=this.player_.duration();i&&i.isLive()&&(r=this.player_.liveTracker.liveCurrentTime()),this.percent_!==t&&(this.el_.setAttribute("aria-valuenow",(100*t).toFixed(2)),this.percent_=t),(this.currentTime_!==e||this.duration_!==r)&&(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[sY(e,r),sY(r,r)],"{1} of {2}")),this.currentTime_=e,this.duration_=r),this.bar&&this.bar.update(rQ(this.el()),this.getProgress())}),t}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}getPercent(){let e;let t=this.getCurrentTime_(),i=this.player_.liveTracker;return i&&i.isLive()?(e=(t-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(e=1)):e=t/this.player_.duration(),e}handleMouseDown(e){r5(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){let i;if(!r5(e)||isNaN(this.player_.duration()))return;t||this.player_.scrubbing()||this.player_.scrubbing(!0);let r=this.calculateDistance(e),s=this.player_.liveTracker;if(s&&s.isLive()){if(r>=.99){s.seekToLiveEdge();return}let e=s.seekableStart(),t=s.liveCurrentTime();if((i=e+r*s.liveWindow())>=t&&(i=t),i<=e&&(i=e+.1),i===1/0)return}else(i=r*this.player_.duration())===this.player_.duration()&&(i-=.1);this.userSeek_(i),this.player_.options_.enableSmoothSeeking&&this.update()}enable(){super.enable();let e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();let e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?s1(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+5)}stepBack(){this.userSeek_(this.player_.currentTime()-5)}handleAction(e){this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){let t=this.player_.liveTracker;if(I(N).isEventKey(e,"Space")||I(N).isEventKey(e,"Enter"))e.preventDefault(),e.stopPropagation(),this.handleAction(e);else if(I(N).isEventKey(e,"Home"))e.preventDefault(),e.stopPropagation(),this.userSeek_(0);else if(I(N).isEventKey(e,"End"))e.preventDefault(),e.stopPropagation(),t&&t.isLive()?this.userSeek_(t.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(I(N)(e))){e.preventDefault(),e.stopPropagation();let i=(I(N).codes[I(N)(e)]-I(N).codes["0"])*10/100;t&&t.isLive()?this.userSeek_(t.seekableStart()+t.liveWindow()*i):this.userSeek_(this.player_.duration()*i)}else I(N).isEventKey(e,"PgDn")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):I(N).isEventKey(e,"PgUp")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):super.handleKeyDown(e)}dispose(){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 I(M)&&"visibilityState"in I(M)&&this.off(I(M),"visibilitychange",this.toggleVisibility_),super.dispose()}}n5.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},rx||rc||n5.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),s$.registerComponent("SeekBar",n5);class n3 extends s${constructor(e,t){super(e,t),this.handleMouseMove=sT(sv(this,this.handleMouseMove),30),this.throttledHandleMouseSeek=sT(sv(this,this.handleMouseSeek),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.handleMouseDownHandler_=e=>this.handleMouseDown(e),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){let t=this.getChild("seekBar");if(!t)return;let i=t.getChild("playProgressBar"),r=t.getChild("mouseTimeDisplay");if(!i&&!r)return;let s=t.el(),n=rJ(s),a=rZ(s,e).x;a=nZ(a,0,1),r&&r.update(n,a),i&&i.update(n,t.getProgress())}handleMouseSeek(e){let t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){if(this.children().forEach(e=>e.disable&&e.disable()),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){let e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&s1(this.player_.play())}}enable(){this.children().forEach(e=>e.enable&&e.enable()),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){let e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){let t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){let t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}n3.prototype.options_={children:["seekBar"]},s$.registerComponent("ProgressControl",n3);class n6 extends nz{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],e=>this.handlePictureInPictureChange(e)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],e=>this.handlePictureInPictureEnabledChange(e)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return`vjs-picture-in-picture-control vjs-hidden ${super.buildCSSClass()}`}handlePictureInPictureAudioModeChange(){if(!("audio"===this.player_.currentType().substring(0,5)||this.player_.audioPosterMode()||this.player_.audioOnlyMode())){this.show();return}this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()}handlePictureInPictureEnabledChange(){I(M).pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in I(R)?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}show(){"function"==typeof I(M).exitPictureInPicture&&super.show()}}n6.prototype.controlText_="Picture-in-Picture",s$.registerComponent("PictureInPictureToggle",n6);class n7 extends nz{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",e=>this.handleFullscreenChange(e)),!1===I(M)[e.fsApi_.fullscreenEnabled]&&this.disable()}buildCSSClass(){return`vjs-fullscreen-control ${super.buildCSSClass()}`}handleFullscreenChange(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}n7.prototype.controlText_="Fullscreen",s$.registerComponent("FullscreenToggle",n7);const n9=function(e,t){t.tech_&&!t.tech_.featuresVolumeControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",function(){t.tech_.featuresVolumeControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")})};s$.registerComponent("VolumeLevel",class extends s${createEl(){let e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}),s$.registerComponent("VolumeLevelTooltip",class extends s${constructor(e,t){super(e,t),this.update=sT(sv(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,i,r){if(!i){let i=rQ(this.el_),r=rQ(this.player_.el()),s=e.width*t;if(!r||!i)return;let n=e.left-r.left+s,a=e.width-s+(r.right-e.right),o=i.width/2;ni.width&&(o=i.width),this.el_.style.right=`-${o}px`}this.write(`${r}%`)}write(e){rB(this.el_,e)}updateVolume(e,t,i,r,s){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,i,r.toFixed(0)),s&&s()})}});class ae extends s${constructor(e,t){super(e,t),this.update=sT(sv(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){this.getChild("volumeLevelTooltip").updateVolume(e,t,i,100*t,()=>{i?this.el_.style.bottom=`${e.height*t}px`:this.el_.style.left=`${e.width*t}px`})}}ae.prototype.options_={children:["volumeLevelTooltip"]},s$.registerComponent("MouseVolumeLevelDisplay",ae);class at extends n1{constructor(e,t){super(e,t),this.on("slideractive",e=>this.updateLastVolume_(e)),this.on(e,"volumechange",e=>this.updateARIAAttributes(e)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){r5(e)&&super.handleMouseDown(e)}handleMouseMove(e){let t=this.getChild("mouseVolumeLevelDisplay");if(t){let i=this.el(),r=rQ(i),s=this.vertical(),n=rZ(i,e);n=nZ(n=s?n.y:n.x,0,1),t.update(r,n,s)}r5(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){let t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(100*this.player_.volume())}updateLastVolume_(){let e=this.player_.volume();this.one("sliderinactive",()=>{0===this.player_.volume()&&this.player_.lastVolume_(e)})}}at.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},rx||rc||at.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),at.prototype.playerEvent="volumechange",s$.registerComponent("VolumeBar",at);class ai extends s${constructor(e,t={}){t.vertical=t.vertical||!1,(void 0===t.volumeBar||rn(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),n9(this,e),this.throttledHandleMouseMove=sT(sv(this,this.handleMouseMove),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.on("mousedown",e=>this.handleMouseDown(e)),this.on("touchstart",e=>this.handleMouseDown(e)),this.on("mousemove",e=>this.handleMouseMove(e)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:`vjs-volume-control vjs-control ${e}`})}handleMouseDown(e){let t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){let t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}ai.prototype.options_={children:["volumeBar"]},s$.registerComponent("VolumeControl",ai);const ar=function(e,t){t.tech_&&!t.tech_.featuresMuteControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",function(){t.tech_.featuresMuteControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")})};class as extends nz{constructor(e,t){super(e,t),ar(this,e),this.on(e,["loadstart","volumechange"],e=>this.update(e))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){let t=this.player_.volume(),i=this.player_.lastVolume_();0===t?(this.player_.volume(i<.1?.1:i),this.player_.muted(!1)):this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){let e=this.player_.volume(),t=3;this.setIcon("volume-high"),rx&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),r$(this.el_,[0,1,2,3].reduce((e,t)=>e+`${t?" ":""}vjs-vol-${t}`,"")),rj(this.el_,`vjs-vol-${t}`)}updateControlText_(){let e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}as.prototype.controlText_="Mute",s$.registerComponent("MuteToggle",as);class an extends s${constructor(e,t={}){void 0!==t.inline?t.inline=t.inline:t.inline=!0,(void 0===t.volumeControl||rn(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=e=>this.handleKeyPress(e),this.on(e,["loadstart"],e=>this.volumePanelState_(e)),this.on(this.muteToggle,"keyup",e=>this.handleKeyPress(e)),this.on(this.volumeControl,"keyup",e=>this.handleVolumeControlKeyUp(e)),this.on("keydown",e=>this.handleKeyPress(e)),this.on("mouseover",e=>this.handleMouseOver(e)),this.on("mouseout",e=>this.handleMouseOut(e)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){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")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:`vjs-volume-panel vjs-control ${e}`})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){I(N).isEventKey(e,"Esc")&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),sm(I(M),"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),sg(I(M),"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){I(N).isEventKey(e,"Esc")&&this.handleMouseOut()}}an.prototype.options_={children:["muteToggle","volumeControl"]},s$.registerComponent("VolumePanel",an);class aa extends nz{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`forward-${this.skipTime}`),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipForwardTime(){let e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`}handleClick(e){let t;if(isNaN(this.player_.duration()))return;let i=this.player_.currentTime(),r=this.player_.liveTracker,s=r&&r.isLive()?r.seekableEnd():this.player_.duration();t=i+this.skipTime<=s?i+this.skipTime:s,this.player_.currentTime(t)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}aa.prototype.controlText_="Skip Forward",s$.registerComponent("SkipForward",aa);class ao extends nz{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`replay-${this.skipTime}`),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipBackwardTime(){let e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`}handleClick(e){let t;let i=this.player_.currentTime(),r=this.player_.liveTracker,s=r&&r.isLive()&&r.seekableStart();t=s&&i-this.skipTime<=s?s:i>=this.skipTime?i-this.skipTime:0,this.player_.currentTime(t)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}ao.prototype.controlText_="Skip Backward",s$.registerComponent("SkipBackward",ao);class al extends s${constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",e=>this.handleKeyDown(e)),this.boundHandleBlur_=e=>this.handleBlur(e),this.boundHandleTapClick_=e=>this.handleTapClick(e)}addEventListenerForItem(e){e instanceof s$&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof s$&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){"string"==typeof e&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){let t=this.addChild(e);t&&this.addEventListenerForItem(t)}createEl(){let e=this.options_.contentElType||"ul";this.contentEl_=rU(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");let t=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return t.appendChild(this.contentEl_),sm(t,"click",function(e){e.preventDefault(),e.stopImmediatePropagation()}),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){let t=e.relatedTarget||I(M).activeElement;if(!this.children().some(e=>e.el()===t)){let e=this.menuButton_;e&&e.buttonPressed_&&t!==e.el().firstChild&&e.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();let t=this.children();if(!Array.isArray(t))return;let i=t.filter(t=>t.el()===e.target)[0];i&&"CaptionSettingsMenuItem"!==i.name()&&this.menuButton_.focus()}}handleKeyDown(e){I(N).isEventKey(e,"Left")||I(N).isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(I(N).isEventKey(e,"Right")||I(N).isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){let t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())}}s$.registerComponent("Menu",al);class au extends s${constructor(e,t={}){super(e,t),this.menuButton_=new nz(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");let i=nz.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+i,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;let r=e=>this.handleClick(e);this.handleMenuKeyUp_=e=>this.handleMenuKeyUp(e),this.on(this.menuButton_,"tap",r),this.on(this.menuButton_,"click",r),this.on(this.menuButton_,"keydown",e=>this.handleKeyDown(e)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),sm(I(M),"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",e=>this.handleMouseLeave(e)),this.on("keydown",e=>this.handleSubmenuKeyDown(e))}update(){let e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){let e=new al(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){let t=rU("li",{className:"vjs-menu-title",textContent:sF(this.options_.title),tabIndex:-1}),i=new s$(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(let t=0;tI(N).isEventKey(e,t))||super.handleKeyDown(e)}handleClick(e){this.selected(!0)}selected(e){this.selectable&&(e?(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))}}s$.registerComponent("MenuItem",ac);class ap extends ac{constructor(e,t){let i=t.track,r=e.textTracks();t.label=i.label||i.language||"Unknown",t.selected="showing"===i.mode,super(e,t),this.track=i,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean);let s=(...e)=>{this.handleTracksChange.apply(this,e)},n=(...e)=>{this.handleSelectedLanguageChange.apply(this,e)};if(e.on(["loadstart","texttrackchange"],s),r.addEventListener("change",s),r.addEventListener("selectedlanguagechange",n),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],s),r.removeEventListener("change",s),r.removeEventListener("selectedlanguagechange",n)}),void 0===r.onchange){let e;this.on(["tap","click"],function(){if("object"!=typeof I(R).Event)try{e=new(I(R)).Event("change")}catch(e){}e||(e=I(M).createEvent("Event")).initEvent("change",!0,!0),r.dispatchEvent(e)})}this.handleTracksChange()}handleClick(e){let t=this.track,i=this.player_.textTracks();if(super.handleClick(e),i)for(let e=0;e-1&&"showing"===r.mode){i=!1;break}}i!==this.isSelected_&&this.selected(i)}handleSelectedLanguageChange(e){let t=this.player().textTracks(),i=!0;for(let e=0,r=t.length;e-1&&"showing"===r.mode){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}s$.registerComponent("OffTextTrackMenuItem",am);class ag extends ad{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=ap){let i;this.label_&&(i=`${this.label_} off`),e.push(new am(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;let r=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let i=0;i-1){let i=new t(this.player_,{track:s,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});i.addClass(`vjs-${s.kind}-menu-item`),e.push(i)}}return e}}s$.registerComponent("TextTrackButton",ag);class af extends ac{constructor(e,t){let i=t.track,r=t.cue,s=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=r.text,t.selected=r.startTime<=s&&s{this.items.forEach(e=>{e.selected(this.track_.activeCues[0]===e.cue)})}}buildCSSClass(){return`vjs-chapters-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-chapters-button ${super.buildWrapperCSSClass()}`}update(e){if(e&&e.track&&"chapters"!==e.track.kind)return;let t=this.findChaptersTrack();t!==this.track_?(this.setTrack(t),super.update()):(!this.items||t&&t.cues&&t.cues.length!==this.items.length)&&super.update()}setTrack(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){let e=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);e&&e.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";let e=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);e&&e.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}}findChaptersTrack(){let e=this.player_.textTracks()||[];for(let t=e.length-1;t>=0;t--){let i=e[t];if(i.kind===this.kind_)return i}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(sF(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){let e=[];if(!this.track_)return e;let t=this.track_.cues;if(!t)return e;for(let i=0,r=t.length;i-1&&(this.label_="captions",this.setIcon("captions")),this.menuButton_.controlText(sF(this.label_))}buildCSSClass(){return`vjs-subs-caps-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subs-caps-button ${super.buildWrapperCSSClass()}`}createItems(){let e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new av(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,aS)}}aE.prototype.kinds_=["captions","subtitles"],aE.prototype.controlText_="Subtitles",s$.registerComponent("SubsCapsButton",aE);class aw extends ac{constructor(e,t){let i=t.track,r=e.audioTracks();t.label=i.label||i.language||"Unknown",t.selected=i.enabled,super(e,t),this.track=i,this.addClass(`vjs-${i.kind}-menu-item`);let s=(...e)=>{this.handleTracksChange.apply(this,e)};r.addEventListener("change",s),this.on("dispose",()=>{r.removeEventListener("change",s)})}createEl(e,t,i){let r=super.createEl(e,t,i),s=r.querySelector(".vjs-menu-item-text");return["main-desc","description"].indexOf(this.options_.track.kind)>=0&&(s.appendChild(rU("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),s.appendChild(rU("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),r}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){let e=this.player_.audioTracks();for(let t=0;tthis.update(e))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}aC.prototype.contentElType="button",s$.registerComponent("PlaybackRateMenuItem",aC);class aD extends au{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",e=>this.updateVisibility(e)),this.on(e,"ratechange",e=>this.updateLabel(e)),this.on(e,"playbackrateschange",e=>this.handlePlaybackRateschange(e))}createEl(){let e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=rU("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){let e=this.playbackRates(),t=[];for(let i=e.length-1;i>=0;i--)t.push(new aC(this.player(),{rate:e[i]+"x"}));return t}handlePlaybackRateschange(e){this.update()}playbackRates(){let e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}updateVisibility(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")}updateLabel(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")}}aD.prototype.controlText_="Playback Rate",s$.registerComponent("PlaybackRateMenuButton",aD);class aI extends s${buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},i={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,i)}}s$.registerComponent("Spacer",aI),s$.registerComponent("CustomControlSpacer",class extends aI{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}});class ax extends s${createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}ax.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]},s$.registerComponent("ControlBar",ax);class aA extends s5{constructor(e,t){super(e,t),this.on(e,"error",e=>{this.open(e)})}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){let e=this.player().error();return e?this.localize(e.message):""}}aA.prototype.options_=Object.assign({},s5.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),s$.registerComponent("ErrorDisplay",aA);class aP extends s${constructor(e,t={}){super(e,t),this.el_.setAttribute("aria-labelledby",this.selectLabelledbyIds)}createEl(){return this.selectLabelledbyIds=[this.options_.legendId,this.options_.labelId].join(" ").trim(),rU("select",{id:this.options_.id},{},this.options_.SelectOptions.map(e=>{let t=this.options_.labelId+"-"+e[1].replace(/\W+/g,""),i=rU("option",{id:t,value:this.localize(e[0]),textContent:e[1]});return i.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${t}`),i}))}}s$.registerComponent("TextTrackSelect",aP);class aL extends s${constructor(e,t={}){super(e,t);let i=rU("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});for(let t of(this.el().appendChild(i),this.options_.selects)){let i=this.options_.selectConfigs[t],r=i.className,s=i.id.replace("%s",this.options_.id_),n=null,a=`vjs_select_${sl++}`;if("colors"===this.options_.type){n=rU("span",{className:r});let e=rU("label",{id:s,className:"vjs-label",textContent:i.label});e.setAttribute("for",a),n.appendChild(e)}let o=new aP(e,{SelectOptions:i.options,legendId:this.options_.legendId,id:a,labelId:s});this.addChild(o),"colors"===this.options_.type&&(n.appendChild(o.el()),this.el().appendChild(n))}}createEl(){return rU("fieldset",{className:this.options_.className})}}s$.registerComponent("TextTrackFieldset",aL);class aO extends s${constructor(e,t={}){super(e,t);let i=this.options_.textTrackComponentid,r=new aL(e,{id_:i,legendId:`captions-text-legend-${i}`,legendText:this.localize("Text"),className:"vjs-fg vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(r);let s=new aL(e,{id_:i,legendId:`captions-background-${i}`,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(s);let n=new aL(e,{id_:i,legendId:`captions-window-${i}`,legendText:this.localize("Caption Area Background"),className:"vjs-window vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(n)}createEl(){return rU("div",{className:"vjs-track-settings-colors"})}}s$.registerComponent("TextTrackSettingsColors",aO);class aR extends s${constructor(e,t={}){super(e,t);let i=this.options_.textTrackComponentid,r=new aL(e,{id_:i,legendId:`captions-font-size-${i}`,legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(r);let s=new aL(e,{id_:i,legendId:`captions-background-${i}`,legendText:this.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(s);let n=new aL(e,{id_:i,legendId:`captions-font-family-${i}`,legendText:this.localize("Font Family"),className:"vjs-font-family vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(n)}createEl(){return rU("div",{className:"vjs-track-settings-font"})}}s$.registerComponent("TextTrackSettingsFont",aR);class aM extends s${constructor(e,t={}){super(e,t);let i=this.localize("restore all settings to the default values"),r=new nz(e,{controlText:i,className:"vjs-default-button"});r.el().classList.remove("vjs-control","vjs-button"),r.el().textContent=this.localize("Reset"),this.addChild(r);let s=new nz(e,{controlText:i,className:"vjs-done-button"});s.el().classList.remove("vjs-control","vjs-button"),s.el().textContent=this.localize("Done"),this.addChild(s)}createEl(){return rU("div",{className:"vjs-track-settings-controls"})}}s$.registerComponent("TrackSettingsControls",aM);const aN="vjs-text-track-settings",aU=["#000","Black"],aB=["#00F","Blue"],aF=["#0FF","Cyan"],aq=["#0F0","Green"],aj=["#F0F","Magenta"],a$=["#F00","Red"],aV=["#FFF","White"],aH=["#FF0","Yellow"],az=["1","Opaque"],aW=["0.5","Semi-Transparent"],aG=["0","Transparent"],aK={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[aU,aV,a$,aq,aB,aH,aj,aF],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[az,aW,aG],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[aV,aU,a$,aq,aB,aH,aj,aF],className:"vjs-text-color"},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},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:e=>"1.00"===e?null:Number(e)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[az,aW],className:"vjs-text-opacity vjs-opacity"},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color",className:"vjs-window-color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[aG,aW,az],className:"vjs-window-opacity vjs-opacity"}};function aX(e,t){if(t&&(e=t(e)),e&&"none"!==e)return e}aK.windowColor.options=aK.backgroundColor.options,s$.registerComponent("TextTrackSettings",class extends s5{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.renderModalComponents(e),this.endDialog=rU("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),void 0===t.persistTextTrackSettings&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.bindFunctionsToSelectsAndButtons(),this.options_.persistTextTrackSettings&&this.restoreSettings()}renderModalComponents(e){let t=new aO(e,{textTrackComponentid:this.id_,selectConfigs:aK,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);let i=new aR(e,{textTrackComponentid:this.id_,selectConfigs:aK,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(i);let r=new aM(e);this.addChild(r)}bindFunctionsToSelectsAndButtons(){this.on(this.$(".vjs-done-button"),"click",()=>{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),"click",()=>{this.setDefaults(),this.updateDisplay()}),ri(aK,e=>{this.on(this.$(e.selector),"change",this.updateDisplay)})}dispose(){this.endDialog=null,super.dispose()}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return rr(aK,(e,t,i)=>{var r,s;let n=(r=this.$(t.selector),s=t.parser,aX(r.options[r.options.selectedIndex].value,s));return void 0!==n&&(e[i]=n),e},{})}setValues(e){ri(aK,(t,i)=>{!function(e,t,i){if(t){for(let r=0;r{let t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(I(R).localStorage.getItem(aN))}catch(e){i7.warn(e)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;let e=this.getValues();try{Object.keys(e).length?I(R).localStorage.setItem(aN,JSON.stringify(e)):I(R).localStorage.removeItem(aN)}catch(e){i7.warn(e)}}updateDisplay(){let e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}),s$.registerComponent("ResizeManager",class extends s${constructor(e,t){let i=t.ResizeObserver||I(R).ResizeObserver;null===t.ResizeObserver&&(i=!1),super(e,ra({createEl:!i,reportTouchActivity:!1},t)),this.ResizeObserver=t.ResizeObserver||I(R).ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=sS(()=>{this.resizeHandler()},100,!1,this),i?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;let e=this.debouncedHandler_,t=this.unloadListener_=function(){sg(this,"resize",e),sg(this,"unload",t),t=null};sm(this.el_.contentWindow,"unload",t),sm(this.el_.contentWindow,"resize",e)},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")}dispose(){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,super.dispose()}});const aY={trackingThreshold:20,liveTolerance:15};s$.registerComponent("LiveTracker",class extends s${constructor(e,t){super(e,ra(aY,t,{createEl:!1})),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=e=>this.handlePlay(e),this.handleFirstTimeupdate_=e=>this.handleFirstTimeupdate(e),this.handleSeeked_=e=>this.handleSeeked(e),this.seekToLiveEdge_=e=>this.seekToLiveEdge(e),this.reset_(),this.on(this.player_,"durationchange",e=>this.handleDurationchange(e)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){let e=this.player_.seekable();if(!e||!e.length)return;let t=Number(I(R).performance.now().toFixed(4)),i=-1===this.lastTime_?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i;let r=this.liveCurrentTime(),s=this.player_.currentTime(),n=this.player_.paused()||this.seekedBehindLive_||Math.abs(r-s)>this.options_.liveTolerance;this.timeupdateSeen_&&r!==1/0||(n=!1),n!==this.behindLiveEdge_&&(this.behindLiveEdge_=n,this.trigger("liveedgechange"))}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,30),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){let e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()}handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}reset_(){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_)}nextSeekedFromUser(){this.nextSeekedFromUser_=!0}stopTracking(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))}seekableEnd(){let e=this.player_.seekable(),t=[],i=e?e.length:0;for(;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){let e=this.player_.seekable(),t=[],i=e?e.length:0;for(;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0}liveWindow(){let e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){let e=this.seekableEnd();return -1!==this.lastSeekEnd_&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return"number"==typeof this.trackingInterval_}seekToLiveEdge(){this.seekedBehindLive_=!1,this.atLiveEdge()||(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}dispose(){this.stopTracking(),super.dispose()}}),s$.registerComponent("TitleBar",class extends s${constructor(e,t){super(e,t),this.on("statechanged",e=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:rU("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${sl++}`}),description:rU("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${sl++}`})},rU("div",{className:"vjs-title-bar"},{},ro(this.els))}updateDom_(){let e=this.player_.tech_,t=e&&e.el_,i={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(e=>{let r=this.state[e],s=this.els[e],n=i[e];r1(s),r&&rB(s,r),t&&(t.removeAttribute(n),r&&t.setAttribute(n,s.id))}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){let e=this.player_.tech_,t=e&&e.el_;t&&(t.removeAttribute("aria-labelledby"),t.removeAttribute("aria-describedby")),super.dispose(),this.els=null}});const aQ=e=>{let t=e.el();if(t.hasAttribute("src"))return e.triggerSourceset(t.src),!0;let i=e.$$("source"),r=[],s="";if(!i.length)return!1;for(let e=0;e{let i={};for(let r=0;raZ([e.el(),I(R).HTMLMediaElement.prototype,I(R).Element.prototype,aJ],"innerHTML"),a1=function(e){let t=e.el();if(t.resetSourceWatch_)return;let i={},r=a0(e),s=i=>(...r)=>{let s=i.apply(t,r);return aQ(e),s};["append","appendChild","insertAdjacentHTML"].forEach(e=>{t[e]&&(i[e]=t[e],t[e]=s(i[e]))}),Object.defineProperty(t,"innerHTML",ra(r,{set:s(r.set)})),t.resetSourceWatch_=()=>{t.resetSourceWatch_=null,Object.keys(i).forEach(e=>{t[e]=i[e]}),Object.defineProperty(t,"innerHTML",r)},e.one("sourceset",t.resetSourceWatch_)},a2=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?no(I(R).Element.prototype.getAttribute.call(this,"src")):""},set(e){return I(R).Element.prototype.setAttribute.call(this,"src",e),e}}),a4=e=>aZ([e.el(),I(R).HTMLMediaElement.prototype,a2],"src"),a8=function(e){if(!e.featuresSourceset)return;let t=e.el();if(t.resetSourceset_)return;let i=a4(e),r=t.setAttribute,s=t.load;Object.defineProperty(t,"src",ra(i,{set:r=>{let s=i.set.call(t,r);return e.triggerSourceset(t.src),s}})),t.setAttribute=(i,s)=>{let n=r.call(t,i,s);return/src/i.test(i)&&e.triggerSourceset(t.src),n},t.load=()=>{let i=s.call(t);return aQ(e)||(e.triggerSourceset(""),a1(e)),i},t.currentSrc?e.triggerSourceset(t.currentSrc):aQ(e)||a1(e),t.resetSourceset_=()=>{t.resetSourceset_=null,t.load=s,t.setAttribute=r,Object.defineProperty(t,"src",i),t.resetSourceWatch_&&t.resetSourceWatch_()}};class a5 extends nv{constructor(e,t){super(e,t);let i=e.source,r=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&"VIDEO"===this.el_.tagName,i&&(this.el_.currentSrc!==i.src||e.tag&&3===e.tag.initNetworkState_)?this.setSource(i):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){let e=this.el_.childNodes,t=e.length,i=[];for(;t--;){let s=e[t];"track"===s.nodeName.toLowerCase()&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(s),this.remoteTextTracks().addTrack(s.track),this.textTracks().addTrack(s.track),!r&&!this.el_.hasAttribute("crossorigin")&&nu(s.src)&&(r=!0)):i.push(s))}for(let e=0;e{e=[];for(let i=0;it.removeEventListener("change",i));let r=()=>{for(let t=0;t{t.removeEventListener("change",i),t.removeEventListener("change",r),t.addEventListener("change",r)}),this.on("webkitendfullscreen",()=>{t.removeEventListener("change",i),t.addEventListener("change",i),t.removeEventListener("change",r)})}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;let i=e.toLowerCase();this[`${i}TracksListeners_`]&&Object.keys(this[`${i}TracksListeners_`]).forEach(e=>{this.el()[`${i}Tracks`].removeEventListener(e,this[`${i}TracksListeners_`][e])}),this[`featuresNative${e}Tracks`]=!t,this[`${i}TracksListeners_`]=null,this.proxyNativeTracksForType_(i)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){let t=ny[e],i=this.el()[t.getterName],r=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!i||!i.addEventListener)return;let s={change:t=>{let i={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(i),"text"===e&&this[n_.remoteText.getterName]().trigger(i)},addtrack(e){r.addTrack(e.track)},removetrack(e){r.removeTrack(e.track)}},n=function(){let e=[];for(let t=0;t{let t=s[e];i.addEventListener(e,t),this.on("dispose",r=>i.removeEventListener(e,t))}),this.on("loadstart",n),this.on("dispose",e=>this.off("loadstart",n))}proxyNativeTracks_(){ny.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){let t=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(t,e),a5.disposeMediaElement(e),e=t}else{e=I(M).createElement("video");let t=ra({},this.options_.tag&&rz(this.options_.tag));rD&&!0===this.options_.nativeControlsForTouch||delete t.controls,rH(e,Object.assign(t,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}void 0!==this.options_.preload&&rG(e,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);let t=["loop","muted","playsinline","autoplay"];for(let i=0;i=2&&t.push("loadeddata"),e.readyState>=3&&t.push("canplay"),e.readyState>=4&&t.push("canplaythrough"),this.ready(function(){t.forEach(function(e){this.trigger(e)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&rA?this.el_.fastSeek(e):this.el_.currentTime=e}catch(e){i7(e,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&rc&&rf&&0===this.el_.currentTime){let e=()=>{this.el_.currentTime>0&&(this.el_.duration===1/0&&this.trigger("durationchange"),this.off("timeupdate",e))};return this.on("timeupdate",e),NaN}return this.el_.duration||NaN}width(){return this.el_.offsetWidth}height(){return this.el_.offsetHeight}proxyWebkitFullscreen_(){if(!("webkitDisplayingFullscreen"in this.el_))return;let e=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},t=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",t),this.on("dispose",()=>{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)})}supportsFullScreen(){return"function"==typeof this.el_.webkitEnterFullScreen}enterFullScreen(){let e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)s1(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}},0);else try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}}exitFullScreen(){if(!this.el_.webkitDisplayingFullscreen){this.trigger("fullscreenerror",Error("The video is not fullscreen"));return}this.el_.webkitExitFullScreen()}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(void 0===e)return this.el_.src;this.setSrc(e)}reset(){a5.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,i){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,i):super.addTextTrack(e,t,i)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);let t=I(M).createElement("track");return e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t}addRemoteTextTrack(e,t){let i=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(i),i}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){let t=this.$$("track"),i=t.length;for(;i--;)(e===t[i]||e===t[i].track)&&this.el().removeChild(t[i])}}getVideoPlaybackQuality(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();let e={};return void 0!==this.el().webkitDroppedFrameCount&&void 0!==this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),I(R).performance&&(e.creationTime=I(R).performance.now()),e}}rl(a5,"TEST_VID",function(){if(!rO())return;let e=I(M).createElement("video"),t=I(M).createElement("track");return t.kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}),a5.isSupported=function(){try{a5.TEST_VID.volume=.5}catch(e){return!1}return!!(a5.TEST_VID&&a5.TEST_VID.canPlayType)},a5.canPlayType=function(e){return a5.TEST_VID.canPlayType(e)},a5.canPlaySource=function(e,t){return a5.canPlayType(e.type)},a5.canControlVolume=function(){try{let e=a5.TEST_VID.volume;a5.TEST_VID.volume=e/2+.1;let t=e!==a5.TEST_VID.volume;if(t&&rx)return I(R).setTimeout(()=>{a5&&a5.prototype&&(a5.prototype.featuresVolumeControl=e!==a5.TEST_VID.volume)}),!1;return t}catch(e){return!1}},a5.canMuteVolume=function(){try{let e=a5.TEST_VID.muted;return a5.TEST_VID.muted=!e,a5.TEST_VID.muted?rG(a5.TEST_VID,"muted","muted"):rK(a5.TEST_VID,"muted","muted"),e!==a5.TEST_VID.muted}catch(e){return!1}},a5.canControlPlaybackRate=function(){if(rc&&rf&&r_<58)return!1;try{let e=a5.TEST_VID.playbackRate;return a5.TEST_VID.playbackRate=e/2+.1,e!==a5.TEST_VID.playbackRate}catch(e){return!1}},a5.canOverrideAttributes=function(){try{let e=()=>{};Object.defineProperty(I(M).createElement("video"),"src",{get:e,set:e}),Object.defineProperty(I(M).createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(I(M).createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(I(M).createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},a5.supportsNativeTextTracks=function(){return rA||rx&&rf},a5.supportsNativeVideoTracks=function(){return!!(a5.TEST_VID&&a5.TEST_VID.videoTracks)},a5.supportsNativeAudioTracks=function(){return!!(a5.TEST_VID&&a5.TEST_VID.audioTracks)},a5.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([e,t]){rl(a5.prototype,e,()=>a5[t](),!0)}),a5.prototype.featuresVolumeControl=a5.canControlVolume(),a5.prototype.movingMediaElementInDOM=!rx,a5.prototype.featuresFullscreenResize=!0,a5.prototype.featuresProgressEvents=!0,a5.prototype.featuresTimeupdateEvents=!0,a5.prototype.featuresVideoFrameCallback=!!(a5.TEST_VID&&a5.TEST_VID.requestVideoFrameCallback),a5.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()}},a5.resetMediaElement=function(e){if(!e)return;let t=e.querySelectorAll("source"),i=t.length;for(;i--;)e.removeChild(t[i]);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(e){a5.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}}),["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(e){a5.prototype["set"+sF(e)]=function(t){this.el_[e]=t,t?this.el_.setAttribute(e,e):this.el_.removeAttribute(e)}}),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(e){a5.prototype[e]=function(){return this.el_[e]}}),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(e){a5.prototype["set"+sF(e)]=function(t){this.el_[e]=t}}),["pause","load","play"].forEach(function(e){a5.prototype[e]=function(){return this.el_[e]()}}),nv.withSourceHandlers(a5),a5.nativeSourceHandler={},a5.nativeSourceHandler.canPlayType=function(e){try{return a5.TEST_VID.canPlayType(e)}catch(e){return""}},a5.nativeSourceHandler.canHandleSource=function(e,t){if(e.type)return a5.nativeSourceHandler.canPlayType(e.type);if(e.src){let t=nl(e.src);return a5.nativeSourceHandler.canPlayType(`video/${t}`)}return""},a5.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},a5.nativeSourceHandler.dispose=function(){},a5.registerSourceHandler(a5.nativeSourceHandler),nv.registerTech("Html5",a5);const a3=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],a6={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},a7=["tiny","xsmall","small","medium","large","xlarge","huge"],a9={};a7.forEach(e=>{let t="x"===e.charAt(0)?`x-${e.substring(1)}`:e;a9[e]=`vjs-layout-${t}`});const oe={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class ot extends s${constructor(e,t,i){if(e.id=e.id||t.id||`vjs_video_${sl++}`,(t=Object.assign(ot.getTagSettings(e),t)).initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,!t.language){let i=e.closest("[lang]");i&&(t.language=i.getAttribute("lang"))}if(super(null,t,i),this.boundDocumentFullscreenChange_=e=>this.documentFullscreenChange_(e),this.boundFullWindowOnEscKey_=e=>this.fullWindowOnEscKey(e),this.boundUpdateStyleEl_=e=>this.updateStyleEl_(e),this.boundApplyInitTime_=e=>this.applyInitTime_(e),this.boundUpdateCurrentBreakpoint_=e=>this.updateCurrentBreakpoint_(e),this.boundHandleTechClick_=e=>this.handleTechClick_(e),this.boundHandleTechDoubleClick_=e=>this.handleTechDoubleClick_(e),this.boundHandleTechTouchStart_=e=>this.handleTechTouchStart_(e),this.boundHandleTechTouchMove_=e=>this.handleTechTouchMove_(e),this.boundHandleTechTouchEnd_=e=>this.handleTechTouchEnd_(e),this.boundHandleTechTap_=e=>this.handleTechTap_(e),this.isFullscreen_=!1,this.log=i9(this.id_),this.fsApi_=i4,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&rz(e),this.language(this.options_.language),t.languages){let e={};Object.getOwnPropertyNames(t.languages).forEach(function(i){e[i.toLowerCase()]=t.languages[i]}),this.languages_=e}else this.languages_=ot.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(e=>{if("function"!=typeof this[e])throw Error(`plugin "${e}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),sM(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(sm(I(M),this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);let r=ra(this.options_);if(t.plugins&&Object.keys(t.plugins).forEach(e=>{this[e](t.plugins[e])}),t.debug&&this.debug(!0),this.options_.playerOptions=r,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons){let e=new(I(R)).DOMParser().parseFromString('',"image/svg+xml");if(e.querySelector("parsererror"))i7.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{let t=e.documentElement;t.style.display="none",this.el_.appendChild(t),this.addClass("vjs-svg-icons-enabled")}}this.initChildren(),this.isAudio("audio"===e.nodeName.toLowerCase()),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),t.spatialNavigation&&t.spatialNavigation.enabled&&(this.spatialNavigation=new nN(this),this.addClass("vjs-spatial-navigation-enabled")),rD&&this.addClass("vjs-touch-enabled"),rx||this.addClass("vjs-workinghover"),ot.players[this.id_]=this;let s=iZ.split(".")[0];this.addClass(`vjs-v${s}`),this.userActive(!0),this.reportUserActivity(),this.one("play",e=>this.listenForUserActivity_(e)),this.on("keydown",e=>this.handleKeyDown(e)),this.on("languagechange",e=>this.handleLanguagechange(e)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){this.trigger("dispose"),this.off("dispose"),sg(I(M),this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),sg(I(M),"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),ot.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),nS[this.id()]=null,nb.names.forEach(e=>{let t=this[nb[e].getterName]();t&&t.off&&t.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e,t=this.tag,i=this.playerElIngest_=t.parentNode&&t.parentNode.hasAttribute&&t.parentNode.hasAttribute("data-vjs-player"),r="video-js"===this.tag.tagName.toLowerCase();i?e=this.el_=t.parentNode:r||(e=this.el_=super.createEl("div"));let s=rz(t);if(r){for(e=this.el_=t,t=this.tag=I(M).createElement("video");e.children.length;)t.appendChild(e.firstChild);rq(e,"video-js")||rj(e,"video-js"),e.appendChild(t),i=this.playerElIngest_=e,Object.keys(e).forEach(i=>{try{t[i]=e[i]}catch(e){}})}t.setAttribute("tabindex","-1"),s.tabindex="-1",rf&&rT&&(t.setAttribute("role","application"),s.role="application"),t.removeAttribute("width"),t.removeAttribute("height"),"width"in s&&delete s.width,"height"in s&&delete s.height,Object.getOwnPropertyNames(s).forEach(function(i){r&&"class"===i||e.setAttribute(i,s[i]),r&&t.setAttribute(i,s[i])}),t.playerId=t.id,t.id+="_html5_api",t.className="vjs-tech",t.player=e.player=this,this.addClass("vjs-paused");let n=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE"].filter(e=>rP[e]).map(e=>"vjs-device-"+e.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...n),!0!==I(R).VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=sn("vjs-styles-dimensions");let e=r3(".vjs-styles-defaults"),t=r3("head");t.insertBefore(this.styleEl_,e?e.nextSibling:t.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);let a=t.getElementsByTagName("a");for(let e=0;e{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)})):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(void 0===e)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){let e,t,i;if(!0===I(R).VIDEOJS_NO_DYNAMIC_STYLE){let e="number"==typeof this.width_?this.width_:this.options_.width,t="number"==typeof this.height_?this.height_:this.options_.height,i=this.tech_&&this.tech_.el();i&&(e>=0&&(i.width=e),t>=0&&(i.height=t));return}let r=(void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:this.videoWidth()>0?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"),s=r[1]/r[0];e=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/s:this.videoWidth()||300,t=void 0!==this.height_?this.height_:e*s,i=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(i),sa(this.styleEl_,`
.${i} {
width: ${e}px;
height: ${t}px;
}
.${i}.vjs-fluid:not(.vjs-audio-only-mode) {
padding-top: ${100*s}%;
}
`)}loadTech_(e,t){var i,r;this.tech_&&this.unloadTech_();let s=sF(e),n=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==s&&this.tag&&(nv.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=s,this.isReady_=!1;let a=this.autoplay();("string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay)&&(a=!1);let o={source:t,autoplay:a,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${n}_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};nb.names.forEach(e=>{let t=nb[e];o[t.getterName]=this[t.privateName]}),Object.assign(o,this.options_[s]),Object.assign(o,this.options_[n]),Object.assign(o,this.options_[e.toLowerCase()]),this.tag&&(o.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(o.startTime=this.cache_.currentTime);let l=nv.getTech(e);if(!l)throw Error(`No Tech named '${s}' exists! '${s}' should be registered using videojs.registerTech()'`);this.tech_=new l(o),this.tech_.ready(sv(this,this.handleTechReady_),!0),i=this.textTracksJson_||[],r=this.tech_,i.forEach(function(e){let t=r.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach(e=>t.addCue(e))}),r.textTracks(),a3.forEach(e=>{this.on(this.tech_,e,t=>this[`handleTech${sF(e)}_`](t))}),Object.keys(a6).forEach(e=>{this.on(this.tech_,e,t=>{if(0===this.tech_.playbackRate()&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${a6[e]}_`].bind(this),event:t});return}this[`handleTech${a6[e]}_`](t)})}),this.on(this.tech_,"loadstart",e=>this.handleTechLoadStart_(e)),this.on(this.tech_,"sourceset",e=>this.handleTechSourceset_(e)),this.on(this.tech_,"waiting",e=>this.handleTechWaiting_(e)),this.on(this.tech_,"ended",e=>this.handleTechEnded_(e)),this.on(this.tech_,"seeking",e=>this.handleTechSeeking_(e)),this.on(this.tech_,"play",e=>this.handleTechPlay_(e)),this.on(this.tech_,"pause",e=>this.handleTechPause_(e)),this.on(this.tech_,"durationchange",e=>this.handleTechDurationChange_(e)),this.on(this.tech_,"fullscreenchange",(e,t)=>this.handleTechFullscreenChange_(e,t)),this.on(this.tech_,"fullscreenerror",(e,t)=>this.handleTechFullscreenError_(e,t)),this.on(this.tech_,"enterpictureinpicture",e=>this.handleTechEnterPictureInPicture_(e)),this.on(this.tech_,"leavepictureinpicture",e=>this.handleTechLeavePictureInPicture_(e)),this.on(this.tech_,"error",e=>this.handleTechError_(e)),this.on(this.tech_,"posterchange",e=>this.handleTechPosterChange_(e)),this.on(this.tech_,"textdata",e=>this.handleTechTextData_(e)),this.on(this.tech_,"ratechange",e=>this.handleTechRateChange_(e)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===s&&this.tag||rF(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){nb.names.forEach(e=>{let t=nb[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=s4(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return void 0===e&&i7.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_}version(){return{"video.js":iZ}}addTechControlsListeners_(){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_)}removeTechControlsListeners_(){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_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()&&this.hasStarted(!1),this.trigger("loadstart"),this.manualAutoplay_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){let t;if(!this.tech_||"string"!=typeof e)return;let i=()=>{let e=this.muted();this.muted(!0);let t=()=>{this.muted(e)};this.playTerminatedQueue_.push(t);let i=this.play();if(s0(i))return i.catch(e=>{throw t(),Error(`Rejection at manualAutoplay. Restoring muted value. ${e||""}`)})};if("any"!==e||this.muted()?t="muted"!==e||this.muted()?this.play():i():s0(t=this.play())&&(t=t.catch(i)),s0(t))return t.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let t=e,i="";"string"!=typeof t&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=nP(this,t)),this.cache_.source=ra({},e,{src:t,type:i});let r=this.cache_.sources.filter(e=>e.src&&e.src===t),s=[],n=this.$$("source"),a=[];for(let e=0;ethis.updateSourceCaches_(e),i=this.currentSource().src,r=e.src;i&&!/^blob:/.test(i)&&/^blob:/.test(r)&&(!this.lastSource_||this.lastSource_.tech!==r&&this.lastSource_.player!==i)&&(t=()=>{}),t(r),e.src||this.tech_.any(["sourceset","loadstart"],e=>{if("sourceset"===e.type)return;let t=this.techGet_("currentSrc");this.lastSource_.tech=t,this.updateSourceCaches_(t)})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(void 0===e)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){this.tech_.playbackRate()>0&&0===this.cache_.lastPlaybackRate&&(this.queuedCallbacks_.forEach(e=>e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");let e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){this.controls_&&(void 0===this.options_||void 0===this.options_.userActions||void 0===this.options_.userActions.click||!1!==this.options_.userActions.click)&&(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.click?this.options_.userActions.click.call(this,e):this.paused()?s1(this.play()):this.pause())}handleTechDoubleClick_(e){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),t=>t.contains(e.target))||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,e):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen()))}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(e){let t=e.target.player;if(t&&t!==this)return;let i=this.el(),r=I(M)[this.fsApi_.fullscreenElement]===i;!r&&i.matches&&(r=i.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(r)}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){let e=this.tech_.error();e&&this.error(e)}handleTechTextData_(){let e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)}getCache(){return this.cache_}resetCache_(){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}}techCall_(e,t){this.ready(function(){if(e in nC){var i;return i=this.middleware_,this.tech_[e](i.reduce(nI(e),t))}if(e in nD)return nw(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(e){throw i7(e),e}},!0)}techGet_(e){if(this.tech_&&this.tech_.isReady_){if(e in nk){var t,i;return t=this.middleware_,i=this.tech_,t.reduceRight(nI(e),i[e]())}if(e in nD)return nw(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){if(void 0===this.tech_[e])throw i7(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t;if("TypeError"===t.name)throw i7(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t;throw i7(t),t}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=s1){this.playCallbacks_.push(e);let t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),i=!!(rA||rx);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t){this.waitToPlay_=e=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!t&&i&&this.load();return}let r=this.techGet_("play");i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),null===r?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(r)}runPlayTerminatedQueue_(){let e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(e){e()})}runPlayCallbacks_(e){let t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach(function(t){t(e)})}pause(){this.techCall_("pause")}paused(){return!1!==this.techGet_("paused")}played(){return this.techGet_("played")||sz(0,0)}scrubbing(e){if(void 0===e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(void 0===e)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;if(e<0&&(e=0),!this.isReady_||this.changingSrc_||!this.tech_||!this.tech_.isReady_){this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_);return}this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=parseFloat(e))<0&&(e=1/0),e===this.cache_.duration||(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return e&&e.length||(e=sz(0,0)),e}seekable(){let e=this.techGet_("seekable");return e&&e.length||(e=sz(0,0)),e}seeking(){return this.techGet_("seeking")}ended(){return this.techGet_("ended")}networkState(){return this.techGet_("networkState")}readyState(){return this.techGet_("readyState")}bufferedPercent(){return sJ(this.buffered(),this.duration())}bufferedEnd(){let e=this.buffered(),t=this.duration(),i=e.end(e.length-1);return i>t&&(i=t),i}volume(e){let t;if(void 0!==e){t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),t>0&&this.lastVolume_(t);return}return isNaN(t=parseFloat(this.techGet_("volume")))?1:t}muted(e){if(void 0!==e){this.techCall_("setMuted",e);return}return this.techGet_("muted")||!1}defaultMuted(e){return void 0!==e&&this.techCall_("setDefaultMuted",e),this.techGet_("defaultMuted")||!1}lastVolume_(e){if(void 0!==e&&0!==e){this.cache_.lastVolume=e;return}return this.cache_.lastVolume}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(void 0!==e){let t=this.isFullscreen_;this.isFullscreen_=!!e,this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_();return}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();let t=this;return new Promise((i,r)=>{function s(){t.off("fullscreenerror",a),t.off("fullscreenchange",n)}function n(){s(),i()}function a(e,t){s(),r(t)}t.one("fullscreenchange",n),t.one("fullscreenerror",a);let o=t.requestFullscreenHelper_(e);o&&(o.then(s,s),o.then(i,r))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0===e||(t=e)),this.fsApi_.requestFullscreen){let e=this.el_[this.fsApi_.requestFullscreen](t);return e&&e.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),e}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){let e=this;return new Promise((t,i)=>{function r(){e.off("fullscreenerror",n),e.off("fullscreenchange",s)}function s(){r(),t()}function n(e,t){r(),i(t)}e.one("fullscreenchange",s),e.one("fullscreenerror",n);let a=e.exitFullscreenHelper_();a&&(a.then(r,r),a.then(t,i))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){let e=I(M)[this.fsApi_.exitFullscreen]();return e&&s1(e.then(()=>this.isFullscreen(!1))),e}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=I(M).documentElement.style.overflow,sm(I(M),"keydown",this.boundFullWindowOnEscKey_),I(M).documentElement.style.overflow="hidden",rj(I(M).body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){I(N).isEventKey(e,"Esc")&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,sg(I(M),"keydown",this.boundFullWindowOnEscKey_),I(M).documentElement.style.overflow=this.docOrigOverflow,r$(I(M).body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(void 0!==e){this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_();return}return!!this.isInPictureInPicture_}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&I(R).documentPictureInPicture){let e=I(M).createElement(this.el().tagName);return e.classList=this.el().classList,e.classList.add("vjs-pip-container"),this.posterImage&&e.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&e.appendChild(this.titleBar.el().cloneNode(!0)),e.appendChild(rU("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),I(R).documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(r9(t),this.el_.parentNode.insertBefore(e,this.el_),t.document.body.appendChild(this.el_),t.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger({type:"enterpictureinpicture",pipWindow:t}),t.addEventListener("pagehide",t=>{let i=t.target.querySelector(".video-js");e.parentNode.replaceChild(i,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),t))}return"pictureInPictureEnabled"in I(M)&&!1===this.disablePictureInPicture()?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){return I(R).documentPictureInPicture&&I(R).documentPictureInPicture.window?(I(R).documentPictureInPicture.window.close(),Promise.resolve()):"pictureInPictureEnabled"in I(M)?I(M).exitPictureInPicture():void 0}handleKeyDown(e){let{userActions:t}=this.options_;t&&t.hotkeys&&((e=>{let t=e.tagName.toLowerCase();return!!e.isContentEditable||("input"===t?-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(e.type):-1!==["textarea"].indexOf(t))})(this.el_.ownerDocument.activeElement)||("function"==typeof t.hotkeys?t.hotkeys.call(this,e):this.handleHotkeys(e)))}handleHotkeys(e){let{fullscreenKey:t=e=>I(N).isEventKey(e,"f"),muteKey:i=e=>I(N).isEventKey(e,"m"),playPauseKey:r=e=>I(N).isEventKey(e,"k")||I(N).isEventKey(e,"Space")}=this.options_.userActions?this.options_.userActions.hotkeys:{};if(t.call(this,e)){e.preventDefault(),e.stopPropagation();let t=s$.getComponent("FullscreenToggle");!1!==I(M)[this.fsApi_.fullscreenEnabled]&&t.prototype.handleClick.call(this,e)}else i.call(this,e)?(e.preventDefault(),e.stopPropagation(),s$.getComponent("MuteToggle").prototype.handleClick.call(this,e)):r.call(this,e)&&(e.preventDefault(),e.stopPropagation(),s$.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let i=0,r=this.options_.techOrder;i[e,nv.getTech(e)]).filter(([e,t])=>t?t.isSupported():(i7.error(`The "${e}" tech is undefined. Skipped browser support check for that tech.`),!1)),r=function(e,t,i){let r;return e.some(e=>t.some(t=>{if(r=i(e,t))return!0})),r},s=([e,t],i)=>{if(t.canPlaySource(i,this.options_[e.toLowerCase()]))return{source:i,tech:e}};return(t=this.options_.sourceOrder?r(e,i,(e,t)=>s(t,e)):r(i,e,s))||!1}handleSrc_(e,t){if(void 0===e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();let i=nL(e);if(!i.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,t||(this.cache_.sources=i),this.updateSourceCaches_(i[0]),!function(e,t,i){e.setTimeout(()=>(function e(t={},i=[],r,s,n=[],a=!1){let[o,...l]=i;if("string"==typeof o)e(t,nT[o],r,s,n,a);else if(o){let i=function(e,t){let i=nS[e.id()],r=null;if(null==i)return r=t(e),nS[e.id()]=[[t,r]],r;for(let e=0;e{if(this.middleware_=r,t||(this.cache_.sources=i),this.updateSourceCaches_(e),this.src_(e))return i.length>1?this.handleSrc_(i.slice(1)):(this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),void this.triggerReady());!function(e,t){e.forEach(e=>e.setTech&&e.setTech(t))}(r,this.tech_)}),i.length>1){let e=()=>{this.error(null),this.handleSrc_(i.slice(1),!0)},t=()=>{this.off("error",e)};this.one("error",e),this.one("playing",t),this.resetRetryOnError_=()=>{this.off("error",e),this.off("playing",t)}}}src(e){return this.handleSrc_(e,!1)}src_(e){let t=this.selectSource([e]);return!t||(sq(t.tech,this.techName_)?this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(()=>{this.changingSrc_=!1})),!1)}load(){if(this.tech_&&this.tech_.vhs){this.src(this.currentSource());return}this.techCall_("load")}reset(){this.paused()?this.doReset_():s1(this.play().then(()=>this.doReset_()))}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),this.error(null),this.titleBar&&this.titleBar.update({title:void 0,description:void 0}),sC(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);let{currentTimeDisplay:e,durationDisplay:t,progressControl:i,remainingTimeDisplay:r}=this.controlBar||{},{seekBar:s}=i||{};e&&e.updateContent(),t&&t.updateContent(),r&&r.updateContent(),s&&(s.update(),s.loadProgressBar&&s.loadProgressBar.update())}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){let e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(void 0!==e){this.techCall_("setPreload",e),this.options_.preload=e;return}return this.techGet_("preload")}autoplay(e){let t;if(void 0===e)return this.options_.autoplay||!1;"string"==typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"==typeof e?e:"play"),t=!1):e?this.options_.autoplay=!0:this.options_.autoplay=!1,t=void 0===t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return void 0!==e&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(void 0!==e){this.techCall_("setLoop",e),this.options_.loop=e;return}return this.techGet_("loop")}poster(e){if(void 0===e)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){let e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}}controls(e){if(void 0===e)return!!this.controls_;e=!!e,this.controls_===e||(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(void 0===e)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(e){if(void 0===e)return this.error_||null;if(i1("beforeerror").forEach(t=>{let i=t(this,e);if(!(rs(i)&&!Array.isArray(i)||"string"==typeof i||"number"==typeof i||null===i)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=i}),this.options_.suppressNotSupportedError&&e&&4===e.code){let t=function(){this.error(e)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],t),this.one("loadstart",function(){this.off(["click","touchstart"],t)});return}if(null===e){this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close();return}this.error_=new sZ(e),this.addClass("vjs-error"),i7.error(`(CODE:${this.error_.code} ${sZ.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),i1("error").forEach(e=>e(this,this.error_))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(void 0===e)return this.userActive_;if((e=!!e)!==this.userActive_){if(this.userActive_=e,this.userActive_){this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive");return}this.tech_&&this.tech_.one("mousemove",function(e){e.stopPropagation(),e.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,t,i,r;let s=sv(this,this.reportUserActivity),n=function(t){s(),this.clearInterval(e)};this.on("mousedown",function(){s(),this.clearInterval(e),e=this.setInterval(s,250)}),this.on("mousemove",function(e){(e.screenX!==t||e.screenY!==i)&&(t=e.screenX,i=e.screenY,s())}),this.on("mouseup",n),this.on("mouseleave",n);let a=this.getChild("controlBar");!a||rx||rc||(a.on("mouseenter",function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),a.on("mouseleave",function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",s),this.on("keyup",s),this.setInterval(function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(r);let e=this.options_.inactivityTimeout;e<=0||(r=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},e))},250)}playbackRate(e){if(void 0!==e){this.techCall_("setPlaybackRate",e);return}return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1}defaultPlaybackRate(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(void 0!==e){this.isAudio_=!!e;return}return!!this.isAudio_}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");let e=this.children(),t=this.getChild("ControlBar"),i=t&&t.currentHeight();e.forEach(e=>{e!==t&&e.el_&&!e.hasClass("vjs-hidden")&&(e.hide(),this.audioOnlyCache_.hiddenChildren.push(e))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){if("boolean"!=typeof e||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){let e=[];return this.isInPictureInPicture()&&e.push(this.exitPictureInPicture()),this.isFullscreen()&&e.push(this.exitFullscreen()),this.audioPosterMode()&&e.push(this.audioPosterMode(!1)),Promise.all(e).then(()=>this.enableAudioOnlyUI_())}return Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return"boolean"!=typeof e||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e,e)?this.audioOnlyMode()?this.audioOnlyMode(!1).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()})}addTextTrack(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let{track:t}=e;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),sC(this)&&this.trigger("languagechange"))}languages(){return ra(ot.prototype.options_.languages,this.languages_)}toJSON(){let e=ra(this.options_),t=e.tracks;e.tracks=[];for(let i=0;i{this.removeChild(i)}),i.open(),i}updateCurrentBreakpoint_(){if(!this.responsive())return;let e=this.currentBreakpoint(),t=this.currentWidth();for(let i=0;ithis.addRemoteTextTrack(e,!1)),this.titleBar&&this.titleBar.update({title:u,description:n||r||""}),this.ready(t)}getMedia(){if(!this.cache_.media){let e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),e=>({kind:e.kind,label:e.label,language:e.language,src:e.src}))};return e&&(t.poster=e,t.artwork=[{src:t.poster,type:nA(t.poster)}]),t}return ra(this.cache_.media)}static getTagSettings(e){let t={sources:[],tracks:[]},i=rz(e),r=i["data-setup"];if(rq(e,"vjs-fill")&&(i.fill=!0),rq(e,"vjs-fluid")&&(i.fluid=!0),null!==r){let[e,t]=I(U)(r||"{}");e&&i7.error(e),Object.assign(i,t)}if(Object.assign(t,i),e.hasChildNodes()){let i=e.childNodes;for(let e=0,r=i.length;e"number"==typeof e)&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}nb.names.forEach(function(e){let t=nb[e];ot.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}}),ot.prototype.crossorigin=ot.prototype.crossOrigin,ot.players={};const oi=I(R).navigator;ot.prototype.options_={techOrder:nv.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:oi&&(oi.languages&&oi.languages[0]||oi.userLanguage||oi.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1,spatialNavigation:{enabled:!1,horizontalSeek:!1},enableSmoothSeeking:!1},a3.forEach(function(e){ot.prototype[`handleTech${sF(e)}_`]=function(){return this.trigger(e)}}),s$.registerComponent("Player",ot);const or="plugin",os="activePlugins_",on={},oa=e=>on.hasOwnProperty(e),oo=e=>oa(e)?on[e]:void 0,ol=(e,t)=>{e[os]=e[os]||{},e[os][t]=!0},ou=(e,t,i)=>{let r=(i?"before":"")+"pluginsetup";e.trigger(r,t),e.trigger(r+":"+t.name,t)},od=function(e,t){let i=function(){ou(this,{name:e,plugin:t,instance:null},!0);let i=t.apply(this,arguments);return ol(this,e),ou(this,{name:e,plugin:t,instance:i}),i};return Object.keys(t).forEach(function(e){i[e]=t[e]}),i},oh=(e,t)=>(t.prototype.name=e,function(...i){ou(this,{name:e,plugin:t,instance:null},!0);let r=new t(...[this,...i]);return this[e]=()=>r,ou(this,r.getEventHash()),r});class oc{constructor(e){if(this.constructor===oc)throw Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),sM(this),delete this.trigger,sU(this,this.constructor.defaultState),ol(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return sf(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){let{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[os][e]=!1,this.player=this.state=null,t[e]=oh(e,on[e])}static isBasic(e){let t="string"==typeof e?oo(e):e;return"function"==typeof t&&!oc.prototype.isPrototypeOf(t.prototype)}static registerPlugin(e,t){if("string"!=typeof e)throw Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(oa(e))i7.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(ot.prototype.hasOwnProperty(e))throw Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if("function"!=typeof t)throw Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return on[e]=t,e!==or&&(oc.isBasic(t)?ot.prototype[e]=od(e,t):ot.prototype[e]=oh(e,t)),t}static deregisterPlugin(e){if(e===or)throw Error("Cannot de-register base plugin.");oa(e)&&(delete on[e],delete ot.prototype[e])}static getPlugins(e=Object.keys(on)){let t;return e.forEach(e=>{let i=oo(e);i&&((t=t||{})[e]=i)}),t}static getPluginVersion(e){let t=oo(e);return t&&t.VERSION||""}}function op(e,t,i,r){var s;let n;return s=`${t} is deprecated and will be removed in ${e}.0; please use ${i} instead.`,n=!1,function(...e){return n||i7.warn(s),n=!0,r.apply(this,e)}}oc.getPlugin=oo,oc.BASE_PLUGIN_NAME=or,oc.registerPlugin(or,oc),ot.prototype.usingPlugin=function(e){return!!this[os]&&!0===this[os][e]},ot.prototype.hasPlugin=function(e){return!!oa(e)};const om=e=>0===e.indexOf("#")?e.slice(1):e;function og(e,t,i){let r=og.getPlayer(e);if(r)return t&&i7.warn(`Player "${e}" is already initialised. Options will not be applied.`),i&&r.ready(i),r;let s="string"==typeof e?r3("#"+om(e)):e;if(!rR(s))throw TypeError("The element or ID supplied is not valid. (videojs)");let n="getRootNode"in s&&s.getRootNode() instanceof I(R).ShadowRoot?s.getRootNode():s.ownerDocument.body;return s.ownerDocument.defaultView&&n.contains(s)||i7.warn("The element supplied is not included in the DOM"),!0===(t=t||{}).restoreEl&&(t.restoreEl=(s.parentNode&&s.parentNode.hasAttribute("data-vjs-player")?s.parentNode:s).cloneNode(!0)),i1("beforesetup").forEach(e=>{let i=e(s,ra(t));if(!rs(i)||Array.isArray(i)){i7.error("please return an object in beforesetup hooks");return}t=ra(t,i)}),r=new(s$.getComponent("Player"))(s,t,i),i1("setup").forEach(e=>e(r)),r}if(og.hooks_=i0,og.hooks=i1,og.hook=function(e,t){i1(e,t)},og.hookOnce=function(e,t){i1(e,[].concat(t).map(t=>{let i=(...r)=>(i2(e,i),t(...r));return i}))},og.removeHook=i2,!0!==I(R).VIDEOJS_NO_DYNAMIC_STYLE&&rO()){let e=r3(".vjs-styles-defaults");if(!e){e=sn("vjs-styles-defaults");let t=r3("head");t&&t.insertBefore(e,t.firstChild),sa(e,`
.video-js {
width: 300px;
height: 150px;
}
.vjs-fluid:not(.vjs-audio-only-mode) {
padding-top: 56.25%
}
`)}}sr(1,og),og.VERSION=iZ,og.options=ot.prototype.options_,og.getPlayers=()=>ot.players,og.getPlayer=e=>{let t;let i=ot.players;if("string"==typeof e){let r=om(e),s=i[r];if(s)return s;t=r3("#"+r)}else t=e;if(rR(t)){let{player:e,playerId:r}=t;if(e||i[r])return e||i[r]}},og.getAllPlayers=()=>Object.keys(ot.players).map(e=>ot.players[e]).filter(Boolean),og.players=ot.players,og.getComponent=s$.getComponent,og.registerComponent=(e,t)=>(nv.isTech(t)&&i7.warn(`The ${e} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),s$.registerComponent.call(s$,e,t)),og.getTech=nv.getTech,og.registerTech=nv.registerTech,og.use=function(e,t){nT[e]=nT[e]||[],nT[e].push(t)},Object.defineProperty(og,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(og.middleware,"TERMINATOR",{value:nE,writeable:!1,enumerable:!0}),og.browser=rP,og.obj=ru,og.mergeOptions=op(9,"videojs.mergeOptions","videojs.obj.merge",ra),og.defineLazyProperty=op(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",rl),og.bind=op(9,"videojs.bind","native Function.prototype.bind",sv),og.registerPlugin=oc.registerPlugin,og.deregisterPlugin=oc.deregisterPlugin,og.plugin=(e,t)=>(i7.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),oc.registerPlugin(e,t)),og.getPlugins=oc.getPlugins,og.getPlugin=oc.getPlugin,og.getPluginVersion=oc.getPluginVersion,og.addLanguage=function(e,t){return e=(""+e).toLowerCase(),og.options.languages=ra(og.options.languages,{[e]:t}),og.options.languages[e]},og.log=i7,og.createLogger=i9,og.time=sQ,og.createTimeRange=op(9,"videojs.createTimeRange","videojs.time.createTimeRanges",sz),og.createTimeRanges=op(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",sz),og.formatTime=op(9,"videojs.formatTime","videojs.time.formatTime",sY),og.setFormatTime=op(9,"videojs.setFormatTime","videojs.time.setFormatTime",sK),og.resetFormatTime=op(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",sX),og.parseUrl=op(9,"videojs.parseUrl","videojs.url.parseUrl",na),og.isCrossOrigin=op(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",nu),og.EventTarget=sw,og.any=s_,og.on=sm,og.one=sy,og.off=sg,og.trigger=sf,og.xhr=I(B),og.TextTrack=np,og.AudioTrack=nm,og.VideoTrack=ng,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(e=>{og[e]=function(){return i7.warn(`videojs.${e}() is deprecated; use videojs.dom.${e}() instead`),se[e].apply(null,arguments)}}),og.computedStyle=op(9,"videojs.computedStyle","videojs.dom.computedStyle",r7),og.dom=se,og.fn=sE,og.num=n0,og.str=sj,og.url=nd,og.Error={UnsupportedSidxContainer:"unsupported-sidx-container-error",DashManifestSidxParsingError:"dash-manifest-sidx-parsing-error",HlsPlaylistRequestError:"hls-playlist-request-error",SegmentUnsupportedMediaFormat:"segment-unsupported-media-format-error",UnsupportedMediaInitialization:"unsupported-media-initialization-error",SegmentSwitchError:"segment-switch-error",SegmentExceedsSourceBufferQuota:"segment-exceeds-source-buffer-quota-error",SegmentAppendError:"segment-append-error",VttLoadError:"vtt-load-error",VttCueParsingError:"vtt-cue-parsing-error",AdsBeforePrerollError:"ads-before-preroll-error",AdsPrerollError:"ads-preroll-error",AdsMidrollError:"ads-midroll-error",AdsPostrollError:"ads-postroll-error",AdsMacroReplacementFailed:"ads-macro-replacement-failed",AdsResumeContentFailed:"ads-resume-content-failed",EMEFailedToRequestMediaKeySystemAccess:"eme-failed-request-media-key-system-access",EMEFailedToCreateMediaKeys:"eme-failed-create-media-keys",EMEFailedToAttachMediaKeysToVideoElement:"eme-failed-attach-media-keys-to-video",EMEFailedToCreateMediaKeySession:"eme-failed-create-media-key-session",EMEFailedToSetServerCertificate:"eme-failed-set-server-certificate",EMEFailedToGenerateLicenseRequest:"eme-failed-generate-license-request",EMEFailedToUpdateSessionWithReceivedLicenseKeys:"eme-failed-update-session",EMEFailedToCloseSession:"eme-failed-close-session",EMEFailedToRemoveKeysFromSession:"eme-failed-remove-keys",EMEFailedToLoadSessionBySessionId:"eme-failed-load-session"};class of{constructor(e){let t=this;return t.id=e.id,t.label=t.id,t.width=e.width,t.height=e.height,t.bitrate=e.bandwidth,t.frameRate=e.frameRate,t.enabled_=e.enabled,Object.defineProperty(t,"enabled",{get:()=>t.enabled_(),set(e){t.enabled_(e)}}),t}}class oy extends og.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get:()=>e.selectedIndex_}),Object.defineProperty(e,"length",{get:()=>e.levels_.length}),e[Symbol.iterator]=()=>e.levels_.values(),e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;let i=this.levels_.length;return t=new of(e),""+i in this||Object.defineProperty(this,i,{get(){return this.levels_[i]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t}removeQualityLevel(e){let t=null;for(let i=0,r=this.length;ii&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let t=0,i=this.length;tr,e.qualityLevels.VERSION=o_,r},ov=function(e){return ob(this,og.obj.merge({},e))};og.registerPlugin("qualityLevels",ov),ov.VERSION=o_;const oT=(e,t)=>t&&t.responseURL&&e!==t.responseURL?t.responseURL:e,oS=e=>og.log.debug?og.log.debug.bind(og,"VHS:",`${e} >`):function(){};function oE(...e){let t=og.obj||og;return(t.merge||t.mergeOptions).apply(t,e)}function ow(...e){let t=og.time||og;return(t.createTimeRanges||t.createTimeRanges).apply(t,e)}const ok=1/30,oC=1/30*3,oD=function(e,t){let i;let r=[];if(e&&e.length)for(i=0;i=t})},ox=function(e,t){return oD(e,function(e){return e-ok>=t})},oA=function(e){if(e.length<2)return ow();let t=[];for(let i=1;i{let t=[];if(!e||!e.length)return"";for(let i=0;i "+e.end(i));return t.join(", ")},oO=e=>{let t=[];for(let i=0;in)){if(t>s&&t<=n){i+=n-t;continue}i+=n-s}}return i},oU=(e,t)=>{if(!t.preload)return t.duration;let i=0;return(t.parts||[]).forEach(function(e){i+=e.duration}),(t.preloadHints||[]).forEach(function(t){"PART"===t.type&&(i+=e.partTargetDuration)}),i},oB=e=>(e.segments||[]).reduce((e,t,i)=>(t.parts?t.parts.forEach(function(r,s){e.push({duration:r.duration,segmentIndex:i,partIndex:s,part:r,segment:t})}):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e),[]),oF=e=>{let t=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return t&&t.parts||[]},oq=({preloadSegment:e})=>{if(!e)return;let{parts:t,preloadHints:i}=e;return(i||[]).reduce((e,t)=>e+("PART"===t.type?1:0),0)+(t&&t.length?t.length:0)},oj=(e,t)=>{if(t.endList)return 0;if(e&&e.suggestedPresentationDelay)return e.suggestedPresentationDelay;let i=oF(t).length>0;return i&&t.serverControl&&t.serverControl.partHoldBack?t.serverControl.partHoldBack:i&&t.partTargetDuration?3*t.partTargetDuration:t.serverControl&&t.serverControl.holdBack?t.serverControl.holdBack:t.targetDuration?3*t.targetDuration:0},o$=function(e,t){let i=0,r=t-e.mediaSequence,s=e.segments[r];if(s){if(void 0!==s.start)return{result:s.start,precise:!0};if(void 0!==s.end)return{result:s.end-s.duration,precise:!0}}for(;r--;){if(void 0!==(s=e.segments[r]).end)return{result:i+s.end,precise:!0};if(i+=oU(e,s),void 0!==s.start)return{result:i+s.start,precise:!0}}return{result:i,precise:!1}},oV=function(e,t){let i,r=0,s=t-e.mediaSequence;for(;sr&&([i,r]=[r,i]),i<0){for(let t=i;tDate.now()},oX=function(e){return e.excludeUntil&&e.excludeUntil===1/0},oY=function(e){let t=oK(e);return!e.disabled&&!t},oQ=function(e,t){return t.attributes&&t.attributes[e]},oJ=(e,t)=>{if(1===e.playlists.length)return!0;let i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter(e=>!!oY(e)&&(e.attributes.BANDWIDTH||0)(!!e||!!t)&&(!!e||!t)&&(!e||!!t)&&(e===t||!!e.id&&!!t.id&&e.id===t.id||!!e.resolvedUri&&!!t.resolvedUri&&e.resolvedUri===t.resolvedUri||!!e.uri&&!!t.uri&&e.uri===t.uri),o0=function(e,t){let i=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{},r=!1;for(let e in i){for(let s in i[e])if(r=t(i[e][s]))break;if(r)break}return!!r},o1=e=>{if(!e||!e.playlists||!e.playlists.length)return o0(e,e=>e.playlists&&e.playlists.length||e.uri);for(let t=0;te5(e)))&&!o0(e,e=>oZ(i,e)))return!1}return!0};var o2={liveEdgeDelay:oj,duration:oz,seekable:function(e,t,i){let r=t||0,s=oG(e,t,!0,i);return null===s?ow():(s0)for(let t=l-1;t>=0;t--){let i=o[t];if(a+=i.duration,n){if(a<0)continue}else if(a+ok<=0)continue;return{partIndex:i.partIndex,segmentIndex:i.segmentIndex,startTime:s-oW({defaultDuration:e.targetDuration,durationList:o,startIndex:l,endIndex:t})}}return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:t}}if(l<0){for(let i=l;i<0;i++)if((a-=e.targetDuration)<0)return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:t};l=0}for(let t=l;tok,u=0===a,d=r&&a+ok>=0;if(!u&&!d||t===o.length-1){if(n){if(a>0)continue}else if(a-ok>=0)continue;return{partIndex:i.partIndex,segmentIndex:i.segmentIndex,startTime:s+oW({defaultDuration:e.targetDuration,durationList:o,startIndex:l,endIndex:t})}}}return{segmentIndex:o[o.length-1].segmentIndex,partIndex:o[o.length-1].partIndex,startTime:t}},isEnabled:oY,isDisabled:function(e){return e.disabled},isExcluded:oK,isIncompatible:oX,playlistEnd:oG,isAes:function(e){for(let t=0;t`${e}-${t}`,o5=(e,t,i)=>`placeholder-uri-${e}-${t}-${i}`,o3=({onwarn:e,oninfo:t,manifestString:i,customTagParsers:r=[],customTagMappers:s=[],llhls:n})=>{let a=new eJ;e&&a.on("warn",e),t&&a.on("info",t),r.forEach(e=>a.addParser(e)),s.forEach(e=>a.addTagMapper(e)),a.push(i),a.end();let o=a.manifest;if(!n&&(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(e){o.hasOwnProperty(e)&&delete o[e]}),o.segments&&o.segments.forEach(function(e){["parts","preloadHints"].forEach(function(t){e.hasOwnProperty(t)&&delete e[t]})})),!o.targetDuration){let t=10;o.segments&&o.segments.length&&(t=o.segments.reduce((e,t)=>Math.max(e,t.duration),0)),e&&e({message:`manifest has no targetDuration defaulting to ${t}`}),o.targetDuration=t}let l=oF(o);if(l.length&&!o.partTargetDuration){let t=l.reduce((e,t)=>Math.max(e,t.duration),0);e&&(e({message:`manifest has no partTargetDuration defaulting to ${t}`}),o4.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.")),o.partTargetDuration=t}return o},o6=(e,t)=>{e.mediaGroups&&["AUDIO","SUBTITLES"].forEach(i=>{if(e.mediaGroups[i])for(let r in e.mediaGroups[i])for(let s in e.mediaGroups[i][r])t(e.mediaGroups[i][r][s],i,r,s)})},o7=({playlist:e,uri:t,id:i})=>{e.id=i,e.playlistErrors_=0,t&&(e.uri=t),e.attributes=e.attributes||{}},o9=e=>{let t=e.playlists.length;for(;t--;){let i=e.playlists[t];o7({playlist:i,id:o8(t,i.uri)}),i.resolvedUri=et(e.uri,i.uri),e.playlists[i.id]=i,e.playlists[i.uri]=i,i.attributes.BANDWIDTH||o4.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},le=e=>{o6(e,t=>{t.uri&&(t.resolvedUri=et(e.uri,t.uri))})},lt=(e,t)=>{let i=o8(0,t),r={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:I(R).location.href,resolvedUri:I(R).location.href,playlists:[{uri:t,id:i,resolvedUri:t,attributes:{}}]};return r.playlists[i]=r.playlists[0],r.playlists[t]=r.playlists[0],r},li=(e,t,i=o5)=>{e.uri=t;for(let t=0;t{if(!t.playlists||!t.playlists.length){if(r&&"AUDIO"===s&&!t.uri)for(let t=0;t(e.set(t.id,t),e),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(null===this.offset_)return[];let e={},t=[];for(let i of(this.pendingDateRanges_.forEach((i,r)=>{if(!this.processedDateRanges_.has(r)&&(i.startTime=i.startDate.getTime()/1e3-this.offset_,i.processDateRange=()=>this.processDateRange(i),t.push(i),i.class)){if(e[i.class]){let t=e[i.class].push(i);i.classListIndex=t-1}else e[i.class]=[i],i.classListIndex=0}}),t)){let t=e[i.class]||[];i.endDate?i.endTime=i.endDate.getTime()/1e3-this.offset_:i.endOnNext&&t[i.classListIndex+1]?i.endTime=t[i.classListIndex+1].startTime:i.duration?i.endTime=i.startTime+i.duration:i.plannedDuration?i.endTime=i.startTime+i.plannedDuration:i.endTime=i.startTime}return t}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((t,i)=>{t.startDate.getTime(){if(t.endList||!t.serverControl)return e;let i={};if(t.serverControl.canBlockReload){let{preloadSegment:e}=t,r=t.mediaSequence+t.segments.length;if(e){let s=e.parts||[],n=oq(t)-1;n>-1&&n!==s.length-1&&(i._HLS_part=n),(n>-1||s.length)&&r--}i._HLS_msn=r}if(t.serverControl&&t.serverControl.canSkipUntil&&(i._HLS_skip=t.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(i).length){let t=new(I(R)).URL(e);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(e){i.hasOwnProperty(e)&&t.searchParams.set(e,i[e])}),e=t.toString()}return e},la=(e,t)=>{if(!e)return t;let i=oE(e,t);if(e.preloadHints&&!t.preloadHints&&delete i.preloadHints,e.parts&&!t.parts)delete i.parts;else if(e.parts&&t.parts)for(let r=0;r{let r;let s=e.slice(),n=t.slice();i=i||0;let a=[];for(let e=0;e{!e.resolvedUri&&e.uri&&(e.resolvedUri=et(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=et(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=et(t,e.map.uri)),e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=et(t,e.map.key.uri)),e.parts&&e.parts.length&&e.parts.forEach(e=>{e.resolvedUri||(e.resolvedUri=et(t,e.uri))}),e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach(e=>{e.resolvedUri||(e.resolvedUri=et(t,e.uri))})},lu=function(e){let t=e.segments||[],i=e.preloadSegment;if(i&&i.parts&&i.parts.length){if(i.preloadHints){for(let e=0;ee===t||e.segments&&t.segments&&e.segments.length===t.segments.length&&e.endList===t.endList&&e.mediaSequence===t.mediaSequence&&e.preloadSegment===t.preloadSegment,lh=(e,t,i=ld)=>{let r=oE(e,{}),s=r.playlists[t.id];if(!s||i(s,t))return null;t.segments=lu(t);let n=oE(s,t);if(n.preloadSegment&&!t.preloadSegment&&delete n.preloadSegment,s.segments){if(t.skip){t.segments=t.segments||[];for(let e=0;e{ll(e,n.resolvedUri)});for(let e=0;e{if(e.playlists)for(let i=0;i{let i=e.segments||[],r=i[i.length-1],s=r&&r.parts&&r.parts[r.parts.length-1],n=s&&s.duration||r&&r.duration;return t&&n?1e3*n:500*(e.partTargetDuration||e.targetDuration||10)};class lp extends ls{constructor(e,t,i={}){if(super(),!e)throw Error("A non-empty playlist URL or object is required");this.logger_=oS("PlaylistLoader");let{withCredentials:r=!1}=i;this.src=e,this.vhs_=t,this.withCredentials=r,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack;let s=t.options_;this.customTagParsers=s&&s.customTagParsers||[],this.customTagMappers=s&&s.customTagMappers||[],this.llhls=s&&s.llhls,this.dateRangesStorage_=new lr,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){let e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);let t=this.dateRangesStorage_.getDateRangesToProcess();t.length&&this.addDateRangesToTextTrack_&&this.addDateRangesToTextTrack_(t)}handleMediaupdatetimeout_(){if("HAVE_METADATA"!==this.state)return;let e=this.media(),t=et(this.main.uri,e.uri);this.llhls&&(t=ln(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials,requestType:"hls-playlist"},(e,t)=>{if(this.request){if(e)return this.playlistRequestError(this.request,this.media(),"HAVE_METADATA");this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}})}playlistRequestError(e,t,i){let{uri:r,id:s}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[s],status:e.status,message:`HLS playlist request error at URL: ${r}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:{errorType:og.Error.HlsPlaylistRequestError}},this.trigger("error")}parseManifest_({url:e,manifestString:t}){return o3({onwarn:({message:t})=>this.logger_(`m3u8-parser warn for ${e}: ${t}`),oninfo:({message:t})=>this.logger_(`m3u8-parser info for ${e}: ${t}`),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls})}haveMetadata({playlistString:e,playlistObject:t,url:i,id:r}){this.request=null,this.state="HAVE_METADATA";let s=t||this.parseManifest_({url:i,manifestString:e});s.lastRequest=Date.now(),o7({playlist:s,uri:i,id:r});let n=lh(this.main,s);this.targetDuration=s.partTargetDuration||s.targetDuration,this.pendingMedia_=null,n?(this.main=n,this.media_=this.main.playlists[r]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(lc(this.media(),!!n)),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),I(R).clearTimeout(this.mediaUpdateTimeout),I(R).clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new lr,this.off()}stopRequest(){if(this.request){let e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,t){if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw Error("Cannot switch media playlist from "+this.state);if("string"==typeof e){if(!this.main.playlists[e])throw Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(I(R).clearTimeout(this.finalRenditionTimeout),t){let t=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=I(R).setTimeout(this.media.bind(this,e,!1),t);return}let i=this.state,r=!this.media_||e.id!==this.media_.id,s=this.main.playlists[e.id];if(s&&s.endList||e.endList&&e.segments.length){this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,r&&(this.trigger("mediachanging"),"HAVE_MAIN_MANIFEST"===i?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(lc(e,!0)),r){if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e,this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(t,r)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=oT(e.resolvedUri,r),t)return this.playlistRequestError(this.request,e,i);this.haveMetadata({playlistString:r.responseText,url:e.uri,id:e.id}),"HAVE_MAIN_MANIFEST"===i?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}}pause(){this.mediaUpdateTimeout&&(I(R).clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(I(R).clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);let t=this.media();if(e){let e=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=I(R).setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},e);return}if(!this.started){this.start();return}t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(I(R).clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=I(R).setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e))}start(){if(this.started=!0,"object"==typeof this.src){this.src.uri||(this.src.uri=I(R).location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},(e,t)=>{if(!this.request)return;if(this.request=null,e)return this.error={status:t.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:t.responseText,code:2,metadata:{errorType:og.Error.HlsPlaylistRequestError}},"HAVE_NOTHING"===this.state&&(this.started=!1),this.trigger("error");this.src=oT(this.src,t);let i=this.parseManifest_({manifestString:t.responseText,url:this.src});this.setupInitialPlaylist(i)})}srcUri(){return"string"==typeof this.src?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){this.main=e,li(this.main,this.srcUri()),e.playlists.forEach(e=>{e.segments=lu(e),e.segments.forEach(t=>{ll(t,e.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}let t=this.srcUri()||I(R).location.href;this.main=lt(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,t){let i=this.main,r=e.ID,s=i.playlists.length;for(;s--;){let n=i.playlists[s];if(n.attributes["PATHWAY-ID"]===r){let a=n.resolvedUri,o=n.id;if(t){let t=this.createCloneURI_(n.resolvedUri,e),a=o8(r,t),o=this.createCloneAttributes_(r,n.attributes),l=this.createClonePlaylist_(n,a,e,o);i.playlists[s]=l,i.playlists[a]=l,i.playlists[t]=l}else i.playlists.splice(s,1);delete i.playlists[o],delete i.playlists[a]}}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){let i=this.main,r=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{if(i.mediaGroups[e]&&i.mediaGroups[e][r]){for(let t in i.mediaGroups[e])if(t===r){for(let r in i.mediaGroups[e][t])i.mediaGroups[e][t][r].playlists.forEach((e,t)=>{let r=i.playlists[e.id],s=r.id,n=r.resolvedUri;delete i.playlists[s],delete i.playlists[n]});delete i.mediaGroups[e][t]}}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){let i=this.main,r=i.playlists.length,s=this.createCloneURI_(t.resolvedUri,e),n=o8(e.ID,s),a=this.createCloneAttributes_(e.ID,t.attributes),o=this.createClonePlaylist_(t,n,e,a);i.playlists[r]=o,i.playlists[n]=o,i.playlists[s]=o,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){let t=e.ID,i=e["BASE-ID"],r=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(s=>{if(r.mediaGroups[s]&&!r.mediaGroups[s][t]){for(let n in r.mediaGroups[s])if(n===i)for(let i in r.mediaGroups[s][t]={},r.mediaGroups[s][n]){let a=r.mediaGroups[s][n][i];r.mediaGroups[s][t][i]=I(F)({},a);let o=r.mediaGroups[s][t][i],l=this.createCloneURI_(a.resolvedUri,e);o.resolvedUri=l,o.uri=l,o.playlists=[],a.playlists.forEach((n,a)=>{let l=r.playlists[n.id],u=o5(s,t,i),d=o8(t,u);if(l&&!r.playlists[d]){let t=this.createClonePlaylist_(l,d,e),i=t.resolvedUri;r.playlists[d]=t,r.playlists[i]=t}o.playlists[a]=this.createClonePlaylist_(n,d,e)})}}})}createClonePlaylist_(e,t,i,r){let s=this.createCloneURI_(e.resolvedUri,i),n={resolvedUri:s,uri:s,id:t};return e.segments&&(n.segments=[]),r&&(n.attributes=r),oE(e,n)}createCloneURI_(e,t){let i=new URL(e);i.hostname=t["URI-REPLACEMENT"].HOST;let r=t["URI-REPLACEMENT"].PARAMS;for(let e of Object.keys(r))i.searchParams.set(e,r[e]);return i.href}createCloneAttributes_(e,t){let i={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(r=>{t[r]&&(i[r]=e)}),i}getKeyIdSet(e){if(e.contentProtection){let t=new Set;for(let i in e.contentProtection){let r=e.contentProtection[i].attributes.keyId;r&&t.add(r.toLowerCase())}return t}}}const lm=function(e,t,i,r){let s="arraybuffer"===e.responseType?e.response:e.responseText;t||!s||(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=s.byteLength||s.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8e3))),i.headers&&(e.responseHeaders=i.headers),t&&"ETIMEDOUT"===t.code&&(e.timedout=!0),t||e.aborted||200===i.statusCode||206===i.statusCode||0===i.statusCode||(t=Error("XHR Failed with a response of: "+(e&&(s||e.responseText)))),r(t,e)},lg=(e,t)=>{if(!e||!e.size)return;let i=t;return e.forEach(e=>{i=e(i)}),i},lf=(e,t,i,r)=>{e&&e.size&&e.forEach(e=>{e(t,i,r)})},ly=function(){let e=function e(t,i){t=oE({timeout:45e3},t);let r=e.beforeRequest||og.Vhs.xhr.beforeRequest,s=e._requestCallbackSet||og.Vhs.xhr._requestCallbackSet||new Set,n=e._responseCallbackSet||og.Vhs.xhr._responseCallbackSet;r&&"function"==typeof r&&(og.log.warn("beforeRequest is deprecated, use onRequest instead."),s.add(r));let a=!0===og.Vhs.xhr.original?og.xhr:og.Vhs.xhr,o=lg(s,t);s.delete(r);let l=a(o||t,function(e,t){return lf(n,l,e,t),lm(l,e,t,i)}),u=l.abort;return l.abort=function(){return l.aborted=!0,u.apply(l,arguments)},l.uri=t.uri,l.requestTime=Date.now(),l};return e.original=!0,e},l_=function(e){var t;let i={};return e.byterange&&(i.Range="bytes="+(t=e.byterange).offset+"-"+("bigint"==typeof t.offset||"bigint"==typeof t.length?I(R).BigInt(t.offset)+I(R).BigInt(t.length)-I(R).BigInt(1):t.offset+t.length-1)),i},lb=function(e,t){let i=e.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")},lv=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},lT=function(e){let t={};return Object.keys(e).forEach(i=>{let r=e[i];tr(r)?t[i]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:t[i]=r}),t},lS=function(e){let t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},lE=function(e){return e.resolvedUri},lw=e=>{let t=Array.prototype.slice.call(e),i="";for(let e=0;elw(e),textRanges:e=>{let t,i="";for(t=0;t{if(!t.dateTimeObject)return null;let i=t.videoTimingInfo.transmuxerPrependedSeconds,r=t.videoTimingInfo.transmuxedPresentationStart;return new Date(t.dateTimeObject.getTime()+1e3*(e-(r+i)))},lD=e=>e.transmuxedPresentationEnd-e.transmuxedPresentationStart-e.transmuxerPrependedSeconds,lI=(e,t)=>{let i;try{i=new Date(e)}catch(e){return null}if(!t||!t.segments||0===t.segments.length)return null;let r=t.segments[0];if(inew Date(n.getTime()+1e3*a)?null:(i>new Date(n)&&(r=s),{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:o2.duration(t,t.mediaSequence+t.segments.indexOf(r)),type:r.videoTimingInfo?"accurate":"estimate"})},lx=(e,t)=>{let i;if(!t||!t.segments||0===t.segments.length)return null;let r=0;for(let s=0;sr){if(e>r+.25*s.duration)return null;i=s}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:r-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}},lA=(e,t)=>{let i,r;try{i=new Date(e),r=new Date(t)}catch(e){}let s=i.getTime();return(r.getTime()-s)/1e3},lP=e=>{if(!e.segments||0===e.segments.length)return!1;for(let t=0;t{if(!i)throw Error("getProgramTime: callback must be provided");if(!e||void 0===t)return i({message:"getProgramTime: playlist and time must be provided"});let r=lx(t,e);if(!r)return i({message:"valid programTime was not found"});if("estimate"===r.type)return i({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:r.estimatedStart});let s={mediaSeconds:t},n=lC(t,r.segment);return n&&(s.programDateTime=n.toISOString()),i(null,s)},lO=({programTime:e,playlist:t,retryCount:i=2,seekTo:r,pauseAfterSeek:s=!0,tech:n,callback:a})=>{if(!a)throw Error("seekToProgramTime: callback must be provided");if(void 0===e||!t||!r)return a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!t.endList&&!n.hasStarted_)return a({message:"player must be playing a live stream to start buffering"});if(!lP(t))return a({message:"programDateTime tags must be provided in the manifest "+t.resolvedUri});let o=lI(e,t);if(!o)return a({message:`${e} was not found in the stream`});let l=o.segment,u=lA(l.dateTimeObject,e);if("estimate"===o.type)return 0===i?a({message:`${e} is not buffered yet. Try again`}):(r(o.estimatedStart+u),void n.one("seeked",()=>{lO({programTime:e,playlist:t,retryCount:i-1,seekTo:r,pauseAfterSeek:s,tech:n,callback:a})}));let d=l.start+u;n.one("seeked",()=>a(null,n.currentTime())),s&&n.pause(),r(d)},lR=(e,t)=>{if(4===e.readyState)return t()},lM=(e,t,i)=>{let r,s=[],n=!1,a=function(e,t,r,s){return t.abort(),n=!0,i(e,t,r,s)},o=function(e,t){if(n)return;if(e)return a(e,t,"",s);let i=t.responseText.substring(s&&s.byteLength||0,t.responseText.length);if(s=th(s,td(i,!0)),r=r||iL(s),s.length<10||r&&s.lengtha(e,t,"",s));let o=iQ(s);return"ts"===o&&s.length<188||!o&&s.length<376?lR(t,()=>a(e,t,"",s)):a(null,t,o,s)},l=t({uri:e,beforeSend(e){e.overrideMimeType("text/plain; charset=x-user-defined"),e.addEventListener("progress",function({total:t,loaded:i}){return lm(e,null,{statusCode:e.status},o)})}},function(e,t){return lm(l,e,t,o)});return l},{EventTarget:lN}=og,lU=function(e,t){if(!ld(e,t)||e.sidx&&t.sidx&&(e.sidx.offset!==t.sidx.offset||e.sidx.length!==t.sidx.length)||!e.sidx&&t.sidx||e.sidx&&!t.sidx||e.segments&&!t.segments||!e.segments&&t.segments)return!1;if(!e.segments&&!t.segments)return!0;for(let i=0;i{let s=r.attributes.NAME||i;return`placeholder-uri-${e}-${t}-${s}`},lF=({mainXml:e,srcUrl:t,clientOffset:i,sidxMapping:r,previousManifest:s})=>{let n=iC(e,{manifestUri:t,clientOffset:i,sidxMapping:r,previousManifest:s});return li(n,t,lB),n},lq=(e,t)=>{o6(e,(i,r,s,n)=>{n in t.mediaGroups[r][s]||delete e.mediaGroups[r][s][n]})},lj=(e,t,i)=>{let r=!0,s=oE(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts});for(let e=0;e{if(e.playlists&&e.playlists.length){let a=e.playlists[0].id,o=lh(s,e.playlists[0],lU);o&&(n in(s=o).mediaGroups[t][i]||(s.mediaGroups[t][i][n]=e),s.mediaGroups[t][i][n].playlists[0]=s.playlists[a],r=!1)}}),lq(s,t),t.minimumUpdatePeriod!==e.minimumUpdatePeriod&&(r=!1),r)?null:s},l$=(e,t)=>(!!(!e.map&&!t.map)||!!(e.map&&t.map&&e.map.byterange.offset===t.map.byterange.offset&&e.map.byterange.length===t.map.byterange.length))&&e.uri===t.uri&&e.byterange.offset===t.byterange.offset&&e.byterange.length===t.byterange.length,lV=(e,t)=>{let i={};for(let r in e){let s=e[r].sidx;if(s){let e=tq(s);if(!t[e])break;l$(t[e].sidxInfo,s)&&(i[e]=t[e])}}return i},lH=(e,t)=>{let i=lV(e.playlists,t);return o6(e,(e,r,s,n)=>{if(e.playlists&&e.playlists.length){let r=e.playlists;i=oE(i,lV(r,t))}}),i};class lz extends lN{constructor(e,t,i={},r){super(),this.mainPlaylistLoader_=r||this,r||(this.isMain_=!0);let{withCredentials:s=!1}=i;if(this.vhs_=t,this.withCredentials=s,this.addMetadataToTextTrack=i.addMetadataToTextTrack,!e)throw Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=oS("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}requestErrored_(e,t,i){return!this.request||((this.request=null,e)?(this.error="object"!=typeof e||e instanceof Error?{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2,metadata:e.metadata}:e,i&&(this.state=i),this.trigger("error"),!0):void 0)}addSidxSegments_(e,t,i){let r=e.sidx&&tq(e.sidx);if(!e.sidx||!r||this.mainPlaylistLoader_.sidxMapping_[r]){this.mediaRequest_=I(R).setTimeout(()=>i(!1),0);return}let s=oT(e.sidx.resolvedUri),n=(s,n)=>{let a;if(this.requestErrored_(s,n,t))return;let o=this.mainPlaylistLoader_.sidxMapping_;try{a=I(iI)(ts(n.response).subarray(8))}catch(e){e.metadata={errorType:og.Error.DashManifestSidxParsingError},this.requestErrored_(e,n,t);return}return o[r]={sidxInfo:e.sidx,sidx:a},tP(e,a,e.sidx.resolvedUri),i(!0)};this.request=lM(s,this.vhs_.xhr,(t,i,r,a)=>{if(t)return n(t,i);if(!r||"mp4"!==r){let t=r||"unknown";return n({status:i.status,message:`Unsupported ${t} container type for sidx segment at URL: ${s}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2,metadata:{errorType:og.Error.UnsupportedSidxContainer,sidxContainer:t}},i)}let{offset:o,length:l}=e.sidx.byterange;if(a.length>=l+o)return n(t,{response:a.subarray(o,o+l),status:i.status,uri:i.uri});this.request=this.vhs_.xhr({uri:s,responseType:"arraybuffer",headers:l_({byterange:e.sidx.byterange})},n)})}dispose(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},I(R).clearTimeout(this.minimumUpdatePeriodTimeout_),I(R).clearTimeout(this.mediaRequest_),I(R).clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){if(this.request){let e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw Error("Cannot switch media playlist from "+this.state);let t=this.state;if("string"==typeof e){if(!this.mainPlaylistLoader_.main.playlists[e])throw Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}let i=!this.media_||e.id!==this.media_.id;if(i&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,i&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}i&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,t,i=>{this.haveMetadata({startingState:t,playlist:e})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,this.mediaRequest_=null,this.refreshMedia_(t.id),"HAVE_MAIN_MANIFEST"===e?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),I(R).clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(I(R).clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)}load(e){I(R).clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;let t=this.media();if(e){let e=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=I(R).setTimeout(()=>this.load(),e);return}if(!this.started){this.start();return}t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist")}start(){if(this.started=!0,!this.isMain_){this.mediaRequest_=I(R).setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,t)=>{this.haveMain_(),this.hasPendingRequest()||this.media_||this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(t,i)=>{if(this.requestErrored_(t,i)){"HAVE_NOTHING"===this.state&&(this.started=!1);return}let r=i.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=i.responseText,i.responseHeaders&&i.responseHeaders.date?this.mainLoaded_=Date.parse(i.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=oT(this.mainPlaylistLoader_.srcUrl,i),r){this.handleMain_(),this.syncClientServerClock_(()=>e(i,r));return}return e(i,r)})}syncClientServerClock_(e){let t=iD(this.mainPlaylistLoader_.mainXml_);return null===t?(this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()):"DIRECT"===t.method?(this.mainPlaylistLoader_.clientOffset_=t.value-Date.now(),e()):void(this.request=this.vhs_.xhr({uri:et(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(i,r)=>{let s;if(this.request){if(i)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();s="HEAD"===t.method?r.responseHeaders&&r.responseHeaders.date?Date.parse(r.responseHeaders.date):this.mainLoaded_:Date.parse(r.responseText),this.mainPlaylistLoader_.clientOffset_=s-Date.now(),e()}}))}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){this.mediaRequest_=null;let e=this.mainPlaylistLoader_.main,t=lF({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e});e&&(t=lj(e,t,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=t||e;let i=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];return i&&i!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=i),(!e||t&&t.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(t),!!t}updateMinimumUpdatePeriodTimeout_(){let e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(I(R).clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;if(0===t&&(e.media()?t=1e3*e.media().targetDuration:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),"number"!=typeof t||t<=0){t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`);return}this.createMUPTimeout_(t)}createMUPTimeout_(e){let t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=I(R).setTimeout(()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,t)=>{t&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=lH(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,e=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();let t=this.mainPlaylistLoader_.main.playlists,i=!this.media_||this.media_!==t[e];if(i?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){let e=()=>{this.media().endList||(this.mediaUpdateTimeout=I(R).setTimeout(()=>{this.trigger("mediaupdatetimeout"),e()},lc(this.media(),!!i)))};e()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){let e=this.mainPlaylistLoader_.main.eventStream.map(e=>({cueTime:e.start,frames:[{data:e.messageData}]}));this.addMetadataToTextTrack("EventStream",e,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){let t=new Set;for(let i in e.contentProtection){let r=e.contentProtection[i].attributes["cenc:default_KID"];r&&t.add(r.replace(/-/g,"").toLowerCase())}return t}}}var lW={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};const lG=e=>{let t=new Uint8Array(new ArrayBuffer(e.length));for(let i=0;i-1)},this.trigger=function(t){var i,r,s,n;if(i=e[t]){if(2==arguments.length)for(r=0,s=i.length;r>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},l=function(){return n(I.ftyp,x,A,x,P)},v=function(e){return n(I.hdlr,L[e])},u=function(e){return n(I.mdat,e)},b=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(t[12]=e.samplerate>>>24&255,t[13]=e.samplerate>>>16&255,t[14]=e.samplerate>>>8&255,t[15]=255&e.samplerate),n(I.mdhd,t)},_=function(e){return n(I.mdia,b(e),v(e.type),h(e))},d=function(e){return n(I.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},h=function(e){return n(I.minf,"video"===e.type?n(I.vmhd,O):n(I.smhd,R),a(),S(e))},c=function(e,t){for(var i=[],r=t.length;r--;)i[r]=w(t[r]);return n.apply(null,[I.moof,d(e)].concat(i))},p=function(e){for(var t=e.length,i=[];t--;)i[t]=f(e[t]);return n.apply(null,[I.moov,g(4294967295)].concat(i).concat(m(e)))},m=function(e){for(var t=e.length,i=[];t--;)i[t]=k(e[t]);return n.apply(null,[I.mvex].concat(i))},g=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return n(I.mvhd,t)},T=function(e){var t,i,r=e.samples||[],s=new Uint8Array(4+r.length);for(i=0;i>>8),a.push(255&r[t].byteLength),a=a.concat(Array.prototype.slice.call(r[t]));for(t=0;t>>8),o.push(255&s[t].byteLength),o=o.concat(Array.prototype.slice.call(s[t]));if(i=[I.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),n(I.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([r.length],a,[s.length],o))),n(I.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio){var l=e.sarRatio[0],u=e.sarRatio[1];i.push(n(I.pasp,new Uint8Array([(4278190080&l)>>24,(16711680&l)>>16,(65280&l)>>8,255&l,(4278190080&u)>>24,(16711680&u)>>16,(65280&u)>>8,255&u])))}return n.apply(null,i)},t=function(e){return n(I.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),o(e))},y=function(e){var t=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return n(I.tkhd,t)},w=function(e){var t,i,r,s,a,o;return(t=n(I.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),a=Math.floor(e.baseMediaDecodeTime/4294967296),o=Math.floor(e.baseMediaDecodeTime%4294967296),i=n(I.tfdt,new Uint8Array([1,0,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a,o>>>24&255,o>>>16&255,o>>>8&255,255&o])),"audio"===e.type)?(r=D(e,92),n(I.traf,t,i,r)):(s=T(e),r=D(e,s.length+92),n(I.traf,t,i,r,s))},f=function(e){return e.duration=e.duration||4294967295,n(I.trak,y(e),_(e))},k=function(e){var t=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(t[t.length-1]=0),n(I.trex,t)},s=function(e,t){var i=0,r=0,s=0,n=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(r=2),void 0!==e[0].flags&&(s=4),void 0!==e[0].compositionTimeOffset&&(n=8)),[0,0,i|r|s|n,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},r=function(e,t){var i,r,a,o,l,u;for(t+=20+16*(o=e.samples||[]).length,(r=new Uint8Array((a=s(o,t)).length+16*o.length)).set(a),i=a.length,u=0;u>>24,r[i++]=(16711680&l.duration)>>>16,r[i++]=(65280&l.duration)>>>8,r[i++]=255&l.duration,r[i++]=(4278190080&l.size)>>>24,r[i++]=(16711680&l.size)>>>16,r[i++]=(65280&l.size)>>>8,r[i++]=255&l.size,r[i++]=l.flags.isLeading<<2|l.flags.dependsOn,r[i++]=l.flags.isDependedOn<<6|l.flags.hasRedundancy<<4|l.flags.paddingValue<<1|l.flags.isNonSyncSample,r[i++]=61440&l.flags.degradationPriority,r[i++]=15&l.flags.degradationPriority,r[i++]=(4278190080&l.compositionTimeOffset)>>>24,r[i++]=(16711680&l.compositionTimeOffset)>>>16,r[i++]=(65280&l.compositionTimeOffset)>>>8,r[i++]=255&l.compositionTimeOffset;return n(I.trun,r)},i=function(e,t){var i,r,a,o,l,u;for(t+=20+8*(o=e.samples||[]).length,(i=new Uint8Array((a=s(o,t)).length+8*o.length)).set(a),r=a.length,u=0;u>>24,i[r++]=(16711680&l.duration)>>>16,i[r++]=(65280&l.duration)>>>8,i[r++]=255&l.duration,i[r++]=(4278190080&l.size)>>>24,i[r++]=(16711680&l.size)>>>16,i[r++]=(65280&l.size)>>>8,i[r++]=255&l.size;return n(I.trun,i)},D=function(e,t){return"audio"===e.type?i(e,t):r(e,t)};var em=function(e,t){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i},eg=[33,16,5,32,164,27],ef=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],ey=function(e){for(var t=[];e--;)t.push(0);return t};j=function(e){return 9e4*e},$=function(e,t){return e*t},V=function(e){return e/9e4},H=function(e,t){return e/t},z=function(e,t){return j(H(e,t))},W=function(e,t){return $(V(e),t)},G=function(e,t,i){return V(i?e:e-t)};var e_={ONE_SECOND_IN_TS:9e4,secondsToVideoTs:j,videoTsToSeconds:V,audioTsToVideoTs:z,videoTsToAudioTs:W,metadataTsToSeconds:G},eb=function(){if(!q){var e;q=Object.keys(e={96e3:[eg,[227,64],ey(154),[56]],88200:[eg,[231],ey(170),[56]],64e3:[eg,[248,192],ey(240),[56]],48e3:[eg,[255,192],ey(268),[55,148,128],ey(54),[112]],44100:[eg,[255,192],ey(268),[55,163,128],ey(84),[112]],32e3:[eg,[255,192],ey(268),[55,234],ey(226),[112]],24e3:[eg,[255,192],ey(268),[55,255,128],ey(268),[111,112],ey(126),[224]],16e3:[eg,[255,192],ey(268),[55,255,128],ey(268),[111,255],ey(269),[223,108],ey(195),[1,192]],12e3:[ef,ey(268),[3,127,248],ey(268),[6,255,240],ey(268),[13,255,224],ey(268),[27,253,128],ey(259),[56]],11025:[ef,ey(268),[3,127,248],ey(268),[6,255,240],ey(268),[13,255,224],ey(268),[27,255,192],ey(268),[55,175,128],ey(108),[112]],8e3:[ef,ey(268),[3,121,16],ey(47),[7]]}).reduce(function(t,i){return t[i]=new Uint8Array(e[i].reduce(function(e,t){return e.concat(t)},[])),t},{})}return q},ev=function(e){var t,i=0;for(t=0;t=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},eD.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},eD.prototype.addText=function(e){this.rows[this.rowIdx]+=e},eD.prototype.backspace=function(){if(!this.isEmpty()){var e=this.rows[this.rowIdx];this.rows[this.rowIdx]=e.substr(0,e.length-1)}};var eI=function(e,t,i){this.serviceNum=e,this.text="",this.currentWindow=new eD(-1),this.windows=[],this.stream=i,"string"==typeof t&&this.createTextDecoder(t)};eI.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new eD(i),"function"==typeof t&&(this.windows[i].beforeRowOverflow=t)},eI.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},eI.prototype.createTextDecoder=function(e){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(e)}catch(t){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+e+" encoding. "+t})}};var ex=function(e){e=e||{},ex.prototype.init.call(this);var t,i=this,r=e.captionServices||{},s={};Object.keys(r).forEach(e=>{t=r[e],/^SERVICE/.test(e)&&(s[e]=t.encoding)}),this.serviceEncodings=s,this.current708Packet=null,this.services={},this.push=function(e){3===e.type?i.new708Packet():null===i.current708Packet&&i.new708Packet(),i.add708Bytes(e)}};ex.prototype=new ec,ex.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},ex.prototype.add708Bytes=function(e){var t=e.ccData;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(t>>>8),this.current708Packet.data.push(255&t)},ex.prototype.push708Packet=function(){var e=this.current708Packet,t=e.data,i=null,r=null,s=0,n=t[s++];for(e.seq=n>>6,e.sizeCode=63&n;s>5,r=31&n,7===i&&r>0&&(i=n=t[s++]),this.pushServiceBlock(i,s,r),r>0&&(s+=r-1)},ex.prototype.pushServiceBlock=function(e,t,i){var r,s=t,n=this.current708Packet.data,a=this.services[e];for(a||(a=this.initService(e,s));s("0"+(255&e).toString(16)).slice(-2)).join(""),16)):ek((n?4096:0)|l),d.pendingNewLine&&!d.isEmpty()&&d.newLine(this.getPts(e)),d.pendingNewLine=!1,d.addText(r),e},ex.prototype.multiByteCharacter=function(e,t){var i=this.current708Packet.data,r=i[e+1],s=i[e+2];return eC(r)&&eC(s)&&(e=this.handleText(++e,t,{isMultiByte:!0})),e},ex.prototype.setCurrentWindow=function(e,t){var i=this.current708Packet.data[e];return t.setCurrentWindow(7&i),e},ex.prototype.defineWindow=function(e,t){var i=this.current708Packet.data,r=i[e],s=7&r;t.setCurrentWindow(s);var n=t.currentWindow;return r=i[++e],n.visible=(32&r)>>5,n.rowLock=(16&r)>>4,n.columnLock=(8&r)>>3,n.priority=7&r,r=i[++e],n.relativePositioning=(128&r)>>7,n.anchorVertical=127&r,r=i[++e],n.anchorHorizontal=r,r=i[++e],n.anchorPoint=(240&r)>>4,n.rowCount=15&r,r=i[++e],n.columnCount=63&r,r=i[++e],n.windowStyle=(56&r)>>3,n.penStyle=7&r,n.virtualRowCount=n.rowCount+1,e},ex.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,r=i[e],s=t.currentWindow.winAttr;return r=i[++e],s.fillOpacity=(192&r)>>6,s.fillRed=(48&r)>>4,s.fillGreen=(12&r)>>2,s.fillBlue=3&r,r=i[++e],s.borderType=(192&r)>>6,s.borderRed=(48&r)>>4,s.borderGreen=(12&r)>>2,s.borderBlue=3&r,r=i[++e],s.borderType+=(128&r)>>5,s.wordWrap=(64&r)>>6,s.printDirection=(48&r)>>4,s.scrollDirection=(12&r)>>2,s.justify=3&r,r=i[++e],s.effectSpeed=(240&r)>>4,s.effectDirection=(12&r)>>2,s.displayEffect=3&r,e},ex.prototype.flushDisplayed=function(e,t){for(var i=[],r=0;r<8;r++)t.windows[r].visible&&!t.windows[r].isEmpty()&&i.push(t.windows[r].getText());t.endPts=e,t.text=i.join("\n\n"),this.pushCaption(t),t.startPts=e},ex.prototype.pushCaption=function(e){""!==e.text&&(this.trigger("data",{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:"cc708_"+e.serviceNum}),e.text="",e.startPts=e.endPts)},ex.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],r=this.getPts(e);this.flushDisplayed(r,t);for(var s=0;s<8;s++)i&1<>4,s.offset=(12&r)>>2,s.penSize=3&r,r=i[++e],s.italics=(128&r)>>7,s.underline=(64&r)>>6,s.edgeType=(56&r)>>3,s.fontStyle=7&r,e},ex.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,r=i[e],s=t.currentWindow.penColor;return r=i[++e],s.fgOpacity=(192&r)>>6,s.fgRed=(48&r)>>4,s.fgGreen=(12&r)>>2,s.fgBlue=3&r,r=i[++e],s.bgOpacity=(192&r)>>6,s.bgRed=(48&r)>>4,s.bgGreen=(12&r)>>2,s.bgBlue=3&r,r=i[++e],s.edgeRed=(48&r)>>4,s.edgeGreen=(12&r)>>2,s.edgeBlue=3&r,e},ex.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,r=i[e],s=t.currentWindow.penLoc;return t.currentWindow.pendingNewLine=!0,r=i[++e],s.row=15&r,r=i[++e],s.column=63&r,e},ex.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)};var eA={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},eP=function(e){return null===e?"":String.fromCharCode(e=eA[e]||e)},eL=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],eO=function(){for(var e=[],t=15;t--;)e.push({text:"",indent:0,offset:0});return e},eR=function(e,t){eR.prototype.init.call(this),this.field_=e||0,this.dataChannel_=t||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(e){var t,i,r,s,n;if((t=32639&e.ccData)===this.lastControlCode_){this.lastControlCode_=null;return}if((61440&t)==4096?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),r=t>>>8,s=255&t,t!==this.PADDING_){if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(t===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=eO();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=eO();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=eO()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(r,s))n=eP((r=(3&r)<<8)|s),this[this.mode_](e.pts,n),this.column_++;else if(this.isExtCharacter(r,s))"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),n=eP((r=(3&r)<<8)|s),this[this.mode_](e.pts,n),this.column_++;else if(this.isMidRowCode(r,s))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,(14&s)==14&&this.addFormatting(e.pts,["i"]),(1&s)==1&&this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(r,s)){let e=3&s;this.nonDisplayed_[this.row_].offset=e,this.column_+=e}else if(this.isPAC(r,s)){var a=eL.indexOf(7968&t);if("rollUp"===this.mode_&&(a-this.rollUpRows_+1<0&&(a=this.rollUpRows_-1),this.setRollUp(e.pts,a)),a!==this.row_&&a>=0&&a<=14&&(this.clearFormatting(e.pts),this.row_=a),1&s&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),(16&t)==16){let e=(14&t)>>1;this.column_=4*e,this.nonDisplayed_[this.row_].indent+=e}this.isColorPAC(s)&&(14&s)==14&&this.addFormatting(e.pts,["i"])}else this.isNormalChar(r)&&(0===s&&(s=null),n=eP(r)+eP(s),this[this.mode_](e.pts,n),this.column_+=n.length)}}};eR.prototype=new ec,eR.prototype.flushDisplayed=function(e){let t=e=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+e+"."})},i=[];this.displayed_.forEach((e,r)=>{if(e&&e.text&&e.text.length){try{e.text=e.text.trim()}catch(e){t(r)}e.text.length&&i.push({text:e.text,line:r+1,position:10+Math.min(70,10*e.indent)+2.5*e.offset})}else null==e&&t(r)}),i.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,content:i,stream:this.name_})},eR.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=eO(),this.nonDisplayed_=eO(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},eR.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},eR.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},eR.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},eR.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},eR.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},eR.prototype.isPAC=function(e,t){return e>=this.BASE_&&e=64&&t<=127},eR.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},eR.prototype.isNormalChar=function(e){return e>=32&&e<=127},eR.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=eO(),this.displayed_=eO()),void 0!==t&&t!==this.row_)for(var i=0;i"},"");this[this.mode_](e,i)},eR.prototype.clearFormatting=function(e){if(this.formatting_.length){var t=this.formatting_.reverse().reduce(function(e,t){return e+""+t+">"},"");this.formatting_=[],this[this.mode_](e,t)}},eR.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_].text;i+=t,this.nonDisplayed_[this.row_].text=i},eR.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_].text;i+=t,this.displayed_[this.row_].text=i},eR.prototype.shiftRowsUp_=function(){var e;for(e=0;et&&(i=-1);Math.abs(t-e)>4294967296;)e+=8589934592*i;return e},eB=function(e){var t,i;eB.prototype.init.call(this),this.type_=e||eN,this.push=function(e){if("metadata"===e.type){this.trigger("data",e);return}(this.type_===eN||e.type===this.type_)&&(void 0===i&&(i=e.dts),e.dts=eU(e.dts,i),e.pts=eU(e.pts,i),t=e.dts,this.trigger("data",e))},this.flush=function(){i=t,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){i=void 0,t=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};eB.prototype=new ec;var eF=(e,t,i)=>{if(!e)return -1;for(var r=i;r"===e.mimeType?e.url=e$(e.data,r,e.data.length):e.pictureData=e.data.subarray(r,e.data.length)))},"T*":function(e){3===e.data[0]&&(e.value=ej(e.data,1,e.data.length).replace(/\0*$/,""),e.values=e.value.split("\0"))},TXXX:function(e){var t;3===e.data[0]&&-1!==(t=eF(e.data,0,1))&&(e.description=ej(e.data,1,t),e.value=ej(e.data,t+1,e.data.length).replace(/\0*$/,""),e.data=e.value)},"W*":function(e){e.url=e$(e.data,0,e.data.length).replace(/\0.*$/,"")},WXXX:function(e){var t;3===e.data[0]&&-1!==(t=eF(e.data,0,1))&&(e.description=ej(e.data,1,t),e.url=e$(e.data,t+1,e.data.length).replace(/\0.*$/,""))},PRIV:function(e){var t;for(t=0;t>>2;d*=4,d+=3&u[7],o.timeStamp=d,void 0===t.pts&&void 0===t.dts&&(t.pts=o.timeStamp,t.dts=o.timeStamp),this.trigger("timestamp",o)}t.frames.push(o),i+=10+a}while(i>>4>1&&(r+=t[r]+1),0===i.pid)i.type="pat",e(t.subarray(r),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",e(t.subarray(r),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,r,i]):this.processPes_(t,r,i)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=eM.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=eM.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}}).prototype=new ec,Y.STREAM_TYPES={h264:27,adts:15},(Q=function(){var e,t=this,i=!1,r={data:[],size:0},s={data:[],size:0},n={data:[],size:0},a=function(e,t){var i;let r=e[0]<<16|e[1]<<8|e[2];t.data=new Uint8Array,1===r&&(t.packetLength=6+(e[4]<<8|e[5]),t.dataAlignmentIndicator=(4&e[6])!=0,192&(i=e[7])&&(t.pts=(14&e[9])<<27|(255&e[10])<<20|(254&e[11])<<12|(255&e[12])<<5|(254&e[13])>>>3,t.pts*=4,t.pts+=(6&e[13])>>>1,t.dts=t.pts,64&i&&(t.dts=(14&e[14])<<27|(255&e[15])<<20|(254&e[16])<<12|(255&e[17])<<5|(254&e[18])>>>3,t.dts*=4,t.dts+=(6&e[18])>>>1)),t.data=e.subarray(9+e[8]))},o=function(e,i,r){var s,n=new Uint8Array(e.size),o={type:i},l=0,u=0,d=!1;if(e.data.length&&!(e.size<9)){for(l=0,o.trackId=e.data[0].pid;l>5,u=(l=((3&t[d+6])+1)*1024)*eX/eY[(60&t[d+2])>>>2],t.byteLength-d>>6&3)+1,channelcount:(1&t[d+2])<<2|(192&t[d+3])>>>6,samplerate:eY[(60&t[d+2])>>>2],samplingfrequencyindex:(60&t[d+2])>>>2,samplesize:16,data:t.subarray(d+7+a,d+n)}),i++,d+=n}"number"==typeof s&&(this.skipWarn_(s,d),s=null),t=t.subarray(d)}},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){t=void 0,this.trigger("reset")},this.endTimeline=function(){t=void 0,this.trigger("endedtimeline")}}).prototype=new ec;var eQ=J;Z=function(e){var t=e.byteLength,i=0,r=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+r},this.loadWord=function(){var s=e.byteLength-t,n=new Uint8Array(4),a=Math.min(4,t);if(0===a)throw Error("no bytes available");n.set(e.subarray(s,s+a)),i=new DataView(n.buffer).getUint32(0),r=8*a,t-=a},this.skipBits=function(e){var s;r>e||(e-=r,s=Math.floor(e/8),e-=8*s,t-=s,this.loadWord()),i<<=e,r-=e},this.readBits=function(e){var s=Math.min(r,e),n=i>>>32-s;return((r-=s)>0?i<<=s:t>0&&this.loadWord(),(s=e-s)>0)?n<>>e)!=0)return i<<=e,r-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()},(et=function(){var e,t,i=0;et.prototype.init.call(this),this.push=function(r){t?((s=new Uint8Array(t.byteLength+r.data.byteLength)).set(t),s.set(r.data,t.byteLength),t=s):t=r.data;for(var s,n=t.byteLength;i3&&this.trigger("data",t.subarray(i+3)),t=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new ec,ei={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(ee=function(){var e,t,i,r,s,n,a,o=new et;ee.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,i=e.pts,r=e.dts,o.push(e))},o.on("data",function(a){var o={trackId:t,pts:i,dts:r,data:a,nalUnitTypeCode:31&a[0]};switch(o.nalUnitTypeCode){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=s(a.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=s(a.subarray(1)),o.config=n(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",o)}),o.on("done",function(){e.trigger("done")}),o.on("partialdone",function(){e.trigger("partialdone")}),o.on("reset",function(){e.trigger("reset")}),o.on("endedtimeline",function(){e.trigger("endedtimeline")}),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},a=function(e,t){var i,r=8,s=8;for(i=0;i=0?i:0,(16&e[t+5])>>4)?i+20:i+10},e1=function(e,t){return e.length-t<10||73!==e[t]||68!==e[t+1]||51!==e[t+2]?t:(t+=e0(e,t),e1(e,t))},e2=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},e4=function(e,t,i){var r,s="";for(r=t;r=t+2&&(255&e[t])==255&&(240&e[t+1])==240&&(22&e[t+1])==16},parseId3TagSize:e0,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,r=e[t+4]<<3;return 6144&e[t+3]|r|i},parseType:function(e,t){return 73===e[t]&&68===e[t+1]&&51===e[t+2]?"timed-metadata":!0&e[t]&&(240&e[t+1])==240?"audio":null},parseSampleRate:function(e){for(var t=0;t+5>>2]}return null},parseAacTimestamp:function(e){var t,i,r;t=10,64&e[5]&&(t+=4+e2(e.subarray(10,14)));do{if((i=e2(e.subarray(t+4,t+8)))<1)break;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){r=e.subarray(t+10,t+i+10);for(var s=0;s>>2;return a*=4,a+=3&n[7]}break}}t+=10+i}while(t=3;){if(73===e[o]&&68===e[o+1]&&51===e[o+2]){if(e.length-o<10||(a=e8.parseId3TagSize(e,o),o+a>e.length))break;r={type:"timed-metadata",data:e.subarray(o,o+a)},this.trigger("data",r),o+=a;continue}if((255&e[o])==255&&(240&e[o+1])==240){if(e.length-o<7||(a=e8.parseAdtsSize(e,o),o+a>e.length))break;s={type:"audio",data:e.subarray(o,o+a),pts:t,dts:t},this.trigger("data",s),o+=a;continue}o++}e=e.length-o>0?e.subarray(o):new Uint8Array},this.reset=function(){e=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){e=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new ec;var e5=er,e3={mdat:u,moof:c,initSegment:function(e){var t,i=l(),r=p(e);return(t=new Uint8Array(i.byteLength+r.byteLength)).set(i),t.set(r,i.byteLength),t}},e6={groupNalsIntoFrames:function(e){var t,i,r=[],s=[];for(t=0,s.byteLength=0,s.nalCount=0,s.duration=0,r.byteLength=0;t1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e},generateSampleTable:function(e,t){var i,r,s,n,a=t||0,o=[];for(i=0;ie_.ONE_SECOND_IN_TS/2))){for((n=eb()[e.samplerate])||(n=t[0].data),a=0;a=g?m:(e.minSegmentDts=1/0,m.filter(function(t){return t.dts>=g&&(e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),e.minSegmentPts=e.minSegmentDts,!0)})),e.baseMediaDecodeTime=tt.calculateTrackBaseMediaDecodeTime(e,t.keepOriginalTimestamps),p=e7(e,o,n,a),e.samples=e9(o),u=e3.mdat(te(o)),r=[],d=new Uint8Array((l=e3.moof(i,[e])).byteLength+u.byteLength),i++,d.set(l),d.set(u,l.byteLength),tt.clearDtsInfo(e),h=Math.ceil(1024*tr/e.samplerate),o.length&&(c=o.length*h,this.trigger("segmentTimingInfo",tu(e_.audioTsToVideoTs(e.baseMediaDecodeTime,e.samplerate),o[0].dts,o[0].pts,o[0].dts+c,o[0].pts+c,p||0)),this.trigger("timingInfo",{start:o[0].pts,end:o[0].pts+c})),this.trigger("data",{track:e,boxes:d}),this.trigger("done","AudioSegmentStream")},this.reset=function(){tt.clearDtsInfo(e),r=[],this.trigger("reset")}}).prototype=new ec,(es=function(e,t){var i,r,s,n=[],a=[];i=(t=t||{}).firstSequenceNumber||0,es.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(t){tt.collectDtsInfo(e,t),"seq_parameter_set_rbsp"!==t.nalUnitType||r||(r=t.config,e.sps=[t.data],tn.forEach(function(t){e[t]=r[t]},this)),"pic_parameter_set_rbsp"!==t.nalUnitType||s||(s=t.data,e.pps=[t.data]),n.push(t)},this.flush=function(){for(var r,s,o,l,u,d,h,c,p,m=0;n.length&&"access_unit_delimiter_rbsp"!==n[0].nalUnitType;)n.shift();if(0===n.length){this.resetStream_(),this.trigger("done","VideoSegmentStream");return}if(s=e6.groupNalsIntoFrames(n),(l=e6.groupFramesIntoGops(s))[0][0].keyFrame||((o=this.getGopForFusion_(n[0],e))?(m=o.duration,l.unshift(o),l.byteLength+=o.byteLength,l.nalCount+=o.nalCount,l.pts=o.pts,l.dts=o.dts,l.duration+=o.duration):l=e6.extendFirstKeyFrame(l)),a.length){if(!(r=t.alignGopsAtEnd?this.alignGopsAtEnd_(l):this.alignGopsAtStart_(l))){this.gopCache_.unshift({gop:l.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),n=[],this.resetStream_(),this.trigger("done","VideoSegmentStream");return}tt.clearDtsInfo(e),l=r}tt.collectDtsInfo(e,l),e.samples=e6.generateSampleTable(l),d=e3.mdat(e6.concatenateNalData(l)),e.baseMediaDecodeTime=tt.calculateTrackBaseMediaDecodeTime(e,t.keepOriginalTimestamps),this.trigger("processedGopsInfo",l.map(function(e){return{pts:e.pts,dts:e.dts,byteLength:e.byteLength}})),c=l[0],p=l[l.length-1],this.trigger("segmentTimingInfo",tu(e.baseMediaDecodeTime,c.dts,c.pts,p.dts+p.duration,p.pts+p.duration,m)),this.trigger("timingInfo",{start:l[0].pts,end:l[l.length-1].pts+l[l.length-1].duration}),this.gopCache_.unshift({gop:l.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),n=[],this.trigger("baseMediaDecodeTime",e.baseMediaDecodeTime),this.trigger("timelineStartInfo",e.timelineStartInfo),h=new Uint8Array((u=e3.moof(i,[e])).byteLength+d.byteLength),i++,h.set(u),h.set(d,u.byteLength),this.trigger("data",{track:e,boxes:h}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),n=[],this.gopCache_.length=0,a.length=0,this.trigger("reset")},this.resetStream_=function(){tt.clearDtsInfo(e),r=void 0,s=void 0},this.getGopForFusion_=function(t){var i,r,s,n,a,o=1/0;for(a=0;a=-1e4&&i<=45e3&&(!r||o>i)&&(r=n,o=i);return r?r.gop:null},this.alignGopsAtStart_=function(e){var t,i,r,s,n,o,l,u;for(n=e.byteLength,o=e.nalCount,l=e.duration,t=i=0;tr.pts){t++;continue}i++,n-=s.byteLength,o-=s.nalCount,l-=s.duration}return 0===i?e:i===e.length?null:((u=e.slice(i)).byteLength=n,u.duration=l,u.nalCount=o,u.pts=u[0].pts,u.dts=u[0].dts,u)},this.alignGopsAtEnd_=function(e){for(t=a.length-1,i=e.length-1,n=null,o=!1;t>=0&&i>=0;){if(r=a[t],s=e[i],r.pts===s.pts){o=!0;break}if(r.pts>s.pts){t--;continue}t===a.length-1&&(n=i),i--}if(!o&&null===n)return null;if(0===(l=o?i:n))return e;var t,i,r,s,n,o,l,u=e.slice(l),d=u.reduce(function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e},{byteLength:0,duration:0,nalCount:0});return u.byteLength=d.byteLength,u.duration=d.duration,u.nalCount=d.nalCount,u.pts=u[0].pts,u.dts=u[0].dts,u},this.alignGopsWith=function(e){a=e}}).prototype=new ec,(eo=function(e,t){this.numberOfTracks=0,this.metadataStream=t,void 0!==(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,eo.prototype.init.call(this),this.push=function(e){return e.content||e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):void(this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),"audio"===e.track.type&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes)))}}).prototype=new ec,eo.prototype.flush=function(e){var t,i,r,s,n=0,a={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,tn.forEach(function(e){a.info[e]=this.videoTrack[e]},this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,ts.forEach(function(e){a.info[e]=this.audioTrack[e]},this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?a.type=this.pendingTracks[0].type:a.type="combined",this.emittedTracks+=this.pendingTracks.length,r=e3.initSegment(this.pendingTracks),a.initSegment=new Uint8Array(r.byteLength),a.initSegment.set(r),a.data=new Uint8Array(this.pendingBytes),s=0;s=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},eo.prototype.setRemux=function(e){this.remuxTracks=e},(ea=function(e){var t,i,r=this,s=!0;ea.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var s={};this.transmuxPipeline_=s,s.type="aac",s.metadataStream=new eG.MetadataStream,s.aacStream=new e5,s.audioTimestampRolloverStream=new eG.TimestampRolloverStream("audio"),s.timedMetadataTimestampRolloverStream=new eG.TimestampRolloverStream("timed-metadata"),s.adtsStream=new eQ,s.coalesceStream=new eo(e,s.metadataStream),s.headOfPipeline=s.aacStream,s.aacStream.pipe(s.audioTimestampRolloverStream).pipe(s.adtsStream),s.aacStream.pipe(s.timedMetadataTimestampRolloverStream).pipe(s.metadataStream).pipe(s.coalesceStream),s.metadataStream.on("timestamp",function(e){s.aacStream.setTimestamp(e.timeStamp)}),s.aacStream.on("data",function(n){"timed-metadata"!==n.type&&"audio"!==n.type||s.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:r.baseMediaDecodeTime},codec:"adts",type:"audio"},s.coalesceStream.numberOfTracks++,s.audioSegmentStream=new en(i,e),s.audioSegmentStream.on("log",r.getLogTrigger_("audioSegmentStream")),s.audioSegmentStream.on("timingInfo",r.trigger.bind(r,"audioTimingInfo")),s.adtsStream.pipe(s.audioSegmentStream).pipe(s.coalesceStream),r.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t}))}),s.coalesceStream.on("data",this.trigger.bind(this,"data")),s.coalesceStream.on("done",this.trigger.bind(this,"done")),to(this,s)},this.setupTsPipeline=function(){var s={};this.transmuxPipeline_=s,s.type="ts",s.metadataStream=new eG.MetadataStream,s.packetStream=new eG.TransportPacketStream,s.parseStream=new eG.TransportParseStream,s.elementaryStream=new eG.ElementaryStream,s.timestampRolloverStream=new eG.TimestampRolloverStream,s.adtsStream=new eQ,s.h264Stream=new eJ,s.captionStream=new eG.CaptionStream(e),s.coalesceStream=new eo(e,s.metadataStream),s.headOfPipeline=s.packetStream,s.packetStream.pipe(s.parseStream).pipe(s.elementaryStream).pipe(s.timestampRolloverStream),s.timestampRolloverStream.pipe(s.h264Stream),s.timestampRolloverStream.pipe(s.adtsStream),s.timestampRolloverStream.pipe(s.metadataStream).pipe(s.coalesceStream),s.h264Stream.pipe(s.captionStream).pipe(s.coalesceStream),s.elementaryStream.on("data",function(n){var a;if("metadata"===n.type){for(a=n.tracks.length;a--;)t||"video"!==n.tracks[a].type?i||"audio"!==n.tracks[a].type||((i=n.tracks[a]).timelineStartInfo.baseMediaDecodeTime=r.baseMediaDecodeTime):(t=n.tracks[a]).timelineStartInfo.baseMediaDecodeTime=r.baseMediaDecodeTime;t&&!s.videoSegmentStream&&(s.coalesceStream.numberOfTracks++,s.videoSegmentStream=new es(t,e),s.videoSegmentStream.on("log",r.getLogTrigger_("videoSegmentStream")),s.videoSegmentStream.on("timelineStartInfo",function(t){i&&!e.keepOriginalTimestamps&&(i.timelineStartInfo=t,s.audioSegmentStream.setEarliestDts(t.dts-r.baseMediaDecodeTime))}),s.videoSegmentStream.on("processedGopsInfo",r.trigger.bind(r,"gopInfo")),s.videoSegmentStream.on("segmentTimingInfo",r.trigger.bind(r,"videoSegmentTimingInfo")),s.videoSegmentStream.on("baseMediaDecodeTime",function(e){i&&s.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}),s.videoSegmentStream.on("timingInfo",r.trigger.bind(r,"videoTimingInfo")),s.h264Stream.pipe(s.videoSegmentStream).pipe(s.coalesceStream)),i&&!s.audioSegmentStream&&(s.coalesceStream.numberOfTracks++,s.audioSegmentStream=new en(i,e),s.audioSegmentStream.on("log",r.getLogTrigger_("audioSegmentStream")),s.audioSegmentStream.on("timingInfo",r.trigger.bind(r,"audioTimingInfo")),s.audioSegmentStream.on("segmentTimingInfo",r.trigger.bind(r,"audioSegmentTimingInfo")),s.adtsStream.pipe(s.audioSegmentStream).pipe(s.coalesceStream)),r.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t})}}),s.coalesceStream.on("data",this.trigger.bind(this,"data")),s.coalesceStream.on("id3Frame",function(e){e.dispatchType=s.metadataStream.dispatchType,r.trigger("id3Frame",e)}),s.coalesceStream.on("caption",this.trigger.bind(this,"caption")),s.coalesceStream.on("done",this.trigger.bind(this,"done")),to(this,s)},this.setBaseMediaDecodeTime=function(r){var s=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=r),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,tt.clearDtsInfo(i),s.audioTimestampRolloverStream&&s.audioTimestampRolloverStream.discontinuity()),t&&(s.videoSegmentStream&&(s.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,tt.clearDtsInfo(t),s.captionStream.reset()),s.timestampRolloverStream&&s.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(t){var i=this.transmuxPipeline_;e.remux=t,i&&i.coalesceStream&&i.coalesceStream.setRemux(t)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(e){var t=this;return function(i){i.stream=e,t.trigger("log",i)}},this.push=function(e){if(s){var t=ti(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),s=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){s=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new ec;var td=ea,th=function(e){return e>>>0},tc=function(e){return""+(String.fromCharCode(e[0])+String.fromCharCode(e[1])+String.fromCharCode(e[2])+String.fromCharCode(e[3]))},tp=function(e,t){var i,r,s,n,a,o=[];if(!t.length)return null;for(i=0;i1?i+r:e.byteLength,s===t[0]&&(1===t.length?o.push(e.subarray(i+8,n)):(a=tp(e.subarray(i+8,n),t.slice(1))).length&&(o=o.concat(a))),i=n;return o},tm=function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4))};return 1===t.version?t.baseMediaDecodeTime=ep(e.subarray(4)):t.baseMediaDecodeTime=th(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),t},tg=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},tf=function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},r=new DataView(e.buffer,e.byteOffset,e.byteLength),s=1&i.flags[2],n=4&i.flags[2],a=1&i.flags[1],o=2&i.flags[1],l=4&i.flags[1],u=8&i.flags[1],d=r.getUint32(4),h=8;for(s&&(i.dataOffset=r.getInt32(h),h+=4),n&&d&&(t={flags:tg(e.subarray(h,h+4))},h+=4,a&&(t.duration=r.getUint32(h),h+=4),o&&(t.size=r.getUint32(h),h+=4),u&&(1===i.version?t.compositionTimeOffset=r.getInt32(h):t.compositionTimeOffset=r.getUint32(h),h+=4),i.samples.push(t),d--);d--;)t={},a&&(t.duration=r.getUint32(h),h+=4),o&&(t.size=r.getUint32(h),h+=4),l&&(t.flags=tg(e.subarray(h,h+4)),h+=4),u&&(1===i.version?t.compositionTimeOffset=r.getInt32(h):t.compositionTimeOffset=r.getUint32(h),h+=4),i.samples.push(t);return i},ty=function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:i.getUint32(4)},s=1&r.flags[2],n=2&r.flags[2],a=8&r.flags[2],o=16&r.flags[2],l=32&r.flags[2],u=65536&r.flags[0],d=131072&r.flags[0];return t=8,s&&(t+=4,r.baseDataOffset=i.getUint32(12),t+=4),n&&(r.sampleDescriptionIndex=i.getUint32(t),t+=4),a&&(r.defaultSampleDuration=i.getUint32(t),t+=4),o&&(r.defaultSampleSize=i.getUint32(t),t+=4),l&&(r.defaultSampleFlags=i.getUint32(t)),u&&(r.durationIsEmpty=!0),!s&&d&&(r.baseDataOffsetIsMoof=!0),r};"undefined"!=typeof window?el=window:void 0!==eh?el=eh:"undefined"!=typeof self?el=self:el={};var t_=el,tb=eS.discardEmulationPreventionBytes,tv=function(e,t){for(var i=e,r=0;r0?tm(l[0]).baseMediaDecodeTime:0,d=tp(n,["trun"]);t===o&&d.length>0&&(i=tT(r,tS(d,u,a),o),s[o]||(s[o]={seiNals:[],logs:[]}),s[o].seiNals=s[o].seiNals.concat(i.seiNals),s[o].logs=s[o].logs.concat(i.logs))}),s},tw=function(e,t,i){if(null===t)return null;var r=tE(e,t)[t]||{};return{seiNals:r.seiNals,logs:r.logs,timescale:i}},tk=function(){var e,t,i,r,s,n,a=!1;this.isInitialized=function(){return a},this.init=function(t){e=new eE,a=!0,n=!!t&&t.isPartial,e.on("data",function(e){e.startTime=e.startPts/r,e.endTime=e.endPts/r,s.captions.push(e),s.captionStreams[e.stream]=!0}),e.on("log",function(e){s.logs.push(e)})},this.isNewInit=function(e,t){return(!e||0!==e.length)&&(!t||"object"!=typeof t||0!==Object.keys(t).length)&&(i!==e[0]||r!==t[i])},this.parse=function(e,n,a){var o;if(!this.isInitialized()||!n||!a)return null;if(this.isNewInit(n,a))r=a[i=n[0]];else if(null===i||!r)return t.push(e),null;for(;t.length>0;){var l=t.shift();this.parse(l,n,a)}return((o=tw(e,i,r))&&o.logs&&(s.logs=s.logs.concat(o.logs)),null!==o&&o.seiNals)?(this.pushNals(o.seiNals),this.flushStream(),s):s.logs.length?{logs:s.logs,captions:[],captionStreams:[]}:null},this.pushNals=function(t){if(!this.isInitialized()||!t||0===t.length)return null;t.forEach(function(t){e.push(t)})},this.flushStream=function(){if(!this.isInitialized())return null;n?e.partialFlush():e.flush()},this.clearParsedCaptions=function(){s.captions=[],s.captionStreams={},s.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],i=null,r=null,s?this.clearParsedCaptions():s={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},tC=function(e){for(var t=0,i=String.fromCharCode(e[0]),r="";"\0"!==i;)r+=i,i=String.fromCharCode(e[++t]);return r+i},tD=function(e,t){var i="\0"!==t.scheme_id_uri,r=0===e&&tI(t.presentation_time_delta)&&i,s=1===e&&tI(t.presentation_time)&&i;return!(e>1)&&r||s},tI=function(e){return void 0!==e||null!==e},tx=function(e){return("00"+e.toString(16)).slice(-2)},tA=function(e){var t,i,r,s,n,a,o,l=4,u=e[0];if(0===u){t=tC(e.subarray(l)),l+=t.length,i=tC(e.subarray(l)),l+=i.length;var d=new DataView(e.buffer);r=d.getUint32(l),l+=4,n=d.getUint32(l),l+=4,a=d.getUint32(l),l+=4,o=d.getUint32(l),l+=4}else if(1===u){var d=new DataView(e.buffer);r=d.getUint32(l),l+=4,s=ep(e.subarray(l)),l+=8,a=d.getUint32(l),l+=4,o=d.getUint32(l),l+=4,t=tC(e.subarray(l)),l+=t.length,i=tC(e.subarray(l)),l+=i.length}var h={scheme_id_uri:t,value:i,timescale:r||1,presentation_time:s,presentation_time_delta:n,event_duration:a,id:o,message_data:new Uint8Array(e.subarray(l,e.byteLength))};return tD(u,h)?h:void 0},tP=function(e,t,i,r){return e||0===e?e/t:r+i/t},tL=ez.parseId3Frames;eu=function(e,t){var i=tp(t,["moof","traf"]).reduce(function(t,i){let r;var s,n=tp(i,["tfhd"])[0],a=e[th(n[4]<<24|n[5]<<16|n[6]<<8|n[7])]||9e4,o=tp(i,["tfdt"])[0],l=new DataView(o.buffer,o.byteOffset,o.byteLength);return"bigint"==typeof(s=1===o[0]?ep(o.subarray(4,12)):l.getUint32(4))?r=s/t_.BigInt(a):"number"!=typeof s||isNaN(s)||(r=s/a),r11?(t.codec+=".",t.codec+=tx(u[9]),t.codec+=tx(u[10]),t.codec+=tx(u[11])):t.codec="avc1.4d400d":/^mp4[a,v]$/i.test(t.codec)?"esds"===tc((u=h.subarray(28)).subarray(4,8))&&u.length>20&&0!==u[19]?(t.codec+="."+tx(u[19]),t.codec+="."+tx(u[20]>>>2&63).replace(/^0/,"")):t.codec="mp4a.40.2":t.codec=t.codec.toLowerCase())}var c=tp(e,["mdia","mdhd"])[0];c&&(t.timescale=ed(c)),i.push(t)}),i},tR=function(e){var t=31&e[1];return t<<=8,t|=e[2]},tM=function(e){return!!(64&e[1])},tN=function(e){var t=0;return(48&e[3])>>>4>1&&(t+=e[4]+1),t},tU=function(e){switch(e){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},tB={};tB.ts={parseType:function(e,t){var i=tR(e);return 0===i?"pat":i===t?"pmt":t?"pes":null},parsePat:function(e){var t=tM(e),i=4+tN(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t,i={},r=tM(e),s=4+tN(e);if(r&&(s+=e[s]+1),1&e[s+5]){t=3+((15&e[s+1])<<8|e[s+2])-4;for(var n=12+((15&e[s+10])<<8|e[s+11]);n=e.byteLength)return null;var r=null;return 192&(t=e[i+7])&&((r={}).pts=(14&e[i+9])<<27|(255&e[i+10])<<20|(254&e[i+11])<<12|(255&e[i+12])<<5|(254&e[i+13])>>>3,r.pts*=4,r.pts+=(6&e[i+13])>>>1,r.dts=r.pts,64&t&&(r.dts=(14&e[i+14])<<27|(255&e[i+15])<<20|(254&e[i+16])<<12|(255&e[i+17])<<5|(254&e[i+18])>>>3,r.dts*=4,r.dts+=(6&e[i+18])>>>1)),r},videoPacketContainsKeyFrame:function(e){for(var t=4+tN(e),i=e.subarray(t),r=0,s=0,n=!1;s3&&"slice_layer_without_partitioning_rbsp_idr"===tU(31&i[s+3])&&(n=!0),n}},tB.aac=e8;var tF=e_.ONE_SECOND_IN_TS,tq=function(e,t){for(var i,r=0,s=188;s=0;){if(71===e[o]&&(71===e[l]||l===e.byteLength)){if(r=e.subarray(o,l),"pes"===tB.ts.parseType(r,t.pid)&&(s=tB.ts.parsePesType(r,t.table),n=tB.ts.parsePayloadUnitStartIndicator(r),"audio"===s&&n&&(a=tB.ts.parsePesTime(r))&&(a.type="audio",i.audio.push(a),u=!0)),u)break;o-=188,l-=188;continue}o--,l--}},t$=function(e,t,i){for(var r,s,n,a,o,l,u,d=0,h=188,c=!1,p={data:[],size:0};h=0;){if(71===e[d]&&71===e[h]){if(r=e.subarray(d,h),"pes"===tB.ts.parseType(r,t.pid)&&(s=tB.ts.parsePesType(r,t.table),n=tB.ts.parsePayloadUnitStartIndicator(r),"video"===s&&n&&(a=tB.ts.parsePesTime(r))&&(a.type="video",i.video.push(a),c=!0)),c)break;d-=188,h-=188;continue}d--,h--}},tV=function(e,t){if(e.audio&&e.audio.length){var i=t;(void 0===i||isNaN(i))&&(i=e.audio[0].dts),e.audio.forEach(function(e){e.dts=eU(e.dts,i),e.pts=eU(e.pts,i),e.dtsTime=e.dts/tF,e.ptsTime=e.pts/tF})}if(e.video&&e.video.length){var r=t;if((void 0===r||isNaN(r))&&(r=e.video[0].dts),e.video.forEach(function(e){e.dts=eU(e.dts,r),e.pts=eU(e.pts,r),e.dtsTime=e.dts/tF,e.ptsTime=e.pts/tF}),e.firstKeyFrame){var s=e.firstKeyFrame;s.dts=eU(s.dts,r),s.pts=eU(s.pts,r),s.dtsTime=s.dts/tF,s.ptsTime=s.pts/tF}}},tH=function(e){for(var t,i=!1,r=0,s=null,n=null,a=0,o=0;e.length-o>=3;){switch(tB.aac.parseType(e,o)){case"timed-metadata":if(e.length-o<10||(a=tB.aac.parseId3TagSize(e,o))>e.length){i=!0;break}null===n&&(t=e.subarray(o,o+a),n=tB.aac.parseAacTimestamp(t)),o+=a;break;case"audio":if(e.length-o<7||(a=tB.aac.parseAdtsSize(e,o))>e.length){i=!0;break}null===s&&(t=e.subarray(o,o+a),s=tB.aac.parseSampleRate(t)),r++,o+=a;break;default:o++}if(i)return null}if(null===s||null===n)return null;var l=tF/s;return{audio:[{type:"audio",dts:n,pts:n},{type:"audio",dts:n+1024*r*l,pts:n+1024*r*l}]}},tz=function(e){var t={pid:null,table:null},i={};for(var r in tq(e,t),t.table)if(t.table.hasOwnProperty(r))switch(t.table[r]){case eM.H264_STREAM_TYPE:i.video=[],t$(e,t,i),0===i.video.length&&delete i.video;break;case eM.ADTS_STREAM_TYPE:i.audio=[],tj(e,t,i),0===i.audio.length&&delete i.audio}return i},tW=function(e,t){var i;return(i=tB.aac.isLikelyAacData(e)?tH(e):tz(e))&&(i.audio||i.video)?(tV(i,t),i):null};let tG=function(e,t){t.on("data",function(t){let i=t.initSegment;t.initSegment={data:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength};let r=t.data;t.data=r.buffer,e.postMessage({action:"data",segment:t,byteOffset:r.byteOffset,byteLength:r.byteLength},[t.data])}),t.on("done",function(t){e.postMessage({action:"done"})}),t.on("gopInfo",function(t){e.postMessage({action:"gopInfo",gopInfo:t})}),t.on("videoSegmentTimingInfo",function(t){let i={start:{decode:e_.videoTsToSeconds(t.start.dts),presentation:e_.videoTsToSeconds(t.start.pts)},end:{decode:e_.videoTsToSeconds(t.end.dts),presentation:e_.videoTsToSeconds(t.end.pts)},baseMediaDecodeTime:e_.videoTsToSeconds(t.baseMediaDecodeTime)};t.prependedContentDuration&&(i.prependedContentDuration=e_.videoTsToSeconds(t.prependedContentDuration)),e.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:i})}),t.on("audioSegmentTimingInfo",function(t){let i={start:{decode:e_.videoTsToSeconds(t.start.dts),presentation:e_.videoTsToSeconds(t.start.pts)},end:{decode:e_.videoTsToSeconds(t.end.dts),presentation:e_.videoTsToSeconds(t.end.pts)},baseMediaDecodeTime:e_.videoTsToSeconds(t.baseMediaDecodeTime)};t.prependedContentDuration&&(i.prependedContentDuration=e_.videoTsToSeconds(t.prependedContentDuration)),e.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:i})}),t.on("id3Frame",function(t){e.postMessage({action:"id3Frame",id3Frame:t})}),t.on("caption",function(t){e.postMessage({action:"caption",caption:t})}),t.on("trackinfo",function(t){e.postMessage({action:"trackinfo",trackInfo:t})}),t.on("audioTimingInfo",function(t){e.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:e_.videoTsToSeconds(t.start),end:e_.videoTsToSeconds(t.end)}})}),t.on("videoTimingInfo",function(t){e.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:e_.videoTsToSeconds(t.start),end:e_.videoTsToSeconds(t.end)}})}),t.on("log",function(t){e.postMessage({action:"log",log:t})})};class tK{constructor(e,t){this.options=t||{},this.self=e,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new td(this.options),tG(this.self,this.transmuxer)}pushMp4Captions(e){this.captionParser||(this.captionParser=new tk,this.captionParser.init());let t=new Uint8Array(e.data,e.byteOffset,e.byteLength),i=this.captionParser.parse(t,e.trackIds,e.timescales);this.self.postMessage({action:"mp4Captions",captions:i&&i.captions||[],logs:i&&i.logs||[],data:t.buffer},[t.buffer])}probeMp4StartTime({timescales:e,data:t}){let i=eu(e,t);this.self.postMessage({action:"probeMp4StartTime",startTime:i,data:t},[t.buffer])}probeMp4Tracks({data:e}){let t=tO(e);this.self.postMessage({action:"probeMp4Tracks",tracks:t,data:e},[e.buffer])}probeEmsgID3({data:e,offset:t}){let i=function(e,t=0){return tp(e,["emsg"]).map(e=>{var i=tA(new Uint8Array(e)),r=tL(i.message_data);return{cueTime:tP(i.presentation_time,i.timescale,i.presentation_time_delta,t),duration:tP(i.event_duration,i.timescale),frames:r}})}(e,t);this.self.postMessage({action:"probeEmsgID3",id3Frames:i,emsgData:e},[e.buffer])}probeTs({data:e,baseStartTime:t}){let i=tW(e,"number"!=typeof t||isNaN(t)?void 0:t*e_.ONE_SECOND_IN_TS),r=null;i&&((r={hasVideo:i.video&&2===i.video.length||!1,hasAudio:i.audio&&2===i.audio.length||!1}).hasVideo&&(r.videoStart=i.video[0].ptsTime),r.hasAudio&&(r.audioStart=i.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:r,data:e},[e.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(e){let t=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(t)}reset(){this.transmuxer.reset()}setTimestampOffset(e){let t=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(e_.secondsToVideoTs(t)))}setAudioAppendStart(e){this.transmuxer.setAudioAppendStart(Math.ceil(e_.secondsToVideoTs(e.appendStart)))}setRemux(e){this.transmuxer.setRemux(e.remux)}flush(e){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())}}self.onmessage=function(e){if("init"===e.data.action&&e.data.options){this.messageHandlers=new tK(self,e.data.options);return}this.messageHandlers||(this.messageHandlers=new tK(self)),e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data)}})));const l0=(e,t,i)=>{let{type:r,initSegment:s,captions:n,captionStreams:a,metadata:o,videoFrameDtsTime:l,videoFramePtsTime:u}=e.data.segment;t.buffer.push({captions:n,captionStreams:a,metadata:o});let d=e.data.segment.boxes||{data:e.data.segment.data},h={type:r,data:new Uint8Array(d.data,d.data.byteOffset,d.data.byteLength),initSegment:new Uint8Array(s.data,s.byteOffset,s.byteLength)};void 0!==l&&(h.videoFrameDtsTime=l),void 0!==u&&(h.videoFramePtsTime=u),i(h)},l1=({transmuxedData:e,callback:t})=>{e.buffer=[],t(e)},l2=(e,t)=>{t.gopInfo=e.data.gopInfo},l4=e=>{let{transmuxer:t,bytes:i,audioAppendStart:r,gopsToAlignWith:s,remux:n,onData:a,onTrackInfo:o,onAudioTimingInfo:l,onVideoTimingInfo:u,onVideoSegmentTimingInfo:d,onAudioSegmentTimingInfo:h,onId3:c,onCaptions:p,onDone:m,onEndedTimeline:g,onTransmuxerLog:f,isEndOfTimeline:y}=e,_={buffer:[]},b=y;if(t.onmessage=i=>{t.currentTransmux===e&&("data"===i.data.action&&l0(i,_,a),"trackinfo"===i.data.action&&o(i.data.trackInfo),"gopInfo"===i.data.action&&l2(i,_),"audioTimingInfo"===i.data.action&&l(i.data.audioTimingInfo),"videoTimingInfo"===i.data.action&&u(i.data.videoTimingInfo),"videoSegmentTimingInfo"===i.data.action&&d(i.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===i.data.action&&h(i.data.audioSegmentTimingInfo),"id3Frame"===i.data.action&&c([i.data.id3Frame],i.data.id3Frame.dispatchType),"caption"===i.data.action&&p(i.data.caption),"endedtimeline"===i.data.action&&(b=!1,g()),"log"===i.data.action&&f(i.data.log),"transmuxed"===i.data.type&&(b||(t.onmessage=null,l1({transmuxedData:_,callback:m}),l8(t))))},r&&t.postMessage({action:"setAudioAppendStart",appendStart:r}),Array.isArray(s)&&t.postMessage({action:"alignGopsWith",gopsToAlignWith:s}),void 0!==n&&t.postMessage({action:"setRemux",remux:n}),i.byteLength){let e=i instanceof ArrayBuffer?i:i.buffer,r=i instanceof ArrayBuffer?0:i.byteOffset;t.postMessage({action:"push",data:e,byteOffset:r,byteLength:i.byteLength},[e])}y&&t.postMessage({action:"endTimeline"}),t.postMessage({action:"flush"})},l8=e=>{e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():l4(e.currentTransmux))},l5=(e,t)=>{e.postMessage({action:t}),l8(e)},l3=(e,t)=>{if(!t.currentTransmux){t.currentTransmux=e,l5(t,e);return}t.transmuxQueue.push(l5.bind(null,t,e))},l6=e=>{if(!e.transmuxer.currentTransmux){e.transmuxer.currentTransmux=e,l4(e);return}e.transmuxer.transmuxQueue.push(e)};var l7={reset:e=>{l3("reset",e)},createTransmuxer:e=>{let t=new lZ;t.currentTransmux=null,t.transmuxQueue=[];let i=t.terminate;return t.terminate=()=>(t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)),t.postMessage({action:"init",options:e}),t}};const l9=function(e){let t=e.transmuxer,i=e.endAction||e.action,r=e.callback,s=I(F)({},e,{endAction:null,transmuxer:null,callback:null}),n=s=>{s.data.action===i&&(t.removeEventListener("message",n),s.data.data&&(s.data.data=new Uint8Array(s.data.data,e.byteOffset||0,e.byteLength||s.data.data.byteLength),e.data&&(e.data=s.data.data)),r(s.data))};if(t.addEventListener("message",n),e.data){let i=e.data instanceof ArrayBuffer;s.byteOffset=i?0:e.data.byteOffset,s.byteLength=e.data.byteLength;let r=[i?e.data:e.data.buffer];t.postMessage(s,r)}else t.postMessage(s)},ue={FAILURE:2,TIMEOUT:-101,ABORTED:-102},ut=e=>{e.forEach(e=>{e.abort()})},ui=e=>({bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}),ur=e=>{let t=e.target,i={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-t.requestTime||0};return i.bytesReceived=e.loaded,i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8e3),i},us=(e,t)=>t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:ue.TIMEOUT,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:ue.ABORTED,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:ue.FAILURE,xhr:t}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:ue.FAILURE,xhr:t}:null,un=(e,t,i)=>(r,s)=>{let n=s.response,a=us(r,s);if(a)return i(a,e);if(16!==n.byteLength)return i({status:s.status,message:"Invalid HLS key at URL: "+s.uri,code:ue.FAILURE,xhr:s},e);let o=new DataView(n),l=new Uint32Array([o.getUint32(0),o.getUint32(4),o.getUint32(8),o.getUint32(12)]);for(let e=0;e{let i=iQ(e.map.bytes);if("mp4"!==i){let r=e.map.resolvedUri||e.map.uri,s=i||"unknown";return t({internal:!0,message:`Found unsupported ${s} container for initialization segment at URL: ${r}`,code:ue.FAILURE,metadata:{errorType:og.Error.UnsupportedMediaInitialization,mediaType:s}})}l9({action:"probeMp4Tracks",data:e.map.bytes,transmuxer:e.transmuxer,callback:({tracks:i,data:r})=>(e.map.bytes=r,i.forEach(function(t){e.map.tracks=e.map.tracks||{},!e.map.tracks[t.type]&&(e.map.tracks[t.type]=t,"number"==typeof t.id&&t.timescale&&(e.map.timescales=e.map.timescales||{},e.map.timescales[t.id]=t.timescale))}),t(null))})},uo=({segment:e,finishProcessingFn:t})=>(i,r)=>{let s=us(i,r);if(s)return t(s,e);let n=new Uint8Array(r.response);if(e.map.key)return e.map.encryptedBytes=n,t(null,e);e.map.bytes=n,ua(e,function(i){if(i)return i.xhr=r,i.status=r.status,t(i,e);t(null,e)})},ul=({segment:e,finishProcessingFn:t,responseType:i})=>(r,s)=>{let n=us(r,s);if(n)return t(n,e);let a="arraybuffer"!==i&&s.responseText?lG(s.responseText.substring(e.lastReachedChar||0)):s.response;return e.stats=ui(s),e.key?e.encryptedBytes=new Uint8Array(a):e.bytes=new Uint8Array(a),t(null,e)},uu=({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})=>{let p=e.map&&e.map.tracks||{},m=!!(p.audio&&p.video),g=r.bind(null,e,"audio","start"),f=r.bind(null,e,"audio","end"),y=r.bind(null,e,"video","start"),_=r.bind(null,e,"video","end"),b=()=>l6({bytes:t,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,remux:m,onData:t=>{t.type="combined"===t.type?"video":t.type,d(e,t)},onTrackInfo:t=>{i&&(m&&(t.isMuxed=!0),i(e,t))},onAudioTimingInfo:e=>{g&&void 0!==e.start&&(g(e.start),g=null),f&&void 0!==e.end&&f(e.end)},onVideoTimingInfo:e=>{y&&void 0!==e.start&&(y(e.start),y=null),_&&void 0!==e.end&&_(e.end)},onVideoSegmentTimingInfo:e=>{s(e)},onAudioSegmentTimingInfo:e=>{n(e)},onId3:(t,i)=>{a(e,t,i)},onCaptions:t=>{o(e,[t])},isEndOfTimeline:l,onEndedTimeline:()=>{u()},onTransmuxerLog:c,onDone:t=>{h&&(t.type="combined"===t.type?"video":t.type,h(null,e,t))}});l9({action:"probeTs",transmuxer:e.transmuxer,data:t,baseStartTime:e.baseStartTime,callback:r=>{e.bytes=t=r.data;let s=r.result;s&&(i(e,{hasAudio:s.hasAudio,hasVideo:s.hasVideo,isMuxed:m}),i=null),b()}})},ud=({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})=>{let p=new Uint8Array(t);if(iM(p,["moof"]).length>0){e.isFmp4=!0;let{tracks:s}=e.map,n={isFmp4:!0,hasVideo:!!s.video,hasAudio:!!s.audio};s.audio&&s.audio.codec&&"enca"!==s.audio.codec&&(n.audioCodec=s.audio.codec),s.video&&s.video.codec&&"encv"!==s.video.codec&&(n.videoCodec=s.video.codec),s.video&&s.audio&&(n.isMuxed=!0),i(e,n);let l=(t,i)=>{d(e,{data:p,type:n.hasAudio&&!n.isMuxed?"audio":"video"}),i&&i.length&&a(e,i),t&&t.length&&o(e,t),h(null,e,{})};l9({action:"probeMp4StartTime",timescales:e.map.timescales,data:p,transmuxer:e.transmuxer,callback:({data:i,startTime:a})=>{t=i.buffer,e.bytes=p=i,n.hasAudio&&!n.isMuxed&&r(e,"audio","start",a),n.hasVideo&&r(e,"video","start",a),l9({action:"probeEmsgID3",data:p,transmuxer:e.transmuxer,offset:a,callback:({emsgData:i,id3Frames:r})=>{if(t=i.buffer,e.bytes=p=i,!s.video||!i.byteLength||!e.transmuxer){l(void 0,r);return}l9({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:e.transmuxer,data:p,timescales:e.map.timescales,trackIds:[s.video.id],callback:i=>{t=i.data.buffer,e.bytes=p=i.data,i.logs.forEach(function(e){c(oE(e,{stream:"mp4CaptionParser"}))}),l(i.captions,r)}})}})}});return}if(!e.transmuxer){h(null,e,{});return}if(void 0===e.container&&(e.container=iQ(p)),"ts"!==e.container&&"aac"!==e.container){i(e,{hasAudio:!1,hasVideo:!1}),h(null,e,{});return}uu({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})},uh=function({id:e,key:t,encryptedBytes:i,decryptionWorker:r},s){let n;let a=t=>{if(t.data.source===e){r.removeEventListener("message",a);let e=t.data.decrypted;s(new Uint8Array(e.bytes,e.byteOffset,e.byteLength))}};r.addEventListener("message",a),n=t.bytes.slice?t.bytes.slice():new Uint32Array(Array.prototype.slice.call(t.bytes)),r.postMessage(lT({source:e,encrypted:i,key:n,iv:t.iv}),[i.buffer,n.buffer])},uc=({decryptionWorker:e,segment:t,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})=>{uh({id:t.requestId,key:t.key,encryptedBytes:t.encryptedBytes,decryptionWorker:e},e=>{t.bytes=e,ud({segment:t,bytes:t.bytes,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})})},up=({activeXhrs:e,decryptionWorker:t,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})=>{let p=0,m=!1;return(g,f)=>{if(!m){if(g)return m=!0,ut(e),h(g,f);if((p+=1)===e.length){let p=function(){if(f.encryptedBytes)return uc({decryptionWorker:t,segment:f,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c});ud({segment:f,bytes:f.bytes,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})};if(f.endOfAllRequests=Date.now(),f.map&&f.map.encryptedBytes&&!f.map.bytes)return uh({decryptionWorker:t,id:f.requestId+"-init",encryptedBytes:f.map.encryptedBytes,key:f.map.key},t=>{f.map.bytes=t,ua(f,t=>{if(t)return ut(e),h(t,f);p()})});p()}}}},um=({loadendState:e,abortFn:t})=>i=>{i.target.aborted&&t&&!e.calledAbortFn&&(t(),e.calledAbortFn=!0)},ug=({segment:e,progressFn:t,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d})=>i=>{if(!i.target.aborted)return e.stats=oE(e.stats,ur(i)),!e.stats.firstBytesReceivedAt&&e.stats.bytesReceived&&(e.stats.firstBytesReceivedAt=Date.now()),t(i,e)},uf=({xhr:e,xhrOptions:t,decryptionWorker:i,segment:r,abortFn:s,progressFn:n,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:u,id3Fn:d,captionsFn:h,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f})=>{let y=[],_=up({activeXhrs:y,decryptionWorker:i,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:u,id3Fn:d,captionsFn:h,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f});if(r.key&&!r.key.bytes){let i=[r.key];r.map&&!r.map.bytes&&r.map.key&&r.map.key.resolvedUri===r.key.resolvedUri&&i.push(r.map.key);let s=e(oE(t,{uri:r.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),un(r,i,_));y.push(s)}if(r.map&&!r.map.bytes){if(r.map.key&&(!r.key||r.key.resolvedUri!==r.map.key.resolvedUri)){let i=e(oE(t,{uri:r.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),un(r,[r.map.key],_));y.push(i)}let i=e(oE(t,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:l_(r.map),requestType:"segment-media-initialization"}),uo({segment:r,finishProcessingFn:_}));y.push(i)}let b=oE(t,{uri:r.part&&r.part.resolvedUri||r.resolvedUri,responseType:"arraybuffer",headers:l_(r),requestType:"segment"}),v=ul({segment:r,finishProcessingFn:_,responseType:b.responseType}),T=e(b,v);T.addEventListener("progress",ug({segment:r,progressFn:n,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:u,id3Fn:d,captionsFn:h,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m})),y.push(T);let S={};return y.forEach(e=>{e.addEventListener("loadend",um({loadendState:S,abortFn:s}))}),()=>ut(y)},uy=oS("CodecUtils"),u_=function(e){let t=e.attributes||{};if(t.CODECS)return e4(t.CODECS)},ub=(e,t)=>{let i=t.attributes||{};return e&&e.mediaGroups&&e.mediaGroups.AUDIO&&i.AUDIO&&e.mediaGroups.AUDIO[i.AUDIO]},uv=(e,t)=>{if(!ub(e,t))return!0;let i=t.attributes||{},r=e.mediaGroups.AUDIO[i.AUDIO];for(let e in r)if(!r[e].uri&&!r[e].playlists)return!0;return!1},uT=function(e){let t={};return e.forEach(({mediaType:e,type:i,details:r})=>{t[e]=t[e]||[],t[e].push(e2(`${i}${r}`))}),Object.keys(t).forEach(function(e){if(t[e].length>1){uy(`multiple ${e} codecs found as attributes: ${t[e].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),t[e]=null;return}t[e]=t[e][0]}),t},uS=function(e){let t=0;return e.audio&&t++,e.video&&t++,t},uE=function(e,t){let i=t.attributes||{},r=uT(u_(t)||[]);if(ub(e,t)&&!r.audio&&!uv(e,t)){let t=uT(e8(e,i.AUDIO)||[]);t.audio&&(r.audio=t.audio)}return r},uw=oS("PlaylistSelector"),uk=function(e){if(!e||!e.playlist)return;let t=e.playlist;return JSON.stringify({id:t.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:t.attributes&&t.attributes.CODECS||""})},uC=function(e,t){if(!e)return"";let i=I(R).getComputedStyle(e);return i?i[t]:""},uD=function(e,t){let i=e.slice();e.sort(function(e,r){let s=t(e,r);return 0===s?i.indexOf(e)-i.indexOf(r):s})},uI=function(e,t){let i,r;return e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||I(R).Number.MAX_VALUE,t.attributes.BANDWIDTH&&(r=t.attributes.BANDWIDTH),i-(r=r||I(R).Number.MAX_VALUE)};let ux=function(e,t,i,r,s,n){let a,o,l,u;if(!e)return;let d={bandwidth:t,width:i,height:r,limitRenditionByPlayerDimensions:s},h=e.playlists;o2.isAudioOnly(e)&&(h=n.getAudioTrackPlaylists_(),d.audioOnly=!0);let c=h.map(e=>{let t=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height;return{bandwidth:e.attributes&&e.attributes.BANDWIDTH||I(R).Number.MAX_VALUE,width:t,height:i,playlist:e}});uD(c,(e,t)=>e.bandwidth-t.bandwidth);let p=(c=c.filter(e=>!o2.isIncompatible(e.playlist))).filter(e=>o2.isEnabled(e.playlist));p.length||(p=c.filter(e=>!o2.isDisabled(e.playlist)));let m=p.filter(e=>e.bandwidth*lW.BANDWIDTH_VARIANCEe.bandwidth===g.bandwidth)[0];if(!1===s){let e=f||p[0]||c[0];if(e&&e.playlist){let t="sortedPlaylistReps";return f&&(t="bandwidthBestRep"),p[0]&&(t="enabledPlaylistReps"),uw(`choosing ${uk(e)} using ${t} with options`,d),e.playlist}return uw("could not choose a playlist with options",d),null}let y=m.filter(e=>e.width&&e.height);uD(y,(e,t)=>e.width-t.width);let _=y.filter(e=>e.width===i&&e.height===r);g=_[_.length-1];let b=_.filter(e=>e.bandwidth===g.bandwidth)[0];if(b||(g=(o=(a=y.filter(e=>e.width>i||e.height>r)).filter(e=>e.width===a[0].width&&e.height===a[0].height))[o.length-1],l=o.filter(e=>e.bandwidth===g.bandwidth)[0]),n.leastPixelDiffSelector){let e=y.map(e=>(e.pixelDiff=Math.abs(e.width-i)+Math.abs(e.height-r),e));uD(e,(e,t)=>e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff),u=e[0]}let v=u||l||b||f||p[0]||c[0];if(v&&v.playlist){let e="sortedPlaylistReps";return u?e="leastPixelDiffRep":l?e="resolutionPlusOneRep":b?e="resolutionBestRep":f?e="bandwidthBestRep":p[0]&&(e="enabledPlaylistReps"),uw(`choosing ${uk(v)} using ${e} with options`,d),v.playlist}return uw("could not choose a playlist with options",d),null};const uA=function(){let e=this.useDevicePixelRatio&&I(R).devicePixelRatio||1;return isNaN(this.customPixelRatio)||(e=this.customPixelRatio),ux(this.playlists.main,this.systemBandwidth,parseInt(uC(this.tech_.el(),"width"),10)*e,parseInt(uC(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.playlistController_)},uP=function(e){let{main:t,currentTime:i,bandwidth:r,duration:s,segmentDuration:n,timeUntilRebuffer:a,currentTimeline:o,syncController:l}=e,u=t.playlists.filter(e=>!o2.isIncompatible(e)),d=u.filter(o2.isEnabled);d.length||(d=u.filter(e=>!o2.isDisabled(e)));let h=d.filter(o2.hasAttribute.bind(null,"BANDWIDTH")).map(e=>{let t=l.getSyncPoint(e,s,o,i),u=o2.estimateSegmentRequestTime(n,r,e);return{playlist:e,rebufferingImpact:u*(t?1:2)-a}}),c=h.filter(e=>e.rebufferingImpact<=0);return(uD(c,(e,t)=>uI(t.playlist,e.playlist)),c.length)?c[0]:(uD(h,(e,t)=>e.rebufferingImpact-t.rebufferingImpact),h[0]||null)},uL=e=>{let t,i=0;return e.bytes&&(t=new Uint8Array(e.bytes),e.segments.forEach(e=>{t.set(e,i),i+=e.byteLength})),t};function uO(e){try{return new URL(e).pathname.split("/").slice(-2).join("/")}catch(e){return""}}const uR=function(e,t,i){if(!e[i]){t.trigger({type:"usage",name:"vhs-608"});let r=i;/^cc708_/.test(i)&&(r="SERVICE"+i.split("_")[1]);let s=t.textTracks().getTrackById(r);if(s)e[i]=s;else{let s=t.options_.vhs&&t.options_.vhs.captionServices||{},n=i,a=i,o=!1,l=s[r];l&&(n=l.label,a=l.language,o=l.default),e[i]=t.addRemoteTextTrack({kind:"captions",id:r,default:o,label:n,language:a},!1).track}}},uM=function({inbandTextTracks:e,captionArray:t,timestampOffset:i}){if(!t)return;let r=I(R).WebKitDataCue||I(R).VTTCue;t.forEach(t=>{let s=t.stream;t.content?t.content.forEach(n=>{let a=new r(t.startTime+i,t.endTime+i,n.text);a.line=n.line,a.align="left",a.position=n.position,a.positionAlign="line-left",e[s].addCue(a)}):e[s].addCue(new r(t.startTime+i,t.endTime+i,t.text))})},uN=function(e){Object.defineProperties(e.frame,{id:{get:()=>(og.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key)},value:{get:()=>(og.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data)},privateData:{get:()=>(og.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data)}})},uU=({inbandTextTracks:e,metadataArray:t,timestampOffset:i,videoDuration:r})=>{if(!t)return;let s=I(R).WebKitDataCue||I(R).VTTCue,n=e.metadataTrack_;if(!n||(t.forEach(e=>{let t=e.cueTime+i;!("number"!=typeof t||I(R).isNaN(t))&&!(t<0)&&t<1/0&&e.frames&&e.frames.length&&e.frames.forEach(e=>{let i=new s(t,t,e.value||e.url||e.data||"");i.frame=e,i.value=e,uN(i),n.addCue(i)})}),!n.cues||!n.cues.length))return;let a=n.cues,o=[];for(let e=0;e{let i=e[t.startTime]||[];return i.push(t),e[t.startTime]=i,e},{}),u=Object.keys(l).sort((e,t)=>Number(e)-Number(t));u.forEach((e,t)=>{let i=l[e],s=isFinite(r)?r:e,n=Number(u[t+1])||s;i.forEach(e=>{e.endTime=n})})},uB={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},uF=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),uq=({inbandTextTracks:e,dateRanges:t})=>{let i=e.metadataTrack_;if(!i)return;let r=I(R).WebKitDataCue||I(R).VTTCue;t.forEach(e=>{for(let t of Object.keys(e)){if(uF.has(t))continue;let s=new r(e.startTime,e.endTime,"");s.id=e.id,s.type="com.apple.quicktime.HLS",s.value={key:uB[t],data:e[t]},("scte35Out"===t||"scte35In"===t)&&(s.value.data=new Uint8Array(s.value.data.match(/[\da-f]{2}/gi)).buffer),i.addCue(s)}e.processDateRange()})},uj=(e,t,i)=>{e.metadataTrack_||(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,og.browser.IS_ANY_SAFARI||(e.metadataTrack_.inBandMetadataTrackDispatchType=t))},u$=function(e,t,i){let r,s;if(i&&i.cues)for(r=i.cues.length;r--;)(s=i.cues[r]).startTime>=e&&s.endTime<=t&&i.removeCue(s)},uV=function(e){let t=e.cues;if(!t)return;let i={};for(let r=t.length-1;r>=0;r--){let s=t[r],n=`${s.startTime}-${s.endTime}-${s.text}`;i[n]?e.removeCue(s):i[n]=s}},uH=(e,t,i)=>{let r;if(null==t||!e.length)return[];let s=Math.ceil((t-i+3)*iJ.ONE_SECOND_IN_TS);for(r=0;rs);r++);return e.slice(r)},uz=(e,t,i)=>{if(!t.length)return e;if(i)return t.slice();let r=t[0].pts,s=0;for(;s=r);s++);return e.slice(0,s).concat(t)},uW=(e,t,i,r)=>{let s=Math.ceil((t-r)*iJ.ONE_SECOND_IN_TS),n=Math.ceil((i-r)*iJ.ONE_SECOND_IN_TS),a=e.slice(),o=e.length;for(;o--&&!(e[o].pts<=n););if(-1===o)return a;let l=o+1;for(;l--&&!(e[l].pts<=s););return l=Math.max(l,0),a.splice(l,o-l+1),a},uG=function(e,t){if(!e&&!t||!e&&t||e&&!t)return!1;if(e===t)return!0;let i=Object.keys(e).sort(),r=Object.keys(t).sort();if(i.length!==r.length)return!1;for(let s=0;si))return n}return 0===r.length?0:r[r.length-1]},uX=e=>"number"==typeof e&&isFinite(e),uY=1/60,uQ=(e,t,i)=>"main"===e&&t&&i?i.hasAudio||i.hasVideo?t.hasVideo&&!i.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!t.hasVideo&&i.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null:"Neither audio nor video found in segment.":null,uJ=(e,t,i)=>{let r=t-lW.BACK_BUFFER_LENGTH;return e.length&&(r=Math.max(r,e.start(0))),Math.min(t-i,r)},uZ=e=>{let{startOfSegment:t,duration:i,segment:r,part:s,playlist:{mediaSequence:n,id:a,segments:o=[]},mediaIndex:l,partIndex:u,timeline:d}=e,h=o.length-1,c="mediaIndex/partIndex increment";e.getMediaInfoForTime?c=`getMediaInfoForTime (${e.getMediaInfoForTime})`:e.isSyncRequest&&(c="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(c+=` with independent ${e.independent}`);let p="number"==typeof u,m=e.segment.uri?"segment":"pre-segment",g=p?oq({preloadSegment:r})-1:0;return`${m} [${n+l}/${n+h}]`+(p?` part [${u}/${g}]`:"")+` segment start/end [${r.start} => ${r.end}]`+(p?` part start/end [${s.start} => ${s.end}]`:"")+` startOfSegment [${t}]`+` duration [${i}]`+` timeline [${d}]`+` selected by [${c}]`+` playlist [${a}]`},u0=e=>`${e}TimingInfo`,u1=({segmentTimeline:e,currentTimeline:t,startOfSegment:i,buffered:r,overrideCheck:s})=>s||e!==t?e{if(t===i)return!1;if("audio"===r){let t=e.lastTimelineChange({type:"main"});return!t||t.to!==i}if("main"===r&&s){let t=e.pendingTimelineChange({type:"audio"});return!t||t.to!==i}return!1},u4=e=>{let t=0;return["video","audio"].forEach(function(i){let r;let s=e[`${i}TimingInfo`];if(!s)return;let{start:n,end:a}=s;"bigint"==typeof n||"bigint"==typeof a?r=I(R).BigInt(a)-I(R).BigInt(n):"number"==typeof n&&"number"==typeof a&&(r=a-n),void 0!==r&&r>t&&(t=r)}),"bigint"==typeof t&&t!!e&&Math.round(e)>t+ok,u5=(e,t)=>{if("hls"!==t)return null;let i=u4({audioTimingInfo:e.audioTimingInfo,videoTimingInfo:e.videoTimingInfo});if(!i)return null;let r=e.playlist.targetDuration,s=u8({segmentDuration:i,maxDuration:2*r}),n=u8({segmentDuration:i,maxDuration:r}),a=`Segment with index ${e.mediaIndex} from playlist ${e.playlist.id} has a duration of ${i} when the reported duration is ${e.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 s||n?{severity:s?"warn":"info",message:a}:null};class u3 extends og.EventTarget{constructor(e,t={}){if(super(),!e)throw TypeError("Initialization settings are required");if("function"!=typeof e.currentTime)throw TypeError("No currentTime getter specified");if(!e.mediaSource)throw TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.shouldForceTimestampOffsetAfterResync_=!1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=!1,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{this.isEndOfStream_()||(this.ended_=!1)}),this.fetchAtBuffer_=!1,this.logger_=oS(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(e){e!==this.state_&&(this.logger_(`${this.state_} -> ${e}`),this.state_=e,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}),"main"===this.loaderType_&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}),"audio"===this.loaderType_&&this.timelineChangeController_.on("timelinechange",()=>{this.hasEnoughInfoToLoad_()&&this.processLoadQueue_(),this.hasEnoughInfoToAppend_()&&this.processCallQueue_()})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return l7.createTransmuxer({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&I(R).clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){if("WAITING"!==this.state){this.pendingSegment_&&(this.pendingSegment_=null);return}this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()}abort_(){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,I(R).clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)}error(e){return void 0!==e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&l7.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){let e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return ow();if("main"===this.loaderType_){let{hasAudio:t,hasVideo:i,isMuxed:r}=e;if(i&&t&&!this.audioDisabled_&&!r)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;let i=lS(e),r=this.initSegments_[i];return t&&!r&&e.bytes&&(this.initSegments_[i]=r={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),r||e}segmentKey(e,t=!1){if(!e)return null;let i=lE(e),r=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!r&&e.bytes&&(this.keyCache_[i]=r={resolvedUri:e.resolvedUri,bytes:e.bytes});let s={resolvedUri:(r||e).resolvedUri};return r&&(s.bytes=r.bytes),s}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),this.playlist_){if("INIT"===this.state&&this.couldBeginLoading_())return this.init_();this.couldBeginLoading_()&&("READY"===this.state||"INIT"===this.state)&&(this.state="READY")}}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,t={}){if(!e)return;let i=this.playlist_,r=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,"INIT"===this.state&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},"main"===this.loaderType_&&this.syncController_.setDateTimeMappingForStart(e));let s=null;if(i&&(i.id?s=i.id:i.uri&&(s=i.uri)),this.logger_(`playlist update [${s} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update:
currentTime: ${this.currentTime_()}
bufferedEnd: ${oM(this.buffered_())}
`,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri){null!==this.mediaIndex&&(e.endList||"number"!=typeof e.partTargetDuration?this.resyncLoader():this.resetLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate");return}let n=e.mediaSequence-i.mediaSequence;if(this.logger_(`live window shift [${n}]`),null!==this.mediaIndex){if(this.mediaIndex-=n,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{let e=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!e.parts||!e.parts.length||!e.parts[this.partIndex])){let e=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=e}}}r&&(r.mediaIndex-=n,r.mediaIndex<0?(r.mediaIndex=null,r.partIndex=null):(r.mediaIndex>=0&&(r.segment=e.segments[r.mediaIndex]),r.partIndex>=0&&r.segment.parts&&(r.part=r.segment.parts[r.partIndex]))),this.syncController_.saveExpiredSegmentInfo(i,e)}pause(){this.checkBufferTimeout_&&(I(R).clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return null===this.checkBufferTimeout_}resetEverything(e){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.mediaSequenceSync_&&this.mediaSequenceSync_.resetAppendedStatus(),this.resyncLoader()}resyncLoader(){this.transmuxer_&&l7.reset(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;let e=this.currentMediaInfo_&&this.currentMediaInfo_.isFmp4;"hls"!==this.sourceType_||e||(this.shouldForceTimestampOffsetAfterResync_=!0),this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,t,i=()=>{},r=!1){if(t===1/0&&(t=this.duration_()),t<=e){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}let s=1,n=()=>{0==--s&&i()};for(let i in(r||!this.audioDisabled_)&&(s++,this.sourceUpdater_.removeAudio(e,t,n)),(r||"main"===this.loaderType_)&&(this.gopBuffer_=uW(this.gopBuffer_,e,t,this.timeMapping_),s++,this.sourceUpdater_.removeVideo(e,t,n)),this.inbandTextTracks_)u$(e,t,this.inbandTextTracks_[i]);u$(e,t,this.segmentMetadataTrack_),n()}monitorBuffer_(){this.checkBufferTimeout_&&I(R).clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=I(R).setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&I(R).clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=I(R).setTimeout(this.monitorBufferTick_.bind(this),500)}fillBuffer_(){if(this.sourceUpdater_.updating())return;let e=this.chooseNextRequest_();e&&("number"==typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,i=this.partIndex){if(!t||!this.mediaSource_)return!1;let r="number"==typeof e&&t.segments[e],s=e+1===t.segments.length,n=!r||!r.parts||i+1===r.parts.length;return t.endList&&"open"===this.mediaSource_.readyState&&s&&n}chooseNextRequest_(){let e=this.buffered_(),t=oM(e)||0,i=oN(e,this.currentTime_()),r=!this.hasPlayed_()&&i>=1,s=i>=this.goalBufferLength_(),n=this.playlist_.segments;if(!n.length||r||s)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_(),this.loaderType_);let a={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:!this.syncPoint_};if(a.isSyncRequest)a.mediaIndex=uK(this.currentTimeline_,n,t),this.logger_(`choose next request. Can not find sync point. Fallback to media Index: ${a.mediaIndex}`);else if(null!==this.mediaIndex){let e=n[this.mediaIndex],i="number"==typeof this.partIndex?this.partIndex:-1;a.startOfSegment=e.end?e.end:t,e.parts&&e.parts[i+1]?(a.mediaIndex=this.mediaIndex,a.partIndex=i+1):a.mediaIndex=this.mediaIndex+1}else{let e,i,r;let s=this.fetchAtBuffer_?t:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch:
For TargetTime: ${s}.
CurrentTime: ${this.currentTime_()}
BufferedEnd: ${t}
Fetch At Buffer: ${this.fetchAtBuffer_}
`,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){let t=this.getSyncInfoFromMediaSequenceSync_(s);if(!t)return this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null;this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${t.start} --> ${t.end})`),e=t.segmentIndex,i=t.partIndex,r=t.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");let t=o2.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:s,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});e=t.segmentIndex,i=t.partIndex,r=t.startTime}a.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${s}`:`currentTime ${s}`,a.mediaIndex=e,a.startOfSegment=r,a.partIndex=i,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${a.mediaIndex} `)}let o=n[a.mediaIndex],l=o&&"number"==typeof a.partIndex&&o.parts&&o.parts[a.partIndex];if(!o||"number"==typeof a.partIndex&&!l)return null;"number"!=typeof a.partIndex&&o.parts&&(a.partIndex=0,l=o.parts[0]);let u=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!i&&l&&!u&&!l.independent){if(0===a.partIndex){let e=n[a.mediaIndex-1],t=e.parts&&e.parts.length&&e.parts[e.parts.length-1];t&&t.independent&&(a.mediaIndex-=1,a.partIndex=e.parts.length-1,a.independent="previous segment")}else o.parts[a.partIndex-1].independent&&(a.partIndex-=1,a.independent="previous part")}let d=this.mediaSource_&&"ended"===this.mediaSource_.readyState;return a.mediaIndex>=n.length-1&&d&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,a.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(a))}getSyncInfoFromMediaSequenceSync_(e){if(!this.mediaSequenceSync_)return null;let t=Math.max(e,this.mediaSequenceSync_.start);e!==t&&this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to ${t}`);let i=this.mediaSequenceSync_.getSyncInfoForTime(t);if(!i)return null;if(!i.isAppended)return i;let r=this.mediaSequenceSync_.getSyncInfoForTime(i.end);return r?(r.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),r):null}generateSegmentInfo_(e){let{independent:t,playlist:i,mediaIndex:r,startOfSegment:s,isSyncRequest:n,partIndex:a,forceTimestampOffset:o,getMediaInfoForTime:l}=e,u=i.segments[r],d="number"==typeof a&&u.parts[a],h={requestId:"segment-loader-"+Math.random(),uri:d&&d.resolvedUri||u.resolvedUri,mediaIndex:r,partIndex:d?a:null,isSyncRequest:n,startOfSegment:s,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:u.timeline,duration:d&&d.duration||u.duration,segment:u,part:d,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:l,independent:t},c=void 0!==o?o:this.isPendingTimestampOffset_;h.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:u.timeline,currentTimeline:this.currentTimeline_,startOfSegment:s,buffered:this.buffered_(),overrideCheck:c});let p=oM(this.sourceUpdater_.audioBuffered());return"number"==typeof p&&(h.audioAppendStart=p-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(h.gopsToAlignWith=uH(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),h}timestampOffsetForSegment_(e){return u1(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH||Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return;let t=this.currentTime_(),i=e.bandwidth,r=this.pendingSegment_.duration,s=o2.estimateSegmentRequestTime(r,i,this.playlist_,e.bytesReceived),n=function(e,t,i=1){return((e.length?e.end(e.length-1):0)-t)/i}(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(s<=n)return;let a=uP({main:this.vhs_.playlists.main,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:r,timeUntilRebuffer:n,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!a)return;let o=s-n-a.rebufferingImpact,l=.5;n<=ok&&(l=1),a.playlist&&a.playlist.uri!==this.playlist_.uri&&!(o{r[e.stream]=r[e.stream]||{startTime:1/0,captions:[],endTime:0};let t=r[e.stream];t.startTime=Math.min(t.startTime,e.startTime+i),t.endTime=Math.max(t.endTime,e.endTime+i),t.captions.push(e)}),Object.keys(r).forEach(e=>{let{startTime:t,endTime:s,captions:n}=r[e],a=this.inbandTextTracks_;this.logger_(`adding cues from ${t} -> ${s} for ${e}`),uR(a,this.vhs_.tech_,e),u$(t,s,a[e]),uM({captionArray:n,inbandTextTracks:a,timestampOffset:i})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,i){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)){if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i));return}this.addMetadataToTextTrack(i,t,this.duration_())}}processMetadataQueue_(){this.metadataQueue_.id3.forEach(e=>e()),this.metadataQueue_.caption.forEach(e=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){let e=this.callQueue_;this.callQueue_=[],e.forEach(e=>e())}processLoadQueue_(){let e=this.loadQueue_;this.loadQueue_=[],e.forEach(e=>e())}hasEnoughInfoToLoad_(){if("audio"!==this.loaderType_)return!0;let e=this.pendingSegment_;return!!e&&(!this.getCurrentMediaInfo_()||!u2({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){if(!this.sourceUpdater_.ready()||this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;let e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;let{hasAudio:i,hasVideo:r,isMuxed:s}=t;return!(r&&!e.videoTimingInfo||i&&!this.audioDisabled_&&!s&&!e.audioTimingInfo||u2({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.callQueue_.length||!this.hasEnoughInfoToAppend_()){this.callQueue_.push(this.handleData_.bind(this,e,t));return}let i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),"closed"!==this.mediaSource_.readyState){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),i.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),i.isFmp4=e.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[u0(t.type)].start;else{let e;let t=this.getCurrentMediaInfo_(),r="main"===this.loaderType_&&t&&t.hasVideo;r&&(e=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:r,firstVideoFrameTimeForData:e,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,t.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:"main"===this.loaderType_});let e=this.chooseNextRequest_();if(e.mediaIndex!==i.mediaIndex||e.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)}}updateAppendInitSegmentStatus(e,t){"main"!==this.loaderType_||"number"!=typeof e.timestampOffset||e.changedTimestampOffset||(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:i,playlist:r}){if(i){let e=lS(i);if(this.activeInitSegmentId_===e)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=e}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=r,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i},r){let s=this.sourceUpdater_.audioBuffered(),n=this.sourceUpdater_.videoBuffered();s.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+oO(s).join(", ")),n.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+oO(n).join(", "));let a=s.length?s.start(0):0,o=s.length?s.end(s.length-1):0,l=n.length?n.start(0):0,u=n.length?n.end(n.length-1):0;if(o-a<=1&&u-l<=1){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${i.byteLength}, audio buffer: ${oO(s).join(", ")}, video buffer: ${oO(n).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0,metadata:{errorType:og.Error.SegmentExceedsSourceBufferQuota}}),this.trigger("error");return}this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:t,bytes:i}));let d=this.currentTime_()-1;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${d}`),this.remove(0,d,()=>{this.logger_("On QUOTA_EXCEEDED_ERR, retrying append in 1s"),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=I(R).setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:i},r){if(r){if(22===r.code){this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",r),this.error({message:`${t} append of ${i.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:og.Error.SegmentAppendError}}),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:r,bytes:s}){if(!s){let e=[r],t=r.byteLength;i&&(e.unshift(i),t+=i.byteLength),s=uL({bytes:t,segments:e})}this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:s},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:s}))}handleSegmentTimingInfo_(e,t,i){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;let r=this.pendingSegment_.segment,s=`${e}TimingInfo`;r[s]||(r[s]={}),r[s].transmuxerPrependedSeconds=i.prependedContentDuration||0,r[s].transmuxedPresentationStart=i.start.presentation,r[s].transmuxedDecodeStart=i.start.decode,r[s].transmuxedPresentationEnd=i.end.presentation,r[s].transmuxedDecodeEnd=i.end.decode,r[s].baseMediaDecodeTime=i.baseMediaDecodeTime}appendData_(e,t){let{type:i,data:r}=t;if(!r||!r.byteLength||"audio"===i&&this.audioDisabled_)return;let s=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:s,data:r})}loadSegment_(e){if(this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),"number"==typeof e.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),!this.hasEnoughInfoToLoad_()){this.loadQueue_.push(()=>{let t=I(F)({},e,{forceTimestampOffset:!0});I(F)(e,this.generateSegmentInfo_(t)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)});return}this.updateTransmuxerAndRequestSegment_(e)}updateTransmuxerAndRequestSegment_(e){this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));let t=this.createSimplifiedSegmentObj_(e),i=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),r=null!==this.mediaIndex,s=e.timeline!==this.currentTimeline_&&e.timeline>0;this.logger_(`Requesting
${uO(e.uri)}
${uZ(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=uf({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:i||r&&s,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:t,level:i,stream:r})=>{this.logger_(`${uZ(e)} logged from transmuxer stream ${r} as a ${i}: ${t}`)}})}trimBackBuffer_(e){let t=uJ(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){let t=e.segment,i=e.part,r={resolvedUri:i?i.resolvedUri:t.resolvedUri,byterange:i?i.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part},s=e.playlist.segments[e.mediaIndex-1];if(s&&s.timeline===t.timeline&&(s.videoTimingInfo?r.baseStartTime=s.videoTimingInfo.transmuxedDecodeEnd:s.audioTimingInfo&&(r.baseStartTime=s.audioTimingInfo.transmuxedDecodeEnd)),t.key){let i=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);r.key=this.segmentKey(t.key),r.key.iv=i}return t.map&&(r.map=this.initSegmentForMap(t.map)),r}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){if(this.pendingSegment_.byteLength=t.bytesReceived,e3*e.playlist.targetDuration,n=r&&r.end&&this.currentTime_()-r.end>3*e.playlist.partTargetDuration;if(s||n){this.logger_(`bad ${s?"segment":"part"} ${uZ(e)}`),this.resetEverything();return}null!==this.mediaIndex&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}recordThroughput_(e){if(e.duratione.toUpperCase())},u9=["video","audio"],de=(e,t)=>{let i=t[`${e}Buffer`];return i&&i.updating||t.queuePending[e]},dt=(e,t)=>{for(let i=0;i{if(0===t.queue.length)return;let i=0,r=t.queue[i];if("mediaSource"===r.type){t.updating()||"closed"===t.mediaSource.readyState||(t.queue.shift(),r.action(t),r.doneFn&&r.doneFn(),di("audio",t),di("video",t));return}if("mediaSource"!==e&&!(!t.ready()||"closed"===t.mediaSource.readyState||de(e,t))){if(r.type!==e){if(null===(i=dt(e,t.queue)))return;r=t.queue[i]}if(t.queue.splice(i,1),t.queuePending[e]=r,r.action(e,t),!r.doneFn){t.queuePending[e]=null,di(e,t);return}}},dr=(e,t)=>{let i=t[`${e}Buffer`],r=u7(e);i&&(i.removeEventListener("updateend",t[`on${r}UpdateEnd_`]),i.removeEventListener("error",t[`on${r}Error_`]),t.codecs[e]=null,t[`${e}Buffer`]=null)},ds=(e,t)=>e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t),dn={appendBuffer:(e,t,i)=>(r,s)=>{let n=s[`${r}Buffer`];if(ds(s.mediaSource,n)){s.logger_(`Appending segment ${t.mediaIndex}'s ${e.length} bytes to ${r}Buffer`);try{n.appendBuffer(e)}catch(e){s.logger_(`Error with code ${e.code} `+(22===e.code?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${t.mediaIndex} to ${r}Buffer`),s.queuePending[r]=null,i(e)}}},remove:(e,t)=>(i,r)=>{let s=r[`${i}Buffer`];if(ds(r.mediaSource,s)){r.logger_(`Removing ${e} to ${t} from ${i}Buffer`);try{s.remove(e,t)}catch(s){r.logger_(`Remove ${e} to ${t} from ${i}Buffer failed`)}}},timestampOffset:e=>(t,i)=>{let r=i[`${t}Buffer`];ds(i.mediaSource,r)&&(i.logger_(`Setting ${t}timestampOffset to ${e}`),r.timestampOffset=e)},callback:e=>(t,i)=>{e()},endOfStream:e=>t=>{if("open"===t.mediaSource.readyState){t.logger_(`Calling mediaSource endOfStream(${e||""})`);try{t.mediaSource.endOfStream(e)}catch(e){og.log.warn("Failed to call media source endOfStream",e)}}},duration:e=>t=>{t.logger_(`Setting mediaSource duration to ${e}`);try{t.mediaSource.duration=e}catch(e){og.log.warn("Failed to set media source duration",e)}},abort:()=>(e,t)=>{if("open"!==t.mediaSource.readyState)return;let i=t[`${e}Buffer`];if(ds(t.mediaSource,i)){t.logger_(`calling abort on ${e}Buffer`);try{i.abort()}catch(t){og.log.warn(`Failed to abort on ${e}Buffer`,t)}}},addSourceBuffer:(e,t)=>i=>{let r=u7(e),s=e3(t);i.logger_(`Adding ${e}Buffer with codec ${t} to mediaSource`);let n=i.mediaSource.addSourceBuffer(s);n.addEventListener("updateend",i[`on${r}UpdateEnd_`]),n.addEventListener("error",i[`on${r}Error_`]),i.codecs[e]=t,i[`${e}Buffer`]=n},removeSourceBuffer:e=>t=>{let i=t[`${e}Buffer`];if(dr(e,t),ds(t.mediaSource,i)){t.logger_(`Removing ${e}Buffer with codec ${t.codecs[e]} from mediaSource`);try{t.mediaSource.removeSourceBuffer(i)}catch(t){og.log.warn(`Failed to removeSourceBuffer ${e}Buffer`,t)}}},changeType:e=>(t,i)=>{let r=i[`${t}Buffer`],s=e3(e);if(!ds(i.mediaSource,r))return;let n=e.substring(0,e.indexOf(".")),a=i.codecs[t];if(a.substring(0,a.indexOf("."))!==n){i.logger_(`changing ${t}Buffer codec from ${i.codecs[t]} to ${e}`);try{r.changeType(s),i.codecs[t]=e}catch(e){og.log.warn(`Failed to changeType on ${t}Buffer`,e)}}}},da=({type:e,sourceUpdater:t,action:i,doneFn:r,name:s})=>{t.queue.push({type:e,action:i,doneFn:r,name:s}),di(e,t)},dl=(e,t)=>i=>{let r=function(e){if(0===e.length)return"Buffered Ranges are empty";let t="Buffered Ranges: \n";for(let i=0;i ${s}. Duration (${s-r})
`}return t}(t[`${e}Buffered`]());if(t.logger_(`received "updateend" event for ${e} Source Buffer: `,r),t.queuePending[e]){let i=t.queuePending[e].doneFn;t.queuePending[e]=null,i&&i(t[`${e}Error_`])}di(e,t)};class du extends og.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>di("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=oS("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=dl("video",this),this.onAudioUpdateEnd_=dl("audio",this),this.onVideoError_=e=>{this.videoError_=e},this.onAudioError_=e=>{this.audioError_=e},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){da({type:"mediaSource",sourceUpdater:this,action:dn.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){da({type:e,sourceUpdater:this,action:dn.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){og.log.error("removeSourceBuffer is not supported!");return}da({type:"mediaSource",sourceUpdater:this,action:dn.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!og.browser.IS_FIREFOX&&I(R).MediaSource&&I(R).MediaSource.prototype&&"function"==typeof I(R).MediaSource.prototype.removeSourceBuffer}static canChangeType(){return I(R).SourceBuffer&&I(R).SourceBuffer.prototype&&"function"==typeof I(R).SourceBuffer.prototype.changeType}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){og.log.error("changeType is not supported!");return}da({type:e,sourceUpdater:this,action:dn.changeType(t),name:"changeType"})}addOrChangeSourceBuffers(e){if(!e||"object"!=typeof e||0===Object.keys(e).length)throw Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach(t=>{let i=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,i);this.canChangeType()&&this.changeType(t,i)})}appendBuffer(e,t){let{segmentInfo:i,type:r,bytes:s}=e;if(this.processedAppend_=!0,"audio"===r&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${s.length} until video append`);return}if(da({type:r,sourceUpdater:this,action:dn.appendBuffer(s,i||{mediaIndex:-1},t),doneFn:t,name:"appendBuffer"}),"video"===r){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;let e=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${e.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,e.forEach(e=>{this.appendBuffer.apply(this,e)})}}audioBuffered(){return ds(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:ow()}videoBuffered(){return ds(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:ow()}buffered(){let e=ds(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=ds(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():oP(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=u6){da({type:"mediaSource",sourceUpdater:this,action:dn.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=u6){"string"!=typeof e&&(e=void 0),da({type:"mediaSource",sourceUpdater:this,action:dn.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,i=u6){if(!this.audioBuffered().length||0===this.audioBuffered().end(0)){i();return}da({type:"audio",sourceUpdater:this,action:dn.remove(e,t),doneFn:i,name:"remove"})}removeVideo(e,t,i=u6){if(!this.videoBuffered().length||0===this.videoBuffered().end(0)){i();return}da({type:"video",sourceUpdater:this,action:dn.remove(e,t),doneFn:i,name:"remove"})}updating(){return!!(de("audio",this)||de("video",this))}audioTimestampOffset(e){return void 0!==e&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(da({type:"audio",sourceUpdater:this,action:dn.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return void 0!==e&&this.videoBuffer&&this.videoTimestampOffset!==e&&(da({type:"video",sourceUpdater:this,action:dn.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&da({type:"audio",sourceUpdater:this,action:dn.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&da({type:"video",sourceUpdater:this,action:dn.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),u9.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>dr(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const dd=e=>decodeURIComponent(escape(String.fromCharCode.apply(null,e))),dh=e=>Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,"0")).join(""),dc=new Uint8Array("\n\n".split("").map(e=>e.charCodeAt(0)));class dp extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class dm extends u3{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}createTransmuxer_(){return null}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return ow();let e=this.subtitlesTrack_.cues;return ow([[e[0].startTime,e[e.length-1].startTime]])}initSegmentForMap(e,t=!1){if(!e)return null;let i=lS(e),r=this.initSegments_[i];if(t&&!r&&e.bytes){let t=new Uint8Array(dc.byteLength+e.bytes.byteLength);t.set(e.bytes),t.set(dc,e.bytes.byteLength),this.initSegments_[i]=r={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:t}}return r||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return void 0===e||(this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_()),this.subtitlesTrack_}remove(e,t){u$(e,t,this.subtitlesTrack_)}fillBuffer_(){let e=this.chooseNextRequest_();if(e){if(null===this.syncController_.timestampOffsetForTimeline(e.timeline)){this.syncController_.one("timestampoffset",()=>{this.state="READY",this.paused()||this.monitorBuffer_()}),this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(e)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,i){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){e.code===ue.TIMEOUT&&this.handleTimeout_(),e.code===ue.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}let r=this.pendingSegment_;this.saveBandwidthRelatedStats_(r.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");let s=r.segment;if(s.map&&(s.map.bytes=t.map.bytes),r.bytes=t.bytes,"function"!=typeof I(R).WebVTT&&"function"==typeof this.loadVttJs){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,t,i),()=>this.stopForError({message:"Error loading vtt.js",metadata:{errorType:og.Error.VttLoadError}}));return}s.requested=!0;try{this.parseVTTCues_(r)}catch(e){this.stopForError({message:e.message,metadata:{errorType:og.Error.VttCueParsingError}});return}if(this.updateTimeMapping_(r,this.syncController_.timelines[r.timeline],this.playlist_),r.cues.length?r.timingInfo={start:r.cues[0].startTime,end:r.cues[r.cues.length-1].endTime}:r.timingInfo={start:r.startOfSegment,end:r.startOfSegment+r.duration},r.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}r.byteLength=r.bytes.byteLength,this.mediaSecondsLoaded+=s.duration,r.cues.forEach(e=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new(I(R)).VTTCue(e.startTime,e.endTime,e.text):e)}),uV(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(){}updateTimingInfoEnd_(){}parseVTTCues_(e){let t;let i=!1;if("function"!=typeof I(R).WebVTT)throw new dp;"function"==typeof I(R).TextDecoder?t=new(I(R)).TextDecoder("utf8"):(t=I(R).WebVTT.StringDecoder(),i=!0);let r=new(I(R)).WebVTT.Parser(I(R),I(R).vttjs,t);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},r.oncue=e.cues.push.bind(e.cues),r.ontimestampmap=t=>{e.timestampmap=t},r.onparsingerror=e=>{og.log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map){let t=e.segment.map.bytes;i&&(t=dd(t)),r.parse(t)}let s=e.bytes;i&&(s=dd(s)),r.parse(s),r.flush()}updateTimeMapping_(e,t,i){let r=e.segment;if(!t)return;if(!e.cues.length){r.empty=!0;return}let{MPEGTS:s,LOCAL:n}=e.timestampmap,a=s/iJ.ONE_SECOND_IN_TS-n+t.mapping;if(e.cues.forEach(e=>{let i=e.endTime-e.startTime,r=0===s?e.startTime+a:this.handleRollover_(e.startTime+a,t.time);e.startTime=Math.max(r,0),e.endTime=Math.max(r+i,0)}),!i.syncInfo){let t=e.cues[0].startTime,s=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(t,s-r.duration)}}}handleRollover_(e,t){let i;if(null===t)return e;let r=e*iJ.ONE_SECOND_IN_TS,s=t*iJ.ONE_SECOND_IN_TS;for(i=s4294967296;)r+=i;return r/iJ.ONE_SECOND_IN_TS}}const dg=function(e,t){let i=e.cues;for(let e=0;e=r.adStartTime&&t<=r.adEndTime)return r}return null},df=function(e,t,i=0){let r;if(!e.segments)return;let s=i;for(let i=0;i=this.start&&e0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach(e=>e.resetAppendedStatus())}}class db{constructor(){this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0}get start(){return this.start_}get end(){return this.end_}get diagnostics(){return this.diagnostics_}get isReliable(){return this.isReliable_}resetAppendedStatus(){this.storage_.forEach(e=>e.resetAppendStatus())}update(e,t){let{mediaSequence:i,segments:r}=e;if(this.isReliable_=this.isReliablePlaylist_(i,r),this.isReliable_)return this.updateStorage_(r,i,this.calculateBaseTime_(i,t))}getSyncInfoForTime(e){for(let{segmentSyncInfo:t,partsSyncInfo:i}of this.storage_.values())if(i.length){for(let t of i)if(t.isInRange(e))return t}else if(t.isInRange(e))return t;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,t,i){let r=new Map,s="\n",n=i,a=t;this.start_=n,e.forEach((e,t)=>{let i=this.storage_.get(a),o=n,l=o+e.duration,u=!!(i&&i.segmentSyncInfo&&i.segmentSyncInfo.isAppended),d=new dy({start:o,end:l,appended:u,segmentIndex:t});e.syncInfo=d;let h=n,c=(e.parts||[]).map((e,r)=>{let n=h,o=h+e.duration,l=!!(i&&i.partsSyncInfo&&i.partsSyncInfo[r]&&i.partsSyncInfo[r].isAppended),u=new dy({start:n,end:o,appended:l,segmentIndex:t,partIndex:r});return h=o,s+=`Media Sequence: ${a}.${r} | Range: ${n} --> ${o} | Appended: ${l}
`,e.syncInfo=u,u});r.set(a,new d_(d,c)),s+=`${uO(e.resolvedUri)} | Media Sequence: ${a} | Range: ${o} --> ${l} | Appended: ${u}
`,a++,n=l}),this.end_=n,this.storage_=r,this.diagnostics_=s}calculateBaseTime_(e,t){return this.storage_.size?this.storage_.has(e)?this.storage_.get(e).segmentSyncInfo.start:t:0}isReliablePlaylist_(e,t){return null!=e&&Array.isArray(t)&&t.length}}class dv extends db{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t){if(!this.storage_.size){let t=this.parent_.getSyncInfoForMediaSequence(e);return t?t.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,t)}}const dT=[{name:"VOD",run:(e,t,i,r,s)=>i!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(e,t,i,r,s,n)=>{let a=e.getMediaSequenceSync(n);if(!a||!a.isReliable)return null;let o=a.getSyncInfoForTime(s);return o?{time:o.start,partIndex:o.partIndex,segmentIndex:o.segmentIndex}:null}},{name:"ProgramDateTime",run:(e,t,i,r,s)=>{if(!Object.keys(e.timelineToDatetimeMappings).length)return null;let n=null,a=null,o=oB(t);s=s||0;for(let i=0;i{let n=null,a=null;s=s||0;let o=oB(t);for(let e=0;e=e)&&(a=e,n={time:d,segmentIndex:l.segmentIndex,partIndex:l.partIndex})}}return n}},{name:"Discontinuity",run:(e,t,i,r,s)=>{let n=null;if(s=s||0,t.discontinuityStarts&&t.discontinuityStarts.length){let i=null;for(let r=0;r=e)&&(i=e,n={time:l.time,segmentIndex:a,partIndex:null})}}}return n}},{name:"Playlist",run:(e,t,i,r,s)=>t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}];class dS extends og.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};let t=new db,i=new dv(t),r=new dv(t);this.mediaSequenceStorage_={main:t,audio:i,vtt:r},this.logger_=oS("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,i,r,s){if(t!==1/0)return dT.find(({name:e})=>"VOD"===e).run(this,e,t);let n=this.runStrategies_(e,t,i,r,s);if(!n.length)return null;for(let t of n){let{syncPoint:i,strategy:s}=t,{segmentIndex:n,time:a}=i;if(n<0)continue;let o=a+e.segments[n].duration;if(this.logger_(`Strategy: ${s}. Current time: ${r}. selected segment: ${n}. Time: [${a} -> ${o}]}`),r>=a&&r0&&(r.time*=-1),Math.abs(r.time+oW({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:r.segmentIndex,endIndex:0}))}runStrategies_(e,t,i,r,s){let n=[];for(let a=0;a86400){og.log.warn(`Not saving expired segment info. Media sequence gap ${i} is too large.`);return}for(let r=i-1;r>=0;r--){let i=e.segments[r];if(i&&void 0!==i.start){t.syncInfo={mediaSequence:e.mediaSequence+r,time:i.start},this.logger_(`playlist refresh sync: [time:${t.syncInfo.time}, mediaSequence: ${t.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){let t=e.segments[0],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){let i=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),r=e.segment;i&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:r.start}));let s=r.dateTimeObject;r.discontinuity&&t&&s&&(this.timelineToDatetimeMappings[r.timeline]=-(s.getTime()/1e3))}timestampOffsetForTimeline(e){return void 0===this.timelines[e]?null:this.timelines[e].time}mappingForTimeline(e){return void 0===this.timelines[e]?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,i){let r,s;let n=e.segment,a=e.part,o=this.timelines[e.timeline];if("number"==typeof e.timestampOffset)o={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=o,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${o.time}] [mapping: ${o.mapping}]`)),r=e.startOfSegment,s=t.end+o.mapping;else{if(!o)return!1;r=t.start+o.mapping,s=t.end+o.mapping}return a&&(a.start=r,a.end=s),(!n.start||ro){let r;r=a<0?i.start-oW({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:s}):i.end+oW({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:s}),this.discontinuities[n]={time:r,accuracy:o}}}}dispose(){this.trigger("dispose"),this.off()}}class dE extends og.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:i},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.lastTimelineChanges_[e]={type:e,from:t,to:i},delete this.pendingTimelineChanges_[e],this.trigger("timelinechange")),this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}var dw=lY(lQ(lJ(function(){var e,t,i,r=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(i,1),i>-1},t.trigger=function(e){var t=this.listeners[e];if(t){if(2==arguments.length)for(var i=t.length,r=0;r>7)*283)^e]=e;for(t=i=0;!h[t];t^=r||1,i=m[i]||1)for(e=0,n=(n=i^i<<1^i<<2^i<<3^i<<4)>>8^255&n^99,h[t]=n,c[n]=t,o=16843009*p[s=p[r=p[t]]]^65537*s^257*r^16843008*t,a=257*p[n]^16843008*n;e<4;e++)u[e][t]=a=a<<24^a>>>8,d[e][n]=o=o<<24^o>>>8;for(e=0;e<5;e++)u[e]=u[e].slice(0),d[e]=d[e].slice(0);return l},n=null;class a{constructor(e){let t,i,r;n||(n=s()),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()]];let a=this._tables[0][4],o=this._tables[1],l=e.length,u=1;if(4!==l&&6!==l&&8!==l)throw Error("Invalid aes key size");let d=e.slice(0),h=[];for(this._key=[d,h],t=l;t<4*l+28;t++)r=d[t-1],(t%l==0||8===l&&t%l==4)&&(r=a[r>>>24]<<24^a[r>>16&255]<<16^a[r>>8&255]<<8^a[255&r],t%l==0&&(r=r<<8^r>>>24^u<<24,u=u<<1^(u>>7)*283)),d[t]=d[t-l]^r;for(i=0;t;i++,t--)r=d[3&i?t:t-4],t<=4||i<4?h[i]=r:h[i]=o[0][a[r>>>24]]^o[1][a[r>>16&255]]^o[2][a[r>>8&255]]^o[3][a[255&r]]}decrypt(e,t,i,r,s,n){let a,o,l,u;let d=this._key[1],h=e^d[0],c=r^d[1],p=i^d[2],m=t^d[3],g=d.length/4-2,f=4,y=this._tables[1],_=y[0],b=y[1],v=y[2],T=y[3],S=y[4];for(u=0;u>>24]^b[c>>16&255]^v[p>>8&255]^T[255&m]^d[f],o=_[c>>>24]^b[p>>16&255]^v[m>>8&255]^T[255&h]^d[f+1],l=_[p>>>24]^b[m>>16&255]^v[h>>8&255]^T[255&c]^d[f+2],m=_[m>>>24]^b[h>>16&255]^v[c>>8&255]^T[255&p]^d[f+3],f+=4,h=a,c=o,p=l;for(u=0;u<4;u++)s[(3&-u)+n]=S[h>>>24]<<24^S[c>>16&255]<<16^S[p>>8&255]<<8^S[255&m]^d[f++],a=h,h=c,c=p,p=m,m=a}}class o extends r{constructor(){super(r),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}let l=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},u=function(e,t,i){let r,s,n,o,u,d,h,c,p;let m=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),g=new a(Array.prototype.slice.call(t)),f=new Uint8Array(e.byteLength),y=new Int32Array(f.buffer);for(p=0,r=i[0],s=i[1],n=i[2],o=i[3];p{let r=e[i];("function"===ArrayBuffer.isView?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer)?t[i]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:t[i]=r}),t};self.onmessage=function(e){let t=e.data;new d(new Uint8Array(t.encrypted.bytes,t.encrypted.byteOffset,t.encrypted.byteLength),new Uint32Array(t.key.bytes,t.key.byteOffset,t.key.byteLength/4),new Uint32Array(t.iv.bytes,t.iv.byteOffset,t.iv.byteLength/4),function(e,i){self.postMessage(p({source:t.source,decrypted:i}),[i.buffer])})}})));const dk=e=>{let t=e.default?"main":"alternative";return e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},dC=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},dD=(e,t)=>{t.activePlaylistLoader=e,e.load()},dI=(e,t)=>()=>{let{segmentLoaders:{[e]:i,main:r},mediaTypes:{[e]:s}}=t,n=s.activeTrack(),a=s.getActiveGroup(),o=s.activePlaylistLoader,l=s.lastGroup_;if((!a||!l||a.id!==l.id)&&(s.lastGroup_=a,s.lastTrack_=n,dC(i,s),a&&!a.isMainPlaylist)){if(!a.playlistLoader){o&&r.resetEverything();return}i.resyncLoader(),dD(a.playlistLoader,s)}},dx=(e,t)=>()=>{let{segmentLoaders:{[e]:i},mediaTypes:{[e]:r}}=t;r.lastGroup_=null,i.abort(),i.pause()},dA=(e,t)=>()=>{let{mainPlaylistLoader:i,segmentLoaders:{[e]:r,main:s},mediaTypes:{[e]:n}}=t,a=n.activeTrack(),o=n.getActiveGroup(),l=n.activePlaylistLoader,u=n.lastTrack_;if((!u||!a||u.id!==a.id)&&(n.lastGroup_=o,n.lastTrack_=a,dC(r,n),o)){if(o.isMainPlaylist){if(!a||!u||a.id===u.id)return;let e=t.vhs.playlistController_,r=e.selectPlaylist();if(e.media()===r)return;n.logger_(`track change. Switching main audio from ${u.id} to ${a.id}`),i.pause(),s.resetEverything(),e.fastQualityChange_(r);return}if("AUDIO"===e){if(!o.playlistLoader){s.setAudio(!0),s.resetEverything();return}r.setAudio(!0),s.setAudio(!1)}if(l===o.playlistLoader){dD(o.playlistLoader,n);return}r.track&&r.track(a),r.resetEverything(),dD(o.playlistLoader,n)}},dP={AUDIO:(e,t)=>()=>{let{mediaTypes:{[e]:i},excludePlaylist:r}=t,s=i.activeTrack(),n=i.activeGroup(),a=(n.filter(e=>e.default)[0]||n[0]).id,o=i.tracks[a];if(s===o){r({error:{message:"Problem encountered loading the default audio track."}});return}for(let e in og.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),i.tracks)i.tracks[e].enabled=i.tracks[e]===o;i.onTrackChanged()},SUBTITLES:(e,t)=>()=>{let{mediaTypes:{[e]:i}}=t;og.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");let r=i.activeTrack();r&&(r.mode="disabled"),i.onTrackChanged()}},dL={AUDIO:(e,t,i)=>{if(!t)return;let{tech:r,requestOptions:s,segmentLoaders:{[e]:n}}=i;t.on("loadedmetadata",()=>{let e=t.media();n.playlist(e,s),(!r.paused()||e.endList&&"none"!==r.preload())&&n.load()}),t.on("loadedplaylist",()=>{n.playlist(t.media(),s),r.paused()||n.load()}),t.on("error",dP[e](e,i))},SUBTITLES:(e,t,i)=>{let{tech:r,requestOptions:s,segmentLoaders:{[e]:n},mediaTypes:{[e]:a}}=i;t.on("loadedmetadata",()=>{let e=t.media();n.playlist(e,s),n.track(a.activeTrack()),(!r.paused()||e.endList&&"none"!==r.preload())&&n.load()}),t.on("loadedplaylist",()=>{n.playlist(t.media(),s),r.paused()||n.load()}),t.on("error",dP[e](e,i))}},dO={AUDIO:(e,t)=>{let{vhs:i,sourceType:r,segmentLoaders:{[e]:s},requestOptions:n,main:{mediaGroups:a},mediaTypes:{[e]:{groups:o,tracks:l,logger_:u}},mainPlaylistLoader:d}=t,h=o1(d.main);for(let s in(!a[e]||0===Object.keys(a[e]).length)&&(a[e]={main:{default:{default:!0}}},h&&(a[e].main.default.playlists=d.main.playlists)),a[e])for(let c in o[s]||(o[s]=[]),a[e][s]){let p,m=a[e][s][c];if(h?(u(`AUDIO group '${s}' label '${c}' is a main playlist`),m.isMainPlaylist=!0,p=null):p="vhs-json"===r&&m.playlists?new lp(m.playlists[0],i,n):m.resolvedUri?new lp(m.resolvedUri,i,n):m.playlists&&"dash"===r?new lz(m.playlists[0],i,n,d):null,m=oE({id:c,playlistLoader:p},m),dL[e](e,m.playlistLoader,t),o[s].push(m),void 0===l[c]){let e=new og.AudioTrack({id:c,kind:dk(m),enabled:!1,language:m.language,default:m.default,label:c});l[c]=e}}s.on("error",dP[e](e,t))},SUBTITLES:(e,t)=>{let{tech:i,vhs:r,sourceType:s,segmentLoaders:{[e]:n},requestOptions:a,main:{mediaGroups:o},mediaTypes:{[e]:{groups:l,tracks:u}},mainPlaylistLoader:d}=t;for(let n in o[e])for(let h in l[n]||(l[n]=[]),o[e][n]){let c;if(!r.options_.useForcedSubtitles&&o[e][n][h].forced)continue;let p=o[e][n][h];if("hls"===s)c=new lp(p.resolvedUri,r,a);else if("dash"===s){if(!p.playlists.filter(e=>e.excludeUntil!==1/0).length)return;c=new lz(p.playlists[0],r,a,d)}else"vhs-json"===s&&(c=new lp(p.playlists?p.playlists[0]:p.resolvedUri,r,a));if(p=oE({id:h,playlistLoader:c},p),dL[e](e,p.playlistLoader,t),l[n].push(p),void 0===u[h]){let e=i.addRemoteTextTrack({id:h,kind:"subtitles",default:p.default&&p.autoselect,language:p.language,label:h},!1).track;u[h]=e}}n.on("error",dP[e](e,t))},"CLOSED-CAPTIONS":(e,t)=>{let{tech:i,main:{mediaGroups:r},mediaTypes:{[e]:{groups:s,tracks:n}}}=t;for(let t in r[e])for(let a in s[t]||(s[t]=[]),r[e][t]){let o=r[e][t][a];if(!/^(?:CC|SERVICE)/.test(o.instreamId))continue;let l=i.options_.vhs&&i.options_.vhs.captionServices||{},u={label:a,language:o.language,instreamId:o.instreamId,default:o.default&&o.autoselect};if(l[u.instreamId]&&(u=oE(u,l[u.instreamId])),void 0===u.default&&delete u.default,s[t].push(oE({id:a},o)),void 0===n[a]){let e=i.addRemoteTextTrack({id:u.instreamId,kind:"captions",default:u.default,language:u.language,label:u.label},!1).track;n[a]=e}}}},dR=(e,t)=>{for(let i=0;ii=>{let{mainPlaylistLoader:r,mediaTypes:{[e]:{groups:s}}}=t,n=r.media();if(!n)return null;let a=null;n.attributes[e]&&(a=s[n.attributes[e]]);let o=Object.keys(s);if(!a){if("AUDIO"===e&&o.length>1&&o1(t.main))for(let e=0;ee.id===i.id)[0]||null},dN={AUDIO:(e,t)=>()=>{let{mediaTypes:{[e]:{tracks:i}}}=t;for(let e in i)if(i[e].enabled)return i[e];return null},SUBTITLES:(e,t)=>()=>{let{mediaTypes:{[e]:{tracks:i}}}=t;for(let e in i)if("showing"===i[e].mode||"hidden"===i[e].mode)return i[e];return null}},dU=(e,{mediaTypes:t})=>()=>{let i=t[e].activeTrack();return i?t[e].activeGroup(i):null},dB=e=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(t=>{dO[t](t,e)});let{mediaTypes:t,mainPlaylistLoader:i,tech:r,vhs:s,segmentLoaders:{AUDIO:n,main:a}}=e;["AUDIO","SUBTITLES"].forEach(i=>{t[i].activeGroup=dM(i,e),t[i].activeTrack=dN[i](i,e),t[i].onGroupChanged=dI(i,e),t[i].onGroupChanging=dx(i,e),t[i].onTrackChanged=dA(i,e),t[i].getActiveGroup=dU(i,e)});let o=t.AUDIO.activeGroup();if(o){let e=(o.filter(e=>e.default)[0]||o[0]).id;t.AUDIO.tracks[e].enabled=!0,t.AUDIO.onGroupChanged(),t.AUDIO.onTrackChanged(),t.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),n.setAudio(!0)):a.setAudio(!0)}i.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(e=>t[e].onGroupChanged())}),i.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(e=>t[e].onGroupChanging())});let l=()=>{t.AUDIO.onTrackChanged(),r.trigger({type:"usage",name:"vhs-audio-change"})};for(let e in r.audioTracks().addEventListener("change",l),r.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),s.on("dispose",()=>{r.audioTracks().removeEventListener("change",l),r.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)}),r.clearTracks("audio"),t.AUDIO.tracks)r.audioTracks().addTrack(t.AUDIO.tracks[e])},dF=()=>{let e={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(t=>{e[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:u6,activeTrack:u6,getActiveGroup:u6,onGroupChanged:u6,onTrackChanged:u6,lastTrack_:null,logger_:oS(`MediaGroups[${t}]`)}}),e};class dq{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){1===e&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=et(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(e=>[e.ID,e])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class dj extends og.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new dq,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=oS("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";let i=t.serverUri||t.serverURL;if(!i){this.logger_(`steering manifest URL is ${i}, cannot request steering manifest.`),this.trigger("error");return}if(i.startsWith("data:")){this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1));return}this.steeringManifest.reloadUri=et(e,i),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){let t=this.steeringManifest.reloadUri;if(!t)return;let i=e?t:this.getRequestURI(t);if(!i){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}this.request_=this.xhr_({uri:i,requestType:"content-steering-manifest"},(e,t)=>{if(e){if(410===t.status){this.logger_(`manifest request 410 ${e}.`),this.logger_(`There will be no more content steering requests to ${i} this session.`),this.excludedSteeringManifestURLs.add(i);return}if(429===t.status){let i=t.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${e}.`),this.logger_(`content steering will retry in ${i} seconds.`),this.startTTLTimeout_(parseInt(i,10));return}this.logger_(`manifest failed to load ${e}.`),this.startTTLTimeout_();return}let r=JSON.parse(this.request_.responseText);this.assignSteeringProperties_(r),this.startTTLTimeout_()})}setProxyServerUrl_(e){let t=new(I(R)).URL(e),i=new(I(R)).URL(this.proxyServerUrl_);return i.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(i.toString())}decodeDataUriManifest_(e){let t=JSON.parse(I(R).atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){let t=new(I(R)).URL(e),i=this.getPathway(),r=this.getBandwidth_();if(i){let e=`_${this.manifestType_}_pathway`;t.searchParams.set(e,i)}if(r){let e=`_${this.manifestType_}_throughput`;t.searchParams.set(e,r)}return t.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());let t=(e=>{for(let t of e)if(this.availablePathways_.has(t))return t;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==t&&(this.currentPathway=t,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;let t=e=>this.excludedSteeringManifestURLs.has(e);if(this.proxyServerUrl_){let i=this.setProxyServerUrl_(e);if(!t(i))return i}let i=this.setSteeringParams_(e);return t(i)?null:i}startTTLTimeout_(e=this.steeringManifest.ttl){this.ttlTimeout_=I(R).setTimeout(()=>{this.requestSteeringManifest()},1e3*e)}clearTTLTimeout_(){I(R).clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new dq}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,t){return!t&&this.steeringManifest.reloadUri||t&&(et(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const d$=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],dV=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]},dH=function({currentPlaylist:e,buffered:t,currentTime:i,nextPlaylist:r,bufferLowWaterLine:s,bufferHighWaterLine:n,duration:a,bufferBasedABR:o,log:l}){if(!r)return og.log.warn("We received no playlist to switch to. Please check your stream."),!1;let u=`allowing switch ${e&&e.id||"null"} -> ${r.id}`;if(!e)return l(`${u} as current playlist is not set`),!0;if(r.id===e.id)return!1;let d=!!oI(t,i).length;if(!e.endList)return d||"number"!=typeof e.partTargetDuration?(l(`${u} as current playlist is live`),!0):(l(`not ${u} as current playlist is live llhls, but currentTime isn't in buffered.`),!1);let h=oN(t,i),c=o?lW.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:lW.MAX_BUFFER_LOW_WATER_LINE;if(am)&&h>=s){let e=`${u} as forwardBuffer >= bufferLowWaterLine (${h} >= ${s})`;return o&&(e+=` and next bandwidth > current bandwidth (${p} > ${m})`),l(e),!0}return l(`not ${u} as no switching criteria met`),!1};class dz extends og.EventTarget{constructor(e){super();let{src:t,withCredentials:i,tech:r,bandwidth:s,externVhs:a,useCueTags:o,playlistExclusionDuration:l,enableLowInitialPlaylist:u,sourceType:d,cacheEncryptionKeys:h,bufferBasedABR:c,leastPixelDiffSelector:p,captionServices:m}=e;if(!t)throw Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:g}=e;null==g&&(g=1/0),n=a,this.bufferBasedABR=!!c,this.leastPixelDiffSelector=!!p,this.withCredentials=i,this.tech_=r,this.vhs_=r.vhs,this.sourceType_=d,this.useCueTags_=o,this.playlistExclusionDuration=l,this.maxPlaylistRetries=g,this.enableLowInitialPlaylist=u,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:g,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=dF(),this.mediaSource=new(I(R)).MediaSource,this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.seekable_=ow(),this.hasPlayed_=!1,this.syncController_=new dS(e),this.segmentMetadataTrack_=r.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new dw,this.sourceUpdater_=new du(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new dE,this.keyStatusMap_=new Map;let f={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:m,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:s,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:h,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_="dash"===this.sourceType_?new lz(t,this.vhs_,oE(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new lp(t,this.vhs_,oE(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new u3(oE(f,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new u3(oE(f,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new dm(oE(f,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((e,t)=>{function i(){r.off("vttjserror",s),e()}function s(){r.off("vttjsloaded",i),t()}r.one("vttjsloaded",i),r.one("vttjserror",s),r.addWebVttScript_()})}),e),this.contentSteeringController_=new dj(this.vhs_.xhr,()=>this.mainSegmentLoader_.bandwidth),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),d$.forEach(e=>{this[e+"_"]=dV.bind(this,e)}),this.logger_=oS("pc"),this.triggeredFmp4Usage=!1,"none"===this.tech_.preload()?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;let y="none"===this.tech_.preload()?"play":"loadstart";this.tech_.one(y,()=>{let e=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-e,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){let e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return -1===e||-1===t?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){let t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){let r=this.media(),s=r&&(r.id||r.uri),n=e&&(e.id||e.uri);s&&s!==n&&(this.logger_(`switch media ${s} -> ${n} from ${t}`),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})),this.mainPlaylistLoader_.media(e,i)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{let t=this.mediaTypes_[e],i=t?t.activeGroup():null,r=this.contentSteeringController_.getPathway();if(i&&r){let t=(i.length?i[0].playlists:i.playlists).filter(e=>e.attributes.serviceLocation===r);t.length&&this.mediaTypes_[e].activePlaylistLoader.media(t[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=I(R).setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(I(R).clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){let e;let t=this.main(),i=t&&t.playlists||[];if(!t||!t.mediaGroups||!t.mediaGroups.AUDIO)return i;let r=t.mediaGroups.AUDIO,s=Object.keys(r);if(Object.keys(this.mediaTypes_.AUDIO.groups).length)e=this.mediaTypes_.AUDIO.activeTrack();else{let t=r.main||s.length&&r[s[0]];for(let i in t)if(t[i].default){e={label:i};break}}if(!e)return i;let n=[];for(let i in r)if(r[i][e.label]){let s=r[i][e.label];if(s.playlists&&s.playlists.length)n.push.apply(n,s.playlists);else if(s.uri)n.push(s);else if(t.playlists.length)for(let e=0;e{let e=this.mainPlaylistLoader_.media(),t=1500*e.targetDuration;oJ(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,e.endList&&"none"!==this.tech_.preload()&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),dB({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),e),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let e=this.mainPlaylistLoader_.media();if(!e){let t;if(this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_(),this.enableLowInitialPlaylist&&(t=this.selectInitialPlaylist()),t||(t=this.selectPlaylist()),!t||!this.shouldSwitchToMedia_(t)||(this.initialMedia_=t,this.switchMedia_(this.initialMedia_,"initial"),!("vhs-json"===this.sourceType_&&this.initialMedia_.segments)))return;e=this.initialMedia_}this.handleUpdatedMediaPlaylist(e)}),this.mainPlaylistLoader_.on("error",()=>{let e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{let e=this.mainPlaylistLoader_.media(),t=1500*e.targetDuration;oJ(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,"dash"===this.sourceType_&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{let e=this.mainPlaylistLoader_.media();"playlist-unchanged"!==e.lastExcludeReason_&&this.stuckAtPlaylistEnd_(e)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),!this.tech_.paused()&&(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){let i=e.mediaGroups||{},r=!0,s=Object.keys(i.AUDIO);for(let e in i.AUDIO)for(let t in i.AUDIO[e])i.AUDIO[e][t].uri||(r=!1);r&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),n.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),s.length&&Object.keys(i.AUDIO[s[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){let t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),r=this.bufferLowWaterLine(),s=this.bufferHighWaterLine();return dH({buffered:this.tech_.buffered(),currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:r,bufferHighWaterLine:s,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{let e=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.mainSegmentLoader_.on("earlyabort",e=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:10}))});let e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();let e=this.getCodecsOrExclude_();e&&this.sourceUpdater_.addOrChangeSourceBuffers(e)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(()=>{this.tech_.setCurrentTime(this.tech_.currentTime())})}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();let e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime(){})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;let e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;let t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){let t=this.mainSegmentLoader_.getCurrentMediaInfo_();e=!t||t.hasVideo?e&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;let t=this.syncController_.getExpiredTime(e,this.duration());if(null===t)return!1;let i=n.Playlist.playlistEnd(e,t),r=this.tech_.currentTime(),s=this.tech_.buffered();if(!s.length)return i-r<=oC;let a=s.end(s.length-1);return a-r<=oC&&i-a<=oC}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){let r;if(e=e||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=t,"open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;let s=this.mainPlaylistLoader_.main.playlists,n=s.filter(oY),a=1===n.length&&n[0]===e;if(1===s.length&&i!==1/0)return og.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(a);if(a){if(this.main().contentSteering){let t=this.pathwayAttribute_(e),i=1e3*this.contentSteeringController_.steeringManifest.ttl;this.contentSteeringController_.excludePathway(t),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(t)},i);return}let t=!1;s.forEach(i=>{if(i===e)return;let r=i.excludeUntil;void 0!==r&&r!==1/0&&(t=!0,delete i.excludeUntil)}),t&&(og.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}r=e.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*i,e.excludeUntil=r,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});let o=this.selectPlaylist();if(!o){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}let l=t.internal?this.logger_:og.log.warn,u=t.message?" "+t.message:"";l(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${u} Switching to playlist ${o.id}.`),o.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),o.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);let d=o.targetDuration/2*1e3||5e3,h="number"==typeof o.lastRequest&&Date.now()-o.lastRequest<=d;return this.switchMedia_(o,"exclude",a||h)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){let i=[],r="all"===e;(r||"main"===e)&&i.push(this.mainPlaylistLoader_);let s=[];(r||"audio"===e)&&s.push("AUDIO"),(r||"subtitle"===e)&&(s.push("CLOSED-CAPTIONS"),s.push("SUBTITLES")),s.forEach(e=>{let t=this.mediaTypes_[e]&&this.mediaTypes_[e].activePlaylistLoader;t&&i.push(t)}),["main","audio","subtitle"].forEach(t=>{let r=this[`${t}SegmentLoader_`];r&&(e===t||"all"===e)&&i.push(r)}),i.forEach(e=>t.forEach(t=>{"function"==typeof e[t]&&e[t]()}))}setCurrentTime(e){let t=oI(this.tech_.buffered(),e);return this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()&&this.mainPlaylistLoader_.media().segments?t&&t.length?e:void(this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()):0}duration(){if(!this.mainPlaylistLoader_)return 0;let e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:n.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let e,t,i;if(!this.mainPlaylistLoader_)return;let r=this.mainPlaylistLoader_.media();if(!r)return;let s=this.syncController_.getExpiredTime(r,this.duration());if(null===s)return;let a=this.mainPlaylistLoader_.main,o=n.Playlist.seekable(r,s,n.Playlist.liveEdgeDelay(a,r));if(0!==o.length){if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(r=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(s=this.syncController_.getExpiredTime(r,this.duration()))||0===(e=n.Playlist.seekable(r,s,n.Playlist.liveEdgeDelay(a,r))).length)||(this.seekable_&&this.seekable_.length&&(t=this.seekable_.end(0),i=this.seekable_.start(0)),e?e.start(0)>o.end(0)||o.start(0)>e.end(0)?this.seekable_=o:this.seekable_=ow([[e.start(0)>o.start(0)?e.start(0):o.start(0),e.end(0)0&&(i=Math.max(i,t.end(t.length-1))),this.mediaSource.duration!==i&&this.sourceUpdater_.setDuration(i)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{let t=this.mediaTypes_[e].groups;for(let e in t)t[e].forEach(e=>{e.playlistLoader&&e.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){let e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return!!t&&!!i}getCodecsOrExclude_(){let e;let t={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},i=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();t.video=t.main;let r=uE(this.main(),i),s={},n=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(t.main.hasVideo&&(s.video=r.video||t.main.videoCodec||"avc1.4d400d"),t.main.isMuxed&&(s.video+=`,${r.audio||t.main.audioCodec||e9}`),(t.main.hasAudio&&!t.main.isMuxed||t.audio.hasAudio||n)&&(s.audio=r.audio||t.main.audioCodec||t.audio.audioCodec||e9,t.audio.isFmp4=t.main.hasAudio&&!t.main.isMuxed?t.main.isFmp4:t.audio.isFmp4),!s.audio&&!s.video){this.excludePlaylist({playlistToExclude:i,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}let a=(e,t)=>e?e6(t):e7(t),o={};if(["video","audio"].forEach(function(i){if(s.hasOwnProperty(i)&&!a(t[i].isFmp4,s[i])){let r=t[i].isFmp4?"browser":"muxer";o[r]=o[r]||[],o[r].push(s[i]),"audio"===i&&(e=r)}}),n&&e&&i.attributes.AUDIO){let t=i.attributes.AUDIO;this.main().playlists.forEach(e=>{(e.attributes&&e.attributes.AUDIO)===t&&e!==i&&(e.excludeUntil=1/0)}),this.logger_(`excluding audio group ${t} as ${e} does not support codec(s): "${s.audio}"`)}if(Object.keys(o).length){let e=Object.keys(o).reduce((e,t)=>(e&&(e+=", "),e+=`${t} does not support codec(s): "${o[t].join(",")}"`),"")+".";this.excludePlaylist({playlistToExclude:i,error:{internal:!0,message:e},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){let e=[];if(["video","audio"].forEach(t=>{let i=(e4(this.sourceUpdater_.codecs[t]||"")[0]||{}).type,r=(e4(s[t]||"")[0]||{}).type;i&&r&&i.toLowerCase()!==r.toLowerCase()&&e.push(`"${this.sourceUpdater_.codecs[t]}" -> "${s[t]}"`)}),e.length){this.excludePlaylist({playlistToExclude:i,error:{message:`Codec switching not supported: ${e.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return s}tryToCreateSourceBuffers_(){if("open"!==this.mediaSource.readyState||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;let e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);let t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){let e=this.main().playlists,t=[];Object.keys(e).forEach(i=>{let r=e[i];if(-1!==t.indexOf(r.id))return;t.push(r.id);let s=uE(this.main,r),n=[];!s.audio||e7(s.audio)||e6(s.audio)||n.push(`audio codec ${s.audio}`),!s.video||e7(s.video)||e6(s.video)||n.push(`video codec ${s.video}`),s.text&&"stpp.ttml.im1t"===s.text&&n.push(`text codec ${s.text}`),n.length&&(r.excludeUntil=1/0,this.logger_(`excluding ${r.id} for unsupported: ${n.join(", ")}`))})}excludeIncompatibleVariants_(e){let t=[],i=this.main().playlists,r=uT(e4(e)),s=uS(r),n=r.video&&e4(r.video)[0]||null,a=r.audio&&e4(r.audio)[0]||null;Object.keys(i).forEach(e=>{let r=i[e];if(-1!==t.indexOf(r.id)||r.excludeUntil===1/0)return;t.push(r.id);let o=[],l=uE(this.mainPlaylistLoader_.main,r),u=uS(l);if(l.audio||l.video){if(u!==s&&o.push(`codec count "${u}" !== "${s}"`),!this.sourceUpdater_.canChangeType()){let e=l.video&&e4(l.video)[0]||null,t=l.audio&&e4(l.audio)[0]||null;e&&n&&e.type.toLowerCase()!==n.type.toLowerCase()&&o.push(`video codec "${e.type}" !== "${n.type}"`),t&&a&&t.type.toLowerCase()!==a.type.toLowerCase()&&o.push(`audio codec "${t.type}" !== "${a.type}"`)}o.length&&(r.excludeUntil=1/0,this.logger_(`excluding ${r.id}: ${o.join(" && ")}`))}})}updateAdCues_(e){let t=0,i=this.seekable();i.length&&(t=i.start(0)),df(e,this.cueTagsTrack_,t)}goalBufferLength(){let e=this.tech_.currentTime(),t=lW.GOAL_BUFFER_LENGTH,i=lW.GOAL_BUFFER_LENGTH_RATE,r=Math.max(t,lW.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,r)}bufferLowWaterLine(){let e=this.tech_.currentTime(),t=lW.BUFFER_LOW_WATER_LINE,i=lW.BUFFER_LOW_WATER_LINE_RATE,r=Math.max(t,lW.MAX_BUFFER_LOW_WATER_LINE),s=Math.max(t,lW.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?s:r)}bufferHighWaterLine(){return lW.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){uj(this.inbandTextTracks_,"com.apple.streaming",this.tech_),uq({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){let r=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();uj(this.inbandTextTracks_,e,this.tech_),uU({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:r,videoDuration:i})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){let e=this.main();if(e.contentSteering){for(let t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),"dash"===this.sourceType_&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{let e=this.main();(this.contentSteeringController_.didDASHTagChange(e.uri,e.contentSteering)||(()=>{let t=this.contentSteeringController_.getAvailablePathways(),i=[];for(let r of e.playlists){let e=r.attributes.serviceLocation;if(e&&(i.push(e),!t.has(e)))return!0}return!i.length&&!!t.size})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){let e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();let t=this.main().playlists,i=new Set,r=!1;Object.keys(t).forEach(s=>{let n=t[s],a=this.pathwayAttribute_(n),o=a&&e!==a;n.excludeUntil!==1/0||"content-steering"!==n.lastExcludeReason_||o||(delete n.excludeUntil,delete n.lastExcludeReason_,r=!0);let l=!n.excludeUntil&&n.excludeUntil!==1/0;!i.has(n.id)&&o&&l&&(i.add(n.id),n.excludeUntil=1/0,n.lastExcludeReason_="content-steering",this.logger_(`excluding ${n.id} for ${n.lastExcludeReason_}`))}),"DASH"===this.contentSteeringController_.manifestType_&&Object.keys(this.mediaTypes_).forEach(t=>{let i=this.mediaTypes_[t];if(i.activePlaylistLoader){let t=i.activePlaylistLoader.media_;t&&t.attributes.serviceLocation!==e&&(r=!0)}}),r&&this.changeSegmentPathway_()}handlePathwayClones_(){let e=this.main().playlists,t=this.contentSteeringController_.currentPathwayClones,i=this.contentSteeringController_.nextPathwayClones;if(t&&t.size||i&&i.size){for(let[e,r]of t.entries())i.get(e)||(this.mainPlaylistLoader_.updateOrDeleteClone(r),this.contentSteeringController_.excludePathway(e));for(let[r,s]of i.entries()){let i=t.get(r);if(!i){e.filter(e=>e.attributes["PATHWAY-ID"]===s["BASE-ID"]).forEach(e=>{this.mainPlaylistLoader_.addClonePathway(s,e)}),this.contentSteeringController_.addAvailablePathway(r);continue}this.equalPathwayClones_(i,s)||(this.mainPlaylistLoader_.updateOrDeleteClone(s,!0),this.contentSteeringController_.addAvailablePathway(r))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...i])))}}equalPathwayClones_(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;let i=e["URI-REPLACEMENT"].PARAMS,r=t["URI-REPLACEMENT"].PARAMS;for(let e in i)if(i[e]!==r[e])return!1;for(let e in r)if(i[e]!==r[e])return!1;return!0}changeSegmentPathway_(){let e=this.selectPlaylist();this.pauseLoading(),"DASH"===this.contentSteeringController_.manifestType_&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0,t="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(i=>{let r=this.mainPlaylistLoader_.getKeyIdSet(i);r&&r.size&&r.forEach(r=>{let s="usable",n=this.keyStatusMap_.has(r)&&this.keyStatusMap_.get(r)===s,a=i.lastExcludeReason_===t&&i.excludeUntil===1/0;n?n&&a&&(delete i.excludeUntil,delete i.lastExcludeReason_,this.logger_(`enabling playlist ${i.id} because key ID ${r} is ${s}`)):(i.excludeUntil!==1/0&&i.lastExcludeReason_!==t&&(i.excludeUntil=1/0,i.lastExcludeReason_=t,this.logger_(`excluding playlist ${i.id} because the key ID ${r} doesn't exist in the keyStatusMap or is not ${s}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(e=>{let i=e&&e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height<720,r=e.excludeUntil===1/0&&e.lastExcludeReason_===t;i&&r&&(delete e.excludeUntil,og.log.warn(`enabling non-HD playlist ${e.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){let i=("string"==typeof e?e:dh(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${t}' with key ID ${i} added to the keyStatusMap`),this.keyStatusMap_.set(i,t)}updatePlaylistByKeyStatus(e,t){this.addKeyStatus_(e,t),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}const dW=(e,t,i)=>r=>{let s=e.main.playlists[t],n=oX(s),a=oY(s);return void 0===r?a:(r?delete s.disabled:s.disabled=!0,r===a||n||(i(s),r?e.trigger("renditionenabled"):e.trigger("renditiondisabled")),r)};class dG{constructor(e,t,i){let{playlistController_:r}=e,s=r.fastQualityChange_.bind(r);if(t.attributes){let e=t.attributes.RESOLUTION;this.width=e&&e.width,this.height=e&&e.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}this.codecs=uE(r.main(),t),this.playlist=t,this.id=i,this.enabled=dW(e.playlists,t.id,s)}}const dK=function(e){e.representations=()=>{let t=e.playlistController_.main(),i=o1(t)?e.playlistController_.getAudioTrackPlaylists_():t.playlists;return i?i.filter(e=>!oX(e)).map((t,i)=>new dG(e,t,t.id)):[]}},dX=["seeking","seeked","pause","playing","error"];class dY{constructor(e){this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=oS("PlaybackWatcher"),this.logger_("initialize");let t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),r=()=>this.techWaiting_(),s=()=>this.resetTimeUpdate_(),n=this.playlistController_,a=["main","subtitle","audio"],o={};a.forEach(e=>{o[e]={reset:()=>this.resetSegmentDownloads_(e),updateend:()=>this.checkSegmentDownloads_(e)},n[`${e}SegmentLoader_`].on("appendsdone",o[e].updateend),n[`${e}SegmentLoader_`].on("playlistupdate",o[e].reset),this.tech_.on(["seeked","seeking"],o[e].reset)});let l=e=>{["main","audio"].forEach(t=>{n[`${t}SegmentLoader_`][e]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),l("off"))},this.clearSeekingAppendCheck_=()=>l("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),l("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",r),this.tech_.on(dX,s),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",r),this.tech_.off(dX,s),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),a.forEach(e=>{n[`${e}SegmentLoader_`].off("appendsdone",o[e].updateend),n[`${e}SegmentLoader_`].off("playlistupdate",o[e].reset),this.tech_.off(["seeked","seeking"],o[e].reset)}),this.checkCurrentTimeTimeout_&&I(R).clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&I(R).clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=I(R).setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){let t=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=t.buffered_()}checkSegmentDownloads_(e){let t=this.playlistController_,i=t[`${e}SegmentLoader_`],r=i.buffered_(),s=oR(this[`${e}Buffered_`],r);if(this[`${e}Buffered_`]=r,s){this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:i.playlist_&&i.playlist_.id,buffered:oO(r)}),this[`${e}StalledDownloads_`]<10||(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),"subtitle"!==e&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;let e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+oC>=t.end(t.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){let e;if(!this.tech_.seeking())return!1;let t=this.seekable(),i=this.tech_.currentTime();if(this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(e=t.end(t.length-1)),this.beforeSeekableWindow_(t,i)){let i=t.start(0);e=i+(i===t.end(0)?0:oC)}if(void 0!==e)return this.logger_(`Trying to seek outside of seekable at time ${i} with seekable range ${oL(t)}. Seeking to ${e}.`),this.tech_.setCurrentTime(e),!0;let r=this.playlistController_.sourceUpdater_,s=this.tech_.buffered(),n=r.audioBuffer?r.audioBuffered():null,a=r.videoBuffer?r.videoBuffered():null,o=this.media(),l=o.partTargetDuration?o.partTargetDuration:(o.targetDuration-ok)*2,u=[n,a];for(let e=0;e ${t.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){let e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){let i=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${i}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}let i=this.tech_.vhs.playlistController_.sourceUpdater_,r=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:i.audioBuffered(),videoBuffered:i.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;let s=ox(r,t);return s.length>0&&(this.logger_(`Stopped at ${t} and seeking to ${s.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0)}afterSeekableWindow_(e,t,i,r=!1){if(!e.length)return!1;let s=e.end(e.length-1)+oC,n=!i.endList,a="number"==typeof i.partTargetDuration;return n&&(a||r)&&(s=e.end(e.length-1)+3*i.targetDuration),t>s}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t2)return{start:r,end:s}}return null}}const dQ={errorInterval:30,getSource(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},dJ=function(e,t){let i=0,r=0,s=oE(dQ,t);e.ready(()=>{e.trigger({type:"usage",name:"vhs-error-reload-initialized"})});let n=function(){r&&e.currentTime(r)},a=function(t){null!=t&&(r=e.duration()!==1/0&&e.currentTime()||0,e.one("loadedmetadata",n),e.src(t),e.trigger({type:"usage",name:"vhs-error-reload"}),e.play())},o=function(){if(Date.now()-i<1e3*s.errorInterval){e.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!s.getSource||"function"!=typeof s.getSource){og.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return i=Date.now(),s.getSource.call(e,a)},l=function(){e.off("loadedmetadata",n),e.off("error",o),e.off("dispose",l)};e.on("error",o),e.on("dispose",l),e.reloadSourceOnError=function(t){l(),dJ(e,t)}};var dZ="3.12.2";const d0={PlaylistLoader:lp,Playlist:o2,utils:lk,STANDARD_PLAYLIST_SELECTOR:uA,INITIAL_PLAYLIST_SELECTOR:function(){let e=this.playlists.main.playlists.filter(o2.isEnabled);return uD(e,(e,t)=>uI(e,t)),e.filter(e=>!!uE(this.playlists.main,e).video)[0]||null},lastBandwidthSelector:uA,movingAverageBandwidthSelector:function(e){let t=-1,i=-1;if(e<0||e>1)throw Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let r=this.useDevicePixelRatio&&I(R).devicePixelRatio||1;return isNaN(this.customPixelRatio)||(r=this.customPixelRatio),t<0&&(t=this.systemBandwidth,i=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==i&&(t=e*this.systemBandwidth+(1-e)*t,i=this.systemBandwidth),ux(this.playlists.main,t,parseInt(uC(this.tech_.el(),"width"),10)*r,parseInt(uC(this.tech_.el(),"height"),10)*r,this.limitRenditionByPlayerDimensions,this.playlistController_)}},comparePlaylistBandwidth:uI,comparePlaylistResolution:function(e,t){let i,r;return(e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||I(R).Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(r=t.attributes.RESOLUTION.width),i===(r=r||I(R).Number.MAX_VALUE)&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH)?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-r},xhr:ly()};Object.keys(lW).forEach(e=>{Object.defineProperty(d0,e,{get:()=>(og.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),lW[e]),set(t){if(og.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),"number"!=typeof t||t<0){og.log.warn(`value of Vhs.${e} must be greater than or equal to 0`);return}lW[e]=t}})});const d1="videojs-vhs",d2=function(e,t){let i=t.media(),r=-1;for(let t=0;t{e.addQualityLevel(t)}),d2(e,t.playlists)};d0.canPlaySource=function(){return og.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const d8=(e,t,i)=>{if(!e)return e;let r={};t&&t.attributes&&t.attributes.CODECS&&(r=uT(e4(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(r.audio=i.attributes.CODECS);let s=e3(r.video),n=e3(r.audio),a={};for(let i in e)a[i]={},n&&(a[i].audioContentType=n),s&&(a[i].videoContentType=s),t.contentProtection&&t.contentProtection[i]&&t.contentProtection[i].pssh&&(a[i].pssh=t.contentProtection[i].pssh),"string"==typeof e[i]&&(a[i].url=e[i]);return oE(e,a)},d5=(e,t)=>e.reduce((e,i)=>{if(!i.contentProtection)return e;let r=t.reduce((e,t)=>{let r=i.contentProtection[t];return r&&r.pssh&&(e[t]={pssh:r.pssh}),e},{});return Object.keys(r).length&&e.push(r),e},[]),d3=({player:e,sourceKeySystems:t,audioMedia:i,mainPlaylists:r})=>{if(!e.eme.initializeMediaKeys)return Promise.resolve();let s=d5(i?r.concat([i]):r,Object.keys(t)),n=[],a=[];return s.forEach(t=>{a.push(new Promise((t,i)=>{e.tech_.one("keysessioncreated",t)})),n.push(new Promise((i,r)=>{e.eme.initializeMediaKeys({keySystems:t},e=>{if(e){r(e);return}i()})}))}),Promise.race([Promise.all(n),Promise.race(a)])},d6=({player:e,sourceKeySystems:t,media:i,audioMedia:r})=>{let s=d8(t,i,r);return!!s&&(e.currentSource().keySystems=s,!s||!!e.eme||(og.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1))},d7=()=>{if(!I(R).localStorage)return null;let e=I(R).localStorage.getItem(d1);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}},d9=e=>{if(!I(R).localStorage)return!1;let t=d7();t=t?oE(t,e):e;try{I(R).localStorage.setItem(d1,JSON.stringify(t))}catch(e){return!1}return t},he=e=>0===e.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(e.substring(e.indexOf(",")+1)):e,ht=(e,t)=>{e._requestCallbackSet||(e._requestCallbackSet=new Set),e._requestCallbackSet.add(t)},hi=(e,t)=>{e._responseCallbackSet||(e._responseCallbackSet=new Set),e._responseCallbackSet.add(t)},hr=(e,t)=>{e._requestCallbackSet&&(e._requestCallbackSet.delete(t),e._requestCallbackSet.size||delete e._requestCallbackSet)},hs=(e,t)=>{e._responseCallbackSet&&(e._responseCallbackSet.delete(t),e._responseCallbackSet.size||delete e._responseCallbackSet)};d0.supportsNativeHls=function(){if(!I(M)||!I(M).createElement)return!1;let e=I(M).createElement("video");return!!og.getTech("Html5").isSupported()&&["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(t){return/maybe|probably/i.test(e.canPlayType(t))})}(),d0.supportsNativeDash=!!(I(M)&&I(M).createElement&&og.getTech("Html5").isSupported())&&/maybe|probably/i.test(I(M).createElement("video").canPlayType("application/dash+xml")),d0.supportsTypeNatively=e=>"hls"===e?d0.supportsNativeHls:"dash"===e&&d0.supportsNativeDash,d0.isSupported=function(){return og.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},d0.xhr.onRequest=function(e){ht(d0.xhr,e)},d0.xhr.onResponse=function(e){hi(d0.xhr,e)},d0.xhr.offRequest=function(e){hr(d0.xhr,e)},d0.xhr.offResponse=function(e){hs(d0.xhr,e)};const hn=og.getComponent("Component");class ha extends hn{constructor(e,t,i){if(super(t,i.vhs),"number"==typeof i.initialBandwidth&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=oS("VhsHandler"),t.options_&&t.options_.playerId){let e=og.getPlayer(t.options_.playerId);this.player_=e}if(this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(I(M),["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],e=>{let t=I(M).fullscreenElement||I(M).webkitFullscreenElement||I(M).mozFullScreenElement||I(M).msFullscreenElement;t&&t.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(e={}){if(this.options_=oE(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage=void 0!==this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=!1!==this.options_.llhls,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,"number"!=typeof this.options_.playlistExclusionDuration&&(this.options_.playlistExclusionDuration=60),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage){let e=d7();e&&e.bandwidth&&(this.options_.bandwidth=e.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),e&&e.throughput&&(this.options_.throughput=e.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=lW.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===lW.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(e=>{void 0!==this.source_[e]&&(this.options_[e]=this.source_[e])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio;let t=this.options_.customPixelRatio;"number"==typeof t&&t>=0&&(this.customPixelRatio=t)}setOptions(e={}){this.setOptions_(e)}src(e,t){if(!e)return;this.setOptions_(),this.options_.src=he(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=d0,this.options_.sourceType=ti(t),this.options_.seekTo=e=>{this.tech_.setCurrentTime(e)},this.playlistController_=new dz(this.options_);let i=oE({liveRangeSafeTimeDelta:oC},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new dY(i),this.playlistController_.on("error",()=>{let e=og.players[this.tech_.options_.playerId],t=this.playlistController_.error;"object"!=typeof t||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)});let r=this.options_.bufferBasedABR?d0.movingAverageBandwidthSelector(.55):d0.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):r.bind(this),this.playlistController_.selectInitialPlaylist=d0.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(e){this.playlistController_.selectPlaylist=e.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(e){this.playlistController_.mainSegmentLoader_.throughput.rate=e,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let e=this.playlistController_.mainSegmentLoader_.bandwidth,t=I(R).navigator.connection||I(R).navigator.mozConnection||I(R).navigator.webkitConnection;if(this.options_.useNetworkInformationApi&&t){let i=1e6*t.downlink;e=i>=1e7&&e>=1e7?Math.max(e,i):i}return e},set(e){this.playlistController_.mainSegmentLoader_.bandwidth=e,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){return Math.floor(1/(1/(this.bandwidth||1)+(this.throughput>0?1/this.throughput:0)))},set(){og.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:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>oO(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>oO(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{this.options_.useBandwidthFromLocalStorage&&d9({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{dK(this)}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=I(R).URL.createObjectURL(this.playlistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){let e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),d3({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(e=>{this.logger_("error while creating EME key session",e),this.player_.error({message:"Failed to initialize media keys for EME",code:3,metadata:{errorType:og.Error.EMEKeySessionCreationError}})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){let e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=d6({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",e=>{this.playlistController_.updatePlaylistByKeyStatus(e.keyId,e.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!t){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){let e=og.players[this.tech_.options_.playerId];e&&e.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{d4(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{d2(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":dZ,"mux.js":"7.0.3","mpd-parser":"1.3.0","m3u8-parser":"7.1.0","aes-decrypter":"4.0.1"}}version(){return this.constructor.version()}canChangeType(){return du.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&I(R).URL.revokeObjectURL&&(I(R).URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return lL({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,r=2){return lO({programTime:e,playlist:this.playlistController_.media(),retryCount:r,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{ht(this.xhr,e)},this.xhr.onResponse=e=>{hi(this.xhr,e)},this.xhr.offRequest=e=>{hr(this.xhr,e)},this.xhr.offResponse=e=>{hs(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}}const ho={name:"videojs-http-streaming",VERSION:dZ,canHandleSource(e,t={}){let i=oE(og.options,t);return ho.canPlayType(e.type,i)},handleSource(e,t,i={}){let r=oE(og.options,i);return t.vhs=new ha(e,t,r),t.vhs.xhr=ly(),t.vhs.setupXhrHooks_(),t.vhs.src(e.src,e.type),t.vhs},canPlayType(e,t){let i=ti(e);if(!i)return"";let r=ho.getOverrideNative(t);return!d0.supportsTypeNatively(i)||r?"maybe":""},getOverrideNative(e={}){let{vhs:t={}}=e,i=!(og.browser.IS_ANY_SAFARI||og.browser.IS_IOS),{overrideNative:r=i}=t;return r}};e6("avc1.4d400d,mp4a.40.2")&&og.getTech("Html5").registerSourceHandler(ho,0),og.VhsHandler=ha,og.VhsSourceHandler=ho,og.Vhs=d0,og.use||og.registerComponent("Vhs",d0),og.options.vhs=og.options.vhs||{},og.getPlugin&&og.getPlugin("reloadSourceOnError")||og.registerPlugin("reloadSourceOnError",function(e){dJ(this,e)});var M=P("7pNCM"),R=P("eDick");function hl(){return(hl=Object.assign||function(e){for(var t=1;t=400&&r.statusCode<=599){var n=s;t&&(n=String.fromCharCode.apply(null,new Uint8Array(s))),e({cause:n});return}e(null,s)}});var hf=function(e){var t,i=String.fromCharCode.apply(null,new Uint16Array(e)),r=new(I(R)).DOMParser().parseFromString(i,"application/xml"),s=r.getElementsByTagName("HttpHeaders")[0],n={};if(s)for(var a=s.getElementsByTagName("name"),o=s.getElementsByTagName("value"),l=0;le.enabled);let{kind:i,language:r}=e,s=t.find(e=>e.language===r&&e.kind===i)||t.find(e=>e.language===r);return s&&(s.enabled=!0),s}bufferedRanges(){let e=[];for(let t=0;t!["chapters","metadata"].includes(e.kind));if(!e)return t.find(e=>"showing"===e.mode);t.forEach(e=>e.mode="disabled");let{kind:i,language:r}=e;return t.find(e=>(e.language===r&&e.kind===i&&(e.mode="showing"),"showing"===e.mode))||t.find(e=>(e.language===r&&(e.mode="showing"),"showing"===e.mode))}}),og.VERSION={pillarbox:O.version,videojs:og.VERSION,[og.VhsSourceHandler.name]:og.VhsSourceHandler.VERSION,eme:og.getPlugin("eme").VERSION},og.options.enableSmoothSeeking=!0,og.options.fill=!0,og.options.html5={vhs:{useForcedSubtitles:!0}},og.options.liveTracker={trackingThreshold:120,liveTolerance:15},og.options.liveui=!0,og.options.playsinline=!0,og.options.responsive=!0,og.options.trackers={};var hV=class{constructor(e="il.srgssr.ch"){this.setIlHost(e)}setIlHost(e){this.baseUrl=`${e}/integrationlayer/2.1/`}handleRequest(e){return async t=>{let i="function"==typeof e?e(t):this.mediaCompositionUrlHandler(t),r=await fetch(i);if(!r.ok)throw r;return await r.json()}}mediaCompositionUrlHandler(e){return`https://${this.baseUrl}mediaComposition/byUrn/${e}?onlyChapters=true&vector=portalplay`}};const hH="https://il.srgssr.ch/images/";var hz=class{static scale({url:e,width:t="960",format:i="jpg"}={},r=hH){if(!e)return;let s=new URL(r);return s.searchParams.set("imageUrl",e),s.searchParams.set("format",i),s.searchParams.set("width",t),decodeURIComponent(s.href)}static get JPG(){return"jpg"}static get PNG(){return"png"}static get WEBP(){return"webp"}static get WIDTH_240(){return"240"}static get WIDTH_320(){return"320"}static get WIDTH_480(){return"480"}static get WIDTH_960(){return"960"}static get WIDTH_1920(){return"1920"}};const hW={WIDEVINE:"com.widevine.alpha",FAIRPLAY:"com.apple.fps.1_0",PLAYREADY:"com.microsoft.playready"};class hG{static buildKeySystems(e=[]){let t={};return e.forEach(e=>{let i=hG.vendors[e.type];if(hG.vendors.FAIRPLAY===i){let{certificateUrl:r,licenseUrl:s}=e;t[i]={certificateUri:r,licenseUri:s}}else t[i]=e.licenseUrl}),{keySystems:t}}static hasDrm(e){return e.some(({drmList:e})=>e&&e.length>0)}static get vendors(){return hW}}const hK="AKAMAI",hX="NONE";class hY{static aclPath(e){let t=e.pathname;return`${t.substring(0,t.lastIndexOf("/")+1)}*`}static get AKAMAI(){return hK}static hasToken(e){return e.some(e=>hY.isAkamai(e.tokenType))}static isAkamai(e){return hK===e}static isNone(e){return hX===e}static get NONE(){return hX}static tokenize(e,t){let i=new URL(`${e.url}`),r=hY.aclPath(i);return fetch(`${t}${encodeURIComponent(r)}`).then(e=>e.ok?e.json():Promise.reject({status:e.status,statusText:e.statusText})).then(({token:{authparams:t}})=>(new URLSearchParams(t).forEach((e,t)=>i.searchParams.set(t,e)),Object.assign({},e,{url:i.toString()}))).catch(e=>Promise.reject(e))}static tokenizeSources(e,t="https://tp.srgssr.ch/akahd/token?acl="){let i=[];return e.forEach(e=>{let r=hY.tokenize(e,t);i.push(r)}),Promise.all(i).then(e=>e).catch(e=>Promise.reject(e))}}const hQ="emptied",hJ="ended",hZ="loadeddata",h0="loadstart",h1="pause",h2="playing",h4="ratechange",h8="seeking",h5="timeupdate",h3="waiting";class h6{constructor(e,{debug:t=!1,environment:i="prod",playerVersion:r="none",tagCommanderScriptURL:s="//colibri-js.akamaized.net/penguin/tc_SRGGD_11.js"}={}){this.isDebugEnabled=t,this.elapsedPlaybackTime=0,this.environment=i,this.hasStarted=!1,this.heartBeatIntervalId=void 0,this.initialized=!1,this.isSeeking=!1,this.isWaiting=!1,this.mediaSession=0,this.pendingQueue=[],this.pendingTagCommanderReload=!1,this.player=e,this.playerVersion=r,this.srcMediaData=void 0,this.startPlaybackSession=0,this.tagCommanderScriptURL=s,this.trackedCurrentTime=0,this.uptimeIntervalId=void 0,this.initScript(),this.initListeners()}beforeunload(){this.notify("stop")}clearTimers(){clearInterval(this.heartBeatIntervalId),clearInterval(this.uptimeIntervalId),clearTimeout(this.uptimeTimeoutId)}currentTime(){return Math.round(this.trackedCurrentTime)}debug(e){if(void 0===e)return this.isDebugEnabled||this.player.debug();this.isDebugEnabled=!!e}destroy(){this.clearTimers(),window.tc_vars||(window.tc_vars={}),this.elapsedPlaybackTime=0,this.hasStarted=!1,this.heartBeatIntervalId=void 0,this.initialized=!1,this.isWaiting=!1,this.mediaSession=0,this.pendingQueue=[],this.srcMediaData=void 0,this.startPlaybackSession=0,this.trackedCurrentTime=0,this.uptimeIntervalId=void 0}dispose(){this.beforeunload(),this.clearTimers(),window.removeEventListener("beforeunload",this.beforeunloadListener),this.player.off(hQ,this.emptiedListener),this.player.off(hJ,this.endedListener),this.player.off(h0,this.loadstartListener),this.player.off(hZ,this.loadeddataListener),this.player.off(h2,this.playListener),this.player.off(h1,this.pauseListener),this.player.off(h4,this.rateChangeListener),this.player.off(h8,this.seekingListener),this.player.off(h5,this.timeUpdateListener),this.player.off(h3,this.waitingListener)}emptied(){this.player.ended()||this.notify("stop")}ended(){this.notify("eof"),this.mediaSession=0,this.clearTimers()}flush(){!this.isTrackerDisabled()&&(this.pendingTagCommanderReload&&window.tC&&(window.tC.container.reload(),this.pendingTagCommanderReload=!1),window.tc_events_11&&this.pendingQueue.length>0&&(this.pendingQueue.forEach(e=>{window.tc_events_11(this.player.el(),e.action,e.labels)}),this.pendingQueue=[]))}getCurrentAudioTrack(){let e=Array.from(this.player.audioTracks()).find(e=>e.enabled),t="und";return e&&e.language&&(t=e.language),e?t.toUpperCase():""}getCurrentTextTrack(){let e=this.player.textTrack(),t="und";return e&&e.language&&(t=e.language),e?t.toUpperCase():""}getDvrWindowPosition(){let{liveTracker:e}=this.player,t=this.currentTime()-e.seekableStart()|0,i=e.liveWindow()-t;return i<0||i===1/0?0:1e3*i}getDvrWindowSize(){let e=this.player.liveTracker.liveWindow()===1/0,t=1e3*this.player.liveTracker.liveWindow();return e?0:t}getElapsedPlaybackTime(){return this.startPlaybackSession?this.getElapsedPlayingTime():this.elapsedPlaybackTime}getElapsedPlayingTime(){let e=h6.now()-this.startPlaybackSession|0;return this.elapsedPlaybackTime+e}getEventLabels(e){let t={event_id:e,event_timestamp:h6.now(),media_dvr_window_length:0,media_dvr_window_offset:0,media_is_dvr:!1,media_is_live:!1,media_mute:this.player.muted()?"1":"0",media_playback_rate:this.player.playbackRate(),media_position:this.currentTime(),media_quality:this.srcMediaData.mediaData.quality,media_subtitles_on:this.isTextTrackEnabled(),media_volume:(100*this.player.volume()).toFixed(0),navigation_environment:this.environment};return this.isAudioTrackEnabled()&&(t.media_audio_track=this.getCurrentAudioTrack()),this.isTextTrackEnabled()&&(t.media_subtitle_selection=this.getCurrentTextTrack()),this.isMediaOnDemand()||(t.media_is_live=!0,t.media_position=this.getElapsedPlaybackTime()),this.isMediaDvr()&&(t.media_dvr_window_offset=0|this.getDvrWindowPosition(),t.media_dvr_window_length=0|this.getDvrWindowSize(),t.media_is_dvr=!0,t.media_timeshift=["play",h1].includes(e)?this.timeShifted():0),t}getInternalLabels(){let e={media_bu_distributer:this.srcMediaData.mediaData.vendor,media_chromecast_selected:!!this.player.tech(!0).isCasting,media_embedding_url:document.referrer,media_player_display:"default",media_player_name:"pillarbox-web",media_player_version:this.playerVersion,media_url:this.srcMediaData.src},t=this.srcMediaData.mediaData.analyticsMetadata||{};window.tc_vars=Object.assign({},window.tc_vars,e,t)}heartBeat(){this.heartBeatIntervalId=setInterval(()=>{this.player.paused()||this.notify("pos")},3e4)}initCallbacks(){this.beforeunloadListener=this.beforeunload.bind(this),this.emptiedListener=this.emptied.bind(this),this.endedListener=this.ended.bind(this),this.loadstartListener=this.loadstart.bind(this),this.loadeddataListener=this.loadeddata.bind(this),this.playListener=this.play.bind(this),this.pauseListener=this.pause.bind(this),this.rateChangeListener=this.rateChange.bind(this),this.seekingListener=this.seeking.bind(this),this.timeUpdateListener=this.timeUpdate.bind(this),this.waitingListener=this.waiting.bind(this)}initListeners(){this.initCallbacks(),window.addEventListener("beforeunload",this.beforeunloadListener),this.player.on(hQ,this.emptiedListener),this.player.on(hJ,this.endedListener),this.player.on(h0,this.loadstartListener),this.player.on(hZ,this.loadeddataListener),this.player.on(h2,this.playListener),this.player.on(h1,this.pauseListener),this.player.on(h4,this.rateChangeListener),this.player.on(h8,this.seekingListener),this.player.on(h5,this.timeUpdateListener),this.player.on(h3,this.waitingListener),this.player.one("dispose",this.dispose.bind(this))}initScript(){let e="tc_script__11";if(!document.querySelector(`#${e}`)){let t=document.createElement("script"),i=this.tagCommanderScriptURL;t.defer=!0,t.id=e,t.src=i,t.type="text/javascript",t.onload=e=>{this.flush()},document.body.appendChild(t)}}isAudioTrackEnabled(){return!!this.getCurrentAudioTrack()}isMediaDvr(){let{trackingThreshold:e}=this.player.liveTracker.options();return!this.isMediaOnDemand()&ðis.player.liveTracker.liveWindow()}isMediaOnDemand(){return Number.isFinite(this.player.duration())}isTextTrackEnabled(){return!!this.getCurrentTextTrack()}isTrackerDisabled(){return!this.srcMediaData||!this.srcMediaData.mediaData||(Array.isArray(this.srcMediaData.disableTrackers)?!!this.srcMediaData.disableTrackers.find(e=>e.toLowerCase()===h6.name.toLowerCase()):!!this.srcMediaData.disableTrackers)}loadstart(){this.destroy(),this.updateSrcMediaData(this.player.currentSource()),this.isTrackerDisabled()||(this.getInternalLabels(),this.reloadTagCommanderContainer(),this.notify("buffer_start"),this.hasStarted=!1)}loadeddata(){this.notify("init"),this.initialized=!0,this.notify("buffer_stop")}log(e,t,i="log"){this.debug()&&console[i](`SRGAnalytics:${e}`,t,window.tc_vars)}notify(e,t){if(this.isTrackerDisabled())return;try{this.flush()}catch(t){this.log(e,t,"error")}let i=Object.assign({},this.getEventLabels(e),t);this.log(e,i);try{window.tc_events_11?window.tc_events_11(this.player.el(),e,i):this.pendingQueue.push({action:e,labels:i})}catch(t){this.log(e,t,"error")}}static now(){return(Date.now()/1e3).toFixed(0)}play(){this.hasStarted||(this.hasStarted=!0),this.startPlaybackSession||this.isMediaOnDemand()||(this.startPlaybackSession=h6.now()),0===this.mediaSession&&(this.mediaSession=h6.now(),this.heartBeat(),this.uptime()),this.timeUpdate(),this.notify("play"),this.isSeeking&&(this.isSeeking=!1)}pause(){if(this.isMediaOnDemand()||(this.elapsedPlaybackTime=this.getElapsedPlayingTime(),this.startPlaybackSession=0),!this.player.seeking()&&!this.isMediaLive()&&this.player.currentTime(){this.player.paused()||this.isMediaOnDemand()||this.notify("uptime")};this.uptimeTimeoutId=setTimeout(()=>{e(),this.uptimeIntervalId=setInterval(()=>{e()},6e4)},3e4)}waiting(){if(!this.initialized||this.isWaiting)return;let e=()=>{this.isWaiting=!1,this.notify("buffer_stop")};this.isWaiting=!0,this.notify("buffer_start"),og.browser.IS_ANY_SAFARI?this.player.one(h5,e):this.player.one(h2,e)}}var h7=class{findChapterByUrn(e){if(this.chapterList){let[t]=this.chapterList.filter(t=>t.urn===e);return t}}findMainSegment(){if(!this.segmentUrn)return;let[e]=this.getMainSegments().filter(e=>e.urn===this.segmentUrn);return e}findResourceListByUrn(e){let t=this.findChapterByUrn(e);if(t)return t.resourceList||[]}getChapters(){let e="AUDIO";return this.getMainChapter().mediaType===e?[]:this.chapterList.filter(({mediaType:t})=>t!==e)}getFilteredExternalSubtitles(){let{subtitleList:e}=this.getMainChapter(),[{subtitleInformationList:t}={}]=this.getResourceList().filter(({subtitleInformationList:e})=>e);if(!e)return[];let i=e.filter(e=>"TTML"!==e.format);return e&&!t?i:i.filter(e=>!t.find(t=>t.locale===e.locale&&e.type===t.type))}getMainBlockReason(){let e=this.getMainChapter();if(!e)return;let{blockReason:t}=e;return!t&&new Datee.blockReason)}getMainChapter(){return this.mainChapter||(this.mainChapter=this.findChapterByUrn(this.chapterUrn)),!this.mainChapter&&this.chapterList&&this.chapterList.length>0&&([this.mainChapter]=this.chapterList),this.mainChapter}getMainChapterImageUrl(){let e=this.getMainChapter();if(e&&e.imageUrl)return e.imageUrl}getMainResources(){let e=this.getResourceList();if(e&&e.length)return e.map(e=>({analyticsData:this.getMergedAnalyticsData(e.analyticsData),analyticsMetadata:this.getMergedAnalyticsMetadata(e.analyticsMetadata),blockReason:this.getMainChapter().blockReason,blockedSegments:this.getMainBlockedSegments(),imageUrl:this.getMainChapterImageUrl(),chapters:this.getChapters(),drmList:e.drmList,dvr:e.dvr,eventData:this.getMainChapter().eventData,id:this.getMainChapter().id,imageCopyright:this.getMainChapter().imageCopyright,intervals:this.getMainTimeIntervals(),live:e.live,mediaType:this.getMainChapter().mediaType,mimeType:e.mimeType,presentation:e.presentation,quality:e.quality,streaming:e.streaming,streamOffset:e.streamOffset,subtitles:this.getFilteredExternalSubtitles(),title:this.getMainChapter().title,tokenType:e.tokenType,url:e.url,urn:this.chapterUrn,vendor:this.getMainChapter().vendor}))}getMainSegments(){let e=this.getMainChapter();return!this.mainSegments&&e&&e.segmentList&&(this.mainSegments=e.segmentList),this.mainSegments||[]}getMainTimeIntervals(){let{timeIntervalList:e=[]}=this.getMainChapter()||{};return e}getMainValidFromDate(){let e=this.getMainChapter();if(!e)return new Date(0);let{validFrom:t}=e;if(t)return new Date(t)}getMergedAnalyticsData(e){return{...this.analyticsData,...this.getMainChapter().analyticsData,...e}}getMergedAnalyticsMetadata(e){return{...this.analyticsMetadata,...this.getMainChapter().analyticsMetadata,...e}}getResourceList(){let{resourceList:e}=this.getMainChapter();return e||[]}},h9={};h9=JSON.parse('{"Play":"Wiedergabe","Pause":"Pause","Replay":"Erneut abspielen","Current Time":"Aktueller Zeitpunkt","Duration":"Dauer","Remaining Time":"Verbleibende Zeit","Stream Type":"Streamtyp","LIVE":"LIVE","Loaded":"Geladen","Progress":"Status","Fullscreen":"Vollbild","Exit Fullscreen":"Vollbildmodus beenden","Mute":"Stumm schalten","Unmute":"Ton einschalten","Playback Rate":"Wiedergabegeschwindigkeit","Subtitles":"Untertitel","subtitles off":"Untertitel aus","Captions":"Untertitel","captions off":"Untertitel aus","Chapters":"Kapitel","You aborted the media playback":"Sie haben die Videowiedergabe abgebrochen.","A network error caused the media download to fail part-way.":"Der Videodownload ist aufgrund eines Netzwerkfehlers fehlgeschlagen.","The media could not be loaded, either because the server or network failed or because the format is not supported.":"Das Video konnte nicht geladen werden, da entweder ein Server- oder Netzwerkfehler auftrat oder das Format nicht unterstützt wird.","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"Die Videowiedergabe wurde entweder wegen eines Problems mit einem beschädigten Video oder wegen verwendeten Funktionen, die vom Browser nicht unterstützt werden, abgebrochen.","No compatible source was found for this media.":"Für dieses Video wurde keine kompatible Quelle gefunden.","Play Video":"Video abspielen","Close":"Schließen","Modal Window":"Modales Fenster","This is a modal window":"Dies ist ein modales Fenster","This modal can be closed by pressing the Escape key or activating the close button.":"Durch Drücken der Esc-Taste bzw. Betätigung der Schaltfläche \\"Schließen\\" wird dieses modale Fenster geschlossen.",", opens captions settings dialog":", öffnet Einstellungen für Untertitel",", opens subtitles settings dialog":", öffnet Einstellungen für Untertitel",", selected":", ausgewählt","captions settings":"Untertiteleinstellungen","subtitles settings":"Untertiteleinstellungen","descriptions settings":"Einstellungen für Beschreibungen","Close Modal Dialog":"Modales Fenster schließen","Descriptions":"Beschreibungen","descriptions off":"Beschreibungen aus","The media is encrypted and we do not have the keys to decrypt it.":"Die Entschlüsselungsschlüssel für den verschlüsselten Medieninhalt sind nicht verfügbar.",", opens descriptions settings dialog":", öffnet Einstellungen für Beschreibungen","Audio Track":"Tonspur","Text":"Schrift","White":"Weiß","Black":"Schwarz","Red":"Rot","Green":"Grün","Blue":"Blau","Yellow":"Gelb","Magenta":"Magenta","Cyan":"Türkis","Background":"Hintergrund","Window":"Fenster","Transparent":"Durchsichtig","Semi-Transparent":"Halbdurchsichtig","Opaque":"Undurchsichtig","Font Size":"Schriftgröße","Text Edge Style":"Textkantenstil","None":"Kein","Raised":"Erhoben","Depressed":"Gedrückt","Uniform":"Uniform","Drop shadow":"Schlagschatten","Font Family":"Schriftfamilie","Proportional Sans-Serif":"Proportionale Sans-Serif","Monospace Sans-Serif":"Monospace Sans-Serif","Proportional Serif":"Proportionale Serif","Monospace Serif":"Monospace Serif","Casual":"Zwanglos","Script":"Schreibschrift","Small Caps":"Small-Caps","Reset":"Zurücksetzen","restore all settings to the default values":"Alle Einstellungen auf die Standardwerte zurücksetzen","Done":"Fertig","Caption Settings Dialog":"Einstellungsdialog für Untertitel","Beginning of dialog window. Escape will cancel and close the window.":"Anfang des Dialogfensters. Esc bricht ab und schließt das Fenster.","End of dialog window.":"Ende des Dialogfensters.","Audio Player":"Audio-Player","Video Player":"Video-Player","Progress Bar":"Fortschrittsbalken","progress bar timing: currentTime={1} duration={2}":"{1} von {2}","Volume Level":"Lautstärke","{1} is loading.":"{1} wird geladen.","Seek to live, currently behind live":"Zur Live-Übertragung wechseln. Aktuell wird es nicht live abgespielt.","Seek to live, currently playing live":"Zur Live-Übertragung wechseln. Es wird aktuell live abgespielt.","Exit Picture-in-Picture":"Bild-im-Bild-Modus beenden","Picture-in-Picture":"Bild-im-Bild-Modus","No content":"Kein Inhalt","Color":"Farbe","Opacity":"Deckkraft","Text Background":"Texthintergrund","Caption Area Background":"Hintergrund des Untertitelbereichs","Playing in Picture-in-Picture":"Wird im Bild-im-Bild-Modus wiedergegeben","Skip forward {1} seconds":"{1} Sekunden vorwärts","Skip backward {1} seconds":"{1} Sekunden zurück"}');var ce={};ce=JSON.parse('{"AGERATING12":"Aus Gründen des Jugendschutzes steht dieser Inhalt nur zwischen 20:00 und 06:00 Uhr zur Verfügung.","AGERATING18":"Aus Gründen des Jugendschutzes steht dieser Inhalt nur zwischen 23:00 und 05:00 Uhr zur Verfügung.","COMMERCIAL":"Die Werbung wurde übersprungen.","ENDDATE":"Dieser Inhalt ist nicht mehr verfügbar.","GEOBLOCK":"Dieser Inhalt ist ausserhalb der Schweiz nicht verfügbar.","LEGAL":"Dieser Inhalt ist aus rechtlichen Gründen nicht verfügbar.","STARTDATE":"Dieser Inhalt ist noch nicht verfügbar. Bitte probieren Sie es später noch einmal.","UNKNOWN":"Dieser Inhalt ist nicht verfügbar."}'),og.addLanguage("de",{...h9,...ce});var ct={};ct=JSON.parse('{"Audio Player":"Audio Player","Video Player":"Video Player","Play":"Play","Pause":"Pause","Replay":"Replay","Current Time":"Current Time","Duration":"Duration","Remaining Time":"Remaining Time","Stream Type":"Stream Type","LIVE":"LIVE","Seek to live, currently behind live":"Seek to live, currently behind live","Seek to live, currently playing live":"Seek to live, currently playing live","Loaded":"Loaded","Progress":"Progress","Progress Bar":"Progress Bar","progress bar timing: currentTime={1} duration={2}":"{1} of {2}","Fullscreen":"Fullscreen","Exit Fullscreen":"Exit Fullscreen","Mute":"Mute","Unmute":"Unmute","Playback Rate":"Playback Rate","Subtitles":"Subtitles","subtitles off":"subtitles off","Captions":"Captions","captions off":"captions off","Chapters":"Chapters","Descriptions":"Descriptions","descriptions off":"descriptions off","Audio Track":"Audio Track","Volume Level":"Volume Level","You aborted the media playback":"You aborted the media playback","A network error caused the media download to fail part-way.":"A network error caused the media download to fail part-way.","The media could not be loaded, either because the server or network failed or because the format is not supported.":"The media could not be loaded, either because the server or network failed or because the format is not supported.","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.","No compatible source was found for this media.":"No compatible source was found for this media.","The media is encrypted and we do not have the keys to decrypt it.":"The media is encrypted and we do not have the keys to decrypt it.","Play Video":"Play Video","Close":"Close","Close Modal Dialog":"Close Modal Dialog","Modal Window":"Modal Window","This is a modal window":"This is a modal window","This modal can be closed by pressing the Escape key or activating the close button.":"This modal can be closed by pressing the Escape key or activating the close button.",", opens captions settings dialog":", opens captions settings dialog",", opens subtitles settings dialog":", opens subtitles settings dialog",", opens descriptions settings dialog":", opens descriptions settings dialog",", selected":", selected","captions settings":"captions settings","subtitles settings":"subtitles settings","descriptions settings":"descriptions settings","Text":"Text","White":"White","Black":"Black","Red":"Red","Green":"Green","Blue":"Blue","Yellow":"Yellow","Magenta":"Magenta","Cyan":"Cyan","Background":"Background","Window":"Window","Transparent":"Transparent","Semi-Transparent":"Semi-Transparent","Opaque":"Opaque","Font Size":"Font Size","Text Edge Style":"Text Edge Style","None":"None","Raised":"Raised","Depressed":"Depressed","Uniform":"Uniform","Drop shadow":"Drop shadow","Font Family":"Font Family","Proportional Sans-Serif":"Proportional Sans-Serif","Monospace Sans-Serif":"Monospace Sans-Serif","Proportional Serif":"Proportional Serif","Monospace Serif":"Monospace Serif","Casual":"Casual","Script":"Script","Small Caps":"Small Caps","Reset":"Reset","restore all settings to the default values":"restore all settings to the default values","Done":"Done","Caption Settings Dialog":"Caption Settings Dialog","Beginning of dialog window. Escape will cancel and close the window.":"Beginning of dialog window. Escape will cancel and close the window.","End of dialog window.":"End of dialog window.","{1} is loading.":"{1} is loading.","Exit Picture-in-Picture":"Exit Picture-in-Picture","Picture-in-Picture":"Picture-in-Picture","No content":"No content","Color":"Color","Opacity":"Opacity","Text Background":"Text Background","Caption Area Background":"Caption Area Background","Playing in Picture-in-Picture":"Playing in Picture-in-Picture","Skip backward {1} seconds":"Skip backward {1} seconds","Skip forward {1} seconds":"Skip forward {1} seconds"}');var ci={};ci=JSON.parse('{"AGERATING12":"To protect children this content is only available between 8PM and 6AM.","AGERATING18":"To protect children this content is only available between 10PM and 5AM.","COMMERCIAL":"This commercial content is not available.","ENDDATE":"This content is not available anymore.","GEOBLOCK":"This content is not available outside Switzerland.","LEGAL":"This content is not available due to legal restrictions.","STARTDATE":"This content is not available yet.","UNKNOWN":"This content is not available."}'),og.addLanguage("en",{...ct,...ci});var cr={};cr=JSON.parse('{"Audio Player":"Lecteur audio","Video Player":"Lecteur vidéo","Play":"Lecture","Pause":"Pause","Replay":"Revoir","Current Time":"Temps actuel","Duration":"Durée","Remaining Time":"Temps restant","Stream Type":"Type de flux","LIVE":"EN DIRECT","Seek to live, currently behind live":"Rechercher le direct, actuellement après le direct","Seek to live, currently playing live":"Rechercher le direct, le direct actuellement en cours de lecture","Loaded":"Chargé","Progress":"Progression","Progress Bar":"Barre de progression","progress bar timing: currentTime={1} duration={2}":"{1} de {2}","Fullscreen":"Plein écran","Exit Fullscreen":"Fenêtré","Mute":"Mettre en sourdine","Unmute":"Activer le son","Playback Rate":"Vitesse de lecture","Subtitles":"Sous-titres","subtitles off":"Sous-titres désactivés","Captions":"Sous-titres transcrits","captions off":"Sous-titres transcrits désactivés","Chapters":"Chapitres","Descriptions":"Descriptions","descriptions off":"descriptions désactivées","Audio Track":"Piste audio","Volume Level":"Niveau de volume","You aborted the media playback":"Vous avez interrompu la lecture de la vidéo.","A network error caused the media download to fail part-way.":"Une erreur de réseau a interrompu le téléchargement de la vidéo.","The media could not be loaded, either because the server or network failed or because the format is not supported.":"Cette vidéo n\'a pas pu être chargée, soit parce que le serveur ou le réseau a échoué ou parce que le format n\'est pas reconnu.","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"La lecture de la vidéo a été interrompue à cause d\'un problème de corruption ou parce que la vidéo utilise des fonctionnalités non prises en charge par votre navigateur.","No compatible source was found for this media.":"Aucune source compatible n\'a été trouvée pour cette vidéo.","The media is encrypted and we do not have the keys to decrypt it.":"Le média est chiffré et nous n\'avons pas les clés pour le déchiffrer.","Play Video":"Lire la vidéo","Close":"Fermer","Close Modal Dialog":"Fermer la boîte de dialogue modale","Modal Window":"Fenêtre modale","This is a modal window":"Ceci est une fenêtre modale","This modal can be closed by pressing the Escape key or activating the close button.":"Ce modal peut être fermé en appuyant sur la touche Échap ou activer le bouton de fermeture.",", opens captions settings dialog":", ouvrir les paramètres des sous-titres transcrits",", opens subtitles settings dialog":", ouvrir les paramètres des sous-titres",", opens descriptions settings dialog":", ouvrir les paramètres des descriptions",", selected":", sélectionné","captions settings":"Paramètres des sous-titres transcrits","subtitles settings":"Paramètres des sous-titres","descriptions settings":"Paramètres des descriptions","Text":"Texte","White":"Blanc","Black":"Noir","Red":"Rouge","Green":"Vert","Blue":"Bleu","Yellow":"Jaune","Magenta":"Magenta","Cyan":"Cyan","Background":"Arrière-plan","Window":"Fenêtre","Transparent":"Transparent","Semi-Transparent":"Semi-transparent","Opaque":"Opaque","Font Size":"Taille des caractères","Text Edge Style":"Style des contours du texte","None":"Aucun","Raised":"Élevé","Depressed":"Enfoncé","Uniform":"Uniforme","Drop shadow":"Ombre portée","Font Family":"Famille de polices","Proportional Sans-Serif":"Polices à chasse variable sans empattement (Proportional Sans-Serif)","Monospace Sans-Serif":"Polices à chasse fixe sans empattement (Monospace Sans-Serif)","Proportional Serif":"Polices à chasse variable avec empattement (Proportional Serif)","Monospace Serif":"Polices à chasse fixe avec empattement (Monospace Serif)","Casual":"Manuscrite","Script":"Scripte","Small Caps":"Petites capitales","Reset":"Réinitialiser","restore all settings to the default values":"Restaurer tous les paramètres aux valeurs par défaut","Done":"Terminé","Caption Settings Dialog":"Boîte de dialogue des paramètres des sous-titres transcrits","Beginning of dialog window. Escape will cancel and close the window.":"Début de la fenêtre de dialogue. La touche d\'échappement annulera et fermera la fenêtre.","End of dialog window.":"Fin de la fenêtre de dialogue.","Exit Picture-in-Picture":"Quitter le mode image dans l\'image","Picture-in-Picture":"Image dans l\'image","{1} is loading.":"{1} en cours de chargement.","No content":"Aucun contenu","Color":"Couleur","Opacity":"Opacité","Text Background":"Arrière-plan du texte","Caption Area Background":"Arrière-plan de la zone de sous-titre","Skip backward {1} seconds":"Reculer de {1} secondes","Skip forward {1} seconds":"Avancer de {1} secondes"}');var cs={};cs=JSON.parse('{"AGERATING12":"Pour protéger les enfants, ce contenu est accessible entre 20h et 6h.","AGERATING18":"Pour protéger les enfants, ce contenu est accessible entre 23h et 5h.","COMMERCIAL":"Ce contenu n\'est actuellement pas disponible.","ENDDATE":"Ce contenu n\'est plus disponible.","GEOBLOCK":"La RTS ne dispose pas des droits de diffusion en dehors de la Suisse.","LEGAL":"Pour des raisons juridiques, ce contenu n\'est pas disponible.","STARTDATE":"Ce contenu n\'est pas encore disponible. Veuillez réessayer plus tard.","UNKNOWN":"Ce contenu n\'est actuellement pas disponible."}'),og.addLanguage("fr",{...cr,...cs});var cn={};cn=JSON.parse('{"Audio Player":"Lettore audio","Video Player":"Lettore video","Play":"Play","Pause":"Pausa","Replay":"Replay","Current Time":"Orario attuale","Duration":"Durata","Remaining Time":"Tempo rimanente","Stream Type":"Tipo di streaming","LIVE":"LIVE","Loaded":"Caricato","Progress":"Stato","Progress Bar":"Barra di avanzamento","progress bar timing: currentTime={1} duration={2}":"{1} di {2}","Fullscreen":"Schermo intero","Exit Fullscreen":"Chiudi Schermo intero","Mute":"Disattiva l’audio","Unmute":"Attiva l’audio","Playback Rate":"Velocità di riproduzione","Subtitles":"Sottotitoli","subtitles off":"Senza sottotitoli","Captions":"Didascalie","captions off":"Senza didascalie","Chapters":"Capitolo","Descriptions":"Descrizioni","descriptions off":"Descrizioni disattivate","Audio Track":"Traccia audio","Volume Level":"Livello del volume","You aborted the media playback":"La riproduzione del contenuto multimediale è stata interrotta.","A network error caused the media download to fail part-way.":"Il download del contenuto multimediale è stato interrotto a causa di un problema rete.","The media could not be loaded, either because the server or network failed or because the format is not supported.":"Il contenuto multimediale non può essere caricato a causa di un errore nel server o nella rete o perché il formato non viene supportato.","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"La riproduzione del contenuto multimediale è stata interrotta a causa di un file danneggiato o per l’utilizzo di impostazioni non supportate dal browser.","No compatible source was found for this media.":"Non ci sono fonti compatibili per questo contenuto multimediale.","The media is encrypted and we do not have the keys to decrypt it.":"Il contenuto multimediale è criptato e non disponiamo delle chiavi per decifrarlo.","Play Video":"Riproduci il video","Close":"Chiudi","Close Modal Dialog":"Chiudi la finestra di dialogo","Modal Window":"Finestra di dialogo","This is a modal window":"Questa è una finestra di dialogo","This modal can be closed by pressing the Escape key or activating the close button.":"Questa finestra di dialogo può essere chiusa premendo sul tasto Esc o attivando il pulsante di chiusura.",", opens captions settings dialog":", aprire le impostazioni delle didascalie",", opens subtitles settings dialog":", aprire le impostazioni dei sottotitoli",", opens descriptions settings dialog":", aprire le impostazioni delle descrizioni",", selected":", selezionato","captions settings":"Impostazioni didascalie","subtitles settings":"Impostazioni sottotitoli","descriptions settings":"Impostazioni descrizioni","Text":"Testo","White":"Bianco","Black":"Nero","Red":"Rosso","Green":"Verde","Blue":"Blu","Yellow":"Giallo","Magenta":"Magenta","Cyan":"Ciano","Background":"Sfondo","Window":"Finestra","Transparent":"Trasparente","Semi-Transparent":"Semi-Trasparente","Opaque":"Opaco","Font Size":"Dimensione dei caratteri","Text Edge Style":"Stile dei bordi del testo","None":"Nessuno","Uniform":"Uniforme","Drop shadow":"Ombra","Font Family":"Carattere","Proportional Sans-Serif":"Sans-Serif proporzionale","Monospace Sans-Serif":"Sans-Serif monospaziato","Proportional Serif":"Serif proporzionale","Monospace Serif":"Serif monospaziato","Small Caps":"Maiuscoletto","Reset":"Reinizializza","restore all settings to the default values":"Ripristina i valori predefiniti per tutti i parametri","Done":"Fatto","Caption Settings Dialog":"Finestra di dialogo dei parametri della trascrizione dei sottotitoli","Beginning of dialog window. Escape will cancel and close the window.":"Inizio della finestra di dialogo. Il tasto Esc annullerà l’operazione e chiuderà la finestra.","End of dialog window.":"Fine della finestra di dialogo.","{1} is loading.":"{1} in fase di caricamento.","Exit Picture-in-Picture":"Esci dalla modalità Picture-in-Picture","Picture-in-Picture":"Picture-in-Picture","Color":"Colore","Opacity":"Opacità","Text Background":"Sfondo testo","Caption Area Background":"Sfondo area sottotitoli","Skip forward {1} seconds":"Avanti {1} secondi","Skip backward {1} seconds":"Indietro {1} secondi"}');var ca={};ca=JSON.parse('{"AGERATING12":"Per proteggere i bambini, questo media è disponibile solo fra le 20 e le 6.","AGERATING18":"Per proteggere i bambini, questo media è disponibile solo fra le 23 le 5.","COMMERCIAL":"Questo contenuto commerciale non è disponibile.","ENDDATE":"Questo media non è più disponibile.","GEOBLOCK":"Questo media non è disponibile fuori dalla Svizzera.","LEGAL":"Il contenuto non è fruibile a causa di restrizioni legali.","STARTDATE":"Il contenuto non è ancora disponibile. Per cortesia prova più tardi.","UNKNOWN":"Questo media non è disponibile."}'),og.addLanguage("it",{...cn,...ca});var co={};co=JSON.parse('{"Audio Player":"Audio-Player","Video Player":"Video-Player","Play":"Laschar ir","Pause":"Pausa","Replay":"Mussar danovamain","Current Time":"Temp actual","Duration":"Durada","Remaining Time":"Temp restant","Stream Type":"Tip dal stream","LIVE":"LIVE","Loaded":"Chargià","Progress":"Progress","Progress Bar":"Bar da progessiun","progress bar timing: currentTime={1} duration={2}":"{1} da {2}","Fullscreen":"Entir visur","Non-Fullscreen":"Betg entir visur","Mute":"Senza tun","Unmute":"Cun tun","Playback Rate":"Tempo ","Subtitles":"Suttitels","subtitles off":"senza suttitels","Captions":"Suttitels","captions off":"senza suttitels","Chapters":"Chapitels","Descriptions":"Descripziuns","descriptions off":"senza descripziuns","Audio Track":"Piese audio","Volume Level":"Nivel dal volumen","You aborted the media playback":"Vus avais interrut il vdieo","A network error caused the media download to fail part-way.":"In sbagl en la rait ha impedì il download","The media could not be loaded, either because the server or network failed or because the format is not supported.":"Il video n\'è betg chargià - ubain per in sbagl da server / da la rait, ubain ch\'il format n\'è betg cumpatibel.","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"Il video è interrut: Ubain ch\'il video è donnegià, ubain che funcziuns n\'èn betg cumpatiblas.","No compatible source was found for this media.":"Chattà nagina funtauna cumpatibla per quest video.","The media is encrypted and we do not have the keys to decrypt it.":"Il video è codifitgà da moda nunenconuschenta.","Play Video":"Aviar video","Close":"Serrar","Close Modal Dialog":"Serrar la fanestra modala","Modal Window":"Fanestra modala","This is a modal window":"Quai è ina fanestra modala","This modal can be closed by pressing the Escape key or activating the close button.":"Questa fanestra modala pudais serrar cun la tasta \\"Escape\\" ubain cun il buttun.",", opens captions settings dialog":", avra opziuns per ils suttitels",", opens subtitles settings dialog":", avra opziuns per ils suttitels",", opens descriptions settings dialog":", avra opziuns per la descripziun",", selected":", selecziunà","captions settings":"opziuns per ils suttitels","subtitles settings":"opziuns per ils suttitels","descriptions settings":"opziuns per la descripziun","Text":"Text","White":"Alv","Black":"Nair","Red":"Cotschn","Green":"Verd","Blue":"Blau","Yellow":"Mellen","Magenta":"Magenta","Cyan":"Cyan","Background":"Fund","Window":"Fanestra","Transparent":"Transparent","Semi-Transparent":"Mez transparent","Opaque":"Betg transparent","Font Size":"Grandezza dal text","Text Edge Style":"Stil dal text","None":"Nagin","Raised":"Auzà","Depressed":"Sbassà","Uniform":"Uniform","Dropshadow":"Sumbriva","Font Family":"Scrittira","Proportional Sans-Serif":"Proportionale Sans-Serif","Monospace Sans-Serif":"Monospace Sans-Serif","Proportional Serif":"Proportionale Serif","Monospace Serif":"Monospace Serif","Casual":"Casual","Script":"Script","Small Caps":"Bustabs pitschens","Reset":"Da nov","restore all settings to the default values":"Enavos tar las opziuns da standard","Done":"Fatg","Caption Settings Dialog":"Opziuns per suttitels","Beginning of dialog window. Escape will cancel and close the window.":"Entschatta da la fanestra da dialog. Escape stizza e serra la fanestra.","End of dialog window.":"Fin da la fanestra da dialog.","AGERATING12":"Per proteger uffants, è quest cuntegn disponibel mo tranter las 20.00 e las 06.00.","AGERATING18":"Per proteger uffants, è quest cuntegn disponibel mo tranter las 23.00 e las 05.00.","COMMERCIAL":"Quest medium commerzial n\'è betg disponibel.","ENDDATE":"Quest cuntegn n\'è betg pli disponibel.","GEOBLOCK":"Quest cuntegn n\'è betg disponibel ordaifer la Svizra.","LEGAL":"Quest cuntegn n\'è betg disponibel perquai ch\'el è scadì.","STARTDATE":"Quest cuntegn n\'è betg anc disponibel. Empruvai pli tard.","UNKNOWN":"Quest cuntegn n\'è betg disponibel."}'),og.addLanguage("rm",{...co});class cl{static addBlockedSegments(e,t=[]){let i="srgssr-blocked-segments",r=e.textTracks().getTrackById(i);if(r&&e.textTracks().removeTrack(r),!Array.isArray(t)||!t.length)return;let s=t.filter(e=>e.blockReason);s.length&&cl.createTextTrack(e,i).then(t=>{s.forEach(e=>{cl.addTextTrackCue(t,e)}),e.textTracks().addTrack(t)})}static addRemoteTextTracks(e,t=[]){Array.isArray(t)&&t.forEach(({type:t,language:i,locale:r,url:s})=>{e.addRemoteTextTrack({kind:"SDH"===t?"captions":"subtitles",label:i,language:r,src:s})})}static addTextTrackCue(e,t){let i=(Number.isFinite(t.markIn)?t.markIn:t.fullLengthMarkIn)/1e3,r=(Number.isFinite(t.markOut)?t.markOut:t.fullLengthMarkOut)/1e3;e.addCue(new VTTCue(i,r,JSON.stringify(t)))}static addTextTracks(e,{mediaData:t}){cl.addRemoteTextTracks(e,t.subtitles),cl.addChapters(e,t.urn,t.chapters),cl.addBlockedSegments(e,t.blockedSegments),cl.addIntervals(e,t.intervals)}static addChapters(e,t,i=[]){let r="srgssr-chapters",s=e.textTracks().getTrackById(r);s&&e.textTracks().removeTrack(s),Array.isArray(i)&&i.length&&cl.createTextTrack(e,r).then(r=>{i.forEach(e=>{t===e.fullLengthUrn&&cl.addTextTrackCue(r,e)}),e.textTracks().addTrack(r)})}static addIntervals(e,t=[]){let i="srgssr-intervals",r=e.textTracks().getTrackById(i);r&&e.textTracks().removeTrack(r),Array.isArray(t)&&t.length&&cl.createTextTrack(e,i).then(i=>{t.forEach(e=>{cl.addTextTrackCue(i,e)}),e.textTracks().addTrack(i)})}static blockingReason(e,t){if(!t.mediaData.blockReason)return;let i=e.localize(t.mediaData.blockReason);return cl.error(e,{code:MediaError.MEDIA_ERR_ABORTED,message:i,metadata:{errorType:t.mediaData.blockReason,src:t}}),!0}static async composeAkamaiResources(e=[]){return hY.hasToken(e)?hY.tokenizeSources(e):Promise.resolve(e)}static composeKeySystemsResources(e=[]){return hG.hasDrm(e),e.map(e=>({...e,...hG.buildKeySystems(e.drmList)}))}static composeMainResources(e){return cl.composeAkamaiResources(cl.composeKeySystemsResources(cl.filterIncompatibleResources(e.getMainResources())))}static composeSrcMediaData({mediaData:e,disableTrackers:t},i){let{url:r,mimeType:s,keySystems:n,...a}=og.obj.merge(i,e);return{src:r,type:s,keySystems:n,disableTrackers:t,mediaData:a}}static createTextTrack(e,t){return new Promise(i=>{setTimeout(()=>{i(new og.TextTrack({id:t,kind:"metadata",label:t,tech:e.tech(!0)}))},100)})}static cuechangeEventProxy(e){e.textTracks().on("addtrack",({track:t})=>{["srgssr-chapters","srgssr-intervals"].includes(t.id)&&t.on("cuechange",()=>{let[i]=Array.from(t.activeCues),r=t.id.includes("srgssr-chapters")?"srgssr/chapter":"srgssr/interval";e.trigger({type:r,data:i})})})}static dataProvider(e){if(!e.options().srgOptions.dataProvider){let{dataProviderHost:t,dataProviderUrlHandler:i}=e.options().srgOptions,r=new hV(t).handleRequest(i);e.options({srgOptions:{dataProvider:r}})}return e.options().srgOptions.dataProvider}static dataProviderError(e,t){if(!t)return;let i=t.statusText?t.statusText:t.message;return cl.error(e,{code:0,message:e.localize("UNKNOWN"),metadata:{errorType:"UNKNOWN",urn:e.src(),status:t.status,statusText:i,url:t.url}}),!0}static error(e,{code:t,message:i,metadata:r}){e.error(null),e.error({code:t,message:i,metadata:r})}static filterIncompatibleResources(e=[]){return e.filter(e=>!["RTMP","HDS"].includes(e.streaming))}static getBlockedSegment(e){let t=e.textTracks().getTrackById("srgssr-blocked-segments");if(!t)return;let[i]=Array.from(t.activeCues);return i}static getBlockedSegmentByTime(e,t){let i=cl.getBlockedSegment(e);if(i)return t>=i.startTime&&te===t)||e[0]}static async getSrcMediaObj(e,t){let{src:i,...r}=t,s=await cl.getMediaComposition(i,cl.dataProvider(e)),n=await cl.composeMainResources(s),a=cl.getMediaData(n);return cl.composeSrcMediaData(r,a)}static handleCurrentTime(e,t){let i=cl.getBlockedSegmentByTime(e,t);if(!i||!Number.isFinite(i.endTime))return t;let r=i.endTime+.1;return e.trigger({type:"srgssr/blocked-segment",data:i}),e.currentTime(r),r}static handleSetCurrentTime(e,t){let{endTime:i}=cl.getBlockedSegmentByTime(e,t)||{};return Number.isFinite(i)?i:t}static async handleSetSource(e,t,i){try{let r=await cl.getSrcMediaObj(e,t);if(cl.srgAnalytics(e),cl.updateTitleBar(e,r),cl.updatePoster(e,r),cl.blockingReason(e,r))return;return cl.addTextTracks(e,r),i(null,r)}catch(t){if(cl.dataProviderError(e,t))return;return i(t)}}static srgAnalytics(e){if(!1!==e.options().trackers.srgAnalytics&&!e.options().trackers.srgAnalytics){let t=new h6(e,{debug:e.debug(),playerVersion:og.VERSION.pillarbox,tagCommanderScriptURL:e.options().srgOptions.tagCommanderScriptURL});e.options({trackers:{srgAnalytics:t}})}}static updatePoster(e,t,i=hz){e.poster(i.scale({url:t.mediaData.imageUrl}))}static updateTitleBar(e,t){e.titleBar&&e.titleBar.update({title:t.mediaData.vendor,description:t.mediaData.title})}static middleware(e){return cl.cuechangeEventProxy(e),{currentTime:t=>cl.handleCurrentTime(e,t),setCurrentTime:t=>cl.handleSetCurrentTime(e,t),setSource:async(t,i)=>cl.handleSetSource(e,t,i)}}}og.use("srgssr/urn",cl.middleware),og.options.srgOptions={dataProvider:void 0,dataProviderHost:void 0,dataProviderUrlHandler:void 0,tagCommanderScriptURL:void 0};const cu=new URLSearchParams(location.search),cd=cu.has("audioOnlyMode");let ch=cu.get("currentTime");const cc=cu.has("debug"),cp=cu.get("ilHost")||void 0,cm=cu.get("language"),cg=cu.has("resize");let cf=cu.get("urn");const cy=cu.has("urlHandler")?e=>e:void 0;if(cf||(cf="urn:rts:video:9883196",ch=911),window.mediaExamples={_blockedSegmentAndChapters:{label:"Blocked segment at 761 (12:42) and chapters",src:"urn:rts:video:10894383",type:"srgssr/urn"},_closingCredits:{label:"Closing credits at 2620 (43:40)",src:"urn:rts:video:14683290",type:"srgssr/urn"},_endDate:{label:"Block reason end date",src:"urn:rts:video:10894367",type:"srgssr/urn"},_externalSubtitles:{label:"Remote text tracks",src:"urn:swi:video:48864812",type:"srgssr/urn"},_pyby:{label:"Pierre-Yves joueur de badminton at 911",src:"urn:rts:video:9883196",type:"srgssr/urn"}},window.pillarbox=og,window.videojs=og,window.player=new og("player",{audioOnlyMode:cd,debug:cc,language:cm,srgOptions:{dataProviderHost:cp,dataProviderUrlHandler:cy}}),player.controlBar.lockShowing(),cg){let e=player.el();e.style.resize="both",e.style.overflow="hidden"}player.on("loadedmetadata",()=>{ch&&(player.currentTime(ch),ch=void 0)}),player.on(["srgssr/blocked-segment","srgssr/chapter","srgssr/interval"],({type:e,data:t})=>{if("srgssr/chapter"===e&&!t){player.titleBar.update({title:player.currentSource().mediaData.vendor,description:player.currentSource().mediaData.title});return}if(!t)return;let i=JSON.parse(t.text);if("srgssr/blocked-segment"===e){console.log("%cBlock reason","background-color: red",i.blockReason);return}if("srgssr/chapter"===e){player.titleBar.update({title:i.title,description:i.description}),console.log("%cChapter","background-color: blue",i.title);return}console.log("%cInterval","background-color: green",i.type)}),player.src({src:cf,type:"srgssr/urn"});