From 38314785e102b974920eed92fb944a2094887ea8 Mon Sep 17 00:00:00 2001 From: Botsy Date: Wed, 12 Feb 2025 13:49:16 +0000 Subject: [PATCH] deploy: 7f7d8bdb1fb5527ed695ccfd2694c376004ed1f4 --- .../binaries/stremio_core_web_bg.wasm | Bin .../fonts/PlusJakartaSans.ttf | Bin .../scripts/main.js | 2 +- .../scripts/main.js.map | 2 +- .../scripts/worker.js | 2 +- .../scripts/worker.js.map | 2 +- .../styles/main.css | 2 +- .../styles/main.css.map | 2 +- feat/season-episode-inputs/index.html | 2 +- feat/season-episode-inputs/service-worker.js | 2 +- feat/season-episode-inputs/service-worker.js.map | 2 +- 11 files changed, 9 insertions(+), 9 deletions(-) rename feat/season-episode-inputs/{2f7d1c38cd17cc12a945a28e631dd6e4e4e2b546 => 7f7d8bdb1fb5527ed695ccfd2694c376004ed1f4}/binaries/stremio_core_web_bg.wasm (100%) rename feat/season-episode-inputs/{2f7d1c38cd17cc12a945a28e631dd6e4e4e2b546 => 7f7d8bdb1fb5527ed695ccfd2694c376004ed1f4}/fonts/PlusJakartaSans.ttf (100%) rename feat/season-episode-inputs/{2f7d1c38cd17cc12a945a28e631dd6e4e4e2b546 => 7f7d8bdb1fb5527ed695ccfd2694c376004ed1f4}/scripts/main.js (53%) rename feat/season-episode-inputs/{2f7d1c38cd17cc12a945a28e631dd6e4e4e2b546 => 7f7d8bdb1fb5527ed695ccfd2694c376004ed1f4}/scripts/main.js.map (54%) rename feat/season-episode-inputs/{2f7d1c38cd17cc12a945a28e631dd6e4e4e2b546 => 7f7d8bdb1fb5527ed695ccfd2694c376004ed1f4}/scripts/worker.js (99%) rename feat/season-episode-inputs/{2f7d1c38cd17cc12a945a28e631dd6e4e4e2b546 => 7f7d8bdb1fb5527ed695ccfd2694c376004ed1f4}/scripts/worker.js.map (99%) rename feat/season-episode-inputs/{2f7d1c38cd17cc12a945a28e631dd6e4e4e2b546 => 7f7d8bdb1fb5527ed695ccfd2694c376004ed1f4}/styles/main.css (99%) rename feat/season-episode-inputs/{2f7d1c38cd17cc12a945a28e631dd6e4e4e2b546 => 7f7d8bdb1fb5527ed695ccfd2694c376004ed1f4}/styles/main.css.map (99%) diff --git a/feat/season-episode-inputs/2f7d1c38cd17cc12a945a28e631dd6e4e4e2b546/binaries/stremio_core_web_bg.wasm b/feat/season-episode-inputs/7f7d8bdb1fb5527ed695ccfd2694c376004ed1f4/binaries/stremio_core_web_bg.wasm similarity index 100% rename from feat/season-episode-inputs/2f7d1c38cd17cc12a945a28e631dd6e4e4e2b546/binaries/stremio_core_web_bg.wasm rename to feat/season-episode-inputs/7f7d8bdb1fb5527ed695ccfd2694c376004ed1f4/binaries/stremio_core_web_bg.wasm diff --git a/feat/season-episode-inputs/2f7d1c38cd17cc12a945a28e631dd6e4e4e2b546/fonts/PlusJakartaSans.ttf b/feat/season-episode-inputs/7f7d8bdb1fb5527ed695ccfd2694c376004ed1f4/fonts/PlusJakartaSans.ttf similarity index 100% rename from feat/season-episode-inputs/2f7d1c38cd17cc12a945a28e631dd6e4e4e2b546/fonts/PlusJakartaSans.ttf rename to feat/season-episode-inputs/7f7d8bdb1fb5527ed695ccfd2694c376004ed1f4/fonts/PlusJakartaSans.ttf diff --git a/feat/season-episode-inputs/2f7d1c38cd17cc12a945a28e631dd6e4e4e2b546/scripts/main.js b/feat/season-episode-inputs/7f7d8bdb1fb5527ed695ccfd2694c376004ed1f4/scripts/main.js similarity index 53% rename from feat/season-episode-inputs/2f7d1c38cd17cc12a945a28e631dd6e4e4e2b546/scripts/main.js rename to feat/season-episode-inputs/7f7d8bdb1fb5527ed695ccfd2694c376004ed1f4/scripts/main.js index 06c6422d8..bf8f17b86 100644 --- a/feat/season-episode-inputs/2f7d1c38cd17cc12a945a28e631dd6e4e4e2b546/scripts/main.js +++ b/feat/season-episode-inputs/7f7d8bdb1fb5527ed695ccfd2694c376004ed1f4/scripts/main.js @@ -1,2 +1,2 @@ -(()=>{var e,t,a={72888:(e,t,a)=>{"use strict";var i=a(33112),o=i(a(60326)),n=i(a(37731));e.exports=function(e,t){t.addEventListener("message",(function(){var a=(0,n.default)(o.default.mark((function a(i){var n,r,E,_,T,s,S;return o.default.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(n=i.data.request){a.next=3;break}return a.abrupt("return");case 3:if(r=n.id,E=n.path,_=n.args,a.prev=4,"function"!=typeof(T=E.reduce((function(e,t){return e[t]}),e))){a.next=13;break}return S=E.slice(0,E.length-1).reduce((function(e,t){return e[t]}),e),a.next=10,T.apply(S,_);case 10:s=a.sent,a.next=16;break;case 13:return a.next=15,T;case 15:s=a.sent;case 16:t.postMessage({response:{id:r,result:{data:s}}}),a.next=22;break;case 19:a.prev=19,a.t0=a.catch(4),t.postMessage({response:{id:r,result:{error:a.t0}}});case 22:case"end":return a.stop()}}),a,null,[[4,19]])})));return function(e){return a.apply(this,arguments)}})()),this.call=(function(){var e=(0,n.default)(o.default.mark((function e(a,i){var n;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Math.random().toString(32).slice(2),e.abrupt("return",new Promise((function(e,o){t.addEventListener("message",(function a(i){var r=i.data.response;r&&r.id===n&&(t.removeEventListener("message",a),"error"in r.result?o(r.result.error):e(r.result.data))})),t.postMessage({request:{id:n,path:a,args:i}})})));case 2:case"end":return e.stop()}}),e)})));return function(t,a){return e.apply(this,arguments)}})()}},92255:e=>{"use strict";var t=Object.prototype.hasOwnProperty,a="~";function i(){}function o(e,t,a){this.fn=e,this.context=t,this.once=a||!1}function n(e,t,i,n,r){if("function"!=typeof i)throw new TypeError("The listener must be a function");var E=new o(i,n||e,r),_=a?a+t:t;return e._events[_]?e._events[_].fn?e._events[_]=[e._events[_],E]:e._events[_].push(E):(e._events[_]=E,e._eventsCount++),e}function r(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function E(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(a=!1)),E.prototype.eventNames=function(){var e,i,o=[];if(0===this._eventsCount)return o;for(i in e=this._events)t.call(e,i)&&o.push(a?i.slice(1):i);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},E.prototype.listeners=function(e){var t=a?a+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var o=0,n=i.length,r=new Array(n);o= 0x80 (not a basic code point)","invalid-input":"Invalid input"},l=Math.floor,I=String.fromCharCode;function u(e){throw RangeError(S[e])}function A(e,t){for(var a=e.length,i=[];a--;)i[a]=t(e[a]);return i}function d(e,t){var a=e.split("@"),i="";return a.length>1&&(i=a[0]+"@",e=a[1]),i+A((e=e.replace(s,".")).split("."),t).join(".")}function O(e){for(var t,a,i=[],o=0,n=e.length;o=55296&&t<=56319&&o65535&&(t+=I((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=I(e)})).join("")}function R(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function N(e,t,a){var i=0;for(e=a?l(e/700):e>>1,e+=l(e/t);e>455;i+=E)e=l(e/35);return l(i+36*e/(e+38))}function m(e){var t,a,i,o,n,_,T,s,S,I,A,d=[],O=e.length,R=0,m=128,L=72;for((a=e.lastIndexOf("-"))<0&&(a=0),i=0;i=128&&u("not-basic"),d.push(e.charCodeAt(i));for(o=a>0?a+1:0;o=O&&u("invalid-input"),((s=(A=e.charCodeAt(o++))-48<10?A-22:A-65<26?A-65:A-97<26?A-97:E)>=E||s>l((r-R)/_))&&u("overflow"),R+=s*_,!(s<(S=T<=L?1:T>=L+26?26:T-L));T+=E)_>l(r/(I=E-S))&&u("overflow"),_*=I;L=N(R-n,t=d.length+1,0==n),l(R/t)>r-m&&u("overflow"),m+=l(R/t),R%=t,d.splice(R++,0,m)}return c(d)}function L(e){var t,a,i,o,n,_,T,s,S,A,d,c,m,L,D,p=[];for(c=(e=O(e)).length,t=128,a=0,n=72,_=0;_=t&&dl((r-a)/(m=i+1))&&u("overflow"),a+=(T-t)*m,t=T,_=0;_r&&u("overflow"),d==t){for(s=a,S=E;!(s<(A=S<=n?1:S>=n+26?26:S-n));S+=E)D=s-A,L=E-A,p.push(I(R(A+D%L,0))),s=l(D/L);p.push(I(R(s,0))),n=N(a,m,i==o),a=0,++i}++a,++t}return p.join("")}n={version:"1.3.2",ucs2:{decode:O,encode:c},decode:m,encode:L,toASCII:function(e){return d(e,(function(e){return T.test(e)?"xn--"+L(e):e}))},toUnicode:function(e){return d(e,(function(e){return _.test(e)?m(e.slice(4).toLowerCase()):e}))}},void 0===(i=function(){return n}.call(t,a,t,e))||(e.exports=i)})()},36372:(e,t,a)=>{"use strict";var i=a(11176),o=a(89637);function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=R,t.resolve=function(e,t){return R(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?R(e,!1,!0).resolveObject(t):t},t.format=function(e){o.isString(e)&&(e=R(e));return e instanceof n?e.format():n.prototype.format.call(e)},t.Url=n;var r=/^([a-z0-9.+-]+:)/i,E=/:[0-9]*$/,_=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,T=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),s=["'"].concat(T),S=["%","/","?",";","#"].concat(s),l=["/","?","#"],I=/^[+a-z0-9A-Z_-]{0,63}$/,u=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,A={javascript:!0,"javascript:":!0},d={javascript:!0,"javascript:":!0},O={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},c=a(47186);function R(e,t,a){if(e&&o.isObject(e)&&e instanceof n)return e;var i=new n;return i.parse(e,t,a),i}n.prototype.parse=function(e,t,a){if(!o.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var n=e.indexOf("?"),E=-1!==n&&n127?W+="x":W+=M[y];if(!W.match(I)){var U=g.slice(0,f),G=g.slice(f+1),k=M.match(u);k&&(U.push(k[1]),G.unshift(k[2])),G.length&&(R="/"+G.join(".")+R),this.hostname=U.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),B||(this.hostname=i.toASCII(this.hostname));var F=this.port?":"+this.port:"",V=this.hostname||"";this.host=V+F,this.href+=this.host,B&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==R[0]&&(R="/"+R))}if(!A[L])for(f=0,v=s.length;f0)&&a.host.split("@"))&&(a.auth=B.shift(),a.host=a.hostname=B.shift());return a.search=e.search,a.query=e.query,o.isNull(a.pathname)&&o.isNull(a.search)||(a.path=(a.pathname?a.pathname:"")+(a.search?a.search:"")),a.href=a.format(),a}if(!D.length)return a.pathname=null,a.search?a.path="/"+a.search:a.path=null,a.href=a.format(),a;for(var h=D.slice(-1)[0],C=(a.host||e.host||D.length>1)&&("."===h||".."===h)||""===h,f=0,P=D.length;P>=0;P--)"."===(h=D[P])?D.splice(P,1):".."===h?(D.splice(P,1),f++):f&&(D.splice(P,1),f--);if(!m&&!L)for(;f--;f)D.unshift("..");!m||""===D[0]||D[0]&&"/"===D[0].charAt(0)||D.unshift(""),C&&"/"!==D.join("/").substr(-1)&&D.push("");var B,g=""===D[0]||D[0]&&"/"===D[0].charAt(0);p&&(a.hostname=a.host=g?"":D.length?D.shift():"",(B=!!(a.host&&a.host.indexOf("@")>0)&&a.host.split("@"))&&(a.auth=B.shift(),a.host=a.hostname=B.shift()));return(m=m||a.host&&D.length)&&!g&&D.unshift(""),D.length?a.pathname=D.join("/"):(a.pathname=null,a.path=null),o.isNull(a.pathname)&&o.isNull(a.search)||(a.path=(a.pathname?a.pathname:"")+(a.search?a.search:"")),a.auth=e.auth||a.auth,a.slashes=a.slashes||e.slashes,a.href=a.format(),a},n.prototype.parseHost=function(){var e=this.host,t=E.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},89637:e=>{"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},47426:(e,t,a)=>{var i=a(92255),o=a(18387);function n(e){var t=(e=e||{}).containerElement;if(!(t instanceof HTMLElement))throw new Error("Container element required to be instance of HTMLElement");var a=e.chromecastTransport;if(!a)throw new Error("Chromecast transport required");var n=a.getCastDevice();if(null===n)throw new Error("Chromecast session must be started");var r=document.createElement("div");r.style.display="flex",r.style.flexDirection="row",r.style.alignItems="center",r.style.justifyContent="center",r.style.width="100%",r.style.height="100%",r.style.backgroundColor="black";var E=document.createElement("div");E.style.flex="none",E.style.maxWidth="80%",E.style.fontSize="5vmin",E.style.lineHeight="1.2em",E.style.maxHeight="3.6em",E.style.textAlign="center",E.style.color="#FFFFFF90",E.innerText="Casting to "+n.friendlyName,r.appendChild(E),t.appendChild(r),a.on("message",I),a.on("message-error",l);var _=new i,T=!1,s={stream:!1,loaded:!1,paused:!1,time:!1,duration:!1,buffering:!1,buffered:!1,audioTracks:!1,selectedAudioTrackId:!1,subtitlesTracks:!1,selectedSubtitlesTrackId:!1,subtitlesOffset:!1,subtitlesSize:!1,subtitlesTextColor:!1,subtitlesBackgroundColor:!1,subtitlesOutlineColor:!1,volume:!1,muted:!1,playbackSpeed:!1,videoParams:!1,extraSubtitlesTracks:!1,selectedExtraSubtitlesTrackId:!1,extraSubtitlesDelay:!1,extraSubtitlesSize:!1,extraSubtitlesOffset:!1,extraSubtitlesTextColor:!1,extraSubtitlesBackgroundColor:!1,extraSubtitlesOutlineColor:!1};function S(e,t){_.emit("error",Object.assign({},o.CHROMECAST_SENDER_VIDEO.MESSAGE_SEND_FAILED,{error:e,action:t}))}function l(e){_.emit("error",Object.assign({},o.CHROMECAST_SENDER_VIDEO.INVALID_MESSAGE_RECEIVED,{error:e}))}function I(e){if(e&&"string"==typeof e.event){var t=Array.isArray(e.args)?e.args:[];_.emit.apply(_,[e.event].concat(t))}else l(new Error("Invalid message: "+e))}function u(e,t){s[e]&&_.emit("propChanged",e,t)}this.on=function(e,t){if(T)throw new Error("Video is destroyed");_.on(e,t)},this.dispatch=function(e){if(T)throw new Error("Video is destroyed");if(e)switch(e.type){case"observeProp":return o=e.propName,s.hasOwnProperty(o)&&(s[o]=!0),void a.sendMessage(e).catch((function(t){S(t,e)}));case"setProp":return void a.sendMessage(e).catch((function(t){S(t,e)}));case"command":return i=e.commandName,e.commandArgs,"destroy"===i&&(T=!0,u("stream",null),u("loaded",null),u("paused",null),u("time",null),u("duration",null),u("buffering",null),u("buffered",null),u("audioTracks",[]),u("selectedAudioTrackId",[]),u("subtitlesTracks",[]),u("selectedSubtitlesTrackId",null),u("subtitlesOffset",null),u("subtitlesSize",null),u("subtitlesTextColor",null),u("subtitlesBackgroundColor",null),u("subtitlesOutlineColor",null),u("volume",null),u("muted",null),u("playbackSpeed",null),u("videoParams",null),u("extraSubtitlesTracks",[]),u("selectedExtraSubtitlesTrackId",null),u("extraSubtitlesDelay",null),u("extraSubtitlesSize",null),u("extraSubtitlesOffset",null),u("extraSubtitlesTextColor",null),u("extraSubtitlesBackgroundColor",null),u("extraSubtitlesOutlineColor",null),_.removeAllListeners(),a.off("message",I),t.removeChild(r)),void a.sendMessage(e).catch((function(t){S(t,e)}))}var i,o;throw new Error("Invalid action dispatched: "+JSON.stringify(e))}}n.canPlayStream=function(){return Promise.resolve(!0)},n.manifest={name:"ChromecastSenderVideo",external:!0,props:["stream","loaded","paused","time","duration","buffering","buffered","audioTracks","selectedAudioTrackId","subtitlesTracks","selectedSubtitlesTrackId","subtitlesOffset","subtitlesSize","subtitlesTextColor","subtitlesBackgroundColor","subtitlesOutlineColor","volume","muted","playbackSpeed","videoParams","extraSubtitlesTracks","selectedExtraSubtitlesTrackId","extraSubtitlesDelay","extraSubtitlesSize","extraSubtitlesOffset","extraSubtitlesTextColor","extraSubtitlesBackgroundColor","extraSubtitlesOutlineColor"],commands:["load","unload","destroy","addExtraSubtitlesTracks"],events:["propValue","propChanged","ended","error","subtitlesTrackLoaded","audioTrackLoaded","extraSubtitlesTrackLoaded","implementationChanged"]},e.exports=n},52369:(e,t,a)=>{var i=a(47426);e.exports=i},7370:(e,t,a)=>{var i=a(92255),o=a(39473),n=a(67193),r=a(52653),E=a(2520),_=a(18387),T=a(78377),s=a(1961);function S(e){var t=(e=e||{}).containerElement;if(!(t instanceof HTMLElement))throw new Error("Container element required to be instance of HTMLElement");var a=document.createElement("style");t.appendChild(a),a.sheet.insertRule("video::cue { font-size: 4vmin; color: rgb(255, 255, 255); background-color: rgba(0, 0, 0, 0); text-shadow: rgb(34, 34, 34) 1px 1px 0.1em; }");var S=document.createElement("video");S.style.width="100%",S.style.height="100%",S.style.backgroundColor="black",S.controls=!1,S.playsInline=!0,S.onerror=function(){!(function(){if(u)return;var e;switch(S.error.code){case 1:e=_.HTML_VIDEO.MEDIA_ERR_ABORTED;break;case 2:e=_.HTML_VIDEO.MEDIA_ERR_NETWORK;break;case 3:e=_.HTML_VIDEO.MEDIA_ERR_DECODE;break;case 4:e=_.HTML_VIDEO.MEDIA_ERR_SRC_NOT_SUPPORTED;break;default:e=_.UNKNOWN_ERROR}N(Object.assign({},e,{critical:!0,error:S.error}))})()},S.onended=function(){I.emit("ended")},S.onpause=function(){m("paused")},S.onplay=function(){m("paused")},S.ontimeupdate=function(){m("time"),m("buffered")},S.ondurationchange=function(){m("duration")},S.onwaiting=function(){m("buffering"),m("buffered")},S.onseeking=function(){m("time"),m("buffering"),m("buffered")},S.onseeked=function(){m("time"),m("buffering"),m("buffered")},S.onstalled=function(){m("buffering"),m("buffered")},S.onplaying=function(){m("time"),m("buffering"),m("buffered")},S.oncanplay=function(){m("buffering"),m("buffered")},S.canplaythrough=function(){m("buffering"),m("buffered")},S.onloadedmetadata=function(){m("loaded")},S.onloadeddata=function(){m("buffering"),m("buffered")},S.onvolumechange=function(){m("volume"),m("muted")},S.onratechange=function(){m("playbackSpeed")},S.textTracks.onchange=function(){m("subtitlesTracks"),m("selectedSubtitlesTrackId"),R(),Array.from(S.textTracks).forEach((function(e){e.oncuechange=R}))},t.appendChild(S);var l=null,I=new i,u=!1,A=null,d=0,O={stream:!1,loaded:!1,paused:!1,time:!1,duration:!1,buffering:!1,buffered:!1,subtitlesTracks:!1,selectedSubtitlesTrackId:!1,subtitlesOffset:!1,subtitlesSize:!1,subtitlesTextColor:!1,subtitlesBackgroundColor:!1,subtitlesOutlineColor:!1,audioTracks:!1,selectedAudioTrackId:!1,volume:!1,muted:!1,playbackSpeed:!1};function c(e){switch(e){case"stream":return A;case"loaded":return null===A?null:S.readyState>=S.HAVE_METADATA;case"paused":return null===A?null:!!S.paused;case"time":return null!==A&&null!==S.currentTime&&isFinite(S.currentTime)?Math.floor(1e3*S.currentTime):null;case"duration":return null!==A&&null!==S.duration&&isFinite(S.duration)?Math.floor(1e3*S.duration):null;case"buffering":return null===A?null:S.readyState0?e.lang:"string"==typeof e.name&&e.name.length>0?e.name:String(e.id),label:"string"==typeof e.name&&e.name.length>0?e.name:"string"==typeof e.lang&&e.lang.length>0?e.lang:String(e.id),origin:"EMBEDDED",embedded:!0})})):[];case"selectedAudioTrackId":return null!==l&&null!==l.audioTrack&&isFinite(l.audioTrack)&&-1!==l.audioTrack?"EMBEDDED_"+String(l.audioTrack):null;case"volume":return u||null===S.volume||!isFinite(S.volume)?null:Math.floor(100*S.volume);case"muted":return u?null:!!S.muted;case"playbackSpeed":return u||null===S.playbackRate||!isFinite(S.playbackRate)?null:S.playbackRate;default:return null}}function R(){Array.from(S.textTracks).forEach((function(e){Array.from(e.cues||[]).forEach((function(e){e.snapToLines=!1,e.line=100-d}))}))}function N(e){I.emit("error",e),e.critical&&L("unload")}function m(e){O[e]&&I.emit("propChanged",e,c(e))}function L(e,i){switch(e){case"load":L("unload"),i&&i.stream&&"string"==typeof i.stream.url?(A=i.stream,m("stream"),m("loaded"),S.autoplay="boolean"!=typeof i.autoplay||i.autoplay,S.currentTime=null!==i.time&&isFinite(i.time)?parseInt(i.time,10)/1e3:0,m("paused"),m("time"),m("duration"),m("buffering"),m("buffered"),m("subtitlesTracks"),m("selectedSubtitlesTrackId"),m("audioTracks"),m("selectedAudioTrackId"),T(A).then((function(e){A===i.stream&&("application/vnd.apple.mpegurl"===e&&o.isSupported()?((l=new o(s)).on(o.Events.AUDIO_TRACKS_UPDATED,(function(){m("audioTracks"),m("selectedAudioTrackId")})),l.on(o.Events.AUDIO_TRACK_SWITCHED,(function(){m("audioTracks"),m("selectedAudioTrackId")})),l.loadSource(A.url),l.attachMedia(S)):S.src=A.url)})).catch((function(){A===i.stream&&(S.src=A.url)}))):N(Object.assign({},_.UNSUPPORTED_STREAM,{critical:!0,stream:i?i.stream:null}));break;case"unload":A=null,Array.from(S.textTracks).forEach((function(e){e.oncuechange=null})),null!==l&&(l.removeAllListeners(),l.detachMedia(S),l.destroy(),l=null),S.removeAttribute("src"),S.load(),S.currentTime=0,m("stream"),m("loaded"),m("paused"),m("time"),m("duration"),m("buffering"),m("buffered"),m("subtitlesTracks"),m("selectedSubtitlesTrackId"),m("audioTracks"),m("selectedAudioTrackId");break;case"destroy":L("unload"),u=!0,m("subtitlesOffset"),m("subtitlesSize"),m("subtitlesTextColor"),m("subtitlesBackgroundColor"),m("subtitlesOutlineColor"),m("volume"),m("muted"),m("playbackSpeed"),I.removeAllListeners(),S.onerror=null,S.onended=null,S.onpause=null,S.onplay=null,S.ontimeupdate=null,S.ondurationchange=null,S.onwaiting=null,S.onseeking=null,S.onseeked=null,S.onstalled=null,S.onplaying=null,S.oncanplay=null,S.canplaythrough=null,S.onloadeddata=null,S.onvolumechange=null,S.onratechange=null,S.textTracks.onchange=null,t.removeChild(S),t.removeChild(a)}}this.on=function(e,t){if(u)throw new Error("Video is destroyed");I.on(e,t)},this.dispatch=function(e){if(u)throw new Error("Video is destroyed");if(e)switch((e=r(n(e))).type){case"observeProp":return t=e.propName,void(O.hasOwnProperty(t)&&(I.emit("propValue",t,c(t)),O[t]=!0));case"setProp":return void(function(e,t){switch(e){case"paused":null!==A&&(t?S.pause():S.play(),m("paused"));break;case"time":null!==A&&null!==t&&isFinite(t)&&(S.currentTime=parseInt(t,10)/1e3,m("time"));break;case"selectedSubtitlesTrackId":if(null!==A){Array.from(S.textTracks).forEach((function(e,a){e.mode="EMBEDDED_"+String(a)===t?"showing":"disabled"}));var i=c("subtitlesTracks").find((function(e){return e.id===t}));i&&(m("selectedSubtitlesTrackId"),I.emit("subtitlesTrackLoaded",i))}break;case"subtitlesOffset":null!==t&&isFinite(t)&&(d=Math.max(0,Math.min(100,parseInt(t,10))),R(),m("subtitlesOffset"));break;case"subtitlesSize":null!==t&&isFinite(t)&&(a.sheet.cssRules[0].style.fontSize=Math.floor(Math.max(0,parseInt(t,10))/25)+"vmin",m("subtitlesSize"));break;case"subtitlesTextColor":if("string"==typeof t){try{a.sheet.cssRules[0].style.color=E(t).rgb().string()}catch(e){console.error("HTMLVideo",e)}m("subtitlesTextColor")}break;case"subtitlesBackgroundColor":if("string"==typeof t){try{a.sheet.cssRules[0].style.backgroundColor=E(t).rgb().string()}catch(e){console.error("HTMLVideo",e)}m("subtitlesBackgroundColor")}break;case"subtitlesOutlineColor":if("string"==typeof t){try{a.sheet.cssRules[0].style.textShadow=E(t).rgb().string()+" 1px 1px 0.1em"}catch(e){console.error("HTMLVideo",e)}m("subtitlesOutlineColor")}break;case"selectedAudioTrackId":if(null!==l){var o=c("audioTracks").find((function(e){return e.id===t}));l.audioTrack=o?parseInt(o.id.split("_").pop(),10):-1,o&&(m("selectedAudioTrackId"),I.emit("audioTrackLoaded",o))}break;case"volume":null!==t&&isFinite(t)&&(S.muted=!1,S.volume=Math.max(0,Math.min(100,parseInt(t,10)))/100,m("muted"),m("volume"));break;case"muted":S.muted=!!t,m("muted");break;case"playbackSpeed":null!==t&&isFinite(t)&&(S.playbackRate=parseFloat(t),m("playbackSpeed"))}})(e.propName,e.propValue);case"command":return void L(e.commandName,e.commandArgs)}var t;throw new Error("Invalid action dispatched: "+JSON.stringify(e))}}S.canPlayStream=function(e){return!e||e.behaviorHints&&e.behaviorHints.notWebReady?Promise.resolve(!1):T(e).then((function(e){return!!document.createElement("video").canPlayType(e)||"application/vnd.apple.mpegurl"===e&&o.isSupported()})).catch((function(){return!1}))},S.manifest={name:"HTMLVideo",external:!1,props:["stream","loaded","paused","time","duration","buffering","buffered","audioTracks","selectedAudioTrackId","subtitlesTracks","selectedSubtitlesTrackId","subtitlesOffset","subtitlesSize","subtitlesTextColor","subtitlesBackgroundColor","subtitlesOutlineColor","volume","muted","playbackSpeed"],commands:["load","unload","destroy"],events:["propValue","propChanged","ended","error","subtitlesTrackLoaded","audioTrackLoaded"]},e.exports=S},78377:e=>{e.exports=function(e){return e&&"string"==typeof e.url?e.behaviorHints&&e.behaviorHints.proxyHeaders&&e.behaviorHints.proxyHeaders.response&&"string"==typeof e.behaviorHints.proxyHeaders.response["content-type"]?Promise.resolve(e.behaviorHints.proxyHeaders.response["content-type"]):fetch(e.url,{method:"HEAD"}).then((function(e){if(e.ok)return e.headers.get("content-type");throw new Error(e.status+" ("+e.statusText+")")})):Promise.reject(new Error("Invalid stream parameter!"))}},1961:e=>{e.exports={debug:!1,enableWorker:!0,lowLatencyMode:!1,backBufferLength:30,maxBufferLength:50,maxMaxBufferLength:80,maxFragLookUpTolerance:0,maxBufferHole:0,appendErrorMaxRetry:20,nudgeMaxRetry:20,manifestLoadingTimeOut:3e4,manifestLoadingMaxRetry:10,fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:20,retryDelayMs:0,maxRetryDelayMs:15},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:15}}}}},12430:(e,t,a)=>{var i=a(7370);e.exports=i},14466:(e,t,a)=>{var i=a(92255),o=a(67193),n=a(52653),r=a(18387);function E(e){var t=(e=e||{}).containerElement;if(!(t instanceof HTMLElement))throw new Error("Container element required to be instance of HTMLElement");var a=document.createElement("iframe");a.style.width="100%",a.style.height="100%",a.style.border=0,a.style.backgroundColor="black",a.allowFullscreen=!1,a.allow="autoplay",t.appendChild(a);var E=new i,_=!1,T={stream:!1,loaded:!1,paused:!1,time:!1,duration:!1,buffering:!1,buffered:!1,volume:!1,muted:!1,playbackSpeed:!1};function s(e){if(e.source===a.contentWindow){var t=e.data||e.message;if(t&&"string"==typeof t.event){var i=t.event,o=Array.isArray(t.args)?t.args:[];E.emit.apply(E,[i].concat(o))}}}function S(e){a.contentWindow.postMessage(e,"*")}function l(e,t){T[e]&&E.emit("propChanged",e,t)}function I(e,i){switch(e){case"load":return I("unload"),i&&i.stream&&"string"==typeof i.stream.playerFrameUrl?(window.addEventListener("message",s,!1),a.onload=function(){S({type:"command",commandName:e,commandArgs:i})},a.src=i.stream.playerFrameUrl):(o=Object.assign({},r.UNSUPPORTED_STREAM,{critical:!0,stream:i?i.stream:null}),E.emit("error",o),o.critical&&I("unload")),!0;case"unload":return window.removeEventListener("message",s),a.onload=null,a.removeAttribute("src"),l("stream",null),l("loaded",null),l("paused",null),l("time",null),l("duration",null),l("buffering",null),l("buffered",null),l("volume",null),l("muted",null),l("playbackSpeed",null),!0;case"destroy":return I("unload"),_=!0,E.removeAllListeners(),t.removeChild(a),!0}var o}this.on=function(e,t){if(_)throw new Error("Video is destroyed");E.on(e,t)},this.dispatch=function(e){if(_)throw new Error("Video is destroyed");if(e)switch((e=n(o(e))).type){case"observeProp":return t=e.propName,T.hasOwnProperty(t)&&(T[t]=!0),void S(e);case"setProp":return void S(e);case"command":return void(I(e.commandName,e.commandArgs)||S(e))}var t;throw new Error("Invalid action dispatched: "+JSON.stringify(e))}}E.canPlayStream=function(e){return Promise.resolve(e&&"string"==typeof e.playerFrameUrl)},E.manifest={name:"IFrameVideo",external:!0,props:["stream","loaded","paused","time","duration","buffering","buffered","audioTracks","selectedAudioTrackId","subtitlesTracks","selectedSubtitlesTrackId","subtitlesOffset","subtitlesSize","subtitlesTextColor","subtitlesBackgroundColor","subtitlesOutlineColor","volume","muted","playbackSpeed","extraSubtitlesTracks","selectedExtraSubtitlesTrackId","extraSubtitlesDelay","extraSubtitlesSize","extraSubtitlesOffset","extraSubtitlesTextColor","extraSubtitlesBackgroundColor","extraSubtitlesOutlineColor"],commands:["load","unload","destroy","addExtraSubtitlesTracks"],events:["propValue","propChanged","ended","error","subtitlesTrackLoaded","audioTrackLoaded","extraSubtitlesTrackLoaded","implementationChanged"]},e.exports=E},30113:(e,t,a)=>{var i=a(14466);e.exports=i},90514:(e,t,a)=>{var i=a(92255),o=a(67193),n=a(52653),r=a(18387),E=.0066,_={loaded:"loaded",stream:null,paused:"pause",time:"time-pos",duration:"duration",buffering:"buffering",volume:"volume",muted:"mute",playbackSpeed:"speed",audioTracks:"audioTracks",selectedAudioTrackId:"aid",subtitlesTracks:"subtitlesTracks",selectedSubtitlesTrackId:"sid",subtitlesSize:"sub-scale",subtitlesOffset:"sub-pos",subtitlesDelay:"sub-delay",subtitlesTextColor:"sub-color",subtitlesBackgroundColor:"sub-back-color",subtitlesOutlineColor:"sub-border-color"};function T(e){return e.split(".").slice(0,2).map((function(e){return parseInt(e)}))}function s(e){var t,a=(e=e||{}).shellTransport,s={},S={},l={};Object.keys(_).forEach((function(e){_[e]&&(l[_[e]]=e)}));var I=new Promise((function(e){t=e}));p("unload"),a.send("mpv-command",["stop"]),a.send("mpv-observe-prop","path"),a.send("mpv-observe-prop","time-pos"),a.send("mpv-observe-prop","volume"),a.send("mpv-observe-prop","pause"),a.send("mpv-observe-prop","seeking"),a.send("mpv-observe-prop","eof-reached"),a.send("mpv-observe-prop","duration"),a.send("mpv-observe-prop","metadata"),a.send("mpv-observe-prop","video-params"),a.send("mpv-observe-prop","track-list"),a.send("mpv-observe-prop","paused-for-cache"),a.send("mpv-observe-prop","cache-buffering-state"),a.send("mpv-observe-prop","aid"),a.send("mpv-observe-prop","vid"),a.send("mpv-observe-prop","sid"),a.send("mpv-observe-prop","sub-scale"),a.send("mpv-observe-prop","sub-pos"),a.send("mpv-observe-prop","sub-delay"),a.send("mpv-observe-prop","speed"),a.send("mpv-observe-prop","mpv-version"),a.send("mpv-observe-prop","ffmpeg-version");var u=new i,A=!1,d=null,O=0;function c(t){for(var a=t?"":"transparent",i=e.containerElement;i;i=i.parentElement)i.style.background=a;if(((window||{}).document||{}).getElementsByTagName){var o=window.document.getElementsByTagName("body");(o||[])[0]&&(o[0].style.background=a)}}function R(e){console.log(e.name+": "+e.data)}var N=0;function m(e){return _[e]?S[_[e]]:(console.log("Unsupported prop requested",e),null)}function L(e){u.emit("error",e),e.critical&&p("unload")}function D(e){s[e]&&u.emit("propChanged",e,m(e))}function p(t,i){switch(t){case"load":p("unload"),i&&i.stream&&"string"==typeof i.stream.url?I.then((function(t){d=i.stream,D("stream"),a.send("mpv-set-prop",["no-sub-ass"]);var o=i.hardwareDecoding?"auto-copy":"no";a.send("mpv-set-prop",["hwdec",o]);var n="Win32"===navigator.platform?"direct3d":"opengl",r=e.mpvSeparateWindow?n:"opengl-cb",E=e.mpvSeparateWindow?"yes":"no";a.send("mpv-set-prop",["vo",r]),a.send("mpv-set-prop",["osc",E]),a.send("mpv-set-prop",["input-default-bindings",E]),a.send("mpv-set-prop",["input-vo-keyboard",E]);var _,s,l,I=Math.floor(parseInt(i.time,10)/1e3)||0;0!==I?(_="0.39",s=T(t),l=T(_),s[0]>l[0]||!(s[0]=l[1]?a.send("mpv-command",["loadfile",d.url,"replace","-1","start=+"+I]):a.send("mpv-command",["loadfile",d.url,"replace","start=+"+I])):a.send("mpv-command",["loadfile",d.url]),a.send("mpv-set-prop",["pause",!1]),a.send("mpv-set-prop",["speed",S.speed]),S.aid&&("string"==typeof S.aid&&S.aid.startsWith("EMBEDDED_")?a.send("mpv-set-prop",["aid",S.aid.slice(9)]):a.send("mpv-set-prop",["aid",S.aid])),a.send("mpv-set-prop",["mute","no"]),D("paused"),D("time"),D("duration"),D("buffering"),D("volume"),D("muted"),D("subtitlesTracks"),D("selectedSubtitlesTrackId")})):L(Object.assign({},r.UNSUPPORTED_STREAM,{critical:!0,stream:i?i.stream:null}));break;case"unload":S={loaded:!1,pause:!1,mute:!1,speed:1,subtitlesTracks:[],audioTracks:[],buffering:!1,aid:null,sid:null},O=0,a.send("mpv-command",["stop"]),D("loaded"),D("stream"),D("paused"),D("time"),D("duration"),D("buffering"),D("volume"),D("muted"),D("subtitlesTracks"),D("selectedSubtitlesTrackId"),c(!0);break;case"destroy":p("unload"),A=!0,u.removeAllListeners()}}a.on("mpv-prop-change",(function(e){switch(e.name){case"mpv-version":t(e.data),S[e.name]=R(e);break;case"ffmpeg-version":S[e.name]=R(e);break;case"duration":var a=0|e.data;S[e.name]=e.data>=30&&(!O||a===O)?Math.round(1e3*e.data):null,O=O?O+a>>1:a,S.loaded=a>0,S.loaded&&(c(!1),D("loaded"));break;case"time-pos":case"sub-delay":S[e.name]=Math.round(1e3*e.data);break;case"sub-scale":S[e.name]=Math.round(e.data/E);break;case"sub-pos":S[e.name]=100-e.data;break;case"paused-for-cache":case"seeking":S.buffering!==e.data&&(S.buffering=e.data,D("buffering"));break;case"aid":case"sid":case"vid":S[e.name]=(function(e){return e.data?"EMBEDDED_"+e.data.toString():null})(e);break;case"track-list":S.audioTracks=e.data.filter((function(e){return"audio"===e.type})).map((function(e,t){return{id:"EMBEDDED_"+e.id,lang:void 0===e.lang?"Track"+(t+1):e.lang,label:void 0===e.title||void 0===e.lang?"":e.title||e.lang,origin:"EMBEDDED",embedded:!0,mode:e.id===S.aid?"showing":"disabled"}})),D("audioTracks"),S.subtitlesTracks=e.data.filter((function(e){return"sub"===e.type})).map((function(e,t){return{id:"EMBEDDED_"+e.id,lang:void 0===e.lang?"Track "+(t+1):e.lang,label:void 0===e.title||void 0===e.lang?"":e.title||e.lang,origin:"EMBEDDED",embedded:!0,mode:e.id===S.sid?"showing":"disabled"}})),D("subtitlesTracks");break;default:S[e.name]=e.data}var i="time-pos"===e.name?Math.floor(S["time-pos"]/1e3):null;i&&N===i||!l[e.name]||(i&&(N=i),D(l[e.name]))})),a.on("mpv-event-ended",(function(e){e.error?L(e.error):u.emit("ended")})),this.on=function(e,t){if(A)throw new Error("Video is destroyed");u.on(e,t)},this.dispatch=function(e){if(A)throw new Error("Video is destroyed");if(e)switch((e=n(o(e))).type){case"observeProp":t=e.propName,u.emit("propValue",t,m(t)),s[t]=!0;break;case"setProp":return void(function(e,t){switch(e){case"paused":null!==d&&a.send("mpv-set-prop",["pause",t]);break;case"time":null!==d&&null!==t&&isFinite(t)&&a.send("mpv-set-prop",["time-pos",t/1e3]);break;case"playbackSpeed":null!==d&&null!==t&&isFinite(t)&&a.send("mpv-set-prop",["speed",t]);break;case"volume":null!==d&&null!==t&&isFinite(t)&&(S.mute=!1,a.send("mpv-set-prop",["mute","no"]),a.send("mpv-set-prop",["volume",t]),D("muted"),D("volume"));break;case"muted":null!==d&&(a.send("mpv-set-prop",["mute",t?"yes":"no"]),S.mute=t,D("muted"));break;case"selectedAudioTrackId":if(null!==d){var i=t.slice(9);a.send("mpv-set-prop",["aid",i])}break;case"selectedSubtitlesTrackId":null!==d&&(t?(i=t.slice(9),a.send("mpv-set-prop",["sid",i]),u.emit("subtitlesTrackLoaded",t)):(a.send("mpv-set-prop",["sid","no"]),S.sid=null)),D("selectedSubtitlesTrackId");break;case"subtitlesSize":a.send("mpv-set-prop",[_[e],t*E]);break;case"subtitlesDelay":a.send("mpv-set-prop",[_[e],t]);break;case"subtitlesOffset":a.send("mpv-set-prop",[_[e],100-t]);break;case"subtitlesTextColor":case"subtitlesBackgroundColor":case"subtitlesOutlineColor":var o=t.replace(/^#(\w{6})(\w{2})$/,"#$2$1");a.send("mpv-set-prop",[_[e],o]);break;default:console.log("Unhandled setProp for",e)}})(e.propName,e.propValue);case"command":return void p(e.commandName,e.commandArgs)}var t}}s.canPlayStream=function(){return Promise.resolve(!0)},s.manifest={name:"ShellVideo",external:!1,props:Object.keys(_),commands:["load","unload","destroy"],events:["propValue","propChanged","ended","error","subtitlesTrackLoaded"]},e.exports=s},2843:(e,t,a)=>{var i=a(90514);e.exports=i},50992:(e,t,a)=>{var i=a(92255),o=a(67193),n=a(52653),r=a(40551),E=a(3690),_=a(18387);function T(){var e=null,t=new i,a=!1;this.on=function(e,i){if(a)throw new Error("Video is destroyed");t.on(e,i)},this.dispatch=function(i,T){if(a)throw new Error("Video is destroyed");if(!i)throw new Error("Invalid action dispatched: "+JSON.stringify(i));if(T=T||{},"command"===(i=n(o(i))).type&&"load"===i.commandName&&i.commandArgs){i.commandArgs.platform&&E.set(i.commandArgs.platform);var s=r(i.commandArgs,T);if(null!==e&&e.constructor!==s&&(e.dispatch({type:"command",commandName:"destroy"}),e=null),null===e){if(null===s)return void t.emit("error",Object.assign({},_.UNSUPPORTED_STREAM,{error:new Error("No video implementation was selected"),critical:!0,stream:i.commandArgs.stream}));(e=new s(T)).on("ended",(function(){t.emit("ended")})),e.on("error",(function(e){t.emit("error",e)})),e.on("propValue",(function(e,a){t.emit("propValue",e,a)})),e.on("propChanged",(function(e,a){t.emit("propChanged",e,a)})),e.on("subtitlesTrackLoaded",(function(e){t.emit("subtitlesTrackLoaded",e)})),e.on("audioTrackLoaded",(function(e){t.emit("audioTrackLoaded",e)})),e.on("extraSubtitlesTrackLoaded",(function(e){t.emit("extraSubtitlesTrackLoaded",e)})),e.on("extraSubtitlesTrackAdded",(function(e){t.emit("extraSubtitlesTrackAdded",e)})),s.manifest.external?e.on("implementationChanged",(function(e){t.emit("implementationChanged",e)})):t.emit("implementationChanged",s.manifest)}}if(null!==e)try{e.dispatch(i)}catch(t){console.error(e.constructor.manifest.name,t)}"command"===i.type&&"destroy"===i.commandName&&(e=null)},this.destroy=function(){a=!0,null!==e&&(e.dispatch({type:"command",commandName:"destroy"}),e=null),t.removeAllListeners()}}T.ERROR=_,e.exports=T},62030:(e,t,a)=>{var i=a(50992);e.exports=i},40551:(e,t,a)=>{var i=a(52369),o=a(2843),n=a(12430),r=a(22429),E=a(11139),_=a(97085),T=a(30113),s=a(7342),S=a(80445),l=a(7068),I=a(39735);e.exports=function(e,t){return e.stream&&"string"!=typeof e.stream.externalUrl?t.chromecastTransport&&t.chromecastTransport.getCastState()===cast.framework.CastState.CONNECTED?i:"string"==typeof e.stream.ytId?I(l(s)):"string"==typeof e.stream.playerFrameUrl?I(T):t.shellTransport?S(l(o)):"string"==typeof e.streamingServerURL?"Tizen"===e.platform?S(l(r)):"webOS"===e.platform?S(l(_)):"Titan"===e.platform||"NetTV"===e.platform?S(l(E)):S(l(n)):"string"==typeof e.stream.url?"Tizen"===e.platform?I(l(r)):"webOS"===e.platform?I(l(_)):"Titan"===e.platform||"NetTV"===e.platform?I(l(E)):I(l(n)):null:null}},43650:(e,t,a)=>{var i=a(92255),o=a(67193),n=a(52653),r=a(2520),E=a(18387);function _(e){var t=(e=e||{}).containerElement;if(!(t instanceof HTMLElement))throw new Error("Container element required to be instance of HTMLElement");var a=document.createElement("style");t.appendChild(a),a.sheet.insertRule("video::cue { font-size: 4vmin; color: rgb(255, 255, 255); background-color: rgba(0, 0, 0, 0); text-shadow: rgb(34, 34, 34) 1px 1px 0.1em; }");var _=document.createElement("video");_.style.width="100%",_.style.height="100%",_.style.backgroundColor="black",_.controls=!1,_.playsInline=!0,_.onerror=function(){!(function(){if(s)return;var e;switch(_.error.code){case 1:e=E.HTML_VIDEO.MEDIA_ERR_ABORTED;break;case 2:e=E.HTML_VIDEO.MEDIA_ERR_NETWORK;break;case 3:e=E.HTML_VIDEO.MEDIA_ERR_DECODE;break;case 4:e=E.HTML_VIDEO.MEDIA_ERR_SRC_NOT_SUPPORTED;break;default:e=E.UNKNOWN_ERROR}d(Object.assign({},e,{critical:!0,error:_.error}))})()},_.onended=function(){T.emit("ended")},_.onpause=function(){O("paused")},_.onplay=function(){O("paused")},_.ontimeupdate=function(){O("time"),O("buffered")},_.ondurationchange=function(){O("duration")},_.onwaiting=function(){O("buffering"),O("buffered")},_.onseeking=function(){O("time"),O("buffering"),O("buffered")},_.onseeked=function(){O("time"),O("buffering"),O("buffered")},_.onstalled=function(){O("buffering"),O("buffered")},_.onplaying=function(){O("time"),O("buffering"),O("buffered")},_.oncanplay=function(){O("buffering"),O("buffered")},_.canplaythrough=function(){O("buffering"),O("buffered")},_.onloadedmetadata=function(){O("loaded")},_.onloadeddata=function(){O("buffering"),O("buffered")},_.onvolumechange=function(){O("volume"),O("muted")},_.onratechange=function(){O("playbackSpeed")},_.textTracks.onchange=function(){O("subtitlesTracks"),O("selectedSubtitlesTrackId"),A(),Array.from(_.textTracks).forEach((function(e){e.oncuechange=A}))},t.appendChild(_);var T=new i,s=!1,S=null,l=0,I={stream:!1,loaded:!1,paused:!1,time:!1,duration:!1,buffering:!1,buffered:!1,subtitlesTracks:!1,selectedSubtitlesTrackId:!1,subtitlesOffset:!1,subtitlesSize:!1,subtitlesTextColor:!1,subtitlesBackgroundColor:!1,subtitlesOutlineColor:!1,audioTracks:!1,selectedAudioTrackId:!1,volume:!1,muted:!1,playbackSpeed:!1};function u(e){switch(e){case"stream":return S;case"loaded":return null===S?null:_.readyState>=_.HAVE_METADATA;case"paused":return null===S?null:!!_.paused;case"time":return null!==S&&null!==_.currentTime&&isFinite(_.currentTime)?Math.floor(1e3*_.currentTime):null;case"duration":return null!==S&&null!==_.duration&&isFinite(_.duration)?Math.floor(1e3*_.duration):null;case"buffering":return null===S?null:_.readyState<_.HAVE_FUTURE_DATA;case"buffered":if(null===S)return null;for(var t=null!==_.currentTime&&isFinite(_.currentTime)?_.currentTime:0,i=0;i<_.buffered.length;i++)if(_.buffered.start(i)<=t&&t<=_.buffered.end(i))return Math.floor(1e3*_.buffered.end(i));return Math.floor(1e3*t);case"subtitlesTracks":return null===S?[]:_.textTracks&&Array.from(_.textTracks).length?Array.from(_.textTracks).filter((function(e){return"subtitles"===e.kind})).map((function(e,t){return Object.freeze({id:"EMBEDDED_"+String(t),lang:e.language,label:e.label||null,origin:"EMBEDDED",embedded:!0})})):[];case"selectedSubtitlesTrackId":return null===S?null:_.textTracks&&Array.from(_.textTracks).length?Array.from(_.textTracks).reduce((function(e,t,a){return null===e&&"showing"===t.mode?"EMBEDDED_"+String(a):e}),null):null;case"subtitlesOffset":return s?null:l;case"subtitlesSize":return s?null:25*parseInt(a.sheet.cssRules[0].style.fontSize,10);case"subtitlesTextColor":return s?null:a.sheet.cssRules[0].style.color;case"subtitlesBackgroundColor":return s?null:a.sheet.cssRules[0].style.backgroundColor;case"subtitlesOutlineColor":return s?null:a.sheet.cssRules[0].style.textShadow.slice(0,a.sheet.cssRules[0].style.textShadow.indexOf(")")+1);case"audioTracks":return null===S?[]:_.audioTracks&&Array.from(_.audioTracks).length?Array.from(_.audioTracks).map((function(e,t){return Object.freeze({id:"EMBEDDED_"+String(t),lang:e.language,label:e.label||null,origin:"EMBEDDED",embedded:!0})})):[];case"selectedAudioTrackId":return null===S?null:_.audioTracks&&Array.from(_.audioTracks).length?Array.from(_.audioTracks).reduce((function(e,t,a){return null===e&&t.enabled?"EMBEDDED_"+String(a):e}),null):null;case"volume":return s||null===_.volume||!isFinite(_.volume)?null:Math.floor(100*_.volume);case"muted":return s?null:!!_.muted;case"playbackSpeed":return s||null===_.playbackRate||!isFinite(_.playbackRate)?null:_.playbackRate;default:return null}}function A(){Array.from(_.textTracks).forEach((function(e){Array.from(e.cues||[]).forEach((function(e){e.snapToLines=!1,e.line=100-l}))}))}function d(e){T.emit("error",e),e.critical&&c("unload")}function O(e){I[e]&&T.emit("propChanged",e,u(e))}function c(e,i){switch(e){case"load":c("unload"),i&&i.stream&&"string"==typeof i.stream.url?(S=i.stream,O("stream"),O("loaded"),_.autoplay="boolean"!=typeof i.autoplay||i.autoplay,_.currentTime=null!==i.time&&isFinite(i.time)?parseInt(i.time,10)/1e3:0,O("paused"),O("time"),O("duration"),O("buffering"),O("buffered"),_.textTracks&&(_.textTracks.onaddtrack=function(){_.textTracks.onaddtrack=null,setTimeout((function(){O("subtitlesTracks"),O("selectedSubtitlesTrackId")}))}),_.audioTracks&&(_.audioTracks.onaddtrack=function(){_.audioTracks.onaddtrack=null,setTimeout((function(){O("audioTracks"),O("selectedAudioTrackId")}))}),_.src=S.url):d(Object.assign({},E.UNSUPPORTED_STREAM,{critical:!0,stream:i?i.stream:null}));break;case"unload":S=null,Array.from(_.textTracks).forEach((function(e){e.oncuechange=null})),_.removeAttribute("src"),_.load(),_.currentTime=0,O("stream"),O("loaded"),O("paused"),O("time"),O("duration"),O("buffering"),O("buffered"),O("subtitlesTracks"),O("selectedSubtitlesTrackId"),O("audioTracks"),O("selectedAudioTrackId");break;case"destroy":c("unload"),s=!0,O("subtitlesOffset"),O("subtitlesSize"),O("subtitlesTextColor"),O("subtitlesBackgroundColor"),O("subtitlesOutlineColor"),O("volume"),O("muted"),O("playbackSpeed"),T.removeAllListeners(),_.onerror=null,_.onended=null,_.onpause=null,_.onplay=null,_.ontimeupdate=null,_.ondurationchange=null,_.onwaiting=null,_.onseeking=null,_.onseeked=null,_.onstalled=null,_.onplaying=null,_.oncanplay=null,_.canplaythrough=null,_.onloadeddata=null,_.onvolumechange=null,_.onratechange=null,_.textTracks.onchange=null,t.removeChild(_),t.removeChild(a)}}this.on=function(e,t){if(s)throw new Error("Video is destroyed");T.on(e,t)},this.dispatch=function(e){if(s)throw new Error("Video is destroyed");if(e)switch((e=n(o(e))).type){case"observeProp":return t=e.propName,void(I.hasOwnProperty(t)&&(T.emit("propValue",t,u(t)),I[t]=!0));case"setProp":return void(function(e,t){switch(e){case"paused":null!==S&&(t?_.pause():_.play(),O("paused"));break;case"time":null!==S&&null!==t&&isFinite(t)&&(_.currentTime=parseInt(t,10)/1e3,O("time"));break;case"selectedSubtitlesTrackId":if(null!==S){Array.from(_.textTracks).forEach((function(e,a){e.mode="EMBEDDED_"+String(a)===t?"showing":"disabled"}));var i=u("subtitlesTracks").find((function(e){return e.id===t}));i&&(O("selectedSubtitlesTrackId"),T.emit("subtitlesTrackLoaded",i))}break;case"subtitlesOffset":null!==t&&isFinite(t)&&(l=Math.max(0,Math.min(100,parseInt(t,10))),A(),O("subtitlesOffset"));break;case"subtitlesSize":null!==t&&isFinite(t)&&(a.sheet.cssRules[0].style.fontSize=Math.floor(Math.max(0,parseInt(t,10))/25)+"vmin",O("subtitlesSize"));break;case"subtitlesTextColor":if("string"==typeof t){try{a.sheet.cssRules[0].style.color=r(t).rgb().string()}catch(e){console.error("TitanVideo",e)}O("subtitlesTextColor")}break;case"subtitlesBackgroundColor":if("string"==typeof t){try{a.sheet.cssRules[0].style.backgroundColor=r(t).rgb().string()}catch(e){console.error("TitanVideo",e)}O("subtitlesBackgroundColor")}break;case"subtitlesOutlineColor":if("string"==typeof t){try{a.sheet.cssRules[0].style.textShadow=r(t).rgb().string()+" 1px 1px 0.1em"}catch(e){console.error("TitanVideo",e)}O("subtitlesOutlineColor")}break;case"selectedAudioTrackId":if(null!==S)for(var o=0;o<_.audioTracks.length;o++)_.audioTracks[o].enabled=!("EMBEDDED_"+String(o)!==t);var n=u("audioTracks").find((function(e){return e.id===t}));n&&(O("selectedAudioTrackId"),T.emit("audioTrackLoaded",n));break;case"volume":null!==t&&isFinite(t)&&(_.muted=!1,_.volume=Math.max(0,Math.min(100,parseInt(t,10)))/100,O("muted"),O("volume"));break;case"muted":_.muted=!!t,O("muted");break;case"playbackSpeed":null!==t&&isFinite(t)&&(_.playbackRate=parseFloat(t),O("playbackSpeed"))}})(e.propName,e.propValue);case"command":return void c(e.commandName,e.commandArgs)}var t;throw new Error("Invalid action dispatched: "+JSON.stringify(e))}}_.canPlayStream=function(e){return e?Promise.resolve(!0):Promise.resolve(!1)},_.manifest={name:"TitanVideo",external:!1,props:["stream","loaded","paused","time","duration","buffering","buffered","audioTracks","selectedAudioTrackId","subtitlesTracks","selectedSubtitlesTrackId","subtitlesOffset","subtitlesSize","subtitlesTextColor","subtitlesBackgroundColor","subtitlesOutlineColor","volume","muted","playbackSpeed"],commands:["load","unload","destroy"],events:["propValue","propChanged","ended","error","subtitlesTrackLoaded","audioTrackLoaded"]},e.exports=_},11139:(e,t,a)=>{var i=a(43650);e.exports=i},49388:e=>{const t="AVPlay";e.exports=e=>({getState:()=>e.request(t,"getState"),getCurrentTime:()=>e.request(t,"getCurrentTime"),getDuration:()=>e.request(t,"getDuration"),getTotalTrackInfo:()=>e.request(t,"getTotalTrackInfo"),getCurrentStreamInfo:()=>e.request(t,"getCurrentStreamInfo"),open:a=>e.request(t,"open",a),prepareAsync:async(a,i)=>{const[o,n]=await e.request(t,"prepareAsync","handler:success","handler:error");"handler:success"===o&&a(),"handler:error"===o&&i(...n)},pause:()=>e.request(t,"pause"),play:()=>e.request(t,"play"),stop:()=>e.request(t,"stop"),seekTo:a=>e.request(t,"seekTo",a),setSpeed:a=>e.request(t,"setSpeed",a),setSelectTrack:(a,i)=>e.request(t,"setSelectTrack",a,i),setDisplayRect:(a,i,o,n)=>e.request(t,"setDisplayRect",a,i,o,n),setDisplayMethod:a=>e.request(t,"setDisplayMethod",a),setListener:a=>{const i=Object.keys(a).map((e=>`handler:${e}`));e.listen(t,"setListener",((e,t)=>{const i=e.replace("handler:","");a[i]&&(t?a[i](...t):a[i]())}),...i)}})},898:(e,t,a)=>{var i=a(92255),o=a(67193),n=a(52653),r=a(2520),E=a(18387),_=a(13001),T=a(49388),s=/^\{(\\an[1-8])+\}/i;function S(e){var t=!0,a=1,S=null,l=null,I=(e=e||{}).containerElement;if(!(I instanceof HTMLElement))throw new Error("Container element required to be instance of HTMLElement");var u,A=T(e.transport),d=!1,O=100,c=0,R="rgb(255, 255, 255)",N="rgba(0, 0, 0, 0)",m="rgb(34, 34, 34)",L=1,D=document.createElement("object");D.type="application/avplayer",D.style.width="100%",D.style.height="100%",D.style.backgroundColor="black";var p=!1;async function h(){if(u){var e=await G("time"),t=u.duration-(e-u.now);t>0&&C(t,u.text)}}async function C(e,t){if(!p){var i=await G("time"),o=t.replace(s,"");for(u={duration:e,text:o,now:i},f&&(clearTimeout(f),f=!1);P.hasChildNodes();)P.removeChild(P.lastChild);P.style.bottom=c+"%",P.style.opacity=L;var n=document.createElement("span");n.innerHTML=o,n.style.display="inline-block",n.style.padding="0.2em",n.style.fontSize=Math.floor(O/25)+"vmin",n.style.color=R,n.style.backgroundColor=N,n.style.textShadow="1px 1px 0.1em "+m,P.appendChild(n),P.appendChild(document.createElement("br")),e&&(f=setTimeout((function(){for(;P.hasChildNodes();)P.removeChild(P.lastChild)}),parseInt(e*a)))}}var f=!1;A.setListener({onbufferingstart:function(){t=!0,F("buffering")},onbufferingprogress:function(){t=!0,F("buffering")},onbufferingcomplete:function(){t=!1,F("buffering")},oncurrentplaytime:function(){F("time")},onsubtitlechange:function(e,t){C(e,t)},onstreamcompleted:function(){B.emit("ended")}}),I.appendChild(D);var P=document.createElement("div");P.style.position="absolute",P.style.right="0",P.style.bottom="0",P.style.left="0",P.style.zIndex="1",P.style.textAlign="center",I.style.position="relative",I.style.zIndex="0",I.appendChild(P);var B=new i,g=!1,v=null,M=0,W=null,y={stream:!1,loaded:!1,paused:!1,time:!1,duration:!1,buffering:!1,subtitlesTracks:!1,selectedSubtitlesTrackId:!1,subtitlesOffset:!1,subtitlesSize:!1,subtitlesTextColor:!1,subtitlesBackgroundColor:!1,subtitlesOutlineColor:!1,subtitlesOpacity:!1,audioTracks:!1,selectedAudioTrackId:!1,playbackSpeed:!1},b=!1,U={audio:[],subs:[]};async function G(e){switch(e){case"stream":return v;case"loaded":return W;case"paused":if(null===v)return null;var i=!("PAUSED"!==await A.getState());return!i&&d&&(A.setSelectTrack("AUDIO",parseInt(d.replace("EMBEDDED_",""))),d=!1),i;case"time":var o=await A.getCurrentTime();return null!==v&&null!==o&&isFinite(o)?Math.floor(o):null;case"duration":var n=await A.getDuration();return null!==v&&null!==n&&isFinite(n)?Math.floor(n):null;case"buffering":return null===v?null:t;case"subtitlesTracks":if(null===v)return[];for(var r=await A.getTotalTrackInfo(),E=[],_=0;_0?I.track_lang.trim():null,D=null;if(((U||{}).subs||[]).length)(B=U.subs.find((function(e){return(e||{}).id-1===T.index})))&&(u=B.lang||"eng",D=B.label||null);E.push({id:s,lang:u,label:D,origin:"EMBEDDED",embedded:!0,mode:p||s!==S?"disabled":"showing"})}return E;case"selectedSubtitlesTrackId":if(null===v||p)return null;var h=await A.getCurrentStreamInfo();for(_=0;_0?I.language:null,y=null;if(((U||{}).audio||[]).length)(B=U.audio.find((function(e){return(e||{}).id-1===f.index})))&&(M=B.lang||"eng",y=B.label||null);C.push({id:P,lang:M,label:y,origin:"EMBEDDED",embedded:!0,mode:P===l?"showing":"disabled"})}return C;case"selectedAudioTrackId":if(null===v)return null;if(d)return d;h=await A.getCurrentStreamInfo();var b=!1;for(_=0;_=6)&&(b||null===v||(b=!0,_(v.url,(function(e){e&&(U=e),((U||{}).subs||[]).length&&F("subtitlesTracks"),((U||{}).audio||[]).length&&F("audioTracks")})))),A.open(v.url),A.setDisplayRect(0,0,window.innerWidth,window.innerHeight),A.setDisplayMethod("PLAYER_DISPLAY_MODE_LETTER_BOX"),A.seekTo(null!==t.time&&isFinite(t.time)?parseInt(t.time,10):0),A.prepareAsync((function(){F("duration"),A.play(),W=!0,F("loaded"),F("stream"),F("paused"),F("time"),F("duration"),F("subtitlesTracks"),F("selectedSubtitlesTrackId"),F("audioTracks"),F("selectedAudioTrackId")}),(function(e){if(M<5){M++;try{A.stop()}catch(e){}V("load",t)}else k(Object.assign({},E.STREAM_FAILED_TO_LOAD,{critical:!0,stream:t?t.stream:null,error:e}))}))}else k(Object.assign({},E.UNSUPPORTED_STREAM,{critical:!0,stream:t?t.stream:null}));break;case"unload":v=null,A.stop(),W=!1,F("loaded"),F("stream"),F("paused"),F("time"),F("duration"),F("buffering"),F("subtitlesTracks"),F("selectedSubtitlesTrackId"),F("audioTracks"),F("selectedAudioTrackId");break;case"destroy":V("unload"),g=!0,A.stop(),F("subtitlesOffset"),F("subtitlesSize"),F("subtitlesTextColor"),F("subtitlesBackgroundColor"),F("subtitlesOutlineColor"),F("subtitlesOpacity"),F("playbackSpeed"),B.removeAllListeners(),I.removeChild(D)}}this.on=function(e,t){if(g)throw new Error("Video is destroyed");B.on(e,t)},this.dispatch=function(e){if(g)throw new Error("Video is destroyed");if(e)switch((e=n(o(e))).type){case"observeProp":return void(async function(e){if(y.hasOwnProperty(e)){var t=await G(e);B.emit("propValue",e,t),y[e]=!0}})(e.propName);case"setProp":return void(async function(e,t){switch(e){case"paused":if(null!==v){var i=!!t;i?A.pause():A.play(),i?f&&clearTimeout(f):h()}F("paused");var o=await G("paused");setTimeout((async function(){await G("paused")!==o&&F("paused")}),1e3);break;case"time":null!==v&&null!==t&&isFinite(t)&&(A.seekTo(parseInt(t,10)),C(1,""),F("time"));break;case"selectedSubtitlesTrackId":if(null!==v)if(0===(S||"").indexOf("EMBEDDED_")){if(-1===(t||"").indexOf("EMBEDDED_"))return C(1,""),p=!0,void F("selectedSubtitlesTrackId");p=!1,S=t;var n=(await G("subtitlesTracks")).find((function(e){return e.id===t}));A.setSelectTrack("TEXT",parseInt(S.replace("EMBEDDED_",""))),n&&(B.emit("subtitlesTrackLoaded",n),F("selectedSubtitlesTrackId"))}else t||(C(1,""),p=!0,F("selectedSubtitlesTrackId"));break;case"subtitlesOffset":null!==t&&isFinite(t)&&(c=Math.max(0,Math.min(100,parseInt(t,10))),h(),F("subtitlesOffset"));break;case"subtitlesSize":null!==t&&isFinite(t)&&(O=Math.max(0,parseInt(t,10)),h(),F("subtitlesSize"));break;case"subtitlesTextColor":if("string"==typeof t){try{R=r(t).rgb().string()}catch(e){console.error("Tizen player with HTML Subtitles",e)}h(),F("subtitlesTextColor")}break;case"subtitlesBackgroundColor":if("string"==typeof t){try{N=r(t).rgb().string()}catch(e){console.error("Tizen player with HTML Subtitles",e)}h(),F("subtitlesBackgroundColor")}break;case"subtitlesOutlineColor":if("string"==typeof t){try{m=r(t).rgb().string()}catch(e){console.error("Tizen player with HTML Subtitles",e)}h(),F("subtitlesOutlineColor")}break;case"subtitlesOpacity":if("number"==typeof t){try{L=Math.min(Math.max(t/100,0),1)}catch(e){console.error("Tizen player with HTML Subtitles",e)}h(),F("subtitlesOpacity")}break;case"selectedAudioTrackId":if(null!==v){l=t;var E=(await G("audioTracks")).find((function(e){return e.id===t}));await G("paused")?(d=t,F("selectedAudioTrackId")):A.setSelectTrack("AUDIO",parseInt(l.replace("EMBEDDED_",""))),E&&(B.emit("audioTrackLoaded",E),F("selectedAudioTrackId"))}break;case"playbackSpeed":if(null!==t&&isFinite(t)){a=parseFloat(t);try{A.setSpeed(a)}catch(e){}F("playbackSpeed")}}})(e.propName,e.propValue);case"command":return void V(e.commandName,e.commandArgs)}throw new Error("Invalid action dispatched: "+JSON.stringify(e))}}S.canPlayStream=function(){return Promise.resolve(!0)},S.manifest={name:"TizenVideo",external:!1,props:["stream","loaded","paused","time","duration","buffering","audioTracks","selectedAudioTrackId","subtitlesTracks","selectedSubtitlesTrackId","subtitlesOffset","subtitlesSize","subtitlesTextColor","subtitlesBackgroundColor","subtitlesOutlineColor","subtitlesOpacity","playbackSpeed"],commands:["load","unload","destroy"],events:["propValue","propChanged","ended","error","subtitlesTrackLoaded","audioTrackLoaded"]},e.exports=S},22429:(e,t,a)=>{var i=a(898);e.exports=i},18786:(e,t,a)=>{var i=a(92255),o=a(67193),n=a(52653),r=a(18387),E=a(13001);function _(e,t,a,i){t&&(e.onSuccess=t||function(){}),e.onFailure=function(t){console.log("WebOS",(e.method||i)+" [fail]["+t.errorCode+"] "+t.errorText),console.log("fail result",JSON.stringify(t)),a&&a()},window.webOS.service.request(i||"luna://com.webos.media",e)}function T(e,t,a){window.webOS.service.request("luna://com.webos.applicationManager",{method:"launch",parameters:{id:e.id,params:{payload:[{fullPath:e.url,artist:"",subtitle:"",dlnaInfo:{flagVal:4096,cleartextSize:"-1",contentLength:"-1",opVal:1,protocolInfo:"http-get:*:video/x-matroska:DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000",duration:0},mediaType:"VIDEO",thumbnail:"",deviceType:"DMR",album:"",fileName:e.name,lastPlayPosition:e.position}]}},onSuccess:function(){t&&t()},onFailure:function(){a&&a(new Error("Failed to launch"+e.id)),"com.webos.app.photovideo"===e.id?(e.id="com.webos.app.smartshare",T(e,t,a)):"com.webos.app.smartshare"===e.id&&(e.id="com.webos.app.mediadiscovery",T(e,t,a))}})}var s=["none","black","white","yellow","red","green","blue"],S={"rgba(0, 0, 0, 0)":"none","rgba(0, 0, 0, 255)":"black","rgba(255, 255, 255, 255)":"white","rgba(255, 255, 0, 255)":"yellow","rgba(255, 0, 0, 255)":"red","rgba(0, 255, 0, 255)":"green","rgba(0, 0, 255, 255)":"blue","rgba(0, 0, 0, 1)":"black","rgba(255, 255, 255, 1)":"white","rgba(255, 255, 0, 1)":"yellow","rgba(255, 0, 0, 1)":"red","rgba(0, 255, 0, 1)":"green","rgba(0, 0, 255, 1)":"blue","rgb(0, 0, 0)":"black","rgb(255, 255, 255)":"white","rgb(255, 255, 0)":"yellow","rgb(255, 0, 0)":"red","rgb(0, 255, 0)":"green","rgb(0, 0, 255)":"blue","#000000FF":"black","#FFFFFFFF":"white","#FFFF00FF":"yellow","#FF0000FF":"red","#00FF00FF":"green","#0000FFFF":"blue","#000000":"black","#FFFFFF":"white","#FFFF00":"yellow","#FF0000":"red","#00FF00":"green","#0000FF":"blue"};var l={unsupportedAudio:["DTS","TRUEHD"],unsupportedSubs:["HDMV/PGS","VOBSUB"]},I=!1;function u(){I||window.webOS.service.request("luna://com.webos.service.config",{method:"getConfigs",parameters:{configNames:["tv.model.edidType"]},onSuccess:function(e){if(((e||{}).configs||{})["tv.model.edidType"]){I=!0;var t=e.configs["tv.model.edidType"].toLowerCase();t.includes("dts")&&(l.unsupportedAudio=l.unsupportedAudio.filter((function(e){return"DTS"!==e}))),t.includes("truehd")&&(l.unsupportedAudio=l.unsupportedAudio.filter((function(e){return"TRUEHD"!==e})))}},onFailure:function(e){console.log("could not get deviceInfo",e)}})}function A(e){var t=(e=e||{}).containerElement;if(!(t instanceof HTMLElement))throw new Error("Container element required to be instance of HTMLElement");var a=null,I=75,A=!0,d=!1,O=!1,c=[],R=[],N={color:"white",font_size:1,bg_color:"none",position:-1,bg_opacity:0,char_opacity:255},m=function(e){D.mediaId&&(A=!e,_({method:"setSubtitleEnable",parameters:{mediaId:D.mediaId,enable:e}}))},L=document.createElement("style");t.appendChild(L),L.sheet.insertRule("video::cue { font-size: 4vmin; color: rgb(255, 255, 255); background-color: rgba(0, 0, 0, 0); text-shadow: rgb(34, 34, 34) 1px 1px 0.1em; }");var D=document.createElement("video");D.style.width="100%",D.style.height="100%",D.style.backgroundColor="black",D.controls=!1,D.onerror=function(){!(function(){if(P)return;var e;switch((D.error||{}).code){case 1:e=r.HTML_VIDEO.MEDIA_ERR_ABORTED;break;case 2:e=r.HTML_VIDEO.MEDIA_ERR_NETWORK;break;case 3:e=r.HTML_VIDEO.MEDIA_ERR_DECODE,T({id:"com.webos.app.photovideo",url:B.url,name:"Stremio",position:-1},null,(function(e){console.error(e)}));break;case 4:e=r.HTML_VIDEO.MEDIA_ERR_SRC_NOT_SUPPORTED,T({id:"com.webos.app.photovideo",url:B.url,name:"Stremio",position:-1},null,(function(e){console.error(e)}));break;default:e=r.UNKNOWN_ERROR}F(Object.assign({},e,{critical:!0,error:D.error}))})()},D.onended=function(){f.emit("ended")},D.onpause=function(){V("paused")},D.onplay=function(){V("paused")},D.ontimeupdate=function(){V("time"),V("buffered")},D.ondurationchange=function(){V("duration")},D.onwaiting=function(){V("buffering"),V("buffered")},D.onseeking=function(){V("buffering"),V("buffered")},D.onseeked=function(){V("buffering"),V("buffered")},D.onstalled=function(){V("buffering"),V("buffered")},D.onplaying=function(){V("buffering"),V("buffered"),a||(a=!0,V("loaded"))},D.oncanplay=function(){V("buffering"),V("buffered")},D.canplaythrough=function(){V("buffering"),V("buffered")},D.onloadeddata=function(){V("buffering"),V("buffered")},D.onloadedmetadata=function(){V("buffering"),V("buffered"),H("time",g)},D.onvolumechange=function(){V("volume"),V("muted")},D.onratechange=function(){V("playbackSpeed")},D.textTracks.onchange=function(){V("subtitlesTracks"),V("selectedSubtitlesTrackId"),k(),Array.from(D.textTracks).forEach((function(e){e.oncuechange=k}))},t.appendChild(D);var p=null,h=null,C=1,f=new i,P=!1,B=null,g=null,v=0,M=100,W={stream:!1,loaded:!1,paused:!1,time:!1,duration:!1,buffering:!1,buffered:!1,subtitlesTracks:!1,selectedSubtitlesTrackId:!1,subtitlesOffset:!1,subtitlesSize:!1,subtitlesTextColor:!1,subtitlesBackgroundColor:!1,subtitlesOpacity:!1,audioTracks:!1,selectedAudioTrackId:!1,volume:!1,muted:!1,playbackSpeed:!1},y=!1,b={audio:[],subs:[]};function U(){y||null===B||(y=!0,E(B.url,(function(e){var t=0,a=0;c=[],R=[],e&&(b=e),((b||{}).subs||[]).length&&(b.subs.forEach((function(e){if(!l.unsupportedSubs.includes(e.codec||"")){var a=t;t++,d||c.length||(d=a),c.push({id:"EMBEDDED_"+a,lang:e.lang||"eng",label:e.label||null,origin:"EMBEDDED",embedded:!0,mode:a===d?"showing":"disabled"})}})),V("subtitlesTracks"),V("selectedSubtitlesTrackId")),((b||{}).audio||[]).length&&(b.audio.forEach((function(e){if(!l.unsupportedAudio.includes(e.codec||"")){var t=a;a++,O||R.length||(O=t),R.push({id:"EMBEDDED_"+t,lang:e.lang||"eng",label:e.label||null,origin:"EMBEDDED",embedded:!0,mode:t===O?"showing":"disabled"})}})),O="EMBEDDED_0",V("audioTracks"),V("selectedAudioTrackId"))})))}function G(e){switch(e){case"stream":return B;case"loaded":return a;case"paused":return null===B?null:!!D.paused;case"time":return null!==B&&null!==D.currentTime&&isFinite(D.currentTime)?Math.floor(1e3*D.currentTime):null;case"duration":return null!==B&&null!==D.duration&&isFinite(D.duration)?Math.floor(1e3*D.duration):null;case"buffering":return null===B?null:D.readyState=D.HAVE_METADATA&&null!==t&&isFinite(t))try{D.currentTime=parseInt(t,10)/1e3,V("time")}catch(e){}break;case"selectedSubtitlesTrackId":if(D.mediaId&&null!==B&&0===(t||"").indexOf("EMBEDDED_")){m(!0),N.bg_opacity="none"===N.bg_color?0:255,["setSubtitleCharacterColor","setSubtitleBackgroundColor","setSubtitlePosition","setSubtitleFontSize","setSubtitleBackgroundOpacity","setSubtitleCharacterOpacity"].forEach((function(e){_({method:e,parameters:{mediaId:D.mediaId,charColor:N.color,bgColor:"none"===N.bg_color?"black":N.bg_color,position:N.position,fontSize:N.font_size,bgOpacity:N.bg_opacity,charOpacity:N.char_opacity}})})),console.log("WebOS","change subtitles for id: ",D.mediaId," index:",t),d=t;var a=parseInt(t.replace("EMBEDDED_",""));console.log("set subs to track idx: "+a),setTimeout((function(){var e=function(){var e=G("subtitlesTracks").find((function(e){return e.id===t}));c=c.map((function(e){return e.mode=e.id===d?"showing":"disabled",e})),e&&(f.emit("subtitlesTrackLoaded",e),V("selectedSubtitlesTrackId"))};_({method:"selectTrack",parameters:{type:"text",mediaId:D.mediaId,index:a}},e,e)}),500)}-1===(t||"").indexOf("EMBEDDED_")&&(d=null,V("selectedSubtitlesTrackId"),m(!1));break;case"subtitlesOffset":if(null!==t&&isFinite(t)){v=t;var i=(l=Math.max(0,Math.min(100,parseInt(v,10))))<=0?-3:l<=5?-2:l<=10?0:l<=15?2:l<=20&&4;!1===i&&(i=-2),N.position=i,D.mediaId&&_({method:"setSubtitlePosition",parameters:{mediaId:D.mediaId,position:i}}),V("subtitlesOffset")}break;case"subtitlesSize":if(null!==t&&isFinite(t)){I=t;var o=(T=Math.max(0,parseInt(I,10)))<=100?1:T<=125?2:T<=150?3:T<=200&&4;!1===o&&(o=1),N.font_size=o,D.mediaId&&_({method:"setSubtitleFontSize",parameters:{mediaId:D.mediaId,fontSize:o}}),V("subtitlesSize")}break;case"subtitlesTextColor":if("string"==typeof t){var n="white";S[t]&&s.indexOf(S[t])>-1&&(n=S[t]),N.color=n,D.mediaId&&_({method:"setSubtitleCharacterColor",parameters:{mediaId:D.mediaId,charColor:n}}),p=t,V("subtitlesTextColor")}break;case"subtitlesBackgroundColor":"string"==typeof t&&(S[t]&&s.indexOf(S[t])>-1&&(N.bg_color=S[t],D.mediaId&&(_({method:"setSubtitleBackgroundColor",parameters:{mediaId:D.mediaId,bgColor:"none"===S[t]?"black":S[t]}}),_("none"===S[t]?{method:"setSubtitleBackgroundOpacity",parameters:{mediaId:D.mediaId,bgOpacity:0}}:{method:"setSubtitleBackgroundOpacity",parameters:{mediaId:D.mediaId,bgOpacity:255}}))),h=t,V("subtitlesBackgroundColor"));break;case"subtitlesOpacity":if("number"==typeof t){var r=Math.floor(t/100*255);N.char_opacity=r,D.mediaId&&_({method:"setSubtitleCharacterOpacity",parameters:{mediaId:D.mediaId,charOpacity:r}}),M=t,V("subtitlesOpacity")}break;case"selectedAudioTrackId":if(0===(t||"").indexOf("EMBEDDED_")){O=t;a=parseInt(t.replace("EMBEDDED_",""));if(D.mediaId&&_({method:"selectTrack",parameters:{type:"audio",mediaId:D.mediaId,index:a}},(function(){var e=G("audioTracks").find((function(e){return e.id===t}));R=R.map((function(e){return e.mode=e.id===O?"showing":"disabled",e})),e&&(f.emit("audioTrackLoaded",e),V("selectedAudioTrackId"))})),D&&D.audioTracks){for(var E=0;E4&&(clearInterval(n),U(),u(),o())}),300)}else F(Object.assign({},r.UNSUPPORTED_STREAM,{critical:!0,stream:a?a.stream:null}));break;case"unload":B=null,g=null,Array.from(D.textTracks).forEach((function(e){e.oncuechange=null})),D.removeAttribute("src"),D.load(),V("stream"),V("paused"),V("time"),V("duration"),V("buffering"),V("buffered"),V("subtitlesTracks"),V("selectedSubtitlesTrackId"),V("audioTracks"),V("selectedAudioTrackId");break;case"destroy":w("unload"),P=!0,V("subtitlesOffset"),V("subtitlesSize"),V("subtitlesTextColor"),V("subtitlesBackgroundColor"),V("subtitlesOpacity"),V("volume"),V("muted"),V("playbackSpeed"),f.removeAllListeners(),D.onerror=null,D.onended=null,D.onpause=null,D.onplay=null,D.ontimeupdate=null,D.ondurationchange=null,D.onwaiting=null,D.onseeking=null,D.onseeked=null,D.onstalled=null,D.onplaying=null,D.oncanplay=null,D.canplaythrough=null,D.onloadeddata=null,D.onloadedmetadata=null,D.onvolumechange=null,D.onratechange=null,D.textTracks.onchange=null,t.removeChild(D),t.removeChild(L)}var o,n}this.on=function(e,t){if(P)throw new Error("Video is destroyed");f.on(e,t)},this.dispatch=function(e){if(P)throw new Error("Video is destroyed");if(e)switch((e=n(o(e))).type){case"observeProp":return t=e.propName,void(W.hasOwnProperty(t)&&(f.emit("propValue",t,G(t)),W[t]=!0));case"setProp":return void H(e.propName,e.propValue);case"command":return void w(e.commandName,e.commandArgs)}var t;throw new Error("Invalid action dispatched: "+JSON.stringify(e))}}A.canPlayStream=function(){return Promise.resolve(!0)},A.manifest={name:"WebOsVideo",external:!1,props:["stream","loaded","paused","time","duration","buffering","buffered","audioTracks","selectedAudioTrackId","subtitlesTracks","selectedSubtitlesTrackId","subtitlesOffset","subtitlesSize","subtitlesTextColor","subtitlesBackgroundColor","subtitlesOpacity","volume","muted","playbackSpeed"],commands:["load","unload","destroy"],events:["propValue","propChanged","ended","error","subtitlesTrackLoaded","audioTrackLoaded"]},e.exports=A},97085:(e,t,a)=>{var i=a(18786);e.exports=i},98388:(e,t,a)=>{var i=a(92255),o=a(67193),n=a(52653),r=a(18387);function E(e){var t=null!==(e=e||{}).timeChangedTimeout&&isFinite(e.timeChangedTimeout)?parseInt(e.timeChangedTimeout,10):100,a=e.containerElement;if(!(a instanceof HTMLElement))throw new Error("Container element required to be instance of HTMLElement");var E=document.createElement("script");E.type="text/javascript",E.src="https://www.youtube.com/iframe_api",E.onload=function(){if(u)return;if(!YT||"function"!=typeof YT.ready)return void c();YT.ready((function(){u||(YT&&YT.PlayerState&&"function"==typeof YT.Player?s=new YT.Player(_,{width:"100%",height:"100%",playerVars:{autoplay:1,cc_load_policy:3,controls:0,disablekb:1,enablejsapi:1,fs:0,iv_load_policy:3,loop:0,modestbranding:1,playsinline:1,rel:0},events:{onError:R,onReady:N,onApiChange:m,onStateChange:L}}):c())}))},E.onerror=c,a.appendChild(E);var _=document.createElement("div");_.style.width="100%",_.style.height="100%",_.style.backgroundColor="black",a.appendChild(_);var T=window.setInterval((function(){h("time"),h("volume"),h("muted"),h("playbackSpeed")}),t),s=null,S=!1,l=null,I=new i,u=!1,A=null,d=null,O={stream:!1,loaded:!1,paused:!1,time:!1,duration:!1,buffering:!1,volume:!1,muted:!1,playbackSpeed:!1,subtitlesTracks:!1,selectedSubtitlesTrackId:!1};function c(){u||p(Object.assign({},r.YOUTUBE_VIDEO.API_LOAD_FAILED,{critical:!0}))}function R(e){if(!u){var t;switch(e.data){case 2:t=r.YOUTUBE_VIDEO.INVALID_PARAMETER;break;case 5:t=r.YOUTUBE_VIDEO.HTML5_VIDEO;break;case 100:t=r.YOUTUBE_VIDEO.VIDEO_NOT_FOUND;break;case 101:case 150:t=r.YOUTUBE_VIDEO.VIDEO_NOT_EMBEDDABLE;break;default:t=r.UNKNOWN_ERROR}p(Object.assign({},t,{critical:!0,error:e}))}}function N(){u||(S=!0,null!==l&&(C("load",l),l=null))}function m(){u||("function"==typeof s.loadModule&&s.loadModule("captions"),"function"==typeof s.setOption&&s.setOption("captions","track",{}),h("paused"),h("time"),h("duration"),h("buffering"),h("volume"),h("muted"),h("playbackSpeed"),h("subtitlesTracks"),h("selectedSubtitlesTrackId"))}function L(e){switch(h("buffering"),e.data){case YT.PlayerState.ENDED:I.emit("ended");break;case YT.PlayerState.CUED:case YT.PlayerState.UNSTARTED:case YT.PlayerState.PAUSED:case YT.PlayerState.PLAYING:h("paused"),h("time"),h("duration")}}function D(e){switch(e){case"stream":return A;case"loaded":return null!==A||null;case"paused":return null===A||"function"!=typeof s.getPlayerState?null:s.getPlayerState()!==YT.PlayerState.PLAYING;case"time":return null!==A&&"function"==typeof s.getCurrentTime&&null!==s.getCurrentTime()&&isFinite(s.getCurrentTime())?Math.floor(1e3*s.getCurrentTime()):null;case"duration":return null!==A&&"function"==typeof s.getDuration&&null!==s.getDuration()&&isFinite(s.getDuration())?Math.floor(1e3*s.getDuration()):null;case"buffering":return null===A||"function"!=typeof s.getPlayerState?null:s.getPlayerState()===YT.PlayerState.BUFFERING;case"volume":return null!==A&&"function"==typeof s.getVolume&&null!==s.getVolume()&&isFinite(s.getVolume())?s.getVolume():null;case"muted":return null===A||"function"!=typeof s.isMuted?null:s.isMuted();case"playbackSpeed":return null!==A&&"function"==typeof s.getPlaybackRate&&null!==s.getPlaybackRate()&&isFinite(s.getPlaybackRate())?s.getPlaybackRate():null;case"subtitlesTracks":return null===A||"function"!=typeof s.getOption?[]:(s.getOption("captions","tracklist")||[]).filter((function(e){return e&&"string"==typeof e.languageCode})).map((function(e,t){return Object.freeze({id:"EMBEDDED_"+String(t),lang:e.languageCode,label:"string"==typeof e.displayName?e.displayName:e.languageCode,origin:"EMBEDDED",embedded:!0})}));case"selectedSubtitlesTrackId":return null===A?null:d;default:return null}}function p(e){I.emit("error",e),e.critical&&C("unload")}function h(e){O[e]&&I.emit("propChanged",e,D(e))}function C(e,t){switch(e){case"load":if(C("unload"),t&&t.stream&&"string"==typeof t.stream.ytId)if(S){A=t.stream,h("stream"),h("loaded");var i="boolean"!=typeof t.autoplay||t.autoplay,o=null!==t.time&&isFinite(t.time)?parseInt(t.time,10)/1e3:0;i&&"function"==typeof s.loadVideoById?s.loadVideoById({videoId:t.stream.ytId,startSeconds:o}):"function"==typeof s.cueVideoById&&s.cueVideoById({videoId:t.stream.ytId,startSeconds:o}),h("paused"),h("time"),h("duration"),h("buffering"),h("volume"),h("muted"),h("playbackSpeed"),h("subtitlesTracks"),h("selectedSubtitlesTrackId")}else l=t;else p(Object.assign({},r.UNSUPPORTED_STREAM,{critical:!0,stream:t?t.stream:null}));break;case"unload":l=null,A=null,h("stream"),h("loaded"),d=null,S&&"function"==typeof s.stopVideo&&s.stopVideo(),h("paused"),h("time"),h("duration"),h("buffering"),h("volume"),h("muted"),h("playbackSpeed"),h("subtitlesTracks"),h("selectedSubtitlesTrackId");break;case"destroy":C("unload"),u=!0,I.removeAllListeners(),clearInterval(T),S&&"function"==typeof s.destroy&&s.destroy(),a.removeChild(E),a.removeChild(_)}}this.on=function(e,t){if(u)throw new Error("Video is destroyed");I.on(e,t)},this.dispatch=function(e){if(u)throw new Error("Video is destroyed");if(e)switch((e=n(o(e))).type){case"observeProp":return t=e.propName,void(O.hasOwnProperty(t)&&(I.emit("propValue",t,D(t)),O[t]=!0));case"setProp":return void(function(e,t){switch(e){case"paused":null!==A&&(t?"function"==typeof s.pauseVideo&&s.pauseVideo():"function"==typeof s.playVideo&&s.playVideo());break;case"time":null!==A&&"function"==typeof s.seekTo&&null!==t&&isFinite(t)&&s.seekTo(parseInt(t,10)/1e3);break;case"volume":null!==A&&null!==t&&isFinite(t)&&("function"==typeof s.unMute&&s.unMute(),"function"==typeof s.setVolume&&s.setVolume(Math.max(0,Math.min(100,parseInt(t,10)))),h("muted"),h("volume"));break;case"muted":null!==A&&(t?"function"==typeof s.mute&&s.mute():"function"==typeof s.unMute&&s.unMute(),h("muted"));break;case"playbackSpeed":null!==A&&"function"==typeof s.setPlaybackRate&&isFinite(t)&&(s.setPlaybackRate(t),h("playbackSpeed"));break;case"selectedSubtitlesTrackId":if(null!==A){d=null;var a=D("subtitlesTracks").find((function(e){return e.id===t}));"function"==typeof s.setOption&&(a?(d=a.id,s.setOption("captions","track",{languageCode:a.lang}),I.emit("subtitlesTrackLoaded",a)):s.setOption("captions","track",{})),h("selectedSubtitlesTrackId")}}})(e.propName,e.propValue);case"command":return void C(e.commandName,e.commandArgs)}var t;throw new Error("Invalid action dispatched: "+JSON.stringify(e))}}E.canPlayStream=function(e){return Promise.resolve(e&&"string"==typeof e.ytId)},E.manifest={name:"YouTubeVideo",external:!1,props:["stream","loaded","paused","time","duration","buffering","volume","muted","playbackSpeed","subtitlesTracks","selectedSubtitlesTrackId"],commands:["load","unload","destroy"],events:["propValue","propChanged","ended","error","subtitlesTrackLoaded"]},e.exports=E},7342:(e,t,a)=>{var i=a(98388);e.exports=i},18387:e=>{e.exports={CHROMECAST_SENDER_VIDEO:{INVALID_MESSAGE_RECEIVED:{code:100,message:"Invalid message received"},MESSAGE_SEND_FAILED:{code:101,message:"Failed to send message"}},YOUTUBE_VIDEO:{API_LOAD_FAILED:{code:90,message:"YouTube player iframe API failed to load"},INVALID_PARAMETER:{code:91,message:"The request contains an invalid parameter value"},HTML5_VIDEO:{code:92,message:"The requested content cannot be played in an HTML5 player"},VIDEO_NOT_FOUND:{code:93,message:"The video requested was not found"},VIDEO_NOT_EMBEDDABLE:{code:94,message:"The owner of the requested video does not allow it to be played in embedded players"}},HTML_VIDEO:{MEDIA_ERR_ABORTED:{code:80,message:"Fetching process aborted"},MEDIA_ERR_NETWORK:{code:81,message:"Error occurred when downloading"},MEDIA_ERR_DECODE:{code:82,message:"Error occurred when decoding"},MEDIA_ERR_SRC_NOT_SUPPORTED:{code:83,message:"Video is not supported"}},WITH_HTML_SUBTITLES:{LOAD_FAILED:{code:70,message:"Failed to load external subtitles"}},WITH_STREAMING_SERVER:{CONVERT_FAILED:{code:60,message:"Your device does not support the stream"}},UNKNOWN_ERROR:{code:1,message:"Unknown error"},UNSUPPORTED_STREAM:{code:2,message:"Stream is not supported"},STREAM_FAILED_TO_LOAD:{code:3,message:"Stream failed to load"}}},63009:(e,t,a)=>{var i=a(62030);e.exports=i},22747:e=>{var t,a,i=[{codec:"h264",force:window.chrome||window.cast,mime:'video/mp4; codecs="avc1.42E01E"'},{codec:"h265",mime:'video/mp4; codecs="hev1.1.6.L150.B0"',aliases:["hevc"]},{codec:"vp8",mime:'video/mp4; codecs="vp8"'},{codec:"vp9",mime:'video/mp4; codecs="vp9"'}],o=[{codec:"aac",mime:'audio/mp4; codecs="mp4a.40.2"'},{codec:"mp3",mime:'audio/mp4; codecs="mp3"'},{codec:"ac3",mime:'audio/mp4; codecs="ac-3"'},{codec:"eac3",mime:'audio/mp4; codecs="ec-3"'},{codec:"vorbis",mime:'audio/mp4; codecs="vorbis"'},{codec:"opus",mime:'audio/mp4; codecs="opus"'}];function n(e,t){return e.force||t.mediaElement.canPlayType(e.mime)?[e.codec].concat(e.aliases||[]):[]}e.exports=(t=document.createElement("video"),a=["mp4"],(window.chrome||window.cast)&&a.push("matroska,webm"),{formats:a,videoCodecs:i.map((function(e){return n(e,{mediaElement:t})})).reduce((function(e,t){return e.concat(t)}),[]),audioCodecs:o.map((function(e){return n(e,{mediaElement:t})})).reduce((function(e,t){return e.concat(t)}),[]),maxAudioChannels:(function(){if(/firefox/i.test(window.navigator.userAgent))return 6;if(!window.AudioContext||window.chrome||window.cast)return 2;var e=(new AudioContext).destination.maxChannelCount;return e>0?e:2})()})},3690:e=>{var t=null;e.exports={set:function(e){t=e},get:function(){return t}}},81057:(e,t,a)=>{var i=a(3690);e.exports=function(){return["Tizen","webOS","Titan","NetTV"].includes(i.get())||void 0!==window.qt?Promise.resolve(!1):Promise.resolve(!0)}},13001:e=>{e.exports=function(e,t){fetch("http://127.0.0.1:11470/tracks/"+encodeURIComponent(e)).then((function(e){return e.json()})).then((function(e){var a=e.filter((function(e){return"audio"===(e||{}).type})),i=e.filter((function(e){return"text"===(e||{}).type}));t({audio:a,subs:i})})).catch((function(e){console.error(e),t(!1)}))}},42703:e=>{e.exports=function(e,t){if(tt?i=n-1:(e[n]{var i=a(60854);e.exports=i},93733:e=>{function t(e){for(var t="",a=(e=e.replace(/<[a-zA-Z/][^>]*>/g,"")).split(/\n/);a.length>3;){for(var i=3;i\s*(\d+):(\d+):(\d+)(?:,(\d+))?/);return n?(t+=n[1]+":"+n[2]+":"+n[3]+"."+n[4]+" --\x3e "+n[5]+":"+n[6]+":"+n[7]+"."+n[8]+"\n",a[o+=1]&&(t+=a[o]+"\n\n"),t):""}e.exports={convert:function(e){if(e.includes("WEBVTT"))return e;try{return(function(e){var a=e.replace(/\r+/g,""),i=(a=a.replace(/^\s+|\s+$/g,"")).split("\n\n"),o="";if(i.length>0){o+="WEBVTT\n\n";for(var n=0;n{var i=a(2626),o=a(42703);e.exports={parse:function(e){return new Promise((function(t,a){var n=new i.WebVTT.Parser(window,i.WebVTT.StringDecoder()),r=[],E=[],_={};n.oncue=function(e){var t={startTime:1e3*e.startTime|0,endTime:1e3*e.endTime|0,text:e.text};E.push(t),_[t.startTime]=_[t.startTime]||[],_[t.endTime]=_[t.endTime]||[]},n.onparsingerror=function(e){0===e.code?(n.oncue=null,n.onparsingerror=null,n.onflush=null,a(e)):(console.warn("Subtitles parsing error",e),r.push(e))},n.onflush=function(){_.times=Object.keys(_).map((function(e){return parseInt(e,10)})).sort((function(e,t){return e-t}));for(var e=0;e{var i=a(2626),o=a(42703);e.exports={render:function(e,t){var a=[],n=o(e.times,t);if(-1!==n)for(var r=e[e.times[n]],E=0;E{var i=a(92255),o=a(67193),n=a(52653),r=a(2520),E=a(18387),_=a(70910),T=a(17186),s=a(93733);e.exports=function(e){function t(t){var a=new e(t=t||{});a.on("error",(function(e){A.emit("error",e),e.critical&&M("unload")})),a.on("propValue",P.bind(null,"propValue")),a.on("propChanged",P.bind(null,"propChanged")),e.manifest.events.filter((function(e){return!["error","propValue","propChanged"].includes(e)})).forEach((function(e){a.on(e,(function(e){return function(){A.emit.apply(A,[e].concat(Array.from(arguments)))}})(e))}));var S=t.containerElement;if(!(S instanceof HTMLElement))throw new Error("Container element required to be instance of HTMLElement");var l=document.createElement("div");l.style.position="absolute",l.style.right="0",l.style.bottom="0",l.style.left="0",l.style.zIndex="1",l.style.textAlign="center",S.style.position="relative",S.style.zIndex="0",S.appendChild(l);var I={time:null},u=null,A=new i,d=!1,O=[],c=null,R=null,N=100,m=0,L="rgb(255, 255, 255)",D="rgba(0, 0, 0, 0)",p="rgb(34, 34, 34)",h=1,C={extraSubtitlesTracks:!1,selectedExtraSubtitlesTrackId:!1,extraSubtitlesDelay:!1,extraSubtitlesSize:!1,extraSubtitlesOffset:!1,extraSubtitlesTextColor:!1,extraSubtitlesBackgroundColor:!1,extraSubtitlesOutlineColor:!1,extraSubtitlesOpacity:!1};function f(){for(;l.hasChildNodes();)l.removeChild(l.lastChild);null!==u&&null!==I.time&&isFinite(I.time)&&(l.style.bottom=m+"%",l.style.opacity=h,T.render(u,I.time-R).forEach((function(e){e.style.display="inline-block",e.style.padding="0.2em",e.style.whiteSpace="pre-wrap",e.style.fontSize=Math.floor(N/25)+"vmin",e.style.color=L,e.style.backgroundColor=D,e.style.textShadow="1px 1px 0.1em "+p,l.appendChild(e),l.appendChild(document.createElement("br"))})))}function P(e,t,a){if("time"===t)I.time=a,f();A.emit(e,t,g(t,a))}function B(e){C[e]&&A.emit("propChanged",e,g(e,null))}function g(e,t){switch(e){case"extraSubtitlesTracks":return d?[]:O.slice();case"selectedExtraSubtitlesTrackId":return d?null:c;case"extraSubtitlesDelay":return d?null:R;case"extraSubtitlesSize":return d?null:N;case"extraSubtitlesOffset":return d?null:m;case"extraSubtitlesTextColor":return d?null:L;case"extraSubtitlesBackgroundColor":return d?null:D;case"extraSubtitlesOutlineColor":return d?null:p;case"extraSubtitlesOpacity":return d?null:h;default:return t}}function v(e,t){switch(e){case"selectedExtraSubtitlesTrackId":u=null,c=null,R=null;var i=O.find((function(e){return e.id===t}));if(i){c=i.id,R=0,(function e(t,o){(function(e){if("string"==typeof e.url)return fetch(e.url).then((function(e){if(e.ok)return e.text();throw new Error(e.status+" ("+e.statusText+")")}));if(e.buffer instanceof ArrayBuffer)try{const t=new Uint8Array(e.buffer),a=(new TextDecoder).decode(t);return Promise.resolve(a)}catch(e){return Promise.reject(e)}return Promise.reject("No `url` or `buffer` field available for this track")})(t).then((function(e){return s.convert(e)})).then((function(e){return _.parse(e)})).then((function(e){c===i.id&&(u=e,f(),A.emit("extraSubtitlesTrackLoaded",i))})).catch((function(t){c===i.id&&(o||"string"!=typeof i.fallbackUrl?(function(e){A.emit("error",e),e.critical&&(M("unload"),a.dispatch({type:"command",commandName:"unload"}))})(Object.assign({},E.WITH_HTML_SUBTITLES.LOAD_FAILED,{error:t,track:i,critical:!1})):e(i,!0))}))})(i)}return f(),B("selectedExtraSubtitlesTrackId"),B("extraSubtitlesDelay"),!0;case"extraSubtitlesDelay":return null!==c&&null!==t&&isFinite(t)&&(R=parseInt(t,10),f(),B("extraSubtitlesDelay")),!0;case"extraSubtitlesSize":return null!==t&&isFinite(t)&&(N=Math.max(0,parseInt(t,10)),f(),B("extraSubtitlesSize")),!0;case"extraSubtitlesOffset":return null!==t&&isFinite(t)&&(m=Math.max(0,Math.min(100,parseInt(t,10))),f(),B("extraSubtitlesOffset")),!0;case"extraSubtitlesTextColor":if("string"==typeof t){try{L=r(t).rgb().string()}catch(e){console.error("withHTMLSubtitles",e)}f(),B("extraSubtitlesTextColor")}return!0;case"extraSubtitlesBackgroundColor":if("string"==typeof t){try{D=r(t).rgb().string()}catch(e){console.error("withHTMLSubtitles",e)}f(),B("extraSubtitlesBackgroundColor")}return!0;case"extraSubtitlesOutlineColor":if("string"==typeof t){try{p=r(t).rgb().string()}catch(e){console.error("withHTMLSubtitles",e)}f(),B("extraSubtitlesOutlineColor")}return!0;case"extraSubtitlesOpacity":if("number"==typeof t){try{h=Math.min(Math.max(t/100,0),1)}catch(e){console.error("withHTMLSubtitles",e)}f(),B("extraSubtitlesOpacity")}return!0;default:return!1}}function M(e,t){switch(e){case"addExtraSubtitlesTracks":return t&&Array.isArray(t.tracks)&&(O=O.concat(t.tracks).filter((function(e,t,a){return e&&"string"==typeof e.id&&"string"==typeof e.lang&&"string"==typeof e.label&&"string"==typeof e.origin&&!e.embedded&&t===a.findIndex((function(t){return t.id===e.id}))})),B("extraSubtitlesTracks")),!0;case"addLocalSubtitles":if(t&&"string"==typeof t.filename&&t.buffer instanceof ArrayBuffer){var i="LOCAL_"+O.filter((function(e){return e.local})).length,o={id:i,url:null,buffer:t.buffer,lang:"local",label:t.filename,origin:"LOCAL",local:!0,embedded:!1};O.push(o),B("extraSubtitlesTracks"),A.emit("extraSubtitlesTrackAdded",o)}return!0;case"load":return M("unload"),t.stream&&Array.isArray(t.stream.subtitles)&&M("addExtraSubtitlesTracks",{tracks:t.stream.subtitles.map((function(e){return Object.assign({},e,{origin:"EXCLUSIVE",exclusive:!0,embedded:!1})}))}),!1;case"unload":return u=null,O=[],c=null,R=null,f(),B("extraSubtitlesTracks"),B("selectedExtraSubtitlesTrackId"),B("extraSubtitlesDelay"),!1;case"destroy":return M("unload"),d=!0,B("extraSubtitlesSize"),B("extraSubtitlesOffset"),B("extraSubtitlesTextColor"),B("extraSubtitlesBackgroundColor"),B("extraSubtitlesOutlineColor"),B("extraSubtitlesOpacity"),a.dispatch({type:"command",commandName:"destroy"}),A.removeAllListeners(),S.removeChild(l),!0;default:return!1}}this.on=function(e,t){if(d)throw new Error("Video is destroyed");A.on(e,t)},this.dispatch=function(e){if(d)throw new Error("Video is destroyed");if(e)switch((e=n(o(e))).type){case"observeProp":if((function(e){switch(e){case"extraSubtitlesTracks":case"selectedExtraSubtitlesTrackId":case"extraSubtitlesDelay":case"extraSubtitlesSize":case"extraSubtitlesOffset":case"extraSubtitlesTextColor":case"extraSubtitlesBackgroundColor":case"extraSubtitlesOutlineColor":case"extraSubtitlesOpacity":return A.emit("propValue",e,g(e,null)),C[e]=!0,!0;default:return!1}})(e.propName))return;break;case"setProp":if(v(e.propName,e.propValue))return;break;case"command":if(M(e.commandName,e.commandArgs))return}a.dispatch(e)}}return t.canPlayStream=function(t){return e.canPlayStream(t)},t.manifest={name:e.manifest.name+"WithHTMLSubtitles",external:e.manifest.external,props:e.manifest.props.concat(["extraSubtitlesTracks","selectedExtraSubtitlesTrackId","extraSubtitlesDelay","extraSubtitlesSize","extraSubtitlesOffset","extraSubtitlesTextColor","extraSubtitlesBackgroundColor","extraSubtitlesOutlineColor","extraSubtitlesOpacity"]).filter((function(e,t,a){return a.indexOf(e)===t})),commands:e.manifest.commands.concat(["load","unload","destroy","addExtraSubtitlesTracks","addLocalSubtitles"]).filter((function(e,t,a){return a.indexOf(e)===t})),events:e.manifest.events.concat(["propValue","propChanged","error","extraSubtitlesTrackLoaded","extraSubtitlesTrackAdded"]).filter((function(e,t,a){return a.indexOf(e)===t}))},t}},30878:(e,t,a)=>{var i=a(36372),o=a(41968),n=a(28819);function r(e,t,a,o){var n=new URL(t),r=new URLSearchParams;return r.set("d",n.origin),Object.entries(a).forEach((function(e){r.append("h",e[0]+":"+e[1])})),Object.entries(o).forEach((function(e){r.append("r",e[0]+":"+e[1])})),i.resolve(e,"/proxy/"+r.toString()+n.pathname)+n.search}e.exports=function(e,t,a,i){return new Promise((function(E,_){if("string"!=typeof t.url)"string"!=typeof t.infoHash?_(new Error("Stream cannot be converted")):n(e,t.infoHash,t.fileIdx,t.announce,a).then((function(e){E({url:e.url,infoHash:e.infoHash,fileIdx:e.fileIdx})})).catch((function(e){_(e)}));else if(0===t.url.indexOf("magnet:")){var T;try{if(!(T=o.decode(t.url))||"string"!=typeof T.infoHash)throw new Error("Failed to decode magnet url")}catch(e){return void _(e)}var s=Array.isArray(T.announce)?T.announce.map((function(e){return"tracker:"+e})):[];n(e,T.infoHash,null,s,a).then((function(e){E({url:e.url,infoHash:e.infoHash,fileIdx:e.fileIdx})})).catch((function(e){_(e)}))}else{var S=i&&i.proxyStreamsEnabled,l=t.behaviorHints&&t.behaviorHints.proxyHeaders;if(S||l){var I=l&&l.request?l.request:{},u=l&&l.response?l.response:{};E({url:r(e,t.url,I,u)})}else E({url:t.url})}}))}},28819:(e,t,a)=>{var i=a(36372);function o(e,t,a,o){var n=Array.isArray(o)&&o.length>0?"?"+new URLSearchParams(o.map((function(e){return["tr",e]}))):"";return{url:i.resolve(e,"/"+encodeURIComponent(t)+"/"+encodeURIComponent(a))+n,infoHash:t,fileIdx:a,sources:o}}e.exports=function(e,t,a,n,r){if((!Array.isArray(n)||0===n.length)&&null!==a&&isFinite(a))return Promise.resolve(o(e,t,a,n));var E={torrent:{infoHash:t}};return Array.isArray(n)&&n.length>0&&(E.peerSearch={sources:["dht:"+t].concat(n).filter((function(e,t,a){return a.indexOf(e)===t})),min:40,max:200}),null!==a&&isFinite(a)?E.guessFileIdx=!1:(E.guessFileIdx={},r&&(null!==r.season&&isFinite(r.season)&&(E.guessFileIdx.season=r.season),null!==r.episode&&isFinite(r.episode)&&(E.guessFileIdx.episode=r.episode))),fetch(i.resolve(e,"/"+encodeURIComponent(t)+"/create"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(E)}).then((function(e){if(e.ok)return e.json();throw new Error(e.status+" ("+e.statusText+")")})).then((function(i){return o(e,t,E.guessFileIdx?i.guessedFileIdx:a,E.peerSearch?E.peerSearch.sources:[])}))}},21172:(e,t,a)=>{var i=a(36372);function o(e,t,a){var o=a&&"string"==typeof a.videoHash?a.videoHash:null,n=a&&isFinite(a.videoSize)?a.videoSize:null;if("string"==typeof o&&null!==n&&isFinite(n))return Promise.resolve({hash:o,size:n});var r=new URLSearchParams([["videoUrl",t]]);return fetch(i.resolve(e,"/opensubHash?"+r.toString())).then((function(e){if(e.ok)return e.json();throw new Error(e.status+" ("+e.statusText+")")})).then((function(e){if(e.error)throw new Error(e.error);return{hash:"string"==typeof o?o:e.result&&"string"==typeof e.result.hash?e.result.hash:null,size:null!==n&&isFinite(n)?n:e.result&&(e.result.size,1)?e.result.size:null}}))}function n(e,t,a,o,n){return n&&"string"==typeof n.filename?Promise.resolve(n.filename):a?fetch(i.resolve(e,"/"+encodeURIComponent(a)+"/"+encodeURIComponent(o)+"/stats.json")).then((function(e){if(e.ok)return e.json();throw new Error(e.status+" ("+e.statusText+")")})).then((function(e){if(!e||"string"!=typeof e.streamName)throw new Error("Could not retrieve filename from torrent");return e.streamName})):Promise.resolve(decodeURIComponent(t.split("/").pop()))}e.exports=function(e,t,a,i,r){return Promise.allSettled([o(e,t,r),n(e,t,a,i,r)]).then((function(e){var t={hash:null,size:null,filename:null};return"fulfilled"===e[0].status?(t.hash=e[0].value.hash,t.size=e[0].value.size):e[0].reason&&console.error(e[0].reason),"fulfilled"===e[1].status?t.filename=e[1].value:e[1].reason&&console.error(e[1].reason),t}))}},80445:(e,t,a)=>{var i=a(15826);e.exports=i},47245:e=>{e.exports=function(e,t){return t.includes("loaded")?new Promise((function(t,a){var i=null;e.on("propChanged",(function(e,o){"loaded"===e&&null!==o&&null===i&&(i=o,!0===o?t(!0):!1===o&&a(Error("Player failed to load, will not retrieve video params")))})),e.dispatch({type:"observeProp",propName:"loaded"})})):Promise.resolve(!0)}},15826:(e,t,a)=>{var i=a(92255),o=a(36372),n=a(39590),r=a(67193),E=a(52653),_=a(22747),T=a(30878),s=a(21172),S=a(47245),l=a(81057),I=a(18387);e.exports=function(e){function t(a){var l=new e(a=a||{});l.on("error",(function(e){R.emit("error",e),e.critical&&C("unload")})),l.on("propValue",L.bind(null,"propValue")),l.on("propChanged",L.bind(null,"propChanged")),e.manifest.events.filter((function(e){return!["error","propValue","propChanged"].includes(e)})).forEach((function(e){l.on(e,(function(e){return function(){R.emit.apply(R,[e].concat(Array.from(arguments)))}})(e))}));var u=this,A=null,d=!1,O=[],c=null,R=new i,N=!1,m={stream:!1,videoParams:!1};function L(e,t,a){R.emit(e,t,h(t,a))}function D(e){m[e]&&R.emit("propChanged",e,h(e,null))}function p(e){R.emit("error",e),e.critical&&(C("unload"),l.dispatch({type:"command",commandName:"unload"}))}function h(e,t){switch(e){case"stream":return null!==A?A.stream:null;case"videoParams":return c;default:return t}}function C(a,i){switch(a){case"load":return i&&i.stream&&"string"==typeof i.streamingServerURL?(C("unload"),l.dispatch({type:"command",commandName:"unload"}),A=i,D("stream"),T(i.streamingServerURL,i.stream,i.seriesInfo,i.streamingServerSettings).then((function(e){var a=e.url,r=e.infoHash,E=e.fileIdx,T=Array.isArray(i.formats)?i.formats:_.formats,s=Array.isArray(i.videoCodecs)?i.videoCodecs:_.videoCodecs,S=Array.isArray(i.audioCodecs)?i.audioCodecs:_.audioCodecs,l=null!==i.maxAudioChannels&&isFinite(i.maxAudioChannels)?i.maxAudioChannels:_.maxAudioChannels,I=Object.assign({},i,{formats:T,videoCodecs:s,audioCodecs:S,maxAudioChannels:l});return(i.forceTranscoding?Promise.resolve(!1):t.canPlayStream({url:a},I)).catch((function(e){return console.warn("Media probe error",e),!1})).then((function(e){if(e)return{mediaURL:a,infoHash:r,fileIdx:E,stream:{url:a}};var t=n(),_=new URLSearchParams([["mediaURL",a]]);return i.forceTranscoding&&_.set("forceTranscoding","1"),s.forEach((function(e){_.append("videoCodecs",e)})),S.forEach((function(e){_.append("audioCodecs",e)})),_.set("maxAudioChannels",l),{mediaURL:a,infoHash:r,fileIdx:E,stream:{url:o.resolve(i.streamingServerURL,"/hlsv2/"+t+"/master.m3u8?"+_.toString()),subtitles:Array.isArray(i.stream.subtitles)?i.stream.subtitles.map((function(e){return Object.assign({},e,{url:"string"==typeof e.url?o.resolve(i.streamingServerURL,"/subtitles.vtt?"+new URLSearchParams([["from",e.url]]).toString()):e.url})})):[],behaviorHints:{headers:{"content-type":"application/vnd.apple.mpegurl"}}}}}))})).then((function(t){i===A&&(l.dispatch({type:"command",commandName:"load",commandArgs:Object.assign({},i,{stream:t.stream})}),d=!0,(function(){for(;O.length>0;){var e=O.shift();u.dispatch.call(u,e)}})(),S(l,e.manifest.props).then((function(){return s(i.streamingServerURL,t.mediaURL,t.infoHash,t.fileIdx,i.stream.behaviorHints)})).then((function(e){i===A&&(c=e,D("videoParams"))})).catch((function(e){i===A&&(console.error(e),c={hash:null,size:null,filename:null},D("videoParams"))})))})).catch((function(e){i===A&&p(Object.assign({},I.WITH_STREAMING_SERVER.CONVERT_FAILED,{error:e,critical:!0,stream:i.stream,streamingServerURL:i.streamingServerURL}))}))):p(Object.assign({},I.UNSUPPORTED_STREAM,{critical:!0,stream:i?i.stream:null,streamingServerURL:i&&"string"==typeof i.streamingServerURL?i.streamingServerURL:null})),!0;case"addExtraSubtitlesTracks":return A&&i&&Array.isArray(i.tracks)&&(d?l.dispatch({type:"command",commandName:"addExtraSubtitlesTracks",commandArgs:Object.assign({},i,{tracks:i.tracks.map((function(e){return Object.assign({},e,{fallbackUrl:e.url,url:"string"==typeof e.url?o.resolve(A.streamingServerURL,"/subtitles.vtt?"+new URLSearchParams([["from",e.url]]).toString()):e.url})}))})}):O.push({type:"command",commandName:"addExtraSubtitlesTracks",commandArgs:i})),!0;case"unload":return A=null,d=!1,O=[],c=null,D("stream"),D("videoParams"),!1;case"destroy":return C("unload"),N=!0,l.dispatch({type:"command",commandName:"destroy"}),R.removeAllListeners(),!0;default:return!d&&(O.push({type:"command",commandName:a,commandArgs:i}),!0)}}this.on=function(e,t){if(N)throw new Error("Video is destroyed");R.on(e,t)},this.dispatch=function(e){if(N)throw new Error("Video is destroyed");if(e)switch((e=E(r(e))).type){case"observeProp":if((function(e){switch(e){case"stream":case"videoParams":return R.emit("propValue",e,h(e,null)),m[e]=!0,!0;default:return!1}})(e.propName))return;break;case"command":if(C(e.commandName,e.commandArgs))return}l.dispatch(e)}}return t.canPlayStream=function(t,a){return l().then((function(i){if(!i)return e.canPlayStream(t);var n=new URLSearchParams([["mediaURL",t.url]]);return fetch(o.resolve(a.streamingServerURL,"/hlsv2/probe?"+n.toString())).then((function(e){return e.json()})).then((function(e){var t=a.formats.some((function(t){return-1!==e.format.name.indexOf(t)})),i=e.streams.every((function(e){return"audio"===e.track?e.channels<=a.maxAudioChannels&&-1!==a.audioCodecs.indexOf(e.codec):"video"!==e.track||-1!==a.videoCodecs.indexOf(e.codec)}));return t&&i})).catch((function(){return e.canPlayStream(t)}))}))},t.manifest={name:e.manifest.name+"WithStreamingServer",external:e.manifest.external,props:e.manifest.props.concat(["stream","videoParams"]).filter((function(e,t,a){return a.indexOf(e)===t})),commands:e.manifest.commands.concat(["load","unload","destroy","addExtraSubtitlesTracks"]).filter((function(e,t,a){return a.indexOf(e)===t})),events:e.manifest.events.concat(["propValue","propChanged","error"]).filter((function(e,t,a){return a.indexOf(e)===t}))},t}},39735:(e,t,a)=>{var i=a(83662);e.exports=i},83662:(e,t,a)=>{var i=a(92255),o=a(67193),n=a(52653);e.exports=function(e){function t(t){var a=new e(t=t||{});a.on("propValue",s.bind(null,"propValue")),a.on("propChanged",s.bind(null,"propChanged")),e.manifest.events.filter((function(e){return!["propValue","propChanged"].includes(e)})).forEach((function(e){a.on(e,(function(e){return function(){E.emit.apply(E,[e].concat(Array.from(arguments)))}})(e))}));var r=null,E=new i,_=!1,T={videoParams:!1};function s(e,t,a){"videoParams"!==t&&E.emit(e,t,S(t,a)),"stream"===t&&(r=a,(function(e){T[e]&&E.emit("propChanged",e,S(e,null))})("videoParams"))}function S(e,t){return"videoParams"===e?null===r?null:{hash:r.behaviorHints&&"string"==typeof r.behaviorHints.videoHash?r.behaviorHints.videoHash:null,size:r.behaviorHints&&null!==r.behaviorHints.videoSize&&isFinite(r.behaviorHints.videoSize)?r.behaviorHints.videoSize:null,filename:r.behaviorHints&&"string"==typeof r.behaviorHints.filename?r.behaviorHints.filename:null}:t}this.on=function(e,t){if(_)throw new Error("Video is destroyed");E.on(e,t)},this.dispatch=function(e){if(_)throw new Error("Video is destroyed");if(e)switch((e=n(o(e))).type){case"observeProp":if("videoParams"===(i=e.propName)&&(E.emit("propValue",i,S(i,null)),T[i]=!0,1))return;break;case"command":if(t=e.commandName,e.commandArgs,"destroy"===t&&(_=!0,a.dispatch({type:"command",commandName:"destroy"}),E.removeAllListeners(),1))return}var t,i;a.dispatch(e)}}return t.canPlayStream=function(t,a){return e.canPlayStream(t,a)},t.manifest={name:e.manifest.name+"WithVideoParams",external:e.manifest.external,props:e.manifest.props.concat(["videoParams"]).filter((function(e,t,a){return a.indexOf(e)===t})),commands:e.manifest.commands.concat(["destroy"]).filter((function(e,t,a){return a.indexOf(e)===t})),events:e.manifest.events.concat(["propValue","propChanged"]).filter((function(e,t,a){return a.indexOf(e)===t}))},t}},21154:function(e){"undefined"!=typeof self&&self,e.exports=(function(e){var t={};function a(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,a),o.l=!0,o.exports}return a.m=e,a.c=t,a.d=function(e,t,i){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(a.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)a.d(i,o,function(t){return e[t]}.bind(null,o));return i},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=1)})([function(e,t,a){"use strict";var i=a(3);function o(e){return!0===i(e)&&"[object Object]"===Object.prototype.toString.call(e)}e.exports=function(e){var t,a;return!1!==o(e)&&"function"==typeof(t=e.constructor)&&!1!==o(a=t.prototype)&&!1!==a.hasOwnProperty("isPrototypeOf")}},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VERSION=t.PALETTE_MATERIAL_CHROME=t.PALETTE_MATERIAL_500=t.COLOR_NAMES=t.getLuminance=t.intToRgb=t.rgbToInt=t.rgbToHsv=t.rgbToHsl=t.hslToRgb=t.rgbToHex=t.parseColor=t.parseColorToHsla=t.parseColorToHsl=t.parseColorToRgba=t.parseColorToRgb=t.from=t.createPicker=void 0;var i=(function(){function e(e,t){for(var a=0;a-1,l="undefined"!=typeof window&&window.navigator.userAgent.indexOf("rv:")>-1,I={id:null,attachTo:"body",showHSL:!0,showRGB:!0,showHEX:!0,showAlpha:!1,color:"#ff0000",palette:null,paletteEditable:!1,useAlphaInPalette:"auto",slBarSize:[232,150],hueBarSize:[150,11],alphaBarSize:[150,11]},u="COLOR",A="RGBA_USER",d="HSLA_USER";function O(e,t,a){return e?e instanceof HTMLElement?e:e instanceof NodeList?e[0]:"string"==typeof e?document.querySelector(e):e.jquery?e.get(0):a?t:null:t}function c(e){var t=e.getContext("2d"),a=+e.width,i=+e.height,r=t.createLinearGradient(1,1,1,i-1);return r.addColorStop(0,"white"),r.addColorStop(1,"black"),{setHue:function(e){var o=t.createLinearGradient(1,0,a-1,0);o.addColorStop(0,"hsla("+e+", 100%, 50%, 0)"),o.addColorStop(1,"hsla("+e+", 100%, 50%, 1)"),t.fillStyle=r,t.fillRect(0,0,a,i),t.fillStyle=o,t.globalCompositeOperation="multiply",t.fillRect(0,0,a,i),t.globalCompositeOperation="source-over"},grabColor:function(e,a){return t.getImageData(e,a,1,1).data},findColor:function(e,t,r){var E=(0,n.rgbToHsv)(e,t,r),_=o(E,3),T=_[1],s=_[2];return[T*a,i-s*i]}}}function R(e,t,a){return null===e?t:/^\s*$/.test(e)?a:!!/true|yes|1/i.test(e)||!/false|no|0/i.test(e)&&t}function N(e,t,a){if(null===e)return t;if(/^\s*$/.test(e))return a;var i=e.split(",").map(Number);return 2===i.length&&i[0]&&i[1]?i:t}var m=(function(){function e(t,a){if(T(this,e),a?(t=O(t),this.options=Object.assign({},I,a)):t&&(0,r.default)(t)?(this.options=Object.assign({},I,t),t=O(this.options.attachTo)):(this.options=Object.assign({},I),t=O((0,n.nvl)(t,this.options.attachTo))),!t)throw new Error("Container not found: "+this.options.attachTo);!(function(e,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"acp-";if(t.hasAttribute(a+"show-hsl")&&(e.showHSL=R(t.getAttribute(a+"show-hsl"),I.showHSL,!0)),t.hasAttribute(a+"show-rgb")&&(e.showRGB=R(t.getAttribute(a+"show-rgb"),I.showRGB,!0)),t.hasAttribute(a+"show-hex")&&(e.showHEX=R(t.getAttribute(a+"show-hex"),I.showHEX,!0)),t.hasAttribute(a+"show-alpha")&&(e.showAlpha=R(t.getAttribute(a+"show-alpha"),I.showAlpha,!0)),t.hasAttribute(a+"palette-editable")&&(e.paletteEditable=R(t.getAttribute(a+"palette-editable"),I.paletteEditable,!0)),t.hasAttribute(a+"sl-bar-size")&&(e.slBarSize=N(t.getAttribute(a+"sl-bar-size"),I.slBarSize,[232,150])),t.hasAttribute(a+"hue-bar-size")&&(e.hueBarSize=N(t.getAttribute(a+"hue-bar-size"),I.hueBarSize,[150,11]),e.alphaBarSize=e.hueBarSize),t.hasAttribute(a+"palette")){var i=t.getAttribute(a+"palette");switch(i){case"PALETTE_MATERIAL_500":e.palette=n.PALETTE_MATERIAL_500;break;case"PALETTE_MATERIAL_CHROME":case"":e.palette=n.PALETTE_MATERIAL_CHROME;break;default:e.palette=i.split(/[;|]/)}}t.hasAttribute(a+"color")&&(e.color=t.getAttribute(a+"color"))})(this.options,t),this.H=0,this.S=0,this.L=0,this.R=0,this.G=0,this.B=0,this.A=1,this.palette={},this.element=document.createElement("div"),this.options.id&&(this.element.id=this.options.id),this.element.className="a-color-picker",this.element.innerHTML=E.default,t.appendChild(this.element);var i=this.element.querySelector(".a-color-picker-h");this.setupHueCanvas(i),this.hueBarHelper=c(i),this.huePointer=this.element.querySelector(".a-color-picker-h+.a-color-picker-dot");var o=this.element.querySelector(".a-color-picker-sl");this.setupSlCanvas(o),this.slBarHelper=c(o),this.slPointer=this.element.querySelector(".a-color-picker-sl+.a-color-picker-dot"),this.preview=this.element.querySelector(".a-color-picker-preview"),this.setupClipboard(this.preview.querySelector(".a-color-picker-clipbaord")),this.options.showHSL?(this.setupInput(this.inputH=this.element.querySelector(".a-color-picker-hsl>input[nameref=H]")),this.setupInput(this.inputS=this.element.querySelector(".a-color-picker-hsl>input[nameref=S]")),this.setupInput(this.inputL=this.element.querySelector(".a-color-picker-hsl>input[nameref=L]"))):this.element.querySelector(".a-color-picker-hsl").remove(),this.options.showRGB?(this.setupInput(this.inputR=this.element.querySelector(".a-color-picker-rgb>input[nameref=R]")),this.setupInput(this.inputG=this.element.querySelector(".a-color-picker-rgb>input[nameref=G]")),this.setupInput(this.inputB=this.element.querySelector(".a-color-picker-rgb>input[nameref=B]"))):this.element.querySelector(".a-color-picker-rgb").remove(),this.options.showHEX?this.setupInput(this.inputRGBHEX=this.element.querySelector("input[nameref=RGBHEX]")):this.element.querySelector(".a-color-picker-rgbhex").remove(),this.options.paletteEditable||this.options.palette&&this.options.palette.length>0?this.setPalette(this.paletteRow=this.element.querySelector(".a-color-picker-palette")):(this.paletteRow=this.element.querySelector(".a-color-picker-palette"),this.paletteRow.remove()),this.options.showAlpha?(this.setupAlphaCanvas(this.element.querySelector(".a-color-picker-a")),this.alphaPointer=this.element.querySelector(".a-color-picker-a+.a-color-picker-dot")):this.element.querySelector(".a-color-picker-alpha").remove(),this.element.style.width=this.options.slBarSize[0]+"px",this.onValueChanged(u,this.options.color)}return i(e,[{key:"setupHueCanvas",value:function(e){var t=this;e.width=this.options.hueBarSize[0],e.height=this.options.hueBarSize[1];for(var a=e.getContext("2d"),i=a.createLinearGradient(0,0,this.options.hueBarSize[0],0),o=0;o<=1;o+=1/360)i.addColorStop(o,"hsl("+360*o+", 100%, 50%)");a.fillStyle=i,a.fillRect(0,0,this.options.hueBarSize[0],this.options.hueBarSize[1]);var r=function(a){var i=(0,n.limit)(a.clientX-e.getBoundingClientRect().left,0,t.options.hueBarSize[0]),o=Math.round(360*i/t.options.hueBarSize[0]);t.huePointer.style.left=i-7+"px",t.onValueChanged("H",o)},E=function e(){document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",e)};e.addEventListener("mousedown",(function(e){r(e),document.addEventListener("mousemove",r),document.addEventListener("mouseup",E)}))}},{key:"setupSlCanvas",value:function(e){var t=this;e.width=this.options.slBarSize[0],e.height=this.options.slBarSize[1];var a=function(a){var i=(0,n.limit)(a.clientX-e.getBoundingClientRect().left,0,t.options.slBarSize[0]-1),o=(0,n.limit)(a.clientY-e.getBoundingClientRect().top,0,t.options.slBarSize[1]-1),r=t.slBarHelper.grabColor(i,o);t.slPointer.style.left=i-7+"px",t.slPointer.style.top=o-7+"px",t.onValueChanged("RGB",r)},i=function e(){document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",e)};e.addEventListener("mousedown",(function(e){a(e),document.addEventListener("mousemove",a),document.addEventListener("mouseup",i)}))}},{key:"setupAlphaCanvas",value:function(e){var t=this;e.width=this.options.alphaBarSize[0],e.height=this.options.alphaBarSize[1];var a=e.getContext("2d"),i=a.createLinearGradient(0,0,e.width-1,0);i.addColorStop(0,"hsla(0, 0%, 50%, 0)"),i.addColorStop(1,"hsla(0, 0%, 50%, 1)"),a.fillStyle=i,a.fillRect(0,0,this.options.alphaBarSize[0],this.options.alphaBarSize[1]);var o=function(a){var i=(0,n.limit)(a.clientX-e.getBoundingClientRect().left,0,t.options.alphaBarSize[0]),o=+(i/t.options.alphaBarSize[0]).toFixed(2);t.alphaPointer.style.left=i-7+"px",t.onValueChanged("ALPHA",o)},r=function e(){document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",e)};e.addEventListener("mousedown",(function(e){o(e),document.addEventListener("mousemove",o),document.addEventListener("mouseup",r)}))}},{key:"setupInput",value:function(e){var t=this,a=+e.min,i=+e.max,o=e.getAttribute("nameref");e.hasAttribute("select-on-focus")&&e.addEventListener("focus",(function(){e.select()})),"text"===e.type?e.addEventListener("change",(function(){t.onValueChanged(o,e.value)})):((S||l)&&e.addEventListener("keydown",(function(r){"Up"===r.key?(e.value=(0,n.limit)(+e.value+1,a,i),t.onValueChanged(o,e.value),r.returnValue=!1):"Down"===r.key&&(e.value=(0,n.limit)(+e.value-1,a,i),t.onValueChanged(o,e.value),r.returnValue=!1)})),e.addEventListener("change",(function(){var r=+e.value;t.onValueChanged(o,(0,n.limit)(r,a,i))})))}},{key:"setupClipboard",value:function(e){var t=this;e.title="click to copy",e.addEventListener("click",(function(){e.value=(0,n.parseColor)([t.R,t.G,t.B,t.A],"hexcss4"),e.select(),document.execCommand("copy")}))}},{key:"setPalette",value:function(e){var t=this,a="auto"===this.options.useAlphaInPalette?this.options.showAlpha:this.options.useAlphaInPalette,i=null;switch(this.options.palette){case"PALETTE_MATERIAL_500":i=n.PALETTE_MATERIAL_500;break;case"PALETTE_MATERIAL_CHROME":i=n.PALETTE_MATERIAL_CHROME;break;default:i=(0,n.ensureArray)(this.options.palette)}if(this.options.paletteEditable||i.length>0){var o=function(a,i,o){var n=e.querySelector('.a-color-picker-palette-color[data-color="'+a+'"]')||document.createElement("div");n.className="a-color-picker-palette-color",n.style.backgroundColor=a,n.setAttribute("data-color",a),n.title=a,e.insertBefore(n,i),t.palette[a]=!0,o&&t.onPaletteColorAdd(a)},r=function(a,i){a?(e.removeChild(a),t.palette[a.getAttribute("data-color")]=!1,i&&t.onPaletteColorRemove(a.getAttribute("data-color"))):(e.querySelectorAll(".a-color-picker-palette-color[data-color]").forEach((function(t){e.removeChild(t)})),Object.keys(t.palette).forEach((function(e){t.palette[e]=!1})),i&&t.onPaletteColorRemove())};if(i.map((function(e){return(0,n.parseColor)(e,a?"rgbcss4":"hex")})).filter((function(e){return!!e})).forEach((function(e){return o(e)})),this.options.paletteEditable){var E=document.createElement("div");E.className="a-color-picker-palette-color a-color-picker-palette-add",E.innerHTML="+",e.appendChild(E),e.addEventListener("click",(function(e){/a-color-picker-palette-add/.test(e.target.className)?e.shiftKey?r(null,!0):o(a?(0,n.parseColor)([t.R,t.G,t.B,t.A],"rgbcss4"):(0,n.rgbToHex)(t.R,t.G,t.B),e.target,!0):/a-color-picker-palette-color/.test(e.target.className)&&(e.shiftKey?r(e.target,!0):t.onValueChanged(u,e.target.getAttribute("data-color")))}))}else e.addEventListener("click",(function(e){/a-color-picker-palette-color/.test(e.target.className)&&t.onValueChanged(u,e.target.getAttribute("data-color"))}))}else e.style.display="none"}},{key:"updatePalette",value:function(e){this.paletteRow.innerHTML="",this.palette={},this.paletteRow.parentElement||this.element.appendChild(this.paletteRow),this.options.palette=e,this.setPalette(this.paletteRow)}},{key:"onValueChanged",value:function(e,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{silent:!1};switch(e){case"H":this.H=t;var i=(0,n.hslToRgb)(this.H,this.S,this.L),r=o(i,3);this.R=r[0],this.G=r[1],this.B=r[2],this.slBarHelper.setHue(t),this.updatePointerH(this.H),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B);break;case"S":this.S=t;var E=(0,n.hslToRgb)(this.H,this.S,this.L),_=o(E,3);this.R=_[0],this.G=_[1],this.B=_[2],this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B);break;case"L":this.L=t;var T=(0,n.hslToRgb)(this.H,this.S,this.L),s=o(T,3);this.R=s[0],this.G=s[1],this.B=s[2],this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B);break;case"R":this.R=t;var S=(0,n.rgbToHsl)(this.R,this.G,this.B),l=o(S,3);this.H=l[0],this.S=l[1],this.L=l[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGBHEX(this.R,this.G,this.B);break;case"G":this.G=t;var I=(0,n.rgbToHsl)(this.R,this.G,this.B),O=o(I,3);this.H=O[0],this.S=O[1],this.L=O[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGBHEX(this.R,this.G,this.B);break;case"B":this.B=t;var c=(0,n.rgbToHsl)(this.R,this.G,this.B),R=o(c,3);this.H=R[0],this.S=R[1],this.L=R[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGBHEX(this.R,this.G,this.B);break;case"RGB":var N=o(t,3);this.R=N[0],this.G=N[1],this.B=N[2];var m=(0,n.rgbToHsl)(this.R,this.G,this.B),L=o(m,3);this.H=L[0],this.S=L[1],this.L=L[2],this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B);break;case A:var D=o(t,4);this.R=D[0],this.G=D[1],this.B=D[2],this.A=D[3];var p=(0,n.rgbToHsl)(this.R,this.G,this.B),h=o(p,3);this.H=h[0],this.S=h[1],this.L=h[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B),this.updatePointerA(this.A);break;case d:var C=o(t,4);this.H=C[0],this.S=C[1],this.L=C[2],this.A=C[3];var f=(0,n.hslToRgb)(this.H,this.S,this.L),P=o(f,3);this.R=P[0],this.G=P[1],this.B=P[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B),this.updatePointerA(this.A);break;case"RGBHEX":var B=(0,n.cssColorToRgb)(t)||[this.R,this.G,this.B],g=o(B,3);this.R=g[0],this.G=g[1],this.B=g[2];var v=(0,n.rgbToHsl)(this.R,this.G,this.B),M=o(v,3);this.H=M[0],this.S=M[1],this.L=M[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B);break;case u:var W=(0,n.parseColor)(t,"rgba")||[0,0,0,1],y=o(W,4);this.R=y[0],this.G=y[1],this.B=y[2],this.A=y[3];var b=(0,n.rgbToHsl)(this.R,this.G,this.B),U=o(b,3);this.H=U[0],this.S=U[1],this.L=U[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B),this.updatePointerA(this.A);break;case"ALPHA":this.A=t}1===this.A?this.preview.style.backgroundColor="rgb("+this.R+","+this.G+","+this.B+")":this.preview.style.backgroundColor="rgba("+this.R+","+this.G+","+this.B+","+this.A+")",a&&a.silent||this.onchange&&this.onchange(this.preview.style.backgroundColor)}},{key:"onPaletteColorAdd",value:function(e){this.oncoloradd&&this.oncoloradd(e)}},{key:"onPaletteColorRemove",value:function(e){this.oncolorremove&&this.oncolorremove(e)}},{key:"updateInputHSL",value:function(e,t,a){this.options.showHSL&&(this.inputH.value=e,this.inputS.value=t,this.inputL.value=a)}},{key:"updateInputRGB",value:function(e,t,a){this.options.showRGB&&(this.inputR.value=e,this.inputG.value=t,this.inputB.value=a)}},{key:"updateInputRGBHEX",value:function(e,t,a){this.options.showHEX&&(this.inputRGBHEX.value=(0,n.rgbToHex)(e,t,a))}},{key:"updatePointerH",value:function(e){var t=this.options.hueBarSize[0]*e/360;this.huePointer.style.left=t-7+"px"}},{key:"updatePointerSL",value:function(e,t,a){var i=(0,n.hslToRgb)(e,t,a),r=o(i,3),E=r[0],_=r[1],T=r[2],s=this.slBarHelper.findColor(E,_,T),S=o(s,2),l=S[0],I=S[1];l>=0&&(this.slPointer.style.left=l-7+"px",this.slPointer.style.top=I-7+"px")}},{key:"updatePointerA",value:function(e){if(this.options.showAlpha){var t=this.options.alphaBarSize[0]*e;this.alphaPointer.style.left=t-7+"px"}}}]),e})(),L=(function(){function e(t){T(this,e),this.name=t,this.listeners=[]}return i(e,[{key:"on",value:function(e){e&&this.listeners.push(e)}},{key:"off",value:function(e){this.listeners=e?this.listeners.filter((function(t){return t!==e})):[]}},{key:"emit",value:function(e,t){for(var a=this.listeners.slice(0),i=0;i1&&void 0!==arguments[1]&&arguments[1];a.onValueChanged(u,e,{silent:t})},get all(){if(r){var e=[a.R,a.G,a.B,a.A],t=a.A<1?"rgba("+a.R+","+a.G+","+a.B+","+a.A+")":n.rgbToHex.apply(void 0,e);(E=(0,n.parseColor)(e,E)).toString=function(){return t},r=!1}return Object.assign({},E)},get onchange(){return i.change&&i.change.listeners[0]},set onchange(e){this.off("change").on("change",e)},get oncoloradd(){return i.coloradd&&i.coloradd.listeners[0]},set oncoloradd(e){this.off("coloradd").on("coloradd",e)},get oncolorremove(){return i.colorremove&&i.colorremove.listeners[0]},set oncolorremove(e){this.off("colorremove").on("colorremove",e)},get palette(){return Object.keys(a.palette).filter((function(e){return a.palette[e]}))},set palette(e){a.updatePalette(e)},show:function(){a.element.classList.remove("hidden")},hide:function(){a.element.classList.add("hidden")},toggle:function(){a.element.classList.toggle("hidden")},on:function(e,t){return e&&i[e]&&i[e].on(t),this},off:function(e,t){return e&&i[e]&&i[e].off(t),this},destroy:function(){i.change.off(),i.coloradd.off(),i.colorremove.off(),a.element.remove(),i=null,a=null}};return a.onchange=function(){for(var e=arguments.length,t=Array(e),a=0;astyle[data-source="a-color-picker"]')){var p=a(5).toString(),h=document.createElement("style");h.setAttribute("type","text/css"),h.setAttribute("data-source","a-color-picker"),h.innerHTML=p,document.querySelector("head").appendChild(h)}t.createPicker=D,t.from=function(e,t){var a=(function(e){return e?Array.isArray(e)?e:e instanceof HTMLElement?[e]:e instanceof NodeList?[].concat(s(e)):"string"==typeof e?[].concat(s(document.querySelectorAll(e))):e.jquery?e.get():[]:[]})(e).map((function(e,a){var i=D(e,t);return i.index=a,i}));return a.on=function(e,t){return a.forEach((function(a){return a.on(e,t)})),this},a.off=function(e){return a.forEach((function(t){return t.off(e)})),this},a},t.parseColorToRgb=n.parseColorToRgb,t.parseColorToRgba=n.parseColorToRgba,t.parseColorToHsl=n.parseColorToHsl,t.parseColorToHsla=n.parseColorToHsla,t.parseColor=n.parseColor,t.rgbToHex=n.rgbToHex,t.hslToRgb=n.hslToRgb,t.rgbToHsl=n.rgbToHsl,t.rgbToHsv=n.rgbToHsv,t.rgbToInt=n.rgbToInt,t.intToRgb=n.intToRgb,t.getLuminance=n.getLuminance,t.COLOR_NAMES=n.COLOR_NAMES,t.PALETTE_MATERIAL_500=n.PALETTE_MATERIAL_500,t.PALETTE_MATERIAL_CHROME=n.PALETTE_MATERIAL_CHROME,t.VERSION="1.2.1"},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nvl=t.ensureArray=t.limit=t.getLuminance=t.parseColor=t.parseColorToHsla=t.parseColorToHsl=t.cssHslaToHsla=t.cssHslToHsl=t.parseColorToRgba=t.parseColorToRgb=t.cssRgbaToRgba=t.cssRgbToRgb=t.cssColorToRgba=t.cssColorToRgb=t.intToRgb=t.rgbToInt=t.rgbToHsv=t.rgbToHsl=t.hslToRgb=t.rgbToHex=t.PALETTE_MATERIAL_CHROME=t.PALETTE_MATERIAL_500=t.COLOR_NAMES=void 0;var i=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return(function(e,t){var a=[],i=!0,o=!1,n=void 0;try{for(var r,E=e[Symbol.iterator]();!(i=(r=E.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,n=e}finally{try{!i&&E.return&&E.return()}finally{if(o)throw n}}return a})(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=(function(e){return e&&e.__esModule?e:{default:e}})(a(0));function n(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);ta?a:e}function _(e,t){return null==e?t:e}function T(e,t,a){var i=[E(e,0,255),E(t,0,255),E(a,0,255)];return"#"+("000000"+((e=i[0])<<16|(t=i[1])<<8|(a=i[2])).toString(16)).slice(-6)}function s(e,t,a){var i=void 0,o=void 0,n=void 0,r=[E(e,0,360)/360,E(t,0,100)/100,E(a,0,100)/100];if(e=r[0],a=r[2],0==(t=r[1]))i=o=n=a;else{var _=function(e,t,a){return a<0&&(a+=1),a>1&&(a-=1),a<1/6?e+6*(t-e)*a:a<.5?t:a<2/3?e+(t-e)*(2/3-a)*6:e},T=a<.5?a*(1+t):a+t-a*t,s=2*a-T;i=_(s,T,e+1/3),o=_(s,T,e),n=_(s,T,e-1/3)}return[255*i,255*o,255*n].map(Math.round)}function S(e,t,a){var i=[E(e,0,255)/255,E(t,0,255)/255,E(a,0,255)/255];e=i[0],t=i[1],a=i[2];var o=Math.max(e,t,a),n=Math.min(e,t,a),r=void 0,_=void 0,T=(o+n)/2;if(o==n)r=_=0;else{var s=o-n;switch(_=T>.5?s/(2-o-n):s/(o+n),o){case e:r=(t-a)/s+(t>16&255,e>>8&255,255&e]},t.cssColorToRgb=I,t.cssColorToRgba=u,t.cssRgbToRgb=A,t.cssRgbaToRgba=d,t.parseColorToRgb=function(e){return Array.isArray(e)?e=[E(e[0],0,255),E(e[1],0,255),E(e[2],0,255)]:I(e)||A(e)},t.parseColorToRgba=O,t.cssHslToHsl=c,t.cssHslaToHsla=R,t.parseColorToHsl=function(e){return Array.isArray(e)?e=[E(e[0],0,360),E(e[1],0,100),E(e[2],0,100)]:c(e)},t.parseColorToHsla=N,t.parseColor=function(e,t){if(t=t||"rgb",null!=e){var a=void 0;if((a=O(e))||(a=N(e))&&(a=[].concat(n(s.apply(void 0,n(a))),[a[3]])))return(0,o.default)(t)?["rgb","rgbcss","rgbcss4","rgba","rgbacss","hsl","hslcss","hslcss4","hsla","hslacss","hex","hexcss4","int"].reduce((function(e,t){return e[t]=m(a,t),e}),t||{}):m(a,t.toString().toLowerCase())}},t.getLuminance=function(e,t,a){return.2126*(e=(e/=255)<.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.7152*(t=(t/=255)<.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.0722*((a/=255)<.03928?a/12.92:Math.pow((a+.055)/1.055,2.4))},t.limit=E,t.ensureArray=function(e){return e?Array.from(e):[]},t.nvl=_},function(e,t,a){"use strict";e.exports=function(e){return null!=e&&"object"==typeof e&&!1===Array.isArray(e)}},function(e,t){e.exports='
'},function(e,t,a){var i=a(6);e.exports="string"==typeof i?i:i.toString()},function(e,t,a){(e.exports=a(7)(!1)).push([e.i,"/*!\n * a-color-picker\n * https://github.com/narsenico/a-color-picker\n *\n * Copyright (c) 2017-2018, Gianfranco Caldi.\n * Released under the MIT License.\n */.a-color-picker{background-color:#fff;padding:0;display:inline-flex;flex-direction:column;user-select:none;width:232px;font:400 10px Helvetica,Arial,sans-serif;border-radius:3px;box-shadow:0 0 0 1px rgba(0,0,0,.05),0 2px 4px rgba(0,0,0,.25)}.a-color-picker,.a-color-picker-row,.a-color-picker input{box-sizing:border-box}.a-color-picker-row{padding:15px;display:flex;flex-direction:row;align-items:center;justify-content:space-between;user-select:none}.a-color-picker-row-top{padding:0}.a-color-picker-row:not(:first-child){border-top:1px solid #f5f5f5}.a-color-picker-column{display:flex;flex-direction:column}.a-color-picker-cell{flex:1 1 auto;margin-bottom:4px}.a-color-picker-cell:last-child{margin-bottom:0}.a-color-picker-stack{position:relative}.a-color-picker-dot{position:absolute;width:14px;height:14px;top:0;left:0;background:#fff;pointer-events:none;border-radius:50px;z-index:1000;box-shadow:0 1px 2px rgba(0,0,0,.75)}.a-color-picker-a,.a-color-picker-h,.a-color-picker-sl{cursor:cell}.a-color-picker-a+.a-color-picker-dot,.a-color-picker-h+.a-color-picker-dot{top:-2px}.a-color-picker-a,.a-color-picker-h{border-radius:2px}.a-color-picker-preview{box-sizing:border-box;width:30px;height:30px;user-select:none;border-radius:15px}.a-color-picker-circle{border-radius:50px;border:1px solid #eee}.a-color-picker-hsl,.a-color-picker-rgb,.a-color-picker-single-input{justify-content:space-evenly}.a-color-picker-hsl>label,.a-color-picker-rgb>label,.a-color-picker-single-input>label{padding:0 8px;flex:0 0 auto;color:#969696}.a-color-picker-hsl>input,.a-color-picker-rgb>input,.a-color-picker-single-input>input{text-align:center;padding:2px 0;width:0;flex:1 1 auto;border:1px solid #e0e0e0;line-height:20px}.a-color-picker-hsl>input::-webkit-inner-spin-button,.a-color-picker-rgb>input::-webkit-inner-spin-button,.a-color-picker-single-input>input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.a-color-picker-hsl>input:focus,.a-color-picker-rgb>input:focus,.a-color-picker-single-input>input:focus{border-color:#04a9f4;outline:none}.a-color-picker-transparent{background-image:linear-gradient(-45deg,#cdcdcd 25%,transparent 0),linear-gradient(45deg,#cdcdcd 25%,transparent 0),linear-gradient(-45deg,transparent 75%,#cdcdcd 0),linear-gradient(45deg,transparent 75%,#cdcdcd 0);background-size:11px 11px;background-position:0 0,0 -5.5px,-5.5px 5.5px,5.5px 0}.a-color-picker-sl{border-radius:3px 3px 0 0}.a-color-picker.hide-alpha [show-on-alpha],.a-color-picker.hide-hsl [show-on-hsl],.a-color-picker.hide-rgb [show-on-rgb],.a-color-picker.hide-single-input [show-on-single-input]{display:none}.a-color-picker-clipbaord{width:100%;height:100%;opacity:0;cursor:pointer}.a-color-picker-palette{flex-flow:wrap;flex-direction:row;justify-content:flex-start;padding:10px}.a-color-picker-palette-color{width:15px;height:15px;flex:0 1 15px;margin:3px;box-sizing:border-box;cursor:pointer;border-radius:3px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.1)}.a-color-picker-palette-add{text-align:center;line-height:13px;color:#607d8b}.a-color-picker.hidden{display:none}",""])},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var a=(function(e,t){var a=e[1]||"",i=e[3];if(!i)return a;if(t&&"function"==typeof btoa){var o=(function(e){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e))))+" */"})(i),n=i.sources.map((function(e){return"/*# sourceURL="+i.sourceRoot+e+" */"}));return[a].concat(n).concat([o]).join("\n")}return[a].join("\n")})(t,e);return t[2]?"@media "+t[2]+"{"+a+"}":a})).join("")},t.i=function(e,a){"string"==typeof e&&(e=[[null,e,""]]);for(var i={},o=0;o{"use strict";t.byteLength=function(e){var t=E(e),a=t[0],i=t[1];return 3*(a+i)/4-i},t.toByteArray=function(e){var t,a,n=E(e),r=n[0],_=n[1],T=new o((function(e,t,a){return 3*(t+a)/4-a})(0,r,_)),s=0,S=_>0?r-4:r;for(a=0;a>16&255,T[s++]=t>>8&255,T[s++]=255&t;2===_&&(t=i[e.charCodeAt(a)]<<2|i[e.charCodeAt(a+1)]>>4,T[s++]=255&t);1===_&&(t=i[e.charCodeAt(a)]<<10|i[e.charCodeAt(a+1)]<<4|i[e.charCodeAt(a+2)]>>2,T[s++]=t>>8&255,T[s++]=255&t);return T},t.fromByteArray=function(e){for(var t,i=e.length,o=i%3,n=[],r=16383,E=0,T=i-o;ET?T:E+r));1===o?(t=e[i-1],n.push(a[t>>2]+a[t<<4&63]+"==")):2===o&&(t=(e[i-2]<<8)+e[i-1],n.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return n.join("")};for(var a=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0;r<64;++r)a[r]=n[r],i[n.charCodeAt(r)]=r;function E(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var a=e.indexOf("=");return-1===a&&(a=t),[a,a===t?0:4-a%4]}function _(e,t,i){for(var o,n,r=[],E=t;E>18&63]+a[n>>12&63]+a[n>>6&63]+a[63&n]);return r.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},13960:e=>{function t(e){return e.reduce(((e,t,a,i)=>{const o=t.split("-").map((e=>parseInt(e)));return e.concat(((e,t=e)=>Array.from({length:t-e+1},((t,a)=>a+e)))(...o))}),[])}e.exports=t,e.exports.parse=t,e.exports.compose=function(e){return e.reduce(((e,t,a,i)=>(0!==a&&t===i[a-1]+1||e.push([]),e[e.length-1].push(t),e)),[]).map((e=>e.length>1?`${e[0]}-${e[e.length-1]}`:`${e[0]}`))}},46880:function(e){e.exports=(function(e){var t={};function a(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,a),o.l=!0,o.exports}return a.m=e,a.c=t,a.d=function(e,t,i){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(a.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)a.d(i,o,function(t){return e[t]}.bind(null,o));return i},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=90)})({17:function(e,t,a){"use strict";t.__esModule=!0,t.default=void 0;var i=a(18),o=(function(){function e(){}return e.getFirstMatch=function(e,t){var a=t.match(e);return a&&a.length>0&&a[1]||""},e.getSecondMatch=function(e,t){var a=t.match(e);return a&&a.length>1&&a[2]||""},e.matchAndReturnConst=function(e,t,a){if(e.test(t))return a},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,a,i){void 0===i&&(i=!1);var o=e.getVersionPrecision(t),n=e.getVersionPrecision(a),r=Math.max(o,n),E=0,_=e.map([t,a],(function(t){var a=r-e.getVersionPrecision(t),i=t+new Array(a+1).join(".0");return e.map(i.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(i&&(E=r-Math.min(o,n)),r-=1;r>=E;){if(_[0][r]>_[1][r])return 1;if(_[0][r]===_[1][r]){if(r===E)return 0;r-=1}else if(_[0][r]<_[1][r])return-1}},e.map=function(e,t){var a,i=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(a=0;a1?o-1:0),r=1;r0){var r=Object.keys(a),_=E.default.find(r,(function(e){return t.isOS(e)}));if(_){var T=this.satisfies(a[_]);if(void 0!==T)return T}var s=E.default.find(r,(function(e){return t.isPlatform(e)}));if(s){var S=this.satisfies(a[s]);if(void 0!==S)return S}}if(n>0){var l=Object.keys(o),I=E.default.find(l,(function(e){return t.isBrowser(e,!0)}));if(void 0!==I)return this.compareVersion(o[I])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var a=this.getBrowserName().toLowerCase(),i=e.toLowerCase(),o=E.default.getBrowserTypeByAlias(i);return t&&o&&(i=o.toLowerCase()),i===a},t.compareVersion=function(e){var t=[0],a=e,i=!1,o=this.getBrowserVersion();if("string"==typeof o)return">"===e[0]||"<"===e[0]?(a=e.substr(1),"="===e[1]?(i=!0,a=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?a=e.substr(1):"~"===e[0]&&(i=!0,a=e.substr(1)),t.indexOf(E.default.compareVersions(o,a,i))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e})();t.default=T,e.exports=t.default},92:function(e,t,a){"use strict";t.__esModule=!0,t.default=void 0;var i,o=(i=a(17))&&i.__esModule?i:{default:i},n=/version\/(\d+(\.?_?\d+)+)/i,r=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},a=o.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||o.default.getFirstMatch(n,e);return a&&(t.version=a),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},a=o.default.getFirstMatch(n,e)||o.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},a=o.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||o.default.getFirstMatch(n,e);return a&&(t.version=a),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},a=o.default.getFirstMatch(n,e)||o.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},a=o.default.getFirstMatch(n,e)||o.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},a=o.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||o.default.getFirstMatch(n,e);return a&&(t.version=a),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},a=o.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||o.default.getFirstMatch(n,e);return a&&(t.version=a),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},a=o.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||o.default.getFirstMatch(n,e);return a&&(t.version=a),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},a=o.default.getFirstMatch(n,e)||o.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},a=o.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(n,e);return a&&(t.version=a),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},a=o.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(n,e);return a&&(t.version=a),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},a=o.default.getFirstMatch(n,e)||o.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},a=o.default.getFirstMatch(n,e)||o.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},a=o.default.getFirstMatch(n,e)||o.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},a=o.default.getFirstMatch(n,e)||o.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},a=o.default.getFirstMatch(n,e)||o.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},a=o.default.getFirstMatch(n,e)||o.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},a=o.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(n,e);return a&&(t.version=a),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},a=o.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(n,e);return a&&(t.version=a),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},a=o.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},a=o.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},a=o.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},a=o.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},a=o.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},a=o.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return a&&(t.version=a),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},a=o.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},a=o.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},a=o.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},a=o.default.getFirstMatch(n,e)||o.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},a=o.default.getFirstMatch(n,e)||o.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},a=o.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},a=o.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(n,e);return a&&(t.version=a),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},a=o.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(n,e);return a&&(t.version=a),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},a=o.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},a=o.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},a=o.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},a=o.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(n,e);return a&&(t.version=a),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},a=o.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},a=o.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:function(e){var t=!e.test(/like android/i),a=e.test(/android/i);return t&&a},describe:function(e){var t={name:"Android Browser"},a=o.default.getFirstMatch(n,e);return a&&(t.version=a),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},a=o.default.getFirstMatch(n,e);return a&&(t.version=a),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},a=o.default.getFirstMatch(n,e);return a&&(t.version=a),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:o.default.getFirstMatch(t,e),version:o.default.getSecondMatch(t,e)}}}];t.default=r,e.exports=t.default},93:function(e,t,a){"use strict";t.__esModule=!0,t.default=void 0;var i,o=(i=a(17))&&i.__esModule?i:{default:i},n=a(18),r=[{test:[/Roku\/DVP/],describe:function(e){var t=o.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:n.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=o.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:n.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=o.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),a=o.default.getWindowsVersionName(t);return{name:n.OS_MAP.Windows,version:t,versionName:a}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:n.OS_MAP.iOS},a=o.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return a&&(t.version=a),t}},{test:[/macintosh/i],describe:function(e){var t=o.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),a=o.default.getMacOSVersionName(t),i={name:n.OS_MAP.MacOS,version:t};return a&&(i.versionName=a),i}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=o.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:n.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),a=e.test(/android/i);return t&&a},describe:function(e){var t=o.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),a=o.default.getAndroidVersionName(t),i={name:n.OS_MAP.Android,version:t};return a&&(i.versionName=a),i}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=o.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),a={name:n.OS_MAP.WebOS};return t&&t.length&&(a.version=t),a}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=o.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||o.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||o.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:n.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=o.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:n.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=o.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:n.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:n.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:n.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=o.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:n.OS_MAP.PlayStation4,version:t}}}];t.default=r,e.exports=t.default},94:function(e,t,a){"use strict";t.__esModule=!0,t.default=void 0;var i,o=(i=a(17))&&i.__esModule?i:{default:i},n=a(18),r=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=o.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",a={type:n.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(a.model=t),a}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:n.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:n.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:n.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:n.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:n.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:n.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),a=e.test(/like (ipod|iphone)/i);return t&&!a},describe:function(e){var t=o.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:n.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:n.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:n.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:n.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:n.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:n.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:n.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:n.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:n.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:n.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:n.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:n.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:n.PLATFORMS_MAP.tv}}}];t.default=r,e.exports=t.default},95:function(e,t,a){"use strict";t.__esModule=!0,t.default=void 0;var i,o=(i=a(17))&&i.__esModule?i:{default:i},n=a(18),r=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:n.ENGINE_MAP.Blink};var t=o.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:n.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:n.ENGINE_MAP.Trident},a=o.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:n.ENGINE_MAP.Presto},a=o.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:function(e){var t=e.test(/gecko/i),a=e.test(/like gecko/i);return t&&!a},describe:function(e){var t={name:n.ENGINE_MAP.Gecko},a=o.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:n.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:n.ENGINE_MAP.WebKit},a=o.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}}];t.default=r,e.exports=t.default}})},48287:(e,t,a)=>{"use strict";const i=a(67526),o=a(251),n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=_,t.IS=50;const r=2147483647;function E(e){if(e>r)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,_.prototype),t}function _(e,t,a){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return S(e)}return T(e,t,a)}function T(e,t,a){if("string"==typeof e)return(function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!_.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const a=0|A(e,t);let i=E(a);const o=i.write(e,t);o!==a&&(i=i.slice(0,o));return i})(e,t);if(ArrayBuffer.isView(e))return(function(e){if(X(e,Uint8Array)){const t=new Uint8Array(e);return I(t.buffer,t.byteOffset,t.byteLength)}return l(e)})(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(X(e,ArrayBuffer)||e&&X(e.buffer,ArrayBuffer))return I(e,t,a);if("undefined"!=typeof SharedArrayBuffer&&(X(e,SharedArrayBuffer)||e&&X(e.buffer,SharedArrayBuffer)))return I(e,t,a);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return _.from(i,t,a);const o=(function(e){if(_.isBuffer(e)){const t=0|u(e.length),a=E(t);return 0===a.length||e.copy(a,0,0,t),a}if(void 0!==e.length)return"number"!=typeof e.length||$(e.length)?E(0):l(e);if("Buffer"===e.type&&Array.isArray(e.data))return l(e.data)})(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return _.from(e[Symbol.toPrimitive]("string"),t,a);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function s(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function S(e){return s(e),E(e<0?0:0|u(e))}function l(e){const t=e.length<0?0:0|u(e.length),a=E(t);for(let i=0;i=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|e}function A(e,t){if(_.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||X(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const a=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===a)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return a;case"utf8":case"utf-8":return j(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*a;case"hex":return a>>>1;case"base64":return x(e).length;default:if(o)return i?-1:j(e).length;t=(""+t).toLowerCase(),o=!0}}function d(e,t,a){let i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===a||a>this.length)&&(a=this.length),a<=0)return"";if((a>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return g(this,t,a);case"utf8":case"utf-8":return C(this,t,a);case"ascii":return P(this,t,a);case"latin1":case"binary":return B(this,t,a);case"base64":return h(this,t,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,t,a);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function O(e,t,a){const i=e[t];e[t]=e[a],e[a]=i}function c(e,t,a,i,o){if(0===e.length)return-1;if("string"==typeof a?(i=a,a=0):a>2147483647?a=2147483647:a<-2147483648&&(a=-2147483648),$(a=+a)&&(a=o?0:e.length-1),a<0&&(a=e.length+a),a>=e.length){if(o)return-1;a=e.length-1}else if(a<0){if(!o)return-1;a=0}if("string"==typeof t&&(t=_.from(t,i)),_.isBuffer(t))return 0===t.length?-1:R(e,t,a,i,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,a):Uint8Array.prototype.lastIndexOf.call(e,t,a):R(e,[t],a,i,o);throw new TypeError("val must be string, number or Buffer")}function R(e,t,a,i,o){let n,r=1,E=e.length,_=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;r=2,E/=2,_/=2,a/=2}function T(e,t){return 1===r?e[t]:e.readUInt16BE(t*r)}if(o){let i=-1;for(n=a;nE&&(a=E-_),n=a;n>=0;n--){let a=!0;for(let i=0;i<_;i++)if(T(e,n+i)!==T(t,i)){a=!1;break}if(a)return n}return-1}function N(e,t,a,i){a=Number(a)||0;const o=e.length-a;i?(i=Number(i))>o&&(i=o):i=o;const n=t.length;let r;for(i>n/2&&(i=n/2),r=0;r>8,o=a%256,n.push(o),n.push(i);return n})(t,e.length-a),e,a,i)}function h(e,t,a){return 0===t&&a===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,a))}function C(e,t,a){a=Math.min(e.length,a);const i=[];let o=t;for(;o239?4:t>223?3:t>191?2:1;if(o+r<=a){let a,i,E,_;switch(r){case 1:t<128&&(n=t);break;case 2:a=e[o+1],128==(192&a)&&(_=(31&t)<<6|63&a,_>127&&(n=_));break;case 3:a=e[o+1],i=e[o+2],128==(192&a)&&128==(192&i)&&(_=(15&t)<<12|(63&a)<<6|63&i,_>2047&&(_<55296||_>57343)&&(n=_));break;case 4:a=e[o+1],i=e[o+2],E=e[o+3],128==(192&a)&&128==(192&i)&&128==(192&E)&&(_=(15&t)<<18|(63&a)<<12|(63&i)<<6|63&E,_>65535&&_<1114112&&(n=_))}}null===n?(n=65533,r=1):n>65535&&(n-=65536,i.push(n>>>10&1023|55296),n=56320|1023&n),i.push(n),o+=r}return(function(e){const t=e.length;if(t<=f)return String.fromCharCode.apply(String,e);let a="",i=0;for(;ii.length?(_.isBuffer(t)||(t=_.from(t)),t.copy(i,o)):Uint8Array.prototype.set.call(i,t,o);else{if(!_.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(i,o)}o+=t.length}return i},_.byteLength=A,_.prototype._isBuffer=!0,_.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;ta&&(e+=" ... "),""},n&&(_.prototype[n]=_.prototype.inspect),_.prototype.compare=function(e,t,a,i,o){if(X(e,Uint8Array)&&(e=_.from(e,e.offset,e.byteLength)),!_.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===a&&(a=e?e.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),t<0||a>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&t>=a)return 0;if(i>=o)return-1;if(t>=a)return 1;if(this===e)return 0;let n=(o>>>=0)-(i>>>=0),r=(a>>>=0)-(t>>>=0);const E=Math.min(n,r),T=this.slice(i,o),s=e.slice(t,a);for(let e=0;e>>=0,isFinite(a)?(a>>>=0,void 0===i&&(i="utf8")):(i=a,a=void 0)}const o=this.length-t;if((void 0===a||a>o)&&(a=o),e.length>0&&(a<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let n=!1;for(;;)switch(i){case"hex":return N(this,e,t,a);case"utf8":case"utf-8":return m(this,e,t,a);case"ascii":case"latin1":case"binary":return L(this,e,t,a);case"base64":return D(this,e,t,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return p(this,e,t,a);default:if(n)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),n=!0}},_.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const f=4096;function P(e,t,a){let i="";a=Math.min(e.length,a);for(let o=t;oi)&&(a=i);let o="";for(let i=t;ia)throw new RangeError("Trying to access beyond buffer length")}function W(e,t,a,i,o,n){if(!_.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function y(e,t,a,i,o){w(t,i,o,e,a,7);let n=Number(t&BigInt(4294967295));e[a++]=n,n>>=8,e[a++]=n,n>>=8,e[a++]=n,n>>=8,e[a++]=n;let r=Number(t>>BigInt(32)&BigInt(4294967295));return e[a++]=r,r>>=8,e[a++]=r,r>>=8,e[a++]=r,r>>=8,e[a++]=r,a}function b(e,t,a,i,o){w(t,i,o,e,a,7);let n=Number(t&BigInt(4294967295));e[a+7]=n,n>>=8,e[a+6]=n,n>>=8,e[a+5]=n,n>>=8,e[a+4]=n;let r=Number(t>>BigInt(32)&BigInt(4294967295));return e[a+3]=r,r>>=8,e[a+2]=r,r>>=8,e[a+1]=r,r>>=8,e[a]=r,a+8}function U(e,t,a,i,o,n){if(a+i>e.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("Index out of range")}function G(e,t,a,i,n){return t=+t,a>>>=0,n||U(e,0,a,4),o.write(e,t,a,i,23,4),a+4}function k(e,t,a,i,n){return t=+t,a>>>=0,n||U(e,0,a,8),o.write(e,t,a,i,52,8),a+8}_.prototype.slice=function(e,t){const a=this.length;(e=~~e)<0?(e+=a)<0&&(e=0):e>a&&(e=a),(t=void 0===t?a:~~t)<0?(t+=a)<0&&(t=0):t>a&&(t=a),t>>=0,t>>>=0,a||M(e,t,this.length);let i=this[e],o=1,n=0;for(;++n>>=0,t>>>=0,a||M(e,t,this.length);let i=this[e+--t],o=1;for(;t>0&&(o*=256);)i+=this[e+--t]*o;return i},_.prototype.readUint8=_.prototype.readUInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),this[e]},_.prototype.readUint16LE=_.prototype.readUInt16LE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]|this[e+1]<<8},_.prototype.readUint16BE=_.prototype.readUInt16BE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]<<8|this[e+1]},_.prototype.readUint32LE=_.prototype.readUInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},_.prototype.readUint32BE=_.prototype.readUInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},_.prototype.readBigUInt64LE=J((function(e){Y(e>>>=0,"offset");const t=this[e],a=this[e+7];void 0!==t&&void 0!==a||z(e,this.length-8);const i=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+a*2**24;return BigInt(i)+(BigInt(o)<>>=0,"offset");const t=this[e],a=this[e+7];void 0!==t&&void 0!==a||z(e,this.length-8);const i=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+a;return(BigInt(i)<>>=0,t>>>=0,a||M(e,t,this.length);let i=this[e],o=1,n=0;for(;++n=o&&(i-=Math.pow(2,8*t)),i},_.prototype.readIntBE=function(e,t,a){e>>>=0,t>>>=0,a||M(e,t,this.length);let i=t,o=1,n=this[e+--i];for(;i>0&&(o*=256);)n+=this[e+--i]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*t)),n},_.prototype.readInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},_.prototype.readInt16LE=function(e,t){e>>>=0,t||M(e,2,this.length);const a=this[e]|this[e+1]<<8;return 32768&a?4294901760|a:a},_.prototype.readInt16BE=function(e,t){e>>>=0,t||M(e,2,this.length);const a=this[e+1]|this[e]<<8;return 32768&a?4294901760|a:a},_.prototype.readInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},_.prototype.readInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},_.prototype.readBigInt64LE=J((function(e){Y(e>>>=0,"offset");const t=this[e],a=this[e+7];void 0!==t&&void 0!==a||z(e,this.length-8);const i=this[e+4]+256*this[e+5]+65536*this[e+6]+(a<<24);return(BigInt(i)<>>=0,"offset");const t=this[e],a=this[e+7];void 0!==t&&void 0!==a||z(e,this.length-8);const i=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(i)<>>=0,t||M(e,4,this.length),o.read(this,e,!0,23,4)},_.prototype.readFloatBE=function(e,t){return e>>>=0,t||M(e,4,this.length),o.read(this,e,!1,23,4)},_.prototype.readDoubleLE=function(e,t){return e>>>=0,t||M(e,8,this.length),o.read(this,e,!0,52,8)},_.prototype.readDoubleBE=function(e,t){return e>>>=0,t||M(e,8,this.length),o.read(this,e,!1,52,8)},_.prototype.writeUintLE=_.prototype.writeUIntLE=function(e,t,a,i){if(e=+e,t>>>=0,a>>>=0,!i){W(this,e,t,a,Math.pow(2,8*a)-1,0)}let o=1,n=0;for(this[t]=255&e;++n>>=0,a>>>=0,!i){W(this,e,t,a,Math.pow(2,8*a)-1,0)}let o=a-1,n=1;for(this[t+o]=255&e;--o>=0&&(n*=256);)this[t+o]=e/n&255;return t+a},_.prototype.writeUint8=_.prototype.writeUInt8=function(e,t,a){return e=+e,t>>>=0,a||W(this,e,t,1,255,0),this[t]=255&e,t+1},_.prototype.writeUint16LE=_.prototype.writeUInt16LE=function(e,t,a){return e=+e,t>>>=0,a||W(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},_.prototype.writeUint16BE=_.prototype.writeUInt16BE=function(e,t,a){return e=+e,t>>>=0,a||W(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},_.prototype.writeUint32LE=_.prototype.writeUInt32LE=function(e,t,a){return e=+e,t>>>=0,a||W(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},_.prototype.writeUint32BE=_.prototype.writeUInt32BE=function(e,t,a){return e=+e,t>>>=0,a||W(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},_.prototype.writeBigUInt64LE=J((function(e,t=0){return y(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),_.prototype.writeBigUInt64BE=J((function(e,t=0){return b(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),_.prototype.writeIntLE=function(e,t,a,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*a-1);W(this,e,t,a,i-1,-i)}let o=0,n=1,r=0;for(this[t]=255&e;++o>>=0,!i){const i=Math.pow(2,8*a-1);W(this,e,t,a,i-1,-i)}let o=a-1,n=1,r=0;for(this[t+o]=255&e;--o>=0&&(n*=256);)e<0&&0===r&&0!==this[t+o+1]&&(r=1),this[t+o]=(e/n|0)-r&255;return t+a},_.prototype.writeInt8=function(e,t,a){return e=+e,t>>>=0,a||W(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},_.prototype.writeInt16LE=function(e,t,a){return e=+e,t>>>=0,a||W(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},_.prototype.writeInt16BE=function(e,t,a){return e=+e,t>>>=0,a||W(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},_.prototype.writeInt32LE=function(e,t,a){return e=+e,t>>>=0,a||W(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},_.prototype.writeInt32BE=function(e,t,a){return e=+e,t>>>=0,a||W(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},_.prototype.writeBigInt64LE=J((function(e,t=0){return y(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),_.prototype.writeBigInt64BE=J((function(e,t=0){return b(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),_.prototype.writeFloatLE=function(e,t,a){return G(this,e,t,!0,a)},_.prototype.writeFloatBE=function(e,t,a){return G(this,e,t,!1,a)},_.prototype.writeDoubleLE=function(e,t,a){return k(this,e,t,!0,a)},_.prototype.writeDoubleBE=function(e,t,a){return k(this,e,t,!1,a)},_.prototype.copy=function(e,t,a,i){if(!_.isBuffer(e))throw new TypeError("argument should be a Buffer");if(a||(a=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t>>=0,a=void 0===a?this.length:a>>>0,e||(e=0),"number"==typeof e)for(o=t;o=i+4;a-=3)t=`_${e.slice(a-3,a)}${t}`;return`${e.slice(0,a)}${t}`}function w(e,t,a,i,o,n){if(e>a||e3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(n+1)}${i}`:`>= -(2${i} ** ${8*(n+1)-1}${i}) and < 2 ** ${8*(n+1)-1}${i}`:`>= ${t}${i} and <= ${a}${i}`,new F.ERR_OUT_OF_RANGE("value",o,e)}!(function(e,t,a){Y(t,"offset"),void 0!==e[t]&&void 0!==e[t+a]||z(t,e.length-(a+1))})(i,o,n)}function Y(e,t){if("number"!=typeof e)throw new F.ERR_INVALID_ARG_TYPE(t,"number",e)}function z(e,t,a){if(Math.floor(e)!==e)throw Y(e,a),new F.ERR_OUT_OF_RANGE(a||"offset","an integer",e);if(t<0)throw new F.ERR_BUFFER_OUT_OF_BOUNDS;throw new F.ERR_OUT_OF_RANGE(a||"offset",`>= ${a?1:0} and <= ${t}`,e)}V("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),V("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),V("ERR_OUT_OF_RANGE",(function(e,t,a){let i=`The value of "${e}" is out of range.`,o=a;return Number.isInteger(a)&&Math.abs(a)>2**32?o=H(String(a)):"bigint"==typeof a&&(o=String(a),(a>BigInt(2)**BigInt(32)||a<-(BigInt(2)**BigInt(32)))&&(o=H(o)),o+="n"),i+=` It must be ${t}. Received ${o}`,i}),RangeError);const K=/[^+/0-9A-Za-z-_]/g;function j(e,t){let a;t=t||1/0;const i=e.length;let o=null;const n=[];for(let r=0;r55295&&a<57344){if(!o){if(a>56319){(t-=3)>-1&&n.push(239,191,189);continue}if(r+1===i){(t-=3)>-1&&n.push(239,191,189);continue}o=a;continue}if(a<56320){(t-=3)>-1&&n.push(239,191,189),o=a;continue}a=65536+(o-55296<<10|a-56320)}else o&&(t-=3)>-1&&n.push(239,191,189);if(o=null,a<128){if((t-=1)<0)break;n.push(a)}else if(a<2048){if((t-=2)<0)break;n.push(a>>6|192,63&a|128)}else if(a<65536){if((t-=3)<0)break;n.push(a>>12|224,a>>6&63|128,63&a|128)}else{if(!(a<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;n.push(a>>18|240,a>>12&63|128,a>>6&63|128,63&a|128)}}return n}function x(e){return i.toByteArray((function(e){if((e=(e=e.split("=")[0]).trim().replace(K,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e})(e))}function Q(e,t,a,i){let o;for(o=0;o=t.length||o>=e.length);++o)t[o+a]=e[o];return o}function X(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function $(e){return e!=e}const q=(function(){const e="0123456789abcdef",t=new Array(256);for(let a=0;a<16;++a){const i=16*a;for(let o=0;o<16;++o)t[i+o]=e[a]+e[o]}return t})();function J(e){return"undefined"==typeof BigInt?Z:e}function Z(){throw new Error("BigInt not supported")}},38075:(e,t,a)=>{"use strict";var i=a(70453),o=a(10487),n=o(i("String.prototype.indexOf"));e.exports=function(e,t){var a=i(e,!!t);return"function"==typeof a&&n(e,".prototype.")>-1?o(a):a}},10487:(e,t,a)=>{"use strict";var i=a(66743),o=a(70453),n=a(96897),r=a(69675),E=o("%Function.prototype.apply%"),_=o("%Function.prototype.call%"),T=o("%Reflect.apply%",!0)||i.call(_,E),s=a(30655),S=o("%Math.max%");e.exports=function(e){if("function"!=typeof e)throw new r("a function is required");var t=T(i,_,arguments);return n(t,1+S(0,e.length-(arguments.length-1)),!0)};var l=function(){return T(i,E,arguments)};s?s(e.exports,"apply",{value:l}):e.exports.apply=l},15659:(e,t,a)=>{const i=a(8156),o={};for(const e of Object.keys(i))o[i[e]]=e;const n={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};e.exports=n;for(const e of Object.keys(n)){if(!("channels"in n[e]))throw new Error("missing channels property: "+e);if(!("labels"in n[e]))throw new Error("missing channel labels property: "+e);if(n[e].labels.length!==n[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:a}=n[e];delete n[e].channels,delete n[e].labels,Object.defineProperty(n[e],"channels",{value:t}),Object.defineProperty(n[e],"labels",{value:a})}n.rgb.hsl=function(e){const t=e[0]/255,a=e[1]/255,i=e[2]/255,o=Math.min(t,a,i),n=Math.max(t,a,i),r=n-o;let E,_;n===o?E=0:t===n?E=(a-i)/r:a===n?E=2+(i-t)/r:i===n&&(E=4+(t-a)/r),E=Math.min(60*E,360),E<0&&(E+=360);const T=(o+n)/2;return _=n===o?0:T<=.5?r/(n+o):r/(2-n-o),[E,100*_,100*T]},n.rgb.hsv=function(e){let t,a,i,o,n;const r=e[0]/255,E=e[1]/255,_=e[2]/255,T=Math.max(r,E,_),s=T-Math.min(r,E,_),S=function(e){return(T-e)/6/s+.5};return 0===s?(o=0,n=0):(n=s/T,t=S(r),a=S(E),i=S(_),r===T?o=i-a:E===T?o=1/3+t-i:_===T&&(o=2/3+a-t),o<0?o+=1:o>1&&(o-=1)),[360*o,100*n,100*T]},n.rgb.hwb=function(e){const t=e[0],a=e[1];let i=e[2];const o=n.rgb.hsl(e)[0],r=1/255*Math.min(t,Math.min(a,i));return i=1-1/255*Math.max(t,Math.max(a,i)),[o,100*r,100*i]},n.rgb.cmyk=function(e){const t=e[0]/255,a=e[1]/255,i=e[2]/255,o=Math.min(1-t,1-a,1-i);return[100*((1-t-o)/(1-o)||0),100*((1-a-o)/(1-o)||0),100*((1-i-o)/(1-o)||0),100*o]},n.rgb.keyword=function(e){const t=o[e];if(t)return t;let a,n=1/0;for(const t of Object.keys(i)){const o=i[t],_=(E=o,((r=e)[0]-E[0])**2+(r[1]-E[1])**2+(r[2]-E[2])**2);_.04045?((t+.055)/1.055)**2.4:t/12.92,a=a>.04045?((a+.055)/1.055)**2.4:a/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92;return[100*(.4124*t+.3576*a+.1805*i),100*(.2126*t+.7152*a+.0722*i),100*(.0193*t+.1192*a+.9505*i)]},n.rgb.lab=function(e){const t=n.rgb.xyz(e);let a=t[0],i=t[1],o=t[2];a/=95.047,i/=100,o/=108.883,a=a>.008856?a**(1/3):7.787*a+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;return[116*i-16,500*(a-i),200*(i-o)]},n.hsl.rgb=function(e){const t=e[0]/360,a=e[1]/100,i=e[2]/100;let o,n,r;if(0===a)return r=255*i,[r,r,r];o=i<.5?i*(1+a):i+a-i*a;const E=2*i-o,_=[0,0,0];for(let e=0;e<3;e++)n=t+1/3*-(e-1),n<0&&n++,n>1&&n--,r=6*n<1?E+6*(o-E)*n:2*n<1?o:3*n<2?E+(o-E)*(2/3-n)*6:E,_[e]=255*r;return _},n.hsl.hsv=function(e){const t=e[0];let a=e[1]/100,i=e[2]/100,o=a;const n=Math.max(i,.01);i*=2,a*=i<=1?i:2-i,o*=n<=1?n:2-n;return[t,100*(0===i?2*o/(n+o):2*a/(i+a)),100*((i+a)/2)]},n.hsv.rgb=function(e){const t=e[0]/60,a=e[1]/100;let i=e[2]/100;const o=Math.floor(t)%6,n=t-Math.floor(t),r=255*i*(1-a),E=255*i*(1-a*n),_=255*i*(1-a*(1-n));switch(i*=255,o){case 0:return[i,_,r];case 1:return[E,i,r];case 2:return[r,i,_];case 3:return[r,E,i];case 4:return[_,r,i];case 5:return[i,r,E]}},n.hsv.hsl=function(e){const t=e[0],a=e[1]/100,i=e[2]/100,o=Math.max(i,.01);let n,r;r=(2-a)*i;const E=(2-a)*o;return n=a*o,n/=E<=1?E:2-E,n=n||0,r/=2,[t,100*n,100*r]},n.hwb.rgb=function(e){const t=e[0]/360;let a=e[1]/100,i=e[2]/100;const o=a+i;let n;o>1&&(a/=o,i/=o);const r=Math.floor(6*t),E=1-i;n=6*t-r,1&r&&(n=1-n);const _=a+n*(E-a);let T,s,S;switch(r){default:case 6:case 0:T=E,s=_,S=a;break;case 1:T=_,s=E,S=a;break;case 2:T=a,s=E,S=_;break;case 3:T=a,s=_,S=E;break;case 4:T=_,s=a,S=E;break;case 5:T=E,s=a,S=_}return[255*T,255*s,255*S]},n.cmyk.rgb=function(e){const t=e[0]/100,a=e[1]/100,i=e[2]/100,o=e[3]/100;return[255*(1-Math.min(1,t*(1-o)+o)),255*(1-Math.min(1,a*(1-o)+o)),255*(1-Math.min(1,i*(1-o)+o))]},n.xyz.rgb=function(e){const t=e[0]/100,a=e[1]/100,i=e[2]/100;let o,n,r;return o=3.2406*t+-1.5372*a+-.4986*i,n=-.9689*t+1.8758*a+.0415*i,r=.0557*t+-.204*a+1.057*i,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,n=n>.0031308?1.055*n**(1/2.4)-.055:12.92*n,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,o=Math.min(Math.max(0,o),1),n=Math.min(Math.max(0,n),1),r=Math.min(Math.max(0,r),1),[255*o,255*n,255*r]},n.xyz.lab=function(e){let t=e[0],a=e[1],i=e[2];t/=95.047,a/=100,i/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,a=a>.008856?a**(1/3):7.787*a+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;return[116*a-16,500*(t-a),200*(a-i)]},n.lab.xyz=function(e){let t,a,i;a=(e[0]+16)/116,t=e[1]/500+a,i=a-e[2]/200;const o=a**3,n=t**3,r=i**3;return a=o>.008856?o:(a-16/116)/7.787,t=n>.008856?n:(t-16/116)/7.787,i=r>.008856?r:(i-16/116)/7.787,t*=95.047,a*=100,i*=108.883,[t,a,i]},n.lab.lch=function(e){const t=e[0],a=e[1],i=e[2];let o;o=360*Math.atan2(i,a)/2/Math.PI,o<0&&(o+=360);return[t,Math.sqrt(a*a+i*i),o]},n.lch.lab=function(e){const t=e[0],a=e[1],i=e[2]/360*2*Math.PI;return[t,a*Math.cos(i),a*Math.sin(i)]},n.rgb.ansi16=function(e,t=null){const[a,i,o]=e;let r=null===t?n.rgb.hsv(e)[2]:t;if(r=Math.round(r/50),0===r)return 30;let E=30+(Math.round(o/255)<<2|Math.round(i/255)<<1|Math.round(a/255));return 2===r&&(E+=60),E},n.hsv.ansi16=function(e){return n.rgb.ansi16(n.hsv.rgb(e),e[2])},n.rgb.ansi256=function(e){const t=e[0],a=e[1],i=e[2];if(t===a&&a===i)return t<8?16:t>248?231:Math.round((t-8)/247*24)+232;return 16+36*Math.round(t/255*5)+6*Math.round(a/255*5)+Math.round(i/255*5)},n.ansi16.rgb=function(e){let t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const a=.5*(1+~~(e>50));return[(1&t)*a*255,(t>>1&1)*a*255,(t>>2&1)*a*255]},n.ansi256.rgb=function(e){if(e>=232){const t=10*(e-232)+8;return[t,t,t]}let t;e-=16;return[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},n.rgb.hex=function(e){const t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},n.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let a=t[0];3===t[0].length&&(a=a.split("").map((e=>e+e)).join(""));const i=parseInt(a,16);return[i>>16&255,i>>8&255,255&i]},n.rgb.hcg=function(e){const t=e[0]/255,a=e[1]/255,i=e[2]/255,o=Math.max(Math.max(t,a),i),n=Math.min(Math.min(t,a),i),r=o-n;let E,_;return E=r<1?n/(1-r):0,_=r<=0?0:o===t?(a-i)/r%6:o===a?2+(i-t)/r:4+(t-a)/r,_/=6,_%=1,[360*_,100*r,100*E]},n.hsl.hcg=function(e){const t=e[1]/100,a=e[2]/100,i=a<.5?2*t*a:2*t*(1-a);let o=0;return i<1&&(o=(a-.5*i)/(1-i)),[e[0],100*i,100*o]},n.hsv.hcg=function(e){const t=e[1]/100,a=e[2]/100,i=t*a;let o=0;return i<1&&(o=(a-i)/(1-i)),[e[0],100*i,100*o]},n.hcg.rgb=function(e){const t=e[0]/360,a=e[1]/100,i=e[2]/100;if(0===a)return[255*i,255*i,255*i];const o=[0,0,0],n=t%1*6,r=n%1,E=1-r;let _=0;switch(Math.floor(n)){case 0:o[0]=1,o[1]=r,o[2]=0;break;case 1:o[0]=E,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=r;break;case 3:o[0]=0,o[1]=E,o[2]=1;break;case 4:o[0]=r,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=E}return _=(1-a)*i,[255*(a*o[0]+_),255*(a*o[1]+_),255*(a*o[2]+_)]},n.hcg.hsv=function(e){const t=e[1]/100,a=t+e[2]/100*(1-t);let i=0;return a>0&&(i=t/a),[e[0],100*i,100*a]},n.hcg.hsl=function(e){const t=e[1]/100,a=e[2]/100*(1-t)+.5*t;let i=0;return a>0&&a<.5?i=t/(2*a):a>=.5&&a<1&&(i=t/(2*(1-a))),[e[0],100*i,100*a]},n.hcg.hwb=function(e){const t=e[1]/100,a=t+e[2]/100*(1-t);return[e[0],100*(a-t),100*(1-a)]},n.hwb.hcg=function(e){const t=e[1]/100,a=1-e[2]/100,i=a-t;let o=0;return i<1&&(o=(a-i)/(1-i)),[e[0],100*i,100*o]},n.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},n.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},n.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},n.gray.hsl=function(e){return[0,0,e[0]]},n.gray.hsv=n.gray.hsl,n.gray.hwb=function(e){return[0,100,e[0]]},n.gray.cmyk=function(e){return[0,0,0,e[0]]},n.gray.lab=function(e){return[e[0],0,0]},n.gray.hex=function(e){const t=255&Math.round(e[0]/100*255),a=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(a.length)+a},n.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}},10734:(e,t,a)=>{const i=a(15659),o=a(8507),n={};Object.keys(i).forEach((e=>{n[e]={},Object.defineProperty(n[e],"channels",{value:i[e].channels}),Object.defineProperty(n[e],"labels",{value:i[e].labels});const t=o(e);Object.keys(t).forEach((a=>{const i=t[a];n[e][a]=(function(e){const t=function(...t){const a=t[0];if(null==a)return a;a.length>1&&(t=a);const i=e(t);if("object"==typeof i)for(let e=i.length,t=0;t1&&(t=a),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t})(i)}))})),e.exports=n},8507:(e,t,a)=>{const i=a(15659);function o(e){const t=(function(){const e={},t=Object.keys(i);for(let a=t.length,i=0;i{"use strict";e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},28854:(e,t,a)=>{var i=a(8156),o=a(19872),n=Object.hasOwnProperty,r=Object.create(null);for(var E in i)n.call(i,E)&&(r[i[E]]=E);var _=e.exports={to:{},get:{}};function T(e,t,a){return Math.min(Math.max(t,e),a)}function s(e){var t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}_.get=function(e){var t,a;switch(e.substring(0,3).toLowerCase()){case"hsl":t=_.get.hsl(e),a="hsl";break;case"hwb":t=_.get.hwb(e),a="hwb";break;default:t=_.get.rgb(e),a="rgb"}return t?{model:a,value:t}:null},_.get.rgb=function(e){if(!e)return null;var t,a,o,r=[0,0,0,1];if(t=e.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(o=t[2],t=t[1],a=0;a<3;a++){var E=2*a;r[a]=parseInt(t.slice(E,E+2),16)}o&&(r[3]=parseInt(o,16)/255)}else if(t=e.match(/^#([a-f0-9]{3,4})$/i)){for(o=(t=t[1])[3],a=0;a<3;a++)r[a]=parseInt(t[a]+t[a],16);o&&(r[3]=parseInt(o+o,16)/255)}else if(t=e.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(a=0;a<3;a++)r[a]=parseInt(t[a+1],0);t[4]&&(t[5]?r[3]=.01*parseFloat(t[4]):r[3]=parseFloat(t[4]))}else{if(!(t=e.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(t=e.match(/^(\w+)$/))?"transparent"===t[1]?[0,0,0,0]:n.call(i,t[1])?((r=i[t[1]])[3]=1,r):null:null;for(a=0;a<3;a++)r[a]=Math.round(2.55*parseFloat(t[a+1]));t[4]&&(t[5]?r[3]=.01*parseFloat(t[4]):r[3]=parseFloat(t[4]))}for(a=0;a<3;a++)r[a]=T(r[a],0,255);return r[3]=T(r[3],0,1),r},_.get.hsl=function(e){if(!e)return null;var t=e.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var a=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,T(parseFloat(t[2]),0,100),T(parseFloat(t[3]),0,100),T(isNaN(a)?1:a,0,1)]}return null},_.get.hwb=function(e){if(!e)return null;var t=e.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var a=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,T(parseFloat(t[2]),0,100),T(parseFloat(t[3]),0,100),T(isNaN(a)?1:a,0,1)]}return null},_.to.hex=function(){var e=o(arguments);return"#"+s(e[0])+s(e[1])+s(e[2])+(e[3]<1?s(Math.round(255*e[3])):"")},_.to.rgb=function(){var e=o(arguments);return e.length<4||1===e[3]?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"},_.to.rgb.percent=function(){var e=o(arguments),t=Math.round(e[0]/255*100),a=Math.round(e[1]/255*100),i=Math.round(e[2]/255*100);return e.length<4||1===e[3]?"rgb("+t+"%, "+a+"%, "+i+"%)":"rgba("+t+"%, "+a+"%, "+i+"%, "+e[3]+")"},_.to.hsl=function(){var e=o(arguments);return e.length<4||1===e[3]?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"},_.to.hwb=function(){var e=o(arguments),t="";return e.length>=4&&1!==e[3]&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"},_.to.keyword=function(e){return r[e.slice(0,3)]}},2520:(e,t,a)=>{const i=a(28854),o=a(10734),n=["keyword","gray","hex"],r={};for(const e of Object.keys(o))r[[...o[e].labels].sort().join("")]=e;const E={};function _(e,t){if(!(this instanceof _))return new _(e,t);if(t&&t in n&&(t=null),t&&!(t in o))throw new Error("Unknown model: "+t);let a,T;if(null==e)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof _)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if("string"==typeof e){const t=i.get(e);if(null===t)throw new Error("Unable to parse color from string: "+e);this.model=t.model,T=o[this.model].channels,this.color=t.value.slice(0,T),this.valpha="number"==typeof t.value[T]?t.value[T]:1}else if(e.length>0){this.model=t||"rgb",T=o[this.model].channels;const a=Array.prototype.slice.call(e,0,T);this.color=l(a,T),this.valpha="number"==typeof e[T]?e[T]:1}else if("number"==typeof e)this.model="rgb",this.color=[e>>16&255,e>>8&255,255&e],this.valpha=1;else{this.valpha=1;const t=Object.keys(e);"alpha"in e&&(t.splice(t.indexOf("alpha"),1),this.valpha="number"==typeof e.alpha?e.alpha:0);const i=t.sort().join("");if(!(i in r))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=r[i];const{labels:n}=o[this.model],E=[];for(a=0;a(e%360+360)%360)),saturationl:s("hsl",1,S(100)),lightness:s("hsl",2,S(100)),saturationv:s("hsv",1,S(100)),value:s("hsv",2,S(100)),chroma:s("hcg",1,S(100)),gray:s("hcg",2,S(100)),white:s("hwb",1,S(100)),wblack:s("hwb",2,S(100)),cyan:s("cmyk",0,S(100)),magenta:s("cmyk",1,S(100)),yellow:s("cmyk",2,S(100)),black:s("cmyk",3,S(100)),x:s("xyz",0,S(95.047)),y:s("xyz",1,S(100)),z:s("xyz",2,S(108.833)),l:s("lab",0,S(100)),a:s("lab",1),b:s("lab",2),keyword(e){return void 0!==e?new _(e):o[this.model].keyword(this.color)},hex(e){return void 0!==e?new _(e):i.to.hex(this.rgb().round().color)},hexa(e){if(void 0!==e)return new _(e);const t=this.rgb().round().color;let a=Math.round(255*this.valpha).toString(16).toUpperCase();return 1===a.length&&(a="0"+a),i.to.hex(t)+a},rgbNumber(){const e=this.rgb().color;return(255&e[0])<<16|(255&e[1])<<8|255&e[2]},luminosity(){const e=this.rgb().color,t=[];for(const[a,i]of e.entries()){const e=i/255;t[a]=e<=.04045?e/12.92:((e+.055)/1.055)**2.4}return.2126*t[0]+.7152*t[1]+.0722*t[2]},contrast(e){const t=this.luminosity(),a=e.luminosity();return t>a?(t+.05)/(a+.05):(a+.05)/(t+.05)},level(e){const t=this.contrast(e);return t>=7?"AAA":t>=4.5?"AA":""},isDark(){const e=this.rgb().color;return(2126*e[0]+7152*e[1]+722*e[2])/1e4<128},isLight(){return!this.isDark()},negate(){const e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){const t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){const t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){const t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){const t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){const t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){const t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){const e=this.rgb().color,t=.3*e[0]+.59*e[1]+.11*e[2];return _.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){const t=this.hsl();let a=t.color[0];return a=(a+e)%360,a=a<0?360+a:a,t.color[0]=a,t},mix(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);const a=e.rgb(),i=this.rgb(),o=void 0===t?.5:t,n=2*o-1,r=a.alpha()-i.alpha(),E=((n*r==-1?n:(n+r)/(1+n*r))+1)/2,T=1-E;return _.rgb(E*a.red()+T*i.red(),E*a.green()+T*i.green(),E*a.blue()+T*i.blue(),a.alpha()*o+i.alpha()*(1-o))}};for(const e of Object.keys(o)){if(n.includes(e))continue;const{channels:t}=o[e];_.prototype[e]=function(...t){return this.model===e?new _(this):t.length>0?new _(t,e):new _([...(a=o[this.model][e].raw(this.color),Array.isArray(a)?a:[a]),this.valpha],e);var a},_[e]=function(...a){let i=a[0];return"number"==typeof i&&(i=l(a,t)),new _(i,e)}}function T(e){return function(t){return(function(e,t){return Number(e.toFixed(t))})(t,e)}}function s(e,t,a){e=Array.isArray(e)?e:[e];for(const i of e)(E[i]||(E[i]=[]))[t]=a;return e=e[0],function(i){let o;return void 0!==i?(a&&(i=a(i)),o=this[e](),o.color[t]=i,o):(o=this[e]().color[t],a&&(o=a(o)),o)}}function S(e){return function(t){return Math.max(0,Math.min(e,t))}}function l(e,t){for(let a=0;a{e.exports=function e(t){return Object.freeze(t),Object.getOwnPropertyNames(t).forEach((function(a){!t.hasOwnProperty(a)||null===t[a]||"object"!=typeof t[a]&&"function"!=typeof t[a]||Object.isFrozen(t[a])||e(t[a])})),t}},30041:(e,t,a)=>{"use strict";var i=a(30655),o=a(58068),n=a(69675),r=a(75795);e.exports=function(e,t,a){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new n("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new n("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new n("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new n("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new n("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new n("`loose`, if provided, must be a boolean");var E=arguments.length>3?arguments[3]:null,_=arguments.length>4?arguments[4]:null,T=arguments.length>5?arguments[5]:null,s=arguments.length>6&&arguments[6],S=!!r&&r(e,t);if(i)i(e,t,{configurable:null===T&&S?S.configurable:!T,enumerable:null===E&&S?S.enumerable:!E,value:a,writable:null===_&&S?S.writable:!_});else{if(!s&&(E||_||T))throw new o("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=a}}},30655:(e,t,a)=>{"use strict";var i=a(70453)("%Object.defineProperty%",!0)||!1;if(i)try{i({},"a",{value:1})}catch(e){i=!1}e.exports=i},41237:e=>{"use strict";e.exports=EvalError},69383:e=>{"use strict";e.exports=Error},79290:e=>{"use strict";e.exports=RangeError},79538:e=>{"use strict";e.exports=ReferenceError},58068:e=>{"use strict";e.exports=SyntaxError},69675:e=>{"use strict";e.exports=TypeError},35345:e=>{"use strict";e.exports=URIError},30228:e=>{"use strict";var t=Object.prototype.hasOwnProperty,a="~";function i(){}function o(e,t,a){this.fn=e,this.context=t,this.once=a||!1}function n(e,t,i,n,r){if("function"!=typeof i)throw new TypeError("The listener must be a function");var E=new o(i,n||e,r),_=a?a+t:t;return e._events[_]?e._events[_].fn?e._events[_]=[e._events[_],E]:e._events[_].push(E):(e._events[_]=E,e._eventsCount++),e}function r(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function E(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(a=!1)),E.prototype.eventNames=function(){var e,i,o=[];if(0===this._eventsCount)return o;for(i in e=this._events)t.call(e,i)&&o.push(a?i.slice(1):i);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},E.prototype.listeners=function(e){var t=a?a+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var o=0,n=i.length,r=new Array(n);o{"use strict";t.A=function(e){var t={};for(var a in e)e.hasOwnProperty(a)&&o(a)&&(t[a]=e[a]);return t};var a={onCopy:!0,onCut:!0,onPaste:!0,onLoad:!0,onError:!0,onWheel:!0,onScroll:!0,onCompositionEnd:!0,onCompositionStart:!0,onCompositionUpdate:!0,onKeyDown:!0,onKeyPress:!0,onKeyUp:!0,onFocus:!0,onBlur:!0,onChange:!0,onInput:!0,onSubmit:!0,onClick:!0,onContextMenu:!0,onDoubleClick:!0,onDrag:!0,onDragEnd:!0,onDragEnter:!0,onDragExit:!0,onDragLeave:!0,onDragOver:!0,onDragStart:!0,onDrop:!0,onMouseDown:!0,onMouseEnter:!0,onMouseLeave:!0,onMouseMove:!0,onMouseOut:!0,onMouseOver:!0,onMouseUp:!0,onSelect:!0,onTouchCancel:!0,onTouchEnd:!0,onTouchMove:!0,onTouchStart:!0,onAnimationStart:!0,onAnimationEnd:!0,onAnimationIteration:!0,onTransitionEnd:!0},i={abbr:"abbr",accept:"accept",acceptCharset:"accept-charset",accessKey:"accesskey",action:"action",allowFullScreen:"allowfullscreen",allowTransparency:"allowtransparency",alt:"alt",async:"async",autoComplete:"autocomplete",autoFocus:"autofocus",autoPlay:"autoplay",cellPadding:"cellpadding",cellSpacing:"cellspacing",challenge:"challenge",charset:"charset",checked:"checked",cite:"cite",class:"class",className:"class",cols:"cols",colSpan:"colspan",command:"command",content:"content",contentEditable:"contenteditable",contextMenu:"contextmenu",controls:"controls",coords:"coords",crossOrigin:"crossorigin",data:"data",dateTime:"datetime",default:"default",defer:"defer",dir:"dir",disabled:"disabled",download:"download",draggable:"draggable",dropzone:"dropzone",encType:"enctype",for:"for",form:"form",formAction:"formaction",formEncType:"formenctype",formMethod:"formmethod",formNoValidate:"formnovalidate",formTarget:"formtarget",frameBorder:"frameBorder",headers:"headers",height:"height",hidden:"hidden",high:"high",href:"href",hrefLang:"hreflang",htmlFor:"for",httpEquiv:"http-equiv",icon:"icon",id:"id",inputMode:"inputmode",isMap:"ismap",itemId:"itemid",itemProp:"itemprop",itemRef:"itemref",itemScope:"itemscope",itemType:"itemtype",kind:"kind",label:"label",lang:"lang",list:"list",loop:"loop",manifest:"manifest",max:"max",maxLength:"maxlength",media:"media",mediaGroup:"mediagroup",method:"method",min:"min",minLength:"minlength",multiple:"multiple",muted:"muted",name:"name",noValidate:"novalidate",open:"open",optimum:"optimum",pattern:"pattern",ping:"ping",placeholder:"placeholder",poster:"poster",preload:"preload",radioGroup:"radiogroup",readOnly:"readonly",rel:"rel",required:"required",role:"role",rows:"rows",rowSpan:"rowspan",sandbox:"sandbox",scope:"scope",scoped:"scoped",scrolling:"scrolling",seamless:"seamless",selected:"selected",shape:"shape",size:"size",sizes:"sizes",sortable:"sortable",span:"span",spellCheck:"spellcheck",src:"src",srcDoc:"srcdoc",srcSet:"srcset",start:"start",step:"step",style:"style",tabIndex:"tabindex",target:"target",title:"title",translate:"translate",type:"type",typeMustMatch:"typemustmatch",useMap:"usemap",value:"value",width:"width",wmode:"wmode",wrap:"wrap"};function o(e){return a[e]||i[e]||/^(data|aria)-/.test(e)}},89353:e=>{"use strict";var t=Object.prototype.toString,a=Math.max,i=function(e,t){for(var a=[],i=0;i{"use strict";var i=a(89353);e.exports=Function.prototype.bind||i},70453:(e,t,a)=>{"use strict";var i,o=a(69383),n=a(41237),r=a(79290),E=a(79538),_=a(58068),T=a(69675),s=a(35345),S=Function,l=function(e){try{return S('"use strict"; return ('+e+").constructor;")()}catch(e){}},I=Object.getOwnPropertyDescriptor;if(I)try{I({},"")}catch(e){I=null}var u=function(){throw new T},A=I?(function(){try{return u}catch(e){try{return I(arguments,"callee").get}catch(e){return u}}})():u,d=a(64039)(),O=a(80024)(),c=Object.getPrototypeOf||(O?function(e){return e.__proto__}:null),R={},N="undefined"!=typeof Uint8Array&&c?c(Uint8Array):i,m={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?i:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?i:ArrayBuffer,"%ArrayIteratorPrototype%":d&&c?c([][Symbol.iterator]()):i,"%AsyncFromSyncIteratorPrototype%":i,"%AsyncFunction%":R,"%AsyncGenerator%":R,"%AsyncGeneratorFunction%":R,"%AsyncIteratorPrototype%":R,"%Atomics%":"undefined"==typeof Atomics?i:Atomics,"%BigInt%":"undefined"==typeof BigInt?i:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?i:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?i:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?i:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":o,"%eval%":eval,"%EvalError%":n,"%Float32Array%":"undefined"==typeof Float32Array?i:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?i:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?i:FinalizationRegistry,"%Function%":S,"%GeneratorFunction%":R,"%Int8Array%":"undefined"==typeof Int8Array?i:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?i:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?i:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":d&&c?c(c([][Symbol.iterator]())):i,"%JSON%":"object"==typeof JSON?JSON:i,"%Map%":"undefined"==typeof Map?i:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&d&&c?c((new Map)[Symbol.iterator]()):i,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?i:Promise,"%Proxy%":"undefined"==typeof Proxy?i:Proxy,"%RangeError%":r,"%ReferenceError%":E,"%Reflect%":"undefined"==typeof Reflect?i:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?i:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&d&&c?c((new Set)[Symbol.iterator]()):i,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?i:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":d&&c?c(""[Symbol.iterator]()):i,"%Symbol%":d?Symbol:i,"%SyntaxError%":_,"%ThrowTypeError%":A,"%TypedArray%":N,"%TypeError%":T,"%Uint8Array%":"undefined"==typeof Uint8Array?i:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?i:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?i:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?i:Uint32Array,"%URIError%":s,"%WeakMap%":"undefined"==typeof WeakMap?i:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?i:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?i:WeakSet};if(c)try{null.error}catch(e){var L=c(c(e));m["%Error.prototype%"]=L}var D=function e(t){var a;if("%AsyncFunction%"===t)a=l("async function () {}");else if("%GeneratorFunction%"===t)a=l("function* () {}");else if("%AsyncGeneratorFunction%"===t)a=l("async function* () {}");else if("%AsyncGenerator%"===t){var i=e("%AsyncGeneratorFunction%");i&&(a=i.prototype)}else if("%AsyncIteratorPrototype%"===t){var o=e("%AsyncGenerator%");o&&c&&(a=c(o.prototype))}return m[t]=a,a},p={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},h=a(66743),C=a(9957),f=h.call(Function.call,Array.prototype.concat),P=h.call(Function.apply,Array.prototype.splice),B=h.call(Function.call,String.prototype.replace),g=h.call(Function.call,String.prototype.slice),v=h.call(Function.call,RegExp.prototype.exec),M=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,W=/\\(\\)?/g,y=function(e,t){var a,i=e;if(C(p,i)&&(i="%"+(a=p[i])[0]+"%"),C(m,i)){var o=m[i];if(o===R&&(o=D(i)),void 0===o&&!t)throw new T("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:a,name:i,value:o}}throw new _("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new T("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new T('"allowMissing" argument must be a boolean');if(null===v(/^%?[^%]*%?$/,e))throw new _("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var a=(function(e){var t=g(e,0,1),a=g(e,-1);if("%"===t&&"%"!==a)throw new _("invalid intrinsic syntax, expected closing `%`");if("%"===a&&"%"!==t)throw new _("invalid intrinsic syntax, expected opening `%`");var i=[];return B(e,M,(function(e,t,a,o){i[i.length]=a?B(o,W,"$1"):t||e})),i})(e),i=a.length>0?a[0]:"",o=y("%"+i+"%",t),n=o.name,r=o.value,E=!1,s=o.alias;s&&(i=s[0],P(a,f([0,1],s)));for(var S=1,l=!0;S=a.length){var O=I(r,u);r=(l=!!O)&&"get"in O&&!("originalValue"in O.get)?O.get:r[u]}else l=C(r,u),r=r[u];l&&!E&&(m[n]=r)}}return r}},75795:(e,t,a)=>{"use strict";var i=a(70453)("%Object.getOwnPropertyDescriptor%",!0);if(i)try{i([],"length")}catch(e){i=null}e.exports=i},30592:(e,t,a)=>{"use strict";var i=a(30655),o=function(){return!!i};o.hasArrayLengthDefineBug=function(){if(!i)return null;try{return 1!==i([],"length",{value:1}).length}catch(e){return!0}},e.exports=o},80024:e=>{"use strict";var t={__proto__:null,foo:{}},a=Object;e.exports=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof a)}},64039:(e,t,a)=>{"use strict";var i="undefined"!=typeof Symbol&&Symbol,o=a(41333);e.exports=function(){return"function"==typeof i&&("function"==typeof Symbol&&("symbol"==typeof i("foo")&&("symbol"==typeof Symbol("bar")&&o())))}},41333:e=>{"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),a=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(a))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var i=Object.getOwnPropertySymbols(e);if(1!==i.length||i[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(e,t);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},9957:(e,t,a)=>{"use strict";var i=Function.prototype.call,o=Object.prototype.hasOwnProperty,n=a(66743);e.exports=n.call(i,o)},39590:e=>{var t=e.exports=function(e,a){if(a||(a=16),void 0===e&&(e=128),e<=0)return"0";for(var i=Math.log(Math.pow(2,e))/Math.log(a),o=2;i===1/0;o*=2)i=Math.log(Math.pow(2,e/o))/Math.log(a)*o;var n=i-Math.floor(i),r="";for(o=0;o=Math.pow(2,e)?t(e,a):r};t.rack=function(e,a,i){var o=function(o){var r=0;do{if(r++>10){if(!i)throw new Error("too many ID collisions, use more bits");e+=i}var E=t(e,a)}while(Object.hasOwnProperty.call(n,E));return n[E]=o,E},n=o.hats={};return o.get=function(e){return o.hats[e]},o.set=function(e,t){return o.hats[e]=t,o},o.bits=e||128,o.base=a||16,o}},39473:e=>{!(function t(a){e.exports=(function(){"use strict";function e(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,i)}return a}function i(t){for(var a=1;ae.length)&&(t=e.length);for(var a=0,i=new Array(t);a=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function m(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var L={exports:{}};!(function(e){var t,a,i,o,n;t=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,a=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,n={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var o=n.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");return o.path=n.normalizePath(o.path),n.buildURLFromParts(o)}var r=n.parseURL(t);if(!r)throw new Error("Error trying to parse relative URL.");if(r.scheme)return i.alwaysNormalize?(r.path=n.normalizePath(r.path),n.buildURLFromParts(r)):t;var E=n.parseURL(e);if(!E)throw new Error("Error trying to parse base URL.");if(!E.netLoc&&E.path&&"/"!==E.path[0]){var _=a.exec(E.path);E.netLoc=_[1],E.path=_[2]}E.netLoc&&!E.path&&(E.path="/");var T={scheme:E.scheme,netLoc:r.netLoc,path:null,params:r.params,query:r.query,fragment:r.fragment};if(!r.netLoc&&(T.netLoc=E.netLoc,"/"!==r.path[0]))if(r.path){var s=E.path,S=s.substring(0,s.lastIndexOf("/")+1)+r.path;T.path=n.normalizePath(S)}else T.path=E.path,r.params||(T.params=E.params,r.query||(T.query=E.query));return null===T.path&&(T.path=i.alwaysNormalize?n.normalizePath(r.path):r.path),n.buildURLFromParts(T)},parseURL:function(e){var a=t.exec(e);return a?{scheme:a[1]||"",netLoc:a[2]||"",path:a[3]||"",params:a[4]||"",query:a[5]||"",fragment:a[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(i,"");e.length!==(e=e.replace(o,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=n})(L);var D=L.exports,p=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},h=Number.isSafeInteger||function(e){return"number"==typeof e&&Math.abs(e)<=C},C=Number.MAX_SAFE_INTEGER||9007199254740991,f=(function(e){return e.MEDIA_ATTACHING="hlsMediaAttaching",e.MEDIA_ATTACHED="hlsMediaAttached",e.MEDIA_DETACHING="hlsMediaDetaching",e.MEDIA_DETACHED="hlsMediaDetached",e.BUFFER_RESET="hlsBufferReset",e.BUFFER_CODECS="hlsBufferCodecs",e.BUFFER_CREATED="hlsBufferCreated",e.BUFFER_APPENDING="hlsBufferAppending",e.BUFFER_APPENDED="hlsBufferAppended",e.BUFFER_EOS="hlsBufferEos",e.BUFFER_FLUSHING="hlsBufferFlushing",e.BUFFER_FLUSHED="hlsBufferFlushed",e.MANIFEST_LOADING="hlsManifestLoading",e.MANIFEST_LOADED="hlsManifestLoaded",e.MANIFEST_PARSED="hlsManifestParsed",e.LEVEL_SWITCHING="hlsLevelSwitching",e.LEVEL_SWITCHED="hlsLevelSwitched",e.LEVEL_LOADING="hlsLevelLoading",e.LEVEL_LOADED="hlsLevelLoaded",e.LEVEL_UPDATED="hlsLevelUpdated",e.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",e.LEVELS_UPDATED="hlsLevelsUpdated",e.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",e.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",e.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",e.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",e.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",e.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",e.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",e.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",e.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",e.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",e.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",e.CUES_PARSED="hlsCuesParsed",e.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",e.INIT_PTS_FOUND="hlsInitPtsFound",e.FRAG_LOADING="hlsFragLoading",e.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",e.FRAG_LOADED="hlsFragLoaded",e.FRAG_DECRYPTED="hlsFragDecrypted",e.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",e.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",e.FRAG_PARSING_METADATA="hlsFragParsingMetadata",e.FRAG_PARSED="hlsFragParsed",e.FRAG_BUFFERED="hlsFragBuffered",e.FRAG_CHANGED="hlsFragChanged",e.FPS_DROP="hlsFpsDrop",e.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",e.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",e.ERROR="hlsError",e.DESTROYING="hlsDestroying",e.KEY_LOADING="hlsKeyLoading",e.KEY_LOADED="hlsKeyLoaded",e.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",e.BACK_BUFFER_REACHED="hlsBackBufferReached",e.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",e})({}),P=(function(e){return e.NETWORK_ERROR="networkError",e.MEDIA_ERROR="mediaError",e.KEY_SYSTEM_ERROR="keySystemError",e.MUX_ERROR="muxError",e.OTHER_ERROR="otherError",e})({}),B=(function(e){return e.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",e.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",e.KEY_SYSTEM_NO_SESSION="keySystemNoSession",e.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",e.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",e.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",e.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",e.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",e.MANIFEST_LOAD_ERROR="manifestLoadError",e.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",e.MANIFEST_PARSING_ERROR="manifestParsingError",e.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",e.LEVEL_EMPTY_ERROR="levelEmptyError",e.LEVEL_LOAD_ERROR="levelLoadError",e.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",e.LEVEL_PARSING_ERROR="levelParsingError",e.LEVEL_SWITCH_ERROR="levelSwitchError",e.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",e.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",e.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",e.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",e.FRAG_LOAD_ERROR="fragLoadError",e.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",e.FRAG_DECRYPT_ERROR="fragDecryptError",e.FRAG_PARSING_ERROR="fragParsingError",e.FRAG_GAP="fragGap",e.REMUX_ALLOC_ERROR="remuxAllocError",e.KEY_LOAD_ERROR="keyLoadError",e.KEY_LOAD_TIMEOUT="keyLoadTimeOut",e.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",e.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",e.BUFFER_APPEND_ERROR="bufferAppendError",e.BUFFER_APPENDING_ERROR="bufferAppendingError",e.BUFFER_STALLED_ERROR="bufferStalledError",e.BUFFER_FULL_ERROR="bufferFullError",e.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",e.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",e.INTERNAL_EXCEPTION="internalException",e.INTERNAL_ABORTED="aborted",e.UNKNOWN="unknown",e})({}),g=function(){},v={trace:g,debug:g,log:g,warn:g,info:g,error:g},M=v;function W(e){var t=self.console[e];return t?t.bind(self.console,"["+e+"] >"):g}function y(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),i=1;iNumber.MAX_SAFE_INTEGER?1/0:t},t.hexadecimalInteger=function(e){if(this[e]){var t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;for(var a=new Uint8Array(t.length/2),i=0;iNumber.MAX_SAFE_INTEGER?1/0:t},t.decimalFloatingPoint=function(e){return parseFloat(this[e])},t.optionalFloat=function(e,t){var a=this[e];return a?parseFloat(a):t},t.enumeratedString=function(e){return this[e]},t.bool=function(e){return"YES"===this[e]},t.decimalResolution=function(e){var t=G.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}},e.parseAttrList=function(e){var t,a={},i='"';for(k.lastIndex=0;null!==(t=k.exec(e));){var o=t[2];0===o.indexOf(i)&&o.lastIndexOf(i)===o.length-1&&(o=o.slice(1,-1)),a[t[1].trim()]=o}return a},E(e,[{key:"clientAttrs",get:function(){return Object.keys(this).filter((function(e){return"X-"===e.substring(0,2)}))}}]),e})();function V(e){return"ID"!==e&&"CLASS"!==e&&"START-DATE"!==e&&"DURATION"!==e&&"END-DATE"!==e&&"END-ON-NEXT"!==e}function H(e){return"SCTE35-OUT"===e||"SCTE35-IN"===e}var w=(function(){function e(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){var a=t.attr;for(var i in a)if(Object.prototype.hasOwnProperty.call(e,i)&&e[i]!==a[i]){U.warn('DATERANGE tag attribute: "'+i+'" does not match for tags with ID: "'+e.ID+'"'),this._badValueForSameId=i;break}e=T(new F({}),a,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){var o=new Date(this.attr["END-DATE"]);p(o.getTime())&&(this._endDate=o)}}return E(e,[{key:"id",get:function(){return this.attr.ID}},{key:"class",get:function(){return this.attr.CLASS}},{key:"startDate",get:function(){return this._startDate}},{key:"endDate",get:function(){if(this._endDate)return this._endDate;var e=this.duration;return null!==e?new Date(this._startDate.getTime()+1e3*e):null}},{key:"duration",get:function(){if("DURATION"in this.attr){var e=this.attr.decimalFloatingPoint("DURATION");if(p(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}},{key:"plannedDuration",get:function(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}},{key:"endOnNext",get:function(){return this.attr.bool("END-ON-NEXT")}},{key:"isValid",get:function(){return!!this.id&&!this._badValueForSameId&&p(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)}}]),e})(),Y=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}},z={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"},K=(function(){function e(e){var t;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((t={})[z.AUDIO]=null,t[z.VIDEO]=null,t[z.AUDIOVIDEO]=null,t),this.baseurl=e}return e.prototype.setByteRange=function(e,t){var a,i=e.split("@",2);a=1===i.length?(null==t?void 0:t.byteRangeEndOffset)||0:parseInt(i[1]),this._byteRange=[a,parseInt(i[0])+a]},E(e,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=D.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(e){this._url=e}}]),e})(),j=(function(e){function t(t,a){var i;return(i=e.call(this,a)||this)._decryptdata=null,i.rawProgramDateTime=null,i.programDateTime=null,i.tagList=[],i.duration=0,i.sn=0,i.levelkeys=void 0,i.type=void 0,i.loader=null,i.keyLoader=null,i.level=-1,i.cc=0,i.startPTS=void 0,i.endPTS=void 0,i.startDTS=void 0,i.endDTS=void 0,i.start=0,i.deltaPTS=void 0,i.maxStartPTS=void 0,i.minEndPTS=void 0,i.stats=new Y,i.data=void 0,i.bitrateTest=!1,i.title=null,i.initSegment=null,i.endList=void 0,i.gap=void 0,i.urlId=0,i.type=t,i}s(t,e);var a=t.prototype;return a.setKeyFormat=function(e){if(this.levelkeys){var t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}},a.abortRequests=function(){var e,t;null==(e=this.loader)||e.abort(),null==(t=this.keyLoader)||t.abort()},a.setElementaryStreamInfo=function(e,t,a,i,o,n){void 0===n&&(n=!1);var r=this.elementaryStreams,E=r[e];E?(E.startPTS=Math.min(E.startPTS,t),E.endPTS=Math.max(E.endPTS,a),E.startDTS=Math.min(E.startDTS,i),E.endDTS=Math.max(E.endDTS,o)):r[e]={startPTS:t,endPTS:a,startDTS:i,endDTS:o,partial:n}},a.clearElementaryStreamInfo=function(){var e=this.elementaryStreams;e[z.AUDIO]=null,e[z.VIDEO]=null,e[z.AUDIOVIDEO]=null},E(t,[{key:"decryptdata",get:function(){if(!this.levelkeys&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){var e=this.levelkeys.identity;if(e)this._decryptdata=e.getDecryptData(this.sn);else{var t=Object.keys(this.levelkeys);if(1===t.length)return this._decryptdata=this.levelkeys[t[0]].getDecryptData(this.sn)}}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(null===this.programDateTime)return null;if(!p(this.programDateTime))return null;var e=p(this.duration)?this.duration:0;return this.programDateTime+1e3*e}},{key:"encrypted",get:function(){var e;if(null!=(e=this._decryptdata)&&e.encrypted)return!0;if(this.levelkeys){var t=Object.keys(this.levelkeys),a=t.length;if(a>1||1===a&&this.levelkeys[t[0]].encrypted)return!0}return!1}}]),t})(K),x=(function(e){function t(t,a,i,o,n){var r;(r=e.call(this,i)||this).fragOffset=0,r.duration=0,r.gap=!1,r.independent=!1,r.relurl=void 0,r.fragment=void 0,r.index=void 0,r.stats=new Y,r.duration=t.decimalFloatingPoint("DURATION"),r.gap=t.bool("GAP"),r.independent=t.bool("INDEPENDENT"),r.relurl=t.enumeratedString("URI"),r.fragment=a,r.index=o;var E=t.enumeratedString("BYTERANGE");return E&&r.setByteRange(E,n),n&&(r.fragOffset=n.fragOffset+n.duration),r}return s(t,e),E(t,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var e=this.elementaryStreams;return!!(e.audio||e.video||e.audiovideo)}}]),t})(K),Q=10,X=(function(){function e(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}return e.prototype.reloaded=function(e){if(!e)return this.advanced=!0,void(this.updated=!0);var t=this.lastPartSn-e.lastPartSn,a=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!a||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||0===t&&a>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay},E(e,[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&p(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||Q}},{key:"drift",get:function(){var e=this.driftEndTime-this.driftStartTime;return e>0?1e3*(this.driftEnd-this.driftStart)/e:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var e;return null!=(e=this.fragments)&&e.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),e})();function $(e){return Uint8Array.from(atob(e),(function(e){return e.charCodeAt(0)}))}function q(e){var t=ee(e).subarray(0,16),a=new Uint8Array(16);return a.set(t,16-t.length),a}function J(e){var t=function(e,t,a){var i=e[t];e[t]=e[a],e[a]=i};t(e,0,3),t(e,1,2),t(e,4,5),t(e,6,7)}function Z(e){var t=e.split(":"),a=null;if("data"===t[0]&&2===t.length){var i=t[1].split(";"),o=i[i.length-1].split(",");if(2===o.length){var n="base64"===o[0],r=o[1];n?(i.splice(-1,1),a=$(r)):a=q(r)}}return a}function ee(e){return Uint8Array.from(unescape(encodeURIComponent(e)),(function(e){return e.charCodeAt(0)}))}var te="undefined"!=typeof self?self:void 0,ae={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},ie={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function oe(e){switch(e){case ie.FAIRPLAY:return ae.FAIRPLAY;case ie.PLAYREADY:return ae.PLAYREADY;case ie.WIDEVINE:return ae.WIDEVINE;case ie.CLEARKEY:return ae.CLEARKEY}}var ne={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function re(e){if(e===ne.WIDEVINE)return ae.WIDEVINE}function Ee(e){switch(e){case ae.FAIRPLAY:return ie.FAIRPLAY;case ae.PLAYREADY:return ie.PLAYREADY;case ae.WIDEVINE:return ie.WIDEVINE;case ae.CLEARKEY:return ie.CLEARKEY}}function _e(e){var t=e.drmSystems,a=e.widevineLicenseUrl,i=t?[ae.FAIRPLAY,ae.WIDEVINE,ae.PLAYREADY,ae.CLEARKEY].filter((function(e){return!!t[e]})):[];return!i[ae.WIDEVINE]&&a&&i.push(ae.WIDEVINE),i}var Te,se=null!=te&&null!=(Te=te.navigator)&&Te.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;function Se(e,t,a,i){var o;switch(e){case ae.FAIRPLAY:o=["cenc","sinf"];break;case ae.WIDEVINE:case ae.PLAYREADY:o=["cenc"];break;case ae.CLEARKEY:o=["cenc","keyids"];break;default:throw new Error("Unknown key-system: "+e)}return le(o,t,a,i)}function le(e,t,a,i){return[{initDataTypes:e,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:t.map((function(e){return{contentType:'audio/mp4; codecs="'+e+'"',robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null}})),videoCapabilities:a.map((function(e){return{contentType:'video/mp4; codecs="'+e+'"',robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}}))}]}function Ie(e,t,a){return Uint8Array.prototype.slice?e.slice(t,a):new Uint8Array(Array.prototype.slice.call(e,t,a))}var ue,Ae=function(e,t){return t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},de=function(e,t){return t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},Oe=function(e,t){for(var a=t,i=0;Ae(e,t);)i+=10,i+=ce(e,t+6),de(e,t+10)&&(i+=10),t+=i;if(i>0)return e.subarray(a,a+i)},ce=function(e,t){var a=0;return a=(127&e[t])<<21,a|=(127&e[t+1])<<14,a|=(127&e[t+2])<<7,a|=127&e[t+3]},Re=function(e,t){return Ae(e,t)&&ce(e,t+6)+10<=e.length-t},Ne=function(e){for(var t=De(e),a=0;a>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:T+=String.fromCharCode(n);break;case 12:case 13:r=e[s++],T+=String.fromCharCode((31&n)<<6|63&r);break;case 14:r=e[s++],E=e[s++],T+=String.fromCharCode((15&n)<<12|(63&r)<<6|63&E)}}return T};function ge(){if(!navigator.userAgent.includes("PlayStation 4"))return ue||void 0===self.TextDecoder||(ue=new self.TextDecoder("utf-8")),ue}var ve={hexDump:function(e){for(var t="",a=0;a>24,e[t+1]=a>>16&255,e[t+2]=a>>8&255,e[t+3]=255&a}function He(e){for(var t=e.byteLength,a=0;a8&&109===e[a+4]&&111===e[a+5]&&111===e[a+6]&&102===e[a+7])return!0;a=i>1?a+i:t}return!1}function we(e,t){var a=[];if(!t.length)return a;for(var i=e.byteLength,o=0;o1?o+n:i;if(be(e.subarray(o+4,o+8))===t[0])if(1===t.length)a.push(e.subarray(o+8,r));else{var E=we(e.subarray(o+8,r),t.slice(1));E.length&&We.apply(a,E)}o=r}return a}function Ye(e){var t=[],a=e[0],i=8,o=Ge(e,i);i+=4;var n=0,r=0;0===a?(n=Ge(e,i),r=Ge(e,i+4),i+=8):(n=ke(e,i),r=ke(e,i+8),i+=16),i+=2;var E=e.length+r,_=Ue(e,i);i+=2;for(var T=0;T<_;T++){var s=i,S=Ge(e,s);s+=4;var l=2147483647&S;if(1==(2147483648&S)>>>31)return U.warn("SIDX has hierarchical references (not supported)"),null;var I=Ge(e,s);s+=4,t.push({referenceSize:l,subsegmentDuration:I,info:{duration:I/o,start:E,end:E+l-1}}),E+=l,i=s+=4}return{earliestPresentationTime:n,timescale:o,version:a,referencesCount:_,references:t}}function ze(e){for(var t=[],a=we(e,["moov","trak"]),o=0;o12){var s=4;if(3!==T[s++])break;s=je(T,s),s+=2;var S=T[s++];if(128&S&&(s+=2),64&S&&(s+=T[s++]),4!==T[s++])break;s=je(T,s);var l=T[s++];if(64!==l)break;if(o+="."+xe(l),s+=12,5!==T[s++])break;s=je(T,s);var I=T[s++],u=(248&I)>>3;31===u&&(u+=1+((7&I)<<3)+((224&T[s])>>5)),o+="."+u}break;case"hvc1":case"hev1":var A=we(a,["hvcC"])[0],d=A[1],O=["","A","B","C"][d>>6],c=31&d,R=Ge(A,2),N=(32&d)>>5?"H":"L",m=A[12],L=A.subarray(6,12);o+="."+O+c,o+="."+R.toString(16).toUpperCase(),o+="."+N+m;for(var D="",p=L.length;p--;){var h=L[p];(h||D)&&(D="."+h.toString(16).toUpperCase()+D)}o+=D;break;case"dvh1":case"dvhe":var C=we(a,["dvcC"])[0],f=C[2]>>1&127,P=C[2]<<5&32|C[3]>>3&31;o+="."+Qe(f)+"."+Qe(P);break;case"vp09":var B=we(a,["vpcC"])[0],g=B[4],v=B[5],M=B[6]>>4&15;o+="."+Qe(g)+"."+Qe(v)+"."+Qe(M);break;case"av01":var W=we(a,["av1C"])[0],y=W[1]>>>5,b=31&W[1],U=W[2]>>>7?"H":"M",G=(64&W[2])>>6,k=(32&W[2])>>5,F=2===y&&G?k?12:10:G?10:8,V=(16&W[2])>>4,H=(8&W[2])>>3,w=(4&W[2])>>2,Y=3&W[2],z=1,K=1,j=1,x=0;o+="."+y+"."+Qe(b)+U+"."+Qe(F)+"."+V+"."+H+w+Y+"."+Qe(z)+"."+Qe(K)+"."+Qe(j)+"."+x}return{codec:o,encrypted:n}}function je(e,t){for(var a=t+5;128&e[t++]&&t0;o||(i=we(t,["encv"])),i.forEach((function(e){we(o?e.subarray(28):e.subarray(78),["sinf"]).forEach((function(e){var t=$e(e);if(t){var i=t.subarray(8,24);i.some((function(e){return 0!==e}))||(U.log("[eme] Patching keyId in 'enc"+(o?"a":"v")+">sinf>>tenc' box: "+ve.hexDump(i)+" -> "+ve.hexDump(a)),t.set(a,8))}}))}))})),e}function $e(e){var t=we(e,["schm"])[0];if(t){var a=be(t.subarray(4,8));if("cbcs"===a||"cenc"===a)return we(e,["schi","tenc"])[0]}return U.error("[eme] missing 'schm' box"),null}function qe(e,t){return we(t,["moof","traf"]).reduce((function(t,a){var i=we(a,["tfdt"])[0],o=i[0],n=we(a,["tfhd"]).reduce((function(t,a){var n=Ge(a,4),r=e[n];if(r){var E=Ge(i,4);if(1===o){if(E===Me)return U.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),t;E*=Me+1,E+=Ge(i,8)}var _=E/(r.timescale||9e4);if(p(_)&&(null===t||_>1&63;return 39===a||40===a}return 6==(31&t)}function rt(e,t,a,i){var o=Et(e),n=0;n+=t;for(var r=0,E=0,_=0;n=o.length)break;r+=_=o[n++]}while(255===_);E=0;do{if(n>=o.length)break;E+=_=o[n++]}while(255===_);var T=o.length-n,s=n;if(ET){U.error("Malformed SEI payload. "+E+" is too small, only "+T+" bytes left to parse.");break}if(4===r){if(181===o[s++]){var S=Ue(o,s);if(s+=2,49===S){var l=Ge(o,s);if(s+=4,1195456820===l){var I=o[s++];if(3===I){var u=o[s++],A=64&u,d=A?2+3*(31&u):0,O=new Uint8Array(d);if(A){O[0]=u;for(var c=1;c16){for(var R=[],N=0;N<16;N++){var m=o[s++].toString(16);R.push(1==m.length?"0"+m:m),3!==N&&5!==N&&7!==N&&9!==N||R.push("-")}for(var L=E-16,D=new Uint8Array(L),p=0;p1?t-1:0),i=1;i>24&255,E[1]=n>>16&255,E[2]=n>>8&255,E[3]=255&n,E.set(e,4),r=0,n=8;r0?(n=new Uint8Array(4),t.length>0&&new DataView(n.buffer).setUint32(0,t.length,!1)):n=new Uint8Array;var _=new Uint8Array(4);return a&&a.byteLength>0&&new DataView(_.buffer).setUint32(0,a.byteLength,!1),Tt([112,115,115,104],new Uint8Array([i,0,0,0]),e,n,o,_,a||new Uint8Array)}function St(e){if(!(e instanceof ArrayBuffer)||e.byteLength<32)return null;var t={version:0,systemId:"",kids:null,data:null},a=new DataView(e),i=a.getUint32(0);if(e.byteLength!==i&&i>44)return null;if(1886614376!==a.getUint32(4))return null;if(t.version=a.getUint32(8)>>>24,t.version>1)return null;t.systemId=ve.hexDump(new Uint8Array(e,12,16));var o=a.getUint32(28);if(0===t.version){if(i-32=22&&(this.keyId=i.subarray(i.length-22,i.length-6));break;case ie.PLAYREADY:var o=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=st(o,null,i);var n=new Uint16Array(i.buffer,i.byteOffset,i.byteLength/2),r=String.fromCharCode.apply(null,Array.from(n)),E=r.substring(r.indexOf("<"),r.length),_=(new DOMParser).parseFromString(E,"text/xml").getElementsByTagName("KID")[0];if(_){var T=_.childNodes[0]?_.childNodes[0].nodeValue:_.getAttribute("VALUE");if(T){var s=$(T).subarray(0,16);J(s),this.keyId=s}}break;default:var S=i.subarray(0,16);if(16!==S.length){var l=new Uint8Array(16);l.set(S,16-S.length),S=l}this.keyId=S}if(!this.keyId||16!==this.keyId.byteLength){var I=lt[this.uri];if(!I){var u=Object.keys(lt).length%Number.MAX_SAFE_INTEGER;I=new Uint8Array(16),new DataView(I.buffer,12,4).setUint32(0,u),lt[this.uri]=I}this.keyId=I}return this},e})();function ut(e){for(var t=new Uint8Array(16),a=12;a<16;a++)t[a]=e>>8*(15-a)&255;return t}var At=/\{\$([a-zA-Z0-9-_]+)\}/g;function dt(e){return At.test(e)}function Ot(e,t,a){if(null!==e.variableList||e.hasVariableRefs)for(var i=a.length;i--;){var o=a[i],n=t[o];n&&(t[o]=ct(e,n))}}function ct(e,t){if(null!==e.variableList||e.hasVariableRefs){var a=e.variableList;return t.replace(At,(function(t){var i=t.substring(2,t.length-1),o=null==a?void 0:a[i];return void 0===o?(e.playlistParsingError||(e.playlistParsingError=new Error('Missing preceding EXT-X-DEFINE tag for Variable Reference: "'+i+'"')),t):o}))}return t}function Rt(e,t,a){var i,o,n=e.variableList;if(n||(e.variableList=n={}),"QUERYPARAM"in t){i=t.QUERYPARAM;try{var r=new self.URL(a).searchParams;if(!r.has(i))throw new Error('"'+i+'" does not match any query parameter in URI: "'+a+'"');o=r.get(i)}catch(t){e.playlistParsingError||(e.playlistParsingError=new Error("EXT-X-DEFINE QUERYPARAM: "+t.message))}}else i=t.NAME,o=t.VALUE;i in n?e.playlistParsingError||(e.playlistParsingError=new Error('EXT-X-DEFINE duplicate Variable Name declarations: "'+i+'"')):n[i]=o||""}function Nt(e,t,a){var i=t.IMPORT;if(a&&i in a){var o=e.variableList;o||(e.variableList=o={}),o[i]=a[i]}else e.playlistParsingError||(e.playlistParsingError=new Error('EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "'+i+'"'))}function mt(e){if(void 0===e&&(e=!0),"undefined"!=typeof self)return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}var Lt={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Dt(e,t){var a=Lt[t];return!!a&&!!a[e.slice(0,4)]}function pt(e,t,a){return void 0===a&&(a=!0),!e.split(",").some((function(e){return!ht(e,t,a)}))}function ht(e,t,a){var i;void 0===a&&(a=!0);var o=mt(a);return null!=(i=null==o?void 0:o.isTypeSupported(Ct(e,t)))&&i}function Ct(e,t){return t+'/mp4;codecs="'+e+'"'}function ft(e){if(e){var t=e.substring(0,4);return Lt.video[t]}return 2}function Pt(e){return e.split(",").reduce((function(e,t){var a=Lt.video[t];return a?(2*a+e)/(e?3:2):(Lt.audio[t]+e)/(e?2:1)}),0)}var Bt={};function gt(e,t){if(void 0===t&&(t=!0),Bt[e])return Bt[e];for(var a={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[e],i=0;i2){var a=t.shift()+".";return a+=parseInt(t.shift()).toString(16),a+=("000"+parseInt(t.shift()).toString(16)).slice(-4)}return e}var bt=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,Ut=/#EXT-X-MEDIA:(.*)/g,Gt=/^#EXT(?:INF|-X-TARGETDURATION):/m,kt=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),Ft=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),Vt=(function(){function e(){}return e.findGroup=function(e,t){for(var a=0;a0&&n.length0&&K.bool("CAN-SKIP-DATERANGES"),s.partHoldBack=K.optionalFloat("PART-HOLD-BACK",0),s.holdBack=K.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var Q=new F(P);s.partTarget=Q.decimalFloatingPoint("PART-TARGET");break;case"PART":var $=s.partList;$||($=s.partList=[]);var q=u>0?$[$.length-1]:void 0,J=u++,Z=new F(P);Ot(s,Z,["BYTERANGE","URI"]);var ee=new x(Z,c,t,J,q);$.push(ee),c.duration+=ee.duration;break;case"PRELOAD-HINT":var te=new F(P);Ot(s,te,["URI"]),s.preloadHint=te;break;case"RENDITION-REPORT":var ae=new F(P);Ot(s,ae,["URI"]),s.renditionReports=s.renditionReports||[],s.renditionReports.push(ae);break;default:U.warn("line parsed but not handled: "+r)}}}O&&!O.relurl?(S.pop(),A-=O.duration,s.partList&&(s.fragmentHint=O)):s.partList&&(jt(c,O),c.cc=d,s.fragmentHint=c,_&&Qt(c,_,s));var ie=S.length,oe=S[0],ne=S[ie-1];if((A+=s.skippedSegments*s.targetduration)>0&&ie&&ne){s.averagetargetduration=A/ie;var re=ne.sn;s.endSN="initSegment"!==re?re:0,s.live||(ne.endList=!0),oe&&(s.startCC=oe.cc)}else s.endSN=0,s.startCC=0;return s.fragmentHint&&(A+=s.fragmentHint.duration),s.totalduration=A,s.endCC=d,R>0&&Kt(S,R),s},e})();function Ht(e,t,a){var i,o,n=new F(e);Ot(a,n,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);var r=null!=(i=n.METHOD)?i:"",E=n.URI,_=n.hexadecimalInteger("IV"),T=n.KEYFORMATVERSIONS,s=null!=(o=n.KEYFORMAT)?o:"identity";E&&n.IV&&!_&&U.error("Invalid IV: "+n.IV);var S=E?Vt.resolve(E,t):"",l=(T||"1").split("/").map(Number).filter(Number.isFinite);return new It(r,S,s,l,_)}function wt(e){var t=new F(e).decimalFloatingPoint("TIME-OFFSET");return p(t)?t:null}function Yt(e,t){var a=(e||"").split(/[ ,]+/).filter((function(e){return e}));["video","audio","text"].forEach((function(e){var i=a.filter((function(t){return Dt(t,e)}));i.length&&(t[e+"Codec"]=i.join(","),a=a.filter((function(e){return-1===i.indexOf(e)})))})),t.unknownCodecs=a}function zt(e,t,a){var i=t[a];i&&(e[a]=i)}function Kt(e,t){for(var a=e[t],i=t;i--;){var o=e[i];if(!o)return;o.programDateTime=a.programDateTime-1e3*o.duration,a=o}}function jt(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime),p(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}function xt(e,t,a,i){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=a,e.sn="initSegment",i&&(e.levelkeys=i),e.initSegment=null}function Qt(e,t,a){e.levelkeys=t;var i=a.encryptedFragments;i.length&&i[i.length-1].levelkeys===t||!Object.keys(t).some((function(e){return t[e].isCommonEncryption}))||i.push(e)}var Xt={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},$t={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function qt(e){switch(e.type){case Xt.AUDIO_TRACK:return $t.AUDIO;case Xt.SUBTITLE_TRACK:return $t.SUBTITLE;default:return $t.MAIN}}function Jt(e,t){var a=e.url;return void 0!==a&&0!==a.indexOf("data:")||(a=t.url),a}var Zt=(function(){function e(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}var t=e.prototype;return t.startLoad=function(e){},t.stopLoad=function(){this.destroyInternalLoaders()},t.registerListeners=function(){var e=this.hls;e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.LEVEL_LOADING,this.onLevelLoading,this),e.on(f.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(f.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},t.unregisterListeners=function(){var e=this.hls;e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.LEVEL_LOADING,this.onLevelLoading,this),e.off(f.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(f.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},t.createInternalLoader=function(e){var t=this.hls.config,a=t.pLoader,i=t.loader,o=new(a||i)(t);return this.loaders[e.type]=o,o},t.getInternalLoader=function(e){return this.loaders[e.type]},t.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},t.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},t.destroy=function(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()},t.onManifestLoading=function(e,t){var a=t.url;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Xt.MANIFEST,url:a,deliveryDirectives:null})},t.onLevelLoading=function(e,t){var a=t.id,i=t.level,o=t.pathwayId,n=t.url,r=t.deliveryDirectives;this.load({id:a,level:i,pathwayId:o,responseType:"text",type:Xt.LEVEL,url:n,deliveryDirectives:r})},t.onAudioTrackLoading=function(e,t){var a=t.id,i=t.groupId,o=t.url,n=t.deliveryDirectives;this.load({id:a,groupId:i,level:null,responseType:"text",type:Xt.AUDIO_TRACK,url:o,deliveryDirectives:n})},t.onSubtitleTrackLoading=function(e,t){var a=t.id,i=t.groupId,o=t.url,n=t.deliveryDirectives;this.load({id:a,groupId:i,level:null,responseType:"text",type:Xt.SUBTITLE_TRACK,url:o,deliveryDirectives:n})},t.load=function(e){var t,a,i,o=this,n=this.hls.config,r=this.getInternalLoader(e);if(r){var E=r.context;if(E&&E.url===e.url&&E.level===e.level)return void U.trace("[playlist-loader]: playlist request ongoing");U.log("[playlist-loader]: aborting previous loader for type: "+e.type),r.abort()}if(a=e.type===Xt.MANIFEST?n.manifestLoadPolicy.default:T({},n.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),p(null==(t=e.deliveryDirectives)?void 0:t.part)&&(e.type===Xt.LEVEL&&null!==e.level?i=this.hls.levels[e.level].details:e.type===Xt.AUDIO_TRACK&&null!==e.id?i=this.hls.audioTracks[e.id].details:e.type===Xt.SUBTITLE_TRACK&&null!==e.id&&(i=this.hls.subtitleTracks[e.id].details),i)){var _=i.partTarget,s=i.targetduration;if(_&&s){var S=1e3*Math.max(3*_,.8*s);a=T({},a,{maxTimeToFirstByteMs:Math.min(S,a.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(S,a.maxTimeToFirstByteMs)})}}var l=a.errorRetry||a.timeoutRetry||{},I={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:l.maxNumRetry||0,retryDelay:l.retryDelayMs||0,maxRetryDelay:l.maxRetryDelayMs||0},u={onSuccess:function(e,t,a,i){var n=o.getInternalLoader(a);o.resetInternalLoader(a.type);var r=e.data;0===r.indexOf("#EXTM3U")?(t.parsing.start=performance.now(),Vt.isMediaPlaylist(r)?o.handleTrackOrLevelPlaylist(e,t,a,i||null,n):o.handleMasterPlaylist(e,t,a,i)):o.handleManifestParsingError(e,a,new Error("no EXTM3U delimiter"),i||null,t)},onError:function(e,t,a,i){o.handleNetworkError(t,a,!1,e,i)},onTimeout:function(e,t,a){o.handleNetworkError(t,a,!0,void 0,e)}};r.load(e,I,u)},t.handleMasterPlaylist=function(e,t,a,i){var o=this.hls,n=e.data,r=Jt(e,a),E=Vt.parseMasterPlaylist(n,r);if(E.playlistParsingError)this.handleManifestParsingError(e,a,E.playlistParsingError,i,t);else{var _=E.contentSteering,T=E.levels,s=E.sessionData,S=E.sessionKeys,l=E.startTimeOffset,I=E.variableList;this.variableList=I;var u=Vt.parseMasterPlaylistMedia(n,r,E),A=u.AUDIO,d=void 0===A?[]:A,O=u.SUBTITLES,c=u["CLOSED-CAPTIONS"];d.length&&(d.some((function(e){return!e.url}))||!T[0].audioCodec||T[0].attrs.AUDIO||(U.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),d.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new F({}),bitrate:0,url:""}))),o.trigger(f.MANIFEST_LOADED,{levels:T,audioTracks:d,subtitles:O,captions:c,contentSteering:_,url:r,stats:t,networkDetails:i,sessionData:s,sessionKeys:S,startTimeOffset:l,variableList:I})}},t.handleTrackOrLevelPlaylist=function(e,t,a,i,o){var n=this.hls,r=a.id,E=a.level,_=a.type,T=Jt(e,a),s=0,S=p(E)?E:p(r)?r:0,l=qt(a),I=Vt.parseLevelPlaylist(e.data,T,S,l,s,this.variableList);if(_===Xt.MANIFEST){var u={attrs:new F({}),bitrate:0,details:I,name:"",url:T};n.trigger(f.MANIFEST_LOADED,{levels:[u],audioTracks:[],url:T,stats:t,networkDetails:i,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),a.levelDetails=I,this.handlePlaylistLoaded(I,e,t,a,i,o)},t.handleManifestParsingError=function(e,t,a,i,o){this.hls.trigger(f.ERROR,{type:P.NETWORK_ERROR,details:B.MANIFEST_PARSING_ERROR,fatal:t.type===Xt.MANIFEST,url:e.url,err:a,error:a,reason:a.message,response:e,context:t,networkDetails:i,stats:o})},t.handleNetworkError=function(e,t,a,o,n){void 0===a&&(a=!1);var r="A network "+(a?"timeout":"error"+(o?" (status "+o.code+")":""))+" occurred while loading "+e.type;e.type===Xt.LEVEL?r+=": "+e.level+" id: "+e.id:e.type!==Xt.AUDIO_TRACK&&e.type!==Xt.SUBTITLE_TRACK||(r+=" id: "+e.id+' group-id: "'+e.groupId+'"');var E=new Error(r);U.warn("[playlist-loader]: "+r);var _=B.UNKNOWN,T=!1,s=this.getInternalLoader(e);switch(e.type){case Xt.MANIFEST:_=a?B.MANIFEST_LOAD_TIMEOUT:B.MANIFEST_LOAD_ERROR,T=!0;break;case Xt.LEVEL:_=a?B.LEVEL_LOAD_TIMEOUT:B.LEVEL_LOAD_ERROR,T=!1;break;case Xt.AUDIO_TRACK:_=a?B.AUDIO_TRACK_LOAD_TIMEOUT:B.AUDIO_TRACK_LOAD_ERROR,T=!1;break;case Xt.SUBTITLE_TRACK:_=a?B.SUBTITLE_TRACK_LOAD_TIMEOUT:B.SUBTITLE_LOAD_ERROR,T=!1}s&&this.resetInternalLoader(e.type);var S={type:P.NETWORK_ERROR,details:_,fatal:T,url:e.url,loader:s,context:e,error:E,networkDetails:t,stats:n};if(o){var l=(null==t?void 0:t.url)||e.url;S.response=i({url:l,data:void 0},o)}this.hls.trigger(f.ERROR,S)},t.handlePlaylistLoaded=function(e,t,a,i,o,n){var r=this.hls,E=i.type,_=i.level,T=i.id,s=i.groupId,S=i.deliveryDirectives,l=Jt(t,i),I=qt(i),u="number"==typeof i.level&&I===$t.MAIN?_:void 0;if(e.fragments.length){e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));var A=e.playlistParsingError;if(A)r.trigger(f.ERROR,{type:P.NETWORK_ERROR,details:B.LEVEL_PARSING_ERROR,fatal:!1,url:l,error:A,reason:A.message,response:t,context:i,level:u,parent:I,networkDetails:o,stats:a});else switch(e.live&&n&&(n.getCacheAge&&(e.ageHeader=n.getCacheAge()||0),n.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),E){case Xt.MANIFEST:case Xt.LEVEL:r.trigger(f.LEVEL_LOADED,{details:e,level:u||0,id:T||0,stats:a,networkDetails:o,deliveryDirectives:S});break;case Xt.AUDIO_TRACK:r.trigger(f.AUDIO_TRACK_LOADED,{details:e,id:T||0,groupId:s||"",stats:a,networkDetails:o,deliveryDirectives:S});break;case Xt.SUBTITLE_TRACK:r.trigger(f.SUBTITLE_TRACK_LOADED,{details:e,id:T||0,groupId:s||"",stats:a,networkDetails:o,deliveryDirectives:S})}}else{var d=new Error("No Segments found in Playlist");r.trigger(f.ERROR,{type:P.NETWORK_ERROR,details:B.LEVEL_EMPTY_ERROR,fatal:!1,url:l,error:d,reason:d.message,response:t,context:i,level:u,parent:I,networkDetails:o,stats:a})}},e})();function ea(e,t){var a;try{a=new Event("addtrack")}catch(e){(a=document.createEvent("Event")).initEvent("addtrack",!1,!1)}a.track=e,t.dispatchEvent(a)}function ta(e,t){var a=e.mode;if("disabled"===a&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error("addCue is failed for: "+t)}catch(a){U.debug("[texttrack-utils]: "+a);try{var i=new self.TextTrackCue(t.startTime,t.endTime,t.text);i.id=t.id,e.addCue(i)}catch(e){U.debug("[texttrack-utils]: Legacy TextTrackCue fallback failed: "+e)}}"disabled"===a&&(e.mode=a)}function aa(e){var t=e.mode;if("disabled"===t&&(e.mode="hidden"),e.cues)for(var a=e.cues.length;a--;)e.removeCue(e.cues[a]);"disabled"===t&&(e.mode=t)}function ia(e,t,a,i){var o=e.mode;if("disabled"===o&&(e.mode="hidden"),e.cues&&e.cues.length>0)for(var n=na(e.cues,t,a),r=0;re[a].endTime)return-1;for(var i=0,o=a;i<=o;){var n=Math.floor((o+i)/2);if(te[n].startTime&&i-1)for(var n=o,r=e.length;n=t&&E.endTime<=a)i.push(E);else if(E.startTime>a)return i}return i}function ra(e){for(var t=[],a=0;aSa&&(S=Sa),S-s<=0&&(S=s+_a);for(var l=0;lt.startDate&&(!e||t.startDate.05&&this.forwardBufferLength>1){var _=Math.min(2,Math.max(1,n)),T=Math.round(2/(1+Math.exp(-.75*E-this.edgeStalled))*20)/20;e.playbackRate=Math.min(_,Math.max(1,T))}else 1!==e.playbackRate&&0!==e.playbackRate&&(e.playbackRate=1)}}}}},t.estimateLiveEdge=function(){var e=this.levelDetails;return null===e?null:e.edge+e.age},t.computeLatency=function(){var e=this.estimateLiveEdge();return null===e?null:e-this.currentTime},E(e,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var e=this.config,t=this.levelDetails;return void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}},{key:"targetLatency",get:function(){var e=this.levelDetails;if(null===e)return null;var t=e.holdBack,a=e.partHoldBack,i=e.targetduration,o=this.config,n=o.liveSyncDuration,r=o.liveSyncDurationCount,E=o.lowLatencyMode,_=this.hls.userConfig,T=E&&a||t;(_.liveSyncDuration||_.liveSyncDurationCount||0===T)&&(T=void 0!==n?n:r*i);var s=i,S=1;return T+Math.min(this.stallCount*S,s)}},{key:"liveSyncPosition",get:function(){var e=this.estimateLiveEdge(),t=this.targetLatency,a=this.levelDetails;if(null===e||null===t||null===a)return null;var i=a.edge,o=e-t-this.edgeStalled,n=i-a.totalduration,r=i-(this.config.lowLatencyMode&&a.partTarget||a.targetduration);return Math.min(Math.max(n,o),r)}},{key:"drift",get:function(){var e=this.levelDetails;return null===e?1:e.drift}},{key:"edgeStalled",get:function(){var e=this.levelDetails;if(null===e)return 0;var t=3*(this.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}},{key:"forwardBufferLength",get:function(){var e=this.media,t=this.levelDetails;if(!e||!t)return 0;var a=e.buffered.length;return(a?e.buffered.end(a-1):t.edge)-this.currentTime}}]),e})(),da=["NONE","TYPE-0","TYPE-1",null];function Oa(e){return da.indexOf(e)>-1}var ca=["SDR","PQ","HLG"];function Ra(e){return!!e&&ca.indexOf(e)>-1}var Na={No:"",Yes:"YES",v2:"v2"};function ma(e,t){var a=e.canSkipUntil,i=e.canSkipDateRanges,o=e.endSN;return a&&(void 0!==t?t-o:0)e.sn?(o=a-e.start,i=e):(o=e.start-a,i=t),i.duration!==o&&(i.duration=o)}else t.sn>e.sn?e.cc===t.cc&&e.minEndPTS?t.start=e.start+(e.minEndPTS-e.start):t.start=e.start+e.duration:t.start=Math.max(e.start-t.duration,0)}function Ca(e,t,a,i,o,n){i-a<=0&&(U.warn("Fragment should have a positive duration",t),i=a+t.duration,n=o+t.duration);var r=a,E=i,_=t.startPTS,T=t.endPTS;if(p(_)){var s=Math.abs(_-a);p(t.deltaPTS)?t.deltaPTS=Math.max(s,t.deltaPTS):t.deltaPTS=s,r=Math.max(a,_),a=Math.min(a,_),o=Math.min(o,t.startDTS),E=Math.min(i,T),i=Math.max(i,T),n=Math.max(n,t.endDTS)}var S=a-t.start;0!==t.start&&(t.start=a),t.duration=i-t.start,t.startPTS=a,t.maxStartPTS=r,t.startDTS=o,t.endPTS=i,t.minEndPTS=E,t.endDTS=n;var l,I=t.sn;if(!e||Ie.endSN)return 0;var u=I-e.startSN,A=e.fragments;for(A[u]=t,l=u;l>0;l--)ha(A[l],A[l-1]);for(l=u;l=0;o--){var n=i[o].initSegment;if(n){a=n;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;var r,E=0;if(ga(e,t,(function(e,i){e.relurl&&(E=e.cc-i.cc),p(e.startPTS)&&p(e.endPTS)&&(i.start=i.startPTS=e.startPTS,i.startDTS=e.startDTS,i.maxStartPTS=e.maxStartPTS,i.endPTS=e.endPTS,i.endDTS=e.endDTS,i.minEndPTS=e.minEndPTS,i.duration=e.endPTS-e.startPTS,i.duration&&(r=i),t.PTSKnown=t.alignedSliding=!0),i.elementaryStreams=e.elementaryStreams,i.loader=e.loader,i.stats=e.stats,e.initSegment&&(i.initSegment=e.initSegment,a=e.initSegment)})),a&&(t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments).forEach((function(e){var t;!e||e.initSegment&&e.initSegment.relurl!==(null==(t=a)?void 0:t.relurl)||(e.initSegment=a)})),t.skippedSegments)if(t.deltaUpdateFailed=t.fragments.some((function(e){return!e})),t.deltaUpdateFailed){U.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var _=t.skippedSegments;_--;)t.fragments.shift();t.startSN=t.fragments[0].sn,t.startCC=t.fragments[0].cc}else t.canSkipDateRanges&&(t.dateRanges=Pa(e.dateRanges,t.dateRanges,t.recentlyRemovedDateranges));var T=t.fragments;if(E){U.warn("discontinuity sliding from playlist, take drift into account");for(var s=0;s=i.length||Ma(t,i[a].start)}function Ma(e,t){if(t){for(var a=e.fragments,i=e.skippedSegments;it){var n=1e3*i[i.length-1].duration;n499)}var za={search:function(e,t){for(var a=0,i=e.length-1,o=null,n=null;a<=i;){var r=t(n=e[o=(a+i)/2|0]);if(r>0)a=o+1;else{if(!(r<0))return n;i=o-1}}return null}};function Ka(e,t,a){if(null===t||!Array.isArray(e)||!e.length||!p(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;a=a||0;for(var i=0;i0&&n<15e-7&&(a+=15e-7)}else 0===a&&0===t[0].start&&(o=t[0]);if(o&&(!e||e.level===o.level)&&0===xa(a,i,o))return o;var r=za.search(t,xa.bind(null,a,i));return!r||r===e&&o?o:r}function xa(e,t,a){if(void 0===e&&(e=0),void 0===t&&(t=0),a.start<=e&&a.start+a.duration>e)return 0;var i=Math.min(t,a.duration+(a.deltaPTS?a.deltaPTS:0));return a.start+a.duration-i<=e?1:a.start-i>e&&a.start?-1:0}function Qa(e,t,a){var i=1e3*Math.min(t,a.duration+(a.deltaPTS?a.deltaPTS:0));return(a.endProgramDateTime||0)-i>e}function Xa(e,t){return za.search(e,(function(e){return e.cct?-1:0}))}var $a={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},qa={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4},Ja=(function(){function e(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=U.log.bind(U,"[info]:"),this.warn=U.warn.bind(U,"[warning]:"),this.error=U.error.bind(U,"[error]:"),this.registerListeners()}var t=e.prototype;return t.registerListeners=function(){var e=this.hls;e.on(f.ERROR,this.onError,this),e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.LEVEL_UPDATED,this.onLevelUpdated,this)},t.unregisterListeners=function(){var e=this.hls;e&&(e.off(f.ERROR,this.onError,this),e.off(f.ERROR,this.onErrorOut,this),e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.LEVEL_UPDATED,this.onLevelUpdated,this))},t.destroy=function(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}},t.startLoad=function(e){},t.stopLoad=function(){this.playlistError=0},t.getVariantLevelIndex=function(e){return(null==e?void 0:e.type)===$t.MAIN?e.level:this.hls.loadLevel},t.onManifestLoading=function(){this.playlistError=0,this.penalizedRenditions={}},t.onLevelUpdated=function(){this.playlistError=0},t.onError=function(e,t){var a,i;if(!t.fatal){var o=this.hls,n=t.context;switch(t.details){case B.FRAG_LOAD_ERROR:case B.FRAG_LOAD_TIMEOUT:case B.KEY_LOAD_ERROR:case B.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case B.FRAG_PARSING_ERROR:if(null!=(a=t.frag)&&a.gap)return void(t.errorAction={action:$a.DoNothing,flags:qa.None});case B.FRAG_GAP:case B.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=$a.SendAlternateToPenaltyBox);case B.LEVEL_EMPTY_ERROR:case B.LEVEL_PARSING_ERROR:var r,E,_=t.parent===$t.MAIN?t.level:o.loadLevel;return void(t.details===B.LEVEL_EMPTY_ERROR&&null!=(r=t.context)&&null!=(E=r.levelDetails)&&E.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,_):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,_)));case B.LEVEL_LOAD_ERROR:case B.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==n?void 0:n.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.level)));case B.AUDIO_TRACK_LOAD_ERROR:case B.AUDIO_TRACK_LOAD_TIMEOUT:case B.SUBTITLE_LOAD_ERROR:case B.SUBTITLE_TRACK_LOAD_TIMEOUT:if(n){var T=o.levels[o.loadLevel];if(T&&(n.type===Xt.AUDIO_TRACK&&T.hasAudioGroup(n.groupId)||n.type===Xt.SUBTITLE_TRACK&&T.hasSubtitleGroup(n.groupId)))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.loadLevel),t.errorAction.action=$a.SendAlternateToPenaltyBox,void(t.errorAction.flags=qa.MoveAllAlternatesMatchingHost)}return;case B.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:var s=o.levels[o.loadLevel],S=null==s?void 0:s.attrs["HDCP-LEVEL"];return void(S?t.errorAction={action:$a.SendAlternateToPenaltyBox,flags:qa.MoveAllAlternatesMatchingHDCP,hdcpLevel:S}:this.keySystemError(t));case B.BUFFER_ADD_CODEC_ERROR:case B.REMUX_ALLOC_ERROR:case B.BUFFER_APPEND_ERROR:return void(t.errorAction=this.getLevelSwitchAction(t,null!=(i=t.level)?i:o.loadLevel));case B.INTERNAL_EXCEPTION:case B.BUFFER_APPENDING_ERROR:case B.BUFFER_FULL_ERROR:case B.LEVEL_SWITCH_ERROR:case B.BUFFER_STALLED_ERROR:case B.BUFFER_SEEK_OVER_HOLE:case B.BUFFER_NUDGE_ON_STALL:return void(t.errorAction={action:$a.DoNothing,flags:qa.None})}t.type===P.KEY_SYSTEM_ERROR&&this.keySystemError(t)}},t.keySystemError=function(e){var t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)},t.getPlaylistRetryOrSwitchAction=function(e,t){var a=Fa(this.hls.config.playlistLoadPolicy,e),i=this.playlistError++;if(wa(a,i,ka(e),e.response))return{action:$a.RetryRequest,flags:qa.None,retryConfig:a,retryCount:i};var o=this.getLevelSwitchAction(e,t);return a&&(o.retryConfig=a,o.retryCount=i),o},t.getFragRetryOrSwitchAction=function(e){var t=this.hls,a=this.getVariantLevelIndex(e.frag),i=t.levels[a],o=t.config,n=o.fragLoadPolicy,r=o.keyLoadPolicy,E=Fa(e.details.startsWith("key")?r:n,e),_=t.levels.reduce((function(e,t){return e+t.fragmentError}),0);if(i&&(e.details!==B.FRAG_GAP&&i.fragmentError++,wa(E,_,ka(e),e.response)))return{action:$a.RetryRequest,flags:qa.None,retryConfig:E,retryCount:_};var T=this.getLevelSwitchAction(e,a);return E&&(T.retryConfig=E,T.retryCount=_),T},t.getLevelSwitchAction=function(e,t){var a=this.hls;null==t&&(t=a.loadLevel);var i=this.hls.levels[t];if(i){var o,n,r=e.details;i.loadError++,r===B.BUFFER_APPEND_ERROR&&i.fragmentError++;var E=-1,_=a.levels,T=a.loadLevel,s=a.minAutoLevel,S=a.maxAutoLevel;a.autoLevelEnabled||(a.loadLevel=-1);for(var l,I=null==(o=e.frag)?void 0:o.type,u=(I===$t.AUDIO&&r===B.FRAG_PARSING_ERROR||"audio"===e.sourceBufferName&&(r===B.BUFFER_ADD_CODEC_ERROR||r===B.BUFFER_APPEND_ERROR))&&_.some((function(e){var t=e.audioCodec;return i.audioCodec!==t})),A="video"===e.sourceBufferName&&(r===B.BUFFER_ADD_CODEC_ERROR||r===B.BUFFER_APPEND_ERROR)&&_.some((function(e){var t=e.codecSet,a=e.audioCodec;return i.codecSet!==t&&i.audioCodec===a})),d=null!=(n=e.context)?n:{},O=d.type,c=d.groupId,R=function(){var t=(N+T)%_.length;if(t!==T&&t>=s&&t<=S&&0===_[t].loadError){var a,o,n=_[t];if(r===B.FRAG_GAP&&e.frag){var l=_[t].details;if(l){var d=ja(e.frag,l.fragments,e.frag.start);if(null!=d&&d.gap)return 0}}else{if(O===Xt.AUDIO_TRACK&&n.hasAudioGroup(c)||O===Xt.SUBTITLE_TRACK&&n.hasSubtitleGroup(c))return 0;if(I===$t.AUDIO&&null!=(a=i.audioGroups)&&a.some((function(e){return n.hasAudioGroup(e)}))||I===$t.SUBTITLE&&null!=(o=i.subtitleGroups)&&o.some((function(e){return n.hasSubtitleGroup(e)}))||u&&i.audioCodec===n.audioCodec||!u&&i.audioCodec!==n.audioCodec||A&&i.codecSet===n.codecSet)return 0}return E=t,1}},N=_.length;N--&&(0===(l=R())||1!==l););if(E>-1&&a.loadLevel!==E)return e.levelRetry=!0,this.playlistError=0,{action:$a.SendAlternateToPenaltyBox,flags:qa.None,nextAutoLevel:E}}return{action:$a.SendAlternateToPenaltyBox,flags:qa.MoveAllAlternatesMatchingHost}},t.onErrorOut=function(e,t){var a;switch(null==(a=t.errorAction)?void 0:a.action){case $a.DoNothing:break;case $a.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===B.FRAG_GAP?/MediaSource readyState: ended/.test(t.error.message)&&(this.warn('MediaSource ended after "'+t.sourceBufferName+'" sourceBuffer append error. Attempting to recover from media error.'),this.hls.recoverMediaError()):t.fatal=!0}t.fatal&&this.hls.stopLoad()},t.sendAlternateToPenaltyBox=function(e){var t=this.hls,a=e.errorAction;if(a){var i=a.flags,o=a.hdcpLevel,n=a.nextAutoLevel;switch(i){case qa.None:this.switchLevel(e,n);break;case qa.MoveAllAlternatesMatchingHDCP:o&&(t.maxHdcpLevel=da[da.indexOf(o)-1],a.resolved=!0),this.warn('Restricting playback to HDCP-LEVEL of "'+t.maxHdcpLevel+'" or lower')}a.resolved||this.switchLevel(e,n)}},t.switchLevel=function(e,t){void 0!==t&&e.errorAction&&(this.warn("switching to level "+t+" after "+e.details),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)},e})(),Za=(function(){function e(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=U.log.bind(U,t+":"),this.warn=U.warn.bind(U,t+":"),this.hls=e}var t=e.prototype;return t.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},t.clearTimer=function(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)},t.startLoad=function(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()},t.stopLoad=function(){this.canLoad=!1,this.clearTimer()},t.switchParams=function(e,t){var a=null==t?void 0:t.renditionReports;if(a){for(var i=-1,o=0;o=0&&s>t.partTarget&&(T+=1)}return new La(_,T>=0?T:void 0,Na.No)}}},t.loadPlaylist=function(e){-1===this.requestScheduled&&(this.requestScheduled=self.performance.now())},t.shouldLoadPlaylist=function(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)},t.shouldReloadPlaylist=function(e){return-1===this.timer&&-1===this.requestScheduled&&this.shouldLoadPlaylist(e)},t.playlistLoaded=function(e,t,a){var i=this,o=t.details,n=t.stats,r=self.performance.now(),E=n.loading.first?Math.max(0,r-n.loading.first):0;if(o.advancedDateTime=Date.now()-E,o.live||null!=a&&a.live){if(o.reloaded(a),a&&this.log("live playlist "+e+" "+(o.advanced?"REFRESHED "+o.lastPartSn+"-"+o.lastPartIndex:o.updated?"UPDATED":"MISSED")),a&&o.fragments.length>0&&fa(a,o),!this.canLoad||!o.live)return;var _,T=void 0,s=void 0;if(o.canBlockReload&&o.endSN&&o.advanced){var S=this.hls.config.lowLatencyMode,l=o.lastPartSn,I=o.endSN,u=o.lastPartIndex,A=l===I;-1!==u?(T=A?I+1:l,s=A?S?0:u:u+1):T=I+1;var d=o.age,O=d+o.ageHeader,c=Math.min(O-o.partTarget,1.5*o.targetduration);if(c>0){if(a&&c>a.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+a.tuneInGoal+" to: "+c+" with playlist age: "+o.age),c=0;else{var R=Math.floor(c/o.targetduration);T+=R,void 0!==s&&(s+=Math.round(c%o.targetduration/o.partTarget)),this.log("CDN Tune-in age: "+o.ageHeader+"s last advanced "+d.toFixed(2)+"s goal: "+c+" skip sn "+R+" to part "+s)}o.tuneInGoal=c}if(_=this.getDeliveryDirectives(o,t.deliveryDirectives,T,s),S||!A)return void this.loadPlaylist(_)}else(o.canBlockReload||o.canSkipUntil)&&(_=this.getDeliveryDirectives(o,t.deliveryDirectives,T,s));var N=this.hls.mainForwardBufferInfo,m=N?N.end-N.len:0,L=Wa(o,1e3*(o.edge-m));o.updated&&r>this.requestScheduled+L&&(this.requestScheduled=n.loading.start),void 0!==T&&o.canBlockReload?this.requestScheduled=n.loading.first+L-(1e3*o.partTarget||1e3):-1===this.requestScheduled||this.requestScheduled+L=T.maxNumRetry)return!1;if(i&&null!=(S=e.context)&&S.deliveryDirectives)this.warn("Retrying playlist loading "+(_+1)+"/"+T.maxNumRetry+' after "'+a+'" without delivery-directives'),this.loadPlaylist();else{var l=Va(T,_);this.timer=self.setTimeout((function(){return t.loadPlaylist()}),l),this.warn("Retrying playlist loading "+(_+1)+"/"+T.maxNumRetry+' after "'+a+'" in '+l+"ms")}e.levelRetry=!0,o.resolved=!0}return s},e})(),ei=(function(){function e(e,t,a){void 0===t&&(t=0),void 0===a&&(a=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=a}var t=e.prototype;return t.sample=function(e,t){var a=Math.pow(this.alpha_,e);this.estimate_=t*(1-a)+a*this.estimate_,this.totalWeight_+=e},t.getTotalWeight=function(){return this.totalWeight_},t.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_},e})(),ti=(function(){function e(e,t,a,i){void 0===i&&(i=100),this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=a,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new ei(e),this.fast_=new ei(t),this.defaultTTFB_=i,this.ttfb_=new ei(e)}var t=e.prototype;return t.update=function(e,t){var a=this.slow_,i=this.fast_,o=this.ttfb_;a.halfLife!==e&&(this.slow_=new ei(e,a.getEstimate(),a.getTotalWeight())),i.halfLife!==t&&(this.fast_=new ei(t,i.getEstimate(),i.getTotalWeight())),o.halfLife!==e&&(this.ttfb_=new ei(e,o.getEstimate(),o.getTotalWeight()))},t.sample=function(e,t){var a=(e=Math.max(e,this.minDelayMs_))/1e3,i=8*t/a;this.fast_.sample(a,i),this.slow_.sample(a,i)},t.sampleTTFB=function(e){var t=e/1e3,a=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(a,Math.max(e,5))},t.canEstimate=function(){return this.fast_.getTotalWeight()>=this.minWeight_},t.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},t.getEstimateTTFB=function(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_},t.destroy=function(){},e})(),ai={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},ii={};function oi(e,t,a,i,o,n){var r=e.audioCodec?e.audioGroups:null,E=null==n?void 0:n.audioCodec,_=null==n?void 0:n.channels,T=_?parseInt(_):E?1/0:2,s=null;if(null!=r&&r.length)try{s=1===r.length&&r[0]?t.groups[r[0]].channels:r.reduce((function(e,a){if(a){var i=t.groups[a];if(!i)throw new Error("Audio track group "+a+" not found");Object.keys(i.channels).forEach((function(t){e[t]=(e[t]||0)+i.channels[t]}))}return e}),{2:0})}catch(e){return!0}return void 0!==e.videoCodec&&(e.width>1920&&e.height>1088||e.height>1920&&e.width>1088||e.frameRate>Math.max(i,30)||"SDR"!==e.videoRange&&e.videoRange!==a||e.bitrate>Math.max(o,8e6))||!!s&&p(T)&&Object.keys(s).some((function(e){return parseInt(e)>T}))}function ni(e,t,a){var o=e.videoCodec,n=e.audioCodec;if(!o||!n||!a)return Promise.resolve(ai);var r={width:e.width,height:e.height,bitrate:Math.ceil(Math.max(.9*e.bitrate,e.averageBitrate)),framerate:e.frameRate||30},E=e.videoRange;"SDR"!==E&&(r.transferFunction=E.toLowerCase());var _=o.split(",").map((function(e){return{type:"media-source",video:i(i({},r),{},{contentType:Ct(e,"video")})}}));return n&&e.audioGroups&&e.audioGroups.forEach((function(e){var a;e&&(null==(a=t.groups[e])||a.tracks.forEach((function(t){if(t.groupId===e){var a=t.channels||"",i=parseFloat(a);p(i)&&i>2&&_.push.apply(_,n.split(",").map((function(e){return{type:"media-source",audio:{contentType:Ct(e,"audio"),channels:""+i}}})))}})))})),Promise.all(_.map((function(e){var t=ri(e);return ii[t]||(ii[t]=a.decodingInfo(e))}))).then((function(e){return{supported:!e.some((function(e){return!e.supported})),configurations:_,decodingInfoResults:e}})).catch((function(e){return{supported:!1,configurations:_,decodingInfoResults:[],error:e}}))}function ri(e){var t=e.audio,a=e.video,i=a||t;if(i){var o=i.contentType.split('"')[1];if(a)return"r"+a.height+"x"+a.width+"f"+Math.ceil(a.framerate)+(a.transferFunction||"sd")+"_"+o+"_"+Math.ceil(a.bitrate/1e5);if(t)return"c"+t.channels+(t.spatialRendering?"s":"n")+"_"+o}return""}function Ei(){if("function"==typeof matchMedia){var e=matchMedia("(dynamic-range: high)"),t=matchMedia("bad query");if(e.media!==t.media)return!0===e.matches}return!1}function _i(e,t){var a=!1,i=[];return e&&(a="SDR"!==e,i=[e]),t&&(i=t.allowedVideoRanges||ca.slice(0),i=(a=void 0!==t.preferHDR?t.preferHDR:Ei())?i.filter((function(e){return"SDR"!==e})):["SDR"]),{preferHDR:a,allowedVideoRanges:i}}function Ti(e,t,a,i,o){for(var n=Object.keys(e),r=null==i?void 0:i.channels,E=null==i?void 0:i.audioCodec,_=r&&2===parseInt(r),T=!0,s=!1,S=1/0,l=1/0,I=1/0,u=0,A=[],d=_i(t,o),O=d.preferHDR,c=d.allowedVideoRanges,R=function(){var t=e[n[N]];T=t.channels[2]>0,S=Math.min(S,t.minHeight),l=Math.min(l,t.minFramerate),I=Math.min(I,t.minBitrate);var a=c.filter((function(e){return t.videoRanges[e]>0}));a.length>0&&(s=!0,A=a)},N=n.length;N--;)R();S=p(S)?S:0,l=p(l)?l:0;var m=Math.max(1080,S),L=Math.max(30,l);return I=p(I)?I:a,a=Math.max(I,a),s||(t=void 0,A=[]),{codecSet:n.reduce((function(t,i){var o=e[i];if(i===t)return t;if(o.minBitrate>a)return si(i,"min bitrate of "+o.minBitrate+" > current estimate of "+a),t;if(!o.hasDefaultAudio)return si(i,"no renditions with default or auto-select sound found"),t;if(E&&i.indexOf(E.substring(0,4))%5!=0)return si(i,'audio codec preference "'+E+'" not found'),t;if(r&&!_){if(!o.channels[r])return si(i,"no renditions with "+r+" channel sound found (channels options: "+Object.keys(o.channels)+")"),t}else if((!E||_)&&T&&0===o.channels[2])return si(i,"no renditions with stereo sound found"),t;return o.minHeight>m?(si(i,"min resolution of "+o.minHeight+" > maximum of "+m),t):o.minFramerate>L?(si(i,"min framerate of "+o.minFramerate+" > maximum of "+L),t):A.some((function(e){return o.videoRanges[e]>0}))?o.maxScore=Pt(t)||o.fragmentError>e[t].fragmentError)?t:(u=o.maxScore,i):(si(i,"no variants with VIDEO-RANGE of "+JSON.stringify(A)+" found"),t)}),void 0),videoRanges:A,preferHDR:O,minFramerate:l,minBitrate:I}}function si(e,t){U.log('[abr] start candidates with "'+e+'" ignored because '+t)}function Si(e){return e.reduce((function(e,t){var a=e.groups[t.groupId];a||(a=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),a.tracks.push(t);var i=t.channels||"2";return a.channels[i]=(a.channels[i]||0)+1,a.hasDefault=a.hasDefault||t.default,a.hasAutoSelect=a.hasAutoSelect||t.autoselect,a.hasDefault&&(e.hasDefaultAudio=!0),a.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e}),{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function li(e,t,a,i){return e.slice(a,i+1).reduce((function(e,a){if(!a.codecSet)return e;var i=a.audioGroups,o=e[a.codecSet];o||(e[a.codecSet]=o={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!i,fragmentError:0}),o.minBitrate=Math.min(o.minBitrate,a.bitrate);var n=Math.min(a.height,a.width);return o.minHeight=Math.min(o.minHeight,n),o.minFramerate=Math.min(o.minFramerate,a.frameRate),o.maxScore=Math.max(o.maxScore,a.score),o.fragmentError+=a.fragmentError,o.videoRanges[a.videoRange]=(o.videoRanges[a.videoRange]||0)+1,i&&i.forEach((function(e){if(e){var a=t.groups[e];o.hasDefaultAudio=o.hasDefaultAudio||t.hasDefaultAudio?a.hasDefault:a.hasAutoSelect||!t.hasDefaultAudio&&!t.hasAutoSelectAudio,Object.keys(a.channels).forEach((function(e){o.channels[e]=(o.channels[e]||0)+a.channels[e]}))}})),e}),{})}function Ii(e,t,a){if("attrs"in e){var i=t.indexOf(e);if(-1!==i)return i}for(var o=0;o1&&(i=Math.max.apply(Math,r));var E=n.videoRange,_=n.frameRate,T=n.codecSet.substring(0,4),s=ci(t,i,(function(t){if(t.videoRange!==E||t.frameRate!==_||t.codecSet.substring(0,4)!==T)return!1;var i=t.audioGroups,n=a.filter((function(e){return!i||-1!==i.indexOf(e.groupId)}));return Ii(e,n,o)>-1}));return s>-1?s:ci(t,i,(function(t){var i=t.audioGroups,n=a.filter((function(e){return!i||-1!==i.indexOf(e.groupId)}));return Ii(e,n,o)>-1}))}function ci(e,t,a){for(var i=t;i;i--)if(a(e[i]))return i;for(var o=t+1;o-1,O=t.getBwEstimate(),c=i.levels,R=c[e.level],N=E.total||Math.max(E.loaded,Math.round(_*R.averageBitrate/8)),m=d?T-A:T;m<1&&d&&(m=Math.min(T,8*E.loaded/O));var L=d?1e3*E.loaded/m:0,D=L?(N-E.loaded)/L:8*N/O+l/1e3;if(!(D<=u)){var h,C=L?8*L:O,P=Number.POSITIVE_INFINITY;for(h=e.level-1;h>s;h--){var B=c[h].maxBitrate;if((P=t.getTimeToLoadFrag(l/1e3,C,_*B,!c[h].details))=D||P>10*_)){i.nextLoadLevel=i.nextAutoLevel=h,d?t.bwEstimator.sample(T-Math.min(l,A),E.loaded):t.bwEstimator.sampleTTFB(T);var g=c[h].maxBitrate;t.getBwEstimate()*t.hls.config.abrBandWidthUpFactor>g&&t.resetEstimator(g),t.clearTimer(),U.warn("[abr] Fragment "+e.sn+(a?" part "+a.index:"")+" of level "+e.level+" is loading too slowly;\n Time to underbuffer: "+u.toFixed(3)+" s\n Estimated load time for current fragment: "+D.toFixed(3)+" s\n Estimated load time for down switch fragment: "+P.toFixed(3)+" s\n TTFB estimate: "+(0|A)+" ms\n Current BW estimate: "+(p(O)?0|O:"Unknown")+" bps\n New BW estimate: "+(0|t.getBwEstimate())+" bps\n Switching to level "+h+" @ "+(0|g)+" bps"),i.trigger(f.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:a,stats:E})}}}}}}},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}var t=e.prototype;return t.resetEstimator=function(e){e&&(U.log("setting initial bwe to "+e),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()},t.initEstimator=function(){var e=this.hls.config;return new ti(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)},t.registerListeners=function(){var e=this.hls;e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.FRAG_LOADING,this.onFragLoading,this),e.on(f.FRAG_LOADED,this.onFragLoaded,this),e.on(f.FRAG_BUFFERED,this.onFragBuffered,this),e.on(f.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(f.LEVEL_LOADED,this.onLevelLoaded,this),e.on(f.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(f.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(f.ERROR,this.onError,this)},t.unregisterListeners=function(){var e=this.hls;e&&(e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.FRAG_LOADING,this.onFragLoading,this),e.off(f.FRAG_LOADED,this.onFragLoaded,this),e.off(f.FRAG_BUFFERED,this.onFragBuffered,this),e.off(f.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(f.LEVEL_LOADED,this.onLevelLoaded,this),e.off(f.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(f.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(f.ERROR,this.onError,this))},t.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null},t.onManifestLoading=function(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()},t.onLevelsUpdated=function(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null},t.onMaxAutoLevelUpdated=function(){this.firstSelection=-1,this.nextAutoLevelKey=""},t.onFragLoading=function(e,t){var a,i=t.frag;this.ignoreFragment(i)||(i.bitrateTest||(this.fragCurrent=i,this.partCurrent=null!=(a=t.part)?a:null),this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100))},t.onLevelSwitching=function(e,t){this.clearTimer()},t.onError=function(e,t){if(!t.fatal)switch(t.details){case B.BUFFER_ADD_CODEC_ERROR:case B.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case B.FRAG_LOAD_TIMEOUT:var a=t.frag,i=this.fragCurrent,o=this.partCurrent;if(a&&i&&a.sn===i.sn&&a.level===i.level){var n=performance.now(),r=o?o.stats:a.stats,E=n-r.loading.start,_=r.loading.first?r.loading.first-r.loading.start:-1;if(r.loaded&&_>-1){var T=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(E-Math.min(T,_),r.loaded)}else this.bwEstimator.sampleTTFB(E)}}},t.getTimeToLoadFrag=function(e,t,a,i){return e+a/t+(i?this.lastLevelLoadSec:0)},t.onLevelLoaded=function(e,t){var a=this.hls.config,i=t.stats.loading,o=i.end-i.start;p(o)&&(this.lastLevelLoadSec=o/1e3),t.details.live?this.bwEstimator.update(a.abrEwmaSlowLive,a.abrEwmaFastLive):this.bwEstimator.update(a.abrEwmaSlowVoD,a.abrEwmaFastVoD)},t.onFragLoaded=function(e,t){var a=t.frag,i=t.part,o=i?i.stats:a.stats;if(a.type===$t.MAIN&&this.bwEstimator.sampleTTFB(o.loading.first-o.loading.start),!this.ignoreFragment(a)){if(this.clearTimer(),a.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){var n=i?i.duration:a.duration,r=this.hls.levels[a.level],E=(r.loaded?r.loaded.bytes:0)+o.loaded,_=(r.loaded?r.loaded.duration:0)+n;r.loaded={bytes:E,duration:_},r.realBitrate=Math.round(8*E/_)}if(a.bitrateTest){var T={stats:o,frag:a,part:i,id:a.type};this.onFragBuffered(f.FRAG_BUFFERED,T),a.bitrateTest=!1}else this.lastLoadedFragLevel=a.level}},t.onFragBuffered=function(e,t){var a=t.frag,i=t.part,o=null!=i&&i.stats.loaded?i.stats:a.stats;if(!o.aborted&&!this.ignoreFragment(a)){var n=o.parsing.end-o.loading.start-Math.min(o.loading.first-o.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(n,o.loaded),o.bwEstimate=this.getBwEstimate(),a.bitrateTest?this.bitrateTestDelay=n/1e3:this.bitrateTestDelay=0}},t.ignoreFragment=function(e){return e.type!==$t.MAIN||"initSegment"===e.sn},t.clearTimer=function(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)},t.getAutoLevelKey=function(){var e;return this.getBwEstimate()+"_"+(null==(e=this.hls.mainForwardBufferInfo)?void 0:e.len)},t.getNextABRAutoLevel=function(){var e=this.fragCurrent,t=this.partCurrent,a=this.hls,i=a.maxAutoLevel,o=a.config,n=a.minAutoLevel,r=a.media,E=t?t.duration:e?e.duration:0,_=r&&0!==r.playbackRate?Math.abs(r.playbackRate):1,T=this.getBwEstimate(),s=a.mainForwardBufferInfo,S=(s?s.len:0)/_,l=o.abrBandWidthFactor,I=o.abrBandWidthUpFactor;if(S){var u=this.findBestLevel(T,n,i,S,0,l,I);if(u>=0)return u}var A=E?Math.min(E,o.maxStarvationDelay):o.maxStarvationDelay;if(!S){var d=this.bitrateTestDelay;d&&(A=(E?Math.min(E,o.maxLoadingDelay):o.maxLoadingDelay)-d,U.info("[abr] bitrate test took "+Math.round(1e3*d)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*A)+" ms"),l=I=1)}var O=this.findBestLevel(T,n,i,S,A,l,I);if(U.info("[abr] "+(S?"rebuffering expected":"buffer is empty")+", optimal quality level "+O),O>-1)return O;var c=a.levels[n],R=a.levels[a.loadLevel];return(null==c?void 0:c.bitrate)<(null==R?void 0:R.bitrate)?n:a.loadLevel},t.getBwEstimate=function(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate},t.findBestLevel=function(e,t,a,i,o,n,r){var E,_=this,T=i+o,s=this.lastLoadedFragLevel,S=-1===s?this.hls.firstLevel:s,l=this.fragCurrent,I=this.partCurrent,u=this.hls,A=u.levels,d=u.allAudioTracks,O=u.loadLevel,c=u.config;if(1===A.length)return 0;var R,N=A[S],m=!(null==N||null==(E=N.details)||!E.live),L=-1===O||-1===s,D="SDR",h=(null==N?void 0:N.frameRate)||0,C=c.audioPreference,f=c.videoPreference,P=this.audioTracksByGroup||(this.audioTracksByGroup=Si(d));if(L){if(-1!==this.firstSelection)return this.firstSelection;var B=Ti(this.codecTiers||(this.codecTiers=li(A,P,t,a)),D,e,C,f),g=B.codecSet,v=B.videoRanges,M=B.minFramerate,W=B.minBitrate,y=B.preferHDR;R=g,D=y?v[v.length-1]:v[0],h=M,e=Math.max(e,W),U.log("[abr] picked start tier "+JSON.stringify(B))}else R=null==N?void 0:N.codecSet,D=null==N?void 0:N.videoRange;for(var b,G=I?I.duration:l?l.duration:0,k=this.bwEstimator.getEstimateTTFB()/1e3,F=[],V=function(){var t,E=A[H],l=H>S;if(!E)return 0;if(c.useMediaCapabilities&&!E.supportedResult&&!E.supportedPromise){var u=navigator.mediaCapabilities;"function"==typeof(null==u?void 0:u.decodingInfo)&&oi(E,P,D,h,e,C)?(E.supportedPromise=ni(E,P,u),E.supportedPromise.then((function(e){E.supportedResult=e;var t=_.hls.levels,a=t.indexOf(E);e.error?U.warn('[abr] MediaCapabilities decodingInfo error: "'+e.error+'" for level '+a+" "+JSON.stringify(e)):e.supported||(U.warn("[abr] Unsupported MediaCapabilities decodingInfo result for level "+a+" "+JSON.stringify(e)),a>-1&&t.length>1&&(U.log("[abr] Removing unsupported level "+a),_.hls.removeLevel(a)))}))):E.supportedResult=ai}if(R&&E.codecSet!==R||D&&E.videoRange!==D||l&&h>E.frameRate||!l&&h>0&&h=2*G&&0===o?A[H].averageBitrate:A[H].maxBitrate,v=_.getTimeToLoadFrag(k,d,g*B,void 0===f);if(d>=g&&(H===s||0===E.loadError&&0===E.fragmentError)&&(v<=k||!p(v)||m&&!_.bitrateTestDelay||v"+H+" adjustedbw("+Math.round(d)+")-bitrate="+Math.round(d-g)+" ttfb:"+k.toFixed(1)+" avgDuration:"+B.toFixed(1)+" maxFetchDuration:"+T.toFixed(1)+" fetchDuration:"+v.toFixed(1)+" firstSelection:"+L+" codecSet:"+R+" videoRange:"+D+" hls.loadLevel:"+O)),L&&(_.firstSelection=H),{v:H}}},H=a;H>=t;H--)if(0!==(b=V())&&b)return b.v;return-1},E(e,[{key:"firstAutoLevel",get:function(){var e=this.hls,t=e.maxAutoLevel,a=e.minAutoLevel,i=this.getBwEstimate(),o=this.hls.config.maxStarvationDelay,n=this.findBestLevel(i,a,t,0,o,1,1);if(n>-1)return n;var r=this.hls.firstLevel,E=Math.min(Math.max(r,a),t);return U.warn("[abr] Could not find best starting auto level. Defaulting to first in playlist "+r+" clamped to "+E),E}},{key:"forcedAutoLevel",get:function(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}},{key:"nextAutoLevel",get:function(){var e=this.forcedAutoLevel,t=this.bwEstimator.canEstimate(),a=this.lastLoadedFragLevel>-1;if(!(-1===e||t&&a&&this.nextAutoLevelKey!==this.getAutoLevelKey()))return e;var i=t&&a?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==e){var o=this.hls.levels;if(o.length>Math.max(e,i)&&o[e].loadError<=o[i].loadError)return e}return this._nextAutoLevel=i,this.nextAutoLevelKey=this.getAutoLevelKey(),i},set:function(e){var t=this.hls,a=t.maxAutoLevel,i=t.minAutoLevel,o=Math.min(Math.max(e,i),a);this._nextAutoLevel!==o&&(this.nextAutoLevelKey="",this._nextAutoLevel=o)}}]),e})(),Ni=(function(){function e(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var t=e.prototype;return t.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},t.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},t.onHandlerDestroyed=function(){},t.hasInterval=function(){return!!this._tickInterval},t.hasNextTick=function(){return!!this._tickTimer},t.setInterval=function(e){return!this._tickInterval&&(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)},t.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)},t.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)},t.tick=function(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},t.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},t.doTick=function(){},e})(),mi={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"},Li=(function(){function e(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}var t=e.prototype;return t._registerListeners=function(){var e=this.hls;e.on(f.BUFFER_APPENDED,this.onBufferAppended,this),e.on(f.FRAG_BUFFERED,this.onFragBuffered,this),e.on(f.FRAG_LOADED,this.onFragLoaded,this)},t._unregisterListeners=function(){var e=this.hls;e.off(f.BUFFER_APPENDED,this.onBufferAppended,this),e.off(f.FRAG_BUFFERED,this.onFragBuffered,this),e.off(f.FRAG_LOADED,this.onFragLoaded,this)},t.destroy=function(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null},t.getAppendedFrag=function(e,t){var a=this.activePartLists[t];if(a)for(var i=a.length;i--;){var o=a[i];if(!o)break;var n=o.end;if(o.start<=e&&null!==n&&e<=n)return o}return this.getBufferedFrag(e,t)},t.getBufferedFrag=function(e,t){for(var a=this.fragments,i=Object.keys(a),o=i.length;o--;){var n=a[i[o]];if((null==n?void 0:n.body.type)===t&&n.buffered){var r=n.body;if(r.start<=e&&e<=r.end)return r}}return null},t.detectEvictedFragments=function(e,t,a,i){var o=this;this.timeRanges&&(this.timeRanges[e]=t);var n=(null==i?void 0:i.fragment.sn)||-1;Object.keys(this.fragments).forEach((function(i){var r=o.fragments[i];if(r&&!(n>=r.body.sn))if(r.buffered||r.loaded){var E=r.range[e];E&&E.time.some((function(e){var a=!o.isTimeBuffered(e.startPTS,e.endPTS,t);return a&&o.removeFragment(r.body),a}))}else r.body.type===a&&o.removeFragment(r.body)}))},t.detectPartialFragments=function(e){var t=this,a=this.timeRanges,i=e.frag,o=e.part;if(a&&"initSegment"!==i.sn){var n=pi(i),r=this.fragments[n];if(!(!r||r.buffered&&i.gap)){var E=!i.relurl;Object.keys(a).forEach((function(e){var n=i.elementaryStreams[e];if(n){var _=a[e],T=E||!0===n.partial;r.range[e]=t.getBufferedTimes(i,o,T,_)}})),r.loaded=null,Object.keys(r.range).length?(r.buffered=!0,(r.body.endList=i.endList||r.body.endList)&&(this.endListFragments[r.body.type]=r),Di(r)||this.removeParts(i.sn-1,i.type)):this.removeFragment(r.body)}}},t.removeParts=function(e,t){var a=this.activePartLists[t];a&&(this.activePartLists[t]=a.filter((function(t){return t.fragment.sn>=e})))},t.fragBuffered=function(e,t){var a=pi(e),i=this.fragments[a];!i&&t&&(i=this.fragments[a]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,i.buffered=!0)},t.getBufferedTimes=function(e,t,a,i){for(var o={time:[],partial:a},n=e.start,r=e.end,E=e.minEndPTS||r,_=e.maxStartPTS||n,T=0;T=s&&E<=S){o.time.push({startPTS:Math.max(n,i.start(T)),endPTS:Math.min(r,i.end(T))});break}if(ns){var l=Math.max(n,i.start(T)),I=Math.min(r,i.end(T));I>l&&(o.partial=!0,o.time.push({startPTS:l,endPTS:I}))}else if(r<=s)break}return o},t.getPartialFragment=function(e){var t,a,i,o=null,n=0,r=this.bufferPadding,E=this.fragments;return Object.keys(E).forEach((function(_){var T=E[_];T&&Di(T)&&(a=T.body.start-r,i=T.body.end+r,e>=a&&e<=i&&(t=Math.min(e-a,i-e),n<=t&&(o=T.body,n=t)))})),o},t.isEndListAppended=function(e){var t=this.endListFragments[e];return void 0!==t&&(t.buffered||Di(t))},t.getState=function(e){var t=pi(e),a=this.fragments[t];return a?a.buffered?Di(a)?mi.PARTIAL:mi.OK:mi.APPENDING:mi.NOT_LOADED},t.isTimeBuffered=function(e,t,a){for(var i,o,n=0;n=i&&t<=o)return!0;if(t<=i)return!1}return!1},t.onFragLoaded=function(e,t){var a=t.frag,i=t.part;if("initSegment"!==a.sn&&!a.bitrateTest){var o=i?null:t,n=pi(a);this.fragments[n]={body:a,appendedPTS:null,loaded:o,buffered:!1,range:Object.create(null)}}},t.onBufferAppended=function(e,t){var a=this,i=t.frag,o=t.part,n=t.timeRanges;if("initSegment"!==i.sn){var r=i.type;if(o){var E=this.activePartLists[r];E||(this.activePartLists[r]=E=[]),E.push(o)}this.timeRanges=n,Object.keys(n).forEach((function(e){var t=n[e];a.detectEvictedFragments(e,t,r,o)}))}},t.onFragBuffered=function(e,t){this.detectPartialFragments(t)},t.hasFragment=function(e){var t=pi(e);return!!this.fragments[t]},t.hasParts=function(e){var t;return!(null==(t=this.activePartLists[e])||!t.length)},t.removeFragmentsInRange=function(e,t,a,i,o){var n=this;i&&!this.hasGaps||Object.keys(this.fragments).forEach((function(r){var E=n.fragments[r];if(E){var _=E.body;_.type!==a||i&&!_.gap||_.starte&&(E.buffered||o)&&n.removeFragment(_)}}))},t.removeFragment=function(e){var t=pi(e);e.stats.loaded=0,e.clearElementaryStreamInfo();var a=this.activePartLists[e.type];if(a){var i=e.sn;this.activePartLists[e.type]=a.filter((function(e){return e.fragment.sn!==i}))}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]},t.removeAllFragments=function(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1},e})();function Di(e){var t,a,i;return e.buffered&&(e.body.gap||(null==(t=e.range.video)?void 0:t.partial)||(null==(a=e.range.audio)?void 0:a.partial)||(null==(i=e.range.audiovideo)?void 0:i.partial))}function pi(e){return e.type+"_"+e.level+"_"+e.sn}var hi={length:0,start:function(){return 0},end:function(){return 0}},Ci=(function(){function e(){}return e.isBuffered=function(t,a){try{if(t)for(var i=e.getBuffered(t),o=0;o=i.start(o)&&a<=i.end(o))return!0}catch(e){}return!1},e.bufferInfo=function(t,a,i){try{if(t){var o,n=e.getBuffered(t),r=[];for(o=0;or&&(i[n-1].end=e[o].end):i.push(e[o])}else i.push(e[o])}else i=e;for(var E,_=0,T=t,s=t,S=0;S=l&&ta.startCC||e&&e.cc>>8^255&d^99,e[I]=d,t[d]=I;var O=l[I],c=l[O],R=l[c],N=257*l[d]^16843008*d;i[I]=N<<24|N>>>8,o[I]=N<<16|N>>>16,n[I]=N<<8|N>>>24,r[I]=N,N=16843009*R^65537*c^257*O^16843008*I,_[d]=N<<24|N>>>8,T[d]=N<<16|N>>>16,s[d]=N<<8|N>>>24,S[d]=N,I?(I=O^l[l[l[R^O]]],u^=l[l[u]]):I=u=1}},t.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),a=!0,i=0;ir.end){var s=n>T;(n<_||s)&&(s&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}a&&(this.fragmentTracker.removeFragmentsInRange(n,1/0,this.playlistType,!0),this.lastCurrentTime=n),this.loadedmetadata||r.len||(this.nextLoadPosition=this.startPosition=n),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onManifestLoaded=function(e,t){this.startTimeOffset=t.startTimeOffset,this.initPTS=[]},a.onHandlerDestroying=function(){this.hls.off(f.MANIFEST_LOADED,this.onManifestLoaded,this),this.stopLoad(),e.prototype.onHandlerDestroying.call(this),this.hls=null},a.onHandlerDestroyed=function(){this.state=Xi.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,e.prototype.onHandlerDestroyed.call(this)},a.loadFragment=function(e,t,a){this._loadFragForPlayback(e,t,a)},a._loadFragForPlayback=function(e,t,a){var i=this,o=function(t){if(i.fragContextChanged(e))return i.warn("Fragment "+e.sn+(t.part?" p: "+t.part.index:"")+" of level "+e.level+" was dropped during download."),void i.fragmentTracker.removeFragment(e);e.stats.chunkCount++,i._handleFragmentLoadProgress(t)};this._doFragLoad(e,t,a,o).then((function(t){if(t){var a=i.state;i.fragContextChanged(e)?(a===Xi.FRAG_LOADING||!i.fragCurrent&&a===Xi.PARSING)&&(i.fragmentTracker.removeFragment(e),i.state=Xi.IDLE):("payload"in t&&(i.log("Loaded fragment "+e.sn+" of level "+e.level),i.hls.trigger(f.FRAG_LOADED,t)),i._handleFragmentLoadComplete(t))}})).catch((function(t){i.state!==Xi.STOPPED&&i.state!==Xi.ERROR&&(i.warn(t),i.resetFragmentLoading(e))}))},a.clearTrackerIfNeeded=function(e){var t,a=this.fragmentTracker;if(a.getState(e)===mi.APPENDING){var i=e.type,o=this.getFwdBufferInfo(this.mediaBuffer,i),n=Math.max(e.duration,o?o.len:this.config.maxBufferLength);this.reduceMaxBufferLength(n)&&a.removeFragment(e)}else 0===(null==(t=this.mediaBuffer)?void 0:t.buffered.length)?a.removeAllFragments():a.hasParts(e.type)&&(a.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),a.getState(e)===mi.PARTIAL&&a.removeFragment(e))},a.checkLiveUpdate=function(e){if(e.updated&&!e.live){var t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)},a.flushMainBuffer=function(e,t,a){if(void 0===a&&(a=null),e-t){var i={startOffset:e,endOffset:t,type:a};this.hls.trigger(f.BUFFER_FLUSHING,i)}},a._loadInitSegment=function(e,t){var a=this;this._doFragLoad(e,t).then((function(t){if(!t||a.fragContextChanged(e)||!a.levels)throw new Error("init load aborted");return t})).then((function(t){var i=a.hls,o=t.payload,n=e.decryptdata;if(o&&o.byteLength>0&&null!=n&&n.key&&n.iv&&"AES-128"===n.method){var r=self.performance.now();return a.decrypter.decrypt(new Uint8Array(o),n.key.buffer,n.iv.buffer).catch((function(t){throw i.trigger(f.ERROR,{type:P.MEDIA_ERROR,details:B.FRAG_DECRYPT_ERROR,fatal:!1,error:t,reason:t.message,frag:e}),t})).then((function(o){var n=self.performance.now();return i.trigger(f.FRAG_DECRYPTED,{frag:e,payload:o,stats:{tstart:r,tdecrypt:n}}),t.payload=o,a.completeInitSegmentLoad(t)}))}return a.completeInitSegmentLoad(t)})).catch((function(t){a.state!==Xi.STOPPED&&a.state!==Xi.ERROR&&(a.warn(t),a.resetFragmentLoading(e))}))},a.completeInitSegmentLoad=function(e){if(!this.levels)throw new Error("init load aborted, missing levels");var t=e.frag.stats;this.state=Xi.IDLE,e.frag.data=new Uint8Array(e.payload),t.parsing.start=t.buffering.start=self.performance.now(),t.parsing.end=t.buffering.end=self.performance.now(),this.tick()},a.fragContextChanged=function(e){var t=this.fragCurrent;return!e||!t||e.sn!==t.sn||e.level!==t.level},a.fragBufferedComplete=function(e,t){var a,i,o,n,r=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log("Buffered "+e.type+" sn: "+e.sn+(t?" part: "+t.index:"")+" of "+(this.playlistType===$t.MAIN?"level":"track")+" "+e.level+" (frag:["+(null!=(a=e.startPTS)?a:NaN).toFixed(3)+"-"+(null!=(i=e.endPTS)?i:NaN).toFixed(3)+"] > buffer:"+(r?Qi.toString(Ci.getBuffered(r)):"(detached)")+")"),"initSegment"!==e.sn){var E;if(e.type!==$t.SUBTITLE){var _=e.elementaryStreams;if(!Object.keys(_).some((function(e){return!!_[e]})))return void(this.state=Xi.IDLE)}var T=null==(E=this.levels)?void 0:E[e.level];null!=T&&T.fragmentError&&(this.log("Resetting level fragment error count of "+T.fragmentError+" on frag buffered"),T.fragmentError=0)}this.state=Xi.IDLE,r&&(!this.loadedmetadata&&e.type==$t.MAIN&&r.buffered.length&&(null==(o=this.fragCurrent)?void 0:o.sn)===(null==(n=this.fragPrevious)?void 0:n.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())},a.seekToStartPos=function(){},a._handleFragmentLoadComplete=function(e){var t=this.transmuxer;if(t){var a=e.frag,i=e.part,o=e.partsLoaded,n=!o||0===o.length||o.some((function(e){return!e})),r=new fi(a.level,a.sn,a.stats.chunkCount+1,0,i?i.index:-1,!n);t.flush(r)}},a._handleFragmentLoadProgress=function(e){},a._doFragLoad=function(e,t,a,i){var o,n=this;void 0===a&&(a=null);var r=null==t?void 0:t.details;if(!this.levels||!r)throw new Error("frag load aborted, missing level"+(r?"":" detail")+"s");var E=null;if(!e.encrypted||null!=(o=e.decryptdata)&&o.key?!e.encrypted&&r.encryptedFragments.length&&this.keyLoader.loadClear(e,r.encryptedFragments):(this.log("Loading key for "+e.sn+" of ["+r.startSN+"-"+r.endSN+"], "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+e.level),this.state=Xi.KEY_LOADING,this.fragCurrent=e,E=this.keyLoader.load(e).then((function(e){if(!n.fragContextChanged(e.frag))return n.hls.trigger(f.KEY_LOADED,e),n.state===Xi.KEY_LOADING&&(n.state=Xi.IDLE),e})),this.hls.trigger(f.KEY_LOADING,{frag:e}),null===this.fragCurrent&&(E=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))),a=Math.max(e.start,a||0),this.config.lowLatencyMode&&"initSegment"!==e.sn){var _=r.partList;if(_&&i){a>e.end&&r.fragmentHint&&(e=r.fragmentHint);var T=this.getNextPart(_,e,a);if(T>-1){var s,S=_[T];return this.log("Loading part sn: "+e.sn+" p: "+S.index+" cc: "+e.cc+" of playlist ["+r.startSN+"-"+r.endSN+"] parts [0-"+T+"-"+(_.length-1)+"] "+("[stream-controller]"===this.logPrefix?"level":"track")+": "+e.level+", target: "+parseFloat(a.toFixed(3))),this.nextLoadPosition=S.start+S.duration,this.state=Xi.FRAG_LOADING,s=E?E.then((function(a){return!a||n.fragContextChanged(a.frag)?null:n.doFragPartsLoad(e,S,t,i)})).catch((function(e){return n.handleFragLoadError(e)})):this.doFragPartsLoad(e,S,t,i).catch((function(e){return n.handleFragLoadError(e)})),this.hls.trigger(f.FRAG_LOADING,{frag:e,part:S,targetBufferTime:a}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):s}if(!e.url||this.loadedEndOfParts(_,a))return Promise.resolve(null)}}this.log("Loading fragment "+e.sn+" cc: "+e.cc+" "+(r?"of ["+r.startSN+"-"+r.endSN+"] ":"")+("[stream-controller]"===this.logPrefix?"level":"track")+": "+e.level+", target: "+parseFloat(a.toFixed(3))),p(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=Xi.FRAG_LOADING;var l,I=this.config.progressive;return l=I&&E?E.then((function(t){return!t||n.fragContextChanged(null==t?void 0:t.frag)?null:n.fragmentLoader.load(e,i)})).catch((function(e){return n.handleFragLoadError(e)})):Promise.all([this.fragmentLoader.load(e,I?i:void 0),E]).then((function(e){var t=e[0];return!I&&t&&i&&i(t),t})).catch((function(e){return n.handleFragLoadError(e)})),this.hls.trigger(f.FRAG_LOADING,{frag:e,targetBufferTime:a}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):l},a.doFragPartsLoad=function(e,t,a,i){var o=this;return new Promise((function(n,r){var E,_=[],T=null==(E=a.details)?void 0:E.partList;!(function t(E){o.fragmentLoader.loadPart(e,E,i).then((function(i){_[E.index]=i;var r=i.part;o.hls.trigger(f.FRAG_LOADED,i);var s=ba(a,e.sn,E.index+1)||Ua(T,e.sn,E.index+1);if(!s)return n({frag:e,part:r,partsLoaded:_});t(s)})).catch(r)})(t)}))},a.handleFragLoadError=function(e){if("data"in e){var t=e.data;e.data&&t.details===B.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(f.ERROR,t)}else this.hls.trigger(f.ERROR,{type:P.OTHER_ERROR,details:B.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null},a._handleTransmuxerFlush=function(e){var t=this.getCurrentContext(e);if(t&&this.state===Xi.PARSING){var a=t.frag,i=t.part,o=t.level,n=self.performance.now();a.stats.parsing.end=n,i&&(i.stats.parsing.end=n),this.updateLevelTiming(a,i,o,e.partial)}else this.fragCurrent||this.state===Xi.STOPPED||this.state===Xi.ERROR||(this.state=Xi.IDLE)},a.getCurrentContext=function(e){var t=this.levels,a=this.fragCurrent,i=e.level,o=e.sn,n=e.part;if(null==t||!t[i])return this.warn("Levels object was unset while buffering fragment "+o+" of level "+i+". The current chunk will not be buffered."),null;var r=t[i],E=n>-1?ba(r,o,n):null,_=E?E.fragment:ya(r,o,a);return _?(a&&a!==_&&(_.stats=a.stats),{frag:_,part:E,level:r}):null},a.bufferFragmentData=function(e,t,a,i,o){var n;if(e&&this.state===Xi.PARSING){var r=e.data1,E=e.data2,_=r;if(r&&E&&(_=at(r,E)),null!=(n=_)&&n.length){var T={type:e.type,frag:t,part:a,chunkMeta:i,parent:t.type,data:_};if(this.hls.trigger(f.BUFFER_APPENDING,T),e.dropped&&e.independent&&!a){if(o)return;this.flushBufferGap(t)}}}},a.flushBufferGap=function(e){var t=this.media;if(t)if(Ci.isBuffered(t,t.currentTime)){var a=t.currentTime,i=Ci.bufferInfo(t,a,0),o=e.duration,n=Math.min(2*this.config.maxFragLookUpTolerance,.25*o),r=Math.max(Math.min(e.start-n,i.end-n),a+n);e.start-r>n&&this.flushMainBuffer(r,e.start)}else this.flushMainBuffer(0,e.start)},a.getFwdBufferInfo=function(e,t){var a=this.getLoadPosition();return p(a)?this.getFwdBufferInfoAtPos(e,a,t):null},a.getFwdBufferInfoAtPos=function(e,t,a){var i=this.config.maxBufferHole,o=Ci.bufferInfo(e,t,i);if(0===o.len&&void 0!==o.nextStart){var n=this.fragmentTracker.getBufferedFrag(t,a);if(n&&o.nextStart=a&&(t.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+t.maxMaxBufferLength+"s"),!0)},a.getAppendedFrag=function(e,t){var a=this.fragmentTracker.getAppendedFrag(e,$t.MAIN);return a&&"fragment"in a?a.fragment:a},a.getNextFragment=function(e,t){var a=t.fragments,i=a.length;if(!i)return null;var o,n=this.config,r=a[0].start;if(t.live){var E=n.initialLiveManifestSize;if(it},a.getNextFragmentLoopLoading=function(e,t,a,i,o){var n=e.gap,r=this.getNextFragment(this.nextLoadPosition,t);if(null===r)return r;if(e=r,n&&e&&!e.gap&&a.nextStart){var E=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,a.nextStart,i);if(null!==E&&a.len+E.len>=o)return this.log('buffer full after gaps in "'+i+'" playlist starting at sn: '+e.sn),null}return e},a.mapToInitFragWhenRequired=function(e){return null==e||!e.initSegment||null!=e&&e.initSegment.data||this.bitrateTest?e:e.initSegment},a.getNextPart=function(e,t,a){for(var i=-1,o=!1,n=!0,r=0,E=e.length;r-1&&a<_.start)break;var T=_.loaded;T?i=-1:(o||_.independent||n)&&_.fragment===t&&(i=r),o=T}return i},a.loadedEndOfParts=function(e,t){var a=e[e.length-1];return a&&t>a.start&&a.loaded},a.getInitialLiveFragment=function(e,t){var a=this.fragPrevious,i=null;if(a){if(e.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+a.programDateTime),i=Ka(t,a.endProgramDateTime,this.config.maxFragLookUpTolerance)),!i){var o=a.sn+1;if(o>=e.startSN&&o<=e.endSN){var n=t[o-e.startSN];a.cc===n.cc&&(i=n,this.log("Live playlist, switching playlist, load frag with next SN: "+i.sn))}i||(i=Xa(t,a.cc))&&this.log("Live playlist, switching playlist, load frag with same CC: "+i.sn)}}else{var r=this.hls.liveSyncPosition;null!==r&&(i=this.getFragmentAtPosition(r,this.bitrateTest?e.fragmentEnd:e.edge,e))}return i},a.getFragmentAtPosition=function(e,t,a){var i,o=this.config,n=this.fragPrevious,r=a.fragments,E=a.endSN,_=a.fragmentHint,T=o.maxFragLookUpTolerance,s=a.partList,S=!!(o.lowLatencyMode&&null!=s&&s.length&&_);if(S&&_&&!this.bitrateTest&&(r=r.concat(_),E=_.sn),i=et-T?0:T):r[r.length-1]){var l=i.sn-a.startSN,I=this.fragmentTracker.getState(i);if((I===mi.OK||I===mi.PARTIAL&&i.gap)&&(n=i),n&&i.sn===n.sn&&(!S||s[0].fragment.sn>i.sn)&&n&&i.level===n.level){var u=r[l+1];i=i.sn=n-t.maxFragLookUpTolerance&&o<=r;if(null!==i&&a.duration>i&&(o"+e.startSN+" prev-sn: "+(E?E.sn:"na")+" fragments: "+i),_}return o},a.waitForCdnTuneIn=function(e){var t=3;return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*t)},a.setStartPosition=function(e,t){var a=this.startPosition;if(a "+(null==(o=this.fragCurrent)?void 0:o.url))}else{var n=t.details===B.FRAG_GAP;n&&this.fragmentTracker.fragBuffered(i,!0);var r=t.errorAction,E=r||{},_=E.action,T=E.retryCount,s=void 0===T?0:T,S=E.retryConfig;if(r&&_===$a.RetryRequest&&S){this.resetStartWhenNotLoaded(this.levelLastLoaded);var l=Va(S,s);this.warn("Fragment "+i.sn+" of "+e+" "+i.level+" errored with "+t.details+", retrying loading "+(s+1)+"/"+S.maxNumRetry+" in "+l+"ms"),r.resolved=!0,this.retryDate=self.performance.now()+l,this.state=Xi.FRAG_LOADING_WAITING_RETRY}else if(S&&r){if(this.resetFragmentErrors(e),!(s.5;i&&this.reduceMaxBufferLength(a.len);var o=!i;return o&&this.warn("Buffer full error while media.currentTime is not buffered, flush "+t+" buffer"),e.frag&&(this.fragmentTracker.removeFragment(e.frag),this.nextLoadPosition=e.frag.start),this.resetLoadingState(),o}return!1},a.resetFragmentErrors=function(e){e===$t.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==Xi.STOPPED&&(this.state=Xi.IDLE)},a.afterBufferFlushed=function(e,t,a){if(e){var i=Ci.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,i,a),this.state===Xi.ENDED&&this.resetLoadingState()}},a.resetLoadingState=function(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=Xi.IDLE},a.resetStartWhenNotLoaded=function(e){if(!this.loadedmetadata){this.startFragRequested=!1;var t=e?e.details:null;null!=t&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}},a.resetWhenMissingContext=function(e){this.warn("The loading context changed while buffering fragment "+e.sn+" of level "+e.level+". This chunk will not be buffered."),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()},a.removeUnbufferedFrags=function(e){void 0===e&&(e=0),this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)},a.updateLevelTiming=function(e,t,a,i){var o,n=this,r=a.details;if(r){if(!Object.keys(e.elementaryStreams).reduce((function(t,o){var E=e.elementaryStreams[o];if(E){var _=E.endPTS-E.startPTS;if(_<=0)return n.warn("Could not parse fragment "+e.sn+" "+o+" duration reliably ("+_+")"),t||!1;var T=i?0:Ca(r,e,E.startPTS,E.endPTS,E.startDTS,E.endDTS);return n.hls.trigger(f.LEVEL_PTS_UPDATED,{details:r,level:a,drift:T,type:o,frag:e,start:E.startPTS,end:E.endPTS}),!0}return t}),!1)&&null===(null==(o=this.transmuxer)?void 0:o.error)){var E=new Error("Found no media in fragment "+e.sn+" of level "+e.level+" resetting transmuxer to fallback to playlist timing");if(0===a.fragmentError&&(a.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(E.message),this.hls.trigger(f.ERROR,{type:P.MEDIA_ERROR,details:B.FRAG_PARSING_ERROR,fatal:!1,error:E,frag:e,reason:"Found no media in msn "+e.sn+' of level "'+a.url+'"'}),!this.hls)return;this.resetTransmuxer()}this.state=Xi.PARSED,this.hls.trigger(f.FRAG_PARSED,{frag:e,part:t})}else this.warn("level.details undefined")},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},a.recoverWorkerError=function(e){"demuxerWorker"===e.event&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())},E(t,[{key:"state",get:function(){return this._state},set:function(e){var t=this._state;t!==e&&(this._state=e,this.log(t+"->"+e))}}]),t})(Ni),qi=(function(){function e(){this.chunks=[],this.dataLength=0}var t=e.prototype;return t.push=function(e){this.chunks.push(e),this.dataLength+=e.length},t.flush=function(){var e,t=this.chunks,a=this.dataLength;return t.length?(e=1===t.length?t[0]:Ji(t,a),this.reset(),e):new Uint8Array(0)},t.reset=function(){this.chunks.length=0,this.dataLength=0},e})();function Ji(e,t){for(var a=new Uint8Array(t),i=0,o=0;o0&&r.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Ea.audioId3,duration:Number.POSITIVE_INFINITY});o<_;){if(this.canParse(e,o)){var T=this.appendFrame(n,e,o);T?(this.frameIndex++,this.lastPTS=T.sample.pts,a=o+=T.length):o=_}else Re(e,o)?(i=Oe(e,o),r.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Ea.audioId3,duration:Number.POSITIVE_INFINITY}),a=o+=i.length):o++;if(o===_&&a!==_){var s=Ie(e,a);this.cachedData?this.cachedData=at(this.cachedData,s):this.cachedData=s}}return{audioTrack:n,videoTrack:Zi(),id3Track:r,textTrack:Zi()}},t.demuxSampleAes=function(e,t,a){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},t.flush=function(e){var t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:Zi(),id3Track:this._id3Track,textTrack:Zi()}},t.destroy=function(){},e})(),to=function(e,t,a){return p(e)?90*e:9e4*t+(a?9e4*a.baseTime/a.timescale:0)};function ao(e,t,a,i){var o,n,r,E,_=navigator.userAgent.toLowerCase(),T=i,s=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];o=1+((192&t[a+2])>>>6);var S=(60&t[a+2])>>>2;if(!(S>s.length-1))return r=(1&t[a+2])<<2,r|=(192&t[a+3])>>>6,U.log("manifest codec:"+i+", ADTS type:"+o+", samplingIndex:"+S),/firefox/i.test(_)?S>=6?(o=5,E=new Array(4),n=S-3):(o=2,E=new Array(2),n=S):-1!==_.indexOf("android")?(o=2,E=new Array(2),n=S):(o=5,E=new Array(4),i&&(-1!==i.indexOf("mp4a.40.29")||-1!==i.indexOf("mp4a.40.5"))||!i&&S>=6?n=S-3:((i&&-1!==i.indexOf("mp4a.40.2")&&(S>=6&&1===r||/vivaldi/i.test(_))||!i&&1===r)&&(o=2,E=new Array(2)),n=S)),E[0]=o<<3,E[0]|=(14&S)>>1,E[1]|=(1&S)<<7,E[1]|=r<<3,5===o&&(E[1]|=(14&n)>>1,E[2]=(1&n)<<7,E[2]|=8,E[3]=0),{config:E,samplerate:s[S],channelCount:r,codec:"mp4a.40."+o,manifestCodec:T};var l=new Error("invalid ADTS sampling index:"+S);e.emit(f.ERROR,f.ERROR,{type:P.MEDIA_ERROR,details:B.FRAG_PARSING_ERROR,fatal:!0,error:l,reason:l.message})}function io(e,t){return 255===e[t]&&240==(246&e[t+1])}function oo(e,t){return 1&e[t+1]?7:9}function no(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function ro(e,t){return t+5=e.length)return!1;var i=no(e,t);if(i<=a)return!1;var o=t+i;return o===e.length||Eo(e,o)}return!1}function so(e,t,a,i,o){if(!e.samplerate){var n=ao(t,a,i,o);if(!n)return;e.config=n.config,e.samplerate=n.samplerate,e.channelCount=n.channelCount,e.codec=n.codec,e.manifestCodec=n.manifestCodec,U.log("parsed codec:"+e.codec+", rate:"+n.samplerate+", channels:"+n.channelCount)}}function So(e){return 9216e4/e}function lo(e,t){var a=oo(e,t);if(t+a<=e.length){var i=no(e,t)-a;if(i>0)return{headerLength:a,frameLength:i}}}function Io(e,t,a,i,o){var n,r=i+o*So(e.samplerate),E=lo(t,a);if(E){var _=E.frameLength,T=E.headerLength,s=T+_,S=Math.max(0,a+s-t.length);S?(n=new Uint8Array(s-T)).set(t.subarray(a+T,t.length),0):n=t.subarray(a+T,a+s);var l={unit:n,pts:r};return S||e.samples.push(l),{sample:l,length:s,missing:S}}var I=t.length-a;return(n=new Uint8Array(I)).set(t.subarray(a,t.length),0),{sample:{unit:n,pts:r},length:I,missing:-1}}var uo=null,Ao=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],Oo=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],co=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Ro=[0,1,1,4];function No(e,t,a,i,o){if(!(a+24>t.length)){var n=mo(t,a);if(n&&a+n.frameLength<=t.length){var r=i+o*(9e4*n.samplesPerFrame/n.sampleRate),E={unit:t.subarray(a,a+n.frameLength),pts:r,dts:r};return e.config=[],e.channelCount=n.channelCount,e.samplerate=n.sampleRate,e.samples.push(E),{sample:E,length:n.frameLength,missing:0}}}}function mo(e,t){var a=e[t+1]>>3&3,i=e[t+1]>>1&3,o=e[t+2]>>4&15,n=e[t+2]>>2&3;if(1!==a&&0!==o&&15!==o&&3!==n){var r=e[t+2]>>1&1,E=e[t+3]>>6,_=1e3*Ao[14*(3===a?3-i:3===i?3:4)+o-1],T=Oo[3*(3===a?0:2===a?1:2)+n],s=3===E?1:2,S=co[a][i],l=Ro[i],I=8*S*l,u=Math.floor(S*_/T+r)*l;if(null===uo){var A=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);uo=A?parseInt(A[1]):0}return!!uo&&uo<=87&&2===i&&_>=224e3&&0===E&&(e[t+3]=128|e[t+3]),{sampleRate:T,channelCount:s,frameLength:u,samplesPerFrame:I}}}function Lo(e,t){return!(255!==e[t]||224&~e[t+1]||!(6&e[t+1]))}function Do(e,t){return t+10;){r[0]=e[t];var E=Math.min(i,8),_=8-E;n[0]=4278190080>>>24+_<<_,o[0]=(r[0]&n[0])>>_,a=a?a<t.length)return-1;if(11!==t[a]||119!==t[a+1])return-1;var n=t[a+4]>>6;if(n>=3)return-1;var r=[48e3,44100,32e3][n],E=63&t[a+4],_=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*E+n];if(a+_>t.length)return-1;var T=t[a+6]>>5,s=0;2===T?s+=2:(1&T&&1!==T&&(s+=2),4&T&&(s+=2));var S=(t[a+6]<<8|t[a+7])>>12-s&1,l=[2,1,2,3,3,4,4,5][T]+S,I=t[a+5]>>3,u=7&t[a+5],A=new Uint8Array([n<<6|I<<1|u>>2,(3&u)<<6|T<<3|S<<2|E>>4,E<<4&224]),d=i+o*(1536/r*9e4),O=t.subarray(a,a+_);return e.config=A,e.channelCount=l,e.samplerate=r,e.samples.push({unit:O,pts:d}),_}var Mo=(function(){function e(){this.VideoSample=null}var t=e.prototype;return t.createVideoSample=function(e,t,a,i){return{key:e,frame:!1,pts:t,dts:a,units:[],debug:i,length:0}},t.getLastNalUnit=function(e){var t,a,i=this.VideoSample;if(i&&0!==i.units.length||(i=e[e.length-1]),null!=(t=i)&&t.units){var o=i.units;a=o[o.length-1]}return a},t.pushAccessUnit=function(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){var a=t.samples,i=a.length;if(!i)return void t.dropped++;var o=a[i-1];e.pts=o.pts,e.dts=o.dts}t.samples.push(e)}e.debug.length&&U.log(e.pts+"/"+e.dts+":"+e.debug)},e})(),Wo=(function(){function e(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}var t=e.prototype;return t.loadWord=function(){var e=this.data,t=this.bytesAvailable,a=e.byteLength-t,i=new Uint8Array(4),o=Math.min(4,t);if(0===o)throw new Error("no bytes available");i.set(e.subarray(a,a+o)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=8*o,this.bytesAvailable-=o},t.skipBits=function(e){var t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,e-=(t=e>>3)<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)},t.readBits=function(e){var t=Math.min(this.bitsAvailable,e),a=this.word>>>32-t;if(e>32&&U.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return(t=e-t)>0&&this.bitsAvailable?a<>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()},t.skipUEG=function(){this.skipBits(1+this.skipLZ())},t.skipEG=function(){this.skipBits(1+this.skipLZ())},t.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},t.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},t.readBoolean=function(){return 1===this.readBits(1)},t.readUByte=function(){return this.readBits(8)},t.readUShort=function(){return this.readBits(16)},t.readUInt=function(){return this.readBits(32)},t.skipScalingList=function(e){for(var t=8,a=8,i=0;i4){var I=new Wo(l).readSliceType();2!==I&&4!==I&&7!==I&&9!==I||(s=!0)}s&&null!=(S=_)&&S.frame&&!_.key&&(r.pushAccessUnit(_,e),_=r.VideoSample=null),_||(_=r.VideoSample=r.createVideoSample(!0,a.pts,a.dts,"")),_.frame=!0,_.key=s;break;case 5:n=!0,null!=(E=_)&&E.frame&&!_.key&&(r.pushAccessUnit(_,e),_=r.VideoSample=null),_||(_=r.VideoSample=r.createVideoSample(!0,a.pts,a.dts,"")),_.key=!0,_.frame=!0;break;case 6:n=!0,rt(i.data,1,a.pts,t.samples);break;case 7:var u,A;n=!0,T=!0;var d=i.data,O=new Wo(d).readSPS();if(!e.sps||e.width!==O.width||e.height!==O.height||(null==(u=e.pixelRatio)?void 0:u[0])!==O.pixelRatio[0]||(null==(A=e.pixelRatio)?void 0:A[1])!==O.pixelRatio[1]){e.width=O.width,e.height=O.height,e.pixelRatio=O.pixelRatio,e.sps=[d],e.duration=o;for(var c=d.subarray(1,4),R="avc1.",N=0;N<3;N++){var m=c[N].toString(16);m.length<2&&(m="0"+m),R+=m}e.codec=R}break;case 8:n=!0,e.pps=[i.data];break;case 9:n=!0,e.audFound=!0,_&&r.pushAccessUnit(_,e),_=r.VideoSample=r.createVideoSample(!1,a.pts,a.dts,"");break;case 12:n=!0;break;default:n=!1,_&&(_.debug+="unknown NAL "+i.type+" ")}_&&n&&_.units.push(i)})),i&&_&&(this.pushAccessUnit(_,e),this.VideoSample=null)},a.parseAVCNALu=function(e,t){var a,i,o=t.byteLength,n=e.naluState||0,r=n,E=[],_=0,T=-1,s=0;for(-1===n&&(T=0,s=31&t[0],n=0,_=1);_=0){var S={data:t.subarray(T,i),type:s};E.push(S)}else{var l=this.getLastNalUnit(e.samples);l&&(r&&_<=4-r&&l.state&&(l.data=l.data.subarray(0,l.data.byteLength-r)),i>0&&(l.data=at(l.data,t.subarray(0,i)),l.state=0))}_=0&&n>=0){var I={data:t.subarray(T,o),type:s,state:n};E.push(I)}if(0===E.length){var u=this.getLastNalUnit(e.samples);u&&(u.data=at(u.data,t))}return e.naluState=n,E},t})(Mo),bo=(function(){function e(e,t,a){this.keyData=void 0,this.decrypter=void 0,this.keyData=a,this.decrypter=new xi(t,{removePKCS7Padding:!1})}var t=e.prototype;return t.decryptBuffer=function(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)},t.decryptAacSample=function(e,t,a){var i=this,o=e[t].unit;if(!(o.length<=16)){var n=o.subarray(16,o.length-o.length%16),r=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(r).then((function(n){var r=new Uint8Array(n);o.set(r,16),i.decrypter.isSync()||i.decryptAacSamples(e,t+1,a)}))}},t.decryptAacSamples=function(e,t,a){for(;;t++){if(t>=e.length)return void a();if(!(e[t].unit.length<32||(this.decryptAacSample(e,t,a),this.decrypter.isSync())))return}},t.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,a=new Int8Array(t),i=0,o=32;o=e.length)return void i();for(var o=e[t].units;!(a>=o.length);a++){var n=o[a];if(!(n.data.length<=48||1!==n.type&&5!==n.type||(this.decryptAvcSample(e,t,a,i,n),this.decrypter.isSync())))return}}},e})(),Uo=188,Go=(function(){function e(e,t,a){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=a,this.videoParser=new yo}e.probe=function(t){var a=e.syncOffset(t);return a>0&&U.warn("MPEG2-TS detected but first sync word found @ offset "+a),-1!==a},e.syncOffset=function(e){for(var t=e.length,a=Math.min(5*Uo,t-Uo)+1,i=0;i1&&(0===n&&r>2||E+Uo>a))return n}i++}return-1},e.createTrack=function(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:ye[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}};var t=e.prototype;return t.resetInitSegment=function(t,a,i,o){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=e.createTrack("video"),this._audioTrack=e.createTrack("audio",o),this._id3Track=e.createTrack("id3"),this._txtTrack=e.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=a,this.videoCodec=i,this._duration=o},t.resetTimeStamp=function(){},t.resetContiguity=function(){var e=this._audioTrack,t=this._videoTrack,a=this._id3Track;e&&(e.pesData=null),t&&(t.pesData=null),a&&(a.pesData=null),this.aacOverFlow=null,this.remainderData=null},t.demux=function(t,a,i,o){var n;void 0===i&&(i=!1),void 0===o&&(o=!1),i||(this.sampleAes=null);var r=this._videoTrack,E=this._audioTrack,_=this._id3Track,T=this._txtTrack,s=r.pid,S=r.pesData,l=E.pid,I=_.pid,u=E.pesData,A=_.pesData,d=null,O=this.pmtParsed,c=this._pmtId,R=t.length;if(this.remainderData&&(R=(t=at(this.remainderData,t)).length,this.remainderData=null),R>4>1){if((h=L+5+t[L+4])===L+Uo)continue}else h=L+4;switch(p){case s:D&&(S&&(n=wo(S))&&this.videoParser.parseAVCPES(r,T,n,!1,this._duration),S={data:[],size:0}),S&&(S.data.push(t.subarray(h,L+Uo)),S.size+=L+Uo-h);break;case l:if(D){if(u&&(n=wo(u)))switch(E.segmentCodec){case"aac":this.parseAACPES(E,n);break;case"mp3":this.parseMPEGPES(E,n);break;case"ac3":this.parseAC3PES(E,n)}u={data:[],size:0}}u&&(u.data.push(t.subarray(h,L+Uo)),u.size+=L+Uo-h);break;case I:D&&(A&&(n=wo(A))&&this.parseID3PES(_,n),A={data:[],size:0}),A&&(A.data.push(t.subarray(h,L+Uo)),A.size+=L+Uo-h);break;case 0:D&&(h+=t[h]+1),c=this._pmtId=Fo(t,h);break;case c:D&&(h+=t[h]+1);var C=Vo(t,h,this.typeSupported,i);(s=C.videoPid)>0&&(r.pid=s,r.segmentCodec=C.segmentVideoCodec),(l=C.audioPid)>0&&(E.pid=l,E.segmentCodec=C.segmentAudioCodec),(I=C.id3Pid)>0&&(_.pid=I),null===d||O||(U.warn("MPEG-TS PMT found at "+L+" after unknown PID '"+d+"'. Backtracking to sync byte @"+N+" to parse all TS packets."),d=null,L=N-188),O=this.pmtParsed=!0;break;case 17:case 8191:break;default:d=p}}else m++;if(m>0){var g=new Error("Found "+m+" TS packet/s that do not start with 0x47");this.observer.emit(f.ERROR,f.ERROR,{type:P.MEDIA_ERROR,details:B.FRAG_PARSING_ERROR,fatal:!1,error:g,reason:g.message})}r.pesData=S,E.pesData=u,_.pesData=A;var v={audioTrack:E,videoTrack:r,id3Track:_,textTrack:T};return o&&this.extractRemainingSamples(v),v},t.flush=function(){var e,t=this.remainderData;return this.remainderData=null,e=t?this.demux(t,-1,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(e),this.sampleAes?this.decrypt(e,this.sampleAes):e},t.extractRemainingSamples=function(e){var t,a=e.audioTrack,i=e.videoTrack,o=e.id3Track,n=e.textTrack,r=i.pesData,E=a.pesData,_=o.pesData;if(r&&(t=wo(r))?(this.videoParser.parseAVCPES(i,n,t,!0,this._duration),i.pesData=null):i.pesData=r,E&&(t=wo(E))){switch(a.segmentCodec){case"aac":this.parseAACPES(a,t);break;case"mp3":this.parseMPEGPES(a,t);break;case"ac3":this.parseAC3PES(a,t)}a.pesData=null}else null!=E&&E.size&&U.log("last AAC PES packet truncated,might overlap between fragments"),a.pesData=E;_&&(t=wo(_))?(this.parseID3PES(o,t),o.pesData=null):o.pesData=_},t.demuxSampleAes=function(e,t,a){var i=this.demux(e,a,!0,!this.config.progressive),o=this.sampleAes=new bo(this.observer,this.config,t);return this.decrypt(i,o)},t.decrypt=function(e,t){return new Promise((function(a){var i=e.audioTrack,o=e.videoTrack;i.samples&&"aac"===i.segmentCodec?t.decryptAacSamples(i.samples,0,(function(){o.samples?t.decryptAvcSamples(o.samples,0,0,(function(){a(e)})):a(e)})):o.samples&&t.decryptAvcSamples(o.samples,0,0,(function(){a(e)}))}))},t.destroy=function(){this._duration=0},t.parseAACPES=function(e,t){var a,i,o,n=0,r=this.aacOverFlow,E=t.data;if(r){this.aacOverFlow=null;var _=r.missing,T=r.sample.unit.byteLength;if(-1===_)E=at(r.sample.unit,E);else{var s=T-_;r.sample.unit.set(E.subarray(0,_),s),e.samples.push(r.sample),n=r.missing}}for(a=n,i=E.length;a0;)E+=o;else U.warn("[tsdemuxer]: AC3 PES unknown PTS")},t.parseID3PES=function(e,t){if(void 0!==t.pts){var a=T({},t,{type:this._videoTrack?Ea.emsg:Ea.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(a)}else U.warn("[tsdemuxer]: ID3 PES unknown PTS")},e})();function ko(e,t){return((31&e[t+1])<<8)+e[t+2]}function Fo(e,t){return(31&e[t+10])<<8|e[t+11]}function Vo(e,t,a,i){var o={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},n=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t0)for(var _=t+5,T=E;T>2;){106===e[_]&&(!0!==a.ac3?U.log("AC-3 audio found, not supported in this browser for now"):(o.audioPid=r,o.segmentAudioCodec="ac3"));var s=e[_+1]+2;_+=s,T-=s}break;case 194:case 135:U.warn("Unsupported EC-3 in M2TS found");break;case 36:U.warn("Unsupported HEVC in M2TS found")}t+=E+5}return o}function Ho(e){U.log(e+" with AES-128-CBC encryption found in unencrypted stream")}function wo(e){var t,a,i,o,n,r=0,E=e.data;if(!e||0===e.size)return null;for(;E[0].length<19&&E.length>1;)E[0]=at(E[0],E[1]),E.splice(1,1);if(1===((t=E[0])[0]<<16)+(t[1]<<8)+t[2]){if((a=(t[4]<<8)+t[5])&&a>e.size-6)return null;var _=t[7];192&_&&(o=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&_?o-(n=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2)>54e5&&(U.warn(Math.round((o-n)/9e4)+"s delta between PTS and DTS, align them"),o=n):n=o);var T=(i=t[8])+9;if(e.size<=T)return null;e.size-=T;for(var s=new Uint8Array(e.size),S=0,l=E.length;SI){T-=I;continue}t=t.subarray(T),I-=T,T=0}s.set(t,r),r+=I}return a&&(a-=i+3),{data:s,pts:o,dts:n,len:a}}return null}var Yo=(function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var a=t.prototype;return a.resetInitSegment=function(t,a,i,o){e.prototype.resetInitSegment.call(this,t,a,i,o),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:a,duration:o,inputTimeScale:9e4,dropped:0}},t.probe=function(e){if(!e)return!1;var t=Oe(e,0),a=(null==t?void 0:t.length)||0;if(t&&11===e[a]&&119===e[a+1]&&void 0!==Ne(t)&&Bo(e,a)<=16)return!1;for(var i=e.length;a1?a-1:0),o=1;o>24&255,E[1]=t>>16&255,E[2]=t>>8&255,E[3]=255&t,E.set(e,4),n=0,t=8;n>24&255,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,o>>24,o>>16&255,o>>8&255,255&o,85,196,0,0]))},e.mdia=function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))},e.mfhd=function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))},e.minf=function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))},e.moof=function(t,a,i){return e.box(e.types.moof,e.mfhd(t),e.traf(i,a))},e.moov=function(t){for(var a=t.length,i=[];a--;)i[a]=e.trak(t[a]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(i).concat(e.mvex(t)))},e.mvex=function(t){for(var a=t.length,i=[];a--;)i[a]=e.trex(t[a]);return e.box.apply(null,[e.types.mvex].concat(i))},e.mvhd=function(t,a){a*=t;var i=Math.floor(a/(Ko+1)),o=Math.floor(a%(Ko+1)),n=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,o>>24,o>>16&255,o>>8&255,255&o,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 e.box(e.types.mvhd,n)},e.sdtp=function(t){var a,i,o=t.samples||[],n=new Uint8Array(4+o.length);for(a=0;a>>8&255),n.push(255&o),n=n.concat(Array.prototype.slice.call(i));for(a=0;a>>8&255),r.push(255&o),r=r.concat(Array.prototype.slice.call(i));var E=e.box(e.types.avcC,new Uint8Array([1,n[3],n[4],n[5],255,224|t.sps.length].concat(n).concat([t.pps.length]).concat(r))),_=t.width,T=t.height,s=t.pixelRatio[0],S=t.pixelRatio[1];return e.box(e.types.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,_>>8&255,255&_,T>>8&255,255&T,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),E,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),e.box(e.types.pasp,new Uint8Array([s>>24,s>>16&255,s>>8&255,255&s,S>>24,S>>16&255,S>>8&255,255&S])))},e.esds=function(e){var t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))},e.audioStsd=function(e){var t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0])},e.mp4a=function(t){return e.box(e.types.mp4a,e.audioStsd(t),e.box(e.types.esds,e.esds(t)))},e.mp3=function(t){return e.box(e.types[".mp3"],e.audioStsd(t))},e.ac3=function(t){return e.box(e.types["ac-3"],e.audioStsd(t),e.box(e.types.dac3,t.config))},e.stsd=function(t){return"audio"===t.type?"mp3"===t.segmentCodec&&"mp3"===t.codec?e.box(e.types.stsd,e.STSD,e.mp3(t)):"ac3"===t.segmentCodec?e.box(e.types.stsd,e.STSD,e.ac3(t)):e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))},e.tkhd=function(t){var a=t.id,i=t.duration*t.timescale,o=t.width,n=t.height,r=Math.floor(i/(Ko+1)),E=Math.floor(i%(Ko+1));return e.box(e.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,a>>24&255,a>>16&255,a>>8&255,255&a,0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,E>>24,E>>16&255,E>>8&255,255&E,0,0,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,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,o>>8&255,255&o,0,0,n>>8&255,255&n,0,0]))},e.traf=function(t,a){var i=e.sdtp(t),o=t.id,n=Math.floor(a/(Ko+1)),r=Math.floor(a%(Ko+1));return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o])),e.box(e.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,r>>24,r>>16&255,r>>8&255,255&r])),e.trun(t,i.length+16+20+8+16+8+8),i)},e.trak=function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.trex=function(t){var a=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},e.trun=function(t,a){var i,o,n,r,E,_,T=t.samples||[],s=T.length,S=12+16*s,l=new Uint8Array(S);for(a+=8+S,l.set(["video"===t.type?1:0,0,15,1,s>>>24&255,s>>>16&255,s>>>8&255,255&s,a>>>24&255,a>>>16&255,a>>>8&255,255&a],0),i=0;i>>24&255,n>>>16&255,n>>>8&255,255&n,r>>>24&255,r>>>16&255,r>>>8&255,255&r,E.isLeading<<2|E.dependsOn,E.isDependedOn<<6|E.hasRedundancy<<4|E.paddingValue<<1|E.isNonSync,61440&E.degradPrio,15&E.degradPrio,_>>>24&255,_>>>16&255,_>>>8&255,255&_],12+16*i);return e.box(e.types.trun,l)},e.initSegment=function(t){e.types||e.init();var a=e.moov(t);return at(e.FTYP,a)},e})();jo.types=void 0,jo.HDLR_TYPES=void 0,jo.STTS=void 0,jo.STSC=void 0,jo.STCO=void 0,jo.STSZ=void 0,jo.VMHD=void 0,jo.SMHD=void 0,jo.STSD=void 0,jo.FTYP=void 0,jo.DINF=void 0;var xo=9e4;function Qo(e,t,a,i){void 0===a&&(a=1),void 0===i&&(i=!1);var o=e*t*a;return i?Math.round(o):o}function Xo(e,t,a,i){return void 0===a&&(a=1),void 0===i&&(i=!1),Qo(e,t,1/a,i)}function $o(e,t){return void 0===t&&(t=!1),Qo(e,1e3,1/xo,t)}function qo(e,t){return void 0===t&&(t=1),Qo(e,xo,1/t)}var Jo=1e4,Zo=1024,en=1152,tn=1536,an=null,on=null,nn=(function(){function e(e,t,a,i){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=a,this.ISGenerated=!1,null===an){var o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);an=o?parseInt(o[1]):0}if(null===on){var n=navigator.userAgent.match(/Safari\/(\d+)/i);on=n?parseInt(n[1]):0}}var t=e.prototype;return t.destroy=function(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null},t.resetTimeStamp=function(e){U.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e},t.resetNextTimestamp=function(){U.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},t.resetInitSegment=function(){U.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0},t.getVideoStartPts=function(e){var t=!1,a=e.reduce((function(e,a){var i=a.pts-e;return i<-4294967296?(t=!0,rn(e,a.pts)):i>0?e:a.pts}),e[0].pts);return t&&U.debug("PTS rollover detected"),a},t.remux=function(e,t,a,i,o,n,r,E){var _,T,s,S,l,I,u=o,A=o,d=e.pid>-1,O=t.pid>-1,c=t.samples.length,R=e.samples.length>0,N=r&&c>0||c>1;if((!d||R)&&(!O||N)||this.ISGenerated||r){if(this.ISGenerated){var m,L,D,p,h=this.videoTrackConfig;!h||t.width===h.width&&t.height===h.height&&(null==(m=t.pixelRatio)?void 0:m[0])===(null==(L=h.pixelRatio)?void 0:L[0])&&(null==(D=t.pixelRatio)?void 0:D[1])===(null==(p=h.pixelRatio)?void 0:p[1])||this.resetInitSegment()}else s=this.generateIS(e,t,o,n);var C,f=this.isVideoContiguous,P=-1;if(N&&(P=En(t.samples),!f&&this.config.forceKeyFrameOnDiscontinuity))if(I=!0,P>0){U.warn("[mp4-remuxer]: Dropped "+P+" out of "+c+" video samples due to a missing keyframe");var B=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(P),t.dropped+=P,C=A+=(t.samples[0].pts-B)/t.inputTimeScale}else-1===P&&(U.warn("[mp4-remuxer]: No keyframe found out of "+c+" video samples"),I=!1);if(this.ISGenerated){if(R&&N){var g=this.getVideoStartPts(t.samples),v=(rn(e.samples[0].pts,g)-g)/t.inputTimeScale;u+=Math.max(0,v),A+=Math.max(0,-v)}if(R){if(e.samplerate||(U.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),s=this.generateIS(e,t,o,n)),T=this.remuxAudio(e,u,this.isAudioContiguous,n,O||N||E===$t.AUDIO?A:void 0),N){var M=T?T.endPTS-T.startPTS:0;t.inputTimeScale||(U.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),s=this.generateIS(e,t,o,n)),_=this.remuxVideo(t,A,f,M)}}else N&&(_=this.remuxVideo(t,A,f,0));_&&(_.firstKeyFrame=P,_.independent=-1!==P,_.firstKeyFramePTS=C)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(a.samples.length&&(l=_n(a,o,this._initPTS,this._initDTS)),i.samples.length&&(S=Tn(i,o,this._initPTS))),{audio:T,video:_,initSegment:s,independent:I,text:S,id3:l}},t.generateIS=function(e,t,a,i){var o,n,r,E=e.samples,_=t.samples,T=this.typeSupported,s={},S=this._initPTS,l=!S||i,I="audio/mp4";if(l&&(o=n=1/0),e.config&&E.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":T.mpeg?(I="audio/mpeg",e.codec=""):T.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3"}s.audio={id:"audio",container:I,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&T.mpeg?new Uint8Array(0):jo.initSegment([e]),metadata:{channelCount:e.channelCount}},l&&(r=e.inputTimeScale,S&&r===S.timescale?l=!1:o=n=E[0].pts-Math.round(r*a))}if(t.sps&&t.pps&&_.length){if(t.timescale=t.inputTimeScale,s.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:jo.initSegment([t]),metadata:{width:t.width,height:t.height}},l)if(r=t.inputTimeScale,S&&r===S.timescale)l=!1;else{var u=this.getVideoStartPts(_),A=Math.round(r*a);n=Math.min(n,rn(_[0].dts,u)-A),o=Math.min(o,u-A)}this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(s).length)return this.ISGenerated=!0,l?(this._initPTS={baseTime:o,timescale:r},this._initDTS={baseTime:n,timescale:r}):o=r=void 0,{tracks:s,initPTS:o,timescale:r}},t.remuxVideo=function(e,t,a,i){var o,n,r=e.inputTimeScale,E=e.samples,_=[],s=E.length,S=this._initPTS,l=this.nextAvcDts,I=8,u=this.videoSampleDuration,A=Number.POSITIVE_INFINITY,d=Number.NEGATIVE_INFINITY,O=!1;if(!a||null===l){var c=t*r,R=E[0].pts-rn(E[0].dts,E[0].pts);an&&null!==l&&Math.abs(c-R-l)<15e3?a=!0:l=c-R}for(var N=S.baseTime*r/S.timescale,m=0;m0?m-1:m].dts&&(O=!0)}O&&E.sort((function(e,t){var a=e.dts-t.dts,i=e.pts-t.pts;return a||i})),o=E[0].dts;var D=(n=E[E.length-1].dts)-o,p=D?Math.round(D/(s-1)):u||e.inputTimeScale/30;if(a){var h=o-l,C=h>p,g=h<-1;if((C||g)&&(C?U.warn("AVC: "+$o(h,!0)+" ms ("+h+"dts) hole between fragments detected at "+t.toFixed(3)):U.warn("AVC: "+$o(-h,!0)+" ms ("+h+"dts) overlapping between fragments detected at "+t.toFixed(3)),!g||l>=E[0].pts||an)){o=l;var v=E[0].pts-h;if(C)E[0].dts=o,E[0].pts=v;else for(var M=0;Mv);M++)E[M].dts-=h,E[M].pts-=h;U.log("Video: Initial PTS/DTS adjusted: "+$o(v,!0)+"/"+$o(o,!0)+", delta: "+$o(h,!0)+" ms")}}for(var W=0,y=0,b=o=Math.max(0,o),G=0;G0?J.dts-E[q-1].dts:p;if(re=q>0?J.pts-E[q-1].pts:p,Ee.stretchShortVideoTrack&&null!==this.nextAudioPts){var Te=Math.floor(Ee.maxBufferHole*r),se=(i?A+i*r:this.nextAudioPts)-J.pts;se>Te?((u=se-_e)<0?u=_e:j=!0,U.log("[mp4-remuxer]: It is approximately "+se/90+" ms to the next segment; using duration "+u/90+" ms for the last video frame.")):u=_e}else u=_e}var Se=Math.round(J.pts-J.dts);x=Math.min(x,u),X=Math.max(X,u),Q=Math.min(Q,re),$=Math.max($,re),_.push(new Sn(J.key,u,ee,Se))}if(_.length)if(an){if(an<70){var le=_[0].flags;le.dependsOn=2,le.isNonSync=0}}else if(on&&$-Q0&&(i&&Math.abs(O-d)<9e3||Math.abs(rn(u[0].pts-c,O)-d)<20*_),u.forEach((function(e){e.pts=rn(e.pts-c,O)})),!a||d<0){if(u=u.filter((function(e){return e.pts>=0})),!u.length)return;d=0===o?0:i&&!I?Math.max(0,O):u[0].pts}if("aac"===e.segmentCodec)for(var R=this.config.maxAudioFramesDrift,N=0,m=d;N=R*_&&h0))return;G+=A;try{W=new Uint8Array(G)}catch(e){return void this.observer.emit(f.ERROR,f.ERROR,{type:P.MUX_ERROR,details:B.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:G,reason:"fail allocating audio mdat "+G})}S||(new DataView(W.buffer).setUint32(0,G),W.set(jo.types.mdat,4))}W.set(w,A);var z=w.byteLength;A+=z,l.push(new Sn(!0,E,z,0)),b=Y}var K=l.length;if(K){var j=l[l.length-1];this.nextAudioPts=d=b+r*j.duration;var x=S?new Uint8Array(0):jo.moof(e.sequenceNumber++,y/r,T({},e,{samples:l}));e.samples=[];var Q=y/n,X=d/n,$={data1:x,data2:W,startPTS:Q,endPTS:X,startDTS:Q,endDTS:X,type:"audio",hasAudio:!0,hasVideo:!1,nb:K};return this.isAudioContiguous=!0,$}},t.remuxEmptyAudio=function(e,t,a,i){var o=e.inputTimeScale,n=o/(e.samplerate?e.samplerate:o),r=this.nextAudioPts,E=this._initDTS,_=9e4*E.baseTime/E.timescale,T=(null!==r?r:i.startDTS*o)+_,s=i.endDTS*o+_,S=n*Zo,l=Math.ceil((s-T)/S),I=zo.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(U.warn("[mp4-remuxer]: remux empty Audio"),I){for(var u=[],A=0;A4294967296;)e+=a;return e}function En(e){for(var t=0;t0?this.lastEndTime=c:(U.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var R=!!I.audio,N=!!I.video,m="";R&&(m+="audio"),N&&(m+="video");var L={data1:S,startPTS:O,startDTS:O,endPTS:c,endDTS:c,type:m,hasAudio:R,hasVideo:N,nb:1,dropped:0};return s.audio="audio"===L.type?L:void 0,s.video="audio"!==L.type?L:void 0,s.initSegment=l,s.id3=_n(a,o,_,_),i.samples.length&&(s.text=Tn(i,o,_)),s},e})();function In(e,t,a,i){if(null===e)return!0;var o=Math.max(i,1),n=t-e.baseTime/e.timescale;return Math.abs(n-a)>o}function un(e,t){var a=null==e?void 0:e.codec;if(a&&a.length>4)return a;if(t===z.AUDIO){if("ec-3"===a||"ac-3"===a||"alac"===a)return a;if("fLaC"===a||"Opus"===a)return Mt(a,!1);var i="mp4a.40.5";return U.info('Parsed audio codec "'+a+'" or audio object type not handled. Using "'+i+'"'),i}return U.warn('Unhandled video codec "'+a+'"'),"hvc1"===a||"hev1"===a?"hvc1.1.6.L120.90":"av01"===a?"av01.0.04M.08":"avc1.42e01e"}try{sn=self.performance.now.bind(self.performance)}catch(e){U.debug("Unable to use Performance API on this environment"),sn=null==te?void 0:te.Date.now}var An=[{demux:Po,remux:ln},{demux:Go,remux:nn},{demux:Co,remux:nn},{demux:Yo,remux:nn}];An.splice(2,0,{demux:go,remux:nn});var dn=(function(){function e(e,t,a,i,o){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=a,this.vendor=i,this.id=o}var t=e.prototype;return t.configure=function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()},t.push=function(e,t,a,i){var o=this,n=a.transmuxing;n.executeStart=sn();var r=new Uint8Array(e),E=this.currentTransmuxState,_=this.transmuxConfig;i&&(this.currentTransmuxState=i);var T=i||E,s=T.contiguous,S=T.discontinuity,l=T.trackSwitch,I=T.accurateTimeOffset,u=T.timeOffset,A=T.initSegmentChange,d=_.audioCodec,O=_.videoCodec,c=_.defaultInitPts,R=_.duration,N=_.initSegmentData,m=On(r,t);if(m&&"AES-128"===m.method){var L=this.getDecrypter();if(!L.isSync())return this.decryptionPromise=L.webCryptoDecrypt(r,m.key.buffer,m.iv.buffer).then((function(e){var t=o.push(e,null,a);return o.decryptionPromise=null,t})),this.decryptionPromise;var D=L.softwareDecrypt(r,m.key.buffer,m.iv.buffer);if(a.part>-1&&(D=L.flush()),!D)return n.executeEnd=sn(),cn(a);r=new Uint8Array(D)}var p=this.needsProbing(S,l);if(p){var h=this.configureTransmuxer(r);if(h)return U.warn("[transmuxer] "+h.message),this.observer.emit(f.ERROR,f.ERROR,{type:P.MEDIA_ERROR,details:B.FRAG_PARSING_ERROR,fatal:!1,error:h,reason:h.message}),n.executeEnd=sn(),cn(a)}(S||l||A||p)&&this.resetInitSegment(N,d,O,R,t),(S||A||p)&&this.resetInitialTimestamp(c),s||this.resetContiguity();var C=this.transmux(r,m,u,I,a),g=this.currentTransmuxState;return g.contiguous=!0,g.discontinuity=!1,g.trackSwitch=!1,n.executeEnd=sn(),C},t.flush=function(e){var t=this,a=e.transmuxing;a.executeStart=sn();var i=this.decrypter,o=this.currentTransmuxState,n=this.decryptionPromise;if(n)return n.then((function(){return t.flush(e)}));var r=[],E=o.timeOffset;if(i){var _=i.flush();_&&r.push(this.push(_,null,e))}var T=this.demuxer,s=this.remuxer;if(!T||!s)return a.executeEnd=sn(),[cn(e)];var S=T.flush(E);return Rn(S)?S.then((function(a){return t.flushRemux(r,a,e),r})):(this.flushRemux(r,S,e),r)},t.flushRemux=function(e,t,a){var i=t.audioTrack,o=t.videoTrack,n=t.id3Track,r=t.textTrack,E=this.currentTransmuxState,_=E.accurateTimeOffset,T=E.timeOffset;U.log("[transmuxer.ts]: Flushed fragment "+a.sn+(a.part>-1?" p: "+a.part:"")+" of level "+a.level);var s=this.remuxer.remux(i,o,n,r,T,_,!0,this.id);e.push({remuxResult:s,chunkMeta:a}),a.transmuxing.executeEnd=sn()},t.resetInitialTimestamp=function(e){var t=this.demuxer,a=this.remuxer;t&&a&&(t.resetTimeStamp(e),a.resetTimeStamp(e))},t.resetContiguity=function(){var e=this.demuxer,t=this.remuxer;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())},t.resetInitSegment=function(e,t,a,i,o){var n=this.demuxer,r=this.remuxer;n&&r&&(n.resetInitSegment(e,t,a,i),r.resetInitSegment(e,t,a,o))},t.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},t.transmux=function(e,t,a,i,o){return t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,a,i,o):this.transmuxUnencrypted(e,a,i,o)},t.transmuxUnencrypted=function(e,t,a,i){var o=this.demuxer.demux(e,t,!1,!this.config.progressive),n=o.audioTrack,r=o.videoTrack,E=o.id3Track,_=o.textTrack;return{remuxResult:this.remuxer.remux(n,r,E,_,t,a,!1,this.id),chunkMeta:i}},t.transmuxSampleAes=function(e,t,a,i,o){var n=this;return this.demuxer.demuxSampleAes(e,t,a).then((function(e){return{remuxResult:n.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,a,i,!1,n.id),chunkMeta:o}}))},t.configureTransmuxer=function(e){for(var t,a=this.config,i=this.observer,o=this.typeSupported,n=this.vendor,r=0,E=An.length;r0&&null!=(null==t?void 0:t.key)&&null!==t.iv&&null!=t.method&&(a=t),a}var cn=function(e){return{remuxResult:{},chunkMeta:e}};function Rn(e){return"then"in e&&e.then instanceof Function}var Nn=function(e,t,a,i,o){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=a,this.duration=i,this.defaultInitPts=o||null},mn=function(e,t,a,i,o,n){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=a,this.trackSwitch=i,this.timeOffset=o,this.initSegmentChange=n},Ln={exports:{}};!(function(e){var t=Object.prototype.hasOwnProperty,a="~";function i(){}function o(e,t,a){this.fn=e,this.context=t,this.once=a||!1}function n(e,t,i,n,r){if("function"!=typeof i)throw new TypeError("The listener must be a function");var E=new o(i,n||e,r),_=a?a+t:t;return e._events[_]?e._events[_].fn?e._events[_]=[e._events[_],E]:e._events[_].push(E):(e._events[_]=E,e._eventsCount++),e}function r(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function E(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(a=!1)),E.prototype.eventNames=function(){var e,i,o=[];if(0===this._eventsCount)return o;for(i in e=this._events)t.call(e,i)&&o.push(a?i.slice(1):i);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},E.prototype.listeners=function(e){var t=a?a+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var o=0,n=i.length,r=new Array(n);o1&&_.id===(null==d?void 0:d.stats.chunkCount),L=!c&&(1===R||0===R&&(1===N||m&&N<=0)),D=self.performance.now();(c||R||0===o.stats.parsing.start)&&(o.stats.parsing.start=D),!n||!N&&L||(n.stats.parsing.start=D);var p=!(d&&(null==(s=o.initSegment)?void 0:s.url)===(null==(S=d.initSegment)?void 0:S.url)),h=new mn(O,L,E,c,u,p);if(!L||O||p){U.log("[transmuxer-interface, "+o.type+"]: Starting new transmux session for sn: "+_.sn+" p: "+_.part+" level: "+_.level+" id: "+_.id+"\n discontinuity: "+O+"\n trackSwitch: "+c+"\n contiguous: "+L+"\n accurateTimeOffset: "+E+"\n timeOffset: "+u+"\n initSegmentChange: "+p);var C=new Nn(a,i,t,r,T);this.configureTransmuxer(C)}if(this.frag=o,this.part=n,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:A,chunkMeta:_,state:h},e instanceof ArrayBuffer?[e]:[]);else if(I){var f=I.push(e,A,_,h);Rn(f)?(I.async=!0,f.then((function(e){l.handleTransmuxComplete(e)})).catch((function(e){l.transmuxerError(e,_,"transmuxer-interface push error")}))):(I.async=!1,this.handleTransmuxComplete(f))}},t.flush=function(e){var t=this;e.transmuxing.start=self.performance.now();var a=this.transmuxer;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(a){var i=a.flush(e);Rn(i)||a.async?(Rn(i)||(i=Promise.resolve(i)),i.then((function(a){t.handleFlushResult(a,e)})).catch((function(a){t.transmuxerError(a,e,"transmuxer-interface flush error")}))):this.handleFlushResult(i,e)}},t.transmuxerError=function(e,t,a){this.hls&&(this.error=e,this.hls.trigger(f.ERROR,{type:P.MEDIA_ERROR,details:B.FRAG_PARSING_ERROR,chunkMeta:t,fatal:!1,error:e,err:e,reason:a}))},t.handleFlushResult=function(e,t){var a=this;e.forEach((function(e){a.handleTransmuxComplete(e)})),this.onFlush(t)},t.onWorkerMessage=function(e){var t=e.data,a=this.hls;switch(t.event){case"init":var i,o=null==(i=this.workerContext)?void 0:i.objectURL;o&&self.URL.revokeObjectURL(o);break;case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":U[t.data.logType]&&U[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,a.trigger(t.event,t.data)}},t.configureTransmuxer=function(e){var t=this.transmuxer;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)},t.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},e})();function Wn(e,t){if(e.length!==t.length)return!1;for(var a=0;a0&&-1===e?(this.log("Override startPosition with lastCurrentTime @"+t.toFixed(3)),e=t,this.state=Xi.IDLE):(this.loadedmetadata=!1,this.state=Xi.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()},a.doTick=function(){switch(this.state){case Xi.IDLE:this.doTickIdle();break;case Xi.WAITING_TRACK:var t,a=this.levels,i=this.trackId,o=null==a||null==(t=a[i])?void 0:t.details;if(o){if(this.waitForCdnTuneIn(o))break;this.state=Xi.WAITING_INIT_PTS}break;case Xi.FRAG_LOADING_WAITING_RETRY:var n,r=performance.now(),E=this.retryDate;if(!E||r>=E||null!=(n=this.media)&&n.seeking){var _=this.levels,T=this.trackId;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((null==_?void 0:_[T])||null),this.state=Xi.IDLE}break;case Xi.WAITING_INIT_PTS:var s=this.waitingData;if(s){var S=s.frag,l=s.part,I=s.cache,u=s.complete;if(void 0!==this.initPTS[S.cc]){this.waitingData=null,this.waitingVideoCC=-1,this.state=Xi.FRAG_LOADING;var A={frag:S,part:l,payload:I.flush(),networkDetails:null};this._handleFragmentLoadProgress(A),u&&e.prototype._handleFragmentLoadComplete.call(this,A)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log("Waiting fragment cc ("+S.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var d=this.getLoadPosition(),O=Ci.bufferInfo(this.mediaBuffer,d,this.config.maxBufferHole);xa(O.end,this.config.maxFragLookUpTolerance,S)<0&&(this.log("Waiting fragment cc ("+S.cc+") @ "+S.start+" cancelled because another fragment at "+O.end+" is needed"),this.clearWaitingFragment())}}else this.state=Xi.IDLE}this.onTickEnd()},a.clearWaitingFragment=function(){var e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=Xi.IDLE)},a.resetLoadingState=function(){this.clearWaitingFragment(),e.prototype.resetLoadingState.call(this)},a.onTickEnd=function(){var e=this.media;null!=e&&e.readyState&&(this.lastCurrentTime=e.currentTime)},a.doTickIdle=function(){var e=this.hls,t=this.levels,a=this.media,i=this.trackId,o=e.config;if((a||!this.startFragRequested&&o.startFragPrefetch)&&null!=t&&t[i]){var n=t[i],r=n.details;if(!r||r.live&&this.levelLastLoaded!==n||this.waitForCdnTuneIn(r))this.state=Xi.WAITING_TRACK;else{var E=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&E&&(this.bufferFlushed=!1,this.afterBufferFlushed(E,z.AUDIO,$t.AUDIO));var _=this.getFwdBufferInfo(E,$t.AUDIO);if(null!==_){var T=this.bufferedTrack,s=this.switchingTrack;if(!s&&this._streamEnded(_,r))return e.trigger(f.BUFFER_EOS,{type:"audio"}),void(this.state=Xi.ENDED);var S=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,$t.MAIN),l=_.len,I=this.getMaxBufferLength(null==S?void 0:S.len),u=r.fragments,A=u[0].start,d=this.flushing?this.getLoadPosition():_.end;if(s&&a){var O=this.getLoadPosition();T&&!yn(s.attrs,T.attrs)&&(d=O),r.PTSKnown&&OA||_.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),a.currentTime=A+.05)}if(!(l>=I&&!s&&dS.end+r.targetduration;if(N||(null==S||!S.len)&&_.len){var m=this.getAppendedFrag(c.start,$t.MAIN);if(null===m)return;if(R||(R=!!m.gap||!!N&&0===S.len),N&&!R||R&&_.nextStart&&_.nextStart-1)o=n[E];else{var _=Ii(r,this.tracks);o=this.tracks[_]}}var T=this.findTrackId(o);-1===T&&o&&(T=this.findTrackId(null));var s={audioTracks:n};this.log("Updating audio tracks, "+n.length+" track(s) found in group(s): "+(null==a?void 0:a.join(","))),this.hls.trigger(f.AUDIO_TRACKS_UPDATED,s);var S=this.trackId;if(-1!==T&&-1===S)this.setAudioTrack(T);else if(n.length&&-1===S){var l,I=new Error("No audio track selected for current audio group-ID(s): "+(null==(l=this.groupIds)?void 0:l.join(","))+" track count: "+n.length);this.warn(I.message),this.hls.trigger(f.ERROR,{type:P.MEDIA_ERROR,details:B.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:I})}}else this.shouldReloadPlaylist(o)&&this.setAudioTrack(this.trackId)}},a.onError=function(e,t){!t.fatal&&t.context&&(t.context.type!==Xt.AUDIO_TRACK||t.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(t.context.groupId)||(this.requestScheduled=-1,this.checkRetry(t)))},a.setAudioOption=function(e){var t=this.hls;if(t.config.audioPreference=e,e){var a=this.allAudioTracks;if(this.selectDefaultTrack=!1,a.length){var i=this.currentTrack;if(i&&ui(e,i,di))return i;var o=Ii(e,this.tracksInGroup,di);if(o>-1){var n=this.tracksInGroup[o];return this.setAudioTrack(o),n}if(i){var r=t.loadLevel;-1===r&&(r=t.firstAutoLevel);var E=Oi(e,t.levels,a,r,di);if(-1===E)return null;t.nextLoadLevel=E}if(e.channels||e.audioCodec){var _=Ii(e,a);if(_>-1)return a[_]}}}return null},a.setAudioTrack=function(e){var t=this.tracksInGroup;if(e<0||e>=t.length)this.warn("Invalid audio track id: "+e);else{this.clearTimer(),this.selectDefaultTrack=!1;var a=this.currentTrack,o=t[e],n=o.details&&!o.details.live;if(!(e===this.trackId&&o===a&&n||(this.log("Switching to audio-track "+e+' "'+o.name+'" lang:'+o.lang+" group:"+o.groupId+" channels:"+o.channels),this.trackId=e,this.currentTrack=o,this.hls.trigger(f.AUDIO_TRACK_SWITCHING,i({},o)),n))){var r=this.switchParams(o.url,null==a?void 0:a.details);this.loadPlaylist(r)}}},a.findTrackId=function(e){for(var t=this.tracksInGroup,a=0;a=o[E].start&&r<=o[E].end){n=o[E];break}var _=a.start+a.duration;n?n.end=_:(n={start:r,end:_},o.push(n)),this.fragmentTracker.fragBuffered(a),this.fragBufferedComplete(a,null)}}},a.onBufferFlushing=function(e,t){var a=t.startOffset,i=t.endOffset;if(0===a&&i!==Number.POSITIVE_INFINITY){var o=i-1;if(o<=0)return;t.endOffsetSubtitles=Math.max(0,o),this.tracksBuffered.forEach((function(e){for(var t=0;t=o.length||r!==i)&&E){this.log("Subtitle track "+r+" loaded ["+n.startSN+","+n.endSN+"]"+(n.lastPartSn?"[part-"+n.lastPartSn+"-"+n.lastPartIndex+"]":"")+",duration:"+n.totalduration),this.mediaBuffer=this.mediaBufferTimeRanges;var _=0;if(n.live||null!=(a=E.details)&&a.live){var T=this.mainDetails;if(n.deltaUpdateFailed||!T)return;var s,S=T.fragments[0];E.details?0===(_=this.alignPlaylists(n,E.details,null==(s=this.levelLastLoaded)?void 0:s.details))&&S&&Ma(n,_=S.start):n.hasProgramDateTime&&T.hasProgramDateTime?(Ui(n,T),_=n.fragments[0].start):S&&Ma(n,_=S.start)}E.details=n,this.levelLastLoaded=E,this.startFragRequested||!this.mainDetails&&n.live||this.setStartPosition(this.mainDetails||n,_),this.tick(),n.live&&!this.fragCurrent&&this.media&&this.state===Xi.IDLE&&(ja(null,n.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),E.details=void 0))}}else this.warn("Subtitle tracks were reset while loading level "+r)},a._handleFragmentLoadComplete=function(e){var t=this,a=e.frag,i=e.payload,o=a.decryptdata,n=this.hls;if(!this.fragContextChanged(a)&&i&&i.byteLength>0&&null!=o&&o.key&&o.iv&&"AES-128"===o.method){var r=performance.now();this.decrypter.decrypt(new Uint8Array(i),o.key.buffer,o.iv.buffer).catch((function(e){throw n.trigger(f.ERROR,{type:P.MEDIA_ERROR,details:B.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:a}),e})).then((function(e){var t=performance.now();n.trigger(f.FRAG_DECRYPTED,{frag:a,payload:e,stats:{tstart:r,tdecrypt:t}})})).catch((function(e){t.warn(e.name+": "+e.message),t.state=Xi.IDLE}))}},a.doTick=function(){if(this.media){if(this.state===Xi.IDLE){var e=this.currentTrackId,t=this.levels,a=null==t?void 0:t[e];if(!a||!t.length||!a.details)return;var i=this.config,o=this.getLoadPosition(),n=Ci.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],o,i.maxBufferHole),r=n.end,E=n.len,_=this.getFwdBufferInfo(this.media,$t.MAIN),T=a.details;if(E>this.getMaxBufferLength(null==_?void 0:_.len)+T.levelTargetDuration)return;var s=T.fragments,S=s.length,l=T.edge,I=null,u=this.fragPrevious;if(rl-A?0:A;!(I=ja(u,s,Math.max(s[0].start,r),d))&&u&&u.start>>=0)>i-1)throw new DOMException("Failed to execute '"+t+"' on 'TimeRanges': The index provided ("+a+") is greater than the maximum bound ("+i+")");return e[a][t]};this.buffered={get length(){return e.length},end:function(a){return t("end",a,e.length)},start:function(a){return t("start",a,e.length)}}},wn=(function(e){function t(t){var a;return(a=e.call(this,t,"[subtitle-track-controller]")||this).media=null,a.tracks=[],a.groupIds=null,a.tracksInGroup=[],a.trackId=-1,a.currentTrack=null,a.selectDefaultTrack=!0,a.queuedDefaultTrack=-1,a.asyncPollTrackChange=function(){return a.pollTrackChange(0)},a.useTextTrackPolling=!1,a.subtitlePollingInterval=-1,a._subtitleDisplay=!0,a.onTextTracksChanged=function(){if(a.useTextTrackPolling||self.clearInterval(a.subtitlePollingInterval),a.media&&a.hls.config.renderTextTracksNatively){for(var e=null,t=ra(a.media.textTracks),i=0;i-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))},a.pollTrackChange=function(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)},a.onMediaDetaching=function(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),ra(this.media.textTracks).forEach((function(e){aa(e)})),this.subtitleTrack=-1,this.media=null)},a.onManifestLoading=function(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0},a.onManifestParsed=function(e,t){this.tracks=t.subtitleTracks},a.onSubtitleTrackLoaded=function(e,t){var a=t.id,i=t.groupId,o=t.details,n=this.tracksInGroup[a];if(n&&n.groupId===i){var r=n.details;n.details=t.details,this.log("Subtitle track "+a+' "'+n.name+'" lang:'+n.lang+" group:"+i+" loaded ["+o.startSN+"-"+o.endSN+"]"),a===this.trackId&&this.playlistLoaded(a,t,r)}else this.warn("Subtitle track with id:"+a+" and group:"+i+" not found in active group "+(null==n?void 0:n.groupId))},a.onLevelLoading=function(e,t){this.switchLevel(t.level)},a.onLevelSwitching=function(e,t){this.switchLevel(t.level)},a.switchLevel=function(e){var t=this.hls.levels[e];if(t){var a=t.subtitleGroups||null,i=this.groupIds,o=this.currentTrack;if(!a||(null==i?void 0:i.length)!==(null==a?void 0:a.length)||null!=a&&a.some((function(e){return-1===(null==i?void 0:i.indexOf(e))}))){this.groupIds=a,this.trackId=-1,this.currentTrack=null;var n=this.tracks.filter((function(e){return!a||-1!==a.indexOf(e.groupId)}));if(n.length)this.selectDefaultTrack&&!n.some((function(e){return e.default}))&&(this.selectDefaultTrack=!1),n.forEach((function(e,t){e.id=t}));else if(!o&&!this.tracksInGroup.length)return;this.tracksInGroup=n;var r=this.hls.config.subtitlePreference;if(!o&&r){this.selectDefaultTrack=!1;var E=Ii(r,n);if(E>-1)o=n[E];else{var _=Ii(r,this.tracks);o=this.tracks[_]}}var T=this.findTrackId(o);-1===T&&o&&(T=this.findTrackId(null));var s={subtitleTracks:n};this.log("Updating subtitle tracks, "+n.length+' track(s) found in "'+(null==a?void 0:a.join(","))+'" group-id'),this.hls.trigger(f.SUBTITLE_TRACKS_UPDATED,s),-1!==T&&-1===this.trackId&&this.setSubtitleTrack(T)}else this.shouldReloadPlaylist(o)&&this.setSubtitleTrack(this.trackId)}},a.findTrackId=function(e){for(var t=this.tracksInGroup,a=this.selectDefaultTrack,i=0;i-1){var o=this.tracksInGroup[i];return this.setSubtitleTrack(i),o}if(a)return null;var n=Ii(e,t);if(n>-1)return t[n]}}return null},a.loadPlaylist=function(t){e.prototype.loadPlaylist.call(this);var a=this.currentTrack;if(this.shouldLoadPlaylist(a)&&a){var i=a.id,o=a.groupId,n=a.url;if(t)try{n=t.addDirectives(n)}catch(e){this.warn("Could not construct new URL with HLS Delivery Directives: "+e)}this.log("Loading subtitle playlist for id "+i),this.hls.trigger(f.SUBTITLE_TRACK_LOADING,{url:n,id:i,groupId:o,deliveryDirectives:t||null})}},a.toggleTrackModes=function(){var e=this.media;if(e){var t,a=ra(e.textTracks),i=this.currentTrack;if(i&&((t=a.filter((function(e){return bn(i,e)}))[0])||this.warn('Unable to find subtitle TextTrack with name "'+i.name+'" and language "'+i.lang+'"')),[].slice.call(a).forEach((function(e){"disabled"!==e.mode&&e!==t&&(e.mode="disabled")})),t){var o=this.subtitleDisplay?"showing":"hidden";t.mode!==o&&(t.mode=o)}}},a.setSubtitleTrack=function(e){var t=this.tracksInGroup;if(this.media)if(e<-1||e>=t.length||!p(e))this.warn("Invalid subtitle track id: "+e);else{this.clearTimer(),this.selectDefaultTrack=!1;var a=this.currentTrack,i=t[e]||null;if(this.trackId=e,this.currentTrack=i,this.toggleTrackModes(),i){var o=!!i.details&&!i.details.live;if(e!==this.trackId||i!==a||!o){this.log("Switching to subtitle-track "+e+(i?' "'+i.name+'" lang:'+i.lang+" group:"+i.groupId:""));var n=i.id,r=i.groupId,E=void 0===r?"":r,_=i.name,T=i.type,s=i.url;this.hls.trigger(f.SUBTITLE_TRACK_SWITCH,{id:n,groupId:E,name:_,type:T,url:s});var S=this.switchParams(i.url,null==a?void 0:a.details);this.loadPlaylist(S)}}else this.hls.trigger(f.SUBTITLE_TRACK_SWITCH,{id:e})}else this.queuedDefaultTrack=e},E(t,[{key:"subtitleDisplay",get:function(){return this._subtitleDisplay},set:function(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}},{key:"allSubtitleTracks",get:function(){return this.tracks}},{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}}]),t})(Za),Yn=(function(){function e(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}var t=e.prototype;return t.append=function(e,t,a){var i=this.queues[t];i.push(e),1!==i.length||a||this.executeNext(t)},t.insertAbort=function(e,t){this.queues[t].unshift(e),this.executeNext(t)},t.appendBlocker=function(e){var t,a=new Promise((function(e){t=e})),i={execute:t,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(i,e),a},t.executeNext=function(e){var t=this.queues[e];if(t.length){var a=t[0];try{a.execute()}catch(t){U.warn('[buffer-operation-queue]: Exception executing "'+e+'" SourceBuffer operation: '+t),a.onError(t);var i=this.buffers[e];null!=i&&i.updating||this.shiftAndExecuteNext(e)}}},t.shiftAndExecuteNext=function(e){this.queues[e].shift(),this.executeNext(e)},t.current=function(e){return this.queues[e][0]},e})(),zn=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,Kn=(function(){function e(e){var t=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=function(e){t.hls&&t.hls.pauseBuffering()},this._onStartStreaming=function(e){t.hls&&t.hls.resumeBuffering()},this._onMediaSourceOpen=function(){var e=t.media,a=t.mediaSource;t.log("Media source opened"),e&&(e.removeEventListener("emptied",t._onMediaEmptied),t.updateMediaElementDuration(),t.hls.trigger(f.MEDIA_ATTACHED,{media:e,mediaSource:a})),a&&a.removeEventListener("sourceopen",t._onMediaSourceOpen),t.checkPendingTracks()},this._onMediaSourceClose=function(){t.log("Media source closed")},this._onMediaSourceEnded=function(){t.log("Media source ended")},this._onMediaEmptied=function(){var e=t.mediaSrc,a=t._objectUrl;e!==a&&U.error("Media element src was set while attaching MediaSource ("+a+" > "+e+")")},this.hls=e;var a="[buffer-controller]";this.appendSource=e.config.preferManagedMediaSource,this.log=U.log.bind(U,a),this.warn=U.warn.bind(U,a),this.error=U.error.bind(U,a),this._initSourceBuffer(),this.registerListeners()}var t=e.prototype;return t.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},t.destroy=function(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null},t.registerListeners=function(){var e=this.hls;e.on(f.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.MANIFEST_PARSED,this.onManifestParsed,this),e.on(f.BUFFER_RESET,this.onBufferReset,this),e.on(f.BUFFER_APPENDING,this.onBufferAppending,this),e.on(f.BUFFER_CODECS,this.onBufferCodecs,this),e.on(f.BUFFER_EOS,this.onBufferEos,this),e.on(f.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(f.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(f.FRAG_PARSED,this.onFragParsed,this),e.on(f.FRAG_CHANGED,this.onFragChanged,this)},t.unregisterListeners=function(){var e=this.hls;e.off(f.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.MANIFEST_PARSED,this.onManifestParsed,this),e.off(f.BUFFER_RESET,this.onBufferReset,this),e.off(f.BUFFER_APPENDING,this.onBufferAppending,this),e.off(f.BUFFER_CODECS,this.onBufferCodecs,this),e.off(f.BUFFER_EOS,this.onBufferEos,this),e.off(f.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(f.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(f.FRAG_PARSED,this.onFragParsed,this),e.off(f.FRAG_CHANGED,this.onFragChanged,this)},t._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new Yn(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null},t.onManifestLoading=function(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null},t.onManifestParsed=function(e,t){var a=2;(t.audio&&!t.video||!t.altAudio)&&(a=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=a,this.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},t.onMediaAttaching=function(e,t){var a=this.media=t.media,i=mt(this.appendSource);if(a&&i){var o,n=this.mediaSource=new i;this.log("created media source: "+(null==(o=n.constructor)?void 0:o.name)),n.addEventListener("sourceopen",this._onMediaSourceOpen),n.addEventListener("sourceended",this._onMediaSourceEnded),n.addEventListener("sourceclose",this._onMediaSourceClose),n.addEventListener("startstreaming",this._onStartStreaming),n.addEventListener("endstreaming",this._onEndStreaming);var r=this._objectUrl=self.URL.createObjectURL(n);if(this.appendSource)try{a.removeAttribute("src");var E=self.ManagedMediaSource;a.disableRemotePlayback=a.disableRemotePlayback||E&&n instanceof E,jn(a),xn(a,r),a.load()}catch(e){a.src=r}else a.src=r;a.addEventListener("emptied",this._onMediaEmptied)}},t.onMediaDetaching=function(){var e=this.media,t=this.mediaSource,a=this._objectUrl;if(t){if(this.log("media source detaching"),"open"===t.readyState)try{t.endOfStream()}catch(e){this.warn("onMediaDetaching: "+e.message+" while calling endOfStream")}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming),e&&(e.removeEventListener("emptied",this._onMediaEmptied),a&&self.URL.revokeObjectURL(a),this.mediaSrc===a?(e.removeAttribute("src"),this.appendSource&&jn(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(f.MEDIA_DETACHED,void 0)},t.onBufferReset=function(){var e=this;this.getSourceBufferTypes().forEach((function(t){e.resetBuffer(t)})),this._initSourceBuffer()},t.resetBuffer=function(e){var t=this.sourceBuffer[e];try{var a;t&&(this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,null!=(a=this.mediaSource)&&a.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t))}catch(t){this.warn("onBufferReset "+e,t)}},t.onBufferCodecs=function(e,t){var a=this,i=this.getSourceBufferTypes().length,o=Object.keys(t);if(o.forEach((function(e){if(i){var o=a.tracks[e];if(o&&"function"==typeof o.buffer.changeType){var n,r=t[e],E=r.id,_=r.codec,T=r.levelCodec,s=r.container,S=r.metadata,l=Wt(o.codec,o.levelCodec),I=null==l?void 0:l.replace(zn,"$1"),u=Wt(_,T),A=null==(n=u)?void 0:n.replace(zn,"$1");if(u&&I!==A){"audio"===e.slice(0,5)&&(u=Mt(u,a.hls.config.preferManagedMediaSource));var d=s+";codecs="+u;a.appendChangeType(e,d),a.log("switching codec "+l+" to "+u),a.tracks[e]={buffer:o.buffer,codec:_,container:s,levelCodec:T,metadata:S,id:E}}}}else a.pendingTracks[e]=t[e]})),!i){var n=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==n&&(this.log(n+" bufferCodec event(s) expected "+o.join(",")),this.bufferCodecEventsExpected=n),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks()}},t.appendChangeType=function(e,t){var a=this,i=this.operationQueue,o={execute:function(){var o=a.sourceBuffer[e];o&&(a.log("changing "+e+" sourceBuffer type to "+t),o.changeType(t)),i.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(t){a.warn("Failed to change "+e+" SourceBuffer type",t)}};i.append(o,e,!!this.pendingTracks[e])},t.onBufferAppending=function(e,t){var a=this,i=this.hls,o=this.operationQueue,n=this.tracks,r=t.data,E=t.type,_=t.frag,T=t.part,s=t.chunkMeta,S=s.buffering[E],l=self.performance.now();S.start=l;var I=_.stats.buffering,u=T?T.stats.buffering:null;0===I.start&&(I.start=l),u&&0===u.start&&(u.start=l);var A=n.audio,d=!1;"audio"===E&&"audio/mpeg"===(null==A?void 0:A.container)&&(d=!this.lastMpegAudioChunk||1===s.id||this.lastMpegAudioChunk.sn!==s.sn,this.lastMpegAudioChunk=s);var O=_.start,c={execute:function(){if(S.executeStart=self.performance.now(),d){var e=a.sourceBuffer[E];if(e){var t=O-e.timestampOffset;Math.abs(t)>=.1&&(a.log("Updating audio SourceBuffer timestampOffset to "+O+" (delta: "+t+") sn: "+_.sn+")"),e.timestampOffset=O)}}a.appendExecutor(r,E)},onStart:function(){},onComplete:function(){var e=self.performance.now();S.executeEnd=S.end=e,0===I.first&&(I.first=e),u&&0===u.first&&(u.first=e);var t=a.sourceBuffer,i={};for(var o in t)i[o]=Ci.getBuffered(t[o]);a.appendErrors[E]=0,"audio"===E||"video"===E?a.appendErrors.audiovideo=0:(a.appendErrors.audio=0,a.appendErrors.video=0),a.hls.trigger(f.BUFFER_APPENDED,{type:E,frag:_,part:T,chunkMeta:s,parent:_.type,timeRanges:i})},onError:function(e){var t={type:P.MEDIA_ERROR,parent:_.type,details:B.BUFFER_APPEND_ERROR,sourceBufferName:E,frag:_,part:T,chunkMeta:s,error:e,err:e,fatal:!1};if(e.code===DOMException.QUOTA_EXCEEDED_ERR)t.details=B.BUFFER_FULL_ERROR;else{var o=++a.appendErrors[E];t.details=B.BUFFER_APPEND_ERROR,a.warn("Failed "+o+"/"+i.config.appendErrorMaxRetry+' times to append segment in "'+E+'" sourceBuffer'),o>=i.config.appendErrorMaxRetry&&(t.fatal=!0)}i.trigger(f.ERROR,t)}};o.append(c,E,!!this.pendingTracks[E])},t.onBufferFlushing=function(e,t){var a=this,i=this.operationQueue,o=function(e){return{execute:a.removeExecutor.bind(a,e,t.startOffset,t.endOffset),onStart:function(){},onComplete:function(){a.hls.trigger(f.BUFFER_FLUSHED,{type:e})},onError:function(t){a.warn("Failed to remove from "+e+" SourceBuffer",t)}}};t.type?i.append(o(t.type),t.type):this.getSourceBufferTypes().forEach((function(e){i.append(o(e),e)}))},t.onFragParsed=function(e,t){var a=this,i=t.frag,o=t.part,n=[],r=o?o.elementaryStreams:i.elementaryStreams;r[z.AUDIOVIDEO]?n.push("audiovideo"):(r[z.AUDIO]&&n.push("audio"),r[z.VIDEO]&&n.push("video"));var E=function(){var e=self.performance.now();i.stats.buffering.end=e,o&&(o.stats.buffering.end=e);var t=o?o.stats:i.stats;a.hls.trigger(f.FRAG_BUFFERED,{frag:i,part:o,stats:t,id:i.type})};0===n.length&&this.warn("Fragments must have at least one ElementaryStreamType set. type: "+i.type+" level: "+i.level+" sn: "+i.sn),this.blockBuffers(E,n)},t.onFragChanged=function(e,t){this.trimBuffers()},t.onBufferEos=function(e,t){var a=this;this.getSourceBufferTypes().reduce((function(e,i){var o=a.sourceBuffer[i];return!o||t.type&&t.type!==i||(o.ending=!0,o.ended||(o.ended=!0,a.log(i+" sourceBuffer now EOS"))),e&&!(o&&!o.ended)}),!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers((function(){a.getSourceBufferTypes().forEach((function(e){var t=a.sourceBuffer[e];t&&(t.ending=!1)}));var e=a.mediaSource;e&&"open"===e.readyState?(a.log("Calling mediaSource.endOfStream()"),e.endOfStream()):e&&a.log("Could not call mediaSource.endOfStream(). mediaSource.readyState: "+e.readyState)})))},t.onLevelUpdated=function(e,t){var a=t.details;a.fragments.length&&(this.details=a,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},t.trimBuffers=function(){var e=this.hls,t=this.details,a=this.media;if(a&&null!==t&&this.getSourceBufferTypes().length){var i=e.config,o=a.currentTime,n=t.levelTargetDuration,r=t.live&&null!==i.liveBackBufferLength?i.liveBackBufferLength:i.backBufferLength;if(p(r)&&r>0){var E=Math.max(r,n),_=Math.floor(o/n)*n-E;this.flushBackBuffer(o,n,_)}if(p(i.frontBufferFlushThreshold)&&i.frontBufferFlushThreshold>0){var T=Math.max(i.maxBufferLength,i.frontBufferFlushThreshold),s=Math.max(T,n),S=Math.floor(o/n)*n+s;this.flushFrontBuffer(o,n,S)}}},t.flushBackBuffer=function(e,t,a){var i=this,o=this.details,n=this.sourceBuffer;this.getSourceBufferTypes().forEach((function(r){var E=n[r];if(E){var _=Ci.getBuffered(E);if(_.length>0&&a>_.start(0)){if(i.hls.trigger(f.BACK_BUFFER_REACHED,{bufferEnd:a}),null!=o&&o.live)i.hls.trigger(f.LIVE_BACK_BUFFER_REACHED,{bufferEnd:a});else if(E.ended&&_.end(_.length-1)-e<2*t)return void i.log("Cannot flush "+r+" back buffer while SourceBuffer is in ended state");i.hls.trigger(f.BUFFER_FLUSHING,{startOffset:0,endOffset:a,type:r})}}}))},t.flushFrontBuffer=function(e,t,a){var i=this,o=this.sourceBuffer;this.getSourceBufferTypes().forEach((function(n){var r=o[n];if(r){var E=Ci.getBuffered(r),_=E.length;if(_<2)return;var T=E.start(_-1),s=E.end(_-1);if(a>T||e>=T&&e<=s)return;if(r.ended&&e-s<2*t)return void i.log("Cannot flush "+n+" front buffer while SourceBuffer is in ended state");i.hls.trigger(f.BUFFER_FLUSHING,{startOffset:T,endOffset:1/0,type:n})}}))},t.updateMediaElementDuration=function(){if(this.details&&this.media&&this.mediaSource&&"open"===this.mediaSource.readyState){var e=this.details,t=this.hls,a=this.media,i=this.mediaSource,o=e.fragments[0].start+e.totalduration,n=a.duration,r=p(i.duration)?i.duration:0;e.live&&t.config.liveDurationInfinity?(i.duration=1/0,this.updateSeekableRange(e)):(o>r&&o>n||!p(n))&&(this.log("Updating Media Source duration to "+o.toFixed(3)),i.duration=o)}},t.updateSeekableRange=function(e){var t=this.mediaSource,a=e.fragments;if(a.length&&e.live&&null!=t&&t.setLiveSeekableRange){var i=Math.max(0,a[0].start),o=Math.max(i,i+e.totalduration);this.log("Media Source duration is set to "+t.duration+". Setting seekable range to "+i+"-"+o+"."),t.setLiveSeekableRange(i,o)}},t.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.operationQueue,a=this.pendingTracks,i=Object.keys(a).length;if(i&&(!e||2===i||"audiovideo"in a)){this.createSourceBuffers(a),this.pendingTracks={};var o=this.getSourceBufferTypes();if(o.length)this.hls.trigger(f.BUFFER_CREATED,{tracks:this.tracks}),o.forEach((function(e){t.executeNext(e)}));else{var n=new Error("could not create source buffer for media codec(s)");this.hls.trigger(f.ERROR,{type:P.MEDIA_ERROR,details:B.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:n,reason:n.message})}}},t.createSourceBuffers=function(e){var t=this,a=this.sourceBuffer,i=this.mediaSource;if(!i)throw Error("createSourceBuffers called when mediaSource was null");var o=function(o){if(!a[o]){var n=e[o];if(!n)throw Error("source buffer exists for track "+o+", however track does not");var r=n.levelCodec||n.codec;r&&"audio"===o.slice(0,5)&&(r=Mt(r,t.hls.config.preferManagedMediaSource));var E=n.container+";codecs="+r;t.log("creating sourceBuffer("+E+")");try{var _=a[o]=i.addSourceBuffer(E),T=o;t.addBufferListener(T,"updatestart",t._onSBUpdateStart),t.addBufferListener(T,"updateend",t._onSBUpdateEnd),t.addBufferListener(T,"error",t._onSBUpdateError),t.addBufferListener(T,"bufferedchange",(function(e,a){var i=a.removedRanges;null!=i&&i.length&&t.hls.trigger(f.BUFFER_FLUSHED,{type:o})})),t.tracks[o]={buffer:_,codec:r,container:n.container,levelCodec:n.levelCodec,metadata:n.metadata,id:n.id}}catch(e){t.error("error while trying to add sourceBuffer: "+e.message),t.hls.trigger(f.ERROR,{type:P.MEDIA_ERROR,details:B.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,sourceBufferName:o,mimeType:E})}}};for(var n in e)o(n)},t._onSBUpdateStart=function(e){this.operationQueue.current(e).onStart()},t._onSBUpdateEnd=function(e){var t;if("closed"!==(null==(t=this.mediaSource)?void 0:t.readyState)){var a=this.operationQueue;a.current(e).onComplete(),a.shiftAndExecuteNext(e)}else this.resetBuffer(e)},t._onSBUpdateError=function(e,t){var a,i=new Error(e+" SourceBuffer error. MediaSource readyState: "+(null==(a=this.mediaSource)?void 0:a.readyState));this.error(""+i,t),this.hls.trigger(f.ERROR,{type:P.MEDIA_ERROR,details:B.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:i,fatal:!1});var o=this.operationQueue.current(e);o&&o.onError(i)},t.removeExecutor=function(e,t,a){var i=this.media,o=this.mediaSource,n=this.operationQueue,r=this.sourceBuffer[e];if(!i||!o||!r)return this.warn("Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),void n.shiftAndExecuteNext(e);var E=p(i.duration)?i.duration:1/0,_=p(o.duration)?o.duration:1/0,T=Math.max(0,t),s=Math.min(a,E,_);s>T&&(!r.ending||r.ended)?(r.ended=!1,this.log("Removing ["+T+","+s+"] from the "+e+" SourceBuffer"),r.remove(T,s)):n.shiftAndExecuteNext(e)},t.appendExecutor=function(e,t){var a=this.sourceBuffer[t];if(a)a.ended=!1,a.appendBuffer(e);else if(!this.pendingTracks[t])throw new Error("Attempting to append to the "+t+" SourceBuffer, but it does not exist")},t.blockBuffers=function(e,t){var a=this;if(void 0===t&&(t=this.getSourceBufferTypes()),!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(e);var i=this.operationQueue,o=t.map((function(e){return i.appendBlocker(e)}));Promise.all(o).then((function(){e(),t.forEach((function(e){var t=a.sourceBuffer[e];null!=t&&t.updating||i.shiftAndExecuteNext(e)}))}))},t.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},t.addBufferListener=function(e,t,a){var i=this.sourceBuffer[e];if(i){var o=a.bind(this,e);this.listeners[e].push({event:t,listener:o}),i.addEventListener(t,o)}},t.removeBufferListeners=function(e){var t=this.sourceBuffer[e];t&&this.listeners[e].forEach((function(e){t.removeEventListener(e.event,e.listener)}))},E(e,[{key:"mediaSrc",get:function(){var e,t=(null==(e=this.media)?void 0:e.firstChild)||this.media;return null==t?void 0:t.src}}]),e})();function jn(e){var t=e.querySelectorAll("source");[].slice.call(t).forEach((function(t){e.removeChild(t)}))}function xn(e,t){var a=self.document.createElement("source");a.type="video/mp4",a.src=t,e.appendChild(a)}var Qn={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},Xn=function(e){var t=e;return Qn.hasOwnProperty(e)&&(t=Qn[e]),String.fromCharCode(t)},$n=15,qn=100,Jn={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Zn={17:2,18:4,21:6,22:8,23:10,19:13,20:15},er={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},tr={25:2,26:4,29:6,30:8,31:10,27:13,28:15},ar=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],ir=(function(){function e(){this.time=null,this.verboseLevel=0}return e.prototype.log=function(e,t){if(this.verboseLevel>=e){var a="function"==typeof t?t():t;U.log(this.time+" ["+e+"] "+a)}},e})(),or=function(e){for(var t=[],a=0;aqn&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=qn)},t.moveCursor=function(e){var t=this.pos+e;if(e>1)for(var a=this.pos+1;a=144&&this.backSpace();var a=Xn(e);this.pos>=qn?this.logger.log(0,(function(){return"Cannot insert "+e.toString(16)+" ("+a+") at position "+t.pos+". Skipping it!"})):(this.chars[this.pos].setChar(a,this.currPenState),this.moveCursor(1))},t.clearFromPos=function(e){var t;for(t=e;t0&&(a=e?"["+t.join(" | ")+"]":t.join("\n")),a},t.getTextAndFormat=function(){return this.rows},e})(),Tr=(function(){function e(e,t,a){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new _r(a),this.nonDisplayedMemory=new _r(a),this.lastOutputScreen=new _r(a),this.currRollUpRow=this.displayedMemory.rows[$n-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=a}var t=e.prototype;return t.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[$n-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},t.getHandler=function(){return this.outputFilter},t.setHandler=function(e){this.outputFilter=e},t.setPAC=function(e){this.writeScreen.setPAC(e)},t.setBkgData=function(e){this.writeScreen.setBkgData(e)},t.setMode=function(e){e!==this.mode&&(this.mode=e,this.logger.log(2,(function(){return"MODE="+e})),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)},t.insertChars=function(e){for(var t=this,a=0;a=46,t.italics)t.foreground="white";else{var a=Math.floor(e/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=i[a]}this.logger.log(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},t.outputDataUpdate=function(e){void 0===e&&(e=!1);var t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))},t.cueSplitAtTime=function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))},e})(),sr=(function(){function e(e,t,a){this.channels=void 0,this.currentChannel=0,this.cmdHistory=Ir(),this.logger=void 0;var i=this.logger=new ir;this.channels=[null,new Tr(e,t,i),new Tr(e+1,a,i)]}var t=e.prototype;return t.getHandler=function(e){return this.channels[e].getHandler()},t.setHandler=function(e,t){this.channels[e].setHandler(t)},t.addData=function(e,t){var a,i,o,n=!1;this.logger.time=e;for(var r=0;r ("+or([i,o])+")"),(a=this.parseCmd(i,o))||(a=this.parseMidrow(i,o)),a||(a=this.parsePAC(i,o)),a||(a=this.parseBackgroundAttributes(i,o)),!a&&(n=this.parseChars(i,o))){var E=this.currentChannel;E&&E>0?this.channels[E].insertChars(n):this.logger.log(2,"No channel found yet. TEXT-MODE?")}a||n||this.logger.log(2,"Couldn't parse cleaned data "+or([i,o])+" orig: "+or([t[r],t[r+1]]))}},t.parseCmd=function(e,t){var a=this.cmdHistory;if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=33&&t<=35))return!1;if(lr(e,t,a))return Sr(null,null,a),this.logger.log(3,"Repeated command ("+or([e,t])+") is dropped"),!0;var i=20===e||21===e||23===e?1:2,o=this.channels[i];return 20===e||21===e||28===e||29===e?32===t?o.ccRCL():33===t?o.ccBS():34===t?o.ccAOF():35===t?o.ccAON():36===t?o.ccDER():37===t?o.ccRU(2):38===t?o.ccRU(3):39===t?o.ccRU(4):40===t?o.ccFON():41===t?o.ccRDC():42===t?o.ccTR():43===t?o.ccRTD():44===t?o.ccEDM():45===t?o.ccCR():46===t?o.ccENM():47===t&&o.ccEOC():o.ccTO(t-32),Sr(e,t,a),this.currentChannel=i,!0},t.parseMidrow=function(e,t){var a=0;if((17===e||25===e)&&t>=32&&t<=47){if((a=17===e?1:2)!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;var i=this.channels[a];return!!i&&(i.ccMIDROW(t),this.logger.log(3,"MIDROW ("+or([e,t])+")"),!0)}return!1},t.parsePAC=function(e,t){var a,i=this.cmdHistory;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127||(16===e||24===e)&&t>=64&&t<=95))return!1;if(lr(e,t,i))return Sr(null,null,i),!0;var o=e<=23?1:2;a=t>=64&&t<=95?1===o?Jn[e]:er[e]:1===o?Zn[e]:tr[e];var n=this.channels[o];return!!n&&(n.setPAC(this.interpretPAC(a,t)),Sr(e,t,i),this.currentChannel=o,!0)},t.interpretPAC=function(e,t){var a,i={color:null,italics:!1,indent:null,underline:!1,row:e};return a=t>95?t-96:t-64,i.underline=!(1&~a),a<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(a/2)]:a<=15?(i.italics=!0,i.color="white"):i.indent=4*Math.floor((a-16)/2),i},t.parseChars=function(e,t){var a,i,o=null,n=null;if(e>=25?(a=2,n=e-8):(a=1,n=e),n>=17&&n<=19?(i=17===n?t+80:18===n?t+112:t+144,this.logger.log(2,"Special char '"+Xn(i)+"' in channel "+a),o=[i]):e>=32&&e<=127&&(o=0===t?[e]:[e,t]),o){var r=or(o);this.logger.log(3,"Char codes = "+r.join(",")),Sr(e,t,this.cmdHistory)}return o},t.parseBackgroundAttributes=function(e,t){var a;if(!((16===e||24===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=45&&t<=47))return!1;var i={};16===e||24===e?(a=Math.floor((t-32)/2),i.background=ar[a],t%2==1&&(i.background=i.background+"_semi")):45===t?i.background="transparent":(i.foreground="black",47===t&&(i.underline=!0));var o=e<=23?1:2;return this.channels[o].setBkgData(i),Sr(e,t,this.cmdHistory),!0},t.reset=function(){for(var e=0;ee)&&(this.startTime=e),this.endTime=t,this.screen=a,this.timelineController.createCaptionsTrack(this.trackName)},t.reset=function(){this.cueRanges=[],this.startTime=null},e})(),Ar=(function(){if(null!=te&&te.VTTCue)return self.VTTCue;var e=["","lr","rl"],t=["start","middle","end","left","right"];function a(e,t){if("string"!=typeof t)return!1;if(!Array.isArray(e))return!1;var a=t.toLowerCase();return!!~e.indexOf(a)&&a}function i(t){return a(e,t)}function o(e){return a(t,e)}function n(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),i=1;i100)throw new Error("Position must be between 0 and 100.");c=e,this.hasBeenReset=!0}})),Object.defineProperty(r,"positionAlign",n({},E,{get:function(){return R},set:function(e){var t=o(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");R=t,this.hasBeenReset=!0}})),Object.defineProperty(r,"size",n({},E,{get:function(){return N},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");N=e,this.hasBeenReset=!0}})),Object.defineProperty(r,"align",n({},E,{get:function(){return m},set:function(e){var t=o(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");m=t,this.hasBeenReset=!0}})),r.displayState=void 0}return r.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},r})(),dr=(function(){function e(){}return e.prototype.decode=function(e,t){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))},e})();function Or(e){function t(e,t,a,i){return 3600*(0|e)+60*(0|t)+(0|a)+parseFloat(i||0)}var a=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return a?parseFloat(a[2])>59?t(a[2],a[3],0,a[4]):t(a[1],a[2],a[3],a[4]):null}var cr=(function(){function e(){this.values=Object.create(null)}var t=e.prototype;return t.set=function(e,t){this.get(e)||""===t||(this.values[e]=t)},t.get=function(e,t,a){return a?this.has(e)?this.values[e]:t[a]:this.has(e)?this.values[e]:t},t.has=function(e){return e in this.values},t.alt=function(e,t,a){for(var i=0;i=0&&a<=100)return this.set(e,a),!0}return!1},e})();function Rr(e,t,a,i){var o=i?e.split(i):[e];for(var n in o)if("string"==typeof o[n]){var r=o[n].split(a);2===r.length&&t(r[0],r[1])}}var Nr=new Ar(0,0,""),mr="middle"===Nr.align?"middle":"center";function Lr(e,t,a){var i=e;function o(){var t=Or(e);if(null===t)throw new Error("Malformed timestamp: "+i);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function n(e,t){var i=new cr;Rr(e,(function(e,t){var o;switch(e){case"region":for(var n=a.length-1;n>=0;n--)if(a[n].id===t){i.set(e,a[n].region);break}break;case"vertical":i.alt(e,t,["rl","lr"]);break;case"line":o=t.split(","),i.integer(e,o[0]),i.percent(e,o[0])&&i.set("snapToLines",!1),i.alt(e,o[0],["auto"]),2===o.length&&i.alt("lineAlign",o[1],["start",mr,"end"]);break;case"position":o=t.split(","),i.percent(e,o[0]),2===o.length&&i.alt("positionAlign",o[1],["start",mr,"end","line-left","line-right","auto"]);break;case"size":i.percent(e,t);break;case"align":i.alt(e,t,["start",mr,"end","left","right"])}}),/:/,/\s/),t.region=i.get("region",null),t.vertical=i.get("vertical","");var o=i.get("line","auto");"auto"===o&&-1===Nr.line&&(o=-1),t.line=o,t.lineAlign=i.get("lineAlign","start"),t.snapToLines=i.get("snapToLines",!0),t.size=i.get("size",100),t.align=i.get("align",mr);var n=i.get("position","auto");"auto"===n&&50===Nr.position&&(n="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=n}function r(){e=e.replace(/^\s+/,"")}if(r(),t.startTime=o(),r(),"--\x3e"!==e.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+i);e=e.slice(3),r(),t.endTime=o(),r(),n(e,t)}function Dr(e){return e.replace(//gi,"\n")}var pr=(function(){function e(){this.state="INITIAL",this.buffer="",this.decoder=new dr,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var t=e.prototype;return t.parse=function(e){var t=this;function a(){var e=t.buffer,a=0;for(e=Dr(e);a9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!(p(t)&&p(a)&&p(i)&&p(o)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+e);return t+=1e3*a,t+=6e4*i,t+=36e5*o},Pr=function(e){for(var t=5381,a=e.length;a;)t=33*t^e.charCodeAt(--a);return(t>>>0).toString()};function Br(e,t,a){return Pr(e.toString())+Pr(t.toString())+Pr(a)}var gr=function(e,t,a){var i=e[t],o=e[i.prevCC];if(!o||!o.new&&i.new)return e.ccOffset=e.presentationOffset=i.start,void(i.new=!1);for(;null!=(n=o)&&n.new;){var n;e.ccOffset+=i.start-o.start,i.new=!1,o=e[(i=o).prevCC]}e.presentationOffset=a};function vr(e,t,a,i,o,n,r){var E,_=new pr,T=Be(new Uint8Array(e)).trim().replace(hr,"\n").split("\n"),s=[],S=t?qo(t.baseTime,t.timescale):0,l="00:00.000",I=0,u=0,A=!0;_.oncue=function(e){var n=a[i],r=a.ccOffset,_=(I-S)/9e4;if(null!=n&&n.new&&(void 0!==u?r=a.ccOffset=n.start:gr(a,i,_)),_){if(!t)return void(E=new Error("Missing initPTS for VTT MPEGTS"));r=_-a.presentationOffset}var T=e.endTime-e.startTime,l=rn(9e4*(e.startTime+r-u),9e4*o)/9e4;e.startTime=Math.max(l,0),e.endTime=Math.max(l+T,0);var A=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(A)),e.id||(e.id=Br(e.startTime,e.endTime,A)),e.endTime>0&&s.push(e)},_.onparsingerror=function(e){E=e},_.onflush=function(){E?r(E):n(s)},T.forEach((function(e){if(A){if(Cr(e,"X-TIMESTAMP-MAP=")){A=!1,e.slice(16).split(",").forEach((function(e){Cr(e,"LOCAL:")?l=e.slice(6):Cr(e,"MPEGTS:")&&(I=parseInt(e.slice(7)))}));try{u=fr(l)/1e3}catch(e){E=e}return}""===e&&(A=!1)}_.parse(e+"\n")})),_.flush()}var Mr="stpp.ttml.im1t",Wr=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,yr=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,br={left:"start",center:"center",right:"end",start:"start",end:"end"};function Ur(e,t,a,i){var o=we(new Uint8Array(e),["mdat"]);if(0!==o.length){var n=o.map((function(e){return Be(e)})),r=Xo(t.baseTime,1,t.timescale);try{n.forEach((function(e){return a(Gr(e,r))}))}catch(e){i(e)}}else i(new Error("Could not parse IMSC1 mdat"))}function Gr(e,t){var a=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("tt")[0];if(!a)throw new Error("Invalid ttml");var i={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},o=Object.keys(i).reduce((function(e,t){return e[t]=a.getAttribute("ttp:"+t)||i[t],e}),{}),n="preserve"!==a.getAttribute("xml:space"),r=Fr(kr(a,"styling","style")),E=Fr(kr(a,"layout","region")),_=kr(a,"body","[begin]");return[].map.call(_,(function(e){var a=Vr(e,n);if(!a||!e.hasAttribute("begin"))return null;var i=zr(e.getAttribute("begin"),o),_=zr(e.getAttribute("dur"),o),s=zr(e.getAttribute("end"),o);if(null===i)throw Yr(e);if(null===s){if(null===_)throw Yr(e);s=i+_}var S=new Ar(i-t,s-t,a);S.id=Br(S.startTime,S.endTime,S.text);var l=Hr(E[e.getAttribute("region")],r[e.getAttribute("style")],r),I=l.textAlign;if(I){var u=br[I];u&&(S.lineAlign=u),S.align=I}return T(S,l),S})).filter((function(e){return null!==e}))}function kr(e,t,a){var i=e.getElementsByTagName(t)[0];return i?[].slice.call(i.querySelectorAll(a)):[]}function Fr(e){return e.reduce((function(e,t){var a=t.getAttribute("xml:id");return a&&(e[a]=t),e}),{})}function Vr(e,t){return[].slice.call(e.childNodes).reduce((function(e,a,i){var o;return"br"===a.nodeName&&i?e+"\n":null!=(o=a.childNodes)&&o.length?Vr(a,t):t?e+a.textContent.trim().replace(/\s+/g," "):e+a.textContent}),"")}function Hr(e,t,a){var i="http://www.w3.org/ns/ttml#styling",o=null,n=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],r=null!=e&&e.hasAttribute("style")?e.getAttribute("style"):null;return r&&a.hasOwnProperty(r)&&(o=a[r]),n.reduce((function(a,n){var r=wr(t,i,n)||wr(e,i,n)||wr(o,i,n);return r&&(a[n]=r),a}),{})}function wr(e,t,a){return e&&e.hasAttributeNS(t,a)?e.getAttributeNS(t,a):null}function Yr(e){return new Error("Could not parse ttml timestamp "+e)}function zr(e,t){if(!e)return null;var a=Or(e);return null===a&&(Wr.test(e)?a=Kr(e,t):yr.test(e)&&(a=jr(e,t))),a}function Kr(e,t){var a=Wr.exec(e),i=(0|a[4])+(0|a[5])/t.subFrameRate;return 3600*(0|a[1])+60*(0|a[2])+(0|a[3])+i/t.frameRate}function jr(e,t){var a=yr.exec(e),i=Number(a[1]);switch(a[2]){case"h":return 3600*i;case"m":return 60*i;case"ms":return 1e3*i;case"f":return i/t.frameRate;case"t":return i/t.tickRate}return i}var xr=(function(){function e(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=qr(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(f.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(f.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(f.FRAG_LOADING,this.onFragLoading,this),e.on(f.FRAG_LOADED,this.onFragLoaded,this),e.on(f.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(f.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(f.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(f.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(f.BUFFER_FLUSHING,this.onBufferFlushing,this)}var t=e.prototype;return t.destroy=function(){var e=this.hls;e.off(f.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(f.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(f.FRAG_LOADING,this.onFragLoading,this),e.off(f.FRAG_LOADED,this.onFragLoaded,this),e.off(f.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(f.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(f.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(f.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(f.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0},t.initCea608Parsers=function(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){var e=new ur(this,"textTrack1"),t=new ur(this,"textTrack2"),a=new ur(this,"textTrack3"),i=new ur(this,"textTrack4");this.cea608Parser1=new sr(1,e,t),this.cea608Parser2=new sr(3,a,i)}},t.addCues=function(e,t,a,i,o){for(var n=!1,r=o.length;r--;){var E=o[r],_=$r(E[0],E[1],t,a);if(_>=0&&(E[0]=Math.min(E[0],t),E[1]=Math.max(E[1],a),n=!0,_/(a-t)>.5))return}if(n||o.push([t,a]),this.config.renderTextTracksNatively){var T=this.captionsTracks[e];this.Cues.newCue(T,t,a,i)}else{var s=this.Cues.newCue(null,t,a,i);this.hls.trigger(f.CUES_PARSED,{type:"captions",cues:s,track:e})}},t.onInitPtsFound=function(e,t){var a=this,i=t.frag,o=t.id,n=t.initPTS,r=t.timescale,E=this.unparsedVttFrags;"main"===o&&(this.initPTS[i.cc]={baseTime:n,timescale:r}),E.length&&(this.unparsedVttFrags=[],E.forEach((function(e){a.onFragLoaded(f.FRAG_LOADED,e)})))},t.getExistingTrack=function(e,t){var a=this.media;if(a)for(var i=0;ii.cc||_.trigger(f.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:t})}))}else r.push(e)},t._fallbackToIMSC1=function(e,t){var a=this,i=this.tracks[e.level];i.textCodec||Ur(t,this.initPTS[e.cc],(function(){i.textCodec=Mr,a._parseIMSC1(e,t)}),(function(){i.textCodec="wvtt"}))},t._appendCues=function(e,t){var a=this.hls;if(this.config.renderTextTracksNatively){var i=this.textTracks[t];if(!i||"disabled"===i.mode)return;e.forEach((function(e){return ta(i,e)}))}else{var o=this.tracks[t];if(!o)return;var n=o.default?"default":"subtitles"+t;a.trigger(f.CUES_PARSED,{type:"subtitles",cues:e,track:n})}},t.onFragDecrypted=function(e,t){t.frag.type===$t.SUBTITLE&&this.onFragLoaded(f.FRAG_LOADED,t)},t.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},t.onFragParsingUserdata=function(e,t){this.initCea608Parsers();var a=this.cea608Parser1,i=this.cea608Parser2;if(this.enabled&&a&&i){var o=t.frag,n=t.samples;if(o.type!==$t.MAIN||"NONE"!==this.closedCaptionsForLevel(o))for(var r=0;rthis.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}},t.getMaxLevel=function(t){var a=this,i=this.hls.levels;if(!i.length)return-1;var o=i.filter((function(e,i){return a.isLevelAllowed(e)&&i<=t}));return this.clientRect=null,e.getMaxLevelByMediaSize(o,this.mediaWidth,this.mediaHeight)},t.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},t.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},t.getDimensions=function(){if(this.clientRect)return this.clientRect;var e=this.media,t={width:0,height:0};if(e){var a=e.getBoundingClientRect();t.width=a.width,t.height=a.height,t.width||t.height||(t.width=a.right-a.left||e.width||0,t.height=a.bottom-a.top||e.height||0)}return this.clientRect=t,t},t.isLevelAllowed=function(e){return!this.restrictedLevels.some((function(t){return e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height}))},e.getMaxLevelByMediaSize=function(e,t,a){if(null==e||!e.length)return-1;for(var i=function(e,t){return!t||e.width!==t.width||e.height!==t.height},o=e.length-1,n=Math.max(t,a),r=0;r=n||E.height>=n)&&i(E,e[r+1])){o=r;break}}return o},E(e,[{key:"mediaWidth",get:function(){return this.getDimensions().width*this.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*this.contentScaleFactor}},{key:"contentScaleFactor",get:function(){var e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(e){}return e}}]),e})(),Zr=(function(){function e(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}var t=e.prototype;return t.setStreamController=function(e){this.streamController=e},t.registerListeners=function(){this.hls.on(f.MEDIA_ATTACHING,this.onMediaAttaching,this)},t.unregisterListeners=function(){this.hls.off(f.MEDIA_ATTACHING,this.onMediaAttaching,this)},t.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},t.onMediaAttaching=function(e,t){var a=this.hls.config;if(a.capLevelOnFPSDrop){var i=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=i,i&&"function"==typeof i.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),a.fpsDroppedMonitoringPeriod)}},t.checkFPS=function(e,t,a){var i=performance.now();if(t){if(this.lastTime){var o=i-this.lastTime,n=a-this.lastDroppedFrames,r=t-this.lastDecodedFrames,E=1e3*n/o,_=this.hls;if(_.trigger(f.FPS_DROP,{currentDropped:n,currentDecoded:r,totalDroppedFrames:a}),E>0&&n>_.config.fpsDroppedMonitoringThreshold*r){var T=_.currentLevel;U.warn("drop FPS ratio greater than max allowed value for currentLevel: "+T),T>0&&(-1===_.autoLevelCapping||_.autoLevelCapping>=T)&&(T-=1,_.trigger(f.FPS_DROP_LEVEL_CAPPING,{level:T,droppedLevel:_.currentLevel}),_.autoLevelCapping=T,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=a,this.lastDecodedFrames=t}},t.checkFPSInterval=function(){var e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){var t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)},e})(),eE="[eme]",tE=(function(){function e(t){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=e.CDMCleanupPromise?[e.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=U.debug.bind(U,eE),this.log=U.log.bind(U,eE),this.warn=U.warn.bind(U,eE),this.error=U.error.bind(U,eE),this.hls=t,this.config=t.config,this.registerListeners()}var t=e.prototype;return t.destroy=function(){this.unregisterListeners(),this.onMediaDetached();var e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null},t.registerListeners=function(){this.hls.on(f.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(f.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(f.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(f.MANIFEST_LOADED,this.onManifestLoaded,this)},t.unregisterListeners=function(){this.hls.off(f.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(f.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(f.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(f.MANIFEST_LOADED,this.onManifestLoaded,this)},t.getLicenseServerUrl=function(e){var t=this.config,a=t.drmSystems,i=t.widevineLicenseUrl,o=a[e];if(o)return o.licenseUrl;if(e===ae.WIDEVINE&&i)return i;throw new Error('no license server URL configured for key-system "'+e+'"')},t.getServerCertificateUrl=function(e){var t=this.config.drmSystems[e];if(t)return t.serverCertificateUrl;this.log('No Server Certificate in config.drmSystems["'+e+'"]')},t.attemptKeySystemAccess=function(e){var t=this,a=this.hls.levels,i=function(e,t,a){return!!e&&a.indexOf(e)===t},o=a.map((function(e){return e.audioCodec})).filter(i),n=a.map((function(e){return e.videoCodec})).filter(i);return o.length+n.length===0&&n.push("avc1.42e01e"),new Promise((function(a,i){!(function e(r){var E=r.shift();t.getMediaKeysPromise(E,o,n).then((function(e){return a({keySystem:E,mediaKeys:e})})).catch((function(t){r.length?e(r):i(t instanceof rE?t:new rE({type:P.KEY_SYSTEM_ERROR,details:B.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))}))})(e)}))},t.requestMediaKeySystemAccess=function(e,t){var a=this.config.requestMediaKeySystemAccessFunc;if("function"!=typeof a){var i="Configured requestMediaKeySystemAccess is not a function "+a;return null===se&&"http:"===self.location.protocol&&(i="navigator.requestMediaKeySystemAccess is not available over insecure protocol "+location.protocol),Promise.reject(new Error(i))}return a(e,t)},t.getMediaKeysPromise=function(e,t,a){var i=this,o=Se(e,t,a,this.config.drmSystemOptions),n=this.keySystemAccessPromises[e],r=null==n?void 0:n.keySystemAccess;if(!r){this.log('Requesting encrypted media "'+e+'" key-system access with config: '+JSON.stringify(o)),r=this.requestMediaKeySystemAccess(e,o);var E=this.keySystemAccessPromises[e]={keySystemAccess:r};return r.catch((function(t){i.log('Failed to obtain access to key-system "'+e+'": '+t)})),r.then((function(t){i.log('Access for key-system "'+t.keySystem+'" obtained');var a=i.fetchServerCertificate(e);return i.log('Create media-keys for "'+e+'"'),E.mediaKeys=t.createMediaKeys().then((function(t){return i.log('Media-keys created for "'+e+'"'),a.then((function(a){return a?i.setMediaKeysServerCertificate(t,e,a):t}))})),E.mediaKeys.catch((function(t){i.error('Failed to create media-keys for "'+e+'"}: '+t)})),E.mediaKeys}))}return r.then((function(){return n.mediaKeys}))},t.createMediaKeySessionContext=function(e){var t=e.decryptdata,a=e.keySystem,i=e.mediaKeys;this.log('Creating key-system session "'+a+'" keyId: '+ve.hexDump(t.keyId||[]));var o=i.createSession(),n={decryptdata:t,keySystem:a,mediaKeys:i,mediaKeysSession:o,keyStatus:"status-pending"};return this.mediaKeySessions.push(n),n},t.renewKeySession=function(e){var t=e.decryptdata;if(t.pssh){var a=this.createMediaKeySessionContext(e),i=this.getKeyIdString(t),o="cenc";this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(a,o,t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)},t.getKeyIdString=function(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(null===e.keyId)throw new Error("keyId is null");return ve.hexDump(e.keyId)},t.updateKeySession=function(e,t){var a,i=e.mediaKeysSession;return this.log('Updating key-session "'+i.sessionId+'" for keyID '+ve.hexDump((null==(a=e.decryptdata)?void 0:a.keyId)||[])+"\n } (data length: "+(t?t.byteLength:t)+")"),i.update(t)},t.selectKeySystemFormat=function(e){var t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log("Selecting key-system from fragment (sn: "+e.sn+" "+e.type+": "+e.level+") key formats "+t.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise},t.getKeyFormatPromise=function(e){var t=this;return new Promise((function(a,i){var o=_e(t.config),n=e.map(oe).filter((function(e){return!!e&&-1!==o.indexOf(e)}));return t.getKeySystemSelectionPromise(n).then((function(e){var t=e.keySystem,o=Ee(t);o?a(o):i(new Error('Unable to find format for key-system "'+t+'"'))})).catch(i)}))},t.loadKey=function(e){var t=this,a=e.keyInfo.decryptdata,i=this.getKeyIdString(a),o="(keyId: "+i+' format: "'+a.keyFormat+'" method: '+a.method+" uri: "+a.uri+")";this.log("Starting session for key "+o);var n=this.keyIdToKeySessionPromise[i];return n||(n=this.keyIdToKeySessionPromise[i]=this.getKeySystemForKeyPromise(a).then((function(i){var n=i.keySystem,r=i.mediaKeys;return t.throwIfDestroyed(),t.log("Handle encrypted media sn: "+e.frag.sn+" "+e.frag.type+": "+e.frag.level+" using key "+o),t.attemptSetMediaKeys(n,r).then((function(){t.throwIfDestroyed();var e=t.createMediaKeySessionContext({keySystem:n,mediaKeys:r,decryptdata:a}),i="cenc";return t.generateRequestWithPreferredKeySession(e,i,a.pssh,"playlist-key")}))}))).catch((function(e){return t.handleError(e)})),n},t.throwIfDestroyed=function(e){if(!this.hls)throw new Error("invalid state")},t.handleError=function(e){this.hls&&(this.error(e.message),e instanceof rE?this.hls.trigger(f.ERROR,e.data):this.hls.trigger(f.ERROR,{type:P.KEY_SYSTEM_ERROR,details:B.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))},t.getKeySystemForKeyPromise=function(e){var t=this.getKeyIdString(e),a=this.keyIdToKeySessionPromise[t];if(!a){var i=oe(e.keyFormat),o=i?[i]:_e(this.config);return this.attemptKeySystemAccess(o)}return a},t.getKeySystemSelectionPromise=function(e){if(e.length||(e=_e(this.config)),0===e.length)throw new rE({type:P.KEY_SYSTEM_ERROR,details:B.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},"Missing key-system license configuration options "+JSON.stringify({drmSystems:this.config.drmSystems}));return this.attemptKeySystemAccess(e)},t._onMediaEncrypted=function(e){var t=this,a=e.initDataType,i=e.initData;if(this.debug('"'+e.type+'" event: init data type: "'+a+'"'),null!==i){var o,n;if("sinf"===a&&this.config.drmSystems[ae.FAIRPLAY]){var r=be(new Uint8Array(i));try{var E=$(JSON.parse(r).sinf),_=$e(new Uint8Array(E));if(!_)return;o=_.subarray(8,24),n=ae.FAIRPLAY}catch(e){return void this.warn('Failed to parse sinf "encrypted" event message initData')}}else{var T=St(i);if(null===T)return;0===T.version&&T.systemId===ne.WIDEVINE&&T.data&&(o=T.data.subarray(8,24)),n=re(T.systemId)}if(n&&o){for(var s,S=ve.hexDump(o),l=this.keyIdToKeySessionPromise,I=this.mediaKeySessions,u=l[S],A=function(){var e=I[d],n=e.decryptdata;if(n.pssh||!n.keyId)return 0;var r=ve.hexDump(n.keyId);return S===r||-1!==n.uri.replace(/-/g,"").indexOf(S)?(u=l[r],delete l[r],n.pssh=new Uint8Array(i),n.keyId=o,u=l[S]=u.then((function(){return t.generateRequestWithPreferredKeySession(e,a,i,"encrypted-event-key-match")})),1):void 0},d=0;d0)for(var n,r=0,E=o.length;r in key message");return ee(atob(I))},t.setupLicenseXHR=function(e,t,a,i){var o=this,n=this.config.licenseXhrSetup;return n?Promise.resolve().then((function(){if(!a.decryptdata)throw new Error("Key removed");return n.call(o.hls,e,t,a,i)})).catch((function(r){if(!a.decryptdata)throw r;return e.open("POST",t,!0),n.call(o.hls,e,t,a,i)})).then((function(a){return e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:a||i}})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:i}))},t.requestLicense=function(e,t){var a=this,i=this.config.keyLoadPolicy.default;return new Promise((function(o,n){var r=a.getLicenseServerUrl(e.keySystem);a.log("Sending license request to URL: "+r);var E=new XMLHttpRequest;E.responseType="arraybuffer",E.onreadystatechange=function(){if(!a.hls||!e.mediaKeysSession)return n(new Error("invalid state"));if(4===E.readyState)if(200===E.status){a._requestLicenseFailureCount=0;var _=E.response;a.log("License received "+(_ instanceof ArrayBuffer?_.byteLength:_));var T=a.config.licenseResponseCallback;if(T)try{_=T.call(a.hls,E,r,e)}catch(e){a.error(e)}o(_)}else{var s=i.errorRetry,S=s?s.maxNumRetry:0;if(a._requestLicenseFailureCount++,a._requestLicenseFailureCount>S||E.status>=400&&E.status<500)n(new rE({type:P.KEY_SYSTEM_ERROR,details:B.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:E,response:{url:r,data:void 0,code:E.status,text:E.statusText}},"License Request XHR failed ("+r+"). Status: "+E.status+" ("+E.statusText+")"));else{var l=S-a._requestLicenseFailureCount+1;a.warn("Retrying license request, "+l+" attempts left"),a.requestLicense(e,t).then(o,n)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=E,a.setupLicenseXHR(E,r,e,t).then((function(t){var i=t.xhr,o=t.licenseChallenge;e.keySystem==ae.PLAYREADY&&(o=a.unpackPlayReadyKeyMessage(i,o)),i.send(o)}))}))},t.onMediaAttached=function(e,t){if(this.config.emeEnabled){var a=t.media;this.media=a,a.addEventListener("encrypted",this.onMediaEncrypted),a.addEventListener("waitingforkey",this.onWaitingForKey)}},t.onMediaDetached=function(){var t=this,a=this.media,i=this.mediaKeySessions;a&&(a.removeEventListener("encrypted",this.onMediaEncrypted),a.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},It.clearKeyUriToKeyIdMap();var o=i.length;e.CDMCleanupPromise=Promise.all(i.map((function(e){return t.removeSession(e)})).concat(null==a?void 0:a.setMediaKeys(null).catch((function(e){t.log("Could not clear media keys: "+e)})))).then((function(){o&&(t.log("finished closing key sessions and clearing media keys"),i.length=0)})).catch((function(e){t.log("Could not close sessions and clear media keys: "+e)}))},t.onManifestLoading=function(){this.keyFormatPromise=null},t.onManifestLoaded=function(e,t){var a=t.sessionKeys;if(a&&this.config.emeEnabled&&!this.keyFormatPromise){var i=a.reduce((function(e,t){return-1===e.indexOf(t.keyFormat)&&e.push(t.keyFormat),e}),[]);this.log("Selecting key-system from session-keys "+i.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(i)}},t.removeSession=function(e){var t=this,a=e.mediaKeysSession,i=e.licenseXhr;if(a){this.log("Remove licenses and keys and close session "+a.sessionId),e._onmessage&&(a.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(a.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;var o=this.mediaKeySessions.indexOf(e);return o>-1&&this.mediaKeySessions.splice(o,1),a.remove().catch((function(e){t.log("Could not remove session: "+e)})).then((function(){return a.close()})).catch((function(e){t.log("Could not close session: "+e)}))}},e})();tE.CDMCleanupPromise=void 0;var aE,iE,oE,nE,rE=(function(e){function t(t,a){var i;return(i=e.call(this,a)||this).data=void 0,t.error||(t.error=new Error(a)),i.data=t,t.err=t.error,i}return s(t,e),t})(d(Error));(function(e){e.MANIFEST="m",e.AUDIO="a",e.VIDEO="v",e.MUXED="av",e.INIT="i",e.CAPTION="c",e.TIMED_TEXT="tt",e.KEY="k",e.OTHER="o"})(aE||(aE={})),(function(e){e.DASH="d",e.HLS="h",e.SMOOTH="s",e.OTHER="o"})(iE||(iE={})),(function(e){e.OBJECT="CMCD-Object",e.REQUEST="CMCD-Request",e.SESSION="CMCD-Session",e.STATUS="CMCD-Status"})(oE||(oE={}));var EE=((nE={})[oE.OBJECT]=["br","d","ot","tb"],nE[oE.REQUEST]=["bl","dl","mtp","nor","nrr","su"],nE[oE.SESSION]=["cid","pr","sf","sid","st","v"],nE[oE.STATUS]=["bs","rtp"],nE),_E=function e(t,a){this.value=void 0,this.params=void 0,Array.isArray(t)&&(t=t.map((function(t){return t instanceof e?t:new e(t)}))),this.value=t,this.params=a},TE=function(e){this.description=void 0,this.description=e},sE="Dict";function SE(e){return Array.isArray(e)?JSON.stringify(e):e instanceof Map?"Map{}":e instanceof Set?"Set{}":"object"==typeof e?JSON.stringify(e):String(e)}function lE(e,t,a,i){return new Error("failed to "+e+' "'+SE(t)+'" as '+a,{cause:i})}var IE="Bare Item",uE="Boolean",AE="Byte Sequence",dE="Decimal",OE="Integer";function cE(e){return e<-999999999999999||99999999999999912)throw LE(e,dE);var a=t.toString();return a.includes(".")?a:a+".0"}var gE="String";function vE(e){if(RE.test(e))throw LE(e,gE);return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'}function ME(e){return e.description||e.toString().slice(7,-1)}function WE(e){var t=ME(e);if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t))throw LE(t,NE);return t}function yE(e){switch(typeof e){case"number":if(!p(e))throw LE(e,IE);return Number.isInteger(e)?CE(e):BE(e);case"string":return vE(e);case"symbol":return WE(e);case"boolean":return DE(e);case"object":if(e instanceof Date)return fE(e);if(e instanceof Uint8Array)return hE(e);if(e instanceof TE)return WE(e);default:throw LE(e,IE)}}function bE(e){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(e))throw LE(e,mE);return e}function UE(e){return null==e?"":Object.entries(e).map((function(e){var t=e[0],a=e[1];return!0===a?";"+bE(t):";"+bE(t)+"="+yE(a)})).join("")}function GE(e){return e instanceof _E?""+yE(e.value)+UE(e.params):yE(e)}function kE(e){return"("+e.value.map(GE).join(" ")+")"+UE(e.params)}function FE(e,t){var a;if(void 0===t&&(t={whitespace:!0}),"object"!=typeof e)throw LE(e,sE);var i=e instanceof Map?e.entries():Object.entries(e),o=null!=(a=t)&&a.whitespace?" ":"";return Array.from(i).map((function(e){var t=e[0],a=e[1];a instanceof _E==0&&(a=new _E(a));var i=bE(t);return!0===a.value?i+=UE(a.params):(i+="=",Array.isArray(a.value)?i+=kE(a):i+=GE(a)),i})).join(","+o)}function VE(e,t){return FE(e,t)}var HE=function(e){return"ot"===e||"sf"===e||"st"===e},wE=function(e){return"number"==typeof e?p(e):null!=e&&""!==e&&!1!==e};function YE(e,t){var a=new URL(e),i=new URL(t);if(a.origin!==i.origin)return e;for(var o=a.pathname.split("/").slice(1),n=i.pathname.split("/").slice(1,-1);o[0]===n[0];)o.shift(),n.shift();for(;n.length;)n.shift(),o.unshift("..");return o.join("/")}function zE(){try{return crypto.randomUUID()}catch(i){try{var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch(e){var a=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=(a+16*Math.random())%16|0;return a=Math.floor(a/16),("x"==e?t:3&t|8).toString(16)}))}}}var KE=function(e){return Math.round(e)},jE=function(e){return 100*KE(e/100)},xE={br:KE,d:KE,bl:jE,dl:jE,mtp:jE,nor:function(e,t){return null!=t&&t.baseUrl&&(e=YE(e,t.baseUrl)),encodeURIComponent(e)},rtp:jE,tb:KE};function QE(e,t){var a={};if(null==e||"object"!=typeof e)return a;var i=Object.keys(e).sort(),o=T({},xE,null==t?void 0:t.formatters),n=null==t?void 0:t.filter;return i.forEach((function(i){if(null==n||!n(i)){var r=e[i],E=o[i];E&&(r=E(r,t)),"v"===i&&1===r||"pr"==i&&1===r||wE(r)&&(HE(i)&&"string"==typeof r&&(r=new TE(r)),a[i]=r)}})),a}function XE(e,t){return void 0===t&&(t={}),e?VE(QE(e,t),T({whitespace:!1},t)):""}function $E(e,t){var a;if(void 0===t&&(t={}),!e)return{};var i=Object.entries(e),o=Object.entries(EE).concat(Object.entries((null==(a=t)?void 0:a.customHeaderMap)||{})),n=i.reduce((function(e,t){var a,i=t[0],n=t[1],r=(null==(a=o.find((function(e){return e[1].includes(i)})))?void 0:a[0])||oE.REQUEST;return null!=e[r]||(e[r]={}),e[r][i]=n,e}),{});return Object.entries(n).reduce((function(e,a){var i=a[0],o=a[1];return e[i]=XE(o,t),e}),{})}function qE(e,t,a){return T(e,$E(t,a))}var JE="CMCD";function ZE(e,t){if(void 0===t&&(t={}),!e)return"";var a=XE(e,t);return JE+"="+encodeURIComponent(a)}var e_=/CMCD=[^&#]+/;function t_(e,t,a){var i=ZE(t,a);if(!i)return e;if(e_.test(e))return e.replace(e_,i);var o=e.includes("?")?"&":"?";return""+e+o+i}var a_=(function(){function e(e){var t=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){t.initialized&&(t.starved=!0),t.buffering=!0},this.onPlaying=function(){t.initialized||(t.initialized=!0),t.buffering=!1},this.applyPlaylistData=function(e){try{t.apply(e,{ot:aE.MANIFEST,su:!t.initialized})}catch(e){U.warn("Could not generate manifest CMCD data.",e)}},this.applyFragmentData=function(e){try{var a=e.frag,i=t.hls.levels[a.level],o=t.getObjectType(a),n={d:1e3*a.duration,ot:o};o!==aE.VIDEO&&o!==aE.AUDIO&&o!=aE.MUXED||(n.br=i.bitrate/1e3,n.tb=t.getTopBandwidth(o)/1e3,n.bl=t.getBufferLength(o)),t.apply(e,n)}catch(e){U.warn("Could not generate segment CMCD data.",e)}},this.hls=e;var a=this.config=e.config,i=a.cmcd;null!=i&&(a.pLoader=this.createPlaylistLoader(),a.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||zE(),this.cid=i.contentId,this.useHeaders=!0===i.useHeaders,this.includeKeys=i.includeKeys,this.registerListeners())}var t=e.prototype;return t.registerListeners=function(){var e=this.hls;e.on(f.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(f.MEDIA_DETACHED,this.onMediaDetached,this),e.on(f.BUFFER_CREATED,this.onBufferCreated,this)},t.unregisterListeners=function(){var e=this.hls;e.off(f.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(f.MEDIA_DETACHED,this.onMediaDetached,this),e.off(f.BUFFER_CREATED,this.onBufferCreated,this)},t.destroy=function(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=null},t.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},t.onMediaDetached=function(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},t.onBufferCreated=function(e,t){var a,i;this.audioBuffer=null==(a=t.tracks.audio)?void 0:a.buffer,this.videoBuffer=null==(i=t.tracks.video)?void 0:i.buffer},t.createData=function(){var e;return{v:1,sf:iE.HLS,sid:this.sid,cid:this.cid,pr:null==(e=this.media)?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},t.apply=function(e,t){void 0===t&&(t={}),T(t,this.createData());var a=t.ot===aE.INIT||t.ot===aE.VIDEO||t.ot===aE.MUXED;this.starved&&a&&(t.bs=!0,t.su=!0,this.starved=!1),null==t.su&&(t.su=this.buffering);var i=this.includeKeys;i&&(t=Object.keys(t).reduce((function(e,a){return i.includes(a)&&(e[a]=t[a]),e}),{})),this.useHeaders?(e.headers||(e.headers={}),qE(e.headers,t)):e.url=t_(e.url,t)},t.getObjectType=function(e){var t=e.type;return"subtitle"===t?aE.TIMED_TEXT:"initSegment"===e.sn?aE.INIT:"audio"===t?aE.AUDIO:"main"===t?this.hls.audioTracks.length?aE.VIDEO:aE.MUXED:void 0},t.getTopBandwidth=function(e){var t,a=0,i=this.hls;if(e===aE.AUDIO)t=i.audioTracks;else{var o=i.maxAutoLevel,n=o>-1?o+1:i.levels.length;t=i.levels.slice(0,n)}for(var r,E=N(t);!(r=E()).done;){var _=r.value;_.bitrate>a&&(a=_.bitrate)}return a>0?a:NaN},t.getBufferLength=function(e){var t=this.hls.media,a=e===aE.AUDIO?this.audioBuffer:this.videoBuffer;return a&&t?1e3*Ci.bufferInfo(a,t.currentTime,this.config.maxBufferHole).len:NaN},t.createPlaylistLoader=function(){var e=this.config.pLoader,t=this.applyPlaylistData,a=e||this.config.loader;return(function(){function e(e){this.loader=void 0,this.loader=new a(e)}var i=e.prototype;return i.destroy=function(){this.loader.destroy()},i.abort=function(){this.loader.abort()},i.load=function(e,a,i){t(e),this.loader.load(e,a,i)},E(e,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),e})()},t.createFragmentLoader=function(){var e=this.config.fLoader,t=this.applyFragmentData,a=e||this.config.loader;return(function(){function e(e){this.loader=void 0,this.loader=new a(e)}var i=e.prototype;return i.destroy=function(){this.loader.destroy()},i.abort=function(){this.loader.abort()},i.load=function(e,a,i){t(e),this.loader.load(e,a,i)},E(e,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),e})()},e})(),i_=3e5,o_=(function(){function e(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=U.log.bind(U,"[content-steering]:"),this.registerListeners()}var t=e.prototype;return t.registerListeners=function(){var e=this.hls;e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(f.MANIFEST_PARSED,this.onManifestParsed,this),e.on(f.ERROR,this.onError,this)},t.unregisterListeners=function(){var e=this.hls;e&&(e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(f.MANIFEST_PARSED,this.onManifestParsed,this),e.off(f.ERROR,this.onError,this))},t.startLoad=function(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){var e=1e3*this.timeToLoad-(performance.now()-this.updated);if(e>0)return void this.scheduleRefresh(this.uri,e)}this.loadSteeringManifest(this.uri)}},t.stopLoad=function(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()},t.clearTimeout=function(){-1!==this.reloadTimer&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)},t.destroy=function(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null},t.removeLevel=function(e){var t=this.levels;t&&(this.levels=t.filter((function(t){return t!==e})))},t.onManifestLoading=function(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null},t.onManifestLoaded=function(e,t){var a=t.contentSteering;null!==a&&(this.pathwayId=a.pathwayId,this.uri=a.uri,this.started&&this.startLoad())},t.onManifestParsed=function(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks},t.onError=function(e,t){var a=t.errorAction;if((null==a?void 0:a.action)===$a.SendAlternateToPenaltyBox&&a.flags===qa.MoveAllAlternatesMatchingHost){var i=this.levels,o=this.pathwayPriority,n=this.pathwayId;if(t.context){var r=t.context,E=r.groupId,_=r.pathwayId,T=r.type;E&&i?n=this.getPathwayForGroupId(E,T,n):_&&(n=_)}n in this.penalizedPathways||(this.penalizedPathways[n]=performance.now()),!o&&i&&(o=i.reduce((function(e,t){return-1===e.indexOf(t.pathwayId)&&e.push(t.pathwayId),e}),[])),o&&o.length>1&&(this.updatePathwayPriority(o),a.resolved=this.pathwayId!==n),a.resolved||U.warn("Could not resolve "+t.details+' ("'+t.error.message+'") with content-steering for Pathway: '+n+" levels: "+(i?i.length:i)+" priorities: "+JSON.stringify(o)+" penalized: "+JSON.stringify(this.penalizedPathways))}},t.filterParsedLevels=function(e){this.levels=e;var t=this.getLevelsForPathway(this.pathwayId);if(0===t.length){var a=e[0].pathwayId;this.log("No levels found in Pathway "+this.pathwayId+'. Setting initial Pathway to "'+a+'"'),t=this.getLevelsForPathway(a),this.pathwayId=a}return t.length!==e.length?(this.log("Found "+t.length+"/"+e.length+' levels in Pathway "'+this.pathwayId+'"'),t):e},t.getLevelsForPathway=function(e){return null===this.levels?[]:this.levels.filter((function(t){return e===t.pathwayId}))},t.updatePathwayPriority=function(e){var t;this.pathwayPriority=e;var a=this.penalizedPathways,i=performance.now();Object.keys(a).forEach((function(e){i-a[e]>i_&&delete a[e]}));for(var o=0;o0){this.log('Setting Pathway to "'+n+'"'),this.pathwayId=n,Ga(t),this.hls.trigger(f.LEVELS_UPDATED,{levels:t});var _=this.hls.levels[r];E&&_&&this.levels&&(_.attrs["STABLE-VARIANT-ID"]!==E.attrs["STABLE-VARIANT-ID"]&&_.bitrate!==E.bitrate&&this.log("Unstable Pathways change from bitrate "+E.bitrate+" to "+_.bitrate),this.hls.nextLoadLevel=r);break}}}},t.getPathwayForGroupId=function(e,t,a){for(var i=this.getLevelsForPathway(a).concat(this.levels||[]),o=0;o=2&&(0===a.loading.first&&(a.loading.first=Math.max(self.performance.now(),a.loading.start),o.timeout!==o.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),o.timeout=o.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),o.loadPolicy.maxLoadTimeMs-(a.loading.first-a.loading.start)))),4===i)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;var n=t.status,r="text"!==t.responseType;if(n>=200&&n<300&&(r&&t.response||null!==t.responseText)){a.loading.end=Math.max(self.performance.now(),a.loading.first);var E=r?t.response:t.responseText,_="arraybuffer"===t.responseType?E.byteLength:E.length;if(a.loaded=a.total=_,a.bwEstimate=8e3*a.total/(a.loading.end-a.loading.first),!this.callbacks)return;var T=this.callbacks.onProgress;if(T&&T(a,e,E,t),!this.callbacks)return;var s={url:t.responseURL,data:E,code:n};this.callbacks.onSuccess(s,a,e,t)}else{var S=o.loadPolicy.errorRetry;wa(S,a.retry,!1,{url:e.url,data:void 0,code:n})?this.retry(S):(U.error(n+" while loading "+e.url),this.callbacks.onError({code:n,text:t.statusText},e,t,a))}}}},t.loadtimeout=function(){var e,t=null==(e=this.config)?void 0:e.loadPolicy.timeoutRetry;if(wa(t,this.stats.retry,!0))this.retry(t);else{var a;U.warn("timeout while loading "+(null==(a=this.context)?void 0:a.url));var i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}},t.retry=function(e){var t=this.context,a=this.stats;this.retryDelay=Va(e,a.retry),a.retry++,U.warn((status?"HTTP Status "+status:"Timeout")+" while loading "+(null==t?void 0:t.url)+", retrying "+a.retry+"/"+e.maxNumRetry+" in "+this.retryDelay+"ms"),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)},t.loadprogress=function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)},t.getCacheAge=function(){var e=null;if(this.loader&&E_.test(this.loader.getAllResponseHeaders())){var t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e},t.getResponseHeader=function(e){return this.loader&&new RegExp("^"+e+":\\s*[\\d.]+\\s*$","im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null},e})();function T_(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1}var s_=/(\d+)-(\d+)\/(\d+)/,S_=(function(){function e(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||A_,this.controller=new self.AbortController,this.stats=new Y}var t=e.prototype;return t.destroy=function(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null},t.abortInternal=function(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())},t.abort=function(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},t.load=function(e,t,a){var i=this,o=this.stats;if(o.loading.start)throw new Error("Loader can only be used once.");o.loading.start=self.performance.now();var n=l_(e,this.controller.signal),r=a.onProgress,E="arraybuffer"===e.responseType,_=E?"byteLength":"length",T=t.loadPolicy,s=T.maxTimeToFirstByteMs,S=T.maxLoadTimeMs;this.context=e,this.config=t,this.callbacks=a,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=s&&p(s)?s:S,this.requestTimeout=self.setTimeout((function(){i.abortInternal(),a.onTimeout(o,e,i.response)}),t.timeout),self.fetch(this.request).then((function(n){i.response=i.loader=n;var _=Math.max(self.performance.now(),o.loading.start);if(self.clearTimeout(i.requestTimeout),t.timeout=S,i.requestTimeout=self.setTimeout((function(){i.abortInternal(),a.onTimeout(o,e,i.response)}),S-(_-o.loading.start)),!n.ok){var T=n.status,s=n.statusText;throw new O_(s||"fetch, bad network response",T,n)}return o.loading.first=_,o.total=u_(n.headers)||o.total,r&&p(t.highWaterMark)?i.loadProgressively(n,o,e,t.highWaterMark,r):E?n.arrayBuffer():"json"===e.responseType?n.json():n.text()})).then((function(n){var E=i.response;if(!E)throw new Error("loader destroyed");self.clearTimeout(i.requestTimeout),o.loading.end=Math.max(self.performance.now(),o.loading.first);var T=n[_];T&&(o.loaded=o.total=T);var s={url:E.url,data:n,code:E.status};r&&!p(t.highWaterMark)&&r(o,e,n,E),a.onSuccess(s,o,e,E)})).catch((function(t){if(self.clearTimeout(i.requestTimeout),!o.aborted){var n=t&&t.code||0,r=t?t.message:null;a.onError({code:n,text:r},e,t?t.details:null,o)}}))},t.getCacheAge=function(){var e=null;if(this.response){var t=this.response.headers.get("age");e=t?parseFloat(t):null}return e},t.getResponseHeader=function(e){return this.response?this.response.headers.get(e):null},t.loadProgressively=function(e,t,a,i,o){void 0===i&&(i=0);var n=new qi,r=e.body.getReader();return(function E(){return r.read().then((function(r){if(r.done)return n.dataLength&&o(t,a,n.flush(),e),Promise.resolve(new ArrayBuffer(0));var _=r.value,T=_.length;return t.loaded+=T,T=i&&o(t,a,n.flush(),e)):o(t,a,_,e),E()})).catch((function(){return Promise.reject()}))})()},e})();function l_(e,t){var a={method:"GET",mode:"cors",credentials:"same-origin",signal:t,headers:new self.Headers(T({},e.headers))};return e.rangeEnd&&a.headers.set("Range","bytes="+e.rangeStart+"-"+String(e.rangeEnd-1)),a}function I_(e){var t=s_.exec(e);if(t)return parseInt(t[2])-parseInt(t[1])+1}function u_(e){var t=e.get("Content-Range");if(t){var a=I_(t);if(p(a))return a}var i=e.get("Content-Length");if(i)return parseInt(i)}function A_(e,t){return new self.Request(e.url,t)}var d_,O_=(function(e){function t(t,a,i){var o;return(o=e.call(this,t)||this).code=void 0,o.details=void 0,o.code=a,o.details=i,o}return s(t,e),t})(d(Error)),c_=/\s/,R_={newCue:function(e,t,a,i){for(var o,n,r,E,_,T=[],s=self.VTTCue||self.TextTrackCue,S=0;S=16?E--:E++;var u=Dr(_.trim()),A=Br(t,a,u);null!=e&&null!=(l=e.cues)&&l.getCueById(A)||((n=new s(t,a,u)).id=A,n.line=S+1,n.align="left",n.position=10+Math.min(80,10*Math.floor(8*E/32)),T.push(n))}return e&&T.length&&(T.sort((function(e,t){return"auto"===e.line||"auto"===t.line?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line})),T.forEach((function(t){return ta(e,t)}))),T}},N_=i(i({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:__,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Ri,bufferController:Kn,capLevelController:Jr,errorController:Ja,fpsController:Zr,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:se,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},m_()),{},{subtitleStreamController:Vn,subtitleTrackController:wn,timelineController:xr,audioStreamController:Gn,audioTrackController:kn,emeController:tE,cmcdController:a_,contentSteeringController:o_});function m_(){return{cueHandler:R_,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function L_(e,t){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');var a=D_(e),o=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach((function(e){var i=("level"===e?"playlist":e)+"LoadPolicy",n=void 0===t[i],r=[];o.forEach((function(o){var E=e+"Loading"+o,_=t[E];if(void 0!==_&&n){r.push(E);var T=a[i].default;switch(t[i]={default:T},o){case"TimeOut":T.maxLoadTimeMs=_,T.maxTimeToFirstByteMs=_;break;case"MaxRetry":T.errorRetry.maxNumRetry=_,T.timeoutRetry.maxNumRetry=_;break;case"RetryDelay":T.errorRetry.retryDelayMs=_,T.timeoutRetry.retryDelayMs=_;break;case"MaxRetryTimeout":T.errorRetry.maxRetryDelayMs=_,T.timeoutRetry.maxRetryDelayMs=_}}})),r.length&&U.warn('hls.js config: "'+r.join('", "')+'" setting(s) are deprecated, use "'+i+'": '+JSON.stringify(t[i]))})),i(i({},a),t)}function D_(e){return e&&"object"==typeof e?Array.isArray(e)?e.map(D_):Object.keys(e).reduce((function(t,a){return t[a]=D_(e[a]),t}),{}):e}function p_(e){var t=e.loader;t!==S_&&t!==__?(U.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1):T_()&&(e.loader=S_,e.progressive=!0,e.enableSoftwareAES=!0,U.log("[config]: Progressive streaming enabled, using FetchLoader"))}var h_=(function(e){function t(t,a){var i;return(i=e.call(this,t,"[level-controller]")||this)._levels=[],i._firstLevel=-1,i._maxAutoLevel=-1,i._startLevel=void 0,i.currentLevel=null,i.currentLevelIndex=-1,i.manualLevelIndex=-1,i.steering=void 0,i.onParsedComplete=void 0,i.steering=a,i._registerListeners(),i}s(t,e);var a=t.prototype;return a._registerListeners=function(){var e=this.hls;e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(f.LEVEL_LOADED,this.onLevelLoaded,this),e.on(f.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(f.FRAG_BUFFERED,this.onFragBuffered,this),e.on(f.ERROR,this.onError,this)},a._unregisterListeners=function(){var e=this.hls;e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(f.LEVEL_LOADED,this.onLevelLoaded,this),e.off(f.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(f.FRAG_BUFFERED,this.onFragBuffered,this),e.off(f.ERROR,this.onError,this)},a.destroy=function(){this._unregisterListeners(),this.steering=null,this.resetLevels(),e.prototype.destroy.call(this)},a.stopLoad=function(){this._levels.forEach((function(e){e.loadError=0,e.fragmentError=0})),e.prototype.stopLoad.call(this)},a.resetLevels=function(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1},a.onManifestLoading=function(e,t){this.resetLevels()},a.onManifestLoaded=function(e,t){var a=this.hls.config.preferManagedMediaSource,i=[],o={},n={},r=!1,E=!1,_=!1;t.levels.forEach((function(e){var t,T,s=e.attrs,S=e.audioCodec,l=e.videoCodec;-1!==(null==(t=S)?void 0:t.indexOf("mp4a.40.34"))&&(d_||(d_=/chrome|firefox/i.test(navigator.userAgent)),d_&&(e.audioCodec=S=void 0)),S&&(e.audioCodec=S=Mt(S,a)),0===(null==(T=l)?void 0:T.indexOf("avc1"))&&(l=e.videoCodec=yt(l));var I=e.width,u=e.height,A=e.unknownCodecs;if(r||(r=!(!I||!u)),E||(E=!!l),_||(_=!!S),!(null!=A&&A.length||S&&!pt(S,"audio",a)||l&&!pt(l,"video",a))){var d=s.CODECS,O=s["FRAME-RATE"],c=s["HDCP-LEVEL"],R=s["PATHWAY-ID"],N=s.RESOLUTION,m=s["VIDEO-RANGE"],L=(R||".")+"-"+e.bitrate+"-"+N+"-"+O+"-"+d+"-"+m+"-"+c;if(o[L])if(o[L].uri===e.url||e.attrs["PATHWAY-ID"])o[L].addGroupId("audio",s.AUDIO),o[L].addGroupId("text",s.SUBTITLES);else{var D=n[L]+=1;e.attrs["PATHWAY-ID"]=new Array(D+1).join(".");var p=new Da(e);o[L]=p,i.push(p)}else{var h=new Da(e);o[L]=h,n[L]=1,i.push(h)}}})),this.filterAndSortMediaOptions(i,t,r,E,_)},a.filterAndSortMediaOptions=function(e,t,a,i,o){var n=this,r=[],E=[],_=e;if((a||i)&&o&&(_=_.filter((function(e){var t=e.videoCodec,a=e.videoRange,i=e.width,o=e.height;return(!!t||!(!i||!o))&&Ra(a)}))),0!==_.length){if(t.audioTracks){var T=this.hls.config.preferManagedMediaSource;C_(r=t.audioTracks.filter((function(e){return!e.audioCodec||pt(e.audioCodec,"audio",T)})))}t.subtitles&&C_(E=t.subtitles);var s=_.slice(0);_.sort((function(e,t){if(e.attrs["HDCP-LEVEL"]!==t.attrs["HDCP-LEVEL"])return(e.attrs["HDCP-LEVEL"]||"")>(t.attrs["HDCP-LEVEL"]||"")?1:-1;if(a&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return ca.indexOf(e.videoRange)-ca.indexOf(t.videoRange);if(e.videoCodec!==t.videoCodec){var i=ft(e.videoCodec),o=ft(t.videoCodec);if(i!==o)return o-i}if(e.uri===t.uri&&e.codecSet!==t.codecSet){var n=Pt(e.codecSet),r=Pt(t.codecSet);if(n!==r)return r-n}return e.averageBitrate!==t.averageBitrate?e.averageBitrate-t.averageBitrate:0}));var S=s[0];if(this.steering&&(_=this.steering.filterParsedLevels(_)).length!==s.length)for(var l=0;ld&&d===N_.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=O)}break}var c=o&&!i,R={levels:_,audioTracks:r,subtitleTracks:E,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:o,video:i,altAudio:!c&&r.some((function(e){return!!e.url}))};this.hls.trigger(f.MANIFEST_PARSED,R),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else Promise.resolve().then((function(){if(n.hls){t.levels.length&&n.warn("One or more CODECS in variant not supported: "+JSON.stringify(t.levels[0].attrs));var e=new Error("no level with compatible codecs found in manifest");n.hls.trigger(f.ERROR,{type:P.MEDIA_ERROR,details:B.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:e,reason:e.message})}}))},a.onError=function(e,t){!t.fatal&&t.context&&t.context.type===Xt.LEVEL&&t.context.level===this.level&&this.checkRetry(t)},a.onFragBuffered=function(e,t){var a=t.frag;if(void 0!==a&&a.type===$t.MAIN){var i=a.elementaryStreams;if(!Object.keys(i).some((function(e){return!!i[e]})))return;var o=this._levels[a.level];null!=o&&o.loadError&&(this.log("Resetting level error count of "+o.loadError+" on frag buffered"),o.loadError=0)}},a.onLevelLoaded=function(e,t){var a,i,o=t.level,n=t.details,r=this._levels[o];if(!r)return this.warn("Invalid level index "+o),void(null!=(i=t.deliveryDirectives)&&i.skip&&(n.deltaUpdateFailed=!0));o===this.currentLevelIndex?(0===r.fragmentError&&(r.loadError=0),this.playlistLoaded(o,t,r.details)):null!=(a=t.deliveryDirectives)&&a.skip&&(n.deltaUpdateFailed=!0)},a.loadPlaylist=function(t){e.prototype.loadPlaylist.call(this);var a=this.currentLevelIndex,i=this.currentLevel;if(i&&this.shouldLoadPlaylist(i)){var o=i.uri;if(t)try{o=t.addDirectives(o)}catch(e){this.warn("Could not construct new URL with HLS Delivery Directives: "+e)}var n=i.attrs["PATHWAY-ID"];this.log("Loading level index "+a+(void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:"")+" with"+(n?" Pathway "+n:"")+" "+o),this.clearTimer(),this.hls.trigger(f.LEVEL_LOADING,{url:o,level:a,pathwayId:i.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}},a.removeLevel=function(e){var t,a=this,i=this._levels.filter((function(t,i){return i!==e||(a.steering&&a.steering.removeLevel(t),t===a.currentLevel&&(a.currentLevel=null,a.currentLevelIndex=-1,t.details&&t.details.fragments.forEach((function(e){return e.level=-1}))),!1)}));Ga(i),this._levels=i,this.currentLevelIndex>-1&&null!=(t=this.currentLevel)&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(f.LEVELS_UPDATED,{levels:i})},a.onLevelsUpdated=function(e,t){var a=t.levels;this._levels=a},a.checkMaxAutoUpdated=function(){var e=this.hls,t=e.autoLevelCapping,a=e.maxAutoLevel,i=e.maxHdcpLevel;this._maxAutoLevel!==a&&(this._maxAutoLevel=a,this.hls.trigger(f.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:t,levels:this.levels,maxAutoLevel:a,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))},E(t,[{key:"levels",get:function(){return 0===this._levels.length?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(e){var t=this._levels;if(0!==t.length){if(e<0||e>=t.length){var a=new Error("invalid level idx"),i=e<0;if(this.hls.trigger(f.ERROR,{type:P.OTHER_ERROR,details:B.LEVEL_SWITCH_ERROR,level:e,fatal:i,error:a,reason:a.message}),i)return;e=Math.min(e,t.length-1)}var o=this.currentLevelIndex,n=this.currentLevel,r=n?n.attrs["PATHWAY-ID"]:void 0,E=t[e],_=E.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=E,o!==e||!E.details||!n||r!==_){this.log("Switching to level "+e+" ("+(E.height?E.height+"p ":"")+(E.videoRange?E.videoRange+" ":"")+(E.codecSet?E.codecSet+" ":"")+"@"+E.bitrate+")"+(_?" with Pathway "+_:"")+" from level "+o+(r?" with Pathway "+r:""));var T={level:e,attrs:E.attrs,details:E.details,bitrate:E.bitrate,averageBitrate:E.averageBitrate,maxBitrate:E.maxBitrate,realBitrate:E.realBitrate,width:E.width,height:E.height,codecSet:E.codecSet,audioCodec:E.audioCodec,videoCodec:E.videoCodec,audioGroups:E.audioGroups,subtitleGroups:E.subtitleGroups,loaded:E.loaded,loadError:E.loadError,fragmentError:E.fragmentError,name:E.name,id:E.id,uri:E.uri,url:E.url,urlId:0,audioGroupIds:E.audioGroupIds,textGroupIds:E.textGroupIds};this.hls.trigger(f.LEVEL_SWITCHING,T);var s=E.details;if(!s||s.live){var S=this.switchParams(E.uri,null==n?void 0:n.details);this.loadPlaylist(S)}}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){if(void 0===this._startLevel){var e=this.hls.config.startLevel;return void 0!==e?e:this.hls.firstAutoLevel}return this._startLevel},set:function(e){this._startLevel=e}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}}]),t})(Za);function C_(e){var t={};e.forEach((function(e){var a=e.groupId||"";e.id=t[a]=t[a]||0,t[a]++}))}var f_=(function(){function e(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}var t=e.prototype;return t.abort=function(e){for(var t in this.keyUriToKeyInfo){var a=this.keyUriToKeyInfo[t].loader;if(a){var i;if(e&&e!==(null==(i=a.context)?void 0:i.frag.type))return;a.abort()}}},t.detach=function(){for(var e in this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}},t.destroy=function(){for(var e in this.detach(),this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}},t.createKeyLoadError=function(e,t,a,i,o){return void 0===t&&(t=B.KEY_LOAD_ERROR),new Hi({type:P.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:o,error:a,networkDetails:i})},t.loadClear=function(e,t){var a=this;if(this.emeController&&this.config.emeEnabled)for(var i=e.sn,o=e.cc,n=function(){var e=t[r];if(o<=e.cc&&("initSegment"===i||"initSegment"===e.sn||iW_,l=!s||t&&t.start<=n||s-n>W_&&!this.fragmentTracker.getPartialFragment(n);if(S||l)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var I;if(!(T.len>0||s))return;var u=Math.max(s,T.start||0)-n,A=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,d=(null==A||null==(I=A.details)?void 0:I.live)?2*A.details.targetduration:W_,O=this.fragmentTracker.getPartialFragment(n);if(u>0&&(u<=d||O))return void(i.paused||this._trySkipBufferHole(O))}var c=self.performance.now();if(null!==o){var R=c-o;if(r||!(R>=M_)||(this._reportStall(T),this.media)){var N=Ci.bufferInfo(i,n,a.maxBufferHole);this._tryFixBufferStall(N,R)}}else this.stalled=c}else if(this.moved=!0,r||(this.nudgeRetry=0),null!==o){if(this.stallReported){var m=self.performance.now()-o;U.warn("playback not stuck anymore @"+n+", after "+Math.round(m)+"ms"),this.stallReported=!1}this.stalled=null}}},t._tryFixBufferStall=function(e,t){var a=this.config,i=this.fragmentTracker,o=this.media;if(null!==o){var n=o.currentTime,r=i.getPartialFragment(n);if(r&&(this._trySkipBufferHole(r)||!this.media))return;(e.len>a.maxBufferHole||e.nextStart&&e.nextStart-n1e3*a.highBufferWatchdogPeriod&&(U.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}},t._reportStall=function(e){var t=this.hls,a=this.media;if(!this.stallReported&&a){this.stallReported=!0;var i=new Error("Playback stalling at @"+a.currentTime+" due to low buffer ("+JSON.stringify(e)+")");U.warn(i.message),t.trigger(f.ERROR,{type:P.MEDIA_ERROR,details:B.BUFFER_STALLED_ERROR,fatal:!1,error:i,buffer:e.len})}},t._trySkipBufferHole=function(e){var t=this.config,a=this.hls,i=this.media;if(null===i)return 0;var o=i.currentTime,n=Ci.bufferInfo(i,o,0),r=o0&&n.len<1&&i.readyState<3,T=r-o;if(T>0&&(E||_)){if(T>t.maxBufferHole){var s=this.fragmentTracker,S=!1;if(0===o){var l=s.getAppendedFrag(0,$t.MAIN);l&&r1?(i=0,this.bitrateTest=!0):i=a.firstAutoLevel),a.nextLoadLevel=i,this.level=a.loadLevel,this.loadedmetadata=!1}t>0&&-1===e&&(this.log("Override startPosition with lastCurrentTime @"+t.toFixed(3)),e=t),this.state=Xi.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=Xi.STOPPED},a.stopLoad=function(){this._forceStartLoad=!1,e.prototype.stopLoad.call(this)},a.doTick=function(){switch(this.state){case Xi.WAITING_LEVEL:var e=this.levels,t=this.level,a=null==e?void 0:e[t],i=null==a?void 0:a.details;if(i&&(!i.live||this.levelLastLoaded===a)){if(this.waitForCdnTuneIn(i))break;this.state=Xi.IDLE;break}if(this.hls.nextLoadLevel!==this.level){this.state=Xi.IDLE;break}break;case Xi.FRAG_LOADING_WAITING_RETRY:var o,n=self.performance.now(),r=this.retryDate;if(!r||n>=r||null!=(o=this.media)&&o.seeking){var E=this.levels,_=this.level,T=null==E?void 0:E[_];this.resetStartWhenNotLoaded(T||null),this.state=Xi.IDLE}}this.state===Xi.IDLE&&this.doTickIdle(),this.onTickEnd()},a.onTickEnd=function(){e.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},a.doTickIdle=function(){var e=this.hls,t=this.levelLastLoaded,a=this.levels,i=this.media,o=e.config,n=e.nextLoadLevel;if(null!==t&&(i||!this.startFragRequested&&o.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)&&null!=a&&a[n]){var r=a[n],E=this.getMainFwdBufferInfo();if(null!==E){var _=this.getLevelDetails();if(_&&this._streamEnded(E,_)){var T={};return this.altAudio&&(T.type="video"),this.hls.trigger(f.BUFFER_EOS,T),void(this.state=Xi.ENDED)}e.loadLevel!==n&&-1===e.manualLevel&&this.log("Adapting to level "+n+" from level "+this.level),this.level=e.nextLoadLevel=n;var s=r.details;if(!s||this.state===Xi.WAITING_LEVEL||s.live&&this.levelLastLoaded!==r)return this.level=n,void(this.state=Xi.WAITING_LEVEL);var S=E.len,l=this.getMaxBufferLength(r.maxBitrate);if(!(S>=l)){this.backtrackFragment&&this.backtrackFragment.start>E.end&&(this.backtrackFragment=null);var I=this.backtrackFragment?this.backtrackFragment.start:E.end,u=this.getNextFragment(I,s);if(this.couldBacktrack&&!this.fragPrevious&&u&&"initSegment"!==u.sn&&this.fragmentTracker.getState(u)!==mi.OK){var A,d=(null!=(A=this.backtrackFragment)?A:u).sn-s.startSN,O=s.fragments[d-1];O&&u.cc===O.cc&&(u=O,this.fragmentTracker.removeFragment(O))}else this.backtrackFragment&&E.len&&(this.backtrackFragment=null);if(u&&this.isLoopLoading(u,I)){if(!u.gap){var c=this.audioOnly&&!this.altAudio?z.AUDIO:z.VIDEO,R=(c===z.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;R&&this.afterBufferFlushed(R,c,$t.MAIN)}u=this.getNextFragmentLoopLoading(u,s,E,$t.MAIN,l)}u&&(!u.initSegment||u.initSegment.data||this.bitrateTest||(u=u.initSegment),this.loadFragment(u,r,I))}}}},a.loadFragment=function(t,a,i){var o=this.fragmentTracker.getState(t);this.fragCurrent=t,o===mi.NOT_LOADED||o===mi.PARTIAL?"initSegment"===t.sn?this._loadInitSegment(t,a):this.bitrateTest?(this.log("Fragment "+t.sn+" of level "+t.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(t,a)):(this.startFragRequested=!0,e.prototype.loadFragment.call(this,t,a,i)):this.clearTrackerIfNeeded(t)},a.getBufferedFrag=function(e){return this.fragmentTracker.getBufferedFrag(e,$t.MAIN)},a.followingBufferedFrag=function(e){return e?this.getBufferedFrag(e.end+.5):null},a.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},a.nextLevelSwitch=function(){var e=this.levels,t=this.media;if(null!=t&&t.readyState){var a,i=this.getAppendedFrag(t.currentTime);i&&i.start>1&&this.flushMainBuffer(0,i.start-1);var o=this.getLevelDetails();if(null!=o&&o.live){var n=this.getMainFwdBufferInfo();if(!n||n.len<2*o.targetduration)return}if(!t.paused&&e){var r=e[this.hls.nextLoadLevel],E=this.fragLastKbps;a=E&&this.fragCurrent?this.fragCurrent.duration*r.maxBitrate/(1e3*E)+1:0}else a=0;var _=this.getBufferedFrag(t.currentTime+a);if(_){var T=this.followingBufferedFrag(_);if(T){this.abortCurrentFrag();var s=T.maxStartPTS?T.maxStartPTS:T.start,S=T.duration,l=Math.max(_.end,s+Math.min(Math.max(S-this.config.maxFragLookUpTolerance,S*(this.couldBacktrack?.5:.125)),S*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(l,Number.POSITIVE_INFINITY)}}}},a.abortCurrentFrag=function(){var e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case Xi.KEY_LOADING:case Xi.FRAG_LOADING:case Xi.FRAG_LOADING_WAITING_RETRY:case Xi.PARSING:case Xi.PARSED:this.state=Xi.IDLE}this.nextLoadPosition=this.getLoadPosition()},a.flushMainBuffer=function(t,a){e.prototype.flushMainBuffer.call(this,t,a,this.altAudio?"video":null)},a.onMediaAttached=function(t,a){e.prototype.onMediaAttached.call(this,t,a);var i=a.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),i.addEventListener("playing",this.onvplaying),i.addEventListener("seeked",this.onvseeked),this.gapController=new U_(this.config,i,this.fragmentTracker,this.hls)},a.onMediaDetaching=function(){var t=this.media;t&&this.onvplaying&&this.onvseeked&&(t.removeEventListener("playing",this.onvplaying),t.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),e.prototype.onMediaDetaching.call(this)},a.onMediaPlaying=function(){this.tick()},a.onMediaSeeked=function(){var e=this.media,t=e?e.currentTime:null;p(t)&&this.log("Media seeked to "+t.toFixed(3));var a=this.getMainFwdBufferInfo();null!==a&&0!==a.len?this.tick():this.warn('Main forward buffer length on "seeked" event '+(a?a.len:"empty")+")")},a.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(f.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1},a.onManifestParsed=function(e,t){var a=!1,i=!1;t.levels.forEach((function(e){var t=e.audioCodec;t&&(a=a||-1!==t.indexOf("mp4a.40.2"),i=i||-1!==t.indexOf("mp4a.40.5"))})),this.audioCodecSwitch=a&&i&&!v_(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1},a.onLevelLoading=function(e,t){var a=this.levels;if(a&&this.state===Xi.IDLE){var i=a[t.level];(!i.details||i.details.live&&this.levelLastLoaded!==i||this.waitForCdnTuneIn(i.details))&&(this.state=Xi.WAITING_LEVEL)}},a.onLevelLoaded=function(e,t){var a,i=this.levels,o=t.level,n=t.details,r=n.totalduration;if(i){this.log("Level "+o+" loaded ["+n.startSN+","+n.endSN+"]"+(n.lastPartSn?"[part-"+n.lastPartSn+"-"+n.lastPartIndex+"]":"")+", cc ["+n.startCC+", "+n.endCC+"] duration:"+r);var E=i[o],_=this.fragCurrent;!_||this.state!==Xi.FRAG_LOADING&&this.state!==Xi.FRAG_LOADING_WAITING_RETRY||_.level!==t.level&&_.loader&&this.abortCurrentFrag();var T=0;if(n.live||null!=(a=E.details)&&a.live){var s;if(this.checkLiveUpdate(n),n.deltaUpdateFailed)return;T=this.alignPlaylists(n,E.details,null==(s=this.levelLastLoaded)?void 0:s.details)}if(E.details=n,this.levelLastLoaded=E,this.hls.trigger(f.LEVEL_UPDATED,{details:n,level:o}),this.state===Xi.WAITING_LEVEL){if(this.waitForCdnTuneIn(n))return;this.state=Xi.IDLE}this.startFragRequested?n.live&&this.synchronizeToLiveEdge(n):this.setStartPosition(n,T),this.tick()}else this.warn("Levels were reset while loading level "+o)},a._handleFragmentLoadProgress=function(e){var t,a=e.frag,i=e.part,o=e.payload,n=this.levels;if(n){var r=n[a.level],E=r.details;if(!E)return this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset"),void this.fragmentTracker.removeFragment(a);var _=r.videoCodec,T=E.PTSKnown||!E.live,s=null==(t=a.initSegment)?void 0:t.data,S=this._getAudioCodec(r),l=this.transmuxer=this.transmuxer||new Mn(this.hls,$t.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),I=i?i.index:-1,u=-1!==I,A=new fi(a.level,a.sn,a.stats.chunkCount,o.byteLength,I,u),d=this.initPTS[a.cc];l.push(o,s,S,_,a,i,E.totalduration,T,A,d)}else this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered")},a.onAudioTrackSwitching=function(e,t){var a=this.altAudio;if(!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var i=this.fragCurrent;i&&(this.log("Switching to main audio track, cancel main fragment load"),i.abortRequests(),this.fragmentTracker.removeFragment(i)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var o=this.hls;a&&(o.trigger(f.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),o.trigger(f.AUDIO_TRACK_SWITCHED,t)}},a.onAudioTrackSwitched=function(e,t){var a=t.id,i=!!this.hls.audioTracks[a].url;if(i){var o=this.videoBuffer;o&&this.mediaBuffer!==o&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=o)}this.altAudio=i,this.tick()},a.onBufferCreated=function(e,t){var a,i,o=t.tracks,n=!1;for(var r in o){var E=o[r];if("main"===E.id){if(i=r,a=E,"video"===r){var _=o[r];_&&(this.videoBuffer=_.buffer)}}else n=!0}n&&a?(this.log("Alternate track found, use "+i+".buffered to schedule main fragment loading"),this.mediaBuffer=a.buffer):this.mediaBuffer=this.media},a.onFragBuffered=function(e,t){var a=t.frag,i=t.part;if(!a||a.type===$t.MAIN){if(this.fragContextChanged(a))return this.warn("Fragment "+a.sn+(i?" p: "+i.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),void(this.state===Xi.PARSED&&(this.state=Xi.IDLE));var o=i?i.stats:a.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),"initSegment"!==a.sn&&(this.fragPrevious=a),this.fragBufferedComplete(a,i)}},a.onError=function(e,t){var a;if(t.fatal)this.state=Xi.ERROR;else switch(t.details){case B.FRAG_GAP:case B.FRAG_PARSING_ERROR:case B.FRAG_DECRYPT_ERROR:case B.FRAG_LOAD_ERROR:case B.FRAG_LOAD_TIMEOUT:case B.KEY_LOAD_ERROR:case B.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError($t.MAIN,t);break;case B.LEVEL_LOAD_ERROR:case B.LEVEL_LOAD_TIMEOUT:case B.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==Xi.WAITING_LEVEL||(null==(a=t.context)?void 0:a.type)!==Xt.LEVEL||(this.state=Xi.IDLE);break;case B.BUFFER_APPEND_ERROR:case B.BUFFER_FULL_ERROR:if(!t.parent||"main"!==t.parent)return;if(t.details===B.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case B.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}},a.checkBuffer=function(){var e=this.media,t=this.gapController;if(e&&t&&e.readyState){if(this.loadedmetadata||!Ci.getBuffered(e).length){var a=this.state!==Xi.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,a)}this.lastCurrentTime=e.currentTime}},a.onFragLoadEmergencyAborted=function(){this.state=Xi.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},a.onBufferFlushed=function(e,t){var a=t.type;if(a!==z.AUDIO||this.audioOnly&&!this.altAudio){var i=(a===z.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(i,a,$t.MAIN),this.tick()}},a.onLevelsUpdated=function(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels},a.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},a.seekToStartPos=function(){var e=this.media;if(e){var t=e.currentTime,a=this.startPosition;if(a>=0&&t0&&(oR.cc;if(!1!==o.independent){var L=s.startPTS,D=s.endPTS,h=s.startDTS,C=s.endDTS;if(_)_.elementaryStreams[s.type]={startPTS:L,endPTS:D,startDTS:h,endDTS:C};else if(s.firstKeyFrame&&s.independent&&1===n.id&&!m&&(this.couldBacktrack=!0),s.dropped&&s.independent){var P=this.getMainFwdBufferInfo(),B=(P?P.end:this.getLoadPosition())+this.config.maxBufferHole,g=s.firstKeyFramePTS?s.firstKeyFramePTS:L;if(!N&&BW_&&(E.gap=!0);E.setElementaryStreamInfo(s.type,L,D,h,C),this.backtrackFragment&&(this.backtrackFragment=E),this.bufferFragmentData(s,E,_,n,N||m)}else{if(!N&&!m)return void this.backtrack(E);E.gap=!0}}if(A){var v=A.startPTS,M=A.endPTS,W=A.startDTS,y=A.endDTS;_&&(_.elementaryStreams[z.AUDIO]={startPTS:v,endPTS:M,startDTS:W,endDTS:y}),E.setElementaryStreamInfo(z.AUDIO,v,M,W,y),this.bufferFragmentData(A,E,_,n)}if(u&&null!=l&&null!=(t=l.samples)&&t.length){var b={id:a,frag:E,details:u,samples:l.samples};i.trigger(f.FRAG_PARSING_METADATA,b)}if(u&&S){var U={id:a,frag:E,details:u,samples:S.samples};i.trigger(f.FRAG_PARSING_USERDATA,U)}}}else this.resetWhenMissingContext(n)},a._bufferInitSegment=function(e,t,a,i){var o=this;if(this.state===Xi.PARSING){this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;var n=t.audio,r=t.video,E=t.audiovideo;if(n){var _=e.audioCodec,T=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(_&&(_=-1!==_.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),1!==n.metadata.channelCount&&-1===T.indexOf("firefox")&&(_="mp4a.40.5")),_&&-1!==_.indexOf("mp4a.40.5")&&-1!==T.indexOf("android")&&"audio/mpeg"!==n.container&&(_="mp4a.40.2",this.log("Android: force audio codec to "+_)),e.audioCodec&&e.audioCodec!==_&&this.log('Swapping manifest audio codec "'+e.audioCodec+'" for "'+_+'"'),n.levelCodec=_,n.id="main",this.log("Init audio buffer, container:"+n.container+", codecs[selected/level/parsed]=["+(_||"")+"/"+(e.audioCodec||"")+"/"+n.codec+"]")}r&&(r.levelCodec=e.videoCodec,r.id="main",this.log("Init video buffer, container:"+r.container+", codecs[level/parsed]=["+(e.videoCodec||"")+"/"+r.codec+"]")),E&&this.log("Init audiovideo buffer, container:"+E.container+", codecs[level/parsed]=["+e.codecs+"/"+E.codec+"]"),this.hls.trigger(f.BUFFER_CODECS,t),Object.keys(t).forEach((function(e){var n=t[e].initSegment;null!=n&&n.byteLength&&o.hls.trigger(f.BUFFER_APPENDING,{type:e,data:n,frag:a,part:null,chunkMeta:i,parent:a.type})})),this.tickImmediate()}},a.getMainFwdBufferInfo=function(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,$t.MAIN)},a.backtrack=function(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=Xi.IDLE},a.checkFragmentChanged=function(){var e=this.media,t=null;if(e&&e.readyState>1&&!1===e.seeking){var a=e.currentTime;if(Ci.isBuffered(e,a)?t=this.getAppendedFrag(a):Ci.isBuffered(e,a+.1)&&(t=this.getAppendedFrag(a+.1)),t){this.backtrackFragment=null;var i=this.fragPlaying,o=t.level;i&&t.sn===i.sn&&i.level===o||(this.fragPlaying=t,this.hls.trigger(f.FRAG_CHANGED,{frag:t}),i&&i.level===o||this.hls.trigger(f.LEVEL_SWITCHED,{level:o}))}}},E(t,[{key:"nextLevel",get:function(){var e=this.nextBufferedFrag;return e?e.level:-1}},{key:"currentFrag",get:function(){var e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}},{key:"currentProgramDateTime",get:function(){var e=this.media;if(e){var t=e.currentTime,a=this.currentFrag;if(a&&p(t)&&p(a.programDateTime)){var i=a.programDateTime+1e3*(t-a.start);return new Date(i)}}return null}},{key:"currentLevel",get:function(){var e=this.currentFrag;return e?e.level:-1}},{key:"nextBufferedFrag",get:function(){var e=this.currentFrag;return e?this.followingBufferedFrag(e):null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),t})($i),F_=(function(){function e(t){void 0===t&&(t={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new Dn,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,b(t.debug||!1,"Hls instance");var a=this.config=L_(e.DefaultConfig,t);this.userConfig=t,a.progressive&&p_(a);var i=a.abrController,o=a.bufferController,n=a.capLevelController,r=a.errorController,E=a.fpsController,_=new r(this),T=this.abrController=new i(this),s=this.bufferController=new o(this),S=this.capLevelController=new n(this),l=new E(this),I=new Zt(this),u=new ua(this),A=a.contentSteeringController,d=A?new A(this):null,O=this.levelController=new h_(this,d),c=new Li(this),R=new f_(this.config),N=this.streamController=new k_(this,c,R);S.setStreamController(N),l.setStreamController(N);var m=[I,O,N];d&&m.splice(1,0,d),this.networkControllers=m;var L=[T,s,S,l,u,c];this.audioTrackController=this.createController(a.audioTrackController,m);var D=a.audioStreamController;D&&m.push(new D(this,c,R)),this.subtitleTrackController=this.createController(a.subtitleTrackController,m);var p=a.subtitleStreamController;p&&m.push(new p(this,c,R)),this.createController(a.timelineController,L),R.emeController=this.emeController=this.createController(a.emeController,L),this.cmcdController=this.createController(a.cmcdController,L),this.latencyController=this.createController(Aa,L),this.coreComponents=L,m.push(_);var h=_.onErrorOut;"function"==typeof h&&this.on(f.ERROR,h,_)}e.isMSESupported=function(){return B_()},e.isSupported=function(){return g_()},e.getMediaSource=function(){return mt()};var t=e.prototype;return t.createController=function(e,t){if(e){var a=new e(this);return t&&t.push(a),a}return null},t.on=function(e,t,a){void 0===a&&(a=this),this._emitter.on(e,t,a)},t.once=function(e,t,a){void 0===a&&(a=this),this._emitter.once(e,t,a)},t.removeAllListeners=function(e){this._emitter.removeAllListeners(e)},t.off=function(e,t,a,i){void 0===a&&(a=this),this._emitter.off(e,t,a,i)},t.listeners=function(e){return this._emitter.listeners(e)},t.emit=function(e,t,a){return this._emitter.emit(e,t,a)},t.trigger=function(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){if(U.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),!this.triggeringException){this.triggeringException=!0;var a=e===f.ERROR;this.trigger(f.ERROR,{type:P.OTHER_ERROR,details:B.INTERNAL_EXCEPTION,fatal:a,event:e,error:t}),this.triggeringException=!1}}return!1},t.listenerCount=function(e){return this._emitter.listenerCount(e)},t.destroy=function(){U.log("destroy"),this.trigger(f.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach((function(e){return e.destroy()})),this.networkControllers.length=0,this.coreComponents.forEach((function(e){return e.destroy()})),this.coreComponents.length=0;var e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null},t.attachMedia=function(e){U.log("attachMedia"),this._media=e,this.trigger(f.MEDIA_ATTACHING,{media:e})},t.detachMedia=function(){U.log("detachMedia"),this.trigger(f.MEDIA_DETACHING,void 0),this._media=null},t.loadSource=function(e){this.stopLoad();var t=this.media,a=this.url,i=this.url=D.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,U.log("loadSource:"+i),t&&a&&(a!==i||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(f.MANIFEST_LOADING,{url:e})},t.startLoad=function(e){void 0===e&&(e=-1),U.log("startLoad("+e+")"),this.started=!0,this.networkControllers.forEach((function(t){t.startLoad(e)}))},t.stopLoad=function(){U.log("stopLoad"),this.started=!1,this.networkControllers.forEach((function(e){e.stopLoad()}))},t.resumeBuffering=function(){this.started&&this.networkControllers.forEach((function(e){"fragmentLoader"in e&&e.startLoad(-1)}))},t.pauseBuffering=function(){this.networkControllers.forEach((function(e){"fragmentLoader"in e&&e.stopLoad()}))},t.swapAudioCodec=function(){U.log("swapAudioCodec"),this.streamController.swapAudioCodec()},t.recoverMediaError=function(){U.log("recoverMediaError");var e=this._media;this.detachMedia(),e&&this.attachMedia(e)},t.removeLevel=function(e){this.levelController.removeLevel(e)},t.setAudioOption=function(e){var t;return null==(t=this.audioTrackController)?void 0:t.setAudioOption(e)},t.setSubtitleOption=function(e){var t;return null==(t=this.subtitleTrackController)||t.setSubtitleOption(e),null},E(e,[{key:"levels",get:function(){var e=this.levelController.levels;return e||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){U.log("set currentLevel:"+e),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){U.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){U.log("set loadLevel:"+e),this.levelController.manualLevel=e}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(e){U.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){var e=this.levelController.startLevel;return-1===e&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e},set:function(e){U.log("set startLevel:"+e),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(e){var t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){this._autoLevelCapping!==e&&(U.log("set autoLevelCapping:"+e),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}},{key:"bandwidthEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimate():NaN},set:function(e){this.abrController.resetEstimator(e)}},{key:"ttfbEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimateTTFB():NaN}},{key:"maxHdcpLevel",get:function(){return this._maxHdcpLevel},set:function(e){Oa(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var e=this.levels,t=this.config.minAutoBitrate;if(!e)return 0;for(var a=e.length,i=0;i=t)return i;return 0}},{key:"maxAutoLevel",get:function(){var e,t=this.levels,a=this.autoLevelCapping,i=this.maxHdcpLevel;if(e=-1===a&&null!=t&&t.length?t.length-1:a,i)for(var o=e;o--;){var n=t[o].attrs["HDCP-LEVEL"];if(n&&n<=i)return o}return e}},{key:"firstAutoLevel",get:function(){return this.abrController.firstAutoLevel}},{key:"nextAutoLevel",get:function(){return this.abrController.nextAutoLevel},set:function(e){this.abrController.nextAutoLevel=e}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"mainForwardBufferInfo",get:function(){return this.streamController.getMainFwdBufferInfo()}},{key:"allAudioTracks",get:function(){var e=this.audioTrackController;return e?e.allAudioTracks:[]}},{key:"audioTracks",get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]}},{key:"audioTrack",get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)}},{key:"allSubtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}},{key:"subtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(e){this.config.lowLatencyMode=e}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.5.5-0.canary.9893"}},{key:"Events",get:function(){return f}},{key:"ErrorTypes",get:function(){return P}},{key:"ErrorDetails",get:function(){return B}},{key:"DefaultConfig",get:function(){return e.defaultConfig?e.defaultConfig:N_},set:function(t){e.defaultConfig=t}}]),e})();return F_.defaultConfig=void 0,F_})()})(!1)},35543:e=>{"use strict";const t=e=>"string"==typeof e,a=()=>{let e,t;const a=new Promise(((a,i)=>{e=a,t=i}));return a.resolve=e,a.reject=t,a},i=e=>null==e?"":""+e,o=/###/g,n=e=>e&&e.indexOf("###")>-1?e.replace(o,"."):e,r=e=>!e||t(e),E=(e,a,i)=>{const o=t(a)?a.split("."):a;let E=0;for(;E{const{obj:i,k:o}=E(e,t,Object);if(void 0!==i||1===t.length)return void(i[o]=a);let n=t[t.length-1],r=t.slice(0,t.length-1),_=E(e,r,Object);for(;void 0===_.obj&&r.length;)n=`${r[r.length-1]}.${n}`,r=r.slice(0,r.length-1),_=E(e,r,Object),_?.obj&&void 0!==_.obj[`${_.k}.${n}`]&&(_.obj=void 0);_.obj[`${_.k}.${n}`]=a},T=(e,t)=>{const{obj:a,k:i}=E(e,t);if(a)return a[i]},s=(e,a,i)=>{for(const o in a)"__proto__"!==o&&"constructor"!==o&&(o in e?t(e[o])||e[o]instanceof String||t(a[o])||a[o]instanceof String?i&&(e[o]=a[o]):s(e[o],a[o],i):e[o]=a[o]);return e},S=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var l={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const I=e=>t(e)?e.replace(/[&<>"'\/]/g,(e=>l[e])):e;const u=[" ",",","?","!",";"],A=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(void 0!==t)return t;const a=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,a),this.regExpQueue.push(e),a}}(20),d=function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(!e)return;if(e[t])return e[t];const i=t.split(a);let o=e;for(let e=0;e-1&&re?.replace("_","-"),c={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class R{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.init(e,t)}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||c,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),a=0;a{this.observers[e]||(this.observers[e]=new Map);const a=this.observers[e].get(t)||0;this.observers[e].set(t,a+1)})),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}emit(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),i=1;i{let[t,i]=e;for(let e=0;e{let[i,o]=t;for(let t=0;t1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,a,i){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const n=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator,r=void 0!==o.ignoreJSONStructure?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let E;e.indexOf(".")>-1?E=e.split("."):(E=[e,a],i&&(Array.isArray(i)?E.push(...i):t(i)&&n?E.push(...i.split(n)):E.push(i)));const _=T(this.data,E);return!_&&!a&&!i&&e.indexOf(".")>-1&&(e=E[0],a=E[1],i=E.slice(2).join(".")),!_&&r&&t(i)?d(this.data?.[e]?.[a],i,n):_}addResource(e,t,a,i){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1};const n=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator;let r=[e,t];a&&(r=r.concat(n?a.split(n):a)),e.indexOf(".")>-1&&(r=e.split("."),i=t,t=r[1]),this.addNamespaces(t),_(this.data,r,i),o.silent||this.emit("added",e,t,a,i)}addResources(e,a,i){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(const o in i)(t(i[o])||Array.isArray(i[o]))&&this.addResource(e,a,o,i[o],{silent:!0});o.silent||this.emit("added",e,a,i)}addResourceBundle(e,t,a,i,o){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1,skipCopy:!1},r=[e,t];e.indexOf(".")>-1&&(r=e.split("."),i=a,a=t,t=r[1]),this.addNamespaces(t);let E=T(this.data,r)||{};n.skipCopy||(a=JSON.parse(JSON.stringify(a))),i?s(E,a,o):E={...E,...a},_(this.data,r,E),n.silent||this.emit("added",e,t,a)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find((e=>t[e]&&Object.keys(t[e]).length>0))}toJSON(){return this.data}}var D={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,a,i,o){return e.forEach((e=>{t=this.processors[e]?.process(t,a,i,o)??t})),t}};const p={};class h extends m{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var a,i;super(),a=e,i=this,["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"].forEach((e=>{a[e]&&(i[e]=a[e])})),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=N.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;const a=this.resolve(e,t);return void 0!==a?.res}extractFromKey(e,a){let i=void 0!==a.nsSeparator?a.nsSeparator:this.options.nsSeparator;void 0===i&&(i=":");const o=void 0!==a.keySeparator?a.keySeparator:this.options.keySeparator;let n=a.ns||this.options.defaultNS||[];const r=i&&e.indexOf(i)>-1,E=!(this.options.userDefinedKeySeparator||a.keySeparator||this.options.userDefinedNsSeparator||a.nsSeparator||((e,t,a)=>{t=t||"",a=a||"";const i=u.filter((e=>t.indexOf(e)<0&&a.indexOf(e)<0));if(0===i.length)return!0;const o=A.getRegExp(`(${i.map((e=>"?"===e?"\\?":e)).join("|")})`);let n=!o.test(e);if(!n){const t=e.indexOf(a);t>0&&!o.test(e.substring(0,t))&&(n=!0)}return n})(e,i,o));if(r&&!E){const a=e.match(this.interpolator.nestingRegexp);if(a&&a.length>0)return{key:e,namespaces:t(n)?[n]:n};const r=e.split(i);(i!==o||i===o&&this.options.ns.indexOf(r[0])>-1)&&(n=r.shift()),e=r.join(o)}return{key:e,namespaces:t(n)?[n]:n}}translate(e,a,i){if("object"!=typeof a&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof a&&(a={...a}),a||(a={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);const o=void 0!==a.returnDetails?a.returnDetails:this.options.returnDetails,n=void 0!==a.keySeparator?a.keySeparator:this.options.keySeparator,{key:r,namespaces:E}=this.extractFromKey(e[e.length-1],a),_=E[E.length-1],T=a.lng||this.language,s=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if("cimode"===T?.toLowerCase()){if(s){const e=a.nsSeparator||this.options.nsSeparator;return o?{res:`${_}${e}${r}`,usedKey:r,exactUsedKey:r,usedLng:T,usedNS:_,usedParams:this.getUsedParamsDetails(a)}:`${_}${e}${r}`}return o?{res:r,usedKey:r,exactUsedKey:r,usedLng:T,usedNS:_,usedParams:this.getUsedParamsDetails(a)}:r}const S=this.resolve(e,a);let l=S?.res;const I=S?.usedKey||r,u=S?.exactUsedKey||r,A=Object.prototype.toString.apply(l),d=void 0!==a.joinArrays?a.joinArrays:this.options.joinArrays,O=!this.i18nFormat||this.i18nFormat.handleAsObject,c=!t(l)&&"boolean"!=typeof l&&"number"!=typeof l;if(!(O&&l&&c&&["[object Number]","[object Function]","[object RegExp]"].indexOf(A)<0)||t(d)&&Array.isArray(l))if(O&&t(d)&&Array.isArray(l))l=l.join(d),l&&(l=this.extendTranslation(l,e,a,i));else{let o=!1,E=!1;const s=void 0!==a.count&&!t(a.count),I=h.hasDefaultValue(a),u=s?this.pluralResolver.getSuffix(T,a.count,a):"",A=a.ordinal&&s?this.pluralResolver.getSuffix(T,a.count,{ordinal:!1}):"",d=s&&!a.ordinal&&0===a.count,O=d&&a[`defaultValue${this.options.pluralSeparator}zero`]||a[`defaultValue${u}`]||a[`defaultValue${A}`]||a.defaultValue;!this.isValidLookup(l)&&I&&(o=!0,l=O),this.isValidLookup(l)||(E=!0,l=r);const c=(a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&E?void 0:l,R=I&&O!==l&&this.options.updateMissing;if(E||o||R){if(this.logger.log(R?"updateKey":"missingKey",T,_,r,R?O:l),n){const e=this.resolve(r,{...a,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[];const t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if("fallback"===this.options.saveMissingTo&&t&&t[0])for(let a=0;a{const o=I&&i!==l?i:c;this.options.missingKeyHandler?this.options.missingKeyHandler(e,_,t,o,R,a):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,_,t,o,R,a),this.emit("missingKey",e,_,t,l)};this.options.saveMissing&&(this.options.saveMissingPlurals&&s?e.forEach((e=>{const t=this.pluralResolver.getSuffixes(e,a);d&&a[`defaultValue${this.options.pluralSeparator}zero`]&&t.indexOf(`${this.options.pluralSeparator}zero`)<0&&t.push(`${this.options.pluralSeparator}zero`),t.forEach((t=>{i([e],r+t,a[`defaultValue${t}`]||O)}))})):i(e,r,O))}l=this.extendTranslation(l,e,a,S,i),E&&l===r&&this.options.appendNamespaceToMissingKey&&(l=`${_}:${r}`),(E||o)&&this.options.parseMissingKeyHandler&&(l=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${_}:${r}`:r,o?l:void 0))}else{if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(I,l,{...a,ns:E}):`key '${r} (${this.language})' returned an object instead of string.`;return o?(S.res=e,S.usedParams=this.getUsedParamsDetails(a),S):e}if(n){const e=Array.isArray(l),t=e?[]:{},i=e?u:I;for(const e in l)if(Object.prototype.hasOwnProperty.call(l,e)){const o=`${i}${n}${e}`;t[e]=this.translate(o,{...a,joinArrays:!1,ns:E}),t[e]===o&&(t[e]=l[e])}l=t}}return o?(S.res=l,S.usedParams=this.getUsedParamsDetails(a),S):l}extendTranslation(e,a,i,o,n){var r=this;if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...i},i.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!i.skipInterpolation){i.interpolation&&this.interpolator.init({...i,interpolation:{...this.options.interpolation,...i.interpolation}});const E=t(e)&&(void 0!==i?.interpolation?.skipOnVariables?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let _;if(E){const t=e.match(this.interpolator.nestingRegexp);_=t&&t.length}let T=i.replace&&!t(i.replace)?i.replace:i;if(this.options.interpolation.defaultVariables&&(T={...this.options.interpolation.defaultVariables,...T}),e=this.interpolator.interpolate(e,T,i.lng||this.language||o.usedLng,i),E){const t=e.match(this.interpolator.nestingRegexp);_<(t&&t.length)&&(i.nest=!1)}!i.lng&&o&&o.res&&(i.lng=this.language||o.usedLng),!1!==i.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,t=new Array(e),o=0;o1&&void 0!==arguments[1]?arguments[1]:{};return t(e)&&(e=[e]),e.forEach((e=>{if(this.isValidLookup(a))return;const _=this.extractFromKey(e,E),T=_.key;i=T;let s=_.namespaces;this.options.fallbackNS&&(s=s.concat(this.options.fallbackNS));const S=void 0!==E.count&&!t(E.count),l=S&&!E.ordinal&&0===E.count,I=void 0!==E.context&&(t(E.context)||"number"==typeof E.context)&&""!==E.context,u=E.lngs?E.lngs:this.languageUtils.toResolveHierarchy(E.lng||this.language,E.fallbackLng);s.forEach((e=>{this.isValidLookup(a)||(r=e,p[`${u[0]}-${e}`]||!this.utils?.hasLoadedNamespace||this.utils?.hasLoadedNamespace(r)||(p[`${u[0]}-${e}`]=!0,this.logger.warn(`key "${i}" for languages "${u.join(", ")}" won't get resolved as namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),u.forEach((t=>{if(this.isValidLookup(a))return;n=t;const i=[T];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(i,T,t,e,E);else{let e;S&&(e=this.pluralResolver.getSuffix(t,E.count,E));const a=`${this.options.pluralSeparator}zero`,o=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(S&&(i.push(T+e),E.ordinal&&0===e.indexOf(o)&&i.push(T+e.replace(o,this.options.pluralSeparator)),l&&i.push(T+a)),I){const t=`${T}${this.options.contextSeparator}${E.context}`;i.push(t),S&&(i.push(t+e),E.ordinal&&0===e.indexOf(o)&&i.push(t+e.replace(o,this.options.pluralSeparator)),l&&i.push(t+a))}}let r;for(;r=i.pop();)this.isValidLookup(a)||(o=r,a=this.getResource(t,e,r,E))})))}))})),{res:a,usedKey:i,exactUsedKey:o,usedLng:n,usedNS:r}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,a){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,a,i):this.resourceStore.getResource(e,t,a,i)}getUsedParamsDetails(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const a=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],i=e.replace&&!t(e.replace);let o=i?e.replace:e;if(i&&void 0!==e.count&&(o.count=e.count),this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),!i){o={...o};for(const e of a)delete o[e]}return o}static hasDefaultValue(e){const t="defaultValue";for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)&&t===a.substring(0,12)&&void 0!==e[a])return!0;return!1}}class C{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=N.create("languageUtils")}getScriptPartFromCode(e){if(!(e=O(e))||e.indexOf("-")<0)return null;const t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}getLanguagePartFromCode(e){if(!(e=O(e))||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(t(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch(e){}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach((e=>{if(t)return;const a=this.formatLanguageCode(e);this.options.supportedLngs&&!this.isSupportedCode(a)||(t=a)})),!t&&this.options.supportedLngs&&e.forEach((e=>{if(t)return;const a=this.getLanguagePartFromCode(e);if(this.isSupportedCode(a))return t=a;t=this.options.supportedLngs.find((e=>e===a?e:e.indexOf("-")<0&&a.indexOf("-")<0?void 0:e.indexOf("-")>0&&a.indexOf("-")<0&&e.substring(0,e.indexOf("-"))===a||0===e.indexOf(a)&&a.length>1?e:void 0))})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,a){if(!e)return[];if("function"==typeof e&&(e=e(a)),t(e)&&(e=[e]),Array.isArray(e))return e;if(!a)return e.default||[];let i=e[a];return i||(i=e[this.getScriptPartFromCode(a)]),i||(i=e[this.formatLanguageCode(a)]),i||(i=e[this.getLanguagePartFromCode(a)]),i||(i=e.default),i||[]}toResolveHierarchy(e,a){const i=this.getFallbackCodes(a||this.options.fallbackLng||[],e),o=[],n=e=>{e&&(this.isSupportedCode(e)?o.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return t(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&n(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&n(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&n(this.getLanguagePartFromCode(e))):t(e)&&n(this.formatLanguageCode(e)),i.forEach((e=>{o.indexOf(e)<0&&n(this.formatLanguageCode(e))})),o}}const f={zero:0,one:1,two:2,few:3,many:4,other:5},P={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class B{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=N.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=O("dev"===e?"en":e),i=t.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:a,type:i});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let n;try{n=new Intl.PluralRules(a,{type:i})}catch(a){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),P;if(!e.match(/-|_/))return P;const i=this.languageUtils.getLanguagePartFromCode(e);n=this.getRule(i,t)}return this.pluralRulesCache[o]=n,n}needsPlural(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=this.getRule(e,t);return a||(a=this.getRule("dev",t)),a?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,a).map((e=>`${t}${e}`))}getSuffixes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=this.getRule(e,t);return a||(a=this.getRule("dev",t)),a?a.resolvedOptions().pluralCategories.sort(((e,t)=>f[e]-f[t])).map((e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`)):[]}getSuffix(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=this.getRule(e,a);return i?`${this.options.prepend}${a.ordinal?`ordinal${this.options.prepend}`:""}${i.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,a))}}const g=function(e,a,i){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".",n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],r=((e,t,a)=>{const i=T(e,a);return void 0!==i?i:T(t,a)})(e,a,i);return!r&&n&&t(i)&&(r=d(e,i,o),void 0===r&&(r=d(a,i,o))),r},v=e=>e.replace(/\$/g,"$$$$");class M{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=N.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:a,useRawValueToEscape:i,prefix:o,prefixEscaped:n,suffix:r,suffixEscaped:E,formatSeparator:_,unescapeSuffix:T,unescapePrefix:s,nestingPrefix:l,nestingPrefixEscaped:u,nestingSuffix:A,nestingSuffixEscaped:d,nestingOptionsSeparator:O,maxReplaces:c,alwaysFormat:R}=e.interpolation;this.escape=void 0!==t?t:I,this.escapeValue=void 0===a||a,this.useRawValueToEscape=void 0!==i&&i,this.prefix=o?S(o):n||"{{",this.suffix=r?S(r):E||"}}",this.formatSeparator=_||",",this.unescapePrefix=T?"":s||"-",this.unescapeSuffix=this.unescapePrefix?"":T||"",this.nestingPrefix=l?S(l):u||S("$t("),this.nestingSuffix=A?S(A):d||S(")"),this.nestingOptionsSeparator=O||",",this.maxReplaces=c||1e3,this.alwaysFormat=void 0!==R&&R,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,a,o,n){let r,E,_;const T=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},s=e=>{if(e.indexOf(this.formatSeparator)<0){const t=g(a,T,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(t,void 0,o,{...n,...a,interpolationkey:e}):t}const t=e.split(this.formatSeparator),i=t.shift().trim(),r=t.join(this.formatSeparator).trim();return this.format(g(a,T,i,this.options.keySeparator,this.options.ignoreJSONStructure),r,o,{...n,...a,interpolationkey:i})};this.resetRegExp();const S=n?.missingInterpolationHandler||this.options.missingInterpolationHandler,l=void 0!==n?.interpolation?.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>v(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?v(this.escape(e)):v(e)}].forEach((a=>{for(_=0;r=a.regex.exec(e);){const o=r[1].trim();if(E=s(o),void 0===E)if("function"==typeof S){const a=S(e,r,n);E=t(a)?a:""}else if(n&&Object.prototype.hasOwnProperty.call(n,o))E="";else{if(l){E=r[0];continue}this.logger.warn(`missed to pass in variable ${o} for interpolating ${e}`),E=""}else t(E)||this.useRawValueToEscape||(E=i(E));const T=a.safeValue(E);if(e=e.replace(r[0],T),l?(a.regex.lastIndex+=E.length,a.regex.lastIndex-=r[0].length):a.regex.lastIndex=0,_++,_>=this.maxReplaces)break}})),e}nest(e,a){let o,n,r,E=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const _=(e,t)=>{const a=this.nestingOptionsSeparator;if(e.indexOf(a)<0)return e;const i=e.split(new RegExp(`${a}[ ]*{`));let o=`{${i[1]}`;e=i[0],o=this.interpolate(o,r);const n=o.match(/'/g),E=o.match(/"/g);((n?.length??0)%2==0&&!E||E.length%2!=0)&&(o=o.replace(/'/g,'"'));try{r=JSON.parse(o),t&&(r={...t,...r})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${a}${o}`}return r.defaultValue&&r.defaultValue.indexOf(this.prefix)>-1&&delete r.defaultValue,e};for(;o=this.nestingRegexp.exec(e);){let T=[];r={...E},r=r.replace&&!t(r.replace)?r.replace:r,r.applyPostProcessor=!1,delete r.defaultValue;let s=!1;if(-1!==o[0].indexOf(this.formatSeparator)&&!/{.*}/.test(o[1])){const e=o[1].split(this.formatSeparator).map((e=>e.trim()));o[1]=e.shift(),T=e,s=!0}if(n=a(_.call(this,o[1].trim(),r),r),n&&o[0]===e&&!t(n))return n;t(n)||(n=i(n)),n||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${e}`),n=""),s&&(n=T.reduce(((e,t)=>this.format(e,t,E.lng,{...E,interpolationkey:o[1].trim()})),n.trim())),e=e.replace(o[0],n),this.regexp.lastIndex=0}return e}}const W=e=>{const t={};return(a,i,o)=>{let n=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(n={...n,[o.interpolationkey]:void 0});const r=i+JSON.stringify(n);let E=t[r];return E||(E=e(O(i),o),t[r]=E),E(a)}};class y{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=N.create("formatter"),this.options=e,this.formats={number:W(((e,t)=>{const a=new Intl.NumberFormat(e,{...t});return e=>a.format(e)})),currency:W(((e,t)=>{const a=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>a.format(e)})),datetime:W(((e,t)=>{const a=new Intl.DateTimeFormat(e,{...t});return e=>a.format(e)})),relativetime:W(((e,t)=>{const a=new Intl.RelativeTimeFormat(e,{...t});return e=>a.format(e,t.range||"day")})),list:W(((e,t)=>{const a=new Intl.ListFormat(e,{...t});return e=>a.format(e)}))},this.init(e)}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};this.formatSeparator=t.interpolation.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=W(t)}format(e,t,a){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=t.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&o[0].indexOf(")")<0&&o.find((e=>e.indexOf(")")>-1))){const e=o.findIndex((e=>e.indexOf(")")>-1));o[0]=[o[0],...o.splice(1,e)].join(this.formatSeparator)}return o.reduce(((e,t)=>{const{formatName:o,formatOptions:n}=(e=>{let t=e.toLowerCase().trim();const a={};if(e.indexOf("(")>-1){const i=e.split("(");t=i[0].toLowerCase().trim();const o=i[1].substring(0,i[1].length-1);"currency"===t&&o.indexOf(":")<0?a.currency||(a.currency=o.trim()):"relativetime"===t&&o.indexOf(":")<0?a.range||(a.range=o.trim()):o.split(";").forEach((e=>{if(e){const[t,...i]=e.split(":"),o=i.join(":").trim().replace(/^'+|'+$/g,""),n=t.trim();a[n]||(a[n]=o),"false"===o&&(a[n]=!1),"true"===o&&(a[n]=!0),isNaN(o)||(a[n]=parseInt(o,10))}}))}return{formatName:t,formatOptions:a}})(t);if(this.formats[o]){let t=e;try{const r=i?.formatParams?.[i.interpolationkey]||{},E=r.locale||r.lng||i.locale||i.lng||a;t=this.formats[o](e,E,{...n,...i,...r})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${o}`),e}),e)}}class b extends m{constructor(e,t,a){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=a,this.languageUtils=a.languageUtils,this.options=i,this.logger=N.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(a,i.backend,i)}queueLoad(e,t,a,i){const o={},n={},r={},E={};return e.forEach((e=>{let i=!0;t.forEach((t=>{const r=`${e}|${t}`;!a.reload&&this.store.hasResourceBundle(e,t)?this.state[r]=2:this.state[r]<0||(1===this.state[r]?void 0===n[r]&&(n[r]=!0):(this.state[r]=1,i=!1,void 0===n[r]&&(n[r]=!0),void 0===o[r]&&(o[r]=!0),void 0===E[t]&&(E[t]=!0)))})),i||(r[e]=!0)})),(Object.keys(o).length||Object.keys(n).length)&&this.queue.push({pending:n,pendingCount:Object.keys(n).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(o),pending:Object.keys(n),toLoadLanguages:Object.keys(r),toLoadNamespaces:Object.keys(E)}}loaded(e,t,a){const i=e.split("|"),o=i[0],n=i[1];t&&this.emit("failedLoading",o,n,t),!t&&a&&this.store.addResourceBundle(o,n,a,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&a&&(this.state[e]=0);const r={};this.queue.forEach((a=>{((e,t,a)=>{const{obj:i,k:o}=E(e,t,Object);i[o]=i[o]||[],i[o].push(a)})(a.loaded,[o],n),((e,t)=>{void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)})(a,e),t&&a.errors.push(t),0!==a.pendingCount||a.done||(Object.keys(a.loaded).forEach((e=>{r[e]||(r[e]={});const t=a.loaded[e];t.length&&t.forEach((t=>{void 0===r[e][t]&&(r[e][t]=!0)}))})),a.done=!0,a.errors.length?a.callback(a.errors):a.callback())})),this.emit("loaded",r),this.queue=this.queue.filter((e=>!e.done))}read(e,t,a){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,n=arguments.length>5?arguments[5]:void 0;if(!e.length)return n(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:a,tried:i,wait:o,callback:n});this.readingCalls++;const r=(r,E)=>{if(this.readingCalls--,this.waitingReads.length>0){const e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}r&&E&&i{this.read.call(this,e,t,a,i+1,2*o,n)}),o):n(r,E)},E=this.backend[a].bind(this.backend);if(2!==E.length)return E(e,t,r);try{const a=E(e,t);a&&"function"==typeof a.then?a.then((e=>r(null,e))).catch(r):r(null,a)}catch(e){r(e)}}prepareLoading(e,a){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();t(e)&&(e=this.languageUtils.toResolveHierarchy(e)),t(a)&&(a=[a]);const n=this.queueLoad(e,a,i,o);if(!n.toLoad.length)return n.pending.length||o(),null;n.toLoad.forEach((e=>{this.loadOne(e)}))}load(e,t,a){this.prepareLoading(e,t,{},a)}reload(e,t,a){this.prepareLoading(e,t,{reload:!0},a)}loadOne(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const a=e.split("|"),i=a[0],o=a[1];this.read(i,o,"read",void 0,void 0,((a,n)=>{a&&this.logger.warn(`${t}loading namespace ${o} for language ${i} failed`,a),!a&&n&&this.logger.log(`${t}loaded namespace ${o} for language ${i}`,n),this.loaded(e,a,n)}))}saveMissing(e,t,a,i,o){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},r=arguments.length>6&&void 0!==arguments[6]?arguments[6]:()=>{};if(!this.services?.utils?.hasLoadedNamespace||this.services?.utils?.hasLoadedNamespace(t)){if(null!=a&&""!==a){if(this.backend?.create){const E={...n,isUpdate:o},_=this.backend.create.bind(this.backend);if(_.length<6)try{let o;o=5===_.length?_(e,t,a,i,E):_(e,t,a,i),o&&"function"==typeof o.then?o.then((e=>r(null,e))).catch(r):r(null,o)}catch(e){r(e)}else _(e,t,a,i,r,E)}e&&e[0]&&this.store.addResource(e[0],t,a,i)}}else this.logger.warn(`did not save key "${a}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")}}const U=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let a={};if("object"==typeof e[1]&&(a=e[1]),t(e[1])&&(a.defaultValue=e[1]),t(e[2])&&(a.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){const t=e[3]||e[2];Object.keys(t).forEach((e=>{a[e]=t[e]}))}return a},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),G=e=>(t(e.ns)&&(e.ns=[e.ns]),t(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),t(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),"boolean"==typeof e.initImmediate&&(e.initAsync=e.initImmediate),e),k=()=>{};class F extends m{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;var a;if(super(),this.options=G(e),this.services={},this.logger=N,this.modules={external:[]},a=this,Object.getOwnPropertyNames(Object.getPrototypeOf(a)).forEach((e=>{"function"==typeof a[e]&&(a[e]=a[e].bind(a))})),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout((()=>{this.init(e,t)}),0)}}init(){var e=this;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,"function"==typeof i&&(o=i,i={}),!i.defaultNS&&!1!==i.defaultNS&&i.ns&&(t(i.ns)?i.defaultNS=i.ns:i.ns.indexOf("translation")<0&&(i.defaultNS=i.ns[0]));const n=U();this.options={...n,...this.options,...G(i)},this.options.interpolation={...n.interpolation,...this.options.interpolation},void 0!==i.keySeparator&&(this.options.userDefinedKeySeparator=i.keySeparator),void 0!==i.nsSeparator&&(this.options.userDefinedNsSeparator=i.nsSeparator);const r=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let t;this.modules.logger?N.init(r(this.modules.logger),this.options):N.init(null,this.options),t=this.modules.formatter?this.modules.formatter:y;const a=new C(this.options);this.store=new L(this.options.resources,this.options);const i=this.services;i.logger=N,i.resourceStore=this.store,i.languageUtils=a,i.pluralResolver=new B(a,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!t||this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format||(i.formatter=r(t),i.formatter.init(i,this.options),this.options.interpolation.format=i.formatter.format.bind(i.formatter)),i.interpolator=new M(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new b(r(this.modules.backend),i.resourceStore,i,this.options),i.backendConnector.on("*",(function(t){for(var a=arguments.length,i=new Array(a>1?a-1:0),o=1;o1?a-1:0),o=1;o{e.init&&e.init(this)}))}if(this.format=this.options.interpolation.format,o||(o=k),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach((t=>{this[t]=function(){return e.store[t](...arguments)}}));["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((t=>{this[t]=function(){return e.store[t](...arguments),e}}));const E=a(),_=()=>{const e=(e,t)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),E.resolve(t),o(e,t)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?_():setTimeout(_,0),E}loadResources(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:k;const i=t(e)?e:this.language;if("function"==typeof e&&(a=e),!this.options.resources||this.options.partialBundledLanguages){if("cimode"===i?.toLowerCase()&&(!this.options.preload||0===this.options.preload.length))return a();const e=[],t=t=>{if(!t)return;if("cimode"===t)return;this.services.languageUtils.toResolveHierarchy(t).forEach((t=>{"cimode"!==t&&e.indexOf(t)<0&&e.push(t)}))};if(i)t(i);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((e=>t(e)))}this.options.preload?.forEach?.((e=>t(e))),this.services.backendConnector.load(e,this.options.ns,(e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),a(e)}))}else a(null)}reloadResources(e,t,i){const o=a();return"function"==typeof e&&(i=e,e=void 0),"function"==typeof t&&(i=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),i||(i=k),this.services.backendConnector.reload(e,t,(e=>{o.resolve(),i(e)})),o}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&D.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(let e=0;e-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}}changeLanguage(e,i){var o=this;this.isLanguageChangingTo=e;const n=a();this.emit("languageChanging",e);const r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},E=(e,t)=>{t?(r(t),this.translator.changeLanguage(t),this.isLanguageChangingTo=void 0,this.emit("languageChanged",t),this.logger.log("languageChanged",t)):this.isLanguageChangingTo=void 0,n.resolve((function(){return o.t(...arguments)})),i&&i(e,(function(){return o.t(...arguments)}))},_=a=>{e||a||!this.services.languageDetector||(a=[]);const i=t(a)?a:this.services.languageUtils.getBestMatchFromCodes(a);i&&(this.language||r(i),this.translator.language||this.translator.changeLanguage(i),this.services.languageDetector?.cacheUserLanguage?.(i)),this.loadResources(i,(e=>{E(e,i)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(_):this.services.languageDetector.detect(_):_(e):_(this.services.languageDetector.detect()),n}getFixedT(e,a,i){var o=this;const n=function(e,t){let a;if("object"!=typeof t){for(var r=arguments.length,E=new Array(r>2?r-2:0),_=2;_`${a.keyPrefix}${T}${e}`)):a.keyPrefix?`${a.keyPrefix}${T}${e}`:e,o.t(s,a)};return t(e)?n.lng=e:n.lngs=e,n.ns=a,n.keyPrefix=i,n}t(){for(var e=arguments.length,t=new Array(e),a=0;a1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const a=t.lng||this.resolvedLanguage||this.languages[0],i=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===a.toLowerCase())return!0;const n=(e,t)=>{const a=this.services.backendConnector.state[`${e}|${t}`];return-1===a||0===a||2===a};if(t.precheck){const e=t.precheck(this,n);if(void 0!==e)return e}return!!this.hasResourceBundle(a,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!n(a,e)||i&&!n(o,e)))}loadNamespaces(e,i){const o=a();return this.options.ns?(t(e)&&(e=[e]),e.forEach((e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)})),this.loadResources((e=>{o.resolve(),i&&i(e)})),o):(i&&i(),Promise.resolve())}loadLanguages(e,i){const o=a();t(e)&&(e=[e]);const n=this.options.preload||[],r=e.filter((e=>n.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e)));return r.length?(this.options.preload=n.concat(r),this.loadResources((e=>{o.resolve(),i&&i(e)})),o):(i&&i(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";const t=this.services?.languageUtils||new C(U());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){return new F(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}cloneInstance(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:k;const a=e.forkResourceStore;a&&delete e.forkResourceStore;const i={...this.options,...e,isClone:!0},o=new F(i);void 0===e.debug&&void 0===e.prefix||(o.logger=o.logger.clone(e));return["store","services","language"].forEach((e=>{o[e]=this[e]})),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},a&&(o.store=new L(this.store.data,i),o.services.resourceStore=o.store),o.translator=new h(o.services,i),o.translator.on("*",(function(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),i=1;i{t.read=function(e,t,a,i,o){var n,r,E=8*o-i-1,_=(1<>1,s=-7,S=a?o-1:0,l=a?-1:1,I=e[t+S];for(S+=l,n=I&(1<<-s)-1,I>>=-s,s+=E;s>0;n=256*n+e[t+S],S+=l,s-=8);for(r=n&(1<<-s)-1,n>>=-s,s+=i;s>0;r=256*r+e[t+S],S+=l,s-=8);if(0===n)n=1-T;else{if(n===_)return r?NaN:1/0*(I?-1:1);r+=Math.pow(2,i),n-=T}return(I?-1:1)*r*Math.pow(2,n-i)},t.write=function(e,t,a,i,o,n){var r,E,_,T=8*n-o-1,s=(1<>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,I=i?0:n-1,u=i?1:-1,A=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(E=isNaN(t)?1:0,r=s):(r=Math.floor(Math.log(t)/Math.LN2),t*(_=Math.pow(2,-r))<1&&(r--,_*=2),(t+=r+S>=1?l/_:l*Math.pow(2,1-S))*_>=2&&(r++,_/=2),r+S>=s?(E=0,r=s):r+S>=1?(E=(t*_-1)*Math.pow(2,o),r+=S):(E=t*Math.pow(2,S-1)*Math.pow(2,o),r=0));o>=8;e[a+I]=255&E,I+=u,E/=256,o-=8);for(r=r<0;e[a+I]=255&r,I+=u,r/=256,T-=8);e[a+I-u]|=128*A}},73220:e=>{e.exports=[{name:"Abkhaz",local:"Аҧсуа",1:"ab",2:"abk","2T":"abk","2B":"abk",3:"abk"},{name:"Afar",local:"Afaraf",1:"aa",2:"aar","2T":"aar","2B":"aar",3:"aar"},{name:"Afrikaans",local:"Afrikaans",1:"af",2:"afr","2T":"afr","2B":"afr",3:"afr"},{name:"Akan",local:"Akan",1:"ak",2:"aka","2T":"aka","2B":"aka",3:"aka"},{name:"Albanian",local:"Shqip",1:"sq",2:"sqi","2T":"sqi","2B":"alb",3:"sqi"},{name:"Amharic",local:"አማርኛ",1:"am",2:"amh","2T":"amh","2B":"amh",3:"amh"},{name:"Arabic",local:"العربية",1:"ar",2:"ara","2T":"ara","2B":"ara",3:"ara"},{name:"Aragonese",local:"Aragonés",1:"an",2:"arg","2T":"arg","2B":"arg",3:"arg"},{name:"Armenian",local:"Հայերեն",1:"hy",2:"hye","2T":"hye","2B":"arm",3:"hye"},{name:"Assamese",local:"অসমীয়া",1:"as",2:"asm","2T":"asm","2B":"asm",3:"asm"},{name:"Avaric",local:"Авар",1:"av",2:"ava","2T":"ava","2B":"ava",3:"ava"},{name:"Avestan",local:"avesta",1:"ae",2:"ave","2T":"ave","2B":"ave",3:"ave"},{name:"Aymara",local:"Aymar",1:"ay",2:"aym","2T":"aym","2B":"aym",3:"aym"},{name:"Azerbaijani",local:"Azərbaycanca",1:"az",2:"aze","2T":"aze","2B":"aze",3:"aze"},{name:"Bambara",local:"Bamanankan",1:"bm",2:"bam","2T":"bam","2B":"bam",3:"bam"},{name:"Bashkir",local:"Башҡортса",1:"ba",2:"bak","2T":"bak","2B":"bak",3:"bak"},{name:"Basque",local:"Euskara",1:"eu",2:"eus","2T":"eus","2B":"baq",3:"eus"},{name:"Belarusian",local:"Беларуская",1:"be",2:"bel","2T":"bel","2B":"bel",3:"bel"},{name:"Bengali",local:"বাংলা",1:"bn",2:"ben","2T":"ben","2B":"ben",3:"ben"},{name:"Bihari",local:"भोजपुरी",1:"bh",2:"bih","2T":"bih","2B":"bih",3:"bih"},{name:"Bislama",local:"Bislama",1:"bi",2:"bis","2T":"bis","2B":"bis",3:"bis"},{name:"Bosnian",local:"Bosanski",1:"bs",2:"bos","2T":"bos","2B":"bos",3:"bos"},{name:"Breton",local:"Brezhoneg",1:"br",2:"bre","2T":"bre","2B":"bre",3:"bre"},{name:"Bulgarian",local:"Български",1:"bg",2:"bul","2T":"bul","2B":"bul",3:"bul"},{name:"Burmese",local:"မြန်မာဘာသာ",1:"my",2:"mya","2T":"mya","2B":"bur",3:"mya"},{name:"Catalan",local:"Català",1:"ca",2:"cat","2T":"cat","2B":"cat",3:"cat"},{name:"Chamorro",local:"Chamoru",1:"ch",2:"cha","2T":"cha","2B":"cha",3:"cha"},{name:"Chechen",local:"Нохчийн",1:"ce",2:"che","2T":"che","2B":"che",3:"che"},{name:"Chichewa",local:"Chichewa",1:"ny",2:"nya","2T":"nya","2B":"nya",3:"nya"},{name:"Chinese",local:"中文",1:"zh",2:"zho","2T":"zho","2B":"chi",3:"zho",locale:"zh-CN"},{name:"Chinese (Simplified)",local:"中文(簡體)",1:"zh",2:"zhe","2T":"zhe","2B":"chi",3:"zhe",locale:"zh-Hans"},{name:"Chinese (Traditional)",local:"中文(繁體)",1:"zh",2:"zht","2T":"zht","2B":"chi",3:"zht",locale:"zh-Hant"},{name:"Chuvash",local:"Чӑвашла",1:"cv",2:"chv","2T":"chv","2B":"chv",3:"chv"},{name:"Cornish",local:"Kernewek",1:"kw",2:"cor","2T":"cor","2B":"cor",3:"cor"},{name:"Corsican",local:"Corsu",1:"co",2:"cos","2T":"cos","2B":"cos",3:"cos"},{name:"Cree",local:"ᓀᐦᐃᔭᐍᐏᐣ",1:"cr",2:"cre","2T":"cre","2B":"cre",3:"cre"},{name:"Croatian",local:"Hrvatski",1:"hr",2:"hrv","2T":"hrv","2B":"hrv",3:"hrv"},{name:"Czech",local:"Čeština",1:"cs",2:"ces","2T":"ces","2B":"cze",3:"ces"},{name:"Danish",local:"Dansk",1:"da",2:"dan","2T":"dan","2B":"dan",3:"dan"},{name:"Divehi",local:"Divehi",1:"dv",2:"div","2T":"div","2B":"div",3:"div"},{name:"Dutch",local:"Nederlands",1:"nl",2:"nld","2T":"nld","2B":"dut",3:"nld"},{name:"Dzongkha",local:"རྫོང་ཁ",1:"dz",2:"dzo","2T":"dzo","2B":"dzo",3:"dzo"},{name:"English",local:"English",1:"en",2:"eng","2T":"eng","2B":"eng",3:"eng",locale:"en-US"},{name:"Esperanto",local:"Esperanto",1:"eo",2:"epo","2T":"epo","2B":"epo",3:"epo"},{name:"Estonian",local:"Eesti",1:"et",2:"est","2T":"est","2B":"est",3:"est"},{name:"Ewe",local:"Eʋegbe",1:"ee",2:"ewe","2T":"ewe","2B":"ewe",3:"ewe"},{name:"Faroese",local:"Føroyskt",1:"fo",2:"fao","2T":"fao","2B":"fao",3:"fao"},{name:"Fijian",local:"Na Vosa Vaka-Viti",1:"fj",2:"fij","2T":"fij","2B":"fij",3:"fij"},{name:"Finnish",local:"Suomi",1:"fi",2:"fin","2T":"fin","2B":"fin",3:"fin"},{name:"French",local:"Français",1:"fr",2:"fra","2T":"fra","2B":"fre",3:"fra",locale:"fr-FR"},{name:"Fula",local:"Fulfulde",1:"ff",2:"ful","2T":"ful","2B":"ful",3:"ful"},{name:"Galician",local:"Galego",1:"gl",2:"glg","2T":"glg","2B":"glg",3:"glg"},{name:"Georgian",local:"ქართული",1:"ka",2:"kat","2T":"kat","2B":"geo",3:"kat"},{name:"German",local:"Deutsch",1:"de",2:"deu","2T":"deu","2B":"ger",3:"deu"},{name:"Greek",local:"Ελληνικά",1:"el",2:"ell","2T":"ell","2B":"gre",3:"ell"},{name:"Guaraní",local:"Avañe'ẽ",1:"gn",2:"grn","2T":"grn","2B":"grn",3:"grn"},{name:"Gujarati",local:"ગુજરાતી",1:"gu",2:"guj","2T":"guj","2B":"guj",3:"guj"},{name:"Haitian",local:"Kreyòl Ayisyen",1:"ht",2:"hat","2T":"hat","2B":"hat",3:"hat"},{name:"Hausa",local:"هَوُسَ",1:"ha",2:"hau","2T":"hau","2B":"hau",3:"hau"},{name:"Hebrew",local:"עברית",1:"he",2:"heb","2T":"heb","2B":"heb",3:"heb"},{name:"Herero",local:"Otjiherero",1:"hz",2:"her","2T":"her","2B":"her",3:"her"},{name:"Hindi",local:"हिन्दी",1:"hi",2:"hin","2T":"hin","2B":"hin",3:"hin"},{name:"Hiri Motu",local:"Hiri Motu",1:"ho",2:"hmo","2T":"hmo","2B":"hmo",3:"hmo"},{name:"Hungarian",local:"Magyar",1:"hu",2:"hun","2T":"hun","2B":"hun",3:"hun"},{name:"Interlingua",local:"Interlingua",1:"ia",2:"ina","2T":"ina","2B":"ina",3:"ina"},{name:"Indonesian",local:"Bahasa Indonesia",1:"id",2:"ind","2T":"ind","2B":"ind",3:"ind"},{name:"Interlingue",local:"Interlingue",1:"ie",2:"ile","2T":"ile","2B":"ile",3:"ile"},{name:"Irish",local:"Gaeilge",1:"ga",2:"gle","2T":"gle","2B":"gle",3:"gle"},{name:"Igbo",local:"Igbo",1:"ig",2:"ibo","2T":"ibo","2B":"ibo",3:"ibo"},{name:"Inupiaq",local:"Iñupiak",1:"ik",2:"ipk","2T":"ipk","2B":"ipk",3:"ipk"},{name:"Ido",local:"Ido",1:"io",2:"ido","2T":"ido","2B":"ido",3:"ido"},{name:"Icelandic",local:"Íslenska",1:"is",2:"isl","2T":"isl","2B":"ice",3:"isl"},{name:"Italian",local:"Italiano",1:"it",2:"ita","2T":"ita","2B":"ita",3:"ita",locale:"it-IT"},{name:"Inuktitut",local:"ᐃᓄᒃᑎᑐᑦ",1:"iu",2:"iku","2T":"iku","2B":"iku",3:"iku"},{name:"Japanese",local:"日本語",1:"ja",2:"jpn","2T":"jpn","2B":"jpn",3:"jpn",locale:"ja-JP"},{name:"Javanese",local:"Basa Jawa",1:"jv",2:"jav","2T":"jav","2B":"jav",3:"jav"},{name:"Kalaallisut",local:"Kalaallisut",1:"kl",2:"kal","2T":"kal","2B":"kal",3:"kal"},{name:"Kannada",local:"ಕನ್ನಡ",1:"kn",2:"kan","2T":"kan","2B":"kan",3:"kan"},{name:"Kanuri",local:"Kanuri",1:"kr",2:"kau","2T":"kau","2B":"kau",3:"kau"},{name:"Kashmiri",local:"كشميري",1:"ks",2:"kas","2T":"kas","2B":"kas",3:"kas"},{name:"Kazakh",local:"Қазақша",1:"kk",2:"kaz","2T":"kaz","2B":"kaz",3:"kaz"},{name:"Khmer",local:"ភាសាខ្មែរ",1:"km",2:"khm","2T":"khm","2B":"khm",3:"khm"},{name:"Kikuyu",local:"Gĩkũyũ",1:"ki",2:"kik","2T":"kik","2B":"kik",3:"kik"},{name:"Kinyarwanda",local:"Kinyarwanda",1:"rw",2:"kin","2T":"kin","2B":"kin",3:"kin"},{name:"Kyrgyz",local:"Кыргызча",1:"ky",2:"kir","2T":"kir","2B":"kir",3:"kir"},{name:"Komi",local:"Коми",1:"kv",2:"kom","2T":"kom","2B":"kom",3:"kom"},{name:"Kongo",local:"Kongo",1:"kg",2:"kon","2T":"kon","2B":"kon",3:"kon"},{name:"Korean",local:"한국어",1:"ko",2:"kor","2T":"kor","2B":"kor",3:"kor"},{name:"Kurdish",local:"Kurdî",1:"ku",2:"kur","2T":"kur","2B":"kur",3:"kur"},{name:"Kwanyama",local:"Kuanyama",1:"kj",2:"kua","2T":"kua","2B":"kua",3:"kua"},{name:"Latin",local:"Latina",1:"la",2:"lat","2T":"lat","2B":"lat",3:"lat"},{name:"Luxembourgish",local:"Lëtzebuergesch",1:"lb",2:"ltz","2T":"ltz","2B":"ltz",3:"ltz"},{name:"Ganda",local:"Luganda",1:"lg",2:"lug","2T":"lug","2B":"lug",3:"lug"},{name:"Limburgish",local:"Limburgs",1:"li",2:"lim","2T":"lim","2B":"lim",3:"lim"},{name:"Lingala",local:"Lingála",1:"ln",2:"lin","2T":"lin","2B":"lin",3:"lin"},{name:"Lao",local:"ພາສາລາວ",1:"lo",2:"lao","2T":"lao","2B":"lao",3:"lao"},{name:"Lithuanian",local:"Lietuvių",1:"lt",2:"lit","2T":"lit","2B":"lit",3:"lit"},{name:"Luba-Katanga",local:"Tshiluba",1:"lu",2:"lub","2T":"lub","2B":"lub",3:"lub"},{name:"Latvian",local:"Latviešu",1:"lv",2:"lav","2T":"lav","2B":"lav",3:"lav"},{name:"Manx",local:"Gaelg",1:"gv",2:"glv","2T":"glv","2B":"glv",3:"glv"},{name:"Macedonian",local:"Македонски",1:"mk",2:"mkd","2T":"mkd","2B":"mac",3:"mkd"},{name:"Malagasy",local:"Malagasy",1:"mg",2:"mlg","2T":"mlg","2B":"mlg",3:"mlg"},{name:"Malay",local:"Bahasa Melayu",1:"ms",2:"msa","2T":"msa","2B":"may",3:"msa"},{name:"Malayalam",local:"മലയാളം",1:"ml",2:"mal","2T":"mal","2B":"mal",3:"mal"},{name:"Maltese",local:"Malti",1:"mt",2:"mlt","2T":"mlt","2B":"mlt",3:"mlt"},{name:"Māori",local:"Māori",1:"mi",2:"mri","2T":"mri","2B":"mao",3:"mri"},{name:"Marathi",local:"मराठी",1:"mr",2:"mar","2T":"mar","2B":"mar",3:"mar"},{name:"Marshallese",local:"Kajin M̧ajeļ",1:"mh",2:"mah","2T":"mah","2B":"mah",3:"mah"},{name:"Mongolian",local:"Монгол",1:"mn",2:"mon","2T":"mon","2B":"mon",3:"mon"},{name:"Nauru",local:"Dorerin Naoero",1:"na",2:"nau","2T":"nau","2B":"nau",3:"nau"},{name:"Navajo",local:"Diné Bizaad",1:"nv",2:"nav","2T":"nav","2B":"nav",3:"nav"},{name:"Northern Ndebele",local:"isiNdebele",1:"nd",2:"nde","2T":"nde","2B":"nde",3:"nde"},{name:"Nepali",local:"नेपाली",1:"ne",2:"nep","2T":"nep","2B":"nep",3:"nep"},{name:"Ndonga",local:"Owambo",1:"ng",2:"ndo","2T":"ndo","2B":"ndo",3:"ndo"},{name:"Norwegian Bokmål",local:"Norsk (Bokmål)",1:"nb",2:"nob","2T":"nob","2B":"nob",3:"nob",locale:"nb-NO"},{name:"Norwegian Nynorsk",local:"Norsk (Nynorsk)",1:"nn",2:"nno","2T":"nno","2B":"nno",3:"nno",locale:"nn-NO"},{name:"Norwegian",local:"Norsk",1:"no",2:"nor","2T":"nor","2B":"nor",3:"nor",locale:"no-NO"},{name:"Nuosu",local:"ꆈꌠ꒿ Nuosuhxop",1:"ii",2:"iii","2T":"iii","2B":"iii",3:"iii"},{name:"Southern Ndebele",local:"isiNdebele",1:"nr",2:"nbl","2T":"nbl","2B":"nbl",3:"nbl"},{name:"Occitan",local:"Occitan",1:"oc",2:"oci","2T":"oci","2B":"oci",3:"oci"},{name:"Ojibwe",local:"ᐊᓂᔑᓈᐯᒧᐎᓐ",1:"oj",2:"oji","2T":"oji","2B":"oji",3:"oji"},{name:"Old Church Slavonic",local:"Словѣ́ньскъ",1:"cu",2:"chu","2T":"chu","2B":"chu",3:"chu"},{name:"Oromo",local:"Afaan Oromoo",1:"om",2:"orm","2T":"orm","2B":"orm",3:"orm"},{name:"Oriya",local:"ଓଡି଼ଆ",1:"or",2:"ori","2T":"ori","2B":"ori",3:"ori"},{name:"Ossetian",local:"Ирон æвзаг",1:"os",2:"oss","2T":"oss","2B":"oss",3:"oss"},{name:"Panjabi",local:"ਪੰਜਾਬੀ",1:"pa",2:"pan","2T":"pan","2B":"pan",3:"pan"},{name:"Pāli",local:"पाऴि",1:"pi",2:"pli","2T":"pli","2B":"pli",3:"pli"},{name:"Persian",local:"فارسی",1:"fa",2:"fas","2T":"fas","2B":"per",3:"fas"},{name:"Polish",local:"Polski",1:"pl",2:"pol","2T":"pol","2B":"pol",3:"pol"},{name:"Pashto",local:"پښتو",1:"ps",2:"pus","2T":"pus","2B":"pus",3:"pus"},{name:"Portuguese",local:"Português",1:"pt",2:"por","2T":"por","2B":"por",3:"por",locale:"pt-PT"},{name:"Portuguese (Brazil)",local:"Português (Brasil)",1:"pb",2:"pob","2T":"pob","2B":"pob",3:"pob",locale:"pt-BR"},{name:"Quechua",local:"Runa Simi",1:"qu",2:"que","2T":"que","2B":"que",3:"que"},{name:"Romansh",local:"Rumantsch",1:"rm",2:"roh","2T":"roh","2B":"roh",3:"roh"},{name:"Kirundi",local:"Kirundi",1:"rn",2:"run","2T":"run","2B":"run",3:"run"},{name:"Romanian",local:"Română",1:"ro",2:"ron","2T":"ron","2B":"rum",3:"ron"},{name:"Russian",local:"Русский",1:"ru",2:"rus","2T":"rus","2B":"rus",3:"rus"},{name:"Sanskrit",local:"संस्कृतम्",1:"sa",2:"san","2T":"san","2B":"san",3:"san"},{name:"Sardinian",local:"Sardu",1:"sc",2:"srd","2T":"srd","2B":"srd",3:"srd"},{name:"Sindhi",local:"سنڌي‎",1:"sd",2:"snd","2T":"snd","2B":"snd",3:"snd"},{name:"Northern Sami",local:"Sámegiella",1:"se",2:"sme","2T":"sme","2B":"sme",3:"sme"},{name:"Samoan",local:"Gagana Sāmoa",1:"sm",2:"smo","2T":"smo","2B":"smo",3:"smo"},{name:"Sango",local:"Sängö",1:"sg",2:"sag","2T":"sag","2B":"sag",3:"sag"},{name:"Serbian",local:"Српски",1:"sr",2:"srp","2T":"srp","2B":"srp",3:"srp"},{name:"Gaelic",local:"Gàidhlig",1:"gd",2:"gla","2T":"gla","2B":"gla",3:"gla"},{name:"Shona",local:"ChiShona",1:"sn",2:"sna","2T":"sna","2B":"sna",3:"sna"},{name:"Sinhala",local:"සිංහල",1:"si",2:"sin","2T":"sin","2B":"sin",3:"sin"},{name:"Slovak",local:"Slovenčina",1:"sk",2:"slk","2T":"slk","2B":"slo",3:"slk"},{name:"Slovene",local:"Slovenščina",1:"sl",2:"slv","2T":"slv","2B":"slv",3:"slv"},{name:"Somali",local:"Soomaaliga",1:"so",2:"som","2T":"som","2B":"som",3:"som"},{name:"Southern Sotho",local:"Sesotho",1:"st",2:"sot","2T":"sot","2B":"sot",3:"sot"},{name:"Spanish",local:"Español",1:"es",2:"spa","2T":"spa","2B":"spa",3:"spa",locale:"es-ES"},{name:"Spanish (Latin America)",local:"Español (América Latina)",1:"es",2:"spl","2T":"spl","2B":"spl",3:"spl",locale:"es-419"},{name:"Sundanese",local:"Basa Sunda",1:"su",2:"sun","2T":"sun","2B":"sun",3:"sun"},{name:"Swahili",local:"Kiswahili",1:"sw",2:"swa","2T":"swa","2B":"swa",3:"swa"},{name:"Swati",local:"SiSwati",1:"ss",2:"ssw","2T":"ssw","2B":"ssw",3:"ssw"},{name:"Swedish",local:"Svenska",1:"sv",2:"swe","2T":"swe","2B":"swe",3:"swe"},{name:"Tamil",local:"தமிழ்",1:"ta",2:"tam","2T":"tam","2B":"tam",3:"tam"},{name:"Telugu",local:"తెలుగు",1:"te",2:"tel","2T":"tel","2B":"tel",3:"tel"},{name:"Tajik",local:"Тоҷикӣ",1:"tg",2:"tgk","2T":"tgk","2B":"tgk",3:"tgk"},{name:"Thai",local:"ภาษาไทย",1:"th",2:"tha","2T":"tha","2B":"tha",3:"tha"},{name:"Tigrinya",local:"ትግርኛ",1:"ti",2:"tir","2T":"tir","2B":"tir",3:"tir"},{name:"Tibetan Standard",local:"བོད་ཡིག",1:"bo",2:"bod","2T":"bod","2B":"tib",3:"bod"},{name:"Turkmen",local:"Türkmençe",1:"tk",2:"tuk","2T":"tuk","2B":"tuk",3:"tuk"},{name:"Tagalog",local:"Tagalog",1:"tl",2:"tgl","2T":"tgl","2B":"tgl",3:"tgl"},{name:"Tswana",local:"Setswana",1:"tn",2:"tsn","2T":"tsn","2B":"tsn",3:"tsn"},{name:"Tonga",local:"faka Tonga",1:"to",2:"ton","2T":"ton","2B":"ton",3:"ton"},{name:"Turkish",local:"Türkçe",1:"tr",2:"tur","2T":"tur","2B":"tur",3:"tur"},{name:"Tsonga",local:"Xitsonga",1:"ts",2:"tso","2T":"tso","2B":"tso",3:"tso"},{name:"Tatar",local:"Татарча",1:"tt",2:"tat","2T":"tat","2B":"tat",3:"tat"},{name:"Twi",local:"Twi",1:"tw",2:"twi","2T":"twi","2B":"twi",3:"twi"},{name:"Tahitian",local:"Reo Mā’ohi",1:"ty",2:"tah","2T":"tah","2B":"tah",3:"tah"},{name:"Uyghur",local:"ئۇيغۇرچه",1:"ug",2:"uig","2T":"uig","2B":"uig",3:"uig"},{name:"Ukrainian",local:"Українська",1:"uk",2:"ukr","2T":"ukr","2B":"ukr",3:"ukr"},{name:"Urdu",local:"اردو",1:"ur",2:"urd","2T":"urd","2B":"urd",3:"urd"},{name:"Uzbek",local:"O‘zbek",1:"uz",2:"uzb","2T":"uzb","2B":"uzb",3:"uzb"},{name:"Venda",local:"Tshivenḓa",1:"ve",2:"ven","2T":"ven","2B":"ven",3:"ven"},{name:"Vietnamese",local:"Tiếng Việt",1:"vi",2:"vie","2T":"vie","2B":"vie",3:"vie"},{name:"Volapük",local:"Volapük",1:"vo",2:"vol","2T":"vol","2B":"vol",3:"vol"},{name:"Walloon",local:"Walon",1:"wa",2:"wln","2T":"wln","2B":"wln",3:"wln"},{name:"Welsh",local:"Cymraeg",1:"cy",2:"cym","2T":"cym","2B":"wel",3:"cym"},{name:"Wolof",local:"Wolof",1:"wo",2:"wol","2T":"wol","2B":"wol",3:"wol"},{name:"Western Frisian",local:"Frysk",1:"fy",2:"fry","2T":"fry","2B":"fry",3:"fry"},{name:"Xhosa",local:"isiXhosa",1:"xh",2:"xho","2T":"xho","2B":"xho",3:"xho"},{name:"Yiddish",local:"ייִדיש",1:"yi",2:"yid","2T":"yid","2B":"yid",3:"yid"},{name:"Yoruba",local:"Yorùbá",1:"yo",2:"yor","2T":"yor","2B":"yor",3:"yor"},{name:"Zhuang",local:"Cuengh",1:"za",2:"zha","2T":"zha","2B":"zha",3:"zha"},{name:"Zulu",local:"isiZulu",1:"zu",2:"zul","2T":"zul","2B":"zul",3:"zul"}]},96854:(e,t,a)=>{var i=a(73220),o={all:function(){return i},has:function(e,t){return void 0!==n(e,t)},codes:function(e){if((function(e){return-1!==[1,2,3,"1","2","2B","2T","3"].indexOf(e)})(e))return r(i,(function(t){return t[e]}))},names:function(e){return r(i,(function(t){return e?t.local:t.name}))},where:n};function n(e,t){for(var a=0;a{e=a.nmd(e);var i="__lodash_hash_undefined__",o=9007199254740991,n="[object Arguments]",r="[object Boolean]",E="[object Date]",_="[object Function]",T="[object GeneratorFunction]",s="[object Map]",S="[object Number]",l="[object Object]",I="[object Promise]",u="[object RegExp]",A="[object Set]",d="[object String]",O="[object Symbol]",c="[object WeakMap]",R="[object ArrayBuffer]",N="[object DataView]",m="[object Float32Array]",L="[object Float64Array]",D="[object Int8Array]",p="[object Int16Array]",h="[object Int32Array]",C="[object Uint8Array]",f="[object Uint8ClampedArray]",P="[object Uint16Array]",B="[object Uint32Array]",g=/\w*$/,v=/^\[object .+?Constructor\]$/,M=/^(?:0|[1-9]\d*)$/,W={};W[n]=W["[object Array]"]=W[R]=W[N]=W[r]=W[E]=W[m]=W[L]=W[D]=W[p]=W[h]=W[s]=W[S]=W[l]=W[u]=W[A]=W[d]=W[O]=W[C]=W[f]=W[P]=W[B]=!0,W["[object Error]"]=W[_]=W[c]=!1;var y="object"==typeof a.g&&a.g&&a.g.Object===Object&&a.g,b="object"==typeof self&&self&&self.Object===Object&&self,U=y||b||Function("return this")(),G=t&&!t.nodeType&&t,k=G&&e&&!e.nodeType&&e,F=k&&k.exports===G;function V(e,t){return e.set(t[0],t[1]),e}function H(e,t){return e.add(t),e}function w(e,t,a,i){var o=-1,n=e?e.length:0;for(i&&n&&(a=e[++o]);++o-1},fe.prototype.set=function(e,t){var a=this.__data__,i=Me(a,e);return i<0?a.push([e,t]):a[i][1]=t,this},Pe.prototype.clear=function(){this.__data__={hash:new Ce,map:new(ue||fe),string:new Ce}},Pe.prototype.delete=function(e){return Ge(this,e).delete(e)},Pe.prototype.get=function(e){return Ge(this,e).get(e)},Pe.prototype.has=function(e){return Ge(this,e).has(e)},Pe.prototype.set=function(e,t){return Ge(this,e).set(e,t),this},Be.prototype.clear=function(){this.__data__=new fe},Be.prototype.delete=function(e){return this.__data__.delete(e)},Be.prototype.get=function(e){return this.__data__.get(e)},Be.prototype.has=function(e){return this.__data__.has(e)},Be.prototype.set=function(e,t){var a=this.__data__;if(a instanceof fe){var i=a.__data__;if(!ue||i.length<199)return i.push([e,t]),this;a=this.__data__=new Pe(i)}return a.set(e,t),this};var Fe=se?K(se,Object):function(){return[]},Ve=function(e){return te.call(e)};function He(e,t){return!!(t=null==t?o:t)&&("number"==typeof e||M.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=o})(e.length)&&!Qe(e)}var xe=Se||function(){return!1};function Qe(e){var t=Xe(e)?te.call(e):"";return t==_||t==T}function Xe(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function $e(e){return je(e)?ge(e):(function(e){if(!we(e))return le(e);var t=[];for(var a in Object(e))ee.call(e,a)&&"constructor"!=a&&t.push(a);return t})(e)}e.exports=function(e){return We(e,!0,!0)}},20181:(e,t,a)=>{var i=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,r=/^0o[0-7]+$/i,E=parseInt,_="object"==typeof a.g&&a.g&&a.g.Object===Object&&a.g,T="object"==typeof self&&self&&self.Object===Object&&self,s=_||T||Function("return this")(),S=Object.prototype.toString,l=Math.max,I=Math.min,u=function(){return s.Date.now()};function A(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function d(e){if("number"==typeof e)return e;if((function(e){return"symbol"==typeof e||(function(e){return!!e&&"object"==typeof e})(e)&&"[object Symbol]"==S.call(e)})(e))return NaN;if(A(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=A(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var a=n.test(e);return a||r.test(e)?E(e.slice(2),a?2:8):o.test(e)?NaN:+e}e.exports=function(e,t,a){var i,o,n,r,E,_,T=0,s=!1,S=!1,O=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function c(t){var a=i,n=o;return i=o=void 0,T=t,r=e.apply(n,a)}function R(e){var a=e-_;return void 0===_||a>=t||a<0||S&&e-T>=n}function N(){var e=u();if(R(e))return m(e);E=setTimeout(N,(function(e){var a=t-(e-_);return S?I(a,n-(e-T)):a})(e))}function m(e){return E=void 0,O&&i?c(e):(i=o=void 0,r)}function L(){var e=u(),a=R(e);if(i=arguments,o=this,_=e,a){if(void 0===E)return(function(e){return T=e,E=setTimeout(N,t),s?c(e):r})(_);if(S)return E=setTimeout(N,t),c(_)}return void 0===E&&(E=setTimeout(N,t)),r}return t=d(t)||0,A(a)&&(s=!!a.leading,n=(S="maxWait"in a)?l(d(a.maxWait)||0,t):n,O="trailing"in a?!!a.trailing:O),L.cancel=function(){void 0!==E&&clearTimeout(E),T=0,i=_=o=E=void 0},L.flush=function(){return void 0===E?r:m(u())},L}},72931:(e,t,a)=>{var i="__lodash_hash_undefined__",o=9007199254740991,n=/^\[object .+?Constructor\]$/,r="object"==typeof a.g&&a.g&&a.g.Object===Object&&a.g,E="object"==typeof self&&self&&self.Object===Object&&self,_=r||E||Function("return this")();function T(e,t){return!!(e?e.length:0)&&(function(e,t,a){if(t!=t)return(function(e,t,a,i){var o=e.length,n=a+(i?1:-1);for(;i?n--:++n-1}function s(e,t,a){for(var i=-1,o=e?e.length:0;++i-1&&e%1==0&&e<=o})(e.length)&&!w(e)})(e)})(e)?e:[]}function G(e,t){var a,i,o=e.__data__;return("string"==(i=typeof(a=t))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==a:null===a)?o["string"==typeof t?"string":"hash"]:o.map}function k(e,t){var a=(function(e,t){return null==e?void 0:e[t]})(e,t);return b(a)?a:void 0}g.prototype.clear=function(){this.__data__=B?B(null):{}},g.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},g.prototype.get=function(e){var t=this.__data__;if(B){var a=t[e];return a===i?void 0:a}return L.call(t,e)?t[e]:void 0},g.prototype.has=function(e){var t=this.__data__;return B?void 0!==t[e]:L.call(t,e)},g.prototype.set=function(e,t){return this.__data__[e]=B&&void 0===t?i:t,this},v.prototype.clear=function(){this.__data__=[]},v.prototype.delete=function(e){var t=this.__data__,a=y(t,e);return!(a<0)&&(a==t.length-1?t.pop():h.call(t,a,1),!0)},v.prototype.get=function(e){var t=this.__data__,a=y(t,e);return a<0?void 0:t[a][1]},v.prototype.has=function(e){return y(this.__data__,e)>-1},v.prototype.set=function(e,t){var a=this.__data__,i=y(a,e);return i<0?a.push([e,t]):a[i][1]=t,this},M.prototype.clear=function(){this.__data__={hash:new g,map:new(P||v),string:new g}},M.prototype.delete=function(e){return G(this,e).delete(e)},M.prototype.get=function(e){return G(this,e).get(e)},M.prototype.has=function(e){return G(this,e).has(e)},M.prototype.set=function(e,t){return G(this,e).set(e,t),this},W.prototype.add=W.prototype.push=function(e){return this.__data__.set(e,i),this},W.prototype.has=function(e){return this.__data__.has(e)};var F,V,H=(F=function(e){var t=S(e,U);return t.length&&t[0]===e[0]?(function(e,t,a){for(var i=a?s:T,o=e[0].length,n=e.length,r=n,E=Array(n),_=1/0,l=[];r--;){var A=e[r];r&&t&&(A=S(A,I(t))),_=f(A.length,_),E[r]=!a&&(t||o>=120&&A.length>=120)?new W(r&&A):void 0}A=e[0];var d=-1,O=E[0];e:for(;++d{e=a.nmd(e);var i="__lodash_hash_undefined__",o=9007199254740991,n="[object Arguments]",r="[object Array]",E="[object Boolean]",_="[object Date]",T="[object Error]",s="[object Function]",S="[object Map]",l="[object Number]",I="[object Object]",u="[object Promise]",A="[object RegExp]",d="[object Set]",O="[object String]",c="[object Symbol]",R="[object WeakMap]",N="[object ArrayBuffer]",m="[object DataView]",L=/^\[object .+?Constructor\]$/,D=/^(?:0|[1-9]\d*)$/,p={};p["[object Float32Array]"]=p["[object Float64Array]"]=p["[object Int8Array]"]=p["[object Int16Array]"]=p["[object Int32Array]"]=p["[object Uint8Array]"]=p["[object Uint8ClampedArray]"]=p["[object Uint16Array]"]=p["[object Uint32Array]"]=!0,p[n]=p[r]=p[N]=p[E]=p[m]=p[_]=p[T]=p[s]=p[S]=p[l]=p[I]=p[A]=p[d]=p[O]=p[R]=!1;var h="object"==typeof a.g&&a.g&&a.g.Object===Object&&a.g,C="object"==typeof self&&self&&self.Object===Object&&self,f=h||C||Function("return this")(),P=t&&!t.nodeType&&t,B=P&&e&&!e.nodeType&&e,g=B&&B.exports===P,v=g&&h.process,M=(function(){try{return v&&v.binding&&v.binding("util")}catch(e){}})(),W=M&&M.isTypedArray;function y(e,t){for(var a=-1,i=null==e?0:e.length;++aE))return!1;var T=n.get(e);if(T&&n.get(t))return T==t;var s=-1,S=!0,l=2&a?new Ne:void 0;for(n.set(e,t),n.set(t,e);++s-1},ce.prototype.set=function(e,t){var a=this.__data__,i=De(a,e);return i<0?(++this.size,a.push([e,t])):a[i][1]=t,this},Re.prototype.clear=function(){this.size=0,this.__data__={hash:new Oe,map:new(ne||ce),string:new Oe}},Re.prototype.delete=function(e){var t=ve(this,e).delete(e);return this.size-=t?1:0,t},Re.prototype.get=function(e){return ve(this,e).get(e)},Re.prototype.has=function(e){return ve(this,e).has(e)},Re.prototype.set=function(e,t){var a=ve(this,e),i=a.size;return a.set(e,t),this.size+=a.size==i?0:1,this},Ne.prototype.add=Ne.prototype.push=function(e){return this.__data__.set(e,i),this},Ne.prototype.has=function(e){return this.__data__.has(e)},me.prototype.clear=function(){this.__data__=new ce,this.size=0},me.prototype.delete=function(e){var t=this.__data__,a=t.delete(e);return this.size=t.size,a},me.prototype.get=function(e){return this.__data__.get(e)},me.prototype.has=function(e){return this.__data__.has(e)},me.prototype.set=function(e,t){var a=this.__data__;if(a instanceof ce){var i=a.__data__;if(!ne||i.length<199)return i.push([e,t]),this.size=++a.size,this;a=this.__data__=new Re(i)}return a.set(e,t),this.size=a.size,this};var We=te?function(e){return null==e?[]:(e=Object(e),(function(e,t){for(var a=-1,i=null==e?0:e.length,o=0,n=[];++a-1&&e%1==0&&e-1&&e%1==0&&e<=o}function Ye(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ze(e){return null!=e&&"object"==typeof e}var Ke=W?(function(e){return function(t){return e(t)}})(W):function(e){return ze(e)&&we(e.length)&&!!p[pe(e)]};function je(e){return null!=(t=e)&&we(t.length)&&!He(t)?Le(e):Pe(e);var t}e.exports=function(e,t){return Ce(e,t)}},25858:(e,t,a)=>{var i="Expected a function",o=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,r=/^0b[01]+$/i,E=/^0o[0-7]+$/i,_=parseInt,T="object"==typeof a.g&&a.g&&a.g.Object===Object&&a.g,s="object"==typeof self&&self&&self.Object===Object&&self,S=T||s||Function("return this")(),l=Object.prototype.toString,I=Math.max,u=Math.min,A=function(){return S.Date.now()};function d(e,t,a){var o,n,r,E,_,T,s=0,S=!1,l=!1,d=!0;if("function"!=typeof e)throw new TypeError(i);function R(t){var a=o,i=n;return o=n=void 0,s=t,E=e.apply(i,a)}function N(e){var a=e-T;return void 0===T||a>=t||a<0||l&&e-s>=r}function m(){var e=A();if(N(e))return L(e);_=setTimeout(m,(function(e){var a=t-(e-T);return l?u(a,r-(e-s)):a})(e))}function L(e){return _=void 0,d&&o?R(e):(o=n=void 0,E)}function D(){var e=A(),a=N(e);if(o=arguments,n=this,T=e,a){if(void 0===_)return(function(e){return s=e,_=setTimeout(m,t),S?R(e):E})(T);if(l)return _=setTimeout(m,t),R(T)}return void 0===_&&(_=setTimeout(m,t)),E}return t=c(t)||0,O(a)&&(S=!!a.leading,r=(l="maxWait"in a)?I(c(a.maxWait)||0,t):r,d="trailing"in a?!!a.trailing:d),D.cancel=function(){void 0!==_&&clearTimeout(_),s=0,o=T=n=_=void 0},D.flush=function(){return void 0===_?E:L(A())},D}function O(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function c(e){if("number"==typeof e)return e;if((function(e){return"symbol"==typeof e||(function(e){return!!e&&"object"==typeof e})(e)&&"[object Symbol]"==l.call(e)})(e))return NaN;if(O(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=O(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(o,"");var a=r.test(e);return a||E.test(e)?_(e.slice(2),a?2:8):n.test(e)?NaN:+e}e.exports=function(e,t,a){var o=!0,n=!0;if("function"!=typeof e)throw new TypeError(i);return O(a)&&(o="leading"in a?!!a.leading:o,n="trailing"in a?!!a.trailing:n),d(e,t,{leading:o,maxWait:t,trailing:n})}},41968:(e,t,a)=>{var i=a(48287).hp;e.exports=r,e.exports.decode=r,e.exports.encode=function(e){e=Object.assign({},e);let t=new Set;e.xt&&"string"==typeof e.xt&&t.add(e.xt);e.xt&&Array.isArray(e.xt)&&(t=new Set(e.xt));e.infoHashBuffer&&t.add(`urn:btih:${e.infoHashBuffer.toString("hex")}`);e.infoHash&&t.add(`urn:btih:${e.infoHash}`);e.infoHashV2Buffer&&t.add(e.xt=`urn:btmh:1220${e.infoHashV2Buffer.toString("hex")}`);e.infoHashV2&&t.add(`urn:btmh:1220${e.infoHashV2}`);const a=Array.from(t);1===a.length&&(e.xt=a[0]);a.length>1&&(e.xt=a);e.publicKeyBuffer&&(e.xs=`urn:btpk:${e.publicKeyBuffer.toString("hex")}`);e.publicKey&&(e.xs=`urn:btpk:${e.publicKey}`);e.name&&(e.dn=e.name);e.keywords&&(e.kt=e.keywords);e.announce&&(e.tr=e.announce);e.urlList&&(e.ws=e.urlList,delete e.as);e.peerAddresses&&(e["x.pe"]=e.peerAddresses);let i="magnet:?";return Object.keys(e).filter((e=>2===e.length||"x.pe"===e)).forEach(((t,a)=>{const o=Array.isArray(e[t])?e[t]:[e[t]];o.forEach(((e,o)=>{(a>0||o>0)&&("kt"!==t&&"so"!==t||0===o)&&(i+="&"),"dn"===t&&(e=encodeURIComponent(e).replace(/%20/g,"+")),"tr"!==t&&"as"!==t&&"ws"!==t||(e=encodeURIComponent(e)),"xs"!==t||e.startsWith("urn:btpk:")||(e=encodeURIComponent(e)),"kt"===t&&(e=encodeURIComponent(e)),"so"!==t&&(i+="kt"===t&&o>0?`+${e}`:`${t}=${e}`)})),"so"===t&&(i+=`${t}=${n.compose(o)}`)})),i};const o=a(30804),n=a(13960);function r(e){const t={},a=e.split("magnet:?")[1];let r;if((a&&a.length>=0?a.split("&"):[]).forEach((e=>{const a=e.split("=");if(2!==a.length)return;const i=a[0];let o=a[1];"dn"===i&&(o=decodeURIComponent(o).replace(/\+/g," ")),"tr"!==i&&"xs"!==i&&"as"!==i&&"ws"!==i||(o=decodeURIComponent(o)),"kt"===i&&(o=decodeURIComponent(o).split("+")),"ix"===i&&(o=Number(o)),"so"===i&&(o=n.parse(decodeURIComponent(o).split(","))),t[i]?(Array.isArray(t[i])||(t[i]=[t[i]]),t[i].push(o)):t[i]=o})),t.xt){(Array.isArray(t.xt)?t.xt:[t.xt]).forEach((e=>{if(r=e.match(/^urn:btih:(.{40})/))t.infoHash=r[1].toLowerCase();else if(r=e.match(/^urn:btih:(.{32})/)){const e=o.decode(r[1]);t.infoHash=i.from(e,"binary").toString("hex")}else(r=e.match(/^urn:btmh:1220(.{64})/))&&(t.infoHashV2=r[1].toLowerCase())}))}if(t.xs){(Array.isArray(t.xs)?t.xs:[t.xs]).forEach((e=>{(r=e.match(/^urn:btpk:(.{64})/))&&(t.publicKey=r[1].toLowerCase())}))}return t.infoHash&&(t.infoHashBuffer=i.from(t.infoHash,"hex")),t.infoHashV2&&(t.infoHashV2Buffer=i.from(t.infoHashV2,"hex")),t.publicKey&&(t.publicKeyBuffer=i.from(t.publicKey,"hex")),t.dn&&(t.name=t.dn),t.kt&&(t.keywords=t.kt),t.announce=[],("string"==typeof t.tr||Array.isArray(t.tr))&&(t.announce=t.announce.concat(t.tr)),t.urlList=[],("string"==typeof t.as||Array.isArray(t.as))&&(t.urlList=t.urlList.concat(t.as)),("string"==typeof t.ws||Array.isArray(t.ws))&&(t.urlList=t.urlList.concat(t.ws)),t.peerAddresses=[],("string"==typeof t["x.pe"]||Array.isArray(t["x.pe"]))&&(t.peerAddresses=t.peerAddresses.concat(t["x.pe"])),t.announce=Array.from(new Set(t.announce)),t.urlList=Array.from(new Set(t.urlList)),t.peerAddresses=Array.from(new Set(t.peerAddresses)),t}},46565:e=>{e.exports={"error-container":"error-container-OJnoc","error-image":"error-image-qU9Qo","error-message":"error-message-kW59Z","buttons-container":"buttons-container-tQonN","button-container":"button-container-vLSQK",label:"label-Up_te"}},8589:e=>{e.exports={"updater-banner":"updater-banner-MjMLN",button:"button-ixcOU",close:"close-Quid9",icon:"icon-N2Lyd"}},19654:e=>{e.exports={"fade-in":"fade-in-pFkt_","fade-in-no-motion":"fade-in-no-motion-lYmxL","slide-up":"slide-up-lSxrC","toasts-container":"toasts-container-oKECy","tooltip-container":"tooltip-container-Qpse8","file-drop-container":"file-drop-container-gHJoy","updater-banner-container":"updater-banner-container-Bk1mq",router:"router-_65XU","loader-container":"loader-container-vwvnb","error-container":"error-container-VZXwH"}},39459:e=>{e.exports={"toast-item-container":"toast-item-container-nG0uk",success:"success-eIDTa","icon-container":"icon-container-rjAiH",icon:"icon-Y4I_O",error:"error-quyOd",info:"info-KEWq8","info-container":"info-container-xD9V6","title-container":"title-container-VFReJ","message-container":"message-container-znkCj","close-button-container":"close-button-container-YtyYE"}},70913:e=>{e.exports={"tooltip-placeholder":"tooltip-placeholder-niioe"}},86780:e=>{e.exports={"tooltip-item":"tooltip-item-gfYXu"}},12698:e=>{e.exports={"addon-details-container":"addon-details-container-tUlp2","title-container":"title-container-Ca076",logo:"logo-Nynh9",icon:"icon-ZYXtC","name-container":"name-container-XxPAj",name:"name-i0o3Y",version:"version-FdUq6","section-container":"section-container-N6QHW","section-header":"section-header-tbXCb","section-label":"section-label-_R7gz","transport-url-label":"transport-url-label-upr4V","disclaimer-label":"disclaimer-label-I7kvM"}},51139:e=>{e.exports={"addon-details-modal-container":"addon-details-modal-container-aBFaQ","addon-details-container":"addon-details-container-VdGrt","addon-details-message-container":"addon-details-message-container-X2sRf","cancel-button":"cancel-button-zuUX6","cancel-button-label":"cancel-button-label-ZOQUJ","uninstall-button":"uninstall-button-iLxLs"}},21512:e=>{e.exports={"bottom-sheet":"bottom-sheet-VtqY2",backdrop:"backdrop-Doe6y",container:"container-yiLtz",dragging:"dragging-ML0cp",heading:"heading-xf2ct",handle:"handle-TCLds",title:"title-QtERv",content:"content-ElxXl"}},82050:e=>{e.exports={"button-container":"button-container-zVLH6"}},69546:e=>{e.exports={chip:"chip-L3r9A",active:"active-jnhyP"}},71976:e=>{e.exports={chips:"chips-Uw41c"}},55685:e=>{e.exports={"color-picker-container":"color-picker-container-Cny5U"}},37603:e=>{e.exports={"color-input-container":"color-input-container-X5ZPx","transparent-label-container":"transparent-label-container-xamzI","transparent-label":"transparent-label-Xm2nQ","color-picker-container":"color-picker-container-RwSYf"}},21847:e=>{e.exports={"event-modal":"event-modal-lIGmX","body-container":"body-container-x9t4v",image:"image-iUBVI","info-container":"info-container-ewqxH","title-container":"title-container-tBMsA",title:"title-lE2cq",label:"label-KwjpM","addon-container":"addon-container-YNNkt",icon:"icon-n54me",name:"name-DVEMC","action-button":"action-button-QSvOg","button-label":"button-label-hRZRW"}},92160:e=>{e.exports={"horizontal-scroll":"horizontal-scroll-pGtUW",left:"left-MCk5v",right:"right-bxsRb",center:"center-J9E02"}},35668:e=>{e.exports={"main-nav-bars-container":"main-nav-bars-container-wNjS5","horizontal-nav-bar":"horizontal-nav-bar-ji5GB","vertical-nav-bar":"vertical-nav-bar-qGRze","nav-content-container":"nav-content-container-zl9hQ"}},306:e=>{e.exports={"meta-item-container":"meta-item-container-Tj0Ib","poster-container":"poster-container-qkw48","dismiss-icon-layer":"dismiss-icon-layer-BWztF","poster-image-layer":"poster-image-layer-KimPZ","play-icon-layer":"play-icon-layer-vpQIo","play-icon-outer":"play-icon-outer-r3iKR","play-icon-background":"play-icon-background-Uazjh","title-bar-container":"title-bar-container-1Ba0x","menu-label-container":"menu-label-container-ChuX8","poster-shape-poster":"poster-shape-poster-MEhNx","poster-shape-square":"poster-shape-square-meMeN","poster-shape-landscape":"poster-shape-landscape-kF6i8","dismiss-icon":"dismiss-icon-db3fv","dismiss-icon-backdrop":"dismiss-icon-backdrop-MkuLQ","watched-icon-layer":"watched-icon-layer-bi3DO","watched-icon":"watched-icon-zuUdK","poster-image":"poster-image-NiV7O","placeholder-icon":"placeholder-icon-xttvb","play-icon":"play-icon-QmEEA","progress-bar-layer":"progress-bar-layer-LVYYi","progress-bar":"progress-bar-w1rNN","progress-bar-background":"progress-bar-background-kyRgp","new-videos":"new-videos-cwuD9",layer:"layer-dQmEe",icon:"icon-gh1t9",label:"label-ZZ2m7","title-label":"title-label-VnEAc"}},38414:e=>{e.exports={"action-button-container":"action-button-container-sVyRr","icon-container":"icon-container-rQBA0",icon:"icon-RouVG","label-container":"label-container-xslEF",label:"label-WCWIO"}},33274:e=>{e.exports={"meta-links-container":"meta-links-container-dh69_","label-container":"label-container-dYN2B","links-container":"links-container-C8Mw9","link-container":"link-container-gHxPW"}},29636:e=>{e.exports={"meta-preview-placeholder-container":"meta-preview-placeholder-container-IVU4R","meta-info-container":"meta-info-container-zVaVX","logo-container":"logo-container-CES89","duration-release-info-container":"duration-release-info-container-JQE0f","duration-container":"duration-container-tVH7K","release-info-container":"release-info-container-dbZja","genres-container":"genres-container-MkCtO","genres-header-container":"genres-header-container-XNnjL","genre-label-container":"genre-label-container-r3gbk","action-buttons-container":"action-buttons-container-FHoD2"}},60781:e=>{e.exports={"meta-preview-container":"meta-preview-container-o22hc",compact:"compact-ii1zu","meta-info-container":"meta-info-container-ub8AH",logo:"logo-X3hTV","logo-placeholder":"logo-placeholder-rE1ld","runtime-release-info-container":"runtime-release-info-container-BGd_r","runtime-label":"runtime-label-TzAGI","release-info-label":"release-info-label-LPJMB","description-container":"description-container-yi8iU","action-buttons-container":"action-buttons-container-XbKVa","action-button":"action-button-XIZa3","background-image-layer":"background-image-layer-kk_WI","background-image":"background-image-9zToE","imdb-button-container":"imdb-button-container-gGjxp",label:"label-MXv72",icon:"icon-N_uIU","label-container":"label-container-_VXZt","meta-links":"meta-links-Xiao3","show-button":"show-button-_yuOF","share-prompt":"share-prompt-QbhIA"}},89452:e=>{e.exports={"meta-row-placeholder-container":"meta-row-placeholder-container-x8ykQ","header-container":"header-container-LRLpi","title-container":"title-container-RuV2b","see-all-container":"see-all-container-GtLII",label:"label-FP9bt",icon:"icon-U2Gj8","meta-items-container":"meta-items-container-M4vN4","meta-item":"meta-item-iOgzp","poster-container":"poster-container-WX2KD","title-bar-container":"title-bar-container-U0ZAT","title-label":"title-label-mb1GR"}},31537:e=>{e.exports={"meta-row-container":"meta-row-container-xtlB1","header-container":"header-container-tR3Ev","title-container":"title-container-Mkwnq","see-all-container":"see-all-container-MoOtW",label:"label-bytni",icon:"icon-Sj7HO","message-container":"message-container-KWmlO","meta-items-container":"meta-items-container-qcuUA","meta-item":"meta-item-QFHCh","poster-shape-poster":"poster-shape-poster-LKBza","poster-shape-square":"poster-shape-square-g5a1z","poster-shape-landscape":"poster-shape-landscape-KmmRZ"}},54623:e=>{e.exports={"modal-container":"modal-container-OuxEF","modal-dialog-container":"modal-dialog-container-DZMKq","modal-dialog-background":"modal-dialog-background-vZpB_","close-button-container":"close-button-container-cmxAp",icon:"icon-OYzlV","modal-dialog-content":"modal-dialog-content-Xgv7Z","title-container":"title-container-v2mmF","body-container":"body-container-H80dD","buttons-container":"buttons-container-e_JoR","action-button":"action-button-eprQG",label:"label-wbfsE"}},89547:e=>{e.exports={"label-container":"label-container-dhjQS",icon:"icon-jg2il",label:"label-AR_l8","modal-container":"modal-container-WaYOG","menu-container":"menu-container-qiz0X","option-container":"option-container-mO9yW","no-options-container":"no-options-container-z47Tg"}},17109:e=>{e.exports={dropdown:"dropdown-MWaxp",open:"open-yuN4f","back-button":"back-button-dGLHu","back-button-icon":"back-button-icon-VdHBJ"}},51261:e=>{e.exports={option:"option-HcOSE",label:"label-IR8xX",icon:"icon-I_g2q"}},90672:e=>{e.exports={"multiselect-menu":"multiselect-menu-qMdaj",disabled:"disabled-RaqL9","multiselect-button":"multiselect-button-XXdgA",icon:"icon-gQU96",open:"open-TvFQd"}},54636:e=>{e.exports={"nav-menu-popup-label":"nav-menu-popup-label-XmUBo","nav-menu-container":"nav-menu-container-Pl25j","user-info-container":"user-info-container-uigVE","avatar-container":"avatar-container-f6ino","user-info-details":"user-info-details-XJ5OH","email-container":"email-container-LNcms","email-label":"email-label-IFT0d","logout-button-container":"logout-button-container-prHdW","logout-label":"logout-label-HhwtK","nav-menu-section":"nav-menu-section-j87xd","nav-menu-option-container":"nav-menu-option-container-Qj9Xh",icon:"icon-MRjOP","nav-menu-option-label":"nav-menu-option-label-d7fgK"}},36345:e=>{e.exports={"search-bar-container":"search-bar-container-asfq1","search-input":"search-input-IQ0ZW","placeholder-label":"placeholder-label-XyrN_","submit-button-container":"submit-button-container-MImNa",icon:"icon-TkvAO","menu-container":"menu-container-GcXNG",label:"label-J908i",title:"title-s74ty","search-history-clear":"search-history-clear-ap0h8",items:"items-P1xS5",item:"item-TgYCX"}},3043:e=>{e.exports={"horizontal-nav-bar-container":"horizontal-nav-bar-container-Y_zvK","logo-container":"logo-container-jteMT",logo:"logo-oPx1q","back-button-container":"back-button-container-lDB1N",title:"title-DGh6h","search-bar":"search-bar-h60ja","buttons-container":"buttons-container-Oc5z1","button-container":"button-container-xT9_L",icon:"icon-T8MU6","menu-button-container":"menu-button-container-DtW4v"}},2572:e=>{e.exports={"nav-tab-button-container":"nav-tab-button-container-dYhs0",label:"label-BCz2f",icon:"icon-TzPrK",logo:"logo-xJBE9"}},41121:e=>{e.exports={"vertical-nav-bar-container":"vertical-nav-bar-container-UPAkA","nav-tab-button":"nav-tab-button-tW6qT"}},3952:e=>{e.exports={"number-input":"number-input-igJ35",button:"button-GWY2o",icon:"icon-EndAk","number-display":"number-display-hLJ72",label:"label-y4qDZ",value:"value-Y2xdx"}},6526:e=>{e.exports={"label-container":"label-container-XOyzm","menu-container":"menu-container-B6cqK","menu-direction-top-left":"menu-direction-top-left-ongjn","menu-direction-bottom-left":"menu-direction-bottom-left-Dvtqk","menu-direction-top-right":"menu-direction-top-right-tmrFG","menu-direction-bottom-right":"menu-direction-bottom-right-aJ89V"}},37872:e=>{e.exports={"radio-button":"radio-button-SGEc1","radio-container":"radio-container-wPddo","inner-circle":"inner-circle-vdtUP",disabled:"disabled-ZzMU9",error:"error-_vY0h",selected:"selected-M_zHA"}},54408:e=>{e.exports={"search-bar-container":"search-bar-container-sTkGP","search-input":"search-input-Q18HV",icon:"icon-M3jX0"}},95939:e=>{e.exports={"search-bar-container":"search-bar-container-p4tSt","search-input":"search-input-bAgAh",icon:"icon-QOYfJ"}},8303:e=>{e.exports={"share-prompt-container":"share-prompt-container-EXOaj","buttons-container":"buttons-container-fiSbJ","button-container":"button-container-KJoeC",icon:"icon-OX8pK","facebook-button":"facebook-button-La6ud","x-button":"x-button-pA7ym","reddit-button":"reddit-button-sd07c","url-container":"url-container-OKpfh","url-text-input":"url-text-input-nqDsC","copy-button":"copy-button-XmXGg",label:"label-gMoQ8"}},63943:e=>{e.exports={"active-slider-within":"active-slider-within-NcgYf","slider-container":"slider-container-nJz5F",layer:"layer-aC5Vt",track:"track-gItfW","track-before":"track-before-kJzIb","track-after":"track-after-pUXC0",thumb:"thumb-PiTF5"}},78263:e=>{e.exports={"text-input":"text-input-hnLiz"}},46056:e=>{e.exports={"toggle-container":"toggle-container-LD19U",toggle:"toggle-c9IYf"}},52100:e=>{e.exports={"video-placeholder-container":"video-placeholder-container-DgoIs","info-container":"info-container-BATmf","name-container":"name-container-N4C39","released-container":"released-container-egHHb"}},99005:e=>{e.exports={"video-container":"video-container-ezBpK","thumbnail-container":"thumbnail-container-Zm8Cl",thumbnail:"thumbnail-J81W3","placeholder-icon":"placeholder-icon-GNOI3","progress-bar-container":"progress-bar-container-w8eFT","progress-bar":"progress-bar-E23CT","progress-bar-background":"progress-bar-background-Q7aEH","info-container":"info-container-xyynk","title-container":"title-container-NcfV9","flex-row-container":"flex-row-container-CAyQu","released-container":"released-container-XLPqf","upcoming-watched-container":"upcoming-watched-container-msCaq","upcoming-container":"upcoming-container-LXfQ7","watched-container":"watched-container-gvzs3","flag-icon":"flag-icon-RDrvf","flag-label":"flag-label-zJloD","context-menu-content":"context-menu-content-ItIFy","context-menu-option-container":"context-menu-option-container-KNVWj","context-menu-option-label":"context-menu-option-label-dy2nc"}},10540:e=>{e.exports={"addon-container":"addon-container-lC5KN","logo-container":"logo-container-ZcSSC",logo:"logo-WrsGF",icon:"icon-GxVbY","info-container":"info-container-AdMB6","name-container":"name-container-qIAg8","version-container":"version-container-zdPyN","types-container":"types-container-DaOrg","description-container":"description-container-v7Jhe","buttons-container":"buttons-container-g0xXr","action-buttons-container":"action-buttons-container-xMVmz","install-button-container":"install-button-container-yfcq5","configure-button-container":"configure-button-container-VwVAQ","uninstall-button-container":"uninstall-button-container-oV4Yo","share-button-container":"share-button-container-s3gwP",label:"label-OnWh2"}},61594:e=>{e.exports={"addon-container":"addon-container-A53Om",content:"content-gjK8A","logo-container":"logo-container-uixVa","info-container":"info-container-EuwPe","placeholder-pill":"placeholder-pill-OmvfW","buttons-container":"buttons-container-_S1YF","action-buttons-container":"action-buttons-container-bYZoV"}},75063:e=>{e.exports={"addons-container":"addons-container-ogGYu","addons-content":"addons-content-zhFBl","addons-list-container":"addons-list-container-Ovr2Z","selectable-inputs-container":"selectable-inputs-container-tUul1","add-button-container":"add-button-container-SkafT",icon:"icon-HsyZS","add-button-label":"add-button-label-NN6bu","select-input-container":"select-input-container-KqG8N",spacing:"spacing-wH1w5","search-bar":"search-bar-k7MXd","filter-button":"filter-button-lLJ1X","filter-icon":"filter-icon-LUDTS","message-container":"message-container-GBw0P",addon:"addon-whmdO","filters-modal":"filters-modal-w6oWY","add-addon-modal-container":"add-addon-modal-container-KR5ny",notice:"notice-UQkO1","addon-url-input":"addon-url-input-ucetZ","cancel-button":"cancel-button-R2AxR","share-modal-container":"share-modal-container-DkzPM","title-container":"title-container-La49g",logo:"logo-PmYDP","name-container":"name-container-m_Sz0",name:"name-YD0xd",version:"version-wuAFB","share-prompt-container":"share-prompt-container-vaK4P"}},98985:e=>{e.exports={"warning-container":"warning-container-_GJlx","warning-statement":"warning-statement-MQjVq",actions:"actions-IOe34",action:"action-t06kj",label:"label-PkwRv"}},42786:e=>{e.exports={"board-container":"board-container-DTN_b","board-content-container":"board-content-container-ToQTz","board-content":"board-content-nPWv1","board-row":"board-row-CoJrZ","board-warning-container":"board-warning-container-a4m04","board-row-poster":"board-row-poster-QPQqC","board-row-square":"board-row-square-pgaZ3","continue-watching-row":"continue-watching-row-ZiNSa","board-row-landscape":"board-row-landscape-FRGXx"}},76160:e=>{e.exports={calendar:"calendar-cH2jw",content:"content-wBwrQ",main:"main-vWt7d"}},91559:e=>{e.exports={details:"details-EuHwi",video:"video-BIs3a",name:"name-vpn8u",info:"info-n1Tz1",icon:"icon-Di3yP",placeholder:"placeholder-Kigxt"}},45958:e=>{e.exports={item:"item-PwXPg",heading:"heading-aqSxF",body:"body-pUnX4",video:"video-XnjiE",name:"name-tepO3",info:"info-dnUvu",icon:"icon-bz23A",today:"today-JJfHO",active:"active-ymNy0"}},88405:e=>{e.exports={list:"list-fa_2a"}},53159:e=>{e.exports={placeholder:"placeholder-pCQTz",title:"title-bE4zd",image:"image-qgtvg",overview:"overview-RGglv",point:"point-iTc1_",icon:"icon-Y5Zkw",text:"text-Pa9GN",button:"button-DsyS9"}},65979:e=>{e.exports={selector:"selector-uRGQ6",prev:"prev-__2gh",next:"next-t6hvT",label:"label-xSEWG",icon:"icon-ixEYr",selected:"selected-lBBwk",year:"year-jHuog",month:"month-VlFJ6"}},79706:e=>{e.exports={cell:"cell-l3eWl",heading:"heading-TYXvp",day:"day-nttmc",items:"items-ZZ9Jt",item:"item-qsUNQ",icon:"icon-F3Uu8",poster:"poster-goLqZ",more:"more-gGKzA",today:"today-G8kuO",active:"active-KC8sV"}},83511:e=>{e.exports={table:"table-QbfK0",week:"week-mTZNI",day:"day-LPW9e",long:"long-UpX3r",short:"short-MoF9_",grid:"grid-cUaUg"}},95407:e=>{e.exports={"discover-container":"discover-container-L6OGL","discover-content":"discover-content-CRsRg","catalog-container":"catalog-container-VNK_T","meta-items-container":"meta-items-container-n8vNz","selectable-inputs-container":"selectable-inputs-container-IRz50","select-input":"select-input-CHDbe","filter-container":"filter-container-BVkqT","filter-icon":"filter-icon-zlFnX","missing-addon-warning-container":"missing-addon-warning-container-IXGuv","warning-label":"warning-label-f19Jg","install-button":"install-button-SmJe1",label:"label-ToW4S","message-container":"message-container-Zv9eF",image:"image-txC9E","message-label":"message-label-mRyRX","meta-item-placeholder":"meta-item-placeholder-wxG4I","poster-container":"poster-container-Dch4R","title-bar-container":"title-bar-container-dtDnk","title-label":"title-label-vHdQd","meta-preview-container":"meta-preview-container-CoWs5","selectable-inputs-modal":"selectable-inputs-modal-ChpOa"}},60323:e=>{e.exports={"consent-toggle-container":"consent-toggle-container-SdUk_",label:"label-hQS0A",link:"link-D82uK"}},74248:e=>{e.exports={"password-reset-modal-container":"password-reset-modal-container-KzJPQ","credentials-text-input":"credentials-text-input-ncrIR","error-message":"error-message-DkekN","cancel-button":"cancel-button-AneJE"}},77928:e=>{e.exports={"intro-container":"intro-container-tkNS6","background-container":"background-container-aYKCH","heading-container":"heading-container-oI70m","logo-container":"logo-container-W49kt",logo:"logo-WJ36F","title-container":"title-container-CbIkM","slogan-container":"slogan-container-UlcYd","content-container":"content-container-A1Drn","form-button":"form-button-vyqqj",icon:"icon-L_6b6",label:"label-uHD7L","submit-button":"submit-button-x3L8z","guest-login-button":"guest-login-button-D8DWZ","signup-form-button":"signup-form-button-UGmSk","login-form-button":"login-form-button-DqJUV","form-container":"form-container-HMlEh","credentials-text-input":"credentials-text-input-QMCZz","forgot-password-link-container":"forgot-password-link-container-ygZqb","forgot-password-link":"forgot-password-link-NxNUD","error-message":"error-message-cKdzB","options-container":"options-container-qxboQ","facebook-button":"facebook-button-LZ_kG","loading-modal-container":"loading-modal-container-eLyTm","loader-container":"loader-container-oe8rU",flash:"flash-wUFXY",button:"button-ryGtP"}},77259:e=>{e.exports={"library-container":"library-container-zM_bj","library-content":"library-content-PgX4O","meta-items-container":"meta-items-container-IKrND","selectable-inputs-container":"selectable-inputs-container-hR3or","select-input-container":"select-input-container-H1VZ1","message-container":"message-container-MhY5t","no-user-message-container":"no-user-message-container-KMLpE","login-button-container":"login-button-container-RoEh7",label:"label-QqYmf",image:"image-csRHm","message-label":"message-label-UExl3","selectable-inputs-modal":"selectable-inputs-modal-rHlo7"}},70338:e=>{e.exports={"button-container":"button-container-UB6hU",label:"label-u4y2u"}},22710:e=>{e.exports={background:"background-Xro_t",icon:"icon-UFaeB"}},53080:e=>{e.exports={"stream-placeholder-container":"stream-placeholder-container-T1nxv","addon-container":"addon-container-pm1P0","addon-name":"addon-name-zAOKP","info-container":"info-container-Z1Dl6","description-container":"description-container-ZOMcn","play-icon":"play-icon-MXqj3"}},83298:e=>{e.exports={"stream-container":"stream-container-JPdah",icon:"icon-rAZvO","info-container":"info-container-TihQo",thumbnail:"thumbnail-whoms","placeholder-icon":"placeholder-icon-znYz0","addon-name":"addon-name-tC8PX","progress-bar-container":"progress-bar-container-ADRp_","progress-bar":"progress-bar-XrEBL","progress-bar-background":"progress-bar-background-HueVQ","description-container":"description-container-vW_De","menu-icon":"menu-icon-JD2rP","context-menu-content":"context-menu-content-Xe_lN","context-menu-title":"context-menu-title-aoWE4","context-menu-option-container":"context-menu-option-container-BZGla","context-menu-option-label":"context-menu-option-label-EbNNz"}},54815:e=>{e.exports={"streams-list-container":"streams-list-container-xYMJo","message-container":"message-container-f9_L4",search:"search-Bo8nu",image:"image-rIyu6",label:"label-luvnO","addons-loading-container":"addons-loading-container-Vkwp3","addons-loading":"addons-loading-zhdQr","addons-loading-bar":"addons-loading-bar-MqT59","select-choices-wrapper":"select-choices-wrapper-xGzfs","back-button-container":"back-button-container-cJ4bk",icon:"icon-SoFgF","episode-title":"episode-title-dln_c","select-input-container":"select-input-container-irGn_","streams-container":"streams-container-bbSc4","install-button-container":"install-button-container-Q60yJ"}},70523:e=>{e.exports={"seasons-bar-placeholder-container":"seasons-bar-placeholder-container-M81RN","prev-season-button":"prev-season-button-TCbOq","next-season-button":"next-season-button-oGnlT",icon:"icon-UzQjF",label:"label-lmBnj","seasons-popup-label-container":"seasons-popup-label-container-r2UDB","seasons-popup-label":"seasons-popup-label-xBinL","seasons-popup-icon":"seasons-popup-icon-p1T5d"}},69450:e=>{e.exports={"seasons-bar-container":"seasons-bar-container-nOZjG","prev-season-button":"prev-season-button-bs1GQ","next-season-button":"next-season-button-RrYAq",disabled:"disabled-WJy2x",label:"label-uJbfD",icon:"icon-_ZBEE","seasons-popup-label-container":"seasons-popup-label-container-fZcu4"}},14028:e=>{e.exports={"videos-list-container":"videos-list-container-NepX5","message-container":"message-container-_hhmQ",image:"image-_xAbP",label:"label-Ff1_X","notifications-toggle":"notifications-toggle-PaWY3","seasons-bar":"seasons-bar-Ma8vp","search-bar":"search-bar-mZHWa","videos-container":"videos-container-msX8s"}},30673:e=>{e.exports={"metadetails-container":"metadetails-container-K_Dqa","background-image-layer":"background-image-layer-wJa90","background-image":"background-image-tSjYu","nav-bar":"nav-bar-MH6Vk","metadetails-content":"metadetails-content-Uz5EV","vertical-nav-bar":"vertical-nav-bar-B39nq","meta-message-container":"meta-message-container-MJZN5",image:"image-R1LcJ","message-label":"message-label-Uz4_P","meta-preview":"meta-preview-ES0h3",spacing:"spacing-rgIYg","videos-list":"videos-list-nE0LJ","streams-list":"streams-list-Y1lCM","meta-extension-modal-container":"meta-extension-modal-container-gHjqy","meta-extension-modal-iframe":"meta-extension-modal-iframe-GGHlm"}},56747:e=>{e.exports={"not-found-container":"not-found-container-Q1qsP","nav-bar":"nav-bar-Eu3_y","not-found-content":"not-found-content-z_Eza","not-found-image":"not-found-image-Qab4G","not-found-label":"not-found-label-mmwyZ"}},19596:e=>{e.exports={"audio-menu":"audio-menu-qB4SQ",container:"container-lNRgG",header:"header-yT4vp",list:"list-lt_h8",option:"option-COcvW",info:"info-BPG2q",lang:"lang-EXxoG",label:"label-_DvDN",icon:"icon-DebLV"}},41339:e=>{e.exports={"buffering-loader-container":"buffering-loader-container-P7S0m","buffering-loader":"buffering-loader-fMSpb",fadeInOut:"fadeInOut-WS5RD"}},34784:e=>{e.exports={"seek-bar-container":"seek-bar-container-JGGTa",label:"label-QFbsS",slider:"slider-hBDOf"}},4792:e=>{e.exports={"volume-slider":"volume-slider-G_xAt"}},66446:e=>{e.exports={"control-bar-container":"control-bar-container-xsWA7","seek-bar":"seek-bar-I7WeY","control-bar-buttons-container":"control-bar-buttons-container-SWhkU","control-bar-button":"control-bar-button-FQUsj",icon:"icon-qy6I6","volume-slider":"volume-slider-U9jfo",spacing:"spacing-p8NJQ","control-bar-buttons-menu-button":"control-bar-buttons-menu-button-h0MWd","control-bar-buttons-menu-container":"control-bar-buttons-menu-container-M6L0_"}},11130:e=>{e.exports={error:"error-ty_iB","error-label":"error-label-lyLDv","error-sub":"error-sub-rdwAf","playlist-button":"playlist-button-tZTCo",icon:"icon-fIGRf",label:"label-Z7jSJ"}},87946:e=>{e.exports={"next-video-popup-container":"next-video-popup-container-H4wnL","slide-fade-in":"slide-fade-in-rk2M8","poster-container":"poster-container-tXZjA","poster-image":"poster-image-2D6wg","placeholder-icon":"placeholder-icon-fu1rK","info-container":"info-container-KLOMx","details-container":"details-container-bUOTZ",name:"name-sIiDL",label:"label-zOq_w",title:"title-Z5Kgo","buttons-container":"buttons-container-iYrpZ",spacing:"spacing-iFwsN","button-container":"button-container-i4F7t","play-button":"play-button-Dluk6",icon:"icon-N3Ewm",dismiss:"dismiss-IvEL_"}},51885:e=>{e.exports={"option-container":"option-container-m_jZq",icon:"icon-krR0X",label:"label-cmqqu"}},63959:e=>{e.exports={"options-menu-container":"options-menu-container-qlzLt"}},15722:e=>{e.exports={"side-drawer":"side-drawer-r9EuA","close-button":"close-button-ruzkn",icon:"icon-k44IU",info:"info-hhNTg","side-drawer-meta-preview":"side-drawer-meta-preview-pB8v6","series-content":"series-content-VkYHB",videos:"videos-nRM2D"}},854:e=>{e.exports={"side-drawer-button":"side-drawer-button-lVLKS",icon:"icon-g5Oo_"}},43228:e=>{e.exports={option:"option-_O96j",icon:"icon-kqaPF",label:"label-FEOiu"}},80956:e=>{e.exports={"speed-menu-container":"speed-menu-container-ABjzc",title:"title-Hu2Dm","options-container":"options-container-DNn3D",option:"option-GcPlB"}},17748:e=>{e.exports={"statistics-menu-container":"statistics-menu-container-DhiHn",title:"title-NCwWH",label:"label-h6nN_",value:"value-E8Ftb",stats:"stats-Tr37t",stat:"stat-zoq5A","info-hash":"info-hash-GT1Cv"}},29760:e=>{e.exports={"discrete-input-container":"discrete-input-container-CMThy",header:"header-n0jWL","input-container":"input-container-TNuI2","button-container":"button-container-ciSB5",icon:"icon-JDltr","option-label":"option-label-tjeeT"}},32110:e=>{e.exports={"subtitles-menu-container":"subtitles-menu-container-PxBRZ","languages-container":"languages-container-NS7H9","variants-container":"variants-container-XglzH","subtitles-settings-container":"subtitles-settings-container-LhRGS","languages-header":"languages-header-jGNcK","variants-header":"variants-header-TsVSR","settings-header":"settings-header-eaWnm","languages-list":"languages-list-sxIwI","variants-list":"variants-list-yZo6B","language-option":"language-option-O1Yr9","variant-option":"variant-option-t7_LA","language-label":"language-label-FjjqA","variant-label":"variant-label-opjnP","variant-origin":"variant-origin-SVnd1",icon:"icon-I1Ruh",info:"info-mxjJh","no-variants-container":"no-variants-container-q6u1Q","no-variants-label":"no-variants-label-RmDKZ",spacing:"spacing-AWJpt","discrete-input":"discrete-input-fXELp"}},18761:e=>{e.exports={"video-container":"video-container-v9_vA",video:"video-tkpQm"}},26213:e=>{e.exports={"volume-change-indicator":"volume-change-indicator-EWypD","volume-icon":"volume-icon-zn9zT","volume-slider":"volume-slider-FKN0X"}},90977:e=>{e.exports={"player-container":"player-container-wIELK",overlayHidden:"overlayHidden-gyjIy","nav-bar-layer":"nav-bar-layer-r9HT5","control-bar-layer":"control-bar-layer-m2jto","menu-layer":"menu-layer-HZFG9","side-drawer-button-layer":"side-drawer-button-layer-RrB8k",layer:"layer-qalDW","buffering-layer":"buffering-layer-ZZCYp","error-layer":"error-layer-RCEZC","background-layer":"background-layer-ldsp8",image:"image-XxZuJ","side-drawer-layer":"side-drawer-layer-CZtJ1"}},84142:e=>{e.exports={"search-container":"search-container-uXEFf","search-content":"search-content-LX6un","search-row":"search-row-EQLaD","search-hints-wrapper":"search-hints-wrapper-IjhmE","search-hints-title-container":"search-hints-title-container-MXt8W","search-hints-title":"search-hints-title-cigX3","search-hints-container":"search-hints-container-FHpPM","search-hint-container":"search-hint-container-kd8iX",icon:"icon-fOZZl",label:"label-l6wxz","message-container":"message-container-YAunr",image:"image-Xuwya","message-label":"message-label-K8LPz","search-row-poster":"search-row-poster-m7CUE","search-row-square":"search-row-square-VesJA","search-row-landscape":"search-row-landscape-o3Lfv"}},75550:e=>{e.exports={"add-item":"add-item-iycwp",input:"input-xcmDi",actions:"actions-iV2qd",add:"add-SjFUs",cancel:"cancel-mErzd",icon:"icon-fsrQ7"}},44118:e=>{e.exports={item:"item-vprGn",content:"content-Z4dHI",selectable:"selectable-vObva",label:"label-Ps0DE",actions:"actions-zY8KP",status:"status-ZtDXI",icon:"icon-Dy2_n",ready:"ready-RSAbX",error:"error-Z7kSJ",delete:"delete-VVe3c"}},38408:e=>{e.exports={wrapper:"wrapper-FMNA6",header:"header-zkCTr",label:"label-dEugA",content:"content-humTO",item:"item-aKQwq",footer:"footer-jhua_","add-url":"add-url-YoBI2",icon:"icon-FpW91",reload:"reload-rrVYe"}},2073:e=>{e.exports={"settings-container":"settings-container-b0DCu","settings-content":"settings-content-lLXmk","side-menu-container":"side-menu-container-NG17D","side-menu-button":"side-menu-button-vbkJ1",selected:"selected-yhdng",spacing:"spacing-fpLUM","version-info-label":"version-info-label-uMkm7","sections-container":"sections-container-EUKAe","section-container":"section-container-twzKQ","section-title":"section-title-Nt71Z","section-category-container":"section-category-container-EOuS0",label:"label-FFamJ",icon:"icon-REQkK","option-container":"option-container-EGlcv","link-container":"link-container-ERYsD","user-info-option-container":"user-info-option-container-oRLJc","user-info-content":"user-info-content-ez7kZ","avatar-container":"avatar-container-YWq9E","email-logout-container":"email-logout-container-kYQDM","email-label-container":"email-label-container-oVmiO","logout-button-container":"logout-button-container-jLrU2","email-label":"email-label-Q__sJ","logout-label":"logout-label-zo4ES","user-panel-container":"user-panel-container-kkrJG","user-panel-label":"user-panel-label-beAQl","option-name-container":"option-name-container-exGMI","option-input-container":"option-input-container-NPgpT","trakt-icon":"trakt-icon-_dK95","button-container":"button-container-ENMae","multiselect-container":"multiselect-container-w0c9l","link-input-container":"link-input-container-TCi0w","checkbox-container":"checkbox-container-R9LLN","color-input-container":"color-input-container-WclA_","info-container":"info-container-wfFcS",selectable:"selectable-eucrJ","configure-input-container":"configure-input-container-PMyIY","configure-button-container":"configure-button-container-xGFgg","shortcut-container":"shortcut-container-ZSm5O","versions-section-container":"versions-section-container-LRCVQ"}},58859:(e,t,a)=>{var i="function"==typeof Map&&Map.prototype,o=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,n=i&&o&&"function"==typeof o.get?o.get:null,r=i&&Map.prototype.forEach,E="function"==typeof Set&&Set.prototype,_=Object.getOwnPropertyDescriptor&&E?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,T=E&&_&&"function"==typeof _.get?_.get:null,s=E&&Set.prototype.forEach,S="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,l="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,I="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,u=Boolean.prototype.valueOf,A=Object.prototype.toString,d=Function.prototype.toString,O=String.prototype.match,c=String.prototype.slice,R=String.prototype.replace,N=String.prototype.toUpperCase,m=String.prototype.toLowerCase,L=RegExp.prototype.test,D=Array.prototype.concat,p=Array.prototype.join,h=Array.prototype.slice,C=Math.floor,f="function"==typeof BigInt?BigInt.prototype.valueOf:null,P=Object.getOwnPropertySymbols,B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,g="function"==typeof Symbol&&"object"==typeof Symbol.iterator,v="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===g||"symbol")?Symbol.toStringTag:null,M=Object.prototype.propertyIsEnumerable,W=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function y(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||L.call(/e/,t))return t;var a=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var i=e<0?-C(-e):C(e);if(i!==e){var o=String(i),n=c.call(t,o.length+1);return R.call(o,a,"$&_")+"."+R.call(R.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return R.call(t,a,"$&_")}var b=a(42634),U=b.custom,G=z(U)?U:null,k={__proto__:null,double:'"',single:"'"},F={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};function V(e,t,a){var i=a.quoteStyle||t,o=k[i];return o+e+o}function H(e){return R.call(String(e),/"/g,""")}function w(e){return!("[object Array]"!==x(e)||v&&"object"==typeof e&&v in e)}function Y(e){return!("[object RegExp]"!==x(e)||v&&"object"==typeof e&&v in e)}function z(e){if(g)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!B)return!1;try{return B.call(e),!0}catch(e){}return!1}e.exports=function e(t,i,o,E){var _=i||{};if(j(_,"quoteStyle")&&!j(k,_.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(j(_,"maxStringLength")&&("number"==typeof _.maxStringLength?_.maxStringLength<0&&_.maxStringLength!==1/0:null!==_.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var A=!j(_,"customInspect")||_.customInspect;if("boolean"!=typeof A&&"symbol"!==A)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(j(_,"indent")&&null!==_.indent&&"\t"!==_.indent&&!(parseInt(_.indent,10)===_.indent&&_.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(j(_,"numericSeparator")&&"boolean"!=typeof _.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var N=_.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return X(t,_);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var L=String(t);return N?y(t,L):L}if("bigint"==typeof t){var C=String(t)+"n";return N?y(t,C):C}var P=void 0===_.depth?5:_.depth;if(void 0===o&&(o=0),o>=P&&P>0&&"object"==typeof t)return w(t)?"[Array]":"[Object]";var U=(function(e,t){var a;if("\t"===e.indent)a="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;a=p.call(Array(e.indent+1)," ")}return{base:a,prev:p.call(Array(t+1),a)}})(_,o);if(void 0===E)E=[];else if(Q(E,t)>=0)return"[Circular]";function F(t,a,i){if(a&&(E=h.call(E)).push(a),i){var n={depth:_.depth};return j(_,"quoteStyle")&&(n.quoteStyle=_.quoteStyle),e(t,n,o+1,E)}return e(t,_,o+1,E)}if("function"==typeof t&&!Y(t)){var K=(function(e){if(e.name)return e.name;var t=O.call(d.call(e),/^function\s*([\w$]+)/);if(t)return t[1];return null})(t),$=te(t,F);return"[Function"+(K?": "+K:" (anonymous)")+"]"+($.length>0?" { "+p.call($,", ")+" }":"")}if(z(t)){var ae=g?R.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):B.call(t);return"object"!=typeof t||g?ae:q(ae)}if((function(e){if(!e||"object"!=typeof e)return!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement)return!0;return"string"==typeof e.nodeName&&"function"==typeof e.getAttribute})(t)){for(var ie="<"+m.call(String(t.nodeName)),oe=t.attributes||[],ne=0;ne"}if(w(t)){if(0===t.length)return"[]";var re=te(t,F);return U&&!(function(e){for(var t=0;t=0)return!1;return!0})(re)?"["+ee(re,U)+"]":"[ "+p.call(re,", ")+" ]"}if((function(e){return!("[object Error]"!==x(e)||v&&"object"==typeof e&&v in e)})(t)){var Ee=te(t,F);return"cause"in Error.prototype||!("cause"in t)||M.call(t,"cause")?0===Ee.length?"["+String(t)+"]":"{ ["+String(t)+"] "+p.call(Ee,", ")+" }":"{ ["+String(t)+"] "+p.call(D.call("[cause]: "+F(t.cause),Ee),", ")+" }"}if("object"==typeof t&&A){if(G&&"function"==typeof t[G]&&b)return b(t,{depth:P-o});if("symbol"!==A&&"function"==typeof t.inspect)return t.inspect()}if((function(e){if(!n||!e||"object"!=typeof e)return!1;try{n.call(e);try{T.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1})(t)){var _e=[];return r&&r.call(t,(function(e,a){_e.push(F(a,t,!0)+" => "+F(e,t))})),Z("Map",n.call(t),_e,U)}if((function(e){if(!T||!e||"object"!=typeof e)return!1;try{T.call(e);try{n.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1})(t)){var Te=[];return s&&s.call(t,(function(e){Te.push(F(e,t))})),Z("Set",T.call(t),Te,U)}if((function(e){if(!S||!e||"object"!=typeof e)return!1;try{S.call(e,S);try{l.call(e,l)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1})(t))return J("WeakMap");if((function(e){if(!l||!e||"object"!=typeof e)return!1;try{l.call(e,l);try{S.call(e,S)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1})(t))return J("WeakSet");if((function(e){if(!I||!e||"object"!=typeof e)return!1;try{return I.call(e),!0}catch(e){}return!1})(t))return J("WeakRef");if((function(e){return!("[object Number]"!==x(e)||v&&"object"==typeof e&&v in e)})(t))return q(F(Number(t)));if((function(e){if(!e||"object"!=typeof e||!f)return!1;try{return f.call(e),!0}catch(e){}return!1})(t))return q(F(f.call(t)));if((function(e){return!("[object Boolean]"!==x(e)||v&&"object"==typeof e&&v in e)})(t))return q(u.call(t));if((function(e){return!("[object String]"!==x(e)||v&&"object"==typeof e&&v in e)})(t))return q(F(String(t)));if("undefined"!=typeof window&&t===window)return"{ [object Window] }";if("undefined"!=typeof globalThis&&t===globalThis||void 0!==a.g&&t===a.g)return"{ [object globalThis] }";if(!(function(e){return!("[object Date]"!==x(e)||v&&"object"==typeof e&&v in e)})(t)&&!Y(t)){var se=te(t,F),Se=W?W(t)===Object.prototype:t instanceof Object||t.constructor===Object,le=t instanceof Object?"":"null prototype",Ie=!Se&&v&&Object(t)===t&&v in t?c.call(x(t),8,-1):le?"Object":"",ue=(Se||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(Ie||le?"["+p.call(D.call([],Ie||[],le||[]),": ")+"] ":"");return 0===se.length?ue+"{}":U?ue+"{"+ee(se,U)+"}":ue+"{ "+p.call(se,", ")+" }"}return String(t)};var K=Object.prototype.hasOwnProperty||function(e){return e in this};function j(e,t){return K.call(e,t)}function x(e){return A.call(e)}function Q(e,t){if(e.indexOf)return e.indexOf(t);for(var a=0,i=e.length;at.maxStringLength){var a=e.length-t.maxStringLength,i="... "+a+" more character"+(a>1?"s":"");return X(c.call(e,0,t.maxStringLength),t)+i}var o=F[t.quoteStyle||"single"];return o.lastIndex=0,V(R.call(R.call(e,o,"\\$1"),/[\x00-\x1f]/g,$),"single",t)}function $(e){var t=e.charCodeAt(0),a={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return a?"\\"+a:"\\x"+(t<16?"0":"")+N.call(t.toString(16))}function q(e){return"Object("+e+")"}function J(e){return e+" { ? }"}function Z(e,t,a,i){return e+" ("+t+") {"+(i?ee(a,i):p.call(a,", "))+"}"}function ee(e,t){if(0===e.length)return"";var a="\n"+t.prev+t.base;return a+p.call(e,","+a)+"\n"+t.prev}function te(e,t){var a=w(e),i=[];if(a){i.length=e.length;for(var o=0;o{"use strict";var i=a(6925);function o(){}function n(){}n.resetWarningCache=o,e.exports=function(){function e(e,t,a,o,n,r){if(r!==i){var E=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw E.name="Invariant Violation",E}}function t(){return e}e.isRequired=e;var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:n,resetWarningCache:o};return a.PropTypes=a,a}},5556:(e,t,a)=>{e.exports=a(2694)()},6925:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},9655:function(e,t,a){var i;e=a.nmd(e),(function(){t&&t.nodeType,e&&e.nodeType;var o="object"==typeof a.g&&a.g;o.global!==o&&o.window!==o&&o.self;var n,r=2147483647,E=36,_=/^xn--/,T=/[^\x20-\x7E]/,s=/[\x2E\u3002\uFF0E\uFF61]/g,S={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},l=Math.floor,I=String.fromCharCode;function u(e){throw new RangeError(S[e])}function A(e,t){for(var a=e.length,i=[];a--;)i[a]=t(e[a]);return i}function d(e,t){var a=e.split("@"),i="";return a.length>1&&(i=a[0]+"@",e=a[1]),i+A((e=e.replace(s,".")).split("."),t).join(".")}function O(e){for(var t,a,i=[],o=0,n=e.length;o=55296&&t<=56319&&o65535&&(t+=I((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=I(e)})).join("")}function R(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function N(e,t,a){var i=0;for(e=a?l(e/700):e>>1,e+=l(e/t);e>455;i+=E)e=l(e/35);return l(i+36*e/(e+38))}function m(e){var t,a,i,o,n,_,T,s,S,I,A,d=[],O=e.length,R=0,m=128,L=72;for((a=e.lastIndexOf("-"))<0&&(a=0),i=0;i=128&&u("not-basic"),d.push(e.charCodeAt(i));for(o=a>0?a+1:0;o=O&&u("invalid-input"),((s=(A=e.charCodeAt(o++))-48<10?A-22:A-65<26?A-65:A-97<26?A-97:E)>=E||s>l((r-R)/_))&&u("overflow"),R+=s*_,!(s<(S=T<=L?1:T>=L+26?26:T-L));T+=E)_>l(r/(I=E-S))&&u("overflow"),_*=I;L=N(R-n,t=d.length+1,0==n),l(R/t)>r-m&&u("overflow"),m+=l(R/t),R%=t,d.splice(R++,0,m)}return c(d)}function L(e){var t,a,i,o,n,_,T,s,S,A,d,c,m,L,D,p=[];for(c=(e=O(e)).length,t=128,a=0,n=72,_=0;_=t&&dl((r-a)/(m=i+1))&&u("overflow"),a+=(T-t)*m,t=T,_=0;_r&&u("overflow"),d==t){for(s=a,S=E;!(s<(A=S<=n?1:S>=n+26?26:S-n));S+=E)D=s-A,L=E-A,p.push(I(R(A+D%L,0))),s=l(D/L);p.push(I(R(s,0))),n=N(a,m,i==o),a=0,++i}++a,++t}return p.join("")}n={version:"1.4.1",ucs2:{decode:O,encode:c},decode:m,encode:L,toASCII:function(e){return d(e,(function(e){return T.test(e)?"xn--"+L(e):e}))},toUnicode:function(e){return d(e,(function(e){return _.test(e)?m(e.slice(4).toLowerCase()):e}))}},void 0===(i=function(){return n}.call(t,a,t,e))||(e.exports=i)})()},74765:e=>{"use strict";var t=String.prototype.replace,a=/%20/g,i="RFC1738",o="RFC3986";e.exports={default:o,formatters:{RFC1738:function(e){return t.call(e,a,"+")},RFC3986:function(e){return String(e)}},RFC1738:i,RFC3986:o}},55373:(e,t,a)=>{"use strict";var i=a(98636),o=a(62642),n=a(74765);e.exports={formats:n,parse:o,stringify:i}},62642:(e,t,a)=>{"use strict";var i=a(37720),o=Object.prototype.hasOwnProperty,n=Array.isArray,r={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:i.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},E=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},_=function(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},T=function(e,t,a,i){if(e){var n=a.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,r=/(\[[^[\]]*])/g,E=a.depth>0&&/(\[[^[\]]*])/.exec(n),T=E?n.slice(0,E.index):n,s=[];if(T){if(!a.plainObjects&&o.call(Object.prototype,T)&&!a.allowPrototypes)return;s.push(T)}for(var S=0;a.depth>0&&null!==(E=r.exec(n))&&S=0;--n){var r,E=e[n];if("[]"===E&&a.parseArrays)r=a.allowEmptyArrays&&(""===o||a.strictNullHandling&&null===o)?[]:[].concat(o);else{r=a.plainObjects?{__proto__:null}:{};var T="["===E.charAt(0)&&"]"===E.charAt(E.length-1)?E.slice(1,-1):E,s=a.decodeDotInKeys?T.replace(/%2E/g,"."):T,S=parseInt(s,10);a.parseArrays||""!==s?!isNaN(S)&&E!==s&&String(S)===s&&S>=0&&a.parseArrays&&S<=a.arrayLimit?(r=[])[S]=o:"__proto__"!==s&&(r[s]=o):r={0:o}}o=r}return o})(s,t,a,i)}};e.exports=function(e,t){var a=(function(e){if(!e)return r;if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.decodeDotInKeys&&"boolean"!=typeof e.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?r.charset:e.charset,a=void 0===e.duplicates?r.duplicates:e.duplicates;if("combine"!==a&&"first"!==a&&"last"!==a)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===e.allowDots?!0===e.decodeDotInKeys||r.allowDots:!!e.allowDots,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:r.allowEmptyArrays,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:r.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:r.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:r.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:r.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:r.comma,decodeDotInKeys:"boolean"==typeof e.decodeDotInKeys?e.decodeDotInKeys:r.decodeDotInKeys,decoder:"function"==typeof e.decoder?e.decoder:r.decoder,delimiter:"string"==typeof e.delimiter||i.isRegExp(e.delimiter)?e.delimiter:r.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:r.depth,duplicates:a,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:r.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:r.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:r.plainObjects,strictDepth:"boolean"==typeof e.strictDepth?!!e.strictDepth:r.strictDepth,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:r.strictNullHandling}})(t);if(""===e||null==e)return a.plainObjects?{__proto__:null}:{};for(var s="string"==typeof e?(function(e,t){var a={__proto__:null},T=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;T=T.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var s,S=t.parameterLimit===1/0?void 0:t.parameterLimit,l=T.split(t.delimiter,S),I=-1,u=t.charset;if(t.charsetSentinel)for(s=0;s-1&&(d=n(d)?[d]:d);var N=o.call(a,A);N&&"combine"===t.duplicates?a[A]=i.combine(a[A],d):N&&"last"!==t.duplicates||(a[A]=d)}return a})(e,a):e,S=a.plainObjects?{__proto__:null}:{},l=Object.keys(s),I=0;I{"use strict";var i=a(920),o=a(37720),n=a(74765),r=Object.prototype.hasOwnProperty,E={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},_=Array.isArray,T=Array.prototype.push,s=function(e,t){T.apply(e,_(t)?t:[t])},S=Date.prototype.toISOString,l=n.default,I={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:o.encode,encodeValuesOnly:!1,filter:void 0,format:l,formatter:n.formatters[l],indices:!1,serializeDate:function(e){return S.call(e)},skipNulls:!1,strictNullHandling:!1},u={},A=function e(t,a,n,r,E,T,S,l,A,d,O,c,R,N,m,L,D,p){for(var h,C=t,f=p,P=0,B=!1;void 0!==(f=f.get(u))&&!B;){var g=f.get(t);if(P+=1,void 0!==g){if(g===P)throw new RangeError("Cyclic object value");B=!0}void 0===f.get(u)&&(P=0)}if("function"==typeof d?C=d(a,C):C instanceof Date?C=R(C):"comma"===n&&_(C)&&(C=o.maybeMap(C,(function(e){return e instanceof Date?R(e):e}))),null===C){if(T)return A&&!L?A(a,I.encoder,D,"key",N):a;C=""}if("string"==typeof(h=C)||"number"==typeof h||"boolean"==typeof h||"symbol"==typeof h||"bigint"==typeof h||o.isBuffer(C))return A?[m(L?a:A(a,I.encoder,D,"key",N))+"="+m(A(C,I.encoder,D,"value",N))]:[m(a)+"="+m(String(C))];var v,M=[];if(void 0===C)return M;if("comma"===n&&_(C))L&&A&&(C=o.maybeMap(C,A)),v=[{value:C.length>0?C.join(",")||null:void 0}];else if(_(d))v=d;else{var W=Object.keys(C);v=O?W.sort(O):W}var y=l?String(a).replace(/\./g,"%2E"):String(a),b=r&&_(C)&&1===C.length?y+"[]":y;if(E&&_(C)&&0===C.length)return b+"[]";for(var U=0;U0?m+N:""}},37720:(e,t,a)=>{"use strict";var i=a(74765),o=Object.prototype.hasOwnProperty,n=Array.isArray,r=(function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e})(),E=function(e,t){for(var a=t&&t.plainObjects?{__proto__:null}:{},i=0;i1;){var t=e.pop(),a=t.obj[t.prop];if(n(a)){for(var i=[],o=0;o=_?E.slice(s,s+_):E,l=[],I=0;I=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||n===i.RFC1738&&(40===u||41===u)?l[l.length]=S.charAt(I):u<128?l[l.length]=r[u]:u<2048?l[l.length]=r[192|u>>6]+r[128|63&u]:u<55296||u>=57344?l[l.length]=r[224|u>>12]+r[128|u>>6&63]+r[128|63&u]:(I+=1,u=65536+((1023&u)<<10|1023&S.charCodeAt(I)),l[l.length]=r[240|u>>18]+r[128|u>>12&63]+r[128|u>>6&63]+r[128|63&u])}T+=l.join("")}return T},isBuffer:function(e){return!(!e||"object"!=typeof e)&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(n(e)){for(var a=[],i=0;i{"use strict";function t(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,a,i,o){a=a||"&",i=i||"=";var n={};if("string"!=typeof e||0===e.length)return n;var r=/\+/g;e=e.split(a);var E=1e3;o&&"number"==typeof o.maxKeys&&(E=o.maxKeys);var _=e.length;E>0&&_>E&&(_=E);for(var T=0;T<_;++T){var s,S,l,I,u=e[T].replace(r,"%20"),A=u.indexOf(i);A>=0?(s=u.substr(0,A),S=u.substr(A+1)):(s=u,S=""),l=decodeURIComponent(s),I=decodeURIComponent(S),t(n,l)?Array.isArray(n[l])?n[l].push(I):n[l]=[n[l],I]:n[l]=I}return n}},59106:e=>{"use strict";var t=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,a,i,o){return a=a||"&",i=i||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map((function(o){var n=encodeURIComponent(t(o))+i;return Array.isArray(e[o])?e[o].map((function(e){return n+encodeURIComponent(t(e))})).join(a):n+encodeURIComponent(t(e[o]))})).join(a):o?encodeURIComponent(t(o))+i+encodeURIComponent(t(e)):""}},47186:(e,t,a)=>{"use strict";t.decode=t.parse=a(11630),t.encode=t.stringify=a(59106)},22551:(e,t,a)=>{"use strict";var i=a(96540),o=a(69982);function n(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,a=1;a