(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,[644664,(e,t,i)=>{var s=e.r(494335);t.exports=function(e,t){return void 0===t&&(t=!1),function(i,r,n){if(i)return void e(i);if(r.statusCode>=400&&r.statusCode<=599){var a=n;if(t)if(s.TextDecoder){var o,l=(void 0===(o=r.headers&&r.headers["content-type"])&&(o=""),o.toLowerCase().split(";").reduce(function(e,t){var i=t.split("="),s=i[0],r=i[1];return"charset"===s.trim()?r.trim():e},"utf-8"));try{a=new TextDecoder(l).decode(n)}catch(e){}}else a=String.fromCharCode.apply(null,new Uint8Array(n));e({cause:a});return}e(null,n)}}},287064,(e,t,i)=>{var s=e.r(494335),r=e.r(9255),n=e.r(717290),a=e.r(474016),o=e.r(875715);d.httpHandler=e.r(644664),d.requestInterceptorsStorage=new a,d.responseInterceptorsStorage=new a,d.retryManager=new o;var l=function(e){var t={};return e&&e.trim().split("\n").forEach(function(e){var i=e.indexOf(":"),s=e.slice(0,i).trim().toLowerCase(),r=e.slice(i+1).trim();void 0===t[s]?t[s]=r:Array.isArray(t[s])?t[s].push(r):t[s]=[t[s],r]}),t};function h(e,t,i){var s=e;return n(t)?(i=t,"string"==typeof e&&(s={uri:e})):s=r({},t,{uri:e}),s.callback=i,s}function d(e,t,i){return u(t=h(e,t,i))}function u(e){if(void 0===e.callback)throw Error("callback argument missing");if(e.requestType&&d.requestInterceptorsStorage.getIsEnabled()){var t,i,s,r={uri:e.uri||e.url,headers:e.headers||{},body:e.body,metadata:e.metadata||{},retry:e.retry,timeout:e.timeout},n=d.requestInterceptorsStorage.execute(e.requestType,r);e.uri=n.uri,e.headers=n.headers,e.body=n.body,e.metadata=n.metadata,e.retry=n.retry,e.timeout=n.timeout}var a=!1,o=function(t,i,s){a||(a=!0,e.callback(t,i,s))};function h(t){if(clearTimeout(s),clearTimeout(e.retryTimeout),t instanceof Error||(t=Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,!i&&d.retryManager.getIsEnabled()&&e.retry&&e.retry.shouldRetry()){e.retryTimeout=setTimeout(function(){e.retry.moveToNextAttempt(),e.xhr=p,u(e)},e.retry.getCurrentFuzzedDelay());return}if(e.requestType&&d.responseInterceptorsStorage.getIsEnabled()){var r={headers:v.headers||{},body:v.body,responseUrl:p.responseURL,responseType:p.responseType},n=d.responseInterceptorsStorage.execute(e.requestType,r);v.body=n.body,v.headers=n.headers}return o(t,v)}function c(){if(!i){clearTimeout(s),clearTimeout(e.retryTimeout);var t=e.useXDR&&void 0===p.status?200:1223===p.status?204:p.status,r=v,n=null;if(0!==t?(r={body:function(){var e=void 0;if(e=p.response?p.response:p.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(p),b)try{e=JSON.parse(e)}catch(e){}return e}(),statusCode:t,method:m,headers:{},url:f,rawRequest:p},p.getAllResponseHeaders&&(r.headers=l(p.getAllResponseHeaders()))):n=Error("Internal XMLHttpRequest Error"),e.requestType&&d.responseInterceptorsStorage.getIsEnabled()){var a={headers:r.headers||{},body:r.body,responseUrl:p.responseURL,responseType:p.responseType},h=d.responseInterceptorsStorage.execute(e.requestType,a);r.body=h.body,r.headers=h.headers}return o(n,r,r.body)}}var p=e.xhr||null;p||(p=e.cors||e.useXDR?new d.XDomainRequest:new d.XMLHttpRequest);var f=p.url=e.uri||e.url,m=p.method=e.method||"GET",g=e.body||e.data,y=p.headers=e.headers||{},_=!!e.sync,b=!1,v={body:void 0,headers:{},statusCode:0,method:m,url:f,rawRequest:p};if("json"in e&&!1!==e.json&&(b=!0,y.accept||y.Accept||(y.Accept="application/json"),"GET"!==m&&"HEAD"!==m&&(y["content-type"]||y["Content-Type"]||(y["Content-Type"]="application/json"),g=JSON.stringify(!0===e.json?g:e.json))),p.onreadystatechange=function(){4!==p.readyState||d.responseInterceptorsStorage.getIsEnabled()||setTimeout(c,0)},p.onload=c,p.onerror=h,p.onprogress=function(){},p.onabort=function(){i=!0,clearTimeout(e.retryTimeout)},p.ontimeout=h,p.open(m,f,!_,e.username,e.password),_||(p.withCredentials=!!e.withCredentials),!_&&e.timeout>0&&(s=setTimeout(function(){if(!i){i=!0,p.abort("timeout");var e=Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",h(e)}},e.timeout)),p.setRequestHeader)for(t in y)y.hasOwnProperty(t)&&p.setRequestHeader(t,y[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&&(p.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(p),p.send(g||null),p}t.exports=d,t.exports.default=d,d.XMLHttpRequest=s.XMLHttpRequest||function(){},d.XDomainRequest="withCredentials"in new d.XMLHttpRequest?d.XMLHttpRequest:s.XDomainRequest,function(e,t){for(var i=0;i{function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,s=Array(t);itypeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=function(e){if(e){if("string"==typeof e)return s(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return s(e,void 0)}}(e))){t&&(e=t);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(r);!(i=n()).done;){var a=i.value;try{t=a(t)}catch(e){}}return t},e}()},875715,(e,t,i)=>{var s=function(){function e(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1}var t=e.prototype;return t.getIsEnabled=function(){return this.enabled_},t.enable=function(){this.enabled_=!0},t.disable=function(){this.enabled_=!1},t.reset=function(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1},t.getMaxAttempts=function(){return this.maxAttempts_},t.setMaxAttempts=function(e){this.maxAttempts_=e},t.getDelayFactor=function(){return this.delayFactor_},t.setDelayFactor=function(e){this.delayFactor_=e},t.getFuzzFactor=function(){return this.fuzzFactor_},t.setFuzzFactor=function(e){this.fuzzFactor_=e},t.getInitialDelay=function(){return this.initialDelay_},t.setInitialDelay=function(e){this.initialDelay_=e},t.createRetry=function(e){var t=void 0===e?{}:e,i=t.maxAttempts,s=t.delayFactor,n=t.fuzzFactor,a=t.initialDelay;return new r({maxAttempts:i||this.maxAttempts_,delayFactor:s||this.delayFactor_,fuzzFactor:n||this.fuzzFactor_,initialDelay:a||this.initialDelay_})},e}(),r=function(){function e(e){this.maxAttempts_=e.maxAttempts,this.delayFactor_=e.delayFactor,this.fuzzFactor_=e.fuzzFactor,this.currentDelay_=e.initialDelay,this.currentAttempt_=1}var t=e.prototype;return t.moveToNextAttempt=function(){this.currentAttempt_++;var e=this.currentDelay_*this.delayFactor_;this.currentDelay_=this.currentDelay_+e},t.shouldRetry=function(){return this.currentAttempt_{function s(e,t){return void 0===t&&(t=Object),t&&"function"==typeof t.freeze?t.freeze(e):e}var r=s({HTML:"text/html",isHTML:function(e){return e===r.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),n=s({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===n.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"}),a=/[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]/,o=RegExp("[\\-\\.0-9"+a.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),l=RegExp("^"+a.source+o.source+"*(?::"+a.source+o.source+"*)?$");i.assign=function(e,t){if(null===e||"object"!=typeof e)throw TypeError("target is not an object");for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},i.find=function(e,t,i){if(void 0===i&&(i=Array.prototype),e&&"function"==typeof i.find)return i.find.call(e,t);for(var s=0;s{var s=e.r(689965).freeze;i.XML_ENTITIES=s({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),i.HTML_ENTITIES=s({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",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:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",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:"𝔅",bfr:"𝔟",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:"𝔹",bopf:"𝕓",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:"𝒷",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:"𝔠",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:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",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:"𝔇",dfr:"𝔡",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:"𝔻",dopf:"𝕕",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:"𝒟",dscr:"𝒹",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:"𝔈",efr:"𝔢",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:"𝔼",eopf:"𝕖",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:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",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:"𝒻",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:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",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:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",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:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",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:"𝔏",lfr:"𝔩",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:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",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:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",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:"𝔑",nfr:"𝔫",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:"𝕟",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:"𝒩",nscr:"𝓃",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:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",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:"𝔓",pfr:"𝔭",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:"𝕡",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:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",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:"𝔯",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:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",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:"𝔖",sfr:"𝔰",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:"𝕊",sopf:"𝕤",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:"𝒮",sscr:"𝓈",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:"𝔗",tfr:"𝔱",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:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",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:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",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:"𝒰",uscr:"𝓊",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:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),i.entityMap=i.HTML_ENTITIES},723661,e=>{var t=e.i(391398),i=e.i(145246),s=e.i(191788);e.i(966278);var r=e.i(318398),n=e.i(687385),a=s,o=e.i(770267),l=e.i(519088),h=e.i(565715);let d=new String(".modal.jsx-a0472c3257dc336b{position:relative}.reaction-view-modal{background:0 0;max-width:500px;height:450px;margin:0 auto;position:relative;top:50%;overflow:hidden;transform:translateY(-50%);box-shadow:none!important;border-radius:4px!important}.modal-button__close.jsx-a0472c3257dc336b{color:var(--button-light-disabled-text);z-index:2;border-radius:50%;justify-content:center;align-items:center;width:2.4rem;height:2.4rem;font-size:1rem;display:flex}.modal-title.jsx-a0472c3257dc336b{border-bottom:1px solid var(--border-light);background:var(--color-light-0);justify-content:space-between;align-items:center;padding:10px 15px;font-size:16px;display:flex}.modal-content.jsx-a0472c3257dc336b{background:var(--thread-background);height:calc(100% - 60px);overflow:auto}.reaction-tabs.jsx-a0472c3257dc336b{align-items:center;display:flex}.reaction-tabs.jsx-a0472c3257dc336b .tab.jsx-a0472c3257dc336b{align-items:center;margin-right:15px;display:flex}.reaction-tabs.jsx-a0472c3257dc336b .tab.active.jsx-a0472c3257dc336b{color:var(--active-indicator);border-bottom:2px solid var(--active-indicator)}.reaction-tabs.jsx-a0472c3257dc336b .tab.jsx-a0472c3257dc336b .count.jsx-a0472c3257dc336b{margin-left:3px;font-weight:700}.users.jsx-a0472c3257dc336b{background-color:var(--thread-background);padding:1rem}.user-list.jsx-a0472c3257dc336b{justify-content:space-between;align-items:center;margin-top:24px;display:flex}.user-list.jsx-a0472c3257dc336b:first-child{margin-top:0}.user-info.jsx-a0472c3257dc336b{flex-direction:row;justify-content:center;align-items:center;display:flex}.user-avatar.jsx-a0472c3257dc336b{border:1px solid var(--color-light-1);background-position:50%;background-repeat:no-repeat;background-size:cover;background-color:var(--avatar-background-dark);border-radius:50%;width:40px;height:40px;margin-right:12px;position:relative}.user-name-rank.jsx-a0472c3257dc336b{flex-direction:column;justify-content:center;display:flex}.user-name.jsx-a0472c3257dc336b{color:var(--color-accent-dark);margin-bottom:3px;font-size:16px;font-weight:700}.user-badge.jsx-a0472c3257dc336b{color:var(--color-accent-dark);margin-left:5px}.user-rank.jsx-a0472c3257dc336b{color:var(--color-rank-badge);font-size:11px;font-weight:700}.reaction.jsx-a0472c3257dc336b{width:16px;position:absolute;bottom:0;right:-5px}.date-link.jsx-a0472c3257dc336b{color:var(--color-light-2)}.loader.jsx-a0472c3257dc336b{margin-top:1rem}");d.__hash="a0472c3257dc336b",o.default.setAppElement("body");class u extends a.default.Component{constructor(e){super(e),this.state={users:[],hasMoreItems:!0,currentPage:0,maxPage:1,showModal:!1,reactionSummary:[],activeReaction:0},this.handleOpenModal=this.handleOpenModal.bind(this),this.handleCloseModal=this.handleCloseModal.bind(this),this.fetchUsers=this.fetchUsers.bind(this),this.changeTab=this.changeTab.bind(this)}handleOpenModal(){this.setState({showModal:!0}),this.fetchUsers()}handleCloseModal(){window.document.body.style.overflow="initial",this.setState({showModal:!1})}disableScroll(){window.document.body.style.overflow="hidden"}changeTab(e){this.setState({activeReaction:e})}fetchUsers(){let{api:e,post:t}=this.props,{users:i,currentPage:s,maxPage:r,reactionSummary:n}=this.state;if(s{let t=!1;s=e.links&&e.links.page?e.links.page:1,r=e.links&&e.links.pages?e.links.pages:1,e.links&&s0&&(i=i.concat(e.users.map(e=>{let t=(0,h.U)(e);return t.reaction=this.props.reactions.find(e=>e.id===t.reactionId),t})),(n=this.props.reactions.map(t=>({...t,count:e.reactions_summary[t.id]}))).unshift({id:0,count:e.users_total}),this.setState({users:i,currentPage:s,maxPage:r,hasMoreItems:t,reactionSummary:n}))})}}render(){let{users:e,hasMoreItems:s,reactionSummary:r,activeReaction:n}=this.state;return(0,t.jsxs)("div",{className:`jsx-${d.__hash} modal`,children:[(0,t.jsxs)(o.default,{isOpen:this.state.showModal,onRequestClose:this.handleCloseModal,onAfterOpen:()=>this.disableScroll(),shouldCloseOnOverlayClick:!0,className:"reaction-view-modal",children:[(0,t.jsxs)("div",{className:`jsx-${d.__hash} modal-title`,children:[(0,t.jsx)("div",{className:`jsx-${d.__hash} reaction-tabs`,children:r.map(e=>e.count>0&&(0,t.jsxs)("button",{onClick:()=>this.changeTab(e.id),className:`jsx-${d.__hash} tab ${e.id===n?"active":""}`,children:[0===e.id?"Tất cả":(0,t.jsx)("img",{src:e.links.imageUrl,alt:e.title,width:"16",className:`jsx-${d.__hash}`}),(0,t.jsx)("span",{className:`jsx-${d.__hash} count`,children:e.count})]},e.id))}),(0,t.jsx)("button",{onClick:this.handleCloseModal,className:`jsx-${d.__hash} modal-button__close`,children:(0,t.jsx)("i",{className:`jsx-${d.__hash} icon fas fa-times`})})]}),(0,t.jsx)("div",{id:"scrollableLikeUsers",className:`jsx-${d.__hash} modal-content`,children:(0,t.jsx)(l.f,{dataLength:e.length,next:this.fetchUsers,hasMore:s,loader:(0,t.jsx)("div",{className:`jsx-${d.__hash} loader`,children:"Đang tải ..."},0),scrollableTarget:"scrollableLikeUsers",children:(0,t.jsx)("div",{className:`jsx-${d.__hash} users`,children:e&&e.length>0&&e.map(e=>(e.reactionId===n||0===n)&&(0,t.jsx)("a",{href:`https://tinhte.vn/profile/${e.id}`,target:"blank",className:`jsx-${d.__hash} user-list`,children:(0,t.jsxs)("div",{className:`jsx-${d.__hash} user-info`,children:[(0,t.jsx)("div",{style:{backgroundImage:`url(${e.avatar})`},className:`jsx-${d.__hash} user-avatar`,children:(0,t.jsx)("img",{src:e.reaction.links.imageUrl,alt:e.name,width:"16",className:`jsx-${d.__hash} reaction`})}),(0,t.jsx)("div",{className:`jsx-${d.__hash} user-name-rank`,children:(0,t.jsxs)("div",{className:`jsx-${d.__hash} user-name`,children:[(0,t.jsx)("span",{className:`jsx-${d.__hash}`,children:e.name}),e.verifiedBadge?(0,t.jsx)("i",{className:`jsx-${d.__hash} user-badge fas fa-check-circle`}):(0,t.jsx)("i",{className:`jsx-${d.__hash}`})]})})]})},e.id))})})})]}),(0,t.jsx)(i.default,{id:d.__hash,children:d})]})}}let c=new String(".total-reactions.jsx-1126b908511751e8{color:var(--text-grey);align-items:center;margin-right:16px;display:flex}.total-reactions.jsx-1126b908511751e8 .reaction-button.jsx-1126b908511751e8{gap:var(--gap-thread-action);display:flex}.total-reactions.comment-mode.jsx-1126b908511751e8{z-index:1;font-size:.8rem;position:absolute;top:-19px;right:0}.total-reactions.comment-mode.jsx-1126b908511751e8 .reaction-button{gap:8px;padding:6px!important}.total-reactions.comment-mode.jsx-1126b908511751e8>button.jsx-1126b908511751e8{background:var(--thread-background);box-shadow:var(--box-shadow);border-radius:20px;justify-content:center;align-items:center;padding:4px;line-height:1;display:flex}.total-reactions.comment-mode.jsx-1126b908511751e8 img.jsx-1126b908511751e8{width:14px}.total-reactions.jsx-1126b908511751e8 img.jsx-1126b908511751e8{vertical-align:middle;width:16px;margin-right:4px}.total-reactions.jsx-1126b908511751e8 span{color:var(--text-light-2);vertical-align:middle;margin-right:3px;font-weight:700;position:relative}");c.__hash="1126b908511751e8";let p=n.f.subscribe(r.f.ApiConsumer(({api:e,commentMode:r=!0,totalReaction:n,post:a,reactions:o})=>{let l=s.default.createRef(),{postReactions:h}=a.reaction,d=o.filter(e=>h[e.id]>0);return n<=0?null:(0,t.jsxs)("div",{className:`jsx-${c.__hash} ${r?"comment-mode ":""}total-reactions`,children:[n>0&&(0,t.jsxs)(s.default.Fragment,{children:[(0,t.jsx)("button",{onClick:()=>{l.current.handleOpenModal()},className:`jsx-${c.__hash} reaction-button`,children:d.map(e=>(0,t.jsxs)("div",{className:`jsx-${c.__hash}`,children:[(0,t.jsx)("img",{width:"25",src:e.links.imageUrl,alt:e.title,className:`jsx-${c.__hash}`},e.id),(0,t.jsx)("span",{className:`jsx-${c.__hash}`,children:h[e.id]})]},e.id))}),(0,t.jsx)(u,{ref:l,post:a,api:e,reactions:o})]}),(0,t.jsx)(i.default,{id:c.__hash,children:c})]})}),({reactions:e})=>({reactions:e}));e.s(["f",0,p],723661)},535044,734673,e=>{var t=e.i(391398),i=e.i(145246),s=e.i(191788);e.i(966278);var r=e.i(318398),n=e.i(501584),a=e.i(565715),o=s,l=e.i(113503),h=e.i(949125),d=e.i(661655),u=e.i(693084),c=e.i(230184),p=e.i(929424),f=e.i(867507),m=e.i(210147),g=e.i(618488),y=e.i(634529),_=e.i(723661),b=e.i(94432),v=e.i(6788),T=e.i(587388),S=e.i(455404);let x=new String(".thread-comment.jsx-ee2ca7fa0afe5b1{overflow:inherit;flex-direction:column;flex:100%;margin:0 0 18px;display:flex}.thread-comment.no-margin.jsx-ee2ca7fa0afe5b1{margin:0}.thread-comment__container.jsx-ee2ca7fa0afe5b1{flex-direction:row;align-items:flex-start;display:flex;position:relative}.thread-comment__avatar.jsx-ee2ca7fa0afe5b1{position:relative}.thread-comment__avatar.jsx-ee2ca7fa0afe5b1 .avatar.jsx-ee2ca7fa0afe5b1{background-position:50%;background-repeat:no-repeat;background-size:cover;background-color:var(--avatar-background-dark);border:1px solid var(--color-light-1);border-radius:50%;width:50px;height:50px;margin-right:6px;position:relative}.thread-comment__avatar.jsx-ee2ca7fa0afe5b1 .avatar.lite.jsx-ee2ca7fa0afe5b1{width:30px;height:30px}.thread-comment__wrapper.jsx-ee2ca7fa0afe5b1{width:100%;position:relative}.thread-comment__box.jsx-ee2ca7fa0afe5b1{background-color:var(--post-background);border-radius:6px;width:100%;padding:0 .5rem .5rem;position:relative}.thread-comment__box.active.jsx-ee2ca7fa0afe5b1{border:1px solid var(--color-accent-dark)}.thread-comment__box.isDeleted.jsx-ee2ca7fa0afe5b1{border:2px solid var(--color-alert-badge);opacity:.4}.thread-comment__box.lite.jsx-ee2ca7fa0afe5b1{background-color:#0000;padding:0}.thread-comment__box.lite.active.jsx-ee2ca7fa0afe5b1,.thread-comment__box.lite.isDeleted.jsx-ee2ca7fa0afe5b1{border:none}.thread-comment__action.jsx-ee2ca7fa0afe5b1{flex-flow:wrap;justify-content:space-between;margin-top:.2rem;padding-top:0;display:flex;position:relative}.thread-comment__action.jsx-ee2ca7fa0afe5b1 .thread-comment__action--left.jsx-ee2ca7fa0afe5b1{gap:var(--gap-thread-action);display:flex}.thread-comment__action.jsx-ee2ca7fa0afe5b1 .react-item.jsx-ee2ca7fa0afe5b1{align-items:center;gap:4px;font-size:12px;line-height:20px;display:flex}.thread-comment__action.jsx-ee2ca7fa0afe5b1 .react-item.jsx-ee2ca7fa0afe5b1 .reacted-text.jsx-ee2ca7fa0afe5b1{color:var(--primary-color);font-weight:700}.thread-comment__action.jsx-ee2ca7fa0afe5b1 .separate.jsx-ee2ca7fa0afe5b1{color:var(--secondary-text);margin:0 .5rem;font-size:14px}.thread-comment__action.jsx-ee2ca7fa0afe5b1 .reaction-text{display:none}.thread-comment__action.jsx-ee2ca7fa0afe5b1 .thread-like.jsx-ee2ca7fa0afe5b1{color:var(--text-grey);cursor:pointer;outline:none;font-size:.8rem}.thread-comment__action.jsx-ee2ca7fa0afe5b1 .thread-like.active.jsx-ee2ca7fa0afe5b1{color:var(--color-accent-dark);font-weight:700}.thread-comment__action.jsx-ee2ca7fa0afe5b1 .thread-like.jsx-ee2ca7fa0afe5b1 i.jsx-ee2ca7fa0afe5b1{margin-right:5px}.thread-comment__action.jsx-ee2ca7fa0afe5b1 .thread-like.jsx-ee2ca7fa0afe5b1 .thread-like__count.jsx-ee2ca7fa0afe5b1{margin-right:7px}.thread-comment__action.jsx-ee2ca7fa0afe5b1 .thread-action.jsx-ee2ca7fa0afe5b1{color:var(--text-since);cursor:pointer;outline:none;align-items:center;font-size:.8rem;display:flex}.thread-comment__action.jsx-ee2ca7fa0afe5b1 .thread-action.jsx-ee2ca7fa0afe5b1:hover,.thread-comment__action.jsx-ee2ca7fa0afe5b1 .thread-action.reply.jsx-ee2ca7fa0afe5b1{color:var(--text-grey)}.thread-comment__action.jsx-ee2ca7fa0afe5b1 .thread-action.selected.jsx-ee2ca7fa0afe5b1 span.jsx-ee2ca7fa0afe5b1{color:var(--text-grey);cursor:pointer;background-color:var(--button-light);border-radius:2px;outline:none;padding:2px 10px;font-size:.8rem}.thread-comment__action.jsx-ee2ca7fa0afe5b1 .thread-action.disabled.jsx-ee2ca7fa0afe5b1{opacity:.5}.thread-comment__action.jsx-ee2ca7fa0afe5b1 .thread-action.jsx-ee2ca7fa0afe5b1:first-child:before{display:none}.thread-comment__action--right.thread-action.jsx-ee2ca7fa0afe5b1:first-child{margin-left:0}.thread-comment__author-container.jsx-ee2ca7fa0afe5b1{justify-content:space-between;max-height:24px;display:flex}.comment-menu-toggle.jsx-ee2ca7fa0afe5b1{padding-top:8px}.thread-comment__author.jsx-ee2ca7fa0afe5b1{flex-flow:wrap;align-items:center;display:flex;position:relative}.thread-comment__author.jsx-ee2ca7fa0afe5b1 .author-name.jsx-ee2ca7fa0afe5b1{color:var(--user-color);font-size:13px;font-weight:700}.thread-comment__author.jsx-ee2ca7fa0afe5b1 .author-name.jsx-ee2ca7fa0afe5b1 i.jsx-ee2ca7fa0afe5b1{color:var(--color-accent-dark);margin-left:5px;margin-right:5px}.thread-comment__author.jsx-ee2ca7fa0afe5b1 .author-rank.jsx-ee2ca7fa0afe5b1{color:var(--role-badge);text-transform:uppercase;margin-right:10px;font-size:11px;font-weight:700}.thread-comment__date.jsx-ee2ca7fa0afe5b1{color:var(--text-since);font-size:10px}.thread-comment__content.jsx-ee2ca7fa0afe5b1{width:100%;position:relative}.thread-comment__wrapper.jsx-ee2ca7fa0afe5b1 .thread-comments__container.jsx-ee2ca7fa0afe5b1{border-left:1px solid var(--border-light);margin-top:1rem;padding-left:.6rem}.thread-comment__stickers.jsx-ee2ca7fa0afe5b1{flex-wrap:wrap;justify-content:flex-start;align-items:flex-start;width:100%;margin:12px 0 0;display:flex;position:relative}.thread-comment__sticker.jsx-ee2ca7fa0afe5b1{width:100px;height:auto;margin-right:10px}.thread-comment__attachments.jsx-ee2ca7fa0afe5b1{flex-wrap:wrap;justify-content:flex-start;align-items:flex-start;width:100%;margin:12px 0 0;display:flex;position:relative}.thread-comment__attachment.jsx-ee2ca7fa0afe5b1{border-radius:4px;width:auto;max-width:300px;padding:4px}@media (width>=400px){.thread-comment__attachment.jsx-ee2ca7fa0afe5b1{padding:6px}}@media (width<=768px){.thread-comment__attachment.jsx-ee2ca7fa0afe5b1{flex-basis:33.3333%}}@media (width>=768px){.thread-comment__attachment.jsx-ee2ca7fa0afe5b1{flex-basis:24%}}.thread-comment__attachment.jsx-ee2ca7fa0afe5b1 img.jsx-ee2ca7fa0afe5b1{border:1px solid var(--border-thread-thumbnail);border-radius:4px}.thread-comments__load-more.jsx-ee2ca7fa0afe5b1{color:var(--color-accent-dark);outline:none;margin-bottom:1.5rem;font-size:.8rem}@media (width<=1000px){.thread-comment__avatar.jsx-ee2ca7fa0afe5b1 .avatar.jsx-ee2ca7fa0afe5b1{width:50px;height:50px}}.comment-menu.jsx-ee2ca7fa0afe5b1{z-index:6;background-color:var(--thread-background);border-radius:10px;flex-direction:column;align-items:flex-start;display:flex;position:absolute;top:40px;right:10px;box-shadow:0 2px 4px #0003}.comment-menu.jsx-ee2ca7fa0afe5b1 .thread-action.jsx-ee2ca7fa0afe5b1{text-align:start;min-width:120px;padding:10px 16px;font-size:14px}.comment-menu.jsx-ee2ca7fa0afe5b1 .thread-action.jsx-ee2ca7fa0afe5b1:hover{background-color:var(--post-background)}.dropdown-action.jsx-ee2ca7fa0afe5b1{width:100%}.dropdown-action.jsx-ee2ca7fa0afe5b1:hover{background-color:var(--page-background)}");x.__hash="ee2ca7fa0afe5b1";let w=e=>(window.location.hash&&window.location.hash.split("-")[1]?window.location.hash.split("-")[1]:"").toString()===e.toString();var E=s;let k=new String(".thread-comments__container.jsx-f2fe2d20f183ca5c{width:100%;position:relative}.thread-comment.jsx-f2fe2d20f183ca5c{overflow:inherit;flex-direction:column;flex:100%;margin:0 0 1.5rem;display:flex}.thread-comment__container.jsx-f2fe2d20f183ca5c{flex-direction:row;align-items:flex-start;display:flex;position:relative}.thread-comment__avatar.jsx-f2fe2d20f183ca5c{position:relative}.thread-comment__avatar.jsx-f2fe2d20f183ca5c .avatar.jsx-f2fe2d20f183ca5c{background-position:50%;background-repeat:no-repeat;background-size:cover;background-color:var(--avatar-background-dark);border:1px solid var(--color-light-1);border-radius:50%;width:50px;height:50px;margin-right:6px;position:relative}.thread-comment__avatar.jsx-f2fe2d20f183ca5c .avatar.lite.jsx-f2fe2d20f183ca5c{width:30px;height:30px}.thread-comment__wrapper.jsx-f2fe2d20f183ca5c{width:100%;position:relative}.thread-comment__box.jsx-f2fe2d20f183ca5c{background-color:var(--post-background);border-radius:6px;width:100%;padding:0 .5rem .5rem;position:relative}.thread-comment__box.active.jsx-f2fe2d20f183ca5c{border:1px solid var(--color-accent-dark)}.thread-comment__box.isDeleted.jsx-f2fe2d20f183ca5c{border:2px solid var(--color-alert-badge);opacity:.4}.thread-comment__box.lite.jsx-f2fe2d20f183ca5c{background-color:#0000;padding:0}.thread-comment__box.lite.active.jsx-f2fe2d20f183ca5c,.thread-comment__box.lite.isDeleted.jsx-f2fe2d20f183ca5c{border:none}.show-quote-reply-button.jsx-f2fe2d20f183ca5c{color:var(--text-since);margin-left:12px;font-size:12px}.show-quote-reply-button.jsx-f2fe2d20f183ca5c:hover{color:var(--text-button-active)}.thread-comment__author-container.jsx-f2fe2d20f183ca5c{justify-content:space-between;max-height:24px;display:flex}.comment-menu-toggle.jsx-f2fe2d20f183ca5c{padding-top:8px}.thread-comment__action.jsx-f2fe2d20f183ca5c{flex-flow:wrap;justify-content:space-between;margin-top:.2rem;padding-top:0;display:flex;position:relative}.thread-comment__action.jsx-f2fe2d20f183ca5c .thread-comment__action--left.jsx-f2fe2d20f183ca5c{gap:var(--gap-thread-action);display:flex}.thread-comment__action.jsx-f2fe2d20f183ca5c .react-item.jsx-f2fe2d20f183ca5c{align-items:center;gap:4px;font-size:12px;line-height:20px;display:flex}.thread-comment__action.jsx-f2fe2d20f183ca5c .react-item.jsx-f2fe2d20f183ca5c .reacted-text.jsx-f2fe2d20f183ca5c{color:var(--primary-color);font-weight:700}.thread-comment__action.jsx-f2fe2d20f183ca5c .separate.jsx-f2fe2d20f183ca5c{color:var(--secondary-text);margin:0 .5rem;font-size:14px}.thread-comment__action.jsx-f2fe2d20f183ca5c .reaction-text{display:none}.thread-comment__action.jsx-f2fe2d20f183ca5c .thread-like.jsx-f2fe2d20f183ca5c{color:var(--text-grey);cursor:pointer;outline:none;font-size:.8rem}.thread-comment__action.jsx-f2fe2d20f183ca5c .thread-like.jsx-f2fe2d20f183ca5c:hover{color:var(--color-accent-dark-hover)}.thread-comment__action.jsx-f2fe2d20f183ca5c .thread-like.active.jsx-f2fe2d20f183ca5c{color:var(--color-accent-dark);font-weight:700}.thread-comment__action.jsx-f2fe2d20f183ca5c .thread-like.jsx-f2fe2d20f183ca5c i.jsx-f2fe2d20f183ca5c{margin-right:5px}.thread-comment__action.jsx-f2fe2d20f183ca5c .thread-like.jsx-f2fe2d20f183ca5c .thread-like__count.jsx-f2fe2d20f183ca5c{margin-right:7px}.thread-comment__action.jsx-f2fe2d20f183ca5c .thread-action.jsx-f2fe2d20f183ca5c{color:var(--text-since);cursor:pointer;outline:none;align-items:center;font-size:.8rem;display:flex}.thread-comment__action.jsx-f2fe2d20f183ca5c .thread-action.jsx-f2fe2d20f183ca5c:hover{color:var(--color-accent-dark-hover)}.thread-comment__action.jsx-f2fe2d20f183ca5c .thread-action.reply.jsx-f2fe2d20f183ca5c{color:var(--text-grey)}.thread-comment__action.jsx-f2fe2d20f183ca5c .thread-action.selected.jsx-f2fe2d20f183ca5c span.jsx-f2fe2d20f183ca5c{color:var(--text-grey);cursor:pointer;background-color:var(--button-light);border-radius:4px;outline:none;padding:5px 10px;font-size:.8rem}.thread-comment__action.jsx-f2fe2d20f183ca5c .thread-action.disabled.jsx-f2fe2d20f183ca5c{opacity:.5}.thread-comment__action.jsx-f2fe2d20f183ca5c .thread-action.jsx-f2fe2d20f183ca5c:first-child:before{display:none}.thread-comment__author.jsx-f2fe2d20f183ca5c{flex-flow:wrap;align-items:center;display:flex;position:relative}.thread-comment__author.jsx-f2fe2d20f183ca5c .author-name.jsx-f2fe2d20f183ca5c{color:var(--user-color);font-size:13px;font-weight:700}.thread-comment__author.jsx-f2fe2d20f183ca5c .author-name.jsx-f2fe2d20f183ca5c i.jsx-f2fe2d20f183ca5c{color:var(--color-accent-dark);margin-left:5px;margin-right:5px}.thread-comment__author.jsx-f2fe2d20f183ca5c .author-rank.jsx-f2fe2d20f183ca5c{color:var(--role-badge);text-transform:uppercase;margin-right:10px;font-size:11px;font-weight:700}.thread-comment__date.jsx-f2fe2d20f183ca5c{color:var(--text-since);font-size:10px}.thread-comment__content.jsx-f2fe2d20f183ca5c{width:100%;position:relative}.thread-comment__wrapper.jsx-f2fe2d20f183ca5c .thread-comments__container.jsx-f2fe2d20f183ca5c{border-left:1px solid var(--border-light);margin-top:1rem;padding-left:1rem}.thread-comment__stickers.jsx-f2fe2d20f183ca5c{flex-wrap:wrap;justify-content:flex-start;align-items:flex-start;width:100%;margin:12px 0 0;display:flex;position:relative}.thread-comment__sticker.jsx-f2fe2d20f183ca5c{width:100px;height:auto;margin-right:10px}.thread-comment__attachments.jsx-f2fe2d20f183ca5c{justify-content:flex-start;align-items:flex-start;width:100%;margin:12px 0 0;display:flex;position:relative}.thread-comment__attachment.jsx-f2fe2d20f183ca5c{border-radius:4px;width:auto;max-width:300px;margin-right:10px}.thread-comment__attachment.jsx-f2fe2d20f183ca5c img.jsx-f2fe2d20f183ca5c{border-radius:4px}@media (width<=1000px){.thread-comment__avatar.jsx-f2fe2d20f183ca5c .avatar.jsx-f2fe2d20f183ca5c{width:50px;height:50px}.thread-comment__box.jsx-f2fe2d20f183ca5c{padding:.75rem}}.comment-menu.jsx-f2fe2d20f183ca5c{z-index:6;background-color:var(--thread-background);border-radius:10px;flex-direction:column;align-items:flex-start;display:flex;position:absolute;top:40px;right:10px;box-shadow:0 2px 4px #0003}.comment-menu.jsx-f2fe2d20f183ca5c .thread-action.jsx-f2fe2d20f183ca5c{text-align:start;min-width:120px;padding:10px 16px;font-size:14px}.comment-menu.jsx-f2fe2d20f183ca5c .thread-action.jsx-f2fe2d20f183ca5c:hover{background-color:var(--post-background)}");k.__hash="f2fe2d20f183ca5c";let C=async(e,t,i)=>(await e.post({uri:`/posts/${t.id}/report`,params:{message:i}}),{...t,reported:!0}),I=(e,t)=>e.post({uri:`/posts/${t}/report`,params:{message:"Khác"}});e.s(["U",0,C,"_",0,I],734673);var A=e.i(602692);class D extends E.default.Component{constructor(e){super(e),this.state={post:this.props.post,user:this.props.user,lite:this.props.lite,isAnchor:!1,postReplyVisible:!1,postReportVisible:!1,postDeleteVisible:!1,postEditVisible:!1,showLightBox:!1,photoIndex:0,showPostQuote:!1,totalReaction:this.props.post.reaction.total},this.edit=this.edit.bind(this),this.onEdit=this.onEdit.bind(this),this.replyPost=this.replyPost.bind(this),this.report=this.report.bind(this),this.addPost=this.addPost.bind(this),this.deletePost=this.deletePost.bind(this),this.delete=this.delete.bind(this),this.toggleLikePost=this.toggleLikePost.bind(this),this.isCommenting=this.isCommenting.bind(this),this.isNotCommenting=this.isNotCommenting.bind(this),this.onReact=this.onReact.bind(this)}componentDidMount(){let{mobileFactComment:e}=this.props,{post:t}=this.state,{isAnchor:i}=this.state;if(i=w(t.id),this.setState({isAnchor:i}),e&&i){let e=document.getElementsByClassName("comment-area");if(e.length>0){let i=e[0];i&&setTimeout(()=>{let e=document.getElementById(`post-mobile-${t.id}`);if(e){let t=e.getBoundingClientRect();i.scrollTo(0,t.top-300)}},500)}}}UNSAFE_componentWillReceiveProps({post:e,user:t}){this.setState({post:e,user:t})}componentWillUnmount(){}onReact(e,t,i){let{totalReaction:s}=this.state,r={...this.state.post};e===b.U.Up&&(s=this.state.totalReaction+1,r.reaction.postReactions[t]=r.reaction.postReactions[t]+1,r.reaction.userReactionId=t),e===b.U.Down&&(s=this.state.totalReaction-1,r.reaction.postReactions[i]=r.reaction.postReactions[i]-1,r.reaction.userReactionId=null),e===b.U.Neutral&&(r.reaction.postReactions[i]=r.reaction.postReactions[i]-1,r.reaction.postReactions[t]=r.reaction.postReactions[t]+1,r.reaction.userReactionId=t),this.setState({totalReaction:s,post:{...r}})}onEdit(e){this.setState({postEditVisible:!this.state.postEditVisible,post:e})}isCommenting(){this.props&&this.props.isCommenting&&this.props.isCommenting()}isNotCommenting(){this.props&&this.props.isNotCommenting&&this.props.isNotCommenting()}goToLoginPage(){window.location=`/login&redirect=${window.location}`}edit(){this.setState({postEditVisible:!this.state.postEditVisible})}report(){this.state.post.id&&I(this.props.api,this.state.post.id).then(e=>{e.errors?S.c.error(e.errors):S.c.success("Báo xấu thành công")}).catch(e=>{S.c.error(e)})}delete(){this.setState({postDeleteVisible:!this.state.postDeleteVisible})}deletePost(e){this.setState({postDeleteVisible:!this.state.postDeleteVisible,post:e})}replyPost(){let{user:t}=this.state;t&&t.id||this.goToLoginPage(),this.setState({postReplyVisible:!this.state.postReplyVisible},()=>{if(this.state.postReplyVisible){let t=`post-reply-${this.state.post.id}`;(e.g.document.getElementById(t)&&e.g.document.getElementById(t).childNodes[0]?e.g.document.getElementById(t).childNodes[0]:{}).focus()}})}async toggleLikePost(){let{api:e}=this.props,{post:t,user:i}=this.state;i&&i.id||this.goToLoginPage();try{let s=await (0,p.f)(e,t),r={user_id:i.id,username:i.name},{likeUsers:n}=t;if(n){let e=n.findIndex(e=>e.user_id===r.user_id);e>-1?s.likeUsers.splice(e,1):s.likeUsers.unshift(r)}else s.likeUsers=[r];this.setState({post:s})}catch(e){}}addPost(e){this.props.addPost(e),this.setState({postReplyVisible:!this.state.postReplyVisible})}showPostQuote(){let{showPostQuote:e}=this.state;this.setState({showPostQuote:!e})}render(){let{post:e,user:s,postReplyVisible:r,postReportVisible:n,postDeleteVisible:a,postEditVisible:o,isAnchor:h,showLightBox:d,photoIndex:p,lite:T,showPostQuote:S,totalReaction:x}=this.state,{enterToSubmit:w,mobileFactComment:C}=this.props,I=[];e.attachments&&e.attachments.length>0&&e.attachments.map(e=>I.push(e.links.permalink));let D="var(--primary-text)";return e.author&&(D=(0,A.f)(e.author)),(0,t.jsxs)("div",{className:`jsx-${k.__hash}`,children:[e.isIgnored?(0,t.jsx)("div",{className:`jsx-${k.__hash}`}):(0,t.jsx)("div",{className:`jsx-${k.__hash} thread-comment`,children:(0,t.jsxs)("div",{className:`jsx-${k.__hash} thread-comment__container`,children:[(0,t.jsx)("div",{className:`jsx-${k.__hash} thread-comment__avatar`,children:(0,t.jsx)("a",{href:e.author.link,className:`jsx-${k.__hash}`,children:(0,t.jsx)("div",{style:{backgroundImage:`url(${e.author.avatar})`},className:`jsx-${k.__hash} avatar ${T?"lite":""}`})})}),(0,t.jsxs)("div",{style:{"--user-color":D},className:`jsx-${k.__hash} thread-comment__wrapper`,children:[o?(0,t.jsx)(f.f,{ref:e=>{this.postReply=e},api:this.props.api,postToEdit:e,isCommenting:this.isCommenting,isNotCommenting:this.isNotCommenting,user:s,lite:T,enterToSubmit:w,onEdit:this.onEdit}):(0,t.jsxs)("div",{id:C?`post-mobile-${e.id}`:`post-${e.id}`,className:`jsx-${k.__hash} thread-comment__box ${T?"lite":""} ${h?"active":""} ${e.isDeleted?"isDeleted":""}`,children:[(0,t.jsxs)("div",{className:`jsx-${k.__hash} thread-comment__author-container`,children:[(0,t.jsxs)("div",{className:`jsx-${k.__hash} thread-comment__author`,children:[(0,t.jsxs)("a",{href:e.author.link,className:`jsx-${k.__hash} author-name`,children:[e.author.name,e.author.verified_badge?(0,t.jsx)("i",{className:`jsx-${k.__hash} fas fa-check-circle`}):(0,t.jsx)("i",{className:`jsx-${k.__hash}`})]}),(0,t.jsx)("a",{href:`#post-${e.id}`,className:`jsx-${k.__hash} thread-comment__date`,children:(0,t.jsx)(c.f,{value:e.since})}),(0,t.jsx)("button",{onClick:()=>this.showPostQuote(),className:`jsx-${k.__hash} show-quote-reply-button`,children:(0,t.jsx)("i",{className:`jsx-${k.__hash} fas ${S?"fa-chevron-up":"fa-chevron-down"}`})})]}),(0,t.jsx)("div",{className:`jsx-${k.__hash}`,children:(0,t.jsx)("div",{className:`jsx-${k.__hash} comment-menu-toggle`,children:(0,t.jsx)(y.f,{position:"right",menuItems:(0,t.jsxs)(E.Fragment,{children:[e.permissions.edit&&(0,t.jsx)("button",{onClick:this.edit,className:`jsx-${k.__hash} dropdown-action`,children:"Sửa"}),e.permissions.delete&&(0,t.jsx)("button",{onClick:this.delete,className:`jsx-${k.__hash} dropdown-action`,children:"Xoá"}),e.permissions.report&&e.reported?(0,t.jsx)("button",{className:`jsx-${k.__hash} dropdown-action disabled`,children:"Đã báo xấu"}):n?(0,t.jsx)("button",{onClick:this.report,className:`jsx-${k.__hash} dropdown-action selected`,children:(0,t.jsx)("span",{className:`jsx-${k.__hash}`,children:"Hủy"})}):(0,t.jsx)("button",{onClick:this.report,className:`jsx-${k.__hash} dropdown-action`,children:"Báo xấu"}),s&&s.id&&(s.isAdmin||s.isModerator)&&(0,t.jsx)("button",{className:`jsx-${k.__hash} dropdown-action`,children:(0,t.jsx)("a",{href:`https://tinhte.vn/spam-cleaner/${e.author.id}/`,className:`jsx-${k.__hash}`,children:(0,t.jsx)("span",{className:`jsx-${k.__hash}`,children:"Spam"})})}),s&&s.id&&(s.isAdmin||s.isModerator)&&(0,t.jsx)("button",{className:`jsx-${k.__hash}`,children:(0,t.jsx)("a",{href:`https://tinhte.vn/members/mem.${e.author.id}/warn-smart?content_type=post&content_id=${e.id}`,className:`jsx-${k.__hash}`,children:(0,t.jsx)("span",{className:`jsx-${k.__hash}`,children:"Cảnh báo"})})})]})})})})]}),(0,t.jsx)("div",{className:`jsx-${k.__hash} thread-comment__content`,children:(0,t.jsx)(u.f,{body:e.bodyHtml,author:e.author.name,showPostQuote:S})}),e.stickers&&e.stickers.length>0&&(0,t.jsx)("div",{className:`jsx-${k.__hash} thread-comment__stickers`,children:e.stickers.map(e=>(0,t.jsx)("div",{className:`jsx-${k.__hash} thread-comment__sticker`,children:(0,t.jsx)("img",{src:e.links.image_url,alt:e.sticker_name,className:`jsx-${k.__hash}`})},e.sticker_id))}),e.attachments&&e.attachments.length>0&&(0,t.jsx)("div",{className:`jsx-${k.__hash} thread-comment__attachments`,children:e.attachments.map((i,s)=>-1!==e.body.indexOf(i.attachment_id.toString())?(0,t.jsx)("div",{className:`jsx-${k.__hash}`},i.attachment_id):(0,t.jsx)("div",{className:`jsx-${k.__hash} thread-comment__attachment`,children:(0,t.jsx)("img",{src:i.links.thumbnail,alt:i.filename,onClick:()=>this.setState({showLightBox:!0,photoIndex:s}),className:`jsx-${k.__hash}`})},i.attachment_id))}),d&&(0,t.jsx)(l.f,{mainSrc:I[p],nextSrc:I[(p+1)%I.length],prevSrc:I[(p+I.length-1)%I.length],onCloseRequest:()=>this.setState({showLightBox:!1}),onMovePrevRequest:()=>this.setState({photoIndex:(p+I.length-1)%I.length}),onMoveNextRequest:()=>this.setState({photoIndex:(p+1)%I.length})})]}),(0,t.jsx)("div",{className:`jsx-${k.__hash} thread-comment__action no-user-select`,children:(0,t.jsxs)("div",{className:`jsx-${k.__hash} thread-comment__action--left`,children:[(0,t.jsx)(_.f,{totalReaction:x,post:e}),s&&s.id&&(0,t.jsx)(E.Fragment,{children:b.q.map(i=>{let s=e&&e.reaction&&e.reaction.userReactionId===i,r=e&&e.reaction&&e.reaction.postReactions[i]||0;return(0,t.jsx)(E.Fragment,{children:(0,t.jsxs)("div",{className:`jsx-${k.__hash} react-item`,children:[(0,t.jsx)(g.f,{post:e,onReact:this.onReact,reactionButtonId:i}),(0,t.jsx)("span",{className:`jsx-${k.__hash} ${s?"reacted-text":""}`,children:r})]})},`${i}`)})}),e.permissions.reply?r?(0,t.jsx)("button",{onClick:this.replyPost,className:`jsx-${k.__hash} thread-action selected no-user-select`,children:(0,t.jsx)("span",{className:`jsx-${k.__hash}`,children:"Hủy"})}):(0,t.jsx)("button",{onClick:this.replyPost,className:`jsx-${k.__hash} thread-action reply no-user-select`,children:(0,t.jsx)(v.f,{style:{width:14}})}):(0,t.jsx)("div",{className:`jsx-${k.__hash}`}),o&&(0,t.jsx)("button",{onClick:this.edit,className:`jsx-${k.__hash} thread-action selected`,children:(0,t.jsx)("span",{className:`jsx-${k.__hash}`,children:"Hủy"})}),a&&(0,t.jsx)("button",{onClick:this.delete,className:`jsx-${k.__hash} thread-action selected`,children:(0,t.jsx)("span",{className:`jsx-${k.__hash}`,children:"Hủy"})})]})}),s&&r&&(0,t.jsx)(f.f,{ref:e=>{this.postReply=e},api:this.props.api,postToReply:e,isCommenting:this.isCommenting,isNotCommenting:this.isNotCommenting,user:s,lite:T,enterToSubmit:w,addPost:this.addPost}),a&&(0,t.jsx)(m.f,{ref:e=>{this.PostDelete=e},api:this.props.api,post:e,user:s,deletePost:this.deletePost})]})]})},e.id),(0,t.jsx)(i.default,{id:k.__hash,children:k})]})}}let P=r.f.ApiConsumer(D);class L extends o.default.Component{constructor(e){super(e),this.state={post:this.props.post,user:this.props.user,lite:this.props.lite,isAnchor:!1,postReplyVisible:!1,postDeleteVisible:!1,postEditVisible:!1,showLightBox:!1,photoIndex:0,totalReaction:this.props.post.reaction.total,showOptionMenu:!1},this.edit=this.edit.bind(this),this.onEdit=this.onEdit.bind(this),this.report=this.report.bind(this),this.deletePost=this.deletePost.bind(this),this.delete=this.delete.bind(this),this.addPost=this.addPost.bind(this),this.replyPost=this.replyPost.bind(this),this.loadMoreReplies=this.loadMoreReplies.bind(this),this.toggleLikePost=this.toggleLikePost.bind(this),this.isCommenting=this.isCommenting.bind(this),this.isNotCommenting=this.isNotCommenting.bind(this),this.showOptionMenu=this.showOptionMenu.bind(this),this.onReact=this.onReact.bind(this)}componentDidMount(){let{mobileFactComment:e}=this.props,{post:t}=this.state,{isAnchor:i}=this.state;if(i=w(t.id),this.setState({isAnchor:i}),e&&i){let e=document.getElementsByClassName("comment-area");if(e.length>0){let i=e[0];i&&setTimeout(()=>{let e=document.getElementById(`post-mobile-${t.id}`);if(e){let t=e.getBoundingClientRect();i.scrollTo(0,t.top-300)}},500)}}}UNSAFE_componentWillReceiveProps({post:e,user:t}){this.setState({post:e,user:t})}componentDidUpdate(e){let{post:t}=this.props;(0,h.default)(t,e.post)||this.setState({post:t})}onReact(e,t,i){let{totalReaction:s}=this.state,r={...this.state.post};e===b.U.Up&&(s=this.state.totalReaction+1,r.reaction.postReactions[t]=r.reaction.postReactions[t]+1,r.reaction.userReactionId=t),e===b.U.Down&&(s=this.state.totalReaction-1,r.reaction.postReactions[i]=r.reaction.postReactions[i]-1,r.reaction.userReactionId=null),e===b.U.Neutral&&(r.reaction.postReactions[i]=r.reaction.postReactions[i]-1,r.reaction.postReactions[t]=r.reaction.postReactions[t]+1,r.reaction.userReactionId=t),this.setState({totalReaction:s,post:{...r}})}onAttachmentClick(e,t){this.setState({showLightBox:!0,photoIndex:t})}onEdit(e){this.setState({postEditVisible:!this.state.postEditVisible,post:e})}isCommenting(){this.props&&this.props.isCommenting&&this.props.isCommenting()}isNotCommenting(){this.props&&this.props.isNotCommenting&&this.props.isNotCommenting()}showOptionMenu(){let{showOptionMenu:e}=this.state;this.setState({showOptionMenu:!e})}goToLoginPage(){window.location=`/login&redirect=${window.location}`}edit(){this.setState({postEditVisible:!this.state.postEditVisible})}report(){this.state.post.id&&I(this.props.api,this.state.post.id).then(e=>{e.errors?S.c.error(e.errors):S.c.success("Báo xấu thành công")}).catch(e=>{S.c.error(e)})}delete(){this.setState({postDeleteVisible:!this.state.postDeleteVisible})}deletePost(e){this.setState({postDeleteVisible:!this.state.postDeleteVisible,post:e})}replyPost(){let{user:t}=this.state;t&&t.id||this.goToLoginPage(),this.setState({postReplyVisible:!this.state.postReplyVisible},()=>{if(this.state.postReplyVisible){let t=`post-reply-${this.state.post.id}`;(e.g.document.getElementById(t)&&e.g.document.getElementById(t).childNodes[0]?e.g.document.getElementById(t).childNodes[0]:{}).focus()}})}async toggleLikePost(){let{api:e}=this.props,{post:t,user:i}=this.state;i&&i.id||this.goToLoginPage();try{let s=await (0,p.f)(e,t),r={user_id:i.id,username:i.name},{likeUsers:n}=t;if(n){let e=n.findIndex(e=>e.user_id===r.user_id);e>-1?s.likeUsers.splice(e,1):s.likeUsers.unshift(r)}else s.likeUsers=[r];this.setState({post:s})}catch(e){console.log(e)}}loadMoreReplies(e){let{post:t}=this.state;fetch(e.link?e.link:"").then(e=>e.json()).then(i=>{let s=[];i&&i.parent_post&&i.parent_post&&i.parent_post.post_replies&&i.parent_post.post_replies.map((e,r)=>{if(e.post_id){let r=i.replies.find(t=>t.post_id===e.post_id);r&&-1===t.postRepliesDetail.findIndex(e=>e.id===r.post_id)&&s.push((0,d.U)(r,t.thread))}else if(0===r){let i=t.postRepliesDetail.findIndex(t=>t.id===e.from),r=t.postRepliesDetail.findIndex(t=>t.id===e.to);(-1===i||-1===r)&&s.push(e)}return!0});let r=t.postRepliesDetail.findIndex(t=>t.link===e.link);r>-1&&t.postRepliesDetail.splice(r,1,...s),this.setState({post:t})})}addPost(e,t){let{post:i}=this.state;e.postReplyTo===i.id?(i.postRepliesDetail.unshift(e),this.setState({postReplyVisible:!this.state.postReplyVisible,post:i})):(i.postRepliesDetail.forEach((t,s)=>{e.postReplyTo===t.id&&i.postRepliesDetail.splice(s+1,0,e)}),this.setState({post:i}))}handleClickOutside(e){e.stopImmediatePropagation();let{showOptionMenu:t}=this.state;this.node&&this.node.contains(e.target)&&!t&&this.showOptionMenu(),t&&!e.target.classList.contains("menu-item")&&this.setState({showOptionMenu:!1})}render(){let{post:e,postReplyVisible:s,postReportVisible:r,postDeleteVisible:n,postEditVisible:a,isAnchor:h,user:d,showLightBox:p,photoIndex:S,lite:w,totalReaction:E,showOptionMenu:k}=this.state,{enterToSubmit:C,mobileFactComment:I}=this.props,D=[];e.attachments&&e.attachments.length>0&&e.attachments.map(e=>D.push(e.links.permalink));let L="var(--primary-text)";return e.author&&(L=(0,A.f)(e.author)),(0,t.jsxs)(o.Fragment,{children:[e.isIgnored?(0,t.jsx)("div",{className:`jsx-${x.__hash}`}):(0,t.jsx)("div",{className:`jsx-${x.__hash} thread-comment ${e.postRepliesDetail&&e.postRepliesDetail.length>0?"no-margin":""}`,children:(0,t.jsxs)("div",{className:`jsx-${x.__hash} thread-comment__container`,children:[(0,t.jsx)("div",{className:`jsx-${x.__hash} thread-comment__avatar`,children:(0,t.jsx)("a",{href:e.author.link,className:`jsx-${x.__hash}`,children:(0,t.jsx)("div",{style:{backgroundImage:`url(${e.author.avatar})`},className:`jsx-${x.__hash} avatar ${w?"lite":""}`})})}),(0,t.jsxs)("div",{style:{"--user-color":L},className:`jsx-${x.__hash} thread-comment__wrapper`,children:[a?(0,t.jsx)(f.f,{ref:e=>{this.postReply=e},api:this.props.api,postToEdit:e,user:d,lite:w,enterToSubmit:C,isCommenting:this.isCommenting,isNotCommenting:this.isNotCommenting,onEdit:this.onEdit}):(0,t.jsxs)("div",{id:I?`post-mobile-${e.id}`:`post-${e.id}`,className:`jsx-${x.__hash} thread-comment__box ${w?"lite":""} ${h?"active":""} ${e.isDeleted?"isDeleted":""}`,children:[(0,t.jsxs)("div",{className:`jsx-${x.__hash} thread-comment__author-container`,children:[(0,t.jsxs)("div",{className:`jsx-${x.__hash} thread-comment__author`,children:[(0,t.jsxs)("a",{href:e.author.link,className:`jsx-${x.__hash} author-name`,children:[e.author.name,e.author.verified_badge?(0,t.jsx)("i",{className:`jsx-${x.__hash} fas fa-check-circle`}):(0,t.jsx)("i",{className:`jsx-${x.__hash}`})]}),(0,t.jsx)("a",{href:`/thread/${e.thread.id}#post-${e.id}`,className:`jsx-${x.__hash} thread-comment__date`,children:(0,t.jsx)(c.f,{value:e.since})})]}),(0,t.jsx)("div",{className:`jsx-${x.__hash} comment-menu-toggle`,children:(0,t.jsx)(y.f,{position:"right",menuItems:(0,t.jsxs)(o.Fragment,{children:[e.permissions.edit&&(0,t.jsx)("button",{onClick:this.edit,className:`jsx-${x.__hash}`,children:"Sửa"}),e.permissions.delete&&(0,t.jsx)("button",{onClick:this.delete,className:`jsx-${x.__hash}`,children:"Xoá"}),e.permissions.report&&e.reported?(0,t.jsx)("button",{className:`jsx-${x.__hash} dropdown-action disabled`,children:"Đã báo xấu"}):r?(0,t.jsx)("button",{onClick:this.report,className:`jsx-${x.__hash} dropdown-action selected`,children:(0,t.jsx)("span",{className:`jsx-${x.__hash}`,children:"Hủy"})}):(0,t.jsx)("button",{onClick:this.report,className:`jsx-${x.__hash}`,children:"Báo xấu"}),d&&d.id&&(d.isAdmin||d.isModerator)&&(0,t.jsx)("a",{href:`https://tinhte.vn/spam-cleaner/${e.author.id}/`,className:`jsx-${x.__hash}`,children:(0,t.jsx)("span",{className:`jsx-${x.__hash}`,children:"Spam"})}),d&&d.id&&(d.isAdmin||d.isModerator)&&(0,t.jsx)("a",{href:`https://tinhte.vn/members/mem.${e.author.id}/warn-smart?content_type=post&content_id=${e.id}`,className:`jsx-${x.__hash}`,children:(0,t.jsx)("span",{className:`jsx-${x.__hash}`,children:"Cảnh báo"})})]})})})]}),(0,t.jsx)("div",{className:`jsx-${x.__hash} thread-comment__content`,children:(0,t.jsx)(u.f,{body:e.bodyHtml,author:e.author.name})}),e.stickers&&e.stickers.length>0&&(0,t.jsx)("div",{className:`jsx-${x.__hash} thread-comment__stickers`,children:e.stickers.map(e=>(0,t.jsx)("div",{className:`jsx-${x.__hash} thread-comment__sticker`,children:(0,t.jsx)("img",{src:e.links.image_url,alt:e.sticker_name,className:`jsx-${x.__hash}`})},e.sticker_id))}),e.attachments&&e.attachments.length>0&&(0,t.jsx)("div",{className:`jsx-${x.__hash} thread-comment__attachments`,children:e.attachments.map((i,s)=>-1!==e.body.indexOf(i.attachment_id.toString())?(0,t.jsx)("div",{className:`jsx-${x.__hash}`},i.attachment_id):(0,t.jsx)(o.Fragment,{children:i&&i.links&&i.links.video_url?(0,t.jsx)("div",{className:`jsx-${x.__hash} thread-comment__attachment`,children:(0,t.jsx)(T.f,{preload:"auto",controls:!0,sources:[{src:i.links.video_url}],poster:i.links.thumbnail,videoRatio:i.video_ratio,attachment:i,largePortraitVideo:!0,post:e})},i.attachment_id):(0,t.jsx)("div",{className:`jsx-${x.__hash} thread-comment__attachment`,children:(0,t.jsx)("img",{src:i.links.thumbnail,alt:i.filename,onClick:()=>this.onAttachmentClick(i,s),className:`jsx-${x.__hash}`})},i.attachment_id)}))}),p&&(0,t.jsx)(l.f,{mainSrc:D[S],nextSrc:D[(S+1)%D.length],prevSrc:D[(S+D.length-1)%D.length],onCloseRequest:()=>this.setState({showLightBox:!1}),onMovePrevRequest:()=>this.setState({photoIndex:(S+D.length-1)%D.length}),onMoveNextRequest:()=>this.setState({photoIndex:(S+1)%D.length})})]}),(0,t.jsx)("div",{className:`jsx-${x.__hash} thread-comment__action no-user-select`,children:(0,t.jsxs)("div",{className:`jsx-${x.__hash} thread-comment__action--left`,children:[(0,t.jsx)(_.f,{totalReaction:E,post:e}),d&&d.id&&(0,t.jsx)(o.Fragment,{children:b.q.map(i=>{let s=e&&e.reaction&&e.reaction.userReactionId===i,r=e&&e.reaction&&e.reaction.postReactions[i]||0;return(0,t.jsx)(o.Fragment,{children:(0,t.jsxs)("div",{className:`jsx-${x.__hash} react-item`,children:[(0,t.jsx)(g.f,{post:e,onReact:this.onReact,reactionButtonId:i}),(0,t.jsx)("span",{className:`jsx-${x.__hash} ${s?"reacted-text":""}`,children:r})]})},`${i}`)})}),e.permissions.reply?s?(0,t.jsx)("button",{onClick:this.replyPost,className:`jsx-${x.__hash} thread-action selected no-user-select`,children:(0,t.jsx)("span",{className:`jsx-${x.__hash}`,children:"Hủy"})}):(0,t.jsx)("button",{onClick:this.replyPost,className:`jsx-${x.__hash} thread-action reply no-user-select`,children:(0,t.jsx)(v.f,{style:{width:14}})}):(0,t.jsx)("div",{className:`jsx-${x.__hash}`}),a&&(0,t.jsx)("button",{onClick:this.edit,className:`jsx-${x.__hash} thread-action selected`,children:(0,t.jsx)("span",{className:`jsx-${x.__hash}`,children:"Hủy"})}),n&&(0,t.jsx)("button",{onClick:this.delete,className:`jsx-${x.__hash} thread-action selected`,children:(0,t.jsx)("span",{className:`jsx-${x.__hash}`,children:"Hủy"})})]})}),s&&(0,t.jsx)(f.f,{ref:e=>{this.postReply=e},api:this.props.api,postToReply:e,isCommenting:this.isCommenting,isNotCommenting:this.isNotCommenting,user:d,lite:w,enterToSubmit:C,addPost:this.addPost}),n&&(0,t.jsx)(m.f,{ref:e=>{this.PostDelete=e},api:this.props.api,post:e,user:d,deletePost:this.deletePost}),e.postRepliesDetail&&e.postRepliesDetail.length>0?(0,t.jsx)("div",{className:`jsx-${x.__hash} thread-comments__container`,children:e.postRepliesDetail.map(e=>e.body?(0,t.jsx)(P,{post:e,user:d,addPost:this.addPost,lite:w,isCommenting:this.isCommenting,isNotCommenting:this.isNotCommenting,mobileFactComment:I},e.id):(0,t.jsxs)("button",{onClick:()=>this.loadMoreReplies(e),className:`jsx-${x.__hash} thread-comments__load-more`,children:["Xem thêm ",e.post_reply_count," trả lời cũ hơn..."]},e.id))}):(0,t.jsx)("div",{className:`jsx-${x.__hash}`})]})]})}),(0,t.jsx)(i.default,{id:x.__hash,children:x})]})}}let O=(0,n.f)(r.f.ApiConsumer(L),"Lỗi comment đơn"),N=new String(".thread-comments__container.jsx-639e1e01230bcb42{width:100%;position:relative}.middle-comment-promotion.jsx-639e1e01230bcb42{margin-bottom:24px}");N.__hash="639e1e01230bcb42";let R=(0,n.f)(r.f.ApiConsumer(({api:e,posts:r,user:n,isCommenting:o,isNotCommenting:l,enterToSubmit:h,lite:d,mobileFactComment:u,tinhteFact:c})=>{let[p,f]=(0,s.useState)(r||[]),[m,g]=(0,s.useState)(n);return(0,s.useEffect)(()=>{f(r)},[r]),(0,s.useEffect)(()=>{e.onAuthenticated(()=>{e&&e.getUserId()&&e.get("users/me").then(e=>{g((0,a.U)(e.user||{}))}).catch(e=>{console.log("#a7148f Fetching user error: ",e)})})},[]),(0,t.jsxs)("div",{className:`jsx-${N.__hash}`,children:[p&&p.length>0?(0,t.jsx)("div",{className:`jsx-${N.__hash} thread-comments__container`,children:p.map((e,i)=>e.isFirstPost?(0,t.jsx)("div",{className:`jsx-${N.__hash}`},e.id):(0,t.jsx)(s.Fragment,{children:5===i?(0,t.jsxs)(s.Fragment,{children:[(0,t.jsx)(O,{enterToSubmit:h,post:e,user:m,lite:d,isCommenting:o,isNotCommenting:l,mobileFactComment:u}),c?(0,t.jsx)("div",{style:{padding:50},className:`jsx-${N.__hash} middle-comment-promotion`,children:(0,t.jsx)("div",{"data-cptid":"1562704_tinhte.vn_300x250",style:{width:300,height:250,display:"block",margin:"0 auto"},className:`jsx-${N.__hash}`,children:(0,t.jsx)("script",{dangerouslySetInnerHTML:{__html:` window.gnshbrequest.cmd.push(function() { window.gnshbrequest.applyPassback("1562704_tinhte.vn_300x250", "[data-cptid='1562704_tinhte.vn_300x250']"); }); `},className:`jsx-${N.__hash}`})})}):(0,t.jsx)("div",{className:`jsx-${N.__hash} middle-comment-promotion`,children:(0,t.jsx)("div",{"data-cptid":"1562703_tinhte.vn_728x90_2",style:{width:728,height:90,display:"block"},className:`jsx-${N.__hash}`,children:(0,t.jsx)("script",{dangerouslySetInnerHTML:{__html:` window.gnshbrequest.cmd.push(function() { window.gnshbrequest.applyPassback("1562703_tinhte.vn_728x90_2", "[data-cptid='1562703_tinhte.vn_728x90_2']"); }); `},className:`jsx-${N.__hash}`})})})]}):(0,t.jsx)(O,{enterToSubmit:h,post:e,user:m,lite:d,isCommenting:o,isNotCommenting:l,mobileFactComment:u})},e.id))}):(0,t.jsx)("div",{className:`jsx-${N.__hash}`}),(0,t.jsx)(i.default,{id:N.__hash,children:N})]})}),"Lỗi comments");e.s(["f",0,R],535044)},210147,e=>{var t=e.i(391398),i=e.i(145246),s=e.i(191788);let r=new String(".thread-delete.jsx-85b3e83eb5a2e29c{background-color:var(--thread-delete-background);border:1px solid var(--thread-delete-border);border-radius:3px;width:100%;margin-top:1rem;padding:1rem;position:relative}.thread-delete__title.jsx-85b3e83eb5a2e29c{color:#f75551;margin:0 1rem 0 0;font-size:14px;font-weight:700}.thread-delete__reasons.jsx-85b3e83eb5a2e29c{align-items:center;margin-top:1rem;display:flex;position:relative}.title.jsx-85b3e83eb5a2e29c{flex:4rem;margin-right:1rem}.reason.jsx-85b3e83eb5a2e29c{width:100%;color:var(--text-always-black);background-color:#fee3e1;border-radius:5px;outline:none;flex-grow:1;padding:5px 1rem}.thread-delete__submit.jsx-85b3e83eb5a2e29c{text-align:right;width:100%}.button.active.jsx-85b3e83eb5a2e29c{color:#fff;background-color:#f75551;border-radius:4px;outline:none;margin-top:1rem;padding:5px 2rem}@media (width<=600px){.thread-delete__reasons.jsx-85b3e83eb5a2e29c{display:inline-block}.thread-delete__reasons.jsx-85b3e83eb5a2e29c .title.jsx-85b3e83eb5a2e29c{margin-bottom:5px}}");r.__hash="85b3e83eb5a2e29c";let n=async(e,t,i)=>(await e.del({uri:`/posts/${t.id}`,params:{message:i}}),{...t,isDeleted:!0});class a extends s.default.Component{constructor(e){super(e),this.state={deleteMessage:""},this.toggleDeletePost=this.toggleDeletePost.bind(this),this.deleteMessageComposing=this.deleteMessageComposing.bind(this)}deleteMessageComposing(e){this.setState({deleteMessage:e.target.value})}async toggleDeletePost(){let{api:e,post:t}=this.props,{deleteMessage:i}=this.state;try{let s=await n(e,t,i);this.props.deletePost(s)}catch(e){}}render(){return(0,t.jsxs)("div",{className:`jsx-${r.__hash} `,children:[(0,t.jsxs)("div",{className:`jsx-${r.__hash} thread-delete`,children:[(0,t.jsx)("p",{className:`jsx-${r.__hash} thread-delete__title`,children:"Xoá bài viết"}),(0,t.jsxs)("div",{className:`jsx-${r.__hash} thread-delete__reasons`,children:[(0,t.jsx)("p",{className:`jsx-${r.__hash} title`,children:"Lý do:"}),(0,t.jsx)("input",{type:"text",placeholder:"Nhập lý do khác tại đây",onChange:e=>this.deleteMessageComposing(e),className:`jsx-${r.__hash} reason`})]}),(0,t.jsx)("div",{className:`jsx-${r.__hash} thread-delete__submit`,children:(0,t.jsx)("button",{onClick:this.toggleDeletePost,className:`jsx-${r.__hash} button active`,children:"Xoá"})})]}),(0,t.jsx)(i.default,{id:r.__hash,children:r})]})}}e.s(["f",0,a],210147)},929424,e=>{let t=async(e,t)=>{let{stats:i}=t,s=!t.isLiked;return await e[s?"post":"del"]({uri:`/posts/${t.id}/likes`}),{...t,isLiked:s,stats:{...i,like:i.like+(s?1:-1)}}};e.s(["f",0,t])},587388,e=>{let t,i,s,r,n,a;var o,l,h,d=e.i(391398),u=e.i(145246),c=e.i(191788),p=e.i(501584);e.i(966278);var f=e.i(318398),m=e.i(865780),g=e.i(494335),y=e.i(690182),_=e.i(287064),b=e.i(590514);function v(){return(v=Object.assign.bind()).apply(null,arguments)}var T="https://example.com";let S=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=g.default.location&&g.default.location.href||"");var i=/^\/\//.test(e),s=!g.default.location&&!/\/\//i.test(e),r=new URL(t,e=new g.default.URL(e,g.default.location||T));return s?r.href.slice(T.length):i?r.href.slice(r.protocol.length):r.href};var x=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,s=0;s-1;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}let I=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},A=function(e){let t,i={};if(!e)return i;let s=e.split(RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),r=s.length;for(;r--;)""!==s[r]&&((t=/([^=]*)=(.*)/.exec(s[r]).slice(1))[0]=t[0].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^['"](.*)['"]$/g,"$1"),i[t[0]]=t[1]);return i},D=e=>{let t=e.split("x"),i={};return t[0]&&(i.width=parseInt(t[0],10)),t[1]&&(i.height=parseInt(t[1],10)),i};class P extends x{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,i;0===(e=e.trim()).length||("#"!==e[0]?this.trigger("data",{type:"uri",uri:e}):this.tagMappers.reduce((t,i)=>{let s=i(e);return s===e?t:t.concat([s])},[e]).forEach(e=>{for(let t=0;te),this.customParsers.push(r=>{if(e.exec(r))return this.trigger("data",{type:"custom",data:i(r),customType:t,segment:s}),!0})}addTagMapper({expression:e,map:t}){this.tagMappers.push(i=>e.test(i)?t(i):i)}}let L=function(e){let t={};return Object.keys(e).forEach(function(i){t[i.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase())]=e[i]}),t},O=function(e){let{serverControl:t,targetDuration:i,partTargetDuration:s}=e;if(!t)return;let r="#EXT-X-SERVER-CONTROL",n="holdBack",a="partHoldBack",o=i&&3*i,l=s&&2*s;i&&!t.hasOwnProperty(n)&&(t[n]=o,this.trigger("info",{message:`${r} defaulting HOLD-BACK to targetDuration * 3 (${o}).`})),o&&t[n]{!n.uri&&(n.parts||n.preloadHints)&&(!n.map&&t&&(n.map=t),!n.key&&i&&(n.key=i),n.timeline||"number"!=typeof h||(n.timeline=h),this.manifest.preloadSegment=n)}),this.parseStream.on("data",function(e){let p,f;if(s.manifest.definitions){for(let t in s.manifest.definitions)if(e.uri&&(e.uri=e.uri.replace(`{$${t}}`,s.manifest.definitions[t])),e.attributes)for(let i in e.attributes)"string"==typeof e.attributes[i]&&(e.attributes[i]=e.attributes[i].replace(`{$${t}}`,s.manifest.definitions[t]))}({tag(){(({version(){e.version&&(this.manifest.version=e.version)},"allow-cache"(){this.manifest.allowCache=e.allowed,"allowed"in e||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){let t={};"length"in e&&(n.byterange=t,t.length=e.length,"offset"in e||(e.offset=d)),"offset"in e&&(n.byterange=t,t.offset=e.offset),d=t.offset+t.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"})),e.title&&(n.title=e.title),e.duration>0&&(n.duration=e.duration),0===e.duration&&(n.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=r},key(){if(!e.attributes)return void this.trigger("warn",{message:"ignoring key declaration without attribute list"});if("NONE"===e.attributes.METHOD){i=null;return}if(!e.attributes.URI)return void this.trigger("warn",{message:"ignoring key declaration without URI"});if("com.apple.streamingkeydelivery"===e.attributes.KEYFORMAT){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:e.attributes};return}if("com.microsoft.playready"===e.attributes.KEYFORMAT){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:e.attributes.URI};return}"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===e.attributes.KEYFORMAT?-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(e.attributes.METHOD)?this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===e.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==e.attributes.URI.substring(0,23))?this.trigger("warn",{message:"invalid key URI provided for Widevine"}):e.attributes.KEYID&&"0x"===e.attributes.KEYID.substring(0,2)?(this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:e.attributes.KEYFORMAT,keyId:e.attributes.KEYID.substring(2)},pssh:k(e.attributes.URI.split(",")[1])}):this.trigger("warn",{message:"invalid key ID provided for Widevine"}):(e.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),i={method:e.attributes.METHOD||"AES-128",uri:e.attributes.URI},void 0!==e.attributes.IV&&(i.iv=e.attributes.IV))},"media-sequence"(){isFinite(e.number)?this.manifest.mediaSequence=e.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+e.number})},"discontinuity-sequence"(){isFinite(e.number)?(this.manifest.discontinuitySequence=e.number,h=e.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+e.number})},"playlist-type"(){/VOD|EVENT/.test(e.playlistType)?this.manifest.playlistType=e.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+e.playlist})},map(){t={},e.uri&&(t.uri=e.uri),e.byterange&&(t.byterange=e.byterange),i&&(t.key=i)},"stream-inf"(){(this.manifest.playlists=r,this.manifest.mediaGroups=this.manifest.mediaGroups||l,e.attributes)?(n.attributes||(n.attributes={}),w(n.attributes,e.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||l,!(e.attributes&&e.attributes.TYPE&&e.attributes["GROUP-ID"]&&e.attributes.NAME))return void this.trigger("warn",{message:"ignoring incomplete or missing media group"});let t=this.manifest.mediaGroups[e.attributes.TYPE];t[e.attributes["GROUP-ID"]]=t[e.attributes["GROUP-ID"]]||{},p=t[e.attributes["GROUP-ID"]],(f={default:/yes/i.test(e.attributes.DEFAULT)}).default?f.autoselect=!0:f.autoselect=/yes/i.test(e.attributes.AUTOSELECT),e.attributes.LANGUAGE&&(f.language=e.attributes.LANGUAGE),e.attributes.URI&&(f.uri=e.attributes.URI),e.attributes["INSTREAM-ID"]&&(f.instreamId=e.attributes["INSTREAM-ID"]),e.attributes.CHARACTERISTICS&&(f.characteristics=e.attributes.CHARACTERISTICS),e.attributes.FORCED&&(f.forced=/yes/i.test(e.attributes.FORCED)),p[e.attributes.NAME]=f},discontinuity(){h+=1,n.discontinuity=!0,this.manifest.discontinuityStarts.push(r.length)},"program-date-time"(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=e.dateTimeString,this.manifest.dateTimeObject=e.dateTimeObject),n.dateTimeString=e.dateTimeString,n.dateTimeObject=e.dateTimeObject;let{lastProgramDateTime:t}=this;this.lastProgramDateTime=new Date(e.dateTimeString).getTime(),null===t&&this.manifest.segments.reduceRight((e,t)=>(t.programDateTime=e-1e3*t.duration,t.programDateTime),this.lastProgramDateTime)},targetduration(){!isFinite(e.duration)||e.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+e.duration}):(this.manifest.targetDuration=e.duration,O.call(this,this.manifest))},start(){!e.attributes||isNaN(e.attributes["TIME-OFFSET"])?this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"}):this.manifest.start={timeOffset:e.attributes["TIME-OFFSET"],precise:e.attributes.PRECISE}},"cue-out"(){n.cueOut=e.data},"cue-out-cont"(){n.cueOutCont=e.data},"cue-in"(){n.cueIn=e.data},skip(){this.manifest.skip=L(e.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",e.attributes,["SKIPPED-SEGMENTS"])},part(){a=!0;let t=this.manifest.segments.length,i=L(e.attributes);n.parts=n.parts||[],n.parts.push(i),i.byterange&&(i.byterange.hasOwnProperty("offset")||(i.byterange.offset=u),u=i.byterange.offset+i.byterange.length);let s=n.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${s} for segment #${t}`,e.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 t=this.manifest.serverControl=L(e.attributes);t.hasOwnProperty("canBlockReload")||(t.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),O.call(this,this.manifest),t.canSkipDateranges&&!t.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){let t=this.manifest.segments.length,i=L(e.attributes),s=i.type&&"PART"===i.type;n.preloadHints=n.preloadHints||[],n.preloadHints.push(i),i.byterange&&!i.byterange.hasOwnProperty("offset")&&(i.byterange.offset=s?u:0,s&&(u=i.byterange.offset+i.byterange.length));let r=n.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${r} for segment #${t}`,e.attributes,["TYPE","URI"]),i.type)for(let e=0;ee.id===i.id);this.manifest.dateRanges[e]=w(this.manifest.dateRanges[e],i),c[i.id]=w(c[i.id],i),this.manifest.dateRanges.pop()}else c[i.id]=i},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=L(e.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",e.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};let t=(e,t)=>{e in this.manifest.definitions?this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${e}`}):this.manifest.definitions[e]=t};if("QUERYPARAM"in e.attributes){if("NAME"in e.attributes||"IMPORT"in e.attributes)return void this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});let i=this.params.get(e.attributes.QUERYPARAM);return i?void t(e.attributes.QUERYPARAM,decodeURIComponent(i)):void this.trigger("error",{message:`EXT-X-DEFINE: No query param ${e.attributes.QUERYPARAM}`})}"NAME"in e.attributes?"IMPORT"in e.attributes?this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"}):"VALUE"in e.attributes&&"string"==typeof e.attributes.VALUE?t(e.attributes.NAME,e.attributes.VALUE):this.trigger("error",{message:`EXT-X-DEFINE: No value for ${e.attributes.NAME}`}):"IMPORT"in e.attributes?this.mainDefinitions[e.attributes.IMPORT]?t(e.attributes.IMPORT,this.mainDefinitions[e.attributes.IMPORT]):this.trigger("error",{message:`EXT-X-DEFINE: No value ${e.attributes.IMPORT} to import, or IMPORT used on main playlist`}):this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:e.attributes,uri:e.uri,timeline:h}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",e.attributes,["BANDWIDTH","URI"])}})[e.tagType]||o).call(s)},uri(){n.uri=e.uri,r.push(n),!this.manifest.targetDuration||"duration"in n||(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),n.duration=this.manifest.targetDuration),i&&(n.key=i),n.timeline=h,t&&(n.map=t),u=0,null!==this.lastProgramDateTime&&(n.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=1e3*n.duration),n={}},comment(){},custom(){e.segment?(n.custom=n.custom||{},n.custom[e.customType]=e.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[e.customType]=e.data)}})[e.type].call(s)})}requiredCompatibilityversion(e,t){(el&&(o-=l,o-=l,o-=Q(2))}return Number(o)},ee=function(e,t){var i=(void 0===t?{}:t).le,s=void 0!==i&&i;("bigint"!=typeof e&&"number"!=typeof e||"number"==typeof e&&e!=e)&&(e=0);for(var r=Math.ceil((e=Q(e)).toString(2).length/8),n=new Uint8Array(new ArrayBuffer(r)),a=0;a=t.length&&l.call(t,function(t,i){return t===(o[i]?o[i]&e[n+i]:e[n+i])})},en=function(e,t,i){t.forEach(function(t){for(var s in e.mediaGroups[t])for(var r in e.mediaGroups[t][s])i(e.mediaGroups[t][s][r],t,s,r)})},ea=e.i(724290);let eo=e=>!!e&&"object"==typeof e,el=(...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]):eo(e[i])&&eo(t[i])?e[i]=el(e[i],t[i]):e[i]=t[i]}),e),{}),eh=e=>Object.keys(e).map(t=>e[t]),ed=e=>e.reduce((e,t)=>e.concat(t),[]),eu=e=>{if(!e.length)return[];let t=[];for(let i=0;i{let r={uri:t,resolvedUri:S(e||"",t)};if(i||s){let e,t=(i||s).split("-"),n=g.default.BigInt?g.default.BigInt(t[0]):parseInt(t[0],10),a=g.default.BigInt?g.default.BigInt(t[1]):parseInt(t[1],10);n(e&&"number"!=typeof e&&(e=parseInt(e,10)),isNaN(e))?null:e,ef={static(e){let{duration:t,timescale:i=1,sourceDuration:s,periodDuration:r}=e,n=ep(e.endNumber),a=t/i;return"number"==typeof n?{start:0,end:n}:"number"==typeof r?{start:0,end:r/a}:{start:0,end:s/a}},dynamic(e){let{NOW:t,clientOffset:i,availabilityStartTime:s,timescale:r=1,duration:n,periodStart:a=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:l=1/0}=e,h=ep(e.endNumber),d=(t+i)/1e3,u=s+a,c=Math.ceil((d+o-u)*r/n),p=Math.floor((d-u-l)*r/n),f=Math.floor((d-u)*r/n);return{start:Math.max(0,p),end:"number"==typeof h?h:Math.min(c,f)}}},em=e=>{let{type:t,duration:i,timescale:s=1,periodDuration:r,sourceDuration:n}=e,{start:a,end:o}=ef[t](e),l=((e,t)=>{let i=[];for(let s=e;s{let{duration:i,timescale:s=1,periodStart:r,startNumber:n=1}=e;return{number:n+t,duration:i/s,timeline:r,time:t*i}});if("static"===t){let e=l.length-1;l[e].duration=("number"==typeof r?r:n)-i/s*e}return l},eg=e=>{let{baseUrl:t,initialization:i={},sourceDuration:s,indexRange:r="",periodStart:n,presentationTime:a,number:o=0,duration:l}=e;if(!t)throw Error("NO_BASE_URL");let h=ec({baseUrl:t,source:i.sourceURL,range:i.range}),d=ec({baseUrl:t,source:t,indexRange:r});if(d.map=h,l){let t=em(e);t.length&&(d.duration=t[0].duration,d.timeline=t[0].timeline)}else s&&(d.duration=s,d.timeline=n);return d.presentationTime=a||n,d.number=o,[d]},ey=(e,t,i)=>{let s,r=e.sidx.map?e.sidx.map:null,n=e.sidx.duration,a=e.timeline||0,o=e.sidx.byterange,l=o.offset+o.length,h=t.timescale,d=t.references.filter(e=>1!==e.referenceType),u=[],c=e.endList?"static":"dynamic",p=e.sidx.timeline,f=p,m=e.mediaSequence||0;s="bigint"==typeof t.firstOffset?g.default.BigInt(l)+t.firstOffset:l+t.firstOffset;for(let e=0;e{let t;return(t=({timeline:e})=>e,eh(e.reduce((e,i)=>(i.forEach(i=>{e[t(i)]=i}),e),{}))).sort((e,t)=>e.timeline>t.timeline?1:-1)},eT=e=>{let t=[];return en(e,e_,(e,i,s,r)=>{t=t.concat(e.playlists||[])}),t},eS=({playlist:e,mediaSequence:t})=>{e.mediaSequence=t,e.segments.forEach((t,i)=>{t.number=e.mediaSequence+i})},ex=e=>{var t;let i;return e&&e.uri+"-"+(i="bigint"==typeof(t=e.byterange).offset||"bigint"==typeof t.length?g.default.BigInt(t.offset)+g.default.BigInt(t.length)-g.default.BigInt(1):t.offset+t.length-1,`${t.offset}-${i}`)},ew=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=eh(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=(e.segments||[]).reduce((e,t,i)=>(t.discontinuity&&e.push(i),e),[]),e))},eE=(e,t)=>{let i=ex(e.sidx),s=i&&t[i]&&t[i].sidx;return s&&ey(e,s,e.sidx.resolvedUri),e},ek=({attributes:e,segments:t,sidx:i,discontinuityStarts:s})=>{let r={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:s,timelineStarts:e.timelineStarts,segments:t};return e.frameRate&&(r.attributes["FRAME-RATE"]=e.frameRate),void 0!==e.qualityRanking&&(r.attributes.SCORE=1/(e.qualityRanking+1)),e.contentProtection&&(r.contentProtection=e.contentProtection),e.serviceLocation&&(r.attributes.serviceLocation=e.serviceLocation),i&&(r.sidx=i),r},eC=({attributes:e})=>"video/mp4"===e.mimeType||"video/webm"===e.mimeType||"video"===e.contentType,eI=({attributes:e})=>"audio/mp4"===e.mimeType||"audio/webm"===e.mimeType||"audio"===e.contentType,eA=({attributes:e})=>"text/vtt"===e.mimeType||"text"===e.contentType,eD=e=>e?Object.keys(e).reduce((t,i)=>{let s=e[i];return t.concat(s.playlists)},[]):[],eP=(e,t,i)=>{let{NOW:s,clientOffset:r,availabilityStartTime:n,timescale:a=1,periodStart:o=0,minimumUpdatePeriod:l=0}=e;return Math.ceil((((s+r)/1e3+l-(n+o))*a-t)/i)},eL=(e,t)=>{let{type:i,minimumUpdatePeriod:s=0,media:r="",sourceDuration:n,timescale:a=1,startNumber:o=1,periodStart:l}=e,h=[],d=-1;for(let u=0;ud&&(d=g),m<0){let o=u+1;c=o===t.length?"dynamic"===i&&s>0&&r.indexOf("$Number$")>0?eP(e,d,f):(n*a-d)/f:(t[o].t-d)/f}else c=m+1;let y=o+h.length+c,_=o+h.length;for(;_e.replace(eO,(e,i,s,r)=>{if("$$"===e)return"$";if(void 0===t[i])return e;let n=""+t[i];return"RepresentationID"===i||(r=s?parseInt(r,10):1,n.length>=r)?n:`${Array(r-n.length+1).join("0")}${n}`}),eR=(e,t)=>{let i={RepresentationID:e.id,Bandwidth:e.bandwidth||0},{initialization:s={sourceURL:"",range:""}}=e,r=ec({baseUrl:e.baseUrl,source:eN(s.sourceURL,i),range:s.range});return(!e.duration&&!t?[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodStart}]:e.duration?em(e):eL(e,t)).map(t=>{i.Number=t.number,i.Time=t.time;let s=eN(e.media||"",i),n=e.timescale||1,a=e.presentationTimeOffset||0,o=e.periodStart+(t.time-a)/n;return{uri:s,timeline:t.timeline,duration:t.duration,resolvedUri:S(e.baseUrl||"",s),map:r,number:t.number,presentationTime:o}})},eM=(e,t)=>{let i,{duration:s,segmentUrls:r=[],periodStart:n}=e;if(!s&&!t||s&&t)throw Error("SEGMENT_TIME_UNSPECIFIED");let a=r.map(t=>((e,t)=>{let{baseUrl:i,initialization:s={}}=e,r=ec({baseUrl:i,source:s.sourceURL,range:s.range}),n=ec({baseUrl:i,source:t.media,range:t.mediaRange});return n.map=r,n})(e,t));return s&&(i=em(e)),t&&(i=eL(e,t)),i.map((t,i)=>{if(a[i]){let s=a[i],r=e.timescale||1,o=e.presentationTimeOffset||0;return s.timeline=t.timeline,s.duration=t.duration,s.number=t.number,s.presentationTime=n+(t.time-o)/r,s}}).filter(e=>e)},eU=({attributes:e,segmentInfo:t})=>{let i,s;t.template?(s=eR,i=el(e,t.template)):t.base?(s=eg,i=el(e,t.base)):t.list&&(s=eM,i=el(e,t.list));let r={attributes:e};if(!s)return r;let n=s(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 r.attributes=i,r.segments=n,t.base&&i.indexRange&&(r.sidx=n[0],r.segments=[]),r},ej=(e,t)=>eu(e.childNodes).filter(({tagName:e})=>e===t),eB=e=>e.textContent.trim(),eq=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,s,r,n,a,o]=t.slice(1);return 31536e3*parseFloat(i||0)+2592e3*parseFloat(s||0)+86400*parseFloat(r||0)+3600*parseFloat(n||0)+60*parseFloat(a||0)+parseFloat(o||0)},e$={mediaPresentationDuration:e=>eq(e),availabilityStartTime:e=>{var t;return t=e,/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t)&&(t+="Z"),Date.parse(t)/1e3},minimumUpdatePeriod:e=>eq(e),suggestedPresentationDelay:e=>eq(e),type:e=>e,timeShiftBufferDepth:e=>eq(e),start:e=>eq(e),width:e=>parseInt(e,10),height:e=>parseInt(e,10),bandwidth:e=>parseInt(e,10),frameRate:e=>parseFloat(e.split("/").reduce((e,t)=>e/t)),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)?eq(e):t},d:e=>parseInt(e,10),t:e=>parseInt(e,10),r:e=>parseInt(e,10),presentationTime:e=>parseInt(e,10),qualityRanking:e=>parseInt(e,10),qualityranking:e=>parseInt(e,10),DEFAULT:e=>e},eF={qualityranking:"qualityRanking"},eV=e=>e&&e.attributes?eu(e.attributes).reduce((e,t)=>{let i=e$[t.name]||e$.DEFAULT;return e[eF[t.name]||t.name]=i(t.value),e},{}):{},eH={"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"},ez=(e,t)=>t.length?ed(e.map(function(e){return t.map(function(t){let i=eB(t),s=S(e.baseUrl,i),r=el(eV(t),{baseUrl:s});return s!==i&&!r.serviceLocation&&e.serviceLocation&&(r.serviceLocation=e.serviceLocation),r})})):e,eW=e=>{let t=ej(e,"SegmentTemplate")[0],i=ej(e,"SegmentList")[0],s=i&&ej(i,"SegmentURL").map(e=>el({tag:"SegmentURL"},eV(e))),r=ej(e,"SegmentBase")[0],n=i||t,a=n&&ej(n,"SegmentTimeline")[0],o=i||r||t,l=o&&ej(o,"Initialization")[0],h=t&&eV(t);h&&l?h.initialization=l&&eV(l):h&&h.initialization&&(h.initialization={sourceURL:h.initialization});let d={template:h,segmentTimeline:a&&ej(a,"S").map(e=>eV(e)),list:i&&el(eV(i),{segmentUrls:s,initialization:eV(l)}),base:r&&el(eV(r),{initialization:eV(l)})};return Object.keys(d).forEach(e=>{d[e]||delete d[e]}),d},eG=e=>ed(ej(e.node,"EventStream").map(t=>{let i=eV(t),s=i.schemeIdUri;return ej(t,"Event").map(t=>{let r=eV(t),n=r.presentationTime||0,a=i.timescale||1,o=r.duration||0,l=n/a+e.attributes.start;return{schemeIdUri:s,value:i.value,id:r.id,start:l,end:l+o/a,messageData:eB(t)||r.messageData,contentEncoding:i.contentEncoding,presentationTimeOffset:i.presentationTimeOffset||0}})})),eX=e=>{let t,i;if(""===e)throw Error("DASH_EMPTY_MANIFEST");let s=new ea.DOMParser;try{i=(t=s.parseFromString(e,"application/xml"))&&"MPD"===t.documentElement.tagName?t.documentElement:null}catch(e){}if(!i||i&&i.getElementsByTagName("parsererror").length>0)throw Error("DASH_INVALID_XML");return i};var eK=e.i(210573),eY=Y([73,68,51]),eQ=function(e,t){void 0===t&&(t=0);var i=(e=Y(e))[t+5],s=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&i)>>4?s+20:s+10},eJ=function e(t,i){return(void 0===i&&(i=0),(t=Y(t)).length-i<10||!er(t,eY,{offset:i}))?i:(i+=eQ(t,i),e(t,i))};new Uint8Array([79,112,117,115,72,101,97,100]);var eZ=function(e){return"string"==typeof e?ei(e):e},e0=function(e){e=Y(e);for(var t=[],i=0;e.length>i;){var s=e[i],r=0,n=0,a=e[++n];for(n++;128&a;)r=(127&a)<<7,a=e[n],n++;r+=127&a;for(var o=0;o>>0,l=t.subarray(a+4,a+8);if(0===o)break;var h=a+o;if(h>t.length){if(s)break;h=t.length}var d=t.subarray(a+8,h);er(l,i[0])&&(1===i.length?n.push(d):n.push.apply(n,e(d,i.slice(1),s))),a=h}return n},e2={EBML:Y([26,69,223,163]),DocType:Y([66,130]),Segment:Y([24,83,128,103]),SegmentInfo:Y([21,73,169,102]),Tracks:Y([22,84,174,107]),Track:Y([174]),TrackNumber:Y([215]),DefaultDuration:Y([35,227,131]),TrackEntry:Y([174]),TrackType:Y([131]),FlagDefault:Y([136]),CodecID:Y([134]),CodecPrivate:Y([99,162]),VideoTrack:Y([224]),AudioTrack:Y([225]),Cluster:Y([31,67,182,117]),Timestamp:Y([231]),TimestampScale:Y([42,215,177]),BlockGroup:Y([160]),BlockDuration:Y([155]),Block:Y([161]),SimpleBlock:Y([163])},e4=[128,64,32,16,8,4,2,1],e5=function(e){for(var t=1,i=0;i=i.length)return i.length;var r=e8(i,s,!1);if(er(t.bytes,r.bytes))return s;var n=e8(i,s+r.length);return e(t,i,s+n.length+n.value+r.length)},e7=function e(t,i){i=Array.isArray(s=i)?s.map(function(e){return e3(e)}):[e3(s)],t=Y(t);var s,r=[];if(!i.length)return r;for(var n=0;nt.length?t.length:l+o.value,d=t.subarray(l,h);er(i[0],a.bytes)&&(1===i.length?r.push(d):r=r.concat(e(d,i.slice(1)))),n+=a.length+o.length+d.length}return r},e9=Y([0,0,0,1]),te=Y([0,0,1]),tt=Y([0,0,3]),ti=function(e){for(var t=[],i=1;i>1&63),-1!==i.indexOf(l)&&(r=n+o),n+=o+("h264"===t?1:2)}return e.subarray(0,0)},tr={webm:Y([119,101,98,109]),matroska:Y([109,97,116,114,111,115,107,97]),flac:Y([102,76,97,67]),ogg:Y([79,103,103,83]),ac3:Y([11,119]),riff:Y([82,73,70,70]),avi:Y([65,86,73]),wav:Y([87,65,86,69]),"3gp":Y([102,116,121,112,51,103]),mp4:Y([102,116,121,112]),fmp4:Y([115,116,121,112]),mov:Y([102,116,121,112,113,116]),moov:Y([109,111,111,118]),moof:Y([109,111,111,102]),vtt:Y([87,69,66,86,84,84])},tn={aac:function(e){var t=eJ(e);return er(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=eJ(e);return er(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){return er(e7(e,[e2.EBML,e2.DocType])[0],tr.webm)},mkv:function(e){return er(e7(e,[e2.EBML,e2.DocType])[0],tr.matroska)},mp4:function(e){return!(tn["3gp"](e)||tn.mov(e))&&(!!(er(e,tr.mp4,{offset:4})||er(e,tr.fmp4,{offset:4})||er(e,tr.moof,{offset:4})||er(e,tr.moov,{offset:4}))||void 0)},mov:function(e){return er(e,tr.mov,{offset:4})},"3gp":function(e){return er(e,tr["3gp"],{offset:4})},ac3:function(e){var t=eJ(e);return er(e,tr.ac3,{offset:t})},vtt:function(e){return er(e,tr.vtt)},ts:function(e){if(e.length<189&&e.length>=1)return 71===e[0];for(var t=0;t+188{let n=a.levels[i],o=RegExp(`^(${n})$`),l=t;if("log"!==e&&r.unshift(e.toUpperCase()+":"),s&&(l=`%c${t}`,r.unshift(s)),r.unshift(l+":"),tg){tg.push([].concat(r));let e=tg.length-1e3;tg.splice(0,e>0?e:0)}if(!g.default.console)return;let h=g.default.console[e];h||"debug"!==e||(h=g.default.console.info||g.default.console.log),h&&n&&o.test(e)&&h[Array.isArray(r)?"apply":"call"](g.default.console,r)},a.createLogger=(r,n,a)=>{let o=void 0!==n?n:i;return e(`${t} ${o} ${r}`,o,void 0!==a?a:s)},a.createNewLogger=(t,i,s)=>e(t,i,s),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=()=>tg?[].concat(tg):[],a.history.filter=e=>(tg||[]).filter(t=>RegExp(`.*${e}.*`).test(t[0])),a.history.clear=()=>{tg&&(tg.length=0)},a.history.disable=()=>{null!==tg&&(tg.length=0,tg=null)},a.history.enable=()=>{null===tg&&(tg=[])},a.error=(...e)=>r("error",n,e),a.warn=(...e)=>r("warn",n,e),a.debug=(...e)=>r("debug",n,e),a}("VIDEOJS"),t_=ty.createLogger,tb=Object.prototype.toString,tv=function(e){return tx(e)?Object.keys(e):[]};function tT(e,t){tv(e).forEach(i=>t(e[i],i))}function tS(e,t,i=0){return tv(e).reduce((i,s)=>t(i,e[s],s),i)}function tx(e){return!!e&&"object"==typeof e}function tw(e){return tx(e)&&"[object Object]"===tb.call(e)&&e.constructor===Object}function tE(...e){let t={};return e.forEach(e=>{e&&tT(e,(e,i)=>{if(!tw(e)){t[i]=e;return}tw(t[i])||(t[i]={}),t[i]=tE(t[i],e)})}),t}function tk(e={}){let t=[];for(let i in e)if(e.hasOwnProperty(i)){let s=e[i];t.push(s)}return t}function tC(e,t,i,s=!0){let r=i=>Object.defineProperty(e,t,{value:i,enumerable:!0,writable:!0}),n={configurable:!0,enumerable:!0,get(){let e=i();return r(e),e}};return s&&(n.set=r),Object.defineProperty(e,t,n)}var tI=Object.freeze({__proto__:null,each:tT,reduce:tS,isObject:tx,isPlain:tw,merge:tE,values:tk,defineLazyProperty:tC});let tA=!1,tD=null,tP=!1,tL=!1,tO=!1,tN=!1,tR=!1,tM=null,tU=null,tj=!!(g.default.cast&&g.default.cast.framework&&g.default.cast.framework.CastReceiverContext),tB=null,tq=!1,t$=!1,tF=!1,tV=!1,tH=!1,tz=!1,tW=!1,tG=!!(tZ()&&("ontouchstart"in g.default||g.default.navigator.maxTouchPoints||g.default.DocumentTouch&&g.default.document instanceof g.default.DocumentTouch)),tX=g.default.navigator&&g.default.navigator.userAgentData;if(tX&&tX.platform&&tX.brands&&(tP="Android"===tX.platform,tO=!!tX.brands.find(e=>"Microsoft Edge"===e.brand),tN=!!tX.brands.find(e=>"Chromium"===e.brand),tR=!tO&&tN,tM=tU=(tX.brands.find(e=>"Chromium"===e.brand)||{}).version||null,t$="Windows"===tX.platform),!tN){let e,t,s,r,n=g.default.navigator&&g.default.navigator.userAgent||"";tA=/iPod/i.test(n),tD=(e=n.match(/OS (\d+)_/i))&&e[1]?e[1]:null,tP=/Android/i.test(n),i=function(){let e=n.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;let t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);return t&&i?parseFloat(e[1]+"."+e[2]):t||null}(),tL=/Firefox/i.test(n),tO=/Edg/i.test(n),tN=/Chrome/i.test(n)||/CriOS/i.test(n),tR=!tO&&tN,tM=tU=(t=n.match(/(Chrome|CriOS)\/(\d+)/))&&t[2]?parseFloat(t[2]):null,!(r=(s=/MSIE\s(\d+)\.\d/.exec(n))&&parseFloat(s[1]))&&/Trident\/7.0/i.test(n)&&/rv:11.0/.test(n)&&(r=11),tB=r,tH=/Tizen/i.test(n),tz=/Web0S/i.test(n),tW=tH||tz,tq=/Safari/i.test(n)&&!tR&&!tP&&!tO&&!tW,t$=/Windows/i.test(n),tF=/iPad/i.test(n)||tq&&tG&&!/iPhone/i.test(n),tV=/iPhone/i.test(n)&&!tF}let tK=tV||tF||tA,tY=(tq||tK)&&!tR;var tQ=Object.freeze({__proto__:null,get IS_IPOD(){return tA},get IOS_VERSION(){return tD},get IS_ANDROID(){return tP},get ANDROID_VERSION(){return i},get IS_FIREFOX(){return tL},get IS_EDGE(){return tO},get IS_CHROMIUM(){return tN},get IS_CHROME(){return tR},get CHROMIUM_VERSION(){return tM},get CHROME_VERSION(){return tU},IS_CHROMECAST_RECEIVER:tj,get IE_VERSION(){return tB},get IS_SAFARI(){return tq},get IS_WINDOWS(){return t$},get IS_IPAD(){return tF},get IS_IPHONE(){return tV},get IS_TIZEN(){return tH},get IS_WEBOS(){return tz},get IS_SMART_TV(){return tW},TOUCH_ENABLED:tG,IS_IOS:tK,IS_ANY_SAFARI:tY});function tJ(e){return"string"==typeof e&&!!e.trim()}function tZ(){return y.default===g.default.document}function t0(e){return tx(e)&&1===e.nodeType}function t1(){try{return g.default.parent!==g.default.self}catch(e){return!0}}function t2(e){return function(t,i){if(!tJ(t))return y.default[e](null);tJ(i)&&(i=y.default.querySelector(i));let s=t0(i)?i:y.default;return s[e]&&s[e](t)}}function t4(e="div",t={},i={},s){let r=y.default.createElement(e);return Object.getOwnPropertyNames(t).forEach(function(e){let i=t[e];"textContent"===e?t5(r,i):(r[e]!==i||"tabIndex"===e)&&(r[e]=i)}),Object.getOwnPropertyNames(i).forEach(function(e){r.setAttribute(e,i[e])}),s&&im(r,s),r}function t5(e,t){return void 0===e.textContent?e.innerText=t:e.textContent=t,e}function t8(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function t3(e,t){if(t.indexOf(" ")>=0)throw Error("class has illegal whitespace characters");return e.classList.contains(t)}function t6(e,...t){return e.classList.add(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e}function t7(e,...t){return e?(e.classList.remove(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e):(ty.warn("removeClass was called with an element that doesn't exist"),null)}function t9(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 ie(e,t){Object.getOwnPropertyNames(t).forEach(function(i){let s=t[i];null==s||!1===s?e.removeAttribute(i):e.setAttribute(i,!0===s?"":s)})}function it(e){let t={},i=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(e&&e.attributes&&e.attributes.length>0){let s=e.attributes;for(let e=s.length-1;e>=0;e--){let r=s[e].name,n=s[e].value;i.includes(r)&&(n=null!==n),t[r]=n}}return t}function ii(e,t){return e.getAttribute(t)}function is(e,t,i){e.setAttribute(t,i)}function ir(e,t){e.removeAttribute(t)}function ia(){y.default.body.focus(),y.default.onselectstart=function(){return!1}}function io(){y.default.onselectstart=function(){return!0}}function il(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(iv(e,"height"))),i.width||(i.width=parseFloat(iv(e,"width"))),i}}function ih(e){if(!e||e&&!e.offsetParent)return{left:0,top:0,width:0,height:0};let t=e.offsetWidth,i=e.offsetHeight,s=0,r=0;for(;e.offsetParent&&e!==y.default[tp.fullscreenElement];)s+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:s,top:r,width:t,height:i}}function id(e,t){let i={x:0,y:0};if(tK){let t=e;for(;t&&"html"!==t.nodeName.toLowerCase();){let e=iv(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]}if(t.assignedSlot&&t.assignedSlot.parentElement&&g.default.WebKitCSSMatrix){let e=g.default.getComputedStyle(t.assignedSlot.parentElement).transform,s=new g.default.WebKitCSSMatrix(e);i.x+=s.m41,i.y+=s.m42}t=t.parentNode||t.host}}let s={},r=ih(t.target),n=ih(e),a=n.width,o=n.height,l=t.offsetY-(n.top-r.top),h=t.offsetX-(n.left-r.left);return t.changedTouches&&(h=t.changedTouches[0].pageX-n.left,l=t.changedTouches[0].pageY+n.top,tK&&(h-=i.x,l-=i.y)),s.y=1-Math.max(0,Math.min(1,l/o)),s.x=Math.max(0,Math.min(1,h/a)),s}function iu(e){return tx(e)&&3===e.nodeType}function ic(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function ip(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map(e=>("function"==typeof e&&(e=e()),t0(e)||iu(e))?e:"string"==typeof e&&/\S/.test(e)?y.default.createTextNode(e):void 0).filter(e=>e)}function im(e,t){return ip(t).forEach(t=>e.appendChild(t)),e}function ig(e,t){return im(ic(e),t)}function iy(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||"mousedown"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons}let i_=t2("querySelector"),ib=t2("querySelectorAll");function iv(e,t){if(!e||!t)return"";if("function"==typeof g.default.getComputedStyle){let i;try{i=g.default.getComputedStyle(e)}catch(e){return""}return i?i.getPropertyValue(t)||i[t]:""}return""}function iT(e){[...y.default.styleSheets].forEach(t=>{try{let i=[...t.cssRules].map(e=>e.cssText).join(""),s=y.default.createElement("style");s.textContent=i,e.document.head.appendChild(s)}catch(s){let i=y.default.createElement("link");i.rel="stylesheet",i.type=t.type,i.media=t.media.mediaText,i.href=t.href,e.document.head.appendChild(i)}})}var iS=Object.freeze({__proto__:null,isReal:tZ,isEl:t0,isInFrame:t1,createEl:t4,textContent:t5,prependTo:t8,hasClass:t3,addClass:t6,removeClass:t7,toggleClass:t9,setAttributes:ie,getAttributes:it,getAttribute:ii,setAttribute:is,removeAttribute:ir,blockTextSelection:ia,unblockTextSelection:io,getBoundingClientRect:il,findPosition:ih,getPointerPosition:id,isTextNode:iu,emptyEl:ic,normalizeContent:ip,appendContent:im,insertContent:ig,isSingleLeftClick:iy,$:i_,$$:ib,computedStyle:iv,copyStyleSheetsToWindow:iT});let ix=!1,iw=function(){if(!1===s.options.autoSetup)return;let e=Array.prototype.slice.call(y.default.getElementsByTagName("video")),t=Array.prototype.slice.call(y.default.getElementsByTagName("audio")),i=Array.prototype.slice.call(y.default.getElementsByTagName("video-js")),r=e.concat(t,i);if(r&&r.length>0)for(let e=0,t=r.length;e-1&&(i={passive:!0}),e.addEventListener(t,s.dispatcher,i)}else e.attachEvent&&e.attachEvent("on"+t,s.dispatcher)}function iU(e,t,i){if(!iA.has(e))return;let s=iA.get(e);if(!s.handlers)return;if(Array.isArray(t))return iL(iU,e,t,i);let r=function(e,t){s.handlers[t]=[],iP(e,t)};if(void 0===t){for(let t in s.handlers)Object.prototype.hasOwnProperty.call(s.handlers||{},t)&&r(e,t);return}let n=s.handlers[t];if(n){if(!i)return void r(e,t);if(i.guid)for(let e=0;e=t&&(e(...s),i=r)}},iH=function(e,t,i,s=g.default){let r,n=function(){let n=this,a=arguments,o=function(){r=null,o=null,i||e.apply(n,a)};!r&&i&&e.apply(n,a),s.clearTimeout(r),r=s.setTimeout(o,t)};return n.cancel=()=>{s.clearTimeout(r),r=null},n};var iz=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:30,bind_:iF,throttle:iV,debounce:iH});class iW{on(e,t){let i=this.addEventListener;this.addEventListener=()=>{},iM(this,e,t),this.addEventListener=i}off(e,t){iU(this,e,t)}one(e,t){let i=this.addEventListener;this.addEventListener=()=>{},iB(this,e,t),this.addEventListener=i}any(e,t){let i=this.addEventListener;this.addEventListener=()=>{},iq(this,e,t),this.addEventListener=i}trigger(e){let t=e.type||e;"string"==typeof e&&(e={type:t}),e=iO(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),ij(this,e)}queueTrigger(e){n||(n=new Map);let t=e.type||e,i=n.get(this);i||(i=new Map,n.set(this,i));let s=i.get(t);i.delete(t),g.default.clearTimeout(s);let r=g.default.setTimeout(()=>{i.delete(t),0===i.size&&(i=null,n.delete(this)),this.trigger(e)},0);i.set(t,r)}}iW.prototype.allowedEvents_={},iW.prototype.addEventListener=iW.prototype.on,iW.prototype.removeEventListener=iW.prototype.off,iW.prototype.dispatchEvent=iW.prototype.trigger;let iG=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,iX=e=>e instanceof iW||!!e.eventBusEl_&&["on","one","off","trigger"].every(t=>"function"==typeof e[t]),iK=e=>"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length,iY=(e,t,i)=>{if(!e||!e.nodeName&&!iX(e))throw Error(`Invalid target for ${iG(t)}#${i}; must be a DOM node or evented object.`)},iQ=(e,t,i)=>{if(!iK(e))throw Error(`Invalid event type for ${iG(t)}#${i}; must be a non-empty string or array.`)},iJ=(e,t,i)=>{if("function"!=typeof e)throw Error(`Invalid listener for ${iG(t)}#${i}; must be a function.`)},iZ=(e,t,i)=>{let s,r,n,a=t.length<3||t[0]===e||t[0]===e.eventBusEl_;return a?(s=e.eventBusEl_,t.length>=3&&t.shift(),[r,n]=t):(s=t[0],r=t[1],n=t[2]),iY(s,e,i),iQ(r,e,i),iJ(n,e,i),{isTargetingSelf:a,target:s,type:r,listener:n=iF(e,n)}},i0=(e,t,i,s)=>{iY(e,e,t),e.nodeName?i$[t](e,i,s):e[t](i,s)},i1={on(...e){let{isTargetingSelf:t,target:i,type:s,listener:r}=iZ(this,e,"on");if(i0(i,"on",s,r),!t){let e=()=>this.off(i,s,r);e.guid=r.guid;let t=()=>this.off("dispose",e);t.guid=r.guid,i0(this,"on","dispose",e),i0(i,"on","dispose",t)}},one(...e){let{isTargetingSelf:t,target:i,type:s,listener:r}=iZ(this,e,"one");if(t)i0(i,"one",s,r);else{let e=(...t)=>{this.off(i,s,e),r.apply(null,t)};e.guid=r.guid,i0(i,"one",s,e)}},any(...e){let{isTargetingSelf:t,target:i,type:s,listener:r}=iZ(this,e,"any");if(t)i0(i,"any",s,r);else{let e=(...t)=>{this.off(i,s,e),r.apply(null,t)};e.guid=r.guid,i0(i,"any",s,e)}},off(e,t,i){!e||iK(e)?iU(this.eventBusEl_,e,t):(iY(e,this,"off"),iQ(t,this,"off"),iJ(i,this,"off"),i=iF(this,i),this.off("dispose",i),e.nodeName?(iU(e,t,i),iU(e,"dispose",i)):iX(e)&&(e.off(t,i),e.off("dispose",i)))},trigger(e,t){if(iY(this.eventBusEl_,this,"trigger"),!iK(e&&"string"!=typeof e?e.type:e))throw Error(`Invalid event type for ${iG(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return ij(this.eventBusEl_,e,t)}};function i2(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_=t4("span",{className:"vjs-event-bus"});return Object.assign(e,i1),e.eventedCallbacks&&e.eventedCallbacks.forEach(e=>{e()}),e.on("dispose",()=>{e.off(),[e,e.el_,e.eventBusEl_].forEach(function(e){e&&iA.has(e)&&iA.delete(e)}),g.default.setTimeout(()=>{e.eventBusEl_=null},0)}),e}let i4={state:{},setState(e){let t;return"function"==typeof e&&(e=e()),tT(e,(e,i)=>{this.state[i]!==e&&((t=t||{})[i]={from:this.state[i],to:e}),this.state[i]=e}),t&&iX(this)&&this.trigger({changes:t,type:"statechanged"}),t}};function i5(e,t){return Object.assign(e,i4),e.state=Object.assign({},e.state,t),"function"==typeof e.handleStateChanged&&iX(e)&&e.on("statechanged",e.handleStateChanged),e}let i8=function(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toLowerCase())},i3=function(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toUpperCase())},i6=function(e,t){return i3(e)===i3(t)};var i7=Object.freeze({__proto__:null,toLowerCase:i8,toTitleCase:i3,titleCaseEquals:i6});class i9{constructor(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=tE({},this.options_),t=this.options_=tE(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_${iD++}`}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&&(i2(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),i5(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()}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_=tE(this.options_,e)),this.options_}el(){return this.el_}createEl(e,t,i){return t4(e,t,i)}localize(e,t,i=e){let s=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),n=r&&r[s],a=s&&s.split("-")[0],o=r&&r[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 s=t[i-1],r=s;return void 0===s&&(r=e),r})),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_[i3(e.name())]=null,this.childNameIndex_[i8(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,i=this.options_,s=e=>{let t=e.name,s=e.opts;if(void 0!==i[t]&&(s=i[t]),!1===s)return;!0===s&&(s={}),s.playerOptions=this.options_.playerOptions;let r=this.addChild(t,s);r&&(this[t]=r)},r=i9.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,s;return"string"==typeof t?s=e[i=t]||this.options_[i]||{}:(i=t.name,s=t),{name:i,opts:s}}).filter(e=>{let t=i9.getComponent(e.opts.componentClass||i3(e.name));return t&&!r.isTech(t)}).forEach(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 i_(e,t||this.contentEl())}$$(e,t){return ib(e,t||this.contentEl())}hasClass(e){return t3(this.el_,e)}addClass(...e){t6(this.el_,...e)}removeClass(...e){t7(this.el_,...e)}toggleClass(e,t){t9(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 ii(this.el_,e)}setAttribute(e,t){is(this.el_,e,t)}removeAttribute(e){ir(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 s=this.el_.style[e],r=s.indexOf("px");return -1!==r?parseInt(s.slice(0,r),10):parseInt(this.el_["offset"+i3(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=iv(this.el_,e)))||isNaN(t)){let i=`offset${i3(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_&&("Tab"===e.key||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(s){1===s.touches.length&&(i={pageX:s.touches[0].pageX,pageY:s.touches[0].pageY},t=g.default.performance.now(),e=!0)}),this.on("touchmove",function(t){if(t.touches.length>1)e=!1;else if(i){let s=t.touches[0].pageX-i.pageX,r=t.touches[0].pageY-i.pageY;Math.sqrt(s*s+r*r)>10&&(e=!1)}});let s=function(){e=!1};this.on("touchleave",s),this.on("touchcancel",s),this.on("touchend",function(s){i=null,!0===e&&g.default.performance.now()-t<200&&(s.preventDefault(),this.trigger("tap"))})}enableTouchActivity(){let e;if(!this.player()||!this.player().reportUserActivity)return;let t=iF(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=iF(this,e),this.clearTimersOnDispose_(),i=g.default.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),g.default.clearTimeout(e)),e}setInterval(e,t){e=iF(this,e),this.clearTimersOnDispose_();let i=g.default.setInterval(e,t);return this.setIntervalIds_.add(i),i}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),g.default.clearInterval(e)),e}requestAnimationFrame(e){var t;return this.clearTimersOnDispose_(),e=iF(this,e),t=g.default.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){this.namedRafs_.has(e)&&this.cancelNamedAnimationFrame(e),this.clearTimersOnDispose_(),t=iF(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),g.default.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=g.default.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>(y.default.documentElement.clientWidth||g.default.innerWidth)||t.y<0||t.y>(y.default.documentElement.clientHeight||g.default.innerHeight))return!1;let i=y.default.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"!==g.default.getComputedStyle(t).height&&"0px"!==g.default.getComputedStyle(t).width&&1)&&(!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=i9.getComponent("Tech"),s=i&&i.isTech(t),r=i9===t||i9.prototype.isPrototypeOf(t.prototype);if(s||!r){let t;throw t=s?"techs must be registered using Tech.registerTech()":"must be a Component subclass",Error(`Illegal component, "${e}"; ${t}.`)}e=i3(e),i9.components_||(i9.components_={});let n=i9.getComponent("Player");if("Player"===e&&n&&n.players){let e=n.players,t=Object.keys(e);if(e&&t.length>0){for(let i=0;ir)throw Error(`Failed to execute '${e}' on 'TimeRanges': The index provided (${s}) is non-numeric or out of bounds (0-${r}).`);return i[s][t]}function st(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:se.bind(null,"start",0,e),end:se.bind(null,"end",1,e)},g.default.Symbol&&g.default.Symbol.iterator&&(t[g.default.Symbol.iterator]=()=>(e||[]).values()),t}function si(e,t){return Array.isArray(e)?st(e):void 0===e||void 0===t?st():st([[e,t]])}i9.registerComponent("Component",i9);let ss=function(e,t){let i=Math.floor((e=e<0?0:e)%60),s=Math.floor(e/60%60),r=Math.floor(e/3600),n=Math.floor(t/60%60),a=Math.floor(t/3600);return(isNaN(e)||1/0===e)&&(r=s=i="-"),s=(((r=r>0||a>0?r+":":"")||n>=10)&&s<10?"0"+s:s)+":",r+s+(i=i<10?"0"+i:i)},sr=ss;function sn(e){sr=e}function sa(){sr=ss}function so(e,t=e){return sr(e,t)}var sl=Object.freeze({__proto__:null,createTimeRanges:si,createTimeRange:si,setFormatTime:sn,resetFormatTime:sa,formatTime:so});function sh(e,t){let i,s,r=0;if(!t)return 0;e&&e.length||(e=si(0,0));for(let n=0;nt&&(s=t),r+=s-i;return r/t}function sd(e){if(e instanceof sd)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:tx(e)&&("number"==typeof e.code&&(this.code=e.code),Object.assign(this,e)),this.message||(this.message=sd.defaultMessages[this.code]||"")}function su(e){return null!=e&&"function"==typeof e.then}function sc(e){su(e)&&e.then(null,e=>{})}sd.prototype.code=0,sd.prototype.message="",sd.prototype.status=null,sd.prototype.metadata=null,sd.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],sd.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."},sd.MEDIA_ERR_CUSTOM=0,sd.prototype.MEDIA_ERR_CUSTOM=0,sd.MEDIA_ERR_ABORTED=1,sd.prototype.MEDIA_ERR_ABORTED=1,sd.MEDIA_ERR_NETWORK=2,sd.prototype.MEDIA_ERR_NETWORK=2,sd.MEDIA_ERR_DECODE=3,sd.prototype.MEDIA_ERR_DECODE=3,sd.MEDIA_ERR_SRC_NOT_SUPPORTED=4,sd.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4,sd.MEDIA_ERR_ENCRYPTED=5,sd.prototype.MEDIA_ERR_ENCRYPTED=5;let sp=function(e){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((t,i,s)=>(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 sf=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=sp(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(sp))};let sm="vjs-modal-dialog";class sg extends i9{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_=t4("div",{className:`${sm}-content`},{role:"document"}),this.descEl_=t4("p",{className:`${sm}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),t5(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`${sm} 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,s=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),ig(t,e),this.trigger("modalfill"),s?i.insertBefore(t,s):i.appendChild(t);let r=this.getChild("closeButton");r&&i.appendChild(r.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),ic(this.contentEl()),this.trigger("modalempty")}content(e){return void 0!==e&&(this.content_=e),this.content_}conditionalFocus_(){let e=y.default.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(),"Escape"===e.key&&this.closeable()){e.preventDefault(),this.close();return}if("Tab"!==e.key)return;let i=this.focusableEls_(),s=this.el_.querySelector(":focus");for(let e=0;e(e instanceof g.default.HTMLAnchorElement||e instanceof g.default.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof g.default.HTMLInputElement||e instanceof g.default.HTMLSelectElement||e instanceof g.default.HTMLTextAreaElement||e instanceof g.default.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof g.default.HTMLIFrameElement||e instanceof g.default.HTMLObjectElement||e instanceof g.default.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable"))}}sg.prototype.options_={pauseOnOpen:!0,temporary:!0},i9.registerComponent("ModalDialog",sg);class sy extends iW{constructor(e=[]){super(),this.tracks_=[];for(let t=0;t{this.trigger({track:e,type:"labelchange",target:this})},iX(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let i=0,s=this.length;i=0;t--)if(e[t].enabled){s_(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&s_(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,s_(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)}}let sv=function(e,t){for(let i=0;i=0;t--)if(e[t].selected){sv(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let e=0;e{this.changing_||(this.changing_=!0,sv(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)}}class sS extends sy{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.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_))}toJSON(){return this.tracks_.map(e=>e.toJSON())}}class sx{constructor(e){sx.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){let t=this.length||0,i=0,s=e.length;this.cues_=e,this.length_=e.length;let r=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"))}})}}let sA=function(e){return new URL(e,y.default.baseURI)},sD=function(e){return new URL(e,y.default.baseURI).href},sP=function(e){if("string"==typeof e){let t=e.split("?")[0].replace(/\/+$/,"").match(/\.([^.\/]+)$/);return t?t[1].toLowerCase():""}return""},sL=function(e,t=g.default.location){return sA(e).origin!==t.origin};var sO=Object.freeze({__proto__:null,parseUrl:sA,getAbsoluteURL:sD,getFileExtension:sP,isCrossOrigin:sL});let sN=function(e,t){let i=new g.default.WebVTT.Parser(g.default,g.default.vttjs,g.default.WebVTT.StringDecoder()),s=[];i.oncue=function(e){t.addCue(e)},i.onparsingerror=function(e){s.push(e)},i.onflush=function(){t.trigger({type:"loadeddata",target:t})},i.parse(e),s.length>0&&(g.default.console&&g.default.console.groupCollapsed&&g.default.console.groupCollapsed(`Text Track parsing errors for ${t.src}`),s.forEach(e=>ty.error(e)),g.default.console&&g.default.console.groupEnd&&g.default.console.groupEnd()),i.flush()},sR=function(e,t){let i={uri:e},s=sL(e);s&&(i.cors=s);let r="use-credentials"===t.tech_.crossOrigin();r&&(i.withCredentials=r),(0,_.default)(i,iF(this,function(e,i,s){if(e)return ty.error(e,i);t.loaded_=!0,"function"!=typeof g.default.WebVTT?t.tech_&&t.tech_.any(["vttjsloaded","vttjserror"],e=>"vttjserror"===e.type?void ty.error(`vttjs failed to load, stopping trying to process ${t.src}`):sN(s,t)):sN(s,t)}))};class sM extends sI{constructor(e={}){if(!e.tech)throw Error("A tech was not provided.");let t=tE(e,{kind:sk[e.kind]||"subtitles",language:e.language||e.srclang||""}),i=sC[t.mode]||"disabled",s=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 r=new sx(this.cues_),n=new sx(this.activeCues_),a=!1;this.timeupdateHandler=iF(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))}});let o=()=>{this.stopTracking()};this.tech_.one("dispose",o),"disabled"!==i&&this.startTracking(),Object.defineProperties(this,{default:{get:()=>s,set(){}},mode:{get:()=>i,set(e){sC[e]&&i!==e&&(i=e,this.preload_||"disabled"===i||0!==this.cues.length||sR(this.src,this),this.stopTracking(),"disabled"!==i&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?r: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,s=this.cues.length;i=e&&t.push(s)}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 sj extends sI{constructor(e={}){let t=tE(e,{kind:sw[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 sB extends iW{constructor(e={}){let t;super();let i=new sM(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=sB.NONE,i.addEventListener("loadeddata",()=>{t=sB.LOADED,this.trigger({type:"load",target:this})})}}sB.prototype.allowedEvents_={load:"load"},sB.NONE=0,sB.LOADING=1,sB.LOADED=2,sB.ERROR=3;let sq={audio:{ListClass:sb,TrackClass:sU,capitalName:"Audio"},video:{ListClass:sT,TrackClass:sj,capitalName:"Video"},text:{ListClass:sS,TrackClass:sM,capitalName:"Text"}};Object.keys(sq).forEach(function(e){sq[e].getterName=`${e}Tracks`,sq[e].privateName=`${e}Tracks_`});let s$={remoteText:{ListClass:sS,TrackClass:sM,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}),sF.names.forEach(t=>{let i=sF[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 sF.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(iF(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 si(0,0)}bufferedPercent(){return sh(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(sq.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 s=t[i];"text"===e&&this.removeRemoteTextTrack(s),t.removeTrack(s)}})}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 sd(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?si(0,0):si()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){sq.names.forEach(e=>{let t=sq[e],i=()=>{this.trigger(`${e}trackchange`)},s=this[t.getterName]();s.addEventListener("removetrack",i),s.addEventListener("addtrack",i),this.on("dispose",()=>{s.removeEventListener("removetrack",i),s.removeEventListener("addtrack",i)})})}addWebVttScript_(){if(!g.default.WebVTT)if(y.default.body.contains(this.el())){if(!this.options_["vtt.js"]&&tw(b.default)&&Object.keys(b.default).length>0)return void this.trigger("vttjsloaded");let e=y.default.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}),g.default.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),s=t=>e.removeTrack(t.track);t.on("addtrack",i),t.on("removetrack",s),this.addWebVttScript_();let r=()=>this.trigger("texttrackchange"),n=()=>{r();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=iD++;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 sV.canPlayType(e.type)}static isTech(e){return e.prototype instanceof sV||e instanceof sV||e===sV}static registerTech(e,t){if(sV.techs_||(sV.techs_={}),!sV.isTech(t))throw Error(`Tech ${e} must be a Tech`);if(!sV.canPlayType)throw Error("Techs must have a static canPlayType method on them");if(!sV.canPlaySource)throw Error("Techs must have a static canPlaySource method on them");return e=i3(e),sV.techs_[e]=t,sV.techs_[i8(e)]=t,"Tech"!==e&&sV.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(sV.techs_&&sV.techs_[e])return sV.techs_[e];if(e=i3(e),g.default&&g.default.videojs&&g.default.videojs[e])return ty.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),g.default.videojs[e]}}}sF.names.forEach(function(e){let t=sF[e];sV.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}}),sV.prototype.featuresVolumeControl=!0,sV.prototype.featuresMuteControl=!0,sV.prototype.featuresFullscreenResize=!1,sV.prototype.featuresPlaybackRate=!1,sV.prototype.featuresProgressEvents=!1,sV.prototype.featuresSourceset=!1,sV.prototype.featuresTimeupdateEvents=!1,sV.prototype.featuresNativeTextTracks=!1,sV.prototype.featuresVideoFrameCallback=!1,sV.withSourceHandlers=function(e){e.registerSourceHandler=function(t,i){let s=e.sourceHandlers;s||(s=e.sourceHandlers=[]),void 0===i&&(i=s.length),s.splice(i,0,t)},e.canPlayType=function(t){let i,s=e.sourceHandlers||[];for(let e=0;e=0;r--){let n=e[r];n[t]&&n[t](s,i)}}(e,i,o,a),o}let sX={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},sK={setCurrentTime:1,setMuted:1,setVolume:1},sY={play:1,pause:1};function sQ(e){return(t,i)=>t===sW?sW:i[e]?i[e](t):t}let sJ={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"},sZ=function(e=""){return sJ[sP(e).toLowerCase()]||""},s0=function(e){if(Array.isArray(e)){let t=[];e.forEach(function(e){Array.isArray(e=s0(e))?t=t.concat(e):tx(e)&&t.push(e)}),e=t}else e="string"==typeof e&&e.trim()?[s1({src:e})]:tx(e)&&"string"==typeof e.src&&e.src&&e.src.trim()?[s1(e)]:[];return e};function s1(e){if(!e.type){let t=sZ(e.src);t&&(e.type=t)}return e}let s2=tH?10009:tz?461:8,s4={codes:{play:415,pause:19,ff:417,rw:412,back:s2},names:{415:"play",19:"pause",417:"ff",412:"rw",[s2]:"back"},isEventKey(e,t){return t=t.toLowerCase(),!!this.names[e.keyCode]&&this.names[e.keyCode]===t},getEventName(e){if(this.names[e.keyCode])return this.names[e.keyCode];if(this.codes[e.code]){let t=this.codes[e.code];return this.names[t]}return null}};class s5 extends iW{constructor(e){super(),this.player_=e,this.focusableComponents=[],this.isListening_=!1,this.isPaused_=!1,this.onKeyDown_=this.onKeyDown_.bind(this),this.lastFocusedComponent_=null}start(){!this.isListening_&&(this.player_.on("keydown",this.onKeyDown_),this.player_.on("modalKeydown",this.onKeyDown_),this.player_.on("loadedmetadata",()=>{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,this.player_.errorDisplay&&this.player_.errorDisplay.on("aftermodalfill",()=>{this.updateFocusableComponents(),this.focusableComponents.length&&(this.focusableComponents.length>1?this.focusableComponents[1].focus():this.focusableComponents[0].focus())}))}stop(){this.player_.off("keydown",this.onKeyDown_),this.isListening_=!1}onKeyDown_(e){let t=e.originalEvent?e.originalEvent:e;if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(t.key)){if(this.isPaused_)return;t.preventDefault();let e=t.key.substring(5).toLowerCase();this.move(e)}else if(s4.isEventKey(t,"play")||s4.isEventKey(t,"pause")||s4.isEventKey(t,"ff")||s4.isEventKey(t,"rw")){t.preventDefault();let e=s4.getEventName(t);this.performMediaAction_(e)}else s4.isEventKey(t,"Back")&&e.target&&"function"==typeof e.target.closeable&&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,s=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)&&(s&&"CloseButton"===s.name()?this.refocusComponent():(this.pause(),s&&s.el()&&(this.lastFocusedComponent_=s)))}handlePlayerFocus_(){this.getCurrentComponent()&&this.getCurrentComponent().getIsFocusable()&&this.resume()}updateFocusableComponents(){let e=this.player_,t=[];function i(e){for(let s of e)s.hasOwnProperty("el_")&&s.getIsFocusable()&&s.getIsAvailableToBeFocused(s.el())&&t.push(s),s.hasOwnProperty("children_")&&s.children_.length>0&&i(s.children_)}return e.children_.forEach(e=>{if(e.hasOwnProperty("el_"))if(e.getIsFocusable&&e.getIsAvailableToBeFocused&&e.getIsFocusable()&&e.getIsAvailableToBeFocused(e.el()))return void t.push(e);else 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);if("ErrorDisplay"===e.name_&&e.opened_){let i=e.el_.querySelector(".vjs-errors-ok-button-container");i&&i.querySelectorAll("button").forEach((e,i)=>{t.push({name:()=>"ModalButton"+(i+1),el:()=>e,getPositions:()=>{let t=e.getBoundingClientRect();return{boundingClientRect:{x:t.x,y:t.y,width:t.width,height:t.height,top:t.top,right:t.right,bottom:t.bottom,left:t.left},center:{x:t.left+t.width/2,y:t.top+t.height/2,width:0,height:0,top:t.top+t.height/2,right:t.left+t.width/2,bottom:t.top+t.height/2,left:t.left+t.width/2}}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:e=>!0,focus:()=>e.focus()})})}}),this.focusableComponents=t,this.focusableComponents}findSuitableDOMChild(e){return e.el()?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(),s=this.focusableComponents.filter(s=>s!==t&&this.isInDirection_(i.boundingClientRect,s.getPositions().boundingClientRect,e)),r=this.findBestCandidate_(i.center,s,e);r?this.focus(r):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:t})}findBestCandidate_(e,t,i){let s=1/0,r=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&&ty.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 s=t4(e,t,i);return this.player_.options_.experimentalSvgIcons||s.appendChild(t4("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(s),s}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=t4("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,t5(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){" "===e.key||"Enter"===e.key?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}i9.registerComponent("ClickableComponent",s8);class s3 extends s8{constructor(e,t){super(e,t);let{mainContent:i}=t&&t.playerOptions||{};this.isMainContent=i,this.update(),this.update_=e=>this.update(e),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return t4("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;null!==e&&"anonymous"!==e&&"use-credentials"!==e?this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`):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(t4("picture",{className:"vjs-poster",tabIndex:-1},{},t4("img",{loading:this.isMainContent?"eager":"lazy",fetchPriority:this.isMainContent?"high":"auto",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e}handleClick(e){if(!this.player_.controls())return;let t=this.player_.getChild("controlBar"),i=t&&t.getChild("playToggle");tO?(i||this.player_).focus():this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?sc(this.player_.play()):this.player_.pause()}}s3.prototype.crossorigin=s3.prototype.crossOrigin,i9.registerComponent("PosterImage",s3);let s6="#222",s7="#ccc",s9={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 re(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 rt(e,t,i){try{e.style[t]=i}catch(e){return}}function ri(e){return e?`${e}px`:""}i9.registerComponent("TextTrackDisplay",class extends i9{constructor(e,t,i){super(e,t,i);let s=e=>this.updateDisplay(e),r=e=>{this.updateDisplayOverlay(),this.updateDisplay(e)};e.on("loadstart",e=>this.toggleDisplay(e)),e.on("useractive",s),e.on("userinactive",s),e.on("texttrackchange",s),e.on("loadedmetadata",e=>{this.updateDisplayOverlay(),this.preselectTrack(e)}),e.ready(iF(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks)return void this.hide();e.on("fullscreenchange",r),e.on("playerresize",r);let t=g.default.screen.orientation||g.default,i=g.default.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;e0&&t.forEach(e=>{if(e.style.inset){let t=e.style.inset.split(" ");3===t.length&&Object.assign(e.style,{top:t[0],right:t[1],bottom:t[2],left:"unset"})}})}}updateDisplayOverlay(){if(!this.player_.videoHeight()||!(void 0!==g.default.CSS&&g.default.CSS.supports("inset-inline: 10px")))return;let e=this.player_.currentWidth(),t=this.player_.currentHeight(),i=e/t,s=this.player_.videoWidth()/this.player_.videoHeight(),r=0,n=0;Math.abs(i-s)>.1&&(i>s?r=Math.round((e-t*s)/2):n=Math.round((t-e/s)/2)),rt(this.el_,"insetInline",ri(r)),rt(this.el_,"insetBlock",ri(n))}updateDisplayState(e){let t=this.player_.textTrackSettings.getValues(),i=e.activeCues,s=i.length;for(;s--;){let e=i[s];if(!e)continue;let r=e.displayState;if(t.color&&(r.firstChild.style.color=t.color),t.textOpacity&&rt(r.firstChild,"color",re(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(r.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&rt(r.firstChild,"backgroundColor",re(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?rt(r,"backgroundColor",re(t.windowColor,t.windowOpacity)):r.style.backgroundColor=t.windowColor),t.edgeStyle&&("dropshadow"===t.edgeStyle?r.firstChild.style.textShadow=`2px 2px 3px ${s6}, 2px 2px 4px ${s6}, 2px 2px 5px ${s6}`:"raised"===t.edgeStyle?r.firstChild.style.textShadow=`1px 1px ${s6}, 2px 2px ${s6}, 3px 3px ${s6}`:"depressed"===t.edgeStyle?r.firstChild.style.textShadow=`1px 1px ${s7}, 0 1px ${s7}, -1px -1px ${s6}, 0 -1px ${s6}`:"uniform"===t.edgeStyle&&(r.firstChild.style.textShadow=`0 0 4px ${s6}, 0 0 4px ${s6}, 0 0 4px ${s6}, 0 0 4px ${s6}`)),t.fontPercent&&1!==t.fontPercent){let e=g.default.parseFloat(r.style.fontSize);r.style.fontSize=e*t.fontPercent+"px",r.style.height="auto",r.style.top="auto"}t.fontFamily&&"default"!==t.fontFamily&&("small-caps"===t.fontFamily?r.firstChild.style.fontVariant="small-caps":r.firstChild.style.fontFamily=s9[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),"function"!=typeof g.default.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(),i=this.player_.getChild("controlBar"),s=i&&i.getChild("playToggle");if("tap"===e.type||this.mouseused_&&"clientX"in e&&"clientY"in e){sc(t),tO?(s||this.player_).focus():this.player_.tech(!0)&&this.player_.tech(!0).focus();return}if(!s)return void this.player_.tech(!0).focus();let r=()=>s.focus();su(t)?t.then(r,()=>{}):this.setTimeout(r,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}rr.prototype.controlText_="Play Video",i9.registerComponent("BigPlayButton",rr),i9.registerComponent("CloseButton",class extends rs{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){"Escape"===e.key?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}});class rn extends rs{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()?sc(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))}}rn.prototype.controlText_="Play",i9.registerComponent("PlayToggle",rn);class ra extends i9{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=t4("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)}\xa0`},{role:"presentation"});return t.appendChild(i),this.contentEl_=t4("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=so(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,ty.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_=y.default.createTextNode(this.formattedTime_),this.textNode_&&(e?this.contentEl_.replaceChild(this.textNode_,e):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}ra.prototype.labelText_="Time",ra.prototype.controlText_="Time",i9.registerComponent("TimeDisplay",ra);class ro extends ra{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;t=this.player_.ended()?this.player_.duration():e&&e.target&&"function"==typeof e.target.pendingSeekTime&&null!==e.target.pendingSeekTime()?e.target.pendingSeekTime():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}ro.prototype.labelText_="Current Time",ro.prototype.controlText_="Current Time",i9.registerComponent("CurrentTimeDisplay",ro);class rl extends ra{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)}}rl.prototype.labelText_="Duration",rl.prototype.controlText_="Duration",i9.registerComponent("DurationDisplay",rl),i9.registerComponent("TimeDivider",class extends i9{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 rh extends ra{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(t4("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))}}rh.prototype.labelText_="Remaining Time",rh.prototype.controlText_="Remaining Time",i9.registerComponent("RemainingTimeDisplay",rh),i9.registerComponent("LiveDisplay",class extends i9{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_=t4("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(t4("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")}\xa0`})),this.contentEl_.appendChild(y.default.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){1/0===this.player().duration()?this.show():this.hide()}});class rd extends rs{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_=t4("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 ru(e,t,i){return Math.min(i,Math.max(t,isNaN(e=Number(e))?t:e))}rd.prototype.controlText_="Seek to live, currently playing live",i9.registerComponent("SeekToLive",rd);var rc=Object.freeze({__proto__:null,clamp:ru});class rp extends i9{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||tR||e.preventDefault(),ia(),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;io(),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(ru(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){let t=id(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){let t=this.options_.playerOptions.spatialNavigation,i=t&&t.enabled,s=t&&t.horizontalSeek;i?s&&"ArrowLeft"===e.key||!s&&"ArrowDown"===e.key?(e.preventDefault(),e.stopPropagation(),this.stepBack()):s&&"ArrowRight"===e.key||!s&&"ArrowUp"===e.key?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(this.pendingSeekTime()&&(this.pendingSeekTime(null),this.userSeek_(this.player_.currentTime())),super.handleKeyDown(e)):"ArrowLeft"===e.key||"ArrowDown"===e.key?(e.preventDefault(),e.stopPropagation(),this.stepBack()):"ArrowUp"===e.key||"ArrowRight"===e.key?(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")}}i9.registerComponent("Slider",rp);let rf=(e,t)=>ru(e/t*100,0,100).toFixed(2)+"%";i9.registerComponent("LoadProgressBar",class extends i9{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=t4("span",{className:"vjs-control-text"}),i=t4("span",{textContent:this.localize("Loaded")}),s=y.default.createTextNode(": ");return this.percentageEl_=t4("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),t.appendChild(s),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(),s=this.player_.bufferedEnd(),r=this.partEls_,n=rf(s,i);this.percent_!==n&&(this.el_.style.width=n,t5(this.percentageEl_,n),this.percent_=n);for(let e=0;et.length;e--)this.el_.removeChild(r[e-1]);r.length=t.length})}}),i9.registerComponent("TimeTooltip",class extends i9{constructor(e,t){super(e,t),this.update=iV(iF(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,i){let s=ih(this.el_),r=il(this.player_.el()),n=e.width*t;if(!r||!s)return;let a=e.left-r.left+n,o=e.width-n+(r.right-e.right);o||(o=e.width-n,a=n);let l=s.width/2;as.width&&(l=s.width),l=Math.round(l),this.el_.style.right=`-${l}px`,this.write(i)}write(e){t5(this.el_,e)}updateTime(e,t,i,s){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let r,n=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){let e=this.player_.liveTracker.liveWindow(),i=e-t*e;r=(i<1?"":"-")+so(i,e)}else r=so(i,n);this.update(e,t,r),s&&s()})}});class rm extends i9{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=iV(iF(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t,i){let s=this.getChild("timeTooltip");if(!s)return;let r=i&&i.target&&"function"==typeof i.target.pendingSeekTime?i.target.pendingSeekTime():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();s.updateTime(e,t,r)}}rm.prototype.options_={children:[]},tK||tP||rm.prototype.options_.children.push("timeTooltip"),i9.registerComponent("PlayProgressBar",rm);class rg extends i9{constructor(e,t){super(e,t),this.update=iV(iF(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`})}}rg.prototype.options_={children:["timeTooltip"]},i9.registerComponent("MouseTimeDisplay",rg);class ry extends rp{constructor(e,t){(t=tE(ry.prototype.options_,t)).children=[...t.children];let i=e.options_.disableSeekWhileScrubbingOnMobile&&(tK||tP)||e.options_.disableSeekWhileScrubbingOnSTV;(tK||tP)&&!i||t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbing_=i,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=iF(this,this.update),this.update=iV(this.update_,30),this.on(this.player_,["durationchange","timeupdate"],this.update),this.on(this.player_,["ended"],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 y.default&&"visibilityState"in y.default&&this.on(y.default,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){"hidden"===y.default.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"===y.default.visibilityState)return;let t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{let i=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),s=this.player_.liveTracker,r=this.player_.duration();s&&s.isLive()&&(r=this.player_.liveTracker.liveCurrentTime()),this.percent_!==t&&(this.el_.setAttribute("aria-valuenow",(100*t).toFixed(2)),this.percent_=t),(this.currentTime_!==i||this.duration_!==r)&&(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[so(i,r),so(r,r)],"{1} of {2}")),this.currentTime_=i,this.duration_=r),this.bar&&this.bar.update(il(this.el()),this.getProgress(),e)}),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()}pendingSeekTime(e){if(void 0!==e)if(null!==e){let t=this.player_.duration();this.pendingSeekTime_=Math.max(0,Math.min(e,t))}else this.pendingSeekTime_=null;return this.pendingSeekTime_}getPercent(){let e;if(null!==this.pendingSeekTime())return this.pendingSeekTime()/this.player_.duration();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){iy(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbing_||this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){let i;if(!iy(e)||isNaN(this.player_.duration()))return;t||this.player_.scrubbing()||this.player_.scrubbing(!0);let s=this.calculateDistance(e),r=this.player_.liveTracker;if(r&&r.isLive()){if(s>=.99)return void r.seekToLiveEdge();let e=r.seekableStart(),t=r.liveCurrentTime();if((i=e+s*r.liveWindow())>=t&&(i=t),i<=e&&(i=e+.1),1/0===i)return}else(i=s*this.player_.duration())===this.player_.duration()&&(i-=.1);this.shouldDisableSeekWhileScrubbing_?this.pendingSeekTime(i):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),null!==this.pendingSeekTime()&&(this.userSeek_(this.pendingSeekTime()),this.pendingSeekTime(null)),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?sc(this.player_.play()):this.update_()}handlePendingSeek_(e){this.player_.paused()||this.player_.pause();let t=null!==this.pendingSeekTime()?this.pendingSeekTime():this.player_.currentTime();this.pendingSeekTime(t+e),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}stepForward(){this.shouldDisableSeekWhileScrubbing_?this.handlePendingSeek_(this.options().stepSeconds):this.userSeek_(this.player_.currentTime()+this.options().stepSeconds)}stepBack(){this.shouldDisableSeekWhileScrubbing_?this.handlePendingSeek_(-this.options().stepSeconds):this.userSeek_(this.player_.currentTime()-this.options().stepSeconds)}handleAction(e){null!==this.pendingSeekTime()&&(this.userSeek_(this.pendingSeekTime()),this.pendingSeekTime(null)),this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){let t=this.player_.liveTracker;if(" "===e.key||"Enter"===e.key)e.preventDefault(),e.stopPropagation(),this.handleAction(e);else if("Home"===e.key)e.preventDefault(),e.stopPropagation(),this.userSeek_(0);else if("End"===e.key)e.preventDefault(),e.stopPropagation(),t&&t.isLive()?this.userSeek_(t.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(e.key)){e.preventDefault(),e.stopPropagation();let i=.1*parseInt(e.key,10);t&&t.isLive()?this.userSeek_(t.seekableStart()+t.liveWindow()*i):this.userSeek_(this.player_.duration()*i)}else"PageDown"===e.key?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-this.options().stepSeconds*this.options().pageMultiplier)):"PageUp"===e.key?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+this.options().stepSeconds*this.options().pageMultiplier)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["durationchange","timeupdate"],this.update),this.off(this.player_,["ended"],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 y.default&&"visibilityState"in y.default&&this.off(y.default,"visibilitychange",this.toggleVisibility_),super.dispose()}}ry.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar",stepSeconds:5,pageMultiplier:12},i9.registerComponent("SeekBar",ry);class r_ extends i9{constructor(e,t){super(e,t),this.handleMouseMove=iV(iF(this,this.handleMouseMove),30),this.throttledHandleMouseSeek=iV(iF(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"),s=t.getChild("mouseTimeDisplay");if(!i&&!s)return;let r=t.el(),n=ih(r),a=id(r,e).x;a=ru(a,0,1),s&&s.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","touchmove"],this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){let e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&sc(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","touchmove"],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()}}r_.prototype.options_={children:["seekBar"]},i9.registerComponent("ProgressControl",r_);class rb extends rs{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(){"audio"===this.player_.currentType().substring(0,5)||this.player_.audioPosterMode()||this.player_.audioOnlyMode()?(this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()):this.show()}handlePictureInPictureEnabledChange(){y.default.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in g.default?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 y.default.exitPictureInPicture&&super.show()}}rb.prototype.controlText_="Picture-in-Picture",i9.registerComponent("PictureInPictureToggle",rb);class rv extends rs{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",e=>this.handleFullscreenChange(e)),!1===y.default[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()}}rv.prototype.controlText_="Fullscreen",i9.registerComponent("FullscreenToggle",rv);let rT=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")})};i9.registerComponent("VolumeLevel",class extends i9{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}}),i9.registerComponent("VolumeLevelTooltip",class extends i9{constructor(e,t){super(e,t),this.update=iV(iF(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,i,s){if(!i){let i=il(this.el_),s=il(this.player_.el()),r=e.width*t;if(!s||!i)return;let n=e.left-s.left+r,a=e.width-r+(s.right-e.right),o=i.width/2;ni.width&&(o=i.width),this.el_.style.right=`-${o}px`}this.write(`${s}%`)}write(e){t5(this.el_,e)}updateVolume(e,t,i,s,r){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,i,s.toFixed(0)),r&&r()})}});class rS extends i9{constructor(e,t){super(e,t),this.update=iV(iF(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`})}}rS.prototype.options_={children:["volumeLevelTooltip"]},i9.registerComponent("MouseVolumeLevelDisplay",rS);class rx extends rp{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){iy(e)&&super.handleMouseDown(e)}handleMouseMove(e){let t=this.getChild("mouseVolumeLevelDisplay");if(t){let i=this.el(),s=il(i),r=this.vertical(),n=id(i,e);n=ru(n=r?n.y:n.x,0,1),t.update(s,n,r)}iy(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)})}}rx.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},tK||tP||rx.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),rx.prototype.playerEvent="volumechange",i9.registerComponent("VolumeBar",rx);class rw extends i9{constructor(e,t={}){t.vertical=t.vertical||!1,(void 0===t.volumeBar||tw(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),rT(this,e),this.throttledHandleMouseMove=iV(iF(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)}}rw.prototype.options_={children:["volumeBar"]},i9.registerComponent("VolumeControl",rw);let rE=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 rk extends rs{constructor(e,t){super(e,t),rE(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"),tK&&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),t7(this.el_,[0,1,2,3].reduce((e,t)=>e+`${t?" ":""}vjs-vol-${t}`,"")),t6(this.el_,`vjs-vol-${t}`)}updateControlText_(){let e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}rk.prototype.controlText_="Mute",i9.registerComponent("MuteToggle",rk);class rC extends i9{constructor(e,t={}){void 0!==t.inline?t.inline=t.inline:t.inline=!0,(void 0===t.volumeControl||tw(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){"Escape"===e.key&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),iM(y.default,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),iU(y.default,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){"Escape"===e.key&&this.handleMouseOut()}}rC.prototype.options_={children:["muteToggle","volumeControl"]},i9.registerComponent("VolumePanel",rC);class rI extends rs{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(),s=this.player_.liveTracker,r=s&&s.isLive()?s.seekableEnd():this.player_.duration();t=i+this.skipTime<=r?i+this.skipTime:r,this.player_.currentTime(t)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}rI.prototype.controlText_="Skip Forward",i9.registerComponent("SkipForward",rI);class rA extends rs{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,i=this.player_.currentTime(),s=this.player_.liveTracker,r=s&&s.isLive()&&s.seekableStart();t=r&&i-this.skipTime<=r?r:i>=this.skipTime?i-this.skipTime:0,this.player_.currentTime(t)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}rA.prototype.controlText_="Skip Backward",i9.registerComponent("SkipBackward",rA);class rD extends i9{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 i9&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof i9&&(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_=t4(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_),iM(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||y.default.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){"ArrowLeft"===e.key||"ArrowDown"===e.key?(e.preventDefault(),e.stopPropagation(),this.stepForward()):("ArrowRight"===e.key||"ArrowUp"===e.key)&&(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())}}i9.registerComponent("Menu",rD);class rP extends i9{constructor(e,t={}){super(e,t),this.menuButton_=new rs(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");let i=rs.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+i,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;let s=e=>this.handleClick(e);this.handleMenuKeyUp_=e=>this.handleMenuKeyUp(e),this.on(this.menuButton_,"tap",s),this.on(this.menuButton_,"click",s),this.on(this.menuButton_,"keydown",e=>this.handleKeyDown(e)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),iM(y.default,"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 rD(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){let t=t4("li",{className:"vjs-menu-title",textContent:i3(this.options_.title),tabIndex:-1}),i=new i9(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(let t=0;t{this.handleTracksChange.apply(this,e)},n=(...e)=>{this.handleSelectedLanguageChange.apply(this,e)};if(e.on(["loadstart","texttrackchange"],r),s.addEventListener("change",r),s.addEventListener("selectedlanguagechange",n),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],r),s.removeEventListener("change",r),s.removeEventListener("selectedlanguagechange",n)}),void 0===s.onchange){let e;this.on(["tap","click"],function(){if("object"!=typeof g.default.Event)try{e=new g.default.Event("change")}catch(e){}e||(e=y.default.createEvent("Event")).initEvent("change",!0,!0),s.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"===s.mode){i=!1;break}}i!==this.isSelected_&&this.selected(i)}handleSelectedLanguageChange(e){let t=this.player().textTracks(),i=!0;for(let e=0,s=t.length;e-1&&"showing"===s.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()}}i9.registerComponent("OffTextTrackMenuItem",rR);class rM extends rL{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=rN){let i;this.label_&&(i=`${this.label_} off`),e.push(new rR(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;let s=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let i=0;i-1){let i=new t(this.player_,{track:r,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});i.addClass(`vjs-${r.kind}-menu-item`),e.push(i)}}return e}}i9.registerComponent("TextTrackButton",rM);class rU extends rO{constructor(e,t){let i=t.track,s=t.cue,r=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=s.text,t.selected=s.startTime<=r&&r{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(i3(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,s=t.length;i-1&&(this.label_="captions",this.setIcon("captions")),this.menuButton_.controlText(i3(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 r$(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,rV)}}rH.prototype.kinds_=["captions","subtitles"],rH.prototype.controlText_="Subtitles",i9.registerComponent("SubsCapsButton",rH);class rz extends rO{constructor(e,t){let i=t.track,s=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 r=(...e)=>{this.handleTracksChange.apply(this,e)};s.addEventListener("change",r),this.on("dispose",()=>{s.removeEventListener("change",r)})}createEl(e,t,i){let s=super.createEl(e,t,i),r=s.querySelector(".vjs-menu-item-text");return["main-desc","descriptions","description"].indexOf(this.options_.track.kind)>=0&&(r.appendChild(t4("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),r.appendChild(t4("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),s}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)}}rG.prototype.contentElType="button",i9.registerComponent("PlaybackRateMenuItem",rG);class rX extends rP{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_=t4("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 rG(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")}}rX.prototype.controlText_="Playback Rate",i9.registerComponent("PlaybackRateMenuButton",rX);class rK extends i9{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},i={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,i)}}i9.registerComponent("Spacer",rK),i9.registerComponent("CustomControlSpacer",class extends rK{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}});class rY extends i9{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}rY.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]},i9.registerComponent("ControlBar",rY);class rQ extends sg{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):""}}rQ.prototype.options_=Object.assign({},sg.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),i9.registerComponent("ErrorDisplay",rQ);class rJ extends i9{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(),t4("select",{id:this.options_.id},{},this.options_.SelectOptions.map(e=>{let t=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${iD++}`)+"-"+e[1].replace(/\W+/g,""),i=t4("option",{id:t,value:this.localize(e[0]),textContent:this.localize(e[1])});return i.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${t}`),i}))}}i9.registerComponent("TextTrackSelect",rJ);class rZ extends i9{constructor(e,t={}){super(e,t);let i=t4("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],s=i.className,r=i.id.replace("%s",this.options_.id_),n=null,a=`vjs_select_${iD++}`;if("colors"===this.options_.type){n=t4("span",{className:s});let e=t4("label",{id:r,className:"vjs-label",textContent:this.localize(i.label)});e.setAttribute("for",a),n.appendChild(e)}let o=new rJ(e,{SelectOptions:i.options,legendId:this.options_.legendId,id:a,labelId:r});this.addChild(o),"colors"===this.options_.type&&(n.appendChild(o.el()),this.el().appendChild(n))}}createEl(){return t4("fieldset",{className:this.options_.className})}}i9.registerComponent("TextTrackFieldset",rZ);class r0 extends i9{constructor(e,t={}){super(e,t);let i=this.options_.textTrackComponentid,s=new rZ(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(s);let r=new rZ(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(r);let n=new rZ(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 t4("div",{className:"vjs-track-settings-colors"})}}i9.registerComponent("TextTrackSettingsColors",r0);class r1 extends i9{constructor(e,t={}){super(e,t);let i=this.options_.textTrackComponentid,s=new rZ(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(s);let r=new rZ(e,{id_:i,legendId:`captions-edge-style-${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(r);let n=new rZ(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 t4("div",{className:"vjs-track-settings-font"})}}i9.registerComponent("TextTrackSettingsFont",r1);class r2 extends i9{constructor(e,t={}){super(e,t);let i=new rs(e,{controlText:this.localize("restore all settings to the default values"),className:"vjs-default-button"});i.el().classList.remove("vjs-control","vjs-button"),i.el().textContent=this.localize("Reset"),this.addChild(i);let s=this.localize("Done"),r=new rs(e,{controlText:s,className:"vjs-done-button"});r.el().classList.remove("vjs-control","vjs-button"),r.el().textContent=s,this.addChild(r)}createEl(){return t4("div",{className:"vjs-track-settings-controls"})}}i9.registerComponent("TrackSettingsControls",r2);let r4="vjs-text-track-settings",r5=["#000","Black"],r8=["#00F","Blue"],r3=["#0FF","Cyan"],r6=["#0F0","Green"],r7=["#F0F","Magenta"],r9=["#F00","Red"],ne=["#FFF","White"],nt=["#FF0","Yellow"],ni=["1","Opaque"],ns=["0.5","Semi-Transparent"],nr=["0","Transparent"],nn={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[r5,ne,r9,r6,r8,nt,r7,r3],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[ni,ns,nr],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[ne,r5,r9,r6,r8,nt,r7,r3],className:"vjs-text-color"},edgeStyle:{selector:".vjs-edge-style > select",id:"",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"",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:"",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:[ni,ns],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:[nr,ns,ni],className:"vjs-window-opacity vjs-opacity"}};function na(e,t){if(t&&(e=t(e)),e&&"none"!==e)return e}nn.windowColor.options=nn.backgroundColor.options,i9.registerComponent("TextTrackSettings",class extends sg{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=t4("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 r0(e,{textTrackComponentid:this.id_,selectConfigs:nn,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);let i=new r1(e,{textTrackComponentid:this.id_,selectConfigs:nn,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(i);let s=new r2(e);this.addChild(s)}bindFunctionsToSelectsAndButtons(){this.on(this.$(".vjs-done-button"),["click","tap"],()=>{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),["click","tap"],()=>{this.setDefaults(),this.updateDisplay()}),tT(nn,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 tS(nn,(e,t,i)=>{var s,r;let n=(s=this.$(t.selector),r=t.parser,na(s.options[s.options.selectedIndex].value,r));return void 0!==n&&(e[i]=n),e},{})}setValues(e){tT(nn,(t,i)=>{!function(e,t,i){if(t){for(let s=0;s{let t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(g.default.localStorage.getItem(r4))}catch(e){ty.warn(e)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;let e=this.getValues();try{Object.keys(e).length?g.default.localStorage.setItem(r4,JSON.stringify(e)):g.default.localStorage.removeItem(r4)}catch(e){ty.warn(e)}}updateDisplay(){let e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}),i9.registerComponent("ResizeManager",class extends i9{constructor(e,t){let i=t.ResizeObserver||g.default.ResizeObserver;null===t.ResizeObserver&&(i=!1),super(e,tE({createEl:!i,reportTouchActivity:!1},t)),this.ResizeObserver=t.ResizeObserver||g.default.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=iH(()=>{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(){iU(this,"resize",e),iU(this,"unload",t),t=null};iM(this.el_.contentWindow,"unload",t),iM(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()}});let no={trackingThreshold:20,liveTolerance:15};i9.registerComponent("LiveTracker",class extends i9{constructor(e,t){super(e,tE(no,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(g.default.performance.now().toFixed(4)),i=-1===this.lastTime_?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i;let s=this.liveCurrentTime(),r=this.player_.currentTime(),n=this.player_.paused()||this.seekedBehindLive_||Math.abs(s-r)>this.options_.liveTolerance;this.timeupdateSeen_&&1/0!==s||(n=!1),n!==this.behindLiveEdge_&&(this.behindLiveEdge_=n,this.trigger("liveedgechange"))}handleDurationchange(){this.toggleTracking()}toggleTracking(){1/0===this.player_.duration()&&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 1/0===e?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()}}),i9.registerComponent("TitleBar",class extends i9{constructor(e,t){super(e,t),this.on("statechanged",e=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:t4("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${iD++}`}),description:t4("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${iD++}`})},t4("div",{className:"vjs-title-bar"},{},tk(this.els))}updateDom_(){let e=this.player_.tech_,t=e&&e.el_,i={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(e=>{let s=this.state[e],r=this.els[e],n=i[e];ic(r),s&&t5(r,s),t&&(t.removeAttribute(n),s&&t.setAttribute(n,r.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}});let nl={initialDisplay:4e3,position:[],takeFocus:!1};i9.registerComponent("TransientButton",class extends rs{constructor(e,t){super(e,t=tE(nl,t)),this.controlText(t.controlText),this.hide(),this.on(this.player_,["useractive","userinactive"],e=>{this.removeClass("force-display")})}buildCSSClass(){return`vjs-transient-button focus-visible ${this.options_.position.map(e=>`vjs-${e}`).join(" ")}`}createEl(){let e=t4("button",{},{type:"button",class:this.buildCSSClass()},t4("span"));return this.controlTextEl_=e.querySelector("span"),e}show(){super.show(),this.addClass("force-display"),this.options_.takeFocus&&this.el().focus({preventScroll:!0}),this.forceDisplayTimeout=this.player_.setTimeout(()=>{this.removeClass("force-display")},this.options_.initialDisplay)}hide(){this.removeClass("force-display"),super.hide()}dispose(){this.player_.clearTimeout(this.forceDisplayTimeout),super.dispose()}});let nh=e=>{let t=e.el();if(t.hasAttribute("src"))return e.triggerSourceset(t.src),!0;let i=e.$$("source"),s=[],r="";if(!i.length)return!1;for(let e=0;e{let i={};for(let s=0;s(...s)=>{let r=i.apply(t,s);return nh(e),r};["append","appendChild","insertAdjacentHTML"].forEach(e=>{t[e]&&(i[e]=t[e],t[e]=r(i[e]))}),Object.defineProperty(t,"innerHTML",tE(s,{set:r(s.set)})),t.resetSourceWatch_=()=>{t.resetSourceWatch_=null,Object.keys(i).forEach(e=>{t[e]=i[e]}),Object.defineProperty(t,"innerHTML",s)},e.one("sourceset",t.resetSourceWatch_)},np=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?sD(g.default.Element.prototype.getAttribute.call(this,"src")):""},set(e){return g.default.Element.prototype.setAttribute.call(this,"src",e),e}}),nf=function(e){if(!e.featuresSourceset)return;let t=e.el();if(t.resetSourceset_)return;let i=nu([e.el(),g.default.HTMLMediaElement.prototype,np],"src"),s=t.setAttribute,r=t.load;Object.defineProperty(t,"src",tE(i,{set:s=>{let r=i.set.call(t,s);return e.triggerSourceset(t.src),r}})),t.setAttribute=(i,r)=>{let n=s.call(t,i,r);return/src/i.test(i)&&e.triggerSourceset(t.src),n},t.load=()=>{let i=r.call(t);return nh(e)||(e.triggerSourceset(""),nc(e)),i},t.currentSrc?e.triggerSourceset(t.currentSrc):nh(e)||nc(e),t.resetSourceset_=()=>{t.resetSourceset_=null,t.load=r,t.setAttribute=s,Object.defineProperty(t,"src",i),t.resetSourceWatch_&&t.resetSourceWatch_()}};class nm extends sV{constructor(e,t){super(e,t);let i=e.source,s=!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 r=e[t];"track"===r.nodeName.toLowerCase()&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(r),this.remoteTextTracks().addTrack(r.track),this.textTracks().addTrack(r.track),!s&&!this.el_.hasAttribute("crossorigin")&&sL(r.src)&&(s=!0)):i.push(r))}for(let e=0;e{e=[];for(let i=0;it.removeEventListener("change",i));let s=()=>{for(let t=0;t{t.removeEventListener("change",i),t.removeEventListener("change",s),t.addEventListener("change",s)}),this.on("webkitendfullscreen",()=>{t.removeEventListener("change",i),t.addEventListener("change",i),t.removeEventListener("change",s)})}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=sq[e],i=this.el()[t.getterName],s=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!i||!i.addEventListener)return;let r={change:t=>{let i={type:"change",target:s,currentTarget:s,srcElement:s};s.trigger(i),"text"===e&&this[s$.remoteText.getterName]().trigger(i)},addtrack(e){s.addTrack(e.track)},removetrack(e){s.removeTrack(e.track)}},n=function(){let e=[];for(let t=0;t{let t=r[e];i.addEventListener(e,t),this.on("dispose",s=>i.removeEventListener(e,t))}),this.on("loadstart",n),this.on("dispose",e=>this.off("loadstart",n))}proxyNativeTracks_(){sq.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),nm.disposeMediaElement(e),e=t}else{e=y.default.createElement("video");let t=tE({},this.options_.tag&&it(this.options_.tag));tG&&!0===this.options_.nativeControlsForTouch||delete t.controls,ie(e,Object.assign(t,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}void 0!==this.options_.preload&&is(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&&tY?this.el_.fastSeek(e):this.el_.currentTime=e}catch(e){ty(e,"Video is not ready. (Video.js)")}}duration(){if(1/0===this.el_.duration&&tP&&tR&&0===this.el_.currentTime){let e=()=>{this.el_.currentTime>0&&(1/0===this.el_.duration&&this.trigger("durationchange"),this.off("timeupdate",e))};return this.on("timeupdate",e),0/0}return this.el_.duration||0/0}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)sc(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(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",Error("The video is not fullscreen"))}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)}addSourceElement(e,t){if(!e)return ty.error("Invalid source URL."),!1;let i={src:e};t&&(i.type=t);let s=t4("source",{},i);return this.el_.appendChild(s),!0}removeSourceElement(e){if(!e)return ty.error("Source URL is required to remove the source element."),!1;for(let t of this.el_.querySelectorAll("source"))if(t.src===e)return this.el_.removeChild(t),!0;return ty.warn(`No matching source element found with src: ${e}`),!1}reset(){nm.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=y.default.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),g.default.performance&&(e.creationTime=g.default.performance.now()),e}}tC(nm,"TEST_VID",function(){if(!tZ())return;let e=y.default.createElement("video"),t=y.default.createElement("track");return t.kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}),nm.isSupported=function(){try{nm.TEST_VID.volume=.5}catch(e){return!1}return!!(nm.TEST_VID&&nm.TEST_VID.canPlayType)},nm.canPlayType=function(e){return nm.TEST_VID.canPlayType(e)},nm.canPlaySource=function(e,t){return nm.canPlayType(e.type)},nm.canControlVolume=function(){try{let e=nm.TEST_VID.volume;nm.TEST_VID.volume=e/2+.1;let t=e!==nm.TEST_VID.volume;if(t&&tK)return g.default.setTimeout(()=>{nm&&nm.prototype&&(nm.prototype.featuresVolumeControl=e!==nm.TEST_VID.volume)}),!1;return t}catch(e){return!1}},nm.canMuteVolume=function(){try{let e=nm.TEST_VID.muted;return nm.TEST_VID.muted=!e,nm.TEST_VID.muted?is(nm.TEST_VID,"muted","muted"):ir(nm.TEST_VID,"muted"),e!==nm.TEST_VID.muted}catch(e){return!1}},nm.canControlPlaybackRate=function(){if(tP&&tR&&tU<58)return!1;try{let e=nm.TEST_VID.playbackRate;return nm.TEST_VID.playbackRate=e/2+.1,e!==nm.TEST_VID.playbackRate}catch(e){return!1}},nm.canOverrideAttributes=function(){try{let e=()=>{};Object.defineProperty(y.default.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(y.default.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(y.default.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(y.default.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},nm.supportsNativeTextTracks=function(){return tY||tK&&tR},nm.supportsNativeVideoTracks=function(){return!!(nm.TEST_VID&&nm.TEST_VID.videoTracks)},nm.supportsNativeAudioTracks=function(){return!!(nm.TEST_VID&&nm.TEST_VID.audioTracks)},nm.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]){tC(nm.prototype,e,()=>nm[t](),!0)}),nm.prototype.featuresVolumeControl=nm.canControlVolume(),nm.prototype.movingMediaElementInDOM=!tK,nm.prototype.featuresFullscreenResize=!0,nm.prototype.featuresProgressEvents=!0,nm.prototype.featuresTimeupdateEvents=!0,nm.prototype.featuresVideoFrameCallback=!!(nm.TEST_VID&&nm.TEST_VID.requestVideoFrameCallback),nm.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){}}()}},nm.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){nm.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}}),["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(e){nm.prototype["set"+i3(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){nm.prototype[e]=function(){return this.el_[e]}}),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(e){nm.prototype["set"+i3(e)]=function(t){this.el_[e]=t}}),["pause","load","play"].forEach(function(e){nm.prototype[e]=function(){return this.el_[e]()}}),sV.withSourceHandlers(nm),nm.nativeSourceHandler={},nm.nativeSourceHandler.canPlayType=function(e){try{return nm.TEST_VID.canPlayType(e)}catch(e){return""}},nm.nativeSourceHandler.canHandleSource=function(e,t){if(e.type)return nm.nativeSourceHandler.canPlayType(e.type);if(e.src){let t=sP(e.src);return nm.nativeSourceHandler.canPlayType(`video/${t}`)}return""},nm.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},nm.nativeSourceHandler.dispose=function(){},nm.registerSourceHandler(nm.nativeSourceHandler),sV.registerTech("Html5",nm);let ng=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],ny={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},n_=["tiny","xsmall","small","medium","large","xlarge","huge"],nb={};n_.forEach(e=>{let t="x"===e.charAt(0)?`x-${e.substring(1)}`:e;nb[e]=`vjs-layout-${t}`});let nv={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class nT extends i9{constructor(e,t,i){if(e.id=e.id||t.id||`vjs_video_${iD++}`,(t=Object.assign(nT.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.boundUpdatePlayerHeightOnAudioOnlyMode_=e=>this.updatePlayerHeightOnAudioOnlyMode_(e),this.isFullscreen_=!1,this.log=t_(this.id_),this.fsApi_=tp,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_={controlBarHeight:null,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&&it(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_=nT.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(),i2(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(iM(y.default,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);let s=tE(this.options_);if(t.plugins&&Object.keys(t.plugins).forEach(e=>{this[e](t.plugins[e])}),t.debug&&this.debug(!0),this.options_.playerOptions=s,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons){let e=new g.default.DOMParser().parseFromString('\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n',"image/svg+xml");if(e.querySelector("parsererror"))ty.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 s5(this),this.addClass("vjs-spatial-navigation-enabled")),tG&&this.addClass("vjs-touch-enabled"),tK||this.addClass("vjs-workinghover"),nT.players[this.id_]=this;let r=th.split(".")[0];this.addClass(`vjs-v${r}`),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"),iU(y.default,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),iU(y.default,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),nT.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),sz.hasOwnProperty(this.id())&&delete sz[this.id()],sF.names.forEach(e=>{let t=this[sF[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"),s="video-js"===this.tag.tagName.toLowerCase();i?e=this.el_=t.parentNode:s||(e=this.el_=super.createEl("div"));let r=it(t);if(s){for(e=this.el_=t,t=this.tag=y.default.createElement("video");e.children.length;)t.appendChild(e.firstChild);t3(e,"video-js")||t6(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"),r.tabindex="-1",tR&&t$&&(t.setAttribute("role","application"),r.role="application"),t.removeAttribute("width"),t.removeAttribute("height"),"width"in r&&delete r.width,"height"in r&&delete r.height,Object.getOwnPropertyNames(r).forEach(function(i){s&&"class"===i||e.setAttribute(i,r[i]),s&&t.setAttribute(i,r[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","IS_CHROMECAST_RECEIVER"].filter(e=>tQ[e]).map(e=>"vjs-device-"+e.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...n),!0!==g.default.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=iC("vjs-styles-dimensions");let e=i_(".vjs-styles-defaults"),t=i_("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_)},iX(this)?t():(this.eventedCallbacks||(this.eventedCallbacks=[]),this.eventedCallbacks.push(t))}else 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===g.default.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 s=(void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:this.videoWidth()>0?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"),r=s[1]/s[0];e=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/r:this.videoWidth()||300,t=void 0!==this.height_?this.height_:e*r,i=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(i),iI(this.styleEl_,` .${i} { width: ${e}px; height: ${t}px; } .${i}.vjs-fluid:not(.vjs-audio-only-mode) { padding-top: ${100*r}%; } `)}loadTech_(e,t){var i,s;this.tech_&&this.unloadTech_();let r=i3(e),n=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==r&&this.tag&&(sV.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=r,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};sF.names.forEach(e=>{let t=sF[e];o[t.getterName]=this[t.privateName]}),Object.assign(o,this.options_[r]),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=sV.getTech(e);if(!l)throw Error(`No Tech named '${r}' exists! '${r}' should be registered using videojs.registerTech()'`);this.tech_=new l(o),this.tech_.ready(iF(this,this.handleTechReady_),!0),i=this.textTracksJson_||[],s=this.tech_,i.forEach(function(e){let t=s.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach(e=>t.addCue(e))}),s.textTracks(),ng.forEach(e=>{this.on(this.tech_,e,t=>this[`handleTech${i3(e)}_`](t))}),Object.keys(ny).forEach(e=>{this.on(this.tech_,e,t=>{0===this.tech_.playbackRate()&&this.tech_.seeking()?this.queuedCallbacks_.push({callback:this[`handleTech${ny[e]}_`].bind(this),event:t}):this[`handleTech${ny[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"===r&&this.tag||t8(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){sF.names.forEach(e=>{let t=sF[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=sf(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&&ty.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":th}}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(su(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():su(t=this.play())&&(t=t.catch(i)),su(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=((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 s=e.$$("source");for(let e=0;ee.src&&e.src===t),r=[],n=this.$$("source"),a=[];for(let e=0;ethis.updateSourceCaches_(e),i=this.currentSource().src,s=e.src;i&&!/^blob:/.test(i)&&/^blob:/.test(s)&&(!this.lastSource_||this.lastSource_.tech!==s&&this.lastSource_.player!==i)&&(t=()=>{}),t(s),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()?sc(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.isInPictureInPicture()&&!y.default.pictureInPictureElement?this.exitPictureInPicture():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(),s=y.default[this.fsApi_.fullscreenElement]===i;!s&&i.matches&&(s=i.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(s)}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:0/0,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}}techCall_(e,t){this.ready(function(){if(e in sK){var i,s;return i=this.middleware_,s=this.tech_,s[e](i.reduce(sQ(e),t))}if(e in sY)return sG(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(e){throw ty(e),e}},!0)}techGet_(e){if(this.tech_&&this.tech_.isReady_){if(e in sX){var t,i;return t=this.middleware_,i=this.tech_,t.reduceRight(sQ(e),i[e]())}if(e in sY)return sG(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){if(void 0===this.tech_[e])throw ty(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t;if("TypeError"===t.name)throw ty(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t;throw ty(t),t}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=sc){this.playCallbacks_.push(e);let t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),i=!!(tY||tK);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 s=this.techGet_("play");i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),null===s?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(s)}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")||si(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:0/0;(e=parseFloat(e))<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,1/0===e?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=si(0,0)),e}seekable(){let e=this.techGet_("seekable");return e&&e.length||(e=si(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 sh(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){return void 0!==e?void this.techCall_("setMuted",e):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,s)=>{function r(){t.off("fullscreenerror",a),t.off("fullscreenchange",n)}function n(){r(),i()}function a(e,t){r(),s(t)}t.one("fullscreenchange",n),t.one("fullscreenerror",a);let o=t.requestFullscreenHelper_(e);o&&(o.then(r,r),o.then(i,s))})}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 s(){e.off("fullscreenerror",n),e.off("fullscreenchange",r)}function r(){s(),t()}function n(e,t){s(),i(t)}e.one("fullscreenchange",r),e.one("fullscreenerror",n);let a=e.exitFullscreenHelper_();a&&(a.then(s,s),a.then(t,i))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){let e=y.default[this.fsApi_.exitFullscreen]();return e&&sc(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=y.default.documentElement.style.overflow,iM(y.default,"keydown",this.boundFullWindowOnEscKey_),y.default.documentElement.style.overflow="hidden",t6(y.default.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){"Escape"===e.key&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,iU(y.default,"keydown",this.boundFullWindowOnEscKey_),y.default.documentElement.style.overflow=this.docOrigOverflow,t7(y.default.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&&g.default.documentPictureInPicture){let e=y.default.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(t4("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),g.default.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(iT(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 y.default&&!1===this.disablePictureInPicture()?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){return g.default.documentPictureInPicture&&g.default.documentPictureInPicture.window?(g.default.documentPictureInPicture.window.close(),Promise.resolve()):"pictureInPictureEnabled"in y.default?y.default.exitPictureInPicture():void 0}handleKeyDown(e){var t;let i,{userActions:s}=this.options_;s&&s.hotkeys&&(i=(t=this.el_.ownerDocument.activeElement).tagName.toLowerCase(),t.isContentEditable||("input"===i?-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(t.type):-1!==["textarea"].indexOf(i))||("function"==typeof s.hotkeys?s.hotkeys.call(this,e):this.handleHotkeys(e)))}handleHotkeys(e){let{fullscreenKey:t=t=>"f"===e.key.toLowerCase(),muteKey:i=t=>"m"===e.key.toLowerCase(),playPauseKey:s=t=>"k"===e.key.toLowerCase()||" "===e.key.toLowerCase()}=this.options_.userActions?this.options_.userActions.hotkeys:{};if(t.call(this,e)){e.preventDefault(),e.stopPropagation();let t=i9.getComponent("FullscreenToggle");!1!==y.default[this.fsApi_.fullscreenEnabled]&&t.prototype.handleClick.call(this,e)}else i.call(this,e)?(e.preventDefault(),e.stopPropagation(),i9.getComponent("MuteToggle").prototype.handleClick.call(this,e)):s.call(this,e)&&(e.preventDefault(),e.stopPropagation(),i9.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let i=0,s=this.options_.techOrder;i[e,sV.getTech(e)]).filter(([e,t])=>t?t.isSupported():(ty.error(`The "${e}" tech is undefined. Skipped browser support check for that tech.`),!1)),s=function(e,t,i){let s;return e.some(e=>t.some(t=>{if(s=i(e,t))return!0})),s},r=([e,t],i)=>{if(t.canPlaySource(i,this.options_[e.toLowerCase()]))return{source:i,tech:e}};if(this.options_.sourceOrder)t=s(e,i,(e,t)=>r(t,e));else t=s(i,e,r);return t||!1}handleSrc_(e,t){var i,s,r;if(void 0===e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();let n=s0(e);if(!n.length)return void this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);if(this.changingSrc_=!0,t||(this.cache_.sources=n),this.updateSourceCaches_(n[0]),i=this,s=n[0],r=(e,i)=>{var s;if(this.middleware_=i,t||(this.cache_.sources=n),this.updateSourceCaches_(e),this.src_(e))return n.length>1?this.handleSrc_(n.slice(1)):(this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),void this.triggerReady());s=this.tech_,i.forEach(e=>e.setTech&&e.setTech(s))},i.setTimeout(()=>(function e(t={},i=[],s,r,n=[],a=!1){let[o,...l]=i;if("string"==typeof o)e(t,sH[o],s,r,n,a);else if(o){let i=function(e,t){let i=sz[e.id()],s=null;if(null==i)return s=t(e),sz[e.id()]=[[t,s]],s;for(let e=0;e1){let e=()=>{this.error(null),this.handleSrc_(n.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||(i6(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)}addSourceElement(e,t){return!!this.tech_&&this.tech_.addSourceElement(e,t)}removeSourceElement(e){return!!this.tech_&&this.tech_.removeSourceElement(e)}load(){this.tech_&&this.tech_.vhs?this.src(this.currentSource()):this.techCall_("load")}reset(){this.paused()?this.doReset_():sc(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}),iX(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);let{currentTimeDisplay:e,durationDisplay:t,progressControl:i,remainingTimeDisplay:s}=this.controlBar||{},{seekBar:r}=i||{};e&&e.updateContent(),t&&t.updateContent(),s&&s.updateContent(),r&&(r.update(),r.loadProgressBar&&r.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(tu("beforeerror").forEach(t=>{let i=t(this,e);tx(i)&&!Array.isArray(i)||"string"==typeof i||"number"==typeof i||null===i?e=i:this.log.error("please return a value that MediaError expects in beforeerror hooks")}),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 sd(e),this.addClass("vjs-error"),ty.error(`(CODE:${this.error_.code} ${sd.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),tu("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,s,r=iF(this,this.reportUserActivity),n=function(t){r(),this.clearInterval(e)};this.on("mousedown",function(){r(),this.clearInterval(e),e=this.setInterval(r,250)}),this.on("mousemove",function(e){(e.screenX!==t||e.screenY!==i)&&(t=e.screenX,i=e.screenY,r())}),this.on("mouseup",n),this.on("mouseleave",n);let a=this.getChild("controlBar");!a||tK||tP||(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",r),this.on("keyup",r),this.setInterval(function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(s);let e=this.options_.inactivityTimeout;e<=0||(s=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},e))},250)}playbackRate(e){return void 0!==e?void this.techCall_("setPlaybackRate",e):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_}updatePlayerHeightOnAudioOnlyMode_(){let e=this.getChild("ControlBar");e&&this.audioOnlyCache_.controlBarHeight!==e.currentHeight()&&(this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight))}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.audioOnlyCache_.controlBarHeight=i,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),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(),iX(this)&&this.trigger("languagechange"))}languages(){return tE(nT.prototype.options_.languages,this.languages_)}toJSON(){let e=tE(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:h,description:n||s||""}),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:sZ(t.poster)}]),t}return tE(this.cache_.media)}static getTagSettings(e){let t={sources:[],tracks:[]},i=it(e),s=i["data-setup"];if(t3(e,"vjs-fill")&&(i.fill=!0),t3(e,"vjs-fluid")&&(i.fluid=!0),null!==s)try{Object.assign(i,JSON.parse(s||"{}"))}catch(e){ty.error("data-setup",e)}if(Object.assign(t,i),e.hasChildNodes()){let i=e.childNodes;for(let e=0,s=i.length;e"number"==typeof e)&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))):void 0}}nT.prototype.videoTracks=()=>{},nT.prototype.audioTracks=()=>{},nT.prototype.textTracks=()=>{},nT.prototype.remoteTextTracks=()=>{},nT.prototype.remoteTextTrackEls=()=>{},sF.names.forEach(function(e){let t=sF[e];nT.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}}),nT.prototype.crossorigin=nT.prototype.crossOrigin,nT.players={};let nS=g.default.navigator;nT.prototype.options_={techOrder:sV.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:nS&&(nS.languages&&nS.languages[0]||nS.userLanguage||nS.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,disableSeekWhileScrubbingOnMobile:!1,disableSeekWhileScrubbingOnSTV:!1},ng.forEach(function(e){nT.prototype[`handleTech${i3(e)}_`]=function(){return this.trigger(e)}}),i9.registerComponent("Player",nT);let nx="plugin",nw="activePlugins_",nE={},nk=e=>nE.hasOwnProperty(e)?nE[e]:void 0,nC=(e,t)=>{e[nw]=e[nw]||{},e[nw][t]=!0},nI=(e,t,i)=>{let s=(i?"before":"")+"pluginsetup";e.trigger(s,t),e.trigger(s+":"+t.name,t)},nA=function(e,t){let i=function(){nI(this,{name:e,plugin:t,instance:null},!0);let i=t.apply(this,arguments);return nC(this,e),nI(this,{name:e,plugin:t,instance:i}),i};return Object.keys(t).forEach(function(e){i[e]=t[e]}),i},nD=(e,t)=>(t.prototype.name=e,function(...i){nI(this,{name:e,plugin:t,instance:null},!0);let s=new t(...[this,...i]);return this[e]=()=>s,nI(this,s.getEventHash()),s});class nP{constructor(e){if(this.constructor===nP)throw Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),i2(this),delete this.trigger,i5(this,this.constructor.defaultState),nC(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 ij(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[nw][e]=!1,this.player=this.state=null,t[e]=nD(e,nE[e])}static isBasic(e){let t="string"==typeof e?nk(e):e;return"function"==typeof t&&!nP.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(nE.hasOwnProperty(e))ty.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(nT.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 nE[e]=t,e!==nx&&(nP.isBasic(t)?nT.prototype[e]=nA(e,t):nT.prototype[e]=nD(e,t)),t}static deregisterPlugin(e){if(e===nx)throw Error("Cannot de-register base plugin.");nE.hasOwnProperty(e)&&(delete nE[e],delete nT.prototype[e])}static getPlugins(e=Object.keys(nE)){let t;return e.forEach(e=>{let i=nk(e);i&&((t=t||{})[e]=i)}),t}static getPluginVersion(e){let t=nk(e);return t&&t.VERSION||""}}function nL(e,t,i,s){var r;let n;return r=`${t} is deprecated and will be removed in ${e}.0; please use ${i} instead.`,n=!1,function(...e){return n||ty.warn(r),n=!0,s.apply(this,e)}}nP.getPlugin=nk,nP.BASE_PLUGIN_NAME=nx,nP.registerPlugin(nx,nP),nT.prototype.usingPlugin=function(e){return!!this[nw]&&!0===this[nw][e]},nT.prototype.hasPlugin=function(e){return!!nE.hasOwnProperty(e)};let nO=e=>0===e.indexOf("#")?e.slice(1):e;function nN(e,t,i){let s=nN.getPlayer(e);if(s)return t&&ty.warn(`Player "${e}" is already initialised. Options will not be applied.`),i&&s.ready(i),s;let r="string"==typeof e?i_("#"+nO(e)):e;if(!t0(r))throw TypeError("The element or ID supplied is not valid. (videojs)");let n="getRootNode"in r&&r.getRootNode()instanceof g.default.ShadowRoot?r.getRootNode():r.ownerDocument.body;return r.ownerDocument.defaultView&&n.contains(r)||ty.warn("The element supplied is not included in the DOM"),!0===(t=t||{}).restoreEl&&(t.restoreEl=(r.parentNode&&r.parentNode.hasAttribute&&r.parentNode.hasAttribute("data-vjs-player")?r.parentNode:r).cloneNode(!0)),tu("beforesetup").forEach(e=>{let i=e(r,tE(t));!tx(i)||Array.isArray(i)?ty.error("please return an object in beforesetup hooks"):t=tE(t,i)}),s=new(i9.getComponent("Player"))(r,t,i),tu("setup").forEach(e=>e(s)),s}if(nN.hooks_=td,nN.hooks=tu,nN.hook=function(e,t){tu(e,t)},nN.hookOnce=function(e,t){tu(e,[].concat(t).map(t=>{let i=(...s)=>(tc(e,i),t(...s));return i}))},nN.removeHook=tc,!0!==g.default.VIDEOJS_NO_DYNAMIC_STYLE&&tZ()){let e=i_(".vjs-styles-defaults");if(!e){e=iC("vjs-styles-defaults");let t=i_("head");t&&t.insertBefore(e,t.firstChild),iI(e,` .video-js { width: 300px; height: 150px; } .vjs-fluid:not(.vjs-audio-only-mode) { padding-top: 56.25% } `)}}iE(1,nN),nN.VERSION=th,nN.options=nT.prototype.options_,nN.getPlayers=()=>nT.players,nN.getPlayer=e=>{let t,i=nT.players;if("string"==typeof e){let s=nO(e),r=i[s];if(r)return r;t=i_("#"+s)}else t=e;if(t0(t)){let{player:e,playerId:s}=t;if(e||i[s])return e||i[s]}},nN.getAllPlayers=()=>Object.keys(nT.players).map(e=>nT.players[e]).filter(Boolean),nN.players=nT.players,nN.getComponent=i9.getComponent,nN.registerComponent=(e,t)=>(sV.isTech(t)&&ty.warn(`The ${e} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),i9.registerComponent.call(i9,e,t)),nN.getTech=sV.getTech,nN.registerTech=sV.registerTech,nN.use=function(e,t){sH[e]=sH[e]||[],sH[e].push(t)},Object.defineProperty(nN,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(nN.middleware,"TERMINATOR",{value:sW,writeable:!1,enumerable:!0}),nN.browser=tQ,nN.obj=tI,nN.mergeOptions=nL(9,"videojs.mergeOptions","videojs.obj.merge",tE),nN.defineLazyProperty=nL(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",tC),nN.bind=nL(9,"videojs.bind","native Function.prototype.bind",iF),nN.registerPlugin=nP.registerPlugin,nN.deregisterPlugin=nP.deregisterPlugin,nN.plugin=(e,t)=>(ty.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),nP.registerPlugin(e,t)),nN.getPlugins=nP.getPlugins,nN.getPlugin=nP.getPlugin,nN.getPluginVersion=nP.getPluginVersion,nN.addLanguage=function(e,t){return e=(""+e).toLowerCase(),nN.options.languages=tE(nN.options.languages,{[e]:t}),nN.options.languages[e]},nN.log=ty,nN.createLogger=t_,nN.time=sl,nN.createTimeRange=nL(9,"videojs.createTimeRange","videojs.time.createTimeRanges",si),nN.createTimeRanges=nL(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",si),nN.formatTime=nL(9,"videojs.formatTime","videojs.time.formatTime",so),nN.setFormatTime=nL(9,"videojs.setFormatTime","videojs.time.setFormatTime",sn),nN.resetFormatTime=nL(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",sa),nN.parseUrl=nL(9,"videojs.parseUrl","videojs.url.parseUrl",sA),nN.isCrossOrigin=nL(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",sL),nN.EventTarget=iW,nN.any=iq,nN.on=iM,nN.one=iB,nN.off=iU,nN.trigger=ij,nN.xhr=_.default,nN.TrackList=sy,nN.TextTrack=sM,nN.TextTrackList=sS,nN.AudioTrack=sU,nN.AudioTrackList=sb,nN.VideoTrack=sj,nN.VideoTrackList=sT,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(e=>{nN[e]=function(){return ty.warn(`videojs.${e}() is deprecated; use videojs.dom.${e}() instead`),iS[e].apply(null,arguments)}}),nN.computedStyle=nL(9,"videojs.computedStyle","videojs.dom.computedStyle",iv),nN.dom=iS,nN.fn=iz,nN.num=rc,nN.str=i7,nN.url=sO,nN.Error={NetworkBadStatus:"networkbadstatus",NetworkRequestFailed:"networkrequestfailed",NetworkRequestAborted:"networkrequestaborted",NetworkRequestTimeout:"networkrequesttimeout",NetworkBodyParserFailed:"networkbodyparserfailed",StreamingHlsPlaylistParserError:"streaminghlsplaylistparsererror",StreamingDashManifestParserError:"streamingdashmanifestparsererror",StreamingContentSteeringParserError:"streamingcontentsteeringparsererror",StreamingVttParserError:"streamingvttparsererror",StreamingFailedToSelectNextSegment:"streamingfailedtoselectnextsegment",StreamingFailedToDecryptSegment:"streamingfailedtodecryptsegment",StreamingFailedToTransmuxSegment:"streamingfailedtotransmuxsegment",StreamingFailedToAppendSegment:"streamingfailedtoappendsegment",StreamingCodecsChangeError:"streamingcodecschangeerror"};class nR{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 nM extends nN.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 nR(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,s=this.length;ii&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let t=0,i=this.length;ts,e.qualityLevels.VERSION=nU,s},nB=function(e){return nj(this,nN.obj.merge({},e))};nN.registerPlugin("qualityLevels",nB),nB.VERSION=nU;let nq=(e,t)=>t&&t.responseURL&&e!==t.responseURL?t.responseURL:e,n$=e=>nN.log.debug?nN.log.debug.bind(nN,"VHS:",`${e} >`):function(){};function nF(...e){let t=nN.obj||nN;return(t.merge||t.mergeOptions).apply(t,e)}function nV(...e){let t=nN.time||nN;return(t.createTimeRanges||t.createTimeRanges).apply(t,e)}let nH=1/30,nz=1/30*3,nW=function(e,t){let i,s=[];if(e&&e.length)for(i=0;i=t})},nX=function(e,t){return nW(e,function(e){return e-nH>=t})},nK=function(e){if(e.length<2)return nV();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(", ")},nJ=e=>{let t=[];for(let i=0;in)){if(t>r&&t<=n){i+=n-t;continue}i+=n-r}}return i},n2=(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},n4=e=>(e.segments||[]).reduce((e,t,i)=>(t.parts?t.parts.forEach(function(s,r){e.push({duration:s.duration,segmentIndex:i,partIndex:r,part:s,segment:t})}):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e),[]),n5=e=>{let t=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return t&&t.parts||[]},n8=({preloadSegment:e})=>{if(!e)return;let{parts:t,preloadHints:i}=e,s=(i||[]).reduce((e,t)=>e+ +("PART"===t.type),0);return s+(t&&t.length?t.length:0)},n3=(e,t)=>{if(t.endList)return 0;if(e&&e.suggestedPresentationDelay)return e.suggestedPresentationDelay;let i=n5(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},n6=function(e,t){let i=0,s=t-e.mediaSequence,r=e.segments[s];if(r){if(void 0!==r.start)return{result:r.start,precise:!0};if(void 0!==r.end)return{result:r.end-r.duration,precise:!0}}for(;s--;){if(void 0!==(r=e.segments[s]).end)return{result:i+r.end,precise:!0};if(i+=n2(e,r),void 0!==r.start)return{result:i+r.start,precise:!0}}return{result:i,precise:!1}},n7=function(e,t){let i,s=0,r=t-e.mediaSequence;for(;rs&&([i,s]=[s,i]),i<0){for(let t=i;tDate.now()},ar=function(e){return e.excludeUntil&&1/0===e.excludeUntil},an=function(e){let t=as(e);return!e.disabled&&!t},aa=function(e,t){return t.attributes&&t.attributes[e]},ao=(e,t)=>{if(1===e.playlists.length)return!0;let i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter(e=>!!an(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),ah=function(e,t){let i=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{},s=!1;for(let e in i){for(let r in i[e])if(s=t(i[e][r]))break;if(s)break}return!!s},ad=e=>{if(!e||!e.playlists||!e.playlists.length)return ah(e,e=>e.playlists&&e.playlists.length||e.uri);for(let t=0;t$(e)))&&!ah(e,e=>al(i,e)))return!1}return!0};var au={liveEdgeDelay:n3,duration:ae,seekable:function(e,t,i){let s=t||0,r=ai(e,t,!0,i);return null===r?nV():(r0)for(let t=l-1;t>=0;t--){let i=o[t];if(a+=i.duration,n){if(a<0)continue}else if(a+nH<=0)continue;return{partIndex:i.partIndex,segmentIndex:i.segmentIndex,startTime:r-at({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;tnH,h=0===a,d=s&&a+nH>=0;if(!h&&!d||t===o.length-1){if(n){if(a>0)continue}else if(a-nH>=0)continue;return{partIndex:i.partIndex,segmentIndex:i.segmentIndex,startTime:r+at({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:an,isDisabled:function(e){return e.disabled},isExcluded:as,isIncompatible:ar,playlistEnd:ai,isAes:function(e){for(let t=0;t`${e}-${t}`,af=(e,t,i)=>`placeholder-uri-${e}-${t}-${i}`,am=(e,t)=>{e.mediaGroups&&["AUDIO","SUBTITLES"].forEach(i=>{if(e.mediaGroups[i])for(let s in e.mediaGroups[i])for(let r in e.mediaGroups[i][s])t(e.mediaGroups[i][s][r],i,s,r)})},ag=({playlist:e,uri:t,id:i})=>{e.id=i,e.playlistErrors_=0,t&&(e.uri=t),e.attributes=e.attributes||{}},ay=(e,t,i=af)=>{e.uri=t;for(let t=0;t{if(!t.playlists||!t.playlists.length){if(s&&"AUDIO"===r&&!t.uri)for(let t=0;t{t.uri&&(t.resolvedUri=S(e.uri,t.uri))})};class a_{constructor(){this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map}setOffset(e=[]){if(null!==this.offset_||!e.length)return;let[t]=e;void 0!==t.programDateTime&&(this.offset_=t.programDateTime/1e3)}setPendingDateRanges(e=[]){if(!e.length)return;let[t]=e,i=t.startDate.getTime();this.trimProcessedDateRanges_(i),this.pendingDateRanges_=e.reduce((e,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,s)=>{if(!this.processedDateRanges_.has(s)&&(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(){let r=t.status<200||t.status>299,n=t.status>=400&&t.status<=499,a={uri:t.uri,requestType:e};return i&&n?(a.error=v({},i),a.errorType=nN.Error.NetworkRequestFailed):t.aborted?a.errorType=nN.Error.NetworkRequestAborted:t.timedout?a.errorType=nN.Error.NetworkRequestTimeout:(r&&!n||s)&&(a.errorType=s?nN.Error.NetworkBodyParserFailed:nN.Error.NetworkBadStatus,a.status=t.status,a.headers=t.headers),a},av=n$("CodecUtils"),aT=function(e){let t=e.attributes||{};if(t.CODECS)return B(t.CODECS)},aS=(e,t)=>{let i=t.attributes||{};return e&&e.mediaGroups&&e.mediaGroups.AUDIO&&i.AUDIO&&e.mediaGroups.AUDIO[i.AUDIO]},ax=function(e){let t={};return e.forEach(({mediaType:e,type:i,details:s})=>{t[e]=t[e]||[],t[e].push(j(`${i}${s}`))}),Object.keys(t).forEach(function(e){if(t[e].length>1){av(`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},aw=function(e){let t=0;return e.audio&&t++,e.video&&t++,t},aE=function(e,t){let i=t.attributes||{},s=ax(aT(t)||[]);if(aS(e,t)&&!s.audio&&!((e,t)=>{if(!aS(e,t))return!0;let i=t.attributes||{},s=e.mediaGroups.AUDIO[i.AUDIO];for(let e in s)if(!s[e].uri&&!s[e].playlists)return!0;return!1})(e,t)){let t=ax(q(e,i.AUDIO)||[]);t.audio&&(s.audio=t.audio)}return s},{EventTarget:ak}=nN,aC=(e,t)=>{if(!e)return t;let i=nF(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 s=0;s{!e.resolvedUri&&e.uri&&(e.resolvedUri=S(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=S(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=S(t,e.map.uri)),e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=S(t,e.map.key.uri)),e.parts&&e.parts.length&&e.parts.forEach(e=>{e.resolvedUri||(e.resolvedUri=S(t,e.uri))}),e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach(e=>{e.resolvedUri||(e.resolvedUri=S(t,e.uri))})},aA=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,aP=(e,t,i=aD)=>{let s=nF(e,{}),r=s.playlists[t.id];if(!r||i(r,t))return null;t.segments=aA(t);let n=nF(r,t);if(n.preloadSegment&&!t.preloadSegment&&delete n.preloadSegment,r.segments){if(t.skip){t.segments=t.segments||[];for(let e=0;e{let s,r=e.slice(),n=t.slice();i=i||0;let a=[];for(let e=0;e{aI(e,n.resolvedUri)});for(let e=0;e{if(e.playlists)for(let i=0;i{let i=e.segments||[],s=i[i.length-1],r=s&&s.parts&&s.parts[s.parts.length-1],n=r&&r.duration||s&&s.duration;return t&&n?1e3*n:500*(e.partTargetDuration||e.targetDuration||10)},aO=(e,t,i)=>{if(!e)return;let s=[];return e.forEach(e=>{if(!e.attributes)return;let{BANDWIDTH:t,RESOLUTION:i,CODECS:r}=e.attributes;s.push({id:e.id,bandwidth:t,resolution:i,codecs:r})}),{type:t,isLive:i,renditions:s}};class aN extends ak{constructor(e,t,i={}){if(super(),!e)throw Error("A non-empty playlist URL or object is required");this.logger_=n$("PlaylistLoader");let{withCredentials:s=!1}=i;this.src=e,this.vhs_=t,this.withCredentials=s,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack;let r=t.options_;this.customTagParsers=r&&r.customTagParsers||[],this.customTagMappers=r&&r.customTagMappers||[],this.llhls=r&&r.llhls,this.dateRangesStorage_=new a_,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=S(this.main.uri,e.uri);this.llhls&&(t=((e,t)=>{if(t.endList||!t.serverControl)return e;let i={};if(t.serverControl.canBlockReload){let{preloadSegment:e}=t,s=t.mediaSequence+t.segments.length;if(e){let r=e.parts||[],n=n8(t)-1;n>-1&&n!==r.length-1&&(i._HLS_part=n),(n>-1||r.length)&&s--}i._HLS_msn=s}if(t.serverControl&&t.serverControl.canSkipUntil&&(i._HLS_skip=t.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(i).length){let t=new g.default.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})(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:s,id:r}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[r],status:e.status,message:`HLS playlist request error at URL: ${s}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:ab({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{let i=(({onwarn:e,oninfo:t,manifestString:i,customTagParsers:s=[],customTagMappers:r=[],llhls:n})=>{let a=new N;e&&a.on("warn",e),t&&a.on("info",t),s.forEach(e=>a.addParser(e)),r.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=n5(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}`}),ac.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})({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});if(!i.playlists||!i.playlists.length)return i;return this.excludeAudioOnlyVariants(i.playlists),i}catch(e){this.error=e,this.error.metadata={errorType:nN.Error.StreamingHlsPlaylistParserError,error:e}}}excludeAudioOnlyVariants(e){let t=e=>{let{width:t,height:i}=(e.attributes||{}).RESOLUTION||{};return!!t&&!!i||!!ax(aT(e)||[]).video};e.some(t)&&e.forEach(e=>{t(e)||(e.excludeUntil=1/0)})}haveMetadata({playlistString:e,playlistObject:t,url:i,id:s}){this.request=null,this.state="HAVE_METADATA";let r={playlistInfo:{type:"media",uri:i}};this.trigger({type:"playlistparsestart",metadata:r});let n=t||this.parseManifest_({url:i,manifestString:e});n.lastRequest=Date.now(),ag({playlist:n,uri:i,id:s});let a=aP(this.main,n);this.targetDuration=n.partTargetDuration||n.targetDuration,this.pendingMedia_=null,a?(this.main=a,this.media_=this.main.playlists[s]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(aL(this.media(),!!a)),r.parsedPlaylist=aO(this.main.playlists,r.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:r}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),g.default.clearTimeout(this.mediaUpdateTimeout),g.default.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new a_,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(g.default.clearTimeout(this.finalRenditionTimeout),t){let t=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=g.default.setTimeout(this.media.bind(this,e,!1),t);return}let i=this.state,s=!this.media_||e.id!==this.media_.id,r=this.main.playlists[e.id];if(r&&r.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,s&&(this.trigger("mediachanging"),"HAVE_MAIN_MANIFEST"===i?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(aL(e,!0)),!s)return;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;let n={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:n}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(t,s)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=nq(e.resolvedUri,s),t)return this.playlistRequestError(this.request,e,i);this.trigger({type:"playlistrequestcomplete",metadata:n}),this.haveMetadata({playlistString:s.responseText,url:e.uri,id:e.id}),"HAVE_MAIN_MANIFEST"===i?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(g.default.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&&(g.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);let t=this.media();if(e){let e=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=g.default.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},e);return}this.started?t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(g.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=g.default.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=g.default.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}let e={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:e}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},(t,i)=>{if(!this.request)return;if(this.request=null,t)return this.error={status:i.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:i.responseText,code:2,metadata:ab({requestType:i.requestType,request:i,error:t})},"HAVE_NOTHING"===this.state&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=nq(this.src,i),this.trigger({type:"playlistparsestart",metadata:e});let s=this.parseManifest_({manifestString:i.responseText,url:this.src});e.parsedPlaylist=aO(s.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),this.setupInitialPlaylist(s)})}srcUri(){return"string"==typeof this.src?this.src:this.src.uri}setupInitialPlaylist(e){let t,i;if(this.state="HAVE_MAIN_MANIFEST",e.playlists){this.main=e,ay(this.main,this.srcUri()),e.playlists.forEach(e=>{e.segments=aA(e),e.segments.forEach(t=>{aI(t,e.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}let s=this.srcUri()||g.default.location.href;this.main=(t=ap(0,s),(i={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:g.default.location.href,resolvedUri:g.default.location.href,playlists:[{uri:s,id:t,resolvedUri:s,attributes:{}}]}).playlists[t]=i.playlists[0],i.playlists[s]=i.playlists[0],i),this.haveMetadata({playlistObject:e,url:s,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,t){let i=this.main,s=e.ID,r=i.playlists.length;for(;r--;){let n=i.playlists[r];if(n.attributes["PATHWAY-ID"]===s){let a=n.resolvedUri,o=n.id;if(t){let t=this.createCloneURI_(n.resolvedUri,e),a=ap(s,t),o=this.createCloneAttributes_(s,n.attributes),l=this.createClonePlaylist_(n,a,e,o);i.playlists[r]=l,i.playlists[a]=l,i.playlists[t]=l}else i.playlists.splice(r,1);delete i.playlists[o],delete i.playlists[a]}}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){let i=this.main,s=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{if(i.mediaGroups[e]&&i.mediaGroups[e][s]){for(let t in i.mediaGroups[e])if(t===s){for(let s in i.mediaGroups[e][t])i.mediaGroups[e][t][s].playlists.forEach((e,t)=>{let s=i.playlists[e.id],r=s.id,n=s.resolvedUri;delete i.playlists[r],delete i.playlists[n]});delete i.mediaGroups[e][t]}}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){let i=this.main,s=i.playlists.length,r=this.createCloneURI_(t.resolvedUri,e),n=ap(e.ID,r),a=this.createCloneAttributes_(e.ID,t.attributes),o=this.createClonePlaylist_(t,n,e,a);i.playlists[s]=o,i.playlists[n]=o,i.playlists[r]=o,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){let t=e.ID,i=e["BASE-ID"],s=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(r=>{if(s.mediaGroups[r]&&!s.mediaGroups[r][t]){for(let n in s.mediaGroups[r])if(n===i)for(let i in s.mediaGroups[r][t]={},s.mediaGroups[r][n]){let a=s.mediaGroups[r][n][i];s.mediaGroups[r][t][i]=v({},a);let o=s.mediaGroups[r][t][i],l=this.createCloneURI_(a.resolvedUri,e);o.resolvedUri=l,o.uri=l,o.playlists=[],a.playlists.forEach((n,a)=>{let l=s.playlists[n.id],h=af(r,t,i),d=ap(t,h);if(l&&!s.playlists[d]){let t=this.createClonePlaylist_(l,d,e),i=t.resolvedUri;s.playlists[d]=t,s.playlists[i]=t}o.playlists[a]=this.createClonePlaylist_(n,d,e)})}}})}createClonePlaylist_(e,t,i,s){let r=this.createCloneURI_(e.resolvedUri,i),n={resolvedUri:r,uri:r,id:t};return e.segments&&(n.segments=[]),s&&(n.attributes=s),nF(e,n)}createCloneURI_(e,t){let i=new URL(e);i.hostname=t["URI-REPLACEMENT"].HOST;let s=t["URI-REPLACEMENT"].PARAMS;for(let e of Object.keys(s))i.searchParams.set(e,s[e]);return i.href}createCloneAttributes_(e,t){let i={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(s=>{t[s]&&(i[s]=e)}),i}getKeyIdSet(e){let t=new Set;if(!e||!e.contentProtection)return t;for(let i in e.contentProtection)if(e.contentProtection[i]&&e.contentProtection[i].attributes&&e.contentProtection[i].attributes.keyId){let s=e.contentProtection[i].attributes.keyId;t.add(s.toLowerCase())}return t}}let aR=function(e,t,i,s){let r="arraybuffer"===e.responseType?e.response:e.responseText;!t&&r&&(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=r.byteLength||r.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*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&&(r||e.responseText)))),s(t,e)},aM=function(){let e=function e(t,i){t=nF({timeout:45e3},t);let s=e.beforeRequest||nN.Vhs.xhr.beforeRequest,r=e._requestCallbackSet||nN.Vhs.xhr._requestCallbackSet||new Set,n=e._responseCallbackSet||nN.Vhs.xhr._responseCallbackSet;s&&"function"==typeof s&&(nN.log.warn("beforeRequest is deprecated, use onRequest instead."),r.add(s));let a=!0===nN.Vhs.xhr.original?nN.xhr:nN.Vhs.xhr,o=((e,t)=>{if(!e||!e.size)return;let i=t;return e.forEach(e=>{i=e(i)}),i})(r,t);r.delete(s);let l=a(o||t,function(e,t){return n&&n.size&&n.forEach(i=>{i(l,e,t)}),aR(l,e,t,i)}),h=l.abort;return l.abort=function(){return l.aborted=!0,h.apply(l,arguments)},l.uri=t.uri,l.requestType=t.requestType,l.requestTime=Date.now(),l};return e.original=!0,e},aU=function(e){return"bytes="+e.offset+"-"+("bigint"==typeof e.offset||"bigint"==typeof e.length?g.default.BigInt(e.offset)+g.default.BigInt(e.length)-g.default.BigInt(1):e.offset+e.length-1)},aj=function(e){let t={};return e.byterange&&(t.Range=aU(e.byterange)),t},aB=function(e,t){let i=e.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")},aq=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},a$=function(e){let t={};return Object.keys(e).forEach(i=>{let s=e[i];K(s)?t[i]={bytes:s.buffer,byteOffset:s.byteOffset,byteLength:s.byteLength}:t[i]=s}),t},aF=function(e){let t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},aV=function(e){return e.resolvedUri},aH=e=>{let t=Array.prototype.slice.call(e),i="";for(let e=0;eaH(e),textRanges:e=>{let t,i="";for(t=0;t{if(!a)throw Error("seekToProgramTime: callback must be provided");if(void 0===e||!t||!s)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(!(e=>{if(!e.segments||0===e.segments.length)return!1;for(let t=0;t{let i,s;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(a.getTime()+1e3*o)?null:(i>new Date(a)&&(r=n),{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:au.duration(t,t.mediaSequence+t.segments.indexOf(r)),type:r.videoTimingInfo?"accurate":"estimate"})})(e,t);if(!o)return a({message:`${e} was not found in the stream`});let l=o.segment,h=((e,t)=>{let i,s;try{i=new Date(e),s=new Date(t)}catch(e){}let r=i.getTime();return(s.getTime()-r)/1e3})(l.dateTimeObject,e);if("estimate"===o.type)return 0===i?a({message:`${e} is not buffered yet. Try again`}):(s(o.estimatedStart+h),void n.one("seeked",()=>{aW({programTime:e,playlist:t,retryCount:i-1,seekTo:s,pauseAfterSeek:r,tech:n,callback:a})}));let d=l.start+h;n.one("seeked",()=>a(null,n.currentTime())),r&&n.pause(),s(d)},aG=(e,t)=>{if(4===e.readyState)return t()},{EventTarget:aX}=nN,aK=function(e,t){if(!aD(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 r=s.attributes.NAME||i;return`placeholder-uri-${e}-${t}-${r}`},aQ=(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,aJ=(e,t)=>{let i={};for(let s in e){let r=e[s].sidx;if(r){let e=ex(r);if(!t[e])break;aQ(t[e].sidxInfo,r)&&(i[e]=t[e])}}return i};class aZ extends aX{constructor(e,t,i={},s){super(),this.isPaused_=!0,this.mainPlaylistLoader_=s||this,s||(this.isMain_=!0);let{withCredentials:r=!1}=i;if(this.vhs_=t,this.withCredentials=r,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_=n$("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}get isPaused(){return this.isPaused_}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){var s,r;let n,a,o,l,h,d,u=e.sidx&&ex(e.sidx);if(!e.sidx||!u||this.mainPlaylistLoader_.sidxMapping_[u]){g.default.clearTimeout(this.mediaRequest_),this.mediaRequest_=g.default.setTimeout(()=>i(!1),0);return}let c=nq(e.sidx.resolvedUri),p=(s,r)=>{let n;if(this.requestErrored_(s,r,t))return;let a=this.mainPlaylistLoader_.sidxMapping_,{requestType:o}=r;try{n=(0,eK.default)(Y(r.response).subarray(8))}catch(e){e.metadata=ab({requestType:o,request:r,parseFailure:!0}),this.requestErrored_(e,r,t);return}return a[u]={sidxInfo:e.sidx,sidx:n},ey(e,n,e.sidx.resolvedUri),i(!0)};this.request=(s=this.vhs_.xhr,r=(t,i,s,r)=>{if(t)return p(t,i);if(!s||"mp4"!==s)return p({status:i.status,message:`Unsupported ${s||"unknown"} container type for sidx segment at URL: ${c}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},i);let{offset:n,length:a}=e.sidx.byterange;if(r.length>=a+n)return p(t,{response:r.subarray(n,n+a),status:i.status,uri:i.uri});this.request=this.vhs_.xhr({uri:c,responseType:"arraybuffer",requestType:"dash-sidx",headers:aj({byterange:e.sidx.byterange})},p)},a=[],o=!1,l=function(e,t,i,s){return t.abort(),o=!0,r(e,t,i,s)},h=function(e,t){if(o)return;if(e)return e.metadata=ab({requestType:"dash-sidx",request:t,error:e}),l(e,t,"",a);let i=t.responseText.substring(a&&a.byteLength||0,t.responseText.length);if(a=es(a,ei(i,!0)),n=n||eJ(a),a.length<10||n&&a.lengthl(e,t,"",a));let s=to(a);return"ts"===s&&a.length<188||!s&&a.length<376?aG(t,()=>l(e,t,"",a)):l(null,t,s,a)},d=s({uri:c,beforeSend(e){e.overrideMimeType("text/plain; charset=x-user-defined"),e.addEventListener("progress",function({total:t,loaded:i}){return aR(e,null,{statusCode:e.status},h)})}},function(e,t){return aR(d,e,t,h)}))}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},g.default.clearTimeout(this.minimumUpdatePeriodTimeout_),g.default.clearTimeout(this.mediaRequest_),g.default.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,g.default.clearTimeout(this.mediaRequest_),this.mediaRequest_=null,this.refreshMedia_(t.id),"HAVE_MAIN_MANIFEST"===e?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.isPaused_=!0,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),g.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(g.default.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)}load(e){this.isPaused_=!1,g.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;let t=this.media();if(e){let e=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=g.default.setTimeout(()=>this.load(),e);return}this.started?t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()}start(){if(this.started=!0,!this.isMain_){g.default.clearTimeout(this.mediaRequest_),this.mediaRequest_=g.default.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,t)=>{this.haveMain_(),this.hasPendingRequest()||this.media_||this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){let t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:t}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(i,s)=>{if(i){let{requestType:e}=s;i.metadata=ab({requestType:e,request:s,error:i})}if(this.requestErrored_(i,s)){"HAVE_NOTHING"===this.state&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:t});let r=s.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=s.responseText,s.responseHeaders&&s.responseHeaders.date?this.mainLoaded_=Date.parse(s.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=nq(this.mainPlaylistLoader_.srcUrl,s),r){this.handleMain_(),this.syncClientServerClock_(()=>e(s,r));return}return e(s,r)})}syncClientServerClock_(e){let t=(e=>{let t=ej(e,"UTCTiming")[0];if(!t)return null;let i=eV(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("UNSUPPORTED_UTC_TIMING_SCHEME")}return i})(eX(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:S(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(i,s)=>{let r;if(this.request){if(i){let{requestType:t}=s;return this.error.metadata=ab({requestType:t,request:s,error:i}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}r="HEAD"===t.method?s.responseHeaders&&s.responseHeaders.date?Date.parse(s.responseHeaders.date):this.mainLoaded_:Date.parse(s.responseText),this.mainPlaylistLoader_.clientOffset_=r-Date.now(),e()}}))}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){let e;g.default.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;let t=this.mainPlaylistLoader_.main,i={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:i});try{e=(({mainXml:e,srcUrl:t,clientOffset:i,sidxMapping:s,previousManifest:r})=>{let n=((e,t={})=>{let i=((e,t={})=>{let{manifestUri:i="",NOW:s=Date.now(),clientOffset:r=0,eventHandler:n=function(){}}=t,a=ej(e,"Period");if(!a.length)throw Error("INVALID_NUMBER_OF_PERIOD");let o=ej(e,"Location"),l=eV(e),h=ez([{baseUrl:i}],ej(e,"BaseURL")),d=ej(e,"ContentSteering");l.type=l.type||"static",l.sourceDuration=l.mediaPresentationDuration||0,l.NOW=s,l.clientOffset=r,o.length&&(l.locations=o.map(eB));let u=[];return a.forEach((e,t)=>{let i=eV(e),s=u[t-1];i.start=(({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)({attributes:i,priorPeriodAttributes:s?s.attributes:null,mpdType:l.type}),u.push({node:e,attributes:i})}),{locations:l.locations,contentSteeringInfo:((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=el({serverURL:eB(e[0])},eV(e[0]));return i.queryBeforeStart="true"===i.queryBeforeStart,i})(d,n),representationInfo:ed(u.map((e,t)=>{let i=ez(h,ej(e.node,"BaseURL")),s=el(l,{periodStart:e.attributes.start});"number"==typeof e.attributes.duration&&(s.periodDuration=e.attributes.duration);let r=ej(e.node,"AdaptationSet"),n=eW(e.node);return ed(r.map(e=>{var t;let r,a=eV(e),o=ez(i,ej(e,"BaseURL")),l=el(s,a,{role:eV(ej(e,"Role")[0])}),h="urn:scte:dash:cc:cea-608:2015"===(t=eV(ej(e,"Accessibility")[0])).schemeIdUri?("string"!=typeof t.value?[]:t.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"===t.schemeIdUri?("string"!=typeof t.value?[]:t.value.split(";")).map(e=>{let t={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(e)){let[i,s=""]=e.split("=");t.channel=i,t.language=e,s.split(",").forEach(e=>{let[i,s]=e.split(":");"lang"===i?t.language=s:"er"===i?t.easyReader=Number(s):"war"===i?t.aspectRatio=Number(s):"3D"===i&&(t["3D"]=Number(s))})}else t.language=e;return t.channel&&(t.channel="SERVICE"+t.channel),t}):void 0;h&&(l=el(l,{captionServices:h}));let d=ej(e,"Label")[0];d&&d.childNodes.length&&(l=el(l,{label:d.childNodes[0].nodeValue.trim()}));let u=ej(e,"ContentProtection").reduce((e,t)=>{let i=eV(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());let s=eH[i.schemeIdUri];if(s){e[s]={attributes:i};let r=ej(t,"cenc:pssh")[0];if(r){let t=eB(r);e[s].pssh=t&&k(t)}}return e},{});Object.keys(u).length&&(l=el(l,{contentProtection:u}));let c=eW(e),p=ej(e,"Representation"),f=el(n,c);return ed(p.map((r=l,e=>{let t=ez(o,ej(e,"BaseURL")),i=el(r,eV(e)),s=eW(e);return t.map(e=>({segmentInfo:el(f,s),attributes:el(i,e)}))})))}))})),eventStream:ed(u.map(eG))}})(eX(e),t);return(({dashPlaylists:e,locations:t,contentSteering:i,sidxMapping:s={},previousManifest:r,eventStream:n})=>{var a;if(!e.length)return{};let{sourceDuration:o,type:l,suggestedPresentationDelay:h,minimumUpdatePeriod:d}=e[0].attributes,u=ew(e.filter(eC)).map(ek),c=ew(e.filter(eI)),p=ew(e.filter(eA)),f=e.map(e=>e.attributes.captionServices).filter(Boolean),m={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:o,playlists:((e,t={})=>{if(!Object.keys(t).length)return e;for(let i in e)e[i]=eE(e[i],t);return e})(u,s)};d>=0&&(m.minimumUpdatePeriod=1e3*d),t&&(m.locations=t),i&&(m.contentSteering=i),"dynamic"===l&&(m.suggestedPresentationDelay=h),n&&n.length>0&&(m.eventStream=n);let g=0===m.playlists.length,y=c.length?((e,t={},i=!1)=>{let s,r=e.reduce((e,r)=>{let n=r.attributes.role&&r.attributes.role.value||"",a=r.attributes.lang||"",o=r.attributes.label||"main";if(a&&!r.attributes.label){let e=n?` (${n})`:"";o=`${r.attributes.lang}${e}`}e[o]||(e[o]={language:a,autoselect:!0,default:"main"===n,playlists:[],uri:""});let l=eE((({attributes:e,segments:t,sidx:i,mediaSequence:s,discontinuitySequence:r,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:r,discontinuityStarts:n,timelineStarts:e.timelineStarts,mediaSequence:s,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})(r,i),t);return e[o].playlists.push(l),void 0===s&&"main"===n&&((s=r).default=!0),e},{});if(!s){let e=Object.keys(r)[0];r[e].default=!0}return r})(c,s,g):null,_=p.length?((e,t={})=>e.reduce((e,i)=>{let s=i.attributes.label||i.attributes.lang||"text",r=i.attributes.lang||"und";return e[s]||(e[s]={language:r,default:!1,autoselect:!1,playlists:[],uri:""}),e[s].playlists.push(eE((({attributes:e,segments:t,mediaSequence:i,discontinuityStarts:s,discontinuitySequence:r})=>{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:s,discontinuitySequence:r,mediaSequence:i,segments:t};return e.serviceLocation&&(a.attributes.serviceLocation=e.serviceLocation),a})(i),t)),e},{}))(p,s):null,b=u.concat(eD(y),eD(_));return m.timelineStarts=ev(b.map(({timelineStarts:e})=>e)),a=m.timelineStarts,b.forEach(e=>{e.mediaSequence=0,e.discontinuitySequence=a.findIndex(function({timeline:t}){return t===e.timeline}),e.segments&&e.segments.forEach((e,t)=>{e.number=t})}),y&&(m.mediaGroups.AUDIO.audio=y),_&&(m.mediaGroups.SUBTITLES.subs=_),(f.length&&(m.mediaGroups["CLOSED-CAPTIONS"].cc=f.reduce((e,t)=>(t&&t.forEach(t=>{let{channel:i,language:s}=t;e[s]={autoselect:!1,default:!1,instreamId:i,language:s},t.hasOwnProperty("aspectRatio")&&(e[s].aspectRatio=t.aspectRatio),t.hasOwnProperty("easyReader")&&(e[s].easyReader=t.easyReader),t.hasOwnProperty("3D")&&(e[s]["3D"]=t["3D"])}),e),{})),r)?(({oldManifest:e,newManifest:t})=>{let i=e.playlists.concat(eT(e)),s=t.playlists.concat(eT(t));return t.timelineStarts=ev([e.timelineStarts,t.timelineStarts]),(({oldPlaylists:e,newPlaylists:t,timelineStarts:i})=>{t.forEach(t=>{t.discontinuitySequence=i.findIndex(function({timeline:e}){return e===t.timeline});let s=((e,t)=>{for(let i=0;is.timeline||s.segments.length&&t.timeline>s.segments[s.segments.length-1].timeline)&&t.discontinuitySequence--;return}s.segments[n].discontinuity&&!r.discontinuity&&(r.discontinuity=!0,t.discontinuityStarts.unshift(0),t.discontinuitySequence--),eS({playlist:t,mediaSequence:s.segments[n].number})})})({oldPlaylists:i,newPlaylists:s,timelineStarts:t.timelineStarts}),t})({oldManifest:r,newManifest:m}):m})({dashPlaylists:i.representationInfo.map(eU),locations:i.locations,contentSteering:i.contentSteeringInfo,sidxMapping:t.sidxMapping,previousManifest:t.previousManifest,eventStream:i.eventStream})})(e,{manifestUri:t,clientOffset:i,sidxMapping:s,previousManifest:r});return ay(n,t,aY),n})({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:t})}catch(e){this.error=e,this.error.metadata={errorType:nN.Error.StreamingDashManifestParserError,error:e},this.trigger("error")}t&&(e=((e,t,i)=>{var s;let r=!0,n=nF(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=aP(n,e.playlists[0],aK);o&&(s in(n=o).mediaGroups[t][i]||(n.mediaGroups[t][i][s]=e),n.mediaGroups[t][i][s].playlists[0]=n.playlists[a],r=!1)}}),am(s=n,(e,i,r,n)=>{t.mediaGroups[i][r]&&n in t.mediaGroups[i][r]||delete s.mediaGroups[i][r][n]}),t.minimumUpdatePeriod!==e.minimumUpdatePeriod&&(r=!1),r)?null:n})(t,e,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=e||t;let s=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(s&&s!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=s),(!t||e&&e.minimumUpdatePeriod!==t.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(e),e){let{duration:t,endList:s}=e,r=[];e.playlists.forEach(e=>{r.push({id:e.id,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS})}),i.parsedManifest={duration:t,isLive:!s,renditions:r},this.trigger({type:"manifestparsecomplete",metadata:i})}return!!e}updateMinimumUpdatePeriodTimeout_(){let e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(g.default.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_=g.default.setTimeout(()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,t)=>{if(t){var i,s;let e;this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=(i=this.mainPlaylistLoader_.main,s=this.mainPlaylistLoader_.sidxMapping_,e=aJ(i.playlists,s),am(i,(t,i,r,n)=>{if(t.playlists&&t.playlists.length){let i=t.playlists;e=nF(e,aJ(i,s))}}),e),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=g.default.setTimeout(()=>{this.trigger("mediaupdatetimeout"),e()},aL(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 s=e.contentProtection[i].attributes["cenc:default_KID"];s&&t.add(s.replace(/-/g,"").toLowerCase())}return t}}}var a0={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};let a1=function(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e},a2=function(e){try{return URL.createObjectURL(new Blob([e],{type:"application/javascript"}))}catch(i){let t=new BlobBuilder;return t.append(e),URL.createObjectURL(t.getBlob())}},a4=function(e){return function(){let t=a2(e),i=a1(new Worker(t));i.objURL=t;let s=i.terminate;return i.on=i.addEventListener,i.off=i.removeEventListener,i.terminate=function(){return URL.revokeObjectURL(t),s.call(this)},i}},a5=function(e){return`var browserWorkerPolyFill = ${a1.toString()}; browserWorkerPolyFill(self); `+e},a8=function(e){return e.toString().replace(/^function.+?{/,"").slice(0,-1)};var a3=a4(a5(a8(function(){var t,i="u">typeof globalThis?globalThis:"u">typeof window?window:e.g,s=function(){this.init=function(){var e={};this.on=function(t,i){e[t]||(e[t]=[]),e[t]=e[t].concat(i)},this.off=function(t,i){var s;return!!e[t]&&(s=e[t].indexOf(i),e[t]=e[t].slice(),e[t].splice(s,1),s>-1)},this.trigger=function(t){var i,s,r,n;if(i=e[t])if(2==arguments.length)for(r=i.length,s=0;stypeof Uint8Array){for(eN in e1)e1.hasOwnProperty(eN)&&(e1[eN]=[eN.charCodeAt(0),eN.charCodeAt(1),eN.charCodeAt(2),eN.charCodeAt(3)]);e2=new Uint8Array([105,115,111,109]),e5=new Uint8Array([97,118,99,49]),e4=new Uint8Array([0,0,0,1]),e8={video:new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),audio:new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0])},e7=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e6=new Uint8Array([0,0,0,0,0,0,0,0]),te=e9=new Uint8Array([0,0,0,0,0,0,0,0]),tt=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),ti=e9,e3=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}eq=function(e){var t,i,s=[],r=0;for(t=1;t>>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),eq(e1.mdhd,t)},eG=function(e){var t;return eq(e1.mdia,eX(e),(t=e.type,eq(e1.hdlr,e8[t])),e$(e))},e$=function(e){return eq(e1.minf,"video"===e.type?eq(e1.vmhd,e3):eq(e1.smhd,e6),eq(e1.dinf,eq(e1.dref,e7)),eY(e))},eF=function(e){for(var t=e.length,i=[];t--;)i[t]=ez(e[t]);return eq.apply(null,[e1.moov,eH(0xffffffff)].concat(i).concat(eV(e)))},eV=function(e){for(var t=e.length,i=[];t--;)i[t]=eZ(e[t]);return eq.apply(null,[e1.mvex].concat(i))},eH=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(0xff000000&e)>>24,(0xff0000&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 eq(e1.mvhd,t)},eK=function(e){var t,i,s=e.samples||[],r=new Uint8Array(4+s.length);for(i=0;i>>8),n.push(255&s[t].byteLength),n=n.concat(Array.prototype.slice.call(s[t]));for(t=0;t>>8),a.push(255&r[t].byteLength),a=a.concat(Array.prototype.slice.call(r[t]));if(i=[e1.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]),eq(e1.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([s.length],n,[r.length],a))),eq(e1.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio){var o=e.sarRatio[0],l=e.sarRatio[1];i.push(eq(e1.pasp,new Uint8Array([(0xff000000&o)>>24,(0xff0000&o)>>16,(65280&o)>>8,255&o,(0xff000000&l)>>24,(0xff0000&l)>>16,(65280&l)>>8,255&l])))}return eq.apply(null,i)},eM=function(e){return eq(e1.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]),eq(e1.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,e.audioobjecttype<<3|e.samplingfrequencyindex>>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2])))},eW=function(e){var t=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(0xff000000&e.id)>>24,(0xff0000&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(0xff000000&e.duration)>>24,(0xff0000&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 eq(e1.tkhd,t)},eJ=function(e){var t,i,s,r,n,o;return(t=eq(e1.tfhd,new Uint8Array([0,0,0,58,(0xff000000&e.id)>>24,(0xff0000&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])),n=Math.floor(e.baseMediaDecodeTime/a),o=Math.floor(e.baseMediaDecodeTime%a),i=eq(e1.tfdt,new Uint8Array([1,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,o>>>24&255,o>>>16&255,o>>>8&255,255&o])),"audio"===e.type)?(s=e0(e,92),eq(e1.traf,t,i,s)):(r=eK(e),s=e0(e,r.length+92),eq(e1.traf,t,i,s,r))},ez=function(e){return e.duration=e.duration||0xffffffff,eq(e1.trak,eW(e),eG(e))},eZ=function(e){var t=new Uint8Array([0,0,0,0,(0xff000000&e.id)>>24,(0xff0000&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),eq(e1.trex,t)},eB=function(e,t){var i=0,s=0,r=0,n=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(s=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset&&(n=8)),[0,0,i|s|r|n,1,(0xff000000&e.length)>>>24,(0xff0000&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(0xff000000&t)>>>24,(0xff0000&t)>>>16,(65280&t)>>>8,255&t]},ej=function(e,t){var i,s,r,n,a,o;for(t+=20+16*(n=e.samples||[]).length,(s=new Uint8Array((r=eB(n,t)).length+16*n.length)).set(r),i=r.length,o=0;o>>24,s[i++]=(0xff0000&a.duration)>>>16,s[i++]=(65280&a.duration)>>>8,s[i++]=255&a.duration,s[i++]=(0xff000000&a.size)>>>24,s[i++]=(0xff0000&a.size)>>>16,s[i++]=(65280&a.size)>>>8,s[i++]=255&a.size,s[i++]=a.flags.isLeading<<2|a.flags.dependsOn,s[i++]=a.flags.isDependedOn<<6|a.flags.hasRedundancy<<4|a.flags.paddingValue<<1|a.flags.isNonSyncSample,s[i++]=61440&a.flags.degradationPriority,s[i++]=15&a.flags.degradationPriority,s[i++]=(0xff000000&a.compositionTimeOffset)>>>24,s[i++]=(0xff0000&a.compositionTimeOffset)>>>16,s[i++]=(65280&a.compositionTimeOffset)>>>8,s[i++]=255&a.compositionTimeOffset;return eq(e1.trun,s)},eU=function(e,t){var i,s,r,n,a,o;for(t+=20+8*(n=e.samples||[]).length,(i=new Uint8Array((r=eB(n,t)).length+8*n.length)).set(r),s=r.length,o=0;o>>24,i[s++]=(0xff0000&a.duration)>>>16,i[s++]=(65280&a.duration)>>>8,i[s++]=255&a.duration,i[s++]=(0xff000000&a.size)>>>24,i[s++]=(0xff0000&a.size)>>>16,i[s++]=(65280&a.size)>>>8,i[s++]=255&a.size;return eq(e1.trun,i)},e0=function(e,t){return"audio"===e.type?eU(e,t):ej(e,t)};var o=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},l=[33,16,5,32,164,27],h=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],d=function(e){for(var t=[];e--;)t.push(0);return t};tr=function(e){return 9e4*e},tn=function(e,t){return e*t},ta=function(e){return e/9e4},to=function(e,t){return e/t};var u=9e4,c=tr,p=ta,f=function(e,t){return tr(to(e,t))},m=function(e,t){return tn(ta(e),t)},g=function(e,t,i){return ta(i?e:e-t)},y=function(){if(!ts){var e;ts=Object.keys(e={96e3:[l,[227,64],d(154),[56]],88200:[l,[231],d(170),[56]],64e3:[l,[248,192],d(240),[56]],48e3:[l,[255,192],d(268),[55,148,128],d(54),[112]],44100:[l,[255,192],d(268),[55,163,128],d(84),[112]],32e3:[l,[255,192],d(268),[55,234],d(226),[112]],24e3:[l,[255,192],d(268),[55,255,128],d(268),[111,112],d(126),[224]],16e3:[l,[255,192],d(268),[55,255,128],d(268),[111,255],d(269),[223,108],d(195),[1,192]],12e3:[h,d(268),[3,127,248],d(268),[6,255,240],d(268),[13,255,224],d(268),[27,253,128],d(259),[56]],11025:[h,d(268),[3,127,248],d(268),[6,255,240],d(268),[13,255,224],d(268),[27,255,192],d(268),[55,175,128],d(108),[112]],8e3:[h,d(268),[3,121,16],d(47),[7]]}).reduce(function(t,i){return t[i]=new Uint8Array(e[i].reduce(function(e,t){return e.concat(t)},[])),t},{})}return ts},_=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--},I.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},I.prototype.addText=function(e){this.rows[this.rowIdx]+=e},I.prototype.backspace=function(){if(!this.isEmpty()){var e=this.rows[this.rowIdx];this.rows[this.rowIdx]=e.substr(0,e.length-1)}};var A=function(e,t,i){this.serviceNum=e,this.text="",this.currentWindow=new I(-1),this.windows=[],this.stream=i,"string"==typeof t&&this.createTextDecoder(t)};A.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new I(i),"function"==typeof t&&(this.windows[i].beforeRowOverflow=t)},A.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},A.prototype.createTextDecoder=function(e){if("u"{t=s[e],/^SERVICE/.test(e)&&(r[e]=t.encoding)}),this.serviceEncodings=r,this.current708Packet=null,this.services={},this.push=function(e){3===e.type?i.new708Packet():null===i.current708Packet&&i.new708Packet(),i.add708Bytes(e)}};D.prototype=new s,D.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},D.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)},D.prototype.push708Packet=function(){var e=this.current708Packet,t=e.data,i=null,s=null,r=0,n=t[r++];for(e.seq=n>>6,e.sizeCode=63&n;r>5,s=31&n,7===i&&s>0&&(i=n=t[r++]),this.pushServiceBlock(i,r,s),s>0&&(r+=s-1)},D.prototype.pushServiceBlock=function(e,t,i){var s,r=t,n=this.current708Packet.data,a=this.services[e];for(a||(a=this.initService(e,r));r("0"+(255&e).toString(16)).slice(-2)).join(""),16)):k(4096*!!n|l),d.pendingNewLine&&!d.isEmpty()&&d.newLine(this.getPts(e)),d.pendingNewLine=!1,d.addText(s),e},D.prototype.multiByteCharacter=function(e,t){var i=this.current708Packet.data,s=i[e+1],r=i[e+2];return C(s)&&C(r)&&(e=this.handleText(++e,t,{isMultiByte:!0})),e},D.prototype.setCurrentWindow=function(e,t){var i=this.current708Packet.data[e];return t.setCurrentWindow(7&i),e},D.prototype.defineWindow=function(e,t){var i=this.current708Packet.data,s=i[e],r=7&s;t.setCurrentWindow(r);var n=t.currentWindow;return n.visible=(32&(s=i[++e]))>>5,n.rowLock=(16&s)>>4,n.columnLock=(8&s)>>3,n.priority=7&s,n.relativePositioning=(128&(s=i[++e]))>>7,n.anchorVertical=127&s,n.anchorHorizontal=s=i[++e],n.anchorPoint=(240&(s=i[++e]))>>4,n.rowCount=15&s,n.columnCount=63&(s=i[++e]),n.windowStyle=(56&(s=i[++e]))>>3,n.penStyle=7&s,n.virtualRowCount=n.rowCount+1,e},D.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,s=i[e],r=t.currentWindow.winAttr;return r.fillOpacity=(192&(s=i[++e]))>>6,r.fillRed=(48&s)>>4,r.fillGreen=(12&s)>>2,r.fillBlue=3&s,r.borderType=(192&(s=i[++e]))>>6,r.borderRed=(48&s)>>4,r.borderGreen=(12&s)>>2,r.borderBlue=3&s,s=i[++e],r.borderType+=(128&s)>>5,r.wordWrap=(64&s)>>6,r.printDirection=(48&s)>>4,r.scrollDirection=(12&s)>>2,r.justify=3&s,r.effectSpeed=(240&(s=i[++e]))>>4,r.effectDirection=(12&s)>>2,r.displayEffect=3&s,e},D.prototype.flushDisplayed=function(e,t){for(var i=[],s=0;s<8;s++)t.windows[s].visible&&!t.windows[s].isEmpty()&&i.push(t.windows[s].getText());t.endPts=e,t.text=i.join("\n\n"),this.pushCaption(t),t.startPts=e},D.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)},D.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],s=this.getPts(e);this.flushDisplayed(s,t);for(var r=0;r<8;r++)i&1<>4,r.offset=(12&s)>>2,r.penSize=3&s,r.italics=(128&(s=i[++e]))>>7,r.underline=(64&s)>>6,r.edgeType=(56&s)>>3,r.fontStyle=7&s,e},D.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,s=i[e],r=t.currentWindow.penColor;return r.fgOpacity=(192&(s=i[++e]))>>6,r.fgRed=(48&s)>>4,r.fgGreen=(12&s)>>2,r.fgBlue=3&s,r.bgOpacity=(192&(s=i[++e]))>>6,r.bgRed=(48&s)>>4,r.bgGreen=(12&s)>>2,r.bgBlue=3&s,r.edgeRed=(48&(s=i[++e]))>>4,r.edgeGreen=(12&s)>>2,r.edgeBlue=3&s,e},D.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,s=i[e],r=t.currentWindow.penLoc;return t.currentWindow.pendingNewLine=!0,r.row=15&i[++e],r.column=63&i[++e],e},D.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)};var P={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},L=function(e){return null===e?"":String.fromCharCode(e=P[e]||e)},O=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],N=function(){for(var e=[],t=15;t--;)e.push({text:"",indent:0,offset:0});return e},R=function(e,t){R.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,s,r,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),s=t>>>8,r=255&t,t!==this.PADDING_)if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(t===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_].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_=N();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=N();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=N()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(s,r))n=L((s=(3&s)<<8)|r),this[this.mode_](e.pts,n),this.column_++;else if(this.isExtCharacter(s,r))"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=L((s=(3&s)<<8)|r),this[this.mode_](e.pts,n),this.column_++;else if(this.isMidRowCode(s,r))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,(14&r)==14&&this.addFormatting(e.pts,["i"]),(1&r)==1&&this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(s,r)){let e=3&r;this.nonDisplayed_[this.row_].offset=e,this.column_+=e}else if(this.isPAC(s,r)){var a=O.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&r&&-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(r)&&(14&r)==14&&this.addFormatting(e.pts,["i"])}else this.isNormalChar(s)&&(0===r&&(r=null),n=L(s)+L(r),this[this.mode_](e.pts,n),this.column_+=n.length)}};R.prototype=new s,R.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,s)=>{if(e&&e.text&&e.text.length){try{e.text=e.text.trim()}catch(e){t(s)}e.text.length&&i.push({text:e.text,line:s+1,position:10+Math.min(70,10*e.indent)+2.5*e.offset})}else null==e&&t(s)}),i.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,content:i,stream:this.name_})},R.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=N(),this.nonDisplayed_=N(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},R.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_},R.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},R.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},R.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},R.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},R.prototype.isPAC=function(e,t){return e>=this.BASE_&&e=64&&t<=127},R.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},R.prototype.isNormalChar=function(e){return e>=32&&e<=127},R.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=N(),this.displayed_=N()),void 0!==t&&t!==this.row_)for(var i=0;i"},"");this[this.mode_](e,i)},R.prototype.clearFormatting=function(e){if(this.formatting_.length){var t=this.formatting_.reverse().reduce(function(e,t){return e+""},"");this.formatting_=[],this[this.mode_](e,t)}},R.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_].text;i+=t,this.nonDisplayed_[this.row_].text=i},R.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_].text;i+=t,this.displayed_[this.row_].text=i},R.prototype.shiftRowsUp_=function(){var e;for(e=0;et&&(i=-1);Math.abs(t-e)>0x100000000;)e+=0x200000000*i;return e},F=function(e){var t,i;F.prototype.init.call(this),this.type_=e||q,this.push=function(e){"metadata"===e.type?this.trigger("data",e):(this.type_===q||e.type===this.type_)&&(void 0===i&&(i=e.dts),e.dts=$(e.dts,i),e.pts=$(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")}};F.prototype=new s;var V=(e,t,i)=>{if(!e)return -1;for(var s=i;s"===e.mimeType?e.url=W(e.data,s,e.data.length):e.pictureData=e.data.subarray(s,e.data.length)))},"T*":function(e){3===e.data[0]&&(e.value=z(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=V(e.data,0,1))&&(e.description=z(e.data,1,t),e.value=z(e.data,t+1,e.data.length).replace(/\0*$/,""),e.data=e.value)},"W*":function(e){e.url=W(e.data,0,e.data.length).replace(/\0.*$/,"")},WXXX:function(e){var t;3!==e.data[0]||-1!==(t=V(e.data,0,1))&&(e.description=z(e.data,1,t),e.url=W(e.data,t+1,e.data.length).replace(/\0.*$/,""))},PRIV:function(e){var t;for(t=0;t>>2;d*=4,o.timeStamp=d+=3&h[7],void 0===t.pts&&void 0===t.dts&&(t.pts=o.timeStamp,t.dts=o.timeStamp),this.trigger("timestamp",o)}t.frames.push(o),i+=10,i+=a}while(i>>4>1&&(s+=t[s]+1),0===i.pid)i.type="pat",e(t.subarray(s),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",e(t.subarray(s),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,s,i]):this.processPes_(t,s,i)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=B.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=B.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 s,td.STREAM_TYPES={h264:27,adts:15},(tu=function(){var e,t=this,i=!1,s={data:[],size:0},r={data:[],size:0},n={data:[],size:0},a=function(e,t){var i;let s=e[0]<<16|e[1]<<8|e[2];t.data=new Uint8Array,1===s&&(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,s){var r,n=new Uint8Array(e.size),o={type:i},l=0,h=0,d=!1;if(e.data.length&&!(e.size<9)){for(o.trackId=e.data[0].pid,l=0;l>5,h=(l=((3&t[d+6])+1)*1024)*et/ei[(60&t[d+2])>>>2],t.byteLength-d>>6&3)+1,channelcount:(1&t[d+2])<<2|(192&t[d+3])>>>6,samplerate:ei[(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 r&&(this.skipWarn_(r,d),r=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 s;var es=tc,er=function(e){var t=e.byteLength,i=0,s=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+s},this.loadWord=function(){var r=e.byteLength-t,n=new Uint8Array(4),a=Math.min(4,t);if(0===a)throw Error("no bytes available");n.set(e.subarray(r,r+a)),i=new DataView(n.buffer).getUint32(0),s=8*a,t-=a},this.skipBits=function(e){var r;s>e||(e-=s,r=Math.floor(e/8),e-=8*r,t-=r,this.loadWord()),i<<=e,s-=e},this.readBits=function(e){var r=Math.min(s,e),n=i>>>32-r;return((s-=r)>0?i<<=r:t>0&&this.loadWord(),(r=e-r)>0)?n<>>e)!=0)return i<<=e,s-=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()};(tf=function(){var e,t,i=0;tf.prototype.init.call(this),this.push=function(s){t?((r=new Uint8Array(t.byteLength+s.data.byteLength)).set(t),r.set(s.data,t.byteLength),t=r):t=s.data;for(var r,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 s,tm={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(tp=function(){var e,t,i,s,r,n,a,o=new tf;tp.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,i=e.pts,s=e.dts,o.push(e))},o.on("data",function(a){var o={trackId:t,pts:i,dts:s,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=r(a.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=r(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,s=8,r=8;for(i=0;i=0?i:0,(16&e[t+5])>>4)?i+20:i+10},el=function(e,t){return e.length-t<10||73!==e[t]||68!==e[t+1]||51!==e[t+2]?t:(t+=eo(e,t),el(e,t))},eh=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},ed=function(e,t,i){var s,r="";for(s=t;s=t+2&&(255&e[t])==255&&(240&e[t+1])==240&&(22&e[t+1])==16},parseId3TagSize:eo,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,s=e[t+4]<<3;return 6144&e[t+3]|s|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,s;t=10,64&e[5]&&(t+=4,t+=eh(e.subarray(10,14)));do{if((i=eh(e.subarray(t+4,t+8)))<1)break;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){s=e.subarray(t+10,t+i+10);for(var r=0;r>>2;return a*=4,a+=3&n[7]}break}}t+=10,t+=i}while(t=3;){if(73===e[o]&&68===e[o+1]&&51===e[o+2]){if(e.length-o<10||(a=eu.parseId3TagSize(e,o),o+a>e.length))break;s={type:"timed-metadata",data:e.subarray(o,o+a)},this.trigger("data",s),o+=a;continue}if((255&e[o])==255&&(240&e[o+1])==240){if(e.length-o<7||(a=eu.parseAdtsSize(e,o),o+a>e.length))break;r={type:"audio",data:e.subarray(o,o+a),pts:t,dts:t},this.trigger("data",r),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 s;var ec=tg,ep=function(e){return eq(e1.mdat,e)},ef=function(e,t){for(var i=[],s=t.length;s--;)i[s]=eJ(t[s]);return eq.apply(null,[e1.moof,eq(e1.mfhd,new Uint8Array([0,0,0,0,(0xff000000&e)>>24,(0xff0000&e)>>16,(65280&e)>>8,255&e]))].concat(i))},em=function(e){var t,i=eq(e1.ftyp,e2,e4,e2,e5),s=eF(e);return(t=new Uint8Array(i.byteLength+s.byteLength)).set(i),t.set(s,i.byteLength),t},eg=function(e){var t,i,s=[],r=[];for(r.byteLength=0,r.nalCount=0,r.duration=0,s.byteLength=0,t=0;t1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e},eb=function(e,t){var i,s,r,n,a=t||0,l=[];for(i=0;iu/2))){for((n=y()[e.samplerate])||(n=t[0].data),a=0;a=_?g:(y.minSegmentDts=1/0,g.filter(function(e){return e.dts>=_&&(y.minSegmentDts=Math.min(y.minSegmentDts,e.dts),y.minSegmentPts=y.minSegmentDts,!0)})),e.baseMediaDecodeTime=eE(e,t.keepOriginalTimestamps),m=eT(e,o,n,a),e.samples=eS(o),h=ep(ex(o)),s=[],d=new Uint8Array((l=ef(i,[e])).byteLength+h.byteLength),i++,d.set(l),d.set(h,l.byteLength),ew(e),c=Math.ceil(1024*u/e.samplerate),o.length&&(p=o.length*c,this.trigger("segmentTimingInfo",eO(f(e.baseMediaDecodeTime,e.samplerate),o[0].dts,o[0].pts,o[0].dts+p,o[0].pts+p,m||0)),this.trigger("timingInfo",{start:o[0].pts,end:o[0].pts+p})),this.trigger("data",{track:e,boxes:d})),this.trigger("done","AudioSegmentStream")},this.reset=function(){ew(e),s=[],this.trigger("reset")}}).prototype=new s,(ty=function(e,t){var i,s,r,n=[],a=[];i=(t=t||{}).firstSequenceNumber||0,ty.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(t){ek(e,t),"seq_parameter_set_rbsp"!==t.nalUnitType||s||(s=t.config,e.sps=[t.data],eA.forEach(function(t){e[t]=s[t]},this)),"pic_parameter_set_rbsp"!==t.nalUnitType||r||(r=t.data,e.pps=[t.data]),n.push(t)},this.flush=function(){for(var s,r,o,l,h,d,u,c,p=0;n.length&&"access_unit_delimiter_rbsp"!==n[0].nalUnitType;)n.shift();if(0===n.length){this.resetStream_(),this.trigger("done","VideoSegmentStream");return}if((o=ey(eg(n)))[0][0].keyFrame||((r=this.getGopForFusion_(n[0],e))?(p=r.duration,o.unshift(r),o.byteLength+=r.byteLength,o.nalCount+=r.nalCount,o.pts=r.pts,o.dts=r.dts,o.duration+=r.duration):o=e_(o)),a.length){if(!(s=t.alignGopsAtEnd?this.alignGopsAtEnd_(o):this.alignGopsAtStart_(o))){this.gopCache_.unshift({gop:o.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),n=[],this.resetStream_(),this.trigger("done","VideoSegmentStream");return}ew(e),o=s}ek(e,o),e.samples=eb(o),h=ep(ev(o)),e.baseMediaDecodeTime=eE(e,t.keepOriginalTimestamps),this.trigger("processedGopsInfo",o.map(function(e){return{pts:e.pts,dts:e.dts,byteLength:e.byteLength}})),u=o[0],c=o[o.length-1],this.trigger("segmentTimingInfo",eO(e.baseMediaDecodeTime,u.dts,u.pts,c.dts+c.duration,c.pts+c.duration,p)),this.trigger("timingInfo",{start:o[0].pts,end:o[o.length-1].pts+o[o.length-1].duration}),this.gopCache_.unshift({gop:o.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),d=new Uint8Array((l=ef(i,[e])).byteLength+h.byteLength),i++,d.set(l),d.set(h,l.byteLength),this.trigger("data",{track:e,boxes:d}),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(){ew(e),s=void 0,r=void 0},this.getGopForFusion_=function(t){var i,s,r,n,a,o=1/0;for(a=0;a=-1e4&&i<=45e3&&(!s||o>i)&&(s=n,o=i);return s?s.gop:null},this.alignGopsAtStart_=function(e){var t,i,s,r,n,o,l,h;for(n=e.byteLength,o=e.nalCount,l=e.duration,t=i=0;ts.pts){t++;continue}i++,n-=r.byteLength,o-=r.nalCount,l-=r.duration}return 0===i?e:i===e.length?null:((h=e.slice(i)).byteLength=n,h.duration=l,h.nalCount=o,h.pts=h[0].pts,h.dts=h[0].dts,h)},this.alignGopsAtEnd_=function(e){for(t=a.length-1,i=e.length-1,n=null,o=!1;t>=0&&i>=0;){if(s=a[t],r=e[i],s.pts===r.pts){o=!0;break}if(s.pts>r.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,s,r,n,o,l,h=e.slice(l),d=h.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 h.byteLength=d.byteLength,h.duration=d.duration,h.nalCount=d.nalCount,h.pts=h[0].pts,h.dts=h[0].dts,h},this.alignGopsWith=function(e){a=e}}).prototype=new s,(tv=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,tv.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 s,tv.prototype.flush=function(e){var t,i,s,r,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,eA.forEach(function(e){a.info[e]=this.videoTrack[e]},this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,eI.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,a.initSegment=new Uint8Array((s=em(this.pendingTracks)).byteLength),a.initSegment.set(s),a.data=new Uint8Array(this.pendingBytes),r=0;r=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},tv.prototype.setRemux=function(e){this.remuxTracks=e},(tb=function(e){var t,i,s=this,r=!0;tb.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="aac",r.metadataStream=new Z.MetadataStream,r.aacStream=new ec,r.audioTimestampRolloverStream=new Z.TimestampRolloverStream("audio"),r.timedMetadataTimestampRolloverStream=new Z.TimestampRolloverStream("timed-metadata"),r.adtsStream=new es,r.coalesceStream=new tv(e,r.metadataStream),r.headOfPipeline=r.aacStream,r.aacStream.pipe(r.audioTimestampRolloverStream).pipe(r.adtsStream),r.aacStream.pipe(r.timedMetadataTimestampRolloverStream).pipe(r.metadataStream).pipe(r.coalesceStream),r.metadataStream.on("timestamp",function(e){r.aacStream.setTimestamp(e.timeStamp)}),r.aacStream.on("data",function(n){"timed-metadata"!==n.type&&"audio"!==n.type||r.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:s.baseMediaDecodeTime},codec:"adts",type:"audio"},r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new t_(i,e),r.audioSegmentStream.on("log",s.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",s.trigger.bind(s,"audioTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream),s.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t}))}),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),eP(this,r)},this.setupTsPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="ts",r.metadataStream=new Z.MetadataStream,r.packetStream=new Z.TransportPacketStream,r.parseStream=new Z.TransportParseStream,r.elementaryStream=new Z.ElementaryStream,r.timestampRolloverStream=new Z.TimestampRolloverStream,r.adtsStream=new es,r.h264Stream=new en,r.captionStream=new Z.CaptionStream(e),r.coalesceStream=new tv(e,r.metadataStream),r.headOfPipeline=r.packetStream,r.packetStream.pipe(r.parseStream).pipe(r.elementaryStream).pipe(r.timestampRolloverStream),r.timestampRolloverStream.pipe(r.h264Stream),r.timestampRolloverStream.pipe(r.adtsStream),r.timestampRolloverStream.pipe(r.metadataStream).pipe(r.coalesceStream),r.h264Stream.pipe(r.captionStream).pipe(r.coalesceStream),r.elementaryStream.on("data",function(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=s.baseMediaDecodeTime):(t=n.tracks[a]).timelineStartInfo.baseMediaDecodeTime=s.baseMediaDecodeTime;t&&!r.videoSegmentStream&&(r.coalesceStream.numberOfTracks++,r.videoSegmentStream=new ty(t,e),r.videoSegmentStream.on("log",s.getLogTrigger_("videoSegmentStream")),r.videoSegmentStream.on("timelineStartInfo",function(t){i&&!e.keepOriginalTimestamps&&(i.timelineStartInfo=t,r.audioSegmentStream.setEarliestDts(t.dts-s.baseMediaDecodeTime))}),r.videoSegmentStream.on("processedGopsInfo",s.trigger.bind(s,"gopInfo")),r.videoSegmentStream.on("segmentTimingInfo",s.trigger.bind(s,"videoSegmentTimingInfo")),r.videoSegmentStream.on("baseMediaDecodeTime",function(e){i&&r.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}),r.videoSegmentStream.on("timingInfo",s.trigger.bind(s,"videoTimingInfo")),r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)),i&&!r.audioSegmentStream&&(r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new t_(i,e),r.audioSegmentStream.on("log",s.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",s.trigger.bind(s,"audioTimingInfo")),r.audioSegmentStream.on("segmentTimingInfo",s.trigger.bind(s,"audioSegmentTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream)),s.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t})}}),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("id3Frame",function(e){e.dispatchType=r.metadataStream.dispatchType,s.trigger("id3Frame",e)}),r.coalesceStream.on("caption",this.trigger.bind(this,"caption")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),eP(this,r)},this.setBaseMediaDecodeTime=function(s){var r=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=s),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,ew(i),r.audioTimestampRolloverStream&&r.audioTimestampRolloverStream.discontinuity()),t&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,ew(t),r.captionStream.reset()),r.timestampRolloverStream&&r.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(t){var i=this.transmuxPipeline_;e.remux=t,i&&i.coalesceStream&&i.coalesceStream.setRemux(t)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(e){var t=this;return function(i){i.stream=e,t.trigger("log",i)}},this.push=function(e){if(r){var t=eC(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),r=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){r=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new s;var eN,eR,eM,eU,ej,eB,eq,e$,eF,eV,eH,ez,eW,eG,eX,eK,eY,eQ,eJ,eZ,e0,e1,e2,e4,e5,e8,e3,e6,e7,e9,te,tt,ti,ts,tr,tn,ta,to,tl,th,td,tu,tc,tp,tf,tm,tg,ty,t_,tb,tv,tT,tS,tx=tb,tw=function(e){return e>>>0},tE=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),t+=String.fromCharCode(e[2]),t+=String.fromCharCode(e[3])},tk=function(e,t){var i,s,r,n,a,o=[];if(!t.length)return null;for(i=0;i1?i+s:e.byteLength,r===t[0]&&(1===t.length?o.push(e.subarray(i+8,n)):(a=tk(e.subarray(i+8,n),t.slice(1))).length&&(o=o.concat(a))),i=n;return o},tC=function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4))};return 1===t.version?t.baseMediaDecodeTime=r(e.subarray(4)):t.baseMediaDecodeTime=tw(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),t},tI=function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),s={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:i.getUint32(4)},r=1&s.flags[2],n=2&s.flags[2],a=8&s.flags[2],o=16&s.flags[2],l=32&s.flags[2],h=65536&s.flags[0],d=131072&s.flags[0];return t=8,r&&(t+=4,s.baseDataOffset=i.getUint32(12),t+=4),n&&(s.sampleDescriptionIndex=i.getUint32(t),t+=4),a&&(s.defaultSampleDuration=i.getUint32(t),t+=4),o&&(s.defaultSampleSize=i.getUint32(t),t+=4),l&&(s.defaultSampleFlags=i.getUint32(t)),h&&(s.durationIsEmpty=!0),!r&&d&&(s.baseDataOffsetIsMoof=!0),s},tA=r,tD=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]}},tP=function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},s=new DataView(e.buffer,e.byteOffset,e.byteLength),r=1&i.flags[2],n=4&i.flags[2],a=1&i.flags[1],o=2&i.flags[1],l=4&i.flags[1],h=8&i.flags[1],d=s.getUint32(4),u=8;for(r&&(i.dataOffset=s.getInt32(u),u+=4),n&&d&&(t={flags:tD(e.subarray(u,u+4))},u+=4,a&&(t.duration=s.getUint32(u),u+=4),o&&(t.size=s.getUint32(u),u+=4),h&&(1===i.version?t.compositionTimeOffset=s.getInt32(u):t.compositionTimeOffset=s.getUint32(u),u+=4),i.samples.push(t),d--);d--;)t={},a&&(t.duration=s.getUint32(u),u+=4),o&&(t.size=s.getUint32(u),u+=4),l&&(t.flags=tD(e.subarray(u,u+4)),u+=4),h&&(1===i.version?t.compositionTimeOffset=s.getInt32(u):t.compositionTimeOffset=s.getUint32(u),u+=4),i.samples.push(t);return i},tL=r,tO=function(e){return new Date(1e3*e-20828448e5)},tN=function(e){var t,i,s=new DataView(e.buffer,e.byteOffset,e.byteLength),r=[];for(t=0;t+4MALFORMED DATA");continue}switch(31&e[t]){case 1:r.push("slice_layer_without_partitioning_rbsp");break;case 5:r.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:r.push("sei_rbsp");break;case 7:r.push("seq_parameter_set_rbsp");break;case 8:r.push("pic_parameter_set_rbsp");break;case 9:r.push("access_unit_delimiter_rbsp");break;default:r.push("UNKNOWN NAL - "+e[t]&31)}}return r},tR={avc1:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{dataReferenceIndex:t.getUint16(6),width:t.getUint16(24),height:t.getUint16(26),horizresolution:t.getUint16(28)+t.getUint16(30)/16,vertresolution:t.getUint16(32)+t.getUint16(34)/16,frameCount:t.getUint16(40),depth:t.getUint16(74),config:tT(e.subarray(78,e.byteLength))}},avcC:function(e){var t,i,s,r,n=new DataView(e.buffer,e.byteOffset,e.byteLength),a={configurationVersion:e[0],avcProfileIndication:e[1],profileCompatibility:e[2],avcLevelIndication:e[3],lengthSizeMinusOne:3&e[4],sps:[],pps:[]},o=31&e[5];for(r=0,s=6;r>>2&63,bufferSize:e[13]<<16|e[14]<<8|e[15],maxBitrate:e[16]<<24|e[17]<<16|e[18]<<8|e[19],avgBitrate:e[20]<<24|e[21]<<16|e[22]<<8|e[23],decoderConfigDescriptor:{tag:e[24],length:e[25],audioObjectType:e[26]>>>3&31,samplingFrequencyIndex:(7&e[26])<<1|e[27]>>>7&1,channelConfiguration:e[27]>>>3&15}}}},ftyp:function(e){for(var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={majorBrand:tE(e.subarray(0,4)),minorVersion:t.getUint32(4),compatibleBrands:[]},s=8;s>10)+96),r.language+=String.fromCharCode(((992&t)>>5)+96),r.language+=String.fromCharCode((31&t)+96),r},mdia:function(e){return{boxes:tT(e)}},mfhd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),sequenceNumber:e[4]<<24|e[5]<<16|e[6]<<8|e[7]}},minf:function(e){return{boxes:tT(e)}},mp4a:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={dataReferenceIndex:t.getUint16(6),channelcount:t.getUint16(16),samplesize:t.getUint16(18),samplerate:t.getUint16(24)+t.getUint16(26)/65536};return e.byteLength>28&&(i.streamDescriptor=tT(e.subarray(28))[0]),i},moof:function(e){return{boxes:tT(e)}},moov:function(e){return{boxes:tT(e)}},mvex:function(e){return{boxes:tT(e)}},mvhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=4,s={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4))};return 1===s.version?(i+=4,s.creationTime=tO(t.getUint32(i)),i+=8,s.modificationTime=tO(t.getUint32(i)),i+=4,s.timescale=t.getUint32(i),i+=8):(s.creationTime=tO(t.getUint32(i)),i+=4,s.modificationTime=tO(t.getUint32(i)),i+=4,s.timescale=t.getUint32(i),i+=4),s.duration=t.getUint32(i),i+=4,s.rate=t.getUint16(i)+t.getUint16(i+2)/16,i+=4,s.volume=t.getUint8(i)+t.getUint8(i+1)/8,i+=12,s.matrix=new Uint32Array(e.subarray(i,i+36)),i+=60,s.nextTrackId=t.getUint32(i),s},pdin:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),rate:t.getUint32(4),initialDelay:t.getUint32(8)}},sdtp:function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]};for(t=4;t>4,isDependedOn:(12&e[t])>>2,hasRedundancy:3&e[t]});return i},sidx:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:t.getUint32(4),timescale:t.getUint32(8)},s=12;0===i.version?(i.earliestPresentationTime=t.getUint32(s),i.firstOffset=t.getUint32(s+4),s+=8):(i.earliestPresentationTime=tA(e.subarray(s)),i.firstOffset=tA(e.subarray(s+8)),s+=16),s+=2;var r=t.getUint16(s);for(s+=2;r>0;s+=12,r--)i.references.push({referenceType:(128&e[s])>>>7,referencedSize:0x7fffffff&t.getUint32(s),subsegmentDuration:t.getUint32(s+4),startsWithSap:!!(128&e[s+8]),sapType:(112&e[s+8])>>>4,sapDeltaTime:0xfffffff&t.getUint32(s+8)});return i},smhd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),balance:e[4]+e[5]/256}},stbl:function(e){return{boxes:tT(e)}},ctts:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),s={version:i.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),compositionOffsets:[]},r=i.getUint32(4);for(t=8;r;t+=8,r--)s.compositionOffsets.push({sampleCount:i.getUint32(t),sampleOffset:i[0===s.version?"getUint32":"getInt32"](t+4)});return s},stss:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),s={version:i.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),syncSamples:[]},r=i.getUint32(4);for(t=8;r;t+=4,r--)s.syncSamples.push(i.getUint32(t));return s},stco:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),s={version:e[0],flags:new Uint8Array(e.subarray(1,4)),chunkOffsets:[]},r=i.getUint32(4);for(t=8;r;t+=4,r--)s.chunkOffsets.push(i.getUint32(t));return s},stsc:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),s=i.getUint32(4),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleToChunks:[]};for(t=8;s;t+=12,s--)r.sampleToChunks.push({firstChunk:i.getUint32(t),samplesPerChunk:i.getUint32(t+4),sampleDescriptionIndex:i.getUint32(t+8)});return r},stsd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleDescriptions:tT(e.subarray(8))}},stsz:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),s={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleSize:i.getUint32(4),entries:[]};for(t=12;t>6,sampleHasRedundancy:(48&e[21])>>4,samplePaddingValue:(14&e[21])>>1,sampleIsDifferenceSample:!!(1&e[21]),sampleDegradationPriority:t.getUint16(22)}},trun:tP,"url ":function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4))}},vmhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),graphicsmode:t.getUint16(4),opcolor:new Uint16Array([t.getUint16(6),t.getUint16(8),t.getUint16(10)])}}},tM={inspect:tT=function(e){for(var t,i,s,r,n,a=0,o=[],l=new ArrayBuffer(e.length),h=new Uint8Array(l),d=0;d1?a+i:e.byteLength,(n=(tR[s]||function(e){return{data:e}})(e.subarray(a+8,r))).size=i,n.type=s,o.push(n),a=r;return o},textify:tS=function(e,t){var i;return i=Array(2*(t=t||0)+1).join(" "),e.map(function(e,s){return i+e.type+"\n"+Object.keys(e).filter(function(e){return"type"!==e&&"boxes"!==e}).map(function(t){var s=i+" "+t+": ",r=e[t];if(r instanceof Uint8Array||r instanceof Uint32Array){var n=Array.prototype.slice.call(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)).map(function(e){return" "+("00"+e.toString(16)).slice(-2)}).join("").match(/.{1,24}/g);return n?1===n.length?s+"<"+n.join("").slice(1)+">":s+"<\n"+n.map(function(e){return i+" "+e}).join("\n")+"\n"+i+" >":s+"<>"}return s+JSON.stringify(r,null,2).split("\n").map(function(e,t){return 0===t?e:i+" "+e}).join("\n")}).join("\n")+(e.boxes?"\n"+tS(e.boxes,t+1):"")}).join("\n")},parseType:tE,findBox:tk,parseTraf:tR.traf,parseTfdt:tR.tfdt,parseHdlr:tR.hdlr,parseTfhd:tR.tfhd,parseTrun:tR.trun,parseSidx:tR.sidx},tU=function(e){for(var t=0,i=String.fromCharCode(e[0]),s="";"\0"!==i;)s+=i,i=String.fromCharCode(e[++t]);return s+i},tj=function(e,t){var i="\0"!==t.scheme_id_uri,s=0===e&&tB(t.presentation_time_delta)&&i,r=1===e&&tB(t.presentation_time)&&i;return!(e>1)&&s||r},tB=function(e){return void 0!==e||null!==e},tq="u">typeof window?window:void 0!==i?i:"u">typeof self?self:{},t$=function(e){return("00"+e.toString(16)).slice(-2)},tF=function(e){var t,i,s,n,a,o,l,h=4,d=e[0];if(0===d){t=tU(e.subarray(h)),h+=t.length,i=tU(e.subarray(h)),h+=i.length;var u=new DataView(e.buffer);s=u.getUint32(h),h+=4,a=u.getUint32(h),h+=4,o=u.getUint32(h),h+=4,l=u.getUint32(h),h+=4}else if(1===d){var u=new DataView(e.buffer);s=u.getUint32(h),h+=4,n=r(e.subarray(h)),h+=8,o=u.getUint32(h),h+=4,l=u.getUint32(h),h+=4,t=tU(e.subarray(h)),h+=t.length,i=tU(e.subarray(h)),h+=i.length}var c={scheme_id_uri:t,value:i,timescale:s||1,presentation_time:n,presentation_time_delta:a,event_duration:o,id:l,message_data:new Uint8Array(e.subarray(h,e.byteLength))};return tj(d,c)?c:void 0},tV=function(e,t,i,s){return e||0===e?e/t:s+i/t},tH={findBox:tk,parseType:tE,timescale:function(e){return tk(e,["moov","trak"]).reduce(function(e,t){var i,s,r,n;return(i=tk(t,["tkhd"])[0])&&(s=0===i[0]?12:20,r=tw(i[s]<<24|i[s+1]<<16|i[s+2]<<8|i[s+3]),n=tk(t,["mdia","mdhd"])[0])?(s=0===n[0]?12:20,e[r]=tw(n[s]<<24|n[s+1]<<16|n[s+2]<<8|n[s+3]),e):null},{})},startTime:function(e,t){var i=tk(t,["moof","traf"]).reduce(function(t,i){let s;var n,a=tk(i,["tfhd"])[0],o=e[tw(a[4]<<24|a[5]<<16|a[6]<<8|a[7])]||9e4,l=tk(i,["tfdt"])[0],h=new DataView(l.buffer,l.byteOffset,l.byteLength);return"bigint"==typeof(n=1===l[0]?r(l.subarray(4,12)):h.getUint32(4))?s=n/tq.BigInt(o):"number"!=typeof n||isNaN(n)||(s=n/o),s11?(i.codec+=".",i.codec+=t$(h[9]),i.codec+=t$(h[10]),i.codec+=t$(h[11])):i.codec="avc1.4d400d":/^mp4[a,v]$/i.test(i.codec)?"esds"===tE((h=u.subarray(28)).subarray(4,8))&&h.length>20&&0!==h[19]?(i.codec+="."+t$(h[19]),i.codec+="."+t$(h[20]>>>2&63).replace(/^0/,"")):i.codec="mp4a.40.2":i.codec=i.codec.toLowerCase())}var c=tk(e,["mdia","mdhd"])[0];c&&(i.timescale=t(c)),s.push(i)}),s},getTimescaleFromMediaHeader:t=function(e){var t=0===e[0]?12:20;return tw(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])},getEmsgID3:function(e,t=0){return tk(e,["emsg"]).map(e=>{var i=tF(new Uint8Array(e)),s=K(i.message_data);return{cueTime:tV(i.presentation_time,i.timescale,i.presentation_time_delta,t),duration:tV(i.event_duration,i.timescale),frames:s}})}};let{parseTrun:tz}=tM,{findBox:tW}=tH;var tG={getMdatTrafPairs:function(e){var t=tW(e,["moof","traf"]),i=tW(e,["mdat"]),s=[];return i.forEach(function(e,i){var r=t[i];s.push({mdat:e,traf:r})}),s},parseSamples:function(e,t,i){var s=t,r=i.defaultSampleDuration||0,n=i.defaultSampleSize||0,a=i.trackId,o=[];return e.forEach(function(e){var t=tz(e).samples;t.forEach(function(e){void 0===e.duration&&(e.duration=r),void 0===e.size&&(e.size=n),e.trackId=a,e.dts=s,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),"bigint"==typeof s?(e.pts=s+tq.BigInt(e.compositionTimeOffset),s+=tq.BigInt(e.duration)):(e.pts=s+e.compositionTimeOffset,s+=e.duration)}),o=o.concat(t)}),o}},tX=S,{getMdatTrafPairs:tK,parseSamples:tY}=tG,tQ=function(e,t){for(var i=e,s=0;s0?tC(l[0]).baseMediaDecodeTime:0,d=tk(n,["trun"]);t===o&&d.length>0&&(s=tJ(r,tY(d,h,a),o),i[o]||(i[o]={seiNals:[],logs:[]}),i[o].seiNals=i[o].seiNals.concat(s.seiNals),i[o].logs=i[o].logs.concat(s.logs))}),i},t0=function(e,t,i){if(null===t)return null;var s=tZ(e,t)[t]||{};return{seiNals:s.seiNals,logs:s.logs,timescale:i}},t1=function(){var e,t,i,s,r,n,a=!1;this.isInitialized=function(){return a},this.init=function(t){e=new M,a=!0,n=!!t&&t.isPartial,e.on("data",function(e){e.startTime=e.startPts/s,e.endTime=e.endPts/s,r.captions.push(e),r.captionStreams[e.stream]=!0}),e.on("log",function(e){r.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]||s!==t[i])},this.parse=function(e,n,a){var o;if(!this.isInitialized()||!n||!a)return null;if(this.isNewInit(n,a))s=a[i=n[0]];else if(null===i||!s)return t.push(e),null;for(;t.length>0;){var l=t.shift();this.parse(l,n,a)}return((o=t0(e,i,s))&&o.logs&&(r.logs=r.logs.concat(o.logs)),null!==o&&o.seiNals)?(this.pushNals(o.seiNals),this.flushStream(),r):r.logs.length?{logs:r.logs,captions:[],captionStreams:[]}:null},this.pushNals=function(t){if(!this.isInitialized()||!t||0===t.length)return null;t.forEach(function(t){e.push(t)})},this.flushStream=function(){if(!this.isInitialized())return null;n?e.partialFlush():e.flush()},this.clearParsedCaptions=function(){r.captions=[],r.captionStreams={},r.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],i=null,s=null,r?this.clearParsedCaptions():r={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()};let{parseTfdt:t2}=tM,{getTimescaleFromMediaHeader:t4}=tH,{parseSamples:t5,getMdatTrafPairs:t8}=tG;var t3=function(){let e=9e4;this.init=function(t){let i=tk(t,["moov","trak","mdia","mdhd"])[0];i&&(e=t4(i))},this.parseSegment=function(t){let i=[],s=t8(t),r=0;return s.forEach(function(t){let s=t.mdat,n=t.traf,a=tk(n,["tfdt"])[0],o=tk(n,["tfhd"])[0],l=tk(n,["trun"]);if(a&&(r=t2(a).baseMediaDecodeTime),l.length&&o){let t=t5(l,r,o),n=0;t.forEach(function(t){let r=new TextDecoder("utf-8"),a=s.slice(n,n+t.size);if(tk(a,["vtte"])[0]){n+=t.size;return}tk(a,["vttc"]).forEach(function(s){let n,a,o=tk(s,["payl"])[0],l=tk(s,["sttg"])[0],h=t.pts/e,d=(t.pts+t.duration)/e;if(o)try{n=r.decode(o)}catch(e){console.error(e)}if(l)try{a=r.decode(l)}catch(e){console.error(e)}t.duration&&n&&i.push({cueText:n,start:h,end:d,settings:a})}),n+=t.size})}}),i}},t6=function(e){var t=31&e[1];return t<<=8,t|=e[2]},t7=function(e){return!!(64&e[1])},t9=function(e){var t=0;return(48&e[3])>>>4>1&&(t+=e[4]+1),t},ie=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}},it={};it.ts={parseType:function(e,t){var i=t6(e);return 0===i?"pat":i===t?"pmt":t?"pes":null},parsePat:function(e){var t=t7(e),i=4+t9(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t,i={},s=t7(e),r=4+t9(e);if(s&&(r+=e[r]+1),1&e[r+5]){t=3+((15&e[r+1])<<8|e[r+2])-4;for(var n=12+((15&e[r+10])<<8|e[r+11]);n=e.byteLength)return null;var s=null;return 192&(t=e[i+7])&&((s={}).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,s.pts*=4,s.pts+=(6&e[i+13])>>>1,s.dts=s.pts,64&t&&(s.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,s.dts*=4,s.dts+=(6&e[i+18])>>>1)),s},videoPacketContainsKeyFrame:function(e){for(var t,i=4+t9(e),s=e.subarray(i),r=0,n=0,a=!1;n3&&"slice_layer_without_partitioning_rbsp_idr"===ie(31&s[n+3])&&(a=!0),a}},it.aac=eu;var ii=u,is=function(e,t){for(var i,s=0,r=188;r=0;){if(71===e[l]&&(71===e[h]||h===e.byteLength)){if(s=e.subarray(l,h),"pes"===it.ts.parseType(s,t.pid)&&(n=it.ts.parsePesType(s,t.table),a=it.ts.parsePayloadUnitStartIndicator(s),"audio"===n&&a&&(o=it.ts.parsePesTime(s))&&(o.type="audio",i.audio.push(o),d=!0)),d)break;l-=188,h-=188;continue}l--,h--}},ia=function(e,t,i){for(var s,r,n,a,o,l,h,d,u=0,c=188,p=!1,f={data:[],size:0};c=0;){if(71===e[u]&&71===e[c]){if(s=e.subarray(u,c),"pes"===it.ts.parseType(s,t.pid)&&(n=it.ts.parsePesType(s,t.table),a=it.ts.parsePayloadUnitStartIndicator(s),"video"===n&&a&&(o=it.ts.parsePesTime(s))&&(o.type="video",i.video.push(o),p=!0)),p)break;u-=188,c-=188;continue}u--,c--}},io=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=$(e.dts,i),e.pts=$(e.pts,i),e.dtsTime=e.dts/ii,e.ptsTime=e.pts/ii})}if(e.video&&e.video.length){var s=t;if((void 0===s||isNaN(s))&&(s=e.video[0].dts),e.video.forEach(function(e){e.dts=$(e.dts,s),e.pts=$(e.pts,s),e.dtsTime=e.dts/ii,e.ptsTime=e.pts/ii}),e.firstKeyFrame){var r=e.firstKeyFrame;r.dts=$(r.dts,s),r.pts=$(r.pts,s),r.dtsTime=r.dts/ii,r.ptsTime=r.pts/ii}}},il=function(e){for(var t,i=!1,s=0,r=null,n=null,a=0,o=0;e.length-o>=3;){switch(it.aac.parseType(e,o)){case"timed-metadata":if(e.length-o<10||(a=it.aac.parseId3TagSize(e,o))>e.length){i=!0;break}null===n&&(t=e.subarray(o,o+a),n=it.aac.parseAacTimestamp(t)),o+=a;break;case"audio":if(e.length-o<7||(a=it.aac.parseAdtsSize(e,o))>e.length){i=!0;break}null===r&&(t=e.subarray(o,o+a),r=it.aac.parseSampleRate(t)),s++,o+=a;break;default:o++}if(i)return null}if(null===r||null===n)return null;var l=ii/r;return{audio:[{type:"audio",dts:n,pts:n},{type:"audio",dts:n+1024*s*l,pts:n+1024*s*l}]}},ih=function(e){var t={pid:null,table:null},i={};for(var s in is(e,t),t.table)if(t.table.hasOwnProperty(s))switch(t.table[s]){case B.H264_STREAM_TYPE:i.video=[],ia(e,t,i),0===i.video.length&&delete i.video;break;case B.ADTS_STREAM_TYPE:i.audio=[],ir(e,t,i),0===i.audio.length&&delete i.audio}return i},id=function(e,t){var i;return(i=it.aac.isLikelyAacData(e)?il(e):ih(e))&&(i.audio||i.video)?(io(i,t),i):null};let iu=function(e,t){t.on("data",function(t){let i=t.initSegment;t.initSegment={data:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength};let s=t.data;t.data=s.buffer,e.postMessage({action:"data",segment:t,byteOffset:s.byteOffset,byteLength:s.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:p(t.start.dts),presentation:p(t.start.pts)},end:{decode:p(t.end.dts),presentation:p(t.end.pts)},baseMediaDecodeTime:p(t.baseMediaDecodeTime)};t.prependedContentDuration&&(i.prependedContentDuration=p(t.prependedContentDuration)),e.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:i})}),t.on("audioSegmentTimingInfo",function(t){let i={start:{decode:p(t.start.dts),presentation:p(t.start.pts)},end:{decode:p(t.end.dts),presentation:p(t.end.pts)},baseMediaDecodeTime:p(t.baseMediaDecodeTime)};t.prependedContentDuration&&(i.prependedContentDuration=p(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:p(t.start),end:p(t.end)}})}),t.on("videoTimingInfo",function(t){e.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:p(t.start),end:p(t.end)}})}),t.on("log",function(t){e.postMessage({action:"log",log:t})})};class ic{constructor(e,t){this.options=t||{},this.self=e,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new tx(this.options),iu(this.self,this.transmuxer)}pushMp4Captions(e){this.captionParser||(this.captionParser=new t1,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])}initMp4WebVttParser(e){this.webVttParser||(this.webVttParser=new t3);let t=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.webVttParser.init(t)}getMp4WebVttText(e){this.webVttParser||(this.webVttParser=new t3);let t=new Uint8Array(e.data,e.byteOffset,e.byteLength),i=this.webVttParser.parseSegment(t);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:i||[],data:t.buffer},[t.buffer])}probeMp4StartTime({timescales:e,data:t}){let i=tH.startTime(e,t);this.self.postMessage({action:"probeMp4StartTime",startTime:i,data:t},[t.buffer])}probeMp4Tracks({data:e}){let t=tH.tracks(e);this.self.postMessage({action:"probeMp4Tracks",tracks:t,data:e},[e.buffer])}probeEmsgID3({data:e,offset:t}){let i=tH.getEmsgID3(e,t);this.self.postMessage({action:"probeEmsgID3",id3Frames:i,emsgData:e},[e.buffer])}probeTs({data:e,baseStartTime:t}){let i=id(e,"number"!=typeof t||isNaN(t)?void 0:t*u),s=null;i&&((s={hasVideo:i.video&&2===i.video.length||!1,hasAudio:i.audio&&2===i.audio.length||!1}).hasVideo&&(s.videoStart=i.video[0].ptsTime),s.hasAudio&&(s.audioStart=i.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:s,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(c(t)))}setAudioAppendStart(e){this.transmuxer.setAudioAppendStart(Math.ceil(c(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 ic(self,e.data.options);return}this.messageHandlers||(this.messageHandlers=new ic(self)),e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data)}})));let a6=e=>{let{transmuxer:t,bytes:i,audioAppendStart:s,gopsToAlignWith:r,remux:n,onData:a,onTrackInfo:o,onAudioTimingInfo:l,onVideoTimingInfo:h,onVideoSegmentTimingInfo:d,onAudioSegmentTimingInfo:u,onId3:c,onCaptions:p,onDone:f,onEndedTimeline:m,onTransmuxerLog:g,isEndOfTimeline:y,segment:_,triggerSegmentEventFn:b}=e,v={buffer:[]},T=y;if(t.onmessage=i=>{t.currentTransmux===e&&("data"===i.data.action&&((e,t,i)=>{let{type:s,initSegment:r,captions:n,captionStreams:a,metadata:o,videoFrameDtsTime:l,videoFramePtsTime:h}=e.data.segment;t.buffer.push({captions:n,captionStreams:a,metadata:o});let d=e.data.segment.boxes||{data:e.data.segment.data},u={type:s,data:new Uint8Array(d.data,d.data.byteOffset,d.data.byteLength),initSegment:new Uint8Array(r.data,r.byteOffset,r.byteLength)};void 0!==l&&(u.videoFrameDtsTime=l),void 0!==h&&(u.videoFramePtsTime=h),i(u)})(i,v,a),"trackinfo"===i.data.action&&o(i.data.trackInfo),"gopInfo"===i.data.action&&(v.gopInfo=i.data.gopInfo),"audioTimingInfo"===i.data.action&&l(i.data.audioTimingInfo),"videoTimingInfo"===i.data.action&&h(i.data.videoTimingInfo),"videoSegmentTimingInfo"===i.data.action&&d(i.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===i.data.action&&u(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&&(T=!1,m()),"log"===i.data.action&&g(i.data.log),"transmuxed"!==i.data.type||T||(t.onmessage=null,(({transmuxedData:e,callback:t})=>{e.buffer=[],t(e)})({transmuxedData:v,callback:f}),a7(t)))},t.onerror=()=>{f(null,{message:"Received an error message from the transmuxer worker",metadata:{errorType:nN.Error.StreamingFailedToTransmuxSegment,segmentInfo:oR({segment:_})}})},s&&t.postMessage({action:"setAudioAppendStart",appendStart:s}),Array.isArray(r)&&t.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),void 0!==n&&t.postMessage({action:"setRemux",remux:n}),i.byteLength){let e=i instanceof ArrayBuffer?i:i.buffer,s=i instanceof ArrayBuffer?0:i.byteOffset;b({type:"segmenttransmuxingstart",segment:_}),t.postMessage({action:"push",data:e,byteOffset:s,byteLength:i.byteLength},[e])}y&&t.postMessage({action:"endTimeline"}),t.postMessage({action:"flush"})},a7=e=>{e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():a6(e.currentTransmux))},a9=(e,t)=>{e.postMessage({action:t}),a7(e)};var oe=e=>{((e,t)=>{if(!t.currentTransmux){t.currentTransmux=e,a9(t,e);return}t.transmuxQueue.push(a9.bind(null,t,e))})("reset",e)};let ot=function(e){let t=e.transmuxer,i=e.endAction||e.action,s=e.callback,r=v({},e,{endAction:null,transmuxer:null,callback:null}),n=r=>{r.data.action===i&&(t.removeEventListener("message",n),r.data.data&&(r.data.data=new Uint8Array(r.data.data,e.byteOffset||0,e.byteLength||r.data.data.byteLength),e.data&&(e.data=r.data.data)),s(r.data))};if(t.addEventListener("message",n),e.data){let i=e.data instanceof ArrayBuffer;r.byteOffset=i?0:e.data.byteOffset,r.byteLength=e.data.byteLength;let s=[i?e.data:e.data.buffer];t.postMessage(r,s)}else t.postMessage(r)},oi="wvtt",os=e=>{e.forEach(e=>{e.abort()})},or=(e,t)=>{let{requestType:i}=t,s=ab({requestType:i,request:t,error:e});return t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:-101,xhr:t,metadata:s}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:-102,xhr:t,metadata:s}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:2,xhr:t,metadata:s}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:2,xhr:t,metadata:s}:null},on=(e,t,i,s)=>(r,n)=>{let a=n.response,o=or(r,n);if(o)return i(o,e);if(16!==a.byteLength)return i({status:n.status,message:"Invalid HLS key at URL: "+n.uri,code:2,xhr:n},e);let l=new DataView(a),h=new Uint32Array([l.getUint32(0),l.getUint32(4),l.getUint32(8),l.getUint32(12)]);for(let e=0;e{let i=to(e.map.bytes);if("mp4"!==i){let s=e.map.resolvedUri||e.map.uri,r=i||"unknown";return t({internal:!0,message:`Found unsupported ${r} container for initialization segment at URL: ${s}`,code:2,metadata:{mediaType:r}})}ot({action:"probeMp4Tracks",data:e.map.bytes,transmuxer:e.transmuxer,callback:({tracks:i,data:s})=>(e.map.bytes=s,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),"text"===t.type&&t.codec===oi&&e.transmuxer.postMessage({action:"initMp4WebVttParser",data:e.map.bytes}))}),t(null))})},oo=({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})=>{let f=new Uint8Array(t);if(e1(f,["moof"]).length>0){e.isFmp4=!0;let{tracks:r}=e.map;if(r.text&&(!r.audio||!r.video)){var m;d(e,{data:f,type:"text"}),m=r.text.codec,m===oi&&ot({action:"getMp4WebVttText",data:e.bytes,transmuxer:e.transmuxer,callback:({data:t,mp4VttCues:i})=>{e.bytes=t,u(null,e,{mp4VttCues:i})}});return}let n={isFmp4:!0,hasVideo:!!r.video,hasAudio:!!r.audio};r.audio&&r.audio.codec&&"enca"!==r.audio.codec&&(n.audioCodec=r.audio.codec),r.video&&r.video.codec&&"encv"!==r.video.codec&&(n.videoCodec=r.video.codec),r.video&&r.audio&&(n.isMuxed=!0),i(e,n);let l=(t,i)=>{d(e,{data:f,type:n.hasAudio&&!n.isMuxed?"audio":"video"}),i&&i.length&&a(e,i),t&&t.length&&o(e,t),u(null,e,{})};ot({action:"probeMp4StartTime",timescales:e.map.timescales,data:f,transmuxer:e.transmuxer,callback:({data:i,startTime:a})=>{t=i.buffer,e.bytes=f=i,n.hasAudio&&!n.isMuxed&&s(e,"audio","start",a),n.hasVideo&&s(e,"video","start",a),ot({action:"probeEmsgID3",data:f,transmuxer:e.transmuxer,offset:a,callback:({emsgData:i,id3Frames:s})=>{(t=i.buffer,e.bytes=f=i,r.video&&i.byteLength&&e.transmuxer)?ot({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:e.transmuxer,data:f,timescales:e.map.timescales,trackIds:[r.video.id],callback:i=>{t=i.data.buffer,e.bytes=f=i.data,i.logs.forEach(function(e){c(nF(e,{stream:"mp4CaptionParser"}))}),l(i.captions,s)}}):l(void 0,s)}})}});return}if(!e.transmuxer)return void u(null,e,{});if(void 0===e.container&&(e.container=to(f)),"ts"!==e.container&&"aac"!==e.container){i(e,{hasAudio:!1,hasVideo:!1}),u(null,e,{});return}(({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})=>{let f=e.map&&e.map.tracks||{},m=!!(f.audio&&f.video),g=s.bind(null,e,"audio","start"),y=s.bind(null,e,"audio","end"),_=s.bind(null,e,"video","start"),b=s.bind(null,e,"video","end");ot({action:"probeTs",transmuxer:e.transmuxer,data:t,baseStartTime:e.baseStartTime,callback:s=>{e.bytes=t=s.data;let f=s.result;f&&(i(e,{hasAudio:f.hasAudio,hasVideo:f.hasVideo,isMuxed:m}),i=null),(e=>{if(!e.transmuxer.currentTransmux){e.transmuxer.currentTransmux=e,a6(e);return}e.transmuxer.transmuxQueue.push(e)})({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),y&&void 0!==e.end&&y(e.end)},onVideoTimingInfo:e=>{_&&void 0!==e.start&&(_(e.start),_=null),b&&void 0!==e.end&&b(e.end)},onVideoSegmentTimingInfo:t=>{p({type:"segmenttransmuxingtiminginfoavailable",segment:e,timingInfo:{pts:{start:t.start.presentation,end:t.end.presentation},dts:{start:t.start.decode,end:t.end.decode}}}),r(t)},onAudioSegmentTimingInfo:t=>{p({type:"segmenttransmuxingtiminginfoavailable",segment:e,timingInfo:{pts:{start:t.start.pts,end:t.end.pts},dts:{start:t.start.dts,end:t.end.dts}}}),n(t)},onId3:(t,i)=>{a(e,t,i)},onCaptions:t=>{o(e,[t])},isEndOfTimeline:l,onEndedTimeline:()=>{h()},onTransmuxerLog:c,onDone:(t,i)=>{u&&(t.type="combined"===t.type?"video":t.type,p({type:"segmenttransmuxingcomplete",segment:e}),u(i,e,t))},segment:e,triggerSegmentEventFn:p})}})})({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})},ol=function({id:e,key:t,encryptedBytes:i,decryptionWorker:s,segment:r,doneFn:n},a){let o,l=t=>{if(t.data.source===e){s.removeEventListener("message",l);let e=t.data.decrypted;a(new Uint8Array(e.bytes,e.byteOffset,e.byteLength))}};s.onerror=()=>{let e="An error occurred in the decryption worker",t=oR({segment:r});n({message:e,metadata:{error:Error(e),errorType:nN.Error.StreamingFailedToDecryptSegment,segmentInfo:t,keyInfo:{uri:r.key.resolvedUri||r.map.key.resolvedUri}}},r)},s.addEventListener("message",l),o=t.bytes.slice?t.bytes.slice():new Uint32Array(Array.prototype.slice.call(t.bytes)),s.postMessage(a$({source:e,encrypted:i,key:o,iv:t.iv}),[i.buffer,o.buffer])},oh=n$("PlaylistSelector"),od=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||""})},ou=function(e,t){if(!e)return"";let i=g.default.getComputedStyle(e);return i?i[t]:""},oc=function(e,t){let i=e.slice();e.sort(function(e,s){let r=t(e,s);return 0===r?i.indexOf(e)-i.indexOf(s):r})},op=function(e,t){let i,s;return e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||g.default.Number.MAX_VALUE,t.attributes.BANDWIDTH&&(s=t.attributes.BANDWIDTH),i-(s=s||g.default.Number.MAX_VALUE)},of=function(e){let t,i,s,r,{main:n,bandwidth:a,playerWidth:o,playerHeight:l,playerObjectFit:h,limitRenditionByPlayerDimensions:d,playlistController:u}=e;if(!n)return;let c={bandwidth:a,width:o,height:l,limitRenditionByPlayerDimensions:d},p=n.playlists;au.isAudioOnly(n)&&(p=u.getAudioTrackPlaylists_(),c.audioOnly=!0);let f=p.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||g.default.Number.MAX_VALUE,width:t,height:i,playlist:e}});oc(f,(e,t)=>e.bandwidth-t.bandwidth);let m=(f=f.filter(e=>!au.isIncompatible(e.playlist))).filter(e=>au.isEnabled(e.playlist));m.length||(m=f.filter(e=>!au.isDisabled(e.playlist)));let y=m.filter(e=>e.bandwidth*a0.BANDWIDTH_VARIANCEe.bandwidth===_.bandwidth)[0];if(!1===d){let e=b||m[0]||f[0];if(e&&e.playlist){let t="sortedPlaylistReps";return b&&(t="bandwidthBestRep"),m[0]&&(t="enabledPlaylistReps"),oh(`choosing ${od(e)} using ${t} with options`,c),e.playlist}return oh("could not choose a playlist with options",c),null}let v=y.filter(e=>e.width&&e.height);oc(v,(e,t)=>e.width-t.width);let T=v.filter(e=>e.width===o&&e.height===l);_=T[T.length-1];let S=T.filter(e=>e.bandwidth===_.bandwidth)[0];if(S||(_=(i=(t=v.filter(e=>"cover"===h?e.width>o&&e.height>l:e.width>o||e.height>l)).filter(e=>e.width===t[0].width&&e.height===t[0].height))[i.length-1],s=i.filter(e=>e.bandwidth===_.bandwidth)[0]),u.leastPixelDiffSelector){let e=v.map(e=>(e.pixelDiff=Math.abs(e.width-o)+Math.abs(e.height-l),e));oc(e,(e,t)=>e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff),r=e[0]}let x=r||s||S||b||m[0]||f[0];if(x&&x.playlist){let e="sortedPlaylistReps";return r?e="leastPixelDiffRep":s?e="resolutionPlusOneRep":S?e="resolutionBestRep":b?e="bandwidthBestRep":m[0]&&(e="enabledPlaylistReps"),oh(`choosing ${od(x)} using ${e} with options`,c),x.playlist}return oh("could not choose a playlist with options",c),null},om=function(){let e=this.useDevicePixelRatio&&g.default.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(e=this.customPixelRatio),of({main:this.playlists.main,bandwidth:this.systemBandwidth,playerWidth:parseInt(ou(this.tech_.el(),"width"),10)*e,playerHeight:parseInt(ou(this.tech_.el(),"height"),10)*e,playerObjectFit:this.usePlayerObjectFit?ou(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})},og=function(e){let{main:t,currentTime:i,bandwidth:s,duration:r,segmentDuration:n,timeUntilRebuffer:a,currentTimeline:o,syncController:l}=e,h=t.playlists.filter(e=>!au.isIncompatible(e)),d=h.filter(au.isEnabled);d.length||(d=h.filter(e=>!au.isDisabled(e)));let u=d.filter(au.hasAttribute.bind(null,"BANDWIDTH")).map(e=>{let t=l.getSyncPoint(e,r,o,i),h=au.estimateSegmentRequestTime(n,s,e);return{playlist:e,rebufferingImpact:h*(t?1:2)-a}}),c=u.filter(e=>e.rebufferingImpact<=0);return(oc(c,(e,t)=>op(t.playlist,e.playlist)),c.length)?c[0]:(oc(u,(e,t)=>e.rebufferingImpact-t.rebufferingImpact),u[0]||null)};function oy(e){try{return new URL(e).pathname.split("/").slice(-2).join("/")}catch(e){return""}}let o_=function(e,t,i){if(!e[i]){t.trigger({type:"usage",name:"vhs-608"});let s=i;/^cc708_/.test(i)&&(s="SERVICE"+i.split("_")[1]);let r=t.textTracks().getTrackById(s);if(r)e[i]=r;else{let r=t.options_.vhs&&t.options_.vhs.captionServices||{},n=i,a=i,o=!1,l=r[s];l&&(n=l.label,a=l.language,o=l.default),e[i]=t.addRemoteTextTrack({kind:"captions",id:s,default:o,label:n,language:a},!1).track}}},ob=function({inbandTextTracks:e,captionArray:t,timestampOffset:i}){if(!t)return;let s=g.default.WebKitDataCue||g.default.VTTCue;t.forEach(t=>{let r=t.stream;t.content?t.content.forEach(n=>{let a=new s(t.startTime+i,t.endTime+i,n.text);a.line=n.line,a.align="left",a.position=n.position,a.positionAlign="line-left",e[r].addCue(a)}):e[r].addCue(new s(t.startTime+i,t.endTime+i,t.text))})},ov=function(e){Object.defineProperties(e.frame,{id:{get:()=>(nN.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key)},value:{get:()=>(nN.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data)},privateData:{get:()=>(nN.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data)}})},oT={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"},oS=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),ox=(e,t,i)=>{!e.metadataTrack_&&(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,nN.browser.IS_ANY_SAFARI||(e.metadataTrack_.inBandMetadataTrackDispatchType=t))},ow=function(e,t,i){let s,r;if(i&&i.cues)for(s=i.cues.length;s--;)(r=i.cues[s]).startTime>=e&&r.endTime<=t&&i.removeCue(r)},oE=function(e){let t=e.cues;if(!t)return;let i={};for(let s=t.length-1;s>=0;s--){let r=t[s],n=`${r.startTime}-${r.endTime}-${r.text}`;i[n]?e.removeCue(r):i[n]=r}},ok=function(e,t){if(!e&&!t||!e&&t||e&&!t)return!1;if(e===t)return!0;let i=Object.keys(e).sort(),s=Object.keys(t).sort();if(i.length!==s.length)return!1;for(let r=0;ri))return n}return 0===s.length?0:s[s.length-1]},oI=e=>"number"==typeof e&&isFinite(e),oA=1/60,oD=e=>{let{startOfSegment:t,duration:i,segment:s,part:r,playlist:{mediaSequence:n,id:a,segments:o=[]},mediaIndex:l,partIndex:h,timeline:d}=e,u=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 h,f=e.segment.uri?"segment":"pre-segment",m=p?n8({preloadSegment:s})-1:0;return`${f} [${n+l}/${n+u}]`+(p?` part [${h}/${m}]`:"")+` segment start/end [${s.start} => ${s.end}]`+(p?` part start/end [${r.start} => ${r.end}]`:"")+` startOfSegment [${t}]`+` duration [${i}]`+` timeline [${d}]`+` selected by [${c}]`+` playlist [${a}]`},oP=e=>`${e}TimingInfo`,oL=({timelineChangeController:e,currentTimeline:t,segmentTimeline:i,loaderType:s,audioDisabled:r})=>{if(t===i)return!1;if("audio"===s){let t=e.lastTimelineChange({type:"main"});return!t||t.to!==i}if("main"===s&&r){let t=e.pendingTimelineChange({type:"audio"});return!t||t.to!==i}return!1},oO=e=>{let t=e.pendingSegment_;if(t&&oL({timelineChangeController:e.timelineChangeController_,currentTimeline:e.currentTimeline_,segmentTimeline:t.timeline,loaderType:e.loaderType_,audioDisabled:e.audioDisabled_})&&(e=>{if(!e)return!1;let t=e.pendingTimelineChange({type:"audio"}),i=e.pendingTimelineChange({type:"main"}),s=t&&i,r=s&&t.to!==i.to;return!!s&&-1!==t.from&&-1!==i.from&&!!r})(e.timelineChangeController_)){let t,i;if(t=e.timelineChangeController_.pendingTimelineChange({type:"audio"}),i=e.timelineChangeController_.pendingTimelineChange({type:"main"}),t&&i&&t.to!!e&&Math.round(e)>t+nH,oR=({type:e,segment:t})=>{if(!t)return;let i=!!(t.key||t.map&&t.map.ke),s=!!(t.map&&!t.map.bytes),r=void 0===t.startOfSegment?t.start:t.startOfSegment;return{type:e||t.type,uri:t.resolvedUri||t.uri,start:r,duration:t.duration,isEncrypted:i,isMediaInitialization:s}};class oM extends nN.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=0/0,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_=n$(`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_():oO(this)}),this.sourceUpdater_.on("codecschange",e=>{this.trigger(v({type:"codecschange"},e))}),"main"===this.loaderType_&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():oO(this)}),"audio"===this.loaderType_&&this.timelineChangeController_.on("timelinechange",e=>{this.trigger(v({type:"timelinechange"},e)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():oO(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():oO(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){var e;let t,i;return e={remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_},(t=new a3).currentTransmux=null,t.transmuxQueue=[],i=t.terminate,t.terminate=()=>(t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)),t.postMessage({action:"init",options:e}),t}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_&&g.default.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),this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);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,g.default.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_&&oe(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){let e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return nV();if("main"===this.loaderType_){let{hasAudio:t,hasVideo:i,isMuxed:s}=e;if(i&&t&&!this.audioDisabled_&&!s)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;let i=aF(e),s=this.initSegments_[i];return t&&!s&&e.bytes&&(this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),s||e}segmentKey(e,t=!1){if(!e)return null;let i=aV(e),s=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!s&&e.bytes&&(this.keyCache_[i]=s={resolvedUri:e.resolvedUri,bytes:e.bytes});let r={resolvedUri:(s||e).resolvedUri};return s&&(r.bytes=s.bytes),r}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||this.playlist_&&this.playlist_.endList&&e.endList&&this.playlist_.uri===e.uri)return;let i=this.playlist_,s=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 r=null;if(i&&(i.id?r=i.id:i.uri&&(r=i.uri)),this.logger_(`playlist update [${r} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update: currentTime: ${this.currentTime_()} bufferedEnd: ${n0(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}}s&&(s.mediaIndex-=n,s.mediaIndex<0?(s.mediaIndex=null,s.partIndex=null):(s.mediaIndex>=0&&(s.segment=e.segments[s.mediaIndex]),s.partIndex>=0&&s.segment.parts&&(s.part=s.segment.parts[s.partIndex]))),this.syncController_.saveExpiredSegmentInfo(i,e)}pause(){this.checkBufferTimeout_&&(g.default.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_&&oe(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=()=>{},s=!1){if(1/0===t&&(t=this.duration_()),t<=e)return void this.logger_("skipping remove because end ${end} is <= start ${start}");if(!this.sourceUpdater_||!this.getMediaInfo_())return void this.logger_("skipping remove because no source updater or starting media info");let r=1,n=()=>{0==--r&&i()};for(let i in(s||!this.audioDisabled_)&&(r++,this.sourceUpdater_.removeAudio(e,t,n)),(s||"main"===this.loaderType_)&&(this.gopBuffer_=((e,t,i,s)=>{let r=Math.ceil((t-s)*tl.ONE_SECOND_IN_TS),n=Math.ceil((i-s)*tl.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<=r););return l=Math.max(l,0),a.splice(l,o-l+1),a})(this.gopBuffer_,e,t,this.timeMapping_),r++,this.sourceUpdater_.removeVideo(e,t,n)),this.inbandTextTracks_)ow(e,t,this.inbandTextTracks_[i]);ow(e,t,this.segmentMetadataTrack_),n()}monitorBuffer_(){this.checkBufferTimeout_&&g.default.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=g.default.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&g.default.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=g.default.setTimeout(this.monitorBufferTick_.bind(this),500)}fillBuffer_(){if(this.sourceUpdater_.updating())return;let e=this.chooseNextRequest_();if(!e)return;let t={segmentInfo:oR({type:this.loaderType_,segment:e})};this.trigger({type:"segmentselected",metadata:t}),"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 s="number"==typeof e&&t.segments[e],r=e+1===t.segments.length,n=!s||!s.parts||i+1===s.parts.length;return t.endList&&"open"===this.mediaSource_.readyState&&r&&n}chooseNextRequest_(){let e=this.buffered_(),t=n0(e)||0,i=n1(e,this.currentTime_()),s=!this.hasPlayed_()&&i>=1,r=i>=this.goalBufferLength_(),n=this.playlist_.segments;if(!n.length||s||r)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=oC(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,s,r=this.fetchAtBuffer_?t:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch: For TargetTime: ${r}. CurrentTime: ${this.currentTime_()} BufferedEnd: ${t} Fetch At Buffer: ${this.fetchAtBuffer_} `,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){let t=this.getSyncInfoFromMediaSequenceSync_(r);if(!t){let e="No sync info found while using media sequence sync";return this.error({message:e,metadata:{errorType:nN.Error.StreamingFailedToSelectNextSegment,error:Error(e)}}),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,s=t.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");let t=au.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:r,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});e=t.segmentIndex,i=t.partIndex,s=t.startTime}a.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${r}`:`currentTime ${r}`,a.mediaIndex=e,a.startOfSegment=s,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 h=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!i&&l&&!h&&!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 s=this.mediaSequenceSync_.getSyncInfoForTime(i.end);return s?(s.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),s):null}generateSegmentInfo_(e){let{independent:t,playlist:i,mediaIndex:s,startOfSegment:r,isSyncRequest:n,partIndex:a,forceTimestampOffset:o,getMediaInfoForTime:l}=e,h=i.segments[s],d="number"==typeof a&&h.parts[a],u={requestId:"segment-loader-"+Math.random(),uri:d&&d.resolvedUri||h.resolvedUri,mediaIndex:s,partIndex:d?a:null,isSyncRequest:n,startOfSegment:r,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:h.timeline,duration:d&&d.duration||h.duration,segment:h,part:d,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:l,independent:t},c=void 0!==o?o:this.isPendingTimestampOffset_;u.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:h.timeline,currentTimeline:this.currentTimeline_,startOfSegment:r,buffered:this.buffered_(),overrideCheck:c});let p=n0(this.sourceUpdater_.audioBuffered());return"number"==typeof p&&(u.audioAppendStart=p-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(u.gopsToAlignWith=((e,t,i)=>{let s;if(null==t||!e.length)return[];let r=Math.ceil((t-i+3)*tl.ONE_SECOND_IN_TS);for(s=0;sr);s++);return e.slice(s)})(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),u}timestampOffsetForSegment_(e){return(({segmentTimeline:e,currentTimeline:t,startOfSegment:i,buffered:s,overrideCheck:r})=>r||e!==t?e{s[e.stream]=s[e.stream]||{startTime:1/0,captions:[],endTime:0};let t=s[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(s).forEach(e=>{let{startTime:t,endTime:r,captions:n}=s[e],a=this.inbandTextTracks_;this.logger_(`adding cues from ${t} -> ${r} for ${e}`),o_(a,this.vhs_.tech_,e),ow(t,r,a[e]),ob({captionArray:n,inbandTextTracks:a,timestampOffset:i})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,i){this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||(this.pendingSegment_.hasAppendedData_?this.addMetadataToTextTrack(i,t,this.duration_()):this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i)))}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_()||!oL({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:s,isMuxed:r}=t;return!(s&&!e.videoTimingInfo||i&&!this.audioDisabled_&&!r&&!e.audioTimingInfo||oL({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_()){oO(this),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[oP(t.type)].start;else{let e,t=this.getCurrentMediaInfo_(),s="main"===this.loaderType_&&t&&t.hasVideo;s&&(e=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:s,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)return void this.logger_("sync segment was incorrect, not appending");this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,t)}}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:s}){if(i){let e=aF(i);if(this.activeInitSegmentId_===e)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=e}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=s,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i},s){let r=this.sourceUpdater_.audioBuffered(),n=this.sourceUpdater_.videoBuffered();r.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+nJ(r).join(", ")),n.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+nJ(n).join(", "));let a=r.length?r.start(0):0,o=r.length?r.end(r.length-1):0,l=n.length?n.start(0):0,h=n.length?n.end(n.length-1):0;if(o-a<=1&&h-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: ${nJ(r).join(", ")}, video buffer: ${nJ(n).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),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_=g.default.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},s){if(s){if(22===s.code)return void this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i});this.logger_("Received non QUOTA_EXCEEDED_ERR on append",s),this.error({message:`${t} append of ${i.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:nN.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:s,bytes:r}){if(!r){var n;let e,t,a=[s],o=s.byteLength;i&&(a.unshift(i),o+=i.byteLength),t=0,(n={bytes:o,segments:a}).bytes&&(e=new Uint8Array(n.bytes),n.segments.forEach(i=>{e.set(i,t),t+=i.byteLength})),r=e}let a={segmentInfo:oR({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:a}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:r},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:r}))}handleSegmentTimingInfo_(e,t,i){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;let s=this.pendingSegment_.segment,r=`${e}TimingInfo`;s[r]||(s[r]={}),s[r].transmuxerPrependedSeconds=i.prependedContentDuration||0,s[r].transmuxedPresentationStart=i.start.presentation,s[r].transmuxedDecodeStart=i.start.decode,s[r].transmuxedPresentationEnd=i.end.presentation,s[r].transmuxedDecodeEnd=i.end.decode,s[r].baseMediaDecodeTime=i.baseMediaDecodeTime}appendData_(e,t){let{type:i,data:s}=t;if(!s||!s.byteLength||"audio"===i&&this.audioDisabled_)return;let r=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:r,data:s})}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_()){oO(this),this.loadQueue_.push(()=>{let t=v({},e,{forceTimestampOffset:!0});v(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),s=null!==this.mediaIndex,r=e.timeline!==this.currentTimeline_&&e.timeline>0;this.logger_(`Requesting ${oy(e.uri)} ${oD(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=(({xhr:e,xhrOptions:t,decryptionWorker:i,segment:s,abortFn:r,progressFn:n,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:h,id3Fn:d,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:p,dataFn:f,doneFn:m,onTransmuxerLog:g,triggerSegmentEventFn:y})=>{let _=[],b=(({activeXhrs:e,decryptionWorker:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})=>{let f=0,m=!1;return(g,y)=>{if(!m){if(g)return m=!0,os(e),u(g,y);if((f+=1)===e.length){let f=function(){if(y.encryptedBytes)return(({decryptionWorker:e,segment:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})=>{p({type:"segmentdecryptionstart"}),ol({id:t.requestId,key:t.key,encryptedBytes:t.encryptedBytes,decryptionWorker:e,segment:t,doneFn:u},e=>{t.bytes=e,p({type:"segmentdecryptioncomplete",segment:t}),oo({segment:t,bytes:t.bytes,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})})})({decryptionWorker:t,segment:y,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p});oo({segment:y,bytes:y.bytes,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})};if(y.endOfAllRequests=Date.now(),y.map&&y.map.encryptedBytes&&!y.map.bytes)return p({type:"segmentdecryptionstart",segment:y}),ol({decryptionWorker:t,id:y.requestId+"-init",encryptedBytes:y.map.encryptedBytes,key:y.map.key,segment:y,doneFn:u},t=>{y.map.bytes=t,p({type:"segmentdecryptioncomplete",segment:y}),oa(y,t=>{if(t)return os(e),u(t,y);f()})});f()}}}})({activeXhrs:_,decryptionWorker:i,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:h,id3Fn:d,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:p,dataFn:f,doneFn:m,onTransmuxerLog:g,triggerSegmentEventFn:y});if(s.key&&!s.key.bytes){let i=[s.key];s.map&&!s.map.bytes&&s.map.key&&s.map.key.resolvedUri===s.key.resolvedUri&&i.push(s.map.key);let r=nF(t,{uri:s.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),n=on(s,i,b,y),a={uri:s.key.resolvedUri};y({type:"segmentkeyloadstart",segment:s,keyInfo:a});let o=e(r,n);_.push(o)}if(s.map&&!s.map.bytes){if(s.map.key&&(!s.key||s.key.resolvedUri!==s.map.key.resolvedUri)){let i=nF(t,{uri:s.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),r=on(s,[s.map.key],b,y),n={uri:s.map.key.resolvedUri};y({type:"segmentkeyloadstart",segment:s,keyInfo:n});let a=e(i,r);_.push(a)}let i=nF(t,{uri:s.map.resolvedUri,responseType:"arraybuffer",headers:aj(s.map),requestType:"segment-media-initialization"}),r=(({segment:e,finishProcessingFn:t,triggerSegmentEventFn:i})=>(s,r)=>{let n=or(s,r);if(n)return t(n,e);let a=new Uint8Array(r.response);if(i({type:"segmentloaded",segment:e}),e.map.key)return e.map.encryptedBytes=a,t(null,e);e.map.bytes=a,oa(e,function(i){if(i)return i.xhr=r,i.status=r.status,t(i,e);t(null,e)})})({segment:s,finishProcessingFn:b,triggerSegmentEventFn:y});y({type:"segmentloadstart",segment:s});let n=e(i,r);_.push(n)}let v=nF(t,{uri:s.part&&s.part.resolvedUri||s.resolvedUri,responseType:"arraybuffer",headers:aj(s),requestType:"segment"}),T=(({segment:e,finishProcessingFn:t,responseType:i,triggerSegmentEventFn:s})=>(r,n)=>{let a=or(r,n);if(a)return t(a,e);s({type:"segmentloaded",segment:e});let o="arraybuffer"!==i&&n.responseText?(e=>{let t=new Uint8Array(new ArrayBuffer(e.length));for(let i=0;ii=>{if(!i.target.aborted){let s,r;return e.stats=nF(e.stats,(s=i.target,(r={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-s.requestTime||0}).bytesReceived=i.loaded,r.bandwidth=Math.floor(r.bytesReceived/r.roundTripTime*8e3),r)),!e.stats.firstBytesReceivedAt&&e.stats.bytesReceived&&(e.stats.firstBytesReceivedAt=Date.now()),t(i,e)}})({segment:s,progressFn:n,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:h,id3Fn:d,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:p,dataFn:f})),_.push(S);let x={};return _.forEach(e=>{e.addEventListener("loadend",(({loadendState:e,abortFn:t})=>i=>{i.target.aborted&&t&&!e.calledAbortFn&&(t(),e.calledAbortFn=!0)})({loadendState:x,abortFn:r}))}),()=>os(_)})({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||s&&r,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:s})=>{this.logger_(`${oD(e)} logged from transmuxer stream ${s} as a ${i}: ${t}`)},triggerSegmentEventFn:({type:e,segment:t,keyInfo:i,trackInfo:s,timingInfo:r})=>{let n={segmentInfo:oR({segment:t})};i&&(n.keyInfo=i),s&&(n.trackInfo=s),r&&(n.timingInfo=r),this.trigger({type:e,metadata:n})}})}trimBackBuffer_(e){var t,i,s;let r,n=(t=this.seekable_(),i=this.currentTime_(),s=this.playlist_.targetDuration||10,r=i-a0.BACK_BUFFER_LENGTH,t.length&&(r=Math.max(r,t.start(0))),Math.min(i-s,r));n>0&&this.remove(0,n)}createSimplifiedSegmentObj_(e){let t=e.segment,i=e.part,s=e.segment.key||e.segment.map&&e.segment.map.key,r=e.segment.map&&!e.segment.map.bytes,n={resolvedUri:i?i.resolvedUri:t.resolvedUri,byterange:i?i.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part,type:this.loaderType_,start:e.startOfSegment,duration:e.duration,isEncrypted:s,isMediaInitialization:r},a=e.playlist.segments[e.mediaIndex-1];if(a&&a.timeline===t.timeline&&(a.videoTimingInfo?n.baseStartTime=a.videoTimingInfo.transmuxedDecodeEnd:a.audioTimingInfo&&(n.baseStartTime=a.audioTimingInfo.transmuxedDecodeEnd)),t.key){let i=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);n.key=this.segmentKey(t.key),n.key.iv=i}return t.map&&(n.map=this.initSegmentForMap(t.map)),n}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){if(this.pendingSegment_.byteLength=t.bytesReceived,e{if(!t.length)return e;if(i)return t.slice();let s=t[0].pts,r=0;for(;r=s);r++);return e.slice(0,r).concat(t)})(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(s)}setTimeMapping_(e){let t=this.syncController_.mappingForTimeline(e);null!==t&&(this.timeMapping_=t)}updateMediaSecondsLoaded_(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:i,firstVideoFrameTimeForData:s,currentVideoTimestampOffset:r,useVideoTimingInfo:n,videoTimingInfo:a,audioTimingInfo:o}){if(void 0!==e)return e;if(!n)return o.start;let l=t.segments[i-1];return 0!==i&&l&&void 0!==l.start&&l.end===s+r?a.start:s}waitForAppendsToComplete_(e){let t=this.getCurrentMediaInfo_(e);if(!t){this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error");return}let{hasAudio:i,hasVideo:s,isMuxed:r}=t,n="main"===this.loaderType_&&s,a=!this.audioDisabled_&&i&&!r;if(e.waitingOnAppends=0,!e.hasAppendedData_){e.timingInfo||"number"!=typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e);return}n&&e.waitingOnAppends++,a&&e.waitingOnAppends++,n&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),a&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){var t,i;let s=(t=this.loaderType_,i=this.getCurrentMediaInfo_(),"main"===t&&i&&e?e.hasAudio||e.hasVideo?i.hasVideo&&!e.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.":!i.hasVideo&&e.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);return!!s&&(this.error({message:s,playlistExclusionDuration:1/0}),this.trigger("error"),!0)}updateSourceBufferTimestampOffset_(e){if(null===e.timestampOffset||"number"!=typeof e.timingInfo.start||e.changedTimestampOffset||"main"!==this.loaderType_)return;let t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:i}){return this.useDtsForTimestampOffset_?e&&"number"==typeof e.transmuxedDecodeStart?e.transmuxedDecodeStart:t&&"number"==typeof t.transmuxedDecodeStart?t.transmuxedDecodeStart:i.start:i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};let t=this.getMediaInfo_(),i="main"===this.loaderType_&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;i&&(e.timingInfo.end="number"==typeof i.end?i.end:i.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_){let e={segmentInfo:oR({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:e})}if(!this.pendingSegment_){this.state="READY",this.paused()||this.monitorBuffer_();return}let e=this.pendingSegment_;e.part&&e.part.syncInfo?e.part.syncInfo.markAppended():e.segment.syncInfo&&e.segment.syncInfo.markAppended(),this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_});let t=((e,t)=>{var i;let s;if("hls"!==t)return null;let r=(i={audioTimingInfo:e.audioTimingInfo,videoTimingInfo:e.videoTimingInfo},s=0,["video","audio"].forEach(function(e){let t,r=i[`${e}TimingInfo`];if(!r)return;let{start:n,end:a}=r;"bigint"==typeof n||"bigint"==typeof a?t=g.default.BigInt(a)-g.default.BigInt(n):"number"==typeof n&&"number"==typeof a&&(t=a-n),void 0!==t&&t>s&&(s=t)}),"bigint"==typeof s&&s3*e.playlist.targetDuration,n=s&&s.end&&this.currentTime_()-s.end>3*e.playlist.partTargetDuration;if(r||n){this.logger_(`bad ${r?"segment":"part"} ${oD(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())},oB=["video","audio"],oq=(e,t)=>{let i=t[`${e}Buffer`];return i&&i.updating||t.queuePending[e]},o$=(e,t)=>{if(0===t.queue.length)return;let i=0,s=t.queue[i];if("mediaSource"===s.type){t.updating()||"closed"===t.mediaSource.readyState||(t.queue.shift(),s.action(t),s.doneFn&&s.doneFn(),o$("audio",t),o$("video",t));return}if("mediaSource"!==e&&!(!t.ready()||"closed"===t.mediaSource.readyState||oq(e,t))){if(s.type!==e){if(null===(i=((e,t)=>{for(let i=0;i{let i=t[`${e}Buffer`],s=oj(e);i&&(i.removeEventListener("updateend",t[`on${s}UpdateEnd_`]),i.removeEventListener("error",t[`on${s}Error_`]),t.codecs[e]=null,t[`${e}Buffer`]=null)},oV=(e,t)=>e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t),oH=(e,t)=>(i,s)=>{let r=s[`${i}Buffer`];if(oV(s.mediaSource,r)){s.logger_(`Removing ${e} to ${t} from ${i}Buffer`);try{r.remove(e,t)}catch(r){s.logger_(`Remove ${e} to ${t} from ${i}Buffer failed`)}}},oz=e=>(t,i)=>{let s=i[`${t}Buffer`];oV(i.mediaSource,s)&&(i.logger_(`Setting ${t}timestampOffset to ${e}`),s.timestampOffset=e)},oW=e=>(t,i)=>{e()},oG=({type:e,sourceUpdater:t,action:i,doneFn:s,name:r})=>{t.queue.push({type:e,action:i,doneFn:s,name:r}),o$(e,t)},oX=(e,t)=>i=>{let s=function(e){if(0===e.length)return"Buffered Ranges are empty";let t="Buffered Ranges: \n";for(let i=0;i ${r}. Duration (${r-s}) `}return t}(t[`${e}Buffered`]());if(t.logger_(`received "updateend" event for ${e} Source Buffer: `,s),t.queuePending[e]){let i=t.queuePending[e].doneFn;t.queuePending[e]=null,i&&i(t[`${e}Error_`])}o$(e,t)};class oK extends nN.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>o$("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=n$("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=oX("video",this),this.onAudioUpdateEnd_=oX("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){let i,s;oG({type:"mediaSource",sourceUpdater:this,action:(i=e,s=t,e=>{let t=oj(i),r=F(s);e.logger_(`Adding ${i}Buffer with codec ${s} to mediaSource`);let n=e.mediaSource.addSourceBuffer(r);n.addEventListener("updateend",e[`on${t}UpdateEnd_`]),n.addEventListener("error",e[`on${t}Error_`]),e.codecs[i]=s,e[`${i}Buffer`]=n}),name:"addSourceBuffer"})}abort(e){oG({type:e,sourceUpdater:this,action:(e,t)=>{if("open"!==t.mediaSource.readyState)return;let i=t[`${e}Buffer`];if(oV(t.mediaSource,i)){t.logger_(`calling abort on ${e}Buffer`);try{i.abort()}catch(t){nN.log.warn(`Failed to abort on ${e}Buffer`,t)}}},name:"abort"})}removeSourceBuffer(e){let t;this.canRemoveSourceBuffer()?oG({type:"mediaSource",sourceUpdater:this,action:(t=e,e=>{let i=e[`${t}Buffer`];if(oF(t,e),oV(e.mediaSource,i)){e.logger_(`Removing ${t}Buffer with codec ${e.codecs[t]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(i)}catch(e){nN.log.warn(`Failed to removeSourceBuffer ${t}Buffer`,e)}}}),name:"removeSourceBuffer"}):nN.log.error("removeSourceBuffer is not supported!")}canRemoveSourceBuffer(){return!nN.browser.IS_FIREFOX&&g.default.MediaSource&&g.default.MediaSource.prototype&&"function"==typeof g.default.MediaSource.prototype.removeSourceBuffer}static canChangeType(){return g.default.SourceBuffer&&g.default.SourceBuffer.prototype&&"function"==typeof g.default.SourceBuffer.prototype.changeType}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){let i;this.canChangeType()?oG({type:e,sourceUpdater:this,action:(i=t,(e,t)=>{let s=t[`${e}Buffer`],r=F(i);if(!oV(t.mediaSource,s))return;let n=i.substring(0,i.indexOf(".")),a=t.codecs[e];if(a.substring(0,a.indexOf("."))===n)return;let o={codecsChangeInfo:{from:a,to:i}};t.trigger({type:"codecschange",metadata:o}),t.logger_(`changing ${e}Buffer codec from ${a} to ${i}`);try{s.changeType(r),t.codecs[e]=i}catch(i){o.errorType=nN.Error.StreamingCodecsChangeError,o.error=i,i.metadata=o,t.error_=i,t.trigger("error"),nN.log.warn(`Failed to changeType on ${e}Buffer`,i)}}),name:"changeType"}):nN.log.error("changeType is not supported!")}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 i,s,r,{segmentInfo:n,type:a,bytes:o}=e;if(this.processedAppend_=!0,"audio"===a&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${o.length} until video append`);return}if(oG({type:a,sourceUpdater:this,action:(i=o,s=n||{mediaIndex:-1},r=t,(e,t)=>{let n=t[`${e}Buffer`];if(oV(t.mediaSource,n)){t.logger_(`Appending segment ${s.mediaIndex}'s ${i.length} bytes to ${e}Buffer`);try{n.appendBuffer(i)}catch(i){t.logger_(`Error with code ${i.code} `+(22===i.code?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${s.mediaIndex} to ${e}Buffer`),t.queuePending[e]=null,r(i)}}}),doneFn:t,name:"appendBuffer"}),"video"===a){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 oV(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:nV()}videoBuffered(){return oV(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:nV()}buffered(){let e=oV(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=oV(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():nY(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=oU){let i;oG({type:"mediaSource",sourceUpdater:this,action:(i=e,e=>{e.logger_(`Setting mediaSource duration to ${i}`);try{e.mediaSource.duration=i}catch(e){nN.log.warn("Failed to set media source duration",e)}}),name:"duration",doneFn:t})}endOfStream(e=null,t=oU){let i;"string"!=typeof e&&(e=void 0),oG({type:"mediaSource",sourceUpdater:this,action:(i=e,e=>{if("open"===e.mediaSource.readyState){e.logger_(`Calling mediaSource endOfStream(${i||""})`);try{e.mediaSource.endOfStream(i)}catch(e){nN.log.warn("Failed to call media source endOfStream",e)}}}),name:"endOfStream",doneFn:t})}removeAudio(e,t,i=oU){this.audioBuffered().length&&0!==this.audioBuffered().end(0)?oG({type:"audio",sourceUpdater:this,action:oH(e,t),doneFn:i,name:"remove"}):i()}removeVideo(e,t,i=oU){this.videoBuffered().length&&0!==this.videoBuffered().end(0)?oG({type:"video",sourceUpdater:this,action:oH(e,t),doneFn:i,name:"remove"}):i()}updating(){return!!(oq("audio",this)||oq("video",this))}audioTimestampOffset(e){return void 0!==e&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(oG({type:"audio",sourceUpdater:this,action:oz(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return void 0!==e&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(oG({type:"video",sourceUpdater:this,action:oz(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&oG({type:"audio",sourceUpdater:this,action:oW(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&oG({type:"video",sourceUpdater:this,action:oW(e),name:"callback"})}dispose(){this.trigger("dispose"),oB.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>oF(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}let oY=e=>decodeURIComponent(escape(String.fromCharCode.apply(null,e))),oQ=new Uint8Array("\n\n".split("").map(e=>e.charCodeAt(0)));class oJ extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class oZ extends oM{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return nV();let e=this.subtitlesTrack_.cues;return nV([[e[0].startTime,e[e.length-1].startTime]])}initSegmentForMap(e,t=!1){if(!e)return null;let i=aF(e),s=this.initSegments_[i];if(t&&!s&&e.bytes){let t=new Uint8Array(oQ.byteLength+e.bytes.byteLength);t.set(e.bytes),t.set(oQ,e.bytes.byteLength),this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:t}}return s||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){ow(e,t,this.subtitlesTrack_)}fillBuffer_(){let e=this.chooseNextRequest_();if(e){if(null===this.syncController_.timestampOffsetForTimeline(e.timeline)){let e=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};this.syncController_.one("timestampoffset",e),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){-101===e.code&&this.handleTimeout_(),-102===e.code?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}let s=this.pendingSegment_,r=i.mp4VttCues&&i.mp4VttCues.length;r&&(s.mp4VttCues=i.mp4VttCues),this.saveBandwidthRelatedStats_(s.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");let n=s.segment;if(n.map&&(n.map.bytes=t.map.bytes),s.bytes=t.bytes,"function"!=typeof g.default.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"}));return}n.requested=!0;try{this.parseVTTCues_(s)}catch(e){this.stopForError({message:e.message,metadata:{errorType:nN.Error.StreamingVttParserError,error:e}});return}if(r||this.updateTimeMapping_(s,this.syncController_.timelines[s.timeline],this.playlist_),s.cues.length?s.timingInfo={start:s.cues[0].startTime,end:s.cues[s.cues.length-1].endTime}:s.timingInfo={start:s.startOfSegment,end:s.startOfSegment+s.duration},s.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}s.byteLength=s.bytes.byteLength,this.mediaSecondsLoaded+=n.duration,s.cues.forEach(e=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new g.default.VTTCue(e.startTime,e.endTime,e.text):e)}),oE(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(e,t){let i=e&&"vtt"===e.type,s=t&&"text"===t.type;i&&s&&super.handleData_(e,t)}updateTimingInfoEnd_(){}parseMp4VttCues_(e){let t=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();e.mp4VttCues.forEach(i=>{let s=i.start+t,r=i.end+t,n=new g.default.VTTCue(s,r,i.cueText);i.settings&&i.settings.split(" ").forEach(e=>{let t=e.split(":"),i=t[0],s=t[1];n[i]=isNaN(s)?s:Number(s)}),e.cues.push(n)})}parseVTTCues_(e){let t,i=!1;if("function"!=typeof g.default.WebVTT)throw new oJ;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues)return void this.parseMp4VttCues_(e);"function"==typeof g.default.TextDecoder?t=new g.default.TextDecoder("utf8"):(t=g.default.WebVTT.StringDecoder(),i=!0);let s=new g.default.WebVTT.Parser(g.default,g.default.vttjs,t);if(s.oncue=e.cues.push.bind(e.cues),s.ontimestampmap=t=>{e.timestampmap=t},s.onparsingerror=e=>{nN.log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map){let t=e.segment.map.bytes;i&&(t=oY(t)),s.parse(t)}let r=e.bytes;i&&(r=oY(r)),s.parse(r),s.flush()}updateTimeMapping_(e,t,i){let s=e.segment;if(!t)return;if(!e.cues.length){s.empty=!0;return}let{MPEGTS:r,LOCAL:n}=e.timestampmap,a=r/tl.ONE_SECOND_IN_TS-n+t.mapping;if(e.cues.forEach(e=>{let i=e.endTime-e.startTime,s=this.handleRollover_(e.startTime+a,t.time);e.startTime=Math.max(s,0),e.endTime=Math.max(s+i,0)}),!i.syncInfo){let t=e.cues[0].startTime,r=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(t,r-s.duration)}}}handleRollover_(e,t){let i;if(null===t)return e;let s=e*tl.ONE_SECOND_IN_TS,r=t*tl.ONE_SECOND_IN_TS;for(i=r0x100000000;)s+=i;return s/tl.ONE_SECOND_IN_TS}}let o0=function(e,t){let i=e.cues;for(let e=0;e=s.adStartTime&&t<=s.adEndTime)return s}return null},o1=function(e,t,i=0){let s;if(!e.segments)return;let r=i;for(let i=0;i=this.start&&e0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach(e=>e.resetAppendedStatus())}}class o5{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:s}=e;if(this.isReliable_=this.isReliablePlaylist_(i,s),this.isReliable_)return this.updateStorage_(s,i,this.calculateBaseTime_(i,s,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 s=new Map,r="\n",n=i,a=t;this.start_=n,e.forEach((e,t)=>{let i=this.storage_.get(a),o=n,l=o+e.duration,h=!!(i&&i.segmentSyncInfo&&i.segmentSyncInfo.isAppended),d=new o2({start:o,end:l,appended:h,segmentIndex:t});e.syncInfo=d;let u=n,c=(e.parts||[]).map((e,s)=>{let n=u,o=u+e.duration,l=!!(i&&i.partsSyncInfo&&i.partsSyncInfo[s]&&i.partsSyncInfo[s].isAppended),h=new o2({start:n,end:o,appended:l,segmentIndex:t,partIndex:s});return u=o,r+=`Media Sequence: ${a}.${s} | Range: ${n} --> ${o} | Appended: ${l} `,e.syncInfo=h,h});s.set(a,new o4(d,c)),r+=`${oy(e.resolvedUri)} | Media Sequence: ${a} | Range: ${o} --> ${l} | Appended: ${h} `,a++,n=l}),this.end_=n,this.storage_=s,this.diagnostics_=r}calculateBaseTime_(e,t,i){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;let s=Math.min(...this.storage_.keys());if(e1/0!==i?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(e,t,i,s,r,n)=>{let a=e.getMediaSequenceSync(n);if(!a||!a.isReliable)return null;let o=a.getSyncInfoForTime(r);return o?{time:o.start,partIndex:o.partIndex,segmentIndex:o.segmentIndex}:null}},{name:"ProgramDateTime",run:(e,t,i,s,r)=>{if(!Object.keys(e.timelineToDatetimeMappings).length)return null;let n=null,a=null,o=n4(t);r=r||0;for(let i=0;i{let n=null,a=null;r=r||0;let o=n4(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,s,r)=>{let n=null;if(r=r||0,t.discontinuityStarts&&t.discontinuityStarts.length){let i=null;for(let s=0;s=e)&&(i=e,n={time:l.time,segmentIndex:a,partIndex:null})}}}return n}},{name:"Playlist",run:(e,t,i,s,r)=>t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}];class o6 extends nN.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};let t=new o5,i=new o8(t),s=new o8(t);this.mediaSequenceStorage_={main:t,audio:i,vtt:s},this.logger_=n$("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,i,s,r){if(1/0!==t)return o3.find(({name:e})=>"VOD"===e).run(this,e,t);let n=this.runStrategies_(e,t,i,s,r);if(!n.length)return null;for(let t of n){let{syncPoint:i,strategy:r}=t,{segmentIndex:n,time:a}=i;if(n<0)continue;let o=a+e.segments[n].duration;if(this.logger_(`Strategy: ${r}. Current time: ${s}. selected segment: ${n}. Time: [${a} -> ${o}]}`),s>=a&&s0&&(s.time*=-1),Math.abs(s.time+at({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:s.segmentIndex,endIndex:0}))}runStrategies_(e,t,i,s,r){let n=[];for(let a=0;a86400)return void nN.log.warn(`Not saving expired segment info. Media sequence gap ${i} is too large.`);for(let s=i-1;s>=0;s--){let i=e.segments[s];if(i&&void 0!==i.start){t.syncInfo={mediaSequence:e.mediaSequence+s,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),s=e.segment;i&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:s.start}));let r=s.dateTimeObject;s.discontinuity&&t&&r&&(this.timelineToDatetimeMappings[s.timeline]=-(r.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 s,r,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}]`)),s=e.startOfSegment,r=t.end+o.mapping;else{if(!o)return!1;s=t.start+o.mapping,r=t.end+o.mapping}return a&&(a.start=s,a.end=r),(!n.start||so){let s;s=a<0?i.start-at({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:r}):i.end+at({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:r}),this.discontinuities[n]={time:s,accuracy:o}}}}dispose(){this.trigger("dispose"),this.off()}}class o7 extends nN.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({type:"timelinechange",metadata:{timelineChangeInfo:{from:t,to:i}}})),this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}var o9=a4(a5(a8(function(){var t,i,s=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,s=0;s>7)*283)^e]=e;for(t=i=0;!u[t];t^=s||1,i=f[i]||1)for(n=(n=i^i<<1^i<<2^i<<3^i<<4)>>8^255&n^99,u[t]=n,c[n]=t,o=0x1010101*p[r=p[s=p[t]]]^65537*r^257*s^0x1010100*t,a=257*p[n]^0x1010100*n,e=0;e<4;e++)h[e][t]=a=a<<24^a>>>8,d[e][n]=o=o<<24^o>>>8;for(e=0;e<5;e++)h[e]=h[e].slice(0),d[e]=d[e].slice(0);return l},n=null;class a{constructor(e){let t,i,s;n||(n=r()),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,h=1;if(4!==l&&6!==l&&8!==l)throw Error("Invalid aes key size");let d=e.slice(0),u=[];for(this._key=[d,u],t=l;t<4*l+28;t++)s=d[t-1],(t%l==0||8===l&&t%l==4)&&(s=a[s>>>24]<<24^a[s>>16&255]<<16^a[s>>8&255]<<8^a[255&s],t%l==0&&(s=s<<8^s>>>24^h<<24,h=h<<1^(h>>7)*283)),d[t]=d[t-l]^s;for(i=0;t;i++,t--)s=d[3&i?t:t-4],t<=4||i<4?u[i]=s:u[i]=o[0][a[s>>>24]]^o[1][a[s>>16&255]]^o[2][a[s>>8&255]]^o[3][a[255&s]]}decrypt(e,t,i,s,r,n){let a,o,l,h,d=this._key[1],u=e^d[0],c=s^d[1],p=i^d[2],f=t^d[3],m=d.length/4-2,g=4,y=this._tables[1],_=y[0],b=y[1],v=y[2],T=y[3],S=y[4];for(h=0;h>>24]^b[c>>16&255]^v[p>>8&255]^T[255&f]^d[g],o=_[c>>>24]^b[p>>16&255]^v[f>>8&255]^T[255&u]^d[g+1],l=_[p>>>24]^b[f>>16&255]^v[u>>8&255]^T[255&c]^d[g+2],f=_[f>>>24]^b[u>>16&255]^v[c>>8&255]^T[255&p]^d[g+3],g+=4,u=a,c=o,p=l;for(h=0;h<4;h++)r[(3&-h)+n]=S[u>>>24]<<24^S[c>>16&255]<<16^S[p>>8&255]<<8^S[255&f]^d[g++],a=u,u=c,c=p,p=f,f=a}}class o extends s{constructor(){super(s),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|(0xff0000&e)>>8|e>>>24},h=function(e,t,i){let s,r,n,o,h,d,u,c,p,f=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),m=new a(Array.prototype.slice.call(t)),g=new Uint8Array(e.byteLength),y=new Int32Array(g.buffer);for(s=i[0],r=i[1],n=i[2],o=i[3],p=0;ptypeof globalThis?globalThis:"u">typeof window?window:e.g,c=("u">typeof window?window:void 0!==u?u:"u">typeof self?self:{}).BigInt||Number;c("0x1"),c("0x100"),c("0x10000"),c("0x1000000"),c("0x100000000"),c("0x10000000000"),c("0x1000000000000"),c("0x100000000000000"),c("0x10000000000000000"),255===(i=new Uint8Array((t=new Uint16Array([65484])).buffer,t.byteOffset,t.byteLength))[0]||i[0];let p=function(e){let t={};return Object.keys(e).forEach(i=>{let s=e[i];("function"===ArrayBuffer.isView?ArrayBuffer.isView(s):s&&s.buffer instanceof ArrayBuffer)?t[i]={bytes:s.buffer,byteOffset:s.byteOffset,byteLength:s.byteLength}:t[i]=s}),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])})}})));let le=e=>{let t=e.default?"main":"alternative";return e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},lt=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},li=(e,t)=>{t.activePlaylistLoader=e,e.load()},ls={AUDIO:(e,t)=>()=>{let{mediaTypes:{[e]:i},excludePlaylist:s}=t,r=i.activeTrack(),n=i.activeGroup(),a=(n.filter(e=>e.default)[0]||n[0]).id,o=i.tracks[a];if(r===o)return void s({error:{message:"Problem encountered loading the default audio track."}});for(let e in nN.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;nN.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");let s=i.activeTrack();s&&(s.mode="disabled"),i.onTrackChanged()}},lr={AUDIO:(e,t,i)=>{if(!t)return;let{tech:s,requestOptions:r,segmentLoaders:{[e]:n}}=i;t.on("loadedmetadata",()=>{let e=t.media();n.playlist(e,r),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()}),t.on("loadedplaylist",()=>{n.playlist(t.media(),r),s.paused()||n.load()}),t.on("error",ls[e](e,i))},SUBTITLES:(e,t,i)=>{let{tech:s,requestOptions:r,segmentLoaders:{[e]:n},mediaTypes:{[e]:a}}=i;t.on("loadedmetadata",()=>{let e=t.media();n.playlist(e,r),n.track(a.activeTrack()),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()}),t.on("loadedplaylist",()=>{n.playlist(t.media(),r),s.paused()||n.load()}),t.on("error",ls[e](e,i))}},ln={AUDIO:(e,t)=>{let{vhs:i,sourceType:s,segmentLoaders:{[e]:r},requestOptions:n,main:{mediaGroups:a},mediaTypes:{[e]:{groups:o,tracks:l,logger_:h}},mainPlaylistLoader:d}=t,u=ad(d.main);for(let r in(!a[e]||0===Object.keys(a[e]).length)&&(a[e]={main:{default:{default:!0}}},u&&(a[e].main.default.playlists=d.main.playlists)),a[e])for(let c in o[r]||(o[r]=[]),a[e][r]){let p,f=a[e][r][c];if(u?(h(`AUDIO group '${r}' label '${c}' is a main playlist`),f.isMainPlaylist=!0,p=null):p="vhs-json"===s&&f.playlists?new aN(f.playlists[0],i,n):f.resolvedUri?new aN(f.resolvedUri,i,n):f.playlists&&"dash"===s?new aZ(f.playlists[0],i,n,d):null,f=nF({id:c,playlistLoader:p},f),lr[e](e,f.playlistLoader,t),o[r].push(f),void 0===l[c]){let e=new nN.AudioTrack({id:c,kind:le(f),enabled:!1,language:f.language,default:f.default,label:c});l[c]=e}}r.on("error",ls[e](e,t))},SUBTITLES:(e,t)=>{let{tech:i,vhs:s,sourceType:r,segmentLoaders:{[e]:n},requestOptions:a,main:{mediaGroups:o},mediaTypes:{[e]:{groups:l,tracks:h}},mainPlaylistLoader:d}=t;for(let n in o[e])for(let u in l[n]||(l[n]=[]),o[e][n]){let c;if(!s.options_.useForcedSubtitles&&o[e][n][u].forced)continue;let p=o[e][n][u];if("hls"===r)c=new aN(p.resolvedUri,s,a);else if("dash"===r){if(!p.playlists.filter(e=>1/0!==e.excludeUntil).length)return;c=new aZ(p.playlists[0],s,a,d)}else"vhs-json"===r&&(c=new aN(p.playlists?p.playlists[0]:p.resolvedUri,s,a));if(p=nF({id:u,playlistLoader:c},p),lr[e](e,p.playlistLoader,t),l[n].push(p),void 0===h[u]){let e=i.addRemoteTextTrack({id:u,kind:"subtitles",default:p.default&&p.autoselect,language:p.language,label:u},!1).track;h[u]=e}}n.on("error",ls[e](e,t))},"CLOSED-CAPTIONS":(e,t)=>{let{tech:i,main:{mediaGroups:s},mediaTypes:{[e]:{groups:r,tracks:n}}}=t;for(let t in s[e])for(let a in r[t]||(r[t]=[]),s[e][t]){let o=s[e][t][a];if(!/^(?:CC|SERVICE)/.test(o.instreamId))continue;let l=i.options_.vhs&&i.options_.vhs.captionServices||{},h={label:a,language:o.language,instreamId:o.instreamId,default:o.default&&o.autoselect};if(l[h.instreamId]&&(h=nF(h,l[h.instreamId])),void 0===h.default&&delete h.default,r[t].push(nF({id:a},o)),void 0===n[a]){let e=i.addRemoteTextTrack({id:h.instreamId,kind:"captions",default:h.default,language:h.language,label:h.label},!1).track;n[a]=e}}}},la=(e,t)=>{for(let i=0;i()=>{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}};class ll{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_=S(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 lh extends nN.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new ll,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_=n$("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}i.startsWith("data:")?this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1)):(this.steeringManifest.reloadUri=S(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}let s={contentSteeringInfo:{uri:i}};this.trigger({type:"contentsteeringloadstart",metadata:s}),this.request_=this.xhr_({uri:i,requestType:"content-steering-manifest"},(e,t)=>{let r;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}this.trigger({type:"contentsteeringloadcomplete",metadata:s});try{r=JSON.parse(this.request_.responseText)}catch(t){let e={errorType:nN.Error.StreamingContentSteeringParserError,error:t};this.trigger({type:"error",metadata:e})}this.assignSteeringProperties_(r);let n={contentSteeringInfo:s.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:n}),this.startTTLTimeout_()})}setProxyServerUrl_(e){let t=new g.default.URL(e),i=new g.default.URL(this.proxyServerUrl_);return i.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(i.toString())}decodeDataUriManifest_(e){let t=JSON.parse(g.default.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){let t=new g.default.URL(e),i=this.getPathway(),s=this.getBandwidth_();if(i){let e=`_${this.manifestType_}_pathway`;t.searchParams.set(e,i)}if(s){let e=`_${this.manifestType_}_throughput`;t.searchParams.set(e,s)}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_=g.default.setTimeout(()=>{this.requestSteeringManifest()},1e3*e)}clearTTLTimeout_(){g.default.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 ll}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&&(S(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}let ld=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],lu=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]},lc=function({currentPlaylist:e,buffered:t,currentTime:i,nextPlaylist:s,bufferLowWaterLine:r,bufferHighWaterLine:n,duration:a,bufferBasedABR:o,log:l}){if(!s)return nN.log.warn("We received no playlist to switch to. Please check your stream."),!1;let h=`allowing switch ${e&&e.id||"null"} -> ${s.id}`;if(!e)return l(`${h} as current playlist is not set`),!0;if(s.id===e.id)return!1;let d=!!nG(t,i).length;if(!e.endList)return d||"number"!=typeof e.partTargetDuration?(l(`${h} as current playlist is live`),!0):(l(`not ${h} as current playlist is live llhls, but currentTime isn't in buffered.`),!1);let u=n1(t,i),c=o?a0.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:a0.MAX_BUFFER_LOW_WATER_LINE;if(af)&&u>=r){let e=`${h} as forwardBuffer >= bufferLowWaterLine (${u} >= ${r})`;return o&&(e+=` and next bandwidth > current bandwidth (${p} > ${f})`),l(e),!0}return l(`not ${h} as no switching criteria met`),!1};class lp extends nN.EventTarget{constructor(e){var t;let i,s;super(),this.fastQualityChange_=(t=this.fastQualityChange_.bind(this),i=null,(...e)=>{clearTimeout(i),i=setTimeout(()=>{t.apply(null,e)},100)});let{src:r,withCredentials:n,tech:o,bandwidth:l,externVhs:h,useCueTags:d,playlistExclusionDuration:u,enableLowInitialPlaylist:c,sourceType:p,cacheEncryptionKeys:f,bufferBasedABR:m,leastPixelDiffSelector:y,captionServices:_,experimentalUseMMS:b}=e;if(!r)throw Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:v}=e;null==v&&(v=1/0),a=h,this.bufferBasedABR=!!m,this.leastPixelDiffSelector=!!y,this.withCredentials=n,this.tech_=o,this.vhs_=o.vhs,this.player_=e.player_,this.sourceType_=p,this.useCueTags_=d,this.playlistExclusionDuration=u,this.maxPlaylistRetries=v,this.enableLowInitialPlaylist=c,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:n,maxPlaylistRetries:v,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=(s={},["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{s[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:oU,activeTrack:oU,getActiveGroup:oU,onGroupChanged:oU,onTrackChanged:oU,lastTrack_:null,logger_:n$(`MediaGroups[${e}]`)}}),s),b&&g.default.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new g.default.ManagedMediaSource,this.usingManagedMediaSource_=!0,nN.log("Using ManagedMediaSource")):g.default.MediaSource&&(this.mediaSource=new g.default.MediaSource),this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.load=this.load.bind(this),this.pause=this.pause.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.mediaSource.addEventListener("startstreaming",this.load),this.mediaSource.addEventListener("endstreaming",this.pause),this.seekable_=nV(),this.hasPlayed_=!1,this.syncController_=new o6(e),this.segmentMetadataTrack_=o.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.segmentMetadataTrack_.mode="hidden",this.decrypter_=new o9,this.sourceUpdater_=new oK(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new o7,this.keyStatusMap_=new Map;let T={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:_,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:l,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:f,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_="dash"===this.sourceType_?new aZ(r,this.vhs_,nF(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new aN(r,this.vhs_,nF(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new oM(nF(T,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new oM(nF(T,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new oZ(nF(T,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((e,t)=>{function i(){o.off("vttjserror",s),e()}function s(){o.off("vttjsloaded",i),t()}o.one("vttjsloaded",i),o.one("vttjserror",s),o.addWebVttScript_()})}),e);let S=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new lh(this.vhs_.xhr,S),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),ld.forEach(e=>{this[e+"_"]=lu.bind(this,e)}),this.logger_=n$("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 x="none"===this.tech_.preload()?"play":"loadstart";this.tech_.one(x,()=>{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 s=this.media(),r=s&&(s.id||s.uri),n=e&&(e.id||e.uri);if(r&&r!==n){this.logger_(`switch media ${r} -> ${n} from ${t}`);let i={renditionInfo:{id:n,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t};this.trigger({type:"renditionselected",metadata:i}),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,s=this.contentSteeringController_.getPathway();if(i&&s){let t=(i.length?i[0].playlists:i.playlists).filter(e=>e.attributes.serviceLocation===s);t.length&&this.mediaTypes_[e].activePlaylistLoader.media(t[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=g.default.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(g.default.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){let e,t=this.main(),i=t&&t.playlists||[];if(!t||!t.mediaGroups||!t.mediaGroups.AUDIO)return i;let s=t.mediaGroups.AUDIO,r=Object.keys(s);if(Object.keys(this.mediaTypes_.AUDIO.groups).length)e=this.mediaTypes_.AUDIO.activeTrack();else{let t=s.main||r.length&&s[r[0]];for(let i in t)if(t[i].default){e={label:i};break}}if(!e)return i;let n=[];for(let i in s)if(s[i][e.label]){let r=s[i][e.label];if(r.playlists&&r.playlists.length)n.push.apply(n,r.playlists);else if(r.uri)n.push(r);else if(t.playlists.length)for(let e=0;e{let e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;ao(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()),(e=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(t=>{ln[t](t,e)});let{mediaTypes:t,mainPlaylistLoader:i,tech:s,vhs:r,segmentLoaders:{AUDIO:n,main:a}}=e;["AUDIO","SUBTITLES"].forEach(i=>{t[i].activeGroup=t=>{let{mainPlaylistLoader:s,mediaTypes:{[i]:{groups:r}}}=e,n=s.media();if(!n)return null;let a=null;n.attributes[i]&&(a=r[n.attributes[i]]);let o=Object.keys(r);if(!a)if("AUDIO"===i&&o.length>1&&ad(e.main))for(let e=0;ee.id===t.id)[0]||null},t[i].activeTrack=lo[i](i,e),t[i].onGroupChanged=()=>{let{segmentLoaders:{[i]:t,main:s},mediaTypes:{[i]:r}}=e,n=r.activeTrack(),a=r.getActiveGroup(),o=r.activePlaylistLoader,l=r.lastGroup_;if((!a||!l||a.id!==l.id)&&(r.lastGroup_=a,r.lastTrack_=n,lt(t,r),a&&!a.isMainPlaylist)){if(!a.playlistLoader){o&&s.resetEverything();return}t.resyncLoader(),li(a.playlistLoader,r)}},t[i].onGroupChanging=()=>{let{segmentLoaders:{[i]:t},mediaTypes:{[i]:s}}=e;s.lastGroup_=null,t.abort(),t.pause()},t[i].onTrackChanged=()=>{let{mainPlaylistLoader:t,segmentLoaders:{[i]:s,main:r},mediaTypes:{[i]:n}}=e,a=n.activeTrack(),o=n.getActiveGroup(),l=n.activePlaylistLoader,h=n.lastTrack_;if((!h||!a||h.id!==a.id)&&(n.lastGroup_=o,n.lastTrack_=a,lt(s,n),o)){if(o.isMainPlaylist){if(!a||!h||a.id===h.id)return;let i=e.vhs.playlistController_,s=i.selectPlaylist();if(i.media()===s)return;n.logger_(`track change. Switching main audio from ${h.id} to ${a.id}`),t.pause(),r.resetEverything(),i.fastQualityChange_(s);return}if("AUDIO"===i){if(!o.playlistLoader){r.setAudio(!0),r.resetEverything();return}s.setAudio(!0),r.setAudio(!1)}if(l===o.playlistLoader)return void li(o.playlistLoader,n);s.track&&s.track(a),s.resetEverything(),li(o.playlistLoader,n)}},t[i].getActiveGroup=((e,{mediaTypes:t})=>()=>{let i=t[e].activeTrack();return i?t[e].activeGroup(i):null})(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(),s.trigger({type:"usage",name:"vhs-audio-change"})};for(let e in s.audioTracks().addEventListener("change",l),s.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),r.on("dispose",()=>{s.audioTracks().removeEventListener("change",l),s.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)}),s.clearTracks("audio"),t.AUDIO.tracks)s.audioTracks().addTrack(t.AUDIO.tracks[e])})({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=1.5*e.targetDuration*1e3;ao(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,"dash"===this.sourceType_&&this.mainPlaylistLoader_.isPaused&&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"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(e=>{this.mainPlaylistLoader_.on(e,e=>{this.player_.trigger(v({},e))})})}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||{},s=!0,r=Object.keys(i.AUDIO);for(let e in i.AUDIO)for(let t in i.AUDIO[e])i.AUDIO[e][t].uri||(s=!1);s&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),a.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),r.length&&Object.keys(i.AUDIO[r[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(),s=this.bufferLowWaterLine(),r=this.bufferHighWaterLine();return lc({buffered:this.tech_.buffered(),currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:s,bufferHighWaterLine:r,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.timelineChangeController_.on("audioTimelineBehind",()=>{let e=this.audioSegmentLoader_.pendingSegment_;if(!e||!e.segment||!e.segment.syncInfo)return;let t=e.segment.syncInfo.end+.01;this.tech_.setCurrentTime(t)}),this.timelineChangeController_.on("fixBadTimelineChange",()=>{this.logger_("Fix bad timeline change. Restarting al segment loaders..."),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()}),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()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(e=>{this.mainSegmentLoader_.on(e,e=>{this.player_.trigger(v({},e))}),this.audioSegmentLoader_.on(e,e=>{this.player_.trigger(v({},e))}),this.subtitleSegmentLoader_.on(e,e=>{this.player_.trigger(v({},e))})})}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()}pause(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}fastQualityChange_(e=this.selectPlaylist()){e&&e===this.mainPlaylistLoader_.media()?this.logger_("skipping fastQualityChange because new media is same as old"):(this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0)}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,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()}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();let e=this.tech_.seekable();if(1/0===this.tech_.duration()&&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)||1/0===Math.abs(t)?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=a.Playlist.playlistEnd(e,t),s=this.tech_.currentTime(),r=this.tech_.buffered();if(!r.length)return i-s<=nz;let n=r.end(r.length-1);return n-s<=nz&&i-n<=nz}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){let s;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 r=this.mainPlaylistLoader_.main.playlists,n=r.filter(an),a=1===n.length&&n[0]===e;if(1===r.length&&1/0!==i)return nN.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;r.forEach(i=>{if(i===e)return;let s=i.excludeUntil;void 0!==s&&1/0!==s&&(t=!0,delete i.excludeUntil)}),t&&(nN.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}s=e.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*i,e.excludeUntil=s,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_:nN.log.warn,h=t.message?" "+t.message:"";l(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${h} 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,u="number"==typeof o.lastRequest&&Date.now()-o.lastRequest<=d;return this.switchMedia_(o,"exclude",a||u)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){let i=[],s="all"===e;(s||"main"===e)&&i.push(this.mainPlaylistLoader_);let r=[];(s||"audio"===e)&&r.push("AUDIO"),(s||"subtitle"===e)&&(r.push("CLOSED-CAPTIONS"),r.push("SUBTITLES")),r.forEach(e=>{let t=this.mediaTypes_[e]&&this.mediaTypes_[e].activePlaylistLoader;t&&i.push(t)}),["main","audio","subtitle"].forEach(t=>{let s=this[`${t}SegmentLoader_`];s&&(e===t||"all"===e)&&i.push(s)}),i.forEach(e=>t.forEach(t=>{"function"==typeof e[t]&&e[t]()}))}setCurrentTime(e){let t=nG(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:a.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}getSeekableRange_(e,t){let i=e.media();if(!i)return null;let s=this.syncController_.getMediaSequenceSync(t);if(s&&s.isReliable){let e=s.start,t=s.end;if(!isFinite(e)||!isFinite(t))return null;let r=Math.max(e,t-a.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i));return nV([[e,r]])}let r=this.syncController_.getExpiredTime(i,this.duration());if(null===r)return null;let n=a.Playlist.seekable(i,r,a.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i));return n.length?n:null}computeFinalSeekable_(e,t){if(!t)return e;let i=e.start(0),s=e.end(0),r=t.start(0),n=t.end(0);return r>s||i>n?e:nV([[Math.max(i,r),Math.min(s,n)]])}onSyncInfoUpdate_(){let e;if(!this.mainPlaylistLoader_)return;let t=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(!t||this.mediaTypes_.AUDIO.activePlaylistLoader&&!(e=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio")))return;let i=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(t,e),!this.seekable_||i&&i.length&&this.seekable_.length&&i.start(0)===this.seekable_.start(0)&&i.end(0)===this.seekable_.end(0))return;this.logger_(`seekable updated [${nQ(this.seekable_)}]`);let s={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:s}),this.tech_.trigger("seekablechanged")}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),"open"!==this.mediaSource.readyState){this.updateDuration_=this.updateDuration.bind(this,e),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(e){let e=this.seekable();if(!e.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration0&&(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,t={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},i=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();t.video=t.main;let s=aE(this.main(),i),r={},n=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(t.main.hasVideo&&(r.video=s.video||t.main.videoCodec||"avc1.4d400d"),t.main.isMuxed&&(r.video+=`,${s.audio||t.main.audioCodec||z}`),(t.main.hasAudio&&!t.main.isMuxed||t.audio.hasAudio||n)&&(r.audio=s.audio||t.main.audioCodec||t.audio.audioCodec||z,t.audio.isFmp4=t.main.hasAudio&&!t.main.isMuxed?t.main.isFmp4:t.audio.isFmp4),!r.audio&&!r.video)return void this.excludePlaylist({playlistToExclude:i,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});let a=(e,t)=>e?V(t,this.usingManagedMediaSource_):H(t),o={};if(["video","audio"].forEach(function(i){if(r.hasOwnProperty(i)&&!a(t[i].isFmp4,r[i])){let s=t[i].isFmp4?"browser":"muxer";o[s]=o[s]||[],o[s].push(r[i]),"audio"===i&&(e=s)}}),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): "${r.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=(B(this.sourceUpdater_.codecs[t]||"")[0]||{}).type,s=(B(r[t]||"")[0]||{}).type;i&&s&&i.toLowerCase()!==s.toLowerCase()&&e.push(`"${this.sourceUpdater_.codecs[t]}" -> "${r[t]}"`)}),e.length)return void this.excludePlaylist({playlistToExclude:i,error:{message:`Codec switching not supported: ${e.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0})}return r}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 s=e[i];if(-1!==t.indexOf(s.id))return;t.push(s.id);let r=aE(this.main,s),n=[];!r.audio||H(r.audio)||V(r.audio,this.usingManagedMediaSource_)||n.push(`audio codec ${r.audio}`),!r.video||H(r.video)||V(r.video,this.usingManagedMediaSource_)||n.push(`video codec ${r.video}`),r.text&&"stpp.ttml.im1t"===r.text&&n.push(`text codec ${r.text}`),n.length&&(s.excludeUntil=1/0,this.logger_(`excluding ${s.id} for unsupported: ${n.join(", ")}`))})}excludeIncompatibleVariants_(e){let t=[],i=this.main().playlists,s=ax(B(e)),r=aw(s),n=s.video&&B(s.video)[0]||null,a=s.audio&&B(s.audio)[0]||null;Object.keys(i).forEach(e=>{let s=i[e];if(-1!==t.indexOf(s.id)||1/0===s.excludeUntil)return;t.push(s.id);let o=[],l=aE(this.mainPlaylistLoader_.main,s),h=aw(l);if(l.audio||l.video){if(h!==r&&o.push(`codec count "${h}" !== "${r}"`),!this.sourceUpdater_.canChangeType()){let e=l.video&&B(l.video)[0]||null,t=l.audio&&B(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&&(s.excludeUntil=1/0,this.logger_(`excluding ${s.id}: ${o.join(" && ")}`))}})}updateAdCues_(e){let t=0,i=this.seekable();i.length&&(t=i.start(0)),o1(e,this.cueTagsTrack_,t)}goalBufferLength(){let e=this.tech_.currentTime(),t=a0.GOAL_BUFFER_LENGTH,i=a0.GOAL_BUFFER_LENGTH_RATE,s=Math.max(t,a0.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,s)}bufferLowWaterLine(){let e=this.tech_.currentTime(),t=a0.BUFFER_LOW_WATER_LINE,i=a0.BUFFER_LOW_WATER_LINE_RATE,s=Math.max(t,a0.MAX_BUFFER_LOW_WATER_LINE),r=Math.max(t,a0.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?r:s)}bufferHighWaterLine(){return a0.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){ox(this.inbandTextTracks_,"com.apple.streaming",this.tech_),(({inbandTextTracks:e,dateRanges:t})=>{let i=e.metadataTrack_;if(!i)return;let s=g.default.WebKitDataCue||g.default.VTTCue;t.forEach(e=>{for(let t of Object.keys(e)){if(oS.has(t))continue;let r=new s(e.startTime,e.endTime,"");r.id=e.id,r.type="com.apple.quicktime.HLS",r.value={key:oT[t],data:e[t]},("scte35Out"===t||"scte35In"===t)&&(r.value.data=new Uint8Array(r.value.data.match(/[\da-f]{2}/gi)).buffer),i.addCue(r)}e.processDateRange()})})({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){let s=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();ox(this.inbandTextTracks_,e,this.tech_),(({inbandTextTracks:e,metadataArray:t,timestampOffset:i,videoDuration:s})=>{if(!t)return;let r=g.default.WebKitDataCue||g.default.VTTCue,n=e.metadataTrack_;if(!n||(t.forEach(e=>{let t=e.cueTime+i;"number"!=typeof t||g.default.isNaN(t)||t<0||!(t<1/0)||e.frames&&e.frames.length&&e.frames.forEach(e=>{let i=new r(t,t,e.value||e.url||e.data||"");i.frame=e,i.value=e,ov(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},{}),h=Object.keys(l).sort((e,t)=>Number(e)-Number(t));h.forEach((e,t)=>{let i=l[e],r=isFinite(s)?s:e,n=Number(h[t+1])||r;i.forEach(e=>{e.endTime=n})})})({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:s,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)return void this.contentSteeringController_.requestSteeringManifest(!0);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)),["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(e=>{this.contentSteeringController_.on(e,e=>{this.trigger(v({},e))})}),"dash"===this.sourceType_&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{let e=this.main(),t=this.contentSteeringController_.didDASHTagChange(e.uri,e.contentSteering),i=()=>{let t=this.contentSteeringController_.getAvailablePathways(),i=[];for(let s of e.playlists){let e=s.attributes.serviceLocation;if(e&&(i.push(e),!t.has(e)))return!0}return!i.length&&!!t.size};(t||i())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){let e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();let t=this.main().playlists,i=new Set,s=!1;Object.keys(t).forEach(r=>{let n=t[r],a=this.pathwayAttribute_(n),o=a&&e!==a;1/0!==n.excludeUntil||"content-steering"!==n.lastExcludeReason_||o||(delete n.excludeUntil,delete n.lastExcludeReason_,s=!0);let l=!n.excludeUntil&&1/0!==n.excludeUntil;!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&&(s=!0)}}),s&&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,s]of t.entries())i.get(e)||(this.mainPlaylistLoader_.updateOrDeleteClone(s),this.contentSteeringController_.excludePathway(e));for(let[s,r]of i.entries()){let i=t.get(s);if(!i){e.filter(e=>e.attributes["PATHWAY-ID"]===r["BASE-ID"]).forEach(e=>{this.mainPlaylistLoader_.addClonePathway(r,e)}),this.contentSteeringController_.addAvailablePathway(s);continue}this.equalPathwayClones_(i,r)||(this.mainPlaylistLoader_.updateOrDeleteClone(r,!0),this.contentSteeringController_.addAvailablePathway(s))}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,s=t["URI-REPLACEMENT"].PARAMS;for(let e in i)if(i[e]!==s[e])return!1;for(let e in s)if(i[e]!==s[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 s=this.mainPlaylistLoader_.getKeyIdSet(i);s&&s.size&&s.forEach(s=>{let r="usable",n=this.keyStatusMap_.has(s)&&this.keyStatusMap_.get(s)===r,a=i.lastExcludeReason_===t&&1/0===i.excludeUntil;n?n&&a&&(delete i.excludeUntil,delete i.lastExcludeReason_,this.logger_(`enabling playlist ${i.id} because key ID ${s} is ${r}`)):(1/0!==i.excludeUntil&&i.lastExcludeReason_!==t&&(i.excludeUntil=1/0,i.lastExcludeReason_=t,this.logger_(`excluding playlist ${i.id} because the key ID ${s} doesn't exist in the keyStatusMap or is not ${r}`)),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,s=1/0===e.excludeUntil&&e.lastExcludeReason_===t;i&&s&&(delete e.excludeUntil,nN.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:Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,"0")).join("")).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_()}}class lf{constructor(e,t,i){let s,r,{playlistController_:n}=e,a=n.fastQualityChange_.bind(n);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=aE(n.main(),t),this.playlist=t,this.id=i,this.enabled=(s=e.playlists,r=t.id,e=>{let t=s.main.playlists[r],i=ar(t),n=an(t);if(void 0===e)return n;e?delete t.disabled:t.disabled=!0;let o={renditionInfo:{id:r,bandwidth:t.attributes.BANDWIDTH,resolution:t.attributes.RESOLUTION,codecs:t.attributes.CODECS},cause:"fast-quality"};return e===n||i||(e?(a(t),s.trigger({type:"renditionenabled",metadata:o})):s.trigger({type:"renditiondisabled",metadata:o})),e})}}let lm=function(e){e.representations=()=>{let t=e.playlistController_.main(),i=ad(t)?e.playlistController_.getAudioTrackPlaylists_():t.playlists;return i?i.filter(e=>!ar(e)).map((t,i)=>new lf(e,t,t.id)):[]}},lg=["seeking","seeked","pause","playing","error"];class ly extends nN.EventTarget{constructor(e){super(),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.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=n$("PlaybackWatcher"),this.logger_("initialize");let t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),s=()=>this.techWaiting_(),r=()=>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",s),this.tech_.on(lg,r),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",s),this.tech_.off(lg,r),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_&&g.default.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&g.default.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=g.default.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_`],s=i.buffered_(),r=nZ(this[`${e}Buffered_`],s);if(this[`${e}Buffered_`]=s,r){t.trigger({type:"bufferedrangeschanged",metadata:{bufferedRanges: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:nJ(s)}),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+nz>=t.end(t.length-1)))return this.techWaiting_();if(this.consecutiveUpdates>=5&&e===this.lastRecordedTime)this.consecutiveUpdates++,this.waiting_();else if(e===this.lastRecordedTime)this.consecutiveUpdates++;else{this.playedRanges_.push(nV([this.lastRecordedTime,e]));let t={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:t}),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:nz)}if(void 0!==e)return this.logger_(`Trying to seek outside of seekable at time ${i} with seekable range ${nQ(t)}. Seeking to ${e}.`),this.tech_.setCurrentTime(e),!0;let s=this.playlistController_.sourceUpdater_,r=this.tech_.buffered(),n=s.audioBuffer?s.audioBuffered():null,a=s.videoBuffer?s.videoBuffered():null,o=this.media(),l=o.partTargetDuration?o.partTargetDuration:(o.targetDuration-nH)*2,h=[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_,s=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 r=nX(s,t);return r.length>0&&(this.logger_(`Stopped at ${t} and seeking to ${r.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0)}afterSeekableWindow_(e,t,i,s=!1){if(!e.length)return!1;let r=e.end(e.length-1)+nz,n=!i.endList,a="number"==typeof i.partTargetDuration;return n&&(a||s)&&(r=e.end(e.length-1)+3*i.targetDuration),t>r}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t2)return{start:s,end:r}}return null}}let l_={errorInterval:30,getSource(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},lb=function(e,t){let i=0,s=0,r=nF(l_,t);e.ready(()=>{e.trigger({type:"usage",name:"vhs-error-reload-initialized"})});let n=function(){s&&e.currentTime(s)},a=function(t){null!=t&&(s=1/0!==e.duration()&&e.currentTime()||0,e.one("loadedmetadata",n),e.src(t),e.trigger({type:"usage",name:"vhs-error-reload"}),e.play())},o=function(){return Date.now()-i<1e3*r.errorInterval?void e.trigger({type:"usage",name:"vhs-error-reload-canceled"}):r.getSource&&"function"==typeof r.getSource?(i=Date.now(),r.getSource.call(e,a)):void nN.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")},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(),lb(e,t)}};var lv="3.17.5";let lT={PlaylistLoader:aN,Playlist:au,utils:az,STANDARD_PLAYLIST_SELECTOR:om,INITIAL_PLAYLIST_SELECTOR:function(){let e=this.playlists.main.playlists.filter(au.isEnabled);return oc(e,(e,t)=>op(e,t)),e.filter(e=>!!aE(this.playlists.main,e).video)[0]||null},lastBandwidthSelector:om,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 s=this.useDevicePixelRatio&&g.default.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(s=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),of({main:this.playlists.main,bandwidth:t,playerWidth:parseInt(ou(this.tech_.el(),"width"),10)*s,playerHeight:parseInt(ou(this.tech_.el(),"height"),10)*s,playerObjectFit:this.usePlayerObjectFit?ou(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})}},comparePlaylistBandwidth:op,comparePlaylistResolution:function(e,t){let i,s;return(e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||g.default.Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(s=t.attributes.RESOLUTION.width),i===(s=s||g.default.Number.MAX_VALUE)&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH)?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-s},xhr:aM()};Object.keys(a0).forEach(e=>{Object.defineProperty(lT,e,{get:()=>(nN.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),a0[e]),set(t){(nN.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),"number"!=typeof t||t<0)?nN.log.warn(`value of Vhs.${e} must be greater than or equal to 0`):a0[e]=t}})});let lS="videojs-vhs",lx=function(e,t){let i=t.media(),s=-1;for(let t=0;t{e.addQualityLevel(t)}),lx(e,t.playlists)};lT.canPlaySource=function(){return nN.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};let lE=()=>{if(!g.default.localStorage)return null;let e=g.default.localStorage.getItem(lS);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}},lk=(e,t)=>{e._requestCallbackSet||(e._requestCallbackSet=new Set),e._requestCallbackSet.add(t)},lC=(e,t)=>{e._responseCallbackSet||(e._responseCallbackSet=new Set),e._responseCallbackSet.add(t)},lI=(e,t)=>{e._requestCallbackSet&&(e._requestCallbackSet.delete(t),e._requestCallbackSet.size||delete e._requestCallbackSet)},lA=(e,t)=>{e._responseCallbackSet&&(e._responseCallbackSet.delete(t),e._responseCallbackSet.size||delete e._responseCallbackSet)};lT.supportsNativeHls=function(){if(!y.default||!y.default.createElement)return!1;let e=y.default.createElement("video");return!!nN.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))})}(),lT.supportsNativeDash=!!y.default&&!!y.default.createElement&&!!nN.getTech("Html5").isSupported()&&/maybe|probably/i.test(y.default.createElement("video").canPlayType("application/dash+xml")),lT.supportsTypeNatively=e=>"hls"===e?lT.supportsNativeHls:"dash"===e&&lT.supportsNativeDash,lT.isSupported=function(){return nN.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},lT.xhr.onRequest=function(e){lk(lT.xhr,e)},lT.xhr.onResponse=function(e){lC(lT.xhr,e)},lT.xhr.offRequest=function(e){lI(lT.xhr,e)},lT.xhr.offResponse=function(e){lA(lT.xhr,e)};let lD=nN.getComponent("Component");class lP extends lD{constructor(e,t,i){if(super(t,i.vhs),"number"==typeof i.initialBandwidth&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=n$("VhsHandler"),t.options_&&t.options_.playerId){let e=nN.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(y.default,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],e=>{let t=y.default.fullscreenElement||y.default.webkitFullscreenElement||y.default.mozFullScreenElement||y.default.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_=nF(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_.usePlayerObjectFit=this.options_.usePlayerObjectFit||!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=void 0===this.options_.useNetworkInformationApi||this.options_.useNetworkInformationApi,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=lE();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=a0.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===a0.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","usePlayerObjectFit","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,this.usePlayerObjectFit=this.options_.usePlayerObjectFit;let t=this.options_.customPixelRatio;"number"==typeof t&&t>=0&&(this.customPixelRatio=t)}setOptions(e={}){this.setOptions_(e)}src(e,t){var i;if(!e)return;this.setOptions_(),this.options_.src=0===(i=this.source_.src).toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(i.substring(i.indexOf(",")+1)):i,this.options_.tech=this.tech_,this.options_.externVhs=lT,this.options_.sourceType=X(t),this.options_.seekTo=e=>{this.tech_.setCurrentTime(e)},this.options_.player_=this.player_,this.playlistController_=new lp(this.options_);let s=nF({liveRangeSafeTimeDelta:nz},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new ly(s),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{let e=nN.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?lT.movingAverageBandwidthSelector(.55):lT.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):r.bind(this),this.playlistController_.selectInitialPlaylist=lT.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=g.default.navigator.connection||g.default.navigator.mozConnection||g.default.navigator.webkitConnection;if(this.options_.useNetworkInformationApi&&t){let i=1e3*t.downlink*1e3;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(){nN.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:()=>nJ(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:()=>nJ(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&&(e=>{if(!g.default.localStorage)return;let t=lE();t=t?nF(t,e):e;try{g.default.localStorage.setItem(lS,JSON.stringify(t))}catch(e){return!1}})({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{lm(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_=g.default.URL.createObjectURL(this.playlistController_.mediaSource),(nN.browser.IS_ANY_SAFARI||nN.browser.IS_IOS)&&this.options_.overrideNative&&"hls"===this.options_.sourceType&&"function"==typeof this.tech_.addSourceElement?(this.tech_.addSourceElement(this.mediaSourceUrl_),this.tech_.addSourceElement(this.source_.src)):this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){let e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),(({player:e,sourceKeySystems:t,audioMedia:i,mainPlaylists:s})=>{let r,n;if(!e.eme.initializeMediaKeys)return Promise.resolve();let a=(r=i?s.concat([i]):s,n=Object.keys(t),r.reduce((e,t)=>{if(!t.contentProtection)return e;let i=n.reduce((e,i)=>{let s=t.contentProtection[i];return s&&s.pssh&&(e[i]={pssh:s.pssh}),e},{});return Object.keys(i).length&&e.push(i),e},[])),o=[],l=[];return a.forEach(t=>{l.push(new Promise((t,i)=>{e.tech_.one("keysessioncreated",t)})),o.push(new Promise((i,s)=>{e.eme.initializeMediaKeys({keySystems:t},e=>{e?s(e):i()})}))}),Promise.race([Promise.all(o),Promise.race(l)])})({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})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){let e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=(({player:e,sourceKeySystems:t,media:i,audioMedia:s})=>{let r=((e,t,i)=>{if(!e)return e;let s={};t&&t.attributes&&t.attributes.CODECS&&(s=ax(B(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(s.audio=i.attributes.CODECS);let r=F(s.video),n=F(s.audio),a={};for(let i in e)a[i]={},n&&(a[i].audioContentType=n),r&&(a[i].videoContentType=r),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 nF(e,a)})(t,i,s);return!!r&&(e.currentSource().keySystems=r,!r||!!e.eme||(nN.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1))})({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});(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.createKeySessions_():this.playlistController_.sourceUpdater_.initializedEme()}setupQualityLevels_(){let e=nN.players[this.tech_.options_.playerId];e&&e.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{lw(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{lx(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":lv,"mux.js":"7.1.0","mpd-parser":"1.4.0","m3u8-parser":"7.2.0","aes-decrypter":"4.0.2"}}version(){return this.constructor.version()}canChangeType(){return oK.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_&&g.default.URL.revokeObjectURL&&(g.default.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return(({playlist:e,time:t,callback:i})=>{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 s=((e,t)=>{let i;if(!t||!t.segments||0===t.segments.length)return null;let s=0;for(let r=0;rs){if(e>s+.25*r.duration)return null;i=r}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:s-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}})(t,e);if(!s)return i({message:"valid programTime was not found"});if("estimate"===s.type)return i({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:s.estimatedStart});let r={mediaSeconds:t},n=((e,t)=>{if(!t.dateTimeObject)return null;let i=t.videoTimingInfo.transmuxerPrependedSeconds,s=t.videoTimingInfo.transmuxedPresentationStart;return new Date(t.dateTimeObject.getTime()+1e3*(e-(s+i)))})(t,s.segment);return n&&(r.programDateTime=n.toISOString()),i(null,r)})({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,s=2){return aW({programTime:e,playlist:this.playlistController_.media(),retryCount:s,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{lk(this.xhr,e)},this.xhr.onResponse=e=>{lC(this.xhr,e)},this.xhr.offRequest=e=>{lI(this.xhr,e)},this.xhr.offResponse=e=>{lA(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(e=>{this.playlistController_.on(e,e=>{this.player_.trigger(v({},e))})}),["gapjumped","playedrangeschanged"].forEach(e=>{this.playbackWatcher_.on(e,e=>{this.player_.trigger(v({},e))})})}}let lL={name:"videojs-http-streaming",VERSION:lv,canHandleSource(e,t={}){let i=nF(nN.options,t);return(!!i.vhs.experimentalUseMMS||!!V("avc1.4d400d,mp4a.40.2",!1))&&lL.canPlayType(e.type,i)},handleSource:(e,t,i={})=>(t.vhs=new lP(e,t,nF(nN.options,i)),t.vhs.xhr=aM(),t.vhs.setupXhrHooks_(),t.vhs.src(e.src,e.type),t.vhs),canPlayType(e,t){let i=X(e);if(!i)return"";let s=lL.getOverrideNative(t);return!lT.supportsTypeNatively(i)||s?"maybe":""},getOverrideNative(e={}){let{vhs:t={}}=e,i=!(nN.browser.IS_ANY_SAFARI||nN.browser.IS_IOS),{overrideNative:s=i}=t;return s}};V("avc1.4d400d,mp4a.40.2",!0)&&nN.getTech("Html5").registerSourceHandler(lL,0),nN.VhsHandler=lP,nN.VhsSourceHandler=lL,nN.Vhs=lT,nN.use||nN.registerComponent("Vhs",lT),nN.options.vhs=nN.options.vhs||{},nN.getPlugin&&nN.getPlugin("reloadSourceOnError")||nN.registerPlugin("reloadSourceOnError",function(e){lb(this,e)});var lO=e.i(574186),lN=e.i(456310);let lR=new String(".video-wrapper.jsx-1de89da5559329e7{height:100%}.video-wrapper.portrait.jsx-1de89da5559329e7{justify-content:center;align-items:center;margin:auto;display:flex}@media (width>=768px){.video-wrapper.portrait.jsx-1de89da5559329e7{max-width:280px}}@media (width>=1024px){.video-wrapper.portrait.jsx-1de89da5559329e7{max-width:600px}}@media (width<=375px) and (height<=667px){.video-wrapper.portrait.jsx-1de89da5559329e7:not(.large-portrait-video){max-width:200px}}@media (width<=414px) and (height<=736px){.video-wrapper.portrait.jsx-1de89da5559329e7:not(.large-portrait-video){max-width:200px}}@media (width<=767px){:is(.portrait.video-wrapper>.vjs-fluid.video-js,.vjs-16-9.video-js,.vjs-4-3.video-js){height:400px}}@media (width>=768px){:is(.portrait.video-wrapper>.vjs-fluid.video-js,.vjs-16-9.video-js,.vjs-4-3.video-js){height:600px}}@media (width>=1024px){:is(.portrait.video-wrapper>.vjs-fluid.video-js,.vjs-16-9.video-js,.vjs-4-3.video-js){height:600px}}.video-js .vjs-big-play-button{border:3px solid var(--text-always-white);background-color:var(--button-high-contrast);border-radius:50%;width:3em;height:3em}.video-js .vjs-big-play-button:hover{background-color:var(--button-high-contrast-hover)}.video-js .vjs-big-play-button .vjs-icon-placeholder{font-size:2.5em;line-height:1.15em}");lR.__hash="1de89da5559329e7";let lM=()=>Math.random().toString(36).substring(7);class lU extends c.default.Component{constructor(e){super(e),this.state={videoPlayId:lM(),countTimeSpendOnVideo:!1,totalTimeSpendOnVideo:0,shouldSendTimeSpendTracking:!0},this.countTimeSpend=this.countTimeSpend.bind(this)}componentDidMount(){this.player=nN(this.videoNode,this.props,function(){console.log("onPlayerReady",this)}),["timeupdate","play","playing","pause","ended","error","waiting"].forEach(e=>{"timeupdate"===e&&this.player.on(e,()=>this.onTimeUpdate(this.player)),("playing"===e||"pause"===e)&&this.player.on(e,()=>this.onPlayPause(this.player,e))}),this.countTimeSpend(),window.onbeforeunload=e=>{this.onEnded()}}componentWillUnmount(){this.player&&this.player.dispose(),this.timeSpendCounter&&clearInterval(this.timeSpendCounter),this.onEnded()}countTimeSpend(){let{countTimeSpendOnVideo:e,totalTimeSpendOnVideo:t}=this.state,i=this,s=t;this.timeSpendCounter=setInterval(()=>{e&&(s+=1,i.setState({totalTimeSpendOnVideo:s}))},1e3)}onEnded(){let{api:e,attachment:t,thread:i,post:s}=this.props,{totalTimeSpendOnVideo:r,videoPlayId:n,shouldSendTimeSpendTracking:a}=this.state;e.onAuthenticated(()=>{let o=new lO.U(e),l=lN.f.TinhteFact_Video_Total_Time_Spend,h=[{key:"video_play_id",value:n},{key:"attachment_id",value:t?t.attachment_id:null},{key:"total_time_spend_on_video",value:r},{key:"thread_id",value:i?i.id:null},{key:"post_id",value:i?s.id:null}];a&&o.trackEvent(l,e.getUserId(),h)}),this.setState({videoPlayId:lM(),totalTimeSpendOnVideo:0,shouldSendTimeSpendTracking:!1}),this.props.onEnded&&this.props.onEnded()}onTimeUpdate(e){let t=Math.floor(e.duration()),i=Math.floor(e.currentTime());i>0&&i==t&&this.onEnded()}onPlayPause(e,t){let{api:i,attachment:s,thread:r,post:n}=this.props,{videoPlayId:a}=this.state;i.onAuthenticated(()=>{let e=new lO.U(i),o="playing"===t?lN.f.TinhteFact_Video_Play_Start:lN.f.TinhteFact_Video_Play_Pause,l=[{key:"video_play_id",value:a},{key:"attachment_id",value:s?s.attachment_id:null},{key:"thread_id",value:r?r.id:null},{key:"post_id",value:r?n.id:null}];e.trackEvent(o,i.getUserId(),l)}),this.setState({countTimeSpendOnVideo:"playing"===t},()=>{"playing"===t?(this.countTimeSpend(),this.setState({shouldSendTimeSpendTracking:!0})):clearInterval(this.timeSpendCounter)})}tooglePlayPauseVideo(e){let{autoPlayWhenInView:t}=this.props;this.player&&(t&&e&&this.player.play(),e||this.player.pause())}render(){let e="landscape",{videoRatio:t,largePortraitVideo:i}=this.props;return t&&t<1&&(e="portrait"),(0,d.jsx)(m.z,{threshold:.5,root:this.props.root,as:"div",onChange:e=>this.tooglePlayPauseVideo(e),children:(0,d.jsxs)("div",{className:`jsx-${lR.__hash} video-wrapper ${e} ${i?"large-portrait-video":""}`,children:[(0,d.jsx)("div",{"data-vjs-player":!0,className:`jsx-${lR.__hash}`,children:(0,d.jsx)("video",{ref:e=>this.videoNode=e,className:`jsx-${lR.__hash} video-js vjs-default-skin vjs-fluid vjs-big-play-centered`})}),(0,d.jsx)(u.default,{id:lR.__hash,children:lR})]})})}}let lj=(0,p.f)(f.f.ApiConsumer(lU),{errorMsg:"Lỗi video..."});e.s(["f",0,lj],587388)},6788,e=>{var t,i=e.i(191788);function s(){return(s=Object.assign.bind()).apply(null,arguments)}e.s(["f",0,function(e){return i.createElement("svg",s({xmlns:"http://www.w3.org/2000/svg",width:21,height:20,viewBox:"0 0 21 20"},e),t||(t=i.createElement("path",{fill:"#606670",fillRule:"evenodd",d:"M18.441 0H2.56C1.146 0 0 1.187 0 2.65v10.195c0 1.464 1.146 2.65 2.56 2.65L2.54 20l6.073-4.504h9.828c1.414 0 2.559-1.187 2.559-2.651V2.65C21 1.187 19.855 0 18.441 0m0 1.523c.601 0 1.09.506 1.09 1.128v10.194c0 .622-.489 1.128-1.09 1.128h-10.3l-.383.284-3.736 2.77.007-1.525.006-1.529H2.56c-.6 0-1.09-.506-1.09-1.128V2.65c0-.622.49-1.128 1.09-1.128h15.882"})))}])}],9255,(e,t,i)=>{function s(){return t.exports=s=Object.assign||function(e){for(var t=1;t{var s=e.r(689965),r=e.r(694823),n=e.r(17383),a=e.r(338222),o=r.DOMImplementation,l=s.NAMESPACE,h=a.ParseError,d=a.XMLReader;function u(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function c(e){this.options=e||{locator:{}}}function p(){this.cdata=!1}function f(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function m(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function g(e,t,i){return"string"==typeof e?e.substr(t,i):e.length>=t+i||t?new java.lang.String(e,t,i)+"":e}function y(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}c.prototype.parseFromString=function(e,t){var i=this.options,s=new d,r=i.domBuilder||new p,a=i.errorHandler,o=i.locator,h=i.xmlns||{},c=/\/x?html?$/.test(t),f=c?n.HTML_ENTITIES:n.XML_ENTITIES;o&&r.setDocumentLocator(o),s.errorHandler=function(e,t,i){if(!e){if(t instanceof p)return t;e=t}var s={},r=e instanceof Function;function n(t){var n=e[t];!n&&r&&(n=2==e.length?function(i){e(t,i)}:e),s[t]=n&&function(e){n("[xmldom "+t+"] "+e+m(i))}||function(){}}return i=i||{},n("warning"),n("error"),n("fatalError"),s}(a,r,o),s.domBuilder=i.domBuilder||r,c&&(h[""]=l.HTML),h.xml=h.xml||l.XML;var g=i.normalizeLineEndings||u;return e&&"string"==typeof e?s.parse(g(e),h,f):s.errorHandler.error("invalid doc source"),r.doc},p.prototype={startDocument:function(){this.doc=new o().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,i,s){var r=this.doc,n=r.createElementNS(e,i||t),a=s.length;y(this,n),this.currentElement=n,this.locator&&f(this.locator,n);for(var o=0;o{var s=e.r(689965),r=s.find,n=s.NAMESPACE,a=s.tagNamePattern;function o(e){return""!==e}function l(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function h(e){return e?Object.keys((e?e.split(/[\t\n\f\r ]+/).filter(o):[]).reduce(l,{})):[]}function d(e,t){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}function u(e,t){var i=e.prototype;if(!(i instanceof t)){function s(){}s.prototype=t.prototype,d(i,s=new s),e.prototype=i=s}i.constructor!=e&&("function"!=typeof e&&console.error("unknown Class:"+e),i.constructor=e)}var c={},p=c.ELEMENT_NODE=1,f=c.ATTRIBUTE_NODE=2,m=c.TEXT_NODE=3,g=c.CDATA_SECTION_NODE=4,y=c.ENTITY_REFERENCE_NODE=5,_=c.ENTITY_NODE=6,b=c.PROCESSING_INSTRUCTION_NODE=7,v=c.COMMENT_NODE=8,T=c.DOCUMENT_NODE=9,S=c.DOCUMENT_TYPE_NODE=10,x=c.DOCUMENT_FRAGMENT_NODE=11,w=c.NOTATION_NODE=12,E={},k={};k[1]="Index size error",E.INDEX_SIZE_ERR=1,k[2]="DOMString size error",E.DOMSTRING_SIZE_ERR=2;var C=(k[3]="Hierarchy request error",E.HIERARCHY_REQUEST_ERR=3);k[4]="Wrong document",E.WRONG_DOCUMENT_ERR=4;var I=(k[5]="Invalid character",E.INVALID_CHARACTER_ERR=5);k[6]="No data allowed",E.NO_DATA_ALLOWED_ERR=6,k[7]="No modification allowed",E.NO_MODIFICATION_ALLOWED_ERR=7;var A=(k[8]="Not found",E.NOT_FOUND_ERR=8);k[9]="Not supported",E.NOT_SUPPORTED_ERR=9;var D=(k[10]="Attribute in use",E.INUSE_ATTRIBUTE_ERR=10),P=(k[11]="Invalid state",E.INVALID_STATE_ERR=11);function L(e,t){if(t instanceof Error)var i=t;else i=this,Error.call(this,k[e]),this.message=k[e],Error.captureStackTrace&&Error.captureStackTrace(this,L);return i.code=e,t&&(this.message=this.message+": "+t),i}function O(){}function N(e,t){this._node=e,this._refresh=t,R(this)}function R(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var i=e._refresh(e._node);if(eT(e,"length",i.length),!e.$$length||i.length=0){for(var r=t.length-1;s"==e&&">"||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function H(e,t){return z(e,null,{enter:function(e){return!t(e)||z.STOP}})===z.STOP}function z(e,t,i){for(var s=[{node:e,context:t,phase:z.ENTER}];s.length>0;){var r=s.pop();if(r.phase===z.ENTER){var n=i.enter(r.node,r.context);if(n===z.STOP)return z.STOP;if(s.push({node:r.node,context:n,phase:z.EXIT}),null==n)continue;for(var a=r.node.lastChild;a;)s.push({node:a,context:n,phase:z.ENTER}),a=a.previousSibling}else i.exit&&i.exit(r.node,r.context)}}function W(){this.ownerDocument=this}function G(e,t,i,s){e&&e._inc++,i.namespaceURI===n.XMLNS&&delete t._nsMap[i.prefix?i.localName:""]}function X(e,t,i){if(e&&e._inc){e._inc++;var s=t.childNodes;if(i)s[s.length++]=i;else{for(var r=t.firstChild,n=0;r;)s[n++]=r,r=r.nextSibling;s.length=n,delete s[s.length]}}}function K(e,t){var i=t.previousSibling,s=t.nextSibling;return i?i.nextSibling=s:e.firstChild=s,s?s.previousSibling=i:e.lastChild=i,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,X(e.ownerDocument,e),t}function Y(e){return e&&e.nodeType===F.DOCUMENT_TYPE_NODE}function Q(e){return e&&e.nodeType===F.ELEMENT_NODE}function J(e){return e&&e.nodeType===F.TEXT_NODE}function Z(e,t){var i=e.childNodes||[];if(r(i,Q)||Y(t))return!1;var s=r(i,Y);return!(t&&s&&i.indexOf(s)>i.indexOf(t))}function ee(e,t){var i=e.childNodes||[];if(r(i,function(e){return Q(e)&&e!==t}))return!1;var s=r(i,Y);return!(t&&s&&i.indexOf(s)>i.indexOf(t))}function et(e,t,i){var s=e.childNodes||[],n=t.childNodes||[];if(t.nodeType===F.DOCUMENT_FRAGMENT_NODE){var a=n.filter(Q);if(a.length>1||r(n,J))throw new L(C,"More than one element or text in fragment");if(1===a.length&&!ee(e,i))throw new L(C,"Element in fragment can not be inserted before doctype")}if(Q(t)&&!ee(e,i))throw new L(C,"Only one element can be added and only after doctype");if(Y(t)){if(r(s,function(e){return Y(e)&&e!==i}))throw new L(C,"Only one doctype is allowed");var o=r(s,Q);if(i&&s.indexOf(o)1||r(n,J))throw new L(C,"More than one element or text in fragment");if(1===a.length&&!Z(e,i))throw new L(C,"Element in fragment can not be inserted before doctype")}if(Q(t)&&!Z(e,i))throw new L(C,"Only one element can be added and only after doctype");if(Y(t)){if(r(s,Y))throw new L(C,"Only one doctype is allowed");var o=r(s,Q);if(i&&s.indexOf(o)=0;E--){var k=r[E];if(""===k.prefix&&k.namespace===e.namespaceURI){h=k.namespace;break}}if(h!==e.namespaceURI)for(var E=r.length-1;E>=0;E--){var k=r[E];if(k.namespace===e.namespaceURI){k.prefix&&(_=k.prefix+":"+c);break}}}if(o&&!a.test(_))throw new L(P,'The element name "'+_+'" is not a valid XML QName');t.push("<",_);for(var C=r.slice(),I=0;I"),null;if(t.push(">"),l&&/^script$/i.test(c)){for(;M;)M.data?t.push(M.data):ev(M,t,l,s,C.slice(),o),M=M.nextSibling;return t.push(""),null}return{ns:C,isHTML:l,tag:_};case T:case x:return{ns:r.slice(),isHTML:l,tag:null};case f:return eb(t,e.name,e.value,o),null;case m:return t.push(e.data.replace(/[<&>]/g,V)),null;case g:if(o&&-1!==e.data.indexOf("]]>"))throw new L(P,'The CDATASection data contains "]]>"');return t.push("/g,"]]]]>"),"]]>"),null;case v:if(o&&-1!==e.data.indexOf("-->"))throw new L(P,'The comment node data contains "-->"');return t.push(""),null;case S:if(o){if(!a.test(e.name))throw new L(P,'The doctype name "'+e.name+'" is not a valid XML Name');if(e.publicId&&!/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(e.publicId))throw new L(P,"DocumentType publicId is not a valid PubidLiteral");if(e.systemId&&!/^("[^"]*"|'[^']*')$/.test(e.systemId))throw new L(P,"DocumentType systemId is not a valid SystemLiteral");if(e.internalSubset&&-1!==e.internalSubset.indexOf("]>"))throw new L(P,'DocumentType internalSubset contains "]>"')}var U=e.publicId,j=e.systemId;if(t.push("");else if(j&&"."!=j)t.push(" SYSTEM ",j,">");else{var B=e.internalSubset;B&&t.push(" [",B,"]"),t.push(">")}return null;case b:if(o){if(!a.test(e.target)||-1!==e.target.indexOf(":")||"xml"===e.target.toLowerCase())throw new L(P,'The processing instruction target "'+e.target+'" is not a valid XML NCName or is reserved');if(-1!==e.data.indexOf("?>"))throw new L(P,'The ProcessingInstruction data contains "?>"')}return t.push(""),null;case y:if(o&&!a.test(e.nodeName))throw new L(P,'The entity reference name "'+e.nodeName+'" is not a valid XML Name');return t.push("&",e.nodeName,";"),null;default:return t.push("??",e.nodeName),null}},exit:function(e,i){i&&i.tag&&t.push("")}})}function eT(e,t,i){e[t]=i}k[12]="Syntax error",E.SYNTAX_ERR=12,k[13]="Invalid modification",E.INVALID_MODIFICATION_ERR=13,k[14]="Invalid namespace",E.NAMESPACE_ERR=14,k[15]="Invalid access",E.INVALID_ACCESS_ERR=15,L.prototype=Error.prototype,d(E,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 s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&i[s]===e)return s}t=t.nodeType==f?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==f?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},d(c,F),d(c,F.prototype),z.STOP=Symbol("walkDOM.STOP"),z.ENTER=0,z.EXIT=1,W.prototype={nodeName:"#document",nodeType:T,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==x){for(var i=e.firstChild;i;){var s=i.nextSibling;this.insertBefore(i,t),i=s}return e}return ei(this,e,t),es(e,this),null===this.documentElement&&e.nodeType===p&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),K(this,e)},replaceChild:function(e,t){ei(this,e,t,et),es(e,this),t&&this.removeChild(t),Q(e)&&(this.documentElement=e)},importNode:function(e,t){var i,s,r,n;return i=this,s=e,r=t,z(s,null,{enter:function(e,t){var s=e.cloneNode(!1);return s.ownerDocument=i,s.parentNode=null,null===t?n=s:t.appendChild(s),e.nodeType===f||r?s:null}}),n},getElementById:function(e){var t=null;return H(this.documentElement,function(i){if(i.nodeType==p&&i.getAttribute("id")==e)return t=i,!0}),t},getElementsByClassName:function(e){var t=h(e);return new N(this,function(i){var s=[];return t.length>0&&H(i.documentElement,function(r){if(r!==i&&r.nodeType===p){var n=r.getAttribute("class");if(n){var a=e===n;if(!a){var o=h(n);a=t.every(function(e){return o&&-1!==o.indexOf(e)})}a&&s.push(r)}}}),s})},createElement:function(e){var t=new er;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new O,(t.attributes=new M)._ownerElement=t,t},createDocumentFragment:function(){var e=new ef;return e.ownerDocument=this,e.childNodes=new O,e},createTextNode:function(e){var t=new eo;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new el;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){if(-1!==e.indexOf("]]>"))throw new L(I,'data contains "]]>"');var t=new eh;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var i=new em;return i.ownerDocument=this,i.tagName=i.nodeName=i.target=e,i.nodeValue=i.data=t,i},createAttribute:function(e){var t=new en;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){if(!a.test(e))throw new L(I,'not a valid xml name "'+e+'"');var t=new ep;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var i=new er,s=t.split(":"),r=i.attributes=new M;return i.childNodes=new O,i.ownerDocument=this,i.nodeName=t,i.tagName=t,i.namespaceURI=e,2==s.length?(i.prefix=s[0],i.localName=s[1]):i.localName=t,r._ownerElement=i,i},createAttributeNS:function(e,t){var i=new en,s=t.split(":");return i.ownerDocument=this,i.nodeName=t,i.name=t,i.namespaceURI=e,i.specified=!0,2==s.length?(i.prefix=s[0],i.localName=s[1]):i.localName=t,i}},u(W,F),er.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===x?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,X(this.ownerDocument,this,e),es(e,this.ownerDocument||this),e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var i=this.getAttributeNodeNS(e,t);i&&this.removeAttributeNode(i)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var i=this.getAttributeNodeNS(e,t);return i&&i.value||""},setAttributeNS:function(e,t,i){var s=this.ownerDocument.createAttributeNS(e,t);s.value=s.nodeValue=""+i,this.setAttributeNode(s)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new N(this,function(t){var i=[];return H(t,function(s){s!==t&&s.nodeType==p&&("*"===e||s.tagName==e)&&i.push(s)}),i})},getElementsByTagNameNS:function(e,t){return new N(this,function(i){var s=[];return H(i,function(r){r!==i&&r.nodeType===p&&("*"===e||r.namespaceURI===e)&&("*"===t||r.localName==t)&&s.push(r)}),s})}},W.prototype.getElementsByTagName=er.prototype.getElementsByTagName,W.prototype.getElementsByTagNameNS=er.prototype.getElementsByTagNameNS,u(er,F),en.prototype.nodeType=f,u(en,F),ea.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(k[C])},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}},u(ea,F),eo.prototype={nodeName:"#text",nodeType:m,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 s=this.ownerDocument.createTextNode(i);return this.parentNode&&this.parentNode.insertBefore(s,this.nextSibling),s}},u(eo,ea),el.prototype={nodeName:"#comment",nodeType:v},u(el,ea),eh.prototype={nodeName:"#cdata-section",nodeType:g},u(eh,ea),ed.prototype.nodeType=S,u(ed,F),eu.prototype.nodeType=w,u(eu,F),ec.prototype.nodeType=_,u(ec,F),ep.prototype.nodeType=y,u(ep,F),ef.prototype.nodeName="#document-fragment",ef.prototype.nodeType=x,u(ef,F),em.prototype.nodeType=b,u(em,F),eg.prototype.serializeToString=function(e,t,i,s){return ey.call(e,t,i,s)},F.prototype.toString=ey;try{Object.defineProperty&&(Object.defineProperty(N.prototype,"length",{get:function(){return R(this),this.$$length}}),Object.defineProperty(F.prototype,"textContent",{get:function(){if(this.nodeType===p||this.nodeType===x){var e=[];return z(this,null,{enter:function(t){return t.nodeType===p||t.nodeType===x||(t.nodeType===b||t.nodeType===v?null:void e.push(t.nodeValue))}}),e.join("")}return this.nodeValue},set:function(e){switch(this.nodeType){case p:case x: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}}}),eT=function(e,t,i){e["$$"+t]=i})}catch(e){}i.DocumentType=ed,i.DOMException=L,i.DOMImplementation=$,i.Element=er,i.Node=F,i.NodeList=O,i.walkDOM=z,i.XMLSerializer=eg},724290,(e,t,i)=>{var s=e.r(694823);i.DOMImplementation=s.DOMImplementation,i.XMLSerializer=s.XMLSerializer,i.DOMParser=e.r(100291).DOMParser},338222,(e,t,i)=>{var s=e.r(689965).NAMESPACE,r=e.r(689965).tagNamePattern;function n(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,n)}function a(){}function o(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function l(e,t,i){for(var r=e.tagName,n=null,a=e.length;a--;){var o=e[a],l=o.qName,h=o.value,d=l.indexOf(":");if(d>0)var u=o.prefix=l.slice(0,d),c=l.slice(d+1),p="xmlns"===u&&c;else c=l,u=null,p="xmlns"===l&&"";o.localName=c,!1!==p&&(null==n&&(n={},i=Object.create(i)),i[p]=n[p]=h,o.uri=s.XMLNS,t.startPrefixMapping(p,h))}for(var a=e.length;a--;){var u=(o=e[a]).prefix;u&&("xml"===u&&(o.uri=s.XML),"xmlns"!==u&&(o.uri=i[u||""]))}var d=r.indexOf(":");d>0?(u=e.prefix=r.slice(0,d),c=e.localName=r.slice(d+1)):(u=null,c=e.localName=r);var f=e.uri=i[u||""];if(t.startElement(f,c,r,e),!e.closed)return e.currentNSMap=i,e.localNSMap=n,!0;if(t.endElement(f,c,r),n)for(u in n)Object.prototype.hasOwnProperty.call(n,u)&&t.endPrefixMapping(u)}function h(){this.attributeNames={}}n.prototype=Error(),n.prototype.name=n.name,a.prototype={parse:function(e,t,i){var a=this.domBuilder;a.startDocument(),function(e,t){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}(t,t={}),function(e,t,i,a,d){function u(e){var t,s=e.slice(1,-1);return Object.hasOwnProperty.call(i,s)?i[s]:"#"===s.charAt(0)?(t=parseInt(s.substr(1).replace("x","0x")))>65535?String.fromCharCode(55296+((t-=65536)>>10),56320+(1023&t)):String.fromCharCode(t):(d.error("entity not found:"+e),e)}function c(t){if(t>v){var i=e.substring(v,t).replace(/&#?\w+;/g,u);y&&p(v),a.characters(i,0,t-v),v=t}}function p(t,i){for(;t>=m&&(i=g.exec(e));)m=(f=i.index)+i[0].length,y.lineNumber++;y.columnNumber=t-f+1}for(var f=0,m=0,g=/.*(?:\r\n?|\n)|.*$/g,y=a.locator,_=[{currentNSMap:t}],b={},v=0;;){try{var T=e.indexOf("<",v);if(T<0){if(!e.substr(v).match(/^\s*$/)){var S=a.doc,x=S.createTextNode(e.substr(v));S.appendChild(x),a.currentElement=x}return}switch(T>v&&c(T),e.charAt(T+1)){case"/":var w=e.indexOf(">",T+3),E=e.substring(T+2,w).replace(/^([\s\S]*?[^ \t\n\r])?[ \t\n\r]*$/,"$1"),k=_.pop();w<0?(E=e.substring(T+2).replace(/[\s<].*/,""),d.error("end tag name: "+E+" is not complete:"+k.tagName),w=T+1+E.length):E.match(/\s",t);if(s){var r=e.substring(t,s).match(/^<\?(\S*)\s*([\s\S]*?)$/);if(r)return r[0].length,i.processingInstruction(r[1],r[2]),s+2}return -1}(e,T,a);break;case"!":y&&p(T),w=function(e,t,i,s){if("-"===e.charAt(t+2)){if("-"===e.charAt(t+3)){var r=e.indexOf("-->",t+4);if(r>t)return i.comment(e,t+4,r-t-4),r+3;s.error("Unclosed comment")}}else{if("CDATA["==e.substr(t+3,6)){var r=e.indexOf("]]>",t+9);return i.startCDATA(),i.characters(e,t+9,r-t-9),i.endCDATA(),r+3}var n=function(e,t){var i,s=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(r.lastIndex=t,r.exec(e);i=r.exec(e);)if(s.push(i),i[1])return s}(e,t),a=n.length;if(a>1&&/!doctype/i.test(n[0][0])){var o=n[1][0],l=!1,h=!1;a>3&&(/^public$/i.test(n[2][0])?(l=n[3][0],h=a>4&&n[4][0]):/^system$/i.test(n[2][0])&&(h=n[3][0]));var d=n[a-1];return i.startDTD(o,l,h),i.endDTD(),d.index+d[0].length}}return -1}(e,T,a,d);break;default:y&&p(T);var D=new h,P=_[_.length-1].currentNSMap,w=function(e,t,i,r,n,a){function o(e,t,s){i.attributeNames.hasOwnProperty(e)&&a.fatalError("Attribute "+e+" redefined"),i.addValue(e,t.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,n),s)}for(var l,h,d=++t,u=0;;){var c=e.charAt(d);if(0===u&&"<"===c)throw Error("unexpected < in tag name: "+e.slice(t,d));switch(c){case"=":if(1===u)l=e.slice(t,d),u=3;else if(2===u)u=3;else throw Error("attribute equal must after attrName");break;case"'":case'"':if(3===u||1===u)if(1===u&&(a.warning('attribute value must after "="'),l=e.slice(t,d)),t=d+1,(d=e.indexOf(c,t))>0)o(l,h=e.slice(t,d),t-1),u=5;else throw Error("attribute value no end '"+c+"' match");else if(4==u)o(l,h=e.slice(t,d),t),a.warning('attribute "'+l+'" missed start quot('+c+")!!"),t=d+1,u=5;else throw Error('attribute value must after "="');break;case"/":switch(u){case 0:i.setTagName(e.slice(t,d));case 5:case 6:case 7:u=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==u&&i.setTagName(e.slice(t,d)),d;case">":switch(u){case 0:i.setTagName(e.slice(t,d));case 5:case 6:case 7:break;case 4:case 1:"/"===(h=e.slice(t,d)).slice(-1)&&(i.closed=!0,h=h.slice(0,-1));case 2:2===u&&(h=l),4==u?(a.warning('attribute "'+h+'" missed quot(")!'),o(l,h,t)):(s.isHTML(r[""])&&h.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+h+'" missed value!! "'+h+'" instead!!'),o(h,h,t));break;case 3:throw Error("attribute value missed!!")}return d;case"€":c=" ";default:if(c<=" ")switch(u){case 0:i.setTagName(e.slice(t,d)),u=6;break;case 1:l=e.slice(t,d),u=2;break;case 4:var h=e.slice(t,d);a.warning('attribute "'+h+'" missed quot(")!!'),o(l,h,t);case 5:u=6}else switch(u){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,u=1;break;case 5:a.warning('attribute space is required"'+l+'"!!');case 6:u=1,t=d;break;case 3:u=4,t=d;break;case 7:throw Error("elements closed character '/' and '>' must be connected to")}}d++}}(e,T,D,P,u,d),L=D.length;if(!D.closed&&function(e,t,i,s){var r=s[i];return null==r&&((r=e.lastIndexOf(""))",t),a=e.substring(t+1,n);if(/[&<]/.test(a))return/^script$/i.test(i)||(a=a.replace(/&#?\w+;/g,s)),r.characters(a,0,a.length),n}return t+1}(e,w,D.tagName,u,a):w++}}catch(e){if(e instanceof n)throw e;d.error("element parse error: "+e),w=-1}w>v?v=w:c(Math.max(T,v)+1)}}(e,t,i,a,this.errorHandler),a.endDocument()}},h.prototype={setTagName:function(e){if(!r.test(e))throw Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,i){if(!r.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.XMLReader=a,i.ParseError=n},690182,(e,t,i)=>{var s,r=e.g;"u">typeof document?s=document:(s=r["__GLOBAL_DOCUMENT_CACHE@4"])||(s=r["__GLOBAL_DOCUMENT_CACHE@4"]={}),t.exports=s},494335,(e,t,i)=>{var s;t.exports=s="u">typeof window?window:e.g},717290,(e,t,i)=>{t.exports=function(e){if(!e)return!1;var t=s.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"u">typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)};var s=Object.prototype.toString},949125,(e,t,i)=>{var s=e.r(190835);t.exports=function(e,t){return s(e,t)}},210573,(e,t,i)=>{var s=e.r(919858).getUint64;t.exports=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:t.getUint32(4),timescale:t.getUint32(8)},r=12;0===i.version?(i.earliestPresentationTime=t.getUint32(r),i.firstOffset=t.getUint32(r+4),r+=8):(i.earliestPresentationTime=s(e.subarray(r)),i.firstOffset=s(e.subarray(r+8)),r+=16),r+=2;var n=t.getUint16(r);for(r+=2;n>0;r+=12,n--)i.references.push({referenceType:(128&e[r])>>>7,referencedSize:0x7fffffff&t.getUint32(r),subsegmentDuration:t.getUint32(r+4),startsWithSap:!!(128&e[r+8]),sapType:(112&e[r+8])>>>4,sapDeltaTime:0xfffffff&t.getUint32(r+8)});return i}},646761,(e,t,i)=>{var s,r,n,a;s=function(e){return 9e4*e},r=function(e,t){return e*t},n=function(e){return e/9e4},t.exports={ONE_SECOND_IN_TS:9e4,secondsToVideoTs:s,secondsToAudioTs:r,videoTsToSeconds:n,audioTsToSeconds:a=function(e,t){return e/t},audioTsToVideoTs:function(e,t){return s(a(e,t))},videoTsToAudioTs:function(e,t){return r(n(e),t)},metadataTsToSeconds:function(e,t,i){return n(i?e:e-t)}}},919858,(e,t,i)=>{t.exports={getUint64:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.getBigUint64?(t=i.getBigUint64(0)){var s={872:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),i=t[0],s=t[1];return(i+s)*3/4-s},t.toByteArray=function(e){var t,i,n=l(e),a=n[0],o=n[1],h=new r((a+o)*3/4-o),d=0,u=o>0?a-4:a;for(i=0;i>16&255,h[d++]=t>>8&255,h[d++]=255&t;return 2===o&&(t=s[e.charCodeAt(i)]<<2|s[e.charCodeAt(i+1)]>>4,h[d++]=255&t),1===o&&(t=s[e.charCodeAt(i)]<<10|s[e.charCodeAt(i+1)]<<4|s[e.charCodeAt(i+2)]>>2,h[d++]=t>>8&255,h[d++]=255&t),h},t.fromByteArray=function(e){for(var t,s=e.length,r=s%3,n=[],a=0,o=s-r;a>18&63]+i[r>>12&63]+i[r>>6&63]+i[63&r]);return n.join("")}(e,a,a+16383>o?o:a+16383));return 1===r?n.push(i[(t=e[s-1])>>2]+i[t<<4&63]+"=="):2===r&&n.push(i[(t=(e[s-2]<<8)+e[s-1])>>10]+i[t>>4&63]+i[t<<2&63]+"="),n.join("")};for(var i=[],s=[],r="u">typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,o=n.length;a0)throw Error("Invalid string. Length must be a multiple of 4");var i=e.indexOf("=");-1===i&&(i=t);var s=i===t?0:4-i%4;return[i,s]}s[45]=62,s[95]=63},230:function(e,t,i){"use strict";var s=i(872),r=i(321),n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function a(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(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 d(e)}return l(e,t,i)}function l(e,t,i){if("string"==typeof e){var s=e,r=t;if(("string"!=typeof r||""===r)&&(r="utf8"),!o.isEncoding(r))throw TypeError("Unknown encoding: "+r);var n=0|p(s,r),l=a(n),h=l.write(s,r);return h!==n&&(l=l.slice(0,h)),l}if(ArrayBuffer.isView(e))return u(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(A(e,ArrayBuffer)||e&&A(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(A(e,SharedArrayBuffer)||e&&A(e.buffer,SharedArrayBuffer)))return function(e,t,i){var s;if(t<0||e.byteLengthtypeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.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 h(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 d(e){return h(e),a(e<0?0:0|c(e))}function u(e){for(var t=e.length<0?0:0|c(e.length),i=a(t),s=0;stypeof 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(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,i){return l(e,t,i)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,i){return(h(e),e<=0)?a(e):void 0!==t?"string"==typeof i?a(e).fill(t,i):a(e).fill(t):a(e)},o.allocUnsafe=function(e){return d(e)},o.allocUnsafeSlow=function(e){return d(e)};function c(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function p(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||A(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);var i=e.length,s=arguments.length>2&&!0===arguments[2];if(!s&&0===i)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":return E(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return C(e).length;default:if(r)return s?-1:E(e).length;t=(""+t).toLowerCase(),r=!0}}function f(e,t,i){var r,n,a,o=!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){var s=e.length;(!t||t<0)&&(t=0),(!i||i<0||i>s)&&(i=s);for(var r="",n=t;n0x7fffffff?i=0x7fffffff:i<-0x80000000&&(i=-0x80000000),(n=i*=1)!=n&&(i=r?0:e.length-1),i<0&&(i=e.length+i),i>=e.length)if(r)return -1;else i=e.length-1;else if(i<0)if(!r)return -1;else i=0;if("string"==typeof t&&(t=o.from(t,s)),o.isBuffer(t))return 0===t.length?-1:y(e,t,i,s,r);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(r)return Uint8Array.prototype.indexOf.call(e,t,i);else return Uint8Array.prototype.lastIndexOf.call(e,t,i);return y(e,[t],i,s,r)}throw TypeError("val must be string, number or Buffer")}function y(e,t,i,s,r){var n,a=1,o=e.length,l=t.length;if(void 0!==s&&("ucs2"===(s=String(s).toLowerCase())||"ucs-2"===s||"utf16le"===s||"utf-16le"===s)){if(e.length<2||t.length<2)return -1;a=2,o/=2,l/=2,i/=2}function h(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(r){var d=-1;for(n=i;no&&(i=o-l),n=i;n>=0;n--){for(var u=!0,c=0;ci&&(e+=" ... "),""},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(e,t,i,s,r){if(A(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.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===s&&(s=0),void 0===r&&(r=this.length),t<0||i>e.length||s<0||r>this.length)throw RangeError("out of range index");if(s>=r&&t>=i)return 0;if(s>=r)return -1;if(t>=i)return 1;if(t>>>=0,i>>>=0,s>>>=0,r>>>=0,this===e)return 0;for(var n=r-s,a=i-t,l=Math.min(n,a),h=this.slice(s,r),d=e.slice(t,i),u=0;u239?4:h>223?3:h>191?2:1;if(r+u<=i)switch(u){case 1:h<128&&(d=h);break;case 2:(192&(n=e[r+1]))==128&&(l=(31&h)<<6|63&n)>127&&(d=l);break;case 3:n=e[r+1],a=e[r+2],(192&n)==128&&(192&a)==128&&(l=(15&h)<<12|(63&n)<<6|63&a)>2047&&(l<55296||l>57343)&&(d=l);break;case 4:n=e[r+1],a=e[r+2],o=e[r+3],(192&n)==128&&(192&a)==128&&(192&o)==128&&(l=(15&h)<<18|(63&n)<<12|(63&a)<<6|63&o)>65535&&l<1114112&&(d=l)}null===d?(d=65533,u=1):d>65535&&(d-=65536,s.push(d>>>10&1023|55296),d=56320|1023&d),s.push(d),r+=u}var c=s,p=c.length;if(p<=4096)return String.fromCharCode.apply(String,c);for(var f="",m=0;mi)throw RangeError("Trying to access beyond buffer length")}function v(e,t,i,s,r,n){if(!o.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>r||te.length)throw RangeError("Index out of range")}function T(e,t,i,s,r,n){if(i+s>e.length||i<0)throw RangeError("Index out of range")}function S(e,t,i,s,n){return t*=1,i>>>=0,n||T(e,t,i,4,34028234663852886e22,-34028234663852886e22),r.write(e,t,i,s,23,4),i+4}function x(e,t,i,s,n){return t*=1,i>>>=0,n||T(e,t,i,8,17976931348623157e292,-17976931348623157e292),r.write(e,t,i,s,52,8),i+8}o.prototype.write=function(e,t,i,s){if(void 0===t)s="utf8",i=this.length,t=0;else if(void 0===i&&"string"==typeof t)s=t,i=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(i)?(i>>>=0,void 0===s&&(s="utf8")):(s=i,i=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var r,n,a,o,l,h,d,u,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");s||(s="utf8");for(var p=!1;;)switch(s){case"hex":return function(e,t,i,s){i=Number(i)||0;var r=e.length-i;s?(s=Number(s))>r&&(s=r):s=r;var n=t.length;s>n/2&&(s=n/2);for(var a=0;a>8,r.push(i%256),r.push(s);return r}(e,this.length-d),this,d,u);default:if(p)throw TypeError("Unknown encoding: "+s);s=(""+s).toLowerCase(),p=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},o.prototype.slice=function(e,t){var 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||b(e,t,this.length);for(var s=this[e],r=1,n=0;++n>>=0,t>>>=0,i||b(e,t,this.length);for(var s=this[e+--t],r=1;t>0&&(r*=256);)s+=this[e+--t]*r;return s},o.prototype.readUInt8=function(e,t){return e>>>=0,t||b(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,i){e>>>=0,t>>>=0,i||b(e,t,this.length);for(var s=this[e],r=1,n=0;++n=(r*=128)&&(s-=Math.pow(2,8*t)),s},o.prototype.readIntBE=function(e,t,i){e>>>=0,t>>>=0,i||b(e,t,this.length);for(var s=t,r=1,n=this[e+--s];s>0&&(r*=256);)n+=this[e+--s]*r;return n>=(r*=128)&&(n-=Math.pow(2,8*t)),n},o.prototype.readInt8=function(e,t){return(e>>>=0,t||b(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||b(e,2,this.length);var i=this[e]|this[e+1]<<8;return 32768&i?0xffff0000|i:i},o.prototype.readInt16BE=function(e,t){e>>>=0,t||b(e,2,this.length);var i=this[e+1]|this[e]<<8;return 32768&i?0xffff0000|i:i},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return e>>>=0,t||b(e,4,this.length),r.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||b(e,4,this.length),r.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||b(e,8,this.length),r.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||b(e,8,this.length),r.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,i,s){if(e*=1,t>>>=0,i>>>=0,!s){var r=Math.pow(2,8*i)-1;v(this,e,t,i,r,0)}var n=1,a=0;for(this[t]=255&e;++a>>=0,i>>>=0,!s){var r=Math.pow(2,8*i)-1;v(this,e,t,i,r,0)}var n=i-1,a=1;for(this[t+n]=255&e;--n>=0&&(a*=256);)this[t+n]=e/a&255;return t+i},o.prototype.writeUInt8=function(e,t,i){return e*=1,t>>>=0,i||v(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,i){return e*=1,t>>>=0,i||v(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUInt16BE=function(e,t,i){return e*=1,t>>>=0,i||v(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUInt32LE=function(e,t,i){return e*=1,t>>>=0,i||v(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUInt32BE=function(e,t,i){return e*=1,t>>>=0,i||v(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeIntLE=function(e,t,i,s){if(e*=1,t>>>=0,!s){var r=Math.pow(2,8*i-1);v(this,e,t,i,r-1,-r)}var n=0,a=1,o=0;for(this[t]=255&e;++n>>=0,!s){var r=Math.pow(2,8*i-1);v(this,e,t,i,r-1,-r)}var n=i-1,a=1,o=0;for(this[t+n]=255&e;--n>=0&&(a*=256);)e<0&&0===o&&0!==this[t+n+1]&&(o=1),this[t+n]=(e/a|0)-o&255;return t+i},o.prototype.writeInt8=function(e,t,i){return e*=1,t>>>=0,i||v(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,i){return e*=1,t>>>=0,i||v(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,i){return e*=1,t>>>=0,i||v(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,i){return e*=1,t>>>=0,i||v(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,i){return e*=1,t>>>=0,i||v(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeFloatLE=function(e,t,i){return S(this,e,t,!0,i)},o.prototype.writeFloatBE=function(e,t,i){return S(this,e,t,!1,i)},o.prototype.writeDoubleLE=function(e,t,i){return x(this,e,t,!0,i)},o.prototype.writeDoubleBE=function(e,t,i){return x(this,e,t,!1,i)},o.prototype.copy=function(e,t,i,s){if(!o.isBuffer(e))throw TypeError("argument should be a Buffer");if(i||(i=0),s||0===s||(s=this.length),t>=e.length&&(t=e.length),t||(t=0),s>0&&s=this.length)throw RangeError("Index out of range");if(s<0)throw RangeError("sourceEnd out of bounds");s>this.length&&(s=this.length),e.length-t=0;--n)e[n+t]=this[n+i];else Uint8Array.prototype.set.call(e,this.subarray(i,s),t);return r},o.prototype.fill=function(e,t,i,s){if("string"==typeof e){if("string"==typeof t?(s=t,t=0,i=this.length):"string"==typeof i&&(s=i,i=this.length),void 0!==s&&"string"!=typeof s)throw TypeError("encoding must be a string");if("string"==typeof s&&!o.isEncoding(s))throw TypeError("Unknown encoding: "+s);if(1===e.length){var r,n=e.charCodeAt(0);("utf8"===s&&n<128||"latin1"===s)&&(e=n)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length>>=0,i=void 0===i?this.length:i>>>0,e||(e=0),"number"==typeof e)for(r=t;r55295&&i<57344){if(!r){if(i>56319||a+1===s){(t-=3)>-1&&n.push(239,191,189);continue}r=i;continue}if(i<56320){(t-=3)>-1&&n.push(239,191,189),r=i;continue}i=(r-55296<<10|i-56320)+65536}else r&&(t-=3)>-1&&n.push(239,191,189);if(r=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 k(e){for(var t=[],i=0;i=t.length)&&!(r>=e.length);++r)t[r+i]=e[r];return r}function A(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var D=function(){for(var e="0123456789abcdef",t=Array(256),i=0;i<16;++i)for(var s=16*i,r=0;r<16;++r)t[s+r]=e[i]+e[r];return t}()},321:function(e,t){t.read=function(e,t,i,s,r){var n,a,o=8*r-s-1,l=(1<>1,d=-7,u=i?r-1:0,c=i?-1:1,p=e[t+u];for(u+=c,n=p&(1<<-d)-1,p>>=-d,d+=o;d>0;n=256*n+e[t+u],u+=c,d-=8);for(a=n&(1<<-d)-1,n>>=-d,d+=s;d>0;a=256*a+e[t+u],u+=c,d-=8);if(0===n)n=1-h;else{if(n===l)return a?0/0:(p?-1:1)*2e308;a+=Math.pow(2,s),n-=h}return(p?-1:1)*a*Math.pow(2,n-s)},t.write=function(e,t,i,s,r,n){var a,o,l,h=8*n-r-1,d=(1<>1,c=5960464477539062e-23*(23===r),p=s?0:n-1,f=s?1:-1,m=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||1/0===t?(o=+!!isNaN(t),a=d):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+u>=1?t+=c/l:t+=c*Math.pow(2,1-u),t*l>=2&&(a++,l/=2),a+u>=d?(o=0,a=d):a+u>=1?(o=(t*l-1)*Math.pow(2,r),a+=u):(o=t*Math.pow(2,u-1)*Math.pow(2,r),a=0));r>=8;e[i+p]=255&o,p+=f,o/=256,r-=8);for(a=a<0;e[i+p]=255&a,p+=f,a/=256,h-=8);e[i+p-f]|=128*m}}},r={};function n(e){var t=r[e];if(void 0!==t)return t.exports;var i=r[e]={exports:{}},a=!0;try{s[e](i,i.exports,n),a=!1}finally{a&&delete r[e]}return i.exports}n.ab="/ROOT/node_modules/next/dist/compiled/buffer/",t.exports=n(230)},590514,(e,t,i)=>{var s=e.r(494335),r=t.exports={WebVTT:e.r(729479),VTTCue:e.r(744733),VTTRegion:e.r(586621)};s.vttjs=r,s.WebVTT=r.WebVTT;var n=r.VTTCue,a=r.VTTRegion,o=s.VTTCue,l=s.VTTRegion;r.shim=function(){s.VTTCue=n,s.VTTRegion=a},r.restore=function(){s.VTTCue=o,s.VTTRegion=l},s.VTTCue||r.shim()},729479,(e,t,i)=>{var s=e.r(690182),r=Object.create||function(){function e(){}return function(t){if(1!=arguments.length)throw Error("Object.create shim only accepts one parameter.");return e.prototype=t,new e}}();function n(e,t){this.name="ParsingError",this.code=e.code,this.message=t||e.message}function a(e){function t(e,t,i,s){return(0|e)*3600+(0|t)*60+(0|i)+(0|s)/1e3}var i=e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return i?i[3]?t(i[1],i[2],i[3].replace(":",""),i[4]):i[1]>59?t(i[1],i[2],0,i[4]):t(0,i[1],i[2],i[4]):null}function o(){this.values=r(null)}function l(e,t,i,s){var r=s?e.split(s):[e];for(var n in r)if("string"==typeof r[n]){var a=r[n].split(i);2===a.length&&t(a[0].trim(),a[1].trim())}}n.prototype=r(Error.prototype),n.prototype.constructor=n,n.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},o.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,i){for(var s=0;s=0)&&!!(t<=100)&&(this.set(e,t),!0)}};var h=s.createElement&&s.createElement("textarea"),d={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},u={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},c={v:"title",lang:"lang"},p={rt:"ruby"};function f(e,t){for(var i,s=e.document.createElement("div"),r=s,n=[];null!==(i=function(){if(!t)return null;var e,i=t.match(/^([^<]*)(<[^>]*>?)?/);return e=i[1]?i[1]:i[2],t=t.substr(e.length),e}());){if("<"===i[0]){if("/"===i[1]){n.length&&n[n.length-1]===i.substr(2).replace(">","")&&(n.pop(),r=r.parentNode);continue}var o,l,f,m,g=a(i.substr(1,i.length-2));if(g){m=e.document.createProcessingInstruction("timestamp",g),r.appendChild(m);continue}var y=i.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!y||!(m=function(t,i){var s=d[t];if(!s)return null;var r=e.document.createElement(s),n=c[t];return n&&i&&(r[n]=i.trim()),r}(y[1],y[3]))||(l=r,p[(f=m).localName]&&p[f.localName]!==l.localName))continue;if(y[2]){var _=y[2].split(".");_.forEach(function(e){var t=/^bg_/.test(e),i=t?e.slice(3):e;if(u.hasOwnProperty(i)){var s=t?"background-color":"color",r=u[i];m.style[s]=r}}),m.className=_.join(" ")}n.push(y[1]),r.appendChild(m),r=m;continue}r.appendChild(e.document.createTextNode((h.innerHTML=o=i,o=h.textContent,h.textContent="",o)))}return s}var m=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function g(){}function y(e,t,i){g.call(this),this.cue=t,this.cueDiv=f(e,t.text);var s={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(s,this.cueDiv),this.div=e.document.createElement("div"),s={direction:function(e){var t=[],i="";if(!e||!e.childNodes)return"ltr";function s(e,t){for(var i=t.childNodes.length-1;i>=0;i--)e.push(t.childNodes[i])}for(s(t,e);i=function e(t){if(!t||!t.length)return null;var i=t.pop(),r=i.textContent||i.innerText;if(r){var n=r.match(/^.*(\n|\r)/);return n?(t.length=0,n[0]):r}return"ruby"===i.tagName?e(t):i.childNodes?(s(t,i),e(t)):void 0}(t);)for(var r=0;r=i[0]&&e<=i[1])return!0}return!1}(i.charCodeAt(r)))return"rtl";return"ltr"}(this.cueDiv),writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===t.align?"center":t.align,font:i.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(s),this.div.appendChild(this.cueDiv);var r=0;switch(t.positionAlign){case"start":case"line-left":r=t.position;break;case"center":r=t.position-t.size/2;break;case"end":case"line-right":r=t.position-t.size}""===t.vertical?this.applyStyles({left:this.formatStyle(r,"%"),width:this.formatStyle(t.size,"%")}):this.applyStyles({top:this.formatStyle(r,"%"),height:this.formatStyle(t.size,"%")}),this.move=function(e){this.applyStyles({top:this.formatStyle(e.top,"px"),bottom:this.formatStyle(e.bottom,"px"),left:this.formatStyle(e.left,"px"),right:this.formatStyle(e.right,"px"),height:this.formatStyle(e.height,"px"),width:this.formatStyle(e.width,"px")})}}function _(e){var t,i,s,r;if(e.div){i=e.div.offsetHeight,s=e.div.offsetWidth,r=e.div.offsetTop;var n=(n=e.div.childNodes)&&(n=n[0])&&n.getClientRects&&n.getClientRects();e=e.div.getBoundingClientRect(),t=n?Math.max(n[0]&&n[0].height||0,e.height/n.length):0}this.left=e.left,this.right=e.right,this.top=e.top||r,this.height=e.height||i,this.bottom=e.bottom||r+(e.height||i),this.width=e.width||s,this.lineHeight=void 0!==t?t:e.lineHeight}function b(){}g.prototype.applyStyles=function(e,t){for(var i in t=t||this.div,e)e.hasOwnProperty(i)&&(t.style[i]=e[i])},g.prototype.formatStyle=function(e,t){return 0===e?0:e+t},y.prototype=r(g.prototype),y.prototype.constructor=y,_.prototype.move=function(e,t){switch(t=void 0!==t?t:this.lineHeight,e){case"+x":this.left+=t,this.right+=t;break;case"-x":this.left-=t,this.right-=t;break;case"+y":this.top+=t,this.bottom+=t;break;case"-y":this.top-=t,this.bottom-=t}},_.prototype.overlaps=function(e){return this.lefte.left&&this.tope.top},_.prototype.overlapsAny=function(e){for(var t=0;t=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},_.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.lefte.right;case"+y":return this.tope.bottom}},_.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)},_.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}},_.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,i=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,s=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||s,height:e.height||t,bottom:e.bottom||s+(e.height||t),width:e.width||i}},b.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},b.convertCueToDOMTree=function(e,t){return e&&t?f(e,t):null},b.processCues=function(e,t,i){if(!e||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var s,r,n=e.document.createElement("div");if(n.style.position="absolute",n.style.left="0",n.style.right="0",n.style.top="0",n.style.bottom="0",n.style.margin="1.5%",i.appendChild(n),!function(e){for(var t=0;t=0&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return -1;for(var t=e.track,i=t.textTrackList,s=0,r=0;rd&&(h=Math.ceil(d/l)*l*(h<0?-1:1)),n<0&&(h+=""===r.vertical?t.height:t.width,a=a.reverse()),s.move(u,h)}else{var c=s.lineHeight/t.height*100;switch(r.lineAlign){case"center":n-=c/2;break;case"end":n-=c}switch(r.vertical){case"":e.applyStyles({top:e.formatStyle(n,"%")});break;case"rl":e.applyStyles({left:e.formatStyle(n,"%")});break;case"lr":e.applyStyles({right:e.formatStyle(n,"%")})}a=["+y","-x","+x","-y"],s=new _(e)}var p=function(e,s){for(var r,n=new _(e),a=1,o=0;ol&&(r=new _(e),a=l),e=new _(n)}return r||n}(s,a);e.move(p.toCSSCompatValues(t))}(s,l,o),r.displayState=s.div,o.push(_.getSimpleBoxPosition(s))},b.Parser=function(e,t,i){i||(i=t,t={}),t||(t={}),this.window=e,this.vttjs=t,this.state="INITIAL",this.buffer="",this.decoder=i||new TextDecoder("utf8"),this.regionList=[]},b.Parser.prototype={reportOrThrowError:function(e){if(e instanceof n)this.onparsingerror&&this.onparsingerror(e);else throw e},parse:function(e){var t=this;function i(){for(var e=t.buffer,i=0;i")){t.cue.id=r;continue}case"CUE":try{!function(e,t,i){var s=e;function r(){var t=a(e);if(null===t)throw new n(n.Errors.BadTimeStamp,"Malformed timestamp: "+s);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function h(){e=e.replace(/^\s+/,"")}if(h(),t.startTime=r(),h(),"-->"!==e.substr(0,3))throw new n(n.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+s);e=e.substr(3),h(),t.endTime=r(),h();var d=e,u=new o;l(d,function(e,t){switch(e){case"region":for(var s=i.length-1;s>=0;s--)if(i[s].id===t){u.set(e,i[s].region);break}break;case"vertical":u.alt(e,t,["rl","lr"]);break;case"line":var r=t.split(","),n=r[0];u.integer(e,n),u.percent(e,n)&&u.set("snapToLines",!1),u.alt(e,n,["auto"]),2===r.length&&u.alt("lineAlign",r[1],["start","center","end"]);break;case"position":r=t.split(","),u.percent(e,r[0]),2===r.length&&u.alt("positionAlign",r[1],["start","center","end"]);break;case"size":u.percent(e,t);break;case"align":u.alt(e,t,["start","center","end","left","right"])}},/:/,/\s/),t.region=u.get("region",null),t.vertical=u.get("vertical","");try{t.line=u.get("line","auto")}catch(e){}t.lineAlign=u.get("lineAlign","start"),t.snapToLines=u.get("snapToLines",!0),t.size=u.get("size",100);try{t.align=u.get("align","center")}catch(e){t.align=u.get("align","middle")}try{t.position=u.get("position","auto")}catch(e){t.position=u.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},t.align)}t.positionAlign=u.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},t.align)}(r,t.cue,t.regionList)}catch(e){t.reportOrThrowError(e),t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var u=-1!==r.indexOf("-->");if(!r||u&&(d=!0)){t.oncue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}t.cue.text&&(t.cue.text+="\n"),t.cue.text+=r.replace(/\u2028/g,"\n").replace(/u2029/g,"\n");continue;case"BADCUE":r||(t.state="ID");continue}}catch(e){t.reportOrThrowError(e),"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){try{if(this.buffer+=this.decoder.decode(),(this.cue||"HEADER"===this.state)&&(this.buffer+="\n\n",this.parse()),"INITIAL"===this.state)throw new n(n.Errors.BadSignature)}catch(e){this.reportOrThrowError(e)}return this.onflush&&this.onflush(),this}},t.exports=b},744733,(e,t,i)=>{var s={"":1,lr:1,rl:1},r={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function n(e){return"string"==typeof e&&!!r[e.toLowerCase()]&&e.toLowerCase()}function a(e,t,i){this.hasBeenReset=!1;var r="",a=!1,o=e,l=t,h=i,d=null,u="",c=!0,p="auto",f="start",m="auto",g="auto",y=100,_="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return r},set:function(e){r=""+e}},pauseOnExit:{enumerable:!0,get:function(){return a},set:function(e){a=!!e}},startTime:{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e)throw TypeError("Start time must be set to a number.");o=e,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return l},set:function(e){if("number"!=typeof e)throw TypeError("End time must be set to a number.");l=e,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return h},set:function(e){h=""+e,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return d},set:function(e){d=e,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return u},set:function(e){var t="string"==typeof e&&!!s[e.toLowerCase()]&&e.toLowerCase();if(!1===t)throw SyntaxError("Vertical: an invalid or illegal direction string was specified.");u=t,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return c},set:function(e){c=!!e,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return p},set:function(e){if("number"!=typeof e&&"auto"!==e)throw SyntaxError("Line: an invalid number or illegal string was specified.");p=e,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return f},set:function(e){var t=n(e);t?(f=t,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return m},set:function(e){if(e<0||e>100)throw Error("Position must be between 0 and 100.");m=e,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return g},set:function(e){var t=n(e);t?(g=t,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return y},set:function(e){if(e<0||e>100)throw Error("Size must be between 0 and 100.");y=e,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return _},set:function(e){var t=n(e);if(!t)throw SyntaxError("align: an invalid or illegal alignment string was specified.");_=t,this.hasBeenReset=!0}}}),this.displayState=void 0}a.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},t.exports=a},586621,(e,t,i)=>{var s={"":!0,up:!0};function r(e){return"number"==typeof e&&e>=0&&e<=100}t.exports=function(){var e=100,t=3,i=0,n=100,a=0,o=100,l="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(t){if(!r(t))throw Error("Width must be between 0 and 100.");e=t}},lines:{enumerable:!0,get:function(){return t},set:function(e){if("number"!=typeof e)throw TypeError("Lines must be set to a number.");t=e}},regionAnchorY:{enumerable:!0,get:function(){return n},set:function(e){if(!r(e))throw Error("RegionAnchorX must be between 0 and 100.");n=e}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(e){if(!r(e))throw Error("RegionAnchorY must be between 0 and 100.");i=e}},viewportAnchorY:{enumerable:!0,get:function(){return o},set:function(e){if(!r(e))throw Error("ViewportAnchorY must be between 0 and 100.");o=e}},viewportAnchorX:{enumerable:!0,get:function(){return a},set:function(e){if(!r(e))throw Error("ViewportAnchorX must be between 0 and 100.");a=e}},scroll:{enumerable:!0,get:function(){return l},set:function(e){var t="string"==typeof e&&!!s[e.toLowerCase()]&&e.toLowerCase();!1===t?console.warn("Scroll: an invalid or illegal string was specified."):l=t}}})}}]);