@ekolabs/eko-gallery-react 4.0.18-devops-1227706.0 → 4.0.18-devops-1236629.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js
CHANGED
|
@@ -11,4 +11,4 @@ import e,{useRef as n,useState as i,createRef as r,useCallback as o,useEffect as
|
|
|
11
11
|
object-assign
|
|
12
12
|
(c) Sindre Sorhus
|
|
13
13
|
@license MIT
|
|
14
|
-
*/var bt=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;var i=Object.getOwnPropertyNames(e).map((function(t){return e[t]}));if("0123456789"!==i.join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(t){r[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,i,r=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),o=1;o<arguments.length;o++){for(var s in n=Object(arguments[o]))gt.call(n,s)&&(r[s]=n[s]);if(vt){i=vt(n);for(var a=0;a<i.length;a++)yt.call(n,i[a])&&(r[i[a]]=n[i[a]])}}return r},kt="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",xt=Function.call.bind(Object.prototype.hasOwnProperty),wt=function(){};if("production"!==process.env.NODE_ENV){var _t=kt,It={},Tt=xt;wt=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(t){}}}function Et(t,e,n,i,r){if("production"!==process.env.NODE_ENV)for(var o in t)if(Tt(t,o)){var s;try{if("function"!=typeof t[o]){var a=Error((i||"React class")+": "+n+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof t[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw a.name="Invariant Violation",a}s=t[o](e,o,i,n,null,_t)}catch(t){s=t}if(!s||s instanceof Error||wt((i||"React class")+": type specification of "+n+" `"+o+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof s+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),s instanceof Error&&!(s.message in It)){It[s.message]=!0;var l=r?r():"";wt("Failed "+n+" type: "+s.message+(null!=l?l:""))}}}Et.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(It={})};var St=Et,Mt=function(){};function At(){return null}"production"!==process.env.NODE_ENV&&(Mt=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(t){}});var Nt=function(t,e){var n="function"==typeof Symbol&&Symbol.iterator,i="@@iterator";var r="<<anonymous>>",o={array:c("array"),bigint:c("bigint"),bool:c("boolean"),func:c("function"),number:c("number"),object:c("object"),string:c("string"),symbol:c("symbol"),any:l(At),arrayOf:function(t){return l((function(e,n,i,r,o){if("function"!=typeof t)return new a("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside arrayOf.");var s=e[n];if(!Array.isArray(s))return new a("Invalid "+r+" `"+o+"` of type `"+h(s)+"` supplied to `"+i+"`, expected an array.");for(var l=0;l<s.length;l++){var c=t(s,l,i,r,o+"["+l+"]",kt);if(c instanceof Error)return c}return null}))},element:l((function(e,n,i,r,o){var s=e[n];return t(s)?null:new a("Invalid "+r+" `"+o+"` of type `"+h(s)+"` supplied to `"+i+"`, expected a single ReactElement.")})),elementType:l((function(t,e,n,i,r){var o=t[e];return mt.isValidElementType(o)?null:new a("Invalid "+i+" `"+r+"` of type `"+h(o)+"` supplied to `"+n+"`, expected a single ReactElement type.")})),instanceOf:function(t){return l((function(e,n,i,o,s){if(!(e[n]instanceof t)){var l=t.name||r;return new a("Invalid "+o+" `"+s+"` of type `"+(((c=e[n]).constructor&&c.constructor.name?c.constructor.name:r)+"` supplied to `")+i+"`, expected instance of `"+l+"`.")}var c;return null}))},node:l((function(t,e,n,i,r){return d(t[e])?null:new a("Invalid "+i+" `"+r+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(t){return l((function(e,n,i,r,o){if("function"!=typeof t)return new a("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var s=e[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected an object.");for(var c in s)if(xt(s,c)){var u=t(s,c,i,r,o+"."+c,kt);if(u instanceof Error)return u}return null}))},oneOf:function(t){if(!Array.isArray(t))return"production"!==process.env.NODE_ENV&&Mt(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),At;return l((function(e,n,i,r,o){for(var l=e[n],c=0;c<t.length;c++)if(s(l,t[c]))return null;var u=JSON.stringify(t,(function(t,e){return"symbol"===f(e)?String(e):e}));return new a("Invalid "+r+" `"+o+"` of value `"+String(l)+"` supplied to `"+i+"`, expected one of "+u+".")}))},oneOfType:function(t){if(!Array.isArray(t))return"production"!==process.env.NODE_ENV&&Mt("Invalid argument supplied to oneOfType, expected an instance of array."),At;for(var e=0;e<t.length;e++){var n=t[e];if("function"!=typeof n)return Mt("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+p(n)+" at index "+e+"."),At}return l((function(e,n,i,r,o){for(var s=[],l=0;l<t.length;l++){var c=(0,t[l])(e,n,i,r,o,kt);if(null==c)return null;c.data&&xt(c.data,"expectedType")&&s.push(c.data.expectedType)}return new a("Invalid "+r+" `"+o+"` supplied to `"+i+"`"+(s.length>0?", expected one of type ["+s.join(", ")+"]":"")+".")}))},shape:function(t){return l((function(e,n,i,r,o){var s=e[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected `object`.");for(var c in t){var d=t[c];if("function"!=typeof d)return u(i,r,o,c,f(d));var p=d(s,c,i,r,o+"."+c,kt);if(p)return p}return null}))},exact:function(t){return l((function(e,n,i,r,o){var s=e[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected `object`.");var c=bt({},e[n],t);for(var d in c){var p=t[d];if(xt(t,d)&&"function"!=typeof p)return u(i,r,o,d,f(p));if(!p)return new a("Invalid "+r+" `"+o+"` key `"+d+"` supplied to `"+i+"`.\nBad object: "+JSON.stringify(e[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(t),null," "));var m=p(s,d,i,r,o+"."+d,kt);if(m)return m}return null}))}};function s(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}function a(t,e){this.message=t,this.data=e&&"object"==typeof e?e:{},this.stack=""}function l(t){if("production"!==process.env.NODE_ENV)var n={},i=0;function o(o,s,l,c,u,d,h){if(c=c||r,d=d||l,h!==kt){if(e){var f=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 f.name="Invariant Violation",f}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var p=c+":"+l;!n[p]&&i<3&&(Mt("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+c+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),n[p]=!0,i++)}}return null==s[l]?o?null===s[l]?new a("The "+u+" `"+d+"` is marked as required in `"+c+"`, but its value is `null`."):new a("The "+u+" `"+d+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:t(s,l,c,u,d)}var s=o.bind(null,!1);return s.isRequired=o.bind(null,!0),s}function c(t){return l((function(e,n,i,r,o,s){var l=e[n];return h(l)!==t?new a("Invalid "+r+" `"+o+"` of type `"+f(l)+"` supplied to `"+i+"`, expected `"+t+"`.",{expectedType:t}):null}))}function u(t,e,n,i,r){return new a((t||"React class")+": "+e+" type `"+n+"."+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+r+"`.")}function d(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(d);if(null===e||t(e))return!0;var r=function(t){var e=t&&(n&&t[n]||t[i]);if("function"==typeof e)return e}(e);if(!r)return!1;var o,s=r.call(e);if(r!==e.entries){for(;!(o=s.next()).done;)if(!d(o.value))return!1}else for(;!(o=s.next()).done;){var a=o.value;if(a&&!d(a[1]))return!1}return!0;default:return!1}}function h(t){var e=typeof t;return Array.isArray(t)?"array":t instanceof RegExp?"object":function(t,e){return"symbol"===t||!!e&&("Symbol"===e["@@toStringTag"]||"function"==typeof Symbol&&e instanceof Symbol)}(e,t)?"symbol":e}function f(t){if(null==t)return""+t;var e=h(t);if("object"===e){if(t instanceof Date)return"date";if(t instanceof RegExp)return"regexp"}return e}function p(t){var e=f(t);switch(e){case"array":case"object":return"an "+e;case"boolean":case"date":case"regexp":return"a "+e;default:return e}}return a.prototype=Error.prototype,o.checkPropTypes=St,o.resetWarningCache=St.resetWarningCache,o.PropTypes=o,o};function Ft(){}function Ct(){}Ct.resetWarningCache=Ft;var Ot=V((function(t){if("production"!==process.env.NODE_ENV){var e=mt;t.exports=Nt(e.isElement,!0)}else t.exports=function(){function t(t,e,n,i,r,o){if(o!==kt){var s=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 s.name="Invariant Violation",s}}function e(){return t}t.isRequired=t;var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:Ct,resetWarningCache:Ft};return n.PropTypes=n,n}()}));const Pt=/https?:\/\/(.*?\.)?eko.com/,Rt={"eko.project.interaction":"interaction","eko.project.swipe":"swipe"};let Dt=null,Bt=null,Lt=[];function zt(t){return e=>{var n;if(!Pt.test(e.origin)||"eko.embedapi"!==(null===(n=e.data)||void 0===n?void 0:n.source))return;const i=e.data,r=Rt[i.type];r&&(t?t(r,i.data):Lt.push({type:r,data:i.data}))}}"undefined"!=typeof window&&(Bt=zt(null),window.addEventListener("message",Bt));var Wt={subscribe:function(t){"function"==typeof t?Dt?console.warn("[eko-gallery-react] Ignoring events subscribe since already subscribed"):(Dt=t,Bt=zt(t),window.addEventListener("message",Bt),function(t){Lt.forEach((e=>{t(e.type,e.data)})),Lt=[]}(t)):console.warn("[eko-gallery-react] Ignoring events subscribe since a callback function was not provided as argument")},unsubscribe:function(){Bt?(window.removeEventListener("message",Bt),Bt=null,Dt=null,Lt=[]):console.warn("[eko-gallery-react] Ignoring events unsubscribe since not subscribed")},send:function(t,e){Dt?Dt(t,e):Lt.push({type:t,data:e})}};const jt=({index:t,activeIndex:n,setActiveIndex:i,item:r,src:o,navItemRefs:s,itemIcon:a})=>{var l,c;const u=null==r||null===(l=r.media)||void 0===l?void 0:l.srcset,d=null==r||null===(c=r.media)||void 0===c?void 0:c.sizes,h=!o&&(null==r?void 0:r.label),f=u?o:function(t,e=200){if(!t)return null;try{let n=t;t.includes("assets.eko.com")&&t.includes("/raw/")&&(n=t.replace("/raw/","/image/"));const i=new URL(n);return i.searchParams.set("width",e),i.href}catch(e){return t}}(o,150);let p=["addons-container",h?"full-thumb-label":""].join(" ").trim();return e.createElement("li",{className:"eko-nav-item","aria-current":n===t,onClick:function(){i(t),function(t){D.track("gallery.interaction",{elementid:`thumbnail-${t}`,interactiontype:"click"}),Wt.send("interaction",{elementid:`thumbnail-${t}`,interactiontype:"click"})}(t)},ref:s.current[t]},e.createElement("button",{type:"button","aria-label":`Go to item ${t}`},!h&&e.createElement("img",{src:f,srcSet:u,sizes:d,alt:null==r?void 0:r.name,loading:"eager",fetchPriority:"high"}),e.createElement("div",{className:p},(null==r?void 0:r.stepsIndication)&&e.createElement("div",{className:"step-indicator"},e.createElement("span",null),e.createElement("span",null),e.createElement("span",null)),(null==r?void 0:r.label)&&e.createElement("div",{className:"thumb-label"},null==r?void 0:r.label)),a&&e.createElement("div",{className:"item-icon"},e.createElement("span",{style:{backgroundImage:`url(${a})`}}))))};jt.propTypes={index:Ot.number,activeIndex:Ot.number,setActiveIndex:Ot.func.isRequired,item:Ot.object.isRequired,src:Ot.string,navItemRefs:Ot.object.isRequired,itemIcon:Ot.string};const $t=({layout:t,nav:i,isVerticalNav:r,showPrevArrow:o,showNextArrow:s})=>{var a,l,c,u,d;const h=n(null),f=n(null),p="arrows"===(null==t||null===(a=t.mobile)||void 0===a||null===(a=a.config)||void 0===a||null===(a=a.navPagination)||void 0===a?void 0:a.type)?"eko-mobile-arrows":"",m="arrows"===(null!==(l=null==t||null===(c=t.desktop)||void 0===c||null===(c=c.config)||void 0===c||null===(c=c.navPagination)||void 0===c?void 0:c.type)&&void 0!==l?l:"arrows")?"eko-desktop-arrows":"",v=p||m,g=r?null==i||null===(u=i.current)||void 0===u?void 0:u.scrollHeight:null==i||null===(d=i.current)||void 0===d?void 0:d.scrollWidth;function y(t){const e=r?i.current.clientHeight:i.current.clientWidth,n=function(t,e){const n=r?e.scrollTop:e.scrollLeft;return Math.max(-n,Math.min(g-t-n,t))}("next"===t?e:-e,i.current);return{top:r?n:0,left:r?0:n,behavior:"smooth"}}function b(t){var e,n,r;const o=y(t),s="next"===t?null==f||null===(e=f.current)||void 0===e?void 0:e.id:null==h||null===(n=h.current)||void 0===n?void 0:n.id;var a,l;window.EkoAnalytics("track","gallery.interaction",{elementid:s,interactiontype:"click"}),null==i||null===(r=i.current)||void 0===r||r.scrollBy(o),a=s,l="click",D.track("gallery.interaction",{elementId:a,interactiontype:l}),Wt.send("interaction",{elementId:a,interactiontype:l})}return e.createElement(e.Fragment,null,v&&e.createElement(e.Fragment,null,e.createElement("button",q({type:"button","aria-label":"Go to previous item","aria-hidden":o?"false":"true",onClick:()=>b("prev"),ref:h,id:"eko-nav-prev-arrow",className:`eko-nav-arrow eko-prev-nav-button ${p} ${m} ${o?"":"eko-hidden-nav-button"}`},o?{}:{tabIndex:"-1"}),e.createElement("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M5.56127 9.52817C5.28966 9.22635 5.28966 8.77361 5.56127 8.502L10.39 3.67331C10.6918 3.37157 11.1445 3.37157 11.4161 3.67331C11.7179 3.94492 11.7179 4.39766 11.4161 4.66927L7.10044 8.98487L11.4161 13.3307C11.7179 13.6023 11.7179 14.055 11.4161 14.3266C11.1445 14.6285 10.6918 14.6285 10.4202 14.3266L5.56127 9.52817Z",fill:"black"}))),e.createElement("button",q({type:"button","aria-label":"Go to next item","aria-hidden":s?"false":"true",onClick:()=>b("next"),ref:f,className:`eko-nav-arrow eko-next-nav-button ${p} ${m} ${s?"":"eko-hidden-nav-button"}`,id:"eko-nav-next-arrow"},s?{}:{tabIndex:"-1"}),e.createElement("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M12.4387 8.47185C12.7103 8.77367 12.7103 9.22641 12.4387 9.49802L7.61003 14.3267C7.30821 14.6284 6.85547 14.6284 6.58386 14.3267C6.28212 14.0551 6.28212 13.6024 6.58386 13.3308L10.8996 9.01515L6.58386 4.66933C6.28212 4.39772 6.28212 3.94499 6.58386 3.67338C6.85547 3.37155 7.30821 3.37155 7.57982 3.67338L12.4387 8.47185Z",fill:"black"})))))};function Ut(t,e,n){let i;return function(){const n=this,r=arguments;clearTimeout(i),i=setTimeout((function(){i=null,t.apply(n,r)}),e)}}$t.propTypes={layout:Ot.object.isRequired,nav:Ot.object.isRequired,isVerticalNav:Ot.bool.isRequired,showPrevArrow:Ot.bool.isRequired,showNextArrow:Ot.bool.isRequired};const qt=({items:t,setActiveIndex:a,activeIndex:l,layout:c,carouselMounted:u,forceMobile:d})=>{const h=n(null),f=n(null),p=n([]),m=3,[g,y]=i(null),[b,k]=i(!1),[x,w]=i(0),[_,I]=i(!1),[T,E]=i(!1);function S(){var t;const e=d||window.innerWidth<768?"mobile":"desktop",n=(null==c||null===(t=c[e])||void 0===t||null===(t=t.config)||void 0===t?void 0:t.orientation)||("desktop"===e?"left":"bottom");k("left"===n||"right"===n);const i=f.current.parentNode,r=u?".eko-smart-gallery-container iframe":".eko-carousel",o=i.querySelector(r);setTimeout((()=>{w(o.clientHeight)}),0)}function M(){var t,e;const n=d||v()?"mobile":"desktop",i=null!==(t=null==c||null===(e=c[n])||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.navPagination)||void 0===e?void 0:e.scrollThreshold)&&void 0!==t?t:m;!function(t=m){var e,n;const i=h.current;if(!i)return;const r="none"!==(null==c||null===(e=c.desktop)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.navPagination)||void 0===e?void 0:e.type),o=(s=null==c||null===(n=c.mobile)||void 0===n||null===(n=n.config)||void 0===n||null===(n=n.navPagination)||void 0===n?void 0:n.type,"mask"===s||"arrows"===s);var s;if((d||v())&&!o)return void i.style.setProperty("-webkit-mask","none");if(!v()&&!r)return void i.style.setProperty("-webkit-mask","none");const a=i.scrollHeight-i.clientHeight,l=i.scrollTop>t?"85%":"100%",u=i.scrollTop<=a-t?"15%":"0%",f=i.scrollWidth-i.clientWidth,p=i.scrollLeft>t?"15%":"0%",g=i.scrollLeft<=f-t?"85%":"100%";b?i.style.setProperty("-webkit-mask",`linear-gradient(0deg,#0000,#000 ${u} ${l},#0000)`):i.style.setProperty("-webkit-mask",`linear-gradient(90deg,#0000,#000 ${p} ${g},#0000)`)}(i),function(t=m){var e,n,i,r,o,s;const a=b?null==h||null===(e=h.current)||void 0===e?void 0:e.scrollTop:null==h||null===(n=h.current)||void 0===n?void 0:n.scrollLeft,l=b?null==h||null===(i=h.current)||void 0===i?void 0:i.clientHeight:null==h||null===(r=h.current)||void 0===r?void 0:r.clientWidth,c=b?null==h||null===(o=h.current)||void 0===o?void 0:o.scrollHeight:null==h||null===(s=h.current)||void 0===s?void 0:s.scrollWidth;c-t<l?(I(!1),E(!1)):a<=t?(I(!1),E(!0)):a+l>c-t?(I(!0),E(!1)):a+t>0&&a<c-t&&(I(!0),E(!0))}(i)}p.current=null==t?void 0:t.map(((t,e)=>{var n,i;return null!==(n=null==p||null===(i=p.current)||void 0===i?void 0:i[e])&&void 0!==n?n:r()}));const A=Ut((t=>{var e;e=t,D.track("gallery.interaction",{elementid:"nav",interactiontype:e}),Wt.send("interaction",{elementid:"nav",interactiontype:e})}),200);const N=o((t=>{a({index:t,step:0,source:"nav"})}),[]);return s((()=>{var t;y(null===(t=p.current)||void 0===t?void 0:t[l])}),[l]),s((()=>{if(null!=g&&g.current&&null!=h&&h.current){const t=g.current,e=h.current.clientWidth/2,n=t.clientWidth/2,i=h.current.clientHeight/2,r=t.clientHeight/2;h.current.scrollTo({left:t.offsetLeft-e+n,top:t.offsetTop-i+r,behavior:"smooth"})}}),[g]),s((()=>{S()}),[]),s((()=>(window.addEventListener("resize",S),()=>{window.removeEventListener("resize",S)})),[f,u,d]),s((()=>{w(0),S()}),[t,f,u,d]),s((()=>{M();const t=new ResizeObserver(M);return t.observe(h.current),()=>{t.disconnect()}}),[t,d,b]),e.createElement("div",{className:"eko-nav-container",ref:f,style:{opacity:x>0?1:0,height:""+(x&&b?x+"px":"auto")}},e.createElement($t,{layout:c,nav:h,isVerticalNav:b,showPrevArrow:_,showNextArrow:T}),e.createElement("ul",{className:`eko-nav eko-mobile-nav-selected-${null!==(F=null==c||null===(C=c.mobile)||void 0===C||null===(C=C.config)||void 0===C?void 0:C.navItemsSelectedType)&&void 0!==F?F:"underline"} eko-desktop-nav-selected-${null!==(O=null==c||null===(P=c.desktop)||void 0===P||null===(P=P.config)||void 0===P?void 0:P.navItemsSelectedType)&&void 0!==O?O:"underline"}`,ref:h,onScroll:function(){M()},onWheel:function(){A("wheel")},onTouchMove:function(){A("swipe")}},null==t?void 0:t.map(((t,n)=>{var i;const r=(null==t||null===(i=t.media)||void 0===i?void 0:i.url)||(null==t?void 0:t.media)||"";return e.createElement(jt,{key:r+n,index:n,activeIndex:l,setActiveIndex:N,item:t,src:r,navItemRefs:p,itemIcon:null==t?void 0:t.icon})}))));var F,C,O,P};qt.propTypes={items:Ot.array.isRequired,activeIndex:Ot.number,setActiveIndex:Ot.func.isRequired,layout:Ot.object,carouselMounted:Ot.bool,forceMobile:Ot.bool};function Vt(){D.track("gallery.cover.displayed"),Wt.send("gallerycoverdisplayed")}function Gt(t){if(!t)return t;try{const e=new URL(t);return e.host.includes("assets.eko.com")&&e.pathname.startsWith("/image")&&!e.searchParams.has("width")?(e.pathname.endsWith(".png")&&(e.pathname=e.pathname.replace(/\.png$/,".webp")),e.searchParams.set("width",1920),e.toString()):t}catch(e){return t}}const Ht=({item:t,src:i,srcset:r,sizes:o,isCoverElement:a})=>{const l=n(null);return s((()=>{var t;if(a){if(null===(t=l.current)||void 0===t||!t.complete)return l.current.addEventListener("load",Vt,{once:!0}),()=>{var t;null===(t=l.current)||void 0===t||t.removeEventListener("load",Vt,{once:!0})};Vt()}}),[]),e.createElement("img",{ref:l,src:Gt(i),srcSet:r,sizes:o,alt:t.name,fetchPriority:a?"high":"auto",loading:a?"eager":"lazy",style:{width:"100%",height:"100%"}})};Ht.propTypes={item:Ot.object.isRequired,src:Ot.string,srcset:Ot.string,sizes:Ot.string,isCoverElement:Ot.bool};const Kt=Ut((t=>{var e;e=t,D.track("gallery.interaction",{elementid:"carousel",interactiontype:e}),Wt.send("interaction",{elementid:"carousel",interactiontype:e})}),200);function Xt(){Kt("wheel")}const Yt=a((({items:t,setActiveIndex:o,activeIndex:a,showSmartLoaders:c},u)=>{const d=n(null),h=n([]);h.current=null==t?void 0:t.map(((t,e)=>{var n,i;return null!==(n=null==h||null===(i=h.current)||void 0===i?void 0:i[e])&&void 0!==n?n:r()}));const[f,p]=i(),[m,v]=i(),g=n(a),y=n(!1);function b(){const e=function(t){const e=t.scrollLeft,n=t.scrollWidth-t.clientWidth;return 0===e?0:e>n?100:e/n*100}(d.current)*(null==t?void 0:t.length)/100,n=Math.min(Math.trunc(e),(null==t?void 0:t.length)-1),i=g.current;"nav"!==i.source&&"external-nav"!==i.source?(y.current&&n!==i.index&&(y.current=!1),y.current||(n>(null==t?void 0:t.length)-1?o({index:(null==t?void 0:t.length)-1,source:"carousel"}):o({index:n,source:"carousel"}))):n===i.index?y.current=!0:y.current&&n!==i.index&&(y.current=!1,o({index:n,source:"carousel"}))}return l(u,(()=>({prev:()=>{o({index:Math.max(0,g.current.index-1),source:"carousel"})},next:()=>{o({index:Math.min((null==t?void 0:t.length)-1,g.current.index+1),source:"carousel"})}}))),s((()=>{const t=d.current;if(t)return t.addEventListener("scroll",b),()=>{t.removeEventListener("scroll",b)}}),[t]),s((()=>{var t;let e=null===(t=h.current)||void 0===t?void 0:t[a.index];if(e&&("nav"===a.source||"external-nav"===a.source)){const t=e.current,n=d.current.clientWidth/2,i=(null==t?void 0:t.clientWidth)/2,r=(null==t?void 0:t.offsetLeft)-n+i;d.current.scrollTo({left:r,behavior:"smooth"})}}),[a]),s((()=>{g.current=a,"nav"!==a.source&&"external-nav"!==a.source||(y.current=!1)}),[a]),e.createElement("ul",{className:"eko-carousel",ref:d,onScroll:b,onWheel:Xt,onTouchMove:function(t){v(t.targetTouches[0].clientX)},onTouchStart:function(t){p(t.targetTouches[0].clientX),v(null)},onTouchEnd:function(){m&&f&&(f-m>75||f-m<-75)&&Kt("swipe")}},null==t?void 0:t.map(((t,n)=>{const i=(null==t?void 0:t.cover)||(null==t?void 0:t.media),r=(null==i?void 0:i.url)||i;return e.createElement("li",{className:"eko-carousel-item",key:r+n,ref:h.current[n]},e.createElement(Ht,{item:t,src:r,srcset:null==i?void 0:i.srcset,sizes:null==i?void 0:i.sizes,isCoverElement:0===n}),c&&"image"!==t.type&&e.createElement("div",{className:"eko-smart-loading"},e.createElement("div",null),e.createElement("p",null,"Loading video experience")))})))}));function Qt(t){var e;return function(t){var e;return"eko.block.event"===(null==t||null===(e=t.data)||void 0===e?void 0:e.type)}(t)&&"GalleryBlock"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.blockType)}Yt.propTypes={items:Ot.array.isRequired,setActiveIndex:Ot.func.isRequired,activeIndex:Ot.object,showSmartLoaders:Ot.bool},Yt.displayName="CarouselLoop";const Jt="eko.project.invoke",Zt="eko.block.invoke";function te(t,e,n){var i;null!=t&&t.contentWindow&&(null==t||null===(i=t.contentWindow)||void 0===i||i.postMessage({target:"eko.embedapi",type:e,data:n},"*"))}function ee(t){return`#variantId=${encodeURIComponent(t)}`}const ne=a((({config:t,instanceId:r,setActiveItem:o,activeItem:a,variantId:c,smartGalleryLoaded:u,onLoad:d,forceMobile:h},f)=>{var p,m,g;const y=null!==(p=null===(m=t.options)||void 0===m?void 0:m.galleryEnv)&&void 0!==p?p:"",b=null===(g=t.__autoGenerated)||void 0===g||null===(g=g.publishItem)||void 0===g?void 0:g.id,k=function(t={}){let e="";return Object.entries(t).forEach((([t,n])=>{e+=`&${t}=${n}`})),e}(null==t?void 0:t.qp),x=function(t,e,n){return`https://${t}play.eko.com/embed?${n?`id=${n}`:`piid=${e}`}&nocover=true&galleryBlockMode=gallery&eko_pixel=true`}(y,b,r),w=n(null),_=n(null),I=n(!1),[T,E]=i(ee(c||"ekonovar")),[S,M]=i(x+k+T);let A;function N(){D.track("gallery.project.display"),d(),Wt.send("galleryloaded")}return l(f,(()=>({prev:()=>{te(null==_?void 0:_.current,Zt,{action:"onPrevModule"})},next:()=>{te(null==_?void 0:_.current,Zt,{action:"onNextModule"})}}))),s((()=>{I.current?te(null==_?void 0:_.current,Jt,{action:"updateVariant",args:{id:c}}):E(ee(c))}),[c]),s((()=>{te(null==_?void 0:_.current,Zt,{action:"updateActiveModule",args:{activeItemIndex:null==a?void 0:a.index,activeModuleIndex:null==a?void 0:a.step}})}),[a]),s((()=>{function t(t){if((function(t){var e;return"eko.project.blockstart"===(null==t||null===(e=t.data)||void 0===e?void 0:e.type)}(t)||function(t){var e,n;return"eko.project.started"===(null==t||null===(e=t.data)||void 0===e?void 0:e.type)&&(null==t||null===(n=t.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.started)}(t))&&!I.current)return e=t.data.data.blockType,I.current=!0,void("GalleryBlock"===e?te(null==_?void 0:_.current,Zt,{action:"updateActiveModule",args:{activeItemIndex:null==a?void 0:a.index,activeModuleIndex:null==a?void 0:a.step}}):N());var e;if(I.current){if(function(t){var e;return Qt(t)&&"activeModuleChanged"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.name)}(t))return void function(t){const e=t.data.data.data.activeItemIndex,n=t.data.data.data.activeModuleIndex;e===(null==a?void 0:a.index)&&n===(null==a?void 0:a.step)||o({index:e,step:n,source:"carousel"})}(t);(function(t){var e;return Qt(t)&&"activeModuleChangeDone"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.name)})(t)&&!u&&N()}}return A=h||v()?"mobile":"desktop",function(t,e={}){window.addEventListener("message",t,e)}(t),()=>{!function(t,e={}){window.removeEventListener("message",t,e)}(t)}}),[a]),s((()=>{I.current||te(null==_?void 0:_.current,Jt,{action:"queryProjectStarted"})}),[a,u]),s((()=>{I.current=!1}),[t]),s((()=>{M(x+k+T)}),[T]),e.createElement("div",{className:"eko-smart-gallery-container "+(u?"":"eko-project-not-ready"),ref:w,"data-type":"smart-gallery","data-qp":k,"data-variant":c,"data-device":A},e.createElement("iframe",{allow:"autoplay; fullscreen",title:"eko gallery",src:S,style:{border:0},ref:_}))}));ne.propTypes={config:Ot.object.isRequired,instanceId:Ot.string,setActiveItem:Ot.func.isRequired,activeItem:Ot.object.isRequired,variantId:Ot.string,smartGalleryLoaded:Ot.bool,onLoad:Ot.func,forceMobile:Ot.bool},ne.displayName="SmartGallery";const ie=()=>e.createElement("style",{suppressHydrationWarning:!0},'.eko-gallery {\n --accentColorEko: #000;\n --primaryColorEko: #000;\n --backgroundColorEko: #25D7A2;\n --navItemsBackgroundColorEko: transparent;\n --navItemsBannerBackgroundColorEko: #EEEEEE;\n --carouselItemsBackgroundColorEko: transparent;\n --carouselInteractiveCoverBackgroundColorEko: transparent;\n --galleryGapEkoMobile: 12px;\n --galleryGapEkoDesktop: 12px;\n --galleryPaddingEkoMobile: 0;\n --galleryPaddingEkoDesktop: 0;\n --galleryMaxWidthEkoMobile: 100%;\n --galleryMaxWidthEkoDesktop: 900px;\n --galleryTransition: .8s cubic-bezier(.35, 0, 0, 1) 1.5s;\n --navBarPaddingEkoMobile: 0 0 0 20px;\n --navBarPaddingEkoDesktop: 0;\n --navItemsWidthEkoMobile: 80px;\n --navItemsWidthEkoDesktop: 80px;\n --navItemsHeightEkoMobile: 80px;\n --navItemsHeightEkoDesktop: 80px;\n --navItemsGapEkoMobile: 14px;\n --navItemsGapEkoDesktop: 14px;\n --navItemsRadiusEkoMobile: 8px;\n --navItemsRadiusEkoDesktop: 8px;\n --navItemsSelectedMarginEkoMobile: 3px;\n --navItemsSelectedMarginEkoDesktop: 3px;\n --navItemsSelectedThicknessEkoMobile: 3px;\n --navItemsSelectedThicknessEkoDesktop: 3px;\n --navItemsSelectedUnderlineRadiusEkoMobile: 100px;\n --navItemsSelectedUnderlineRadiusEkoDesktop: 100px;\n --navItemsObjectFitEkoMobile: cover;\n --navItemsObjectFitEkoDesktop: cover;\n --navMediaBadgeSizeEkoMobile: 22px;\n --navMediaBadgeSizeEkoDesktop: 22px;\n --navMediaBadgeMarginTopEkoMobile: 4px;\n --navMediaBadgeMarginTopEkoDesktop: 4px;\n --navMediaBadgeMarginRightEkoMobile: 4px;\n --navMediaBadgeMarginRightEkoDesktop: 4px;\n --carouselItemsAspectRatioEkoMobile: 1 / 1;\n --carouselItemsAspectRatioEkoDesktop: 1 / 1;\n --carouselItemsRadiusEkoMobile: 0px;\n --carouselItemsRadiusEkoDesktop: 12px;\n --carouselItemsObjectFitEkoMobile: cover;\n --carouselItemsObjectFitEkoDesktop: cover;\n --navBannerFontSizeEkoMobile: 12px;\n --navBannerFontSizeEkoDesktop: 12px;\n --navBannerFontLineHeightEkoMobile: 120%;\n --navBannerFontLineHeightEkoDesktop: 120%;\n --navBannerFontFamilyEkoMobile: inherit;\n --navBannerFontFamilyEkoDesktop: inherit;\n --navBannerFontWeightEkoMobile: 400;\n --navBannerFontWeightEkoDesktop: 400;\n --outerWidth: 0\n}\n\n.eko-gallery * {\n box-sizing: border-box\n}\n\n.eko-gallery ul,\n.eko-gallery li {\n padding: 0;\n text-indent: 0;\n list-style-type: none;\n font-size: 0;\n margin: 0\n}\n\n.eko-gallery button {\n border: none;\n padding: 0\n}\n\n.eko-gallery .eko-hidden {\n display: none !important\n}\n\n.eko-gallery .eko-not-visible {\n visibility: hidden !important\n}\n\n.eko-hidden-variant {\n display: none !important\n}\n\n.eko-sr-only {\n width: 1px;\n height: 1px;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n margin: -1px;\n padding: 0;\n position: absolute;\n overflow: hidden\n}\n\n.eko-sticky-top {\n position: sticky;\n top: 0\n}\n\n.eko-gallery .eko-nav {\n height: 100%;\n display: flex;\n align-items: start;\n align-self: start;\n flex-shrink: 0;\n scrollbar-width: none;\n -ms-overflow-style: none\n}\n\n.eko-gallery .eko-nav li {\n font-size: 0;\n position: relative;\n display: flex;\n flex-shrink: 0;\n justify-content: center;\n -webkit-box-pack: center;\n cursor: pointer\n}\n\n.eko-gallery .eko-nav li button {\n position: relative;\n background-color: transparent;\n border-radius: 0;\n line-height: 0;\n overflow: hidden;\n cursor: pointer\n}\n\n.eko-gallery .eko-nav li button img {\n background-color: var(--navItemsBackgroundColorEko);\n pointer-events: none\n}\n\n.eko-gallery .eko-nav li button .item-icon {\n position: absolute;\n top: 0;\n right: 0;\n width: 32px;\n height: 32px;\n transform: scale(.25);\n transform-origin: top right\n}\n\n.eko-gallery .eko-nav li button .item-icon span {\n display: block;\n width: 400%;\n height: 400%;\n position: absolute;\n top: 0;\n right: 0;\n background-position: top right;\n background-repeat: no-repeat;\n background-size: contain\n}\n\n.eko-gallery .eko-nav li .addons-container {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n display: flex;\n flex-direction: column;\n font-size: 10px;\n line-height: 100%\n}\n\n.eko-gallery .eko-nav li .addons-container .thumb-label {\n width: 100%;\n background: var(--navItemsBannerBackgroundColorEko);\n padding: 4px;\n text-align: center;\n text-wrap: balance;\n color: var(--primaryColorEko)\n}\n\n.eko-gallery .eko-nav li .addons-container .step-indicator {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: center;\n gap: 5px;\n padding: 6px\n}\n\n.eko-gallery .eko-nav li .addons-container .step-indicator span {\n width: 5px;\n height: 5px;\n border-radius: 100px;\n background: #fff;\n box-shadow: 0 0 3px #00000094\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label {\n position: relative\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .step-indicator {\n position: absolute;\n bottom: 0\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n align-content: center\n}\n\n.eko-gallery .eko-nav::-webkit-scrollbar {\n display: none\n}\n\n.eko-nav-container {\n display: flex\n}\n\n.eko-nav-container:has(.eko-nav.eko-not-visible) .eko-nav-arrow {\n display: none\n}\n\n.eko-nav-container {\n position: relative;\n opacity: 0;\n transition: opacity .15s ease-in\n}\n\n.eko-nav-container .eko-nav-arrow {\n width: 28px;\n height: 28px;\n position: absolute;\n display: none;\n justify-content: center;\n align-items: center;\n border-radius: 28px;\n background-color: #fff;\n box-shadow: 0 0 6px #0000001f;\n z-index: 1;\n bottom: 50%;\n opacity: 1;\n transition: opacity .15s ease-in;\n transform: translateY(50%);\n cursor: pointer\n}\n\n.eko-nav-container .eko-nav-arrow.eko-prev-nav-button svg,\n.eko-nav-container .eko-nav-arrow.eko-next-nav-button svg {\n padding: 1px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-prev-nav-button {\n left: 8px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-next-nav-button {\n right: 8px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-hidden-nav-button {\n opacity: 0;\n pointer-events: none\n}\n\n.eko-gallery .eko-nav {\n gap: var(--navItemsGapEkoMobile);\n padding: var(--navBarPaddingEkoMobile)\n}\n\n.eko-gallery .eko-nav li button img {\n width: var(--navItemsWidthEkoMobile);\n height: var(--navItemsHeightEkoMobile);\n object-fit: var(--navItemsObjectFitEkoMobile)\n}\n\n.eko-gallery .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoMobile);\n font-size: var(--navBannerFontSizeEkoMobile);\n line-height: var(--navBannerFontLineHeightEkoMobile);\n font-weight: var(--navBannerFontWeightEkoMobile)\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoMobile);\n height: var(--navItemsHeightEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li {\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile))\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoMobile);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoMobile);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoMobile) + var(--navItemsSelectedMarginEkoMobile));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoMobile) var(--accentColorEko)\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-nav {\n gap: var(--navItemsGapEkoDesktop);\n padding: var(--navBarPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li button img {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop);\n object-fit: var(--navItemsObjectFitEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoDesktop);\n font-size: var(--navBannerFontSizeEkoDesktop);\n line-height: var(--navBannerFontLineHeightEkoDesktop);\n font-weight: var(--navBannerFontWeightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li {\n border-radius: 0;\n padding: 0;\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop))\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true] {\n box-shadow: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoDesktop);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoDesktop);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoDesktop) var(--accentColorEko)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true]:after {\n content: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container .eko-nav-arrow {\n width: 30px;\n height: 30px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container .eko-nav-arrow.eko-desktop-arrows {\n display: flex\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container:has(.eko-desktop-nav-selected-underline) .eko-nav-arrow.eko-desktop-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop)) / 2))\n }\n}\n\n@media screen and (max-width: 767px) {\n .eko-gallery.eko-liquid-gallery .eko-nav-arrow.eko-mobile-arrows {\n display: flex\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container:has(.eko-mobile-nav-selected-underline) .eko-nav-arrow.eko-mobile-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile)) / 2))\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav {\n gap: var(--navItemsGapEkoDesktop);\n padding: var(--navBarPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li button img {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop);\n object-fit: var(--navItemsObjectFitEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoDesktop);\n font-size: var(--navBannerFontSizeEkoDesktop);\n line-height: var(--navBannerFontLineHeightEkoDesktop);\n font-weight: var(--navBannerFontWeightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li {\n border-radius: 0;\n padding: 0;\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop))\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true] {\n box-shadow: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoDesktop);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoDesktop);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoDesktop) var(--accentColorEko)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true]:after {\n content: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container .eko-nav-arrow {\n width: 30px;\n height: 30px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container .eko-nav-arrow.eko-desktop-arrows {\n display: flex\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container:has(.eko-desktop-nav-selected-underline) .eko-nav-arrow.eko-desktop-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop)) / 2))\n }\n}\n\n@media screen and (max-width: 767px) {\n .eko-gallery.eko-react-gallery.eko-mobile .eko-nav-arrow.eko-mobile-arrows {\n display: flex\n }\n\n .eko-gallery.eko-react-gallery.eko-mobile .eko-nav-container:has(.eko-mobile-nav-selected-underline) .eko-nav-arrow.eko-mobile-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile)) / 2))\n }\n}\n\n.eko-media-badge {\n display: none;\n width: var(--navMediaBadgeSizeEkoMobile);\n height: var(--navMediaBadgeSizeEkoMobile);\n background: #fff;\n align-items: center;\n justify-content: center;\n border-radius: 100%;\n box-shadow: 0 0 4px #00000014;\n place-content: center;\n position: absolute;\n top: var(--navMediaBadgeMarginTopEkoMobile);\n right: var(--navMediaBadgeMarginRightEkoMobile)\n}\n\n.eko-media-badge svg {\n width: 100%;\n height: 100%\n}\n\n.eko-media-badge svg path {\n fill: #000\n}\n\n.eko-nav li .eko-media-badge-mobile {\n display: flex\n}\n\nsvg.interactiveThumb {\n position: absolute;\n top: 3px;\n right: -2.5px;\n width: 100%;\n height: 100%\n}\n\nsvg.interactiveThumb.hand {\n animation: handAnim 2.5s linear infinite\n}\n\nsvg.interactiveThumb.beam {\n animation: beamAnim 2.5s linear infinite;\n transform-origin: 26% 40%;\n top: 0\n}\n\n@keyframes handAnim {\n 0% {\n transform: translateY(0)\n }\n\n 3% {\n transform: translateY(-4px)\n }\n\n 15% {\n transform: translateY(0)\n }\n\n to {\n transform: translateY(0)\n }\n}\n\n@keyframes beamAnim {\n 0% {\n transform: scale(1);\n opacity: 0\n }\n\n 5% {\n transform: scale(1.1);\n opacity: 1\n }\n\n 30% {\n transform: scale(1.4);\n opacity: 0\n }\n\n to {\n transform: scale(1.4);\n opacity: 0\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-media-badge {\n width: var(--navMediaBadgeSizeEkoDesktop);\n height: var(--navMediaBadgeSizeEkoDesktop);\n top: var(--navMediaBadgeMarginTopEkoDesktop);\n right: var(--navMediaBadgeMarginRightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .eko-media-badge-mobile {\n display: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .eko-media-badge-desktop {\n display: flex\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-media-badge {\n width: var(--navMediaBadgeSizeEkoDesktop);\n height: var(--navMediaBadgeSizeEkoDesktop);\n top: var(--navMediaBadgeMarginTopEkoDesktop);\n right: var(--navMediaBadgeMarginRightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .eko-media-badge-mobile {\n display: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .eko-media-badge-desktop {\n display: flex\n }\n}\n\n.eko-loading-animation {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow: hidden;\n pointer-events: none\n}\n\n.eko-loading-animation.eko-show-loading-animation .eko-animated-bar {\n opacity: .6\n}\n\n.eko-loading-animation.eko-show-loading-animation .eko-animated-bar .eko-animated-bar-inner {\n animation: eko-loading-bar-inner-animation 2s infinite\n}\n\n.eko-loading-animation.eko-show-loading-text .eko-loading-text {\n opacity: 1\n}\n\n.eko-loading-animation .eko-animated-bar {\n width: 100%;\n height: 4px;\n background-color: #e8e8e8b2;\n opacity: 0;\n transition: opacity .5s;\n position: relative\n}\n\n.eko-loading-animation .eko-animated-bar .eko-animated-bar-inner {\n width: 150px;\n height: 100%;\n transform: translate(-150px);\n background-color: var(--accentColorEko, #4d484b);\n display: block;\n position: absolute\n}\n\n.eko-loading-animation .eko-loading-text {\n position: absolute;\n top: 10px;\n left: 50%;\n transform: translate(-50%);\n color: #656565;\n font-size: 12px;\n font-family: Bogle-Medium, sans-serif;\n font-weight: 500;\n opacity: 0;\n align-items: center;\n display: flex;\n gap: 2px;\n transition: opacity .5s\n}\n\n.eko-loading-animation .eko-loading-text-icon {\n opacity: 60%\n}\n\n.eko-loading-animation .eko-loading-text-icon svg {\n transform: translate(2px, 2px)\n}\n\n.eko-loading-animation .eko-loading-text-icon path {\n fill: var(--accentColorEko, #4d484b)\n}\n\n.eko-loading-animation.eko-hide-icon .eko-loading-text-icon {\n display: none\n}\n\n@keyframes eko-loading-bar-inner-animation {\n 0% {\n left: -350px\n }\n\n to {\n left: calc(100% + 350px)\n }\n}\n\n.eko-smart-loading {\n position: absolute;\n top: 8px;\n left: 50%;\n transform: translate(-50%);\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px\n}\n\n.eko-smart-loading div {\n position: relative;\n width: 158px;\n height: 3px;\n background-color: #dcdcdc;\n overflow: hidden;\n opacity: 0;\n animation: eko-smart-loading-show-animation .2s linear forwards 1s\n}\n\n.eko-smart-loading div:after {\n content: "";\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background-color: #878787;\n animation: eko-smart-loading-animation 2.5s ease-in-out infinite\n}\n\n.eko-smart-loading p {\n font-size: 11px;\n line-height: 120%;\n font-weight: 500;\n color: #6b6b6b;\n text-shadow: 0 0 2px white;\n opacity: 0;\n animation: eko-smart-loading-show-animation .2s linear forwards 3s\n}\n\n@keyframes eko-smart-loading-animation {\n 0% {\n transform: translate(-100%)\n }\n\n to {\n transform: translate(100%)\n }\n}\n\n@keyframes eko-smart-loading-show-animation {\n 0% {\n opacity: 0\n }\n\n to {\n opacity: 100%\n }\n}\n\n@media screen and (min-width: 450px) {\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-animated-bar {\n height: 6px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-loading-text {\n font-size: 16px;\n top: 12px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-loading-text-icon {\n transform: rotate(180deg)\n }\n}\n\n@media screen and (min-width: 450px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-animated-bar {\n height: 6px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-loading-text {\n font-size: 16px;\n top: 12px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-loading-text-icon {\n transform: rotate(180deg)\n }\n}\n\n.eko-carousel {\n width: 100%;\n white-space: nowrap;\n overflow-x: auto;\n overflow-y: hidden;\n scroll-snap-type: x mandatory;\n overscroll-behavior-x: contain;\n align-self: start;\n align-items: start;\n display: flex;\n gap: 10px;\n scrollbar-width: none;\n -ms-overflow-style: none\n}\n\n.eko-carousel li {\n width: 100%;\n display: inline-block;\n position: relative;\n align-items: start;\n overflow: hidden;\n scroll-snap-align: center;\n scroll-snap-stop: always;\n flex-shrink: 0\n}\n\n.eko-carousel li img.eko-cover-image {\n position: relative;\n pointer-events: none;\n transition: opacity .5s;\n z-index: 1;\n width: 100%;\n height: 100%;\n background-color: var(--carouselInteractiveCoverBackgroundColorEko)\n}\n\n.eko-carousel li iframe {\n position: absolute;\n border: none;\n top: 0;\n left: 0\n}\n\n.eko-carousel li img,\n.eko-carousel li video {\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n min-width: 0;\n background-color: var(--carouselItemsBackgroundColorEko)\n}\n\n.eko-carousel li[data-type=videoembed],\n.eko-carousel li[data-type=video] {\n cursor: pointer\n}\n\n.eko-carousel::-webkit-scrollbar {\n display: none\n}\n\n.eko-carousel:has(.zoomed) {\n overflow: hidden\n}\n\n.eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoMobile)\n}\n\n.eko-carousel li img.eko-desktop-cover-image {\n display: none\n}\n\n.eko-carousel li img.eko-mobile-cover-image {\n display: inline\n}\n\n.eko-carousel li img,\n.eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoMobile);\n object-fit: var(--carouselItemsObjectFitEkoMobile)\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-carousel li img,\n .eko-gallery.eko-liquid-gallery .eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop);\n object-fit: var(--carouselItemsObjectFitEkoDesktop)\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li img,\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop);\n object-fit: var(--carouselItemsObjectFitEkoDesktop)\n }\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-nav-container {\n display: none\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-carousel {\n overflow-x: hidden\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-mobile-carousel-scroll {\n overflow-x: auto\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-nav-container {\n display: none\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-carousel {\n overflow-x: hidden\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-carousel.eko-desktop-carousel-scroll {\n overflow-x: auto\n }\n\n .eko-gallery.eko-liquid-gallery.eko-mobile-embed-layout.eko-desktop-nav-layout .eko-nav-container {\n display: flex\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-nav-container {\n display: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-carousel {\n overflow-x: hidden\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-carousel.eko-desktop-carousel-scroll {\n overflow-x: auto\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-mobile-embed-layout.eko-desktop-nav-layout .eko-nav-container {\n display: flex\n }\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-bottom .eko-nav,\n.eko-gallery.eko-desktop-nav-layout.eko-desktop-nav-bottom .eko-nav,\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-top .eko-nav,\n.eko-gallery.eko-desktop-nav-layout.eko-desktop-nav-top .eko-nav {\n flex-direction: row;\n overflow-x: auto;\n overflow-y: hidden;\n max-width: 100%;\n margin: auto\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-bottom {\n flex-direction: column-reverse\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-top {\n flex-direction: column\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-bottom {\n flex-direction: column-reverse\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-top {\n flex-direction: column\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-bottom {\n flex-direction: column-reverse\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-top {\n flex-direction: column\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right {\n flex-direction: row-reverse\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left {\n flex-direction: row\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav {\n display: flex;\n flex-direction: column;\n justify-content: start;\n overflow-x: hidden;\n overflow-y: auto;\n gap: var(--navItemsGapEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container {\n display: flex;\n flex-shrink: 0\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button {\n top: 4px;\n left: auto\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n bottom: 4px\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n right: 50%;\n transform: translate(50%)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg {\n transform: rotate(90deg)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout .eko-carousel {\n align-self: start\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right {\n flex-direction: row-reverse\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left {\n flex-direction: row\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav {\n display: flex;\n flex-direction: column;\n justify-content: start;\n overflow-x: hidden;\n overflow-y: auto;\n gap: var(--navItemsGapEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container {\n display: flex;\n flex-shrink: 0\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button {\n top: 4px;\n left: auto\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n bottom: 4px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n right: 50%;\n transform: translate(50%)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg {\n transform: rotate(90deg)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout .eko-carousel {\n align-self: start\n }\n}\n\n.eko-gallery .eko-introButton {\n cursor: pointer;\n white-space: nowrap;\n pointer-events: auto;\n position: absolute;\n bottom: 100px;\n left: 50%;\n transform: translate(-50%);\n padding: 15px 20px\n}\n\n.eko-gallery .eko-introButton .eko-handContainer {\n display: none\n}\n\n.eko-gallery {\n position: relative;\n overflow: hidden;\n display: flex;\n flex-direction: row;\n justify-content: start;\n margin-inline-start: calc(-1 * var(--outerWidth));\n margin-inline-end: calc(-1 * var(--outerWidth));\n padding: var(--galleryPaddingEkoMobile);\n margin: auto;\n max-width: var(--galleryMaxWidthEkoMobile);\n transition: height var(--galleryTransition, .8s cubic-bezier(.35, 0, 0, 1) 1.5s), padding 0s;\n gap: var(--galleryGapEkoMobile)\n}\n\n.eko-gallery .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoMobile);\n overflow: hidden;\n flex: 1;\n display: flex;\n height: fit-content\n}\n\n.eko-gallery .eko-smart-gallery-container iframe {\n width: 100%;\n aspect-ratio: var(--carouselItemsAspectRatioEkoMobile)\n}\n\n.eko-gallery .eko-smart-gallery-container.eko-project-not-ready {\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n opacity: 0;\n pointer-events: none;\n touch-action: none\n}\n\n.eko-gallery .eko-smart-gallery-container.eko-project-not-ready iframe {\n pointer-events: none;\n touch-action: none\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery {\n max-width: var(--galleryMaxWidthEkoDesktop);\n gap: var(--galleryGapEkoDesktop);\n padding: var(--galleryPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-smart-gallery-container iframe {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop)\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop {\n max-width: var(--galleryMaxWidthEkoDesktop);\n gap: var(--galleryGapEkoDesktop);\n padding: var(--galleryPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-smart-gallery-container iframe {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop)\n }\n}'),re=({layout:t,style:n})=>{let i={};return function(t={}){Object.keys(t).forEach((e=>{i[`--${e}Eko`]=t[e]}))}(n),function(t){var e,n;const r=(null==t||null===(e=t.desktop)||void 0===e?void 0:e.config)||{},o=(null==t||null===(n=t.mobile)||void 0===n?void 0:n.config)||{};Object.keys(r).forEach((t=>{"string"==typeof r[t]&&(i[`--${t}EkoDesktop`]=r[t])})),Object.keys(o).forEach((t=>{"string"==typeof o[t]&&(i[`--${t}EkoMobile`]=o[t])}))}(t),e.createElement("style",{key:{layout:t,style:n}},`.eko-gallery {${Object.keys(i).map((t=>`${t}: ${i[t]};`)).join("\n")}}`)};re.propTypes={layout:Ot.object,style:Ot.object},b("experiment");const oe=({activeVariantId:t,activeElementId:e,hasInteractive:i,experiments:r,publishItem:o})=>{const a="gallery",l=n(t),c=n(e),u=n(i),d=n(r),h=n(o);s((()=>{l.current=t,c.current=e,u.current=i,d.current=r,h.current=o}),[t,e,i,r,o]);const f={publishItemPacker:{tag:a,schema:"iglu:com.helloeko/publishitem/jsonschema/1-0-0",match:/.*/,getData:function(){const t=h.current;if(t){const e={};return null!=t&&t.id&&(e.id=t.id),null!=t&&t.productId&&(e.productid=t.productId),t.salesChannelId&&(e.saleschannelid=t.salesChannelId),null!=t&&t.salesChannelName&&(e.saleschannelname=t.salesChannelName),t.salesChannelType&&(e.saleschanneltype=t.salesChannelType),e.id?e:void 0}}},galleryInteractionPacker:{tag:a,schema:"iglu:com.helloeko/gallery_interaction/jsonschema/1-0-0",match:"gallery.interaction",getData:function({elementid:t,interactiontype:e}){return{elementid:String(t),interactiontype:e}}},galleryPacker:{tag:a,schema:"iglu:com.helloeko/gallery/jsonschema/1-0-2",match:/^gallery.*/,getData:function(){var t;return{activeitemid:c.current.toString(),activevariantid:l.current,hasinteractive:u.current,version:(null===(t=window.eko)||void 0===t||null===(t=t.gallery)||void 0===t?void 0:t.version)||""}}},activeVariantIdPacker:{tag:a,schema:"iglu:com.helloeko/variant/jsonschema/1-0-1",match:/.*/,getData:function(){if(l.current)return{id:l.current}}},experimentPacker:{tag:a,schema:"iglu:com.helloeko/experiment/jsonschema/1-0-3",match:/.*/,getData:function(){var t;let e=function(t){let e=null;if(t){const n=Math.floor(Date.now()/1e3);for(const i of t){if("deliverable"!==i.type)return;const t=Math.floor(new Date(i.startDate).getTime()/1e3),r=Math.floor(new Date(i.endDate).getTime()/1e3);!0===i.active&&n>t&&n<r&&(e=i)}}return e}(d.current);if(!e)return;let n={experimentid:e.id||"",experimentvariant:e.chosen||"pending decision",experimenttype:e.type||""},i=null===(t=e.targetDevice)||void 0===t?void 0:t.toLowerCase();return"mobile"!==i&&"notmobile"!==i||(n.experimenttargeting={device:i}),n}}};return s((()=>(Object.values(f).forEach((t=>{window.EkoAnalytics("registerContextPacker",t)})),()=>{window.EkoAnalytics("reset",a)})),[]),null};oe.propTypes={activeVariantId:Ot.string,activeElementId:Ot.number,hasInteractive:Ot.bool,experiments:Ot.array,publishItem:Ot.object};const se=({variantId:t,activeItem:i,hasInteractive:r,activeIndex:o,experiments:a,publishItem:l})=>{const c=n(!0);return s((()=>{c.current||t&&D.track("gallery.variant.change")}),[t]),s((()=>{c.current||D.track("gallery.element.change",{activeIndex:o})}),[o]),s((()=>{c.current||i&&null!=l&&l.id&&D.track("gallery.asset.view",{publishitemid:l.id,type:i.type,name:i.name})}),[i]),s((()=>{c.current=!1}),[]),e.createElement(oe,{activeVariantId:t||"ekonovar",activeElementId:o,hasInteractive:r,experiments:a,publishItem:l})};se.propTypes={variantId:Ot.string,activeItem:Ot.object,hasInteractive:Ot.bool,activeIndex:Ot.number,experiments:Ot.array,publishItem:Ot.object};const ae="eko-gallery-react";function le(t,e){var n,i,r;const o=(null==t||null===(n=t.variantMap)||void 0===n?void 0:n[e])||"ekonovar";return(null==t||null===(i=t.items)||void 0===i?void 0:i.find((t=>(null==t?void 0:t.variantId)===o)))||(null==t||null===(r=t.items)||void 0===r?void 0:r[0])}"undefined"!=typeof window&&(window.EkoAnalytics||(console.log("EkoAnalytics is not defined, initializing a no-op function..."),window.EkoAnalytics=()=>{}));const ce=a((({className:t,config:r,instanceId:o,variantId:a,activeItem:l={index:0,step:0},onEvent:c,forceMobile:u},d)=>{var h,f,p,m,v,g;const y=null!==(h=null===(f=r.options)||void 0===f?void 0:f.loadingTimeout)&&void 0!==h?h:12,b=null===(p=null===(m=r.options)||void 0===m?void 0:m.showCoverLoadAnimation)||void 0===p||p,[k,x]=i(le(r,a)),[w,_]=i({index:l.index,step:l.step,source:"external-nav"}),[I,T]=i(!1),[E,S]=i(!1),[M,A]=i("eko-desktop"),N=n(!1),F=n(!1),C=n(l),O=n(null),P=n(a);function R(){const t=u||window.innerWidth<768?"eko-mobile":"eko-desktop";A(t)}return F.current||(Wt.send("galleryinit"),F.current=!0),s((()=>{const t=P.current!==a;P.current=a,x(le(r,a)),t&&!N.current&&_({index:0,step:0,source:"external-nav"})}),[r,a]),s((()=>{if(c)return Wt.subscribe(c),()=>{Wt.unsubscribe()}}),[c]),s((()=>{N.current=E}),[E]),s((()=>{T(!1),S(!1);const t=setTimeout((()=>{N.current||(T(!0),D.track("gallery.load.timeout"))}),1e3*y);return()=>{clearTimeout(t)}}),[r]),s((()=>{R()}),[u]),s((()=>(window.addEventListener("resize",R),R(),()=>{window.removeEventListener("resize",R)})),[u]),s((()=>(window.EkoAnalytics("trackElementVisibility",O.current,ae),()=>{window.EkoAnalytics("stopTrackingElementVisibility",ae)})),[]),s((()=>{!("carousel"===(null==w?void 0:w.source)||"nav"===(null==w?void 0:w.source))||(null==w?void 0:w.index)===l.index&&(null==w?void 0:w.step)===l.step||Wt.send("activeitemchanged",{index:null==w?void 0:w.index,step:null==w?void 0:w.step})}),[w,l]),s((()=>{C.current.index===l.index&&C.current.step===l.step||(C.current=l,_({index:l.index,step:l.step,source:"external-nav"}))}),[l]),e.createElement(e.Fragment,null,e.createElement(ie,null),e.createElement(re,{layout:r.layout,style:r.style,forceMobile:u}),e.createElement(se,{variantId:a,activeItem:null==k||null===(v=k.items)||void 0===v?void 0:v[w.index],activeIndex:w.index,hasInteractive:E,experiments:r.experiments,publishItem:null==r||null===(g=r.__autoGenerated)||void 0===g?void 0:g.publishItem}),e.createElement("section",{className:`${`eko-gallery eko-react-gallery ${function(t){let e="";return["mobile","desktop"].forEach((n=>{var i,r;const o=null!==(i=null==t||null===(r=t[n])||void 0===r?void 0:r.type)&&void 0!==i?i:"nav";if(e+=`eko-${n}-${o}-layout `,"nav"===o){var s;const i="desktop"===n,r=(null==t||null===(s=t[n])||void 0===s||null===(s=s.config)||void 0===s?void 0:s.orientation)||(i?"left":"bottom");e+=`eko-${n}-nav-${r} `}})),e}(r.layout)} ${null!=t?t:""}`.trim()} ${M}`,"aria-controls":"main-content",ref:O},e.createElement(qt,{items:(null==k?void 0:k.items)||[],setActiveIndex:_,activeIndex:w.index,layout:r.layout,carouselMounted:E,forceMobile:u}),!E&&e.createElement(Yt,{ref:d,items:(null==k?void 0:k.items)||[],setActiveIndex:_,activeIndex:{index:w.index,source:null==w?void 0:w.source},showSmartLoaders:!I&&b}),!I&&e.createElement(ne,{ref:d,config:r,instanceId:o,activeItem:w,setActiveItem:_,variantId:null==k?void 0:k.variantId,smartGalleryLoaded:E,forceMobile:u,onLoad:function(){S(!0)}})))}));ce.propTypes={className:Ot.string,config:Ot.object.isRequired,instanceId:Ot.string,variantId:Ot.string,activeItem:Ot.object,onEvent:Ot.func,forceMobile:Ot.bool,onPrev:Ot.func,onNext:Ot.func},ce.displayName="EkoGallery";var ue=c(ce);const de=b("gallery-react");const he=a(((t,n)=>{var i;s((()=>(de.setDataStorage("gallery-react",{config:t.config}),window.eko=window.eko||{},window.eko.config=t.config,window.eko.gallery={version:"devops/4.0.17"},()=>{window.eko.config=void 0})),[t.config]);const{children:r,...o}=t;return void 0!==t.config?e.createElement(ue,q({ref:n},o,{key:null===(i=t.config.__autoGenerated)||void 0===i||null===(i=i.publishItem)||void 0===i?void 0:i.id})):r}));he.propTypes={className:Ot.string,config:Ot.object,variantId:Ot.string,onEvent:Ot.func,instanceId:Ot.string,children:Ot.node},he.displayName="EkoGalleryWrapper";var fe,pe,me,ve,ge,ye,be,ke,xe,we,_e,Ie,Te,Ee,Se,Me,Ae,Ne,Fe,Ce,Oe,Pe,Re,De,Be,Le,ze,We,je,$e,Ue,qe,Ve,Ge,He,Ke,Xe,Ye,Qe,Je,Ze,tn,en,nn,rn,on,sn,an,ln,cn,un,dn=c(he);const hn=1,fn=2,pn=4,mn=8,vn=16,gn=1,yn=4,bn=8,kn=16,xn=4,wn="[",_n="[!",In="]",Tn={},En=Symbol(),Sn=Symbol("filename"),Mn="http://www.w3.org/1999/xhtml",An="@attach",Nn=!0;var Fn=Array.isArray,Cn=Array.prototype.indexOf,On=Array.from,Pn=Object.defineProperty,Rn=Object.getOwnPropertyDescriptor,Dn=Object.getOwnPropertyDescriptors,Bn=Object.prototype,Ln=Array.prototype,zn=Object.getPrototypeOf,Wn=Object.isExtensible;const jn=()=>{};function $n(){var t,e;return{promise:new Promise(((n,i)=>{t=n,e=i})),resolve:t,reject:e}}const Un=2,qn=4,Vn=8,Gn=1<<24,Hn=16,Kn=32,Xn=64,Yn=128,Qn=512,Jn=1024,Zn=2048,ti=4096,ei=8192,ni=16384,ii=32768,ri=65536,oi=1<<17,si=1<<18,ai=1<<19,li=1<<20,ci=1<<25,ui=32768,di=1<<21,hi=1<<22,fi=1<<23,pi=Symbol("$state"),mi=Symbol("legacy props"),vi=Symbol(""),gi=Symbol("proxy path"),yi=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},bi=3,ki=8;function xi(t){{const e=new Error(`lifecycle_outside_component\n\`${t}(...)\` can only be used during component initialisation\nhttps://svelte.dev/e/lifecycle_outside_component`);throw e.name="Svelte error",e}}var wi="font-weight: bold",_i="font-weight: normal";function Ii(t){console.warn("%c[svelte] hydration_mismatch\n%cHydration failed because the initial UI does not match what was rendered on the server\nhttps://svelte.dev/e/hydration_mismatch",wi,_i)}function Ti(t){console.warn(`%c[svelte] state_proxy_equality_mismatch\n%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${t}\` will produce unexpected results\nhttps://svelte.dev/e/state_proxy_equality_mismatch`,wi,_i)}let Ei,Si=!1;function Mi(t){Si=t}function Ai(t){if(null===t)throw Ii(),Tn;return Ei=t}function Ni(){return Ai(Vo(Ei))}function Fi(t){if(Si){if(null!==Vo(Ei))throw Ii(),Tn;Ei=t}}function Ci(t=!0){for(var e=0,n=Ei;;){if(n.nodeType===ki){var i=n.data;if(i===In){if(0===e)return n;e-=1}else i!==wn&&i!==_n||(e+=1)}var r=Vo(n);t&&n.remove(),n=r}}function Oi(t){if(!t||t.nodeType!==ki)throw Ii(),Tn;return t.data}function Pi(t){return t===this.v}function Ri(t){return e=t,n=this.v,!(e!=e?n==n:e!==n||null!==e&&"object"==typeof e||"function"==typeof e);var e,n}let Di=!1;function Bi(t,e){return t.label=e,Li(t.v,e),t}function Li(t,e){var n;return null==t||null===(n=t[gi])||void 0===n||n.call(t,e),t}function zi(t){const e=new Error,n=function(){const t=Error.stackTraceLimit;Error.stackTraceLimit=1/0;const e=(new Error).stack;if(Error.stackTraceLimit=t,!e)return[];const n=e.split("\n"),i=[];for(let t=0;t<n.length;t++){const e=n[t],r=e.replaceAll("\\","/");if("Error"!==e.trim()){if(e.includes("validate_each_keys"))return[];r.includes("svelte/src/internal")||r.includes("node_modules/.vite")||i.push(e)}}return i}();return 0===n.length?null:(n.unshift("\n"),Pn(e,"stack",{value:n.join("\n")}),Pn(e,"name",{value:t}),e)}let Wi=null;function ji(t){Wi=t}let $i=null;function Ui(t){$i=t}let qi=null;function Vi(t){qi=t}function Gi(t){return Xi("getContext").get(t)}function Hi(t,e=!1,n){Wi={p:Wi,i:!1,c:null,e:null,s:t,x:null,l:null},Wi.function=n,qi=n}function Ki(t){var e,n,i=Wi,r=i.e;if(null!==r)for(var o of(i.e=null,r))rs(o);return i.i=!0,Wi=i.p,qi=null!==(e=null===(n=Wi)||void 0===n?void 0:n.function)&&void 0!==e?e:null,{}}function Xi(t){var e,n;return null===Wi&&xi(t),null!==(n=(e=Wi).c)&&void 0!==n?n:e.c=new Map(function(t){let e=t.p;for(;null!==e;){const t=e.c;if(null!==t)return t;e=e.p}return null}(Wi)||void 0)}let Yi=[];function Qi(){var t=Yi;Yi=[],function(t){for(var e=0;e<t.length;e++)t[e]()}(t)}function Ji(t){if(0===Yi.length&&!mr){var e=Yi;queueMicrotask((()=>{e===Yi&&Qi()}))}Yi.push(t)}function Zi(){for(;Yi.length>0;)Qi()}const tr=new WeakMap;function er(t){var e=Ss;if(null===e)return Is.f|=fi,t;if(t instanceof Error&&!tr.has(t)&&tr.set(t,function(t,e){var n,i;const r=Rn(t,"message");if(r&&!r.configurable)return;var o=zo?" ":"\t",s=`\n${o}in ${(null===(n=e.fn)||void 0===n?void 0:n.name)||"<unknown>"}`,a=e.ctx;for(;null!==a;){var l;s+=`\n${o}in ${null===(l=a.function)||void 0===l?void 0:l[Sn].split("/").pop()}`,a=a.p}return{message:t.message+`\n${s}\n`,stack:null===(i=t.stack)||void 0===i?void 0:i.split("\n").filter((t=>!t.includes("svelte/src/internal"))).join("\n")}}(t,e)),e.f&ii)nr(t,e);else{if(!(e.f&Yn))throw!e.parent&&t instanceof Error&&ir(t),t;e.b.error(t)}}function nr(t,e){for(;null!==e;){if(e.f&Yn)try{return void e.b.error(t)}catch(e){t=e}e=e.parent}throw t instanceof Error&&ir(t),t}function ir(t){const e=tr.get(t);e&&(Pn(t,"message",{value:e.message}),Pn(t,"stack",{value:e.stack}))}const rr=-7169;function or(t,e){t.f=t.f&rr|e}function sr(t){t.f&Qn||null===t.deps?or(t,Jn):or(t,ti)}function ar(t){if(null!==t)for(const e of t)e.f&Un&&e.f&ui&&(e.f^=ui,ar(e.deps))}function lr(t,e,n){t.f&Zn?e.add(t):t.f&ti&&n.add(t),ar(t.deps),or(t,Jn)}const cr=new Set;let ur=null,dr=null,hr=[],fr=null,pr=!1,mr=!1;var vr=new WeakMap,gr=new WeakMap,yr=new WeakMap,br=new WeakMap,kr=new WeakMap,xr=new WeakMap,wr=new WeakMap,_r=new WeakSet;class Ir{constructor(){$(this,_r),U(this,"committed",!1),U(this,"current",new Map),U(this,"previous",new Map),W(this,vr,new Set),W(this,gr,new Set),W(this,yr,0),W(this,br,0),W(this,kr,null),W(this,xr,new Set),W(this,wr,new Set),U(this,"skipped_effects",new Set),U(this,"is_fork",!1)}is_deferred(){return this.is_fork||z(br,this)>0}process(t){hr=[],this.apply();var e,n=[],i=[];for(const e of t)B(_r,this,Tr).call(this,e,n,i);(this.is_fork||B(_r,this,Sr).call(this),this.is_deferred())?(B(_r,this,Er).call(this,i),B(_r,this,Er).call(this,n)):(ur=null,Cr(i),Cr(n),null===(e=z(kr,this))||void 0===e||e.resolve());dr=null}capture(t,e){var n;(e===En||this.previous.has(t)||this.previous.set(t,e),t.f&fi)||(this.current.set(t,t.v),null===(n=dr)||void 0===n||n.set(t,t.v))}activate(){ur=this,this.apply()}deactivate(){ur===this&&(ur=null,dr=null)}flush(){if(this.activate(),hr.length>0){if(Ar(),null!==ur&&ur!==this)return}else 0===z(yr,this)&&this.process([]);this.deactivate()}discard(){for(const t of z(gr,this))t(this);z(gr,this).clear()}increment(t){j(yr,this,z(yr,this)+1),t&&j(br,this,z(br,this)+1)}decrement(t){j(yr,this,z(yr,this)-1),t&&j(br,this,z(br,this)-1),this.revive()}revive(){for(const t of z(xr,this))z(wr,this).delete(t),or(t,Zn),Rr(t);for(const t of z(wr,this))or(t,ti),Rr(t);this.flush()}oncommit(t){z(vr,this).add(t)}ondiscard(t){z(gr,this).add(t)}settled(){var t;return(null!==(t=z(kr,this))&&void 0!==t?t:j(kr,this,$n())).promise}static ensure(){if(null===ur){const t=ur=new Ir;cr.add(ur),mr||Ir.enqueue((()=>{ur===t&&t.flush()}))}return ur}static enqueue(t){Ji(t)}apply(){}}function Tr(t,e,n){t.f^=Jn;for(var i=t.first,r=null;null!==i;){var o=i.f,s=!!(o&(Kn|Xn));if(!(s&&!!(o&Jn)||!!(o&ei)||this.skipped_effects.has(i))&&null!==i.fn){s?i.f^=Jn:null!==r&&o&(qn|Vn|Gn)?r.b.defer_effect(i):o&qn?e.push(i):zs(i)&&(o&Hn&&z(xr,this).add(i),qs(i));var a=i.first;if(null!==a){i=a;continue}}var l=i.parent;for(i=i.next;null===i&&null!==l;)l===r&&(r=null),i=l.next,l=l.parent}}function Er(t){for(var e=0;e<t.length;e+=1)lr(t[e],z(xr,this),z(wr,this))}function Sr(){if(0===z(br,this)){for(const t of z(vr,this))t();z(vr,this).clear()}0===z(yr,this)&&B(_r,this,Mr).call(this)}function Mr(){if(cr.size>1){this.previous.clear();var t=dr,e=!0;for(const t of cr){if(t===this){e=!1;continue}const i=[];for(const[n,r]of this.current){if(t.current.has(n)){if(!e||r===t.current.get(n))continue;t.current.set(n,r)}i.push(n)}if(0===i.length)continue;const r=[...t.current.keys()].filter((t=>!this.current.has(t)));if(r.length>0){var n=hr;hr=[];const e=new Set,o=new Map;for(const t of i)Or(t,r,e,o);if(hr.length>0){ur=t,t.apply();for(const e of hr)B(_r,t,Tr).call(t,e,[],[]);t.deactivate()}hr=n}}ur=null,dr=t}this.committed=!0,cr.delete(this)}function Ar(){var t=ks;pr=!0;var e=new Set;try{var n=0;for(xs(!0);hr.length>0;){var i=Ir.ensure();if(n++>1e3){if(Nn){var r=new Map;for(const t of i.current.keys())for(const[e,n]of null!==(o=t.updated)&&void 0!==o?o:[]){var o,s=r.get(e);s||(s={error:n.error,count:0},r.set(e,s)),s.count+=n.count}for(const t of r.values())t.error&&console.error(t.error)}Nr()}if(i.process(hr),xo.clear(),Nn)for(const t of i.current.keys())e.add(t)}}finally{pr=!1,xs(t),fr=null;for(const t of e)t.updated=null}}function Nr(){try{!function(){{const t=new Error("effect_update_depth_exceeded\nMaximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state\nhttps://svelte.dev/e/effect_update_depth_exceeded");throw t.name="Svelte error",t}}()}catch(t){Pn(t,"stack",{value:""}),nr(t,fr)}}let Fr=null;function Cr(t){var e=t.length;if(0!==e){for(var n=0;n<e;){var i,r=t[n++];if(!(r.f&(ni|ei))&&zs(r))if(Fr=new Set,qs(r),null===r.deps&&null===r.first&&null===r.nodes&&(null===r.teardown&&null===r.ac?ps(r):r.fn=null),(null===(i=Fr)||void 0===i?void 0:i.size)>0){xo.clear();for(const t of Fr){if(t.f&(ni|ei))continue;const e=[t];let n=t.parent;for(;null!==n;)Fr.has(n)&&(Fr.delete(n),e.push(n)),n=n.parent;for(let t=e.length-1;t>=0;t--){const n=e[t];n.f&(ni|ei)||qs(n)}}Fr.clear()}}Fr=null}}function Or(t,e,n,i){if(!n.has(t)&&(n.add(t),null!==t.reactions))for(const r of t.reactions){const t=r.f;t&Un?Or(r,e,n,i):t&(hi|Hn)&&!(t&Zn)&&Pr(r,e,i)&&(or(r,Zn),Rr(r))}}function Pr(t,e,n){const i=n.get(t);if(void 0!==i)return i;if(null!==t.deps)for(const i of t.deps){if(e.includes(i))return!0;if(i.f&Un&&Pr(i,e,n))return n.set(i,!0),!0}return n.set(t,!1),!1}function Rr(t){for(var e=fr=t;null!==e.parent;){var n=(e=e.parent).f;if(pr&&e===Ss&&n&Hn&&!(n&si))return;if(n&(Xn|Kn)){if(!(n&Jn))return;e.f^=Jn}}hr.push(e)}var Dr=ri|ai|Yn;var Br=new WeakMap,Lr=new WeakMap,zr=new WeakMap,Wr=new WeakMap,jr=new WeakMap,$r=new WeakMap,Ur=new WeakMap,qr=new WeakMap,Vr=new WeakMap,Gr=new WeakMap,Hr=new WeakMap,Kr=new WeakMap,Xr=new WeakMap,Yr=new WeakMap,Qr=new WeakMap,Jr=new WeakMap,Zr=new WeakMap,to=new WeakSet;class eo{constructor(t,e,n){$(this,to),U(this,"parent",void 0),U(this,"is_pending",!1),W(this,Br,void 0),W(this,Lr,Si?Ei:null),W(this,zr,void 0),W(this,Wr,void 0),W(this,jr,void 0),W(this,$r,null),W(this,Ur,null),W(this,qr,null),W(this,Vr,null),W(this,Gr,null),W(this,Hr,0),W(this,Kr,0),W(this,Xr,!1),W(this,Yr,new Set),W(this,Qr,new Set),W(this,Jr,null),W(this,Zr,function(t){let e,n=0,i=Io(0);return Bi(i,"createSubscriber version"),()=>{es()&&(Gs(i),ss((()=>(0===n&&(e=Xs((()=>t((()=>No(i)))))),n+=1,()=>{Ji((()=>{var t;n-=1,0===n&&(null===(t=e)||void 0===t||t(),e=void 0,No(i))}))}))))}}((()=>(j(Jr,this,Io(z(Hr,this))),Bi(z(Jr,this),"$effect.pending()"),()=>{j(Jr,this,null)})))),j(Br,this,t),j(zr,this,e),j(Wr,this,n),this.parent=Ss.b,this.is_pending=!!z(zr,this).pending,j(jr,this,ls((()=>{if(Ss.b=this,Si){const t=z(Lr,this);Ni();t.nodeType===ki&&t.data===_n?B(to,this,io).call(this):(B(to,this,no).call(this),0===z(Kr,this)&&(this.is_pending=!1))}else{var t=B(to,this,ro).call(this);try{j($r,this,us((()=>n(t))))}catch(t){this.error(t)}z(Kr,this)>0?B(to,this,so).call(this):this.is_pending=!1}return()=>{var t;null===(t=z(Gr,this))||void 0===t||t.remove()}}),Dr)),Si&&j(Br,this,Ei)}defer_effect(t){lr(t,z(Yr,this),z(Qr,this))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!z(zr,this).pending}update_pending_count(t){B(to,this,ao).call(this,t),j(Hr,this,z(Hr,this)+t),z(Jr,this)&&Mo(z(Jr,this),z(Hr,this))}get_effect_pending(){return z(Zr,this).call(this),Gs(z(Jr,this))}error(t){var e=z(zr,this).onerror;let n=z(zr,this).failed;if(z(Xr,this)||!e&&!n)throw t;z($r,this)&&(fs(z($r,this)),j($r,this,null)),z(Ur,this)&&(fs(z(Ur,this)),j(Ur,this,null)),z(qr,this)&&(fs(z(qr,this)),j(qr,this,null)),Si&&(Ai(z(Lr,this)),function(t=1){if(Si){for(var e=t,n=Ei;e--;)n=Vo(n);Ei=n}}(),Ai(Ci()));var i=!1,r=!1;const o=()=>{i?console.warn("%c[svelte] svelte_boundary_reset_noop\n%cA `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop",wi,_i):(i=!0,r&&function(){{const t=new Error("svelte_boundary_reset_onerror\nA `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror");throw t.name="Svelte error",t}}(),Ir.ensure(),j(Hr,this,0),null!==z(qr,this)&&ms(z(qr,this),(()=>{j(qr,this,null)})),this.is_pending=this.has_pending_snippet(),j($r,this,B(to,this,oo).call(this,(()=>(j(Xr,this,!1),us((()=>z(Wr,this).call(this,z(Br,this)))))))),z(Kr,this)>0?B(to,this,so).call(this):this.is_pending=!1)};var s=Is;try{Es(null),r=!0,null==e||e(t,o),r=!1}catch(t){nr(t,z(jr,this)&&z(jr,this).parent)}finally{Es(s)}n&&Ji((()=>{j(qr,this,B(to,this,oo).call(this,(()=>{Ir.ensure(),j(Xr,this,!0);try{return us((()=>{n(z(Br,this),(()=>t),(()=>o))}))}catch(t){return nr(t,z(jr,this).parent),null}finally{j(Xr,this,!1)}})))}))}}function no(){try{j($r,this,us((()=>z(Wr,this).call(this,z(Br,this)))))}catch(t){this.error(t)}}function io(){const t=z(zr,this).pending;t&&(j(Ur,this,us((()=>t(z(Br,this))))),Ir.enqueue((()=>{var t=B(to,this,ro).call(this);j($r,this,B(to,this,oo).call(this,(()=>(Ir.ensure(),us((()=>z(Wr,this).call(this,t))))))),z(Kr,this)>0?B(to,this,so).call(this):(ms(z(Ur,this),(()=>{j(Ur,this,null)})),this.is_pending=!1)})))}function ro(){var t=z(Br,this);return this.is_pending&&(j(Gr,this,Uo()),z(Br,this).before(z(Gr,this)),t=z(Gr,this)),t}function oo(t){var e=Ss,n=Is,i=Wi;Ms(z(jr,this)),Es(z(jr,this)),ji(z(jr,this).ctx);try{return t()}catch(t){return er(t),null}finally{Ms(e),Es(n),ji(i)}}function so(){const t=z(zr,this).pending;null!==z($r,this)&&(j(Vr,this,document.createDocumentFragment()),z(Vr,this).append(z(Gr,this)),bs(z($r,this),z(Vr,this))),null===z(Ur,this)&&j(Ur,this,us((()=>t(z(Br,this)))))}function ao(t){var e;if(this.has_pending_snippet()){if(j(Kr,this,z(Kr,this)+t),0===z(Kr,this)){this.is_pending=!1;for(const t of z(Yr,this))or(t,Zn),Rr(t);for(const t of z(Qr,this))or(t,ti),Rr(t);z(Yr,this).clear(),z(Qr,this).clear(),z(Ur,this)&&ms(z(Ur,this),(()=>{j(Ur,this,null)})),z(Vr,this)&&(z(Br,this).before(z(Vr,this)),j(Vr,this,null))}}else this.parent&&B(to,e=this.parent,ao).call(e,t)}function lo(t,e,n,i){const r=ho;if(0!==n.length||0!==t.length){var o,s,a,l,c,u=ur,d=Ss,h=(o=Ss,s=Is,a=Wi,l=ur,c=$i,function(t=!0){Ms(o),Es(s),ji(a),t&&(null==l||l.activate()),Ui(c)});t.length>0?Promise.all(t).then((()=>{h();try{return f()}finally{null==u||u.deactivate(),co()}})):f()}else i(e.map(r));function f(){Promise.all(n.map((t=>fo(t)))).then((t=>{h();try{i([...e.map(r),...t])}catch(t){d.f&ni||nr(t,d)}null==u||u.deactivate(),co()})).catch((t=>{nr(t,d)}))}}function co(){Ms(null),Es(null),ji(null),Ui(null)}const uo=new Set;function ho(t){var e=Un|Zn,n=null!==Is&&Is.f&Un?Is:null;null!==Ss&&(Ss.f|=ai);return{ctx:Wi,deps:null,effects:null,equals:Pi,f:e,fn:t,reactions:null,rv:0,v:En,wv:0,parent:null!=n?n:Ss,ac:null}}function fo(t,e,n){let i=Ss;null===i&&function(){{const t=new Error("async_derived_orphan\nCannot create a `$derived(...)` with an `await` expression outside of an effect tree\nhttps://svelte.dev/e/async_derived_orphan");throw t.name="Svelte error",t}}();var r=i.b,o=void 0,s=Io(En);s.label=e;var a=!Is,l=new Map;return function(t){ts(hi|ai,t,!0)}((()=>{var e=$n();o=e.promise;try{Promise.resolve(t()).then(e.resolve,e.reject).then((()=>{n===ur&&n.committed&&n.deactivate(),co()}))}catch(t){e.reject(t),co()}var n=ur;if(a){var i,c=r.is_rendered();r.update_pending_count(1),n.increment(c),null===(i=l.get(n))||void 0===i||i.reject(yi),l.delete(n),l.set(n,e)}const u=(t,e=void 0)=>{if(n.activate(),e)e!==yi&&(s.f|=fi,Mo(s,e));else{s.f&fi&&(s.f^=fi),Mo(s,t);for(const[t,e]of l){if(l.delete(t),t===n)break;e.reject(yi)}}a&&(r.update_pending_count(-1),n.decrement(c))};e.promise.then(u,(t=>u(null,t||"unknown")))})),ns((()=>{for(const t of l.values())t.reject(yi)})),s.f|=hi,new Promise((t=>{!function e(n){function i(){n===o?t(s):e(o)}n.then(i,i)}(o)}))}function po(t){const e=ho(t);return Ns(e),e}function mo(t){const e=ho(t);return e.equals=Ri,e}function vo(t){var e=t.effects;if(null!==e){t.effects=null;for(var n=0;n<e.length;n+=1)fs(e[n])}}let go=[];function yo(t){var e,n=Ss;Ms(function(t){for(var e=t.parent;null!==e;){if(!(e.f&Un))return e.f&ni?null:e;e=e.parent}return null}(t));{let i=ko;wo(new Set);try{go.includes(t)&&function(){{const t=new Error("derived_references_self\nA derived value cannot reference itself recursively\nhttps://svelte.dev/e/derived_references_self");throw t.name="Svelte error",t}}(),go.push(t),t.f&=~ui,vo(t),e=js(t)}finally{Ms(n),wo(i),go.pop()}}return e}function bo(t){var e,n,i=yo(t);if(!t.equals(i)&&(t.wv=Ls(),(null===(e=ur)||void 0===e||!e.is_fork||null===t.deps)&&(t.v=i,null===t.deps)))return void or(t,Jn);ws||(null!==dr?(es()||null!==(n=ur)&&void 0!==n&&n.is_fork)&&dr.set(t,i):sr(t))}let ko=new Set;const xo=new Map;function wo(t){ko=t}let _o=!1;function Io(t,e){return{f:0,v:t,reactions:null,equals:Pi,rv:0,wv:0}}function To(t,e){const n=Io(t);return Ns(n),n}function Eo(t,e=!1,n=!0){const i=Io(t);return e||(i.equals=Ri),i}function So(t,e,n=!1){var i;null!==Is&&(!Ts||Is.f&oi)&&Is.f&(Un|Hn|hi|oi)&&(null===(i=As)||void 0===i||!i.includes(t))&&function(){{const t=new Error("state_unsafe_mutation\nUpdating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw t.name="Svelte error",t}}();let r=n?Oo(e):e;return Li(r,t.label),Mo(t,r)}function Mo(t,e){if(!t.equals(e)){var n=t.v;ws?xo.set(t,e):xo.set(t,n),t.v=e;var i=Ir.ensure();if(i.capture(t,n),null!==Ss){var r,o,s;null!==(r=t.updated)&&void 0!==r||(t.updated=new Map);const e=(null!==(o=null===(s=t.updated.get(""))||void 0===s?void 0:s.count)&&void 0!==o?o:0)+1;if(t.updated.set("",{error:null,count:e}),e>5){const e=zi("updated at");if(null!==e){let n=t.updated.get(e.stack);n||(n={error:e,count:0},t.updated.set(e.stack,n)),n.count++}}}if(null!==Ss&&(t.set_during_effect=!0),t.f&Un){const e=t;t.f&Zn&&yo(e),sr(e)}t.wv=Ls(),Fo(t,Zn),null!==Ss&&Ss.f&Jn&&!(Ss.f&(Kn|Xn))&&(null===Os?function(t){Os=t}([t]):Os.push(t)),!i.is_fork&&ko.size>0&&!_o&&Ao()}return e}function Ao(){_o=!1;var t=ks;xs(!0);const e=Array.from(ko);try{for(const t of e)t.f&Jn&&or(t,ti),zs(t)&&qs(t)}finally{xs(t)}ko.clear()}function No(t){So(t,t.v+1)}function Fo(t,e){var n=t.reactions;if(null!==n)for(var i=n.length,r=0;r<i;r++){var o=n[r],s=o.f;if(s&oi)ko.add(o);else{var a=!(s&Zn);if(a&&or(o,e),s&Un){var l,c=o;null===(l=dr)||void 0===l||l.delete(c),s&ui||(s&Qn&&(o.f|=ui),Fo(c,ti))}else a&&(s&Hn&&null!==Fr&&Fr.add(o),Rr(o))}}}const Co=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function Oo(t){if("object"!=typeof t||null===t||pi in t)return t;const e=zn(t);if(e!==Bn&&e!==Ln)return t;var n=new Map,i=Fn(t),r=To(0),o=Ds,s=t=>{if(Ds===o)return t();var e=Is,n=Ds;Es(null),Bs(o);var i=t();return Es(e),Bs(n),i};i&&(n.set("length",To(t.length)),t=new Proxy(t,{get(t,e,n){var i=Reflect.get(t,e,n);return Do.has(e)?function(...t){_o=!0;var e=i.apply(this,t);return Ao(),e}:i}}));var a="";let l=!1;function c(t){if(!l){l=!0,Bi(r,`${a=t} version`);for(const[t,e]of n)Bi(e,Po(a,t));l=!1}}return new Proxy(t,{defineProperty(t,e,i){"value"in i&&!1!==i.configurable&&!1!==i.enumerable&&!1!==i.writable||function(){{const t=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw t.name="Svelte error",t}}();var r=n.get(e);return void 0===r?r=s((()=>{var t=To(i.value);return n.set(e,t),"string"==typeof e&&Bi(t,Po(a,e)),t})):So(r,i.value,!0),!0},deleteProperty(t,e){var i=n.get(e);if(void 0===i){if(e in t){const t=s((()=>To(En)));n.set(e,t),No(r),Bi(t,Po(a,e))}}else So(i,En),No(r);return!0},get(e,i,r){var o;if(i===pi)return t;if(i===gi)return c;var l=n.get(i),u=i in e;if(void 0===l&&(!u||null!==(o=Rn(e,i))&&void 0!==o&&o.writable)&&(l=s((()=>{var t=To(Oo(u?e[i]:En));return Bi(t,Po(a,i)),t})),n.set(i,l)),void 0!==l){var d=Gs(l);return d===En?void 0:d}return Reflect.get(e,i,r)},getOwnPropertyDescriptor(t,e){var i=Reflect.getOwnPropertyDescriptor(t,e);if(i&&"value"in i){var r=n.get(e);r&&(i.value=Gs(r))}else if(void 0===i){var o=n.get(e),s=null==o?void 0:o.v;if(void 0!==o&&s!==En)return{enumerable:!0,configurable:!0,value:s,writable:!0}}return i},has(t,e){var i;if(e===pi)return!0;var r=n.get(e),o=void 0!==r&&r.v!==En||Reflect.has(t,e);if((void 0!==r||null!==Ss&&(!o||null!==(i=Rn(t,e))&&void 0!==i&&i.writable))&&(void 0===r&&(r=s((()=>{var n=To(o?Oo(t[e]):En);return Bi(n,Po(a,e)),n})),n.set(e,r)),Gs(r)===En))return!1;return o},set(t,e,o,l){var c,u=n.get(e),d=e in t;if(i&&"length"===e)for(var h=o;h<u.v;h+=1){var f=n.get(h+"");void 0!==f?So(f,En):h in t&&(f=s((()=>To(En))),n.set(h+"",f),Bi(f,Po(a,h)))}void 0===u?(!d||null!==(c=Rn(t,e))&&void 0!==c&&c.writable)&&(Bi(u=s((()=>To(void 0))),Po(a,e)),So(u,Oo(o)),n.set(e,u)):(d=u.v!==En,So(u,s((()=>Oo(o)))));var p=Reflect.getOwnPropertyDescriptor(t,e);if(null!=p&&p.set&&p.set.call(l,o),!d){if(i&&"string"==typeof e){var m=n.get("length"),v=Number(e);Number.isInteger(v)&&v>=m.v&&So(m,v+1)}No(r)}return!0},ownKeys(t){Gs(r);var e=Reflect.ownKeys(t).filter((t=>{var e=n.get(t);return void 0===e||e.v!==En}));for(var[i,o]of n)o.v===En||i in t||e.push(i);return e},setPrototypeOf(){!function(){{const t=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw t.name="Svelte error",t}}()}})}function Po(t,e){var n;return"symbol"==typeof e?`${t}[Symbol(${null!==(n=e.description)&&void 0!==n?n:""})]`:Co.test(e)?`${t}.${e}`:/^\d+$/.test(e)?`${t}[${e}]`:`${t}['${e}']`}function Ro(t){try{if(null!==t&&"object"==typeof t&&pi in t)return t[pi]}catch{}return t}const Do=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function Bo(t,e,n=!0){try{t===e!=(Ro(t)===Ro(e))&&Ti(n?"===":"!==")}catch{}return t===e===n}var Lo,zo,Wo,jo;function $o(){if(void 0===Lo){Lo=window,zo=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;Wo=Rn(e,"firstChild").get,jo=Rn(e,"nextSibling").get,Wn(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),Wn(n)&&(n.__t=void 0),t.__svelte_meta=null,function(){const t=Array.prototype,e=Array.__svelte_cleanup;e&&e();const{indexOf:n,lastIndexOf:i,includes:r}=t;t.indexOf=function(t,e){const i=n.call(this,t,e);if(-1===i)for(let n=null!=e?e:0;n<this.length;n+=1)if(Ro(this[n])===t){Ti("array.indexOf(...)");break}return i},t.lastIndexOf=function(t,e){const n=i.call(this,t,null!=e?e:this.length-1);if(-1===n)for(let n=0;n<=(null!=e?e:this.length-1);n+=1)if(Ro(this[n])===t){Ti("array.lastIndexOf(...)");break}return n},t.includes=function(t,e){const n=r.call(this,t,e);if(!n)for(let e=0;e<this.length;e+=1)if(Ro(this[e])===t){Ti("array.includes(...)");break}return n},Array.__svelte_cleanup=()=>{t.indexOf=n,t.lastIndexOf=i,t.includes=r}}()}}function Uo(t=""){return document.createTextNode(t)}function qo(t){return Wo.call(t)}function Vo(t){return jo.call(t)}function Go(t,e){if(!Si)return qo(t);var n=qo(Ei);if(null===n)n=Ei.appendChild(Uo());else if(e&&n.nodeType!==bi){var i,r=Uo();return null===(i=n)||void 0===i||i.before(r),Ai(r),r}return Ai(n),n}function Ho(t,e=!1){var n;if(!Si){var i=qo(t);return i instanceof Comment&&""===i.data?Vo(i):i}if(e&&(null===(n=Ei)||void 0===n?void 0:n.nodeType)!==bi){var r,o=Uo();return null===(r=Ei)||void 0===r||r.before(o),Ai(o),o}return Ei}function Ko(t,e=1,n=!1){var i;let r=Si?Ei:t;for(var o;e--;)o=r,r=Vo(r);if(!Si)return r;if(n&&(null===(i=r)||void 0===i?void 0:i.nodeType)!==bi){var s,a=Uo();if(null===r)null===(s=o)||void 0===s||s.after(a);else r.before(a);return Ai(a),a}return Ai(r),r}function Xo(t){t.textContent=""}function Yo(t,e){if(e){const e=document.body;t.autofocus=!0,Ji((()=>{document.activeElement===e&&t.focus()}))}}let Qo=!1;function Jo(t){var e=Is,n=Ss;Es(null),Ms(null);try{return t()}finally{Es(e),Ms(n)}}function Zo(t){null===Ss&&(null===Is&&function(t){{const e=new Error(`effect_orphan\n\`${t}\` can only be used inside an effect (e.g. during component initialisation)\nhttps://svelte.dev/e/effect_orphan`);throw e.name="Svelte error",e}}(t),function(){{const t=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw t.name="Svelte error",t}}()),ws&&function(t){{const e=new Error(`effect_in_teardown\n\`${t}\` cannot be used inside an effect cleanup function\nhttps://svelte.dev/e/effect_in_teardown`);throw e.name="Svelte error",e}}(t)}function ts(t,e,n){for(var i=Ss;null!==i&&i.f&oi;)i=i.parent;null!==i&&i.f&ei&&(t|=ei);var r={ctx:Wi,deps:null,nodes:null,f:t|Zn|Qn,first:null,fn:e,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,wv:0,ac:null};if(r.component_function=qi,n)try{qs(r),r.f|=ii}catch(t){throw fs(r),t}else null!==e&&Rr(r);var o=r;if(!n||null!==o.deps||null!==o.teardown||null!==o.nodes||o.first!==o.last||o.f&ai||(o=o.first,t&Hn&&t&ri&&null!==o&&(o.f|=ri)),null!==o&&(o.parent=i,null!==i&&function(t,e){var n=e.last;null===n?e.last=e.first=t:(n.next=t,t.prev=n,e.last=t)}(o,i),null!==Is&&Is.f&Un&&!(t&Xn))){var s,a=Is;(null!==(s=a.effects)&&void 0!==s?s:a.effects=[]).push(o)}return r}function es(){return null!==Is&&!Ts}function ns(t){const e=ts(Vn,null,!1);return or(e,Jn),e.teardown=t,e}function is(t){Zo("$effect"),Pn(t,"name",{value:"$effect"});var e=Ss.f;if(!!(Is||!(e&Kn)||e&ii))return rs(t);var n,i=Wi;(null!==(n=i.e)&&void 0!==n?n:i.e=[]).push(t)}function rs(t){return ts(qn|li,t,!1)}function os(t){return ts(qn,t,!1)}function ss(t,e=0){return ts(Vn|e,t,!0)}function as(t,e=[],n=[],i=[]){lo(i,e,n,(e=>{ts(Vn,(()=>t(...e.map(Gs))),!0)}))}function ls(t,e=0){var n=ts(Hn|e,t,!0);return n.dev_stack=$i,n}function cs(t,e=0){var n=ts(Gn|e,t,!0);return n.dev_stack=$i,n}function us(t){return ts(Kn|ai,t,!0)}function ds(t){var e=t.teardown;if(null!==e){const t=ws,n=Is;_s(!0),Es(null);try{e.call(null)}finally{_s(t),Es(n)}}}function hs(t,e=!1){var n=t.first;for(t.first=t.last=null;null!==n;){const t=n.ac;null!==t&&Jo((()=>{t.abort(yi)}));var i=n.next;n.f&Xn?n.parent=null:fs(n,e),n=i}}function fs(t,e=!0){var n=!1;(e||t.f&si)&&null!==t.nodes&&null!==t.nodes.end&&(!function(t,e){for(;null!==t;){var n=t===e?null:Vo(t);t.remove(),t=n}}(t.nodes.start,t.nodes.end),n=!0),hs(t,e&&!n),Us(t,0),or(t,ni);var i=t.nodes&&t.nodes.t;if(null!==i)for(const t of i)t.stop();ds(t);var r=t.parent;null!==r&&null!==r.first&&ps(t),t.component_function=null,t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=null}function ps(t){var e=t.parent,n=t.prev,i=t.next;null!==n&&(n.next=i),null!==i&&(i.prev=n),null!==e&&(e.first===t&&(e.first=i),e.last===t&&(e.last=n))}function ms(t,e,n=!0){var i=[];vs(t,i,!0);var r=()=>{n&&fs(t),e&&e()},o=i.length;if(o>0){var s=()=>--o||r();for(var a of i)a.out(s)}else r()}function vs(t,e,n){if(!(t.f&ei)){t.f^=ei;var i=t.nodes&&t.nodes.t;if(null!==i)for(const t of i)(t.is_global||n)&&e.push(t);for(var r=t.first;null!==r;){var o=r.next;vs(r,e,!!(!!(r.f&ri)||!!(r.f&Kn)&&!!(t.f&Hn))&&n),r=o}}}function gs(t){ys(t,!0)}function ys(t,e){if(t.f&ei){t.f^=ei,t.f&Jn||(or(t,Zn),Rr(t));for(var n=t.first;null!==n;){var i=n.next;ys(n,!!(!!(n.f&ri)||!!(n.f&Kn))&&e),n=i}var r=t.nodes&&t.nodes.t;if(null!==r)for(const t of r)(t.is_global||e)&&t.in()}}function bs(t,e){if(t.nodes)for(var n=t.nodes.start,i=t.nodes.end;null!==n;){var r=n===i?null:Vo(n);e.append(n),n=r}}let ks=!1;function xs(t){ks=t}let ws=!1;function _s(t){ws=t}let Is=null,Ts=!1;function Es(t){Is=t}let Ss=null;function Ms(t){Ss=t}let As=null;function Ns(t){null!==Is&&(null===As?As=[t]:As.push(t))}let Fs=null,Cs=0,Os=null;let Ps=1,Rs=0,Ds=Rs;function Bs(t){Ds=t}function Ls(){return++Ps}function zs(t){var e=t.f;if(e&Zn)return!0;if(e&Un&&(t.f&=~ui),e&ti){for(var n=t.deps,i=n.length,r=0;r<i;r++){var o=n[r];if(zs(o)&&bo(o),o.wv>t.wv)return!0}e&Qn&&null===dr&&or(t,Jn)}return!1}function Ws(t,e,n=!0){var i,r=t.reactions;if(null!==r&&(null===(i=As)||void 0===i||!i.includes(t)))for(var o=0;o<r.length;o++){var s=r[o];s.f&Un?Ws(s,e,!1):e===s&&(n?or(s,Zn):s.f&Jn&&or(s,ti),Rr(s))}}function js(t){var e=Fs,n=Cs,i=Os,r=Is,o=As,s=Wi,a=Ts,l=Ds,c=t.f;Fs=null,Cs=0,Os=null,Is=c&(Kn|Xn)?null:t,As=null,ji(t.ctx),Ts=!1,Ds=++Rs,null!==t.ac&&(Jo((()=>{t.ac.abort(yi)})),t.ac=null);try{t.f|=di;var u=(0,t.fn)(),d=t.deps;if(null!==Fs){var h;if(Us(t,Cs),null!==d&&Cs>0)for(d.length=Cs+Fs.length,h=0;h<Fs.length;h++)d[Cs+h]=Fs[h];else t.deps=d=Fs;if(es()&&t.f&Qn)for(h=Cs;h<d.length;h++){var f,p;(null!==(p=(f=d[h]).reactions)&&void 0!==p?p:f.reactions=[]).push(t)}}else null!==d&&Cs<d.length&&(Us(t,Cs),d.length=Cs);if(!(null===Os||Ts||null===d||t.f&(Un|ti|Zn)))for(h=0;h<Os.length;h++)Ws(Os[h],t);return null!==r&&r!==t&&(Rs++,null!==Os&&(null===i?i=Os:i.push(...Os))),t.f&fi&&(t.f^=fi),u}catch(t){return er(t)}finally{t.f^=di,Fs=e,Cs=n,Os=i,Is=r,As=o,ji(s),Ts=a,Ds=l}}function $s(t,e){let n=e.reactions;if(null!==n){var i=Cn.call(n,t);if(-1!==i){var r=n.length-1;0===r?n=e.reactions=null:(n[i]=n[r],n.pop())}}if(null===n&&e.f&Un&&(null===Fs||!Fs.includes(e))){var o=e;o.f&Qn&&(o.f^=Qn,o.f&=~ui),sr(o),vo(o),Us(o,0)}}function Us(t,e){var n=t.deps;if(null!==n)for(var i=e;i<n.length;i++)$s(t,n[i])}function qs(t){var e=t.f;if(!(e&ni)){or(t,Jn);var n=Ss,i=ks;Ss=t,ks=!0;var r,o=qi;Vi(t.component_function);var s=$i;Ui(null!==(r=t.dev_stack)&&void 0!==r?r:$i);try{e&(Hn|Gn)?function(t){for(var e=t.first;null!==e;){var n=e.next;e.f&Kn||fs(e),e=n}}(t):hs(t),ds(t);var a=js(t);t.teardown="function"==typeof a?a:null,t.wv=Ps,Nn&&Di&&t.f&Zn&&t.deps}finally{ks=i,Ss=n,Vi(o),Ui(s)}}}async function Vs(){await Promise.resolve(),function(){var t=mr;mr=!0;try{for(;;){var e;if(Zi(),0===hr.length&&(null===(e=ur)||void 0===e||e.flush(),0===hr.length))return void(fr=null);Ar()}}finally{mr=t}}()}function Gs(t){var e,n,i=!!(t.f&Un);if(null!==Is&&!Ts&&!(null!==Ss&&!!(Ss.f&ni)||null!==(n=As)&&void 0!==n&&n.includes(t))){var r=Is.deps;if(Is.f&di)t.rv<Rs&&(t.rv=Rs,null===Fs&&null!==r&&r[Cs]===t?Cs++:null===Fs?Fs=[t]:Fs.includes(t)||Fs.push(t));else{var o,s;(null!==(s=(o=Is).deps)&&void 0!==s?s:o.deps=[]).push(t);var a=t.reactions;null===a?t.reactions=[Is]:a.includes(Is)||a.push(Is)}}if(uo.delete(t),ws&&xo.has(t))return xo.get(t);if(i){var l=t;if(ws){var c=l.v;return(l.f&Jn||null===l.reactions)&&!Ks(l)||(c=yo(l)),xo.set(l,c),c}var u=!(l.f&Qn)&&!Ts&&null!==Is&&(ks||!!(Is.f&Qn)),d=null===l.deps;zs(l)&&(u&&(l.f|=Qn),bo(l)),u&&!d&&Hs(l)}if(null!==(e=dr)&&void 0!==e&&e.has(t))return dr.get(t);if(t.f&fi)throw t.v;return t.v}function Hs(t){if(null!==t.deps){t.f|=Qn;for(const n of t.deps){var e;(null!==(e=n.reactions)&&void 0!==e?e:n.reactions=[]).push(t),n.f&Un&&!(n.f&Qn)&&Hs(n)}}}function Ks(t){if(t.v===En)return!0;if(null===t.deps)return!1;for(const e of t.deps){if(xo.has(e))return!0;if(e.f&Un&&Ks(e))return!0}return!1}function Xs(t){var e=Ts;try{return Ts=!0,t()}finally{Ts=e}}const Ys=new Set,Qs=new Set;function Js(t,e,n,i={}){function r(t){if(i.capture||na.call(e,t),!t.cancelBubble)return Jo((()=>null==n?void 0:n.call(this,t)))}return t.startsWith("pointer")||t.startsWith("touch")||"wheel"===t?Ji((()=>{e.addEventListener(t,r,i)})):e.addEventListener(t,r,i),r}function Zs(t,e,n,i,r){var o={capture:i,passive:r},s=Js(t,e,n,o);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&ns((()=>{e.removeEventListener(t,s,o)}))}function ta(t){for(var e=0;e<t.length;e++)Ys.add(t[e]);for(var n of Qs)n(t)}let ea=null;function na(t){var e,n=this,i=n.ownerDocument,r=t.type,o=(null===(e=t.composedPath)||void 0===e?void 0:e.call(t))||[],s=o[0]||t.target;ea=t;var a=0,l=ea===t&&t.__root;if(l){var c=o.indexOf(l);if(-1!==c&&(n===document||n===window))return void(t.__root=n);var u=o.indexOf(n);if(-1===u)return;c<=u&&(a=c)}if((s=o[a]||t.target)!==n){Pn(t,"currentTarget",{configurable:!0,get:()=>s||i});var d=Is,h=Ss;Es(null),Ms(null);try{for(var f,p=[];null!==s;){var m=s.assignedSlot||s.parentNode||s.host||null;try{var v=s["__"+r];null==v||s.disabled&&t.target!==s||v.call(s,t)}catch(t){f?p.push(t):f=t}if(t.cancelBubble||m===n||null===m)break;s=m}if(f){for(let t of p)queueMicrotask((()=>{throw t}));throw f}}finally{t.__root=n,delete t.currentTarget,Es(d),Ms(h)}}}function ia(t){var e=document.createElement("template");return e.innerHTML=t.replaceAll("<!>","\x3c!----\x3e"),e.content}function ra(t,e){var n=Ss;null===n.nodes&&(n.nodes={start:t,end:e,a:null,t:null})}function oa(t,e){var n,i=!!(1&e),r=!!(2&e),o=!t.startsWith("<!>");return()=>{if(Si)return ra(Ei,null),Ei;void 0===n&&(n=ia(o?t:"<!>"+t),i||(n=qo(n)));var e=r||zo?document.importNode(n,!0):n.cloneNode(!0);i?ra(qo(e),e.lastChild):ra(e,e);return e}}function sa(t,e,n="svg"){var i,r=`<${n}>${!t.startsWith("<!>")?t:"<!>"+t}</${n}>`;return()=>{if(Si)return ra(Ei,null),Ei;if(!i){var t=ia(r);i=qo(qo(t))}var e=i.cloneNode(!0);return ra(e,e),e}}function aa(t,e){return sa(t,0,"svg")}function la(){if(Si)return ra(Ei,null),Ei;var t=document.createDocumentFragment(),e=document.createComment(""),n=Uo();return t.append(e,n),ra(e,n),t}function ca(t,e){if(Si){var n=Ss;return n.f&ii&&null!==n.nodes.end||(n.nodes.end=Ei),void Ni()}null!==t&&t.before(e)}function ua(t){return t.endsWith("capture")&&"gotpointercapture"!==t&&"lostpointercapture"!==t}const da=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function ha(t){return da.includes(t)}const fa={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function pa(t){var e;return t=t.toLowerCase(),null!==(e=fa[t])&&void 0!==e?e:t}const ma=["touchstart","touchmove"];let va=!0;function ga(t,e){var n,i=null==e?"":"object"==typeof e?e+"":e;i!==(null!==(n=t.__t)&&void 0!==n?n:t.__t=t.nodeValue)&&(t.__t=i,t.nodeValue=i+"")}function ya(t,e){return xa(t,e)}function ba(t,e){var n;$o(),e.intro=null!==(n=e.intro)&&void 0!==n&&n;const i=e.target,r=Si,o=Ei;try{for(var s=qo(i);s&&(s.nodeType!==ki||s.data!==wn);)s=Vo(s);if(!s)throw Tn;Mi(!0),Ai(s);const n=xa(t,{...e,anchor:s});return Mi(!1),n}catch(n){if(n instanceof Error&&n.message.split("\n").some((t=>t.startsWith("https://svelte.dev/e/"))))throw n;return n!==Tn&&console.warn("Failed to hydrate: ",n),!1===e.recover&&function(){{const t=new Error("hydration_failed\nFailed to hydrate the application\nhttps://svelte.dev/e/hydration_failed");throw t.name="Svelte error",t}}(),$o(),Xo(i),Mi(!1),ya(t,e)}finally{Mi(r),Ai(o)}}const ka=new Map;function xa(t,{target:e,anchor:n,props:i={},events:r,context:o,intro:s=!0}){$o();var a=new Set,l=t=>{for(var n=0;n<t.length;n++){var i=t[n];if(!a.has(i)){a.add(i);var r=(s=i,ma.includes(s));e.addEventListener(i,na,{passive:r});var o=ka.get(i);void 0===o?(document.addEventListener(i,na,{passive:r}),ka.set(i,1)):ka.set(i,o+1)}}var s};l(On(Ys)),Qs.add(l);var c=void 0,u=function(t){Ir.ensure();const e=ts(Xn|ai,t,!0);return(t={})=>new Promise((n=>{t.outro?ms(e,(()=>{fs(e),n(void 0)})):(fs(e),n(void 0))}))}((()=>{var u=null!=n?n:e.appendChild(Uo());return function(t,e,n){new eo(t,e,n)}(u,{pending:()=>{}},(e=>{o&&(Hi({}),Wi.c=o);if(r&&(i.$$events=r),Si&&ra(e,null),va=s,c=t(e,i)||{},va=!0,Si&&(Ss.nodes.end=Ei,null===Ei||Ei.nodeType!==ki||Ei.data!==In))throw Ii(),Tn;o&&Ki()})),()=>{for(var t of a){e.removeEventListener(t,na);var i=ka.get(t);0==--i?(document.removeEventListener(t,na),ka.delete(t)):ka.set(t,i)}var r;(Qs.delete(l),u!==n)&&(null===(r=u.parentNode)||void 0===r||r.removeChild(u))}}));return wa.set(c,u),c}let wa=new WeakMap;function _a(t,e){const n=wa.get(t);return n?(wa.delete(t),n(e)):(pi in t?console.warn("%c[svelte] state_proxy_unmount\n%cTried to unmount a state proxy, rather than a component\nhttps://svelte.dev/e/state_proxy_unmount",wi,_i):console.warn("%c[svelte] lifecycle_double_unmount\n%cTried to unmount a component that was not mounted\nhttps://svelte.dev/e/lifecycle_double_unmount",wi,_i),Promise.resolve())}class Ia{anchor;#t=new Map;#e=new Map;#n=new Map;#i=new Set;#r=!0;constructor(t,e=!0){this.anchor=t,this.#r=e}#o=()=>{var t=ur;if(this.#t.has(t)){var e=this.#t.get(t),n=this.#e.get(e);if(n)gs(n),this.#i.delete(e);else{var i=this.#n.get(e);i&&(this.#e.set(e,i.effect),this.#n.delete(e),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),n=i.effect)}for(const[e,n]of this.#t){if(this.#t.delete(e),e===t)break;const i=this.#n.get(n);i&&(fs(i.effect),this.#n.delete(n))}for(const[t,i]of this.#e){if(t===e||this.#i.has(t))continue;const r=()=>{if(Array.from(this.#t.values()).includes(t)){var e=document.createDocumentFragment();bs(i,e),e.append(Uo()),this.#n.set(t,{effect:i,fragment:e})}else fs(i);this.#i.delete(t),this.#e.delete(t)};this.#r||!n?(this.#i.add(t),ms(i,r,!1)):r()}}};#s=t=>{this.#t.delete(t);const e=Array.from(this.#t.values());for(const[t,n]of this.#n)e.includes(t)||(fs(n.effect),this.#n.delete(t))};ensure(t,e){var n=ur;!e||this.#e.has(t)||this.#n.has(t)||this.#e.set(t,us((()=>e(this.anchor)))),this.#t.set(n,t),Si&&(this.anchor=Ei),this.#o()}}{let t=function(t){if(!(t in globalThis)){let e;Object.defineProperty(globalThis,t,{configurable:!0,get:()=>{if(void 0!==e)return e;!function(t){{const e=new Error(`rune_outside_svelte\nThe \`${t}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files\nhttps://svelte.dev/e/rune_outside_svelte`);throw e.name="Svelte error",e}}(t)},set:t=>{e=t}})}};t("$state"),t("$effect"),t("$derived"),t("$inspect"),t("$props"),t("$bindable")}function Ta(t){null===Wi&&xi("onMount"),is((()=>{const e=Xs(t);if("function"==typeof e)return e}))}var Ea,Sa=new Map;function Ma(t,e,n=!1){Si&&Ni();var i=new Ia(t);function r(e,n){if(Si){if(e===(Oi(t)===_n)){var r=Ci();return Ai(r),i.anchor=r,Mi(!1),i.ensure(e,n),void Mi(!0)}}i.ensure(e,n)}ls((()=>{var t=!1;e(((e,n=!0)=>{t=!0,r(n,e)})),t||r(!1,null)}),n?ri:0)}function Aa(t,e){return e}function Na(t,e=!0){for(var n=0;n<t.length;n++)fs(t[n],e)}function Fa(t,e,n,i,r,o=null){var s=t,a=new Map;if(!!(e&pn)){var l=t;s=Si?Ai(qo(l)):l.appendChild(Uo())}Si&&Ni();var c,u=null,d=mo((()=>{var t=n();return Fn(t)?t:null==t?[]:On(t)})),h=!0;function f(){m.fallback=u,function(t,e,n,i,r){var o,s,a,l,c,u=!!(i&mn),d=e.length,h=t.items,f=t.effect.first,p=null,m=[],v=[];if(u)for(c=0;c<d;c+=1){var g,y;if(a=r(e[c],c),!((l=h.get(a).e).f&ci))null===(g=l.nodes)||void 0===g||null===(g=g.a)||void 0===g||g.measure(),(null!==(y=s)&&void 0!==y?y:s=new Set).add(l)}for(c=0;c<d;c+=1){if(a=r(e[c],c),l=h.get(a).e,null!==t.outrogroups)for(const e of t.outrogroups)e.pending.delete(l),e.done.delete(l);if(l.f&ci){if(l.f^=ci,l!==f){var b=p?p.next:f;l===t.effect.last&&(t.effect.last=l.prev),l.prev&&(l.prev.next=l.next),l.next&&(l.next.prev=l.prev),Pa(t,p,l),Pa(t,l,b),Oa(l,b,n),m=[],v=[],f=(p=l).next;continue}Oa(l,null,n)}var k,x;if(l.f&ei)if(gs(l),u)null===(k=l.nodes)||void 0===k||null===(k=k.a)||void 0===k||k.unfix(),(null!==(x=s)&&void 0!==x?x:s=new Set).delete(l);if(l!==f){if(void 0!==o&&o.has(l)){if(m.length<v.length){var w,_=v[0];p=_.prev;var I=m[0],T=m[m.length-1];for(w=0;w<m.length;w+=1)Oa(m[w],_,n);for(w=0;w<v.length;w+=1)o.delete(v[w]);Pa(t,I.prev,T.next),Pa(t,p,I),Pa(t,T,_),f=_,p=T,c-=1,m=[],v=[]}else o.delete(l),Oa(l,f,n),Pa(t,l.prev,l.next),Pa(t,l,null===p?t.effect.first:p.next),Pa(t,p,l),p=l;continue}for(m=[],v=[];null!==f&&f!==l;){var E;(null!==(E=o)&&void 0!==E?E:o=new Set).add(f),v.push(f),f=f.next}if(null===f)continue}l.f&ci||m.push(l),p=l,f=l.next}if(null!==t.outrogroups){for(const e of t.outrogroups){var S;if(0===e.pending.size)Na(On(e.done)),null===(S=t.outrogroups)||void 0===S||S.delete(e)}0===t.outrogroups.size&&(t.outrogroups=null)}if(null!==f||void 0!==o){var M=[];if(void 0!==o)for(l of o)l.f&ei||M.push(l);for(;null!==f;)f.f&ei||f===t.fallback||M.push(f),f=f.next;var A=M.length;if(A>0){var N=i&pn&&0===d?n:null;if(u){for(c=0;c<A;c+=1){var F;null===(F=M[c].nodes)||void 0===F||null===(F=F.a)||void 0===F||F.measure()}for(c=0;c<A;c+=1){var C;null===(C=M[c].nodes)||void 0===C||null===(C=C.a)||void 0===C||C.fix()}}!function(t,e,n){for(var i,r=e.length,o=e.length,s=0;s<r;s++){let n=e[s];ms(n,(()=>{if(i){if(i.pending.delete(n),i.done.add(n),0===i.pending.size){var e=t.outrogroups;Na(On(i.done)),e.delete(i),0===e.size&&(t.outrogroups=null)}}else o-=1}),!1)}if(0===o){var a=null!==n;if(a){var l=n,c=l.parentNode;Xo(c),c.append(l),t.items.clear()}Na(e,!a)}else{var u;i={pending:new Set(e),done:new Set},(null!==(u=t.outrogroups)&&void 0!==u?u:t.outrogroups=new Set).add(i)}}(t,M,N)}}u&&Ji((()=>{if(void 0!==s)for(l of s){var t;null===(t=l.nodes)||void 0===t||null===(t=t.a)||void 0===t||t.apply()}}))}(m,c,s,e,i),null!==u&&(0===c.length?u.f&ci?(u.f^=ci,Oa(u,null,s)):gs(u):ms(u,(()=>{u=null})))}var p=ls((()=>{var t=(c=Gs(d)).length;let l=!1;Si&&(Oi(s)===_n!==(0===t)&&(Ai(s=Ci()),Mi(!1),l=!0));for(var p=new Set,m=0;m<t;m+=1){Si&&Ei.nodeType===ki&&Ei.data===In&&(s=Ei,l=!0,Mi(!1));var v,g=c[m],y=i(g,m),b=h?null:a.get(y);if(b)b.v&&Mo(b.v,g),b.i&&Mo(b.i,m);else b=Ca(a,h?s:null!==(v=Ea)&&void 0!==v?v:Ea=Uo(),g,y,m,r,e,n),h||(b.e.f|=ci),a.set(y,b);p.add(y)}0===t&&o&&!u&&(h?u=us((()=>o(s))):(u=us((()=>{var t;return o(null!==(t=Ea)&&void 0!==t?t:Ea=Uo())}))).f|=ci),Si&&t>0&&Ai(Ci()),h||f(),l&&Mi(!0),Gs(d)})),m={effect:p,items:a,outrogroups:null,fallback:u};h=!1,Si&&(s=Ei)}function Ca(t,e,n,i,r,o,s,a){var l=s&hn?s&vn?Io(n):Eo(n,!1,!1):null,c=s&fn?Io(r):null;return l&&(l.trace=()=>{var t;a()[null!==(t=null==c?void 0:c.v)&&void 0!==t?t:r]}),{v:l,i:c,e:us((()=>(o(e,null!=l?l:n,null!=c?c:r,a),()=>{t.delete(i)})))}}function Oa(t,e,n){if(t.nodes)for(var i=t.nodes.start,r=t.nodes.end,o=!e||e.f&ci?n:e.nodes.start;null!==i;){var s=Vo(i);if(o.before(i),i===r)return;i=s}}function Pa(t,e,n){null===e?t.effect.first=n:e.next=n,null===n?t.effect.last=e:n.prev=e}const Ra={tick:t=>requestAnimationFrame(t),now:()=>performance.now(),tasks:new Set};function Da(){const t=Ra.now();Ra.tasks.forEach((e=>{e.c(t)||(Ra.tasks.delete(e),e.f())})),0!==Ra.tasks.size&&Ra.tick(Da)}function Ba(t,e){Jo((()=>{t.dispatchEvent(new CustomEvent(e))}))}function La(t){if("float"===t)return"cssFloat";if("offset"===t)return"cssOffset";if(t.startsWith("--"))return t;const e=t.split("-");return 1===e.length?e[0]:e[0]+e.slice(1).map((t=>t[0].toUpperCase()+t.slice(1))).join("")}function za(t){const e={},n=t.split(";");for(const t of n){const[n,i]=t.split(":");if(!n||void 0===i)break;e[La(n.trim())]=i.trim()}return e}const Wa=t=>t;function ja(t,e,n,i){var r,o,s,a,l,c=!!(t&xn),u=e.inert,d=e.style.overflow;function h(){return Jo((()=>{var t,r;return null!==(t=s)&&void 0!==t?t:s=n()(e,null!==(r=null==i?void 0:i())&&void 0!==r?r:{},{direction:"both"})}))}var f={is_global:c,in(){e.inert=u,Ba(e,"introstart"),a=$a(e,h(),l,1,(()=>{var t;Ba(e,"introend"),null===(t=a)||void 0===t||t.abort(),a=s=void 0,e.style.overflow=d}))},out(t){e.inert=!0,Ba(e,"outrostart"),l=$a(e,h(),a,0,(()=>{Ba(e,"outroend"),null==t||t()}))},stop:()=>{var t,e;null===(t=a)||void 0===t||t.abort(),null===(e=l)||void 0===e||e.abort()}},p=Ss;if((null!==(o=(r=p.nodes).t)&&void 0!==o?o:r.t=[]).push(f),va){var m=c;if(!m){for(var v=p.parent;v&&v.f&ri;)for(;(v=v.parent)&&!(v.f&Hn););m=!v||!!(v.f&ii)}m&&os((()=>{Xs((()=>f.in()))}))}}function $a(t,e,n,i,r){var o=1===i;if("function"==typeof e){var s,a=!1;return Ji((()=>{if(!a){var l=e({direction:o?"in":"out"});s=$a(t,l,n,i,r)}})),{abort:()=>{var t;a=!0,null===(t=s)||void 0===t||t.abort()},deactivate:()=>s.deactivate(),reset:()=>s.reset(),t:()=>s.t()}}if(null==n||n.deactivate(),null==e||!e.duration)return r(),{abort:jn,deactivate:jn,reset:jn,t:()=>i};const{delay:l=0,css:c,tick:u,easing:d=Wa}=e;var h=[];if(o&&void 0===n&&(u&&u(0,1),c)){var f=za(c(0,1));h.push(f,f)}var p=()=>1-i,m=t.animate(h,{duration:l,fill:"forwards"});return m.onfinish=()=>{var o;m.cancel();var s=null!==(o=null==n?void 0:n.t())&&void 0!==o?o:1-i;null==n||n.abort();var a=i-s,l=e.duration*Math.abs(a),h=[];if(l>0){var f=!1;if(c)for(var v=Math.ceil(l/(1e3/60)),g=0;g<=v;g+=1){var y=s+a*d(g/v),b=za(c(y,1-y));h.push(b),f||(f="hidden"===b.overflow)}f&&(t.style.overflow="hidden"),p=()=>{var t=m.currentTime;return s+a*d(t/l)},u&&function(t){let e;0===Ra.tasks.size&&Ra.tick(Da),new Promise((n=>{Ra.tasks.add(e={c:t,f:n})}))}((()=>{if("running"!==m.playState)return!1;var t=p();return u(t,1-t),!0}))}(m=t.animate(h,{duration:l,fill:"forwards"})).onfinish=()=>{p=()=>i,null==u||u(i,1-i),r()}},{abort:()=>{m&&(m.cancel(),m.effect=null,m.onfinish=jn)},deactivate:()=>{r=jn},reset:()=>{0===i&&(null==u||u(1,0))},t:()=>p()}}function Ua(t,e){os((()=>{var n,i=t.getRootNode(),r=i.host?i:null!==(n=i.head)&&void 0!==n?n:i.ownerDocument.head;if(!r.querySelector("#"+e.hash)){const t=document.createElement("style");t.id=e.hash,t.textContent=e.code,r.appendChild(t),function(t,e){var n=Sa.get(t);n||(n=new Set,Sa.set(t,n)),n.add(e)}(e.hash,t)}}))}function qa(t,e){var n,i=void 0;cs((()=>{i!==(i=e())&&(n&&(fs(n),n=null),i&&(n=us((()=>{os((()=>i(t)))}))))}))}function Va(t){var e,n,i="";if("string"==typeof t||"number"==typeof t)i+=t;else if("object"==typeof t)if(Array.isArray(t)){var r=t.length;for(e=0;e<r;e++)t[e]&&(n=Va(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function Ga(t){return"object"==typeof t?function(){for(var t,e,n=0,i="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=Va(t))&&(i&&(i+=" "),i+=e);return i}(t):null!=t?t:""}const Ha=[..." \t\n\r\f \v\ufeff"];function Ka(t,e=!1){var n=e?" !important;":";",i="";for(var r in t){var o=t[r];null!=o&&""!==o&&(i+=" "+r+": "+o+n)}return i}function Xa(t){return"-"!==t[0]||"-"!==t[1]?t.toLowerCase():t}function Ya(t,e,n,i,r,o){var s=t.__className;if(Si||s!==n||void 0===s){var a=function(t,e,n){var i=null==t?"":""+t;if(e&&(i=i?i+" "+e:e),n)for(var r in n)if(n[r])i=i?i+" "+r:r;else if(i.length)for(var o=r.length,s=0;(s=i.indexOf(r,s))>=0;){var a=s+o;0!==s&&!Ha.includes(i[s-1])||a!==i.length&&!Ha.includes(i[a])?s=a:i=(0===s?"":i.substring(0,s))+i.substring(a+1)}return""===i?null:i}(n,i,o);Si&&a===t.getAttribute("class")||(null==a?t.removeAttribute("class"):e?t.className=a:t.setAttribute("class",a)),t.__className=n}else if(o&&r!==o)for(var l in o){var c=!!o[l];null!=r&&c===!!r[l]||t.classList.toggle(l,c)}return o}function Qa(t,e={},n,i){for(var r in n){var o=n[r];e[r]!==o&&(null==n[r]?t.style.removeProperty(r):t.style.setProperty(r,o,i))}}function Ja(t,e,n,i){var r=t.__style;if(Si||r!==e){var o=function(t,e){if(e){var n,i,r="";if(Array.isArray(e)?(n=e[0],i=e[1]):n=e,t){t=String(t).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var o=!1,s=0,a=!1,l=[];n&&l.push(...Object.keys(n).map(Xa)),i&&l.push(...Object.keys(i).map(Xa));var c=0,u=-1;const e=t.length;for(var d=0;d<e;d++){var h=t[d];if(a?"/"===h&&"*"===t[d-1]&&(a=!1):o?o===h&&(o=!1):"/"===h&&"*"===t[d+1]?a=!0:'"'===h||"'"===h?o=h:"("===h?s++:")"===h&&s--,!a&&!1===o&&0===s)if(":"===h&&-1===u)u=d;else if(";"===h||d===e-1){if(-1!==u){var f=Xa(t.substring(c,u).trim());l.includes(f)||(";"!==h&&d++,r+=" "+t.substring(c,d).trim()+";")}c=d+1,u=-1}}}return n&&(r+=Ka(n)),i&&(r+=Ka(i,!0)),""===(r=r.trim())?null:r}return null==t?null:String(t)}(e,i);Si&&o===t.getAttribute("style")||(null==o?t.removeAttribute("style"):t.style.cssText=o),t.__style=e}else i&&(Array.isArray(i)?(Qa(t,null==n?void 0:n[0],i[0]),Qa(t,null==n?void 0:n[1],i[1],"important")):Qa(t,n,i));return i}function Za(t,e,n=!1){if(t.multiple){if(null==e)return;if(!Fn(e))return void console.warn("%c[svelte] select_multiple_invalid_value\n%cThe `value` property of a `<select multiple>` element should be an array, but it received a non-array value. The selection will be kept as is.\nhttps://svelte.dev/e/select_multiple_invalid_value",wi,_i);for(var i of t.options)i.selected=e.includes(tl(i))}else{for(i of t.options){var r=tl(i);if(o=r,s=e,Object.is(Ro(o),Ro(s)))return void(i.selected=!0)}var o,s;n&&void 0===e||(t.selectedIndex=-1)}}function tl(t){return"__value"in t?t.__value:t.value}const el=Symbol("class"),nl=Symbol("style"),il=Symbol("is custom element"),rl=Symbol("is html");function ol(t){if(Si){var e=!1,n=()=>{if(!e){if(e=!0,t.hasAttribute("value")){var n=t.value;al(t,"value",null),t.value=n}if(t.hasAttribute("checked")){var i=t.checked;al(t,"checked",null),t.checked=i}}};t.__on_r=n,Ji(n),Qo||(Qo=!0,document.addEventListener("reset",(t=>{Promise.resolve().then((()=>{if(!t.defaultPrevented)for(const n of t.target.elements){var e;null===(e=n.__on_r)||void 0===e||e.call(n)}}))}),{capture:!0}))}}function sl(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function al(t,e,n,i){var r=cl(t);Si&&(r[e]=t.getAttribute(e),"src"===e||"srcset"===e||"href"===e&&"LINK"===t.nodeName)?i||function(t,e,n){var i;if("srcset"===e&&function(t,e){var n=fl(t.srcset),i=fl(e);return i.length===n.length&&i.every((([t,e],i)=>e===n[i][1]&&(hl(n[i][0],t)||hl(t,n[i][0]))))}(t,n))return;if(hl(null!==(i=t.getAttribute(e))&&void 0!==i?i:"",n))return;!function(t,e,n){console.warn(`%c[svelte] hydration_attribute_changed\n%cThe \`${t}\` attribute on \`${e}\` changed its value between server and client renders. The client value, \`${n}\`, will be ignored in favour of the server value\nhttps://svelte.dev/e/hydration_attribute_changed`,wi,_i)}(e,t.outerHTML.replace(t.innerHTML,t.innerHTML&&"..."),String(n))}(t,e,null!=n?n:""):r[e]!==(r[e]=n)&&("loading"===e&&(t[vi]=n),null==n?t.removeAttribute(e):"string"!=typeof n&&dl(t).includes(e)?t[e]=n:t.setAttribute(e,n))}function ll(t,e,n=[],i=[],r=[],o,s=!1,a=!1){lo(r,n,i,(n=>{var i=void 0,r={},l="SELECT"===t.nodeName,c=!1;if(cs((()=>{var u=e(...n.map(Gs)),d=function(t,e,n,i,r=!1,o=!1){if(Si&&r&&"INPUT"===t.tagName){var s=t;("checkbox"===s.type?"defaultChecked":"defaultValue")in n||ol(s)}var a=cl(t),l=a[il],c=!a[rl];let u=Si&&l;u&&Mi(!1);var d,h=e||{},f="OPTION"===t.tagName;for(var p in e)p in n||(n[p]=null);n.class?n.class=Ga(n.class):n.class=null,n[nl]&&(null!==(d=n.style)&&void 0!==d||(n.style=null));var m=dl(t);for(const r in n){let s=n[r];if(f&&"value"===r&&null==s)t.value=t.__value="",h[r]=s;else if("class"!==r)if("style"!==r){var v=h[r];if(s!==v||void 0===s&&t.hasAttribute(r)){h[r]=s;var g=r[0]+r[1];if("$$"!==g)if("on"===g){const e={},n="$$"+r;let i=r.slice(2);var y=ha(i);if(ua(i)&&(i=i.slice(0,-7),e.capture=!0),!y&&v){if(null!=s)continue;t.removeEventListener(i,h[n],e),h[n]=null}if(null!=s)if(y)t[`__${i}`]=s,ta([i]);else{let o=function(t){h[r].call(this,t)};h[n]=Js(i,t,o,e)}else y&&(t[`__${i}`]=void 0)}else if("style"===r)al(t,r,s);else if("autofocus"===r)Yo(t,Boolean(s));else if(l||"__value"!==r&&("value"!==r||null==s))if("selected"===r&&f)sl(t,s);else{var b=r;c||(b=pa(b));var k="defaultValue"===b||"defaultChecked"===b;if(null!=s||l||k)k||m.includes(b)&&(l||"string"!=typeof s)?(t[b]=s,b in a&&(a[b]=En)):"function"!=typeof s&&al(t,b,s,o);else if(a[r]=null,"value"===b||"checked"===b){let n=t;const i=void 0===e;if("value"===b){let t=n.defaultValue;n.removeAttribute(b),n.defaultValue=t,n.value=n.__value=i?t:null}else{let t=n.defaultChecked;n.removeAttribute(b),n.defaultChecked=t,n.checked=!!i&&t}}else t.removeAttribute(r)}else t.value=t.__value=s}}else Ja(t,s,null==e?void 0:e[nl],n[nl]),h[r]=s,h[nl]=n[nl];else Ya(t,"http://www.w3.org/1999/xhtml"===t.namespaceURI,s,i,null==e?void 0:e[el],n[el]),h[r]=s,h[el]=n[el]}return u&&Mi(!0),h}(t,i,u,o,s,a);c&&l&&"value"in u&&Za(t,u.value);for(let t of Object.getOwnPropertySymbols(r))u[t]||fs(r[t]);for(let e of Object.getOwnPropertySymbols(u)){var h=u[e];e.description!==An||i&&h===i[e]||(r[e]&&fs(r[e]),r[e]=us((()=>qa(t,(()=>h))))),d[e]=h}i=d})),l){var u=t;os((()=>{Za(u,i.value,!0),function(t){var e=new MutationObserver((()=>{Za(t,t.__value)}));e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),ns((()=>{e.disconnect()}))}(u)}))}c=!0}))}function cl(t){var e;return null!==(e=t.__attributes)&&void 0!==e?e:t.__attributes={[il]:t.nodeName.includes("-"),[rl]:t.namespaceURI===Mn}}var ul=new Map;function dl(t){var e,n=t.getAttribute("is")||t.nodeName,i=ul.get(n);if(i)return i;ul.set(n,i=[]);for(var r=t,o=Element.prototype;o!==r;){for(var s in e=Dn(r))e[s].set&&i.push(s);r=zn(r)}return i}function hl(t,e){return t===e||new URL(t,document.baseURI).href===new URL(e,document.baseURI).href}function fl(t){return t.split(",").map((t=>t.trim().split(" ").filter(Boolean)))}function pl(t,e){return t===e||(null==t?void 0:t[pi])===e}function ml(t={},e,n,i){return os((()=>{var i,r;return ss((()=>{i=r,r=[],Xs((()=>{t!==n(...r)&&(e(t,...r),i&&pl(n(...i),t)&&e(null,...i))}))})),()=>{Ji((()=>{r&&pl(n(...r),t)&&e(null,...r)}))}})),t}let vl=!1;function gl(t,e,n,i){var r,o,s=!!(n&bn),a=!!(n&kn),l=i,c=!0,u=()=>(c&&(c=!1,l=a?Xs(i):i),l);if(s){var d,h,f=pi in t||mi in t;r=null!==(d=null===(h=Rn(t,e))||void 0===h?void 0:h.set)&&void 0!==d?d:f&&e in t?n=>t[e]=n:void 0}var p,m=!1;if(s?[o,m]=function(t){var e=vl;try{return vl=!1,[t(),vl]}finally{vl=e}}((()=>t[e])):o=t[e],void 0===o&&void 0!==i&&(o=u(),r&&(!function(t){{const e=new Error(`props_invalid_value\nCannot do \`bind:${t}={undefined}\` when \`${t}\` has a fallback value\nhttps://svelte.dev/e/props_invalid_value`);throw e.name="Svelte error",e}}(e),r(o))),p=()=>{var n=t[e];return void 0===n?u():(c=!0,n)},!(n&yn))return p;if(r){var v=t.$$legacy;return function(t,e){return arguments.length>0?((!e||v||m)&&r(e?p():t),t):p()}}var g=!1,y=(n&gn?ho:mo)((()=>(g=!1,p())));y.label=e,s&&Gs(y);var b=Ss;return function(t,e){if(arguments.length>0){const n=e?Gs(y):s?Oo(t):t;return So(y,n),g=!0,void 0!==l&&(l=n),t}return ws&&g||b.f&ni?y.v:Gs(y)}}var yl,bl,kl,xl;"undefined"!=typeof window&&(null!==(bl=(yl=null!==(xl=(kl=window).__svelte)&&void 0!==xl?xl:kl.__svelte={}).v)&&void 0!==bl?bl:yl.v=new Set).add("5");function wl(t,{include:e,exclude:n}={}){const i=t=>{const i=e=>"string"==typeof e?t===e:e.test(t);return e?e.some(i):!n||!n.some(i)};for(const[e,n]of(t=>{const e=new Set;do{for(const n of Reflect.ownKeys(t))e.add([t,n])}while((t=Reflect.getPrototypeOf(t))&&t!==Object.prototype);return e})(t.constructor.prototype)){if("constructor"===n||!i(n))continue;const r=Reflect.getOwnPropertyDescriptor(e,n);r&&"function"==typeof r.value&&(t[n]=t[n].bind(t))}return t}function _l(t,e){t.getNodesAtTime(0)[0].once("nodestart",e)}class Il{constructor({position:t,gallery:e,config:n}){this.config=n,this.position=t,this.gallery=e,this.name=n.name;const{variantId:i,itemIndex:r,moduleIndex:o}=t;this.id=`${n.itemType}_${i}_${r}_${o}`,wl(this)}#a=Bi(To(Oo({})),"BaseModule.#state");#l=Bi(To(null),"BaseModule.#cover");#c=Bi(To(!1),"BaseModule.#showCover");#u=Bi(To(null),"BaseModule.#Component");id;player;position;config;timeline;moduleEndListener;hasDuration=!1;coverAssets=[];get state(){return Gs(this.#a)}set state(t){So(this.#a,t,!0)}get cover(){return Gs(this.#l)}set cover(t){So(this.#l,t)}get showCover(){return Gs(this.#c)}set showCover(t){So(this.#c,t,!0)}get Component(){return Gs(this.#u)}set Component(t){So(this.#u,t)}emitModuleEnd(){var t;null===(t=this.moduleEndListener)||void 0===t||t.call(this)}start(t){this.player=t}setPosition(){this.gallery.state.playingModulePosition=this.position}play(){this.gallery.track("moduleview"),this.timeline?(_l(this.timeline,(()=>{this.setPosition()})),this.player.switchTimeline(this.timeline)):this.setPosition()}get duration(){return this.hasDuration&&this.timeline?this.timeline.placements.reduce(((t,e)=>t+this.player.getNode(e.nodeId).duration),0):0}}const Tl="cmaf:";function El(t,e,n){var i,r,o;const s=(null==e||null===(i=e.entity)||void 0===i?void 0:i.entityId)||(null==e?void 0:e.assetId),a=null!==(r=null==e||null===(o=e.entity)||void 0===o?void 0:o.entityRevision)&&void 0!==r?r:null==e?void 0:e.assetRevision,l=function(t){return t&&t.find((t=>t.startsWith(Tl)))?t.filter((t=>t.startsWith(Tl))):t}(null==e?void 0:e.availableEncodeProfiles);return n.addNode({id:t,manifestRef:{type:"assets-delivery-service",assetId:s,assetRevision:a,availableEncodeProfiles:l}})}function Sl(t){const e=t-1;return e*e*e+1}var Ml=!1;function Al(t,{delay:e=0,duration:n=400,easing:i=Sl,axis:r="y"}={}){const o=getComputedStyle(t);var s;!Ml&&/(contents|inline|table)/.test(o.display)&&(Ml=!0,Promise.resolve().then((()=>Ml=!1)),s=o.display,console.warn(`%c[svelte] transition_slide_display\n%cThe \`slide\` transition does not work correctly for elements with \`display: ${s}\`\nhttps://svelte.dev/e/transition_slide_display`,wi,_i));const a=+o.opacity,l="y"===r?"height":"width",c=parseFloat(o[l]),u="y"===r?["top","bottom"]:["left","right"],d=u.map((t=>`${t[0].toUpperCase()}${t.slice(1)}`)),h=parseFloat(o[`padding${d[0]}`]),f=parseFloat(o[`padding${d[1]}`]),p=parseFloat(o[`margin${d[0]}`]),m=parseFloat(o[`margin${d[1]}`]),v=parseFloat(o[`border${d[0]}Width`]),g=parseFloat(o[`border${d[1]}Width`]);return{delay:e,duration:n,easing:i,css:t=>`overflow: hidden;opacity: ${Math.min(20*t,1)*a};${l}: ${t*c}px;padding-${u[0]}: ${t*h}px;padding-${u[1]}: ${t*f}px;margin-${u[0]}: ${t*p}px;margin-${u[1]}: ${t*m}px;border-${u[0]}-width: ${t*v}px;border-${u[1]}-width: ${t*g}px;min-${l}: 0`}}function Nl(t){const e=t-1;return e*e*e+1}var Fl=oa('<h3 class="text-box-title desktop-title svelte-wejicf"> </h3>'),Cl=oa('<h3 class="text-box-title svelte-wejicf"> </h3>'),Ol=oa('<div class="expanded-text-content svelte-wejicf"><!> <p class="text-box-description svelte-wejicf"> </p></div>'),Pl=oa('<span class="text-box-title svelte-wejicf"> </span>'),Rl=oa('<span class="text-box-description minimized-description svelte-wejicf"> </span>'),Dl=oa('<span class="read-more-cta svelte-wejicf" aria-hidden="true">Read more</span>'),Bl=oa('<button class="expand-description-button svelte-wejicf" aria-expanded="false" aria-controls="expanded-text-content" aria-label="Expand feature description"><!> <!></button>'),Ll=oa('<button class="collapse-description-button svelte-wejicf" aria-expanded="true" aria-label="Collapse feature description" data-elementid="textbox-expand" data-elementtype="textbox" data-elementname="Read less" data-interactiontype="module-ui">Read less</button>'),zl=oa('<section aria-label="Feature description" aria-live="polite"><div class="text-wrapper svelte-wejicf"><!> <!> <!></div> <!></section>');const Wl={hash:"svelte-wejicf",code:".eko-gallery-app {--textBox_bg: linear-gradient(\n rgba(255, 255, 255, 0) 0%,\n rgba(255, 255, 255, 0.9) 27.79%,\n rgba(255, 255, 255, 0.95) 100%\n );--textBox_border: 0;--textBox_borderRadius: 0;--textBox_maxWidth: 100%;--textBox_margin: 0;--textBox_padding: 16px 16px 64px 16px;--textBox_padding_mobile: 8px 16px;--textBox_gap: 8px;--textBox_expandedContent_gap: 8px;--textBox_expandButton_gap: 6px;--textBox_button_color: #014FD3;--textBox_button_fontSize: 12px;--textBox_button_fontWeight: 500;--textBox_button_lineHeight: 18px;--textBox_button_lineHeight_mobile: 12px;--textBox_button_letterSpacing: 0;--textBox_collapse_marginBottom: 8px;}.step-description-container.svelte-wejicf {width:100%;max-width:var(--textBox_maxWidth);margin:var(--textBox_margin);position:absolute;bottom:0;display:flex;justify-content:space-between;gap:var(--textBox_gap);box-sizing:border-box;padding:var(--textBox_padding);font-family:var(--textBox_fontFamily, var(--fontName));font-size:var(--textBox_fontSize, 12px);font-weight:var(--textBox_fontWeight, 400);font-style:var(--textBox_fontStyle, normal);line-height:var(--textBox_lineHeight, 18px);letter-spacing:var(--textBox_letterSpacing, 0);color:var(--textBox_color, #030303);overflow:hidden;pointer-events:none;background:var(--textBox_bg);border:var(--textBox_border);border-radius:var(--textBox_borderRadius);}.step-description-container.mobile.svelte-wejicf {padding:var(--textBox_padding_mobile);line-height:var(--textBox_lineHeight_mobile, 16px);}.step-description-container.expanded.svelte-wejicf {flex-direction:column;justify-content:flex-start;gap:0;}.expanded-text-content.svelte-wejicf:not([hidden]) {display:flex;flex-direction:column;gap:var(--textBox_expandedContent_gap);}button.svelte-wejicf {background:none;border:none;padding:0;cursor:pointer;font-family:var(--textBox_fontFamily, var(--fontName));font-size:var(--textBox_button_fontSize, 12px);font-weight:var(--textBox_button_fontWeight, 500);line-height:var(--textBox_button_lineHeight, 18px);letter-spacing:var(--textBox_button_letterSpacing, 0);color:var(--textBox_button_color, #014FD3);gap:var(--textBox_expandButton_gap, 6px);flex-shrink:0;text-align:left;pointer-events:auto;}.step-description-container.mobile.svelte-wejicf button:where(.svelte-wejicf) {line-height:var(--textBox_button_lineHeight_mobile);}.collapse-description-button.svelte-wejicf {margin-top:var(--textBox_gap);margin-bottom:var(--textBox_collapse_marginBottom);}.step-description-container.mobile.svelte-wejicf .collapse-description-button:where(.svelte-wejicf) {margin-bottom:0;}.text-wrapper.svelte-wejicf {width:100%;display:flex;flex-direction:column;}.text-box-title.svelte-wejicf {margin:0;font-family:var(--textBox_title_fontFamily, var(--textBox_fontFamily, var(--fontName)));font-size:var(--textBox_title_fontSize, var(--textBox_fontSize, 12px));font-weight:var(--textBox_title_fontWeight, 500);color:var(--textBox_title_color, var(--textBox_color, #030303));}.text-box-title.desktop-title.svelte-wejicf {display:var(--textBox_desktop_title_display, none);margin-bottom:var(--textBox_expandedContent_gap);}.text-box-description.svelte-wejicf {margin:0;font-family:var(--textBox_description_fontFamily, var(--textBox_fontFamily, var(--fontName)));font-size:var(--textBox_description_fontSize, var(--textBox_fontSize, 12px));font-weight:var(--textBox_description_fontWeight, var(--textBox_fontWeight, 400));color:var(--textBox_description_color, var(--textBox_color, #030303));text-align:var(--textBox_description_textAlign, left);}.minimized-description.svelte-wejicf {overflow:hidden;line-clamp:1;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;font-weight:var(--textBox_description_fontWeight, var(--textBox_fontWeight, 400));}.expand-description-button.svelte-wejicf {width:100%;display:flex;justify-content:space-between;gap:var(--textBox_expandButton_gap);flex-wrap:nowrap;}.expand-description-button.svelte-wejicf .read-more-cta:where(.svelte-wejicf) {color:var(--textBox_button_color, #014FD3);flex-shrink:0;}"};function jl(t,e){Hi(e,!0),Ua(t,Wl);let n=gl(e,"textBox",3,null),i=gl(e,"isMobile",3,!1);const r={duration:300,easing:Nl};let o=To(!1),s=To(null),a=To(null),l=To(!1),c=To(!1),u=po((()=>{var t;return(null===(t=n())||void 0===t?void 0:t.title)||""})),d=po((()=>{var t;return(null===(t=n())||void 0===t?void 0:t.description)||""})),h=po((()=>{var t,e;return[(null===(t=n())||void 0===t?void 0:t.textColor)&&`--textBox_textColor: ${n().textColor}`,(null===(e=n())||void 0===e?void 0:e.bgColor)&&`--textBox_bgColor: ${n().bgColor}`].filter(Boolean).join("; ")}));function f(){Gs(s)&&So(l,Gs(s).scrollWidth>Gs(s).clientWidth||Gs(s).scrollHeight>Gs(s).clientHeight,!0)}is((()=>{var t;Gs(s)&&(f(),"undefined"!=typeof document&&null!==(t=document.fonts)&&void 0!==t&&t.ready&&document.fonts.ready.then(f))})),is((()=>{if(Gs(a)){const t=getComputedStyle(Gs(a)).getPropertyValue("--textBox_forceCollapse").trim();So(c,"1"===t||"true"===t,!0)}}));var p=la();Zs("resize",Lo,f);var m=Ho(p),v=t=>{var n=zl();let f;var p=Go(n),m=Go(p),v=t=>{var e=Fl(),n=Go(e,!0);Fi(e),as((()=>ga(n,Gs(u)))),ca(t,e)};Ma(m,(t=>{Gs(u)&&!i()&&t(v)}));var g=Ko(m,2),y=t=>{var e=Ol(),n=Go(e),o=t=>{var e=Cl(),n=Go(e,!0);Fi(e),as((()=>ga(n,Gs(u)))),ca(t,e)};Ma(n,(t=>{Gs(u)&&i()&&t(o)}));var s=Ko(n,2),a=Go(s,!0);Fi(s),Fi(e),as((()=>ga(a,Gs(d)))),ja(3,e,(()=>Al),(()=>r)),ca(t,e)};Ma(g,(t=>{Gs(o)&&t(y)}));var b=Ko(g,2),k=t=>{var n=Bl(),a=po((()=>e.gallery.interaction((()=>So(o,!0)),{elementid:"textbox-expand",elementtype:"textbox",elementname:"Read more",interactiontype:"module-ui"})));n.__click=function(...t){var e;null===(e=Gs(a))||void 0===e||e.apply(this,t)};var h=Go(n),f=t=>{var e=Pl(),n=Go(e,!0);Fi(e),as((()=>ga(n,Gs(u)))),ca(t,e)},p=t=>{var e=Rl(),n=Go(e,!0);Fi(e),ml(e,(t=>So(s,t)),(()=>Gs(s))),as((()=>ga(n,Gs(d)))),ca(t,e)};Ma(h,(t=>{i()&&Gs(u)?t(f):t(p,!1)}));var m=Ko(h,2),v=t=>{ca(t,Dl())};Ma(m,(t=>{(i()||Gs(l)||Gs(c))&&t(v)})),Fi(n),ja(3,n,(()=>Al),(()=>r)),ca(t,n)};Ma(b,(t=>{Gs(o)||t(k)})),Fi(p);var x=Ko(p,2),w=t=>{var n=Ll(),i=po((()=>e.gallery.interaction((()=>So(o,!1)))));n.__click=function(...t){var e;null===(e=Gs(i))||void 0===e||e.apply(this,t)},ja(3,n,(()=>Al),(()=>r)),ca(t,n)};Ma(x,(t=>{Gs(o)&&t(w)})),Fi(n),ml(n,(t=>So(a,t)),(()=>Gs(a))),as((()=>{f=Ya(n,1,"step-description-container svelte-wejicf",null,f,{mobile:i(),expanded:Gs(o)}),Ja(n,Gs(h))})),ca(t,n)};Ma(m,(t=>{(Gs(u)||Gs(d))&&t(v)})),ca(t,p),Ki()}function $l(t,e){const n=po((()=>e.state.textBox));jl(t,{get textBox(){return Gs(n)},get isMobile(){return e.isMobile},get gallery(){return e.gallery}})}ta(["click"]);const Ul=new Set;function ql(t){if("undefined"!=typeof window)for(const e of t)if(!Ul.has(e)){const t=new Image;t.src=e,window[e]=t,Ul.add(e)}}var Vl=new WeakSet;class Gl extends Il{constructor({config:t,...e}){super({...e,config:t}),$(this,Vl),this.synced=t.sync,this.startOnLoop=t.startOnLoop,this.switchTo=()=>{},wl(this);const n=t[this.constructor.itemsKey];this.coverAssets=n.flatMap((t=>[t.intro,t.video])).filter(Boolean),this.itemsCovers=n.map((t=>({intro:t.intro||t.video,loop:t.video}))),this.cover=this.getCorrectCover(this.itemsCovers[0]),this.state={items:n.map((t=>this.mapItem(t))),currentIndex:0,onItemClicked:B(Vl,this,Hl).bind(this),textBox:n[0].textBox}}getCorrectCover(t){return this.synced||this.startOnLoop?t.loop:t.intro}mapItem(t){return t}start(t){super.start(t);const e=this.config[this.constructor.itemsKey],{nodePrefix:n}=this.constructor;this.synced?(this.timeline=t.createTimeline(),e.forEach(((e,i)=>{this.timeline.placeOnTimeline(El(`${this.id}_${n}_${i}`,e.video,t),0,{loop:!0})})),this.timeline.placeRenderNodeOnTimeline("switch",0,1/0,{params:{switchCrossfadeSeconds:.25,initSwitching:({switchTo:t})=>{this.switchTo=t,t(this.state.currentIndex,{crossfadeSeconds:0})}}})):(this.timelines=e.map(((e,i)=>{const r=t.createTimeline(),o=t.createTimeline(),s=El(`${this.id}_${n}_${i}`,e.video,t);return e.intro&&r.placeOnTimeline(El(`${this.id}_${n}_${i}_intro`,e.intro,t)),r.placeOnTimeline(s,"end",{loop:!0}),o.placeOnTimeline(s,0,{loop:!0}),{withIntro:r,justLoop:o}})),this.timeline=this.timelines[this.state.currentIndex][this.startOnLoop?"justLoop":"withIntro"])}play(){if(super.play(),!this.synced){ql(this.coverAssets.filter((t=>Bo(t,this.cover,!1))).map((t=>this.gallery.getCoverUrl(t,1920))))}}}function Hl(t){if(Bo(t,this.state.currentIndex))return;const e=this.config[this.constructor.itemsKey];var n,i;(this.state.currentIndex=t,this.state.textBox=e[t].textBox,this.synced)?(this.cover=this.itemsCovers[t].loop,this.switchTo(t)):(this.cover=this.itemsCovers[t].intro,this.timeline=null===(n=this.timelines)||void 0===n?void 0:n[t].withIntro,this.showCover=!0,_l(this.timeline,(()=>{var e;(this.showCover=!1,this.startOnLoop)&&(this.cover=this.itemsCovers[t].loop,this.timeline=null===(e=this.timelines)||void 0===e?void 0:e[t].justLoop)})),null===(i=this.player)||void 0===i||i.switchTimeline(this.timeline))}U(Gl,"itemsKey","items"),U(Gl,"nodePrefix","item");var Kl=oa('<div class="toggle-option-container svelte-16pmvvn"><button data-elementtype="toggle" data-interactiontype="module-ui"> </button></div>'),Xl=oa('<div class="toggle-container svelte-16pmvvn"><div></div></div> <!>',1);const Yl={hash:"svelte-16pmvvn",code:".eko-gallery-app {--toggleModule_gap: 8px;--toggleModule_padding: 10px 58px 0 0;--toggleModule_alignItems: center;--toggleModule_justifyContent: end;--toggleModule_options_padding: 0;--toggleModule_options_height: auto;--toggleModule_options_width: 100%;--toggleModule_options_maxWidth: 100%;--toggleModule_options_gap: 8px;--toggleModule_options_bgColor: transparent;--toggleModule_options_border: 0;--toggleModule_options_borderRadius: 0;--toggleModule_options_boxShadow: none;--toggleModule_options_alignItems: stretch;--toggleModule_button_padding: 8px 12px;--toggleModule_button_border: #E4E5E8 solid 1px;--toggleModule_button_borderRadius: 100px;--toggleModule_button_bgColor: #FBFBFB;--toggleModule_button_bgColor_hover: #F3F4F6;--toggleModule_button_bgColor_active: #E4E5E8;--toggleModule_button_boxShadow: 0px 2px 8px 2px rgba(0, 0, 0, 0.07);--toggleModule_button_text_fontFamily: var(--fontName);--toggleModule_button_text_fontSize: 12px;--toggleModule_button_text_fontWeight: 400;--toggleModule_button_text_fontStyle: normal;--toggleModule_button_text_lineHeight: 16px;--toggleModule_button_text_letterSpacing: -0.2px;--toggleModule_button_text_color: #000;--toggleModule_button_selected_bgColor: #014FD3;--toggleModule_button_selected_borderColor: #014FD3;--toggleModule_button_selected_boxShadow: none;--toggleModule_button_selected_text_color: #FFFFFF;--toggleModule_button_selected_text_fontWeight: var(--toggleModule_button_text_fontWeight);--toggleModule_title_fontFamily: var(--fontName);--toggleModule_title_fontSize: 13px;--toggleModule_title_fontWeight: 400;--toggleModule_title_fontStyle: normal;--toggleModule_title_lineHeight: 120%;--toggleModule_title_letterSpacing: 0;--toggleModule_title_color: #666;--toggleModule_title_textAlignment: center;--toggleModule_note_fontFamily: var(--fontName);--toggleModule_note_fontSize: 12px;--toggleModule_note_fontWeight: 400;--toggleModule_note_fontStyle: normal;--toggleModule_note_lineHeight: 120%;--toggleModule_note_letterSpacing: 0;--toggleModule_note_color: #888;--toggleModule_note_topMargin: 4px;}.toggle-container.svelte-16pmvvn {position:absolute;top:0;padding:var(--toggleModule_padding);width:100%;display:flex;flex-direction:column;align-items:var(--toggleModule_alignItems);gap:var(--toggleModule_gap);pointer-events:auto;box-sizing:border-box;}.toggle-options.svelte-16pmvvn {width:var(--toggleModule_options_width);max-width:var(--toggleModule_options_maxWidth);height:var(--toggleModule_options_height);padding:var(--toggleModule_options_padding);gap:var(--toggleModule_options_gap);background-color:var(--toggleModule_options_bgColor);border:var(--toggleModule_options_border);border-radius:var(--toggleModule_options_borderRadius);box-shadow:var(--toggleModule_options_boxShadow);display:flex;justify-content:var(--toggleModule_justifyContent);align-items:var(--toggleModule_options_alignItems);margin:0;}.toggle-option-container.svelte-16pmvvn {position:relative;min-width:0;}.toggle-option-button.svelte-16pmvvn {border-radius:var(--toggleModule_button_borderRadius);font-family:var(--toggleModule_button_text_fontFamily);font-size:var(--toggleModule_button_text_fontSize);font-weight:var(--toggleModule_button_text_fontWeight);font-style:var(--toggleModule_button_text_fontStyle);line-height:var(--toggleModule_button_text_lineHeight);letter-spacing:var(--toggleModule_button_text_letterSpacing);color:var(--toggleModule_button_text_color);padding:var(--toggleModule_button_padding);border:var(--toggleModule_button_border);background:var(--toggleModule_button_bgColor);box-shadow:var(--toggleModule_button_boxShadow);display:flex;width:100%;height:100%;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;cursor:pointer;position:relative;transition:all 0.3s ease-in-out;animation-duration:0.5s;animation-timing-function:cubic-bezier(0.36, 0, 0, 1);animation-fill-mode:both;animation-delay:calc(var(--button-index) * 90ms);\n animation-name: svelte-16pmvvn-button-back-appear-anim;transform-origin:bottom center;}.toggle-option-button.selected.svelte-16pmvvn {background:var(--toggleModule_button_selected_bgColor);border-color:var(--toggleModule_button_selected_borderColor);box-shadow:var(--toggleModule_button_selected_boxShadow);color:var(--toggleModule_button_selected_text_color);font-weight:var(--toggleModule_button_selected_text_fontWeight);}.toggle-option-button.svelte-16pmvvn:hover:not(.selected) {background:var(--toggleModule_button_bgColor_hover);}.toggle-option-button.svelte-16pmvvn:active:not(.selected) {background:var(--toggleModule_button_bgColor_active);}.toggle-option-button.svelte-16pmvvn:focus {outline-offset:4px;outline-width:2px;}\n\n@keyframes svelte-16pmvvn-button-back-appear-anim {\n from {\n transform: scale(0);\n }\n to {\n transform: scale(1);\n }\n}\n@keyframes svelte-16pmvvn-optionNoteIn {\n 0% {\n opacity: 0;\n translate: -50% -5px;\n }\n 100% {\n opacity: 1;\n translate: -50% var(--toggleModule_note_topMargin);\n }\n}"};function Ql(t,e){Hi(e,!0),Ua(t,Yl);const n=po((()=>e.state.items)),i=po((()=>e.state.currentIndex)),r=po((()=>e.state.onItemClicked)),o=po((()=>e.state.textBox));var s=Xl(),a=Ho(s),l=Go(a);Fa(l,21,(()=>Gs(n)),Aa,((t,n,o)=>{var s=Kl();Ja(s,`--button-index: ${o};`);var a=Go(s);let l;var c=po((()=>e.gallery.interaction((()=>Gs(r)(o)))));a.__click=function(...t){var e;null===(e=Gs(c))||void 0===e||e.apply(this,t)},al(a,"data-elementid",`${o+1}`);var u=Go(a,!0);Fi(a),Fi(s),as((()=>{l=Ya(a,1,"toggle-option-button svelte-16pmvvn",null,l,{selected:Gs(i)===o}),al(a,"data-elementname",Gs(n).label),ga(u,Gs(n).label)})),ca(t,s)})),Fi(l),Fi(a);var c=Ko(a,2),u=t=>{jl(t,{get textBox(){return Gs(o)},get isMobile(){return e.isMobile},get gallery(){return e.gallery}})};Ma(c,(t=>{Gs(o)&&t(u)})),as((()=>{var t;return Ya(l,1,`toggle-options selected-${null!==(t=Gs(i))&&void 0!==t?t:""}`,"svelte-16pmvvn")})),ca(t,s),Ki()}ta(["click"]);var Jl=oa('<div class="mode-title svelte-1650wj7"> </div>'),Zl=oa('<div class="mode-description svelte-1650wj7"> </div>'),tc=oa('<button data-elementtype="mode" data-interactiontype="module-ui"><img class="svelte-1650wj7"/> <div class="svelte-1650wj7"><!> <!></div></button>'),ec=oa('<div class="modes-container svelte-1650wj7"></div> <!>',1);const nc={hash:"svelte-1650wj7",code:".eko-gallery-app {--modesModule_gap: 16px;--modesModule_width: 100%;--modesModule_top: unset;--modesModule_left: 0;--modesModule_right: unset;--modesModule_bottom: 0;--modesModule_flexDirection: row;--modesModule_alignItems: flex-start;--modesModule_justifyContent: center;--modesModule_padding: 0 0 32px 0;--modesModule_paddingWithSteps: 0 0 48px 0;--modesModule_paddingWithTextBox: 28px 0 0 0;--modesModule_background: none;--modesModule_border: none;--modesModule_borderRadius: 0;--modesModule_transform: none;--modesModule_mode_width: 64px;--modesModule_mode_titleGap: 6px;--modesModule_mode_title_fontFamily: var(--fontName);--modesModule_mode_title_fontSize: 12px;--modesModule_mode_title_fontWeight: 500;--modesModule_mode_title_lineHeight: 120%;--modesModule_mode_title_letterSpacing: -0.2px;--modesModule_mode_title_textAlign: center;--modesModule_mode_description_fontFamily: var(--fontName);--modesModule_mode_description_fontSize: 11px;--modesModule_mode_description_fontWeight: 400;--modesModule_mode_description_lineHeight: 120%;--modesModule_mode_description_letterSpacing: -0.2px;--modesModule_mode_description_textAlign: center;--modesModule_mode_image_strokeSize: 2px;}.modes-container.svelte-1650wj7 {position:absolute;top:var(--modesModule_top);left:var(--modesModule_left);right:var(--modesModule_right);bottom:var(--modesModule_bottom);width:var(--modesModule_width);display:flex;flex-direction:var(--modesModule_flexDirection);align-items:var(--modesModule_alignItems);justify-content:var(--modesModule_justifyContent);gap:var(--modesModule_gap);flex-wrap:wrap;padding:var(--modesModule_padding);background:var(--modesModule_background);border:var(--modesModule_border);border-radius:var(--modesModule_borderRadius);transform:var(--modesModule_transform);}.mode-button.svelte-1650wj7 {display:flex;flex-direction:column;align-items:center;width:var(--modesModule_mode_width);background:none;border:none;padding:0;pointer-events:auto;cursor:pointer;color:rgba(var(--unselectedColor, 111, 111, 111), 1);gap:var(--modesModule_mode_titleGap);flex-shrink:0;}.mode-button.svelte-1650wj7 .mode-title:where(.svelte-1650wj7) {font-family:var(--modesModule_mode_title_fontFamily);font-size:var(--modesModule_mode_title_fontSize);font-weight:var(--modesModule_mode_title_fontWeight);line-height:var(--modesModule_mode_title_lineHeight);letter-spacing:var(--modesModule_mode_title_letterSpacing);text-align:var(--modesModule_mode_title_textAlign);}.mode-button.svelte-1650wj7 .mode-description:where(.svelte-1650wj7) {font-family:var(--modesModule_mode_description_fontFamily);font-size:var(--modesModule_mode_description_fontSize);font-weight:var(--modesModule_mode_description_fontWeight);line-height:var(--modesModule_mode_description_lineHeight);letter-spacing:var(--modesModule_mode_description_letterSpacing);text-align:var(--modesModule_mode_description_textAlign);}.mode-button.svelte-1650wj7 div:where(.svelte-1650wj7) {width:100%;}.mode-button.svelte-1650wj7 img:where(.svelte-1650wj7) {width:100%;aspect-ratio:1;object-fit:cover;border-radius:100%;box-shadow:0 0 0 var(--modesModule_mode_image_strokeSize) rgba(var(--unselectedColor, 111, 111, 111), 0.15);background-color:rgba(var(--unselectedColor, 111, 111, 111), 0.15);pointer-events:none;}.mode-button.selected.svelte-1650wj7 {color:var(--selectedColor, #000000);}.mode-button.selected.svelte-1650wj7 img:where(.svelte-1650wj7) {background-color:var(--selectedColor, #000000);box-shadow:0 0 0 var(--modesModule_mode_image_strokeSize) var(--selectedColor, #000000);}"};function ic(t,e){Hi(e,!0),Ua(t,nc);const n=po((()=>e.state.items)),i=po((()=>e.state.currentIndex)),r=po((()=>e.state.onItemClicked)),o=po((()=>e.state.textBox));var s=ec(),a=Ho(s);Fa(a,21,(()=>Gs(n)),Aa,((t,n,o)=>{var s=tc();let a;var l=po((()=>e.gallery.interaction((()=>Gs(r)(o)))));s.__click=function(...t){var e;null===(e=Gs(l))||void 0===e||e.apply(this,t)},al(s,"data-elementid",`${o+1}`);var c=Go(s);al(c,"alt",`Mode ${o+1}`);var u=Ko(c,2),d=Go(u),h=t=>{var e=Jl(),i=Go(e,!0);Fi(e),as((()=>ga(i,Gs(n).title))),ca(t,e)};Ma(d,(t=>{Gs(n).title&&t(h)}));var f=Ko(d,2),p=t=>{var e=Zl(),i=Go(e,!0);Fi(e),as((()=>ga(i,Gs(n).description))),ca(t,e)};Ma(f,(t=>{Gs(n).description&&t(p)})),Fi(u),Fi(s),as((t=>{a=Ya(s,1,"mode-button svelte-1650wj7",null,a,{selected:Gs(i)===o}),al(s,"data-elementname",Gs(n).title||`mode-${o+1}`),al(c,"src",t)}),[()=>e.gallery.getCoverUrl(Gs(n).image,375)]),ca(t,s)})),Fi(a);var l=Ko(a,2),c=t=>{jl(t,{get textBox(){return Gs(o)},get isMobile(){return e.isMobile},get gallery(){return e.gallery}})};Ma(l,(t=>{Gs(o)&&t(c)})),ca(t,s),Ki()}ta(["click"]);const rc=(t,e,n)=>n>e?e:n<t?t:n;function oc(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let sc=()=>{},ac=()=>{};function lc(t){let e;return()=>(void 0===e&&(e=t()),e)}"undefined"!=typeof process&&"production"!==(null===(fe=process.env)||void 0===fe?void 0:fe.NODE_ENV)&&(sc=(t,e,n)=>{t||"undefined"==typeof console||console.warn(oc(e,n))},ac=(t,e,n)=>{if(!t)throw new Error(oc(e,n))});const cc=t=>t,uc=t=>1e3*t,dc=t=>t/1e3;const hc=t=>Array.isArray(t)&&"number"==typeof t[0],fc=(t,e,n=10)=>{let i="";const r=Math.max(Math.round(e/n),2);for(let e=0;e<r;e++)i+=Math.round(1e4*t(e/(r-1)))/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},pc=2e4;function mc(t){let e=0;let n=t.next(e);for(;!n.done&&e<pc;)e+=50,n=t.next(e);return e>=pc?1/0:e}const vc=5;const gc={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},yc=.001;function bc({duration:t=gc.duration,bounce:e=gc.bounce,velocity:n=gc.velocity,mass:i=gc.mass}){let r,o;sc(t<=uc(gc.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let s=1-e;s=rc(gc.minDamping,gc.maxDamping,s),t=rc(gc.minDuration,gc.maxDuration,dc(t)),s<1?(r=e=>{const i=e*s,r=i*t,o=i-n,a=xc(e,s),l=Math.exp(-r);return yc-o/a*l},o=e=>{const i=e*s*t,o=i*n+n,a=Math.pow(s,2)*Math.pow(e,2)*t,l=Math.exp(-i),c=xc(Math.pow(e,2),s);return(-r(e)+yc>0?-1:1)*((o-a)*l)/c}):(r=e=>Math.exp(-e*t)*((e-n)*t+1)-yc,o=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let i=n;for(let n=1;n<kc;n++)i-=t(i)/e(i);return i}(r,o,5/t);if(t=uc(t),isNaN(a))return{stiffness:gc.stiffness,damping:gc.damping,duration:t};{const e=Math.pow(a,2)*i;return{stiffness:e,damping:2*s*Math.sqrt(i*e),duration:t}}}const kc=12;function xc(t,e){return t*Math.sqrt(1-e*e)}const wc=["duration","bounce"],_c=["stiffness","damping","mass"];function Ic(t,e){return e.some((e=>void 0!==t[e]))}function Tc(t=gc.visualDuration,e=gc.bounce){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:i,restDelta:r}=n;const o=n.keyframes[0],s=n.keyframes[n.keyframes.length-1],a={done:!1,value:o},{stiffness:l,damping:c,mass:u,duration:d,velocity:h,isResolvedFromDuration:f}=function(t){let e={velocity:gc.velocity,stiffness:gc.stiffness,damping:gc.damping,mass:gc.mass,isResolvedFromDuration:!1,...t};if(!Ic(t,_c)&&Ic(t,wc))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(1.2*n),r=i*i,o=2*rc(.05,1,1-(t.bounce||0))*Math.sqrt(r);e={...e,mass:gc.mass,stiffness:r,damping:o}}else{const n=bc(t);e={...e,...n,mass:gc.mass},e.isResolvedFromDuration=!0}return e}({...n,velocity:-dc(n.velocity||0)}),p=h||0,m=c/(2*Math.sqrt(l*u)),v=s-o,g=dc(Math.sqrt(l/u)),y=Math.abs(v)<5;let b;if(i||(i=y?gc.restSpeed.granular:gc.restSpeed.default),r||(r=y?gc.restDelta.granular:gc.restDelta.default),m<1){const t=xc(g,m);b=e=>{const n=Math.exp(-m*g*e);return s-n*((p+m*g*v)/t*Math.sin(t*e)+v*Math.cos(t*e))}}else if(1===m)b=t=>s-Math.exp(-g*t)*(v+(p+g*v)*t);else{const t=g*Math.sqrt(m*m-1);b=e=>{const n=Math.exp(-m*g*e),i=Math.min(t*e,300);return s-n*((p+m*g*v)*Math.sinh(i)+t*v*Math.cosh(i))/t}}const k={calculatedDuration:f&&d||null,next:t=>{const e=b(t);if(f)a.done=t>=d;else{let n=0===t?p:0;m<1&&(n=0===t?uc(p):function(t,e,n){const i=Math.max(e-vc,0);return r=n-t(i),(o=e-i)?r*(1e3/o):0;var r,o}(b,t,e));const o=Math.abs(n)<=i,l=Math.abs(s-e)<=r;a.done=o&&l}return a.value=a.done?s:e,a},toString:()=>{const t=Math.min(mc(k),pc),e=fc((e=>k.next(t*e).value),t,30);return t+"ms "+e},toTransition:()=>{}};return k}Tc.applyToOptions=t=>{const e=function(t,e=100,n){const i=n({...t,keyframes:[0,e]}),r=Math.min(mc(i),pc);return{type:"keyframes",ease:t=>i.next(r*t).value/e,duration:dc(r)}}(t,100,Tc);return t.ease=e.ease,t.duration=uc(e.duration),t.type="keyframes",t};const Ec=t=>null!==t;class Sc{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise((t=>{this.resolve=t}))}notifyFinished(){this.resolve()}then(t,e){return this.finished.then(t,e)}}function Mc(t){for(let n=1;n<t.length;n++){var e;null!==(e=t[n])&&void 0!==e||(t[n]=t[n-1])}}const Ac=t=>t.startsWith("--");const Nc=lc((()=>void 0!==window.ScrollTimeline)),Fc={};function Cc(t,e){const n=lc(t);return()=>{var t;return null!==(t=Fc[e])&&void 0!==t?t:n()}}const Oc=Cc((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing"),Pc=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,Rc={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Pc([0,.65,.55,1]),circOut:Pc([.55,0,1,.45]),backIn:Pc([.31,.01,.66,-.59]),backOut:Pc([.33,1.53,.69,.99])};function Dc(t,e){return t?"function"==typeof t?Oc()?fc(t,e):"ease-out":hc(t)?Pc(t):Array.isArray(t)?t.map((t=>Dc(t,e)||Rc.easeOut)):Rc[t]:void 0}function Bc(t,e,n,{delay:i=0,duration:r=300,repeat:o=0,repeatType:s="loop",ease:a="easeOut",times:l}={},c=void 0){const u={[e]:n};l&&(u.offset=l);const d=Dc(a,r);Array.isArray(d)&&(u.easing=d);const h={delay:i,duration:r,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:o+1,direction:"reverse"===s?"alternate":"normal"};c&&(h.pseudoElement=c);return t.animate(u,h)}class Lc extends Sc{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:e,name:n,keyframes:i,pseudoElement:r,allowFlatten:o=!1,finalKeyframe:s,onComplete:a}=t;this.isPseudoElement=Boolean(r),this.allowFlatten=o,this.options=t,ac("string"!=typeof t.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:t,...e}){return function(t){return"function"==typeof t&&"applyToOptions"in t}(t)&&Oc()?t.applyToOptions(e):(null!==(n=e.duration)&&void 0!==n||(e.duration=300),null!==(i=e.ease)&&void 0!==i||(e.ease="easeOut"),e);var n,i}(t);this.animation=Bc(e,n,i,l,r),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!r){const t=function(t,{repeat:e,repeatType:n="loop"},i,r=1){const o=t.filter(Ec),s=r<0||e&&"loop"!==n&&e%2==1?0:o.length-1;return s&&void 0!==i?i:o[s]}(i,this.options,s,this.speed);this.updateMotionValue?this.updateMotionValue(t):function(t,e,n){Ac(e)?t.style.setProperty(e,n):t.style[e]=n}(e,n,t),this.animation.cancel()}null==a||a(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,e;null===(t=(e=this.animation).finish)||void 0===t||t.call(e)}cancel(){try{this.animation.cancel()}catch(t){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;"idle"!==t&&"finished"!==t&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,e;this.isPseudoElement||(null===(t=(e=this.animation).commitStyles)||void 0===t||t.call(e))}get duration(){var t,e;const n=(null===(t=this.animation.effect)||void 0===t||null===(e=t.getComputedTiming)||void 0===e?void 0:e.call(t).duration)||0;return dc(Number(n))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+dc(t)}get time(){return dc(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=uc(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){var t;return null!==(t=this.manualStartTime)&&void 0!==t?t:Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,observe:e}){var n;this.allowFlatten&&(null===(n=this.animation.effect)||void 0===n||n.updateTiming({easing:"linear"}));return this.animation.onfinish=null,t&&Nc()?(this.animation.timeline=t,cc):e(this)}}class zc{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map((t=>t.finished)))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t){const e=this.animations.map((e=>e.attachTimeline(t)));return()=>{e.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return Wc(this.animations,"duration")}get iterationDuration(){return Wc(this.animations,"iterationDuration")}runAll(t){this.animations.forEach((e=>e[t]()))}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function Wc(t,e){let n=0;for(let i=0;i<t.length;i++){const r=t[i][e];null!==r&&r>n&&(n=r)}return n}class jc extends zc{then(t,e){return this.finished.finally(t).then((()=>{}))}}const $c=new WeakMap,Uc=(t,e="")=>`${t}:${e}`;function qc(t){const e=$c.get(t)||new Map;return $c.set(t,e),e}function Vc(t,e){var n,i;return null!==(n=null!==(i=null==t?void 0:t[e])&&void 0!==i?i:null==t?void 0:t.default)&&void 0!==n?n:t}const Gc=new Set(["borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","width","maxWidth","height","maxHeight","top","right","bottom","left","inset","insetBlock","insetBlockStart","insetBlockEnd","insetInline","insetInlineStart","insetInlineEnd","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingBlock","paddingBlockStart","paddingBlockEnd","paddingInline","paddingInlineStart","paddingInlineEnd","margin","marginTop","marginRight","marginBottom","marginLeft","marginBlock","marginBlockStart","marginBlockEnd","marginInline","marginInlineStart","marginInlineEnd","fontSize","backgroundPositionX","backgroundPositionY"]);function Hc(t,e){for(let n=0;n<t.length;n++)"number"==typeof t[n]&&Gc.has(e)&&(t[n]=t[n]+"px")}function Kc(t,e){const n=window.getComputedStyle(t);return Ac(e)?n.getPropertyValue(e):n[e]}function Xc(t,e,n,i){if(null==t)return[];const r=function(t){if(null==t)return[];if(t instanceof EventTarget)return[t];if("string"==typeof t){const e=document.querySelectorAll(t);return e?Array.from(e):[]}return Array.from(t).filter((t=>null!=t))}(t),o=r.length;ac(Boolean(o),"No valid elements provided.","no-valid-elements");const s=[];for(let t=0;t<o;t++){const i=r[t],a={...n};"function"==typeof a.delay&&(a.delay=a.delay(t,o));for(const t in e){let n=e[t];Array.isArray(n)||(n=[n]);const r={...Vc(a,t)};r.duration&&(r.duration=uc(r.duration)),r.delay&&(r.delay=uc(r.delay));const o=qc(i),l=Uc(t,r.pseudoElement||""),c=o.get(l);c&&c.stop(),s.push({map:o,key:l,unresolvedKeyframes:n,options:{...r,element:i,name:t,allowFlatten:!a.type&&!a.ease}})}}for(let t=0;t<s.length;t++){const{unresolvedKeyframes:e,options:n}=s[t],{element:i,name:r,pseudoElement:o}=n;o||null!==e[0]||(e[0]=Kc(i,r)),Mc(e),Hc(e,r),!o&&e.length<2&&e.unshift(Kc(i,r)),n.keyframes=e}const a=[];for(let t=0;t<s.length;t++){const{map:e,key:n,options:i}=s[t],r=new Lc(i);e.set(n,r),r.finished.finally((()=>e.delete(n))),a.push(r)}return a}const Yc=(()=>function(t,e,n){return new jc(Xc(t,e,n))})();var Qc=oa('<button class="svelte-16kucsb"><div class="cta-text svelte-16kucsb"> </div></button>'),Jc=oa('<div class="tryIt-container svelte-16kucsb"><!></div>');const Zc={hash:"svelte-16kucsb",code:".eko-gallery-app {--tryItModule_justifyContent: center;--tryItModule_alignItems: flex-end;--tryItModule_padding: 16px 20px 48px 20px;--tryItModule_button_padding: 16px 32px;--tryItModule_button_textAlign: center;--tryItModule_button_borderRadius: 100px;--tryItModule_button_border: 0;--tryItModule_button_boxShadow: 0 4px 24px 2px rgba(0, 0, 0, 0.12);--tryItModule_button_background: #FFFFFF;--tryItModule_button_text_fontFamily: var(--fontName);--tryItModule_button_text_fontSize: 18px;--tryItModule_button_text_color: #222;--tryItModule_button_text_weight: 500;--tryItModule_button_text_lineHeight: 120%;--tryItModule_button_text_letterSpacing: -0.1px;}.tryIt-container.svelte-16kucsb {position:relative;padding:var(--tryItModule_padding);width:100%;height:100%;box-sizing:border-box;display:flex;justify-content:var(--tryItModule_justifyContent);align-items:var(--tryItModule_alignItems);}.tryIt-container.svelte-16kucsb button:where(.svelte-16kucsb) {position:relative;padding:var(--tryItModule_button_padding);text-align:var(--tryItModule_button_textAlign);border-radius:var(--tryItModule_button_borderRadius);border:var(--tryItModule_button_border);background:var(--tryItModule_button_background);box-shadow:var(--tryItModule_button_boxShadow);font-family:var(--tryItModule_button_text_fontFamily);font-size:var(--tryItModule_button_text_fontSize);color:var(--tryItModule_button_text_color);font-weight:var(--tryItModule_button_text_weight);line-height:var(--tryItModule_button_text_lineHeight);letter-spacing:var(--tryItModule_button_text_letterSpacing);cursor:pointer;opacity:0;}.tryIt-container.svelte-16kucsb button:where(.svelte-16kucsb) .cta-text:where(.svelte-16kucsb) {opacity:0;}"};function tu(t,e){Hi(e,!0),Ua(t,Zc);const n=po((()=>e.state.ctaText)),i=po((()=>e.state.animationConfig)),r=po((()=>e.state.showCta)),o=po((()=>e.state.onCtaClick));let s=null,a=null,l=To(!1),c=!1;function u(){c&&Yc(s,{transform:"scale(1.05)"},{type:Tc,mass:1.5,stiffness:400,damping:30})}function d(){c&&Yc(s,{transform:"scale(1)"},{type:Tc,mass:1.5,stiffness:400,damping:30})}function h(){c&&Yc(s,{transform:"scale(0.95)"},{type:Tc,mass:1,stiffness:600,damping:30})}is((()=>{const{mass:t,stiffness:e,damping:n,delay:o}=Gs(i);let u;return Gs(r)&&(u=setTimeout((async()=>{So(l,!0),u=null,Yc(s,{transform:["translateY(40px) scale(0, 0.2)","translateY(0) scale(1, 1)"],opacity:1},{type:Tc,mass:t,stiffness:e,damping:n}),await Yc(a,{transform:["translateY(20px) scale(0.8)","translateY(0) scale(1)"],opacity:1},{type:Tc,mass:t,stiffness:e,damping:n,delay:.15}),c=!0}),o)),()=>{u&&clearTimeout(u)}}));var f=Jc(),p=Go(f),m=t=>{var e=Qc();e.__mousedown=h,e.__touchstart=h,e.__click=function(...t){var e;null===(e=Gs(o))||void 0===e||e.apply(this,t)};var i=Go(e),r=Go(i,!0);Fi(i),ml(i,(t=>a=t),(()=>a)),Fi(e),ml(e,(t=>s=t),(()=>s)),as((()=>{Ja(e,"pointer-events: "+(Gs(l)?"auto":"none")),ga(r,Gs(n))})),Zs("mouseenter",e,u),Zs("mouseleave",e,d),ca(t,e)};Ma(p,(t=>{Gs(r)&&t(m)})),Fi(f),ca(t,f),Ki()}ta(["mousedown","touchstart","click"]);var eu=new WeakSet;function nu(){this.mainTimeline?this.player.switchTimeline(this.mainTimeline):this.emitModuleEnd(),this.state.showCta=!1}function iu(t,e){const n=po((()=>e.state.textBox));jl(t,{get textBox(){return Gs(n)},get isMobile(){return e.isMobile},get gallery(){return e.gallery}})}var ru=oa('<div class="ripple svelte-1jfcowt"></div>'),ou=oa('<div class="hand-anim svelte-1jfcowt" aria-hidden="true"><svg viewBox="0 0 518 658" xmlns="http://www.w3.org/2000/svg" class="svelte-1jfcowt"><path class="hand-fill svelte-1jfcowt" d="M139.234 341.909V67.9226C139.234 53.292 145.203 40.0053 154.838 30.3866C175.516 9.69329 209.234 9.70929 229.912 30.3866C239.547 40.0064 245.516 53.288 245.516 67.9226V148.699C254.536 141.662 265.854 137.454 278.13 137.454C292.745 137.454 306.048 143.443 315.666 153.058C325.302 162.693 331.27 175.979 331.27 190.61V194.146C340.291 187.11 351.609 182.901 363.885 182.901C378.499 182.901 391.802 188.891 401.421 198.505C409.785 206.87 415.38 217.984 416.728 230.333C425.785 223.146 437.238 218.844 449.623 218.844C464.254 218.844 477.541 224.833 487.175 234.448C496.795 244.083 502.779 257.369 502.779 272V412.373C502.779 438.608 503.92 455.092 498.212 481.513C493.831 501.664 487.134 519.816 479.54 537.461C462.846 576.289 432.461 604.503 395.878 622.055C367.378 635.732 335.086 642.883 302.638 643.461C270.174 644.039 237.502 638.07 208.258 625.477C169.898 608.972 137.285 581.128 118.425 541.8C105.477 514.816 90.6385 488.097 75.9878 461.753C55.6131 425.06 35.5918 389.018 20.8838 352.665C15.8316 340.165 13.6234 326.692 15.889 314.4C20.6598 288.373 45.5823 272.597 71.217 277.296C83.6806 279.598 95.4463 286.598 103.925 297.301L139.234 341.909Z"></path><path class="hand-stroke svelte-1jfcowt" d="M244.917 166V269M330.917 201V305M419.917 246V326M139.234 341.909V67.9226C139.234 53.292 145.203 40.0053 154.838 30.3866C175.516 9.69329 209.234 9.70929 229.912 30.3866C239.547 40.0064 245.516 53.288 245.516 67.9226V148.699C254.536 141.662 265.854 137.454 278.13 137.454C292.745 137.454 306.048 143.443 315.666 153.058C325.302 162.693 331.27 175.979 331.27 190.61V194.146C340.291 187.11 351.609 182.901 363.885 182.901C378.499 182.901 391.802 188.891 401.421 198.505C409.785 206.87 415.38 217.984 416.728 230.333C425.785 223.146 437.238 218.844 449.623 218.844C464.254 218.844 477.541 224.833 487.175 234.448C496.795 244.083 502.779 257.369 502.779 272V412.373C502.779 438.608 503.92 455.092 498.212 481.513C493.831 501.664 487.134 519.816 479.54 537.461C462.846 576.289 432.461 604.503 395.878 622.055C367.378 635.732 335.086 642.883 302.638 643.461C270.174 644.039 237.502 638.07 208.258 625.477C169.898 608.972 137.285 581.128 118.425 541.8C105.477 514.816 90.6385 488.097 75.9878 461.753C55.6131 425.06 35.5918 389.018 20.8838 352.665C15.8316 340.165 13.6234 326.692 15.889 314.4C20.6598 288.373 45.5823 272.597 71.217 277.296C83.6806 279.598 95.4463 286.598 103.925 297.301L139.234 341.909Z"></path></svg></div>'),su=oa('<div class="tryIt-container svelte-1jfcowt"><div class="cta-wrapper svelte-1jfcowt"><button><div class="cta-text svelte-1jfcowt"> </div> <!></button> <!></div></div>');const au={hash:"svelte-1jfcowt",code:".eko-gallery-app {--tryItModule_justifyContent: center;--tryItModule_alignItems: flex-end;--tryItModule_padding: 16px 20px 48px 20px;--tryItModule_button_padding: 16px 32px;--tryItModule_button_textAlign: center;--tryItModule_button_borderRadius: 100px;--tryItModule_button_border: 0;--tryItModule_button_boxShadow: 0 4px 24px 2px rgba(0, 0, 0, 0.12);--tryItModule_button_background: #FFFFFF;--introModule_button_text_fontFamily: var(--fontName);--introModule_button_text_fontSize: 18px;--introModule_button_text_color: #222;--introModule_button_text_weight: 500;--introModule_button_text_lineHeight: 120%;--introModule_button_text_letterSpacing: -0.1px;--introModule_ripple_color: #FFFFFF;--introModule_ripple_borderWidth: 4px;--introModule_ripple_inset_top: -42px;--introModule_ripple_inset_right: -45px;--introModule_ripple_inset_bottom: -30px;--introModule_ripple_inset_left: -57px;--introModule_hand_fill: #FFFFFF;--introModule_hand_stroke: #000000;--introModule_hand_strokeWidth: 29;--introModule_hand_boxWidth: 75px;--introModule_hand_boxHeight: 95px;--introModule_hand_svgWidth: 60px;--introModule_hand_svgHeight: 75px;--introModule_hand_top: 24px;--introModule_hand_right: -79px;}.tryIt-container.svelte-1jfcowt {position:relative;padding:var(--tryItModule_padding);width:100%;height:100%;box-sizing:border-box;display:flex;justify-content:var(--tryItModule_justifyContent);align-items:var(--tryItModule_alignItems);}.tryIt-container.svelte-1jfcowt .cta-wrapper:where(.svelte-1jfcowt) {position:relative;width:fit-content;}.tryIt-container.svelte-1jfcowt button:where(.svelte-1jfcowt) {position:relative;padding:var(--tryItModule_button_padding);text-align:var(--tryItModule_button_textAlign);border-radius:var(--tryItModule_button_borderRadius);border:var(--tryItModule_button_border);background:var(--tryItModule_button_background);box-shadow:var(--tryItModule_button_boxShadow);font-family:var(--introModule_button_text_fontFamily);font-size:var(--introModule_button_text_fontSize);color:var(--introModule_button_text_color);font-weight:var(--introModule_button_text_weight);line-height:var(--introModule_button_text_lineHeight);letter-spacing:var(--introModule_button_text_letterSpacing);cursor:pointer;opacity:0;overflow:visible;pointer-events:auto;}.tryIt-container.svelte-1jfcowt button.has-hand-anim:where(.svelte-1jfcowt) {\n animation: svelte-1jfcowt-intro-bump 2s ease-out infinite;}.tryIt-container.svelte-1jfcowt button:where(.svelte-1jfcowt) .cta-text:where(.svelte-1jfcowt) {opacity:0;}.tryIt-container.svelte-1jfcowt button:where(.svelte-1jfcowt) .ripple:where(.svelte-1jfcowt) {position:absolute;inset:0;border-radius:inherit;border:var(--introModule_ripple_borderWidth) solid var(--introModule_ripple_color);pointer-events:none;box-sizing:border-box;\n animation: svelte-1jfcowt-intro-ripple-grow 2s cubic-bezier(0.32, 0.33, 0.08, 1) infinite, svelte-1jfcowt-intro-ripple-fade 2s linear infinite;}.tryIt-container.svelte-1jfcowt .hand-anim:where(.svelte-1jfcowt) {position:absolute;top:var(--introModule_hand_top);right:var(--introModule_hand_right);width:var(--introModule_hand_boxWidth);height:var(--introModule_hand_boxHeight);pointer-events:none;transform-origin:86.4% 98%;\n animation: svelte-1jfcowt-intro-hand-tap 2s cubic-bezier(0.32, 0.33, 0.08, 1) infinite;}.tryIt-container.svelte-1jfcowt .hand-anim:where(.svelte-1jfcowt) svg:where(.svelte-1jfcowt) {width:var(--introModule_hand_svgWidth);height:var(--introModule_hand_svgHeight);display:block;}.tryIt-container.svelte-1jfcowt .hand-anim:where(.svelte-1jfcowt) .hand-fill:where(.svelte-1jfcowt) {fill:var(--introModule_hand_fill);}.tryIt-container.svelte-1jfcowt .hand-anim:where(.svelte-1jfcowt) .hand-stroke:where(.svelte-1jfcowt) {fill:none;stroke:var(--introModule_hand_stroke);stroke-width:var(--introModule_hand_strokeWidth);stroke-linecap:round;}\n\n@keyframes svelte-1jfcowt-intro-ripple-grow {\n 0% {\n inset: 0;\n }\n 60% {\n inset: var(--introModule_ripple_inset_top) var(--introModule_ripple_inset_right) var(--introModule_ripple_inset_bottom) var(--introModule_ripple_inset_left);\n }\n 100% {\n inset: var(--introModule_ripple_inset_top) var(--introModule_ripple_inset_right) var(--introModule_ripple_inset_bottom) var(--introModule_ripple_inset_left);\n }\n}\n@keyframes svelte-1jfcowt-intro-ripple-fade {\n 0% {\n opacity: 1;\n }\n 20% {\n opacity: 1;\n }\n 60% {\n opacity: 0;\n }\n 100% {\n opacity: 0;\n }\n}\n@keyframes svelte-1jfcowt-intro-hand-tap {\n 0% {\n transform: translateX(0) translateY(0) rotate(0) scale(1);\n }\n 10% {\n transform: translateX(-10px) translateY(-20px) rotate(-40deg) scale(0.9);\n }\n 35% {\n transform: translateX(0) translateY(0) rotate(15deg) scale(1);\n }\n 100% {\n transform: translateX(0) translateY(0) rotate(0) scale(1);\n }\n}\n@keyframes svelte-1jfcowt-intro-bump {\n 0% {\n transform: scale(1);\n }\n 5% {\n transform: scale(1);\n }\n 10% {\n transform: scale(0.8);\n }\n 20% {\n transform: scale(1);\n }\n 100% {\n transform: scale(1);\n }\n}"};function lu(t,e){Hi(e,!0),Ua(t,au);const n=po((()=>e.state.buttonText)),i=po((()=>e.state.animateHand)),r=po((()=>e.state.onCtaClick));let o=null,s=null;Ta((async()=>{Yc(o,{opacity:1},{duration:.35,ease:"easeOut"}),await Yc(s,{opacity:1},{duration:.35,ease:"easeOut",delay:.05})}));var a=su(),l=Go(a),c=Go(l);let u;c.__click=function(...t){var e;null===(e=Gs(r))||void 0===e||e.apply(this,t)};var d=Go(c),h=Go(d,!0);Fi(d),ml(d,(t=>s=t),(()=>s));var f=Ko(d,2),p=t=>{ca(t,ru())};Ma(f,(t=>{Gs(i)&&t(p)})),Fi(c),ml(c,(t=>o=t),(()=>o));var m=Ko(c,2),v=t=>{ca(t,ou())};Ma(m,(t=>{Gs(i)&&t(v)})),Fi(l),Fi(a),as((()=>{u=Ya(c,1,"svelte-1jfcowt",null,u,{"has-hand-anim":Gs(i)}),ga(h,Gs(n))})),ca(t,a),Ki()}ta(["click"]);var cu=new WeakSet;function uu(){this.emitModuleEnd()}const du={videoModule:class extends Il{constructor({config:t,...e}){var n;super({...e,config:t}),this.Component=$l,this.hasDuration=!t.loop,wl(this),this.coverAssets.push(null!==(n=t.intro)&&void 0!==n?n:t.video),this.cover=this.coverAssets[0],this.state={textBox:t.textBox}}start(t){super.start(t),this.timeline=t.createTimeline();const e=this.config;e.intro&&this.timeline.placeOnTimeline(El(`${this.id}_intro`,e.intro,t),"end");const n=El(this.id,e.video,t);this.timeline.placeOnTimeline(n,"end",{loop:e.loop}),e.loop||n.on("nodeend",this.emitModuleEnd)}},toggleModule:class extends Gl{static itemsKey="options";static nodePrefix="option";constructor(t){super(t),this.Component=Ql}mapItem(t){return{label:t.label,note:t.note}}},modesModule:class extends Gl{static itemsKey="modes";static nodePrefix="mode";constructor(t){super(t),this.Component=ic}mapItem(t){return{title:t.title,description:t.description,image:t.image}}},tryItModule:class extends Il{constructor({config:t,...e}){var n;super({...e,config:t}),$(this,eu),wl(this);const{introVideo:i}=t;this.coverAssets.push(null!==(n=i.intro)&&void 0!==n?n:i.loop),this.cover=this.coverAssets[0],this.state={ctaText:t.ctaText,animationConfig:t.animationConfig,showCta:!0,onCtaClick:B(eu,this,nu).bind(this)}}start(t){super.start(t),this.Component=tu,this.timeline=t.createTimeline();const{introVideo:e,mainVideo:n}=this.config;if(e.intro&&this.timeline.placeOnTimeline(El(`${this.id}_intro_intro`,e.intro,t)),this.timeline.placeOnTimeline(El(`${this.id}_intro_loop`,e.loop,t),"end",{loop:!0}),n){this.mainTimeline=t.createTimeline(),n.intro&&this.mainTimeline.placeOnTimeline(El(`${this.id}_main_intro`,n.intro,t));const e=El(`${this.id}_main_loop`,n.loop,t);this.mainTimeline.placeOnTimeline(e,"end",{loop:!0})}}play(){this.state.showCta=!0,super.play()}},imageModule:class extends Il{constructor({config:t,...e}){super({...e,config:t}),this.Component=iu,wl(this),this.coverAssets.push(t.image),this.cover=this.coverAssets[0],this.showCover=!0,this.state={textBox:t.textBox}}start(t){super.start(t),this.timeline=t.createTimeline();const e=El(this.id,this.config.image,t);delete e.manifestRef.availableEncodeProfiles,e.manifestRef.assetType="image",this.timeline.placeOnTimeline(e,0,{loop:!0})}},introModule:class extends Il{constructor({config:t,...e}){var n,i,r;super({...e,config:t}),$(this,cu),wl(this),this.coverAssets.push(null!==(n=t.intro)&&void 0!==n?n:t.video),this.cover=this.coverAssets[0],this.state={buttonText:t.buttonText,animateHand:null===(i=null!==(r=t.animateHand)&&void 0!==r?r:t.animatedHand)||void 0===i||i,onCtaClick:B(cu,this,uu).bind(this)}}start(t){super.start(t),this.Component=lu,this.timeline=t.createTimeline();const e=this.config;e.intro&&this.timeline.placeOnTimeline(El(`${this.id}_intro`,e.intro,t)),this.timeline.placeOnTimeline(El(`${this.id}_loop`,e.video,t),"end",{loop:!0})}play(){this.timeline?this.player.switchTimeline(this.timeline):this.setPosition()}}};class hu{#d=Bi(To(null),"GalleryState.#introModule");#h=Bi(To(!1),"GalleryState.#introModulePlayed");#f=Bi(To({}),"GalleryState.#variants");#p=Bi(To("ekonovar"),"GalleryState.#activeVariant");#m=Bi(To(0),"GalleryState.#activeItemIndex");#v=Bi(To(0),"GalleryState.#activeModuleIndex");#g=Bi(To(Oo({variantId:Gs(this.#p),itemIndex:0,moduleIndex:0})),"GalleryState.#playingModulePosition");#y=Bi(po((()=>{var t;return null===(t=Gs(this.#f))||void 0===t?void 0:t[Gs(this.#p)]})),"GalleryState.#currentItemsList");#b=Bi(po((()=>{var t;return null===(t=Gs(this.#y))||void 0===t?void 0:t[Gs(this.#m)]})),"GalleryState.#currentItem");#k=Bi(po((()=>{var t,e;return Gs(this.#x)?null===(e=Gs(this.#y))||void 0===e||null===(e=e[Gs(this.#g).itemIndex])||void 0===e?void 0:e.modules[Gs(this.#g).moduleIndex]:null===(t=Gs(this.#b))||void 0===t?void 0:t.modules[Gs(this.#v)]})),"GalleryState.#currentModule");#w=Bi(po((()=>{var t;return(null===(t=Gs(this.#y))||void 0===t?void 0:t.flatMap((t=>t.modules)))||[]})),"GalleryState.#currentModulesList");#_=Bi(To(!1),"GalleryState.#playerLoaded");#I=Bi(To(!1),"GalleryState.#paused");#x=Bi(To(!1),"GalleryState.#startedPlaying");#T=Bi(po((()=>!(Bo(Gs(this.#g).itemIndex,this.activeItemIndex)&&Bo(Gs(this.#g).moduleIndex,this.activeModuleIndex)))),"GalleryState.#seeking");#E=Bi(To(!1),"GalleryState.#themeLoaded");set introModule(t){So(this.#d,t)}set introModulePlayed(t){So(this.#h,t,!0)}set variants(t){So(this.#f,t)}set activeVariant(t){So(this.#p,t,!0)}set activeItemIndex(t){So(this.#m,t,!0)}set activeModuleIndex(t){So(this.#v,t,!0)}set playingModulePosition(t){So(this.#g,t,!0)}set playerLoaded(t){So(this.#_,t,!0)}set paused(t){So(this.#I,t,!0)}set startedPlaying(t){So(this.#x,t,!0)}set themeLoaded(t){So(this.#E,t,!0)}get introModule(){return Gs(this.#d)}get introModulePlayed(){return Gs(this.#h)}get variants(){return Gs(this.#f)}get activeVariant(){return Gs(this.#p)}get availableVariants(){return Object.keys(Gs(this.#f))}get activeItemIndex(){return Gs(this.#m)}get activeModuleIndex(){return Gs(this.#v)}get playingModulePosition(){return Gs(this.#g)}get currentItemsList(){return Gs(this.#y)}get currentItem(){return Gs(this.#b)}get currentModule(){return Gs(this.#k)}get playerLoaded(){return Gs(this.#_)}get paused(){return Gs(this.#I)}get startedPlaying(){return Gs(this.#x)}get seeking(){return Gs(this.#T)}get currentModulesList(){return Gs(this.#w)}get themeLoaded(){return Gs(this.#E)}}const fu={assetsDeliveryBase:"https://{{env}}assets.eko.com",galleryAppDelivery:"https://{{env}}play.eko.com/video-apps/eko-gallery-app"};function pu(t,...e){function n(t){return"[object Object]"===Object.prototype.toString.call(t)}function i(t,e){if(Array.isArray(e)){Array.isArray(t)||(t=Array.isArray(t)?t.slice():[]);const r=Math.max(t.length,e.length);for(let o=0;o<r;o++){const r=t[o],s=e[o];null!==s&&(void 0!==s&&(n(r)&&n(s)?t[o]=i({...r},s):Array.isArray(r)&&Array.isArray(s)?t[o]=i(r.slice(),s):n(s)?t[o]=i({},s):Array.isArray(s)?t[o]=i([],s):t[o]=s))}return t}if(n(e)){n(t)||(t={});for(const r of Object.keys(e)){const o=t[r],s=e[r];n(o)&&n(s)?t[r]=i({...o},s):Array.isArray(o)&&Array.isArray(s)?t[r]=i(o.slice(),s):n(s)?t[r]=i({},s):Array.isArray(s)?t[r]=i([],s):void 0!==s&&(t[r]=s)}return t}return e}for(const n of e)null!==n&&i(t,n);return t}const mu="ekonovar",vu=2,gu=5,yu=10,bu=(t,e)=>{let n=t.findIndex((t=>t.variantAware&&t.id===e.id));return-1===n&&(n=t.findIndex((t=>t.variantAware))),-1===n?0:n};var ku=new WeakMap,xu=new WeakMap,wu=new WeakMap,_u=new WeakMap,Iu=new WeakMap,Tu=new WeakMap,Eu=new WeakSet;class Su{constructor(t){var e,n,i,r,o;$(this,Eu),W(this,ku,void 0),W(this,xu,void 0),W(this,wu,void 0),W(this,_u,void 0),W(this,Iu,void 0),W(this,Tu,void 0),U(this,"version","0.0.20"),wl(this),j(ku,this,(null===(e=crypto)||void 0===e||null===(n=e.randomUUID)||void 0===n?void 0:n.call(e))||`eko-gallery-${Date.now()}`),j(_u,this,t),j(Tu,this,(null==t?void 0:t.onEvent)||(()=>{})),j(xu,this,new hu),j(Iu,this,((t="")=>("production"===t&&(t=""),Object.fromEntries(Object.entries(fu).map((([e,n])=>[e,n.replaceAll("{{env}}",t)])))))(null==t||null===(i=t.options)||void 0===i?void 0:i.galleryEnv)),j(wu,this,[]);const s=null==t||null===(r=t.instance)||void 0===r||null===(r=r.data)||void 0===r||null===(r=r.blocks)||void 0===r||null===(r=r.blocksArr)||void 0===r||null===(r=r.find((t=>"GalleryBlock"===t.blockType)))||void 0===r?void 0:r.config;s?(B(Eu,this,Mu).call(this,s.items),B(Eu,this,Au).call(this,s.items),function(t,e){function n(e){window.EkoAnalytics("registerContextPacker",{tag:t,...e})}function i(e){return function(...n){return n.pop()!==t?null:e(...n)}}"undefined"!=typeof window&&window.EkoAnalytics&&(n({schema:"iglu:com.helloeko/gallery-app/jsonschema/1-0-0",match:/.*/,getData:i((()=>{var t,n,i,r,o;const s=null===(t=e.currentItem)||void 0===t?void 0:t.modules[e.activeModuleIndex];return{itemid:(null===(n=e.currentItem)||void 0===n?void 0:n.id)||"",itemindex:e.activeItemIndex,totalitems:(null===(i=e.currentItemsList)||void 0===i?void 0:i.length)||0,itemname:(null===(r=e.currentItem)||void 0===r?void 0:r.name)||"",moduleid:(null==s?void 0:s.id)||"",modulename:(null==s?void 0:s.name)||"",moduletype:(null==s?void 0:s.config.itemType)||"",moduleindex:e.activeModuleIndex,totalmodules:(null===(o=e.currentItem)||void 0===o?void 0:o.modules.length)||0,version:"0.0.20"}}))}),n({schema:"iglu:com.helloeko/implementation_interactions/jsonschema/1-0-6",match:"interaction",getData:i((t=>t))}))}(z(ku,this),z(xu,this))):console.warn("[eko-gallery-app] Gallery initiated without an instance, results will be empty");const a=null==t||null===(o=t.instance)||void 0===o||null===(o=o.data)||void 0===o||null===(o=o.blocks)||void 0===o||null===(o=o.blocksArr)||void 0===o||null===(o=o.find((t=>"FullScreenIntro"===t.blockType)))||void 0===o?void 0:o.config;a&&(z(xu,this).introModule=new du.introModule({position:{variantId:"intro",itemIndex:0,moduleIndex:0},config:{itemType:"introModule",...a},gallery:this}))}dispose(){var t,e;"undefined"!=typeof window&&(null===(t=(e=window).EkoAnalytics)||void 0===t||t.call(e,"reset",z(ku,this)),function(){if("undefined"!=typeof window){for(const t of Ul)delete window[t];Ul.clear()}}())}start(t){z(xu,this).playerLoaded=!0,z(wu,this).forEach((e=>{e.start(t)})),j(wu,this,null),B(Eu,this,Nu).call(this,t),z(xu,this).introModule?(z(xu,this).introModule.start(t),z(xu,this).introModule.moduleEndListener=()=>{z(xu,this).introModulePlayed=!0,z(xu,this).currentModule.play()},z(xu,this).introModule.play()):z(xu,this).currentModule.play()}selectVariant(t){const{variants:e,currentItem:n,activeItemIndex:i,activeModuleIndex:r}=z(xu,this);if(e[t]){const i=bu(e[t],n);z(xu,this).activeVariant=t,z(xu,this).activeItemIndex=i,z(xu,this).activeModuleIndex=0}else z(xu,this).activeVariant=mu,z(xu,this).activeItemIndex=0,z(xu,this).activeModuleIndex=0;i===z(xu,this).activeItemIndex&&r===z(xu,this).activeModuleIndex&&z(xu,this).currentModule.play()}selectItem(t){B(Eu,this,Cu).call(this);const e=z(xu,this);t!==e.activeItemIndex&&(e.activeItemIndex=t,e.activeModuleIndex=0)}selectItemAndStep(t,e){B(Eu,this,Cu).call(this);const n=z(xu,this);t===n.activeItemIndex&&e===n.activeModuleIndex||(n.activeItemIndex=t,n.activeModuleIndex=e)}next(){B(Eu,this,Cu).call(this)||B(Eu,this,Ou).call(this)}prev(){if(B(Eu,this,Cu).call(this))return;const t=z(xu,this);if(t.activeModuleIndex=t.activeModuleIndex-1,!t.currentItem.modules[t.activeModuleIndex])if(t.currentItemsList[t.activeItemIndex-1]){t.activeItemIndex=t.activeItemIndex-1;const e=t.currentItemsList[t.activeItemIndex];t.activeModuleIndex=e.modules.length-1}else t.activeModuleIndex=t.activeModuleIndex+1}getCoverUrl(t,e){var n,i,r,o;const s=(null==t||null===(n=t.entity)||void 0===n?void 0:n.entityId)||(null==t?void 0:t.assetId),a=null!==(i=null==t||null===(r=t.entity)||void 0===r?void 0:r.entityRevision)&&void 0!==i?i:null==t?void 0:t.assetRevision;if(!s)throw new Error(`[getCoverUrl] No assetId found in assetConfig: ${JSON.stringify(t||{},null,2)}`);if(!a&&0!==a)throw new Error(`[getCoverUrl] No assetRevision found for asset ${s}.`);let l;return null!==(o=z(_u,this))&&void 0!==o&&null!==(o=o.coverAssetsMap)&&void 0!==o&&o[s]?(l=new URL(z(_u,this).coverAssetsMap[s]),/^[a-z0-9]*assets.eko.com$/.test(l.host)&&e&&(l.pathname=l.pathname.replace(".png",".webp"))):(l=new URL(`${z(Iu,this).assetsDeliveryBase}/image/${s}/${a}?startOffset=0`),l.pathname+=e?".webp":".png"),e&&l.searchParams.set("width",e),l.href}track(t,...e){var n,i;"undefined"!=typeof window&&(null===(n=(i=window).EkoAnalytics)||void 0===n||n.call(i,"track",t,...e,z(ku,this)))}interaction(t,e){const n=z(ku,this);return i=>{if("undefined"!=typeof window){var r,o,s,a;const t=null==i||null===(r=i.target)||void 0===r?void 0:r.dataset;let l;null!=i&&null!==(o=i.detail)&&void 0!==o&&o.direction&&("left"===i.detail.direction?l="swipe_next":"right"===i.detail.direction&&(l="swipe_prev"));const c={elementid:(null==t?void 0:t.elementid)||(null==e?void 0:e.elementid)||"",elementtype:(null==t?void 0:t.elementtype)||(null==e?void 0:e.elementtype)||"",elementname:(null==t?void 0:t.elementname)||(null==e?void 0:e.elementname)||"",interactiontype:l||(null==t?void 0:t.interactiontype)||(null==e?void 0:e.interactiontype)||""};null===(s=(a=window).EkoAnalytics)||void 0===s||s.call(a,"track","interaction",c,n),z(Tu,this).call(this,"interaction",c)}t(i)}}preloadVariantsCovers(t,e){const{activeVariant:n,variants:i}=z(xu,this);ql(Object.entries(i).filter((([t])=>t!==n)).map((([,n])=>{const i=bu(n,t);return this.getCoverUrl(n[i].modules[0].cover,e)})))}get uuid(){return z(ku,this)}get state(){return z(xu,this)}get urls(){return z(Iu,this)}}function Mu(t){const e={};for(let n of t)for(let t of Object.keys(n.variants||{}))e[t]=[];e[mu]=[],z(xu,this).variants=e}function Au(t){const e=(t=[],e)=>{const n=[];for(let[i,r]of t.entries()){if(!du[r.itemType])throw new Error(`Unknown module type ${r.itemType}`);const t=new du[r.itemType]({position:{...e,moduleIndex:i},config:r,gallery:this});t.moduleEndListener=B(Eu,this,Fu).bind(this),n.push(t)}return n},n=Object.entries(z(xu,this).variants);for(const e of t)if("galleryItemV2"===e.itemType){const{variants:t,...i}=e;for(const[r,o]of n){const n=null==t?void 0:t[r];if(!n&&e.variantSpecific)continue;let s={...i};n&&(s=pu({},i,n)),o.push({...s,variantAware:!!n})}}for(const[t,i]of n)if(0!==i.length)for(const[n,r]of i.entries())r.modules=e(r.modules,{variantId:t,itemIndex:n}),j(wu,this,[...z(wu,this),...r.modules]);else delete z(xu,this).variants[t]}function Nu(t){const e=Object.entries(z(xu,this).variants);for(const[n,i]of e){const r=e.filter((([t])=>t!==n));for(const[e,n]of i.entries()){const o=n.modules,s=i.filter((t=>t!==n)).map((t=>t.modules[0])),a=r.map((([,t])=>({nodeId:t[bu(t,n)].modules[0].timeline.getNodesAtTime(0)[0].id,weight:yu})));for(const[n,r]of o.entries()){let l=o[n+1];l||(l=i[(e+1)%i.length].modules[0]);const c=l.timeline.getNodesAtTime(0)[0],u=s.filter((t=>t!==l)).map((t=>t.timeline.getNodesAtTime(0)[0])),d=[{nodeId:c.id,weight:vu},...u.map((t=>({nodeId:t.id,weight:gu}))),...a];for(const e of r.timeline.placements){t.getNode(e.nodeId).setChildren(d)}}}}}function Fu(){const t=z(xu,this),e=t.currentItem.modules;e.length>1&&t.activeModuleIndex===e.length-1?t.activeModuleIndex=0:B(Eu,this,Ou).call(this)}function Cu(){const{introModule:t,introModulePlayed:e}=z(xu,this);return!(!t||e)&&(z(xu,this).introModulePlayed=!0,!0)}function Ou(){const t=z(xu,this);t.activeModuleIndex=t.activeModuleIndex+1,t.currentItem.modules[t.activeModuleIndex]||(t.currentItemsList[t.activeItemIndex+1]?(t.activeItemIndex=t.activeItemIndex+1,t.activeModuleIndex=0):t.activeModuleIndex=t.activeModuleIndex-1)}const Pu=["activeVariant","activeItemIndex","activeModuleIndex","paused","startedPlaying","availableVariants"],Ru=t=>Pu.reduce(((e,n)=>(e[n]=t[n],e)),{});function Du(t){return{version:t.version,state:Ru(t.state),selectItem:t.selectItem,selectItemAndStep:t.selectItemAndStep,next:t.next,prev:t.prev,subscribe:e=>function(t){Ir.ensure();const e=ts(Xn|ai,t,!0);return()=>{fs(e)}}((()=>{is((()=>{e(Ru(t.state))}))}))}}var Bu=oa('<img class="nav-button-icon svelte-er27y2" alt="" aria-hidden="true"/>'),Lu=oa('<button><!> <span class="svelte-er27y2"> </span></button>'),zu=oa('<div><div class="nav-buttons svelte-er27y2"></div></div>');const Wu={hash:"svelte-er27y2",code:".eko-gallery-app {--nav_gap: 10px;--nav_padding: 12px 16px;--nav_bgColor: #FFFFFF;--nav_justifyContent: center;--nav_tray_margin: 0;--nav_tray_padding: 2px;--nav_tray_width: fit-content;--nav_tray_maxWidth: 100%;--nav_tray_bgColor: transparent;--nav_tray_border: 0;--nav_tray_borderRadius: 0;--nav_tray_boxShadow: none;--nav_tray_overflow: auto;--nav_button_width: fit-content;--nav_button_bgColor: #FFFFFF;--nav_button_borderRadius: 100px;--nav_button_paddingTop: 8px;--nav_button_paddingBottom: var(--nav_button_paddingTop);--nav_button_paddingLeft: 12px;--nav_button_paddingRight: var(--nav_button_paddingLeft);--nav_button_boxShadow: 0 0 0 1px #E7E7E7;--nav_button_gap: 2px;--nav_button_selected_boxShadow: 0 0 0 1px #000000;--nav_button_selected_bgColor: var(--nav_button_bgColor);--nav_button_text_color: #000000;--nav_button_text_fontSize: 14px;--nav_button_text_fontWeight: 500;--nav_button_text_fontFamily: var(--fontName);--nav_button_text_lineHeight: 120%;--nav_button_text_letterSpacing: 0px;--nav_button_text_align: center;--nav_button_selected_text_color: var(--nav_button_text_color);--nav_button_selected_text_fontWeight: var(--nav_button_text_fontWeight);--nav_button_image_borderRadius: calc(var(--nav_button_borderRadius) - var(--nav_button_paddingTop));--nav_button_icon_size: 20px;--nav_button_icon_filter: none;--nav_button_selected_icon_filter: none;--nav_arrow_color: var(--secondaryColor);--nav_arrow_bgColor: transparent;--nav_arrow_borderRadius: 100%;--nav_arrow_padding: 9px;--nav_arrow_size: 30px;--nav_arrow_boxShadow: none;--nav_arrow_iconOpacity: 0.6;--nav_arrow_bgColor_hover: #FFFFFF;--nav_arrow_boxShadow_hover: 0 0 8px 0 rgba(0, 0, 0, 0.12);}.nav-buttons-container.svelte-er27y2 {width:100%;background-color:var(--nav_bgColor);display:flex;box-sizing:border-box;text-align:center;justify-content:var(--nav_justifyContent);align-items:center;position:relative;flex-shrink:0;opacity:0;transition:opacity 0.2s ease-in-out;}.nav-buttons-container.theme-loaded.svelte-er27y2 {opacity:1;}.nav-buttons-container.svelte-er27y2 :where(.svelte-er27y2) {touch-action:auto;}.nav-buttons.svelte-er27y2 {display:flex;margin:var(--nav_tray_margin);gap:var(--nav_gap);height:100%;align-items:center;padding:var(--nav_tray_padding, var(--nav_padding));background-color:var(--nav_tray_bgColor);border:var(--nav_tray_border);border-radius:var(--nav_tray_borderRadius);box-shadow:var(--nav_tray_boxShadow);box-sizing:border-box;overflow-x:var(--nav_tray_overflow);scrollbar-width:none;max-width:var(--nav_tray_maxWidth);width:var(--nav_tray_width);overflow-y:hidden;overscroll-behavior-y:none;}.nav-button.svelte-er27y2 {display:flex;outline:none;flex-shrink:0;height:100%;width:var(--nav_button_width);border:none;cursor:pointer;align-items:center;gap:var(--nav_button_gap);background-color:var(--nav_button_bgColor);border-radius:var(--nav_button_borderRadius);\n /* eslint-disable-next-line max-len */padding:var(--nav_button_paddingTop) var(--nav_button_paddingRight) var(--nav_button_paddingBottom) var(--nav_button_paddingLeft);box-shadow:var(--nav_button_boxShadow);}.nav-button.svelte-er27y2 .nav-button-icon:where(.svelte-er27y2) {width:var(--nav_button_icon_size);height:var(--nav_button_icon_size);flex:0 0 auto;object-fit:contain;filter:var(--nav_button_icon_filter);pointer-events:none;display:block;}.nav-button.svelte-er27y2 span:where(.svelte-er27y2) {flex:1 0 0;transition:color 0.2s ease-in-out;color:var(--nav_button_text_color);font-weight:var(--nav_button_text_fontWeight);font-size:var(--nav_button_text_fontSize);font-family:var(--nav_button_text_fontFamily);line-height:var(--nav_button_text_lineHeight);letter-spacing:var(--nav_button_text_letterSpacing);text-align:var(--nav_button_text_align);}.nav-button.selected.svelte-er27y2 {background-color:var(--nav_button_selected_bgColor);box-shadow:var(--nav_button_selected_boxShadow);}.nav-button.selected.svelte-er27y2 .nav-button-icon:where(.svelte-er27y2) {filter:var(--nav_button_selected_icon_filter);}.nav-button.selected.svelte-er27y2 span:where(.svelte-er27y2) {color:var(--nav_button_selected_text_color);font-weight:var(--nav_button_selected_text_fontWeight);}"};function ju(t,e){Hi(e,!0),Ua(t,Wu);let n=gl(e,"onNavItemClick",3,(()=>{}));const i=Gi("state");var r=zu();let o;var s=Go(r);Fa(s,23,(()=>i().currentItemsList),((t,e)=>`${i().activeVariant}_${t.id}_${e}`),((t,r,o)=>{const s=po((()=>function(t){var n;if(!t)return null;if("string"==typeof t)return t;if(null!=(null===(n=t.entity)||void 0===n?void 0:n.entityId))try{return e.gallery.getCoverUrl(t,40)}catch{return null}return null}(Gs(r).icon)));var a=Lu();let l;a.__click=()=>n()(Gs(o));var c=Go(a),u=t=>{var e=Bu();as((()=>al(e,"src",Gs(s)))),ca(t,e)};Ma(c,(t=>{Gs(s)&&t(u)}));var d=Ko(c,2),h=Go(d,!0);Fi(d),Fi(a),as(((t,e)=>{l=Ya(a,1,"nav-button svelte-er27y2",null,l,t),al(a,"data-item-name",e),ga(h,Gs(r).name)}),[()=>({selected:Gs(o)===i().activeItemIndex}),()=>{var t,e;return null!==(t=null===(e=Gs(r).name)||void 0===e?void 0:e.toLowerCase())&&void 0!==t?t:""}]),ca(t,a)})),Fi(s),Fi(r),as((t=>o=Ya(r,1,"nav-buttons-container svelte-er27y2",null,o,t)),[()=>({"theme-loaded":i().themeLoaded})]),ca(t,r),Ki()}ta(["click"]);const $u="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20320%20512'%3e%3cpath%20d='M310.6%20233.4c12.5%2012.5%2012.5%2032.8%200%2045.3l-192%20192c-12.5%2012.5-32.8%2012.5-45.3%200s-12.5-32.8%200-45.3L242.7%20256%2073.4%2086.6c-12.5-12.5-12.5-32.8%200-45.3s32.8-12.5%2045.3%200l192%20192z'/%3e%3c/svg%3e";var Uu=oa('<button><img class="svelte-1al44kl"/></button>');const qu={hash:"svelte-1al44kl",code:'.nav-button.svelte-1al44kl {height:var(--nav_arrow_size, 30px);width:var(--nav_arrow_size, 30px);border-radius:var(--nav_arrow_borderRadius, 100%);background-color:var(--nav_arrow_bgColor, transparent);padding:var(--nav_arrow_padding, 9px);box-shadow:var(--nav_arrow_boxShadow, none);box-sizing:border-box;display:flex;align-items:center;justify-content:center;pointer-events:auto;border:0;opacity:100%;cursor:pointer;transition:background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out, opacity 0.2s ease-in-out;position:relative;}.nav-button.prev.svelte-1al44kl {transform:rotate(180deg);}.nav-button.hidden.svelte-1al44kl {opacity:0;pointer-events:none;}.nav-button.svelte-1al44kl::before {content:"";position:absolute;top:-8px;right:-8px;bottom:-8px;left:-8px;}.nav-button.svelte-1al44kl img:where(.svelte-1al44kl) {height:100%;opacity:var(--nav_arrow_iconOpacity, 1);}'};function Vu(t,e){Ua(t,qu);const n=gl(e,"hidden",3,!1);var i=Uu();let r;i.__click=function(...t){var n;null===(n=e.onClick)||void 0===n||n.apply(this,t)};var o=Go(i);Fi(i),as((()=>{var t;r=Ya(i,1,`nav-button ${null!==(t=e.type)&&void 0!==t?t:""}`,"svelte-1al44kl",r,{hidden:n()}),al(i,"aria-label",e.type),al(o,"src",$u),al(o,"alt",e.type)})),ca(t,i)}ta(["click"]);var Gu=oa('<button data-elementtype="step-indicator" data-interactiontype="navigation"><span class="svelte-1mxltt0"> </span></button>'),Hu=oa('<div><button aria-label="Scroll to previous steps"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="svelte-1mxltt0"><path d="M12.8333 16.6668C12.68 16.6668 12.5266 16.5935 12.4266 16.4601L9.42663 12.2935C9.36482 12.2081 9.33154 12.1055 9.33154 12.0001C9.33154 11.8948 9.36482 11.7921 9.42663 11.7068L12.4266 7.54012C12.4651 7.48671 12.5138 7.44142 12.5698 7.40682C12.6259 7.37222 12.6882 7.349 12.7532 7.33848C12.8182 7.32795 12.8846 7.33033 12.9487 7.34549C13.0128 7.36064 13.0732 7.38826 13.1266 7.42678C13.18 7.46531 13.2253 7.51397 13.2599 7.56999C13.2945 7.62602 13.3177 7.68831 13.3283 7.75331C13.3388 7.81831 13.3364 7.88475 13.3213 7.94883C13.3061 8.01291 13.2785 8.07338 13.24 8.12678L10.4466 12.0001L13.2333 15.8735C13.2864 15.9479 13.3181 16.0355 13.3251 16.1267C13.332 16.2179 13.314 16.3092 13.2728 16.3909C13.2316 16.4725 13.1689 16.5414 13.0915 16.59C13.014 16.6386 12.9247 16.6652 12.8333 16.6668Z" fill="#030303" class="svelte-1mxltt0"></path></svg></button> <div role="group" aria-roledescription="Sequence navigation buttons"></div> <button aria-label="Scroll to next steps"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="svelte-1mxltt0"><path d="M11.1668 16.6666C11.0668 16.6666 10.9601 16.6333 10.8734 16.5733C10.8199 16.5348 10.7746 16.4862 10.7399 16.4302C10.7053 16.3741 10.682 16.3118 10.6715 16.2468C10.6609 16.1818 10.6634 16.1153 10.6786 16.0512C10.6938 15.9871 10.7215 15.9266 10.7601 15.8733L13.5534 11.9999L10.7601 8.12661C10.6001 7.89994 10.6468 7.59328 10.8734 7.42661C11.1001 7.26661 11.4068 7.31994 11.5734 7.53994L14.5734 11.7066C14.7001 11.8799 14.7001 12.1133 14.5734 12.2933L11.5734 16.4599C11.4734 16.5933 11.3201 16.6666 11.1668 16.6666Z" fill="#030303" class="svelte-1mxltt0"></path></svg></button></div>');const Ku={hash:"svelte-1mxltt0",code:'.eko-gallery-app {--stepsIndicator_container_bottom: 12px;--stepsIndicator_container_left: 8px;--stepsIndicator_container_right: auto;--stepsIndicator_container_width: calc(100% - 16px);--stepsIndicator_padding: 4px 4px;--stepsIndicator_margin: 0 16px;--stepsIndicator_gap: 8px;--stepsIndicator_justifyContent: flex-start;--stepsIndicator_mask_left: linear-gradient(to left, black calc(100% - 20px), transparent);--stepsIndicator_mask_right: linear-gradient(to right, black calc(100% - 20px), transparent);\n /* stylelint-disable-next-line max-line-length */--stepsIndicator_mask_both: linear-gradient(\n to right,\n transparent,\n black 20px,\n black calc(100% - 20px),\n transparent\n );--stepsIndicator_button_padding: 8px 12px;--stepsIndicator_button_border: #E4E5E8 solid 1px;--stepsIndicator_button_borderRadius: 100px;--stepsIndicator_button_bgColor: #FBFBFB;--stepsIndicator_button_bgColor_hover: #F3F4F6;--stepsIndicator_button_bgColor_active: #E4E5E8;--stepsIndicator_button_boxShadow: none;--stepsIndicator_button_color: #030303;--stepsIndicator_button_fontSize: 12px;--stepsIndicator_button_fontWeight: 500;--stepsIndicator_button_lineHeight: 16px;--stepsIndicator_button_active_bgColor: #014FD3;--stepsIndicator_button_active_borderColor: #014FD3;--stepsIndicator_button_active_boxShadow: none;--stepsIndicator_button_active_color: #FFFFFF;--stepsIndicator_span_display: block;--stepsIndicator_span_width: auto;--stepsIndicator_span_height: auto;--stepsIndicator_span_borderRadius: 0;--stepsIndicator_span_bgColor: transparent;--stepsIndicator_span_border: 0;--stepsIndicator_span_boxShadow: none;--stepsIndicator_span_fontSize: inherit;--stepsIndicator_span_color: inherit;--stepsIndicator_span_active_width: var(--stepsIndicator_span_width);--stepsIndicator_span_active_height: var(--stepsIndicator_span_height);--stepsIndicator_span_active_bgColor: var(--stepsIndicator_span_bgColor);--stepsIndicator_span_active_border: var(--stepsIndicator_span_border);--stepsIndicator_span_active_boxShadow: var(--stepsIndicator_span_boxShadow);--stepsIndicator_arrow_display: flex;}.steps-indicator-container.svelte-1mxltt0 {width:var(--stepsIndicator_container_width);position:absolute;bottom:var(--stepsIndicator_container_bottom);left:var(--stepsIndicator_container_left);right:var(--stepsIndicator_container_right);animation-duration:0.75s;animation-timing-function:cubic-bezier(0.36, 0, 0, 1);animation-fill-mode:both;animation-delay:0.15s;\n animation-name: svelte-1mxltt0-gallery-steps-appear-anim;}.steps-indicator-container.mobile-indicators.svelte-1mxltt0 {display:var(--stepsIndicator_mobile_display, none);}.steps-indicator.svelte-1mxltt0 {--stepSize: 6px;--stepPadding: 7px;padding:var(--stepsIndicator_padding);margin:var(--stepsIndicator_margin);display:flex;gap:var(--stepsIndicator_gap);align-items:center;justify-content:var(--stepsIndicator_justifyContent);overflow-x:auto;pointer-events:all;scrollbar-width:none;}.steps-indicator.fade-right.svelte-1mxltt0 {mask-image:var(--stepsIndicator_mask_right);}.steps-indicator.fade-left.svelte-1mxltt0 {mask-image:var(--stepsIndicator_mask_left);}.steps-indicator.fade-left.fade-right.svelte-1mxltt0 {mask-image:var(--stepsIndicator_mask_both);}.steps-indicator.with-duration.svelte-1mxltt0 .step-button:where(.svelte-1mxltt0) span:where(.svelte-1mxltt0) {position:relative;overflow:hidden;}.steps-indicator.with-duration.svelte-1mxltt0 .step-button:where(.svelte-1mxltt0) span:where(.svelte-1mxltt0):after {transition:0.3s ease-in-out;transition-property:opacity, width;}.step-button.svelte-1mxltt0 {padding:var(--stepsIndicator_button_padding);border:var(--stepsIndicator_button_border);background-color:var(--stepsIndicator_button_bgColor);box-shadow:var(--stepsIndicator_button_boxShadow);border-radius:var(--stepsIndicator_button_borderRadius);font-size:var(--stepsIndicator_button_fontSize);font-weight:var(--stepsIndicator_button_fontWeight);line-height:var(--stepsIndicator_button_lineHeight);color:var(--stepsIndicator_button_color);cursor:pointer;pointer-events:all;flex-shrink:0;transition:all 0.3s ease-in-out;outline-color:#3191fc;}.step-button.active.svelte-1mxltt0 {background-color:var(--stepsIndicator_button_active_bgColor);color:var(--stepsIndicator_button_active_color);box-shadow:var(--stepsIndicator_button_active_boxShadow);border-color:var(--stepsIndicator_button_active_borderColor);}.step-button.active.svelte-1mxltt0:after {opacity:100%;\n animation: svelte-1mxltt0-stepDurationAnimation var(--stepDuration) linear forwards;animation-play-state:running;}.step-button.svelte-1mxltt0:hover:not(.active) {background:var(--stepsIndicator_button_bgColor_hover);}.step-button.svelte-1mxltt0:active:not(.active) {background:var(--stepsIndicator_button_bgColor_active);}.step-button.svelte-1mxltt0:focus {outline-offset:4px;outline-width:2px;}.step-button.svelte-1mxltt0 span:where(.svelte-1mxltt0) {display:var(--stepsIndicator_span_display);width:var(--stepsIndicator_span_width);height:var(--stepsIndicator_span_height);border-radius:var(--stepsIndicator_span_borderRadius);background-color:var(--stepsIndicator_span_bgColor);border:var(--stepsIndicator_span_border);box-shadow:var(--stepsIndicator_span_boxShadow);font-size:var(--stepsIndicator_span_fontSize);color:var(--stepsIndicator_span_color);box-sizing:border-box;pointer-events:none;white-space:nowrap;}.step-button.svelte-1mxltt0 span:where(.svelte-1mxltt0):after {content:"";background-color:rgba(0, 0, 0, 0.6);position:absolute;border-radius:var(--stepSize);width:0;height:100%;top:0;left:-100%;opacity:0;transform:translateX(0);animation-play-state:paused;}.step-button.active.svelte-1mxltt0 span:where(.svelte-1mxltt0) {width:var(--stepsIndicator_span_active_width);height:var(--stepsIndicator_span_active_height);background-color:var(--stepsIndicator_span_active_bgColor);border:var(--stepsIndicator_span_active_border);box-shadow:var(--stepsIndicator_span_active_boxShadow);}.step-arrow.svelte-1mxltt0 {display:var(--stepsIndicator_arrow_display);width:34px;height:34px;position:absolute;z-index:10;bottom:4px;border:1px solid #C4C8CF;border-radius:50%;background-color:#FFFFFF;box-shadow:0 2px 3px 0 rgba(0, 0, 0, 0.05);box-sizing:border-box;align-items:center;justify-content:center;pointer-events:none;cursor:pointer;opacity:0;}.step-arrow.svelte-1mxltt0:hover {background:#F6F6F7;}.step-arrow.svelte-1mxltt0:active {background:#E4E5E8;}.step-arrow-prev.svelte-1mxltt0 {left:3px;transform:translateX(-100%);\n animation: svelte-1mxltt0-arrow-left-disappear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}.step-arrow-prev.visible.svelte-1mxltt0 {pointer-events:auto;\n animation: svelte-1mxltt0-arrow-left-appear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}.step-arrow-next.svelte-1mxltt0 {right:3px;transform:translateX(100%);\n animation: svelte-1mxltt0-arrow-right-disappear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}.step-arrow-next.visible.svelte-1mxltt0 {pointer-events:auto;\n animation: svelte-1mxltt0-arrow-right-appear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}\n\n@keyframes svelte-1mxltt0-gallery-steps-appear-anim {\n from {\n opacity: 0;\n transform: translate(0, 10px);\n }\n to {\n opacity: 1;\n transform: translate(0, 0);\n }\n}\n@keyframes svelte-1mxltt0-gallery-steps-disappear-anim {\n from {\n opacity: 1;\n transform: translate(0, 0);\n }\n to {\n opacity: 0;\n transform: translate(0, 10px);\n }\n}\n@keyframes svelte-1mxltt0-arrow-left-appear {\n from {\n opacity: 0;\n transform: translateX(-100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n@keyframes svelte-1mxltt0-arrow-left-disappear {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(-100%);\n }\n}\n@keyframes svelte-1mxltt0-arrow-right-appear {\n from {\n opacity: 0;\n transform: translateX(100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n@keyframes svelte-1mxltt0-arrow-right-disappear {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(100%);\n }\n}\n@keyframes svelte-1mxltt0-stepDurationAnimation {\n 0% {\n transform: translateX(0);\n }\n 100% {\n transform: translateX(100%);\n }\n}'};function Xu(t,e){Hi(e,!0),Ua(t,Ku);const n=16,i=32;let r=gl(e,"gallery",7),o=To(null),s=To(null),a=To(!1),l=To(!1);const c=po((()=>{let t=[];return t=r().state.currentItem.modules.map(((t,e)=>({index:e,type:e===r().state.activeModuleIndex?"active":"",name:t.name}))),t}));function u(){Gs(o)&&(So(a,Gs(o).scrollLeft>0),So(l,Gs(o).scrollLeft+Gs(o).clientWidth<Gs(o).scrollWidth-0))}function d(t){Gs(o).scrollBy({left:t,behavior:"smooth"})}function h(t,e){const r=t.getBoundingClientRect(),o=e.getBoundingClientRect(),s=n+i;o.left<r.left+i?d(o.left-r.left-s):o.right>r.right-i&&d(o.right-r.right+s)}function f(){const t=Array.from(Gs(o).querySelectorAll(".step-button")).find((t=>{const e=t.getBoundingClientRect(),n=Gs(o).getBoundingClientRect();return e.left>n.left+i}));if(t){const e=t.previousElementSibling;e&&h(Gs(o),e)}}function p(){const t=Array.from(Gs(o).querySelectorAll(".step-button")).reverse().find((t=>{const e=t.getBoundingClientRect(),n=Gs(o).getBoundingClientRect();return e.right<n.right-i}));if(t){const e=t.nextElementSibling;e&&h(Gs(o),e)}}is((()=>{if(Gs(o)){u();const t=Gs(o).querySelector(".step-button.active");t&&So(s,t,!0);const e=new MutationObserver((()=>{const t=Gs(o).querySelector(".step-button.active");t&&So(s,t,!0)}));e.observe(Gs(o),{attributes:!0,attributeFilter:["class"],subtree:!0});const n=new ResizeObserver((()=>{u()}));return n.observe(Gs(o)),()=>{e.disconnect(),n.disconnect()}}})),is((()=>{Gs(c),Gs(o)&&Vs().then(u)})),is((()=>{Gs(s)&&Gs(o)&&h(Gs(o),Gs(s))}));var m=la();Zs("resize",Lo,u),function(t,e,n){Si&&Ni();var i=new Ia(t);ls((()=>{var t=e();i.ensure(t,n)}))}(Ho(m),(()=>r().state.activeItemIndex),(t=>{var n=Hu();let i;var s=Go(n);let d;s.__click=f;var m=Ko(s,2);let v;Fa(m,21,(()=>Gs(c)),Aa,((t,e)=>{var n=Gu();let i;var s=po((()=>r().interaction((t=>{return n=t.currentTarget,i=Gs(e).index,r().state.activeModuleIndex=i,void h(Gs(o),n);var n,i}))));n.__click=function(...t){var e;null===(e=Gs(s))||void 0===e||e.apply(this,t)};var a=Go(n),l=Go(a,!0);Fi(a),Fi(n),as((()=>{i=Ya(n,1,"step-button svelte-1mxltt0",null,i,{active:"active"===Gs(e).type}),al(n,"aria-label",`Go to step $${Gs(e).index+1}`),al(n,"data-elementid",`${Gs(e).index+1}`),al(n,"data-elementname",Gs(e).name),ga(l,Gs(e).name)})),ca(t,n)})),Fi(m),ml(m,(t=>So(o,t)),(()=>Gs(o)));var g=Ko(m,2);let y;g.__click=p,Fi(n),as((()=>{var t,o,c;i=Ya(n,1,"steps-indicator-container svelte-1mxltt0",null,i,{"mobile-indicators":e.isMobile}),d=Ya(s,1,"step-arrow step-arrow-prev svelte-1mxltt0",null,d,{visible:Gs(a)}),v=Ya(m,1,"steps-indicator svelte-1mxltt0",null,v,{"with-duration":null===(t=r().state.currentModule)||void 0===t?void 0:t.hasDuration,paused:r().state.paused,"fade-left":Gs(a),"fade-right":Gs(l)}),Ja(m,`--stepDuration: ${null!==(o=null===(c=r().state.currentModule)||void 0===c?void 0:c.duration)&&void 0!==o?o:""}s`),y=Ya(g,1,"step-arrow step-arrow-next svelte-1mxltt0",null,y,{visible:Gs(l)})})),Zs("scroll",m,u),ca(t,n)})),ca(t,m),Ki()}ta(["click"]);var Yu=aa('<svg class="pause-button-icon pause-button-icon--play svelte-a3r6re" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M5.23 3.75c0-1.11 1.19-1.82 2.17-1.28l15 8.25a1.46 1.46 0 0 1 0 2.56l-15 8.25a1.46 1.46 0 0 1-2.17-1.28V3.75z"></path></svg>'),Qu=aa('<svg class="pause-button-icon pause-button-icon--pause svelte-a3r6re" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><line class="pause-bar pause-bar--left svelte-a3r6re" x1="8" y1="3.5" x2="8" y2="20.5"></line><line class="pause-bar pause-bar--right svelte-a3r6re" x1="16" y1="3.5" x2="16" y2="20.5"></line></svg>'),Ju=oa('<button class="pause-button svelte-a3r6re" data-elementid="play_pause" data-elementtype="button"><!></button>');const Zu={hash:"svelte-a3r6re",code:".eko-gallery-app {--pauseButton_top: 10px;--pauseButton_right: 10px;--pauseButton_bottom: auto;--pauseButton_left: auto;--pauseButton_size: 32px;--pauseButton_borderRadius: 100%;--pauseButton_border: 1px solid #C4C8CF;--pauseButton_boxShadow: none;--pauseButton_backdropFilter: none;--pauseButton_bgColor: #FFFFFF;--pauseButton_bgColor_hover: #F6F6F7;--pauseButton_bgColor_active: #E4E5E8;--pauseButton_iconSize: 16px;--pauseButton_iconColor: #030303;--pauseButton_playIconFill: none;--pauseButton_playIconStroke: currentColor;--pauseButton_playIconStrokeWidth: 1.5;--pauseButton_pauseIconStrokeWidth: 1.5;--pauseButton_pauseIconStrokeLinecap: butt;--pauseButton_pauseIconScaleY: 1;--pauseButton_pauseIconBarSpread: 0px;}.pause-button.svelte-a3r6re {position:absolute;top:var(--pauseButton_top);right:var(--pauseButton_right);bottom:var(--pauseButton_bottom);left:var(--pauseButton_left);width:var(--pauseButton_size);height:var(--pauseButton_size);padding:0;background:var(--pauseButton_bgColor);border:var(--pauseButton_border);border-radius:var(--pauseButton_borderRadius);box-shadow:var(--pauseButton_boxShadow);backdrop-filter:var(--pauseButton_backdropFilter);-webkit-backdrop-filter:var(--pauseButton_backdropFilter);color:var(--pauseButton_iconColor);display:flex;justify-content:center;align-items:center;pointer-events:auto;transition:background 0.2s ease-in-out;cursor:pointer;outline-color:#3191fc;}.pause-button.svelte-a3r6re:hover {background:var(--pauseButton_bgColor_hover);}.pause-button.svelte-a3r6re:active {background:var(--pauseButton_bgColor_active);}.pause-button.svelte-a3r6re:focus {outline-offset:8px;outline-width:2px;}.pause-button.svelte-a3r6re .pause-button-icon:where(.svelte-a3r6re) {width:var(--pauseButton_iconSize);height:var(--pauseButton_iconSize);pointer-events:none;display:block;}.pause-button.svelte-a3r6re .pause-button-icon--pause:where(.svelte-a3r6re) {fill:none;stroke:currentColor;stroke-width:var(--pauseButton_pauseIconStrokeWidth, 1.5);stroke-linecap:var(--pauseButton_pauseIconStrokeLinecap, butt);transform:scaleY(var(--pauseButton_pauseIconScaleY, 1));transform-origin:center;overflow:visible;}.pause-button.svelte-a3r6re .pause-button-icon--pause:where(.svelte-a3r6re) .pause-bar--left:where(.svelte-a3r6re) {transform:translateX(calc(-1 * var(--pauseButton_pauseIconBarSpread, 0px)));}.pause-button.svelte-a3r6re .pause-button-icon--pause:where(.svelte-a3r6re) .pause-bar--right:where(.svelte-a3r6re) {transform:translateX(var(--pauseButton_pauseIconBarSpread, 0px));}.pause-button.svelte-a3r6re .pause-button-icon--play:where(.svelte-a3r6re) {fill:var(--pauseButton_playIconFill, none);stroke:var(--pauseButton_playIconStroke, currentColor);stroke-width:var(--pauseButton_playIconStrokeWidth, 1.5);stroke-linejoin:round;stroke-linecap:round;}"};ta(["click"]);const td=300,ed=60,nd="none";function id(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function rd(t,e,n){const{x:i,y:r}=function(t,e){const n=t.getBoundingClientRect();return{x:Math.round(e.clientX-n.left),y:Math.round(e.clientY-n.top)}}(t,e);return{event:e,pointersCount:n.length,target:e.target,x:i,y:r,attachmentNode:t}}function od(t,e,n,i,r){const o=rd(t,n,i);return t.dispatchEvent(new CustomEvent(`${e}${r}`,{detail:o})),o}function sd(){let t=[],e=()=>{},n=[];return{setPointerControls:(i,r,o,s,a,l=nd,c=[])=>{var u;if(r.style.touchAction=(u=l,Array.isArray(u)?u:[u]).join(" "),n=c,n.forEach((e=>{var n;null===(n=e.onInit)||void 0===n||n.call(e,t)})),!t.length){let l=function(e){t.push(e);const l=od(r,i,e,t,"down");function c(e){const o=t.length;t=function(t,e){return e.filter((e=>Bo(t.pointerId,e.pointerId,!1)))}(e,t);if(o>t.length){t.length||(u(),d(),h(),f());const o=od(r,i,e,t,"up");null==a||a(t,e),setTimeout((()=>{n.forEach((e=>{var n;null===(n=e.onUp)||void 0===n||n.call(e,o,t)}))}))}}null==s||s(t,e),setTimeout((()=>{n.forEach((e=>{var n;null===(n=e.onDown)||void 0===n||n.call(e,l,t)}))}));const u=id(r,"pointermove",(e=>{t=t.map((t=>Bo(e.pointerId,t.pointerId)?e:t));const s=od(r,i,e,t,"move");null==o||o(t,e),n.forEach((e=>{var n;null===(n=e.onMove)||void 0===n||n.call(e,s,t)}))})),d=id(r,"lostpointercapture",(t=>{c(t)})),h=id(r,"pointerup",(t=>{c(t)})),f=id(r,"pointerleave",(t=>{c(t)}))};e=id(r,"pointerdown",l)}return{destroy:()=>{t.length||(e(),n.forEach((t=>{var e;null===(e=t.onDestroy)||void 0===e||e.call(t)})))}}}}}const ad="@attach";function ld(){return Symbol(ad)}const cd="swipe";function ud(t,e,n,i=!1){const{setPointerControls:r}=sd(),o=i?cd:ld();return{...n,[`on${cd}`]:t,[o]:t=>{const{onDown:n,onUp:i,parameters:o}=function(t,e){const n={timeframe:td,minSwipeDistance:ed,touchAction:nd,composed:!1,...e};let i,r,o,s;function a(t,e){r=e.clientX,o=e.clientY,i=Date.now(),Bo(t.length,1)&&(s=e.target)}function l(e,a){if(Bo(a.type,"pointerup")&&Bo(e.length,0)&&Date.now()-i<n.timeframe){const e=a.clientX-r,i=a.clientY-o,l=Math.abs(e),c=Math.abs(i);let u=null;l>=2*c&&l>n.minSwipeDistance?u=e>0?"right":"left":c>=2*l&&c>n.minSwipeDistance&&(u=i>0?"bottom":"top"),u&&t.dispatchEvent(new CustomEvent(cd,{detail:{direction:u,target:s,pointerType:a.pointerType}}))}}return{onDown:a,onUp:l,parameters:n}}(t,null==e?void 0:e());return r(cd,t,null,n,i,o.touchAction,o.plugins).destroy}}}const dd="tap";function hd(t,e,n,i=!1){const{setPointerControls:r}=sd(),o=i?dd:ld();return{...n,[`on${dd}`]:t,[o]:t=>{const{onDown:n,onUp:i,parameters:o}=function(t,e){const n={timeframe:td,composed:!1,touchAction:"auto",...e};let i,r,o;function s(e,s){if(Math.abs(s.clientX-r)<4&&Math.abs(s.clientY-o)<4&&Date.now()-i<n.timeframe){const e=t.getBoundingClientRect(),n=Math.round(s.clientX-e.left),i=Math.round(s.clientY-e.top);t.dispatchEvent(new CustomEvent(dd,{detail:{x:n,y:i,target:s.target,pointerType:s.pointerType}}))}}function a(t,e){r=e.clientX,o=e.clientY,i=Date.now()}return{onDown:a,onUp:s,parameters:n}}(t,null==e?void 0:e());return r(dd,t,null,n,i,o.touchAction,o.plugins).destroy}}}const fd=t=>{const e="#00ff00",n=1e6,i=4;let r,o,s,a=null,l=!1,c=Date.now();const u={x:void 0,y:void 0};function d(){const e=t.fadeTime,n=Date.now(),i=n-c;i>e/20&&(a&&o&&s&&r&&(s.drawImage(r,0,0),a.clearRect(0,0,r.width,r.height),a.globalAlpha=1-3*i/e,a.drawImage(o,0,0),a.globalAlpha=1,s.clearRect(0,0,r.width,r.height)),c=n),l&&requestAnimationFrame(d)}function h(t){u.x=t.x,u.y=t.y}function f(){a&&o&&r&&(a.canvas.width=window.innerWidth,a.canvas.height=window.innerHeight,o.width=r.width,o.height=r.height)}function p(e){var i;m(),r=window.document.createElement("canvas"),r.id="svelte-gestures-highlight-plugin",a=r.getContext("2d"),r.style.cssText=`\ndisplay: block; \nwidth: 100dvw;\nheight: 100dvh;\ntop: 0;\nleft: 0;\nposition: fixed;\npointer-events: none;\nz-index: ${null!==(i=t.zIndex)&&void 0!==i?i:n};\n`,window.document.body.appendChild(r),window.addEventListener("resize",f),e&&h(e.event),o=document.createElement("canvas"),f(),s=o.getContext("2d"),l=!0,d()}function m(){var t;l=!1,null===(t=window.document.getElementById("svelte-gestures-highlight-plugin"))||void 0===t||t.remove(),window.removeEventListener("resize",f)}return{onMove:n=>{var r,o,s;r=n.event,a&&(a.beginPath(),a.lineWidth=null!==(o=t.lineWidth)&&void 0!==o?o:i,a.lineCap="round",a.strokeStyle=null!==(s=t.color)&&void 0!==s?s:e,Bo(u.x,void 0,!1)&&Bo(u.y,void 0,!1)?(a.moveTo(u.x,u.y),h(r),a.lineTo(u.x,u.y)):h(r),a.stroke())},onDown:t=>{p(t)},onUp:(t,e)=>{Bo(e.length,0)&&m()},onDestroy:m,onInit:t=>{t.length&&(u.x=void 0,u.y=void 0,p())}}};var pd=oa("<div></div>"),md=oa("<div></div>");const vd={hash:"svelte-1fv6njc",code:".swiper.svelte-1fv6njc {position:absolute;top:0;left:0;pointer-events:auto;width:100%;height:100%;}"};var gd=oa("<img/>"),yd=oa('<div class="ui-container svelte-1rvgxfc"><!></div>'),bd=oa('<div class="cover-container svelte-1rvgxfc"><!> <!> <!></div>'),kd=oa('<div class="covers-container svelte-1rvgxfc" style="scroll-behavior: auto;"><!></div>');const xd={hash:"svelte-1rvgxfc",code:".covers-container.svelte-1rvgxfc {position:absolute;top:0;left:0;bottom:0;right:0;overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;scrollbar-width:none;display:flex;gap:0.5px;}.covers-container.svelte-1rvgxfc::-webkit-scrollbar {display:none;}.cover-container.svelte-1rvgxfc {position:relative;display:flex;width:100%;height:100%;flex-shrink:0;scroll-snap-align:center;user-select:none;justify-content:center;align-items:center;}.cover-image.svelte-1rvgxfc {width:var(--videoWidth);height:var(--videoHeight);aspect-ratio:var(--videoAspect);object-fit:cover;pointer-events:none;background:#ffffff;}.cover-image.content-playing.svelte-1rvgxfc {opacity:0;}.cover-image.content-playing.force-show.svelte-1rvgxfc {opacity:1;background:transparent;transition:opacity 0s 0.2s;}.ui-container.svelte-1rvgxfc {position:absolute;top:0;left:0;bottom:0;right:0;pointer-events:none;}"};function wd(t,e){Hi(e,!0),Ua(t,xd);const n=(t,n=jn,i=jn,r=jn,l=jn)=>{var c=bd(),u=Go(c),d=t=>{var e=gd();let o;as((t=>{o=Ya(e,1,"cover-image svelte-1rvgxfc",null,o,{"content-playing":n(),"force-show":i().showCover}),al(e,"src",t),al(e,"alt",i().name),al(e,"fetchpriority",r())}),[()=>s().getCoverUrl(i().cover,a)]),Zs("load",e,(function(...t){var e;null===(e=l())||void 0===e||e.apply(this,t)})),function(t){if(!Si)return;t.removeAttribute("onload"),t.removeAttribute("onerror");const e=t.__e;void 0!==e&&(t.__e=void 0,queueMicrotask((()=>{t.isConnected&&t.dispatchEvent(e)})))}(e),ca(t,e)};Ma(u,(t=>{t(d)}));var h=Ko(u,2);!function(t,e){Hi(e,!0),Ua(t,vd);const n={color:"#e3e3e3",fadeTime:300,lineWidth:8},i=ud(e.gallery.interaction((t=>{const{direction:n}=t.detail;var i;if("left"===n)null===(i=e.gallery)||void 0===i||i.next(),e.onEvent("swipe",[-1,0]);else if("right"===n){var r;null===(r=e.gallery)||void 0===r||r.prev(),e.onEvent("swipe",[1,0])}}),{elementid:"swiper"}),(()=>({touchAction:"pan-y",plugins:e.debug?[fd(n)]:[]}))),r=hd((function(t){const{x:n,y:i}=t.detail;e.onEvent("click",{x:n,y:i})}),(()=>({touchAction:"pan-y"})));var o=la(),s=Ho(o),a=t=>{var e=pd();ll(e,(()=>({...i,...r,class:"swiper"})),void 0,void 0,void 0,"svelte-1fv6njc"),ca(t,e)},l=t=>{var e=md();ll(e,(()=>({...r,class:"swiper"})),void 0,void 0,void 0,"svelte-1fv6njc"),ca(t,e)};Ma(s,(t=>{e.swipeEnabled?t(a):t(l,!1)})),ca(t,o),Ki()}(h,{get gallery(){return s()},get debug(){return e.debug},get swipeEnabled(){return e.swipeEnabled},get onEvent(){return e.onEvent}});var f=Ko(h,2),p=t=>{var e=yd();!function(t,e,n){Si&&Ni();var i=new Ia(t);ls((()=>{var t,r=null!==(t=e())&&void 0!==t?t:null;i.ensure(r,r&&(t=>n(t,r)))}),ri)}(Go(e),(()=>i().Component),((t,e)=>{e(t,{get state(){return i().state},get gallery(){return s()},get isMobile(){return o()}})})),Fi(e),ca(t,e)};Ma(f,(t=>{var e;s().state.themeLoaded&&null!==(e=i())&&void 0!==e&&e.Component&&t(p)})),Fi(c),ca(t,c)};let i,r=gl(e,"scrollOffset",15),o=gl(e,"isMobile",3,!1),s=gl(e,"gallery",7),a=1920,l=s().state.playingModulePosition,c=0,u=null,d=null,h=po((()=>!s().state.introModulePlayed&&s().state.introModule)),f=po((()=>s().state.startedPlaying)),p=po((()=>s().state.currentModulesList)),m=po((()=>Gs(p).findIndex((t=>g(s().state.playingModulePosition,t.position))))),v=!1;function g(t,e){return t.itemIndex===e.itemIndex&&t.moduleIndex===e.moduleIndex}function y(t){const e=t.scrollLeft,n=t.scrollWidth-t.clientWidth;return 0===e?0:e>n?100:e/n*100}function b(t){var e,n;u=(null===(e=Gs(p)[t])||void 0===e?void 0:e.position)||null;const r=null===(n=i)||void 0===n||null===(n=n.children)||void 0===n?void 0:n[t];if(!i||!r)return;const o=i.getBoundingClientRect(),s=r.getBoundingClientRect();let a=i.scrollLeft+(s.left-o.left);const l=Math.max(0,i.scrollWidth-i.clientWidth);a=Math.max(0,Math.min(l,a)),i.scrollTo({left:a,behavior:"auto"})}function k(t){var e;if(Gs(h))return;o()&&t.preventDefault();const{target:n}=t,a=y(n),f=(null===(e=Gs(p))||void 0===e?void 0:e.length)||1,v=100/(f-1||1),b=Math.round(a/v);c=Math.min(b,f-1);const k=Gs(p)[c],x={itemIndex:s().state.activeItemIndex,moduleIndex:s().state.activeModuleIndex};if(!u){const t=i.children[Gs(m)],e=i.getBoundingClientRect(),n=t.getBoundingClientRect();r(n.x-e.x)}d&&clearTimeout(d),d=setTimeout((()=>{const t=y(n);Math.abs(t-b*v)<.25&&async function(){s().state.seeking&&(s().state.playerLoaded?s().state.currentItemsList[s().state.activeItemIndex].modules[s().state.activeModuleIndex].play():s().state.playingModulePosition=l,r(0))}()}),u?0:150),null!==u||g(k.position,x)?null!==u&&g(k.position,u)&&(u=null):(s().state.activeItemIndex=k.position.itemIndex,s().state.activeModuleIndex=k.position.moduleIndex),l=k.position}function x(){v||(s().track("coverdisplay"),v=!0)}is((()=>{const{activeItemIndex:t,activeModuleIndex:e}=s().state;t===l.itemIndex&&e===l.moduleIndex||Xs((()=>{b(Gs(p).findIndex((n=>{const{itemIndex:i,moduleIndex:r}=n.position;return t===i&&e===r})))}))})),is((()=>{Gs(m)>-1&&!u&&c!==Gs(m)&&Xs((()=>b(Gs(m))))})),is((()=>{const{seeking:t,startedPlaying:e,currentItem:n}=s().state;!t&&e&&Xs((()=>{s().preloadVariantsCovers(n,a)}))})),is((()=>{Gs(f)&&Xs((()=>{s().track("projectstartedplaying")}))}));var w=la(),_=Ho(w),I=t=>{var e=kd(),r=Go(e),o=t=>{n(t,(()=>Gs(f)),(()=>Gs(h)),(()=>"high"),(()=>x))},a=t=>{var e=la();Fa(Ho(e),19,(()=>Gs(p)),(t=>t.id),((t,e,i)=>{n(t,(()=>Gs(f)&&Gs(i)===Gs(m)),(()=>Gs(e)),(()=>0===Gs(i)?"high":"auto"),(()=>0!==Gs(i)||s().state.introModule?()=>{}:x))})),ca(t,e)};Ma(r,(t=>{Gs(h)?t(o):t(a,!1)})),Fi(e),ml(e,(t=>i=t),(()=>i)),Zs("scroll",e,k),ca(t,e)};Ma(_,(t=>{Gs(p)&&t(I)})),ca(t,w),Ki()}const _d="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};let Id;function Td(){const t=_d&&_d.navigator&&(_d.navigator.userAgent||_d.navigator.platform||_d.navigator.vendor)||"";if(Id&&Id.ua===t)return Id;const e=t.toLowerCase(),n=e.includes("android"),i=e.includes("iphone")||e.includes("ipad")||e.includes("ipod")||e.includes("ios"),r=n||i||e.includes("mobile");return Id={ua:t,isMobile:r},Id}const Ed=(t,e,n)=>{const i=t[e];return i?"function"==typeof i?i():Promise.resolve(i):new Promise(((t,i)=>{("function"==typeof queueMicrotask?queueMicrotask:setTimeout)(i.bind(null,new Error("Unknown variable dynamic import: "+e+(e.split("/").length!==n?". Note that variables only represent file names one level deep.":""))))}))},Sd=3e3,Md=new Set;const Ad="https://storage.eko.com/efu/ekoanalytics/master/latest/EkoAnalyticsPlatform.min.gz.js";function Nd(t){var e,n;if("undefined"==typeof window||null!==(e=window.EkoAnalytics)&&void 0!==e&&e.cb||null!==(n=window.EkoAnalytics)&&void 0!==n&&n.configure)return;if(function(t){let e,n;"undefined"==typeof window||(e=window,n="EkoAnalytics",e[n]=function(){e[n].f?(e[n].q.push(arguments),e[n].ts.push(Date.now())):e[n].apply(e,arguments)},e[n].f=!0,e[n].q=e[n].q||[],e[n].ts=e[n].ts||[],e[n].t=Number(new Date),e[n].sa=[],e[n].cb=[],e[n].init=function(t){e[n].id=t},e[n].childRequestIdsCallback=function(t){t.data&&"ea-ids-request"===t.data.type&&e[n].sa.push(t.source)},e.addEventListener("message",e[n].childRequestIdsCallback)),window.EkoAnalytics.cb.push((()=>{let t=(t,e,n="")=>{let i=window.location.hostname,r=i,o=i.split(".");o.length>2&&(r=o.slice(-2).join(".")),window.document.cookie=`${t}=${e}; domain=.${r}; path=/; secure; samesite=lax; ${n}`};t("easid",encodeURIComponent(window.EkoAnalytics("getSid"))),t("eauid",encodeURIComponent(window.EkoAnalytics("getUid")),"max-age=2147483647")})),window.EkoAnalytics("configure",{snowplow:{options:{appId:"ekoGalleryApp"}},ekoEnv:t?"production":"development",env:"website"})}(!t||"production"===t),!window.EkoAnalytics)return void console.warn("Failed to load LUDA script.");if(0===document.querySelectorAll(`script[src="${Ad}"]`).length){const t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src=Ad,document.head.appendChild(t)}}var Fd,Cd;"undefined"!=typeof window&&(window.addEventListener("pageshow",(function(t){t.persisted&&setTimeout((function(){window.location.reload()}),10)}),!1),null===(Fd=(Cd=window).EkoAnalytics)||void 0===Fd||Fd.call(Cd,"track","init"));function Od(t,e){var n,i;return null!==(n=null===(i=e.variantMap)||void 0===i?void 0:i[t])&&void 0!==n?n:t}function Pd(t,e,n){const i=Od(t,e);return n.variants[i]?i:n.availableVariants[0]}let Rd=!1;var Dd=oa('<div class="paging-buttons svelte-1n46o8q"><!> <!></div>'),Bd=oa("<!> <!> <!>",1),Ld=oa('<div style="position: absolute; top: 0; left: 0; width: 100%;"></div>'),zd=oa('<div class="player-container svelte-1n46o8q"><div class="player-div swipable svelte-1n46o8q"></div> <!> <!> <!></div> <!>',1),Wd=oa("<div><!></div>");const jd={hash:"svelte-1n46o8q",code:'.eko-gallery-app.svelte-1n46o8q {position:relative;width:100%;height:100%;display:flex;flex-direction:column;box-sizing:border-box;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;}.eko-gallery-app.svelte-1n46o8q:hover .paging-buttons:where(.svelte-1n46o8q) .nav-button {background-color:var(--nav_arrow_bgColor_hover, #FFFFFF);box-shadow:var(--nav_arrow_boxShadow_hover, 0 0 8px 0 rgba(0, 0, 0, 0.12));}.eko-gallery-app.svelte-1n46o8q * {box-sizing:border-box;touch-action:pan-y;font-family:var(--fontName, "Human BBY Digital"), sans-serif;}.player-container.svelte-1n46o8q {position:relative;flex:1;width:100%;pointer-events:none;overflow:hidden;border-radius:var(--playerContainer_borderRadius, 16px);display:flex;align-items:center;justify-content:center;}.player-container.svelte-1n46o8q .pause-button {opacity:var(--pauseButton_opacity, 1);}.player-container.svelte-1n46o8q:hover .pause-button {opacity:var(--pauseButton_opacity_hover, 1);}.player-div.svelte-1n46o8q {position:absolute;width:var(--videoWidth);height:var(--videoHeight);aspect-ratio:var(--videoAspect);}.swipable.svelte-1n46o8q {will-change:transform;transform:translate3d(var(--uiTranformX, 0), 0, 0);}.paging-buttons.svelte-1n46o8q {position:absolute;top:0;left:0;bottom:0;right:0;display:flex;justify-content:space-between;align-items:center;pointer-events:none;padding:0 12px;}.paging-buttons.svelte-1n46o8q .nav-button {transition:0.2s ease-in-out;box-shadow:none;}.paging-buttons.svelte-1n46o8q .nav-button img {opacity:0.6;}'};function $d(t,e){Hi(e,!0),Ua(t,jd);let n=gl(e,"config",19,(()=>({}))),i=gl(e,"variant",7),r=gl(e,"forceMobile",3,!1),o=gl(e,"videoAspectRatio",3,"unset"),s=gl(e,"loadAnalytics",3,!0),a=gl(e,"onGalleryReady",3,(()=>{})),l=gl(e,"onEvent",3,(()=>{}));var c;!Rd&&s()&&(Nd(null===(c=n())||void 0===c||null===(c=c.options)||void 0===c?void 0:c.galleryEnv),Rd=!0);let u,d=!1,h=To(Oo(new Su({...n(),onEvent:l()}))),f=To(null),p=po((()=>r()||Td().isMobile)),m=po((()=>{var t;return e.theme||(null===(t=n())||void 0===t||null===(t=t.options)||void 0===t?void 0:t.theme)})),v=po((()=>{var t;return Gs(p)&&!(null!==(t=n())&&void 0!==t&&null!==(t=t.options)&&void 0!==t&&t.disableSwipes)})),g=po((()=>{var t,e;return Gs(p)?null===(t=n())||void 0===t||null===(t=t.layout)||void 0===t?void 0:t.mobile:null===(e=n())||void 0===e||null===(e=e.layout)||void 0===e?void 0:e.desktop})),y=po((()=>{var t;return null===(t=Gs(g))||void 0===t?void 0:t.hideNav})),b=To(0),k=To(void 0),x=To(!0),w=To(Oo({width:"100%",height:"100%"}));var _,I;function T(){const t={AssetsDeliveryService:{assetsDeliveryServiceUrl:Gs(h).urls.assetsDeliveryBase},Tracker:{tag:Gs(h).uuid}};So(f,new e.EkoPlayer(u,function(t,...e){function n(t){return"[object Object]"===Object.prototype.toString.call(t)}function i(t,e){if(Array.isArray(e)){Array.isArray(t)||(t=Array.isArray(t)?t.slice():[]);const r=Math.max(t.length,e.length);for(let o=0;o<r;o++){const r=t[o],s=e[o];null!=s&&(n(r)&&n(s)?t[o]=i({...r},s):Array.isArray(r)&&Array.isArray(s)?t[o]=i(r.slice(),s):n(s)?t[o]=i({},s):Array.isArray(s)?t[o]=i([],s):t[o]=s)}return t}if(n(e)){n(t)||(t={});for(const r of Object.keys(e)){const o=t[r],s=e[r];n(o)&&n(s)?t[r]=i({...o},s):Array.isArray(o)&&Array.isArray(s)?t[r]=i(o.slice(),s):n(s)?t[r]=i({},s):Array.isArray(s)?t[r]=i([],s):void 0!==s&&(t[r]=s)}return t}return e}for(const n of e)null!==n&&i(t,n);return t}({},e.playerOptions,t))),Gs(f).on("playing",(()=>{Gs(h).state.paused=!1})),Gs(f).on("pause",(()=>{Gs(h).state.paused=!0})),Gs(f).once("playing",(()=>{Gs(h).state.startedPlaying=!0,l()("galleryloaded")}))}function E(t){var e;null===(e=Gs(h))||void 0===e||e.selectItem(t)}function S(){var t;null===(t=Gs(h))||void 0===t||t.next()}function M(){var t;null===(t=Gs(h))||void 0===t||t.prev()}function A(){Gs(f).paused?Gs(f).play():Gs(f).pause()}function N(){return`--uiTranformX: ${Gs(b)}px;--videoAspect: ${o()};--videoWidth: ${Gs(w).width};--videoHeight: ${Gs(w).height};`}_="state",I=()=>Gs(h).state,Xi("setContext").set(_,I),Gs(h).state.activeVariant=Pd(i(),n(),Gs(h).state),Ta((()=>(a()(Du(Gs(h))),n()&&e.EkoPlayer&&(T(),Gs(h).start(Gs(f))),()=>{var t;null===(t=Gs(f))||void 0===t||t.dispose(),Gs(h).dispose()}))),is((()=>{n()&&e.EkoPlayer&&(d?Xs((()=>{So(x,!1),Vs().then((()=>{var t;return Gs(h).dispose(),So(h,new Su({...n(),onEvent:l()}),!0),Gs(h).state.activeVariant=Pd(i(),n(),Gs(h).state),null===(t=Gs(f))||void 0===t||t.dispose(),So(x,!0),Vs()})).then((()=>{a()(Du(Gs(h))),T(),Gs(h).start(Gs(f))}))})):d=!0)})),is((()=>{!Rd&&s()&&(Nd(Xs((()=>{var t;return null===(t=n())||void 0===t||null===(t=t.options)||void 0===t?void 0:t.galleryEnv}))),Rd=!0)})),is((()=>{const t=Od(i(),Xs((()=>n())));t&&t!==Xs((()=>Gs(h).state.activeVariant))&&Gs(h).selectVariant(t)})),is((()=>{const t=Xs((()=>Od(i(),n())));Gs(h).state.activeVariant!==t&&Xs((()=>{i(Gs(h).state.activeVariant)}))})),is((()=>{Gs(k)&&Gs(f)&&Gs(f).loadDebugOverlay({containerElement:Gs(k)})})),is((()=>{if("unset"!==o()&&o().includes("/")){const[t,e]=o().split("/").map((t=>Number(t)));isNaN(t)||isNaN(e)||So(w,t>e?{width:"100%",height:"auto"}:{width:"auto",height:"100%"},!0)}else So(w,{width:"100%",height:"100%"},!0)})),is((()=>{!async function(t,e){if(t&&!Md.has(t)){e.state.themeLoaded=!1;try{let n;try{n=await Ed(Object.assign({"../themes/smg.scss":()=>Promise.resolve({}),"../themes/walmart.scss":()=>Promise.resolve({}),"../themes/wayfair.scss":()=>Promise.resolve({})}),`../themes/${t}.scss`,3)}catch(t){console.error(t)}if(!n||"Module"!==n[Symbol.toStringTag]){const n=`${e.urls.galleryAppDelivery}/${e.version}/${t}.css`,i=document.createElement("link");i.rel="stylesheet",i.href=n;const r=new Promise(((t,e)=>{const n=setTimeout((()=>{e("timeout")}),Sd);i.onload=()=>{t(),clearTimeout(n)}}));document.head.appendChild(i),await r}Md.add(t)}catch(e){console.warn(`[eko-gallery-app] failed to load theme: ${t}`,e)}e.state.themeLoaded=!0}else e.state.themeLoaded=!0}(Gs(m),Gs(h))}));var F=Wd(),C=Go(F),O=t=>{const n=po((()=>Gs(h).state.introModule));var i=zd(),r=Ho(i),o=Go(r);ml(o,(t=>u=t),(()=>u));var s=Ko(o,2);wd(s,{get isMobile(){return Gs(p)},get gallery(){return Gs(h)},get debug(){return e.debug},get swipeEnabled(){return Gs(v)},get onEvent(){return l()},get scrollOffset(){return Gs(b)},set scrollOffset(t){So(b,t,!0)}});var a=Ko(s,2),c=t=>{var e=Bd(),n=Ho(e),i=t=>{var e=Dd(),n=Go(e);Vu(n,{type:"prev",onClick:M}),Vu(Ko(n,2),{type:"next",onClick:S}),Fi(e),ca(t,e)};Ma(n,(t=>{Gs(v)||Gs(y)||t(i)}));var r=Ko(n,2),o=t=>{Xu(t,{get gallery(){return Gs(h)},get isMobile(){return Gs(p)}})};Ma(r,(t=>{var e;(null===(e=Gs(h).state.currentItem)||void 0===e?void 0:e.modules.length)>1&&t(o)}));var s=Ko(r,2),a=t=>{!function(t,e){Hi(e,!0),Ua(t,Zu);const n=Gi("state");let i=po((()=>n().paused));var r=Ju(),o=po((()=>e.gallery.interaction(e.onPauseClick)));r.__click=function(...t){var e;null===(e=Gs(o))||void 0===e||e.apply(this,t)};var s=Go(r),a=t=>{ca(t,Yu())},l=t=>{ca(t,Qu())};Ma(s,(t=>{Gs(i)?t(a):t(l,!1)})),Fi(r),as((()=>{al(r,"aria-label",Gs(i)?"Play":"Pause"),al(r,"data-interactiontype",Gs(i)?"play":"pause")})),ca(t,r),Ki()}(t,{onPauseClick:A,get gallery(){return Gs(h)}})};Ma(s,(t=>{Gs(h).state.startedPlaying&&t(a)})),ca(t,e)};Ma(a,(t=>{Gs(n)&&!Gs(h).state.introModulePlayed||!Gs(h).state.themeLoaded||t(c)}));var d=Ko(a,2),f=t=>{var n=la(),i=Ho(n),r=t=>{var e=Ld();ml(e,(t=>So(k,t)),(()=>Gs(k))),ca(t,e)};Ma(i,(t=>{e.debug&&t(r)})),ca(t,n)};Ma(d,(t=>{Gs(h).state.startedPlaying&&t(f)})),Fi(r);var m=Ko(r,2),g=t=>{ju(t,{onNavItemClick:E,get gallery(){return Gs(h)}})};Ma(m,(t=>{Gs(y)||Gs(n)&&!Gs(h).state.introModulePlayed||t(g)})),as((t=>Ja(r,t)),[N]),ca(t,i)};Ma(C,(t=>{n()&&Gs(x)&&t(O)})),Fi(F),as((()=>Ya(F,1,"eko-gallery-app "+(Gs(m)?`theme-${Gs(m)}`:""),"svelte-1n46o8q"))),ca(t,F),Ki()}function Ud(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var qd,Vd,Gd,Hd,Kd={exports:{}},Xd=Ud((qd||(qd=1,Gd=Kd.exports,Hd=function(){var t=function(){},e="undefined",n=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},o=null;function s(t,e){var n=t[e];if("function"==typeof n.bind)return n.bind(t);try{return Function.prototype.bind.call(n,t)}catch(e){return function(){return Function.prototype.apply.apply(n,[t,arguments])}}}function a(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function l(){for(var n=this.getLevel(),r=0;r<i.length;r++){var o=i[r];this[o]=r<n?t:this.methodFactory(o,n,this.name)}if(this.log=this.debug,typeof console===e&&n<this.levels.SILENT)return"No console available for logging"}function c(t){return function(){typeof console!==e&&(l.call(this),this[t].apply(this,arguments))}}function u(i,r,o){return"debug"===(l=i)&&(l="log"),typeof console!==e&&("trace"===l&&n?a:void 0!==console[l]?s(console,l):void 0!==console.log?s(console,"log"):t)||c.apply(this,arguments);var l}function d(t,n){var s,a,c,d=this,h="loglevel";function f(){var t;if(typeof window!==e&&h){try{t=window.localStorage[h]}catch(t){}if(typeof t===e)try{var n=window.document.cookie,i=encodeURIComponent(h),r=n.indexOf(i+"=");-1!==r&&(t=/^([^;]+)/.exec(n.slice(r+i.length+1))[1])}catch(t){}return void 0===d.levels[t]&&(t=void 0),t}}function p(t){var e=t;if("string"==typeof e&&void 0!==d.levels[e.toUpperCase()]&&(e=d.levels[e.toUpperCase()]),"number"==typeof e&&e>=0&&e<=d.levels.SILENT)return e;throw new TypeError("log.setLevel() called with invalid level: "+t)}"string"==typeof t?h+=":"+t:"symbol"==typeof t&&(h=void 0),d.name=t,d.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},d.methodFactory=n||u,d.getLevel=function(){return null!=c?c:null!=a?a:s},d.setLevel=function(t,n){return c=p(t),!1!==n&&function(t){var n=(i[t]||"silent").toUpperCase();if(typeof window!==e&&h){try{return void(window.localStorage[h]=n)}catch(t){}try{window.document.cookie=encodeURIComponent(h)+"="+n+";"}catch(t){}}}(c),l.call(d)},d.setDefaultLevel=function(t){a=p(t),f()||d.setLevel(t,!1)},d.resetLevel=function(){c=null,function(){if(typeof window!==e&&h){try{window.localStorage.removeItem(h)}catch(t){}try{window.document.cookie=encodeURIComponent(h)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(t){}}}(),l.call(d)},d.enableAll=function(t){d.setLevel(d.levels.TRACE,t)},d.disableAll=function(t){d.setLevel(d.levels.SILENT,t)},d.rebuild=function(){if(o!==d&&(s=p(o.getLevel())),l.call(d),o===d)for(var t in r)r[t].rebuild()},s=p(o?o.getLevel():"WARN");var m=f();null!=m&&(c=p(m)),l.call(d)}(o=new d).getLogger=function(t){if("symbol"!=typeof t&&"string"!=typeof t||""===t)throw new TypeError("You must supply a name when creating a logger.");var e=r[t];return e||(e=r[t]=new d(t,o.methodFactory)),e};var h=typeof window!==e?window.log:void 0;return o.noConflict=function(){return typeof window!==e&&window.log===o&&(window.log=h),o},o.getLoggers=function(){return r},o.default=o,o},(Vd=Kd).exports?Vd.exports=Hd():Gd.log=Hd()),Kd.exports));const Yd=()=>{},Qd=["trace","log","debug","info","warn","error","getLevel","setLevel"],Jd=["trace","debug","info","warn","error","silent"],Zd={TRACE:"color: white; background-color: magenta;",DEBUG:"color: black; background-color: turquoise;",INFO:"color: white; background-color: green;",WARN:"color: black; background-color: yellow;",ERROR:"color: white; background-color: red;"},th="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global;let eh={level:"trace",appName:""},nh=[];const ih="object"==typeof th&&th.performance&&"function"==typeof th.performance.now?th.performance.now.bind(th.performance):Date.now.bind(Date),rh=t=>t&&"string"==typeof t?t.toLowerCase().trim():"",oh=(()=>{try{const t=new URLSearchParams(document.location.search),e=[].concat(t.getAll("log")).concat(t.getAll("ekolog")).concat(t.getAll("ekologger")).join(",").split(",");if(0===e.length)return{};let n={};return e.forEach((t=>{const[e,i]=t.split(":");n[rh(e)]=rh(i)||"trace"})),n}catch(t){return{}}})(),sh=(t,e="")=>{const n=rh(t),i=Xd.getLogger(n);if(i.__ekologger)return i.__ekologger;e||oh[n]||oh["*"]||(i.__noExplicitLevel=!0);const r=i.methodFactory;i.methodFactory=(e,n,i)=>{const o=r(e,n,i),s=e.toUpperCase();return(...e)=>{o(`[${((t,e=3)=>(ih()/1e3).toFixed(e))()}] %c[${s}] ${eh.appName?`[${eh.appName}] `:""}[${t}]`,Zd[s],...e)}},e=oh[n]||oh["*"]||e||eh.level,i.setLevel(e,!1);const o=(...t)=>i.log(...t);return Qd.forEach((t=>{o[t]=(...e)=>(nh.forEach((n=>{n[t](...e)})),i[t](...e))})),i.__ekologger=o,o};sh.setDefaults=({appName:t="",level:e})=>{t&&"string"==typeof t&&(eh.appName=t),(e=rh(e))&&Jd.includes(e)&&(eh.level=e,Object.values(Xd.getLoggers()).filter((t=>t.__noExplicitLevel)).forEach((t=>t.setLevel(eh.level,!1))))},sh.installDriver=t=>{const e={...Qd.reduce(((e,n)=>(e[n]="function"==typeof(null==t?void 0:t[n])?t[n]:Yd,e)),{})};nh.push(e)};let ah=class{#S=new Map;on(t,e){if("function"!=typeof e)return this;const n=this.#S.get(t)||new Set;return n.add(e),this.#S.set(t,n),this}once(t,e){if("function"!=typeof e)return this;const n=(...i)=>(this.off(t,n),e(...i));return this.on(t,n)}off(t,e){if(!t)return this.#S.clear(),this;const n=this.#S.get(t);return n?e?(n.delete(e),0===n.size&&this.#S.delete(t),this):(this.#S.delete(t),this):this}trigger(t,...e){const n=this.#S.get(t);return n?(n.forEach((t=>t(...e))),this):this}};function lh(t){return"[object Object]"===Object.prototype.toString.call(t)}function ch(t,...e){const n=lh(t)?{...t}:{};return e.forEach((t=>{lh(t)&&Object.keys(t).forEach((e=>{const i=t[e],r=n[e];lh(i)&&lh(r)?n[e]=ch(r,i):Array.isArray(i)?n[e]=i.slice():n[e]=i}))})),n}function uh(t){if("string"==typeof t)return`'${t}'`;if(Array.isArray(t))return`[${t.map((t=>uh(t))).join(", ")}]`;if(lh(t))try{return JSON.stringify(t)}catch(t){return"[object Object]"}return null===t?"null":void 0===t?"undefined":String(t)}function dh(t){return Array.from(t).map((t=>uh(t))).join(", ")}var hh=new WeakSet;class fh extends ah{constructor(...t){super(),$(this,hh);const e=t.length?t[t.length-1]:void 0,n=this.name;if(!n||"string"!=typeof n)throw new Error("Extending classes must implement get name() returning a string.");this.log=sh(n,this.loglevel);const i=lh(this.defaults)?this.defaults:{},r=lh(e)&&lh(e[n])?e[n]:{};this.settings=ch({},i,r),B(hh,this,ph).call(this),B(hh,this,mh).call(this)}get name(){throw new Error("BaseModuleClass requires a name getter.")}get loglevel(){return"warn"}get defaults(){return{}}get methodsExcludedFromAutoLog(){return new Set(["constructor","on","off","once","trigger","#wrapMethodsForLogging"])}dispose(){this._disposed||(this._disposed=!0,"function"==typeof this._lifecycleCleanup&&(this._lifecycleCleanup(),this._lifecycleCleanup=null),"function"==typeof this.onDispose&&this.onDispose())}onDispose(){}}function ph(){const t=new Set,e=this.methodsExcludedFromAutoLog;let n=Object.getPrototypeOf(this);for(;n&&n!==Object.prototype;){const i=Object.getOwnPropertyNames(n);for(let r=0;r<i.length;r+=1){const o=i[r];if("constructor"===o||o.startsWith("#"))continue;if(t.has(o))continue;const s=Object.getOwnPropertyDescriptor(n,o);if(!s||"function"!=typeof s.value)continue;const a=s.value.bind(this),l=!e.has(o);this[o]=l?(...t)=>(this.log&&"function"==typeof this.log.debug&&this.log.debug(`${this.name}.${o}(${dh(t)})`),a(...t)):a,t.add(o)}n=Object.getPrototypeOf(n)}}function mh(){if("undefined"==typeof window||"function"!=typeof window.addEventListener)return;const t=()=>{try{"function"==typeof this.dispose&&this.dispose()}catch(t){this.log&&"function"==typeof this.log.error&&this.log.error("dispose failed",t)}};window.addEventListener("pagehide",t),window.addEventListener("beforeunload",t),this._lifecycleCleanup=()=>{window.removeEventListener("pagehide",t),window.removeEventListener("beforeunload",t)}}const vh="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};function gh(t){return Boolean(t)&&"object"==typeof t&&1===t.nodeType&&"function"==typeof t.appendChild}const yh=Object.freeze({NODE_ADD:"node:add",NODE_CHILDREN_CHANGED:"node:childrenchanged",NODE_LOADED:"node:loaded",NODE_LOAD_ERROR:"node:loaderror",PLACEMENT_ADDED:"placement:added",RENDER_PLACEMENT_ADDED:"renderplacement:added",TIMELINE_TIME_UPDATE:"timeline:timeupdate",TIMELINE_STATE_CHANGE:"statechange",TIMELINE_SEEKING:"seeking",TIMELINE_SEEKED:"seeked",TIMELINE_RESET:"timeline:reset",TIMELINE_PLAYER_STATE:"player:state",TIMELINE_CUEPOINT:"cuepoint",VISUAL_FRAMES_AVAILABLE:"visualframesavailable",TRACK_BUFFER_UPDATE:"track:bufferupdate",TRACK_READY:"track:ready",TRACK_UNDERFLOW:"track:underflow",CLOCK_TICK:"tick",DECODE_READY:"decode:ready",DECODE_ERROR:"decode:error",DECODER_AUDIO:"decoder:audio",DECODER_FRAME:"decoder:frame",DECODER_INIT:"decoder:init",DECODER_ERROR:"decoder:error",QOE_SCORE:"qoescore",QOE_STATUS:"qoestatus",CONTAINER_RESIZE:"containerresize",CANVAS_WEBGL_CONTEXT_LOST:"canvas.webglcontextlost",CANVAS_WEBGL_CONTEXT_RESTORED:"canvas.webglcontextrestored"});function bh(t,e){const n={};return Number.isFinite(t)&&(n.time=t),"string"==typeof e&&(n.source=e),n}function kh({placementId:t,nodeId:e,trackId:n,segmentId:i,trackType:r,pts:o,duration:s,frame:a,audioBuffer:l}={}){const c={};return t&&(c.placementId=t),e&&(c.nodeId=e),n&&(c.trackId=n),i&&(c.segmentId=i),r&&(c.trackType=r),Number.isFinite(o)&&(c.pts=o),Number.isFinite(s)&&(c.duration=s),a&&(c.frame=a),l&&(c.audioBuffer=l),c}function xh({placementId:t,nodeId:e,trackId:n,segmentId:i,trackType:r,error:o}={}){const s={};return t&&(s.placementId=t),e&&(s.nodeId=e),n&&(s.trackId=n),i&&(s.segmentId=i),r&&(s.trackType=r),o&&(s.error=o),s}var wh=new WeakMap,_h=new WeakMap,Ih=new WeakMap,Th=new WeakMap,Eh=new WeakMap,Sh=new WeakMap,Mh=new WeakMap,Ah=new WeakSet;class Nh extends fh{get defaults(){return{style:{width:"100%",height:"100%"},contextAttributes:{alpha:!1,depth:!1,stencil:!1,antialias:!1,preserveDrawingBuffer:!1,powerPreference:"low-power"}}}constructor(...t){var e,n;super(...t),$(this,Ah),W(this,wh,void 0),W(this,_h,void 0),W(this,Ih,void 0),W(this,Th,void 0),W(this,Eh,void 0),W(this,Sh,void 0),W(this,Mh,void 0);const[i,r=null]=t;j(Sh,this,r);const o=function(t,e=(null==vh?void 0:vh.document)){if(gh(t))return t;const n="string"==typeof t?t:null;if(!n||!e||"function"!=typeof e.querySelector)return null;const i=e.querySelector(n);return gh(i)?i:null}(i);if(!o)throw new Error("Canvas requires a valid mount target (HTMLElement or selector string).");j(wh,this,o);const s=null==vh?void 0:vh.document;if(!s||"function"!=typeof s.createElement)throw new Error("Canvas requires document.createElement.");var a,l;j(_h,this,s.createElement("canvas")),a=z(_h,this),l=null===(e=this.settings)||void 0===e?void 0:e.style,a&&l&&"object"==typeof l&&!Array.isArray(l)&&Object.keys(l).forEach((t=>{const e=l[t];null!=e&&(a.style[t]=String(e))})),z(wh,this).appendChild(z(_h,this));const c=null===(n=this.settings)||void 0===n?void 0:n.contextAttributes,u=c&&"object"==typeof c&&!Array.isArray(c)?c:void 0;if(j(Mh,this,u),j(Ih,this,z(_h,this).getContext("webgl2",u)),!z(Ih,this))throw new Error("Canvas WebGL2 context is not available.");B(Ah,this,Ch).call(this)}get name(){return"Canvas"}get element(){return z(_h,this)}get gl(){return z(Ih,this)}onDispose(){B(Ah,this,Oh).call(this),z(_h,this)&&z(_h,this).parentNode&&z(_h,this).parentNode.removeChild(z(_h,this)),j(Ih,this,null),j(_h,this,null),j(wh,this,null),j(Sh,this,null),j(Mh,this,null),j(Th,this,null),j(Eh,this,null)}}function Fh(t,e){var n,i;this.trigger(t,e),null===(n=z(Sh,this))||void 0===n||null===(i=n.trigger)||void 0===i||i.call(n,t,e)}function Ch(){z(_h,this)&&(j(Th,this,(t=>{"function"==typeof(null==t?void 0:t.preventDefault)&&t.preventDefault(),this.log.error("WebGL context lost",t),B(Ah,this,Fh).call(this,yh.CANVAS_WEBGL_CONTEXT_LOST,t)})),j(Eh,this,(t=>{var e;j(Ih,this,(null===(e=z(_h,this))||void 0===e?void 0:e.getContext("webgl2",z(Mh,this)))||null),z(Ih,this)?B(Ah,this,Fh).call(this,yh.CANVAS_WEBGL_CONTEXT_RESTORED,t):this.log.error("WebGL context restored event fired but WebGL2 context is still unavailable.",t)})),z(_h,this).addEventListener("webglcontextlost",z(Th,this)),z(_h,this).addEventListener("webglcontextrestored",z(Eh,this)))}function Oh(){z(_h,this)&&(z(_h,this).removeEventListener("webglcontextlost",z(Th,this)),z(_h,this).removeEventListener("webglcontextrestored",z(Eh,this)))}var Ph=new WeakMap,Rh=new WeakMap,Dh=new WeakMap,Bh=new WeakMap,Lh=new WeakMap,zh=new WeakMap,Wh=new WeakSet;class jh extends fh{get name(){return"ContainerSize"}get containerWidth(){return z(Rh,this)}get containerHeight(){return z(Dh,this)}get width(){return z(Rh,this)}get height(){return z(Dh,this)}constructor(...t){super(...t),$(this,Wh),W(this,Ph,void 0),W(this,Rh,0),W(this,Dh,0),W(this,Bh,null),W(this,Lh,null),W(this,zh,null);const[e]=t;var n;j(Ph,this,(n=e)&&n.element&&gh(n.element)?n.element:gh(n)?n:null),z(Ph,this)&&(B(Wh,this,Uh).call(this,!0),B(Wh,this,$h).call(this))}onDispose(){z(Bh,this)&&"function"==typeof z(Bh,this).disconnect&&z(Bh,this).disconnect(),j(Bh,this,null),z(zh,this)&&"function"==typeof(null==vh?void 0:vh.removeEventListener)&&vh.removeEventListener("resize",z(zh,this)),j(zh,this,null),z(Lh,this)&&((null==vh?void 0:vh.clearInterval)||clearInterval)(z(Lh,this)),j(Lh,this,null),j(Ph,this,null)}}function $h(){if(!z(Ph,this))return;const t=null==vh?void 0:vh.ResizeObserver;if("function"==typeof t)return j(Bh,this,new t((()=>B(Wh,this,Uh).call(this)))),void z(Bh,this).observe(z(Ph,this));j(zh,this,(()=>B(Wh,this,Uh).call(this))),"function"==typeof(null==vh?void 0:vh.addEventListener)&&vh.addEventListener("resize",z(zh,this));const e=(null==vh?void 0:vh.setInterval)||setInterval;j(Lh,this,e((()=>B(Wh,this,Uh).call(this)),250))}function Uh(t=!1){if(!z(Ph,this))return;const{width:e,height:n}=function(t){const e=Number(null==t?void 0:t.clientWidth),n=Number(null==t?void 0:t.clientHeight);return{width:Number.isFinite(e)&&e>0?Math.round(e):0,height:Number.isFinite(n)&&n>0?Math.round(n):0}}(z(Ph,this));(t||e!==z(Rh,this)||n!==z(Dh,this))&&(j(Rh,this,e),j(Dh,this,n),this.trigger("containerresize",{width:e,height:n}))}var qh={VIDEO_SOURCE_PREFIX:"__SRC_VID:",TEXTURE_SOURCE_PREFIX:"__SRC_TEXTURE:",PREVIOUS_OUTPUT_PREFIX:"__PREVIOUS:",SAVED_FRAME_PREFIX:"__SAVED_FRAME:",SYSTEM_NODES:{FILTERS:{RENDER_TO_CANVAS:"__default"},TAGS:{ATOM:"atom",FILTER:"filter",COMPOSITE_FILTER:"composite",TRANSITION_FILTER:"transition"}},MESSAGES:{UPDATE_OPTIONS:"update_options"}};class Vh{constructor(t,e){this.canvasSource=t,this.startRendering=e,this.gl=null,this.glOptions=null}init(t,e,n){this.glOptions=n||{};const i=this.initCanvas(this.canvasSource,t,e);return this.initWebgl(i,this.glOptions)}initCanvas(){throw new Error("implement on concrete class")}getContextConfig(t={}){if(!t||"object"!=typeof t)return{contextType:"webgl",contextAttributes:void 0};const{contextType:e,contextAttributes:n,__shaderGraph:i,...r}=t,o=Object.prototype.hasOwnProperty.call(t,"contextAttributes");let s=o?n:r;return o||!s||"object"!=typeof s||Array.isArray(s)||0!==Object.keys(s).length||(s=void 0),{contextType:e||"webgl",contextAttributes:s}}initWebgl(t,e={}){const{contextType:n,contextAttributes:i}=this.getContextConfig(e),r=t.getContext(n,i);if(!r)throw new Error(`Browser doesn't support ${n}`);return r.enable(r.BLEND),r.disable(r.DEPTH_TEST),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),r}isStartRendering(){return this.startRendering}}var Gh,Hh={exports:{}},Kh=(Gh||(Gh=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function i(){}function r(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,i,o,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");var a=new r(i,o||t,s),l=n?n+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],a]:t._events[l].push(a):(t._events[l]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new i:delete t._events[e]}function a(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),a.prototype.eventNames=function(){var t,i,r=[];if(0===this._eventsCount)return r;for(i in t=this._events)e.call(t,i)&&r.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},a.prototype.listeners=function(t){var e=n?n+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,o=i.length,s=new Array(o);r<o;r++)s[r]=i[r].fn;return s},a.prototype.listenerCount=function(t){var e=n?n+t:t,i=this._events[e];return i?i.fn?1:i.length:0},a.prototype.emit=function(t,e,i,r,o,s){var a=n?n+t:t;if(!this._events[a])return!1;var l,c,u=this._events[a],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,i),!0;case 4:return u.fn.call(u.context,e,i,r),!0;case 5:return u.fn.call(u.context,e,i,r,o),!0;case 6:return u.fn.call(u.context,e,i,r,o,s),!0}for(c=1,l=new Array(d-1);c<d;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var h,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(t,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,e);break;case 3:u[c].fn.call(u[c].context,e,i);break;case 4:u[c].fn.call(u[c].context,e,i,r);break;default:if(!l)for(h=1,l=new Array(d-1);h<d;h++)l[h-1]=arguments[h];u[c].fn.apply(u[c].context,l)}}return!0},a.prototype.on=function(t,e,n){return o(this,t,e,n,!1)},a.prototype.once=function(t,e,n){return o(this,t,e,n,!0)},a.prototype.removeListener=function(t,e,i,r){var o=n?n+t:t;if(!this._events[o])return this;if(!e)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==e||r&&!a.once||i&&a.context!==i||s(this,o);else{for(var l=0,c=[],u=a.length;l<u;l++)(a[l].fn!==e||r&&!a[l].once||i&&a[l].context!==i)&&c.push(a[l]);c.length?this._events[o]=1===c.length?c[0]:c:s(this,o)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&s(this,e)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,t.exports=a}(Hh)),Hh.exports),Xh=Ud(Kh);class Yh extends Vh{constructor(t){super(t,!0),this.setSrcVidTracksFn=null,this.shouldUpdateTexture=!0,this.onPlayerSeeking=this.onPlayerSeeking.bind(this),this.onPlayerSeeked=this.onPlayerSeeked.bind(this),this.onPlayerNodeStart=this.onPlayerNodeStart.bind(this),this.oncePlayerPlaying=this.oncePlayerPlaying.bind(this);const e=new Xh;this.on=e.on.bind(e),this.off=e.off.bind(e),this.once=e.once.bind(e),this.trigger=e.emit.bind(e)}onPlayerSeeking(){this.shouldUpdateTexture=!1}onPlayerSeeked(){this.shouldUpdateTexture=!0}onPlayerNodeStart(){this.shouldUpdateTexture=!0,"function"==typeof this.player.canvas.drawFrame&&this.player.canvas.drawFrame(),this.trigger("forcerender")}oncePlayerPlaying(){this.onPlayerNodeStart()}addPlayerListeners(){this.player&&(this.player.on("seeking",this.onPlayerSeeking),this.player.on("seeked",this.onPlayerSeeked),this.player.on("nodestart",this.onPlayerNodeStart),this.player.once("playing",this.oncePlayerPlaying))}removePlayerListeners(){this.player&&(this.player.off("seeking",this.onPlayerSeeking),this.player.off("seeked",this.onPlayerSeeked),this.player.off("nodestart",this.onPlayerNodeStart),this.player.off("playing",this.oncePlayerPlaying))}initCanvas(t,e,n){var i;this.player=t,this.setSrcVidTracksFn=e;const{contextType:r,contextAttributes:o}=this.getContextConfig(this.glOptions),s=!1!==(null===(i=this.glOptions)||void 0===i||null===(i=i.__shaderGraph)||void 0===i?void 0:i.forwardContextAttributes)&&null!=(a=o)&&"object"==typeof a&&!Array.isArray(a)&&Object.keys(a).length>0;var a;const l={contextType:r};s&&(l.contextAttributes=o),t.initPlugin("canvas",l);const c={drawFrame:this.canvasDrawFrameFn.bind(this),resize:n,contextType:r,offscreenVideoCanvasEnabled:!1,viewportModeEnabled:!0,fps:0};return s&&(c.contextAttributes=o),t.canvas.init(c),t.paused&&0===t.currentTime&&(this.shouldUpdateTexture=!1),this.addPlayerListeners(),t.canvas.canvas}canvasDrawFrameFn(t,e,n){var i;this.setSrcVidTracksFn&&this.shouldUpdateTexture&&t&&e&&n&&(n.videoWidth||n.displayWidth)&&(n.videoHeight||n.displayHeight)&&(!(i=n)||"boolean"!=typeof i.isDataLoaded||i&&i.isDataLoaded&&(void 0===i.isFrameTextureReady||i.isFrameTextureReady))&&this.setSrcVidTracksFn(n)}async recover(){if(this.player&&this.player.paused)return new Promise((t=>{this.player.once("seeked",(()=>{this.shouldUpdateTexture=!0,t()})),this.player.currentTime=this.player.currentTime}))}dispose(){this.player&&(this.player.canvas&&"function"==typeof this.player.canvas.dispose&&this.player.canvas.dispose(),this.removePlayerListeners(),this.player=null)}}class Qh extends Vh{constructor(t){super(t,!1)}initCanvas(t,e){const n=function(){const t=document.querySelector("video");t&&t.videoHeight&&e(t),requestAnimationFrame(n)};return requestAnimationFrame(n),document.getElementById(t)}}class Jh extends Vh{constructor(t){super(t,!1)}initCanvas({src:t,dest:e},n,i){const r="string"==typeof e?document.querySelector(e):e,o="undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement,s=()=>{this.isDisposed||(t&&t.videoHeight&&n(t),requestAnimationFrame(s))};return o?requestAnimationFrame(s):"function"==typeof t?t(n,i):n(t),r}dispose(){this.isDisposed=!0}}var Zh=function(t){let e;return e="string"==typeof t?new Qh(t):t&&t.src&&t.dest?new Jh(t):new Yh(t),e};function tf(t){return Array.isArray(t)||(t=[t]),t}class ef{constructor(t){this.store=t?{...t.get()}:{}}reset(){this.store={}}get(t){if(!t)return this.store;const e=(t=tf(t)).reduce(((t,e)=>{const n=this.store[e];return t.push(n),t}),[]);return 1===e.length?e[0]:e}set(t,e){if(t=tf(t),e=tf(e),t.length!==e.length)throw new Error(`cant set values ${e} to keys ${t}, length did not match`);t.forEach(((t,n)=>{this.store[t]=e[n]}))}}class nf{constructor(t,e,n,i){this.gl=i.gl,this.unit=t,this.bindPoint=e,this.height=1080,this.width=1920,this.textureObject=n.object,this.textureObjectInfo=n,this.isStatic=!1,n.needRefresh&&this.setParameters()}getUnit(){return this.unit}getObject(){return this.textureObject}bind(){this.gl.bindTexture(this.bindPoint,this.textureObject)}fill(){throw new Error("impl in concrete class")}setParameters(){this.bind(),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR)}active(){this.gl.activeTexture(this.gl.TEXTURE0+this.getUnit())}beforeUse(){this.active(),this.bind()}dispose(){this.gl.deleteTexture(this.textureObject)}setHeight(t){this.height=t}setWidth(t){this.width=t}getHeight(){if(!this.height)throw new Error(`texture ${this.unit} no height init `);return this.height}getWidth(){if(!this.width)throw new Error(`texture ${this.unit} no width init `);return this.width}}const rf=sh("frame","warn");let of=!1;if("undefined"!=typeof window&&window.InterludePlayer){let t=window.InterludePlayer.environment,e=t.isAffectedBySafari17SeekBug,n=t.ua.includes("WMT1H")&&t.ua.includes("iOS/17");of=e||n}function sf(t,e){const n=t.gl;var i;n.texImage2D(t.bindPoint,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e),t.__hasAllocated=!0,i=t,Number.isFinite(i.width)&&Number.isFinite(i.height)&&(i.actualWidth=i.width,i.actualHeight=i.height,i.textureObjectInfo&&(i.textureObjectInfo.allocatedWidth=i.width,i.textureObjectInfo.allocatedHeight=i.height))}class af extends nf{fill(t){if(of&&(t.paused||"undefined"!=typeof document&&"hidden"===document.visibilityState))return;if(t.__closed)return;this.bind();const e=function(t,e){let n=!t.__hasAllocated;return e?(e.width===t.width&&e.height===t.height||(n=!0),t.width=e.width,t.height=e.height,n):n}(this,function(t){if(!t)return;const e=[[t.displayWidth,t.displayHeight],[t.codedWidth,t.codedHeight],[t.videoWidth,t.videoHeight],[t.naturalWidth,t.naturalHeight],[t.width,t.height]];for(let t=0;t<e.length;t+=1){const[n,i]=e[t],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}(t)),n=performance.now();!function(t,e,n){const i=t.gl,r=function(t){if("undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement)return!0;const e="object"==typeof window?window:"object"==typeof self?self:null,n=e&&e.VideoFrame;return"function"==typeof n&&t instanceof n}(e);r&&(t.__useSubImage=!1),n||!1===t.__useSubImage||r?sf(t,e):(i.texSubImage2D(t.bindPoint,0,0,0,i.RGBA,i.UNSIGNED_BYTE,e),void 0===t.__useSubImage&&(i.getError()!==i.NO_ERROR?(t.__useSubImage=!1,sf(t,e)):t.__useSubImage=!0))}(this,t,e);const i=(performance.now()-n)/1e3;i>=.1&&rf.warn(`[fill] texImage2D() took ${i.toFixed(3)} seconds to execute.`),"function"==typeof t.close&&!0!==t.__keepOpen&&(t.close(),t.__closed=!0)}}class lf extends nf{constructor(t,e,n){super(...arguments),n.needRefresh&&(this.fill(null),n.needRefresh=!1)}fill(t){if(this.bind(),t&&t.tagName&&"IMG"===t.tagName){const e=Number(t.naturalWidth||t.width),n=Number(t.naturalHeight||t.height);this.gl.texImage2D(this.bindPoint,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),Number.isFinite(e)&&Number.isFinite(n)&&(this.actualWidth=e,this.actualHeight=n,this.textureObjectInfo&&(this.textureObjectInfo.allocatedWidth=e,this.textureObjectInfo.allocatedHeight=n))}else{const e=this.gl.canvas.width,n=this.gl.canvas.height;this.gl.texImage2D(this.bindPoint,0,this.gl.RGBA,e,n,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),Number.isFinite(e)&&Number.isFinite(n)&&(this.actualWidth=e,this.actualHeight=n,this.textureObjectInfo&&(this.textureObjectInfo.allocatedWidth=e,this.textureObjectInfo.allocatedHeight=n))}}}var cf=function(t,e,n,i,r){let o;switch(t){case"frame":o=new af(e,n,i,r);break;case"pixel":o=new lf(e,n,i,r);break;default:throw new Error(`cant recognize type ${t}`)}return o};class uf{constructor(t){this.gl=t.gl;const e=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS)||20;return this.maxTextures=Math.min(20,e),this.textureObjectPool=[],this.textureUnitsPool=new Set(Array(this.maxTextures).keys()),this.activeTextures=t.activeTextures instanceof Set?t.activeTextures:new Set,{createTexture:this.createTexture.bind(this),releaseTexture:this.releaseTexture.bind(this),refreshTextureObjects:this.refreshTextureObjects.bind(this),refreshActiveTextures:this.refreshActiveTextures.bind(this)}}getTextureObject(){return this.textureObjectPool.pop()||{object:this.gl.createTexture(),needRefresh:!0}}getTextureUnit(){const t=this.textureUnitsPool.values(),e=Math.min.apply(null,[...t]);return this.textureUnitsPool.delete(e),e}createTexture(t){const e=t&&t.type||{},n=this.gl.TEXTURE_2D,i=this.getTextureUnit(),r=this.getTextureObject(),o=cf(e,i,n,r,{gl:this.gl});return this.activeTextures.add(o),o}releaseTexture(t){this.textureUnitsPool.has(t.getUnit())||(this.textureObjectPool.push({object:t.getObject(),needRefresh:!1}),this.textureUnitsPool.add(t.getUnit())),this.activeTextures.delete(t)}refreshTextureObjects(){this.textureObjectPool.forEach((t=>{t.needRefresh=!0}))}refreshActiveTextures(){const t=new Set;this.activeTextures.forEach((e=>{if(!e||"function"!=typeof e.getUnit)return;t.add(e.getUnit());const n={object:this.gl.createTexture(),needRefresh:!0};e.gl=this.gl,e.textureObjectInfo=n,e.textureObject=n.object,e.__hasAllocated=!1,e.__useSubImage=void 0,e.actualWidth=null,e.actualHeight=null,"function"==typeof e.setParameters&&e.setParameters()})),this.textureObjectPool=[],this.textureUnitsPool=new Set(Array(this.maxTextures).keys()),t.forEach((t=>{this.textureUnitsPool.delete(t)}))}}const df=qh.VIDEO_SOURCE_PREFIX,hf=qh.TEXTURE_SOURCE_PREFIX,ff=qh.PREVIOUS_OUTPUT_PREFIX,pf=qh.SAVED_FRAME_PREFIX;function mf(t,e,n){t.set(`${df}${n}`,e)}function vf(t,e,n){t.set(`${ff}${n}`,e)}function gf(t,e,n){t.set(`${pf}${n}`,e)}class yf{constructor(t){return this.gl=t.gl,this.glSource=t.glSource,this.textureManager=t.textureManager,this.capturedFramesManager=t.capturedFramesManager,{setVideoSources:this.setVideoSources.bind(this),setTextureSource:this.setTextureSource.bind(this),getInput:this.getInput.bind(this),getPrevOutput:this.getPrevOutput.bind(this),setOutputs:this.setOutputs.bind(this),disposeTextures:this.disposeTextures.bind(this),disposeAllStore:this.disposeAllStore.bind(this)}}setVideoSources(t){for(const[e,n]of Object.entries(this.capturedFramesManager.getCurrentFrames()))mf(t,n,e),vf(t,n,e);for(const[e,n]of Object.entries(this.capturedFramesManager.getSavedFrames()))gf(t,n,e)}setTextureSource(t,e,n){t.set(`${hf}${n}`,e)}getInput(t,e){return t.get(e)}getPrevOutput(t,e){return e=Number.isInteger(e)?e:0,t.get(`${ff}${e}`)}setOutputs(t,e=[],n=[]){if(Array.isArray(n)||(n=[n]),e.length>n.length)throw new Error(`output ids ${e.length} is bigger then supplied outputs ${n.length}`);n.forEach(((e,n)=>{vf(t,e,n)})),e.forEach(((e,i)=>{t.set(e,n[i])}))}disposeTextures(t,e){const n=e.getUnit();t.forEach((t=>{const e=t.getUnit();this.capturedFramesManager.isReservedUnit(e)||n===e||this.textureManager.releaseTexture(t)}))}disposeAllStore(t){const e=new Set;Object.values(t.get()).forEach((t=>{const n=t.getUnit();this.capturedFramesManager.isReservedUnit(n)||e.has(n)||t.isStatic||(this.textureManager.releaseTexture(t),e.add(n))}))}}class bf{constructor(t){this.context=t}bind(){throw new Error("impl in concrete")}}let kf=100,xf=100;function wf(t,e){kf=t,xf=e}let _f=class extends bf{bind(t){var e,n;this.context.gl.bindFramebuffer(this.context.gl.FRAMEBUFFER,null);const i=null===(e=this.context.gl)||void 0===e||null===(e=e.canvas)||void 0===e?void 0:e.width,r=null===(n=this.context.gl)||void 0===n||null===(n=n.canvas)||void 0===n?void 0:n.height;return Number.isFinite(i)&&Number.isFinite(r)&&i>0&&r>0&&(this.context.gl.viewport(0,0,i,r),wf(i,r)),t}},If=class extends bf{bind(t){Array.isArray(t)||(t=[t]),this.context.gl.bindFramebuffer(this.context.gl.FRAMEBUFFER,this.context.frameBufferObject);const e=this.context.textureManager.createTexture({type:"pixel"}),n=this.context.gl.COLOR_ATTACHMENT0;if(this.context.gl.framebufferTexture2D(this.context.gl.FRAMEBUFFER,n,this.context.gl.TEXTURE_2D,e.textureObject,0),this.context.gl.clear(this.context.gl.COLOR_BUFFER_BIT),!0===this.context.useCanvasSizedFilterTargets){var i,r;const t=null===(i=this.context.gl)||void 0===i||null===(i=i.canvas)||void 0===i?void 0:i.width,n=null===(r=this.context.gl)||void 0===r||null===(r=r.canvas)||void 0===r?void 0:r.height;Number.isFinite(t)&&t>0&&e.setWidth(t),Number.isFinite(n)&&n>0&&e.setHeight(n);const o=e.textureObjectInfo,s=null==o?void 0:o.allocatedWidth,a=null==o?void 0:o.allocatedHeight;Number.isFinite(t)&&Number.isFinite(n)&&(s!==t||a!==n)&&"function"==typeof e.fill&&e.fill(null)}else t[0]&&(e.setHeight(t[0].getHeight()),e.setWidth(t[0].getWidth()));return e}};class Tf{constructor(t){this.gl=t.gl,this.textureManager=t.textureManager,this.useCanvasSizedFilterTargets=t.useCanvasSizedFilterTargets,this.bufferIndex=0,this.frameBufferObjectsPool=[this.gl.createFramebuffer(),this.gl.createFramebuffer(),this.gl.createFramebuffer()]}getFrameBufferObject(){const t=this.frameBufferObjectsPool[this.bufferIndex];return this.bufferIndex=this.bufferIndex++%this.frameBufferObjectsPool.length,t}create(t){let e;return e=t===qh.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS?new _f({gl:this.gl}):new If({gl:this.gl,textureManager:this.textureManager,frameBufferObject:this.getFrameBufferObject(),useCanvasSizedFilterTargets:this.useCanvasSizedFilterTargets}),e}}function Ef(t,e,n){const i=e===t.VERTEX_SHADER?"vertex":"fragment";var r;r=t,Boolean(r)&&("undefined"!=typeof WebGL2RenderingContext&&r instanceof WebGL2RenderingContext||"function"==typeof r.createVertexArray)&&(n=function(t="",e){if("string"!=typeof t||!t||function(t=""){return"string"==typeof t&&t.includes("#version 300 es")}(t))return t;let n=t;if("vertex"===e&&(n=n.replace(/\battribute\b/g,"in"),n=n.replace(/\bvarying\b/g,"out")),"fragment"===e&&(n=n.replace(/\bvarying\b/g,"in"),n=n.replace(/\bgl_FragColor\b/g,"fragColor")),n=n.replace(/\btexture2D\b/g,"texture"),n=`#version 300 es\n${n}`,"fragment"===e&&n.includes("fragColor")&&!/\bout\s+vec4\s+fragColor\s*;/.test(n)){const t=n.split("\n");let e=1;for(let n=1;n<t.length;n+=1)if(t[n].trim().startsWith("precision ")){e=n+1;break}t.splice(e,0,"out vec4 fragColor;"),n=t.join("\n")}return n}(n,i));const o=t.createShader(e);if(!o)throw new Error(`Failed to create ${i} shader`);if(t.shaderSource(o,n),t.compileShader(o),t.getShaderParameter(o,t.COMPILE_STATUS))return o;const s=t.getShaderInfoLog(o);throw t.deleteShader(o),new Error(s)}var Sf=function(t,e){return Ef(t,t.VERTEX_SHADER,e)},Mf=function(t,e){return Ef(t,t.FRAGMENT_SHADER,e)};const Af={position_3d:0,texture_coordinate_2d:1};var Nf=function(t,e,n){const i=t.createProgram();if(t.attachShader(i,e),t.attachShader(i,n),Object.entries(Af).forEach((([e,n])=>{t.bindAttribLocation(i,n,e)})),t.linkProgram(i),t.getProgramParameter(i,t.LINK_STATUS))return i;const r=t.getProgramInfoLog(i);throw t.deleteProgram(i),new Error(r)},Ff=[-1,-1,1,1,-1,1,-1,1,1,1,1,1],Cf=[0,1,2,2,1,3],Of=[0,0,1,0,0,1,1,1];const Pf=96,Rf=[new Float32Array(new ArrayBuffer(Pf)),new Float32Array(new ArrayBuffer(Pf)),new Float32Array(new ArrayBuffer(Pf)),new Float32Array(new ArrayBuffer(Pf)),new Float32Array(new ArrayBuffer(Pf)),new Float32Array(new ArrayBuffer(Pf))],Df=[new Int16Array(6),new Int16Array(6),new Int16Array(6)];class Bf{constructor(t,e,n){return this.gl=n.gl,this.program=n.program,this.bindPoint=e,this.location=this.gl.getAttribLocation(this.program,t),this.buffer=this.gl.createBuffer(),this.floatBufferCounter=0,this.unit16BufferCounter=0,{fillBuffer:this.fillBuffer.bind(this),bindBuffer:this.bindBuffer.bind(this),setPointer:this.setPointer.bind(this),dispose:this.dispose.bind(this)}}enable(){this.gl.enableVertexAttribArray(this.location)}bindBuffer(){this.gl.bindBuffer(this.bindPoint,this.buffer)}getBuffer(){let t;switch(this.bindPoint){case this.gl.ARRAY_BUFFER:t=Rf[this.floatBufferCounter],this.floatBufferCounter=this.floatBufferCounter++%Rf.length;break;case this.gl.ELEMENT_ARRAY_BUFFER:t=Df[this.unit16BufferCounter],this.unit16BufferCounter=this.unit16BufferCounter++%Df.length;break;default:throw new Error("cant get buffer for this bind point: ",this.bindPoint)}return t}fillBuffer(t){this.bindBuffer();const e=this.getBuffer();e.set(t,0),this.gl.bufferData(this.bindPoint,e,this.gl.STATIC_DRAW)}getPointerData(){throw new Error("you should impl this function")}setPointer(){this.bindBuffer(),this.enable();const t=this.getPointerData();this.gl.vertexAttribPointer(this.location,t.size,t.type,t.normalize,t.stride,t.offset)}dispose(){this.gl.deleteBuffer(this.buffer)}}const Lf={position_3d:class extends Bf{getPointerData(){return{size:3,type:this.gl.FLOAT,normalize:!1,stride:0,offset:0}}},position_indexes:class extends Bf{setPointer(){}getPointerData(){}enable(){}},texture_coordinate_2d:class extends Bf{getPointerData(){return{size:2,type:this.gl.FLOAT,normalize:!0,stride:0,offset:0}}}};var zf=function(t,e,n){const i=Lf[t];if(!i)throw new Error(`${t} is not a attribute name,choose from list: ${Object.keys(Lf)}`);return new i(t,e,n)};class Wf{constructor(t,e){this.gl=e.gl,this.program=e.program,this.location=this.gl.getUniformLocation(this.program,t)}compute(){return this}set(){return this}}class jf extends Wf{set(t){this.gl.uniform1fv(this.location,t)}}class $f extends Wf{set(t){t&&(t.beforeUse(),this.gl.uniform1i(this.location,t.getUnit()))}}const Uf="first_texture_dimensions",qf="viewport_dimensions",Vf="time",Gf={RUNTIME_OPTIONS:"runtimeOptions[0]",STATIC_OPTIONS:"staticOptions[0]",FIRST_TEXTURE:"first_texture",SECOND_TEXTURE:"second_texture",FIRST_MATRIX:"first_mat4"},Hf={[Gf.FIRST_TEXTURE]:$f,[Gf.SECOND_TEXTURE]:$f,[Gf.FIRST_MATRIX]:class extends Wf{set(t){this.gl.uniformMatrix4fv(this.location,!1,t)}},[Gf.STATIC_OPTIONS]:jf,[Gf.RUNTIME_OPTIONS]:jf};var Kf=function(t,e){const n=Hf[t];if(!n)throw new Error(`${t} is not a attribute name,choose from list: ${Object.keys(Hf)}`);return new n(t,e)},Xf=function(t,e){let n=(Date.now()-t||0)/(e||1);return n=Number.parseFloat(n).toFixed(7),n=Math.min(1,n),n};const Yf="position_3d",Qf="position_indexes",Jf="texture_coordinate_2d";class Zf{constructor(t,e,n,i){this.type=t,this.gl=i.gl,this.frameBuffer=i.frameBufferFactory.create(t),this.rebindAttributesOnProgramSwitch=!1!==i.rebindAttributesOnProgramSwitch,this.vertexShader=Sf(this.gl,e.vertex),this.fragmentShader=Mf(this.gl,e.fragment),this.program=Nf(this.gl,this.vertexShader,this.fragmentShader);const r={gl:this.gl,program:this.program};this.attributes=function(t,e){const n={};return t=t||[],(t=[{id:Yf,bindPoint:e.gl.ARRAY_BUFFER},{id:Qf,bindPoint:e.gl.ELEMENT_ARRAY_BUFFER},{id:Jf,bindPoint:e.gl.ARRAY_BUFFER}].concat(t)).forEach((t=>{const i=t.id;n[i]=zf(i,t.bindPoint,e)})),n}(n.attributes,r),this.uniforms=function(t,e){const n={};return(t=t||[]).forEach((t=>{const i=t.id;n[i]=Kf(i,e)})),n}(n.uniforms,r),this.gl.useProgram(this.program),i.__handleAttributesInitedOnce||(this.handleAttributes(),i.__handleAttributesInitedOnce=!0),this.handleStaticUniforms(i.options)}static getFilterType(){throw new Error("impl in concrete class")}static getInputsCount(){throw new Error(`impl in concrete class ${this.getFilterType()}`)}static getInitialOptions(){throw new Error(`impl in concrete class ${this.getFilterType()}`)}static getUniformInfo(t){let e=[{id:Gf.RUNTIME_OPTIONS},{id:Gf.STATIC_OPTIONS}];return(t.getUniformList||Zf.getUniformList)().forEach((t=>{Object.values(Gf).includes(t)&&e.push({id:t})})),e}handleRuntimeUniforms(t,e){const{inputTextures:n,viewportDimensions:i}=t;let r=Array.isArray(n)?n:[n],o=[];(this.constructor.getUniformList||Zf.getUniformList)().forEach((t=>{switch(t){case Gf.FIRST_TEXTURE:this.uniforms[Gf.FIRST_TEXTURE].set(r[0]);break;case Gf.SECOND_TEXTURE:this.uniforms[Gf.SECOND_TEXTURE].set(r[1]);break;case Uf:o=[...o,r[0].getWidth(),r[0].getHeight()];break;case qf:o=[...o,i.width,i.height];break;case Vf:{const t=Xf(e.startTime,e.duration);o=[...o,t];break}}})),o.length>0&&this.uniforms[Gf.RUNTIME_OPTIONS].set(o)}static getUniformList(){return[Gf.FIRST_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(){}handleAttributes(){this.attributes[Yf].fillBuffer(Ff),this.attributes[Yf].setPointer(),this.attributes[Qf].fillBuffer(Cf),this.attributes[Jf].fillBuffer(Of),this.attributes[Jf].setPointer()}disposeAttributes(){Object.values(this.attributes).forEach((t=>{t.dispose()}))}render(t,e){const n=this.frameBuffer.bind(t);let i={width:kf,height:xf};return this.gl.useProgram(this.program),this.rebindAttributesOnProgramSwitch&&this.gl.__shaderGraphLastProgram!==this.program&&(this.handleAttributes(),this.gl.__shaderGraphLastProgram=this.program),this.handleRuntimeUniforms({inputTextures:t,viewportDimensions:i},e),this.draw(),n}draw(){const t=this.gl.TRIANGLES,e=this.gl.UNSIGNED_SHORT;this.gl.drawElements(t,6,e,0)}updateStaticUniforms(t){this.gl.useProgram(this.program),this.handleStaticUniforms(t)}dispose(){this.gl.detachShader(this.program,this.vertexShader),this.gl.deleteShader(this.vertexShader),this.gl.detachShader(this.program,this.fragmentShader),this.gl.deleteShader(this.fragmentShader),this.gl.deleteProgram(this.program)}}class tp extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(tp)};super(tp.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n // we need to flip y poisiton bacause webgl display the canvas\n // with 0,0 being the bottom left corner \n // insted of the traditional top left\n float flip_y_position = position_3d.y * (-1.0);\n vec4 normalize_poistion = vec4(position_3d.x, flip_y_position, position_3d.z, 1);\n \n gl_Position = normalize_poistion;\n \n current_texture_coordinate_2d = texture_coordinate_2d;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n gl_FragColor = texture2D(first_texture, current_texture_coordinate_2d);\n}"},e,t)}static getFilterType(){return"__default"}static getInputsCount(){return 1}static getInitialOptions(){return{}}}var ep,np="undefined"!=typeof Float32Array?Float32Array:Array;function ip(){var t=new np(3);return np!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function rp(t,e,n){var i=new np(3);return i[0]=t,i[1]=e,i[2]=n,i}function op(){var t=new np(4);return np!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}ip(),function(){var t;t=new np(4),np!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}(),ip(),rp(1,0,0),rp(0,1,0),op(),op(),ep=new np(9),np!=Float32Array&&(ep[1]=0,ep[2]=0,ep[3]=0,ep[5]=0,ep[6]=0,ep[7]=0),ep[0]=1,ep[4]=1,ep[8]=1;class sp extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(sp)};super(sp.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform mat4 first_mat4;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xy, 1, 1);\n\n gl_Position = first_mat4 * normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n gl_FragColor = texture2D(first_texture, current_texture_coordinate_2d);\n // gl_FragColor = vec4(256,0,0,1);\n}"},e,t)}static getFilterType(){return"transform"}static getInputsCount(){return 1}static getInitialOptions(){return{translate:{x:0,y:0},scale:{x:1,y:1},rotate:0}}getOptionsDisplay(){return[{properties:["translate","x"],type:"slider",minValue:-2,maxValue:2,step:.001,initialValue:sp.getInitialOptions().translate.x},{properties:["translate","y"],type:"slider",minValue:-2,maxValue:2,step:.001,initialValue:sp.getInitialOptions().translate.y},{properties:["scale","x"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:sp.getInitialOptions().scale.x},{properties:["scale","y"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:sp.getInitialOptions().scale.y},{properties:["rotate"],type:"slider",minValue:-360,maxValue:360,step:1,initialValue:sp.getInitialOptions().rotate}]}static getUniformList(){return[Gf.FIRST_TEXTURE,Gf.FIRST_MATRIX]}handleStaticUniforms(t){if(!t||!t.translate||!t.scale)throw new Error(`bad options object for Transform filter, check ${t}`);const e=Number.parseFloat(t.translate.x).toFixed(7),n=-1*Number.parseFloat(t.translate.y).toFixed(7),i=Number.parseFloat(t.scale.x).toFixed(7),r=Number.parseFloat(t.scale.y).toFixed(7),o=t.rotate||0;var s;this.transformMatrix=function(t,e,n,i){var r=e[0],o=e[1],s=e[2],a=e[3],l=r+r,c=o+o,u=s+s,d=r*l,h=r*c,f=r*u,p=o*c,m=o*u,v=s*u,g=a*l,y=a*c,b=a*u,k=i[0],x=i[1],w=i[2];return t[0]=(1-(p+v))*k,t[1]=(h+b)*k,t[2]=(f-y)*k,t[3]=0,t[4]=(h-b)*x,t[5]=(1-(d+v))*x,t[6]=(m+g)*x,t[7]=0,t[8]=(f+y)*w,t[9]=(m-g)*w,t[10]=(1-(d+p))*w,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}((s=new np(16),np!=Float32Array&&(s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[11]=0,s[12]=0,s[13]=0,s[14]=0),s[0]=1,s[5]=1,s[10]=1,s[15]=1,s),function(t,e,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",o=Math.PI/360;e*=o,i*=o,n*=o;var s=Math.sin(e),a=Math.cos(e),l=Math.sin(n),c=Math.cos(n),u=Math.sin(i),d=Math.cos(i);switch(r){case"xyz":t[0]=s*c*d+a*l*u,t[1]=a*l*d-s*c*u,t[2]=a*c*u+s*l*d,t[3]=a*c*d-s*l*u;break;case"xzy":t[0]=s*c*d-a*l*u,t[1]=a*l*d-s*c*u,t[2]=a*c*u+s*l*d,t[3]=a*c*d+s*l*u;break;case"yxz":t[0]=s*c*d+a*l*u,t[1]=a*l*d-s*c*u,t[2]=a*c*u-s*l*d,t[3]=a*c*d+s*l*u;break;case"yzx":t[0]=s*c*d+a*l*u,t[1]=a*l*d+s*c*u,t[2]=a*c*u-s*l*d,t[3]=a*c*d-s*l*u;break;case"zxy":t[0]=s*c*d-a*l*u,t[1]=a*l*d+s*c*u,t[2]=a*c*u+s*l*d,t[3]=a*c*d-s*l*u;break;case"zyx":t[0]=s*c*d-a*l*u,t[1]=a*l*d+s*c*u,t[2]=a*c*u-s*l*d,t[3]=a*c*d+s*l*u;break;default:throw new Error("Unknown angle order "+r)}return t}(op(),0,0,o),rp(e,n,0),rp(i,r,1)),this.uniforms[Gf.FIRST_MATRIX].set(this.transformMatrix)}}class ap extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(ap)};super(ap.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[2];\n\nvarying vec2 blur_texture_coordinate_2d[11];\n\n\nvoid main() {\n vec2 normalize_poistion = vec2(position_3d.xy);\n gl_Position = vec4(normalize_poistion, 1, 1);\n\n float texture_width = runtimeOptions[0];\n float pixel_width = 1.0 / texture_width;\n\n \n for(int i=-5; i<5; ++i){\n float current_i = float(i);\n blur_texture_coordinate_2d[i+5] = texture_coordinate_2d + vec2(pixel_width * current_i, 0.0); \n }\n}\n",fragment:"\nprecision lowp float;\n\nuniform sampler2D first_texture;\n\nvarying vec2 blur_texture_coordinate_2d[11];\n\nvoid main() {\n vec4 out_colour = vec4(0.0);\n\tout_colour += texture2D(first_texture, blur_texture_coordinate_2d[0]) * 0.0093;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[1]) * 0.028002;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[2]) * 0.065984;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[3]) * 0.121703;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[4]) * 0.175713;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[5]) * 0.198596;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[6]) * 0.175713;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[7]) * 0.121703;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[8]) * 0.065984;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[9]) * 0.028002;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[10]) * 0.0093;\n \n \n gl_FragColor = out_colour;\n}"},e,t)}static getFilterType(){return"horizontalBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[Gf.FIRST_TEXTURE,Uf]}}class lp extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(lp)};super(lp.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[2];\n\nvarying vec2 blur_texture_coordinate_2d[11];\n\n\nvoid main() {\n vec2 normalize_poistion = vec2(position_3d.xy);\n gl_Position = vec4(normalize_poistion, 1, 1);\n\n float texture_width = runtimeOptions[1];\n float pixel_height = 1.0 / texture_width;\n\n for(int i=-5; i<5; ++i){\n float current_i = float(i);\n blur_texture_coordinate_2d[i+5] = texture_coordinate_2d + vec2( 0.0, pixel_height * current_i);\n }\n}\n",fragment:"\nprecision lowp float;\n\nuniform sampler2D first_texture;\n\nvarying vec2 blur_texture_coordinate_2d[11];\n\nvoid main() {\n vec4 out_colour = vec4(0.0);\n\tout_colour += texture2D(first_texture, blur_texture_coordinate_2d[0]) * 0.0093;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[1]) * 0.028002;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[2]) * 0.065984;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[3]) * 0.121703;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[4]) * 0.175713;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[5]) * 0.198596;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[6]) * 0.175713;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[7]) * 0.121703;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[8]) * 0.065984;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[9]) * 0.028002;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[10]) * 0.0093;\n \n \n gl_FragColor = out_colour;\n}"},e,t)}static getFilterType(){return"verticalBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[Gf.FIRST_TEXTURE,Uf]}}class cp extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(cp)};super(cp.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float staticOptions[3];\nuniform float runtimeOptions[4];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nconst float Depth = 3.;\nconst float Samples = 8.;\nfloat OffsetDist = staticOptions[0];\n\nvec2 srcDims = vec2(runtimeOptions[0], runtimeOptions[1]);\nvec2 vpDims = vec2(runtimeOptions[2], runtimeOptions[3]);\nvec2 iResolution = vpDims;\n\n\n#define TAU 6.28318530718\n\nvec4 RadialBlur(vec2 fragCoord, float radius) {\n if (radius <= 0.) {\n return texture2D(first_texture, fragCoord/iResolution.xy);\n }\n\n vec2 offset;\n float angle = 0.;\n vec4 color = vec4(0.);\n\n for(float angle = 0.; angle < TAU; angle += (TAU/Samples)) {\n offset = vec2(cos(angle), sin(angle)) * radius;\n color += texture2D(first_texture, (fragCoord + offset)/iResolution.xy);\n }\n\n return color/Samples;\n\n}\n\nvec4 FastBlur(vec2 fragCoord) {\n\n vec4 color;\n vec2 offset;\n float fib = 2.;\n float fibTotal = 0.;\n\n for(float i = 1.; i <= Depth; ++i) {\n fib += i;\n color += RadialBlur(fragCoord, i * OffsetDist)/ fib;\n fibTotal += 1./fib;\n }\n\n return color/fibTotal;\n\n}\n\n// based on https://www.shadertoy.com/view/3ljBDd\nvoid main() {\n// vec2 fragCoords = (vec2(current_texture_coordinate_2d) + 1.0) / 2.0 * vpDims;\n vec2 fragCoords = vec2(current_texture_coordinate_2d) * vpDims;\n gl_FragColor = FastBlur(fragCoords);\n}"},e,t)}static getFilterType(){return"fastBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[Gf.FIRST_TEXTURE,Uf,qf]}handleStaticUniforms(t){var e;const n=(null!==(e=Number.parseFloat(t.offsetDist))&&void 0!==e?e:4).toFixed(3);this.uniforms[Gf.STATIC_OPTIONS].set([n])}}class up extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(up)};super(up.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float staticOptions[2];\nuniform float runtimeOptions[4];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvec2 vpDims = vec2(runtimeOptions[2], runtimeOptions[3]);\n\n// A simple directional blur that doesn't brighten the image, based on https://www.shadertoy.com/view/WdSXWD\n// and https://www.shadertoy.com/view/NltSD4\n\nvec4 dirBlur() {\n float angle = staticOptions[0];\n float strength = staticOptions[1];\n if (strength == 0.0){\n return texture2D(first_texture, current_texture_coordinate_2d);\n }\n\n vec2 uv = current_texture_coordinate_2d;\n\n float r = radians(angle);\n vec2 direction = vec2(sin(r), cos(r));\n\n vec2 strengthDirection = strength * direction;\n vec3 acc = vec3(0);\n for(float i = -1.0; i <= 1.0; i += (2.0 / 50.0)) {\n acc += texture2D(first_texture, uv - vec2(strengthDirection.x * i, strengthDirection.y * i)).rgb * (2.0 / 50.0) * .5;\n }\n\n return vec4(acc, 1.0);\n\n}\n\nvoid main() {\n gl_FragColor = dirBlur();\n}"},e,t)}static getFilterType(){return"directionalBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[Gf.FIRST_TEXTURE,Uf,qf]}handleStaticUniforms(t){var e,n;const i=(null!==(e=Number.parseFloat(t.angle))&&void 0!==e?e:90).toFixed(3),r=(null!==(n=Number.parseFloat(t.strength))&&void 0!==n?n:.1).toFixed(3);this.uniforms[Gf.STATIC_OPTIONS].set([i,r])}}class dp extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(dp)};super(dp.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n \n current_texture_coordinate_2d = texture_coordinate_2d;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform float staticOptions[1];\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 texture = texture2D(first_texture, current_texture_coordinate_2d);\n float opacity = texture.w - (1.0 - staticOptions[0]);\n gl_FragColor = vec4((texture.xyz) , opacity);\n}"},e,t)}static getFilterType(){return"opacity"}static getInputsCount(){return 1}static getInitialOptions(){return{power:1}}getOptionsDisplay(){return[{properties:["power"],type:"slider",minValue:0,maxValue:1,step:.001}]}handleStaticUniforms(t){const e=Number.parseFloat(t.power).toFixed(7);this.uniforms[Gf.STATIC_OPTIONS].set([e])}}class hp extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(hp)};super(hp.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform sampler2D second_texture;\n\nuniform float staticOptions[7];\nuniform float runtimeOptions[2];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\n\nfloat roundedBoxSDF(vec2 point, vec2 center, vec2 area, float radius) {\n return length(max(abs(point - center) - area + radius, 0.0)) - radius;\n}\n\nfloat boxSDF(vec2 point, vec2 center, vec2 area){\n vec2 d = abs(point - center) - area;\n return length(max(d,vec2(0)));\n}\n\n\nvoid main() {\n float type = staticOptions[0];\n vec2 aspectRatio = vec2(runtimeOptions[0]/runtimeOptions[1], 1.0);\n\n\n vec2 center = vec2(staticOptions[1], staticOptions[2]) * aspectRatio;\n vec2 area = max(vec2(staticOptions[3], staticOptions[4]) * aspectRatio, 0.0); \n float radius = staticOptions[5];\n\n vec2 SDF_PositionCoordinate2d = vec2(\n current_position_coordinate_2d.x,\n current_position_coordinate_2d.y * -1.0\n ) * aspectRatio;\n\n vec4 color1 = texture2D(first_texture, current_texture_coordinate_2d);\n vec4 color2 = texture2D(second_texture, current_texture_coordinate_2d);\n\n float dist;\n vec4 color;\n if(type == 0.0){\n dist = boxSDF(SDF_PositionCoordinate2d, center, area);\n color = (dist > 0.0) ? color2: color1;\n } else {\n dist = roundedBoxSDF(SDF_PositionCoordinate2d, center, area, radius);\n color = (dist > 0.0) ? color2: color1;\n color = mix( color, color2, 1.0-smoothstep(0.0,0.0025,abs(dist)));\n }\n \n gl_FragColor = color;\n}"},e,t)}static getFilterType(){return"shapeCompositeMask"}static getInputsCount(){return 2}static getInitialOptions(){return{type:"box",center:{x:0,y:0},area:{width:0,height:0},radius:.01,edgeSoftness:0}}getOptionsDisplay(){return[{properties:["center","x"],type:"slider",minValue:-1,maxValue:1,step:.001},{properties:["center","y"],type:"slider",minValue:-1,maxValue:1,step:.001},{properties:["area","width"],type:"slider",minValue:-2,maxValue:2,step:.001},{properties:["area","height"],type:"slider",minValue:-2,maxValue:2,step:.001},{properties:["radius"],type:"slider",minValue:-2,maxValue:2,step:.001},{properties:["edgeSoftness"],type:"slider",minValue:-2,maxValue:2,step:.001}]}static getUniformList(){return[Gf.FIRST_TEXTURE,Uf,Gf.SECOND_TEXTURE]}handleStaticUniforms(t){let e;switch(t.type){case"box":e=0;break;case"rounded":e=1;break;default:throw new Error("cant recognize shape composite mask type")}const n=Number.parseFloat(t.center.x).toFixed(7);let i=Number.parseFloat(t.center.y).toFixed(7);i+=0;const r=Number.parseFloat(t.area.width).toFixed(7),o=Number.parseFloat(t.area.height).toFixed(7),s=Number.parseFloat(t.radius).toFixed(7),a=Number.parseFloat(t.edgeSoftness).toFixed(7);this.uniforms[Gf.STATIC_OPTIONS].set([e,n,i,r,o,s,a])}}class fp extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(fp)};super(fp.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform sampler2D second_texture;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 fgColor = texture2D(first_texture, current_texture_coordinate_2d);\n vec4 bgColor = texture2D(second_texture, current_texture_coordinate_2d);\n gl_FragColor = vec4(\n mix(bgColor.xyz, fgColor.xyz, fgColor.w),\n 1.0\n );\n // vec4 fgColor = texture2D(textures[1], current_texture_coordinate_2d);\n // if(fgColor.w > 0.0){\n // gl_FragColor = vec4(1.0,0,0,1);\n // }else{\n // gl_FragColor = vec4(1.0,1.0,0,1);\n // }\n \n \n}"},e,t)}static getFilterType(){return"shapeComposite"}static getInputsCount(){return 2}static getInitialOptions(){return{}}static getUniformList(){return[Gf.FIRST_TEXTURE,Gf.SECOND_TEXTURE]}}class pp extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(pp)};super(pp.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform sampler2D second_texture;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n // Look it up in the LUT\n vec4 textureColor = texture2D(first_texture, current_texture_coordinate_2d);\n\n mediump float blueColor = textureColor.b * 63.0;\n\n mediump vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n\n mediump vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n\n highp vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);\n\n\n highp vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);\n\n lowp vec4 newColor1 = texture2D(second_texture, texPos1);\n lowp vec4 newColor2 = texture2D(second_texture, texPos2);\n\n lowp vec4 color = mix(newColor1, newColor2, fract(blueColor));\n\n gl_FragColor = color;\n\n // debug\n// if (current_texture_coordinate_2d.x < 0.5) {\n// // Left half: show original\n// gl_FragColor = textureColor;\n// } else {\n// gl_FragColor = color;\n// }\n}\n"},e,t)}static getFilterType(){return"lut"}static getInputsCount(){return 2}static getInitialOptions(){return{}}static getUniformList(){return[Gf.FIRST_TEXTURE,Gf.SECOND_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(t){const e=Number.parseFloat(t.lutSize).toFixed(1);this.uniforms[Gf.STATIC_OPTIONS].set([e])}}var mp="attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",vp='precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\n\n// a 256 * 4 length array with values for the master, r, g and b curve respectively\n// Temporarily changed length to 256 to avoid the following error on some machines:\n// "Implementation limit of 4096 (e.g., number of built-in plus user defined active uniforms components) exceeded, fragment shader uses 4100 total uniforms."\nuniform float staticOptions[256];\n\n\n// implementation of round (doesn\'t exist in webgl)\nint round(float val){\n return int(floor(val + 0.5));\n}\n\n// no dynamic array indexes in webgl\n// see https://stackoverflow.com/questions/30585265/what-can-i-use-as-an-array-index-in-glsl-in-webgl\nfloat getCurveValue(float pixelValue){\n float v;\n for (int k = 0; k < 256; k++) {\n if (k == round(pixelValue * 255.0)){\n v = float(staticOptions[k]) / 255.0;\n }\n }\n return v;\n}\n\nvec3 masterCurve(vec4 color){\n float r = getCurveValue(color.r);\n float g = getCurveValue(color.g);\n float b = getCurveValue(color.b);\n// for (int k = 0; k < 256; ++k) {\n// if (k == int(color.g) * 256){\n// g = float(staticOptions[k]) / 256.0;\n// }\n// }\n// for (int k = 0; k < 256; ++k) {\n// if (k == int(color.b) * 256){\n// b = float(staticOptions[k]) / 256.0;\n// }\n// }\n return vec3(r,g,b);\n}\n\n//vec3 redCurve(vec3 color){\n// int offset = 256;\n// return vec3(staticOptions[int(int(color.r) + offset)], color.g, color.b);\n//}\n//\n//vec3 greenCurve(vec3 color){\n// int offset = 256 * 2;\n// return vec3(color.r, staticOptions[int(int(color.g) + offset)], color.b);\n//}\n//\n//vec3 blueCurve(vec3 color){\n// int offset = 256 * 3;\n// return vec3(color.r, color.g, staticOptions[int(int(color.b) + offset)]);\n//}\n\nvoid main() {\n// vec4 textureColor = texture2D(first_texture, current_texture_coordinate_2d);\n// vec3 afterMaster = masterCurve(textureColor);\n// vec3 afterRed = redCurve(afterMaster);\n// vec3 afterGreen = greenCurve(afterRed);\n// vec3 afterBlue = blueCurve(afterGreen);\n// vec4 finalColor = vec4(afterBlue, textureColor.a);\n\n vec4 textureColor = texture2D(first_texture, current_texture_coordinate_2d);\n vec3 afterMaster = masterCurve(textureColor);\n vec4 finalColor = vec4(afterMaster, textureColor.a);\n\n gl_FragColor = finalColor;\n}\n';const{abs:gp,cos:yp,sin:bp,acos:kp,atan2:xp,sqrt:wp,pow:_p}=Math;function Ip(t){return t<0?-_p(-t,1/3):_p(t,1/3)}const Tp=Math.PI,Ep=2*Tp,Sp=Tp/2,Mp=Number.MAX_SAFE_INTEGER||9007199254740991,Ap=Number.MIN_SAFE_INTEGER||-9007199254740991,Np={x:0,y:0,z:0},Fp={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(t,e){const n=e(t);let i=n.x*n.x+n.y*n.y;return void 0!==n.z&&(i+=n.z*n.z),wp(i)},compute:function(t,e,n){if(0===t)return e[0].t=0,e[0];const i=e.length-1;if(1===t)return e[i].t=1,e[i];const r=1-t;let o=e;if(0===i)return e[0].t=t,e[0];if(1===i){const e={x:r*o[0].x+t*o[1].x,y:r*o[0].y+t*o[1].y,t:t};return n&&(e.z=r*o[0].z+t*o[1].z),e}if(i<4){let e,s,a,l=r*r,c=t*t,u=0;2===i?(o=[o[0],o[1],o[2],Np],e=l,s=r*t*2,a=c):3===i&&(e=l*r,s=l*t*3,a=r*c*3,u=t*c);const d={x:e*o[0].x+s*o[1].x+a*o[2].x+u*o[3].x,y:e*o[0].y+s*o[1].y+a*o[2].y+u*o[3].y,t:t};return n&&(d.z=e*o[0].z+s*o[1].z+a*o[2].z+u*o[3].z),d}const s=JSON.parse(JSON.stringify(e));for(;s.length>1;){for(let e=0;e<s.length-1;e++)s[e]={x:s[e].x+(s[e+1].x-s[e].x)*t,y:s[e].y+(s[e+1].y-s[e].y)*t},void 0!==s[e].z&&(s[e].z=s[e].z+(s[e+1].z-s[e].z)*t);s.splice(s.length-1,1)}return s[0].t=t,s[0]},computeWithRatios:function(t,e,n,i){const r=1-t,o=n,s=e;let a,l=o[0],c=o[1],u=o[2],d=o[3];return l*=r,c*=t,2===s.length?(a=l+c,{x:(l*s[0].x+c*s[1].x)/a,y:(l*s[0].y+c*s[1].y)/a,z:!!i&&(l*s[0].z+c*s[1].z)/a,t:t}):(l*=r,c*=2*r,u*=t*t,3===s.length?(a=l+c+u,{x:(l*s[0].x+c*s[1].x+u*s[2].x)/a,y:(l*s[0].y+c*s[1].y+u*s[2].y)/a,z:!!i&&(l*s[0].z+c*s[1].z+u*s[2].z)/a,t:t}):(l*=r,c*=1.5*r,u*=3*r,d*=t*t*t,4===s.length?(a=l+c+u+d,{x:(l*s[0].x+c*s[1].x+u*s[2].x+d*s[3].x)/a,y:(l*s[0].y+c*s[1].y+u*s[2].y+d*s[3].y)/a,z:!!i&&(l*s[0].z+c*s[1].z+u*s[2].z+d*s[3].z)/a,t:t}):void 0))},derive:function(t,e){const n=[];for(let i=t,r=i.length,o=r-1;r>1;r--,o--){const t=[];for(let n,r=0;r<o;r++)n={x:o*(i[r+1].x-i[r].x),y:o*(i[r+1].y-i[r].y)},e&&(n.z=o*(i[r+1].z-i[r].z)),t.push(n);n.push(t),i=t}return n},between:function(t,e,n){return e<=t&&t<=n||Fp.approximately(t,e)||Fp.approximately(t,n)},approximately:function(t,e,n){return gp(t-e)<=(n||1e-6)},length:function(t){const e=Fp.Tvalues.length;let n=0;for(let i,r=0;r<e;r++)i=.5*Fp.Tvalues[r]+.5,n+=Fp.Cvalues[r]*Fp.arcfn(i,t);return.5*n},map:function(t,e,n,i,r){return i+(t-e)/(n-e)*(r-i)},lerp:function(t,e,n){const i={x:e.x+t*(n.x-e.x),y:e.y+t*(n.y-e.y)};return void 0!==e.z&&void 0!==n.z&&(i.z=e.z+t*(n.z-e.z)),i},pointToString:function(t){let e=t.x+"/"+t.y;return void 0!==t.z&&(e+="/"+t.z),e},pointsToString:function(t){return"["+t.map(Fp.pointToString).join(", ")+"]"},copy:function(t){return JSON.parse(JSON.stringify(t))},angle:function(t,e,n){const i=e.x-t.x,r=e.y-t.y,o=n.x-t.x,s=n.y-t.y;return xp(i*s-r*o,i*o+r*s)},round:function(t,e){const n=""+t,i=n.indexOf(".");return parseFloat(n.substring(0,i+1+e))},dist:function(t,e){const n=t.x-e.x,i=t.y-e.y;return wp(n*n+i*i)},closest:function(t,e){let n,i,r=_p(2,63);return t.forEach((function(t,o){i=Fp.dist(e,t),i<r&&(r=i,n=o)})),{mdist:r,mpos:n}},abcratio:function(t,e){if(2!==e&&3!==e)return!1;if(void 0===t)t=.5;else if(0===t||1===t)return t;const n=_p(t,e)+_p(1-t,e);return gp((n-1)/n)},projectionratio:function(t,e){if(2!==e&&3!==e)return!1;if(void 0===t)t=.5;else if(0===t||1===t)return t;const n=_p(1-t,e);return n/(_p(t,e)+n)},lli8:function(t,e,n,i,r,o,s,a){const l=(t-n)*(o-a)-(e-i)*(r-s);return 0!=l&&{x:((t*i-e*n)*(r-s)-(t-n)*(r*a-o*s))/l,y:((t*i-e*n)*(o-a)-(e-i)*(r*a-o*s))/l}},lli4:function(t,e,n,i){const r=t.x,o=t.y,s=e.x,a=e.y,l=n.x,c=n.y,u=i.x,d=i.y;return Fp.lli8(r,o,s,a,l,c,u,d)},lli:function(t,e){return Fp.lli4(t,t.c,e,e.c)},makeline:function(t,e){return new jp(t.x,t.y,(t.x+e.x)/2,(t.y+e.y)/2,e.x,e.y)},findbbox:function(t){let e=Mp,n=Mp,i=Ap,r=Ap;return t.forEach((function(t){const o=t.bbox();e>o.x.min&&(e=o.x.min),n>o.y.min&&(n=o.y.min),i<o.x.max&&(i=o.x.max),r<o.y.max&&(r=o.y.max)})),{x:{min:e,mid:(e+i)/2,max:i,size:i-e},y:{min:n,mid:(n+r)/2,max:r,size:r-n}}},shapeintersections:function(t,e,n,i,r){if(!Fp.bboxoverlap(e,i))return[];const o=[],s=[t.startcap,t.forward,t.back,t.endcap],a=[n.startcap,n.forward,n.back,n.endcap];return s.forEach((function(e){e.virtual||a.forEach((function(i){if(i.virtual)return;const s=e.intersects(i,r);s.length>0&&(s.c1=e,s.c2=i,s.s1=t,s.s2=n,o.push(s))}))})),o},makeshape:function(t,e,n){const i=e.points.length,r=t.points.length,o=Fp.makeline(e.points[i-1],t.points[0]),s=Fp.makeline(t.points[r-1],e.points[0]),a={startcap:o,forward:t,back:e,endcap:s,bbox:Fp.findbbox([o,t,e,s]),intersections:function(t){return Fp.shapeintersections(a,a.bbox,t,t.bbox,n)}};return a},getminmax:function(t,e,n){if(!n)return{min:0,max:0};let i,r,o=Mp,s=Ap;-1===n.indexOf(0)&&(n=[0].concat(n)),-1===n.indexOf(1)&&n.push(1);for(let a=0,l=n.length;a<l;a++)i=n[a],r=t.get(i),r[e]<o&&(o=r[e]),r[e]>s&&(s=r[e]);return{min:o,mid:(o+s)/2,max:s,size:s-o}},align:function(t,e){const n=e.p1.x,i=e.p1.y,r=-xp(e.p2.y-i,e.p2.x-n);return t.map((function(t){return{x:(t.x-n)*yp(r)-(t.y-i)*bp(r),y:(t.x-n)*bp(r)+(t.y-i)*yp(r)}}))},roots:function(t,e){e=e||{p1:{x:0,y:0},p2:{x:1,y:0}};const n=t.length-1,i=Fp.align(t,e),r=function(t){return 0<=t&&t<=1};if(2===n){const t=i[0].y,e=i[1].y,n=i[2].y,o=t-2*e+n;if(0!==o){const i=-wp(e*e-t*n),s=-t+e;return[-(i+s)/o,-(-i+s)/o].filter(r)}return e!==n&&0===o?[(2*e-n)/(2*e-2*n)].filter(r):[]}const o=i[0].y,s=i[1].y,a=i[2].y;let l=3*s-o-3*a+i[3].y,c=3*o-6*s+3*a,u=-3*o+3*s,d=o;if(Fp.approximately(l,0)){if(Fp.approximately(c,0))return Fp.approximately(u,0)?[]:[-d/u].filter(r);const t=wp(u*u-4*c*d),e=2*c;return[(t-u)/e,(-u-t)/e].filter(r)}c/=l,u/=l,d/=l;const h=(3*u-c*c)/3,f=h/3,p=(2*c*c*c-9*c*u+27*d)/27,m=p/2,v=m*m+f*f*f;let g,y,b,k,x;if(v<0){const t=-h/3,e=wp(t*t*t),n=-p/(2*e),i=kp(n<-1?-1:n>1?1:n),o=2*Ip(e);return b=o*yp(i/3)-c/3,k=o*yp((i+Ep)/3)-c/3,x=o*yp((i+2*Ep)/3)-c/3,[b,k,x].filter(r)}if(0===v)return g=m<0?Ip(-m):-Ip(m),b=2*g-c/3,k=-g-c/3,[b,k].filter(r);{const t=wp(v);return g=Ip(-m+t),y=Ip(m+t),[g-y-c/3].filter(r)}},droots:function(t){if(3===t.length){const e=t[0],n=t[1],i=t[2],r=e-2*n+i;if(0!==r){const t=-wp(n*n-e*i),o=-e+n;return[-(t+o)/r,-(-t+o)/r]}return n!==i&&0===r?[(2*n-i)/(2*(n-i))]:[]}if(2===t.length){const e=t[0],n=t[1];return e!==n?[e/(e-n)]:[]}return[]},curvature:function(t,e,n,i,r){let o,s,a,l,c=0,u=0;const d=Fp.compute(t,e),h=Fp.compute(t,n),f=d.x*d.x+d.y*d.y;if(i?(o=wp(_p(d.y*h.z-h.y*d.z,2)+_p(d.z*h.x-h.z*d.x,2)+_p(d.x*h.y-h.x*d.y,2)),s=_p(f+d.z*d.z,1.5)):(o=d.x*h.y-d.y*h.x,s=_p(f,1.5)),0===o||0===s)return{k:0,r:0};if(c=o/s,u=s/o,!r){const r=Fp.curvature(t-.001,e,n,i,!0).k,o=Fp.curvature(t+.001,e,n,i,!0).k;l=(o-c+(c-r))/2,a=(gp(o-c)+gp(c-r))/2}return{k:c,r:u,dk:l,adk:a}},inflections:function(t){if(t.length<4)return[];const e=Fp.align(t,{p1:t[0],p2:t.slice(-1)[0]}),n=e[2].x*e[1].y,i=e[3].x*e[1].y,r=e[1].x*e[2].y,o=18*(-3*n+2*i+3*r-e[3].x*e[2].y),s=18*(3*n-i-3*r),a=18*(r-n);if(Fp.approximately(o,0)){if(!Fp.approximately(s,0)){let t=-a/s;if(0<=t&&t<=1)return[t]}return[]}const l=2*o;if(Fp.approximately(l,0))return[];const c=s*s-4*o*a;if(c<0)return[];const u=Math.sqrt(c);return[(u-s)/l,-(s+u)/l].filter((function(t){return 0<=t&&t<=1}))},bboxoverlap:function(t,e){const n=["x","y"],i=n.length;for(let r,o,s,a,l=0;l<i;l++)if(r=n[l],o=t[r].mid,s=e[r].mid,a=(t[r].size+e[r].size)/2,gp(o-s)>=a)return!1;return!0},expandbox:function(t,e){e.x.min<t.x.min&&(t.x.min=e.x.min),e.y.min<t.y.min&&(t.y.min=e.y.min),e.z&&e.z.min<t.z.min&&(t.z.min=e.z.min),e.x.max>t.x.max&&(t.x.max=e.x.max),e.y.max>t.y.max&&(t.y.max=e.y.max),e.z&&e.z.max>t.z.max&&(t.z.max=e.z.max),t.x.mid=(t.x.min+t.x.max)/2,t.y.mid=(t.y.min+t.y.max)/2,t.z&&(t.z.mid=(t.z.min+t.z.max)/2),t.x.size=t.x.max-t.x.min,t.y.size=t.y.max-t.y.min,t.z&&(t.z.size=t.z.max-t.z.min)},pairiteration:function(t,e,n){const i=t.bbox(),r=e.bbox(),o=1e5,s=n||.5;if(i.x.size+i.y.size<s&&r.x.size+r.y.size<s)return[(o*(t._t1+t._t2)/2|0)/o+"/"+(o*(e._t1+e._t2)/2|0)/o];let a=t.split(.5),l=e.split(.5),c=[{left:a.left,right:l.left},{left:a.left,right:l.right},{left:a.right,right:l.right},{left:a.right,right:l.left}];c=c.filter((function(t){return Fp.bboxoverlap(t.left.bbox(),t.right.bbox())}));let u=[];return 0===c.length||(c.forEach((function(t){u=u.concat(Fp.pairiteration(t.left,t.right,s))})),u=u.filter((function(t,e){return u.indexOf(t)===e}))),u},getccenter:function(t,e,n){const i=e.x-t.x,r=e.y-t.y,o=n.x-e.x,s=n.y-e.y,a=i*yp(Sp)-r*bp(Sp),l=i*bp(Sp)+r*yp(Sp),c=o*yp(Sp)-s*bp(Sp),u=o*bp(Sp)+s*yp(Sp),d=(t.x+e.x)/2,h=(t.y+e.y)/2,f=(e.x+n.x)/2,p=(e.y+n.y)/2,m=d+a,v=h+l,g=f+c,y=p+u,b=Fp.lli8(d,h,m,v,f,p,g,y),k=Fp.dist(b,t);let x,w=xp(t.y-b.y,t.x-b.x),_=xp(e.y-b.y,e.x-b.x),I=xp(n.y-b.y,n.x-b.x);return w<I?((w>_||_>I)&&(w+=Ep),w>I&&(x=I,I=w,w=x)):I<_&&_<w?(x=I,I=w,w=x):I+=Ep,b.s=w,b.e=I,b.r=k,b},numberSort:function(t,e){return t-e}};class Cp{constructor(t){this.curves=[],this._3d=!1,t&&(this.curves=t,this._3d=this.curves[0]._3d)}valueOf(){return this.toString()}toString(){return"["+this.curves.map((function(t){return Fp.pointsToString(t.points)})).join(", ")+"]"}addCurve(t){this.curves.push(t),this._3d=this._3d||t._3d}length(){return this.curves.map((function(t){return t.length()})).reduce((function(t,e){return t+e}))}curve(t){return this.curves[t]}bbox(){const t=this.curves;for(var e=t[0].bbox(),n=1;n<t.length;n++)Fp.expandbox(e,t[n].bbox());return e}offset(t){const e=[];return this.curves.forEach((function(n){e.push(...n.offset(t))})),new Cp(e)}}const{abs:Op,min:Pp,max:Rp,cos:Dp,sin:Bp,acos:Lp,sqrt:zp}=Math,Wp=Math.PI;let jp=class e{constructor(t){let e=t&&t.forEach?t:Array.from(arguments).slice(),n=!1;if("object"==typeof e[0]){n=e.length;const t=[];e.forEach((function(e){["x","y","z"].forEach((function(n){void 0!==e[n]&&t.push(e[n])}))})),e=t}let i=!1;const r=e.length;if(n){if(n>4){if(1!==arguments.length)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");i=!0}}else if(6!==r&&8!==r&&9!==r&&12!==r&&1!==arguments.length)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");const o=this._3d=!i&&(9===r||12===r)||t&&t[0]&&void 0!==t[0].z,s=this.points=[];for(let t=0,n=o?3:2;t<r;t+=n){var a={x:e[t],y:e[t+1]};o&&(a.z=e[t+2]),s.push(a)}const l=this.order=s.length-1,c=this.dims=["x","y"];o&&c.push("z"),this.dimlen=c.length;const u=Fp.align(s,{p1:s[0],p2:s[l]}),d=Fp.dist(s[0],s[l]);this._linear=u.reduce(((t,e)=>t+Op(e.y)),0)<d/50,this._lut=[],this._t1=0,this._t2=1,this.update()}static quadraticFromPoints(t,n,i,r){if(void 0===r&&(r=.5),0===r)return new e(n,n,i);if(1===r)return new e(t,n,n);const o=e.getABC(2,t,n,i,r);return new e(t,o.A,i)}static cubicFromPoints(t,n,i,r,o){void 0===r&&(r=.5);const s=e.getABC(3,t,n,i,r);void 0===o&&(o=Fp.dist(n,s.C));const a=o*(1-r)/r,l=Fp.dist(t,i),c=(i.x-t.x)/l,u=(i.y-t.y)/l,d=o*c,h=o*u,f=a*c,p=a*u,m=n.x-d,v=n.y-h,g=n.x+f,y=n.y+p,b=s.A,k=b.x+(m-b.x)/(1-r),x=b.y+(v-b.y)/(1-r),w=b.x+(g-b.x)/r,_=b.y+(y-b.y)/r,I={x:t.x+(k-t.x)/r,y:t.y+(x-t.y)/r},T={x:i.x+(w-i.x)/(1-r),y:i.y+(_-i.y)/(1-r)};return new e(t,I,T,i)}static getUtils(){return Fp}getUtils(){return e.getUtils()}static get PolyBezier(){return Cp}valueOf(){return this.toString()}toString(){return Fp.pointsToString(this.points)}toSVG(){if(this._3d)return!1;const t=this.points,e=["M",t[0].x,t[0].y,2===this.order?"Q":"C"];for(let n=1,i=t.length;n<i;n++)e.push(t[n].x),e.push(t[n].y);return e.join(" ")}setRatios(t){if(t.length!==this.points.length)throw new Error("incorrect number of ratio values");this.ratios=t,this._lut=[]}verify(){const t=this.coordDigest();t!==this._print&&(this._print=t,this.update())}coordDigest(){return this.points.map((function(t,e){return""+e+t.x+t.y+(t.z?t.z:0)})).join("")}update(){this._lut=[],this.dpoints=Fp.derive(this.points,this._3d),this.computedirection()}computedirection(){const t=this.points,e=Fp.angle(t[0],t[this.order],t[1]);this.clockwise=e>0}length(){return Fp.length(this.derivative.bind(this))}static getABC(t=2,e,n,i,r=.5){const o=Fp.projectionratio(r,t),s=1-o,a={x:o*e.x+s*i.x,y:o*e.y+s*i.y},l=Fp.abcratio(r,t);return{A:{x:n.x+(n.x-a.x)/l,y:n.y+(n.y-a.y)/l},B:n,C:a,S:e,E:i}}getABC(t,n){n=n||this.get(t);let i=this.points[0],r=this.points[this.order];return e.getABC(this.order,i,n,r,t)}getLUT(t){if(this.verify(),t=t||100,this._lut.length===t+1)return this._lut;this._lut=[],t++,this._lut=[];for(let e,n,i=0;i<t;i++)n=i/(t-1),e=this.compute(n),e.t=n,this._lut.push(e);return this._lut}on(e,n){n=n||5;const i=this.getLUT(),r=[];for(let t,o=0,s=0;o<i.length;o++)t=i[o],Fp.dist(t,e)<n&&(r.push(t),s+=o/i.length);return!!r.length&&(t/=r.length)}project(t){const e=this.getLUT(),n=e.length-1,i=Fp.closest(e,t),r=i.mpos,o=(r-1)/n,s=(r+1)/n,a=.1/n;let l,c=i.mdist,u=o,d=u;c+=1;for(let e;u<s+a;u+=a)l=this.compute(u),e=Fp.dist(t,l),e<c&&(c=e,d=u);return d=d<0?0:d>1?1:d,l=this.compute(d),l.t=d,l.d=c,l}get(t){return this.compute(t)}point(t){return this.points[t]}compute(t){return this.ratios?Fp.computeWithRatios(t,this.points,this.ratios,this._3d):Fp.compute(t,this.points,this._3d,this.ratios)}raise(){const t=this.points,n=[t[0]],i=t.length;for(let e,r,o=1;o<i;o++)e=t[o],r=t[o-1],n[o]={x:(i-o)/i*e.x+o/i*r.x,y:(i-o)/i*e.y+o/i*r.y};return n[i]=t[i-1],new e(n)}derivative(t){return Fp.compute(t,this.dpoints[0],this._3d)}dderivative(t){return Fp.compute(t,this.dpoints[1],this._3d)}align(){let t=this.points;return new e(Fp.align(t,{p1:t[0],p2:t[t.length-1]}))}curvature(t){return Fp.curvature(t,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return Fp.inflections(this.points)}normal(t){return this._3d?this.__normal3(t):this.__normal2(t)}__normal2(t){const e=this.derivative(t),n=zp(e.x*e.x+e.y*e.y);return{t:t,x:-e.y/n,y:e.x/n}}__normal3(t){const e=this.derivative(t),n=this.derivative(t+.01),i=zp(e.x*e.x+e.y*e.y+e.z*e.z),r=zp(n.x*n.x+n.y*n.y+n.z*n.z);e.x/=i,e.y/=i,e.z/=i,n.x/=r,n.y/=r,n.z/=r;const o={x:n.y*e.z-n.z*e.y,y:n.z*e.x-n.x*e.z,z:n.x*e.y-n.y*e.x},s=zp(o.x*o.x+o.y*o.y+o.z*o.z);o.x/=s,o.y/=s,o.z/=s;const a=[o.x*o.x,o.x*o.y-o.z,o.x*o.z+o.y,o.x*o.y+o.z,o.y*o.y,o.y*o.z-o.x,o.x*o.z-o.y,o.y*o.z+o.x,o.z*o.z];return{t:t,x:a[0]*e.x+a[1]*e.y+a[2]*e.z,y:a[3]*e.x+a[4]*e.y+a[5]*e.z,z:a[6]*e.x+a[7]*e.y+a[8]*e.z}}hull(t){let e=this.points,n=[],i=[],r=0;for(i[r++]=e[0],i[r++]=e[1],i[r++]=e[2],3===this.order&&(i[r++]=e[3]);e.length>1;){n=[];for(let o,s=0,a=e.length-1;s<a;s++)o=Fp.lerp(t,e[s],e[s+1]),i[r++]=o,n.push(o);e=n}return i}split(t,n){if(0===t&&n)return this.split(n).left;if(1===n)return this.split(t).right;const i=this.hull(t),r={left:2===this.order?new e([i[0],i[3],i[5]]):new e([i[0],i[4],i[7],i[9]]),right:2===this.order?new e([i[5],i[4],i[2]]):new e([i[9],i[8],i[6],i[3]]),span:i};return r.left._t1=Fp.map(0,0,1,this._t1,this._t2),r.left._t2=Fp.map(t,0,1,this._t1,this._t2),r.right._t1=Fp.map(t,0,1,this._t1,this._t2),r.right._t2=Fp.map(1,0,1,this._t1,this._t2),n?(n=Fp.map(n,t,1,0,1),r.right.split(n).left):r}extrema(){const t={};let e=[];return this.dims.forEach(function(n){let i=function(t){return t[n]},r=this.dpoints[0].map(i);t[n]=Fp.droots(r),3===this.order&&(r=this.dpoints[1].map(i),t[n]=t[n].concat(Fp.droots(r))),t[n]=t[n].filter((function(t){return t>=0&&t<=1})),e=e.concat(t[n].sort(Fp.numberSort))}.bind(this)),t.values=e.sort(Fp.numberSort).filter((function(t,n){return e.indexOf(t)===n})),t}bbox(){const t=this.extrema(),e={};return this.dims.forEach(function(n){e[n]=Fp.getminmax(this,n,t[n])}.bind(this)),e}overlaps(t){const e=this.bbox(),n=t.bbox();return Fp.bboxoverlap(e,n)}offset(t,n){if(void 0!==n){const e=this.get(t),i=this.normal(t),r={c:e,n:i,x:e.x+i.x*n,y:e.y+i.y*n};return this._3d&&(r.z=e.z+i.z*n),r}if(this._linear){const n=this.normal(0),i=this.points.map((function(e){const i={x:e.x+t*n.x,y:e.y+t*n.y};return e.z&&n.z&&(i.z=e.z+t*n.z),i}));return[new e(i)]}return this.reduce().map((function(e){return e._linear?e.offset(t)[0]:e.scale(t)}))}simple(){if(3===this.order){const t=Fp.angle(this.points[0],this.points[3],this.points[1]),e=Fp.angle(this.points[0],this.points[3],this.points[2]);if(t>0&&e<0||t<0&&e>0)return!1}const t=this.normal(0),e=this.normal(1);let n=t.x*e.x+t.y*e.y;return this._3d&&(n+=t.z*e.z),Op(Lp(n))<Wp/3}reduce(){let t,e,n=0,i=0,r=.01,o=[],s=[],a=this.extrema().values;for(-1===a.indexOf(0)&&(a=[0].concat(a)),-1===a.indexOf(1)&&a.push(1),n=a[0],t=1;t<a.length;t++)i=a[t],e=this.split(n,i),e._t1=n,e._t2=i,o.push(e),n=i;return o.forEach((function(t){for(n=0,i=0;i<=1;)for(i=n+r;i<=1.01;i+=r)if(e=t.split(n,i),!e.simple()){if(i-=r,Op(n-i)<r)return[];e=t.split(n,i),e._t1=Fp.map(n,0,1,t._t1,t._t2),e._t2=Fp.map(i,0,1,t._t1,t._t2),s.push(e),n=i;break}n<1&&(e=t.split(n,1),e._t1=Fp.map(n,0,1,t._t1,t._t2),e._t2=t._t2,s.push(e))})),s}translate(t,n,i){i="number"==typeof i?i:n;const r=this.order;let o=this.points.map(((t,e)=>(1-e/r)*n+e/r*i));return new e(this.points.map(((e,n)=>({x:e.x+t.x*o[n],y:e.y+t.y*o[n]}))))}scale(t){const n=this.order;let i=!1;if("function"==typeof t&&(i=t),i&&2===n)return this.raise().scale(i);const r=this.clockwise,o=this.points;if(this._linear)return this.translate(this.normal(0),i?i(0):t,i?i(1):t);const s=i?i(0):t,a=i?i(1):t,l=[this.offset(0,10),this.offset(1,10)],c=[],u=Fp.lli4(l[0],l[0].c,l[1],l[1].c);if(!u)throw new Error("cannot scale this curve. Try reducing it first.");return[0,1].forEach((function(t){const e=c[t*n]=Fp.copy(o[t*n]);e.x+=(t?a:s)*l[t].n.x,e.y+=(t?a:s)*l[t].n.y})),i?([0,1].forEach((function(e){if(2!==n||!e){var s=o[e+1],a={x:s.x-u.x,y:s.y-u.y},l=i?i((e+1)/n):t;i&&!r&&(l=-l);var d=zp(a.x*a.x+a.y*a.y);a.x/=d,a.y/=d,c[e+1]={x:s.x+l*a.x,y:s.y+l*a.y}}})),new e(c)):([0,1].forEach((t=>{if(2===n&&t)return;const e=c[t*n],i=this.derivative(t),r={x:e.x+i.x,y:e.y+i.y};c[t+1]=Fp.lli4(e,r,u,o[t+1])})),new e(c))}outline(t,n,i,r){if(n=void 0===n?t:n,this._linear){const o=this.normal(0),s=this.points[0],a=this.points[this.points.length-1];let l,c,u;void 0===i&&(i=t,r=n),l={x:s.x+o.x*t,y:s.y+o.y*t},u={x:a.x+o.x*i,y:a.y+o.y*i},c={x:(l.x+u.x)/2,y:(l.y+u.y)/2};const d=[l,c,u];l={x:s.x-o.x*n,y:s.y-o.y*n},u={x:a.x-o.x*r,y:a.y-o.y*r},c={x:(l.x+u.x)/2,y:(l.y+u.y)/2};const h=[u,c,l],f=Fp.makeline(h[2],d[0]),p=Fp.makeline(d[2],h[0]),m=[f,new e(d),p,new e(h)];return new Cp(m)}const o=this.reduce(),s=o.length,a=[];let l,c=[],u=0,d=this.length();const h=void 0!==i&&void 0!==r;function f(t,e,n,i,r){return function(o){const s=i/n,a=(i+r)/n,l=e-t;return Fp.map(o,0,1,t+s*l,t+a*l)}}o.forEach((function(e){const o=e.length();h?(a.push(e.scale(f(t,i,d,u,o))),c.push(e.scale(f(-n,-r,d,u,o)))):(a.push(e.scale(t)),c.push(e.scale(-n))),u+=o})),c=c.map((function(t){return l=t.points,l[3]?t.points=[l[3],l[2],l[1],l[0]]:t.points=[l[2],l[1],l[0]],t})).reverse();const p=a[0].points[0],m=a[s-1].points[a[s-1].points.length-1],v=c[s-1].points[c[s-1].points.length-1],g=c[0].points[0],y=Fp.makeline(v,p),b=Fp.makeline(m,g),k=[y].concat(a).concat([b]).concat(c);return new Cp(k)}outlineshapes(t,e,n){e=e||t;const i=this.outline(t,e).curves,r=[];for(let t=1,e=i.length;t<e/2;t++){const o=Fp.makeshape(i[t],i[e-t],n);o.startcap.virtual=t>1,o.endcap.virtual=t<e/2-1,r.push(o)}return r}intersects(t,n){return t?t.p1&&t.p2?this.lineIntersects(t):(t instanceof e&&(t=t.reduce()),this.curveintersects(this.reduce(),t,n)):this.selfintersects(n)}lineIntersects(t){const e=Pp(t.p1.x,t.p2.x),n=Pp(t.p1.y,t.p2.y),i=Rp(t.p1.x,t.p2.x),r=Rp(t.p1.y,t.p2.y);return Fp.roots(this.points,t).filter((t=>{var o=this.get(t);return Fp.between(o.x,e,i)&&Fp.between(o.y,n,r)}))}selfintersects(t){const e=this.reduce(),n=e.length-2,i=[];for(let r,o,s,a=0;a<n;a++)o=e.slice(a,a+1),s=e.slice(a+2),r=this.curveintersects(o,s,t),i.push(...r);return i}curveintersects(t,e,n){const i=[];t.forEach((function(t){e.forEach((function(e){t.overlaps(e)&&i.push({left:t,right:e})}))}));let r=[];return i.forEach((function(t){const e=Fp.pairiteration(t.left,t.right,n);e.length>0&&(r=r.concat(e))})),r}arcs(t){return t=t||.5,this._iterate(t,[])}_error(t,e,n,i){const r=(i-n)/4,o=this.get(n+r),s=this.get(i-r),a=Fp.dist(t,e),l=Fp.dist(t,o),c=Fp.dist(t,s);return Op(l-a)+Op(c-a)}_iterate(t,e){let n,i=0,r=1;do{n=0,r=1;let o,s,a,l,c,u=this.get(i),d=!1,h=!1,f=r,p=1;do{if(h=d,l=a,f=(i+r)/2,o=this.get(f),s=this.get(r),a=Fp.getccenter(u,o,s),a.interval={start:i,end:r},d=this._error(a,u,i,r)<=t,c=h&&!d,c||(p=r),d){if(r>=1){if(a.interval.end=p=1,l=a,r>1){let t={x:a.x+a.r*Dp(a.e),y:a.y+a.r*Bp(a.e)};a.e+=Fp.angle({x:a.x,y:a.y},t,this.get(1))}break}r+=(r-i)/2}else r=f}while(!c&&n++<100);if(n>=100)break;l=l||a,e.push(l),i=p}while(r<1);return e}};var $p={pointsToCurve:function(t,e){let n=1/e;if(0===t.length){let t=[];for(let i=0;i<e;i++){let e=i*n;t.push({x:e,y:.5})}return t}if(1===t.length){let i=t[0].y,r=[{x:0,y:i}];for(let t=0;t<e;t++){let e=t*n+n;r.push({x:e,y:i})}return r}let i=[],r=t[0],o=t[t.length-1],s=new jp({x:o.x-1,y:o.y},{x:o.x-1+(r.x-(o.x-1))/2,y:o.y},{x:r.x-(r.x-(o.x-1))/2,y:r.y},r),a=new jp(o,{x:o.x+(r.x+1-o.x)/2,y:o.y},{x:r.x+1-(r.x+1-o.x)/2,y:r.y},{x:r.x+1,y:r.y});for(let e=0;e<t.length-1;e++){let n=t[e],r=t[e+1],o={x:n.x+(r.x-n.x)/2,y:n.y},s={x:r.x-(r.x-n.x)/2,y:r.y},a=new jp(n,o,s,r);i.push(a)}i.unshift(s),i.push(a);let l=[s.get(s.intersects({p1:{x:0,y:0},p2:{x:0,y:1}})[0])];for(let t=0;t<e;t++){let e,r=t*n+n;i.every((t=>{let n=t.intersects({p1:{x:r,y:0},p2:{x:r,y:1}});return!(n.length>0&&(e=t.get(n[0]),l.push(e),1))}))}return l}};class Up{constructor(t,e){this.xs=t,this.ys=e,this.ks=this.getNaturalKs(new Float64Array(this.xs.length))}getNaturalKs(t){const e=this.xs.length-1,n=function(t,e){const n=[];for(let i=0;i<t;i++)n.push(new Float64Array(e));return n}(e+1,e+2);for(let t=1;t<e;t++)n[t][t-1]=1/(this.xs[t]-this.xs[t-1]),n[t][t]=2*(1/(this.xs[t]-this.xs[t-1])+1/(this.xs[t+1]-this.xs[t])),n[t][t+1]=1/(this.xs[t+1]-this.xs[t]),n[t][e+1]=3*((this.ys[t]-this.ys[t-1])/((this.xs[t]-this.xs[t-1])*(this.xs[t]-this.xs[t-1]))+(this.ys[t+1]-this.ys[t])/((this.xs[t+1]-this.xs[t])*(this.xs[t+1]-this.xs[t])));return n[0][0]=2/(this.xs[1]-this.xs[0]),n[0][1]=1/(this.xs[1]-this.xs[0]),n[0][e+1]=3*(this.ys[1]-this.ys[0])/((this.xs[1]-this.xs[0])*(this.xs[1]-this.xs[0])),n[e][e-1]=1/(this.xs[e]-this.xs[e-1]),n[e][e]=2/(this.xs[e]-this.xs[e-1]),n[e][e+1]=3*(this.ys[e]-this.ys[e-1])/((this.xs[e]-this.xs[e-1])*(this.xs[e]-this.xs[e-1])),function(t,e){const n=t.length;let i=0,r=0;for(;i<n&&r<=n;){let e=0,o=-1/0;for(let s=i;s<n;s++){const n=Math.abs(t[s][r]);n>o&&(e=s,o=n)}if(0===t[e][r])r++;else{qp(t,i,e);for(let e=i+1;e<n;e++){const o=t[e][r]/t[i][r];t[e][r]=0;for(let s=r+1;s<=n;s++)t[e][s]-=t[i][s]*o}i++,r++}}for(let i=n-1;i>=0;i--){var o=0;t[i][i]&&(o=t[i][n]/t[i][i]),e[i]=o;for(let e=i-1;e>=0;e--)t[e][n]-=t[e][i]*o,t[e][i]=0}return e}(n,t)}getIndexBefore(t){let e=0,n=this.xs.length,i=0;for(;e<n;)i=Math.floor((e+n)/2),this.xs[i]<t&&i!==e?e=i:n=this.xs[i]>=t&&i!==n?i:e;return e===this.xs.length-1?this.xs.length-1:e+1}at(t){let e=this.getIndexBefore(t);const n=(t-this.xs[e-1])/(this.xs[e]-this.xs[e-1]),i=this.ks[e-1]*(this.xs[e]-this.xs[e-1])-(this.ys[e]-this.ys[e-1]),r=-this.ks[e]*(this.xs[e]-this.xs[e-1])+(this.ys[e]-this.ys[e-1]);return(1-n)*this.ys[e-1]+n*this.ys[e]+n*(1-n)*(i*(1-n)+r*n)}}function qp(t,e,n){let i=t[e];t[e]=t[n],t[n]=i}function Vp(t,e,n){const i=n[0],r=n[n.length-1];if(t<i.x)return i.y;if(t>r.x)return r.y;const o=e.at(t);return Math.max(0,Math.min(o,1))}var Gp={pointsToCurve:function(t,e){if(!Array.isArray(t)||!t.every((t=>"object"==typeof t&&"number"==typeof t.x&&"number"==typeof t.y&&t.x>=0&&t.x<=1&&t.y>=0&&t.y<=1)))throw new Error("[pointsToCurve] Invalid points. Expected array of objects with x and y in [0, 1] range.");if(!("number"==typeof e&&e>=1))throw new Error(`[pointsToCurve] Invalid resolution: ${e}. Expected integer >= 1.`);const n=t.map((t=>t.x)),i=t.map((t=>t.y)),r=new Up(n,i);let o=[];for(let n=0;n<e;n++)o.push(Vp(n/(e-1),r,t));return o}};function Hp(t,e=256,n={}){return"bezier"===n.type?$p.pointsToCurve(t,e,n):Gp.pointsToCurve(t,e)}const Kp=[];for(let t=0;t<256;t++)Kp[t]=t;class Xp extends Zf{constructor(t){const e={vertex:mp,fragment:vp},n={uniforms:Zf.getUniformInfo(Xp)};super(Xp.getFilterType(),e,n,t)}static getFilterType(){return"curves"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=[];var n;e=[...t.master||t.points||t.masterPoints?t.master||(n=t.points||t.masterPoints,Hp(n,256).map((t=>255*t))):Kp],this.uniforms[Gf.STATIC_OPTIONS].set(e)}}function Yp(t,e,n){if("number"!=typeof t||t<0||t>255)throw new Error(`[levels] Invalid black point: ${t}. Expected integer between 0 and 255`);if("number"!=typeof e||e<0||e>255)throw new Error(`[levels] Invalid white point: ${e}. Expected integer between 0 and 255`);if("number"!=typeof n||n<.01||n>9.99)throw new Error(`[levels] Invalid gamma: ${n}. Expected float between 0.01 and 9.99`);if(t>e)throw new Error(`[levels] Invalid black and white points: ${t}, ${e}. Expected black <= white`);let i=[];for(let r=0;r<256;r++){let o;o=r<=t?0:r>=e?255:255*Math.pow((r-t)/(e-t),1/n),i[r]=o}return i}class Qp extends Zf{constructor(t){const e={vertex:mp,fragment:vp},n={uniforms:Zf.getUniformInfo(Qp)};super(Qp.getFilterType(),e,n,t)}static getFilterType(){return"levels"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=[...Yp(t.black,t.white,t.gamma)];this.uniforms[Gf.STATIC_OPTIONS].set(e)}}const Jp=360,Zp=[];for(let t=0;t<Jp;t++)Zp[t]=t;class tm extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(tm)};super(tm.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\n\n// a 360 length array with values for the hue curve\n// this represents a lookup table from a hue value to another hue value\nuniform float staticOptions[360];\n\n// implementation of round (doesn't exist in webgl)\nint round(float val){\n return int(floor(val + 0.5));\n}\n\n// glsl mod doesn't work with negative numbers so\n// this is a safer version that lets us play with negatives > -1.0\nfloat safeMod(float val){\n return mod(val + 1.0, 1.0);\n}\n\n// no dynamic array indexes in webgl\n// see https://stackoverflow.com/questions/30585265/what-can-i-use-as-an-array-index-in-glsl-in-webgl\nfloat getCurveValue(float pixelValue){\n float v;\n for (int k = 0; k < 360; k++) {\n if (k == round(pixelValue * 359.0)){\n v = float(staticOptions[k]) / 359.0;\n }\n }\n return v;\n}\n\n// function source https://www.shadertoy.com/view/4dKcWK\nconst float EPSILON = 1e-10;\n\nvec3 HUEtoRGB(in float hue) {\n // Hue [0..1] to RGB [0..1]\n // See http://www.chilliant.com/rgb2hsv.html\n vec3 rgb = abs(hue * 6. - vec3(3, 2, 4)) * vec3(1, -1, -1) + vec3(-1, 2, 2);\n return clamp(rgb, 0., 1.);\n}\n\nvec3 RGBtoHCV(in vec3 rgb) {\n // RGB [0..1] to Hue-Chroma-Value [0..1]\n // Based on work by Sam Hocevar and Emil Persson\n vec4 p = (rgb.g < rgb.b) ? vec4(rgb.bg, -1., 2. / 3.) : vec4(rgb.gb, 0., -1. / 3.);\n vec4 q = (rgb.r < p.x) ? vec4(p.xyw, rgb.r) : vec4(rgb.r, p.yzx);\n float c = q.x - min(q.w, q.y);\n float h = abs((q.w - q.y) / (6. * c + EPSILON) + q.z);\n return vec3(h, c, q.x);\n}\n\nvec3 HSVtoRGB(in vec3 hsv) {\n // Hue-Saturation-Value [0..1] to RGB [0..1]\n vec3 rgb = HUEtoRGB(hsv.x);\n return ((rgb - 1.) * hsv.y + 1.) * hsv.z;\n}\n\nvec3 HSLtoRGB(in vec3 hsl) {\n // Hue-Saturation-Lightness [0..1] to RGB [0..1]\n vec3 rgb = HUEtoRGB(hsl.x);\n float c = (1. - abs(2. * hsl.z - 1.)) * hsl.y;\n return (rgb - 0.5) * c + hsl.z;\n}\n\nvec3 RGBtoHSV(in vec3 rgb) {\n // RGB [0..1] to Hue-Saturation-Value [0..1]\n vec3 hcv = RGBtoHCV(rgb);\n float s = hcv.y / (hcv.z + EPSILON);\n return vec3(hcv.x, s, hcv.z);\n}\n\nvec3 RGBtoHSL(in vec3 rgb) {\n // RGB [0..1] to Hue-Saturation-Lightness [0..1]\n vec3 hcv = RGBtoHCV(rgb);\n float z = hcv.z - hcv.y * 0.5;\n float s = hcv.y / (1. - abs(z * 2. - 1.) + EPSILON);\n return vec3(hcv.x, s, z);\n}\n\nvoid main() {\n vec4 textureColor = texture2D(first_texture, current_texture_coordinate_2d);\n vec3 inHSL = RGBtoHSL(textureColor.rgb);\n // in the UI hue 0 is cyan and 180 is red\n float shiftedHue = getCurveValue(mod(inHSL.x + 0.5, 1.0));\n vec3 inRGB = HSLtoRGB(vec3(shiftedHue, inHSL.y, inHSL.z));\n\n vec4 finalColor = vec4(inRGB, textureColor.a);\n\n // During the rgb-to-hsl-to-rgb conversion total whites gets clipped on OSX for some reason\n // make sure to retain absolute white (since it has no chroma component)\n if (textureColor.r == 1.0 && textureColor.g == 1.0 && textureColor.b == 1.0){\n finalColor.rgb = vec3(1.0, 1.0, 1.0);\n }\n\n gl_FragColor = finalColor;\n}\n"},e,t)}static getFilterType(){return"hue"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=t.points&&function(t){return Hp(t,Jp,{type:"bezier"}).map((t=>{return e=t,((Math.round(e.x*Jp)+180)%Jp+(1-e.y-.5)*Jp+Jp)%Jp;var e}))}(t.points)||Zp;this.uniforms[Gf.STATIC_OPTIONS].set(e)}}class em extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(em)};super(em.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\nuniform float staticOptions[2];\n\n//CIE L*a*b* (CIELAB, L* for lightness, a* from green to red, b* from blue to yellow)\n//Source: https://gist.github.com/mattatz/44f081cac87e2f7c8980 (HLSL)\nvec3 rgb2xyz(vec3 c){\n vec3 tmp=vec3(\n (c.r>.04045)?pow((c.r+.055)/1.055,2.4):c.r/12.92,\n (c.g>.04045)?pow((c.g+.055)/1.055,2.4):c.g/12.92,\n (c.b>.04045)?pow((c.b+.055)/1.055,2.4):c.b/12.92\n );\n mat3 mat=mat3(\n .4124,.3576,.1805,\n .2126,.7152,.0722,\n .0193,.1192,.9505\n );\n return 100.*(tmp*mat);\n}\nvec3 xyz2lab(vec3 c){\n vec3 n=c/vec3(95.047,100.,108.883),\n v=vec3(\n (n.x>.008856)?pow(n.x,1./3.):(7.787*n.x)+(16./116.),\n (n.y>.008856)?pow(n.y,1./3.):(7.787*n.y)+(16./116.),\n (n.z>.008856)?pow(n.z,1./3.):(7.787*n.z)+(16./116.)\n );\n return vec3((116.*v.y)-16.,500.*(v.x-v.y),200.*(v.y-v.z));\n}\nvec3 rgb2lab(vec3 c){\n vec3 lab=xyz2lab(rgb2xyz(c));\n return vec3(lab.x/100.,.5+.5*(lab.y/127.),.5+.5*(lab.z/127.));\n}\nvec3 lab2xyz(vec3 c){\n float fy=(c.x+16.)/116.,\n fx=c.y/500.+fy,\n fz=fy-c.z/200.;\n return vec3(\n 95.047*((fx>.206897)?fx*fx*fx:(fx-16./116.)/7.787),\n 100. *((fy>.206897)?fy*fy*fy:(fy-16./116.)/7.787),\n 108.883*((fz>.206897)?fz*fz*fz:(fz-16./116.)/7.787)\n );\n}\nvec3 xyz2rgb(vec3 c){\n mat3 mat=mat3(\n 3.2406,-1.5372,-.4986,\n -.9689, 1.8758, .0415,\n .0557, -.2040,1.0570\n );\n vec3 v=(c/100.0)*mat,\n r=vec3(\n (v.r>.0031308)?((1.055*pow(v.r,(1./2.4)))-.055):12.92*v.r,\n (v.g>.0031308)?((1.055*pow(v.g,(1./2.4)))-.055):12.92*v.g,\n (v.b>.0031308)?((1.055*pow(v.b,(1./2.4)))-.055):12.92*v.b\n );\n return r;\n}\nvec3 lab2rgb(vec3 c){return xyz2rgb(lab2xyz(vec3(100.*c.x,2.*127.*(c.y-.5),2.*127.*(c.z-.5))));}\n\n\nfloat handleMix(float x){\n return pow(x * 2.0 - 1.0, 2.0);\n}\n\nvoid main() {\n vec3 inColor = texture2D(first_texture, current_texture_coordinate_2d).rgb;\n// inColor = vec3(148.0 / 255.0, 99.0 / 255.0, 95.0 / 255.0); // debug\n\n vec3 inLab = rgb2lab(inColor);\n vec3 inRGB ;\n\n// vec2 tempTint = vec2(staticOptions[1], -staticOptions[0]);\n\n// inLab.yz += (tempTint.xy); // * 0.3; // damping of effect\n\n // lab range is 0 to 1, input is -128 to 127\n // lab chromacity zero is 0.5, 0.5 so convert between the ranges\n // y is a, z is b\n inLab.y -= (-staticOptions[1] + 128.0) / 255.0 - 0.5;\n inLab.z -= (staticOptions[0] + 128.0) / 255.0 - 0.5;\n\n inRGB = lab2rgb(inLab);\n\n\n // vec3 mixed = mix(inRGB, inColor, handleMix(inLab.x)); // mid tones\n // vec3 mixed = mix(inRGB, inColor, inLab.x); // only high tones\n vec3 mixed = mix(inRGB, inColor, 0.0); // no mix\n\n gl_FragColor = vec4(mixed,1.0);\n}\n"},e,t)}static getFilterType(){return"whiteBalance"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=t.temperature?t.temperature:0,n=t.tint?t.tint:0;this.uniforms[Gf.STATIC_OPTIONS].set([e,n])}}class nm extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(nm)};super(nm.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\nuniform float staticOptions[4];\n\n// algorithm from here\n// https://github.com/CeeJayDK/SweetFX/blob/master/Shaders/Vibrance.fx\n\nvoid main() {\n float percentAmount = staticOptions[0];\n float redBalance = staticOptions[1];\n float greenBalance = staticOptions[2];\n float blueBalance = staticOptions[3];\n\n vec3 color = texture2D(first_texture, current_texture_coordinate_2d).rgb;\n vec3 coefLuma = vec3(0.212656, 0.715158, 0.072186);\n\n float luma = dot(coefLuma, color);\n\n float max_color = max(color.r, max(color.g, color.b)); // Find the strongest color\n float min_color = min(color.r, min(color.g, color.b)); // Find the weakest color\n\n float color_saturation = max_color - min_color; // The difference between the two is the saturation\n\n // Extrapolate between luma and original by 1 + (1-saturation) - current\n vec3 coeffVibrance = vec3(redBalance, greenBalance, blueBalance) * percentAmount;\n\n color.r = mix(luma, color.r, 1.0 + (coeffVibrance.r * (1.0 - (sign(coeffVibrance.r) * color_saturation))));\n color.g = mix(luma, color.g, 1.0 + (coeffVibrance.g * (1.0 - (sign(coeffVibrance.g) * color_saturation))));\n color.b = mix(luma, color.b, 1.0 + (coeffVibrance.b * (1.0 - (sign(coeffVibrance.b) * color_saturation))));\n\n\n gl_FragColor = vec4(color, 1.0);\n\n}\n"},e,t)}static getFilterType(){return"vibrance"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=t.amount?t.amount/100*2:0,n=null===t.redBalance?1:t.redBalance,i=null===t.greenBalance?1:t.greenBalance,r=null===t.blueBalance?1:t.blueBalance;this.uniforms[Gf.STATIC_OPTIONS].set([e,n,i,r])}}class im extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(im)};super(im.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\nuniform float staticOptions[1];\n\n// algorithm from here\n// https://github.com/minus34/cesium1/blob/master/Cesium/Shaders/Builtin/Functions/saturation.glsl\n\n/**\n * Adjusts the saturation of a color.\n *\n * @name czm_saturation\n * @glslFunction\n *\n * @param {vec3} rgb The color.\n * @param {float} adjustment The amount to adjust the saturation of the color.\n *\n * @returns {float} The color with the saturation adjusted.\n *\n * @example\n * vec3 greyScale = czm_saturation(color, 0.0);\n * vec3 doubleSaturation = czm_saturation(color, 2.0);\n */\nvec3 czm_saturation(vec3 rgb, float adjustment)\n{\n // Algorithm from Chapter 16 of OpenGL Shading Language\n const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n vec3 intensity = vec3(dot(rgb, W));\n return mix(intensity, rgb, adjustment);\n}\n\n\nvoid main() {\n float amount = staticOptions[0];\n vec3 color = texture2D(first_texture, current_texture_coordinate_2d).rgb;\n gl_FragColor = vec4(czm_saturation(color, amount), 1.0);\n}\n"},e,t)}static getFilterType(){return"saturation"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=null===t.amount?1:t.amount;this.uniforms[Gf.STATIC_OPTIONS].set([e])}}class rm extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(rm)};super(rm.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float staticOptions[12];\nuniform float runtimeOptions[4];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\n\nfloat roundedBoxSDF(vec2 CenterPosition, vec2 Size, float Radius) {\n return length(max(abs(CenterPosition)-Size+Radius,0.0))-Radius;\n}\n\nvoid main() {\n vec2 srcAR = vec2(runtimeOptions[0]/runtimeOptions[1], 1.0);\n // custom aspect ratio (other than the default 1920/1080)\n // useful for example when doing crop on crop\n if (staticOptions[10] > 0.0) { //\n srcAR.x = staticOptions[10];\n }\n vec2 srcCenter = vec2(staticOptions[0], staticOptions[1]);\n vec2 srcDims = vec2(staticOptions[2], staticOptions[3]);\n vec2 srcTL = vec2(srcCenter.x - srcDims[0] / 2.0, srcCenter.y - srcDims[1] / 2.0); // top left point\n\n vec2 srcDims_AR = srcDims * srcAR;\n vec2 srcTL_AR = srcTL * srcAR;\n\n vec2 vpDims = vec2(runtimeOptions[2], runtimeOptions[3]);\n vec2 vpAR = vec2(vpDims[0]/vpDims[1], 1.0);\n\n vec2 tgtCenter = vec2(staticOptions[4], staticOptions[5]);\n vec2 tgtDims = vec2(staticOptions[6], staticOptions[7]);\n vec2 tgtTL = vec2(tgtCenter.x - tgtDims[0] / 2.0, tgtCenter.y - tgtDims[1] / 2.0);\n\n vec2 tgtDims_AR = tgtDims * vpAR;\n vec2 tgtTL_AR = tgtTL * vpAR;\n\n vec2 pos_AR = current_texture_coordinate_2d * vpAR;\n\n float ratioW = tgtDims_AR[0] / srcDims_AR[0];\n float ratioH = tgtDims_AR[1] / srcDims_AR[1];\n\n float ratio;\n\n // the type of crop fit. 0 - contain, 1 - fill, 3 - stretch\n float fitType = staticOptions[8];\n\n if (fitType == 0.0){\n ratio = ratioW > ratioH ? ratioW : ratioH;\n vec2 tgtDims_OLD_AR = tgtDims_AR;\n tgtDims_AR = srcDims_AR * ratio;\n tgtTL_AR = tgtTL_AR - (tgtDims_AR - tgtDims_OLD_AR) / 2.0;\n } else if (fitType == 1.0){\n ratio = ratioW < ratioH ? ratioW : ratioH;\n vec2 tgtDims_OLD_AR = tgtDims_AR;\n tgtDims_AR = srcDims_AR * ratio;\n tgtTL_AR = tgtTL_AR + (tgtDims_OLD_AR - tgtDims_AR) / 2.0;\n }\n\n vec2 final_pos_AR = (pos_AR - tgtTL_AR) / tgtDims_AR * srcDims_AR + srcTL_AR;\n\n // transform coords back from AR into 0 to 1 range\n vec2 pos = final_pos_AR / srcAR;\n\n // How soft the edges should be . Higher values could be used to simulate a drop shadow.\n float edgeSoftness = staticOptions[11];\n\n // The radius of the corners in pixels\n float radius = staticOptions[9];\n\n float tightDistance = roundedBoxSDF((current_texture_coordinate_2d - tgtCenter) , tgtDims_AR / vpAR / 2.0, 0.0);\n// float distance = roundedBoxSDF((current_texture_coordinate_2d - tgtCenter) * vpAR, tgtDims * vpAR / 2.0, 0.01);\n float distance = roundedBoxSDF((current_texture_coordinate_2d - tgtCenter) * vpDims, (tgtDims * vpDims) / 2.0, radius);\n\n // Smooth the result (free antialiasing).\n float smoothedAlpha = 1.0 - smoothstep(0.0, edgeSoftness * 2.0, distance);\n\n // Return the resultant shape.\n vec4 textureColor = texture2D(first_texture, pos);\n vec4 quadColor = vec4(textureColor.xyz, smoothedAlpha);\n\n // Apply a drop shadow effect.\n// float shadowSoftness = 0.0;\n// vec2 shadowOffset = vec2(0.0, 0.0);\n// float shadowDistance = roundedBoxSDF(pos + shadowOffset, tgtDims_AR / 2.0, radius);\n// float shadowAlpha = 1.0 - smoothstep(-shadowSoftness, shadowSoftness, shadowDistance);\n// vec4 shadowColor = vec4(0.4, 0.4, 0.4, 1.0);\n // gl_FragColor = mix(quadColor, shadowColor, shadowAlpha - smoothedAlpha);\n\n\n // pillarboxing\n if (tightDistance > 0.0 && distance <= 0.0){\n gl_FragColor = vec4(0, 0, 0, 1.0);\n } else {\n gl_FragColor = quadColor;\n }\n\n // debug\n // gl_FragColor = texture2D(first_texture, pos);\n\n}"},e,t)}static getFilterType(){return"crop"}static getInputsCount(){return 1}static getInitialOptions(){return{source:{center:{x:.5,y:.5},width:1,height:1},target:{center:{x:.5,y:.5},width:1,height:1},fitType:"fill",cornerRadius:10,edgeSoftness:0}}getOptionsDisplay(){return[]}static getUniformList(){return[Gf.FIRST_TEXTURE,Uf,qf]}handleStaticUniforms(t){let e={...rm.getInitialOptions(),...t};const n=Number.parseFloat(e.source.center.x).toFixed(5),i=Number.parseFloat(e.source.center.y).toFixed(5),r=Number.parseFloat(e.source.width).toFixed(5),o=Number.parseFloat(e.source.height).toFixed(5),s=Number.parseFloat(e.target.center.x).toFixed(5),a=Number.parseFloat(e.target.center.y).toFixed(5),l=Number.parseFloat(e.target.width).toFixed(5),c=Number.parseFloat(e.target.height).toFixed(5),u=Number.parseFloat(e.edgeSoftness).toFixed(5),d=e.source.aspectRatio?Number.parseFloat(e.source.aspectRatio).toFixed(5):0;let h;h="fill"===e.fitType?0:"contain"===e.fitType?1:2;const f=Number.parseFloat(e.cornerRadius).toFixed(5);this.uniforms[Gf.STATIC_OPTIONS].set([n,i,r,o,s,a,l,c,h,f,d,u])}}class om extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(om)};super(om.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float staticOptions[4];\nuniform float runtimeOptions[2];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\n\nvoid main() {\n // this is the the texture from the prev shader\n vec4 texture = texture2D(first_texture, current_texture_coordinate_2d);\n vec4 color = vec4(staticOptions[0], staticOptions[1], staticOptions[2], 1.0);\n vec4 blended = mix(texture, color, staticOptions[3]);\n gl_FragColor = blended;\n}"},e,t)}static getFilterType(){return"solid"}static getInputsCount(){return 1}static getInitialOptions(){return{color:{r:.33,g:.66,b:.99,a:1}}}getOptionsDisplay(){return[{properties:["color","r"],type:"slider",minValue:0,maxValue:1,step:.001},{properties:["color","g"],type:"slider",minValue:0,maxValue:1,step:.001},{properties:["color","b"],type:"slider",minValue:0,maxValue:1,step:.001}]}handleStaticUniforms(t){var e;const n=Number.parseFloat(t.color.r).toFixed(5),i=Number.parseFloat(t.color.g).toFixed(5),r=Number.parseFloat(t.color.b).toFixed(5),o=(null!==(e=Number.parseFloat(t.color.a))&&void 0!==e?e:1).toFixed(5);this.uniforms[Gf.STATIC_OPTIONS].set([n,i,r,o])}}class sm extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(sm)};super(sm.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float runtimeOptions[1];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\n\nvoid main() {\n vec4 textureColor = texture2D(first_texture, current_texture_coordinate_2d);\n gl_FragColor = vec4(textureColor.rgb, 1.0);\n}\n"},e,t)}static getFilterType(){return"solidImage"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}}class am extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(am)};super(am.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_position = vec4(position_3d.xyz, 1);\n gl_Position = normalize_position;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\n\n//CIE L*a*b* (CIELAB, L* for lightness, a* from green to red, b* from blue to yellow)\n//Source: https://gist.github.com/mattatz/44f081cac87e2f7c8980 (HLSL)\nvec3 rgb2xyz(vec3 c){\n vec3 tmp=vec3(\n (c.r>.04045)?pow((c.r+.055)/1.055,2.4):c.r/12.92,\n (c.g>.04045)?pow((c.g+.055)/1.055,2.4):c.g/12.92,\n (c.b>.04045)?pow((c.b+.055)/1.055,2.4):c.b/12.92\n );\n mat3 mat=mat3(\n .4124,.3576,.1805,\n .2126,.7152,.0722,\n .0193,.1192,.9505\n );\n return 100.*(tmp*mat);\n}\nvec3 xyz2lab(vec3 c){\n vec3 n=c/vec3(95.047,100.,108.883),\n v=vec3(\n (n.x>.008856)?pow(n.x,1./3.):(7.787*n.x)+(16./116.),\n (n.y>.008856)?pow(n.y,1./3.):(7.787*n.y)+(16./116.),\n (n.z>.008856)?pow(n.z,1./3.):(7.787*n.z)+(16./116.)\n );\n return vec3((116.*v.y)-16.,500.*(v.x-v.y),200.*(v.y-v.z));\n}\nvec3 rgb2lab(vec3 c){\n vec3 lab=xyz2lab(rgb2xyz(c));\n return vec3(lab.x/100.,.5+.5*(lab.y/127.),.5+.5*(lab.z/127.));\n}\n\nvoid main() {\n vec3 inColor = texture2D(first_texture, current_texture_coordinate_2d).rgb;\n vec3 inLab = rgb2lab(inColor);\n gl_FragColor = vec4(inLab, 1.0);\n}\n"},e,t)}static getFilterType(){return"lab"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=t.temperature?t.temperature:0,n=t.tint?t.tint:0;this.uniforms[Gf.STATIC_OPTIONS].set([e,n])}}class lm extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(lm)};super(lm.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n} ",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\nuniform float staticOptions[1];\n\nvoid main() {\n float exposureStops = staticOptions[0];\n vec3 color = texture2D(first_texture, current_texture_coordinate_2d).rgb;\n \n // Convert exposure stops to multiplier: pow(2.0, stops)\n float multiplier = pow(2.0, exposureStops);\n \n // Apply exposure adjustment\n vec3 exposedColor = color * multiplier;\n \n gl_FragColor = vec4(exposedColor, 1.0);\n} "},e,t)}static getFilterType(){return"exposure"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=null===t.exposure?0:t.exposure;this.uniforms[Gf.STATIC_OPTIONS].set([e])}}var cm,um,dm,hm,fm,pm,mm,vm;function gm(){if(hm)return dm;hm=1;const t=um?cm:(um=1,cm={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]}),e={};for(const n of Object.keys(t))e[t[n]]=n;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"]}};dm=n;for(const t of Object.keys(n)){if(!("channels"in n[t]))throw new Error("missing channels property: "+t);if(!("labels"in n[t]))throw new Error("missing channel labels property: "+t);if(n[t].labels.length!==n[t].channels)throw new Error("channel and label counts mismatch: "+t);const{channels:e,labels:i}=n[t];delete n[t].channels,delete n[t].labels,Object.defineProperty(n[t],"channels",{value:e}),Object.defineProperty(n[t],"labels",{value:i})}function i(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}return n.rgb.hsl=function(t){const e=t[0]/255,n=t[1]/255,i=t[2]/255,r=Math.min(e,n,i),o=Math.max(e,n,i),s=o-r;let a,l;o===r?a=0:e===o?a=(n-i)/s:n===o?a=2+(i-e)/s:i===o&&(a=4+(e-n)/s),a=Math.min(60*a,360),a<0&&(a+=360);const c=(r+o)/2;return l=o===r?0:c<=.5?s/(o+r):s/(2-o-r),[a,100*l,100*c]},n.rgb.hsv=function(t){let e,n,i,r,o;const s=t[0]/255,a=t[1]/255,l=t[2]/255,c=Math.max(s,a,l),u=c-Math.min(s,a,l),d=function(t){return(c-t)/6/u+.5};return 0===u?(r=0,o=0):(o=u/c,e=d(s),n=d(a),i=d(l),s===c?r=i-n:a===c?r=1/3+e-i:l===c&&(r=2/3+n-e),r<0?r+=1:r>1&&(r-=1)),[360*r,100*o,100*c]},n.rgb.hwb=function(t){const e=t[0],i=t[1];let r=t[2];const o=n.rgb.hsl(t)[0],s=1/255*Math.min(e,Math.min(i,r));return r=1-1/255*Math.max(e,Math.max(i,r)),[o,100*s,100*r]},n.rgb.cmyk=function(t){const e=t[0]/255,n=t[1]/255,i=t[2]/255,r=Math.min(1-e,1-n,1-i);return[100*((1-e-r)/(1-r)||0),100*((1-n-r)/(1-r)||0),100*((1-i-r)/(1-r)||0),100*r]},n.rgb.keyword=function(n){const r=e[n];if(r)return r;let o,s=1/0;for(const e of Object.keys(t)){const r=i(n,t[e]);r<s&&(s=r,o=e)}return o},n.keyword.rgb=function(e){return t[e]},n.rgb.xyz=function(t){let e=t[0]/255,n=t[1]/255,i=t[2]/255;return e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92,[100*(.4124*e+.3576*n+.1805*i),100*(.2126*e+.7152*n+.0722*i),100*(.0193*e+.1192*n+.9505*i)]},n.rgb.lab=function(t){const e=n.rgb.xyz(t);let i=e[0],r=e[1],o=e[2];return i/=95.047,r/=100,o/=108.883,i=i>.008856?i**(1/3):7.787*i+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,o=o>.008856?o**(1/3):7.787*o+16/116,[116*r-16,500*(i-r),200*(r-o)]},n.hsl.rgb=function(t){const e=t[0]/360,n=t[1]/100,i=t[2]/100;let r,o,s;if(0===n)return s=255*i,[s,s,s];r=i<.5?i*(1+n):i+n-i*n;const a=2*i-r,l=[0,0,0];for(let t=0;t<3;t++)o=e+1/3*-(t-1),o<0&&o++,o>1&&o--,s=6*o<1?a+6*(r-a)*o:2*o<1?r:3*o<2?a+(r-a)*(2/3-o)*6:a,l[t]=255*s;return l},n.hsl.hsv=function(t){const e=t[0];let n=t[1]/100,i=t[2]/100,r=n;const o=Math.max(i,.01);return i*=2,n*=i<=1?i:2-i,r*=o<=1?o:2-o,[e,100*(0===i?2*r/(o+r):2*n/(i+n)),(i+n)/2*100]},n.hsv.rgb=function(t){const e=t[0]/60,n=t[1]/100;let i=t[2]/100;const r=Math.floor(e)%6,o=e-Math.floor(e),s=255*i*(1-n),a=255*i*(1-n*o),l=255*i*(1-n*(1-o));switch(i*=255,r){case 0:return[i,l,s];case 1:return[a,i,s];case 2:return[s,i,l];case 3:return[s,a,i];case 4:return[l,s,i];case 5:return[i,s,a]}},n.hsv.hsl=function(t){const e=t[0],n=t[1]/100,i=t[2]/100,r=Math.max(i,.01);let o,s;s=(2-n)*i;const a=(2-n)*r;return o=n*r,o/=a<=1?a:2-a,o=o||0,s/=2,[e,100*o,100*s]},n.hwb.rgb=function(t){const e=t[0]/360;let n=t[1]/100,i=t[2]/100;const r=n+i;let o;r>1&&(n/=r,i/=r);const s=Math.floor(6*e),a=1-i;o=6*e-s,1&s&&(o=1-o);const l=n+o*(a-n);let c,u,d;switch(s){default:case 6:case 0:c=a,u=l,d=n;break;case 1:c=l,u=a,d=n;break;case 2:c=n,u=a,d=l;break;case 3:c=n,u=l,d=a;break;case 4:c=l,u=n,d=a;break;case 5:c=a,u=n,d=l}return[255*c,255*u,255*d]},n.cmyk.rgb=function(t){const e=t[0]/100,n=t[1]/100,i=t[2]/100,r=t[3]/100;return[255*(1-Math.min(1,e*(1-r)+r)),255*(1-Math.min(1,n*(1-r)+r)),255*(1-Math.min(1,i*(1-r)+r))]},n.xyz.rgb=function(t){const e=t[0]/100,n=t[1]/100,i=t[2]/100;let r,o,s;return r=3.2406*e+-1.5372*n+-.4986*i,o=-.9689*e+1.8758*n+.0415*i,s=.0557*e+-.204*n+1.057*i,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,r=Math.min(Math.max(0,r),1),o=Math.min(Math.max(0,o),1),s=Math.min(Math.max(0,s),1),[255*r,255*o,255*s]},n.xyz.lab=function(t){let e=t[0],n=t[1],i=t[2];return e/=95.047,n/=100,i/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,[116*n-16,500*(e-n),200*(n-i)]},n.lab.xyz=function(t){let e,n,i;n=(t[0]+16)/116,e=t[1]/500+n,i=n-t[2]/200;const r=n**3,o=e**3,s=i**3;return n=r>.008856?r:(n-16/116)/7.787,e=o>.008856?o:(e-16/116)/7.787,i=s>.008856?s:(i-16/116)/7.787,e*=95.047,n*=100,i*=108.883,[e,n,i]},n.lab.lch=function(t){const e=t[0],n=t[1],i=t[2];let r;return r=360*Math.atan2(i,n)/2/Math.PI,r<0&&(r+=360),[e,Math.sqrt(n*n+i*i),r]},n.lch.lab=function(t){const e=t[0],n=t[1],i=t[2]/360*2*Math.PI;return[e,n*Math.cos(i),n*Math.sin(i)]},n.rgb.ansi16=function(t,e=null){const[i,r,o]=t;let s=null===e?n.rgb.hsv(t)[2]:e;if(s=Math.round(s/50),0===s)return 30;let a=30+(Math.round(o/255)<<2|Math.round(r/255)<<1|Math.round(i/255));return 2===s&&(a+=60),a},n.hsv.ansi16=function(t){return n.rgb.ansi16(n.hsv.rgb(t),t[2])},n.rgb.ansi256=function(t){const e=t[0],n=t[1],i=t[2];return e===n&&n===i?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5)},n.ansi16.rgb=function(t){let e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];const n=.5*(1+~~(t>50));return[(1&e)*n*255,(e>>1&1)*n*255,(e>>2&1)*n*255]},n.ansi256.rgb=function(t){if(t>=232){const e=10*(t-232)+8;return[e,e,e]}let e;return t-=16,[Math.floor(t/36)/5*255,Math.floor((e=t%36)/6)/5*255,e%6/5*255]},n.rgb.hex=function(t){const e=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(e.length)+e},n.hex.rgb=function(t){const e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let n=e[0];3===e[0].length&&(n=n.split("").map((t=>t+t)).join(""));const i=parseInt(n,16);return[i>>16&255,i>>8&255,255&i]},n.rgb.hcg=function(t){const e=t[0]/255,n=t[1]/255,i=t[2]/255,r=Math.max(Math.max(e,n),i),o=Math.min(Math.min(e,n),i),s=r-o;let a,l;return a=s<1?o/(1-s):0,l=s<=0?0:r===e?(n-i)/s%6:r===n?2+(i-e)/s:4+(e-n)/s,l/=6,l%=1,[360*l,100*s,100*a]},n.hsl.hcg=function(t){const e=t[1]/100,n=t[2]/100,i=n<.5?2*e*n:2*e*(1-n);let r=0;return i<1&&(r=(n-.5*i)/(1-i)),[t[0],100*i,100*r]},n.hsv.hcg=function(t){const e=t[1]/100,n=t[2]/100,i=e*n;let r=0;return i<1&&(r=(n-i)/(1-i)),[t[0],100*i,100*r]},n.hcg.rgb=function(t){const e=t[0]/360,n=t[1]/100,i=t[2]/100;if(0===n)return[255*i,255*i,255*i];const r=[0,0,0],o=e%1*6,s=o%1,a=1-s;let l=0;switch(Math.floor(o)){case 0:r[0]=1,r[1]=s,r[2]=0;break;case 1:r[0]=a,r[1]=1,r[2]=0;break;case 2:r[0]=0,r[1]=1,r[2]=s;break;case 3:r[0]=0,r[1]=a,r[2]=1;break;case 4:r[0]=s,r[1]=0,r[2]=1;break;default:r[0]=1,r[1]=0,r[2]=a}return l=(1-n)*i,[255*(n*r[0]+l),255*(n*r[1]+l),255*(n*r[2]+l)]},n.hcg.hsv=function(t){const e=t[1]/100,n=e+t[2]/100*(1-e);let i=0;return n>0&&(i=e/n),[t[0],100*i,100*n]},n.hcg.hsl=function(t){const e=t[1]/100,n=t[2]/100*(1-e)+.5*e;let i=0;return n>0&&n<.5?i=e/(2*n):n>=.5&&n<1&&(i=e/(2*(1-n))),[t[0],100*i,100*n]},n.hcg.hwb=function(t){const e=t[1]/100,n=e+t[2]/100*(1-e);return[t[0],100*(n-e),100*(1-n)]},n.hwb.hcg=function(t){const e=t[1]/100,n=1-t[2]/100,i=n-e;let r=0;return i<1&&(r=(n-i)/(1-i)),[t[0],100*i,100*r]},n.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},n.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},n.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},n.gray.hsl=function(t){return[0,0,t[0]]},n.gray.hsv=n.gray.hsl,n.gray.hwb=function(t){return[0,100,t[0]]},n.gray.cmyk=function(t){return[0,0,0,t[0]]},n.gray.lab=function(t){return[t[0],0,0]},n.gray.hex=function(t){const e=255&Math.round(t[0]/100*255),n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n},n.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]},dm}function ym(){if(pm)return fm;pm=1;const t=gm();function e(t,e){return function(n){return e(t(n))}}function n(n,i){const r=[i[n].parent,n];let o=t[i[n].parent][n],s=i[n].parent;for(;i[s].parent;)r.unshift(i[s].parent),o=e(t[i[s].parent][s],o),s=i[s].parent;return o.conversion=r,o}return fm=function(e){const i=function(e){const n=function(){const e={},n=Object.keys(t);for(let t=n.length,i=0;i<t;i++)e[n[i]]={distance:-1,parent:null};return e}(),i=[e];for(n[e].distance=0;i.length;){const e=i.pop(),r=Object.keys(t[e]);for(let t=r.length,o=0;o<t;o++){const t=r[o],s=n[t];-1===s.distance&&(s.distance=n[e].distance+1,s.parent=e,i.unshift(t))}}return n}(e),r={},o=Object.keys(i);for(let t=o.length,e=0;e<t;e++){const t=o[e];null!==i[t].parent&&(r[t]=n(t,i))}return r}}var bm=function(){if(vm)return mm;vm=1;const t=gm(),e=ym(),n={};return Object.keys(t).forEach((i=>{n[i]={},Object.defineProperty(n[i],"channels",{value:t[i].channels}),Object.defineProperty(n[i],"labels",{value:t[i].labels});const r=e(i);Object.keys(r).forEach((t=>{const e=r[t];n[i][t]=function(t){const e=function(...e){const n=e[0];if(null==n)return n;n.length>1&&(e=n);const i=t(e);if("object"==typeof i)for(let t=i.length,e=0;e<t;e++)i[e]=Math.round(i[e]);return i};return"conversion"in t&&(e.conversion=t.conversion),e}(e),n[i][t].raw=function(t){const e=function(...e){const n=e[0];return null==n?n:(n.length>1&&(e=n),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}(e)}))})),mm=n}(),km=Ud(bm);class xm extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(xm)};super(xm.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform float staticOptions[3];\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 blend = texture2D(first_texture, current_texture_coordinate_2d);\n \n vec3 blendRGB = blend.rgb;\n vec3 baseRGB = vec3(staticOptions[0], staticOptions[1], staticOptions[2]);\n \n vec3 limit = step(0.5, blendRGB);\n vec3 mixedRGB = mix(2.0 * baseRGB * blendRGB, 1.0 - 2.0 * (1.0 - baseRGB) * (1.0 - blendRGB), limit);\n \n gl_FragColor = vec4((mixedRGB * blend.a) + ((1.0 - blend.a) * baseRGB), 1);\n}"},e,t)}static getFilterType(){return"hardLight"}static getInputsCount(){return 1}static getInitialOptions(){return{color:"4b0082"}}getOptionsDisplay(){return[{properties:["color"],type:"colorPicker"}]}handleStaticUniforms(t){const e=km.hex.rgb(t.color).map((t=>t/255));this.uniforms[Gf.STATIC_OPTIONS].set([e[0],e[1],e[2]])}}class wm extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(wm)};super(wm.getFilterType(),{vertex:"precision lowp float;\n\nattribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[1];\nuniform float staticOptions[6];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float exposure_value;\n\n\nfloat getCurrentBeizerProgress(vec2 p1, vec2 p2, float t){\n vec2 p0 = vec2(0,0);\n vec2 p3 = vec2(1,1);\n \n vec2 E = mix(p0, p1, t);\n vec2 F = mix(p1, p2, t);\n vec2 G = mix(p2, p3, t);\n\n vec2 H = mix(E, F, t);\n vec2 I = mix(F, G, t);\n\n vec2 P = mix(H, I, t);\n\n return P.y;\n}\n\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n \n // transfrom logic // \n // normalized time range from 0 to 1\n float current_time = runtimeOptions[0];\n float current_power_progress = getCurrentBeizerProgress(\n vec2(staticOptions[2], staticOptions[3]),\n vec2(staticOptions[4], staticOptions[5]),\n current_time\n );\n \n current_texture_coordinate_2d = texture_coordinate_2d;\n exposure_value = mix(staticOptions[0], staticOptions[1], current_power_progress);\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float exposure_value;\n\nvoid main() {\n vec4 texture = texture2D(first_texture, current_texture_coordinate_2d);\n gl_FragColor = vec4((texture.xyz) * (1.0 + exposure_value) , texture.w);\n}\n\n"},e,t)}static getFilterType(){return"exposureTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{properties:{power:{form:0,to:0,ease:[0,0,1,1]}}}}handleStaticUniforms(t){const e=t.properties.power;this.uniforms[Gf.STATIC_OPTIONS].set([e.from,e.to,...e.ease])}static getUniformList(){return[Gf.FIRST_TEXTURE,Vf]}}class _m extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(_m)};super(_m.getFilterType(),{vertex:"precision lowp float;\n\nattribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[1];\nuniform float staticOptions[6];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float dipToBlack_value;\n\n\nfloat getCurrentBeizerProgress(vec2 p1, vec2 p2, float t){\n vec2 p0 = vec2(0,0);\n vec2 p3 = vec2(1,1);\n \n vec2 E = mix(p0, p1, t);\n vec2 F = mix(p1, p2, t);\n vec2 G = mix(p2, p3, t);\n\n vec2 H = mix(E, F, t);\n vec2 I = mix(F, G, t);\n\n vec2 P = mix(H, I, t);\n\n return P.y;\n}\n\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n \n // transfrom logic // \n // normalized time range from 0 to 1\n float current_time = runtimeOptions[0];\n float current_power_progress = getCurrentBeizerProgress(\n vec2(staticOptions[2], staticOptions[3]),\n vec2(staticOptions[4], staticOptions[5]),\n current_time\n );\n \n current_texture_coordinate_2d = texture_coordinate_2d;\n dipToBlack_value = mix(staticOptions[0], staticOptions[1], current_power_progress);\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float dipToBlack_value;\n\nvoid main() {\n vec4 texture = texture2D(first_texture, current_texture_coordinate_2d);\n gl_FragColor = vec4(texture.xyz - dipToBlack_value, texture.w);\n}"},e,t)}static getFilterType(){return"dipToBlackTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{}}handleStaticUniforms(t){const e=t.properties.power;this.uniforms[Gf.STATIC_OPTIONS].set([e.from,e.to,...e.ease])}static getUniformList(){return[Gf.FIRST_TEXTURE,Vf]}}class Im extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(Im)};super(Im.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[1];\nuniform float staticOptions[16];\n\nvarying vec2 current_texture_coordinate_2d;\n\nfloat getCurrentBeizerProgress(vec2 p1, vec2 p2, float t){\n vec2 p0 = vec2(0,0);\n vec2 p3 = vec2(1,1);\n \n vec2 E = mix(p0, p1, t);\n vec2 F = mix(p1, p2, t);\n vec2 G = mix(p2, p3, t);\n\n vec2 H = mix(E, F, t);\n vec2 I = mix(F, G, t);\n\n vec2 P = mix(H, I, t);\n\n return P.y;\n}\n\n\nvoid main() {\n // time range from 0 to 1\n float current_time = runtimeOptions[0];\n\n // scale X\n float current_scale_x_progress = getCurrentBeizerProgress(\n vec2(staticOptions[4],staticOptions[5]),\n vec2(staticOptions[6],staticOptions[7]),\n current_time\n );\n float currnet_scale_x_value = mix(staticOptions[0], staticOptions[1], current_scale_x_progress);\n\n // scale Y\n float current_scale_y_progress = getCurrentBeizerProgress(\n vec2(staticOptions[4],staticOptions[5]),\n vec2(staticOptions[6],staticOptions[7]),\n current_time\n );\n float currnet_scale_y_value = mix(staticOptions[2], staticOptions[3], current_scale_y_progress);\n\n // translate x\n float current_translate_x_progress = getCurrentBeizerProgress(\n vec2(staticOptions[12],staticOptions[13]),\n vec2(staticOptions[14],staticOptions[15]),\n current_time\n );\n \n float currnet_translate_x_value = mix(staticOptions[8], staticOptions[9], current_translate_x_progress); \n\n // translate y\n float current_translate_y_progress = getCurrentBeizerProgress(\n vec2(staticOptions[12],staticOptions[13]),\n vec2(staticOptions[14],staticOptions[15]),\n current_time\n );\n float currnet_translate_y_value = mix(staticOptions[10], staticOptions[11], current_translate_y_progress); \n\n // See Default vertex shader, we normalize y axis to be -y\n // because of webgl texture coordinates\n currnet_translate_y_value = currnet_translate_y_value * -1.0;\n\n // create matries\n mat4 scaleMatrix;\n scaleMatrix[0] = vec4(currnet_scale_x_value, 0, 0, 0); \n scaleMatrix[1] = vec4(0, currnet_scale_y_value, 0, 0); \n scaleMatrix[2] = vec4(0, 0, 1, 0); \n scaleMatrix[3] = vec4(0, 0, 0, 1); \n\n mat4 translateMatrix;\n translateMatrix[0] = vec4(1, 0, 0, 0); \n translateMatrix[1] = vec4(0, 1, 0, 0); \n translateMatrix[2] = vec4(0, 0, 1, 0); \n translateMatrix[3] = vec4(currnet_translate_x_value, currnet_translate_y_value, 0, 1); \n\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = translateMatrix * scaleMatrix * normalize_poistion;\n // gl_Position = translateMatrix * scaleMatrix * normalize_poistion;\n \n \n current_texture_coordinate_2d = texture_coordinate_2d;\n \n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n gl_FragColor = texture2D(first_texture, current_texture_coordinate_2d);\n}"},e,t)}static getFilterType(){return"transformTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{}}handleStaticUniforms(t){const e=t.properties.scale||{},n=t.properties.translate||{};e.ease=e.ease||[0,0,1,1],n.ease=n.ease||[0,0,1,1],this.uniforms[Gf.STATIC_OPTIONS].set([e.from&&e.from.x||1,e.to&&e.to.x||1,e.from&&e.from.y||1,e.to&&e.to.y||1,...e.ease,n.from&&n.from.x||0,n.to&&n.to.x||0,n.from&&n.from.y||0,n.to&&n.to.y||0,...n.ease])}static getUniformList(){return[Gf.FIRST_TEXTURE,Vf]}}class Tm extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(Tm)};super(Tm.getFilterType(),{vertex:"precision lowp float;\n\nattribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float staticOptions[8];\nuniform float runtimeOptions[3];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float current_power_value;\n\nfloat getCurrentBeizerProgress(vec2 p1, vec2 p2, float t){\n vec2 p0 = vec2(0,0);\n vec2 p3 = vec2(1,1);\n \n vec2 E = mix(p0, p1, t);\n vec2 F = mix(p1, p2, t);\n vec2 G = mix(p2, p3, t);\n\n vec2 H = mix(E, F, t);\n vec2 I = mix(F, G, t);\n\n vec2 P = mix(H, I, t);\n\n return P.y;\n}\n\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n float current_time = runtimeOptions[0];\n float current_power_progress = getCurrentBeizerProgress(\n vec2(staticOptions[2],staticOptions[3]),\n vec2(staticOptions[4],staticOptions[5]),\n current_time\n );\n \n // varing\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_power_value = mix(staticOptions[0], staticOptions[1], current_power_progress);\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform float staticOptions[8];\nuniform float runtimeOptions[3];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float current_power_value;\n\nconst int samples = 12; //multiple of 2\n\nvoid main() {\n vec2 pixel = vec2(1.0/runtimeOptions[1], 1.0/runtimeOptions[2]);\n vec2 direction = vec2(staticOptions[6], staticOptions[7]);\n \n vec4 color = vec4(0.0); \n\n for (int i=1; i<=samples/2; i++) {\n vec2 motion = float(i) * current_power_value / float(samples / 2) * direction * pixel;\n \n color += texture2D(\n first_texture,\n current_texture_coordinate_2d + motion);\n\n color += texture2D(\n first_texture,\n current_texture_coordinate_2d - motion);\n }\n\t\n color = color/float(samples);\n\n \n gl_FragColor = color;\n // gl_FragColor = vec4(0,1,0,1);\n \n}"},e,t)}static getFilterType(){return"motionBlurTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{}}handleStaticUniforms(t){const e=t.properties.power||{from:0,to:0},n=t.properties.direction||{x:0,y:0};e.ease=e.ease||[0,0,1,1],this.uniforms[Gf.STATIC_OPTIONS].set([e.from,e.to,...e.ease,n.x,n.y])}static getUniformList(){return[Gf.FIRST_TEXTURE,Vf,Uf]}}class Em extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(Em)};super(Em.getFilterType(),{vertex:"precision lowp float;\n\nattribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[1];\nuniform float staticOptions[9];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float current_power_value;\n\nfloat getCurrentBeizerProgress(vec2 p1, vec2 p2, float t){\n vec2 p0 = vec2(0,0);\n vec2 p3 = vec2(1,1);\n \n vec2 E = mix(p0, p1, t);\n vec2 F = mix(p1, p2, t);\n vec2 G = mix(p2, p3, t);\n\n vec2 H = mix(E, F, t);\n vec2 I = mix(F, G, t);\n\n vec2 P = mix(H, I, t);\n\n return P.y;\n}\n\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n float current_time = runtimeOptions[0];\n float current_power_progress = getCurrentBeizerProgress(\n vec2(staticOptions[2],staticOptions[3]),\n vec2(staticOptions[4],staticOptions[5]),\n current_time\n );\n \n // varing\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_power_value = mix(staticOptions[0], staticOptions[1], current_power_progress);\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform float staticOptions[9];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float current_power_value;\n\nvoid main() {\n vec4 texture = texture2D(first_texture, current_texture_coordinate_2d);\n vec4 fadeColor = vec4(staticOptions[6], staticOptions[7], staticOptions[8], 1.0) ;\n gl_FragColor = mix(texture,fadeColor, current_power_value);\n}"},e,t)}static getFilterType(){return"fadeToColorTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{properties:{power:{form:0,to:0,ease:[0,0,1,1]},color:"#FFFFFF"}}}handleStaticUniforms(t){const e=t.properties.power||{from:0,to:0};e.ease=e.ease||[0,0,1,1];const n=t.properties.color,i=km.hex.rgb(n).map((t=>t/255));this.uniforms[Gf.STATIC_OPTIONS].set([e.from,e.to,...e.ease,i[0],i[1],i[2]])}static getUniformList(){return[Gf.FIRST_TEXTURE,Vf]}}var Sm=Object.freeze({__proto__:null,Crop:rm,Curves:Xp,Default:tp,DipToBlackTransition:_m,DirectionalBlur:up,Exposure:lm,ExposureTransition:wm,FadeToColorTransition:Em,FastBlur:cp,HardLight:xm,HorizontalBlur:ap,Hue:tm,Lab:am,Levels:Qp,Lut:pp,MotionBlurTransition:Tm,Opacity:dp,Saturation:im,ShapeComposite:fp,ShapeCompositeMask:hp,Solid:om,SolidImage:sm,Transform:sp,TransformTransition:Im,VerticalBlur:lp,Vibrance:nm,WhiteBalance:em});const Mm=Object.values(Sm).reduce(((t,e)=>(t[e.getFilterType()]=e,t)),{});class Am{constructor(t){this.context=t}static getFilterClass(t){return Mm[t]}getFilterIds(){return Object.keys(this.filterTypeToInstanceMap)}create(t,e){this.context={...this.context,options:e.options};const n=new Mm[t](this.context);if(!n)throw new Error(`${t} is not a atom filter, atomFilter list: `,this.getFilterIds());return n}}const Nm=qh.PREVIOUS_OUTPUT_PREFIX,Fm=Object.values(Sm).reduce(((t,e)=>(t[e.getFilterType()]={type:e.getFilterType(),options:e.getInitialOptions(),inputs:[...Array(e.getInputsCount())].map(((t,e)=>`${Nm}${e}`)),outputs:[]},t)),{});var Cm,Om,Pm=function(){if(Om)return Cm;Om=1;var t=function(t){return function(t){return!!t&&"object"==typeof t}(t)&&(n=t,!("[object RegExp]"===(i=Object.prototype.toString.call(n))||"[object Date]"===i||n.$$typeof===e));var n,i},e="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(t,e){return!1!==e.clone&&e.isMergeableObject(t)?s((n=t,Array.isArray(n)?[]:{}),t,e):t;var n}function i(t,e,i){return t.concat(e).map((function(t){return n(t,i)}))}function r(t){return Object.keys(t).concat((e=t,Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]));var e}function o(t,e){try{return e in t}catch(t){return!1}}function s(e,a,l){(l=l||{}).arrayMerge=l.arrayMerge||i,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=n;var c=Array.isArray(a);return c===Array.isArray(e)?c?l.arrayMerge(e,a,l):function(t,e,i){var a={};return i.isMergeableObject(t)&&r(t).forEach((function(e){a[e]=n(t[e],i)})),r(e).forEach((function(r){var l,c;o(l=t,c=r)&&(!Object.hasOwnProperty.call(l,c)||!Object.propertyIsEnumerable.call(l,c))||(o(t,r)&&i.isMergeableObject(e[r])?a[r]=function(t,e){if(!e.customMerge)return s;var n=e.customMerge(t);return"function"==typeof n?n:s}(r,i)(t[r],e[r],i):a[r]=n(e[r],i))})),a}(e,a,l):n(a,l)}return s.all=function(t,e){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce((function(t,n){return s(t,n,e)}),{})},Cm=s}(),Rm=Ud(Pm),Dm=function(t,e){return Rm(t,e,{arrayMerge:(t,e)=>e})};const Bm=qh.MESSAGES.UPDATE_OPTIONS;let Lm=class{constructor(t,e){this.eventEmitter=new Xh,this.type=t,this.inputs=e.inputs,this.outputs=e.outputs,this.options=e.options}render(){throw new Error("concrete class should implement")}_updateOptions(){throw new Error("concrete class should implement")}updateOptions(t){this._updateOptions(t),this.eventEmitter.emit(Bm,this.options)}updateInputs(t){t&&(this.inputs.length===t.length&&this.inputs.every(((e,n)=>e===t[n]))||(this.inputs=[...t]))}getEventEmitter(){return this.eventEmitter}getType(){return this.type}getInputs(){return this.inputs}getOutputs(){return this.outputs}getOptions(){return this.options}getInfo(){return{inputs:this.inputs,outputs:this.outputs,options:this.options}}getOptionsDisplay(){return this.filter.getOptionsDisplay()}dispose(){throw new Error("concrete class should implement")}};class zm extends Lm{constructor(t,e,n){super(...arguments),this.filter=n.filterFactory.create(this.type,{options:this.options})}render(t){const e=t.ioStore,n=t.graphIOManager,i=this.getInputs(),r=this.getOutputs(),o=e.get(i),s=this.filter.render(o,this.options);return n.setOutputs(e,r,s),s}_updateOptions(t){this.options=Dm(this.options,t),this.filter.updateStaticUniforms(this.options)}dispose(){this.filter.dispose()}}const Wm=qh.MESSAGES.UPDATE_OPTIONS;class jm extends zm{constructor(t,e,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}baseNodeUpdateOptions(t){this.options=Dm(this.options,t),this.filter.updateStaticUniforms(this.options)}registerListeners(){this.baseNode.getEventEmitter().on(Wm,this.baseNodeUpdateOptions,this)}dispose(){this.filter.dispose(),this.baseNode.getEventEmitter().off(Wm,this.baseNodeUpdateOptions,this)}}function $m(t){return null!==t&&"object"==typeof t}function Um(t){if(!$m(t)||(e=t,Array.isArray(e)))return t;var e;const n=Object.keys(t).sort(),i={};return n.forEach((e=>{i[e]=Um(t[e])})),i}function qm(t,e){return null!=t&&t.id&&null!=e&&e.id?t.type===e.type&&t.id===e.id:t.type===e.type}function Vm(t,e){const n=[];t.forEach(((t,i)=>{const r=(o=t,e.findIndex((t=>function(t,e){const n=JSON.parse(JSON.stringify(t));return r=JSON.parse(JSON.stringify(e)),$m(i=n)&&$m(r)?JSON.stringify(Um(i))===JSON.stringify(Um(r)):!(!Number.isNaN(i)||!Number.isNaN(r))||i===r;var i,r}(o,t))));var o;if(-1!==r)return void n.push({type:"take",index:r});const s=(a=t,l=i,(c=e)&&c[l]&&qm(a,c[l])?l:c.findIndex((t=>qm(a,t))));var a,l,c;-1===s?n.push({type:"create",newGraphIndex:i}):n.push({type:"update",currentGraphIndex:s,newGraphIndex:i})}));const i=n.reduce(((t,e)=>("take"===e.type?t.push(e.index):"update"===e.type&&t.push(e.currentGraphIndex),t)),[]);return e.reduce(((t,e,n)=>(i.includes(n)||t.push(n),t)),[]).forEach((t=>{n.push({type:"dispose",currentGraphIndex:t})})),n}function Gm(t,e,n,i){const r=[];return t.forEach((t=>{switch(t.type){case"take":r.push(n[t.index]);break;case"update":const o=e[t.newGraphIndex].options,s=n[t.currentGraphIndex];s.updateInputs(e[t.newGraphIndex].inputs),s.updateOptions(o),r.push(s);break;case"create":const a=rv.create(e[t.newGraphIndex],i);r.push(a);break;case"dispose":n[t.currentGraphIndex].dispose();break;default:throw new Error("cant apply action type: ",t.type)}})),r}var Hm=function(t,e,n,i){const r=t.graph,o=e.graph;if(!(o&&r&&Array.isArray(o)&&Array.isArray(r)))throw new Error("cant apply new composite options",t);return Gm(Vm(r,o),r,n,i)};class Km extends Lm{constructor(t,e,n){super(...arguments),this.context=n,this.nodes=this.createNodes(this.options)}createNodes(t){if(!t||!t.graph)throw new Error("cant create composite node, please supply info.options.graph");return t.graph.map((t=>rv.create(t,this.context)))}render(t){const e=t.ioStore,n=t.graphIOManager;let i=n.getPrevOutput(e);const r=this.outputs;if(this.nodes.length){const t=new ef(e),r="__PREVIOUS:0",o=[],s=new Set;this.nodes.forEach(((e,a)=>{const l={ioStore:t,graphIOManager:n},c=e.getOutputs?e.getOutputs():void 0,u=Array.isArray(c)?c:[],d={};u.forEach((e=>{d[e]=t.get(e)}));const h=t.get(r);i=e.render(l),a!==this.nodes.length-1&&o.push(i);const f=new Set;if(h&&h!==i&&f.add(h),u.forEach((t=>{const e=d[t];e&&e!==i&&f.add(e)})),f.size){const e=new Set(Object.values(t.get()));f.forEach((t=>{e.has(t)||(n.disposeTextures([t],i),s.add(t))}))}}));const a=o.filter((t=>!s.has(t)));n.disposeTextures(a,i)}return n.setOutputs(e,r,i),i}getOptionsDisplay(){return[]}_updateOptions(t){this.nodes=Hm(t,this.options,this.nodes,this.context),this.options=t}dispose(){this.nodes.forEach((t=>{t.dispose()}))}}const Xm=qh.MESSAGES.UPDATE_OPTIONS;class Ym extends Km{constructor(t,e,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}registerListeners(){this.baseNode.getEventEmitter().on(Xm,this.updateOptions,this)}dispose(){this.nodes.forEach((t=>{t.dispose()})),this.baseNode.getEventEmitter().off(Xm,this.updateOptions,this)}}const Qm=qh.SYSTEM_NODES.TAGS.ATOM,Jm=qh.SYSTEM_NODES.TAGS.FILTER,Zm=qh.SYSTEM_NODES.TAGS.COMPOSITE_FILTER,tv=qh.SYSTEM_NODES.TAGS.TRANSITION_FILTER,ev=qh.PREVIOUS_OUTPUT_PREFIX,nv=Object.keys(Fm);function iv(t,e){const n=(i=t.type,Fm[i]);var i;return t=Dm(n,t),new zm(t.type,t,e)}var rv={create:function(t,e){let n;switch(function(t){let e;return n=t,e=nv.includes(n)?Qm:t===Zm?Zm:t===tv?tv:Jm,e;var n}((t=JSON.parse(JSON.stringify(t))).type)){case Qm:n=iv(t,e);break;case Jm:n=function(t,e){const n=function(t,e){const n=e.get(t);if(!n)throw new Error(`no base node, cant resolve type: ${t}`);return n}(t.type,e.nodeStore),i=n.getType(),r=n.getInfo();let o;return t=Dm(r,t),e={...e,baseNode:n},o=i===Zm?new Ym(i,t,e):new jm(i,t,e),o}(t,e);break;case Zm:n=function(t,e){const n=t.type;return t=Dm({inputs:[`${ev}0`]},t),new Km(n,t,e)}(t,e);break;case tv:n=function(t,e){const n=t.options.filter;if(!n)throw new Error(`transition filter should supply base filter ${n}`);return t.type=`${n}Transition`,iv(t,e)}(t,e);break;default:throw new Error("cant create node",t.type)}return n}};const ov=qh.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS;var sv=function(t){const e={[ov]:Fm[ov]};for(const[n,i]of Object.entries(e)){const e=rv.create(i,t);t.nodeStore.set(n,e)}},av=function(t,e){for(const[n,i]of Object.entries(t)){const t=rv.create(i,e);e.nodeStore.set(n,t)}};const lv=qh.CAPTURED_FRAME_PREFIX;class cv{constructor(t){return this.textureManager=t.textureManager,this.currentFrameTextures={0:this.textureManager.createTexture({type:"frame"})},this.saveInNextFrameTextures=[],this.savedFramesTextures={},this.reservedUnits=new Set([this.currentFrameTextures[0].getUnit()]),{capture:this.capture.bind(this),createCaptureId:this.createCaptureId.bind(this),releaseCaptureId:this.releaseCaptureId.bind(this),getCurrentFrames:this.getCurrentFrames.bind(this),getSavedFrames:this.getSavedFrames.bind(this),isReservedUnit:this.isReservedUnit.bind(this)}}updateCurrentFrame(t,e){e=e||0,this.currentFrameTextures[e].fill(t)}saveFrame(t){0!==this.saveInNextFrameTextures.length&&(this.saveInNextFrameTextures.forEach((e=>{e.fill(t)})),this.saveInNextFrameTextures=[])}capture(t,e){(t.videoHeight>150||t.displayHeight>150)&&(this.updateCurrentFrame(t,e),this.saveFrame(t))}createCaptureId(){const t=this.textureManager.createTexture({type:"frame"});this.saveInNextFrameTextures.push(t);const e=t.getUnit(),n=`${lv}${e}`;return this.savedFramesTextures[n]=t,this.reservedUnits.add(e),n}releaseCaptureId(t){if("string"!=typeof t)throw new Error("capture id should be string");delete this.saveInNextFrameTextures[t];const e=t.split(":")[1];this.reservedUnits.delete(parseInt(e,10))}getCurrentFrames(){return this.currentFrameTextures}getSavedFrames(){return this.savedFramesTextures}isReservedUnit(t){return this.reservedUnits.has(t)}}const uv=sh("ShaderGraphApplication","warn"),dv=qh.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS,hv=Object.freeze({useCanvasSizedFilterTargets:!1,rebindAttributesOnProgramSwitch:!0,forwardContextAttributes:!0});function fv(t={}){const e=null==t?void 0:t.performanceToggles;return e&&"object"==typeof e?{...hv,...e}:{...hv}}class pv{constructor(t,e={}){return this.glSource=t,this.config=e,this.performanceToggles=fv(e),this.isContextLost=!1,this.isRecovering=!1,this.isDisposed=!1,this.pendingNodeOptionUpdates=new Map,this.doInit(t,e)}doInit(t,e){this.source=Zh(t),this.performanceToggles=fv(e),this.isDisposed=!1,this.resetViewportSyncState(),this.render=this.render.bind(this),this.resizeCanvasSize=this.resizeCanvasSize.bind(this),this.setSrcVidTracks=this.setSrcVidTracks.bind(this),this.onWebGLContextLost=this.onWebGLContextLost.bind(this),this.onForceRender=this.onForceRender.bind(this),this.resizeCanvasSize._shouldPreventDefault=!0;const n=function(t={},e=hv){const n=null!=t&&t.glOptions&&"object"==typeof t.glOptions?{...t.glOptions}:{},i=n.__shaderGraph&&"object"==typeof n.__shaderGraph?n.__shaderGraph:{};return{...n,__shaderGraph:{...i,forwardContextAttributes:!1!==e.forwardContextAttributes}}}(e,this.performanceToggles);return this.gl=this.source.init(this.setSrcVidTracks,this.resizeCanvasSize,n),this.addCanvasListeners(),this.addSourceListeners(),this.exposeDebugGlobalIfBrowser(),this.selectedRenderNode=null,this.setupRenderInfrastructure(t,e),e.userWillCallRender||(this.rafId=requestAnimationFrame(this.render)),this.dirtyCanvasSize=!0,{getNodes:this.getNodes.bind(this),addNodes:this.addClientNodes.bind(this),selectNode:this.selectNode.bind(this),addTexture:this.addTexture.bind(this),releaseTexture:this.releaseTexture.bind(this),captureTexture:this.captureTexture.bind(this),disposeTexture:this.disposeTexture.bind(this),updateOptions:this.updateOptions.bind(this),render:this.render,dispose:this.dispose.bind(this)}}exposeDebugGlobalIfBrowser(){"undefined"!=typeof window&&(window.ekoShaderGraph=this)}setupRenderInfrastructure(t,e){this.activeTextures=this.activeTextures||new Set,this.textureManager=new uf({gl:this.gl,activeTextures:this.activeTextures}),this.capturedFramesManager=new cv({textureManager:this.textureManager}),this.graphIOManager=new yf({glSource:t,gl:this.gl,textureManager:this.textureManager,capturedFramesManager:this.capturedFramesManager}),this.frameBufferFactory=new Tf({gl:this.gl,textureManager:this.textureManager,useCanvasSizedFilterTargets:this.performanceToggles.useCanvasSizedFilterTargets}),this.filterFactory=new Am({gl:this.gl,frameBufferFactory:this.frameBufferFactory,rebindAttributesOnProgramSwitch:this.performanceToggles.rebindAttributesOnProgramSwitch}),this.nodeStore=new ef,this.ioStore=new ef,sv({nodeStore:this.nodeStore,filterFactory:this.filterFactory}),this.addClientNodes(e.nodes,this.isRecovering)}getNodes(){return uv.debug("[getNodes]"),this.nodeStore.get()}addClientNodes(t,e=!1){if(uv.debug("[addClientNodes]",t),t&&!e&&(this.addClientNodeInvocations=this.addClientNodeInvocations||[],this.addClientNodeInvocations.push(t)),!e&&this.isContextUnavailable())return;t=t||{};const n=JSON.parse(JSON.stringify(t));av(n,{nodeStore:this.nodeStore,filterFactory:this.filterFactory})}addTexture(t,e,n){if(uv.debug("[addTexture]",t,e,n),this.isContextUnavailable())return null;let i=this.textureManager.createTexture({type:e});return i.isStatic=!0,t&&i.fill(t),this.graphIOManager.setTextureSource(this.ioStore,i,n),i}releaseTexture(t){uv.debug("[releaseTexture]",t),this.isContextUnavailable()||this.textureManager.releaseTexture(t)}selectNode(t){if(uv.debug("[selectNode]",t),!this.isContextUnavailable())return this.nodeStore.get(t)||uv.warn("Missing render node",t),void(this.selectedRenderNodeId=t);this.selectedRenderNodeId=t}captureTexture(){return uv.debug("[captureTexture]"),this.isContextUnavailable()?null:this.capturedFramesManager.createCaptureId()}disposeTexture(t){return uv.debug("[disposeTexture]",t),this.isContextUnavailable()||"string"!=typeof t?null:this.capturedFramesManager.releaseCaptureId(t)}setSrcVidTracks(t){this.isContextUnavailable()||this.capturedFramesManager&&this.capturedFramesManager.capture(t)}resizeCanvasSize(t,e,n,i){this.dirtyCanvasSize={width:n,height:i}}resetViewportSyncState(){this._lastSyncedViewportCanvasWidth=null,this._lastSyncedViewportCanvasHeight=null}syncViewportToCanvasBackingStoreIfChanged(){var t,e;const n=null===(t=this.gl)||void 0===t||null===(t=t.canvas)||void 0===t?void 0:t.width,i=null===(e=this.gl)||void 0===e||null===(e=e.canvas)||void 0===e?void 0:e.height;!Number.isFinite(n)||!Number.isFinite(i)||n<=0||i<=0||n===this._lastSyncedViewportCanvasWidth&&i===this._lastSyncedViewportCanvasHeight||(wf(n,i),this.gl.viewport(0,0,n,i),this._lastSyncedViewportCanvasWidth=n,this._lastSyncedViewportCanvasHeight=i)}isContextUnavailable(){return!!this.isDisposed||!(!this.isRecovering&&!this.isContextLost)||!(!this.gl||"function"!=typeof this.gl.isContextLost)&&this.gl.isContextLost()}queueNodeOptionUpdate(t,e){t&&e&&"object"==typeof e&&(this.pendingNodeOptionUpdates||(this.pendingNodeOptionUpdates=new Map),this.pendingNodeOptionUpdates.set(t,e))}applyPendingNodeOptionUpdates(t=!1){if(!this.pendingNodeOptionUpdates||!this.pendingNodeOptionUpdates.size)return;const e=Array.from(this.pendingNodeOptionUpdates.entries());this.pendingNodeOptionUpdates.clear(),e.forEach((([e,n])=>{try{if(t){const t=this.nodeStore.get(e);if(!t||"function"!=typeof t.updateOptions)return void this.queueNodeOptionUpdate(e,n);try{t.updateOptions(n)}catch(t){uv.error("Failed to apply pending node options",e,t),this.queueNodeOptionUpdate(e,n)}return}this.updateOptions(e,n)}catch(t){uv.error("Failed to apply pending node options",e,t)}}))}render(t={}){const{noRaf:e=!1}=t;if(this.isContextUnavailable())return;if(this.dirtyCanvasSize){let{width:t=this.gl.canvas.width,height:e=this.gl.canvas.height}=this.dirtyCanvasSize;wf(t,e),this.gl.canvas.width=t,this.gl.canvas.height=e,this.textureManager.refreshTextureObjects(),this.gl.viewport(0,0,t,e),this.dirtyCanvasSize=!1,this._lastSyncedViewportCanvasWidth=t,this._lastSyncedViewportCanvasHeight=e}this.syncViewportToCanvasBackingStoreIfChanged(),this.graphIOManager.setVideoSources(this.ioStore);let n={ioStore:this.ioStore,graphIOManager:this.graphIOManager};this.renderSelectedNode(n),this.config.onPreRenderToScreen&&this.config.onPreRenderToScreen(),this.renderToCanvas(n),this.config.onPostRenderToScreen&&this.config.onPostRenderToScreen(),this.graphIOManager.disposeAllStore(this.ioStore),n=null,!e&&!this.config.userWillCallRender&&(this.rafId=requestAnimationFrame(this.render))}renderSelectedNode(t){if(!this.selectedRenderNodeId)return;const e=this.nodeStore.get(this.selectedRenderNodeId);e&&"function"==typeof e.render?e.render(t):(uv.warn("Missing selected render node",this.selectedRenderNodeId),this.selectedRenderNodeId=null)}renderToCanvas(t){const e=this.nodeStore.get(dv);e&&"function"==typeof e.render?e.render(t):uv.warn("Missing render-to-canvas node")}updateOptions(t,e){if(uv.debug("[updateOptions]",t,e),this.isContextUnavailable())return void this.queueNodeOptionUpdate(t,e);const n=this.nodeStore.get(t);if(n&&"function"==typeof n.updateOptions)try{n.updateOptions(e)}catch(n){uv.error("Failed to update node options",t,n),this.queueNodeOptionUpdate(t,e)}else this.queueNodeOptionUpdate(t,e)}addSourceListeners(){var t;"function"==typeof(null===(t=this.source)||void 0===t?void 0:t.on)&&this.source.on("forcerender",this.onForceRender)}removeSourceListeners(){var t;"function"==typeof(null===(t=this.source)||void 0===t?void 0:t.off)&&this.source.off("forcerender",this.onForceRender)}addCanvasListeners(){var t;(null==this||null===(t=this.gl)||void 0===t?void 0:t.canvas)&&(this.config.noWebGLContextLostRecovery||this.gl.canvas.addEventListener("webglcontextlost",this.onWebGLContextLost))}removeCanvasListeners(){var t;(null==this||null===(t=this.gl)||void 0===t?void 0:t.canvas)&&this.gl.canvas.removeEventListener("webglcontextlost",this.onWebGLContextLost)}getNodesOptions(){const t=this.getNodes();let e={};return Object.keys(t).filter((t=>"__default"!==t)).forEach((n=>{e[n]=t[n].options})),e}getDocumentVisibilityPromise(){return new Promise((t=>{"visible"===document.visibilityState&&t();const e=()=>{"visible"===document.visibilityState&&(document.removeEventListener("visibilitychange",e),t())};document.addEventListener("visibilitychange",e)}))}onForceRender(){uv.info("[onForceRender]"),this.render({noRaf:!0})}async onWebGLContextLost(t){if(t&&"function"==typeof t.preventDefault&&t.preventDefault(),this.isDisposed||this.isRecovering)return;this.isContextLost=!0,this.isRecovering=!0;const e=this.getNodesOptions(),n=this.addClientNodeInvocations,i=this.selectedRenderNodeId;cancelAnimationFrame(this.rafId),uv.warn("WebGL context lost - attempting to recover");const r=async()=>{if(this.isDisposed)this.isRecovering=!1;else try{var t;if(await this.getDocumentVisibilityPromise(),this.isDisposed)return void(this.isRecovering=!1);if(this.gl&&"function"==typeof this.gl.isContextLost&&this.gl.isContextLost())return void setTimeout(r,200);this.dispose(!1),this.doInit(this.glSource,this.config),this.textureManager&&"function"==typeof this.textureManager.refreshActiveTextures&&this.textureManager.refreshActiveTextures(),n&&n.length&&n.forEach((t=>{uv.debug("Re-adding client nodes",t),this.addClientNodes(t,!0)})),Object.entries(e).forEach((([t,e])=>{uv.debug("Re-applying node options",t,e);const n=this.nodeStore.get(t);n&&"function"==typeof n.updateOptions&&n.updateOptions(e)})),i&&(this.selectedRenderNodeId=i),this.applyPendingNodeOptionUpdates(!0);const o="function"==typeof(null===(t=this.source)||void 0===t?void 0:t.recover);o&&(uv.debug("Recovering glSource (i.e. seeking/resetting player)"),await this.source.recover()),this.isContextLost=!1,this.isRecovering=!1,o&&this.render()}catch(t){uv.error("Failed to recover WebGL context, retrying",t),setTimeout(r,200)}};await r()}dispose(t=!0){if(this.selectedRenderNode=null,t&&(this.isDisposed=!0,this.isRecovering=!1,this.isContextLost=!1),this.source&&(this.removeSourceListeners(),"function"==typeof this.source.dispose&&this.source.dispose()),this.gl){this.removeCanvasListeners();const e=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS);for(let t=0;t<e;++t)this.gl.activeTexture(this.gl.TEXTURE0+t),this.gl.bindTexture(this.gl.TEXTURE_2D,null),this.gl.bindTexture(this.gl.TEXTURE_CUBE_MAP,null);if(this.gl.bindBuffer(this.gl.ARRAY_BUFFER,null),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,null),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null),this.gl.bindTexture(this.gl.TEXTURE_2D,null),this.gl.bindRenderbuffer(this.gl.RENDERBUFFER,null),t)try{this.gl.getExtension("WEBGL_lose_context").loseContext()}catch(t){console.error(t)}}this.selectedRenderNodeId=null,t&&delete this.addClientNodeInvocations}}class mv{constructor(t={}){this.options=t}get type(){return"stage"}getSignature(){return this.type}build({inputs:t=[]}={}){return{graph:[],outputs:t,signature:this.getSignature()}}}function vv(t={}){const e={source:{center:{x:.5,y:.5},width:1,height:1},target:{center:{x:.5,y:.5},width:1,height:1},fitType:"fill",cornerRadius:0,edgeSoftness:0},n={...e.source,...t.source||{}},i={...e.target,...t.target||{}};return{...e,...t,source:n,target:i}}class gv extends mv{get type(){return"retarget"}getSignature(){var t;const e=Array.isArray(null===(t=this.options)||void 0===t?void 0:t.frames)?this.options.frames:[];return`${this.type}:${e.length}`}build({inputs:t=[],stageIndex:e=0}={}){var n;const i=Array.isArray(null===(n=this.options)||void 0===n?void 0:n.frames)?this.options.frames:[];if(!i.length)return{graph:[],outputs:t,signature:this.getSignature()};const r=[],o=[];for(let n=0;n<t.length;n+=1){const s=t[n],a=i[n];if(!a){o.push(s);continue}const l=`retarget-${e}-${n}`;r.push({id:l,type:"crop",inputs:[s],outputs:[l],options:vv(a)}),o.push(l)}return{graph:r,outputs:o,signature:this.getSignature()}}}class yv{#M=new Map;constructor(){this.register("retarget",gv)}register(t,e){t&&"function"==typeof e&&this.#M.set(t,e)}create(t={}){const e="string"==typeof(null==t?void 0:t.type)?t.type:null;if(!e)return null;const n=this.#M.get(e);return n?new n((null==t?void 0:t.options)||{}):null}}class bv{constructor(t={}){this.params=t}static get panAndScanTarget(){return"pre"}static buildDefaultLayoutGraph(t=[]){const e=t[0]||"__SRC_TEXTURE:0";return{type:"default",signature:`default:${t.length}`,isDynamic:!1,graph:[{type:"opacity",inputs:[e],options:{power:1}}]}}static prepareRenderFrames({frames:t}={}){return Array.isArray(t)?t:[]}static getRenderTiming({timing:t}={}){return t&&"object"==typeof t?t:{}}static resetRenderState(t){}render(t){}}class kv extends bv{#A=null;#N=null;static get type(){return"default"}static get aliases(){return["DefaultRenderNode","default"]}static get requiresFrameCadence(){return!1}static buildLayoutGraph({inputs:t=[]}={}){return super.buildDefaultLayoutGraph(t)}static prepareRenderFrames({frames:t}={}){const e=Array.isArray(t)?t:[];if(e.length<=1)return e;const n=e[e.length-1];return n?[n]:e}render(t){var e;const n=(null==t||null===(e=t.visualFramesAvailable)||void 0===e?void 0:e.frames)||[];if(!n.length)return;const i=null==t?void 0:t.shaderGraph,r=null==t?void 0:t.shaderGraphNodeIds;if(!i||"function"!=typeof i.updateOptions||"function"!=typeof i.selectNode)return;const o=null==r?void 0:r.default;if(o)try{const t=n.map(((t,e)=>t?`__SRC_TEXTURE:${e}`:null)).filter(Boolean),e=kv.buildLayoutGraph({inputs:t}),r=e.signature;this.#A!==r&&(i.updateOptions(o,{graph:e.graph}),this.#A=r),this.#N!==o&&(i.selectNode(o),this.#N=o),i.render({noRaf:!0})}catch(t){}}}function xv(t){const e=Number(t);return Number.isFinite(e)?e<=0?0:e>=1?1:e:0}class wv extends bv{#A=null;#N=null;#F=null;static get type(){return"cross-fade"}static get aliases(){return["CrossFadeRenderNode","cross-fade","crossfade"]}static get requiresFrameCadence(){return!0}static get panAndScanTarget(){return"pre"}static buildLayoutGraph({inputs:t=[],normalizedTime:e}={}){if(t.length<2)return super.buildDefaultLayoutGraph(t);const n=xv(e),i=[{type:"opacity",inputs:[t[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",t[0]],options:{}}];return{type:wv.type,signature:`${wv.type}:${t.length}`,isDynamic:!0,graph:i}}static prepareRenderFrames({frames:t,timelineTime:e,active:n}={}){let i=(Array.isArray(t)?t:[]).slice(0,2);if(i.length<2)return i;const r=Number.isFinite(null==n?void 0:n.duration)&&n.duration>0?n.duration:void 0,o=Number.isFinite(null==n?void 0:n.offset)?n.offset:void 0;if(!Number.isFinite(e)||!Number.isFinite(r)||!Number.isFinite(o))return i;const s=xv((e-o)/r);return s<=0?[i[0]]:s>=1?[i[1]]:i}render(t){var e;const n=(null==t||null===(e=t.visualFramesAvailable)||void 0===e?void 0:e.frames)||[];if(!n.length)return;const i=null==t?void 0:t.shaderGraph,r=null==t?void 0:t.shaderGraphNodeIds;if(!i||"function"!=typeof i.updateOptions||"function"!=typeof i.selectNode)return;if(n.length<2){const t=null==r?void 0:r.default;if(!t)return;try{const e="default";if(this.#A!==e){const n=wv.buildLayoutGraph({inputs:["__SRC_TEXTURE:0"]});i.updateOptions(t,{graph:n.graph}),this.#A=e}this.#N!==t&&(i.selectNode(t),this.#N=t),i.render({noRaf:!0})}catch(t){}return}const o=null==r?void 0:r.crossFade;if(o)try{const e=["__SRC_TEXTURE:0","__SRC_TEXTURE:1"],n=wv.buildLayoutGraph({inputs:e,normalizedTime:null==t?void 0:t.renderNodeNormalizedTime}),r=n.signature,s=Number(null==t?void 0:t.renderNodeNormalizedTime),a=Number.isFinite(s)?s:0;this.#A===r&&this.#F===a||(i.updateOptions(o,{graph:n.graph}),this.#A=r,this.#F=a),this.#N!==o&&(i.selectNode(o),this.#N=o),i.render({noRaf:!0})}catch(t){}}}function _v(t,e,n={}){if("number"==typeof(null==t?void 0:t.nodeDurationOverride)&&Number.isFinite(t.nodeDurationOverride))return t.nodeDurationOverride;const i="function"==typeof(null==n?void 0:n.getNode)?n.getNode:e&&"function"==typeof e.get?t=>e.get(t):null;if(!i)return;const r=i(null==t?void 0:t.nodeId);if(!r)return;const o=r.duration;if("number"!=typeof o||Number.isNaN(o)||!Number.isFinite(o))return;const s="string"!=typeof r.state||"ready"===r.state;if(!0!==(null==n?void 0:n.allowUnready)&&!s)return;if(!(!0!==(null==n?void 0:n.allowUnready)||s||o>0))return;let a=0;"number"==typeof t.nodeOffsetOverride&&Number.isFinite(t.nodeOffsetOverride)&&(a=t.nodeOffsetOverride);const l=o-a;return l>0?l:0}function Iv(t){return!(!t||!0===t.offsetPending)&&Number.isFinite(t.offset)}function Tv(t){return Iv(t)?t.offset:void 0}function Ev(t,e,n,i={}){if(!t)return!1;const r=Tv(t);if(!Number.isFinite(r))return!1;const o=_v(t,n,i);return Number.isFinite(o)?e>=r&&e<r+o:e>=r}function Sv(t=[]){if(!Array.isArray(t))return t;const e=[],n=[];return t.forEach((t=>{Iv(t)?e.push(t):n.push(t)})),e.sort(((t,e)=>t.offset-e.offset)),t.splice(0,t.length,...e,...n),t}function Mv(t=[],e={}){if(!Array.isArray(t)||!t.length)return{updated:!1,resolvedPlacements:[]};const n="function"==typeof e.getPlacementDuration?e.getPlacementDuration:()=>{},i="function"==typeof e.snapPlacementOffset?e.snapPlacementOffset:t=>t,r="function"==typeof e.onResolvedPlacement?e.onResolvedPlacement:null,o=new Map,s=[];if(t.forEach((t=>{null!=t&&t.placementId&&o.set(t.placementId,t),!0===(null==t?void 0:t.offsetPending)&&s.push(t)})),!s.length)return{updated:!1,resolvedPlacements:[]};let a=!1;const l=[];let c=s,u=!0;for(;c.length&&u;){u=!1;const t=[];for(let e=0;e<c.length;e+=1){const s=c[e],d=null==s?void 0:s.offsetAnchorPlacementId;if(!d){t.push(s);continue}const h=o.get(d);if(!h||!0===h.offsetPending){t.push(s);continue}const f=Tv(h);if(!Number.isFinite(f)){t.push(s);continue}let p;if("start"===s.offsetAnchorEdge)p=i(f,s);else{const e=n(h);if(!(e>0)){t.push(s);continue}const r=f+e-(Number.isFinite(s.offsetEndSeconds)?s.offsetEndSeconds:0);if(!Number.isFinite(r)){t.push(s);continue}const o=i(r,s);p=!0===s.offsetAnchorIsReference?Math.max(o,r):o}Number.isFinite(p)?(s.offset=p,s.offsetPending=!1,s.offsetAnchorPlacementId=void 0,s.offsetAnchorEdge=void 0,s.offsetAnchorIsReference=void 0,r&&r(s,h,p),l.push(s),a=!0,u=!0):t.push(s)}c=t}return a&&!1!==e.sortPlacements&&Sv(t),{updated:a,resolvedPlacements:l}}function Av(t){const e=Number(t);return Number.isFinite(e)?e:0}function Nv(t,e={}){const n=function(t){const e=Number(t);return Number.isFinite(e)&&e<0?Math.abs(e):0}(t),i=Number.isFinite(null==e?void 0:e.offsetEndSeconds)?e.offsetEndSeconds:n;var r;return{wantsEndOffset:"end"===(r=t)||null==r||n>0||!0===(null==e?void 0:e.offsetPending),endOffsetSeconds:i,endOffsetFromAtSeconds:n}}function Fv(t){if("string"!=typeof t)return null;const e=t.trim();if(!e||"end"===e)return null;const n=Number(e);if(Number.isFinite(n))return null;const i=e.split("@"),r=i[0]?i[0].trim():"";if(!r)return null;if(1===i.length)return{placementId:r,anchor:"start"};if(2!==i.length)return null;const o=i[1]?i[1].trim().toLowerCase():"";return"start"!==o&&"end"!==o?null:{placementId:r,anchor:o}}function Cv(t=[],e,n,i){if(Array.isArray(t))for(let r=0;r<t.length;r+=1){const o=t[r],s="number"==typeof(null==o?void 0:o.offset)?o.offset:0;if(e<s+("number"==typeof(null==o?void 0:o.duration)&&Number.isFinite(o.duration)?o.duration:Number.POSITIVE_INFINITY)&&s<n)throw new Error(i)}}function Ov(t){const e=Number(t);return Number.isFinite(e)&&e>0?e:0}function Pv(t){return(null==t?void 0:t.id)||(null==t?void 0:t.nodeId)||null}function Rv(t,e){return Array.isArray(t)&&e?t.findIndex((t=>Pv(t)===e)):-1}function Dv(t,e,n){const i=function(t,e,n){if(!Array.isArray(e)||0===e.length)return null;const i=e.length;if(null==t||"next"===t){const t=Rv(e,n);return t>=0?(t+1)%i:0}if("prev"===t){const t=Rv(e,n);return t>=0?(t-1+i)%i:i-1}const r=Number(t);return Number.isInteger(r)&&r>=0&&r<i?r:null}(t,e,n);return Number.isInteger(i)?Pv(e[i]):null}function Bv(t,e,n,i){const r=function(t,e){if(!Array.isArray(t)||t.length<=1)return t||[];const n=function(t){const e=[],n=new Set;return Array.isArray(t)?(t.forEach((t=>{const i=null==t?void 0:t.placementId;i&&!n.has(i)&&(n.add(i),e.push(i))})),e):e}(e);if(!n.length)return t;const i=new Map;t.forEach((t=>{const e=null==t?void 0:t.placementId;e&&!i.has(e)&&i.set(e,t)}));const r=[],o=new Set;return n.forEach((t=>{const e=i.get(t);e&&!o.has(t)&&(o.add(t),r.push(e))})),t.forEach((t=>{const e=null==t?void 0:t.placementId;e&&!o.has(e)&&(o.add(e),r.push(t))})),r}(function(t,e){const n=function(t){const e=Number(null==t?void 0:t.offset),n=Number(null==t?void 0:t.duration),i=n===Number.POSITIVE_INFINITY,r=Number.isFinite(n)&&n>0||i;return Number.isFinite(e)&&r?{start:e,end:i?Number.POSITIVE_INFINITY:e+n}:null}(e);if(!n||!t||!Array.isArray(t.placements))return[];const i=function(t,e){const n=Number(null==t||null===(e=t.settings)||void 0===e?void 0:e.snapToFps);return!Number.isFinite(n)||n<=0?0:.5/n}(t),r=t.placements.filter((e=>{const r=function(t,e){const n=Tv(t);if(!Number.isFinite(n))return null;const i="function"==typeof(null==e?void 0:e.getPlacementDuration)?e.getPlacementDuration(t):void 0;return{start:n,end:Number.isFinite(i)&&i>=0?n+i:Number.POSITIVE_INFINITY}}(e,t);return!!r&&r.start<n.end&&r.end>n.start+i}));return r.sort(((t,e)=>Tv(t)-Tv(e))),r}(e,n),i),o=function(t,e){const n=[],i=new Set;return Array.isArray(t)?(t.forEach((t=>{const r=null==t?void 0:t.nodeId;if(!r||i.has(r))return;const o="function"==typeof(null==e?void 0:e.getNode)?e.getNode(r):null;if(o){const t="object"==typeof o&&null!==o?o.id||o.nodeId?o:{...o,id:r}:{id:r};n.push(t),i.add(r)}})),n):n}(r,e),s=function(t){const e=new Map;return t.forEach((t=>{const n=null==t?void 0:t.placementId,i=null==t?void 0:t.nodeId;n&&i&&(e.has(i)||e.set(i,[]),e.get(i).push(n))})),e}(r),a=Array.isArray(t.nodes)?t.nodes:[];return a.splice(0,a.length,...o),t.nodes=a,t.placements=r,t.nodePlacementMap=s,{nodes:a,placements:r,nodePlacementMap:s}}function Lv(t,e,n){if(!Array.isArray(t))return null;if(e){const n=t.find((t=>(null==t?void 0:t.placementId)===e));if(n)return n}return n&&t.find((t=>(null==t?void 0:t.nodeId)===n))||null}function zv(t,e){if(!e||!Array.isArray(t))return null;const n=t.find((t=>(null==t?void 0:t.placementId)===e));return(null==n?void 0:n.nodeId)||null}function Wv(t,e,n){if(!t||!e)return null;const i=e.get(t);if(!Array.isArray(i)||!i.length)return null;for(let e=0;e<i.length;e+=1){const r=i[e];if(Lv(n,r,t))return r}return null}function jv(t){t.initialized=!1,t.activeRenderPlacementId=null,t.nodes=[],t.placements=[],t.nodePlacementMap=null,t.selectedPlacementId=null,t.previousPlacementId=null,t.pendingSwitch=null,t.switchStartTime=null,t.switchDuration=0,t.switchNormalizedTime=void 0,t.switchTo=null,t.countOfConcurrentChannels=null}class $v extends bv{static get type(){return"switching"}static get aliases(){return["SwitchingRenderNode","switching","switch"]}static get requiresFrameCadence(){return!0}static get panAndScanTarget(){return"pre"}static buildLayoutGraph({inputs:t=[],normalizedTime:e}={}){if(t.length<2)return super.buildDefaultLayoutGraph(t);const n=xv(e),i=[{type:"opacity",inputs:[t[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",t[0]],options:{}}];return{type:$v.type,signature:`${$v.type}:${t.length}`,isDynamic:!0,graph:i}}static getRenderTiming({timing:t,state:e}={}){const n=t&&"object"==typeof t?t:{},i=Number(null==e?void 0:e.switchNormalizedTime);return Number.isFinite(i)?{...n,normalizedTime:xv(i)}:n}static prepareRenderFrames({frames:t,timelineTime:e,timeline:n,active:i,renderNodeParams:r,state:o}={}){const s=Array.isArray(t)?t:[],a=o&&"object"==typeof o?o:{},l=null==i?void 0:i.renderPlacementId;l&&a.activeRenderPlacementId!==l&&(jv(a),a.activeRenderPlacementId=l);const c=null==r?void 0:r.initSwitching,u=Bv(a,n,i,s),d=(f=s,Array.isArray(f)?f.length:0),h=a.countOfConcurrentChannels;var f;if(a.countOfConcurrentChannels=d,"function"==typeof c&&(a.switchTo||(a.switchTo=(t,e)=>{const n=zv(a.placements,a.selectedPlacementId),i=Dv(t,a.nodes,n);if(!i)return;const r={nodeId:i};e&&Object.prototype.hasOwnProperty.call(e,"crossfadeSeconds")&&void 0!==e.crossfadeSeconds&&(r.crossfadeSeconds=e.crossfadeSeconds),a.pendingSwitch=r}),!a.initialized||h!==d)){a.initialized=!0,a.countOfConcurrentChannels=d;try{c({nodes:u.nodes,countOfConcurrentChannels:d,switchTo:a.switchTo})}catch(f){}}if(!a.selectedPlacementId){const t=Number(null==r?void 0:r.initialChannelIndex),e=Dv(Number.isInteger(t)&&t>=0?t:0,a.nodes,null);let n=null;if(e&&(n=Wv(e,a.nodePlacementMap,s),!n&&a.nodePlacementMap)){const t=a.nodePlacementMap.get(e);Array.isArray(t)&&t.length&&(n=t[0])}a.selectedPlacementId=n||function(t,e){if(Array.isArray(e))for(let i=0;i<e.length;i+=1){var n;const r=null===(n=e[i])||void 0===n?void 0:n.placementId;if(r&&Lv(t,r))return r}const i=Array.isArray(t)?t.find((t=>null==t?void 0:t.placementId)):null;return i?i.placementId:null}(s,a.placements)}if(a.pendingSwitch&&Number.isFinite(e)){const t=Wv(a.pendingSwitch.nodeId,a.nodePlacementMap,s);if(t){const n=a.selectedPlacementId;a.previousPlacementId=n&&n!==t?n:null,a.selectedPlacementId=t;const i=Object.prototype.hasOwnProperty.call(a.pendingSwitch,"crossfadeSeconds"),o=Ov(a.pendingSwitch.crossfadeSeconds),s=Ov(null==r?void 0:r.switchCrossfadeSeconds),l=i?o:s;a.switchDuration=l,l>0?a.switchStartTime=e:(a.switchStartTime=null,a.previousPlacementId=null)}a.pendingSwitch=null}let p;if(Number.isFinite(a.switchStartTime)&&a.switchDuration>0&&Number.isFinite(e)){const t=e-a.switchStartTime;t>=a.switchDuration?(a.switchStartTime=null,a.switchDuration=0,a.previousPlacementId=null):t>=0&&(p=xv(t/a.switchDuration))}a.switchNormalizedTime=Number.isFinite(p)?p:void 0;const m=zv(a.placements,a.selectedPlacementId),v=Lv(s,a.selectedPlacementId,m)||s[0];let g=null;if(Number.isFinite(a.switchNormalizedTime)&&a.previousPlacementId){const t=zv(a.placements,a.previousPlacementId),e=zv(a.placements,a.selectedPlacementId),n=Lv(s,a.previousPlacementId,t),i=Lv(s,a.selectedPlacementId,e);n&&i&&(g=[n,i])}return g||(g=v?[v]:s),g}static resetRenderState(t){t&&"object"==typeof t&&jv(t)}}const Uv=.5,qv="auto";function Vv(t){return"vertical"===t?"vertical":"horizontal"}function Gv(t){return void 0===t||t===qv?qv:"manual"}function Hv(t){const e=Number(t);return Number.isFinite(e)&&e>=0?e:.004}function Kv(t,e){const n=Number(null==t?void 0:t.width),i=Number(null==t?void 0:t.height);return Number.isFinite(n)&&Number.isFinite(i)&&n>0&&i>0?i>n?"vertical":"horizontal":Vv(e)}function Xv(t,e){const n=e&&"object"==typeof e&&e.runtimeParams&&"object"==typeof e.runtimeParams?e.runtimeParams:{},i=Object.prototype.hasOwnProperty.call(n,"orientationMode")?n.orientationMode:null==t?void 0:t.orientationMode,r=Object.prototype.hasOwnProperty.call(n,"orientation")?n.orientation:null==t?void 0:t.orientation,o=Object.prototype.hasOwnProperty.call(n,"gap")?n.gap:null==t?void 0:t.gap,s=Gv(i);return{orientationMode:s,orientation:s===qv?Kv(null==e?void 0:e.viewportSize,r):Vv(r),gap:Hv(o)}}function Yv(t){t&&"object"==typeof t&&(t.activeRenderPlacementId=null,t.frames=null,t.gridInitialized=!1,t.runtimeParams=null,t.setGridParams=null)}class Qv extends bv{static get type(){return"grid"}static get aliases(){return["GridRenderNode","grid","SideBySideRenderNode","side-by-side","sidebyside"]}static get requiresFrameCadence(){return!1}static get panAndScanTarget(){return"skip"}static resolvePanAndScanTarget({frameCount:t}={}){return t<2?"pre":Qv.panAndScanTarget}static buildLayoutGraph({inputs:t=[],renderNodeParams:e,state:n}={}){const i=Array.isArray(t)?t.slice(0,12):[],r=i.length;if(r<2)return super.buildDefaultLayoutGraph(i);const{orientation:o,gap:s}=Xv(e,n),{rows:a,cols:l}=(p=o,(f=r)<=3?"vertical"===p?{rows:f,cols:1}:{rows:1,cols:f}:4===f?{rows:2,cols:2}:f<=6?"vertical"===p?{rows:3,cols:2}:{rows:2,cols:3}:f<=8?"vertical"===p?{rows:4,cols:2}:{rows:2,cols:4}:9===f?{rows:3,cols:3}:"vertical"===p?{rows:4,cols:3}:{rows:3,cols:4}),c=1/a,u=Math.max(0,c-s),d=[],h="grid-slice";var f,p;function m(t){const e=Math.floor(t/l),n=function(t,e,n,i){const r=(e-1)*n;return t===e-1&&i>r?i-r:n}(e,a,l,r),i=n<l?t-e*l:t%l,o=1/n;return{row:e,cellWidth:o,cropWidth:Math.max(0,o-s),targetCenterX:(i+Uv)*o,targetCenterY:(e+Uv)*c}}function v(t,e,n){const i=m(t);return{id:`grid-crop-${t}`,type:"crop",inputs:[e],outputs:[n],options:{source:{center:{x:Uv,y:Uv},width:1,height:1},target:{center:{x:i.targetCenterX,y:i.targetCenterY},width:i.cropWidth,height:u},fitType:"fill",cornerRadius:0,edgeSoftness:0}}}function g(t){const e=m(t);return{id:`grid-mask-${t}`,type:"shapeCompositeMask",inputs:[h,"accum"],outputs:["accum"],options:{type:"box",center:{x:2*e.targetCenterX-1,y:1-2*e.targetCenterY},area:{width:e.cellWidth,height:c},radius:0,edgeSoftness:0}}}d.push(v(0,i[0],"accum"));for(let t=1;t<r;t+=1)d.push(v(t,i[t],h)),d.push(g(t));return{type:Qv.type,signature:`${Qv.type}:${r}:${a}x${l}:${o}:${s}`,isDynamic:!1,graph:d}}static prepareRenderFrames({frames:t,renderNodeParams:e,active:n,state:i}={}){const r=Array.isArray(t)?t.slice(0,12):[],o=i&&"object"==typeof i?i:{},s=null==n?void 0:n.renderPlacementId;s&&o.activeRenderPlacementId!==s&&(Yv(o),o.activeRenderPlacementId=s);const a=Array.isArray(o.frames)?o.frames:[],l=null==e?void 0:e.initGrid;if("function"==typeof l&&(o.setGridParams||(o.setGridParams=t=>{!function(t,e){if(!t||"object"!=typeof t||!e||"object"!=typeof e)return;const n=t.runtimeParams&&"object"==typeof t.runtimeParams?{...t.runtimeParams}:{};Object.prototype.hasOwnProperty.call(e,"orientationMode")&&(n.orientationMode=Gv(e.orientationMode)),Object.prototype.hasOwnProperty.call(e,"orientation")&&(n.orientation=Vv(e.orientation)),Object.prototype.hasOwnProperty.call(e,"gap")&&(n.gap=Hv(e.gap)),t.runtimeParams=n}(o,t),"function"==typeof o.requestRender&&o.requestRender()}),!o.gridInitialized)){o.gridInitialized=!0;const t=Xv(e,o);try{l({orientationMode:t.orientationMode,orientation:t.orientation,gap:t.gap,setGridParams:o.setGridParams})}catch(t){}}if(r.length<2){const t=function(t,e){if(!Array.isArray(e)||e.length<2)return t.length?[t[t.length-1]]:[];const n=Math.min(12,Math.max(t.length,e.length,2)),i=t[0]||e[0];return Array.from({length:n},((n,r)=>t[r]||e[r]||i))}(r,a);return o.frames=t,t}return o.frames=r,r}static resetRenderState(t){Yv(t)}}const Jv=[kv,wv,$v,Qv],Zv=new Map;function tg(t){if("string"!=typeof t)return null;const e=t.trim();return e?e.toLowerCase():null}function eg(t){const e=tg(t);return e&&Zv.get(e)||null}function ng(t){return eg(t)||kv}Jv.forEach((t=>function(t){(function(t){const e=Array.isArray(t.aliases)?t.aliases:[],n=t.type;return(n?[n,...e]:e.slice()).filter((t=>"string"==typeof t&&t.trim().length))})(t).forEach((e=>{const n=tg(e);n&&Zv.set(n,t)}))}(t)));class ig{static get defaultType(){return kv.type||"default"}static getRenderNodeClass(t){return eg(t)}static normalizeType(t){const e=eg(t);return e?e.type:null}static doesRenderNodeTypeRequireFrameCadence(t){const e=eg(t);return!!e&&!0===e.requiresFrameCadence}static buildLayoutGraph({type:t,inputs:e=[],normalizedTime:n,renderNodeParams:i,state:r}={}){const o=ng(t);return o&&"function"==typeof o.buildLayoutGraph?o.buildLayoutGraph({inputs:e,normalizedTime:n,renderNodeParams:i,state:r}):kv.buildLayoutGraph({inputs:e,normalizedTime:n,renderNodeParams:i,state:r})}static getPanAndScanTarget(t,e={}){const n=ng(t);return"post"===(i=n&&"function"==typeof n.resolvePanAndScanTarget?n.resolvePanAndScanTarget(e):null==n?void 0:n.panAndScanTarget)||"skip"===i?i:"pre";var i}static prepareRenderFrames({type:t,frames:e,timelineTime:n,timeline:i,active:r,renderNodeParams:o,state:s}={}){const a=ng(t);if(a&&"function"==typeof a.prepareRenderFrames){const t=a.prepareRenderFrames({frames:e,timelineTime:n,timeline:i,active:r,renderNodeParams:o,state:s});if(Array.isArray(t))return t}return Array.isArray(e)?e:[]}static getRenderTiming({type:t,timing:e,timelineTime:n,active:i,renderNodeParams:r,state:o}={}){const s=ng(t),a=e&&"object"==typeof e?e:{};if(s&&"function"==typeof s.getRenderTiming){const t=s.getRenderTiming({timing:a,timelineTime:n,active:i,renderNodeParams:r,state:o});if(t&&"object"==typeof t)return{...a,...t}}return a}static resetRenderState(t,e){const n=ng(t);n&&"function"==typeof n.resetRenderState&&n.resetRenderState(e)}static resetAllRenderStates(t){t&&"function"==typeof t.forEach&&t.forEach(((t,e)=>{ig.resetRenderState(e,t)}))}create(t,e){return t&&"function"==typeof t.render?t:new(ng(t))(e)}}function rg(t){return Array.isArray(t)?t.filter((t=>t&&"string"==typeof t.type)):[]}function og(t,e){return t&&"function"==typeof t.getSignature?t.getSignature():(null==e?void 0:e.type)||"stage"}class sg{#C;constructor(t){this.#C=t||new yv}build(t={}){const e=(Array.isArray(null==t?void 0:t.frames)?t.frames:[]).length,n=Array.from({length:e},((t,e)=>`__SRC_TEXTURE:${e}`)),i=ig.normalizeType(null==t?void 0:t.layoutType)||ig.defaultType,r=null==t?void 0:t.normalizedTime,o=rg(null==t?void 0:t.preStages),s=rg(null==t?void 0:t.postStages),a=[],l=[`layout:${i}`,`inputs:${e}`];let c=n;o.forEach(((e,n)=>{const i=this.#C.create(e);if(!i)return;const r=i.build({inputs:c,stageIndex:n,context:t});Array.isArray(null==r?void 0:r.graph)&&r.graph.length&&a.push(...r.graph),Array.isArray(null==r?void 0:r.outputs)&&r.outputs.length&&(c=r.outputs),l.push(og(i,e))}));const u=ig.buildLayoutGraph({type:i,inputs:c,normalizedTime:r,renderNodeParams:null==t?void 0:t.renderNodeParams,state:null==t?void 0:t.renderNodeState}),d=!(null==u||!u.isDynamic);Array.isArray(null==u?void 0:u.graph)&&u.graph.length&&a.push(...u.graph),l.push((null==u?void 0:u.signature)||`${i}:${c.length}`);let h="__PREVIOUS:0";return s.forEach(((e,n)=>{const i=this.#C.create(e);if(!i)return;const r=i.build({inputs:[h],stageIndex:n,context:t});Array.isArray(null==r?void 0:r.graph)&&r.graph.length&&a.push(...r.graph),h=Array.isArray(null==r?void 0:r.outputs)&&r.outputs.length?r.outputs[0]:"__PREVIOUS:0",l.push(og(i,e))})),{graph:a,signature:l.join("|"),isDynamic:d}}}const ag=[0,0,1,1],lg="zoomInExposure",cg=["transform","exposure","fadeToColor","dipToBlack"],ug={zoomInExposure:{filters:{fadeToColor:{duration:150,ease:[1,0,1,0],power:{from:0,to:1},color:"#ffffff"},exposure:!1,transform:{duration:150,ease:[0,.5,.5,1],scale:{from:{x:1,y:1},to:{x:1.1,y:1.1}},translate:{from:{x:0,y:0},to:{x:0,y:0}}}},reverseFilters:{fadeToColor:{duration:700,ease:[0,1,0,1]},exposure:!1,transform:{duration:700,ease:[0,1,0,1]}}},dipToBlack:{filters:{transform:{duration:250,ease:[0,.5,.5,1],scale:{from:{x:1,y:1},to:{x:1.05,y:1.05}},translate:{from:{x:0,y:0},to:{x:0,y:0}}},dipToBlack:{duration:250,ease:[0,.5,.5,1],power:{from:0,to:1}}},reverseFilters:{dipToBlack:{duration:800,ease:[0,1,0,1]}}}};function dg(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}function hg(t,e=ag){return Array.isArray(t)&&t.length>=4?t:e}function fg(t){return"string"==typeof t&&t.trim()?t.trim():"#ffffff"}function pg(t,e){const n=null==t?void 0:t[e];return!1===n||null==n?null:lh(n)?n:{}}function mg(t={}){let e=0;return cg.forEach((n=>{const i=pg(t,n);if(!i)return;const r=dg(null==i?void 0:i.duration);r>e&&(e=r)})),e}function vg(t,e,n,i,r){const o=[];return cg.forEach((s=>{const a=pg(t,s);if(!a)return;const l=function(t,e,n){const i=dg(null==t?void 0:t.duration);return Number.isFinite(n)&&n>0?i>0&&e>0?i*e:n:i}(a,n,i),c=function(t,e,n,i,r){const o={type:"transition",inputs:["__PREVIOUS:0"],options:{filter:t,startTime:n,duration:i,properties:{}}};if("transform"===t){var s,a,l,c;const t=hg(null==e?void 0:e.ease),n=(null==e||null===(s=e.scale)||void 0===s?void 0:s.from)||{x:1,y:1},i=(null==e||null===(a=e.scale)||void 0===a?void 0:a.to)||{x:1,y:1},r=(null==e||null===(l=e.translate)||void 0===l?void 0:l.from)||{x:0,y:0},u=(null==e||null===(c=e.translate)||void 0===c?void 0:c.to)||{x:0,y:0};return o.options.properties.scale={from:n,to:i,ease:t},o.options.properties.translate={from:r,to:u,ease:t},o}if("fadeToColor"===t){const t=hg(null==e?void 0:e.ease),n=(null==e?void 0:e.power)||{from:0,to:1};return o.options.properties.power={from:dg(null==n?void 0:n.from,0),to:dg(null==n?void 0:n.to,1),ease:t},o.options.properties.color=fg((null==e?void 0:e.color)||r),o}if("exposure"===t||"dipToBlack"===t){const t=hg(null==e?void 0:e.ease),n=(null==e?void 0:e.power)||{from:0,to:1};return o.options.properties.power={from:dg(null==n?void 0:n.from,0),to:dg(null==n?void 0:n.to,1),ease:t},o}return null}(s,a,e,l,r);c&&o.push(c)})),o}function gg(t=[]){const e=t.map((t=>{const e=JSON.parse(JSON.stringify(t));return null!=e&&e.options&&(e.options.startTime=0),e}));return JSON.stringify(e)}class yg{#O=null;start(t={}){const e=null==t?void 0:t.shaderGraph;if(!e||"function"!=typeof e.captureTexture)return null;const{baseFilters:n,reverseFilters:i}=function(t={}){const e=function(t={}){if(lh(null==t?void 0:t.transition))return t.transition;if("string"==typeof(null==t?void 0:t.transition))return ug[t.transition]||ug[lg];if(lh(null==t?void 0:t.filters)||lh(null==t?void 0:t.reverseFilters))return{filters:t.filters||{},reverseFilters:t.reverseFilters||{}};if("string"==typeof(null==t?void 0:t.filter)){const e=dg(t.duration)>0?1e3*t.duration:500;return{filters:{[t.filter]:{duration:e,power:{from:0,to:1}}},reverseFilters:{}}}return ug[lg]}(t),n=ch({},(null==e?void 0:e.filters)||{},lh(null==t?void 0:t.filters)?t.filters:{}),i=function(t={}){const e={};return Object.keys(t).forEach((n=>{const i=t[n];if(!1===i)return void(e[n]=!1);const r=JSON.parse(JSON.stringify(lh(i)?i:{}));Object.values(r).forEach((t=>function(t){if(t&&"object"==typeof t&&"from"in t&&"to"in t){const e=t.from;t.from=t.to,t.to=e}}(t))),e[n]=r})),e}(n),r=ch({},(null==e?void 0:e.reverseFilters)||{},lh(null==t?void 0:t.reverseFilters)?t.reverseFilters:{});return{baseFilters:n,reverseFilters:ch({},i,r)}}(t),r=dg(null==t?void 0:t.duration),o=r>0?1e3*r:null,s=mg(n),a=mg(i),l=o&&s>0?o/s:1,c=o&&a>0?o/a:1,u=o||s||500,d=o||a||u,h=fg(null==t?void 0:t.color),f=e.captureTexture(),p=Date.now(),m=vg(n,p,l,o,h);return this.#O={phase:"out",startTime:p,outDurationMs:u,inDurationMs:d,color:h,captureId:f,baseFilters:n,reverseFilters:i,outScale:l,inScale:c,durationOverrideMs:o,outGraph:m,outSignature:gg(m),inGraph:null,inSignature:null},{captureId:f,outDurationMs:u,inDurationMs:d}}beginIncoming(){if(!this.#O)return;const t=Date.now(),e=vg(this.#O.reverseFilters,t,this.#O.inScale,this.#O.durationOverrideMs,this.#O.color);this.#O={...this.#O,phase:"in",startTime:t,inGraph:e,inSignature:gg(e)}}reset(t){var e;t&&"function"==typeof t.disposeTexture&&null!==(e=this.#O)&&void 0!==e&&e.captureId&&t.disposeTexture(this.#O.captureId),this.#O=null}getState(){return this.#O}buildOutgoingGraph(){const t=this.#O;return t&&"out"===t.phase&&Array.isArray(t.outGraph)&&t.outGraph.length?{signature:`transition:out:${t.outSignature||""}`,forceUpdate:!1,graph:t.outGraph}:null}buildIncomingGraph(){const t=this.#O;return t&&"in"===t.phase&&Array.isArray(t.inGraph)&&t.inGraph.length?{signature:`transition:in:${t.inSignature||""}`,forceUpdate:!1,graph:t.inGraph}:null}}let bg;const kg=[/firefox\/(\d+)/,/edg\/(\d+)/,/opr\/(\d+)/,/chrome\/(\d+)/];function xg(){const t=vh&&vh.navigator&&(vh.navigator.userAgent||vh.navigator.platform||vh.navigator.vendor)||"";if(bg&&bg.ua===t)return bg;const e=t.toLowerCase(),n=e.includes("android"),i=e.includes("iphone")||e.includes("ipad")||e.includes("ipod")||e.includes("ios"),r=n||i||e.includes("mobile"),o=!!t&&!r,s=e.includes("firefox/"),a=function(t=""){for(let e=0;e<kg.length;e+=1){const n=kg[e],i=t.match(n);if(!i)continue;const r=Number(i[1]);return Number.isFinite(r)?r:null}if(t.includes("safari/")&&t.includes("version/")){const e=t.match(/version\/(\d+)/);if(!e)return null;const n=Number(e[1]);return Number.isFinite(n)?n:null}return null}(e);return bg={ua:t,lowerUA:e,isAndroid:n,isiOS:i,isMobile:r,isDesktop:o,isFirefox:s,browserMajorVersion:a},bg}function wg(){return xg().ua}function _g(){return xg().isAndroid}function Ig(){return xg().isiOS}function Tg(){return xg().isMobile}function Eg(){return xg().isDesktop}function Sg(){return xg().isFirefox}function Mg(){return xg().browserMajorVersion}var Ag={getUserAgent:wg,isAndroid:_g,isiOS:Ig,isMobile:Tg,isDesktop:Eg,isFirefox:Sg,getBrowserMajorVersion:Mg},Ng=Object.freeze({__proto__:null,default:Ag,getBrowserMajorVersion:Mg,getUserAgent:wg,isAndroid:_g,isDesktop:Eg,isFirefox:Sg,isMobile:Tg,isiOS:Ig});const Fg="Idle",Cg="Playing",Og="FirstFramePending",Pg="Waiting",Rg="Paused",Dg="Seeking",Bg="Resetting";function Lg(t){return Array.isArray(t)?t.filter((t=>t&&"string"==typeof t.type)):[]}function zg(t,e){return!!Array.isArray(t)&&t.some((t=>(null==t?void 0:t.type)===e))}function Wg(t){const e=Number(t);return!Number.isFinite(e)||e<=0?null:{type:"retarget",options:{frames:Array.from({length:e},(()=>({fitType:"fill"})))},meta:{source:"panAndScan"}}}function jg(t){return Array.isArray(t)?t.filter((t=>{return!("panAndScan"===(null==(e=t)||null===(n=e.meta)||void 0===n?void 0:n.source));var e,n})):[]}const $g=2073600;function Ug(t,e){const n=Number(t);return Number.isFinite(n)&&n>0?n:e}function qg(t,e){if(null==t)return e;const n=Number(t);return Number.isFinite(n)?n:e}var Vg=new WeakMap,Gg=new WeakMap,Hg=new WeakMap,Kg=new WeakMap,Xg=new WeakMap,Yg=new WeakMap,Qg=new WeakMap,Jg=new WeakMap,Zg=new WeakMap,ty=new WeakMap,ey=new WeakMap,ny=new WeakMap,iy=new WeakMap,ry=new WeakMap,oy=new WeakMap,sy=new WeakMap,ay=new WeakMap,ly=new WeakMap,cy=new WeakMap,uy=new WeakMap,dy=new WeakMap,hy=new WeakMap,fy=new WeakMap,py=new WeakMap,my=new WeakMap,vy=new WeakMap,gy=new WeakMap,yy=new WeakMap,by=new WeakMap,ky=new WeakMap,xy=new WeakMap,wy=new WeakMap,_y=new WeakMap,Iy=new WeakMap,Ty=new WeakSet;class Ey extends fh{static get pipelineNodeId(){return"ekoplayer-render-pipeline"}get defaults(){return{defaultRenderParams:void 0,resourceLimits:{enabled:!0,maxCanvasPixels:$g,maxDevicePixelRatio:0,renderScale:1,transitionMinFrameIntervalMs:33}}}constructor(...t){super(...t),$(this,Ty),W(this,Vg,void 0),W(this,Gg,void 0),W(this,Hg,void 0),W(this,Kg,void 0),W(this,Xg,void 0),W(this,Yg,void 0),W(this,Qg,void 0),W(this,Jg,void 0),W(this,Zg,void 0),W(this,ty,void 0),W(this,ey,void 0),W(this,ny,void 0),W(this,iy,null),W(this,ry,null),W(this,oy,void 0),W(this,sy,void 0),W(this,ay,void 0),W(this,ly,[]),W(this,cy,[]),W(this,uy,null),W(this,dy,null),W(this,hy,null),W(this,fy,null),W(this,py,null),W(this,my,null),W(this,vy,new Map),W(this,gy,null),W(this,yy,null),W(this,by,!1),W(this,ky,!1),W(this,xy,!1),W(this,wy,!1),W(this,_y,[]),W(this,Iy,null);const[e,n,i]=t;j(Vg,this,e),j(Gg,this,n),j(Hg,this,i),z(Vg,this)&&"function"==typeof z(Vg,this).enableFirstFrameRenderedGate&&z(Vg,this).enableFirstFrameRenderedGate(),j(ny,this,new sg),j(oy,this,new yg),j(sy,this,null),j(ay,this,null),j(hy,this,null),j(Kg,this,(t=>B(Ty,this,db).call(this,t))),z(Vg,this)&&"function"==typeof z(Vg,this).on&&(z(Vg,this).on(yh.VISUAL_FRAMES_AVAILABLE,z(Kg,this)),j(Xg,this,(()=>{var t,e,n,i;B(Ty,this,Fy).call(this),B(Ty,this,sb).call(this,0),j(cy,this,[]),j(uy,this,null),j(iy,this,null),j(ry,this,null),B(Ty,this,Yy).call(this),j(gy,this,null);(null===(t=z(oy,this))||void 0===t||null===(e=t.getState)||void 0===e?void 0:e.call(t))||null===(n=z(oy,this))||void 0===n||null===(i=n.reset)||void 0===i||i.call(n,z(sy,this))})),z(Vg,this).on(yh.TIMELINE_SEEKING,z(Xg,this)),j(Yg,this,((t={})=>{"switch"===(null==t?void 0:t.reason)||"reset"===(null==t?void 0:t.reason)?B(Ty,this,My).call(this):B(Ty,this,Sy).call(this),B(Ty,this,Cy).call(this)})),z(Vg,this).on(yh.TIMELINE_RESET,z(Yg,this)),j(Zg,this,(()=>B(Ty,this,tb).call(this))),z(Vg,this).on(yh.TIMELINE_TIME_UPDATE,z(Zg,this)),j(Qg,this,(()=>{B(Ty,this,hb).call(this)&&z(dy,this)&&B(Ty,this,db).call(this,z(dy,this))})),z(Vg,this).on(yh.TIMELINE_STATE_CHANGE,z(Qg,this))),z(Gg,this)&&"function"==typeof z(Gg,this).on&&(j(ty,this,(()=>{const t=z(dy,this);j(wy,this,!0),B(Ty,this,Sy).call(this),j(dy,this,t)})),z(Gg,this).on(yh.CANVAS_WEBGL_CONTEXT_LOST,z(ty,this)),j(ey,this,(()=>{var t;const e=null===(t=z(Gg,this))||void 0===t?void 0:t.gl;if(!e||"function"==typeof e.isContextLost&&e.isContextLost())return void j(wy,this,!0);const n=z(dy,this);j(wy,this,!1),B(Ty,this,Sy).call(this),j(dy,this,n),n&&B(Ty,this,hb).call(this)&&B(Ty,this,db).call(this,n)})),z(Gg,this).on(yh.CANVAS_WEBGL_CONTEXT_RESTORED,z(ey,this))),j(Jg,this,(()=>{j(uy,this,null),z(dy,this)&&B(Ty,this,hb).call(this)&&B(Ty,this,db).call(this,z(dy,this))})),z(Hg,this)&&"function"==typeof z(Hg,this).on&&z(Hg,this).on(yh.CONTAINER_RESIZE,z(Jg,this))}get name(){return"Renderer"}onDispose(){z(Vg,this)&&z(Kg,this)&&"function"==typeof z(Vg,this).off&&z(Vg,this).off(yh.VISUAL_FRAMES_AVAILABLE,z(Kg,this)),z(Vg,this)&&z(Xg,this)&&"function"==typeof z(Vg,this).off&&z(Vg,this).off(yh.TIMELINE_SEEKING,z(Xg,this)),z(Vg,this)&&z(Yg,this)&&"function"==typeof z(Vg,this).off&&z(Vg,this).off(yh.TIMELINE_RESET,z(Yg,this)),z(Vg,this)&&z(Zg,this)&&"function"==typeof z(Vg,this).off&&z(Vg,this).off(yh.TIMELINE_TIME_UPDATE,z(Zg,this)),z(Vg,this)&&z(Qg,this)&&"function"==typeof z(Vg,this).off&&z(Vg,this).off(yh.TIMELINE_STATE_CHANGE,z(Qg,this)),z(Hg,this)&&z(Jg,this)&&"function"==typeof z(Hg,this).off&&z(Hg,this).off(yh.CONTAINER_RESIZE,z(Jg,this)),z(Gg,this)&&z(ty,this)&&"function"==typeof z(Gg,this).off&&z(Gg,this).off(yh.CANVAS_WEBGL_CONTEXT_LOST,z(ty,this)),z(Gg,this)&&z(ey,this)&&"function"==typeof z(Gg,this).off&&z(Gg,this).off(yh.CANVAS_WEBGL_CONTEXT_RESTORED,z(ey,this)),B(Ty,this,Sy).call(this),j(Kg,this,null),j(Xg,this,null),j(Yg,this,null),j(Zg,this,null),j(Qg,this,null),j(Jg,this,null),j(ty,this,null),j(ey,this,null),j(ny,this,null),j(oy,this,null),j(vy,this,null),j(gy,this,null),j(Gg,this,null),j(Hg,this,null),j(Vg,this,null)}startTransition(t={}){var e,n;const i=null===(e=z(Gg,this))||void 0===e?void 0:e.element,r=null===(n=z(Gg,this))||void 0===n?void 0:n.gl;if(!i||!r)return null;if(z(wy,this)||"function"==typeof r.isContextLost&&r.isContextLost())return j(wy,this,!0),null;if(B(Ty,this,Py).call(this,i),!z(sy,this))return null;const o=z(oy,this).start({shaderGraph:z(sy,this),duration:null==t?void 0:t.duration,filter:null==t?void 0:t.filter,color:null==t?void 0:t.color,filters:null==t?void 0:t.filters,reverseFilters:null==t?void 0:t.reverseFilters,transition:null==t?void 0:t.transition});return j(hy,this,z(dy,this)||null),B(Ty,this,lb).call(this),o}beginTransitionIn(t={}){var e,n;null!==(e=z(oy,this))&&void 0!==e&&null!==(n=e.beginIncoming)&&void 0!==n&&n.call(e,t),j(hy,this,null),B(Ty,this,lb).call(this)}resetTransition(){var t,e;null!==(t=z(oy,this))&&void 0!==t&&null!==(e=t.reset)&&void 0!==e&&e.call(t,z(sy,this)),j(hy,this,null),B(Ty,this,cb).call(this)}}function Sy(){if(B(Ty,this,Fy).call(this),z(oy,this)&&"function"==typeof z(oy,this).reset&&z(oy,this).reset(z(sy,this)),B(Ty,this,sb).call(this,0),z(sy,this)&&"function"==typeof z(sy,this).dispose)try{z(sy,this).dispose()}catch(t){}j(sy,this,null),j(ay,this,null),j(ly,this,[]),j(cy,this,[]),j(by,this,!1),j(uy,this,null),j(iy,this,null),j(ry,this,null),j(dy,this,null),j(hy,this,null),B(Ty,this,cb).call(this),B(Ty,this,Yy).call(this),j(gy,this,null)}function My(){B(Ty,this,Fy).call(this),z(oy,this)&&"function"==typeof z(oy,this).reset&&z(oy,this).reset(z(sy,this)),B(Ty,this,sb).call(this,0),j(ly,this,[]),j(cy,this,[]),j(uy,this,null),j(iy,this,null),j(ry,this,null),j(dy,this,null),j(hy,this,null),B(Ty,this,cb).call(this),B(Ty,this,Yy).call(this),j(gy,this,null),j(yy,this,null)}function Ay(){const t="function"==typeof vh.requestAnimationFrame?vh.requestAnimationFrame.bind(vh):null,e="function"==typeof vh.cancelAnimationFrame?vh.cancelAnimationFrame.bind(vh):null;return t?{schedule:e=>t(e),cancel(t){"number"==typeof t&&e&&e(t)}}:null}function Ny(t){j(_y,this,z(_y,this).filter((e=>e!==t))),z(_y,this).length||j(Iy,this,null)}function Fy(){z(Iy,this)&&z(_y,this).forEach((t=>z(Iy,this).call(this,t))),j(_y,this,[]),j(Iy,this,null),j(xy,this,!1)}function Cy(){B(Ty,this,Fy).call(this),j(ky,this,!1)}function Oy(){if(z(ky,this)||z(xy,this))return;const t=B(Ty,this,Ay).call(this);if(!t)return;const{schedule:e,cancel:n}=t;let i;j(Iy,this,n),j(xy,this,!0),i=e((()=>{let t;B(Ty,this,Ny).call(this,i),t=e((()=>{B(Ty,this,Ny).call(this,t),j(xy,this,!1),z(ky,this)||(j(ky,this,!0),z(Vg,this)&&"function"==typeof z(Vg,this).notifyFirstFrameRendered&&z(Vg,this).notifyFirstFrameRendered())})),z(_y,this).push(t)})),z(_y,this).push(i)}function Py(t){if(z(sy,this)||!t)return;const e=this,n={dest:t,src:(t,n)=>{j(ay,e,n)}};j(sy,e,new pv(n,{userWillCallRender:!0,glOptions:{contextType:"webgl2"},performanceToggles:{useCanvasSizedFilterTargets:!0}})),z(sy,e)&&"function"==typeof z(sy,e).addNodes&&z(sy,e).addNodes({[pe.pipelineNodeId]:{type:"composite",options:{graph:[]}}})}function Ry(t){var e;if("null"===(null==t?void 0:t.message))return!0;const n=null===(e=z(Gg,this))||void 0===e?void 0:e.gl;return!(!n||"function"!=typeof n.isContextLost||!n.isContextLost())}function Dy(t,e,n){const i=e||z(dy,this)||null;if(B(Ty,this,Sy).call(this),j(dy,this,i),!n)return this.log.warn("Shader graph render failed; rebuilding graph once.",t),void B(Ty,this,db).call(this,i,!0);this.log.warn("Shader graph render is still unavailable after rebuild; deferring until the next render pass.",t)}function By(){var t;const e=null===(t=this.settings)||void 0===t?void 0:t.resourceLimits;return!e||"object"!=typeof e||Array.isArray(e)?{}:e}function Ly(){const t=B(Ty,this,By).call(this).enabled;return!0===t||!1!==t&&Ig()}function zy(){if(!B(Ty,this,Ly).call(this))return 0;const t=qg(B(Ty,this,By).call(this).transitionMinFrameIntervalMs,33);return Number.isFinite(t)&&t>0?t:0}function Wy(t,e,n={}){const i=!0===(null==n?void 0:n.useDevicePixelRatio),r=B(Ty,this,Ly).call(this),o=i?Ug(null==vh?void 0:vh.devicePixelRatio,1):1;let s=o,a=0;if(r){const t=B(Ty,this,By).call(this);a=qg(t.maxCanvasPixels,$g);const e=qg(t.maxDevicePixelRatio,0);s=Ug(t.renderScale,1)*(e>0?Math.min(o,e):o)}let l=Math.max(1,Math.round(t*s)),c=Math.max(1,Math.round(e*s));if(r&&a>0){const t=l*c;if(t>a){const e=Math.sqrt(a/t);l=Math.max(1,Math.floor(l*e)),c=Math.max(1,Math.floor(c*e))}}return{width:l,height:c}}function jy(t=[],e={}){var n;const i=null===(n=z(Gg,this))||void 0===n?void 0:n.element,r=z(ay,this);if(!i||"function"!=typeof r)return!1;let o=0,s=0;const a=!0===(null==e?void 0:e.useViewportSize);if(a){var l,c,u,d,h,f;const t=Number(null!==(l=null===(c=z(Hg,this))||void 0===c?void 0:c.containerWidth)&&void 0!==l?l:null===(u=z(Hg,this))||void 0===u?void 0:u.width),e=Number(null!==(d=null===(h=z(Hg,this))||void 0===h?void 0:h.containerHeight)&&void 0!==d?d:null===(f=z(Hg,this))||void 0===f?void 0:f.height);if(Number.isFinite(t)&&Number.isFinite(e)&&t>0&&e>0)o=Math.round(t),s=Math.round(e);else{const t=Number(i.clientWidth),e=Number(i.clientHeight);Number.isFinite(t)&&Number.isFinite(e)&&t>0&&e>0&&(o=Math.round(t),s=Math.round(e))}}if(!(o>0&&s>0)){if(!Array.isArray(t)||!t.length)return;for(let e=0;e<t.length;e+=1){var p;const n=null===(p=t[e])||void 0===p?void 0:p.frame,i=Number((null==n?void 0:n.displayWidth)||(null==n?void 0:n.codedWidth)||(null==n?void 0:n.videoWidth)||(null==n?void 0:n.naturalWidth)||(null==n?void 0:n.width)),r=Number((null==n?void 0:n.displayHeight)||(null==n?void 0:n.codedHeight)||(null==n?void 0:n.videoHeight)||(null==n?void 0:n.naturalHeight)||(null==n?void 0:n.height));!Number.isFinite(i)||!Number.isFinite(r)||i<=0||r<=0||(i>o&&(o=i),r>s&&(s=r))}}if(!(o>0&&s>0))return!1;const m=B(Ty,this,Wy).call(this,o,s,{useDevicePixelRatio:a}),v=m.width,g=m.height,y=z(uy,this);return!(y&&y.width===v&&y.height===g||(j(uy,this,{width:v,height:g}),r(null,null,v,g),0))}function $y(t){const e=null==t?void 0:t.nodeId,n=null==t?void 0:t.trackId,i=null==t?void 0:t.segmentId,r=null==t?void 0:t.presentationTime;return e&&n&&i&&Number.isFinite(r)?`${e}:${n}:${i}@${r}`:null}function Uy(t,e,n){const i=Number.isFinite(null==t?void 0:t.duration)&&t.duration>0?t.duration:void 0;let r;if(i&&Number.isFinite(null==t?void 0:t.offset)){const n=(e-t.offset)/i;r=n<0?0:n>1?1:n}const o=B(Ty,this,qy).call(this,t),s=B(Ty,this,Vy).call(this,o);return ig.getRenderTiming({type:o,timing:{duration:i,normalizedTime:r},timelineTime:e,active:t,renderNodeParams:n,state:s})}function qy(t){return ig.normalizeType(null==t?void 0:t.type)||ig.defaultType}function Vy(t){if(!t||!z(vy,this))return null;let e=z(vy,this).get(t);return e||(e={},z(vy,this).set(t,e)),e}function Gy(){var t,e,n,i,r,o,s,a,l,c,u;const d=Number(null!==(t=null===(e=z(Hg,this))||void 0===e?void 0:e.containerWidth)&&void 0!==t?t:null===(n=z(Hg,this))||void 0===n?void 0:n.width),h=Number(null!==(i=null===(r=z(Hg,this))||void 0===r?void 0:r.containerHeight)&&void 0!==i?i:null===(o=z(Hg,this))||void 0===o?void 0:o.height);if(Number.isFinite(d)&&Number.isFinite(h)&&d>0&&h>0)return{width:Math.round(d),height:Math.round(h)};const f=null===(s=z(Gg,this))||void 0===s?void 0:s.element,p=Number(null==f?void 0:f.clientWidth),m=Number(null==f?void 0:f.clientHeight);if(Number.isFinite(p)&&Number.isFinite(m)&&p>0&&m>0)return{width:Math.round(p),height:Math.round(m)};const v=Number(null!==(a=null==f?void 0:f.width)&&void 0!==a?a:null===(l=z(uy,this))||void 0===l?void 0:l.width),g=Number(null!==(c=null==f?void 0:f.height)&&void 0!==c?c:null===(u=z(uy,this))||void 0===u?void 0:u.height);return Number.isFinite(v)&&Number.isFinite(g)&&v>0&&g>0?{width:Math.round(v),height:Math.round(g)}:null}function Hy(t){const e=B(Ty,this,Vy).call(this,t);return e&&"object"==typeof e&&(e.requestRender=()=>B(Ty,this,Ky).call(this),e.viewportSize=B(Ty,this,Gy).call(this)),e}function Ky(){z(by,this)||(j(by,this,!0),Promise.resolve().then((()=>{j(by,this,!1),z(dy,this)&&B(Ty,this,hb).call(this)&&B(Ty,this,db).call(this,z(dy,this))})))}function Xy(t){if(!t||!z(vy,this))return;const e=z(vy,this).get(t);e&&ig.resetRenderState(t,e),z(vy,this).delete(t)}function Yy(){z(vy,this)&&(ig.resetAllRenderStates(z(vy,this)),z(vy,this).clear())}function Qy(t,e,n,i){const r=B(Ty,this,qy).call(this,t);z(gy,this)&&z(gy,this)!==r&&B(Ty,this,Xy).call(this,z(gy,this)),j(gy,this,r);const o=B(Ty,this,Hy).call(this,r);return ig.prepareRenderFrames({type:r,frames:e,timelineTime:n,timeline:z(Vg,this),active:t,renderNodeParams:i,state:o})}function Jy(t){var e;return null!=t&&t.params&&"object"==typeof t.params?t.params:!t&&null!==(e=this.settings)&&void 0!==e&&e.defaultRenderParams&&"object"==typeof this.settings.defaultRenderParams?this.settings.defaultRenderParams:{}}function Zy(t){return t?String(t.renderPlacementId||t.type||"unknown"):"default"}function tb(){if(!z(Vg,this)||!z(dy,this))return;const t=z(Vg,this).currentTime,e=z(Vg,this).getActiveRenderPlacement(t),n=B(Ty,this,Zy).call(this,e);n!==z(yy,this)&&(j(yy,this,n),B(Ty,this,db).call(this,{...z(dy,this),time:t}))}function eb(t){return!t||"object"!=typeof t||!Object.prototype.hasOwnProperty.call(t,"panAndScan")||!1!==t.panAndScan}function nb(t,e){const n=B(Ty,this,Jy).call(this,t),i=null==n?void 0:n.stages;let r=Lg(null==i?void 0:i.pre),o=Lg(null==i?void 0:i.post);const s=B(Ty,this,eb).call(this,n),a=B(Ty,this,qy).call(this,t),l=zg(r,"retarget")||zg(o,"retarget");if(s&&!l){const i=ig.getPanAndScanTarget(a,{frameCount:Array.isArray(e)?e.length:0,active:t,renderNodeParams:n});if("pre"===i){const t=Wg(Array.isArray(e)?e.length:0);t&&(r=[t,...r])}else if("post"===i){const t=Wg(1);t&&(o=[...o,t])}}else s||(r=jg(r),o=jg(o));return{preStages:r,postStages:o,renderNodeParams:n}}function ib(t,e,n,i,r){const o=r||B(Ty,this,Uy).call(this,t,n,i),s=B(Ty,this,nb).call(this,t,e),a=B(Ty,this,qy).call(this,t),l=B(Ty,this,Hy).call(this,a);return z(ny,this).build({layoutType:null==t?void 0:t.type,frames:e,preStages:s.preStages,postStages:s.postStages,normalizedTime:o.normalizedTime,renderNodeDuration:o.duration,renderNodeParams:s.renderNodeParams,renderNodeState:l,timelineTime:n})}function rb(){var t,e;const n=null===(t=z(oy,this))||void 0===t||null===(e=t.getState)||void 0===e?void 0:e.call(t);return"out"===(null==n?void 0:n.phase)?z(oy,this).buildOutgoingGraph():"in"===(null==n?void 0:n.phase)?z(oy,this).buildIncomingGraph():null}function ob(t,e,n,i){const r=n||e!==z(iy,this),o=r||i;return r&&z(sy,this)&&"function"==typeof z(sy,this).updateOptions&&(z(sy,this).updateOptions(pe.pipelineNodeId,{graph:t}),j(iy,this,e)),z(sy,this)&&"function"==typeof z(sy,this).selectNode&&z(ry,this)!==pe.pipelineNodeId&&(z(sy,this).selectNode(pe.pipelineNodeId),j(ry,this,pe.pipelineNodeId)),!(!o||!z(sy,this)||"function"!=typeof z(sy,this).render||(z(sy,this).render({noRaf:!0}),0))}function sb(t){if(!Array.isArray(z(ly,this))||!z(ly,this).length)return;const e=Number.isFinite(t)?Math.max(0,t):0;if(!(z(ly,this).length<=e)){for(let t=e;t<z(ly,this).length;t+=1){const e=z(ly,this)[t];if(e&&z(sy,this)&&"function"==typeof z(sy,this).releaseTexture)try{z(sy,this).releaseTexture(e)}catch(t){}}z(ly,this).length=e,z(cy,this).length=e}}function ab(t=[]){if(!z(sy,this)||"function"!=typeof z(sy,this).addTexture)return{didUpdate:!1,hasUploadFailure:!1,ready:!1};if("function"==typeof z(sy,this).isContextUnavailable&&z(sy,this).isContextUnavailable())return{didUpdate:!1,hasUploadFailure:!1,ready:!1};if(!Array.isArray(t)||!t.length)return B(Ty,this,sb).call(this,0),{didUpdate:!1,hasUploadFailure:!1,ready:!1};B(Ty,this,sb).call(this,t.length);let e=!1,n=!1,i=!0;for(let o=0;o<t.length;o+=1){var r;z(ly,this)[o]||"function"!=typeof z(sy,this).addTexture||(z(ly,this)[o]=z(sy,this).addTexture(null,"frame",o));const s=B(Ty,this,$y).call(this,t[o]),a=null===(r=t[o])||void 0===r?void 0:r.frame;if(z(ly,this)[o]&&a){if(!s||s!==z(cy,this)[o])try{z(ly,this)[o].fill(a),z(cy,this)[o]=s,e=!0}catch(t){i=!1,n=!0,z(cy,this)[o]=null}}else i=!1}return{didUpdate:e,hasUploadFailure:n,ready:i}}function lb(){if(z(fy,this))return;const t="function"==typeof vh.requestAnimationFrame?t=>vh.requestAnimationFrame(t):t=>setTimeout(t,16),e="function"==typeof vh.cancelAnimationFrame?t=>vh.cancelAnimationFrame(t):clearTimeout;j(py,this,e);const n=()=>{var e,i;if(null!==(e=z(oy,this))&&void 0!==e&&null!==(i=e.getState)&&void 0!==i&&i.call(e)){if(z(dy,this)){const t=B(Ty,this,zy).call(this),e=Date.now();(!t||!z(my,this)||e-z(my,this)>=t)&&(j(my,this,e),B(Ty,this,db).call(this,z(dy,this)))}j(fy,this,t(n))}else j(fy,this,null)};j(fy,this,t(n))}function cb(){z(fy,this)&&z(py,this)&&z(py,this).call(this,z(fy,this)),j(fy,this,null),j(py,this,null),j(my,this,null)}function ub(t){var e,n;const i=null===(e=z(oy,this))||void 0===e||null===(n=e.getState)||void 0===n?void 0:n.call(e);return"out"===(null==i?void 0:i.phase)&&z(hy,this)?z(hy,this):t}function db(t={},e=!1){try{var n,i;t&&j(dy,this,t);const e=null===(n=z(Gg,this))||void 0===n?void 0:n.element,r=null===(i=z(Gg,this))||void 0===i?void 0:i.gl;if(!e||!r)return;if(z(wy,this)||"function"==typeof r.isContextLost&&r.isContextLost())return void j(wy,this,!0);if(!B(Ty,this,hb).call(this))return;const o=B(Ty,this,ub).call(this,t),s=Number.isFinite(null==o?void 0:o.time)?o.time:void 0;if(!Number.isFinite(s))return;if(B(Ty,this,Py).call(this,e),!z(sy,this))return;const a=z(Vg,this)&&"function"==typeof z(Vg,this).getActiveRenderPlacement?z(Vg,this).getActiveRenderPlacement(s):void 0,l=B(Ty,this,Zy).call(this,a);l!==z(yy,this)&&j(yy,this,l);const c=Array.isArray(null==o?void 0:o.frames)?o.frames:[],u=B(Ty,this,Jy).call(this,a),d=B(Ty,this,eb).call(this,u),h=B(Ty,this,Qy).call(this,a,c,s,u),f=B(Ty,this,Uy).call(this,a,s,u),p=B(Ty,this,jy).call(this,h,{useViewportSize:d}),m=B(Ty,this,ab).call(this,h),v=m.didUpdate;if(h.length>0&&!m.ready)return void(m.hasUploadFailure&&this.log.warn("Skipping render because one or more input textures could not be uploaded."));const g=B(Ty,this,ib).call(this,a,h,s,u,f),y=B(Ty,this,rb).call(this);let b=g.graph,k=g.signature,x=!!g.isDynamic;y&&Array.isArray(y.graph)&&y.graph.length&&(b=b.concat(y.graph),k=`${k}|${y.signature||"transition"}`,x=x||!!y.forceUpdate);const w=p||v||x||y&&Array.isArray(y.graph)&&y.graph.length;B(Ty,this,ob).call(this,b,k,x,w)&&h.length>0&&B(Ty,this,Oy).call(this)}catch(n){if(B(Ty,this,Ry).call(this,n))return void B(Ty,this,Dy).call(this,n,t,e);throw n}}function hb(){var t;const e=null===(t=z(Vg,this))||void 0===t?void 0:t.state;return e===Fg||e===Og||e===Cg||e===Rg}function fb(t){return"number"==typeof t&&Number.isFinite(t)&&t>0}function pb(t){return t&&"resource"===t.entryType&&t.transferSize>0&&t.duration>0&&t.responseEnd>=t.requestStart}function mb(t){return Array.isArray(t)&&0!==t.length?t.reduce(((t,e)=>t+e),0)/t.length:NaN}pe=Ey;var vb=new WeakMap,gb=new WeakMap,yb=new WeakMap,bb=new WeakMap,kb=new WeakSet;class xb extends fh{get name(){return"DownloadSpeedGuesstimator"}get defaults(){return{persistentStorage:{key:"ekoDownloadSpeedKbps",ttl:-1},priorities:[["resourceTiming","downlink","persistentValue"],["resourceTiming","downlink"],["resourceTiming","persistentValue","ua"],["resourceTiming","ua","defaultKbps"],["downlink","persistentValue"],["downlink"],["persistentValue"],["connectionType"],["ua"],["defaultKbps"]],defaultKbps:2500,connectionType:{"slow-2g":50,"2g":70,"3g":700,"4g":3500,bluetooth:750,cellular:750,ethernet:3500,wifi:2500,wimax:2500,none:0},ua:{desktop:2500,ios:2500,android:2500}}}constructor(...t){super(...t),$(this,kb),W(this,vb,void 0),W(this,gb,void 0),W(this,yb,void 0),W(this,bb,void 0),j(vb,this,!!(vh&&vh.navigator&&vh.navigator.connection)),j(gb,this,!(!vh||!vh.performance||"function"!=typeof vh.performance.getEntriesByType)),j(yb,this,B(kb,this,_b).call(this)),j(bb,this,B(kb,this,Mb).call(this))}guesstimate(){const t=B(kb,this,Nb).call(this);this.log.debug("[guesstimate] Data:",t);const e=B(kb,this,Ab).call(this,t),n=fb(e)?e:t.defaultKbps;return B(kb,this,Ib).call(this,n),this.log.info(`[guesstimate] Result: ${n} kbps`),n}update(t){fb(t)&&B(kb,this,Ib).call(this,t)}onDispose(){j(yb,this,void 0),j(bb,this,void 0)}}function wb(){return Math.round(Date.now()/1e3)}function _b(){try{if(!vh||!vh.localStorage||"function"!=typeof vh.localStorage.getItem)return}catch(t){return}const t=this.settings.persistentStorage.key,e=vh.localStorage.getItem(t);if(e)try{const t=JSON.parse(e),n=this.settings.persistentStorage.ttl,i=B(kb,this,wb).call(this)-t.timestamp;if("number"==typeof n&&n>=0&&i>n)return null;if(!fb(t.value))return;return t.value}catch(t){return}}function Ib(t){if(!fb(t))return;try{if(!vh||!vh.localStorage||"function"!=typeof vh.localStorage.setItem)return}catch(t){return}const e=this.settings.persistentStorage.key,n=JSON.stringify({value:t,timestamp:B(kb,this,wb).call(this)});try{vh.localStorage.setItem(e,n),j(yb,this,t)}catch(t){}}function Tb(){return vh&&vh.performance&&"function"==typeof vh.performance.getEntriesByType?mb(vh.performance.getEntriesByType("resource").filter(pb).map((t=>8*t.transferSize/t.duration))):NaN}function Eb(){if(!vh||!vh.navigator||!vh.navigator.connection)return NaN;const t=vh.navigator.connection.downlink;return fb(t)?1e3*t:NaN}function Sb(){if(!z(vb,this))return NaN;const t=vh.navigator.connection,e=t.effectiveType||t.type,n=this.settings.connectionType||{};return e&&Object.prototype.hasOwnProperty.call(n,e)?n[e]:NaN}function Mb(){const t=this.settings.ua||{};return _g()?t.android:Ig()?t.ios:t.desktop}function Ab(t){const e=Array.isArray(this.settings.priorities)?this.settings.priorities:[];for(let n=0;n<e.length;n+=1){const i=e[n];if(!Array.isArray(i)||0===i.length)continue;const r=i.map((e=>t[e])).filter((t=>fb(t)));if(r.length===i.length)return this.log.debug("[#selectFromPriorities] Selected from priorities:",i,"with values:",r),mb(r)}return NaN}function Nb(){const t=this.settings.testOverrides||{},e=fb(t.resourceTiming)?t.resourceTiming:B(kb,this,Tb).call(this),n=fb(t.downlink)?t.downlink:B(kb,this,Eb).call(this),i=fb(t.persistentValue)?t.persistentValue:z(yb,this),r=fb(t.connectionType)?t.connectionType:B(kb,this,Sb).call(this),o=fb(t.ua)?t.ua:z(bb,this);return{defaultKbps:this.settings.defaultKbps,resourceTiming:e,downlink:n,connectionType:r,persistentValue:i,ua:o}}const Fb=new ah;function Cb(t){return"string"!=typeof t||0===t.length?[]:t.split(".").filter((t=>t.length>0))}function Ob(t){if("string"!=typeof t)return!1;if(0===t.length)return!1;const e=Number(t);return Number.isInteger(e)&&String(e)===t}function Pb(t){return null!==t&&"object"==typeof t}function Rb(t,e,n){const i=Cb(e);if(0===i.length)return void 0===t?n:t;let r=t;for(let t=0;t<i.length;t+=1){if(null==r)return n;if(r=r[i[t]],void 0===r)return n}return void 0===r?n:r}function Db(t,e,n){if(!Pb(t))return t;const i=Cb(e);if(0===i.length)return t;let r=t;for(let t=0;t<i.length;t+=1){const e=i[t];if(t===i.length-1){r[e]=n;break}Pb(r[e])||(r[e]=Ob(i[t+1])?[]:{}),r=r[e]}return t}const Bb={get:(t,e)=>vh&&vh.eko?Rb(vh.eko,t,e):e,set(t,e){if(vh)return vh.eko&&"object"==typeof vh.eko||(vh.eko={}),Db(vh.eko,t,e),vh.eko}},Lb=vh&&vh.performance,zb=Lb&&"function"==typeof Lb.now?()=>Lb.now():()=>Date.now();function Wb(){return"undefined"==typeof AbortController?null:new AbortController}function jb(){const t=new Error("The operation was aborted");return t.name="AbortError",t.code="ABORT_ERR",t}function $b(t,e){return!(!e||!e.aborted)||!!t&&("AbortError"===t.name||"ABORT_ERR"===t.code||20===t.code)}const Ub=2,qb=100,Vb=2,Gb="runtime.downloadSpeedSamples",Hb=sh("download","warn");function Kb(t){return new Promise((e=>{setTimeout(e,t)}))}function Xb(t){return t>=500}function Yb(t){if(!t||!t.headers||"function"!=typeof t.headers.get)return 0;const e=t.headers.get("content-length");if(!e)return 0;const n=Number(e);return Number.isNaN(n)||n<0?0:n}function Qb(t,e,n,i,r,o){const s={bytes:t,durationMs:e,kbps:e>0?8*t/e:0,startTime:n,endTime:i,url:o};try{let t=Bb.get(r);t||(t=[],Bb.set(r,t)),t.push(s)}catch(t){}return s}async function Jb(t,e={}){const{method:n="GET",headers:i,body:r,retries:o=Ub,retryDelay:s=qb,backoffFactor:a=Vb,samplesTargetPath:l=Gb,fetch:c,loglevel:u="warn",cache:d,signal:h,onProgress:f,returnType:p="default"}=e;Hb.setLevel(u);const m=function(t){if(t)return t;if(vh&&"function"==typeof vh.fetch)return vh.fetch.bind(vh);throw new Error("fetch is not available in this environment")}(c);let v=0,g=s;for(;;){if(h&&h.aborted)throw jb();const e=zb();try{const s=await m(t,{method:n,headers:i,body:r,cache:d,mode:"cors",signal:h});if(h&&h.aborted)throw jb();if(!s.ok){if(v<o&&Xb(s.status)){v+=1,Hb.warn(`[${t}] Download attempt #${v} failed with status ${s.status}, retrying in ${g}ms...`),await Kb(g),g*=a;continue}Hb.error(`[${t}] Download attempt #${v} failed with status ${s.status}, no more retries.`);const e=new Error(`Download failed with status ${s.status}`);throw e.status=s.status,e}let c=zb();const u=Yb(s),y="arrayBuffer"===p||"bytes"===p,b=y&&"function"==typeof f;let k,x,w,_,I,T=0;if(y&&s.body&&"function"==typeof s.body.getReader&&b){const t=s.body.getReader(),e=[];for(;;){if(h&&h.aborted)throw jb();const{done:n,value:i}=await t.read();if(n)break;if(i&&i.length){const t=zb();Number.isFinite(_)||(_=t),I=t,e.push(i),T+=i.length,f({loaded:T,total:u||void 0,chunk:i})}}k=new Uint8Array(T);let n=0;e.forEach((t=>{k.set(t,n),n+=t.length})),c=zb()}else if(y){const t=await s.arrayBuffer();k=new Uint8Array(t),T=k.length,c=zb()}else"text"===p?(x=await s.text(),c=zb()):"json"===p&&(w=await s.json(),c=zb());if(h&&h.aborted)throw jb();const E=y?k?k.length:T:("text"===p&&"string"==typeof x?x.length:0)||("json"===p&&w?JSON.stringify(w).length:0),S=u||E||0;let M=e,A=c;Number.isFinite(_)&&(M=_,Number.isFinite(I)&&(A=Math.max(I,c))),(!Number.isFinite(M)||!Number.isFinite(A)||A<M)&&(M=e,A=c);const N=Math.max(0,A-M),F=Qb(S,N,M,A,l,t);try{Fb.trigger("download:sample",F)}catch(t){}const C={response:s,bytes:S,durationMs:N,kbps:F.kbps,startTime:F.startTime,endTime:F.endTime};if("default"===p)return C;if("arrayBuffer"===p||"bytes"===p){const t=k||new Uint8Array(await s.arrayBuffer());return"arrayBuffer"===p?t.buffer:t}return"text"===p?x:"json"===p?w:C}catch(e){if($b(e,h))throw"AbortError"===e.name?e:jb();if(!(v<o)||e.status&&!Xb(e.status))throw Hb.error(`[${t}] Download attempt #${v} failed with error ${e}, no more retries.`),e;v+=1,Hb.warn(`[${t}] Download attempt #${v} failed with error ${e}, retrying in ${g}ms...`),await Kb(g),g*=a}}}const Zb={disabledTracks:{default:["audio"],targetPaths:["NodeRepository.disabledTracks"]},muted:{default:!1,targetPaths:["AudioPlaybackManager.muted"]},volume:{default:1,targetPaths:["AudioPlaybackManager.volume"]},encodeProfile:{default:null,targetPaths:["AssetsDeliveryService.profile"]},forceVideoCodec:{default:void 0,targetPaths:["NodeRepository.forceVideoCodec"]},forceImageFallback:{default:!1,targetPaths:["NodeRepository.forceImageFallback"]},mediaHostRewriteMap:{default:{"storageeko.s3.amazonaws.com":"https://storage.eko.com","studioz-post.s3.amazonaws.com":"https://studioz-post.eko.com"},targetPaths:["NodeRepository.mediaHostRewriteMap"]},playbackRate:{default:1,targetPaths:["PlaybackClock.playbackRate"]},initialKbps:{default:"auto",targetPaths:["DownloadSpeed.initialKbps"]},defaultRenderParams:{default:void 0,targetPaths:["Renderer.defaultRenderParams"]},maxBufferedVideoFrames:{default:24,targetPaths:["Timeline.maxBufferedVideoFrames"]},waitingBufferAheadSeconds:{default:3,targetPaths:["Timeline.waitingBufferAheadSeconds"]},abrStrategy:{default:"auto",targetPaths:["ABRSelector.abrStrategy"]},segmentEvictionEnabled:{default:!0,targetPaths:["SegmentEvictionCoordinator.enabled"]},segmentEvictionBufferBehindSeconds:{default:30,targetPaths:["SegmentEvictionCoordinator.bufferBehindSeconds"]},segmentEvictionBufferAheadSeconds:{default:30,targetPaths:["SegmentEvictionCoordinator.bufferAheadSeconds"]},segmentEvictionMaxRetainedBytes:{default:52428800,targetPaths:["SegmentEvictionCoordinator.maxRetainedBytes"]},autoplay:{default:!0,targetPaths:["Idle.autoplay"]},autoPauseOnVisibilityChange:{default:!0,targetPaths:["DocumentVisibility.autoPauseOnVisibilityChange"]},autoResumeOnVisibilityChange:{default:!0,targetPaths:["DocumentVisibility.autoResumeOnVisibilityChange"]},trackingEnabled:{default:!0,targetPaths:["Tracker.trackingEnabled"]}},tk=Object.freeze(Object.entries(Zb).reduce(((t,[e,n])=>(Object.prototype.hasOwnProperty.call(n,"default")&&(t[e]=n.default),t)),{})),ek=sh("config","warn");function nk(t){return tk[t]}var ik=new WeakMap,rk=new WeakMap,ok=new WeakMap,sk=new WeakMap,ak=new WeakMap,lk=new WeakSet;class ck extends fh{get name(){return"DownloadSpeed"}get defaults(){return{alpha:.3,maxSamples:30,minBytesPerSample:1024,minDurationMs:5,maxSampleKbpsCap:void 0,ignoreCacheHits:!0,samplesPath:"runtime.downloadSpeedSamples",initialKbps:nk("initialKbps"),probeUrl:void 0,defaultKbps:2500}}constructor(...t){super(...t),$(this,lk),W(this,ik,void 0),W(this,rk,void 0),W(this,ok,void 0),W(this,sk,void 0),W(this,ak,void 0),j(ok,this,[]),j(rk,this,0),j(ik,this,B(lk,this,hk).call(this)),j(ak,this,Wb()),j(sk,this,(t=>{B(lk,this,yk).call(this,t,"event")})),B(lk,this,fk).call(this),Fb.on("download:sample",z(sk,this)),B(lk,this,pk).call(this),this.log.debug(`[#constructor] Initial estimate: ${z(ik,this)} kbps`)}getKbps(){return z(ik,this)}addSample(t){B(lk,this,yk).call(this,t,"manual")}reset(){j(ok,this,[]),j(rk,this,0),j(ik,this,B(lk,this,hk).call(this))}onDispose(){z(ak,this)&&z(ak,this).abort(),j(ak,this,null),Fb.off("download:sample",z(sk,this)),j(ok,this,[]),j(rk,this,0),j(ik,this,void 0),j(sk,this,null)}}function uk(t,e){return!!(this.settings.ignoreCacheHits&&(0===e||t&&"boolean"==typeof t.cached&&t.cached||t&&"number"==typeof t.transferSize&&"number"==typeof t.encodedBodySize&&t.transferSize<=t.encodedBodySize))}function dk(t){if(!t||"object"!=typeof t)return null;const e=Number(t.bytes),n=Number(t.durationMs);let i=fb(t.kbps)?Number(t.kbps):NaN;return!fb(i)&&n>0&&fb(e)&&(i=8*e/n),fb(i)?e<=this.settings.minBytesPerSample||n<=this.settings.minDurationMs||B(lk,this,uk).call(this,t,e)?null:(fb(this.settings.maxSampleKbpsCap)&&i>this.settings.maxSampleKbpsCap&&(i=this.settings.maxSampleKbpsCap),{...t,bytes:e,durationMs:n,kbps:i}):null}function hk(){const t=this.settings.initialKbps;if(fb(t))return t;if("auto"===t)try{const t=(new xb).guesstimate();if(fb(t))return t}catch(t){}return this.settings.defaultKbps}function fk(){const t=Bb.get(this.settings.samplesPath,[]);if(!Array.isArray(t)||0===t.length)return;const e=t.slice(-this.settings.maxSamples);for(let t=0;t<e.length;t+=1)B(lk,this,yk).call(this,e[t],"replay",{emit:!1})}async function pk(){if(!this.settings.probeUrl||z(rk,this)>0)return;const t=z(ak,this)?z(ak,this).signal:void 0;if(!t||!t.aborted)try{await Jb(this.settings.probeUrl,{cache:"no-store",samplesTargetPath:this.settings.samplesPath,signal:t})}catch(t){}}function mk(t){return"number"==typeof t.startTime&&"number"==typeof t.endTime&&Number.isFinite(t.startTime)&&Number.isFinite(t.endTime)&&t.startTime>=0&&t.endTime>t.startTime}function vk(t,e){if(!B(lk,this,mk).call(this,t)||!B(lk,this,mk).call(this,e))return 0;const n=Math.max(t.startTime,e.startTime);return Math.min(t.endTime,e.endTime)-n}function gk(t){if(!B(lk,this,mk).call(this,t))return t;const e=[];for(let n=0;n<z(ok,this).length;n+=1){const i=z(ok,this)[n];B(lk,this,mk).call(this,i)&&(B(lk,this,vk).call(this,t,i)>0&&e.push(i))}if(0===e.length)return t;j(ok,this,z(ok,this).filter((t=>!e.includes(t))));const n=[t,...e],i=n.reduce(((t,e)=>t+(e.bytes||0)),0),r=Math.min(...n.map((t=>t.startTime))),o=Math.max(...n.map((t=>t.endTime))),s=o-r;if(!fb(i)||s<=0)return t;const a={bytes:i,durationMs:s,kbps:8*i/s,startTime:r,endTime:o,url:t.url||e[e.length-1].url};return B(lk,this,dk).call(this,a)}function yk(t,e,{emit:n=!0}={}){const i=B(lk,this,dk).call(this,t);if(!i)return;const r=B(lk,this,gk).call(this,i);if(!r)return;j(rk,this,z(rk,this)+1),z(ok,this).push(r),z(ok,this).length>this.settings.maxSamples&&z(ok,this).shift();const o=this.defaults.alpha,s="number"==typeof this.settings.alpha?this.settings.alpha:o,a=fb(z(ik,this)),l=a?z(ik,this):r.kbps,c=a||1!==z(rk,this)?s*r.kbps+(1-s)*l:r.kbps;j(ik,this,c),this.log.debug(`[#ingestSample] Next estimate: ${c} kbps`),n&&this.trigger("download:speed",{kbps:z(ik,this),sample:r,source:e,samplesCount:z(rk,this)})}function bk(t=""){if(t&&"string"==typeof t)return t.split(",")[0].trim()||void 0}function kk(t=""){const e=bk(t);if(!e)return;const n=e.match(/^[a-z0-9]+/i);return n?n[0].toLowerCase():void 0}var xk={getFirstCodec:bk,getBaseCodec:kk},wk=Object.freeze({__proto__:null,default:xk,getBaseCodec:kk,getFirstCodec:bk});class _k{constructor(t={}){const{id:e,url:n,uri:i,mime:r,codecs:o,bandwidth:s,timescale:a,sizeBytes:l,...c}=t;if(!e)throw new Error("Representation requires id");const u=n||i;if(!u)throw new Error("Representation requires url or uri");this.id=e,this.url=u,this.mime=r,this.codecs=o,this.baseCodec=kk(o),fb(s)&&(this.bandwidth=s),fb(a)&&(this.timescale=a),fb(l)&&(this.sizeBytes=l),Object.assign(this,c)}}class Ik{#P=new Map;#R;#D;#B=0;#L;constructor(t={}){const{id:e,offset:n=0,duration:i=0,isInit:r=!1,representations:o=[]}=t;if(!e)throw new Error("Segment requires id");o.forEach((t=>{if(!t||!t.url&&!t.uri)throw new Error("Segment representation must include uri or url")})),this.id=e,this.offset=n,this.duration=i,this.isInit=!!r,this.originalRepresentations=o.map((t=>t instanceof _k?t:new _k(t))),this.representations=this.originalRepresentations.map((t=>t)),this.appliedFilters=[],this.loadAttempts=0,this.loadError=void 0}setRepresentationBuffer(t,e){t&&e&&this.#P.set(t,e)}setDownloadProgress(t,e){const n=Number(t);Number.isFinite(n)&&n>=0&&(this.#B=Math.max(this.#B,n));const i=Number(e);Number.isFinite(i)&&i>0&&(this.#L=i)}setChosenRepresentation(t){this.#R=t;const e=null==t?void 0:t.id;if(!(this.isInit||!e||this.#P.size<=1))for(const t of this.#P.keys())t!==e&&this.#P.delete(t)}setABRDecisionSnapshot(t){if(!t||"object"!=typeof t)return void(this.#D=void 0);const e={...t};Array.isArray(t.availableRepresentations)&&(e.availableRepresentations=t.availableRepresentations.map((t=>({...t})))),this.#D=e}markLoadAttempt(){const t=Number(this.loadAttempts);this.loadAttempts=Number.isFinite(t)&&t>0?t+1:1,this.loadError=void 0}setLoadError(t){this.loadError=t||new Error("Segment load failed")}getRepresentationBuffer(t){return this.#P.get(t)}get chosenRepresentation(){return this.#R}get abrDecision(){return this.#D}get arrayBuffer(){return this.#R?this.#P.get(this.#R.id):void 0}get retainedByteLength(){let t=0;for(const e of this.#P.values())e&&"number"==typeof e.byteLength&&(t+=e.byteLength);return t}get bufferedRatio(){var t;const e=fb(this.#L)?this.#L:null===(t=this.#R)||void 0===t?void 0:t.sizeBytes;return fb(e)?Math.min(1,Math.max(0,this.#B/e)):this.retainedByteLength>0?1:0}get isLoaded(){return this.retainedByteLength>0}evict(){this.#R=void 0,this.#D=void 0,this.#P.clear(),this.#B=0,this.#L=void 0}}class Tk{constructor(t={}){const{timestamp:e,name:n,data:i,isSticky:r=!1}=t;this.timestamp="number"==typeof e?e:0,this.name="string"==typeof n?n:"",this.data=i,this.isSticky="boolean"==typeof r&&r}}function Ek(t,e){const n=Number(null==t?void 0:t.offset),i=Number(null==t?void 0:t.duration);if(!e)return{offset:n,duration:i};const r=(null==t?void 0:t.chosenRepresentation)||(Array.isArray(null==t?void 0:t.representations)?t.representations[0]:void 0),o=Number(null==r?void 0:r.segStart),s=Number(null==r?void 0:r.segDuration);return Number.isFinite(o)&&Number.isFinite(s)&&s>0?{offset:o,duration:s}:{offset:n,duration:i}}function Sk(t,e,n={}){if(!Array.isArray(t)||!t.length)return;const i=Number(e);if(!Number.isFinite(i))return;const r=!!n.preferRepresentationTime;let o,s,a=-1/0;for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||n.isInit)continue;o||(o=n);const l=Ek(n,r);if(!Number.isFinite(l.offset))continue;const c=Number(l.duration);if(Number.isFinite(c)&&c>0&&i>=l.offset&&i<l.offset+c)return n;l.offset<=i&&l.offset>a&&(a=l.offset,s=n)}return s||o}const Mk=new Set(["video","audio","image","cue","data","bbox"]);class Ak{constructor(t={}){const{id:e,type:n,offset:i=0,duration:r,source:o,segments:s=[],cues:a=[]}=t;if(!e)throw new Error("Track requires id");if(!Mk.has(n))throw new Error(`Track type must be one of ${Array.from(Mk).join("|")}`);this.id=e,this.type=n,this.offset=i,this.duration=fb(r)?r:void 0,this.source=o,"cue"===n?(this._cues=a.map((t=>t instanceof Tk?t:new Tk(t))),this._segments=[]):(this._segments=s.map((t=>t instanceof Ik?t:new Ik(t))),this._cues=void 0)}get segments(){return this._segments.slice()}get cues(){if("cue"===this.type)return this._cues.slice()}get endTime(){if(fb(this.duration))return this.offset+this.duration;if(!this._segments.length)return;const t=this._segments.reduce(((t,e)=>{const n=fb(e.duration)?e.duration:0;return Math.max(t,e.offset+n)}),this.offset);return t}get buffered(){const t=this._segments.map((t=>({duration:fb(null==t?void 0:t.duration)?t.duration:0,offset:fb(null==t?void 0:t.offset)?t.offset:0,ratio:t&&!t.isInit&&"number"==typeof t.bufferedRatio?t.bufferedRatio:0}))).filter((t=>t.duration>0&&t.ratio>0));if(!t.length)return;const e=t.reduce(((t,e)=>Math.min(t,e.offset)),1/0),n=t.reduce(((t,e)=>{const n=e.offset+e.duration*Math.min(1,e.ratio);return Math.max(t,n)}),0);return!Number.isFinite(e)||!Number.isFinite(n)||n<=e?void 0:{start:e,end:n}}getMediaSegmentAtTime(t,e={}){return Sk(this._segments,t,e)}setSegments(t=[]){if("cue"===this.type)return;const e=Array.isArray(t)?t:[];this._segments=e.map((t=>t instanceof Ik?t:new Ik(t)))}}function Nk(t){return"string"==typeof t?t:t&&"object"==typeof t?t.nodeId||t.nodeIdOrRef||t.id:void 0}function Fk(t){const e=Nk(t);let n=1;if(t&&"object"==typeof t&&fb(t.weight)&&(n=t.weight),!e)throw new Error("Child entry requires a nodeId");return{nodeId:e,weight:n}}function Ck(t){return(Array.isArray(t)?t:[]).map((t=>Fk(t)))}function Ok(t,e=void 0){if("string"==typeof t){const e=t.match(/\d+\.?\d*/);if(e){const t=Number(e[0]);if(Number.isFinite(t))return t}}else if("number"==typeof t&&Number.isFinite(t))return t;return e}function Pk(t,e){if(t){if(t.includes("$Number%")){const n=t.match(/\$Number%0(\d+)d\$/);if(n){const i=Number(n[1]),r=String(e).padStart(i,"0");return t.replace(/\$Number%0\d+d\$/,r)}}return t.replace(/\$Number\$/g,String(e))}}function Rk(t,e){if(e)try{var n;return new URL(e,t||(null==vh||null===(n=vh.location)||void 0===n?void 0:n.href)||void 0).toString()}catch(t){return e}}const Dk=new Map;class Bk{static register(t,e){if(!t||"function"!=typeof e)throw new Error("ManifestFactory.register requires type and parser function");Dk.set(t,e)}static inferType(t={}){const{typeHint:e,url:n,mimeType:i,body:r}=t;return e||function(t=""){const e=function(t=""){return t&&"string"==typeof t?t.split("#")[0].split("?")[0].toLowerCase():""}(t);return e.endsWith(".mpd")?"dash":e.endsWith(".ivd")?"ivd":e.endsWith(".jpg")||e.endsWith(".jpeg")||e.endsWith(".png")||e.endsWith(".webp")||e.endsWith(".gif")||e.endsWith(".avif")?"image":void 0}(n||"")||function(t=""){const e=t.toLowerCase();return e.includes("dash")||e.includes("mpd")||e.includes("xml")?"dash":e.includes("ivd")||e.includes("json")?"ivd":e.includes("image/")?"image":void 0}(i||"")||function(t=""){const e="string"==typeof t?t.trim():"";if(e.startsWith("<")&&e.includes("<MPD"))return"dash";if(e.startsWith("{"))try{const t=JSON.parse(e);if(t&&"object"==typeof t)return"ivd"}catch(t){return}}(r||"")}static parse(t={}){const e=Bk.inferType(t);if(!e||!Dk.has(e))throw new Error("Unsupported manifest type");return Dk.get(e)(t)}}Bk.register("dash",(function(t={}){const{body:e,url:n}=t,i=function(){if(vh&&"function"==typeof vh.DOMParser)return new vh.DOMParser;throw new Error("DOMParser is not available in this environment")}().parseFromString(e||"","application/xml"),r=i.getElementsByTagName("MPD")[0];if(!r)throw new Error("Invalid MPD");const o=i.getElementsByTagName("Period")[0],s=o?Array.from(o.getElementsByTagName("AdaptationSet")):[],a=[];let l=Ok(r.getAttribute("mediaPresentationDuration"));l=Number.isFinite(l)?l:void 0,s.forEach(((t,e)=>{const i=t.getAttribute("mimeType")||"",r=function(t=""){const e=t.toLowerCase();return e.includes("video")?"video":e.includes("audio")?"audio":e.includes("image")?"image":"data"}(i),o=t.getAttribute("id")||`${r}-${e+1}`,s=t.getElementsByTagName("SegmentTemplate")[0],c=Array.from(t.getElementsByTagName("Representation")).map((t=>function(t,e,n){const i=t.getAttribute("id")||t.getAttribute("representationId")||"",r=Ok(t.getAttribute("bandwidth")),o=t.getAttribute("codecs"),s=t.getAttribute("mimeType")||e&&e.getAttribute("mimeType")||n,a=t.getElementsByTagName("SegmentTemplate")[0]||e;return{repId:i,bandwidth:r,codecs:o,mime:s,media:a?a.getAttribute("media"):void 0,initialization:a?a.getAttribute("initialization"):void 0,timescale:Ok(a&&a.getAttribute("timescale"))||Ok(e&&e.getAttribute("timescale"),1)||1,startNumber:Ok(a&&a.getAttribute("startNumber"))||Ok(e&&e.getAttribute("startNumber"),1)||1,timeline:function(t){const e=[],n=t.getElementsByTagName("SegmentTimeline")[0];if(!n)return e;const i=Array.from(n.getElementsByTagName("S"));let r=0;for(let t=0;t<i.length;t+=1){const n=i[t],o=Ok(n.getAttribute("t")),s=Ok(n.getAttribute("d")),a=Ok(n.getAttribute("r"),0);if(!fb(s))continue;fb(o)&&(r=o);const l=a>=0?a:0;for(let t=0;t<=l;t+=1)e.push({start:r,duration:s}),r+=s}return e}(a)}}(t,s,i))),u=c.map((t=>({id:t.repId,url:Rk(n,Pk(t.initialization,t.startNumber)),bandwidth:t.bandwidth,mime:t.mime,codecs:t.codecs,timescale:t.timescale}))).filter((t=>t.url)),d=c.reduce(((t,e)=>{const n=Array.isArray(null==t?void 0:t.timeline)?t.timeline.length:0;return(Array.isArray(null==e?void 0:e.timeline)?e.timeline.length:0)>n?e:t}),c[0]),h=Array.isArray(null==d?void 0:d.timeline)?d.timeline:[],f=h.length,p=[],m=(null==d?void 0:d.timescale)||1;u.length>0&&p.push({id:`init-${o}`,offset:0,duration:0,isInit:!0,representations:u});for(let t=0;t<f;t+=1){const e=h[t];if(!e)continue;const i=c.map((e=>{const i=e.startNumber+t,r=e.timescale||m,o=Array.isArray(e.timeline)?e.timeline[t]:void 0;if(!o)return null;const s=o.start,a=o.duration;return{id:e.repId,url:Rk(n,Pk(e.media,i)),bandwidth:e.bandwidth,mime:e.mime,codecs:e.codecs,timescale:e.timescale,segIndex:t,segStart:s/r,segDuration:a/r}})).filter(Boolean);i.length&&p.push({id:`${o}-seg-${t+1}`,offset:e.start/m,duration:e.duration/m,isInit:!1,representations:i})}a.push({id:o,type:r,offset:0,duration:l,segments:p})}));const c=a[0]?a[0].id:void 0;return{id:n||r.getAttribute("id")||"mpd",mainTrackId:c,tracks:a,duration:l}})),Bk.register("ivd",(function(t={}){var e;const{body:n,url:i}=t;let r;try{r="string"==typeof n?JSON.parse(n):n}catch(t){throw new Error("Invalid IVD manifest")}if(!r||"object"!=typeof r)throw new Error("Invalid IVD manifest");const o=Array.isArray(r.representations)?r.representations:[],s=new Map;o.forEach(((t,e)=>{const n=function(t){const e=(t.mimeType||"").toLowerCase();return e.includes("video")?"video":e.includes("audio")?"audio":"data"}(t),i=Number.isInteger(t.altIndex)?t.altIndex:0,r=`${n}-${i}`,o=(l=e,{id:`${(a=t).format||"unknownformat"}-${a.altIndex||0}-${a.label||l+1}`,url:a.url,mime:a.mimeType,codecs:a.codecs,bandwidth:a.bandwidth||a.audioBandwidth||a.videoBandwidth,sizeBytes:a.contentLength,duration:fb(a.duration)?a.duration:void 0,segIndex:Number.isInteger(a.segIndex)&&a.segIndex>=0?a.segIndex:0});var a,l;s.has(r)||s.set(r,{type:n,altIndex:i,reps:[]}),s.get(r).reps.push(o)}));const a=Array.from(s.values()).map(((t,e)=>{const n=new Map;t.reps.forEach((t=>{const e=Number.isInteger(t.segIndex)?t.segIndex:0;n.has(e)||n.set(e,[]),n.get(e).push(t)}));const i=Array.from(n.keys()).sort(((t,e)=>t-e));let o=0;const s=i.map((i=>{var r;const s=n.get(i)||[],a=(null===(r=s.find((t=>fb(t.duration))))||void 0===r?void 0:r.duration)||0,l={id:`${t.type}-${t.altIndex}-${e+1}-seg-${i+1}`,offset:o,duration:a,isInit:!1,representations:s.map((t=>{const{duration:e,segIndex:n,...i}=t;return i}))};return o+=a,l})),a=s.reduce(((t,e)=>t+(fb(e.duration)?e.duration:0)),0),l=fb(r.duration)?r.duration:a||void 0;return{id:`${t.type}-${t.altIndex}-${e+1}`,type:t.type,offset:0,duration:l,segments:s}})),l=r.mainTrackId||(null===(e=a.find((t=>"video"===t.type)))||void 0===e?void 0:e.id)||a[0]&&a[0].id,c=a.find((t=>t.id===l)),u=(null==c?void 0:c.duration)||void 0;return{id:r.id||i||"ivd",metadata:r.metadata||{},mainTrackId:l,tracks:a,duration:u}})),Bk.register("image",(function(t={}){const e=null==t?void 0:t.url;if(!e||"string"!=typeof e)throw new Error("ImageParser requires url");const n=fb(null==t?void 0:t.duration)?t.duration:30,i=fb(null==t?void 0:t.width)?t.width:void 0,r=fb(null==t?void 0:t.height)?t.height:void 0,o={id:"image-1",url:e,mime:"string"==typeof(null==t?void 0:t.mimeType)?t.mimeType:void 0};fb(i)&&fb(r)&&(o.width=i,o.height=r);const s="image-1";return{id:e,metadata:{},mainTrackId:s,tracks:[{id:s,type:"image",offset:0,duration:n,segments:[{id:"image-1-seg-1",offset:0,duration:n,isInit:!1,representations:[o]}]}],duration:n}}));const Lk=["video/mp4"];function zk(t){return Lk.includes(t.mime)}var Wk={name:"containers",fn:function(t=[]){return t.filter(zk)},isRelevantForTrack:function(t){return"video"===(null==t?void 0:t.type)}},jk={name:"force-video-codec",fn:function(t=[],{node:e}={}){const n=kk(null==e?void 0:e.forceVideoCodec);if(!n)return t;const i=t.filter((t=>(null==t?void 0:t.baseCodec)===n));return i.length?i:t},isRelevantForTrack:function(t){return"video"===(null==t?void 0:t.type)}};function $k(t=""){return t.toLowerCase().includes("video")}const Uk=new(me=new WeakMap,ve=new WeakSet,class extends fh{get name(){return"MediaCapabilities"}get defaults(){return{enabled:!0,smoothWeight:10,powerWeight:10,ignoreSmooth:!1,ignorePower:!0,codecBonus:{av01:.2,hvc1:.15,hev1:.15,vp09:.1,avc1:0}}}constructor(...t){super(...t),$(this,ve),W(this,me,void 0),j(me,this,new Map)}onDispose(){z(me,this)&&z(me,this).clear()}async sortRepsCodecs(t=[]){if(!Array.isArray(t)||0===t.length)return[];const e=[],n=new Set;let i=0;t.forEach((t=>{const r=null==t?void 0:t.baseCodec;r&&!n.has(r)&&(n.add(r),e.push({codec:r,rep:t,index:i}),i+=1)}));const r=(await Promise.all(e.map((async t=>{const{score:e}=await B(ve,this,Qk).call(this,t.rep);return{...t,score:e}})))).sort(((t,e)=>{const n=e.score-t.score;return 0!==n?n:t.index-e.index}));return this.log.info("[sortRepsCodecs] Sorted entries:",r),r.map((t=>t.codec))}});function qk(){return!!(vh&&vh.navigator&&vh.navigator.mediaCapabilities&&"function"==typeof vh.navigator.mediaCapabilities.decodingInfo)}function Vk(t){if(!t||"object"!=typeof t)return void this.log.debug("[#buildConfig] Invalid representation:",t);const e=t.mime||t.mimeType||"",n=function(t="",e=""){const n=t||"",i=e||"";return i?`${n}; codecs="${i}"`:n}(e,t.codecs||"");return $k(e)?(this.log.debug("[#buildConfig] Building video config for:",t),{type:"file",video:{contentType:n,width:t.width||1920,height:t.height||1080,bitrate:t.videoBandwidth||t.bandwidth||0,framerate:t.framerate||t.frameRate||24}}):function(t=""){return t.toLowerCase().includes("audio")}(e)?(this.log.debug("[#buildConfig] Building audio config for:",t),{type:"file",audio:{contentType:n,channels:t.channels||2,bitrate:t.audioBandwidth||t.bandwidth||0,samplerate:t.audioSamplingRate||48e3}}):void this.log.debug("[#buildConfig] Unknown mime type:",e)}function Gk(t){const e=bk(null==t?void 0:t.codecs);if(!e)return;const n={codec:e,codedWidth:t.codedWidth||t.width||1920,codedHeight:t.codedHeight||t.height||1080};return t.description&&(n.description=t.description),n}function Hk(t){return t?JSON.stringify(t):"invalid"}function Kk(){return!(!vh||!vh.VideoDecoder||"function"!=typeof vh.VideoDecoder.isConfigSupported)}async function Xk(t){if(!this.settings.enabled||!B(ve,this,qk).call(this)||!t)return this.log.debug("[#queryCapabilities] Not supported, returning false",t),{supported:!1,smooth:!1,powerEfficient:!1};const e=B(ve,this,Hk).call(this,t),n=z(me,this).get(e);if(n)return n;let i;try{i=await vh.navigator.mediaCapabilities.decodingInfo(t)}catch(t){i={supported:!1,smooth:!1,powerEfficient:!1}}return this.log.debug("[#queryCapabilities] Config:",t,"\nDecoding info result:",i),z(me,this).set(e,i),i}async function Yk(t){if(!$k((null==t?void 0:t.mime)||(null==t?void 0:t.mimeType)||""))return{supported:!0};if(!B(ve,this,Kk).call(this))return{supported:!0};const e=B(ve,this,Gk).call(this,t);if(!e)return{supported:!1};const n=`video-decoder:${B(ve,this,Hk).call(this,e)}`,i=z(me,this).get(n);if(i)return i;let r;try{r=await vh.VideoDecoder.isConfigSupported(e)}catch(t){r={supported:!1}}return this.log.debug("[#queryVideoDecoderSupport] Config:",e,"\nSupport result:",r),z(me,this).set(n,r),r}async function Qk(t){const e=B(ve,this,Vk).call(this,t),[n,i]=await Promise.all([B(ve,this,Xk).call(this,e),B(ve,this,Yk).call(this,t)]),r=!!n.supported&&!!i.supported,o={supported:r,smooth:r&&!!n.smooth,powerEfficient:r&&!!n.powerEfficient},s=function(t="",e={}){const n=(t||"").toLowerCase();return Object.keys(e).reduce(((t,i)=>n.includes(i.toLowerCase())?e[i]:t),0)}(t.codecs||"",this.settings.codecBonus);let a=0;return o.supported&&(a+=1),!this.settings.ignoreSmooth&&o.smooth&&(a+=this.settings.smoothWeight),!this.settings.ignorePower&&o.powerEfficient&&(a+=this.settings.powerWeight),a+=s,{score:a,capability:o}}const Jk=[],Zk=()=>!0;[Wk,jk,{name:"media-capabilities",fn:async function(t=[],{track:e}){if(null==e||!e.preferredCodec){const n=await Uk.sortRepsCodecs(t);if(!Array.isArray(n)||0===n.length)return t;e.preferredCodec=n[0]}return t.filter((t=>(null==t?void 0:t.baseCodec)===e.preferredCodec))},isRelevantForTrack:function(t){return"video"===(null==t?void 0:t.type)}}].forEach((({name:t,fn:e,isRelevantForTrack:n})=>{!function(t,e,{isRelevantForTrack:n}={}){if(!t||"function"!=typeof e)throw new Error("registerRepresentationFilter requires a name and function");const i="function"==typeof n?n:Zk;Jk.push({name:t,fn:e,isRelevantForTrack:i})}(t,e,{isRelevantForTrack:n})}));const tx=sh("Node","warn"),ex={start:0,end:0},nx=.001;function ix(t){if(!Array.isArray(t)||!t.length)return;const e=t.map((t=>{const e=Number(null==t?void 0:t.segStart),n=Number(null==t?void 0:t.segDuration);return!Number.isFinite(e)||!Number.isFinite(n)||n<=0?null:{start:e,duration:n}}));if(e.some((t=>!t)))return;const n=e[0];return e.every((t=>Math.abs(t.start-n.start)<=nx&&Math.abs(t.duration-n.duration)<=nx))?{offset:n.start,duration:n.duration}:void 0}var rx=new WeakMap,ox=new WeakMap,sx=new WeakMap,ax=new WeakMap,lx=new WeakMap,cx=new WeakMap,ux=new WeakMap,dx=new WeakMap,hx=new WeakMap,fx=new WeakMap,px=new WeakSet;class mx extends ah{constructor(t={},e={}){super(),$(this,px),W(this,rx,void 0),W(this,ox,void 0),W(this,sx,void 0),W(this,ax,void 0),W(this,lx,void 0),W(this,cx,void 0),W(this,ux,void 0),W(this,dx,void 0),W(this,hx,void 0),W(this,fx,[]);const{id:n,manifestRef:i,duration:r,width:o,height:s,metadata:a={},children:l=[]}=t;if(!n)throw new Error("Node requires id");if(!i)throw new Error("Node requires manifestRef");this.id=n,this.manifestRef=i,this.metadata=a,this.state="pending",this.error=void 0,this.tracks=[],this.mainTrackId=void 0,this.imageFallbackActive=!1,this.disabledTracks=[],this.disabledTrackTypes=Array.isArray(e.disabledTracks)?e.disabledTracks.filter((t=>"string"==typeof t)):[],this.enabledRepFilters=Array.isArray(e.enabledRepFilters)?e.enabledRepFilters:void 0,this.forceVideoCodec="string"==typeof e.forceVideoCodec&&e.forceVideoCodec.trim()?e.forceVideoCodec.trim():void 0,j(ux,this,!0===e.forceImageFallback),j(rx,this,e.abrSelector),j(ox,this,e.assetsDeliveryService),j(ax,this,fb(r)?r:void 0),j(lx,this,fb(o)?o:void 0),j(cx,this,fb(s)?s:void 0),j(dx,this,e&&"object"==typeof e.mediaHostRewriteMap?e.mediaHostRewriteMap:void 0),j(hx,this,fb(e.maxManifestLoadAttempts)?e.maxManifestLoadAttempts:1/0),this.manifestLoadAttempts=0,this.manifestLoadError=void 0,j(fx,this,Ck(l))}setChildren(t){const e=Ck(t);return B(px,this,Ox).call(this,e,{emit:!0})}addChild(t){const e=Fk(t),n=z(fx,this).slice(),i=n.findIndex((t=>(null==t?void 0:t.nodeId)===e.nodeId));if(i>=0){var r;if((null===(r=n[i])||void 0===r?void 0:r.weight)===e.weight)return this.children;n[i]=e}else n.push(e);return B(px,this,Ox).call(this,n,{emit:!0})}removeChild(t){const e=Nk(t);if(!e)return this.children;const n=z(fx,this).filter((t=>(null==t?void 0:t.nodeId)!==e));return n.length===z(fx,this).length?this.children:B(px,this,Ox).call(this,n,{emit:!0})}async load(t={}){const{loadingMode:e="full",signal:n}=t;tx.info(`[load] [${this.id}] Loading node in '${e}' mode`);try{if(n&&n.aborted)throw jb();"ready"!==this.state&&await this.resolve({signal:n});const t="partial"===e,i=[];this.tracks.forEach((e=>{const n=e.segments||[];if(t){const t=n.find((t=>t.isInit)),r=n.find((t=>!t.isInit));t&&Array.isArray(t.representations)&&!t.isLoaded&&i.push({track:e,segment:t}),r&&Array.isArray(r.representations)&&!r.isLoaded&&i.push({track:e,segment:r})}else n.forEach((t=>{Array.isArray(t.representations)&&!t.isLoaded&&i.push({track:e,segment:t})}))}));const r=i.filter((({segment:t})=>t.isInit)),o=i.filter((({segment:t})=>!t.isInit)),s=o.length?o[0]:void 0,a=r.map((({track:t,segment:e})=>B(px,this,Ax).call(this,t,e,n))),l=s?B(px,this,Nx).call(this,s.segment,s.track,n):Promise.resolve();await Promise.all([...a,l]);const c=s?o.slice(1):o;for(const t of c)await B(px,this,Nx).call(this,t.segment,t.track,n);if(n&&n.aborted)throw jb();return this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:e}),this}catch(t){if($b(t,n))throw t;throw this.trigger("node:loaderror",{nodeId:this.id,node:this,error:t,loadingMode:e}),t}}async loadMediaSegmentsAtOffset(t,e={}){const n=Number(t);if(tx.info(`[loadMediaSegmentsAtOffset] [${this.id}] Loading media segments at offset ${n}`),!Number.isFinite(n))return;const{signal:i}=e;if(i&&i.aborted)throw jb();if("ready"!==this.state&&await this.resolve({signal:i}),"ready"!==this.state)return;const r=[],o=[];if(this.tracks.forEach((t=>{const e=(null==t?void 0:t.segments)||[];if(!Array.isArray(e)||!e.length)return;const s=e.find((t=>(null==t?void 0:t.isInit)&&Array.isArray(null==t?void 0:t.representations)));s&&!s.isLoaded&&r.push(B(px,this,Ax).call(this,t,s,i)),e.forEach((e=>{if(!e||e.isInit||!Array.isArray(e.representations))return;const i=Number(e.offset);Number.isFinite(i)&&Math.abs(i-n)<=nx&&!e.isLoaded&&o.push({segment:e,track:t})}))})),r.length||o.length){if(await Promise.all(r),o.length&&await Promise.all(o.map((({segment:t,track:e})=>B(px,this,Nx).call(this,t,e,i)))),i&&i.aborted)throw jb();this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:"segment-offset",offsetSeconds:n})}}async resolve(t={}){const{signal:e,manifestOverride:n}=t;let i=!0;for(;i;){if(i=!1,"ready"===this.state)return this;if("resolving"===this.state)try{return await z(sx,this)}catch(t){if(!$b(t)||e&&e.aborted)throw t;i=!0;continue}if(e&&e.aborted)throw jb();if(this.hasExceededManifestLoadAttempts()){const t=this.manifestLoadError||new Error("Manifest load retry limit reached");throw this.state="failed",this.error=t,t}const t=B(px,this,wx).call(this);return this.state="resolving",this.error=void 0,j(sx,this,(async()=>{try{const t=await B(px,this,Fx).call(this,{signal:e,manifestOverride:n});if(e&&e.aborted)throw jb();let i=Bk.parse(t);return i=B(px,this,xx).call(this,i),this.tracks=(i.tracks||[]).map((t=>t instanceof Ak?t:new Ak(t))),this.mainTrackId=i.mainTrackId||this.mainTrackId,this.metadata=i.metadata||this.metadata,B(px,this,Rx).call(this),B(px,this,Px).call(this),await B(px,this,Cx).call(this),this.state="ready",this}catch(n){if($b(n,e))throw B(px,this,_x).call(this,t),n;throw this.state="failed",this.error=n,n}})()),z(sx,this)}return z(sx,this)}evict(){this.tracks.forEach((t=>{(t.segments||[]).forEach((t=>{t.evict()}))}))}get children(){return z(fx,this).slice()}set children(t){this.setChildren(t)}get duration(){if(!this.mainTrackId)return 0;const t=this.tracks.find((t=>t.id===this.mainTrackId));return t?fb(t.duration)?t.duration:t.endTime:0}get retainedByteLength(){let t=0;return this.tracks.forEach((e=>{(Array.isArray(e.segments)?e.segments:[]).forEach((e=>{t+=fb(e.retainedByteLength)?e.retainedByteLength:0}))})),t}get buffered(){if("ready"!==this.state)return ex;const t=Array.isArray(this.tracks)?this.tracks.find((t=>(null==t?void 0:t.id)===this.mainTrackId)):void 0,e=this.duration;if(!t||!fb(e))return ex;const n=Array.isArray(this.tracks)?this.tracks.map((t=>{if(!t||void 0===t.buffered)return;const e=t.buffered;return e&&Number.isFinite(e.start)&&Number.isFinite(e.end)?{track:t,range:e}:void 0})).filter(Boolean):[];if(!n.length)return ex;if(n.length===this.tracks.length&&n.every((({track:t,range:e})=>{const n=t.endTime,i=fb(t.offset)?t.offset:0;return Number.isFinite(n)&&e.start<=i&&e.end>=n})))return{start:0,end:e};const i=n.reduce(((t,{range:e})=>Math.min(t,e.end)),1/0);if(!Number.isFinite(i))return ex;const r=Math.min(i,e);return r>0?{start:0,end:r}:ex}get isLoaded(){return"ready"===this.state&&(Array.isArray(this.tracks)?this.tracks:[]).flatMap((t=>Array.isArray(null==t?void 0:t.segments)?t.segments:[])).every((t=>t.isLoaded))}hasExceededManifestLoadAttempts(){if(!Number.isFinite(z(hx,this))||z(hx,this)<=0)return!1;if(!this.manifestLoadError)return!1;const t=Number(this.manifestLoadAttempts);return Number.isFinite(t)&&t>=z(hx,this)}}function vx(t){return function(t,e){if(!t||"string"!=typeof t)return t;if(!e||"object"!=typeof e)return t;const n=vh&&"function"==typeof vh.URL?vh.URL:"function"==typeof URL?URL:null;if(!n)return t;let i;try{i=new n(t)}catch(e){return t}const r=function(t,e){const n=null==t?void 0:t.hostname,i=null==t?void 0:t.pathname;if("string"!=typeof n||"string"!=typeof i)return t;if(!/^s3(?:[.-][a-z0-9-]+)?\.amazonaws\.com$/i.test(n))return t;const r=i.split("/").filter(Boolean);if(r.length<2)return t;const o=r[0],s=new e(t.toString());return s.hostname=`${o}.${n}`,s.pathname=`/${r.slice(1).join("/")}`,s}(i,n),o=e[r.hostname]?r:i,s=e[o.hostname];if(!s||"string"!=typeof s)return t;let a;try{a=new n(s)}catch(e){return t}return a.protocol&&a.host?(o.protocol=a.protocol,o.host=a.host,o.toString()):t}(t,z(dx,this))}function gx(){return z(ux,this)||void 0===vh.VideoDecoder}function yx(){return this.manifestRef&&"object"==typeof this.manifestRef&&"assets-delivery-service"===this.manifestRef.type}function bx(t){if(!B(px,this,yx).call(this))return!1;if(!B(px,this,gx).call(this))return!1;const e=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[],n=e.find((e=>(null==e?void 0:e.id)===(null==t?void 0:t.mainTrackId)))||e[0];return"image"!==(null==n?void 0:n.type)}function kx(t){const e=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[],n=function(t){const e=Number(null==t?void 0:t.duration);if(Number.isFinite(e)&&e>0)return e;const n=Array.isArray(null==t?void 0:t.segments)?t.segments:[];let i=0;return n.forEach((t=>{if(null!=t&&t.isInit)return;const e=Number(null==t?void 0:t.offset),n=Number(null==t?void 0:t.duration);!Number.isFinite(e)||!Number.isFinite(n)||n<=0||(i=Math.max(i,e+n))})),i>0?i:void 0}(e.find((e=>(null==e?void 0:e.id)===(null==t?void 0:t.mainTrackId)))||e[0]);return fb(n)?n:fb(z(ax,this))?z(ax,this):void 0}function xx(t){if(this.imageFallbackActive=!1,!B(px,this,bx).call(this,t))return t;if(!z(ox,this)||"function"!=typeof z(ox,this).resolveImageOne)return t;const e=z(ox,this).resolveImageOne(this.manifestRef),n=B(px,this,vx).call(this,null==e?void 0:e.url);if(!n)return t;const i={typeHint:"image",url:n,duration:B(px,this,kx).call(this,t),width:z(lx,this),height:z(cx,this)},r=Bk.parse(i);return t&&"object"==typeof t.metadata&&!Array.isArray(t.metadata)&&(r.metadata=t.metadata),this.imageFallbackActive=!0,r}function wx(){return{state:this.state,error:this.error,tracks:this.tracks,mainTrackId:this.mainTrackId,metadata:this.metadata,imageFallbackActive:this.imageFallbackActive,disabledTracks:this.disabledTracks,manifestRef:this.manifestRef,manifestLoadAttempts:this.manifestLoadAttempts,manifestLoadError:this.manifestLoadError}}function _x(t){t&&(this.state=t.state,this.error=t.error,this.tracks=t.tracks,this.mainTrackId=t.mainTrackId,this.metadata=t.metadata,this.imageFallbackActive=t.imageFallbackActive,this.disabledTracks=t.disabledTracks,this.manifestRef=t.manifestRef,this.manifestLoadAttempts=t.manifestLoadAttempts,this.manifestLoadError=t.manifestLoadError)}function Ix(){const t=Number(this.manifestLoadAttempts);this.manifestLoadAttempts=Number.isFinite(t)&&t>0?t+1:1,this.manifestLoadError=void 0}function Tx(t){this.manifestLoadError=t||new Error("Manifest load failed")}function Ex(t){if(!t)return null;const e={loadAttempts:Number(t.loadAttempts),loadError:t.loadError};if("function"==typeof t.markLoadAttempt)return t.markLoadAttempt(),e;const n=Number(t.loadAttempts);return t.loadAttempts=Number.isFinite(n)&&n>0?n+1:1,t.loadError=void 0,e}function Sx(t,e){if(!t||!e)return;const n=Number(e.loadAttempts);t.loadAttempts=Number.isFinite(n)&&n>=0?n:0,t.loadError=e.loadError}function Mx(t,e){t&&("function"!=typeof t.setLoadError?t.loadError=e||new Error("Segment load failed"):t.setLoadError(e))}async function Ax(t,e,n){const i=B(px,this,Ex).call(this,e);try{const i=e.representations.map((async i=>{const r=B(px,this,vx).call(this,i.url),o=await Jb(r,{returnType:"arrayBuffer",signal:n,onProgress:({loaded:n,total:i,chunk:r})=>{e&&"function"==typeof e.setDownloadProgress&&e.setDownloadProgress(n,i),this.trigger("segment:chunk",{nodeId:this.id,trackId:null==t?void 0:t.id,trackType:null==t?void 0:t.type,segmentId:e.id,isInit:!0,loaded:n,total:i,chunk:r})}}),s=o instanceof ArrayBuffer?o:null==o?void 0:o.arrayBuffer;s&&e.setRepresentationBuffer(i.id,s)}));await Promise.all(i)}catch(t){if($b(t,n))throw B(px,this,Sx).call(this,e,i),t;throw B(px,this,Mx).call(this,e,t),t}}async function Nx(t,e,n){const i=z(rx,this),r={representations:t.representations,nodeId:this.id,trackId:null==e?void 0:e.id,segmentId:t.id},o=i&&"function"==typeof i.select?i.select(r):void 0,s=t.representations.find((t=>t.id===o))||t.representations[0];if(!s)return;t&&"function"==typeof t.setABRDecisionSnapshot&&t.setABRDecisionSnapshot(r.abrDecision),t.setChosenRepresentation(s);const a=B(px,this,Ex).call(this,t);try{const i=B(px,this,vx).call(this,s.url),r=await Jb(i,{returnType:"arrayBuffer",signal:n,onProgress:({loaded:n,total:i,chunk:r})=>{t&&"function"==typeof t.setDownloadProgress&&t.setDownloadProgress(n,i),this.trigger("segment:chunk",{nodeId:this.id,trackId:null==e?void 0:e.id,trackType:null==e?void 0:e.type,segmentId:t.id,isInit:!1,loaded:n,total:i,chunk:r})}}),o=r instanceof ArrayBuffer?r:null==r?void 0:r.arrayBuffer;o&&(t.setRepresentationBuffer(s.id,o),t.setChosenRepresentation(s))}catch(e){if($b(e,n))throw B(px,this,Sx).call(this,t,a),e;throw B(px,this,Mx).call(this,t,e),e}}async function Fx(t={}){const{signal:e,manifestOverride:n}=t;if(e&&e.aborted)throw jb();B(px,this,Ix).call(this);try{let t=this.manifestRef;if(n&&"object"==typeof n){if(B(px,this,yx).call(this)&&"string"==typeof n.encodeProfile&&n.encodeProfile&&(this.manifestRef={...this.manifestRef,encodeProfile:n.encodeProfile},t=this.manifestRef),n.ivd)return{typeHint:"ivd",body:n.ivd};if(n.body){const t=B(px,this,vx).call(this,n.url);return{typeHint:n.typeHint,url:t,mimeType:n.mimeType,body:n.body,duration:z(ax,this),width:z(lx,this),height:z(cx,this)}}"string"==typeof n.url&&n.url&&(t=n)}if(t&&"object"==typeof t&&"assets-delivery-service"===t.type){if(!z(ox,this)||"function"!=typeof z(ox,this).resolveOne)throw new Error("AssetsDeliveryService is required for assets-delivery-service manifestRef");const n=await z(ox,this).resolveOne(t,{signal:e});if(!n)throw new Error("AssetsDeliveryService returned empty result");if("string"==typeof n.encodeProfile&&n.encodeProfile&&(this.manifestRef={...t,encodeProfile:n.encodeProfile}),n.ivd)return{typeHint:"ivd",body:n.ivd};const i=n.typeHint,r=B(px,this,vx).call(this,n.url),o=n.mimeType,s=n.body;if(r||s||o)return{typeHint:i,url:r,mimeType:o,body:s,duration:z(ax,this),width:z(lx,this),height:z(cx,this)};throw new Error("AssetsDeliveryService returned unsupported manifest shape")}if(t&&"object"==typeof t){const e=B(px,this,vx).call(this,t.url),n=t.mimeType;if(t.body)return{url:e,mimeType:n,body:"string"==typeof t.body?t.body:JSON.stringify(t.body)}}if("string"==typeof t||t&&"string"==typeof t.url){const n="string"==typeof t?t:t.url,i=B(px,this,vx).call(this,n),r="object"==typeof t?t.typeHint:void 0,o="object"==typeof t?t.mimeType:void 0;if("image"===Bk.inferType({typeHint:r,url:i,mimeType:o})){const e="object"==typeof t&&fb(t.duration)?t.duration:z(ax,this);return{typeHint:"image",url:i,mimeType:o,duration:e,width:"object"==typeof t&&fb(t.width)?t.width:z(lx,this),height:"object"==typeof t&&fb(t.height)?t.height:z(cx,this)}}const s=await Jb(i,{returnType:"default",signal:e});return{url:i,body:s&&s.response&&"function"==typeof s.response.text?await s.response.text():void 0,mimeType:(s&&s.response&&s.response.headers&&"function"==typeof s.response.headers.get&&s.response.headers.get("content-type")?s.response.headers.get("content-type"):void 0)||o}}throw new Error("Node manifestRef is invalid or missing")}catch(t){if($b(t,e))throw t;throw B(px,this,Tx).call(this,t),t}}async function Cx(){const t=Jk.slice().filter((t=>!this.enabledRepFilters||this.enabledRepFilters.includes(t.name)));if(t.length)for(let e=0;e<this.tracks.length;e+=1){const n=this.tracks[e],i=Array.isArray(n.segments)?n.segments:[],r=[];for(let e=0;e<i.length;e+=1){const o=i[e];if(!Array.isArray(o.representations)){r.push(o);continue}o.appliedFilters=o.appliedFilters||[];let s=o.representations;for(let e=0;e<t.length;e+=1){const{name:i,fn:r,isRelevantForTrack:a}=t[e];if(!a(n))continue;const l=await r(s,{segment:o,track:n,node:this});Array.isArray(l)&&(s=l),o.appliedFilters.push(i)}if(o.representations=s,o.representations.length){if(!o.isInit){const t=ix(o.representations);t&&(o.offset=t.offset,o.duration=t.duration)}r.push(o)}}r.length!==i.length&&n&&"function"==typeof n.setSegments&&n.setSegments(r)}}function Ox(t,{emit:e=!1}={}){return function(t=[],e=[]){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n+=1){const i=t[n],r=e[n];if((null==i?void 0:i.nodeId)!==(null==r?void 0:r.nodeId)||(null==i?void 0:i.weight)!==(null==r?void 0:r.weight))return!1}return!0}(z(fx,this),t)||(j(fx,this,t),e&&(n=this)&&"function"==typeof n.trigger&&n.trigger("node:childrenchanged",{nodeId:n.id,node:n,children:Array.isArray(n.children)?n.children:[]})),this.children;var n}function Px(){var t;const e=Array.isArray(this.disabledTrackTypes)?this.disabledTrackTypes:[];if(!e.length||!Array.isArray(this.tracks)||!this.tracks.length)return void(this.disabledTracks=[]);const n=new Set(e),i=[],r=[];this.tracks.forEach((t=>{t&&n.has(t.type)?r.push(t):t&&i.push(t)})),this.tracks=i,this.disabledTracks=r,this.mainTrackId&&!i.some((t=>t.id===this.mainTrackId))&&(this.mainTrackId=null===(t=i[0])||void 0===t?void 0:t.id)}function Rx(){if(!Array.isArray(this.tracks)||!this.tracks.length)return;const t=this.duration;if(!fb(t))return;const e=[new Tk({name:"nodestart",timestamp:0,data:{id:this.id},isSticky:!0}),new Tk({name:"nodeend",timestamp:t,data:{id:this.id}})],n=new Ak({id:`${this.id}-auto-cue`,type:"cue",cues:e,offset:0,duration:t});this.tracks.push(n)}var Dx=new WeakMap,Bx=new WeakMap,Lx=new WeakMap,zx=new WeakMap,Wx=new WeakSet;class jx extends fh{constructor(...t){super(...t),$(this,Wx),W(this,Dx,new Map),W(this,Bx,new Map),W(this,Lx,void 0),W(this,zx,void 0);const[e,n]=t;j(Lx,this,e),j(zx,this,n)}get name(){return"NodeRepository"}get defaults(){return{enabledRepFilters:["containers","force-video-codec","media-capabilities"],disabledTracks:nk("disabledTracks"),forceVideoCodec:nk("forceVideoCodec"),forceImageFallback:nk("forceImageFallback"),mediaHostRewriteMap:nk("mediaHostRewriteMap"),maxManifestLoadAttempts:3}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"get","list"])}onDispose(){z(Dx,this).forEach(((t,e)=>{const n=z(Bx,this).get(e);n&&t&&"function"==typeof t.off&&t.off(yh.NODE_CHILDREN_CHANGED,n)})),z(Bx,this).clear(),z(Dx,this).clear()}add(t){const e=t instanceof mx?t:new mx(t,{enabledRepFilters:this.settings.enabledRepFilters,disabledTracks:this.settings.disabledTracks,forceVideoCodec:this.settings.forceVideoCodec,forceImageFallback:this.settings.forceImageFallback,mediaHostRewriteMap:this.settings.mediaHostRewriteMap,maxManifestLoadAttempts:this.settings.maxManifestLoadAttempts,abrSelector:z(Lx,this),assetsDeliveryService:z(zx,this)});if(!e.id)throw new Error("NodeRepository.add requires node with id");if(z(Dx,this).has(e.id))throw new Error(`NodeRepository.add: node with id ${e.id} already exists`);return z(Dx,this).set(e.id,e),B(Wx,this,$x).call(this,e),this.trigger(yh.NODE_ADD,{node:e}),e}get(t){const e=(null==t?void 0:t.id)||t;if(!e)throw new Error("NodeRepository.get requires node or id");return z(Dx,this).get(e)}list(){return Array.from(z(Dx,this).values())}}function $x(t){if(!t||"function"!=typeof t.on||!t.id)return;const e=t=>{this.trigger(yh.NODE_CHILDREN_CHANGED,t)};t.on(yh.NODE_CHILDREN_CHANGED,e),z(Bx,this).set(t.id,e)}var Ux=new WeakMap,qx=new WeakMap,Vx=new WeakSet;class Gx extends fh{constructor(...t){super(...t),$(this,Vx),W(this,Ux,void 0),W(this,qx,new Map);const[e]=t;j(Ux,this,e)}get name(){return"ABRSelector"}get defaults(){return{safetyMargin:.35,minBufferForUpgrade:5,minBufferCritical:1,hysteresisRatio:1.1,abrStrategy:nk("abrStrategy")}}select(t={}){var e;const{representations:n=[],bufferSeconds:i}=t;if(!Array.isArray(n)||0===n.length)return;const r=z(Ux,this)&&"function"==typeof z(Ux,this).getKbps?z(Ux,this).getKbps():void 0,o=B(Vx,this,Hx).call(this,n[0]),s=z(qx,this).get(o),a=this.settings.abrStrategy||"auto";this.log.debug(`[select] strategy=${a}, bw=${r}, buffer=${i}, prev=${s}`);const l=n.slice().sort(((t,e)=>B(Vx,this,Kx).call(this,t.bandwidth)-B(Vx,this,Kx).call(this,e.bandwidth)));if("bottom"===a){const e=l[0];return B(Vx,this,Qx).call(this,e,t,{decisionReason:"strategy:bottom",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==e?void 0:e.id}if("top"===a){const e=l[l.length-1];return B(Vx,this,Qx).call(this,e,t,{decisionReason:"strategy:top",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==e?void 0:e.id}if("random"===a){const e=l[Math.floor(Math.random()*l.length)];return B(Vx,this,Qx).call(this,e,t,{decisionReason:"strategy:random",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==e?void 0:e.id}const c=Number.isFinite(i)?i:void 0,u=fb(r)?r*this.settings.safetyMargin:void 0;let d="auto:highest-available";if(s&&void 0!==c&&c<this.settings.minBufferCritical){const e=l[0];return this.log.debug("[select] critical buffer -> lowest",t),B(Vx,this,Qx).call(this,e,t,{decisionReason:"auto:critical-buffer",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:u,bufferSeconds:c}),null==e?void 0:e.id}let h=l[l.length-1];if(void 0!==u){const e=l.filter((t=>B(Vx,this,Kx).call(this,t.bandwidth)<=u));e.length>0?(h=e[e.length-1],d="auto:highest-under-safe-bandwidth",this.log.debug("[select] under safe bandwidth ->",h.id,t)):(this.log.debug("[select] no rep under safe bandwidth, fallback lowest",t),h=l[0],d="auto:no-rep-under-safe-bandwidth")}if(s&&void 0!==c&&c<this.settings.minBufferForUpgrade){const e=n.find((t=>t.id===s));e&&fb(e.bandwidth)&&fb(h.bandwidth)&&h.bandwidth/e.bandwidth>this.settings.hysteresisRatio&&(h=n.filter((t=>t.bandwidth&&t.bandwidth<=e.bandwidth*this.settings.hysteresisRatio)).sort(((t,e)=>t.bandwidth-e.bandwidth)).pop()||e,d="auto:hysteresis-hold",this.log.debug("[select] hysteresis prevents upgrade; hold",h.id,t))}return B(Vx,this,Qx).call(this,h,t,{decisionReason:d,trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:u,bufferSeconds:c}),null===(e=h)||void 0===e?void 0:e.id}onDispose(){z(qx,this).clear(),j(Ux,this,null)}}function Hx(t){var e,n;return(null===(e=t.mime)||void 0===e||null===(n=e.split)||void 0===n||null===(n=n.call(e,"/"))||void 0===n?void 0:n[0])||"unknown"}function Kx(t){return fb(t)?t/1e3:0}function Xx(t){return fb(t)?t/1e3:void 0}function Yx(t,e,n={}){const i=Array.isArray(null==e?void 0:e.representations)?e.representations.map((t=>({id:null==t?void 0:t.id,bandwidthKbps:B(Vx,this,Xx).call(this,null==t?void 0:t.bandwidth)}))):[];return{timeMs:Date.now(),strategy:this.settings.abrStrategy||"auto",decisionReason:n.decisionReason,nodeId:null==e?void 0:e.nodeId,trackId:null==e?void 0:e.trackId,segmentId:null==e?void 0:e.segmentId,trackType:n.trackType,measuredDownloadSpeedKbps:Number.isFinite(n.measuredDownloadSpeedKbps)?n.measuredDownloadSpeedKbps:void 0,safeBandwidthKbps:Number.isFinite(n.safeBandwidthKbps)?n.safeBandwidthKbps:void 0,bufferSeconds:Number.isFinite(n.bufferSeconds)?n.bufferSeconds:void 0,previousRepresentationId:n.previousRepresentationId,selectedRepresentationId:null==t?void 0:t.id,selectedRepresentationBandwidthKbps:B(Vx,this,Xx).call(this,null==t?void 0:t.bandwidth),safetyMargin:Number(this.settings.safetyMargin),minBufferForUpgrade:Number(this.settings.minBufferForUpgrade),minBufferCritical:Number(this.settings.minBufferCritical),hysteresisRatio:Number(this.settings.hysteresisRatio),availableRepresentations:i}}function Qx(t,e,n={}){if(!t)return;const i=B(Vx,this,Yx).call(this,t,e,n);e&&"object"==typeof e&&(e.abrDecision=i),this.log.info("[select] Chosen representation:",t,"context:",e,"decision:",i),this.trigger("abr:selection",{representation:t,context:e,strategy:this.settings.abrStrategy,decision:i});const r=B(Vx,this,Hx).call(this,t);z(qx,this).set(r,t.id)}var Jx=new WeakMap,Zx=new WeakSet;class tw extends fh{constructor(...t){super(...t),$(this,Zx),W(this,Jx,void 0);const[e]=t;if(j(Jx,this,e),!z(Jx,this)||"function"!=typeof z(Jx,this).list)throw new Error("NodePrioritizer requires a NodeRepository instance")}get name(){return"NodePrioritizer"}get defaults(){return{levelMultiplier:1,priorityMultiplier:.3}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"sortNodes"])}onDispose(){j(Jx,this,null)}getPrioritizationSnapshot(t){const e=z(Jx,this).list();if(!e.length)return{orderedIds:[],reachableIds:[]};const{levels:n,weights:i}=B(Zx,this,ew).call(this,e,t);return{orderedIds:B(Zx,this,nw).call(this,e,n,i),reachableIds:Array.from(n.keys())}}sortNodes(t){const{orderedIds:e}=this.getPrioritizationSnapshot(t);return e.length?(this.log.info(`[sortNodes(${t})] Sorted nodes: [${e.join(", ")}]`),e):[]}getReachableNodeIds(t){const{reachableIds:e}=this.getPrioritizationSnapshot(t);return e}}function ew(t,e){const n=new Map;t.forEach((t=>{t&&t.id&&n.set(t.id,t)}));const i=new Map,r=new Map;if(!e||!n.has(e))return{levels:i,weights:r};const o=[{id:e,level:0,priority:1}];for(i.set(e,0),r.set(e,1);o.length;){const{id:t,level:e,priority:s}=o.shift(),a=n.get(t),l=Array.isArray(null==a?void 0:a.children)?a.children:[];for(let t=0;t<l.length;t+=1){const a=l[t],c=(null==a?void 0:a.nodeId)||(null==a?void 0:a.id);if(!c||!n.has(c)||i.has(c))continue;const u=fb(null==a?void 0:a.weight)?a.weight:1,d=Math.max(u,s);i.set(c,e+1),r.set(c,d),o.push({id:c,level:e+1,priority:d})}}return{levels:i,weights:r}}function nw(t,e,n){const i=e.size>0,{levelMultiplier:r,priorityMultiplier:o}=this.settings,s=t.map((t=>{var s;const a=e.has(t.id)?e.get(t.id):i?Number.MAX_SAFE_INTEGER:0,l=Number.isFinite(a)?a:Number.MAX_SAFE_INTEGER,c=null!==(s=n.get(t.id))&&void 0!==s?s:1,u=(Number.isFinite(l)?r*l:Number.MAX_SAFE_INTEGER)+o*c;return{id:t.id,score:u,level:l,priorityWeight:c}}));return s.sort(((t,e)=>t.score!==e.score?t.score-e.score:t.level!==e.level?t.level-e.level:t.priorityWeight!==e.priorityWeight?t.priorityWeight-e.priorityWeight:t.id.localeCompare(e.id))),s.map((t=>t.id))}function iw(t,e){return function(t,e){const n=Array.isArray(t)?t:[];return n.length?e&&n.includes(e)?e:n[0]:e||void 0}(null==t?void 0:t.availableEncodeProfiles,e)}function rw(t,e){const n=t&&"object"==typeof t?{...t}:t;return n&&"object"==typeof n?("string"==typeof e&&e?n.encodeProfile=e:delete n.encodeProfile,n):n}function ow(t){return"string"==typeof t&&t.startsWith("cmaf:")}function sw(t){return"image"===(null==t?void 0:t.assetType)?"image":"ivd"}function aw(t){if(!t||"object"!=typeof t)return t;if(Object.prototype.hasOwnProperty.call(t,"mpd")){const e="string"==typeof t.mpdUrl&&t.mpdUrl||"string"==typeof t.url&&t.url||void 0;return{typeHint:"dash",body:t.mpd,url:e}}return t.ivd||t.url||t.body||t.mimeType||t.typeHint?t:(e=t)&&"object"==typeof e&&Array.isArray(e.representations)?{ivd:t}:t;var e}var lw=new WeakMap,cw=new WeakMap,uw=new WeakSet;class dw extends fh{constructor(...t){super(...t),$(this,uw),W(this,lw,void 0),W(this,cw,void 0);const[,e={}]=t;j(lw,this,"function"==typeof e.fetchFn?e.fetchFn:void 0),j(cw,this,Wb())}get name(){return"AssetsDeliveryService"}get defaults(){return{assetsDeliveryServiceUrl:"https://assets.eko.com",profile:nk("encodeProfile"),maxBatchSize:5,imageQueryParams:{startOffset:0,width:1024}}}async resolveOne(t,e={}){var n;const i=await this.resolve([t],e);if(!i.length)return;const r=i[0],o=null==r?void 0:r.manifest,s=null==r||null===(n=r.manifestRef)||void 0===n?void 0:n.encodeProfile;return o&&"object"==typeof o&&"string"==typeof s&&s?{...o,encodeProfile:s}:o}resolveImageOne(t){if(!B(uw,this,fw).call(this,t))return;const e=iw(t,this.settings.profile),n=function(t,e,n){const i=function(t,e,n){const i=(t||"").replace(/\/$/,""),r=null==n?void 0:n.assetId,o=null==n?void 0:n.assetRevision;if(i&&e&&"string"==typeof r&&"number"==typeof o)return`${i}/${e}/${encodeURIComponent(r)}/${o}`}(t,"image",e);if(!i)return;const r=function(t){if(!t||"object"!=typeof t||Array.isArray(t))return"";const e=new URLSearchParams;return Object.keys(t).forEach((n=>{if("string"!=typeof n||!n)return;const i=t[n];null!=i&&("number"!=typeof i||Number.isFinite(i))&&("string"!=typeof i&&"number"!=typeof i&&"boolean"!=typeof i||e.set(n,String(i)))})),e.toString()}(n);return r?`${i}?${r}`:i}(this.settings.assetsDeliveryServiceUrl||"",t,this.settings.imageQueryParams);if(!n)return;const i={typeHint:"image",url:n};return"string"==typeof e&&e&&(i.encodeProfile=e),i}async resolve(t=[],e={}){const n=(Array.isArray(t)?t:[t]).filter((t=>B(uw,this,fw).call(this,t)));if(!n.length)return[];const i=B(uw,this,hw).call(this,e);if(i&&i.aborted)return[];const r=[],o=this.settings.profile;n.forEach((t=>{if("image"!==sw(t))return;const e=this.resolveImageOne(t);e&&e.url&&r.push({manifestRef:rw(t,e.encodeProfile),manifest:{typeHint:"image",url:e.url}})}));const s=n.filter((t=>"image"!==sw(t))).map((t=>function(t,e){const n=iw(t,e);return{ref:t,profile:n,route:ow(n)?"dash":"ivd"}}(t,o))),a=B(uw,this,mw).call(this,s);for(const{refs:t,route:e}of a){if(i&&i.aborted)return r;const{url:n}=B(uw,this,vw).call(this,t,e),o=await B(uw,this,gw).call(this,n,{method:"GET",signal:i});o&&"object"==typeof o&&t.forEach((({ref:t,profile:e})=>{const n=`${t.assetId}:${t.assetRevision}`,i=o[n]||o[t.assetId]||o[t.assetId||n];i&&r.push({manifestRef:rw(t,e),manifest:aw(i)})}))}return r}onDispose(){z(cw,this)&&z(cw,this).abort(),j(cw,this,null),j(lw,this,null)}}function hw(t){return t&&t.signal?t.signal:z(cw,this)?z(cw,this).signal:void 0}function fw(t){const e="number"==typeof(null==t?void 0:t.assetRevision)&&Number.isFinite(t.assetRevision)&&t.assetRevision>=0;return t&&"assets-delivery-service"===t.type&&"string"==typeof t.assetId&&e}function pw(t,e){const n=Number.isFinite(e)&&e>0?e:t.length,i=[];for(let e=0;e<t.length;e+=n)i.push(t.slice(e,e+n));return i}function mw(t){if(!Array.isArray(t)||!t.length)return[];const e=[];t.forEach((t=>{const n=e[e.length-1];n&&n.route===t.route?n.refs.push(t):e.push({route:t.route,refs:[t]})}));const n=[];return e.forEach((t=>{B(uw,this,pw).call(this,t.refs,this.settings.maxBatchSize).forEach((e=>{n.push({route:t.route,refs:e})}))})),n}function vw(t,e="ivd"){const n=t.map((({ref:t,profile:e})=>function(t,e){const n=`${t.assetId}:${t.assetRevision}`;return e?`${n}:${e}`:n}(t,e))),i=new URLSearchParams({assets:n.join(","),type:"data"});return{url:`${(this.settings.assetsDeliveryServiceUrl||"").replace(/\/$/,"")}/${"dash"===e?"dash":"ivd"}?${i.toString()}`}}async function gw(t,e){return z(lw,this)?z(lw,this).call(this,t,e):await Jb(t,{returnType:"json",method:(null==e?void 0:e.method)||"GET",signal:null==e?void 0:e.signal})}function yw({prioritizer:t,repository:e,startNodeId:n,prioritizedIds:i,pendingIds:r,allowedIds:o,filter:s,fallbackToRepository:a=!0}={}){const l=Array.isArray(i)?i:t&&"function"==typeof t.sortNodes?t.sortNodes(n):[],c=a?(f=e)&&"function"==typeof f.list?f.list().map((t=>null==t?void 0:t.id)).filter(Boolean):[]:[],u=l.length?l:c,d=r?new Set(r):null,h=o?new Set(o):null;var f;return u.filter((t=>{if(!t)return!1;if(d&&d.has(t))return!1;if(h&&!h.has(t))return!1;const n=function(t,e){if(t&&"function"==typeof t.get)return t.get(e)}(e,t);return!(!n||"function"==typeof s&&!s(n,t))}))}const bw=(vh.requestAnimationFrame||vh.mozRequestAnimationFrame||vh.webkitRequestAnimationFrame||vh.msRequestAnimationFrame||(t=>vh.setTimeout(t,1e3/60))).bind(vh),kw=(vh.cancelAnimationFrame||vh.mozCancelAnimationFrame||vh.webkitCancelAnimationFrame||vh.msCancelAnimationFrame||(t=>vh.clearTimeout(t))).bind(vh),xw=sh("ticker","warn");let ww,_w=[],Iw=null,Tw=zb();function Ew(){Tw=zb();const t=[];let e,n;for(n=_w.length-1;n>=0;--n)e=_w[n],Tw>=e.lastTick+e.interval&&t.push(e);for(n=t.length-1;n>=0;--n)if(e=t[n],!e.stopped){e.lastTick=Tw;try{e.callback()}catch(t){console&&"function"==typeof console.error?console.error(t):xw.error(t)}}ww=bw(Ew)}function Sw(){zb()-Tw>=200&&(kw(ww),Ew())}function Mw(t){let e=-1;for(let n=0;n<_w.length;n+=1)if(_w[n].callback===t){e=n;break}return e}function Aw(t,e=0){if(!t||"function"!=typeof t||"number"!=typeof e||e<0)return void xw.error("[start] Invalid arguments given to start method.",arguments);const n=Mw(t);return-1!==n?(xw.debug("[start] Callback already exists, overriding interval.",arguments),_w[n].interval=e,t):(_w.push({callback:t,interval:e,lastTick:zb()}),1===_w.length&&(ww=bw(Ew),Iw||(Iw=vh.setInterval(Sw,1e3))),t)}function Nw(t){const e=Mw(t);-1!==e?(_w[e].stopped=!0,_w.splice(e,1),_w.length||(kw(ww),vh.clearInterval(Iw),Iw=null)):xw.debug("[stop] Callback not found, doing nothing.",arguments)}function Fw(t){return-1!==Mw(t)}function Cw(t,e,n){const i="number"==typeof n?n:(null==n?void 0:n.maxQueueSize)||Number.POSITIVE_INFINITY,r=null!=n&&n.immediatelyFlushFirst?"boolean"==typeof n.immediatelyFlushFirst?n.immediatelyFlushFirst?1:0:Number(n.immediatelyFlushFirst):0;let o=0;if("function"!=typeof t)return void xw.error("[createThrottler] Bad argument given to createThrottler, first argument must be a function.",arguments);xw.debug("[createThrottler] Creating a new throttler instance.",arguments);const s=[];function a(){xw.debug("[onThrottlerTick] Calling callback with "+s.length+" queued items.");const e=s.slice(0);s.length=0,Nw(a),t(e)}const l={push:function(t){xw.debug("[push] Queuing argument:",t),0===s.length&&Aw(a,e),s.push(t),o+=1,(o<=r||s.length>=i)&&a()},flush:function(){xw.debug("[flush] Flushing queue."),0!==s.length&&a()},dispose:function(){xw.debug("[dispose] Disposing of throttler.");const t=s.slice(0);return s.length=0,Nw(a),t}};return Object.defineProperty(l,"interval",{enumerable:!0,get:function(){return e},set:function(t){"number"==typeof t&&(e=t)}}),l}function Ow(t,e){if(t&&"function"==typeof t)return t.__tickerThrottler||(t.__tickerThrottler=Cw((function(){t()}),e)),"number"==typeof e&&(t.__tickerThrottler.interval=e),t.__tickerThrottler.push(),t.__tickerThrottler;xw.error("[scheduleExecution] Bad argument given to scheduleExecution, first argument must be a function.",arguments)}var Pw=new WeakMap,Rw=new WeakMap,Dw=new WeakMap,Bw=new WeakMap,Lw=new WeakMap,zw=new WeakMap,Ww=new WeakMap,jw=new WeakMap,$w=new WeakMap,Uw=new WeakMap,qw=new WeakMap,Vw=new WeakMap,Gw=new WeakMap,Hw=new WeakMap,Kw=new WeakMap,Xw=new WeakMap,Yw=new WeakSet;class Qw extends fh{constructor(...t){super(...t),$(this,Yw),W(this,Pw,void 0),W(this,Rw,void 0),W(this,Dw,void 0),W(this,Bw,void 0),W(this,Lw,[]),W(this,zw,[]),W(this,Ww,new Set),W(this,jw,new Set),W(this,$w,!1),W(this,Uw,void 0),W(this,qw,void 0),W(this,Vw,void 0),W(this,Gw,void 0),W(this,Hw,void 0),W(this,Kw,void 0),W(this,Xw,void 0);const[e,n,i,r]=t;j(Pw,this,e),j(Rw,this,n),j(Dw,this,i),j(Bw,this,r),j(Uw,this,Wb());const o=t.length?t[t.length-1]:void 0,s=o&&"object"==typeof o&&Number.isFinite(o.maxConcurrent)?o.maxConcurrent:void 0;Number.isFinite(s)&&(this.settings.maxConcurrent=s),j(Xw,this,(()=>B(Yw,this,l_).call(this))),B(Yw,this,e_).call(this),B(Yw,this,t_).call(this)}get name(){return"NodeResolver"}get defaults(){return{maxConcurrent:5}}onDispose(){var t;z(Uw,this)&&z(Uw,this).abort(),j(Uw,this,null),z(Bw,this)&&"function"==typeof z(Bw,this).off&&z(Vw,this)&&z(Bw,this).off(yh.PLACEMENT_ADDED,z(Vw,this)),z(Bw,this)&&"function"==typeof z(Bw,this).off&&z(Kw,this)&&z(Bw,this).off(yh.TIMELINE_RESET,z(Kw,this)),z(Pw,this)&&"function"==typeof z(Pw,this).off&&z(Gw,this)&&z(Pw,this).off(yh.NODE_ADD,z(Gw,this)),z(Pw,this)&&"function"==typeof z(Pw,this).off&&z(Hw,this)&&z(Pw,this).off(yh.NODE_CHILDREN_CHANGED,z(Hw,this)),j(Vw,this,null),j(Gw,this,null),j(Hw,this,null),j(Kw,this,null),j(Lw,this,[]),j(zw,this,[]),z(Ww,this).clear(),z(jw,this).clear(),j($w,this,!1),j(qw,this,void 0),null!==(t=z(Xw,this))&&void 0!==t&&t.__tickerThrottler&&z(Xw,this).__tickerThrottler.dispose(),j(Xw,this,null)}}function Jw(){return z(Uw,this)?z(Uw,this).signal:void 0}function Zw(){return this._disposed||z(Uw,this)&&z(Uw,this).signal.aborted}function t_(){z(Bw,this)&&"function"==typeof z(Bw,this).on&&(j(Vw,this,(t=>{B(Yw,this,i_).call(this,null==t?void 0:t.nodeId)})),z(Bw,this).on(yh.PLACEMENT_ADDED,z(Vw,this)),j(Kw,this,(()=>B(Yw,this,n_).call(this))),z(Bw,this).on(yh.TIMELINE_RESET,z(Kw,this))),z(Pw,this)&&"function"==typeof z(Pw,this).on&&(j(Gw,this,(({node:t})=>{(null==t?void 0:t.id)&&B(Yw,this,i_).call(this,t.id,{fromRepoAdd:!0})})),z(Pw,this).on(yh.NODE_ADD,z(Gw,this)),j(Hw,this,(()=>{Ow(z(Xw,this),100)})),z(Pw,this).on(yh.NODE_CHILDREN_CHANGED,z(Hw,this)))}function e_(){const t=z(Bw,this)&&Array.isArray(z(Bw,this).placements)?z(Bw,this).placements:[];t.forEach((t=>B(Yw,this,i_).call(this,t.nodeId)));const e=t.length?t[t.length-1]:void 0;e&&e.nodeId&&j(qw,this,e.nodeId)}function n_(){z(Uw,this)&&z(Uw,this).abort(),j(Uw,this,Wb()),j(Lw,this,[]),j(zw,this,[]),z(Ww,this).clear(),j($w,this,!1),j(qw,this,void 0)}function i_(t,{fromRepoAdd:e=!1}={}){B(Yw,this,Zw).call(this)||t&&(z(jw,this).has(t)||z(Ww,this).has(t)||(z(Lw,this).push(t),z(qw,this)||e||j(qw,this,t),!z($w,this)&&e||B(Yw,this,r_).call(this)))}function r_(){if(z($w,this))return void B(Yw,this,o_).call(this);if(0===z(Lw,this).length)return;j($w,this,!0);const t=z(Lw,this).shift();B(Yw,this,c_).call(this,t).finally((()=>{B(Yw,this,o_).call(this)}))}async function o_(){if(!B(Yw,this,Zw).call(this))for(z(Lw,this).length||z(zw,this).length||j(zw,this,B(Yw,this,s_).call(this));z(Ww,this).size<this.settings.maxConcurrent;){const t=this.settings.maxConcurrent-z(Ww,this).size;if(t<=0)break;const e=[];for(;e.length<t&&(z(Lw,this).length||z(zw,this).length);){let t=z(Lw,this).shift();t||(t=z(zw,this).shift()),t&&e.push(t)}if(!e.length)break;const n=B(Yw,this,u_).call(this,e);n.length&&z(Dw,this)&&"function"==typeof z(Dw,this).resolve&&B(Yw,this,d_).call(this,n).finally((()=>B(Yw,this,o_).call(this))),e.filter((t=>!n.find((e=>e.nodeId===t)))).forEach((t=>{B(Yw,this,c_).call(this,t).finally((()=>B(Yw,this,o_).call(this)))}))}}function s_(){const t=new Set([...z(jw,this),...z(Ww,this),...z(Lw,this)]);return B(Yw,this,a_).call(this,t)}function a_(t){const e=z(Bw,this)&&Array.isArray(z(Bw,this).placements)?z(Bw,this).placements:[],n=(e.length?e[e.length-1].nodeId:void 0)||z(qw,this);return yw({prioritizer:z(Rw,this),repository:z(Pw,this),startNodeId:n,pendingIds:t,fallbackToRepository:!1})}function l_(){B(Yw,this,Zw).call(this)||(z($w,this)||0!==z(Lw,this).length)&&(j(zw,this,B(Yw,this,s_).call(this)),z($w,this)&&B(Yw,this,o_).call(this))}async function c_(t,e){if(!t||z(jw,this).has(t)||z(Ww,this).has(t))return;const n=B(Yw,this,Jw).call(this);if(n&&n.aborted)return;const i=z(Pw,this)&&"function"==typeof z(Pw,this).get?z(Pw,this).get(t):void 0;if(i&&"function"==typeof i.resolve)if("function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts())z(jw,this).add(t);else{z(Ww,this).add(t);try{const r={signal:n};e&&(r.manifestOverride=e),await i.resolve(r),z(jw,this).add(t)}catch(e){if($b(e,n))return;this.log.warn(`NodeResolver failed to resolve node ${t}: ${(null==e?void 0:e.message)||e}`),"function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts()&&z(jw,this).add(t)}finally{z(Ww,this).delete(t)}}}function u_(t){const e=[];return t.forEach((t=>{const n=z(Pw,this)&&"function"==typeof z(Pw,this).get?z(Pw,this).get(t):void 0;n&&n.manifestRef&&"assets-delivery-service"===n.manifestRef.type&&e.push({nodeId:t,ref:n.manifestRef})})),e}async function d_(t){const e=B(Yw,this,Jw).call(this);if(!e||!e.aborted){t.forEach((({nodeId:t})=>z(Ww,this).add(t)));try{const n=t.map((t=>t.ref)),i=await z(Dw,this).resolve(n,{signal:e});t.forEach((({nodeId:t,ref:e})=>{var n;const r=z(Pw,this)&&"function"==typeof z(Pw,this).get?z(Pw,this).get(t):void 0;if(z(Ww,this).delete(t),!r||"function"!=typeof r.resolve)return;const o=Array.isArray(i)?i.find((t=>{const n=null==t?void 0:t.manifestRef;return n&&n.assetId===e.assetId&&n.assetRevision===e.assetRevision})):void 0,s="string"==typeof(null==o||null===(n=o.manifestRef)||void 0===n?void 0:n.encodeProfile)&&o.manifestRef.encodeProfile?o.manifestRef.encodeProfile:void 0,a=o?B(Yw,this,h_).call(this,o.manifest,s):void 0;B(Yw,this,c_).call(this,t,a)}))}catch(n){$b(n,e)||this.log.warn(`NodeResolver ADS batch failed: ${(null==n?void 0:n.message)||n}`),t.forEach((({nodeId:t})=>z(Ww,this).delete(t)))}}}function h_(t,e){if(!t)return;const n="string"==typeof e&&e?e:void 0,i=t=>n&&t&&"object"==typeof t?{...t,encodeProfile:n}:t;return t.ivd?i({typeHint:"ivd",body:t.ivd}):t.url||t.body||t.mimeType?i({typeHint:t.typeHint,url:t.url,mimeType:t.mimeType,body:t.body}):i(t)}const f_=.001,p_="priority";function m_(t){const e=Number(t);return Number.isFinite(e)?e:0}var v_=new WeakMap,g_=new WeakMap,y_=new WeakMap,b_=new WeakMap,k_=new WeakMap,x_=new WeakMap,w_=new WeakMap,__=new WeakMap,I_=new WeakMap,T_=new WeakMap,E_=new WeakMap,S_=new WeakMap,M_=new WeakMap,A_=new WeakMap,N_=new WeakMap,F_=new WeakMap,C_=new WeakMap,O_=new WeakMap,P_=new WeakMap,R_=new WeakMap,D_=new WeakSet;class B_ extends fh{constructor(...t){super(...t),$(this,D_),W(this,v_,void 0),W(this,g_,void 0),W(this,y_,void 0),W(this,b_,new Map),W(this,k_,new Map),W(this,x_,[]),W(this,w_,new Set),W(this,__,new Map),W(this,I_,!1),W(this,T_,void 0),W(this,E_,void 0),W(this,S_,void 0),W(this,M_,void 0),W(this,A_,void 0),W(this,N_,void 0),W(this,F_,void 0),W(this,C_,void 0),W(this,O_,!1),W(this,P_,[]),W(this,R_,void 0);const[e,n,i]=t;j(v_,this,e),j(g_,this,n),j(y_,this,i),j(E_,this,Wb()),j(R_,this,(()=>B(D_,this,bI).call(this))),B(D_,this,J_).call(this)}get name(){return"SegmentLoadCoordinator"}get defaults(){return{maxConcurrentLoads:3,maxSegmentLoadAttempts:3}}onDispose(){var t;z(E_,this)&&z(E_,this).abort(),j(E_,this,null),z(__,this).size&&z(__,this).forEach((t=>{(null==t?void 0:t.controller)&&t.controller.abort()})),z(__,this).clear(),z(y_,this)&&"function"==typeof z(y_,this).off&&(z(S_,this)&&z(y_,this).off(yh.PLACEMENT_ADDED,z(S_,this)),z(A_,this)&&z(y_,this).off(yh.TIMELINE_SEEKING,z(A_,this)),z(N_,this)&&z(y_,this).off(yh.TIMELINE_SEEKED,z(N_,this)),z(F_,this)&&z(y_,this).off(yh.TIMELINE_RESET,z(F_,this))),z(v_,this)&&"function"==typeof z(v_,this).off&&z(M_,this)&&z(v_,this).off(yh.NODE_CHILDREN_CHANGED,z(M_,this)),z(C_,this)&&"function"==typeof vh.removeEventListener&&vh.removeEventListener("online",z(C_,this)),j(S_,this,null),j(M_,this,null),j(A_,this,null),j(N_,this,null),j(F_,this,null),j(C_,this,null),z(b_,this).clear(),z(k_,this).clear(),j(x_,this,[]),z(w_,this).clear(),z(__,this).clear(),j(I_,this,!1),j(T_,this,void 0),j(O_,this,!1),j(P_,this,[]),null!==(t=z(R_,this))&&void 0!==t&&t.__tickerThrottler&&z(R_,this).__tickerThrottler.dispose(),j(R_,this,null)}}function L_(){return z(E_,this)?z(E_,this).signal:void 0}function z_(){return this._disposed||z(E_,this)&&z(E_,this).signal.aborted}function W_(){const t=Number(this.settings.maxSegmentLoadAttempts);return Number.isFinite(t)&&t>0?t:1/0}function j_(t){const e=B(D_,this,W_).call(this);if(!Number.isFinite(e)||e===1/0)return!1;if(null==t||!t.loadError)return!1;const n=Number(t.loadAttempts);return Number.isFinite(n)&&n>=e}function $_(t){return!!t&&(!!B(D_,this,j_).call(this,t)||B(D_,this,U_).call(this,t))}function U_(t){if(!t)return!1;if("boolean"==typeof t.isLoaded)return t.isLoaded;const e=Number(t.retainedByteLength);return Number.isFinite(e)&&e>0}function q_(t){if(!t||B(D_,this,U_).call(this,t))return;const e=Number(t.loadAttempts);(Number.isFinite(e)&&e>0||t.loadError)&&("function"==typeof t.evict&&t.evict(),t.loadAttempts=0,t.loadError=void 0)}function V_(t){t&&(t.manifestLoadError&&(t.manifestLoadAttempts=0,t.manifestLoadError=void 0,"failed"===t.state&&(t.state="pending",t.error=void 0)),(Array.isArray(t.tracks)?t.tracks:[]).forEach((t=>{(Array.isArray(null==t?void 0:t.segments)?t.segments:[]).forEach((t=>{B(D_,this,q_).call(this,t)}))})))}function G_(){(z(v_,this)&&"function"==typeof z(v_,this).list?z(v_,this).list():[]).forEach((t=>{B(D_,this,V_).call(this,t)}))}function H_(t,{allowSeekKeep:e=!1,segmentOffset:n}={}){const i=Wb(),r=i?i.signal:B(D_,this,L_).call(this);return t&&z(__,this).set(t,{controller:i,allowSeekKeep:!!e,segmentOffset:n}),{signal:r,controller:i}}function K_(t,e,n={}){const i=z(__,this).get(t);i&&i.controller===e&&(Object.prototype.hasOwnProperty.call(n,"allowSeekKeep")&&(i.allowSeekKeep=!!n.allowSeekKeep),Object.prototype.hasOwnProperty.call(n,"segmentOffset")&&(i.segmentOffset=n.segmentOffset))}function X_(t,e){const n=z(__,this).get(t);n&&(e&&n.controller!==e||z(__,this).delete(t))}function Y_(t,e){const n=new Set;return(Array.isArray(t)?t:[]).forEach((t=>{const i=null==t?void 0:t.nodeId;if(!i)return;const r=z(v_,this)&&"function"==typeof z(v_,this).get?z(v_,this).get(i):void 0;if(!r)return;const o=B(D_,this,cI).call(this,r,t,e);Number.isFinite(o)&&n.add(`${i}:${o}`)})),n}function Q_(t){z(__,this).size&&z(__,this).forEach(((e,n)=>{const i=null==e?void 0:e.segmentOffset,r=Number.isFinite(i)?`${n}:${i}`:"";!(null!=e&&e.allowSeekKeep&&r&&t&&t.has(r))&&(null==e?void 0:e.controller)&&e.controller.abort()}))}function J_(){z(y_,this)&&"function"==typeof z(y_,this).on&&(j(S_,this,(t=>{B(D_,this,rI).call(this,t)})),z(y_,this).on(yh.PLACEMENT_ADDED,z(S_,this)),j(A_,this,(t=>B(D_,this,Z_).call(this,t))),z(y_,this).on(yh.TIMELINE_SEEKING,z(A_,this)),j(N_,this,(t=>B(D_,this,tI).call(this,t))),z(y_,this).on(yh.TIMELINE_SEEKED,z(N_,this)),j(F_,this,(()=>B(D_,this,iI).call(this))),z(y_,this).on(yh.TIMELINE_RESET,z(F_,this))),z(v_,this)&&"function"==typeof z(v_,this).on&&(j(M_,this,(()=>{Ow(z(R_,this),100)})),z(v_,this).on(yh.NODE_CHILDREN_CHANGED,z(M_,this))),"function"==typeof vh.addEventListener&&(j(C_,this,(()=>B(D_,this,nI).call(this))),vh.addEventListener("online",z(C_,this)))}function Z_(t={}){if(B(D_,this,z_).call(this))return;const e=Number(null==t?void 0:t.targetTime);if(!Number.isFinite(e))return;const n=Array.isArray(null==t?void 0:t.placements)?t.placements:[],i=B(D_,this,Y_).call(this,n,e);B(D_,this,Q_).call(this,i),j(O_,this,!0),j(P_,this,n.map((t=>{const n=null==t?void 0:t.nodeId;if(n)return{nodeId:n,placement:t,targetTime:e}})).filter(Boolean)),setTimeout((()=>B(D_,this,sI).call(this)),0)}function tI(t={}){var e;if(B(D_,this,z_).call(this))return;j(O_,this,!1),j(P_,this,[]);const n=Number.isFinite(null==t?void 0:t.targetTime)?Number(t.targetTime):Number(null===(e=z(y_,this))||void 0===e?void 0:e.currentTime);B(D_,this,eI).call(this,n),setTimeout((()=>B(D_,this,sI).call(this)),0)}function eI(t){var e;(Array.isArray(null===(e=z(y_,this))||void 0===e?void 0:e.placements)?z(y_,this).placements:[]).forEach((e=>{if(!e)return;const n=Tv(e);if(Number.isFinite(n)){if(Number.isFinite(t)){if(n>=t)return void B(D_,this,rI).call(this,e);const i=_v(e,z(v_,this));return Number.isFinite(i)?void(n+i>t&&B(D_,this,rI).call(this,e)):void(n<=t&&B(D_,this,rI).call(this,e))}B(D_,this,rI).call(this,e)}}))}function nI(){var t;B(D_,this,z_).call(this)||(B(D_,this,G_).call(this),j(O_,this,!1),j(P_,this,[]),B(D_,this,eI).call(this,Number(null===(t=z(y_,this))||void 0===t?void 0:t.currentTime)),j(x_,this,B(D_,this,gI).call(this)),setTimeout((()=>B(D_,this,sI).call(this)),0))}function iI(){z(E_,this)&&z(E_,this).abort(),j(E_,this,Wb()),z(__,this).size&&z(__,this).forEach((t=>{(null==t?void 0:t.controller)&&t.controller.abort()})),z(__,this).clear(),z(b_,this).clear(),z(k_,this).clear(),j(x_,this,[]),z(w_,this).clear(),j(I_,this,!1),j(T_,this,void 0),j(O_,this,!1),j(P_,this,[])}function rI(t){if(B(D_,this,z_).call(this))return;const e=null==t?void 0:t.nodeId;if(!e)return;const n=z(b_,this).get(e);if(n){const i=Tv(n),r=Tv(t);Number.isFinite(i)?Number.isFinite(r)&&r<i&&z(b_,this).set(e,t):Number.isFinite(r)&&z(b_,this).set(e,t)}else z(b_,this).set(e,t);const i=z(T_,this);j(T_,this,e),i&&i!==e&&j(x_,this,[]),z(I_,this)?setTimeout((()=>B(D_,this,sI).call(this)),0):B(D_,this,oI).call(this)}function oI(){z(I_,this)||z(b_,this).size&&(j(I_,this,!0),B(D_,this,sI).call(this))}async function sI(){if(B(D_,this,z_).call(this))return;if(z(w_,this).size>=this.settings.maxConcurrentLoads)return;if(z(O_,this))return void(z(P_,this).length&&B(D_,this,aI).call(this));const t=B(D_,this,hI).call(this);if(t.hasPending)B(D_,this,fI).call(this,t);else for(z(x_,this).length||j(x_,this,B(D_,this,gI).call(this));z(w_,this).size<this.settings.maxConcurrentLoads&&z(x_,this).length;){const t=z(x_,this).shift();B(D_,this,kI).call(this,t,"partial").finally((()=>{setTimeout((()=>B(D_,this,sI).call(this)),0)}))}}function aI(){if(B(D_,this,z_).call(this))return;const t=Math.max(0,this.settings.maxConcurrentLoads-z(w_,this).size);if(!t||!z(P_,this).length)return;const e=[],n=[];for(let i=0;i<z(P_,this).length;i+=1){const r=z(P_,this)[i];(null==r?void 0:r.nodeId)&&(e.length<t&&!z(w_,this).has(r.nodeId)?e.push(r):n.push(r))}j(P_,this,n),e.forEach((t=>{B(D_,this,lI).call(this,t).finally((()=>{setTimeout((()=>B(D_,this,sI).call(this)),0)}))}))}async function lI(t={}){const e=null==t?void 0:t.nodeId,n=null==t?void 0:t.placement,i=Number(null==t?void 0:t.targetTime);if(!e||!n||!Number.isFinite(i))return;if(z(w_,this).has(e))return;const{signal:r,controller:o}=B(D_,this,H_).call(this,e);if(r&&r.aborted)B(D_,this,X_).call(this,e,o);else{z(w_,this).add(e);try{const t=z(v_,this)&&"function"==typeof z(v_,this).get?z(v_,this).get(e):void 0;if(!t)return;if("ready"!==t.state&&"function"==typeof t.resolve)try{await t.resolve({signal:r})}catch(t){return}if("ready"!==t.state)return;const s=B(D_,this,cI).call(this,t,n,i);if(!Number.isFinite(s)){const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks.map((t=>null==t?void 0:t.type)).filter(Boolean):[];return void this.log.debug(`[#loadSeekWork] No seek segment offset for node [${e}] targetTime=${i} mainTrackId=${(null==t?void 0:t.mainTrackId)||"n/a"} trackTypes=[${n.join(",")}]`)}"function"==typeof t.loadMediaSegmentsAtOffset?(this.log.debug(`[#loadSeekWork] Loading seek segment for node [${e}] at offset=${s}`),B(D_,this,K_).call(this,e,o,{allowSeekKeep:!0,segmentOffset:s}),await t.loadMediaSegmentsAtOffset(s,{signal:r})):"function"==typeof t.load&&await t.load({loadingMode:"partial",signal:r})}catch(t){$b(t,r)||this.log.warn(`[#loadSeekWork] SegmentLoadCoordinator failed to seek-load node ${e}: ${(null==t?void 0:t.message)||t}`)}finally{z(w_,this).delete(e),B(D_,this,X_).call(this,e,o)}}}function cI(t,e,n){var i;const r=Tv(e);if(!Number.isFinite(r))return;const o=m_(null==e?void 0:e.nodeOffsetOverride),s=Math.max(0,n-r+o),a=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];let l;if(null!=t&&t.mainTrackId){const e=a.find((e=>(null==e?void 0:e.id)===t.mainTrackId));"video"!==(null==e?void 0:e.type)&&"image"!==(null==e?void 0:e.type)||(l=e)}if(l||(l=a.find((t=>"video"===(null==t?void 0:t.type)))||a.find((t=>"image"===(null==t?void 0:t.type)))),!l||!Array.isArray(l.segments))return;const c=l.segments.filter((t=>t&&!t.isInit&&Array.isArray(t.representations)));if(!c.length)return;const u=m_(null===(i=l)||void 0===i?void 0:i.offset),d=Sk(c,Math.max(0,s-u),{preferRepresentationTime:!0}),h=Number(null==d?void 0:d.offset);return Number.isFinite(h)?h:void 0}function uI(t,e,n=(t=>null===(t=z(y_,this))||void 0===t?void 0:t.currentTime)()){var i;const r=(Array.isArray(null===(i=z(y_,this))||void 0===i?void 0:i.placements)?z(y_,this).placements:[]).filter((e=>(null==e?void 0:e.nodeId)===t&&Number.isFinite(Tv(e)))).sort(((t,e)=>Tv(t)-Tv(e)));if(!r.length)return e;const o=Number(n);if(!Number.isFinite(o))return e||r[0];let s,a;for(let t=0;t<r.length;t+=1){const e=r[t],n=Tv(e);if(!Number.isFinite(n))continue;const i=_v(e,z(v_,this)),l=Number.isFinite(i)&&i>=0;(!a&&n>=o-f_&&(a=e),l)?o+f_>=n&&o<n+i-f_&&(s=e):o+f_>=n&&(s=e)}return s||a||r[r.length-1]}function dI(t,e){var n;const i=Number(Tv(e));if(!Number.isFinite(i))return;const r=_v(e,z(v_,this)),o=Number.isFinite(r)&&r>=0?i+r:void 0,s=(Array.isArray(null===(n=z(y_,this))||void 0===n?void 0:n.placements)?z(y_,this).placements:[]).filter((e=>(null==e?void 0:e.nodeId)===t&&Number.isFinite(Tv(e)))).sort(((t,e)=>Tv(t)-Tv(e)));for(let t=0;t<s.length;t+=1){const e=s[t],n=Number(Tv(e));if(Number.isFinite(n)&&!(n<=i+f_)){if(Number.isFinite(o)&&n>o+f_)return;return e}}}function hI(){const t=[];let e=!1,n=1/0;if(z(b_,this).forEach(((i,r)=>{if(!r||!i)return;const o=z(k_,this).get(r);if(o)return e=!0,void(n=Math.min(n,m_(o.timelineStart)));const s=B(D_,this,pI).call(this,r,i);s&&(e=!0,n=Math.min(n,m_(s.timelineStart)),t.push(s))})),!e||!Number.isFinite(n))return{hasPending:!1,waveTime:void 0,startable:[]};const i=t.filter((t=>m_(t.timelineStart)===n&&!z(w_,this).has(t.nodeId))).sort(((t,e)=>{const n=Number.isFinite(null==t?void 0:t.timelineStart)?t.timelineStart:Number.POSITIVE_INFINITY,i=Number.isFinite(null==e?void 0:e.timelineStart)?e.timelineStart:Number.POSITIVE_INFINITY;return n!==i?n-i:String(t.nodeId).localeCompare(String(e.nodeId))}));return{hasPending:!0,waveTime:n,startable:i}}function fI({waveTime:t,startable:e}){const n=Math.max(0,this.settings.maxConcurrentLoads-z(w_,this).size);n&&e.length&&e.slice(0,n).forEach((e=>{B(D_,this,vI).call(this,e,t).finally((()=>{setTimeout((()=>B(D_,this,sI).call(this)),0)}))}))}function pI(t,e){var n,i;const r=z(v_,this)&&"function"==typeof z(v_,this).get?z(v_,this).get(t):void 0;if(!r)return;if("function"==typeof r.hasExceededManifestLoadAttempts&&r.hasExceededManifestLoadAttempts())return void z(b_,this).delete(t);const o=B(D_,this,uI).call(this,t,e,null===(n=z(y_,this))||void 0===n?void 0:n.currentTime),s=Number(Tv(o)),a=m_(null===(i=z(y_,this))||void 0===i?void 0:i.currentTime),l="function"==typeof r.loadMediaSegmentsAtOffset,c="function"==typeof r.load;if(!l&&!c)return void z(b_,this).delete(t);if(r.isLoaded)return void z(b_,this).delete(t);if("ready"!==r.state){if(!Number.isFinite(s))return;return{nodeId:t,segmentOffset:0,timelineStart:s}}if(!B(D_,this,xI).call(this,r))return void z(b_,this).delete(t);const u=Array.isArray(r.tracks)?r.tracks:[],d=u.some((t=>{const e=(Array.isArray(null==t?void 0:t.segments)?t.segments:[]).find((t=>(null==t?void 0:t.isInit)&&Array.isArray(null==t?void 0:t.representations)));return!!e&&!B(D_,this,$_).call(this,e)})),h=new Set;u.forEach((t=>{(Array.isArray(null==t?void 0:t.segments)?t.segments:[]).forEach((t=>{if(!t||t.isInit||!Array.isArray(t.representations))return;const e=Number(t.offset);if(Number.isFinite(e)){const t=Math.round(e/f_)*f_;h.add(t)}}))}));const f=Array.from(h).sort(((t,e)=>t-e)),p=e=>{const n=Number(Tv(e));if(!Number.isFinite(n))return{status:"none"};const i=m_(null==e?void 0:e.nodeOffsetOverride),o=Math.max(0,a-n+i);let s=0;for(let t=0;t<f.length&&f[t]<=o+f_;t+=1)s=t;const l=f.slice(s);if(!l.some((t=>B(D_,this,mI).call(this,r,t))))return{status:f.slice(0,s).some((t=>B(D_,this,mI).call(this,r,t)))?"beforeOnly":"none"};const c=l.find((t=>B(D_,this,mI).call(this,r,t))),u=Math.max(0,m_(c)-i);return{status:"work",work:{nodeId:t,segmentOffset:c,timelineStart:n+u}}},m=p(o);if("work"===m.status)return m.work;if("beforeOnly"!==m.status){if(d&&Number.isFinite(s))return{nodeId:t,segmentOffset:0,timelineStart:s};z(b_,this).delete(t)}else{const e=B(D_,this,dI).call(this,t,o);if(e){const t=p(e);if("work"===t.status)return t.work}}}function mI(t,e){const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[],i=m_(e);return n.some((t=>(Array.isArray(null==t?void 0:t.segments)?t.segments:[]).some((t=>{if(!t||t.isInit||!Array.isArray(t.representations))return!1;const e=Number(t.offset);return Number.isFinite(e)&&Math.abs(e-i)<=f_&&!B(D_,this,$_).call(this,t)}))))}async function vI(t,e){const n=null==t?void 0:t.nodeId,i=null==t?void 0:t.segmentOffset;if(this.log.debug(`[#loadP0Work] Loading ${p_} node [${n}] at segmentOffset=${i} wave=${e}`),!n)return;const r=z(v_,this)&&"function"==typeof z(v_,this).get?z(v_,this).get(n):void 0;if(!r)return void z(b_,this).delete(n);const o="function"==typeof r.loadMediaSegmentsAtOffset&&Number.isFinite(i),{signal:s,controller:a}=B(D_,this,H_).call(this,n,{allowSeekKeep:o,segmentOffset:i});if(s&&s.aborted)B(D_,this,X_).call(this,n,a);else{z(w_,this).add(n),z(k_,this).set(n,{timelineStart:e,segmentOffset:i});try{"function"==typeof r.loadMediaSegmentsAtOffset?await r.loadMediaSegmentsAtOffset(i,{signal:s}):"function"==typeof r.load&&await r.load({loadingMode:"full",signal:s})}catch(t){if($b(t,s))return;const e=`[#loadP0Work] SegmentLoadCoordinator failed to load ${p_} work for node ${n}: ${(null==t?void 0:t.message)||t}`;this.log.warn(e)}finally{this.log.debug(`[#loadP0Work] Finished ${p_} work for node [${n}]`),z(k_,this).delete(n),z(w_,this).delete(n),B(D_,this,X_).call(this,n,a)}}}function gI(){const t=new Set([...z(b_,this).keys(),...z(w_,this)]),e=B(D_,this,yI).call(this),n=Array.isArray(null==e?void 0:e.orderedIds)?e.orderedIds:null,i=Array.isArray(null==e?void 0:e.reachableIds)&&e.reachableIds.length?new Set(e.reachableIds):null,r=t=>!("function"==typeof t.hasExceededManifestLoadAttempts&&t.hasExceededManifestLoadAttempts()||t.isLoaded||"ready"===t.state&&B(D_,this,wI).call(this,t));if(i){const e=yw({prioritizer:z(g_,this),repository:z(v_,this),startNodeId:z(T_,this),prioritizedIds:n,pendingIds:t,allowedIds:i,filter:r});if(e.length)return e}return yw({prioritizer:z(g_,this),repository:z(v_,this),startNodeId:z(T_,this),prioritizedIds:n,pendingIds:t,filter:r})}function yI(){return z(g_,this)&&z(T_,this)?"function"==typeof z(g_,this).getPrioritizationSnapshot?z(g_,this).getPrioritizationSnapshot(z(T_,this)):{orderedIds:"function"==typeof z(g_,this).sortNodes?z(g_,this).sortNodes(z(T_,this)):[],reachableIds:"function"==typeof z(g_,this).getReachableNodeIds?z(g_,this).getReachableNodeIds(z(T_,this)):[]}:null}function bI(){B(D_,this,z_).call(this)||(z(I_,this)||z(b_,this).size)&&(j(x_,this,B(D_,this,gI).call(this)),z(I_,this)&&!z(O_,this)&&B(D_,this,sI).call(this))}async function kI(t,e){if(this.log.debug(`[#loadNode] Loading node [${t}] in '${e}' mode`),!t)return;const n=z(v_,this)&&"function"==typeof z(v_,this).get?z(v_,this).get(t):void 0;if(!n||"function"!=typeof n.load)return;if("function"==typeof n.hasExceededManifestLoadAttempts&&n.hasExceededManifestLoadAttempts())return;if(n.isLoaded)return void this.log.debug(`[#loadNode] Skipping load for ${t}: already loaded`);const{signal:i,controller:r}=B(D_,this,H_).call(this,t,{allowSeekKeep:!1});if(i&&i.aborted)B(D_,this,X_).call(this,t,r);else try{if("ready"!==n.state&&await n.resolve({signal:i}),"ready"!==n.state)return void this.log.debug(`[#loadNode] Skipping load for ${t}: not ready`);if("partial"===e&&B(D_,this,wI).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${t}: partial already loaded`);if(!B(D_,this,xI).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${t}: no loadable tracks`);z(w_,this).add(t),await n.load({loadingMode:e,signal:i})}catch(e){if($b(e,i))return;this.log.warn(`[#loadNode] SegmentLoadCoordinator failed to load node ${t}: ${(null==e?void 0:e.message)||e}`)}finally{this.log.debug(`[#loadNode] Finished loading node [${t}]`),z(w_,this).delete(t),B(D_,this,X_).call(this,t,r)}}function xI(t){return(Array.isArray(t.tracks)?t.tracks:[]).some((t=>{var e;return null==t||null===(e=t.segments)||void 0===e?void 0:e.length}))}function wI(t){const e=(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).filter((t=>Array.isArray(null==t?void 0:t.segments)&&t.segments.length));return!e.length||e.every((t=>{const e=Array.isArray(null==t?void 0:t.segments)?t.segments:[];if(!e.length)return!0;const n=e.find((t=>null==t?void 0:t.isInit)),i=e.find((t=>t&&!t.isInit));return!(n&&!B(D_,this,$_).call(this,n)||i&&!B(D_,this,$_).call(this,i))}))}class _I extends fh{constructor(...t){super(...t),this.track=void 0,this.lastSegment=void 0}get name(){return"BaseDecoder"}configure(t){this.track=t}decode(t){this.lastSegment=t}decodeChunk(t,e){}onDispose(){this.track=void 0,this.lastSegment=void 0}}function II(t){if(!t)throw new Error("Assertion failed.")}const TI=t=>t&&t[t.length-1],EI=t=>{let e=0;for(;0===t.readBits(1)&&e<32;)e++;if(e>=32)throw new Error("Invalid exponential-Golomb code.");return(1<<e)-1+t.readBits(e)},SI=t=>t.constructor===Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t),MI=t=>t.constructor===DataView?t:ArrayBuffer.isView(t)?new DataView(t.buffer,t.byteOffset,t.byteLength):new DataView(t),AI=new TextDecoder,NI=t=>Object.fromEntries(Object.entries(t).map((([t,e])=>[e,t]))),FI={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},CI=NI(FI),OI={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},PI=NI(OI),RI={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},DI=NI(RI),BI=t=>[...t].map((t=>t.toString(16).padStart(2,"0"))).join(""),LI=t=>(t=(t=(t=(t=(t=t>>1&1431655765|(1431655765&t)<<1)>>2&858993459|(858993459&t)<<2)>>4&252645135|(252645135&t)<<4)>>8&16711935|(16711935&t)<<8)>>16&65535|(65535&t)<<16)>>>0,zI=(t,e,n)=>{let i=0,r=t.length-1,o=-1;for(;i<=r;){const s=i+r>>1,a=n(t[s]);a===e?(o=s,r=s-1):a<e?i=s+1:r=s-1}return o},WI=(t,e,n)=>{let i=0,r=t.length-1,o=-1;for(;i<=r;){const s=i+(r-i+1)/2|0;n(t[s])<=e?(o=s,i=s+1):r=s-1}return o},jI=()=>{let t,e;return{promise:new Promise(((n,i)=>{t=n,e=i})),resolve:t,reject:e}},$I=(t,e,n)=>t.getUint8(e)<<16|t.getUint8(e+1)<<8|t.getUint8(e+2),UI=(t,e,n)=>Math.max(e,Math.min(n,t)),qI=/^[a-z]{3}$/,VI=1e6*(1+Number.EPSILON);let GI=null;let HI=null;const KI=()=>{if(null!==HI)return HI;if("undefined"==typeof navigator)return null;const t=/\bChrome\/(\d+)/.exec(navigator.userAgent);return t?HI=Number(t[1]):null},XI=t=>"number"==typeof t&&!Number.isNaN(t);class YI{constructor(t,e){if(this.data=t,this.mimeType=e,!(t instanceof Uint8Array))throw new TypeError("data must be a Uint8Array.");if("string"!=typeof e)throw new TypeError("mimeType must be a string.")}}const QI={default:!0,forced:!1,original:!1,commentary:!1,hearingImpaired:!1,visuallyImpaired:!1};class JI{constructor(t){this.bytes=t,this.pos=0}seekToByte(t){this.pos=8*t}readBit(){var t;const e=Math.floor(this.pos/8),n=null!==(t=this.bytes[e])&&void 0!==t?t:0,i=7-(7&this.pos),r=(n&1<<i)>>i;return this.pos++,r}readBits(t){if(1===t)return this.readBit();let e=0;for(let n=0;n<t;n++)e<<=1,e|=this.readBit();return e}writeBits(t,e){const n=this.pos+t;for(let t=this.pos;t<n;t++){const i=Math.floor(t/8);let r=this.bytes[i];const o=7-(7&t);r&=~(1<<o),r|=(e&1<<n-t-1)>>n-t-1<<o,this.bytes[i]=r}this.pos=n}readAlignedByte(){var t;if(this.pos%8!=0)throw new Error("Bitstream is not byte-aligned.");const e=this.pos/8,n=null!==(t=this.bytes[e])&&void 0!==t?t:0;return this.pos+=8,n}skipBits(t){this.pos+=t}getBitsLeft(){return 8*this.bytes.length-this.pos}clone(){const t=new JI(this.bytes);return t.pos=this.pos,t}}const ZI=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],tT=[-1,1,2,3,4,5,6,8],eT=t=>{if(!t||t.byteLength<2)throw new TypeError("AAC description must be at least 2 bytes long.");const e=new JI(t);let n=e.readBits(5);31===n&&(n=32+e.readBits(6));const i=e.readBits(4);let r=null;15===i?r=e.readBits(24):i<ZI.length&&(r=ZI[i]);const o=e.readBits(4);let s=null;return o>=1&&o<=7&&(s=tT[o]),{objectType:n,frequencyIndex:i,sampleRate:r,channelConfiguration:o,numberOfChannels:s}},nT=["pcm-s16","pcm-s16be","pcm-s24","pcm-s24be","pcm-s32","pcm-s32be","pcm-f32","pcm-f32be","pcm-f64","pcm-f64be","pcm-u8","pcm-s8","ulaw","alaw"],iT=[{maxPictureSize:36864,maxBitrate:2e5,level:10},{maxPictureSize:73728,maxBitrate:8e5,level:11},{maxPictureSize:122880,maxBitrate:18e5,level:20},{maxPictureSize:245760,maxBitrate:36e5,level:21},{maxPictureSize:552960,maxBitrate:72e5,level:30},{maxPictureSize:983040,maxBitrate:12e6,level:31},{maxPictureSize:2228224,maxBitrate:18e6,level:40},{maxPictureSize:2228224,maxBitrate:3e7,level:41},{maxPictureSize:8912896,maxBitrate:6e7,level:50},{maxPictureSize:8912896,maxBitrate:12e7,level:51},{maxPictureSize:8912896,maxBitrate:18e7,level:52},{maxPictureSize:35651584,maxBitrate:18e7,level:60},{maxPictureSize:35651584,maxBitrate:24e7,level:61},{maxPictureSize:35651584,maxBitrate:48e7,level:62}],rT=t=>{const{codec:e,codecDescription:n,colorSpace:i,avcCodecInfo:r,hevcCodecInfo:o,vp9CodecInfo:s,av1CodecInfo:a}=t;if("avc"===e){if(II(null!==t.avcType),r){const e=new Uint8Array([r.avcProfileIndication,r.profileCompatibility,r.avcLevelIndication]);return`avc${t.avcType}.${BI(e)}`}if(!n||n.byteLength<4)throw new TypeError("AVC decoder description is not provided or is not at least 4 bytes long.");return`avc${t.avcType}.${BI(n.subarray(1,4))}`}if("hevc"===e){let t,e,i,r,s,a;if(o)t=o.generalProfileSpace,e=o.generalProfileIdc,i=LI(o.generalProfileCompatibilityFlags),r=o.generalTierFlag,s=o.generalLevelIdc,a=[...o.generalConstraintIndicatorFlags];else{if(!n||n.byteLength<23)throw new TypeError("HEVC decoder description is not provided or is not at least 23 bytes long.");const o=MI(n),l=o.getUint8(1);t=l>>6&3,e=31&l,i=LI(o.getUint32(2)),r=l>>5&1,s=o.getUint8(12),a=[];for(let t=0;t<6;t++)a.push(o.getUint8(6+t))}let l="hev1.";for(l+=["","A","B","C"][t]+e,l+=".",l+=i.toString(16).toUpperCase(),l+=".",l+=0===r?"L":"H",l+=s;a.length>0&&0===a[a.length-1];)a.pop();return a.length>0&&(l+=".",l+=a.map((t=>t.toString(16).toUpperCase())).join(".")),l}if("vp8"===e)return"vp8";if("vp9"===e){if(!s){const e=t.width*t.height;let n=TI(iT).level;for(const t of iT)if(e<=t.maxPictureSize){n=t.level;break}return`vp09.00.${n.toString().padStart(2,"0")}.08`}let e=`vp09.${s.profile.toString().padStart(2,"0")}.${s.level.toString().padStart(2,"0")}.${s.bitDepth.toString().padStart(2,"0")}.${s.chromaSubsampling.toString().padStart(2,"0")}`;return e+=`.${s.colourPrimaries.toString().padStart(2,"0")}.${s.transferCharacteristics.toString().padStart(2,"0")}.${s.matrixCoefficients.toString().padStart(2,"0")}.${s.videoFullRangeFlag.toString().padStart(2,"0")}`,e.endsWith(".01.01.01.01.00")&&(e=e.slice(0,-15)),e}if("av1"===e){if(!a){const e=t.width*t.height;let n=TI(iT).level;for(const t of iT)if(e<=t.maxPictureSize){n=t.level;break}return`av01.0.${n.toString().padStart(2,"0")}M.08`}const e=a.profile,n=a.level.toString().padStart(2,"0"),r=a.tier?"H":"M",o=a.bitDepth.toString().padStart(2,"0"),s=a.monochrome?"1":"0",l=100*a.chromaSubsamplingX+10*a.chromaSubsamplingY+1*(a.chromaSubsamplingX&&a.chromaSubsamplingY?a.chromaSamplePosition:0),c=null!=i&&i.primaries?FI[i.primaries]:1,u=null!=i&&i.transfer?OI[i.transfer]:1,d=null!=i&&i.matrix?RI[i.matrix]:1,h=null!=i&&i.fullRange?1:0;let f=`av01.${e}.${n}${r}.${o}`;return f+=`.${s}.${l.toString().padStart(3,"0")}`,f+=`.${c.toString().padStart(2,"0")}`,f+=`.${u.toString().padStart(2,"0")}`,f+=`.${d.toString().padStart(2,"0")}`,f+=`.${h}`,f.endsWith(".0.110.01.01.01.0")&&(f=f.slice(0,-17)),f}throw new TypeError(`Unhandled codec '${e}'.`)},oT=t=>{const{codec:e,codecDescription:n,aacCodecInfo:i}=t;if("aac"===e){if(!i)throw new TypeError("AAC codec info must be provided.");if(i.isMpeg2)return"mp4a.67";{let t;return t=null!==i.objectType?i.objectType:eT(n).objectType,`mp4a.40.${t}`}}if("mp3"===e)return"mp3";if("opus"===e)return"opus";if("vorbis"===e)return"vorbis";if("flac"===e)return"flac";if("ac3"===e)return"ac-3";if("eac3"===e)return"ec-3";if(e&&nT.includes(e))return e;throw new TypeError(`Unhandled codec '${e}'.`)},sT=/^pcm-([usf])(\d+)+(be)?$/,aT=[48e3,44100,32e3],lT=[24e3,22050,16e3];var cT,uT;!function(t){t[t.NON_IDR_SLICE=1]="NON_IDR_SLICE",t[t.SLICE_DPA=2]="SLICE_DPA",t[t.SLICE_DPB=3]="SLICE_DPB",t[t.SLICE_DPC=4]="SLICE_DPC",t[t.IDR=5]="IDR",t[t.SEI=6]="SEI",t[t.SPS=7]="SPS",t[t.PPS=8]="PPS",t[t.AUD=9]="AUD",t[t.SPS_EXT=13]="SPS_EXT"}(cT||(cT={})),function(t){t[t.RASL_N=8]="RASL_N",t[t.RASL_R=9]="RASL_R",t[t.BLA_W_LP=16]="BLA_W_LP",t[t.RSV_IRAP_VCL23=23]="RSV_IRAP_VCL23",t[t.VPS_NUT=32]="VPS_NUT",t[t.SPS_NUT=33]="SPS_NUT",t[t.PPS_NUT=34]="PPS_NUT",t[t.AUD_NUT=35]="AUD_NUT",t[t.PREFIX_SEI_NUT=39]="PREFIX_SEI_NUT",t[t.SUFFIX_SEI_NUT=40]="SUFFIX_SEI_NUT"}(uT||(uT={}));const dT=function*(t){let e=0,n=-1;for(;e<t.length-2;){const i=t.indexOf(0,e);if(-1===i||i>=t.length-2)break;e=i;let r=0;e+3<t.length&&0===t[e+1]&&0===t[e+2]&&1===t[e+3]?r=4:0===t[e+1]&&1===t[e+2]&&(r=3),0!==r?(-1!==n&&e>n&&(yield{offset:n,length:e-n}),n=e+r,e=n):e++}-1!==n&&n<t.length&&(yield{offset:n,length:t.length-n})},hT=function*(t,e){let n=0;const i=new DataView(t.buffer,t.byteOffset,t.byteLength);for(;n+e<=t.length;){let t;1===e?t=i.getUint8(n):2===e?t=i.getUint16(n,!1):3===e?t=$I(i,n):(II(4===e),t=i.getUint32(n,!1)),n+=e,yield{offset:n,length:t},n+=t}},fT=t=>31&t,pT=t=>{const e=[],n=t.length;for(let i=0;i<n;i++)i+2<n&&0===t[i]&&0===t[i+1]&&3===t[i+2]?(e.push(0,0),i+=2):e.push(t[i]);return new Uint8Array(e)},mT=t=>t>>1&63,vT=function*(t){const e=new JI(t),n=()=>{let t=0;for(let n=0;n<8;n++){const i=e.readAlignedByte();if(t|=(127&i)<<7*n,!(128&i))break;if(7===n&&128&i)return null}return t>=2**32-1?null:t};for(;e.getBitsLeft()>=8;){e.skipBits(1);const i=e.readBits(4),r=e.readBits(1),o=e.readBits(1);let s;if(e.skipBits(1),r&&e.skipBits(8),o){const t=n();if(null===t)return;s=t}else s=Math.floor(e.getBitsLeft()/8);II(e.pos%8==0),yield{type:i,data:t.subarray(e.pos/8,e.pos/8+s)},e.skipBits(8*s)}};var gT;!function(t){t[t.STREAMINFO=0]="STREAMINFO",t[t.VORBIS_COMMENT=4]="VORBIS_COMMENT",t[t.PICTURE=6]="PICTURE"}(gT||(gT={}));const yT=[2,1,2,3,3,4,4,5];class bT{constructor(t){this.input=t}}const kT=[],xT=[],wT=new Uint8Array(0);class _T{constructor(t,e,n,i,r=-1,o,s){if(this.data=t,this.type=e,this.timestamp=n,this.duration=i,this.sequenceNumber=r,t===wT&&void 0===o)throw new Error("Internal error: byteLength must be explicitly provided when constructing metadata-only packets.");if(void 0===o&&(o=t.byteLength),!(t instanceof Uint8Array))throw new TypeError("data must be a Uint8Array.");if("key"!==e&&"delta"!==e)throw new TypeError('type must be either "key" or "delta".');if(!Number.isFinite(n))throw new TypeError("timestamp must be a number.");if(!Number.isFinite(i)||i<0)throw new TypeError("duration must be a non-negative number.");if(!Number.isFinite(r))throw new TypeError("sequenceNumber must be a number.");if(!Number.isInteger(o)||o<0)throw new TypeError("byteLength must be a non-negative integer.");if(void 0!==s&&("object"!=typeof s||!s))throw new TypeError("sideData, when provided, must be an object.");if(void 0!==(null==s?void 0:s.alpha)&&!(s.alpha instanceof Uint8Array))throw new TypeError("sideData.alpha, when provided, must be a Uint8Array.");if(void 0!==(null==s?void 0:s.alphaByteLength)&&(!Number.isInteger(s.alphaByteLength)||s.alphaByteLength<0))throw new TypeError("sideData.alphaByteLength, when provided, must be a non-negative integer.");this.byteLength=o,this.sideData=null!=s?s:{},this.sideData.alpha&&void 0===this.sideData.alphaByteLength&&(this.sideData.alphaByteLength=this.sideData.alpha.byteLength)}get isMetadataOnly(){return this.data===wT}get microsecondTimestamp(){return Math.trunc(VI*this.timestamp)}get microsecondDuration(){return Math.trunc(VI*this.duration)}toEncodedVideoChunk(){if(this.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be converted to a video chunk.");if("undefined"==typeof EncodedVideoChunk)throw new Error("Your browser does not support EncodedVideoChunk.");return new EncodedVideoChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}alphaToEncodedVideoChunk(t=this.type){if(!this.sideData.alpha)throw new TypeError("This packet does not contain alpha side data.");if(this.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be converted to a video chunk.");if("undefined"==typeof EncodedVideoChunk)throw new Error("Your browser does not support EncodedVideoChunk.");return new EncodedVideoChunk({data:this.sideData.alpha,type:t,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}toEncodedAudioChunk(){if(this.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be converted to an audio chunk.");if("undefined"==typeof EncodedAudioChunk)throw new Error("Your browser does not support EncodedAudioChunk.");return new EncodedAudioChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}static fromEncodedChunk(t,e){var n;if(!(t instanceof EncodedVideoChunk||t instanceof EncodedAudioChunk))throw new TypeError("chunk must be an EncodedVideoChunk or EncodedAudioChunk.");const i=new Uint8Array(t.byteLength);return t.copyTo(i),new _T(i,t.type,t.timestamp/1e6,(null!==(n=t.duration)&&void 0!==n?n:0)/1e6,void 0,void 0,e)}clone(t){var e,n,i,r,o,s;if(void 0!==t&&("object"!=typeof t||null===t))throw new TypeError("options, when provided, must be an object.");if(void 0!==(null==t?void 0:t.data)&&!(t.data instanceof Uint8Array))throw new TypeError("options.data, when provided, must be a Uint8Array.");if(void 0!==(null==t?void 0:t.type)&&"key"!==t.type&&"delta"!==t.type)throw new TypeError('options.type, when provided, must be either "key" or "delta".');if(void 0!==(null==t?void 0:t.timestamp)&&!Number.isFinite(t.timestamp))throw new TypeError("options.timestamp, when provided, must be a number.");if(void 0!==(null==t?void 0:t.duration)&&!Number.isFinite(t.duration))throw new TypeError("options.duration, when provided, must be a number.");if(void 0!==(null==t?void 0:t.sequenceNumber)&&!Number.isFinite(t.sequenceNumber))throw new TypeError("options.sequenceNumber, when provided, must be a number.");if(void 0!==(null==t?void 0:t.sideData)&&("object"!=typeof t.sideData||null===t.sideData))throw new TypeError("options.sideData, when provided, must be an object.");return new _T(null!==(e=null==t?void 0:t.data)&&void 0!==e?e:this.data,null!==(n=null==t?void 0:t.type)&&void 0!==n?n:this.type,null!==(i=null==t?void 0:t.timestamp)&&void 0!==i?i:this.timestamp,null!==(r=null==t?void 0:t.duration)&&void 0!==r?r:this.duration,null!==(o=null==t?void 0:t.sequenceNumber)&&void 0!==o?o:this.sequenceNumber,this.byteLength,null!==(s=null==t?void 0:t.sideData)&&void 0!==s?s:this.sideData)}}const IT=t=>{if(!t||"object"!=typeof t)throw new TypeError("options must be an object.");if(void 0!==t.metadataOnly&&"boolean"!=typeof t.metadataOnly)throw new TypeError("options.metadataOnly, when defined, must be a boolean.");if(void 0!==t.verifyKeyPackets&&"boolean"!=typeof t.verifyKeyPackets)throw new TypeError("options.verifyKeyPackets, when defined, must be a boolean.");if(t.verifyKeyPackets&&t.metadataOnly)throw new TypeError("options.verifyKeyPackets and options.metadataOnly cannot be enabled together.")},TT=t=>{if(!XI(t))throw new TypeError("timestamp must be a number.")},ET=(t,e,n)=>n.verifyKeyPackets?e.then((async e=>{if(!e||"delta"===e.type)return e;const n=await t.determinePacketType(e);return n&&(e.type=n),e})):e;class ST{constructor(t){if(!(t instanceof MT))throw new TypeError("track must be an InputTrack.");this._track=t}getFirstPacket(t={}){if(IT(t),this._track.input._disposed)throw new tE;return ET(this._track,this._track._backing.getFirstPacket(t),t)}async getFirstKeyPacket(t={}){IT(t);const e=await this.getFirstPacket(t);return e?"key"===e.type?e:this.getNextKeyPacket(e,t):null}getPacket(t,e={}){if(TT(t),IT(e),this._track.input._disposed)throw new tE;return ET(this._track,this._track._backing.getPacket(t,e),e)}getNextPacket(t,e={}){if(!(t instanceof _T))throw new TypeError("packet must be an EncodedPacket.");if(IT(e),this._track.input._disposed)throw new tE;return ET(this._track,this._track._backing.getNextPacket(t,e),e)}async getKeyPacket(t,e={}){if(TT(t),IT(e),this._track.input._disposed)throw new tE;if(!e.verifyKeyPackets)return this._track._backing.getKeyPacket(t,e);const n=await this._track._backing.getKeyPacket(t,e);return n?(II("key"===n.type),"delta"===await this._track.determinePacketType(n)?this.getKeyPacket(n.timestamp-1/this._track.timeResolution,e):n):n}async getNextKeyPacket(t,e={}){if(!(t instanceof _T))throw new TypeError("packet must be an EncodedPacket.");if(IT(e),this._track.input._disposed)throw new tE;if(!e.verifyKeyPackets)return this._track._backing.getNextKeyPacket(t,e);const n=await this._track._backing.getNextKeyPacket(t,e);return n?(II("key"===n.type),"delta"===await this._track.determinePacketType(n)?this.getNextKeyPacket(n,e):n):n}packets(t,e,n={}){if(void 0!==t&&!(t instanceof _T))throw new TypeError("startPacket must be an EncodedPacket.");if(void 0!==t&&t.isMetadataOnly&&(null==n||!n.metadataOnly))throw new TypeError("startPacket can only be metadata-only if options.metadataOnly is enabled.");if(void 0!==e&&!(e instanceof _T))throw new TypeError("endPacket must be an EncodedPacket.");if(IT(n),this._track.input._disposed)throw new tE;const i=[];let{promise:r,resolve:o}=jI(),{promise:s,resolve:a}=jI(),l=!1,c=!1,u=null;const d=[];(async()=>{let u=null!=t?t:await this.getFirstPacket(n);for(;u&&!c&&!this._track.input._disposed&&!(e&&u.sequenceNumber>=(null==e?void 0:e.sequenceNumber));)i.length>Math.max(2,d.length)?(({promise:s,resolve:a}=jI()),await s):(i.push(u),o(),({promise:r,resolve:o}=jI()),u=await this.getNextPacket(u,n));l=!0,o()})().catch((t=>{u||(u=t,o())}));const h=this._track;return{async next(){for(;;){if(h.input._disposed)throw new tE;if(c)return{value:void 0,done:!0};if(u)throw u;if(i.length>0){const t=i.shift(),e=performance.now();for(d.push(e);d.length>0&&e-d[0]>=1e3;)d.shift();return a(),{value:t,done:!1}}if(l)return{value:void 0,done:!0};await r}},return:async()=>(c=!0,a(),o(),{value:void 0,done:!0}),async throw(t){throw t},[Symbol.asyncIterator](){return this}}}}class MT{constructor(t,e){this.input=t,this._backing=e}isVideoTrack(){return this instanceof AT}isAudioTrack(){return this instanceof NT}get id(){return this._backing.getId()}get number(){return this._backing.getNumber()}get internalCodecId(){return this._backing.getInternalCodecId()}get languageCode(){return this._backing.getLanguageCode()}get name(){return this._backing.getName()}get timeResolution(){return this._backing.getTimeResolution()}get disposition(){return this._backing.getDisposition()}getFirstTimestamp(){return this._backing.getFirstTimestamp()}computeDuration(){return this._backing.computeDuration()}async computePacketStats(t=1/0){const e=new ST(this);let n=1/0,i=-1/0,r=0,o=0;for await(const s of e.packets(void 0,void 0,{metadataOnly:!0})){if(r>=t&&s.timestamp>=i)break;n=Math.min(n,s.timestamp),i=Math.max(i,s.timestamp+s.duration),r++,o+=s.byteLength}return{packetCount:r,averagePacketRate:r?Number((r/(i-n)).toPrecision(16)):0,averageBitrate:r?Number((8*o/(i-n)).toPrecision(16)):0}}}class AT extends MT{constructor(t,e){super(t,e),this._backing=e,this.pixelAspectRatio=(t=>{II(0!==t.den);let e=Math.abs(t.num),n=Math.abs(t.den);for(;0!==n;){const t=e%n;e=n,n=t}const i=e||1;return{num:t.num/i,den:t.den/i}})({num:this._backing.getSquarePixelWidth()*this._backing.getCodedHeight(),den:this._backing.getSquarePixelHeight()*this._backing.getCodedWidth()})}get type(){return"video"}get codec(){return this._backing.getCodec()}get codedWidth(){return this._backing.getCodedWidth()}get codedHeight(){return this._backing.getCodedHeight()}get rotation(){return this._backing.getRotation()}get squarePixelWidth(){return this._backing.getSquarePixelWidth()}get squarePixelHeight(){return this._backing.getSquarePixelHeight()}get displayWidth(){return this._backing.getRotation()%180==0?this.squarePixelWidth:this.squarePixelHeight}get displayHeight(){return this._backing.getRotation()%180==0?this.squarePixelHeight:this.squarePixelWidth}getColorSpace(){return this._backing.getColorSpace()}async hasHighDynamicRange(){const t=await this._backing.getColorSpace();return"bt2020"===t.primaries||"smpte432"===t.primaries||"pg"===t.transfer||"hlg"===t.transfer||"bt2020-ncl"===t.matrix}canBeTransparent(){return this._backing.canBeTransparent()}getDecoderConfig(){return this._backing.getDecoderConfig()}async getCodecParameterString(){var t;const e=await this._backing.getDecoderConfig();return null!==(t=null==e?void 0:e.codec)&&void 0!==t?t:null}async canDecode(){try{const t=await this._backing.getDecoderConfig();if(!t)return!1;const e=this._backing.getCodec();return II(null!==e),kT.some((n=>n.supports(e,t)))?!0:"undefined"!=typeof VideoDecoder&&!0===(await VideoDecoder.isConfigSupported(t)).supported}catch(t){return console.error("Error during decodability check:",t),!1}}async determinePacketType(t){if(!(t instanceof _T))throw new TypeError("packet must be an EncodedPacket.");if(t.isMetadataOnly)throw new TypeError("packet must not be metadata-only to determine its type.");if(null===this.codec)return null;const e=await this.getDecoderConfig();return II(e),((t,e,n)=>{switch(t){case"avc":for(const t of((t,e)=>{if(e.description){const n=3&SI(e.description)[4];return hT(t,n+1)}return dT(t)})(n,e)){const e=n[t.offset],r=fT(e);if(r>=cT.NON_IDR_SLICE&&r<=cT.SLICE_DPC)return"delta";if(r===cT.IDR)return"key";if(r===cT.SEI&&(i=void 0,!(null!==GI?GI:GI=!("undefined"==typeof navigator||(null===(i=navigator.vendor)||void 0===i||!i.includes("Google Inc"))&&!/Chrome/.test(navigator.userAgent)))||KI()>=144)){const e=n.subarray(t.offset,t.offset+t.length),i=pT(e);let r=1;do{let t=0;for(;;){const e=i[r++];if(void 0===e)break;if(t+=e,e<255)break}let e=0;for(;;){const t=i[r++];if(void 0===t)break;if(e+=t,t<255)break}if(6===t){const t=new JI(i);t.pos=8*r;const e=EI(t),n=t.readBits(1);if(0===e&&1===n)return"key"}r+=e}while(r<i.length-1)}}return"delta";case"hevc":for(const t of((t,e)=>{if(e.description){const n=3&SI(e.description)[21];return hT(t,n+1)}return dT(t)})(n,e)){const e=mT(n[t.offset]);if(e<uT.BLA_W_LP)return"delta";if(e<=uT.RSV_IRAP_VCL23)return"key"}return"delta";case"vp8":return 1&n[0]?"delta":"key";case"vp9":{const t=new JI(n);if(2!==t.readBits(2))return null;const e=t.readBits(1);return 3===(t.readBits(1)<<1)+e&&t.skipBits(1),t.readBits(1)?null:0===t.readBits(1)?"key":"delta"}case"av1":{let t=!1;for(const{type:e,data:i}of vT(n))if(1===e){const e=new JI(i);e.skipBits(4),t=!!e.readBits(1)}else if(3===e||6===e||7===e){if(t)return"key";const e=new JI(i);return e.readBits(1)?null:0===e.readBits(2)?"key":"delta"}return null}default:(t=>{throw new Error(`Unexpected value: ${t}`)})(t),II(!1)}var i})(this.codec,e,t.data)}}class NT extends MT{constructor(t,e){super(t,e),this._backing=e}get type(){return"audio"}get codec(){return this._backing.getCodec()}get numberOfChannels(){return this._backing.getNumberOfChannels()}get sampleRate(){return this._backing.getSampleRate()}getDecoderConfig(){return this._backing.getDecoderConfig()}async getCodecParameterString(){var t;const e=await this._backing.getDecoderConfig();return null!==(t=null==e?void 0:e.codec)&&void 0!==t?t:null}async canDecode(){try{const t=await this._backing.getDecoderConfig();if(!t)return!1;const e=this._backing.getCodec();return II(null!==e),xT.some((n=>n.supports(e,t)))?!0:!!t.codec.startsWith("pcm-")||"undefined"!=typeof AudioDecoder&&!0===(await AudioDecoder.isConfigSupported(t)).supported}catch(t){return console.error("Error during decodability check:",t),!1}}async determinePacketType(t){if(!(t instanceof _T))throw new TypeError("packet must be an EncodedPacket.");return null===this.codec?null:"key"}}const FT=t=>{let e=cE(t);const n=pE(t,4);let i=8;1===e&&(e=dE(t),i=16);const r=e-i;return r<0?null:{name:n,totalSize:e,headerSize:i,contentSize:r}},CT=t=>uE(t)/65536,OT=t=>uE(t)/1073741824,PT=t=>{let e=0;for(let n=0;n<4;n++){e<<=7;const n=oE(t);if(e|=127&n,!(128&n))break}return e},RT=t=>{let e=sE(t);return t.skip(2),e=Math.min(e,t.remainingLength),AI.decode(rE(t,e))},DT=t=>{const e=FT(t);if(!e||"data"!==e.name)return null;if(t.remainingLength<8)return null;const n=cE(t);t.skip(4);const i=rE(t,e.contentSize-8);switch(n){case 1:return AI.decode(i);case 2:return new TextDecoder("utf-16be").decode(i);case 13:return new YI(i,"image/jpeg");case 14:return new YI(i,"image/png");case 27:return new YI(i,"image/bmp");default:return i}};class BT extends bT{constructor(t){super(t),this.moovSlice=null,this.currentTrack=null,this.tracks=[],this.metadataPromise=null,this.movieTimescale=-1,this.movieDurationInTimescale=-1,this.isQuickTime=!1,this.metadataTags={},this.currentMetadataKeys=null,this.isFragmented=!1,this.fragmentTrackDefaults=[],this.currentFragment=null,this.lastReadFragment=null,this.reader=t._reader}async computeDuration(){const t=await this.getTracks(),e=await Promise.all(t.map((t=>t.computeDuration())));return Math.max(0,...e)}async getTracks(){return await this.readMetadata(),this.tracks.map((t=>t.inputTrack))}async getMimeType(){await this.readMetadata();const t=await Promise.all(this.tracks.map((t=>t.inputTrack.getCodecParameterString())));return(t=>{let e=(t.hasVideo?"video/":t.hasAudio?"audio/":"application/")+(t.isQuickTime?"quicktime":"mp4");return t.codecStrings.length>0&&(e+=`; codecs="${[...new Set(t.codecStrings)].join(", ")}"`),e})({isQuickTime:this.isQuickTime,hasVideo:this.tracks.some((t=>{var e;return"video"===(null===(e=t.info)||void 0===e?void 0:e.type)})),hasAudio:this.tracks.some((t=>{var e;return"audio"===(null===(e=t.info)||void 0===e?void 0:e.type)})),codecStrings:t.filter(Boolean)})}async getMetadataTags(){return await this.readMetadata(),this.metadataTags}readMetadata(){var t;return null!==(t=this.metadataPromise)&&void 0!==t?t:this.metadataPromise=(async()=>{let t=0;for(;;){let e=this.reader.requestSliceRange(t,8,16);if(e instanceof Promise&&(e=await e),!e)break;const n=t,i=FT(e);if(!i)break;if("ftyp"===i.name){const t=pE(e,4);this.isQuickTime="qt "===t}else if("moov"===i.name){let t=this.reader.requestSlice(e.filePos,i.contentSize);if(t instanceof Promise&&(t=await t),!t)break;this.moovSlice=t,this.readContiguousBoxes(this.moovSlice),this.tracks.sort(((t,e)=>Number(e.disposition.default)-Number(t.disposition.default)));for(const t of this.tracks){const e=t.editListPreviousSegmentDurations/this.movieTimescale;t.editListOffset-=Math.round(e*t.timescale)}break}t=n+i.totalSize}if(this.isFragmented&&null!==this.reader.fileSize){let t=this.reader.requestSlice(this.reader.fileSize-4,4);t instanceof Promise&&(t=await t),II(t);const e=cE(t),n=this.reader.fileSize-e;if(n>=0&&n<=this.reader.fileSize-16){let t=this.reader.requestSliceRange(n,8,16);if(t instanceof Promise&&(t=await t),t){const e=FT(t);if(e&&"mfra"===e.name){let n=this.reader.requestSlice(t.filePos,e.contentSize);n instanceof Promise&&(n=await n),n&&this.readContiguousBoxes(n)}}}}})()}getSampleTableForTrack(t){var e;if(t.sampleTable)return t.sampleTable;const n={sampleTimingEntries:[],sampleCompositionTimeOffsets:[],sampleSizes:[],keySampleIndices:null,chunkOffsets:[],sampleToChunk:[],presentationTimestamps:null,presentationTimestampIndexMap:null};t.sampleTable=n,II(this.moovSlice);const i=this.moovSlice.slice(t.sampleTableByteOffset);if(this.currentTrack=t,this.traverseBox(i),this.currentTrack=null,"audio"===(null===(e=t.info)||void 0===e?void 0:e.type)&&t.info.codec&&nT.includes(t.info.codec)&&0===n.sampleCompositionTimeOffsets.length){var r;II("audio"===(null===(r=t.info)||void 0===r?void 0:r.type));const e=(t=>{if(II(nT.includes(t)),"ulaw"===t)return{dataType:"ulaw",sampleSize:1,littleEndian:!0,silentValue:255};if("alaw"===t)return{dataType:"alaw",sampleSize:1,littleEndian:!0,silentValue:213};const e=sT.exec(t);let n;return II(e),n="u"===e[1]?"unsigned":"s"===e[1]?"signed":"float",{dataType:n,sampleSize:Number(e[2])/8,littleEndian:"be"!==e[3],silentValue:"pcm-u8"===t?128:0}})(t.info.codec),i=[],o=[];for(let r=0;r<n.sampleToChunk.length;r++){const s=n.sampleToChunk[r],a=n.sampleToChunk[r+1],l=(a?a.startChunkIndex:n.chunkOffsets.length)-s.startChunkIndex;for(let r=0;r<l;r++){const a=s.startSampleIndex+r*s.samplesPerChunk,l=a+s.samplesPerChunk,c=WI(n.sampleTimingEntries,a,(t=>t.startIndex)),u=n.sampleTimingEntries[c],d=WI(n.sampleTimingEntries,l,(t=>t.startIndex)),h=n.sampleTimingEntries[d],f=u.startDecodeTimestamp+(a-u.startIndex)*u.delta,p=h.startDecodeTimestamp+(l-h.startIndex)*h.delta-f,m=TI(i);m&&m.delta===p?m.count++:i.push({startIndex:s.startChunkIndex+r,startDecodeTimestamp:f,count:1,delta:p});const v=s.samplesPerChunk*e.sampleSize*t.info.numberOfChannels;o.push(v)}s.startSampleIndex=s.startChunkIndex,s.samplesPerChunk=1}n.sampleTimingEntries=i,n.sampleSizes=o}if(n.sampleCompositionTimeOffsets.length>0){n.presentationTimestamps=[];for(const t of n.sampleTimingEntries)for(let e=0;e<t.count;e++)n.presentationTimestamps.push({presentationTimestamp:t.startDecodeTimestamp+e*t.delta,sampleIndex:t.startIndex+e});for(const t of n.sampleCompositionTimeOffsets)for(let e=0;e<t.count;e++){const i=t.startIndex+e,r=n.presentationTimestamps[i];r&&(r.presentationTimestamp+=t.offset)}n.presentationTimestamps.sort(((t,e)=>t.presentationTimestamp-e.presentationTimestamp)),n.presentationTimestampIndexMap=Array(n.presentationTimestamps.length).fill(-1);for(let t=0;t<n.presentationTimestamps.length;t++)n.presentationTimestampIndexMap[n.presentationTimestamps[t].sampleIndex]=t}return n}async readFragment(t){var e;if((null===(e=this.lastReadFragment)||void 0===e?void 0:e.moofOffset)===t)return this.lastReadFragment;let n=this.reader.requestSliceRange(t,8,16);n instanceof Promise&&(n=await n),II(n);const i=FT(n);II("moof"===(null==i?void 0:i.name));let r=this.reader.requestSlice(t,i.totalSize);r instanceof Promise&&(r=await r),II(r),this.traverseBox(r);const o=this.lastReadFragment;II(o&&o.moofOffset===t);for(const[,t]of o.trackData){const e=t.track,{fragmentPositionCache:n}=e;if(!t.startTimestampIsFinal){const i=e.fragmentLookupTable.find((t=>t.moofOffset===o.moofOffset));if(i)VT(t,i.timestamp);else{const e=WI(n,o.moofOffset-1,(t=>t.moofOffset));if(-1!==e){const i=n[e];VT(t,i.endTimestamp)}}t.startTimestampIsFinal=!0}const i=WI(n,t.startTimestamp,(t=>t.startTimestamp));-1!==i&&n[i].moofOffset===o.moofOffset||n.splice(i+1,0,{moofOffset:o.moofOffset,startTimestamp:t.startTimestamp,endTimestamp:t.endTimestamp})}return o}readContiguousBoxes(t){const e=t.filePos;for(;t.filePos-e<=t.length-8&&this.traverseBox(t););}*iterateContiguousBoxes(t){const e=t.filePos;for(;t.filePos-e<=t.length-8;){const e=t.filePos,n=FT(t);if(!n)break;yield{boxInfo:n,slice:t},t.filePos=e+n.totalSize}}traverseBox(t){var e,n,i,r,o,s,a,l,c,u,d,h,f,p,m,v,g,y,b,k,x,w,_,I,T,E,S,M,A,N,F,C,O,P,R,D;const B=t.filePos,L=FT(t);if(!L)return!1;const z=t.filePos,W=B+L.totalSize;switch(L.name){case"mdia":case"minf":case"dinf":case"mfra":case"edts":case"wave":this.readContiguousBoxes(t.slice(z,L.contentSize));break;case"mvhd":{const e=oE(t);t.skip(3),1===e?(t.skip(16),this.movieTimescale=cE(t),this.movieDurationInTimescale=dE(t)):(t.skip(8),this.movieTimescale=cE(t),this.movieDurationInTimescale=cE(t))}break;case"trak":{const e={id:-1,demuxer:this,inputTrack:null,disposition:{...QI},info:null,timescale:-1,durationInMovieTimescale:-1,durationInMediaTimescale:-1,rotation:0,internalCodecId:null,name:null,languageCode:"und",sampleTableByteOffset:-1,sampleTable:null,fragmentLookupTable:[],currentFragmentState:null,fragmentPositionCache:[],editListPreviousSegmentDurations:0,editListOffset:0};if(this.currentTrack=e,this.readContiguousBoxes(t.slice(z,L.contentSize)),-1!==e.id&&-1!==e.timescale&&null!==e.info)if("video"===e.info.type&&-1!==e.info.width){const t=e;e.inputTrack=new AT(this.input,new zT(t)),this.tracks.push(e)}else if("audio"===e.info.type&&-1!==e.info.numberOfChannels){const t=e;e.inputTrack=new NT(this.input,new WT(t)),this.tracks.push(e)}this.currentTrack=null}break;case"tkhd":{const e=this.currentTrack;if(!e)break;const n=oE(t),i=!!(1&aE(t));if(e.disposition.default=i,0===n)t.skip(8),e.id=cE(t),t.skip(4),e.durationInMovieTimescale=cE(t);else{if(1!==n)throw new Error(`Incorrect track header version ${n}.`);t.skip(16),e.id=cE(t),t.skip(4),e.durationInMovieTimescale=dE(t)}t.skip(16);const r=[CT(t),CT(t),OT(t),CT(t),CT(t),OT(t),CT(t),CT(t),OT(t)],o=(t=>{const e=(t%360+360)%360;if(0===e||90===e||180===e||270===e)return e;throw new Error(`Invalid rotation ${t}.`)})((Ct=GT(r),90*Math.round(Ct/90)));II(0===o||90===o||180===o||270===o),e.rotation=o}break;case"elst":{const e=this.currentTrack;if(!e)break;const n=oE(t);t.skip(3);let i=!1,r=0;const o=cE(t);for(let s=0;s<o;s++){const o=1===n?dE(t):cE(t),s=1===n?hE(t):uE(t),a=CT(t);if(0!==o){if(i){console.warn("Unsupported edit list: multiple edits are not currently supported. Only using first edit.");break}if(-1!==s){if(1!==a){console.warn("Unsupported edit list entry: media rate must be 1.");break}e.editListPreviousSegmentDurations=r,e.editListOffset=s,i=!0}else r+=o}}}break;case"mdhd":{const e=this.currentTrack;if(!e)break;const n=oE(t);t.skip(3),0===n?(t.skip(8),e.timescale=cE(t),e.durationInMediaTimescale=cE(t)):1===n&&(t.skip(16),e.timescale=cE(t),e.durationInMediaTimescale=dE(t));let i=sE(t);if(i>0){e.languageCode="";for(let t=0;t<3;t++)e.languageCode=String.fromCharCode(96+(31&i))+e.languageCode,i>>=5;Ft=e.languageCode,qI.test(Ft)||(e.languageCode="und")}}break;case"hdlr":{const e=this.currentTrack;if(!e)break;t.skip(8);const n=pE(t,4);"vide"===n?e.info={type:"video",width:-1,height:-1,squarePixelWidth:-1,squarePixelHeight:-1,codec:null,codecDescription:null,colorSpace:null,avcType:null,avcCodecInfo:null,hevcCodecInfo:null,vp9CodecInfo:null,av1CodecInfo:null}:"soun"===n&&(e.info={type:"audio",numberOfChannels:-1,sampleRate:-1,codec:null,codecDescription:null,aacCodecInfo:null})}break;case"stbl":{const e=this.currentTrack;if(!e)break;e.sampleTableByteOffset=B,this.readContiguousBoxes(t.slice(z,L.contentSize))}break;case"stsd":{const e=this.currentTrack;if(!e)break;if(null===e.info||e.sampleTable)break;const n=oE(t);t.skip(3);const i=cE(t);for(let r=0;r<i;r++){const i=t.filePos,r=FT(t);if(!r)break;e.internalCodecId=r.name;const o=r.name.toLowerCase();if("video"===e.info.type)"avc1"===o||"avc3"===o?(e.info.codec="avc",e.info.avcType="avc1"===o?1:3):"hvc1"===o||"hev1"===o?e.info.codec="hevc":"vp08"===o?e.info.codec="vp8":"vp09"===o?e.info.codec="vp9":"av01"===o?e.info.codec="av1":console.warn(`Unsupported video codec (sample entry type '${r.name}').`),t.skip(24),e.info.width=sE(t),e.info.height=sE(t),e.info.squarePixelWidth=e.info.width,e.info.squarePixelHeight=e.info.height,t.skip(50),this.readContiguousBoxes(t.slice(t.filePos,i+r.totalSize-t.filePos));else{"mp4a"===o||("opus"===o?e.info.codec="opus":"flac"===o?e.info.codec="flac":"twos"===o||"sowt"===o||"raw "===o||"in24"===o||"in32"===o||"fl32"===o||"fl64"===o||"lpcm"===o||"ipcm"===o||"fpcm"===o||("ulaw"===o?e.info.codec="ulaw":"alaw"===o?e.info.codec="alaw":"ac-3"===o?e.info.codec="ac3":"ec-3"===o?e.info.codec="eac3":console.warn(`Unsupported audio codec (sample entry type '${r.name}').`))),t.skip(8);const s=sE(t);t.skip(6);let a=sE(t),l=sE(t);t.skip(4);let c=cE(t)/65536;if(0===n&&s>0)if(1===s)t.skip(4),l=8*cE(t),t.skip(8);else if(2===s){t.skip(4),c=fE(t),a=cE(t),t.skip(4),l=cE(t);const n=cE(t);if(t.skip(8),"lpcm"===o){const t=l+7>>3,i=Boolean(1&n),r=Boolean(2&n),o=4&n?-1:0;l>0&&l<=64&&(i?32===l&&(e.info.codec=r?"pcm-f32be":"pcm-f32"):o&1<<t-1?1===t?e.info.codec="pcm-s8":2===t?e.info.codec=r?"pcm-s16be":"pcm-s16":3===t?e.info.codec=r?"pcm-s24be":"pcm-s24":4===t&&(e.info.codec=r?"pcm-s32be":"pcm-s32"):1===t&&(e.info.codec="pcm-u8")),null===e.info.codec&&console.warn("Unsupported PCM format.")}}"opus"===e.info.codec&&(c=48e3),e.info.numberOfChannels=a,e.info.sampleRate=c,"twos"===o?8===l?e.info.codec="pcm-s8":16===l?e.info.codec="pcm-s16be":(console.warn(`Unsupported sample size ${l} for codec 'twos'.`),e.info.codec=null):"sowt"===o?8===l?e.info.codec="pcm-s8":16===l?e.info.codec="pcm-s16":(console.warn(`Unsupported sample size ${l} for codec 'sowt'.`),e.info.codec=null):"raw "===o?e.info.codec="pcm-u8":"in24"===o?e.info.codec="pcm-s24be":"in32"===o?e.info.codec="pcm-s32be":"fl32"===o?e.info.codec="pcm-f32be":"fl64"===o?e.info.codec="pcm-f64be":"ipcm"===o?e.info.codec="pcm-s16be":"fpcm"===o&&(e.info.codec="pcm-f32be"),this.readContiguousBoxes(t.slice(t.filePos,i+r.totalSize-t.filePos))}}}break;case"avcC":{const e=this.currentTrack;if(!e)break;II(e.info),e.info.codecDescription=rE(t,L.contentSize)}break;case"hvcC":{const e=this.currentTrack;if(!e)break;II(e.info),e.info.codecDescription=rE(t,L.contentSize)}break;case"vpcC":{var j;const e=this.currentTrack;if(!e)break;II("video"===(null===(j=e.info)||void 0===j?void 0:j.type)),t.skip(4);const n=oE(t),i=oE(t),r=oE(t),o=r>>4,s=r>>1&7,a=1&r,l=oE(t),c=oE(t),u=oE(t);e.info.vp9CodecInfo={profile:n,level:i,bitDepth:o,chromaSubsampling:s,videoFullRangeFlag:a,colourPrimaries:l,transferCharacteristics:c,matrixCoefficients:u}}break;case"av1C":{var $;const e=this.currentTrack;if(!e)break;II("video"===(null===($=e.info)||void 0===$?void 0:$.type)),t.skip(1);const n=oE(t),i=n>>5,r=31&n,o=oE(t),s=o>>7,a=o>>6&1,l=o>>4&1,c=o>>3&1,u=o>>2&1,d=3&o,h=2===i&&a?o>>5&1?12:10:a?10:8;e.info.av1CodecInfo={profile:i,level:r,tier:s,bitDepth:h,monochrome:l,chromaSubsamplingX:c,chromaSubsamplingY:u,chromaSamplePosition:d}}break;case"colr":{var U;const e=this.currentTrack;if(!e)break;if(II("video"===(null===(U=e.info)||void 0===U?void 0:U.type)),"nclx"!==pE(t,4))break;const n=sE(t),i=sE(t),r=sE(t),o=Boolean(128&oE(t));e.info.colorSpace={primaries:CI[n],transfer:PI[i],matrix:DI[r],fullRange:o}}break;case"pasp":{var q;const e=this.currentTrack;if(!e)break;II("video"===(null===(q=e.info)||void 0===q?void 0:q.type));const n=cE(t),i=cE(t);n>i?e.info.squarePixelWidth=Math.round(e.info.width*n/i):e.info.squarePixelHeight=Math.round(e.info.height*i/n)}break;case"esds":{var V;const e=this.currentTrack;if(!e)break;II("audio"===(null===(V=e.info)||void 0===V?void 0:V.type)),t.skip(4),II(3===oE(t)),PT(t),t.skip(2);const n=oE(t),i=!!(64&n),r=!!(32&n);if(!!(128&n)&&t.skip(2),i){const e=oE(t);t.skip(e)}r&&t.skip(2),II(4===oE(t));const o=PT(t),s=t.filePos,a=oE(t);if(64===a||103===a?(e.info.codec="aac",e.info.aacCodecInfo={isMpeg2:103===a,objectType:null}):105===a||107===a?e.info.codec="mp3":221===a?e.info.codec="vorbis":console.warn(`Unsupported audio codec (objectTypeIndication ${a}) - discarding track.`),t.skip(12),o>t.filePos-s){II(5===oE(t));const n=PT(t);if(e.info.codecDescription=rE(t,n),"aac"===e.info.codec){const t=eT(e.info.codecDescription);null!==t.numberOfChannels&&(e.info.numberOfChannels=t.numberOfChannels),null!==t.sampleRate&&(e.info.sampleRate=t.sampleRate)}}}break;case"enda":{var G;const e=this.currentTrack;if(!e)break;II("audio"===(null===(G=e.info)||void 0===G?void 0:G.type)),255&sE(t)&&("pcm-s16be"===e.info.codec?e.info.codec="pcm-s16":"pcm-s24be"===e.info.codec?e.info.codec="pcm-s24":"pcm-s32be"===e.info.codec?e.info.codec="pcm-s32":"pcm-f32be"===e.info.codec?e.info.codec="pcm-f32":"pcm-f64be"===e.info.codec&&(e.info.codec="pcm-f64"))}break;case"pcmC":{var H;const e=this.currentTrack;if(!e)break;II("audio"===(null===(H=e.info)||void 0===H?void 0:H.type)),t.skip(4);const n=oE(t),i=Boolean(1&n),r=oE(t);"pcm-s16be"===e.info.codec?i?16===r?e.info.codec="pcm-s16":24===r?e.info.codec="pcm-s24":32===r?e.info.codec="pcm-s32":(console.warn(`Invalid ipcm sample size ${r}.`),e.info.codec=null):16===r?e.info.codec="pcm-s16be":24===r?e.info.codec="pcm-s24be":32===r?e.info.codec="pcm-s32be":(console.warn(`Invalid ipcm sample size ${r}.`),e.info.codec=null):"pcm-f32be"===e.info.codec&&(i?32===r?e.info.codec="pcm-f32":64===r?e.info.codec="pcm-f64":(console.warn(`Invalid fpcm sample size ${r}.`),e.info.codec=null):32===r?e.info.codec="pcm-f32be":64===r?e.info.codec="pcm-f64be":(console.warn(`Invalid fpcm sample size ${r}.`),e.info.codec=null));break}case"dOps":{var K;const e=this.currentTrack;if(!e)break;II("audio"===(null===(K=e.info)||void 0===K?void 0:K.type)),t.skip(1);const n=oE(t),i=sE(t),r=cE(t),o=lE(t),s=oE(t);let a;a=0!==s?rE(t,2+n):new Uint8Array(0);const l=new Uint8Array(19+a.byteLength),c=new DataView(l.buffer);c.setUint32(0,1332770163,!1),c.setUint32(4,1214603620,!1),c.setUint8(8,1),c.setUint8(9,n),c.setUint16(10,i,!0),c.setUint32(12,r,!0),c.setInt16(16,o,!0),c.setUint8(18,s),l.set(a,19),e.info.codecDescription=l,e.info.numberOfChannels=n}break;case"dfLa":{var X;const e=this.currentTrack;if(!e)break;II("audio"===(null===(X=e.info)||void 0===X?void 0:X.type)),t.skip(4);const n=127,i=128,r=t.filePos;for(;t.filePos<W;){const r=oE(t),o=aE(t);if((r&n)===gT.STREAMINFO){t.skip(10);const n=cE(t),i=n>>>12,r=1+(n>>9&7);e.info.sampleRate=i,e.info.numberOfChannels=r,t.skip(20)}else t.skip(o);if(r&i)break}const o=t.filePos;t.filePos=r;const s=rE(t,o-r),a=new Uint8Array(4+s.byteLength);new DataView(a.buffer).setUint32(0,1716281667,!1),a.set(s,4),e.info.codecDescription=a}break;case"dac3":{var Y;const e=this.currentTrack;if(!e)break;II("audio"===(null===(Y=e.info)||void 0===Y?void 0:Y.type));const n=rE(t,3),i=new JI(n),r=i.readBits(2);i.skipBits(8);const o=i.readBits(3),s=i.readBits(1);r<3&&(e.info.sampleRate=aT[r]),e.info.numberOfChannels=yT[o]+s}break;case"dec3":{var Q;const e=this.currentTrack;if(!e)break;II("audio"===(null===(Q=e.info)||void 0===Q?void 0:Q.type));const n=(t=>{if(t.length<2)return null;const e=new JI(t),n=e.readBits(13),i=e.readBits(3),r=[];for(let n=0;n<=i&&!(Math.ceil(e.pos/8)+3>t.length);n++){const t=e.readBits(2),n=e.readBits(5);e.skipBits(1),e.skipBits(1);const i=e.readBits(3),o=e.readBits(3),s=e.readBits(1);e.skipBits(3);const a=e.readBits(4);let l=0;a>0?l=e.readBits(9):e.skipBits(1),r.push({fscod:t,fscod2:null,bsid:n,bsmod:i,acmod:o,lfeon:s,numDepSub:a,chanLoc:l})}return 0===r.length?null:{dataRate:n,substreams:r}})(rE(t,L.contentSize));if(!n){console.warn("Invalid dec3 box contents, ignoring.");break}const i=(t=>{const e=t.substreams[0];return II(e),e.fscod<3?aT[e.fscod]:null!==e.fscod2&&e.fscod2<3?lT[e.fscod2]:null})(n);null!==i&&(e.info.sampleRate=i),e.info.numberOfChannels=(t=>{const e=t.substreams[0];II(e);let n=yT[e.acmod]+e.lfeon;if(e.numDepSub>0){const t=[2,2,1,1,2,2,2,1,1];for(let i=0;i<9;i++)e.chanLoc&1<<8-i&&(n+=t[i])}return n})(n)}break;case"stts":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4);const n=cE(t);let i=0,r=0;for(let o=0;o<n;o++){const n=cE(t),o=cE(t);e.sampleTable.sampleTimingEntries.push({startIndex:i,startDecodeTimestamp:r,count:n,delta:o}),i+=n,r+=n*o}}break;case"ctts":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4);const n=cE(t);let i=0;for(let r=0;r<n;r++){const n=cE(t),r=uE(t);e.sampleTable.sampleCompositionTimeOffsets.push({startIndex:i,count:n,offset:r}),i+=n}}break;case"stsz":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4);const n=cE(t),i=cE(t);if(0===n)for(let n=0;n<i;n++){const n=cE(t);e.sampleTable.sampleSizes.push(n)}else e.sampleTable.sampleSizes.push(n)}break;case"stz2":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4),t.skip(3);const n=oE(t),i=cE(t),r=rE(t,Math.ceil(i*n/8)),o=new JI(r);for(let t=0;t<i;t++){const t=o.readBits(n);e.sampleTable.sampleSizes.push(t)}}break;case"stss":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4),e.sampleTable.keySampleIndices=[];const n=cE(t);for(let i=0;i<n;i++){const n=cE(t)-1;e.sampleTable.keySampleIndices.push(n)}0!==e.sampleTable.keySampleIndices[0]&&e.sampleTable.keySampleIndices.unshift(0)}break;case"stsc":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4);const n=cE(t);for(let i=0;i<n;i++){const n=cE(t)-1,i=cE(t),r=cE(t);e.sampleTable.sampleToChunk.push({startSampleIndex:-1,startChunkIndex:n,samplesPerChunk:i,sampleDescriptionIndex:r})}let i=0;for(let t=0;t<e.sampleTable.sampleToChunk.length;t++)e.sampleTable.sampleToChunk[t].startSampleIndex=i,t<e.sampleTable.sampleToChunk.length-1&&(i+=(e.sampleTable.sampleToChunk[t+1].startChunkIndex-e.sampleTable.sampleToChunk[t].startChunkIndex)*e.sampleTable.sampleToChunk[t].samplesPerChunk)}break;case"stco":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4);const n=cE(t);for(let i=0;i<n;i++){const n=cE(t);e.sampleTable.chunkOffsets.push(n)}}break;case"co64":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4);const n=cE(t);for(let i=0;i<n;i++){const n=dE(t);e.sampleTable.chunkOffsets.push(n)}}break;case"mvex":this.isFragmented=!0,this.readContiguousBoxes(t.slice(z,L.contentSize));break;case"mehd":{const e=oE(t);t.skip(3);const n=1===e?dE(t):cE(t);this.movieDurationInTimescale=n}break;case"trex":{t.skip(4);const e=cE(t),n=cE(t),i=cE(t),r=cE(t),o=cE(t);this.fragmentTrackDefaults.push({trackId:e,defaultSampleDescriptionIndex:n,defaultSampleDuration:i,defaultSampleSize:r,defaultSampleFlags:o})}break;case"tfra":{const e=oE(t);t.skip(3);const n=cE(t),i=this.tracks.find((t=>t.id===n));if(!i)break;const r=cE(t),o=(12&r)>>2,s=3&r,a=[oE,sE,aE,cE],l=a[(48&r)>>4],c=a[o],u=a[s],d=cE(t);for(let n=0;n<d;n++){const n=1===e?dE(t):cE(t),r=1===e?dE(t):cE(t);l(t),c(t),u(t),i.fragmentLookupTable.push({timestamp:n,moofOffset:r})}i.fragmentLookupTable.sort(((t,e)=>t.timestamp-e.timestamp));for(let t=0;t<i.fragmentLookupTable.length-1;t++){const e=i.fragmentLookupTable[t],n=i.fragmentLookupTable[t+1];e.timestamp===n.timestamp&&(i.fragmentLookupTable.splice(t+1,1),t--)}}break;case"moof":this.currentFragment={moofOffset:B,moofSize:L.totalSize,implicitBaseDataOffset:B,trackData:new Map},this.readContiguousBoxes(t.slice(z,L.contentSize)),this.lastReadFragment=this.currentFragment,this.currentFragment=null;break;case"traf":if(II(this.currentFragment),this.readContiguousBoxes(t.slice(z,L.contentSize)),this.currentTrack){const t=this.currentFragment.trackData.get(this.currentTrack.id);if(t){const{currentFragmentState:e}=this.currentTrack;II(e),null!==e.startTimestamp&&(VT(t,e.startTimestamp),t.startTimestampIsFinal=!0)}this.currentTrack.currentFragmentState=null,this.currentTrack=null}break;case"tfhd":{var J,Z,tt,et;II(this.currentFragment),t.skip(1);const e=aE(t),n=Boolean(1&e),i=Boolean(2&e),r=Boolean(8&e),o=Boolean(16&e),s=Boolean(32&e),a=Boolean(65536&e),l=Boolean(131072&e),c=cE(t),u=this.tracks.find((t=>t.id===c));if(!u)break;const d=this.fragmentTrackDefaults.find((t=>t.trackId===c));this.currentTrack=u,u.currentFragmentState={baseDataOffset:this.currentFragment.implicitBaseDataOffset,sampleDescriptionIndex:null!==(J=null==d?void 0:d.defaultSampleDescriptionIndex)&&void 0!==J?J:null,defaultSampleDuration:null!==(Z=null==d?void 0:d.defaultSampleDuration)&&void 0!==Z?Z:null,defaultSampleSize:null!==(tt=null==d?void 0:d.defaultSampleSize)&&void 0!==tt?tt:null,defaultSampleFlags:null!==(et=null==d?void 0:d.defaultSampleFlags)&&void 0!==et?et:null,startTimestamp:null},n?u.currentFragmentState.baseDataOffset=dE(t):l&&(u.currentFragmentState.baseDataOffset=this.currentFragment.moofOffset),i&&(u.currentFragmentState.sampleDescriptionIndex=cE(t)),r&&(u.currentFragmentState.defaultSampleDuration=cE(t)),o&&(u.currentFragmentState.defaultSampleSize=cE(t)),s&&(u.currentFragmentState.defaultSampleFlags=cE(t)),a&&(u.currentFragmentState.defaultSampleDuration=0)}break;case"tfdt":{const e=this.currentTrack;if(!e)break;II(e.currentFragmentState);const n=oE(t);t.skip(3);const i=0===n?cE(t):dE(t);e.currentFragmentState.startTimestamp=i}break;case"trun":{const e=this.currentTrack;if(!e)break;if(II(this.currentFragment),II(e.currentFragmentState),this.currentFragment.trackData.has(e.id)){console.warn("Can't have two trun boxes for the same track in one fragment. Ignoring...");break}const n=oE(t),i=aE(t),r=Boolean(1&i),o=Boolean(4&i),s=Boolean(256&i),a=Boolean(512&i),l=Boolean(1024&i),c=Boolean(2048&i),u=cE(t);let d=e.currentFragmentState.baseDataOffset;r&&(d+=uE(t));let h=null;o&&(h=cE(t));let f=d;if(0===u){this.currentFragment.implicitBaseDataOffset=f;break}let p=0;const m={track:e,startTimestamp:0,endTimestamp:0,firstKeyFrameTimestamp:null,samples:[],presentationTimestamps:[],startTimestampIsFinal:!1};this.currentFragment.trackData.set(e.id,m);for(let i=0;i<u;i++){let r,o,u;s?r=cE(t):(II(null!==e.currentFragmentState.defaultSampleDuration),r=e.currentFragmentState.defaultSampleDuration),a?o=cE(t):(II(null!==e.currentFragmentState.defaultSampleSize),o=e.currentFragmentState.defaultSampleSize),l?u=cE(t):(II(null!==e.currentFragmentState.defaultSampleFlags),u=e.currentFragmentState.defaultSampleFlags),0===i&&null!==h&&(u=h);let d=0;c&&(d=0===n?cE(t):uE(t));const v=!(65536&u);m.samples.push({presentationTimestamp:p+d,duration:r,byteOffset:f,byteSize:o,isKeyFrame:v}),f+=o,p+=r}m.presentationTimestamps=m.samples.map(((t,e)=>({presentationTimestamp:t.presentationTimestamp,sampleIndex:e}))).sort(((t,e)=>t.presentationTimestamp-e.presentationTimestamp));for(let t=0;t<m.presentationTimestamps.length;t++){const e=m.presentationTimestamps[t],n=m.samples[e.sampleIndex];if(null===m.firstKeyFrameTimestamp&&n.isKeyFrame&&(m.firstKeyFrameTimestamp=n.presentationTimestamp),t<m.presentationTimestamps.length-1){const i=m.presentationTimestamps[t+1];n.duration=i.presentationTimestamp-e.presentationTimestamp}}const v=m.samples[m.presentationTimestamps[0].sampleIndex],g=m.samples[TI(m.presentationTimestamps).sampleIndex];m.startTimestamp=v.presentationTimestamp,m.endTimestamp=g.presentationTimestamp+g.duration,this.currentFragment.implicitBaseDataOffset=f}break;case"udta":{const g=this.iterateContiguousBoxes(t.slice(z,L.contentSize));for(const{boxInfo:t,slice:y}of g){if("meta"!==t.name&&!this.currentTrack){var nt,it,rt,ot,st,at,lt,ct;const e=y.filePos;null!==(it=(nt=this.metadataTags).raw)&&void 0!==it||(nt.raw={}),"©"===t.name[0]?null!==(st=(rt=this.metadataTags.raw)[ot=t.name])&&void 0!==st||(rt[ot]=RT(y)):null!==(ct=(at=this.metadataTags.raw)[lt=t.name])&&void 0!==ct||(at[lt]=rE(y,t.contentSize)),y.filePos=e}switch(t.name){case"meta":y.skip(-t.headerSize),this.traverseBox(y);break;case"©nam":case"name":this.currentTrack?this.currentTrack.name=AI.decode(rE(y,t.contentSize)):null!==(n=(e=this.metadataTags).title)&&void 0!==n||(e.title=RT(y));break;case"©des":this.currentTrack||null!==(r=(i=this.metadataTags).description)&&void 0!==r||(i.description=RT(y));break;case"©ART":this.currentTrack||null!==(s=(o=this.metadataTags).artist)&&void 0!==s||(o.artist=RT(y));break;case"©alb":this.currentTrack||null!==(l=(a=this.metadataTags).album)&&void 0!==l||(a.album=RT(y));break;case"albr":this.currentTrack||null!==(u=(c=this.metadataTags).albumArtist)&&void 0!==u||(c.albumArtist=RT(y));break;case"©gen":this.currentTrack||null!==(h=(d=this.metadataTags).genre)&&void 0!==h||(d.genre=RT(y));break;case"©day":if(!this.currentTrack){var ut,dt;const t=new Date(RT(y));Number.isNaN(t.getTime())||null!==(dt=(ut=this.metadataTags).date)&&void 0!==dt||(ut.date=t)}break;case"©cmt":this.currentTrack||null!==(p=(f=this.metadataTags).comment)&&void 0!==p||(f.comment=RT(y));break;case"©lyr":this.currentTrack||null!==(v=(m=this.metadataTags).lyrics)&&void 0!==v||(m.lyrics=RT(y))}}}break;case"meta":{if(this.currentTrack)break;const e=0!==cE(t);this.currentMetadataKeys=new Map,e?this.readContiguousBoxes(t.slice(z,L.contentSize)):this.readContiguousBoxes(t.slice(z+4,L.contentSize-4)),this.currentMetadataKeys=null}break;case"keys":{if(!this.currentMetadataKeys)break;t.skip(4);const e=cE(t);for(let n=0;n<e;n++){const e=cE(t);t.skip(4);const i=AI.decode(rE(t,e-8));this.currentMetadataKeys.set(n+1,i)}}break;case"ilst":{if(!this.currentMetadataKeys)break;const e=this.iterateContiguousBoxes(t.slice(z,L.contentSize));for(const{boxInfo:t,slice:n}of e){var ht,ft,pt,mt,vt;let e=t.name;const i=(e.charCodeAt(0)<<24)+(e.charCodeAt(1)<<16)+(e.charCodeAt(2)<<8)+e.charCodeAt(3);this.currentMetadataKeys.has(i)&&(e=this.currentMetadataKeys.get(i));const r=DT(n);switch(null!==(ft=(ht=this.metadataTags).raw)&&void 0!==ft||(ht.raw={}),null!==(vt=(pt=this.metadataTags.raw)[mt=e])&&void 0!==vt||(pt[mt]=r),e){case"©nam":case"titl":case"com.apple.quicktime.title":case"title":"string"==typeof r&&(null!==(y=(g=this.metadataTags).title)&&void 0!==y||(g.title=r));break;case"©des":case"desc":case"dscp":case"com.apple.quicktime.description":case"description":"string"==typeof r&&(null!==(k=(b=this.metadataTags).description)&&void 0!==k||(b.description=r));break;case"©ART":case"com.apple.quicktime.artist":case"artist":"string"==typeof r&&(null!==(w=(x=this.metadataTags).artist)&&void 0!==w||(x.artist=r));break;case"©alb":case"albm":case"com.apple.quicktime.album":case"album":"string"==typeof r&&(null!==(I=(_=this.metadataTags).album)&&void 0!==I||(_.album=r));break;case"aART":case"album_artist":"string"==typeof r&&(null!==(E=(T=this.metadataTags).albumArtist)&&void 0!==E||(T.albumArtist=r));break;case"©cmt":case"com.apple.quicktime.comment":case"comment":"string"==typeof r&&(null!==(M=(S=this.metadataTags).comment)&&void 0!==M||(S.comment=r));break;case"©gen":case"gnre":case"com.apple.quicktime.genre":case"genre":"string"==typeof r&&(null!==(N=(A=this.metadataTags).genre)&&void 0!==N||(A.genre=r));break;case"©lyr":case"lyrics":"string"==typeof r&&(null!==(C=(F=this.metadataTags).lyrics)&&void 0!==C||(F.lyrics=r));break;case"©day":case"rldt":case"com.apple.quicktime.creationdate":case"date":if("string"==typeof r){var gt,yt;const t=new Date(r);Number.isNaN(t.getTime())||null!==(yt=(gt=this.metadataTags).date)&&void 0!==yt||(gt.date=t)}break;case"covr":case"com.apple.quicktime.artwork":r instanceof YI?(null!==(P=(O=this.metadataTags).images)&&void 0!==P||(O.images=[]),this.metadataTags.images.push({data:r.data,kind:"coverFront",mimeType:r.mimeType})):r instanceof Uint8Array&&(null!==(D=(R=this.metadataTags).images)&&void 0!==D||(R.images=[]),this.metadataTags.images.push({data:r,kind:"coverFront",mimeType:"image/*"}));break;case"track":if("string"==typeof r){var bt,kt,xt,wt;const t=r.split("/"),e=Number.parseInt(t[0],10),n=t[1]&&Number.parseInt(t[1],10);Number.isInteger(e)&&e>0&&(null!==(kt=(bt=this.metadataTags).trackNumber)&&void 0!==kt||(bt.trackNumber=e)),n&&Number.isInteger(n)&&n>0&&(null!==(wt=(xt=this.metadataTags).tracksTotal)&&void 0!==wt||(xt.tracksTotal=n))}break;case"trkn":if(r instanceof Uint8Array&&r.length>=6){var _t,It,Tt,Et;const t=MI(r),e=t.getUint16(2,!1),n=t.getUint16(4,!1);e>0&&(null!==(It=(_t=this.metadataTags).trackNumber)&&void 0!==It||(_t.trackNumber=e)),n>0&&(null!==(Et=(Tt=this.metadataTags).tracksTotal)&&void 0!==Et||(Tt.tracksTotal=n))}break;case"disc":case"disk":if(r instanceof Uint8Array&&r.length>=6){var St,Mt,At,Nt;const t=MI(r),e=t.getUint16(2,!1),n=t.getUint16(4,!1);e>0&&(null!==(Mt=(St=this.metadataTags).discNumber)&&void 0!==Mt||(St.discNumber=e)),n>0&&(null!==(Nt=(At=this.metadataTags).discsTotal)&&void 0!==Nt||(At.discsTotal=n))}}}}}var Ft,Ct;return t.filePos=W,!0}}class LT{constructor(t){this.internalTrack=t,this.packetToSampleIndex=new WeakMap,this.packetToFragmentLocation=new WeakMap}getId(){return this.internalTrack.id}getNumber(){const t=this.internalTrack.demuxer,e=this.internalTrack.inputTrack.type;let n=0;for(const i of t.tracks)if(i.inputTrack.type===e&&n++,i===this.internalTrack)break;return n}getCodec(){throw new Error("Not implemented on base class.")}getInternalCodecId(){return this.internalTrack.internalCodecId}getName(){return this.internalTrack.name}getLanguageCode(){return this.internalTrack.languageCode}getTimeResolution(){return this.internalTrack.timescale}getDisposition(){return this.internalTrack.disposition}async computeDuration(){var t,e;const n=await this.getPacket(1/0,{metadataOnly:!0});return(null!==(t=null==n?void 0:n.timestamp)&&void 0!==t?t:0)+(null!==(e=null==n?void 0:n.duration)&&void 0!==e?e:0)}async getFirstTimestamp(){var t;const e=await this.getFirstPacket({metadataOnly:!0});return null!==(t=null==e?void 0:e.timestamp)&&void 0!==t?t:0}async getFirstPacket(t){const e=await this.fetchPacketForSampleIndex(0,t);return e||!this.internalTrack.demuxer.isFragmented?e:this.performFragmentedLookup(null,(t=>t.trackData.get(this.internalTrack.id)?{sampleIndex:0,correctSampleFound:!0}:{sampleIndex:-1,correctSampleFound:!1}),-1/0,1/0,t)}mapTimestampIntoTimescale(t){return(t=>{const e=Math.round(t);return Math.abs(t/e-1)<10*Number.EPSILON?e:t})(t*this.internalTrack.timescale)+this.internalTrack.editListOffset}async getPacket(t,e){const n=this.mapTimestampIntoTimescale(t),i=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),r=jT(i,n),o=await this.fetchPacketForSampleIndex(r,e);return HT(i)&&this.internalTrack.demuxer.isFragmented?this.performFragmentedLookup(null,(t=>{const e=t.trackData.get(this.internalTrack.id);if(!e)return{sampleIndex:-1,correctSampleFound:!1};const i=WI(e.presentationTimestamps,n,(t=>t.presentationTimestamp));return{sampleIndex:-1!==i?e.presentationTimestamps[i].sampleIndex:-1,correctSampleFound:-1!==i&&n<e.endTimestamp}}),n,n,e):o}async getNextPacket(t,e){const n=this.packetToSampleIndex.get(t);if(void 0!==n)return this.fetchPacketForSampleIndex(n+1,e);const i=this.packetToFragmentLocation.get(t);if(void 0===i)throw new Error("Packet was not created from this track.");return this.performFragmentedLookup(i.fragment,(t=>{if(t===i.fragment){const e=t.trackData.get(this.internalTrack.id);if(i.sampleIndex+1<e.samples.length)return{sampleIndex:i.sampleIndex+1,correctSampleFound:!0}}else if(t.trackData.get(this.internalTrack.id))return{sampleIndex:0,correctSampleFound:!0};return{sampleIndex:-1,correctSampleFound:!1}}),-1/0,1/0,e)}async getKeyPacket(t,e){const n=this.mapTimestampIntoTimescale(t),i=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),r=$T(i,n),o=await this.fetchPacketForSampleIndex(r,e);return HT(i)&&this.internalTrack.demuxer.isFragmented?this.performFragmentedLookup(null,(t=>{const e=t.trackData.get(this.internalTrack.id);if(!e)return{sampleIndex:-1,correctSampleFound:!1};const i=((t,e)=>{for(let n=t.length-1;n>=0;n--)if(e(t[n]))return n;return-1})(e.presentationTimestamps,(t=>e.samples[t.sampleIndex].isKeyFrame&&t.presentationTimestamp<=n));return{sampleIndex:-1!==i?e.presentationTimestamps[i].sampleIndex:-1,correctSampleFound:-1!==i&&n<e.endTimestamp}}),n,n,e):o}async getNextKeyPacket(t,e){const n=this.packetToSampleIndex.get(t);if(void 0!==n){const t=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),i=qT(t,n);return this.fetchPacketForSampleIndex(i,e)}const i=this.packetToFragmentLocation.get(t);if(void 0===i)throw new Error("Packet was not created from this track.");return this.performFragmentedLookup(i.fragment,(t=>{if(t===i.fragment){const e=t.trackData.get(this.internalTrack.id).samples.findIndex(((t,e)=>t.isKeyFrame&&e>i.sampleIndex));if(-1!==e)return{sampleIndex:e,correctSampleFound:!0}}else{const e=t.trackData.get(this.internalTrack.id);if(e&&null!==e.firstKeyFrameTimestamp){const t=e.samples.findIndex((t=>t.isKeyFrame));return II(-1!==t),{sampleIndex:t,correctSampleFound:!0}}}return{sampleIndex:-1,correctSampleFound:!1}}),-1/0,1/0,e)}async fetchPacketForSampleIndex(t,e){if(-1===t)return null;const n=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),i=UT(n,t);if(!i)return null;let r;if(e.metadataOnly)r=wT;else{let t=this.internalTrack.demuxer.reader.requestSlice(i.sampleOffset,i.sampleSize);t instanceof Promise&&(t=await t),II(t),r=rE(t,i.sampleSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new _T(r,i.isKeyFrame?"key":"delta",o,s,t,i.sampleSize);return this.packetToSampleIndex.set(a,t),a}async fetchPacketInFragment(t,e,n){if(-1===e)return null;const i=t.trackData.get(this.internalTrack.id).samples[e];let r;if(II(i),n.metadataOnly)r=wT;else{let t=this.internalTrack.demuxer.reader.requestSlice(i.byteOffset,i.byteSize);t instanceof Promise&&(t=await t),II(t),r=rE(t,i.byteSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new _T(r,i.isKeyFrame?"key":"delta",o,s,t.moofOffset+e,i.byteSize);return this.packetToFragmentLocation.set(a,{fragment:t,sampleIndex:e}),a}async performFragmentedLookup(t,e,n,i,r){var o,s;const a=this.internalTrack.demuxer;let l=null,c=null,u=-1;if(t){const{sampleIndex:n,correctSampleFound:i}=e(t);if(i)return this.fetchPacketInFragment(t,n,r);-1!==n&&(c=t,u=n)}const d=WI(this.internalTrack.fragmentLookupTable,n,(t=>t.timestamp)),h=-1!==d?this.internalTrack.fragmentLookupTable[d]:null,f=WI(this.internalTrack.fragmentPositionCache,n,(t=>t.startTimestamp)),p=-1!==f?this.internalTrack.fragmentPositionCache[f]:null,m=Math.max(null!==(o=null==h?void 0:h.moofOffset)&&void 0!==o?o:0,null!==(s=null==p?void 0:p.moofOffset)&&void 0!==s?s:0)||null;let v;for(t?null===m||t.moofOffset>=m?(v=t.moofOffset+t.moofSize,l=t):v=m:v=null!=m?m:0;;){if(l){const t=l.trackData.get(this.internalTrack.id);if(t&&t.startTimestamp>i)break}let t=a.reader.requestSliceRange(v,8,16);if(t instanceof Promise&&(t=await t),!t)break;const n=v,o=FT(t);if(!o)break;if("moof"===o.name){l=await a.readFragment(n);const{sampleIndex:t,correctSampleFound:i}=e(l);if(i)return this.fetchPacketInFragment(l,t,r);-1!==t&&(c=l,u=t)}v=n+o.totalSize}if(h&&(!c||c.moofOffset<h.moofOffset)){var g;const t=this.internalTrack.fragmentLookupTable[d-1];II(!t||t.timestamp<h.timestamp);const n=null!==(g=null==t?void 0:t.timestamp)&&void 0!==g?g:-1/0;return this.performFragmentedLookup(null,e,n,i,r)}return c?this.fetchPacketInFragment(c,u,r):null}}class zT extends LT{constructor(t){super(t),this.decoderConfigPromise=null,this.internalTrack=t}getCodec(){return this.internalTrack.info.codec}getCodedWidth(){return this.internalTrack.info.width}getCodedHeight(){return this.internalTrack.info.height}getSquarePixelWidth(){return this.internalTrack.info.squarePixelWidth}getSquarePixelHeight(){return this.internalTrack.info.squarePixelHeight}getRotation(){return this.internalTrack.rotation}async getColorSpace(){var t,e,n,i;return{primaries:null===(t=this.internalTrack.info.colorSpace)||void 0===t?void 0:t.primaries,transfer:null===(e=this.internalTrack.info.colorSpace)||void 0===e?void 0:e.transfer,matrix:null===(n=this.internalTrack.info.colorSpace)||void 0===n?void 0:n.matrix,fullRange:null===(i=this.internalTrack.info.colorSpace)||void 0===i?void 0:i.fullRange}}async canBeTransparent(){return!1}async getDecoderConfig(){var t;return this.internalTrack.info.codec?null!==(t=this.decoderConfigPromise)&&void 0!==t?t:this.decoderConfigPromise=(async(t,e)=>{if("vp9"!==this.internalTrack.info.codec||this.internalTrack.info.vp9CodecInfo){if("av1"===this.internalTrack.info.codec&&!this.internalTrack.info.av1CodecInfo){const t=await this.getFirstPacket({});this.internalTrack.info.av1CodecInfo=t&&(t=>{for(const{type:e,data:n}of vT(t)){if(1!==e)continue;const t=new JI(n),i=t.readBits(3);t.readBits(1);const r=t.readBits(1);let o=0,s=0,a=0;if(r)o=t.readBits(5);else{if(t.readBits(1)&&(t.skipBits(32),t.skipBits(32),t.readBits(1)))return null;const e=t.readBits(1);e&&(a=t.readBits(5),t.skipBits(32),t.skipBits(5),t.skipBits(5));const n=t.readBits(5);for(let i=0;i<=n;i++){t.skipBits(12);const n=t.readBits(5);if(0===i&&(o=n),n>7){const e=t.readBits(1);0===i&&(s=e)}if(e&&t.readBits(1)){const e=a+1;t.skipBits(e),t.skipBits(e),t.skipBits(1)}t.readBits(1)&&t.skipBits(4)}}const l=t.readBits(4),c=t.readBits(4),u=l+1;t.skipBits(u);const d=c+1;t.skipBits(d);let h=0;if(h=r?0:t.readBits(1),h&&(t.skipBits(4),t.skipBits(3)),t.skipBits(1),t.skipBits(1),t.skipBits(1),!r){t.skipBits(1),t.skipBits(1),t.skipBits(1),t.skipBits(1);const e=t.readBits(1);e&&(t.skipBits(1),t.skipBits(1));let n=0;n=t.readBits(1)?2:t.readBits(1),n>0&&(t.readBits(1)||t.skipBits(1)),e&&t.skipBits(3)}t.skipBits(1),t.skipBits(1),t.skipBits(1);const f=t.readBits(1);let p=8;2===i&&f?p=t.readBits(1)?12:10:i<=2&&(p=f?10:8);let m=0;1!==i&&(m=t.readBits(1));let v=1,g=1,y=0;return m||(0===i?(v=1,g=1):1===i?(v=0,g=0):12===p&&(v=t.readBits(1),v&&(g=t.readBits(1))),v&&g&&(y=t.readBits(2))),{profile:i,level:o,tier:s,bitDepth:p,monochrome:m,chromaSubsamplingX:v,chromaSubsamplingY:g,chromaSamplePosition:y}}return null})(t.data)}}else{const t=await this.getFirstPacket({});this.internalTrack.info.vp9CodecInfo=t&&(t=>{const e=new JI(t);if(2!==e.readBits(2))return null;const n=e.readBits(1),i=(e.readBits(1)<<1)+n;if(3===i&&e.skipBits(1),1===e.readBits(1))return null;if(0!==e.readBits(1))return null;if(e.skipBits(2),4817730!==e.readBits(24))return null;let r=8;i>=2&&(r=e.readBits(1)?12:10);const o=e.readBits(3);let s=0,a=0;if(7!==o)if(a=e.readBits(1),1===i||3===i){const t=e.readBits(1),n=e.readBits(1);s=t||n?t&&!n?2:1:3,e.skipBits(1)}else s=1;else s=3,a=1;const l=(e.readBits(16)+1)*(e.readBits(16)+1);let c=TI(iT).level;for(const t of iT)if(l<=t.maxPictureSize){c=t.level;break}return{profile:i,level:c,bitDepth:r,chromaSubsampling:s,videoFullRangeFlag:a,colourPrimaries:2===o?1:1===o?6:2,transferCharacteristics:2===o?1:1===o?6:2,matrixCoefficients:7===o?0:2===o?1:1===o?6:2}})(t.data)}return{codec:rT(this.internalTrack.info),codedWidth:this.internalTrack.info.width,codedHeight:this.internalTrack.info.height,displayAspectWidth:this.internalTrack.info.squarePixelWidth,displayAspectHeight:this.internalTrack.info.squarePixelHeight,description:null!==(t=this.internalTrack.info.codecDescription)&&void 0!==t?t:void 0,colorSpace:null!==(e=this.internalTrack.info.colorSpace)&&void 0!==e?e:void 0}})():null}}class WT extends LT{constructor(t){super(t),this.decoderConfig=null,this.internalTrack=t}getCodec(){return this.internalTrack.info.codec}getNumberOfChannels(){return this.internalTrack.info.numberOfChannels}getSampleRate(){return this.internalTrack.info.sampleRate}async getDecoderConfig(){var t,e;return this.internalTrack.info.codec?null!==(t=this.decoderConfig)&&void 0!==t?t:this.decoderConfig={codec:oT(this.internalTrack.info),numberOfChannels:this.internalTrack.info.numberOfChannels,sampleRate:this.internalTrack.info.sampleRate,description:null!==(e=this.internalTrack.info.codecDescription)&&void 0!==e?e:void 0}:null}}const jT=(t,e)=>{if(t.presentationTimestamps){const n=WI(t.presentationTimestamps,e,(t=>t.presentationTimestamp));return-1===n?-1:t.presentationTimestamps[n].sampleIndex}{const n=WI(t.sampleTimingEntries,e,(t=>t.startDecodeTimestamp));if(-1===n)return-1;const i=t.sampleTimingEntries[n];return i.startIndex+Math.min(Math.floor((e-i.startDecodeTimestamp)/i.delta),i.count-1)}},$T=(t,e)=>{if(!t.keySampleIndices)return jT(t,e);if(t.presentationTimestamps){const n=WI(t.presentationTimestamps,e,(t=>t.presentationTimestamp));if(-1===n)return-1;for(let e=n;e>=0;e--){const n=t.presentationTimestamps[e].sampleIndex;if(-1!==zI(t.keySampleIndices,n,(t=>t)))return n}return-1}{var n;const i=jT(t,e),r=WI(t.keySampleIndices,i,(t=>t));return null!==(n=t.keySampleIndices[r])&&void 0!==n?n:-1}},UT=(t,e)=>{const n=WI(t.sampleTimingEntries,e,(t=>t.startIndex)),i=t.sampleTimingEntries[n];if(!i||i.startIndex+i.count<=e)return null;let r=i.startDecodeTimestamp+(e-i.startIndex)*i.delta;const o=WI(t.sampleCompositionTimeOffsets,e,(t=>t.startIndex)),s=t.sampleCompositionTimeOffsets[o];s&&e-s.startIndex<s.count&&(r+=s.offset);const a=t.sampleSizes[Math.min(e,t.sampleSizes.length-1)],l=WI(t.sampleToChunk,e,(t=>t.startSampleIndex)),c=t.sampleToChunk[l];II(c);const u=c.startChunkIndex+Math.floor((e-c.startSampleIndex)/c.samplesPerChunk),d=t.chunkOffsets[u],h=c.startSampleIndex+(u-c.startChunkIndex)*c.samplesPerChunk;let f=0,p=d;if(1===t.sampleSizes.length)p+=a*(e-h),f+=a*c.samplesPerChunk;else for(let n=h;n<h+c.samplesPerChunk;n++){const i=t.sampleSizes[n];n<e&&(p+=i),f+=i}let m=i.delta;if(t.presentationTimestamps){const n=t.presentationTimestampIndexMap[e];II(void 0!==n),n<t.presentationTimestamps.length-1&&(m=t.presentationTimestamps[n+1].presentationTimestamp-r)}return{presentationTimestamp:r,duration:m,sampleOffset:p,sampleSize:a,chunkOffset:d,chunkSize:f,isKeyFrame:!t.keySampleIndices||-1!==zI(t.keySampleIndices,e,(t=>t))}},qT=(t,e)=>{var n;if(!t.keySampleIndices)return e+1;const i=WI(t.keySampleIndices,e,(t=>t));return null!==(n=t.keySampleIndices[i+1])&&void 0!==n?n:-1},VT=(t,e)=>{t.startTimestamp+=e,t.endTimestamp+=e;for(const n of t.samples)n.presentationTimestamp+=e;for(const n of t.presentationTimestamps)n.presentationTimestamp+=e},GT=t=>{const[e,,,n]=t,i=Math.hypot(e,n),r=e/i,o=n/i,s=-Math.atan2(o,r)*(180/Math.PI);return Number.isFinite(s)?s:0},HT=t=>0===t.sampleSizes.length;class KT{}class XT extends KT{async _getMajorBrand(t){let e=t._reader.requestSlice(0,12);return e instanceof Promise&&(e=await e),e?(e.skip(4),"ftyp"!==pE(e,4)?null:pE(e,4)):null}_createDemuxer(t){return new BT(t)}}const YT=new class extends XT{async _canReadInput(t){const e=await this._getMajorBrand(t);return!!e&&"qt "!==e}get name(){return"MP4"}get mimeType(){return"video/mp4"}};class QT{constructor(){this._disposed=!1,this._sizePromise=null,this.onread=null}async getSizeOrNull(){var t;if(this._disposed)throw new tE;return null!==(t=this._sizePromise)&&void 0!==t?t:this._sizePromise=Promise.resolve(this._retrieveSize())}async getSize(){if(this._disposed)throw new tE;const t=await this.getSizeOrNull();if(null===t)throw new Error("Cannot determine the size of an unsized source.");return t}}class JT extends QT{constructor(t,e={}){var n;if(!(t instanceof ReadableStream))throw new TypeError("stream must be a ReadableStream.");if(!e||"object"!=typeof e)throw new TypeError("options must be an object.");if(void 0!==e.maxCacheSize&&(!XI(e.maxCacheSize)||e.maxCacheSize<0))throw new TypeError("options.maxCacheSize, when provided, must be a non-negative number.");super(),this._reader=null,this._cache=[],this._pendingSlices=[],this._currentIndex=0,this._targetIndex=0,this._maxRequestedIndex=0,this._endIndex=null,this._pulling=!1,this._stream=t,this._maxCacheSize=null!==(n=e.maxCacheSize)&&void 0!==n?n:16777216}_retrieveSize(){return this._endIndex}_read(t,e){if(null!==this._endIndex&&e>this._endIndex)return null;this._maxRequestedIndex=Math.max(this._maxRequestedIndex,e);const n=WI(this._cache,t,(t=>t.start)),i=-1!==n?this._cache[n]:null;if(i&&i.start<=t&&e<=i.end)return{bytes:i.bytes,view:i.view,offset:i.start};let r=t;const o=new Uint8Array(e-t);if(-1!==n)for(let i=n;i<this._cache.length;i++){const n=this._cache[i];if(n.start>=e)break;const s=Math.max(t,n.start);s>r&&this._throwDueToCacheMiss();const a=Math.min(e,n.end);s<a&&(o.set(n.bytes.subarray(s-n.start,a-n.start),s-t),r=a)}if(r===e)return{bytes:o,view:MI(o),offset:t};this._currentIndex>r&&this._throwDueToCacheMiss();const{promise:s,resolve:a,reject:l}=jI();return this._pendingSlices.push({start:t,end:e,bytes:o,resolve:a,reject:l}),this._targetIndex=Math.max(this._targetIndex,e),this._pulling||(this._pulling=!0,this._pull().catch((t=>{if(this._pulling=!1,!(this._pendingSlices.length>0))throw t;this._pendingSlices.forEach((e=>e.reject(t))),this._pendingSlices.length=0}))),s}_throwDueToCacheMiss(){throw new Error("Read is before the cached region. With ReadableStreamSource, you must access the data more sequentially or increase the size of its cache.")}async _pull(){for(null!==(t=this._reader)&&void 0!==t||(this._reader=this._stream.getReader());this._currentIndex<this._targetIndex&&!this._disposed;){var t;const{done:e,value:n}=await this._reader.read();if(e){for(const t of this._pendingSlices)t.resolve(null);this._pendingSlices.length=0,this._endIndex=this._currentIndex;break}const i=this._currentIndex,r=this._currentIndex+n.byteLength;for(let t=0;t<this._pendingSlices.length;t++){const e=this._pendingSlices[t],o=Math.max(i,e.start),s=Math.min(r,e.end);o<s&&(e.bytes.set(n.subarray(o-i,s-i),o-e.start),s===e.end&&(e.resolve({bytes:e.bytes,view:MI(e.bytes),offset:e.start}),this._pendingSlices.splice(t,1),t--))}for(this._cache.push({start:i,end:r,bytes:n,view:MI(n),age:0});this._cache.length>0;){const t=this._cache[0];if(this._maxRequestedIndex-t.end<=this._maxCacheSize)break;this._cache.shift()}this._currentIndex+=n.byteLength}this._pulling=!1}_dispose(){this._pendingSlices.length=0,this._cache.length=0}}null!==(ge=Symbol.dispose)&&void 0!==ge||(Symbol.dispose=Symbol("Symbol.dispose"));class ZT{get disposed(){return this._disposed}constructor(t){if(this._demuxerPromise=null,this._format=null,this._disposed=!1,!t||"object"!=typeof t)throw new TypeError("options must be an object.");if(!Array.isArray(t.formats)||t.formats.some((t=>!(t instanceof KT))))throw new TypeError("options.formats must be an array of InputFormat.");if(!(t.source instanceof QT))throw new TypeError("options.source must be a Source.");if(t.source._disposed)throw new Error("options.source must not be disposed.");this._formats=t.formats,this._source=t.source,this._reader=new eE(t.source)}_getDemuxer(){var t;return null!==(t=this._demuxerPromise)&&void 0!==t?t:this._demuxerPromise=(async()=>{this._reader.fileSize=await this._source.getSizeOrNull();for(const t of this._formats)if(await t._canReadInput(this))return this._format=t,t._createDemuxer(this);throw new Error("Input has an unsupported or unrecognizable format.")})()}get source(){return this._source}async getFormat(){return await this._getDemuxer(),II(this._format),this._format}async computeDuration(){return(await this._getDemuxer()).computeDuration()}async getFirstTimestamp(){const t=await this.getTracks();if(0===t.length)return 0;const e=await Promise.all(t.map((t=>t.getFirstTimestamp())));return Math.min(...e)}async getTracks(){return(await this._getDemuxer()).getTracks()}async getVideoTracks(){return(await this.getTracks()).filter((t=>t.isVideoTrack()))}async getAudioTracks(){return(await this.getTracks()).filter((t=>t.isAudioTrack()))}async getPrimaryVideoTrack(){var t;return null!==(t=(await this.getTracks()).find((t=>t.isVideoTrack())))&&void 0!==t?t:null}async getPrimaryAudioTrack(){var t;return null!==(t=(await this.getTracks()).find((t=>t.isAudioTrack())))&&void 0!==t?t:null}async getMimeType(){return(await this._getDemuxer()).getMimeType()}async getMetadataTags(){return(await this._getDemuxer()).getMetadataTags()}dispose(){this._disposed||(this._disposed=!0,this._source._disposed=!0,this._source._dispose())}[Symbol.dispose](){this.dispose()}}class tE extends Error{constructor(t="Input has been disposed."){super(t),this.name="InputDisposedError"}}class eE{constructor(t){this.source=t}requestSlice(t,e){if(this.source._disposed)throw new tE;if(t<0)return null;if(null!==this.fileSize&&t+e>this.fileSize)return null;const n=t+e,i=this.source._read(t,n);return i instanceof Promise?i.then((e=>e?new nE(e.bytes,e.view,e.offset,t,n):null)):i?new nE(i.bytes,i.view,i.offset,t,n):null}requestSliceRange(t,e,n){if(this.source._disposed)throw new tE;if(t<0)return null;if(null!==this.fileSize)return this.requestSlice(t,UI(this.fileSize-t,e,n));{const i=this.requestSlice(t,n),r=i=>{if(i)return i;const r=i=>(II(null!==i),this.requestSlice(t,UI(i-t,e,n))),o=this.source._retrieveSize();return o instanceof Promise?o.then(r):r(o)};return i instanceof Promise?i.then(r):r(i)}}}class nE{constructor(t,e,n,i,r){this.bytes=t,this.view=e,this.offset=n,this.start=i,this.end=r,this.bufferPos=i-n}static tempFromBytes(t){return new nE(t,MI(t),0,0,t.length)}get length(){return this.end-this.start}get filePos(){return this.offset+this.bufferPos}set filePos(t){this.bufferPos=t-this.offset}get remainingLength(){return Math.max(this.end-this.filePos,0)}skip(t){this.bufferPos+=t}slice(t,e=this.end-t){if(t<this.start||t+e>this.end)throw new RangeError("Slicing outside of original slice.");return new nE(this.bytes,this.view,this.offset,t,t+e)}}const iE=(t,e)=>{if(t.filePos<t.start||t.filePos+e>t.end)throw new RangeError(`Tried reading [${t.filePos}, ${t.filePos+e}), but slice is [${t.start}, ${t.end}). This is likely an internal error, please report it alongside the file that caused it.`)},rE=(t,e)=>{iE(t,e);const n=t.bytes.subarray(t.bufferPos,t.bufferPos+e);return t.bufferPos+=e,n},oE=t=>(iE(t,1),t.view.getUint8(t.bufferPos++)),sE=t=>{iE(t,2);const e=t.view.getUint16(t.bufferPos,!1);return t.bufferPos+=2,e},aE=t=>{iE(t,3);const e=$I(t.view,t.bufferPos);return t.bufferPos+=3,e},lE=t=>{iE(t,2);const e=t.view.getInt16(t.bufferPos,!1);return t.bufferPos+=2,e},cE=t=>{iE(t,4);const e=t.view.getUint32(t.bufferPos,!1);return t.bufferPos+=4,e},uE=t=>{iE(t,4);const e=t.view.getInt32(t.bufferPos,!1);return t.bufferPos+=4,e},dE=t=>4294967296*cE(t)+cE(t),hE=t=>4294967296*uE(t)+cE(t),fE=t=>{iE(t,8);const e=t.view.getFloat64(t.bufferPos,!1);return t.bufferPos+=8,e},pE=(t,e)=>{iE(t,e);let n="";for(let i=0;i<e;i++)n+=String.fromCharCode(t.bytes[t.bufferPos++]);return n};var mE=new WeakMap,vE=new WeakMap,gE=new WeakMap,yE=new WeakMap,bE=new WeakMap,kE=new WeakMap,xE=new WeakMap,wE=new WeakMap,_E=new WeakMap,IE=new WeakMap,TE=new WeakMap,EE=new WeakMap,SE=new WeakMap,ME=new WeakMap,AE=new WeakMap,NE=new WeakSet;class FE extends fh{constructor(...t){super(...t),$(this,NE),W(this,mE,null),W(this,vE,null),W(this,gE,null),W(this,yE,null),W(this,bE,!1),W(this,kE,!1),W(this,xE,!1),W(this,wE,!1),W(this,_E,void 0),W(this,IE,null),W(this,TE,null),W(this,EE,!1),W(this,SE,!1),W(this,ME,null),W(this,AE,!1)}get name(){return"FMP4Demuxer"}get defaults(){return{}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"pushChunk","endOfStream"])}pushChunk(t,e={}){if(z(xE,this)||z(wE,this))return;const n=t instanceof Uint8Array?t:new Uint8Array(t),i=!!e.isInit;j(IE,this,B(NE,this,BE).call(this,n,e,i)),i&&(j(_E,this,n),j(TE,this,null),this.trigger("demux:init",{data:n})),B(NE,this,DE).call(this);try{var r;const t=null===(r=z(mE,this))||void 0===r?void 0:r.write(n);t&&"function"==typeof t.catch&&t.catch((t=>{B(NE,this,LE).call(this,t)}))}catch(t){if(z(xE,this)||B(NE,this,CE).call(this,t))return;return this.log.warn("[FMP4Demuxer] mediabunny demux failed",t),void B(NE,this,LE).call(this,t)}const o=B(NE,this,jE).call(this);o&&"function"==typeof o.catch&&o.catch((t=>{B(NE,this,LE).call(this,t)}))}endOfStream(){if(z(wE,this))return;if(z(EE,this))return;let t;j(EE,this,!0),j(SE,this,!1),j(AE,this,!1);try{var e;t=null===(e=z(mE,this))||void 0===e?void 0:e.close()}catch(e){t=Promise.resolve()}let n=!1;B(NE,this,PE).call(this),j(ME,this,setTimeout((()=>{j(ME,this,null),n||z(SE,this)||z(wE,this)||B(NE,this,RE).call(this)}),20)),Promise.resolve(t).catch((()=>{})).finally((()=>{n=!0,B(NE,this,PE).call(this),B(NE,this,RE).call(this)}))}onDispose(){super.onDispose(),j(wE,this,!0);try{var t,e;null===(t=z(gE,this))||void 0===t||null===(e=t.close)||void 0===e||e.call(t)}catch(t){}this.endOfStream();try{var n,i;null===(n=z(vE,this))||void 0===n||null===(i=n.dispose)||void 0===i||i.call(n)}catch(t){}j(gE,this,null),j(vE,this,null),j(xE,this,!1),j(IE,this,null),j(yE,this,null),j(bE,this,!1),j(kE,this,!1),j(EE,this,!1),j(SE,this,!1),j(AE,this,!1),B(NE,this,PE).call(this)}}function CE(t){return!!z(wE,this)&&(!t||("InputDisposedError"===(null==t?void 0:t.name)||("string"==typeof(null==t?void 0:t.message)?t.message:"").includes("Input has been disposed")))}function OE(){try{var t,e;const n=null===(t=z(mE,this))||void 0===t||null===(e=t.close)||void 0===e?void 0:e.call(t);n&&"function"==typeof n.catch&&n.catch((()=>{}))}catch(t){}j(mE,this,null)}function PE(){null!==z(ME,this)&&(clearTimeout(z(ME,this)),j(ME,this,null))}function RE(){if(z(SE,this)||z(wE,this)||z(xE,this))return;if(j(SE,this,!0),z(kE,this))return void j(AE,this,!0);j(AE,this,!1);const t=B(NE,this,jE).call(this);t&&"function"==typeof t.catch&&t.catch((t=>{B(NE,this,LE).call(this,t)}))}function DE(){if(z(vE,this)&&z(mE,this))return;const t=vh.TransformStream;if(void 0===t)throw new Error("TransformStream is not available in this environment");const{readable:e,writable:n}=new t;j(mE,this,n.getWriter()),j(vE,this,new ZT({source:new JT(e),formats:[YT]})),j(bE,this,!1)}function BE(t,e,n){const i={isInit:n,byteLength:(null==t?void 0:t.byteLength)||0};return"number"==typeof e.loaded&&(i.loaded=e.loaded),"number"==typeof e.total&&(i.total=e.total),"number"==typeof e.pts&&(i.pts=e.pts),"number"==typeof e.dts&&(i.dts=e.dts),"number"==typeof e.duration&&(i.duration=e.duration),"boolean"==typeof e.isKey&&(i.isKey=e.isKey),i}function LE(t){if(z(xE,this)||B(NE,this,CE).call(this,t))return;if(B(NE,this,WE).call(this,t))return void j(bE,this,!1);j(xE,this,!0),B(NE,this,OE).call(this);try{var e,n;null===(e=z(gE,this))||void 0===e||null===(n=e.close)||void 0===n||n.call(e)}catch(t){}j(gE,this,null);try{var i,r;null===(i=z(vE,this))||void 0===i||null===(r=i.dispose)||void 0===r||r.call(i)}catch(t){}j(vE,this,null);const o={error:t,recoverable:!1,severity:"fatal",streamClosed:z(EE,this),streamFinalized:z(SE,this)};z(IE,this)&&(o.context={...z(IE,this)}),this.trigger("demux:error",o)}function zE(t){if(!t)return!1;const e="string"==typeof(null==t?void 0:t.message)?t.message:"";return!!e&&(e.includes("unsupported or unrecognizable format")||e.includes("No supported tracks found"))}function WE(t){return!!B(NE,this,zE).call(this,t)&&(!z(SE,this)||z(AE,this))}async function jE(){if(!(z(wE,this)||z(xE,this)||z(bE,this)||z(kE,this))){j(kE,this,!0);try{B(NE,this,DE).call(this);const t=await z(vE,this).getPrimaryVideoTrack(),e=t?null:await z(vE,this).getPrimaryAudioTrack(),n=t||e;if(!n)throw new Error("No supported tracks found in MP4");const i=await n.getDecoderConfig(),r=await n.getCodecParameterString(),o=await z(vE,this).getMimeType();this.trigger("demux:init",{...z(_E,this)?{data:z(_E,this)}:{},decoderConfig:i,codec:r,mimeType:o}),j(gE,this,new ST(n)),j(bE,this,!0),j(yE,this,(async()=>{try{for await(const t of z(gE,this).packets()){if(z(wE,this))break;const e="number"==typeof t.timestamp?t.timestamp:0;null===z(TE,this)&&j(TE,this,e);let n=e-z(TE,this);n<0&&(n=0),this.trigger("demux:sample",{data:t.data,pts:n,dts:n,duration:t.duration,isKey:"key"===t.type})}this.trigger("demux:complete")}catch(t){B(NE,this,LE).call(this,t)}})())}catch(t){if(B(NE,this,WE).call(this,t))return;throw t}finally{j(kE,this,!1),!z(AE,this)||z(xE,this)||z(wE,this)||B(NE,this,RE).call(this)}}}const $E=1e6,UE=24e3/1001,qE={primaries:"bt709",transfer:"bt709",matrix:"bt709",fullRange:!0},VE=new Uint8Array;function GE(t){return t?t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):VE:VE}let HE=null;const KE={video:(ye=new WeakMap,be=new WeakMap,ke=new WeakMap,xe=new WeakMap,we=new WeakMap,_e=new WeakMap,Ie=new WeakMap,Te=new WeakMap,Ee=new WeakMap,Se=new WeakMap,Me=new WeakMap,Ae=new WeakMap,Ne=new WeakMap,Fe=new WeakMap,Ce=new WeakMap,Oe=new WeakMap,Pe=new WeakMap,Re=new WeakMap,De=new WeakMap,Be=new WeakMap,Le=new WeakMap,ze=new WeakMap,We=new WeakMap,je=new WeakMap,$e=new WeakMap,Ue=new WeakMap,qe=new WeakMap,Ve=new WeakMap,Ge=new WeakMap,He=new WeakMap,Ke=new WeakMap,Xe=new WeakMap,Ye=new WeakMap,Qe=new WeakMap,Je=new WeakSet,class extends _I{get name(){return"WebCodecsSegmentDecoder"}get defaults(){return{decodedHorizonSeconds:1,maxDecodedFrames:24,maxDecodeQueueSize:4,av1ColorSpaceOverrideEnabled:!0,convertFramesToBitmapsOnAndroid:!0,androidFixEndOfSegmentDelta:.2}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"decodeChunk"])}constructor(...t){super(...t),$(this,Je),W(this,ye,void 0),W(this,be,[]),W(this,ke,void 0),W(this,xe,void 0),W(this,we,void 0),W(this,_e,void 0),W(this,Ie,[]),W(this,Te,void 0),W(this,Ee,new Map),W(this,Se,!0),W(this,Me,!1),W(this,Ae,!1),W(this,Ne,!1),W(this,Fe,void 0),W(this,Ce,!1),W(this,Oe,!1),W(this,Pe,0),W(this,Re,void 0),W(this,De,void 0),W(this,Be,{}),W(this,Le,void 0),W(this,ze,0),W(this,We,null),W(this,je,!1),W(this,$e,null),W(this,Ue,void 0),W(this,qe,0),W(this,Ve,0),W(this,Ge,0),W(this,He,0),W(this,Ke,!1),W(this,Xe,!1),W(this,Ye,.2),W(this,Qe,Promise.resolve()),j(ke,this,this.settings.decodedHorizonSeconds||1),j(xe,this,B(Je,this,zS).call(this,this.settings.maxDecodedFrames)),j(we,this,B(Je,this,jS).call(this,this.settings.maxDecodeQueueSize)),j(Ke,this,_g()),j(Xe,this,B(Je,this,FS).call(this,this.settings.convertFramesToBitmapsOnAndroid)),j(Ye,this,B(Je,this,CS).call(this,this.settings.androidFixEndOfSegmentDelta)),j(_e,this,(()=>0)),j(Te,this,(()=>B(Je,this,xS).call(this)));const e=this.settings.demuxerOptions?{FMP4Demuxer:this.settings.demuxerOptions}:{};j(ye,this,new FE(e)),z(ye,this).on("demux:init",(t=>B(Je,this,dS).call(this,t))),z(ye,this).on("demux:sample",(t=>B(Je,this,hS).call(this,t))),z(ye,this).on("demux:complete",(()=>B(Je,this,fS).call(this))),z(ye,this).on("demux:error",(t=>B(Je,this,tS).call(this,t)))}setCurrentTimeProvider(t){"function"==typeof t&&j(_e,this,t)}setTimeOffsetSeconds(t){const e=Number(t);j(ze,this,Number.isFinite(e)?e:0)}setSeekTargetTimeSeconds(t){const e=Number(t);j(We,this,Number.isFinite(e)?e:null),j(je,this,!1),j($e,this,null)}endOfStream(){z(ye,this)&&"function"==typeof z(ye,this).endOfStream&&z(ye,this).endOfStream()}configure(t){super.configure(t),j(Be,this,{codec:B(Je,this,GS).call(this,t),width:(null==t?void 0:t.codedWidth)||(null==t?void 0:t.width),height:(null==t?void 0:t.codedHeight)||(null==t?void 0:t.height)}),j(Re,this,z(Be,this).codec)}setSegment(t){this.lastSegment=t,B(Je,this,aS).call(this)}setNodeId(t){j(Ue,this,t)}decode(t){this.setSegment(t);const e=null==t?void 0:t.arrayBuffer;e&&z(ye,this).pushChunk(e,{isInit:!(null==t||!t.isInit)})}async decodeChunk(t,e={}){await z(ye,this).pushChunk(t,{isInit:!!e.isInit,pts:"number"==typeof e.pts?e.pts:void 0,dts:"number"==typeof e.dts?e.dts:void 0,duration:"number"==typeof e.duration?e.duration:void 0,isKey:!!e.isKey,loaded:"number"==typeof e.loaded?e.loaded:void 0,total:"number"==typeof e.total?e.total:void 0})}get decodedFrames(){return z(be,this).slice()}onDispose(){if(super.onDispose(),B(Je,this,IS).call(this),z(ye,this)&&"function"==typeof z(ye,this).dispose&&z(ye,this).dispose(),j(be,this,[]),j(Ie,this,[]),z(Ee,this).clear(),j($e,this,null),z(Fe,this)&&"function"==typeof z(Fe,this).close)try{z(Fe,this).close()}catch(t){}j(Fe,this,null),j(Ce,this,!1),j(De,this,null),j(Re,this,null),j(Ue,this,null),j(Qe,this,Promise.resolve()),B(Je,this,aS).call(this)}}),audio:(Ze=new WeakMap,tn=new WeakMap,en=new WeakMap,nn=new WeakMap,rn=new WeakMap,on=new WeakMap,sn=new WeakMap,an=new WeakSet,class extends _I{constructor(...t){super(...t),$(this,an),W(this,Ze,void 0),W(this,tn,[]),W(this,en,0),W(this,nn,!1),W(this,rn,!1),W(this,on,void 0),W(this,sn,0)}get name(){return"WebAudioDecoder"}setSegment(t){j(on,this,t)}setTimeOffsetSeconds(t){const e=Number(t);j(sn,this,Number.isFinite(e)?e:0)}decode(t){if(this.lastSegment=t,!t)return;if(t.isInit)return void j(Ze,this,GE(t.arrayBuffer));const e=t.arrayBuffer;e&&B(an,this,QE).call(this,GE(e),!0)}decodeChunk(t,e={}){if(!t)return;if(e.isInit)return void j(Ze,this,GE(t));const n=GE(t);if(!n.length)return;z(tn,this).push(n),j(en,this,z(en,this)+n.length);const i=Number(e.loaded),r=Number(e.total);Number.isFinite(i)&&Number.isFinite(r)&&r>0&&i>=r&&B(an,this,XE).call(this)}endOfStream(){B(an,this,XE).call(this)}onDispose(){super.onDispose(),j(Ze,this,void 0),j(tn,this,[]),j(en,this,0),j(nn,this,!1),j(rn,this,!1),j(on,this,void 0)}}),image:class extends _I{#z;#W=0;#j=[];#$=0;#U;get name(){return"ImageDecoder"}setSegment(t){this.#z=t}setTimeOffsetSeconds(t){const e=Number(t);this.#W=Number.isFinite(e)?e:0}decode(t){super.decode(t),t&&(this.#z=t);const e=null==t?void 0:t.arrayBuffer;e instanceof ArrayBuffer&&(this.#j=[new Uint8Array(e)],this.#$=e.byteLength,this.endOfStream())}decodeChunk(t,e={}){if(null!=e&&e.isInit)return;const n=function(t){if(t)return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):ArrayBuffer.isView(t)&&t.buffer?new Uint8Array(t.buffer):void 0}(t);n&&n.length&&(this.#j.push(n),this.#$+=n.length)}async endOfStream(){var t,e,n;if(this.#U)return;if(!(this.#j.length&&this.#$>0))return;const i=new Uint8Array(this.#$);let r=0;for(let t=0;t<this.#j.length;t+=1){const e=this.#j[t];i.set(e,r),r+=e.length}const o=null===(t=this.#z)||void 0===t?void 0:t.chosenRepresentation,s=(null==o?void 0:o.mime)||(null===(e=this.track)||void 0===e?void 0:e.mimeType)||(null===(n=this.track)||void 0===n?void 0:n.mime)||function(t){if(t instanceof Uint8Array&&!(t.byteLength<4))return t.byteLength>=8&&137===t[0]&&80===t[1]&&78===t[2]&&71===t[3]&&13===t[4]&&10===t[5]&&26===t[6]&&10===t[7]?"image/png":255===t[0]&&216===t[1]&&255===t[2]?"image/jpeg":t.byteLength>=6&&71===t[0]&&73===t[1]&&70===t[2]&&56===t[3]?"image/gif":t.byteLength>=12&&82===t[0]&&73===t[1]&&70===t[2]&&70===t[3]&&87===t[8]&&69===t[9]&&66===t[10]&&80===t[11]?"image/webp":void 0}(i);try{var a,l;const t=await async function(t,e){const n=function(t,e){if(!(t&&t.byteLength>0))return;if("function"!=typeof vh.Blob)return;const n="string"==typeof e?e:"";return new vh.Blob([t],n?{type:n}:void 0)}(t,e);if(!n)throw new Error("Image decode requires Blob support");let i;if("function"==typeof vh.Image&&vh.URL&&"function"==typeof vh.URL.createObjectURL&&"function"==typeof vh.URL.revokeObjectURL){const t=vh.URL.createObjectURL(n);try{const e=new vh.Image;return await new Promise(((n,i)=>{e.onload=()=>n(),e.onerror=t=>i(t||new Error("Image decode failed")),e.src=t})),e}catch(t){i=t}finally{vh.URL.revokeObjectURL(t)}}if("function"==typeof vh.createImageBitmap)try{return vh.createImageBitmap(n)}catch(t){i=t}if(i)throw i;throw new Error("No supported image decode mechanism")}(i,s);this.#U=t;const e=function(t){if(!t)return;const e=[[t.naturalWidth,t.naturalHeight],[t.width,t.height],[t.displayWidth,t.displayHeight],[t.videoWidth,t.videoHeight],[t.codedWidth,t.codedHeight]];for(let t=0;t<e.length;t+=1){const[n,i]=e[t],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}(t);e&&o&&(fb(o.width)||(o.width=e.width),fb(o.height)||(o.height=e.height)),this.trigger("decoder:frame",{pts:this.#W,duration:fb(null===(a=this.#z)||void 0===a?void 0:a.duration)?this.#z.duration:null===(l=this.track)||void 0===l?void 0:l.duration,frame:t})}catch(t){this.trigger("decoder:error",{error:t})}}onDispose(){if(super.onDispose(),this.#U&&"function"==typeof this.#U.close)try{this.#U.close()}catch(t){}this.#U=null,this.#j=[],this.#$=0,this.#z=null}}};function XE(){if(z(nn,this)||z(rn,this))return;if(!z(en,this))return;const t=B(an,this,YE).call(this);t.length&&B(an,this,QE).call(this,t,!1)}function YE(){const t=z(Ze,this),e=t?t.length:0,n=e+z(en,this);if(!n)return VE;const i=new Uint8Array(n);let r=0;e&&(i.set(t,r),r+=e);for(let t=0;t<z(tn,this).length;t+=1){const e=z(tn,this)[t];e&&e.length&&(i.set(e,r),r+=e.length)}return i}function QE(t,e){if(z(nn,this)||z(rn,this))return;const n=e?B(an,this,JE).call(this,t):t;if(!n||!n.length)return;const i=function(){if(HE)return HE;const t=vh.AudioContext||vh.webkitAudioContext;return t?(HE=new t,HE):null}();if(!i||"function"!=typeof i.decodeAudioData)return void this.trigger("decoder:error",{error:new Error("AudioContext is not available")});const r=n.buffer.slice(0);j(rn,this,!0),new Promise(((t,e)=>{const n=i.decodeAudioData(r,t,e);n&&"function"==typeof n.then&&n.then(t).catch(e)})).then((t=>{var e;j(nn,this,!0);const n=Number.isFinite(null==t?void 0:t.duration)?t.duration:Number(null===(e=z(on,this))||void 0===e?void 0:e.duration)||void 0;this.trigger("decoder:audio",{audioBuffer:t,pts:z(sn,this),duration:n})})).catch((t=>{this.trigger("decoder:error",{error:t})})).finally((()=>{j(tn,this,[]),j(en,this,0),j(rn,this,!1)}))}function JE(t){const e=z(Ze,this);if(!e||!e.length)return t;const n=e.length+t.length,i=new Uint8Array(n);return i.set(e,0),i.set(t,e.length),i}function ZE(t,e){var n,i,r,o,s;const a=null!=t&&t.context&&"object"==typeof t.context?t.context:void 0;return{error:e,errorName:null==e?void 0:e.name,errorMessage:"string"==typeof(null==e?void 0:e.message)?e.message:void 0,nodeId:z(Ue,this),trackId:null===(n=this.track)||void 0===n?void 0:n.id,trackType:null===(i=this.track)||void 0===i?void 0:i.type,codec:(null===(r=z(Be,this))||void 0===r?void 0:r.codec)||z(Re,this),segmentId:null===(o=this.lastSegment)||void 0===o?void 0:o.id,segmentIsInit:!(null===(s=this.lastSegment)||void 0===s||!s.isInit),chunkContext:a}}function tS(t){const e=(null==t?void 0:t.error)||t,n=B(Je,this,ZE).call(this,t,e);if(B(Je,this,eS).call(this,t,e))return this.log.warn("[onDemuxError] recoverable demux error",n),void B(Je,this,fS).call(this);const i=B(Je,this,uS).call(this,t),r=B(Je,this,nS).call(this,i);if(i&&0===i.missingFrames)return this.log.warn(`[onDemuxError] ignoring demux error (no missing frames)${r}`,{...n,missingFrameStats:i}),void B(Je,this,fS).call(this);let o=n;i&&(o={...n,missingFrameStats:i}),this.log.warn(`[onDemuxError] demux error${r}`,o),this.trigger("decoder:error",t)}function eS(t,e){if("boolean"==typeof(null==t?void 0:t.recoverable))return t.recoverable;const n="string"==typeof(null==t?void 0:t.severity)?t.severity:"";if(n)return"recoverable"===n||"transient"===n;const i="string"==typeof(null==e?void 0:e.message)?e.message:"";return!!i&&(i.includes("unsupported or unrecognizable format")||i.includes("No supported tracks found"))}function nS(t){return t?` expectedFrames=${B(Je,this,iS).call(this,t.expectedFrames)} demuxedFrames=${B(Je,this,iS).call(this,t.demuxedFrames)} missingFrames=${B(Je,this,iS).call(this,t.missingFrames)}`:""}function iS(t){if(null==t)return"unknown";const e=Number(t);return Number.isFinite(e)?String(e):"unknown"}function rS(t,e={}){return{expectedFrames:null,demuxedFrames:z(qe,this),missingFrames:null,reason:t,...e}}function oS(t){const e=Number(t);return Number.isFinite(e)?e:null}function sS(t){var e,n;const i=(null==t?void 0:t.context)||{},r=Number(i.loaded),o=Number(i.total);if(!Number.isFinite(o)||o<=0||!Number.isFinite(r)||r<o)return null;if(null!==(e=this.lastSegment)&&void 0!==e&&e.isInit)return null;const s=Number(null===(n=this.lastSegment)||void 0===n?void 0:n.duration);if(!Number.isFinite(s)||s<=0)return B(Je,this,rS).call(this,"segment_duration_unavailable",{segmentDurationSeconds:B(Je,this,oS).call(this,s),demuxedCoverageSeconds:z(He,this),frameDurationSeconds:null});const a=B(Je,this,cS).call(this);if(!Number.isFinite(a)||a<=0){const t=Math.max(1,Math.round(s*UE));return{expectedFrames:t,demuxedFrames:z(qe,this),missingFrames:Math.max(0,t-z(qe,this)),reason:"fallback_fps",fallbackFps:UE,segmentDurationSeconds:s,demuxedCoverageSeconds:z(He,this),frameDurationSeconds:B(Je,this,oS).call(this,a)}}const l=Math.min(.5*a,.02),c=Math.max(0,s-z(He,this)),u=c<=l?0:c,d=Math.max(1,Math.floor((s+l)/a)),h=Math.max(0,d-z(qe,this)),f=u>0?Math.ceil(u/a):0;return{expectedFrames:d,demuxedFrames:z(qe,this),missingFrames:Math.max(h,f),segmentDurationSeconds:s,demuxedCoverageSeconds:z(He,this),frameDurationSeconds:a}}function aS(){j(qe,this,0),j(Ve,this,0),j(Ge,this,0),j(He,this,0)}function lS(t){j(qe,this,z(qe,this)+1);const e=Number(null==t?void 0:t.pts),n=Number(null==t?void 0:t.duration);if(Number.isFinite(n)&&n>0&&(j(Ve,this,z(Ve,this)+n),j(Ge,this,z(Ge,this)+1)),!Number.isFinite(e))return;const i=Number.isFinite(n)&&n>0?e+n:e;Number.isFinite(i)&&i>z(He,this)&&j(He,this,i)}function cS(){return z(Ge,this)>0?z(Ve,this)/z(Ge,this):z(qe,this)>0&&z(He,this)>0?z(He,this)/z(qe,this):null}function uS(t){return B(Je,this,sS).call(this,t)}function dS(t){(null==t?void 0:t.data)instanceof Uint8Array&&(j(De,this,t.data.buffer),B(Je,this,ES).call(this)),null!=t&&t.decoderConfig&&(j(Le,this,t.decoderConfig),j(Re,this,t.decoderConfig.codec||z(Re,this)),B(Je,this,ES).call(this)),this.trigger("decoder:init",t)}function hS(t){B(Je,this,lS).call(this,t),z(Ie,this).push(t),B(Je,this,xS).call(this)}function fS(){j(Me,this,!0),B(Je,this,MS).call(this)}function pS(t){const e="number"==typeof(null==t?void 0:t.pts)?t.pts:void 0;if(Number.isFinite(e))return z(ze,this)+e}function mS(t){return z(Ie,this).some((e=>{const n=B(Je,this,pS).call(this,e);return Number.isFinite(n)&&n>=t}))}function vS(t){let e=-1,n=null;for(let i=0;i<z(Ie,this).length;i+=1){const r=z(Ie,this)[i],o=B(Je,this,pS).call(this,r);Number.isFinite(o)&&(null==r?void 0:r.isKey)&&o<=t&&(e=i,n=o)}return{chosenIndex:e,chosenPtsSeconds:n}}function gS(t){let e=-1,n=null;for(let i=0;i<z(Ie,this).length;i+=1){const r=z(Ie,this)[i],o=B(Je,this,pS).call(this,r);if(Number.isFinite(o)&&null!=r&&r.isKey&&(e=i,n=o,o>=t))break}return{chosenIndex:e,chosenPtsSeconds:n}}function yS(t){const e=t+z(ke,this),n=z(We,this);if(!Number.isFinite(n))return e;const i=Number.isFinite(z($e,this))?z($e,this):null;if(Number.isFinite(i))return Math.max(e,i);const{chosenPtsSeconds:r}=B(Je,this,gS).call(this,n);return Number.isFinite(r)?Math.max(e,r):e}function bS(t){const e=z(We,this);Number.isFinite(e)&&Number.isFinite(t)&&t>=e&&(j(We,this,null),j($e,this,null))}function kS(){const t=z(We,this);if(!Number.isFinite(t)||z(je,this))return!0;if(!B(Je,this,mS).call(this,t)&&!z(Me,this))return!1;const e=B(Je,this,vS).call(this,t);let n=e;if(-1===e.chosenIndex&&(n=B(Je,this,gS).call(this,t)),n.chosenIndex>0){const t=`[#maybeAlignToSeekKeyframe] Dropping ${n.chosenIndex} samples before keyframe @ ${n.chosenPtsSeconds}`;this.log.debug(t),z(Ie,this).splice(0,n.chosenIndex)}return j(Se,this,!0),Number.isFinite(n.chosenPtsSeconds)&&j($e,this,n.chosenPtsSeconds),j(je,this,!0),!0}function xS(){const t=z(_e,this)?z(_e,this).call(this):0,e=B(Je,this,yS).call(this,t);if(B(Je,this,BS).call(this,t),B(Je,this,LS).call(this),!B(Je,this,kS).call(this))return void B(Je,this,_S).call(this);const n=void 0!==vh.VideoDecoder&&void 0!==vh.EncodedVideoChunk;for(n&&!z(Ce,this)&&z(Le,this)&&B(Je,this,ES).call(this);z(Ie,this).length&&!B(Je,this,WS).call(this)&&!(n&&z(Fe,this)&&B(Je,this,$S).call(this));){const t=z(Ie,this)[0],i="number"==typeof(null==t?void 0:t.pts)?t.pts:0,r=z(ze,this)+i;if(r>e)break;if(null!=t&&t.raw)z(Ie,this).shift(),B(Je,this,wS).call(this,t);else{if(n){if(!z(Ce,this)||!z(Fe,this))break;if(z(Se,this)&&!t.isKey){z(Ie,this).shift();continue}z(Ie,this).shift();const e=Math.max(0,Math.round(r*$E));z(Ee,this).set(e,!!t.isKey);try{const n=new vh.EncodedVideoChunk({type:t.isKey?"key":"delta",timestamp:e,duration:t.duration?Math.round(t.duration*$E):void 0,data:t.data instanceof Uint8Array?t.data:new Uint8Array(t.data)});z(Fe,this).decode(n),t.isKey&&j(Se,this,!1);continue}catch(t){z(Ee,this).delete(e);const n="string"==typeof(null==t?void 0:t.message)?t.message:"";if("DataError"===(null==t?void 0:t.name)&&n.includes("key frame")){j(Se,this,!0);continue}this.log.warn("[#drainDecodeQueue] decode failed, falling back to placeholder",t)}}z(Ie,this).shift(),B(Je,this,wS).call(this,t)}}B(Je,this,MS).call(this),B(Je,this,_S).call(this)}function wS(t){const e=z(_e,this)?z(_e,this).call(this):0,n=B(Je,this,yS).call(this,e),i=z(ze,this)+("number"==typeof t.pts?t.pts:0);if(i<e||i>n)return;B(Je,this,BS).call(this,e);const r={pts:i,duration:t.duration,data:t.data,isKey:t.isKey};z(be,this).push(r),B(Je,this,LS).call(this),this.trigger("decoder:frame",r),B(Je,this,bS).call(this,i)}function _S(){if(z(Ie,this).length>0&&void 0!==vh.VideoDecoder){if(Fw(z(Te,this)))return;Aw(z(Te,this),50)}else B(Je,this,IS).call(this)}function IS(){z(Te,this)&&Fw(z(Te,this))&&Nw(z(Te,this))}function TS(){return null!=vh&&vh.performance&&"function"==typeof vh.performance.now?vh.performance.now():Date.now()}function ES(){if(z(Ce,this))return;if(void 0===vh.VideoDecoder)return;if(!z(Le,this))return;if(z(Oe,this)&&B(Je,this,TS).call(this)<z(Pe,this))return;const t=B(Je,this,SS).call(this);try{j(Fe,this,new vh.VideoDecoder({output:t=>B(Je,this,NS).call(this,t),error:t=>B(Je,this,AS).call(this,t)})),z(Fe,this).configure(t),j(Ce,this,!0),j(Se,this,!0),j(Oe,this,!1),j(Pe,this,0),B(Je,this,xS).call(this)}catch(t){this.log.warn("[#maybeConfigureDecoder] configure failed, falling back to placeholder decode",t),j(Fe,this,null),j(Ce,this,!1),j(Le,this,null)}}function SS(){const t={...z(Le,this)};return B(Je,this,qS).call(this,t)&&z(Be,this).codec?t.codec=z(Be,this).codec:!t.codec&&z(Re,this)&&(t.codec=z(Re,this)),z(De,this)&&!t.description&&(t.description=z(De,this)),z(Be,this).width&&!t.codedWidth&&(t.codedWidth=z(Be,this).width),z(Be,this).height&&!t.codedHeight&&(t.codedHeight=z(Be,this).height),B(Je,this,VS).call(this,t),t}function MS(){void 0!==vh.VideoDecoder&&void 0!==vh.EncodedVideoChunk&&(z(Oe,this)||!z(Me,this)||z(Ne,this)||z(Ae,this)||z(Ce,this)&&z(Fe,this)&&"function"==typeof z(Fe,this).flush&&(z(Ie,this).length||(j(Ae,this,!0),Promise.resolve().then((()=>z(Fe,this).flush())).then((()=>{j(Ne,this,!0),j(Se,this,!0)})).catch((t=>{"AbortError"!==(null==t?void 0:t.name)&&this.log.warn("[#maybeFlushDecoder] flush failed",t)})).finally((()=>{j(Ae,this,!1)})))))}function AS(t){if(this.log.warn("[#handleDecoderError] decoder error",t),this.trigger("decoder:error",{error:t}),z(Fe,this)&&"function"==typeof z(Fe,this).close)try{z(Fe,this).close()}catch(t){}j(Fe,this,null),j(Ce,this,!1),j(Ae,this,!1),j(Ne,this,!1),j(Se,this,!0),z(Ee,this).clear(),j(Oe,this,!0),j(Pe,this,B(Je,this,TS).call(this)+1e3)}function NS(t){j(Qe,this,z(Qe,this).then((()=>{var e;if(!this._disposed)return B(Je,this,DS).call(this,t);null===(e=t.close)||void 0===e||e.call(t)})).catch((e=>{this.log.warn("[#enqueueDecodedFrame] failed processing decoded frame",e);try{var n;null===(n=t.close)||void 0===n||n.call(t)}catch(t){}})))}function FS(t){return"boolean"!=typeof t||t}function CS(t){const e=Number(t);return!Number.isFinite(e)||e<0?.2:e}function OS(){return!!z(Xe,this)&&"function"==typeof vh.createImageBitmap&&z(Ke,this)}function PS(t){var e;const n=Number(null===(e=this.lastSegment)||void 0===e?void 0:e.duration);if(!Number.isFinite(n)||n<=0)return!1;if(!Number.isFinite(t))return!1;const i=Number(z(ze,this));return!!Number.isFinite(i)&&t>=i+n-z(Ye,this)}async function RS(t,e){try{var n;const i=B(Je,this,PS).call(this,e),r=await vh.createImageBitmap(t,{premultiplyAlpha:i?"none":"default"});return null!==(n=t.close)&&void 0!==n&&n.call(t),r}catch(e){return this.log.debug("[#maybeConvertFrameToBitmap] createImageBitmap failed",e),t}}async function DS(t){var e,n;let i=t;if(this._disposed)return void(null===(e=(n=i).close)||void 0===e||e.call(n));const r="number"==typeof t.timestamp?t.timestamp:void 0,o="number"==typeof t.timestamp?t.timestamp/$E:z(_e,this)?z(_e,this).call(this):0,s="number"==typeof t.duration?t.duration/$E:void 0;let a;void 0!==r&&(a=z(Ee,this).get(r),z(Ee,this).delete(r));try{var l,c,u,d;let e=z(_e,this)?z(_e,this).call(this):0,n=B(Je,this,yS).call(this,e);if(o<e||o>n)return void(null===(l=(c=i).close)||void 0===l||l.call(c));if(B(Je,this,OS).call(this)){var h,f,p,m;if(i=await B(Je,this,RS).call(this,t,o),this._disposed)return void(null===(h=(f=i).close)||void 0===h||h.call(f));if(e=z(_e,this)?z(_e,this).call(this):0,n=B(Je,this,yS).call(this,e),o<e||o>n)return void(null===(p=(m=i).close)||void 0===p||p.call(m))}if(B(Je,this,BS).call(this,e),this._disposed)return void(null===(u=(d=i).close)||void 0===u||u.call(d));const r={frame:i,pts:o,duration:s,isKey:void 0!==a&&a};z(be,this).push(r),B(Je,this,LS).call(this),this.trigger("decoder:frame",r),B(Je,this,bS).call(this,o),this.log.debug(`[#handleDecodedFrame] [${z(Be,this).codec}] Decoded frame:`,r)}catch(t){this.log.warn(`[#handleDecodedFrame] [${z(Be,this).codec}] Failed to handle decoded frame`,t);try{var v,g;null===(v=(g=i).close)||void 0===v||v.call(g)}catch(t){}}}function BS(t){const e=B(Je,this,yS).call(this,t),n=[];z(be,this).forEach((i=>{var r;const o=null!==(r=null==i?void 0:i.pts)&&void 0!==r?r:0;o<t||o>e||n.push(i)})),j(be,this,n)}function LS(){const t=z(xe,this);if(!Number.isFinite(t)||t<=0)return;if(z(be,this).length<=t)return;const e=z(be,this).length-t;z(be,this).splice(0,e)}function zS(t){const e=Number(t);return!Number.isFinite(e)||e<=0?0:Math.floor(e)}function WS(){const t=z(xe,this);return!(!Number.isFinite(t)||t<=0)&&z(be,this).length>=t}function jS(t){const e=Number(t);return!Number.isFinite(e)||e<=0?0:Math.floor(e)}function $S(){var t;const e=z(we,this);if(!Number.isFinite(e)||e<=0)return!1;const n=Number(null===(t=z(Fe,this))||void 0===t?void 0:t.decodeQueueSize);return!!Number.isFinite(n)&&n>=e}function US(t){return"string"==typeof t&&t.toLowerCase().startsWith("av01")}function qS(t){var e;return!1!==this.settings.av1ColorSpaceOverrideEnabled&&B(Je,this,US).call(this,(null===(e=z(Be,this))||void 0===e?void 0:e.codec)||(null==t?void 0:t.codec))}function VS(t){B(Je,this,qS).call(this,t)&&(t.colorSpace={...qE})}function GS(t){if(t&&Array.isArray(t.segments))for(let e=0;e<t.segments.length;e+=1){const n=t.segments[e];if(!Array.isArray(null==n?void 0:n.representations))continue;const i=n.chosenRepresentation||n.representations[0];if(null!=i&&i.codecs)return i.codecs;if(null!=i&&i.mime)return i.mime}}class HS extends fh{#q;get name(){return"DecoderFactory"}constructor(...t){super(...t);const e=t.length?t[t.length-1]:void 0;this.#q=e&&"object"==typeof e&&!Array.isArray(e)?e:{}}create(t,e=this.#q){if(!t||!t.type)return new _I(e);const n=KE[t.type];return n?(this.log.debug(`[#create] [${t.type}] Creating decoder:`,n),new n(e)):new _I(e)}}class KS{#V;#G;#H;#K;constructor(t={}){this.#V=t.getActiveRenderPlacement,this.#G=t.getPlacementsActiveAtTime,this.#H=t.ensureDecodedForPlacementAtTime;const e=Number(t.lookaheadSeconds);this.#K=Number.isFinite(e)&&e>=0?e:1}handleTimeUpdate(t={}){const e=Number(null==t?void 0:t.time);if(!Number.isFinite(e))return;if("function"!=typeof this.#H)return;const n="function"==typeof this.#G?this.#G:()=>[],i=n(e),r=new Set;i.forEach((t=>{null!=t&&t.placementId&&r.add(t.placementId),this.#H(t,e)}));const o=this.#K;if(!(o>0))return;const s=e+o;n(s).forEach((t=>{const e=null==t?void 0:t.placementId;e&&!r.has(e)&&this.#H(t,s)}))}dispose(){}}class XS{#X;#Y;#Q;#J;#Z;#tt;constructor(t={}){this.#X=t.getNode,this.#Y=t.getPlacementState,this.#Q=t.getDecodeTracks,this.#J=t.getSegmentIdForTrackAtTime,this.#Z=t.decodeLoadedMediaSegment,this.#tt=t.decodeLoadedMediaSegmentsAfter}ensureDecodedForPlacementAtTime(t,e){if(!t||!Number.isFinite(e))return;const n=null==t?void 0:t.placementId,i=null==t?void 0:t.nodeId;if(!n||!i)return;const r="function"==typeof this.#X?this.#X(i):void 0;if(!r)return;const o="function"==typeof this.#Y?this.#Y(n):void 0,s=null==o?void 0:o.trackStates;s&&"function"==typeof s.get&&("function"==typeof this.#Q?this.#Q(r).filter((t=>"video"===(null==t?void 0:t.type)||"image"===(null==t?void 0:t.type)||"audio"===(null==t?void 0:t.type))):[]).forEach((n=>{var i;const r=s.get(n.id);if(!r)return;const o="function"==typeof this.#J?this.#J(n,t,e):null;if(!o)return;const a=null==n||null===(i=n.segments)||void 0===i?void 0:i.find((t=>(null==t?void 0:t.id)===o));a&&!a.isInit&&a.retainedByteLength>0&&a.arrayBuffer&&(r.segmentDecoders&&"function"==typeof r.segmentDecoders.has&&r.segmentDecoders.has(o)||"function"!=typeof this.#Z||this.#Z(t,n,a),"video"===(null==n?void 0:n.type)&&"function"==typeof this.#tt&&this.#tt(t,n,a))}))}dispose(){}}const YS=new Set(["video","audio","image"]);function QS(t){const e=Number(t);return Number.isFinite(e)?e:0}var JS=new WeakMap,ZS=new WeakMap,tM=new WeakMap,eM=new WeakMap,nM=new WeakMap,iM=new WeakMap,rM=new WeakMap,oM=new WeakMap,sM=new WeakMap,aM=new WeakMap,lM=new WeakMap,cM=new WeakMap,uM=new WeakMap,dM=new WeakMap,hM=new WeakMap,fM=new WeakMap,pM=new WeakMap,mM=new WeakMap,vM=new WeakMap,gM=new WeakSet;class yM extends fh{constructor(...t){super(...t),$(this,gM),W(this,JS,void 0),W(this,ZS,void 0),W(this,tM,void 0),W(this,eM,void 0),W(this,nM,void 0),W(this,iM,void 0),W(this,rM,void 0),W(this,oM,void 0),W(this,sM,void 0),W(this,aM,void 0),W(this,lM,void 0),W(this,cM,new Map),W(this,uM,new Map),W(this,dM,new Map),W(this,hM,new Map),W(this,fM,new Set),W(this,pM,0),W(this,mM,!1),W(this,vM,null);const[e,n,i]=t;j(JS,this,e),j(ZS,this,n),j(tM,this,i||new HS),j(eM,this,new XS({getNode:t=>B(gM,this,UM).call(this,t),getPlacementState:t=>z(cM,this).get(t),getDecodeTracks:t=>B(gM,this,LM).call(this,t),getSegmentIdForTrackAtTime:(t,e,n)=>B(gM,this,EM).call(this,t,e,n),decodeLoadedMediaSegment:(t,e,n)=>{B(gM,this,cA).call(this,t,e,n)},decodeLoadedMediaSegmentsAfter:(t,e,n)=>{B(gM,this,eA).call(this,t,e,n)}})),j(nM,this,new KS({getActiveRenderPlacement:t=>{var e,n;return null===(e=z(ZS,this))||void 0===e||null===(n=e.getActiveRenderPlacement)||void 0===n?void 0:n.call(e,t)},getPlacementsActiveAtTime:t=>{var e,n;return(null===(e=z(ZS,this))||void 0===e||null===(n=e.getPlacementsActiveAtTime)||void 0===n?void 0:n.call(e,t))||[]},ensureDecodedForPlacementAtTime:(t,e)=>{var n,i;null===(n=z(eM,this))||void 0===n||null===(i=n.ensureDecodedForPlacementAtTime)||void 0===i||i.call(n,t,e)}})),B(gM,this,bM).call(this),B(gM,this,RM).call(this)}get name(){return"DecodeCoordinator"}onDispose(){var t,e;z(ZS,this)&&"function"==typeof z(ZS,this).off&&z(iM,this)&&z(ZS,this).off(yh.PLACEMENT_ADDED,z(iM,this)),z(ZS,this)&&"function"==typeof z(ZS,this).off&&z(rM,this)&&z(ZS,this).off(yh.TIMELINE_SEEKING,z(rM,this)),z(ZS,this)&&"function"==typeof z(ZS,this).off&&z(oM,this)&&z(ZS,this).off(yh.TIMELINE_SEEKED,z(oM,this)),z(ZS,this)&&"function"==typeof z(ZS,this).off&&z(sM,this)&&z(ZS,this).off(yh.TIMELINE_TIME_UPDATE,z(sM,this)),z(ZS,this)&&"function"==typeof z(ZS,this).off&&z(aM,this)&&z(ZS,this).off(yh.TIMELINE_RESET,z(aM,this)),B(gM,this,kM).call(this),j(iM,this,null),j(rM,this,null),j(oM,this,null),j(sM,this,null),j(aM,this,null),null!==(t=z(eM,this))&&void 0!==t&&null!==(e=t.dispose)&&void 0!==e&&e.call(t),j(eM,this,null),z(nM,this)&&"function"==typeof z(nM,this).dispose&&z(nM,this).dispose(),j(nM,this,null),z(uM,this).forEach(((t,e)=>{const n=B(gM,this,UM).call(this,e);n&&"function"==typeof n.off&&n.off("node:loaded",t)})),z(uM,this).clear(),z(dM,this).forEach(((t,e)=>{const n=B(gM,this,UM).call(this,e);n&&"function"==typeof n.off&&n.off("segment:chunk",t)})),z(dM,this).clear(),z(hM,this).clear(),z(fM,this).clear(),B(gM,this,FM).call(this),z(cM,this).forEach((({trackStates:t})=>{t&&t.forEach((t=>{B(gM,this,HM).call(this,t)}))})),z(cM,this).clear()}}function bM(){z(ZS,this)&&"function"==typeof z(ZS,this).on&&(j(iM,this,(t=>{B(gM,this,DM).call(this,t)})),z(ZS,this).on(yh.PLACEMENT_ADDED,z(iM,this)),j(rM,this,(t=>B(gM,this,xM).call(this,t))),z(ZS,this).on(yh.TIMELINE_SEEKING,z(rM,this)),j(oM,this,(()=>B(gM,this,wM).call(this))),z(ZS,this).on(yh.TIMELINE_SEEKED,z(oM,this)),j(sM,this,(t=>B(gM,this,_M).call(this,t))),z(ZS,this).on(yh.TIMELINE_TIME_UPDATE,z(sM,this)),j(aM,this,(()=>B(gM,this,IM).call(this))),z(ZS,this).on(yh.TIMELINE_RESET,z(aM,this))),(null==vh?void 0:vh.document)&&"function"==typeof vh.document.addEventListener&&(j(lM,this,(()=>{B(gM,this,CM).call(this)})),vh.document.addEventListener("visibilitychange",z(lM,this)))}function kM(){z(lM,this)&&null!=vh&&vh.document&&"function"==typeof vh.document.removeEventListener&&vh.document.removeEventListener("visibilitychange",z(lM,this)),j(lM,this,null)}function xM(t={}){const e=Number(null==t?void 0:t.targetTime);Number.isFinite(e)&&(z(cM,this).forEach((t=>{const n=null==t?void 0:t.trackStates;n&&n.forEach((n=>{var i;const r=null==n||null===(i=n.track)||void 0===i?void 0:i.type;"video"!==r&&"image"!==r&&"audio"!==r||(B(gM,this,TM).call(this,n,null==t?void 0:t.placement,e),n.seekSegmentId=null)}))})),(Array.isArray(null==t?void 0:t.placements)?t.placements:[]).forEach((t=>{const n=null==t?void 0:t.placementId,i=null==t?void 0:t.nodeId;if(!n||!i)return;const r=z(cM,this).get(n);if(!r||!r.trackStates)return;const o=B(gM,this,UM).call(this,i);o&&(r.trackStates.forEach((n=>{const i=null==n?void 0:n.track;!i||"video"!==i.type&&"image"!==i.type&&"audio"!==i.type||B(gM,this,TM).call(this,n,r.placement||t,e)})),B(gM,this,tA).call(this,r.placement||t,o))})))}function wM(){z(cM,this).forEach((t=>{const e=null==t?void 0:t.trackStates;e&&e.forEach((t=>{var e;const n=null==t||null===(e=t.track)||void 0===e?void 0:e.type;"video"!==n&&"image"!==n&&"audio"!==n||(t.seekSegmentId=null)}))}))}function _M(t={}){var e,n;B(gM,this,ZM).call(this,null==t?void 0:t.time),null!==(e=z(nM,this))&&void 0!==e&&null!==(n=e.handleTimeUpdate)&&void 0!==n&&n.call(e,t),B(gM,this,CM).call(this),B(gM,this,KM).call(this,null==t?void 0:t.time)}function IM(){z(uM,this).forEach(((t,e)=>{const n=B(gM,this,UM).call(this,e);n&&"function"==typeof n.off&&n.off("node:loaded",t)})),z(uM,this).clear(),z(dM,this).forEach(((t,e)=>{const n=B(gM,this,UM).call(this,e);n&&"function"==typeof n.off&&n.off("segment:chunk",t)})),z(dM,this).clear(),z(hM,this).clear(),z(fM,this).clear(),z(cM,this).forEach((({trackStates:t})=>{t&&t.forEach((t=>{const e=null==t?void 0:t.segmentDecoders;e&&e.forEach((t=>{t&&"function"==typeof t.dispose&&t.dispose()}))}))})),z(cM,this).clear()}function TM(t,e,n){t&&(B(gM,this,HM).call(this,t),t.seekSegmentId=B(gM,this,EM).call(this,t.track,e,n))}function EM(t,e,n){if(!t||!e||!Array.isArray(t.segments))return null;const i=Tv(e);if(!Number.isFinite(i))return null;const r=QS(null==e?void 0:e.nodeOffsetOverride),o=Math.max(0,n-i+r),s=QS(null==t?void 0:t.offset),a=Math.max(0,o-s),l="function"==typeof t.getMediaSegmentAtTime?t.getMediaSegmentAtTime(a,{preferRepresentationTime:!0}):Sk(t.segments,a,{preferRepresentationTime:!0});return(null==l?void 0:l.id)||null}function SM(t){if(!t)return!1;const e=null==t?void 0:t.name;if("QuotaExceededError"===e)return!0;if("EncodingError"===e)return!0;const n="string"==typeof(null==t?void 0:t.message)?t.message:"";return!!n.includes("Decoder failure")||!!n.includes("Codec reclaimed due to inactivity")||!("OperationError"!==e||!n.includes("initialize after flush"))}function MM(){const t=null==vh?void 0:vh.document;return!t||"string"!=typeof t.visibilityState||"visible"===t.visibilityState}function AM(){var t;const e=z(ZS,this);if(!e||"number"!=typeof e.currentTime)return!1;if(e.state===Dg)return!1;const n=Date.now();if(n<z(pM,this))return!1;const i=e.currentTime;if(!Number.isFinite(i))return!1;const r="function"==typeof e.getPlacementsActiveAtTime?e.getPlacementsActiveAtTime(i):[],o=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.snapToFps),s=Number.isFinite(o)&&o>0?1/o:1/60;let a;if(Array.isArray(r)&&r.length)a=i+s;else if(a=B(gM,this,NM).call(this,i),!Number.isFinite(a))return!1;return j(pM,this,n+1500),this.log.warn("[DecodeCoordinator] attempting decoder recovery seek"),e.currentTime=a,!0}function NM(t){var e;const n=z(ZS,this);if(!n)return null;const i=Array.isArray(n.placements)?n.placements:[];if(!i.length)return null;const r=Number(t);if(!Number.isFinite(r))return null;const o=Number(null==n||null===(e=n.settings)||void 0===e?void 0:e.snapToFps),s=Number.isFinite(o)&&o>0?1/o:1/60;let a=Number.NEGATIVE_INFINITY,l=null,c=Number.NEGATIVE_INFINITY,u=null,d=null;return i.forEach((t=>{const e=Tv(t);if(!Number.isFinite(e))return;(!Number.isFinite(d)||e<d)&&(d=e);const n=_v(t,z(JS,this)),i=Number.isFinite(n),o=i?e+n:e;(o>e||!i)&&((o>a||!Number.isFinite(a)&&Number.isFinite(o))&&(a=o,l=e),o<=r&&o>c&&(c=o,u=i?Math.max(e,o-s):e))})),Number.isFinite(l)&&Number.isFinite(a)&&r>=a-s?l:Number.isFinite(u)?u:Number.isFinite(d)?d:null}function FM(){j(mM,this,!1),j(vM,this,null)}function CM(){z(mM,this)&&B(gM,this,MM).call(this)&&B(gM,this,AM).call(this)}function OM(t){if(!B(gM,this,SM).call(this,t))return;const e=z(ZS,this);e&&"number"==typeof e.currentTime&&(j(mM,this,!0),j(vM,this,t),B(gM,this,MM).call(this)&&B(gM,this,AM).call(this))}function PM(t){var e;return!!t&&(Array.isArray(null===(e=z(ZS,this))||void 0===e?void 0:e.placements)?z(ZS,this).placements:[]).includes(t)}function RM(t){var e;(Array.isArray(null===(e=z(ZS,this))||void 0===e?void 0:e.placements)?[...z(ZS,this).placements]:[]).filter((e=>"function"!=typeof t||t(e))).sort(((t,e)=>{const n=Tv(t),i=Tv(e);return(Number.isFinite(n)?n:Number.POSITIVE_INFINITY)-(Number.isFinite(i)?i:Number.POSITIVE_INFINITY)})).forEach((t=>{B(gM,this,DM).call(this,t)}))}async function DM(t){if(!t||!t.placementId||z(cM,this).has(t.placementId))return;if(!B(gM,this,PM).call(this,t))return;const e=t.nodeId;if(!e||!z(JS,this)||"function"!=typeof z(JS,this).get)return;const n=B(gM,this,UM).call(this,e);if(n){if(n.state&&"ready"!==n.state){if("function"==typeof n.resolve)try{await n.resolve()}catch(n){if(!B(gM,this,PM).call(this,t))return;return void this.log.warn(`[#processPlacement] Failed to resolve node ${e}`,n)}if(!B(gM,this,PM).call(this,t))return;if("ready"!==n.state)return}if(B(gM,this,JM).call(this,t))return B(gM,this,QM).call(this,t,n),void z(fM,this).add(t.placementId);B(gM,this,YM).call(this,t,n)}}function BM(t){return B(gM,this,LM).call(this,t).every((t=>B(gM,this,XM).call(this,t)))}function LM(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).filter((t=>YS.has(null==t?void 0:t.type)))}function zM(t){if(!t||!t.id||"function"!=typeof t.on)return;if(z(uM,this).has(t.id))return;const e=()=>{B(gM,this,nA).call(this,t.id)};t.on("node:loaded",e),z(uM,this).set(t.id,e)}function WM(t){if(!t||!t.id||"function"!=typeof t.on)return;if(z(dM,this).has(t.id))return;const e=t=>B(gM,this,iA).call(this,t);t.on("segment:chunk",e),z(dM,this).set(t.id,e)}function jM(t,e){if(!t||!e)return;const n=z(hM,this).get(t)||new Set;n.add(e),z(hM,this).set(t,n)}function $M(t){return z(hM,this).get(t)||new Set}function UM(t){if(t&&z(JS,this)&&"function"==typeof z(JS,this).get)return z(JS,this).get(t)}function qM(t){if(!t)return;const e=t.fullBufferRetryTimer;null!=e&&("function"==typeof(null==vh?void 0:vh.clearTimeout)?vh.clearTimeout.bind(vh):clearTimeout)(e),t.fullBufferRetryTimer=null,t.fullBufferDecodeScheduled=!1,t.fullBufferRetryAttempts=0}function VM(t){const e=null==t?void 0:t.segmentStates;e&&"function"==typeof e.forEach&&e.forEach((t=>{B(gM,this,qM).call(this,t)}))}function GM(t,e,n,i){var r,o;if(!(t&&e&&n&&i))return!1;const s=z(cM,this).get(t),a=null==s||null===(r=s.trackStates)||void 0===r?void 0:r.get(e);return(null==a||null===(o=a.segmentStates)||void 0===o?void 0:o.get(n))===i}function HM(t){if(!t)return;B(gM,this,VM).call(this,t);const e=t.segmentDecoders;e&&"function"==typeof e.forEach&&(e.forEach((t=>{if(t&&"function"==typeof t.dispose)try{t.dispose()}catch(t){}})),"function"==typeof e.clear&&e.clear()),t.segmentStates&&"function"==typeof t.segmentStates.clear&&t.segmentStates.clear(),t.ready=!1,t.seekSegmentId=null}function KM(t){const e=QS(t);if(!Number.isFinite(e))return;const n=e-2;Number.isFinite(n)&&z(cM,this).forEach((t=>{const e=null==t?void 0:t.placement;if(!e)return;const i=Tv(e),r=_v(e,z(JS,this),{allowUnready:!0});if(!Number.isFinite(i)||!Number.isFinite(r))return;const o=i+r;if(!Number.isFinite(o)||o>n)return;const s=null==t?void 0:t.trackStates;s&&"function"==typeof s.forEach&&s.forEach((t=>{var e;const n=null==t||null===(e=t.track)||void 0===e?void 0:e.type;"video"!==n&&"image"!==n&&"audio"!==n||B(gM,this,HM).call(this,t)}))}))}function XM(t){if(!t||!Array.isArray(t.segments))return!1;const e=t.segments.find((t=>null==t?void 0:t.isInit));if(e&&!(e.retainedByteLength>0))return!1;const n=t.segments.find((t=>t&&!t.isInit));return!n||n.retainedByteLength>0}function YM(t,e){if(this.log.debug(`[#startDecode] [${t.placementId}] [${e.id}] Starting decode`),B(gM,this,QM).call(this,t,e)){if(B(gM,this,jM).call(this,e.id,t.placementId),!B(gM,this,BM).call(this,e))return B(gM,this,zM).call(this,e),void B(gM,this,WM).call(this,e);B(gM,this,tA).call(this,t,e),B(gM,this,WM).call(this,e)}}function QM(t,e){if(!t||!t.placementId||!e)return;const n=z(cM,this).get(t.placementId);if(n)return n.placement=t,n;const i=B(gM,this,LM).call(this,e),r=new Map;i.forEach((n=>{try{const t=n.segments.some((t=>null==t?void 0:t.isInit));r.set(n.id,{hasInit:t,track:n,ready:!1,segmentDecoders:new Map,segmentStates:new Map})}catch(i){this.trigger(yh.DECODE_ERROR,xh({placementId:t.placementId,nodeId:e.id,trackId:null==n?void 0:n.id,trackType:null==n?void 0:n.type,error:i}))}}));const o={trackStates:r,nodeId:e.id,placement:t};return z(cM,this).set(t.placementId,o),o}function JM(t){var e;const n=Tv(t),i=QS(null===(e=z(ZS,this))||void 0===e?void 0:e.currentTime);return!Number.isFinite(n)||!!Number.isFinite(i)&&n-i>2}function ZM(t){if(!z(fM,this).size)return;const e=QS(t);if(!Number.isFinite(e))return;const n=[];z(fM,this).forEach((t=>{const i=z(cM,this).get(t),r=null==i?void 0:i.placement;if(!r)return void n.push(t);const o=Tv(r);Number.isFinite(o)&&o-e<=2&&n.push(t)})),n.forEach((t=>{z(fM,this).delete(t);const e=z(cM,this).get(t),n=null==e?void 0:e.placement;if(!n)return;const i=B(gM,this,UM).call(this,n.nodeId);i&&B(gM,this,YM).call(this,n,i)}))}function tA(t,e){const n=z(cM,this).get(t.placementId);n&&B(gM,this,LM).call(this,e).forEach((i=>{const r=n.trackStates.get(i.id);if(r&&!r.ready)try{let n;if(r.seekSegmentId&&(n=i.segments.find((t=>t&&!t.isInit&&t.id===r.seekSegmentId&&t.retainedByteLength>0)),!n))return;if(n||(n=i.segments.find((t=>t&&!t.isInit&&t.retainedByteLength>0))),!n)return;B(gM,this,cA).call(this,t,i,n),r.seekSegmentId&&"video"===(null==i?void 0:i.type)&&B(gM,this,eA).call(this,t,i,n),r.ready=!0,this.trigger(yh.DECODE_READY,kh({placementId:t.placementId,nodeId:e.id,trackId:i.id,trackType:i.type}))}catch(n){this.trigger(yh.DECODE_ERROR,xh({placementId:t.placementId,nodeId:e.id,trackId:null==i?void 0:i.id,trackType:null==i?void 0:i.type,error:n}))}}))}function eA(t,e,n){var i;if(!(t&&e&&n&&Array.isArray(e.segments)))return;const r=null==t?void 0:t.placementId,o=r?z(cM,this).get(r):void 0,s=null==o||null===(i=o.trackStates)||void 0===i?void 0:i.get(e.id),a=null==s?void 0:s.segmentDecoders;if(!a||"function"!=typeof a.has)return;const l=e.segments,c=l.findIndex((t=>(null==t?void 0:t.id)===n.id));if(c<0)return;let u=0;for(let n=c+1;n<l.length;n+=1){const i=l[n];if(!i||i.isInit)continue;if(a.has(i.id))continue;if(!(i.retainedByteLength>0))break;const r=i.arrayBuffer;if(!r||"number"!=typeof r.byteLength||r.byteLength<=0)break;if(B(gM,this,cA).call(this,t,e,i),u+=1,u>=2)break}}function nA(t){const e=B(gM,this,UM).call(this,t);e&&B(gM,this,BM).call(this,e)&&B(gM,this,$M).call(this,t).forEach((t=>{const n=z(cM,this).get(t);B(gM,this,tA).call(this,(null==n?void 0:n.placement)||{placementId:t},e)}))}function iA(t){t&&t.nodeId&&t.trackId&&t.chunk&&B(gM,this,$M).call(this,t.nodeId).forEach((e=>B(gM,this,rA).call(this,e,t)))}function rA(t,e){const n=z(cM,this).get(t);if(!n)return;const i=n.trackStates.get(e.trackId);if(i)try{var r,o;if(e.isInit)return;const s=i.track,a=null==s||null===(r=s.segments)||void 0===r?void 0:r.find((t=>(null==t?void 0:t.id)===e.segmentId));if(!a||a.isInit)return;if("image"===(null==s?void 0:s.type))return void(!i.ready&&a.retainedByteLength>0&&B(gM,this,cA).call(this,n.placement,s,a)&&(i.ready=!0,this.trigger(yh.DECODE_READY,kh({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType}))));if((null===(o=z(ZS,this))||void 0===o?void 0:o.state)===Dg&&i.seekSegmentId&&("video"===(null==s?void 0:s.type)||"audio"===(null==s?void 0:s.type))&&a.id!==i.seekSegmentId)return;const l=a.id,c=i.segmentStates.get(l)||{initSent:!1,pendingChunks:[],ended:!1,firstChunkObserved:!1,missedSegmentPrefix:!1,fullBufferDecodeScheduled:!1,fullBufferRetryTimer:null,fullBufferRetryAttempts:0};i.segmentStates.set(l,c);const u=B(gM,this,aA).call(this,n.placement,s,a);if(!u||"function"!=typeof u.decodeChunk)return;if(i.hasInit&&!c.initSent){const t=B(gM,this,lA).call(this,s,a);if(!t)return void c.pendingChunks.push({chunk:e.chunk,loaded:e.loaded,total:e.total});u.decodeChunk(t,{isInit:!0}),c.initSent=!0,c.pendingChunks.length&&(c.pendingChunks.forEach((t=>{u.decodeChunk(t.chunk,{isInit:!1,loaded:t.loaded,total:t.total})})),c.pendingChunks=[])}const d="number"==typeof e.loaded&&"number"==typeof e.total&&e.total>0&&e.loaded>=e.total;B(gM,this,oA).call(this,c,e)?d&&!c.ended&&B(gM,this,sA).call(this,n.placement,s,a,c):(u.decodeChunk(e.chunk,{isInit:!1,loaded:e.loaded,total:e.total}),d&&!c.ended&&"function"==typeof u.endOfStream&&(c.ended=!0,u.endOfStream())),i.ready||(i.ready=!0,this.trigger(yh.DECODE_READY,kh({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType})))}catch(n){this.trigger(yh.DECODE_ERROR,xh({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType,error:n}))}}function oA(t,e){var n;if(!t||t.missedSegmentPrefix)return!(null==t||!t.missedSegmentPrefix);if(t.firstChunkObserved)return!1;t.firstChunkObserved=!0;const i=Number(null==e?void 0:e.loaded),r=Number(null==e||null===(n=e.chunk)||void 0===n?void 0:n.byteLength);return!(!Number.isFinite(i)||!Number.isFinite(r)||r<=0)&&(t.missedSegmentPrefix=i>r,t.missedSegmentPrefix)}function sA(t,e,n,i){if(!t||!e||!n||!i||i.fullBufferDecodeScheduled)return;const r=null==t?void 0:t.placementId,o=null==e?void 0:e.id,s=null==n?void 0:n.id;if(!r||!o||!s)return;const a="function"==typeof(null==vh?void 0:vh.setTimeout)?vh.setTimeout.bind(vh):setTimeout;i.fullBufferDecodeScheduled=!0,i.fullBufferRetryAttempts=0;const l=()=>{if(!B(gM,this,GM).call(this,r,o,s,i)||i.ended)return void B(gM,this,qM).call(this,i);if(B(gM,this,cA).call(this,t,e,n))return void B(gM,this,qM).call(this,i);i.fullBufferRetryAttempts+=1;const c=i.fullBufferRetryAttempts<=8?0:50;i.fullBufferRetryTimer=a((()=>{l()}),c)};i.fullBufferRetryTimer=a((()=>{l()}),0)}function aA(t,e,n){var i,r;const o=null==t?void 0:t.placementId;if(!o||!e||!n)return;const s=z(cM,this).get(o),a=null==s||null===(i=s.trackStates)||void 0===i?void 0:i.get(e.id);if(!a)return;const l=a.segmentDecoders.get(n.id);if(l)return l;const c=z(tM,this).create(e);if(c&&"function"==typeof c.configure&&c.configure(e),c&&"function"==typeof c.setNodeId&&c.setNodeId(null==t?void 0:t.nodeId),c&&"function"==typeof c.setSegment&&c.setSegment(n),c&&"function"==typeof c.setCurrentTimeProvider&&c.setCurrentTimeProvider((()=>{var t;return"number"==typeof(null===(t=z(ZS,this))||void 0===t?void 0:t.currentTime)?z(ZS,this).currentTime:0})),c&&"function"==typeof c.setTimeOffsetSeconds){var u,d;const i=Tv(t),r=QS(null==e?void 0:e.offset),o=QS(null!==(u=null==n||null===(d=n.chosenRepresentation)||void 0===d?void 0:d.segStart)&&void 0!==u?u:null==n?void 0:n.offset);Number.isFinite(i)&&c.setTimeOffsetSeconds(i+r+o)}return c&&"function"==typeof c.setSeekTargetTimeSeconds&&(null===(r=z(ZS,this))||void 0===r?void 0:r.state)===Dg&&"video"===(null==e?void 0:e.type)&&c.setSeekTargetTimeSeconds(z(ZS,this).currentTime),c&&"function"==typeof c.on&&(c.on(yh.DECODER_FRAME,(i=>{i&&(!z(mM,this)||"video"!==(null==e?void 0:e.type)&&"image"!==(null==e?void 0:e.type)||(j(mM,this,!1),j(vM,this,null)),z(ZS,this)&&"function"==typeof z(ZS,this).notifyDecodedFrame&&(i.frame||i.data)&&z(ZS,this).notifyDecodedFrame({placementId:o,nodeId:null==t?void 0:t.nodeId,trackId:null==e?void 0:e.id,trackType:null==e?void 0:e.type,segmentId:null==n?void 0:n.id,pts:i.pts,duration:i.duration,frame:i.frame,data:i.data}))})),c.on(yh.DECODER_AUDIO,(i=>{i&&i.audioBuffer&&this.trigger(yh.DECODER_AUDIO,kh({placementId:o,nodeId:null==t?void 0:t.nodeId,trackId:null==e?void 0:e.id,trackType:null==e?void 0:e.type,segmentId:null==n?void 0:n.id,pts:i.pts,duration:i.duration,audioBuffer:i.audioBuffer}))})),c.on(yh.DECODER_ERROR,(i=>{const r=(null==i?void 0:i.error)||i;this.trigger(yh.DECODER_ERROR,xh({placementId:o,nodeId:null==t?void 0:t.nodeId,trackId:null==e?void 0:e.id,trackType:null==e?void 0:e.type,segmentId:null==n?void 0:n.id,error:r})),B(gM,this,OM).call(this,r)}))),a.segmentDecoders.set(n.id,c),c}function lA(t,e){var n,i;if(!t||!e||!Array.isArray(t.segments))return;const r=t.segments.find((t=>null==t?void 0:t.isInit));if(!r||"function"!=typeof r.getRepresentationBuffer)return;const o=(null==e||null===(n=e.chosenRepresentation)||void 0===n?void 0:n.id)||(null==e||null===(i=e.representations)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.id);if(!o)return;const s=r.getRepresentationBuffer(o);return s?s instanceof Uint8Array?s:new Uint8Array(s):void 0}function cA(t,e,n){var i;if(!t||!e||!n)return!1;const r=t.placementId,o=z(cM,this).get(r),s=null==o||null===(i=o.trackStates)||void 0===i?void 0:i.get(e.id);if(!s)return!1;const a=B(gM,this,aA).call(this,t,e,n);if(!a||"function"!=typeof a.decodeChunk)return!1;const l=s.segmentStates.get(n.id)||{initSent:!1,pendingChunks:[],ended:!1,firstChunkObserved:!1,missedSegmentPrefix:!1,fullBufferDecodeScheduled:!1,fullBufferRetryTimer:null,fullBufferRetryAttempts:0};if(s.segmentStates.set(n.id,l),l.ended)return B(gM,this,qM).call(this,l),!0;if(s.hasInit&&!l.initSent){const t=B(gM,this,lA).call(this,e,n);if(!t)return!1;a.decodeChunk(t,{isInit:!0}),l.initSent=!0}const c=n.arrayBuffer;return!(!c||"number"!=typeof c.byteLength||c.byteLength<=0||(a.decodeChunk(new Uint8Array(c),{isInit:!1,loaded:c.byteLength,total:c.byteLength}),l.ended||"function"!=typeof a.endOfStream||(l.ended=!0,a.endOfStream()),B(gM,this,qM).call(this,l),0))}const uA=1e-6;var dA=new WeakMap,hA=new WeakMap,fA=new WeakMap,pA=new WeakMap,mA=new WeakMap,vA=new WeakMap,gA=new WeakMap,yA=new WeakMap,bA=new WeakSet;class kA extends fh{get name(){return"TransitionManager"}get defaults(){return{durationSeconds:.5}}constructor(t,e,n){super(n),$(this,bA),W(this,dA,void 0),W(this,hA,void 0),W(this,fA,null),W(this,pA,null),W(this,mA,null),W(this,vA,0),W(this,gA,[]),W(this,yA,null),j(dA,this,t),j(hA,this,e),z(dA,this)&&"function"==typeof z(dA,this).on&&(j(yA,this,(()=>B(bA,this,AA).call(this))),z(dA,this).on(yh.TIMELINE_RESET,z(yA,this)))}transitionTo(t,e={}){const n=Number(t);if(!Number.isFinite(n))throw new Error("TransitionManager.transitionTo requires a numeric time");B(bA,this,AA).call(this);const i=B(bA,this,xA).call(this),r=B(bA,this,TA).call(this,n,e);return r?B(bA,this,EA).call(this,n,e,i,r):Promise.resolve()}onDispose(){z(dA,this)&&"function"==typeof z(dA,this).off&&z(yA,this)&&z(dA,this).off(yh.TIMELINE_RESET,z(yA,this)),j(yA,this,null),B(bA,this,AA).call(this),j(hA,this,null),j(dA,this,null)}}function xA(){return j(vA,this,z(vA,this)+1),z(vA,this)}function wA(t={}){var e;const n=Number(null==t?void 0:t.duration),i=Number(null===(e=this.settings)||void 0===e?void 0:e.durationSeconds);return Number.isFinite(n)?n:i}function _A(t={},e){return{duration:e,filter:null==t?void 0:t.filter,color:null==t?void 0:t.color,filters:null==t?void 0:t.filters,reverseFilters:null==t?void 0:t.reverseFilters,transition:null==t?void 0:t.transition}}function IA(t,e){const n=1e3*t,i=Number.isFinite(Number(null==e?void 0:e.outDurationMs))&&e.outDurationMs>0?e.outDurationMs:n;return{outDurationMs:i,inDurationMs:Number.isFinite(Number(null==e?void 0:e.inDurationMs))&&e.inDurationMs>0?e.inDurationMs:i}}function TA(t,e={}){var n;const i=z(hA,this),r=B(bA,this,wA).call(this,e);if(!i||"function"!=typeof i.startTransition)return z(dA,this).currentTime=t,null;if(!(r>0))return z(dA,this).currentTime=t,null!==(n=i.resetTransition)&&void 0!==n&&n.call(i),null;const o=B(bA,this,_A).call(this,e,r);"function"==typeof(null==e?void 0:e.onTransitionInStart)&&e.onTransitionInStart();const s=i.startTransition(o),{outDurationMs:a,inDurationMs:l}=B(bA,this,IA).call(this,r,s);return{renderer:i,transitionOptions:o,outDurationMs:a,inDurationMs:l,shouldWaitForFrames:!1!==(null==e?void 0:e.waitForVisualFrames)}}function EA(t,e={},n,i){const{renderer:r,transitionOptions:o,outDurationMs:s,inDurationMs:a,shouldWaitForFrames:l}=i,c=B(bA,this,PA).call(this,t,e,n),u=l?B(bA,this,RA).call(this,t,n):Promise.resolve();let d=!1,h=!1,f=!1,p=!l;const m=()=>{var t;B(bA,this,NA).call(this,n)&&!f&&d&&h&&p&&(f=!0,"function"==typeof(null==e?void 0:e.onTransitionInEnd)&&e.onTransitionInEnd(),"function"==typeof(null==e?void 0:e.onTransitionOutStart)&&e.onTransitionOutStart(),null!==(t=r.beginTransitionIn)&&void 0!==t&&t.call(r,o),j(pA,this,setTimeout((()=>{var t;B(bA,this,NA).call(this,n)&&(null!==(t=r.resetTransition)&&void 0!==t&&t.call(r),"function"==typeof(null==e?void 0:e.onTransitionOutEnd)&&e.onTransitionOutEnd(),B(bA,this,SA).call(this))}),a)))};return j(fA,this,setTimeout((()=>{d=!0,m()}),s)),c.then((()=>{h=!0,m()})).catch((()=>{var t;B(bA,this,NA).call(this,n)&&(null!==(t=r.resetTransition)&&void 0!==t&&t.call(r),B(bA,this,SA).call(this))})),u.then((()=>{p=!0,m()})).catch((()=>{p=!0,m()})),z(dA,this).currentTime=t,new Promise((t=>{j(mA,this,t)}))}function SA(){const t=z(mA,this);j(mA,this,null),B(bA,this,MA).call(this),B(bA,this,OA).call(this),t&&t()}function MA(){z(fA,this)&&clearTimeout(z(fA,this)),z(pA,this)&&clearTimeout(z(pA,this)),j(fA,this,null),j(pA,this,null)}function AA(){var t,e;z(hA,this)&&null!==(t=(e=z(hA,this)).resetTransition)&&void 0!==t&&t.call(e),B(bA,this,MA).call(this),B(bA,this,OA).call(this),z(mA,this)&&(z(mA,this).call(this),j(mA,this,null))}function NA(t){return z(vA,this)===t}function FA(t,e){z(dA,this)&&"function"==typeof z(dA,this).on&&(z(dA,this).on(t,e),z(gA,this).push({eventName:t,handler:e}))}function CA(t,e){z(dA,this)&&"function"==typeof z(dA,this).off&&(z(dA,this).off(t,e),j(gA,this,z(gA,this).filter((n=>n.eventName!==t||n.handler!==e))))}function OA(){z(dA,this)&&"function"==typeof z(dA,this).off?(z(gA,this).forEach((t=>{z(dA,this).off(t.eventName,t.handler)})),j(gA,this,[])):j(gA,this,[])}function PA(t,e,n){const i=null==e?void 0:e.transitionOutPromise;if(i&&"function"==typeof i.then)return i;if("function"==typeof i)try{const t=i();if(t&&"function"==typeof t.then)return t}catch(t){return Promise.resolve()}if(!z(dA,this)||"function"!=typeof z(dA,this).on)return Promise.resolve();const r=B(bA,this,DA).call(this);return new Promise((e=>{let i=!1;const o=r?yh.TIMELINE_SEEKED:"nodestart";let s,a;const l=()=>{B(bA,this,CA).call(this,yh.TIMELINE_SEEKING,s),B(bA,this,CA).call(this,o,a),e()};s=(e={})=>{B(bA,this,NA).call(this,n)?B(bA,this,BA).call(this,e,t)&&(i=!0):l()},a=(e={})=>{B(bA,this,NA).call(this,n)?(o!==yh.TIMELINE_SEEKED||B(bA,this,BA).call(this,e,t))&&(o===yh.TIMELINE_SEEKED||i)&&l():l()},B(bA,this,FA).call(this,yh.TIMELINE_SEEKING,s),B(bA,this,FA).call(this,o,a)}))}function RA(t,e){if(!z(dA,this)||"function"!=typeof z(dA,this).on)return Promise.resolve();const n=Number(t);return new Promise((t=>{const i=(r={})=>{if(!B(bA,this,NA).call(this,e))return B(bA,this,CA).call(this,yh.VISUAL_FRAMES_AVAILABLE,i),void t();const o=Number(null==r?void 0:r.time);Number.isFinite(n)&&Number.isFinite(o)&&o+uA<n||(Array.isArray(null==r?void 0:r.frames)?r.frames:[]).length&&(B(bA,this,CA).call(this,yh.VISUAL_FRAMES_AVAILABLE,i),t())};B(bA,this,FA).call(this,yh.VISUAL_FRAMES_AVAILABLE,i)}))}function DA(){var t,e;const n=null===(t=z(dA,this))||void 0===t?void 0:t.state;if(n===Rg||n===Fg)return!0;const i=null===(e=z(dA,this))||void 0===e?void 0:e.placements;return!Array.isArray(i)||0===i.length}function BA(t,e){const n=Number(null==t?void 0:t.targetTime);return!Number.isFinite(n)||Math.abs(n-e)<uA}function LA(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}var zA=new WeakMap,WA=new WeakMap,jA=new WeakMap,$A=new WeakMap,UA=new WeakMap,qA=new WeakMap,VA=new WeakMap,GA=new WeakMap,HA=new WeakMap,KA=new WeakMap,XA=new WeakMap,YA=new WeakMap,QA=new WeakMap,JA=new WeakMap,ZA=new WeakSet;class tN extends fh{get name(){return"AudioPlaybackManager"}get defaults(){return{muted:!1,volume:1,lookaheadSeconds:1}}constructor(t,e,n){super(n),$(this,ZA),W(this,zA,void 0),W(this,WA,void 0),W(this,jA,null),W(this,$A,null),W(this,UA,[]),W(this,qA,new Set),W(this,VA,new Map),W(this,GA,!1),W(this,HA,1),W(this,KA,!0),W(this,XA,null),W(this,YA,null),W(this,QA,null),W(this,JA,null),j(zA,this,t),j(WA,this,e),j(GA,this,!!this.settings.muted),j(HA,this,xv(this.settings.volume));const i=Array.isArray(null==n?void 0:n.disabledTracks)?n.disabledTracks:[];j(KA,this,!i.includes("audio")),B(ZA,this,eN).call(this)}get muted(){return z(GA,this)}set muted(t){j(GA,this,!!t),B(ZA,this,hN).call(this)}get volume(){return z(HA,this)}set volume(t){j(HA,this,xv(t)),B(ZA,this,hN).call(this)}handleDecodedAudio(t={}){if(!z(KA,this))return;const e=null==t?void 0:t.audioBuffer,n=null==t?void 0:t.placementId,i=null==t?void 0:t.segmentId,r=LA(null==t?void 0:t.pts,null);if(!(e&&n&&i&&Number.isFinite(r)))return;const o=Number.isFinite(null==t?void 0:t.duration)?t.duration:e.duration,s=`${n}:${i}`;z(qA,this).has(s)||(z(UA,this).push({key:s,placementId:n,pts:r,duration:o,audioBuffer:e}),z(UA,this).sort(((t,e)=>t.pts-e.pts)),B(ZA,this,sN).call(this))}onDispose(){B(ZA,this,nN).call(this),B(ZA,this,uN).call(this,!0),z(jA,this)&&"function"==typeof z(jA,this).close&&z(jA,this).close(),j(jA,this,null),j($A,this,null),j(zA,this,null),j(WA,this,null)}}function eN(){z(zA,this)&&"function"==typeof z(zA,this).on&&(j(XA,this,(t=>B(ZA,this,iN).call(this,t))),z(zA,this).on(yh.TIMELINE_TIME_UPDATE,z(XA,this)),j(YA,this,(t=>B(ZA,this,rN).call(this,t))),z(zA,this).on(yh.TIMELINE_STATE_CHANGE,z(YA,this)),j(JA,this,(()=>B(ZA,this,oN).call(this))),z(zA,this).on(yh.TIMELINE_RESET,z(JA,this))),z(WA,this)&&"function"==typeof z(WA,this).on&&(j(QA,this,(t=>this.handleDecodedAudio(t))),z(WA,this).on(yh.DECODER_AUDIO,z(QA,this)))}function nN(){z(zA,this)&&"function"==typeof z(zA,this).off&&(z(XA,this)&&z(zA,this).off(yh.TIMELINE_TIME_UPDATE,z(XA,this)),z(YA,this)&&z(zA,this).off(yh.TIMELINE_STATE_CHANGE,z(YA,this)),z(JA,this)&&z(zA,this).off(yh.TIMELINE_RESET,z(JA,this))),z(WA,this)&&"function"==typeof z(WA,this).off&&z(QA,this)&&z(WA,this).off(yh.DECODER_AUDIO,z(QA,this)),j(XA,this,null),j(YA,this,null),j(QA,this,null),j(JA,this,null)}function iN(){B(ZA,this,sN).call(this)}function rN(t={}){const e=null==t?void 0:t.to;if(e)return e===Cg?(B(ZA,this,fN).call(this),void B(ZA,this,sN).call(this)):void(e!==Rg&&e!==Pg?e!==Dg&&e!==Bg||B(ZA,this,oN).call(this):B(ZA,this,pN).call(this))}function oN(){B(ZA,this,pN).call(this),B(ZA,this,uN).call(this,!0),j(UA,this,[])}function sN(){if(!z(KA,this)||!z(zA,this))return;if(z(zA,this).state!==Cg)return;const t=B(ZA,this,dN).call(this);if(!t)return;const e=LA(z(zA,this).currentTime,0),n=e+Math.max(0,LA(this.settings.lookaheadSeconds,1)),i=[];for(let r=0;r<z(UA,this).length;r+=1){const o=z(UA,this)[r];o&&(o.pts>n?i.push(o):B(ZA,this,aN).call(this,o)&&B(ZA,this,cN).call(this,o,t,e))}j(UA,this,i)}function aN(t){if(!t||!z(zA,this))return!1;const e=B(ZA,this,lN).call(this,t.pts);return!(!e||e!==t.placementId)}function lN(t){if(!z(zA,this)||"function"!=typeof z(zA,this).getPlacementsActiveAtTime)return null;const e=z(zA,this).getPlacementsActiveAtTime(t);if(!Array.isArray(e)||!e.length)return null;const n=e.find((t=>null==t?void 0:t.placementId));return n?n.placementId:null}function cN(t,e,n){const i=t.key;if(z(qA,this).has(i))return;const r=t.audioBuffer;if(!r)return;const o=Number.isFinite(t.duration)?t.duration:r.duration,s=t.pts;if(!Number.isFinite(s))return;const a=n-s;if(Number.isFinite(o)&&o>0&&a>=o)return;const l=e.createBufferSource();l.buffer=r,l.connect(z($A,this));let c=e.currentTime,u=0;a>0?u=a:a<0&&(c=e.currentTime+Math.abs(a));try{l.start(c,u)}catch(t){return void this.log.warn("[AudioPlaybackManager] Failed to start audio buffer",t)}z(qA,this).add(i),z(VA,this).set(i,l),l.onended=()=>{z(VA,this).delete(i)}}function uN(t){z(VA,this).forEach(((t,e)=>{if(t&&"function"==typeof t.stop)try{t.stop()}catch(t){}z(VA,this).delete(e)})),t&&z(qA,this).clear()}function dN(){if(z(jA,this))return z(jA,this);const t=vh.AudioContext||vh.webkitAudioContext;if(!t)return this.log.warn("[AudioPlaybackManager] AudioContext is not available."),null;try{return j(jA,this,new t),j($A,this,z(jA,this).createGain()),z($A,this).connect(z(jA,this).destination),B(ZA,this,hN).call(this),z(jA,this)}catch(t){return this.log.warn("[AudioPlaybackManager] Failed to initialize AudioContext",t),j(jA,this,null),j($A,this,null),null}}function hN(){if(!z($A,this))return;const t=z(GA,this)?0:z(HA,this);z($A,this).gain.value=t}function fN(){z(jA,this)&&"function"==typeof z(jA,this).resume&&"suspended"===z(jA,this).state&&z(jA,this).resume().catch((()=>{}))}function pN(){z(jA,this)&&"function"==typeof z(jA,this).suspend&&"running"===z(jA,this).state&&z(jA,this).suspend().catch((()=>{}))}var mN=new WeakMap,vN=new WeakMap,gN=new WeakMap,yN=new WeakMap,bN=new WeakMap,kN=new WeakSet;class xN extends fh{constructor(...t){super(...t),$(this,kN),W(this,mN,void 0),W(this,vN,void 0),W(this,gN,void 0),W(this,yN,void 0),W(this,bN,void 0),j(mN,this,B(kN,this,_N).call(this,this.settings.currentTime)),j(vN,this,B(kN,this,IN).call(this,this.settings.playbackRate)),j(gN,this,null),j(yN,this,!1),j(bN,this,B(kN,this,wN).bind(this))}get name(){return"PlaybackClock"}get defaults(){return{currentTime:0,playbackRate:nk("playbackRate")}}get currentTime(){return z(mN,this)}get playbackRate(){return z(vN,this)}set playbackRate(t){j(vN,this,B(kN,this,IN).call(this,t))}play(){z(yN,this)||(j(yN,this,!0),j(gN,this,zb()),Aw(z(bN,this),0))}pause(){z(yN,this)&&(j(yN,this,!1),Nw(z(bN,this)))}seek(t){j(mN,this,B(kN,this,_N).call(this,t)),j(gN,this,zb())}reset(){this.pause(),j(mN,this,0),j(gN,this,null)}onDispose(){this.pause(),j(bN,this,null)}}function wN(){const t=zb();if(null===z(gN,this))return j(gN,this,t),void this.trigger(yh.CLOCK_TICK,{currentTime:z(mN,this)});const e=t-z(gN,this);j(gN,this,t);const n=e/1e3;j(mN,this,z(mN,this)+n*z(vN,this)),this.trigger(yh.CLOCK_TICK,{currentTime:z(mN,this)})}function _N(t){return"number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t)||t<0?0:t}function IN(t){return"number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t)||t<=0?z(vN,this)||1:t}var TN=new WeakMap,EN=new WeakSet;class SN extends fh{constructor(...t){super(...t),$(this,EN),W(this,TN,new Map)}get name(){return"TrackBuffers"}get defaults(){return{}}refreshNode(t){if(!t||!Array.isArray(t.tracks))return;const e=t.id,n=z(TN,this).get(e)||new Map;z(TN,this).set(e,n),t.tracks.forEach((t=>{const i=null==t?void 0:t.type;if(!i)return;const r=t.buffered,o=n.get(i),s=!!o&&o.ready,a=(l=r)&&Number.isFinite(l.start)&&Number.isFinite(l.end)&&l.end>l.start;var l,c,u;u=r,!(c=null==o?void 0:o.range)&&!u||c&&u&&c.start===u.start&&c.end===u.end?o&&o.ready!==a&&n.set(i,{range:r,ready:a}):(n.set(i,{range:r,ready:a}),this.trigger(yh.TRACK_BUFFER_UPDATE,{nodeId:e,trackType:i,range:r})),!s&&a?this.trigger(yh.TRACK_READY,{nodeId:e,trackType:i,range:r}):s&&!a&&this.trigger(yh.TRACK_UNDERFLOW,{nodeId:e,trackType:i,range:r})}))}getTrackRange(t,e){const n=z(TN,this).get(t),i=null==n?void 0:n.get(e);return null==i?void 0:i.range}computeBuffered(t=[],e=0,n){if(!n||"function"!=typeof n.get)return;const i=Number.isFinite(e)?e:0;let r,o,s=!1;for(let e=0;e<t.length;e+=1){const a=B(EN,this,AN).call(this,n,t[e],i);if(!a||a.end<=i)continue;if(void 0===r){r=a.start,o=a.end,s=a.full;continue}const l=a.start<=o,c=s&&a.full;if(!l&&!c)break;o=Math.max(o,a.end),s=a.full}return void 0===r||void 0===o?{start:0,end:0}:{start:r,end:o}}get buffered(){return z(TN,this)}reset(){z(TN,this).clear()}onDispose(){z(TN,this).clear(),"function"==typeof this.off&&this.off()}}function MN(t,e=0){const n=Array.isArray(null==t?void 0:t.segments)?t.segments:[],i=[];for(let t=0;t<n.length;t+=1){const e=n[t];if(!e||e.isInit)continue;const r=Number(e.duration),o=Number(e.offset),s=Number(e.bufferedRatio);if(!Number.isFinite(r)||r<=0||!Number.isFinite(o)||s<=0)continue;const a=o+r*Math.min(1,s);!Number.isFinite(a)||a<=o||i.push({start:o,end:a})}if(!i.length)return;i.sort(((t,e)=>t.start-e.start));const r=[i[0]];for(let t=1;t<i.length;t+=1){const e=i[t],n=r[r.length-1];e.start<=n.end+.001?n.end=Math.max(n.end,e.end):r.push({...e})}const o=Number.isFinite(e)?e:0;for(let t=0;t<r.length;t+=1){const e=r[t];if(e.end>o+.001)return e}}function AN(t,e,n=0){var i,r;const o=Tv(e);if(!Number.isFinite(o))return;const s=t.get(e.nodeId);if(!s)return;const a=Array.isArray(s.tracks)?s.tracks:[];if(!a.length){const t=s.buffered;if(!t||!Number.isFinite(t.start)||!Number.isFinite(t.end))return;return B(EN,this,NN).call(this,s,t,o,e)}const l=s.mainTrackId,c=Number.isFinite(e.nodeOffsetOverride)?e.nodeOffsetOverride:0,u=Math.max(0,n-o+c);let d;l&&(d=a.find((t=>(null==t?void 0:t.id)===l))),(null===(i=d)||void 0===i?void 0:i.type)||(d=a.find((t=>null==t?void 0:t.type)));const h=B(EN,this,MN).call(this,d,u)||(null===(r=d)||void 0===r?void 0:r.buffered);return h&&Number.isFinite(h.start)&&Number.isFinite(h.end)?B(EN,this,NN).call(this,s,h,o,e):void 0}function NN(t,e,n,i){const r=Number.isFinite(i.nodeOffsetOverride)?i.nodeOffsetOverride:0;let o=e.start-r+n,s=e.end-r+n;const a=t.duration,l=Number.isFinite(i.nodeDurationOverride)?i.nodeDurationOverride:a;if(Number.isFinite(l)){const t=n+l;s=Math.min(s,t);const e=o<=n&&s>=t;if(o=Math.max(o,n),!(s>o))return;return{start:o,end:s,full:e}}if(o=Math.max(o,n),s>o)return{start:o,end:s,full:!1}}class FN{constructor(t={}){const{placementId:e,nodeId:n,offset:i,offsetPending:r=!1,offsetAnchorPlacementId:o,offsetEndSeconds:s,offsetAnchorEdge:a,offsetAnchorIsReference:l,nodeOffsetOverride:c,nodeDurationOverride:u,loop:d=!1,loopRootPlacementId:h,loopRootOffset:f}=t;if(!e)throw new Error("Placement requires placementId");if(!n)throw new Error("Placement requires nodeId");this.placementId=e,this.nodeId=n;const p=Number.isFinite(i)?i:0;this.offsetPending=!0===r,this.offsetAnchorPlacementId=o,this.offsetAnchorEdge=a,this.offsetAnchorIsReference=l,this.offsetEndSeconds=Number.isFinite(s)?s:void 0,this.offset=this.offsetPending?void 0:p,this.nodeOffsetOverride=c,this.nodeDurationOverride=u,this.loop=!0===d,this.loopRootPlacementId=h,this.loopRootOffset=f}}class CN extends fh{constructor(t,e){super(e),this.timeline=t}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"handleDecodedFrame","handleClockTick","handleMainTrackBufferUpdate"])}enter(){}exit(){}play(){this.timeline.transitionTo(Cg)}pause(){this.timeline.transitionTo(Rg)}wait(){this.timeline.transitionTo(Pg)}reset(){this.timeline.transitionTo(Bg)}seek(t){this.timeline.transitionTo(Dg,{targetTime:t,returnState:this.timeline.state})}getCurrentTime(){return this.timeline.currentTime}emitPlayerStateEvent(t,e={}){if(!t||!this.timeline||"function"!=typeof this.timeline.trigger)return;const n=Number.isFinite(null==e?void 0:e.time)?e.time:this.getCurrentTime(),i={...e,event:t};Number.isFinite(n)&&(i.time=n),this.timeline.trigger("player:state",i)}get buffered(){return this.timeline.computeBuffered(this.timeline.currentTime)}handleMainTrackUnderflow(t){this.wait()}handleMainTrackReady(t){const e=this.timeline.getLastStableState()||Rg;this.timeline.transitionTo(e)}handleMainTrackBufferUpdate(t){}handleDecodedFrame(t){}handleClockTick(t){}onDispose(){this.timeline=null}}const ON=24e3/1001;function PN(t,e=(null==t?void 0:t.currentTime)){return Number.isFinite(e)?e:Number.isFinite(null==t?void 0:t.currentTime)?t.currentTime:0}function RN(t){var e;const n=Number(null==t||null===(e=t.settings)||void 0===e?void 0:e.snapToFps);return Number.isFinite(n)&&n>0?.5/n:.001}function DN(t){var e;const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];let i;if(null!=t&&t.mainTrackId){const e=n.find((e=>(null==e?void 0:e.id)===t.mainTrackId));i=null==e?void 0:e.type}if(i||(i=null===(e=n.find((t=>null==t?void 0:t.type)))||void 0===e?void 0:e.type),"video"===i||"audio"===i||"image"===i)return i}function BN(t){const e=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];if(e.length){if(null!=t&&t.mainTrackId){const n=e.find((e=>(null==e?void 0:e.id)===t.mainTrackId));if("video"===(null==n?void 0:n.type)||"image"===(null==n?void 0:n.type))return n}return e.find((t=>"video"===(null==t?void 0:t.type)||"image"===(null==t?void 0:t.type)))}}function LN(t,e,n,i,r){var o,s;const a="function"==typeof(null==t?void 0:t.getDecodedVisualBuffer)?t.getDecodedVisualBuffer(e,n):void 0;if(!a)return"function"==typeof(null==t?void 0:t.hasDecodedFirstFrame)&&t.hasDecodedFirstFrame(e,i);const l=Array.isArray(a.frames)?a.frames:[];let c,u=Number.isFinite(null===(o=a.current)||void 0===o?void 0:o.presentationTime)?a.current:void 0;for(let t=0;t<l.length;t+=1){const e=l[t],n=Number(null==e?void 0:e.presentationTime);if(Number.isFinite(n)){if(!(n<=r)){c=n;break}u=e}}const d=Number(null===(s=u)||void 0===s?void 0:s.presentationTime);if(!Number.isFinite(d)||d>r)return!1;const h=function(t,e,n,i){const r=Number(null==n?void 0:n.duration);if(Number.isFinite(r)&&r>0)return e+r;const o=function(t,e){const n=Number(null==t||null===(e=t.settings)||void 0===e?void 0:e.snapToFps);return 2/(Number.isFinite(n)&&n>0?n:ON)}(t),s=Number.isFinite(i)&&i>e?i-e:o;return e+Math.min(s,o)}(t,d,u,c);return!!Number.isFinite(h)&&r<=h+RN(t)}function zN(t,e=(null==t?void 0:t.currentTime)){const n=PN(t,e),i="function"==typeof(null==t?void 0:t.getPlacementsActiveAtTime)?t.getPlacementsActiveAtTime(n):[];if(!i.length)return!1;for(let e=0;e<i.length;e+=1){const n=i[e],r=null==n?void 0:n.placementId;if(!r)return!0;const o="function"==typeof(null==t?void 0:t.getNode)?t.getNode(n.nodeId):void 0;if(!o)return!0;const s=DN(o);if(!s)return!0;if(!t.hasDecodedFirstFrame(r,s))return!0}return!1}function WN(t,e=(null==t?void 0:t.currentTime)){return zN(t,e)||function(t,e=(null==t?void 0:t.currentTime)){const n=PN(t,e),i="function"==typeof(null==t?void 0:t.getPlacementsActiveAtTime)?t.getPlacementsActiveAtTime(n):[];if(!i.length)return!1;for(let e=0;e<i.length;e+=1){const r=i[e],o=null==r?void 0:r.placementId;if(!o)return!0;const s="function"==typeof(null==t?void 0:t.getNode)?t.getNode(r.nodeId):void 0;if(!s)return!0;const a=BN(s);if(null!=a&&a.id&&!LN(t,o,a.id,a.type,n))return!0}return!1}(t,e)}function jN(t,e=(null==t?void 0:t.currentTime)){if("function"!=typeof(null==t?void 0:t.computeBuffered))return!1;const n=PN(t,e),i=t.computeBuffered(n),r=Number(null==i?void 0:i.start),o=Number(null==i?void 0:i.end);if(!Number.isFinite(r)||!Number.isFinite(o)||o<=r)return!1;const s=RN(t);if(!(r<=n+s))return!1;return o-n>=function(t,e){const n=Number(null==t||null===(e=t.settings)||void 0===e?void 0:e.waitingBufferAheadSeconds);return!Number.isFinite(n)||n<0?3:n}(t)-s||function(t,e,n,i){const r=function(t){const e=Array.isArray(null==t?void 0:t.placements)?t.placements:[];let n;for(let i=0;i<e.length;i+=1){const r=e[i],o=Tv(r);if(!Number.isFinite(o))continue;const s="function"==typeof(null==t?void 0:t.getPlacementDuration)?t.getPlacementDuration(r):void 0;if(!Number.isFinite(s))continue;const a=o+s;Number.isFinite(a)&&(!Number.isFinite(n)||a>n)&&(n=a)}return n}(t);return!!Number.isFinite(r)&&(e>=r-i||n>=r-i)}(t,n,o,s)}const $N={[Fg]:class extends CN{get name(){return Fg}get defaults(){return{autoplay:nk("autoplay")}}enter(){this.timeline.recordStableState(Rg),this.timeline.stopPlaybackClock()}play(){const t=WN(this.timeline),e=t?Pg:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t)return this.timeline.recordStableState(Cg),void this.timeline.transitionTo(Pg);this.timeline.transitionTo(e)}pause(){}handleDecodedFrame(t){if(!0!==this.settings.autoplay)return;if(!Array.isArray(this.timeline.placements)||!this.timeline.placements.length)return;if(WN(this.timeline))return;const e=this.timeline.getPlaybackStartState();this.log.info("[handleDecodedFrame] Autoplay enabled, starting playback!"),this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),this.timeline.transitionTo(e)}},[Og]:class extends CN{get name(){return Og}enter(t={}){const{from:e,to:n}=t;this.timeline.recordStableState(Cg),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("canplay",{from:e,to:n})}play(){}handleMainTrackUnderflow(){}pause(){this.timeline.transitionTo(Rg)}},[Cg]:class extends CN{get name(){return Cg}enter(t={}){const{from:e,to:n,fromFirstFramePending:i}=t;this.timeline.recordStableState(Cg),this.timeline.startPlaybackClock(),!0!==i&&this.emitPlayerStateEvent("canplay",{from:e,to:n}),this.emitPlayerStateEvent("playing",{from:e,to:n})}play(){}pause(){this.timeline.transitionTo(Rg)}handleClockTick(t){const e=this.timeline.currentTime;WN(this.timeline,e)&&(this.timeline.recordStableState(Cg),this.timeline.transitionTo(Pg))}},[Pg]:(ln=new WeakMap,cn=new WeakMap,un=new WeakSet,class extends CN{constructor(...t){super(...t),$(this,un),W(this,ln,void 0),W(this,cn,null)}get name(){return Pg}enter(t={}){const{from:e,to:n}=t;this.timeline.stopPlaybackClock(),B(un,this,UN).call(this),B(un,this,VN).call(this),this.emitPlayerStateEvent("waiting",{from:e,to:n}),B(un,this,KN).call(this)}exit(){B(un,this,qN).call(this),B(un,this,GN).call(this)}play(){this.timeline.recordStableState(Cg);const t=B(un,this,HN).call(this),e=t?Pg:this.timeline.getPlaybackStartState();this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t||this.timeline.transitionTo(e)}pause(){this.timeline.transitionTo(Rg)}handleMainTrackReady(t){const e=this.timeline.getLastStableState()||Rg;e!==Cg?this.timeline.transitionTo(e):B(un,this,KN).call(this)}handleDecodedFrame(t){B(un,this,KN).call(this)}handleMainTrackBufferUpdate(t){B(un,this,KN).call(this)}}),[Rg]:class extends CN{get name(){return Rg}enter(t={}){const{from:e,to:n}=t;this.timeline.recordStableState(Rg),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("pause",{from:e,to:n})}play(){const t=WN(this.timeline),e=t?Pg:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t)return this.timeline.recordStableState(Cg),void this.timeline.transitionTo(Pg);this.timeline.transitionTo(e)}pause(){}},[Dg]:class extends CN{get name(){return Dg}enter(t={}){const{targetTime:e,returnState:n}=t;if(this.timeline&&"function"==typeof this.timeline.stopPlaybackClock&&this.timeline.stopPlaybackClock(),this.timeline&&"function"==typeof this.timeline.startSeeking)return void this.timeline.startSeeking(e,n);this.timeline.updateTime(e);const i=n===Cg||n===Og,r=i&&"function"==typeof this.timeline.getPlaybackStartState?this.timeline.getPlaybackStartState(e):i?Cg:Rg;this.timeline.transitionTo(r,{fromSeeking:!0})}play(){var t;if(this.timeline&&"function"==typeof this.timeline.setSeekReturnState)return void this.timeline.setSeekReturnState(Cg);const e="function"==typeof(null===(t=this.timeline)||void 0===t?void 0:t.getPlaybackStartState)?this.timeline.getPlaybackStartState():Cg;this.timeline.transitionTo(e)}pause(){this.timeline&&"function"==typeof this.timeline.setSeekReturnState?this.timeline.setSeekReturnState(Rg):this.timeline.transitionTo(Rg)}handleDecodedFrame(t){this.timeline&&"function"==typeof this.timeline.maybeCompleteSeek&&this.timeline.maybeCompleteSeek(t)}},[Bg]:class extends CN{get name(){return Bg}enter(){this.timeline.resetClock(),this.timeline.transitionTo(Fg,{fromReset:!0})}play(){}pause(){}get buffered(){return{start:0,end:0}}}};function UN(){var t;const e=null===(t=this.timeline)||void 0===t?void 0:t.trackBuffers;e&&"function"==typeof e.on&&(j(ln,this,(t=>this.handleMainTrackBufferUpdate(t))),e.on(yh.TRACK_BUFFER_UPDATE,z(ln,this)))}function qN(){var t;const e=null===(t=this.timeline)||void 0===t?void 0:t.trackBuffers;z(ln,this)&&e&&"function"==typeof e.off?(e.off(yh.TRACK_BUFFER_UPDATE,z(ln,this)),j(ln,this,null)):j(ln,this,null)}function VN(){if(null!==z(cn,this))return;const t="function"==typeof(null==vh?void 0:vh.setInterval)?vh.setInterval.bind(vh):setInterval;j(cn,this,t((()=>{var t;(null===(t=this.timeline)||void 0===t?void 0:t.state)===Pg&&B(un,this,KN).call(this)}),200))}function GN(){null!==z(cn,this)&&(("function"==typeof(null==vh?void 0:vh.clearInterval)?vh.clearInterval.bind(vh):clearInterval)(z(cn,this)),j(cn,this,null))}function HN(t=(t=>null===(t=this.timeline)||void 0===t?void 0:t.currentTime)()){return function(t,e=(null==t?void 0:t.currentTime),n={}){return!!zN(t,e)||!0===n.skipBufferResume||!jN(t,e)}(this.timeline,t)}function KN(t=(t=>null===(t=this.timeline)||void 0===t?void 0:t.currentTime)()){return(this.timeline.getLastStableState()||Rg)===Cg&&!B(un,this,HN).call(this,t)&&(this.timeline.transitionTo(this.timeline.getPlaybackStartState(t)),!0)}function XN(t){return t&&("string"!=typeof t.state||"ready"===t.state)}function YN(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).some((t=>"video"===(null==t?void 0:t.type)))}function QN(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).some((t=>"video"===(null==t?void 0:t.type)||"image"===(null==t?void 0:t.type)))}function JN(t){return t===Cg||t===Og}var ZN=new WeakMap,tF=new WeakMap,eF=new WeakMap,nF=new WeakMap,iF=new WeakMap,rF=new WeakMap,oF=new WeakMap,sF=new WeakMap,aF=new WeakMap,lF=new WeakMap,cF=new WeakMap,uF=new WeakMap,dF=new WeakMap,hF=new WeakMap,fF=new WeakSet;class pF{constructor(t={}){$(this,fF),W(this,ZN,void 0),W(this,tF,void 0),W(this,eF,void 0),W(this,nF,void 0),W(this,iF,void 0),W(this,rF,void 0),W(this,oF,void 0),W(this,sF,void 0),W(this,aF,void 0),W(this,lF,null),W(this,cF,Rg),W(this,uF,[]),W(this,dF,new Set),W(this,hF,new Map),j(ZN,this,t.getState),j(tF,this,t.getNode),j(eF,this,t.getPlacementsActiveAtTime),j(nF,this,t.getLastStableState),j(iF,this,t.getPlaybackStartState),j(rF,this,t.clearVisualFrameBuffers),j(oF,this,t.updateTime),j(sF,this,t.transitionTo),j(aF,this,t.trigger)}start(t,e){const n=Number(t);if(!Number.isFinite(n))return;let i=e;i===Dg?i=z(cF,this):i===Pg&&"function"==typeof z(nF,this)&&(i=z(nF,this).call(this)),j(cF,this,JN(i)?Cg:Rg),j(lF,this,n),z(dF,this).clear(),z(hF,this).clear(),j(uF,this,"function"==typeof z(eF,this)?z(eF,this).call(this,n):[]),"function"==typeof z(rF,this)&&z(rF,this).call(this),"function"==typeof z(oF,this)&&z(oF,this).call(this,n,{source:"seek"}),"function"==typeof z(aF,this)&&z(aF,this).call(this,yh.TIMELINE_SEEKING,{targetTime:n,placements:z(uF,this).slice()}),this.maybeComplete()}setReturnState(t){j(cF,this,JN(t)?Cg:Rg)}maybeComplete(t){if(("function"==typeof z(ZN,this)?z(ZN,this).call(this):void 0)!==Dg)return;const e=z(lF,this);if(!Number.isFinite(e))return;const n=null==t?void 0:t.trackType,i=null==t?void 0:t.placementId;if(i&&"video"===n){const n=Number(null==t?void 0:t.pts);if(Number.isFinite(n)&&n>=e){z(dF,this).add(i);const t=z(hF,this).get(i);(!Number.isFinite(t)||n<t)&&z(hF,this).set(i,n)}}else i&&"image"===n&&function(t,e){const n=Number(null==t?void 0:t.pts),i=Number(null==t?void 0:t.duration);return!Number.isFinite(n)||(Number.isFinite(i)&&i>0?e>=n&&e<n+i:e>=n)}(t,e)&&z(dF,this).add(i);const r=Array.isArray(z(uF,this))?z(uF,this):[];if(r.length){if("function"==typeof z(tF,this)){for(let t=0;t<r.length;t+=1){const e=r[t],n=null==e?void 0:e.placementId;if(!n)return;const i=z(tF,this).call(this,e.nodeId);if(!XN(i))return;if(QN(i)&&!z(dF,this).has(n))return}B(fF,this,mF).call(this,e,r)}}else B(fF,this,mF).call(this,e,[])}dispose(){j(uF,this,[]),z(dF,this).clear(),z(hF,this).clear(),j(lF,this,null)}}function mF(t,e){const n=B(fF,this,vF).call(this,t,e);if("function"==typeof z(oF,this)&&z(oF,this).call(this,n,{source:"seek"}),j(lF,this,null),j(uF,this,[]),z(dF,this).clear(),z(hF,this).clear(),"function"==typeof z(aF,this)&&z(aF,this).call(this,yh.TIMELINE_SEEKED,{targetTime:t,placements:Array.isArray(e)?e.slice():[]}),"function"==typeof z(sF,this)){const t=z(cF,this)===Cg&&"function"==typeof z(iF,this)?z(iF,this).call(this,n):z(cF,this);z(sF,this).call(this,t,{fromSeeking:!0})}}function vF(t,e){const n=Number(t);if(!Number.isFinite(n))return t;if(!Array.isArray(e)||!e.length||"function"!=typeof z(tF,this))return n;let i=n;for(let t=0;t<e.length;t+=1){const n=e[t],r=null==n?void 0:n.placementId;if(!r)continue;if(!YN(z(tF,this).call(this,n.nodeId)))continue;const o=z(hF,this).get(r);Number.isFinite(o)&&o>i&&(i=o)}return i}function gF(t){if(t&&"function"==typeof t.close)try{t.close()}catch(t){}}function yF(t){if(!t)return;const e=Array.isArray(null==t?void 0:t.frames)?t.frames:[],n=null==t?void 0:t.current;(n?[n,...e]:e).forEach((t=>gF(null==t?void 0:t.frame)))}function bF(t){return Tv(t)}function kF(t){return Number.isFinite(null==t?void 0:t.loopRootOffset)?t.loopRootOffset:bF(t)}function xF(t,e){return"string"==typeof(null==t?void 0:t.loopRootPlacementId)&&t.loopRootPlacementId?t.loopRootPlacementId:e}function wF(t){if("string"!=typeof t)return Number.NaN;const e=t.match(/(\d+)/);return e?Number(e[1]):Number.NaN}function _F(t){if(!t)return;const e=[[t.displayWidth,t.displayHeight],[t.codedWidth,t.codedHeight],[t.videoWidth,t.videoHeight],[t.naturalWidth,t.naturalHeight],[t.width,t.height]];for(let t=0;t<e.length;t+=1){const[n,i]=e[t],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}const IF=1e-6;function TF(t){return t&&("string"!=typeof t.state||"ready"===t.state)}function EF(t){const e=Number(t);return Number.isFinite(e)?e:0}function SF(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).filter((t=>"cue"===(null==t?void 0:t.type)&&Array.isArray(null==t?void 0:t.cues)))}function MF(t){return t&&"cue"===t.type&&Array.isArray(t.cues)?t.cues:[]}var AF=new WeakMap,NF=new WeakMap,FF=new WeakMap,CF=new WeakMap,OF=new WeakMap,PF=new WeakMap,RF=new WeakMap,DF=new WeakMap,BF=new WeakSet;class LF{constructor(t={}){$(this,BF),W(this,AF,void 0),W(this,NF,void 0),W(this,FF,void 0),W(this,CF,void 0),W(this,OF,void 0),W(this,PF,void 0),W(this,RF,-1e-6),W(this,DF,null),j(AF,this,t.getPlacements),j(NF,this,t.getPlacementsActiveAtTime),j(FF,this,t.getPlacementDuration),j(CF,this,t.getNode),j(OF,this,t.triggerTimeline),j(PF,this,t.triggerNode)}handleSeeking(t,e){const n=EF(t);j(DF,this,n)}handleSeeked(t){const e=EF(t),n=z(DF,this);j(DF,this,null),Number.isFinite(n)?(B(BF,this,WF).call(this,n,e),j(RF,this,e)):j(RF,this,e)}handleTimeUpdate(t,e={}){const n=EF(t),i=z(RF,this);!0===(null==e?void 0:e.isSeeking)?j(RF,this,n):Number.isFinite(i)?n<=i?n<i&&j(RF,this,n-IF):(B(BF,this,zF).call(this,i,n),j(RF,this,n)):j(RF,this,n)}dispose(){j(DF,this,null),j(RF,this,-1e-6)}}function zF(t,e){const n="function"==typeof z(AF,this)?z(AF,this).call(this):[];B(BF,this,jF).call(this,n,t,e,{onlySticky:!1})}function WF(t,e){if("function"!=typeof z(NF,this))return;const n=z(NF,this).call(this,e);B(BF,this,jF).call(this,n,t,e,{onlySticky:!0})}function jF(t,e,n,i={}){if("function"!=typeof z(CF,this)||"function"!=typeof z(OF,this))return;if(!Array.isArray(t)||!t.length)return;const r=!0===i.onlySticky,o=[];for(let i=0;i<t.length;i+=1){const s=t[i],a=null==s?void 0:s.placementId,l=null==s?void 0:s.nodeId;if(!a||!l)continue;const c=z(CF,this).call(this,l);if(!TF(c))continue;const u=SF(c);if(!u.length)continue;const d=Tv(s);if(!Number.isFinite(d))continue;const h=Number.isFinite(null==s?void 0:s.nodeOffsetOverride)?s.nodeOffsetOverride:0,f="function"==typeof z(FF,this)?z(FF,this).call(this,s):void 0,p="number"==typeof f&&Number.isFinite(f)?d+f:Number.POSITIVE_INFINITY,m=r?d-IF:e;for(let t=0;t<u.length;t+=1){const e=MF(u[t]);for(let i=0;i<e.length;i+=1){const s=e[i],c=EF(null==s?void 0:s.timestamp),u=d+Math.max(0,c-h);u<=p&&(r&&!0!==(null==s?void 0:s.isSticky)||u>m&&u<=n&&"string"==typeof(null==s?void 0:s.name)&&s.name&&o.push({time:u,placementOffset:d,placementId:a,nodeId:l,cuepoint:s,trackIndex:t,cueIndex:i}))}}}o.length&&(o.sort(((t,e)=>t.time!==e.time?t.time-e.time:t.placementOffset!==e.placementOffset?t.placementOffset-e.placementOffset:t.placementId!==e.placementId?t.placementId<e.placementId?-1:1:t.trackIndex!==e.trackIndex?t.trackIndex-e.trackIndex:t.cueIndex-e.cueIndex)),o.forEach((t=>{const e=t.cuepoint,n={time:t.time,nodeId:t.nodeId,placementId:t.placementId,cuepoint:e};z(OF,this).call(this,"cuepoint",n),z(OF,this).call(this,e.name,n),"function"==typeof z(PF,this)&&(z(PF,this).call(this,t.nodeId,"cuepoint",n),z(PF,this).call(this,t.nodeId,e.name,n))})))}class $F{#et;#nt=0;#it=new Set;constructor(t){this.#et="string"==typeof t?t:""}claim(t){if(t)return this.#it.add(t),t;let e;do{e=`${this.#et}${++this.#nt}`}while(this.#it.has(e));return this.#it.add(e),e}reset(){this.#nt=0,this.#it.clear()}}const UF=24e3/1001;function qF(t){var e;const n=null==t?void 0:t.frame;if(!n||!0===n.__closed||!0===n.closed)return 0;if("function"==typeof n.allocationSize)try{const t=Number(n.allocationSize());if(Number.isFinite(t)&&t>0)return t}catch(t){}const i=Number(null==n?void 0:n.byteLength);if(Number.isFinite(i)&&i>0)return i;const r=Number(null==n||null===(e=n.data)||void 0===e?void 0:e.byteLength);if(Number.isFinite(r)&&r>0)return r;const o=function(t,e){const n=Number(null==t?void 0:t.width),i=Number(null==t?void 0:t.height);return Number.isFinite(n)&&Number.isFinite(i)&&n>0&&i>0?{width:n,height:i}:_F(e)}(t,n),s=Number(null==o?void 0:o.width),a=Number(null==o?void 0:o.height);return Number.isFinite(s)&&Number.isFinite(a)&&s>0&&a>0?s*a*4:0}var VF=new WeakMap,GF=new WeakMap,HF=new WeakMap,KF=new WeakMap,XF=new WeakMap,YF=new WeakMap,QF=new WeakMap,JF=new WeakMap,ZF=new WeakMap,tC=new WeakMap,eC=new WeakMap,nC=new WeakMap,iC=new WeakMap,rC=new WeakMap,oC=new WeakMap,sC=new WeakMap,aC=new WeakMap,lC=new WeakMap,cC=new WeakMap,uC=new WeakMap,dC=new WeakMap,hC=new WeakMap,fC=new WeakMap,pC=new WeakMap,mC=new WeakMap,vC=new WeakMap,gC=new WeakMap,yC=new WeakMap,bC=new WeakMap,kC=new WeakMap,xC=new WeakMap,wC=new WeakMap,_C=new WeakMap,IC=new WeakSet;class TC extends fh{constructor(...t){super(...t),$(this,IC),W(this,VF,void 0),W(this,GF,void 0),W(this,HF,void 0),W(this,KF,void 0),W(this,XF,void 0),W(this,YF,!1),W(this,QF,[]),W(this,JF,new $F("placement-")),W(this,ZF,[]),W(this,tC,new $F("renderplacement-")),W(this,eC,void 0),W(this,nC,void 0),W(this,iC,void 0),W(this,rC,!1),W(this,oC,new Set),W(this,sC,new Set),W(this,aC,new Map),W(this,lC,[]),W(this,cC,0),W(this,uC,new Set),W(this,dC,new Set),W(this,hC,Number.NEGATIVE_INFINITY),W(this,fC,[]),W(this,pC,Number.NEGATIVE_INFINITY),W(this,mC,0),W(this,vC,void 0),W(this,gC,void 0),W(this,yC,new Map),W(this,bC,null),W(this,kC,void 0),W(this,xC,void 0),W(this,wC,void 0),W(this,_C,void 0);const[e,n={}]=t;j(VF,this,e),j(vC,this,n),j(XF,this,new xN(n)),j(eC,this,new SN(n)),j(KF,this,Rg),B(IC,this,DC).call(this),B(IC,this,BC).call(this),j(kC,this,new pF({getState:()=>this.state,getNode:t=>z(VF,this)&&"function"==typeof z(VF,this).get?z(VF,this).get(t):void 0,getPlacementsActiveAtTime:t=>B(IC,this,vO).call(this,t,{endEpsilonSeconds:B(IC,this,TO).call(this)}),getLastStableState:()=>this.getLastStableState(),getPlaybackStartState:t=>this.getPlaybackStartState(t),clearVisualFrameBuffers:()=>B(IC,this,pO).call(this),updateTime:(t,e)=>this.updateTime(t,e),transitionTo:(t,e)=>this.transitionTo(t,e),trigger:(t,e)=>this.trigger(t,e)})),j(xC,this,new LF({getPlacements:()=>z(QF,this).slice(),getPlacementsActiveAtTime:t=>B(IC,this,vO).call(this,t),getPlacementDuration:t=>B(IC,this,QC).call(this,t),getNode:t=>z(VF,this)&&"function"==typeof z(VF,this).get?z(VF,this).get(t):void 0,triggerTimeline:(t,e)=>this.trigger(t,e),triggerNode:(t,e,n)=>{const i=z(VF,this)&&"function"==typeof z(VF,this).get?z(VF,this).get(t):void 0;i&&"function"==typeof i.trigger&&i.trigger(e,n)}})),j(wC,this,(()=>{var t,e;null===(t=z(xC,this))||void 0===t||null===(e=t.handleSeeked)||void 0===e||e.call(t,this.currentTime)})),this.on(yh.TIMELINE_SEEKED,z(wC,this)),j(_C,this,(t=>B(IC,this,qC).call(this,t))),this.on("nodestart",z(_C,this)),this.transitionTo(Fg)}get name(){return"Timeline"}get defaults(){return{snapToFps:UF,maxBufferedVideoFrames:24}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"computeBuffered","notifyDecodedFrame","getDecodedFrameStats","getActiveRenderPlacement","maybeCompleteSeek","getPlacementsActiveAtTime","hasDecodedFirstFrame","getDecodedVisualBuffer","getPlacementDuration","getNode"])}transitionTo(t,e={}){const n=z(HF,this),i=function(t,e,n={}){const i=$N[t];return i?new i(e,n):null}(t,this,z(vC,this)),r=e&&"object"==typeof e&&!Array.isArray(e)?{...e,from:n,to:t}:{from:n,to:t};i?(z(GF,this)&&"function"==typeof z(GF,this).exit&&z(GF,this).exit(),j(GF,this,i),j(HF,this,t),"function"==typeof i.enter&&i.enter(r),this.trigger(yh.TIMELINE_STATE_CHANGE,{from:n,to:t,options:e})):this.log.warn(`Unknown state "${t}"`)}recordStableState(t){j(KF,this,t)}getLastStableState(){return z(KF,this)}enableFirstFrameRenderedGate(){j(YF,this,!0)}getPlaybackStartState(t=this.currentTime){return this.shouldWaitForFirstRenderedFrame(t)?Og:Cg}shouldWaitForFirstRenderedFrame(t=this.currentTime){if(!z(YF,this)||z(rC,this))return!1;const e=Number.isFinite(t)?t:this.currentTime,n=B(IC,this,vO).call(this,e);return Array.isArray(n)&&n.length>0}notifyFirstFrameRendered(){z(rC,this)||(j(rC,this,!0),this.state===Og&&this.transitionTo(Cg,{fromFirstFramePending:!0}))}get state(){return z(HF,this)}get paused(){return z(HF,this)===Fg||z(HF,this)===Rg}get currentTime(){return z(XF,this).currentTime}set currentTime(t){z(GF,this).seek(t)}get playbackRate(){return z(XF,this).playbackRate}set playbackRate(t){z(XF,this).playbackRate=t}play(){z(GF,this).play()}pause(){z(GF,this).pause()}reset(){z(GF,this).reset()}seekToPlacement(t){if(!t)throw new Error("Timeline.seekToPlacement requires placement id");B(IC,this,HC).call(this);const e=B(IC,this,xO).call(this,t);if(!e)throw new Error("Timeline.seekToPlacement requires placement id");const n=Tv(e);if(!Number.isFinite(n))throw new Error("Timeline.seekToPlacement requires resolved placement offset");return this.currentTime=n,n}updateTime(t,e={}){var n,i;B(IC,this,HC).call(this),B(IC,this,KC).call(this),z(XF,this).seek(t),B(IC,this,mO).call(this,this.currentTime),B(IC,this,gO).call(this);const r="string"==typeof(null==e?void 0:e.source)?e.source:"set";null!==(n=z(xC,this))&&void 0!==n&&null!==(i=n.handleTimeUpdate)&&void 0!==i&&i.call(n,this.currentTime,{isSeeking:this.state===Dg}),B(IC,this,VC).call(this,this.currentTime),B(IC,this,cO).call(this,this.currentTime),this.trigger(yh.TIMELINE_TIME_UPDATE,bh(this.currentTime,r))}startSeeking(t,e){var n,i;null!==(n=z(xC,this))&&void 0!==n&&null!==(i=n.handleSeeking)&&void 0!==i&&i.call(n,this.currentTime,t),z(kC,this)&&"function"==typeof z(kC,this).start&&z(kC,this).start(t,e)}setSeekReturnState(t){z(kC,this)&&"function"==typeof z(kC,this).setReturnState&&z(kC,this).setReturnState(t)}maybeCompleteSeek(t){z(kC,this)&&"function"==typeof z(kC,this).maybeComplete&&z(kC,this).maybeComplete(t)}startPlaybackClock(){z(XF,this).play()}stopPlaybackClock(){z(XF,this).pause()}resetClock(){var t,e;j(rC,this,!1),z(XF,this).reset(),this.trigger(yh.TIMELINE_RESET,{reason:"reset"}),null===(t=z(xC,this))||void 0===t||null===(e=t.dispose)||void 0===e||e.call(t)}applyTimelineDefinition(t={}){const e=Array.isArray(null==t?void 0:t.placements)?t.placements:[],n=Array.isArray(null==t?void 0:t.renderPlacements)?t.renderPlacements:[];B(IC,this,EC).call(this),B(IC,this,SC).call(this,e),B(IC,this,MC).call(this,n),this.currentTime=0}placeOnTimeline(t,e,n={}){const i=t&&"object"==typeof t?t.id:t;if(!i)throw new Error("Timeline.placeOnTimeline requires node id");const r=z(JF,this).claim(n.placementId),o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=Fv(e);if("string"==typeof e&&e.includes("@")&&!a)throw new Error("Timeline.placeOnTimeline requires valid placement reference");const{wantsEndOffset:l,endOffsetSeconds:c}=a?{wantsEndOffset:!1}:Nv(e,n);let u,d,h,f=!1;const p=null!==a;if(B(IC,this,HC).call(this),a){const t=z(QF,this).find((t=>(null==t?void 0:t.placementId)===a.placementId));if(!t)throw new Error("Timeline.placeOnTimeline requires valid placement reference");d=t.placementId,h=a.anchor;const e=Tv(t);if("start"===a.anchor)Number.isFinite(e)?u=B(IC,this,JC).call(this,e,{nodeOffsetOverride:o}):f=!0;else{const n=B(IC,this,QC).call(this,t);if(Number.isFinite(e)&&n>0){const t=e+n,i=B(IC,this,JC).call(this,t,{nodeOffsetOverride:o});u=Math.max(i,t)}else f=!0}}else if(l){const t=n.offsetAnchorPlacementId?z(QF,this).find((t=>(null==t?void 0:t.placementId)===n.offsetAnchorPlacementId)):z(QF,this).length?z(QF,this)[z(QF,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==t?void 0:t.placementId),d){const e=Tv(t),n=B(IC,this,QC).call(this,t);Number.isFinite(e)&&n>0?u=B(IC,this,JC).call(this,e+n-c,{nodeOffsetOverride:o}):(f=!0,h="end")}else u=B(IC,this,JC).call(this,-c,{nodeOffsetOverride:o})}else u=Av(e),u=B(IC,this,JC).call(this,u,{...n,nodeOffsetOverride:o});const m=!0===n.loop?n.loopRootPlacementId||r:void 0,v=!0===n.loop&&Number.isFinite(n.loopRootOffset)?n.loopRootOffset:!0===n.loop?u:void 0,g=l?c:a&&"end"===a.anchor?0:void 0,y=new FN({placementId:r,nodeId:i,offset:u,offsetPending:f,offsetAnchorPlacementId:f?d:void 0,offsetAnchorEdge:f?h:void 0,offsetAnchorIsReference:f?p:void 0,offsetEndSeconds:g,nodeOffsetOverride:o,nodeDurationOverride:s,loop:!0===n.loop,loopRootPlacementId:m,loopRootOffset:v});if(z(QF,this).push(y),Sv(z(QF,this)),B(IC,this,aO).call(this,y),B(IC,this,oO).call(this),f&&d){const t=z(QF,this).find((t=>(null==t?void 0:t.placementId)===d));B(IC,this,tO).call(this,null==t?void 0:t.nodeId)}return this.trigger(yh.PLACEMENT_ADDED,y),r}placeRenderNodeOnTimeline(t,e,n,i={}){const r="string"==typeof t?t:null==t?void 0:t.type;if(!r||"string"!=typeof r)throw new Error("Timeline.placeRenderNodeOnTimeline requires render node type");const o=B(IC,this,ZC).call(this,e,i),s=o.offset,a=!0===o.offsetPending,l=o.offsetAnchorPlacementId,c=o.offsetAnchorEdge,u=o.offsetAnchorIsReference,d=z(tC,this).claim(i.renderPlacementId),h=Number(n),f=h===Number.POSITIVE_INFINITY,p=Number.isFinite(h)&&h>0||f?h:void 0;if(!p)throw new Error("Timeline.placeRenderNodeOnTimeline requires a positive duration (seconds) or Infinity as 3rd argument");const m=i.params&&"object"==typeof i.params?i.params:void 0,v={renderPlacementId:d,type:r,offset:s,offsetPending:a,offsetAnchorPlacementId:l,offsetAnchorEdge:c,offsetAnchorIsReference:u,duration:p,params:m};if(!a){const t=s,e=s+p;Cv(z(ZF,this),t,e,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements")}if(z(ZF,this).push(v),Sv(z(ZF,this)),a&&l){const t=z(QF,this).find((t=>(null==t?void 0:t.placementId)===l));B(IC,this,tO).call(this,null==t?void 0:t.nodeId)}return this.trigger(yh.RENDER_PLACEMENT_ADDED,v),d}get placements(){return z(QF,this).slice()}getPlacementsActiveAtTime(t){return B(IC,this,vO).call(this,t)}getNodesAtTime(t){const e=B(IC,this,wO).call(this,t);if(!Number.isFinite(e))return[];const n=B(IC,this,vO).call(this,e),i=[];return n.forEach((t=>{const e=this.getNode(null==t?void 0:t.nodeId);e&&i.push(e)})),i}getPlacementDuration(t){return B(IC,this,QC).call(this,t)}getNode(t){if(z(VF,this)&&"function"==typeof z(VF,this).get)return z(VF,this).get(t)}get renderPlacements(){return z(ZF,this).slice()}get placementsAhead(){const t=this.currentTime;return z(QF,this).filter((e=>{const n=Tv(e);if(!Number.isFinite(n))return!1;const i=B(IC,this,QC).call(this,e);return"number"==typeof i?n+i>t:n>=t}))}get buffered(){return z(GF,this)?z(GF,this).buffered:{start:0,end:0}}get trackBuffers(){return z(eC,this)}onDispose(){B(IC,this,PC).call(this),z(sC,this)&&z(sC,this).clear(),z(xC,this)&&"function"==typeof z(xC,this).dispose&&z(xC,this).dispose(),j(xC,this,null),B(IC,this,OC).call(this),B(IC,this,RC).call(this),z(kC,this)&&"function"==typeof z(kC,this).dispose&&z(kC,this).dispose(),j(kC,this,null),z(XF,this)&&"function"==typeof z(XF,this).dispose&&(z(gC,this)&&"function"==typeof z(XF,this).off&&(z(XF,this).off("tick",z(gC,this)),j(gC,this,null)),z(XF,this).dispose(),j(XF,this,null)),B(IC,this,iO).call(this),j(GF,this,null),j(HF,this,null),j(QF,this,[]),j(ZF,this,[]),B(IC,this,rO).call(this),B(IC,this,oO).call(this),z(yC,this).clear(),j(bC,this,null)}notifyDecodedFrame(t={}){const e=null==t?void 0:t.placementId,n=null==t?void 0:t.trackType;if(!e||!n)return;const i=`${e}:${n}`;z(oC,this).add(i),B(IC,this,fO).call(this,t),B(IC,this,gO).call(this),z(GF,this)&&"function"==typeof z(GF,this).handleDecodedFrame&&z(GF,this).handleDecodedFrame(t)}getDecodedFrameStats(){return function(t){const e={totalBytes:0,frames:0,available:!1};if(!t||"function"!=typeof t.values)return e;for(const n of t.values()){const t=[];null!=n&&n.current&&t.push(n.current),Array.isArray(null==n?void 0:n.frames)&&t.push(...n.frames),t.forEach((t=>{const n=null==t?void 0:t.frame;if(!n||!0===n.__closed||!0===n.closed)return;e.frames+=1;const i=qF(t);Number.isFinite(i)&&i>0&&(e.totalBytes+=i)}))}return e.available=!0,e}(z(yC,this))}hasDecodedFirstFrame(t,e){return!(!t||!e)&&z(oC,this).has(`${t}:${e}`)}getDecodedVisualBuffer(t,e){if(t&&e)return z(yC,this).get(`${t}:${e}`)}computeBuffered(t){const e=z(VF,this);if(e&&"function"==typeof e.get)return z(eC,this).computeBuffered(z(QF,this),t,e)}getActiveRenderPlacement(t=this.currentTime){const e=Number.isFinite(t)?t:this.currentTime,n=Array.isArray(z(ZF,this))?z(ZF,this):[];if(!n.length)return;let i;for(let t=0;t<n.length;t+=1){const r=n[t];if(!0===(null==r?void 0:r.offsetPending))continue;const o="number"==typeof r.offset?r.offset:void 0;if(!Number.isFinite(o))continue;const s=r.duration;("number"==typeof s&&Number.isFinite(s)&&s>0?e>=o&&e<o+s:e>=o)&&(i=r)}return i}}function EC(){j(rC,this,!1),this.trigger(yh.TIMELINE_RESET,{reason:"switch"}),B(IC,this,pO).call(this),z(eC,this)&&"function"==typeof z(eC,this).reset&&z(eC,this).reset(),z(sC,this)&&z(sC,this).clear(),j(QF,this,[]),j(ZF,this,[]),B(IC,this,rO).call(this),B(IC,this,oO).call(this),z(JF,this).reset(),z(tC,this).reset()}function SC(t=[]){for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||!n.nodeId)continue;const i=B(IC,this,AC).call(this,n),r=B(IC,this,FC).call(this,n);this.placeOnTimeline(n.nodeId,r,i)}}function MC(t=[]){for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||!n.type)continue;const i=B(IC,this,NC).call(this,n),r=B(IC,this,CC).call(this,n);this.placeRenderNodeOnTimeline(n.type,r,n.duration,i)}}function AC(t){const e={};return t.placementId&&(e.placementId=t.placementId),Number.isFinite(t.nodeOffsetOverride)&&(e.nodeOffsetOverride=t.nodeOffsetOverride),Number.isFinite(t.nodeDurationOverride)&&(e.nodeDurationOverride=t.nodeDurationOverride),!0===t.offsetPending&&(e.offsetPending=!0,t.offsetAnchorPlacementId&&(e.offsetAnchorPlacementId=t.offsetAnchorPlacementId),t.offsetAnchorEdge&&(e.offsetAnchorEdge=t.offsetAnchorEdge)),Number.isFinite(t.offsetEndSeconds)&&(e.offsetEndSeconds=t.offsetEndSeconds),!0===t.loop&&(e.loop=!0),t.loopRootPlacementId&&(e.loopRootPlacementId=t.loopRootPlacementId),Number.isFinite(t.loopRootOffset)&&(e.loopRootOffset=t.loopRootOffset),e}function NC(t){const e={};return t.renderPlacementId&&(e.renderPlacementId=t.renderPlacementId),t.params&&"object"==typeof t.params&&(e.params=t.params),e}function FC(t){if(!0===t.offsetPending&&t.offsetAnchorPlacementId&&t.offsetAnchorEdge){if(!0===t.offsetAnchorIsReference)return`${t.offsetAnchorPlacementId}@${t.offsetAnchorEdge}`;if("end"===t.offsetAnchorEdge)return Number.isFinite(t.offsetEndSeconds)&&t.offsetEndSeconds>0?-t.offsetEndSeconds:"end"}return"string"==typeof t.offset||Number.isFinite(t.offset)?t.offset:0}function CC(t){return!0===t.offsetPending&&t.offsetAnchorPlacementId&&t.offsetAnchorEdge&&!0===t.offsetAnchorIsReference?`${t.offsetAnchorPlacementId}@${t.offsetAnchorEdge}`:"string"==typeof t.offset||Number.isFinite(t.offset)?t.offset:0}function OC(){z(GF,this)&&"function"==typeof z(GF,this).exit&&z(GF,this).exit()}function PC(){z(wC,this)&&"function"==typeof this.off&&(this.off(yh.TIMELINE_SEEKED,z(wC,this)),j(wC,this,null)),z(_C,this)&&"function"==typeof this.off&&(this.off("nodestart",z(_C,this)),j(_C,this,null))}function RC(){z(eC,this)&&(z(nC,this)&&(z(eC,this).off("track:underflow",z(nC,this)),j(nC,this,null)),z(iC,this)&&(z(eC,this).off("track:ready",z(iC,this)),j(iC,this,null)),"function"==typeof z(eC,this).dispose&&z(eC,this).dispose(),j(eC,this,null))}function DC(){z(eC,this)&&"function"==typeof z(eC,this).on&&(j(nC,this,(t=>B(IC,this,zC).call(this,t))),j(iC,this,(t=>B(IC,this,WC).call(this,t))),z(eC,this).on(yh.TRACK_UNDERFLOW,z(nC,this)),z(eC,this).on(yh.TRACK_READY,z(iC,this)))}function BC(){z(XF,this)&&"function"==typeof z(XF,this).on&&(j(gC,this,(t=>B(IC,this,LC).call(this,t))),z(XF,this).on(yh.CLOCK_TICK,z(gC,this)))}function LC(t){var e,n;B(IC,this,HC).call(this),B(IC,this,gO).call(this),null!==(e=z(xC,this))&&void 0!==e&&null!==(n=e.handleTimeUpdate)&&void 0!==n&&n.call(e,this.currentTime,{isSeeking:!1}),B(IC,this,VC).call(this,this.currentTime),this.trigger(yh.TIMELINE_TIME_UPDATE,bh(this.currentTime,"clock")),z(GF,this)&&"function"==typeof z(GF,this).handleClockTick&&z(GF,this).handleClockTick(t)}function zC(t){B(IC,this,HC).call(this);const e=B(IC,this,jC).call(this);e&&(null==t?void 0:t.trackType)===e.trackType&&(z(GF,this)&&"function"==typeof z(GF,this).handleMainTrackUnderflow?z(GF,this).handleMainTrackUnderflow(t):this.transitionTo(Pg))}function WC(t){if(B(IC,this,HC).call(this),this.state!==Pg)return;const e=B(IC,this,jC).call(this);if(!e)return;if((null==t?void 0:t.trackType)!==e.trackType)return;if(z(GF,this)&&"function"==typeof z(GF,this).handleMainTrackReady)return void z(GF,this).handleMainTrackReady(t);const n=this.getLastStableState()||Rg;this.transitionTo(n)}function jC(t=this.currentTime){const e=B(IC,this,UC).call(this,t);if(!e)return;const n=z(VF,this)&&"function"==typeof z(VF,this).get?z(VF,this).get(e.nodeId):void 0;if(!n)return;const i=B(IC,this,$C).call(this,n);return i?{placement:e,trackType:i}:void 0}function $C(t){var e;const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];let i;if(null!=t&&t.mainTrackId){const e=n.find((e=>(null==e?void 0:e.id)===t.mainTrackId));i=null==e?void 0:e.type}if(i||(i=null===(e=n.find((t=>null==t?void 0:t.type)))||void 0===e?void 0:e.type),"video"===i||"audio"===i||"image"===i)return i}function UC(t=this.currentTime){const e=z(QF,this)||[];let n;for(let i=0;i<e.length;i+=1){const r=e[i],o=Tv(r);if(!Number.isFinite(o))continue;const s=B(IC,this,QC).call(this,r);if(Number.isFinite(s)){if(t>=o&&t<o+s)return r}else if(t<=o)return r;!n&&t<o&&(n=r)}return n}function qC(t={}){if(this.state!==Cg)return;const e=null==t?void 0:t.placementId;if(!e)return;const n=B(IC,this,xO).call(this,e);n&&B(IC,this,GC).call(this,n)}function VC(t=this.currentTime){if(this.state!==Cg)return;const e=B(IC,this,vO).call(this,t);Array.isArray(e)&&e.length&&e.forEach((t=>B(IC,this,GC).call(this,t)))}function GC(t){const e=null==t?void 0:t.placementId;if(!e)return;if(z(sC,this).has(e))return;if(!t||!0!==t.loop)return;if(!t.nodeId)return;const n=B(IC,this,QC).call(this,t);if(!Number.isFinite(n)||n<=0)return;const i=Tv(t);if(!Number.isFinite(i))return;const r=i+n;if(!Number.isFinite(r))return;const o=t.loopRootPlacementId||t.placementId,s=Number.isFinite(t.loopRootOffset)?t.loopRootOffset:i;z(sC,this).add(e),this.placeOnTimeline(t.nodeId,r,{nodeOffsetOverride:t.nodeOffsetOverride,nodeDurationOverride:t.nodeDurationOverride,loop:!0,loopRootPlacementId:o,loopRootOffset:s})}function HC(){const t=Mv(z(QF,this),{getPlacementDuration:t=>B(IC,this,QC).call(this,t),snapPlacementOffset:(t,e)=>B(IC,this,JC).call(this,t,{nodeOffsetOverride:null==e?void 0:e.nodeOffsetOverride}),onResolvedPlacement:(t,e)=>{!0!==t.loop||Number.isFinite(t.loopRootOffset)||(t.loopRootOffset=t.offset),B(IC,this,eO).call(this,null==e?void 0:e.nodeId)}});return t.updated&&(B(IC,this,oO).call(this),t.resolvedPlacements.forEach((t=>{B(IC,this,aO).call(this,t),this.trigger(yh.PLACEMENT_ADDED,t)}))),t.updated}function KC(){if(!z(ZF,this).length||!z(QF,this).length)return!1;const t=new Map;z(QF,this).forEach((e=>{(null==e?void 0:e.placementId)&&t.set(e.placementId,e)}));const e=z(ZF,this).filter((t=>!0===(null==t?void 0:t.offsetPending)));if(!e.length)return!1;let n=!1;const i=[];for(let r=0;r<e.length;r+=1){const o=e[r];B(IC,this,XC).call(this,o,t)&&(n=!0,i.push(o))}return n&&(Sv(z(ZF,this)),i.forEach((t=>{this.trigger(yh.RENDER_PLACEMENT_ADDED,t)}))),n}function XC(t,e){const n=null==t?void 0:t.offsetAnchorPlacementId,i=null==t?void 0:t.offsetAnchorEdge;if(!n||!i)return!1;const r=e.get(n);if(!r||!0===r.offsetPending)return!1;const o=B(IC,this,YC).call(this,r,t);if(!Number.isFinite(o))return!1;t.offset=o,t.offsetPending=!1,t.offsetAnchorPlacementId=void 0,t.offsetAnchorEdge=void 0,t.offsetAnchorIsReference=void 0;const s=t.offset,a=t.offset+t.duration;return Cv(z(ZF,this).filter((e=>e!==t&&!0!==(null==e?void 0:e.offsetPending))),s,a,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements"),B(IC,this,eO).call(this,null==r?void 0:r.nodeId),!0}function YC(t,e){const n=Tv(t);if(!Number.isFinite(n))return;if("start"===e.offsetAnchorEdge)return B(IC,this,JC).call(this,n);const i=B(IC,this,QC).call(this,t);if(!(i>0))return;const r=n+i;if(!Number.isFinite(r))return;const o=B(IC,this,JC).call(this,r);return!0===e.offsetAnchorIsReference?Math.max(o,r):o}function QC(t){return _v(t,z(VF,this))}function JC(t,e={}){var n;return function(t,e={},n){const i=Number(n);if(!(i>0))return t;const r=Number(t);if(!Number.isFinite(r))return t;const o=Number.isFinite(null==e?void 0:e.nodeOffsetOverride)?e.nodeOffsetOverride:0,s=r-o;return Math.round(s*i)/i+o}(t,e,null===(n=this.settings)||void 0===n?void 0:n.snapToFps)}function ZC(t,e={}){const n=Fv(t);if("string"==typeof t&&t.includes("@")&&!n)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");if(!n){const n=Av(t);return{offset:B(IC,this,JC).call(this,n,e)}}const i=z(QF,this).find((t=>(null==t?void 0:t.placementId)===n.placementId));if(!i)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");const r=Tv(i);if("start"===n.anchor)return Number.isFinite(r)?{offset:B(IC,this,JC).call(this,r,e)}:{offset:void 0,offsetPending:!0,offsetAnchorPlacementId:i.placementId,offsetAnchorEdge:"start",offsetAnchorIsReference:!0};const o=B(IC,this,QC).call(this,i);if(!(Number.isFinite(r)&&o>0))return{offset:void 0,offsetPending:!0,offsetAnchorPlacementId:i.placementId,offsetAnchorEdge:"end",offsetAnchorIsReference:!0};const s=r+o,a=B(IC,this,JC).call(this,s,e);return{offset:Math.max(a,s)}}function tO(t){if(!t||!z(VF,this)||"function"!=typeof z(VF,this).get)return;if(z(aC,this).has(t))return;let e;try{e=z(VF,this).get(t)}catch(t){return}if(!e||"function"!=typeof e.on)return;if("ready"===e.state&&e.duration>0)return void this.updateTime(this.currentTime);const n=()=>{this.updateTime(this.currentTime),B(IC,this,eO).call(this,t)};e.on(yh.NODE_LOADED,n),z(aC,this).set(t,n)}function eO(t){if(!t)return;if(B(IC,this,nO).call(this,t))return;const e=z(aC,this).get(t);if(!e)return;let n;try{n=z(VF,this).get(t)}catch(t){n=null}n&&"function"==typeof n.off&&n.off(yh.NODE_LOADED,e),z(aC,this).delete(t)}function nO(t){if(!t)return!1;const e=new Map;z(QF,this).forEach((t=>{(null==t?void 0:t.placementId)&&e.set(t.placementId,t)}));const n=n=>{if(null==n||!n.offsetPending||null==n||!n.offsetAnchorPlacementId)return!1;const i=e.get(n.offsetAnchorPlacementId);return(null==i?void 0:i.nodeId)===t};return!!z(QF,this).some((t=>n(t)))||!!z(ZF,this).some((t=>n(t)))}function iO(){z(aC,this).size&&z(VF,this)?(z(aC,this).forEach(((t,e)=>{let n;try{n=z(VF,this).get(e)}catch(t){n=null}n&&"function"==typeof n.off&&n.off(yh.NODE_LOADED,t)})),z(aC,this).clear()):z(aC,this).clear()}function rO(){j(lC,this,[]),j(cC,this,0),z(uC,this).clear(),z(dC,this).clear(),j(hC,this,Number.NEGATIVE_INFINITY)}function oO(){j(fC,this,[]),j(mC,this,0),j(pC,this,Number.NEGATIVE_INFINITY)}function sO(t,e){const n=z(lC,this),i={placementId:t,endTime:e};if(!n.length||e>=n[n.length-1].endTime)return void n.push(i);const r=n.findIndex((t=>e<t.endTime)),o=-1===r?n.length:r;n.splice(o,0,i),o<z(cC,this)&&j(cC,this,z(cC,this)+1)}function aO(t){const e=null==t?void 0:t.placementId;if(!e||z(uC,this).has(e))return;const n=Tv(t),i=B(IC,this,QC).call(this,t);if(!Number.isFinite(n)||!Number.isFinite(i)||i<0)return void z(dC,this).add(e);const r=n+i;Number.isFinite(r)&&(z(uC,this).add(e),z(dC,this).delete(e),B(IC,this,sO).call(this,e,r))}function lO(){z(dC,this).size&&Array.from(z(dC,this)).forEach((t=>{const e=B(IC,this,xO).call(this,t);e?B(IC,this,aO).call(this,e):z(dC,this).delete(t)}))}function cO(t){const e=Number(t);if(!Number.isFinite(e))return;if(e<z(hC,this))return void j(hC,this,e);if(j(hC,this,e),B(IC,this,lO).call(this),!z(lC,this).length)return;const n=new Set;let i=z(cC,this);for(;i<z(lC,this).length;){const t=z(lC,this)[i];if(!t||!Number.isFinite(t.endTime)||t.endTime>e)break;t.placementId&&n.add(t.placementId),i+=1}i!==z(cC,this)&&(j(cC,this,i),n.size&&(B(IC,this,hO).call(this,n),B(IC,this,uO).call(this,n)))}function uO(t){if(t&&t.size)for(const e of z(oC,this)){const n=e.split(":")[0];t.has(n)&&z(oC,this).delete(e)}}function dO(t){const e=Array.isArray(null==t?void 0:t.frames)?t.frames:[],n=null==t?void 0:t.current;(n?[n,...e]:e).forEach((t=>{const e=null==t?void 0:t.frame;if(e&&"function"==typeof e.close)try{e.close()}catch(t){}}))}function hO(t){if(t&&t.size)for(const[e,n]of z(yC,this).entries())t.has(null==n?void 0:n.placementId)&&(B(IC,this,dO).call(this,n),z(yC,this).delete(e))}function fO(t={}){var e;const n=null==t?void 0:t.placementId,i=null==t?void 0:t.nodeId,r=null==t?void 0:t.trackId,o=null==t?void 0:t.segmentId,s=null==t?void 0:t.trackType;if(!(n&&i&&r&&o))return;if("video"!==s&&"image"!==s)return;const a=(null==t?void 0:t.frame)||(null==t?void 0:t.data);if(!a)return;"video"===s&&"object"==typeof a&&"function"==typeof a.close&&(a.__keepOpen=!0);const l=_F(a),c=Number.isFinite(null==l?void 0:l.width)?l.width:void 0,u=Number.isFinite(null==l?void 0:l.height)?l.height:void 0,d=Number.isFinite(null==t?void 0:t.pts)?t.pts:void 0;if(!Number.isFinite(d))return;const h=Number.isFinite(null==t?void 0:t.duration)?t.duration:void 0,f=`${n}:${r}`,p=z(yC,this).get(f),m=p||{placementId:n,nodeId:i,trackId:r,trackType:s,frames:[],current:void 0},v={placementId:n,nodeId:i,trackId:r,segmentId:o,frame:a,width:c,height:u,presentationTime:d,duration:h},g=m.frames,y=g.length?g[g.length-1]:void 0;if(!y||y.presentationTime<=v.presentationTime)g.push(v);else{let t=g.findIndex((t=>t.presentationTime>v.presentationTime));-1===t&&(t=g.length),g.splice(t,0,v)}const b=Number(null===(e=this.settings)||void 0===e?void 0:e.maxBufferedVideoFrames);if("video"===s&&Number.isFinite(b)&&b>0&&g.length>b){const t=g.length-b;for(let e=0;e<t;e+=1){const t=g.pop(),e=null==t?void 0:t.frame;if(e&&"function"==typeof e.close)try{e.close()}catch(t){}}}p||z(yC,this).set(f,m)}function pO(){for(const t of z(yC,this).values())B(IC,this,dO).call(this,t);z(yC,this).clear(),j(bC,this,null),z(oC,this).clear()}function mO(t){const e=Number.isFinite(t)?t:this.currentTime;if(!Number.isFinite(e))return;e<z(pC,this)&&(j(fC,this,[]),j(mC,this,0));const n=Array.isArray(z(QF,this))?z(QF,this):[],i=[],r=new Set;z(fC,this).forEach((t=>{B(IC,this,EO).call(this,t,e)&&(i.push(t),(null==t?void 0:t.placementId)&&r.add(t.placementId))}));let o=z(mC,this);for(;o<n.length;){const t=n[o],s=Tv(t);if(!Number.isFinite(s))break;if(s>e)break;if(B(IC,this,EO).call(this,t,e)){const e=null==t?void 0:t.placementId;e&&r.has(e)||(i.push(t),e&&r.add(e))}o+=1}j(fC,this,i),j(mC,this,o),j(pC,this,e)}function vO(t,e={}){const n=Number.isFinite(t)?t:this.currentTime,i=Number.isFinite(null==e?void 0:e.endEpsilonSeconds)?e.endEpsilonSeconds:0;return 0===i&&n===this.currentTime&&n===z(pC,this)?z(fC,this).slice():(Array.isArray(z(QF,this))?z(QF,this):[]).filter((t=>B(IC,this,EO).call(this,t,n,i)))}function gO(){const t=this.currentTime,e=B(IC,this,bO).call(this,t);if(!e.length)return void j(bC,this,null);const n=this.getActiveRenderPlacement(t),i=B(IC,this,kO).call(this,e,n);(i!==z(bC,this)||B(IC,this,yO).call(this,t,n))&&(j(bC,this,i),this.trigger(yh.VISUAL_FRAMES_AVAILABLE,{time:t,frames:e}))}function yO(t,e){const n=e||this.getActiveRenderPlacement(t);if(!n)return!1;if(!ig.doesRenderNodeTypeRequireFrameCadence(null==n?void 0:n.type))return!1;const i=n.duration;return"number"==typeof i&&i>0}function bO(t){return function(t={}){const e=t.buffers,n=t.time,i=t.getPlacementById,r=t.isPlacementActiveAtTime,o=t.getPlacementDuration,s=[];if(!e||"function"!=typeof e.entries)return[];const a=[];for(const[t,c]of e.entries()){const e=null==c?void 0:c.placementId,u="function"==typeof i?i(e):void 0;if(!u){yF(c),a.push(t);continue}if("function"==typeof r&&!r(u,n)){const e=bF(u),i="function"==typeof o?o(u):void 0;Number.isFinite(i)&&Number.isFinite(e)&&n>=e+i&&(yF(c),a.push(t));continue}const d=Array.isArray(null==c?void 0:c.frames)?c.frames:[];for(;d.length&&Number.isFinite(null===(l=d[0])||void 0===l?void 0:l.presentationTime)&&d[0].presentationTime<=n;){var l;const t=c.current,e=d.shift();c.current=e,t&&t!==e&&gF(null==t?void 0:t.frame)}if(!c.current)continue;const h={placementId:e,nodeId:c.current.nodeId,trackId:c.current.trackId,segmentId:c.current.segmentId,frame:c.current.frame,width:c.current.width,height:c.current.height,presentationTime:c.current.presentationTime,duration:c.current.duration};s.push({frame:h,placementId:e,placementOffset:bF(u),placementSortOffset:kF(u),placementSortId:xF(u,e)})}return a.forEach((t=>{e.delete(t)})),s.sort(((t,e)=>{const n=Number.isFinite(null==t?void 0:t.placementSortOffset)?t.placementSortOffset:Number.isFinite(null==t?void 0:t.placementOffset)?t.placementOffset:0,i=Number.isFinite(null==e?void 0:e.placementSortOffset)?e.placementSortOffset:Number.isFinite(null==e?void 0:e.placementOffset)?e.placementOffset:0;if(n!==i)return n-i;const r=(null==t?void 0:t.placementSortId)||(null==t?void 0:t.placementId),o=(null==e?void 0:e.placementSortId)||(null==e?void 0:e.placementId),s=wF(r),a=wF(o);return Number.isFinite(s)&&Number.isFinite(a)&&s!==a?s-a:r&&o&&r!==o?r<o?-1:1:function(t,e){const n=(null==t?void 0:t.frame)||{},i=(null==e?void 0:e.frame)||{};return n.trackId!==i.trackId?n.trackId<i.trackId?-1:1:n.nodeId!==i.nodeId?n.nodeId<i.nodeId?-1:1:n.segmentId!==i.segmentId?n.segmentId<i.segmentId?-1:1:("number"==typeof n.presentationTime?n.presentationTime:0)-("number"==typeof i.presentationTime?i.presentationTime:0)}(t,e)})),s.map((t=>t.frame))}({buffers:z(yC,this),time:t,getPlacementById:t=>B(IC,this,xO).call(this,t),isPlacementActiveAtTime:(t,e)=>B(IC,this,EO).call(this,t,e),getPlacementDuration:t=>B(IC,this,QC).call(this,t)})}function kO(t,e){return`${e?`render:${e.renderPlacementId||e.type||"unknown"}`:"render:default"}|${t.map((t=>`${t.nodeId}:${t.trackId}:${t.segmentId}@${t.presentationTime}`)).join("|")}`}function xO(t){if(t)return(z(QF,this)||[]).find((e=>(null==e?void 0:e.placementId)===t))}function wO(t){if("end"===t){const t=B(IC,this,_O).call(this);if(!Number.isFinite(t))return;const e=B(IC,this,IO).call(this);return Math.max(0,t-Math.min(t,e))}const e=Number(t);return Number.isFinite(e)?e:0}function _O(){let t;return(Array.isArray(z(QF,this))?z(QF,this):[]).forEach((e=>{const n=Tv(e);if(!Number.isFinite(n))return;const i=B(IC,this,QC).call(this,e);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(t)||r>t)&&(t=r)})),t}function IO(){const t=B(IC,this,TO).call(this);return t>0?t:.001}function TO(){var t;const e=Number(null===(t=this.settings)||void 0===t?void 0:t.snapToFps);return!Number.isFinite(e)||e<=0?0:.5/e}function EO(t,e,n=0){if(!Ev(t,e,z(VF,this)))return!1;const i=Number(n);if(!Number.isFinite(i)||i<=0)return!0;const r=B(IC,this,QC).call(this,t);if(!Number.isFinite(r))return!0;const o=Tv(t);return!Number.isFinite(o)||e<o+r-i}var SO=new WeakMap,MO=new WeakMap,AO=new WeakMap,NO=new WeakMap,FO=new WeakMap,CO=new WeakMap,OO=new WeakMap,PO=new WeakMap,RO=new WeakMap,DO=new WeakMap,BO=new WeakMap,LO=new WeakMap,zO=new WeakMap,WO=new WeakMap,jO=new WeakMap,$O=new WeakMap,UO=new WeakMap,qO=new WeakSet;class VO extends fh{get name(){return"QoE"}get defaults(){return{calcScoreInterval:1,streamQualityWeight:.8,fpsWeight:.2,fpsMathFuncType:"quad",bestFpsMobile:27,bestFpsDesktop:57,waitingMultiplier:1,statusFloors:{excellent:.98,good:.85,fair:.7,poor:0,alert:0},alertStatusCeil:.3,fpsGracePeriod:2,windowSeconds:30}}constructor(...t){super(...t),$(this,qO),W(this,SO,void 0),W(this,MO,void 0),W(this,AO,1),W(this,NO,1),W(this,FO,1),W(this,CO,""),W(this,OO,0),W(this,PO,[]),W(this,RO,null),W(this,DO,void 0),W(this,BO,[]),W(this,LO,null),W(this,zO,null),W(this,WO,0),W(this,jO,0),W(this,$O,0),W(this,UO,void 0);const[e]=t;j(SO,this,e),j(WO,this,zb()),j(UO,this,B(qO,this,GO).call(this)),B(qO,this,HO).call(this),B(qO,this,KO).call(this),B(qO,this,ZO).call(this),B(qO,this,QO).call(this)}get publicAPI(){return z(UO,this)}calcScore(){B(qO,this,lP).call(this)}onDispose(){z(SO,this)&&z(MO,this)&&"function"==typeof z(SO,this).off&&z(SO,this).off(yh.TIMELINE_PLAYER_STATE,z(MO,this)),j(MO,this,null),B(qO,this,JO).call(this),B(qO,this,tP).call(this),j(SO,this,null),j(BO,this,[]),j(PO,this,[]),j(UO,this,null)}}function GO(){const t=this;return{get score(){return z(AO,t)},get status(){return z(CO,t)},get streamQualityScore(){return z(NO,t)},get fpsScore(){return z(FO,t)},get browserFps(){return z(OO,t)},get waitingSeconds(){return z(jO,t)/1e3},get playingSeconds(){return z($O,t)/1e3}}}function HO(){Number(this.settings.streamQualityWeight)+Number(this.settings.fpsWeight)!==1&&(this.log.warn("QoE weights must sum to 1; resetting to legacy defaults."),this.settings.streamQualityWeight=.8,this.settings.fpsWeight=.2)}function KO(){z(SO,this)&&"function"==typeof z(SO,this).on&&(j(MO,this,(t=>B(qO,this,XO).call(this,t))),z(SO,this).on(yh.TIMELINE_PLAYER_STATE,z(MO,this)))}function XO(t={}){const e="string"==typeof(null==t?void 0:t.event)?t.event:"";"playing"!==e?"waiting"!==e?"pause"!==e&&"seeking"!==e&&"seeked"!==e&&"reset"!==e||B(qO,this,YO).call(this,null):B(qO,this,YO).call(this,"waiting"):B(qO,this,YO).call(this,"playing")}function YO(t){if(t===z(LO,this))return;const e=zb();z(LO,this)&&Number.isFinite(z(zO,this))&&z(BO,this).push({state:z(LO,this),startMs:z(zO,this),endMs:e}),j(LO,this,t),j(zO,this,t?e:null),B(qO,this,iP).call(this,e)}function QO(){const t=Number(this.settings.calcScoreInterval);!Number.isFinite(t)||t<=0||(j(DO,this,(()=>B(qO,this,lP).call(this))),Aw(z(DO,this),1e3*t))}function JO(){z(DO,this)&&Nw(z(DO,this)),j(DO,this,null)}function ZO(){if("function"!=typeof bw)return;const t=()=>{if(this._disposed)return;const e=zb();j(OO,this,B(qO,this,eP).call(this,z(PO,this),e)),j(RO,this,bw(t))};j(RO,this,bw(t))}function tP(){z(RO,this)&&"function"==typeof kw&&kw(z(RO,this)),j(RO,this,null)}function eP(t,e){const n=B(qO,this,nP).call(this);for(t.push(e);t.length&&e-t[0]>n;)t.shift();if(t.length<2)return 0;const i=t[t.length-1]-t[0];return i<=0?0:1e3*(t.length-1)/i}function nP(){const t=Number(this.settings.windowSeconds);return!Number.isFinite(t)||t<=0?3e4:1e3*t}function iP(t){const e=t-B(qO,this,nP).call(this);for(;z(BO,this).length&&z(BO,this)[0].endMs<=e;)z(BO,this).shift()}function rP(t){const e=t-B(qO,this,nP).call(this);let n=0,i=0;const r=(r,o,s)=>{const a=Math.max(o,e),l=Math.min(s,t);l<=a||("waiting"===r?n+=l-a:"playing"===r&&(i+=l-a))};return z(BO,this).forEach((t=>{r(t.state,t.startMs,t.endMs)})),z(LO,this)&&Number.isFinite(z(zO,this))&&r(z(LO,this),z(zO,this),t),j(jO,this,n),j($O,this,i),{waitingMs:n,playingMs:i}}function oP(t,e){if(t<=0)return 1;if(t>e)return 0;const n=e||1;return xv(1-t*this.settings.waitingMultiplier/n)}function sP(){if(zb()-z(WO,this)<=1e3*this.settings.fpsGracePeriod)return 1;const t=Number(z(OO,this)),e=Ag.isDesktop()?this.settings.bestFpsDesktop:this.settings.bestFpsMobile,n=xv(e>0?t/e:0);return"quad"===this.settings.fpsMathFuncType?n*n:n}function aP(t,e){const n=this.settings.statusFloors||{};let i="";return t>=n.excellent?i="excellent":t>=n.good?i="good":t>=n.fair?i="fair":(i="poor",t<=this.settings.alertStatusCeil&&e>0&&(i="alert")),i}function lP(){const t=zb(),{waitingMs:e,playingMs:n}=B(qO,this,rP).call(this,t),i=B(qO,this,oP).call(this,e,n),r=B(qO,this,sP).call(this),o=xv(i*this.settings.streamQualityWeight+r*this.settings.fpsWeight);o!==z(AO,this)&&(j(AO,this,o),this.trigger(yh.QOE_SCORE,o)),j(NO,this,i),j(FO,this,r);const s=B(qO,this,aP).call(this,o,e);s!==z(CO,this)&&(j(CO,this,s),this.trigger(yh.QOE_STATUS,s))}function cP(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}function uP(t){const e=Number(t);return!Number.isFinite(e)||e<0?0:e}var dP=new WeakMap,hP=new WeakMap,fP=new WeakMap,pP=new WeakMap,mP=new WeakSet;class vP extends fh{get name(){return"SegmentEvictionCoordinator"}get defaults(){return{enabled:nk("segmentEvictionEnabled"),bufferBehindSeconds:nk("segmentEvictionBufferBehindSeconds"),bufferAheadSeconds:nk("segmentEvictionBufferAheadSeconds"),maxRetainedBytes:nk("segmentEvictionMaxRetainedBytes")}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"evictAtTime"])}constructor(t,e,n={}){super(n),$(this,mP),W(this,dP,void 0),W(this,hP,void 0),W(this,fP,void 0),W(this,pP,void 0),j(dP,this,t),j(hP,this,e),j(fP,this,(t=>B(mP,this,gP).call(this,t))),j(pP,this,(t=>B(mP,this,yP).call(this,t))),z(dP,this)&&"function"==typeof z(dP,this).on&&(z(dP,this).on(yh.TIMELINE_TIME_UPDATE,z(fP,this)),z(dP,this).on(yh.TIMELINE_SEEKED,z(pP,this)))}onDispose(){z(dP,this)&&"function"==typeof z(dP,this).off&&(z(dP,this).off(yh.TIMELINE_TIME_UPDATE,z(fP,this)),z(dP,this).off(yh.TIMELINE_SEEKED,z(pP,this))),j(dP,this,null),j(hP,this,null),j(fP,this,null),j(pP,this,null)}evictAtTime(t){if(!0!==this.settings.enabled)return;const e=Number(t);if(!Number.isFinite(e))return;const n=uP(this.settings.bufferBehindSeconds),i=uP(this.settings.bufferAheadSeconds),r=e-n,o=e+i,s=B(mP,this,bP).call(this);if(!s.length)return;const a=Number(this.settings.maxRetainedBytes);if(Number.isFinite(a)&&a>0&&B(mP,this,kP).call(this,s)<=a)return;const l=new Map;s.forEach((t=>{const e=null==t?void 0:t.nodeId;if(!e)return;const n=Tv(t);if(!Number.isFinite(n))return;const i=l.get(e)||[];i.push(t),l.set(e,i)})),l.size&&l.forEach(((t,e)=>{const n=B(mP,this,xP).call(this,e);if(!n)return;const i=t.filter((t=>B(mP,this,wP).call(this,t,r,o)));i.length?B(mP,this,_P).call(this,n,i,r,o):"function"==typeof n.evict&&n.evict()}))}}function gP(t){var e,n;if(!0!==this.settings.enabled)return;if((null===(e=z(dP,this))||void 0===e?void 0:e.state)===Dg)return;const i=Number(null==t?void 0:t.time),r=Number.isFinite(i)?i:Number(null===(n=z(dP,this))||void 0===n?void 0:n.currentTime);this.evictAtTime(r)}function yP(t){var e;if(!0!==this.settings.enabled)return;const n=Number(null==t?void 0:t.targetTime),i=Number.isFinite(n)?n:Number(null===(e=z(dP,this))||void 0===e?void 0:e.currentTime);this.evictAtTime(i)}function bP(){var t;const e=null===(t=z(dP,this))||void 0===t?void 0:t.placements;return Array.isArray(e)?e:[]}function kP(t){if(!Array.isArray(t)||!t.length)return 0;const e=new Set;let n=0;return t.forEach((t=>{const i=null==t?void 0:t.nodeId;if(!i||e.has(i))return;e.add(i);const r=B(mP,this,xP).call(this,i),o=Number(null==r?void 0:r.retainedByteLength);fb(o)?n+=o:(Array.isArray(null==r?void 0:r.tracks)?r.tracks:[]).forEach((t=>{(Array.isArray(null==t?void 0:t.segments)?t.segments:[]).forEach((t=>{fb(null==t?void 0:t.retainedByteLength)&&(n+=t.retainedByteLength)}))}))})),n}function xP(t){if(z(hP,this)&&"function"==typeof z(hP,this).get)return z(hP,this).get(t)}function wP(t,e,n){const i=Tv(t);if(!Number.isFinite(i))return!1;const r=_v(t,z(hP,this));return(Number.isFinite(r)?i+r:Number.POSITIVE_INFINITY)>e&&i<n}function _P(t,e,n,i){const r=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];r.length&&r.forEach((t=>{const r=Array.isArray(null==t?void 0:t.segments)?t.segments:[],o=cP(null==t?void 0:t.offset,0);r.forEach((t=>{if(!t||!fb(null==(r=t)?void 0:r.retainedByteLength))return;var r;if(t.isInit)return;let s=!1;for(let r=0;r<e.length;r+=1){const a=e[r],l=Tv(a);if(!Number.isFinite(l))continue;const c=cP(null==a?void 0:a.nodeOffsetOverride,0),u=cP(null==t?void 0:t.offset,NaN);if(!Number.isFinite(u))continue;const d=cP(null==t?void 0:t.duration,0),h=l+o+u-c,f=h+(d>0?d:0),p=_v(a,z(hP,this)),m=Number.isFinite(p)?l+p:Number.POSITIVE_INFINITY;if(!(f<=l||h>=m||f<=n||h>=i)){s=!0;break}}s||t.evict()}))}))}var IP=new WeakMap,TP=new WeakMap,EP=new WeakMap,SP=new WeakSet;class MP extends fh{get name(){return"DocumentVisibility"}get defaults(){return{autoPauseOnVisibilityChange:!0,autoResumeOnVisibilityChange:!0}}constructor(t,e={}){super(e),$(this,SP),W(this,IP,void 0),W(this,TP,null),W(this,EP,!1),j(IP,this,t),B(SP,this,AP).call(this)}onDispose(){B(SP,this,NP).call(this),j(IP,this,null),j(EP,this,!1)}}function AP(){const t=null==vh?void 0:vh.document;t&&"function"==typeof t.addEventListener&&(j(TP,this,(()=>B(SP,this,FP).call(this))),t.addEventListener("visibilitychange",z(TP,this)))}function NP(){const t=null==vh?void 0:vh.document;z(TP,this)&&t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",z(TP,this)),j(TP,this,null)}function FP(){const t=null==vh?void 0:vh.document,e=null==t?void 0:t.visibilityState;"string"==typeof e&&("hidden"!==e?"visible"===e&&B(SP,this,OP).call(this):B(SP,this,CP).call(this))}function CP(){var t;(null===(t=this.settings)||void 0===t?void 0:t.autoPauseOnVisibilityChange)&&z(IP,this)&&"function"==typeof z(IP,this).pause&&(z(IP,this).state===Cg?(this.log.info("[#handleHidden] Pausing timeline due to document visibility change"),z(IP,this).pause(),j(EP,this,!0)):j(EP,this,!1))}function OP(){var t;z(EP,this)&&(null===(t=this.settings)||void 0===t?void 0:t.autoResumeOnVisibilityChange)&&z(IP,this)&&"function"==typeof z(IP,this).play&&(z(IP,this).state!==Cg?(this.log.info("[#handleVisible] Resuming timeline due to document visibility change"),z(IP,this).play(),j(EP,this,!1)):j(EP,this,!1))}const PP=[{event:"canplay",once:!0,trackAs:"canplay"},{event:"playing",once:!0,trackAs:"startedplaying"},"seeked","canvas.webglcontextlost"];function RP(t,e=0){return Number.isFinite(t)?t:e}function DP(t){const e=null==t?void 0:t.exposedPlayerAPI;return e&&"object"==typeof e?e:t}const BP=[function(t){return{schema:"iglu:com.helloeko/player/jsonschema/1-0-7",match:/^.*$/,getData:()=>{var e,n,i;const r=function(t){const e=null==t?void 0:t.exposedPlayerAPI;return e&&"object"==typeof e?e:t}(t);return{playerversion:"string"==typeof(null==r?void 0:r.version)?r.version:"0.0.0",isautoplay:!(null==r||null===(e=r.options)||void 0===e||!e.autoplay),playerqoe:RP(null==r||null===(n=r.qoe)||void 0===n?void 0:n.score),playerqoestatus:"string"==typeof(null==r||null===(i=r.qoe)||void 0===i?void 0:i.status)?r.qoe.status:"",ismuted:!(null==r||!r.muted),playervolume:RP(null==r?void 0:r.volume),playercontainerwidth:RP(null==r?void 0:r.containerWidth),playercontainerheight:RP(null==r?void 0:r.containerHeight)}}}},function(t){return{schema:"iglu:com.helloeko/currentnode/jsonschema/1-0-2",match:/^.*$/,getData:()=>{var e;const n=DP(t),i=function(t){const e=DP(t);if(!e||"function"!=typeof e.getNodesAtTime)return null;const n=Number.isFinite(e.currentTime)?e.currentTime:0,i=e.getNodesAtTime(n);return Array.isArray(i)&&0!==i.length&&i[0]||null}(t);return{currentnodeid:"string"==typeof(null==i?void 0:i.id)?i.id:"",currentnodetime:Number.isFinite(null==n?void 0:n.currentTime)?n.currentTime:0,currentnodeduration:Number.isFinite(null==i?void 0:i.duration)?i.duration:0,currentnodeprofile:"string"==typeof(null==i||null===(e=i.metadata)||void 0===e?void 0:e.profile)?i.metadata.profile:""}}}},function(t){let e=0,n=0;const i=()=>{e||(e=Date.now(),n=0)},r=()=>{e&&!n&&(n=Date.now())};return t&&"function"==typeof t.on&&(t.on("seeking",i),t.on("seeked",r)),{schema:"iglu:com.helloeko/seeked/jsonschema/1-0-0",match:"seeked",getData:()=>{r();const t=e&&n&&n>=e?(n-e)/1e3:0;return e=0,n=0,{seekduration:t}},dispose:()=>{t&&"function"==typeof t.off&&(t.off("seeking",i),t.off("seeked",r))}}},function(){return{schema:"iglu:com.helloeko/environment/jsonschema/1-0-0",match:/^.*$/,getData:()=>{var t;const e=null==vh||null===(t=vh.eko)||void 0===t||null===(t=t.environment)||void 0===t?void 0:t.embeddingApp;return e?{embeddingapp:e}:{}}}}],LP=Object.freeze({once:!1,trackAs:""});var zP=new WeakMap,WP=new WeakMap,jP=new WeakMap,$P=new WeakMap,UP=new WeakMap,qP=new WeakMap,VP=new WeakSet;class GP extends fh{get name(){return"Tracker"}get defaults(){return{tag:null,trackingEnabled:nk("trackingEnabled"),defaultForwarders:PP,defaultContextPackers:BP}}constructor(t,e={}){var n,i;super(e),$(this,VP),W(this,zP,void 0),W(this,WP,new Map),W(this,jP,[]),W(this,$P,!1),W(this,UP,void 0),W(this,qP,void 0),j(qP,this,!this.settings.tag),j(UP,this,this.settings.tag||(null===(n=crypto)||void 0===n||null===(i=n.randomUUID)||void 0===i?void 0:i.call(n))||`eko-player-${Date.now()}`),j(zP,this,t),B(VP,this,ZP).call(this),B(VP,this,KP).call(this)}track(t,...e){if(!this.settings.trackingEnabled)return;if("string"!=typeof t||!t)return void this.log.warn("[track] Expected event to be a non-empty string.");const n=B(VP,this,eR).call(this);n&&n("track",t,...e,z(UP,this))}registerContextPacker(t){if(!t||"object"!=typeof t)return void this.log.warn("[registerContextPacker] Expected a packer object.");const e={tag:z(UP,this),schema:t.schema,match:t.match,getData:B(VP,this,HP).call(this,t.getData)};if("string"!=typeof e.schema||!e.schema)return void this.log.warn('[registerContextPacker] Expected "schema" to be a non-empty string.');if("function"!=typeof e.getData)return void this.log.warn('[registerContextPacker] Expected "getData" to be a function.');if(!this.settings.trackingEnabled)return;const n=B(VP,this,eR).call(this);n&&n("registerContextPacker",e)}onDispose(){if(B(VP,this,JP).call(this),B(VP,this,tR).call(this),j(zP,this,null),z(qP,this)){const t=B(VP,this,eR).call(this);t&&(t("reset",z(UP,this)),j(UP,this,null))}}}function HP(t){return"function"!=typeof t?null:(...e)=>e.pop()!==z(UP,this)?null:t(...e)}function KP(){(Array.isArray(this.settings.defaultForwarders)?this.settings.defaultForwarders:[]).forEach((t=>B(VP,this,XP).call(this,t)))}function XP(t){const e=B(VP,this,YP).call(this,t);if(!e)return void this.log.warn("[#addEventForwarder] Invalid forwarder input.",t);const n=z(zP,this);if(!n||"function"!=typeof n.on)return;const i=B(VP,this,QP).call(this,e);if(z(WP,this).has(i))return;const r=(...t)=>{e.once&&n&&"function"==typeof n.off&&n.off(e.event,r);const i=e.trackAs||e.event;this.track(i,...t)};n.on(e.event,r),z(WP,this).set(i,{event:e.event,listener:r})}function YP(t){return"string"==typeof t&&t?{event:t,...LP}:t&&"object"==typeof t&&"string"==typeof t.event&&t.event?{event:t.event,once:!!t.once,trackAs:"string"==typeof t.trackAs?t.trackAs:""}:null}function QP({event:t,once:e,trackAs:n}){return`${t}:${e}:${n}`}function JP(){const t=z(zP,this);t&&"function"==typeof t.off&&z(WP,this).forEach((({event:e,listener:n})=>{t.off(e,n)})),z(WP,this).clear()}function ZP(){(Array.isArray(this.settings.defaultContextPackers)?this.settings.defaultContextPackers:[]).forEach((t=>{if("function"!=typeof t)return;const e=t(z(zP,this),this);e&&"object"==typeof e&&("function"==typeof e.dispose&&z(jP,this).push(e.dispose),e.disabled||this.registerContextPacker({schema:e.schema,match:e.match,getData:e.getData}))}))}function tR(){z(jP,this).forEach((t=>{try{t()}catch(t){this.log.warn("[#teardownContextPackers] Failed disposing context packer.",t)}})),j(jP,this,[])}function eR(){const t=null==vh?void 0:vh.EkoAnalytics;return"function"==typeof t?t:(B(VP,this,nR).call(this),null)}function nR(){this.settings.trackingEnabled&&!z($P,this)&&(this.log.warn("EkoAnalytics not found on window."),j($P,this,!0))}class iR{#rt;#ot;#st;#at;#lt;#ct;#ut;#dt;#ht;#ft;#pt;#mt;#vt;#gt;#yt;#bt;#kt;#xt;#wt;constructor(t,e={},n=null){this.#rt=new Nh(t,n,e),this.#ot=new jh(this.#rt,e),this.#st=new dw(e),this.#at=new ck(e),this.#lt=new Gx(this.#at,e),this.#ct=new jx(this.#lt,this.#st,e),this.#ut=new tw(this.#ct,e),this.#dt=new TC(this.#ct,e),this.#ht=new MP(this.#dt,e),this.#xt=new vP(this.#dt,this.#ct,e),this.#ft=new Qw(this.#ct,this.#ut,this.#st,this.#dt,e),this.#pt=new B_(this.#ct,this.#ut,this.#dt,e),this.#mt=new HS(e),this.#vt=new yM(this.#ct,this.#dt,this.#mt,e),this.#yt=new VO(this.#dt,e),this.#wt=new GP(n,e);const i=e&&"object"==typeof e?e.adapters:null,r=i&&"object"==typeof i&&"function"==typeof i.renderAdapterFactory?i.renderAdapterFactory:null,o=i&&"object"==typeof i&&"function"==typeof i.audioAdapterFactory?i.audioAdapterFactory:null;this.#bt=r?r({timeline:this.#dt,canvas:this.#rt,containerSize:this.#ot,options:e}):new Ey(this.#dt,this.#rt,this.#ot,e),this.#gt=o?o({timeline:this.#dt,decodeCoordinator:this.#vt,options:e}):new tN(this.#dt,this.#vt,e),this.#kt=new kA(this.#dt,this.#bt,e)}get canvas(){return this.#rt}get containerSize(){return this.#ot}get assetsDeliveryService(){return this.#st}get downloadSpeed(){return this.#at}get abrSelector(){return this.#lt}get nodeRepository(){return this.#ct}get nodePrioritizer(){return this.#ut}get timeline(){return this.#dt}get documentVisibility(){return this.#ht}get nodeResolver(){return this.#ft}get segmentLoadCoordinator(){return this.#pt}get decoderFactory(){return this.#mt}get parsingManager(){return this.#vt}get audioAdapter(){return this.#gt}get audioPlaybackManager(){return this.#gt}get qoe(){return this.#yt}get renderAdapter(){return this.#bt}get renderer(){return this.#bt}get transitionManager(){return this.#kt}get tracker(){return this.#wt}dispose(){[this.#wt,this.#dt,this.#ht,this.#pt,this.#ft,this.#ut,this.#ct,this.#st,this.#lt,this.#at,this.#vt,this.#mt,this.#gt,this.#yt,this.#bt,this.#kt,this.#xt,this.#ot,this.#rt].forEach((t=>{t&&"function"==typeof t.dispose&&t.dispose()})),this.#dt=null,this.#ht=null,this.#pt=null,this.#ft=null,this.#ut=null,this.#ct=null,this.#st=null,this.#lt=null,this.#at=null,this.#vt=null,this.#mt=null,this.#gt=null,this.#yt=null,this.#bt=null,this.#kt=null,this.#xt=null,this.#rt=null,this.#wt=null}}const rR="devops.1227706";var oR={isPlainObject:lh,deepMerge:ch,get:Rb,set:Db,ekoGlobalStore:Bb,download:Jb,isPositiveNumber:fb,clamp01:xv,root:vh,now:zb,getFrameDimensions:_F,codecs:wk,useragent:Ng,requestAnimationFrame:bw,cancelAnimationFrame:kw,start:Aw,stop:Nw,isTicking:Fw,predicator:function(t,e){const n=e||{};if("function"!=typeof t)return void xw.error("[predicator] Bad argument given to predicator, first argument must be a function.",arguments);if(t.apply())return xw.debug("[predicator] Invoking onFulfilled immediately."),void("function"==typeof n.onFulfilled&&n.onFulfilled.call(null,0));const i=n.timeout||1e4,r=n.interval,o=zb();let s,a,l,c,u;c=function(){t.apply()&&l()},l=function(){Nw(c),vh.clearTimeout(s),u=zb()-o,xw.debug("[predicator] Invoking onFulfilled after "+u+" ms."),"function"==typeof n.onFulfilled&&n.onFulfilled.call(null,u)},a=function(){Nw(c),u=zb()-o,xw.debug("[predicator] Invoking onTimeout after "+u+" ms."),"function"==typeof n.onTimeout&&n.onTimeout.call(null,u)},s=vh.setTimeout(a,i),Aw(c,r)},createThrottler:Cw,scheduleExecution:Ow},sR=new WeakMap,aR=new WeakMap,lR=new WeakMap,cR=new WeakMap,uR=new WeakMap,dR=new WeakMap,hR=new WeakMap,fR=new WeakSet;class pR{constructor(t){$(this,fR),W(this,sR,[]),W(this,aR,[]),W(this,lR,new $F("placement-")),W(this,cR,new $F("renderplacement-")),W(this,uR,void 0),W(this,dR,new Map),W(this,hR,void 0),j(uR,this,t),j(hR,this,{allowUnready:!0,getNode:t=>B(fR,this,mR).call(this,t)})}get placements(){return z(sR,this).slice()}get renderPlacements(){return z(aR,this).slice()}getNodesAtTime(t){B(fR,this,vR).call(this);const e=B(fR,this,yR).call(this,t);if(!Number.isFinite(e))return[];const n=z(sR,this).filter((t=>Ev(t,e,null,z(hR,this)))),i=[];return n.forEach((t=>{const e=B(fR,this,mR).call(this,null==t?void 0:t.nodeId);e&&i.push(e)})),i}placeOnTimeline(t,e,n={}){const i=t&&"object"==typeof t?t:null,r=i?i.id:t;if(!r)throw new Error("TimelineDefinition.placeOnTimeline requires node id");i&&z(dR,this).set(r,i);const o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=Fv(e);if("string"==typeof e&&e.includes("@")&&!a)throw new Error("TimelineDefinition.placeOnTimeline requires valid placement reference");const{wantsEndOffset:l,endOffsetSeconds:c}=a?{wantsEndOffset:!1}:Nv(e,n);let u,d,h,f=!1;const p=null!==a;if(a){const t=z(sR,this).find((t=>(null==t?void 0:t.placementId)===a.placementId));if(!t)throw new Error("TimelineDefinition.placeOnTimeline requires valid placement reference");d=t.placementId,h=a.anchor;const e=Tv(t);if("start"===a.anchor)Number.isFinite(e)?u=e:f=!0;else{const n=B(fR,this,gR).call(this,t);Number.isFinite(e)&&n>0?u=e+n:f=!0}}else if(l){const t=n.offsetAnchorPlacementId?z(sR,this).find((t=>(null==t?void 0:t.placementId)===n.offsetAnchorPlacementId)):z(sR,this).length?z(sR,this)[z(sR,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==t?void 0:t.placementId),d){const e=Tv(t),n=B(fR,this,gR).call(this,t);Number.isFinite(e)&&n>0?u=e+n-c:(f=!0,h="end")}else u=-c}else u=Av(e);const m=z(lR,this).claim(n.placementId),v={placementId:m,nodeId:r,offset:u,offsetPending:f,offsetAnchorPlacementId:f?d:void 0,offsetAnchorEdge:f?h:void 0,offsetAnchorIsReference:f?p:void 0,offsetEndSeconds:l?c:a&&"end"===a.anchor?0:void 0,nodeOffsetOverride:o,nodeDurationOverride:s,loop:!0===n.loop};return z(sR,this).push(v),Sv(z(sR,this)),m}placeRenderNodeOnTimeline(t,e,n,i={}){const r="string"==typeof t?t:null==t?void 0:t.type;if(!r||"string"!=typeof r)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires render node type");let o,s,a,l=!1;const c=Fv(e);if("string"==typeof e&&e.includes("@")&&!c)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires valid placement reference");const u=null!==c;if(c){const t=z(sR,this).find((t=>(null==t?void 0:t.placementId)===c.placementId));if(!t)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires valid placement reference");s=t.placementId,a=c.anchor;const e=Tv(t);if("start"===c.anchor)Number.isFinite(e)?o=e:l=!0;else{const n=B(fR,this,gR).call(this,t);Number.isFinite(e)&&Number.isFinite(n)?o=e+n:l=!0}}else o=Av(e);const d=z(cR,this).claim(i.renderPlacementId),h=Number(n),f=h===Number.POSITIVE_INFINITY,p=Number.isFinite(h)&&h>0||f?h:void 0;if(!p)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires a positive duration (seconds) or Infinity as 3rd argument");const m={renderPlacementId:d,type:r,offset:o,offsetPending:l,offsetAnchorPlacementId:l?s:void 0,offsetAnchorEdge:l?a:void 0,offsetAnchorIsReference:l?u:void 0,duration:p,params:i.params&&"object"==typeof i.params?i.params:void 0};if(!l){const t=o,e=o+p;Cv(z(aR,this),t,e,"TimelineDefinition.placeRenderNodeOnTimeline does not allow overlapping render nodes")}return z(aR,this).push(m),Sv(z(aR,this)),d}}function mR(t){if(t)return z(uR,this)&&"function"==typeof z(uR,this).get?z(uR,this).get(t):z(dR,this).get(t)}function vR(){return Mv(z(sR,this),{getPlacementDuration:t=>B(fR,this,gR).call(this,t)}).updated}function gR(t){return _v(t,null,z(hR,this))}function yR(t){if("end"===t){const t=B(fR,this,bR).call(this);if(!Number.isFinite(t))return;return Math.max(0,t-Math.min(t,.001))}const e=Number(t);return Number.isFinite(e)?e:0}function bR(){let t;return z(sR,this).forEach((e=>{const n=Tv(e);if(!Number.isFinite(n))return;const i=B(fR,this,gR).call(this,e);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(t)||r>t)&&(t=r)})),t}const kR=new Set(["canplay","play","playing","waiting","pause","seeking","seeked"]);var xR=new WeakMap,wR=new WeakMap,_R=new WeakMap,IR=new WeakMap,TR=new WeakMap,ER=new WeakMap,SR=new WeakMap,MR=new WeakMap,AR=new WeakMap,NR=new WeakMap,FR=new WeakMap,CR=new WeakMap,OR=new WeakMap,PR=new WeakMap,RR=new WeakMap,DR=new WeakMap,BR=new WeakMap,LR=new WeakMap,zR=new WeakMap,WR=new WeakMap,jR=new WeakMap,$R=new WeakMap,UR=new WeakMap,qR=new WeakMap,VR=new WeakMap,GR=new WeakSet;class HR extends fh{get name(){return"EkoPlayer"}get exposedPlayerAPI(){return z(IR,this)}constructor(t,e={}){const{options:n,publicOptions:i}=function(t={}){const e=ch({},tk,t);Object.entries(Zb).forEach((([t,{targetPaths:n}])=>{void 0!==e[t]&&n.forEach((n=>{void 0===Rb(e,n)&&Db(e,n,e[t])}))}));const n=function(t){const e={};return Object.keys(Zb).forEach((n=>{Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})),Object.freeze(e)}(e);return ek.info("Processed options:",e),ek.info("Public options:",n),{options:e,publicOptions:n}}(e);return super(n),$(this,GR),W(this,xR,void 0),W(this,wR,void 0),W(this,_R,void 0),W(this,IR,void 0),W(this,TR,void 0),W(this,ER,void 0),W(this,SR,void 0),W(this,MR,void 0),W(this,AR,void 0),W(this,NR,void 0),W(this,FR,void 0),W(this,CR,void 0),W(this,OR,void 0),W(this,PR,void 0),W(this,RR,void 0),W(this,DR,void 0),W(this,BR,void 0),W(this,LR,void 0),W(this,zR,void 0),W(this,WR,void 0),W(this,jR,void 0),W(this,$R,void 0),W(this,UR,void 0),W(this,qR,void 0),W(this,VR,0),j(_R,this,i),this.log.info("Initializing EkoPlayer with options:",i),j(CR,this,new iR(t,n,this)),B(GR,this,iD).call(this,z(CR,this)),j(RR,this,(t=>B(GR,this,KR).call(this,t))),z(wR,this)&&"function"==typeof z(wR,this).on&&z(wR,this).on(yh.TIMELINE_CUEPOINT,z(RR,this)),j(DR,this,null),j(LR,this,(t=>B(GR,this,XR).call(this,t))),j(zR,this,(t=>{const e=t&&"object"==typeof t?t:{};B(GR,this,XR).call(this,{...e,event:"seeking"})})),j(WR,this,(t=>{const e=t&&"object"==typeof t?t:{};B(GR,this,XR).call(this,{...e,event:"seeked"})})),z(wR,this)&&"function"==typeof z(wR,this).on&&(z(wR,this).on(yh.TIMELINE_PLAYER_STATE,z(LR,this)),z(wR,this).on(yh.TIMELINE_SEEKING,z(zR,this)),z(wR,this).on(yh.TIMELINE_SEEKED,z(WR,this))),j(UR,this,(t=>{const e=t&&"object"==typeof t?t:{};this.trigger(yh.CONTAINER_RESIZE,e)})),z(OR,this)&&"function"==typeof z(OR,this).on&&z(OR,this).on(yh.CONTAINER_RESIZE,z(UR,this)),B(GR,this,ZR).call(this),B(GR,this,JR).call(this),j(IR,this,B(GR,this,nD).call(this)),z(IR,this)}onDispose(){z(wR,this)&&"function"==typeof z(wR,this).off&&z(RR,this)&&z(wR,this).off(yh.TIMELINE_CUEPOINT,z(RR,this)),j(RR,this,null),z(wR,this)&&"function"==typeof z(wR,this).off&&(z(LR,this)&&z(wR,this).off(yh.TIMELINE_PLAYER_STATE,z(LR,this)),z(zR,this)&&z(wR,this).off(yh.TIMELINE_SEEKING,z(zR,this)),z(WR,this)&&z(wR,this).off(yh.TIMELINE_SEEKED,z(WR,this))),j(LR,this,null),j(zR,this,null),j(WR,this,null),j(DR,this,null),z(OR,this)&&"function"==typeof z(OR,this).off&&z(UR,this)&&z(OR,this).off(yh.CONTAINER_RESIZE,z(UR,this)),j(UR,this,null),z(FR,this)&&"function"==typeof z(FR,this).off&&(z(jR,this)&&z(FR,this).off("qoescore",z(jR,this)),z($R,this)&&z(FR,this).off("qoestatus",z($R,this))),j(jR,this,null),j($R,this,null),z(NR,this)&&"function"==typeof z(NR,this).off&&z(qR,this)&&z(NR,this).off(yh.DECODER_ERROR,z(qR,this)),j(qR,this,null),j(VR,this,0),z(PR,this)&&"function"==typeof z(PR,this).dispose&&z(PR,this).dispose(),j(PR,this,null),z(CR,this)&&"function"==typeof z(CR,this).dispose&&z(CR,this).dispose(),j(wR,this,null),j(xR,this,null),j(ER,this,null),j(SR,this,null),j(MR,this,null),j(AR,this,null),j(NR,this,null),j(FR,this,null),j(OR,this,null),j(TR,this,null),j(IR,this,null),j(CR,this,null)}}function KR(t={}){var e;this.trigger(yh.TIMELINE_CUEPOINT,t);const n="string"==typeof(null==t||null===(e=t.cuepoint)||void 0===e?void 0:e.name)?t.cuepoint.name:"";n&&this.trigger(n,t)}function XR(t={}){const e="string"==typeof(null==t?void 0:t.event)?t.event:"";if(!kR.has(e))return;if("playing"!==e||Number.isFinite(z(BR,this))||(j(BR,this,zb()),this.log.info(`[#handlePlayerStateEvent] Playback started @ ${(z(BR,this)/1e3).toFixed(3)}s (${Date.now()})`)),z(DR,this)===e)return;j(DR,this,e);const n=Number.isFinite(null==t?void 0:t.time)?t.time:z(wR,this)&&Number.isFinite(z(wR,this).currentTime)?z(wR,this).currentTime:0,i={};Number.isFinite(n)&&(i.time=n),"string"==typeof(null==t?void 0:t.from)&&(i.from=t.from),"string"==typeof(null==t?void 0:t.to)&&(i.to=t.to),Number.isFinite(null==t?void 0:t.targetTime)&&(i.targetTime=t.targetTime),Array.isArray(null==t?void 0:t.placements)&&(i.placements=t.placements.slice()),this.trigger(e,i)}function YR(){return new pR(z(xR,this))}function QR(t){if(!t||"object"!=typeof t)throw new Error("EkoPlayer.switchTimeline requires a timeline definition");if(!z(wR,this)||"function"!=typeof z(wR,this).applyTimelineDefinition)throw new Error("EkoPlayer.switchTimeline requires an active timeline");z(wR,this).applyTimelineDefinition(t),"function"==typeof z(wR,this).play&&z(wR,this).play()}function JR(){z(FR,this)&&"function"==typeof z(FR,this).on&&(j(jR,this,(t=>{this.trigger(yh.QOE_SCORE,t)})),j($R,this,(t=>{this.trigger(yh.QOE_STATUS,t)})),z(FR,this).on(yh.QOE_SCORE,z(jR,this)),z(FR,this).on(yh.QOE_STATUS,z($R,this)))}function ZR(){z(NR,this)&&"function"==typeof z(NR,this).on&&(j(qR,this,(t=>{const e=t&&"object"==typeof t?t:{error:t};this.trigger(yh.DECODER_ERROR,e),B(GR,this,tD).call(this,e)})),z(NR,this).on(yh.DECODER_ERROR,z(qR,this)))}function tD(t={}){var e;const n=z(wR,this);if(!n||"number"!=typeof n.currentTime)return;const i=Date.now();if(i<z(VR,this))return;const r=Number(n.currentTime);if(!Number.isFinite(r))return;const o=Number(null==n||null===(e=n.settings)||void 0===e?void 0:e.snapToFps),s=Number.isFinite(o)&&o>0?1/o:1/60;j(VR,this,i+1500),this.log.warn("[#attemptDecoderRecoverySeek] decoder:error received, attempting seek recovery",null==t?void 0:t.error),n.currentTime=r+s}async function eD(t={}){var e;if(z(PR,this))return z(PR,this);const n=t&&"object"==typeof t&&!Array.isArray(t)?{...t}:{},i=z(TR,this)&&z(TR,this).element?z(TR,this).element:null;if(!i)throw new Error("Debug overlay requires an initialized player canvas and mount element.");const r=function({canvasElement:t,containerElement:e}={}){const n=t&&t.parentNode?t.parentNode:null;if(null==e)return n;const i=function(t,e=(null==vh?void 0:vh.document)){if(gh(t))return t;if("string"!=typeof t)return null;let n=t.trim();if("#"===n.charAt(0)&&(n=n.slice(1)),!n||!e||"function"!=typeof e.getElementById)return null;const i=e.getElementById(n);return gh(i)?i:null}(e,t&&t.ownerDocument?t.ownerDocument:null);if(i)return i;if("string"==typeof e){const t=e.trim(),n="#"===t.charAt(0)?t.slice(1):t;if(!n)throw new Error("Debug overlay containerElement id cannot be empty.");throw new Error(`Debug overlay containerElement id "${n}" was not found.`)}throw new Error("Debug overlay containerElement must be an element id string or DOM element.")}({canvasElement:i,containerElement:n.containerElement});if(!r)throw new Error("Debug overlay requires an initialized player canvas and mount element.");Object.prototype.hasOwnProperty.call(n,"containerElement")&&delete n.containerElement;const o=await import("./debug-overlay-B4njlEwZ.esm.js"),s=(null==o?void 0:o.createDebugOverlay)||(null==o?void 0:o.default);if("function"!=typeof s)throw new Error("Debug overlay bundle does not export createDebugOverlay().");return n.publicOptions=z(_R,this),n.playerVersion=rR,j(PR,this,s({mountElement:r,canvasElement:i,timeline:z(wR,this),assetsDeliveryServiceUrl:null===(e=z(CR,this))||void 0===e||null===(e=e.assetsDeliveryService)||void 0===e||null===(e=e.settings)||void 0===e?void 0:e.assetsDeliveryServiceUrl,getNode:t=>z(xR,this)&&"function"==typeof z(xR,this).get?z(xR,this).get(t):void 0,listNodes:()=>z(xR,this)&&"function"==typeof z(xR,this).list?z(xR,this).list():[],downloadSpeed:z(CR,this)?z(CR,this).downloadSpeed:void 0,downloadEvents:Fb,qoe:z(FR,this)?z(FR,this).publicAPI:void 0,qoeEvents:this,options:n,playbackStartedAtMs:z(BR,this)})),z(PR,this)}function nD(){const t=this;return{createTimeline:()=>B(GR,t,YR).call(t),switchTimeline:e=>B(GR,t,QR).call(t,e),play:z(wR,this).play,pause:z(wR,this).pause,reset:z(wR,this).reset,placeOnTimeline:z(wR,this).placeOnTimeline,placeRenderNodeOnTimeline:z(wR,this).placeRenderNodeOnTimeline,addNode:z(xR,this).add,getNode:z(xR,this).get,listNodes:z(xR,this).list,getNodesAtTime:e=>z(wR,t).getNodesAtTime(e),dispose:this.dispose,on:t.on,off:t.off,once:t.once,trigger:t.trigger,transitionTo:(e,n)=>z(SR,t).transitionTo(e,n),track:(e,...n)=>{if(z(AR,t)&&"function"==typeof z(AR,t).track)return z(AR,t).track(e,...n)},seekToPlacement:e=>z(wR,t).seekToPlacement(e),get currentTime(){return z(wR,t).currentTime},set currentTime(e){z(wR,t).currentTime=e},get buffered(){return z(wR,t).buffered},get options(){return z(_R,t)},get containerWidth(){return z(OR,t)?z(OR,t).containerWidth:0},get containerHeight(){return z(OR,t)?z(OR,t).containerHeight:0},get playbackRate(){return z(wR,t).playbackRate},set playbackRate(e){z(wR,t).playbackRate=e},get paused(){return!!z(wR,t)&&!0===z(wR,t).paused},get muted(){return!!z(MR,t)&&z(MR,t).muted},set muted(e){z(MR,t)&&(z(MR,t).muted=e)},get volume(){return z(MR,t)?z(MR,t).volume:1},set volume(e){z(MR,t)&&(z(MR,t).volume=e)},get qoe(){return z(FR,t)?z(FR,t).publicAPI:void 0},get utils(){return oR},get version(){return rR},loadDebugOverlay:(...e)=>B(GR,t,eD).call(t,...e)}}function iD(t){t&&(j(TR,this,t.canvas),j(xR,this,t.nodeRepository),j(wR,this,t.timeline),j(MR,this,t.audioAdapter||t.audioPlaybackManager),j(AR,this,t.tracker),j(NR,this,t.parsingManager),j(FR,this,t.qoe),j(ER,this,t.renderAdapter||t.renderer),j(SR,this,t.transitionManager),j(OR,this,t.containerSize))}class rD{constructor({target:t,props:e}){if(!t)throw new Error("`options.target` is required");So(this.#_t,e,!0),this.#_t.v.EkoPlayer=HR;const n=t.hasChildNodes()?ba:ya;this.#It=n($d,{target:t,props:this.#_t.v})}#It;#_t=Bi(To(Oo({})),"EkoGallery.#props");destroy(t){if(this.#It)return _a(this.#It,t)}get props(){return Gs(this.#_t)}}const oD=b("gallery-react");const sD=a(((t,i)=>{const{config:r,variantId:a,debug:c,ssrHtml:u,activeItem:d={index:0,step:0},forceMobile:h,videoAspectRatio:f,theme:p,loadAnalytics:m=!0,onEvent:v=()=>{}}=t,g=n(null),y=n({}),b=function(t){return void 0!==t}(r),k=n(d),x=n(u);y.current.initEventSent||(v("galleryinit"),y.current.initEventSent=!0);const w=o((t=>{y.current.state=t,t.activeItemIndex===k.current.index&&t.activeModuleIndex===k.current.step||v("activeitemchanged",{index:t.activeItemIndex,step:t.activeModuleIndex})}),[]),_=o((t=>{y.current.API=t,0===k.current.index&&0===k.current.step||t.selectItemAndStep(k.current.index,k.current.step),y.current.unsubscribe&&y.current.unsubscribe(),y.current.unsubscribe=t.subscribe(w)}),[]),I=o(((t,e)=>{v(t,e)}),[v]);return s((()=>(oD.setDataStorage("gallery-react",{config:r}),window.eko=window.eko||{},window.eko.config=r,window.eko.gallery={version:"devops/4.0.17"},()=>{window.eko.config=void 0})),[r]),l(i,(()=>({prev:()=>{var t;null===(t=y.current.API)||void 0===t||t.prev()},next:()=>{var t;null===(t=y.current.API)||void 0===t||t.next()}}))),s((()=>{if(null==g||!g.current)return;const t=g.current;return y.current.app=new rD({target:t,props:{config:r,forceMobile:h,videoAspectRatio:f,theme:p,loadAnalytics:m,variant:a,onGalleryReady:_,onEvent:I}}),()=>{var t;null===(t=y.current.app)||void 0===t||t.destroy()}}),[]),s((()=>{y.current.app&&(y.current.app.props.config=r,k.current={index:0,step:0})}),[r]),s((()=>{y.current.app&&(y.current.app.props.variant=a)}),[a]),s((()=>{y.current.app&&(y.current.app.props.debug=c,y.current.app.props.forceMobile=h,y.current.app.props.videoAspectRatio=f,y.current.app.props.theme=p,y.current.app.props.loadAnalytics=m,y.current.app.props.onEvent=I)}),[c,h,f,p,m,I]),s((()=>{k.current=d,y.current.state&&(y.current.state.activeItemIndex===d.index&&y.current.state.activeModuleIndex===d.step||y.current.API.selectItemAndStep(d.index,d.step))}),[d]),b?e.createElement("div",q({style:{position:"relative",width:"100%",height:"100%"},ref:g},x.current?{dangerouslySetInnerHTML:{__html:x.current}}:{})):t.children}));sD.propTypes={className:Ot.string,config:Ot.object,variantId:Ot.string,onEvent:Ot.func,ssrHtml:Ot.string,videoAspectRatio:Ot.string,theme:Ot.string,debug:Ot.bool,activeItem:Ot.shape({index:Ot.number,step:Ot.number}),forceMobile:Ot.bool,loadAnalytics:Ot.bool,children:Ot.node},sD.displayName="EkoGallerySvelte";const aD=d("v2"),lD=d("v1");export{dn as E,$ as _,W as a,j as b,z as c,B as d,u as e,lD as f,aD as g,sD as h,D as w};
|
|
14
|
+
*/var bt=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;var i=Object.getOwnPropertyNames(e).map((function(t){return e[t]}));if("0123456789"!==i.join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(t){r[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,i,r=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),o=1;o<arguments.length;o++){for(var s in n=Object(arguments[o]))gt.call(n,s)&&(r[s]=n[s]);if(vt){i=vt(n);for(var a=0;a<i.length;a++)yt.call(n,i[a])&&(r[i[a]]=n[i[a]])}}return r},kt="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",xt=Function.call.bind(Object.prototype.hasOwnProperty),wt=function(){};if("production"!==process.env.NODE_ENV){var _t=kt,It={},Tt=xt;wt=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(t){}}}function Et(t,e,n,i,r){if("production"!==process.env.NODE_ENV)for(var o in t)if(Tt(t,o)){var s;try{if("function"!=typeof t[o]){var a=Error((i||"React class")+": "+n+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof t[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw a.name="Invariant Violation",a}s=t[o](e,o,i,n,null,_t)}catch(t){s=t}if(!s||s instanceof Error||wt((i||"React class")+": type specification of "+n+" `"+o+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof s+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),s instanceof Error&&!(s.message in It)){It[s.message]=!0;var l=r?r():"";wt("Failed "+n+" type: "+s.message+(null!=l?l:""))}}}Et.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(It={})};var St=Et,Mt=function(){};function At(){return null}"production"!==process.env.NODE_ENV&&(Mt=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(t){}});var Nt=function(t,e){var n="function"==typeof Symbol&&Symbol.iterator,i="@@iterator";var r="<<anonymous>>",o={array:c("array"),bigint:c("bigint"),bool:c("boolean"),func:c("function"),number:c("number"),object:c("object"),string:c("string"),symbol:c("symbol"),any:l(At),arrayOf:function(t){return l((function(e,n,i,r,o){if("function"!=typeof t)return new a("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside arrayOf.");var s=e[n];if(!Array.isArray(s))return new a("Invalid "+r+" `"+o+"` of type `"+h(s)+"` supplied to `"+i+"`, expected an array.");for(var l=0;l<s.length;l++){var c=t(s,l,i,r,o+"["+l+"]",kt);if(c instanceof Error)return c}return null}))},element:l((function(e,n,i,r,o){var s=e[n];return t(s)?null:new a("Invalid "+r+" `"+o+"` of type `"+h(s)+"` supplied to `"+i+"`, expected a single ReactElement.")})),elementType:l((function(t,e,n,i,r){var o=t[e];return mt.isValidElementType(o)?null:new a("Invalid "+i+" `"+r+"` of type `"+h(o)+"` supplied to `"+n+"`, expected a single ReactElement type.")})),instanceOf:function(t){return l((function(e,n,i,o,s){if(!(e[n]instanceof t)){var l=t.name||r;return new a("Invalid "+o+" `"+s+"` of type `"+(((c=e[n]).constructor&&c.constructor.name?c.constructor.name:r)+"` supplied to `")+i+"`, expected instance of `"+l+"`.")}var c;return null}))},node:l((function(t,e,n,i,r){return d(t[e])?null:new a("Invalid "+i+" `"+r+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(t){return l((function(e,n,i,r,o){if("function"!=typeof t)return new a("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var s=e[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected an object.");for(var c in s)if(xt(s,c)){var u=t(s,c,i,r,o+"."+c,kt);if(u instanceof Error)return u}return null}))},oneOf:function(t){if(!Array.isArray(t))return"production"!==process.env.NODE_ENV&&Mt(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),At;return l((function(e,n,i,r,o){for(var l=e[n],c=0;c<t.length;c++)if(s(l,t[c]))return null;var u=JSON.stringify(t,(function(t,e){return"symbol"===f(e)?String(e):e}));return new a("Invalid "+r+" `"+o+"` of value `"+String(l)+"` supplied to `"+i+"`, expected one of "+u+".")}))},oneOfType:function(t){if(!Array.isArray(t))return"production"!==process.env.NODE_ENV&&Mt("Invalid argument supplied to oneOfType, expected an instance of array."),At;for(var e=0;e<t.length;e++){var n=t[e];if("function"!=typeof n)return Mt("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+p(n)+" at index "+e+"."),At}return l((function(e,n,i,r,o){for(var s=[],l=0;l<t.length;l++){var c=(0,t[l])(e,n,i,r,o,kt);if(null==c)return null;c.data&&xt(c.data,"expectedType")&&s.push(c.data.expectedType)}return new a("Invalid "+r+" `"+o+"` supplied to `"+i+"`"+(s.length>0?", expected one of type ["+s.join(", ")+"]":"")+".")}))},shape:function(t){return l((function(e,n,i,r,o){var s=e[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected `object`.");for(var c in t){var d=t[c];if("function"!=typeof d)return u(i,r,o,c,f(d));var p=d(s,c,i,r,o+"."+c,kt);if(p)return p}return null}))},exact:function(t){return l((function(e,n,i,r,o){var s=e[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected `object`.");var c=bt({},e[n],t);for(var d in c){var p=t[d];if(xt(t,d)&&"function"!=typeof p)return u(i,r,o,d,f(p));if(!p)return new a("Invalid "+r+" `"+o+"` key `"+d+"` supplied to `"+i+"`.\nBad object: "+JSON.stringify(e[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(t),null," "));var m=p(s,d,i,r,o+"."+d,kt);if(m)return m}return null}))}};function s(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}function a(t,e){this.message=t,this.data=e&&"object"==typeof e?e:{},this.stack=""}function l(t){if("production"!==process.env.NODE_ENV)var n={},i=0;function o(o,s,l,c,u,d,h){if(c=c||r,d=d||l,h!==kt){if(e){var f=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 f.name="Invariant Violation",f}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var p=c+":"+l;!n[p]&&i<3&&(Mt("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+c+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),n[p]=!0,i++)}}return null==s[l]?o?null===s[l]?new a("The "+u+" `"+d+"` is marked as required in `"+c+"`, but its value is `null`."):new a("The "+u+" `"+d+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:t(s,l,c,u,d)}var s=o.bind(null,!1);return s.isRequired=o.bind(null,!0),s}function c(t){return l((function(e,n,i,r,o,s){var l=e[n];return h(l)!==t?new a("Invalid "+r+" `"+o+"` of type `"+f(l)+"` supplied to `"+i+"`, expected `"+t+"`.",{expectedType:t}):null}))}function u(t,e,n,i,r){return new a((t||"React class")+": "+e+" type `"+n+"."+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+r+"`.")}function d(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(d);if(null===e||t(e))return!0;var r=function(t){var e=t&&(n&&t[n]||t[i]);if("function"==typeof e)return e}(e);if(!r)return!1;var o,s=r.call(e);if(r!==e.entries){for(;!(o=s.next()).done;)if(!d(o.value))return!1}else for(;!(o=s.next()).done;){var a=o.value;if(a&&!d(a[1]))return!1}return!0;default:return!1}}function h(t){var e=typeof t;return Array.isArray(t)?"array":t instanceof RegExp?"object":function(t,e){return"symbol"===t||!!e&&("Symbol"===e["@@toStringTag"]||"function"==typeof Symbol&&e instanceof Symbol)}(e,t)?"symbol":e}function f(t){if(null==t)return""+t;var e=h(t);if("object"===e){if(t instanceof Date)return"date";if(t instanceof RegExp)return"regexp"}return e}function p(t){var e=f(t);switch(e){case"array":case"object":return"an "+e;case"boolean":case"date":case"regexp":return"a "+e;default:return e}}return a.prototype=Error.prototype,o.checkPropTypes=St,o.resetWarningCache=St.resetWarningCache,o.PropTypes=o,o};function Ft(){}function Ct(){}Ct.resetWarningCache=Ft;var Ot=V((function(t){if("production"!==process.env.NODE_ENV){var e=mt;t.exports=Nt(e.isElement,!0)}else t.exports=function(){function t(t,e,n,i,r,o){if(o!==kt){var s=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 s.name="Invariant Violation",s}}function e(){return t}t.isRequired=t;var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:Ct,resetWarningCache:Ft};return n.PropTypes=n,n}()}));const Pt=/https?:\/\/(.*?\.)?eko.com/,Rt={"eko.project.interaction":"interaction","eko.project.swipe":"swipe"};let Dt=null,Bt=null,Lt=[];function zt(t){return e=>{var n;if(!Pt.test(e.origin)||"eko.embedapi"!==(null===(n=e.data)||void 0===n?void 0:n.source))return;const i=e.data,r=Rt[i.type];r&&(t?t(r,i.data):Lt.push({type:r,data:i.data}))}}"undefined"!=typeof window&&(Bt=zt(null),window.addEventListener("message",Bt));var Wt={subscribe:function(t){"function"==typeof t?Dt?console.warn("[eko-gallery-react] Ignoring events subscribe since already subscribed"):(Dt=t,Bt=zt(t),window.addEventListener("message",Bt),function(t){Lt.forEach((e=>{t(e.type,e.data)})),Lt=[]}(t)):console.warn("[eko-gallery-react] Ignoring events subscribe since a callback function was not provided as argument")},unsubscribe:function(){Bt?(window.removeEventListener("message",Bt),Bt=null,Dt=null,Lt=[]):console.warn("[eko-gallery-react] Ignoring events unsubscribe since not subscribed")},send:function(t,e){Dt?Dt(t,e):Lt.push({type:t,data:e})}};const jt=({index:t,activeIndex:n,setActiveIndex:i,item:r,src:o,navItemRefs:s,itemIcon:a})=>{var l,c;const u=null==r||null===(l=r.media)||void 0===l?void 0:l.srcset,d=null==r||null===(c=r.media)||void 0===c?void 0:c.sizes,h=!o&&(null==r?void 0:r.label),f=u?o:function(t,e=200){if(!t)return null;try{let n=t;t.includes("assets.eko.com")&&t.includes("/raw/")&&(n=t.replace("/raw/","/image/"));const i=new URL(n);return i.searchParams.set("width",e),i.href}catch(e){return t}}(o,150);let p=["addons-container",h?"full-thumb-label":""].join(" ").trim();return e.createElement("li",{className:"eko-nav-item","aria-current":n===t,onClick:function(){i(t),function(t){D.track("gallery.interaction",{elementid:`thumbnail-${t}`,interactiontype:"click"}),Wt.send("interaction",{elementid:`thumbnail-${t}`,interactiontype:"click"})}(t)},ref:s.current[t]},e.createElement("button",{type:"button","aria-label":`Go to item ${t}`},!h&&e.createElement("img",{src:f,srcSet:u,sizes:d,alt:null==r?void 0:r.name,loading:"eager",fetchPriority:"high"}),e.createElement("div",{className:p},(null==r?void 0:r.stepsIndication)&&e.createElement("div",{className:"step-indicator"},e.createElement("span",null),e.createElement("span",null),e.createElement("span",null)),(null==r?void 0:r.label)&&e.createElement("div",{className:"thumb-label"},null==r?void 0:r.label)),a&&e.createElement("div",{className:"item-icon"},e.createElement("span",{style:{backgroundImage:`url(${a})`}}))))};jt.propTypes={index:Ot.number,activeIndex:Ot.number,setActiveIndex:Ot.func.isRequired,item:Ot.object.isRequired,src:Ot.string,navItemRefs:Ot.object.isRequired,itemIcon:Ot.string};const $t=({layout:t,nav:i,isVerticalNav:r,showPrevArrow:o,showNextArrow:s})=>{var a,l,c,u,d;const h=n(null),f=n(null),p="arrows"===(null==t||null===(a=t.mobile)||void 0===a||null===(a=a.config)||void 0===a||null===(a=a.navPagination)||void 0===a?void 0:a.type)?"eko-mobile-arrows":"",m="arrows"===(null!==(l=null==t||null===(c=t.desktop)||void 0===c||null===(c=c.config)||void 0===c||null===(c=c.navPagination)||void 0===c?void 0:c.type)&&void 0!==l?l:"arrows")?"eko-desktop-arrows":"",v=p||m,g=r?null==i||null===(u=i.current)||void 0===u?void 0:u.scrollHeight:null==i||null===(d=i.current)||void 0===d?void 0:d.scrollWidth;function y(t){const e=r?i.current.clientHeight:i.current.clientWidth,n=function(t,e){const n=r?e.scrollTop:e.scrollLeft;return Math.max(-n,Math.min(g-t-n,t))}("next"===t?e:-e,i.current);return{top:r?n:0,left:r?0:n,behavior:"smooth"}}function b(t){var e,n,r;const o=y(t),s="next"===t?null==f||null===(e=f.current)||void 0===e?void 0:e.id:null==h||null===(n=h.current)||void 0===n?void 0:n.id;var a,l;window.EkoAnalytics("track","gallery.interaction",{elementid:s,interactiontype:"click"}),null==i||null===(r=i.current)||void 0===r||r.scrollBy(o),a=s,l="click",D.track("gallery.interaction",{elementId:a,interactiontype:l}),Wt.send("interaction",{elementId:a,interactiontype:l})}return e.createElement(e.Fragment,null,v&&e.createElement(e.Fragment,null,e.createElement("button",q({type:"button","aria-label":"Go to previous item","aria-hidden":o?"false":"true",onClick:()=>b("prev"),ref:h,id:"eko-nav-prev-arrow",className:`eko-nav-arrow eko-prev-nav-button ${p} ${m} ${o?"":"eko-hidden-nav-button"}`},o?{}:{tabIndex:"-1"}),e.createElement("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M5.56127 9.52817C5.28966 9.22635 5.28966 8.77361 5.56127 8.502L10.39 3.67331C10.6918 3.37157 11.1445 3.37157 11.4161 3.67331C11.7179 3.94492 11.7179 4.39766 11.4161 4.66927L7.10044 8.98487L11.4161 13.3307C11.7179 13.6023 11.7179 14.055 11.4161 14.3266C11.1445 14.6285 10.6918 14.6285 10.4202 14.3266L5.56127 9.52817Z",fill:"black"}))),e.createElement("button",q({type:"button","aria-label":"Go to next item","aria-hidden":s?"false":"true",onClick:()=>b("next"),ref:f,className:`eko-nav-arrow eko-next-nav-button ${p} ${m} ${s?"":"eko-hidden-nav-button"}`,id:"eko-nav-next-arrow"},s?{}:{tabIndex:"-1"}),e.createElement("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M12.4387 8.47185C12.7103 8.77367 12.7103 9.22641 12.4387 9.49802L7.61003 14.3267C7.30821 14.6284 6.85547 14.6284 6.58386 14.3267C6.28212 14.0551 6.28212 13.6024 6.58386 13.3308L10.8996 9.01515L6.58386 4.66933C6.28212 4.39772 6.28212 3.94499 6.58386 3.67338C6.85547 3.37155 7.30821 3.37155 7.57982 3.67338L12.4387 8.47185Z",fill:"black"})))))};function Ut(t,e,n){let i;return function(){const n=this,r=arguments;clearTimeout(i),i=setTimeout((function(){i=null,t.apply(n,r)}),e)}}$t.propTypes={layout:Ot.object.isRequired,nav:Ot.object.isRequired,isVerticalNav:Ot.bool.isRequired,showPrevArrow:Ot.bool.isRequired,showNextArrow:Ot.bool.isRequired};const qt=({items:t,setActiveIndex:a,activeIndex:l,layout:c,carouselMounted:u,forceMobile:d})=>{const h=n(null),f=n(null),p=n([]),m=3,[g,y]=i(null),[b,k]=i(!1),[x,w]=i(0),[_,I]=i(!1),[T,E]=i(!1);function S(){var t;const e=d||window.innerWidth<768?"mobile":"desktop",n=(null==c||null===(t=c[e])||void 0===t||null===(t=t.config)||void 0===t?void 0:t.orientation)||("desktop"===e?"left":"bottom");k("left"===n||"right"===n);const i=f.current.parentNode,r=u?".eko-smart-gallery-container iframe":".eko-carousel",o=i.querySelector(r);setTimeout((()=>{w(o.clientHeight)}),0)}function M(){var t,e;const n=d||v()?"mobile":"desktop",i=null!==(t=null==c||null===(e=c[n])||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.navPagination)||void 0===e?void 0:e.scrollThreshold)&&void 0!==t?t:m;!function(t=m){var e,n;const i=h.current;if(!i)return;const r="none"!==(null==c||null===(e=c.desktop)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.navPagination)||void 0===e?void 0:e.type),o=(s=null==c||null===(n=c.mobile)||void 0===n||null===(n=n.config)||void 0===n||null===(n=n.navPagination)||void 0===n?void 0:n.type,"mask"===s||"arrows"===s);var s;if((d||v())&&!o)return void i.style.setProperty("-webkit-mask","none");if(!v()&&!r)return void i.style.setProperty("-webkit-mask","none");const a=i.scrollHeight-i.clientHeight,l=i.scrollTop>t?"85%":"100%",u=i.scrollTop<=a-t?"15%":"0%",f=i.scrollWidth-i.clientWidth,p=i.scrollLeft>t?"15%":"0%",g=i.scrollLeft<=f-t?"85%":"100%";b?i.style.setProperty("-webkit-mask",`linear-gradient(0deg,#0000,#000 ${u} ${l},#0000)`):i.style.setProperty("-webkit-mask",`linear-gradient(90deg,#0000,#000 ${p} ${g},#0000)`)}(i),function(t=m){var e,n,i,r,o,s;const a=b?null==h||null===(e=h.current)||void 0===e?void 0:e.scrollTop:null==h||null===(n=h.current)||void 0===n?void 0:n.scrollLeft,l=b?null==h||null===(i=h.current)||void 0===i?void 0:i.clientHeight:null==h||null===(r=h.current)||void 0===r?void 0:r.clientWidth,c=b?null==h||null===(o=h.current)||void 0===o?void 0:o.scrollHeight:null==h||null===(s=h.current)||void 0===s?void 0:s.scrollWidth;c-t<l?(I(!1),E(!1)):a<=t?(I(!1),E(!0)):a+l>c-t?(I(!0),E(!1)):a+t>0&&a<c-t&&(I(!0),E(!0))}(i)}p.current=null==t?void 0:t.map(((t,e)=>{var n,i;return null!==(n=null==p||null===(i=p.current)||void 0===i?void 0:i[e])&&void 0!==n?n:r()}));const A=Ut((t=>{var e;e=t,D.track("gallery.interaction",{elementid:"nav",interactiontype:e}),Wt.send("interaction",{elementid:"nav",interactiontype:e})}),200);const N=o((t=>{a({index:t,step:0,source:"nav"})}),[]);return s((()=>{var t;y(null===(t=p.current)||void 0===t?void 0:t[l])}),[l]),s((()=>{if(null!=g&&g.current&&null!=h&&h.current){const t=g.current,e=h.current.clientWidth/2,n=t.clientWidth/2,i=h.current.clientHeight/2,r=t.clientHeight/2;h.current.scrollTo({left:t.offsetLeft-e+n,top:t.offsetTop-i+r,behavior:"smooth"})}}),[g]),s((()=>{S()}),[]),s((()=>(window.addEventListener("resize",S),()=>{window.removeEventListener("resize",S)})),[f,u,d]),s((()=>{w(0),S()}),[t,f,u,d]),s((()=>{M();const t=new ResizeObserver(M);return t.observe(h.current),()=>{t.disconnect()}}),[t,d,b]),e.createElement("div",{className:"eko-nav-container",ref:f,style:{opacity:x>0?1:0,height:""+(x&&b?x+"px":"auto")}},e.createElement($t,{layout:c,nav:h,isVerticalNav:b,showPrevArrow:_,showNextArrow:T}),e.createElement("ul",{className:`eko-nav eko-mobile-nav-selected-${null!==(F=null==c||null===(C=c.mobile)||void 0===C||null===(C=C.config)||void 0===C?void 0:C.navItemsSelectedType)&&void 0!==F?F:"underline"} eko-desktop-nav-selected-${null!==(O=null==c||null===(P=c.desktop)||void 0===P||null===(P=P.config)||void 0===P?void 0:P.navItemsSelectedType)&&void 0!==O?O:"underline"}`,ref:h,onScroll:function(){M()},onWheel:function(){A("wheel")},onTouchMove:function(){A("swipe")}},null==t?void 0:t.map(((t,n)=>{var i;const r=(null==t||null===(i=t.media)||void 0===i?void 0:i.url)||(null==t?void 0:t.media)||"";return e.createElement(jt,{key:r+n,index:n,activeIndex:l,setActiveIndex:N,item:t,src:r,navItemRefs:p,itemIcon:null==t?void 0:t.icon})}))));var F,C,O,P};qt.propTypes={items:Ot.array.isRequired,activeIndex:Ot.number,setActiveIndex:Ot.func.isRequired,layout:Ot.object,carouselMounted:Ot.bool,forceMobile:Ot.bool};function Vt(){D.track("gallery.cover.displayed"),Wt.send("gallerycoverdisplayed")}function Gt(t){if(!t)return t;try{const e=new URL(t);return e.host.includes("assets.eko.com")&&e.pathname.startsWith("/image")&&!e.searchParams.has("width")?(e.pathname.endsWith(".png")&&(e.pathname=e.pathname.replace(/\.png$/,".webp")),e.searchParams.set("width",1920),e.toString()):t}catch(e){return t}}const Ht=({item:t,src:i,srcset:r,sizes:o,isCoverElement:a})=>{const l=n(null);return s((()=>{var t;if(a){if(null===(t=l.current)||void 0===t||!t.complete)return l.current.addEventListener("load",Vt,{once:!0}),()=>{var t;null===(t=l.current)||void 0===t||t.removeEventListener("load",Vt,{once:!0})};Vt()}}),[]),e.createElement("img",{ref:l,src:Gt(i),srcSet:r,sizes:o,alt:t.name,fetchPriority:a?"high":"auto",loading:a?"eager":"lazy",style:{width:"100%",height:"100%"}})};Ht.propTypes={item:Ot.object.isRequired,src:Ot.string,srcset:Ot.string,sizes:Ot.string,isCoverElement:Ot.bool};const Kt=Ut((t=>{var e;e=t,D.track("gallery.interaction",{elementid:"carousel",interactiontype:e}),Wt.send("interaction",{elementid:"carousel",interactiontype:e})}),200);function Xt(){Kt("wheel")}const Yt=a((({items:t,setActiveIndex:o,activeIndex:a,showSmartLoaders:c},u)=>{const d=n(null),h=n([]);h.current=null==t?void 0:t.map(((t,e)=>{var n,i;return null!==(n=null==h||null===(i=h.current)||void 0===i?void 0:i[e])&&void 0!==n?n:r()}));const[f,p]=i(),[m,v]=i(),g=n(a),y=n(!1);function b(){const e=function(t){const e=t.scrollLeft,n=t.scrollWidth-t.clientWidth;return 0===e?0:e>n?100:e/n*100}(d.current)*(null==t?void 0:t.length)/100,n=Math.min(Math.trunc(e),(null==t?void 0:t.length)-1),i=g.current;"nav"!==i.source&&"external-nav"!==i.source?(y.current&&n!==i.index&&(y.current=!1),y.current||(n>(null==t?void 0:t.length)-1?o({index:(null==t?void 0:t.length)-1,source:"carousel"}):o({index:n,source:"carousel"}))):n===i.index?y.current=!0:y.current&&n!==i.index&&(y.current=!1,o({index:n,source:"carousel"}))}return l(u,(()=>({prev:()=>{o({index:Math.max(0,g.current.index-1),source:"carousel"})},next:()=>{o({index:Math.min((null==t?void 0:t.length)-1,g.current.index+1),source:"carousel"})}}))),s((()=>{const t=d.current;if(t)return t.addEventListener("scroll",b),()=>{t.removeEventListener("scroll",b)}}),[t]),s((()=>{var t;let e=null===(t=h.current)||void 0===t?void 0:t[a.index];if(e&&("nav"===a.source||"external-nav"===a.source)){const t=e.current,n=d.current.clientWidth/2,i=(null==t?void 0:t.clientWidth)/2,r=(null==t?void 0:t.offsetLeft)-n+i;d.current.scrollTo({left:r,behavior:"smooth"})}}),[a]),s((()=>{g.current=a,"nav"!==a.source&&"external-nav"!==a.source||(y.current=!1)}),[a]),e.createElement("ul",{className:"eko-carousel",ref:d,onScroll:b,onWheel:Xt,onTouchMove:function(t){v(t.targetTouches[0].clientX)},onTouchStart:function(t){p(t.targetTouches[0].clientX),v(null)},onTouchEnd:function(){m&&f&&(f-m>75||f-m<-75)&&Kt("swipe")}},null==t?void 0:t.map(((t,n)=>{const i=(null==t?void 0:t.cover)||(null==t?void 0:t.media),r=(null==i?void 0:i.url)||i;return e.createElement("li",{className:"eko-carousel-item",key:r+n,ref:h.current[n]},e.createElement(Ht,{item:t,src:r,srcset:null==i?void 0:i.srcset,sizes:null==i?void 0:i.sizes,isCoverElement:0===n}),c&&"image"!==t.type&&e.createElement("div",{className:"eko-smart-loading"},e.createElement("div",null),e.createElement("p",null,"Loading video experience")))})))}));function Qt(t){var e;return function(t){var e;return"eko.block.event"===(null==t||null===(e=t.data)||void 0===e?void 0:e.type)}(t)&&"GalleryBlock"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.blockType)}Yt.propTypes={items:Ot.array.isRequired,setActiveIndex:Ot.func.isRequired,activeIndex:Ot.object,showSmartLoaders:Ot.bool},Yt.displayName="CarouselLoop";const Jt="eko.project.invoke",Zt="eko.block.invoke";function te(t,e,n){var i;null!=t&&t.contentWindow&&(null==t||null===(i=t.contentWindow)||void 0===i||i.postMessage({target:"eko.embedapi",type:e,data:n},"*"))}function ee(t){return`#variantId=${encodeURIComponent(t)}`}const ne=a((({config:t,instanceId:r,setActiveItem:o,activeItem:a,variantId:c,smartGalleryLoaded:u,onLoad:d,forceMobile:h},f)=>{var p,m,g;const y=null!==(p=null===(m=t.options)||void 0===m?void 0:m.galleryEnv)&&void 0!==p?p:"",b=null===(g=t.__autoGenerated)||void 0===g||null===(g=g.publishItem)||void 0===g?void 0:g.id,k=function(t={}){let e="";return Object.entries(t).forEach((([t,n])=>{e+=`&${t}=${n}`})),e}(null==t?void 0:t.qp),x=function(t,e,n){return`https://${t}play.eko.com/embed?${n?`id=${n}`:`piid=${e}`}&nocover=true&galleryBlockMode=gallery&eko_pixel=true`}(y,b,r),w=n(null),_=n(null),I=n(!1),[T,E]=i(ee(c||"ekonovar")),[S,M]=i(x+k+T);let A;function N(){D.track("gallery.project.display"),d(),Wt.send("galleryloaded")}return l(f,(()=>({prev:()=>{te(null==_?void 0:_.current,Zt,{action:"onPrevModule"})},next:()=>{te(null==_?void 0:_.current,Zt,{action:"onNextModule"})}}))),s((()=>{I.current?te(null==_?void 0:_.current,Jt,{action:"updateVariant",args:{id:c}}):E(ee(c))}),[c]),s((()=>{te(null==_?void 0:_.current,Zt,{action:"updateActiveModule",args:{activeItemIndex:null==a?void 0:a.index,activeModuleIndex:null==a?void 0:a.step}})}),[a]),s((()=>{function t(t){if((function(t){var e;return"eko.project.blockstart"===(null==t||null===(e=t.data)||void 0===e?void 0:e.type)}(t)||function(t){var e,n;return"eko.project.started"===(null==t||null===(e=t.data)||void 0===e?void 0:e.type)&&(null==t||null===(n=t.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.started)}(t))&&!I.current)return e=t.data.data.blockType,I.current=!0,void("GalleryBlock"===e?te(null==_?void 0:_.current,Zt,{action:"updateActiveModule",args:{activeItemIndex:null==a?void 0:a.index,activeModuleIndex:null==a?void 0:a.step}}):N());var e;if(I.current){if(function(t){var e;return Qt(t)&&"activeModuleChanged"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.name)}(t))return void function(t){const e=t.data.data.data.activeItemIndex,n=t.data.data.data.activeModuleIndex;e===(null==a?void 0:a.index)&&n===(null==a?void 0:a.step)||o({index:e,step:n,source:"carousel"})}(t);(function(t){var e;return Qt(t)&&"activeModuleChangeDone"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.name)})(t)&&!u&&N()}}return A=h||v()?"mobile":"desktop",function(t,e={}){window.addEventListener("message",t,e)}(t),()=>{!function(t,e={}){window.removeEventListener("message",t,e)}(t)}}),[a]),s((()=>{I.current||te(null==_?void 0:_.current,Jt,{action:"queryProjectStarted"})}),[a,u]),s((()=>{I.current=!1}),[t]),s((()=>{M(x+k+T)}),[T]),e.createElement("div",{className:"eko-smart-gallery-container "+(u?"":"eko-project-not-ready"),ref:w,"data-type":"smart-gallery","data-qp":k,"data-variant":c,"data-device":A},e.createElement("iframe",{allow:"autoplay; fullscreen",title:"eko gallery",src:S,style:{border:0},ref:_}))}));ne.propTypes={config:Ot.object.isRequired,instanceId:Ot.string,setActiveItem:Ot.func.isRequired,activeItem:Ot.object.isRequired,variantId:Ot.string,smartGalleryLoaded:Ot.bool,onLoad:Ot.func,forceMobile:Ot.bool},ne.displayName="SmartGallery";const ie=()=>e.createElement("style",{suppressHydrationWarning:!0},'.eko-gallery {\n --accentColorEko: #000;\n --primaryColorEko: #000;\n --backgroundColorEko: #25D7A2;\n --navItemsBackgroundColorEko: transparent;\n --navItemsBannerBackgroundColorEko: #EEEEEE;\n --carouselItemsBackgroundColorEko: transparent;\n --carouselInteractiveCoverBackgroundColorEko: transparent;\n --galleryGapEkoMobile: 12px;\n --galleryGapEkoDesktop: 12px;\n --galleryPaddingEkoMobile: 0;\n --galleryPaddingEkoDesktop: 0;\n --galleryMaxWidthEkoMobile: 100%;\n --galleryMaxWidthEkoDesktop: 900px;\n --galleryTransition: .8s cubic-bezier(.35, 0, 0, 1) 1.5s;\n --navBarPaddingEkoMobile: 0 0 0 20px;\n --navBarPaddingEkoDesktop: 0;\n --navItemsWidthEkoMobile: 80px;\n --navItemsWidthEkoDesktop: 80px;\n --navItemsHeightEkoMobile: 80px;\n --navItemsHeightEkoDesktop: 80px;\n --navItemsGapEkoMobile: 14px;\n --navItemsGapEkoDesktop: 14px;\n --navItemsRadiusEkoMobile: 8px;\n --navItemsRadiusEkoDesktop: 8px;\n --navItemsSelectedMarginEkoMobile: 3px;\n --navItemsSelectedMarginEkoDesktop: 3px;\n --navItemsSelectedThicknessEkoMobile: 3px;\n --navItemsSelectedThicknessEkoDesktop: 3px;\n --navItemsSelectedUnderlineRadiusEkoMobile: 100px;\n --navItemsSelectedUnderlineRadiusEkoDesktop: 100px;\n --navItemsObjectFitEkoMobile: cover;\n --navItemsObjectFitEkoDesktop: cover;\n --navMediaBadgeSizeEkoMobile: 22px;\n --navMediaBadgeSizeEkoDesktop: 22px;\n --navMediaBadgeMarginTopEkoMobile: 4px;\n --navMediaBadgeMarginTopEkoDesktop: 4px;\n --navMediaBadgeMarginRightEkoMobile: 4px;\n --navMediaBadgeMarginRightEkoDesktop: 4px;\n --carouselItemsAspectRatioEkoMobile: 1 / 1;\n --carouselItemsAspectRatioEkoDesktop: 1 / 1;\n --carouselItemsRadiusEkoMobile: 0px;\n --carouselItemsRadiusEkoDesktop: 12px;\n --carouselItemsObjectFitEkoMobile: cover;\n --carouselItemsObjectFitEkoDesktop: cover;\n --navBannerFontSizeEkoMobile: 12px;\n --navBannerFontSizeEkoDesktop: 12px;\n --navBannerFontLineHeightEkoMobile: 120%;\n --navBannerFontLineHeightEkoDesktop: 120%;\n --navBannerFontFamilyEkoMobile: inherit;\n --navBannerFontFamilyEkoDesktop: inherit;\n --navBannerFontWeightEkoMobile: 400;\n --navBannerFontWeightEkoDesktop: 400;\n --outerWidth: 0\n}\n\n.eko-gallery * {\n box-sizing: border-box\n}\n\n.eko-gallery ul,\n.eko-gallery li {\n padding: 0;\n text-indent: 0;\n list-style-type: none;\n font-size: 0;\n margin: 0\n}\n\n.eko-gallery button {\n border: none;\n padding: 0\n}\n\n.eko-gallery .eko-hidden {\n display: none !important\n}\n\n.eko-gallery .eko-not-visible {\n visibility: hidden !important\n}\n\n.eko-hidden-variant {\n display: none !important\n}\n\n.eko-sr-only {\n width: 1px;\n height: 1px;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n margin: -1px;\n padding: 0;\n position: absolute;\n overflow: hidden\n}\n\n.eko-sticky-top {\n position: sticky;\n top: 0\n}\n\n.eko-gallery .eko-nav {\n height: 100%;\n display: flex;\n align-items: start;\n align-self: start;\n flex-shrink: 0;\n scrollbar-width: none;\n -ms-overflow-style: none\n}\n\n.eko-gallery .eko-nav li {\n font-size: 0;\n position: relative;\n display: flex;\n flex-shrink: 0;\n justify-content: center;\n -webkit-box-pack: center;\n cursor: pointer\n}\n\n.eko-gallery .eko-nav li button {\n position: relative;\n background-color: transparent;\n border-radius: 0;\n line-height: 0;\n overflow: hidden;\n cursor: pointer\n}\n\n.eko-gallery .eko-nav li button img {\n background-color: var(--navItemsBackgroundColorEko);\n pointer-events: none\n}\n\n.eko-gallery .eko-nav li button .item-icon {\n position: absolute;\n top: 0;\n right: 0;\n width: 32px;\n height: 32px;\n transform: scale(.25);\n transform-origin: top right\n}\n\n.eko-gallery .eko-nav li button .item-icon span {\n display: block;\n width: 400%;\n height: 400%;\n position: absolute;\n top: 0;\n right: 0;\n background-position: top right;\n background-repeat: no-repeat;\n background-size: contain\n}\n\n.eko-gallery .eko-nav li .addons-container {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n display: flex;\n flex-direction: column;\n font-size: 10px;\n line-height: 100%\n}\n\n.eko-gallery .eko-nav li .addons-container .thumb-label {\n width: 100%;\n background: var(--navItemsBannerBackgroundColorEko);\n padding: 4px;\n text-align: center;\n text-wrap: balance;\n color: var(--primaryColorEko)\n}\n\n.eko-gallery .eko-nav li .addons-container .step-indicator {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: center;\n gap: 5px;\n padding: 6px\n}\n\n.eko-gallery .eko-nav li .addons-container .step-indicator span {\n width: 5px;\n height: 5px;\n border-radius: 100px;\n background: #fff;\n box-shadow: 0 0 3px #00000094\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label {\n position: relative\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .step-indicator {\n position: absolute;\n bottom: 0\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n align-content: center\n}\n\n.eko-gallery .eko-nav::-webkit-scrollbar {\n display: none\n}\n\n.eko-nav-container {\n display: flex\n}\n\n.eko-nav-container:has(.eko-nav.eko-not-visible) .eko-nav-arrow {\n display: none\n}\n\n.eko-nav-container {\n position: relative;\n opacity: 0;\n transition: opacity .15s ease-in\n}\n\n.eko-nav-container .eko-nav-arrow {\n width: 28px;\n height: 28px;\n position: absolute;\n display: none;\n justify-content: center;\n align-items: center;\n border-radius: 28px;\n background-color: #fff;\n box-shadow: 0 0 6px #0000001f;\n z-index: 1;\n bottom: 50%;\n opacity: 1;\n transition: opacity .15s ease-in;\n transform: translateY(50%);\n cursor: pointer\n}\n\n.eko-nav-container .eko-nav-arrow.eko-prev-nav-button svg,\n.eko-nav-container .eko-nav-arrow.eko-next-nav-button svg {\n padding: 1px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-prev-nav-button {\n left: 8px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-next-nav-button {\n right: 8px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-hidden-nav-button {\n opacity: 0;\n pointer-events: none\n}\n\n.eko-gallery .eko-nav {\n gap: var(--navItemsGapEkoMobile);\n padding: var(--navBarPaddingEkoMobile)\n}\n\n.eko-gallery .eko-nav li button img {\n width: var(--navItemsWidthEkoMobile);\n height: var(--navItemsHeightEkoMobile);\n object-fit: var(--navItemsObjectFitEkoMobile)\n}\n\n.eko-gallery .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoMobile);\n font-size: var(--navBannerFontSizeEkoMobile);\n line-height: var(--navBannerFontLineHeightEkoMobile);\n font-weight: var(--navBannerFontWeightEkoMobile)\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoMobile);\n height: var(--navItemsHeightEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li {\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile))\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoMobile);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoMobile);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoMobile) + var(--navItemsSelectedMarginEkoMobile));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoMobile) var(--accentColorEko)\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-nav {\n gap: var(--navItemsGapEkoDesktop);\n padding: var(--navBarPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li button img {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop);\n object-fit: var(--navItemsObjectFitEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoDesktop);\n font-size: var(--navBannerFontSizeEkoDesktop);\n line-height: var(--navBannerFontLineHeightEkoDesktop);\n font-weight: var(--navBannerFontWeightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li {\n border-radius: 0;\n padding: 0;\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop))\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true] {\n box-shadow: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoDesktop);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoDesktop);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoDesktop) var(--accentColorEko)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true]:after {\n content: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container .eko-nav-arrow {\n width: 30px;\n height: 30px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container .eko-nav-arrow.eko-desktop-arrows {\n display: flex\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container:has(.eko-desktop-nav-selected-underline) .eko-nav-arrow.eko-desktop-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop)) / 2))\n }\n}\n\n@media screen and (max-width: 767px) {\n .eko-gallery.eko-liquid-gallery .eko-nav-arrow.eko-mobile-arrows {\n display: flex\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container:has(.eko-mobile-nav-selected-underline) .eko-nav-arrow.eko-mobile-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile)) / 2))\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav {\n gap: var(--navItemsGapEkoDesktop);\n padding: var(--navBarPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li button img {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop);\n object-fit: var(--navItemsObjectFitEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoDesktop);\n font-size: var(--navBannerFontSizeEkoDesktop);\n line-height: var(--navBannerFontLineHeightEkoDesktop);\n font-weight: var(--navBannerFontWeightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li {\n border-radius: 0;\n padding: 0;\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop))\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true] {\n box-shadow: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoDesktop);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoDesktop);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoDesktop) var(--accentColorEko)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true]:after {\n content: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container .eko-nav-arrow {\n width: 30px;\n height: 30px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container .eko-nav-arrow.eko-desktop-arrows {\n display: flex\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container:has(.eko-desktop-nav-selected-underline) .eko-nav-arrow.eko-desktop-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop)) / 2))\n }\n}\n\n@media screen and (max-width: 767px) {\n .eko-gallery.eko-react-gallery.eko-mobile .eko-nav-arrow.eko-mobile-arrows {\n display: flex\n }\n\n .eko-gallery.eko-react-gallery.eko-mobile .eko-nav-container:has(.eko-mobile-nav-selected-underline) .eko-nav-arrow.eko-mobile-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile)) / 2))\n }\n}\n\n.eko-media-badge {\n display: none;\n width: var(--navMediaBadgeSizeEkoMobile);\n height: var(--navMediaBadgeSizeEkoMobile);\n background: #fff;\n align-items: center;\n justify-content: center;\n border-radius: 100%;\n box-shadow: 0 0 4px #00000014;\n place-content: center;\n position: absolute;\n top: var(--navMediaBadgeMarginTopEkoMobile);\n right: var(--navMediaBadgeMarginRightEkoMobile)\n}\n\n.eko-media-badge svg {\n width: 100%;\n height: 100%\n}\n\n.eko-media-badge svg path {\n fill: #000\n}\n\n.eko-nav li .eko-media-badge-mobile {\n display: flex\n}\n\nsvg.interactiveThumb {\n position: absolute;\n top: 3px;\n right: -2.5px;\n width: 100%;\n height: 100%\n}\n\nsvg.interactiveThumb.hand {\n animation: handAnim 2.5s linear infinite\n}\n\nsvg.interactiveThumb.beam {\n animation: beamAnim 2.5s linear infinite;\n transform-origin: 26% 40%;\n top: 0\n}\n\n@keyframes handAnim {\n 0% {\n transform: translateY(0)\n }\n\n 3% {\n transform: translateY(-4px)\n }\n\n 15% {\n transform: translateY(0)\n }\n\n to {\n transform: translateY(0)\n }\n}\n\n@keyframes beamAnim {\n 0% {\n transform: scale(1);\n opacity: 0\n }\n\n 5% {\n transform: scale(1.1);\n opacity: 1\n }\n\n 30% {\n transform: scale(1.4);\n opacity: 0\n }\n\n to {\n transform: scale(1.4);\n opacity: 0\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-media-badge {\n width: var(--navMediaBadgeSizeEkoDesktop);\n height: var(--navMediaBadgeSizeEkoDesktop);\n top: var(--navMediaBadgeMarginTopEkoDesktop);\n right: var(--navMediaBadgeMarginRightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .eko-media-badge-mobile {\n display: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .eko-media-badge-desktop {\n display: flex\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-media-badge {\n width: var(--navMediaBadgeSizeEkoDesktop);\n height: var(--navMediaBadgeSizeEkoDesktop);\n top: var(--navMediaBadgeMarginTopEkoDesktop);\n right: var(--navMediaBadgeMarginRightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .eko-media-badge-mobile {\n display: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .eko-media-badge-desktop {\n display: flex\n }\n}\n\n.eko-loading-animation {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow: hidden;\n pointer-events: none\n}\n\n.eko-loading-animation.eko-show-loading-animation .eko-animated-bar {\n opacity: .6\n}\n\n.eko-loading-animation.eko-show-loading-animation .eko-animated-bar .eko-animated-bar-inner {\n animation: eko-loading-bar-inner-animation 2s infinite\n}\n\n.eko-loading-animation.eko-show-loading-text .eko-loading-text {\n opacity: 1\n}\n\n.eko-loading-animation .eko-animated-bar {\n width: 100%;\n height: 4px;\n background-color: #e8e8e8b2;\n opacity: 0;\n transition: opacity .5s;\n position: relative\n}\n\n.eko-loading-animation .eko-animated-bar .eko-animated-bar-inner {\n width: 150px;\n height: 100%;\n transform: translate(-150px);\n background-color: var(--accentColorEko, #4d484b);\n display: block;\n position: absolute\n}\n\n.eko-loading-animation .eko-loading-text {\n position: absolute;\n top: 10px;\n left: 50%;\n transform: translate(-50%);\n color: #656565;\n font-size: 12px;\n font-family: Bogle-Medium, sans-serif;\n font-weight: 500;\n opacity: 0;\n align-items: center;\n display: flex;\n gap: 2px;\n transition: opacity .5s\n}\n\n.eko-loading-animation .eko-loading-text-icon {\n opacity: 60%\n}\n\n.eko-loading-animation .eko-loading-text-icon svg {\n transform: translate(2px, 2px)\n}\n\n.eko-loading-animation .eko-loading-text-icon path {\n fill: var(--accentColorEko, #4d484b)\n}\n\n.eko-loading-animation.eko-hide-icon .eko-loading-text-icon {\n display: none\n}\n\n@keyframes eko-loading-bar-inner-animation {\n 0% {\n left: -350px\n }\n\n to {\n left: calc(100% + 350px)\n }\n}\n\n.eko-smart-loading {\n position: absolute;\n top: 8px;\n left: 50%;\n transform: translate(-50%);\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px\n}\n\n.eko-smart-loading div {\n position: relative;\n width: 158px;\n height: 3px;\n background-color: #dcdcdc;\n overflow: hidden;\n opacity: 0;\n animation: eko-smart-loading-show-animation .2s linear forwards 1s\n}\n\n.eko-smart-loading div:after {\n content: "";\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background-color: #878787;\n animation: eko-smart-loading-animation 2.5s ease-in-out infinite\n}\n\n.eko-smart-loading p {\n font-size: 11px;\n line-height: 120%;\n font-weight: 500;\n color: #6b6b6b;\n text-shadow: 0 0 2px white;\n opacity: 0;\n animation: eko-smart-loading-show-animation .2s linear forwards 3s\n}\n\n@keyframes eko-smart-loading-animation {\n 0% {\n transform: translate(-100%)\n }\n\n to {\n transform: translate(100%)\n }\n}\n\n@keyframes eko-smart-loading-show-animation {\n 0% {\n opacity: 0\n }\n\n to {\n opacity: 100%\n }\n}\n\n@media screen and (min-width: 450px) {\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-animated-bar {\n height: 6px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-loading-text {\n font-size: 16px;\n top: 12px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-loading-text-icon {\n transform: rotate(180deg)\n }\n}\n\n@media screen and (min-width: 450px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-animated-bar {\n height: 6px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-loading-text {\n font-size: 16px;\n top: 12px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-loading-text-icon {\n transform: rotate(180deg)\n }\n}\n\n.eko-carousel {\n width: 100%;\n white-space: nowrap;\n overflow-x: auto;\n overflow-y: hidden;\n scroll-snap-type: x mandatory;\n overscroll-behavior-x: contain;\n align-self: start;\n align-items: start;\n display: flex;\n gap: 10px;\n scrollbar-width: none;\n -ms-overflow-style: none\n}\n\n.eko-carousel li {\n width: 100%;\n display: inline-block;\n position: relative;\n align-items: start;\n overflow: hidden;\n scroll-snap-align: center;\n scroll-snap-stop: always;\n flex-shrink: 0\n}\n\n.eko-carousel li img.eko-cover-image {\n position: relative;\n pointer-events: none;\n transition: opacity .5s;\n z-index: 1;\n width: 100%;\n height: 100%;\n background-color: var(--carouselInteractiveCoverBackgroundColorEko)\n}\n\n.eko-carousel li iframe {\n position: absolute;\n border: none;\n top: 0;\n left: 0\n}\n\n.eko-carousel li img,\n.eko-carousel li video {\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n min-width: 0;\n background-color: var(--carouselItemsBackgroundColorEko)\n}\n\n.eko-carousel li[data-type=videoembed],\n.eko-carousel li[data-type=video] {\n cursor: pointer\n}\n\n.eko-carousel::-webkit-scrollbar {\n display: none\n}\n\n.eko-carousel:has(.zoomed) {\n overflow: hidden\n}\n\n.eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoMobile)\n}\n\n.eko-carousel li img.eko-desktop-cover-image {\n display: none\n}\n\n.eko-carousel li img.eko-mobile-cover-image {\n display: inline\n}\n\n.eko-carousel li img,\n.eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoMobile);\n object-fit: var(--carouselItemsObjectFitEkoMobile)\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-carousel li img,\n .eko-gallery.eko-liquid-gallery .eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop);\n object-fit: var(--carouselItemsObjectFitEkoDesktop)\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li img,\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop);\n object-fit: var(--carouselItemsObjectFitEkoDesktop)\n }\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-nav-container {\n display: none\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-carousel {\n overflow-x: hidden\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-mobile-carousel-scroll {\n overflow-x: auto\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-nav-container {\n display: none\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-carousel {\n overflow-x: hidden\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-carousel.eko-desktop-carousel-scroll {\n overflow-x: auto\n }\n\n .eko-gallery.eko-liquid-gallery.eko-mobile-embed-layout.eko-desktop-nav-layout .eko-nav-container {\n display: flex\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-nav-container {\n display: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-carousel {\n overflow-x: hidden\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-carousel.eko-desktop-carousel-scroll {\n overflow-x: auto\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-mobile-embed-layout.eko-desktop-nav-layout .eko-nav-container {\n display: flex\n }\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-bottom .eko-nav,\n.eko-gallery.eko-desktop-nav-layout.eko-desktop-nav-bottom .eko-nav,\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-top .eko-nav,\n.eko-gallery.eko-desktop-nav-layout.eko-desktop-nav-top .eko-nav {\n flex-direction: row;\n overflow-x: auto;\n overflow-y: hidden;\n max-width: 100%;\n margin: auto\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-bottom {\n flex-direction: column-reverse\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-top {\n flex-direction: column\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-bottom {\n flex-direction: column-reverse\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-top {\n flex-direction: column\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-bottom {\n flex-direction: column-reverse\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-top {\n flex-direction: column\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right {\n flex-direction: row-reverse\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left {\n flex-direction: row\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav {\n display: flex;\n flex-direction: column;\n justify-content: start;\n overflow-x: hidden;\n overflow-y: auto;\n gap: var(--navItemsGapEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container {\n display: flex;\n flex-shrink: 0\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button {\n top: 4px;\n left: auto\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n bottom: 4px\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n right: 50%;\n transform: translate(50%)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg {\n transform: rotate(90deg)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout .eko-carousel {\n align-self: start\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right {\n flex-direction: row-reverse\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left {\n flex-direction: row\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav {\n display: flex;\n flex-direction: column;\n justify-content: start;\n overflow-x: hidden;\n overflow-y: auto;\n gap: var(--navItemsGapEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container {\n display: flex;\n flex-shrink: 0\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button {\n top: 4px;\n left: auto\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n bottom: 4px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n right: 50%;\n transform: translate(50%)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg {\n transform: rotate(90deg)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout .eko-carousel {\n align-self: start\n }\n}\n\n.eko-gallery .eko-introButton {\n cursor: pointer;\n white-space: nowrap;\n pointer-events: auto;\n position: absolute;\n bottom: 100px;\n left: 50%;\n transform: translate(-50%);\n padding: 15px 20px\n}\n\n.eko-gallery .eko-introButton .eko-handContainer {\n display: none\n}\n\n.eko-gallery {\n position: relative;\n overflow: hidden;\n display: flex;\n flex-direction: row;\n justify-content: start;\n margin-inline-start: calc(-1 * var(--outerWidth));\n margin-inline-end: calc(-1 * var(--outerWidth));\n padding: var(--galleryPaddingEkoMobile);\n margin: auto;\n max-width: var(--galleryMaxWidthEkoMobile);\n transition: height var(--galleryTransition, .8s cubic-bezier(.35, 0, 0, 1) 1.5s), padding 0s;\n gap: var(--galleryGapEkoMobile)\n}\n\n.eko-gallery .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoMobile);\n overflow: hidden;\n flex: 1;\n display: flex;\n height: fit-content\n}\n\n.eko-gallery .eko-smart-gallery-container iframe {\n width: 100%;\n aspect-ratio: var(--carouselItemsAspectRatioEkoMobile)\n}\n\n.eko-gallery .eko-smart-gallery-container.eko-project-not-ready {\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n opacity: 0;\n pointer-events: none;\n touch-action: none\n}\n\n.eko-gallery .eko-smart-gallery-container.eko-project-not-ready iframe {\n pointer-events: none;\n touch-action: none\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery {\n max-width: var(--galleryMaxWidthEkoDesktop);\n gap: var(--galleryGapEkoDesktop);\n padding: var(--galleryPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-smart-gallery-container iframe {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop)\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop {\n max-width: var(--galleryMaxWidthEkoDesktop);\n gap: var(--galleryGapEkoDesktop);\n padding: var(--galleryPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-smart-gallery-container iframe {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop)\n }\n}'),re=({layout:t,style:n})=>{let i={};return function(t={}){Object.keys(t).forEach((e=>{i[`--${e}Eko`]=t[e]}))}(n),function(t){var e,n;const r=(null==t||null===(e=t.desktop)||void 0===e?void 0:e.config)||{},o=(null==t||null===(n=t.mobile)||void 0===n?void 0:n.config)||{};Object.keys(r).forEach((t=>{"string"==typeof r[t]&&(i[`--${t}EkoDesktop`]=r[t])})),Object.keys(o).forEach((t=>{"string"==typeof o[t]&&(i[`--${t}EkoMobile`]=o[t])}))}(t),e.createElement("style",{key:{layout:t,style:n}},`.eko-gallery {${Object.keys(i).map((t=>`${t}: ${i[t]};`)).join("\n")}}`)};re.propTypes={layout:Ot.object,style:Ot.object},b("experiment");const oe=({activeVariantId:t,activeElementId:e,hasInteractive:i,experiments:r,publishItem:o})=>{const a="gallery",l=n(t),c=n(e),u=n(i),d=n(r),h=n(o);s((()=>{l.current=t,c.current=e,u.current=i,d.current=r,h.current=o}),[t,e,i,r,o]);const f={publishItemPacker:{tag:a,schema:"iglu:com.helloeko/publishitem/jsonschema/1-0-0",match:/.*/,getData:function(){const t=h.current;if(t){const e={};return null!=t&&t.id&&(e.id=t.id),null!=t&&t.productId&&(e.productid=t.productId),t.salesChannelId&&(e.saleschannelid=t.salesChannelId),null!=t&&t.salesChannelName&&(e.saleschannelname=t.salesChannelName),t.salesChannelType&&(e.saleschanneltype=t.salesChannelType),e.id?e:void 0}}},galleryInteractionPacker:{tag:a,schema:"iglu:com.helloeko/gallery_interaction/jsonschema/1-0-0",match:"gallery.interaction",getData:function({elementid:t,interactiontype:e}){return{elementid:String(t),interactiontype:e}}},galleryPacker:{tag:a,schema:"iglu:com.helloeko/gallery/jsonschema/1-0-2",match:/^gallery.*/,getData:function(){var t;return{activeitemid:c.current.toString(),activevariantid:l.current,hasinteractive:u.current,version:(null===(t=window.eko)||void 0===t||null===(t=t.gallery)||void 0===t?void 0:t.version)||""}}},activeVariantIdPacker:{tag:a,schema:"iglu:com.helloeko/variant/jsonschema/1-0-1",match:/.*/,getData:function(){if(l.current)return{id:l.current}}},experimentPacker:{tag:a,schema:"iglu:com.helloeko/experiment/jsonschema/1-0-3",match:/.*/,getData:function(){var t;let e=function(t){let e=null;if(t){const n=Math.floor(Date.now()/1e3);for(const i of t){if("deliverable"!==i.type)return;const t=Math.floor(new Date(i.startDate).getTime()/1e3),r=Math.floor(new Date(i.endDate).getTime()/1e3);!0===i.active&&n>t&&n<r&&(e=i)}}return e}(d.current);if(!e)return;let n={experimentid:e.id||"",experimentvariant:e.chosen||"pending decision",experimenttype:e.type||""},i=null===(t=e.targetDevice)||void 0===t?void 0:t.toLowerCase();return"mobile"!==i&&"notmobile"!==i||(n.experimenttargeting={device:i}),n}}};return s((()=>(Object.values(f).forEach((t=>{window.EkoAnalytics("registerContextPacker",t)})),()=>{window.EkoAnalytics("reset",a)})),[]),null};oe.propTypes={activeVariantId:Ot.string,activeElementId:Ot.number,hasInteractive:Ot.bool,experiments:Ot.array,publishItem:Ot.object};const se=({variantId:t,activeItem:i,hasInteractive:r,activeIndex:o,experiments:a,publishItem:l})=>{const c=n(!0);return s((()=>{c.current||t&&D.track("gallery.variant.change")}),[t]),s((()=>{c.current||D.track("gallery.element.change",{activeIndex:o})}),[o]),s((()=>{c.current||i&&null!=l&&l.id&&D.track("gallery.asset.view",{publishitemid:l.id,type:i.type,name:i.name})}),[i]),s((()=>{c.current=!1}),[]),e.createElement(oe,{activeVariantId:t||"ekonovar",activeElementId:o,hasInteractive:r,experiments:a,publishItem:l})};se.propTypes={variantId:Ot.string,activeItem:Ot.object,hasInteractive:Ot.bool,activeIndex:Ot.number,experiments:Ot.array,publishItem:Ot.object};const ae="eko-gallery-react";function le(t,e){var n,i,r;const o=(null==t||null===(n=t.variantMap)||void 0===n?void 0:n[e])||"ekonovar";return(null==t||null===(i=t.items)||void 0===i?void 0:i.find((t=>(null==t?void 0:t.variantId)===o)))||(null==t||null===(r=t.items)||void 0===r?void 0:r[0])}"undefined"!=typeof window&&(window.EkoAnalytics||(console.log("EkoAnalytics is not defined, initializing a no-op function..."),window.EkoAnalytics=()=>{}));const ce=a((({className:t,config:r,instanceId:o,variantId:a,activeItem:l={index:0,step:0},onEvent:c,forceMobile:u},d)=>{var h,f,p,m,v,g;const y=null!==(h=null===(f=r.options)||void 0===f?void 0:f.loadingTimeout)&&void 0!==h?h:12,b=null===(p=null===(m=r.options)||void 0===m?void 0:m.showCoverLoadAnimation)||void 0===p||p,[k,x]=i(le(r,a)),[w,_]=i({index:l.index,step:l.step,source:"external-nav"}),[I,T]=i(!1),[E,S]=i(!1),[M,A]=i("eko-desktop"),N=n(!1),F=n(!1),C=n(l),O=n(null),P=n(a);function R(){const t=u||window.innerWidth<768?"eko-mobile":"eko-desktop";A(t)}return F.current||(Wt.send("galleryinit"),F.current=!0),s((()=>{const t=P.current!==a;P.current=a,x(le(r,a)),t&&!N.current&&_({index:0,step:0,source:"external-nav"})}),[r,a]),s((()=>{if(c)return Wt.subscribe(c),()=>{Wt.unsubscribe()}}),[c]),s((()=>{N.current=E}),[E]),s((()=>{T(!1),S(!1);const t=setTimeout((()=>{N.current||(T(!0),D.track("gallery.load.timeout"))}),1e3*y);return()=>{clearTimeout(t)}}),[r]),s((()=>{R()}),[u]),s((()=>(window.addEventListener("resize",R),R(),()=>{window.removeEventListener("resize",R)})),[u]),s((()=>(window.EkoAnalytics("trackElementVisibility",O.current,ae),()=>{window.EkoAnalytics("stopTrackingElementVisibility",ae)})),[]),s((()=>{!("carousel"===(null==w?void 0:w.source)||"nav"===(null==w?void 0:w.source))||(null==w?void 0:w.index)===l.index&&(null==w?void 0:w.step)===l.step||Wt.send("activeitemchanged",{index:null==w?void 0:w.index,step:null==w?void 0:w.step})}),[w,l]),s((()=>{C.current.index===l.index&&C.current.step===l.step||(C.current=l,_({index:l.index,step:l.step,source:"external-nav"}))}),[l]),e.createElement(e.Fragment,null,e.createElement(ie,null),e.createElement(re,{layout:r.layout,style:r.style,forceMobile:u}),e.createElement(se,{variantId:a,activeItem:null==k||null===(v=k.items)||void 0===v?void 0:v[w.index],activeIndex:w.index,hasInteractive:E,experiments:r.experiments,publishItem:null==r||null===(g=r.__autoGenerated)||void 0===g?void 0:g.publishItem}),e.createElement("section",{className:`${`eko-gallery eko-react-gallery ${function(t){let e="";return["mobile","desktop"].forEach((n=>{var i,r;const o=null!==(i=null==t||null===(r=t[n])||void 0===r?void 0:r.type)&&void 0!==i?i:"nav";if(e+=`eko-${n}-${o}-layout `,"nav"===o){var s;const i="desktop"===n,r=(null==t||null===(s=t[n])||void 0===s||null===(s=s.config)||void 0===s?void 0:s.orientation)||(i?"left":"bottom");e+=`eko-${n}-nav-${r} `}})),e}(r.layout)} ${null!=t?t:""}`.trim()} ${M}`,"aria-controls":"main-content",ref:O},e.createElement(qt,{items:(null==k?void 0:k.items)||[],setActiveIndex:_,activeIndex:w.index,layout:r.layout,carouselMounted:E,forceMobile:u}),!E&&e.createElement(Yt,{ref:d,items:(null==k?void 0:k.items)||[],setActiveIndex:_,activeIndex:{index:w.index,source:null==w?void 0:w.source},showSmartLoaders:!I&&b}),!I&&e.createElement(ne,{ref:d,config:r,instanceId:o,activeItem:w,setActiveItem:_,variantId:null==k?void 0:k.variantId,smartGalleryLoaded:E,forceMobile:u,onLoad:function(){S(!0)}})))}));ce.propTypes={className:Ot.string,config:Ot.object.isRequired,instanceId:Ot.string,variantId:Ot.string,activeItem:Ot.object,onEvent:Ot.func,forceMobile:Ot.bool,onPrev:Ot.func,onNext:Ot.func},ce.displayName="EkoGallery";var ue=c(ce);const de=b("gallery-react");const he=a(((t,n)=>{var i;s((()=>(de.setDataStorage("gallery-react",{config:t.config}),window.eko=window.eko||{},window.eko.config=t.config,window.eko.gallery={version:"devops/4.0.17"},()=>{window.eko.config=void 0})),[t.config]);const{children:r,...o}=t;return void 0!==t.config?e.createElement(ue,q({ref:n},o,{key:null===(i=t.config.__autoGenerated)||void 0===i||null===(i=i.publishItem)||void 0===i?void 0:i.id})):r}));he.propTypes={className:Ot.string,config:Ot.object,variantId:Ot.string,onEvent:Ot.func,instanceId:Ot.string,children:Ot.node},he.displayName="EkoGalleryWrapper";var fe,pe,me,ve,ge,ye,be,ke,xe,we,_e,Ie,Te,Ee,Se,Me,Ae,Ne,Fe,Ce,Oe,Pe,Re,De,Be,Le,ze,We,je,$e,Ue,qe,Ve,Ge,He,Ke,Xe,Ye,Qe,Je,Ze,tn,en,nn,rn,on,sn,an,ln,cn,un,dn=c(he);const hn=1,fn=2,pn=4,mn=8,vn=16,gn=1,yn=4,bn=8,kn=16,xn=4,wn="[",_n="[!",In="]",Tn={},En=Symbol(),Sn=Symbol("filename"),Mn="http://www.w3.org/1999/xhtml",An="@attach",Nn=!0;var Fn=Array.isArray,Cn=Array.prototype.indexOf,On=Array.from,Pn=Object.defineProperty,Rn=Object.getOwnPropertyDescriptor,Dn=Object.getOwnPropertyDescriptors,Bn=Object.prototype,Ln=Array.prototype,zn=Object.getPrototypeOf,Wn=Object.isExtensible;const jn=()=>{};function $n(){var t,e;return{promise:new Promise(((n,i)=>{t=n,e=i})),resolve:t,reject:e}}const Un=2,qn=4,Vn=8,Gn=1<<24,Hn=16,Kn=32,Xn=64,Yn=128,Qn=512,Jn=1024,Zn=2048,ti=4096,ei=8192,ni=16384,ii=32768,ri=65536,oi=1<<17,si=1<<18,ai=1<<19,li=1<<20,ci=1<<25,ui=32768,di=1<<21,hi=1<<22,fi=1<<23,pi=Symbol("$state"),mi=Symbol("legacy props"),vi=Symbol(""),gi=Symbol("proxy path"),yi=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},bi=3,ki=8;function xi(t){{const e=new Error(`lifecycle_outside_component\n\`${t}(...)\` can only be used during component initialisation\nhttps://svelte.dev/e/lifecycle_outside_component`);throw e.name="Svelte error",e}}var wi="font-weight: bold",_i="font-weight: normal";function Ii(t){console.warn("%c[svelte] hydration_mismatch\n%cHydration failed because the initial UI does not match what was rendered on the server\nhttps://svelte.dev/e/hydration_mismatch",wi,_i)}function Ti(t){console.warn(`%c[svelte] state_proxy_equality_mismatch\n%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${t}\` will produce unexpected results\nhttps://svelte.dev/e/state_proxy_equality_mismatch`,wi,_i)}let Ei,Si=!1;function Mi(t){Si=t}function Ai(t){if(null===t)throw Ii(),Tn;return Ei=t}function Ni(){return Ai(Vo(Ei))}function Fi(t){if(Si){if(null!==Vo(Ei))throw Ii(),Tn;Ei=t}}function Ci(t=!0){for(var e=0,n=Ei;;){if(n.nodeType===ki){var i=n.data;if(i===In){if(0===e)return n;e-=1}else i!==wn&&i!==_n||(e+=1)}var r=Vo(n);t&&n.remove(),n=r}}function Oi(t){if(!t||t.nodeType!==ki)throw Ii(),Tn;return t.data}function Pi(t){return t===this.v}function Ri(t){return e=t,n=this.v,!(e!=e?n==n:e!==n||null!==e&&"object"==typeof e||"function"==typeof e);var e,n}let Di=!1;function Bi(t,e){return t.label=e,Li(t.v,e),t}function Li(t,e){var n;return null==t||null===(n=t[gi])||void 0===n||n.call(t,e),t}function zi(t){const e=new Error,n=function(){const t=Error.stackTraceLimit;Error.stackTraceLimit=1/0;const e=(new Error).stack;if(Error.stackTraceLimit=t,!e)return[];const n=e.split("\n"),i=[];for(let t=0;t<n.length;t++){const e=n[t],r=e.replaceAll("\\","/");if("Error"!==e.trim()){if(e.includes("validate_each_keys"))return[];r.includes("svelte/src/internal")||r.includes("node_modules/.vite")||i.push(e)}}return i}();return 0===n.length?null:(n.unshift("\n"),Pn(e,"stack",{value:n.join("\n")}),Pn(e,"name",{value:t}),e)}let Wi=null;function ji(t){Wi=t}let $i=null;function Ui(t){$i=t}let qi=null;function Vi(t){qi=t}function Gi(t){return Xi("getContext").get(t)}function Hi(t,e=!1,n){Wi={p:Wi,i:!1,c:null,e:null,s:t,x:null,l:null},Wi.function=n,qi=n}function Ki(t){var e,n,i=Wi,r=i.e;if(null!==r)for(var o of(i.e=null,r))rs(o);return i.i=!0,Wi=i.p,qi=null!==(e=null===(n=Wi)||void 0===n?void 0:n.function)&&void 0!==e?e:null,{}}function Xi(t){var e,n;return null===Wi&&xi(t),null!==(n=(e=Wi).c)&&void 0!==n?n:e.c=new Map(function(t){let e=t.p;for(;null!==e;){const t=e.c;if(null!==t)return t;e=e.p}return null}(Wi)||void 0)}let Yi=[];function Qi(){var t=Yi;Yi=[],function(t){for(var e=0;e<t.length;e++)t[e]()}(t)}function Ji(t){if(0===Yi.length&&!mr){var e=Yi;queueMicrotask((()=>{e===Yi&&Qi()}))}Yi.push(t)}function Zi(){for(;Yi.length>0;)Qi()}const tr=new WeakMap;function er(t){var e=Ss;if(null===e)return Is.f|=fi,t;if(t instanceof Error&&!tr.has(t)&&tr.set(t,function(t,e){var n,i;const r=Rn(t,"message");if(r&&!r.configurable)return;var o=zo?" ":"\t",s=`\n${o}in ${(null===(n=e.fn)||void 0===n?void 0:n.name)||"<unknown>"}`,a=e.ctx;for(;null!==a;){var l;s+=`\n${o}in ${null===(l=a.function)||void 0===l?void 0:l[Sn].split("/").pop()}`,a=a.p}return{message:t.message+`\n${s}\n`,stack:null===(i=t.stack)||void 0===i?void 0:i.split("\n").filter((t=>!t.includes("svelte/src/internal"))).join("\n")}}(t,e)),e.f&ii)nr(t,e);else{if(!(e.f&Yn))throw!e.parent&&t instanceof Error&&ir(t),t;e.b.error(t)}}function nr(t,e){for(;null!==e;){if(e.f&Yn)try{return void e.b.error(t)}catch(e){t=e}e=e.parent}throw t instanceof Error&&ir(t),t}function ir(t){const e=tr.get(t);e&&(Pn(t,"message",{value:e.message}),Pn(t,"stack",{value:e.stack}))}const rr=-7169;function or(t,e){t.f=t.f&rr|e}function sr(t){t.f&Qn||null===t.deps?or(t,Jn):or(t,ti)}function ar(t){if(null!==t)for(const e of t)e.f&Un&&e.f&ui&&(e.f^=ui,ar(e.deps))}function lr(t,e,n){t.f&Zn?e.add(t):t.f&ti&&n.add(t),ar(t.deps),or(t,Jn)}const cr=new Set;let ur=null,dr=null,hr=[],fr=null,pr=!1,mr=!1;var vr=new WeakMap,gr=new WeakMap,yr=new WeakMap,br=new WeakMap,kr=new WeakMap,xr=new WeakMap,wr=new WeakMap,_r=new WeakSet;class Ir{constructor(){$(this,_r),U(this,"committed",!1),U(this,"current",new Map),U(this,"previous",new Map),W(this,vr,new Set),W(this,gr,new Set),W(this,yr,0),W(this,br,0),W(this,kr,null),W(this,xr,new Set),W(this,wr,new Set),U(this,"skipped_effects",new Set),U(this,"is_fork",!1)}is_deferred(){return this.is_fork||z(br,this)>0}process(t){hr=[],this.apply();var e,n=[],i=[];for(const e of t)B(_r,this,Tr).call(this,e,n,i);(this.is_fork||B(_r,this,Sr).call(this),this.is_deferred())?(B(_r,this,Er).call(this,i),B(_r,this,Er).call(this,n)):(ur=null,Cr(i),Cr(n),null===(e=z(kr,this))||void 0===e||e.resolve());dr=null}capture(t,e){var n;(e===En||this.previous.has(t)||this.previous.set(t,e),t.f&fi)||(this.current.set(t,t.v),null===(n=dr)||void 0===n||n.set(t,t.v))}activate(){ur=this,this.apply()}deactivate(){ur===this&&(ur=null,dr=null)}flush(){if(this.activate(),hr.length>0){if(Ar(),null!==ur&&ur!==this)return}else 0===z(yr,this)&&this.process([]);this.deactivate()}discard(){for(const t of z(gr,this))t(this);z(gr,this).clear()}increment(t){j(yr,this,z(yr,this)+1),t&&j(br,this,z(br,this)+1)}decrement(t){j(yr,this,z(yr,this)-1),t&&j(br,this,z(br,this)-1),this.revive()}revive(){for(const t of z(xr,this))z(wr,this).delete(t),or(t,Zn),Rr(t);for(const t of z(wr,this))or(t,ti),Rr(t);this.flush()}oncommit(t){z(vr,this).add(t)}ondiscard(t){z(gr,this).add(t)}settled(){var t;return(null!==(t=z(kr,this))&&void 0!==t?t:j(kr,this,$n())).promise}static ensure(){if(null===ur){const t=ur=new Ir;cr.add(ur),mr||Ir.enqueue((()=>{ur===t&&t.flush()}))}return ur}static enqueue(t){Ji(t)}apply(){}}function Tr(t,e,n){t.f^=Jn;for(var i=t.first,r=null;null!==i;){var o=i.f,s=!!(o&(Kn|Xn));if(!(s&&!!(o&Jn)||!!(o&ei)||this.skipped_effects.has(i))&&null!==i.fn){s?i.f^=Jn:null!==r&&o&(qn|Vn|Gn)?r.b.defer_effect(i):o&qn?e.push(i):zs(i)&&(o&Hn&&z(xr,this).add(i),qs(i));var a=i.first;if(null!==a){i=a;continue}}var l=i.parent;for(i=i.next;null===i&&null!==l;)l===r&&(r=null),i=l.next,l=l.parent}}function Er(t){for(var e=0;e<t.length;e+=1)lr(t[e],z(xr,this),z(wr,this))}function Sr(){if(0===z(br,this)){for(const t of z(vr,this))t();z(vr,this).clear()}0===z(yr,this)&&B(_r,this,Mr).call(this)}function Mr(){if(cr.size>1){this.previous.clear();var t=dr,e=!0;for(const t of cr){if(t===this){e=!1;continue}const i=[];for(const[n,r]of this.current){if(t.current.has(n)){if(!e||r===t.current.get(n))continue;t.current.set(n,r)}i.push(n)}if(0===i.length)continue;const r=[...t.current.keys()].filter((t=>!this.current.has(t)));if(r.length>0){var n=hr;hr=[];const e=new Set,o=new Map;for(const t of i)Or(t,r,e,o);if(hr.length>0){ur=t,t.apply();for(const e of hr)B(_r,t,Tr).call(t,e,[],[]);t.deactivate()}hr=n}}ur=null,dr=t}this.committed=!0,cr.delete(this)}function Ar(){var t=ks;pr=!0;var e=new Set;try{var n=0;for(xs(!0);hr.length>0;){var i=Ir.ensure();if(n++>1e3){if(Nn){var r=new Map;for(const t of i.current.keys())for(const[e,n]of null!==(o=t.updated)&&void 0!==o?o:[]){var o,s=r.get(e);s||(s={error:n.error,count:0},r.set(e,s)),s.count+=n.count}for(const t of r.values())t.error&&console.error(t.error)}Nr()}if(i.process(hr),xo.clear(),Nn)for(const t of i.current.keys())e.add(t)}}finally{pr=!1,xs(t),fr=null;for(const t of e)t.updated=null}}function Nr(){try{!function(){{const t=new Error("effect_update_depth_exceeded\nMaximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state\nhttps://svelte.dev/e/effect_update_depth_exceeded");throw t.name="Svelte error",t}}()}catch(t){Pn(t,"stack",{value:""}),nr(t,fr)}}let Fr=null;function Cr(t){var e=t.length;if(0!==e){for(var n=0;n<e;){var i,r=t[n++];if(!(r.f&(ni|ei))&&zs(r))if(Fr=new Set,qs(r),null===r.deps&&null===r.first&&null===r.nodes&&(null===r.teardown&&null===r.ac?ps(r):r.fn=null),(null===(i=Fr)||void 0===i?void 0:i.size)>0){xo.clear();for(const t of Fr){if(t.f&(ni|ei))continue;const e=[t];let n=t.parent;for(;null!==n;)Fr.has(n)&&(Fr.delete(n),e.push(n)),n=n.parent;for(let t=e.length-1;t>=0;t--){const n=e[t];n.f&(ni|ei)||qs(n)}}Fr.clear()}}Fr=null}}function Or(t,e,n,i){if(!n.has(t)&&(n.add(t),null!==t.reactions))for(const r of t.reactions){const t=r.f;t&Un?Or(r,e,n,i):t&(hi|Hn)&&!(t&Zn)&&Pr(r,e,i)&&(or(r,Zn),Rr(r))}}function Pr(t,e,n){const i=n.get(t);if(void 0!==i)return i;if(null!==t.deps)for(const i of t.deps){if(e.includes(i))return!0;if(i.f&Un&&Pr(i,e,n))return n.set(i,!0),!0}return n.set(t,!1),!1}function Rr(t){for(var e=fr=t;null!==e.parent;){var n=(e=e.parent).f;if(pr&&e===Ss&&n&Hn&&!(n&si))return;if(n&(Xn|Kn)){if(!(n&Jn))return;e.f^=Jn}}hr.push(e)}var Dr=ri|ai|Yn;var Br=new WeakMap,Lr=new WeakMap,zr=new WeakMap,Wr=new WeakMap,jr=new WeakMap,$r=new WeakMap,Ur=new WeakMap,qr=new WeakMap,Vr=new WeakMap,Gr=new WeakMap,Hr=new WeakMap,Kr=new WeakMap,Xr=new WeakMap,Yr=new WeakMap,Qr=new WeakMap,Jr=new WeakMap,Zr=new WeakMap,to=new WeakSet;class eo{constructor(t,e,n){$(this,to),U(this,"parent",void 0),U(this,"is_pending",!1),W(this,Br,void 0),W(this,Lr,Si?Ei:null),W(this,zr,void 0),W(this,Wr,void 0),W(this,jr,void 0),W(this,$r,null),W(this,Ur,null),W(this,qr,null),W(this,Vr,null),W(this,Gr,null),W(this,Hr,0),W(this,Kr,0),W(this,Xr,!1),W(this,Yr,new Set),W(this,Qr,new Set),W(this,Jr,null),W(this,Zr,function(t){let e,n=0,i=Io(0);return Bi(i,"createSubscriber version"),()=>{es()&&(Gs(i),ss((()=>(0===n&&(e=Xs((()=>t((()=>No(i)))))),n+=1,()=>{Ji((()=>{var t;n-=1,0===n&&(null===(t=e)||void 0===t||t(),e=void 0,No(i))}))}))))}}((()=>(j(Jr,this,Io(z(Hr,this))),Bi(z(Jr,this),"$effect.pending()"),()=>{j(Jr,this,null)})))),j(Br,this,t),j(zr,this,e),j(Wr,this,n),this.parent=Ss.b,this.is_pending=!!z(zr,this).pending,j(jr,this,ls((()=>{if(Ss.b=this,Si){const t=z(Lr,this);Ni();t.nodeType===ki&&t.data===_n?B(to,this,io).call(this):(B(to,this,no).call(this),0===z(Kr,this)&&(this.is_pending=!1))}else{var t=B(to,this,ro).call(this);try{j($r,this,us((()=>n(t))))}catch(t){this.error(t)}z(Kr,this)>0?B(to,this,so).call(this):this.is_pending=!1}return()=>{var t;null===(t=z(Gr,this))||void 0===t||t.remove()}}),Dr)),Si&&j(Br,this,Ei)}defer_effect(t){lr(t,z(Yr,this),z(Qr,this))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!z(zr,this).pending}update_pending_count(t){B(to,this,ao).call(this,t),j(Hr,this,z(Hr,this)+t),z(Jr,this)&&Mo(z(Jr,this),z(Hr,this))}get_effect_pending(){return z(Zr,this).call(this),Gs(z(Jr,this))}error(t){var e=z(zr,this).onerror;let n=z(zr,this).failed;if(z(Xr,this)||!e&&!n)throw t;z($r,this)&&(fs(z($r,this)),j($r,this,null)),z(Ur,this)&&(fs(z(Ur,this)),j(Ur,this,null)),z(qr,this)&&(fs(z(qr,this)),j(qr,this,null)),Si&&(Ai(z(Lr,this)),function(t=1){if(Si){for(var e=t,n=Ei;e--;)n=Vo(n);Ei=n}}(),Ai(Ci()));var i=!1,r=!1;const o=()=>{i?console.warn("%c[svelte] svelte_boundary_reset_noop\n%cA `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop",wi,_i):(i=!0,r&&function(){{const t=new Error("svelte_boundary_reset_onerror\nA `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror");throw t.name="Svelte error",t}}(),Ir.ensure(),j(Hr,this,0),null!==z(qr,this)&&ms(z(qr,this),(()=>{j(qr,this,null)})),this.is_pending=this.has_pending_snippet(),j($r,this,B(to,this,oo).call(this,(()=>(j(Xr,this,!1),us((()=>z(Wr,this).call(this,z(Br,this)))))))),z(Kr,this)>0?B(to,this,so).call(this):this.is_pending=!1)};var s=Is;try{Es(null),r=!0,null==e||e(t,o),r=!1}catch(t){nr(t,z(jr,this)&&z(jr,this).parent)}finally{Es(s)}n&&Ji((()=>{j(qr,this,B(to,this,oo).call(this,(()=>{Ir.ensure(),j(Xr,this,!0);try{return us((()=>{n(z(Br,this),(()=>t),(()=>o))}))}catch(t){return nr(t,z(jr,this).parent),null}finally{j(Xr,this,!1)}})))}))}}function no(){try{j($r,this,us((()=>z(Wr,this).call(this,z(Br,this)))))}catch(t){this.error(t)}}function io(){const t=z(zr,this).pending;t&&(j(Ur,this,us((()=>t(z(Br,this))))),Ir.enqueue((()=>{var t=B(to,this,ro).call(this);j($r,this,B(to,this,oo).call(this,(()=>(Ir.ensure(),us((()=>z(Wr,this).call(this,t))))))),z(Kr,this)>0?B(to,this,so).call(this):(ms(z(Ur,this),(()=>{j(Ur,this,null)})),this.is_pending=!1)})))}function ro(){var t=z(Br,this);return this.is_pending&&(j(Gr,this,Uo()),z(Br,this).before(z(Gr,this)),t=z(Gr,this)),t}function oo(t){var e=Ss,n=Is,i=Wi;Ms(z(jr,this)),Es(z(jr,this)),ji(z(jr,this).ctx);try{return t()}catch(t){return er(t),null}finally{Ms(e),Es(n),ji(i)}}function so(){const t=z(zr,this).pending;null!==z($r,this)&&(j(Vr,this,document.createDocumentFragment()),z(Vr,this).append(z(Gr,this)),bs(z($r,this),z(Vr,this))),null===z(Ur,this)&&j(Ur,this,us((()=>t(z(Br,this)))))}function ao(t){var e;if(this.has_pending_snippet()){if(j(Kr,this,z(Kr,this)+t),0===z(Kr,this)){this.is_pending=!1;for(const t of z(Yr,this))or(t,Zn),Rr(t);for(const t of z(Qr,this))or(t,ti),Rr(t);z(Yr,this).clear(),z(Qr,this).clear(),z(Ur,this)&&ms(z(Ur,this),(()=>{j(Ur,this,null)})),z(Vr,this)&&(z(Br,this).before(z(Vr,this)),j(Vr,this,null))}}else this.parent&&B(to,e=this.parent,ao).call(e,t)}function lo(t,e,n,i){const r=ho;if(0!==n.length||0!==t.length){var o,s,a,l,c,u=ur,d=Ss,h=(o=Ss,s=Is,a=Wi,l=ur,c=$i,function(t=!0){Ms(o),Es(s),ji(a),t&&(null==l||l.activate()),Ui(c)});t.length>0?Promise.all(t).then((()=>{h();try{return f()}finally{null==u||u.deactivate(),co()}})):f()}else i(e.map(r));function f(){Promise.all(n.map((t=>fo(t)))).then((t=>{h();try{i([...e.map(r),...t])}catch(t){d.f&ni||nr(t,d)}null==u||u.deactivate(),co()})).catch((t=>{nr(t,d)}))}}function co(){Ms(null),Es(null),ji(null),Ui(null)}const uo=new Set;function ho(t){var e=Un|Zn,n=null!==Is&&Is.f&Un?Is:null;null!==Ss&&(Ss.f|=ai);return{ctx:Wi,deps:null,effects:null,equals:Pi,f:e,fn:t,reactions:null,rv:0,v:En,wv:0,parent:null!=n?n:Ss,ac:null}}function fo(t,e,n){let i=Ss;null===i&&function(){{const t=new Error("async_derived_orphan\nCannot create a `$derived(...)` with an `await` expression outside of an effect tree\nhttps://svelte.dev/e/async_derived_orphan");throw t.name="Svelte error",t}}();var r=i.b,o=void 0,s=Io(En);s.label=e;var a=!Is,l=new Map;return function(t){ts(hi|ai,t,!0)}((()=>{var e=$n();o=e.promise;try{Promise.resolve(t()).then(e.resolve,e.reject).then((()=>{n===ur&&n.committed&&n.deactivate(),co()}))}catch(t){e.reject(t),co()}var n=ur;if(a){var i,c=r.is_rendered();r.update_pending_count(1),n.increment(c),null===(i=l.get(n))||void 0===i||i.reject(yi),l.delete(n),l.set(n,e)}const u=(t,e=void 0)=>{if(n.activate(),e)e!==yi&&(s.f|=fi,Mo(s,e));else{s.f&fi&&(s.f^=fi),Mo(s,t);for(const[t,e]of l){if(l.delete(t),t===n)break;e.reject(yi)}}a&&(r.update_pending_count(-1),n.decrement(c))};e.promise.then(u,(t=>u(null,t||"unknown")))})),ns((()=>{for(const t of l.values())t.reject(yi)})),s.f|=hi,new Promise((t=>{!function e(n){function i(){n===o?t(s):e(o)}n.then(i,i)}(o)}))}function po(t){const e=ho(t);return Ns(e),e}function mo(t){const e=ho(t);return e.equals=Ri,e}function vo(t){var e=t.effects;if(null!==e){t.effects=null;for(var n=0;n<e.length;n+=1)fs(e[n])}}let go=[];function yo(t){var e,n=Ss;Ms(function(t){for(var e=t.parent;null!==e;){if(!(e.f&Un))return e.f&ni?null:e;e=e.parent}return null}(t));{let i=ko;wo(new Set);try{go.includes(t)&&function(){{const t=new Error("derived_references_self\nA derived value cannot reference itself recursively\nhttps://svelte.dev/e/derived_references_self");throw t.name="Svelte error",t}}(),go.push(t),t.f&=~ui,vo(t),e=js(t)}finally{Ms(n),wo(i),go.pop()}}return e}function bo(t){var e,n,i=yo(t);if(!t.equals(i)&&(t.wv=Ls(),(null===(e=ur)||void 0===e||!e.is_fork||null===t.deps)&&(t.v=i,null===t.deps)))return void or(t,Jn);ws||(null!==dr?(es()||null!==(n=ur)&&void 0!==n&&n.is_fork)&&dr.set(t,i):sr(t))}let ko=new Set;const xo=new Map;function wo(t){ko=t}let _o=!1;function Io(t,e){return{f:0,v:t,reactions:null,equals:Pi,rv:0,wv:0}}function To(t,e){const n=Io(t);return Ns(n),n}function Eo(t,e=!1,n=!0){const i=Io(t);return e||(i.equals=Ri),i}function So(t,e,n=!1){var i;null!==Is&&(!Ts||Is.f&oi)&&Is.f&(Un|Hn|hi|oi)&&(null===(i=As)||void 0===i||!i.includes(t))&&function(){{const t=new Error("state_unsafe_mutation\nUpdating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw t.name="Svelte error",t}}();let r=n?Oo(e):e;return Li(r,t.label),Mo(t,r)}function Mo(t,e){if(!t.equals(e)){var n=t.v;ws?xo.set(t,e):xo.set(t,n),t.v=e;var i=Ir.ensure();if(i.capture(t,n),null!==Ss){var r,o,s;null!==(r=t.updated)&&void 0!==r||(t.updated=new Map);const e=(null!==(o=null===(s=t.updated.get(""))||void 0===s?void 0:s.count)&&void 0!==o?o:0)+1;if(t.updated.set("",{error:null,count:e}),e>5){const e=zi("updated at");if(null!==e){let n=t.updated.get(e.stack);n||(n={error:e,count:0},t.updated.set(e.stack,n)),n.count++}}}if(null!==Ss&&(t.set_during_effect=!0),t.f&Un){const e=t;t.f&Zn&&yo(e),sr(e)}t.wv=Ls(),Fo(t,Zn),null!==Ss&&Ss.f&Jn&&!(Ss.f&(Kn|Xn))&&(null===Os?function(t){Os=t}([t]):Os.push(t)),!i.is_fork&&ko.size>0&&!_o&&Ao()}return e}function Ao(){_o=!1;var t=ks;xs(!0);const e=Array.from(ko);try{for(const t of e)t.f&Jn&&or(t,ti),zs(t)&&qs(t)}finally{xs(t)}ko.clear()}function No(t){So(t,t.v+1)}function Fo(t,e){var n=t.reactions;if(null!==n)for(var i=n.length,r=0;r<i;r++){var o=n[r],s=o.f;if(s&oi)ko.add(o);else{var a=!(s&Zn);if(a&&or(o,e),s&Un){var l,c=o;null===(l=dr)||void 0===l||l.delete(c),s&ui||(s&Qn&&(o.f|=ui),Fo(c,ti))}else a&&(s&Hn&&null!==Fr&&Fr.add(o),Rr(o))}}}const Co=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function Oo(t){if("object"!=typeof t||null===t||pi in t)return t;const e=zn(t);if(e!==Bn&&e!==Ln)return t;var n=new Map,i=Fn(t),r=To(0),o=Ds,s=t=>{if(Ds===o)return t();var e=Is,n=Ds;Es(null),Bs(o);var i=t();return Es(e),Bs(n),i};i&&(n.set("length",To(t.length)),t=new Proxy(t,{get(t,e,n){var i=Reflect.get(t,e,n);return Do.has(e)?function(...t){_o=!0;var e=i.apply(this,t);return Ao(),e}:i}}));var a="";let l=!1;function c(t){if(!l){l=!0,Bi(r,`${a=t} version`);for(const[t,e]of n)Bi(e,Po(a,t));l=!1}}return new Proxy(t,{defineProperty(t,e,i){"value"in i&&!1!==i.configurable&&!1!==i.enumerable&&!1!==i.writable||function(){{const t=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw t.name="Svelte error",t}}();var r=n.get(e);return void 0===r?r=s((()=>{var t=To(i.value);return n.set(e,t),"string"==typeof e&&Bi(t,Po(a,e)),t})):So(r,i.value,!0),!0},deleteProperty(t,e){var i=n.get(e);if(void 0===i){if(e in t){const t=s((()=>To(En)));n.set(e,t),No(r),Bi(t,Po(a,e))}}else So(i,En),No(r);return!0},get(e,i,r){var o;if(i===pi)return t;if(i===gi)return c;var l=n.get(i),u=i in e;if(void 0===l&&(!u||null!==(o=Rn(e,i))&&void 0!==o&&o.writable)&&(l=s((()=>{var t=To(Oo(u?e[i]:En));return Bi(t,Po(a,i)),t})),n.set(i,l)),void 0!==l){var d=Gs(l);return d===En?void 0:d}return Reflect.get(e,i,r)},getOwnPropertyDescriptor(t,e){var i=Reflect.getOwnPropertyDescriptor(t,e);if(i&&"value"in i){var r=n.get(e);r&&(i.value=Gs(r))}else if(void 0===i){var o=n.get(e),s=null==o?void 0:o.v;if(void 0!==o&&s!==En)return{enumerable:!0,configurable:!0,value:s,writable:!0}}return i},has(t,e){var i;if(e===pi)return!0;var r=n.get(e),o=void 0!==r&&r.v!==En||Reflect.has(t,e);if((void 0!==r||null!==Ss&&(!o||null!==(i=Rn(t,e))&&void 0!==i&&i.writable))&&(void 0===r&&(r=s((()=>{var n=To(o?Oo(t[e]):En);return Bi(n,Po(a,e)),n})),n.set(e,r)),Gs(r)===En))return!1;return o},set(t,e,o,l){var c,u=n.get(e),d=e in t;if(i&&"length"===e)for(var h=o;h<u.v;h+=1){var f=n.get(h+"");void 0!==f?So(f,En):h in t&&(f=s((()=>To(En))),n.set(h+"",f),Bi(f,Po(a,h)))}void 0===u?(!d||null!==(c=Rn(t,e))&&void 0!==c&&c.writable)&&(Bi(u=s((()=>To(void 0))),Po(a,e)),So(u,Oo(o)),n.set(e,u)):(d=u.v!==En,So(u,s((()=>Oo(o)))));var p=Reflect.getOwnPropertyDescriptor(t,e);if(null!=p&&p.set&&p.set.call(l,o),!d){if(i&&"string"==typeof e){var m=n.get("length"),v=Number(e);Number.isInteger(v)&&v>=m.v&&So(m,v+1)}No(r)}return!0},ownKeys(t){Gs(r);var e=Reflect.ownKeys(t).filter((t=>{var e=n.get(t);return void 0===e||e.v!==En}));for(var[i,o]of n)o.v===En||i in t||e.push(i);return e},setPrototypeOf(){!function(){{const t=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw t.name="Svelte error",t}}()}})}function Po(t,e){var n;return"symbol"==typeof e?`${t}[Symbol(${null!==(n=e.description)&&void 0!==n?n:""})]`:Co.test(e)?`${t}.${e}`:/^\d+$/.test(e)?`${t}[${e}]`:`${t}['${e}']`}function Ro(t){try{if(null!==t&&"object"==typeof t&&pi in t)return t[pi]}catch{}return t}const Do=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function Bo(t,e,n=!0){try{t===e!=(Ro(t)===Ro(e))&&Ti(n?"===":"!==")}catch{}return t===e===n}var Lo,zo,Wo,jo;function $o(){if(void 0===Lo){Lo=window,zo=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;Wo=Rn(e,"firstChild").get,jo=Rn(e,"nextSibling").get,Wn(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),Wn(n)&&(n.__t=void 0),t.__svelte_meta=null,function(){const t=Array.prototype,e=Array.__svelte_cleanup;e&&e();const{indexOf:n,lastIndexOf:i,includes:r}=t;t.indexOf=function(t,e){const i=n.call(this,t,e);if(-1===i)for(let n=null!=e?e:0;n<this.length;n+=1)if(Ro(this[n])===t){Ti("array.indexOf(...)");break}return i},t.lastIndexOf=function(t,e){const n=i.call(this,t,null!=e?e:this.length-1);if(-1===n)for(let n=0;n<=(null!=e?e:this.length-1);n+=1)if(Ro(this[n])===t){Ti("array.lastIndexOf(...)");break}return n},t.includes=function(t,e){const n=r.call(this,t,e);if(!n)for(let e=0;e<this.length;e+=1)if(Ro(this[e])===t){Ti("array.includes(...)");break}return n},Array.__svelte_cleanup=()=>{t.indexOf=n,t.lastIndexOf=i,t.includes=r}}()}}function Uo(t=""){return document.createTextNode(t)}function qo(t){return Wo.call(t)}function Vo(t){return jo.call(t)}function Go(t,e){if(!Si)return qo(t);var n=qo(Ei);if(null===n)n=Ei.appendChild(Uo());else if(e&&n.nodeType!==bi){var i,r=Uo();return null===(i=n)||void 0===i||i.before(r),Ai(r),r}return Ai(n),n}function Ho(t,e=!1){var n;if(!Si){var i=qo(t);return i instanceof Comment&&""===i.data?Vo(i):i}if(e&&(null===(n=Ei)||void 0===n?void 0:n.nodeType)!==bi){var r,o=Uo();return null===(r=Ei)||void 0===r||r.before(o),Ai(o),o}return Ei}function Ko(t,e=1,n=!1){var i;let r=Si?Ei:t;for(var o;e--;)o=r,r=Vo(r);if(!Si)return r;if(n&&(null===(i=r)||void 0===i?void 0:i.nodeType)!==bi){var s,a=Uo();if(null===r)null===(s=o)||void 0===s||s.after(a);else r.before(a);return Ai(a),a}return Ai(r),r}function Xo(t){t.textContent=""}function Yo(t,e){if(e){const e=document.body;t.autofocus=!0,Ji((()=>{document.activeElement===e&&t.focus()}))}}let Qo=!1;function Jo(t){var e=Is,n=Ss;Es(null),Ms(null);try{return t()}finally{Es(e),Ms(n)}}function Zo(t){null===Ss&&(null===Is&&function(t){{const e=new Error(`effect_orphan\n\`${t}\` can only be used inside an effect (e.g. during component initialisation)\nhttps://svelte.dev/e/effect_orphan`);throw e.name="Svelte error",e}}(t),function(){{const t=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw t.name="Svelte error",t}}()),ws&&function(t){{const e=new Error(`effect_in_teardown\n\`${t}\` cannot be used inside an effect cleanup function\nhttps://svelte.dev/e/effect_in_teardown`);throw e.name="Svelte error",e}}(t)}function ts(t,e,n){for(var i=Ss;null!==i&&i.f&oi;)i=i.parent;null!==i&&i.f&ei&&(t|=ei);var r={ctx:Wi,deps:null,nodes:null,f:t|Zn|Qn,first:null,fn:e,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,wv:0,ac:null};if(r.component_function=qi,n)try{qs(r),r.f|=ii}catch(t){throw fs(r),t}else null!==e&&Rr(r);var o=r;if(!n||null!==o.deps||null!==o.teardown||null!==o.nodes||o.first!==o.last||o.f&ai||(o=o.first,t&Hn&&t&ri&&null!==o&&(o.f|=ri)),null!==o&&(o.parent=i,null!==i&&function(t,e){var n=e.last;null===n?e.last=e.first=t:(n.next=t,t.prev=n,e.last=t)}(o,i),null!==Is&&Is.f&Un&&!(t&Xn))){var s,a=Is;(null!==(s=a.effects)&&void 0!==s?s:a.effects=[]).push(o)}return r}function es(){return null!==Is&&!Ts}function ns(t){const e=ts(Vn,null,!1);return or(e,Jn),e.teardown=t,e}function is(t){Zo("$effect"),Pn(t,"name",{value:"$effect"});var e=Ss.f;if(!!(Is||!(e&Kn)||e&ii))return rs(t);var n,i=Wi;(null!==(n=i.e)&&void 0!==n?n:i.e=[]).push(t)}function rs(t){return ts(qn|li,t,!1)}function os(t){return ts(qn,t,!1)}function ss(t,e=0){return ts(Vn|e,t,!0)}function as(t,e=[],n=[],i=[]){lo(i,e,n,(e=>{ts(Vn,(()=>t(...e.map(Gs))),!0)}))}function ls(t,e=0){var n=ts(Hn|e,t,!0);return n.dev_stack=$i,n}function cs(t,e=0){var n=ts(Gn|e,t,!0);return n.dev_stack=$i,n}function us(t){return ts(Kn|ai,t,!0)}function ds(t){var e=t.teardown;if(null!==e){const t=ws,n=Is;_s(!0),Es(null);try{e.call(null)}finally{_s(t),Es(n)}}}function hs(t,e=!1){var n=t.first;for(t.first=t.last=null;null!==n;){const t=n.ac;null!==t&&Jo((()=>{t.abort(yi)}));var i=n.next;n.f&Xn?n.parent=null:fs(n,e),n=i}}function fs(t,e=!0){var n=!1;(e||t.f&si)&&null!==t.nodes&&null!==t.nodes.end&&(!function(t,e){for(;null!==t;){var n=t===e?null:Vo(t);t.remove(),t=n}}(t.nodes.start,t.nodes.end),n=!0),hs(t,e&&!n),Us(t,0),or(t,ni);var i=t.nodes&&t.nodes.t;if(null!==i)for(const t of i)t.stop();ds(t);var r=t.parent;null!==r&&null!==r.first&&ps(t),t.component_function=null,t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=null}function ps(t){var e=t.parent,n=t.prev,i=t.next;null!==n&&(n.next=i),null!==i&&(i.prev=n),null!==e&&(e.first===t&&(e.first=i),e.last===t&&(e.last=n))}function ms(t,e,n=!0){var i=[];vs(t,i,!0);var r=()=>{n&&fs(t),e&&e()},o=i.length;if(o>0){var s=()=>--o||r();for(var a of i)a.out(s)}else r()}function vs(t,e,n){if(!(t.f&ei)){t.f^=ei;var i=t.nodes&&t.nodes.t;if(null!==i)for(const t of i)(t.is_global||n)&&e.push(t);for(var r=t.first;null!==r;){var o=r.next;vs(r,e,!!(!!(r.f&ri)||!!(r.f&Kn)&&!!(t.f&Hn))&&n),r=o}}}function gs(t){ys(t,!0)}function ys(t,e){if(t.f&ei){t.f^=ei,t.f&Jn||(or(t,Zn),Rr(t));for(var n=t.first;null!==n;){var i=n.next;ys(n,!!(!!(n.f&ri)||!!(n.f&Kn))&&e),n=i}var r=t.nodes&&t.nodes.t;if(null!==r)for(const t of r)(t.is_global||e)&&t.in()}}function bs(t,e){if(t.nodes)for(var n=t.nodes.start,i=t.nodes.end;null!==n;){var r=n===i?null:Vo(n);e.append(n),n=r}}let ks=!1;function xs(t){ks=t}let ws=!1;function _s(t){ws=t}let Is=null,Ts=!1;function Es(t){Is=t}let Ss=null;function Ms(t){Ss=t}let As=null;function Ns(t){null!==Is&&(null===As?As=[t]:As.push(t))}let Fs=null,Cs=0,Os=null;let Ps=1,Rs=0,Ds=Rs;function Bs(t){Ds=t}function Ls(){return++Ps}function zs(t){var e=t.f;if(e&Zn)return!0;if(e&Un&&(t.f&=~ui),e&ti){for(var n=t.deps,i=n.length,r=0;r<i;r++){var o=n[r];if(zs(o)&&bo(o),o.wv>t.wv)return!0}e&Qn&&null===dr&&or(t,Jn)}return!1}function Ws(t,e,n=!0){var i,r=t.reactions;if(null!==r&&(null===(i=As)||void 0===i||!i.includes(t)))for(var o=0;o<r.length;o++){var s=r[o];s.f&Un?Ws(s,e,!1):e===s&&(n?or(s,Zn):s.f&Jn&&or(s,ti),Rr(s))}}function js(t){var e=Fs,n=Cs,i=Os,r=Is,o=As,s=Wi,a=Ts,l=Ds,c=t.f;Fs=null,Cs=0,Os=null,Is=c&(Kn|Xn)?null:t,As=null,ji(t.ctx),Ts=!1,Ds=++Rs,null!==t.ac&&(Jo((()=>{t.ac.abort(yi)})),t.ac=null);try{t.f|=di;var u=(0,t.fn)(),d=t.deps;if(null!==Fs){var h;if(Us(t,Cs),null!==d&&Cs>0)for(d.length=Cs+Fs.length,h=0;h<Fs.length;h++)d[Cs+h]=Fs[h];else t.deps=d=Fs;if(es()&&t.f&Qn)for(h=Cs;h<d.length;h++){var f,p;(null!==(p=(f=d[h]).reactions)&&void 0!==p?p:f.reactions=[]).push(t)}}else null!==d&&Cs<d.length&&(Us(t,Cs),d.length=Cs);if(!(null===Os||Ts||null===d||t.f&(Un|ti|Zn)))for(h=0;h<Os.length;h++)Ws(Os[h],t);return null!==r&&r!==t&&(Rs++,null!==Os&&(null===i?i=Os:i.push(...Os))),t.f&fi&&(t.f^=fi),u}catch(t){return er(t)}finally{t.f^=di,Fs=e,Cs=n,Os=i,Is=r,As=o,ji(s),Ts=a,Ds=l}}function $s(t,e){let n=e.reactions;if(null!==n){var i=Cn.call(n,t);if(-1!==i){var r=n.length-1;0===r?n=e.reactions=null:(n[i]=n[r],n.pop())}}if(null===n&&e.f&Un&&(null===Fs||!Fs.includes(e))){var o=e;o.f&Qn&&(o.f^=Qn,o.f&=~ui),sr(o),vo(o),Us(o,0)}}function Us(t,e){var n=t.deps;if(null!==n)for(var i=e;i<n.length;i++)$s(t,n[i])}function qs(t){var e=t.f;if(!(e&ni)){or(t,Jn);var n=Ss,i=ks;Ss=t,ks=!0;var r,o=qi;Vi(t.component_function);var s=$i;Ui(null!==(r=t.dev_stack)&&void 0!==r?r:$i);try{e&(Hn|Gn)?function(t){for(var e=t.first;null!==e;){var n=e.next;e.f&Kn||fs(e),e=n}}(t):hs(t),ds(t);var a=js(t);t.teardown="function"==typeof a?a:null,t.wv=Ps,Nn&&Di&&t.f&Zn&&t.deps}finally{ks=i,Ss=n,Vi(o),Ui(s)}}}async function Vs(){await Promise.resolve(),function(){var t=mr;mr=!0;try{for(;;){var e;if(Zi(),0===hr.length&&(null===(e=ur)||void 0===e||e.flush(),0===hr.length))return void(fr=null);Ar()}}finally{mr=t}}()}function Gs(t){var e,n,i=!!(t.f&Un);if(null!==Is&&!Ts&&!(null!==Ss&&!!(Ss.f&ni)||null!==(n=As)&&void 0!==n&&n.includes(t))){var r=Is.deps;if(Is.f&di)t.rv<Rs&&(t.rv=Rs,null===Fs&&null!==r&&r[Cs]===t?Cs++:null===Fs?Fs=[t]:Fs.includes(t)||Fs.push(t));else{var o,s;(null!==(s=(o=Is).deps)&&void 0!==s?s:o.deps=[]).push(t);var a=t.reactions;null===a?t.reactions=[Is]:a.includes(Is)||a.push(Is)}}if(uo.delete(t),ws&&xo.has(t))return xo.get(t);if(i){var l=t;if(ws){var c=l.v;return(l.f&Jn||null===l.reactions)&&!Ks(l)||(c=yo(l)),xo.set(l,c),c}var u=!(l.f&Qn)&&!Ts&&null!==Is&&(ks||!!(Is.f&Qn)),d=null===l.deps;zs(l)&&(u&&(l.f|=Qn),bo(l)),u&&!d&&Hs(l)}if(null!==(e=dr)&&void 0!==e&&e.has(t))return dr.get(t);if(t.f&fi)throw t.v;return t.v}function Hs(t){if(null!==t.deps){t.f|=Qn;for(const n of t.deps){var e;(null!==(e=n.reactions)&&void 0!==e?e:n.reactions=[]).push(t),n.f&Un&&!(n.f&Qn)&&Hs(n)}}}function Ks(t){if(t.v===En)return!0;if(null===t.deps)return!1;for(const e of t.deps){if(xo.has(e))return!0;if(e.f&Un&&Ks(e))return!0}return!1}function Xs(t){var e=Ts;try{return Ts=!0,t()}finally{Ts=e}}const Ys=new Set,Qs=new Set;function Js(t,e,n,i={}){function r(t){if(i.capture||na.call(e,t),!t.cancelBubble)return Jo((()=>null==n?void 0:n.call(this,t)))}return t.startsWith("pointer")||t.startsWith("touch")||"wheel"===t?Ji((()=>{e.addEventListener(t,r,i)})):e.addEventListener(t,r,i),r}function Zs(t,e,n,i,r){var o={capture:i,passive:r},s=Js(t,e,n,o);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&ns((()=>{e.removeEventListener(t,s,o)}))}function ta(t){for(var e=0;e<t.length;e++)Ys.add(t[e]);for(var n of Qs)n(t)}let ea=null;function na(t){var e,n=this,i=n.ownerDocument,r=t.type,o=(null===(e=t.composedPath)||void 0===e?void 0:e.call(t))||[],s=o[0]||t.target;ea=t;var a=0,l=ea===t&&t.__root;if(l){var c=o.indexOf(l);if(-1!==c&&(n===document||n===window))return void(t.__root=n);var u=o.indexOf(n);if(-1===u)return;c<=u&&(a=c)}if((s=o[a]||t.target)!==n){Pn(t,"currentTarget",{configurable:!0,get:()=>s||i});var d=Is,h=Ss;Es(null),Ms(null);try{for(var f,p=[];null!==s;){var m=s.assignedSlot||s.parentNode||s.host||null;try{var v=s["__"+r];null==v||s.disabled&&t.target!==s||v.call(s,t)}catch(t){f?p.push(t):f=t}if(t.cancelBubble||m===n||null===m)break;s=m}if(f){for(let t of p)queueMicrotask((()=>{throw t}));throw f}}finally{t.__root=n,delete t.currentTarget,Es(d),Ms(h)}}}function ia(t){var e=document.createElement("template");return e.innerHTML=t.replaceAll("<!>","\x3c!----\x3e"),e.content}function ra(t,e){var n=Ss;null===n.nodes&&(n.nodes={start:t,end:e,a:null,t:null})}function oa(t,e){var n,i=!!(1&e),r=!!(2&e),o=!t.startsWith("<!>");return()=>{if(Si)return ra(Ei,null),Ei;void 0===n&&(n=ia(o?t:"<!>"+t),i||(n=qo(n)));var e=r||zo?document.importNode(n,!0):n.cloneNode(!0);i?ra(qo(e),e.lastChild):ra(e,e);return e}}function sa(t,e,n="svg"){var i,r=`<${n}>${!t.startsWith("<!>")?t:"<!>"+t}</${n}>`;return()=>{if(Si)return ra(Ei,null),Ei;if(!i){var t=ia(r);i=qo(qo(t))}var e=i.cloneNode(!0);return ra(e,e),e}}function aa(t,e){return sa(t,0,"svg")}function la(){if(Si)return ra(Ei,null),Ei;var t=document.createDocumentFragment(),e=document.createComment(""),n=Uo();return t.append(e,n),ra(e,n),t}function ca(t,e){if(Si){var n=Ss;return n.f&ii&&null!==n.nodes.end||(n.nodes.end=Ei),void Ni()}null!==t&&t.before(e)}function ua(t){return t.endsWith("capture")&&"gotpointercapture"!==t&&"lostpointercapture"!==t}const da=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function ha(t){return da.includes(t)}const fa={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function pa(t){var e;return t=t.toLowerCase(),null!==(e=fa[t])&&void 0!==e?e:t}const ma=["touchstart","touchmove"];let va=!0;function ga(t,e){var n,i=null==e?"":"object"==typeof e?e+"":e;i!==(null!==(n=t.__t)&&void 0!==n?n:t.__t=t.nodeValue)&&(t.__t=i,t.nodeValue=i+"")}function ya(t,e){return xa(t,e)}function ba(t,e){var n;$o(),e.intro=null!==(n=e.intro)&&void 0!==n&&n;const i=e.target,r=Si,o=Ei;try{for(var s=qo(i);s&&(s.nodeType!==ki||s.data!==wn);)s=Vo(s);if(!s)throw Tn;Mi(!0),Ai(s);const n=xa(t,{...e,anchor:s});return Mi(!1),n}catch(n){if(n instanceof Error&&n.message.split("\n").some((t=>t.startsWith("https://svelte.dev/e/"))))throw n;return n!==Tn&&console.warn("Failed to hydrate: ",n),!1===e.recover&&function(){{const t=new Error("hydration_failed\nFailed to hydrate the application\nhttps://svelte.dev/e/hydration_failed");throw t.name="Svelte error",t}}(),$o(),Xo(i),Mi(!1),ya(t,e)}finally{Mi(r),Ai(o)}}const ka=new Map;function xa(t,{target:e,anchor:n,props:i={},events:r,context:o,intro:s=!0}){$o();var a=new Set,l=t=>{for(var n=0;n<t.length;n++){var i=t[n];if(!a.has(i)){a.add(i);var r=(s=i,ma.includes(s));e.addEventListener(i,na,{passive:r});var o=ka.get(i);void 0===o?(document.addEventListener(i,na,{passive:r}),ka.set(i,1)):ka.set(i,o+1)}}var s};l(On(Ys)),Qs.add(l);var c=void 0,u=function(t){Ir.ensure();const e=ts(Xn|ai,t,!0);return(t={})=>new Promise((n=>{t.outro?ms(e,(()=>{fs(e),n(void 0)})):(fs(e),n(void 0))}))}((()=>{var u=null!=n?n:e.appendChild(Uo());return function(t,e,n){new eo(t,e,n)}(u,{pending:()=>{}},(e=>{o&&(Hi({}),Wi.c=o);if(r&&(i.$$events=r),Si&&ra(e,null),va=s,c=t(e,i)||{},va=!0,Si&&(Ss.nodes.end=Ei,null===Ei||Ei.nodeType!==ki||Ei.data!==In))throw Ii(),Tn;o&&Ki()})),()=>{for(var t of a){e.removeEventListener(t,na);var i=ka.get(t);0==--i?(document.removeEventListener(t,na),ka.delete(t)):ka.set(t,i)}var r;(Qs.delete(l),u!==n)&&(null===(r=u.parentNode)||void 0===r||r.removeChild(u))}}));return wa.set(c,u),c}let wa=new WeakMap;function _a(t,e){const n=wa.get(t);return n?(wa.delete(t),n(e)):(pi in t?console.warn("%c[svelte] state_proxy_unmount\n%cTried to unmount a state proxy, rather than a component\nhttps://svelte.dev/e/state_proxy_unmount",wi,_i):console.warn("%c[svelte] lifecycle_double_unmount\n%cTried to unmount a component that was not mounted\nhttps://svelte.dev/e/lifecycle_double_unmount",wi,_i),Promise.resolve())}class Ia{anchor;#t=new Map;#e=new Map;#n=new Map;#i=new Set;#r=!0;constructor(t,e=!0){this.anchor=t,this.#r=e}#o=()=>{var t=ur;if(this.#t.has(t)){var e=this.#t.get(t),n=this.#e.get(e);if(n)gs(n),this.#i.delete(e);else{var i=this.#n.get(e);i&&(this.#e.set(e,i.effect),this.#n.delete(e),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),n=i.effect)}for(const[e,n]of this.#t){if(this.#t.delete(e),e===t)break;const i=this.#n.get(n);i&&(fs(i.effect),this.#n.delete(n))}for(const[t,i]of this.#e){if(t===e||this.#i.has(t))continue;const r=()=>{if(Array.from(this.#t.values()).includes(t)){var e=document.createDocumentFragment();bs(i,e),e.append(Uo()),this.#n.set(t,{effect:i,fragment:e})}else fs(i);this.#i.delete(t),this.#e.delete(t)};this.#r||!n?(this.#i.add(t),ms(i,r,!1)):r()}}};#s=t=>{this.#t.delete(t);const e=Array.from(this.#t.values());for(const[t,n]of this.#n)e.includes(t)||(fs(n.effect),this.#n.delete(t))};ensure(t,e){var n=ur;!e||this.#e.has(t)||this.#n.has(t)||this.#e.set(t,us((()=>e(this.anchor)))),this.#t.set(n,t),Si&&(this.anchor=Ei),this.#o()}}{let t=function(t){if(!(t in globalThis)){let e;Object.defineProperty(globalThis,t,{configurable:!0,get:()=>{if(void 0!==e)return e;!function(t){{const e=new Error(`rune_outside_svelte\nThe \`${t}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files\nhttps://svelte.dev/e/rune_outside_svelte`);throw e.name="Svelte error",e}}(t)},set:t=>{e=t}})}};t("$state"),t("$effect"),t("$derived"),t("$inspect"),t("$props"),t("$bindable")}function Ta(t){null===Wi&&xi("onMount"),is((()=>{const e=Xs(t);if("function"==typeof e)return e}))}var Ea,Sa=new Map;function Ma(t,e,n=!1){Si&&Ni();var i=new Ia(t);function r(e,n){if(Si){if(e===(Oi(t)===_n)){var r=Ci();return Ai(r),i.anchor=r,Mi(!1),i.ensure(e,n),void Mi(!0)}}i.ensure(e,n)}ls((()=>{var t=!1;e(((e,n=!0)=>{t=!0,r(n,e)})),t||r(!1,null)}),n?ri:0)}function Aa(t,e){return e}function Na(t,e=!0){for(var n=0;n<t.length;n++)fs(t[n],e)}function Fa(t,e,n,i,r,o=null){var s=t,a=new Map;if(!!(e&pn)){var l=t;s=Si?Ai(qo(l)):l.appendChild(Uo())}Si&&Ni();var c,u=null,d=mo((()=>{var t=n();return Fn(t)?t:null==t?[]:On(t)})),h=!0;function f(){m.fallback=u,function(t,e,n,i,r){var o,s,a,l,c,u=!!(i&mn),d=e.length,h=t.items,f=t.effect.first,p=null,m=[],v=[];if(u)for(c=0;c<d;c+=1){var g,y;if(a=r(e[c],c),!((l=h.get(a).e).f&ci))null===(g=l.nodes)||void 0===g||null===(g=g.a)||void 0===g||g.measure(),(null!==(y=s)&&void 0!==y?y:s=new Set).add(l)}for(c=0;c<d;c+=1){if(a=r(e[c],c),l=h.get(a).e,null!==t.outrogroups)for(const e of t.outrogroups)e.pending.delete(l),e.done.delete(l);if(l.f&ci){if(l.f^=ci,l!==f){var b=p?p.next:f;l===t.effect.last&&(t.effect.last=l.prev),l.prev&&(l.prev.next=l.next),l.next&&(l.next.prev=l.prev),Pa(t,p,l),Pa(t,l,b),Oa(l,b,n),m=[],v=[],f=(p=l).next;continue}Oa(l,null,n)}var k,x;if(l.f&ei)if(gs(l),u)null===(k=l.nodes)||void 0===k||null===(k=k.a)||void 0===k||k.unfix(),(null!==(x=s)&&void 0!==x?x:s=new Set).delete(l);if(l!==f){if(void 0!==o&&o.has(l)){if(m.length<v.length){var w,_=v[0];p=_.prev;var I=m[0],T=m[m.length-1];for(w=0;w<m.length;w+=1)Oa(m[w],_,n);for(w=0;w<v.length;w+=1)o.delete(v[w]);Pa(t,I.prev,T.next),Pa(t,p,I),Pa(t,T,_),f=_,p=T,c-=1,m=[],v=[]}else o.delete(l),Oa(l,f,n),Pa(t,l.prev,l.next),Pa(t,l,null===p?t.effect.first:p.next),Pa(t,p,l),p=l;continue}for(m=[],v=[];null!==f&&f!==l;){var E;(null!==(E=o)&&void 0!==E?E:o=new Set).add(f),v.push(f),f=f.next}if(null===f)continue}l.f&ci||m.push(l),p=l,f=l.next}if(null!==t.outrogroups){for(const e of t.outrogroups){var S;if(0===e.pending.size)Na(On(e.done)),null===(S=t.outrogroups)||void 0===S||S.delete(e)}0===t.outrogroups.size&&(t.outrogroups=null)}if(null!==f||void 0!==o){var M=[];if(void 0!==o)for(l of o)l.f&ei||M.push(l);for(;null!==f;)f.f&ei||f===t.fallback||M.push(f),f=f.next;var A=M.length;if(A>0){var N=i&pn&&0===d?n:null;if(u){for(c=0;c<A;c+=1){var F;null===(F=M[c].nodes)||void 0===F||null===(F=F.a)||void 0===F||F.measure()}for(c=0;c<A;c+=1){var C;null===(C=M[c].nodes)||void 0===C||null===(C=C.a)||void 0===C||C.fix()}}!function(t,e,n){for(var i,r=e.length,o=e.length,s=0;s<r;s++){let n=e[s];ms(n,(()=>{if(i){if(i.pending.delete(n),i.done.add(n),0===i.pending.size){var e=t.outrogroups;Na(On(i.done)),e.delete(i),0===e.size&&(t.outrogroups=null)}}else o-=1}),!1)}if(0===o){var a=null!==n;if(a){var l=n,c=l.parentNode;Xo(c),c.append(l),t.items.clear()}Na(e,!a)}else{var u;i={pending:new Set(e),done:new Set},(null!==(u=t.outrogroups)&&void 0!==u?u:t.outrogroups=new Set).add(i)}}(t,M,N)}}u&&Ji((()=>{if(void 0!==s)for(l of s){var t;null===(t=l.nodes)||void 0===t||null===(t=t.a)||void 0===t||t.apply()}}))}(m,c,s,e,i),null!==u&&(0===c.length?u.f&ci?(u.f^=ci,Oa(u,null,s)):gs(u):ms(u,(()=>{u=null})))}var p=ls((()=>{var t=(c=Gs(d)).length;let l=!1;Si&&(Oi(s)===_n!==(0===t)&&(Ai(s=Ci()),Mi(!1),l=!0));for(var p=new Set,m=0;m<t;m+=1){Si&&Ei.nodeType===ki&&Ei.data===In&&(s=Ei,l=!0,Mi(!1));var v,g=c[m],y=i(g,m),b=h?null:a.get(y);if(b)b.v&&Mo(b.v,g),b.i&&Mo(b.i,m);else b=Ca(a,h?s:null!==(v=Ea)&&void 0!==v?v:Ea=Uo(),g,y,m,r,e,n),h||(b.e.f|=ci),a.set(y,b);p.add(y)}0===t&&o&&!u&&(h?u=us((()=>o(s))):(u=us((()=>{var t;return o(null!==(t=Ea)&&void 0!==t?t:Ea=Uo())}))).f|=ci),Si&&t>0&&Ai(Ci()),h||f(),l&&Mi(!0),Gs(d)})),m={effect:p,items:a,outrogroups:null,fallback:u};h=!1,Si&&(s=Ei)}function Ca(t,e,n,i,r,o,s,a){var l=s&hn?s&vn?Io(n):Eo(n,!1,!1):null,c=s&fn?Io(r):null;return l&&(l.trace=()=>{var t;a()[null!==(t=null==c?void 0:c.v)&&void 0!==t?t:r]}),{v:l,i:c,e:us((()=>(o(e,null!=l?l:n,null!=c?c:r,a),()=>{t.delete(i)})))}}function Oa(t,e,n){if(t.nodes)for(var i=t.nodes.start,r=t.nodes.end,o=!e||e.f&ci?n:e.nodes.start;null!==i;){var s=Vo(i);if(o.before(i),i===r)return;i=s}}function Pa(t,e,n){null===e?t.effect.first=n:e.next=n,null===n?t.effect.last=e:n.prev=e}const Ra={tick:t=>requestAnimationFrame(t),now:()=>performance.now(),tasks:new Set};function Da(){const t=Ra.now();Ra.tasks.forEach((e=>{e.c(t)||(Ra.tasks.delete(e),e.f())})),0!==Ra.tasks.size&&Ra.tick(Da)}function Ba(t,e){Jo((()=>{t.dispatchEvent(new CustomEvent(e))}))}function La(t){if("float"===t)return"cssFloat";if("offset"===t)return"cssOffset";if(t.startsWith("--"))return t;const e=t.split("-");return 1===e.length?e[0]:e[0]+e.slice(1).map((t=>t[0].toUpperCase()+t.slice(1))).join("")}function za(t){const e={},n=t.split(";");for(const t of n){const[n,i]=t.split(":");if(!n||void 0===i)break;e[La(n.trim())]=i.trim()}return e}const Wa=t=>t;function ja(t,e,n,i){var r,o,s,a,l,c=!!(t&xn),u=e.inert,d=e.style.overflow;function h(){return Jo((()=>{var t,r;return null!==(t=s)&&void 0!==t?t:s=n()(e,null!==(r=null==i?void 0:i())&&void 0!==r?r:{},{direction:"both"})}))}var f={is_global:c,in(){e.inert=u,Ba(e,"introstart"),a=$a(e,h(),l,1,(()=>{var t;Ba(e,"introend"),null===(t=a)||void 0===t||t.abort(),a=s=void 0,e.style.overflow=d}))},out(t){e.inert=!0,Ba(e,"outrostart"),l=$a(e,h(),a,0,(()=>{Ba(e,"outroend"),null==t||t()}))},stop:()=>{var t,e;null===(t=a)||void 0===t||t.abort(),null===(e=l)||void 0===e||e.abort()}},p=Ss;if((null!==(o=(r=p.nodes).t)&&void 0!==o?o:r.t=[]).push(f),va){var m=c;if(!m){for(var v=p.parent;v&&v.f&ri;)for(;(v=v.parent)&&!(v.f&Hn););m=!v||!!(v.f&ii)}m&&os((()=>{Xs((()=>f.in()))}))}}function $a(t,e,n,i,r){var o=1===i;if("function"==typeof e){var s,a=!1;return Ji((()=>{if(!a){var l=e({direction:o?"in":"out"});s=$a(t,l,n,i,r)}})),{abort:()=>{var t;a=!0,null===(t=s)||void 0===t||t.abort()},deactivate:()=>s.deactivate(),reset:()=>s.reset(),t:()=>s.t()}}if(null==n||n.deactivate(),null==e||!e.duration)return r(),{abort:jn,deactivate:jn,reset:jn,t:()=>i};const{delay:l=0,css:c,tick:u,easing:d=Wa}=e;var h=[];if(o&&void 0===n&&(u&&u(0,1),c)){var f=za(c(0,1));h.push(f,f)}var p=()=>1-i,m=t.animate(h,{duration:l,fill:"forwards"});return m.onfinish=()=>{var o;m.cancel();var s=null!==(o=null==n?void 0:n.t())&&void 0!==o?o:1-i;null==n||n.abort();var a=i-s,l=e.duration*Math.abs(a),h=[];if(l>0){var f=!1;if(c)for(var v=Math.ceil(l/(1e3/60)),g=0;g<=v;g+=1){var y=s+a*d(g/v),b=za(c(y,1-y));h.push(b),f||(f="hidden"===b.overflow)}f&&(t.style.overflow="hidden"),p=()=>{var t=m.currentTime;return s+a*d(t/l)},u&&function(t){let e;0===Ra.tasks.size&&Ra.tick(Da),new Promise((n=>{Ra.tasks.add(e={c:t,f:n})}))}((()=>{if("running"!==m.playState)return!1;var t=p();return u(t,1-t),!0}))}(m=t.animate(h,{duration:l,fill:"forwards"})).onfinish=()=>{p=()=>i,null==u||u(i,1-i),r()}},{abort:()=>{m&&(m.cancel(),m.effect=null,m.onfinish=jn)},deactivate:()=>{r=jn},reset:()=>{0===i&&(null==u||u(1,0))},t:()=>p()}}function Ua(t,e){os((()=>{var n,i=t.getRootNode(),r=i.host?i:null!==(n=i.head)&&void 0!==n?n:i.ownerDocument.head;if(!r.querySelector("#"+e.hash)){const t=document.createElement("style");t.id=e.hash,t.textContent=e.code,r.appendChild(t),function(t,e){var n=Sa.get(t);n||(n=new Set,Sa.set(t,n)),n.add(e)}(e.hash,t)}}))}function qa(t,e){var n,i=void 0;cs((()=>{i!==(i=e())&&(n&&(fs(n),n=null),i&&(n=us((()=>{os((()=>i(t)))}))))}))}function Va(t){var e,n,i="";if("string"==typeof t||"number"==typeof t)i+=t;else if("object"==typeof t)if(Array.isArray(t)){var r=t.length;for(e=0;e<r;e++)t[e]&&(n=Va(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function Ga(t){return"object"==typeof t?function(){for(var t,e,n=0,i="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=Va(t))&&(i&&(i+=" "),i+=e);return i}(t):null!=t?t:""}const Ha=[..." \t\n\r\f \v\ufeff"];function Ka(t,e=!1){var n=e?" !important;":";",i="";for(var r in t){var o=t[r];null!=o&&""!==o&&(i+=" "+r+": "+o+n)}return i}function Xa(t){return"-"!==t[0]||"-"!==t[1]?t.toLowerCase():t}function Ya(t,e,n,i,r,o){var s=t.__className;if(Si||s!==n||void 0===s){var a=function(t,e,n){var i=null==t?"":""+t;if(e&&(i=i?i+" "+e:e),n)for(var r in n)if(n[r])i=i?i+" "+r:r;else if(i.length)for(var o=r.length,s=0;(s=i.indexOf(r,s))>=0;){var a=s+o;0!==s&&!Ha.includes(i[s-1])||a!==i.length&&!Ha.includes(i[a])?s=a:i=(0===s?"":i.substring(0,s))+i.substring(a+1)}return""===i?null:i}(n,i,o);Si&&a===t.getAttribute("class")||(null==a?t.removeAttribute("class"):e?t.className=a:t.setAttribute("class",a)),t.__className=n}else if(o&&r!==o)for(var l in o){var c=!!o[l];null!=r&&c===!!r[l]||t.classList.toggle(l,c)}return o}function Qa(t,e={},n,i){for(var r in n){var o=n[r];e[r]!==o&&(null==n[r]?t.style.removeProperty(r):t.style.setProperty(r,o,i))}}function Ja(t,e,n,i){var r=t.__style;if(Si||r!==e){var o=function(t,e){if(e){var n,i,r="";if(Array.isArray(e)?(n=e[0],i=e[1]):n=e,t){t=String(t).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var o=!1,s=0,a=!1,l=[];n&&l.push(...Object.keys(n).map(Xa)),i&&l.push(...Object.keys(i).map(Xa));var c=0,u=-1;const e=t.length;for(var d=0;d<e;d++){var h=t[d];if(a?"/"===h&&"*"===t[d-1]&&(a=!1):o?o===h&&(o=!1):"/"===h&&"*"===t[d+1]?a=!0:'"'===h||"'"===h?o=h:"("===h?s++:")"===h&&s--,!a&&!1===o&&0===s)if(":"===h&&-1===u)u=d;else if(";"===h||d===e-1){if(-1!==u){var f=Xa(t.substring(c,u).trim());l.includes(f)||(";"!==h&&d++,r+=" "+t.substring(c,d).trim()+";")}c=d+1,u=-1}}}return n&&(r+=Ka(n)),i&&(r+=Ka(i,!0)),""===(r=r.trim())?null:r}return null==t?null:String(t)}(e,i);Si&&o===t.getAttribute("style")||(null==o?t.removeAttribute("style"):t.style.cssText=o),t.__style=e}else i&&(Array.isArray(i)?(Qa(t,null==n?void 0:n[0],i[0]),Qa(t,null==n?void 0:n[1],i[1],"important")):Qa(t,n,i));return i}function Za(t,e,n=!1){if(t.multiple){if(null==e)return;if(!Fn(e))return void console.warn("%c[svelte] select_multiple_invalid_value\n%cThe `value` property of a `<select multiple>` element should be an array, but it received a non-array value. The selection will be kept as is.\nhttps://svelte.dev/e/select_multiple_invalid_value",wi,_i);for(var i of t.options)i.selected=e.includes(tl(i))}else{for(i of t.options){var r=tl(i);if(o=r,s=e,Object.is(Ro(o),Ro(s)))return void(i.selected=!0)}var o,s;n&&void 0===e||(t.selectedIndex=-1)}}function tl(t){return"__value"in t?t.__value:t.value}const el=Symbol("class"),nl=Symbol("style"),il=Symbol("is custom element"),rl=Symbol("is html");function ol(t){if(Si){var e=!1,n=()=>{if(!e){if(e=!0,t.hasAttribute("value")){var n=t.value;al(t,"value",null),t.value=n}if(t.hasAttribute("checked")){var i=t.checked;al(t,"checked",null),t.checked=i}}};t.__on_r=n,Ji(n),Qo||(Qo=!0,document.addEventListener("reset",(t=>{Promise.resolve().then((()=>{if(!t.defaultPrevented)for(const n of t.target.elements){var e;null===(e=n.__on_r)||void 0===e||e.call(n)}}))}),{capture:!0}))}}function sl(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function al(t,e,n,i){var r=cl(t);Si&&(r[e]=t.getAttribute(e),"src"===e||"srcset"===e||"href"===e&&"LINK"===t.nodeName)?i||function(t,e,n){var i;if("srcset"===e&&function(t,e){var n=fl(t.srcset),i=fl(e);return i.length===n.length&&i.every((([t,e],i)=>e===n[i][1]&&(hl(n[i][0],t)||hl(t,n[i][0]))))}(t,n))return;if(hl(null!==(i=t.getAttribute(e))&&void 0!==i?i:"",n))return;!function(t,e,n){console.warn(`%c[svelte] hydration_attribute_changed\n%cThe \`${t}\` attribute on \`${e}\` changed its value between server and client renders. The client value, \`${n}\`, will be ignored in favour of the server value\nhttps://svelte.dev/e/hydration_attribute_changed`,wi,_i)}(e,t.outerHTML.replace(t.innerHTML,t.innerHTML&&"..."),String(n))}(t,e,null!=n?n:""):r[e]!==(r[e]=n)&&("loading"===e&&(t[vi]=n),null==n?t.removeAttribute(e):"string"!=typeof n&&dl(t).includes(e)?t[e]=n:t.setAttribute(e,n))}function ll(t,e,n=[],i=[],r=[],o,s=!1,a=!1){lo(r,n,i,(n=>{var i=void 0,r={},l="SELECT"===t.nodeName,c=!1;if(cs((()=>{var u=e(...n.map(Gs)),d=function(t,e,n,i,r=!1,o=!1){if(Si&&r&&"INPUT"===t.tagName){var s=t;("checkbox"===s.type?"defaultChecked":"defaultValue")in n||ol(s)}var a=cl(t),l=a[il],c=!a[rl];let u=Si&&l;u&&Mi(!1);var d,h=e||{},f="OPTION"===t.tagName;for(var p in e)p in n||(n[p]=null);n.class?n.class=Ga(n.class):n.class=null,n[nl]&&(null!==(d=n.style)&&void 0!==d||(n.style=null));var m=dl(t);for(const r in n){let s=n[r];if(f&&"value"===r&&null==s)t.value=t.__value="",h[r]=s;else if("class"!==r)if("style"!==r){var v=h[r];if(s!==v||void 0===s&&t.hasAttribute(r)){h[r]=s;var g=r[0]+r[1];if("$$"!==g)if("on"===g){const e={},n="$$"+r;let i=r.slice(2);var y=ha(i);if(ua(i)&&(i=i.slice(0,-7),e.capture=!0),!y&&v){if(null!=s)continue;t.removeEventListener(i,h[n],e),h[n]=null}if(null!=s)if(y)t[`__${i}`]=s,ta([i]);else{let o=function(t){h[r].call(this,t)};h[n]=Js(i,t,o,e)}else y&&(t[`__${i}`]=void 0)}else if("style"===r)al(t,r,s);else if("autofocus"===r)Yo(t,Boolean(s));else if(l||"__value"!==r&&("value"!==r||null==s))if("selected"===r&&f)sl(t,s);else{var b=r;c||(b=pa(b));var k="defaultValue"===b||"defaultChecked"===b;if(null!=s||l||k)k||m.includes(b)&&(l||"string"!=typeof s)?(t[b]=s,b in a&&(a[b]=En)):"function"!=typeof s&&al(t,b,s,o);else if(a[r]=null,"value"===b||"checked"===b){let n=t;const i=void 0===e;if("value"===b){let t=n.defaultValue;n.removeAttribute(b),n.defaultValue=t,n.value=n.__value=i?t:null}else{let t=n.defaultChecked;n.removeAttribute(b),n.defaultChecked=t,n.checked=!!i&&t}}else t.removeAttribute(r)}else t.value=t.__value=s}}else Ja(t,s,null==e?void 0:e[nl],n[nl]),h[r]=s,h[nl]=n[nl];else Ya(t,"http://www.w3.org/1999/xhtml"===t.namespaceURI,s,i,null==e?void 0:e[el],n[el]),h[r]=s,h[el]=n[el]}return u&&Mi(!0),h}(t,i,u,o,s,a);c&&l&&"value"in u&&Za(t,u.value);for(let t of Object.getOwnPropertySymbols(r))u[t]||fs(r[t]);for(let e of Object.getOwnPropertySymbols(u)){var h=u[e];e.description!==An||i&&h===i[e]||(r[e]&&fs(r[e]),r[e]=us((()=>qa(t,(()=>h))))),d[e]=h}i=d})),l){var u=t;os((()=>{Za(u,i.value,!0),function(t){var e=new MutationObserver((()=>{Za(t,t.__value)}));e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),ns((()=>{e.disconnect()}))}(u)}))}c=!0}))}function cl(t){var e;return null!==(e=t.__attributes)&&void 0!==e?e:t.__attributes={[il]:t.nodeName.includes("-"),[rl]:t.namespaceURI===Mn}}var ul=new Map;function dl(t){var e,n=t.getAttribute("is")||t.nodeName,i=ul.get(n);if(i)return i;ul.set(n,i=[]);for(var r=t,o=Element.prototype;o!==r;){for(var s in e=Dn(r))e[s].set&&i.push(s);r=zn(r)}return i}function hl(t,e){return t===e||new URL(t,document.baseURI).href===new URL(e,document.baseURI).href}function fl(t){return t.split(",").map((t=>t.trim().split(" ").filter(Boolean)))}function pl(t,e){return t===e||(null==t?void 0:t[pi])===e}function ml(t={},e,n,i){return os((()=>{var i,r;return ss((()=>{i=r,r=[],Xs((()=>{t!==n(...r)&&(e(t,...r),i&&pl(n(...i),t)&&e(null,...i))}))})),()=>{Ji((()=>{r&&pl(n(...r),t)&&e(null,...r)}))}})),t}let vl=!1;function gl(t,e,n,i){var r,o,s=!!(n&bn),a=!!(n&kn),l=i,c=!0,u=()=>(c&&(c=!1,l=a?Xs(i):i),l);if(s){var d,h,f=pi in t||mi in t;r=null!==(d=null===(h=Rn(t,e))||void 0===h?void 0:h.set)&&void 0!==d?d:f&&e in t?n=>t[e]=n:void 0}var p,m=!1;if(s?[o,m]=function(t){var e=vl;try{return vl=!1,[t(),vl]}finally{vl=e}}((()=>t[e])):o=t[e],void 0===o&&void 0!==i&&(o=u(),r&&(!function(t){{const e=new Error(`props_invalid_value\nCannot do \`bind:${t}={undefined}\` when \`${t}\` has a fallback value\nhttps://svelte.dev/e/props_invalid_value`);throw e.name="Svelte error",e}}(e),r(o))),p=()=>{var n=t[e];return void 0===n?u():(c=!0,n)},!(n&yn))return p;if(r){var v=t.$$legacy;return function(t,e){return arguments.length>0?((!e||v||m)&&r(e?p():t),t):p()}}var g=!1,y=(n&gn?ho:mo)((()=>(g=!1,p())));y.label=e,s&&Gs(y);var b=Ss;return function(t,e){if(arguments.length>0){const n=e?Gs(y):s?Oo(t):t;return So(y,n),g=!0,void 0!==l&&(l=n),t}return ws&&g||b.f&ni?y.v:Gs(y)}}var yl,bl,kl,xl;"undefined"!=typeof window&&(null!==(bl=(yl=null!==(xl=(kl=window).__svelte)&&void 0!==xl?xl:kl.__svelte={}).v)&&void 0!==bl?bl:yl.v=new Set).add("5");function wl(t,{include:e,exclude:n}={}){const i=t=>{const i=e=>"string"==typeof e?t===e:e.test(t);return e?e.some(i):!n||!n.some(i)};for(const[e,n]of(t=>{const e=new Set;do{for(const n of Reflect.ownKeys(t))e.add([t,n])}while((t=Reflect.getPrototypeOf(t))&&t!==Object.prototype);return e})(t.constructor.prototype)){if("constructor"===n||!i(n))continue;const r=Reflect.getOwnPropertyDescriptor(e,n);r&&"function"==typeof r.value&&(t[n]=t[n].bind(t))}return t}function _l(t,e){t.getNodesAtTime(0)[0].once("nodestart",e)}class Il{constructor({position:t,gallery:e,config:n}){this.config=n,this.position=t,this.gallery=e,this.name=n.name;const{variantId:i,itemIndex:r,moduleIndex:o}=t;this.id=`${n.itemType}_${i}_${r}_${o}`,wl(this)}#a=Bi(To(Oo({})),"BaseModule.#state");#l=Bi(To(null),"BaseModule.#cover");#c=Bi(To(!1),"BaseModule.#showCover");#u=Bi(To(null),"BaseModule.#Component");id;player;position;config;timeline;moduleEndListener;hasDuration=!1;coverAssets=[];get state(){return Gs(this.#a)}set state(t){So(this.#a,t,!0)}get cover(){return Gs(this.#l)}set cover(t){So(this.#l,t)}get showCover(){return Gs(this.#c)}set showCover(t){So(this.#c,t,!0)}get Component(){return Gs(this.#u)}set Component(t){So(this.#u,t)}emitModuleEnd(){var t;null===(t=this.moduleEndListener)||void 0===t||t.call(this)}start(t){this.player=t}setPosition(){this.gallery.state.playingModulePosition=this.position}play(){this.gallery.track("moduleview"),this.timeline?(_l(this.timeline,(()=>{this.setPosition()})),this.player.switchTimeline(this.timeline)):this.setPosition()}get duration(){return this.hasDuration&&this.timeline?this.timeline.placements.reduce(((t,e)=>t+this.player.getNode(e.nodeId).duration),0):0}}const Tl="cmaf:";function El(t,e,n){var i,r,o;const s=(null==e||null===(i=e.entity)||void 0===i?void 0:i.entityId)||(null==e?void 0:e.assetId),a=null!==(r=null==e||null===(o=e.entity)||void 0===o?void 0:o.entityRevision)&&void 0!==r?r:null==e?void 0:e.assetRevision,l=function(t){return t&&t.find((t=>t.startsWith(Tl)))?t.filter((t=>t.startsWith(Tl))):t}(null==e?void 0:e.availableEncodeProfiles);return n.addNode({id:t,manifestRef:{type:"assets-delivery-service",assetId:s,assetRevision:a,availableEncodeProfiles:l}})}function Sl(t){const e=t-1;return e*e*e+1}var Ml=!1;function Al(t,{delay:e=0,duration:n=400,easing:i=Sl,axis:r="y"}={}){const o=getComputedStyle(t);var s;!Ml&&/(contents|inline|table)/.test(o.display)&&(Ml=!0,Promise.resolve().then((()=>Ml=!1)),s=o.display,console.warn(`%c[svelte] transition_slide_display\n%cThe \`slide\` transition does not work correctly for elements with \`display: ${s}\`\nhttps://svelte.dev/e/transition_slide_display`,wi,_i));const a=+o.opacity,l="y"===r?"height":"width",c=parseFloat(o[l]),u="y"===r?["top","bottom"]:["left","right"],d=u.map((t=>`${t[0].toUpperCase()}${t.slice(1)}`)),h=parseFloat(o[`padding${d[0]}`]),f=parseFloat(o[`padding${d[1]}`]),p=parseFloat(o[`margin${d[0]}`]),m=parseFloat(o[`margin${d[1]}`]),v=parseFloat(o[`border${d[0]}Width`]),g=parseFloat(o[`border${d[1]}Width`]);return{delay:e,duration:n,easing:i,css:t=>`overflow: hidden;opacity: ${Math.min(20*t,1)*a};${l}: ${t*c}px;padding-${u[0]}: ${t*h}px;padding-${u[1]}: ${t*f}px;margin-${u[0]}: ${t*p}px;margin-${u[1]}: ${t*m}px;border-${u[0]}-width: ${t*v}px;border-${u[1]}-width: ${t*g}px;min-${l}: 0`}}function Nl(t){const e=t-1;return e*e*e+1}var Fl=oa('<h3 class="text-box-title desktop-title svelte-wejicf"> </h3>'),Cl=oa('<h3 class="text-box-title svelte-wejicf"> </h3>'),Ol=oa('<div class="expanded-text-content svelte-wejicf"><!> <p class="text-box-description svelte-wejicf"> </p></div>'),Pl=oa('<span class="text-box-title svelte-wejicf"> </span>'),Rl=oa('<span class="text-box-description minimized-description svelte-wejicf"> </span>'),Dl=oa('<span class="read-more-cta svelte-wejicf" aria-hidden="true">Read more</span>'),Bl=oa('<button class="expand-description-button svelte-wejicf" aria-expanded="false" aria-controls="expanded-text-content" aria-label="Expand feature description"><!> <!></button>'),Ll=oa('<button class="collapse-description-button svelte-wejicf" aria-expanded="true" aria-label="Collapse feature description" data-elementid="textbox-expand" data-elementtype="textbox" data-elementname="Read less" data-interactiontype="module-ui">Read less</button>'),zl=oa('<section aria-label="Feature description" aria-live="polite"><div class="text-wrapper svelte-wejicf"><!> <!> <!></div> <!></section>');const Wl={hash:"svelte-wejicf",code:".eko-gallery-app {--textBox_bg: linear-gradient(\n rgba(255, 255, 255, 0) 0%,\n rgba(255, 255, 255, 0.9) 27.79%,\n rgba(255, 255, 255, 0.95) 100%\n );--textBox_border: 0;--textBox_borderRadius: 0;--textBox_maxWidth: 100%;--textBox_margin: 0;--textBox_padding: 16px 16px 64px 16px;--textBox_padding_mobile: 8px 16px;--textBox_gap: 8px;--textBox_expandedContent_gap: 8px;--textBox_expandButton_gap: 6px;--textBox_button_color: #014FD3;--textBox_button_fontSize: 12px;--textBox_button_fontWeight: 500;--textBox_button_lineHeight: 18px;--textBox_button_lineHeight_mobile: 12px;--textBox_button_letterSpacing: 0;--textBox_collapse_marginBottom: 8px;}.step-description-container.svelte-wejicf {width:100%;max-width:var(--textBox_maxWidth);margin:var(--textBox_margin);position:absolute;bottom:0;display:flex;justify-content:space-between;gap:var(--textBox_gap);box-sizing:border-box;padding:var(--textBox_padding);font-family:var(--textBox_fontFamily, var(--fontName));font-size:var(--textBox_fontSize, 12px);font-weight:var(--textBox_fontWeight, 400);font-style:var(--textBox_fontStyle, normal);line-height:var(--textBox_lineHeight, 18px);letter-spacing:var(--textBox_letterSpacing, 0);color:var(--textBox_color, #030303);overflow:hidden;pointer-events:none;background:var(--textBox_bg);border:var(--textBox_border);border-radius:var(--textBox_borderRadius);}.step-description-container.mobile.svelte-wejicf {padding:var(--textBox_padding_mobile);line-height:var(--textBox_lineHeight_mobile, 16px);}.step-description-container.expanded.svelte-wejicf {flex-direction:column;justify-content:flex-start;gap:0;}.expanded-text-content.svelte-wejicf:not([hidden]) {display:flex;flex-direction:column;gap:var(--textBox_expandedContent_gap);}button.svelte-wejicf {background:none;border:none;padding:0;cursor:pointer;font-family:var(--textBox_fontFamily, var(--fontName));font-size:var(--textBox_button_fontSize, 12px);font-weight:var(--textBox_button_fontWeight, 500);line-height:var(--textBox_button_lineHeight, 18px);letter-spacing:var(--textBox_button_letterSpacing, 0);color:var(--textBox_button_color, #014FD3);gap:var(--textBox_expandButton_gap, 6px);flex-shrink:0;text-align:left;pointer-events:auto;}.step-description-container.mobile.svelte-wejicf button:where(.svelte-wejicf) {line-height:var(--textBox_button_lineHeight_mobile);}.collapse-description-button.svelte-wejicf {margin-top:var(--textBox_gap);margin-bottom:var(--textBox_collapse_marginBottom);}.step-description-container.mobile.svelte-wejicf .collapse-description-button:where(.svelte-wejicf) {margin-bottom:0;}.text-wrapper.svelte-wejicf {width:100%;display:flex;flex-direction:column;}.text-box-title.svelte-wejicf {margin:0;font-family:var(--textBox_title_fontFamily, var(--textBox_fontFamily, var(--fontName)));font-size:var(--textBox_title_fontSize, var(--textBox_fontSize, 12px));font-weight:var(--textBox_title_fontWeight, 500);color:var(--textBox_title_color, var(--textBox_color, #030303));}.text-box-title.desktop-title.svelte-wejicf {display:var(--textBox_desktop_title_display, none);margin-bottom:var(--textBox_expandedContent_gap);}.text-box-description.svelte-wejicf {margin:0;font-family:var(--textBox_description_fontFamily, var(--textBox_fontFamily, var(--fontName)));font-size:var(--textBox_description_fontSize, var(--textBox_fontSize, 12px));font-weight:var(--textBox_description_fontWeight, var(--textBox_fontWeight, 400));color:var(--textBox_description_color, var(--textBox_color, #030303));text-align:var(--textBox_description_textAlign, left);}.minimized-description.svelte-wejicf {overflow:hidden;line-clamp:1;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;font-weight:var(--textBox_description_fontWeight, var(--textBox_fontWeight, 400));}.expand-description-button.svelte-wejicf {width:100%;display:flex;justify-content:space-between;gap:var(--textBox_expandButton_gap);flex-wrap:nowrap;}.expand-description-button.svelte-wejicf .read-more-cta:where(.svelte-wejicf) {color:var(--textBox_button_color, #014FD3);flex-shrink:0;}"};function jl(t,e){Hi(e,!0),Ua(t,Wl);let n=gl(e,"textBox",3,null),i=gl(e,"isMobile",3,!1);const r={duration:300,easing:Nl};let o=To(!1),s=To(null),a=To(null),l=To(!1),c=To(!1),u=po((()=>{var t;return(null===(t=n())||void 0===t?void 0:t.title)||""})),d=po((()=>{var t;return(null===(t=n())||void 0===t?void 0:t.description)||""})),h=po((()=>{var t,e;return[(null===(t=n())||void 0===t?void 0:t.textColor)&&`--textBox_textColor: ${n().textColor}`,(null===(e=n())||void 0===e?void 0:e.bgColor)&&`--textBox_bgColor: ${n().bgColor}`].filter(Boolean).join("; ")}));function f(){Gs(s)&&So(l,Gs(s).scrollWidth>Gs(s).clientWidth||Gs(s).scrollHeight>Gs(s).clientHeight,!0)}is((()=>{var t;Gs(s)&&(f(),"undefined"!=typeof document&&null!==(t=document.fonts)&&void 0!==t&&t.ready&&document.fonts.ready.then(f))})),is((()=>{if(Gs(a)){const t=getComputedStyle(Gs(a)).getPropertyValue("--textBox_forceCollapse").trim();So(c,"1"===t||"true"===t,!0)}}));var p=la();Zs("resize",Lo,f);var m=Ho(p),v=t=>{var n=zl();let f;var p=Go(n),m=Go(p),v=t=>{var e=Fl(),n=Go(e,!0);Fi(e),as((()=>ga(n,Gs(u)))),ca(t,e)};Ma(m,(t=>{Gs(u)&&!i()&&t(v)}));var g=Ko(m,2),y=t=>{var e=Ol(),n=Go(e),o=t=>{var e=Cl(),n=Go(e,!0);Fi(e),as((()=>ga(n,Gs(u)))),ca(t,e)};Ma(n,(t=>{Gs(u)&&i()&&t(o)}));var s=Ko(n,2),a=Go(s,!0);Fi(s),Fi(e),as((()=>ga(a,Gs(d)))),ja(3,e,(()=>Al),(()=>r)),ca(t,e)};Ma(g,(t=>{Gs(o)&&t(y)}));var b=Ko(g,2),k=t=>{var n=Bl(),a=po((()=>e.gallery.interaction((()=>So(o,!0)),{elementid:"textbox-expand",elementtype:"textbox",elementname:"Read more",interactiontype:"module-ui"})));n.__click=function(...t){var e;null===(e=Gs(a))||void 0===e||e.apply(this,t)};var h=Go(n),f=t=>{var e=Pl(),n=Go(e,!0);Fi(e),as((()=>ga(n,Gs(u)))),ca(t,e)},p=t=>{var e=Rl(),n=Go(e,!0);Fi(e),ml(e,(t=>So(s,t)),(()=>Gs(s))),as((()=>ga(n,Gs(d)))),ca(t,e)};Ma(h,(t=>{i()&&Gs(u)?t(f):t(p,!1)}));var m=Ko(h,2),v=t=>{ca(t,Dl())};Ma(m,(t=>{(i()||Gs(l)||Gs(c))&&t(v)})),Fi(n),ja(3,n,(()=>Al),(()=>r)),ca(t,n)};Ma(b,(t=>{Gs(o)||t(k)})),Fi(p);var x=Ko(p,2),w=t=>{var n=Ll(),i=po((()=>e.gallery.interaction((()=>So(o,!1)))));n.__click=function(...t){var e;null===(e=Gs(i))||void 0===e||e.apply(this,t)},ja(3,n,(()=>Al),(()=>r)),ca(t,n)};Ma(x,(t=>{Gs(o)&&t(w)})),Fi(n),ml(n,(t=>So(a,t)),(()=>Gs(a))),as((()=>{f=Ya(n,1,"step-description-container svelte-wejicf",null,f,{mobile:i(),expanded:Gs(o)}),Ja(n,Gs(h))})),ca(t,n)};Ma(m,(t=>{(Gs(u)||Gs(d))&&t(v)})),ca(t,p),Ki()}function $l(t,e){const n=po((()=>e.state.textBox));jl(t,{get textBox(){return Gs(n)},get isMobile(){return e.isMobile},get gallery(){return e.gallery}})}ta(["click"]);const Ul=new Set;function ql(t){if("undefined"!=typeof window)for(const e of t)if(!Ul.has(e)){const t=new Image;t.src=e,window[e]=t,Ul.add(e)}}var Vl=new WeakSet;class Gl extends Il{constructor({config:t,...e}){super({...e,config:t}),$(this,Vl),this.synced=t.sync,this.startOnLoop=t.startOnLoop,this.switchTo=()=>{},wl(this);const n=t[this.constructor.itemsKey];this.coverAssets=n.flatMap((t=>[t.intro,t.video])).filter(Boolean),this.itemsCovers=n.map((t=>({intro:t.intro||t.video,loop:t.video}))),this.cover=this.getCorrectCover(this.itemsCovers[0]),this.state={items:n.map((t=>this.mapItem(t))),currentIndex:0,onItemClicked:B(Vl,this,Hl).bind(this),textBox:n[0].textBox}}getCorrectCover(t){return this.synced||this.startOnLoop?t.loop:t.intro}mapItem(t){return t}start(t){super.start(t);const e=this.config[this.constructor.itemsKey],{nodePrefix:n}=this.constructor;this.synced?(this.timeline=t.createTimeline(),e.forEach(((e,i)=>{this.timeline.placeOnTimeline(El(`${this.id}_${n}_${i}`,e.video,t),0,{loop:!0})})),this.timeline.placeRenderNodeOnTimeline("switch",0,1/0,{params:{switchCrossfadeSeconds:.25,initSwitching:({switchTo:t})=>{this.switchTo=t,t(this.state.currentIndex,{crossfadeSeconds:0})}}})):(this.timelines=e.map(((e,i)=>{const r=t.createTimeline(),o=t.createTimeline(),s=El(`${this.id}_${n}_${i}`,e.video,t);return e.intro&&r.placeOnTimeline(El(`${this.id}_${n}_${i}_intro`,e.intro,t)),r.placeOnTimeline(s,"end",{loop:!0}),o.placeOnTimeline(s,0,{loop:!0}),{withIntro:r,justLoop:o}})),this.timeline=this.timelines[this.state.currentIndex][this.startOnLoop?"justLoop":"withIntro"])}play(){if(super.play(),!this.synced){ql(this.coverAssets.filter((t=>Bo(t,this.cover,!1))).map((t=>this.gallery.getCoverUrl(t,1920))))}}}function Hl(t){if(Bo(t,this.state.currentIndex))return;const e=this.config[this.constructor.itemsKey];var n,i;(this.state.currentIndex=t,this.state.textBox=e[t].textBox,this.synced)?(this.cover=this.itemsCovers[t].loop,this.switchTo(t)):(this.cover=this.itemsCovers[t].intro,this.timeline=null===(n=this.timelines)||void 0===n?void 0:n[t].withIntro,this.showCover=!0,_l(this.timeline,(()=>{var e;(this.showCover=!1,this.startOnLoop)&&(this.cover=this.itemsCovers[t].loop,this.timeline=null===(e=this.timelines)||void 0===e?void 0:e[t].justLoop)})),null===(i=this.player)||void 0===i||i.switchTimeline(this.timeline))}U(Gl,"itemsKey","items"),U(Gl,"nodePrefix","item");var Kl=oa('<div class="toggle-option-container svelte-16pmvvn"><button data-elementtype="toggle" data-interactiontype="module-ui"> </button></div>'),Xl=oa('<div class="toggle-container svelte-16pmvvn"><div></div></div> <!>',1);const Yl={hash:"svelte-16pmvvn",code:".eko-gallery-app {--toggleModule_gap: 8px;--toggleModule_padding: 10px 58px 0 0;--toggleModule_alignItems: center;--toggleModule_justifyContent: end;--toggleModule_options_padding: 0;--toggleModule_options_height: auto;--toggleModule_options_width: 100%;--toggleModule_options_maxWidth: 100%;--toggleModule_options_gap: 8px;--toggleModule_options_bgColor: transparent;--toggleModule_options_border: 0;--toggleModule_options_borderRadius: 0;--toggleModule_options_boxShadow: none;--toggleModule_options_alignItems: stretch;--toggleModule_button_padding: 8px 12px;--toggleModule_button_border: #E4E5E8 solid 1px;--toggleModule_button_borderRadius: 100px;--toggleModule_button_bgColor: #FBFBFB;--toggleModule_button_bgColor_hover: #F3F4F6;--toggleModule_button_bgColor_active: #E4E5E8;--toggleModule_button_boxShadow: 0px 2px 8px 2px rgba(0, 0, 0, 0.07);--toggleModule_button_text_fontFamily: var(--fontName);--toggleModule_button_text_fontSize: 12px;--toggleModule_button_text_fontWeight: 400;--toggleModule_button_text_fontStyle: normal;--toggleModule_button_text_lineHeight: 16px;--toggleModule_button_text_letterSpacing: -0.2px;--toggleModule_button_text_color: #000;--toggleModule_button_selected_bgColor: #014FD3;--toggleModule_button_selected_borderColor: #014FD3;--toggleModule_button_selected_boxShadow: none;--toggleModule_button_selected_text_color: #FFFFFF;--toggleModule_button_selected_text_fontWeight: var(--toggleModule_button_text_fontWeight);--toggleModule_title_fontFamily: var(--fontName);--toggleModule_title_fontSize: 13px;--toggleModule_title_fontWeight: 400;--toggleModule_title_fontStyle: normal;--toggleModule_title_lineHeight: 120%;--toggleModule_title_letterSpacing: 0;--toggleModule_title_color: #666;--toggleModule_title_textAlignment: center;--toggleModule_note_fontFamily: var(--fontName);--toggleModule_note_fontSize: 12px;--toggleModule_note_fontWeight: 400;--toggleModule_note_fontStyle: normal;--toggleModule_note_lineHeight: 120%;--toggleModule_note_letterSpacing: 0;--toggleModule_note_color: #888;--toggleModule_note_topMargin: 4px;}.toggle-container.svelte-16pmvvn {position:absolute;top:0;padding:var(--toggleModule_padding);width:100%;display:flex;flex-direction:column;align-items:var(--toggleModule_alignItems);gap:var(--toggleModule_gap);pointer-events:auto;box-sizing:border-box;}.toggle-options.svelte-16pmvvn {width:var(--toggleModule_options_width);max-width:var(--toggleModule_options_maxWidth);height:var(--toggleModule_options_height);padding:var(--toggleModule_options_padding);gap:var(--toggleModule_options_gap);background-color:var(--toggleModule_options_bgColor);border:var(--toggleModule_options_border);border-radius:var(--toggleModule_options_borderRadius);box-shadow:var(--toggleModule_options_boxShadow);display:flex;justify-content:var(--toggleModule_justifyContent);align-items:var(--toggleModule_options_alignItems);margin:0;}.toggle-option-container.svelte-16pmvvn {position:relative;min-width:0;}.toggle-option-button.svelte-16pmvvn {border-radius:var(--toggleModule_button_borderRadius);font-family:var(--toggleModule_button_text_fontFamily);font-size:var(--toggleModule_button_text_fontSize);font-weight:var(--toggleModule_button_text_fontWeight);font-style:var(--toggleModule_button_text_fontStyle);line-height:var(--toggleModule_button_text_lineHeight);letter-spacing:var(--toggleModule_button_text_letterSpacing);color:var(--toggleModule_button_text_color);padding:var(--toggleModule_button_padding);border:var(--toggleModule_button_border);background:var(--toggleModule_button_bgColor);box-shadow:var(--toggleModule_button_boxShadow);display:flex;width:100%;height:100%;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;cursor:pointer;position:relative;transition:all 0.3s ease-in-out;animation-duration:0.5s;animation-timing-function:cubic-bezier(0.36, 0, 0, 1);animation-fill-mode:both;animation-delay:calc(var(--button-index) * 90ms);\n animation-name: svelte-16pmvvn-button-back-appear-anim;transform-origin:bottom center;}.toggle-option-button.selected.svelte-16pmvvn {background:var(--toggleModule_button_selected_bgColor);border-color:var(--toggleModule_button_selected_borderColor);box-shadow:var(--toggleModule_button_selected_boxShadow);color:var(--toggleModule_button_selected_text_color);font-weight:var(--toggleModule_button_selected_text_fontWeight);}.toggle-option-button.svelte-16pmvvn:hover:not(.selected) {background:var(--toggleModule_button_bgColor_hover);}.toggle-option-button.svelte-16pmvvn:active:not(.selected) {background:var(--toggleModule_button_bgColor_active);}.toggle-option-button.svelte-16pmvvn:focus {outline-offset:4px;outline-width:2px;}\n\n@keyframes svelte-16pmvvn-button-back-appear-anim {\n from {\n transform: scale(0);\n }\n to {\n transform: scale(1);\n }\n}\n@keyframes svelte-16pmvvn-optionNoteIn {\n 0% {\n opacity: 0;\n translate: -50% -5px;\n }\n 100% {\n opacity: 1;\n translate: -50% var(--toggleModule_note_topMargin);\n }\n}"};function Ql(t,e){Hi(e,!0),Ua(t,Yl);const n=po((()=>e.state.items)),i=po((()=>e.state.currentIndex)),r=po((()=>e.state.onItemClicked)),o=po((()=>e.state.textBox));var s=Xl(),a=Ho(s),l=Go(a);Fa(l,21,(()=>Gs(n)),Aa,((t,n,o)=>{var s=Kl();Ja(s,`--button-index: ${o};`);var a=Go(s);let l;var c=po((()=>e.gallery.interaction((()=>Gs(r)(o)))));a.__click=function(...t){var e;null===(e=Gs(c))||void 0===e||e.apply(this,t)},al(a,"data-elementid",`${o+1}`);var u=Go(a,!0);Fi(a),Fi(s),as((()=>{l=Ya(a,1,"toggle-option-button svelte-16pmvvn",null,l,{selected:Gs(i)===o}),al(a,"data-elementname",Gs(n).label),ga(u,Gs(n).label)})),ca(t,s)})),Fi(l),Fi(a);var c=Ko(a,2),u=t=>{jl(t,{get textBox(){return Gs(o)},get isMobile(){return e.isMobile},get gallery(){return e.gallery}})};Ma(c,(t=>{Gs(o)&&t(u)})),as((()=>{var t;return Ya(l,1,`toggle-options selected-${null!==(t=Gs(i))&&void 0!==t?t:""}`,"svelte-16pmvvn")})),ca(t,s),Ki()}ta(["click"]);var Jl=oa('<div class="mode-title svelte-1650wj7"> </div>'),Zl=oa('<div class="mode-description svelte-1650wj7"> </div>'),tc=oa('<button data-elementtype="mode" data-interactiontype="module-ui"><img class="svelte-1650wj7"/> <div class="svelte-1650wj7"><!> <!></div></button>'),ec=oa('<div class="modes-container svelte-1650wj7"></div> <!>',1);const nc={hash:"svelte-1650wj7",code:".eko-gallery-app {--modesModule_gap: 16px;--modesModule_width: 100%;--modesModule_top: unset;--modesModule_left: 0;--modesModule_right: unset;--modesModule_bottom: 0;--modesModule_flexDirection: row;--modesModule_alignItems: flex-start;--modesModule_justifyContent: center;--modesModule_padding: 0 0 32px 0;--modesModule_paddingWithSteps: 0 0 48px 0;--modesModule_paddingWithTextBox: 28px 0 0 0;--modesModule_background: none;--modesModule_border: none;--modesModule_borderRadius: 0;--modesModule_transform: none;--modesModule_mode_width: 64px;--modesModule_mode_titleGap: 6px;--modesModule_mode_title_fontFamily: var(--fontName);--modesModule_mode_title_fontSize: 12px;--modesModule_mode_title_fontWeight: 500;--modesModule_mode_title_lineHeight: 120%;--modesModule_mode_title_letterSpacing: -0.2px;--modesModule_mode_title_textAlign: center;--modesModule_mode_description_fontFamily: var(--fontName);--modesModule_mode_description_fontSize: 11px;--modesModule_mode_description_fontWeight: 400;--modesModule_mode_description_lineHeight: 120%;--modesModule_mode_description_letterSpacing: -0.2px;--modesModule_mode_description_textAlign: center;--modesModule_mode_image_strokeSize: 2px;}.modes-container.svelte-1650wj7 {position:absolute;top:var(--modesModule_top);left:var(--modesModule_left);right:var(--modesModule_right);bottom:var(--modesModule_bottom);width:var(--modesModule_width);display:flex;flex-direction:var(--modesModule_flexDirection);align-items:var(--modesModule_alignItems);justify-content:var(--modesModule_justifyContent);gap:var(--modesModule_gap);flex-wrap:wrap;padding:var(--modesModule_padding);background:var(--modesModule_background);border:var(--modesModule_border);border-radius:var(--modesModule_borderRadius);transform:var(--modesModule_transform);}.mode-button.svelte-1650wj7 {display:flex;flex-direction:column;align-items:center;width:var(--modesModule_mode_width);background:none;border:none;padding:0;pointer-events:auto;cursor:pointer;color:rgba(var(--unselectedColor, 111, 111, 111), 1);gap:var(--modesModule_mode_titleGap);flex-shrink:0;}.mode-button.svelte-1650wj7 .mode-title:where(.svelte-1650wj7) {font-family:var(--modesModule_mode_title_fontFamily);font-size:var(--modesModule_mode_title_fontSize);font-weight:var(--modesModule_mode_title_fontWeight);line-height:var(--modesModule_mode_title_lineHeight);letter-spacing:var(--modesModule_mode_title_letterSpacing);text-align:var(--modesModule_mode_title_textAlign);}.mode-button.svelte-1650wj7 .mode-description:where(.svelte-1650wj7) {font-family:var(--modesModule_mode_description_fontFamily);font-size:var(--modesModule_mode_description_fontSize);font-weight:var(--modesModule_mode_description_fontWeight);line-height:var(--modesModule_mode_description_lineHeight);letter-spacing:var(--modesModule_mode_description_letterSpacing);text-align:var(--modesModule_mode_description_textAlign);}.mode-button.svelte-1650wj7 div:where(.svelte-1650wj7) {width:100%;}.mode-button.svelte-1650wj7 img:where(.svelte-1650wj7) {width:100%;aspect-ratio:1;object-fit:cover;border-radius:100%;box-shadow:0 0 0 var(--modesModule_mode_image_strokeSize) rgba(var(--unselectedColor, 111, 111, 111), 0.15);background-color:rgba(var(--unselectedColor, 111, 111, 111), 0.15);pointer-events:none;}.mode-button.selected.svelte-1650wj7 {color:var(--selectedColor, #000000);}.mode-button.selected.svelte-1650wj7 img:where(.svelte-1650wj7) {background-color:var(--selectedColor, #000000);box-shadow:0 0 0 var(--modesModule_mode_image_strokeSize) var(--selectedColor, #000000);}"};function ic(t,e){Hi(e,!0),Ua(t,nc);const n=po((()=>e.state.items)),i=po((()=>e.state.currentIndex)),r=po((()=>e.state.onItemClicked)),o=po((()=>e.state.textBox));var s=ec(),a=Ho(s);Fa(a,21,(()=>Gs(n)),Aa,((t,n,o)=>{var s=tc();let a;var l=po((()=>e.gallery.interaction((()=>Gs(r)(o)))));s.__click=function(...t){var e;null===(e=Gs(l))||void 0===e||e.apply(this,t)},al(s,"data-elementid",`${o+1}`);var c=Go(s);al(c,"alt",`Mode ${o+1}`);var u=Ko(c,2),d=Go(u),h=t=>{var e=Jl(),i=Go(e,!0);Fi(e),as((()=>ga(i,Gs(n).title))),ca(t,e)};Ma(d,(t=>{Gs(n).title&&t(h)}));var f=Ko(d,2),p=t=>{var e=Zl(),i=Go(e,!0);Fi(e),as((()=>ga(i,Gs(n).description))),ca(t,e)};Ma(f,(t=>{Gs(n).description&&t(p)})),Fi(u),Fi(s),as((t=>{a=Ya(s,1,"mode-button svelte-1650wj7",null,a,{selected:Gs(i)===o}),al(s,"data-elementname",Gs(n).title||`mode-${o+1}`),al(c,"src",t)}),[()=>e.gallery.getCoverUrl(Gs(n).image,375)]),ca(t,s)})),Fi(a);var l=Ko(a,2),c=t=>{jl(t,{get textBox(){return Gs(o)},get isMobile(){return e.isMobile},get gallery(){return e.gallery}})};Ma(l,(t=>{Gs(o)&&t(c)})),ca(t,s),Ki()}ta(["click"]);const rc=(t,e,n)=>n>e?e:n<t?t:n;function oc(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let sc=()=>{},ac=()=>{};function lc(t){let e;return()=>(void 0===e&&(e=t()),e)}"undefined"!=typeof process&&"production"!==(null===(fe=process.env)||void 0===fe?void 0:fe.NODE_ENV)&&(sc=(t,e,n)=>{t||"undefined"==typeof console||console.warn(oc(e,n))},ac=(t,e,n)=>{if(!t)throw new Error(oc(e,n))});const cc=t=>t,uc=t=>1e3*t,dc=t=>t/1e3;const hc=t=>Array.isArray(t)&&"number"==typeof t[0],fc=(t,e,n=10)=>{let i="";const r=Math.max(Math.round(e/n),2);for(let e=0;e<r;e++)i+=Math.round(1e4*t(e/(r-1)))/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},pc=2e4;function mc(t){let e=0;let n=t.next(e);for(;!n.done&&e<pc;)e+=50,n=t.next(e);return e>=pc?1/0:e}const vc=5;const gc={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},yc=.001;function bc({duration:t=gc.duration,bounce:e=gc.bounce,velocity:n=gc.velocity,mass:i=gc.mass}){let r,o;sc(t<=uc(gc.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let s=1-e;s=rc(gc.minDamping,gc.maxDamping,s),t=rc(gc.minDuration,gc.maxDuration,dc(t)),s<1?(r=e=>{const i=e*s,r=i*t,o=i-n,a=xc(e,s),l=Math.exp(-r);return yc-o/a*l},o=e=>{const i=e*s*t,o=i*n+n,a=Math.pow(s,2)*Math.pow(e,2)*t,l=Math.exp(-i),c=xc(Math.pow(e,2),s);return(-r(e)+yc>0?-1:1)*((o-a)*l)/c}):(r=e=>Math.exp(-e*t)*((e-n)*t+1)-yc,o=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let i=n;for(let n=1;n<kc;n++)i-=t(i)/e(i);return i}(r,o,5/t);if(t=uc(t),isNaN(a))return{stiffness:gc.stiffness,damping:gc.damping,duration:t};{const e=Math.pow(a,2)*i;return{stiffness:e,damping:2*s*Math.sqrt(i*e),duration:t}}}const kc=12;function xc(t,e){return t*Math.sqrt(1-e*e)}const wc=["duration","bounce"],_c=["stiffness","damping","mass"];function Ic(t,e){return e.some((e=>void 0!==t[e]))}function Tc(t=gc.visualDuration,e=gc.bounce){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:i,restDelta:r}=n;const o=n.keyframes[0],s=n.keyframes[n.keyframes.length-1],a={done:!1,value:o},{stiffness:l,damping:c,mass:u,duration:d,velocity:h,isResolvedFromDuration:f}=function(t){let e={velocity:gc.velocity,stiffness:gc.stiffness,damping:gc.damping,mass:gc.mass,isResolvedFromDuration:!1,...t};if(!Ic(t,_c)&&Ic(t,wc))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(1.2*n),r=i*i,o=2*rc(.05,1,1-(t.bounce||0))*Math.sqrt(r);e={...e,mass:gc.mass,stiffness:r,damping:o}}else{const n=bc(t);e={...e,...n,mass:gc.mass},e.isResolvedFromDuration=!0}return e}({...n,velocity:-dc(n.velocity||0)}),p=h||0,m=c/(2*Math.sqrt(l*u)),v=s-o,g=dc(Math.sqrt(l/u)),y=Math.abs(v)<5;let b;if(i||(i=y?gc.restSpeed.granular:gc.restSpeed.default),r||(r=y?gc.restDelta.granular:gc.restDelta.default),m<1){const t=xc(g,m);b=e=>{const n=Math.exp(-m*g*e);return s-n*((p+m*g*v)/t*Math.sin(t*e)+v*Math.cos(t*e))}}else if(1===m)b=t=>s-Math.exp(-g*t)*(v+(p+g*v)*t);else{const t=g*Math.sqrt(m*m-1);b=e=>{const n=Math.exp(-m*g*e),i=Math.min(t*e,300);return s-n*((p+m*g*v)*Math.sinh(i)+t*v*Math.cosh(i))/t}}const k={calculatedDuration:f&&d||null,next:t=>{const e=b(t);if(f)a.done=t>=d;else{let n=0===t?p:0;m<1&&(n=0===t?uc(p):function(t,e,n){const i=Math.max(e-vc,0);return r=n-t(i),(o=e-i)?r*(1e3/o):0;var r,o}(b,t,e));const o=Math.abs(n)<=i,l=Math.abs(s-e)<=r;a.done=o&&l}return a.value=a.done?s:e,a},toString:()=>{const t=Math.min(mc(k),pc),e=fc((e=>k.next(t*e).value),t,30);return t+"ms "+e},toTransition:()=>{}};return k}Tc.applyToOptions=t=>{const e=function(t,e=100,n){const i=n({...t,keyframes:[0,e]}),r=Math.min(mc(i),pc);return{type:"keyframes",ease:t=>i.next(r*t).value/e,duration:dc(r)}}(t,100,Tc);return t.ease=e.ease,t.duration=uc(e.duration),t.type="keyframes",t};const Ec=t=>null!==t;class Sc{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise((t=>{this.resolve=t}))}notifyFinished(){this.resolve()}then(t,e){return this.finished.then(t,e)}}function Mc(t){for(let n=1;n<t.length;n++){var e;null!==(e=t[n])&&void 0!==e||(t[n]=t[n-1])}}const Ac=t=>t.startsWith("--");const Nc=lc((()=>void 0!==window.ScrollTimeline)),Fc={};function Cc(t,e){const n=lc(t);return()=>{var t;return null!==(t=Fc[e])&&void 0!==t?t:n()}}const Oc=Cc((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing"),Pc=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,Rc={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Pc([0,.65,.55,1]),circOut:Pc([.55,0,1,.45]),backIn:Pc([.31,.01,.66,-.59]),backOut:Pc([.33,1.53,.69,.99])};function Dc(t,e){return t?"function"==typeof t?Oc()?fc(t,e):"ease-out":hc(t)?Pc(t):Array.isArray(t)?t.map((t=>Dc(t,e)||Rc.easeOut)):Rc[t]:void 0}function Bc(t,e,n,{delay:i=0,duration:r=300,repeat:o=0,repeatType:s="loop",ease:a="easeOut",times:l}={},c=void 0){const u={[e]:n};l&&(u.offset=l);const d=Dc(a,r);Array.isArray(d)&&(u.easing=d);const h={delay:i,duration:r,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:o+1,direction:"reverse"===s?"alternate":"normal"};c&&(h.pseudoElement=c);return t.animate(u,h)}class Lc extends Sc{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:e,name:n,keyframes:i,pseudoElement:r,allowFlatten:o=!1,finalKeyframe:s,onComplete:a}=t;this.isPseudoElement=Boolean(r),this.allowFlatten=o,this.options=t,ac("string"!=typeof t.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:t,...e}){return function(t){return"function"==typeof t&&"applyToOptions"in t}(t)&&Oc()?t.applyToOptions(e):(null!==(n=e.duration)&&void 0!==n||(e.duration=300),null!==(i=e.ease)&&void 0!==i||(e.ease="easeOut"),e);var n,i}(t);this.animation=Bc(e,n,i,l,r),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!r){const t=function(t,{repeat:e,repeatType:n="loop"},i,r=1){const o=t.filter(Ec),s=r<0||e&&"loop"!==n&&e%2==1?0:o.length-1;return s&&void 0!==i?i:o[s]}(i,this.options,s,this.speed);this.updateMotionValue?this.updateMotionValue(t):function(t,e,n){Ac(e)?t.style.setProperty(e,n):t.style[e]=n}(e,n,t),this.animation.cancel()}null==a||a(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,e;null===(t=(e=this.animation).finish)||void 0===t||t.call(e)}cancel(){try{this.animation.cancel()}catch(t){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;"idle"!==t&&"finished"!==t&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,e;this.isPseudoElement||(null===(t=(e=this.animation).commitStyles)||void 0===t||t.call(e))}get duration(){var t,e;const n=(null===(t=this.animation.effect)||void 0===t||null===(e=t.getComputedTiming)||void 0===e?void 0:e.call(t).duration)||0;return dc(Number(n))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+dc(t)}get time(){return dc(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=uc(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){var t;return null!==(t=this.manualStartTime)&&void 0!==t?t:Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,observe:e}){var n;this.allowFlatten&&(null===(n=this.animation.effect)||void 0===n||n.updateTiming({easing:"linear"}));return this.animation.onfinish=null,t&&Nc()?(this.animation.timeline=t,cc):e(this)}}class zc{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map((t=>t.finished)))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t){const e=this.animations.map((e=>e.attachTimeline(t)));return()=>{e.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return Wc(this.animations,"duration")}get iterationDuration(){return Wc(this.animations,"iterationDuration")}runAll(t){this.animations.forEach((e=>e[t]()))}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function Wc(t,e){let n=0;for(let i=0;i<t.length;i++){const r=t[i][e];null!==r&&r>n&&(n=r)}return n}class jc extends zc{then(t,e){return this.finished.finally(t).then((()=>{}))}}const $c=new WeakMap,Uc=(t,e="")=>`${t}:${e}`;function qc(t){const e=$c.get(t)||new Map;return $c.set(t,e),e}function Vc(t,e){var n,i;return null!==(n=null!==(i=null==t?void 0:t[e])&&void 0!==i?i:null==t?void 0:t.default)&&void 0!==n?n:t}const Gc=new Set(["borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","width","maxWidth","height","maxHeight","top","right","bottom","left","inset","insetBlock","insetBlockStart","insetBlockEnd","insetInline","insetInlineStart","insetInlineEnd","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingBlock","paddingBlockStart","paddingBlockEnd","paddingInline","paddingInlineStart","paddingInlineEnd","margin","marginTop","marginRight","marginBottom","marginLeft","marginBlock","marginBlockStart","marginBlockEnd","marginInline","marginInlineStart","marginInlineEnd","fontSize","backgroundPositionX","backgroundPositionY"]);function Hc(t,e){for(let n=0;n<t.length;n++)"number"==typeof t[n]&&Gc.has(e)&&(t[n]=t[n]+"px")}function Kc(t,e){const n=window.getComputedStyle(t);return Ac(e)?n.getPropertyValue(e):n[e]}function Xc(t,e,n,i){if(null==t)return[];const r=function(t){if(null==t)return[];if(t instanceof EventTarget)return[t];if("string"==typeof t){const e=document.querySelectorAll(t);return e?Array.from(e):[]}return Array.from(t).filter((t=>null!=t))}(t),o=r.length;ac(Boolean(o),"No valid elements provided.","no-valid-elements");const s=[];for(let t=0;t<o;t++){const i=r[t],a={...n};"function"==typeof a.delay&&(a.delay=a.delay(t,o));for(const t in e){let n=e[t];Array.isArray(n)||(n=[n]);const r={...Vc(a,t)};r.duration&&(r.duration=uc(r.duration)),r.delay&&(r.delay=uc(r.delay));const o=qc(i),l=Uc(t,r.pseudoElement||""),c=o.get(l);c&&c.stop(),s.push({map:o,key:l,unresolvedKeyframes:n,options:{...r,element:i,name:t,allowFlatten:!a.type&&!a.ease}})}}for(let t=0;t<s.length;t++){const{unresolvedKeyframes:e,options:n}=s[t],{element:i,name:r,pseudoElement:o}=n;o||null!==e[0]||(e[0]=Kc(i,r)),Mc(e),Hc(e,r),!o&&e.length<2&&e.unshift(Kc(i,r)),n.keyframes=e}const a=[];for(let t=0;t<s.length;t++){const{map:e,key:n,options:i}=s[t],r=new Lc(i);e.set(n,r),r.finished.finally((()=>e.delete(n))),a.push(r)}return a}const Yc=(()=>function(t,e,n){return new jc(Xc(t,e,n))})();var Qc=oa('<button class="svelte-16kucsb"><div class="cta-text svelte-16kucsb"> </div></button>'),Jc=oa('<div class="tryIt-container svelte-16kucsb"><!></div>');const Zc={hash:"svelte-16kucsb",code:".eko-gallery-app {--tryItModule_justifyContent: center;--tryItModule_alignItems: flex-end;--tryItModule_padding: 16px 20px 48px 20px;--tryItModule_button_padding: 16px 32px;--tryItModule_button_textAlign: center;--tryItModule_button_borderRadius: 100px;--tryItModule_button_border: 0;--tryItModule_button_boxShadow: 0 4px 24px 2px rgba(0, 0, 0, 0.12);--tryItModule_button_background: #FFFFFF;--tryItModule_button_text_fontFamily: var(--fontName);--tryItModule_button_text_fontSize: 18px;--tryItModule_button_text_color: #222;--tryItModule_button_text_weight: 500;--tryItModule_button_text_lineHeight: 120%;--tryItModule_button_text_letterSpacing: -0.1px;}.tryIt-container.svelte-16kucsb {position:relative;padding:var(--tryItModule_padding);width:100%;height:100%;box-sizing:border-box;display:flex;justify-content:var(--tryItModule_justifyContent);align-items:var(--tryItModule_alignItems);}.tryIt-container.svelte-16kucsb button:where(.svelte-16kucsb) {position:relative;padding:var(--tryItModule_button_padding);text-align:var(--tryItModule_button_textAlign);border-radius:var(--tryItModule_button_borderRadius);border:var(--tryItModule_button_border);background:var(--tryItModule_button_background);box-shadow:var(--tryItModule_button_boxShadow);font-family:var(--tryItModule_button_text_fontFamily);font-size:var(--tryItModule_button_text_fontSize);color:var(--tryItModule_button_text_color);font-weight:var(--tryItModule_button_text_weight);line-height:var(--tryItModule_button_text_lineHeight);letter-spacing:var(--tryItModule_button_text_letterSpacing);cursor:pointer;opacity:0;}.tryIt-container.svelte-16kucsb button:where(.svelte-16kucsb) .cta-text:where(.svelte-16kucsb) {opacity:0;}"};function tu(t,e){Hi(e,!0),Ua(t,Zc);const n=po((()=>e.state.ctaText)),i=po((()=>e.state.animationConfig)),r=po((()=>e.state.showCta)),o=po((()=>e.state.onCtaClick));let s=null,a=null,l=To(!1),c=!1;function u(){c&&Yc(s,{transform:"scale(1.05)"},{type:Tc,mass:1.5,stiffness:400,damping:30})}function d(){c&&Yc(s,{transform:"scale(1)"},{type:Tc,mass:1.5,stiffness:400,damping:30})}function h(){c&&Yc(s,{transform:"scale(0.95)"},{type:Tc,mass:1,stiffness:600,damping:30})}is((()=>{const{mass:t,stiffness:e,damping:n,delay:o}=Gs(i);let u;return Gs(r)&&(u=setTimeout((async()=>{So(l,!0),u=null,Yc(s,{transform:["translateY(40px) scale(0, 0.2)","translateY(0) scale(1, 1)"],opacity:1},{type:Tc,mass:t,stiffness:e,damping:n}),await Yc(a,{transform:["translateY(20px) scale(0.8)","translateY(0) scale(1)"],opacity:1},{type:Tc,mass:t,stiffness:e,damping:n,delay:.15}),c=!0}),o)),()=>{u&&clearTimeout(u)}}));var f=Jc(),p=Go(f),m=t=>{var e=Qc();e.__mousedown=h,e.__touchstart=h,e.__click=function(...t){var e;null===(e=Gs(o))||void 0===e||e.apply(this,t)};var i=Go(e),r=Go(i,!0);Fi(i),ml(i,(t=>a=t),(()=>a)),Fi(e),ml(e,(t=>s=t),(()=>s)),as((()=>{Ja(e,"pointer-events: "+(Gs(l)?"auto":"none")),ga(r,Gs(n))})),Zs("mouseenter",e,u),Zs("mouseleave",e,d),ca(t,e)};Ma(p,(t=>{Gs(r)&&t(m)})),Fi(f),ca(t,f),Ki()}ta(["mousedown","touchstart","click"]);var eu=new WeakSet;function nu(){this.mainTimeline?this.player.switchTimeline(this.mainTimeline):this.emitModuleEnd(),this.state.showCta=!1}function iu(t,e){const n=po((()=>e.state.textBox));jl(t,{get textBox(){return Gs(n)},get isMobile(){return e.isMobile},get gallery(){return e.gallery}})}var ru=oa('<div class="ripple svelte-1jfcowt"></div>'),ou=oa('<div class="hand-anim svelte-1jfcowt" aria-hidden="true"><svg viewBox="0 0 518 658" xmlns="http://www.w3.org/2000/svg" class="svelte-1jfcowt"><path class="hand-fill svelte-1jfcowt" d="M139.234 341.909V67.9226C139.234 53.292 145.203 40.0053 154.838 30.3866C175.516 9.69329 209.234 9.70929 229.912 30.3866C239.547 40.0064 245.516 53.288 245.516 67.9226V148.699C254.536 141.662 265.854 137.454 278.13 137.454C292.745 137.454 306.048 143.443 315.666 153.058C325.302 162.693 331.27 175.979 331.27 190.61V194.146C340.291 187.11 351.609 182.901 363.885 182.901C378.499 182.901 391.802 188.891 401.421 198.505C409.785 206.87 415.38 217.984 416.728 230.333C425.785 223.146 437.238 218.844 449.623 218.844C464.254 218.844 477.541 224.833 487.175 234.448C496.795 244.083 502.779 257.369 502.779 272V412.373C502.779 438.608 503.92 455.092 498.212 481.513C493.831 501.664 487.134 519.816 479.54 537.461C462.846 576.289 432.461 604.503 395.878 622.055C367.378 635.732 335.086 642.883 302.638 643.461C270.174 644.039 237.502 638.07 208.258 625.477C169.898 608.972 137.285 581.128 118.425 541.8C105.477 514.816 90.6385 488.097 75.9878 461.753C55.6131 425.06 35.5918 389.018 20.8838 352.665C15.8316 340.165 13.6234 326.692 15.889 314.4C20.6598 288.373 45.5823 272.597 71.217 277.296C83.6806 279.598 95.4463 286.598 103.925 297.301L139.234 341.909Z"></path><path class="hand-stroke svelte-1jfcowt" d="M244.917 166V269M330.917 201V305M419.917 246V326M139.234 341.909V67.9226C139.234 53.292 145.203 40.0053 154.838 30.3866C175.516 9.69329 209.234 9.70929 229.912 30.3866C239.547 40.0064 245.516 53.288 245.516 67.9226V148.699C254.536 141.662 265.854 137.454 278.13 137.454C292.745 137.454 306.048 143.443 315.666 153.058C325.302 162.693 331.27 175.979 331.27 190.61V194.146C340.291 187.11 351.609 182.901 363.885 182.901C378.499 182.901 391.802 188.891 401.421 198.505C409.785 206.87 415.38 217.984 416.728 230.333C425.785 223.146 437.238 218.844 449.623 218.844C464.254 218.844 477.541 224.833 487.175 234.448C496.795 244.083 502.779 257.369 502.779 272V412.373C502.779 438.608 503.92 455.092 498.212 481.513C493.831 501.664 487.134 519.816 479.54 537.461C462.846 576.289 432.461 604.503 395.878 622.055C367.378 635.732 335.086 642.883 302.638 643.461C270.174 644.039 237.502 638.07 208.258 625.477C169.898 608.972 137.285 581.128 118.425 541.8C105.477 514.816 90.6385 488.097 75.9878 461.753C55.6131 425.06 35.5918 389.018 20.8838 352.665C15.8316 340.165 13.6234 326.692 15.889 314.4C20.6598 288.373 45.5823 272.597 71.217 277.296C83.6806 279.598 95.4463 286.598 103.925 297.301L139.234 341.909Z"></path></svg></div>'),su=oa('<div class="tryIt-container svelte-1jfcowt"><div class="cta-wrapper svelte-1jfcowt"><button><div class="cta-text svelte-1jfcowt"> </div> <!></button> <!></div></div>');const au={hash:"svelte-1jfcowt",code:".eko-gallery-app {--tryItModule_justifyContent: center;--tryItModule_alignItems: flex-end;--tryItModule_padding: 16px 20px 48px 20px;--tryItModule_button_padding: 16px 32px;--tryItModule_button_textAlign: center;--tryItModule_button_borderRadius: 100px;--tryItModule_button_border: 0;--tryItModule_button_boxShadow: 0 4px 24px 2px rgba(0, 0, 0, 0.12);--tryItModule_button_background: #FFFFFF;--introModule_button_text_fontFamily: var(--fontName);--introModule_button_text_fontSize: 18px;--introModule_button_text_color: #222;--introModule_button_text_weight: 500;--introModule_button_text_lineHeight: 120%;--introModule_button_text_letterSpacing: -0.1px;--introModule_ripple_color: #FFFFFF;--introModule_ripple_borderWidth: 4px;--introModule_ripple_inset_top: -42px;--introModule_ripple_inset_right: -45px;--introModule_ripple_inset_bottom: -30px;--introModule_ripple_inset_left: -57px;--introModule_hand_fill: #FFFFFF;--introModule_hand_stroke: #000000;--introModule_hand_strokeWidth: 29;--introModule_hand_boxWidth: 75px;--introModule_hand_boxHeight: 95px;--introModule_hand_svgWidth: 60px;--introModule_hand_svgHeight: 75px;--introModule_hand_top: 24px;--introModule_hand_right: -79px;}.tryIt-container.svelte-1jfcowt {position:relative;padding:var(--tryItModule_padding);width:100%;height:100%;box-sizing:border-box;display:flex;justify-content:var(--tryItModule_justifyContent);align-items:var(--tryItModule_alignItems);}.tryIt-container.svelte-1jfcowt .cta-wrapper:where(.svelte-1jfcowt) {position:relative;width:fit-content;}.tryIt-container.svelte-1jfcowt button:where(.svelte-1jfcowt) {position:relative;padding:var(--tryItModule_button_padding);text-align:var(--tryItModule_button_textAlign);border-radius:var(--tryItModule_button_borderRadius);border:var(--tryItModule_button_border);background:var(--tryItModule_button_background);box-shadow:var(--tryItModule_button_boxShadow);font-family:var(--introModule_button_text_fontFamily);font-size:var(--introModule_button_text_fontSize);color:var(--introModule_button_text_color);font-weight:var(--introModule_button_text_weight);line-height:var(--introModule_button_text_lineHeight);letter-spacing:var(--introModule_button_text_letterSpacing);cursor:pointer;opacity:0;overflow:visible;pointer-events:auto;}.tryIt-container.svelte-1jfcowt button.has-hand-anim:where(.svelte-1jfcowt) {\n animation: svelte-1jfcowt-intro-bump 2s ease-out infinite;}.tryIt-container.svelte-1jfcowt button:where(.svelte-1jfcowt) .cta-text:where(.svelte-1jfcowt) {opacity:0;}.tryIt-container.svelte-1jfcowt button:where(.svelte-1jfcowt) .ripple:where(.svelte-1jfcowt) {position:absolute;inset:0;border-radius:inherit;border:var(--introModule_ripple_borderWidth) solid var(--introModule_ripple_color);pointer-events:none;box-sizing:border-box;\n animation: svelte-1jfcowt-intro-ripple-grow 2s cubic-bezier(0.32, 0.33, 0.08, 1) infinite, svelte-1jfcowt-intro-ripple-fade 2s linear infinite;}.tryIt-container.svelte-1jfcowt .hand-anim:where(.svelte-1jfcowt) {position:absolute;top:var(--introModule_hand_top);right:var(--introModule_hand_right);width:var(--introModule_hand_boxWidth);height:var(--introModule_hand_boxHeight);pointer-events:none;transform-origin:86.4% 98%;\n animation: svelte-1jfcowt-intro-hand-tap 2s cubic-bezier(0.32, 0.33, 0.08, 1) infinite;}.tryIt-container.svelte-1jfcowt .hand-anim:where(.svelte-1jfcowt) svg:where(.svelte-1jfcowt) {width:var(--introModule_hand_svgWidth);height:var(--introModule_hand_svgHeight);display:block;}.tryIt-container.svelte-1jfcowt .hand-anim:where(.svelte-1jfcowt) .hand-fill:where(.svelte-1jfcowt) {fill:var(--introModule_hand_fill);}.tryIt-container.svelte-1jfcowt .hand-anim:where(.svelte-1jfcowt) .hand-stroke:where(.svelte-1jfcowt) {fill:none;stroke:var(--introModule_hand_stroke);stroke-width:var(--introModule_hand_strokeWidth);stroke-linecap:round;}\n\n@keyframes svelte-1jfcowt-intro-ripple-grow {\n 0% {\n inset: 0;\n }\n 60% {\n inset: var(--introModule_ripple_inset_top) var(--introModule_ripple_inset_right) var(--introModule_ripple_inset_bottom) var(--introModule_ripple_inset_left);\n }\n 100% {\n inset: var(--introModule_ripple_inset_top) var(--introModule_ripple_inset_right) var(--introModule_ripple_inset_bottom) var(--introModule_ripple_inset_left);\n }\n}\n@keyframes svelte-1jfcowt-intro-ripple-fade {\n 0% {\n opacity: 1;\n }\n 20% {\n opacity: 1;\n }\n 60% {\n opacity: 0;\n }\n 100% {\n opacity: 0;\n }\n}\n@keyframes svelte-1jfcowt-intro-hand-tap {\n 0% {\n transform: translateX(0) translateY(0) rotate(0) scale(1);\n }\n 10% {\n transform: translateX(-10px) translateY(-20px) rotate(-40deg) scale(0.9);\n }\n 35% {\n transform: translateX(0) translateY(0) rotate(15deg) scale(1);\n }\n 100% {\n transform: translateX(0) translateY(0) rotate(0) scale(1);\n }\n}\n@keyframes svelte-1jfcowt-intro-bump {\n 0% {\n transform: scale(1);\n }\n 5% {\n transform: scale(1);\n }\n 10% {\n transform: scale(0.8);\n }\n 20% {\n transform: scale(1);\n }\n 100% {\n transform: scale(1);\n }\n}"};function lu(t,e){Hi(e,!0),Ua(t,au);const n=po((()=>e.state.buttonText)),i=po((()=>e.state.animateHand)),r=po((()=>e.state.onCtaClick));let o=null,s=null;Ta((async()=>{Yc(o,{opacity:1},{duration:.35,ease:"easeOut"}),await Yc(s,{opacity:1},{duration:.35,ease:"easeOut",delay:.05})}));var a=su(),l=Go(a),c=Go(l);let u;c.__click=function(...t){var e;null===(e=Gs(r))||void 0===e||e.apply(this,t)};var d=Go(c),h=Go(d,!0);Fi(d),ml(d,(t=>s=t),(()=>s));var f=Ko(d,2),p=t=>{ca(t,ru())};Ma(f,(t=>{Gs(i)&&t(p)})),Fi(c),ml(c,(t=>o=t),(()=>o));var m=Ko(c,2),v=t=>{ca(t,ou())};Ma(m,(t=>{Gs(i)&&t(v)})),Fi(l),Fi(a),as((()=>{u=Ya(c,1,"svelte-1jfcowt",null,u,{"has-hand-anim":Gs(i)}),ga(h,Gs(n))})),ca(t,a),Ki()}ta(["click"]);var cu=new WeakSet;function uu(){this.emitModuleEnd()}const du={videoModule:class extends Il{constructor({config:t,...e}){var n;super({...e,config:t}),this.Component=$l,this.hasDuration=!t.loop,wl(this),this.coverAssets.push(null!==(n=t.intro)&&void 0!==n?n:t.video),this.cover=this.coverAssets[0],this.state={textBox:t.textBox}}start(t){super.start(t),this.timeline=t.createTimeline();const e=this.config;e.intro&&this.timeline.placeOnTimeline(El(`${this.id}_intro`,e.intro,t),"end");const n=El(this.id,e.video,t);this.timeline.placeOnTimeline(n,"end",{loop:e.loop}),e.loop||n.on("nodeend",this.emitModuleEnd)}},toggleModule:class extends Gl{static itemsKey="options";static nodePrefix="option";constructor(t){super(t),this.Component=Ql}mapItem(t){return{label:t.label,note:t.note}}},modesModule:class extends Gl{static itemsKey="modes";static nodePrefix="mode";constructor(t){super(t),this.Component=ic}mapItem(t){return{title:t.title,description:t.description,image:t.image}}},tryItModule:class extends Il{constructor({config:t,...e}){var n;super({...e,config:t}),$(this,eu),wl(this);const{introVideo:i}=t;this.coverAssets.push(null!==(n=i.intro)&&void 0!==n?n:i.loop),this.cover=this.coverAssets[0],this.state={ctaText:t.ctaText,animationConfig:t.animationConfig,showCta:!0,onCtaClick:B(eu,this,nu).bind(this)}}start(t){super.start(t),this.Component=tu,this.timeline=t.createTimeline();const{introVideo:e,mainVideo:n}=this.config;if(e.intro&&this.timeline.placeOnTimeline(El(`${this.id}_intro_intro`,e.intro,t)),this.timeline.placeOnTimeline(El(`${this.id}_intro_loop`,e.loop,t),"end",{loop:!0}),n){this.mainTimeline=t.createTimeline(),n.intro&&this.mainTimeline.placeOnTimeline(El(`${this.id}_main_intro`,n.intro,t));const e=El(`${this.id}_main_loop`,n.loop,t);this.mainTimeline.placeOnTimeline(e,"end",{loop:!0})}}play(){this.state.showCta=!0,super.play()}},imageModule:class extends Il{constructor({config:t,...e}){super({...e,config:t}),this.Component=iu,wl(this),this.coverAssets.push(t.image),this.cover=this.coverAssets[0],this.showCover=!0,this.state={textBox:t.textBox}}start(t){super.start(t),this.timeline=t.createTimeline();const e=El(this.id,this.config.image,t);delete e.manifestRef.availableEncodeProfiles,e.manifestRef.assetType="image",this.timeline.placeOnTimeline(e,0,{loop:!0})}},introModule:class extends Il{constructor({config:t,...e}){var n,i,r;super({...e,config:t}),$(this,cu),wl(this),this.coverAssets.push(null!==(n=t.intro)&&void 0!==n?n:t.video),this.cover=this.coverAssets[0],this.state={buttonText:t.buttonText,animateHand:null===(i=null!==(r=t.animateHand)&&void 0!==r?r:t.animatedHand)||void 0===i||i,onCtaClick:B(cu,this,uu).bind(this)}}start(t){super.start(t),this.Component=lu,this.timeline=t.createTimeline();const e=this.config;e.intro&&this.timeline.placeOnTimeline(El(`${this.id}_intro`,e.intro,t)),this.timeline.placeOnTimeline(El(`${this.id}_loop`,e.video,t),"end",{loop:!0})}play(){this.timeline?this.player.switchTimeline(this.timeline):this.setPosition()}}};class hu{#d=Bi(To(null),"GalleryState.#introModule");#h=Bi(To(!1),"GalleryState.#introModulePlayed");#f=Bi(To({}),"GalleryState.#variants");#p=Bi(To("ekonovar"),"GalleryState.#activeVariant");#m=Bi(To(0),"GalleryState.#activeItemIndex");#v=Bi(To(0),"GalleryState.#activeModuleIndex");#g=Bi(To(Oo({variantId:Gs(this.#p),itemIndex:0,moduleIndex:0})),"GalleryState.#playingModulePosition");#y=Bi(po((()=>{var t;return null===(t=Gs(this.#f))||void 0===t?void 0:t[Gs(this.#p)]})),"GalleryState.#currentItemsList");#b=Bi(po((()=>{var t;return null===(t=Gs(this.#y))||void 0===t?void 0:t[Gs(this.#m)]})),"GalleryState.#currentItem");#k=Bi(po((()=>{var t,e;return Gs(this.#x)?null===(e=Gs(this.#y))||void 0===e||null===(e=e[Gs(this.#g).itemIndex])||void 0===e?void 0:e.modules[Gs(this.#g).moduleIndex]:null===(t=Gs(this.#b))||void 0===t?void 0:t.modules[Gs(this.#v)]})),"GalleryState.#currentModule");#w=Bi(po((()=>{var t;return(null===(t=Gs(this.#y))||void 0===t?void 0:t.flatMap((t=>t.modules)))||[]})),"GalleryState.#currentModulesList");#_=Bi(To(!1),"GalleryState.#playerLoaded");#I=Bi(To(!1),"GalleryState.#paused");#x=Bi(To(!1),"GalleryState.#startedPlaying");#T=Bi(po((()=>!(Bo(Gs(this.#g).itemIndex,this.activeItemIndex)&&Bo(Gs(this.#g).moduleIndex,this.activeModuleIndex)))),"GalleryState.#seeking");#E=Bi(To(!1),"GalleryState.#themeLoaded");set introModule(t){So(this.#d,t)}set introModulePlayed(t){So(this.#h,t,!0)}set variants(t){So(this.#f,t)}set activeVariant(t){So(this.#p,t,!0)}set activeItemIndex(t){So(this.#m,t,!0)}set activeModuleIndex(t){So(this.#v,t,!0)}set playingModulePosition(t){So(this.#g,t,!0)}set playerLoaded(t){So(this.#_,t,!0)}set paused(t){So(this.#I,t,!0)}set startedPlaying(t){So(this.#x,t,!0)}set themeLoaded(t){So(this.#E,t,!0)}get introModule(){return Gs(this.#d)}get introModulePlayed(){return Gs(this.#h)}get variants(){return Gs(this.#f)}get activeVariant(){return Gs(this.#p)}get availableVariants(){return Object.keys(Gs(this.#f))}get activeItemIndex(){return Gs(this.#m)}get activeModuleIndex(){return Gs(this.#v)}get playingModulePosition(){return Gs(this.#g)}get currentItemsList(){return Gs(this.#y)}get currentItem(){return Gs(this.#b)}get currentModule(){return Gs(this.#k)}get playerLoaded(){return Gs(this.#_)}get paused(){return Gs(this.#I)}get startedPlaying(){return Gs(this.#x)}get seeking(){return Gs(this.#T)}get currentModulesList(){return Gs(this.#w)}get themeLoaded(){return Gs(this.#E)}}const fu={assetsDeliveryBase:"https://{{env}}assets.eko.com",galleryAppDelivery:"https://{{env}}play.eko.com/video-apps/eko-gallery-app"};function pu(t,...e){function n(t){return"[object Object]"===Object.prototype.toString.call(t)}function i(t,e){if(Array.isArray(e)){Array.isArray(t)||(t=Array.isArray(t)?t.slice():[]);const r=Math.max(t.length,e.length);for(let o=0;o<r;o++){const r=t[o],s=e[o];null!==s&&(void 0!==s&&(n(r)&&n(s)?t[o]=i({...r},s):Array.isArray(r)&&Array.isArray(s)?t[o]=i(r.slice(),s):n(s)?t[o]=i({},s):Array.isArray(s)?t[o]=i([],s):t[o]=s))}return t}if(n(e)){n(t)||(t={});for(const r of Object.keys(e)){const o=t[r],s=e[r];n(o)&&n(s)?t[r]=i({...o},s):Array.isArray(o)&&Array.isArray(s)?t[r]=i(o.slice(),s):n(s)?t[r]=i({},s):Array.isArray(s)?t[r]=i([],s):void 0!==s&&(t[r]=s)}return t}return e}for(const n of e)null!==n&&i(t,n);return t}const mu="ekonovar",vu=2,gu=5,yu=10,bu=(t,e)=>{let n=t.findIndex((t=>t.variantAware&&t.id===e.id));return-1===n&&(n=t.findIndex((t=>t.variantAware))),-1===n?0:n};var ku=new WeakMap,xu=new WeakMap,wu=new WeakMap,_u=new WeakMap,Iu=new WeakMap,Tu=new WeakMap,Eu=new WeakSet;class Su{constructor(t){var e,n,i,r,o;$(this,Eu),W(this,ku,void 0),W(this,xu,void 0),W(this,wu,void 0),W(this,_u,void 0),W(this,Iu,void 0),W(this,Tu,void 0),U(this,"version","0.0.20"),wl(this),j(ku,this,(null===(e=crypto)||void 0===e||null===(n=e.randomUUID)||void 0===n?void 0:n.call(e))||`eko-gallery-${Date.now()}`),j(_u,this,t),j(Tu,this,(null==t?void 0:t.onEvent)||(()=>{})),j(xu,this,new hu),j(Iu,this,((t="")=>("production"===t&&(t=""),Object.fromEntries(Object.entries(fu).map((([e,n])=>[e,n.replaceAll("{{env}}",t)])))))(null==t||null===(i=t.options)||void 0===i?void 0:i.galleryEnv)),j(wu,this,[]);const s=null==t||null===(r=t.instance)||void 0===r||null===(r=r.data)||void 0===r||null===(r=r.blocks)||void 0===r||null===(r=r.blocksArr)||void 0===r||null===(r=r.find((t=>"GalleryBlock"===t.blockType)))||void 0===r?void 0:r.config;s?(B(Eu,this,Mu).call(this,s.items),B(Eu,this,Au).call(this,s.items),function(t,e){function n(e){window.EkoAnalytics("registerContextPacker",{tag:t,...e})}function i(e){return function(...n){return n.pop()!==t?null:e(...n)}}"undefined"!=typeof window&&window.EkoAnalytics&&(n({schema:"iglu:com.helloeko/gallery-app/jsonschema/1-0-0",match:/.*/,getData:i((()=>{var t,n,i,r,o;const s=null===(t=e.currentItem)||void 0===t?void 0:t.modules[e.activeModuleIndex];return{itemid:(null===(n=e.currentItem)||void 0===n?void 0:n.id)||"",itemindex:e.activeItemIndex,totalitems:(null===(i=e.currentItemsList)||void 0===i?void 0:i.length)||0,itemname:(null===(r=e.currentItem)||void 0===r?void 0:r.name)||"",moduleid:(null==s?void 0:s.id)||"",modulename:(null==s?void 0:s.name)||"",moduletype:(null==s?void 0:s.config.itemType)||"",moduleindex:e.activeModuleIndex,totalmodules:(null===(o=e.currentItem)||void 0===o?void 0:o.modules.length)||0,version:"0.0.20"}}))}),n({schema:"iglu:com.helloeko/implementation_interactions/jsonschema/1-0-6",match:"interaction",getData:i((t=>t))}))}(z(ku,this),z(xu,this))):console.warn("[eko-gallery-app] Gallery initiated without an instance, results will be empty");const a=null==t||null===(o=t.instance)||void 0===o||null===(o=o.data)||void 0===o||null===(o=o.blocks)||void 0===o||null===(o=o.blocksArr)||void 0===o||null===(o=o.find((t=>"FullScreenIntro"===t.blockType)))||void 0===o?void 0:o.config;a&&(z(xu,this).introModule=new du.introModule({position:{variantId:"intro",itemIndex:0,moduleIndex:0},config:{itemType:"introModule",...a},gallery:this}))}dispose(){var t,e;"undefined"!=typeof window&&(null===(t=(e=window).EkoAnalytics)||void 0===t||t.call(e,"reset",z(ku,this)),function(){if("undefined"!=typeof window){for(const t of Ul)delete window[t];Ul.clear()}}())}start(t){z(xu,this).playerLoaded=!0,z(wu,this).forEach((e=>{e.start(t)})),j(wu,this,null),B(Eu,this,Nu).call(this,t),z(xu,this).introModule?(z(xu,this).introModule.start(t),z(xu,this).introModule.moduleEndListener=()=>{z(xu,this).introModulePlayed=!0,z(xu,this).currentModule.play()},z(xu,this).introModule.play()):z(xu,this).currentModule.play()}selectVariant(t){const{variants:e,currentItem:n,activeItemIndex:i,activeModuleIndex:r}=z(xu,this);if(e[t]){const i=bu(e[t],n);z(xu,this).activeVariant=t,z(xu,this).activeItemIndex=i,z(xu,this).activeModuleIndex=0}else z(xu,this).activeVariant=mu,z(xu,this).activeItemIndex=0,z(xu,this).activeModuleIndex=0;i===z(xu,this).activeItemIndex&&r===z(xu,this).activeModuleIndex&&z(xu,this).currentModule.play()}selectItem(t){B(Eu,this,Cu).call(this);const e=z(xu,this);t!==e.activeItemIndex&&(e.activeItemIndex=t,e.activeModuleIndex=0)}selectItemAndStep(t,e){B(Eu,this,Cu).call(this);const n=z(xu,this);t===n.activeItemIndex&&e===n.activeModuleIndex||(n.activeItemIndex=t,n.activeModuleIndex=e)}next(){B(Eu,this,Cu).call(this)||B(Eu,this,Ou).call(this)}prev(){if(B(Eu,this,Cu).call(this))return;const t=z(xu,this);if(t.activeModuleIndex=t.activeModuleIndex-1,!t.currentItem.modules[t.activeModuleIndex])if(t.currentItemsList[t.activeItemIndex-1]){t.activeItemIndex=t.activeItemIndex-1;const e=t.currentItemsList[t.activeItemIndex];t.activeModuleIndex=e.modules.length-1}else t.activeModuleIndex=t.activeModuleIndex+1}getCoverUrl(t,e){var n,i,r,o;const s=(null==t||null===(n=t.entity)||void 0===n?void 0:n.entityId)||(null==t?void 0:t.assetId),a=null!==(i=null==t||null===(r=t.entity)||void 0===r?void 0:r.entityRevision)&&void 0!==i?i:null==t?void 0:t.assetRevision;if(!s)throw new Error(`[getCoverUrl] No assetId found in assetConfig: ${JSON.stringify(t||{},null,2)}`);if(!a&&0!==a)throw new Error(`[getCoverUrl] No assetRevision found for asset ${s}.`);let l;return null!==(o=z(_u,this))&&void 0!==o&&null!==(o=o.coverAssetsMap)&&void 0!==o&&o[s]?(l=new URL(z(_u,this).coverAssetsMap[s]),/^[a-z0-9]*assets.eko.com$/.test(l.host)&&e&&(l.pathname=l.pathname.replace(".png",".webp"))):(l=new URL(`${z(Iu,this).assetsDeliveryBase}/image/${s}/${a}?startOffset=0`),l.pathname+=e?".webp":".png"),e&&l.searchParams.set("width",e),l.href}track(t,...e){var n,i;"undefined"!=typeof window&&(null===(n=(i=window).EkoAnalytics)||void 0===n||n.call(i,"track",t,...e,z(ku,this)))}interaction(t,e){const n=z(ku,this);return i=>{if("undefined"!=typeof window){var r,o,s,a;const t=null==i||null===(r=i.target)||void 0===r?void 0:r.dataset;let l;null!=i&&null!==(o=i.detail)&&void 0!==o&&o.direction&&("left"===i.detail.direction?l="swipe_next":"right"===i.detail.direction&&(l="swipe_prev"));const c={elementid:(null==t?void 0:t.elementid)||(null==e?void 0:e.elementid)||"",elementtype:(null==t?void 0:t.elementtype)||(null==e?void 0:e.elementtype)||"",elementname:(null==t?void 0:t.elementname)||(null==e?void 0:e.elementname)||"",interactiontype:l||(null==t?void 0:t.interactiontype)||(null==e?void 0:e.interactiontype)||""};null===(s=(a=window).EkoAnalytics)||void 0===s||s.call(a,"track","interaction",c,n),z(Tu,this).call(this,"interaction",c)}t(i)}}preloadVariantsCovers(t,e){const{activeVariant:n,variants:i}=z(xu,this);ql(Object.entries(i).filter((([t])=>t!==n)).map((([,n])=>{const i=bu(n,t);return this.getCoverUrl(n[i].modules[0].cover,e)})))}get uuid(){return z(ku,this)}get state(){return z(xu,this)}get urls(){return z(Iu,this)}}function Mu(t){const e={};for(let n of t)for(let t of Object.keys(n.variants||{}))e[t]=[];e[mu]=[],z(xu,this).variants=e}function Au(t){const e=(t=[],e)=>{const n=[];for(let[i,r]of t.entries()){if(!du[r.itemType])throw new Error(`Unknown module type ${r.itemType}`);const t=new du[r.itemType]({position:{...e,moduleIndex:i},config:r,gallery:this});t.moduleEndListener=B(Eu,this,Fu).bind(this),n.push(t)}return n},n=Object.entries(z(xu,this).variants);for(const e of t)if("galleryItemV2"===e.itemType){const{variants:t,...i}=e;for(const[r,o]of n){const n=null==t?void 0:t[r];if(!n&&e.variantSpecific)continue;let s={...i};n&&(s=pu({},i,n)),o.push({...s,variantAware:!!n})}}for(const[t,i]of n)if(0!==i.length)for(const[n,r]of i.entries())r.modules=e(r.modules,{variantId:t,itemIndex:n}),j(wu,this,[...z(wu,this),...r.modules]);else delete z(xu,this).variants[t]}function Nu(t){const e=Object.entries(z(xu,this).variants);for(const[n,i]of e){const r=e.filter((([t])=>t!==n));for(const[e,n]of i.entries()){const o=n.modules,s=i.filter((t=>t!==n)).map((t=>t.modules[0])),a=r.map((([,t])=>({nodeId:t[bu(t,n)].modules[0].timeline.getNodesAtTime(0)[0].id,weight:yu})));for(const[n,r]of o.entries()){let l=o[n+1];l||(l=i[(e+1)%i.length].modules[0]);const c=l.timeline.getNodesAtTime(0)[0],u=s.filter((t=>t!==l)).map((t=>t.timeline.getNodesAtTime(0)[0])),d=[{nodeId:c.id,weight:vu},...u.map((t=>({nodeId:t.id,weight:gu}))),...a];for(const e of r.timeline.placements){t.getNode(e.nodeId).setChildren(d)}}}}}function Fu(){const t=z(xu,this),e=t.currentItem.modules;e.length>1&&t.activeModuleIndex===e.length-1?t.activeModuleIndex=0:B(Eu,this,Ou).call(this)}function Cu(){const{introModule:t,introModulePlayed:e}=z(xu,this);return!(!t||e)&&(z(xu,this).introModulePlayed=!0,!0)}function Ou(){const t=z(xu,this);t.activeModuleIndex=t.activeModuleIndex+1,t.currentItem.modules[t.activeModuleIndex]||(t.currentItemsList[t.activeItemIndex+1]?(t.activeItemIndex=t.activeItemIndex+1,t.activeModuleIndex=0):t.activeModuleIndex=t.activeModuleIndex-1)}const Pu=["activeVariant","activeItemIndex","activeModuleIndex","paused","startedPlaying","availableVariants"],Ru=t=>Pu.reduce(((e,n)=>(e[n]=t[n],e)),{});function Du(t){return{version:t.version,state:Ru(t.state),selectItem:t.selectItem,selectItemAndStep:t.selectItemAndStep,next:t.next,prev:t.prev,subscribe:e=>function(t){Ir.ensure();const e=ts(Xn|ai,t,!0);return()=>{fs(e)}}((()=>{is((()=>{e(Ru(t.state))}))}))}}var Bu=oa('<img class="nav-button-icon svelte-er27y2" alt="" aria-hidden="true"/>'),Lu=oa('<button><!> <span class="svelte-er27y2"> </span></button>'),zu=oa('<div><div class="nav-buttons svelte-er27y2"></div></div>');const Wu={hash:"svelte-er27y2",code:".eko-gallery-app {--nav_gap: 10px;--nav_padding: 12px 16px;--nav_bgColor: #FFFFFF;--nav_justifyContent: center;--nav_tray_margin: 0;--nav_tray_padding: 2px;--nav_tray_width: fit-content;--nav_tray_maxWidth: 100%;--nav_tray_bgColor: transparent;--nav_tray_border: 0;--nav_tray_borderRadius: 0;--nav_tray_boxShadow: none;--nav_tray_overflow: auto;--nav_button_width: fit-content;--nav_button_bgColor: #FFFFFF;--nav_button_borderRadius: 100px;--nav_button_paddingTop: 8px;--nav_button_paddingBottom: var(--nav_button_paddingTop);--nav_button_paddingLeft: 12px;--nav_button_paddingRight: var(--nav_button_paddingLeft);--nav_button_boxShadow: 0 0 0 1px #E7E7E7;--nav_button_gap: 2px;--nav_button_selected_boxShadow: 0 0 0 1px #000000;--nav_button_selected_bgColor: var(--nav_button_bgColor);--nav_button_text_color: #000000;--nav_button_text_fontSize: 14px;--nav_button_text_fontWeight: 500;--nav_button_text_fontFamily: var(--fontName);--nav_button_text_lineHeight: 120%;--nav_button_text_letterSpacing: 0px;--nav_button_text_align: center;--nav_button_selected_text_color: var(--nav_button_text_color);--nav_button_selected_text_fontWeight: var(--nav_button_text_fontWeight);--nav_button_image_borderRadius: calc(var(--nav_button_borderRadius) - var(--nav_button_paddingTop));--nav_button_icon_size: 20px;--nav_button_icon_filter: none;--nav_button_selected_icon_filter: none;--nav_arrow_color: var(--secondaryColor);--nav_arrow_bgColor: transparent;--nav_arrow_borderRadius: 100%;--nav_arrow_padding: 9px;--nav_arrow_size: 30px;--nav_arrow_boxShadow: none;--nav_arrow_iconOpacity: 0.6;--nav_arrow_bgColor_hover: #FFFFFF;--nav_arrow_boxShadow_hover: 0 0 8px 0 rgba(0, 0, 0, 0.12);}.nav-buttons-container.svelte-er27y2 {width:100%;background-color:var(--nav_bgColor);display:flex;box-sizing:border-box;text-align:center;justify-content:var(--nav_justifyContent);align-items:center;position:relative;flex-shrink:0;opacity:0;transition:opacity 0.2s ease-in-out;}.nav-buttons-container.theme-loaded.svelte-er27y2 {opacity:1;}.nav-buttons-container.svelte-er27y2 :where(.svelte-er27y2) {touch-action:auto;}.nav-buttons.svelte-er27y2 {display:flex;margin:var(--nav_tray_margin);gap:var(--nav_gap);height:100%;align-items:center;padding:var(--nav_tray_padding, var(--nav_padding));background-color:var(--nav_tray_bgColor);border:var(--nav_tray_border);border-radius:var(--nav_tray_borderRadius);box-shadow:var(--nav_tray_boxShadow);box-sizing:border-box;overflow-x:var(--nav_tray_overflow);scrollbar-width:none;max-width:var(--nav_tray_maxWidth);width:var(--nav_tray_width);overflow-y:hidden;overscroll-behavior-y:none;}.nav-button.svelte-er27y2 {display:flex;outline:none;flex-shrink:0;height:100%;width:var(--nav_button_width);border:none;cursor:pointer;align-items:center;gap:var(--nav_button_gap);background-color:var(--nav_button_bgColor);border-radius:var(--nav_button_borderRadius);\n /* eslint-disable-next-line max-len */padding:var(--nav_button_paddingTop) var(--nav_button_paddingRight) var(--nav_button_paddingBottom) var(--nav_button_paddingLeft);box-shadow:var(--nav_button_boxShadow);}.nav-button.svelte-er27y2 .nav-button-icon:where(.svelte-er27y2) {width:var(--nav_button_icon_size);height:var(--nav_button_icon_size);flex:0 0 auto;object-fit:contain;filter:var(--nav_button_icon_filter);pointer-events:none;display:block;}.nav-button.svelte-er27y2 span:where(.svelte-er27y2) {flex:1 0 0;transition:color 0.2s ease-in-out;color:var(--nav_button_text_color);font-weight:var(--nav_button_text_fontWeight);font-size:var(--nav_button_text_fontSize);font-family:var(--nav_button_text_fontFamily);line-height:var(--nav_button_text_lineHeight);letter-spacing:var(--nav_button_text_letterSpacing);text-align:var(--nav_button_text_align);}.nav-button.selected.svelte-er27y2 {background-color:var(--nav_button_selected_bgColor);box-shadow:var(--nav_button_selected_boxShadow);}.nav-button.selected.svelte-er27y2 .nav-button-icon:where(.svelte-er27y2) {filter:var(--nav_button_selected_icon_filter);}.nav-button.selected.svelte-er27y2 span:where(.svelte-er27y2) {color:var(--nav_button_selected_text_color);font-weight:var(--nav_button_selected_text_fontWeight);}"};function ju(t,e){Hi(e,!0),Ua(t,Wu);let n=gl(e,"onNavItemClick",3,(()=>{}));const i=Gi("state");var r=zu();let o;var s=Go(r);Fa(s,23,(()=>i().currentItemsList),((t,e)=>`${i().activeVariant}_${t.id}_${e}`),((t,r,o)=>{const s=po((()=>function(t){var n;if(!t)return null;if("string"==typeof t)return t;if(null!=(null===(n=t.entity)||void 0===n?void 0:n.entityId))try{return e.gallery.getCoverUrl(t,40)}catch{return null}return null}(Gs(r).icon)));var a=Lu();let l;a.__click=()=>n()(Gs(o));var c=Go(a),u=t=>{var e=Bu();as((()=>al(e,"src",Gs(s)))),ca(t,e)};Ma(c,(t=>{Gs(s)&&t(u)}));var d=Ko(c,2),h=Go(d,!0);Fi(d),Fi(a),as(((t,e)=>{l=Ya(a,1,"nav-button svelte-er27y2",null,l,t),al(a,"data-item-name",e),ga(h,Gs(r).name)}),[()=>({selected:Gs(o)===i().activeItemIndex}),()=>{var t,e;return null!==(t=null===(e=Gs(r).name)||void 0===e?void 0:e.toLowerCase())&&void 0!==t?t:""}]),ca(t,a)})),Fi(s),Fi(r),as((t=>o=Ya(r,1,"nav-buttons-container svelte-er27y2",null,o,t)),[()=>({"theme-loaded":i().themeLoaded})]),ca(t,r),Ki()}ta(["click"]);const $u="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20320%20512'%3e%3cpath%20d='M310.6%20233.4c12.5%2012.5%2012.5%2032.8%200%2045.3l-192%20192c-12.5%2012.5-32.8%2012.5-45.3%200s-12.5-32.8%200-45.3L242.7%20256%2073.4%2086.6c-12.5-12.5-12.5-32.8%200-45.3s32.8-12.5%2045.3%200l192%20192z'/%3e%3c/svg%3e";var Uu=oa('<button><img class="svelte-1al44kl"/></button>');const qu={hash:"svelte-1al44kl",code:'.nav-button.svelte-1al44kl {height:var(--nav_arrow_size, 30px);width:var(--nav_arrow_size, 30px);border-radius:var(--nav_arrow_borderRadius, 100%);background-color:var(--nav_arrow_bgColor, transparent);padding:var(--nav_arrow_padding, 9px);box-shadow:var(--nav_arrow_boxShadow, none);box-sizing:border-box;display:flex;align-items:center;justify-content:center;pointer-events:auto;border:0;opacity:100%;cursor:pointer;transition:background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out, opacity 0.2s ease-in-out;position:relative;}.nav-button.prev.svelte-1al44kl {transform:rotate(180deg);}.nav-button.hidden.svelte-1al44kl {opacity:0;pointer-events:none;}.nav-button.svelte-1al44kl::before {content:"";position:absolute;top:-8px;right:-8px;bottom:-8px;left:-8px;}.nav-button.svelte-1al44kl img:where(.svelte-1al44kl) {height:100%;opacity:var(--nav_arrow_iconOpacity, 1);}'};function Vu(t,e){Ua(t,qu);const n=gl(e,"hidden",3,!1);var i=Uu();let r;i.__click=function(...t){var n;null===(n=e.onClick)||void 0===n||n.apply(this,t)};var o=Go(i);Fi(i),as((()=>{var t;r=Ya(i,1,`nav-button ${null!==(t=e.type)&&void 0!==t?t:""}`,"svelte-1al44kl",r,{hidden:n()}),al(i,"aria-label",e.type),al(o,"src",$u),al(o,"alt",e.type)})),ca(t,i)}ta(["click"]);var Gu=oa('<button data-elementtype="step-indicator" data-interactiontype="navigation"><span class="svelte-1mxltt0"> </span></button>'),Hu=oa('<div><button aria-label="Scroll to previous steps"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="svelte-1mxltt0"><path d="M12.8333 16.6668C12.68 16.6668 12.5266 16.5935 12.4266 16.4601L9.42663 12.2935C9.36482 12.2081 9.33154 12.1055 9.33154 12.0001C9.33154 11.8948 9.36482 11.7921 9.42663 11.7068L12.4266 7.54012C12.4651 7.48671 12.5138 7.44142 12.5698 7.40682C12.6259 7.37222 12.6882 7.349 12.7532 7.33848C12.8182 7.32795 12.8846 7.33033 12.9487 7.34549C13.0128 7.36064 13.0732 7.38826 13.1266 7.42678C13.18 7.46531 13.2253 7.51397 13.2599 7.56999C13.2945 7.62602 13.3177 7.68831 13.3283 7.75331C13.3388 7.81831 13.3364 7.88475 13.3213 7.94883C13.3061 8.01291 13.2785 8.07338 13.24 8.12678L10.4466 12.0001L13.2333 15.8735C13.2864 15.9479 13.3181 16.0355 13.3251 16.1267C13.332 16.2179 13.314 16.3092 13.2728 16.3909C13.2316 16.4725 13.1689 16.5414 13.0915 16.59C13.014 16.6386 12.9247 16.6652 12.8333 16.6668Z" fill="#030303" class="svelte-1mxltt0"></path></svg></button> <div role="group" aria-roledescription="Sequence navigation buttons"></div> <button aria-label="Scroll to next steps"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="svelte-1mxltt0"><path d="M11.1668 16.6666C11.0668 16.6666 10.9601 16.6333 10.8734 16.5733C10.8199 16.5348 10.7746 16.4862 10.7399 16.4302C10.7053 16.3741 10.682 16.3118 10.6715 16.2468C10.6609 16.1818 10.6634 16.1153 10.6786 16.0512C10.6938 15.9871 10.7215 15.9266 10.7601 15.8733L13.5534 11.9999L10.7601 8.12661C10.6001 7.89994 10.6468 7.59328 10.8734 7.42661C11.1001 7.26661 11.4068 7.31994 11.5734 7.53994L14.5734 11.7066C14.7001 11.8799 14.7001 12.1133 14.5734 12.2933L11.5734 16.4599C11.4734 16.5933 11.3201 16.6666 11.1668 16.6666Z" fill="#030303" class="svelte-1mxltt0"></path></svg></button></div>');const Ku={hash:"svelte-1mxltt0",code:'.eko-gallery-app {--stepsIndicator_container_bottom: 12px;--stepsIndicator_container_left: 8px;--stepsIndicator_container_right: auto;--stepsIndicator_container_width: calc(100% - 16px);--stepsIndicator_padding: 4px 4px;--stepsIndicator_margin: 0 16px;--stepsIndicator_gap: 8px;--stepsIndicator_justifyContent: flex-start;--stepsIndicator_mask_left: linear-gradient(to left, black calc(100% - 20px), transparent);--stepsIndicator_mask_right: linear-gradient(to right, black calc(100% - 20px), transparent);\n /* stylelint-disable-next-line max-line-length */--stepsIndicator_mask_both: linear-gradient(\n to right,\n transparent,\n black 20px,\n black calc(100% - 20px),\n transparent\n );--stepsIndicator_button_padding: 8px 12px;--stepsIndicator_button_border: #E4E5E8 solid 1px;--stepsIndicator_button_borderRadius: 100px;--stepsIndicator_button_bgColor: #FBFBFB;--stepsIndicator_button_bgColor_hover: #F3F4F6;--stepsIndicator_button_bgColor_active: #E4E5E8;--stepsIndicator_button_boxShadow: none;--stepsIndicator_button_color: #030303;--stepsIndicator_button_fontSize: 12px;--stepsIndicator_button_fontWeight: 500;--stepsIndicator_button_lineHeight: 16px;--stepsIndicator_button_active_bgColor: #014FD3;--stepsIndicator_button_active_borderColor: #014FD3;--stepsIndicator_button_active_boxShadow: none;--stepsIndicator_button_active_color: #FFFFFF;--stepsIndicator_span_display: block;--stepsIndicator_span_width: auto;--stepsIndicator_span_height: auto;--stepsIndicator_span_borderRadius: 0;--stepsIndicator_span_bgColor: transparent;--stepsIndicator_span_border: 0;--stepsIndicator_span_boxShadow: none;--stepsIndicator_span_fontSize: inherit;--stepsIndicator_span_color: inherit;--stepsIndicator_span_active_width: var(--stepsIndicator_span_width);--stepsIndicator_span_active_height: var(--stepsIndicator_span_height);--stepsIndicator_span_active_bgColor: var(--stepsIndicator_span_bgColor);--stepsIndicator_span_active_border: var(--stepsIndicator_span_border);--stepsIndicator_span_active_boxShadow: var(--stepsIndicator_span_boxShadow);--stepsIndicator_arrow_display: flex;}.steps-indicator-container.svelte-1mxltt0 {width:var(--stepsIndicator_container_width);position:absolute;bottom:var(--stepsIndicator_container_bottom);left:var(--stepsIndicator_container_left);right:var(--stepsIndicator_container_right);animation-duration:0.75s;animation-timing-function:cubic-bezier(0.36, 0, 0, 1);animation-fill-mode:both;animation-delay:0.15s;\n animation-name: svelte-1mxltt0-gallery-steps-appear-anim;}.steps-indicator-container.mobile-indicators.svelte-1mxltt0 {display:var(--stepsIndicator_mobile_display, none);}.steps-indicator.svelte-1mxltt0 {--stepSize: 6px;--stepPadding: 7px;padding:var(--stepsIndicator_padding);margin:var(--stepsIndicator_margin);display:flex;gap:var(--stepsIndicator_gap);align-items:center;justify-content:var(--stepsIndicator_justifyContent);overflow-x:auto;pointer-events:all;scrollbar-width:none;}.steps-indicator.fade-right.svelte-1mxltt0 {mask-image:var(--stepsIndicator_mask_right);}.steps-indicator.fade-left.svelte-1mxltt0 {mask-image:var(--stepsIndicator_mask_left);}.steps-indicator.fade-left.fade-right.svelte-1mxltt0 {mask-image:var(--stepsIndicator_mask_both);}.steps-indicator.with-duration.svelte-1mxltt0 .step-button:where(.svelte-1mxltt0) span:where(.svelte-1mxltt0) {position:relative;overflow:hidden;}.steps-indicator.with-duration.svelte-1mxltt0 .step-button:where(.svelte-1mxltt0) span:where(.svelte-1mxltt0):after {transition:0.3s ease-in-out;transition-property:opacity, width;}.step-button.svelte-1mxltt0 {padding:var(--stepsIndicator_button_padding);border:var(--stepsIndicator_button_border);background-color:var(--stepsIndicator_button_bgColor);box-shadow:var(--stepsIndicator_button_boxShadow);border-radius:var(--stepsIndicator_button_borderRadius);font-size:var(--stepsIndicator_button_fontSize);font-weight:var(--stepsIndicator_button_fontWeight);line-height:var(--stepsIndicator_button_lineHeight);color:var(--stepsIndicator_button_color);cursor:pointer;pointer-events:all;flex-shrink:0;transition:all 0.3s ease-in-out;outline-color:#3191fc;}.step-button.active.svelte-1mxltt0 {background-color:var(--stepsIndicator_button_active_bgColor);color:var(--stepsIndicator_button_active_color);box-shadow:var(--stepsIndicator_button_active_boxShadow);border-color:var(--stepsIndicator_button_active_borderColor);}.step-button.active.svelte-1mxltt0:after {opacity:100%;\n animation: svelte-1mxltt0-stepDurationAnimation var(--stepDuration) linear forwards;animation-play-state:running;}.step-button.svelte-1mxltt0:hover:not(.active) {background:var(--stepsIndicator_button_bgColor_hover);}.step-button.svelte-1mxltt0:active:not(.active) {background:var(--stepsIndicator_button_bgColor_active);}.step-button.svelte-1mxltt0:focus {outline-offset:4px;outline-width:2px;}.step-button.svelte-1mxltt0 span:where(.svelte-1mxltt0) {display:var(--stepsIndicator_span_display);width:var(--stepsIndicator_span_width);height:var(--stepsIndicator_span_height);border-radius:var(--stepsIndicator_span_borderRadius);background-color:var(--stepsIndicator_span_bgColor);border:var(--stepsIndicator_span_border);box-shadow:var(--stepsIndicator_span_boxShadow);font-size:var(--stepsIndicator_span_fontSize);color:var(--stepsIndicator_span_color);box-sizing:border-box;pointer-events:none;white-space:nowrap;}.step-button.svelte-1mxltt0 span:where(.svelte-1mxltt0):after {content:"";background-color:rgba(0, 0, 0, 0.6);position:absolute;border-radius:var(--stepSize);width:0;height:100%;top:0;left:-100%;opacity:0;transform:translateX(0);animation-play-state:paused;}.step-button.active.svelte-1mxltt0 span:where(.svelte-1mxltt0) {width:var(--stepsIndicator_span_active_width);height:var(--stepsIndicator_span_active_height);background-color:var(--stepsIndicator_span_active_bgColor);border:var(--stepsIndicator_span_active_border);box-shadow:var(--stepsIndicator_span_active_boxShadow);}.step-arrow.svelte-1mxltt0 {display:var(--stepsIndicator_arrow_display);width:34px;height:34px;position:absolute;z-index:10;bottom:4px;border:1px solid #C4C8CF;border-radius:50%;background-color:#FFFFFF;box-shadow:0 2px 3px 0 rgba(0, 0, 0, 0.05);box-sizing:border-box;align-items:center;justify-content:center;pointer-events:none;cursor:pointer;opacity:0;}.step-arrow.svelte-1mxltt0:hover {background:#F6F6F7;}.step-arrow.svelte-1mxltt0:active {background:#E4E5E8;}.step-arrow-prev.svelte-1mxltt0 {left:3px;transform:translateX(-100%);\n animation: svelte-1mxltt0-arrow-left-disappear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}.step-arrow-prev.visible.svelte-1mxltt0 {pointer-events:auto;\n animation: svelte-1mxltt0-arrow-left-appear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}.step-arrow-next.svelte-1mxltt0 {right:3px;transform:translateX(100%);\n animation: svelte-1mxltt0-arrow-right-disappear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}.step-arrow-next.visible.svelte-1mxltt0 {pointer-events:auto;\n animation: svelte-1mxltt0-arrow-right-appear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}\n\n@keyframes svelte-1mxltt0-gallery-steps-appear-anim {\n from {\n opacity: 0;\n transform: translate(0, 10px);\n }\n to {\n opacity: 1;\n transform: translate(0, 0);\n }\n}\n@keyframes svelte-1mxltt0-gallery-steps-disappear-anim {\n from {\n opacity: 1;\n transform: translate(0, 0);\n }\n to {\n opacity: 0;\n transform: translate(0, 10px);\n }\n}\n@keyframes svelte-1mxltt0-arrow-left-appear {\n from {\n opacity: 0;\n transform: translateX(-100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n@keyframes svelte-1mxltt0-arrow-left-disappear {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(-100%);\n }\n}\n@keyframes svelte-1mxltt0-arrow-right-appear {\n from {\n opacity: 0;\n transform: translateX(100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n@keyframes svelte-1mxltt0-arrow-right-disappear {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(100%);\n }\n}\n@keyframes svelte-1mxltt0-stepDurationAnimation {\n 0% {\n transform: translateX(0);\n }\n 100% {\n transform: translateX(100%);\n }\n}'};function Xu(t,e){Hi(e,!0),Ua(t,Ku);const n=16,i=32;let r=gl(e,"gallery",7),o=To(null),s=To(null),a=To(!1),l=To(!1);const c=po((()=>{let t=[];return t=r().state.currentItem.modules.map(((t,e)=>({index:e,type:e===r().state.activeModuleIndex?"active":"",name:t.name}))),t}));function u(){Gs(o)&&(So(a,Gs(o).scrollLeft>0),So(l,Gs(o).scrollLeft+Gs(o).clientWidth<Gs(o).scrollWidth-0))}function d(t){Gs(o).scrollBy({left:t,behavior:"smooth"})}function h(t,e){const r=t.getBoundingClientRect(),o=e.getBoundingClientRect(),s=n+i;o.left<r.left+i?d(o.left-r.left-s):o.right>r.right-i&&d(o.right-r.right+s)}function f(){const t=Array.from(Gs(o).querySelectorAll(".step-button")).find((t=>{const e=t.getBoundingClientRect(),n=Gs(o).getBoundingClientRect();return e.left>n.left+i}));if(t){const e=t.previousElementSibling;e&&h(Gs(o),e)}}function p(){const t=Array.from(Gs(o).querySelectorAll(".step-button")).reverse().find((t=>{const e=t.getBoundingClientRect(),n=Gs(o).getBoundingClientRect();return e.right<n.right-i}));if(t){const e=t.nextElementSibling;e&&h(Gs(o),e)}}is((()=>{if(Gs(o)){u();const t=Gs(o).querySelector(".step-button.active");t&&So(s,t,!0);const e=new MutationObserver((()=>{const t=Gs(o).querySelector(".step-button.active");t&&So(s,t,!0)}));e.observe(Gs(o),{attributes:!0,attributeFilter:["class"],subtree:!0});const n=new ResizeObserver((()=>{u()}));return n.observe(Gs(o)),()=>{e.disconnect(),n.disconnect()}}})),is((()=>{Gs(c),Gs(o)&&Vs().then(u)})),is((()=>{Gs(s)&&Gs(o)&&h(Gs(o),Gs(s))}));var m=la();Zs("resize",Lo,u),function(t,e,n){Si&&Ni();var i=new Ia(t);ls((()=>{var t=e();i.ensure(t,n)}))}(Ho(m),(()=>r().state.activeItemIndex),(t=>{var n=Hu();let i;var s=Go(n);let d;s.__click=f;var m=Ko(s,2);let v;Fa(m,21,(()=>Gs(c)),Aa,((t,e)=>{var n=Gu();let i;var s=po((()=>r().interaction((t=>{return n=t.currentTarget,i=Gs(e).index,r().state.activeModuleIndex=i,void h(Gs(o),n);var n,i}))));n.__click=function(...t){var e;null===(e=Gs(s))||void 0===e||e.apply(this,t)};var a=Go(n),l=Go(a,!0);Fi(a),Fi(n),as((()=>{i=Ya(n,1,"step-button svelte-1mxltt0",null,i,{active:"active"===Gs(e).type}),al(n,"aria-label",`Go to step $${Gs(e).index+1}`),al(n,"data-elementid",`${Gs(e).index+1}`),al(n,"data-elementname",Gs(e).name),ga(l,Gs(e).name)})),ca(t,n)})),Fi(m),ml(m,(t=>So(o,t)),(()=>Gs(o)));var g=Ko(m,2);let y;g.__click=p,Fi(n),as((()=>{var t,o,c;i=Ya(n,1,"steps-indicator-container svelte-1mxltt0",null,i,{"mobile-indicators":e.isMobile}),d=Ya(s,1,"step-arrow step-arrow-prev svelte-1mxltt0",null,d,{visible:Gs(a)}),v=Ya(m,1,"steps-indicator svelte-1mxltt0",null,v,{"with-duration":null===(t=r().state.currentModule)||void 0===t?void 0:t.hasDuration,paused:r().state.paused,"fade-left":Gs(a),"fade-right":Gs(l)}),Ja(m,`--stepDuration: ${null!==(o=null===(c=r().state.currentModule)||void 0===c?void 0:c.duration)&&void 0!==o?o:""}s`),y=Ya(g,1,"step-arrow step-arrow-next svelte-1mxltt0",null,y,{visible:Gs(l)})})),Zs("scroll",m,u),ca(t,n)})),ca(t,m),Ki()}ta(["click"]);var Yu=aa('<svg class="pause-button-icon pause-button-icon--play svelte-a3r6re" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M5.23 3.75c0-1.11 1.19-1.82 2.17-1.28l15 8.25a1.46 1.46 0 0 1 0 2.56l-15 8.25a1.46 1.46 0 0 1-2.17-1.28V3.75z"></path></svg>'),Qu=aa('<svg class="pause-button-icon pause-button-icon--pause svelte-a3r6re" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><line class="pause-bar pause-bar--left svelte-a3r6re" x1="8" y1="3.5" x2="8" y2="20.5"></line><line class="pause-bar pause-bar--right svelte-a3r6re" x1="16" y1="3.5" x2="16" y2="20.5"></line></svg>'),Ju=oa('<button class="pause-button svelte-a3r6re" data-elementid="play_pause" data-elementtype="button"><!></button>');const Zu={hash:"svelte-a3r6re",code:".eko-gallery-app {--pauseButton_top: 10px;--pauseButton_right: 10px;--pauseButton_bottom: auto;--pauseButton_left: auto;--pauseButton_size: 32px;--pauseButton_borderRadius: 100%;--pauseButton_border: 1px solid #C4C8CF;--pauseButton_boxShadow: none;--pauseButton_backdropFilter: none;--pauseButton_bgColor: #FFFFFF;--pauseButton_bgColor_hover: #F6F6F7;--pauseButton_bgColor_active: #E4E5E8;--pauseButton_iconSize: 16px;--pauseButton_iconColor: #030303;--pauseButton_playIconFill: none;--pauseButton_playIconStroke: currentColor;--pauseButton_playIconStrokeWidth: 1.5;--pauseButton_pauseIconStrokeWidth: 1.5;--pauseButton_pauseIconStrokeLinecap: butt;--pauseButton_pauseIconScaleY: 1;--pauseButton_pauseIconBarSpread: 0px;}.pause-button.svelte-a3r6re {position:absolute;top:var(--pauseButton_top);right:var(--pauseButton_right);bottom:var(--pauseButton_bottom);left:var(--pauseButton_left);width:var(--pauseButton_size);height:var(--pauseButton_size);padding:0;background:var(--pauseButton_bgColor);border:var(--pauseButton_border);border-radius:var(--pauseButton_borderRadius);box-shadow:var(--pauseButton_boxShadow);backdrop-filter:var(--pauseButton_backdropFilter);-webkit-backdrop-filter:var(--pauseButton_backdropFilter);color:var(--pauseButton_iconColor);display:flex;justify-content:center;align-items:center;pointer-events:auto;transition:background 0.2s ease-in-out;cursor:pointer;outline-color:#3191fc;}.pause-button.svelte-a3r6re:hover {background:var(--pauseButton_bgColor_hover);}.pause-button.svelte-a3r6re:active {background:var(--pauseButton_bgColor_active);}.pause-button.svelte-a3r6re:focus {outline-offset:8px;outline-width:2px;}.pause-button.svelte-a3r6re .pause-button-icon:where(.svelte-a3r6re) {width:var(--pauseButton_iconSize);height:var(--pauseButton_iconSize);pointer-events:none;display:block;}.pause-button.svelte-a3r6re .pause-button-icon--pause:where(.svelte-a3r6re) {fill:none;stroke:currentColor;stroke-width:var(--pauseButton_pauseIconStrokeWidth, 1.5);stroke-linecap:var(--pauseButton_pauseIconStrokeLinecap, butt);transform:scaleY(var(--pauseButton_pauseIconScaleY, 1));transform-origin:center;overflow:visible;}.pause-button.svelte-a3r6re .pause-button-icon--pause:where(.svelte-a3r6re) .pause-bar--left:where(.svelte-a3r6re) {transform:translateX(calc(-1 * var(--pauseButton_pauseIconBarSpread, 0px)));}.pause-button.svelte-a3r6re .pause-button-icon--pause:where(.svelte-a3r6re) .pause-bar--right:where(.svelte-a3r6re) {transform:translateX(var(--pauseButton_pauseIconBarSpread, 0px));}.pause-button.svelte-a3r6re .pause-button-icon--play:where(.svelte-a3r6re) {fill:var(--pauseButton_playIconFill, none);stroke:var(--pauseButton_playIconStroke, currentColor);stroke-width:var(--pauseButton_playIconStrokeWidth, 1.5);stroke-linejoin:round;stroke-linecap:round;}"};ta(["click"]);const td=300,ed=60,nd="none";function id(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function rd(t,e,n){const{x:i,y:r}=function(t,e){const n=t.getBoundingClientRect();return{x:Math.round(e.clientX-n.left),y:Math.round(e.clientY-n.top)}}(t,e);return{event:e,pointersCount:n.length,target:e.target,x:i,y:r,attachmentNode:t}}function od(t,e,n,i,r){const o=rd(t,n,i);return t.dispatchEvent(new CustomEvent(`${e}${r}`,{detail:o})),o}function sd(){let t=[],e=()=>{},n=[];return{setPointerControls:(i,r,o,s,a,l=nd,c=[])=>{var u;if(r.style.touchAction=(u=l,Array.isArray(u)?u:[u]).join(" "),n=c,n.forEach((e=>{var n;null===(n=e.onInit)||void 0===n||n.call(e,t)})),!t.length){let l=function(e){t.push(e);const l=od(r,i,e,t,"down");function c(e){const o=t.length;t=function(t,e){return e.filter((e=>Bo(t.pointerId,e.pointerId,!1)))}(e,t);if(o>t.length){t.length||(u(),d(),h(),f());const o=od(r,i,e,t,"up");null==a||a(t,e),setTimeout((()=>{n.forEach((e=>{var n;null===(n=e.onUp)||void 0===n||n.call(e,o,t)}))}))}}null==s||s(t,e),setTimeout((()=>{n.forEach((e=>{var n;null===(n=e.onDown)||void 0===n||n.call(e,l,t)}))}));const u=id(r,"pointermove",(e=>{t=t.map((t=>Bo(e.pointerId,t.pointerId)?e:t));const s=od(r,i,e,t,"move");null==o||o(t,e),n.forEach((e=>{var n;null===(n=e.onMove)||void 0===n||n.call(e,s,t)}))})),d=id(r,"lostpointercapture",(t=>{c(t)})),h=id(r,"pointerup",(t=>{c(t)})),f=id(r,"pointerleave",(t=>{c(t)}))};e=id(r,"pointerdown",l)}return{destroy:()=>{t.length||(e(),n.forEach((t=>{var e;null===(e=t.onDestroy)||void 0===e||e.call(t)})))}}}}}const ad="@attach";function ld(){return Symbol(ad)}const cd="swipe";function ud(t,e,n,i=!1){const{setPointerControls:r}=sd(),o=i?cd:ld();return{...n,[`on${cd}`]:t,[o]:t=>{const{onDown:n,onUp:i,parameters:o}=function(t,e){const n={timeframe:td,minSwipeDistance:ed,touchAction:nd,composed:!1,...e};let i,r,o,s;function a(t,e){r=e.clientX,o=e.clientY,i=Date.now(),Bo(t.length,1)&&(s=e.target)}function l(e,a){if(Bo(a.type,"pointerup")&&Bo(e.length,0)&&Date.now()-i<n.timeframe){const e=a.clientX-r,i=a.clientY-o,l=Math.abs(e),c=Math.abs(i);let u=null;l>=2*c&&l>n.minSwipeDistance?u=e>0?"right":"left":c>=2*l&&c>n.minSwipeDistance&&(u=i>0?"bottom":"top"),u&&t.dispatchEvent(new CustomEvent(cd,{detail:{direction:u,target:s,pointerType:a.pointerType}}))}}return{onDown:a,onUp:l,parameters:n}}(t,null==e?void 0:e());return r(cd,t,null,n,i,o.touchAction,o.plugins).destroy}}}const dd="tap";function hd(t,e,n,i=!1){const{setPointerControls:r}=sd(),o=i?dd:ld();return{...n,[`on${dd}`]:t,[o]:t=>{const{onDown:n,onUp:i,parameters:o}=function(t,e){const n={timeframe:td,composed:!1,touchAction:"auto",...e};let i,r,o;function s(e,s){if(Math.abs(s.clientX-r)<4&&Math.abs(s.clientY-o)<4&&Date.now()-i<n.timeframe){const e=t.getBoundingClientRect(),n=Math.round(s.clientX-e.left),i=Math.round(s.clientY-e.top);t.dispatchEvent(new CustomEvent(dd,{detail:{x:n,y:i,target:s.target,pointerType:s.pointerType}}))}}function a(t,e){r=e.clientX,o=e.clientY,i=Date.now()}return{onDown:a,onUp:s,parameters:n}}(t,null==e?void 0:e());return r(dd,t,null,n,i,o.touchAction,o.plugins).destroy}}}const fd=t=>{const e="#00ff00",n=1e6,i=4;let r,o,s,a=null,l=!1,c=Date.now();const u={x:void 0,y:void 0};function d(){const e=t.fadeTime,n=Date.now(),i=n-c;i>e/20&&(a&&o&&s&&r&&(s.drawImage(r,0,0),a.clearRect(0,0,r.width,r.height),a.globalAlpha=1-3*i/e,a.drawImage(o,0,0),a.globalAlpha=1,s.clearRect(0,0,r.width,r.height)),c=n),l&&requestAnimationFrame(d)}function h(t){u.x=t.x,u.y=t.y}function f(){a&&o&&r&&(a.canvas.width=window.innerWidth,a.canvas.height=window.innerHeight,o.width=r.width,o.height=r.height)}function p(e){var i;m(),r=window.document.createElement("canvas"),r.id="svelte-gestures-highlight-plugin",a=r.getContext("2d"),r.style.cssText=`\ndisplay: block; \nwidth: 100dvw;\nheight: 100dvh;\ntop: 0;\nleft: 0;\nposition: fixed;\npointer-events: none;\nz-index: ${null!==(i=t.zIndex)&&void 0!==i?i:n};\n`,window.document.body.appendChild(r),window.addEventListener("resize",f),e&&h(e.event),o=document.createElement("canvas"),f(),s=o.getContext("2d"),l=!0,d()}function m(){var t;l=!1,null===(t=window.document.getElementById("svelte-gestures-highlight-plugin"))||void 0===t||t.remove(),window.removeEventListener("resize",f)}return{onMove:n=>{var r,o,s;r=n.event,a&&(a.beginPath(),a.lineWidth=null!==(o=t.lineWidth)&&void 0!==o?o:i,a.lineCap="round",a.strokeStyle=null!==(s=t.color)&&void 0!==s?s:e,Bo(u.x,void 0,!1)&&Bo(u.y,void 0,!1)?(a.moveTo(u.x,u.y),h(r),a.lineTo(u.x,u.y)):h(r),a.stroke())},onDown:t=>{p(t)},onUp:(t,e)=>{Bo(e.length,0)&&m()},onDestroy:m,onInit:t=>{t.length&&(u.x=void 0,u.y=void 0,p())}}};var pd=oa("<div></div>"),md=oa("<div></div>");const vd={hash:"svelte-1fv6njc",code:".swiper.svelte-1fv6njc {position:absolute;top:0;left:0;pointer-events:auto;width:100%;height:100%;}"};var gd=oa("<img/>"),yd=oa('<div class="ui-container svelte-1rvgxfc"><!></div>'),bd=oa('<div class="cover-container svelte-1rvgxfc"><!> <!> <!></div>'),kd=oa('<div class="covers-container svelte-1rvgxfc" style="scroll-behavior: auto;"><!></div>');const xd={hash:"svelte-1rvgxfc",code:".covers-container.svelte-1rvgxfc {position:absolute;top:0;left:0;bottom:0;right:0;overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;scrollbar-width:none;display:flex;gap:0.5px;}.covers-container.svelte-1rvgxfc::-webkit-scrollbar {display:none;}.cover-container.svelte-1rvgxfc {position:relative;display:flex;width:100%;height:100%;flex-shrink:0;scroll-snap-align:center;user-select:none;justify-content:center;align-items:center;}.cover-image.svelte-1rvgxfc {width:var(--videoWidth);height:var(--videoHeight);aspect-ratio:var(--videoAspect);object-fit:cover;pointer-events:none;background:#ffffff;}.cover-image.content-playing.svelte-1rvgxfc {opacity:0;}.cover-image.content-playing.force-show.svelte-1rvgxfc {opacity:1;background:transparent;transition:opacity 0s 0.2s;}.ui-container.svelte-1rvgxfc {position:absolute;top:0;left:0;bottom:0;right:0;pointer-events:none;}"};function wd(t,e){Hi(e,!0),Ua(t,xd);const n=(t,n=jn,i=jn,r=jn,l=jn)=>{var c=bd(),u=Go(c),d=t=>{var e=gd();let o;as((t=>{o=Ya(e,1,"cover-image svelte-1rvgxfc",null,o,{"content-playing":n(),"force-show":i().showCover}),al(e,"src",t),al(e,"alt",i().name),al(e,"fetchpriority",r())}),[()=>s().getCoverUrl(i().cover,a)]),Zs("load",e,(function(...t){var e;null===(e=l())||void 0===e||e.apply(this,t)})),function(t){if(!Si)return;t.removeAttribute("onload"),t.removeAttribute("onerror");const e=t.__e;void 0!==e&&(t.__e=void 0,queueMicrotask((()=>{t.isConnected&&t.dispatchEvent(e)})))}(e),ca(t,e)};Ma(u,(t=>{t(d)}));var h=Ko(u,2);!function(t,e){Hi(e,!0),Ua(t,vd);const n={color:"#e3e3e3",fadeTime:300,lineWidth:8},i=ud(e.gallery.interaction((t=>{const{direction:n}=t.detail;var i;if("left"===n)null===(i=e.gallery)||void 0===i||i.next(),e.onEvent("swipe",[-1,0]);else if("right"===n){var r;null===(r=e.gallery)||void 0===r||r.prev(),e.onEvent("swipe",[1,0])}}),{elementid:"swiper"}),(()=>({touchAction:"pan-y",plugins:e.debug?[fd(n)]:[]}))),r=hd((function(t){const{x:n,y:i}=t.detail;e.onEvent("click",{x:n,y:i})}),(()=>({touchAction:"pan-y"})));var o=la(),s=Ho(o),a=t=>{var e=pd();ll(e,(()=>({...i,...r,class:"swiper"})),void 0,void 0,void 0,"svelte-1fv6njc"),ca(t,e)},l=t=>{var e=md();ll(e,(()=>({...r,class:"swiper"})),void 0,void 0,void 0,"svelte-1fv6njc"),ca(t,e)};Ma(s,(t=>{e.swipeEnabled?t(a):t(l,!1)})),ca(t,o),Ki()}(h,{get gallery(){return s()},get debug(){return e.debug},get swipeEnabled(){return e.swipeEnabled},get onEvent(){return e.onEvent}});var f=Ko(h,2),p=t=>{var e=yd();!function(t,e,n){Si&&Ni();var i=new Ia(t);ls((()=>{var t,r=null!==(t=e())&&void 0!==t?t:null;i.ensure(r,r&&(t=>n(t,r)))}),ri)}(Go(e),(()=>i().Component),((t,e)=>{e(t,{get state(){return i().state},get gallery(){return s()},get isMobile(){return o()}})})),Fi(e),ca(t,e)};Ma(f,(t=>{var e;s().state.themeLoaded&&null!==(e=i())&&void 0!==e&&e.Component&&t(p)})),Fi(c),ca(t,c)};let i,r=gl(e,"scrollOffset",15),o=gl(e,"isMobile",3,!1),s=gl(e,"gallery",7),a=1920,l=s().state.playingModulePosition,c=0,u=null,d=null,h=po((()=>!s().state.introModulePlayed&&s().state.introModule)),f=po((()=>s().state.startedPlaying)),p=po((()=>s().state.currentModulesList)),m=po((()=>Gs(p).findIndex((t=>g(s().state.playingModulePosition,t.position))))),v=!1;function g(t,e){return t.itemIndex===e.itemIndex&&t.moduleIndex===e.moduleIndex}function y(t){const e=t.scrollLeft,n=t.scrollWidth-t.clientWidth;return 0===e?0:e>n?100:e/n*100}function b(t){var e,n;u=(null===(e=Gs(p)[t])||void 0===e?void 0:e.position)||null;const r=null===(n=i)||void 0===n||null===(n=n.children)||void 0===n?void 0:n[t];if(!i||!r)return;const o=i.getBoundingClientRect(),s=r.getBoundingClientRect();let a=i.scrollLeft+(s.left-o.left);const l=Math.max(0,i.scrollWidth-i.clientWidth);a=Math.max(0,Math.min(l,a)),i.scrollTo({left:a,behavior:"auto"})}function k(t){var e;if(Gs(h))return;o()&&t.preventDefault();const{target:n}=t,a=y(n),f=(null===(e=Gs(p))||void 0===e?void 0:e.length)||1,v=100/(f-1||1),b=Math.round(a/v);c=Math.min(b,f-1);const k=Gs(p)[c],x={itemIndex:s().state.activeItemIndex,moduleIndex:s().state.activeModuleIndex};if(!u){const t=i.children[Gs(m)],e=i.getBoundingClientRect(),n=t.getBoundingClientRect();r(n.x-e.x)}d&&clearTimeout(d),d=setTimeout((()=>{const t=y(n);Math.abs(t-b*v)<.25&&async function(){s().state.seeking&&(s().state.playerLoaded?s().state.currentItemsList[s().state.activeItemIndex].modules[s().state.activeModuleIndex].play():s().state.playingModulePosition=l,r(0))}()}),u?0:150),null!==u||g(k.position,x)?null!==u&&g(k.position,u)&&(u=null):(s().state.activeItemIndex=k.position.itemIndex,s().state.activeModuleIndex=k.position.moduleIndex),l=k.position}function x(){v||(s().track("coverdisplay"),v=!0)}is((()=>{const{activeItemIndex:t,activeModuleIndex:e}=s().state;t===l.itemIndex&&e===l.moduleIndex||Xs((()=>{b(Gs(p).findIndex((n=>{const{itemIndex:i,moduleIndex:r}=n.position;return t===i&&e===r})))}))})),is((()=>{Gs(m)>-1&&!u&&c!==Gs(m)&&Xs((()=>b(Gs(m))))})),is((()=>{const{seeking:t,startedPlaying:e,currentItem:n}=s().state;!t&&e&&Xs((()=>{s().preloadVariantsCovers(n,a)}))})),is((()=>{Gs(f)&&Xs((()=>{s().track("projectstartedplaying")}))}));var w=la(),_=Ho(w),I=t=>{var e=kd(),r=Go(e),o=t=>{n(t,(()=>Gs(f)),(()=>Gs(h)),(()=>"high"),(()=>x))},a=t=>{var e=la();Fa(Ho(e),19,(()=>Gs(p)),(t=>t.id),((t,e,i)=>{n(t,(()=>Gs(f)&&Gs(i)===Gs(m)),(()=>Gs(e)),(()=>0===Gs(i)?"high":"auto"),(()=>0!==Gs(i)||s().state.introModule?()=>{}:x))})),ca(t,e)};Ma(r,(t=>{Gs(h)?t(o):t(a,!1)})),Fi(e),ml(e,(t=>i=t),(()=>i)),Zs("scroll",e,k),ca(t,e)};Ma(_,(t=>{Gs(p)&&t(I)})),ca(t,w),Ki()}const _d="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};let Id;function Td(){const t=_d&&_d.navigator&&(_d.navigator.userAgent||_d.navigator.platform||_d.navigator.vendor)||"";if(Id&&Id.ua===t)return Id;const e=t.toLowerCase(),n=e.includes("android"),i=e.includes("iphone")||e.includes("ipad")||e.includes("ipod")||e.includes("ios"),r=n||i||e.includes("mobile");return Id={ua:t,isMobile:r},Id}const Ed=(t,e,n)=>{const i=t[e];return i?"function"==typeof i?i():Promise.resolve(i):new Promise(((t,i)=>{("function"==typeof queueMicrotask?queueMicrotask:setTimeout)(i.bind(null,new Error("Unknown variable dynamic import: "+e+(e.split("/").length!==n?". Note that variables only represent file names one level deep.":""))))}))},Sd=3e3,Md=new Set;const Ad="https://storage.eko.com/efu/ekoanalytics/master/latest/EkoAnalyticsPlatform.min.gz.js";function Nd(t){var e,n;if("undefined"==typeof window||null!==(e=window.EkoAnalytics)&&void 0!==e&&e.cb||null!==(n=window.EkoAnalytics)&&void 0!==n&&n.configure)return;if(function(t){let e,n;"undefined"==typeof window||(e=window,n="EkoAnalytics",e[n]=function(){e[n].f?(e[n].q.push(arguments),e[n].ts.push(Date.now())):e[n].apply(e,arguments)},e[n].f=!0,e[n].q=e[n].q||[],e[n].ts=e[n].ts||[],e[n].t=Number(new Date),e[n].sa=[],e[n].cb=[],e[n].init=function(t){e[n].id=t},e[n].childRequestIdsCallback=function(t){t.data&&"ea-ids-request"===t.data.type&&e[n].sa.push(t.source)},e.addEventListener("message",e[n].childRequestIdsCallback)),window.EkoAnalytics.cb.push((()=>{let t=(t,e,n="")=>{let i=window.location.hostname,r=i,o=i.split(".");o.length>2&&(r=o.slice(-2).join(".")),window.document.cookie=`${t}=${e}; domain=.${r}; path=/; secure; samesite=lax; ${n}`};t("easid",encodeURIComponent(window.EkoAnalytics("getSid"))),t("eauid",encodeURIComponent(window.EkoAnalytics("getUid")),"max-age=2147483647")})),window.EkoAnalytics("configure",{snowplow:{options:{appId:"ekoGalleryApp"}},ekoEnv:t?"production":"development",env:"website"})}(!t||"production"===t),!window.EkoAnalytics)return void console.warn("Failed to load LUDA script.");if(0===document.querySelectorAll(`script[src="${Ad}"]`).length){const t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src=Ad,document.head.appendChild(t)}}var Fd,Cd;"undefined"!=typeof window&&(window.addEventListener("pageshow",(function(t){t.persisted&&setTimeout((function(){window.location.reload()}),10)}),!1),null===(Fd=(Cd=window).EkoAnalytics)||void 0===Fd||Fd.call(Cd,"track","init"));function Od(t,e){var n,i;return null!==(n=null===(i=e.variantMap)||void 0===i?void 0:i[t])&&void 0!==n?n:t}function Pd(t,e,n){const i=Od(t,e);return n.variants[i]?i:n.availableVariants[0]}let Rd=!1;var Dd=oa('<div class="paging-buttons svelte-1n46o8q"><!> <!></div>'),Bd=oa("<!> <!> <!>",1),Ld=oa('<div style="position: absolute; top: 0; left: 0; width: 100%;"></div>'),zd=oa('<div class="player-container svelte-1n46o8q"><div class="player-div swipable svelte-1n46o8q"></div> <!> <!> <!></div> <!>',1),Wd=oa("<div><!></div>");const jd={hash:"svelte-1n46o8q",code:'.eko-gallery-app.svelte-1n46o8q {position:relative;width:100%;height:100%;display:flex;flex-direction:column;box-sizing:border-box;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;}.eko-gallery-app.svelte-1n46o8q:hover .paging-buttons:where(.svelte-1n46o8q) .nav-button {background-color:var(--nav_arrow_bgColor_hover, #FFFFFF);box-shadow:var(--nav_arrow_boxShadow_hover, 0 0 8px 0 rgba(0, 0, 0, 0.12));}.eko-gallery-app.svelte-1n46o8q * {box-sizing:border-box;touch-action:pan-y;font-family:var(--fontName, "Human BBY Digital"), sans-serif;}.player-container.svelte-1n46o8q {position:relative;flex:1;width:100%;pointer-events:none;overflow:hidden;border-radius:var(--playerContainer_borderRadius, 16px);display:flex;align-items:center;justify-content:center;}.player-container.svelte-1n46o8q .pause-button {opacity:var(--pauseButton_opacity, 1);}.player-container.svelte-1n46o8q:hover .pause-button {opacity:var(--pauseButton_opacity_hover, 1);}.player-div.svelte-1n46o8q {position:absolute;width:var(--videoWidth);height:var(--videoHeight);aspect-ratio:var(--videoAspect);}.swipable.svelte-1n46o8q {will-change:transform;transform:translate3d(var(--uiTranformX, 0), 0, 0);}.paging-buttons.svelte-1n46o8q {position:absolute;top:0;left:0;bottom:0;right:0;display:flex;justify-content:space-between;align-items:center;pointer-events:none;padding:0 12px;}.paging-buttons.svelte-1n46o8q .nav-button {transition:0.2s ease-in-out;box-shadow:none;}.paging-buttons.svelte-1n46o8q .nav-button img {opacity:0.6;}'};function $d(t,e){Hi(e,!0),Ua(t,jd);let n=gl(e,"config",19,(()=>({}))),i=gl(e,"variant",7),r=gl(e,"forceMobile",3,!1),o=gl(e,"videoAspectRatio",3,"unset"),s=gl(e,"loadAnalytics",3,!0),a=gl(e,"onGalleryReady",3,(()=>{})),l=gl(e,"onEvent",3,(()=>{}));var c;!Rd&&s()&&(Nd(null===(c=n())||void 0===c||null===(c=c.options)||void 0===c?void 0:c.galleryEnv),Rd=!0);let u,d=!1,h=To(Oo(new Su({...n(),onEvent:l()}))),f=To(null),p=po((()=>r()||Td().isMobile)),m=po((()=>{var t;return e.theme||(null===(t=n())||void 0===t||null===(t=t.options)||void 0===t?void 0:t.theme)})),v=po((()=>{var t;return Gs(p)&&!(null!==(t=n())&&void 0!==t&&null!==(t=t.options)&&void 0!==t&&t.disableSwipes)})),g=po((()=>{var t,e;return Gs(p)?null===(t=n())||void 0===t||null===(t=t.layout)||void 0===t?void 0:t.mobile:null===(e=n())||void 0===e||null===(e=e.layout)||void 0===e?void 0:e.desktop})),y=po((()=>{var t;return null===(t=Gs(g))||void 0===t?void 0:t.hideNav})),b=To(0),k=To(void 0),x=To(!0),w=To(Oo({width:"100%",height:"100%"}));var _,I;function T(){const t={AssetsDeliveryService:{assetsDeliveryServiceUrl:Gs(h).urls.assetsDeliveryBase},Tracker:{tag:Gs(h).uuid}};So(f,new e.EkoPlayer(u,function(t,...e){function n(t){return"[object Object]"===Object.prototype.toString.call(t)}function i(t,e){if(Array.isArray(e)){Array.isArray(t)||(t=Array.isArray(t)?t.slice():[]);const r=Math.max(t.length,e.length);for(let o=0;o<r;o++){const r=t[o],s=e[o];null!=s&&(n(r)&&n(s)?t[o]=i({...r},s):Array.isArray(r)&&Array.isArray(s)?t[o]=i(r.slice(),s):n(s)?t[o]=i({},s):Array.isArray(s)?t[o]=i([],s):t[o]=s)}return t}if(n(e)){n(t)||(t={});for(const r of Object.keys(e)){const o=t[r],s=e[r];n(o)&&n(s)?t[r]=i({...o},s):Array.isArray(o)&&Array.isArray(s)?t[r]=i(o.slice(),s):n(s)?t[r]=i({},s):Array.isArray(s)?t[r]=i([],s):void 0!==s&&(t[r]=s)}return t}return e}for(const n of e)null!==n&&i(t,n);return t}({},e.playerOptions,t))),Gs(f).on("playing",(()=>{Gs(h).state.paused=!1})),Gs(f).on("pause",(()=>{Gs(h).state.paused=!0})),Gs(f).once("playing",(()=>{Gs(h).state.startedPlaying=!0,l()("galleryloaded")}))}function E(t){var e;null===(e=Gs(h))||void 0===e||e.selectItem(t)}function S(){var t;null===(t=Gs(h))||void 0===t||t.next()}function M(){var t;null===(t=Gs(h))||void 0===t||t.prev()}function A(){Gs(f).paused?Gs(f).play():Gs(f).pause()}function N(){return`--uiTranformX: ${Gs(b)}px;--videoAspect: ${o()};--videoWidth: ${Gs(w).width};--videoHeight: ${Gs(w).height};`}_="state",I=()=>Gs(h).state,Xi("setContext").set(_,I),Gs(h).state.activeVariant=Pd(i(),n(),Gs(h).state),Ta((()=>(a()(Du(Gs(h))),n()&&e.EkoPlayer&&(T(),Gs(h).start(Gs(f))),()=>{var t;null===(t=Gs(f))||void 0===t||t.dispose(),Gs(h).dispose()}))),is((()=>{n()&&e.EkoPlayer&&(d?Xs((()=>{So(x,!1),Vs().then((()=>{var t;return Gs(h).dispose(),So(h,new Su({...n(),onEvent:l()}),!0),Gs(h).state.activeVariant=Pd(i(),n(),Gs(h).state),null===(t=Gs(f))||void 0===t||t.dispose(),So(x,!0),Vs()})).then((()=>{a()(Du(Gs(h))),T(),Gs(h).start(Gs(f))}))})):d=!0)})),is((()=>{!Rd&&s()&&(Nd(Xs((()=>{var t;return null===(t=n())||void 0===t||null===(t=t.options)||void 0===t?void 0:t.galleryEnv}))),Rd=!0)})),is((()=>{const t=Od(i(),Xs((()=>n())));t&&t!==Xs((()=>Gs(h).state.activeVariant))&&Gs(h).selectVariant(t)})),is((()=>{const t=Xs((()=>Od(i(),n())));Gs(h).state.activeVariant!==t&&Xs((()=>{i(Gs(h).state.activeVariant)}))})),is((()=>{Gs(k)&&Gs(f)&&Gs(f).loadDebugOverlay({containerElement:Gs(k)})})),is((()=>{if("unset"!==o()&&o().includes("/")){const[t,e]=o().split("/").map((t=>Number(t)));isNaN(t)||isNaN(e)||So(w,t>e?{width:"100%",height:"auto"}:{width:"auto",height:"100%"},!0)}else So(w,{width:"100%",height:"100%"},!0)})),is((()=>{!async function(t,e){if(t&&!Md.has(t)){e.state.themeLoaded=!1;try{let n;try{n=await Ed(Object.assign({"../themes/smg.scss":()=>Promise.resolve({}),"../themes/walmart.scss":()=>Promise.resolve({}),"../themes/wayfair.scss":()=>Promise.resolve({})}),`../themes/${t}.scss`,3)}catch(t){console.error(t)}if(!n||"Module"!==n[Symbol.toStringTag]){const n=`${e.urls.galleryAppDelivery}/${e.version}/${t}.css`,i=document.createElement("link");i.rel="stylesheet",i.href=n;const r=new Promise(((t,e)=>{const n=setTimeout((()=>{e("timeout")}),Sd);i.onload=()=>{t(),clearTimeout(n)}}));document.head.appendChild(i),await r}Md.add(t)}catch(e){console.warn(`[eko-gallery-app] failed to load theme: ${t}`,e)}e.state.themeLoaded=!0}else e.state.themeLoaded=!0}(Gs(m),Gs(h))}));var F=Wd(),C=Go(F),O=t=>{const n=po((()=>Gs(h).state.introModule));var i=zd(),r=Ho(i),o=Go(r);ml(o,(t=>u=t),(()=>u));var s=Ko(o,2);wd(s,{get isMobile(){return Gs(p)},get gallery(){return Gs(h)},get debug(){return e.debug},get swipeEnabled(){return Gs(v)},get onEvent(){return l()},get scrollOffset(){return Gs(b)},set scrollOffset(t){So(b,t,!0)}});var a=Ko(s,2),c=t=>{var e=Bd(),n=Ho(e),i=t=>{var e=Dd(),n=Go(e);Vu(n,{type:"prev",onClick:M}),Vu(Ko(n,2),{type:"next",onClick:S}),Fi(e),ca(t,e)};Ma(n,(t=>{Gs(v)||Gs(y)||t(i)}));var r=Ko(n,2),o=t=>{Xu(t,{get gallery(){return Gs(h)},get isMobile(){return Gs(p)}})};Ma(r,(t=>{var e;(null===(e=Gs(h).state.currentItem)||void 0===e?void 0:e.modules.length)>1&&t(o)}));var s=Ko(r,2),a=t=>{!function(t,e){Hi(e,!0),Ua(t,Zu);const n=Gi("state");let i=po((()=>n().paused));var r=Ju(),o=po((()=>e.gallery.interaction(e.onPauseClick)));r.__click=function(...t){var e;null===(e=Gs(o))||void 0===e||e.apply(this,t)};var s=Go(r),a=t=>{ca(t,Yu())},l=t=>{ca(t,Qu())};Ma(s,(t=>{Gs(i)?t(a):t(l,!1)})),Fi(r),as((()=>{al(r,"aria-label",Gs(i)?"Play":"Pause"),al(r,"data-interactiontype",Gs(i)?"play":"pause")})),ca(t,r),Ki()}(t,{onPauseClick:A,get gallery(){return Gs(h)}})};Ma(s,(t=>{Gs(h).state.startedPlaying&&t(a)})),ca(t,e)};Ma(a,(t=>{Gs(n)&&!Gs(h).state.introModulePlayed||!Gs(h).state.themeLoaded||t(c)}));var d=Ko(a,2),f=t=>{var n=la(),i=Ho(n),r=t=>{var e=Ld();ml(e,(t=>So(k,t)),(()=>Gs(k))),ca(t,e)};Ma(i,(t=>{e.debug&&t(r)})),ca(t,n)};Ma(d,(t=>{Gs(h).state.startedPlaying&&t(f)})),Fi(r);var m=Ko(r,2),g=t=>{ju(t,{onNavItemClick:E,get gallery(){return Gs(h)}})};Ma(m,(t=>{Gs(y)||Gs(n)&&!Gs(h).state.introModulePlayed||t(g)})),as((t=>Ja(r,t)),[N]),ca(t,i)};Ma(C,(t=>{n()&&Gs(x)&&t(O)})),Fi(F),as((()=>Ya(F,1,"eko-gallery-app "+(Gs(m)?`theme-${Gs(m)}`:""),"svelte-1n46o8q"))),ca(t,F),Ki()}function Ud(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var qd,Vd,Gd,Hd,Kd={exports:{}},Xd=Ud((qd||(qd=1,Gd=Kd.exports,Hd=function(){var t=function(){},e="undefined",n=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},o=null;function s(t,e){var n=t[e];if("function"==typeof n.bind)return n.bind(t);try{return Function.prototype.bind.call(n,t)}catch(e){return function(){return Function.prototype.apply.apply(n,[t,arguments])}}}function a(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function l(){for(var n=this.getLevel(),r=0;r<i.length;r++){var o=i[r];this[o]=r<n?t:this.methodFactory(o,n,this.name)}if(this.log=this.debug,typeof console===e&&n<this.levels.SILENT)return"No console available for logging"}function c(t){return function(){typeof console!==e&&(l.call(this),this[t].apply(this,arguments))}}function u(i,r,o){return"debug"===(l=i)&&(l="log"),typeof console!==e&&("trace"===l&&n?a:void 0!==console[l]?s(console,l):void 0!==console.log?s(console,"log"):t)||c.apply(this,arguments);var l}function d(t,n){var s,a,c,d=this,h="loglevel";function f(){var t;if(typeof window!==e&&h){try{t=window.localStorage[h]}catch(t){}if(typeof t===e)try{var n=window.document.cookie,i=encodeURIComponent(h),r=n.indexOf(i+"=");-1!==r&&(t=/^([^;]+)/.exec(n.slice(r+i.length+1))[1])}catch(t){}return void 0===d.levels[t]&&(t=void 0),t}}function p(t){var e=t;if("string"==typeof e&&void 0!==d.levels[e.toUpperCase()]&&(e=d.levels[e.toUpperCase()]),"number"==typeof e&&e>=0&&e<=d.levels.SILENT)return e;throw new TypeError("log.setLevel() called with invalid level: "+t)}"string"==typeof t?h+=":"+t:"symbol"==typeof t&&(h=void 0),d.name=t,d.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},d.methodFactory=n||u,d.getLevel=function(){return null!=c?c:null!=a?a:s},d.setLevel=function(t,n){return c=p(t),!1!==n&&function(t){var n=(i[t]||"silent").toUpperCase();if(typeof window!==e&&h){try{return void(window.localStorage[h]=n)}catch(t){}try{window.document.cookie=encodeURIComponent(h)+"="+n+";"}catch(t){}}}(c),l.call(d)},d.setDefaultLevel=function(t){a=p(t),f()||d.setLevel(t,!1)},d.resetLevel=function(){c=null,function(){if(typeof window!==e&&h){try{window.localStorage.removeItem(h)}catch(t){}try{window.document.cookie=encodeURIComponent(h)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(t){}}}(),l.call(d)},d.enableAll=function(t){d.setLevel(d.levels.TRACE,t)},d.disableAll=function(t){d.setLevel(d.levels.SILENT,t)},d.rebuild=function(){if(o!==d&&(s=p(o.getLevel())),l.call(d),o===d)for(var t in r)r[t].rebuild()},s=p(o?o.getLevel():"WARN");var m=f();null!=m&&(c=p(m)),l.call(d)}(o=new d).getLogger=function(t){if("symbol"!=typeof t&&"string"!=typeof t||""===t)throw new TypeError("You must supply a name when creating a logger.");var e=r[t];return e||(e=r[t]=new d(t,o.methodFactory)),e};var h=typeof window!==e?window.log:void 0;return o.noConflict=function(){return typeof window!==e&&window.log===o&&(window.log=h),o},o.getLoggers=function(){return r},o.default=o,o},(Vd=Kd).exports?Vd.exports=Hd():Gd.log=Hd()),Kd.exports));const Yd=()=>{},Qd=["trace","log","debug","info","warn","error","getLevel","setLevel"],Jd=["trace","debug","info","warn","error","silent"],Zd={TRACE:"color: white; background-color: magenta;",DEBUG:"color: black; background-color: turquoise;",INFO:"color: white; background-color: green;",WARN:"color: black; background-color: yellow;",ERROR:"color: white; background-color: red;"},th="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global;let eh={level:"trace",appName:""},nh=[];const ih="object"==typeof th&&th.performance&&"function"==typeof th.performance.now?th.performance.now.bind(th.performance):Date.now.bind(Date),rh=t=>t&&"string"==typeof t?t.toLowerCase().trim():"",oh=(()=>{try{const t=new URLSearchParams(document.location.search),e=[].concat(t.getAll("log")).concat(t.getAll("ekolog")).concat(t.getAll("ekologger")).join(",").split(",");if(0===e.length)return{};let n={};return e.forEach((t=>{const[e,i]=t.split(":");n[rh(e)]=rh(i)||"trace"})),n}catch(t){return{}}})(),sh=(t,e="")=>{const n=rh(t),i=Xd.getLogger(n);if(i.__ekologger)return i.__ekologger;e||oh[n]||oh["*"]||(i.__noExplicitLevel=!0);const r=i.methodFactory;i.methodFactory=(e,n,i)=>{const o=r(e,n,i),s=e.toUpperCase();return(...e)=>{o(`[${((t,e=3)=>(ih()/1e3).toFixed(e))()}] %c[${s}] ${eh.appName?`[${eh.appName}] `:""}[${t}]`,Zd[s],...e)}},e=oh[n]||oh["*"]||e||eh.level,i.setLevel(e,!1);const o=(...t)=>i.log(...t);return Qd.forEach((t=>{o[t]=(...e)=>(nh.forEach((n=>{n[t](...e)})),i[t](...e))})),i.__ekologger=o,o};sh.setDefaults=({appName:t="",level:e})=>{t&&"string"==typeof t&&(eh.appName=t),(e=rh(e))&&Jd.includes(e)&&(eh.level=e,Object.values(Xd.getLoggers()).filter((t=>t.__noExplicitLevel)).forEach((t=>t.setLevel(eh.level,!1))))},sh.installDriver=t=>{const e={...Qd.reduce(((e,n)=>(e[n]="function"==typeof(null==t?void 0:t[n])?t[n]:Yd,e)),{})};nh.push(e)};let ah=class{#S=new Map;on(t,e){if("function"!=typeof e)return this;const n=this.#S.get(t)||new Set;return n.add(e),this.#S.set(t,n),this}once(t,e){if("function"!=typeof e)return this;const n=(...i)=>(this.off(t,n),e(...i));return this.on(t,n)}off(t,e){if(!t)return this.#S.clear(),this;const n=this.#S.get(t);return n?e?(n.delete(e),0===n.size&&this.#S.delete(t),this):(this.#S.delete(t),this):this}trigger(t,...e){const n=this.#S.get(t);return n?(n.forEach((t=>t(...e))),this):this}};function lh(t){return"[object Object]"===Object.prototype.toString.call(t)}function ch(t,...e){const n=lh(t)?{...t}:{};return e.forEach((t=>{lh(t)&&Object.keys(t).forEach((e=>{const i=t[e],r=n[e];lh(i)&&lh(r)?n[e]=ch(r,i):Array.isArray(i)?n[e]=i.slice():n[e]=i}))})),n}function uh(t){if("string"==typeof t)return`'${t}'`;if(Array.isArray(t))return`[${t.map((t=>uh(t))).join(", ")}]`;if(lh(t))try{return JSON.stringify(t)}catch(t){return"[object Object]"}return null===t?"null":void 0===t?"undefined":String(t)}function dh(t){return Array.from(t).map((t=>uh(t))).join(", ")}var hh=new WeakSet;class fh extends ah{constructor(...t){super(),$(this,hh);const e=t.length?t[t.length-1]:void 0,n=this.name;if(!n||"string"!=typeof n)throw new Error("Extending classes must implement get name() returning a string.");this.log=sh(n,this.loglevel);const i=lh(this.defaults)?this.defaults:{},r=lh(e)&&lh(e[n])?e[n]:{};this.settings=ch({},i,r),B(hh,this,ph).call(this),B(hh,this,mh).call(this)}get name(){throw new Error("BaseModuleClass requires a name getter.")}get loglevel(){return"warn"}get defaults(){return{}}get methodsExcludedFromAutoLog(){return new Set(["constructor","on","off","once","trigger","#wrapMethodsForLogging"])}dispose(){this._disposed||(this._disposed=!0,"function"==typeof this._lifecycleCleanup&&(this._lifecycleCleanup(),this._lifecycleCleanup=null),"function"==typeof this.onDispose&&this.onDispose())}onDispose(){}}function ph(){const t=new Set,e=this.methodsExcludedFromAutoLog;let n=Object.getPrototypeOf(this);for(;n&&n!==Object.prototype;){const i=Object.getOwnPropertyNames(n);for(let r=0;r<i.length;r+=1){const o=i[r];if("constructor"===o||o.startsWith("#"))continue;if(t.has(o))continue;const s=Object.getOwnPropertyDescriptor(n,o);if(!s||"function"!=typeof s.value)continue;const a=s.value.bind(this),l=!e.has(o);this[o]=l?(...t)=>(this.log&&"function"==typeof this.log.debug&&this.log.debug(`${this.name}.${o}(${dh(t)})`),a(...t)):a,t.add(o)}n=Object.getPrototypeOf(n)}}function mh(){if("undefined"==typeof window||"function"!=typeof window.addEventListener)return;const t=()=>{try{"function"==typeof this.dispose&&this.dispose()}catch(t){this.log&&"function"==typeof this.log.error&&this.log.error("dispose failed",t)}};window.addEventListener("pagehide",t),window.addEventListener("beforeunload",t),this._lifecycleCleanup=()=>{window.removeEventListener("pagehide",t),window.removeEventListener("beforeunload",t)}}const vh="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};function gh(t){return Boolean(t)&&"object"==typeof t&&1===t.nodeType&&"function"==typeof t.appendChild}const yh=Object.freeze({NODE_ADD:"node:add",NODE_CHILDREN_CHANGED:"node:childrenchanged",NODE_LOADED:"node:loaded",NODE_LOAD_ERROR:"node:loaderror",PLACEMENT_ADDED:"placement:added",RENDER_PLACEMENT_ADDED:"renderplacement:added",TIMELINE_TIME_UPDATE:"timeline:timeupdate",TIMELINE_STATE_CHANGE:"statechange",TIMELINE_SEEKING:"seeking",TIMELINE_SEEKED:"seeked",TIMELINE_RESET:"timeline:reset",TIMELINE_PLAYER_STATE:"player:state",TIMELINE_CUEPOINT:"cuepoint",VISUAL_FRAMES_AVAILABLE:"visualframesavailable",TRACK_BUFFER_UPDATE:"track:bufferupdate",TRACK_READY:"track:ready",TRACK_UNDERFLOW:"track:underflow",CLOCK_TICK:"tick",DECODE_READY:"decode:ready",DECODE_ERROR:"decode:error",DECODER_AUDIO:"decoder:audio",DECODER_FRAME:"decoder:frame",DECODER_INIT:"decoder:init",DECODER_ERROR:"decoder:error",QOE_SCORE:"qoescore",QOE_STATUS:"qoestatus",CONTAINER_RESIZE:"containerresize",CANVAS_WEBGL_CONTEXT_LOST:"canvas.webglcontextlost",CANVAS_WEBGL_CONTEXT_RESTORED:"canvas.webglcontextrestored"});function bh(t,e){const n={};return Number.isFinite(t)&&(n.time=t),"string"==typeof e&&(n.source=e),n}function kh({placementId:t,nodeId:e,trackId:n,segmentId:i,trackType:r,pts:o,duration:s,frame:a,audioBuffer:l}={}){const c={};return t&&(c.placementId=t),e&&(c.nodeId=e),n&&(c.trackId=n),i&&(c.segmentId=i),r&&(c.trackType=r),Number.isFinite(o)&&(c.pts=o),Number.isFinite(s)&&(c.duration=s),a&&(c.frame=a),l&&(c.audioBuffer=l),c}function xh({placementId:t,nodeId:e,trackId:n,segmentId:i,trackType:r,error:o}={}){const s={};return t&&(s.placementId=t),e&&(s.nodeId=e),n&&(s.trackId=n),i&&(s.segmentId=i),r&&(s.trackType=r),o&&(s.error=o),s}var wh=new WeakMap,_h=new WeakMap,Ih=new WeakMap,Th=new WeakMap,Eh=new WeakMap,Sh=new WeakMap,Mh=new WeakMap,Ah=new WeakSet;class Nh extends fh{get defaults(){return{style:{width:"100%",height:"100%"},contextAttributes:{alpha:!1,depth:!1,stencil:!1,antialias:!1,preserveDrawingBuffer:!1,powerPreference:"low-power"}}}constructor(...t){var e,n;super(...t),$(this,Ah),W(this,wh,void 0),W(this,_h,void 0),W(this,Ih,void 0),W(this,Th,void 0),W(this,Eh,void 0),W(this,Sh,void 0),W(this,Mh,void 0);const[i,r=null]=t;j(Sh,this,r);const o=function(t,e=(null==vh?void 0:vh.document)){if(gh(t))return t;const n="string"==typeof t?t:null;if(!n||!e||"function"!=typeof e.querySelector)return null;const i=e.querySelector(n);return gh(i)?i:null}(i);if(!o)throw new Error("Canvas requires a valid mount target (HTMLElement or selector string).");j(wh,this,o);const s=null==vh?void 0:vh.document;if(!s||"function"!=typeof s.createElement)throw new Error("Canvas requires document.createElement.");var a,l;j(_h,this,s.createElement("canvas")),a=z(_h,this),l=null===(e=this.settings)||void 0===e?void 0:e.style,a&&l&&"object"==typeof l&&!Array.isArray(l)&&Object.keys(l).forEach((t=>{const e=l[t];null!=e&&(a.style[t]=String(e))})),z(wh,this).appendChild(z(_h,this));const c=null===(n=this.settings)||void 0===n?void 0:n.contextAttributes,u=c&&"object"==typeof c&&!Array.isArray(c)?c:void 0;if(j(Mh,this,u),j(Ih,this,z(_h,this).getContext("webgl2",u)),!z(Ih,this))throw new Error("Canvas WebGL2 context is not available.");B(Ah,this,Ch).call(this)}get name(){return"Canvas"}get element(){return z(_h,this)}get gl(){return z(Ih,this)}onDispose(){B(Ah,this,Oh).call(this),z(_h,this)&&z(_h,this).parentNode&&z(_h,this).parentNode.removeChild(z(_h,this)),j(Ih,this,null),j(_h,this,null),j(wh,this,null),j(Sh,this,null),j(Mh,this,null),j(Th,this,null),j(Eh,this,null)}}function Fh(t,e){var n,i;this.trigger(t,e),null===(n=z(Sh,this))||void 0===n||null===(i=n.trigger)||void 0===i||i.call(n,t,e)}function Ch(){z(_h,this)&&(j(Th,this,(t=>{"function"==typeof(null==t?void 0:t.preventDefault)&&t.preventDefault(),this.log.error("WebGL context lost",t),B(Ah,this,Fh).call(this,yh.CANVAS_WEBGL_CONTEXT_LOST,t)})),j(Eh,this,(t=>{var e;j(Ih,this,(null===(e=z(_h,this))||void 0===e?void 0:e.getContext("webgl2",z(Mh,this)))||null),z(Ih,this)?B(Ah,this,Fh).call(this,yh.CANVAS_WEBGL_CONTEXT_RESTORED,t):this.log.error("WebGL context restored event fired but WebGL2 context is still unavailable.",t)})),z(_h,this).addEventListener("webglcontextlost",z(Th,this)),z(_h,this).addEventListener("webglcontextrestored",z(Eh,this)))}function Oh(){z(_h,this)&&(z(_h,this).removeEventListener("webglcontextlost",z(Th,this)),z(_h,this).removeEventListener("webglcontextrestored",z(Eh,this)))}var Ph=new WeakMap,Rh=new WeakMap,Dh=new WeakMap,Bh=new WeakMap,Lh=new WeakMap,zh=new WeakMap,Wh=new WeakSet;class jh extends fh{get name(){return"ContainerSize"}get containerWidth(){return z(Rh,this)}get containerHeight(){return z(Dh,this)}get width(){return z(Rh,this)}get height(){return z(Dh,this)}constructor(...t){super(...t),$(this,Wh),W(this,Ph,void 0),W(this,Rh,0),W(this,Dh,0),W(this,Bh,null),W(this,Lh,null),W(this,zh,null);const[e]=t;var n;j(Ph,this,(n=e)&&n.element&&gh(n.element)?n.element:gh(n)?n:null),z(Ph,this)&&(B(Wh,this,Uh).call(this,!0),B(Wh,this,$h).call(this))}onDispose(){z(Bh,this)&&"function"==typeof z(Bh,this).disconnect&&z(Bh,this).disconnect(),j(Bh,this,null),z(zh,this)&&"function"==typeof(null==vh?void 0:vh.removeEventListener)&&vh.removeEventListener("resize",z(zh,this)),j(zh,this,null),z(Lh,this)&&((null==vh?void 0:vh.clearInterval)||clearInterval)(z(Lh,this)),j(Lh,this,null),j(Ph,this,null)}}function $h(){if(!z(Ph,this))return;const t=null==vh?void 0:vh.ResizeObserver;if("function"==typeof t)return j(Bh,this,new t((()=>B(Wh,this,Uh).call(this)))),void z(Bh,this).observe(z(Ph,this));j(zh,this,(()=>B(Wh,this,Uh).call(this))),"function"==typeof(null==vh?void 0:vh.addEventListener)&&vh.addEventListener("resize",z(zh,this));const e=(null==vh?void 0:vh.setInterval)||setInterval;j(Lh,this,e((()=>B(Wh,this,Uh).call(this)),250))}function Uh(t=!1){if(!z(Ph,this))return;const{width:e,height:n}=function(t){const e=Number(null==t?void 0:t.clientWidth),n=Number(null==t?void 0:t.clientHeight);return{width:Number.isFinite(e)&&e>0?Math.round(e):0,height:Number.isFinite(n)&&n>0?Math.round(n):0}}(z(Ph,this));(t||e!==z(Rh,this)||n!==z(Dh,this))&&(j(Rh,this,e),j(Dh,this,n),this.trigger("containerresize",{width:e,height:n}))}var qh={VIDEO_SOURCE_PREFIX:"__SRC_VID:",TEXTURE_SOURCE_PREFIX:"__SRC_TEXTURE:",PREVIOUS_OUTPUT_PREFIX:"__PREVIOUS:",SAVED_FRAME_PREFIX:"__SAVED_FRAME:",SYSTEM_NODES:{FILTERS:{RENDER_TO_CANVAS:"__default"},TAGS:{ATOM:"atom",FILTER:"filter",COMPOSITE_FILTER:"composite",TRANSITION_FILTER:"transition"}},MESSAGES:{UPDATE_OPTIONS:"update_options"}};class Vh{constructor(t,e){this.canvasSource=t,this.startRendering=e,this.gl=null,this.glOptions=null}init(t,e,n){this.glOptions=n||{};const i=this.initCanvas(this.canvasSource,t,e);return this.initWebgl(i,this.glOptions)}initCanvas(){throw new Error("implement on concrete class")}getContextConfig(t={}){if(!t||"object"!=typeof t)return{contextType:"webgl",contextAttributes:void 0};const{contextType:e,contextAttributes:n,__shaderGraph:i,...r}=t,o=Object.prototype.hasOwnProperty.call(t,"contextAttributes");let s=o?n:r;return o||!s||"object"!=typeof s||Array.isArray(s)||0!==Object.keys(s).length||(s=void 0),{contextType:e||"webgl",contextAttributes:s}}initWebgl(t,e={}){const{contextType:n,contextAttributes:i}=this.getContextConfig(e),r=t.getContext(n,i);if(!r)throw new Error(`Browser doesn't support ${n}`);return r.enable(r.BLEND),r.disable(r.DEPTH_TEST),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),r}isStartRendering(){return this.startRendering}}var Gh,Hh={exports:{}},Kh=(Gh||(Gh=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function i(){}function r(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,i,o,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");var a=new r(i,o||t,s),l=n?n+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],a]:t._events[l].push(a):(t._events[l]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new i:delete t._events[e]}function a(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),a.prototype.eventNames=function(){var t,i,r=[];if(0===this._eventsCount)return r;for(i in t=this._events)e.call(t,i)&&r.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},a.prototype.listeners=function(t){var e=n?n+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,o=i.length,s=new Array(o);r<o;r++)s[r]=i[r].fn;return s},a.prototype.listenerCount=function(t){var e=n?n+t:t,i=this._events[e];return i?i.fn?1:i.length:0},a.prototype.emit=function(t,e,i,r,o,s){var a=n?n+t:t;if(!this._events[a])return!1;var l,c,u=this._events[a],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,i),!0;case 4:return u.fn.call(u.context,e,i,r),!0;case 5:return u.fn.call(u.context,e,i,r,o),!0;case 6:return u.fn.call(u.context,e,i,r,o,s),!0}for(c=1,l=new Array(d-1);c<d;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var h,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(t,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,e);break;case 3:u[c].fn.call(u[c].context,e,i);break;case 4:u[c].fn.call(u[c].context,e,i,r);break;default:if(!l)for(h=1,l=new Array(d-1);h<d;h++)l[h-1]=arguments[h];u[c].fn.apply(u[c].context,l)}}return!0},a.prototype.on=function(t,e,n){return o(this,t,e,n,!1)},a.prototype.once=function(t,e,n){return o(this,t,e,n,!0)},a.prototype.removeListener=function(t,e,i,r){var o=n?n+t:t;if(!this._events[o])return this;if(!e)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==e||r&&!a.once||i&&a.context!==i||s(this,o);else{for(var l=0,c=[],u=a.length;l<u;l++)(a[l].fn!==e||r&&!a[l].once||i&&a[l].context!==i)&&c.push(a[l]);c.length?this._events[o]=1===c.length?c[0]:c:s(this,o)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&s(this,e)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,t.exports=a}(Hh)),Hh.exports),Xh=Ud(Kh);class Yh extends Vh{constructor(t){super(t,!0),this.setSrcVidTracksFn=null,this.shouldUpdateTexture=!0,this.onPlayerSeeking=this.onPlayerSeeking.bind(this),this.onPlayerSeeked=this.onPlayerSeeked.bind(this),this.onPlayerNodeStart=this.onPlayerNodeStart.bind(this),this.oncePlayerPlaying=this.oncePlayerPlaying.bind(this);const e=new Xh;this.on=e.on.bind(e),this.off=e.off.bind(e),this.once=e.once.bind(e),this.trigger=e.emit.bind(e)}onPlayerSeeking(){this.shouldUpdateTexture=!1}onPlayerSeeked(){this.shouldUpdateTexture=!0}onPlayerNodeStart(){this.shouldUpdateTexture=!0,"function"==typeof this.player.canvas.drawFrame&&this.player.canvas.drawFrame(),this.trigger("forcerender")}oncePlayerPlaying(){this.onPlayerNodeStart()}addPlayerListeners(){this.player&&(this.player.on("seeking",this.onPlayerSeeking),this.player.on("seeked",this.onPlayerSeeked),this.player.on("nodestart",this.onPlayerNodeStart),this.player.once("playing",this.oncePlayerPlaying))}removePlayerListeners(){this.player&&(this.player.off("seeking",this.onPlayerSeeking),this.player.off("seeked",this.onPlayerSeeked),this.player.off("nodestart",this.onPlayerNodeStart),this.player.off("playing",this.oncePlayerPlaying))}initCanvas(t,e,n){var i;this.player=t,this.setSrcVidTracksFn=e;const{contextType:r,contextAttributes:o}=this.getContextConfig(this.glOptions),s=!1!==(null===(i=this.glOptions)||void 0===i||null===(i=i.__shaderGraph)||void 0===i?void 0:i.forwardContextAttributes)&&null!=(a=o)&&"object"==typeof a&&!Array.isArray(a)&&Object.keys(a).length>0;var a;const l={contextType:r};s&&(l.contextAttributes=o),t.initPlugin("canvas",l);const c={drawFrame:this.canvasDrawFrameFn.bind(this),resize:n,contextType:r,offscreenVideoCanvasEnabled:!1,viewportModeEnabled:!0,fps:0};return s&&(c.contextAttributes=o),t.canvas.init(c),t.paused&&0===t.currentTime&&(this.shouldUpdateTexture=!1),this.addPlayerListeners(),t.canvas.canvas}canvasDrawFrameFn(t,e,n){var i;this.setSrcVidTracksFn&&this.shouldUpdateTexture&&t&&e&&n&&(n.videoWidth||n.displayWidth)&&(n.videoHeight||n.displayHeight)&&(!(i=n)||"boolean"!=typeof i.isDataLoaded||i&&i.isDataLoaded&&(void 0===i.isFrameTextureReady||i.isFrameTextureReady))&&this.setSrcVidTracksFn(n)}async recover(){if(this.player&&this.player.paused)return new Promise((t=>{this.player.once("seeked",(()=>{this.shouldUpdateTexture=!0,t()})),this.player.currentTime=this.player.currentTime}))}dispose(){this.player&&(this.player.canvas&&"function"==typeof this.player.canvas.dispose&&this.player.canvas.dispose(),this.removePlayerListeners(),this.player=null)}}class Qh extends Vh{constructor(t){super(t,!1)}initCanvas(t,e){const n=function(){const t=document.querySelector("video");t&&t.videoHeight&&e(t),requestAnimationFrame(n)};return requestAnimationFrame(n),document.getElementById(t)}}class Jh extends Vh{constructor(t){super(t,!1)}initCanvas({src:t,dest:e},n,i){const r="string"==typeof e?document.querySelector(e):e,o="undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement,s=()=>{this.isDisposed||(t&&t.videoHeight&&n(t),requestAnimationFrame(s))};return o?requestAnimationFrame(s):"function"==typeof t?t(n,i):n(t),r}dispose(){this.isDisposed=!0}}var Zh=function(t){let e;return e="string"==typeof t?new Qh(t):t&&t.src&&t.dest?new Jh(t):new Yh(t),e};function tf(t){return Array.isArray(t)||(t=[t]),t}class ef{constructor(t){this.store=t?{...t.get()}:{}}reset(){this.store={}}get(t){if(!t)return this.store;const e=(t=tf(t)).reduce(((t,e)=>{const n=this.store[e];return t.push(n),t}),[]);return 1===e.length?e[0]:e}set(t,e){if(t=tf(t),e=tf(e),t.length!==e.length)throw new Error(`cant set values ${e} to keys ${t}, length did not match`);t.forEach(((t,n)=>{this.store[t]=e[n]}))}}class nf{constructor(t,e,n,i){this.gl=i.gl,this.unit=t,this.bindPoint=e,this.height=1080,this.width=1920,this.textureObject=n.object,this.textureObjectInfo=n,this.isStatic=!1,n.needRefresh&&this.setParameters()}getUnit(){return this.unit}getObject(){return this.textureObject}bind(){this.gl.bindTexture(this.bindPoint,this.textureObject)}fill(){throw new Error("impl in concrete class")}setParameters(){this.bind(),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR)}active(){this.gl.activeTexture(this.gl.TEXTURE0+this.getUnit())}beforeUse(){this.active(),this.bind()}dispose(){this.gl.deleteTexture(this.textureObject)}setHeight(t){this.height=t}setWidth(t){this.width=t}getHeight(){if(!this.height)throw new Error(`texture ${this.unit} no height init `);return this.height}getWidth(){if(!this.width)throw new Error(`texture ${this.unit} no width init `);return this.width}}const rf=sh("frame","warn");let of=!1;if("undefined"!=typeof window&&window.InterludePlayer){let t=window.InterludePlayer.environment,e=t.isAffectedBySafari17SeekBug,n=t.ua.includes("WMT1H")&&t.ua.includes("iOS/17");of=e||n}function sf(t,e){const n=t.gl;var i;n.texImage2D(t.bindPoint,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e),t.__hasAllocated=!0,i=t,Number.isFinite(i.width)&&Number.isFinite(i.height)&&(i.actualWidth=i.width,i.actualHeight=i.height,i.textureObjectInfo&&(i.textureObjectInfo.allocatedWidth=i.width,i.textureObjectInfo.allocatedHeight=i.height))}class af extends nf{fill(t){if(of&&(t.paused||"undefined"!=typeof document&&"hidden"===document.visibilityState))return;if(t.__closed)return;this.bind();const e=function(t,e){let n=!t.__hasAllocated;return e?(e.width===t.width&&e.height===t.height||(n=!0),t.width=e.width,t.height=e.height,n):n}(this,function(t){if(!t)return;const e=[[t.displayWidth,t.displayHeight],[t.codedWidth,t.codedHeight],[t.videoWidth,t.videoHeight],[t.naturalWidth,t.naturalHeight],[t.width,t.height]];for(let t=0;t<e.length;t+=1){const[n,i]=e[t],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}(t)),n=performance.now();!function(t,e,n){const i=t.gl,r=function(t){if("undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement)return!0;const e="object"==typeof window?window:"object"==typeof self?self:null,n=e&&e.VideoFrame;return"function"==typeof n&&t instanceof n}(e);r&&(t.__useSubImage=!1),n||!1===t.__useSubImage||r?sf(t,e):(i.texSubImage2D(t.bindPoint,0,0,0,i.RGBA,i.UNSIGNED_BYTE,e),void 0===t.__useSubImage&&(i.getError()!==i.NO_ERROR?(t.__useSubImage=!1,sf(t,e)):t.__useSubImage=!0))}(this,t,e);const i=(performance.now()-n)/1e3;i>=.1&&rf.warn(`[fill] texImage2D() took ${i.toFixed(3)} seconds to execute.`),"function"==typeof t.close&&!0!==t.__keepOpen&&(t.close(),t.__closed=!0)}}class lf extends nf{constructor(t,e,n){super(...arguments),n.needRefresh&&(this.fill(null),n.needRefresh=!1)}fill(t){if(this.bind(),t&&t.tagName&&"IMG"===t.tagName){const e=Number(t.naturalWidth||t.width),n=Number(t.naturalHeight||t.height);this.gl.texImage2D(this.bindPoint,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),Number.isFinite(e)&&Number.isFinite(n)&&(this.actualWidth=e,this.actualHeight=n,this.textureObjectInfo&&(this.textureObjectInfo.allocatedWidth=e,this.textureObjectInfo.allocatedHeight=n))}else{const e=this.gl.canvas.width,n=this.gl.canvas.height;this.gl.texImage2D(this.bindPoint,0,this.gl.RGBA,e,n,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),Number.isFinite(e)&&Number.isFinite(n)&&(this.actualWidth=e,this.actualHeight=n,this.textureObjectInfo&&(this.textureObjectInfo.allocatedWidth=e,this.textureObjectInfo.allocatedHeight=n))}}}var cf=function(t,e,n,i,r){let o;switch(t){case"frame":o=new af(e,n,i,r);break;case"pixel":o=new lf(e,n,i,r);break;default:throw new Error(`cant recognize type ${t}`)}return o};class uf{constructor(t){this.gl=t.gl;const e=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS)||20;return this.maxTextures=Math.min(20,e),this.textureObjectPool=[],this.textureUnitsPool=new Set(Array(this.maxTextures).keys()),this.activeTextures=t.activeTextures instanceof Set?t.activeTextures:new Set,{createTexture:this.createTexture.bind(this),releaseTexture:this.releaseTexture.bind(this),refreshTextureObjects:this.refreshTextureObjects.bind(this),refreshActiveTextures:this.refreshActiveTextures.bind(this)}}getTextureObject(){return this.textureObjectPool.pop()||{object:this.gl.createTexture(),needRefresh:!0}}getTextureUnit(){const t=this.textureUnitsPool.values(),e=Math.min.apply(null,[...t]);return this.textureUnitsPool.delete(e),e}createTexture(t){const e=t&&t.type||{},n=this.gl.TEXTURE_2D,i=this.getTextureUnit(),r=this.getTextureObject(),o=cf(e,i,n,r,{gl:this.gl});return this.activeTextures.add(o),o}releaseTexture(t){this.textureUnitsPool.has(t.getUnit())||(this.textureObjectPool.push({object:t.getObject(),needRefresh:!1}),this.textureUnitsPool.add(t.getUnit())),this.activeTextures.delete(t)}refreshTextureObjects(){this.textureObjectPool.forEach((t=>{t.needRefresh=!0}))}refreshActiveTextures(){const t=new Set;this.activeTextures.forEach((e=>{if(!e||"function"!=typeof e.getUnit)return;t.add(e.getUnit());const n={object:this.gl.createTexture(),needRefresh:!0};e.gl=this.gl,e.textureObjectInfo=n,e.textureObject=n.object,e.__hasAllocated=!1,e.__useSubImage=void 0,e.actualWidth=null,e.actualHeight=null,"function"==typeof e.setParameters&&e.setParameters()})),this.textureObjectPool=[],this.textureUnitsPool=new Set(Array(this.maxTextures).keys()),t.forEach((t=>{this.textureUnitsPool.delete(t)}))}}const df=qh.VIDEO_SOURCE_PREFIX,hf=qh.TEXTURE_SOURCE_PREFIX,ff=qh.PREVIOUS_OUTPUT_PREFIX,pf=qh.SAVED_FRAME_PREFIX;function mf(t,e,n){t.set(`${df}${n}`,e)}function vf(t,e,n){t.set(`${ff}${n}`,e)}function gf(t,e,n){t.set(`${pf}${n}`,e)}class yf{constructor(t){return this.gl=t.gl,this.glSource=t.glSource,this.textureManager=t.textureManager,this.capturedFramesManager=t.capturedFramesManager,{setVideoSources:this.setVideoSources.bind(this),setTextureSource:this.setTextureSource.bind(this),getInput:this.getInput.bind(this),getPrevOutput:this.getPrevOutput.bind(this),setOutputs:this.setOutputs.bind(this),disposeTextures:this.disposeTextures.bind(this),disposeAllStore:this.disposeAllStore.bind(this)}}setVideoSources(t){for(const[e,n]of Object.entries(this.capturedFramesManager.getCurrentFrames()))mf(t,n,e),vf(t,n,e);for(const[e,n]of Object.entries(this.capturedFramesManager.getSavedFrames()))gf(t,n,e)}setTextureSource(t,e,n){t.set(`${hf}${n}`,e)}getInput(t,e){return t.get(e)}getPrevOutput(t,e){return e=Number.isInteger(e)?e:0,t.get(`${ff}${e}`)}setOutputs(t,e=[],n=[]){if(Array.isArray(n)||(n=[n]),e.length>n.length)throw new Error(`output ids ${e.length} is bigger then supplied outputs ${n.length}`);n.forEach(((e,n)=>{vf(t,e,n)})),e.forEach(((e,i)=>{t.set(e,n[i])}))}disposeTextures(t,e){const n=e.getUnit();t.forEach((t=>{const e=t.getUnit();this.capturedFramesManager.isReservedUnit(e)||n===e||this.textureManager.releaseTexture(t)}))}disposeAllStore(t){const e=new Set;Object.values(t.get()).forEach((t=>{const n=t.getUnit();this.capturedFramesManager.isReservedUnit(n)||e.has(n)||t.isStatic||(this.textureManager.releaseTexture(t),e.add(n))}))}}class bf{constructor(t){this.context=t}bind(){throw new Error("impl in concrete")}}let kf=100,xf=100;function wf(t,e){kf=t,xf=e}let _f=class extends bf{bind(t){var e,n;this.context.gl.bindFramebuffer(this.context.gl.FRAMEBUFFER,null);const i=null===(e=this.context.gl)||void 0===e||null===(e=e.canvas)||void 0===e?void 0:e.width,r=null===(n=this.context.gl)||void 0===n||null===(n=n.canvas)||void 0===n?void 0:n.height;return Number.isFinite(i)&&Number.isFinite(r)&&i>0&&r>0&&(this.context.gl.viewport(0,0,i,r),wf(i,r)),t}},If=class extends bf{bind(t){Array.isArray(t)||(t=[t]),this.context.gl.bindFramebuffer(this.context.gl.FRAMEBUFFER,this.context.frameBufferObject);const e=this.context.textureManager.createTexture({type:"pixel"}),n=this.context.gl.COLOR_ATTACHMENT0;if(this.context.gl.framebufferTexture2D(this.context.gl.FRAMEBUFFER,n,this.context.gl.TEXTURE_2D,e.textureObject,0),this.context.gl.clear(this.context.gl.COLOR_BUFFER_BIT),!0===this.context.useCanvasSizedFilterTargets){var i,r;const t=null===(i=this.context.gl)||void 0===i||null===(i=i.canvas)||void 0===i?void 0:i.width,n=null===(r=this.context.gl)||void 0===r||null===(r=r.canvas)||void 0===r?void 0:r.height;Number.isFinite(t)&&t>0&&e.setWidth(t),Number.isFinite(n)&&n>0&&e.setHeight(n);const o=e.textureObjectInfo,s=null==o?void 0:o.allocatedWidth,a=null==o?void 0:o.allocatedHeight;Number.isFinite(t)&&Number.isFinite(n)&&(s!==t||a!==n)&&"function"==typeof e.fill&&e.fill(null)}else t[0]&&(e.setHeight(t[0].getHeight()),e.setWidth(t[0].getWidth()));return e}};class Tf{constructor(t){this.gl=t.gl,this.textureManager=t.textureManager,this.useCanvasSizedFilterTargets=t.useCanvasSizedFilterTargets,this.bufferIndex=0,this.frameBufferObjectsPool=[this.gl.createFramebuffer(),this.gl.createFramebuffer(),this.gl.createFramebuffer()]}getFrameBufferObject(){const t=this.frameBufferObjectsPool[this.bufferIndex];return this.bufferIndex=this.bufferIndex++%this.frameBufferObjectsPool.length,t}create(t){let e;return e=t===qh.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS?new _f({gl:this.gl}):new If({gl:this.gl,textureManager:this.textureManager,frameBufferObject:this.getFrameBufferObject(),useCanvasSizedFilterTargets:this.useCanvasSizedFilterTargets}),e}}function Ef(t,e,n){const i=e===t.VERTEX_SHADER?"vertex":"fragment";var r;r=t,Boolean(r)&&("undefined"!=typeof WebGL2RenderingContext&&r instanceof WebGL2RenderingContext||"function"==typeof r.createVertexArray)&&(n=function(t="",e){if("string"!=typeof t||!t||function(t=""){return"string"==typeof t&&t.includes("#version 300 es")}(t))return t;let n=t;if("vertex"===e&&(n=n.replace(/\battribute\b/g,"in"),n=n.replace(/\bvarying\b/g,"out")),"fragment"===e&&(n=n.replace(/\bvarying\b/g,"in"),n=n.replace(/\bgl_FragColor\b/g,"fragColor")),n=n.replace(/\btexture2D\b/g,"texture"),n=`#version 300 es\n${n}`,"fragment"===e&&n.includes("fragColor")&&!/\bout\s+vec4\s+fragColor\s*;/.test(n)){const t=n.split("\n");let e=1;for(let n=1;n<t.length;n+=1)if(t[n].trim().startsWith("precision ")){e=n+1;break}t.splice(e,0,"out vec4 fragColor;"),n=t.join("\n")}return n}(n,i));const o=t.createShader(e);if(!o)throw new Error(`Failed to create ${i} shader`);if(t.shaderSource(o,n),t.compileShader(o),t.getShaderParameter(o,t.COMPILE_STATUS))return o;const s=t.getShaderInfoLog(o);throw t.deleteShader(o),new Error(s)}var Sf=function(t,e){return Ef(t,t.VERTEX_SHADER,e)},Mf=function(t,e){return Ef(t,t.FRAGMENT_SHADER,e)};const Af={position_3d:0,texture_coordinate_2d:1};var Nf=function(t,e,n){const i=t.createProgram();if(t.attachShader(i,e),t.attachShader(i,n),Object.entries(Af).forEach((([e,n])=>{t.bindAttribLocation(i,n,e)})),t.linkProgram(i),t.getProgramParameter(i,t.LINK_STATUS))return i;const r=t.getProgramInfoLog(i);throw t.deleteProgram(i),new Error(r)},Ff=[-1,-1,1,1,-1,1,-1,1,1,1,1,1],Cf=[0,1,2,2,1,3],Of=[0,0,1,0,0,1,1,1];const Pf=96,Rf=[new Float32Array(new ArrayBuffer(Pf)),new Float32Array(new ArrayBuffer(Pf)),new Float32Array(new ArrayBuffer(Pf)),new Float32Array(new ArrayBuffer(Pf)),new Float32Array(new ArrayBuffer(Pf)),new Float32Array(new ArrayBuffer(Pf))],Df=[new Int16Array(6),new Int16Array(6),new Int16Array(6)];class Bf{constructor(t,e,n){return this.gl=n.gl,this.program=n.program,this.bindPoint=e,this.location=this.gl.getAttribLocation(this.program,t),this.buffer=this.gl.createBuffer(),this.floatBufferCounter=0,this.unit16BufferCounter=0,{fillBuffer:this.fillBuffer.bind(this),bindBuffer:this.bindBuffer.bind(this),setPointer:this.setPointer.bind(this),dispose:this.dispose.bind(this)}}enable(){this.gl.enableVertexAttribArray(this.location)}bindBuffer(){this.gl.bindBuffer(this.bindPoint,this.buffer)}getBuffer(){let t;switch(this.bindPoint){case this.gl.ARRAY_BUFFER:t=Rf[this.floatBufferCounter],this.floatBufferCounter=this.floatBufferCounter++%Rf.length;break;case this.gl.ELEMENT_ARRAY_BUFFER:t=Df[this.unit16BufferCounter],this.unit16BufferCounter=this.unit16BufferCounter++%Df.length;break;default:throw new Error("cant get buffer for this bind point: ",this.bindPoint)}return t}fillBuffer(t){this.bindBuffer();const e=this.getBuffer();e.set(t,0),this.gl.bufferData(this.bindPoint,e,this.gl.STATIC_DRAW)}getPointerData(){throw new Error("you should impl this function")}setPointer(){this.bindBuffer(),this.enable();const t=this.getPointerData();this.gl.vertexAttribPointer(this.location,t.size,t.type,t.normalize,t.stride,t.offset)}dispose(){this.gl.deleteBuffer(this.buffer)}}const Lf={position_3d:class extends Bf{getPointerData(){return{size:3,type:this.gl.FLOAT,normalize:!1,stride:0,offset:0}}},position_indexes:class extends Bf{setPointer(){}getPointerData(){}enable(){}},texture_coordinate_2d:class extends Bf{getPointerData(){return{size:2,type:this.gl.FLOAT,normalize:!0,stride:0,offset:0}}}};var zf=function(t,e,n){const i=Lf[t];if(!i)throw new Error(`${t} is not a attribute name,choose from list: ${Object.keys(Lf)}`);return new i(t,e,n)};class Wf{constructor(t,e){this.gl=e.gl,this.program=e.program,this.location=this.gl.getUniformLocation(this.program,t)}compute(){return this}set(){return this}}class jf extends Wf{set(t){this.gl.uniform1fv(this.location,t)}}class $f extends Wf{set(t){t&&(t.beforeUse(),this.gl.uniform1i(this.location,t.getUnit()))}}const Uf="first_texture_dimensions",qf="viewport_dimensions",Vf="time",Gf={RUNTIME_OPTIONS:"runtimeOptions[0]",STATIC_OPTIONS:"staticOptions[0]",FIRST_TEXTURE:"first_texture",SECOND_TEXTURE:"second_texture",FIRST_MATRIX:"first_mat4"},Hf={[Gf.FIRST_TEXTURE]:$f,[Gf.SECOND_TEXTURE]:$f,[Gf.FIRST_MATRIX]:class extends Wf{set(t){this.gl.uniformMatrix4fv(this.location,!1,t)}},[Gf.STATIC_OPTIONS]:jf,[Gf.RUNTIME_OPTIONS]:jf};var Kf=function(t,e){const n=Hf[t];if(!n)throw new Error(`${t} is not a attribute name,choose from list: ${Object.keys(Hf)}`);return new n(t,e)},Xf=function(t,e){let n=(Date.now()-t||0)/(e||1);return n=Number.parseFloat(n).toFixed(7),n=Math.min(1,n),n};const Yf="position_3d",Qf="position_indexes",Jf="texture_coordinate_2d";class Zf{constructor(t,e,n,i){this.type=t,this.gl=i.gl,this.frameBuffer=i.frameBufferFactory.create(t),this.rebindAttributesOnProgramSwitch=!1!==i.rebindAttributesOnProgramSwitch,this.vertexShader=Sf(this.gl,e.vertex),this.fragmentShader=Mf(this.gl,e.fragment),this.program=Nf(this.gl,this.vertexShader,this.fragmentShader);const r={gl:this.gl,program:this.program};this.attributes=function(t,e){const n={};return t=t||[],(t=[{id:Yf,bindPoint:e.gl.ARRAY_BUFFER},{id:Qf,bindPoint:e.gl.ELEMENT_ARRAY_BUFFER},{id:Jf,bindPoint:e.gl.ARRAY_BUFFER}].concat(t)).forEach((t=>{const i=t.id;n[i]=zf(i,t.bindPoint,e)})),n}(n.attributes,r),this.uniforms=function(t,e){const n={};return(t=t||[]).forEach((t=>{const i=t.id;n[i]=Kf(i,e)})),n}(n.uniforms,r),this.gl.useProgram(this.program),i.__handleAttributesInitedOnce||(this.handleAttributes(),i.__handleAttributesInitedOnce=!0),this.handleStaticUniforms(i.options)}static getFilterType(){throw new Error("impl in concrete class")}static getInputsCount(){throw new Error(`impl in concrete class ${this.getFilterType()}`)}static getInitialOptions(){throw new Error(`impl in concrete class ${this.getFilterType()}`)}static getUniformInfo(t){let e=[{id:Gf.RUNTIME_OPTIONS},{id:Gf.STATIC_OPTIONS}];return(t.getUniformList||Zf.getUniformList)().forEach((t=>{Object.values(Gf).includes(t)&&e.push({id:t})})),e}handleRuntimeUniforms(t,e){const{inputTextures:n,viewportDimensions:i}=t;let r=Array.isArray(n)?n:[n],o=[];(this.constructor.getUniformList||Zf.getUniformList)().forEach((t=>{switch(t){case Gf.FIRST_TEXTURE:this.uniforms[Gf.FIRST_TEXTURE].set(r[0]);break;case Gf.SECOND_TEXTURE:this.uniforms[Gf.SECOND_TEXTURE].set(r[1]);break;case Uf:o=[...o,r[0].getWidth(),r[0].getHeight()];break;case qf:o=[...o,i.width,i.height];break;case Vf:{const t=Xf(e.startTime,e.duration);o=[...o,t];break}}})),o.length>0&&this.uniforms[Gf.RUNTIME_OPTIONS].set(o)}static getUniformList(){return[Gf.FIRST_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(){}handleAttributes(){this.attributes[Yf].fillBuffer(Ff),this.attributes[Yf].setPointer(),this.attributes[Qf].fillBuffer(Cf),this.attributes[Jf].fillBuffer(Of),this.attributes[Jf].setPointer()}disposeAttributes(){Object.values(this.attributes).forEach((t=>{t.dispose()}))}render(t,e){const n=this.frameBuffer.bind(t);let i={width:kf,height:xf};return this.gl.useProgram(this.program),this.rebindAttributesOnProgramSwitch&&this.gl.__shaderGraphLastProgram!==this.program&&(this.handleAttributes(),this.gl.__shaderGraphLastProgram=this.program),this.handleRuntimeUniforms({inputTextures:t,viewportDimensions:i},e),this.draw(),n}draw(){const t=this.gl.TRIANGLES,e=this.gl.UNSIGNED_SHORT;this.gl.drawElements(t,6,e,0)}updateStaticUniforms(t){this.gl.useProgram(this.program),this.handleStaticUniforms(t)}dispose(){this.gl.detachShader(this.program,this.vertexShader),this.gl.deleteShader(this.vertexShader),this.gl.detachShader(this.program,this.fragmentShader),this.gl.deleteShader(this.fragmentShader),this.gl.deleteProgram(this.program)}}class tp extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(tp)};super(tp.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n // we need to flip y poisiton bacause webgl display the canvas\n // with 0,0 being the bottom left corner \n // insted of the traditional top left\n float flip_y_position = position_3d.y * (-1.0);\n vec4 normalize_poistion = vec4(position_3d.x, flip_y_position, position_3d.z, 1);\n \n gl_Position = normalize_poistion;\n \n current_texture_coordinate_2d = texture_coordinate_2d;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n gl_FragColor = texture2D(first_texture, current_texture_coordinate_2d);\n}"},e,t)}static getFilterType(){return"__default"}static getInputsCount(){return 1}static getInitialOptions(){return{}}}var ep,np="undefined"!=typeof Float32Array?Float32Array:Array;function ip(){var t=new np(3);return np!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function rp(t,e,n){var i=new np(3);return i[0]=t,i[1]=e,i[2]=n,i}function op(){var t=new np(4);return np!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}ip(),function(){var t;t=new np(4),np!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}(),ip(),rp(1,0,0),rp(0,1,0),op(),op(),ep=new np(9),np!=Float32Array&&(ep[1]=0,ep[2]=0,ep[3]=0,ep[5]=0,ep[6]=0,ep[7]=0),ep[0]=1,ep[4]=1,ep[8]=1;class sp extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(sp)};super(sp.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform mat4 first_mat4;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xy, 1, 1);\n\n gl_Position = first_mat4 * normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n gl_FragColor = texture2D(first_texture, current_texture_coordinate_2d);\n // gl_FragColor = vec4(256,0,0,1);\n}"},e,t)}static getFilterType(){return"transform"}static getInputsCount(){return 1}static getInitialOptions(){return{translate:{x:0,y:0},scale:{x:1,y:1},rotate:0}}getOptionsDisplay(){return[{properties:["translate","x"],type:"slider",minValue:-2,maxValue:2,step:.001,initialValue:sp.getInitialOptions().translate.x},{properties:["translate","y"],type:"slider",minValue:-2,maxValue:2,step:.001,initialValue:sp.getInitialOptions().translate.y},{properties:["scale","x"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:sp.getInitialOptions().scale.x},{properties:["scale","y"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:sp.getInitialOptions().scale.y},{properties:["rotate"],type:"slider",minValue:-360,maxValue:360,step:1,initialValue:sp.getInitialOptions().rotate}]}static getUniformList(){return[Gf.FIRST_TEXTURE,Gf.FIRST_MATRIX]}handleStaticUniforms(t){if(!t||!t.translate||!t.scale)throw new Error(`bad options object for Transform filter, check ${t}`);const e=Number.parseFloat(t.translate.x).toFixed(7),n=-1*Number.parseFloat(t.translate.y).toFixed(7),i=Number.parseFloat(t.scale.x).toFixed(7),r=Number.parseFloat(t.scale.y).toFixed(7),o=t.rotate||0;var s;this.transformMatrix=function(t,e,n,i){var r=e[0],o=e[1],s=e[2],a=e[3],l=r+r,c=o+o,u=s+s,d=r*l,h=r*c,f=r*u,p=o*c,m=o*u,v=s*u,g=a*l,y=a*c,b=a*u,k=i[0],x=i[1],w=i[2];return t[0]=(1-(p+v))*k,t[1]=(h+b)*k,t[2]=(f-y)*k,t[3]=0,t[4]=(h-b)*x,t[5]=(1-(d+v))*x,t[6]=(m+g)*x,t[7]=0,t[8]=(f+y)*w,t[9]=(m-g)*w,t[10]=(1-(d+p))*w,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}((s=new np(16),np!=Float32Array&&(s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[11]=0,s[12]=0,s[13]=0,s[14]=0),s[0]=1,s[5]=1,s[10]=1,s[15]=1,s),function(t,e,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",o=Math.PI/360;e*=o,i*=o,n*=o;var s=Math.sin(e),a=Math.cos(e),l=Math.sin(n),c=Math.cos(n),u=Math.sin(i),d=Math.cos(i);switch(r){case"xyz":t[0]=s*c*d+a*l*u,t[1]=a*l*d-s*c*u,t[2]=a*c*u+s*l*d,t[3]=a*c*d-s*l*u;break;case"xzy":t[0]=s*c*d-a*l*u,t[1]=a*l*d-s*c*u,t[2]=a*c*u+s*l*d,t[3]=a*c*d+s*l*u;break;case"yxz":t[0]=s*c*d+a*l*u,t[1]=a*l*d-s*c*u,t[2]=a*c*u-s*l*d,t[3]=a*c*d+s*l*u;break;case"yzx":t[0]=s*c*d+a*l*u,t[1]=a*l*d+s*c*u,t[2]=a*c*u-s*l*d,t[3]=a*c*d-s*l*u;break;case"zxy":t[0]=s*c*d-a*l*u,t[1]=a*l*d+s*c*u,t[2]=a*c*u+s*l*d,t[3]=a*c*d-s*l*u;break;case"zyx":t[0]=s*c*d-a*l*u,t[1]=a*l*d+s*c*u,t[2]=a*c*u-s*l*d,t[3]=a*c*d+s*l*u;break;default:throw new Error("Unknown angle order "+r)}return t}(op(),0,0,o),rp(e,n,0),rp(i,r,1)),this.uniforms[Gf.FIRST_MATRIX].set(this.transformMatrix)}}class ap extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(ap)};super(ap.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[2];\n\nvarying vec2 blur_texture_coordinate_2d[11];\n\n\nvoid main() {\n vec2 normalize_poistion = vec2(position_3d.xy);\n gl_Position = vec4(normalize_poistion, 1, 1);\n\n float texture_width = runtimeOptions[0];\n float pixel_width = 1.0 / texture_width;\n\n \n for(int i=-5; i<5; ++i){\n float current_i = float(i);\n blur_texture_coordinate_2d[i+5] = texture_coordinate_2d + vec2(pixel_width * current_i, 0.0); \n }\n}\n",fragment:"\nprecision lowp float;\n\nuniform sampler2D first_texture;\n\nvarying vec2 blur_texture_coordinate_2d[11];\n\nvoid main() {\n vec4 out_colour = vec4(0.0);\n\tout_colour += texture2D(first_texture, blur_texture_coordinate_2d[0]) * 0.0093;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[1]) * 0.028002;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[2]) * 0.065984;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[3]) * 0.121703;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[4]) * 0.175713;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[5]) * 0.198596;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[6]) * 0.175713;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[7]) * 0.121703;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[8]) * 0.065984;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[9]) * 0.028002;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[10]) * 0.0093;\n \n \n gl_FragColor = out_colour;\n}"},e,t)}static getFilterType(){return"horizontalBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[Gf.FIRST_TEXTURE,Uf]}}class lp extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(lp)};super(lp.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[2];\n\nvarying vec2 blur_texture_coordinate_2d[11];\n\n\nvoid main() {\n vec2 normalize_poistion = vec2(position_3d.xy);\n gl_Position = vec4(normalize_poistion, 1, 1);\n\n float texture_width = runtimeOptions[1];\n float pixel_height = 1.0 / texture_width;\n\n for(int i=-5; i<5; ++i){\n float current_i = float(i);\n blur_texture_coordinate_2d[i+5] = texture_coordinate_2d + vec2( 0.0, pixel_height * current_i);\n }\n}\n",fragment:"\nprecision lowp float;\n\nuniform sampler2D first_texture;\n\nvarying vec2 blur_texture_coordinate_2d[11];\n\nvoid main() {\n vec4 out_colour = vec4(0.0);\n\tout_colour += texture2D(first_texture, blur_texture_coordinate_2d[0]) * 0.0093;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[1]) * 0.028002;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[2]) * 0.065984;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[3]) * 0.121703;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[4]) * 0.175713;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[5]) * 0.198596;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[6]) * 0.175713;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[7]) * 0.121703;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[8]) * 0.065984;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[9]) * 0.028002;\n out_colour += texture2D(first_texture, blur_texture_coordinate_2d[10]) * 0.0093;\n \n \n gl_FragColor = out_colour;\n}"},e,t)}static getFilterType(){return"verticalBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[Gf.FIRST_TEXTURE,Uf]}}class cp extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(cp)};super(cp.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float staticOptions[3];\nuniform float runtimeOptions[4];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nconst float Depth = 3.;\nconst float Samples = 8.;\nfloat OffsetDist = staticOptions[0];\n\nvec2 srcDims = vec2(runtimeOptions[0], runtimeOptions[1]);\nvec2 vpDims = vec2(runtimeOptions[2], runtimeOptions[3]);\nvec2 iResolution = vpDims;\n\n\n#define TAU 6.28318530718\n\nvec4 RadialBlur(vec2 fragCoord, float radius) {\n if (radius <= 0.) {\n return texture2D(first_texture, fragCoord/iResolution.xy);\n }\n\n vec2 offset;\n float angle = 0.;\n vec4 color = vec4(0.);\n\n for(float angle = 0.; angle < TAU; angle += (TAU/Samples)) {\n offset = vec2(cos(angle), sin(angle)) * radius;\n color += texture2D(first_texture, (fragCoord + offset)/iResolution.xy);\n }\n\n return color/Samples;\n\n}\n\nvec4 FastBlur(vec2 fragCoord) {\n\n vec4 color;\n vec2 offset;\n float fib = 2.;\n float fibTotal = 0.;\n\n for(float i = 1.; i <= Depth; ++i) {\n fib += i;\n color += RadialBlur(fragCoord, i * OffsetDist)/ fib;\n fibTotal += 1./fib;\n }\n\n return color/fibTotal;\n\n}\n\n// based on https://www.shadertoy.com/view/3ljBDd\nvoid main() {\n// vec2 fragCoords = (vec2(current_texture_coordinate_2d) + 1.0) / 2.0 * vpDims;\n vec2 fragCoords = vec2(current_texture_coordinate_2d) * vpDims;\n gl_FragColor = FastBlur(fragCoords);\n}"},e,t)}static getFilterType(){return"fastBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[Gf.FIRST_TEXTURE,Uf,qf]}handleStaticUniforms(t){var e;const n=(null!==(e=Number.parseFloat(t.offsetDist))&&void 0!==e?e:4).toFixed(3);this.uniforms[Gf.STATIC_OPTIONS].set([n])}}class up extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(up)};super(up.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float staticOptions[2];\nuniform float runtimeOptions[4];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvec2 vpDims = vec2(runtimeOptions[2], runtimeOptions[3]);\n\n// A simple directional blur that doesn't brighten the image, based on https://www.shadertoy.com/view/WdSXWD\n// and https://www.shadertoy.com/view/NltSD4\n\nvec4 dirBlur() {\n float angle = staticOptions[0];\n float strength = staticOptions[1];\n if (strength == 0.0){\n return texture2D(first_texture, current_texture_coordinate_2d);\n }\n\n vec2 uv = current_texture_coordinate_2d;\n\n float r = radians(angle);\n vec2 direction = vec2(sin(r), cos(r));\n\n vec2 strengthDirection = strength * direction;\n vec3 acc = vec3(0);\n for(float i = -1.0; i <= 1.0; i += (2.0 / 50.0)) {\n acc += texture2D(first_texture, uv - vec2(strengthDirection.x * i, strengthDirection.y * i)).rgb * (2.0 / 50.0) * .5;\n }\n\n return vec4(acc, 1.0);\n\n}\n\nvoid main() {\n gl_FragColor = dirBlur();\n}"},e,t)}static getFilterType(){return"directionalBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[Gf.FIRST_TEXTURE,Uf,qf]}handleStaticUniforms(t){var e,n;const i=(null!==(e=Number.parseFloat(t.angle))&&void 0!==e?e:90).toFixed(3),r=(null!==(n=Number.parseFloat(t.strength))&&void 0!==n?n:.1).toFixed(3);this.uniforms[Gf.STATIC_OPTIONS].set([i,r])}}class dp extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(dp)};super(dp.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n \n current_texture_coordinate_2d = texture_coordinate_2d;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform float staticOptions[1];\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 texture = texture2D(first_texture, current_texture_coordinate_2d);\n float opacity = texture.w - (1.0 - staticOptions[0]);\n gl_FragColor = vec4((texture.xyz) , opacity);\n}"},e,t)}static getFilterType(){return"opacity"}static getInputsCount(){return 1}static getInitialOptions(){return{power:1}}getOptionsDisplay(){return[{properties:["power"],type:"slider",minValue:0,maxValue:1,step:.001}]}handleStaticUniforms(t){const e=Number.parseFloat(t.power).toFixed(7);this.uniforms[Gf.STATIC_OPTIONS].set([e])}}class hp extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(hp)};super(hp.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform sampler2D second_texture;\n\nuniform float staticOptions[7];\nuniform float runtimeOptions[2];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\n\nfloat roundedBoxSDF(vec2 point, vec2 center, vec2 area, float radius) {\n return length(max(abs(point - center) - area + radius, 0.0)) - radius;\n}\n\nfloat boxSDF(vec2 point, vec2 center, vec2 area){\n vec2 d = abs(point - center) - area;\n return length(max(d,vec2(0)));\n}\n\n\nvoid main() {\n float type = staticOptions[0];\n vec2 aspectRatio = vec2(runtimeOptions[0]/runtimeOptions[1], 1.0);\n\n\n vec2 center = vec2(staticOptions[1], staticOptions[2]) * aspectRatio;\n vec2 area = max(vec2(staticOptions[3], staticOptions[4]) * aspectRatio, 0.0); \n float radius = staticOptions[5];\n\n vec2 SDF_PositionCoordinate2d = vec2(\n current_position_coordinate_2d.x,\n current_position_coordinate_2d.y * -1.0\n ) * aspectRatio;\n\n vec4 color1 = texture2D(first_texture, current_texture_coordinate_2d);\n vec4 color2 = texture2D(second_texture, current_texture_coordinate_2d);\n\n float dist;\n vec4 color;\n if(type == 0.0){\n dist = boxSDF(SDF_PositionCoordinate2d, center, area);\n color = (dist > 0.0) ? color2: color1;\n } else {\n dist = roundedBoxSDF(SDF_PositionCoordinate2d, center, area, radius);\n color = (dist > 0.0) ? color2: color1;\n color = mix( color, color2, 1.0-smoothstep(0.0,0.0025,abs(dist)));\n }\n \n gl_FragColor = color;\n}"},e,t)}static getFilterType(){return"shapeCompositeMask"}static getInputsCount(){return 2}static getInitialOptions(){return{type:"box",center:{x:0,y:0},area:{width:0,height:0},radius:.01,edgeSoftness:0}}getOptionsDisplay(){return[{properties:["center","x"],type:"slider",minValue:-1,maxValue:1,step:.001},{properties:["center","y"],type:"slider",minValue:-1,maxValue:1,step:.001},{properties:["area","width"],type:"slider",minValue:-2,maxValue:2,step:.001},{properties:["area","height"],type:"slider",minValue:-2,maxValue:2,step:.001},{properties:["radius"],type:"slider",minValue:-2,maxValue:2,step:.001},{properties:["edgeSoftness"],type:"slider",minValue:-2,maxValue:2,step:.001}]}static getUniformList(){return[Gf.FIRST_TEXTURE,Uf,Gf.SECOND_TEXTURE]}handleStaticUniforms(t){let e;switch(t.type){case"box":e=0;break;case"rounded":e=1;break;default:throw new Error("cant recognize shape composite mask type")}const n=Number.parseFloat(t.center.x).toFixed(7);let i=Number.parseFloat(t.center.y).toFixed(7);i+=0;const r=Number.parseFloat(t.area.width).toFixed(7),o=Number.parseFloat(t.area.height).toFixed(7),s=Number.parseFloat(t.radius).toFixed(7),a=Number.parseFloat(t.edgeSoftness).toFixed(7);this.uniforms[Gf.STATIC_OPTIONS].set([e,n,i,r,o,s,a])}}class fp extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(fp)};super(fp.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform sampler2D second_texture;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 fgColor = texture2D(first_texture, current_texture_coordinate_2d);\n vec4 bgColor = texture2D(second_texture, current_texture_coordinate_2d);\n gl_FragColor = vec4(\n mix(bgColor.xyz, fgColor.xyz, fgColor.w),\n 1.0\n );\n // vec4 fgColor = texture2D(textures[1], current_texture_coordinate_2d);\n // if(fgColor.w > 0.0){\n // gl_FragColor = vec4(1.0,0,0,1);\n // }else{\n // gl_FragColor = vec4(1.0,1.0,0,1);\n // }\n \n \n}"},e,t)}static getFilterType(){return"shapeComposite"}static getInputsCount(){return 2}static getInitialOptions(){return{}}static getUniformList(){return[Gf.FIRST_TEXTURE,Gf.SECOND_TEXTURE]}}class pp extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(pp)};super(pp.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform sampler2D second_texture;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n // Look it up in the LUT\n vec4 textureColor = texture2D(first_texture, current_texture_coordinate_2d);\n\n mediump float blueColor = textureColor.b * 63.0;\n\n mediump vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n\n mediump vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n\n highp vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);\n\n\n highp vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);\n\n lowp vec4 newColor1 = texture2D(second_texture, texPos1);\n lowp vec4 newColor2 = texture2D(second_texture, texPos2);\n\n lowp vec4 color = mix(newColor1, newColor2, fract(blueColor));\n\n gl_FragColor = color;\n\n // debug\n// if (current_texture_coordinate_2d.x < 0.5) {\n// // Left half: show original\n// gl_FragColor = textureColor;\n// } else {\n// gl_FragColor = color;\n// }\n}\n"},e,t)}static getFilterType(){return"lut"}static getInputsCount(){return 2}static getInitialOptions(){return{}}static getUniformList(){return[Gf.FIRST_TEXTURE,Gf.SECOND_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(t){const e=Number.parseFloat(t.lutSize).toFixed(1);this.uniforms[Gf.STATIC_OPTIONS].set([e])}}var mp="attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",vp='precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\n\n// a 256 * 4 length array with values for the master, r, g and b curve respectively\n// Temporarily changed length to 256 to avoid the following error on some machines:\n// "Implementation limit of 4096 (e.g., number of built-in plus user defined active uniforms components) exceeded, fragment shader uses 4100 total uniforms."\nuniform float staticOptions[256];\n\n\n// implementation of round (doesn\'t exist in webgl)\nint round(float val){\n return int(floor(val + 0.5));\n}\n\n// no dynamic array indexes in webgl\n// see https://stackoverflow.com/questions/30585265/what-can-i-use-as-an-array-index-in-glsl-in-webgl\nfloat getCurveValue(float pixelValue){\n float v;\n for (int k = 0; k < 256; k++) {\n if (k == round(pixelValue * 255.0)){\n v = float(staticOptions[k]) / 255.0;\n }\n }\n return v;\n}\n\nvec3 masterCurve(vec4 color){\n float r = getCurveValue(color.r);\n float g = getCurveValue(color.g);\n float b = getCurveValue(color.b);\n// for (int k = 0; k < 256; ++k) {\n// if (k == int(color.g) * 256){\n// g = float(staticOptions[k]) / 256.0;\n// }\n// }\n// for (int k = 0; k < 256; ++k) {\n// if (k == int(color.b) * 256){\n// b = float(staticOptions[k]) / 256.0;\n// }\n// }\n return vec3(r,g,b);\n}\n\n//vec3 redCurve(vec3 color){\n// int offset = 256;\n// return vec3(staticOptions[int(int(color.r) + offset)], color.g, color.b);\n//}\n//\n//vec3 greenCurve(vec3 color){\n// int offset = 256 * 2;\n// return vec3(color.r, staticOptions[int(int(color.g) + offset)], color.b);\n//}\n//\n//vec3 blueCurve(vec3 color){\n// int offset = 256 * 3;\n// return vec3(color.r, color.g, staticOptions[int(int(color.b) + offset)]);\n//}\n\nvoid main() {\n// vec4 textureColor = texture2D(first_texture, current_texture_coordinate_2d);\n// vec3 afterMaster = masterCurve(textureColor);\n// vec3 afterRed = redCurve(afterMaster);\n// vec3 afterGreen = greenCurve(afterRed);\n// vec3 afterBlue = blueCurve(afterGreen);\n// vec4 finalColor = vec4(afterBlue, textureColor.a);\n\n vec4 textureColor = texture2D(first_texture, current_texture_coordinate_2d);\n vec3 afterMaster = masterCurve(textureColor);\n vec4 finalColor = vec4(afterMaster, textureColor.a);\n\n gl_FragColor = finalColor;\n}\n';const{abs:gp,cos:yp,sin:bp,acos:kp,atan2:xp,sqrt:wp,pow:_p}=Math;function Ip(t){return t<0?-_p(-t,1/3):_p(t,1/3)}const Tp=Math.PI,Ep=2*Tp,Sp=Tp/2,Mp=Number.MAX_SAFE_INTEGER||9007199254740991,Ap=Number.MIN_SAFE_INTEGER||-9007199254740991,Np={x:0,y:0,z:0},Fp={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(t,e){const n=e(t);let i=n.x*n.x+n.y*n.y;return void 0!==n.z&&(i+=n.z*n.z),wp(i)},compute:function(t,e,n){if(0===t)return e[0].t=0,e[0];const i=e.length-1;if(1===t)return e[i].t=1,e[i];const r=1-t;let o=e;if(0===i)return e[0].t=t,e[0];if(1===i){const e={x:r*o[0].x+t*o[1].x,y:r*o[0].y+t*o[1].y,t:t};return n&&(e.z=r*o[0].z+t*o[1].z),e}if(i<4){let e,s,a,l=r*r,c=t*t,u=0;2===i?(o=[o[0],o[1],o[2],Np],e=l,s=r*t*2,a=c):3===i&&(e=l*r,s=l*t*3,a=r*c*3,u=t*c);const d={x:e*o[0].x+s*o[1].x+a*o[2].x+u*o[3].x,y:e*o[0].y+s*o[1].y+a*o[2].y+u*o[3].y,t:t};return n&&(d.z=e*o[0].z+s*o[1].z+a*o[2].z+u*o[3].z),d}const s=JSON.parse(JSON.stringify(e));for(;s.length>1;){for(let e=0;e<s.length-1;e++)s[e]={x:s[e].x+(s[e+1].x-s[e].x)*t,y:s[e].y+(s[e+1].y-s[e].y)*t},void 0!==s[e].z&&(s[e].z=s[e].z+(s[e+1].z-s[e].z)*t);s.splice(s.length-1,1)}return s[0].t=t,s[0]},computeWithRatios:function(t,e,n,i){const r=1-t,o=n,s=e;let a,l=o[0],c=o[1],u=o[2],d=o[3];return l*=r,c*=t,2===s.length?(a=l+c,{x:(l*s[0].x+c*s[1].x)/a,y:(l*s[0].y+c*s[1].y)/a,z:!!i&&(l*s[0].z+c*s[1].z)/a,t:t}):(l*=r,c*=2*r,u*=t*t,3===s.length?(a=l+c+u,{x:(l*s[0].x+c*s[1].x+u*s[2].x)/a,y:(l*s[0].y+c*s[1].y+u*s[2].y)/a,z:!!i&&(l*s[0].z+c*s[1].z+u*s[2].z)/a,t:t}):(l*=r,c*=1.5*r,u*=3*r,d*=t*t*t,4===s.length?(a=l+c+u+d,{x:(l*s[0].x+c*s[1].x+u*s[2].x+d*s[3].x)/a,y:(l*s[0].y+c*s[1].y+u*s[2].y+d*s[3].y)/a,z:!!i&&(l*s[0].z+c*s[1].z+u*s[2].z+d*s[3].z)/a,t:t}):void 0))},derive:function(t,e){const n=[];for(let i=t,r=i.length,o=r-1;r>1;r--,o--){const t=[];for(let n,r=0;r<o;r++)n={x:o*(i[r+1].x-i[r].x),y:o*(i[r+1].y-i[r].y)},e&&(n.z=o*(i[r+1].z-i[r].z)),t.push(n);n.push(t),i=t}return n},between:function(t,e,n){return e<=t&&t<=n||Fp.approximately(t,e)||Fp.approximately(t,n)},approximately:function(t,e,n){return gp(t-e)<=(n||1e-6)},length:function(t){const e=Fp.Tvalues.length;let n=0;for(let i,r=0;r<e;r++)i=.5*Fp.Tvalues[r]+.5,n+=Fp.Cvalues[r]*Fp.arcfn(i,t);return.5*n},map:function(t,e,n,i,r){return i+(t-e)/(n-e)*(r-i)},lerp:function(t,e,n){const i={x:e.x+t*(n.x-e.x),y:e.y+t*(n.y-e.y)};return void 0!==e.z&&void 0!==n.z&&(i.z=e.z+t*(n.z-e.z)),i},pointToString:function(t){let e=t.x+"/"+t.y;return void 0!==t.z&&(e+="/"+t.z),e},pointsToString:function(t){return"["+t.map(Fp.pointToString).join(", ")+"]"},copy:function(t){return JSON.parse(JSON.stringify(t))},angle:function(t,e,n){const i=e.x-t.x,r=e.y-t.y,o=n.x-t.x,s=n.y-t.y;return xp(i*s-r*o,i*o+r*s)},round:function(t,e){const n=""+t,i=n.indexOf(".");return parseFloat(n.substring(0,i+1+e))},dist:function(t,e){const n=t.x-e.x,i=t.y-e.y;return wp(n*n+i*i)},closest:function(t,e){let n,i,r=_p(2,63);return t.forEach((function(t,o){i=Fp.dist(e,t),i<r&&(r=i,n=o)})),{mdist:r,mpos:n}},abcratio:function(t,e){if(2!==e&&3!==e)return!1;if(void 0===t)t=.5;else if(0===t||1===t)return t;const n=_p(t,e)+_p(1-t,e);return gp((n-1)/n)},projectionratio:function(t,e){if(2!==e&&3!==e)return!1;if(void 0===t)t=.5;else if(0===t||1===t)return t;const n=_p(1-t,e);return n/(_p(t,e)+n)},lli8:function(t,e,n,i,r,o,s,a){const l=(t-n)*(o-a)-(e-i)*(r-s);return 0!=l&&{x:((t*i-e*n)*(r-s)-(t-n)*(r*a-o*s))/l,y:((t*i-e*n)*(o-a)-(e-i)*(r*a-o*s))/l}},lli4:function(t,e,n,i){const r=t.x,o=t.y,s=e.x,a=e.y,l=n.x,c=n.y,u=i.x,d=i.y;return Fp.lli8(r,o,s,a,l,c,u,d)},lli:function(t,e){return Fp.lli4(t,t.c,e,e.c)},makeline:function(t,e){return new jp(t.x,t.y,(t.x+e.x)/2,(t.y+e.y)/2,e.x,e.y)},findbbox:function(t){let e=Mp,n=Mp,i=Ap,r=Ap;return t.forEach((function(t){const o=t.bbox();e>o.x.min&&(e=o.x.min),n>o.y.min&&(n=o.y.min),i<o.x.max&&(i=o.x.max),r<o.y.max&&(r=o.y.max)})),{x:{min:e,mid:(e+i)/2,max:i,size:i-e},y:{min:n,mid:(n+r)/2,max:r,size:r-n}}},shapeintersections:function(t,e,n,i,r){if(!Fp.bboxoverlap(e,i))return[];const o=[],s=[t.startcap,t.forward,t.back,t.endcap],a=[n.startcap,n.forward,n.back,n.endcap];return s.forEach((function(e){e.virtual||a.forEach((function(i){if(i.virtual)return;const s=e.intersects(i,r);s.length>0&&(s.c1=e,s.c2=i,s.s1=t,s.s2=n,o.push(s))}))})),o},makeshape:function(t,e,n){const i=e.points.length,r=t.points.length,o=Fp.makeline(e.points[i-1],t.points[0]),s=Fp.makeline(t.points[r-1],e.points[0]),a={startcap:o,forward:t,back:e,endcap:s,bbox:Fp.findbbox([o,t,e,s]),intersections:function(t){return Fp.shapeintersections(a,a.bbox,t,t.bbox,n)}};return a},getminmax:function(t,e,n){if(!n)return{min:0,max:0};let i,r,o=Mp,s=Ap;-1===n.indexOf(0)&&(n=[0].concat(n)),-1===n.indexOf(1)&&n.push(1);for(let a=0,l=n.length;a<l;a++)i=n[a],r=t.get(i),r[e]<o&&(o=r[e]),r[e]>s&&(s=r[e]);return{min:o,mid:(o+s)/2,max:s,size:s-o}},align:function(t,e){const n=e.p1.x,i=e.p1.y,r=-xp(e.p2.y-i,e.p2.x-n);return t.map((function(t){return{x:(t.x-n)*yp(r)-(t.y-i)*bp(r),y:(t.x-n)*bp(r)+(t.y-i)*yp(r)}}))},roots:function(t,e){e=e||{p1:{x:0,y:0},p2:{x:1,y:0}};const n=t.length-1,i=Fp.align(t,e),r=function(t){return 0<=t&&t<=1};if(2===n){const t=i[0].y,e=i[1].y,n=i[2].y,o=t-2*e+n;if(0!==o){const i=-wp(e*e-t*n),s=-t+e;return[-(i+s)/o,-(-i+s)/o].filter(r)}return e!==n&&0===o?[(2*e-n)/(2*e-2*n)].filter(r):[]}const o=i[0].y,s=i[1].y,a=i[2].y;let l=3*s-o-3*a+i[3].y,c=3*o-6*s+3*a,u=-3*o+3*s,d=o;if(Fp.approximately(l,0)){if(Fp.approximately(c,0))return Fp.approximately(u,0)?[]:[-d/u].filter(r);const t=wp(u*u-4*c*d),e=2*c;return[(t-u)/e,(-u-t)/e].filter(r)}c/=l,u/=l,d/=l;const h=(3*u-c*c)/3,f=h/3,p=(2*c*c*c-9*c*u+27*d)/27,m=p/2,v=m*m+f*f*f;let g,y,b,k,x;if(v<0){const t=-h/3,e=wp(t*t*t),n=-p/(2*e),i=kp(n<-1?-1:n>1?1:n),o=2*Ip(e);return b=o*yp(i/3)-c/3,k=o*yp((i+Ep)/3)-c/3,x=o*yp((i+2*Ep)/3)-c/3,[b,k,x].filter(r)}if(0===v)return g=m<0?Ip(-m):-Ip(m),b=2*g-c/3,k=-g-c/3,[b,k].filter(r);{const t=wp(v);return g=Ip(-m+t),y=Ip(m+t),[g-y-c/3].filter(r)}},droots:function(t){if(3===t.length){const e=t[0],n=t[1],i=t[2],r=e-2*n+i;if(0!==r){const t=-wp(n*n-e*i),o=-e+n;return[-(t+o)/r,-(-t+o)/r]}return n!==i&&0===r?[(2*n-i)/(2*(n-i))]:[]}if(2===t.length){const e=t[0],n=t[1];return e!==n?[e/(e-n)]:[]}return[]},curvature:function(t,e,n,i,r){let o,s,a,l,c=0,u=0;const d=Fp.compute(t,e),h=Fp.compute(t,n),f=d.x*d.x+d.y*d.y;if(i?(o=wp(_p(d.y*h.z-h.y*d.z,2)+_p(d.z*h.x-h.z*d.x,2)+_p(d.x*h.y-h.x*d.y,2)),s=_p(f+d.z*d.z,1.5)):(o=d.x*h.y-d.y*h.x,s=_p(f,1.5)),0===o||0===s)return{k:0,r:0};if(c=o/s,u=s/o,!r){const r=Fp.curvature(t-.001,e,n,i,!0).k,o=Fp.curvature(t+.001,e,n,i,!0).k;l=(o-c+(c-r))/2,a=(gp(o-c)+gp(c-r))/2}return{k:c,r:u,dk:l,adk:a}},inflections:function(t){if(t.length<4)return[];const e=Fp.align(t,{p1:t[0],p2:t.slice(-1)[0]}),n=e[2].x*e[1].y,i=e[3].x*e[1].y,r=e[1].x*e[2].y,o=18*(-3*n+2*i+3*r-e[3].x*e[2].y),s=18*(3*n-i-3*r),a=18*(r-n);if(Fp.approximately(o,0)){if(!Fp.approximately(s,0)){let t=-a/s;if(0<=t&&t<=1)return[t]}return[]}const l=2*o;if(Fp.approximately(l,0))return[];const c=s*s-4*o*a;if(c<0)return[];const u=Math.sqrt(c);return[(u-s)/l,-(s+u)/l].filter((function(t){return 0<=t&&t<=1}))},bboxoverlap:function(t,e){const n=["x","y"],i=n.length;for(let r,o,s,a,l=0;l<i;l++)if(r=n[l],o=t[r].mid,s=e[r].mid,a=(t[r].size+e[r].size)/2,gp(o-s)>=a)return!1;return!0},expandbox:function(t,e){e.x.min<t.x.min&&(t.x.min=e.x.min),e.y.min<t.y.min&&(t.y.min=e.y.min),e.z&&e.z.min<t.z.min&&(t.z.min=e.z.min),e.x.max>t.x.max&&(t.x.max=e.x.max),e.y.max>t.y.max&&(t.y.max=e.y.max),e.z&&e.z.max>t.z.max&&(t.z.max=e.z.max),t.x.mid=(t.x.min+t.x.max)/2,t.y.mid=(t.y.min+t.y.max)/2,t.z&&(t.z.mid=(t.z.min+t.z.max)/2),t.x.size=t.x.max-t.x.min,t.y.size=t.y.max-t.y.min,t.z&&(t.z.size=t.z.max-t.z.min)},pairiteration:function(t,e,n){const i=t.bbox(),r=e.bbox(),o=1e5,s=n||.5;if(i.x.size+i.y.size<s&&r.x.size+r.y.size<s)return[(o*(t._t1+t._t2)/2|0)/o+"/"+(o*(e._t1+e._t2)/2|0)/o];let a=t.split(.5),l=e.split(.5),c=[{left:a.left,right:l.left},{left:a.left,right:l.right},{left:a.right,right:l.right},{left:a.right,right:l.left}];c=c.filter((function(t){return Fp.bboxoverlap(t.left.bbox(),t.right.bbox())}));let u=[];return 0===c.length||(c.forEach((function(t){u=u.concat(Fp.pairiteration(t.left,t.right,s))})),u=u.filter((function(t,e){return u.indexOf(t)===e}))),u},getccenter:function(t,e,n){const i=e.x-t.x,r=e.y-t.y,o=n.x-e.x,s=n.y-e.y,a=i*yp(Sp)-r*bp(Sp),l=i*bp(Sp)+r*yp(Sp),c=o*yp(Sp)-s*bp(Sp),u=o*bp(Sp)+s*yp(Sp),d=(t.x+e.x)/2,h=(t.y+e.y)/2,f=(e.x+n.x)/2,p=(e.y+n.y)/2,m=d+a,v=h+l,g=f+c,y=p+u,b=Fp.lli8(d,h,m,v,f,p,g,y),k=Fp.dist(b,t);let x,w=xp(t.y-b.y,t.x-b.x),_=xp(e.y-b.y,e.x-b.x),I=xp(n.y-b.y,n.x-b.x);return w<I?((w>_||_>I)&&(w+=Ep),w>I&&(x=I,I=w,w=x)):I<_&&_<w?(x=I,I=w,w=x):I+=Ep,b.s=w,b.e=I,b.r=k,b},numberSort:function(t,e){return t-e}};class Cp{constructor(t){this.curves=[],this._3d=!1,t&&(this.curves=t,this._3d=this.curves[0]._3d)}valueOf(){return this.toString()}toString(){return"["+this.curves.map((function(t){return Fp.pointsToString(t.points)})).join(", ")+"]"}addCurve(t){this.curves.push(t),this._3d=this._3d||t._3d}length(){return this.curves.map((function(t){return t.length()})).reduce((function(t,e){return t+e}))}curve(t){return this.curves[t]}bbox(){const t=this.curves;for(var e=t[0].bbox(),n=1;n<t.length;n++)Fp.expandbox(e,t[n].bbox());return e}offset(t){const e=[];return this.curves.forEach((function(n){e.push(...n.offset(t))})),new Cp(e)}}const{abs:Op,min:Pp,max:Rp,cos:Dp,sin:Bp,acos:Lp,sqrt:zp}=Math,Wp=Math.PI;let jp=class e{constructor(t){let e=t&&t.forEach?t:Array.from(arguments).slice(),n=!1;if("object"==typeof e[0]){n=e.length;const t=[];e.forEach((function(e){["x","y","z"].forEach((function(n){void 0!==e[n]&&t.push(e[n])}))})),e=t}let i=!1;const r=e.length;if(n){if(n>4){if(1!==arguments.length)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");i=!0}}else if(6!==r&&8!==r&&9!==r&&12!==r&&1!==arguments.length)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");const o=this._3d=!i&&(9===r||12===r)||t&&t[0]&&void 0!==t[0].z,s=this.points=[];for(let t=0,n=o?3:2;t<r;t+=n){var a={x:e[t],y:e[t+1]};o&&(a.z=e[t+2]),s.push(a)}const l=this.order=s.length-1,c=this.dims=["x","y"];o&&c.push("z"),this.dimlen=c.length;const u=Fp.align(s,{p1:s[0],p2:s[l]}),d=Fp.dist(s[0],s[l]);this._linear=u.reduce(((t,e)=>t+Op(e.y)),0)<d/50,this._lut=[],this._t1=0,this._t2=1,this.update()}static quadraticFromPoints(t,n,i,r){if(void 0===r&&(r=.5),0===r)return new e(n,n,i);if(1===r)return new e(t,n,n);const o=e.getABC(2,t,n,i,r);return new e(t,o.A,i)}static cubicFromPoints(t,n,i,r,o){void 0===r&&(r=.5);const s=e.getABC(3,t,n,i,r);void 0===o&&(o=Fp.dist(n,s.C));const a=o*(1-r)/r,l=Fp.dist(t,i),c=(i.x-t.x)/l,u=(i.y-t.y)/l,d=o*c,h=o*u,f=a*c,p=a*u,m=n.x-d,v=n.y-h,g=n.x+f,y=n.y+p,b=s.A,k=b.x+(m-b.x)/(1-r),x=b.y+(v-b.y)/(1-r),w=b.x+(g-b.x)/r,_=b.y+(y-b.y)/r,I={x:t.x+(k-t.x)/r,y:t.y+(x-t.y)/r},T={x:i.x+(w-i.x)/(1-r),y:i.y+(_-i.y)/(1-r)};return new e(t,I,T,i)}static getUtils(){return Fp}getUtils(){return e.getUtils()}static get PolyBezier(){return Cp}valueOf(){return this.toString()}toString(){return Fp.pointsToString(this.points)}toSVG(){if(this._3d)return!1;const t=this.points,e=["M",t[0].x,t[0].y,2===this.order?"Q":"C"];for(let n=1,i=t.length;n<i;n++)e.push(t[n].x),e.push(t[n].y);return e.join(" ")}setRatios(t){if(t.length!==this.points.length)throw new Error("incorrect number of ratio values");this.ratios=t,this._lut=[]}verify(){const t=this.coordDigest();t!==this._print&&(this._print=t,this.update())}coordDigest(){return this.points.map((function(t,e){return""+e+t.x+t.y+(t.z?t.z:0)})).join("")}update(){this._lut=[],this.dpoints=Fp.derive(this.points,this._3d),this.computedirection()}computedirection(){const t=this.points,e=Fp.angle(t[0],t[this.order],t[1]);this.clockwise=e>0}length(){return Fp.length(this.derivative.bind(this))}static getABC(t=2,e,n,i,r=.5){const o=Fp.projectionratio(r,t),s=1-o,a={x:o*e.x+s*i.x,y:o*e.y+s*i.y},l=Fp.abcratio(r,t);return{A:{x:n.x+(n.x-a.x)/l,y:n.y+(n.y-a.y)/l},B:n,C:a,S:e,E:i}}getABC(t,n){n=n||this.get(t);let i=this.points[0],r=this.points[this.order];return e.getABC(this.order,i,n,r,t)}getLUT(t){if(this.verify(),t=t||100,this._lut.length===t+1)return this._lut;this._lut=[],t++,this._lut=[];for(let e,n,i=0;i<t;i++)n=i/(t-1),e=this.compute(n),e.t=n,this._lut.push(e);return this._lut}on(e,n){n=n||5;const i=this.getLUT(),r=[];for(let t,o=0,s=0;o<i.length;o++)t=i[o],Fp.dist(t,e)<n&&(r.push(t),s+=o/i.length);return!!r.length&&(t/=r.length)}project(t){const e=this.getLUT(),n=e.length-1,i=Fp.closest(e,t),r=i.mpos,o=(r-1)/n,s=(r+1)/n,a=.1/n;let l,c=i.mdist,u=o,d=u;c+=1;for(let e;u<s+a;u+=a)l=this.compute(u),e=Fp.dist(t,l),e<c&&(c=e,d=u);return d=d<0?0:d>1?1:d,l=this.compute(d),l.t=d,l.d=c,l}get(t){return this.compute(t)}point(t){return this.points[t]}compute(t){return this.ratios?Fp.computeWithRatios(t,this.points,this.ratios,this._3d):Fp.compute(t,this.points,this._3d,this.ratios)}raise(){const t=this.points,n=[t[0]],i=t.length;for(let e,r,o=1;o<i;o++)e=t[o],r=t[o-1],n[o]={x:(i-o)/i*e.x+o/i*r.x,y:(i-o)/i*e.y+o/i*r.y};return n[i]=t[i-1],new e(n)}derivative(t){return Fp.compute(t,this.dpoints[0],this._3d)}dderivative(t){return Fp.compute(t,this.dpoints[1],this._3d)}align(){let t=this.points;return new e(Fp.align(t,{p1:t[0],p2:t[t.length-1]}))}curvature(t){return Fp.curvature(t,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return Fp.inflections(this.points)}normal(t){return this._3d?this.__normal3(t):this.__normal2(t)}__normal2(t){const e=this.derivative(t),n=zp(e.x*e.x+e.y*e.y);return{t:t,x:-e.y/n,y:e.x/n}}__normal3(t){const e=this.derivative(t),n=this.derivative(t+.01),i=zp(e.x*e.x+e.y*e.y+e.z*e.z),r=zp(n.x*n.x+n.y*n.y+n.z*n.z);e.x/=i,e.y/=i,e.z/=i,n.x/=r,n.y/=r,n.z/=r;const o={x:n.y*e.z-n.z*e.y,y:n.z*e.x-n.x*e.z,z:n.x*e.y-n.y*e.x},s=zp(o.x*o.x+o.y*o.y+o.z*o.z);o.x/=s,o.y/=s,o.z/=s;const a=[o.x*o.x,o.x*o.y-o.z,o.x*o.z+o.y,o.x*o.y+o.z,o.y*o.y,o.y*o.z-o.x,o.x*o.z-o.y,o.y*o.z+o.x,o.z*o.z];return{t:t,x:a[0]*e.x+a[1]*e.y+a[2]*e.z,y:a[3]*e.x+a[4]*e.y+a[5]*e.z,z:a[6]*e.x+a[7]*e.y+a[8]*e.z}}hull(t){let e=this.points,n=[],i=[],r=0;for(i[r++]=e[0],i[r++]=e[1],i[r++]=e[2],3===this.order&&(i[r++]=e[3]);e.length>1;){n=[];for(let o,s=0,a=e.length-1;s<a;s++)o=Fp.lerp(t,e[s],e[s+1]),i[r++]=o,n.push(o);e=n}return i}split(t,n){if(0===t&&n)return this.split(n).left;if(1===n)return this.split(t).right;const i=this.hull(t),r={left:2===this.order?new e([i[0],i[3],i[5]]):new e([i[0],i[4],i[7],i[9]]),right:2===this.order?new e([i[5],i[4],i[2]]):new e([i[9],i[8],i[6],i[3]]),span:i};return r.left._t1=Fp.map(0,0,1,this._t1,this._t2),r.left._t2=Fp.map(t,0,1,this._t1,this._t2),r.right._t1=Fp.map(t,0,1,this._t1,this._t2),r.right._t2=Fp.map(1,0,1,this._t1,this._t2),n?(n=Fp.map(n,t,1,0,1),r.right.split(n).left):r}extrema(){const t={};let e=[];return this.dims.forEach(function(n){let i=function(t){return t[n]},r=this.dpoints[0].map(i);t[n]=Fp.droots(r),3===this.order&&(r=this.dpoints[1].map(i),t[n]=t[n].concat(Fp.droots(r))),t[n]=t[n].filter((function(t){return t>=0&&t<=1})),e=e.concat(t[n].sort(Fp.numberSort))}.bind(this)),t.values=e.sort(Fp.numberSort).filter((function(t,n){return e.indexOf(t)===n})),t}bbox(){const t=this.extrema(),e={};return this.dims.forEach(function(n){e[n]=Fp.getminmax(this,n,t[n])}.bind(this)),e}overlaps(t){const e=this.bbox(),n=t.bbox();return Fp.bboxoverlap(e,n)}offset(t,n){if(void 0!==n){const e=this.get(t),i=this.normal(t),r={c:e,n:i,x:e.x+i.x*n,y:e.y+i.y*n};return this._3d&&(r.z=e.z+i.z*n),r}if(this._linear){const n=this.normal(0),i=this.points.map((function(e){const i={x:e.x+t*n.x,y:e.y+t*n.y};return e.z&&n.z&&(i.z=e.z+t*n.z),i}));return[new e(i)]}return this.reduce().map((function(e){return e._linear?e.offset(t)[0]:e.scale(t)}))}simple(){if(3===this.order){const t=Fp.angle(this.points[0],this.points[3],this.points[1]),e=Fp.angle(this.points[0],this.points[3],this.points[2]);if(t>0&&e<0||t<0&&e>0)return!1}const t=this.normal(0),e=this.normal(1);let n=t.x*e.x+t.y*e.y;return this._3d&&(n+=t.z*e.z),Op(Lp(n))<Wp/3}reduce(){let t,e,n=0,i=0,r=.01,o=[],s=[],a=this.extrema().values;for(-1===a.indexOf(0)&&(a=[0].concat(a)),-1===a.indexOf(1)&&a.push(1),n=a[0],t=1;t<a.length;t++)i=a[t],e=this.split(n,i),e._t1=n,e._t2=i,o.push(e),n=i;return o.forEach((function(t){for(n=0,i=0;i<=1;)for(i=n+r;i<=1.01;i+=r)if(e=t.split(n,i),!e.simple()){if(i-=r,Op(n-i)<r)return[];e=t.split(n,i),e._t1=Fp.map(n,0,1,t._t1,t._t2),e._t2=Fp.map(i,0,1,t._t1,t._t2),s.push(e),n=i;break}n<1&&(e=t.split(n,1),e._t1=Fp.map(n,0,1,t._t1,t._t2),e._t2=t._t2,s.push(e))})),s}translate(t,n,i){i="number"==typeof i?i:n;const r=this.order;let o=this.points.map(((t,e)=>(1-e/r)*n+e/r*i));return new e(this.points.map(((e,n)=>({x:e.x+t.x*o[n],y:e.y+t.y*o[n]}))))}scale(t){const n=this.order;let i=!1;if("function"==typeof t&&(i=t),i&&2===n)return this.raise().scale(i);const r=this.clockwise,o=this.points;if(this._linear)return this.translate(this.normal(0),i?i(0):t,i?i(1):t);const s=i?i(0):t,a=i?i(1):t,l=[this.offset(0,10),this.offset(1,10)],c=[],u=Fp.lli4(l[0],l[0].c,l[1],l[1].c);if(!u)throw new Error("cannot scale this curve. Try reducing it first.");return[0,1].forEach((function(t){const e=c[t*n]=Fp.copy(o[t*n]);e.x+=(t?a:s)*l[t].n.x,e.y+=(t?a:s)*l[t].n.y})),i?([0,1].forEach((function(e){if(2!==n||!e){var s=o[e+1],a={x:s.x-u.x,y:s.y-u.y},l=i?i((e+1)/n):t;i&&!r&&(l=-l);var d=zp(a.x*a.x+a.y*a.y);a.x/=d,a.y/=d,c[e+1]={x:s.x+l*a.x,y:s.y+l*a.y}}})),new e(c)):([0,1].forEach((t=>{if(2===n&&t)return;const e=c[t*n],i=this.derivative(t),r={x:e.x+i.x,y:e.y+i.y};c[t+1]=Fp.lli4(e,r,u,o[t+1])})),new e(c))}outline(t,n,i,r){if(n=void 0===n?t:n,this._linear){const o=this.normal(0),s=this.points[0],a=this.points[this.points.length-1];let l,c,u;void 0===i&&(i=t,r=n),l={x:s.x+o.x*t,y:s.y+o.y*t},u={x:a.x+o.x*i,y:a.y+o.y*i},c={x:(l.x+u.x)/2,y:(l.y+u.y)/2};const d=[l,c,u];l={x:s.x-o.x*n,y:s.y-o.y*n},u={x:a.x-o.x*r,y:a.y-o.y*r},c={x:(l.x+u.x)/2,y:(l.y+u.y)/2};const h=[u,c,l],f=Fp.makeline(h[2],d[0]),p=Fp.makeline(d[2],h[0]),m=[f,new e(d),p,new e(h)];return new Cp(m)}const o=this.reduce(),s=o.length,a=[];let l,c=[],u=0,d=this.length();const h=void 0!==i&&void 0!==r;function f(t,e,n,i,r){return function(o){const s=i/n,a=(i+r)/n,l=e-t;return Fp.map(o,0,1,t+s*l,t+a*l)}}o.forEach((function(e){const o=e.length();h?(a.push(e.scale(f(t,i,d,u,o))),c.push(e.scale(f(-n,-r,d,u,o)))):(a.push(e.scale(t)),c.push(e.scale(-n))),u+=o})),c=c.map((function(t){return l=t.points,l[3]?t.points=[l[3],l[2],l[1],l[0]]:t.points=[l[2],l[1],l[0]],t})).reverse();const p=a[0].points[0],m=a[s-1].points[a[s-1].points.length-1],v=c[s-1].points[c[s-1].points.length-1],g=c[0].points[0],y=Fp.makeline(v,p),b=Fp.makeline(m,g),k=[y].concat(a).concat([b]).concat(c);return new Cp(k)}outlineshapes(t,e,n){e=e||t;const i=this.outline(t,e).curves,r=[];for(let t=1,e=i.length;t<e/2;t++){const o=Fp.makeshape(i[t],i[e-t],n);o.startcap.virtual=t>1,o.endcap.virtual=t<e/2-1,r.push(o)}return r}intersects(t,n){return t?t.p1&&t.p2?this.lineIntersects(t):(t instanceof e&&(t=t.reduce()),this.curveintersects(this.reduce(),t,n)):this.selfintersects(n)}lineIntersects(t){const e=Pp(t.p1.x,t.p2.x),n=Pp(t.p1.y,t.p2.y),i=Rp(t.p1.x,t.p2.x),r=Rp(t.p1.y,t.p2.y);return Fp.roots(this.points,t).filter((t=>{var o=this.get(t);return Fp.between(o.x,e,i)&&Fp.between(o.y,n,r)}))}selfintersects(t){const e=this.reduce(),n=e.length-2,i=[];for(let r,o,s,a=0;a<n;a++)o=e.slice(a,a+1),s=e.slice(a+2),r=this.curveintersects(o,s,t),i.push(...r);return i}curveintersects(t,e,n){const i=[];t.forEach((function(t){e.forEach((function(e){t.overlaps(e)&&i.push({left:t,right:e})}))}));let r=[];return i.forEach((function(t){const e=Fp.pairiteration(t.left,t.right,n);e.length>0&&(r=r.concat(e))})),r}arcs(t){return t=t||.5,this._iterate(t,[])}_error(t,e,n,i){const r=(i-n)/4,o=this.get(n+r),s=this.get(i-r),a=Fp.dist(t,e),l=Fp.dist(t,o),c=Fp.dist(t,s);return Op(l-a)+Op(c-a)}_iterate(t,e){let n,i=0,r=1;do{n=0,r=1;let o,s,a,l,c,u=this.get(i),d=!1,h=!1,f=r,p=1;do{if(h=d,l=a,f=(i+r)/2,o=this.get(f),s=this.get(r),a=Fp.getccenter(u,o,s),a.interval={start:i,end:r},d=this._error(a,u,i,r)<=t,c=h&&!d,c||(p=r),d){if(r>=1){if(a.interval.end=p=1,l=a,r>1){let t={x:a.x+a.r*Dp(a.e),y:a.y+a.r*Bp(a.e)};a.e+=Fp.angle({x:a.x,y:a.y},t,this.get(1))}break}r+=(r-i)/2}else r=f}while(!c&&n++<100);if(n>=100)break;l=l||a,e.push(l),i=p}while(r<1);return e}};var $p={pointsToCurve:function(t,e){let n=1/e;if(0===t.length){let t=[];for(let i=0;i<e;i++){let e=i*n;t.push({x:e,y:.5})}return t}if(1===t.length){let i=t[0].y,r=[{x:0,y:i}];for(let t=0;t<e;t++){let e=t*n+n;r.push({x:e,y:i})}return r}let i=[],r=t[0],o=t[t.length-1],s=new jp({x:o.x-1,y:o.y},{x:o.x-1+(r.x-(o.x-1))/2,y:o.y},{x:r.x-(r.x-(o.x-1))/2,y:r.y},r),a=new jp(o,{x:o.x+(r.x+1-o.x)/2,y:o.y},{x:r.x+1-(r.x+1-o.x)/2,y:r.y},{x:r.x+1,y:r.y});for(let e=0;e<t.length-1;e++){let n=t[e],r=t[e+1],o={x:n.x+(r.x-n.x)/2,y:n.y},s={x:r.x-(r.x-n.x)/2,y:r.y},a=new jp(n,o,s,r);i.push(a)}i.unshift(s),i.push(a);let l=[s.get(s.intersects({p1:{x:0,y:0},p2:{x:0,y:1}})[0])];for(let t=0;t<e;t++){let e,r=t*n+n;i.every((t=>{let n=t.intersects({p1:{x:r,y:0},p2:{x:r,y:1}});return!(n.length>0&&(e=t.get(n[0]),l.push(e),1))}))}return l}};class Up{constructor(t,e){this.xs=t,this.ys=e,this.ks=this.getNaturalKs(new Float64Array(this.xs.length))}getNaturalKs(t){const e=this.xs.length-1,n=function(t,e){const n=[];for(let i=0;i<t;i++)n.push(new Float64Array(e));return n}(e+1,e+2);for(let t=1;t<e;t++)n[t][t-1]=1/(this.xs[t]-this.xs[t-1]),n[t][t]=2*(1/(this.xs[t]-this.xs[t-1])+1/(this.xs[t+1]-this.xs[t])),n[t][t+1]=1/(this.xs[t+1]-this.xs[t]),n[t][e+1]=3*((this.ys[t]-this.ys[t-1])/((this.xs[t]-this.xs[t-1])*(this.xs[t]-this.xs[t-1]))+(this.ys[t+1]-this.ys[t])/((this.xs[t+1]-this.xs[t])*(this.xs[t+1]-this.xs[t])));return n[0][0]=2/(this.xs[1]-this.xs[0]),n[0][1]=1/(this.xs[1]-this.xs[0]),n[0][e+1]=3*(this.ys[1]-this.ys[0])/((this.xs[1]-this.xs[0])*(this.xs[1]-this.xs[0])),n[e][e-1]=1/(this.xs[e]-this.xs[e-1]),n[e][e]=2/(this.xs[e]-this.xs[e-1]),n[e][e+1]=3*(this.ys[e]-this.ys[e-1])/((this.xs[e]-this.xs[e-1])*(this.xs[e]-this.xs[e-1])),function(t,e){const n=t.length;let i=0,r=0;for(;i<n&&r<=n;){let e=0,o=-1/0;for(let s=i;s<n;s++){const n=Math.abs(t[s][r]);n>o&&(e=s,o=n)}if(0===t[e][r])r++;else{qp(t,i,e);for(let e=i+1;e<n;e++){const o=t[e][r]/t[i][r];t[e][r]=0;for(let s=r+1;s<=n;s++)t[e][s]-=t[i][s]*o}i++,r++}}for(let i=n-1;i>=0;i--){var o=0;t[i][i]&&(o=t[i][n]/t[i][i]),e[i]=o;for(let e=i-1;e>=0;e--)t[e][n]-=t[e][i]*o,t[e][i]=0}return e}(n,t)}getIndexBefore(t){let e=0,n=this.xs.length,i=0;for(;e<n;)i=Math.floor((e+n)/2),this.xs[i]<t&&i!==e?e=i:n=this.xs[i]>=t&&i!==n?i:e;return e===this.xs.length-1?this.xs.length-1:e+1}at(t){let e=this.getIndexBefore(t);const n=(t-this.xs[e-1])/(this.xs[e]-this.xs[e-1]),i=this.ks[e-1]*(this.xs[e]-this.xs[e-1])-(this.ys[e]-this.ys[e-1]),r=-this.ks[e]*(this.xs[e]-this.xs[e-1])+(this.ys[e]-this.ys[e-1]);return(1-n)*this.ys[e-1]+n*this.ys[e]+n*(1-n)*(i*(1-n)+r*n)}}function qp(t,e,n){let i=t[e];t[e]=t[n],t[n]=i}function Vp(t,e,n){const i=n[0],r=n[n.length-1];if(t<i.x)return i.y;if(t>r.x)return r.y;const o=e.at(t);return Math.max(0,Math.min(o,1))}var Gp={pointsToCurve:function(t,e){if(!Array.isArray(t)||!t.every((t=>"object"==typeof t&&"number"==typeof t.x&&"number"==typeof t.y&&t.x>=0&&t.x<=1&&t.y>=0&&t.y<=1)))throw new Error("[pointsToCurve] Invalid points. Expected array of objects with x and y in [0, 1] range.");if(!("number"==typeof e&&e>=1))throw new Error(`[pointsToCurve] Invalid resolution: ${e}. Expected integer >= 1.`);const n=t.map((t=>t.x)),i=t.map((t=>t.y)),r=new Up(n,i);let o=[];for(let n=0;n<e;n++)o.push(Vp(n/(e-1),r,t));return o}};function Hp(t,e=256,n={}){return"bezier"===n.type?$p.pointsToCurve(t,e,n):Gp.pointsToCurve(t,e)}const Kp=[];for(let t=0;t<256;t++)Kp[t]=t;class Xp extends Zf{constructor(t){const e={vertex:mp,fragment:vp},n={uniforms:Zf.getUniformInfo(Xp)};super(Xp.getFilterType(),e,n,t)}static getFilterType(){return"curves"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=[];var n;e=[...t.master||t.points||t.masterPoints?t.master||(n=t.points||t.masterPoints,Hp(n,256).map((t=>255*t))):Kp],this.uniforms[Gf.STATIC_OPTIONS].set(e)}}function Yp(t,e,n){if("number"!=typeof t||t<0||t>255)throw new Error(`[levels] Invalid black point: ${t}. Expected integer between 0 and 255`);if("number"!=typeof e||e<0||e>255)throw new Error(`[levels] Invalid white point: ${e}. Expected integer between 0 and 255`);if("number"!=typeof n||n<.01||n>9.99)throw new Error(`[levels] Invalid gamma: ${n}. Expected float between 0.01 and 9.99`);if(t>e)throw new Error(`[levels] Invalid black and white points: ${t}, ${e}. Expected black <= white`);let i=[];for(let r=0;r<256;r++){let o;o=r<=t?0:r>=e?255:255*Math.pow((r-t)/(e-t),1/n),i[r]=o}return i}class Qp extends Zf{constructor(t){const e={vertex:mp,fragment:vp},n={uniforms:Zf.getUniformInfo(Qp)};super(Qp.getFilterType(),e,n,t)}static getFilterType(){return"levels"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=[...Yp(t.black,t.white,t.gamma)];this.uniforms[Gf.STATIC_OPTIONS].set(e)}}const Jp=360,Zp=[];for(let t=0;t<Jp;t++)Zp[t]=t;class tm extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(tm)};super(tm.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\n\n// a 360 length array with values for the hue curve\n// this represents a lookup table from a hue value to another hue value\nuniform float staticOptions[360];\n\n// implementation of round (doesn't exist in webgl)\nint round(float val){\n return int(floor(val + 0.5));\n}\n\n// glsl mod doesn't work with negative numbers so\n// this is a safer version that lets us play with negatives > -1.0\nfloat safeMod(float val){\n return mod(val + 1.0, 1.0);\n}\n\n// no dynamic array indexes in webgl\n// see https://stackoverflow.com/questions/30585265/what-can-i-use-as-an-array-index-in-glsl-in-webgl\nfloat getCurveValue(float pixelValue){\n float v;\n for (int k = 0; k < 360; k++) {\n if (k == round(pixelValue * 359.0)){\n v = float(staticOptions[k]) / 359.0;\n }\n }\n return v;\n}\n\n// function source https://www.shadertoy.com/view/4dKcWK\nconst float EPSILON = 1e-10;\n\nvec3 HUEtoRGB(in float hue) {\n // Hue [0..1] to RGB [0..1]\n // See http://www.chilliant.com/rgb2hsv.html\n vec3 rgb = abs(hue * 6. - vec3(3, 2, 4)) * vec3(1, -1, -1) + vec3(-1, 2, 2);\n return clamp(rgb, 0., 1.);\n}\n\nvec3 RGBtoHCV(in vec3 rgb) {\n // RGB [0..1] to Hue-Chroma-Value [0..1]\n // Based on work by Sam Hocevar and Emil Persson\n vec4 p = (rgb.g < rgb.b) ? vec4(rgb.bg, -1., 2. / 3.) : vec4(rgb.gb, 0., -1. / 3.);\n vec4 q = (rgb.r < p.x) ? vec4(p.xyw, rgb.r) : vec4(rgb.r, p.yzx);\n float c = q.x - min(q.w, q.y);\n float h = abs((q.w - q.y) / (6. * c + EPSILON) + q.z);\n return vec3(h, c, q.x);\n}\n\nvec3 HSVtoRGB(in vec3 hsv) {\n // Hue-Saturation-Value [0..1] to RGB [0..1]\n vec3 rgb = HUEtoRGB(hsv.x);\n return ((rgb - 1.) * hsv.y + 1.) * hsv.z;\n}\n\nvec3 HSLtoRGB(in vec3 hsl) {\n // Hue-Saturation-Lightness [0..1] to RGB [0..1]\n vec3 rgb = HUEtoRGB(hsl.x);\n float c = (1. - abs(2. * hsl.z - 1.)) * hsl.y;\n return (rgb - 0.5) * c + hsl.z;\n}\n\nvec3 RGBtoHSV(in vec3 rgb) {\n // RGB [0..1] to Hue-Saturation-Value [0..1]\n vec3 hcv = RGBtoHCV(rgb);\n float s = hcv.y / (hcv.z + EPSILON);\n return vec3(hcv.x, s, hcv.z);\n}\n\nvec3 RGBtoHSL(in vec3 rgb) {\n // RGB [0..1] to Hue-Saturation-Lightness [0..1]\n vec3 hcv = RGBtoHCV(rgb);\n float z = hcv.z - hcv.y * 0.5;\n float s = hcv.y / (1. - abs(z * 2. - 1.) + EPSILON);\n return vec3(hcv.x, s, z);\n}\n\nvoid main() {\n vec4 textureColor = texture2D(first_texture, current_texture_coordinate_2d);\n vec3 inHSL = RGBtoHSL(textureColor.rgb);\n // in the UI hue 0 is cyan and 180 is red\n float shiftedHue = getCurveValue(mod(inHSL.x + 0.5, 1.0));\n vec3 inRGB = HSLtoRGB(vec3(shiftedHue, inHSL.y, inHSL.z));\n\n vec4 finalColor = vec4(inRGB, textureColor.a);\n\n // During the rgb-to-hsl-to-rgb conversion total whites gets clipped on OSX for some reason\n // make sure to retain absolute white (since it has no chroma component)\n if (textureColor.r == 1.0 && textureColor.g == 1.0 && textureColor.b == 1.0){\n finalColor.rgb = vec3(1.0, 1.0, 1.0);\n }\n\n gl_FragColor = finalColor;\n}\n"},e,t)}static getFilterType(){return"hue"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=t.points&&function(t){return Hp(t,Jp,{type:"bezier"}).map((t=>{return e=t,((Math.round(e.x*Jp)+180)%Jp+(1-e.y-.5)*Jp+Jp)%Jp;var e}))}(t.points)||Zp;this.uniforms[Gf.STATIC_OPTIONS].set(e)}}class em extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(em)};super(em.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\nuniform float staticOptions[2];\n\n//CIE L*a*b* (CIELAB, L* for lightness, a* from green to red, b* from blue to yellow)\n//Source: https://gist.github.com/mattatz/44f081cac87e2f7c8980 (HLSL)\nvec3 rgb2xyz(vec3 c){\n vec3 tmp=vec3(\n (c.r>.04045)?pow((c.r+.055)/1.055,2.4):c.r/12.92,\n (c.g>.04045)?pow((c.g+.055)/1.055,2.4):c.g/12.92,\n (c.b>.04045)?pow((c.b+.055)/1.055,2.4):c.b/12.92\n );\n mat3 mat=mat3(\n .4124,.3576,.1805,\n .2126,.7152,.0722,\n .0193,.1192,.9505\n );\n return 100.*(tmp*mat);\n}\nvec3 xyz2lab(vec3 c){\n vec3 n=c/vec3(95.047,100.,108.883),\n v=vec3(\n (n.x>.008856)?pow(n.x,1./3.):(7.787*n.x)+(16./116.),\n (n.y>.008856)?pow(n.y,1./3.):(7.787*n.y)+(16./116.),\n (n.z>.008856)?pow(n.z,1./3.):(7.787*n.z)+(16./116.)\n );\n return vec3((116.*v.y)-16.,500.*(v.x-v.y),200.*(v.y-v.z));\n}\nvec3 rgb2lab(vec3 c){\n vec3 lab=xyz2lab(rgb2xyz(c));\n return vec3(lab.x/100.,.5+.5*(lab.y/127.),.5+.5*(lab.z/127.));\n}\nvec3 lab2xyz(vec3 c){\n float fy=(c.x+16.)/116.,\n fx=c.y/500.+fy,\n fz=fy-c.z/200.;\n return vec3(\n 95.047*((fx>.206897)?fx*fx*fx:(fx-16./116.)/7.787),\n 100. *((fy>.206897)?fy*fy*fy:(fy-16./116.)/7.787),\n 108.883*((fz>.206897)?fz*fz*fz:(fz-16./116.)/7.787)\n );\n}\nvec3 xyz2rgb(vec3 c){\n mat3 mat=mat3(\n 3.2406,-1.5372,-.4986,\n -.9689, 1.8758, .0415,\n .0557, -.2040,1.0570\n );\n vec3 v=(c/100.0)*mat,\n r=vec3(\n (v.r>.0031308)?((1.055*pow(v.r,(1./2.4)))-.055):12.92*v.r,\n (v.g>.0031308)?((1.055*pow(v.g,(1./2.4)))-.055):12.92*v.g,\n (v.b>.0031308)?((1.055*pow(v.b,(1./2.4)))-.055):12.92*v.b\n );\n return r;\n}\nvec3 lab2rgb(vec3 c){return xyz2rgb(lab2xyz(vec3(100.*c.x,2.*127.*(c.y-.5),2.*127.*(c.z-.5))));}\n\n\nfloat handleMix(float x){\n return pow(x * 2.0 - 1.0, 2.0);\n}\n\nvoid main() {\n vec3 inColor = texture2D(first_texture, current_texture_coordinate_2d).rgb;\n// inColor = vec3(148.0 / 255.0, 99.0 / 255.0, 95.0 / 255.0); // debug\n\n vec3 inLab = rgb2lab(inColor);\n vec3 inRGB ;\n\n// vec2 tempTint = vec2(staticOptions[1], -staticOptions[0]);\n\n// inLab.yz += (tempTint.xy); // * 0.3; // damping of effect\n\n // lab range is 0 to 1, input is -128 to 127\n // lab chromacity zero is 0.5, 0.5 so convert between the ranges\n // y is a, z is b\n inLab.y -= (-staticOptions[1] + 128.0) / 255.0 - 0.5;\n inLab.z -= (staticOptions[0] + 128.0) / 255.0 - 0.5;\n\n inRGB = lab2rgb(inLab);\n\n\n // vec3 mixed = mix(inRGB, inColor, handleMix(inLab.x)); // mid tones\n // vec3 mixed = mix(inRGB, inColor, inLab.x); // only high tones\n vec3 mixed = mix(inRGB, inColor, 0.0); // no mix\n\n gl_FragColor = vec4(mixed,1.0);\n}\n"},e,t)}static getFilterType(){return"whiteBalance"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=t.temperature?t.temperature:0,n=t.tint?t.tint:0;this.uniforms[Gf.STATIC_OPTIONS].set([e,n])}}class nm extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(nm)};super(nm.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\nuniform float staticOptions[4];\n\n// algorithm from here\n// https://github.com/CeeJayDK/SweetFX/blob/master/Shaders/Vibrance.fx\n\nvoid main() {\n float percentAmount = staticOptions[0];\n float redBalance = staticOptions[1];\n float greenBalance = staticOptions[2];\n float blueBalance = staticOptions[3];\n\n vec3 color = texture2D(first_texture, current_texture_coordinate_2d).rgb;\n vec3 coefLuma = vec3(0.212656, 0.715158, 0.072186);\n\n float luma = dot(coefLuma, color);\n\n float max_color = max(color.r, max(color.g, color.b)); // Find the strongest color\n float min_color = min(color.r, min(color.g, color.b)); // Find the weakest color\n\n float color_saturation = max_color - min_color; // The difference between the two is the saturation\n\n // Extrapolate between luma and original by 1 + (1-saturation) - current\n vec3 coeffVibrance = vec3(redBalance, greenBalance, blueBalance) * percentAmount;\n\n color.r = mix(luma, color.r, 1.0 + (coeffVibrance.r * (1.0 - (sign(coeffVibrance.r) * color_saturation))));\n color.g = mix(luma, color.g, 1.0 + (coeffVibrance.g * (1.0 - (sign(coeffVibrance.g) * color_saturation))));\n color.b = mix(luma, color.b, 1.0 + (coeffVibrance.b * (1.0 - (sign(coeffVibrance.b) * color_saturation))));\n\n\n gl_FragColor = vec4(color, 1.0);\n\n}\n"},e,t)}static getFilterType(){return"vibrance"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=t.amount?t.amount/100*2:0,n=null===t.redBalance?1:t.redBalance,i=null===t.greenBalance?1:t.greenBalance,r=null===t.blueBalance?1:t.blueBalance;this.uniforms[Gf.STATIC_OPTIONS].set([e,n,i,r])}}class im extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(im)};super(im.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\nuniform float staticOptions[1];\n\n// algorithm from here\n// https://github.com/minus34/cesium1/blob/master/Cesium/Shaders/Builtin/Functions/saturation.glsl\n\n/**\n * Adjusts the saturation of a color.\n *\n * @name czm_saturation\n * @glslFunction\n *\n * @param {vec3} rgb The color.\n * @param {float} adjustment The amount to adjust the saturation of the color.\n *\n * @returns {float} The color with the saturation adjusted.\n *\n * @example\n * vec3 greyScale = czm_saturation(color, 0.0);\n * vec3 doubleSaturation = czm_saturation(color, 2.0);\n */\nvec3 czm_saturation(vec3 rgb, float adjustment)\n{\n // Algorithm from Chapter 16 of OpenGL Shading Language\n const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n vec3 intensity = vec3(dot(rgb, W));\n return mix(intensity, rgb, adjustment);\n}\n\n\nvoid main() {\n float amount = staticOptions[0];\n vec3 color = texture2D(first_texture, current_texture_coordinate_2d).rgb;\n gl_FragColor = vec4(czm_saturation(color, amount), 1.0);\n}\n"},e,t)}static getFilterType(){return"saturation"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=null===t.amount?1:t.amount;this.uniforms[Gf.STATIC_OPTIONS].set([e])}}class rm extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(rm)};super(rm.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float staticOptions[12];\nuniform float runtimeOptions[4];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\n\nfloat roundedBoxSDF(vec2 CenterPosition, vec2 Size, float Radius) {\n return length(max(abs(CenterPosition)-Size+Radius,0.0))-Radius;\n}\n\nvoid main() {\n vec2 srcAR = vec2(runtimeOptions[0]/runtimeOptions[1], 1.0);\n // custom aspect ratio (other than the default 1920/1080)\n // useful for example when doing crop on crop\n if (staticOptions[10] > 0.0) { //\n srcAR.x = staticOptions[10];\n }\n vec2 srcCenter = vec2(staticOptions[0], staticOptions[1]);\n vec2 srcDims = vec2(staticOptions[2], staticOptions[3]);\n vec2 srcTL = vec2(srcCenter.x - srcDims[0] / 2.0, srcCenter.y - srcDims[1] / 2.0); // top left point\n\n vec2 srcDims_AR = srcDims * srcAR;\n vec2 srcTL_AR = srcTL * srcAR;\n\n vec2 vpDims = vec2(runtimeOptions[2], runtimeOptions[3]);\n vec2 vpAR = vec2(vpDims[0]/vpDims[1], 1.0);\n\n vec2 tgtCenter = vec2(staticOptions[4], staticOptions[5]);\n vec2 tgtDims = vec2(staticOptions[6], staticOptions[7]);\n vec2 tgtTL = vec2(tgtCenter.x - tgtDims[0] / 2.0, tgtCenter.y - tgtDims[1] / 2.0);\n\n vec2 tgtDims_AR = tgtDims * vpAR;\n vec2 tgtTL_AR = tgtTL * vpAR;\n\n vec2 pos_AR = current_texture_coordinate_2d * vpAR;\n\n float ratioW = tgtDims_AR[0] / srcDims_AR[0];\n float ratioH = tgtDims_AR[1] / srcDims_AR[1];\n\n float ratio;\n\n // the type of crop fit. 0 - contain, 1 - fill, 3 - stretch\n float fitType = staticOptions[8];\n\n if (fitType == 0.0){\n ratio = ratioW > ratioH ? ratioW : ratioH;\n vec2 tgtDims_OLD_AR = tgtDims_AR;\n tgtDims_AR = srcDims_AR * ratio;\n tgtTL_AR = tgtTL_AR - (tgtDims_AR - tgtDims_OLD_AR) / 2.0;\n } else if (fitType == 1.0){\n ratio = ratioW < ratioH ? ratioW : ratioH;\n vec2 tgtDims_OLD_AR = tgtDims_AR;\n tgtDims_AR = srcDims_AR * ratio;\n tgtTL_AR = tgtTL_AR + (tgtDims_OLD_AR - tgtDims_AR) / 2.0;\n }\n\n vec2 final_pos_AR = (pos_AR - tgtTL_AR) / tgtDims_AR * srcDims_AR + srcTL_AR;\n\n // transform coords back from AR into 0 to 1 range\n vec2 pos = final_pos_AR / srcAR;\n\n // How soft the edges should be . Higher values could be used to simulate a drop shadow.\n float edgeSoftness = staticOptions[11];\n\n // The radius of the corners in pixels\n float radius = staticOptions[9];\n\n float tightDistance = roundedBoxSDF((current_texture_coordinate_2d - tgtCenter) , tgtDims_AR / vpAR / 2.0, 0.0);\n// float distance = roundedBoxSDF((current_texture_coordinate_2d - tgtCenter) * vpAR, tgtDims * vpAR / 2.0, 0.01);\n float distance = roundedBoxSDF((current_texture_coordinate_2d - tgtCenter) * vpDims, (tgtDims * vpDims) / 2.0, radius);\n\n // Smooth the result (free antialiasing).\n float smoothedAlpha = 1.0 - smoothstep(0.0, edgeSoftness * 2.0, distance);\n\n // Return the resultant shape.\n vec4 textureColor = texture2D(first_texture, pos);\n vec4 quadColor = vec4(textureColor.xyz, smoothedAlpha);\n\n // Apply a drop shadow effect.\n// float shadowSoftness = 0.0;\n// vec2 shadowOffset = vec2(0.0, 0.0);\n// float shadowDistance = roundedBoxSDF(pos + shadowOffset, tgtDims_AR / 2.0, radius);\n// float shadowAlpha = 1.0 - smoothstep(-shadowSoftness, shadowSoftness, shadowDistance);\n// vec4 shadowColor = vec4(0.4, 0.4, 0.4, 1.0);\n // gl_FragColor = mix(quadColor, shadowColor, shadowAlpha - smoothedAlpha);\n\n\n // pillarboxing\n if (tightDistance > 0.0 && distance <= 0.0){\n gl_FragColor = vec4(0, 0, 0, 1.0);\n } else {\n gl_FragColor = quadColor;\n }\n\n // debug\n // gl_FragColor = texture2D(first_texture, pos);\n\n}"},e,t)}static getFilterType(){return"crop"}static getInputsCount(){return 1}static getInitialOptions(){return{source:{center:{x:.5,y:.5},width:1,height:1},target:{center:{x:.5,y:.5},width:1,height:1},fitType:"fill",cornerRadius:10,edgeSoftness:0}}getOptionsDisplay(){return[]}static getUniformList(){return[Gf.FIRST_TEXTURE,Uf,qf]}handleStaticUniforms(t){let e={...rm.getInitialOptions(),...t};const n=Number.parseFloat(e.source.center.x).toFixed(5),i=Number.parseFloat(e.source.center.y).toFixed(5),r=Number.parseFloat(e.source.width).toFixed(5),o=Number.parseFloat(e.source.height).toFixed(5),s=Number.parseFloat(e.target.center.x).toFixed(5),a=Number.parseFloat(e.target.center.y).toFixed(5),l=Number.parseFloat(e.target.width).toFixed(5),c=Number.parseFloat(e.target.height).toFixed(5),u=Number.parseFloat(e.edgeSoftness).toFixed(5),d=e.source.aspectRatio?Number.parseFloat(e.source.aspectRatio).toFixed(5):0;let h;h="fill"===e.fitType?0:"contain"===e.fitType?1:2;const f=Number.parseFloat(e.cornerRadius).toFixed(5);this.uniforms[Gf.STATIC_OPTIONS].set([n,i,r,o,s,a,l,c,h,f,d,u])}}class om extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(om)};super(om.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float staticOptions[4];\nuniform float runtimeOptions[2];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\n\nvoid main() {\n // this is the the texture from the prev shader\n vec4 texture = texture2D(first_texture, current_texture_coordinate_2d);\n vec4 color = vec4(staticOptions[0], staticOptions[1], staticOptions[2], 1.0);\n vec4 blended = mix(texture, color, staticOptions[3]);\n gl_FragColor = blended;\n}"},e,t)}static getFilterType(){return"solid"}static getInputsCount(){return 1}static getInitialOptions(){return{color:{r:.33,g:.66,b:.99,a:1}}}getOptionsDisplay(){return[{properties:["color","r"],type:"slider",minValue:0,maxValue:1,step:.001},{properties:["color","g"],type:"slider",minValue:0,maxValue:1,step:.001},{properties:["color","b"],type:"slider",minValue:0,maxValue:1,step:.001}]}handleStaticUniforms(t){var e;const n=Number.parseFloat(t.color.r).toFixed(5),i=Number.parseFloat(t.color.g).toFixed(5),r=Number.parseFloat(t.color.b).toFixed(5),o=(null!==(e=Number.parseFloat(t.color.a))&&void 0!==e?e:1).toFixed(5);this.uniforms[Gf.STATIC_OPTIONS].set([n,i,r,o])}}class sm extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(sm)};super(sm.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float runtimeOptions[1];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\n\nvoid main() {\n vec4 textureColor = texture2D(first_texture, current_texture_coordinate_2d);\n gl_FragColor = vec4(textureColor.rgb, 1.0);\n}\n"},e,t)}static getFilterType(){return"solidImage"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}}class am extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(am)};super(am.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_position = vec4(position_3d.xyz, 1);\n gl_Position = normalize_position;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\n",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\n\n//CIE L*a*b* (CIELAB, L* for lightness, a* from green to red, b* from blue to yellow)\n//Source: https://gist.github.com/mattatz/44f081cac87e2f7c8980 (HLSL)\nvec3 rgb2xyz(vec3 c){\n vec3 tmp=vec3(\n (c.r>.04045)?pow((c.r+.055)/1.055,2.4):c.r/12.92,\n (c.g>.04045)?pow((c.g+.055)/1.055,2.4):c.g/12.92,\n (c.b>.04045)?pow((c.b+.055)/1.055,2.4):c.b/12.92\n );\n mat3 mat=mat3(\n .4124,.3576,.1805,\n .2126,.7152,.0722,\n .0193,.1192,.9505\n );\n return 100.*(tmp*mat);\n}\nvec3 xyz2lab(vec3 c){\n vec3 n=c/vec3(95.047,100.,108.883),\n v=vec3(\n (n.x>.008856)?pow(n.x,1./3.):(7.787*n.x)+(16./116.),\n (n.y>.008856)?pow(n.y,1./3.):(7.787*n.y)+(16./116.),\n (n.z>.008856)?pow(n.z,1./3.):(7.787*n.z)+(16./116.)\n );\n return vec3((116.*v.y)-16.,500.*(v.x-v.y),200.*(v.y-v.z));\n}\nvec3 rgb2lab(vec3 c){\n vec3 lab=xyz2lab(rgb2xyz(c));\n return vec3(lab.x/100.,.5+.5*(lab.y/127.),.5+.5*(lab.z/127.));\n}\n\nvoid main() {\n vec3 inColor = texture2D(first_texture, current_texture_coordinate_2d).rgb;\n vec3 inLab = rgb2lab(inColor);\n gl_FragColor = vec4(inLab, 1.0);\n}\n"},e,t)}static getFilterType(){return"lab"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=t.temperature?t.temperature:0,n=t.tint?t.tint:0;this.uniforms[Gf.STATIC_OPTIONS].set([e,n])}}class lm extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(lm)};super(lm.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n} ",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nvarying vec2 current_texture_coordinate_2d;\nuniform float staticOptions[1];\n\nvoid main() {\n float exposureStops = staticOptions[0];\n vec3 color = texture2D(first_texture, current_texture_coordinate_2d).rgb;\n \n // Convert exposure stops to multiplier: pow(2.0, stops)\n float multiplier = pow(2.0, exposureStops);\n \n // Apply exposure adjustment\n vec3 exposedColor = color * multiplier;\n \n gl_FragColor = vec4(exposedColor, 1.0);\n} "},e,t)}static getFilterType(){return"exposure"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=null===t.exposure?0:t.exposure;this.uniforms[Gf.STATIC_OPTIONS].set([e])}}var cm,um,dm,hm,fm,pm,mm,vm;function gm(){if(hm)return dm;hm=1;const t=um?cm:(um=1,cm={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]}),e={};for(const n of Object.keys(t))e[t[n]]=n;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"]}};dm=n;for(const t of Object.keys(n)){if(!("channels"in n[t]))throw new Error("missing channels property: "+t);if(!("labels"in n[t]))throw new Error("missing channel labels property: "+t);if(n[t].labels.length!==n[t].channels)throw new Error("channel and label counts mismatch: "+t);const{channels:e,labels:i}=n[t];delete n[t].channels,delete n[t].labels,Object.defineProperty(n[t],"channels",{value:e}),Object.defineProperty(n[t],"labels",{value:i})}function i(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}return n.rgb.hsl=function(t){const e=t[0]/255,n=t[1]/255,i=t[2]/255,r=Math.min(e,n,i),o=Math.max(e,n,i),s=o-r;let a,l;o===r?a=0:e===o?a=(n-i)/s:n===o?a=2+(i-e)/s:i===o&&(a=4+(e-n)/s),a=Math.min(60*a,360),a<0&&(a+=360);const c=(r+o)/2;return l=o===r?0:c<=.5?s/(o+r):s/(2-o-r),[a,100*l,100*c]},n.rgb.hsv=function(t){let e,n,i,r,o;const s=t[0]/255,a=t[1]/255,l=t[2]/255,c=Math.max(s,a,l),u=c-Math.min(s,a,l),d=function(t){return(c-t)/6/u+.5};return 0===u?(r=0,o=0):(o=u/c,e=d(s),n=d(a),i=d(l),s===c?r=i-n:a===c?r=1/3+e-i:l===c&&(r=2/3+n-e),r<0?r+=1:r>1&&(r-=1)),[360*r,100*o,100*c]},n.rgb.hwb=function(t){const e=t[0],i=t[1];let r=t[2];const o=n.rgb.hsl(t)[0],s=1/255*Math.min(e,Math.min(i,r));return r=1-1/255*Math.max(e,Math.max(i,r)),[o,100*s,100*r]},n.rgb.cmyk=function(t){const e=t[0]/255,n=t[1]/255,i=t[2]/255,r=Math.min(1-e,1-n,1-i);return[100*((1-e-r)/(1-r)||0),100*((1-n-r)/(1-r)||0),100*((1-i-r)/(1-r)||0),100*r]},n.rgb.keyword=function(n){const r=e[n];if(r)return r;let o,s=1/0;for(const e of Object.keys(t)){const r=i(n,t[e]);r<s&&(s=r,o=e)}return o},n.keyword.rgb=function(e){return t[e]},n.rgb.xyz=function(t){let e=t[0]/255,n=t[1]/255,i=t[2]/255;return e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92,[100*(.4124*e+.3576*n+.1805*i),100*(.2126*e+.7152*n+.0722*i),100*(.0193*e+.1192*n+.9505*i)]},n.rgb.lab=function(t){const e=n.rgb.xyz(t);let i=e[0],r=e[1],o=e[2];return i/=95.047,r/=100,o/=108.883,i=i>.008856?i**(1/3):7.787*i+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,o=o>.008856?o**(1/3):7.787*o+16/116,[116*r-16,500*(i-r),200*(r-o)]},n.hsl.rgb=function(t){const e=t[0]/360,n=t[1]/100,i=t[2]/100;let r,o,s;if(0===n)return s=255*i,[s,s,s];r=i<.5?i*(1+n):i+n-i*n;const a=2*i-r,l=[0,0,0];for(let t=0;t<3;t++)o=e+1/3*-(t-1),o<0&&o++,o>1&&o--,s=6*o<1?a+6*(r-a)*o:2*o<1?r:3*o<2?a+(r-a)*(2/3-o)*6:a,l[t]=255*s;return l},n.hsl.hsv=function(t){const e=t[0];let n=t[1]/100,i=t[2]/100,r=n;const o=Math.max(i,.01);return i*=2,n*=i<=1?i:2-i,r*=o<=1?o:2-o,[e,100*(0===i?2*r/(o+r):2*n/(i+n)),(i+n)/2*100]},n.hsv.rgb=function(t){const e=t[0]/60,n=t[1]/100;let i=t[2]/100;const r=Math.floor(e)%6,o=e-Math.floor(e),s=255*i*(1-n),a=255*i*(1-n*o),l=255*i*(1-n*(1-o));switch(i*=255,r){case 0:return[i,l,s];case 1:return[a,i,s];case 2:return[s,i,l];case 3:return[s,a,i];case 4:return[l,s,i];case 5:return[i,s,a]}},n.hsv.hsl=function(t){const e=t[0],n=t[1]/100,i=t[2]/100,r=Math.max(i,.01);let o,s;s=(2-n)*i;const a=(2-n)*r;return o=n*r,o/=a<=1?a:2-a,o=o||0,s/=2,[e,100*o,100*s]},n.hwb.rgb=function(t){const e=t[0]/360;let n=t[1]/100,i=t[2]/100;const r=n+i;let o;r>1&&(n/=r,i/=r);const s=Math.floor(6*e),a=1-i;o=6*e-s,1&s&&(o=1-o);const l=n+o*(a-n);let c,u,d;switch(s){default:case 6:case 0:c=a,u=l,d=n;break;case 1:c=l,u=a,d=n;break;case 2:c=n,u=a,d=l;break;case 3:c=n,u=l,d=a;break;case 4:c=l,u=n,d=a;break;case 5:c=a,u=n,d=l}return[255*c,255*u,255*d]},n.cmyk.rgb=function(t){const e=t[0]/100,n=t[1]/100,i=t[2]/100,r=t[3]/100;return[255*(1-Math.min(1,e*(1-r)+r)),255*(1-Math.min(1,n*(1-r)+r)),255*(1-Math.min(1,i*(1-r)+r))]},n.xyz.rgb=function(t){const e=t[0]/100,n=t[1]/100,i=t[2]/100;let r,o,s;return r=3.2406*e+-1.5372*n+-.4986*i,o=-.9689*e+1.8758*n+.0415*i,s=.0557*e+-.204*n+1.057*i,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,r=Math.min(Math.max(0,r),1),o=Math.min(Math.max(0,o),1),s=Math.min(Math.max(0,s),1),[255*r,255*o,255*s]},n.xyz.lab=function(t){let e=t[0],n=t[1],i=t[2];return e/=95.047,n/=100,i/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,[116*n-16,500*(e-n),200*(n-i)]},n.lab.xyz=function(t){let e,n,i;n=(t[0]+16)/116,e=t[1]/500+n,i=n-t[2]/200;const r=n**3,o=e**3,s=i**3;return n=r>.008856?r:(n-16/116)/7.787,e=o>.008856?o:(e-16/116)/7.787,i=s>.008856?s:(i-16/116)/7.787,e*=95.047,n*=100,i*=108.883,[e,n,i]},n.lab.lch=function(t){const e=t[0],n=t[1],i=t[2];let r;return r=360*Math.atan2(i,n)/2/Math.PI,r<0&&(r+=360),[e,Math.sqrt(n*n+i*i),r]},n.lch.lab=function(t){const e=t[0],n=t[1],i=t[2]/360*2*Math.PI;return[e,n*Math.cos(i),n*Math.sin(i)]},n.rgb.ansi16=function(t,e=null){const[i,r,o]=t;let s=null===e?n.rgb.hsv(t)[2]:e;if(s=Math.round(s/50),0===s)return 30;let a=30+(Math.round(o/255)<<2|Math.round(r/255)<<1|Math.round(i/255));return 2===s&&(a+=60),a},n.hsv.ansi16=function(t){return n.rgb.ansi16(n.hsv.rgb(t),t[2])},n.rgb.ansi256=function(t){const e=t[0],n=t[1],i=t[2];return e===n&&n===i?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5)},n.ansi16.rgb=function(t){let e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];const n=.5*(1+~~(t>50));return[(1&e)*n*255,(e>>1&1)*n*255,(e>>2&1)*n*255]},n.ansi256.rgb=function(t){if(t>=232){const e=10*(t-232)+8;return[e,e,e]}let e;return t-=16,[Math.floor(t/36)/5*255,Math.floor((e=t%36)/6)/5*255,e%6/5*255]},n.rgb.hex=function(t){const e=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(e.length)+e},n.hex.rgb=function(t){const e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let n=e[0];3===e[0].length&&(n=n.split("").map((t=>t+t)).join(""));const i=parseInt(n,16);return[i>>16&255,i>>8&255,255&i]},n.rgb.hcg=function(t){const e=t[0]/255,n=t[1]/255,i=t[2]/255,r=Math.max(Math.max(e,n),i),o=Math.min(Math.min(e,n),i),s=r-o;let a,l;return a=s<1?o/(1-s):0,l=s<=0?0:r===e?(n-i)/s%6:r===n?2+(i-e)/s:4+(e-n)/s,l/=6,l%=1,[360*l,100*s,100*a]},n.hsl.hcg=function(t){const e=t[1]/100,n=t[2]/100,i=n<.5?2*e*n:2*e*(1-n);let r=0;return i<1&&(r=(n-.5*i)/(1-i)),[t[0],100*i,100*r]},n.hsv.hcg=function(t){const e=t[1]/100,n=t[2]/100,i=e*n;let r=0;return i<1&&(r=(n-i)/(1-i)),[t[0],100*i,100*r]},n.hcg.rgb=function(t){const e=t[0]/360,n=t[1]/100,i=t[2]/100;if(0===n)return[255*i,255*i,255*i];const r=[0,0,0],o=e%1*6,s=o%1,a=1-s;let l=0;switch(Math.floor(o)){case 0:r[0]=1,r[1]=s,r[2]=0;break;case 1:r[0]=a,r[1]=1,r[2]=0;break;case 2:r[0]=0,r[1]=1,r[2]=s;break;case 3:r[0]=0,r[1]=a,r[2]=1;break;case 4:r[0]=s,r[1]=0,r[2]=1;break;default:r[0]=1,r[1]=0,r[2]=a}return l=(1-n)*i,[255*(n*r[0]+l),255*(n*r[1]+l),255*(n*r[2]+l)]},n.hcg.hsv=function(t){const e=t[1]/100,n=e+t[2]/100*(1-e);let i=0;return n>0&&(i=e/n),[t[0],100*i,100*n]},n.hcg.hsl=function(t){const e=t[1]/100,n=t[2]/100*(1-e)+.5*e;let i=0;return n>0&&n<.5?i=e/(2*n):n>=.5&&n<1&&(i=e/(2*(1-n))),[t[0],100*i,100*n]},n.hcg.hwb=function(t){const e=t[1]/100,n=e+t[2]/100*(1-e);return[t[0],100*(n-e),100*(1-n)]},n.hwb.hcg=function(t){const e=t[1]/100,n=1-t[2]/100,i=n-e;let r=0;return i<1&&(r=(n-i)/(1-i)),[t[0],100*i,100*r]},n.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},n.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},n.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},n.gray.hsl=function(t){return[0,0,t[0]]},n.gray.hsv=n.gray.hsl,n.gray.hwb=function(t){return[0,100,t[0]]},n.gray.cmyk=function(t){return[0,0,0,t[0]]},n.gray.lab=function(t){return[t[0],0,0]},n.gray.hex=function(t){const e=255&Math.round(t[0]/100*255),n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n},n.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]},dm}function ym(){if(pm)return fm;pm=1;const t=gm();function e(t,e){return function(n){return e(t(n))}}function n(n,i){const r=[i[n].parent,n];let o=t[i[n].parent][n],s=i[n].parent;for(;i[s].parent;)r.unshift(i[s].parent),o=e(t[i[s].parent][s],o),s=i[s].parent;return o.conversion=r,o}return fm=function(e){const i=function(e){const n=function(){const e={},n=Object.keys(t);for(let t=n.length,i=0;i<t;i++)e[n[i]]={distance:-1,parent:null};return e}(),i=[e];for(n[e].distance=0;i.length;){const e=i.pop(),r=Object.keys(t[e]);for(let t=r.length,o=0;o<t;o++){const t=r[o],s=n[t];-1===s.distance&&(s.distance=n[e].distance+1,s.parent=e,i.unshift(t))}}return n}(e),r={},o=Object.keys(i);for(let t=o.length,e=0;e<t;e++){const t=o[e];null!==i[t].parent&&(r[t]=n(t,i))}return r}}var bm=function(){if(vm)return mm;vm=1;const t=gm(),e=ym(),n={};return Object.keys(t).forEach((i=>{n[i]={},Object.defineProperty(n[i],"channels",{value:t[i].channels}),Object.defineProperty(n[i],"labels",{value:t[i].labels});const r=e(i);Object.keys(r).forEach((t=>{const e=r[t];n[i][t]=function(t){const e=function(...e){const n=e[0];if(null==n)return n;n.length>1&&(e=n);const i=t(e);if("object"==typeof i)for(let t=i.length,e=0;e<t;e++)i[e]=Math.round(i[e]);return i};return"conversion"in t&&(e.conversion=t.conversion),e}(e),n[i][t].raw=function(t){const e=function(...e){const n=e[0];return null==n?n:(n.length>1&&(e=n),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}(e)}))})),mm=n}(),km=Ud(bm);class xm extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(xm)};super(xm.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform float staticOptions[3];\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 blend = texture2D(first_texture, current_texture_coordinate_2d);\n \n vec3 blendRGB = blend.rgb;\n vec3 baseRGB = vec3(staticOptions[0], staticOptions[1], staticOptions[2]);\n \n vec3 limit = step(0.5, blendRGB);\n vec3 mixedRGB = mix(2.0 * baseRGB * blendRGB, 1.0 - 2.0 * (1.0 - baseRGB) * (1.0 - blendRGB), limit);\n \n gl_FragColor = vec4((mixedRGB * blend.a) + ((1.0 - blend.a) * baseRGB), 1);\n}"},e,t)}static getFilterType(){return"hardLight"}static getInputsCount(){return 1}static getInitialOptions(){return{color:"4b0082"}}getOptionsDisplay(){return[{properties:["color"],type:"colorPicker"}]}handleStaticUniforms(t){const e=km.hex.rgb(t.color).map((t=>t/255));this.uniforms[Gf.STATIC_OPTIONS].set([e[0],e[1],e[2]])}}class wm extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(wm)};super(wm.getFilterType(),{vertex:"precision lowp float;\n\nattribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[1];\nuniform float staticOptions[6];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float exposure_value;\n\n\nfloat getCurrentBeizerProgress(vec2 p1, vec2 p2, float t){\n vec2 p0 = vec2(0,0);\n vec2 p3 = vec2(1,1);\n \n vec2 E = mix(p0, p1, t);\n vec2 F = mix(p1, p2, t);\n vec2 G = mix(p2, p3, t);\n\n vec2 H = mix(E, F, t);\n vec2 I = mix(F, G, t);\n\n vec2 P = mix(H, I, t);\n\n return P.y;\n}\n\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n \n // transfrom logic // \n // normalized time range from 0 to 1\n float current_time = runtimeOptions[0];\n float current_power_progress = getCurrentBeizerProgress(\n vec2(staticOptions[2], staticOptions[3]),\n vec2(staticOptions[4], staticOptions[5]),\n current_time\n );\n \n current_texture_coordinate_2d = texture_coordinate_2d;\n exposure_value = mix(staticOptions[0], staticOptions[1], current_power_progress);\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float exposure_value;\n\nvoid main() {\n vec4 texture = texture2D(first_texture, current_texture_coordinate_2d);\n gl_FragColor = vec4((texture.xyz) * (1.0 + exposure_value) , texture.w);\n}\n\n"},e,t)}static getFilterType(){return"exposureTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{properties:{power:{form:0,to:0,ease:[0,0,1,1]}}}}handleStaticUniforms(t){const e=t.properties.power;this.uniforms[Gf.STATIC_OPTIONS].set([e.from,e.to,...e.ease])}static getUniformList(){return[Gf.FIRST_TEXTURE,Vf]}}class _m extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(_m)};super(_m.getFilterType(),{vertex:"precision lowp float;\n\nattribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[1];\nuniform float staticOptions[6];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float dipToBlack_value;\n\n\nfloat getCurrentBeizerProgress(vec2 p1, vec2 p2, float t){\n vec2 p0 = vec2(0,0);\n vec2 p3 = vec2(1,1);\n \n vec2 E = mix(p0, p1, t);\n vec2 F = mix(p1, p2, t);\n vec2 G = mix(p2, p3, t);\n\n vec2 H = mix(E, F, t);\n vec2 I = mix(F, G, t);\n\n vec2 P = mix(H, I, t);\n\n return P.y;\n}\n\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n \n // transfrom logic // \n // normalized time range from 0 to 1\n float current_time = runtimeOptions[0];\n float current_power_progress = getCurrentBeizerProgress(\n vec2(staticOptions[2], staticOptions[3]),\n vec2(staticOptions[4], staticOptions[5]),\n current_time\n );\n \n current_texture_coordinate_2d = texture_coordinate_2d;\n dipToBlack_value = mix(staticOptions[0], staticOptions[1], current_power_progress);\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float dipToBlack_value;\n\nvoid main() {\n vec4 texture = texture2D(first_texture, current_texture_coordinate_2d);\n gl_FragColor = vec4(texture.xyz - dipToBlack_value, texture.w);\n}"},e,t)}static getFilterType(){return"dipToBlackTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{}}handleStaticUniforms(t){const e=t.properties.power;this.uniforms[Gf.STATIC_OPTIONS].set([e.from,e.to,...e.ease])}static getUniformList(){return[Gf.FIRST_TEXTURE,Vf]}}class Im extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(Im)};super(Im.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[1];\nuniform float staticOptions[16];\n\nvarying vec2 current_texture_coordinate_2d;\n\nfloat getCurrentBeizerProgress(vec2 p1, vec2 p2, float t){\n vec2 p0 = vec2(0,0);\n vec2 p3 = vec2(1,1);\n \n vec2 E = mix(p0, p1, t);\n vec2 F = mix(p1, p2, t);\n vec2 G = mix(p2, p3, t);\n\n vec2 H = mix(E, F, t);\n vec2 I = mix(F, G, t);\n\n vec2 P = mix(H, I, t);\n\n return P.y;\n}\n\n\nvoid main() {\n // time range from 0 to 1\n float current_time = runtimeOptions[0];\n\n // scale X\n float current_scale_x_progress = getCurrentBeizerProgress(\n vec2(staticOptions[4],staticOptions[5]),\n vec2(staticOptions[6],staticOptions[7]),\n current_time\n );\n float currnet_scale_x_value = mix(staticOptions[0], staticOptions[1], current_scale_x_progress);\n\n // scale Y\n float current_scale_y_progress = getCurrentBeizerProgress(\n vec2(staticOptions[4],staticOptions[5]),\n vec2(staticOptions[6],staticOptions[7]),\n current_time\n );\n float currnet_scale_y_value = mix(staticOptions[2], staticOptions[3], current_scale_y_progress);\n\n // translate x\n float current_translate_x_progress = getCurrentBeizerProgress(\n vec2(staticOptions[12],staticOptions[13]),\n vec2(staticOptions[14],staticOptions[15]),\n current_time\n );\n \n float currnet_translate_x_value = mix(staticOptions[8], staticOptions[9], current_translate_x_progress); \n\n // translate y\n float current_translate_y_progress = getCurrentBeizerProgress(\n vec2(staticOptions[12],staticOptions[13]),\n vec2(staticOptions[14],staticOptions[15]),\n current_time\n );\n float currnet_translate_y_value = mix(staticOptions[10], staticOptions[11], current_translate_y_progress); \n\n // See Default vertex shader, we normalize y axis to be -y\n // because of webgl texture coordinates\n currnet_translate_y_value = currnet_translate_y_value * -1.0;\n\n // create matries\n mat4 scaleMatrix;\n scaleMatrix[0] = vec4(currnet_scale_x_value, 0, 0, 0); \n scaleMatrix[1] = vec4(0, currnet_scale_y_value, 0, 0); \n scaleMatrix[2] = vec4(0, 0, 1, 0); \n scaleMatrix[3] = vec4(0, 0, 0, 1); \n\n mat4 translateMatrix;\n translateMatrix[0] = vec4(1, 0, 0, 0); \n translateMatrix[1] = vec4(0, 1, 0, 0); \n translateMatrix[2] = vec4(0, 0, 1, 0); \n translateMatrix[3] = vec4(currnet_translate_x_value, currnet_translate_y_value, 0, 1); \n\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = translateMatrix * scaleMatrix * normalize_poistion;\n // gl_Position = translateMatrix * scaleMatrix * normalize_poistion;\n \n \n current_texture_coordinate_2d = texture_coordinate_2d;\n \n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n gl_FragColor = texture2D(first_texture, current_texture_coordinate_2d);\n}"},e,t)}static getFilterType(){return"transformTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{}}handleStaticUniforms(t){const e=t.properties.scale||{},n=t.properties.translate||{};e.ease=e.ease||[0,0,1,1],n.ease=n.ease||[0,0,1,1],this.uniforms[Gf.STATIC_OPTIONS].set([e.from&&e.from.x||1,e.to&&e.to.x||1,e.from&&e.from.y||1,e.to&&e.to.y||1,...e.ease,n.from&&n.from.x||0,n.to&&n.to.x||0,n.from&&n.from.y||0,n.to&&n.to.y||0,...n.ease])}static getUniformList(){return[Gf.FIRST_TEXTURE,Vf]}}class Tm extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(Tm)};super(Tm.getFilterType(),{vertex:"precision lowp float;\n\nattribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float staticOptions[8];\nuniform float runtimeOptions[3];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float current_power_value;\n\nfloat getCurrentBeizerProgress(vec2 p1, vec2 p2, float t){\n vec2 p0 = vec2(0,0);\n vec2 p3 = vec2(1,1);\n \n vec2 E = mix(p0, p1, t);\n vec2 F = mix(p1, p2, t);\n vec2 G = mix(p2, p3, t);\n\n vec2 H = mix(E, F, t);\n vec2 I = mix(F, G, t);\n\n vec2 P = mix(H, I, t);\n\n return P.y;\n}\n\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n float current_time = runtimeOptions[0];\n float current_power_progress = getCurrentBeizerProgress(\n vec2(staticOptions[2],staticOptions[3]),\n vec2(staticOptions[4],staticOptions[5]),\n current_time\n );\n \n // varing\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_power_value = mix(staticOptions[0], staticOptions[1], current_power_progress);\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform float staticOptions[8];\nuniform float runtimeOptions[3];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float current_power_value;\n\nconst int samples = 12; //multiple of 2\n\nvoid main() {\n vec2 pixel = vec2(1.0/runtimeOptions[1], 1.0/runtimeOptions[2]);\n vec2 direction = vec2(staticOptions[6], staticOptions[7]);\n \n vec4 color = vec4(0.0); \n\n for (int i=1; i<=samples/2; i++) {\n vec2 motion = float(i) * current_power_value / float(samples / 2) * direction * pixel;\n \n color += texture2D(\n first_texture,\n current_texture_coordinate_2d + motion);\n\n color += texture2D(\n first_texture,\n current_texture_coordinate_2d - motion);\n }\n\t\n color = color/float(samples);\n\n \n gl_FragColor = color;\n // gl_FragColor = vec4(0,1,0,1);\n \n}"},e,t)}static getFilterType(){return"motionBlurTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{}}handleStaticUniforms(t){const e=t.properties.power||{from:0,to:0},n=t.properties.direction||{x:0,y:0};e.ease=e.ease||[0,0,1,1],this.uniforms[Gf.STATIC_OPTIONS].set([e.from,e.to,...e.ease,n.x,n.y])}static getUniformList(){return[Gf.FIRST_TEXTURE,Vf,Uf]}}class Em extends Zf{constructor(t){const e={uniforms:Zf.getUniformInfo(Em)};super(Em.getFilterType(),{vertex:"precision lowp float;\n\nattribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[1];\nuniform float staticOptions[9];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float current_power_value;\n\nfloat getCurrentBeizerProgress(vec2 p1, vec2 p2, float t){\n vec2 p0 = vec2(0,0);\n vec2 p3 = vec2(1,1);\n \n vec2 E = mix(p0, p1, t);\n vec2 F = mix(p1, p2, t);\n vec2 G = mix(p2, p3, t);\n\n vec2 H = mix(E, F, t);\n vec2 I = mix(F, G, t);\n\n vec2 P = mix(H, I, t);\n\n return P.y;\n}\n\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n float current_time = runtimeOptions[0];\n float current_power_progress = getCurrentBeizerProgress(\n vec2(staticOptions[2],staticOptions[3]),\n vec2(staticOptions[4],staticOptions[5]),\n current_time\n );\n \n // varing\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_power_value = mix(staticOptions[0], staticOptions[1], current_power_progress);\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\nuniform float staticOptions[9];\n\nvarying vec2 current_texture_coordinate_2d;\nvarying float current_power_value;\n\nvoid main() {\n vec4 texture = texture2D(first_texture, current_texture_coordinate_2d);\n vec4 fadeColor = vec4(staticOptions[6], staticOptions[7], staticOptions[8], 1.0) ;\n gl_FragColor = mix(texture,fadeColor, current_power_value);\n}"},e,t)}static getFilterType(){return"fadeToColorTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{properties:{power:{form:0,to:0,ease:[0,0,1,1]},color:"#FFFFFF"}}}handleStaticUniforms(t){const e=t.properties.power||{from:0,to:0};e.ease=e.ease||[0,0,1,1];const n=t.properties.color,i=km.hex.rgb(n).map((t=>t/255));this.uniforms[Gf.STATIC_OPTIONS].set([e.from,e.to,...e.ease,i[0],i[1],i[2]])}static getUniformList(){return[Gf.FIRST_TEXTURE,Vf]}}var Sm=Object.freeze({__proto__:null,Crop:rm,Curves:Xp,Default:tp,DipToBlackTransition:_m,DirectionalBlur:up,Exposure:lm,ExposureTransition:wm,FadeToColorTransition:Em,FastBlur:cp,HardLight:xm,HorizontalBlur:ap,Hue:tm,Lab:am,Levels:Qp,Lut:pp,MotionBlurTransition:Tm,Opacity:dp,Saturation:im,ShapeComposite:fp,ShapeCompositeMask:hp,Solid:om,SolidImage:sm,Transform:sp,TransformTransition:Im,VerticalBlur:lp,Vibrance:nm,WhiteBalance:em});const Mm=Object.values(Sm).reduce(((t,e)=>(t[e.getFilterType()]=e,t)),{});class Am{constructor(t){this.context=t}static getFilterClass(t){return Mm[t]}getFilterIds(){return Object.keys(this.filterTypeToInstanceMap)}create(t,e){this.context={...this.context,options:e.options};const n=new Mm[t](this.context);if(!n)throw new Error(`${t} is not a atom filter, atomFilter list: `,this.getFilterIds());return n}}const Nm=qh.PREVIOUS_OUTPUT_PREFIX,Fm=Object.values(Sm).reduce(((t,e)=>(t[e.getFilterType()]={type:e.getFilterType(),options:e.getInitialOptions(),inputs:[...Array(e.getInputsCount())].map(((t,e)=>`${Nm}${e}`)),outputs:[]},t)),{});var Cm,Om,Pm=function(){if(Om)return Cm;Om=1;var t=function(t){return function(t){return!!t&&"object"==typeof t}(t)&&(n=t,!("[object RegExp]"===(i=Object.prototype.toString.call(n))||"[object Date]"===i||n.$$typeof===e));var n,i},e="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(t,e){return!1!==e.clone&&e.isMergeableObject(t)?s((n=t,Array.isArray(n)?[]:{}),t,e):t;var n}function i(t,e,i){return t.concat(e).map((function(t){return n(t,i)}))}function r(t){return Object.keys(t).concat((e=t,Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]));var e}function o(t,e){try{return e in t}catch(t){return!1}}function s(e,a,l){(l=l||{}).arrayMerge=l.arrayMerge||i,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=n;var c=Array.isArray(a);return c===Array.isArray(e)?c?l.arrayMerge(e,a,l):function(t,e,i){var a={};return i.isMergeableObject(t)&&r(t).forEach((function(e){a[e]=n(t[e],i)})),r(e).forEach((function(r){var l,c;o(l=t,c=r)&&(!Object.hasOwnProperty.call(l,c)||!Object.propertyIsEnumerable.call(l,c))||(o(t,r)&&i.isMergeableObject(e[r])?a[r]=function(t,e){if(!e.customMerge)return s;var n=e.customMerge(t);return"function"==typeof n?n:s}(r,i)(t[r],e[r],i):a[r]=n(e[r],i))})),a}(e,a,l):n(a,l)}return s.all=function(t,e){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce((function(t,n){return s(t,n,e)}),{})},Cm=s}(),Rm=Ud(Pm),Dm=function(t,e){return Rm(t,e,{arrayMerge:(t,e)=>e})};const Bm=qh.MESSAGES.UPDATE_OPTIONS;let Lm=class{constructor(t,e){this.eventEmitter=new Xh,this.type=t,this.inputs=e.inputs,this.outputs=e.outputs,this.options=e.options}render(){throw new Error("concrete class should implement")}_updateOptions(){throw new Error("concrete class should implement")}updateOptions(t){this._updateOptions(t),this.eventEmitter.emit(Bm,this.options)}updateInputs(t){t&&(this.inputs.length===t.length&&this.inputs.every(((e,n)=>e===t[n]))||(this.inputs=[...t]))}getEventEmitter(){return this.eventEmitter}getType(){return this.type}getInputs(){return this.inputs}getOutputs(){return this.outputs}getOptions(){return this.options}getInfo(){return{inputs:this.inputs,outputs:this.outputs,options:this.options}}getOptionsDisplay(){return this.filter.getOptionsDisplay()}dispose(){throw new Error("concrete class should implement")}};class zm extends Lm{constructor(t,e,n){super(...arguments),this.filter=n.filterFactory.create(this.type,{options:this.options})}render(t){const e=t.ioStore,n=t.graphIOManager,i=this.getInputs(),r=this.getOutputs(),o=e.get(i),s=this.filter.render(o,this.options);return n.setOutputs(e,r,s),s}_updateOptions(t){this.options=Dm(this.options,t),this.filter.updateStaticUniforms(this.options)}dispose(){this.filter.dispose()}}const Wm=qh.MESSAGES.UPDATE_OPTIONS;class jm extends zm{constructor(t,e,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}baseNodeUpdateOptions(t){this.options=Dm(this.options,t),this.filter.updateStaticUniforms(this.options)}registerListeners(){this.baseNode.getEventEmitter().on(Wm,this.baseNodeUpdateOptions,this)}dispose(){this.filter.dispose(),this.baseNode.getEventEmitter().off(Wm,this.baseNodeUpdateOptions,this)}}function $m(t){return null!==t&&"object"==typeof t}function Um(t){if(!$m(t)||(e=t,Array.isArray(e)))return t;var e;const n=Object.keys(t).sort(),i={};return n.forEach((e=>{i[e]=Um(t[e])})),i}function qm(t,e){return null!=t&&t.id&&null!=e&&e.id?t.type===e.type&&t.id===e.id:t.type===e.type}function Vm(t,e){const n=[];t.forEach(((t,i)=>{const r=(o=t,e.findIndex((t=>function(t,e){const n=JSON.parse(JSON.stringify(t));return r=JSON.parse(JSON.stringify(e)),$m(i=n)&&$m(r)?JSON.stringify(Um(i))===JSON.stringify(Um(r)):!(!Number.isNaN(i)||!Number.isNaN(r))||i===r;var i,r}(o,t))));var o;if(-1!==r)return void n.push({type:"take",index:r});const s=(a=t,l=i,(c=e)&&c[l]&&qm(a,c[l])?l:c.findIndex((t=>qm(a,t))));var a,l,c;-1===s?n.push({type:"create",newGraphIndex:i}):n.push({type:"update",currentGraphIndex:s,newGraphIndex:i})}));const i=n.reduce(((t,e)=>("take"===e.type?t.push(e.index):"update"===e.type&&t.push(e.currentGraphIndex),t)),[]);return e.reduce(((t,e,n)=>(i.includes(n)||t.push(n),t)),[]).forEach((t=>{n.push({type:"dispose",currentGraphIndex:t})})),n}function Gm(t,e,n,i){const r=[];return t.forEach((t=>{switch(t.type){case"take":r.push(n[t.index]);break;case"update":const o=e[t.newGraphIndex].options,s=n[t.currentGraphIndex];s.updateInputs(e[t.newGraphIndex].inputs),s.updateOptions(o),r.push(s);break;case"create":const a=rv.create(e[t.newGraphIndex],i);r.push(a);break;case"dispose":n[t.currentGraphIndex].dispose();break;default:throw new Error("cant apply action type: ",t.type)}})),r}var Hm=function(t,e,n,i){const r=t.graph,o=e.graph;if(!(o&&r&&Array.isArray(o)&&Array.isArray(r)))throw new Error("cant apply new composite options",t);return Gm(Vm(r,o),r,n,i)};class Km extends Lm{constructor(t,e,n){super(...arguments),this.context=n,this.nodes=this.createNodes(this.options)}createNodes(t){if(!t||!t.graph)throw new Error("cant create composite node, please supply info.options.graph");return t.graph.map((t=>rv.create(t,this.context)))}render(t){const e=t.ioStore,n=t.graphIOManager;let i=n.getPrevOutput(e);const r=this.outputs;if(this.nodes.length){const t=new ef(e),r="__PREVIOUS:0",o=[],s=new Set;this.nodes.forEach(((e,a)=>{const l={ioStore:t,graphIOManager:n},c=e.getOutputs?e.getOutputs():void 0,u=Array.isArray(c)?c:[],d={};u.forEach((e=>{d[e]=t.get(e)}));const h=t.get(r);i=e.render(l),a!==this.nodes.length-1&&o.push(i);const f=new Set;if(h&&h!==i&&f.add(h),u.forEach((t=>{const e=d[t];e&&e!==i&&f.add(e)})),f.size){const e=new Set(Object.values(t.get()));f.forEach((t=>{e.has(t)||(n.disposeTextures([t],i),s.add(t))}))}}));const a=o.filter((t=>!s.has(t)));n.disposeTextures(a,i)}return n.setOutputs(e,r,i),i}getOptionsDisplay(){return[]}_updateOptions(t){this.nodes=Hm(t,this.options,this.nodes,this.context),this.options=t}dispose(){this.nodes.forEach((t=>{t.dispose()}))}}const Xm=qh.MESSAGES.UPDATE_OPTIONS;class Ym extends Km{constructor(t,e,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}registerListeners(){this.baseNode.getEventEmitter().on(Xm,this.updateOptions,this)}dispose(){this.nodes.forEach((t=>{t.dispose()})),this.baseNode.getEventEmitter().off(Xm,this.updateOptions,this)}}const Qm=qh.SYSTEM_NODES.TAGS.ATOM,Jm=qh.SYSTEM_NODES.TAGS.FILTER,Zm=qh.SYSTEM_NODES.TAGS.COMPOSITE_FILTER,tv=qh.SYSTEM_NODES.TAGS.TRANSITION_FILTER,ev=qh.PREVIOUS_OUTPUT_PREFIX,nv=Object.keys(Fm);function iv(t,e){const n=(i=t.type,Fm[i]);var i;return t=Dm(n,t),new zm(t.type,t,e)}var rv={create:function(t,e){let n;switch(function(t){let e;return n=t,e=nv.includes(n)?Qm:t===Zm?Zm:t===tv?tv:Jm,e;var n}((t=JSON.parse(JSON.stringify(t))).type)){case Qm:n=iv(t,e);break;case Jm:n=function(t,e){const n=function(t,e){const n=e.get(t);if(!n)throw new Error(`no base node, cant resolve type: ${t}`);return n}(t.type,e.nodeStore),i=n.getType(),r=n.getInfo();let o;return t=Dm(r,t),e={...e,baseNode:n},o=i===Zm?new Ym(i,t,e):new jm(i,t,e),o}(t,e);break;case Zm:n=function(t,e){const n=t.type;return t=Dm({inputs:[`${ev}0`]},t),new Km(n,t,e)}(t,e);break;case tv:n=function(t,e){const n=t.options.filter;if(!n)throw new Error(`transition filter should supply base filter ${n}`);return t.type=`${n}Transition`,iv(t,e)}(t,e);break;default:throw new Error("cant create node",t.type)}return n}};const ov=qh.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS;var sv=function(t){const e={[ov]:Fm[ov]};for(const[n,i]of Object.entries(e)){const e=rv.create(i,t);t.nodeStore.set(n,e)}},av=function(t,e){for(const[n,i]of Object.entries(t)){const t=rv.create(i,e);e.nodeStore.set(n,t)}};const lv=qh.CAPTURED_FRAME_PREFIX;class cv{constructor(t){return this.textureManager=t.textureManager,this.currentFrameTextures={0:this.textureManager.createTexture({type:"frame"})},this.saveInNextFrameTextures=[],this.savedFramesTextures={},this.reservedUnits=new Set([this.currentFrameTextures[0].getUnit()]),{capture:this.capture.bind(this),createCaptureId:this.createCaptureId.bind(this),releaseCaptureId:this.releaseCaptureId.bind(this),getCurrentFrames:this.getCurrentFrames.bind(this),getSavedFrames:this.getSavedFrames.bind(this),isReservedUnit:this.isReservedUnit.bind(this)}}updateCurrentFrame(t,e){e=e||0,this.currentFrameTextures[e].fill(t)}saveFrame(t){0!==this.saveInNextFrameTextures.length&&(this.saveInNextFrameTextures.forEach((e=>{e.fill(t)})),this.saveInNextFrameTextures=[])}capture(t,e){(t.videoHeight>150||t.displayHeight>150)&&(this.updateCurrentFrame(t,e),this.saveFrame(t))}createCaptureId(){const t=this.textureManager.createTexture({type:"frame"});this.saveInNextFrameTextures.push(t);const e=t.getUnit(),n=`${lv}${e}`;return this.savedFramesTextures[n]=t,this.reservedUnits.add(e),n}releaseCaptureId(t){if("string"!=typeof t)throw new Error("capture id should be string");delete this.saveInNextFrameTextures[t];const e=t.split(":")[1];this.reservedUnits.delete(parseInt(e,10))}getCurrentFrames(){return this.currentFrameTextures}getSavedFrames(){return this.savedFramesTextures}isReservedUnit(t){return this.reservedUnits.has(t)}}const uv=sh("ShaderGraphApplication","warn"),dv=qh.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS,hv=Object.freeze({useCanvasSizedFilterTargets:!1,rebindAttributesOnProgramSwitch:!0,forwardContextAttributes:!0});function fv(t={}){const e=null==t?void 0:t.performanceToggles;return e&&"object"==typeof e?{...hv,...e}:{...hv}}class pv{constructor(t,e={}){return this.glSource=t,this.config=e,this.performanceToggles=fv(e),this.isContextLost=!1,this.isRecovering=!1,this.isDisposed=!1,this.pendingNodeOptionUpdates=new Map,this.doInit(t,e)}doInit(t,e){this.source=Zh(t),this.performanceToggles=fv(e),this.isDisposed=!1,this.resetViewportSyncState(),this.render=this.render.bind(this),this.resizeCanvasSize=this.resizeCanvasSize.bind(this),this.setSrcVidTracks=this.setSrcVidTracks.bind(this),this.onWebGLContextLost=this.onWebGLContextLost.bind(this),this.onForceRender=this.onForceRender.bind(this),this.resizeCanvasSize._shouldPreventDefault=!0;const n=function(t={},e=hv){const n=null!=t&&t.glOptions&&"object"==typeof t.glOptions?{...t.glOptions}:{},i=n.__shaderGraph&&"object"==typeof n.__shaderGraph?n.__shaderGraph:{};return{...n,__shaderGraph:{...i,forwardContextAttributes:!1!==e.forwardContextAttributes}}}(e,this.performanceToggles);return this.gl=this.source.init(this.setSrcVidTracks,this.resizeCanvasSize,n),this.addCanvasListeners(),this.addSourceListeners(),this.exposeDebugGlobalIfBrowser(),this.selectedRenderNode=null,this.setupRenderInfrastructure(t,e),e.userWillCallRender||(this.rafId=requestAnimationFrame(this.render)),this.dirtyCanvasSize=!0,{getNodes:this.getNodes.bind(this),addNodes:this.addClientNodes.bind(this),selectNode:this.selectNode.bind(this),addTexture:this.addTexture.bind(this),releaseTexture:this.releaseTexture.bind(this),captureTexture:this.captureTexture.bind(this),disposeTexture:this.disposeTexture.bind(this),updateOptions:this.updateOptions.bind(this),render:this.render,dispose:this.dispose.bind(this)}}exposeDebugGlobalIfBrowser(){"undefined"!=typeof window&&(window.ekoShaderGraph=this)}setupRenderInfrastructure(t,e){this.activeTextures=this.activeTextures||new Set,this.textureManager=new uf({gl:this.gl,activeTextures:this.activeTextures}),this.capturedFramesManager=new cv({textureManager:this.textureManager}),this.graphIOManager=new yf({glSource:t,gl:this.gl,textureManager:this.textureManager,capturedFramesManager:this.capturedFramesManager}),this.frameBufferFactory=new Tf({gl:this.gl,textureManager:this.textureManager,useCanvasSizedFilterTargets:this.performanceToggles.useCanvasSizedFilterTargets}),this.filterFactory=new Am({gl:this.gl,frameBufferFactory:this.frameBufferFactory,rebindAttributesOnProgramSwitch:this.performanceToggles.rebindAttributesOnProgramSwitch}),this.nodeStore=new ef,this.ioStore=new ef,sv({nodeStore:this.nodeStore,filterFactory:this.filterFactory}),this.addClientNodes(e.nodes,this.isRecovering)}getNodes(){return uv.debug("[getNodes]"),this.nodeStore.get()}addClientNodes(t,e=!1){if(uv.debug("[addClientNodes]",t),t&&!e&&(this.addClientNodeInvocations=this.addClientNodeInvocations||[],this.addClientNodeInvocations.push(t)),!e&&this.isContextUnavailable())return;t=t||{};const n=JSON.parse(JSON.stringify(t));av(n,{nodeStore:this.nodeStore,filterFactory:this.filterFactory})}addTexture(t,e,n){if(uv.debug("[addTexture]",t,e,n),this.isContextUnavailable())return null;let i=this.textureManager.createTexture({type:e});return i.isStatic=!0,t&&i.fill(t),this.graphIOManager.setTextureSource(this.ioStore,i,n),i}releaseTexture(t){uv.debug("[releaseTexture]",t),this.isContextUnavailable()||this.textureManager.releaseTexture(t)}selectNode(t){if(uv.debug("[selectNode]",t),!this.isContextUnavailable())return this.nodeStore.get(t)||uv.warn("Missing render node",t),void(this.selectedRenderNodeId=t);this.selectedRenderNodeId=t}captureTexture(){return uv.debug("[captureTexture]"),this.isContextUnavailable()?null:this.capturedFramesManager.createCaptureId()}disposeTexture(t){return uv.debug("[disposeTexture]",t),this.isContextUnavailable()||"string"!=typeof t?null:this.capturedFramesManager.releaseCaptureId(t)}setSrcVidTracks(t){this.isContextUnavailable()||this.capturedFramesManager&&this.capturedFramesManager.capture(t)}resizeCanvasSize(t,e,n,i){this.dirtyCanvasSize={width:n,height:i}}resetViewportSyncState(){this._lastSyncedViewportCanvasWidth=null,this._lastSyncedViewportCanvasHeight=null}syncViewportToCanvasBackingStoreIfChanged(){var t,e;const n=null===(t=this.gl)||void 0===t||null===(t=t.canvas)||void 0===t?void 0:t.width,i=null===(e=this.gl)||void 0===e||null===(e=e.canvas)||void 0===e?void 0:e.height;!Number.isFinite(n)||!Number.isFinite(i)||n<=0||i<=0||n===this._lastSyncedViewportCanvasWidth&&i===this._lastSyncedViewportCanvasHeight||(wf(n,i),this.gl.viewport(0,0,n,i),this._lastSyncedViewportCanvasWidth=n,this._lastSyncedViewportCanvasHeight=i)}isContextUnavailable(){return!!this.isDisposed||!(!this.isRecovering&&!this.isContextLost)||!(!this.gl||"function"!=typeof this.gl.isContextLost)&&this.gl.isContextLost()}queueNodeOptionUpdate(t,e){t&&e&&"object"==typeof e&&(this.pendingNodeOptionUpdates||(this.pendingNodeOptionUpdates=new Map),this.pendingNodeOptionUpdates.set(t,e))}applyPendingNodeOptionUpdates(t=!1){if(!this.pendingNodeOptionUpdates||!this.pendingNodeOptionUpdates.size)return;const e=Array.from(this.pendingNodeOptionUpdates.entries());this.pendingNodeOptionUpdates.clear(),e.forEach((([e,n])=>{try{if(t){const t=this.nodeStore.get(e);if(!t||"function"!=typeof t.updateOptions)return void this.queueNodeOptionUpdate(e,n);try{t.updateOptions(n)}catch(t){uv.error("Failed to apply pending node options",e,t),this.queueNodeOptionUpdate(e,n)}return}this.updateOptions(e,n)}catch(t){uv.error("Failed to apply pending node options",e,t)}}))}render(t={}){const{noRaf:e=!1}=t;if(this.isContextUnavailable())return;if(this.dirtyCanvasSize){let{width:t=this.gl.canvas.width,height:e=this.gl.canvas.height}=this.dirtyCanvasSize;wf(t,e),this.gl.canvas.width=t,this.gl.canvas.height=e,this.textureManager.refreshTextureObjects(),this.gl.viewport(0,0,t,e),this.dirtyCanvasSize=!1,this._lastSyncedViewportCanvasWidth=t,this._lastSyncedViewportCanvasHeight=e}this.syncViewportToCanvasBackingStoreIfChanged(),this.graphIOManager.setVideoSources(this.ioStore);let n={ioStore:this.ioStore,graphIOManager:this.graphIOManager};this.renderSelectedNode(n),this.config.onPreRenderToScreen&&this.config.onPreRenderToScreen(),this.renderToCanvas(n),this.config.onPostRenderToScreen&&this.config.onPostRenderToScreen(),this.graphIOManager.disposeAllStore(this.ioStore),n=null,!e&&!this.config.userWillCallRender&&(this.rafId=requestAnimationFrame(this.render))}renderSelectedNode(t){if(!this.selectedRenderNodeId)return;const e=this.nodeStore.get(this.selectedRenderNodeId);e&&"function"==typeof e.render?e.render(t):(uv.warn("Missing selected render node",this.selectedRenderNodeId),this.selectedRenderNodeId=null)}renderToCanvas(t){const e=this.nodeStore.get(dv);e&&"function"==typeof e.render?e.render(t):uv.warn("Missing render-to-canvas node")}updateOptions(t,e){if(uv.debug("[updateOptions]",t,e),this.isContextUnavailable())return void this.queueNodeOptionUpdate(t,e);const n=this.nodeStore.get(t);if(n&&"function"==typeof n.updateOptions)try{n.updateOptions(e)}catch(n){uv.error("Failed to update node options",t,n),this.queueNodeOptionUpdate(t,e)}else this.queueNodeOptionUpdate(t,e)}addSourceListeners(){var t;"function"==typeof(null===(t=this.source)||void 0===t?void 0:t.on)&&this.source.on("forcerender",this.onForceRender)}removeSourceListeners(){var t;"function"==typeof(null===(t=this.source)||void 0===t?void 0:t.off)&&this.source.off("forcerender",this.onForceRender)}addCanvasListeners(){var t;(null==this||null===(t=this.gl)||void 0===t?void 0:t.canvas)&&(this.config.noWebGLContextLostRecovery||this.gl.canvas.addEventListener("webglcontextlost",this.onWebGLContextLost))}removeCanvasListeners(){var t;(null==this||null===(t=this.gl)||void 0===t?void 0:t.canvas)&&this.gl.canvas.removeEventListener("webglcontextlost",this.onWebGLContextLost)}getNodesOptions(){const t=this.getNodes();let e={};return Object.keys(t).filter((t=>"__default"!==t)).forEach((n=>{e[n]=t[n].options})),e}getDocumentVisibilityPromise(){return new Promise((t=>{"visible"===document.visibilityState&&t();const e=()=>{"visible"===document.visibilityState&&(document.removeEventListener("visibilitychange",e),t())};document.addEventListener("visibilitychange",e)}))}onForceRender(){uv.info("[onForceRender]"),this.render({noRaf:!0})}async onWebGLContextLost(t){if(t&&"function"==typeof t.preventDefault&&t.preventDefault(),this.isDisposed||this.isRecovering)return;this.isContextLost=!0,this.isRecovering=!0;const e=this.getNodesOptions(),n=this.addClientNodeInvocations,i=this.selectedRenderNodeId;cancelAnimationFrame(this.rafId),uv.warn("WebGL context lost - attempting to recover");const r=async()=>{if(this.isDisposed)this.isRecovering=!1;else try{var t;if(await this.getDocumentVisibilityPromise(),this.isDisposed)return void(this.isRecovering=!1);if(this.gl&&"function"==typeof this.gl.isContextLost&&this.gl.isContextLost())return void setTimeout(r,200);this.dispose(!1),this.doInit(this.glSource,this.config),this.textureManager&&"function"==typeof this.textureManager.refreshActiveTextures&&this.textureManager.refreshActiveTextures(),n&&n.length&&n.forEach((t=>{uv.debug("Re-adding client nodes",t),this.addClientNodes(t,!0)})),Object.entries(e).forEach((([t,e])=>{uv.debug("Re-applying node options",t,e);const n=this.nodeStore.get(t);n&&"function"==typeof n.updateOptions&&n.updateOptions(e)})),i&&(this.selectedRenderNodeId=i),this.applyPendingNodeOptionUpdates(!0);const o="function"==typeof(null===(t=this.source)||void 0===t?void 0:t.recover);o&&(uv.debug("Recovering glSource (i.e. seeking/resetting player)"),await this.source.recover()),this.isContextLost=!1,this.isRecovering=!1,o&&this.render()}catch(t){uv.error("Failed to recover WebGL context, retrying",t),setTimeout(r,200)}};await r()}dispose(t=!0){if(this.selectedRenderNode=null,t&&(this.isDisposed=!0,this.isRecovering=!1,this.isContextLost=!1),this.source&&(this.removeSourceListeners(),"function"==typeof this.source.dispose&&this.source.dispose()),this.gl){this.removeCanvasListeners();const e=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS);for(let t=0;t<e;++t)this.gl.activeTexture(this.gl.TEXTURE0+t),this.gl.bindTexture(this.gl.TEXTURE_2D,null),this.gl.bindTexture(this.gl.TEXTURE_CUBE_MAP,null);if(this.gl.bindBuffer(this.gl.ARRAY_BUFFER,null),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,null),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null),this.gl.bindTexture(this.gl.TEXTURE_2D,null),this.gl.bindRenderbuffer(this.gl.RENDERBUFFER,null),t)try{this.gl.getExtension("WEBGL_lose_context").loseContext()}catch(t){console.error(t)}}this.selectedRenderNodeId=null,t&&delete this.addClientNodeInvocations}}class mv{constructor(t={}){this.options=t}get type(){return"stage"}getSignature(){return this.type}build({inputs:t=[]}={}){return{graph:[],outputs:t,signature:this.getSignature()}}}function vv(t={}){const e={source:{center:{x:.5,y:.5},width:1,height:1},target:{center:{x:.5,y:.5},width:1,height:1},fitType:"fill",cornerRadius:0,edgeSoftness:0},n={...e.source,...t.source||{}},i={...e.target,...t.target||{}};return{...e,...t,source:n,target:i}}class gv extends mv{get type(){return"retarget"}getSignature(){var t;const e=Array.isArray(null===(t=this.options)||void 0===t?void 0:t.frames)?this.options.frames:[];return`${this.type}:${e.length}`}build({inputs:t=[],stageIndex:e=0}={}){var n;const i=Array.isArray(null===(n=this.options)||void 0===n?void 0:n.frames)?this.options.frames:[];if(!i.length)return{graph:[],outputs:t,signature:this.getSignature()};const r=[],o=[];for(let n=0;n<t.length;n+=1){const s=t[n],a=i[n];if(!a){o.push(s);continue}const l=`retarget-${e}-${n}`;r.push({id:l,type:"crop",inputs:[s],outputs:[l],options:vv(a)}),o.push(l)}return{graph:r,outputs:o,signature:this.getSignature()}}}class yv{#M=new Map;constructor(){this.register("retarget",gv)}register(t,e){t&&"function"==typeof e&&this.#M.set(t,e)}create(t={}){const e="string"==typeof(null==t?void 0:t.type)?t.type:null;if(!e)return null;const n=this.#M.get(e);return n?new n((null==t?void 0:t.options)||{}):null}}class bv{constructor(t={}){this.params=t}static get panAndScanTarget(){return"pre"}static buildDefaultLayoutGraph(t=[]){const e=t[0]||"__SRC_TEXTURE:0";return{type:"default",signature:`default:${t.length}`,isDynamic:!1,graph:[{type:"opacity",inputs:[e],options:{power:1}}]}}static prepareRenderFrames({frames:t}={}){return Array.isArray(t)?t:[]}static getRenderTiming({timing:t}={}){return t&&"object"==typeof t?t:{}}static resetRenderState(t){}render(t){}}class kv extends bv{#A=null;#N=null;static get type(){return"default"}static get aliases(){return["DefaultRenderNode","default"]}static get requiresFrameCadence(){return!1}static buildLayoutGraph({inputs:t=[]}={}){return super.buildDefaultLayoutGraph(t)}static prepareRenderFrames({frames:t}={}){const e=Array.isArray(t)?t:[];if(e.length<=1)return e;const n=e[e.length-1];return n?[n]:e}render(t){var e;const n=(null==t||null===(e=t.visualFramesAvailable)||void 0===e?void 0:e.frames)||[];if(!n.length)return;const i=null==t?void 0:t.shaderGraph,r=null==t?void 0:t.shaderGraphNodeIds;if(!i||"function"!=typeof i.updateOptions||"function"!=typeof i.selectNode)return;const o=null==r?void 0:r.default;if(o)try{const t=n.map(((t,e)=>t?`__SRC_TEXTURE:${e}`:null)).filter(Boolean),e=kv.buildLayoutGraph({inputs:t}),r=e.signature;this.#A!==r&&(i.updateOptions(o,{graph:e.graph}),this.#A=r),this.#N!==o&&(i.selectNode(o),this.#N=o),i.render({noRaf:!0})}catch(t){}}}function xv(t){const e=Number(t);return Number.isFinite(e)?e<=0?0:e>=1?1:e:0}class wv extends bv{#A=null;#N=null;#F=null;static get type(){return"cross-fade"}static get aliases(){return["CrossFadeRenderNode","cross-fade","crossfade"]}static get requiresFrameCadence(){return!0}static get panAndScanTarget(){return"pre"}static buildLayoutGraph({inputs:t=[],normalizedTime:e}={}){if(t.length<2)return super.buildDefaultLayoutGraph(t);const n=xv(e),i=[{type:"opacity",inputs:[t[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",t[0]],options:{}}];return{type:wv.type,signature:`${wv.type}:${t.length}`,isDynamic:!0,graph:i}}static prepareRenderFrames({frames:t,timelineTime:e,active:n}={}){let i=(Array.isArray(t)?t:[]).slice(0,2);if(i.length<2)return i;const r=Number.isFinite(null==n?void 0:n.duration)&&n.duration>0?n.duration:void 0,o=Number.isFinite(null==n?void 0:n.offset)?n.offset:void 0;if(!Number.isFinite(e)||!Number.isFinite(r)||!Number.isFinite(o))return i;const s=xv((e-o)/r);return s<=0?[i[0]]:s>=1?[i[1]]:i}render(t){var e;const n=(null==t||null===(e=t.visualFramesAvailable)||void 0===e?void 0:e.frames)||[];if(!n.length)return;const i=null==t?void 0:t.shaderGraph,r=null==t?void 0:t.shaderGraphNodeIds;if(!i||"function"!=typeof i.updateOptions||"function"!=typeof i.selectNode)return;if(n.length<2){const t=null==r?void 0:r.default;if(!t)return;try{const e="default";if(this.#A!==e){const n=wv.buildLayoutGraph({inputs:["__SRC_TEXTURE:0"]});i.updateOptions(t,{graph:n.graph}),this.#A=e}this.#N!==t&&(i.selectNode(t),this.#N=t),i.render({noRaf:!0})}catch(t){}return}const o=null==r?void 0:r.crossFade;if(o)try{const e=["__SRC_TEXTURE:0","__SRC_TEXTURE:1"],n=wv.buildLayoutGraph({inputs:e,normalizedTime:null==t?void 0:t.renderNodeNormalizedTime}),r=n.signature,s=Number(null==t?void 0:t.renderNodeNormalizedTime),a=Number.isFinite(s)?s:0;this.#A===r&&this.#F===a||(i.updateOptions(o,{graph:n.graph}),this.#A=r,this.#F=a),this.#N!==o&&(i.selectNode(o),this.#N=o),i.render({noRaf:!0})}catch(t){}}}function _v(t,e,n={}){if("number"==typeof(null==t?void 0:t.nodeDurationOverride)&&Number.isFinite(t.nodeDurationOverride))return t.nodeDurationOverride;const i="function"==typeof(null==n?void 0:n.getNode)?n.getNode:e&&"function"==typeof e.get?t=>e.get(t):null;if(!i)return;const r=i(null==t?void 0:t.nodeId);if(!r)return;const o=r.duration;if("number"!=typeof o||Number.isNaN(o)||!Number.isFinite(o))return;const s="string"!=typeof r.state||"ready"===r.state;if(!0!==(null==n?void 0:n.allowUnready)&&!s)return;if(!(!0!==(null==n?void 0:n.allowUnready)||s||o>0))return;let a=0;"number"==typeof t.nodeOffsetOverride&&Number.isFinite(t.nodeOffsetOverride)&&(a=t.nodeOffsetOverride);const l=o-a;return l>0?l:0}function Iv(t){return!(!t||!0===t.offsetPending)&&Number.isFinite(t.offset)}function Tv(t){return Iv(t)?t.offset:void 0}function Ev(t,e,n,i={}){if(!t)return!1;const r=Tv(t);if(!Number.isFinite(r))return!1;const o=_v(t,n,i);return Number.isFinite(o)?e>=r&&e<r+o:e>=r}function Sv(t=[]){if(!Array.isArray(t))return t;const e=[],n=[];return t.forEach((t=>{Iv(t)?e.push(t):n.push(t)})),e.sort(((t,e)=>t.offset-e.offset)),t.splice(0,t.length,...e,...n),t}function Mv(t=[],e={}){if(!Array.isArray(t)||!t.length)return{updated:!1,resolvedPlacements:[]};const n="function"==typeof e.getPlacementDuration?e.getPlacementDuration:()=>{},i="function"==typeof e.snapPlacementOffset?e.snapPlacementOffset:t=>t,r="function"==typeof e.onResolvedPlacement?e.onResolvedPlacement:null,o=new Map,s=[];if(t.forEach((t=>{null!=t&&t.placementId&&o.set(t.placementId,t),!0===(null==t?void 0:t.offsetPending)&&s.push(t)})),!s.length)return{updated:!1,resolvedPlacements:[]};let a=!1;const l=[];let c=s,u=!0;for(;c.length&&u;){u=!1;const t=[];for(let e=0;e<c.length;e+=1){const s=c[e],d=null==s?void 0:s.offsetAnchorPlacementId;if(!d){t.push(s);continue}const h=o.get(d);if(!h||!0===h.offsetPending){t.push(s);continue}const f=Tv(h);if(!Number.isFinite(f)){t.push(s);continue}let p;if("start"===s.offsetAnchorEdge)p=i(f,s);else{const e=n(h);if(!(e>0)){t.push(s);continue}const r=f+e-(Number.isFinite(s.offsetEndSeconds)?s.offsetEndSeconds:0);if(!Number.isFinite(r)){t.push(s);continue}const o=i(r,s);p=!0===s.offsetAnchorIsReference?Math.max(o,r):o}Number.isFinite(p)?(s.offset=p,s.offsetPending=!1,s.offsetAnchorPlacementId=void 0,s.offsetAnchorEdge=void 0,s.offsetAnchorIsReference=void 0,r&&r(s,h,p),l.push(s),a=!0,u=!0):t.push(s)}c=t}return a&&!1!==e.sortPlacements&&Sv(t),{updated:a,resolvedPlacements:l}}function Av(t){const e=Number(t);return Number.isFinite(e)?e:0}function Nv(t,e={}){const n=function(t){const e=Number(t);return Number.isFinite(e)&&e<0?Math.abs(e):0}(t),i=Number.isFinite(null==e?void 0:e.offsetEndSeconds)?e.offsetEndSeconds:n;var r;return{wantsEndOffset:"end"===(r=t)||null==r||n>0||!0===(null==e?void 0:e.offsetPending),endOffsetSeconds:i,endOffsetFromAtSeconds:n}}function Fv(t){if("string"!=typeof t)return null;const e=t.trim();if(!e||"end"===e)return null;const n=Number(e);if(Number.isFinite(n))return null;const i=e.split("@"),r=i[0]?i[0].trim():"";if(!r)return null;if(1===i.length)return{placementId:r,anchor:"start"};if(2!==i.length)return null;const o=i[1]?i[1].trim().toLowerCase():"";return"start"!==o&&"end"!==o?null:{placementId:r,anchor:o}}function Cv(t=[],e,n,i){if(Array.isArray(t))for(let r=0;r<t.length;r+=1){const o=t[r],s="number"==typeof(null==o?void 0:o.offset)?o.offset:0;if(e<s+("number"==typeof(null==o?void 0:o.duration)&&Number.isFinite(o.duration)?o.duration:Number.POSITIVE_INFINITY)&&s<n)throw new Error(i)}}function Ov(t){const e=Number(t);return Number.isFinite(e)&&e>0?e:0}function Pv(t){return(null==t?void 0:t.id)||(null==t?void 0:t.nodeId)||null}function Rv(t,e){return Array.isArray(t)&&e?t.findIndex((t=>Pv(t)===e)):-1}function Dv(t,e,n){const i=function(t,e,n){if(!Array.isArray(e)||0===e.length)return null;const i=e.length;if(null==t||"next"===t){const t=Rv(e,n);return t>=0?(t+1)%i:0}if("prev"===t){const t=Rv(e,n);return t>=0?(t-1+i)%i:i-1}const r=Number(t);return Number.isInteger(r)&&r>=0&&r<i?r:null}(t,e,n);return Number.isInteger(i)?Pv(e[i]):null}function Bv(t,e,n,i){const r=function(t,e){if(!Array.isArray(t)||t.length<=1)return t||[];const n=function(t){const e=[],n=new Set;return Array.isArray(t)?(t.forEach((t=>{const i=null==t?void 0:t.placementId;i&&!n.has(i)&&(n.add(i),e.push(i))})),e):e}(e);if(!n.length)return t;const i=new Map;t.forEach((t=>{const e=null==t?void 0:t.placementId;e&&!i.has(e)&&i.set(e,t)}));const r=[],o=new Set;return n.forEach((t=>{const e=i.get(t);e&&!o.has(t)&&(o.add(t),r.push(e))})),t.forEach((t=>{const e=null==t?void 0:t.placementId;e&&!o.has(e)&&(o.add(e),r.push(t))})),r}(function(t,e){const n=function(t){const e=Number(null==t?void 0:t.offset),n=Number(null==t?void 0:t.duration),i=n===Number.POSITIVE_INFINITY,r=Number.isFinite(n)&&n>0||i;return Number.isFinite(e)&&r?{start:e,end:i?Number.POSITIVE_INFINITY:e+n}:null}(e);if(!n||!t||!Array.isArray(t.placements))return[];const i=function(t,e){const n=Number(null==t||null===(e=t.settings)||void 0===e?void 0:e.snapToFps);return!Number.isFinite(n)||n<=0?0:.5/n}(t),r=t.placements.filter((e=>{const r=function(t,e){const n=Tv(t);if(!Number.isFinite(n))return null;const i="function"==typeof(null==e?void 0:e.getPlacementDuration)?e.getPlacementDuration(t):void 0;return{start:n,end:Number.isFinite(i)&&i>=0?n+i:Number.POSITIVE_INFINITY}}(e,t);return!!r&&r.start<n.end&&r.end>n.start+i}));return r.sort(((t,e)=>Tv(t)-Tv(e))),r}(e,n),i),o=function(t,e){const n=[],i=new Set;return Array.isArray(t)?(t.forEach((t=>{const r=null==t?void 0:t.nodeId;if(!r||i.has(r))return;const o="function"==typeof(null==e?void 0:e.getNode)?e.getNode(r):null;if(o){const t="object"==typeof o&&null!==o?o.id||o.nodeId?o:{...o,id:r}:{id:r};n.push(t),i.add(r)}})),n):n}(r,e),s=function(t){const e=new Map;return t.forEach((t=>{const n=null==t?void 0:t.placementId,i=null==t?void 0:t.nodeId;n&&i&&(e.has(i)||e.set(i,[]),e.get(i).push(n))})),e}(r),a=Array.isArray(t.nodes)?t.nodes:[];return a.splice(0,a.length,...o),t.nodes=a,t.placements=r,t.nodePlacementMap=s,{nodes:a,placements:r,nodePlacementMap:s}}function Lv(t,e,n){if(!Array.isArray(t))return null;if(e){const n=t.find((t=>(null==t?void 0:t.placementId)===e));if(n)return n}return n&&t.find((t=>(null==t?void 0:t.nodeId)===n))||null}function zv(t,e){if(!e||!Array.isArray(t))return null;const n=t.find((t=>(null==t?void 0:t.placementId)===e));return(null==n?void 0:n.nodeId)||null}function Wv(t,e,n){if(!t||!e)return null;const i=e.get(t);if(!Array.isArray(i)||!i.length)return null;for(let e=0;e<i.length;e+=1){const r=i[e];if(Lv(n,r,t))return r}return null}function jv(t){t.initialized=!1,t.activeRenderPlacementId=null,t.nodes=[],t.placements=[],t.nodePlacementMap=null,t.selectedPlacementId=null,t.previousPlacementId=null,t.pendingSwitch=null,t.switchStartTime=null,t.switchDuration=0,t.switchNormalizedTime=void 0,t.switchTo=null,t.countOfConcurrentChannels=null}class $v extends bv{static get type(){return"switching"}static get aliases(){return["SwitchingRenderNode","switching","switch"]}static get requiresFrameCadence(){return!0}static get panAndScanTarget(){return"pre"}static buildLayoutGraph({inputs:t=[],normalizedTime:e}={}){if(t.length<2)return super.buildDefaultLayoutGraph(t);const n=xv(e),i=[{type:"opacity",inputs:[t[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",t[0]],options:{}}];return{type:$v.type,signature:`${$v.type}:${t.length}`,isDynamic:!0,graph:i}}static getRenderTiming({timing:t,state:e}={}){const n=t&&"object"==typeof t?t:{},i=Number(null==e?void 0:e.switchNormalizedTime);return Number.isFinite(i)?{...n,normalizedTime:xv(i)}:n}static prepareRenderFrames({frames:t,timelineTime:e,timeline:n,active:i,renderNodeParams:r,state:o}={}){const s=Array.isArray(t)?t:[],a=o&&"object"==typeof o?o:{},l=null==i?void 0:i.renderPlacementId;l&&a.activeRenderPlacementId!==l&&(jv(a),a.activeRenderPlacementId=l);const c=null==r?void 0:r.initSwitching,u=Bv(a,n,i,s),d=(f=s,Array.isArray(f)?f.length:0),h=a.countOfConcurrentChannels;var f;if(a.countOfConcurrentChannels=d,"function"==typeof c&&(a.switchTo||(a.switchTo=(t,e)=>{const n=zv(a.placements,a.selectedPlacementId),i=Dv(t,a.nodes,n);if(!i)return;const r={nodeId:i};e&&Object.prototype.hasOwnProperty.call(e,"crossfadeSeconds")&&void 0!==e.crossfadeSeconds&&(r.crossfadeSeconds=e.crossfadeSeconds),a.pendingSwitch=r}),!a.initialized||h!==d)){a.initialized=!0,a.countOfConcurrentChannels=d;try{c({nodes:u.nodes,countOfConcurrentChannels:d,switchTo:a.switchTo})}catch(f){}}if(!a.selectedPlacementId){const t=Number(null==r?void 0:r.initialChannelIndex),e=Dv(Number.isInteger(t)&&t>=0?t:0,a.nodes,null);let n=null;if(e&&(n=Wv(e,a.nodePlacementMap,s),!n&&a.nodePlacementMap)){const t=a.nodePlacementMap.get(e);Array.isArray(t)&&t.length&&(n=t[0])}a.selectedPlacementId=n||function(t,e){if(Array.isArray(e))for(let i=0;i<e.length;i+=1){var n;const r=null===(n=e[i])||void 0===n?void 0:n.placementId;if(r&&Lv(t,r))return r}const i=Array.isArray(t)?t.find((t=>null==t?void 0:t.placementId)):null;return i?i.placementId:null}(s,a.placements)}if(a.pendingSwitch&&Number.isFinite(e)){const t=Wv(a.pendingSwitch.nodeId,a.nodePlacementMap,s);if(t){const n=a.selectedPlacementId;a.previousPlacementId=n&&n!==t?n:null,a.selectedPlacementId=t;const i=Object.prototype.hasOwnProperty.call(a.pendingSwitch,"crossfadeSeconds"),o=Ov(a.pendingSwitch.crossfadeSeconds),s=Ov(null==r?void 0:r.switchCrossfadeSeconds),l=i?o:s;a.switchDuration=l,l>0?a.switchStartTime=e:(a.switchStartTime=null,a.previousPlacementId=null)}a.pendingSwitch=null}let p;if(Number.isFinite(a.switchStartTime)&&a.switchDuration>0&&Number.isFinite(e)){const t=e-a.switchStartTime;t>=a.switchDuration?(a.switchStartTime=null,a.switchDuration=0,a.previousPlacementId=null):t>=0&&(p=xv(t/a.switchDuration))}a.switchNormalizedTime=Number.isFinite(p)?p:void 0;const m=zv(a.placements,a.selectedPlacementId),v=Lv(s,a.selectedPlacementId,m)||s[0];let g=null;if(Number.isFinite(a.switchNormalizedTime)&&a.previousPlacementId){const t=zv(a.placements,a.previousPlacementId),e=zv(a.placements,a.selectedPlacementId),n=Lv(s,a.previousPlacementId,t),i=Lv(s,a.selectedPlacementId,e);n&&i&&(g=[n,i])}return g||(g=v?[v]:s),g}static resetRenderState(t){t&&"object"==typeof t&&jv(t)}}const Uv=.5,qv="auto";function Vv(t){return"vertical"===t?"vertical":"horizontal"}function Gv(t){return void 0===t||t===qv?qv:"manual"}function Hv(t){const e=Number(t);return Number.isFinite(e)&&e>=0?e:.004}function Kv(t,e){const n=Number(null==t?void 0:t.width),i=Number(null==t?void 0:t.height);return Number.isFinite(n)&&Number.isFinite(i)&&n>0&&i>0?i>n?"vertical":"horizontal":Vv(e)}function Xv(t,e){const n=e&&"object"==typeof e&&e.runtimeParams&&"object"==typeof e.runtimeParams?e.runtimeParams:{},i=Object.prototype.hasOwnProperty.call(n,"orientationMode")?n.orientationMode:null==t?void 0:t.orientationMode,r=Object.prototype.hasOwnProperty.call(n,"orientation")?n.orientation:null==t?void 0:t.orientation,o=Object.prototype.hasOwnProperty.call(n,"gap")?n.gap:null==t?void 0:t.gap,s=Gv(i);return{orientationMode:s,orientation:s===qv?Kv(null==e?void 0:e.viewportSize,r):Vv(r),gap:Hv(o)}}function Yv(t){t&&"object"==typeof t&&(t.activeRenderPlacementId=null,t.frames=null,t.gridInitialized=!1,t.runtimeParams=null,t.setGridParams=null)}class Qv extends bv{static get type(){return"grid"}static get aliases(){return["GridRenderNode","grid","SideBySideRenderNode","side-by-side","sidebyside"]}static get requiresFrameCadence(){return!1}static get panAndScanTarget(){return"skip"}static resolvePanAndScanTarget({frameCount:t}={}){return t<2?"pre":Qv.panAndScanTarget}static buildLayoutGraph({inputs:t=[],renderNodeParams:e,state:n}={}){const i=Array.isArray(t)?t.slice(0,12):[],r=i.length;if(r<2)return super.buildDefaultLayoutGraph(i);const{orientation:o,gap:s}=Xv(e,n),{rows:a,cols:l}=(p=o,(f=r)<=3?"vertical"===p?{rows:f,cols:1}:{rows:1,cols:f}:4===f?{rows:2,cols:2}:f<=6?"vertical"===p?{rows:3,cols:2}:{rows:2,cols:3}:f<=8?"vertical"===p?{rows:4,cols:2}:{rows:2,cols:4}:9===f?{rows:3,cols:3}:"vertical"===p?{rows:4,cols:3}:{rows:3,cols:4}),c=1/a,u=Math.max(0,c-s),d=[],h="grid-slice";var f,p;function m(t){const e=Math.floor(t/l),n=function(t,e,n,i){const r=(e-1)*n;return t===e-1&&i>r?i-r:n}(e,a,l,r),i=n<l?t-e*l:t%l,o=1/n;return{row:e,cellWidth:o,cropWidth:Math.max(0,o-s),targetCenterX:(i+Uv)*o,targetCenterY:(e+Uv)*c}}function v(t,e,n){const i=m(t);return{id:`grid-crop-${t}`,type:"crop",inputs:[e],outputs:[n],options:{source:{center:{x:Uv,y:Uv},width:1,height:1},target:{center:{x:i.targetCenterX,y:i.targetCenterY},width:i.cropWidth,height:u},fitType:"fill",cornerRadius:0,edgeSoftness:0}}}function g(t){const e=m(t);return{id:`grid-mask-${t}`,type:"shapeCompositeMask",inputs:[h,"accum"],outputs:["accum"],options:{type:"box",center:{x:2*e.targetCenterX-1,y:1-2*e.targetCenterY},area:{width:e.cellWidth,height:c},radius:0,edgeSoftness:0}}}d.push(v(0,i[0],"accum"));for(let t=1;t<r;t+=1)d.push(v(t,i[t],h)),d.push(g(t));return{type:Qv.type,signature:`${Qv.type}:${r}:${a}x${l}:${o}:${s}`,isDynamic:!1,graph:d}}static prepareRenderFrames({frames:t,renderNodeParams:e,active:n,state:i}={}){const r=Array.isArray(t)?t.slice(0,12):[],o=i&&"object"==typeof i?i:{},s=null==n?void 0:n.renderPlacementId;s&&o.activeRenderPlacementId!==s&&(Yv(o),o.activeRenderPlacementId=s);const a=Array.isArray(o.frames)?o.frames:[],l=null==e?void 0:e.initGrid;if("function"==typeof l&&(o.setGridParams||(o.setGridParams=t=>{!function(t,e){if(!t||"object"!=typeof t||!e||"object"!=typeof e)return;const n=t.runtimeParams&&"object"==typeof t.runtimeParams?{...t.runtimeParams}:{};Object.prototype.hasOwnProperty.call(e,"orientationMode")&&(n.orientationMode=Gv(e.orientationMode)),Object.prototype.hasOwnProperty.call(e,"orientation")&&(n.orientation=Vv(e.orientation)),Object.prototype.hasOwnProperty.call(e,"gap")&&(n.gap=Hv(e.gap)),t.runtimeParams=n}(o,t),"function"==typeof o.requestRender&&o.requestRender()}),!o.gridInitialized)){o.gridInitialized=!0;const t=Xv(e,o);try{l({orientationMode:t.orientationMode,orientation:t.orientation,gap:t.gap,setGridParams:o.setGridParams})}catch(t){}}if(r.length<2){const t=function(t,e){if(!Array.isArray(e)||e.length<2)return t.length?[t[t.length-1]]:[];const n=Math.min(12,Math.max(t.length,e.length,2)),i=t[0]||e[0];return Array.from({length:n},((n,r)=>t[r]||e[r]||i))}(r,a);return o.frames=t,t}return o.frames=r,r}static resetRenderState(t){Yv(t)}}const Jv=[kv,wv,$v,Qv],Zv=new Map;function tg(t){if("string"!=typeof t)return null;const e=t.trim();return e?e.toLowerCase():null}function eg(t){const e=tg(t);return e&&Zv.get(e)||null}function ng(t){return eg(t)||kv}Jv.forEach((t=>function(t){(function(t){const e=Array.isArray(t.aliases)?t.aliases:[],n=t.type;return(n?[n,...e]:e.slice()).filter((t=>"string"==typeof t&&t.trim().length))})(t).forEach((e=>{const n=tg(e);n&&Zv.set(n,t)}))}(t)));class ig{static get defaultType(){return kv.type||"default"}static getRenderNodeClass(t){return eg(t)}static normalizeType(t){const e=eg(t);return e?e.type:null}static doesRenderNodeTypeRequireFrameCadence(t){const e=eg(t);return!!e&&!0===e.requiresFrameCadence}static buildLayoutGraph({type:t,inputs:e=[],normalizedTime:n,renderNodeParams:i,state:r}={}){const o=ng(t);return o&&"function"==typeof o.buildLayoutGraph?o.buildLayoutGraph({inputs:e,normalizedTime:n,renderNodeParams:i,state:r}):kv.buildLayoutGraph({inputs:e,normalizedTime:n,renderNodeParams:i,state:r})}static getPanAndScanTarget(t,e={}){const n=ng(t);return"post"===(i=n&&"function"==typeof n.resolvePanAndScanTarget?n.resolvePanAndScanTarget(e):null==n?void 0:n.panAndScanTarget)||"skip"===i?i:"pre";var i}static prepareRenderFrames({type:t,frames:e,timelineTime:n,timeline:i,active:r,renderNodeParams:o,state:s}={}){const a=ng(t);if(a&&"function"==typeof a.prepareRenderFrames){const t=a.prepareRenderFrames({frames:e,timelineTime:n,timeline:i,active:r,renderNodeParams:o,state:s});if(Array.isArray(t))return t}return Array.isArray(e)?e:[]}static getRenderTiming({type:t,timing:e,timelineTime:n,active:i,renderNodeParams:r,state:o}={}){const s=ng(t),a=e&&"object"==typeof e?e:{};if(s&&"function"==typeof s.getRenderTiming){const t=s.getRenderTiming({timing:a,timelineTime:n,active:i,renderNodeParams:r,state:o});if(t&&"object"==typeof t)return{...a,...t}}return a}static resetRenderState(t,e){const n=ng(t);n&&"function"==typeof n.resetRenderState&&n.resetRenderState(e)}static resetAllRenderStates(t){t&&"function"==typeof t.forEach&&t.forEach(((t,e)=>{ig.resetRenderState(e,t)}))}create(t,e){return t&&"function"==typeof t.render?t:new(ng(t))(e)}}function rg(t){return Array.isArray(t)?t.filter((t=>t&&"string"==typeof t.type)):[]}function og(t,e){return t&&"function"==typeof t.getSignature?t.getSignature():(null==e?void 0:e.type)||"stage"}class sg{#C;constructor(t){this.#C=t||new yv}build(t={}){const e=(Array.isArray(null==t?void 0:t.frames)?t.frames:[]).length,n=Array.from({length:e},((t,e)=>`__SRC_TEXTURE:${e}`)),i=ig.normalizeType(null==t?void 0:t.layoutType)||ig.defaultType,r=null==t?void 0:t.normalizedTime,o=rg(null==t?void 0:t.preStages),s=rg(null==t?void 0:t.postStages),a=[],l=[`layout:${i}`,`inputs:${e}`];let c=n;o.forEach(((e,n)=>{const i=this.#C.create(e);if(!i)return;const r=i.build({inputs:c,stageIndex:n,context:t});Array.isArray(null==r?void 0:r.graph)&&r.graph.length&&a.push(...r.graph),Array.isArray(null==r?void 0:r.outputs)&&r.outputs.length&&(c=r.outputs),l.push(og(i,e))}));const u=ig.buildLayoutGraph({type:i,inputs:c,normalizedTime:r,renderNodeParams:null==t?void 0:t.renderNodeParams,state:null==t?void 0:t.renderNodeState}),d=!(null==u||!u.isDynamic);Array.isArray(null==u?void 0:u.graph)&&u.graph.length&&a.push(...u.graph),l.push((null==u?void 0:u.signature)||`${i}:${c.length}`);let h="__PREVIOUS:0";return s.forEach(((e,n)=>{const i=this.#C.create(e);if(!i)return;const r=i.build({inputs:[h],stageIndex:n,context:t});Array.isArray(null==r?void 0:r.graph)&&r.graph.length&&a.push(...r.graph),h=Array.isArray(null==r?void 0:r.outputs)&&r.outputs.length?r.outputs[0]:"__PREVIOUS:0",l.push(og(i,e))})),{graph:a,signature:l.join("|"),isDynamic:d}}}const ag=[0,0,1,1],lg="zoomInExposure",cg=["transform","exposure","fadeToColor","dipToBlack"],ug={zoomInExposure:{filters:{fadeToColor:{duration:150,ease:[1,0,1,0],power:{from:0,to:1},color:"#ffffff"},exposure:!1,transform:{duration:150,ease:[0,.5,.5,1],scale:{from:{x:1,y:1},to:{x:1.1,y:1.1}},translate:{from:{x:0,y:0},to:{x:0,y:0}}}},reverseFilters:{fadeToColor:{duration:700,ease:[0,1,0,1]},exposure:!1,transform:{duration:700,ease:[0,1,0,1]}}},dipToBlack:{filters:{transform:{duration:250,ease:[0,.5,.5,1],scale:{from:{x:1,y:1},to:{x:1.05,y:1.05}},translate:{from:{x:0,y:0},to:{x:0,y:0}}},dipToBlack:{duration:250,ease:[0,.5,.5,1],power:{from:0,to:1}}},reverseFilters:{dipToBlack:{duration:800,ease:[0,1,0,1]}}}};function dg(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}function hg(t,e=ag){return Array.isArray(t)&&t.length>=4?t:e}function fg(t){return"string"==typeof t&&t.trim()?t.trim():"#ffffff"}function pg(t,e){const n=null==t?void 0:t[e];return!1===n||null==n?null:lh(n)?n:{}}function mg(t={}){let e=0;return cg.forEach((n=>{const i=pg(t,n);if(!i)return;const r=dg(null==i?void 0:i.duration);r>e&&(e=r)})),e}function vg(t,e,n,i,r){const o=[];return cg.forEach((s=>{const a=pg(t,s);if(!a)return;const l=function(t,e,n){const i=dg(null==t?void 0:t.duration);return Number.isFinite(n)&&n>0?i>0&&e>0?i*e:n:i}(a,n,i),c=function(t,e,n,i,r){const o={type:"transition",inputs:["__PREVIOUS:0"],options:{filter:t,startTime:n,duration:i,properties:{}}};if("transform"===t){var s,a,l,c;const t=hg(null==e?void 0:e.ease),n=(null==e||null===(s=e.scale)||void 0===s?void 0:s.from)||{x:1,y:1},i=(null==e||null===(a=e.scale)||void 0===a?void 0:a.to)||{x:1,y:1},r=(null==e||null===(l=e.translate)||void 0===l?void 0:l.from)||{x:0,y:0},u=(null==e||null===(c=e.translate)||void 0===c?void 0:c.to)||{x:0,y:0};return o.options.properties.scale={from:n,to:i,ease:t},o.options.properties.translate={from:r,to:u,ease:t},o}if("fadeToColor"===t){const t=hg(null==e?void 0:e.ease),n=(null==e?void 0:e.power)||{from:0,to:1};return o.options.properties.power={from:dg(null==n?void 0:n.from,0),to:dg(null==n?void 0:n.to,1),ease:t},o.options.properties.color=fg((null==e?void 0:e.color)||r),o}if("exposure"===t||"dipToBlack"===t){const t=hg(null==e?void 0:e.ease),n=(null==e?void 0:e.power)||{from:0,to:1};return o.options.properties.power={from:dg(null==n?void 0:n.from,0),to:dg(null==n?void 0:n.to,1),ease:t},o}return null}(s,a,e,l,r);c&&o.push(c)})),o}function gg(t=[]){const e=t.map((t=>{const e=JSON.parse(JSON.stringify(t));return null!=e&&e.options&&(e.options.startTime=0),e}));return JSON.stringify(e)}class yg{#O=null;start(t={}){const e=null==t?void 0:t.shaderGraph;if(!e||"function"!=typeof e.captureTexture)return null;const{baseFilters:n,reverseFilters:i}=function(t={}){const e=function(t={}){if(lh(null==t?void 0:t.transition))return t.transition;if("string"==typeof(null==t?void 0:t.transition))return ug[t.transition]||ug[lg];if(lh(null==t?void 0:t.filters)||lh(null==t?void 0:t.reverseFilters))return{filters:t.filters||{},reverseFilters:t.reverseFilters||{}};if("string"==typeof(null==t?void 0:t.filter)){const e=dg(t.duration)>0?1e3*t.duration:500;return{filters:{[t.filter]:{duration:e,power:{from:0,to:1}}},reverseFilters:{}}}return ug[lg]}(t),n=ch({},(null==e?void 0:e.filters)||{},lh(null==t?void 0:t.filters)?t.filters:{}),i=function(t={}){const e={};return Object.keys(t).forEach((n=>{const i=t[n];if(!1===i)return void(e[n]=!1);const r=JSON.parse(JSON.stringify(lh(i)?i:{}));Object.values(r).forEach((t=>function(t){if(t&&"object"==typeof t&&"from"in t&&"to"in t){const e=t.from;t.from=t.to,t.to=e}}(t))),e[n]=r})),e}(n),r=ch({},(null==e?void 0:e.reverseFilters)||{},lh(null==t?void 0:t.reverseFilters)?t.reverseFilters:{});return{baseFilters:n,reverseFilters:ch({},i,r)}}(t),r=dg(null==t?void 0:t.duration),o=r>0?1e3*r:null,s=mg(n),a=mg(i),l=o&&s>0?o/s:1,c=o&&a>0?o/a:1,u=o||s||500,d=o||a||u,h=fg(null==t?void 0:t.color),f=e.captureTexture(),p=Date.now(),m=vg(n,p,l,o,h);return this.#O={phase:"out",startTime:p,outDurationMs:u,inDurationMs:d,color:h,captureId:f,baseFilters:n,reverseFilters:i,outScale:l,inScale:c,durationOverrideMs:o,outGraph:m,outSignature:gg(m),inGraph:null,inSignature:null},{captureId:f,outDurationMs:u,inDurationMs:d}}beginIncoming(){if(!this.#O)return;const t=Date.now(),e=vg(this.#O.reverseFilters,t,this.#O.inScale,this.#O.durationOverrideMs,this.#O.color);this.#O={...this.#O,phase:"in",startTime:t,inGraph:e,inSignature:gg(e)}}reset(t){var e;t&&"function"==typeof t.disposeTexture&&null!==(e=this.#O)&&void 0!==e&&e.captureId&&t.disposeTexture(this.#O.captureId),this.#O=null}getState(){return this.#O}buildOutgoingGraph(){const t=this.#O;return t&&"out"===t.phase&&Array.isArray(t.outGraph)&&t.outGraph.length?{signature:`transition:out:${t.outSignature||""}`,forceUpdate:!1,graph:t.outGraph}:null}buildIncomingGraph(){const t=this.#O;return t&&"in"===t.phase&&Array.isArray(t.inGraph)&&t.inGraph.length?{signature:`transition:in:${t.inSignature||""}`,forceUpdate:!1,graph:t.inGraph}:null}}let bg;const kg=[/firefox\/(\d+)/,/edg\/(\d+)/,/opr\/(\d+)/,/chrome\/(\d+)/];function xg(){const t=vh&&vh.navigator&&(vh.navigator.userAgent||vh.navigator.platform||vh.navigator.vendor)||"";if(bg&&bg.ua===t)return bg;const e=t.toLowerCase(),n=e.includes("android"),i=e.includes("iphone")||e.includes("ipad")||e.includes("ipod")||e.includes("ios"),r=n||i||e.includes("mobile"),o=!!t&&!r,s=e.includes("firefox/"),a=function(t=""){for(let e=0;e<kg.length;e+=1){const n=kg[e],i=t.match(n);if(!i)continue;const r=Number(i[1]);return Number.isFinite(r)?r:null}if(t.includes("safari/")&&t.includes("version/")){const e=t.match(/version\/(\d+)/);if(!e)return null;const n=Number(e[1]);return Number.isFinite(n)?n:null}return null}(e);return bg={ua:t,lowerUA:e,isAndroid:n,isiOS:i,isMobile:r,isDesktop:o,isFirefox:s,browserMajorVersion:a},bg}function wg(){return xg().ua}function _g(){return xg().isAndroid}function Ig(){return xg().isiOS}function Tg(){return xg().isMobile}function Eg(){return xg().isDesktop}function Sg(){return xg().isFirefox}function Mg(){return xg().browserMajorVersion}var Ag={getUserAgent:wg,isAndroid:_g,isiOS:Ig,isMobile:Tg,isDesktop:Eg,isFirefox:Sg,getBrowserMajorVersion:Mg},Ng=Object.freeze({__proto__:null,default:Ag,getBrowserMajorVersion:Mg,getUserAgent:wg,isAndroid:_g,isDesktop:Eg,isFirefox:Sg,isMobile:Tg,isiOS:Ig});const Fg="Idle",Cg="Playing",Og="FirstFramePending",Pg="Waiting",Rg="Paused",Dg="Seeking",Bg="Resetting";function Lg(t){return Array.isArray(t)?t.filter((t=>t&&"string"==typeof t.type)):[]}function zg(t,e){return!!Array.isArray(t)&&t.some((t=>(null==t?void 0:t.type)===e))}function Wg(t){const e=Number(t);return!Number.isFinite(e)||e<=0?null:{type:"retarget",options:{frames:Array.from({length:e},(()=>({fitType:"fill"})))},meta:{source:"panAndScan"}}}function jg(t){return Array.isArray(t)?t.filter((t=>{return!("panAndScan"===(null==(e=t)||null===(n=e.meta)||void 0===n?void 0:n.source));var e,n})):[]}const $g=2073600;function Ug(t,e){const n=Number(t);return Number.isFinite(n)&&n>0?n:e}function qg(t,e){if(null==t)return e;const n=Number(t);return Number.isFinite(n)?n:e}var Vg=new WeakMap,Gg=new WeakMap,Hg=new WeakMap,Kg=new WeakMap,Xg=new WeakMap,Yg=new WeakMap,Qg=new WeakMap,Jg=new WeakMap,Zg=new WeakMap,ty=new WeakMap,ey=new WeakMap,ny=new WeakMap,iy=new WeakMap,ry=new WeakMap,oy=new WeakMap,sy=new WeakMap,ay=new WeakMap,ly=new WeakMap,cy=new WeakMap,uy=new WeakMap,dy=new WeakMap,hy=new WeakMap,fy=new WeakMap,py=new WeakMap,my=new WeakMap,vy=new WeakMap,gy=new WeakMap,yy=new WeakMap,by=new WeakMap,ky=new WeakMap,xy=new WeakMap,wy=new WeakMap,_y=new WeakMap,Iy=new WeakMap,Ty=new WeakSet;class Ey extends fh{static get pipelineNodeId(){return"ekoplayer-render-pipeline"}get defaults(){return{defaultRenderParams:void 0,resourceLimits:{enabled:!0,maxCanvasPixels:$g,maxDevicePixelRatio:0,renderScale:1,transitionMinFrameIntervalMs:33}}}constructor(...t){super(...t),$(this,Ty),W(this,Vg,void 0),W(this,Gg,void 0),W(this,Hg,void 0),W(this,Kg,void 0),W(this,Xg,void 0),W(this,Yg,void 0),W(this,Qg,void 0),W(this,Jg,void 0),W(this,Zg,void 0),W(this,ty,void 0),W(this,ey,void 0),W(this,ny,void 0),W(this,iy,null),W(this,ry,null),W(this,oy,void 0),W(this,sy,void 0),W(this,ay,void 0),W(this,ly,[]),W(this,cy,[]),W(this,uy,null),W(this,dy,null),W(this,hy,null),W(this,fy,null),W(this,py,null),W(this,my,null),W(this,vy,new Map),W(this,gy,null),W(this,yy,null),W(this,by,!1),W(this,ky,!1),W(this,xy,!1),W(this,wy,!1),W(this,_y,[]),W(this,Iy,null);const[e,n,i]=t;j(Vg,this,e),j(Gg,this,n),j(Hg,this,i),z(Vg,this)&&"function"==typeof z(Vg,this).enableFirstFrameRenderedGate&&z(Vg,this).enableFirstFrameRenderedGate(),j(ny,this,new sg),j(oy,this,new yg),j(sy,this,null),j(ay,this,null),j(hy,this,null),j(Kg,this,(t=>B(Ty,this,db).call(this,t))),z(Vg,this)&&"function"==typeof z(Vg,this).on&&(z(Vg,this).on(yh.VISUAL_FRAMES_AVAILABLE,z(Kg,this)),j(Xg,this,(()=>{var t,e,n,i;B(Ty,this,Fy).call(this),B(Ty,this,sb).call(this,0),j(cy,this,[]),j(uy,this,null),j(iy,this,null),j(ry,this,null),B(Ty,this,Yy).call(this),j(gy,this,null);(null===(t=z(oy,this))||void 0===t||null===(e=t.getState)||void 0===e?void 0:e.call(t))||null===(n=z(oy,this))||void 0===n||null===(i=n.reset)||void 0===i||i.call(n,z(sy,this))})),z(Vg,this).on(yh.TIMELINE_SEEKING,z(Xg,this)),j(Yg,this,((t={})=>{"switch"===(null==t?void 0:t.reason)||"reset"===(null==t?void 0:t.reason)?B(Ty,this,My).call(this):B(Ty,this,Sy).call(this),B(Ty,this,Cy).call(this)})),z(Vg,this).on(yh.TIMELINE_RESET,z(Yg,this)),j(Zg,this,(()=>B(Ty,this,tb).call(this))),z(Vg,this).on(yh.TIMELINE_TIME_UPDATE,z(Zg,this)),j(Qg,this,(()=>{B(Ty,this,hb).call(this)&&z(dy,this)&&B(Ty,this,db).call(this,z(dy,this))})),z(Vg,this).on(yh.TIMELINE_STATE_CHANGE,z(Qg,this))),z(Gg,this)&&"function"==typeof z(Gg,this).on&&(j(ty,this,(()=>{const t=z(dy,this);j(wy,this,!0),B(Ty,this,Sy).call(this),j(dy,this,t)})),z(Gg,this).on(yh.CANVAS_WEBGL_CONTEXT_LOST,z(ty,this)),j(ey,this,(()=>{var t;const e=null===(t=z(Gg,this))||void 0===t?void 0:t.gl;if(!e||"function"==typeof e.isContextLost&&e.isContextLost())return void j(wy,this,!0);const n=z(dy,this);j(wy,this,!1),B(Ty,this,Sy).call(this),j(dy,this,n),n&&B(Ty,this,hb).call(this)&&B(Ty,this,db).call(this,n)})),z(Gg,this).on(yh.CANVAS_WEBGL_CONTEXT_RESTORED,z(ey,this))),j(Jg,this,(()=>{j(uy,this,null),z(dy,this)&&B(Ty,this,hb).call(this)&&B(Ty,this,db).call(this,z(dy,this))})),z(Hg,this)&&"function"==typeof z(Hg,this).on&&z(Hg,this).on(yh.CONTAINER_RESIZE,z(Jg,this))}get name(){return"Renderer"}onDispose(){z(Vg,this)&&z(Kg,this)&&"function"==typeof z(Vg,this).off&&z(Vg,this).off(yh.VISUAL_FRAMES_AVAILABLE,z(Kg,this)),z(Vg,this)&&z(Xg,this)&&"function"==typeof z(Vg,this).off&&z(Vg,this).off(yh.TIMELINE_SEEKING,z(Xg,this)),z(Vg,this)&&z(Yg,this)&&"function"==typeof z(Vg,this).off&&z(Vg,this).off(yh.TIMELINE_RESET,z(Yg,this)),z(Vg,this)&&z(Zg,this)&&"function"==typeof z(Vg,this).off&&z(Vg,this).off(yh.TIMELINE_TIME_UPDATE,z(Zg,this)),z(Vg,this)&&z(Qg,this)&&"function"==typeof z(Vg,this).off&&z(Vg,this).off(yh.TIMELINE_STATE_CHANGE,z(Qg,this)),z(Hg,this)&&z(Jg,this)&&"function"==typeof z(Hg,this).off&&z(Hg,this).off(yh.CONTAINER_RESIZE,z(Jg,this)),z(Gg,this)&&z(ty,this)&&"function"==typeof z(Gg,this).off&&z(Gg,this).off(yh.CANVAS_WEBGL_CONTEXT_LOST,z(ty,this)),z(Gg,this)&&z(ey,this)&&"function"==typeof z(Gg,this).off&&z(Gg,this).off(yh.CANVAS_WEBGL_CONTEXT_RESTORED,z(ey,this)),B(Ty,this,Sy).call(this),j(Kg,this,null),j(Xg,this,null),j(Yg,this,null),j(Zg,this,null),j(Qg,this,null),j(Jg,this,null),j(ty,this,null),j(ey,this,null),j(ny,this,null),j(oy,this,null),j(vy,this,null),j(gy,this,null),j(Gg,this,null),j(Hg,this,null),j(Vg,this,null)}startTransition(t={}){var e,n;const i=null===(e=z(Gg,this))||void 0===e?void 0:e.element,r=null===(n=z(Gg,this))||void 0===n?void 0:n.gl;if(!i||!r)return null;if(z(wy,this)||"function"==typeof r.isContextLost&&r.isContextLost())return j(wy,this,!0),null;if(B(Ty,this,Py).call(this,i),!z(sy,this))return null;const o=z(oy,this).start({shaderGraph:z(sy,this),duration:null==t?void 0:t.duration,filter:null==t?void 0:t.filter,color:null==t?void 0:t.color,filters:null==t?void 0:t.filters,reverseFilters:null==t?void 0:t.reverseFilters,transition:null==t?void 0:t.transition});return j(hy,this,z(dy,this)||null),B(Ty,this,lb).call(this),o}beginTransitionIn(t={}){var e,n;null!==(e=z(oy,this))&&void 0!==e&&null!==(n=e.beginIncoming)&&void 0!==n&&n.call(e,t),j(hy,this,null),B(Ty,this,lb).call(this)}resetTransition(){var t,e;null!==(t=z(oy,this))&&void 0!==t&&null!==(e=t.reset)&&void 0!==e&&e.call(t,z(sy,this)),j(hy,this,null),B(Ty,this,cb).call(this)}}function Sy(){if(B(Ty,this,Fy).call(this),z(oy,this)&&"function"==typeof z(oy,this).reset&&z(oy,this).reset(z(sy,this)),B(Ty,this,sb).call(this,0),z(sy,this)&&"function"==typeof z(sy,this).dispose)try{z(sy,this).dispose()}catch(t){}j(sy,this,null),j(ay,this,null),j(ly,this,[]),j(cy,this,[]),j(by,this,!1),j(uy,this,null),j(iy,this,null),j(ry,this,null),j(dy,this,null),j(hy,this,null),B(Ty,this,cb).call(this),B(Ty,this,Yy).call(this),j(gy,this,null)}function My(){B(Ty,this,Fy).call(this),z(oy,this)&&"function"==typeof z(oy,this).reset&&z(oy,this).reset(z(sy,this)),B(Ty,this,sb).call(this,0),j(ly,this,[]),j(cy,this,[]),j(uy,this,null),j(iy,this,null),j(ry,this,null),j(dy,this,null),j(hy,this,null),B(Ty,this,cb).call(this),B(Ty,this,Yy).call(this),j(gy,this,null),j(yy,this,null)}function Ay(){const t="function"==typeof vh.requestAnimationFrame?vh.requestAnimationFrame.bind(vh):null,e="function"==typeof vh.cancelAnimationFrame?vh.cancelAnimationFrame.bind(vh):null;return t?{schedule:e=>t(e),cancel(t){"number"==typeof t&&e&&e(t)}}:null}function Ny(t){j(_y,this,z(_y,this).filter((e=>e!==t))),z(_y,this).length||j(Iy,this,null)}function Fy(){z(Iy,this)&&z(_y,this).forEach((t=>z(Iy,this).call(this,t))),j(_y,this,[]),j(Iy,this,null),j(xy,this,!1)}function Cy(){B(Ty,this,Fy).call(this),j(ky,this,!1)}function Oy(){if(z(ky,this)||z(xy,this))return;const t=B(Ty,this,Ay).call(this);if(!t)return;const{schedule:e,cancel:n}=t;let i;j(Iy,this,n),j(xy,this,!0),i=e((()=>{let t;B(Ty,this,Ny).call(this,i),t=e((()=>{B(Ty,this,Ny).call(this,t),j(xy,this,!1),z(ky,this)||(j(ky,this,!0),z(Vg,this)&&"function"==typeof z(Vg,this).notifyFirstFrameRendered&&z(Vg,this).notifyFirstFrameRendered())})),z(_y,this).push(t)})),z(_y,this).push(i)}function Py(t){if(z(sy,this)||!t)return;const e=this,n={dest:t,src:(t,n)=>{j(ay,e,n)}};j(sy,e,new pv(n,{userWillCallRender:!0,glOptions:{contextType:"webgl2"},performanceToggles:{useCanvasSizedFilterTargets:!0}})),z(sy,e)&&"function"==typeof z(sy,e).addNodes&&z(sy,e).addNodes({[pe.pipelineNodeId]:{type:"composite",options:{graph:[]}}})}function Ry(t){var e;if("null"===(null==t?void 0:t.message))return!0;const n=null===(e=z(Gg,this))||void 0===e?void 0:e.gl;return!(!n||"function"!=typeof n.isContextLost||!n.isContextLost())}function Dy(t,e,n){const i=e||z(dy,this)||null;if(B(Ty,this,Sy).call(this),j(dy,this,i),!n)return this.log.warn("Shader graph render failed; rebuilding graph once.",t),void B(Ty,this,db).call(this,i,!0);this.log.warn("Shader graph render is still unavailable after rebuild; deferring until the next render pass.",t)}function By(){var t;const e=null===(t=this.settings)||void 0===t?void 0:t.resourceLimits;return!e||"object"!=typeof e||Array.isArray(e)?{}:e}function Ly(){const t=B(Ty,this,By).call(this).enabled;return!0===t||!1!==t&&Ig()}function zy(){if(!B(Ty,this,Ly).call(this))return 0;const t=qg(B(Ty,this,By).call(this).transitionMinFrameIntervalMs,33);return Number.isFinite(t)&&t>0?t:0}function Wy(t,e,n={}){const i=!0===(null==n?void 0:n.useDevicePixelRatio),r=B(Ty,this,Ly).call(this),o=i?Ug(null==vh?void 0:vh.devicePixelRatio,1):1;let s=o,a=0;if(r){const t=B(Ty,this,By).call(this);a=qg(t.maxCanvasPixels,$g);const e=qg(t.maxDevicePixelRatio,0);s=Ug(t.renderScale,1)*(e>0?Math.min(o,e):o)}let l=Math.max(1,Math.round(t*s)),c=Math.max(1,Math.round(e*s));if(r&&a>0){const t=l*c;if(t>a){const e=Math.sqrt(a/t);l=Math.max(1,Math.floor(l*e)),c=Math.max(1,Math.floor(c*e))}}return{width:l,height:c}}function jy(t=[],e={}){var n;const i=null===(n=z(Gg,this))||void 0===n?void 0:n.element,r=z(ay,this);if(!i||"function"!=typeof r)return!1;let o=0,s=0;const a=!0===(null==e?void 0:e.useViewportSize);if(a){var l,c,u,d,h,f;const t=Number(null!==(l=null===(c=z(Hg,this))||void 0===c?void 0:c.containerWidth)&&void 0!==l?l:null===(u=z(Hg,this))||void 0===u?void 0:u.width),e=Number(null!==(d=null===(h=z(Hg,this))||void 0===h?void 0:h.containerHeight)&&void 0!==d?d:null===(f=z(Hg,this))||void 0===f?void 0:f.height);if(Number.isFinite(t)&&Number.isFinite(e)&&t>0&&e>0)o=Math.round(t),s=Math.round(e);else{const t=Number(i.clientWidth),e=Number(i.clientHeight);Number.isFinite(t)&&Number.isFinite(e)&&t>0&&e>0&&(o=Math.round(t),s=Math.round(e))}}if(!(o>0&&s>0)){if(!Array.isArray(t)||!t.length)return;for(let e=0;e<t.length;e+=1){var p;const n=null===(p=t[e])||void 0===p?void 0:p.frame,i=Number((null==n?void 0:n.displayWidth)||(null==n?void 0:n.codedWidth)||(null==n?void 0:n.videoWidth)||(null==n?void 0:n.naturalWidth)||(null==n?void 0:n.width)),r=Number((null==n?void 0:n.displayHeight)||(null==n?void 0:n.codedHeight)||(null==n?void 0:n.videoHeight)||(null==n?void 0:n.naturalHeight)||(null==n?void 0:n.height));!Number.isFinite(i)||!Number.isFinite(r)||i<=0||r<=0||(i>o&&(o=i),r>s&&(s=r))}}if(!(o>0&&s>0))return!1;const m=B(Ty,this,Wy).call(this,o,s,{useDevicePixelRatio:a}),v=m.width,g=m.height,y=z(uy,this);return!(y&&y.width===v&&y.height===g||(j(uy,this,{width:v,height:g}),r(null,null,v,g),0))}function $y(t){const e=null==t?void 0:t.nodeId,n=null==t?void 0:t.trackId,i=null==t?void 0:t.segmentId,r=null==t?void 0:t.presentationTime;return e&&n&&i&&Number.isFinite(r)?`${e}:${n}:${i}@${r}`:null}function Uy(t,e,n){const i=Number.isFinite(null==t?void 0:t.duration)&&t.duration>0?t.duration:void 0;let r;if(i&&Number.isFinite(null==t?void 0:t.offset)){const n=(e-t.offset)/i;r=n<0?0:n>1?1:n}const o=B(Ty,this,qy).call(this,t),s=B(Ty,this,Vy).call(this,o);return ig.getRenderTiming({type:o,timing:{duration:i,normalizedTime:r},timelineTime:e,active:t,renderNodeParams:n,state:s})}function qy(t){return ig.normalizeType(null==t?void 0:t.type)||ig.defaultType}function Vy(t){if(!t||!z(vy,this))return null;let e=z(vy,this).get(t);return e||(e={},z(vy,this).set(t,e)),e}function Gy(){var t,e,n,i,r,o,s,a,l,c,u;const d=Number(null!==(t=null===(e=z(Hg,this))||void 0===e?void 0:e.containerWidth)&&void 0!==t?t:null===(n=z(Hg,this))||void 0===n?void 0:n.width),h=Number(null!==(i=null===(r=z(Hg,this))||void 0===r?void 0:r.containerHeight)&&void 0!==i?i:null===(o=z(Hg,this))||void 0===o?void 0:o.height);if(Number.isFinite(d)&&Number.isFinite(h)&&d>0&&h>0)return{width:Math.round(d),height:Math.round(h)};const f=null===(s=z(Gg,this))||void 0===s?void 0:s.element,p=Number(null==f?void 0:f.clientWidth),m=Number(null==f?void 0:f.clientHeight);if(Number.isFinite(p)&&Number.isFinite(m)&&p>0&&m>0)return{width:Math.round(p),height:Math.round(m)};const v=Number(null!==(a=null==f?void 0:f.width)&&void 0!==a?a:null===(l=z(uy,this))||void 0===l?void 0:l.width),g=Number(null!==(c=null==f?void 0:f.height)&&void 0!==c?c:null===(u=z(uy,this))||void 0===u?void 0:u.height);return Number.isFinite(v)&&Number.isFinite(g)&&v>0&&g>0?{width:Math.round(v),height:Math.round(g)}:null}function Hy(t){const e=B(Ty,this,Vy).call(this,t);return e&&"object"==typeof e&&(e.requestRender=()=>B(Ty,this,Ky).call(this),e.viewportSize=B(Ty,this,Gy).call(this)),e}function Ky(){z(by,this)||(j(by,this,!0),Promise.resolve().then((()=>{j(by,this,!1),z(dy,this)&&B(Ty,this,hb).call(this)&&B(Ty,this,db).call(this,z(dy,this))})))}function Xy(t){if(!t||!z(vy,this))return;const e=z(vy,this).get(t);e&&ig.resetRenderState(t,e),z(vy,this).delete(t)}function Yy(){z(vy,this)&&(ig.resetAllRenderStates(z(vy,this)),z(vy,this).clear())}function Qy(t,e,n,i){const r=B(Ty,this,qy).call(this,t);z(gy,this)&&z(gy,this)!==r&&B(Ty,this,Xy).call(this,z(gy,this)),j(gy,this,r);const o=B(Ty,this,Hy).call(this,r);return ig.prepareRenderFrames({type:r,frames:e,timelineTime:n,timeline:z(Vg,this),active:t,renderNodeParams:i,state:o})}function Jy(t){var e;return null!=t&&t.params&&"object"==typeof t.params?t.params:!t&&null!==(e=this.settings)&&void 0!==e&&e.defaultRenderParams&&"object"==typeof this.settings.defaultRenderParams?this.settings.defaultRenderParams:{}}function Zy(t){return t?String(t.renderPlacementId||t.type||"unknown"):"default"}function tb(){if(!z(Vg,this)||!z(dy,this))return;const t=z(Vg,this).currentTime,e=z(Vg,this).getActiveRenderPlacement(t),n=B(Ty,this,Zy).call(this,e);n!==z(yy,this)&&(j(yy,this,n),B(Ty,this,db).call(this,{...z(dy,this),time:t}))}function eb(t){return!t||"object"!=typeof t||!Object.prototype.hasOwnProperty.call(t,"panAndScan")||!1!==t.panAndScan}function nb(t,e){const n=B(Ty,this,Jy).call(this,t),i=null==n?void 0:n.stages;let r=Lg(null==i?void 0:i.pre),o=Lg(null==i?void 0:i.post);const s=B(Ty,this,eb).call(this,n),a=B(Ty,this,qy).call(this,t),l=zg(r,"retarget")||zg(o,"retarget");if(s&&!l){const i=ig.getPanAndScanTarget(a,{frameCount:Array.isArray(e)?e.length:0,active:t,renderNodeParams:n});if("pre"===i){const t=Wg(Array.isArray(e)?e.length:0);t&&(r=[t,...r])}else if("post"===i){const t=Wg(1);t&&(o=[...o,t])}}else s||(r=jg(r),o=jg(o));return{preStages:r,postStages:o,renderNodeParams:n}}function ib(t,e,n,i,r){const o=r||B(Ty,this,Uy).call(this,t,n,i),s=B(Ty,this,nb).call(this,t,e),a=B(Ty,this,qy).call(this,t),l=B(Ty,this,Hy).call(this,a);return z(ny,this).build({layoutType:null==t?void 0:t.type,frames:e,preStages:s.preStages,postStages:s.postStages,normalizedTime:o.normalizedTime,renderNodeDuration:o.duration,renderNodeParams:s.renderNodeParams,renderNodeState:l,timelineTime:n})}function rb(){var t,e;const n=null===(t=z(oy,this))||void 0===t||null===(e=t.getState)||void 0===e?void 0:e.call(t);return"out"===(null==n?void 0:n.phase)?z(oy,this).buildOutgoingGraph():"in"===(null==n?void 0:n.phase)?z(oy,this).buildIncomingGraph():null}function ob(t,e,n,i){const r=n||e!==z(iy,this),o=r||i;return r&&z(sy,this)&&"function"==typeof z(sy,this).updateOptions&&(z(sy,this).updateOptions(pe.pipelineNodeId,{graph:t}),j(iy,this,e)),z(sy,this)&&"function"==typeof z(sy,this).selectNode&&z(ry,this)!==pe.pipelineNodeId&&(z(sy,this).selectNode(pe.pipelineNodeId),j(ry,this,pe.pipelineNodeId)),!(!o||!z(sy,this)||"function"!=typeof z(sy,this).render||(z(sy,this).render({noRaf:!0}),0))}function sb(t){if(!Array.isArray(z(ly,this))||!z(ly,this).length)return;const e=Number.isFinite(t)?Math.max(0,t):0;if(!(z(ly,this).length<=e)){for(let t=e;t<z(ly,this).length;t+=1){const e=z(ly,this)[t];if(e&&z(sy,this)&&"function"==typeof z(sy,this).releaseTexture)try{z(sy,this).releaseTexture(e)}catch(t){}}z(ly,this).length=e,z(cy,this).length=e}}function ab(t=[]){if(!z(sy,this)||"function"!=typeof z(sy,this).addTexture)return{didUpdate:!1,hasUploadFailure:!1,ready:!1};if("function"==typeof z(sy,this).isContextUnavailable&&z(sy,this).isContextUnavailable())return{didUpdate:!1,hasUploadFailure:!1,ready:!1};if(!Array.isArray(t)||!t.length)return B(Ty,this,sb).call(this,0),{didUpdate:!1,hasUploadFailure:!1,ready:!1};B(Ty,this,sb).call(this,t.length);let e=!1,n=!1,i=!0;for(let o=0;o<t.length;o+=1){var r;z(ly,this)[o]||"function"!=typeof z(sy,this).addTexture||(z(ly,this)[o]=z(sy,this).addTexture(null,"frame",o));const s=B(Ty,this,$y).call(this,t[o]),a=null===(r=t[o])||void 0===r?void 0:r.frame;if(z(ly,this)[o]&&a){if(!s||s!==z(cy,this)[o])try{z(ly,this)[o].fill(a),z(cy,this)[o]=s,e=!0}catch(t){i=!1,n=!0,z(cy,this)[o]=null}}else i=!1}return{didUpdate:e,hasUploadFailure:n,ready:i}}function lb(){if(z(fy,this))return;const t="function"==typeof vh.requestAnimationFrame?t=>vh.requestAnimationFrame(t):t=>setTimeout(t,16),e="function"==typeof vh.cancelAnimationFrame?t=>vh.cancelAnimationFrame(t):clearTimeout;j(py,this,e);const n=()=>{var e,i;if(null!==(e=z(oy,this))&&void 0!==e&&null!==(i=e.getState)&&void 0!==i&&i.call(e)){if(z(dy,this)){const t=B(Ty,this,zy).call(this),e=Date.now();(!t||!z(my,this)||e-z(my,this)>=t)&&(j(my,this,e),B(Ty,this,db).call(this,z(dy,this)))}j(fy,this,t(n))}else j(fy,this,null)};j(fy,this,t(n))}function cb(){z(fy,this)&&z(py,this)&&z(py,this).call(this,z(fy,this)),j(fy,this,null),j(py,this,null),j(my,this,null)}function ub(t){var e,n;const i=null===(e=z(oy,this))||void 0===e||null===(n=e.getState)||void 0===n?void 0:n.call(e);return"out"===(null==i?void 0:i.phase)&&z(hy,this)?z(hy,this):t}function db(t={},e=!1){try{var n,i;t&&j(dy,this,t);const e=null===(n=z(Gg,this))||void 0===n?void 0:n.element,r=null===(i=z(Gg,this))||void 0===i?void 0:i.gl;if(!e||!r)return;if(z(wy,this)||"function"==typeof r.isContextLost&&r.isContextLost())return void j(wy,this,!0);if(!B(Ty,this,hb).call(this))return;const o=B(Ty,this,ub).call(this,t),s=Number.isFinite(null==o?void 0:o.time)?o.time:void 0;if(!Number.isFinite(s))return;if(B(Ty,this,Py).call(this,e),!z(sy,this))return;const a=z(Vg,this)&&"function"==typeof z(Vg,this).getActiveRenderPlacement?z(Vg,this).getActiveRenderPlacement(s):void 0,l=B(Ty,this,Zy).call(this,a);l!==z(yy,this)&&j(yy,this,l);const c=Array.isArray(null==o?void 0:o.frames)?o.frames:[],u=B(Ty,this,Jy).call(this,a),d=B(Ty,this,eb).call(this,u),h=B(Ty,this,Qy).call(this,a,c,s,u),f=B(Ty,this,Uy).call(this,a,s,u),p=B(Ty,this,jy).call(this,h,{useViewportSize:d}),m=B(Ty,this,ab).call(this,h),v=m.didUpdate;if(h.length>0&&!m.ready)return void(m.hasUploadFailure&&this.log.warn("Skipping render because one or more input textures could not be uploaded."));const g=B(Ty,this,ib).call(this,a,h,s,u,f),y=B(Ty,this,rb).call(this);let b=g.graph,k=g.signature,x=!!g.isDynamic;y&&Array.isArray(y.graph)&&y.graph.length&&(b=b.concat(y.graph),k=`${k}|${y.signature||"transition"}`,x=x||!!y.forceUpdate);const w=p||v||x||y&&Array.isArray(y.graph)&&y.graph.length;B(Ty,this,ob).call(this,b,k,x,w)&&h.length>0&&B(Ty,this,Oy).call(this)}catch(n){if(B(Ty,this,Ry).call(this,n))return void B(Ty,this,Dy).call(this,n,t,e);throw n}}function hb(){var t;const e=null===(t=z(Vg,this))||void 0===t?void 0:t.state;return e===Fg||e===Og||e===Cg||e===Rg}function fb(t){return"number"==typeof t&&Number.isFinite(t)&&t>0}function pb(t){return t&&"resource"===t.entryType&&t.transferSize>0&&t.duration>0&&t.responseEnd>=t.requestStart}function mb(t){return Array.isArray(t)&&0!==t.length?t.reduce(((t,e)=>t+e),0)/t.length:NaN}pe=Ey;var vb=new WeakMap,gb=new WeakMap,yb=new WeakMap,bb=new WeakMap,kb=new WeakSet;class xb extends fh{get name(){return"DownloadSpeedGuesstimator"}get defaults(){return{persistentStorage:{key:"ekoDownloadSpeedKbps",ttl:-1},priorities:[["resourceTiming","downlink","persistentValue"],["resourceTiming","downlink"],["resourceTiming","persistentValue","ua"],["resourceTiming","ua","defaultKbps"],["downlink","persistentValue"],["downlink"],["persistentValue"],["connectionType"],["ua"],["defaultKbps"]],defaultKbps:2500,connectionType:{"slow-2g":50,"2g":70,"3g":700,"4g":3500,bluetooth:750,cellular:750,ethernet:3500,wifi:2500,wimax:2500,none:0},ua:{desktop:2500,ios:2500,android:2500}}}constructor(...t){super(...t),$(this,kb),W(this,vb,void 0),W(this,gb,void 0),W(this,yb,void 0),W(this,bb,void 0),j(vb,this,!!(vh&&vh.navigator&&vh.navigator.connection)),j(gb,this,!(!vh||!vh.performance||"function"!=typeof vh.performance.getEntriesByType)),j(yb,this,B(kb,this,_b).call(this)),j(bb,this,B(kb,this,Mb).call(this))}guesstimate(){const t=B(kb,this,Nb).call(this);this.log.debug("[guesstimate] Data:",t);const e=B(kb,this,Ab).call(this,t),n=fb(e)?e:t.defaultKbps;return B(kb,this,Ib).call(this,n),this.log.info(`[guesstimate] Result: ${n} kbps`),n}update(t){fb(t)&&B(kb,this,Ib).call(this,t)}onDispose(){j(yb,this,void 0),j(bb,this,void 0)}}function wb(){return Math.round(Date.now()/1e3)}function _b(){try{if(!vh||!vh.localStorage||"function"!=typeof vh.localStorage.getItem)return}catch(t){return}const t=this.settings.persistentStorage.key,e=vh.localStorage.getItem(t);if(e)try{const t=JSON.parse(e),n=this.settings.persistentStorage.ttl,i=B(kb,this,wb).call(this)-t.timestamp;if("number"==typeof n&&n>=0&&i>n)return null;if(!fb(t.value))return;return t.value}catch(t){return}}function Ib(t){if(!fb(t))return;try{if(!vh||!vh.localStorage||"function"!=typeof vh.localStorage.setItem)return}catch(t){return}const e=this.settings.persistentStorage.key,n=JSON.stringify({value:t,timestamp:B(kb,this,wb).call(this)});try{vh.localStorage.setItem(e,n),j(yb,this,t)}catch(t){}}function Tb(){return vh&&vh.performance&&"function"==typeof vh.performance.getEntriesByType?mb(vh.performance.getEntriesByType("resource").filter(pb).map((t=>8*t.transferSize/t.duration))):NaN}function Eb(){if(!vh||!vh.navigator||!vh.navigator.connection)return NaN;const t=vh.navigator.connection.downlink;return fb(t)?1e3*t:NaN}function Sb(){if(!z(vb,this))return NaN;const t=vh.navigator.connection,e=t.effectiveType||t.type,n=this.settings.connectionType||{};return e&&Object.prototype.hasOwnProperty.call(n,e)?n[e]:NaN}function Mb(){const t=this.settings.ua||{};return _g()?t.android:Ig()?t.ios:t.desktop}function Ab(t){const e=Array.isArray(this.settings.priorities)?this.settings.priorities:[];for(let n=0;n<e.length;n+=1){const i=e[n];if(!Array.isArray(i)||0===i.length)continue;const r=i.map((e=>t[e])).filter((t=>fb(t)));if(r.length===i.length)return this.log.debug("[#selectFromPriorities] Selected from priorities:",i,"with values:",r),mb(r)}return NaN}function Nb(){const t=this.settings.testOverrides||{},e=fb(t.resourceTiming)?t.resourceTiming:B(kb,this,Tb).call(this),n=fb(t.downlink)?t.downlink:B(kb,this,Eb).call(this),i=fb(t.persistentValue)?t.persistentValue:z(yb,this),r=fb(t.connectionType)?t.connectionType:B(kb,this,Sb).call(this),o=fb(t.ua)?t.ua:z(bb,this);return{defaultKbps:this.settings.defaultKbps,resourceTiming:e,downlink:n,connectionType:r,persistentValue:i,ua:o}}const Fb=new ah;function Cb(t){return"string"!=typeof t||0===t.length?[]:t.split(".").filter((t=>t.length>0))}function Ob(t){if("string"!=typeof t)return!1;if(0===t.length)return!1;const e=Number(t);return Number.isInteger(e)&&String(e)===t}function Pb(t){return null!==t&&"object"==typeof t}function Rb(t,e,n){const i=Cb(e);if(0===i.length)return void 0===t?n:t;let r=t;for(let t=0;t<i.length;t+=1){if(null==r)return n;if(r=r[i[t]],void 0===r)return n}return void 0===r?n:r}function Db(t,e,n){if(!Pb(t))return t;const i=Cb(e);if(0===i.length)return t;let r=t;for(let t=0;t<i.length;t+=1){const e=i[t];if(t===i.length-1){r[e]=n;break}Pb(r[e])||(r[e]=Ob(i[t+1])?[]:{}),r=r[e]}return t}const Bb={get:(t,e)=>vh&&vh.eko?Rb(vh.eko,t,e):e,set(t,e){if(vh)return vh.eko&&"object"==typeof vh.eko||(vh.eko={}),Db(vh.eko,t,e),vh.eko}},Lb=vh&&vh.performance,zb=Lb&&"function"==typeof Lb.now?()=>Lb.now():()=>Date.now();function Wb(){return"undefined"==typeof AbortController?null:new AbortController}function jb(){const t=new Error("The operation was aborted");return t.name="AbortError",t.code="ABORT_ERR",t}function $b(t,e){return!(!e||!e.aborted)||!!t&&("AbortError"===t.name||"ABORT_ERR"===t.code||20===t.code)}const Ub=2,qb=100,Vb=2,Gb="runtime.downloadSpeedSamples",Hb=sh("download","warn");function Kb(t){return new Promise((e=>{setTimeout(e,t)}))}function Xb(t){return t>=500}function Yb(t){if(!t||!t.headers||"function"!=typeof t.headers.get)return 0;const e=t.headers.get("content-length");if(!e)return 0;const n=Number(e);return Number.isNaN(n)||n<0?0:n}function Qb(t,e,n,i,r,o){const s={bytes:t,durationMs:e,kbps:e>0?8*t/e:0,startTime:n,endTime:i,url:o};try{let t=Bb.get(r);t||(t=[],Bb.set(r,t)),t.push(s)}catch(t){}return s}async function Jb(t,e={}){const{method:n="GET",headers:i,body:r,retries:o=Ub,retryDelay:s=qb,backoffFactor:a=Vb,samplesTargetPath:l=Gb,fetch:c,loglevel:u="warn",cache:d,signal:h,onProgress:f,returnType:p="default"}=e;Hb.setLevel(u);const m=function(t){if(t)return t;if(vh&&"function"==typeof vh.fetch)return vh.fetch.bind(vh);throw new Error("fetch is not available in this environment")}(c);let v=0,g=s;for(;;){if(h&&h.aborted)throw jb();const e=zb();try{const s=await m(t,{method:n,headers:i,body:r,cache:d,mode:"cors",signal:h});if(h&&h.aborted)throw jb();if(!s.ok){if(v<o&&Xb(s.status)){v+=1,Hb.warn(`[${t}] Download attempt #${v} failed with status ${s.status}, retrying in ${g}ms...`),await Kb(g),g*=a;continue}Hb.error(`[${t}] Download attempt #${v} failed with status ${s.status}, no more retries.`);const e=new Error(`Download failed with status ${s.status}`);throw e.status=s.status,e}let c=zb();const u=Yb(s),y="arrayBuffer"===p||"bytes"===p,b=y&&"function"==typeof f;let k,x,w,_,I,T=0;if(y&&s.body&&"function"==typeof s.body.getReader&&b){const t=s.body.getReader(),e=[];for(;;){if(h&&h.aborted)throw jb();const{done:n,value:i}=await t.read();if(n)break;if(i&&i.length){const t=zb();Number.isFinite(_)||(_=t),I=t,e.push(i),T+=i.length,f({loaded:T,total:u||void 0,chunk:i})}}k=new Uint8Array(T);let n=0;e.forEach((t=>{k.set(t,n),n+=t.length})),c=zb()}else if(y){const t=await s.arrayBuffer();k=new Uint8Array(t),T=k.length,c=zb()}else"text"===p?(x=await s.text(),c=zb()):"json"===p&&(w=await s.json(),c=zb());if(h&&h.aborted)throw jb();const E=y?k?k.length:T:("text"===p&&"string"==typeof x?x.length:0)||("json"===p&&w?JSON.stringify(w).length:0),S=u||E||0;let M=e,A=c;Number.isFinite(_)&&(M=_,Number.isFinite(I)&&(A=Math.max(I,c))),(!Number.isFinite(M)||!Number.isFinite(A)||A<M)&&(M=e,A=c);const N=Math.max(0,A-M),F=Qb(S,N,M,A,l,t);try{Fb.trigger("download:sample",F)}catch(t){}const C={response:s,bytes:S,durationMs:N,kbps:F.kbps,startTime:F.startTime,endTime:F.endTime};if("default"===p)return C;if("arrayBuffer"===p||"bytes"===p){const t=k||new Uint8Array(await s.arrayBuffer());return"arrayBuffer"===p?t.buffer:t}return"text"===p?x:"json"===p?w:C}catch(e){if($b(e,h))throw"AbortError"===e.name?e:jb();if(!(v<o)||e.status&&!Xb(e.status))throw Hb.error(`[${t}] Download attempt #${v} failed with error ${e}, no more retries.`),e;v+=1,Hb.warn(`[${t}] Download attempt #${v} failed with error ${e}, retrying in ${g}ms...`),await Kb(g),g*=a}}}const Zb={disabledTracks:{default:["audio"],targetPaths:["NodeRepository.disabledTracks"]},muted:{default:!1,targetPaths:["AudioPlaybackManager.muted"]},volume:{default:1,targetPaths:["AudioPlaybackManager.volume"]},encodeProfile:{default:null,targetPaths:["AssetsDeliveryService.profile"]},forceVideoCodec:{default:void 0,targetPaths:["NodeRepository.forceVideoCodec"]},forceImageFallback:{default:!1,targetPaths:["NodeRepository.forceImageFallback"]},mediaHostRewriteMap:{default:{"storageeko.s3.amazonaws.com":"https://storage.eko.com","studioz-post.s3.amazonaws.com":"https://studioz-post.eko.com"},targetPaths:["NodeRepository.mediaHostRewriteMap"]},playbackRate:{default:1,targetPaths:["PlaybackClock.playbackRate"]},initialKbps:{default:"auto",targetPaths:["DownloadSpeed.initialKbps"]},defaultRenderParams:{default:void 0,targetPaths:["Renderer.defaultRenderParams"]},maxBufferedVideoFrames:{default:24,targetPaths:["Timeline.maxBufferedVideoFrames"]},waitingBufferAheadSeconds:{default:3,targetPaths:["Timeline.waitingBufferAheadSeconds"]},abrStrategy:{default:"auto",targetPaths:["ABRSelector.abrStrategy"]},segmentEvictionEnabled:{default:!0,targetPaths:["SegmentEvictionCoordinator.enabled"]},segmentEvictionBufferBehindSeconds:{default:30,targetPaths:["SegmentEvictionCoordinator.bufferBehindSeconds"]},segmentEvictionBufferAheadSeconds:{default:30,targetPaths:["SegmentEvictionCoordinator.bufferAheadSeconds"]},segmentEvictionMaxRetainedBytes:{default:52428800,targetPaths:["SegmentEvictionCoordinator.maxRetainedBytes"]},autoplay:{default:!0,targetPaths:["Idle.autoplay"]},autoPauseOnVisibilityChange:{default:!0,targetPaths:["DocumentVisibility.autoPauseOnVisibilityChange"]},autoResumeOnVisibilityChange:{default:!0,targetPaths:["DocumentVisibility.autoResumeOnVisibilityChange"]},trackingEnabled:{default:!0,targetPaths:["Tracker.trackingEnabled"]}},tk=Object.freeze(Object.entries(Zb).reduce(((t,[e,n])=>(Object.prototype.hasOwnProperty.call(n,"default")&&(t[e]=n.default),t)),{})),ek=sh("config","warn");function nk(t){return tk[t]}var ik=new WeakMap,rk=new WeakMap,ok=new WeakMap,sk=new WeakMap,ak=new WeakMap,lk=new WeakSet;class ck extends fh{get name(){return"DownloadSpeed"}get defaults(){return{alpha:.3,maxSamples:30,minBytesPerSample:1024,minDurationMs:5,maxSampleKbpsCap:void 0,ignoreCacheHits:!0,samplesPath:"runtime.downloadSpeedSamples",initialKbps:nk("initialKbps"),probeUrl:void 0,defaultKbps:2500}}constructor(...t){super(...t),$(this,lk),W(this,ik,void 0),W(this,rk,void 0),W(this,ok,void 0),W(this,sk,void 0),W(this,ak,void 0),j(ok,this,[]),j(rk,this,0),j(ik,this,B(lk,this,hk).call(this)),j(ak,this,Wb()),j(sk,this,(t=>{B(lk,this,yk).call(this,t,"event")})),B(lk,this,fk).call(this),Fb.on("download:sample",z(sk,this)),B(lk,this,pk).call(this),this.log.debug(`[#constructor] Initial estimate: ${z(ik,this)} kbps`)}getKbps(){return z(ik,this)}addSample(t){B(lk,this,yk).call(this,t,"manual")}reset(){j(ok,this,[]),j(rk,this,0),j(ik,this,B(lk,this,hk).call(this))}onDispose(){z(ak,this)&&z(ak,this).abort(),j(ak,this,null),Fb.off("download:sample",z(sk,this)),j(ok,this,[]),j(rk,this,0),j(ik,this,void 0),j(sk,this,null)}}function uk(t,e){return!!(this.settings.ignoreCacheHits&&(0===e||t&&"boolean"==typeof t.cached&&t.cached||t&&"number"==typeof t.transferSize&&"number"==typeof t.encodedBodySize&&t.transferSize<=t.encodedBodySize))}function dk(t){if(!t||"object"!=typeof t)return null;const e=Number(t.bytes),n=Number(t.durationMs);let i=fb(t.kbps)?Number(t.kbps):NaN;return!fb(i)&&n>0&&fb(e)&&(i=8*e/n),fb(i)?e<=this.settings.minBytesPerSample||n<=this.settings.minDurationMs||B(lk,this,uk).call(this,t,e)?null:(fb(this.settings.maxSampleKbpsCap)&&i>this.settings.maxSampleKbpsCap&&(i=this.settings.maxSampleKbpsCap),{...t,bytes:e,durationMs:n,kbps:i}):null}function hk(){const t=this.settings.initialKbps;if(fb(t))return t;if("auto"===t)try{const t=(new xb).guesstimate();if(fb(t))return t}catch(t){}return this.settings.defaultKbps}function fk(){const t=Bb.get(this.settings.samplesPath,[]);if(!Array.isArray(t)||0===t.length)return;const e=t.slice(-this.settings.maxSamples);for(let t=0;t<e.length;t+=1)B(lk,this,yk).call(this,e[t],"replay",{emit:!1})}async function pk(){if(!this.settings.probeUrl||z(rk,this)>0)return;const t=z(ak,this)?z(ak,this).signal:void 0;if(!t||!t.aborted)try{await Jb(this.settings.probeUrl,{cache:"no-store",samplesTargetPath:this.settings.samplesPath,signal:t})}catch(t){}}function mk(t){return"number"==typeof t.startTime&&"number"==typeof t.endTime&&Number.isFinite(t.startTime)&&Number.isFinite(t.endTime)&&t.startTime>=0&&t.endTime>t.startTime}function vk(t,e){if(!B(lk,this,mk).call(this,t)||!B(lk,this,mk).call(this,e))return 0;const n=Math.max(t.startTime,e.startTime);return Math.min(t.endTime,e.endTime)-n}function gk(t){if(!B(lk,this,mk).call(this,t))return t;const e=[];for(let n=0;n<z(ok,this).length;n+=1){const i=z(ok,this)[n];B(lk,this,mk).call(this,i)&&(B(lk,this,vk).call(this,t,i)>0&&e.push(i))}if(0===e.length)return t;j(ok,this,z(ok,this).filter((t=>!e.includes(t))));const n=[t,...e],i=n.reduce(((t,e)=>t+(e.bytes||0)),0),r=Math.min(...n.map((t=>t.startTime))),o=Math.max(...n.map((t=>t.endTime))),s=o-r;if(!fb(i)||s<=0)return t;const a={bytes:i,durationMs:s,kbps:8*i/s,startTime:r,endTime:o,url:t.url||e[e.length-1].url};return B(lk,this,dk).call(this,a)}function yk(t,e,{emit:n=!0}={}){const i=B(lk,this,dk).call(this,t);if(!i)return;const r=B(lk,this,gk).call(this,i);if(!r)return;j(rk,this,z(rk,this)+1),z(ok,this).push(r),z(ok,this).length>this.settings.maxSamples&&z(ok,this).shift();const o=this.defaults.alpha,s="number"==typeof this.settings.alpha?this.settings.alpha:o,a=fb(z(ik,this)),l=a?z(ik,this):r.kbps,c=a||1!==z(rk,this)?s*r.kbps+(1-s)*l:r.kbps;j(ik,this,c),this.log.debug(`[#ingestSample] Next estimate: ${c} kbps`),n&&this.trigger("download:speed",{kbps:z(ik,this),sample:r,source:e,samplesCount:z(rk,this)})}function bk(t=""){if(t&&"string"==typeof t)return t.split(",")[0].trim()||void 0}function kk(t=""){const e=bk(t);if(!e)return;const n=e.match(/^[a-z0-9]+/i);return n?n[0].toLowerCase():void 0}var xk={getFirstCodec:bk,getBaseCodec:kk},wk=Object.freeze({__proto__:null,default:xk,getBaseCodec:kk,getFirstCodec:bk});class _k{constructor(t={}){const{id:e,url:n,uri:i,mime:r,codecs:o,bandwidth:s,timescale:a,sizeBytes:l,...c}=t;if(!e)throw new Error("Representation requires id");const u=n||i;if(!u)throw new Error("Representation requires url or uri");this.id=e,this.url=u,this.mime=r,this.codecs=o,this.baseCodec=kk(o),fb(s)&&(this.bandwidth=s),fb(a)&&(this.timescale=a),fb(l)&&(this.sizeBytes=l),Object.assign(this,c)}}class Ik{#P=new Map;#R;#D;#B=0;#L;constructor(t={}){const{id:e,offset:n=0,duration:i=0,isInit:r=!1,representations:o=[]}=t;if(!e)throw new Error("Segment requires id");o.forEach((t=>{if(!t||!t.url&&!t.uri)throw new Error("Segment representation must include uri or url")})),this.id=e,this.offset=n,this.duration=i,this.isInit=!!r,this.originalRepresentations=o.map((t=>t instanceof _k?t:new _k(t))),this.representations=this.originalRepresentations.map((t=>t)),this.appliedFilters=[],this.loadAttempts=0,this.loadError=void 0}setRepresentationBuffer(t,e){t&&e&&this.#P.set(t,e)}setDownloadProgress(t,e){const n=Number(t);Number.isFinite(n)&&n>=0&&(this.#B=Math.max(this.#B,n));const i=Number(e);Number.isFinite(i)&&i>0&&(this.#L=i)}setChosenRepresentation(t){this.#R=t;const e=null==t?void 0:t.id;if(!(this.isInit||!e||this.#P.size<=1))for(const t of this.#P.keys())t!==e&&this.#P.delete(t)}setABRDecisionSnapshot(t){if(!t||"object"!=typeof t)return void(this.#D=void 0);const e={...t};Array.isArray(t.availableRepresentations)&&(e.availableRepresentations=t.availableRepresentations.map((t=>({...t})))),this.#D=e}markLoadAttempt(){const t=Number(this.loadAttempts);this.loadAttempts=Number.isFinite(t)&&t>0?t+1:1,this.loadError=void 0}setLoadError(t){this.loadError=t||new Error("Segment load failed")}getRepresentationBuffer(t){return this.#P.get(t)}get chosenRepresentation(){return this.#R}get abrDecision(){return this.#D}get arrayBuffer(){return this.#R?this.#P.get(this.#R.id):void 0}get retainedByteLength(){let t=0;for(const e of this.#P.values())e&&"number"==typeof e.byteLength&&(t+=e.byteLength);return t}get bufferedRatio(){var t;const e=fb(this.#L)?this.#L:null===(t=this.#R)||void 0===t?void 0:t.sizeBytes;return fb(e)?Math.min(1,Math.max(0,this.#B/e)):this.retainedByteLength>0?1:0}get isLoaded(){return this.retainedByteLength>0}evict(){this.#R=void 0,this.#D=void 0,this.#P.clear(),this.#B=0,this.#L=void 0}}class Tk{constructor(t={}){const{timestamp:e,name:n,data:i,isSticky:r=!1}=t;this.timestamp="number"==typeof e?e:0,this.name="string"==typeof n?n:"",this.data=i,this.isSticky="boolean"==typeof r&&r}}function Ek(t,e){const n=Number(null==t?void 0:t.offset),i=Number(null==t?void 0:t.duration);if(!e)return{offset:n,duration:i};const r=(null==t?void 0:t.chosenRepresentation)||(Array.isArray(null==t?void 0:t.representations)?t.representations[0]:void 0),o=Number(null==r?void 0:r.segStart),s=Number(null==r?void 0:r.segDuration);return Number.isFinite(o)&&Number.isFinite(s)&&s>0?{offset:o,duration:s}:{offset:n,duration:i}}function Sk(t,e,n={}){if(!Array.isArray(t)||!t.length)return;const i=Number(e);if(!Number.isFinite(i))return;const r=!!n.preferRepresentationTime;let o,s,a=-1/0;for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||n.isInit)continue;o||(o=n);const l=Ek(n,r);if(!Number.isFinite(l.offset))continue;const c=Number(l.duration);if(Number.isFinite(c)&&c>0&&i>=l.offset&&i<l.offset+c)return n;l.offset<=i&&l.offset>a&&(a=l.offset,s=n)}return s||o}const Mk=new Set(["video","audio","image","cue","data","bbox"]);class Ak{constructor(t={}){const{id:e,type:n,offset:i=0,duration:r,source:o,segments:s=[],cues:a=[]}=t;if(!e)throw new Error("Track requires id");if(!Mk.has(n))throw new Error(`Track type must be one of ${Array.from(Mk).join("|")}`);this.id=e,this.type=n,this.offset=i,this.duration=fb(r)?r:void 0,this.source=o,"cue"===n?(this._cues=a.map((t=>t instanceof Tk?t:new Tk(t))),this._segments=[]):(this._segments=s.map((t=>t instanceof Ik?t:new Ik(t))),this._cues=void 0)}get segments(){return this._segments.slice()}get cues(){if("cue"===this.type)return this._cues.slice()}get endTime(){if(fb(this.duration))return this.offset+this.duration;if(!this._segments.length)return;const t=this._segments.reduce(((t,e)=>{const n=fb(e.duration)?e.duration:0;return Math.max(t,e.offset+n)}),this.offset);return t}get buffered(){const t=this._segments.map((t=>({duration:fb(null==t?void 0:t.duration)?t.duration:0,offset:fb(null==t?void 0:t.offset)?t.offset:0,ratio:t&&!t.isInit&&"number"==typeof t.bufferedRatio?t.bufferedRatio:0}))).filter((t=>t.duration>0&&t.ratio>0));if(!t.length)return;const e=t.reduce(((t,e)=>Math.min(t,e.offset)),1/0),n=t.reduce(((t,e)=>{const n=e.offset+e.duration*Math.min(1,e.ratio);return Math.max(t,n)}),0);return!Number.isFinite(e)||!Number.isFinite(n)||n<=e?void 0:{start:e,end:n}}getMediaSegmentAtTime(t,e={}){return Sk(this._segments,t,e)}setSegments(t=[]){if("cue"===this.type)return;const e=Array.isArray(t)?t:[];this._segments=e.map((t=>t instanceof Ik?t:new Ik(t)))}}function Nk(t){return"string"==typeof t?t:t&&"object"==typeof t?t.nodeId||t.nodeIdOrRef||t.id:void 0}function Fk(t){const e=Nk(t);let n=1;if(t&&"object"==typeof t&&fb(t.weight)&&(n=t.weight),!e)throw new Error("Child entry requires a nodeId");return{nodeId:e,weight:n}}function Ck(t){return(Array.isArray(t)?t:[]).map((t=>Fk(t)))}function Ok(t,e=void 0){if("string"==typeof t){const e=t.match(/\d+\.?\d*/);if(e){const t=Number(e[0]);if(Number.isFinite(t))return t}}else if("number"==typeof t&&Number.isFinite(t))return t;return e}function Pk(t,e){if(t){if(t.includes("$Number%")){const n=t.match(/\$Number%0(\d+)d\$/);if(n){const i=Number(n[1]),r=String(e).padStart(i,"0");return t.replace(/\$Number%0\d+d\$/,r)}}return t.replace(/\$Number\$/g,String(e))}}function Rk(t,e){if(e)try{var n;return new URL(e,t||(null==vh||null===(n=vh.location)||void 0===n?void 0:n.href)||void 0).toString()}catch(t){return e}}const Dk=new Map;class Bk{static register(t,e){if(!t||"function"!=typeof e)throw new Error("ManifestFactory.register requires type and parser function");Dk.set(t,e)}static inferType(t={}){const{typeHint:e,url:n,mimeType:i,body:r}=t;return e||function(t=""){const e=function(t=""){return t&&"string"==typeof t?t.split("#")[0].split("?")[0].toLowerCase():""}(t);return e.endsWith(".mpd")?"dash":e.endsWith(".ivd")?"ivd":e.endsWith(".jpg")||e.endsWith(".jpeg")||e.endsWith(".png")||e.endsWith(".webp")||e.endsWith(".gif")||e.endsWith(".avif")?"image":void 0}(n||"")||function(t=""){const e=t.toLowerCase();return e.includes("dash")||e.includes("mpd")||e.includes("xml")?"dash":e.includes("ivd")||e.includes("json")?"ivd":e.includes("image/")?"image":void 0}(i||"")||function(t=""){const e="string"==typeof t?t.trim():"";if(e.startsWith("<")&&e.includes("<MPD"))return"dash";if(e.startsWith("{"))try{const t=JSON.parse(e);if(t&&"object"==typeof t)return"ivd"}catch(t){return}}(r||"")}static parse(t={}){const e=Bk.inferType(t);if(!e||!Dk.has(e))throw new Error("Unsupported manifest type");return Dk.get(e)(t)}}Bk.register("dash",(function(t={}){const{body:e,url:n}=t,i=function(){if(vh&&"function"==typeof vh.DOMParser)return new vh.DOMParser;throw new Error("DOMParser is not available in this environment")}().parseFromString(e||"","application/xml"),r=i.getElementsByTagName("MPD")[0];if(!r)throw new Error("Invalid MPD");const o=i.getElementsByTagName("Period")[0],s=o?Array.from(o.getElementsByTagName("AdaptationSet")):[],a=[];let l=Ok(r.getAttribute("mediaPresentationDuration"));l=Number.isFinite(l)?l:void 0,s.forEach(((t,e)=>{const i=t.getAttribute("mimeType")||"",r=function(t=""){const e=t.toLowerCase();return e.includes("video")?"video":e.includes("audio")?"audio":e.includes("image")?"image":"data"}(i),o=t.getAttribute("id")||`${r}-${e+1}`,s=t.getElementsByTagName("SegmentTemplate")[0],c=Array.from(t.getElementsByTagName("Representation")).map((t=>function(t,e,n){const i=t.getAttribute("id")||t.getAttribute("representationId")||"",r=Ok(t.getAttribute("bandwidth")),o=t.getAttribute("codecs"),s=t.getAttribute("mimeType")||e&&e.getAttribute("mimeType")||n,a=t.getElementsByTagName("SegmentTemplate")[0]||e;return{repId:i,bandwidth:r,codecs:o,mime:s,media:a?a.getAttribute("media"):void 0,initialization:a?a.getAttribute("initialization"):void 0,timescale:Ok(a&&a.getAttribute("timescale"))||Ok(e&&e.getAttribute("timescale"),1)||1,startNumber:Ok(a&&a.getAttribute("startNumber"))||Ok(e&&e.getAttribute("startNumber"),1)||1,timeline:function(t){const e=[],n=t.getElementsByTagName("SegmentTimeline")[0];if(!n)return e;const i=Array.from(n.getElementsByTagName("S"));let r=0;for(let t=0;t<i.length;t+=1){const n=i[t],o=Ok(n.getAttribute("t")),s=Ok(n.getAttribute("d")),a=Ok(n.getAttribute("r"),0);if(!fb(s))continue;fb(o)&&(r=o);const l=a>=0?a:0;for(let t=0;t<=l;t+=1)e.push({start:r,duration:s}),r+=s}return e}(a)}}(t,s,i))),u=c.map((t=>({id:t.repId,url:Rk(n,Pk(t.initialization,t.startNumber)),bandwidth:t.bandwidth,mime:t.mime,codecs:t.codecs,timescale:t.timescale}))).filter((t=>t.url)),d=c.reduce(((t,e)=>{const n=Array.isArray(null==t?void 0:t.timeline)?t.timeline.length:0;return(Array.isArray(null==e?void 0:e.timeline)?e.timeline.length:0)>n?e:t}),c[0]),h=Array.isArray(null==d?void 0:d.timeline)?d.timeline:[],f=h.length,p=[],m=(null==d?void 0:d.timescale)||1;u.length>0&&p.push({id:`init-${o}`,offset:0,duration:0,isInit:!0,representations:u});for(let t=0;t<f;t+=1){const e=h[t];if(!e)continue;const i=c.map((e=>{const i=e.startNumber+t,r=e.timescale||m,o=Array.isArray(e.timeline)?e.timeline[t]:void 0;if(!o)return null;const s=o.start,a=o.duration;return{id:e.repId,url:Rk(n,Pk(e.media,i)),bandwidth:e.bandwidth,mime:e.mime,codecs:e.codecs,timescale:e.timescale,segIndex:t,segStart:s/r,segDuration:a/r}})).filter(Boolean);i.length&&p.push({id:`${o}-seg-${t+1}`,offset:e.start/m,duration:e.duration/m,isInit:!1,representations:i})}a.push({id:o,type:r,offset:0,duration:l,segments:p})}));const c=a[0]?a[0].id:void 0;return{id:n||r.getAttribute("id")||"mpd",mainTrackId:c,tracks:a,duration:l}})),Bk.register("ivd",(function(t={}){var e;const{body:n,url:i}=t;let r;try{r="string"==typeof n?JSON.parse(n):n}catch(t){throw new Error("Invalid IVD manifest")}if(!r||"object"!=typeof r)throw new Error("Invalid IVD manifest");const o=Array.isArray(r.representations)?r.representations:[],s=new Map;o.forEach(((t,e)=>{const n=function(t){const e=(t.mimeType||"").toLowerCase();return e.includes("video")?"video":e.includes("audio")?"audio":"data"}(t),i=Number.isInteger(t.altIndex)?t.altIndex:0,r=`${n}-${i}`,o=(l=e,{id:`${(a=t).format||"unknownformat"}-${a.altIndex||0}-${a.label||l+1}`,url:a.url,mime:a.mimeType,codecs:a.codecs,bandwidth:a.bandwidth||a.audioBandwidth||a.videoBandwidth,sizeBytes:a.contentLength,duration:fb(a.duration)?a.duration:void 0,segIndex:Number.isInteger(a.segIndex)&&a.segIndex>=0?a.segIndex:0});var a,l;s.has(r)||s.set(r,{type:n,altIndex:i,reps:[]}),s.get(r).reps.push(o)}));const a=Array.from(s.values()).map(((t,e)=>{const n=new Map;t.reps.forEach((t=>{const e=Number.isInteger(t.segIndex)?t.segIndex:0;n.has(e)||n.set(e,[]),n.get(e).push(t)}));const i=Array.from(n.keys()).sort(((t,e)=>t-e));let o=0;const s=i.map((i=>{var r;const s=n.get(i)||[],a=(null===(r=s.find((t=>fb(t.duration))))||void 0===r?void 0:r.duration)||0,l={id:`${t.type}-${t.altIndex}-${e+1}-seg-${i+1}`,offset:o,duration:a,isInit:!1,representations:s.map((t=>{const{duration:e,segIndex:n,...i}=t;return i}))};return o+=a,l})),a=s.reduce(((t,e)=>t+(fb(e.duration)?e.duration:0)),0),l=fb(r.duration)?r.duration:a||void 0;return{id:`${t.type}-${t.altIndex}-${e+1}`,type:t.type,offset:0,duration:l,segments:s}})),l=r.mainTrackId||(null===(e=a.find((t=>"video"===t.type)))||void 0===e?void 0:e.id)||a[0]&&a[0].id,c=a.find((t=>t.id===l)),u=(null==c?void 0:c.duration)||void 0;return{id:r.id||i||"ivd",metadata:r.metadata||{},mainTrackId:l,tracks:a,duration:u}})),Bk.register("image",(function(t={}){const e=null==t?void 0:t.url;if(!e||"string"!=typeof e)throw new Error("ImageParser requires url");const n=fb(null==t?void 0:t.duration)?t.duration:30,i=fb(null==t?void 0:t.width)?t.width:void 0,r=fb(null==t?void 0:t.height)?t.height:void 0,o={id:"image-1",url:e,mime:"string"==typeof(null==t?void 0:t.mimeType)?t.mimeType:void 0};fb(i)&&fb(r)&&(o.width=i,o.height=r);const s="image-1";return{id:e,metadata:{},mainTrackId:s,tracks:[{id:s,type:"image",offset:0,duration:n,segments:[{id:"image-1-seg-1",offset:0,duration:n,isInit:!1,representations:[o]}]}],duration:n}}));const Lk=["video/mp4"];function zk(t){return Lk.includes(t.mime)}var Wk={name:"containers",fn:function(t=[]){return t.filter(zk)},isRelevantForTrack:function(t){return"video"===(null==t?void 0:t.type)}},jk={name:"force-video-codec",fn:function(t=[],{node:e}={}){const n=kk(null==e?void 0:e.forceVideoCodec);if(!n)return t;const i=t.filter((t=>(null==t?void 0:t.baseCodec)===n));return i.length?i:t},isRelevantForTrack:function(t){return"video"===(null==t?void 0:t.type)}};function $k(t=""){return t.toLowerCase().includes("video")}const Uk=new(me=new WeakMap,ve=new WeakSet,class extends fh{get name(){return"MediaCapabilities"}get defaults(){return{enabled:!0,smoothWeight:10,powerWeight:10,ignoreSmooth:!1,ignorePower:!0,codecBonus:{av01:.2,hvc1:.15,hev1:.15,vp09:.1,avc1:0}}}constructor(...t){super(...t),$(this,ve),W(this,me,void 0),j(me,this,new Map)}onDispose(){z(me,this)&&z(me,this).clear()}async sortRepsCodecs(t=[]){if(!Array.isArray(t)||0===t.length)return[];const e=[],n=new Set;let i=0;t.forEach((t=>{const r=null==t?void 0:t.baseCodec;r&&!n.has(r)&&(n.add(r),e.push({codec:r,rep:t,index:i}),i+=1)}));const r=(await Promise.all(e.map((async t=>{const{score:e}=await B(ve,this,Qk).call(this,t.rep);return{...t,score:e}})))).sort(((t,e)=>{const n=e.score-t.score;return 0!==n?n:t.index-e.index}));return this.log.info("[sortRepsCodecs] Sorted entries:",r),r.map((t=>t.codec))}});function qk(){return!!(vh&&vh.navigator&&vh.navigator.mediaCapabilities&&"function"==typeof vh.navigator.mediaCapabilities.decodingInfo)}function Vk(t){if(!t||"object"!=typeof t)return void this.log.debug("[#buildConfig] Invalid representation:",t);const e=t.mime||t.mimeType||"",n=function(t="",e=""){const n=t||"",i=e||"";return i?`${n}; codecs="${i}"`:n}(e,t.codecs||"");return $k(e)?(this.log.debug("[#buildConfig] Building video config for:",t),{type:"file",video:{contentType:n,width:t.width||1920,height:t.height||1080,bitrate:t.videoBandwidth||t.bandwidth||0,framerate:t.framerate||t.frameRate||24}}):function(t=""){return t.toLowerCase().includes("audio")}(e)?(this.log.debug("[#buildConfig] Building audio config for:",t),{type:"file",audio:{contentType:n,channels:t.channels||2,bitrate:t.audioBandwidth||t.bandwidth||0,samplerate:t.audioSamplingRate||48e3}}):void this.log.debug("[#buildConfig] Unknown mime type:",e)}function Gk(t){const e=bk(null==t?void 0:t.codecs);if(!e)return;const n={codec:e,codedWidth:t.codedWidth||t.width||1920,codedHeight:t.codedHeight||t.height||1080};return t.description&&(n.description=t.description),n}function Hk(t){return t?JSON.stringify(t):"invalid"}function Kk(){return!(!vh||!vh.VideoDecoder||"function"!=typeof vh.VideoDecoder.isConfigSupported)}async function Xk(t){if(!this.settings.enabled||!B(ve,this,qk).call(this)||!t)return this.log.debug("[#queryCapabilities] Not supported, returning false",t),{supported:!1,smooth:!1,powerEfficient:!1};const e=B(ve,this,Hk).call(this,t),n=z(me,this).get(e);if(n)return n;let i;try{i=await vh.navigator.mediaCapabilities.decodingInfo(t)}catch(t){i={supported:!1,smooth:!1,powerEfficient:!1}}return this.log.debug("[#queryCapabilities] Config:",t,"\nDecoding info result:",i),z(me,this).set(e,i),i}async function Yk(t){if(!$k((null==t?void 0:t.mime)||(null==t?void 0:t.mimeType)||""))return{supported:!0};if(!B(ve,this,Kk).call(this))return{supported:!0};const e=B(ve,this,Gk).call(this,t);if(!e)return{supported:!1};const n=`video-decoder:${B(ve,this,Hk).call(this,e)}`,i=z(me,this).get(n);if(i)return i;let r;try{r=await vh.VideoDecoder.isConfigSupported(e)}catch(t){r={supported:!1}}return this.log.debug("[#queryVideoDecoderSupport] Config:",e,"\nSupport result:",r),z(me,this).set(n,r),r}async function Qk(t){const e=B(ve,this,Vk).call(this,t),[n,i]=await Promise.all([B(ve,this,Xk).call(this,e),B(ve,this,Yk).call(this,t)]),r=!!n.supported&&!!i.supported,o={supported:r,smooth:r&&!!n.smooth,powerEfficient:r&&!!n.powerEfficient},s=function(t="",e={}){const n=(t||"").toLowerCase();return Object.keys(e).reduce(((t,i)=>n.includes(i.toLowerCase())?e[i]:t),0)}(t.codecs||"",this.settings.codecBonus);let a=0;return o.supported&&(a+=1),!this.settings.ignoreSmooth&&o.smooth&&(a+=this.settings.smoothWeight),!this.settings.ignorePower&&o.powerEfficient&&(a+=this.settings.powerWeight),a+=s,{score:a,capability:o}}const Jk=[],Zk=()=>!0;[Wk,jk,{name:"media-capabilities",fn:async function(t=[],{track:e}){if(null==e||!e.preferredCodec){const n=await Uk.sortRepsCodecs(t);if(!Array.isArray(n)||0===n.length)return t;e.preferredCodec=n[0]}return t.filter((t=>(null==t?void 0:t.baseCodec)===e.preferredCodec))},isRelevantForTrack:function(t){return"video"===(null==t?void 0:t.type)}}].forEach((({name:t,fn:e,isRelevantForTrack:n})=>{!function(t,e,{isRelevantForTrack:n}={}){if(!t||"function"!=typeof e)throw new Error("registerRepresentationFilter requires a name and function");const i="function"==typeof n?n:Zk;Jk.push({name:t,fn:e,isRelevantForTrack:i})}(t,e,{isRelevantForTrack:n})}));const tx=sh("Node","warn"),ex={start:0,end:0},nx=.001;function ix(t){if(!Array.isArray(t)||!t.length)return;const e=t.map((t=>{const e=Number(null==t?void 0:t.segStart),n=Number(null==t?void 0:t.segDuration);return!Number.isFinite(e)||!Number.isFinite(n)||n<=0?null:{start:e,duration:n}}));if(e.some((t=>!t)))return;const n=e[0];return e.every((t=>Math.abs(t.start-n.start)<=nx&&Math.abs(t.duration-n.duration)<=nx))?{offset:n.start,duration:n.duration}:void 0}var rx=new WeakMap,ox=new WeakMap,sx=new WeakMap,ax=new WeakMap,lx=new WeakMap,cx=new WeakMap,ux=new WeakMap,dx=new WeakMap,hx=new WeakMap,fx=new WeakMap,px=new WeakSet;class mx extends ah{constructor(t={},e={}){super(),$(this,px),W(this,rx,void 0),W(this,ox,void 0),W(this,sx,void 0),W(this,ax,void 0),W(this,lx,void 0),W(this,cx,void 0),W(this,ux,void 0),W(this,dx,void 0),W(this,hx,void 0),W(this,fx,[]);const{id:n,manifestRef:i,duration:r,width:o,height:s,metadata:a={},children:l=[]}=t;if(!n)throw new Error("Node requires id");if(!i)throw new Error("Node requires manifestRef");this.id=n,this.manifestRef=i,this.metadata=a,this.state="pending",this.error=void 0,this.tracks=[],this.mainTrackId=void 0,this.imageFallbackActive=!1,this.disabledTracks=[],this.disabledTrackTypes=Array.isArray(e.disabledTracks)?e.disabledTracks.filter((t=>"string"==typeof t)):[],this.enabledRepFilters=Array.isArray(e.enabledRepFilters)?e.enabledRepFilters:void 0,this.forceVideoCodec="string"==typeof e.forceVideoCodec&&e.forceVideoCodec.trim()?e.forceVideoCodec.trim():void 0,j(ux,this,!0===e.forceImageFallback),j(rx,this,e.abrSelector),j(ox,this,e.assetsDeliveryService),j(ax,this,fb(r)?r:void 0),j(lx,this,fb(o)?o:void 0),j(cx,this,fb(s)?s:void 0),j(dx,this,e&&"object"==typeof e.mediaHostRewriteMap?e.mediaHostRewriteMap:void 0),j(hx,this,fb(e.maxManifestLoadAttempts)?e.maxManifestLoadAttempts:1/0),this.manifestLoadAttempts=0,this.manifestLoadError=void 0,j(fx,this,Ck(l))}setChildren(t){const e=Ck(t);return B(px,this,Ox).call(this,e,{emit:!0})}addChild(t){const e=Fk(t),n=z(fx,this).slice(),i=n.findIndex((t=>(null==t?void 0:t.nodeId)===e.nodeId));if(i>=0){var r;if((null===(r=n[i])||void 0===r?void 0:r.weight)===e.weight)return this.children;n[i]=e}else n.push(e);return B(px,this,Ox).call(this,n,{emit:!0})}removeChild(t){const e=Nk(t);if(!e)return this.children;const n=z(fx,this).filter((t=>(null==t?void 0:t.nodeId)!==e));return n.length===z(fx,this).length?this.children:B(px,this,Ox).call(this,n,{emit:!0})}async load(t={}){const{loadingMode:e="full",signal:n}=t;tx.info(`[load] [${this.id}] Loading node in '${e}' mode`);try{if(n&&n.aborted)throw jb();"ready"!==this.state&&await this.resolve({signal:n});const t="partial"===e,i=[];this.tracks.forEach((e=>{const n=e.segments||[];if(t){const t=n.find((t=>t.isInit)),r=n.find((t=>!t.isInit));t&&Array.isArray(t.representations)&&!t.isLoaded&&i.push({track:e,segment:t}),r&&Array.isArray(r.representations)&&!r.isLoaded&&i.push({track:e,segment:r})}else n.forEach((t=>{Array.isArray(t.representations)&&!t.isLoaded&&i.push({track:e,segment:t})}))}));const r=i.filter((({segment:t})=>t.isInit)),o=i.filter((({segment:t})=>!t.isInit)),s=o.length?o[0]:void 0,a=r.map((({track:t,segment:e})=>B(px,this,Ax).call(this,t,e,n))),l=s?B(px,this,Nx).call(this,s.segment,s.track,n):Promise.resolve();await Promise.all([...a,l]);const c=s?o.slice(1):o;for(const t of c)await B(px,this,Nx).call(this,t.segment,t.track,n);if(n&&n.aborted)throw jb();return this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:e}),this}catch(t){if($b(t,n))throw t;throw this.trigger("node:loaderror",{nodeId:this.id,node:this,error:t,loadingMode:e}),t}}async loadMediaSegmentsAtOffset(t,e={}){const n=Number(t);if(tx.info(`[loadMediaSegmentsAtOffset] [${this.id}] Loading media segments at offset ${n}`),!Number.isFinite(n))return;const{signal:i}=e;if(i&&i.aborted)throw jb();if("ready"!==this.state&&await this.resolve({signal:i}),"ready"!==this.state)return;const r=[],o=[];if(this.tracks.forEach((t=>{const e=(null==t?void 0:t.segments)||[];if(!Array.isArray(e)||!e.length)return;const s=e.find((t=>(null==t?void 0:t.isInit)&&Array.isArray(null==t?void 0:t.representations)));s&&!s.isLoaded&&r.push(B(px,this,Ax).call(this,t,s,i)),e.forEach((e=>{if(!e||e.isInit||!Array.isArray(e.representations))return;const i=Number(e.offset);Number.isFinite(i)&&Math.abs(i-n)<=nx&&!e.isLoaded&&o.push({segment:e,track:t})}))})),r.length||o.length){if(await Promise.all(r),o.length&&await Promise.all(o.map((({segment:t,track:e})=>B(px,this,Nx).call(this,t,e,i)))),i&&i.aborted)throw jb();this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:"segment-offset",offsetSeconds:n})}}async resolve(t={}){const{signal:e,manifestOverride:n}=t;let i=!0;for(;i;){if(i=!1,"ready"===this.state)return this;if("resolving"===this.state)try{return await z(sx,this)}catch(t){if(!$b(t)||e&&e.aborted)throw t;i=!0;continue}if(e&&e.aborted)throw jb();if(this.hasExceededManifestLoadAttempts()){const t=this.manifestLoadError||new Error("Manifest load retry limit reached");throw this.state="failed",this.error=t,t}const t=B(px,this,wx).call(this);return this.state="resolving",this.error=void 0,j(sx,this,(async()=>{try{const t=await B(px,this,Fx).call(this,{signal:e,manifestOverride:n});if(e&&e.aborted)throw jb();let i=Bk.parse(t);return i=B(px,this,xx).call(this,i),this.tracks=(i.tracks||[]).map((t=>t instanceof Ak?t:new Ak(t))),this.mainTrackId=i.mainTrackId||this.mainTrackId,this.metadata=i.metadata||this.metadata,B(px,this,Rx).call(this),B(px,this,Px).call(this),await B(px,this,Cx).call(this),this.state="ready",this}catch(n){if($b(n,e))throw B(px,this,_x).call(this,t),n;throw this.state="failed",this.error=n,n}})()),z(sx,this)}return z(sx,this)}evict(){this.tracks.forEach((t=>{(t.segments||[]).forEach((t=>{t.evict()}))}))}get children(){return z(fx,this).slice()}set children(t){this.setChildren(t)}get duration(){if(!this.mainTrackId)return 0;const t=this.tracks.find((t=>t.id===this.mainTrackId));return t?fb(t.duration)?t.duration:t.endTime:0}get retainedByteLength(){let t=0;return this.tracks.forEach((e=>{(Array.isArray(e.segments)?e.segments:[]).forEach((e=>{t+=fb(e.retainedByteLength)?e.retainedByteLength:0}))})),t}get buffered(){if("ready"!==this.state)return ex;const t=Array.isArray(this.tracks)?this.tracks.find((t=>(null==t?void 0:t.id)===this.mainTrackId)):void 0,e=this.duration;if(!t||!fb(e))return ex;const n=Array.isArray(this.tracks)?this.tracks.map((t=>{if(!t||void 0===t.buffered)return;const e=t.buffered;return e&&Number.isFinite(e.start)&&Number.isFinite(e.end)?{track:t,range:e}:void 0})).filter(Boolean):[];if(!n.length)return ex;if(n.length===this.tracks.length&&n.every((({track:t,range:e})=>{const n=t.endTime,i=fb(t.offset)?t.offset:0;return Number.isFinite(n)&&e.start<=i&&e.end>=n})))return{start:0,end:e};const i=n.reduce(((t,{range:e})=>Math.min(t,e.end)),1/0);if(!Number.isFinite(i))return ex;const r=Math.min(i,e);return r>0?{start:0,end:r}:ex}get isLoaded(){return"ready"===this.state&&(Array.isArray(this.tracks)?this.tracks:[]).flatMap((t=>Array.isArray(null==t?void 0:t.segments)?t.segments:[])).every((t=>t.isLoaded))}hasExceededManifestLoadAttempts(){if(!Number.isFinite(z(hx,this))||z(hx,this)<=0)return!1;if(!this.manifestLoadError)return!1;const t=Number(this.manifestLoadAttempts);return Number.isFinite(t)&&t>=z(hx,this)}}function vx(t){return function(t,e){if(!t||"string"!=typeof t)return t;if(!e||"object"!=typeof e)return t;const n=vh&&"function"==typeof vh.URL?vh.URL:"function"==typeof URL?URL:null;if(!n)return t;let i;try{i=new n(t)}catch(e){return t}const r=function(t,e){const n=null==t?void 0:t.hostname,i=null==t?void 0:t.pathname;if("string"!=typeof n||"string"!=typeof i)return t;if(!/^s3(?:[.-][a-z0-9-]+)?\.amazonaws\.com$/i.test(n))return t;const r=i.split("/").filter(Boolean);if(r.length<2)return t;const o=r[0],s=new e(t.toString());return s.hostname=`${o}.${n}`,s.pathname=`/${r.slice(1).join("/")}`,s}(i,n),o=e[r.hostname]?r:i,s=e[o.hostname];if(!s||"string"!=typeof s)return t;let a;try{a=new n(s)}catch(e){return t}return a.protocol&&a.host?(o.protocol=a.protocol,o.host=a.host,o.toString()):t}(t,z(dx,this))}function gx(){return z(ux,this)||void 0===vh.VideoDecoder}function yx(){return this.manifestRef&&"object"==typeof this.manifestRef&&"assets-delivery-service"===this.manifestRef.type}function bx(t){if(!B(px,this,yx).call(this))return!1;if(!B(px,this,gx).call(this))return!1;const e=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[],n=e.find((e=>(null==e?void 0:e.id)===(null==t?void 0:t.mainTrackId)))||e[0];return"image"!==(null==n?void 0:n.type)}function kx(t){const e=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[],n=function(t){const e=Number(null==t?void 0:t.duration);if(Number.isFinite(e)&&e>0)return e;const n=Array.isArray(null==t?void 0:t.segments)?t.segments:[];let i=0;return n.forEach((t=>{if(null!=t&&t.isInit)return;const e=Number(null==t?void 0:t.offset),n=Number(null==t?void 0:t.duration);!Number.isFinite(e)||!Number.isFinite(n)||n<=0||(i=Math.max(i,e+n))})),i>0?i:void 0}(e.find((e=>(null==e?void 0:e.id)===(null==t?void 0:t.mainTrackId)))||e[0]);return fb(n)?n:fb(z(ax,this))?z(ax,this):void 0}function xx(t){if(this.imageFallbackActive=!1,!B(px,this,bx).call(this,t))return t;if(!z(ox,this)||"function"!=typeof z(ox,this).resolveImageOne)return t;const e=z(ox,this).resolveImageOne(this.manifestRef),n=B(px,this,vx).call(this,null==e?void 0:e.url);if(!n)return t;const i={typeHint:"image",url:n,duration:B(px,this,kx).call(this,t),width:z(lx,this),height:z(cx,this)},r=Bk.parse(i);return t&&"object"==typeof t.metadata&&!Array.isArray(t.metadata)&&(r.metadata=t.metadata),this.imageFallbackActive=!0,r}function wx(){return{state:this.state,error:this.error,tracks:this.tracks,mainTrackId:this.mainTrackId,metadata:this.metadata,imageFallbackActive:this.imageFallbackActive,disabledTracks:this.disabledTracks,manifestRef:this.manifestRef,manifestLoadAttempts:this.manifestLoadAttempts,manifestLoadError:this.manifestLoadError}}function _x(t){t&&(this.state=t.state,this.error=t.error,this.tracks=t.tracks,this.mainTrackId=t.mainTrackId,this.metadata=t.metadata,this.imageFallbackActive=t.imageFallbackActive,this.disabledTracks=t.disabledTracks,this.manifestRef=t.manifestRef,this.manifestLoadAttempts=t.manifestLoadAttempts,this.manifestLoadError=t.manifestLoadError)}function Ix(){const t=Number(this.manifestLoadAttempts);this.manifestLoadAttempts=Number.isFinite(t)&&t>0?t+1:1,this.manifestLoadError=void 0}function Tx(t){this.manifestLoadError=t||new Error("Manifest load failed")}function Ex(t){if(!t)return null;const e={loadAttempts:Number(t.loadAttempts),loadError:t.loadError};if("function"==typeof t.markLoadAttempt)return t.markLoadAttempt(),e;const n=Number(t.loadAttempts);return t.loadAttempts=Number.isFinite(n)&&n>0?n+1:1,t.loadError=void 0,e}function Sx(t,e){if(!t||!e)return;const n=Number(e.loadAttempts);t.loadAttempts=Number.isFinite(n)&&n>=0?n:0,t.loadError=e.loadError}function Mx(t,e){t&&("function"!=typeof t.setLoadError?t.loadError=e||new Error("Segment load failed"):t.setLoadError(e))}async function Ax(t,e,n){const i=B(px,this,Ex).call(this,e);try{const i=e.representations.map((async i=>{const r=B(px,this,vx).call(this,i.url),o=await Jb(r,{returnType:"arrayBuffer",signal:n,onProgress:({loaded:n,total:i,chunk:r})=>{e&&"function"==typeof e.setDownloadProgress&&e.setDownloadProgress(n,i),this.trigger("segment:chunk",{nodeId:this.id,trackId:null==t?void 0:t.id,trackType:null==t?void 0:t.type,segmentId:e.id,isInit:!0,loaded:n,total:i,chunk:r})}}),s=o instanceof ArrayBuffer?o:null==o?void 0:o.arrayBuffer;s&&e.setRepresentationBuffer(i.id,s)}));await Promise.all(i)}catch(t){if($b(t,n))throw B(px,this,Sx).call(this,e,i),t;throw B(px,this,Mx).call(this,e,t),t}}async function Nx(t,e,n){const i=z(rx,this),r={representations:t.representations,nodeId:this.id,trackId:null==e?void 0:e.id,segmentId:t.id},o=i&&"function"==typeof i.select?i.select(r):void 0,s=t.representations.find((t=>t.id===o))||t.representations[0];if(!s)return;t&&"function"==typeof t.setABRDecisionSnapshot&&t.setABRDecisionSnapshot(r.abrDecision),t.setChosenRepresentation(s);const a=B(px,this,Ex).call(this,t);try{const i=B(px,this,vx).call(this,s.url),r=await Jb(i,{returnType:"arrayBuffer",signal:n,onProgress:({loaded:n,total:i,chunk:r})=>{t&&"function"==typeof t.setDownloadProgress&&t.setDownloadProgress(n,i),this.trigger("segment:chunk",{nodeId:this.id,trackId:null==e?void 0:e.id,trackType:null==e?void 0:e.type,segmentId:t.id,isInit:!1,loaded:n,total:i,chunk:r})}}),o=r instanceof ArrayBuffer?r:null==r?void 0:r.arrayBuffer;o&&(t.setRepresentationBuffer(s.id,o),t.setChosenRepresentation(s))}catch(e){if($b(e,n))throw B(px,this,Sx).call(this,t,a),e;throw B(px,this,Mx).call(this,t,e),e}}async function Fx(t={}){const{signal:e,manifestOverride:n}=t;if(e&&e.aborted)throw jb();B(px,this,Ix).call(this);try{let t=this.manifestRef;if(n&&"object"==typeof n){if(B(px,this,yx).call(this)&&"string"==typeof n.encodeProfile&&n.encodeProfile&&(this.manifestRef={...this.manifestRef,encodeProfile:n.encodeProfile},t=this.manifestRef),n.ivd)return{typeHint:"ivd",body:n.ivd};if(n.body){const t=B(px,this,vx).call(this,n.url);return{typeHint:n.typeHint,url:t,mimeType:n.mimeType,body:n.body,duration:z(ax,this),width:z(lx,this),height:z(cx,this)}}"string"==typeof n.url&&n.url&&(t=n)}if(t&&"object"==typeof t&&"assets-delivery-service"===t.type){if(!z(ox,this)||"function"!=typeof z(ox,this).resolveOne)throw new Error("AssetsDeliveryService is required for assets-delivery-service manifestRef");const n=await z(ox,this).resolveOne(t,{signal:e});if(!n)throw new Error("AssetsDeliveryService returned empty result");if("string"==typeof n.encodeProfile&&n.encodeProfile&&(this.manifestRef={...t,encodeProfile:n.encodeProfile}),n.ivd)return{typeHint:"ivd",body:n.ivd};const i=n.typeHint,r=B(px,this,vx).call(this,n.url),o=n.mimeType,s=n.body;if(r||s||o)return{typeHint:i,url:r,mimeType:o,body:s,duration:z(ax,this),width:z(lx,this),height:z(cx,this)};throw new Error("AssetsDeliveryService returned unsupported manifest shape")}if(t&&"object"==typeof t){const e=B(px,this,vx).call(this,t.url),n=t.mimeType;if(t.body)return{url:e,mimeType:n,body:"string"==typeof t.body?t.body:JSON.stringify(t.body)}}if("string"==typeof t||t&&"string"==typeof t.url){const n="string"==typeof t?t:t.url,i=B(px,this,vx).call(this,n),r="object"==typeof t?t.typeHint:void 0,o="object"==typeof t?t.mimeType:void 0;if("image"===Bk.inferType({typeHint:r,url:i,mimeType:o})){const e="object"==typeof t&&fb(t.duration)?t.duration:z(ax,this);return{typeHint:"image",url:i,mimeType:o,duration:e,width:"object"==typeof t&&fb(t.width)?t.width:z(lx,this),height:"object"==typeof t&&fb(t.height)?t.height:z(cx,this)}}const s=await Jb(i,{returnType:"default",signal:e});return{url:i,body:s&&s.response&&"function"==typeof s.response.text?await s.response.text():void 0,mimeType:(s&&s.response&&s.response.headers&&"function"==typeof s.response.headers.get&&s.response.headers.get("content-type")?s.response.headers.get("content-type"):void 0)||o}}throw new Error("Node manifestRef is invalid or missing")}catch(t){if($b(t,e))throw t;throw B(px,this,Tx).call(this,t),t}}async function Cx(){const t=Jk.slice().filter((t=>!this.enabledRepFilters||this.enabledRepFilters.includes(t.name)));if(t.length)for(let e=0;e<this.tracks.length;e+=1){const n=this.tracks[e],i=Array.isArray(n.segments)?n.segments:[],r=[];for(let e=0;e<i.length;e+=1){const o=i[e];if(!Array.isArray(o.representations)){r.push(o);continue}o.appliedFilters=o.appliedFilters||[];let s=o.representations;for(let e=0;e<t.length;e+=1){const{name:i,fn:r,isRelevantForTrack:a}=t[e];if(!a(n))continue;const l=await r(s,{segment:o,track:n,node:this});Array.isArray(l)&&(s=l),o.appliedFilters.push(i)}if(o.representations=s,o.representations.length){if(!o.isInit){const t=ix(o.representations);t&&(o.offset=t.offset,o.duration=t.duration)}r.push(o)}}r.length!==i.length&&n&&"function"==typeof n.setSegments&&n.setSegments(r)}}function Ox(t,{emit:e=!1}={}){return function(t=[],e=[]){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n+=1){const i=t[n],r=e[n];if((null==i?void 0:i.nodeId)!==(null==r?void 0:r.nodeId)||(null==i?void 0:i.weight)!==(null==r?void 0:r.weight))return!1}return!0}(z(fx,this),t)||(j(fx,this,t),e&&(n=this)&&"function"==typeof n.trigger&&n.trigger("node:childrenchanged",{nodeId:n.id,node:n,children:Array.isArray(n.children)?n.children:[]})),this.children;var n}function Px(){var t;const e=Array.isArray(this.disabledTrackTypes)?this.disabledTrackTypes:[];if(!e.length||!Array.isArray(this.tracks)||!this.tracks.length)return void(this.disabledTracks=[]);const n=new Set(e),i=[],r=[];this.tracks.forEach((t=>{t&&n.has(t.type)?r.push(t):t&&i.push(t)})),this.tracks=i,this.disabledTracks=r,this.mainTrackId&&!i.some((t=>t.id===this.mainTrackId))&&(this.mainTrackId=null===(t=i[0])||void 0===t?void 0:t.id)}function Rx(){if(!Array.isArray(this.tracks)||!this.tracks.length)return;const t=this.duration;if(!fb(t))return;const e=[new Tk({name:"nodestart",timestamp:0,data:{id:this.id},isSticky:!0}),new Tk({name:"nodeend",timestamp:t,data:{id:this.id}})],n=new Ak({id:`${this.id}-auto-cue`,type:"cue",cues:e,offset:0,duration:t});this.tracks.push(n)}var Dx=new WeakMap,Bx=new WeakMap,Lx=new WeakMap,zx=new WeakMap,Wx=new WeakSet;class jx extends fh{constructor(...t){super(...t),$(this,Wx),W(this,Dx,new Map),W(this,Bx,new Map),W(this,Lx,void 0),W(this,zx,void 0);const[e,n]=t;j(Lx,this,e),j(zx,this,n)}get name(){return"NodeRepository"}get defaults(){return{enabledRepFilters:["containers","force-video-codec","media-capabilities"],disabledTracks:nk("disabledTracks"),forceVideoCodec:nk("forceVideoCodec"),forceImageFallback:nk("forceImageFallback"),mediaHostRewriteMap:nk("mediaHostRewriteMap"),maxManifestLoadAttempts:3}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"get","list"])}onDispose(){z(Dx,this).forEach(((t,e)=>{const n=z(Bx,this).get(e);n&&t&&"function"==typeof t.off&&t.off(yh.NODE_CHILDREN_CHANGED,n)})),z(Bx,this).clear(),z(Dx,this).clear()}add(t){const e=t instanceof mx?t:new mx(t,{enabledRepFilters:this.settings.enabledRepFilters,disabledTracks:this.settings.disabledTracks,forceVideoCodec:this.settings.forceVideoCodec,forceImageFallback:this.settings.forceImageFallback,mediaHostRewriteMap:this.settings.mediaHostRewriteMap,maxManifestLoadAttempts:this.settings.maxManifestLoadAttempts,abrSelector:z(Lx,this),assetsDeliveryService:z(zx,this)});if(!e.id)throw new Error("NodeRepository.add requires node with id");if(z(Dx,this).has(e.id))throw new Error(`NodeRepository.add: node with id ${e.id} already exists`);return z(Dx,this).set(e.id,e),B(Wx,this,$x).call(this,e),this.trigger(yh.NODE_ADD,{node:e}),e}get(t){const e=(null==t?void 0:t.id)||t;if(!e)throw new Error("NodeRepository.get requires node or id");return z(Dx,this).get(e)}list(){return Array.from(z(Dx,this).values())}}function $x(t){if(!t||"function"!=typeof t.on||!t.id)return;const e=t=>{this.trigger(yh.NODE_CHILDREN_CHANGED,t)};t.on(yh.NODE_CHILDREN_CHANGED,e),z(Bx,this).set(t.id,e)}var Ux=new WeakMap,qx=new WeakMap,Vx=new WeakSet;class Gx extends fh{constructor(...t){super(...t),$(this,Vx),W(this,Ux,void 0),W(this,qx,new Map);const[e]=t;j(Ux,this,e)}get name(){return"ABRSelector"}get defaults(){return{safetyMargin:.35,minBufferForUpgrade:5,minBufferCritical:1,hysteresisRatio:1.1,abrStrategy:nk("abrStrategy")}}select(t={}){var e;const{representations:n=[],bufferSeconds:i}=t;if(!Array.isArray(n)||0===n.length)return;const r=z(Ux,this)&&"function"==typeof z(Ux,this).getKbps?z(Ux,this).getKbps():void 0,o=B(Vx,this,Hx).call(this,n[0]),s=z(qx,this).get(o),a=this.settings.abrStrategy||"auto";this.log.debug(`[select] strategy=${a}, bw=${r}, buffer=${i}, prev=${s}`);const l=n.slice().sort(((t,e)=>B(Vx,this,Kx).call(this,t.bandwidth)-B(Vx,this,Kx).call(this,e.bandwidth)));if("bottom"===a){const e=l[0];return B(Vx,this,Qx).call(this,e,t,{decisionReason:"strategy:bottom",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==e?void 0:e.id}if("top"===a){const e=l[l.length-1];return B(Vx,this,Qx).call(this,e,t,{decisionReason:"strategy:top",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==e?void 0:e.id}if("random"===a){const e=l[Math.floor(Math.random()*l.length)];return B(Vx,this,Qx).call(this,e,t,{decisionReason:"strategy:random",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==e?void 0:e.id}const c=Number.isFinite(i)?i:void 0,u=fb(r)?r*this.settings.safetyMargin:void 0;let d="auto:highest-available";if(s&&void 0!==c&&c<this.settings.minBufferCritical){const e=l[0];return this.log.debug("[select] critical buffer -> lowest",t),B(Vx,this,Qx).call(this,e,t,{decisionReason:"auto:critical-buffer",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:u,bufferSeconds:c}),null==e?void 0:e.id}let h=l[l.length-1];if(void 0!==u){const e=l.filter((t=>B(Vx,this,Kx).call(this,t.bandwidth)<=u));e.length>0?(h=e[e.length-1],d="auto:highest-under-safe-bandwidth",this.log.debug("[select] under safe bandwidth ->",h.id,t)):(this.log.debug("[select] no rep under safe bandwidth, fallback lowest",t),h=l[0],d="auto:no-rep-under-safe-bandwidth")}if(s&&void 0!==c&&c<this.settings.minBufferForUpgrade){const e=n.find((t=>t.id===s));e&&fb(e.bandwidth)&&fb(h.bandwidth)&&h.bandwidth/e.bandwidth>this.settings.hysteresisRatio&&(h=n.filter((t=>t.bandwidth&&t.bandwidth<=e.bandwidth*this.settings.hysteresisRatio)).sort(((t,e)=>t.bandwidth-e.bandwidth)).pop()||e,d="auto:hysteresis-hold",this.log.debug("[select] hysteresis prevents upgrade; hold",h.id,t))}return B(Vx,this,Qx).call(this,h,t,{decisionReason:d,trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:u,bufferSeconds:c}),null===(e=h)||void 0===e?void 0:e.id}onDispose(){z(qx,this).clear(),j(Ux,this,null)}}function Hx(t){var e,n;return(null===(e=t.mime)||void 0===e||null===(n=e.split)||void 0===n||null===(n=n.call(e,"/"))||void 0===n?void 0:n[0])||"unknown"}function Kx(t){return fb(t)?t/1e3:0}function Xx(t){return fb(t)?t/1e3:void 0}function Yx(t,e,n={}){const i=Array.isArray(null==e?void 0:e.representations)?e.representations.map((t=>({id:null==t?void 0:t.id,bandwidthKbps:B(Vx,this,Xx).call(this,null==t?void 0:t.bandwidth)}))):[];return{timeMs:Date.now(),strategy:this.settings.abrStrategy||"auto",decisionReason:n.decisionReason,nodeId:null==e?void 0:e.nodeId,trackId:null==e?void 0:e.trackId,segmentId:null==e?void 0:e.segmentId,trackType:n.trackType,measuredDownloadSpeedKbps:Number.isFinite(n.measuredDownloadSpeedKbps)?n.measuredDownloadSpeedKbps:void 0,safeBandwidthKbps:Number.isFinite(n.safeBandwidthKbps)?n.safeBandwidthKbps:void 0,bufferSeconds:Number.isFinite(n.bufferSeconds)?n.bufferSeconds:void 0,previousRepresentationId:n.previousRepresentationId,selectedRepresentationId:null==t?void 0:t.id,selectedRepresentationBandwidthKbps:B(Vx,this,Xx).call(this,null==t?void 0:t.bandwidth),safetyMargin:Number(this.settings.safetyMargin),minBufferForUpgrade:Number(this.settings.minBufferForUpgrade),minBufferCritical:Number(this.settings.minBufferCritical),hysteresisRatio:Number(this.settings.hysteresisRatio),availableRepresentations:i}}function Qx(t,e,n={}){if(!t)return;const i=B(Vx,this,Yx).call(this,t,e,n);e&&"object"==typeof e&&(e.abrDecision=i),this.log.info("[select] Chosen representation:",t,"context:",e,"decision:",i),this.trigger("abr:selection",{representation:t,context:e,strategy:this.settings.abrStrategy,decision:i});const r=B(Vx,this,Hx).call(this,t);z(qx,this).set(r,t.id)}var Jx=new WeakMap,Zx=new WeakSet;class tw extends fh{constructor(...t){super(...t),$(this,Zx),W(this,Jx,void 0);const[e]=t;if(j(Jx,this,e),!z(Jx,this)||"function"!=typeof z(Jx,this).list)throw new Error("NodePrioritizer requires a NodeRepository instance")}get name(){return"NodePrioritizer"}get defaults(){return{levelMultiplier:1,priorityMultiplier:.3}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"sortNodes"])}onDispose(){j(Jx,this,null)}getPrioritizationSnapshot(t){const e=z(Jx,this).list();if(!e.length)return{orderedIds:[],reachableIds:[]};const{levels:n,weights:i}=B(Zx,this,ew).call(this,e,t);return{orderedIds:B(Zx,this,nw).call(this,e,n,i),reachableIds:Array.from(n.keys())}}sortNodes(t){const{orderedIds:e}=this.getPrioritizationSnapshot(t);return e.length?(this.log.info(`[sortNodes(${t})] Sorted nodes: [${e.join(", ")}]`),e):[]}getReachableNodeIds(t){const{reachableIds:e}=this.getPrioritizationSnapshot(t);return e}}function ew(t,e){const n=new Map;t.forEach((t=>{t&&t.id&&n.set(t.id,t)}));const i=new Map,r=new Map;if(!e||!n.has(e))return{levels:i,weights:r};const o=[{id:e,level:0,priority:1}];for(i.set(e,0),r.set(e,1);o.length;){const{id:t,level:e,priority:s}=o.shift(),a=n.get(t),l=Array.isArray(null==a?void 0:a.children)?a.children:[];for(let t=0;t<l.length;t+=1){const a=l[t],c=(null==a?void 0:a.nodeId)||(null==a?void 0:a.id);if(!c||!n.has(c)||i.has(c))continue;const u=fb(null==a?void 0:a.weight)?a.weight:1,d=Math.max(u,s);i.set(c,e+1),r.set(c,d),o.push({id:c,level:e+1,priority:d})}}return{levels:i,weights:r}}function nw(t,e,n){const i=e.size>0,{levelMultiplier:r,priorityMultiplier:o}=this.settings,s=t.map((t=>{var s;const a=e.has(t.id)?e.get(t.id):i?Number.MAX_SAFE_INTEGER:0,l=Number.isFinite(a)?a:Number.MAX_SAFE_INTEGER,c=null!==(s=n.get(t.id))&&void 0!==s?s:1,u=(Number.isFinite(l)?r*l:Number.MAX_SAFE_INTEGER)+o*c;return{id:t.id,score:u,level:l,priorityWeight:c}}));return s.sort(((t,e)=>t.score!==e.score?t.score-e.score:t.level!==e.level?t.level-e.level:t.priorityWeight!==e.priorityWeight?t.priorityWeight-e.priorityWeight:t.id.localeCompare(e.id))),s.map((t=>t.id))}function iw(t,e){return function(t,e){const n=Array.isArray(t)?t:[];return n.length?e&&n.includes(e)?e:n[0]:e||void 0}(null==t?void 0:t.availableEncodeProfiles,e)}function rw(t,e){const n=t&&"object"==typeof t?{...t}:t;return n&&"object"==typeof n?("string"==typeof e&&e?n.encodeProfile=e:delete n.encodeProfile,n):n}function ow(t){return"string"==typeof t&&t.startsWith("cmaf:")}function sw(t){return"image"===(null==t?void 0:t.assetType)?"image":"ivd"}function aw(t){if(!t||"object"!=typeof t)return t;if(Object.prototype.hasOwnProperty.call(t,"mpd")){const e="string"==typeof t.mpdUrl&&t.mpdUrl||"string"==typeof t.url&&t.url||void 0;return{typeHint:"dash",body:t.mpd,url:e}}return t.ivd||t.url||t.body||t.mimeType||t.typeHint?t:(e=t)&&"object"==typeof e&&Array.isArray(e.representations)?{ivd:t}:t;var e}var lw=new WeakMap,cw=new WeakMap,uw=new WeakSet;class dw extends fh{constructor(...t){super(...t),$(this,uw),W(this,lw,void 0),W(this,cw,void 0);const[,e={}]=t;j(lw,this,"function"==typeof e.fetchFn?e.fetchFn:void 0),j(cw,this,Wb())}get name(){return"AssetsDeliveryService"}get defaults(){return{assetsDeliveryServiceUrl:"https://assets.eko.com",profile:nk("encodeProfile"),maxBatchSize:5,imageQueryParams:{startOffset:0,width:1024}}}async resolveOne(t,e={}){var n;const i=await this.resolve([t],e);if(!i.length)return;const r=i[0],o=null==r?void 0:r.manifest,s=null==r||null===(n=r.manifestRef)||void 0===n?void 0:n.encodeProfile;return o&&"object"==typeof o&&"string"==typeof s&&s?{...o,encodeProfile:s}:o}resolveImageOne(t){if(!B(uw,this,fw).call(this,t))return;const e=iw(t,this.settings.profile),n=function(t,e,n){const i=function(t,e,n){const i=(t||"").replace(/\/$/,""),r=null==n?void 0:n.assetId,o=null==n?void 0:n.assetRevision;if(i&&e&&"string"==typeof r&&"number"==typeof o)return`${i}/${e}/${encodeURIComponent(r)}/${o}`}(t,"image",e);if(!i)return;const r=function(t){if(!t||"object"!=typeof t||Array.isArray(t))return"";const e=new URLSearchParams;return Object.keys(t).forEach((n=>{if("string"!=typeof n||!n)return;const i=t[n];null!=i&&("number"!=typeof i||Number.isFinite(i))&&("string"!=typeof i&&"number"!=typeof i&&"boolean"!=typeof i||e.set(n,String(i)))})),e.toString()}(n);return r?`${i}?${r}`:i}(this.settings.assetsDeliveryServiceUrl||"",t,this.settings.imageQueryParams);if(!n)return;const i={typeHint:"image",url:n};return"string"==typeof e&&e&&(i.encodeProfile=e),i}async resolve(t=[],e={}){const n=(Array.isArray(t)?t:[t]).filter((t=>B(uw,this,fw).call(this,t)));if(!n.length)return[];const i=B(uw,this,hw).call(this,e);if(i&&i.aborted)return[];const r=[],o=this.settings.profile;n.forEach((t=>{if("image"!==sw(t))return;const e=this.resolveImageOne(t);e&&e.url&&r.push({manifestRef:rw(t,e.encodeProfile),manifest:{typeHint:"image",url:e.url}})}));const s=n.filter((t=>"image"!==sw(t))).map((t=>function(t,e){const n=iw(t,e);return{ref:t,profile:n,route:ow(n)?"dash":"ivd"}}(t,o))),a=B(uw,this,mw).call(this,s);for(const{refs:t,route:e}of a){if(i&&i.aborted)return r;const{url:n}=B(uw,this,vw).call(this,t,e),o=await B(uw,this,gw).call(this,n,{method:"GET",signal:i});o&&"object"==typeof o&&t.forEach((({ref:t,profile:e})=>{const n=`${t.assetId}:${t.assetRevision}`,i=o[n]||o[t.assetId]||o[t.assetId||n];i&&r.push({manifestRef:rw(t,e),manifest:aw(i)})}))}return r}onDispose(){z(cw,this)&&z(cw,this).abort(),j(cw,this,null),j(lw,this,null)}}function hw(t){return t&&t.signal?t.signal:z(cw,this)?z(cw,this).signal:void 0}function fw(t){const e="number"==typeof(null==t?void 0:t.assetRevision)&&Number.isFinite(t.assetRevision)&&t.assetRevision>=0;return t&&"assets-delivery-service"===t.type&&"string"==typeof t.assetId&&e}function pw(t,e){const n=Number.isFinite(e)&&e>0?e:t.length,i=[];for(let e=0;e<t.length;e+=n)i.push(t.slice(e,e+n));return i}function mw(t){if(!Array.isArray(t)||!t.length)return[];const e=[];t.forEach((t=>{const n=e[e.length-1];n&&n.route===t.route?n.refs.push(t):e.push({route:t.route,refs:[t]})}));const n=[];return e.forEach((t=>{B(uw,this,pw).call(this,t.refs,this.settings.maxBatchSize).forEach((e=>{n.push({route:t.route,refs:e})}))})),n}function vw(t,e="ivd"){const n=t.map((({ref:t,profile:e})=>function(t,e){const n=`${t.assetId}:${t.assetRevision}`;return e?`${n}:${e}`:n}(t,e))),i=new URLSearchParams({assets:n.join(","),type:"data"});return{url:`${(this.settings.assetsDeliveryServiceUrl||"").replace(/\/$/,"")}/${"dash"===e?"dash":"ivd"}?${i.toString()}`}}async function gw(t,e){return z(lw,this)?z(lw,this).call(this,t,e):await Jb(t,{returnType:"json",method:(null==e?void 0:e.method)||"GET",signal:null==e?void 0:e.signal})}function yw({prioritizer:t,repository:e,startNodeId:n,prioritizedIds:i,pendingIds:r,allowedIds:o,filter:s,fallbackToRepository:a=!0}={}){const l=Array.isArray(i)?i:t&&"function"==typeof t.sortNodes?t.sortNodes(n):[],c=a?(f=e)&&"function"==typeof f.list?f.list().map((t=>null==t?void 0:t.id)).filter(Boolean):[]:[],u=l.length?l:c,d=r?new Set(r):null,h=o?new Set(o):null;var f;return u.filter((t=>{if(!t)return!1;if(d&&d.has(t))return!1;if(h&&!h.has(t))return!1;const n=function(t,e){if(t&&"function"==typeof t.get)return t.get(e)}(e,t);return!(!n||"function"==typeof s&&!s(n,t))}))}const bw=(vh.requestAnimationFrame||vh.mozRequestAnimationFrame||vh.webkitRequestAnimationFrame||vh.msRequestAnimationFrame||(t=>vh.setTimeout(t,1e3/60))).bind(vh),kw=(vh.cancelAnimationFrame||vh.mozCancelAnimationFrame||vh.webkitCancelAnimationFrame||vh.msCancelAnimationFrame||(t=>vh.clearTimeout(t))).bind(vh),xw=sh("ticker","warn");let ww,_w=[],Iw=null,Tw=zb();function Ew(){Tw=zb();const t=[];let e,n;for(n=_w.length-1;n>=0;--n)e=_w[n],Tw>=e.lastTick+e.interval&&t.push(e);for(n=t.length-1;n>=0;--n)if(e=t[n],!e.stopped){e.lastTick=Tw;try{e.callback()}catch(t){console&&"function"==typeof console.error?console.error(t):xw.error(t)}}ww=bw(Ew)}function Sw(){zb()-Tw>=200&&(kw(ww),Ew())}function Mw(t){let e=-1;for(let n=0;n<_w.length;n+=1)if(_w[n].callback===t){e=n;break}return e}function Aw(t,e=0){if(!t||"function"!=typeof t||"number"!=typeof e||e<0)return void xw.error("[start] Invalid arguments given to start method.",arguments);const n=Mw(t);return-1!==n?(xw.debug("[start] Callback already exists, overriding interval.",arguments),_w[n].interval=e,t):(_w.push({callback:t,interval:e,lastTick:zb()}),1===_w.length&&(ww=bw(Ew),Iw||(Iw=vh.setInterval(Sw,1e3))),t)}function Nw(t){const e=Mw(t);-1!==e?(_w[e].stopped=!0,_w.splice(e,1),_w.length||(kw(ww),vh.clearInterval(Iw),Iw=null)):xw.debug("[stop] Callback not found, doing nothing.",arguments)}function Fw(t){return-1!==Mw(t)}function Cw(t,e,n){const i="number"==typeof n?n:(null==n?void 0:n.maxQueueSize)||Number.POSITIVE_INFINITY,r=null!=n&&n.immediatelyFlushFirst?"boolean"==typeof n.immediatelyFlushFirst?n.immediatelyFlushFirst?1:0:Number(n.immediatelyFlushFirst):0;let o=0;if("function"!=typeof t)return void xw.error("[createThrottler] Bad argument given to createThrottler, first argument must be a function.",arguments);xw.debug("[createThrottler] Creating a new throttler instance.",arguments);const s=[];function a(){xw.debug("[onThrottlerTick] Calling callback with "+s.length+" queued items.");const e=s.slice(0);s.length=0,Nw(a),t(e)}const l={push:function(t){xw.debug("[push] Queuing argument:",t),0===s.length&&Aw(a,e),s.push(t),o+=1,(o<=r||s.length>=i)&&a()},flush:function(){xw.debug("[flush] Flushing queue."),0!==s.length&&a()},dispose:function(){xw.debug("[dispose] Disposing of throttler.");const t=s.slice(0);return s.length=0,Nw(a),t}};return Object.defineProperty(l,"interval",{enumerable:!0,get:function(){return e},set:function(t){"number"==typeof t&&(e=t)}}),l}function Ow(t,e){if(t&&"function"==typeof t)return t.__tickerThrottler||(t.__tickerThrottler=Cw((function(){t()}),e)),"number"==typeof e&&(t.__tickerThrottler.interval=e),t.__tickerThrottler.push(),t.__tickerThrottler;xw.error("[scheduleExecution] Bad argument given to scheduleExecution, first argument must be a function.",arguments)}var Pw=new WeakMap,Rw=new WeakMap,Dw=new WeakMap,Bw=new WeakMap,Lw=new WeakMap,zw=new WeakMap,Ww=new WeakMap,jw=new WeakMap,$w=new WeakMap,Uw=new WeakMap,qw=new WeakMap,Vw=new WeakMap,Gw=new WeakMap,Hw=new WeakMap,Kw=new WeakMap,Xw=new WeakMap,Yw=new WeakSet;class Qw extends fh{constructor(...t){super(...t),$(this,Yw),W(this,Pw,void 0),W(this,Rw,void 0),W(this,Dw,void 0),W(this,Bw,void 0),W(this,Lw,[]),W(this,zw,[]),W(this,Ww,new Set),W(this,jw,new Set),W(this,$w,!1),W(this,Uw,void 0),W(this,qw,void 0),W(this,Vw,void 0),W(this,Gw,void 0),W(this,Hw,void 0),W(this,Kw,void 0),W(this,Xw,void 0);const[e,n,i,r]=t;j(Pw,this,e),j(Rw,this,n),j(Dw,this,i),j(Bw,this,r),j(Uw,this,Wb());const o=t.length?t[t.length-1]:void 0,s=o&&"object"==typeof o&&Number.isFinite(o.maxConcurrent)?o.maxConcurrent:void 0;Number.isFinite(s)&&(this.settings.maxConcurrent=s),j(Xw,this,(()=>B(Yw,this,l_).call(this))),B(Yw,this,e_).call(this),B(Yw,this,t_).call(this)}get name(){return"NodeResolver"}get defaults(){return{maxConcurrent:5}}onDispose(){var t;z(Uw,this)&&z(Uw,this).abort(),j(Uw,this,null),z(Bw,this)&&"function"==typeof z(Bw,this).off&&z(Vw,this)&&z(Bw,this).off(yh.PLACEMENT_ADDED,z(Vw,this)),z(Bw,this)&&"function"==typeof z(Bw,this).off&&z(Kw,this)&&z(Bw,this).off(yh.TIMELINE_RESET,z(Kw,this)),z(Pw,this)&&"function"==typeof z(Pw,this).off&&z(Gw,this)&&z(Pw,this).off(yh.NODE_ADD,z(Gw,this)),z(Pw,this)&&"function"==typeof z(Pw,this).off&&z(Hw,this)&&z(Pw,this).off(yh.NODE_CHILDREN_CHANGED,z(Hw,this)),j(Vw,this,null),j(Gw,this,null),j(Hw,this,null),j(Kw,this,null),j(Lw,this,[]),j(zw,this,[]),z(Ww,this).clear(),z(jw,this).clear(),j($w,this,!1),j(qw,this,void 0),null!==(t=z(Xw,this))&&void 0!==t&&t.__tickerThrottler&&z(Xw,this).__tickerThrottler.dispose(),j(Xw,this,null)}}function Jw(){return z(Uw,this)?z(Uw,this).signal:void 0}function Zw(){return this._disposed||z(Uw,this)&&z(Uw,this).signal.aborted}function t_(){z(Bw,this)&&"function"==typeof z(Bw,this).on&&(j(Vw,this,(t=>{B(Yw,this,i_).call(this,null==t?void 0:t.nodeId)})),z(Bw,this).on(yh.PLACEMENT_ADDED,z(Vw,this)),j(Kw,this,(()=>B(Yw,this,n_).call(this))),z(Bw,this).on(yh.TIMELINE_RESET,z(Kw,this))),z(Pw,this)&&"function"==typeof z(Pw,this).on&&(j(Gw,this,(({node:t})=>{(null==t?void 0:t.id)&&B(Yw,this,i_).call(this,t.id,{fromRepoAdd:!0})})),z(Pw,this).on(yh.NODE_ADD,z(Gw,this)),j(Hw,this,(()=>{Ow(z(Xw,this),100)})),z(Pw,this).on(yh.NODE_CHILDREN_CHANGED,z(Hw,this)))}function e_(){const t=z(Bw,this)&&Array.isArray(z(Bw,this).placements)?z(Bw,this).placements:[];t.forEach((t=>B(Yw,this,i_).call(this,t.nodeId)));const e=t.length?t[t.length-1]:void 0;e&&e.nodeId&&j(qw,this,e.nodeId)}function n_(){z(Uw,this)&&z(Uw,this).abort(),j(Uw,this,Wb()),j(Lw,this,[]),j(zw,this,[]),z(Ww,this).clear(),j($w,this,!1),j(qw,this,void 0)}function i_(t,{fromRepoAdd:e=!1}={}){B(Yw,this,Zw).call(this)||t&&(z(jw,this).has(t)||z(Ww,this).has(t)||(z(Lw,this).push(t),z(qw,this)||e||j(qw,this,t),!z($w,this)&&e||B(Yw,this,r_).call(this)))}function r_(){if(z($w,this))return void B(Yw,this,o_).call(this);if(0===z(Lw,this).length)return;j($w,this,!0);const t=z(Lw,this).shift();B(Yw,this,c_).call(this,t).finally((()=>{B(Yw,this,o_).call(this)}))}async function o_(){if(!B(Yw,this,Zw).call(this))for(z(Lw,this).length||z(zw,this).length||j(zw,this,B(Yw,this,s_).call(this));z(Ww,this).size<this.settings.maxConcurrent;){const t=this.settings.maxConcurrent-z(Ww,this).size;if(t<=0)break;const e=[];for(;e.length<t&&(z(Lw,this).length||z(zw,this).length);){let t=z(Lw,this).shift();t||(t=z(zw,this).shift()),t&&e.push(t)}if(!e.length)break;const n=B(Yw,this,u_).call(this,e);n.length&&z(Dw,this)&&"function"==typeof z(Dw,this).resolve&&B(Yw,this,d_).call(this,n).finally((()=>B(Yw,this,o_).call(this))),e.filter((t=>!n.find((e=>e.nodeId===t)))).forEach((t=>{B(Yw,this,c_).call(this,t).finally((()=>B(Yw,this,o_).call(this)))}))}}function s_(){const t=new Set([...z(jw,this),...z(Ww,this),...z(Lw,this)]);return B(Yw,this,a_).call(this,t)}function a_(t){const e=z(Bw,this)&&Array.isArray(z(Bw,this).placements)?z(Bw,this).placements:[],n=(e.length?e[e.length-1].nodeId:void 0)||z(qw,this);return yw({prioritizer:z(Rw,this),repository:z(Pw,this),startNodeId:n,pendingIds:t,fallbackToRepository:!1})}function l_(){B(Yw,this,Zw).call(this)||(z($w,this)||0!==z(Lw,this).length)&&(j(zw,this,B(Yw,this,s_).call(this)),z($w,this)&&B(Yw,this,o_).call(this))}async function c_(t,e){if(!t||z(jw,this).has(t)||z(Ww,this).has(t))return;const n=B(Yw,this,Jw).call(this);if(n&&n.aborted)return;const i=z(Pw,this)&&"function"==typeof z(Pw,this).get?z(Pw,this).get(t):void 0;if(i&&"function"==typeof i.resolve)if("function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts())z(jw,this).add(t);else{z(Ww,this).add(t);try{const r={signal:n};e&&(r.manifestOverride=e),await i.resolve(r),z(jw,this).add(t)}catch(e){if($b(e,n))return;this.log.warn(`NodeResolver failed to resolve node ${t}: ${(null==e?void 0:e.message)||e}`),"function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts()&&z(jw,this).add(t)}finally{z(Ww,this).delete(t)}}}function u_(t){const e=[];return t.forEach((t=>{const n=z(Pw,this)&&"function"==typeof z(Pw,this).get?z(Pw,this).get(t):void 0;n&&n.manifestRef&&"assets-delivery-service"===n.manifestRef.type&&e.push({nodeId:t,ref:n.manifestRef})})),e}async function d_(t){const e=B(Yw,this,Jw).call(this);if(!e||!e.aborted){t.forEach((({nodeId:t})=>z(Ww,this).add(t)));try{const n=t.map((t=>t.ref)),i=await z(Dw,this).resolve(n,{signal:e});t.forEach((({nodeId:t,ref:e})=>{var n;const r=z(Pw,this)&&"function"==typeof z(Pw,this).get?z(Pw,this).get(t):void 0;if(z(Ww,this).delete(t),!r||"function"!=typeof r.resolve)return;const o=Array.isArray(i)?i.find((t=>{const n=null==t?void 0:t.manifestRef;return n&&n.assetId===e.assetId&&n.assetRevision===e.assetRevision})):void 0,s="string"==typeof(null==o||null===(n=o.manifestRef)||void 0===n?void 0:n.encodeProfile)&&o.manifestRef.encodeProfile?o.manifestRef.encodeProfile:void 0,a=o?B(Yw,this,h_).call(this,o.manifest,s):void 0;B(Yw,this,c_).call(this,t,a)}))}catch(n){$b(n,e)||this.log.warn(`NodeResolver ADS batch failed: ${(null==n?void 0:n.message)||n}`),t.forEach((({nodeId:t})=>z(Ww,this).delete(t)))}}}function h_(t,e){if(!t)return;const n="string"==typeof e&&e?e:void 0,i=t=>n&&t&&"object"==typeof t?{...t,encodeProfile:n}:t;return t.ivd?i({typeHint:"ivd",body:t.ivd}):t.url||t.body||t.mimeType?i({typeHint:t.typeHint,url:t.url,mimeType:t.mimeType,body:t.body}):i(t)}const f_=.001,p_="priority";function m_(t){const e=Number(t);return Number.isFinite(e)?e:0}var v_=new WeakMap,g_=new WeakMap,y_=new WeakMap,b_=new WeakMap,k_=new WeakMap,x_=new WeakMap,w_=new WeakMap,__=new WeakMap,I_=new WeakMap,T_=new WeakMap,E_=new WeakMap,S_=new WeakMap,M_=new WeakMap,A_=new WeakMap,N_=new WeakMap,F_=new WeakMap,C_=new WeakMap,O_=new WeakMap,P_=new WeakMap,R_=new WeakMap,D_=new WeakSet;class B_ extends fh{constructor(...t){super(...t),$(this,D_),W(this,v_,void 0),W(this,g_,void 0),W(this,y_,void 0),W(this,b_,new Map),W(this,k_,new Map),W(this,x_,[]),W(this,w_,new Set),W(this,__,new Map),W(this,I_,!1),W(this,T_,void 0),W(this,E_,void 0),W(this,S_,void 0),W(this,M_,void 0),W(this,A_,void 0),W(this,N_,void 0),W(this,F_,void 0),W(this,C_,void 0),W(this,O_,!1),W(this,P_,[]),W(this,R_,void 0);const[e,n,i]=t;j(v_,this,e),j(g_,this,n),j(y_,this,i),j(E_,this,Wb()),j(R_,this,(()=>B(D_,this,bI).call(this))),B(D_,this,J_).call(this)}get name(){return"SegmentLoadCoordinator"}get defaults(){return{maxConcurrentLoads:3,maxSegmentLoadAttempts:3}}onDispose(){var t;z(E_,this)&&z(E_,this).abort(),j(E_,this,null),z(__,this).size&&z(__,this).forEach((t=>{(null==t?void 0:t.controller)&&t.controller.abort()})),z(__,this).clear(),z(y_,this)&&"function"==typeof z(y_,this).off&&(z(S_,this)&&z(y_,this).off(yh.PLACEMENT_ADDED,z(S_,this)),z(A_,this)&&z(y_,this).off(yh.TIMELINE_SEEKING,z(A_,this)),z(N_,this)&&z(y_,this).off(yh.TIMELINE_SEEKED,z(N_,this)),z(F_,this)&&z(y_,this).off(yh.TIMELINE_RESET,z(F_,this))),z(v_,this)&&"function"==typeof z(v_,this).off&&z(M_,this)&&z(v_,this).off(yh.NODE_CHILDREN_CHANGED,z(M_,this)),z(C_,this)&&"function"==typeof vh.removeEventListener&&vh.removeEventListener("online",z(C_,this)),j(S_,this,null),j(M_,this,null),j(A_,this,null),j(N_,this,null),j(F_,this,null),j(C_,this,null),z(b_,this).clear(),z(k_,this).clear(),j(x_,this,[]),z(w_,this).clear(),z(__,this).clear(),j(I_,this,!1),j(T_,this,void 0),j(O_,this,!1),j(P_,this,[]),null!==(t=z(R_,this))&&void 0!==t&&t.__tickerThrottler&&z(R_,this).__tickerThrottler.dispose(),j(R_,this,null)}}function L_(){return z(E_,this)?z(E_,this).signal:void 0}function z_(){return this._disposed||z(E_,this)&&z(E_,this).signal.aborted}function W_(){const t=Number(this.settings.maxSegmentLoadAttempts);return Number.isFinite(t)&&t>0?t:1/0}function j_(t){const e=B(D_,this,W_).call(this);if(!Number.isFinite(e)||e===1/0)return!1;if(null==t||!t.loadError)return!1;const n=Number(t.loadAttempts);return Number.isFinite(n)&&n>=e}function $_(t){return!!t&&(!!B(D_,this,j_).call(this,t)||B(D_,this,U_).call(this,t))}function U_(t){if(!t)return!1;if("boolean"==typeof t.isLoaded)return t.isLoaded;const e=Number(t.retainedByteLength);return Number.isFinite(e)&&e>0}function q_(t){if(!t||B(D_,this,U_).call(this,t))return;const e=Number(t.loadAttempts);(Number.isFinite(e)&&e>0||t.loadError)&&("function"==typeof t.evict&&t.evict(),t.loadAttempts=0,t.loadError=void 0)}function V_(t){t&&(t.manifestLoadError&&(t.manifestLoadAttempts=0,t.manifestLoadError=void 0,"failed"===t.state&&(t.state="pending",t.error=void 0)),(Array.isArray(t.tracks)?t.tracks:[]).forEach((t=>{(Array.isArray(null==t?void 0:t.segments)?t.segments:[]).forEach((t=>{B(D_,this,q_).call(this,t)}))})))}function G_(){(z(v_,this)&&"function"==typeof z(v_,this).list?z(v_,this).list():[]).forEach((t=>{B(D_,this,V_).call(this,t)}))}function H_(t,{allowSeekKeep:e=!1,segmentOffset:n}={}){const i=Wb(),r=i?i.signal:B(D_,this,L_).call(this);return t&&z(__,this).set(t,{controller:i,allowSeekKeep:!!e,segmentOffset:n}),{signal:r,controller:i}}function K_(t,e,n={}){const i=z(__,this).get(t);i&&i.controller===e&&(Object.prototype.hasOwnProperty.call(n,"allowSeekKeep")&&(i.allowSeekKeep=!!n.allowSeekKeep),Object.prototype.hasOwnProperty.call(n,"segmentOffset")&&(i.segmentOffset=n.segmentOffset))}function X_(t,e){const n=z(__,this).get(t);n&&(e&&n.controller!==e||z(__,this).delete(t))}function Y_(t,e){const n=new Set;return(Array.isArray(t)?t:[]).forEach((t=>{const i=null==t?void 0:t.nodeId;if(!i)return;const r=z(v_,this)&&"function"==typeof z(v_,this).get?z(v_,this).get(i):void 0;if(!r)return;const o=B(D_,this,cI).call(this,r,t,e);Number.isFinite(o)&&n.add(`${i}:${o}`)})),n}function Q_(t){z(__,this).size&&z(__,this).forEach(((e,n)=>{const i=null==e?void 0:e.segmentOffset,r=Number.isFinite(i)?`${n}:${i}`:"";!(null!=e&&e.allowSeekKeep&&r&&t&&t.has(r))&&(null==e?void 0:e.controller)&&e.controller.abort()}))}function J_(){z(y_,this)&&"function"==typeof z(y_,this).on&&(j(S_,this,(t=>{B(D_,this,rI).call(this,t)})),z(y_,this).on(yh.PLACEMENT_ADDED,z(S_,this)),j(A_,this,(t=>B(D_,this,Z_).call(this,t))),z(y_,this).on(yh.TIMELINE_SEEKING,z(A_,this)),j(N_,this,(t=>B(D_,this,tI).call(this,t))),z(y_,this).on(yh.TIMELINE_SEEKED,z(N_,this)),j(F_,this,(()=>B(D_,this,iI).call(this))),z(y_,this).on(yh.TIMELINE_RESET,z(F_,this))),z(v_,this)&&"function"==typeof z(v_,this).on&&(j(M_,this,(()=>{Ow(z(R_,this),100)})),z(v_,this).on(yh.NODE_CHILDREN_CHANGED,z(M_,this))),"function"==typeof vh.addEventListener&&(j(C_,this,(()=>B(D_,this,nI).call(this))),vh.addEventListener("online",z(C_,this)))}function Z_(t={}){if(B(D_,this,z_).call(this))return;const e=Number(null==t?void 0:t.targetTime);if(!Number.isFinite(e))return;const n=Array.isArray(null==t?void 0:t.placements)?t.placements:[],i=B(D_,this,Y_).call(this,n,e);B(D_,this,Q_).call(this,i),j(O_,this,!0),j(P_,this,n.map((t=>{const n=null==t?void 0:t.nodeId;if(n)return{nodeId:n,placement:t,targetTime:e}})).filter(Boolean)),setTimeout((()=>B(D_,this,sI).call(this)),0)}function tI(t={}){var e;if(B(D_,this,z_).call(this))return;j(O_,this,!1),j(P_,this,[]);const n=Number.isFinite(null==t?void 0:t.targetTime)?Number(t.targetTime):Number(null===(e=z(y_,this))||void 0===e?void 0:e.currentTime);B(D_,this,eI).call(this,n),setTimeout((()=>B(D_,this,sI).call(this)),0)}function eI(t){var e;(Array.isArray(null===(e=z(y_,this))||void 0===e?void 0:e.placements)?z(y_,this).placements:[]).forEach((e=>{if(!e)return;const n=Tv(e);if(Number.isFinite(n)){if(Number.isFinite(t)){if(n>=t)return void B(D_,this,rI).call(this,e);const i=_v(e,z(v_,this));return Number.isFinite(i)?void(n+i>t&&B(D_,this,rI).call(this,e)):void(n<=t&&B(D_,this,rI).call(this,e))}B(D_,this,rI).call(this,e)}}))}function nI(){var t;B(D_,this,z_).call(this)||(B(D_,this,G_).call(this),j(O_,this,!1),j(P_,this,[]),B(D_,this,eI).call(this,Number(null===(t=z(y_,this))||void 0===t?void 0:t.currentTime)),j(x_,this,B(D_,this,gI).call(this)),setTimeout((()=>B(D_,this,sI).call(this)),0))}function iI(){z(E_,this)&&z(E_,this).abort(),j(E_,this,Wb()),z(__,this).size&&z(__,this).forEach((t=>{(null==t?void 0:t.controller)&&t.controller.abort()})),z(__,this).clear(),z(b_,this).clear(),z(k_,this).clear(),j(x_,this,[]),z(w_,this).clear(),j(I_,this,!1),j(T_,this,void 0),j(O_,this,!1),j(P_,this,[])}function rI(t){if(B(D_,this,z_).call(this))return;const e=null==t?void 0:t.nodeId;if(!e)return;const n=z(b_,this).get(e);if(n){const i=Tv(n),r=Tv(t);Number.isFinite(i)?Number.isFinite(r)&&r<i&&z(b_,this).set(e,t):Number.isFinite(r)&&z(b_,this).set(e,t)}else z(b_,this).set(e,t);const i=z(T_,this);j(T_,this,e),i&&i!==e&&j(x_,this,[]),z(I_,this)?setTimeout((()=>B(D_,this,sI).call(this)),0):B(D_,this,oI).call(this)}function oI(){z(I_,this)||z(b_,this).size&&(j(I_,this,!0),B(D_,this,sI).call(this))}async function sI(){if(B(D_,this,z_).call(this))return;if(z(w_,this).size>=this.settings.maxConcurrentLoads)return;if(z(O_,this))return void(z(P_,this).length&&B(D_,this,aI).call(this));const t=B(D_,this,hI).call(this);if(t.hasPending)B(D_,this,fI).call(this,t);else for(z(x_,this).length||j(x_,this,B(D_,this,gI).call(this));z(w_,this).size<this.settings.maxConcurrentLoads&&z(x_,this).length;){const t=z(x_,this).shift();B(D_,this,kI).call(this,t,"partial").finally((()=>{setTimeout((()=>B(D_,this,sI).call(this)),0)}))}}function aI(){if(B(D_,this,z_).call(this))return;const t=Math.max(0,this.settings.maxConcurrentLoads-z(w_,this).size);if(!t||!z(P_,this).length)return;const e=[],n=[];for(let i=0;i<z(P_,this).length;i+=1){const r=z(P_,this)[i];(null==r?void 0:r.nodeId)&&(e.length<t&&!z(w_,this).has(r.nodeId)?e.push(r):n.push(r))}j(P_,this,n),e.forEach((t=>{B(D_,this,lI).call(this,t).finally((()=>{setTimeout((()=>B(D_,this,sI).call(this)),0)}))}))}async function lI(t={}){const e=null==t?void 0:t.nodeId,n=null==t?void 0:t.placement,i=Number(null==t?void 0:t.targetTime);if(!e||!n||!Number.isFinite(i))return;if(z(w_,this).has(e))return;const{signal:r,controller:o}=B(D_,this,H_).call(this,e);if(r&&r.aborted)B(D_,this,X_).call(this,e,o);else{z(w_,this).add(e);try{const t=z(v_,this)&&"function"==typeof z(v_,this).get?z(v_,this).get(e):void 0;if(!t)return;if("ready"!==t.state&&"function"==typeof t.resolve)try{await t.resolve({signal:r})}catch(t){return}if("ready"!==t.state)return;const s=B(D_,this,cI).call(this,t,n,i);if(!Number.isFinite(s)){const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks.map((t=>null==t?void 0:t.type)).filter(Boolean):[];return void this.log.debug(`[#loadSeekWork] No seek segment offset for node [${e}] targetTime=${i} mainTrackId=${(null==t?void 0:t.mainTrackId)||"n/a"} trackTypes=[${n.join(",")}]`)}"function"==typeof t.loadMediaSegmentsAtOffset?(this.log.debug(`[#loadSeekWork] Loading seek segment for node [${e}] at offset=${s}`),B(D_,this,K_).call(this,e,o,{allowSeekKeep:!0,segmentOffset:s}),await t.loadMediaSegmentsAtOffset(s,{signal:r})):"function"==typeof t.load&&await t.load({loadingMode:"partial",signal:r})}catch(t){$b(t,r)||this.log.warn(`[#loadSeekWork] SegmentLoadCoordinator failed to seek-load node ${e}: ${(null==t?void 0:t.message)||t}`)}finally{z(w_,this).delete(e),B(D_,this,X_).call(this,e,o)}}}function cI(t,e,n){var i;const r=Tv(e);if(!Number.isFinite(r))return;const o=m_(null==e?void 0:e.nodeOffsetOverride),s=Math.max(0,n-r+o),a=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];let l;if(null!=t&&t.mainTrackId){const e=a.find((e=>(null==e?void 0:e.id)===t.mainTrackId));"video"!==(null==e?void 0:e.type)&&"image"!==(null==e?void 0:e.type)||(l=e)}if(l||(l=a.find((t=>"video"===(null==t?void 0:t.type)))||a.find((t=>"image"===(null==t?void 0:t.type)))),!l||!Array.isArray(l.segments))return;const c=l.segments.filter((t=>t&&!t.isInit&&Array.isArray(t.representations)));if(!c.length)return;const u=m_(null===(i=l)||void 0===i?void 0:i.offset),d=Sk(c,Math.max(0,s-u),{preferRepresentationTime:!0}),h=Number(null==d?void 0:d.offset);return Number.isFinite(h)?h:void 0}function uI(t,e,n=(t=>null===(t=z(y_,this))||void 0===t?void 0:t.currentTime)()){var i;const r=(Array.isArray(null===(i=z(y_,this))||void 0===i?void 0:i.placements)?z(y_,this).placements:[]).filter((e=>(null==e?void 0:e.nodeId)===t&&Number.isFinite(Tv(e)))).sort(((t,e)=>Tv(t)-Tv(e)));if(!r.length)return e;const o=Number(n);if(!Number.isFinite(o))return e||r[0];let s,a;for(let t=0;t<r.length;t+=1){const e=r[t],n=Tv(e);if(!Number.isFinite(n))continue;const i=_v(e,z(v_,this)),l=Number.isFinite(i)&&i>=0;(!a&&n>=o-f_&&(a=e),l)?o+f_>=n&&o<n+i-f_&&(s=e):o+f_>=n&&(s=e)}return s||a||r[r.length-1]}function dI(t,e){var n;const i=Number(Tv(e));if(!Number.isFinite(i))return;const r=_v(e,z(v_,this)),o=Number.isFinite(r)&&r>=0?i+r:void 0,s=(Array.isArray(null===(n=z(y_,this))||void 0===n?void 0:n.placements)?z(y_,this).placements:[]).filter((e=>(null==e?void 0:e.nodeId)===t&&Number.isFinite(Tv(e)))).sort(((t,e)=>Tv(t)-Tv(e)));for(let t=0;t<s.length;t+=1){const e=s[t],n=Number(Tv(e));if(Number.isFinite(n)&&!(n<=i+f_)){if(Number.isFinite(o)&&n>o+f_)return;return e}}}function hI(){const t=[];let e=!1,n=1/0;if(z(b_,this).forEach(((i,r)=>{if(!r||!i)return;const o=z(k_,this).get(r);if(o)return e=!0,void(n=Math.min(n,m_(o.timelineStart)));const s=B(D_,this,pI).call(this,r,i);s&&(e=!0,n=Math.min(n,m_(s.timelineStart)),t.push(s))})),!e||!Number.isFinite(n))return{hasPending:!1,waveTime:void 0,startable:[]};const i=t.filter((t=>m_(t.timelineStart)===n&&!z(w_,this).has(t.nodeId))).sort(((t,e)=>{const n=Number.isFinite(null==t?void 0:t.timelineStart)?t.timelineStart:Number.POSITIVE_INFINITY,i=Number.isFinite(null==e?void 0:e.timelineStart)?e.timelineStart:Number.POSITIVE_INFINITY;return n!==i?n-i:String(t.nodeId).localeCompare(String(e.nodeId))}));return{hasPending:!0,waveTime:n,startable:i}}function fI({waveTime:t,startable:e}){const n=Math.max(0,this.settings.maxConcurrentLoads-z(w_,this).size);n&&e.length&&e.slice(0,n).forEach((e=>{B(D_,this,vI).call(this,e,t).finally((()=>{setTimeout((()=>B(D_,this,sI).call(this)),0)}))}))}function pI(t,e){var n,i;const r=z(v_,this)&&"function"==typeof z(v_,this).get?z(v_,this).get(t):void 0;if(!r)return;if("function"==typeof r.hasExceededManifestLoadAttempts&&r.hasExceededManifestLoadAttempts())return void z(b_,this).delete(t);const o=B(D_,this,uI).call(this,t,e,null===(n=z(y_,this))||void 0===n?void 0:n.currentTime),s=Number(Tv(o)),a=m_(null===(i=z(y_,this))||void 0===i?void 0:i.currentTime),l="function"==typeof r.loadMediaSegmentsAtOffset,c="function"==typeof r.load;if(!l&&!c)return void z(b_,this).delete(t);if(r.isLoaded)return void z(b_,this).delete(t);if("ready"!==r.state){if(!Number.isFinite(s))return;return{nodeId:t,segmentOffset:0,timelineStart:s}}if(!B(D_,this,xI).call(this,r))return void z(b_,this).delete(t);const u=Array.isArray(r.tracks)?r.tracks:[],d=u.some((t=>{const e=(Array.isArray(null==t?void 0:t.segments)?t.segments:[]).find((t=>(null==t?void 0:t.isInit)&&Array.isArray(null==t?void 0:t.representations)));return!!e&&!B(D_,this,$_).call(this,e)})),h=new Set;u.forEach((t=>{(Array.isArray(null==t?void 0:t.segments)?t.segments:[]).forEach((t=>{if(!t||t.isInit||!Array.isArray(t.representations))return;const e=Number(t.offset);if(Number.isFinite(e)){const t=Math.round(e/f_)*f_;h.add(t)}}))}));const f=Array.from(h).sort(((t,e)=>t-e)),p=e=>{const n=Number(Tv(e));if(!Number.isFinite(n))return{status:"none"};const i=m_(null==e?void 0:e.nodeOffsetOverride),o=Math.max(0,a-n+i);let s=0;for(let t=0;t<f.length&&f[t]<=o+f_;t+=1)s=t;const l=f.slice(s);if(!l.some((t=>B(D_,this,mI).call(this,r,t))))return{status:f.slice(0,s).some((t=>B(D_,this,mI).call(this,r,t)))?"beforeOnly":"none"};const c=l.find((t=>B(D_,this,mI).call(this,r,t))),u=Math.max(0,m_(c)-i);return{status:"work",work:{nodeId:t,segmentOffset:c,timelineStart:n+u}}},m=p(o);if("work"===m.status)return m.work;if("beforeOnly"!==m.status){if(d&&Number.isFinite(s))return{nodeId:t,segmentOffset:0,timelineStart:s};z(b_,this).delete(t)}else{const e=B(D_,this,dI).call(this,t,o);if(e){const t=p(e);if("work"===t.status)return t.work}}}function mI(t,e){const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[],i=m_(e);return n.some((t=>(Array.isArray(null==t?void 0:t.segments)?t.segments:[]).some((t=>{if(!t||t.isInit||!Array.isArray(t.representations))return!1;const e=Number(t.offset);return Number.isFinite(e)&&Math.abs(e-i)<=f_&&!B(D_,this,$_).call(this,t)}))))}async function vI(t,e){const n=null==t?void 0:t.nodeId,i=null==t?void 0:t.segmentOffset;if(this.log.debug(`[#loadP0Work] Loading ${p_} node [${n}] at segmentOffset=${i} wave=${e}`),!n)return;const r=z(v_,this)&&"function"==typeof z(v_,this).get?z(v_,this).get(n):void 0;if(!r)return void z(b_,this).delete(n);const o="function"==typeof r.loadMediaSegmentsAtOffset&&Number.isFinite(i),{signal:s,controller:a}=B(D_,this,H_).call(this,n,{allowSeekKeep:o,segmentOffset:i});if(s&&s.aborted)B(D_,this,X_).call(this,n,a);else{z(w_,this).add(n),z(k_,this).set(n,{timelineStart:e,segmentOffset:i});try{"function"==typeof r.loadMediaSegmentsAtOffset?await r.loadMediaSegmentsAtOffset(i,{signal:s}):"function"==typeof r.load&&await r.load({loadingMode:"full",signal:s})}catch(t){if($b(t,s))return;const e=`[#loadP0Work] SegmentLoadCoordinator failed to load ${p_} work for node ${n}: ${(null==t?void 0:t.message)||t}`;this.log.warn(e)}finally{this.log.debug(`[#loadP0Work] Finished ${p_} work for node [${n}]`),z(k_,this).delete(n),z(w_,this).delete(n),B(D_,this,X_).call(this,n,a)}}}function gI(){const t=new Set([...z(b_,this).keys(),...z(w_,this)]),e=B(D_,this,yI).call(this),n=Array.isArray(null==e?void 0:e.orderedIds)?e.orderedIds:null,i=Array.isArray(null==e?void 0:e.reachableIds)&&e.reachableIds.length?new Set(e.reachableIds):null,r=t=>!("function"==typeof t.hasExceededManifestLoadAttempts&&t.hasExceededManifestLoadAttempts()||t.isLoaded||"ready"===t.state&&B(D_,this,wI).call(this,t));if(i){const e=yw({prioritizer:z(g_,this),repository:z(v_,this),startNodeId:z(T_,this),prioritizedIds:n,pendingIds:t,allowedIds:i,filter:r});if(e.length)return e}return yw({prioritizer:z(g_,this),repository:z(v_,this),startNodeId:z(T_,this),prioritizedIds:n,pendingIds:t,filter:r})}function yI(){return z(g_,this)&&z(T_,this)?"function"==typeof z(g_,this).getPrioritizationSnapshot?z(g_,this).getPrioritizationSnapshot(z(T_,this)):{orderedIds:"function"==typeof z(g_,this).sortNodes?z(g_,this).sortNodes(z(T_,this)):[],reachableIds:"function"==typeof z(g_,this).getReachableNodeIds?z(g_,this).getReachableNodeIds(z(T_,this)):[]}:null}function bI(){B(D_,this,z_).call(this)||(z(I_,this)||z(b_,this).size)&&(j(x_,this,B(D_,this,gI).call(this)),z(I_,this)&&!z(O_,this)&&B(D_,this,sI).call(this))}async function kI(t,e){if(this.log.debug(`[#loadNode] Loading node [${t}] in '${e}' mode`),!t)return;const n=z(v_,this)&&"function"==typeof z(v_,this).get?z(v_,this).get(t):void 0;if(!n||"function"!=typeof n.load)return;if("function"==typeof n.hasExceededManifestLoadAttempts&&n.hasExceededManifestLoadAttempts())return;if(n.isLoaded)return void this.log.debug(`[#loadNode] Skipping load for ${t}: already loaded`);const{signal:i,controller:r}=B(D_,this,H_).call(this,t,{allowSeekKeep:!1});if(i&&i.aborted)B(D_,this,X_).call(this,t,r);else try{if("ready"!==n.state&&await n.resolve({signal:i}),"ready"!==n.state)return void this.log.debug(`[#loadNode] Skipping load for ${t}: not ready`);if("partial"===e&&B(D_,this,wI).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${t}: partial already loaded`);if(!B(D_,this,xI).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${t}: no loadable tracks`);z(w_,this).add(t),await n.load({loadingMode:e,signal:i})}catch(e){if($b(e,i))return;this.log.warn(`[#loadNode] SegmentLoadCoordinator failed to load node ${t}: ${(null==e?void 0:e.message)||e}`)}finally{this.log.debug(`[#loadNode] Finished loading node [${t}]`),z(w_,this).delete(t),B(D_,this,X_).call(this,t,r)}}function xI(t){return(Array.isArray(t.tracks)?t.tracks:[]).some((t=>{var e;return null==t||null===(e=t.segments)||void 0===e?void 0:e.length}))}function wI(t){const e=(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).filter((t=>Array.isArray(null==t?void 0:t.segments)&&t.segments.length));return!e.length||e.every((t=>{const e=Array.isArray(null==t?void 0:t.segments)?t.segments:[];if(!e.length)return!0;const n=e.find((t=>null==t?void 0:t.isInit)),i=e.find((t=>t&&!t.isInit));return!(n&&!B(D_,this,$_).call(this,n)||i&&!B(D_,this,$_).call(this,i))}))}class _I extends fh{constructor(...t){super(...t),this.track=void 0,this.lastSegment=void 0}get name(){return"BaseDecoder"}configure(t){this.track=t}decode(t){this.lastSegment=t}decodeChunk(t,e){}onDispose(){this.track=void 0,this.lastSegment=void 0}}function II(t){if(!t)throw new Error("Assertion failed.")}const TI=t=>t&&t[t.length-1],EI=t=>{let e=0;for(;0===t.readBits(1)&&e<32;)e++;if(e>=32)throw new Error("Invalid exponential-Golomb code.");return(1<<e)-1+t.readBits(e)},SI=t=>t.constructor===Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t),MI=t=>t.constructor===DataView?t:ArrayBuffer.isView(t)?new DataView(t.buffer,t.byteOffset,t.byteLength):new DataView(t),AI=new TextDecoder,NI=t=>Object.fromEntries(Object.entries(t).map((([t,e])=>[e,t]))),FI={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},CI=NI(FI),OI={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},PI=NI(OI),RI={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},DI=NI(RI),BI=t=>[...t].map((t=>t.toString(16).padStart(2,"0"))).join(""),LI=t=>(t=(t=(t=(t=(t=t>>1&1431655765|(1431655765&t)<<1)>>2&858993459|(858993459&t)<<2)>>4&252645135|(252645135&t)<<4)>>8&16711935|(16711935&t)<<8)>>16&65535|(65535&t)<<16)>>>0,zI=(t,e,n)=>{let i=0,r=t.length-1,o=-1;for(;i<=r;){const s=i+r>>1,a=n(t[s]);a===e?(o=s,r=s-1):a<e?i=s+1:r=s-1}return o},WI=(t,e,n)=>{let i=0,r=t.length-1,o=-1;for(;i<=r;){const s=i+(r-i+1)/2|0;n(t[s])<=e?(o=s,i=s+1):r=s-1}return o},jI=()=>{let t,e;return{promise:new Promise(((n,i)=>{t=n,e=i})),resolve:t,reject:e}},$I=(t,e,n)=>t.getUint8(e)<<16|t.getUint8(e+1)<<8|t.getUint8(e+2),UI=(t,e,n)=>Math.max(e,Math.min(n,t)),qI=/^[a-z]{3}$/,VI=1e6*(1+Number.EPSILON);let GI=null;let HI=null;const KI=()=>{if(null!==HI)return HI;if("undefined"==typeof navigator)return null;const t=/\bChrome\/(\d+)/.exec(navigator.userAgent);return t?HI=Number(t[1]):null},XI=t=>"number"==typeof t&&!Number.isNaN(t);class YI{constructor(t,e){if(this.data=t,this.mimeType=e,!(t instanceof Uint8Array))throw new TypeError("data must be a Uint8Array.");if("string"!=typeof e)throw new TypeError("mimeType must be a string.")}}const QI={default:!0,forced:!1,original:!1,commentary:!1,hearingImpaired:!1,visuallyImpaired:!1};class JI{constructor(t){this.bytes=t,this.pos=0}seekToByte(t){this.pos=8*t}readBit(){var t;const e=Math.floor(this.pos/8),n=null!==(t=this.bytes[e])&&void 0!==t?t:0,i=7-(7&this.pos),r=(n&1<<i)>>i;return this.pos++,r}readBits(t){if(1===t)return this.readBit();let e=0;for(let n=0;n<t;n++)e<<=1,e|=this.readBit();return e}writeBits(t,e){const n=this.pos+t;for(let t=this.pos;t<n;t++){const i=Math.floor(t/8);let r=this.bytes[i];const o=7-(7&t);r&=~(1<<o),r|=(e&1<<n-t-1)>>n-t-1<<o,this.bytes[i]=r}this.pos=n}readAlignedByte(){var t;if(this.pos%8!=0)throw new Error("Bitstream is not byte-aligned.");const e=this.pos/8,n=null!==(t=this.bytes[e])&&void 0!==t?t:0;return this.pos+=8,n}skipBits(t){this.pos+=t}getBitsLeft(){return 8*this.bytes.length-this.pos}clone(){const t=new JI(this.bytes);return t.pos=this.pos,t}}const ZI=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],tT=[-1,1,2,3,4,5,6,8],eT=t=>{if(!t||t.byteLength<2)throw new TypeError("AAC description must be at least 2 bytes long.");const e=new JI(t);let n=e.readBits(5);31===n&&(n=32+e.readBits(6));const i=e.readBits(4);let r=null;15===i?r=e.readBits(24):i<ZI.length&&(r=ZI[i]);const o=e.readBits(4);let s=null;return o>=1&&o<=7&&(s=tT[o]),{objectType:n,frequencyIndex:i,sampleRate:r,channelConfiguration:o,numberOfChannels:s}},nT=["pcm-s16","pcm-s16be","pcm-s24","pcm-s24be","pcm-s32","pcm-s32be","pcm-f32","pcm-f32be","pcm-f64","pcm-f64be","pcm-u8","pcm-s8","ulaw","alaw"],iT=[{maxPictureSize:36864,maxBitrate:2e5,level:10},{maxPictureSize:73728,maxBitrate:8e5,level:11},{maxPictureSize:122880,maxBitrate:18e5,level:20},{maxPictureSize:245760,maxBitrate:36e5,level:21},{maxPictureSize:552960,maxBitrate:72e5,level:30},{maxPictureSize:983040,maxBitrate:12e6,level:31},{maxPictureSize:2228224,maxBitrate:18e6,level:40},{maxPictureSize:2228224,maxBitrate:3e7,level:41},{maxPictureSize:8912896,maxBitrate:6e7,level:50},{maxPictureSize:8912896,maxBitrate:12e7,level:51},{maxPictureSize:8912896,maxBitrate:18e7,level:52},{maxPictureSize:35651584,maxBitrate:18e7,level:60},{maxPictureSize:35651584,maxBitrate:24e7,level:61},{maxPictureSize:35651584,maxBitrate:48e7,level:62}],rT=t=>{const{codec:e,codecDescription:n,colorSpace:i,avcCodecInfo:r,hevcCodecInfo:o,vp9CodecInfo:s,av1CodecInfo:a}=t;if("avc"===e){if(II(null!==t.avcType),r){const e=new Uint8Array([r.avcProfileIndication,r.profileCompatibility,r.avcLevelIndication]);return`avc${t.avcType}.${BI(e)}`}if(!n||n.byteLength<4)throw new TypeError("AVC decoder description is not provided or is not at least 4 bytes long.");return`avc${t.avcType}.${BI(n.subarray(1,4))}`}if("hevc"===e){let t,e,i,r,s,a;if(o)t=o.generalProfileSpace,e=o.generalProfileIdc,i=LI(o.generalProfileCompatibilityFlags),r=o.generalTierFlag,s=o.generalLevelIdc,a=[...o.generalConstraintIndicatorFlags];else{if(!n||n.byteLength<23)throw new TypeError("HEVC decoder description is not provided or is not at least 23 bytes long.");const o=MI(n),l=o.getUint8(1);t=l>>6&3,e=31&l,i=LI(o.getUint32(2)),r=l>>5&1,s=o.getUint8(12),a=[];for(let t=0;t<6;t++)a.push(o.getUint8(6+t))}let l="hev1.";for(l+=["","A","B","C"][t]+e,l+=".",l+=i.toString(16).toUpperCase(),l+=".",l+=0===r?"L":"H",l+=s;a.length>0&&0===a[a.length-1];)a.pop();return a.length>0&&(l+=".",l+=a.map((t=>t.toString(16).toUpperCase())).join(".")),l}if("vp8"===e)return"vp8";if("vp9"===e){if(!s){const e=t.width*t.height;let n=TI(iT).level;for(const t of iT)if(e<=t.maxPictureSize){n=t.level;break}return`vp09.00.${n.toString().padStart(2,"0")}.08`}let e=`vp09.${s.profile.toString().padStart(2,"0")}.${s.level.toString().padStart(2,"0")}.${s.bitDepth.toString().padStart(2,"0")}.${s.chromaSubsampling.toString().padStart(2,"0")}`;return e+=`.${s.colourPrimaries.toString().padStart(2,"0")}.${s.transferCharacteristics.toString().padStart(2,"0")}.${s.matrixCoefficients.toString().padStart(2,"0")}.${s.videoFullRangeFlag.toString().padStart(2,"0")}`,e.endsWith(".01.01.01.01.00")&&(e=e.slice(0,-15)),e}if("av1"===e){if(!a){const e=t.width*t.height;let n=TI(iT).level;for(const t of iT)if(e<=t.maxPictureSize){n=t.level;break}return`av01.0.${n.toString().padStart(2,"0")}M.08`}const e=a.profile,n=a.level.toString().padStart(2,"0"),r=a.tier?"H":"M",o=a.bitDepth.toString().padStart(2,"0"),s=a.monochrome?"1":"0",l=100*a.chromaSubsamplingX+10*a.chromaSubsamplingY+1*(a.chromaSubsamplingX&&a.chromaSubsamplingY?a.chromaSamplePosition:0),c=null!=i&&i.primaries?FI[i.primaries]:1,u=null!=i&&i.transfer?OI[i.transfer]:1,d=null!=i&&i.matrix?RI[i.matrix]:1,h=null!=i&&i.fullRange?1:0;let f=`av01.${e}.${n}${r}.${o}`;return f+=`.${s}.${l.toString().padStart(3,"0")}`,f+=`.${c.toString().padStart(2,"0")}`,f+=`.${u.toString().padStart(2,"0")}`,f+=`.${d.toString().padStart(2,"0")}`,f+=`.${h}`,f.endsWith(".0.110.01.01.01.0")&&(f=f.slice(0,-17)),f}throw new TypeError(`Unhandled codec '${e}'.`)},oT=t=>{const{codec:e,codecDescription:n,aacCodecInfo:i}=t;if("aac"===e){if(!i)throw new TypeError("AAC codec info must be provided.");if(i.isMpeg2)return"mp4a.67";{let t;return t=null!==i.objectType?i.objectType:eT(n).objectType,`mp4a.40.${t}`}}if("mp3"===e)return"mp3";if("opus"===e)return"opus";if("vorbis"===e)return"vorbis";if("flac"===e)return"flac";if("ac3"===e)return"ac-3";if("eac3"===e)return"ec-3";if(e&&nT.includes(e))return e;throw new TypeError(`Unhandled codec '${e}'.`)},sT=/^pcm-([usf])(\d+)+(be)?$/,aT=[48e3,44100,32e3],lT=[24e3,22050,16e3];var cT,uT;!function(t){t[t.NON_IDR_SLICE=1]="NON_IDR_SLICE",t[t.SLICE_DPA=2]="SLICE_DPA",t[t.SLICE_DPB=3]="SLICE_DPB",t[t.SLICE_DPC=4]="SLICE_DPC",t[t.IDR=5]="IDR",t[t.SEI=6]="SEI",t[t.SPS=7]="SPS",t[t.PPS=8]="PPS",t[t.AUD=9]="AUD",t[t.SPS_EXT=13]="SPS_EXT"}(cT||(cT={})),function(t){t[t.RASL_N=8]="RASL_N",t[t.RASL_R=9]="RASL_R",t[t.BLA_W_LP=16]="BLA_W_LP",t[t.RSV_IRAP_VCL23=23]="RSV_IRAP_VCL23",t[t.VPS_NUT=32]="VPS_NUT",t[t.SPS_NUT=33]="SPS_NUT",t[t.PPS_NUT=34]="PPS_NUT",t[t.AUD_NUT=35]="AUD_NUT",t[t.PREFIX_SEI_NUT=39]="PREFIX_SEI_NUT",t[t.SUFFIX_SEI_NUT=40]="SUFFIX_SEI_NUT"}(uT||(uT={}));const dT=function*(t){let e=0,n=-1;for(;e<t.length-2;){const i=t.indexOf(0,e);if(-1===i||i>=t.length-2)break;e=i;let r=0;e+3<t.length&&0===t[e+1]&&0===t[e+2]&&1===t[e+3]?r=4:0===t[e+1]&&1===t[e+2]&&(r=3),0!==r?(-1!==n&&e>n&&(yield{offset:n,length:e-n}),n=e+r,e=n):e++}-1!==n&&n<t.length&&(yield{offset:n,length:t.length-n})},hT=function*(t,e){let n=0;const i=new DataView(t.buffer,t.byteOffset,t.byteLength);for(;n+e<=t.length;){let t;1===e?t=i.getUint8(n):2===e?t=i.getUint16(n,!1):3===e?t=$I(i,n):(II(4===e),t=i.getUint32(n,!1)),n+=e,yield{offset:n,length:t},n+=t}},fT=t=>31&t,pT=t=>{const e=[],n=t.length;for(let i=0;i<n;i++)i+2<n&&0===t[i]&&0===t[i+1]&&3===t[i+2]?(e.push(0,0),i+=2):e.push(t[i]);return new Uint8Array(e)},mT=t=>t>>1&63,vT=function*(t){const e=new JI(t),n=()=>{let t=0;for(let n=0;n<8;n++){const i=e.readAlignedByte();if(t|=(127&i)<<7*n,!(128&i))break;if(7===n&&128&i)return null}return t>=2**32-1?null:t};for(;e.getBitsLeft()>=8;){e.skipBits(1);const i=e.readBits(4),r=e.readBits(1),o=e.readBits(1);let s;if(e.skipBits(1),r&&e.skipBits(8),o){const t=n();if(null===t)return;s=t}else s=Math.floor(e.getBitsLeft()/8);II(e.pos%8==0),yield{type:i,data:t.subarray(e.pos/8,e.pos/8+s)},e.skipBits(8*s)}};var gT;!function(t){t[t.STREAMINFO=0]="STREAMINFO",t[t.VORBIS_COMMENT=4]="VORBIS_COMMENT",t[t.PICTURE=6]="PICTURE"}(gT||(gT={}));const yT=[2,1,2,3,3,4,4,5];class bT{constructor(t){this.input=t}}const kT=[],xT=[],wT=new Uint8Array(0);class _T{constructor(t,e,n,i,r=-1,o,s){if(this.data=t,this.type=e,this.timestamp=n,this.duration=i,this.sequenceNumber=r,t===wT&&void 0===o)throw new Error("Internal error: byteLength must be explicitly provided when constructing metadata-only packets.");if(void 0===o&&(o=t.byteLength),!(t instanceof Uint8Array))throw new TypeError("data must be a Uint8Array.");if("key"!==e&&"delta"!==e)throw new TypeError('type must be either "key" or "delta".');if(!Number.isFinite(n))throw new TypeError("timestamp must be a number.");if(!Number.isFinite(i)||i<0)throw new TypeError("duration must be a non-negative number.");if(!Number.isFinite(r))throw new TypeError("sequenceNumber must be a number.");if(!Number.isInteger(o)||o<0)throw new TypeError("byteLength must be a non-negative integer.");if(void 0!==s&&("object"!=typeof s||!s))throw new TypeError("sideData, when provided, must be an object.");if(void 0!==(null==s?void 0:s.alpha)&&!(s.alpha instanceof Uint8Array))throw new TypeError("sideData.alpha, when provided, must be a Uint8Array.");if(void 0!==(null==s?void 0:s.alphaByteLength)&&(!Number.isInteger(s.alphaByteLength)||s.alphaByteLength<0))throw new TypeError("sideData.alphaByteLength, when provided, must be a non-negative integer.");this.byteLength=o,this.sideData=null!=s?s:{},this.sideData.alpha&&void 0===this.sideData.alphaByteLength&&(this.sideData.alphaByteLength=this.sideData.alpha.byteLength)}get isMetadataOnly(){return this.data===wT}get microsecondTimestamp(){return Math.trunc(VI*this.timestamp)}get microsecondDuration(){return Math.trunc(VI*this.duration)}toEncodedVideoChunk(){if(this.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be converted to a video chunk.");if("undefined"==typeof EncodedVideoChunk)throw new Error("Your browser does not support EncodedVideoChunk.");return new EncodedVideoChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}alphaToEncodedVideoChunk(t=this.type){if(!this.sideData.alpha)throw new TypeError("This packet does not contain alpha side data.");if(this.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be converted to a video chunk.");if("undefined"==typeof EncodedVideoChunk)throw new Error("Your browser does not support EncodedVideoChunk.");return new EncodedVideoChunk({data:this.sideData.alpha,type:t,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}toEncodedAudioChunk(){if(this.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be converted to an audio chunk.");if("undefined"==typeof EncodedAudioChunk)throw new Error("Your browser does not support EncodedAudioChunk.");return new EncodedAudioChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}static fromEncodedChunk(t,e){var n;if(!(t instanceof EncodedVideoChunk||t instanceof EncodedAudioChunk))throw new TypeError("chunk must be an EncodedVideoChunk or EncodedAudioChunk.");const i=new Uint8Array(t.byteLength);return t.copyTo(i),new _T(i,t.type,t.timestamp/1e6,(null!==(n=t.duration)&&void 0!==n?n:0)/1e6,void 0,void 0,e)}clone(t){var e,n,i,r,o,s;if(void 0!==t&&("object"!=typeof t||null===t))throw new TypeError("options, when provided, must be an object.");if(void 0!==(null==t?void 0:t.data)&&!(t.data instanceof Uint8Array))throw new TypeError("options.data, when provided, must be a Uint8Array.");if(void 0!==(null==t?void 0:t.type)&&"key"!==t.type&&"delta"!==t.type)throw new TypeError('options.type, when provided, must be either "key" or "delta".');if(void 0!==(null==t?void 0:t.timestamp)&&!Number.isFinite(t.timestamp))throw new TypeError("options.timestamp, when provided, must be a number.");if(void 0!==(null==t?void 0:t.duration)&&!Number.isFinite(t.duration))throw new TypeError("options.duration, when provided, must be a number.");if(void 0!==(null==t?void 0:t.sequenceNumber)&&!Number.isFinite(t.sequenceNumber))throw new TypeError("options.sequenceNumber, when provided, must be a number.");if(void 0!==(null==t?void 0:t.sideData)&&("object"!=typeof t.sideData||null===t.sideData))throw new TypeError("options.sideData, when provided, must be an object.");return new _T(null!==(e=null==t?void 0:t.data)&&void 0!==e?e:this.data,null!==(n=null==t?void 0:t.type)&&void 0!==n?n:this.type,null!==(i=null==t?void 0:t.timestamp)&&void 0!==i?i:this.timestamp,null!==(r=null==t?void 0:t.duration)&&void 0!==r?r:this.duration,null!==(o=null==t?void 0:t.sequenceNumber)&&void 0!==o?o:this.sequenceNumber,this.byteLength,null!==(s=null==t?void 0:t.sideData)&&void 0!==s?s:this.sideData)}}const IT=t=>{if(!t||"object"!=typeof t)throw new TypeError("options must be an object.");if(void 0!==t.metadataOnly&&"boolean"!=typeof t.metadataOnly)throw new TypeError("options.metadataOnly, when defined, must be a boolean.");if(void 0!==t.verifyKeyPackets&&"boolean"!=typeof t.verifyKeyPackets)throw new TypeError("options.verifyKeyPackets, when defined, must be a boolean.");if(t.verifyKeyPackets&&t.metadataOnly)throw new TypeError("options.verifyKeyPackets and options.metadataOnly cannot be enabled together.")},TT=t=>{if(!XI(t))throw new TypeError("timestamp must be a number.")},ET=(t,e,n)=>n.verifyKeyPackets?e.then((async e=>{if(!e||"delta"===e.type)return e;const n=await t.determinePacketType(e);return n&&(e.type=n),e})):e;class ST{constructor(t){if(!(t instanceof MT))throw new TypeError("track must be an InputTrack.");this._track=t}getFirstPacket(t={}){if(IT(t),this._track.input._disposed)throw new tE;return ET(this._track,this._track._backing.getFirstPacket(t),t)}async getFirstKeyPacket(t={}){IT(t);const e=await this.getFirstPacket(t);return e?"key"===e.type?e:this.getNextKeyPacket(e,t):null}getPacket(t,e={}){if(TT(t),IT(e),this._track.input._disposed)throw new tE;return ET(this._track,this._track._backing.getPacket(t,e),e)}getNextPacket(t,e={}){if(!(t instanceof _T))throw new TypeError("packet must be an EncodedPacket.");if(IT(e),this._track.input._disposed)throw new tE;return ET(this._track,this._track._backing.getNextPacket(t,e),e)}async getKeyPacket(t,e={}){if(TT(t),IT(e),this._track.input._disposed)throw new tE;if(!e.verifyKeyPackets)return this._track._backing.getKeyPacket(t,e);const n=await this._track._backing.getKeyPacket(t,e);return n?(II("key"===n.type),"delta"===await this._track.determinePacketType(n)?this.getKeyPacket(n.timestamp-1/this._track.timeResolution,e):n):n}async getNextKeyPacket(t,e={}){if(!(t instanceof _T))throw new TypeError("packet must be an EncodedPacket.");if(IT(e),this._track.input._disposed)throw new tE;if(!e.verifyKeyPackets)return this._track._backing.getNextKeyPacket(t,e);const n=await this._track._backing.getNextKeyPacket(t,e);return n?(II("key"===n.type),"delta"===await this._track.determinePacketType(n)?this.getNextKeyPacket(n,e):n):n}packets(t,e,n={}){if(void 0!==t&&!(t instanceof _T))throw new TypeError("startPacket must be an EncodedPacket.");if(void 0!==t&&t.isMetadataOnly&&(null==n||!n.metadataOnly))throw new TypeError("startPacket can only be metadata-only if options.metadataOnly is enabled.");if(void 0!==e&&!(e instanceof _T))throw new TypeError("endPacket must be an EncodedPacket.");if(IT(n),this._track.input._disposed)throw new tE;const i=[];let{promise:r,resolve:o}=jI(),{promise:s,resolve:a}=jI(),l=!1,c=!1,u=null;const d=[];(async()=>{let u=null!=t?t:await this.getFirstPacket(n);for(;u&&!c&&!this._track.input._disposed&&!(e&&u.sequenceNumber>=(null==e?void 0:e.sequenceNumber));)i.length>Math.max(2,d.length)?(({promise:s,resolve:a}=jI()),await s):(i.push(u),o(),({promise:r,resolve:o}=jI()),u=await this.getNextPacket(u,n));l=!0,o()})().catch((t=>{u||(u=t,o())}));const h=this._track;return{async next(){for(;;){if(h.input._disposed)throw new tE;if(c)return{value:void 0,done:!0};if(u)throw u;if(i.length>0){const t=i.shift(),e=performance.now();for(d.push(e);d.length>0&&e-d[0]>=1e3;)d.shift();return a(),{value:t,done:!1}}if(l)return{value:void 0,done:!0};await r}},return:async()=>(c=!0,a(),o(),{value:void 0,done:!0}),async throw(t){throw t},[Symbol.asyncIterator](){return this}}}}class MT{constructor(t,e){this.input=t,this._backing=e}isVideoTrack(){return this instanceof AT}isAudioTrack(){return this instanceof NT}get id(){return this._backing.getId()}get number(){return this._backing.getNumber()}get internalCodecId(){return this._backing.getInternalCodecId()}get languageCode(){return this._backing.getLanguageCode()}get name(){return this._backing.getName()}get timeResolution(){return this._backing.getTimeResolution()}get disposition(){return this._backing.getDisposition()}getFirstTimestamp(){return this._backing.getFirstTimestamp()}computeDuration(){return this._backing.computeDuration()}async computePacketStats(t=1/0){const e=new ST(this);let n=1/0,i=-1/0,r=0,o=0;for await(const s of e.packets(void 0,void 0,{metadataOnly:!0})){if(r>=t&&s.timestamp>=i)break;n=Math.min(n,s.timestamp),i=Math.max(i,s.timestamp+s.duration),r++,o+=s.byteLength}return{packetCount:r,averagePacketRate:r?Number((r/(i-n)).toPrecision(16)):0,averageBitrate:r?Number((8*o/(i-n)).toPrecision(16)):0}}}class AT extends MT{constructor(t,e){super(t,e),this._backing=e,this.pixelAspectRatio=(t=>{II(0!==t.den);let e=Math.abs(t.num),n=Math.abs(t.den);for(;0!==n;){const t=e%n;e=n,n=t}const i=e||1;return{num:t.num/i,den:t.den/i}})({num:this._backing.getSquarePixelWidth()*this._backing.getCodedHeight(),den:this._backing.getSquarePixelHeight()*this._backing.getCodedWidth()})}get type(){return"video"}get codec(){return this._backing.getCodec()}get codedWidth(){return this._backing.getCodedWidth()}get codedHeight(){return this._backing.getCodedHeight()}get rotation(){return this._backing.getRotation()}get squarePixelWidth(){return this._backing.getSquarePixelWidth()}get squarePixelHeight(){return this._backing.getSquarePixelHeight()}get displayWidth(){return this._backing.getRotation()%180==0?this.squarePixelWidth:this.squarePixelHeight}get displayHeight(){return this._backing.getRotation()%180==0?this.squarePixelHeight:this.squarePixelWidth}getColorSpace(){return this._backing.getColorSpace()}async hasHighDynamicRange(){const t=await this._backing.getColorSpace();return"bt2020"===t.primaries||"smpte432"===t.primaries||"pg"===t.transfer||"hlg"===t.transfer||"bt2020-ncl"===t.matrix}canBeTransparent(){return this._backing.canBeTransparent()}getDecoderConfig(){return this._backing.getDecoderConfig()}async getCodecParameterString(){var t;const e=await this._backing.getDecoderConfig();return null!==(t=null==e?void 0:e.codec)&&void 0!==t?t:null}async canDecode(){try{const t=await this._backing.getDecoderConfig();if(!t)return!1;const e=this._backing.getCodec();return II(null!==e),kT.some((n=>n.supports(e,t)))?!0:"undefined"!=typeof VideoDecoder&&!0===(await VideoDecoder.isConfigSupported(t)).supported}catch(t){return console.error("Error during decodability check:",t),!1}}async determinePacketType(t){if(!(t instanceof _T))throw new TypeError("packet must be an EncodedPacket.");if(t.isMetadataOnly)throw new TypeError("packet must not be metadata-only to determine its type.");if(null===this.codec)return null;const e=await this.getDecoderConfig();return II(e),((t,e,n)=>{switch(t){case"avc":for(const t of((t,e)=>{if(e.description){const n=3&SI(e.description)[4];return hT(t,n+1)}return dT(t)})(n,e)){const e=n[t.offset],r=fT(e);if(r>=cT.NON_IDR_SLICE&&r<=cT.SLICE_DPC)return"delta";if(r===cT.IDR)return"key";if(r===cT.SEI&&(i=void 0,!(null!==GI?GI:GI=!("undefined"==typeof navigator||(null===(i=navigator.vendor)||void 0===i||!i.includes("Google Inc"))&&!/Chrome/.test(navigator.userAgent)))||KI()>=144)){const e=n.subarray(t.offset,t.offset+t.length),i=pT(e);let r=1;do{let t=0;for(;;){const e=i[r++];if(void 0===e)break;if(t+=e,e<255)break}let e=0;for(;;){const t=i[r++];if(void 0===t)break;if(e+=t,t<255)break}if(6===t){const t=new JI(i);t.pos=8*r;const e=EI(t),n=t.readBits(1);if(0===e&&1===n)return"key"}r+=e}while(r<i.length-1)}}return"delta";case"hevc":for(const t of((t,e)=>{if(e.description){const n=3&SI(e.description)[21];return hT(t,n+1)}return dT(t)})(n,e)){const e=mT(n[t.offset]);if(e<uT.BLA_W_LP)return"delta";if(e<=uT.RSV_IRAP_VCL23)return"key"}return"delta";case"vp8":return 1&n[0]?"delta":"key";case"vp9":{const t=new JI(n);if(2!==t.readBits(2))return null;const e=t.readBits(1);return 3===(t.readBits(1)<<1)+e&&t.skipBits(1),t.readBits(1)?null:0===t.readBits(1)?"key":"delta"}case"av1":{let t=!1;for(const{type:e,data:i}of vT(n))if(1===e){const e=new JI(i);e.skipBits(4),t=!!e.readBits(1)}else if(3===e||6===e||7===e){if(t)return"key";const e=new JI(i);return e.readBits(1)?null:0===e.readBits(2)?"key":"delta"}return null}default:(t=>{throw new Error(`Unexpected value: ${t}`)})(t),II(!1)}var i})(this.codec,e,t.data)}}class NT extends MT{constructor(t,e){super(t,e),this._backing=e}get type(){return"audio"}get codec(){return this._backing.getCodec()}get numberOfChannels(){return this._backing.getNumberOfChannels()}get sampleRate(){return this._backing.getSampleRate()}getDecoderConfig(){return this._backing.getDecoderConfig()}async getCodecParameterString(){var t;const e=await this._backing.getDecoderConfig();return null!==(t=null==e?void 0:e.codec)&&void 0!==t?t:null}async canDecode(){try{const t=await this._backing.getDecoderConfig();if(!t)return!1;const e=this._backing.getCodec();return II(null!==e),xT.some((n=>n.supports(e,t)))?!0:!!t.codec.startsWith("pcm-")||"undefined"!=typeof AudioDecoder&&!0===(await AudioDecoder.isConfigSupported(t)).supported}catch(t){return console.error("Error during decodability check:",t),!1}}async determinePacketType(t){if(!(t instanceof _T))throw new TypeError("packet must be an EncodedPacket.");return null===this.codec?null:"key"}}const FT=t=>{let e=cE(t);const n=pE(t,4);let i=8;1===e&&(e=dE(t),i=16);const r=e-i;return r<0?null:{name:n,totalSize:e,headerSize:i,contentSize:r}},CT=t=>uE(t)/65536,OT=t=>uE(t)/1073741824,PT=t=>{let e=0;for(let n=0;n<4;n++){e<<=7;const n=oE(t);if(e|=127&n,!(128&n))break}return e},RT=t=>{let e=sE(t);return t.skip(2),e=Math.min(e,t.remainingLength),AI.decode(rE(t,e))},DT=t=>{const e=FT(t);if(!e||"data"!==e.name)return null;if(t.remainingLength<8)return null;const n=cE(t);t.skip(4);const i=rE(t,e.contentSize-8);switch(n){case 1:return AI.decode(i);case 2:return new TextDecoder("utf-16be").decode(i);case 13:return new YI(i,"image/jpeg");case 14:return new YI(i,"image/png");case 27:return new YI(i,"image/bmp");default:return i}};class BT extends bT{constructor(t){super(t),this.moovSlice=null,this.currentTrack=null,this.tracks=[],this.metadataPromise=null,this.movieTimescale=-1,this.movieDurationInTimescale=-1,this.isQuickTime=!1,this.metadataTags={},this.currentMetadataKeys=null,this.isFragmented=!1,this.fragmentTrackDefaults=[],this.currentFragment=null,this.lastReadFragment=null,this.reader=t._reader}async computeDuration(){const t=await this.getTracks(),e=await Promise.all(t.map((t=>t.computeDuration())));return Math.max(0,...e)}async getTracks(){return await this.readMetadata(),this.tracks.map((t=>t.inputTrack))}async getMimeType(){await this.readMetadata();const t=await Promise.all(this.tracks.map((t=>t.inputTrack.getCodecParameterString())));return(t=>{let e=(t.hasVideo?"video/":t.hasAudio?"audio/":"application/")+(t.isQuickTime?"quicktime":"mp4");return t.codecStrings.length>0&&(e+=`; codecs="${[...new Set(t.codecStrings)].join(", ")}"`),e})({isQuickTime:this.isQuickTime,hasVideo:this.tracks.some((t=>{var e;return"video"===(null===(e=t.info)||void 0===e?void 0:e.type)})),hasAudio:this.tracks.some((t=>{var e;return"audio"===(null===(e=t.info)||void 0===e?void 0:e.type)})),codecStrings:t.filter(Boolean)})}async getMetadataTags(){return await this.readMetadata(),this.metadataTags}readMetadata(){var t;return null!==(t=this.metadataPromise)&&void 0!==t?t:this.metadataPromise=(async()=>{let t=0;for(;;){let e=this.reader.requestSliceRange(t,8,16);if(e instanceof Promise&&(e=await e),!e)break;const n=t,i=FT(e);if(!i)break;if("ftyp"===i.name){const t=pE(e,4);this.isQuickTime="qt "===t}else if("moov"===i.name){let t=this.reader.requestSlice(e.filePos,i.contentSize);if(t instanceof Promise&&(t=await t),!t)break;this.moovSlice=t,this.readContiguousBoxes(this.moovSlice),this.tracks.sort(((t,e)=>Number(e.disposition.default)-Number(t.disposition.default)));for(const t of this.tracks){const e=t.editListPreviousSegmentDurations/this.movieTimescale;t.editListOffset-=Math.round(e*t.timescale)}break}t=n+i.totalSize}if(this.isFragmented&&null!==this.reader.fileSize){let t=this.reader.requestSlice(this.reader.fileSize-4,4);t instanceof Promise&&(t=await t),II(t);const e=cE(t),n=this.reader.fileSize-e;if(n>=0&&n<=this.reader.fileSize-16){let t=this.reader.requestSliceRange(n,8,16);if(t instanceof Promise&&(t=await t),t){const e=FT(t);if(e&&"mfra"===e.name){let n=this.reader.requestSlice(t.filePos,e.contentSize);n instanceof Promise&&(n=await n),n&&this.readContiguousBoxes(n)}}}}})()}getSampleTableForTrack(t){var e;if(t.sampleTable)return t.sampleTable;const n={sampleTimingEntries:[],sampleCompositionTimeOffsets:[],sampleSizes:[],keySampleIndices:null,chunkOffsets:[],sampleToChunk:[],presentationTimestamps:null,presentationTimestampIndexMap:null};t.sampleTable=n,II(this.moovSlice);const i=this.moovSlice.slice(t.sampleTableByteOffset);if(this.currentTrack=t,this.traverseBox(i),this.currentTrack=null,"audio"===(null===(e=t.info)||void 0===e?void 0:e.type)&&t.info.codec&&nT.includes(t.info.codec)&&0===n.sampleCompositionTimeOffsets.length){var r;II("audio"===(null===(r=t.info)||void 0===r?void 0:r.type));const e=(t=>{if(II(nT.includes(t)),"ulaw"===t)return{dataType:"ulaw",sampleSize:1,littleEndian:!0,silentValue:255};if("alaw"===t)return{dataType:"alaw",sampleSize:1,littleEndian:!0,silentValue:213};const e=sT.exec(t);let n;return II(e),n="u"===e[1]?"unsigned":"s"===e[1]?"signed":"float",{dataType:n,sampleSize:Number(e[2])/8,littleEndian:"be"!==e[3],silentValue:"pcm-u8"===t?128:0}})(t.info.codec),i=[],o=[];for(let r=0;r<n.sampleToChunk.length;r++){const s=n.sampleToChunk[r],a=n.sampleToChunk[r+1],l=(a?a.startChunkIndex:n.chunkOffsets.length)-s.startChunkIndex;for(let r=0;r<l;r++){const a=s.startSampleIndex+r*s.samplesPerChunk,l=a+s.samplesPerChunk,c=WI(n.sampleTimingEntries,a,(t=>t.startIndex)),u=n.sampleTimingEntries[c],d=WI(n.sampleTimingEntries,l,(t=>t.startIndex)),h=n.sampleTimingEntries[d],f=u.startDecodeTimestamp+(a-u.startIndex)*u.delta,p=h.startDecodeTimestamp+(l-h.startIndex)*h.delta-f,m=TI(i);m&&m.delta===p?m.count++:i.push({startIndex:s.startChunkIndex+r,startDecodeTimestamp:f,count:1,delta:p});const v=s.samplesPerChunk*e.sampleSize*t.info.numberOfChannels;o.push(v)}s.startSampleIndex=s.startChunkIndex,s.samplesPerChunk=1}n.sampleTimingEntries=i,n.sampleSizes=o}if(n.sampleCompositionTimeOffsets.length>0){n.presentationTimestamps=[];for(const t of n.sampleTimingEntries)for(let e=0;e<t.count;e++)n.presentationTimestamps.push({presentationTimestamp:t.startDecodeTimestamp+e*t.delta,sampleIndex:t.startIndex+e});for(const t of n.sampleCompositionTimeOffsets)for(let e=0;e<t.count;e++){const i=t.startIndex+e,r=n.presentationTimestamps[i];r&&(r.presentationTimestamp+=t.offset)}n.presentationTimestamps.sort(((t,e)=>t.presentationTimestamp-e.presentationTimestamp)),n.presentationTimestampIndexMap=Array(n.presentationTimestamps.length).fill(-1);for(let t=0;t<n.presentationTimestamps.length;t++)n.presentationTimestampIndexMap[n.presentationTimestamps[t].sampleIndex]=t}return n}async readFragment(t){var e;if((null===(e=this.lastReadFragment)||void 0===e?void 0:e.moofOffset)===t)return this.lastReadFragment;let n=this.reader.requestSliceRange(t,8,16);n instanceof Promise&&(n=await n),II(n);const i=FT(n);II("moof"===(null==i?void 0:i.name));let r=this.reader.requestSlice(t,i.totalSize);r instanceof Promise&&(r=await r),II(r),this.traverseBox(r);const o=this.lastReadFragment;II(o&&o.moofOffset===t);for(const[,t]of o.trackData){const e=t.track,{fragmentPositionCache:n}=e;if(!t.startTimestampIsFinal){const i=e.fragmentLookupTable.find((t=>t.moofOffset===o.moofOffset));if(i)VT(t,i.timestamp);else{const e=WI(n,o.moofOffset-1,(t=>t.moofOffset));if(-1!==e){const i=n[e];VT(t,i.endTimestamp)}}t.startTimestampIsFinal=!0}const i=WI(n,t.startTimestamp,(t=>t.startTimestamp));-1!==i&&n[i].moofOffset===o.moofOffset||n.splice(i+1,0,{moofOffset:o.moofOffset,startTimestamp:t.startTimestamp,endTimestamp:t.endTimestamp})}return o}readContiguousBoxes(t){const e=t.filePos;for(;t.filePos-e<=t.length-8&&this.traverseBox(t););}*iterateContiguousBoxes(t){const e=t.filePos;for(;t.filePos-e<=t.length-8;){const e=t.filePos,n=FT(t);if(!n)break;yield{boxInfo:n,slice:t},t.filePos=e+n.totalSize}}traverseBox(t){var e,n,i,r,o,s,a,l,c,u,d,h,f,p,m,v,g,y,b,k,x,w,_,I,T,E,S,M,A,N,F,C,O,P,R,D;const B=t.filePos,L=FT(t);if(!L)return!1;const z=t.filePos,W=B+L.totalSize;switch(L.name){case"mdia":case"minf":case"dinf":case"mfra":case"edts":case"wave":this.readContiguousBoxes(t.slice(z,L.contentSize));break;case"mvhd":{const e=oE(t);t.skip(3),1===e?(t.skip(16),this.movieTimescale=cE(t),this.movieDurationInTimescale=dE(t)):(t.skip(8),this.movieTimescale=cE(t),this.movieDurationInTimescale=cE(t))}break;case"trak":{const e={id:-1,demuxer:this,inputTrack:null,disposition:{...QI},info:null,timescale:-1,durationInMovieTimescale:-1,durationInMediaTimescale:-1,rotation:0,internalCodecId:null,name:null,languageCode:"und",sampleTableByteOffset:-1,sampleTable:null,fragmentLookupTable:[],currentFragmentState:null,fragmentPositionCache:[],editListPreviousSegmentDurations:0,editListOffset:0};if(this.currentTrack=e,this.readContiguousBoxes(t.slice(z,L.contentSize)),-1!==e.id&&-1!==e.timescale&&null!==e.info)if("video"===e.info.type&&-1!==e.info.width){const t=e;e.inputTrack=new AT(this.input,new zT(t)),this.tracks.push(e)}else if("audio"===e.info.type&&-1!==e.info.numberOfChannels){const t=e;e.inputTrack=new NT(this.input,new WT(t)),this.tracks.push(e)}this.currentTrack=null}break;case"tkhd":{const e=this.currentTrack;if(!e)break;const n=oE(t),i=!!(1&aE(t));if(e.disposition.default=i,0===n)t.skip(8),e.id=cE(t),t.skip(4),e.durationInMovieTimescale=cE(t);else{if(1!==n)throw new Error(`Incorrect track header version ${n}.`);t.skip(16),e.id=cE(t),t.skip(4),e.durationInMovieTimescale=dE(t)}t.skip(16);const r=[CT(t),CT(t),OT(t),CT(t),CT(t),OT(t),CT(t),CT(t),OT(t)],o=(t=>{const e=(t%360+360)%360;if(0===e||90===e||180===e||270===e)return e;throw new Error(`Invalid rotation ${t}.`)})((Ct=GT(r),90*Math.round(Ct/90)));II(0===o||90===o||180===o||270===o),e.rotation=o}break;case"elst":{const e=this.currentTrack;if(!e)break;const n=oE(t);t.skip(3);let i=!1,r=0;const o=cE(t);for(let s=0;s<o;s++){const o=1===n?dE(t):cE(t),s=1===n?hE(t):uE(t),a=CT(t);if(0!==o){if(i){console.warn("Unsupported edit list: multiple edits are not currently supported. Only using first edit.");break}if(-1!==s){if(1!==a){console.warn("Unsupported edit list entry: media rate must be 1.");break}e.editListPreviousSegmentDurations=r,e.editListOffset=s,i=!0}else r+=o}}}break;case"mdhd":{const e=this.currentTrack;if(!e)break;const n=oE(t);t.skip(3),0===n?(t.skip(8),e.timescale=cE(t),e.durationInMediaTimescale=cE(t)):1===n&&(t.skip(16),e.timescale=cE(t),e.durationInMediaTimescale=dE(t));let i=sE(t);if(i>0){e.languageCode="";for(let t=0;t<3;t++)e.languageCode=String.fromCharCode(96+(31&i))+e.languageCode,i>>=5;Ft=e.languageCode,qI.test(Ft)||(e.languageCode="und")}}break;case"hdlr":{const e=this.currentTrack;if(!e)break;t.skip(8);const n=pE(t,4);"vide"===n?e.info={type:"video",width:-1,height:-1,squarePixelWidth:-1,squarePixelHeight:-1,codec:null,codecDescription:null,colorSpace:null,avcType:null,avcCodecInfo:null,hevcCodecInfo:null,vp9CodecInfo:null,av1CodecInfo:null}:"soun"===n&&(e.info={type:"audio",numberOfChannels:-1,sampleRate:-1,codec:null,codecDescription:null,aacCodecInfo:null})}break;case"stbl":{const e=this.currentTrack;if(!e)break;e.sampleTableByteOffset=B,this.readContiguousBoxes(t.slice(z,L.contentSize))}break;case"stsd":{const e=this.currentTrack;if(!e)break;if(null===e.info||e.sampleTable)break;const n=oE(t);t.skip(3);const i=cE(t);for(let r=0;r<i;r++){const i=t.filePos,r=FT(t);if(!r)break;e.internalCodecId=r.name;const o=r.name.toLowerCase();if("video"===e.info.type)"avc1"===o||"avc3"===o?(e.info.codec="avc",e.info.avcType="avc1"===o?1:3):"hvc1"===o||"hev1"===o?e.info.codec="hevc":"vp08"===o?e.info.codec="vp8":"vp09"===o?e.info.codec="vp9":"av01"===o?e.info.codec="av1":console.warn(`Unsupported video codec (sample entry type '${r.name}').`),t.skip(24),e.info.width=sE(t),e.info.height=sE(t),e.info.squarePixelWidth=e.info.width,e.info.squarePixelHeight=e.info.height,t.skip(50),this.readContiguousBoxes(t.slice(t.filePos,i+r.totalSize-t.filePos));else{"mp4a"===o||("opus"===o?e.info.codec="opus":"flac"===o?e.info.codec="flac":"twos"===o||"sowt"===o||"raw "===o||"in24"===o||"in32"===o||"fl32"===o||"fl64"===o||"lpcm"===o||"ipcm"===o||"fpcm"===o||("ulaw"===o?e.info.codec="ulaw":"alaw"===o?e.info.codec="alaw":"ac-3"===o?e.info.codec="ac3":"ec-3"===o?e.info.codec="eac3":console.warn(`Unsupported audio codec (sample entry type '${r.name}').`))),t.skip(8);const s=sE(t);t.skip(6);let a=sE(t),l=sE(t);t.skip(4);let c=cE(t)/65536;if(0===n&&s>0)if(1===s)t.skip(4),l=8*cE(t),t.skip(8);else if(2===s){t.skip(4),c=fE(t),a=cE(t),t.skip(4),l=cE(t);const n=cE(t);if(t.skip(8),"lpcm"===o){const t=l+7>>3,i=Boolean(1&n),r=Boolean(2&n),o=4&n?-1:0;l>0&&l<=64&&(i?32===l&&(e.info.codec=r?"pcm-f32be":"pcm-f32"):o&1<<t-1?1===t?e.info.codec="pcm-s8":2===t?e.info.codec=r?"pcm-s16be":"pcm-s16":3===t?e.info.codec=r?"pcm-s24be":"pcm-s24":4===t&&(e.info.codec=r?"pcm-s32be":"pcm-s32"):1===t&&(e.info.codec="pcm-u8")),null===e.info.codec&&console.warn("Unsupported PCM format.")}}"opus"===e.info.codec&&(c=48e3),e.info.numberOfChannels=a,e.info.sampleRate=c,"twos"===o?8===l?e.info.codec="pcm-s8":16===l?e.info.codec="pcm-s16be":(console.warn(`Unsupported sample size ${l} for codec 'twos'.`),e.info.codec=null):"sowt"===o?8===l?e.info.codec="pcm-s8":16===l?e.info.codec="pcm-s16":(console.warn(`Unsupported sample size ${l} for codec 'sowt'.`),e.info.codec=null):"raw "===o?e.info.codec="pcm-u8":"in24"===o?e.info.codec="pcm-s24be":"in32"===o?e.info.codec="pcm-s32be":"fl32"===o?e.info.codec="pcm-f32be":"fl64"===o?e.info.codec="pcm-f64be":"ipcm"===o?e.info.codec="pcm-s16be":"fpcm"===o&&(e.info.codec="pcm-f32be"),this.readContiguousBoxes(t.slice(t.filePos,i+r.totalSize-t.filePos))}}}break;case"avcC":{const e=this.currentTrack;if(!e)break;II(e.info),e.info.codecDescription=rE(t,L.contentSize)}break;case"hvcC":{const e=this.currentTrack;if(!e)break;II(e.info),e.info.codecDescription=rE(t,L.contentSize)}break;case"vpcC":{var j;const e=this.currentTrack;if(!e)break;II("video"===(null===(j=e.info)||void 0===j?void 0:j.type)),t.skip(4);const n=oE(t),i=oE(t),r=oE(t),o=r>>4,s=r>>1&7,a=1&r,l=oE(t),c=oE(t),u=oE(t);e.info.vp9CodecInfo={profile:n,level:i,bitDepth:o,chromaSubsampling:s,videoFullRangeFlag:a,colourPrimaries:l,transferCharacteristics:c,matrixCoefficients:u}}break;case"av1C":{var $;const e=this.currentTrack;if(!e)break;II("video"===(null===($=e.info)||void 0===$?void 0:$.type)),t.skip(1);const n=oE(t),i=n>>5,r=31&n,o=oE(t),s=o>>7,a=o>>6&1,l=o>>4&1,c=o>>3&1,u=o>>2&1,d=3&o,h=2===i&&a?o>>5&1?12:10:a?10:8;e.info.av1CodecInfo={profile:i,level:r,tier:s,bitDepth:h,monochrome:l,chromaSubsamplingX:c,chromaSubsamplingY:u,chromaSamplePosition:d}}break;case"colr":{var U;const e=this.currentTrack;if(!e)break;if(II("video"===(null===(U=e.info)||void 0===U?void 0:U.type)),"nclx"!==pE(t,4))break;const n=sE(t),i=sE(t),r=sE(t),o=Boolean(128&oE(t));e.info.colorSpace={primaries:CI[n],transfer:PI[i],matrix:DI[r],fullRange:o}}break;case"pasp":{var q;const e=this.currentTrack;if(!e)break;II("video"===(null===(q=e.info)||void 0===q?void 0:q.type));const n=cE(t),i=cE(t);n>i?e.info.squarePixelWidth=Math.round(e.info.width*n/i):e.info.squarePixelHeight=Math.round(e.info.height*i/n)}break;case"esds":{var V;const e=this.currentTrack;if(!e)break;II("audio"===(null===(V=e.info)||void 0===V?void 0:V.type)),t.skip(4),II(3===oE(t)),PT(t),t.skip(2);const n=oE(t),i=!!(64&n),r=!!(32&n);if(!!(128&n)&&t.skip(2),i){const e=oE(t);t.skip(e)}r&&t.skip(2),II(4===oE(t));const o=PT(t),s=t.filePos,a=oE(t);if(64===a||103===a?(e.info.codec="aac",e.info.aacCodecInfo={isMpeg2:103===a,objectType:null}):105===a||107===a?e.info.codec="mp3":221===a?e.info.codec="vorbis":console.warn(`Unsupported audio codec (objectTypeIndication ${a}) - discarding track.`),t.skip(12),o>t.filePos-s){II(5===oE(t));const n=PT(t);if(e.info.codecDescription=rE(t,n),"aac"===e.info.codec){const t=eT(e.info.codecDescription);null!==t.numberOfChannels&&(e.info.numberOfChannels=t.numberOfChannels),null!==t.sampleRate&&(e.info.sampleRate=t.sampleRate)}}}break;case"enda":{var G;const e=this.currentTrack;if(!e)break;II("audio"===(null===(G=e.info)||void 0===G?void 0:G.type)),255&sE(t)&&("pcm-s16be"===e.info.codec?e.info.codec="pcm-s16":"pcm-s24be"===e.info.codec?e.info.codec="pcm-s24":"pcm-s32be"===e.info.codec?e.info.codec="pcm-s32":"pcm-f32be"===e.info.codec?e.info.codec="pcm-f32":"pcm-f64be"===e.info.codec&&(e.info.codec="pcm-f64"))}break;case"pcmC":{var H;const e=this.currentTrack;if(!e)break;II("audio"===(null===(H=e.info)||void 0===H?void 0:H.type)),t.skip(4);const n=oE(t),i=Boolean(1&n),r=oE(t);"pcm-s16be"===e.info.codec?i?16===r?e.info.codec="pcm-s16":24===r?e.info.codec="pcm-s24":32===r?e.info.codec="pcm-s32":(console.warn(`Invalid ipcm sample size ${r}.`),e.info.codec=null):16===r?e.info.codec="pcm-s16be":24===r?e.info.codec="pcm-s24be":32===r?e.info.codec="pcm-s32be":(console.warn(`Invalid ipcm sample size ${r}.`),e.info.codec=null):"pcm-f32be"===e.info.codec&&(i?32===r?e.info.codec="pcm-f32":64===r?e.info.codec="pcm-f64":(console.warn(`Invalid fpcm sample size ${r}.`),e.info.codec=null):32===r?e.info.codec="pcm-f32be":64===r?e.info.codec="pcm-f64be":(console.warn(`Invalid fpcm sample size ${r}.`),e.info.codec=null));break}case"dOps":{var K;const e=this.currentTrack;if(!e)break;II("audio"===(null===(K=e.info)||void 0===K?void 0:K.type)),t.skip(1);const n=oE(t),i=sE(t),r=cE(t),o=lE(t),s=oE(t);let a;a=0!==s?rE(t,2+n):new Uint8Array(0);const l=new Uint8Array(19+a.byteLength),c=new DataView(l.buffer);c.setUint32(0,1332770163,!1),c.setUint32(4,1214603620,!1),c.setUint8(8,1),c.setUint8(9,n),c.setUint16(10,i,!0),c.setUint32(12,r,!0),c.setInt16(16,o,!0),c.setUint8(18,s),l.set(a,19),e.info.codecDescription=l,e.info.numberOfChannels=n}break;case"dfLa":{var X;const e=this.currentTrack;if(!e)break;II("audio"===(null===(X=e.info)||void 0===X?void 0:X.type)),t.skip(4);const n=127,i=128,r=t.filePos;for(;t.filePos<W;){const r=oE(t),o=aE(t);if((r&n)===gT.STREAMINFO){t.skip(10);const n=cE(t),i=n>>>12,r=1+(n>>9&7);e.info.sampleRate=i,e.info.numberOfChannels=r,t.skip(20)}else t.skip(o);if(r&i)break}const o=t.filePos;t.filePos=r;const s=rE(t,o-r),a=new Uint8Array(4+s.byteLength);new DataView(a.buffer).setUint32(0,1716281667,!1),a.set(s,4),e.info.codecDescription=a}break;case"dac3":{var Y;const e=this.currentTrack;if(!e)break;II("audio"===(null===(Y=e.info)||void 0===Y?void 0:Y.type));const n=rE(t,3),i=new JI(n),r=i.readBits(2);i.skipBits(8);const o=i.readBits(3),s=i.readBits(1);r<3&&(e.info.sampleRate=aT[r]),e.info.numberOfChannels=yT[o]+s}break;case"dec3":{var Q;const e=this.currentTrack;if(!e)break;II("audio"===(null===(Q=e.info)||void 0===Q?void 0:Q.type));const n=(t=>{if(t.length<2)return null;const e=new JI(t),n=e.readBits(13),i=e.readBits(3),r=[];for(let n=0;n<=i&&!(Math.ceil(e.pos/8)+3>t.length);n++){const t=e.readBits(2),n=e.readBits(5);e.skipBits(1),e.skipBits(1);const i=e.readBits(3),o=e.readBits(3),s=e.readBits(1);e.skipBits(3);const a=e.readBits(4);let l=0;a>0?l=e.readBits(9):e.skipBits(1),r.push({fscod:t,fscod2:null,bsid:n,bsmod:i,acmod:o,lfeon:s,numDepSub:a,chanLoc:l})}return 0===r.length?null:{dataRate:n,substreams:r}})(rE(t,L.contentSize));if(!n){console.warn("Invalid dec3 box contents, ignoring.");break}const i=(t=>{const e=t.substreams[0];return II(e),e.fscod<3?aT[e.fscod]:null!==e.fscod2&&e.fscod2<3?lT[e.fscod2]:null})(n);null!==i&&(e.info.sampleRate=i),e.info.numberOfChannels=(t=>{const e=t.substreams[0];II(e);let n=yT[e.acmod]+e.lfeon;if(e.numDepSub>0){const t=[2,2,1,1,2,2,2,1,1];for(let i=0;i<9;i++)e.chanLoc&1<<8-i&&(n+=t[i])}return n})(n)}break;case"stts":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4);const n=cE(t);let i=0,r=0;for(let o=0;o<n;o++){const n=cE(t),o=cE(t);e.sampleTable.sampleTimingEntries.push({startIndex:i,startDecodeTimestamp:r,count:n,delta:o}),i+=n,r+=n*o}}break;case"ctts":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4);const n=cE(t);let i=0;for(let r=0;r<n;r++){const n=cE(t),r=uE(t);e.sampleTable.sampleCompositionTimeOffsets.push({startIndex:i,count:n,offset:r}),i+=n}}break;case"stsz":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4);const n=cE(t),i=cE(t);if(0===n)for(let n=0;n<i;n++){const n=cE(t);e.sampleTable.sampleSizes.push(n)}else e.sampleTable.sampleSizes.push(n)}break;case"stz2":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4),t.skip(3);const n=oE(t),i=cE(t),r=rE(t,Math.ceil(i*n/8)),o=new JI(r);for(let t=0;t<i;t++){const t=o.readBits(n);e.sampleTable.sampleSizes.push(t)}}break;case"stss":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4),e.sampleTable.keySampleIndices=[];const n=cE(t);for(let i=0;i<n;i++){const n=cE(t)-1;e.sampleTable.keySampleIndices.push(n)}0!==e.sampleTable.keySampleIndices[0]&&e.sampleTable.keySampleIndices.unshift(0)}break;case"stsc":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4);const n=cE(t);for(let i=0;i<n;i++){const n=cE(t)-1,i=cE(t),r=cE(t);e.sampleTable.sampleToChunk.push({startSampleIndex:-1,startChunkIndex:n,samplesPerChunk:i,sampleDescriptionIndex:r})}let i=0;for(let t=0;t<e.sampleTable.sampleToChunk.length;t++)e.sampleTable.sampleToChunk[t].startSampleIndex=i,t<e.sampleTable.sampleToChunk.length-1&&(i+=(e.sampleTable.sampleToChunk[t+1].startChunkIndex-e.sampleTable.sampleToChunk[t].startChunkIndex)*e.sampleTable.sampleToChunk[t].samplesPerChunk)}break;case"stco":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4);const n=cE(t);for(let i=0;i<n;i++){const n=cE(t);e.sampleTable.chunkOffsets.push(n)}}break;case"co64":{const e=this.currentTrack;if(!e)break;if(!e.sampleTable)break;t.skip(4);const n=cE(t);for(let i=0;i<n;i++){const n=dE(t);e.sampleTable.chunkOffsets.push(n)}}break;case"mvex":this.isFragmented=!0,this.readContiguousBoxes(t.slice(z,L.contentSize));break;case"mehd":{const e=oE(t);t.skip(3);const n=1===e?dE(t):cE(t);this.movieDurationInTimescale=n}break;case"trex":{t.skip(4);const e=cE(t),n=cE(t),i=cE(t),r=cE(t),o=cE(t);this.fragmentTrackDefaults.push({trackId:e,defaultSampleDescriptionIndex:n,defaultSampleDuration:i,defaultSampleSize:r,defaultSampleFlags:o})}break;case"tfra":{const e=oE(t);t.skip(3);const n=cE(t),i=this.tracks.find((t=>t.id===n));if(!i)break;const r=cE(t),o=(12&r)>>2,s=3&r,a=[oE,sE,aE,cE],l=a[(48&r)>>4],c=a[o],u=a[s],d=cE(t);for(let n=0;n<d;n++){const n=1===e?dE(t):cE(t),r=1===e?dE(t):cE(t);l(t),c(t),u(t),i.fragmentLookupTable.push({timestamp:n,moofOffset:r})}i.fragmentLookupTable.sort(((t,e)=>t.timestamp-e.timestamp));for(let t=0;t<i.fragmentLookupTable.length-1;t++){const e=i.fragmentLookupTable[t],n=i.fragmentLookupTable[t+1];e.timestamp===n.timestamp&&(i.fragmentLookupTable.splice(t+1,1),t--)}}break;case"moof":this.currentFragment={moofOffset:B,moofSize:L.totalSize,implicitBaseDataOffset:B,trackData:new Map},this.readContiguousBoxes(t.slice(z,L.contentSize)),this.lastReadFragment=this.currentFragment,this.currentFragment=null;break;case"traf":if(II(this.currentFragment),this.readContiguousBoxes(t.slice(z,L.contentSize)),this.currentTrack){const t=this.currentFragment.trackData.get(this.currentTrack.id);if(t){const{currentFragmentState:e}=this.currentTrack;II(e),null!==e.startTimestamp&&(VT(t,e.startTimestamp),t.startTimestampIsFinal=!0)}this.currentTrack.currentFragmentState=null,this.currentTrack=null}break;case"tfhd":{var J,Z,tt,et;II(this.currentFragment),t.skip(1);const e=aE(t),n=Boolean(1&e),i=Boolean(2&e),r=Boolean(8&e),o=Boolean(16&e),s=Boolean(32&e),a=Boolean(65536&e),l=Boolean(131072&e),c=cE(t),u=this.tracks.find((t=>t.id===c));if(!u)break;const d=this.fragmentTrackDefaults.find((t=>t.trackId===c));this.currentTrack=u,u.currentFragmentState={baseDataOffset:this.currentFragment.implicitBaseDataOffset,sampleDescriptionIndex:null!==(J=null==d?void 0:d.defaultSampleDescriptionIndex)&&void 0!==J?J:null,defaultSampleDuration:null!==(Z=null==d?void 0:d.defaultSampleDuration)&&void 0!==Z?Z:null,defaultSampleSize:null!==(tt=null==d?void 0:d.defaultSampleSize)&&void 0!==tt?tt:null,defaultSampleFlags:null!==(et=null==d?void 0:d.defaultSampleFlags)&&void 0!==et?et:null,startTimestamp:null},n?u.currentFragmentState.baseDataOffset=dE(t):l&&(u.currentFragmentState.baseDataOffset=this.currentFragment.moofOffset),i&&(u.currentFragmentState.sampleDescriptionIndex=cE(t)),r&&(u.currentFragmentState.defaultSampleDuration=cE(t)),o&&(u.currentFragmentState.defaultSampleSize=cE(t)),s&&(u.currentFragmentState.defaultSampleFlags=cE(t)),a&&(u.currentFragmentState.defaultSampleDuration=0)}break;case"tfdt":{const e=this.currentTrack;if(!e)break;II(e.currentFragmentState);const n=oE(t);t.skip(3);const i=0===n?cE(t):dE(t);e.currentFragmentState.startTimestamp=i}break;case"trun":{const e=this.currentTrack;if(!e)break;if(II(this.currentFragment),II(e.currentFragmentState),this.currentFragment.trackData.has(e.id)){console.warn("Can't have two trun boxes for the same track in one fragment. Ignoring...");break}const n=oE(t),i=aE(t),r=Boolean(1&i),o=Boolean(4&i),s=Boolean(256&i),a=Boolean(512&i),l=Boolean(1024&i),c=Boolean(2048&i),u=cE(t);let d=e.currentFragmentState.baseDataOffset;r&&(d+=uE(t));let h=null;o&&(h=cE(t));let f=d;if(0===u){this.currentFragment.implicitBaseDataOffset=f;break}let p=0;const m={track:e,startTimestamp:0,endTimestamp:0,firstKeyFrameTimestamp:null,samples:[],presentationTimestamps:[],startTimestampIsFinal:!1};this.currentFragment.trackData.set(e.id,m);for(let i=0;i<u;i++){let r,o,u;s?r=cE(t):(II(null!==e.currentFragmentState.defaultSampleDuration),r=e.currentFragmentState.defaultSampleDuration),a?o=cE(t):(II(null!==e.currentFragmentState.defaultSampleSize),o=e.currentFragmentState.defaultSampleSize),l?u=cE(t):(II(null!==e.currentFragmentState.defaultSampleFlags),u=e.currentFragmentState.defaultSampleFlags),0===i&&null!==h&&(u=h);let d=0;c&&(d=0===n?cE(t):uE(t));const v=!(65536&u);m.samples.push({presentationTimestamp:p+d,duration:r,byteOffset:f,byteSize:o,isKeyFrame:v}),f+=o,p+=r}m.presentationTimestamps=m.samples.map(((t,e)=>({presentationTimestamp:t.presentationTimestamp,sampleIndex:e}))).sort(((t,e)=>t.presentationTimestamp-e.presentationTimestamp));for(let t=0;t<m.presentationTimestamps.length;t++){const e=m.presentationTimestamps[t],n=m.samples[e.sampleIndex];if(null===m.firstKeyFrameTimestamp&&n.isKeyFrame&&(m.firstKeyFrameTimestamp=n.presentationTimestamp),t<m.presentationTimestamps.length-1){const i=m.presentationTimestamps[t+1];n.duration=i.presentationTimestamp-e.presentationTimestamp}}const v=m.samples[m.presentationTimestamps[0].sampleIndex],g=m.samples[TI(m.presentationTimestamps).sampleIndex];m.startTimestamp=v.presentationTimestamp,m.endTimestamp=g.presentationTimestamp+g.duration,this.currentFragment.implicitBaseDataOffset=f}break;case"udta":{const g=this.iterateContiguousBoxes(t.slice(z,L.contentSize));for(const{boxInfo:t,slice:y}of g){if("meta"!==t.name&&!this.currentTrack){var nt,it,rt,ot,st,at,lt,ct;const e=y.filePos;null!==(it=(nt=this.metadataTags).raw)&&void 0!==it||(nt.raw={}),"©"===t.name[0]?null!==(st=(rt=this.metadataTags.raw)[ot=t.name])&&void 0!==st||(rt[ot]=RT(y)):null!==(ct=(at=this.metadataTags.raw)[lt=t.name])&&void 0!==ct||(at[lt]=rE(y,t.contentSize)),y.filePos=e}switch(t.name){case"meta":y.skip(-t.headerSize),this.traverseBox(y);break;case"©nam":case"name":this.currentTrack?this.currentTrack.name=AI.decode(rE(y,t.contentSize)):null!==(n=(e=this.metadataTags).title)&&void 0!==n||(e.title=RT(y));break;case"©des":this.currentTrack||null!==(r=(i=this.metadataTags).description)&&void 0!==r||(i.description=RT(y));break;case"©ART":this.currentTrack||null!==(s=(o=this.metadataTags).artist)&&void 0!==s||(o.artist=RT(y));break;case"©alb":this.currentTrack||null!==(l=(a=this.metadataTags).album)&&void 0!==l||(a.album=RT(y));break;case"albr":this.currentTrack||null!==(u=(c=this.metadataTags).albumArtist)&&void 0!==u||(c.albumArtist=RT(y));break;case"©gen":this.currentTrack||null!==(h=(d=this.metadataTags).genre)&&void 0!==h||(d.genre=RT(y));break;case"©day":if(!this.currentTrack){var ut,dt;const t=new Date(RT(y));Number.isNaN(t.getTime())||null!==(dt=(ut=this.metadataTags).date)&&void 0!==dt||(ut.date=t)}break;case"©cmt":this.currentTrack||null!==(p=(f=this.metadataTags).comment)&&void 0!==p||(f.comment=RT(y));break;case"©lyr":this.currentTrack||null!==(v=(m=this.metadataTags).lyrics)&&void 0!==v||(m.lyrics=RT(y))}}}break;case"meta":{if(this.currentTrack)break;const e=0!==cE(t);this.currentMetadataKeys=new Map,e?this.readContiguousBoxes(t.slice(z,L.contentSize)):this.readContiguousBoxes(t.slice(z+4,L.contentSize-4)),this.currentMetadataKeys=null}break;case"keys":{if(!this.currentMetadataKeys)break;t.skip(4);const e=cE(t);for(let n=0;n<e;n++){const e=cE(t);t.skip(4);const i=AI.decode(rE(t,e-8));this.currentMetadataKeys.set(n+1,i)}}break;case"ilst":{if(!this.currentMetadataKeys)break;const e=this.iterateContiguousBoxes(t.slice(z,L.contentSize));for(const{boxInfo:t,slice:n}of e){var ht,ft,pt,mt,vt;let e=t.name;const i=(e.charCodeAt(0)<<24)+(e.charCodeAt(1)<<16)+(e.charCodeAt(2)<<8)+e.charCodeAt(3);this.currentMetadataKeys.has(i)&&(e=this.currentMetadataKeys.get(i));const r=DT(n);switch(null!==(ft=(ht=this.metadataTags).raw)&&void 0!==ft||(ht.raw={}),null!==(vt=(pt=this.metadataTags.raw)[mt=e])&&void 0!==vt||(pt[mt]=r),e){case"©nam":case"titl":case"com.apple.quicktime.title":case"title":"string"==typeof r&&(null!==(y=(g=this.metadataTags).title)&&void 0!==y||(g.title=r));break;case"©des":case"desc":case"dscp":case"com.apple.quicktime.description":case"description":"string"==typeof r&&(null!==(k=(b=this.metadataTags).description)&&void 0!==k||(b.description=r));break;case"©ART":case"com.apple.quicktime.artist":case"artist":"string"==typeof r&&(null!==(w=(x=this.metadataTags).artist)&&void 0!==w||(x.artist=r));break;case"©alb":case"albm":case"com.apple.quicktime.album":case"album":"string"==typeof r&&(null!==(I=(_=this.metadataTags).album)&&void 0!==I||(_.album=r));break;case"aART":case"album_artist":"string"==typeof r&&(null!==(E=(T=this.metadataTags).albumArtist)&&void 0!==E||(T.albumArtist=r));break;case"©cmt":case"com.apple.quicktime.comment":case"comment":"string"==typeof r&&(null!==(M=(S=this.metadataTags).comment)&&void 0!==M||(S.comment=r));break;case"©gen":case"gnre":case"com.apple.quicktime.genre":case"genre":"string"==typeof r&&(null!==(N=(A=this.metadataTags).genre)&&void 0!==N||(A.genre=r));break;case"©lyr":case"lyrics":"string"==typeof r&&(null!==(C=(F=this.metadataTags).lyrics)&&void 0!==C||(F.lyrics=r));break;case"©day":case"rldt":case"com.apple.quicktime.creationdate":case"date":if("string"==typeof r){var gt,yt;const t=new Date(r);Number.isNaN(t.getTime())||null!==(yt=(gt=this.metadataTags).date)&&void 0!==yt||(gt.date=t)}break;case"covr":case"com.apple.quicktime.artwork":r instanceof YI?(null!==(P=(O=this.metadataTags).images)&&void 0!==P||(O.images=[]),this.metadataTags.images.push({data:r.data,kind:"coverFront",mimeType:r.mimeType})):r instanceof Uint8Array&&(null!==(D=(R=this.metadataTags).images)&&void 0!==D||(R.images=[]),this.metadataTags.images.push({data:r,kind:"coverFront",mimeType:"image/*"}));break;case"track":if("string"==typeof r){var bt,kt,xt,wt;const t=r.split("/"),e=Number.parseInt(t[0],10),n=t[1]&&Number.parseInt(t[1],10);Number.isInteger(e)&&e>0&&(null!==(kt=(bt=this.metadataTags).trackNumber)&&void 0!==kt||(bt.trackNumber=e)),n&&Number.isInteger(n)&&n>0&&(null!==(wt=(xt=this.metadataTags).tracksTotal)&&void 0!==wt||(xt.tracksTotal=n))}break;case"trkn":if(r instanceof Uint8Array&&r.length>=6){var _t,It,Tt,Et;const t=MI(r),e=t.getUint16(2,!1),n=t.getUint16(4,!1);e>0&&(null!==(It=(_t=this.metadataTags).trackNumber)&&void 0!==It||(_t.trackNumber=e)),n>0&&(null!==(Et=(Tt=this.metadataTags).tracksTotal)&&void 0!==Et||(Tt.tracksTotal=n))}break;case"disc":case"disk":if(r instanceof Uint8Array&&r.length>=6){var St,Mt,At,Nt;const t=MI(r),e=t.getUint16(2,!1),n=t.getUint16(4,!1);e>0&&(null!==(Mt=(St=this.metadataTags).discNumber)&&void 0!==Mt||(St.discNumber=e)),n>0&&(null!==(Nt=(At=this.metadataTags).discsTotal)&&void 0!==Nt||(At.discsTotal=n))}}}}}var Ft,Ct;return t.filePos=W,!0}}class LT{constructor(t){this.internalTrack=t,this.packetToSampleIndex=new WeakMap,this.packetToFragmentLocation=new WeakMap}getId(){return this.internalTrack.id}getNumber(){const t=this.internalTrack.demuxer,e=this.internalTrack.inputTrack.type;let n=0;for(const i of t.tracks)if(i.inputTrack.type===e&&n++,i===this.internalTrack)break;return n}getCodec(){throw new Error("Not implemented on base class.")}getInternalCodecId(){return this.internalTrack.internalCodecId}getName(){return this.internalTrack.name}getLanguageCode(){return this.internalTrack.languageCode}getTimeResolution(){return this.internalTrack.timescale}getDisposition(){return this.internalTrack.disposition}async computeDuration(){var t,e;const n=await this.getPacket(1/0,{metadataOnly:!0});return(null!==(t=null==n?void 0:n.timestamp)&&void 0!==t?t:0)+(null!==(e=null==n?void 0:n.duration)&&void 0!==e?e:0)}async getFirstTimestamp(){var t;const e=await this.getFirstPacket({metadataOnly:!0});return null!==(t=null==e?void 0:e.timestamp)&&void 0!==t?t:0}async getFirstPacket(t){const e=await this.fetchPacketForSampleIndex(0,t);return e||!this.internalTrack.demuxer.isFragmented?e:this.performFragmentedLookup(null,(t=>t.trackData.get(this.internalTrack.id)?{sampleIndex:0,correctSampleFound:!0}:{sampleIndex:-1,correctSampleFound:!1}),-1/0,1/0,t)}mapTimestampIntoTimescale(t){return(t=>{const e=Math.round(t);return Math.abs(t/e-1)<10*Number.EPSILON?e:t})(t*this.internalTrack.timescale)+this.internalTrack.editListOffset}async getPacket(t,e){const n=this.mapTimestampIntoTimescale(t),i=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),r=jT(i,n),o=await this.fetchPacketForSampleIndex(r,e);return HT(i)&&this.internalTrack.demuxer.isFragmented?this.performFragmentedLookup(null,(t=>{const e=t.trackData.get(this.internalTrack.id);if(!e)return{sampleIndex:-1,correctSampleFound:!1};const i=WI(e.presentationTimestamps,n,(t=>t.presentationTimestamp));return{sampleIndex:-1!==i?e.presentationTimestamps[i].sampleIndex:-1,correctSampleFound:-1!==i&&n<e.endTimestamp}}),n,n,e):o}async getNextPacket(t,e){const n=this.packetToSampleIndex.get(t);if(void 0!==n)return this.fetchPacketForSampleIndex(n+1,e);const i=this.packetToFragmentLocation.get(t);if(void 0===i)throw new Error("Packet was not created from this track.");return this.performFragmentedLookup(i.fragment,(t=>{if(t===i.fragment){const e=t.trackData.get(this.internalTrack.id);if(i.sampleIndex+1<e.samples.length)return{sampleIndex:i.sampleIndex+1,correctSampleFound:!0}}else if(t.trackData.get(this.internalTrack.id))return{sampleIndex:0,correctSampleFound:!0};return{sampleIndex:-1,correctSampleFound:!1}}),-1/0,1/0,e)}async getKeyPacket(t,e){const n=this.mapTimestampIntoTimescale(t),i=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),r=$T(i,n),o=await this.fetchPacketForSampleIndex(r,e);return HT(i)&&this.internalTrack.demuxer.isFragmented?this.performFragmentedLookup(null,(t=>{const e=t.trackData.get(this.internalTrack.id);if(!e)return{sampleIndex:-1,correctSampleFound:!1};const i=((t,e)=>{for(let n=t.length-1;n>=0;n--)if(e(t[n]))return n;return-1})(e.presentationTimestamps,(t=>e.samples[t.sampleIndex].isKeyFrame&&t.presentationTimestamp<=n));return{sampleIndex:-1!==i?e.presentationTimestamps[i].sampleIndex:-1,correctSampleFound:-1!==i&&n<e.endTimestamp}}),n,n,e):o}async getNextKeyPacket(t,e){const n=this.packetToSampleIndex.get(t);if(void 0!==n){const t=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),i=qT(t,n);return this.fetchPacketForSampleIndex(i,e)}const i=this.packetToFragmentLocation.get(t);if(void 0===i)throw new Error("Packet was not created from this track.");return this.performFragmentedLookup(i.fragment,(t=>{if(t===i.fragment){const e=t.trackData.get(this.internalTrack.id).samples.findIndex(((t,e)=>t.isKeyFrame&&e>i.sampleIndex));if(-1!==e)return{sampleIndex:e,correctSampleFound:!0}}else{const e=t.trackData.get(this.internalTrack.id);if(e&&null!==e.firstKeyFrameTimestamp){const t=e.samples.findIndex((t=>t.isKeyFrame));return II(-1!==t),{sampleIndex:t,correctSampleFound:!0}}}return{sampleIndex:-1,correctSampleFound:!1}}),-1/0,1/0,e)}async fetchPacketForSampleIndex(t,e){if(-1===t)return null;const n=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),i=UT(n,t);if(!i)return null;let r;if(e.metadataOnly)r=wT;else{let t=this.internalTrack.demuxer.reader.requestSlice(i.sampleOffset,i.sampleSize);t instanceof Promise&&(t=await t),II(t),r=rE(t,i.sampleSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new _T(r,i.isKeyFrame?"key":"delta",o,s,t,i.sampleSize);return this.packetToSampleIndex.set(a,t),a}async fetchPacketInFragment(t,e,n){if(-1===e)return null;const i=t.trackData.get(this.internalTrack.id).samples[e];let r;if(II(i),n.metadataOnly)r=wT;else{let t=this.internalTrack.demuxer.reader.requestSlice(i.byteOffset,i.byteSize);t instanceof Promise&&(t=await t),II(t),r=rE(t,i.byteSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new _T(r,i.isKeyFrame?"key":"delta",o,s,t.moofOffset+e,i.byteSize);return this.packetToFragmentLocation.set(a,{fragment:t,sampleIndex:e}),a}async performFragmentedLookup(t,e,n,i,r){var o,s;const a=this.internalTrack.demuxer;let l=null,c=null,u=-1;if(t){const{sampleIndex:n,correctSampleFound:i}=e(t);if(i)return this.fetchPacketInFragment(t,n,r);-1!==n&&(c=t,u=n)}const d=WI(this.internalTrack.fragmentLookupTable,n,(t=>t.timestamp)),h=-1!==d?this.internalTrack.fragmentLookupTable[d]:null,f=WI(this.internalTrack.fragmentPositionCache,n,(t=>t.startTimestamp)),p=-1!==f?this.internalTrack.fragmentPositionCache[f]:null,m=Math.max(null!==(o=null==h?void 0:h.moofOffset)&&void 0!==o?o:0,null!==(s=null==p?void 0:p.moofOffset)&&void 0!==s?s:0)||null;let v;for(t?null===m||t.moofOffset>=m?(v=t.moofOffset+t.moofSize,l=t):v=m:v=null!=m?m:0;;){if(l){const t=l.trackData.get(this.internalTrack.id);if(t&&t.startTimestamp>i)break}let t=a.reader.requestSliceRange(v,8,16);if(t instanceof Promise&&(t=await t),!t)break;const n=v,o=FT(t);if(!o)break;if("moof"===o.name){l=await a.readFragment(n);const{sampleIndex:t,correctSampleFound:i}=e(l);if(i)return this.fetchPacketInFragment(l,t,r);-1!==t&&(c=l,u=t)}v=n+o.totalSize}if(h&&(!c||c.moofOffset<h.moofOffset)){var g;const t=this.internalTrack.fragmentLookupTable[d-1];II(!t||t.timestamp<h.timestamp);const n=null!==(g=null==t?void 0:t.timestamp)&&void 0!==g?g:-1/0;return this.performFragmentedLookup(null,e,n,i,r)}return c?this.fetchPacketInFragment(c,u,r):null}}class zT extends LT{constructor(t){super(t),this.decoderConfigPromise=null,this.internalTrack=t}getCodec(){return this.internalTrack.info.codec}getCodedWidth(){return this.internalTrack.info.width}getCodedHeight(){return this.internalTrack.info.height}getSquarePixelWidth(){return this.internalTrack.info.squarePixelWidth}getSquarePixelHeight(){return this.internalTrack.info.squarePixelHeight}getRotation(){return this.internalTrack.rotation}async getColorSpace(){var t,e,n,i;return{primaries:null===(t=this.internalTrack.info.colorSpace)||void 0===t?void 0:t.primaries,transfer:null===(e=this.internalTrack.info.colorSpace)||void 0===e?void 0:e.transfer,matrix:null===(n=this.internalTrack.info.colorSpace)||void 0===n?void 0:n.matrix,fullRange:null===(i=this.internalTrack.info.colorSpace)||void 0===i?void 0:i.fullRange}}async canBeTransparent(){return!1}async getDecoderConfig(){var t;return this.internalTrack.info.codec?null!==(t=this.decoderConfigPromise)&&void 0!==t?t:this.decoderConfigPromise=(async(t,e)=>{if("vp9"!==this.internalTrack.info.codec||this.internalTrack.info.vp9CodecInfo){if("av1"===this.internalTrack.info.codec&&!this.internalTrack.info.av1CodecInfo){const t=await this.getFirstPacket({});this.internalTrack.info.av1CodecInfo=t&&(t=>{for(const{type:e,data:n}of vT(t)){if(1!==e)continue;const t=new JI(n),i=t.readBits(3);t.readBits(1);const r=t.readBits(1);let o=0,s=0,a=0;if(r)o=t.readBits(5);else{if(t.readBits(1)&&(t.skipBits(32),t.skipBits(32),t.readBits(1)))return null;const e=t.readBits(1);e&&(a=t.readBits(5),t.skipBits(32),t.skipBits(5),t.skipBits(5));const n=t.readBits(5);for(let i=0;i<=n;i++){t.skipBits(12);const n=t.readBits(5);if(0===i&&(o=n),n>7){const e=t.readBits(1);0===i&&(s=e)}if(e&&t.readBits(1)){const e=a+1;t.skipBits(e),t.skipBits(e),t.skipBits(1)}t.readBits(1)&&t.skipBits(4)}}const l=t.readBits(4),c=t.readBits(4),u=l+1;t.skipBits(u);const d=c+1;t.skipBits(d);let h=0;if(h=r?0:t.readBits(1),h&&(t.skipBits(4),t.skipBits(3)),t.skipBits(1),t.skipBits(1),t.skipBits(1),!r){t.skipBits(1),t.skipBits(1),t.skipBits(1),t.skipBits(1);const e=t.readBits(1);e&&(t.skipBits(1),t.skipBits(1));let n=0;n=t.readBits(1)?2:t.readBits(1),n>0&&(t.readBits(1)||t.skipBits(1)),e&&t.skipBits(3)}t.skipBits(1),t.skipBits(1),t.skipBits(1);const f=t.readBits(1);let p=8;2===i&&f?p=t.readBits(1)?12:10:i<=2&&(p=f?10:8);let m=0;1!==i&&(m=t.readBits(1));let v=1,g=1,y=0;return m||(0===i?(v=1,g=1):1===i?(v=0,g=0):12===p&&(v=t.readBits(1),v&&(g=t.readBits(1))),v&&g&&(y=t.readBits(2))),{profile:i,level:o,tier:s,bitDepth:p,monochrome:m,chromaSubsamplingX:v,chromaSubsamplingY:g,chromaSamplePosition:y}}return null})(t.data)}}else{const t=await this.getFirstPacket({});this.internalTrack.info.vp9CodecInfo=t&&(t=>{const e=new JI(t);if(2!==e.readBits(2))return null;const n=e.readBits(1),i=(e.readBits(1)<<1)+n;if(3===i&&e.skipBits(1),1===e.readBits(1))return null;if(0!==e.readBits(1))return null;if(e.skipBits(2),4817730!==e.readBits(24))return null;let r=8;i>=2&&(r=e.readBits(1)?12:10);const o=e.readBits(3);let s=0,a=0;if(7!==o)if(a=e.readBits(1),1===i||3===i){const t=e.readBits(1),n=e.readBits(1);s=t||n?t&&!n?2:1:3,e.skipBits(1)}else s=1;else s=3,a=1;const l=(e.readBits(16)+1)*(e.readBits(16)+1);let c=TI(iT).level;for(const t of iT)if(l<=t.maxPictureSize){c=t.level;break}return{profile:i,level:c,bitDepth:r,chromaSubsampling:s,videoFullRangeFlag:a,colourPrimaries:2===o?1:1===o?6:2,transferCharacteristics:2===o?1:1===o?6:2,matrixCoefficients:7===o?0:2===o?1:1===o?6:2}})(t.data)}return{codec:rT(this.internalTrack.info),codedWidth:this.internalTrack.info.width,codedHeight:this.internalTrack.info.height,displayAspectWidth:this.internalTrack.info.squarePixelWidth,displayAspectHeight:this.internalTrack.info.squarePixelHeight,description:null!==(t=this.internalTrack.info.codecDescription)&&void 0!==t?t:void 0,colorSpace:null!==(e=this.internalTrack.info.colorSpace)&&void 0!==e?e:void 0}})():null}}class WT extends LT{constructor(t){super(t),this.decoderConfig=null,this.internalTrack=t}getCodec(){return this.internalTrack.info.codec}getNumberOfChannels(){return this.internalTrack.info.numberOfChannels}getSampleRate(){return this.internalTrack.info.sampleRate}async getDecoderConfig(){var t,e;return this.internalTrack.info.codec?null!==(t=this.decoderConfig)&&void 0!==t?t:this.decoderConfig={codec:oT(this.internalTrack.info),numberOfChannels:this.internalTrack.info.numberOfChannels,sampleRate:this.internalTrack.info.sampleRate,description:null!==(e=this.internalTrack.info.codecDescription)&&void 0!==e?e:void 0}:null}}const jT=(t,e)=>{if(t.presentationTimestamps){const n=WI(t.presentationTimestamps,e,(t=>t.presentationTimestamp));return-1===n?-1:t.presentationTimestamps[n].sampleIndex}{const n=WI(t.sampleTimingEntries,e,(t=>t.startDecodeTimestamp));if(-1===n)return-1;const i=t.sampleTimingEntries[n];return i.startIndex+Math.min(Math.floor((e-i.startDecodeTimestamp)/i.delta),i.count-1)}},$T=(t,e)=>{if(!t.keySampleIndices)return jT(t,e);if(t.presentationTimestamps){const n=WI(t.presentationTimestamps,e,(t=>t.presentationTimestamp));if(-1===n)return-1;for(let e=n;e>=0;e--){const n=t.presentationTimestamps[e].sampleIndex;if(-1!==zI(t.keySampleIndices,n,(t=>t)))return n}return-1}{var n;const i=jT(t,e),r=WI(t.keySampleIndices,i,(t=>t));return null!==(n=t.keySampleIndices[r])&&void 0!==n?n:-1}},UT=(t,e)=>{const n=WI(t.sampleTimingEntries,e,(t=>t.startIndex)),i=t.sampleTimingEntries[n];if(!i||i.startIndex+i.count<=e)return null;let r=i.startDecodeTimestamp+(e-i.startIndex)*i.delta;const o=WI(t.sampleCompositionTimeOffsets,e,(t=>t.startIndex)),s=t.sampleCompositionTimeOffsets[o];s&&e-s.startIndex<s.count&&(r+=s.offset);const a=t.sampleSizes[Math.min(e,t.sampleSizes.length-1)],l=WI(t.sampleToChunk,e,(t=>t.startSampleIndex)),c=t.sampleToChunk[l];II(c);const u=c.startChunkIndex+Math.floor((e-c.startSampleIndex)/c.samplesPerChunk),d=t.chunkOffsets[u],h=c.startSampleIndex+(u-c.startChunkIndex)*c.samplesPerChunk;let f=0,p=d;if(1===t.sampleSizes.length)p+=a*(e-h),f+=a*c.samplesPerChunk;else for(let n=h;n<h+c.samplesPerChunk;n++){const i=t.sampleSizes[n];n<e&&(p+=i),f+=i}let m=i.delta;if(t.presentationTimestamps){const n=t.presentationTimestampIndexMap[e];II(void 0!==n),n<t.presentationTimestamps.length-1&&(m=t.presentationTimestamps[n+1].presentationTimestamp-r)}return{presentationTimestamp:r,duration:m,sampleOffset:p,sampleSize:a,chunkOffset:d,chunkSize:f,isKeyFrame:!t.keySampleIndices||-1!==zI(t.keySampleIndices,e,(t=>t))}},qT=(t,e)=>{var n;if(!t.keySampleIndices)return e+1;const i=WI(t.keySampleIndices,e,(t=>t));return null!==(n=t.keySampleIndices[i+1])&&void 0!==n?n:-1},VT=(t,e)=>{t.startTimestamp+=e,t.endTimestamp+=e;for(const n of t.samples)n.presentationTimestamp+=e;for(const n of t.presentationTimestamps)n.presentationTimestamp+=e},GT=t=>{const[e,,,n]=t,i=Math.hypot(e,n),r=e/i,o=n/i,s=-Math.atan2(o,r)*(180/Math.PI);return Number.isFinite(s)?s:0},HT=t=>0===t.sampleSizes.length;class KT{}class XT extends KT{async _getMajorBrand(t){let e=t._reader.requestSlice(0,12);return e instanceof Promise&&(e=await e),e?(e.skip(4),"ftyp"!==pE(e,4)?null:pE(e,4)):null}_createDemuxer(t){return new BT(t)}}const YT=new class extends XT{async _canReadInput(t){const e=await this._getMajorBrand(t);return!!e&&"qt "!==e}get name(){return"MP4"}get mimeType(){return"video/mp4"}};class QT{constructor(){this._disposed=!1,this._sizePromise=null,this.onread=null}async getSizeOrNull(){var t;if(this._disposed)throw new tE;return null!==(t=this._sizePromise)&&void 0!==t?t:this._sizePromise=Promise.resolve(this._retrieveSize())}async getSize(){if(this._disposed)throw new tE;const t=await this.getSizeOrNull();if(null===t)throw new Error("Cannot determine the size of an unsized source.");return t}}class JT extends QT{constructor(t,e={}){var n;if(!(t instanceof ReadableStream))throw new TypeError("stream must be a ReadableStream.");if(!e||"object"!=typeof e)throw new TypeError("options must be an object.");if(void 0!==e.maxCacheSize&&(!XI(e.maxCacheSize)||e.maxCacheSize<0))throw new TypeError("options.maxCacheSize, when provided, must be a non-negative number.");super(),this._reader=null,this._cache=[],this._pendingSlices=[],this._currentIndex=0,this._targetIndex=0,this._maxRequestedIndex=0,this._endIndex=null,this._pulling=!1,this._stream=t,this._maxCacheSize=null!==(n=e.maxCacheSize)&&void 0!==n?n:16777216}_retrieveSize(){return this._endIndex}_read(t,e){if(null!==this._endIndex&&e>this._endIndex)return null;this._maxRequestedIndex=Math.max(this._maxRequestedIndex,e);const n=WI(this._cache,t,(t=>t.start)),i=-1!==n?this._cache[n]:null;if(i&&i.start<=t&&e<=i.end)return{bytes:i.bytes,view:i.view,offset:i.start};let r=t;const o=new Uint8Array(e-t);if(-1!==n)for(let i=n;i<this._cache.length;i++){const n=this._cache[i];if(n.start>=e)break;const s=Math.max(t,n.start);s>r&&this._throwDueToCacheMiss();const a=Math.min(e,n.end);s<a&&(o.set(n.bytes.subarray(s-n.start,a-n.start),s-t),r=a)}if(r===e)return{bytes:o,view:MI(o),offset:t};this._currentIndex>r&&this._throwDueToCacheMiss();const{promise:s,resolve:a,reject:l}=jI();return this._pendingSlices.push({start:t,end:e,bytes:o,resolve:a,reject:l}),this._targetIndex=Math.max(this._targetIndex,e),this._pulling||(this._pulling=!0,this._pull().catch((t=>{if(this._pulling=!1,!(this._pendingSlices.length>0))throw t;this._pendingSlices.forEach((e=>e.reject(t))),this._pendingSlices.length=0}))),s}_throwDueToCacheMiss(){throw new Error("Read is before the cached region. With ReadableStreamSource, you must access the data more sequentially or increase the size of its cache.")}async _pull(){for(null!==(t=this._reader)&&void 0!==t||(this._reader=this._stream.getReader());this._currentIndex<this._targetIndex&&!this._disposed;){var t;const{done:e,value:n}=await this._reader.read();if(e){for(const t of this._pendingSlices)t.resolve(null);this._pendingSlices.length=0,this._endIndex=this._currentIndex;break}const i=this._currentIndex,r=this._currentIndex+n.byteLength;for(let t=0;t<this._pendingSlices.length;t++){const e=this._pendingSlices[t],o=Math.max(i,e.start),s=Math.min(r,e.end);o<s&&(e.bytes.set(n.subarray(o-i,s-i),o-e.start),s===e.end&&(e.resolve({bytes:e.bytes,view:MI(e.bytes),offset:e.start}),this._pendingSlices.splice(t,1),t--))}for(this._cache.push({start:i,end:r,bytes:n,view:MI(n),age:0});this._cache.length>0;){const t=this._cache[0];if(this._maxRequestedIndex-t.end<=this._maxCacheSize)break;this._cache.shift()}this._currentIndex+=n.byteLength}this._pulling=!1}_dispose(){this._pendingSlices.length=0,this._cache.length=0}}null!==(ge=Symbol.dispose)&&void 0!==ge||(Symbol.dispose=Symbol("Symbol.dispose"));class ZT{get disposed(){return this._disposed}constructor(t){if(this._demuxerPromise=null,this._format=null,this._disposed=!1,!t||"object"!=typeof t)throw new TypeError("options must be an object.");if(!Array.isArray(t.formats)||t.formats.some((t=>!(t instanceof KT))))throw new TypeError("options.formats must be an array of InputFormat.");if(!(t.source instanceof QT))throw new TypeError("options.source must be a Source.");if(t.source._disposed)throw new Error("options.source must not be disposed.");this._formats=t.formats,this._source=t.source,this._reader=new eE(t.source)}_getDemuxer(){var t;return null!==(t=this._demuxerPromise)&&void 0!==t?t:this._demuxerPromise=(async()=>{this._reader.fileSize=await this._source.getSizeOrNull();for(const t of this._formats)if(await t._canReadInput(this))return this._format=t,t._createDemuxer(this);throw new Error("Input has an unsupported or unrecognizable format.")})()}get source(){return this._source}async getFormat(){return await this._getDemuxer(),II(this._format),this._format}async computeDuration(){return(await this._getDemuxer()).computeDuration()}async getFirstTimestamp(){const t=await this.getTracks();if(0===t.length)return 0;const e=await Promise.all(t.map((t=>t.getFirstTimestamp())));return Math.min(...e)}async getTracks(){return(await this._getDemuxer()).getTracks()}async getVideoTracks(){return(await this.getTracks()).filter((t=>t.isVideoTrack()))}async getAudioTracks(){return(await this.getTracks()).filter((t=>t.isAudioTrack()))}async getPrimaryVideoTrack(){var t;return null!==(t=(await this.getTracks()).find((t=>t.isVideoTrack())))&&void 0!==t?t:null}async getPrimaryAudioTrack(){var t;return null!==(t=(await this.getTracks()).find((t=>t.isAudioTrack())))&&void 0!==t?t:null}async getMimeType(){return(await this._getDemuxer()).getMimeType()}async getMetadataTags(){return(await this._getDemuxer()).getMetadataTags()}dispose(){this._disposed||(this._disposed=!0,this._source._disposed=!0,this._source._dispose())}[Symbol.dispose](){this.dispose()}}class tE extends Error{constructor(t="Input has been disposed."){super(t),this.name="InputDisposedError"}}class eE{constructor(t){this.source=t}requestSlice(t,e){if(this.source._disposed)throw new tE;if(t<0)return null;if(null!==this.fileSize&&t+e>this.fileSize)return null;const n=t+e,i=this.source._read(t,n);return i instanceof Promise?i.then((e=>e?new nE(e.bytes,e.view,e.offset,t,n):null)):i?new nE(i.bytes,i.view,i.offset,t,n):null}requestSliceRange(t,e,n){if(this.source._disposed)throw new tE;if(t<0)return null;if(null!==this.fileSize)return this.requestSlice(t,UI(this.fileSize-t,e,n));{const i=this.requestSlice(t,n),r=i=>{if(i)return i;const r=i=>(II(null!==i),this.requestSlice(t,UI(i-t,e,n))),o=this.source._retrieveSize();return o instanceof Promise?o.then(r):r(o)};return i instanceof Promise?i.then(r):r(i)}}}class nE{constructor(t,e,n,i,r){this.bytes=t,this.view=e,this.offset=n,this.start=i,this.end=r,this.bufferPos=i-n}static tempFromBytes(t){return new nE(t,MI(t),0,0,t.length)}get length(){return this.end-this.start}get filePos(){return this.offset+this.bufferPos}set filePos(t){this.bufferPos=t-this.offset}get remainingLength(){return Math.max(this.end-this.filePos,0)}skip(t){this.bufferPos+=t}slice(t,e=this.end-t){if(t<this.start||t+e>this.end)throw new RangeError("Slicing outside of original slice.");return new nE(this.bytes,this.view,this.offset,t,t+e)}}const iE=(t,e)=>{if(t.filePos<t.start||t.filePos+e>t.end)throw new RangeError(`Tried reading [${t.filePos}, ${t.filePos+e}), but slice is [${t.start}, ${t.end}). This is likely an internal error, please report it alongside the file that caused it.`)},rE=(t,e)=>{iE(t,e);const n=t.bytes.subarray(t.bufferPos,t.bufferPos+e);return t.bufferPos+=e,n},oE=t=>(iE(t,1),t.view.getUint8(t.bufferPos++)),sE=t=>{iE(t,2);const e=t.view.getUint16(t.bufferPos,!1);return t.bufferPos+=2,e},aE=t=>{iE(t,3);const e=$I(t.view,t.bufferPos);return t.bufferPos+=3,e},lE=t=>{iE(t,2);const e=t.view.getInt16(t.bufferPos,!1);return t.bufferPos+=2,e},cE=t=>{iE(t,4);const e=t.view.getUint32(t.bufferPos,!1);return t.bufferPos+=4,e},uE=t=>{iE(t,4);const e=t.view.getInt32(t.bufferPos,!1);return t.bufferPos+=4,e},dE=t=>4294967296*cE(t)+cE(t),hE=t=>4294967296*uE(t)+cE(t),fE=t=>{iE(t,8);const e=t.view.getFloat64(t.bufferPos,!1);return t.bufferPos+=8,e},pE=(t,e)=>{iE(t,e);let n="";for(let i=0;i<e;i++)n+=String.fromCharCode(t.bytes[t.bufferPos++]);return n};var mE=new WeakMap,vE=new WeakMap,gE=new WeakMap,yE=new WeakMap,bE=new WeakMap,kE=new WeakMap,xE=new WeakMap,wE=new WeakMap,_E=new WeakMap,IE=new WeakMap,TE=new WeakMap,EE=new WeakMap,SE=new WeakMap,ME=new WeakMap,AE=new WeakMap,NE=new WeakSet;class FE extends fh{constructor(...t){super(...t),$(this,NE),W(this,mE,null),W(this,vE,null),W(this,gE,null),W(this,yE,null),W(this,bE,!1),W(this,kE,!1),W(this,xE,!1),W(this,wE,!1),W(this,_E,void 0),W(this,IE,null),W(this,TE,null),W(this,EE,!1),W(this,SE,!1),W(this,ME,null),W(this,AE,!1)}get name(){return"FMP4Demuxer"}get defaults(){return{}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"pushChunk","endOfStream"])}pushChunk(t,e={}){if(z(xE,this)||z(wE,this))return;const n=t instanceof Uint8Array?t:new Uint8Array(t),i=!!e.isInit;j(IE,this,B(NE,this,BE).call(this,n,e,i)),i&&(j(_E,this,n),j(TE,this,null),this.trigger("demux:init",{data:n})),B(NE,this,DE).call(this);try{var r;const t=null===(r=z(mE,this))||void 0===r?void 0:r.write(n);t&&"function"==typeof t.catch&&t.catch((t=>{B(NE,this,LE).call(this,t)}))}catch(t){if(z(xE,this)||B(NE,this,CE).call(this,t))return;return this.log.warn("[FMP4Demuxer] mediabunny demux failed",t),void B(NE,this,LE).call(this,t)}const o=B(NE,this,jE).call(this);o&&"function"==typeof o.catch&&o.catch((t=>{B(NE,this,LE).call(this,t)}))}endOfStream(){if(z(wE,this))return;if(z(EE,this))return;let t;j(EE,this,!0),j(SE,this,!1),j(AE,this,!1);try{var e;t=null===(e=z(mE,this))||void 0===e?void 0:e.close()}catch(e){t=Promise.resolve()}let n=!1;B(NE,this,PE).call(this),j(ME,this,setTimeout((()=>{j(ME,this,null),n||z(SE,this)||z(wE,this)||B(NE,this,RE).call(this)}),20)),Promise.resolve(t).catch((()=>{})).finally((()=>{n=!0,B(NE,this,PE).call(this),B(NE,this,RE).call(this)}))}onDispose(){super.onDispose(),j(wE,this,!0);try{var t,e;null===(t=z(gE,this))||void 0===t||null===(e=t.close)||void 0===e||e.call(t)}catch(t){}this.endOfStream();try{var n,i;null===(n=z(vE,this))||void 0===n||null===(i=n.dispose)||void 0===i||i.call(n)}catch(t){}j(gE,this,null),j(vE,this,null),j(xE,this,!1),j(IE,this,null),j(yE,this,null),j(bE,this,!1),j(kE,this,!1),j(EE,this,!1),j(SE,this,!1),j(AE,this,!1),B(NE,this,PE).call(this)}}function CE(t){return!!z(wE,this)&&(!t||("InputDisposedError"===(null==t?void 0:t.name)||("string"==typeof(null==t?void 0:t.message)?t.message:"").includes("Input has been disposed")))}function OE(){try{var t,e;const n=null===(t=z(mE,this))||void 0===t||null===(e=t.close)||void 0===e?void 0:e.call(t);n&&"function"==typeof n.catch&&n.catch((()=>{}))}catch(t){}j(mE,this,null)}function PE(){null!==z(ME,this)&&(clearTimeout(z(ME,this)),j(ME,this,null))}function RE(){if(z(SE,this)||z(wE,this)||z(xE,this))return;if(j(SE,this,!0),z(kE,this))return void j(AE,this,!0);j(AE,this,!1);const t=B(NE,this,jE).call(this);t&&"function"==typeof t.catch&&t.catch((t=>{B(NE,this,LE).call(this,t)}))}function DE(){if(z(vE,this)&&z(mE,this))return;const t=vh.TransformStream;if(void 0===t)throw new Error("TransformStream is not available in this environment");const{readable:e,writable:n}=new t;j(mE,this,n.getWriter()),j(vE,this,new ZT({source:new JT(e),formats:[YT]})),j(bE,this,!1)}function BE(t,e,n){const i={isInit:n,byteLength:(null==t?void 0:t.byteLength)||0};return"number"==typeof e.loaded&&(i.loaded=e.loaded),"number"==typeof e.total&&(i.total=e.total),"number"==typeof e.pts&&(i.pts=e.pts),"number"==typeof e.dts&&(i.dts=e.dts),"number"==typeof e.duration&&(i.duration=e.duration),"boolean"==typeof e.isKey&&(i.isKey=e.isKey),i}function LE(t){if(z(xE,this)||B(NE,this,CE).call(this,t))return;if(B(NE,this,WE).call(this,t))return void j(bE,this,!1);j(xE,this,!0),B(NE,this,OE).call(this);try{var e,n;null===(e=z(gE,this))||void 0===e||null===(n=e.close)||void 0===n||n.call(e)}catch(t){}j(gE,this,null);try{var i,r;null===(i=z(vE,this))||void 0===i||null===(r=i.dispose)||void 0===r||r.call(i)}catch(t){}j(vE,this,null);const o={error:t,recoverable:!1,severity:"fatal",streamClosed:z(EE,this),streamFinalized:z(SE,this)};z(IE,this)&&(o.context={...z(IE,this)}),this.trigger("demux:error",o)}function zE(t){if(!t)return!1;const e="string"==typeof(null==t?void 0:t.message)?t.message:"";return!!e&&(e.includes("unsupported or unrecognizable format")||e.includes("No supported tracks found"))}function WE(t){return!!B(NE,this,zE).call(this,t)&&(!z(SE,this)||z(AE,this))}async function jE(){if(!(z(wE,this)||z(xE,this)||z(bE,this)||z(kE,this))){j(kE,this,!0);try{B(NE,this,DE).call(this);const t=await z(vE,this).getPrimaryVideoTrack(),e=t?null:await z(vE,this).getPrimaryAudioTrack(),n=t||e;if(!n)throw new Error("No supported tracks found in MP4");const i=await n.getDecoderConfig(),r=await n.getCodecParameterString(),o=await z(vE,this).getMimeType();this.trigger("demux:init",{...z(_E,this)?{data:z(_E,this)}:{},decoderConfig:i,codec:r,mimeType:o}),j(gE,this,new ST(n)),j(bE,this,!0),j(yE,this,(async()=>{try{for await(const t of z(gE,this).packets()){if(z(wE,this))break;const e="number"==typeof t.timestamp?t.timestamp:0;null===z(TE,this)&&j(TE,this,e);let n=e-z(TE,this);n<0&&(n=0),this.trigger("demux:sample",{data:t.data,pts:n,dts:n,duration:t.duration,isKey:"key"===t.type})}this.trigger("demux:complete")}catch(t){B(NE,this,LE).call(this,t)}})())}catch(t){if(B(NE,this,WE).call(this,t))return;throw t}finally{j(kE,this,!1),!z(AE,this)||z(xE,this)||z(wE,this)||B(NE,this,RE).call(this)}}}const $E=1e6,UE=24e3/1001,qE={primaries:"bt709",transfer:"bt709",matrix:"bt709",fullRange:!0},VE=new Uint8Array;function GE(t){return t?t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):VE:VE}let HE=null;const KE={video:(ye=new WeakMap,be=new WeakMap,ke=new WeakMap,xe=new WeakMap,we=new WeakMap,_e=new WeakMap,Ie=new WeakMap,Te=new WeakMap,Ee=new WeakMap,Se=new WeakMap,Me=new WeakMap,Ae=new WeakMap,Ne=new WeakMap,Fe=new WeakMap,Ce=new WeakMap,Oe=new WeakMap,Pe=new WeakMap,Re=new WeakMap,De=new WeakMap,Be=new WeakMap,Le=new WeakMap,ze=new WeakMap,We=new WeakMap,je=new WeakMap,$e=new WeakMap,Ue=new WeakMap,qe=new WeakMap,Ve=new WeakMap,Ge=new WeakMap,He=new WeakMap,Ke=new WeakMap,Xe=new WeakMap,Ye=new WeakMap,Qe=new WeakMap,Je=new WeakSet,class extends _I{get name(){return"WebCodecsSegmentDecoder"}get defaults(){return{decodedHorizonSeconds:1,maxDecodedFrames:24,maxDecodeQueueSize:4,av1ColorSpaceOverrideEnabled:!0,convertFramesToBitmapsOnAndroid:!0,androidFixEndOfSegmentDelta:.2}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"decodeChunk"])}constructor(...t){super(...t),$(this,Je),W(this,ye,void 0),W(this,be,[]),W(this,ke,void 0),W(this,xe,void 0),W(this,we,void 0),W(this,_e,void 0),W(this,Ie,[]),W(this,Te,void 0),W(this,Ee,new Map),W(this,Se,!0),W(this,Me,!1),W(this,Ae,!1),W(this,Ne,!1),W(this,Fe,void 0),W(this,Ce,!1),W(this,Oe,!1),W(this,Pe,0),W(this,Re,void 0),W(this,De,void 0),W(this,Be,{}),W(this,Le,void 0),W(this,ze,0),W(this,We,null),W(this,je,!1),W(this,$e,null),W(this,Ue,void 0),W(this,qe,0),W(this,Ve,0),W(this,Ge,0),W(this,He,0),W(this,Ke,!1),W(this,Xe,!1),W(this,Ye,.2),W(this,Qe,Promise.resolve()),j(ke,this,this.settings.decodedHorizonSeconds||1),j(xe,this,B(Je,this,zS).call(this,this.settings.maxDecodedFrames)),j(we,this,B(Je,this,jS).call(this,this.settings.maxDecodeQueueSize)),j(Ke,this,_g()),j(Xe,this,B(Je,this,FS).call(this,this.settings.convertFramesToBitmapsOnAndroid)),j(Ye,this,B(Je,this,CS).call(this,this.settings.androidFixEndOfSegmentDelta)),j(_e,this,(()=>0)),j(Te,this,(()=>B(Je,this,xS).call(this)));const e=this.settings.demuxerOptions?{FMP4Demuxer:this.settings.demuxerOptions}:{};j(ye,this,new FE(e)),z(ye,this).on("demux:init",(t=>B(Je,this,dS).call(this,t))),z(ye,this).on("demux:sample",(t=>B(Je,this,hS).call(this,t))),z(ye,this).on("demux:complete",(()=>B(Je,this,fS).call(this))),z(ye,this).on("demux:error",(t=>B(Je,this,tS).call(this,t)))}setCurrentTimeProvider(t){"function"==typeof t&&j(_e,this,t)}setTimeOffsetSeconds(t){const e=Number(t);j(ze,this,Number.isFinite(e)?e:0)}setSeekTargetTimeSeconds(t){const e=Number(t);j(We,this,Number.isFinite(e)?e:null),j(je,this,!1),j($e,this,null)}endOfStream(){z(ye,this)&&"function"==typeof z(ye,this).endOfStream&&z(ye,this).endOfStream()}configure(t){super.configure(t),j(Be,this,{codec:B(Je,this,GS).call(this,t),width:(null==t?void 0:t.codedWidth)||(null==t?void 0:t.width),height:(null==t?void 0:t.codedHeight)||(null==t?void 0:t.height)}),j(Re,this,z(Be,this).codec)}setSegment(t){this.lastSegment=t,B(Je,this,aS).call(this)}setNodeId(t){j(Ue,this,t)}decode(t){this.setSegment(t);const e=null==t?void 0:t.arrayBuffer;e&&z(ye,this).pushChunk(e,{isInit:!(null==t||!t.isInit)})}async decodeChunk(t,e={}){await z(ye,this).pushChunk(t,{isInit:!!e.isInit,pts:"number"==typeof e.pts?e.pts:void 0,dts:"number"==typeof e.dts?e.dts:void 0,duration:"number"==typeof e.duration?e.duration:void 0,isKey:!!e.isKey,loaded:"number"==typeof e.loaded?e.loaded:void 0,total:"number"==typeof e.total?e.total:void 0})}get decodedFrames(){return z(be,this).slice()}onDispose(){if(super.onDispose(),B(Je,this,IS).call(this),z(ye,this)&&"function"==typeof z(ye,this).dispose&&z(ye,this).dispose(),j(be,this,[]),j(Ie,this,[]),z(Ee,this).clear(),j($e,this,null),z(Fe,this)&&"function"==typeof z(Fe,this).close)try{z(Fe,this).close()}catch(t){}j(Fe,this,null),j(Ce,this,!1),j(De,this,null),j(Re,this,null),j(Ue,this,null),j(Qe,this,Promise.resolve()),B(Je,this,aS).call(this)}}),audio:(Ze=new WeakMap,tn=new WeakMap,en=new WeakMap,nn=new WeakMap,rn=new WeakMap,on=new WeakMap,sn=new WeakMap,an=new WeakSet,class extends _I{constructor(...t){super(...t),$(this,an),W(this,Ze,void 0),W(this,tn,[]),W(this,en,0),W(this,nn,!1),W(this,rn,!1),W(this,on,void 0),W(this,sn,0)}get name(){return"WebAudioDecoder"}setSegment(t){j(on,this,t)}setTimeOffsetSeconds(t){const e=Number(t);j(sn,this,Number.isFinite(e)?e:0)}decode(t){if(this.lastSegment=t,!t)return;if(t.isInit)return void j(Ze,this,GE(t.arrayBuffer));const e=t.arrayBuffer;e&&B(an,this,QE).call(this,GE(e),!0)}decodeChunk(t,e={}){if(!t)return;if(e.isInit)return void j(Ze,this,GE(t));const n=GE(t);if(!n.length)return;z(tn,this).push(n),j(en,this,z(en,this)+n.length);const i=Number(e.loaded),r=Number(e.total);Number.isFinite(i)&&Number.isFinite(r)&&r>0&&i>=r&&B(an,this,XE).call(this)}endOfStream(){B(an,this,XE).call(this)}onDispose(){super.onDispose(),j(Ze,this,void 0),j(tn,this,[]),j(en,this,0),j(nn,this,!1),j(rn,this,!1),j(on,this,void 0)}}),image:class extends _I{#z;#W=0;#j=[];#$=0;#U;get name(){return"ImageDecoder"}setSegment(t){this.#z=t}setTimeOffsetSeconds(t){const e=Number(t);this.#W=Number.isFinite(e)?e:0}decode(t){super.decode(t),t&&(this.#z=t);const e=null==t?void 0:t.arrayBuffer;e instanceof ArrayBuffer&&(this.#j=[new Uint8Array(e)],this.#$=e.byteLength,this.endOfStream())}decodeChunk(t,e={}){if(null!=e&&e.isInit)return;const n=function(t){if(t)return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):ArrayBuffer.isView(t)&&t.buffer?new Uint8Array(t.buffer):void 0}(t);n&&n.length&&(this.#j.push(n),this.#$+=n.length)}async endOfStream(){var t,e,n;if(this.#U)return;if(!(this.#j.length&&this.#$>0))return;const i=new Uint8Array(this.#$);let r=0;for(let t=0;t<this.#j.length;t+=1){const e=this.#j[t];i.set(e,r),r+=e.length}const o=null===(t=this.#z)||void 0===t?void 0:t.chosenRepresentation,s=(null==o?void 0:o.mime)||(null===(e=this.track)||void 0===e?void 0:e.mimeType)||(null===(n=this.track)||void 0===n?void 0:n.mime)||function(t){if(t instanceof Uint8Array&&!(t.byteLength<4))return t.byteLength>=8&&137===t[0]&&80===t[1]&&78===t[2]&&71===t[3]&&13===t[4]&&10===t[5]&&26===t[6]&&10===t[7]?"image/png":255===t[0]&&216===t[1]&&255===t[2]?"image/jpeg":t.byteLength>=6&&71===t[0]&&73===t[1]&&70===t[2]&&56===t[3]?"image/gif":t.byteLength>=12&&82===t[0]&&73===t[1]&&70===t[2]&&70===t[3]&&87===t[8]&&69===t[9]&&66===t[10]&&80===t[11]?"image/webp":void 0}(i);try{var a,l;const t=await async function(t,e){const n=function(t,e){if(!(t&&t.byteLength>0))return;if("function"!=typeof vh.Blob)return;const n="string"==typeof e?e:"";return new vh.Blob([t],n?{type:n}:void 0)}(t,e);if(!n)throw new Error("Image decode requires Blob support");let i;if("function"==typeof vh.Image&&vh.URL&&"function"==typeof vh.URL.createObjectURL&&"function"==typeof vh.URL.revokeObjectURL){const t=vh.URL.createObjectURL(n);try{const e=new vh.Image;return await new Promise(((n,i)=>{e.onload=()=>n(),e.onerror=t=>i(t||new Error("Image decode failed")),e.src=t})),e}catch(t){i=t}finally{vh.URL.revokeObjectURL(t)}}if("function"==typeof vh.createImageBitmap)try{return vh.createImageBitmap(n)}catch(t){i=t}if(i)throw i;throw new Error("No supported image decode mechanism")}(i,s);this.#U=t;const e=function(t){if(!t)return;const e=[[t.naturalWidth,t.naturalHeight],[t.width,t.height],[t.displayWidth,t.displayHeight],[t.videoWidth,t.videoHeight],[t.codedWidth,t.codedHeight]];for(let t=0;t<e.length;t+=1){const[n,i]=e[t],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}(t);e&&o&&(fb(o.width)||(o.width=e.width),fb(o.height)||(o.height=e.height)),this.trigger("decoder:frame",{pts:this.#W,duration:fb(null===(a=this.#z)||void 0===a?void 0:a.duration)?this.#z.duration:null===(l=this.track)||void 0===l?void 0:l.duration,frame:t})}catch(t){this.trigger("decoder:error",{error:t})}}onDispose(){if(super.onDispose(),this.#U&&"function"==typeof this.#U.close)try{this.#U.close()}catch(t){}this.#U=null,this.#j=[],this.#$=0,this.#z=null}}};function XE(){if(z(nn,this)||z(rn,this))return;if(!z(en,this))return;const t=B(an,this,YE).call(this);t.length&&B(an,this,QE).call(this,t,!1)}function YE(){const t=z(Ze,this),e=t?t.length:0,n=e+z(en,this);if(!n)return VE;const i=new Uint8Array(n);let r=0;e&&(i.set(t,r),r+=e);for(let t=0;t<z(tn,this).length;t+=1){const e=z(tn,this)[t];e&&e.length&&(i.set(e,r),r+=e.length)}return i}function QE(t,e){if(z(nn,this)||z(rn,this))return;const n=e?B(an,this,JE).call(this,t):t;if(!n||!n.length)return;const i=function(){if(HE)return HE;const t=vh.AudioContext||vh.webkitAudioContext;return t?(HE=new t,HE):null}();if(!i||"function"!=typeof i.decodeAudioData)return void this.trigger("decoder:error",{error:new Error("AudioContext is not available")});const r=n.buffer.slice(0);j(rn,this,!0),new Promise(((t,e)=>{const n=i.decodeAudioData(r,t,e);n&&"function"==typeof n.then&&n.then(t).catch(e)})).then((t=>{var e;j(nn,this,!0);const n=Number.isFinite(null==t?void 0:t.duration)?t.duration:Number(null===(e=z(on,this))||void 0===e?void 0:e.duration)||void 0;this.trigger("decoder:audio",{audioBuffer:t,pts:z(sn,this),duration:n})})).catch((t=>{this.trigger("decoder:error",{error:t})})).finally((()=>{j(tn,this,[]),j(en,this,0),j(rn,this,!1)}))}function JE(t){const e=z(Ze,this);if(!e||!e.length)return t;const n=e.length+t.length,i=new Uint8Array(n);return i.set(e,0),i.set(t,e.length),i}function ZE(t,e){var n,i,r,o,s;const a=null!=t&&t.context&&"object"==typeof t.context?t.context:void 0;return{error:e,errorName:null==e?void 0:e.name,errorMessage:"string"==typeof(null==e?void 0:e.message)?e.message:void 0,nodeId:z(Ue,this),trackId:null===(n=this.track)||void 0===n?void 0:n.id,trackType:null===(i=this.track)||void 0===i?void 0:i.type,codec:(null===(r=z(Be,this))||void 0===r?void 0:r.codec)||z(Re,this),segmentId:null===(o=this.lastSegment)||void 0===o?void 0:o.id,segmentIsInit:!(null===(s=this.lastSegment)||void 0===s||!s.isInit),chunkContext:a}}function tS(t){const e=(null==t?void 0:t.error)||t,n=B(Je,this,ZE).call(this,t,e);if(B(Je,this,eS).call(this,t,e))return this.log.warn("[onDemuxError] recoverable demux error",n),void B(Je,this,fS).call(this);const i=B(Je,this,uS).call(this,t),r=B(Je,this,nS).call(this,i);if(i&&0===i.missingFrames)return this.log.warn(`[onDemuxError] ignoring demux error (no missing frames)${r}`,{...n,missingFrameStats:i}),void B(Je,this,fS).call(this);let o=n;i&&(o={...n,missingFrameStats:i}),this.log.warn(`[onDemuxError] demux error${r}`,o),this.trigger("decoder:error",t)}function eS(t,e){if("boolean"==typeof(null==t?void 0:t.recoverable))return t.recoverable;const n="string"==typeof(null==t?void 0:t.severity)?t.severity:"";if(n)return"recoverable"===n||"transient"===n;const i="string"==typeof(null==e?void 0:e.message)?e.message:"";return!!i&&(i.includes("unsupported or unrecognizable format")||i.includes("No supported tracks found"))}function nS(t){return t?` expectedFrames=${B(Je,this,iS).call(this,t.expectedFrames)} demuxedFrames=${B(Je,this,iS).call(this,t.demuxedFrames)} missingFrames=${B(Je,this,iS).call(this,t.missingFrames)}`:""}function iS(t){if(null==t)return"unknown";const e=Number(t);return Number.isFinite(e)?String(e):"unknown"}function rS(t,e={}){return{expectedFrames:null,demuxedFrames:z(qe,this),missingFrames:null,reason:t,...e}}function oS(t){const e=Number(t);return Number.isFinite(e)?e:null}function sS(t){var e,n;const i=(null==t?void 0:t.context)||{},r=Number(i.loaded),o=Number(i.total);if(!Number.isFinite(o)||o<=0||!Number.isFinite(r)||r<o)return null;if(null!==(e=this.lastSegment)&&void 0!==e&&e.isInit)return null;const s=Number(null===(n=this.lastSegment)||void 0===n?void 0:n.duration);if(!Number.isFinite(s)||s<=0)return B(Je,this,rS).call(this,"segment_duration_unavailable",{segmentDurationSeconds:B(Je,this,oS).call(this,s),demuxedCoverageSeconds:z(He,this),frameDurationSeconds:null});const a=B(Je,this,cS).call(this);if(!Number.isFinite(a)||a<=0){const t=Math.max(1,Math.round(s*UE));return{expectedFrames:t,demuxedFrames:z(qe,this),missingFrames:Math.max(0,t-z(qe,this)),reason:"fallback_fps",fallbackFps:UE,segmentDurationSeconds:s,demuxedCoverageSeconds:z(He,this),frameDurationSeconds:B(Je,this,oS).call(this,a)}}const l=Math.min(.5*a,.02),c=Math.max(0,s-z(He,this)),u=c<=l?0:c,d=Math.max(1,Math.floor((s+l)/a)),h=Math.max(0,d-z(qe,this)),f=u>0?Math.ceil(u/a):0;return{expectedFrames:d,demuxedFrames:z(qe,this),missingFrames:Math.max(h,f),segmentDurationSeconds:s,demuxedCoverageSeconds:z(He,this),frameDurationSeconds:a}}function aS(){j(qe,this,0),j(Ve,this,0),j(Ge,this,0),j(He,this,0)}function lS(t){j(qe,this,z(qe,this)+1);const e=Number(null==t?void 0:t.pts),n=Number(null==t?void 0:t.duration);if(Number.isFinite(n)&&n>0&&(j(Ve,this,z(Ve,this)+n),j(Ge,this,z(Ge,this)+1)),!Number.isFinite(e))return;const i=Number.isFinite(n)&&n>0?e+n:e;Number.isFinite(i)&&i>z(He,this)&&j(He,this,i)}function cS(){return z(Ge,this)>0?z(Ve,this)/z(Ge,this):z(qe,this)>0&&z(He,this)>0?z(He,this)/z(qe,this):null}function uS(t){return B(Je,this,sS).call(this,t)}function dS(t){(null==t?void 0:t.data)instanceof Uint8Array&&(j(De,this,t.data.buffer),B(Je,this,ES).call(this)),null!=t&&t.decoderConfig&&(j(Le,this,t.decoderConfig),j(Re,this,t.decoderConfig.codec||z(Re,this)),B(Je,this,ES).call(this)),this.trigger("decoder:init",t)}function hS(t){B(Je,this,lS).call(this,t),z(Ie,this).push(t),B(Je,this,xS).call(this)}function fS(){j(Me,this,!0),B(Je,this,MS).call(this)}function pS(t){const e="number"==typeof(null==t?void 0:t.pts)?t.pts:void 0;if(Number.isFinite(e))return z(ze,this)+e}function mS(t){return z(Ie,this).some((e=>{const n=B(Je,this,pS).call(this,e);return Number.isFinite(n)&&n>=t}))}function vS(t){let e=-1,n=null;for(let i=0;i<z(Ie,this).length;i+=1){const r=z(Ie,this)[i],o=B(Je,this,pS).call(this,r);Number.isFinite(o)&&(null==r?void 0:r.isKey)&&o<=t&&(e=i,n=o)}return{chosenIndex:e,chosenPtsSeconds:n}}function gS(t){let e=-1,n=null;for(let i=0;i<z(Ie,this).length;i+=1){const r=z(Ie,this)[i],o=B(Je,this,pS).call(this,r);if(Number.isFinite(o)&&null!=r&&r.isKey&&(e=i,n=o,o>=t))break}return{chosenIndex:e,chosenPtsSeconds:n}}function yS(t){const e=t+z(ke,this),n=z(We,this);if(!Number.isFinite(n))return e;const i=Number.isFinite(z($e,this))?z($e,this):null;if(Number.isFinite(i))return Math.max(e,i);const{chosenPtsSeconds:r}=B(Je,this,gS).call(this,n);return Number.isFinite(r)?Math.max(e,r):e}function bS(t){const e=z(We,this);Number.isFinite(e)&&Number.isFinite(t)&&t>=e&&(j(We,this,null),j($e,this,null))}function kS(){const t=z(We,this);if(!Number.isFinite(t)||z(je,this))return!0;if(!B(Je,this,mS).call(this,t)&&!z(Me,this))return!1;const e=B(Je,this,vS).call(this,t);let n=e;if(-1===e.chosenIndex&&(n=B(Je,this,gS).call(this,t)),n.chosenIndex>0){const t=`[#maybeAlignToSeekKeyframe] Dropping ${n.chosenIndex} samples before keyframe @ ${n.chosenPtsSeconds}`;this.log.debug(t),z(Ie,this).splice(0,n.chosenIndex)}return j(Se,this,!0),Number.isFinite(n.chosenPtsSeconds)&&j($e,this,n.chosenPtsSeconds),j(je,this,!0),!0}function xS(){const t=z(_e,this)?z(_e,this).call(this):0,e=B(Je,this,yS).call(this,t);if(B(Je,this,BS).call(this,t),B(Je,this,LS).call(this),!B(Je,this,kS).call(this))return void B(Je,this,_S).call(this);const n=void 0!==vh.VideoDecoder&&void 0!==vh.EncodedVideoChunk;for(n&&!z(Ce,this)&&z(Le,this)&&B(Je,this,ES).call(this);z(Ie,this).length&&!B(Je,this,WS).call(this)&&!(n&&z(Fe,this)&&B(Je,this,$S).call(this));){const t=z(Ie,this)[0],i="number"==typeof(null==t?void 0:t.pts)?t.pts:0,r=z(ze,this)+i;if(r>e)break;if(null!=t&&t.raw)z(Ie,this).shift(),B(Je,this,wS).call(this,t);else{if(n){if(!z(Ce,this)||!z(Fe,this))break;if(z(Se,this)&&!t.isKey){z(Ie,this).shift();continue}z(Ie,this).shift();const e=Math.max(0,Math.round(r*$E));z(Ee,this).set(e,!!t.isKey);try{const n=new vh.EncodedVideoChunk({type:t.isKey?"key":"delta",timestamp:e,duration:t.duration?Math.round(t.duration*$E):void 0,data:t.data instanceof Uint8Array?t.data:new Uint8Array(t.data)});z(Fe,this).decode(n),t.isKey&&j(Se,this,!1);continue}catch(t){z(Ee,this).delete(e);const n="string"==typeof(null==t?void 0:t.message)?t.message:"";if("DataError"===(null==t?void 0:t.name)&&n.includes("key frame")){j(Se,this,!0);continue}this.log.warn("[#drainDecodeQueue] decode failed, falling back to placeholder",t)}}z(Ie,this).shift(),B(Je,this,wS).call(this,t)}}B(Je,this,MS).call(this),B(Je,this,_S).call(this)}function wS(t){const e=z(_e,this)?z(_e,this).call(this):0,n=B(Je,this,yS).call(this,e),i=z(ze,this)+("number"==typeof t.pts?t.pts:0);if(i<e||i>n)return;B(Je,this,BS).call(this,e);const r={pts:i,duration:t.duration,data:t.data,isKey:t.isKey};z(be,this).push(r),B(Je,this,LS).call(this),this.trigger("decoder:frame",r),B(Je,this,bS).call(this,i)}function _S(){if(z(Ie,this).length>0&&void 0!==vh.VideoDecoder){if(Fw(z(Te,this)))return;Aw(z(Te,this),50)}else B(Je,this,IS).call(this)}function IS(){z(Te,this)&&Fw(z(Te,this))&&Nw(z(Te,this))}function TS(){return null!=vh&&vh.performance&&"function"==typeof vh.performance.now?vh.performance.now():Date.now()}function ES(){if(z(Ce,this))return;if(void 0===vh.VideoDecoder)return;if(!z(Le,this))return;if(z(Oe,this)&&B(Je,this,TS).call(this)<z(Pe,this))return;const t=B(Je,this,SS).call(this);try{j(Fe,this,new vh.VideoDecoder({output:t=>B(Je,this,NS).call(this,t),error:t=>B(Je,this,AS).call(this,t)})),z(Fe,this).configure(t),j(Ce,this,!0),j(Se,this,!0),j(Oe,this,!1),j(Pe,this,0),B(Je,this,xS).call(this)}catch(t){this.log.warn("[#maybeConfigureDecoder] configure failed, falling back to placeholder decode",t),j(Fe,this,null),j(Ce,this,!1),j(Le,this,null)}}function SS(){const t={...z(Le,this)};return B(Je,this,qS).call(this,t)&&z(Be,this).codec?t.codec=z(Be,this).codec:!t.codec&&z(Re,this)&&(t.codec=z(Re,this)),z(De,this)&&!t.description&&(t.description=z(De,this)),z(Be,this).width&&!t.codedWidth&&(t.codedWidth=z(Be,this).width),z(Be,this).height&&!t.codedHeight&&(t.codedHeight=z(Be,this).height),B(Je,this,VS).call(this,t),t}function MS(){void 0!==vh.VideoDecoder&&void 0!==vh.EncodedVideoChunk&&(z(Oe,this)||!z(Me,this)||z(Ne,this)||z(Ae,this)||z(Ce,this)&&z(Fe,this)&&"function"==typeof z(Fe,this).flush&&(z(Ie,this).length||(j(Ae,this,!0),Promise.resolve().then((()=>z(Fe,this).flush())).then((()=>{j(Ne,this,!0),j(Se,this,!0)})).catch((t=>{"AbortError"!==(null==t?void 0:t.name)&&this.log.warn("[#maybeFlushDecoder] flush failed",t)})).finally((()=>{j(Ae,this,!1)})))))}function AS(t){if(this.log.warn("[#handleDecoderError] decoder error",t),this.trigger("decoder:error",{error:t}),z(Fe,this)&&"function"==typeof z(Fe,this).close)try{z(Fe,this).close()}catch(t){}j(Fe,this,null),j(Ce,this,!1),j(Ae,this,!1),j(Ne,this,!1),j(Se,this,!0),z(Ee,this).clear(),j(Oe,this,!0),j(Pe,this,B(Je,this,TS).call(this)+1e3)}function NS(t){j(Qe,this,z(Qe,this).then((()=>{var e;if(!this._disposed)return B(Je,this,DS).call(this,t);null===(e=t.close)||void 0===e||e.call(t)})).catch((e=>{this.log.warn("[#enqueueDecodedFrame] failed processing decoded frame",e);try{var n;null===(n=t.close)||void 0===n||n.call(t)}catch(t){}})))}function FS(t){return"boolean"!=typeof t||t}function CS(t){const e=Number(t);return!Number.isFinite(e)||e<0?.2:e}function OS(){return!!z(Xe,this)&&"function"==typeof vh.createImageBitmap&&z(Ke,this)}function PS(t){var e;const n=Number(null===(e=this.lastSegment)||void 0===e?void 0:e.duration);if(!Number.isFinite(n)||n<=0)return!1;if(!Number.isFinite(t))return!1;const i=Number(z(ze,this));return!!Number.isFinite(i)&&t>=i+n-z(Ye,this)}async function RS(t,e){try{var n;const i=B(Je,this,PS).call(this,e),r=await vh.createImageBitmap(t,{premultiplyAlpha:i?"none":"default"});return null!==(n=t.close)&&void 0!==n&&n.call(t),r}catch(e){return this.log.debug("[#maybeConvertFrameToBitmap] createImageBitmap failed",e),t}}async function DS(t){var e,n;let i=t;if(this._disposed)return void(null===(e=(n=i).close)||void 0===e||e.call(n));const r="number"==typeof t.timestamp?t.timestamp:void 0,o="number"==typeof t.timestamp?t.timestamp/$E:z(_e,this)?z(_e,this).call(this):0,s="number"==typeof t.duration?t.duration/$E:void 0;let a;void 0!==r&&(a=z(Ee,this).get(r),z(Ee,this).delete(r));try{var l,c,u,d;let e=z(_e,this)?z(_e,this).call(this):0,n=B(Je,this,yS).call(this,e);if(o<e||o>n)return void(null===(l=(c=i).close)||void 0===l||l.call(c));if(B(Je,this,OS).call(this)){var h,f,p,m;if(i=await B(Je,this,RS).call(this,t,o),this._disposed)return void(null===(h=(f=i).close)||void 0===h||h.call(f));if(e=z(_e,this)?z(_e,this).call(this):0,n=B(Je,this,yS).call(this,e),o<e||o>n)return void(null===(p=(m=i).close)||void 0===p||p.call(m))}if(B(Je,this,BS).call(this,e),this._disposed)return void(null===(u=(d=i).close)||void 0===u||u.call(d));const r={frame:i,pts:o,duration:s,isKey:void 0!==a&&a};z(be,this).push(r),B(Je,this,LS).call(this),this.trigger("decoder:frame",r),B(Je,this,bS).call(this,o),this.log.debug(`[#handleDecodedFrame] [${z(Be,this).codec}] Decoded frame:`,r)}catch(t){this.log.warn(`[#handleDecodedFrame] [${z(Be,this).codec}] Failed to handle decoded frame`,t);try{var v,g;null===(v=(g=i).close)||void 0===v||v.call(g)}catch(t){}}}function BS(t){const e=B(Je,this,yS).call(this,t),n=[];z(be,this).forEach((i=>{var r;const o=null!==(r=null==i?void 0:i.pts)&&void 0!==r?r:0;o<t||o>e||n.push(i)})),j(be,this,n)}function LS(){const t=z(xe,this);if(!Number.isFinite(t)||t<=0)return;if(z(be,this).length<=t)return;const e=z(be,this).length-t;z(be,this).splice(0,e)}function zS(t){const e=Number(t);return!Number.isFinite(e)||e<=0?0:Math.floor(e)}function WS(){const t=z(xe,this);return!(!Number.isFinite(t)||t<=0)&&z(be,this).length>=t}function jS(t){const e=Number(t);return!Number.isFinite(e)||e<=0?0:Math.floor(e)}function $S(){var t;const e=z(we,this);if(!Number.isFinite(e)||e<=0)return!1;const n=Number(null===(t=z(Fe,this))||void 0===t?void 0:t.decodeQueueSize);return!!Number.isFinite(n)&&n>=e}function US(t){return"string"==typeof t&&t.toLowerCase().startsWith("av01")}function qS(t){var e;return!1!==this.settings.av1ColorSpaceOverrideEnabled&&B(Je,this,US).call(this,(null===(e=z(Be,this))||void 0===e?void 0:e.codec)||(null==t?void 0:t.codec))}function VS(t){B(Je,this,qS).call(this,t)&&(t.colorSpace={...qE})}function GS(t){if(t&&Array.isArray(t.segments))for(let e=0;e<t.segments.length;e+=1){const n=t.segments[e];if(!Array.isArray(null==n?void 0:n.representations))continue;const i=n.chosenRepresentation||n.representations[0];if(null!=i&&i.codecs)return i.codecs;if(null!=i&&i.mime)return i.mime}}class HS extends fh{#q;get name(){return"DecoderFactory"}constructor(...t){super(...t);const e=t.length?t[t.length-1]:void 0;this.#q=e&&"object"==typeof e&&!Array.isArray(e)?e:{}}create(t,e=this.#q){if(!t||!t.type)return new _I(e);const n=KE[t.type];return n?(this.log.debug(`[#create] [${t.type}] Creating decoder:`,n),new n(e)):new _I(e)}}class KS{#V;#G;#H;#K;constructor(t={}){this.#V=t.getActiveRenderPlacement,this.#G=t.getPlacementsActiveAtTime,this.#H=t.ensureDecodedForPlacementAtTime;const e=Number(t.lookaheadSeconds);this.#K=Number.isFinite(e)&&e>=0?e:1}handleTimeUpdate(t={}){const e=Number(null==t?void 0:t.time);if(!Number.isFinite(e))return;if("function"!=typeof this.#H)return;const n="function"==typeof this.#G?this.#G:()=>[],i=n(e),r=new Set;i.forEach((t=>{null!=t&&t.placementId&&r.add(t.placementId),this.#H(t,e)}));const o=this.#K;if(!(o>0))return;const s=e+o;n(s).forEach((t=>{const e=null==t?void 0:t.placementId;e&&!r.has(e)&&this.#H(t,s)}))}dispose(){}}class XS{#X;#Y;#Q;#J;#Z;#tt;constructor(t={}){this.#X=t.getNode,this.#Y=t.getPlacementState,this.#Q=t.getDecodeTracks,this.#J=t.getSegmentIdForTrackAtTime,this.#Z=t.decodeLoadedMediaSegment,this.#tt=t.decodeLoadedMediaSegmentsAfter}ensureDecodedForPlacementAtTime(t,e){if(!t||!Number.isFinite(e))return;const n=null==t?void 0:t.placementId,i=null==t?void 0:t.nodeId;if(!n||!i)return;const r="function"==typeof this.#X?this.#X(i):void 0;if(!r)return;const o="function"==typeof this.#Y?this.#Y(n):void 0,s=null==o?void 0:o.trackStates;s&&"function"==typeof s.get&&("function"==typeof this.#Q?this.#Q(r).filter((t=>"video"===(null==t?void 0:t.type)||"image"===(null==t?void 0:t.type)||"audio"===(null==t?void 0:t.type))):[]).forEach((n=>{var i;const r=s.get(n.id);if(!r)return;const o="function"==typeof this.#J?this.#J(n,t,e):null;if(!o)return;const a=null==n||null===(i=n.segments)||void 0===i?void 0:i.find((t=>(null==t?void 0:t.id)===o));a&&!a.isInit&&a.retainedByteLength>0&&a.arrayBuffer&&(r.segmentDecoders&&"function"==typeof r.segmentDecoders.has&&r.segmentDecoders.has(o)||"function"!=typeof this.#Z||this.#Z(t,n,a),"video"===(null==n?void 0:n.type)&&"function"==typeof this.#tt&&this.#tt(t,n,a))}))}dispose(){}}const YS=new Set(["video","audio","image"]);function QS(t){const e=Number(t);return Number.isFinite(e)?e:0}var JS=new WeakMap,ZS=new WeakMap,tM=new WeakMap,eM=new WeakMap,nM=new WeakMap,iM=new WeakMap,rM=new WeakMap,oM=new WeakMap,sM=new WeakMap,aM=new WeakMap,lM=new WeakMap,cM=new WeakMap,uM=new WeakMap,dM=new WeakMap,hM=new WeakMap,fM=new WeakMap,pM=new WeakMap,mM=new WeakMap,vM=new WeakMap,gM=new WeakSet;class yM extends fh{constructor(...t){super(...t),$(this,gM),W(this,JS,void 0),W(this,ZS,void 0),W(this,tM,void 0),W(this,eM,void 0),W(this,nM,void 0),W(this,iM,void 0),W(this,rM,void 0),W(this,oM,void 0),W(this,sM,void 0),W(this,aM,void 0),W(this,lM,void 0),W(this,cM,new Map),W(this,uM,new Map),W(this,dM,new Map),W(this,hM,new Map),W(this,fM,new Set),W(this,pM,0),W(this,mM,!1),W(this,vM,null);const[e,n,i]=t;j(JS,this,e),j(ZS,this,n),j(tM,this,i||new HS),j(eM,this,new XS({getNode:t=>B(gM,this,UM).call(this,t),getPlacementState:t=>z(cM,this).get(t),getDecodeTracks:t=>B(gM,this,LM).call(this,t),getSegmentIdForTrackAtTime:(t,e,n)=>B(gM,this,EM).call(this,t,e,n),decodeLoadedMediaSegment:(t,e,n)=>{B(gM,this,cA).call(this,t,e,n)},decodeLoadedMediaSegmentsAfter:(t,e,n)=>{B(gM,this,eA).call(this,t,e,n)}})),j(nM,this,new KS({getActiveRenderPlacement:t=>{var e,n;return null===(e=z(ZS,this))||void 0===e||null===(n=e.getActiveRenderPlacement)||void 0===n?void 0:n.call(e,t)},getPlacementsActiveAtTime:t=>{var e,n;return(null===(e=z(ZS,this))||void 0===e||null===(n=e.getPlacementsActiveAtTime)||void 0===n?void 0:n.call(e,t))||[]},ensureDecodedForPlacementAtTime:(t,e)=>{var n,i;null===(n=z(eM,this))||void 0===n||null===(i=n.ensureDecodedForPlacementAtTime)||void 0===i||i.call(n,t,e)}})),B(gM,this,bM).call(this),B(gM,this,RM).call(this)}get name(){return"DecodeCoordinator"}onDispose(){var t,e;z(ZS,this)&&"function"==typeof z(ZS,this).off&&z(iM,this)&&z(ZS,this).off(yh.PLACEMENT_ADDED,z(iM,this)),z(ZS,this)&&"function"==typeof z(ZS,this).off&&z(rM,this)&&z(ZS,this).off(yh.TIMELINE_SEEKING,z(rM,this)),z(ZS,this)&&"function"==typeof z(ZS,this).off&&z(oM,this)&&z(ZS,this).off(yh.TIMELINE_SEEKED,z(oM,this)),z(ZS,this)&&"function"==typeof z(ZS,this).off&&z(sM,this)&&z(ZS,this).off(yh.TIMELINE_TIME_UPDATE,z(sM,this)),z(ZS,this)&&"function"==typeof z(ZS,this).off&&z(aM,this)&&z(ZS,this).off(yh.TIMELINE_RESET,z(aM,this)),B(gM,this,kM).call(this),j(iM,this,null),j(rM,this,null),j(oM,this,null),j(sM,this,null),j(aM,this,null),null!==(t=z(eM,this))&&void 0!==t&&null!==(e=t.dispose)&&void 0!==e&&e.call(t),j(eM,this,null),z(nM,this)&&"function"==typeof z(nM,this).dispose&&z(nM,this).dispose(),j(nM,this,null),z(uM,this).forEach(((t,e)=>{const n=B(gM,this,UM).call(this,e);n&&"function"==typeof n.off&&n.off("node:loaded",t)})),z(uM,this).clear(),z(dM,this).forEach(((t,e)=>{const n=B(gM,this,UM).call(this,e);n&&"function"==typeof n.off&&n.off("segment:chunk",t)})),z(dM,this).clear(),z(hM,this).clear(),z(fM,this).clear(),B(gM,this,FM).call(this),z(cM,this).forEach((({trackStates:t})=>{t&&t.forEach((t=>{B(gM,this,HM).call(this,t)}))})),z(cM,this).clear()}}function bM(){z(ZS,this)&&"function"==typeof z(ZS,this).on&&(j(iM,this,(t=>{B(gM,this,DM).call(this,t)})),z(ZS,this).on(yh.PLACEMENT_ADDED,z(iM,this)),j(rM,this,(t=>B(gM,this,xM).call(this,t))),z(ZS,this).on(yh.TIMELINE_SEEKING,z(rM,this)),j(oM,this,(()=>B(gM,this,wM).call(this))),z(ZS,this).on(yh.TIMELINE_SEEKED,z(oM,this)),j(sM,this,(t=>B(gM,this,_M).call(this,t))),z(ZS,this).on(yh.TIMELINE_TIME_UPDATE,z(sM,this)),j(aM,this,(()=>B(gM,this,IM).call(this))),z(ZS,this).on(yh.TIMELINE_RESET,z(aM,this))),(null==vh?void 0:vh.document)&&"function"==typeof vh.document.addEventListener&&(j(lM,this,(()=>{B(gM,this,CM).call(this)})),vh.document.addEventListener("visibilitychange",z(lM,this)))}function kM(){z(lM,this)&&null!=vh&&vh.document&&"function"==typeof vh.document.removeEventListener&&vh.document.removeEventListener("visibilitychange",z(lM,this)),j(lM,this,null)}function xM(t={}){const e=Number(null==t?void 0:t.targetTime);Number.isFinite(e)&&(z(cM,this).forEach((t=>{const n=null==t?void 0:t.trackStates;n&&n.forEach((n=>{var i;const r=null==n||null===(i=n.track)||void 0===i?void 0:i.type;"video"!==r&&"image"!==r&&"audio"!==r||(B(gM,this,TM).call(this,n,null==t?void 0:t.placement,e),n.seekSegmentId=null)}))})),(Array.isArray(null==t?void 0:t.placements)?t.placements:[]).forEach((t=>{const n=null==t?void 0:t.placementId,i=null==t?void 0:t.nodeId;if(!n||!i)return;const r=z(cM,this).get(n);if(!r||!r.trackStates)return;const o=B(gM,this,UM).call(this,i);o&&(r.trackStates.forEach((n=>{const i=null==n?void 0:n.track;!i||"video"!==i.type&&"image"!==i.type&&"audio"!==i.type||B(gM,this,TM).call(this,n,r.placement||t,e)})),B(gM,this,tA).call(this,r.placement||t,o))})))}function wM(){z(cM,this).forEach((t=>{const e=null==t?void 0:t.trackStates;e&&e.forEach((t=>{var e;const n=null==t||null===(e=t.track)||void 0===e?void 0:e.type;"video"!==n&&"image"!==n&&"audio"!==n||(t.seekSegmentId=null)}))}))}function _M(t={}){var e,n;B(gM,this,ZM).call(this,null==t?void 0:t.time),null!==(e=z(nM,this))&&void 0!==e&&null!==(n=e.handleTimeUpdate)&&void 0!==n&&n.call(e,t),B(gM,this,CM).call(this),B(gM,this,KM).call(this,null==t?void 0:t.time)}function IM(){z(uM,this).forEach(((t,e)=>{const n=B(gM,this,UM).call(this,e);n&&"function"==typeof n.off&&n.off("node:loaded",t)})),z(uM,this).clear(),z(dM,this).forEach(((t,e)=>{const n=B(gM,this,UM).call(this,e);n&&"function"==typeof n.off&&n.off("segment:chunk",t)})),z(dM,this).clear(),z(hM,this).clear(),z(fM,this).clear(),z(cM,this).forEach((({trackStates:t})=>{t&&t.forEach((t=>{const e=null==t?void 0:t.segmentDecoders;e&&e.forEach((t=>{t&&"function"==typeof t.dispose&&t.dispose()}))}))})),z(cM,this).clear()}function TM(t,e,n){t&&(B(gM,this,HM).call(this,t),t.seekSegmentId=B(gM,this,EM).call(this,t.track,e,n))}function EM(t,e,n){if(!t||!e||!Array.isArray(t.segments))return null;const i=Tv(e);if(!Number.isFinite(i))return null;const r=QS(null==e?void 0:e.nodeOffsetOverride),o=Math.max(0,n-i+r),s=QS(null==t?void 0:t.offset),a=Math.max(0,o-s),l="function"==typeof t.getMediaSegmentAtTime?t.getMediaSegmentAtTime(a,{preferRepresentationTime:!0}):Sk(t.segments,a,{preferRepresentationTime:!0});return(null==l?void 0:l.id)||null}function SM(t){if(!t)return!1;const e=null==t?void 0:t.name;if("QuotaExceededError"===e)return!0;if("EncodingError"===e)return!0;const n="string"==typeof(null==t?void 0:t.message)?t.message:"";return!!n.includes("Decoder failure")||!!n.includes("Codec reclaimed due to inactivity")||!("OperationError"!==e||!n.includes("initialize after flush"))}function MM(){const t=null==vh?void 0:vh.document;return!t||"string"!=typeof t.visibilityState||"visible"===t.visibilityState}function AM(){var t;const e=z(ZS,this);if(!e||"number"!=typeof e.currentTime)return!1;if(e.state===Dg)return!1;const n=Date.now();if(n<z(pM,this))return!1;const i=e.currentTime;if(!Number.isFinite(i))return!1;const r="function"==typeof e.getPlacementsActiveAtTime?e.getPlacementsActiveAtTime(i):[],o=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.snapToFps),s=Number.isFinite(o)&&o>0?1/o:1/60;let a;if(Array.isArray(r)&&r.length)a=i+s;else if(a=B(gM,this,NM).call(this,i),!Number.isFinite(a))return!1;return j(pM,this,n+1500),this.log.warn("[DecodeCoordinator] attempting decoder recovery seek"),e.currentTime=a,!0}function NM(t){var e;const n=z(ZS,this);if(!n)return null;const i=Array.isArray(n.placements)?n.placements:[];if(!i.length)return null;const r=Number(t);if(!Number.isFinite(r))return null;const o=Number(null==n||null===(e=n.settings)||void 0===e?void 0:e.snapToFps),s=Number.isFinite(o)&&o>0?1/o:1/60;let a=Number.NEGATIVE_INFINITY,l=null,c=Number.NEGATIVE_INFINITY,u=null,d=null;return i.forEach((t=>{const e=Tv(t);if(!Number.isFinite(e))return;(!Number.isFinite(d)||e<d)&&(d=e);const n=_v(t,z(JS,this)),i=Number.isFinite(n),o=i?e+n:e;(o>e||!i)&&((o>a||!Number.isFinite(a)&&Number.isFinite(o))&&(a=o,l=e),o<=r&&o>c&&(c=o,u=i?Math.max(e,o-s):e))})),Number.isFinite(l)&&Number.isFinite(a)&&r>=a-s?l:Number.isFinite(u)?u:Number.isFinite(d)?d:null}function FM(){j(mM,this,!1),j(vM,this,null)}function CM(){z(mM,this)&&B(gM,this,MM).call(this)&&B(gM,this,AM).call(this)}function OM(t){if(!B(gM,this,SM).call(this,t))return;const e=z(ZS,this);e&&"number"==typeof e.currentTime&&(j(mM,this,!0),j(vM,this,t),B(gM,this,MM).call(this)&&B(gM,this,AM).call(this))}function PM(t){var e;return!!t&&(Array.isArray(null===(e=z(ZS,this))||void 0===e?void 0:e.placements)?z(ZS,this).placements:[]).includes(t)}function RM(t){var e;(Array.isArray(null===(e=z(ZS,this))||void 0===e?void 0:e.placements)?[...z(ZS,this).placements]:[]).filter((e=>"function"!=typeof t||t(e))).sort(((t,e)=>{const n=Tv(t),i=Tv(e);return(Number.isFinite(n)?n:Number.POSITIVE_INFINITY)-(Number.isFinite(i)?i:Number.POSITIVE_INFINITY)})).forEach((t=>{B(gM,this,DM).call(this,t)}))}async function DM(t){if(!t||!t.placementId||z(cM,this).has(t.placementId))return;if(!B(gM,this,PM).call(this,t))return;const e=t.nodeId;if(!e||!z(JS,this)||"function"!=typeof z(JS,this).get)return;const n=B(gM,this,UM).call(this,e);if(n){if(n.state&&"ready"!==n.state){if("function"==typeof n.resolve)try{await n.resolve()}catch(n){if(!B(gM,this,PM).call(this,t))return;return void this.log.warn(`[#processPlacement] Failed to resolve node ${e}`,n)}if(!B(gM,this,PM).call(this,t))return;if("ready"!==n.state)return}if(B(gM,this,JM).call(this,t))return B(gM,this,QM).call(this,t,n),void z(fM,this).add(t.placementId);B(gM,this,YM).call(this,t,n)}}function BM(t){return B(gM,this,LM).call(this,t).every((t=>B(gM,this,XM).call(this,t)))}function LM(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).filter((t=>YS.has(null==t?void 0:t.type)))}function zM(t){if(!t||!t.id||"function"!=typeof t.on)return;if(z(uM,this).has(t.id))return;const e=()=>{B(gM,this,nA).call(this,t.id)};t.on("node:loaded",e),z(uM,this).set(t.id,e)}function WM(t){if(!t||!t.id||"function"!=typeof t.on)return;if(z(dM,this).has(t.id))return;const e=t=>B(gM,this,iA).call(this,t);t.on("segment:chunk",e),z(dM,this).set(t.id,e)}function jM(t,e){if(!t||!e)return;const n=z(hM,this).get(t)||new Set;n.add(e),z(hM,this).set(t,n)}function $M(t){return z(hM,this).get(t)||new Set}function UM(t){if(t&&z(JS,this)&&"function"==typeof z(JS,this).get)return z(JS,this).get(t)}function qM(t){if(!t)return;const e=t.fullBufferRetryTimer;null!=e&&("function"==typeof(null==vh?void 0:vh.clearTimeout)?vh.clearTimeout.bind(vh):clearTimeout)(e),t.fullBufferRetryTimer=null,t.fullBufferDecodeScheduled=!1,t.fullBufferRetryAttempts=0}function VM(t){const e=null==t?void 0:t.segmentStates;e&&"function"==typeof e.forEach&&e.forEach((t=>{B(gM,this,qM).call(this,t)}))}function GM(t,e,n,i){var r,o;if(!(t&&e&&n&&i))return!1;const s=z(cM,this).get(t),a=null==s||null===(r=s.trackStates)||void 0===r?void 0:r.get(e);return(null==a||null===(o=a.segmentStates)||void 0===o?void 0:o.get(n))===i}function HM(t){if(!t)return;B(gM,this,VM).call(this,t);const e=t.segmentDecoders;e&&"function"==typeof e.forEach&&(e.forEach((t=>{if(t&&"function"==typeof t.dispose)try{t.dispose()}catch(t){}})),"function"==typeof e.clear&&e.clear()),t.segmentStates&&"function"==typeof t.segmentStates.clear&&t.segmentStates.clear(),t.ready=!1,t.seekSegmentId=null}function KM(t){const e=QS(t);if(!Number.isFinite(e))return;const n=e-2;Number.isFinite(n)&&z(cM,this).forEach((t=>{const e=null==t?void 0:t.placement;if(!e)return;const i=Tv(e),r=_v(e,z(JS,this),{allowUnready:!0});if(!Number.isFinite(i)||!Number.isFinite(r))return;const o=i+r;if(!Number.isFinite(o)||o>n)return;const s=null==t?void 0:t.trackStates;s&&"function"==typeof s.forEach&&s.forEach((t=>{var e;const n=null==t||null===(e=t.track)||void 0===e?void 0:e.type;"video"!==n&&"image"!==n&&"audio"!==n||B(gM,this,HM).call(this,t)}))}))}function XM(t){if(!t||!Array.isArray(t.segments))return!1;const e=t.segments.find((t=>null==t?void 0:t.isInit));if(e&&!(e.retainedByteLength>0))return!1;const n=t.segments.find((t=>t&&!t.isInit));return!n||n.retainedByteLength>0}function YM(t,e){if(this.log.debug(`[#startDecode] [${t.placementId}] [${e.id}] Starting decode`),B(gM,this,QM).call(this,t,e)){if(B(gM,this,jM).call(this,e.id,t.placementId),!B(gM,this,BM).call(this,e))return B(gM,this,zM).call(this,e),void B(gM,this,WM).call(this,e);B(gM,this,tA).call(this,t,e),B(gM,this,WM).call(this,e)}}function QM(t,e){if(!t||!t.placementId||!e)return;const n=z(cM,this).get(t.placementId);if(n)return n.placement=t,n;const i=B(gM,this,LM).call(this,e),r=new Map;i.forEach((n=>{try{const t=n.segments.some((t=>null==t?void 0:t.isInit));r.set(n.id,{hasInit:t,track:n,ready:!1,segmentDecoders:new Map,segmentStates:new Map})}catch(i){this.trigger(yh.DECODE_ERROR,xh({placementId:t.placementId,nodeId:e.id,trackId:null==n?void 0:n.id,trackType:null==n?void 0:n.type,error:i}))}}));const o={trackStates:r,nodeId:e.id,placement:t};return z(cM,this).set(t.placementId,o),o}function JM(t){var e;const n=Tv(t),i=QS(null===(e=z(ZS,this))||void 0===e?void 0:e.currentTime);return!Number.isFinite(n)||!!Number.isFinite(i)&&n-i>2}function ZM(t){if(!z(fM,this).size)return;const e=QS(t);if(!Number.isFinite(e))return;const n=[];z(fM,this).forEach((t=>{const i=z(cM,this).get(t),r=null==i?void 0:i.placement;if(!r)return void n.push(t);const o=Tv(r);Number.isFinite(o)&&o-e<=2&&n.push(t)})),n.forEach((t=>{z(fM,this).delete(t);const e=z(cM,this).get(t),n=null==e?void 0:e.placement;if(!n)return;const i=B(gM,this,UM).call(this,n.nodeId);i&&B(gM,this,YM).call(this,n,i)}))}function tA(t,e){const n=z(cM,this).get(t.placementId);n&&B(gM,this,LM).call(this,e).forEach((i=>{const r=n.trackStates.get(i.id);if(r&&!r.ready)try{let n;if(r.seekSegmentId&&(n=i.segments.find((t=>t&&!t.isInit&&t.id===r.seekSegmentId&&t.retainedByteLength>0)),!n))return;if(n||(n=i.segments.find((t=>t&&!t.isInit&&t.retainedByteLength>0))),!n)return;B(gM,this,cA).call(this,t,i,n),r.seekSegmentId&&"video"===(null==i?void 0:i.type)&&B(gM,this,eA).call(this,t,i,n),r.ready=!0,this.trigger(yh.DECODE_READY,kh({placementId:t.placementId,nodeId:e.id,trackId:i.id,trackType:i.type}))}catch(n){this.trigger(yh.DECODE_ERROR,xh({placementId:t.placementId,nodeId:e.id,trackId:null==i?void 0:i.id,trackType:null==i?void 0:i.type,error:n}))}}))}function eA(t,e,n){var i;if(!(t&&e&&n&&Array.isArray(e.segments)))return;const r=null==t?void 0:t.placementId,o=r?z(cM,this).get(r):void 0,s=null==o||null===(i=o.trackStates)||void 0===i?void 0:i.get(e.id),a=null==s?void 0:s.segmentDecoders;if(!a||"function"!=typeof a.has)return;const l=e.segments,c=l.findIndex((t=>(null==t?void 0:t.id)===n.id));if(c<0)return;let u=0;for(let n=c+1;n<l.length;n+=1){const i=l[n];if(!i||i.isInit)continue;if(a.has(i.id))continue;if(!(i.retainedByteLength>0))break;const r=i.arrayBuffer;if(!r||"number"!=typeof r.byteLength||r.byteLength<=0)break;if(B(gM,this,cA).call(this,t,e,i),u+=1,u>=2)break}}function nA(t){const e=B(gM,this,UM).call(this,t);e&&B(gM,this,BM).call(this,e)&&B(gM,this,$M).call(this,t).forEach((t=>{const n=z(cM,this).get(t);B(gM,this,tA).call(this,(null==n?void 0:n.placement)||{placementId:t},e)}))}function iA(t){t&&t.nodeId&&t.trackId&&t.chunk&&B(gM,this,$M).call(this,t.nodeId).forEach((e=>B(gM,this,rA).call(this,e,t)))}function rA(t,e){const n=z(cM,this).get(t);if(!n)return;const i=n.trackStates.get(e.trackId);if(i)try{var r,o;if(e.isInit)return;const s=i.track,a=null==s||null===(r=s.segments)||void 0===r?void 0:r.find((t=>(null==t?void 0:t.id)===e.segmentId));if(!a||a.isInit)return;if("image"===(null==s?void 0:s.type))return void(!i.ready&&a.retainedByteLength>0&&B(gM,this,cA).call(this,n.placement,s,a)&&(i.ready=!0,this.trigger(yh.DECODE_READY,kh({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType}))));if((null===(o=z(ZS,this))||void 0===o?void 0:o.state)===Dg&&i.seekSegmentId&&("video"===(null==s?void 0:s.type)||"audio"===(null==s?void 0:s.type))&&a.id!==i.seekSegmentId)return;const l=a.id,c=i.segmentStates.get(l)||{initSent:!1,pendingChunks:[],ended:!1,firstChunkObserved:!1,missedSegmentPrefix:!1,fullBufferDecodeScheduled:!1,fullBufferRetryTimer:null,fullBufferRetryAttempts:0};i.segmentStates.set(l,c);const u=B(gM,this,aA).call(this,n.placement,s,a);if(!u||"function"!=typeof u.decodeChunk)return;if(i.hasInit&&!c.initSent){const t=B(gM,this,lA).call(this,s,a);if(!t)return void c.pendingChunks.push({chunk:e.chunk,loaded:e.loaded,total:e.total});u.decodeChunk(t,{isInit:!0}),c.initSent=!0,c.pendingChunks.length&&(c.pendingChunks.forEach((t=>{u.decodeChunk(t.chunk,{isInit:!1,loaded:t.loaded,total:t.total})})),c.pendingChunks=[])}const d="number"==typeof e.loaded&&"number"==typeof e.total&&e.total>0&&e.loaded>=e.total;B(gM,this,oA).call(this,c,e)?d&&!c.ended&&B(gM,this,sA).call(this,n.placement,s,a,c):(u.decodeChunk(e.chunk,{isInit:!1,loaded:e.loaded,total:e.total}),d&&!c.ended&&"function"==typeof u.endOfStream&&(c.ended=!0,u.endOfStream())),i.ready||(i.ready=!0,this.trigger(yh.DECODE_READY,kh({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType})))}catch(n){this.trigger(yh.DECODE_ERROR,xh({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType,error:n}))}}function oA(t,e){var n;if(!t||t.missedSegmentPrefix)return!(null==t||!t.missedSegmentPrefix);if(t.firstChunkObserved)return!1;t.firstChunkObserved=!0;const i=Number(null==e?void 0:e.loaded),r=Number(null==e||null===(n=e.chunk)||void 0===n?void 0:n.byteLength);return!(!Number.isFinite(i)||!Number.isFinite(r)||r<=0)&&(t.missedSegmentPrefix=i>r,t.missedSegmentPrefix)}function sA(t,e,n,i){if(!t||!e||!n||!i||i.fullBufferDecodeScheduled)return;const r=null==t?void 0:t.placementId,o=null==e?void 0:e.id,s=null==n?void 0:n.id;if(!r||!o||!s)return;const a="function"==typeof(null==vh?void 0:vh.setTimeout)?vh.setTimeout.bind(vh):setTimeout;i.fullBufferDecodeScheduled=!0,i.fullBufferRetryAttempts=0;const l=()=>{if(!B(gM,this,GM).call(this,r,o,s,i)||i.ended)return void B(gM,this,qM).call(this,i);if(B(gM,this,cA).call(this,t,e,n))return void B(gM,this,qM).call(this,i);i.fullBufferRetryAttempts+=1;const c=i.fullBufferRetryAttempts<=8?0:50;i.fullBufferRetryTimer=a((()=>{l()}),c)};i.fullBufferRetryTimer=a((()=>{l()}),0)}function aA(t,e,n){var i,r;const o=null==t?void 0:t.placementId;if(!o||!e||!n)return;const s=z(cM,this).get(o),a=null==s||null===(i=s.trackStates)||void 0===i?void 0:i.get(e.id);if(!a)return;const l=a.segmentDecoders.get(n.id);if(l)return l;const c=z(tM,this).create(e);if(c&&"function"==typeof c.configure&&c.configure(e),c&&"function"==typeof c.setNodeId&&c.setNodeId(null==t?void 0:t.nodeId),c&&"function"==typeof c.setSegment&&c.setSegment(n),c&&"function"==typeof c.setCurrentTimeProvider&&c.setCurrentTimeProvider((()=>{var t;return"number"==typeof(null===(t=z(ZS,this))||void 0===t?void 0:t.currentTime)?z(ZS,this).currentTime:0})),c&&"function"==typeof c.setTimeOffsetSeconds){var u,d;const i=Tv(t),r=QS(null==e?void 0:e.offset),o=QS(null!==(u=null==n||null===(d=n.chosenRepresentation)||void 0===d?void 0:d.segStart)&&void 0!==u?u:null==n?void 0:n.offset);Number.isFinite(i)&&c.setTimeOffsetSeconds(i+r+o)}return c&&"function"==typeof c.setSeekTargetTimeSeconds&&(null===(r=z(ZS,this))||void 0===r?void 0:r.state)===Dg&&"video"===(null==e?void 0:e.type)&&c.setSeekTargetTimeSeconds(z(ZS,this).currentTime),c&&"function"==typeof c.on&&(c.on(yh.DECODER_FRAME,(i=>{i&&(!z(mM,this)||"video"!==(null==e?void 0:e.type)&&"image"!==(null==e?void 0:e.type)||(j(mM,this,!1),j(vM,this,null)),z(ZS,this)&&"function"==typeof z(ZS,this).notifyDecodedFrame&&(i.frame||i.data)&&z(ZS,this).notifyDecodedFrame({placementId:o,nodeId:null==t?void 0:t.nodeId,trackId:null==e?void 0:e.id,trackType:null==e?void 0:e.type,segmentId:null==n?void 0:n.id,pts:i.pts,duration:i.duration,frame:i.frame,data:i.data}))})),c.on(yh.DECODER_AUDIO,(i=>{i&&i.audioBuffer&&this.trigger(yh.DECODER_AUDIO,kh({placementId:o,nodeId:null==t?void 0:t.nodeId,trackId:null==e?void 0:e.id,trackType:null==e?void 0:e.type,segmentId:null==n?void 0:n.id,pts:i.pts,duration:i.duration,audioBuffer:i.audioBuffer}))})),c.on(yh.DECODER_ERROR,(i=>{const r=(null==i?void 0:i.error)||i;this.trigger(yh.DECODER_ERROR,xh({placementId:o,nodeId:null==t?void 0:t.nodeId,trackId:null==e?void 0:e.id,trackType:null==e?void 0:e.type,segmentId:null==n?void 0:n.id,error:r})),B(gM,this,OM).call(this,r)}))),a.segmentDecoders.set(n.id,c),c}function lA(t,e){var n,i;if(!t||!e||!Array.isArray(t.segments))return;const r=t.segments.find((t=>null==t?void 0:t.isInit));if(!r||"function"!=typeof r.getRepresentationBuffer)return;const o=(null==e||null===(n=e.chosenRepresentation)||void 0===n?void 0:n.id)||(null==e||null===(i=e.representations)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.id);if(!o)return;const s=r.getRepresentationBuffer(o);return s?s instanceof Uint8Array?s:new Uint8Array(s):void 0}function cA(t,e,n){var i;if(!t||!e||!n)return!1;const r=t.placementId,o=z(cM,this).get(r),s=null==o||null===(i=o.trackStates)||void 0===i?void 0:i.get(e.id);if(!s)return!1;const a=B(gM,this,aA).call(this,t,e,n);if(!a||"function"!=typeof a.decodeChunk)return!1;const l=s.segmentStates.get(n.id)||{initSent:!1,pendingChunks:[],ended:!1,firstChunkObserved:!1,missedSegmentPrefix:!1,fullBufferDecodeScheduled:!1,fullBufferRetryTimer:null,fullBufferRetryAttempts:0};if(s.segmentStates.set(n.id,l),l.ended)return B(gM,this,qM).call(this,l),!0;if(s.hasInit&&!l.initSent){const t=B(gM,this,lA).call(this,e,n);if(!t)return!1;a.decodeChunk(t,{isInit:!0}),l.initSent=!0}const c=n.arrayBuffer;return!(!c||"number"!=typeof c.byteLength||c.byteLength<=0||(a.decodeChunk(new Uint8Array(c),{isInit:!1,loaded:c.byteLength,total:c.byteLength}),l.ended||"function"!=typeof a.endOfStream||(l.ended=!0,a.endOfStream()),B(gM,this,qM).call(this,l),0))}const uA=1e-6;var dA=new WeakMap,hA=new WeakMap,fA=new WeakMap,pA=new WeakMap,mA=new WeakMap,vA=new WeakMap,gA=new WeakMap,yA=new WeakMap,bA=new WeakSet;class kA extends fh{get name(){return"TransitionManager"}get defaults(){return{durationSeconds:.5}}constructor(t,e,n){super(n),$(this,bA),W(this,dA,void 0),W(this,hA,void 0),W(this,fA,null),W(this,pA,null),W(this,mA,null),W(this,vA,0),W(this,gA,[]),W(this,yA,null),j(dA,this,t),j(hA,this,e),z(dA,this)&&"function"==typeof z(dA,this).on&&(j(yA,this,(()=>B(bA,this,AA).call(this))),z(dA,this).on(yh.TIMELINE_RESET,z(yA,this)))}transitionTo(t,e={}){const n=Number(t);if(!Number.isFinite(n))throw new Error("TransitionManager.transitionTo requires a numeric time");B(bA,this,AA).call(this);const i=B(bA,this,xA).call(this),r=B(bA,this,TA).call(this,n,e);return r?B(bA,this,EA).call(this,n,e,i,r):Promise.resolve()}onDispose(){z(dA,this)&&"function"==typeof z(dA,this).off&&z(yA,this)&&z(dA,this).off(yh.TIMELINE_RESET,z(yA,this)),j(yA,this,null),B(bA,this,AA).call(this),j(hA,this,null),j(dA,this,null)}}function xA(){return j(vA,this,z(vA,this)+1),z(vA,this)}function wA(t={}){var e;const n=Number(null==t?void 0:t.duration),i=Number(null===(e=this.settings)||void 0===e?void 0:e.durationSeconds);return Number.isFinite(n)?n:i}function _A(t={},e){return{duration:e,filter:null==t?void 0:t.filter,color:null==t?void 0:t.color,filters:null==t?void 0:t.filters,reverseFilters:null==t?void 0:t.reverseFilters,transition:null==t?void 0:t.transition}}function IA(t,e){const n=1e3*t,i=Number.isFinite(Number(null==e?void 0:e.outDurationMs))&&e.outDurationMs>0?e.outDurationMs:n;return{outDurationMs:i,inDurationMs:Number.isFinite(Number(null==e?void 0:e.inDurationMs))&&e.inDurationMs>0?e.inDurationMs:i}}function TA(t,e={}){var n;const i=z(hA,this),r=B(bA,this,wA).call(this,e);if(!i||"function"!=typeof i.startTransition)return z(dA,this).currentTime=t,null;if(!(r>0))return z(dA,this).currentTime=t,null!==(n=i.resetTransition)&&void 0!==n&&n.call(i),null;const o=B(bA,this,_A).call(this,e,r);"function"==typeof(null==e?void 0:e.onTransitionInStart)&&e.onTransitionInStart();const s=i.startTransition(o),{outDurationMs:a,inDurationMs:l}=B(bA,this,IA).call(this,r,s);return{renderer:i,transitionOptions:o,outDurationMs:a,inDurationMs:l,shouldWaitForFrames:!1!==(null==e?void 0:e.waitForVisualFrames)}}function EA(t,e={},n,i){const{renderer:r,transitionOptions:o,outDurationMs:s,inDurationMs:a,shouldWaitForFrames:l}=i,c=B(bA,this,PA).call(this,t,e,n),u=l?B(bA,this,RA).call(this,t,n):Promise.resolve();let d=!1,h=!1,f=!1,p=!l;const m=()=>{var t;B(bA,this,NA).call(this,n)&&!f&&d&&h&&p&&(f=!0,"function"==typeof(null==e?void 0:e.onTransitionInEnd)&&e.onTransitionInEnd(),"function"==typeof(null==e?void 0:e.onTransitionOutStart)&&e.onTransitionOutStart(),null!==(t=r.beginTransitionIn)&&void 0!==t&&t.call(r,o),j(pA,this,setTimeout((()=>{var t;B(bA,this,NA).call(this,n)&&(null!==(t=r.resetTransition)&&void 0!==t&&t.call(r),"function"==typeof(null==e?void 0:e.onTransitionOutEnd)&&e.onTransitionOutEnd(),B(bA,this,SA).call(this))}),a)))};return j(fA,this,setTimeout((()=>{d=!0,m()}),s)),c.then((()=>{h=!0,m()})).catch((()=>{var t;B(bA,this,NA).call(this,n)&&(null!==(t=r.resetTransition)&&void 0!==t&&t.call(r),B(bA,this,SA).call(this))})),u.then((()=>{p=!0,m()})).catch((()=>{p=!0,m()})),z(dA,this).currentTime=t,new Promise((t=>{j(mA,this,t)}))}function SA(){const t=z(mA,this);j(mA,this,null),B(bA,this,MA).call(this),B(bA,this,OA).call(this),t&&t()}function MA(){z(fA,this)&&clearTimeout(z(fA,this)),z(pA,this)&&clearTimeout(z(pA,this)),j(fA,this,null),j(pA,this,null)}function AA(){var t,e;z(hA,this)&&null!==(t=(e=z(hA,this)).resetTransition)&&void 0!==t&&t.call(e),B(bA,this,MA).call(this),B(bA,this,OA).call(this),z(mA,this)&&(z(mA,this).call(this),j(mA,this,null))}function NA(t){return z(vA,this)===t}function FA(t,e){z(dA,this)&&"function"==typeof z(dA,this).on&&(z(dA,this).on(t,e),z(gA,this).push({eventName:t,handler:e}))}function CA(t,e){z(dA,this)&&"function"==typeof z(dA,this).off&&(z(dA,this).off(t,e),j(gA,this,z(gA,this).filter((n=>n.eventName!==t||n.handler!==e))))}function OA(){z(dA,this)&&"function"==typeof z(dA,this).off?(z(gA,this).forEach((t=>{z(dA,this).off(t.eventName,t.handler)})),j(gA,this,[])):j(gA,this,[])}function PA(t,e,n){const i=null==e?void 0:e.transitionOutPromise;if(i&&"function"==typeof i.then)return i;if("function"==typeof i)try{const t=i();if(t&&"function"==typeof t.then)return t}catch(t){return Promise.resolve()}if(!z(dA,this)||"function"!=typeof z(dA,this).on)return Promise.resolve();const r=B(bA,this,DA).call(this);return new Promise((e=>{let i=!1;const o=r?yh.TIMELINE_SEEKED:"nodestart";let s,a;const l=()=>{B(bA,this,CA).call(this,yh.TIMELINE_SEEKING,s),B(bA,this,CA).call(this,o,a),e()};s=(e={})=>{B(bA,this,NA).call(this,n)?B(bA,this,BA).call(this,e,t)&&(i=!0):l()},a=(e={})=>{B(bA,this,NA).call(this,n)?(o!==yh.TIMELINE_SEEKED||B(bA,this,BA).call(this,e,t))&&(o===yh.TIMELINE_SEEKED||i)&&l():l()},B(bA,this,FA).call(this,yh.TIMELINE_SEEKING,s),B(bA,this,FA).call(this,o,a)}))}function RA(t,e){if(!z(dA,this)||"function"!=typeof z(dA,this).on)return Promise.resolve();const n=Number(t);return new Promise((t=>{const i=(r={})=>{if(!B(bA,this,NA).call(this,e))return B(bA,this,CA).call(this,yh.VISUAL_FRAMES_AVAILABLE,i),void t();const o=Number(null==r?void 0:r.time);Number.isFinite(n)&&Number.isFinite(o)&&o+uA<n||(Array.isArray(null==r?void 0:r.frames)?r.frames:[]).length&&(B(bA,this,CA).call(this,yh.VISUAL_FRAMES_AVAILABLE,i),t())};B(bA,this,FA).call(this,yh.VISUAL_FRAMES_AVAILABLE,i)}))}function DA(){var t,e;const n=null===(t=z(dA,this))||void 0===t?void 0:t.state;if(n===Rg||n===Fg)return!0;const i=null===(e=z(dA,this))||void 0===e?void 0:e.placements;return!Array.isArray(i)||0===i.length}function BA(t,e){const n=Number(null==t?void 0:t.targetTime);return!Number.isFinite(n)||Math.abs(n-e)<uA}function LA(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}var zA=new WeakMap,WA=new WeakMap,jA=new WeakMap,$A=new WeakMap,UA=new WeakMap,qA=new WeakMap,VA=new WeakMap,GA=new WeakMap,HA=new WeakMap,KA=new WeakMap,XA=new WeakMap,YA=new WeakMap,QA=new WeakMap,JA=new WeakMap,ZA=new WeakSet;class tN extends fh{get name(){return"AudioPlaybackManager"}get defaults(){return{muted:!1,volume:1,lookaheadSeconds:1}}constructor(t,e,n){super(n),$(this,ZA),W(this,zA,void 0),W(this,WA,void 0),W(this,jA,null),W(this,$A,null),W(this,UA,[]),W(this,qA,new Set),W(this,VA,new Map),W(this,GA,!1),W(this,HA,1),W(this,KA,!0),W(this,XA,null),W(this,YA,null),W(this,QA,null),W(this,JA,null),j(zA,this,t),j(WA,this,e),j(GA,this,!!this.settings.muted),j(HA,this,xv(this.settings.volume));const i=Array.isArray(null==n?void 0:n.disabledTracks)?n.disabledTracks:[];j(KA,this,!i.includes("audio")),B(ZA,this,eN).call(this)}get muted(){return z(GA,this)}set muted(t){j(GA,this,!!t),B(ZA,this,hN).call(this)}get volume(){return z(HA,this)}set volume(t){j(HA,this,xv(t)),B(ZA,this,hN).call(this)}handleDecodedAudio(t={}){if(!z(KA,this))return;const e=null==t?void 0:t.audioBuffer,n=null==t?void 0:t.placementId,i=null==t?void 0:t.segmentId,r=LA(null==t?void 0:t.pts,null);if(!(e&&n&&i&&Number.isFinite(r)))return;const o=Number.isFinite(null==t?void 0:t.duration)?t.duration:e.duration,s=`${n}:${i}`;z(qA,this).has(s)||(z(UA,this).push({key:s,placementId:n,pts:r,duration:o,audioBuffer:e}),z(UA,this).sort(((t,e)=>t.pts-e.pts)),B(ZA,this,sN).call(this))}onDispose(){B(ZA,this,nN).call(this),B(ZA,this,uN).call(this,!0),z(jA,this)&&"function"==typeof z(jA,this).close&&z(jA,this).close(),j(jA,this,null),j($A,this,null),j(zA,this,null),j(WA,this,null)}}function eN(){z(zA,this)&&"function"==typeof z(zA,this).on&&(j(XA,this,(t=>B(ZA,this,iN).call(this,t))),z(zA,this).on(yh.TIMELINE_TIME_UPDATE,z(XA,this)),j(YA,this,(t=>B(ZA,this,rN).call(this,t))),z(zA,this).on(yh.TIMELINE_STATE_CHANGE,z(YA,this)),j(JA,this,(()=>B(ZA,this,oN).call(this))),z(zA,this).on(yh.TIMELINE_RESET,z(JA,this))),z(WA,this)&&"function"==typeof z(WA,this).on&&(j(QA,this,(t=>this.handleDecodedAudio(t))),z(WA,this).on(yh.DECODER_AUDIO,z(QA,this)))}function nN(){z(zA,this)&&"function"==typeof z(zA,this).off&&(z(XA,this)&&z(zA,this).off(yh.TIMELINE_TIME_UPDATE,z(XA,this)),z(YA,this)&&z(zA,this).off(yh.TIMELINE_STATE_CHANGE,z(YA,this)),z(JA,this)&&z(zA,this).off(yh.TIMELINE_RESET,z(JA,this))),z(WA,this)&&"function"==typeof z(WA,this).off&&z(QA,this)&&z(WA,this).off(yh.DECODER_AUDIO,z(QA,this)),j(XA,this,null),j(YA,this,null),j(QA,this,null),j(JA,this,null)}function iN(){B(ZA,this,sN).call(this)}function rN(t={}){const e=null==t?void 0:t.to;if(e)return e===Cg?(B(ZA,this,fN).call(this),void B(ZA,this,sN).call(this)):void(e!==Rg&&e!==Pg?e!==Dg&&e!==Bg||B(ZA,this,oN).call(this):B(ZA,this,pN).call(this))}function oN(){B(ZA,this,pN).call(this),B(ZA,this,uN).call(this,!0),j(UA,this,[])}function sN(){if(!z(KA,this)||!z(zA,this))return;if(z(zA,this).state!==Cg)return;const t=B(ZA,this,dN).call(this);if(!t)return;const e=LA(z(zA,this).currentTime,0),n=e+Math.max(0,LA(this.settings.lookaheadSeconds,1)),i=[];for(let r=0;r<z(UA,this).length;r+=1){const o=z(UA,this)[r];o&&(o.pts>n?i.push(o):B(ZA,this,aN).call(this,o)&&B(ZA,this,cN).call(this,o,t,e))}j(UA,this,i)}function aN(t){if(!t||!z(zA,this))return!1;const e=B(ZA,this,lN).call(this,t.pts);return!(!e||e!==t.placementId)}function lN(t){if(!z(zA,this)||"function"!=typeof z(zA,this).getPlacementsActiveAtTime)return null;const e=z(zA,this).getPlacementsActiveAtTime(t);if(!Array.isArray(e)||!e.length)return null;const n=e.find((t=>null==t?void 0:t.placementId));return n?n.placementId:null}function cN(t,e,n){const i=t.key;if(z(qA,this).has(i))return;const r=t.audioBuffer;if(!r)return;const o=Number.isFinite(t.duration)?t.duration:r.duration,s=t.pts;if(!Number.isFinite(s))return;const a=n-s;if(Number.isFinite(o)&&o>0&&a>=o)return;const l=e.createBufferSource();l.buffer=r,l.connect(z($A,this));let c=e.currentTime,u=0;a>0?u=a:a<0&&(c=e.currentTime+Math.abs(a));try{l.start(c,u)}catch(t){return void this.log.warn("[AudioPlaybackManager] Failed to start audio buffer",t)}z(qA,this).add(i),z(VA,this).set(i,l),l.onended=()=>{z(VA,this).delete(i)}}function uN(t){z(VA,this).forEach(((t,e)=>{if(t&&"function"==typeof t.stop)try{t.stop()}catch(t){}z(VA,this).delete(e)})),t&&z(qA,this).clear()}function dN(){if(z(jA,this))return z(jA,this);const t=vh.AudioContext||vh.webkitAudioContext;if(!t)return this.log.warn("[AudioPlaybackManager] AudioContext is not available."),null;try{return j(jA,this,new t),j($A,this,z(jA,this).createGain()),z($A,this).connect(z(jA,this).destination),B(ZA,this,hN).call(this),z(jA,this)}catch(t){return this.log.warn("[AudioPlaybackManager] Failed to initialize AudioContext",t),j(jA,this,null),j($A,this,null),null}}function hN(){if(!z($A,this))return;const t=z(GA,this)?0:z(HA,this);z($A,this).gain.value=t}function fN(){z(jA,this)&&"function"==typeof z(jA,this).resume&&"suspended"===z(jA,this).state&&z(jA,this).resume().catch((()=>{}))}function pN(){z(jA,this)&&"function"==typeof z(jA,this).suspend&&"running"===z(jA,this).state&&z(jA,this).suspend().catch((()=>{}))}var mN=new WeakMap,vN=new WeakMap,gN=new WeakMap,yN=new WeakMap,bN=new WeakMap,kN=new WeakSet;class xN extends fh{constructor(...t){super(...t),$(this,kN),W(this,mN,void 0),W(this,vN,void 0),W(this,gN,void 0),W(this,yN,void 0),W(this,bN,void 0),j(mN,this,B(kN,this,_N).call(this,this.settings.currentTime)),j(vN,this,B(kN,this,IN).call(this,this.settings.playbackRate)),j(gN,this,null),j(yN,this,!1),j(bN,this,B(kN,this,wN).bind(this))}get name(){return"PlaybackClock"}get defaults(){return{currentTime:0,playbackRate:nk("playbackRate")}}get currentTime(){return z(mN,this)}get playbackRate(){return z(vN,this)}set playbackRate(t){j(vN,this,B(kN,this,IN).call(this,t))}play(){z(yN,this)||(j(yN,this,!0),j(gN,this,zb()),Aw(z(bN,this),0))}pause(){z(yN,this)&&(j(yN,this,!1),Nw(z(bN,this)))}seek(t){j(mN,this,B(kN,this,_N).call(this,t)),j(gN,this,zb())}reset(){this.pause(),j(mN,this,0),j(gN,this,null)}onDispose(){this.pause(),j(bN,this,null)}}function wN(){const t=zb();if(null===z(gN,this))return j(gN,this,t),void this.trigger(yh.CLOCK_TICK,{currentTime:z(mN,this)});const e=t-z(gN,this);j(gN,this,t);const n=e/1e3;j(mN,this,z(mN,this)+n*z(vN,this)),this.trigger(yh.CLOCK_TICK,{currentTime:z(mN,this)})}function _N(t){return"number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t)||t<0?0:t}function IN(t){return"number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t)||t<=0?z(vN,this)||1:t}var TN=new WeakMap,EN=new WeakSet;class SN extends fh{constructor(...t){super(...t),$(this,EN),W(this,TN,new Map)}get name(){return"TrackBuffers"}get defaults(){return{}}refreshNode(t){if(!t||!Array.isArray(t.tracks))return;const e=t.id,n=z(TN,this).get(e)||new Map;z(TN,this).set(e,n),t.tracks.forEach((t=>{const i=null==t?void 0:t.type;if(!i)return;const r=t.buffered,o=n.get(i),s=!!o&&o.ready,a=(l=r)&&Number.isFinite(l.start)&&Number.isFinite(l.end)&&l.end>l.start;var l,c,u;u=r,!(c=null==o?void 0:o.range)&&!u||c&&u&&c.start===u.start&&c.end===u.end?o&&o.ready!==a&&n.set(i,{range:r,ready:a}):(n.set(i,{range:r,ready:a}),this.trigger(yh.TRACK_BUFFER_UPDATE,{nodeId:e,trackType:i,range:r})),!s&&a?this.trigger(yh.TRACK_READY,{nodeId:e,trackType:i,range:r}):s&&!a&&this.trigger(yh.TRACK_UNDERFLOW,{nodeId:e,trackType:i,range:r})}))}getTrackRange(t,e){const n=z(TN,this).get(t),i=null==n?void 0:n.get(e);return null==i?void 0:i.range}computeBuffered(t=[],e=0,n){if(!n||"function"!=typeof n.get)return;const i=Number.isFinite(e)?e:0;let r,o,s=!1;for(let e=0;e<t.length;e+=1){const a=B(EN,this,AN).call(this,n,t[e],i);if(!a||a.end<=i)continue;if(void 0===r){r=a.start,o=a.end,s=a.full;continue}const l=a.start<=o,c=s&&a.full;if(!l&&!c)break;o=Math.max(o,a.end),s=a.full}return void 0===r||void 0===o?{start:0,end:0}:{start:r,end:o}}get buffered(){return z(TN,this)}reset(){z(TN,this).clear()}onDispose(){z(TN,this).clear(),"function"==typeof this.off&&this.off()}}function MN(t,e=0){const n=Array.isArray(null==t?void 0:t.segments)?t.segments:[],i=[];for(let t=0;t<n.length;t+=1){const e=n[t];if(!e||e.isInit)continue;const r=Number(e.duration),o=Number(e.offset),s=Number(e.bufferedRatio);if(!Number.isFinite(r)||r<=0||!Number.isFinite(o)||s<=0)continue;const a=o+r*Math.min(1,s);!Number.isFinite(a)||a<=o||i.push({start:o,end:a})}if(!i.length)return;i.sort(((t,e)=>t.start-e.start));const r=[i[0]];for(let t=1;t<i.length;t+=1){const e=i[t],n=r[r.length-1];e.start<=n.end+.001?n.end=Math.max(n.end,e.end):r.push({...e})}const o=Number.isFinite(e)?e:0;for(let t=0;t<r.length;t+=1){const e=r[t];if(e.end>o+.001)return e}}function AN(t,e,n=0){var i,r;const o=Tv(e);if(!Number.isFinite(o))return;const s=t.get(e.nodeId);if(!s)return;const a=Array.isArray(s.tracks)?s.tracks:[];if(!a.length){const t=s.buffered;if(!t||!Number.isFinite(t.start)||!Number.isFinite(t.end))return;return B(EN,this,NN).call(this,s,t,o,e)}const l=s.mainTrackId,c=Number.isFinite(e.nodeOffsetOverride)?e.nodeOffsetOverride:0,u=Math.max(0,n-o+c);let d;l&&(d=a.find((t=>(null==t?void 0:t.id)===l))),(null===(i=d)||void 0===i?void 0:i.type)||(d=a.find((t=>null==t?void 0:t.type)));const h=B(EN,this,MN).call(this,d,u)||(null===(r=d)||void 0===r?void 0:r.buffered);return h&&Number.isFinite(h.start)&&Number.isFinite(h.end)?B(EN,this,NN).call(this,s,h,o,e):void 0}function NN(t,e,n,i){const r=Number.isFinite(i.nodeOffsetOverride)?i.nodeOffsetOverride:0;let o=e.start-r+n,s=e.end-r+n;const a=t.duration,l=Number.isFinite(i.nodeDurationOverride)?i.nodeDurationOverride:a;if(Number.isFinite(l)){const t=n+l;s=Math.min(s,t);const e=o<=n&&s>=t;if(o=Math.max(o,n),!(s>o))return;return{start:o,end:s,full:e}}if(o=Math.max(o,n),s>o)return{start:o,end:s,full:!1}}class FN{constructor(t={}){const{placementId:e,nodeId:n,offset:i,offsetPending:r=!1,offsetAnchorPlacementId:o,offsetEndSeconds:s,offsetAnchorEdge:a,offsetAnchorIsReference:l,nodeOffsetOverride:c,nodeDurationOverride:u,loop:d=!1,loopRootPlacementId:h,loopRootOffset:f}=t;if(!e)throw new Error("Placement requires placementId");if(!n)throw new Error("Placement requires nodeId");this.placementId=e,this.nodeId=n;const p=Number.isFinite(i)?i:0;this.offsetPending=!0===r,this.offsetAnchorPlacementId=o,this.offsetAnchorEdge=a,this.offsetAnchorIsReference=l,this.offsetEndSeconds=Number.isFinite(s)?s:void 0,this.offset=this.offsetPending?void 0:p,this.nodeOffsetOverride=c,this.nodeDurationOverride=u,this.loop=!0===d,this.loopRootPlacementId=h,this.loopRootOffset=f}}class CN extends fh{constructor(t,e){super(e),this.timeline=t}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"handleDecodedFrame","handleClockTick","handleMainTrackBufferUpdate"])}enter(){}exit(){}play(){this.timeline.transitionTo(Cg)}pause(){this.timeline.transitionTo(Rg)}wait(){this.timeline.transitionTo(Pg)}reset(){this.timeline.transitionTo(Bg)}seek(t){this.timeline.transitionTo(Dg,{targetTime:t,returnState:this.timeline.state})}getCurrentTime(){return this.timeline.currentTime}emitPlayerStateEvent(t,e={}){if(!t||!this.timeline||"function"!=typeof this.timeline.trigger)return;const n=Number.isFinite(null==e?void 0:e.time)?e.time:this.getCurrentTime(),i={...e,event:t};Number.isFinite(n)&&(i.time=n),this.timeline.trigger("player:state",i)}get buffered(){return this.timeline.computeBuffered(this.timeline.currentTime)}handleMainTrackUnderflow(t){this.wait()}handleMainTrackReady(t){const e=this.timeline.getLastStableState()||Rg;this.timeline.transitionTo(e)}handleMainTrackBufferUpdate(t){}handleDecodedFrame(t){}handleClockTick(t){}onDispose(){this.timeline=null}}const ON=24e3/1001;function PN(t,e=(null==t?void 0:t.currentTime)){return Number.isFinite(e)?e:Number.isFinite(null==t?void 0:t.currentTime)?t.currentTime:0}function RN(t){var e;const n=Number(null==t||null===(e=t.settings)||void 0===e?void 0:e.snapToFps);return Number.isFinite(n)&&n>0?.5/n:.001}function DN(t){var e;const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];let i;if(null!=t&&t.mainTrackId){const e=n.find((e=>(null==e?void 0:e.id)===t.mainTrackId));i=null==e?void 0:e.type}if(i||(i=null===(e=n.find((t=>null==t?void 0:t.type)))||void 0===e?void 0:e.type),"video"===i||"audio"===i||"image"===i)return i}function BN(t){const e=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];if(e.length){if(null!=t&&t.mainTrackId){const n=e.find((e=>(null==e?void 0:e.id)===t.mainTrackId));if("video"===(null==n?void 0:n.type)||"image"===(null==n?void 0:n.type))return n}return e.find((t=>"video"===(null==t?void 0:t.type)||"image"===(null==t?void 0:t.type)))}}function LN(t,e,n,i,r){var o,s;const a="function"==typeof(null==t?void 0:t.getDecodedVisualBuffer)?t.getDecodedVisualBuffer(e,n):void 0;if(!a)return"function"==typeof(null==t?void 0:t.hasDecodedFirstFrame)&&t.hasDecodedFirstFrame(e,i);const l=Array.isArray(a.frames)?a.frames:[];let c,u=Number.isFinite(null===(o=a.current)||void 0===o?void 0:o.presentationTime)?a.current:void 0;for(let t=0;t<l.length;t+=1){const e=l[t],n=Number(null==e?void 0:e.presentationTime);if(Number.isFinite(n)){if(!(n<=r)){c=n;break}u=e}}const d=Number(null===(s=u)||void 0===s?void 0:s.presentationTime);if(!Number.isFinite(d)||d>r)return!1;const h=function(t,e,n,i){const r=Number(null==n?void 0:n.duration);if(Number.isFinite(r)&&r>0)return e+r;const o=function(t,e){const n=Number(null==t||null===(e=t.settings)||void 0===e?void 0:e.snapToFps);return 2/(Number.isFinite(n)&&n>0?n:ON)}(t),s=Number.isFinite(i)&&i>e?i-e:o;return e+Math.min(s,o)}(t,d,u,c);return!!Number.isFinite(h)&&r<=h+RN(t)}function zN(t,e=(null==t?void 0:t.currentTime)){const n=PN(t,e),i="function"==typeof(null==t?void 0:t.getPlacementsActiveAtTime)?t.getPlacementsActiveAtTime(n):[];if(!i.length)return!1;for(let e=0;e<i.length;e+=1){const n=i[e],r=null==n?void 0:n.placementId;if(!r)return!0;const o="function"==typeof(null==t?void 0:t.getNode)?t.getNode(n.nodeId):void 0;if(!o)return!0;const s=DN(o);if(!s)return!0;if(!t.hasDecodedFirstFrame(r,s))return!0}return!1}function WN(t,e=(null==t?void 0:t.currentTime)){return zN(t,e)||function(t,e=(null==t?void 0:t.currentTime)){const n=PN(t,e),i="function"==typeof(null==t?void 0:t.getPlacementsActiveAtTime)?t.getPlacementsActiveAtTime(n):[];if(!i.length)return!1;for(let e=0;e<i.length;e+=1){const r=i[e],o=null==r?void 0:r.placementId;if(!o)return!0;const s="function"==typeof(null==t?void 0:t.getNode)?t.getNode(r.nodeId):void 0;if(!s)return!0;const a=BN(s);if(null!=a&&a.id&&!LN(t,o,a.id,a.type,n))return!0}return!1}(t,e)}function jN(t,e=(null==t?void 0:t.currentTime)){if("function"!=typeof(null==t?void 0:t.computeBuffered))return!1;const n=PN(t,e),i=t.computeBuffered(n),r=Number(null==i?void 0:i.start),o=Number(null==i?void 0:i.end);if(!Number.isFinite(r)||!Number.isFinite(o)||o<=r)return!1;const s=RN(t);if(!(r<=n+s))return!1;return o-n>=function(t,e){const n=Number(null==t||null===(e=t.settings)||void 0===e?void 0:e.waitingBufferAheadSeconds);return!Number.isFinite(n)||n<0?3:n}(t)-s||function(t,e,n,i){const r=function(t){const e=Array.isArray(null==t?void 0:t.placements)?t.placements:[];let n;for(let i=0;i<e.length;i+=1){const r=e[i],o=Tv(r);if(!Number.isFinite(o))continue;const s="function"==typeof(null==t?void 0:t.getPlacementDuration)?t.getPlacementDuration(r):void 0;if(!Number.isFinite(s))continue;const a=o+s;Number.isFinite(a)&&(!Number.isFinite(n)||a>n)&&(n=a)}return n}(t);return!!Number.isFinite(r)&&(e>=r-i||n>=r-i)}(t,n,o,s)}const $N={[Fg]:class extends CN{get name(){return Fg}get defaults(){return{autoplay:nk("autoplay")}}enter(){this.timeline.recordStableState(Rg),this.timeline.stopPlaybackClock()}play(){const t=WN(this.timeline),e=t?Pg:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t)return this.timeline.recordStableState(Cg),void this.timeline.transitionTo(Pg);this.timeline.transitionTo(e)}pause(){}handleDecodedFrame(t){if(!0!==this.settings.autoplay)return;if(!Array.isArray(this.timeline.placements)||!this.timeline.placements.length)return;if(WN(this.timeline))return;const e=this.timeline.getPlaybackStartState();this.log.info("[handleDecodedFrame] Autoplay enabled, starting playback!"),this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),this.timeline.transitionTo(e)}},[Og]:class extends CN{get name(){return Og}enter(t={}){const{from:e,to:n}=t;this.timeline.recordStableState(Cg),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("canplay",{from:e,to:n})}play(){}handleMainTrackUnderflow(){}pause(){this.timeline.transitionTo(Rg)}},[Cg]:class extends CN{get name(){return Cg}enter(t={}){const{from:e,to:n,fromFirstFramePending:i}=t;this.timeline.recordStableState(Cg),this.timeline.startPlaybackClock(),!0!==i&&this.emitPlayerStateEvent("canplay",{from:e,to:n}),this.emitPlayerStateEvent("playing",{from:e,to:n})}play(){}pause(){this.timeline.transitionTo(Rg)}handleClockTick(t){const e=this.timeline.currentTime;WN(this.timeline,e)&&(this.timeline.recordStableState(Cg),this.timeline.transitionTo(Pg))}},[Pg]:(ln=new WeakMap,cn=new WeakMap,un=new WeakSet,class extends CN{constructor(...t){super(...t),$(this,un),W(this,ln,void 0),W(this,cn,null)}get name(){return Pg}enter(t={}){const{from:e,to:n}=t;this.timeline.stopPlaybackClock(),B(un,this,UN).call(this),B(un,this,VN).call(this),this.emitPlayerStateEvent("waiting",{from:e,to:n}),B(un,this,KN).call(this)}exit(){B(un,this,qN).call(this),B(un,this,GN).call(this)}play(){this.timeline.recordStableState(Cg);const t=B(un,this,HN).call(this),e=t?Pg:this.timeline.getPlaybackStartState();this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t||this.timeline.transitionTo(e)}pause(){this.timeline.transitionTo(Rg)}handleMainTrackReady(t){const e=this.timeline.getLastStableState()||Rg;e!==Cg?this.timeline.transitionTo(e):B(un,this,KN).call(this)}handleDecodedFrame(t){B(un,this,KN).call(this)}handleMainTrackBufferUpdate(t){B(un,this,KN).call(this)}}),[Rg]:class extends CN{get name(){return Rg}enter(t={}){const{from:e,to:n}=t;this.timeline.recordStableState(Rg),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("pause",{from:e,to:n})}play(){const t=WN(this.timeline),e=t?Pg:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t)return this.timeline.recordStableState(Cg),void this.timeline.transitionTo(Pg);this.timeline.transitionTo(e)}pause(){}},[Dg]:class extends CN{get name(){return Dg}enter(t={}){const{targetTime:e,returnState:n}=t;if(this.timeline&&"function"==typeof this.timeline.stopPlaybackClock&&this.timeline.stopPlaybackClock(),this.timeline&&"function"==typeof this.timeline.startSeeking)return void this.timeline.startSeeking(e,n);this.timeline.updateTime(e);const i=n===Cg||n===Og,r=i&&"function"==typeof this.timeline.getPlaybackStartState?this.timeline.getPlaybackStartState(e):i?Cg:Rg;this.timeline.transitionTo(r,{fromSeeking:!0})}play(){var t;if(this.timeline&&"function"==typeof this.timeline.setSeekReturnState)return void this.timeline.setSeekReturnState(Cg);const e="function"==typeof(null===(t=this.timeline)||void 0===t?void 0:t.getPlaybackStartState)?this.timeline.getPlaybackStartState():Cg;this.timeline.transitionTo(e)}pause(){this.timeline&&"function"==typeof this.timeline.setSeekReturnState?this.timeline.setSeekReturnState(Rg):this.timeline.transitionTo(Rg)}handleDecodedFrame(t){this.timeline&&"function"==typeof this.timeline.maybeCompleteSeek&&this.timeline.maybeCompleteSeek(t)}},[Bg]:class extends CN{get name(){return Bg}enter(){this.timeline.resetClock(),this.timeline.transitionTo(Fg,{fromReset:!0})}play(){}pause(){}get buffered(){return{start:0,end:0}}}};function UN(){var t;const e=null===(t=this.timeline)||void 0===t?void 0:t.trackBuffers;e&&"function"==typeof e.on&&(j(ln,this,(t=>this.handleMainTrackBufferUpdate(t))),e.on(yh.TRACK_BUFFER_UPDATE,z(ln,this)))}function qN(){var t;const e=null===(t=this.timeline)||void 0===t?void 0:t.trackBuffers;z(ln,this)&&e&&"function"==typeof e.off?(e.off(yh.TRACK_BUFFER_UPDATE,z(ln,this)),j(ln,this,null)):j(ln,this,null)}function VN(){if(null!==z(cn,this))return;const t="function"==typeof(null==vh?void 0:vh.setInterval)?vh.setInterval.bind(vh):setInterval;j(cn,this,t((()=>{var t;(null===(t=this.timeline)||void 0===t?void 0:t.state)===Pg&&B(un,this,KN).call(this)}),200))}function GN(){null!==z(cn,this)&&(("function"==typeof(null==vh?void 0:vh.clearInterval)?vh.clearInterval.bind(vh):clearInterval)(z(cn,this)),j(cn,this,null))}function HN(t=(t=>null===(t=this.timeline)||void 0===t?void 0:t.currentTime)()){return function(t,e=(null==t?void 0:t.currentTime),n={}){return!!zN(t,e)||!0===n.skipBufferResume||!jN(t,e)}(this.timeline,t)}function KN(t=(t=>null===(t=this.timeline)||void 0===t?void 0:t.currentTime)()){return(this.timeline.getLastStableState()||Rg)===Cg&&!B(un,this,HN).call(this,t)&&(this.timeline.transitionTo(this.timeline.getPlaybackStartState(t)),!0)}function XN(t){return t&&("string"!=typeof t.state||"ready"===t.state)}function YN(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).some((t=>"video"===(null==t?void 0:t.type)))}function QN(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).some((t=>"video"===(null==t?void 0:t.type)||"image"===(null==t?void 0:t.type)))}function JN(t){return t===Cg||t===Og}var ZN=new WeakMap,tF=new WeakMap,eF=new WeakMap,nF=new WeakMap,iF=new WeakMap,rF=new WeakMap,oF=new WeakMap,sF=new WeakMap,aF=new WeakMap,lF=new WeakMap,cF=new WeakMap,uF=new WeakMap,dF=new WeakMap,hF=new WeakMap,fF=new WeakSet;class pF{constructor(t={}){$(this,fF),W(this,ZN,void 0),W(this,tF,void 0),W(this,eF,void 0),W(this,nF,void 0),W(this,iF,void 0),W(this,rF,void 0),W(this,oF,void 0),W(this,sF,void 0),W(this,aF,void 0),W(this,lF,null),W(this,cF,Rg),W(this,uF,[]),W(this,dF,new Set),W(this,hF,new Map),j(ZN,this,t.getState),j(tF,this,t.getNode),j(eF,this,t.getPlacementsActiveAtTime),j(nF,this,t.getLastStableState),j(iF,this,t.getPlaybackStartState),j(rF,this,t.clearVisualFrameBuffers),j(oF,this,t.updateTime),j(sF,this,t.transitionTo),j(aF,this,t.trigger)}start(t,e){const n=Number(t);if(!Number.isFinite(n))return;let i=e;i===Dg?i=z(cF,this):i===Pg&&"function"==typeof z(nF,this)&&(i=z(nF,this).call(this)),j(cF,this,JN(i)?Cg:Rg),j(lF,this,n),z(dF,this).clear(),z(hF,this).clear(),j(uF,this,"function"==typeof z(eF,this)?z(eF,this).call(this,n):[]),"function"==typeof z(rF,this)&&z(rF,this).call(this),"function"==typeof z(oF,this)&&z(oF,this).call(this,n,{source:"seek"}),"function"==typeof z(aF,this)&&z(aF,this).call(this,yh.TIMELINE_SEEKING,{targetTime:n,placements:z(uF,this).slice()}),this.maybeComplete()}setReturnState(t){j(cF,this,JN(t)?Cg:Rg)}maybeComplete(t){if(("function"==typeof z(ZN,this)?z(ZN,this).call(this):void 0)!==Dg)return;const e=z(lF,this);if(!Number.isFinite(e))return;const n=null==t?void 0:t.trackType,i=null==t?void 0:t.placementId;if(i&&"video"===n){const n=Number(null==t?void 0:t.pts);if(Number.isFinite(n)&&n>=e){z(dF,this).add(i);const t=z(hF,this).get(i);(!Number.isFinite(t)||n<t)&&z(hF,this).set(i,n)}}else i&&"image"===n&&function(t,e){const n=Number(null==t?void 0:t.pts),i=Number(null==t?void 0:t.duration);return!Number.isFinite(n)||(Number.isFinite(i)&&i>0?e>=n&&e<n+i:e>=n)}(t,e)&&z(dF,this).add(i);const r=Array.isArray(z(uF,this))?z(uF,this):[];if(r.length){if("function"==typeof z(tF,this)){for(let t=0;t<r.length;t+=1){const e=r[t],n=null==e?void 0:e.placementId;if(!n)return;const i=z(tF,this).call(this,e.nodeId);if(!XN(i))return;if(QN(i)&&!z(dF,this).has(n))return}B(fF,this,mF).call(this,e,r)}}else B(fF,this,mF).call(this,e,[])}dispose(){j(uF,this,[]),z(dF,this).clear(),z(hF,this).clear(),j(lF,this,null)}}function mF(t,e){const n=B(fF,this,vF).call(this,t,e);if("function"==typeof z(oF,this)&&z(oF,this).call(this,n,{source:"seek"}),j(lF,this,null),j(uF,this,[]),z(dF,this).clear(),z(hF,this).clear(),"function"==typeof z(aF,this)&&z(aF,this).call(this,yh.TIMELINE_SEEKED,{targetTime:t,placements:Array.isArray(e)?e.slice():[]}),"function"==typeof z(sF,this)){const t=z(cF,this)===Cg&&"function"==typeof z(iF,this)?z(iF,this).call(this,n):z(cF,this);z(sF,this).call(this,t,{fromSeeking:!0})}}function vF(t,e){const n=Number(t);if(!Number.isFinite(n))return t;if(!Array.isArray(e)||!e.length||"function"!=typeof z(tF,this))return n;let i=n;for(let t=0;t<e.length;t+=1){const n=e[t],r=null==n?void 0:n.placementId;if(!r)continue;if(!YN(z(tF,this).call(this,n.nodeId)))continue;const o=z(hF,this).get(r);Number.isFinite(o)&&o>i&&(i=o)}return i}function gF(t){if(t&&"function"==typeof t.close)try{t.close()}catch(t){}}function yF(t){if(!t)return;const e=Array.isArray(null==t?void 0:t.frames)?t.frames:[],n=null==t?void 0:t.current;(n?[n,...e]:e).forEach((t=>gF(null==t?void 0:t.frame)))}function bF(t){return Tv(t)}function kF(t){return Number.isFinite(null==t?void 0:t.loopRootOffset)?t.loopRootOffset:bF(t)}function xF(t,e){return"string"==typeof(null==t?void 0:t.loopRootPlacementId)&&t.loopRootPlacementId?t.loopRootPlacementId:e}function wF(t){if("string"!=typeof t)return Number.NaN;const e=t.match(/(\d+)/);return e?Number(e[1]):Number.NaN}function _F(t){if(!t)return;const e=[[t.displayWidth,t.displayHeight],[t.codedWidth,t.codedHeight],[t.videoWidth,t.videoHeight],[t.naturalWidth,t.naturalHeight],[t.width,t.height]];for(let t=0;t<e.length;t+=1){const[n,i]=e[t],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}const IF=1e-6;function TF(t){return t&&("string"!=typeof t.state||"ready"===t.state)}function EF(t){const e=Number(t);return Number.isFinite(e)?e:0}function SF(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).filter((t=>"cue"===(null==t?void 0:t.type)&&Array.isArray(null==t?void 0:t.cues)))}function MF(t){return t&&"cue"===t.type&&Array.isArray(t.cues)?t.cues:[]}var AF=new WeakMap,NF=new WeakMap,FF=new WeakMap,CF=new WeakMap,OF=new WeakMap,PF=new WeakMap,RF=new WeakMap,DF=new WeakMap,BF=new WeakSet;class LF{constructor(t={}){$(this,BF),W(this,AF,void 0),W(this,NF,void 0),W(this,FF,void 0),W(this,CF,void 0),W(this,OF,void 0),W(this,PF,void 0),W(this,RF,-1e-6),W(this,DF,null),j(AF,this,t.getPlacements),j(NF,this,t.getPlacementsActiveAtTime),j(FF,this,t.getPlacementDuration),j(CF,this,t.getNode),j(OF,this,t.triggerTimeline),j(PF,this,t.triggerNode)}handleSeeking(t,e){const n=EF(t);j(DF,this,n)}handleSeeked(t){const e=EF(t),n=z(DF,this);j(DF,this,null),Number.isFinite(n)?(B(BF,this,WF).call(this,n,e),j(RF,this,e)):j(RF,this,e)}handleTimeUpdate(t,e={}){const n=EF(t),i=z(RF,this);!0===(null==e?void 0:e.isSeeking)?j(RF,this,n):Number.isFinite(i)?n<=i?n<i&&j(RF,this,n-IF):(B(BF,this,zF).call(this,i,n),j(RF,this,n)):j(RF,this,n)}dispose(){j(DF,this,null),j(RF,this,-1e-6)}}function zF(t,e){const n="function"==typeof z(AF,this)?z(AF,this).call(this):[];B(BF,this,jF).call(this,n,t,e,{onlySticky:!1})}function WF(t,e){if("function"!=typeof z(NF,this))return;const n=z(NF,this).call(this,e);B(BF,this,jF).call(this,n,t,e,{onlySticky:!0})}function jF(t,e,n,i={}){if("function"!=typeof z(CF,this)||"function"!=typeof z(OF,this))return;if(!Array.isArray(t)||!t.length)return;const r=!0===i.onlySticky,o=[];for(let i=0;i<t.length;i+=1){const s=t[i],a=null==s?void 0:s.placementId,l=null==s?void 0:s.nodeId;if(!a||!l)continue;const c=z(CF,this).call(this,l);if(!TF(c))continue;const u=SF(c);if(!u.length)continue;const d=Tv(s);if(!Number.isFinite(d))continue;const h=Number.isFinite(null==s?void 0:s.nodeOffsetOverride)?s.nodeOffsetOverride:0,f="function"==typeof z(FF,this)?z(FF,this).call(this,s):void 0,p="number"==typeof f&&Number.isFinite(f)?d+f:Number.POSITIVE_INFINITY,m=r?d-IF:e;for(let t=0;t<u.length;t+=1){const e=MF(u[t]);for(let i=0;i<e.length;i+=1){const s=e[i],c=EF(null==s?void 0:s.timestamp),u=d+Math.max(0,c-h);u<=p&&(r&&!0!==(null==s?void 0:s.isSticky)||u>m&&u<=n&&"string"==typeof(null==s?void 0:s.name)&&s.name&&o.push({time:u,placementOffset:d,placementId:a,nodeId:l,cuepoint:s,trackIndex:t,cueIndex:i}))}}}o.length&&(o.sort(((t,e)=>t.time!==e.time?t.time-e.time:t.placementOffset!==e.placementOffset?t.placementOffset-e.placementOffset:t.placementId!==e.placementId?t.placementId<e.placementId?-1:1:t.trackIndex!==e.trackIndex?t.trackIndex-e.trackIndex:t.cueIndex-e.cueIndex)),o.forEach((t=>{const e=t.cuepoint,n={time:t.time,nodeId:t.nodeId,placementId:t.placementId,cuepoint:e};z(OF,this).call(this,"cuepoint",n),z(OF,this).call(this,e.name,n),"function"==typeof z(PF,this)&&(z(PF,this).call(this,t.nodeId,"cuepoint",n),z(PF,this).call(this,t.nodeId,e.name,n))})))}class $F{#et;#nt=0;#it=new Set;constructor(t){this.#et="string"==typeof t?t:""}claim(t){if(t)return this.#it.add(t),t;let e;do{e=`${this.#et}${++this.#nt}`}while(this.#it.has(e));return this.#it.add(e),e}reset(){this.#nt=0,this.#it.clear()}}const UF=24e3/1001;function qF(t){var e;const n=null==t?void 0:t.frame;if(!n||!0===n.__closed||!0===n.closed)return 0;if("function"==typeof n.allocationSize)try{const t=Number(n.allocationSize());if(Number.isFinite(t)&&t>0)return t}catch(t){}const i=Number(null==n?void 0:n.byteLength);if(Number.isFinite(i)&&i>0)return i;const r=Number(null==n||null===(e=n.data)||void 0===e?void 0:e.byteLength);if(Number.isFinite(r)&&r>0)return r;const o=function(t,e){const n=Number(null==t?void 0:t.width),i=Number(null==t?void 0:t.height);return Number.isFinite(n)&&Number.isFinite(i)&&n>0&&i>0?{width:n,height:i}:_F(e)}(t,n),s=Number(null==o?void 0:o.width),a=Number(null==o?void 0:o.height);return Number.isFinite(s)&&Number.isFinite(a)&&s>0&&a>0?s*a*4:0}var VF=new WeakMap,GF=new WeakMap,HF=new WeakMap,KF=new WeakMap,XF=new WeakMap,YF=new WeakMap,QF=new WeakMap,JF=new WeakMap,ZF=new WeakMap,tC=new WeakMap,eC=new WeakMap,nC=new WeakMap,iC=new WeakMap,rC=new WeakMap,oC=new WeakMap,sC=new WeakMap,aC=new WeakMap,lC=new WeakMap,cC=new WeakMap,uC=new WeakMap,dC=new WeakMap,hC=new WeakMap,fC=new WeakMap,pC=new WeakMap,mC=new WeakMap,vC=new WeakMap,gC=new WeakMap,yC=new WeakMap,bC=new WeakMap,kC=new WeakMap,xC=new WeakMap,wC=new WeakMap,_C=new WeakMap,IC=new WeakSet;class TC extends fh{constructor(...t){super(...t),$(this,IC),W(this,VF,void 0),W(this,GF,void 0),W(this,HF,void 0),W(this,KF,void 0),W(this,XF,void 0),W(this,YF,!1),W(this,QF,[]),W(this,JF,new $F("placement-")),W(this,ZF,[]),W(this,tC,new $F("renderplacement-")),W(this,eC,void 0),W(this,nC,void 0),W(this,iC,void 0),W(this,rC,!1),W(this,oC,new Set),W(this,sC,new Set),W(this,aC,new Map),W(this,lC,[]),W(this,cC,0),W(this,uC,new Set),W(this,dC,new Set),W(this,hC,Number.NEGATIVE_INFINITY),W(this,fC,[]),W(this,pC,Number.NEGATIVE_INFINITY),W(this,mC,0),W(this,vC,void 0),W(this,gC,void 0),W(this,yC,new Map),W(this,bC,null),W(this,kC,void 0),W(this,xC,void 0),W(this,wC,void 0),W(this,_C,void 0);const[e,n={}]=t;j(VF,this,e),j(vC,this,n),j(XF,this,new xN(n)),j(eC,this,new SN(n)),j(KF,this,Rg),B(IC,this,DC).call(this),B(IC,this,BC).call(this),j(kC,this,new pF({getState:()=>this.state,getNode:t=>z(VF,this)&&"function"==typeof z(VF,this).get?z(VF,this).get(t):void 0,getPlacementsActiveAtTime:t=>B(IC,this,vO).call(this,t,{endEpsilonSeconds:B(IC,this,TO).call(this)}),getLastStableState:()=>this.getLastStableState(),getPlaybackStartState:t=>this.getPlaybackStartState(t),clearVisualFrameBuffers:()=>B(IC,this,pO).call(this),updateTime:(t,e)=>this.updateTime(t,e),transitionTo:(t,e)=>this.transitionTo(t,e),trigger:(t,e)=>this.trigger(t,e)})),j(xC,this,new LF({getPlacements:()=>z(QF,this).slice(),getPlacementsActiveAtTime:t=>B(IC,this,vO).call(this,t),getPlacementDuration:t=>B(IC,this,QC).call(this,t),getNode:t=>z(VF,this)&&"function"==typeof z(VF,this).get?z(VF,this).get(t):void 0,triggerTimeline:(t,e)=>this.trigger(t,e),triggerNode:(t,e,n)=>{const i=z(VF,this)&&"function"==typeof z(VF,this).get?z(VF,this).get(t):void 0;i&&"function"==typeof i.trigger&&i.trigger(e,n)}})),j(wC,this,(()=>{var t,e;null===(t=z(xC,this))||void 0===t||null===(e=t.handleSeeked)||void 0===e||e.call(t,this.currentTime)})),this.on(yh.TIMELINE_SEEKED,z(wC,this)),j(_C,this,(t=>B(IC,this,qC).call(this,t))),this.on("nodestart",z(_C,this)),this.transitionTo(Fg)}get name(){return"Timeline"}get defaults(){return{snapToFps:UF,maxBufferedVideoFrames:24}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"computeBuffered","notifyDecodedFrame","getDecodedFrameStats","getActiveRenderPlacement","maybeCompleteSeek","getPlacementsActiveAtTime","hasDecodedFirstFrame","getDecodedVisualBuffer","getPlacementDuration","getNode"])}transitionTo(t,e={}){const n=z(HF,this),i=function(t,e,n={}){const i=$N[t];return i?new i(e,n):null}(t,this,z(vC,this)),r=e&&"object"==typeof e&&!Array.isArray(e)?{...e,from:n,to:t}:{from:n,to:t};i?(z(GF,this)&&"function"==typeof z(GF,this).exit&&z(GF,this).exit(),j(GF,this,i),j(HF,this,t),"function"==typeof i.enter&&i.enter(r),this.trigger(yh.TIMELINE_STATE_CHANGE,{from:n,to:t,options:e})):this.log.warn(`Unknown state "${t}"`)}recordStableState(t){j(KF,this,t)}getLastStableState(){return z(KF,this)}enableFirstFrameRenderedGate(){j(YF,this,!0)}getPlaybackStartState(t=this.currentTime){return this.shouldWaitForFirstRenderedFrame(t)?Og:Cg}shouldWaitForFirstRenderedFrame(t=this.currentTime){if(!z(YF,this)||z(rC,this))return!1;const e=Number.isFinite(t)?t:this.currentTime,n=B(IC,this,vO).call(this,e);return Array.isArray(n)&&n.length>0}notifyFirstFrameRendered(){z(rC,this)||(j(rC,this,!0),this.state===Og&&this.transitionTo(Cg,{fromFirstFramePending:!0}))}get state(){return z(HF,this)}get paused(){return z(HF,this)===Fg||z(HF,this)===Rg}get currentTime(){return z(XF,this).currentTime}set currentTime(t){z(GF,this).seek(t)}get playbackRate(){return z(XF,this).playbackRate}set playbackRate(t){z(XF,this).playbackRate=t}play(){z(GF,this).play()}pause(){z(GF,this).pause()}reset(){z(GF,this).reset()}seekToPlacement(t){if(!t)throw new Error("Timeline.seekToPlacement requires placement id");B(IC,this,HC).call(this);const e=B(IC,this,xO).call(this,t);if(!e)throw new Error("Timeline.seekToPlacement requires placement id");const n=Tv(e);if(!Number.isFinite(n))throw new Error("Timeline.seekToPlacement requires resolved placement offset");return this.currentTime=n,n}updateTime(t,e={}){var n,i;B(IC,this,HC).call(this),B(IC,this,KC).call(this),z(XF,this).seek(t),B(IC,this,mO).call(this,this.currentTime),B(IC,this,gO).call(this);const r="string"==typeof(null==e?void 0:e.source)?e.source:"set";null!==(n=z(xC,this))&&void 0!==n&&null!==(i=n.handleTimeUpdate)&&void 0!==i&&i.call(n,this.currentTime,{isSeeking:this.state===Dg}),B(IC,this,VC).call(this,this.currentTime),B(IC,this,cO).call(this,this.currentTime),this.trigger(yh.TIMELINE_TIME_UPDATE,bh(this.currentTime,r))}startSeeking(t,e){var n,i;null!==(n=z(xC,this))&&void 0!==n&&null!==(i=n.handleSeeking)&&void 0!==i&&i.call(n,this.currentTime,t),z(kC,this)&&"function"==typeof z(kC,this).start&&z(kC,this).start(t,e)}setSeekReturnState(t){z(kC,this)&&"function"==typeof z(kC,this).setReturnState&&z(kC,this).setReturnState(t)}maybeCompleteSeek(t){z(kC,this)&&"function"==typeof z(kC,this).maybeComplete&&z(kC,this).maybeComplete(t)}startPlaybackClock(){z(XF,this).play()}stopPlaybackClock(){z(XF,this).pause()}resetClock(){var t,e;j(rC,this,!1),z(XF,this).reset(),this.trigger(yh.TIMELINE_RESET,{reason:"reset"}),null===(t=z(xC,this))||void 0===t||null===(e=t.dispose)||void 0===e||e.call(t)}applyTimelineDefinition(t={}){const e=Array.isArray(null==t?void 0:t.placements)?t.placements:[],n=Array.isArray(null==t?void 0:t.renderPlacements)?t.renderPlacements:[];B(IC,this,EC).call(this),B(IC,this,SC).call(this,e),B(IC,this,MC).call(this,n),this.currentTime=0}placeOnTimeline(t,e,n={}){const i=t&&"object"==typeof t?t.id:t;if(!i)throw new Error("Timeline.placeOnTimeline requires node id");const r=z(JF,this).claim(n.placementId),o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=Fv(e);if("string"==typeof e&&e.includes("@")&&!a)throw new Error("Timeline.placeOnTimeline requires valid placement reference");const{wantsEndOffset:l,endOffsetSeconds:c}=a?{wantsEndOffset:!1}:Nv(e,n);let u,d,h,f=!1;const p=null!==a;if(B(IC,this,HC).call(this),a){const t=z(QF,this).find((t=>(null==t?void 0:t.placementId)===a.placementId));if(!t)throw new Error("Timeline.placeOnTimeline requires valid placement reference");d=t.placementId,h=a.anchor;const e=Tv(t);if("start"===a.anchor)Number.isFinite(e)?u=B(IC,this,JC).call(this,e,{nodeOffsetOverride:o}):f=!0;else{const n=B(IC,this,QC).call(this,t);if(Number.isFinite(e)&&n>0){const t=e+n,i=B(IC,this,JC).call(this,t,{nodeOffsetOverride:o});u=Math.max(i,t)}else f=!0}}else if(l){const t=n.offsetAnchorPlacementId?z(QF,this).find((t=>(null==t?void 0:t.placementId)===n.offsetAnchorPlacementId)):z(QF,this).length?z(QF,this)[z(QF,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==t?void 0:t.placementId),d){const e=Tv(t),n=B(IC,this,QC).call(this,t);Number.isFinite(e)&&n>0?u=B(IC,this,JC).call(this,e+n-c,{nodeOffsetOverride:o}):(f=!0,h="end")}else u=B(IC,this,JC).call(this,-c,{nodeOffsetOverride:o})}else u=Av(e),u=B(IC,this,JC).call(this,u,{...n,nodeOffsetOverride:o});const m=!0===n.loop?n.loopRootPlacementId||r:void 0,v=!0===n.loop&&Number.isFinite(n.loopRootOffset)?n.loopRootOffset:!0===n.loop?u:void 0,g=l?c:a&&"end"===a.anchor?0:void 0,y=new FN({placementId:r,nodeId:i,offset:u,offsetPending:f,offsetAnchorPlacementId:f?d:void 0,offsetAnchorEdge:f?h:void 0,offsetAnchorIsReference:f?p:void 0,offsetEndSeconds:g,nodeOffsetOverride:o,nodeDurationOverride:s,loop:!0===n.loop,loopRootPlacementId:m,loopRootOffset:v});if(z(QF,this).push(y),Sv(z(QF,this)),B(IC,this,aO).call(this,y),B(IC,this,oO).call(this),f&&d){const t=z(QF,this).find((t=>(null==t?void 0:t.placementId)===d));B(IC,this,tO).call(this,null==t?void 0:t.nodeId)}return this.trigger(yh.PLACEMENT_ADDED,y),r}placeRenderNodeOnTimeline(t,e,n,i={}){const r="string"==typeof t?t:null==t?void 0:t.type;if(!r||"string"!=typeof r)throw new Error("Timeline.placeRenderNodeOnTimeline requires render node type");const o=B(IC,this,ZC).call(this,e,i),s=o.offset,a=!0===o.offsetPending,l=o.offsetAnchorPlacementId,c=o.offsetAnchorEdge,u=o.offsetAnchorIsReference,d=z(tC,this).claim(i.renderPlacementId),h=Number(n),f=h===Number.POSITIVE_INFINITY,p=Number.isFinite(h)&&h>0||f?h:void 0;if(!p)throw new Error("Timeline.placeRenderNodeOnTimeline requires a positive duration (seconds) or Infinity as 3rd argument");const m=i.params&&"object"==typeof i.params?i.params:void 0,v={renderPlacementId:d,type:r,offset:s,offsetPending:a,offsetAnchorPlacementId:l,offsetAnchorEdge:c,offsetAnchorIsReference:u,duration:p,params:m};if(!a){const t=s,e=s+p;Cv(z(ZF,this),t,e,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements")}if(z(ZF,this).push(v),Sv(z(ZF,this)),a&&l){const t=z(QF,this).find((t=>(null==t?void 0:t.placementId)===l));B(IC,this,tO).call(this,null==t?void 0:t.nodeId)}return this.trigger(yh.RENDER_PLACEMENT_ADDED,v),d}get placements(){return z(QF,this).slice()}getPlacementsActiveAtTime(t){return B(IC,this,vO).call(this,t)}getNodesAtTime(t){const e=B(IC,this,wO).call(this,t);if(!Number.isFinite(e))return[];const n=B(IC,this,vO).call(this,e),i=[];return n.forEach((t=>{const e=this.getNode(null==t?void 0:t.nodeId);e&&i.push(e)})),i}getPlacementDuration(t){return B(IC,this,QC).call(this,t)}getNode(t){if(z(VF,this)&&"function"==typeof z(VF,this).get)return z(VF,this).get(t)}get renderPlacements(){return z(ZF,this).slice()}get placementsAhead(){const t=this.currentTime;return z(QF,this).filter((e=>{const n=Tv(e);if(!Number.isFinite(n))return!1;const i=B(IC,this,QC).call(this,e);return"number"==typeof i?n+i>t:n>=t}))}get buffered(){return z(GF,this)?z(GF,this).buffered:{start:0,end:0}}get trackBuffers(){return z(eC,this)}onDispose(){B(IC,this,PC).call(this),z(sC,this)&&z(sC,this).clear(),z(xC,this)&&"function"==typeof z(xC,this).dispose&&z(xC,this).dispose(),j(xC,this,null),B(IC,this,OC).call(this),B(IC,this,RC).call(this),z(kC,this)&&"function"==typeof z(kC,this).dispose&&z(kC,this).dispose(),j(kC,this,null),z(XF,this)&&"function"==typeof z(XF,this).dispose&&(z(gC,this)&&"function"==typeof z(XF,this).off&&(z(XF,this).off("tick",z(gC,this)),j(gC,this,null)),z(XF,this).dispose(),j(XF,this,null)),B(IC,this,iO).call(this),j(GF,this,null),j(HF,this,null),j(QF,this,[]),j(ZF,this,[]),B(IC,this,rO).call(this),B(IC,this,oO).call(this),z(yC,this).clear(),j(bC,this,null)}notifyDecodedFrame(t={}){const e=null==t?void 0:t.placementId,n=null==t?void 0:t.trackType;if(!e||!n)return;const i=`${e}:${n}`;z(oC,this).add(i),B(IC,this,fO).call(this,t),B(IC,this,gO).call(this),z(GF,this)&&"function"==typeof z(GF,this).handleDecodedFrame&&z(GF,this).handleDecodedFrame(t)}getDecodedFrameStats(){return function(t){const e={totalBytes:0,frames:0,available:!1};if(!t||"function"!=typeof t.values)return e;for(const n of t.values()){const t=[];null!=n&&n.current&&t.push(n.current),Array.isArray(null==n?void 0:n.frames)&&t.push(...n.frames),t.forEach((t=>{const n=null==t?void 0:t.frame;if(!n||!0===n.__closed||!0===n.closed)return;e.frames+=1;const i=qF(t);Number.isFinite(i)&&i>0&&(e.totalBytes+=i)}))}return e.available=!0,e}(z(yC,this))}hasDecodedFirstFrame(t,e){return!(!t||!e)&&z(oC,this).has(`${t}:${e}`)}getDecodedVisualBuffer(t,e){if(t&&e)return z(yC,this).get(`${t}:${e}`)}computeBuffered(t){const e=z(VF,this);if(e&&"function"==typeof e.get)return z(eC,this).computeBuffered(z(QF,this),t,e)}getActiveRenderPlacement(t=this.currentTime){const e=Number.isFinite(t)?t:this.currentTime,n=Array.isArray(z(ZF,this))?z(ZF,this):[];if(!n.length)return;let i;for(let t=0;t<n.length;t+=1){const r=n[t];if(!0===(null==r?void 0:r.offsetPending))continue;const o="number"==typeof r.offset?r.offset:void 0;if(!Number.isFinite(o))continue;const s=r.duration;("number"==typeof s&&Number.isFinite(s)&&s>0?e>=o&&e<o+s:e>=o)&&(i=r)}return i}}function EC(){j(rC,this,!1),this.trigger(yh.TIMELINE_RESET,{reason:"switch"}),B(IC,this,pO).call(this),z(eC,this)&&"function"==typeof z(eC,this).reset&&z(eC,this).reset(),z(sC,this)&&z(sC,this).clear(),j(QF,this,[]),j(ZF,this,[]),B(IC,this,rO).call(this),B(IC,this,oO).call(this),z(JF,this).reset(),z(tC,this).reset()}function SC(t=[]){for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||!n.nodeId)continue;const i=B(IC,this,AC).call(this,n),r=B(IC,this,FC).call(this,n);this.placeOnTimeline(n.nodeId,r,i)}}function MC(t=[]){for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||!n.type)continue;const i=B(IC,this,NC).call(this,n),r=B(IC,this,CC).call(this,n);this.placeRenderNodeOnTimeline(n.type,r,n.duration,i)}}function AC(t){const e={};return t.placementId&&(e.placementId=t.placementId),Number.isFinite(t.nodeOffsetOverride)&&(e.nodeOffsetOverride=t.nodeOffsetOverride),Number.isFinite(t.nodeDurationOverride)&&(e.nodeDurationOverride=t.nodeDurationOverride),!0===t.offsetPending&&(e.offsetPending=!0,t.offsetAnchorPlacementId&&(e.offsetAnchorPlacementId=t.offsetAnchorPlacementId),t.offsetAnchorEdge&&(e.offsetAnchorEdge=t.offsetAnchorEdge)),Number.isFinite(t.offsetEndSeconds)&&(e.offsetEndSeconds=t.offsetEndSeconds),!0===t.loop&&(e.loop=!0),t.loopRootPlacementId&&(e.loopRootPlacementId=t.loopRootPlacementId),Number.isFinite(t.loopRootOffset)&&(e.loopRootOffset=t.loopRootOffset),e}function NC(t){const e={};return t.renderPlacementId&&(e.renderPlacementId=t.renderPlacementId),t.params&&"object"==typeof t.params&&(e.params=t.params),e}function FC(t){if(!0===t.offsetPending&&t.offsetAnchorPlacementId&&t.offsetAnchorEdge){if(!0===t.offsetAnchorIsReference)return`${t.offsetAnchorPlacementId}@${t.offsetAnchorEdge}`;if("end"===t.offsetAnchorEdge)return Number.isFinite(t.offsetEndSeconds)&&t.offsetEndSeconds>0?-t.offsetEndSeconds:"end"}return"string"==typeof t.offset||Number.isFinite(t.offset)?t.offset:0}function CC(t){return!0===t.offsetPending&&t.offsetAnchorPlacementId&&t.offsetAnchorEdge&&!0===t.offsetAnchorIsReference?`${t.offsetAnchorPlacementId}@${t.offsetAnchorEdge}`:"string"==typeof t.offset||Number.isFinite(t.offset)?t.offset:0}function OC(){z(GF,this)&&"function"==typeof z(GF,this).exit&&z(GF,this).exit()}function PC(){z(wC,this)&&"function"==typeof this.off&&(this.off(yh.TIMELINE_SEEKED,z(wC,this)),j(wC,this,null)),z(_C,this)&&"function"==typeof this.off&&(this.off("nodestart",z(_C,this)),j(_C,this,null))}function RC(){z(eC,this)&&(z(nC,this)&&(z(eC,this).off("track:underflow",z(nC,this)),j(nC,this,null)),z(iC,this)&&(z(eC,this).off("track:ready",z(iC,this)),j(iC,this,null)),"function"==typeof z(eC,this).dispose&&z(eC,this).dispose(),j(eC,this,null))}function DC(){z(eC,this)&&"function"==typeof z(eC,this).on&&(j(nC,this,(t=>B(IC,this,zC).call(this,t))),j(iC,this,(t=>B(IC,this,WC).call(this,t))),z(eC,this).on(yh.TRACK_UNDERFLOW,z(nC,this)),z(eC,this).on(yh.TRACK_READY,z(iC,this)))}function BC(){z(XF,this)&&"function"==typeof z(XF,this).on&&(j(gC,this,(t=>B(IC,this,LC).call(this,t))),z(XF,this).on(yh.CLOCK_TICK,z(gC,this)))}function LC(t){var e,n;B(IC,this,HC).call(this),B(IC,this,gO).call(this),null!==(e=z(xC,this))&&void 0!==e&&null!==(n=e.handleTimeUpdate)&&void 0!==n&&n.call(e,this.currentTime,{isSeeking:!1}),B(IC,this,VC).call(this,this.currentTime),this.trigger(yh.TIMELINE_TIME_UPDATE,bh(this.currentTime,"clock")),z(GF,this)&&"function"==typeof z(GF,this).handleClockTick&&z(GF,this).handleClockTick(t)}function zC(t){B(IC,this,HC).call(this);const e=B(IC,this,jC).call(this);e&&(null==t?void 0:t.trackType)===e.trackType&&(z(GF,this)&&"function"==typeof z(GF,this).handleMainTrackUnderflow?z(GF,this).handleMainTrackUnderflow(t):this.transitionTo(Pg))}function WC(t){if(B(IC,this,HC).call(this),this.state!==Pg)return;const e=B(IC,this,jC).call(this);if(!e)return;if((null==t?void 0:t.trackType)!==e.trackType)return;if(z(GF,this)&&"function"==typeof z(GF,this).handleMainTrackReady)return void z(GF,this).handleMainTrackReady(t);const n=this.getLastStableState()||Rg;this.transitionTo(n)}function jC(t=this.currentTime){const e=B(IC,this,UC).call(this,t);if(!e)return;const n=z(VF,this)&&"function"==typeof z(VF,this).get?z(VF,this).get(e.nodeId):void 0;if(!n)return;const i=B(IC,this,$C).call(this,n);return i?{placement:e,trackType:i}:void 0}function $C(t){var e;const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];let i;if(null!=t&&t.mainTrackId){const e=n.find((e=>(null==e?void 0:e.id)===t.mainTrackId));i=null==e?void 0:e.type}if(i||(i=null===(e=n.find((t=>null==t?void 0:t.type)))||void 0===e?void 0:e.type),"video"===i||"audio"===i||"image"===i)return i}function UC(t=this.currentTime){const e=z(QF,this)||[];let n;for(let i=0;i<e.length;i+=1){const r=e[i],o=Tv(r);if(!Number.isFinite(o))continue;const s=B(IC,this,QC).call(this,r);if(Number.isFinite(s)){if(t>=o&&t<o+s)return r}else if(t<=o)return r;!n&&t<o&&(n=r)}return n}function qC(t={}){if(this.state!==Cg)return;const e=null==t?void 0:t.placementId;if(!e)return;const n=B(IC,this,xO).call(this,e);n&&B(IC,this,GC).call(this,n)}function VC(t=this.currentTime){if(this.state!==Cg)return;const e=B(IC,this,vO).call(this,t);Array.isArray(e)&&e.length&&e.forEach((t=>B(IC,this,GC).call(this,t)))}function GC(t){const e=null==t?void 0:t.placementId;if(!e)return;if(z(sC,this).has(e))return;if(!t||!0!==t.loop)return;if(!t.nodeId)return;const n=B(IC,this,QC).call(this,t);if(!Number.isFinite(n)||n<=0)return;const i=Tv(t);if(!Number.isFinite(i))return;const r=i+n;if(!Number.isFinite(r))return;const o=t.loopRootPlacementId||t.placementId,s=Number.isFinite(t.loopRootOffset)?t.loopRootOffset:i;z(sC,this).add(e),this.placeOnTimeline(t.nodeId,r,{nodeOffsetOverride:t.nodeOffsetOverride,nodeDurationOverride:t.nodeDurationOverride,loop:!0,loopRootPlacementId:o,loopRootOffset:s})}function HC(){const t=Mv(z(QF,this),{getPlacementDuration:t=>B(IC,this,QC).call(this,t),snapPlacementOffset:(t,e)=>B(IC,this,JC).call(this,t,{nodeOffsetOverride:null==e?void 0:e.nodeOffsetOverride}),onResolvedPlacement:(t,e)=>{!0!==t.loop||Number.isFinite(t.loopRootOffset)||(t.loopRootOffset=t.offset),B(IC,this,eO).call(this,null==e?void 0:e.nodeId)}});return t.updated&&(B(IC,this,oO).call(this),t.resolvedPlacements.forEach((t=>{B(IC,this,aO).call(this,t),this.trigger(yh.PLACEMENT_ADDED,t)}))),t.updated}function KC(){if(!z(ZF,this).length||!z(QF,this).length)return!1;const t=new Map;z(QF,this).forEach((e=>{(null==e?void 0:e.placementId)&&t.set(e.placementId,e)}));const e=z(ZF,this).filter((t=>!0===(null==t?void 0:t.offsetPending)));if(!e.length)return!1;let n=!1;const i=[];for(let r=0;r<e.length;r+=1){const o=e[r];B(IC,this,XC).call(this,o,t)&&(n=!0,i.push(o))}return n&&(Sv(z(ZF,this)),i.forEach((t=>{this.trigger(yh.RENDER_PLACEMENT_ADDED,t)}))),n}function XC(t,e){const n=null==t?void 0:t.offsetAnchorPlacementId,i=null==t?void 0:t.offsetAnchorEdge;if(!n||!i)return!1;const r=e.get(n);if(!r||!0===r.offsetPending)return!1;const o=B(IC,this,YC).call(this,r,t);if(!Number.isFinite(o))return!1;t.offset=o,t.offsetPending=!1,t.offsetAnchorPlacementId=void 0,t.offsetAnchorEdge=void 0,t.offsetAnchorIsReference=void 0;const s=t.offset,a=t.offset+t.duration;return Cv(z(ZF,this).filter((e=>e!==t&&!0!==(null==e?void 0:e.offsetPending))),s,a,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements"),B(IC,this,eO).call(this,null==r?void 0:r.nodeId),!0}function YC(t,e){const n=Tv(t);if(!Number.isFinite(n))return;if("start"===e.offsetAnchorEdge)return B(IC,this,JC).call(this,n);const i=B(IC,this,QC).call(this,t);if(!(i>0))return;const r=n+i;if(!Number.isFinite(r))return;const o=B(IC,this,JC).call(this,r);return!0===e.offsetAnchorIsReference?Math.max(o,r):o}function QC(t){return _v(t,z(VF,this))}function JC(t,e={}){var n;return function(t,e={},n){const i=Number(n);if(!(i>0))return t;const r=Number(t);if(!Number.isFinite(r))return t;const o=Number.isFinite(null==e?void 0:e.nodeOffsetOverride)?e.nodeOffsetOverride:0,s=r-o;return Math.round(s*i)/i+o}(t,e,null===(n=this.settings)||void 0===n?void 0:n.snapToFps)}function ZC(t,e={}){const n=Fv(t);if("string"==typeof t&&t.includes("@")&&!n)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");if(!n){const n=Av(t);return{offset:B(IC,this,JC).call(this,n,e)}}const i=z(QF,this).find((t=>(null==t?void 0:t.placementId)===n.placementId));if(!i)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");const r=Tv(i);if("start"===n.anchor)return Number.isFinite(r)?{offset:B(IC,this,JC).call(this,r,e)}:{offset:void 0,offsetPending:!0,offsetAnchorPlacementId:i.placementId,offsetAnchorEdge:"start",offsetAnchorIsReference:!0};const o=B(IC,this,QC).call(this,i);if(!(Number.isFinite(r)&&o>0))return{offset:void 0,offsetPending:!0,offsetAnchorPlacementId:i.placementId,offsetAnchorEdge:"end",offsetAnchorIsReference:!0};const s=r+o,a=B(IC,this,JC).call(this,s,e);return{offset:Math.max(a,s)}}function tO(t){if(!t||!z(VF,this)||"function"!=typeof z(VF,this).get)return;if(z(aC,this).has(t))return;let e;try{e=z(VF,this).get(t)}catch(t){return}if(!e||"function"!=typeof e.on)return;if("ready"===e.state&&e.duration>0)return void this.updateTime(this.currentTime);const n=()=>{this.updateTime(this.currentTime),B(IC,this,eO).call(this,t)};e.on(yh.NODE_LOADED,n),z(aC,this).set(t,n)}function eO(t){if(!t)return;if(B(IC,this,nO).call(this,t))return;const e=z(aC,this).get(t);if(!e)return;let n;try{n=z(VF,this).get(t)}catch(t){n=null}n&&"function"==typeof n.off&&n.off(yh.NODE_LOADED,e),z(aC,this).delete(t)}function nO(t){if(!t)return!1;const e=new Map;z(QF,this).forEach((t=>{(null==t?void 0:t.placementId)&&e.set(t.placementId,t)}));const n=n=>{if(null==n||!n.offsetPending||null==n||!n.offsetAnchorPlacementId)return!1;const i=e.get(n.offsetAnchorPlacementId);return(null==i?void 0:i.nodeId)===t};return!!z(QF,this).some((t=>n(t)))||!!z(ZF,this).some((t=>n(t)))}function iO(){z(aC,this).size&&z(VF,this)?(z(aC,this).forEach(((t,e)=>{let n;try{n=z(VF,this).get(e)}catch(t){n=null}n&&"function"==typeof n.off&&n.off(yh.NODE_LOADED,t)})),z(aC,this).clear()):z(aC,this).clear()}function rO(){j(lC,this,[]),j(cC,this,0),z(uC,this).clear(),z(dC,this).clear(),j(hC,this,Number.NEGATIVE_INFINITY)}function oO(){j(fC,this,[]),j(mC,this,0),j(pC,this,Number.NEGATIVE_INFINITY)}function sO(t,e){const n=z(lC,this),i={placementId:t,endTime:e};if(!n.length||e>=n[n.length-1].endTime)return void n.push(i);const r=n.findIndex((t=>e<t.endTime)),o=-1===r?n.length:r;n.splice(o,0,i),o<z(cC,this)&&j(cC,this,z(cC,this)+1)}function aO(t){const e=null==t?void 0:t.placementId;if(!e||z(uC,this).has(e))return;const n=Tv(t),i=B(IC,this,QC).call(this,t);if(!Number.isFinite(n)||!Number.isFinite(i)||i<0)return void z(dC,this).add(e);const r=n+i;Number.isFinite(r)&&(z(uC,this).add(e),z(dC,this).delete(e),B(IC,this,sO).call(this,e,r))}function lO(){z(dC,this).size&&Array.from(z(dC,this)).forEach((t=>{const e=B(IC,this,xO).call(this,t);e?B(IC,this,aO).call(this,e):z(dC,this).delete(t)}))}function cO(t){const e=Number(t);if(!Number.isFinite(e))return;if(e<z(hC,this))return void j(hC,this,e);if(j(hC,this,e),B(IC,this,lO).call(this),!z(lC,this).length)return;const n=new Set;let i=z(cC,this);for(;i<z(lC,this).length;){const t=z(lC,this)[i];if(!t||!Number.isFinite(t.endTime)||t.endTime>e)break;t.placementId&&n.add(t.placementId),i+=1}i!==z(cC,this)&&(j(cC,this,i),n.size&&(B(IC,this,hO).call(this,n),B(IC,this,uO).call(this,n)))}function uO(t){if(t&&t.size)for(const e of z(oC,this)){const n=e.split(":")[0];t.has(n)&&z(oC,this).delete(e)}}function dO(t){const e=Array.isArray(null==t?void 0:t.frames)?t.frames:[],n=null==t?void 0:t.current;(n?[n,...e]:e).forEach((t=>{const e=null==t?void 0:t.frame;if(e&&"function"==typeof e.close)try{e.close()}catch(t){}}))}function hO(t){if(t&&t.size)for(const[e,n]of z(yC,this).entries())t.has(null==n?void 0:n.placementId)&&(B(IC,this,dO).call(this,n),z(yC,this).delete(e))}function fO(t={}){var e;const n=null==t?void 0:t.placementId,i=null==t?void 0:t.nodeId,r=null==t?void 0:t.trackId,o=null==t?void 0:t.segmentId,s=null==t?void 0:t.trackType;if(!(n&&i&&r&&o))return;if("video"!==s&&"image"!==s)return;const a=(null==t?void 0:t.frame)||(null==t?void 0:t.data);if(!a)return;"video"===s&&"object"==typeof a&&"function"==typeof a.close&&(a.__keepOpen=!0);const l=_F(a),c=Number.isFinite(null==l?void 0:l.width)?l.width:void 0,u=Number.isFinite(null==l?void 0:l.height)?l.height:void 0,d=Number.isFinite(null==t?void 0:t.pts)?t.pts:void 0;if(!Number.isFinite(d))return;const h=Number.isFinite(null==t?void 0:t.duration)?t.duration:void 0,f=`${n}:${r}`,p=z(yC,this).get(f),m=p||{placementId:n,nodeId:i,trackId:r,trackType:s,frames:[],current:void 0},v={placementId:n,nodeId:i,trackId:r,segmentId:o,frame:a,width:c,height:u,presentationTime:d,duration:h},g=m.frames,y=g.length?g[g.length-1]:void 0;if(!y||y.presentationTime<=v.presentationTime)g.push(v);else{let t=g.findIndex((t=>t.presentationTime>v.presentationTime));-1===t&&(t=g.length),g.splice(t,0,v)}const b=Number(null===(e=this.settings)||void 0===e?void 0:e.maxBufferedVideoFrames);if("video"===s&&Number.isFinite(b)&&b>0&&g.length>b){const t=g.length-b;for(let e=0;e<t;e+=1){const t=g.pop(),e=null==t?void 0:t.frame;if(e&&"function"==typeof e.close)try{e.close()}catch(t){}}}p||z(yC,this).set(f,m)}function pO(){for(const t of z(yC,this).values())B(IC,this,dO).call(this,t);z(yC,this).clear(),j(bC,this,null),z(oC,this).clear()}function mO(t){const e=Number.isFinite(t)?t:this.currentTime;if(!Number.isFinite(e))return;e<z(pC,this)&&(j(fC,this,[]),j(mC,this,0));const n=Array.isArray(z(QF,this))?z(QF,this):[],i=[],r=new Set;z(fC,this).forEach((t=>{B(IC,this,EO).call(this,t,e)&&(i.push(t),(null==t?void 0:t.placementId)&&r.add(t.placementId))}));let o=z(mC,this);for(;o<n.length;){const t=n[o],s=Tv(t);if(!Number.isFinite(s))break;if(s>e)break;if(B(IC,this,EO).call(this,t,e)){const e=null==t?void 0:t.placementId;e&&r.has(e)||(i.push(t),e&&r.add(e))}o+=1}j(fC,this,i),j(mC,this,o),j(pC,this,e)}function vO(t,e={}){const n=Number.isFinite(t)?t:this.currentTime,i=Number.isFinite(null==e?void 0:e.endEpsilonSeconds)?e.endEpsilonSeconds:0;return 0===i&&n===this.currentTime&&n===z(pC,this)?z(fC,this).slice():(Array.isArray(z(QF,this))?z(QF,this):[]).filter((t=>B(IC,this,EO).call(this,t,n,i)))}function gO(){const t=this.currentTime,e=B(IC,this,bO).call(this,t);if(!e.length)return void j(bC,this,null);const n=this.getActiveRenderPlacement(t),i=B(IC,this,kO).call(this,e,n);(i!==z(bC,this)||B(IC,this,yO).call(this,t,n))&&(j(bC,this,i),this.trigger(yh.VISUAL_FRAMES_AVAILABLE,{time:t,frames:e}))}function yO(t,e){const n=e||this.getActiveRenderPlacement(t);if(!n)return!1;if(!ig.doesRenderNodeTypeRequireFrameCadence(null==n?void 0:n.type))return!1;const i=n.duration;return"number"==typeof i&&i>0}function bO(t){return function(t={}){const e=t.buffers,n=t.time,i=t.getPlacementById,r=t.isPlacementActiveAtTime,o=t.getPlacementDuration,s=[];if(!e||"function"!=typeof e.entries)return[];const a=[];for(const[t,c]of e.entries()){const e=null==c?void 0:c.placementId,u="function"==typeof i?i(e):void 0;if(!u){yF(c),a.push(t);continue}if("function"==typeof r&&!r(u,n)){const e=bF(u),i="function"==typeof o?o(u):void 0;Number.isFinite(i)&&Number.isFinite(e)&&n>=e+i&&(yF(c),a.push(t));continue}const d=Array.isArray(null==c?void 0:c.frames)?c.frames:[];for(;d.length&&Number.isFinite(null===(l=d[0])||void 0===l?void 0:l.presentationTime)&&d[0].presentationTime<=n;){var l;const t=c.current,e=d.shift();c.current=e,t&&t!==e&&gF(null==t?void 0:t.frame)}if(!c.current)continue;const h={placementId:e,nodeId:c.current.nodeId,trackId:c.current.trackId,segmentId:c.current.segmentId,frame:c.current.frame,width:c.current.width,height:c.current.height,presentationTime:c.current.presentationTime,duration:c.current.duration};s.push({frame:h,placementId:e,placementOffset:bF(u),placementSortOffset:kF(u),placementSortId:xF(u,e)})}return a.forEach((t=>{e.delete(t)})),s.sort(((t,e)=>{const n=Number.isFinite(null==t?void 0:t.placementSortOffset)?t.placementSortOffset:Number.isFinite(null==t?void 0:t.placementOffset)?t.placementOffset:0,i=Number.isFinite(null==e?void 0:e.placementSortOffset)?e.placementSortOffset:Number.isFinite(null==e?void 0:e.placementOffset)?e.placementOffset:0;if(n!==i)return n-i;const r=(null==t?void 0:t.placementSortId)||(null==t?void 0:t.placementId),o=(null==e?void 0:e.placementSortId)||(null==e?void 0:e.placementId),s=wF(r),a=wF(o);return Number.isFinite(s)&&Number.isFinite(a)&&s!==a?s-a:r&&o&&r!==o?r<o?-1:1:function(t,e){const n=(null==t?void 0:t.frame)||{},i=(null==e?void 0:e.frame)||{};return n.trackId!==i.trackId?n.trackId<i.trackId?-1:1:n.nodeId!==i.nodeId?n.nodeId<i.nodeId?-1:1:n.segmentId!==i.segmentId?n.segmentId<i.segmentId?-1:1:("number"==typeof n.presentationTime?n.presentationTime:0)-("number"==typeof i.presentationTime?i.presentationTime:0)}(t,e)})),s.map((t=>t.frame))}({buffers:z(yC,this),time:t,getPlacementById:t=>B(IC,this,xO).call(this,t),isPlacementActiveAtTime:(t,e)=>B(IC,this,EO).call(this,t,e),getPlacementDuration:t=>B(IC,this,QC).call(this,t)})}function kO(t,e){return`${e?`render:${e.renderPlacementId||e.type||"unknown"}`:"render:default"}|${t.map((t=>`${t.nodeId}:${t.trackId}:${t.segmentId}@${t.presentationTime}`)).join("|")}`}function xO(t){if(t)return(z(QF,this)||[]).find((e=>(null==e?void 0:e.placementId)===t))}function wO(t){if("end"===t){const t=B(IC,this,_O).call(this);if(!Number.isFinite(t))return;const e=B(IC,this,IO).call(this);return Math.max(0,t-Math.min(t,e))}const e=Number(t);return Number.isFinite(e)?e:0}function _O(){let t;return(Array.isArray(z(QF,this))?z(QF,this):[]).forEach((e=>{const n=Tv(e);if(!Number.isFinite(n))return;const i=B(IC,this,QC).call(this,e);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(t)||r>t)&&(t=r)})),t}function IO(){const t=B(IC,this,TO).call(this);return t>0?t:.001}function TO(){var t;const e=Number(null===(t=this.settings)||void 0===t?void 0:t.snapToFps);return!Number.isFinite(e)||e<=0?0:.5/e}function EO(t,e,n=0){if(!Ev(t,e,z(VF,this)))return!1;const i=Number(n);if(!Number.isFinite(i)||i<=0)return!0;const r=B(IC,this,QC).call(this,t);if(!Number.isFinite(r))return!0;const o=Tv(t);return!Number.isFinite(o)||e<o+r-i}var SO=new WeakMap,MO=new WeakMap,AO=new WeakMap,NO=new WeakMap,FO=new WeakMap,CO=new WeakMap,OO=new WeakMap,PO=new WeakMap,RO=new WeakMap,DO=new WeakMap,BO=new WeakMap,LO=new WeakMap,zO=new WeakMap,WO=new WeakMap,jO=new WeakMap,$O=new WeakMap,UO=new WeakMap,qO=new WeakSet;class VO extends fh{get name(){return"QoE"}get defaults(){return{calcScoreInterval:1,streamQualityWeight:.8,fpsWeight:.2,fpsMathFuncType:"quad",bestFpsMobile:27,bestFpsDesktop:57,waitingMultiplier:1,statusFloors:{excellent:.98,good:.85,fair:.7,poor:0,alert:0},alertStatusCeil:.3,fpsGracePeriod:2,windowSeconds:30}}constructor(...t){super(...t),$(this,qO),W(this,SO,void 0),W(this,MO,void 0),W(this,AO,1),W(this,NO,1),W(this,FO,1),W(this,CO,""),W(this,OO,0),W(this,PO,[]),W(this,RO,null),W(this,DO,void 0),W(this,BO,[]),W(this,LO,null),W(this,zO,null),W(this,WO,0),W(this,jO,0),W(this,$O,0),W(this,UO,void 0);const[e]=t;j(SO,this,e),j(WO,this,zb()),j(UO,this,B(qO,this,GO).call(this)),B(qO,this,HO).call(this),B(qO,this,KO).call(this),B(qO,this,ZO).call(this),B(qO,this,QO).call(this)}get publicAPI(){return z(UO,this)}calcScore(){B(qO,this,lP).call(this)}onDispose(){z(SO,this)&&z(MO,this)&&"function"==typeof z(SO,this).off&&z(SO,this).off(yh.TIMELINE_PLAYER_STATE,z(MO,this)),j(MO,this,null),B(qO,this,JO).call(this),B(qO,this,tP).call(this),j(SO,this,null),j(BO,this,[]),j(PO,this,[]),j(UO,this,null)}}function GO(){const t=this;return{get score(){return z(AO,t)},get status(){return z(CO,t)},get streamQualityScore(){return z(NO,t)},get fpsScore(){return z(FO,t)},get browserFps(){return z(OO,t)},get waitingSeconds(){return z(jO,t)/1e3},get playingSeconds(){return z($O,t)/1e3}}}function HO(){Number(this.settings.streamQualityWeight)+Number(this.settings.fpsWeight)!==1&&(this.log.warn("QoE weights must sum to 1; resetting to legacy defaults."),this.settings.streamQualityWeight=.8,this.settings.fpsWeight=.2)}function KO(){z(SO,this)&&"function"==typeof z(SO,this).on&&(j(MO,this,(t=>B(qO,this,XO).call(this,t))),z(SO,this).on(yh.TIMELINE_PLAYER_STATE,z(MO,this)))}function XO(t={}){const e="string"==typeof(null==t?void 0:t.event)?t.event:"";"playing"!==e?"waiting"!==e?"pause"!==e&&"seeking"!==e&&"seeked"!==e&&"reset"!==e||B(qO,this,YO).call(this,null):B(qO,this,YO).call(this,"waiting"):B(qO,this,YO).call(this,"playing")}function YO(t){if(t===z(LO,this))return;const e=zb();z(LO,this)&&Number.isFinite(z(zO,this))&&z(BO,this).push({state:z(LO,this),startMs:z(zO,this),endMs:e}),j(LO,this,t),j(zO,this,t?e:null),B(qO,this,iP).call(this,e)}function QO(){const t=Number(this.settings.calcScoreInterval);!Number.isFinite(t)||t<=0||(j(DO,this,(()=>B(qO,this,lP).call(this))),Aw(z(DO,this),1e3*t))}function JO(){z(DO,this)&&Nw(z(DO,this)),j(DO,this,null)}function ZO(){if("function"!=typeof bw)return;const t=()=>{if(this._disposed)return;const e=zb();j(OO,this,B(qO,this,eP).call(this,z(PO,this),e)),j(RO,this,bw(t))};j(RO,this,bw(t))}function tP(){z(RO,this)&&"function"==typeof kw&&kw(z(RO,this)),j(RO,this,null)}function eP(t,e){const n=B(qO,this,nP).call(this);for(t.push(e);t.length&&e-t[0]>n;)t.shift();if(t.length<2)return 0;const i=t[t.length-1]-t[0];return i<=0?0:1e3*(t.length-1)/i}function nP(){const t=Number(this.settings.windowSeconds);return!Number.isFinite(t)||t<=0?3e4:1e3*t}function iP(t){const e=t-B(qO,this,nP).call(this);for(;z(BO,this).length&&z(BO,this)[0].endMs<=e;)z(BO,this).shift()}function rP(t){const e=t-B(qO,this,nP).call(this);let n=0,i=0;const r=(r,o,s)=>{const a=Math.max(o,e),l=Math.min(s,t);l<=a||("waiting"===r?n+=l-a:"playing"===r&&(i+=l-a))};return z(BO,this).forEach((t=>{r(t.state,t.startMs,t.endMs)})),z(LO,this)&&Number.isFinite(z(zO,this))&&r(z(LO,this),z(zO,this),t),j(jO,this,n),j($O,this,i),{waitingMs:n,playingMs:i}}function oP(t,e){if(t<=0)return 1;if(t>e)return 0;const n=e||1;return xv(1-t*this.settings.waitingMultiplier/n)}function sP(){if(zb()-z(WO,this)<=1e3*this.settings.fpsGracePeriod)return 1;const t=Number(z(OO,this)),e=Ag.isDesktop()?this.settings.bestFpsDesktop:this.settings.bestFpsMobile,n=xv(e>0?t/e:0);return"quad"===this.settings.fpsMathFuncType?n*n:n}function aP(t,e){const n=this.settings.statusFloors||{};let i="";return t>=n.excellent?i="excellent":t>=n.good?i="good":t>=n.fair?i="fair":(i="poor",t<=this.settings.alertStatusCeil&&e>0&&(i="alert")),i}function lP(){const t=zb(),{waitingMs:e,playingMs:n}=B(qO,this,rP).call(this,t),i=B(qO,this,oP).call(this,e,n),r=B(qO,this,sP).call(this),o=xv(i*this.settings.streamQualityWeight+r*this.settings.fpsWeight);o!==z(AO,this)&&(j(AO,this,o),this.trigger(yh.QOE_SCORE,o)),j(NO,this,i),j(FO,this,r);const s=B(qO,this,aP).call(this,o,e);s!==z(CO,this)&&(j(CO,this,s),this.trigger(yh.QOE_STATUS,s))}function cP(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}function uP(t){const e=Number(t);return!Number.isFinite(e)||e<0?0:e}var dP=new WeakMap,hP=new WeakMap,fP=new WeakMap,pP=new WeakMap,mP=new WeakSet;class vP extends fh{get name(){return"SegmentEvictionCoordinator"}get defaults(){return{enabled:nk("segmentEvictionEnabled"),bufferBehindSeconds:nk("segmentEvictionBufferBehindSeconds"),bufferAheadSeconds:nk("segmentEvictionBufferAheadSeconds"),maxRetainedBytes:nk("segmentEvictionMaxRetainedBytes")}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"evictAtTime"])}constructor(t,e,n={}){super(n),$(this,mP),W(this,dP,void 0),W(this,hP,void 0),W(this,fP,void 0),W(this,pP,void 0),j(dP,this,t),j(hP,this,e),j(fP,this,(t=>B(mP,this,gP).call(this,t))),j(pP,this,(t=>B(mP,this,yP).call(this,t))),z(dP,this)&&"function"==typeof z(dP,this).on&&(z(dP,this).on(yh.TIMELINE_TIME_UPDATE,z(fP,this)),z(dP,this).on(yh.TIMELINE_SEEKED,z(pP,this)))}onDispose(){z(dP,this)&&"function"==typeof z(dP,this).off&&(z(dP,this).off(yh.TIMELINE_TIME_UPDATE,z(fP,this)),z(dP,this).off(yh.TIMELINE_SEEKED,z(pP,this))),j(dP,this,null),j(hP,this,null),j(fP,this,null),j(pP,this,null)}evictAtTime(t){if(!0!==this.settings.enabled)return;const e=Number(t);if(!Number.isFinite(e))return;const n=uP(this.settings.bufferBehindSeconds),i=uP(this.settings.bufferAheadSeconds),r=e-n,o=e+i,s=B(mP,this,bP).call(this);if(!s.length)return;const a=Number(this.settings.maxRetainedBytes);if(Number.isFinite(a)&&a>0&&B(mP,this,kP).call(this,s)<=a)return;const l=new Map;s.forEach((t=>{const e=null==t?void 0:t.nodeId;if(!e)return;const n=Tv(t);if(!Number.isFinite(n))return;const i=l.get(e)||[];i.push(t),l.set(e,i)})),l.size&&l.forEach(((t,e)=>{const n=B(mP,this,xP).call(this,e);if(!n)return;const i=t.filter((t=>B(mP,this,wP).call(this,t,r,o)));i.length?B(mP,this,_P).call(this,n,i,r,o):"function"==typeof n.evict&&n.evict()}))}}function gP(t){var e,n;if(!0!==this.settings.enabled)return;if((null===(e=z(dP,this))||void 0===e?void 0:e.state)===Dg)return;const i=Number(null==t?void 0:t.time),r=Number.isFinite(i)?i:Number(null===(n=z(dP,this))||void 0===n?void 0:n.currentTime);this.evictAtTime(r)}function yP(t){var e;if(!0!==this.settings.enabled)return;const n=Number(null==t?void 0:t.targetTime),i=Number.isFinite(n)?n:Number(null===(e=z(dP,this))||void 0===e?void 0:e.currentTime);this.evictAtTime(i)}function bP(){var t;const e=null===(t=z(dP,this))||void 0===t?void 0:t.placements;return Array.isArray(e)?e:[]}function kP(t){if(!Array.isArray(t)||!t.length)return 0;const e=new Set;let n=0;return t.forEach((t=>{const i=null==t?void 0:t.nodeId;if(!i||e.has(i))return;e.add(i);const r=B(mP,this,xP).call(this,i),o=Number(null==r?void 0:r.retainedByteLength);fb(o)?n+=o:(Array.isArray(null==r?void 0:r.tracks)?r.tracks:[]).forEach((t=>{(Array.isArray(null==t?void 0:t.segments)?t.segments:[]).forEach((t=>{fb(null==t?void 0:t.retainedByteLength)&&(n+=t.retainedByteLength)}))}))})),n}function xP(t){if(z(hP,this)&&"function"==typeof z(hP,this).get)return z(hP,this).get(t)}function wP(t,e,n){const i=Tv(t);if(!Number.isFinite(i))return!1;const r=_v(t,z(hP,this));return(Number.isFinite(r)?i+r:Number.POSITIVE_INFINITY)>e&&i<n}function _P(t,e,n,i){const r=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];r.length&&r.forEach((t=>{const r=Array.isArray(null==t?void 0:t.segments)?t.segments:[],o=cP(null==t?void 0:t.offset,0);r.forEach((t=>{if(!t||!fb(null==(r=t)?void 0:r.retainedByteLength))return;var r;if(t.isInit)return;let s=!1;for(let r=0;r<e.length;r+=1){const a=e[r],l=Tv(a);if(!Number.isFinite(l))continue;const c=cP(null==a?void 0:a.nodeOffsetOverride,0),u=cP(null==t?void 0:t.offset,NaN);if(!Number.isFinite(u))continue;const d=cP(null==t?void 0:t.duration,0),h=l+o+u-c,f=h+(d>0?d:0),p=_v(a,z(hP,this)),m=Number.isFinite(p)?l+p:Number.POSITIVE_INFINITY;if(!(f<=l||h>=m||f<=n||h>=i)){s=!0;break}}s||t.evict()}))}))}var IP=new WeakMap,TP=new WeakMap,EP=new WeakMap,SP=new WeakSet;class MP extends fh{get name(){return"DocumentVisibility"}get defaults(){return{autoPauseOnVisibilityChange:!0,autoResumeOnVisibilityChange:!0}}constructor(t,e={}){super(e),$(this,SP),W(this,IP,void 0),W(this,TP,null),W(this,EP,!1),j(IP,this,t),B(SP,this,AP).call(this)}onDispose(){B(SP,this,NP).call(this),j(IP,this,null),j(EP,this,!1)}}function AP(){const t=null==vh?void 0:vh.document;t&&"function"==typeof t.addEventListener&&(j(TP,this,(()=>B(SP,this,FP).call(this))),t.addEventListener("visibilitychange",z(TP,this)))}function NP(){const t=null==vh?void 0:vh.document;z(TP,this)&&t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",z(TP,this)),j(TP,this,null)}function FP(){const t=null==vh?void 0:vh.document,e=null==t?void 0:t.visibilityState;"string"==typeof e&&("hidden"!==e?"visible"===e&&B(SP,this,OP).call(this):B(SP,this,CP).call(this))}function CP(){var t;(null===(t=this.settings)||void 0===t?void 0:t.autoPauseOnVisibilityChange)&&z(IP,this)&&"function"==typeof z(IP,this).pause&&(z(IP,this).state===Cg?(this.log.info("[#handleHidden] Pausing timeline due to document visibility change"),z(IP,this).pause(),j(EP,this,!0)):j(EP,this,!1))}function OP(){var t;z(EP,this)&&(null===(t=this.settings)||void 0===t?void 0:t.autoResumeOnVisibilityChange)&&z(IP,this)&&"function"==typeof z(IP,this).play&&(z(IP,this).state!==Cg?(this.log.info("[#handleVisible] Resuming timeline due to document visibility change"),z(IP,this).play(),j(EP,this,!1)):j(EP,this,!1))}const PP=[{event:"canplay",once:!0,trackAs:"canplay"},{event:"playing",once:!0,trackAs:"startedplaying"},"seeked","canvas.webglcontextlost"];function RP(t,e=0){return Number.isFinite(t)?t:e}function DP(t){const e=null==t?void 0:t.exposedPlayerAPI;return e&&"object"==typeof e?e:t}const BP=[function(t){return{schema:"iglu:com.helloeko/player/jsonschema/1-0-7",match:/^.*$/,getData:()=>{var e,n,i;const r=function(t){const e=null==t?void 0:t.exposedPlayerAPI;return e&&"object"==typeof e?e:t}(t);return{playerversion:"string"==typeof(null==r?void 0:r.version)?r.version:"0.0.0",isautoplay:!(null==r||null===(e=r.options)||void 0===e||!e.autoplay),playerqoe:RP(null==r||null===(n=r.qoe)||void 0===n?void 0:n.score),playerqoestatus:"string"==typeof(null==r||null===(i=r.qoe)||void 0===i?void 0:i.status)?r.qoe.status:"",ismuted:!(null==r||!r.muted),playervolume:RP(null==r?void 0:r.volume),playercontainerwidth:RP(null==r?void 0:r.containerWidth),playercontainerheight:RP(null==r?void 0:r.containerHeight)}}}},function(t){return{schema:"iglu:com.helloeko/currentnode/jsonschema/1-0-2",match:/^.*$/,getData:()=>{var e;const n=DP(t),i=function(t){const e=DP(t);if(!e||"function"!=typeof e.getNodesAtTime)return null;const n=Number.isFinite(e.currentTime)?e.currentTime:0,i=e.getNodesAtTime(n);return Array.isArray(i)&&0!==i.length&&i[0]||null}(t);return{currentnodeid:"string"==typeof(null==i?void 0:i.id)?i.id:"",currentnodetime:Number.isFinite(null==n?void 0:n.currentTime)?n.currentTime:0,currentnodeduration:Number.isFinite(null==i?void 0:i.duration)?i.duration:0,currentnodeprofile:"string"==typeof(null==i||null===(e=i.metadata)||void 0===e?void 0:e.profile)?i.metadata.profile:""}}}},function(t){let e=0,n=0;const i=()=>{e||(e=Date.now(),n=0)},r=()=>{e&&!n&&(n=Date.now())};return t&&"function"==typeof t.on&&(t.on("seeking",i),t.on("seeked",r)),{schema:"iglu:com.helloeko/seeked/jsonschema/1-0-0",match:"seeked",getData:()=>{r();const t=e&&n&&n>=e?(n-e)/1e3:0;return e=0,n=0,{seekduration:t}},dispose:()=>{t&&"function"==typeof t.off&&(t.off("seeking",i),t.off("seeked",r))}}},function(){return{schema:"iglu:com.helloeko/environment/jsonschema/1-0-0",match:/^.*$/,getData:()=>{var t;const e=null==vh||null===(t=vh.eko)||void 0===t||null===(t=t.environment)||void 0===t?void 0:t.embeddingApp;return e?{embeddingapp:e}:{}}}}],LP=Object.freeze({once:!1,trackAs:""});var zP=new WeakMap,WP=new WeakMap,jP=new WeakMap,$P=new WeakMap,UP=new WeakMap,qP=new WeakMap,VP=new WeakSet;class GP extends fh{get name(){return"Tracker"}get defaults(){return{tag:null,trackingEnabled:nk("trackingEnabled"),defaultForwarders:PP,defaultContextPackers:BP}}constructor(t,e={}){var n,i;super(e),$(this,VP),W(this,zP,void 0),W(this,WP,new Map),W(this,jP,[]),W(this,$P,!1),W(this,UP,void 0),W(this,qP,void 0),j(qP,this,!this.settings.tag),j(UP,this,this.settings.tag||(null===(n=crypto)||void 0===n||null===(i=n.randomUUID)||void 0===i?void 0:i.call(n))||`eko-player-${Date.now()}`),j(zP,this,t),B(VP,this,ZP).call(this),B(VP,this,KP).call(this)}track(t,...e){if(!this.settings.trackingEnabled)return;if("string"!=typeof t||!t)return void this.log.warn("[track] Expected event to be a non-empty string.");const n=B(VP,this,eR).call(this);n&&n("track",t,...e,z(UP,this))}registerContextPacker(t){if(!t||"object"!=typeof t)return void this.log.warn("[registerContextPacker] Expected a packer object.");const e={tag:z(UP,this),schema:t.schema,match:t.match,getData:B(VP,this,HP).call(this,t.getData)};if("string"!=typeof e.schema||!e.schema)return void this.log.warn('[registerContextPacker] Expected "schema" to be a non-empty string.');if("function"!=typeof e.getData)return void this.log.warn('[registerContextPacker] Expected "getData" to be a function.');if(!this.settings.trackingEnabled)return;const n=B(VP,this,eR).call(this);n&&n("registerContextPacker",e)}onDispose(){if(B(VP,this,JP).call(this),B(VP,this,tR).call(this),j(zP,this,null),z(qP,this)){const t=B(VP,this,eR).call(this);t&&(t("reset",z(UP,this)),j(UP,this,null))}}}function HP(t){return"function"!=typeof t?null:(...e)=>e.pop()!==z(UP,this)?null:t(...e)}function KP(){(Array.isArray(this.settings.defaultForwarders)?this.settings.defaultForwarders:[]).forEach((t=>B(VP,this,XP).call(this,t)))}function XP(t){const e=B(VP,this,YP).call(this,t);if(!e)return void this.log.warn("[#addEventForwarder] Invalid forwarder input.",t);const n=z(zP,this);if(!n||"function"!=typeof n.on)return;const i=B(VP,this,QP).call(this,e);if(z(WP,this).has(i))return;const r=(...t)=>{e.once&&n&&"function"==typeof n.off&&n.off(e.event,r);const i=e.trackAs||e.event;this.track(i,...t)};n.on(e.event,r),z(WP,this).set(i,{event:e.event,listener:r})}function YP(t){return"string"==typeof t&&t?{event:t,...LP}:t&&"object"==typeof t&&"string"==typeof t.event&&t.event?{event:t.event,once:!!t.once,trackAs:"string"==typeof t.trackAs?t.trackAs:""}:null}function QP({event:t,once:e,trackAs:n}){return`${t}:${e}:${n}`}function JP(){const t=z(zP,this);t&&"function"==typeof t.off&&z(WP,this).forEach((({event:e,listener:n})=>{t.off(e,n)})),z(WP,this).clear()}function ZP(){(Array.isArray(this.settings.defaultContextPackers)?this.settings.defaultContextPackers:[]).forEach((t=>{if("function"!=typeof t)return;const e=t(z(zP,this),this);e&&"object"==typeof e&&("function"==typeof e.dispose&&z(jP,this).push(e.dispose),e.disabled||this.registerContextPacker({schema:e.schema,match:e.match,getData:e.getData}))}))}function tR(){z(jP,this).forEach((t=>{try{t()}catch(t){this.log.warn("[#teardownContextPackers] Failed disposing context packer.",t)}})),j(jP,this,[])}function eR(){const t=null==vh?void 0:vh.EkoAnalytics;return"function"==typeof t?t:(B(VP,this,nR).call(this),null)}function nR(){this.settings.trackingEnabled&&!z($P,this)&&(this.log.warn("EkoAnalytics not found on window."),j($P,this,!0))}class iR{#rt;#ot;#st;#at;#lt;#ct;#ut;#dt;#ht;#ft;#pt;#mt;#vt;#gt;#yt;#bt;#kt;#xt;#wt;constructor(t,e={},n=null){this.#rt=new Nh(t,n,e),this.#ot=new jh(this.#rt,e),this.#st=new dw(e),this.#at=new ck(e),this.#lt=new Gx(this.#at,e),this.#ct=new jx(this.#lt,this.#st,e),this.#ut=new tw(this.#ct,e),this.#dt=new TC(this.#ct,e),this.#ht=new MP(this.#dt,e),this.#xt=new vP(this.#dt,this.#ct,e),this.#ft=new Qw(this.#ct,this.#ut,this.#st,this.#dt,e),this.#pt=new B_(this.#ct,this.#ut,this.#dt,e),this.#mt=new HS(e),this.#vt=new yM(this.#ct,this.#dt,this.#mt,e),this.#yt=new VO(this.#dt,e),this.#wt=new GP(n,e);const i=e&&"object"==typeof e?e.adapters:null,r=i&&"object"==typeof i&&"function"==typeof i.renderAdapterFactory?i.renderAdapterFactory:null,o=i&&"object"==typeof i&&"function"==typeof i.audioAdapterFactory?i.audioAdapterFactory:null;this.#bt=r?r({timeline:this.#dt,canvas:this.#rt,containerSize:this.#ot,options:e}):new Ey(this.#dt,this.#rt,this.#ot,e),this.#gt=o?o({timeline:this.#dt,decodeCoordinator:this.#vt,options:e}):new tN(this.#dt,this.#vt,e),this.#kt=new kA(this.#dt,this.#bt,e)}get canvas(){return this.#rt}get containerSize(){return this.#ot}get assetsDeliveryService(){return this.#st}get downloadSpeed(){return this.#at}get abrSelector(){return this.#lt}get nodeRepository(){return this.#ct}get nodePrioritizer(){return this.#ut}get timeline(){return this.#dt}get documentVisibility(){return this.#ht}get nodeResolver(){return this.#ft}get segmentLoadCoordinator(){return this.#pt}get decoderFactory(){return this.#mt}get parsingManager(){return this.#vt}get audioAdapter(){return this.#gt}get audioPlaybackManager(){return this.#gt}get qoe(){return this.#yt}get renderAdapter(){return this.#bt}get renderer(){return this.#bt}get transitionManager(){return this.#kt}get tracker(){return this.#wt}dispose(){[this.#wt,this.#dt,this.#ht,this.#pt,this.#ft,this.#ut,this.#ct,this.#st,this.#lt,this.#at,this.#vt,this.#mt,this.#gt,this.#yt,this.#bt,this.#kt,this.#xt,this.#ot,this.#rt].forEach((t=>{t&&"function"==typeof t.dispose&&t.dispose()})),this.#dt=null,this.#ht=null,this.#pt=null,this.#ft=null,this.#ut=null,this.#ct=null,this.#st=null,this.#lt=null,this.#at=null,this.#vt=null,this.#mt=null,this.#gt=null,this.#yt=null,this.#bt=null,this.#kt=null,this.#xt=null,this.#rt=null,this.#wt=null}}const rR="devops.1236629";var oR={isPlainObject:lh,deepMerge:ch,get:Rb,set:Db,ekoGlobalStore:Bb,download:Jb,isPositiveNumber:fb,clamp01:xv,root:vh,now:zb,getFrameDimensions:_F,codecs:wk,useragent:Ng,requestAnimationFrame:bw,cancelAnimationFrame:kw,start:Aw,stop:Nw,isTicking:Fw,predicator:function(t,e){const n=e||{};if("function"!=typeof t)return void xw.error("[predicator] Bad argument given to predicator, first argument must be a function.",arguments);if(t.apply())return xw.debug("[predicator] Invoking onFulfilled immediately."),void("function"==typeof n.onFulfilled&&n.onFulfilled.call(null,0));const i=n.timeout||1e4,r=n.interval,o=zb();let s,a,l,c,u;c=function(){t.apply()&&l()},l=function(){Nw(c),vh.clearTimeout(s),u=zb()-o,xw.debug("[predicator] Invoking onFulfilled after "+u+" ms."),"function"==typeof n.onFulfilled&&n.onFulfilled.call(null,u)},a=function(){Nw(c),u=zb()-o,xw.debug("[predicator] Invoking onTimeout after "+u+" ms."),"function"==typeof n.onTimeout&&n.onTimeout.call(null,u)},s=vh.setTimeout(a,i),Aw(c,r)},createThrottler:Cw,scheduleExecution:Ow},sR=new WeakMap,aR=new WeakMap,lR=new WeakMap,cR=new WeakMap,uR=new WeakMap,dR=new WeakMap,hR=new WeakMap,fR=new WeakSet;class pR{constructor(t){$(this,fR),W(this,sR,[]),W(this,aR,[]),W(this,lR,new $F("placement-")),W(this,cR,new $F("renderplacement-")),W(this,uR,void 0),W(this,dR,new Map),W(this,hR,void 0),j(uR,this,t),j(hR,this,{allowUnready:!0,getNode:t=>B(fR,this,mR).call(this,t)})}get placements(){return z(sR,this).slice()}get renderPlacements(){return z(aR,this).slice()}getNodesAtTime(t){B(fR,this,vR).call(this);const e=B(fR,this,yR).call(this,t);if(!Number.isFinite(e))return[];const n=z(sR,this).filter((t=>Ev(t,e,null,z(hR,this)))),i=[];return n.forEach((t=>{const e=B(fR,this,mR).call(this,null==t?void 0:t.nodeId);e&&i.push(e)})),i}placeOnTimeline(t,e,n={}){const i=t&&"object"==typeof t?t:null,r=i?i.id:t;if(!r)throw new Error("TimelineDefinition.placeOnTimeline requires node id");i&&z(dR,this).set(r,i);const o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=Fv(e);if("string"==typeof e&&e.includes("@")&&!a)throw new Error("TimelineDefinition.placeOnTimeline requires valid placement reference");const{wantsEndOffset:l,endOffsetSeconds:c}=a?{wantsEndOffset:!1}:Nv(e,n);let u,d,h,f=!1;const p=null!==a;if(a){const t=z(sR,this).find((t=>(null==t?void 0:t.placementId)===a.placementId));if(!t)throw new Error("TimelineDefinition.placeOnTimeline requires valid placement reference");d=t.placementId,h=a.anchor;const e=Tv(t);if("start"===a.anchor)Number.isFinite(e)?u=e:f=!0;else{const n=B(fR,this,gR).call(this,t);Number.isFinite(e)&&n>0?u=e+n:f=!0}}else if(l){const t=n.offsetAnchorPlacementId?z(sR,this).find((t=>(null==t?void 0:t.placementId)===n.offsetAnchorPlacementId)):z(sR,this).length?z(sR,this)[z(sR,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==t?void 0:t.placementId),d){const e=Tv(t),n=B(fR,this,gR).call(this,t);Number.isFinite(e)&&n>0?u=e+n-c:(f=!0,h="end")}else u=-c}else u=Av(e);const m=z(lR,this).claim(n.placementId),v={placementId:m,nodeId:r,offset:u,offsetPending:f,offsetAnchorPlacementId:f?d:void 0,offsetAnchorEdge:f?h:void 0,offsetAnchorIsReference:f?p:void 0,offsetEndSeconds:l?c:a&&"end"===a.anchor?0:void 0,nodeOffsetOverride:o,nodeDurationOverride:s,loop:!0===n.loop};return z(sR,this).push(v),Sv(z(sR,this)),m}placeRenderNodeOnTimeline(t,e,n,i={}){const r="string"==typeof t?t:null==t?void 0:t.type;if(!r||"string"!=typeof r)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires render node type");let o,s,a,l=!1;const c=Fv(e);if("string"==typeof e&&e.includes("@")&&!c)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires valid placement reference");const u=null!==c;if(c){const t=z(sR,this).find((t=>(null==t?void 0:t.placementId)===c.placementId));if(!t)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires valid placement reference");s=t.placementId,a=c.anchor;const e=Tv(t);if("start"===c.anchor)Number.isFinite(e)?o=e:l=!0;else{const n=B(fR,this,gR).call(this,t);Number.isFinite(e)&&Number.isFinite(n)?o=e+n:l=!0}}else o=Av(e);const d=z(cR,this).claim(i.renderPlacementId),h=Number(n),f=h===Number.POSITIVE_INFINITY,p=Number.isFinite(h)&&h>0||f?h:void 0;if(!p)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires a positive duration (seconds) or Infinity as 3rd argument");const m={renderPlacementId:d,type:r,offset:o,offsetPending:l,offsetAnchorPlacementId:l?s:void 0,offsetAnchorEdge:l?a:void 0,offsetAnchorIsReference:l?u:void 0,duration:p,params:i.params&&"object"==typeof i.params?i.params:void 0};if(!l){const t=o,e=o+p;Cv(z(aR,this),t,e,"TimelineDefinition.placeRenderNodeOnTimeline does not allow overlapping render nodes")}return z(aR,this).push(m),Sv(z(aR,this)),d}}function mR(t){if(t)return z(uR,this)&&"function"==typeof z(uR,this).get?z(uR,this).get(t):z(dR,this).get(t)}function vR(){return Mv(z(sR,this),{getPlacementDuration:t=>B(fR,this,gR).call(this,t)}).updated}function gR(t){return _v(t,null,z(hR,this))}function yR(t){if("end"===t){const t=B(fR,this,bR).call(this);if(!Number.isFinite(t))return;return Math.max(0,t-Math.min(t,.001))}const e=Number(t);return Number.isFinite(e)?e:0}function bR(){let t;return z(sR,this).forEach((e=>{const n=Tv(e);if(!Number.isFinite(n))return;const i=B(fR,this,gR).call(this,e);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(t)||r>t)&&(t=r)})),t}const kR=new Set(["canplay","play","playing","waiting","pause","seeking","seeked"]);var xR=new WeakMap,wR=new WeakMap,_R=new WeakMap,IR=new WeakMap,TR=new WeakMap,ER=new WeakMap,SR=new WeakMap,MR=new WeakMap,AR=new WeakMap,NR=new WeakMap,FR=new WeakMap,CR=new WeakMap,OR=new WeakMap,PR=new WeakMap,RR=new WeakMap,DR=new WeakMap,BR=new WeakMap,LR=new WeakMap,zR=new WeakMap,WR=new WeakMap,jR=new WeakMap,$R=new WeakMap,UR=new WeakMap,qR=new WeakMap,VR=new WeakMap,GR=new WeakSet;class HR extends fh{get name(){return"EkoPlayer"}get exposedPlayerAPI(){return z(IR,this)}constructor(t,e={}){const{options:n,publicOptions:i}=function(t={}){const e=ch({},tk,t);Object.entries(Zb).forEach((([t,{targetPaths:n}])=>{void 0!==e[t]&&n.forEach((n=>{void 0===Rb(e,n)&&Db(e,n,e[t])}))}));const n=function(t){const e={};return Object.keys(Zb).forEach((n=>{Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})),Object.freeze(e)}(e);return ek.info("Processed options:",e),ek.info("Public options:",n),{options:e,publicOptions:n}}(e);return super(n),$(this,GR),W(this,xR,void 0),W(this,wR,void 0),W(this,_R,void 0),W(this,IR,void 0),W(this,TR,void 0),W(this,ER,void 0),W(this,SR,void 0),W(this,MR,void 0),W(this,AR,void 0),W(this,NR,void 0),W(this,FR,void 0),W(this,CR,void 0),W(this,OR,void 0),W(this,PR,void 0),W(this,RR,void 0),W(this,DR,void 0),W(this,BR,void 0),W(this,LR,void 0),W(this,zR,void 0),W(this,WR,void 0),W(this,jR,void 0),W(this,$R,void 0),W(this,UR,void 0),W(this,qR,void 0),W(this,VR,0),j(_R,this,i),this.log.info("Initializing EkoPlayer with options:",i),j(CR,this,new iR(t,n,this)),B(GR,this,iD).call(this,z(CR,this)),j(RR,this,(t=>B(GR,this,KR).call(this,t))),z(wR,this)&&"function"==typeof z(wR,this).on&&z(wR,this).on(yh.TIMELINE_CUEPOINT,z(RR,this)),j(DR,this,null),j(LR,this,(t=>B(GR,this,XR).call(this,t))),j(zR,this,(t=>{const e=t&&"object"==typeof t?t:{};B(GR,this,XR).call(this,{...e,event:"seeking"})})),j(WR,this,(t=>{const e=t&&"object"==typeof t?t:{};B(GR,this,XR).call(this,{...e,event:"seeked"})})),z(wR,this)&&"function"==typeof z(wR,this).on&&(z(wR,this).on(yh.TIMELINE_PLAYER_STATE,z(LR,this)),z(wR,this).on(yh.TIMELINE_SEEKING,z(zR,this)),z(wR,this).on(yh.TIMELINE_SEEKED,z(WR,this))),j(UR,this,(t=>{const e=t&&"object"==typeof t?t:{};this.trigger(yh.CONTAINER_RESIZE,e)})),z(OR,this)&&"function"==typeof z(OR,this).on&&z(OR,this).on(yh.CONTAINER_RESIZE,z(UR,this)),B(GR,this,ZR).call(this),B(GR,this,JR).call(this),j(IR,this,B(GR,this,nD).call(this)),z(IR,this)}onDispose(){z(wR,this)&&"function"==typeof z(wR,this).off&&z(RR,this)&&z(wR,this).off(yh.TIMELINE_CUEPOINT,z(RR,this)),j(RR,this,null),z(wR,this)&&"function"==typeof z(wR,this).off&&(z(LR,this)&&z(wR,this).off(yh.TIMELINE_PLAYER_STATE,z(LR,this)),z(zR,this)&&z(wR,this).off(yh.TIMELINE_SEEKING,z(zR,this)),z(WR,this)&&z(wR,this).off(yh.TIMELINE_SEEKED,z(WR,this))),j(LR,this,null),j(zR,this,null),j(WR,this,null),j(DR,this,null),z(OR,this)&&"function"==typeof z(OR,this).off&&z(UR,this)&&z(OR,this).off(yh.CONTAINER_RESIZE,z(UR,this)),j(UR,this,null),z(FR,this)&&"function"==typeof z(FR,this).off&&(z(jR,this)&&z(FR,this).off("qoescore",z(jR,this)),z($R,this)&&z(FR,this).off("qoestatus",z($R,this))),j(jR,this,null),j($R,this,null),z(NR,this)&&"function"==typeof z(NR,this).off&&z(qR,this)&&z(NR,this).off(yh.DECODER_ERROR,z(qR,this)),j(qR,this,null),j(VR,this,0),z(PR,this)&&"function"==typeof z(PR,this).dispose&&z(PR,this).dispose(),j(PR,this,null),z(CR,this)&&"function"==typeof z(CR,this).dispose&&z(CR,this).dispose(),j(wR,this,null),j(xR,this,null),j(ER,this,null),j(SR,this,null),j(MR,this,null),j(AR,this,null),j(NR,this,null),j(FR,this,null),j(OR,this,null),j(TR,this,null),j(IR,this,null),j(CR,this,null)}}function KR(t={}){var e;this.trigger(yh.TIMELINE_CUEPOINT,t);const n="string"==typeof(null==t||null===(e=t.cuepoint)||void 0===e?void 0:e.name)?t.cuepoint.name:"";n&&this.trigger(n,t)}function XR(t={}){const e="string"==typeof(null==t?void 0:t.event)?t.event:"";if(!kR.has(e))return;if("playing"!==e||Number.isFinite(z(BR,this))||(j(BR,this,zb()),this.log.info(`[#handlePlayerStateEvent] Playback started @ ${(z(BR,this)/1e3).toFixed(3)}s (${Date.now()})`)),z(DR,this)===e)return;j(DR,this,e);const n=Number.isFinite(null==t?void 0:t.time)?t.time:z(wR,this)&&Number.isFinite(z(wR,this).currentTime)?z(wR,this).currentTime:0,i={};Number.isFinite(n)&&(i.time=n),"string"==typeof(null==t?void 0:t.from)&&(i.from=t.from),"string"==typeof(null==t?void 0:t.to)&&(i.to=t.to),Number.isFinite(null==t?void 0:t.targetTime)&&(i.targetTime=t.targetTime),Array.isArray(null==t?void 0:t.placements)&&(i.placements=t.placements.slice()),this.trigger(e,i)}function YR(){return new pR(z(xR,this))}function QR(t){if(!t||"object"!=typeof t)throw new Error("EkoPlayer.switchTimeline requires a timeline definition");if(!z(wR,this)||"function"!=typeof z(wR,this).applyTimelineDefinition)throw new Error("EkoPlayer.switchTimeline requires an active timeline");z(wR,this).applyTimelineDefinition(t),"function"==typeof z(wR,this).play&&z(wR,this).play()}function JR(){z(FR,this)&&"function"==typeof z(FR,this).on&&(j(jR,this,(t=>{this.trigger(yh.QOE_SCORE,t)})),j($R,this,(t=>{this.trigger(yh.QOE_STATUS,t)})),z(FR,this).on(yh.QOE_SCORE,z(jR,this)),z(FR,this).on(yh.QOE_STATUS,z($R,this)))}function ZR(){z(NR,this)&&"function"==typeof z(NR,this).on&&(j(qR,this,(t=>{const e=t&&"object"==typeof t?t:{error:t};this.trigger(yh.DECODER_ERROR,e),B(GR,this,tD).call(this,e)})),z(NR,this).on(yh.DECODER_ERROR,z(qR,this)))}function tD(t={}){var e;const n=z(wR,this);if(!n||"number"!=typeof n.currentTime)return;const i=Date.now();if(i<z(VR,this))return;const r=Number(n.currentTime);if(!Number.isFinite(r))return;const o=Number(null==n||null===(e=n.settings)||void 0===e?void 0:e.snapToFps),s=Number.isFinite(o)&&o>0?1/o:1/60;j(VR,this,i+1500),this.log.warn("[#attemptDecoderRecoverySeek] decoder:error received, attempting seek recovery",null==t?void 0:t.error),n.currentTime=r+s}async function eD(t={}){var e;if(z(PR,this))return z(PR,this);const n=t&&"object"==typeof t&&!Array.isArray(t)?{...t}:{},i=z(TR,this)&&z(TR,this).element?z(TR,this).element:null;if(!i)throw new Error("Debug overlay requires an initialized player canvas and mount element.");const r=function({canvasElement:t,containerElement:e}={}){const n=t&&t.parentNode?t.parentNode:null;if(null==e)return n;const i=function(t,e=(null==vh?void 0:vh.document)){if(gh(t))return t;if("string"!=typeof t)return null;let n=t.trim();if("#"===n.charAt(0)&&(n=n.slice(1)),!n||!e||"function"!=typeof e.getElementById)return null;const i=e.getElementById(n);return gh(i)?i:null}(e,t&&t.ownerDocument?t.ownerDocument:null);if(i)return i;if("string"==typeof e){const t=e.trim(),n="#"===t.charAt(0)?t.slice(1):t;if(!n)throw new Error("Debug overlay containerElement id cannot be empty.");throw new Error(`Debug overlay containerElement id "${n}" was not found.`)}throw new Error("Debug overlay containerElement must be an element id string or DOM element.")}({canvasElement:i,containerElement:n.containerElement});if(!r)throw new Error("Debug overlay requires an initialized player canvas and mount element.");Object.prototype.hasOwnProperty.call(n,"containerElement")&&delete n.containerElement;const o=await import("./debug-overlay-B4njlEwZ.esm.js"),s=(null==o?void 0:o.createDebugOverlay)||(null==o?void 0:o.default);if("function"!=typeof s)throw new Error("Debug overlay bundle does not export createDebugOverlay().");return n.publicOptions=z(_R,this),n.playerVersion=rR,j(PR,this,s({mountElement:r,canvasElement:i,timeline:z(wR,this),assetsDeliveryServiceUrl:null===(e=z(CR,this))||void 0===e||null===(e=e.assetsDeliveryService)||void 0===e||null===(e=e.settings)||void 0===e?void 0:e.assetsDeliveryServiceUrl,getNode:t=>z(xR,this)&&"function"==typeof z(xR,this).get?z(xR,this).get(t):void 0,listNodes:()=>z(xR,this)&&"function"==typeof z(xR,this).list?z(xR,this).list():[],downloadSpeed:z(CR,this)?z(CR,this).downloadSpeed:void 0,downloadEvents:Fb,qoe:z(FR,this)?z(FR,this).publicAPI:void 0,qoeEvents:this,options:n,playbackStartedAtMs:z(BR,this)})),z(PR,this)}function nD(){const t=this;return{createTimeline:()=>B(GR,t,YR).call(t),switchTimeline:e=>B(GR,t,QR).call(t,e),play:z(wR,this).play,pause:z(wR,this).pause,reset:z(wR,this).reset,placeOnTimeline:z(wR,this).placeOnTimeline,placeRenderNodeOnTimeline:z(wR,this).placeRenderNodeOnTimeline,addNode:z(xR,this).add,getNode:z(xR,this).get,listNodes:z(xR,this).list,getNodesAtTime:e=>z(wR,t).getNodesAtTime(e),dispose:this.dispose,on:t.on,off:t.off,once:t.once,trigger:t.trigger,transitionTo:(e,n)=>z(SR,t).transitionTo(e,n),track:(e,...n)=>{if(z(AR,t)&&"function"==typeof z(AR,t).track)return z(AR,t).track(e,...n)},seekToPlacement:e=>z(wR,t).seekToPlacement(e),get currentTime(){return z(wR,t).currentTime},set currentTime(e){z(wR,t).currentTime=e},get buffered(){return z(wR,t).buffered},get options(){return z(_R,t)},get containerWidth(){return z(OR,t)?z(OR,t).containerWidth:0},get containerHeight(){return z(OR,t)?z(OR,t).containerHeight:0},get playbackRate(){return z(wR,t).playbackRate},set playbackRate(e){z(wR,t).playbackRate=e},get paused(){return!!z(wR,t)&&!0===z(wR,t).paused},get muted(){return!!z(MR,t)&&z(MR,t).muted},set muted(e){z(MR,t)&&(z(MR,t).muted=e)},get volume(){return z(MR,t)?z(MR,t).volume:1},set volume(e){z(MR,t)&&(z(MR,t).volume=e)},get qoe(){return z(FR,t)?z(FR,t).publicAPI:void 0},get utils(){return oR},get version(){return rR},loadDebugOverlay:(...e)=>B(GR,t,eD).call(t,...e)}}function iD(t){t&&(j(TR,this,t.canvas),j(xR,this,t.nodeRepository),j(wR,this,t.timeline),j(MR,this,t.audioAdapter||t.audioPlaybackManager),j(AR,this,t.tracker),j(NR,this,t.parsingManager),j(FR,this,t.qoe),j(ER,this,t.renderAdapter||t.renderer),j(SR,this,t.transitionManager),j(OR,this,t.containerSize))}class rD{constructor({target:t,props:e}){if(!t)throw new Error("`options.target` is required");So(this.#_t,e,!0),this.#_t.v.EkoPlayer=HR;const n=t.hasChildNodes()?ba:ya;this.#It=n($d,{target:t,props:this.#_t.v})}#It;#_t=Bi(To(Oo({})),"EkoGallery.#props");destroy(t){if(this.#It)return _a(this.#It,t)}get props(){return Gs(this.#_t)}}const oD=b("gallery-react");const sD=a(((t,i)=>{const{config:r,variantId:a,debug:c,ssrHtml:u,activeItem:d={index:0,step:0},forceMobile:h,videoAspectRatio:f,theme:p,loadAnalytics:m=!0,onEvent:v=()=>{}}=t,g=n(null),y=n({}),b=function(t){return void 0!==t}(r),k=n(d),x=n(u);y.current.initEventSent||(v("galleryinit"),y.current.initEventSent=!0);const w=o((t=>{y.current.state=t,t.activeItemIndex===k.current.index&&t.activeModuleIndex===k.current.step||v("activeitemchanged",{index:t.activeItemIndex,step:t.activeModuleIndex})}),[]),_=o((t=>{y.current.API=t,0===k.current.index&&0===k.current.step||t.selectItemAndStep(k.current.index,k.current.step),y.current.unsubscribe&&y.current.unsubscribe(),y.current.unsubscribe=t.subscribe(w)}),[]),I=o(((t,e)=>{v(t,e)}),[v]);return s((()=>(oD.setDataStorage("gallery-react",{config:r}),window.eko=window.eko||{},window.eko.config=r,window.eko.gallery={version:"devops/4.0.17"},()=>{window.eko.config=void 0})),[r]),l(i,(()=>({prev:()=>{var t;null===(t=y.current.API)||void 0===t||t.prev()},next:()=>{var t;null===(t=y.current.API)||void 0===t||t.next()}}))),s((()=>{if(null==g||!g.current)return;const t=g.current;return y.current.app=new rD({target:t,props:{config:r,forceMobile:h,videoAspectRatio:f,theme:p,loadAnalytics:m,variant:a,onGalleryReady:_,onEvent:I}}),()=>{var t;null===(t=y.current.app)||void 0===t||t.destroy()}}),[]),s((()=>{y.current.app&&(y.current.app.props.config=r,k.current={index:0,step:0})}),[r]),s((()=>{y.current.app&&(y.current.app.props.variant=a)}),[a]),s((()=>{y.current.app&&(y.current.app.props.debug=c,y.current.app.props.forceMobile=h,y.current.app.props.videoAspectRatio=f,y.current.app.props.theme=p,y.current.app.props.loadAnalytics=m,y.current.app.props.onEvent=I)}),[c,h,f,p,m,I]),s((()=>{k.current=d,y.current.state&&(y.current.state.activeItemIndex===d.index&&y.current.state.activeModuleIndex===d.step||y.current.API.selectItemAndStep(d.index,d.step))}),[d]),b?e.createElement("div",q({style:{position:"relative",width:"100%",height:"100%"},ref:g},x.current?{dangerouslySetInnerHTML:{__html:x.current}}:{})):t.children}));sD.propTypes={className:Ot.string,config:Ot.object,variantId:Ot.string,onEvent:Ot.func,ssrHtml:Ot.string,videoAspectRatio:Ot.string,theme:Ot.string,debug:Ot.bool,activeItem:Ot.shape({index:Ot.number,step:Ot.number}),forceMobile:Ot.bool,loadAnalytics:Ot.bool,children:Ot.node},sD.displayName="EkoGallerySvelte";const aD=d("v2"),lD=d("v1");export{dn as E,$ as _,W as a,j as b,z as c,B as d,u as e,lD as f,aD as g,sD as h,D as w};
|