@ekolabs/eko-gallery-react 4.0.4 → 4.0.5-backstage-global-workflows-1156289.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/eko-gallery-react.cjs.js +3 -3
- package/dist/index.esm.js +3 -3
- package/dist/server.cjs.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e=require("react");function n(t="v1"){return function(e,n="*",i=""){let r=`https://${i}play.eko.com/api/${t}/channels/${e}/configs`;return r+="*"!==n?`/${n}`:"",r}}function i(t){return"object"==typeof t&&!Array.isArray(t)&&null!==t}var r={pack:function(t){const e={};if(!i(t))return e;if(t.itemId&&(e.item_id=t.itemId),t.itemName&&(e.item_name=t.itemName),i(t.itemPrice)){const n=t.itemPrice;e.item_price=function(t){const e={};return i(t)&&(t.amount&&(e.amount=Number(t.amount)),t.currency&&(e.currency=t.currency)),e}(n)}return t.quantity&&(e.quantity=Number(t.quantity)),e}};const o="mobile",s="notmobile";function a(){return((window.navigator.userAgentData?window.navigator.userAgentData.mobile:navigator.maxTouchPoints>0&&/Mobile|Android|webOS|iPhone|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&!/Tablet|iPad/i.test(navigator.userAgent))?o:s)===o}const l={};class c{constructor(t){this.key=`eko.${t}`}setDataStorage(t,e){if("undefined"!=typeof window)try{var n,i;let r=null===(n=window.localStorage)||void 0===n?void 0:n.getItem(this.key);r=JSON.parse(r)||{},r[t]=e,null===(i=window.localStorage)||void 0===i||i.setItem(this.key,JSON.stringify(r))}catch(t){console.error(`[setDataStorage]: ${t}`)}}getDataStorage(t){if("undefined"!=typeof window)try{var e;let n=null===(e=window.localStorage)||void 0===e?void 0:e.getItem(this.key);return n=JSON.parse(n)||{},n[t]}catch(t){console.error(`[getDataStorage]: ${t}`)}}removeDataStorage(t){if("undefined"!=typeof window)try{var e;let i=null===(e=window.localStorage)||void 0===e?void 0:e.getItem(this.key);var n;if(i)if(i=JSON.parse(i),delete i[t],Object.keys(i).length>0)null===(n=window.localStorage)||void 0===n||n.setItem(this.key,JSON.stringify(i));else this.removeAll()}catch(t){console.error(`[removeDataStorage]: ${t}`)}}removeAll(){if("undefined"!=typeof window)try{var t;null===(t=window.localStorage)||void 0===t||t.removeItem(this.key)}catch(t){console.error(`[removeAll]: ${t}`)}}}function u(t){return l[t]||(l[t]=new c(t)),l[t]}const d=u("gallery-react").getDataStorage("gallery-react");function h(t){window.EkoAnalytics("registerContextPacker",{tag:t,match:/.*/,schema:"iglu:com.helloeko/products/jsonschema/1-0-1",getData(t={}){var e,n;if(t.items)return{items:t.items.map((t=>function(t){const e=r.pack(t);return t.id&&(e.id=t.id),t.sku&&(e.sku=t.sku),t.upc&&(e.upc=t.upc),t.name&&(e.name=t.name),e}(t)))};const i=(null===(e=window.eko)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.product)||(null==d||null===(n=d.config)||void 0===n?void 0:n.product);if(i){return{items:[{id:i.id,item_id:i.sku,sku:i.sku,upc:i.upc,typeid:i.type,name:i.name}]}}return null}})}function f(t){return"object"==typeof t&&!Array.isArray(t)&&null!==t}function p(t){const e={};return f(t)&&(t.amount&&(e.amount=Number(t.amount)),t.currency&&(e.currency=t.currency)),e}var m={isObject:f,pricePack:p,itemPack:function(t){const e={};if(!f(t))return e;if(t.itemId&&(e.item_id=t.itemId),t.itemName&&(e.item_name=t.itemName),f(t.itemPrice)){const n=t.itemPrice;e.item_price=p(n)}return t.quantity&&(e.quantity=Number(t.quantity)),t.sellingPlan&&(e.selling_plan=function(t){const e={};return f(t)&&(t.id&&(e.id=t.id),t.name&&(e.name=t.name)),e}(t.sellingPlan)),e}};const v=u("gallery-react").getDataStorage("gallery-react");const g=u("gallery-react").getDataStorage("gallery-react");const y=u("gallery-react").getDataStorage("gallery-react");const b="eko-gallery-react";var k={register:function(){
|
|
1
|
+
"use strict";var e=require("react");function n(t="v1"){return function(e,n="*",i=""){let r=`https://${i}play.eko.com/api/${t}/channels/${e}/configs`;return r+="*"!==n?`/${n}`:"",r}}function i(t){return"object"==typeof t&&!Array.isArray(t)&&null!==t}var r={pack:function(t){const e={};if(!i(t))return e;if(t.itemId&&(e.item_id=t.itemId),t.itemName&&(e.item_name=t.itemName),i(t.itemPrice)){const n=t.itemPrice;e.item_price=function(t){const e={};return i(t)&&(t.amount&&(e.amount=Number(t.amount)),t.currency&&(e.currency=t.currency)),e}(n)}return t.quantity&&(e.quantity=Number(t.quantity)),e}};const o="mobile",s="notmobile";function a(){return((window.navigator.userAgentData?window.navigator.userAgentData.mobile:navigator.maxTouchPoints>0&&/Mobile|Android|webOS|iPhone|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&!/Tablet|iPad/i.test(navigator.userAgent))?o:s)===o}const l={};class c{constructor(t){this.key=`eko.${t}`}setDataStorage(t,e){if("undefined"!=typeof window)try{var n,i;let r=null===(n=window.localStorage)||void 0===n?void 0:n.getItem(this.key);r=JSON.parse(r)||{},r[t]=e,null===(i=window.localStorage)||void 0===i||i.setItem(this.key,JSON.stringify(r))}catch(t){console.error(`[setDataStorage]: ${t}`)}}getDataStorage(t){if("undefined"!=typeof window)try{var e;let n=null===(e=window.localStorage)||void 0===e?void 0:e.getItem(this.key);return n=JSON.parse(n)||{},n[t]}catch(t){console.error(`[getDataStorage]: ${t}`)}}removeDataStorage(t){if("undefined"!=typeof window)try{var e;let i=null===(e=window.localStorage)||void 0===e?void 0:e.getItem(this.key);var n;if(i)if(i=JSON.parse(i),delete i[t],Object.keys(i).length>0)null===(n=window.localStorage)||void 0===n||n.setItem(this.key,JSON.stringify(i));else this.removeAll()}catch(t){console.error(`[removeDataStorage]: ${t}`)}}removeAll(){if("undefined"!=typeof window)try{var t;null===(t=window.localStorage)||void 0===t||t.removeItem(this.key)}catch(t){console.error(`[removeAll]: ${t}`)}}}function u(t){return l[t]||(l[t]=new c(t)),l[t]}const d=u("gallery-react").getDataStorage("gallery-react");function h(t){window.EkoAnalytics("registerContextPacker",{tag:t,match:/.*/,schema:"iglu:com.helloeko/products/jsonschema/1-0-1",getData(t={}){var e,n;if(t.items)return{items:t.items.map((t=>function(t){const e=r.pack(t);return t.id&&(e.id=t.id),t.sku&&(e.sku=t.sku),t.upc&&(e.upc=t.upc),t.name&&(e.name=t.name),e}(t)))};const i=(null===(e=window.eko)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.product)||(null==d||null===(n=d.config)||void 0===n?void 0:n.product);if(i){return{items:[{id:i.id,item_id:i.sku,sku:i.sku,upc:i.upc,typeid:i.type,name:i.name}]}}return null}})}function f(t){return"object"==typeof t&&!Array.isArray(t)&&null!==t}function p(t){const e={};return f(t)&&(t.amount&&(e.amount=Number(t.amount)),t.currency&&(e.currency=t.currency)),e}var m={isObject:f,pricePack:p,itemPack:function(t){const e={};if(!f(t))return e;if(t.itemId&&(e.item_id=t.itemId),t.itemName&&(e.item_name=t.itemName),f(t.itemPrice)){const n=t.itemPrice;e.item_price=p(n)}return t.quantity&&(e.quantity=Number(t.quantity)),t.sellingPlan&&(e.selling_plan=function(t){const e={};return f(t)&&(t.id&&(e.id=t.id),t.name&&(e.name=t.name)),e}(t.sellingPlan)),e}};const v=u("gallery-react").getDataStorage("gallery-react");const g=u("gallery-react").getDataStorage("gallery-react");const y=u("gallery-react").getDataStorage("gallery-react");const b="eko-gallery-react";var k={register:function(){!function(t){window.EkoAnalytics("registerContextPacker",{tag:t,schema:"iglu:com.helloeko/page/jsonschema/1-0-0",match:/^pixel\..*/,getData:function(){return{url:document.location.href||"",referrer:document.referrer||"",title:document.title||""}}})}(b),h(b),function(t){window.EkoAnalytics("registerContextPacker",{tag:t,schema:"iglu:com.helloeko/cart/jsonschema/1-0-1",match:/pixel\.cart\.(add|remove)$/,getData(t){const e={};if((t=t||{}).cartId&&(e.cart_id=t.cartId),Array.isArray(t.items)&&(e.items=t.items.map((t=>m.itemPack(t)))),m.isObject(t.totalPrice)){const n=t.totalPrice;e.total_price=m.pricePack(n)}return t.totalQuantity&&(e.total_quantity=Number(t.totalQuantity)),e}})}(b),function(t){window.EkoAnalytics("registerContextPacker",{tag:t,schema:"iglu:com.helloeko/organization/jsonschema/1-0-0",match:/.*/,getData:function(){var t,e;const n=(null===(t=window.eko)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.customer)||(null==v||null===(e=v.config)||void 0===e?void 0:e.customer);if(n)return{id:null==n?void 0:n.organizationId}}})}(b),function(t){window.EkoAnalytics("registerContextPacker",{tag:t,schema:"iglu:com.helloeko/space/jsonschema/1-0-2",match:/.*/,getData:function(){var t,e;const n=(null===(t=window.eko)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.customer)||(null==g||null===(e=g.config)||void 0===e?void 0:e.customer);if(n)return{id:null==n?void 0:n.spaceId}}})}(b),function(t){window.EkoAnalytics("registerContextPacker",{tag:t,schema:"iglu:com.helloeko/asset/jsonschema/1-0-1",match:/.*/,getData:function(t){var e,n;if(null!=t&&t.type&&null!=t&&t.publishitemid&&null!=t&&t.name)return{deliverableid:"",publishitemid:null==t?void 0:t.publishitemid,type:null==t?void 0:t.type,name:null==t?void 0:t.name,artifactid:""};const i=null===(e=window.eko)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.__autoGenerated)||void 0===e?void 0:e.publishItem,r=null==y||null===(n=y.config)||void 0===n||null===(n=n.__autoGenerated)||void 0===n?void 0:n.publishItem,o=i||r;return o?{deliverableid:"",publishitemid:null==o?void 0:o.id,type:"interactive",name:"",artifactid:""}:void 0}})}(b),function(t){window.EkoAnalytics("registerContextPacker",{tag:t,schema:"iglu:com.helloeko/traffic_allocation/jsonschema/1-0-0",match:"trafficallocation.decision",getData:function(t){if(!t)return;const e={decision:t.decision};return t.config&&(e.config=t.config),isNaN(t.traffic_split)||(e.traffic_split=t.traffic_split),t.provider&&(e.provider=t.provider),e}})}(b),function(t){window.EkoAnalytics("registerContextPacker",{tag:t,schema:"iglu:com.helloeko/checkout/jsonschema/1-0-4",match:/pixel\.(checkout|order)$/,getData(t){const e={};if((t=t||{}).checkoutId&&(e.checkout_id=t.checkoutId),Array.isArray(t.items)&&(e.items=t.items.map((t=>m.itemPack(t)))),m.isObject(t.totalPrice)){const n=t.totalPrice;e.total_price=m.pricePack(n)}return t.totalQuantity&&(e.total_quantity=Number(t.totalQuantity)),e}})}(b),function(t){window.EkoAnalytics("registerContextPacker",{tag:t,schema:"iglu:com.helloeko/order/jsonschema/1-0-2",match:"pixel.order",getData(t){const e={};if((t=t||{}).orderId&&(e.order_id=t.orderId),Array.isArray(t.items)&&(e.items=t.items.map((t=>m.itemPack(t)))),m.isObject(t.totalPrice)){const n=t.totalPrice;e.total_price=m.pricePack(n)}return t.totalQuantity&&(e.total_quantity=Number(t.totalQuantity)),e}})}(b)}};function x(t,e){let n="";try{n=window[t].getItem(e),n||(n=function(t){const e=document.cookie.split(";");for(let n=0;n<e.length;n++){const i=e[n].trim();if(0===i.indexOf(t+"="))return i.substring(t.length+1)}return""}(e))}catch(t){console.warn("[eko-gallery-react] Error while getting the id from storage:",e,t)}return n}function w(t){let e=Array.isArray(t.items)?t.items:[t];return e=e.map((t=>({itemId:t.id,itemName:t.name,itemPrice:t.price,quantity:t.quantity||1,variantId:t.variantId,sellingPlan:t.sellingPlan}))),e}function _(t){return{cartId:t.cartId,items:w(t),totalPrice:t.totalPrice,totalQuantity:t.totalQuantity}}var T={"pixel.cart.add":_,"pixel.cart.remove":_,"pixel.product_viewed":function(t){let e=w(t);return e=e.map((t=>function(t){let e=x("localStorage","eko.metadata");if(e&&e[t.itemId]){let n=e[t.itemId].product;t.id=null==n?void 0:n.id,t.sku=null==n?void 0:n.sku,t.upc=null==n?void 0:n.upc,t.name=null==n?void 0:n.name}return t}(t))),{items:e}},"pixel.checkout":function(t){return{checkoutId:t.checkoutId,items:w(t),totalPrice:t.totalPrice,totalQuantity:t.totalQuantity}},"pixel.order":function(t){return{checkoutId:t.checkoutId,orderId:t.orderId,items:w(t),totalPrice:t.totalPrice,totalQuantity:t.totalQuantity}}};const I="https://storage.eko.com/efu/ekoanalytics/master/latest/EkoAnalyticsPlatform.min.gz.js";let E=!1;var S={init:function(t){k.register(),function(t){if(E)return;let e=t?window.location.host:"development";const n=document.createElement("script");n.setAttribute("pxid",e),n.type="text/javascript",n.async=!0,n.src=I,document.body.appendChild(n),E=!0}(t)},onRouteChanged:function(){window.EkoAnalytics("reset")},track:function(t,e){T[t]&&(e=T[t](e)),window.EkoAnalytics("track",t,e)}};function A(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}function N(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function M(t,e){return t.get(A(t,e))}function F(t,e,n){N(t,e),e.set(t,n)}function C(t,e,n){return t.set(A(t,e),n),n}function O(t,e){N(t,e),e.add(t)}function P(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function R(){return R=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},R.apply(null,arguments)}function D(t,e){return t(e={exports:{}},e.exports),e.exports
|
|
2
2
|
/** @license React v16.13.1
|
|
3
3
|
* react-is.production.min.js
|
|
4
4
|
*
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/}var L="function"==typeof Symbol&&Symbol.for,B=L?Symbol.for("react.element"):60103,z=L?Symbol.for("react.portal"):60106,W=L?Symbol.for("react.fragment"):60107,$=L?Symbol.for("react.strict_mode"):60108,U=L?Symbol.for("react.profiler"):60114,j=L?Symbol.for("react.provider"):60109,q=L?Symbol.for("react.context"):60110,V=L?Symbol.for("react.async_mode"):60111,
|
|
9
|
+
*/}var L="function"==typeof Symbol&&Symbol.for,B=L?Symbol.for("react.element"):60103,z=L?Symbol.for("react.portal"):60106,W=L?Symbol.for("react.fragment"):60107,$=L?Symbol.for("react.strict_mode"):60108,U=L?Symbol.for("react.profiler"):60114,j=L?Symbol.for("react.provider"):60109,q=L?Symbol.for("react.context"):60110,V=L?Symbol.for("react.async_mode"):60111,G=L?Symbol.for("react.concurrent_mode"):60111,H=L?Symbol.for("react.forward_ref"):60112,K=L?Symbol.for("react.suspense"):60113,X=L?Symbol.for("react.suspense_list"):60120,Y=L?Symbol.for("react.memo"):60115,Q=L?Symbol.for("react.lazy"):60116,J=L?Symbol.for("react.block"):60121,Z=L?Symbol.for("react.fundamental"):60117,tt=L?Symbol.for("react.responder"):60118,et=L?Symbol.for("react.scope"):60119;function nt(t){if("object"==typeof t&&null!==t){var e=t.$$typeof;switch(e){case B:switch(t=t.type){case V:case G:case W:case U:case $:case K:return t;default:switch(t=t&&t.$$typeof){case q:case H:case Q:case Y:case j:return t;default:return e}}case z:return e}}}function it(t){return nt(t)===G}var rt={AsyncMode:V,ConcurrentMode:G,ContextConsumer:q,ContextProvider:j,Element:B,ForwardRef:H,Fragment:W,Lazy:Q,Memo:Y,Portal:z,Profiler:U,StrictMode:$,Suspense:K,isAsyncMode:function(t){return it(t)||nt(t)===V},isConcurrentMode:it,isContextConsumer:function(t){return nt(t)===q},isContextProvider:function(t){return nt(t)===j},isElement:function(t){return"object"==typeof t&&null!==t&&t.$$typeof===B},isForwardRef:function(t){return nt(t)===H},isFragment:function(t){return nt(t)===W},isLazy:function(t){return nt(t)===Q},isMemo:function(t){return nt(t)===Y},isPortal:function(t){return nt(t)===z},isProfiler:function(t){return nt(t)===U},isStrictMode:function(t){return nt(t)===$},isSuspense:function(t){return nt(t)===K},isValidElementType:function(t){return"string"==typeof t||"function"==typeof t||t===W||t===G||t===U||t===$||t===K||t===X||"object"==typeof t&&null!==t&&(t.$$typeof===Q||t.$$typeof===Y||t.$$typeof===j||t.$$typeof===q||t.$$typeof===H||t.$$typeof===Z||t.$$typeof===tt||t.$$typeof===et||t.$$typeof===J)},typeOf:nt},ot=D((function(t,e){"production"!==process.env.NODE_ENV&&function(){var t="function"==typeof Symbol&&Symbol.for,n=t?Symbol.for("react.element"):60103,i=t?Symbol.for("react.portal"):60106,r=t?Symbol.for("react.fragment"):60107,o=t?Symbol.for("react.strict_mode"):60108,s=t?Symbol.for("react.profiler"):60114,a=t?Symbol.for("react.provider"):60109,l=t?Symbol.for("react.context"):60110,c=t?Symbol.for("react.async_mode"):60111,u=t?Symbol.for("react.concurrent_mode"):60111,d=t?Symbol.for("react.forward_ref"):60112,h=t?Symbol.for("react.suspense"):60113,f=t?Symbol.for("react.suspense_list"):60120,p=t?Symbol.for("react.memo"):60115,m=t?Symbol.for("react.lazy"):60116,v=t?Symbol.for("react.block"):60121,g=t?Symbol.for("react.fundamental"):60117,y=t?Symbol.for("react.responder"):60118,b=t?Symbol.for("react.scope"):60119;function k(t){if("object"==typeof t&&null!==t){var e=t.$$typeof;switch(e){case n:var f=t.type;switch(f){case c:case u:case r:case s:case o:case h:return f;default:var v=f&&f.$$typeof;switch(v){case l:case d:case m:case p:case a:return v;default:return e}}case i:return e}}}var x=c,w=u,_=l,T=a,I=n,E=d,S=r,A=m,N=p,M=i,F=s,C=o,O=h,P=!1;function R(t){return k(t)===u}e.AsyncMode=x,e.ConcurrentMode=w,e.ContextConsumer=_,e.ContextProvider=T,e.Element=I,e.ForwardRef=E,e.Fragment=S,e.Lazy=A,e.Memo=N,e.Portal=M,e.Profiler=F,e.StrictMode=C,e.Suspense=O,e.isAsyncMode=function(t){return P||(P=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),R(t)||k(t)===c},e.isConcurrentMode=R,e.isContextConsumer=function(t){return k(t)===l},e.isContextProvider=function(t){return k(t)===a},e.isElement=function(t){return"object"==typeof t&&null!==t&&t.$$typeof===n},e.isForwardRef=function(t){return k(t)===d},e.isFragment=function(t){return k(t)===r},e.isLazy=function(t){return k(t)===m},e.isMemo=function(t){return k(t)===p},e.isPortal=function(t){return k(t)===i},e.isProfiler=function(t){return k(t)===s},e.isStrictMode=function(t){return k(t)===o},e.isSuspense=function(t){return k(t)===h},e.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===r||t===u||t===s||t===o||t===h||t===f||"object"==typeof t&&null!==t&&(t.$$typeof===m||t.$$typeof===p||t.$$typeof===a||t.$$typeof===l||t.$$typeof===d||t.$$typeof===g||t.$$typeof===y||t.$$typeof===b||t.$$typeof===v)},e.typeOf=k}()}));ot.AsyncMode,ot.ConcurrentMode,ot.ContextConsumer,ot.ContextProvider,ot.Element,ot.ForwardRef,ot.Fragment,ot.Lazy,ot.Memo,ot.Portal,ot.Profiler,ot.StrictMode,ot.Suspense,ot.isAsyncMode,ot.isConcurrentMode,ot.isContextConsumer,ot.isContextProvider,ot.isElement,ot.isForwardRef,ot.isFragment,ot.isLazy,ot.isMemo,ot.isPortal,ot.isProfiler,ot.isStrictMode,ot.isSuspense,ot.isValidElementType,ot.typeOf;var st=D((function(t){"production"===process.env.NODE_ENV?t.exports=rt:t.exports=ot})),at=Object.getOwnPropertySymbols,lt=Object.prototype.hasOwnProperty,ct=Object.prototype.propertyIsEnumerable;
|
|
10
10
|
/*
|
|
11
11
|
object-assign
|
|
12
12
|
(c) Sindre Sorhus
|
|
13
13
|
@license MIT
|
|
14
|
-
*/var ut=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]))lt.call(n,s)&&(r[s]=n[s]);if(at){i=at(n);for(var a=0;a<i.length;a++)ct.call(n,i[a])&&(r[i[a]]=n[i[a]])}}return r},dt="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",ht=Function.call.bind(Object.prototype.hasOwnProperty),ft=function(){};if("production"!==process.env.NODE_ENV){var pt=dt,mt={},vt=ht;ft=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(t){}}}function gt(t,e,n,i,r){if("production"!==process.env.NODE_ENV)for(var o in t)if(vt(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,pt)}catch(t){s=t}if(!s||s instanceof Error||ft((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 mt)){mt[s.message]=!0;var l=r?r():"";ft("Failed "+n+" type: "+s.message+(null!=l?l:""))}}}gt.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(mt={})};var yt=gt,bt=function(){};function kt(){return null}"production"!==process.env.NODE_ENV&&(bt=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(t){}});var xt=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(kt),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+"]",dt);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 st.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(ht(s,c)){var u=t(s,c,i,r,o+"."+c,dt);if(u instanceof Error)return u}return null}))},oneOf:function(t){if(!Array.isArray(t))return"production"!==process.env.NODE_ENV&&bt(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."),kt;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&&bt("Invalid argument supplied to oneOfType, expected an instance of array."),kt;for(var e=0;e<t.length;e++){var n=t[e];if("function"!=typeof n)return bt("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+p(n)+" at index "+e+"."),kt}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,dt);if(null==c)return null;c.data&&ht(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,dt);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=ut({},e[n],t);for(var d in c){var p=t[d];if(ht(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,dt);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!==dt){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&&(bt("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=yt,o.resetWarningCache=yt.resetWarningCache,o.PropTypes=o,o};function wt(){}function _t(){}_t.resetWarningCache=wt;var Tt=D((function(t){if("production"!==process.env.NODE_ENV){var e=st;t.exports=xt(e.isElement,!0)}else t.exports=function(){function t(t,e,n,i,r,o){if(o!==dt){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:_t,resetWarningCache:wt};return n.PropTypes=n,n}()}));const It=/https?:\/\/(.*?\.)?eko.com/,Et={"eko.project.interaction":"interaction","eko.project.swipe":"swipe"};let St=null,At=null,Nt=[];function Mt(t){return e=>{var n;if(!It.test(e.origin)||"eko.embedapi"!==(null===(n=e.data)||void 0===n?void 0:n.source))return;const i=e.data,r=Et[i.type];r&&(t?t(r,i.data):Nt.push({type:r,data:i.data}))}}"undefined"!=typeof window&&(At=Mt(null),window.addEventListener("message",At));var Ft={subscribe:function(t){"function"==typeof t?St?console.warn("[eko-gallery-react] Ignoring events subscribe since already subscribed"):(St=t,At=Mt(t),window.addEventListener("message",At),function(t){Nt.forEach((e=>{t(e.type,e.data)})),Nt=[]}(t)):console.warn("[eko-gallery-react] Ignoring events subscribe since a callback function was not provided as argument")},unsubscribe:function(){At?(window.removeEventListener("message",At),At=null,St=null,Nt=[]):console.warn("[eko-gallery-react] Ignoring events unsubscribe since not subscribed")},send:function(t,e){St?St(t,e):Nt.push({type:t,data:e})}};const Ct=({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){S.track("gallery.interaction",{elementid:`thumbnail-${t}`,interactiontype:"click"}),Ft.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})`}}))))};Ct.propTypes={index:Tt.number,activeIndex:Tt.number,setActiveIndex:Tt.func.isRequired,item:Tt.object.isRequired,src:Tt.string,navItemRefs:Tt.object.isRequired,itemIcon:Tt.string};const Ot=({layout:t,nav:n,isVerticalNav:i,showPrevArrow:r,showNextArrow:o})=>{var s,a,l,c,u;const d=e.useRef(null),h=e.useRef(null),f="arrows"===(null==t||null===(s=t.mobile)||void 0===s||null===(s=s.config)||void 0===s||null===(s=s.navPagination)||void 0===s?void 0:s.type)?"eko-mobile-arrows":"",p="arrows"===(null!==(a=null==t||null===(l=t.desktop)||void 0===l||null===(l=l.config)||void 0===l||null===(l=l.navPagination)||void 0===l?void 0:l.type)&&void 0!==a?a:"arrows")?"eko-desktop-arrows":"",m=f||p,v=i?null==n||null===(c=n.current)||void 0===c?void 0:c.scrollHeight:null==n||null===(u=n.current)||void 0===u?void 0:u.scrollWidth;function g(t){const e=i?n.current.clientHeight:n.current.clientWidth,r=function(t,e){const n=i?e.scrollTop:e.scrollLeft;return Math.max(-n,Math.min(v-t-n,t))}("next"===t?e:-e,n.current);return{top:i?r:0,left:i?0:r,behavior:"smooth"}}function y(t){var e,i,r;const o=g(t),s="next"===t?null==h||null===(e=h.current)||void 0===e?void 0:e.id:null==d||null===(i=d.current)||void 0===i?void 0:i.id;var a,l;window.EkoAnalytics("track","gallery.interaction",{elementid:s,interactiontype:"click"}),null==n||null===(r=n.current)||void 0===r||r.scrollBy(o),a=s,l="click",S.track("gallery.interaction",{elementId:a,interactiontype:l}),Ft.send("interaction",{elementId:a,interactiontype:l})}return e.createElement(e.Fragment,null,m&&e.createElement(e.Fragment,null,e.createElement("button",R({type:"button","aria-label":"Go to previous item","aria-hidden":r?"false":"true",onClick:()=>y("prev"),ref:d,id:"eko-nav-prev-arrow",className:`eko-nav-arrow eko-prev-nav-button ${f} ${p} ${r?"":"eko-hidden-nav-button"}`},r?{}:{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",R({type:"button","aria-label":"Go to next item","aria-hidden":o?"false":"true",onClick:()=>y("next"),ref:h,className:`eko-nav-arrow eko-next-nav-button ${f} ${p} ${o?"":"eko-hidden-nav-button"}`,id:"eko-nav-next-arrow"},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:"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 Pt(t,e,n){let i;return function(){const n=this,r=arguments;clearTimeout(i),i=setTimeout((function(){i=null,t.apply(n,r)}),e)}}Ot.propTypes={layout:Tt.object.isRequired,nav:Tt.object.isRequired,isVerticalNav:Tt.bool.isRequired,showPrevArrow:Tt.bool.isRequired,showNextArrow:Tt.bool.isRequired};const Rt=({items:t,setActiveIndex:n,activeIndex:i,layout:r,carouselMounted:o,forceMobile:s})=>{const l=e.useRef(null),c=e.useRef(null),u=e.useRef([]),d=3,[h,f]=e.useState(null),[p,m]=e.useState(!1),[v,g]=e.useState(0),[y,b]=e.useState(!1),[k,x]=e.useState(!1);function w(){var t;const e=s||window.innerWidth<768?"mobile":"desktop",n=(null==r||null===(t=r[e])||void 0===t||null===(t=t.config)||void 0===t?void 0:t.orientation)||("desktop"===e?"left":"bottom");m("left"===n||"right"===n);const i=c.current.parentNode,a=o?".eko-smart-gallery-container iframe":".eko-carousel",l=i.querySelector(a);setTimeout((()=>{g(l.clientHeight)}),0)}function _(){var t,e;const n=s||a()?"mobile":"desktop",i=null!==(t=null==r||null===(e=r[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:d;!function(t=d){var e,n;const i=l.current;if(!i)return;const o="none"!==(null==r||null===(e=r.desktop)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.navPagination)||void 0===e?void 0:e.type),c=(u=null==r||null===(n=r.mobile)||void 0===n||null===(n=n.config)||void 0===n||null===(n=n.navPagination)||void 0===n?void 0:n.type,"mask"===u||"arrows"===u);var u;if((s||a())&&!c)return void i.style.setProperty("-webkit-mask","none");if(!a()&&!o)return void i.style.setProperty("-webkit-mask","none");const h=i.scrollHeight-i.clientHeight,f=i.scrollTop>t?"85%":"100%",m=i.scrollTop<=h-t?"15%":"0%",v=i.scrollWidth-i.clientWidth,g=i.scrollLeft>t?"15%":"0%",y=i.scrollLeft<=v-t?"85%":"100%";p?i.style.setProperty("-webkit-mask",`linear-gradient(0deg,#0000,#000 ${m} ${f},#0000)`):i.style.setProperty("-webkit-mask",`linear-gradient(90deg,#0000,#000 ${g} ${y},#0000)`)}(i),function(t=d){var e,n,i,r,o,s;const a=p?null==l||null===(e=l.current)||void 0===e?void 0:e.scrollTop:null==l||null===(n=l.current)||void 0===n?void 0:n.scrollLeft,c=p?null==l||null===(i=l.current)||void 0===i?void 0:i.clientHeight:null==l||null===(r=l.current)||void 0===r?void 0:r.clientWidth,u=p?null==l||null===(o=l.current)||void 0===o?void 0:o.scrollHeight:null==l||null===(s=l.current)||void 0===s?void 0:s.scrollWidth;u-t<c?(b(!1),x(!1)):a<=t?(b(!1),x(!0)):a+c>u-t?(b(!0),x(!1)):a+t>0&&a<u-t&&(b(!0),x(!0))}(i)}u.current=null==t?void 0:t.map(((t,n)=>{var i,r;return null!==(i=null==u||null===(r=u.current)||void 0===r?void 0:r[n])&&void 0!==i?i:e.createRef()}));const T=Pt((t=>{var e;e=t,S.track("gallery.interaction",{elementid:"nav",interactiontype:e}),Ft.send("interaction",{elementid:"nav",interactiontype:e})}),200);const I=e.useCallback((t=>{n({index:t,step:0,source:"nav"})}),[]);return e.useEffect((()=>{var t;f(null===(t=u.current)||void 0===t?void 0:t[i])}),[i]),e.useEffect((()=>{if(null!=h&&h.current&&null!=l&&l.current){const t=h.current,e=l.current.clientWidth/2,n=t.clientWidth/2,i=l.current.clientHeight/2,r=t.clientHeight/2;l.current.scrollTo({left:t.offsetLeft-e+n,top:t.offsetTop-i+r,behavior:"smooth"})}}),[h]),e.useEffect((()=>{w()}),[]),e.useEffect((()=>(window.addEventListener("resize",w),()=>{window.removeEventListener("resize",w)})),[c,o,s]),e.useEffect((()=>{g(0),w()}),[t,c,o,s]),e.useEffect((()=>{_();const t=new ResizeObserver(_);return t.observe(l.current),()=>{t.disconnect()}}),[t,s,p]),e.createElement("div",{className:"eko-nav-container",ref:c,style:{opacity:v>0?1:0,height:""+(v&&p?v+"px":"auto")}},e.createElement(Ot,{layout:r,nav:l,isVerticalNav:p,showPrevArrow:y,showNextArrow:k}),e.createElement("ul",{className:`eko-nav eko-mobile-nav-selected-${null!==(E=null==r||null===(A=r.mobile)||void 0===A||null===(A=A.config)||void 0===A?void 0:A.navItemsSelectedType)&&void 0!==E?E:"underline"} eko-desktop-nav-selected-${null!==(N=null==r||null===(M=r.desktop)||void 0===M||null===(M=M.config)||void 0===M?void 0:M.navItemsSelectedType)&&void 0!==N?N:"underline"}`,ref:l,onScroll:function(){_()},onWheel:function(){T("wheel")},onTouchMove:function(){T("swipe")}},null==t?void 0:t.map(((t,n)=>{var r;const o=(null==t||null===(r=t.media)||void 0===r?void 0:r.url)||(null==t?void 0:t.media)||"";return e.createElement(Ct,{key:o+n,index:n,activeIndex:i,setActiveIndex:I,item:t,src:o,navItemRefs:u,itemIcon:null==t?void 0:t.icon})}))));var E,A,N,M};Rt.propTypes={items:Tt.array.isRequired,activeIndex:Tt.number,setActiveIndex:Tt.func.isRequired,layout:Tt.object,carouselMounted:Tt.bool,forceMobile:Tt.bool};function Dt(){S.track("gallery.cover.displayed"),Ft.send("gallerycoverdisplayed")}function Lt(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 Bt=({item:t,src:n,srcset:i,sizes:r,isCoverElement:o})=>{const s=e.useRef(null);return e.useEffect((()=>{var t;if(o){if(null===(t=s.current)||void 0===t||!t.complete)return s.current.addEventListener("load",Dt,{once:!0}),()=>{var t;null===(t=s.current)||void 0===t||t.removeEventListener("load",Dt,{once:!0})};Dt()}}),[]),e.createElement("img",{ref:s,src:Lt(n),srcSet:i,sizes:r,alt:t.name,fetchPriority:o?"high":"auto",loading:o?"eager":"lazy",style:{width:"100%",height:"100%"}})};Bt.propTypes={item:Tt.object.isRequired,src:Tt.string,srcset:Tt.string,sizes:Tt.string,isCoverElement:Tt.bool};const zt=Pt((t=>{var e;e=t,S.track("gallery.interaction",{elementid:"carousel",interactiontype:e}),Ft.send("interaction",{elementid:"carousel",interactiontype:e})}),200);function Wt(){zt("wheel")}const $t=e.forwardRef((({items:t,setActiveIndex:n,activeIndex:i,showSmartLoaders:r},o)=>{const s=e.useRef(null),a=e.useRef([]);a.current=null==t?void 0:t.map(((t,n)=>{var i,r;return null!==(i=null==a||null===(r=a.current)||void 0===r?void 0:r[n])&&void 0!==i?i:e.createRef()}));const[l,c]=e.useState(),[u,d]=e.useState(),h=e.useRef(i),f=e.useRef(!1);function p(){const e=function(t){const e=t.scrollLeft,n=t.scrollWidth-t.clientWidth;return 0===e?0:e>n?100:e/n*100}(s.current)*(null==t?void 0:t.length)/100,i=Math.min(Math.trunc(e),(null==t?void 0:t.length)-1),r=h.current;"nav"!==r.source&&"external-nav"!==r.source?(f.current&&i!==r.index&&(f.current=!1),f.current||(i>(null==t?void 0:t.length)-1?n({index:(null==t?void 0:t.length)-1,source:"carousel"}):n({index:i,source:"carousel"}))):i===r.index?f.current=!0:f.current&&i!==r.index&&(f.current=!1,n({index:i,source:"carousel"}))}return e.useImperativeHandle(o,(()=>({prev:()=>{n({index:Math.max(0,h.current.index-1),source:"carousel"})},next:()=>{n({index:Math.min((null==t?void 0:t.length)-1,h.current.index+1),source:"carousel"})}}))),e.useEffect((()=>{const t=s.current;if(t)return t.addEventListener("scroll",p),()=>{t.removeEventListener("scroll",p)}}),[t]),e.useEffect((()=>{var t;let e=null===(t=a.current)||void 0===t?void 0:t[i.index];if(e&&("nav"===i.source||"external-nav"===i.source)){const t=e.current,n=s.current.clientWidth/2,i=(null==t?void 0:t.clientWidth)/2,r=(null==t?void 0:t.offsetLeft)-n+i;s.current.scrollTo({left:r,behavior:"smooth"})}}),[i]),e.useEffect((()=>{h.current=i,"nav"!==i.source&&"external-nav"!==i.source||(f.current=!1)}),[i]),e.createElement("ul",{className:"eko-carousel",ref:s,onScroll:p,onWheel:Wt,onTouchMove:function(t){d(t.targetTouches[0].clientX)},onTouchStart:function(t){c(t.targetTouches[0].clientX),d(null)},onTouchEnd:function(){u&&l&&(l-u>75||l-u<-75)&&zt("swipe")}},null==t?void 0:t.map(((t,n)=>{const i=(null==t?void 0:t.cover)||(null==t?void 0:t.media),o=(null==i?void 0:i.url)||i;return e.createElement("li",{className:"eko-carousel-item",key:o+n,ref:a.current[n]},e.createElement(Bt,{item:t,src:o,srcset:null==i?void 0:i.srcset,sizes:null==i?void 0:i.sizes,isCoverElement:0===n}),r&&"image"!==t.type&&e.createElement("div",{className:"eko-smart-loading"},e.createElement("div",null),e.createElement("p",null,"Loading video experience")))})))}));function Ut(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)}$t.propTypes={items:Tt.array.isRequired,setActiveIndex:Tt.func.isRequired,activeIndex:Tt.object,showSmartLoaders:Tt.bool},$t.displayName="CarouselLoop";const jt="eko.project.invoke",qt="eko.block.invoke";function Vt(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 Ht(t){return`#variantId=${encodeURIComponent(t)}`}const Gt=e.forwardRef((({config:t,instanceId:n,setActiveItem:i,activeItem:r,variantId:o,smartGalleryLoaded:s,onLoad:l,forceMobile:c},u)=>{var d,h,f;const p=null!==(d=null===(h=t.options)||void 0===h?void 0:h.galleryEnv)&&void 0!==d?d:"",m=null===(f=t.__autoGenerated)||void 0===f||null===(f=f.publishItem)||void 0===f?void 0:f.id,v=function(t={}){let e="";return Object.entries(t).forEach((([t,n])=>{e+=`&${t}=${n}`})),e}(null==t?void 0:t.qp),g=function(t,e,n){return`https://${t}play.eko.com/embed?${n?`id=${n}`:`piid=${e}`}&nocover=true&galleryBlockMode=gallery&eko_pixel=true`}(p,m,n),y=e.useRef(null),b=e.useRef(null),k=e.useRef(!1),[x,w]=e.useState(Ht(o||"ekonovar")),[_,T]=e.useState(g+v+x);let I;function E(){S.track("gallery.project.display"),l(),Ft.send("galleryloaded")}return e.useImperativeHandle(u,(()=>({prev:()=>{Vt(null==b?void 0:b.current,qt,{action:"onPrevModule"})},next:()=>{Vt(null==b?void 0:b.current,qt,{action:"onNextModule"})}}))),e.useEffect((()=>{k.current?Vt(null==b?void 0:b.current,jt,{action:"updateVariant",args:{id:o}}):w(Ht(o))}),[o]),e.useEffect((()=>{Vt(null==b?void 0:b.current,qt,{action:"updateActiveModule",args:{activeItemIndex:null==r?void 0:r.index,activeModuleIndex:null==r?void 0:r.step}})}),[r]),e.useEffect((()=>{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))&&!k.current)return e=t.data.data.blockType,k.current=!0,void("GalleryBlock"===e?Vt(null==b?void 0:b.current,qt,{action:"updateActiveModule",args:{activeItemIndex:null==r?void 0:r.index,activeModuleIndex:null==r?void 0:r.step}}):E());var e;if(k.current){if(function(t){var e;return Ut(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==r?void 0:r.index)&&n===(null==r?void 0:r.step)||i({index:e,step:n,source:"carousel"})}(t);(function(t){var e;return Ut(t)&&"activeModuleChangeDone"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.name)})(t)&&!s&&E()}}return I=c||a()?"mobile":"desktop",function(t,e={}){window.addEventListener("message",t,e)}(t),()=>{!function(t,e={}){window.removeEventListener("message",t,e)}(t)}}),[r]),e.useEffect((()=>{k.current||Vt(null==b?void 0:b.current,jt,{action:"queryProjectStarted"})}),[r,s]),e.useEffect((()=>{k.current=!1}),[t]),e.useEffect((()=>{T(g+v+x)}),[x]),e.createElement("div",{className:"eko-smart-gallery-container "+(s?"":"eko-project-not-ready"),ref:y,"data-type":"smart-gallery","data-qp":v,"data-variant":o,"data-device":I},e.createElement("iframe",{allow:"autoplay; fullscreen",title:"eko gallery",src:_,style:{border:0},ref:b}))}));Gt.propTypes={config:Tt.object.isRequired,instanceId:Tt.string,setActiveItem:Tt.func.isRequired,activeItem:Tt.object.isRequired,variantId:Tt.string,smartGalleryLoaded:Tt.bool,onLoad:Tt.func,forceMobile:Tt.bool},Gt.displayName="SmartGallery";const Kt=()=>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}'),Xt=({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")}}`)};Xt.propTypes={layout:Tt.object,style:Tt.object},u("experiment");const Yt=({activeVariantId:t,activeElementId:n,hasInteractive:i,experiments:r,publishItem:o})=>{const s="gallery",a=e.useRef(t),l=e.useRef(n),c=e.useRef(i),u=e.useRef(r),d=e.useRef(o);e.useEffect((()=>{a.current=t,l.current=n,c.current=i,u.current=r,d.current=o}),[t,n,i,r,o]);const h={publishItemPacker:{tag:s,schema:"iglu:com.helloeko/publishitem/jsonschema/1-0-0",match:/.*/,getData:function(){const t=d.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:s,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:s,schema:"iglu:com.helloeko/gallery/jsonschema/1-0-2",match:/^gallery.*/,getData:function(){var t;return{activeitemid:l.current.toString(),activevariantid:a.current,hasinteractive:c.current,version:(null===(t=window.eko)||void 0===t||null===(t=t.gallery)||void 0===t?void 0:t.version)||""}}},activeVariantIdPacker:{tag:s,schema:"iglu:com.helloeko/variant/jsonschema/1-0-1",match:/.*/,getData:function(){if(a.current)return{id:a.current}}},experimentPacker:{tag:s,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}(u.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 e.useEffect((()=>(Object.values(h).forEach((t=>{window.EkoAnalytics("registerContextPacker",t)})),()=>{window.EkoAnalytics("reset",s)})),[]),null};Yt.propTypes={activeVariantId:Tt.string,activeElementId:Tt.number,hasInteractive:Tt.bool,experiments:Tt.array,publishItem:Tt.object};const Qt=({variantId:t,activeItem:n,hasInteractive:i,activeIndex:r,experiments:o,publishItem:s})=>{const a=e.useRef(!0);return e.useEffect((()=>{a.current||t&&S.track("gallery.variant.change")}),[t]),e.useEffect((()=>{a.current||S.track("gallery.element.change",{activeIndex:r})}),[r]),e.useEffect((()=>{a.current||n&&null!=s&&s.id&&S.track("gallery.asset.view",{publishitemid:s.id,type:n.type,name:n.name})}),[n]),e.useEffect((()=>{a.current=!1}),[]),e.createElement(Yt,{activeVariantId:t||"ekonovar",activeElementId:r,hasInteractive:i,experiments:o,publishItem:s})};Qt.propTypes={variantId:Tt.string,activeItem:Tt.object,hasInteractive:Tt.bool,activeIndex:Tt.number,experiments:Tt.array,publishItem:Tt.object};const Jt="eko-gallery-react";function Zt(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 te=e.forwardRef((({className:t,config:n,instanceId:i,variantId:r,activeItem:o={index:0,step:0},onEvent:s,forceMobile:a},l)=>{var c,u,d,h,f,p;const m=null!==(c=null===(u=n.options)||void 0===u?void 0:u.loadingTimeout)&&void 0!==c?c:12,v=null===(d=null===(h=n.options)||void 0===h?void 0:h.showCoverLoadAnimation)||void 0===d||d,[g,y]=e.useState(Zt(n,r)),[b,k]=e.useState({index:o.index,step:o.step,source:"external-nav"}),[x,w]=e.useState(!1),[_,T]=e.useState(!1),[I,E]=e.useState("eko-desktop"),A=e.useRef(!1),N=e.useRef(!1),M=e.useRef(o),F=e.useRef(null),C=e.useRef(r);function O(){const t=a||window.innerWidth<768?"eko-mobile":"eko-desktop";E(t)}return N.current||(Ft.send("galleryinit"),N.current=!0),e.useEffect((()=>{const t=C.current!==r;C.current=r,y(Zt(n,r)),t&&!A.current&&k({index:0,step:0,source:"external-nav"})}),[n,r]),e.useEffect((()=>{if(s)return Ft.subscribe(s),()=>{Ft.unsubscribe()}}),[s]),e.useEffect((()=>{A.current=_}),[_]),e.useEffect((()=>{w(!1),T(!1);const t=setTimeout((()=>{A.current||(w(!0),S.track("gallery.load.timeout"))}),1e3*m);return()=>{clearTimeout(t)}}),[n]),e.useEffect((()=>{O()}),[a]),e.useEffect((()=>(window.addEventListener("resize",O),O(),()=>{window.removeEventListener("resize",O)})),[a]),e.useEffect((()=>(window.EkoAnalytics("trackElementVisibility",F.current,Jt),()=>{window.EkoAnalytics("stopTrackingElementVisibility",Jt)})),[]),e.useEffect((()=>{!("carousel"===(null==b?void 0:b.source)||"nav"===(null==b?void 0:b.source))||(null==b?void 0:b.index)===o.index&&(null==b?void 0:b.step)===o.step||Ft.send("activeitemchanged",{index:null==b?void 0:b.index,step:null==b?void 0:b.step})}),[b,o]),e.useEffect((()=>{M.current.index===o.index&&M.current.step===o.step||(M.current=o,k({index:o.index,step:o.step,source:"external-nav"}))}),[o]),e.createElement(e.Fragment,null,e.createElement(Kt,null),e.createElement(Xt,{layout:n.layout,style:n.style,forceMobile:a}),e.createElement(Qt,{variantId:r,activeItem:null==g||null===(f=g.items)||void 0===f?void 0:f[b.index],activeIndex:b.index,hasInteractive:_,experiments:n.experiments,publishItem:null==n||null===(p=n.__autoGenerated)||void 0===p?void 0:p.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}(n.layout)} ${null!=t?t:""}`.trim()} ${I}`,"aria-controls":"main-content",ref:F},e.createElement(Rt,{items:(null==g?void 0:g.items)||[],setActiveIndex:k,activeIndex:b.index,layout:n.layout,carouselMounted:_,forceMobile:a}),!_&&e.createElement($t,{ref:l,items:(null==g?void 0:g.items)||[],setActiveIndex:k,activeIndex:{index:b.index,source:null==b?void 0:b.source},showSmartLoaders:!x&&v}),!x&&e.createElement(Gt,{ref:l,config:n,instanceId:i,activeItem:b,setActiveItem:k,variantId:null==g?void 0:g.variantId,smartGalleryLoaded:_,forceMobile:a,onLoad:function(){T(!0)}})))}));te.propTypes={className:Tt.string,config:Tt.object.isRequired,instanceId:Tt.string,variantId:Tt.string,activeItem:Tt.object,onEvent:Tt.func,forceMobile:Tt.bool,onPrev:Tt.func,onNext:Tt.func},te.displayName="EkoGallery";var ee=e.memo(te);const ne=u("gallery-react");const ie=e.forwardRef(((t,n)=>{var i;e.useEffect((()=>(ne.setDataStorage("gallery-react",{config:t.config}),window.eko=window.eko||{},window.eko.config=t.config,window.eko.gallery={version:"4.0.4"},()=>{window.eko.config=void 0})),[t.config]);const{children:r,...o}=t;return void 0!==t.config?e.createElement(ee,R({ref:n},o,{key:null===(i=t.config.__autoGenerated)||void 0===i||null===(i=i.publishItem)||void 0===i?void 0:i.id})):r}));ie.propTypes={className:Tt.string,config:Tt.object,variantId:Tt.string,onEvent:Tt.func,instanceId:Tt.string,children:Tt.node},ie.displayName="EkoGalleryWrapper";var re,oe,se,ae,le,ce,ue,de,he,fe,pe,me,ve,ge,ye,be,ke,xe,we,_e,Te,Ie,Ee,Se,Ae,Ne,Me,Fe,Ce,Oe,Pe,Re,De,Le,Be,ze,We,$e,Ue,je,qe,Ve,He,Ge,Ke,Xe,Ye,Qe,Je,Ze,tn,en,nn=e.memo(ie);const rn=1,on=2,sn=4,an=8,ln=16,cn=1,un=4,dn=8,hn=16,fn="[",pn="[!",mn="]",vn={},gn=Symbol(),yn="http://www.w3.org/1999/xhtml",bn="@attach",kn=!1;var xn=Array.isArray,wn=Array.prototype.indexOf,_n=Array.from,Tn=Object.defineProperty,In=Object.getOwnPropertyDescriptor,En=Object.getOwnPropertyDescriptors,Sn=Object.prototype,An=Array.prototype,Nn=Object.getPrototypeOf,Mn=Object.isExtensible;function Fn(){var t,e;return{promise:new Promise(((n,i)=>{t=n,e=i})),resolve:t,reject:e}}const Cn=2,On=4,Pn=8,Rn=1<<24,Dn=16,Ln=32,Bn=64,zn=128,Wn=512,$n=1024,Un=2048,jn=4096,qn=8192,Vn=16384,Hn=32768,Gn=65536,Kn=1<<17,Xn=1<<18,Yn=1<<19,Qn=1<<20,Jn=1<<25,Zn=32768,ti=1<<21,ei=1<<22,ni=1<<23,ii=Symbol("$state"),ri=Symbol("legacy props"),oi=Symbol(""),si=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},ai=3,li=8;function ci(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function ui(t){console.warn("https://svelte.dev/e/hydration_mismatch")}let di,hi=!1;function fi(t){hi=t}function pi(t){if(null===t)throw ui(),vn;return di=t}function mi(){return pi(fo(di))}function vi(t){if(hi){if(null!==fo(di))throw ui(),vn;di=t}}function gi(t=!0){for(var e=0,n=di;;){if(n.nodeType===li){var i=n.data;if(i===mn){if(0===e)return n;e-=1}else i!==fn&&i!==pn||(e+=1)}var r=fo(n);t&&n.remove(),n=r}}function yi(t){if(!t||t.nodeType!==li)throw ui(),vn;return t.data}function bi(t){return t===this.v}function ki(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 xi=!1,wi=null;function _i(t){wi=t}function Ti(t){return Si().get(t)}function Ii(t,e=!1,n){wi={p:wi,i:!1,c:null,e:null,s:t,x:null,l:null}}function Ei(t){var e=wi,n=e.e;if(null!==n)for(var i of(e.e=null,n))Eo(i);return e.i=!0,wi=e.p,{}}function Si(t){var e,n;return null===wi&&ci(),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 Ai=[];function Ni(){var t=Ai;Ai=[],function(t){for(var e=0;e<t.length;e++)t[e]()}(t)}function Mi(t){if(0===Ai.length&&!Vi){var e=Ai;queueMicrotask((()=>{e===Ai&&Ni()}))}Ai.push(t)}function Fi(){for(;Ai.length>0;)Ni()}function Ci(t){var e=Xo;if(null===e)return Ho.f|=ni,t;if(e.f&Hn)Oi(t,e);else{if(!(e.f&zn))throw t;e.b.error(t)}}function Oi(t,e){for(;null!==e;){if(e.f&zn)try{return void e.b.error(t)}catch(e){t=e}e=e.parent}throw t}const Pi=-7169;function Ri(t,e){t.f=t.f&Pi|e}function Di(t){t.f&Wn||null===t.deps?Ri(t,$n):Ri(t,jn)}function Li(t){if(null!==t)for(const e of t)e.f&Cn&&e.f&Zn&&(e.f^=Zn,Li(e.deps))}function Bi(t,e,n){t.f&Un?e.add(t):t.f&jn&&n.add(t),Li(t.deps),Ri(t,$n)}const zi=new Set;let Wi=null,$i=null,Ui=[],ji=null,qi=!1,Vi=!1;var Hi=new WeakMap,Gi=new WeakMap,Ki=new WeakMap,Xi=new WeakMap,Yi=new WeakMap,Qi=new WeakMap,Ji=new WeakMap,Zi=new WeakSet;class tr{constructor(){O(this,Zi),P(this,"committed",!1),P(this,"current",new Map),P(this,"previous",new Map),F(this,Hi,new Set),F(this,Gi,new Set),F(this,Ki,0),F(this,Xi,0),F(this,Yi,null),F(this,Qi,new Set),F(this,Ji,new Set),P(this,"skipped_effects",new Set),P(this,"is_fork",!1)}is_deferred(){return this.is_fork||M(Xi,this)>0}process(t){Ui=[],this.apply();var e,n=[],i=[];for(const e of t)A(Zi,this,er).call(this,e,n,i);(this.is_fork||A(Zi,this,ir).call(this),this.is_deferred())?(A(Zi,this,nr).call(this,i),A(Zi,this,nr).call(this,n)):(Wi=null,lr(i),lr(n),null===(e=M(Yi,this))||void 0===e||e.resolve());$i=null}capture(t,e){var n;(e===gn||this.previous.has(t)||this.previous.set(t,e),t.f&ni)||(this.current.set(t,t.v),null===(n=$i)||void 0===n||n.set(t,t.v))}activate(){Wi=this,this.apply()}deactivate(){Wi===this&&(Wi=null,$i=null)}flush(){if(this.activate(),Ui.length>0){if(or(),null!==Wi&&Wi!==this)return}else 0===M(Ki,this)&&this.process([]);this.deactivate()}discard(){for(const t of M(Gi,this))t(this);M(Gi,this).clear()}increment(t){C(Ki,this,M(Ki,this)+1),t&&C(Xi,this,M(Xi,this)+1)}decrement(t){C(Ki,this,M(Ki,this)-1),t&&C(Xi,this,M(Xi,this)-1),this.revive()}revive(){for(const t of M(Qi,this))M(Ji,this).delete(t),Ri(t,Un),dr(t);for(const t of M(Ji,this))Ri(t,jn),dr(t);this.flush()}oncommit(t){M(Hi,this).add(t)}ondiscard(t){M(Gi,this).add(t)}settled(){var t;return(null!==(t=M(Yi,this))&&void 0!==t?t:C(Yi,this,Fn())).promise}static ensure(){if(null===Wi){const t=Wi=new tr;zi.add(Wi),Vi||tr.enqueue((()=>{Wi===t&&t.flush()}))}return Wi}static enqueue(t){Mi(t)}apply(){}}function er(t,e,n){t.f^=$n;for(var i=t.first,r=null;null!==i;){var o=i.f,s=!!(o&(Ln|Bn));if(!(s&&!!(o&$n)||!!(o&qn)||this.skipped_effects.has(i))&&null!==i.fn){s?i.f^=$n:null!==r&&o&(On|Pn|Rn)?r.b.defer_effect(i):o&On?e.push(i):as(i)&&(o&Dn&&M(Qi,this).add(i),hs(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 nr(t){for(var e=0;e<t.length;e+=1)Bi(t[e],M(Qi,this),M(Ji,this))}function ir(){if(0===M(Xi,this)){for(const t of M(Hi,this))t();M(Hi,this).clear()}0===M(Ki,this)&&A(Zi,this,rr).call(this)}function rr(){if(zi.size>1){this.previous.clear();var t=$i,e=!0;for(const t of zi){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=Ui;Ui=[];const e=new Set,o=new Map;for(const t of i)cr(t,r,e,o);if(Ui.length>0){Wi=t,t.apply();for(const e of Ui)A(Zi,t,er).call(t,e,[],[]);t.deactivate()}Ui=n}}Wi=null,$i=t}this.committed=!0,zi.delete(this)}function or(){var t=Uo;qi=!0;try{var e=0;for(jo(!0);Ui.length>0;){var n=tr.ensure();if(e++>1e3)sr();n.process(Ui),Kr.clear()}}finally{qi=!1,jo(t),ji=null}}function sr(){try{!function(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}()}catch(t){Oi(t,ji)}}let ar=null;function lr(t){var e=t.length;if(0!==e){for(var n=0;n<e;){var i,r=t[n++];if(!(r.f&(Vn|qn))&&as(r))if(ar=new Set,hs(r),null===r.deps&&null===r.first&&null===r.nodes&&(null===r.teardown&&null===r.ac?Do(r):r.fn=null),(null===(i=ar)||void 0===i?void 0:i.size)>0){Kr.clear();for(const t of ar){if(t.f&(Vn|qn))continue;const e=[t];let n=t.parent;for(;null!==n;)ar.has(n)&&(ar.delete(n),e.push(n)),n=n.parent;for(let t=e.length-1;t>=0;t--){const n=e[t];n.f&(Vn|qn)||hs(n)}}ar.clear()}}ar=null}}function cr(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&Cn?cr(r,e,n,i):t&(ei|Dn)&&!(t&Un)&&ur(r,e,i)&&(Ri(r,Un),dr(r))}}function ur(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&Cn&&ur(i,e,n))return n.set(i,!0),!0}return n.set(t,!1),!1}function dr(t){for(var e=ji=t;null!==e.parent;){var n=(e=e.parent).f;if(qi&&e===Xo&&n&Dn&&!(n&Xn))return;if(n&(Bn|Ln)){if(!(n&$n))return;e.f^=$n}}Ui.push(e)}var hr=Gn|Yn|zn;var fr=new WeakMap,pr=new WeakMap,mr=new WeakMap,vr=new WeakMap,gr=new WeakMap,yr=new WeakMap,br=new WeakMap,kr=new WeakMap,xr=new WeakMap,wr=new WeakMap,_r=new WeakMap,Tr=new WeakMap,Ir=new WeakMap,Er=new WeakMap,Sr=new WeakMap,Ar=new WeakMap,Nr=new WeakMap,Mr=new WeakSet;class Fr{constructor(t,e,n){O(this,Mr),P(this,"parent",void 0),P(this,"is_pending",!1),F(this,fr,void 0),F(this,pr,hi?di:null),F(this,mr,void 0),F(this,vr,void 0),F(this,gr,void 0),F(this,yr,null),F(this,br,null),F(this,kr,null),F(this,xr,null),F(this,wr,null),F(this,_r,0),F(this,Tr,0),F(this,Ir,!1),F(this,Er,new Set),F(this,Sr,new Set),F(this,Ar,null),F(this,Nr,function(t){let e,n=0,i=Yr(0);return()=>{_o()&&(ps(i),Ao((()=>(0===n&&(e=gs((()=>t((()=>eo(i)))))),n+=1,()=>{Mi((()=>{var t;n-=1,0===n&&(null===(t=e)||void 0===t||t(),e=void 0,eo(i))}))}))))}}((()=>(C(Ar,this,Yr(M(_r,this))),()=>{C(Ar,this,null)})))),C(fr,this,t),C(mr,this,e),C(vr,this,n),this.parent=Xo.b,this.is_pending=!!M(mr,this).pending,C(gr,this,Mo((()=>{if(Xo.b=this,hi){const t=M(pr,this);mi();t.nodeType===li&&t.data===pn?A(Mr,this,Or).call(this):(A(Mr,this,Cr).call(this),0===M(Tr,this)&&(this.is_pending=!1))}else{var t=A(Mr,this,Pr).call(this);try{C(yr,this,Co((()=>n(t))))}catch(t){this.error(t)}M(Tr,this)>0?A(Mr,this,Dr).call(this):this.is_pending=!1}return()=>{var t;null===(t=M(wr,this))||void 0===t||t.remove()}}),hr)),hi&&C(fr,this,di)}defer_effect(t){Bi(t,M(Er,this),M(Sr,this))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!M(mr,this).pending}update_pending_count(t){A(Mr,this,Lr).call(this,t),C(_r,this,M(_r,this)+t),M(Ar,this)&&to(M(Ar,this),M(_r,this))}get_effect_pending(){return M(Nr,this).call(this),ps(M(Ar,this))}error(t){var e=M(mr,this).onerror;let n=M(mr,this).failed;if(M(Ir,this)||!e&&!n)throw t;M(yr,this)&&(Ro(M(yr,this)),C(yr,this,null)),M(br,this)&&(Ro(M(br,this)),C(br,this,null)),M(kr,this)&&(Ro(M(kr,this)),C(kr,this,null)),hi&&(pi(M(pr,this)),function(t=1){if(hi){for(var e=t,n=di;e--;)n=fo(n);di=n}}(),pi(gi()));var i=!1,r=!1;const o=()=>{i?console.warn("https://svelte.dev/e/svelte_boundary_reset_noop"):(i=!0,r&&function(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}(),tr.ensure(),C(_r,this,0),null!==M(kr,this)&&Lo(M(kr,this),(()=>{C(kr,this,null)})),this.is_pending=this.has_pending_snippet(),C(yr,this,A(Mr,this,Rr).call(this,(()=>(C(Ir,this,!1),Co((()=>M(vr,this).call(this,M(fr,this)))))))),M(Tr,this)>0?A(Mr,this,Dr).call(this):this.is_pending=!1)};var s=Ho;try{Ko(null),r=!0,null==e||e(t,o),r=!1}catch(t){Oi(t,M(gr,this)&&M(gr,this).parent)}finally{Ko(s)}n&&Mi((()=>{C(kr,this,A(Mr,this,Rr).call(this,(()=>{tr.ensure(),C(Ir,this,!0);try{return Co((()=>{n(M(fr,this),(()=>t),(()=>o))}))}catch(t){return Oi(t,M(gr,this).parent),null}finally{C(Ir,this,!1)}})))}))}}function Cr(){try{C(yr,this,Co((()=>M(vr,this).call(this,M(fr,this)))))}catch(t){this.error(t)}}function Or(){const t=M(mr,this).pending;t&&(C(br,this,Co((()=>t(M(fr,this))))),tr.enqueue((()=>{var t=A(Mr,this,Pr).call(this);C(yr,this,A(Mr,this,Rr).call(this,(()=>(tr.ensure(),Co((()=>M(vr,this).call(this,t))))))),M(Tr,this)>0?A(Mr,this,Dr).call(this):(Lo(M(br,this),(()=>{C(br,this,null)})),this.is_pending=!1)})))}function Pr(){var t=M(fr,this);return this.is_pending&&(C(wr,this,uo()),M(fr,this).before(M(wr,this)),t=M(wr,this)),t}function Rr(t){var e=Xo,n=Ho,i=wi;Yo(M(gr,this)),Ko(M(gr,this)),_i(M(gr,this).ctx);try{return t()}catch(t){return Ci(t),null}finally{Yo(e),Ko(n),_i(i)}}function Dr(){const t=M(mr,this).pending;null!==M(yr,this)&&(C(xr,this,document.createDocumentFragment()),M(xr,this).append(M(wr,this)),$o(M(yr,this),M(xr,this))),null===M(br,this)&&C(br,this,Co((()=>t(M(fr,this)))))}function Lr(t){var e;if(this.has_pending_snippet()){if(C(Tr,this,M(Tr,this)+t),0===M(Tr,this)){this.is_pending=!1;for(const t of M(Er,this))Ri(t,Un),dr(t);for(const t of M(Sr,this))Ri(t,jn),dr(t);M(Er,this).clear(),M(Sr,this).clear(),M(br,this)&&Lo(M(br,this),(()=>{C(br,this,null)})),M(xr,this)&&(M(fr,this).before(M(xr,this)),C(xr,this,null))}}else this.parent&&A(Mr,e=this.parent,Lr).call(e,t)}function Br(t,e,n,i){const r=Wr;if(0!==n.length||0!==t.length){var o,s,a,l,c=Wi,u=Xo,d=(o=Xo,s=Ho,a=wi,l=Wi,function(t=!0){Yo(o),Ko(s),_i(a),t&&(null==l||l.activate())});t.length>0?Promise.all(t).then((()=>{d();try{return h()}finally{null==c||c.deactivate(),zr()}})):h()}else i(e.map(r));function h(){Promise.all(n.map((t=>$r(t)))).then((t=>{d();try{i([...e.map(r),...t])}catch(t){u.f&Vn||Oi(t,u)}null==c||c.deactivate(),zr()})).catch((t=>{Oi(t,u)}))}}function zr(){Yo(null),Ko(null),_i(null)}function Wr(t){var e=Cn|Un,n=null!==Ho&&Ho.f&Cn?Ho:null;null!==Xo&&(Xo.f|=Yn);return{ctx:wi,deps:null,effects:null,equals:bi,f:e,fn:t,reactions:null,rv:0,v:gn,wv:0,parent:null!=n?n:Xo,ac:null}}function $r(t,e,n){let i=Xo;null===i&&function(){throw new Error("https://svelte.dev/e/async_derived_orphan")}();var r=i.b,o=void 0,s=Yr(gn),a=!Ho,l=new Map;return function(t){wo(ei|Yn,t,!0)}((()=>{var e=Fn();o=e.promise;try{Promise.resolve(t()).then(e.resolve,e.reject).then((()=>{n===Wi&&n.committed&&n.deactivate(),zr()}))}catch(t){e.reject(t),zr()}var n=Wi;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(si),l.delete(n),l.set(n,e)}const u=(t,e=void 0)=>{if(n.activate(),e)e!==si&&(s.f|=ni,to(s,e));else{s.f&ni&&(s.f^=ni),to(s,t);for(const[t,e]of l){if(l.delete(t),t===n)break;e.reject(si)}}a&&(r.update_pending_count(-1),n.decrement(c))};e.promise.then(u,(t=>u(null,t||"unknown")))})),To((()=>{for(const t of l.values())t.reject(si)})),new Promise((t=>{!function e(n){function i(){n===o?t(s):e(o)}n.then(i,i)}(o)}))}function Ur(t){const e=Wr(t);return Jo(e),e}function jr(t){const e=Wr(t);return e.equals=ki,e}function qr(t){var e=t.effects;if(null!==e){t.effects=null;for(var n=0;n<e.length;n+=1)Ro(e[n])}}function Vr(t){var e,n=Xo;Yo(function(t){for(var e=t.parent;null!==e;){if(!(e.f&Cn))return e.f&Vn?null:e;e=e.parent}return null}(t));try{t.f&=~Zn,qr(t),e=cs(t)}finally{Yo(n)}return e}function Hr(t){var e,n,i=Vr(t);if(!t.equals(i)&&(t.wv=ss(),(null===(e=Wi)||void 0===e||!e.is_fork||null===t.deps)&&(t.v=i,null===t.deps)))return void Ri(t,$n);qo||(null!==$i?(_o()||null!==(n=Wi)&&void 0!==n&&n.is_fork)&&$i.set(t,i):Di(t))}let Gr=new Set;const Kr=new Map;let Xr=!1;function Yr(t,e){return{f:0,v:t,reactions:null,equals:bi,rv:0,wv:0}}function Qr(t,e){const n=Yr(t);return Jo(n),n}function Jr(t,e=!1,n=!0){const i=Yr(t);return e||(i.equals=ki),i}function Zr(t,e,n=!1){var i;return null!==Ho&&(!Go||Ho.f&Kn)&&Ho.f&(Cn|Dn|ei|Kn)&&(null===(i=Qo)||void 0===i||!i.includes(t))&&function(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}(),to(t,n?io(e):e)}function to(t,e){if(!t.equals(e)){var n=t.v;qo?Kr.set(t,e):Kr.set(t,n),t.v=e;var i=tr.ensure();if(i.capture(t,n),t.f&Cn){const e=t;t.f&Un&&Vr(e),Di(e)}t.wv=ss(),no(t,Un),null!==Xo&&Xo.f&$n&&!(Xo.f&(Ln|Bn))&&(null===es?function(t){es=t}([t]):es.push(t)),!i.is_fork&&Gr.size>0&&!Xr&&function(){Xr=!1;var t=Uo;jo(!0);const e=Array.from(Gr);try{for(const t of e)t.f&$n&&Ri(t,jn),as(t)&&hs(t)}finally{jo(t)}Gr.clear()}()}return e}function eo(t){Zr(t,t.v+1)}function no(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,a=!(s&Un);if(a&&Ri(o,e),s&Cn){var l,c=o;null===(l=$i)||void 0===l||l.delete(c),s&Zn||(s&Wn&&(o.f|=Zn),no(c,jn))}else a&&(s&Dn&&null!==ar&&ar.add(o),dr(o))}}function io(t){if("object"!=typeof t||null===t||ii in t)return t;const e=Nn(t);if(e!==Sn&&e!==An)return t;var n=new Map,i=xn(t),r=Qr(0),o=rs,s=t=>{if(rs===o)return t();var e=Ho,n=rs;Ko(null),os(o);var i=t();return Ko(e),os(n),i};return i&&n.set("length",Qr(t.length)),new Proxy(t,{defineProperty(t,e,i){"value"in i&&!1!==i.configurable&&!1!==i.enumerable&&!1!==i.writable||function(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}();var r=n.get(e);return void 0===r?r=s((()=>{var t=Qr(i.value);return n.set(e,t),t})):Zr(r,i.value,!0),!0},deleteProperty(t,e){var i=n.get(e);if(void 0===i){if(e in t){const t=s((()=>Qr(gn)));n.set(e,t),eo(r)}}else Zr(i,gn),eo(r);return!0},get(e,i,r){var o;if(i===ii)return t;var a=n.get(i),l=i in e;if(void 0===a&&(!l||null!==(o=In(e,i))&&void 0!==o&&o.writable)&&(a=s((()=>Qr(io(l?e[i]:gn)))),n.set(i,a)),void 0!==a){var c=ps(a);return c===gn?void 0:c}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=ps(r))}else if(void 0===i){var o=n.get(e),s=null==o?void 0:o.v;if(void 0!==o&&s!==gn)return{enumerable:!0,configurable:!0,value:s,writable:!0}}return i},has(t,e){var i;if(e===ii)return!0;var r=n.get(e),o=void 0!==r&&r.v!==gn||Reflect.has(t,e);if((void 0!==r||null!==Xo&&(!o||null!==(i=In(t,e))&&void 0!==i&&i.writable))&&(void 0===r&&(r=s((()=>Qr(o?io(t[e]):gn))),n.set(e,r)),ps(r)===gn))return!1;return o},set(t,e,o,a){var l,c=n.get(e),u=e in t;if(i&&"length"===e)for(var d=o;d<c.v;d+=1){var h=n.get(d+"");void 0!==h?Zr(h,gn):d in t&&(h=s((()=>Qr(gn))),n.set(d+"",h))}void 0===c?(!u||null!==(l=In(t,e))&&void 0!==l&&l.writable)&&(Zr(c=s((()=>Qr(void 0))),io(o)),n.set(e,c)):(u=c.v!==gn,Zr(c,s((()=>io(o)))));var f=Reflect.getOwnPropertyDescriptor(t,e);if(null!=f&&f.set&&f.set.call(a,o),!u){if(i&&"string"==typeof e){var p=n.get("length"),m=Number(e);Number.isInteger(m)&&m>=p.v&&Zr(p,m+1)}eo(r)}return!0},ownKeys(t){ps(r);var e=Reflect.ownKeys(t).filter((t=>{var e=n.get(t);return void 0===e||e.v!==gn}));for(var[i,o]of n)o.v===gn||i in t||e.push(i);return e},setPrototypeOf(){!function(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}()}})}function ro(t){try{if(null!==t&&"object"==typeof t&&ii in t)return t[ii]}catch{}return t}var oo,so,ao,lo;function co(){if(void 0===oo){oo=window,so=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;ao=In(e,"firstChild").get,lo=In(e,"nextSibling").get,Mn(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),Mn(n)&&(n.__t=void 0)}}function uo(t=""){return document.createTextNode(t)}function ho(t){return ao.call(t)}function fo(t){return lo.call(t)}function po(t,e){if(!hi)return ho(t);var n=ho(di);if(null===n)n=di.appendChild(uo());else if(e&&n.nodeType!==ai){var i,r=uo();return null===(i=n)||void 0===i||i.before(r),pi(r),r}return pi(n),n}function mo(t,e=!1){var n;if(!hi){var i=ho(t);return i instanceof Comment&&""===i.data?fo(i):i}if(e&&(null===(n=di)||void 0===n?void 0:n.nodeType)!==ai){var r,o=uo();return null===(r=di)||void 0===r||r.before(o),pi(o),o}return di}function vo(t,e=1,n=!1){var i;let r=hi?di:t;for(var o;e--;)o=r,r=fo(r);if(!hi)return r;if(n&&(null===(i=r)||void 0===i?void 0:i.nodeType)!==ai){var s,a=uo();if(null===r)null===(s=o)||void 0===s||s.after(a);else r.before(a);return pi(a),a}return pi(r),r}function go(t){t.textContent=""}function yo(t,e){if(e){const e=document.body;t.autofocus=!0,Mi((()=>{document.activeElement===e&&t.focus()}))}}let bo=!1;function ko(t){var e=Ho,n=Xo;Ko(null),Yo(null);try{return t()}finally{Ko(e),Yo(n)}}function xo(t){null===Xo&&(null===Ho&&function(){throw new Error("https://svelte.dev/e/effect_orphan")}(),function(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}()),qo&&function(){throw new Error("https://svelte.dev/e/effect_in_teardown")}()}function wo(t,e,n){var i=Xo;null!==i&&i.f&qn&&(t|=qn);var r={ctx:wi,deps:null,nodes:null,f:t|Un|Wn,first:null,fn:e,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,wv:0,ac:null};if(n)try{hs(r),r.f|=Hn}catch(t){throw Ro(r),t}else null!==e&&dr(r);var o=r;if(!n||null!==o.deps||null!==o.teardown||null!==o.nodes||o.first!==o.last||o.f&Yn||(o=o.first,t&Dn&&t&Gn&&null!==o&&(o.f|=Gn)),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!==Ho&&Ho.f&Cn&&!(t&Bn))){var s,a=Ho;(null!==(s=a.effects)&&void 0!==s?s:a.effects=[]).push(o)}return r}function _o(){return null!==Ho&&!Go}function To(t){const e=wo(Pn,null,!1);return Ri(e,$n),e.teardown=t,e}function Io(t){xo();var e=Xo.f;if(!!(Ho||!(e&Ln)||e&Hn))return Eo(t);var n,i=wi;(null!==(n=i.e)&&void 0!==n?n:i.e=[]).push(t)}function Eo(t){return wo(On|Qn,t,!1)}function So(t){return wo(On,t,!1)}function Ao(t,e=0){return wo(Pn|e,t,!0)}function No(t,e=[],n=[],i=[]){Br(i,e,n,(e=>{wo(Pn,(()=>t(...e.map(ps))),!0)}))}function Mo(t,e=0){return wo(Dn|e,t,!0)}function Fo(t,e=0){return wo(Rn|e,t,!0)}function Co(t){return wo(Ln|Yn,t,!0)}function Oo(t){var e=t.teardown;if(null!==e){const t=qo,n=Ho;Vo(!0),Ko(null);try{e.call(null)}finally{Vo(t),Ko(n)}}}function Po(t,e=!1){var n=t.first;for(t.first=t.last=null;null!==n;){const t=n.ac;null!==t&&ko((()=>{t.abort(si)}));var i=n.next;n.f&Bn?n.parent=null:Ro(n,e),n=i}}function Ro(t,e=!0){var n=!1;(e||t.f&Xn)&&null!==t.nodes&&null!==t.nodes.end&&(!function(t,e){for(;null!==t;){var n=t===e?null:fo(t);t.remove(),t=n}}(t.nodes.start,t.nodes.end),n=!0),Po(t,e&&!n),ds(t,0),Ri(t,Vn);var i=t.nodes&&t.nodes.t;if(null!==i)for(const t of i)t.stop();Oo(t);var r=t.parent;null!==r&&null!==r.first&&Do(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=null}function Do(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 Lo(t,e,n=!0){var i=[];Bo(t,i,!0);var r=()=>{n&&Ro(t),e&&e()},o=i.length;if(o>0){var s=()=>--o||r();for(var a of i)a.out(s)}else r()}function Bo(t,e,n){if(!(t.f&qn)){t.f^=qn;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;Bo(r,e,!!(!!(r.f&Gn)||!!(r.f&Ln)&&!!(t.f&Dn))&&n),r=o}}}function zo(t){Wo(t,!0)}function Wo(t,e){if(t.f&qn){t.f^=qn,t.f&$n||(Ri(t,Un),dr(t));for(var n=t.first;null!==n;){var i=n.next;Wo(n,!!(!!(n.f&Gn)||!!(n.f&Ln))&&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 $o(t,e){if(t.nodes)for(var n=t.nodes.start,i=t.nodes.end;null!==n;){var r=n===i?null:fo(n);e.append(n),n=r}}let Uo=!1;function jo(t){Uo=t}let qo=!1;function Vo(t){qo=t}let Ho=null,Go=!1;function Ko(t){Ho=t}let Xo=null;function Yo(t){Xo=t}let Qo=null;function Jo(t){null!==Ho&&(null===Qo?Qo=[t]:Qo.push(t))}let Zo=null,ts=0,es=null;let ns=1,is=0,rs=is;function os(t){rs=t}function ss(){return++ns}function as(t){var e=t.f;if(e&Un)return!0;if(e&Cn&&(t.f&=~Zn),e&jn){for(var n=t.deps,i=n.length,r=0;r<i;r++){var o=n[r];if(as(o)&&Hr(o),o.wv>t.wv)return!0}e&Wn&&null===$i&&Ri(t,$n)}return!1}function ls(t,e,n=!0){var i,r=t.reactions;if(null!==r&&(null===(i=Qo)||void 0===i||!i.includes(t)))for(var o=0;o<r.length;o++){var s=r[o];s.f&Cn?ls(s,e,!1):e===s&&(n?Ri(s,Un):s.f&$n&&Ri(s,jn),dr(s))}}function cs(t){var e=Zo,n=ts,i=es,r=Ho,o=Qo,s=wi,a=Go,l=rs,c=t.f;Zo=null,ts=0,es=null,Ho=c&(Ln|Bn)?null:t,Qo=null,_i(t.ctx),Go=!1,rs=++is,null!==t.ac&&(ko((()=>{t.ac.abort(si)})),t.ac=null);try{t.f|=ti;var u=(0,t.fn)(),d=t.deps;if(null!==Zo){var h;if(ds(t,ts),null!==d&&ts>0)for(d.length=ts+Zo.length,h=0;h<Zo.length;h++)d[ts+h]=Zo[h];else t.deps=d=Zo;if(_o()&&t.f&Wn)for(h=ts;h<d.length;h++){var f,p;(null!==(p=(f=d[h]).reactions)&&void 0!==p?p:f.reactions=[]).push(t)}}else null!==d&&ts<d.length&&(ds(t,ts),d.length=ts);if(!(null===es||Go||null===d||t.f&(Cn|jn|Un)))for(h=0;h<es.length;h++)ls(es[h],t);return null!==r&&r!==t&&(is++,null!==es&&(null===i?i=es:i.push(...es))),t.f&ni&&(t.f^=ni),u}catch(t){return Ci(t)}finally{t.f^=ti,Zo=e,ts=n,es=i,Ho=r,Qo=o,_i(s),Go=a,rs=l}}function us(t,e){let n=e.reactions;if(null!==n){var i=wn.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&Cn&&(null===Zo||!Zo.includes(e))){var o=e;o.f&Wn&&(o.f^=Wn,o.f&=~Zn),Di(o),qr(o),ds(o,0)}}function ds(t,e){var n=t.deps;if(null!==n)for(var i=e;i<n.length;i++)us(t,n[i])}function hs(t){var e=t.f;if(!(e&Vn)){Ri(t,$n);var n=Xo,i=Uo;Xo=t,Uo=!0;try{e&(Dn|Rn)?function(t){for(var e=t.first;null!==e;){var n=e.next;e.f&Ln||Ro(e),e=n}}(t):Po(t),Oo(t);var r=cs(t);t.teardown="function"==typeof r?r:null,t.wv=ns,kn&&xi&&t.f&Un&&t.deps}finally{Uo=i,Xo=n}}}async function fs(){await Promise.resolve(),function(){var t=Vi;Vi=!0;try{for(;;){var e;if(Fi(),0===Ui.length&&(null===(e=Wi)||void 0===e||e.flush(),0===Ui.length))return void(ji=null);or()}}finally{Vi=t}}()}function ps(t){var e,n,i=!!(t.f&Cn);if(null!==Ho&&!Go&&!(null!==Xo&&!!(Xo.f&Vn)||null!==(n=Qo)&&void 0!==n&&n.includes(t))){var r=Ho.deps;if(Ho.f&ti)t.rv<is&&(t.rv=is,null===Zo&&null!==r&&r[ts]===t?ts++:null===Zo?Zo=[t]:Zo.includes(t)||Zo.push(t));else{var o,s;(null!==(s=(o=Ho).deps)&&void 0!==s?s:o.deps=[]).push(t);var a=t.reactions;null===a?t.reactions=[Ho]:a.includes(Ho)||a.push(Ho)}}if(qo&&Kr.has(t))return Kr.get(t);if(i){var l=t;if(qo){var c=l.v;return(l.f&$n||null===l.reactions)&&!vs(l)||(c=Vr(l)),Kr.set(l,c),c}var u=!(l.f&Wn)&&!Go&&null!==Ho&&(Uo||!!(Ho.f&Wn)),d=null===l.deps;as(l)&&(u&&(l.f|=Wn),Hr(l)),u&&!d&&ms(l)}if(null!==(e=$i)&&void 0!==e&&e.has(t))return $i.get(t);if(t.f&ni)throw t.v;return t.v}function ms(t){if(null!==t.deps){t.f|=Wn;for(const n of t.deps){var e;(null!==(e=n.reactions)&&void 0!==e?e:n.reactions=[]).push(t),n.f&Cn&&!(n.f&Wn)&&ms(n)}}}function vs(t){if(t.v===gn)return!0;if(null===t.deps)return!1;for(const e of t.deps){if(Kr.has(e))return!0;if(e.f&Cn&&vs(e))return!0}return!1}function gs(t){var e=Go;try{return Go=!0,t()}finally{Go=e}}const ys=new Set,bs=new Set;function ks(t,e,n,i={}){function r(t){if(i.capture||Ts.call(e,t),!t.cancelBubble)return ko((()=>null==n?void 0:n.call(this,t)))}return t.startsWith("pointer")||t.startsWith("touch")||"wheel"===t?Mi((()=>{e.addEventListener(t,r,i)})):e.addEventListener(t,r,i),r}function xs(t,e,n,i,r){var o={capture:i,passive:r},s=ks(t,e,n,o);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&To((()=>{e.removeEventListener(t,s,o)}))}function ws(t){for(var e=0;e<t.length;e++)ys.add(t[e]);for(var n of bs)n(t)}let _s=null;function Ts(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;_s=t;var a=0,l=_s===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){Tn(t,"currentTarget",{configurable:!0,get:()=>s||i});var d=Ho,h=Xo;Ko(null),Yo(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,Ko(d),Yo(h)}}}function Is(t,e){var n=Xo;null===n.nodes&&(n.nodes={start:t,end:e,a:null,t:null})}function Es(t,e){var n,i=!!(1&e),r=!!(2&e),o=!t.startsWith("<!>");return()=>{if(hi)return Is(di,null),di;var e,s;void 0===n&&(e=o?t:"<!>"+t,(s=document.createElement("template")).innerHTML=e.replaceAll("<!>","\x3c!----\x3e"),n=s.content,i||(n=ho(n)));var a=r||so?document.importNode(n,!0):n.cloneNode(!0);i?Is(ho(a),a.lastChild):Is(a,a);return a}}function Ss(){if(hi)return Is(di,null),di;var t=document.createDocumentFragment(),e=document.createComment(""),n=uo();return t.append(e,n),Is(e,n),t}function As(t,e){if(hi){var n=Xo;return n.f&Hn&&null!==n.nodes.end||(n.nodes.end=di),void mi()}null!==t&&t.before(e)}function Ns(t){return t.endsWith("capture")&&"gotpointercapture"!==t&&"lostpointercapture"!==t}const Ms=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function Fs(t){return Ms.includes(t)}const Cs={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 Os(t){var e;return t=t.toLowerCase(),null!==(e=Cs[t])&&void 0!==e?e:t}const Ps=["touchstart","touchmove"];function Rs(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 Ds(t,e){return zs(t,e)}function Ls(t,e){var n;co(),e.intro=null!==(n=e.intro)&&void 0!==n&&n;const i=e.target,r=hi,o=di;try{for(var s=ho(i);s&&(s.nodeType!==li||s.data!==fn);)s=fo(s);if(!s)throw vn;fi(!0),pi(s);const n=zs(t,{...e,anchor:s});return fi(!1),n}catch(n){if(n instanceof Error&&n.message.split("\n").some((t=>t.startsWith("https://svelte.dev/e/"))))throw n;return n!==vn&&console.warn("Failed to hydrate: ",n),!1===e.recover&&function(){throw new Error("https://svelte.dev/e/hydration_failed")}(),co(),go(i),fi(!1),Ds(t,e)}finally{fi(r),pi(o)}}const Bs=new Map;function zs(t,{target:e,anchor:n,props:i={},events:r,context:o,intro:s=!0}){co();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,Ps.includes(s));e.addEventListener(i,Ts,{passive:r});var o=Bs.get(i);void 0===o?(document.addEventListener(i,Ts,{passive:r}),Bs.set(i,1)):Bs.set(i,o+1)}}var s};l(_n(ys)),bs.add(l);var c=void 0,u=function(t){tr.ensure();const e=wo(Bn|Yn,t,!0);return(t={})=>new Promise((n=>{t.outro?Lo(e,(()=>{Ro(e),n(void 0)})):(Ro(e),n(void 0))}))}((()=>{var s=null!=n?n:e.appendChild(uo());return function(t,e,n){new Fr(t,e,n)}(s,{pending:()=>{}},(e=>{o&&(Ii({}),wi.c=o);if(r&&(i.$$events=r),hi&&Is(e,null),c=t(e,i)||{},hi&&(Xo.nodes.end=di,null===di||di.nodeType!==li||di.data!==mn))throw ui(),vn;o&&Ei()})),()=>{for(var t of a){e.removeEventListener(t,Ts);var i=Bs.get(t);0==--i?(document.removeEventListener(t,Ts),Bs.delete(t)):Bs.set(t,i)}var r;(bs.delete(l),s!==n)&&(null===(r=s.parentNode)||void 0===r||r.removeChild(s))}}));return Ws.set(c,u),c}let Ws=new WeakMap;class $s{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=Wi;if(this.#t.has(t)){var e=this.#t.get(t),n=this.#e.get(e);if(n)zo(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&&(Ro(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();$o(i,e),e.append(uo()),this.#n.set(t,{effect:i,fragment:e})}else Ro(i);this.#i.delete(t),this.#e.delete(t)};this.#r||!n?(this.#i.add(t),Lo(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)||(Ro(n.effect),this.#n.delete(t))};ensure(t,e){var n=Wi;!e||this.#e.has(t)||this.#n.has(t)||this.#e.set(t,Co((()=>e(this.anchor)))),this.#t.set(n,t),hi&&(this.anchor=di),this.#o()}}function Us(t,e,n=!1){hi&&mi();var i=new $s(t);function r(e,n){if(hi){if(e===(yi(t)===pn)){var r=gi();return pi(r),i.anchor=r,fi(!1),i.ensure(e,n),void fi(!0)}}i.ensure(e,n)}Mo((()=>{var t=!1;e(((e,n=!0)=>{t=!0,r(n,e)})),t||r(!1,null)}),n?Gn:0)}function js(t,e){return e}function qs(t,e=!0){for(var n=0;n<t.length;n++)Ro(t[n],e)}var Vs;function Hs(t,e,n,i,r,o=null){var s=t,a=new Map;if(!!(e&sn)){var l=t;s=hi?pi(ho(l)):l.appendChild(uo())}hi&&mi();var c,u=null,d=jr((()=>{var t=n();return xn(t)?t:null==t?[]:_n(t)})),h=!0;function f(){m.fallback=u,function(t,e,n,i,r){var o,s,a,l,c,u=!!(i&an),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&Jn))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&Jn){if(l.f^=Jn,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),Xs(t,p,l),Xs(t,l,b),Ks(l,b,n),m=[],v=[],f=(p=l).next;continue}Ks(l,null,n)}var k,x;if(l.f&qn)if(zo(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 T=m[0],I=m[m.length-1];for(w=0;w<m.length;w+=1)Ks(m[w],_,n);for(w=0;w<v.length;w+=1)o.delete(v[w]);Xs(t,T.prev,I.next),Xs(t,p,T),Xs(t,I,_),f=_,p=I,c-=1,m=[],v=[]}else o.delete(l),Ks(l,f,n),Xs(t,l.prev,l.next),Xs(t,l,null===p?t.effect.first:p.next),Xs(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&Jn||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)qs(_n(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 A=[];if(void 0!==o)for(l of o)l.f&qn||A.push(l);for(;null!==f;)f.f&qn||f===t.fallback||A.push(f),f=f.next;var N=A.length;if(N>0){var M=i&sn&&0===d?n:null;if(u){for(c=0;c<N;c+=1){var F;null===(F=A[c].nodes)||void 0===F||null===(F=F.a)||void 0===F||F.measure()}for(c=0;c<N;c+=1){var C;null===(C=A[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];Lo(n,(()=>{if(i){if(i.pending.delete(n),i.done.add(n),0===i.pending.size){var e=t.outrogroups;qs(_n(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;go(c),c.append(l),t.items.clear()}qs(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,A,M)}}u&&Mi((()=>{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&Jn?(u.f^=Jn,Ks(u,null,s)):zo(u):Lo(u,(()=>{u=null})))}var p=Mo((()=>{var t=(c=ps(d)).length;let l=!1;hi&&(yi(s)===pn!==(0===t)&&(pi(s=gi()),fi(!1),l=!0));for(var p=new Set,m=0;m<t;m+=1){hi&&di.nodeType===li&&di.data===mn&&(s=di,l=!0,fi(!1));var v,g=c[m],y=i(g,m),b=h?null:a.get(y);if(b)b.v&&to(b.v,g),b.i&&to(b.i,m);else b=Gs(a,h?s:null!==(v=Vs)&&void 0!==v?v:Vs=uo(),g,y,m,r,e,n),h||(b.e.f|=Jn),a.set(y,b);p.add(y)}0===t&&o&&!u&&(h?u=Co((()=>o(s))):(u=Co((()=>{var t;return o(null!==(t=Vs)&&void 0!==t?t:Vs=uo())}))).f|=Jn),hi&&t>0&&pi(gi()),h||f(),l&&fi(!0),ps(d)})),m={effect:p,items:a,outrogroups:null,fallback:u};h=!1,hi&&(s=di)}function Gs(t,e,n,i,r,o,s,a){var l=s&rn?s&ln?Yr(n):Jr(n,!1,!1):null,c=s&on?Yr(r):null;return{v:l,i:c,e:Co((()=>(o(e,null!=l?l:n,null!=c?c:r,a),()=>{t.delete(i)})))}}function Ks(t,e,n){if(t.nodes)for(var i=t.nodes.start,r=t.nodes.end,o=!e||e.f&Jn?n:e.nodes.start;null!==i;){var s=fo(i);if(o.before(i),i===r)return;i=s}}function Xs(t,e,n){null===e?t.effect.first=n:e.next=n,null===n?t.effect.last=e:n.prev=e}function Ys(t,e){So((()=>{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 Qs(t,e){var n,i=void 0;Fo((()=>{i!==(i=e())&&(n&&(Ro(n),n=null),i&&(n=Co((()=>{So((()=>i(t)))}))))}))}function Js(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=Js(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function Zs(t){return"object"==typeof t?function(){for(var t,e,n=0,i="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=Js(t))&&(i&&(i+=" "),i+=e);return i}(t):null!=t?t:""}const ta=[..." \t\n\r\f \v\ufeff"];function ea(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 na(t){return"-"!==t[0]||"-"!==t[1]?t.toLowerCase():t}function ia(t,e,n,i,r,o){var s=t.__className;if(hi||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&&!ta.includes(i[s-1])||a!==i.length&&!ta.includes(i[a])?s=a:i=(0===s?"":i.substring(0,s))+i.substring(a+1)}return""===i?null:i}(n,i,o);hi&&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 ra(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 oa(t,e,n,i){var r=t.__style;if(hi||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(na)),i&&l.push(...Object.keys(i).map(na));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=na(t.substring(c,u).trim());l.includes(f)||(";"!==h&&d++,r+=" "+t.substring(c,d).trim()+";")}c=d+1,u=-1}}}return n&&(r+=ea(n)),i&&(r+=ea(i,!0)),""===(r=r.trim())?null:r}return null==t?null:String(t)}(e,i);hi&&o===t.getAttribute("style")||(null==o?t.removeAttribute("style"):t.style.cssText=o),t.__style=e}else i&&(Array.isArray(i)?(ra(t,null==n?void 0:n[0],i[0]),ra(t,null==n?void 0:n[1],i[1],"important")):ra(t,n,i));return i}function sa(t,e,n=!1){if(t.multiple){if(null==e)return;if(!xn(e))return void console.warn("https://svelte.dev/e/select_multiple_invalid_value");for(var i of t.options)i.selected=e.includes(aa(i))}else{for(i of t.options){var r=aa(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 aa(t){return"__value"in t?t.__value:t.value}const la=Symbol("class"),ca=Symbol("style"),ua=Symbol("is custom element"),da=Symbol("is html");function ha(t){if(hi){var e=!1,n=()=>{if(!e){if(e=!0,t.hasAttribute("value")){var n=t.value;pa(t,"value",null),t.value=n}if(t.hasAttribute("checked")){var i=t.checked;pa(t,"checked",null),t.checked=i}}};t.__on_r=n,Mi(n),bo||(bo=!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 fa(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function pa(t,e,n,i){var r=va(t);hi&&(r[e]=t.getAttribute(e),"src"===e||"srcset"===e||"href"===e&&"LINK"===t.nodeName)||r[e]!==(r[e]=n)&&("loading"===e&&(t[oi]=n),null==n?t.removeAttribute(e):"string"!=typeof n&&ya(t).includes(e)?t[e]=n:t.setAttribute(e,n))}function ma(t,e,n=[],i=[],r=[],o,s=!1,a=!1){Br(r,n,i,(n=>{var i=void 0,r={},l="SELECT"===t.nodeName,c=!1;if(Fo((()=>{var u=e(...n.map(ps)),d=function(t,e,n,i,r=!1){if(hi&&r&&"INPUT"===t.tagName){var o=t;("checkbox"===o.type?"defaultChecked":"defaultValue")in n||ha(o)}var s=va(t),a=s[ua],l=!s[da];let c=hi&&a;c&&fi(!1);var u,d=e||{},h="OPTION"===t.tagName;for(var f in e)f in n||(n[f]=null);n.class?n.class=Zs(n.class):n.class=null,n[ca]&&(null!==(u=n.style)&&void 0!==u||(n.style=null));var p=ya(t);for(const r in n){let o=n[r];if(h&&"value"===r&&null==o)t.value=t.__value="",d[r]=o;else if("class"!==r)if("style"!==r){var m=d[r];if(o!==m||void 0===o&&t.hasAttribute(r)){d[r]=o;var v=r[0]+r[1];if("$$"!==v)if("on"===v){const e={},n="$$"+r;let i=r.slice(2);var g=Fs(i);if(Ns(i)&&(i=i.slice(0,-7),e.capture=!0),!g&&m){if(null!=o)continue;t.removeEventListener(i,d[n],e),d[n]=null}if(null!=o)if(g)t[`__${i}`]=o,ws([i]);else{let o=function(t){d[r].call(this,t)};d[n]=ks(i,t,o,e)}else g&&(t[`__${i}`]=void 0)}else if("style"===r)pa(t,r,o);else if("autofocus"===r)yo(t,Boolean(o));else if(a||"__value"!==r&&("value"!==r||null==o))if("selected"===r&&h)fa(t,o);else{var y=r;l||(y=Os(y));var b="defaultValue"===y||"defaultChecked"===y;if(null!=o||a||b)b||p.includes(y)&&(a||"string"!=typeof o)?(t[y]=o,y in s&&(s[y]=gn)):"function"!=typeof o&&pa(t,y,o);else if(s[r]=null,"value"===y||"checked"===y){let n=t;const i=void 0===e;if("value"===y){let t=n.defaultValue;n.removeAttribute(y),n.defaultValue=t,n.value=n.__value=i?t:null}else{let t=n.defaultChecked;n.removeAttribute(y),n.defaultChecked=t,n.checked=!!i&&t}}else t.removeAttribute(r)}else t.value=t.__value=o}}else oa(t,o,null==e?void 0:e[ca],n[ca]),d[r]=o,d[ca]=n[ca];else ia(t,"http://www.w3.org/1999/xhtml"===t.namespaceURI,o,i,null==e?void 0:e[la],n[la]),d[r]=o,d[la]=n[la]}return c&&fi(!0),d}(t,i,u,o,s,a);c&&l&&"value"in u&&sa(t,u.value);for(let t of Object.getOwnPropertySymbols(r))u[t]||Ro(r[t]);for(let e of Object.getOwnPropertySymbols(u)){var h=u[e];e.description!==bn||i&&h===i[e]||(r[e]&&Ro(r[e]),r[e]=Co((()=>Qs(t,(()=>h))))),d[e]=h}i=d})),l){var u=t;So((()=>{sa(u,i.value,!0),function(t){var e=new MutationObserver((()=>{sa(t,t.__value)}));e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),To((()=>{e.disconnect()}))}(u)}))}c=!0}))}function va(t){var e;return null!==(e=t.__attributes)&&void 0!==e?e:t.__attributes={[ua]:t.nodeName.includes("-"),[da]:t.namespaceURI===yn}}var ga=new Map;function ya(t){var e,n=t.getAttribute("is")||t.nodeName,i=ga.get(n);if(i)return i;ga.set(n,i=[]);for(var r=t,o=Element.prototype;o!==r;){for(var s in e=En(r))e[s].set&&i.push(s);r=Nn(r)}return i}function ba(t,e){return t===e||(null==t?void 0:t[ii])===e}function ka(t={},e,n,i){return So((()=>{var i,r;return Ao((()=>{i=r,r=[],gs((()=>{t!==n(...r)&&(e(t,...r),i&&ba(n(...i),t)&&e(null,...i))}))})),()=>{Mi((()=>{r&&ba(n(...r),t)&&e(null,...r)}))}})),t}let xa=!1;function wa(t,e,n,i){var r,o,s=!!(n&dn),a=!!(n&hn),l=i,c=!0,u=()=>(c&&(c=!1,l=a?gs(i):i),l);if(s){var d,h,f=ii in t||ri in t;r=null!==(d=null===(h=In(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=xa;try{return xa=!1,[t(),xa]}finally{xa=e}}((()=>t[e])):o=t[e],void 0===o&&void 0!==i&&(o=u(),r&&(!function(){throw new Error("https://svelte.dev/e/props_invalid_value")}(),r(o))),p=()=>{var n=t[e];return void 0===n?u():(c=!0,n)},!(n&un))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&cn?Wr:jr)((()=>(g=!1,p())));s&&ps(y);var b=Xo;return function(t,e){if(arguments.length>0){const n=e?ps(y):s?io(t):t;return Zr(y,n),g=!0,void 0!==l&&(l=n),t}return qo&&g||b.f&Vn?y.v:ps(y)}}var _a,Ta,Ia,Ea;"undefined"!=typeof window&&(null!==(Ta=(_a=null!==(Ea=(Ia=window).__svelte)&&void 0!==Ea?Ea:Ia.__svelte={}).v)&&void 0!==Ta?Ta:_a.v=new Set).add("5");function Sa(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 Aa(t,e){t.getNodesAtTime(0)[0].once("nodestart",e)}class Na{constructor({position:t,galleryState:e,config:n}){this.config=n,this.position=t,this.galleryState=e,this.name=n.name;const{variantId:i,itemIndex:r,moduleIndex:o}=t;this.id=`${n.itemType}_${i}_${r}_${o}`,Sa(this)}#a=Qr(io({}));#l=Qr(null);#c=Qr(!1);#u=Qr(null);id;player;position;config;timeline;moduleEndListener;hasDuration=!1;coverAssets=[];get state(){return ps(this.#a)}set state(t){Zr(this.#a,t,!0)}get cover(){return ps(this.#l)}set cover(t){Zr(this.#l,t)}get showCover(){return ps(this.#c)}set showCover(t){Zr(this.#c,t,!0)}get Component(){return ps(this.#u)}set Component(t){Zr(this.#u,t)}emitModuleEnd(){var t;null===(t=this.moduleEndListener)||void 0===t||t.call(this)}start(t){this.player=t}setPosition(){this.galleryState.playingModulePosition=this.position}play(){Aa(this.timeline,(()=>{this.setPosition()})),this.player.switchTimeline(this.timeline)}get duration(){return this.hasDuration?this.timeline.placements.reduce(((t,e)=>t+this.player.getNode(e.nodeId).duration),0):0}}function Ma(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;return n.addNode({id:t,manifestRef:{type:"assets-delivery-service",assetId:s,assetRevision:a,availableEncodeProfiles:e.availableEncodeProfiles}})}var Fa=Es('<h3 class="text-box-title svelte-17x2i38"> </h3>'),Ca=Es('<span class="text-box-title svelte-17x2i38"> </span>'),Oa=Es('<span class="text-box-description minimized-description svelte-17x2i38"> </span>'),Pa=Es('<span class="read-more-cta svelte-17x2i38" aria-hidden="true">Read more</span>'),Ra=Es('<button class="expand-description-button svelte-17x2i38" aria-expanded="false" aria-controls="expanded-text-content" aria-label="Expand feature description"><!> <!></button>'),Da=Es('<button aria-expanded="true" aria-label="Collapse feature description" class="svelte-17x2i38">Read less</button>'),La=Es('<section aria-label="Feature description" aria-live="polite"><div class="text-wrapper svelte-17x2i38"><div class="expanded-text-content svelte-17x2i38"><!> <p class="text-box-description svelte-17x2i38"> </p></div> <!></div> <!></section>');const Ba={hash:"svelte-17x2i38",code:".step-description-container.svelte-17x2i38 {width:100%;position:absolute;bottom:0;display:flex;justify-content:space-between;gap:8px;box-sizing:border-box;font-size:12px;font-weight:400;font-style:normal;line-height:16px;letter-spacing:0px;overflow:hidden;pointer-events:none;background: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 );&.expanded {flex-direction:column;justify-content:flex-start;}&:not(.expanded) {button:where(.svelte-17x2i38) {line-height:16px;}}}.expanded-text-content.svelte-17x2i38:not([hidden]) {display:flex;flex-direction:column;gap:8px;}button.svelte-17x2i38 {background:none;border:none;padding:0;cursor:pointer;line-height:18px;gap:8px;letter-spacing:0%;color:#014FD3;font-size:12px;font-weight:500;flex-shrink:0;text-align:left;font-family:inherit;pointer-events:auto;}h3.svelte-17x2i38, p.svelte-17x2i38, span.svelte-17x2i38 {color:#030303;}.text-wrapper.svelte-17x2i38 {width:100%;}.text-box-title.svelte-17x2i38 {margin:0;font-weight:500;font-size:12px;}.text-box-description.svelte-17x2i38 {margin:0;text-align:left;font-weight:400;}.minimized-description.svelte-17x2i38 {overflow:hidden;line-clamp:1;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;font-weight:400;}.expand-description-button.svelte-17x2i38 {width:100%;display:flex;justify-content:space-between;gap:6px;flex-wrap:nowrap;.read-more-cta:where(.svelte-17x2i38) {color:#014FD3;flex-shrink:0;}}"};function za(t,e){const n=Ur((()=>e.state.textBox));!function(t,e){Ii(e,!0),Ys(t,Ba);let n=wa(e,"textBox",3,null),i=wa(e,"isMobile",3,!1),r=Qr(!1),o=Qr(null),s=Qr(!1),a=Ur((()=>{var t;return(null===(t=n())||void 0===t?void 0:t.title)||""})),l=Ur((()=>{var t;return(null===(t=n())||void 0===t?void 0:t.description)||""})),c=Ur((()=>i()?16:18)),u=Ur((()=>i()?12:16));function d(){ps(o)&&Zr(s,ps(o).scrollWidth>ps(o).clientWidth||ps(o).scrollHeight>ps(o).clientHeight,!0)}Io((()=>{ps(o)&&d()}));var h=Ss();xs("resize",oo,d);var f=mo(h),p=t=>{var e=La(),n=po(e),d=po(n),h=po(d),f=t=>{var e=Fa(),n=po(e,!0);vi(e),No((()=>Rs(n,ps(a)))),As(t,e)};Us(h,(t=>{i()&&t(f)}));var p=vo(h,2),m=po(p,!0);vi(p),vi(d);var v=vo(d,2),g=t=>{var e=Ra();e.__click=()=>Zr(r,!0);var n=po(e),u=t=>{var e=Ca(),n=po(e,!0);vi(e),No((()=>Rs(n,ps(a)))),As(t,e)},d=t=>{var e=Oa(),n=po(e,!0);vi(e),ka(e,(t=>Zr(o,t)),(()=>ps(o))),No((()=>Rs(n,ps(l)))),As(t,e)};Us(n,(t=>{i()&&ps(a)?t(u):t(d,!1)}));var h=vo(n,2),f=t=>{As(t,Pa())};Us(h,(t=>{(i()||!i()&&ps(s))&&t(f)})),vi(e),No((()=>oa(e,`line-height: ${ps(c)}px;`))),As(t,e)};Us(v,(t=>{ps(r)||t(g)})),vi(n);var y=vo(n,2),b=t=>{var e=Da();e.__click=()=>Zr(r,!1),No((()=>oa(e,`margin-bottom: ${!i()&&ps(r)?"8px":"0px"};\n line-height: ${ps(u)}px;`))),As(t,e)};Us(y,(t=>{ps(r)&&t(b)})),vi(e),No((()=>{ia(e,1,"step-description-container "+(ps(r)?"expanded":""),"svelte-17x2i38"),oa(e,`padding: ${i()?"8px 16px":"16px 16px 56px 16px"};`),oa(d,`line-height: ${ps(c)}px;`),pa(d,"hidden",!ps(r)),Rs(m,ps(l))})),As(t,e)};Us(f,(t=>{(ps(a)||ps(l))&&t(p)})),As(t,h),Ei()}(t,{get textBox(){return ps(n)},get isMobile(){return e.isMobile}})}ws(["click"]);var Wa=Es('<div class="toggle-option-container svelte-16pmvvn"><button> </button></div>'),$a=Es('<div class="toggle-container svelte-16pmvvn"><div></div></div>');const Ua={hash:"svelte-16pmvvn",code:".eko-gallery-app {--toggleModule_gap: 8px;--toggleModule_padding: 10px 58px 0 0;--toggleModule_options_padding: 0;--toggleModule_options_height: auto;--toggleModule_options_width: 100%;--toggleModule_options_gap: 8px;--toggleModule_button_backgroundColor: #FFFFFF;--toggleModule_button_padding: 8px 12px;--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_border_radius: 100px;--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:center;gap:var(--toggleModule_gap);pointer-events:auto;box-sizing:border-box;}.toggle-options.svelte-16pmvvn {width:var(--toggleModule_options_width);height:var(--toggleModule_options_height);padding:var(--toggleModule_options_padding);gap:var(--toggleModule_options_gap);display:flex;justify-content:end;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:#E4E5E8 solid 1px;background:#FBFBFB;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;border-radius:var(--toggleModule_button_border_radius);}.toggle-option-button.selected.svelte-16pmvvn {box-shadow:none;color:#FFFFFF;background:#014FD3;border-color:#014FD3;}.toggle-option-button.svelte-16pmvvn:hover:not(.selected) {background:#F3F4F6;}.toggle-option-button.svelte-16pmvvn:active:not(.selected) {background:#E4E5E8;}.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 ja(t,e){Ys(t,Ua);const n=Ur((()=>e.state.options)),i=Ur((()=>e.state.currentOptionIndex)),r=Ur((()=>e.state.onOptionClicked));var o=$a(),s=po(o);Hs(s,21,(()=>ps(n)),js,((t,e,n)=>{var o=Wa();oa(o,`--button-index: ${n};`);var s=po(o);let a;s.__click=()=>ps(r)(n);var l=po(s,!0);vi(s),vi(o),No((()=>{a=ia(s,1,"toggle-option-button svelte-16pmvvn",null,a,{selected:ps(i)===n}),Rs(l,ps(e).label)})),As(t,o)})),vi(s),vi(o),No((()=>{var t;return ia(s,1,`toggle-options selected-${null!==(t=ps(i))&&void 0!==t?t:""}`,"svelte-16pmvvn")})),As(t,o)}ws(["click"]);var qa=new WeakSet;function Va(t){var e,n;t!==this.state.currentOptionIndex&&(this.state.currentOptionIndex=t,this.cover=this.coverAssets[t],this.synced?this.switchTo(t):(this.timeline=null===(e=this.timelines)||void 0===e?void 0:e[t],this.showCover=!0,Aa(this.timeline,(()=>{this.showCover=!1})),null===(n=this.player)||void 0===n||n.switchTimeline(this.timeline)))}const Ha=(t,e,n)=>n>e?e:n<t?t:n;function Ga(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let Ka=()=>{},Xa=()=>{};function Ya(t){let e;return()=>(void 0===e&&(e=t()),e)}"undefined"!=typeof process&&"production"!==(null===(re=process.env)||void 0===re?void 0:re.NODE_ENV)&&(Ka=(t,e,n)=>{t||"undefined"==typeof console||console.warn(Ga(e,n))},Xa=(t,e,n)=>{if(!t)throw new Error(Ga(e,n))});const Qa=t=>t,Ja=t=>1e3*t,Za=t=>t/1e3;const tl=t=>Array.isArray(t)&&"number"==typeof t[0],el=(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)})`},nl=2e4;function il(t){let e=0;let n=t.next(e);for(;!n.done&&e<nl;)e+=50,n=t.next(e);return e>=nl?1/0:e}const rl=5;const ol={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},sl=.001;function al({duration:t=ol.duration,bounce:e=ol.bounce,velocity:n=ol.velocity,mass:i=ol.mass}){let r,o;Ka(t<=Ja(ol.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let s=1-e;s=Ha(ol.minDamping,ol.maxDamping,s),t=Ha(ol.minDuration,ol.maxDuration,Za(t)),s<1?(r=e=>{const i=e*s,r=i*t,o=i-n,a=cl(e,s),l=Math.exp(-r);return sl-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=cl(Math.pow(e,2),s);return(-r(e)+sl>0?-1:1)*((o-a)*l)/c}):(r=e=>Math.exp(-e*t)*((e-n)*t+1)-sl,o=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let i=n;for(let n=1;n<ll;n++)i-=t(i)/e(i);return i}(r,o,5/t);if(t=Ja(t),isNaN(a))return{stiffness:ol.stiffness,damping:ol.damping,duration:t};{const e=Math.pow(a,2)*i;return{stiffness:e,damping:2*s*Math.sqrt(i*e),duration:t}}}const ll=12;function cl(t,e){return t*Math.sqrt(1-e*e)}const ul=["duration","bounce"],dl=["stiffness","damping","mass"];function hl(t,e){return e.some((e=>void 0!==t[e]))}function fl(t=ol.visualDuration,e=ol.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:ol.velocity,stiffness:ol.stiffness,damping:ol.damping,mass:ol.mass,isResolvedFromDuration:!1,...t};if(!hl(t,dl)&&hl(t,ul))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(1.2*n),r=i*i,o=2*Ha(.05,1,1-(t.bounce||0))*Math.sqrt(r);e={...e,mass:ol.mass,stiffness:r,damping:o}}else{const n=al(t);e={...e,...n,mass:ol.mass},e.isResolvedFromDuration=!0}return e}({...n,velocity:-Za(n.velocity||0)}),p=h||0,m=c/(2*Math.sqrt(l*u)),v=s-o,g=Za(Math.sqrt(l/u)),y=Math.abs(v)<5;let b;if(i||(i=y?ol.restSpeed.granular:ol.restSpeed.default),r||(r=y?ol.restDelta.granular:ol.restDelta.default),m<1){const t=cl(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?Ja(p):function(t,e,n){const i=Math.max(e-rl,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(il(k),nl),e=el((e=>k.next(t*e).value),t,30);return t+"ms "+e},toTransition:()=>{}};return k}fl.applyToOptions=t=>{const e=function(t,e=100,n){const i=n({...t,keyframes:[0,e]}),r=Math.min(il(i),nl);return{type:"keyframes",ease:t=>i.next(r*t).value/e,duration:Za(r)}}(t,100,fl);return t.ease=e.ease,t.duration=Ja(e.duration),t.type="keyframes",t};const pl=t=>null!==t;class ml{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 vl(t){for(let n=1;n<t.length;n++){var e;null!==(e=t[n])&&void 0!==e||(t[n]=t[n-1])}}const gl=t=>t.startsWith("--");const yl=Ya((()=>void 0!==window.ScrollTimeline)),bl={};function kl(t,e){const n=Ya(t);return()=>{var t;return null!==(t=bl[e])&&void 0!==t?t:n()}}const xl=kl((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing"),wl=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,_l={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:wl([0,.65,.55,1]),circOut:wl([.55,0,1,.45]),backIn:wl([.31,.01,.66,-.59]),backOut:wl([.33,1.53,.69,.99])};function Tl(t,e){return t?"function"==typeof t?xl()?el(t,e):"ease-out":tl(t)?wl(t):Array.isArray(t)?t.map((t=>Tl(t,e)||_l.easeOut)):_l[t]:void 0}function Il(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=Tl(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 El extends ml{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,Xa("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)&&xl()?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=Il(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(pl),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){gl(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 Za(Number(n))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Za(t)}get time(){return Za(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Ja(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&&yl()?(this.animation.timeline=t,Qa):e(this)}}class Sl{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 Al(this.animations,"duration")}get iterationDuration(){return Al(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 Al(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 Nl extends Sl{then(t,e){return this.finished.finally(t).then((()=>{}))}}const Ml=new WeakMap,Fl=(t,e="")=>`${t}:${e}`;function Cl(t){const e=Ml.get(t)||new Map;return Ml.set(t,e),e}function Ol(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 Pl=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 Rl(t,e){for(let n=0;n<t.length;n++)"number"==typeof t[n]&&Pl.has(e)&&(t[n]=t[n]+"px")}function Dl(t,e){const n=window.getComputedStyle(t);return gl(e)?n.getPropertyValue(e):n[e]}function Ll(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;Xa(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={...Ol(a,t)};r.duration&&(r.duration=Ja(r.duration)),r.delay&&(r.delay=Ja(r.delay));const o=Cl(i),l=Fl(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]=Dl(i,r)),vl(e),Rl(e,r),!o&&e.length<2&&e.unshift(Dl(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 El(i);e.set(n,r),r.finished.finally((()=>e.delete(n))),a.push(r)}return a}const Bl=(()=>function(t,e,n){return new Nl(Ll(t,e,n))})();var zl=Es('<button class="svelte-16kucsb"><div class="svelte-16kucsb"> </div></button>'),Wl=Es('<div class="tryIt-container svelte-16kucsb"><!></div>');const $l={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) {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;overflow:hidden;}.tryIt-container.svelte-16kucsb button:where(.svelte-16kucsb) div:where(.svelte-16kucsb) {opacity:0;}"};function Ul(t,e){Ii(e,!0),Ys(t,$l);const n=Ur((()=>e.state.ctaText)),i=Ur((()=>e.state.animationConfig)),r=Ur((()=>e.state.showCta)),o=Ur((()=>e.state.onCtaClick));let s=null,a=null,l=Qr(!1),c=!1;function u(){c&&Bl(s,{transform:"scale(1.05)"},{type:fl,mass:1.5,stiffness:400,damping:30})}function d(){c&&Bl(s,{transform:"scale(1)"},{type:fl,mass:1.5,stiffness:400,damping:30})}function h(){c&&Bl(s,{transform:"scale(0.95)"},{type:fl,mass:1,stiffness:600,damping:30})}Io((()=>{const{mass:t,stiffness:e,damping:n,delay:o}=ps(i);let u;return ps(r)&&(u=setTimeout((async()=>{Zr(l,!0),u=null,Bl(s,{transform:["translateY(40px) scale(0, 0.2)","translateY(0) scale(1, 1)"],opacity:1},{type:fl,mass:t,stiffness:e,damping:n}),await Bl(a,{transform:["translateY(20px) scale(0.8)","translateY(0) scale(1)"],opacity:1},{type:fl,mass:t,stiffness:e,damping:n,delay:.15}),c=!0}),o)),()=>{u&&clearTimeout(u)}}));var f=Wl(),p=po(f),m=t=>{var e=zl();e.__mousedown=h,e.__touchstart=h,e.__click=function(...t){var e;null===(e=ps(o))||void 0===e||e.apply(this,t)};var i=po(e),r=po(i,!0);vi(i),ka(i,(t=>a=t),(()=>a)),vi(e),ka(e,(t=>s=t),(()=>s)),No((()=>{oa(e,"pointer-events: "+(ps(l)?"auto":"none")),Rs(r,ps(n))})),xs("mouseenter",e,u),xs("mouseleave",e,d),As(t,e)};Us(p,(t=>{ps(r)&&t(m)})),vi(f),As(t,f),Ei()}ws(["mousedown","touchstart","click"]);var jl=new WeakSet;function ql(){this.mainTimeline?this.player.switchTimeline(this.mainTimeline):this.emitModuleEnd(),this.state.showCta=!1}const Vl={videoModule:class extends Na{constructor({config:t,...e}){var n;super({...e,config:t}),this.Component=za,this.hasDuration=!t.loop,Sa(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(Ma(`${this.id}_intro`,e.intro,t),"end");const n=Ma(this.id,e.video,t);this.timeline.placeOnTimeline(n,"end",{loop:e.loop}),e.loop||n.on("nodeend",this.emitModuleEnd)}},toggleModule:class extends Na{constructor({config:t,...e}){super({...e,config:t}),O(this,qa),this.Component=ja,this.synced=t.sync,this.switchTo=()=>{},Sa(this),this.coverAssets=t.options.map((t=>{var e;return null!==(e=t.intro)&&void 0!==e?e:t.video})),this.cover=this.coverAssets[0],this.state={options:t.options.map((t=>({label:t.label,note:t.note}))),currentOptionIndex:0,onOptionClicked:A(qa,this,Va).bind(this)}}start(t){super.start(t),this.synced?(this.timeline=t.createTimeline(),this.config.options.forEach(((e,n)=>{this.timeline.placeOnTimeline(Ma(`${this.id}_option_${n}`,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.currentOptionIndex,{crossfadeSeconds:0})}}})):(this.timelines=this.config.options.map(((e,n)=>{const i=t.createTimeline();return e.intro&&i.placeOnTimeline(Ma(`${this.id}_option_${n}_intro`,e.intro,t),"end"),i.placeOnTimeline(Ma(`${this.id}_option_${n}`,e.video,t),"end",{loop:!0}),i})),this.timeline=this.timelines[this.state.currentOptionIndex])}},tryItModule:class extends Na{constructor({config:t,...e}){var n;super({...e,config:t}),O(this,jl),Sa(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:A(jl,this,ql).bind(this)}}start(t){super.start(t),this.Component=Ul,this.timeline=t.createTimeline();const{introVideo:e,mainVideo:n}=this.config;if(e.intro&&this.timeline.placeOnTimeline(Ma(`${this.id}_intro_intro`,e.intro,t)),this.timeline.placeOnTimeline(Ma(`${this.id}_intro_loop`,e.loop,t),"end",{loop:!0}),n){this.mainTimeline=t.createTimeline(),n.intro&&this.mainTimeline.placeOnTimeline(Ma(`${this.id}_main_intro`,n.intro,t));const e=Ma(`${this.id}_main_loop`,n.loop,t);this.mainTimeline.placeOnTimeline(e,"end",{loop:!0})}}play(){this.state.showCta=!0,super.play()}}};class Hl{#d=Qr({});#h=Qr("ekonovar");#f=Qr(0);#p=Qr(0);#m=Qr(io({itemIndex:0,moduleIndex:0}));#v=Ur((()=>{var t;return null===(t=ps(this.#d))||void 0===t?void 0:t[ps(this.#h)]}));#g=Ur((()=>{var t;return null===(t=ps(this.#v))||void 0===t?void 0:t[ps(this.#f)]}));#y=Ur((()=>{var t,e;return ps(this.#b)?null===(e=ps(this.#v))||void 0===e?void 0:e[ps(this.#m).itemIndex].modules[ps(this.#m).moduleIndex]:null===(t=ps(this.#g))||void 0===t?void 0:t.modules[ps(this.#p)]}));#k=Ur((()=>{var t;return(null===(t=ps(this.#v))||void 0===t?void 0:t.flatMap((t=>t.modules)))||[]}));#x=Qr(!1);#w=Qr(!1);#b=Qr(!1);#_=Ur((()=>!(ps(this.#m).itemIndex===this.activeItemIndex&&ps(this.#m).moduleIndex===this.activeModuleIndex)));set variants(t){Zr(this.#d,t)}set activeVariant(t){Zr(this.#h,t,!0)}set activeItemIndex(t){Zr(this.#f,t,!0)}set activeModuleIndex(t){Zr(this.#p,t,!0)}set playingModulePosition(t){Zr(this.#m,t,!0)}set playerLoaded(t){Zr(this.#x,t,!0)}set paused(t){Zr(this.#w,t,!0)}set startedPlaying(t){Zr(this.#b,t,!0)}get variants(){return ps(this.#d)}get activeVariant(){return ps(this.#h)}get activeItemIndex(){return ps(this.#f)}get activeModuleIndex(){return ps(this.#p)}get playingModulePosition(){return ps(this.#m)}get currentItemsList(){return ps(this.#v)}get currentItem(){return ps(this.#g)}get currentModule(){return ps(this.#y)}get playerLoaded(){return ps(this.#x)}get paused(){return ps(this.#w)}get startedPlaying(){return ps(this.#b)}get seeking(){return ps(this.#_)}get currentModulesList(){return ps(this.#k)}}const Gl={assetsDeliveryBase:"https://{{env}}assets.eko.com"},Kl=2,Xl=5,Yl=["activeItemIndex","activeModuleIndex","paused","startedPlaying"],Ql=["version","selectItem","selectItemAndStep","next","prev","subscribe"];var Jl=new WeakMap,Zl=new WeakMap,tc=new WeakMap,ec=new WeakMap,nc=new WeakSet;class ic{constructor(t){var e,n,i;O(this,nc),F(this,Jl,void 0),F(this,Zl,void 0),F(this,tc,void 0),F(this,ec,void 0),P(this,"public",void 0),P(this,"version","0.0.7"),Sa(this),C(tc,this,t),C(Jl,this,new Hl(null==t||null===(e=t.options)||void 0===e?void 0:e.galleryEnv)),C(ec,this,((t="")=>("production"===t&&(t=""),Object.fromEntries(Object.entries(Gl).map((([e,n])=>[e,n.replaceAll("{{env}}",t)])))))(null==t||null===(n=t.options)||void 0===n?void 0:n.galleryEnv)),C(Zl,this,[]);const r=null==t||null===(i=t.instance)||void 0===i||null===(i=i.data)||void 0===i||null===(i=i.blocks)||void 0===i||null===(i=i.blocksArr)||void 0===i||null===(i=i.find((t=>"GalleryBlock"===t.blockType)))||void 0===i?void 0:i.config;var o;r?(A(nc,this,rc).call(this,r.items),A(nc,this,oc).call(this,r.items)):console.warn("[eko-gallery-app] Gallery initiated without an instance, results will be empty"),this.public=(o=this,Ql.reduce(((t,e)=>{if(!(e in o))throw new Error(`[eko-gallery-app] Public API member "${e}" does not exist on GalleryLogic`);const n=o[e];return t[e]="function"==typeof n?n.bind(o):n,t}),{}))}start(t){M(Jl,this).playerLoaded=!0,M(Zl,this).forEach((e=>{e.start(t)})),C(Zl,this,null),A(nc,this,sc).call(this,t),M(Jl,this).currentModule.play()}selectItem(t){const e=M(Jl,this);t!==e.activeItemIndex&&(e.activeItemIndex=t,e.activeModuleIndex=0)}selectItemAndStep(t,e){const n=M(Jl,this);t===n.activeItemIndex&&e===n.activeModuleIndex||(n.activeItemIndex=t,n.activeModuleIndex=e)}next(){A(nc,this,lc).call(this)}prev(){const t=M(Jl,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}subscribe(t){const e=M(Jl,this);return function(t){tr.ensure();const e=wo(Bn|Yn,t,!0);return()=>{Ro(e)}}((()=>{Io((()=>{const n=Yl.reduce(((t,n)=>(t[n]=e[n],t)),{});t(n)}))}))}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=M(tc,this))&&void 0!==o&&null!==(o=o.coverAssetsMap)&&void 0!==o&&o[s]?(l=new URL(M(tc,this).coverAssetsMap[s]),/^[a-z0-9]*assets.eko.com$/.test(l.host)&&e&&(l.pathname=l.pathname.replace(".png",".webp"))):(l=new URL(`${M(ec,this).assetsDeliveryBase}/image/${s}/${a}?startOffset=0`),l.pathname+=e?".webp":".png"),e&&l.searchParams.set("width",e),l.href}get currentConfig(){return M(tc,this)}get state(){return M(Jl,this)}get urls(){return M(ec,this)}}function rc(t){const e={};for(let n of t)for(let t of Object.keys(n.variants||{}))e[t]=[];e.ekonovar=[],M(Jl,this).variants=e}function oc(t){const e=(t=[],e)=>{const n=[];for(let[i,r]of t.entries()){if(!Vl[r.itemType])throw new Error(`Unknown module type ${r.itemType}`);const t=new Vl[r.itemType]({position:{...e,moduleIndex:i},config:r,galleryState:M(Jl,this)});t.moduleEndListener=A(nc,this,ac).bind(this),n.push(t)}return n};for(const[i,r]of t.entries())if("galleryItemV2"===r.itemType){const{modules:t,...o}=r;for(const[s,a]of Object.entries(M(Jl,this).variants)){var n;if(null===(n=r.variants)||void 0===n?void 0:n[s])console.log("NO IMPLEMENTED");else{const n={...o};n.modules=e(t,{variantId:s,itemIndex:i}),C(Zl,this,[...M(Zl,this),...n.modules]),a.push(n)}}}}function sc(t){for(const[,e]of Object.entries(M(Jl,this).variants))for(const[n,i]of e.entries()){const r=i.modules,o=e.filter((t=>t!==i)).map((t=>t.modules[0]));for(const[i,s]of r.entries()){let a=r[i+1];a||(a=e[(n+1)%e.length].modules[0]);const l=a.timeline.getNodesAtTime(0)[0],c=o.filter((t=>t!==a)).map((t=>t.timeline.getNodesAtTime(0)[0])),u=[{nodeId:l.id,weight:Kl},...c.map((t=>({nodeId:t.id,weight:Xl})))];for(const e of s.timeline.placements){t.getNode(e.nodeId).setChildren(u)}}}}function ac(){const t=M(Jl,this),e=t.currentItem.modules;e.length>1&&t.activeModuleIndex===e.length-1?t.activeModuleIndex=0:A(nc,this,lc).call(this)}function lc(){const t=M(Jl,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)}var cc=Es('<button><span class="svelte-er27y2"> </span></button>'),uc=Es('<div class="nav-buttons-container svelte-er27y2"><div class="nav-buttons svelte-er27y2"></div></div>');const dc={hash:"svelte-er27y2",code:".eko-gallery-app {--nav_gap: 10px;--nav_padding: 12px 16px;--nav_bgColor: #FFFFFF;--nav_justifyContent: center;--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_arrow_color: var(--secondaryColor);--nav_arrow_bgColor: var(--primaryColor);--nav_arrow_padding: 9px;--nav_arrow_size: 28px;--nav_arrow_boxShadow: 0 0 8px 0 rgba(0, 0, 0, 0.3);}.nav-buttons-container.svelte-er27y2 {width:100%;background-color:var(--nav_bgColor);height:var(--buttonsContainerHeight);display:flex;box-sizing:border-box;text-align:center;justify-content:var(--nav_justifyContent);align-items:center;position:relative;flex-shrink:0;}.nav-buttons-container.svelte-er27y2 :where(.svelte-er27y2) {touch-action:auto;}.nav-buttons.svelte-er27y2 {display:flex;margin:0;gap:var(--nav_gap);height:100%;align-items:center;padding:var(--nav_padding);box-sizing:border-box;overflow-x:auto;scrollbar-width:none;max-width:100%;width:fit-content;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 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 span:where(.svelte-er27y2) {color:var(--nav_button_selected_text_color);font-weight:var(--nav_button_selected_text_fontWeight);}"};ws(["click"]);const hc="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 fc=Es('<button><img class="svelte-1al44kl"/></button>');const pc={hash:"svelte-1al44kl",code:'.nav-button.svelte-1al44kl {height:30px;width:30px;border-radius:100%;background-color:transparent;padding:9px;box-sizing:border-box;display:flex;align-items:center;justify-content:center;pointer-events:auto;border:0;opacity:100%;cursor:pointer;transition-property:background-color, box-shadow, opacity;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%;}'};function mc(t,e){Ys(t,pc);const n=wa(e,"hidden",3,!1);var i=fc();let r;i.__click=function(...t){var n;null===(n=e.onClick)||void 0===n||n.apply(this,t)};var o=po(i);vi(i),No((()=>{var t;r=ia(i,1,`nav-button ${null!==(t=e.type)&&void 0!==t?t:""}`,"svelte-1al44kl",r,{hidden:n()}),pa(i,"aria-label",e.type),pa(o,"src",hc),pa(o,"alt",e.type)})),As(t,i)}ws(["click"]);var vc=Es('<button><span class="svelte-1mxltt0"> </span></button>'),gc=Es('<div class="steps-indicator-container svelte-1mxltt0"><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 yc={hash:"svelte-1mxltt0",code:'.steps-indicator-container.svelte-1mxltt0 {width:calc(100% - 32px);position:absolute;bottom:12px;left:16px;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.svelte-1mxltt0 {--stepSize: 6px;--stepPadding: 7px;padding:4px 0px;display:flex;gap:8px;align-items:center;overflow-x:auto;pointer-events:all;scrollbar-width:none;}.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:8px 12px;border:#E4E5E8 solid 1px;background-color:#FBFBFB;cursor:pointer;pointer-events:all;flex-shrink:0;border-radius:100px;font-size:12px;font-weight:500;line-height:16px;color:#030303;transition:all 0.3s ease-in-out;outline-color:#3191fc;}.step-button.active.svelte-1mxltt0 {background-color:#014FD3;color:#FFFFFF;box-shadow:none;border-color:#014FD3;}.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:#F3F4F6;}.step-button.svelte-1mxltt0:active:not(.active) {background:#E4E5E8;}.step-button.svelte-1mxltt0:focus {outline-offset:4px;outline-width:2px;}.step-button.svelte-1mxltt0 span:where(.svelte-1mxltt0) {display:block;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-arrow.svelte-1mxltt0 {max-height:34px;position:absolute;padding-top:4px;padding-bottom:4px;z-index:10;bottom:4px;border:none;background-color:#FFF;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 {padding-right:8px;padding-left:0;left:0;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 {padding-right:0;padding-left:8px;right:0;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 bc(t,e){Ii(e,!0),Ys(t,yc);const n=16,i=32,r=Ti("state");let o=Qr(null),s=Qr(null),a=Qr(!1),l=Qr(!1);const c=Ur((()=>{let t=[];return t=r().currentItem.modules.map(((t,e)=>({index:e,type:e===r().activeModuleIndex?"active":"",name:t.name}))),t}));function u(){ps(o)&&(Zr(a,ps(o).scrollLeft>3),Zr(l,ps(o).scrollLeft+ps(o).clientWidth<ps(o).scrollWidth-3))}function d(t){ps(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(ps(o).querySelectorAll(".step-button")).find((t=>{const e=t.getBoundingClientRect(),n=ps(o).getBoundingClientRect();return e.left>n.left+i}));if(t){const e=t.previousElementSibling;e&&h(ps(o),e)}}function p(){const t=Array.from(ps(o).querySelectorAll(".step-button")).reverse().find((t=>{const e=t.getBoundingClientRect(),n=ps(o).getBoundingClientRect();return e.right<n.right-i}));if(t){const e=t.nextElementSibling;e&&h(ps(o),e)}}Io((()=>{if(ps(o)){u();const t=new MutationObserver((()=>{const t=ps(o).querySelector(".step-button.active");t&&Zr(s,t,!0)}));return t.observe(ps(o),{attributes:!0,attributeFilter:["class"],subtree:!0}),()=>{t.disconnect()}}})),Io((()=>{ps(s)&&ps(o)&&h(ps(o),ps(s))}));var m=Ss();xs("resize",oo,u),function(t,e,n){hi&&mi();var i=new $s(t);Mo((()=>{var t=e();i.ensure(t,n)}))}(mo(m),(()=>r().activeItemIndex),(t=>{var e=gc(),n=po(e);let i;n.__click=f;var s=vo(n,2);let d;Hs(s,21,(()=>ps(c)),js,((t,e)=>{var n=vc();let i;n.__click=t=>{return n=t.currentTarget,i=ps(e).index,r().activeModuleIndex=i,void h(ps(o),n);var n,i};var s=po(n),a=po(s,!0);vi(s),vi(n),No((()=>{i=ia(n,1,"step-button svelte-1mxltt0",null,i,{active:"active"===ps(e).type}),pa(n,"aria-label",`Go to step $${ps(e).index+1}`),Rs(a,ps(e).name)})),As(t,n)})),vi(s),ka(s,(t=>Zr(o,t)),(()=>ps(o)));var m=vo(s,2);let v;m.__click=p,vi(e),No(((t,e)=>{i=ia(n,1,"step-arrow step-arrow-prev svelte-1mxltt0",null,i,{visible:ps(a)}),d=ia(s,1,"steps-indicator svelte-1mxltt0",null,d,t),oa(s,`--stepDuration: ${null!=e?e:""}s`),v=ia(m,1,"step-arrow step-arrow-next svelte-1mxltt0",null,v,{visible:ps(l)})}),[()=>({"with-duration":r().currentModule.hasDuration,paused:r().paused}),()=>r().currentModule.duration]),xs("scroll",s,u),As(t,e)})),As(t,m),Ei()}ws(["click"]);const kc="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.01318%203.42005C3.01318%202.06672%204.50652%201.26672%205.66652%201.90672C6.82652%202.54672%2014.0732%206.48672%2014.0732%206.48672C15.2865%207.15339%2015.2865%208.86005%2014.0732%209.52005L5.66652%2014.1001C4.50652%2014.7334%203.01318%2013.9401%203.01318%2012.5801V3.42005ZM3.98652%2012.5801C3.98652%2013.1334%204.63318%2013.5467%205.19985%2013.2401L13.6065%208.66005C14.1399%208.36672%2014.1465%207.63339%2013.6065%207.34005C13.0665%207.04672%205.19985%202.76005%205.19985%202.76005C4.63985%202.44672%203.98652%202.86005%203.98652%203.42005V12.5801Z'%20fill='%23030303'/%3e%3c/svg%3e",xc="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M10.8332%2014C10.5598%2014%2010.3332%2013.7733%2010.3332%2013.5V2.5C10.3332%202.22667%2010.5598%202%2010.8332%202C11.1065%202%2011.3332%202.22667%2011.3332%202.5V13.5C11.3332%2013.7733%2011.1065%2014%2010.8332%2014ZM5.1665%2014C4.89317%2014%204.6665%2013.7733%204.6665%2013.5V2.5C4.6665%202.22667%204.89317%202%205.1665%202C5.43984%202%205.6665%202.22667%205.6665%202.5V13.5C5.6665%2013.7733%205.43984%2014%205.1665%2014Z'%20fill='%23030303'/%3e%3c/svg%3e";var wc=Es('<img alt="Play" class="svelte-a3r6re"/>'),_c=Es('<img alt="Pause" class="svelte-a3r6re"/>'),Tc=Es('<button class="pause-button svelte-a3r6re"><!></button>');const Ic={hash:"svelte-a3r6re",code:".pause-button.svelte-a3r6re {position:absolute;top:10px;right:10px;background:#FFFFFF;border-radius:100%;border:1px #C4C8CF solid;padding:0;width:32px;height:32px;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:#F6F6F7;}.pause-button.svelte-a3r6re:active {background:#E4E5E8;}.pause-button.svelte-a3r6re:focus {outline-offset:8px;outline-width:2px;}.pause-button.svelte-a3r6re img:where(.svelte-a3r6re) {width:16px;height:16px;pointer-events:none;}"};ws(["click"]);const Ec=300,Sc=60,Ac="none";function Nc(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function Mc(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 Fc(t,e,n,i,r){const o=Mc(t,n,i);return t.dispatchEvent(new CustomEvent(`${e}${r}`,{detail:o})),o}function Cc(){let t=[],e=()=>{},n=[];return{setPointerControls:(i,r,o,s,a,l=Ac,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=Fc(r,i,e,t,"down");function c(e){const o=t.length;t=function(t,e){return e.filter((e=>t.pointerId!==e.pointerId))}(e,t);if(o>t.length){t.length||(u(),d(),h(),f());const o=Fc(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=Nc(r,"pointermove",(e=>{t=t.map((t=>e.pointerId===t.pointerId?e:t));const s=Fc(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=Nc(r,"lostpointercapture",(t=>{c(t)})),h=Nc(r,"pointerup",(t=>{c(t)})),f=Nc(r,"pointerleave",(t=>{c(t)}))};e=Nc(r,"pointerdown",l)}return{destroy:()=>{t.length||(e(),n.forEach((t=>{var e;null===(e=t.onDestroy)||void 0===e||e.call(t)})))}}}}}const Oc="@attach";const Pc="swipe";function Rc(t,e,n,i=!1){const{setPointerControls:r}=Cc(),o=i?Pc:Symbol(Oc);return{...n,[`on${Pc}`]:t,[o]:t=>{const{onDown:n,onUp:i,parameters:o}=function(t,e){const n={timeframe:Ec,minSwipeDistance:Sc,touchAction:Ac,composed:!1,...e};let i,r,o,s;function a(t,e){r=e.clientX,o=e.clientY,i=Date.now(),1===t.length&&(s=e.target)}function l(e,a){if("pointerup"===a.type&&0===e.length&&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(Pc,{detail:{direction:u,target:s,pointerType:a.pointerType}}))}}return{onDown:a,onUp:l,parameters:n}}(t,null==e?void 0:e());return r(Pc,t,null,n,i,o.touchAction,o.plugins).destroy}}}const Dc=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,void 0!==u.x&&void 0!==u.y?(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)=>{0===e.length&&m()},onDestroy:m,onInit:t=>{t.length&&(u.x=void 0,u.y=void 0,p())}}};var Lc=Es("<div></div>");const Bc={hash:"svelte-1fv6njc",code:".swiper.svelte-1fv6njc {position:absolute;top:0;left:0;pointer-events:auto;width:100%;height:100%;}"};var zc=Es("<img/>"),Wc=Es('<div class="ui-container svelte-1rvgxfc"><!></div>'),$c=Es('<div class="cover-container svelte-1rvgxfc"><!> <!> <!></div>'),Uc=Es('<div class="covers-container svelte-1rvgxfc" style="scroll-behavior: auto;"></div>');const jc={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;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.hidden.svelte-1rvgxfc {opacity:0;}.cover-image.hidden.force-show.svelte-1rvgxfc {opacity:1;background:transparent;}.ui-container.svelte-1rvgxfc {position:absolute;top:0;left:0;bottom:0;right:0;pointer-events:none;}"};function qc(t,e){Ii(e,!0),Ys(t,jc);const n=[375,768,1024,1400,1920];let i=wa(e,"scrollOffset",15),r=wa(e,"isMobile",3,!1);const o=Ti("state");let s,a=Ur((()=>o().playingModulePosition)),l=null,c=null,u=Ur((()=>o().startedPlaying)),d=Ur((()=>o().currentModulesList)),h=Ur((()=>ps(d).findIndex((t=>f(o().playingModulePosition,t.position)))));function f(t,e){return t.itemIndex===e.itemIndex&&t.moduleIndex===e.moduleIndex}function p(t){const e=t.scrollLeft,n=t.scrollWidth-t.clientWidth;return 0===e?0:e>n?100:e/n*100}function m(t){var e;r()&&t.preventDefault();const{target:n}=t,u=p(n),m=(null===(e=ps(d))||void 0===e?void 0:e.length)||1,v=100/(m-1||1),g=Math.round(u/v);let y=Math.min(g,m-1);const b=ps(d)[y],k={itemIndex:o().activeItemIndex,moduleIndex:o().activeModuleIndex};if(!l){const t=s.children[ps(h)],e=s.getBoundingClientRect(),n=t.getBoundingClientRect();i(n.x-e.x)}c&&clearTimeout(c),c=setTimeout((()=>{const t=p(n);Math.abs(t-g*v)<.25&&async function(){o().seeking&&(o().playerLoaded?o().currentItemsList[o().activeItemIndex].modules[o().activeModuleIndex].play():o().playingModulePosition=ps(a),i(0))}()}),l?0:150),null!==l||f(b.position,k)?null!==l&&f(b.position,l)&&(l=null):(o().activeItemIndex=b.position.itemIndex,o().activeModuleIndex=b.position.moduleIndex),Zr(a,b.position)}function v(){}Io((()=>{const{activeItemIndex:t,activeModuleIndex:e}=o();t===ps(a).itemIndex&&e===ps(a).moduleIndex||gs((()=>{var n,i;const r=ps(d).findIndex((n=>{const{itemIndex:i,moduleIndex:r}=n.position;return t===i&&e===r}));l=(null===(n=ps(d)[r])||void 0===n?void 0:n.position)||null;const o=null===(i=s)||void 0===i||null===(i=i.children)||void 0===i?void 0:i[r];if(!s||!o)return;const a=s.getBoundingClientRect(),c=o.getBoundingClientRect();let u=s.scrollLeft+(c.left-a.left);const h=Math.max(0,s.scrollWidth-s.clientWidth);u=Math.max(0,Math.min(h,u)),s.scrollTo({left:u,behavior:"auto"})}))})),Io((()=>{ps(u)&&gs((()=>{}))}));var g=Ss(),y=mo(g),b=t=>{var i=Uc();Hs(i,23,(()=>ps(d)),(t=>t.id),((t,i,o)=>{var s=$c(),a=po(s),l=t=>{var r=zc();let s;No((t=>{s=ia(r,1,"cover-image svelte-1rvgxfc",null,s,{hidden:ps(u)&&ps(o)===ps(h),"force-show":ps(i).showCover}),pa(r,"src",t),pa(r,"alt",ps(i).name),pa(r,"fetchpriority",0===ps(o)?"high":"auto")}),[()=>e.gallery.getCoverUrl(ps(i).cover,n[n.length-1])]),xs("load",r,(function(...t){var e;null===(e=0===ps(o)?v:()=>{})||void 0===e||e.apply(this,t)})),function(t){if(!hi)return;t.removeAttribute("onload"),t.removeAttribute("onerror");const e=t.__e;void 0!==e&&(t.__e=void 0,queueMicrotask((()=>{t.isConnected&&t.dispatchEvent(e)})))}(r),As(t,r)};Us(a,(t=>{t(l)}));var c=vo(a,2),d=t=>{!function(t,e){Ii(e,!0),Ys(t,Bc);const n={color:"#e3e3e3",fadeTime:300,lineWidth:8};function i(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])}}var r=Lc();ma(r,(t=>({...t,class:"swiper"})),[()=>Rc(i,(()=>({touchAction:"pan-y",plugins:e.debug?[Dc(n)]:[]})))],void 0,void 0,"svelte-1fv6njc"),As(t,r),Ei()}(t,{get gallery(){return e.gallery},get debug(){return e.debug},get onEvent(){return e.onEvent}})};Us(c,(t=>{r()&&t(d)}));var f=vo(c,2),p=t=>{var e=Wc();!function(t,e,n){hi&&mi();var i=new $s(t);Mo((()=>{var t,r=null!==(t=e())&&void 0!==t?t:null;i.ensure(r,r&&(t=>n(t,r)))}),Gn)}(po(e),(()=>ps(i).Component),((t,e)=>{e(t,{get state(){return ps(i).state},get isMobile(){return r()}})})),vi(e),As(t,e)};Us(f,(t=>{var e;null!==(e=ps(i))&&void 0!==e&&e.Component&&t(p)})),vi(s),As(t,s)})),vi(i),ka(i,(t=>s=t),(()=>s)),xs("scroll",i,m),As(t,i)};Us(y,(t=>{ps(d)&&t(b)})),As(t,g),Ei()}const Vc="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};let Hc;function Gc(){const t=Vc&&Vc.navigator&&(Vc.navigator.userAgent||Vc.navigator.platform||Vc.navigator.vendor)||"";if(Hc&&Hc.ua===t)return Hc;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 Hc={ua:t,isMobile:r},Hc}"undefined"!=typeof window&&window.addEventListener("pageshow",(function(t){t.persisted&&setTimeout((function(){window.location.reload()}),10)}),!1);var Kc=Es('<div class="paging-buttons svelte-1n46o8q"><!> <!></div>'),Xc=Es('<div style="position: absolute; top: 0; left: 0; width: 100%;"></div>'),Yc=Es("<!> <!>",1),Qc=Es('<div class="player-container svelte-1n46o8q"><div class="player-div swipable svelte-1n46o8q"></div> <!> <!> <!> <!></div> <!>',1),Jc=Es('<div class="eko-gallery-app svelte-1n46o8q"><!></div>');const Zc={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:#FFFFFF;box-shadow: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:"Human BBY Digital", sans-serif;}.player-container.svelte-1n46o8q {position:relative;flex:1;width:100%;pointer-events:none;overflow:hidden;display:flex;align-items:center;justify-content:center;}.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 tu(t,e){Ii(e,!0),Ys(t,Zc);const n=wa(e,"config",19,(()=>({}))),i=wa(e,"forceMobile",3,!1),r=wa(e,"videoAspectRatio",3,"unset"),o=wa(e,"onGalleryReady",3,(()=>{})),s=wa(e,"onEvent",3,(()=>{}));let a,l=!1,c=Qr(new ic(n())),u=Qr(null),d=Ur((()=>i()||Gc().isMobile)),h=Qr(0),f=Qr(void 0),p=Qr(!0),m=Qr(io({width:"100%",height:"100%"}));var v,g,y;function b(){const t={AssetsDeliveryService:{assetsDeliveryServiceUrl:ps(c).urls.assetsDeliveryBase}};Zr(u,new e.EkoPlayer(a,Object.assign(t,e.playerOptions))),ps(u).on("playing",(()=>{ps(c).state.paused=!1})),ps(u).on("pause",(()=>{ps(c).state.paused=!0})),ps(u).once("playing",(()=>{ps(c).state.startedPlaying=!0,s()("galleryloaded")}))}function k(t){var e;null===(e=ps(c))||void 0===e||e.selectItem(t)}function x(){var t;null===(t=ps(c))||void 0===t||t.next()}function w(){var t;null===(t=ps(c))||void 0===t||t.prev()}function _(){ps(u).paused?ps(u).play():ps(u).pause()}function T(){return`--uiTranformX: ${ps(h)}px;--videoAspect: ${r()};--videoWidth: ${ps(m).width};--videoHeight: ${ps(m).height};`}v="state",g=()=>ps(c).state,Si().set(v,g),y=()=>(o()(ps(c).public),n()&&e.EkoPlayer&&(b(),ps(c).start(ps(u))),()=>{var t;null===(t=ps(u))||void 0===t||t.dispose()}),null===wi&&ci(),Io((()=>{const t=gs(y);if("function"==typeof t)return t})),Io((()=>{n()&&e.EkoPlayer&&(l?gs((()=>{var t;Zr(c,new ic(n())),null===(t=ps(u))||void 0===t||t.dispose(),Zr(p,!1),fs().then((()=>(Zr(p,!0),fs()))).then((()=>{o()(ps(c).public),b(),ps(c).start(ps(u))}))})):l=!0)})),Io((()=>{ps(f)&&ps(u)&&ps(u).loadDebugOverlay({containerElement:ps(f)})})),Io((()=>{if("unset"!==r()&&r().includes("/")){const[t,e]=r().split("/").map((t=>Number(t)));isNaN(t)||isNaN(e)||Zr(m,t>e?{width:"100%",height:"auto"}:{width:"auto",height:"100%"},!0)}else Zr(m,{width:"100%",height:"100%"},!0)}));var I=Jc(),E=po(I),S=t=>{var n=Qc(),i=mo(n),r=po(i);ka(r,(t=>a=t),(()=>a));var o=vo(r,2);qc(o,{get isMobile(){return ps(d)},get gallery(){return ps(c)},get debug(){return e.debug},get onEvent(){return s()},get scrollOffset(){return ps(h)},set scrollOffset(t){Zr(h,t,!0)}});var l=vo(o,2),u=t=>{var e=Kc(),n=po(e);mc(n,{type:"prev",onClick:w}),mc(vo(n,2),{type:"next",onClick:x}),vi(e),As(t,e)};Us(l,(t=>{ps(d)||e.hideNav||t(u)}));var p=vo(l,2),m=t=>{bc(t,{})};Us(p,(t=>{var e;!ps(d)&&(null===(e=ps(c).state.currentItem)||void 0===e?void 0:e.modules.length)>1&&t(m)}));var v=vo(p,2),g=t=>{var n=Yc(),i=mo(n);!function(t,e){Ii(e,!0),Ys(t,Ic);const n=Ti("state");var i=Tc();i.__click=function(...t){var n;null===(n=e.onPauseClick)||void 0===n||n.apply(this,t)};var r=po(i),o=t=>{var e=wc();No((()=>pa(e,"src",kc))),As(t,e)},s=t=>{var e=_c();No((()=>pa(e,"src",xc))),As(t,e)};Us(r,(t=>{n().paused?t(o):t(s,!1)})),vi(i),No((t=>pa(i,"aria-label",t)),[()=>n().paused?"Play":"Pause"]),As(t,i),Ei()}(i,{onPauseClick:_});var r=vo(i,2),o=t=>{var e=Xc();ka(e,(t=>Zr(f,t)),(()=>ps(f))),As(t,e)};Us(r,(t=>{e.debug&&t(o)})),As(t,n)};Us(v,(t=>{ps(c).state.startedPlaying&&t(g)})),vi(i);var y=vo(i,2),b=t=>{!function(t,e){Ii(e,!0),Ys(t,dc);let n=wa(e,"onNavItemClick",3,(()=>{}));const i=Ti("state");var r=uc(),o=po(r);Hs(o,23,(()=>i().currentItemsList),(t=>t.id),((t,e,r)=>{var o=cc();let s;o.__click=()=>n()(ps(r));var a=po(o),l=po(a,!0);vi(a),vi(o),No((t=>{s=ia(o,1,"nav-button svelte-er27y2",null,s,t),Rs(l,ps(e).name)}),[()=>({selected:ps(r)===i().activeItemIndex})]),As(t,o)})),vi(o),vi(r),As(t,r),Ei()}(t,{onNavItemClick:k})};Us(y,(t=>{e.hideNav||t(b)})),No((t=>oa(i,t)),[T]),As(t,n)};Us(E,(t=>{n()&&ps(p)&&t(S)})),vi(I),As(t,I),Ei()}function eu(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var nu,iu,ru,ou,su={exports:{}},au=eu((nu||(nu=1,ru=su.exports,ou=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},(iu=su).exports?iu.exports=ou():ru.log=ou()),su.exports));const lu=()=>{},cu=["trace","log","debug","info","warn","error","getLevel","setLevel"],uu=["trace","debug","info","warn","error","silent"],du={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;"},hu="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global;let fu={level:"trace",appName:""},pu=[];const mu="object"==typeof hu&&hu.performance&&"function"==typeof hu.performance.now?hu.performance.now.bind(hu.performance):Date.now.bind(Date),vu=t=>t&&"string"==typeof t?t.toLowerCase().trim():"",gu=(()=>{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[vu(e)]=vu(i)||"trace"})),n}catch(t){return{}}})(),yu=(t,e="")=>{const n=vu(t),i=au.getLogger(n);if(i.__ekologger)return i.__ekologger;e||gu[n]||gu["*"]||(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)=>(mu()/1e3).toFixed(e))()}] %c[${s}] ${fu.appName?`[${fu.appName}] `:""}[${t}]`,du[s],...e)}},e=gu[n]||gu["*"]||e||fu.level,i.setLevel(e,!1);const o=(...t)=>i.log(...t);return cu.forEach((t=>{o[t]=(...e)=>(pu.forEach((n=>{n[t](...e)})),i[t](...e))})),i.__ekologger=o,o};yu.setDefaults=({appName:t="",level:e})=>{t&&"string"==typeof t&&(fu.appName=t),(e=vu(e))&&uu.includes(e)&&(fu.level=e,Object.values(au.getLoggers()).filter((t=>t.__noExplicitLevel)).forEach((t=>t.setLevel(fu.level,!1))))},yu.installDriver=t=>{const e={...cu.reduce(((e,n)=>(e[n]="function"==typeof(null==t?void 0:t[n])?t[n]:lu,e)),{})};pu.push(e)};let bu=class{#T=new Map;on(t,e){if("function"!=typeof e)return this;const n=this.#T.get(t)||new Set;return n.add(e),this.#T.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.#T.clear(),this;const n=this.#T.get(t);return n?e?(n.delete(e),0===n.size&&this.#T.delete(t),this):(this.#T.delete(t),this):this}trigger(t,...e){const n=this.#T.get(t);return n?(n.forEach((t=>t(...e))),this):this}};function ku(t){return"[object Object]"===Object.prototype.toString.call(t)}function xu(t,...e){const n=ku(t)?{...t}:{};return e.forEach((t=>{ku(t)&&Object.keys(t).forEach((e=>{const i=t[e],r=n[e];ku(i)&&ku(r)?n[e]=xu(r,i):Array.isArray(i)?n[e]=i.slice():n[e]=i}))})),n}function wu(t){if("string"==typeof t)return`'${t}'`;if(Array.isArray(t))return`[${t.map((t=>wu(t))).join(", ")}]`;if(ku(t))try{return JSON.stringify(t)}catch(t){return"[object Object]"}return null===t?"null":void 0===t?"undefined":String(t)}function _u(t){return Array.from(t).map((t=>wu(t))).join(", ")}var Tu=new WeakSet;let Iu=class extends bu{constructor(...t){super(),O(this,Tu);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=yu(n,this.loglevel);const i=ku(this.defaults)?this.defaults:{},r=ku(e)&&ku(e[n])?e[n]:{};this.settings=xu({},i,r),A(Tu,this,Eu).call(this),A(Tu,this,Su).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 Eu(){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}(${_u(t)})`),a(...t)):a,t.add(o)}n=Object.getPrototypeOf(n)}}function Su(){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 Au="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};function Nu(t){return Boolean(t)&&"object"==typeof t&&1===t.nodeType&&"function"==typeof t.appendChild}let Mu=class extends Iu{#I;#E;#S;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);const[i]=t,r=function(t,e=(null==Au?void 0:Au.document)){if(Nu(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 Nu(i)?i:null}(i);if(!r)throw new Error("Canvas requires a valid mount target (HTMLElement or selector string).");this.#I=r;const o=null==Au?void 0:Au.document;if(!o||"function"!=typeof o.createElement)throw new Error("Canvas requires document.createElement.");var s,a;this.#E=o.createElement("canvas"),s=this.#E,a=null===(e=this.settings)||void 0===e?void 0:e.style,s&&a&&"object"==typeof a&&!Array.isArray(a)&&Object.keys(a).forEach((t=>{const e=a[t];null!=e&&(s.style[t]=String(e))})),this.#I.appendChild(this.#E);const l=null===(n=this.settings)||void 0===n?void 0:n.contextAttributes,c=l&&"object"==typeof l&&!Array.isArray(l)?l:void 0;if(this.#S=this.#E.getContext("webgl2",c),!this.#S)throw new Error("Canvas WebGL2 context is not available.")}get name(){return"Canvas"}get element(){return this.#E}get gl(){return this.#S}onDispose(){this.#E&&this.#E.parentNode&&this.#E.parentNode.removeChild(this.#E),this.#S=null,this.#E=null,this.#I=null}};var Fu=new WeakMap,Cu=new WeakMap,Ou=new WeakMap,Pu=new WeakMap,Ru=new WeakMap,Du=new WeakMap,Lu=new WeakSet;let Bu=class extends Iu{get name(){return"ContainerSize"}get containerWidth(){return M(Cu,this)}get containerHeight(){return M(Ou,this)}get width(){return M(Cu,this)}get height(){return M(Ou,this)}constructor(...t){super(...t),O(this,Lu),F(this,Fu,void 0),F(this,Cu,0),F(this,Ou,0),F(this,Pu,null),F(this,Ru,null),F(this,Du,null);const[e]=t;var n;C(Fu,this,(n=e)&&n.element&&Nu(n.element)?n.element:Nu(n)?n:null),M(Fu,this)&&(A(Lu,this,Wu).call(this,!0),A(Lu,this,zu).call(this))}onDispose(){M(Pu,this)&&"function"==typeof M(Pu,this).disconnect&&M(Pu,this).disconnect(),C(Pu,this,null),M(Du,this)&&"function"==typeof(null==Au?void 0:Au.removeEventListener)&&Au.removeEventListener("resize",M(Du,this)),C(Du,this,null),M(Ru,this)&&((null==Au?void 0:Au.clearInterval)||clearInterval)(M(Ru,this)),C(Ru,this,null),C(Fu,this,null)}};function zu(){if(!M(Fu,this))return;const t=null==Au?void 0:Au.ResizeObserver;if("function"==typeof t)return C(Pu,this,new t((()=>A(Lu,this,Wu).call(this)))),void M(Pu,this).observe(M(Fu,this));C(Du,this,(()=>A(Lu,this,Wu).call(this))),"function"==typeof(null==Au?void 0:Au.addEventListener)&&Au.addEventListener("resize",M(Du,this));const e=(null==Au?void 0:Au.setInterval)||setInterval;C(Ru,this,e((()=>A(Lu,this,Wu).call(this)),250))}function Wu(t=!1){if(!M(Fu,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}}(M(Fu,this));(t||e!==M(Cu,this)||n!==M(Ou,this))&&(C(Cu,this,e),C(Ou,this,n),this.trigger("containerresize",{width:e,height:n}))}var $u={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"}};let Uu=class{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;return{contextType:e||"webgl",contextAttributes:Object.prototype.hasOwnProperty.call(t,"contextAttributes")?n:r}}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 ju,qu={exports:{}},Vu=(ju||(ju=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}(qu)),qu.exports),Hu=eu(Vu);let Gu=class extends Uu{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 Hu;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);const a={contextType:r};s&&void 0!==o&&(a.contextAttributes=o),t.initPlugin("canvas",a);const l={drawFrame:this.canvasDrawFrameFn.bind(this),resize:n,contextType:r,offscreenVideoCanvasEnabled:!1,viewportModeEnabled:!0,fps:0};return s&&void 0!==o&&(l.contextAttributes=o),t.canvas.init(l),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)}},Ku=class extends Uu{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)}},Xu=class extends Uu{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 Yu=function(t){let e;return e="string"==typeof t?new Ku(t):t&&t.src&&t.dest?new Xu(t):new Gu(t),e};function Qu(t){return Array.isArray(t)||(t=[t]),t}let Ju=class{constructor(t){this.store=t?{...t.get()}:{}}reset(){this.store={}}get(t){if(!t)return this.store;const e=(t=Qu(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=Qu(t),e=Qu(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]}))}},Zu=class{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 td=yu("frame","warn");let ed=!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");ed=e||n}function nd(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))}let id=class extends Zu{fill(t){if(ed&&(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?nd(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,nd(t,e)):t.__useSubImage=!0))}(this,t,e);const i=(performance.now()-n)/1e3;i>=.1&&td.warn(`[fill] texImage2D() took ${i.toFixed(3)} seconds to execute.`),"function"==typeof t.close&&!0!==t.__keepOpen&&(t.close(),t.__closed=!0)}},rd=class extends Zu{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 od=function(t,e,n,i,r){let o;switch(t){case"frame":o=new id(e,n,i,r);break;case"pixel":o=new rd(e,n,i,r);break;default:throw new Error(`cant recognize type ${t}`)}return o};let sd=class{constructor(t){return this.gl=t.gl,this.textureObjectPool=[],this.textureUnitsPool=new Set(Array(20).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=od(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(20).keys()),t.forEach((t=>{this.textureUnitsPool.delete(t)}))}};const ad=$u.VIDEO_SOURCE_PREFIX,ld=$u.TEXTURE_SOURCE_PREFIX,cd=$u.PREVIOUS_OUTPUT_PREFIX,ud=$u.SAVED_FRAME_PREFIX;function dd(t,e,n){t.set(`${ad}${n}`,e)}function hd(t,e,n){t.set(`${cd}${n}`,e)}function fd(t,e,n){t.set(`${ud}${n}`,e)}let pd=class{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()))dd(t,n,e),hd(t,n,e);for(const[e,n]of Object.entries(this.capturedFramesManager.getSavedFrames()))fd(t,n,e)}setTextureSource(t,e,n){t.set(`${ld}${n}`,e)}getInput(t,e){return t.get(e)}getPrevOutput(t,e){return e=Number.isInteger(e)?e:0,t.get(`${cd}${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)=>{hd(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))}))}},md=class{constructor(t){this.context=t}bind(){throw new Error("impl in concrete")}},vd=100,gd=100;function yd(t,e){vd=t,gd=e}let bd=class extends md{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),yd(i,r)),t}},kd=class extends md{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),!1!==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 xd{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===$u.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS?new bd({gl:this.gl}):new kd({gl:this.gl,textureManager:this.textureManager,frameBufferObject:this.getFrameBufferObject(),useCanvasSizedFilterTargets:this.useCanvasSizedFilterTargets}),e}}function wd(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 _d=function(t,e){return wd(t,t.VERTEX_SHADER,e)},Td=function(t,e){return wd(t,t.FRAGMENT_SHADER,e)};const Id={position_3d:0,texture_coordinate_2d:1};var Ed=function(t,e,n){const i=t.createProgram();if(t.attachShader(i,e),t.attachShader(i,n),Object.entries(Id).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)},Sd=[-1,-1,1,1,-1,1,-1,1,1,1,1,1],Ad=[0,1,2,2,1,3],Nd=[0,0,1,0,0,1,1,1];const Md=96,Fd=[new Float32Array(new ArrayBuffer(Md)),new Float32Array(new ArrayBuffer(Md)),new Float32Array(new ArrayBuffer(Md)),new Float32Array(new ArrayBuffer(Md)),new Float32Array(new ArrayBuffer(Md)),new Float32Array(new ArrayBuffer(Md))],Cd=[new Int16Array(6),new Int16Array(6),new Int16Array(6)];class Od{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=Fd[this.floatBufferCounter],this.floatBufferCounter=this.floatBufferCounter++%Fd.length;break;case this.gl.ELEMENT_ARRAY_BUFFER:t=Cd[this.unit16BufferCounter],this.unit16BufferCounter=this.unit16BufferCounter++%Cd.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 Pd={position_3d:class extends Od{getPointerData(){return{size:3,type:this.gl.FLOAT,normalize:!1,stride:0,offset:0}}},position_indexes:class extends Od{setPointer(){}getPointerData(){}enable(){}},texture_coordinate_2d:class extends Od{getPointerData(){return{size:2,type:this.gl.FLOAT,normalize:!0,stride:0,offset:0}}}};var Rd=function(t,e,n){const i=Pd[t];if(!i)throw new Error(`${t} is not a attribute name,choose from list: ${Object.keys(Pd)}`);return new i(t,e,n)};class Dd{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 Ld extends Dd{set(t){this.gl.uniform1fv(this.location,t)}}let Bd=class extends Dd{set(t){t&&(t.beforeUse(),this.gl.uniform1i(this.location,t.getUnit()))}};const zd="first_texture_dimensions",Wd="viewport_dimensions",$d="time",Ud={RUNTIME_OPTIONS:"runtimeOptions[0]",STATIC_OPTIONS:"staticOptions[0]",FIRST_TEXTURE:"first_texture",SECOND_TEXTURE:"second_texture",FIRST_MATRIX:"first_mat4"},jd={[Ud.FIRST_TEXTURE]:Bd,[Ud.SECOND_TEXTURE]:Bd,[Ud.FIRST_MATRIX]:class extends Dd{set(t){this.gl.uniformMatrix4fv(this.location,!1,t)}},[Ud.STATIC_OPTIONS]:Ld,[Ud.RUNTIME_OPTIONS]:Ld};var qd=function(t,e){const n=jd[t];if(!n)throw new Error(`${t} is not a attribute name,choose from list: ${Object.keys(jd)}`);return new n(t,e)},Vd=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 Hd="position_3d",Gd="position_indexes",Kd="texture_coordinate_2d";class Xd{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=_d(this.gl,e.vertex),this.fragmentShader=Td(this.gl,e.fragment),this.program=Ed(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:Hd,bindPoint:e.gl.ARRAY_BUFFER},{id:Gd,bindPoint:e.gl.ELEMENT_ARRAY_BUFFER},{id:Kd,bindPoint:e.gl.ARRAY_BUFFER}].concat(t)).forEach((t=>{const i=t.id;n[i]=Rd(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]=qd(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:Ud.RUNTIME_OPTIONS},{id:Ud.STATIC_OPTIONS}];return(t.getUniformList||Xd.getUniformList)().forEach((t=>{Object.values(Ud).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||Xd.getUniformList)().forEach((t=>{switch(t){case Ud.FIRST_TEXTURE:this.uniforms[Ud.FIRST_TEXTURE].set(r[0]);break;case Ud.SECOND_TEXTURE:this.uniforms[Ud.SECOND_TEXTURE].set(r[1]);break;case zd:o=[...o,r[0].getWidth(),r[0].getHeight()];break;case Wd:o=[...o,i.width,i.height];break;case $d:{const t=Vd(e.startTime,e.duration);o=[...o,t];break}}})),o.length>0&&this.uniforms[Ud.RUNTIME_OPTIONS].set(o)}static getUniformList(){return[Ud.FIRST_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(){}handleAttributes(){this.attributes[Hd].fillBuffer(Sd),this.attributes[Hd].setPointer(),this.attributes[Gd].fillBuffer(Ad),this.attributes[Kd].fillBuffer(Nd),this.attributes[Kd].setPointer()}disposeAttributes(){Object.values(this.attributes).forEach((t=>{t.dispose()}))}render(t,e){const n=this.frameBuffer.bind(t);let i={width:vd,height:gd};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 Yd extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(Yd)};super(Yd.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 Qd,Jd="undefined"!=typeof Float32Array?Float32Array:Array;function Zd(){var t=new Jd(3);return Jd!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function th(t,e,n){var i=new Jd(3);return i[0]=t,i[1]=e,i[2]=n,i}function eh(){var t=new Jd(4);return Jd!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}Zd(),function(){var t;t=new Jd(4),Jd!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}(),Zd(),th(1,0,0),th(0,1,0),eh(),eh(),Qd=new Jd(9),Jd!=Float32Array&&(Qd[1]=0,Qd[2]=0,Qd[3]=0,Qd[5]=0,Qd[6]=0,Qd[7]=0),Qd[0]=1,Qd[4]=1,Qd[8]=1;class nh extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(nh)};super(nh.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:nh.getInitialOptions().translate.x},{properties:["translate","y"],type:"slider",minValue:-2,maxValue:2,step:.001,initialValue:nh.getInitialOptions().translate.y},{properties:["scale","x"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:nh.getInitialOptions().scale.x},{properties:["scale","y"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:nh.getInitialOptions().scale.y},{properties:["rotate"],type:"slider",minValue:-360,maxValue:360,step:1,initialValue:nh.getInitialOptions().rotate}]}static getUniformList(){return[Ud.FIRST_TEXTURE,Ud.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 Jd(16),Jd!=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}(eh(),0,0,o),th(e,n,0),th(i,r,1)),this.uniforms[Ud.FIRST_MATRIX].set(this.transformMatrix)}}class ih extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(ih)};super(ih.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[Ud.FIRST_TEXTURE,zd]}}class rh extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(rh)};super(rh.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[Ud.FIRST_TEXTURE,zd]}}class oh extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(oh)};super(oh.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[Ud.FIRST_TEXTURE,zd,Wd]}handleStaticUniforms(t){var e;const n=(null!==(e=Number.parseFloat(t.offsetDist))&&void 0!==e?e:4).toFixed(3);this.uniforms[Ud.STATIC_OPTIONS].set([n])}}class sh extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(sh)};super(sh.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[Ud.FIRST_TEXTURE,zd,Wd]}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[Ud.STATIC_OPTIONS].set([i,r])}}class ah extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(ah)};super(ah.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[Ud.STATIC_OPTIONS].set([e])}}class lh extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(lh)};super(lh.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[Ud.FIRST_TEXTURE,zd,Ud.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[Ud.STATIC_OPTIONS].set([e,n,i,r,o,s,a])}}class ch extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(ch)};super(ch.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[Ud.FIRST_TEXTURE,Ud.SECOND_TEXTURE]}}class uh extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(uh)};super(uh.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[Ud.FIRST_TEXTURE,Ud.SECOND_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(t){const e=Number.parseFloat(t.lutSize).toFixed(1);this.uniforms[Ud.STATIC_OPTIONS].set([e])}}var dh="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",hh='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:fh,cos:ph,sin:mh,acos:vh,atan2:gh,sqrt:yh,pow:bh}=Math;function kh(t){return t<0?-bh(-t,1/3):bh(t,1/3)}const xh=Math.PI,wh=2*xh,_h=xh/2,Th=Number.MAX_SAFE_INTEGER||9007199254740991,Ih=Number.MIN_SAFE_INTEGER||-9007199254740991,Eh={x:0,y:0,z:0},Sh={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),yh(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],Eh],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||Sh.approximately(t,e)||Sh.approximately(t,n)},approximately:function(t,e,n){return fh(t-e)<=(n||1e-6)},length:function(t){const e=Sh.Tvalues.length;let n=0;for(let i,r=0;r<e;r++)i=.5*Sh.Tvalues[r]+.5,n+=Sh.Cvalues[r]*Sh.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(Sh.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 gh(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 yh(n*n+i*i)},closest:function(t,e){let n,i,r=bh(2,63);return t.forEach((function(t,o){i=Sh.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=bh(t,e)+bh(1-t,e);return fh((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=bh(1-t,e);return n/(bh(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 Sh.lli8(r,o,s,a,l,c,u,d)},lli:function(t,e){return Sh.lli4(t,t.c,e,e.c)},makeline:function(t,e){return new Lh(t.x,t.y,(t.x+e.x)/2,(t.y+e.y)/2,e.x,e.y)},findbbox:function(t){let e=Th,n=Th,i=Ih,r=Ih;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(!Sh.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=Sh.makeline(e.points[i-1],t.points[0]),s=Sh.makeline(t.points[r-1],e.points[0]),a={startcap:o,forward:t,back:e,endcap:s,bbox:Sh.findbbox([o,t,e,s]),intersections:function(t){return Sh.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=Th,s=Ih;-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=-gh(e.p2.y-i,e.p2.x-n);return t.map((function(t){return{x:(t.x-n)*ph(r)-(t.y-i)*mh(r),y:(t.x-n)*mh(r)+(t.y-i)*ph(r)}}))},roots:function(t,e){e=e||{p1:{x:0,y:0},p2:{x:1,y:0}};const n=t.length-1,i=Sh.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=-yh(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(Sh.approximately(l,0)){if(Sh.approximately(c,0))return Sh.approximately(u,0)?[]:[-d/u].filter(r);const t=yh(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=yh(t*t*t),n=-p/(2*e),i=vh(n<-1?-1:n>1?1:n),o=2*kh(e);return b=o*ph(i/3)-c/3,k=o*ph((i+wh)/3)-c/3,x=o*ph((i+2*wh)/3)-c/3,[b,k,x].filter(r)}if(0===v)return g=m<0?kh(-m):-kh(m),b=2*g-c/3,k=-g-c/3,[b,k].filter(r);{const t=yh(v);return g=kh(-m+t),y=kh(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=-yh(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=Sh.compute(t,e),h=Sh.compute(t,n),f=d.x*d.x+d.y*d.y;if(i?(o=yh(bh(d.y*h.z-h.y*d.z,2)+bh(d.z*h.x-h.z*d.x,2)+bh(d.x*h.y-h.x*d.y,2)),s=bh(f+d.z*d.z,1.5)):(o=d.x*h.y-d.y*h.x,s=bh(f,1.5)),0===o||0===s)return{k:0,r:0};if(c=o/s,u=s/o,!r){const r=Sh.curvature(t-.001,e,n,i,!0).k,o=Sh.curvature(t+.001,e,n,i,!0).k;l=(o-c+(c-r))/2,a=(fh(o-c)+fh(c-r))/2}return{k:c,r:u,dk:l,adk:a}},inflections:function(t){if(t.length<4)return[];const e=Sh.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(Sh.approximately(o,0)){if(!Sh.approximately(s,0)){let t=-a/s;if(0<=t&&t<=1)return[t]}return[]}const l=2*o;if(Sh.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,fh(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 Sh.bboxoverlap(t.left.bbox(),t.right.bbox())}));let u=[];return 0===c.length||(c.forEach((function(t){u=u.concat(Sh.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*ph(_h)-r*mh(_h),l=i*mh(_h)+r*ph(_h),c=o*ph(_h)-s*mh(_h),u=o*mh(_h)+s*ph(_h),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=Sh.lli8(d,h,m,v,f,p,g,y),k=Sh.dist(b,t);let x,w=gh(t.y-b.y,t.x-b.x),_=gh(e.y-b.y,e.x-b.x),T=gh(n.y-b.y,n.x-b.x);return w<T?((w>_||_>T)&&(w+=wh),w>T&&(x=T,T=w,w=x)):T<_&&_<w?(x=T,T=w,w=x):T+=wh,b.s=w,b.e=T,b.r=k,b},numberSort:function(t,e){return t-e}};class Ah{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 Sh.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++)Sh.expandbox(e,t[n].bbox());return e}offset(t){const e=[];return this.curves.forEach((function(n){e.push(...n.offset(t))})),new Ah(e)}}const{abs:Nh,min:Mh,max:Fh,cos:Ch,sin:Oh,acos:Ph,sqrt:Rh}=Math,Dh=Math.PI;let Lh=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=Sh.align(s,{p1:s[0],p2:s[l]}),d=Sh.dist(s[0],s[l]);this._linear=u.reduce(((t,e)=>t+Nh(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=Sh.dist(n,s.C));const a=o*(1-r)/r,l=Sh.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,T={x:t.x+(k-t.x)/r,y:t.y+(x-t.y)/r},I={x:i.x+(w-i.x)/(1-r),y:i.y+(_-i.y)/(1-r)};return new e(t,T,I,i)}static getUtils(){return Sh}getUtils(){return e.getUtils()}static get PolyBezier(){return Ah}valueOf(){return this.toString()}toString(){return Sh.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=Sh.derive(this.points,this._3d),this.computedirection()}computedirection(){const t=this.points,e=Sh.angle(t[0],t[this.order],t[1]);this.clockwise=e>0}length(){return Sh.length(this.derivative.bind(this))}static getABC(t=2,e,n,i,r=.5){const o=Sh.projectionratio(r,t),s=1-o,a={x:o*e.x+s*i.x,y:o*e.y+s*i.y},l=Sh.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],Sh.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=Sh.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=Sh.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?Sh.computeWithRatios(t,this.points,this.ratios,this._3d):Sh.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 Sh.compute(t,this.dpoints[0],this._3d)}dderivative(t){return Sh.compute(t,this.dpoints[1],this._3d)}align(){let t=this.points;return new e(Sh.align(t,{p1:t[0],p2:t[t.length-1]}))}curvature(t){return Sh.curvature(t,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return Sh.inflections(this.points)}normal(t){return this._3d?this.__normal3(t):this.__normal2(t)}__normal2(t){const e=this.derivative(t),n=Rh(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=Rh(e.x*e.x+e.y*e.y+e.z*e.z),r=Rh(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=Rh(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=Sh.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=Sh.map(0,0,1,this._t1,this._t2),r.left._t2=Sh.map(t,0,1,this._t1,this._t2),r.right._t1=Sh.map(t,0,1,this._t1,this._t2),r.right._t2=Sh.map(1,0,1,this._t1,this._t2),n?(n=Sh.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]=Sh.droots(r),3===this.order&&(r=this.dpoints[1].map(i),t[n]=t[n].concat(Sh.droots(r))),t[n]=t[n].filter((function(t){return t>=0&&t<=1})),e=e.concat(t[n].sort(Sh.numberSort))}.bind(this)),t.values=e.sort(Sh.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]=Sh.getminmax(this,n,t[n])}.bind(this)),e}overlaps(t){const e=this.bbox(),n=t.bbox();return Sh.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=Sh.angle(this.points[0],this.points[3],this.points[1]),e=Sh.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),Nh(Ph(n))<Dh/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,Nh(n-i)<r)return[];e=t.split(n,i),e._t1=Sh.map(n,0,1,t._t1,t._t2),e._t2=Sh.map(i,0,1,t._t1,t._t2),s.push(e),n=i;break}n<1&&(e=t.split(n,1),e._t1=Sh.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=Sh.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]=Sh.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=Rh(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]=Sh.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=Sh.makeline(h[2],d[0]),p=Sh.makeline(d[2],h[0]),m=[f,new e(d),p,new e(h)];return new Ah(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 Sh.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=Sh.makeline(v,p),b=Sh.makeline(m,g),k=[y].concat(a).concat([b]).concat(c);return new Ah(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=Sh.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=Mh(t.p1.x,t.p2.x),n=Mh(t.p1.y,t.p2.y),i=Fh(t.p1.x,t.p2.x),r=Fh(t.p1.y,t.p2.y);return Sh.roots(this.points,t).filter((t=>{var o=this.get(t);return Sh.between(o.x,e,i)&&Sh.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=Sh.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=Sh.dist(t,e),l=Sh.dist(t,o),c=Sh.dist(t,s);return Nh(l-a)+Nh(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=Sh.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*Ch(a.e),y:a.y+a.r*Oh(a.e)};a.e+=Sh.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 Bh={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 Lh({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 Lh(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 Lh(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 zh{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{Wh(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 Wh(t,e,n){let i=t[e];t[e]=t[n],t[n]=i}function $h(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 Uh={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 zh(n,i);let o=[];for(let n=0;n<e;n++)o.push($h(n/(e-1),r,t));return o}};function jh(t,e=256,n={}){return"bezier"===n.type?Bh.pointsToCurve(t,e,n):Uh.pointsToCurve(t,e)}const qh=[];for(let t=0;t<256;t++)qh[t]=t;class Vh extends Xd{constructor(t){const e={vertex:dh,fragment:hh},n={uniforms:Xd.getUniformInfo(Vh)};super(Vh.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,jh(n,256).map((t=>255*t))):qh],this.uniforms[Ud.STATIC_OPTIONS].set(e)}}function Hh(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 Gh extends Xd{constructor(t){const e={vertex:dh,fragment:hh},n={uniforms:Xd.getUniformInfo(Gh)};super(Gh.getFilterType(),e,n,t)}static getFilterType(){return"levels"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=[...Hh(t.black,t.white,t.gamma)];this.uniforms[Ud.STATIC_OPTIONS].set(e)}}const Kh=360,Xh=[];for(let t=0;t<Kh;t++)Xh[t]=t;class Yh extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(Yh)};super(Yh.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 jh(t,Kh,{type:"bezier"}).map((t=>{return e=t,((Math.round(e.x*Kh)+180)%Kh+(1-e.y-.5)*Kh+Kh)%Kh;var e}))}(t.points)||Xh;this.uniforms[Ud.STATIC_OPTIONS].set(e)}}class Qh extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(Qh)};super(Qh.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[Ud.STATIC_OPTIONS].set([e,n])}}class Jh extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(Jh)};super(Jh.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[Ud.STATIC_OPTIONS].set([e,n,i,r])}}class Zh extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(Zh)};super(Zh.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[Ud.STATIC_OPTIONS].set([e])}}class tf extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(tf)};super(tf.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[Ud.FIRST_TEXTURE,zd,Wd]}handleStaticUniforms(t){let e={...tf.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[Ud.STATIC_OPTIONS].set([n,i,r,o,s,a,l,c,h,f,d,u])}}class ef extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(ef)};super(ef.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[Ud.STATIC_OPTIONS].set([n,i,r,o])}}class nf extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(nf)};super(nf.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 rf extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(rf)};super(rf.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[Ud.STATIC_OPTIONS].set([e,n])}}class of extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(of)};super(of.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[Ud.STATIC_OPTIONS].set([e])}}var sf,af,lf,cf,uf,df,hf,ff;function pf(){if(cf)return lf;cf=1;const t=af?sf:(af=1,sf={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"]}};lf=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]},lf}function mf(){if(df)return uf;df=1;const t=pf();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 uf=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 vf=function(){if(ff)return hf;ff=1;const t=pf(),e=mf(),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)}))})),hf=n}(),gf=eu(vf);class yf extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(yf)};super(yf.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=gf.hex.rgb(t.color).map((t=>t/255));this.uniforms[Ud.STATIC_OPTIONS].set([e[0],e[1],e[2]])}}class bf extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(bf)};super(bf.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[Ud.STATIC_OPTIONS].set([e.from,e.to,...e.ease])}static getUniformList(){return[Ud.FIRST_TEXTURE,$d]}}class kf extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(kf)};super(kf.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[Ud.STATIC_OPTIONS].set([e.from,e.to,...e.ease])}static getUniformList(){return[Ud.FIRST_TEXTURE,$d]}}class xf extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(xf)};super(xf.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[Ud.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[Ud.FIRST_TEXTURE,$d]}}class wf extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(wf)};super(wf.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[Ud.STATIC_OPTIONS].set([e.from,e.to,...e.ease,n.x,n.y])}static getUniformList(){return[Ud.FIRST_TEXTURE,$d,zd]}}class _f extends Xd{constructor(t){const e={uniforms:Xd.getUniformInfo(_f)};super(_f.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=gf.hex.rgb(n).map((t=>t/255));this.uniforms[Ud.STATIC_OPTIONS].set([e.from,e.to,...e.ease,i[0],i[1],i[2]])}static getUniformList(){return[Ud.FIRST_TEXTURE,$d]}}var Tf=Object.freeze({__proto__:null,Crop:tf,Curves:Vh,Default:Yd,DipToBlackTransition:kf,DirectionalBlur:sh,Exposure:of,ExposureTransition:bf,FadeToColorTransition:_f,FastBlur:oh,HardLight:yf,HorizontalBlur:ih,Hue:Yh,Lab:rf,Levels:Gh,Lut:uh,MotionBlurTransition:wf,Opacity:ah,Saturation:Zh,ShapeComposite:ch,ShapeCompositeMask:lh,Solid:ef,SolidImage:nf,Transform:nh,TransformTransition:xf,VerticalBlur:rh,Vibrance:Jh,WhiteBalance:Qh});const If=Object.values(Tf).reduce(((t,e)=>(t[e.getFilterType()]=e,t)),{});class Ef{constructor(t){this.context=t}static getFilterClass(t){return If[t]}getFilterIds(){return Object.keys(this.filterTypeToInstanceMap)}create(t,e){this.context={...this.context,options:e.options};const n=new If[t](this.context);if(!n)throw new Error(`${t} is not a atom filter, atomFilter list: `,this.getFilterIds());return n}}const Sf=$u.PREVIOUS_OUTPUT_PREFIX,Af=Object.values(Tf).reduce(((t,e)=>(t[e.getFilterType()]={type:e.getFilterType(),options:e.getInitialOptions(),inputs:[...Array(e.getInputsCount())].map(((t,e)=>`${Sf}${e}`)),outputs:[]},t)),{});var Nf,Mf,Ff=function(){if(Mf)return Nf;Mf=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)}),{})},Nf=s}(),Cf=eu(Ff),Of=function(t,e){return Cf(t,e,{arrayMerge:(t,e)=>e})};const Pf=$u.MESSAGES.UPDATE_OPTIONS;let Rf=class{constructor(t,e){this.eventEmitter=new Hu,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(Pf,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 Df extends Rf{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=Of(this.options,t),this.filter.updateStaticUniforms(this.options)}dispose(){this.filter.dispose()}}const Lf=$u.MESSAGES.UPDATE_OPTIONS;let Bf=class extends Df{constructor(t,e,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}baseNodeUpdateOptions(t){this.options=Of(this.options,t),this.filter.updateStaticUniforms(this.options)}registerListeners(){this.baseNode.getEventEmitter().on(Lf,this.baseNodeUpdateOptions,this)}dispose(){this.filter.dispose(),this.baseNode.getEventEmitter().off(Lf,this.baseNodeUpdateOptions,this)}};function zf(t){return null!==t&&"object"==typeof t}function Wf(t){if(!zf(t)||(e=t,Array.isArray(e)))return t;var e;const n=Object.keys(t).sort(),i={};return n.forEach((e=>{i[e]=Wf(t[e])})),i}function $f(t,e){return null!=t&&t.id&&null!=e&&e.id?t.type===e.type&&t.id===e.id:t.type===e.type}function Uf(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)),zf(i=n)&&zf(r)?JSON.stringify(Wf(i))===JSON.stringify(Wf(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]&&$f(a,c[l])?l:c.findIndex((t=>$f(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 jf(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=ep.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 qf=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 jf(Uf(r,o),r,n,i)};class Vf extends Rf{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=>ep.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 Ju(e),r=[];this.nodes.forEach(((e,o)=>{const s={ioStore:t,graphIOManager:n};i=e.render(s),o!==this.nodes.length-1&&r.push(i)})),n.disposeTextures(r,i)}return n.setOutputs(e,r,i),i}getOptionsDisplay(){return[]}_updateOptions(t){this.nodes=qf(t,this.options,this.nodes,this.context),this.options=t}dispose(){this.nodes.forEach((t=>{t.dispose()}))}}const Hf=$u.MESSAGES.UPDATE_OPTIONS;class Gf extends Vf{constructor(t,e,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}registerListeners(){this.baseNode.getEventEmitter().on(Hf,this.updateOptions,this)}dispose(){this.nodes.forEach((t=>{t.dispose()})),this.baseNode.getEventEmitter().off(Hf,this.updateOptions,this)}}const Kf=$u.SYSTEM_NODES.TAGS.ATOM,Xf=$u.SYSTEM_NODES.TAGS.FILTER,Yf=$u.SYSTEM_NODES.TAGS.COMPOSITE_FILTER,Qf=$u.SYSTEM_NODES.TAGS.TRANSITION_FILTER,Jf=$u.PREVIOUS_OUTPUT_PREFIX,Zf=Object.keys(Af);function tp(t,e){const n=(i=t.type,Af[i]);var i;return t=Of(n,t),new Df(t.type,t,e)}var ep={create:function(t,e){let n;switch(function(t){let e;return n=t,e=Zf.includes(n)?Kf:t===Yf?Yf:t===Qf?Qf:Xf,e;var n}((t=JSON.parse(JSON.stringify(t))).type)){case Kf:n=tp(t,e);break;case Xf: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=Of(r,t),e={...e,baseNode:n},o=i===Yf?new Gf(i,t,e):new Bf(i,t,e),o}(t,e);break;case Yf:n=function(t,e){const n=t.type;return t=Of({inputs:[`${Jf}0`]},t),new Vf(n,t,e)}(t,e);break;case Qf: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`,tp(t,e)}(t,e);break;default:throw new Error("cant create node",t.type)}return n}};const np=$u.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS;var ip=function(t){const e={[np]:Af[np]};for(const[n,i]of Object.entries(e)){const e=ep.create(i,t);t.nodeStore.set(n,e)}},rp=function(t,e){for(const[n,i]of Object.entries(t)){const t=ep.create(i,e);e.nodeStore.set(n,t)}};const op=$u.CAPTURED_FRAME_PREFIX;class sp{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=`${op}${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 ap=yu("ShaderGraphApplication","warn"),lp=$u.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS,cp=Object.freeze({useCanvasSizedFilterTargets:!1,rebindAttributesOnProgramSwitch:!0,forwardContextAttributes:!0});function up(t={}){const e=null==t?void 0:t.performanceToggles;return e&&"object"==typeof e?{...cp,...e}:{...cp}}class dp{constructor(t,e={}){return this.glSource=t,this.config=e,this.performanceToggles=up(e),this.isContextLost=!1,this.isRecovering=!1,this.isDisposed=!1,this.pendingNodeOptionUpdates=new Map,this.doInit(t,e)}doInit(t,e){this.source=Yu(t),this.performanceToggles=up(e),this.isDisposed=!1,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=cp){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(),"undefined"!=typeof window&&(window.ekoShaderGraph=this),this.selectedRenderNode=null,this.activeTextures=this.activeTextures||new Set,this.textureManager=new sd({gl:this.gl,activeTextures:this.activeTextures}),this.capturedFramesManager=new sp({textureManager:this.textureManager}),this.graphIOManager=new pd({glSource:t,gl:this.gl,textureManager:this.textureManager,capturedFramesManager:this.capturedFramesManager}),this.frameBufferFactory=new xd({gl:this.gl,textureManager:this.textureManager,useCanvasSizedFilterTargets:this.performanceToggles.useCanvasSizedFilterTargets}),this.filterFactory=new Ef({gl:this.gl,frameBufferFactory:this.frameBufferFactory,rebindAttributesOnProgramSwitch:this.performanceToggles.rebindAttributesOnProgramSwitch}),this.nodeStore=new Ju,this.ioStore=new Ju,ip({nodeStore:this.nodeStore,filterFactory:this.filterFactory}),this.addClientNodes(e.nodes,this.isRecovering),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)}}getNodes(){return ap.debug("[getNodes]"),this.nodeStore.get()}addClientNodes(t,e=!1){if(ap.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));rp(n,{nodeStore:this.nodeStore,filterFactory:this.filterFactory})}addTexture(t,e,n){if(ap.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){ap.debug("[releaseTexture]",t),this.isContextUnavailable()||this.textureManager.releaseTexture(t)}selectNode(t){if(ap.debug("[selectNode]",t),!this.isContextUnavailable())return this.nodeStore.get(t)||ap.warn("Missing render node",t),void(this.selectedRenderNodeId=t);this.selectedRenderNodeId=t}captureTexture(){return ap.debug("[captureTexture]"),this.isContextUnavailable()?null:this.capturedFramesManager.createCaptureId()}disposeTexture(t){return ap.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}}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){ap.error("Failed to apply pending node options",e,t),this.queueNodeOptionUpdate(e,n)}return}this.updateOptions(e,n)}catch(t){ap.error("Failed to apply pending node options",e,t)}}))}render(t={}){var e,n;const{noRaf:i=!1}=t;if(this.isContextUnavailable())return;if(this.dirtyCanvasSize){let{width:t=this.gl.canvas.width,height:e=this.gl.canvas.height}=this.dirtyCanvasSize;yd(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}const r=null===(e=this.gl)||void 0===e||null===(e=e.canvas)||void 0===e?void 0:e.width,o=null===(n=this.gl)||void 0===n||null===(n=n.canvas)||void 0===n?void 0:n.height;Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0&&(yd(r,o),this.gl.viewport(0,0,r,o)),this.graphIOManager.setVideoSources(this.ioStore);let s={ioStore:this.ioStore,graphIOManager:this.graphIOManager};this.renderSelectedNode(s),this.config.onPreRenderToScreen&&this.config.onPreRenderToScreen(),this.renderToCanvas(s),this.config.onPostRenderToScreen&&this.config.onPostRenderToScreen(),this.graphIOManager.disposeAllStore(this.ioStore),s=null,!i&&!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):(ap.warn("Missing selected render node",this.selectedRenderNodeId),this.selectedRenderNodeId=null)}renderToCanvas(t){const e=this.nodeStore.get(lp);e&&"function"==typeof e.render?e.render(t):ap.warn("Missing render-to-canvas node")}updateOptions(t,e){if(ap.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){ap.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(){ap.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),ap.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=>{ap.debug("Re-adding client nodes",t),this.addClientNodes(t,!0)})),Object.entries(e).forEach((([t,e])=>{ap.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&&(ap.debug("Recovering glSource (i.e. seeking/resetting player)"),await this.source.recover()),this.isContextLost=!1,this.isRecovering=!1,o&&this.render()}catch(t){ap.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 hp{constructor(t={}){this.options=t}get type(){return"stage"}getSignature(){return this.type}build({inputs:t=[]}={}){return{graph:[],outputs:t,signature:this.getSignature()}}}function fp(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 pp extends hp{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:fp(a)}),o.push(l)}return{graph:r,outputs:o,signature:this.getSignature()}}}class mp{#A=new Map;constructor(){this.register("retarget",pp)}register(t,e){t&&"function"==typeof e&&this.#A.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.#A.get(e);return n?new n((null==t?void 0:t.options)||{}):null}}class vp{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 gp extends vp{#N=null;#M=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=gp.buildLayoutGraph({inputs:t}),r=e.signature;this.#N!==r&&(i.updateOptions(o,{graph:e.graph}),this.#N=r),this.#M!==o&&(i.selectNode(o),this.#M=o),i.render({noRaf:!0})}catch(t){}}}var yp=new WeakMap,bp=new WeakMap,kp=new WeakSet;class xp extends vp{constructor(...t){super(...t),O(this,kp),F(this,yp,null),F(this,bp,null)}static get type(){return"side-by-side"}static get aliases(){return["SideBySideRenderNode","side-by-side","sidebyside"]}static get requiresFrameCadence(){return!1}static get panAndScanTarget(){return"skip"}static buildLayoutGraph({inputs:t=[]}={}){const e=t.length;if(e<=1)return super.buildDefaultLayoutGraph(t);const n=1/e,i=[],r=t.map(((t,e)=>{const r=(e+.5)*n,o=`slice-${e}`;return i.push({id:`side-by-side-crop-${e}`,type:"crop",inputs:[t],outputs:[o],options:{source:{center:{x:.5,y:.5},width:1,height:1},target:{center:{x:r,y:.5},width:n,height:1},fitType:"fill",cornerRadius:0,edgeSoftness:0}}),o}));let o=r[0];for(let t=1;t<e;t+=1){const e=(t+.5)*n*2-1;i.push({id:`side-by-side-mask-${t}`,type:"shapeCompositeMask",inputs:[r[t],o],outputs:["accum"],options:{type:"box",center:{x:e,y:0},area:{width:n,height:1},radius:0,edgeSoftness:0}}),o="accum"}return{type:xp.type,signature:`${xp.type}:${t.length}`,isDynamic:!1,graph:i}}static prepareRenderFrames({frames:t,state:e}={}){const n=Array.isArray(t)?t:[],i=e&&"object"==typeof e?e:{},r=Array.isArray(i.frames)?i.frames:[];if(!n.length&&!r.length)return i.frames=[],i!==e&&e&&"object"==typeof e&&Object.assign(e,i),[];const o=Math.max(n.length,r.length,2),s=Array.from({length:o}),a=n[0]||r[0];for(let t=0;t<o;t+=1)s[t]=n[t]||r[t]||a;return i.frames=s,i!==e&&e&&"object"==typeof e&&Object.assign(e,i),s}static resetRenderState(t){t&&"object"==typeof t&&(t.frames=null)}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.sideBySide;if(o){if(1===n.length){const t=null==r?void 0:r.default;try{A(kp,this,wp).call(this,i,t)}catch(t){}return}try{A(kp,this,_p).call(this,i,o,n)}catch(t){}}}}function wp(t,e){if(!e)return;const n=oe.buildLayoutGraph({inputs:["__SRC_TEXTURE:0"]}),i=n.signature;M(yp,this)!==i&&(t.updateOptions(e,{graph:n.graph}),C(yp,this,i)),M(bp,this)!==e&&(t.selectNode(e),C(bp,this,e)),t.render({noRaf:!0})}function _p(t,e,n){const i=Array.isArray(n)?n.length:0;if(!e||!i||i<2)return;const r=n.map(((t,e)=>t?`__SRC_TEXTURE:${e}`:null)).filter(Boolean),o=oe.buildLayoutGraph({inputs:r}),s=o.signature;M(yp,this)!==s&&(t.updateOptions(e,{graph:o.graph}),C(yp,this,s)),M(bp,this)!==e&&(t.selectNode(e),C(bp,this,e)),t.render({noRaf:!0})}function Tp(t){const e=Number(t);return Number.isFinite(e)?e<=0?0:e>=1?1:e:0}oe=xp;class Ip extends vp{#N=null;#M=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=Tp(e),i=[{type:"opacity",inputs:[t[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",t[0]],options:{}}];return{type:Ip.type,signature:`${Ip.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=Tp((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.#N!==e){const n=Ip.buildLayoutGraph({inputs:["__SRC_TEXTURE:0"]});i.updateOptions(t,{graph:n.graph}),this.#N=e}this.#M!==t&&(i.selectNode(t),this.#M=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=Ip.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.#N===r&&this.#F===a||(i.updateOptions(o,{graph:n.graph}),this.#N=r,this.#F=a),this.#M!==o&&(i.selectNode(o),this.#M=o),i.render({noRaf:!0})}catch(t){}}}function Ep(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 Sp(t){return!(!t||!0===t.offsetPending)&&Number.isFinite(t.offset)}function Ap(t){return Sp(t)?t.offset:void 0}function Np(t,e,n,i={}){if(!t)return!1;const r=Ap(t);if(!Number.isFinite(r))return!1;const o=Ep(t,n,i);return Number.isFinite(o)?e>=r&&e<r+o:e>=r}function Mp(t=[]){if(!Array.isArray(t))return t;const e=[],n=[];return t.forEach((t=>{Sp(t)?e.push(t):n.push(t)})),e.sort(((t,e)=>t.offset-e.offset)),t.splice(0,t.length,...e,...n),t}function Fp(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=Ap(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&&Mp(t),{updated:a,resolvedPlacements:l}}function Cp(t){const e=Number(t);return Number.isFinite(e)?e:0}function Op(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 Pp(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 Rp(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 Dp(t){const e=Number(t);return Number.isFinite(e)&&e>0?e:0}function Lp(t){return(null==t?void 0:t.id)||(null==t?void 0:t.nodeId)||null}function Bp(t,e){return Array.isArray(t)&&e?t.findIndex((t=>Lp(t)===e)):-1}function zp(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=Bp(e,n);return t>=0?(t+1)%i:0}if("prev"===t){const t=Bp(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)?Lp(e[i]):null}function Wp(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=Ap(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)=>Ap(t)-Ap(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 $p(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 Up(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 jp(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($p(n,r,t))return r}return null}function qp(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 Vp extends vp{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=Tp(e),i=[{type:"opacity",inputs:[t[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",t[0]],options:{}}];return{type:Vp.type,signature:`${Vp.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:Tp(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&&(qp(a),a.activeRenderPlacementId=l);const c=null==r?void 0:r.initSwitching,u=Wp(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=Up(a.placements,a.selectedPlacementId),i=zp(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=zp(Number.isInteger(t)&&t>=0?t:0,a.nodes,null);let n=null;if(e&&(n=jp(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&&$p(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=jp(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=Dp(a.pendingSwitch.crossfadeSeconds),s=Dp(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=Tp(t/a.switchDuration))}a.switchNormalizedTime=Number.isFinite(p)?p:void 0;const m=Up(a.placements,a.selectedPlacementId),v=$p(s,a.selectedPlacementId,m)||s[0];let g=null;if(Number.isFinite(a.switchNormalizedTime)&&a.previousPlacementId){const t=Up(a.placements,a.previousPlacementId),e=Up(a.placements,a.selectedPlacementId),n=$p(s,a.previousPlacementId,t),i=$p(s,a.selectedPlacementId,e);n&&i&&(g=[n,i])}return g||(g=v?[v]:s),g}static resetRenderState(t){t&&"object"==typeof t&&qp(t)}}const Hp=[gp,xp,Ip,Vp],Gp=new Map;function Kp(t){if("string"!=typeof t)return null;const e=t.trim();return e?e.toLowerCase():null}function Xp(t){const e=Kp(t);return e&&Gp.get(e)||null}function Yp(t){return Xp(t)||gp}Hp.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=Kp(e);n&&Gp.set(n,t)}))}(t)));class Qp{static get defaultType(){return gp.type||"default"}static getRenderNodeClass(t){return Xp(t)}static normalizeType(t){const e=Xp(t);return e?e.type:null}static doesRenderNodeTypeRequireFrameCadence(t){const e=Xp(t);return!!e&&!0===e.requiresFrameCadence}static buildLayoutGraph({type:t,inputs:e=[],normalizedTime:n}={}){const i=Yp(t);return i&&"function"==typeof i.buildLayoutGraph?i.buildLayoutGraph({inputs:e,normalizedTime:n}):gp.buildLayoutGraph({inputs:e,normalizedTime:n})}static getPanAndScanTarget(t){const e=Yp(t);return"post"===(n=null==e?void 0:e.panAndScanTarget)||"skip"===n?n:"pre";var n}static prepareRenderFrames({type:t,frames:e,timelineTime:n,timeline:i,active:r,renderNodeParams:o,state:s}={}){const a=Yp(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=Yp(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=Yp(t);n&&"function"==typeof n.resetRenderState&&n.resetRenderState(e)}static resetAllRenderStates(t){t&&"function"==typeof t.forEach&&t.forEach(((t,e)=>{Qp.resetRenderState(e,t)}))}create(t,e){return t&&"function"==typeof t.render?t:new(Yp(t))(e)}}function Jp(t){return Array.isArray(t)?t.filter((t=>t&&"string"==typeof t.type)):[]}function Zp(t,e){return t&&"function"==typeof t.getSignature?t.getSignature():(null==e?void 0:e.type)||"stage"}class tm{#C;constructor(t){this.#C=t||new mp}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=Qp.normalizeType(null==t?void 0:t.layoutType)||Qp.defaultType,r=null==t?void 0:t.normalizedTime,o=Jp(null==t?void 0:t.preStages),s=Jp(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(Zp(i,e))}));const u=Qp.buildLayoutGraph({type:i,inputs:c,normalizedTime:r}),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(Zp(i,e))})),{graph:a,signature:l.join("|"),isDynamic:d}}}const em=[0,0,1,1],nm="zoomInExposure",im=["transform","exposure","fadeToColor","dipToBlack"],rm={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 om(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}function sm(t,e=em){return Array.isArray(t)&&t.length>=4?t:e}function am(t){return"string"==typeof t&&t.trim()?t.trim():"#ffffff"}function lm(t,e){const n=null==t?void 0:t[e];return!1===n||null==n?null:ku(n)?n:{}}function cm(t={}){let e=0;return im.forEach((n=>{const i=lm(t,n);if(!i)return;const r=om(null==i?void 0:i.duration);r>e&&(e=r)})),e}function um(t,e,n,i,r){const o=[];return im.forEach((s=>{const a=lm(t,s);if(!a)return;const l=function(t,e,n){const i=om(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=sm(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=sm(null==e?void 0:e.ease),n=(null==e?void 0:e.power)||{from:0,to:1};return o.options.properties.power={from:om(null==n?void 0:n.from,0),to:om(null==n?void 0:n.to,1),ease:t},o.options.properties.color=am((null==e?void 0:e.color)||r),o}if("exposure"===t||"dipToBlack"===t){const t=sm(null==e?void 0:e.ease),n=(null==e?void 0:e.power)||{from:0,to:1};return o.options.properties.power={from:om(null==n?void 0:n.from,0),to:om(null==n?void 0:n.to,1),ease:t},o}return null}(s,a,e,l,r);c&&o.push(c)})),o}function dm(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 hm{#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(ku(null==t?void 0:t.transition))return t.transition;if("string"==typeof(null==t?void 0:t.transition))return rm[t.transition]||rm[nm];if(ku(null==t?void 0:t.filters)||ku(null==t?void 0:t.reverseFilters))return{filters:t.filters||{},reverseFilters:t.reverseFilters||{}};if("string"==typeof(null==t?void 0:t.filter)){const e=om(t.duration)>0?1e3*t.duration:500;return{filters:{[t.filter]:{duration:e,power:{from:0,to:1}}},reverseFilters:{}}}return rm[nm]}(t),n=xu({},(null==e?void 0:e.filters)||{},ku(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(ku(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=xu({},(null==e?void 0:e.reverseFilters)||{},ku(null==t?void 0:t.reverseFilters)?t.reverseFilters:{});return{baseFilters:n,reverseFilters:xu({},i,r)}}(t),r=om(null==t?void 0:t.duration),o=r>0?1e3*r:null,s=cm(n),a=cm(i),l=o&&s>0?o/s:1,c=o&&a>0?o/a:1,u=o||s||500,d=o||a||u,h=am(null==t?void 0:t.color),f=e.captureTexture(),p=Date.now(),m=um(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:dm(m),inGraph:null,inSignature:null},{captureId:f,outDurationMs:u,inDurationMs:d}}beginIncoming(){if(!this.#O)return;const t=Date.now(),e=um(this.#O.reverseFilters,t,this.#O.inScale,this.#O.durationOverrideMs,this.#O.color);this.#O={...this.#O,phase:"in",startTime:t,inGraph:e,inSignature:dm(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 fm;const pm=[/firefox\/(\d+)/,/edg\/(\d+)/,/opr\/(\d+)/,/chrome\/(\d+)/];function mm(){const t=Au&&Au.navigator&&(Au.navigator.userAgent||Au.navigator.platform||Au.navigator.vendor)||"";if(fm&&fm.ua===t)return fm;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<pm.length;e+=1){const n=pm[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 fm={ua:t,lowerUA:e,isAndroid:n,isiOS:i,isMobile:r,isDesktop:o,isFirefox:s,browserMajorVersion:a},fm}function vm(){return mm().ua}function gm(){return mm().isAndroid}function ym(){return mm().isiOS}function bm(){return mm().isMobile}function km(){return mm().isDesktop}function xm(){return mm().isFirefox}function wm(){return mm().browserMajorVersion}var _m={getUserAgent:vm,isAndroid:gm,isiOS:ym,isMobile:bm,isDesktop:km,isFirefox:xm,getBrowserMajorVersion:wm},Tm=Object.freeze({__proto__:null,default:_m,getBrowserMajorVersion:wm,getUserAgent:vm,isAndroid:gm,isDesktop:km,isFirefox:xm,isMobile:bm,isiOS:ym});const Im=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"});function Em(t,e){const n={};return Number.isFinite(t)&&(n.time=t),"string"==typeof e&&(n.source=e),n}function Sm({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 Am({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}const Nm="Idle",Mm="Playing",Fm="FirstFramePending",Cm="Waiting",Om="Paused",Pm="Seeking",Rm="Resetting";function Dm(t){return Array.isArray(t)?t.filter((t=>t&&"string"==typeof t.type)):[]}function Lm(t,e){return!!Array.isArray(t)&&t.some((t=>(null==t?void 0:t.type)===e))}function Bm(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 zm(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 Wm=2073600;function $m(t,e){const n=Number(t);return Number.isFinite(n)&&n>0?n:e}function Um(t,e){if(null==t)return e;const n=Number(t);return Number.isFinite(n)?n:e}var jm=new WeakMap,qm=new WeakMap,Vm=new WeakMap,Hm=new WeakMap,Gm=new WeakMap,Km=new WeakMap,Xm=new WeakMap,Ym=new WeakMap,Qm=new WeakMap,Jm=new WeakMap,Zm=new WeakMap,tv=new WeakMap,ev=new WeakMap,nv=new WeakMap,iv=new WeakMap,rv=new WeakMap,ov=new WeakMap,sv=new WeakMap,av=new WeakMap,lv=new WeakMap,cv=new WeakMap,uv=new WeakMap,dv=new WeakMap,hv=new WeakMap,fv=new WeakMap,pv=new WeakMap,mv=new WeakMap,vv=new WeakMap,gv=new WeakMap,yv=new WeakMap,bv=new WeakSet;class kv extends Iu{static get pipelineNodeId(){return"ekoplayer-render-pipeline"}get defaults(){return{defaultRenderParams:void 0,resourceLimits:{enabled:!0,maxCanvasPixels:Wm,maxDevicePixelRatio:0,renderScale:1,transitionMinFrameIntervalMs:33}}}constructor(...t){super(...t),O(this,bv),F(this,jm,void 0),F(this,qm,void 0),F(this,Vm,void 0),F(this,Hm,void 0),F(this,Gm,void 0),F(this,Km,void 0),F(this,Xm,void 0),F(this,Ym,void 0),F(this,Qm,void 0),F(this,Jm,void 0),F(this,Zm,null),F(this,tv,null),F(this,ev,void 0),F(this,nv,void 0),F(this,iv,void 0),F(this,rv,[]),F(this,ov,[]),F(this,sv,null),F(this,av,null),F(this,lv,null),F(this,cv,null),F(this,uv,null),F(this,dv,null),F(this,hv,new Map),F(this,fv,null),F(this,pv,null),F(this,mv,!1),F(this,vv,!1),F(this,gv,[]),F(this,yv,null);const[e,n,i]=t;C(jm,this,e),C(qm,this,n),C(Vm,this,i),M(jm,this)&&"function"==typeof M(jm,this).enableFirstFrameRenderedGate&&M(jm,this).enableFirstFrameRenderedGate(),C(Jm,this,new tm),C(ev,this,new hm),C(nv,this,null),C(iv,this,null),C(lv,this,null),C(Hm,this,(t=>A(bv,this,Zv).call(this,t))),M(jm,this)&&"function"==typeof M(jm,this).on&&(M(jm,this).on(Im.VISUAL_FRAMES_AVAILABLE,M(Hm,this)),C(Gm,this,(()=>{var t,e,n,i;A(bv,this,Tv).call(this),A(bv,this,Kv).call(this,0),C(ov,this,[]),C(sv,this,null),C(Zm,this,null),C(tv,this,null),A(bv,this,Bv).call(this),C(fv,this,null);(null===(t=M(ev,this))||void 0===t||null===(e=t.getState)||void 0===e?void 0:e.call(t))||null===(n=M(ev,this))||void 0===n||null===(i=n.reset)||void 0===i||i.call(n,M(nv,this))})),M(jm,this).on(Im.TIMELINE_SEEKING,M(Gm,this)),C(Km,this,(()=>A(bv,this,Iv).call(this))),M(jm,this).on(Im.TIMELINE_RESET,M(Km,this)),C(Qm,this,(()=>A(bv,this,Uv).call(this))),M(jm,this).on(Im.TIMELINE_TIME_UPDATE,M(Qm,this)),C(Xm,this,(()=>{A(bv,this,tg).call(this)&&M(av,this)&&A(bv,this,Zv).call(this,M(av,this))})),M(jm,this).on(Im.TIMELINE_STATE_CHANGE,M(Xm,this))),C(Ym,this,(()=>{C(sv,this,null),M(av,this)&&A(bv,this,tg).call(this)&&A(bv,this,Zv).call(this,M(av,this))})),M(Vm,this)&&"function"==typeof M(Vm,this).on&&M(Vm,this).on(Im.CONTAINER_RESIZE,M(Ym,this))}get name(){return"Renderer"}onDispose(){M(jm,this)&&M(Hm,this)&&"function"==typeof M(jm,this).off&&M(jm,this).off(Im.VISUAL_FRAMES_AVAILABLE,M(Hm,this)),M(jm,this)&&M(Gm,this)&&"function"==typeof M(jm,this).off&&M(jm,this).off(Im.TIMELINE_SEEKING,M(Gm,this)),M(jm,this)&&M(Km,this)&&"function"==typeof M(jm,this).off&&M(jm,this).off(Im.TIMELINE_RESET,M(Km,this)),M(jm,this)&&M(Qm,this)&&"function"==typeof M(jm,this).off&&M(jm,this).off(Im.TIMELINE_TIME_UPDATE,M(Qm,this)),M(jm,this)&&M(Xm,this)&&"function"==typeof M(jm,this).off&&M(jm,this).off(Im.TIMELINE_STATE_CHANGE,M(Xm,this)),M(Vm,this)&&M(Ym,this)&&"function"==typeof M(Vm,this).off&&M(Vm,this).off(Im.CONTAINER_RESIZE,M(Ym,this)),A(bv,this,xv).call(this),C(Hm,this,null),C(Gm,this,null),C(Km,this,null),C(Qm,this,null),C(Xm,this,null),C(Ym,this,null),C(Jm,this,null),C(ev,this,null),C(hv,this,null),C(fv,this,null),C(qm,this,null),C(Vm,this,null),C(jm,this,null)}startTransition(t={}){var e;const n=null===(e=M(qm,this))||void 0===e?void 0:e.element;if(!n)return null;if(A(bv,this,Sv).call(this,n),!M(nv,this))return null;const i=M(ev,this).start({shaderGraph:M(nv,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 C(lv,this,M(av,this)||null),A(bv,this,Yv).call(this),i}beginTransitionIn(t={}){var e,n;null!==(e=M(ev,this))&&void 0!==e&&null!==(n=e.beginIncoming)&&void 0!==n&&n.call(e,t),C(lv,this,null),A(bv,this,Yv).call(this)}resetTransition(){var t,e;null!==(t=M(ev,this))&&void 0!==t&&null!==(e=t.reset)&&void 0!==e&&e.call(t,M(nv,this)),C(lv,this,null),A(bv,this,Qv).call(this)}}function xv(){if(A(bv,this,Tv).call(this),M(ev,this)&&"function"==typeof M(ev,this).reset&&M(ev,this).reset(M(nv,this)),A(bv,this,Kv).call(this,0),M(nv,this)&&"function"==typeof M(nv,this).dispose)try{M(nv,this).dispose()}catch(t){}C(nv,this,null),C(iv,this,null),C(rv,this,[]),C(ov,this,[]),C(sv,this,null),C(Zm,this,null),C(tv,this,null),C(av,this,null),C(lv,this,null),A(bv,this,Qv).call(this),A(bv,this,Bv).call(this),C(fv,this,null)}function wv(){return{schedule:"function"==typeof Au.requestAnimationFrame?Au.requestAnimationFrame.bind(Au):t=>setTimeout(t,16),cancel:"function"==typeof Au.cancelAnimationFrame?Au.cancelAnimationFrame.bind(Au):clearTimeout}}function _v(t){C(gv,this,M(gv,this).filter((e=>e!==t))),M(gv,this).length||C(yv,this,null)}function Tv(){M(yv,this)&&M(gv,this).forEach((t=>M(yv,this).call(this,t))),C(gv,this,[]),C(yv,this,null),C(vv,this,!1)}function Iv(){A(bv,this,Tv).call(this),C(mv,this,!1)}function Ev(){if(M(mv,this)||M(vv,this))return;const{schedule:t,cancel:e}=A(bv,this,wv).call(this);let n;C(yv,this,e),C(vv,this,!0),n=t((()=>{let e;A(bv,this,_v).call(this,n),e=t((()=>{A(bv,this,_v).call(this,e),C(vv,this,!1),M(mv,this)||(C(mv,this,!0),M(jm,this)&&"function"==typeof M(jm,this).notifyFirstFrameRendered&&M(jm,this).notifyFirstFrameRendered())})),M(gv,this).push(e)})),M(gv,this).push(n)}function Sv(t){if(M(nv,this)||!t)return;const e=this,n={dest:t,src:(t,n)=>{C(iv,e,n)}};C(nv,e,new dp(n,{userWillCallRender:!0,glOptions:{contextType:"webgl2"},performanceToggles:{useCanvasSizedFilterTargets:!0}})),M(nv,e)&&"function"==typeof M(nv,e).addNodes&&M(nv,e).addNodes({[se.pipelineNodeId]:{type:"composite",options:{graph:[]}}})}function Av(){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 Nv(){const t=A(bv,this,Av).call(this).enabled;return!0===t||!1!==t&&ym()}function Mv(){if(!A(bv,this,Nv).call(this))return 0;const t=Um(A(bv,this,Av).call(this).transitionMinFrameIntervalMs,33);return Number.isFinite(t)&&t>0?t:0}function Fv(t,e,n={}){const i=!0===(null==n?void 0:n.useDevicePixelRatio),r=A(bv,this,Nv).call(this),o=i?$m(null==Au?void 0:Au.devicePixelRatio,1):1;let s=o,a=0;if(r){const t=A(bv,this,Av).call(this);a=Um(t.maxCanvasPixels,Wm);const e=Um(t.maxDevicePixelRatio,0);s=$m(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 Cv(t=[],e={}){var n;const i=null===(n=M(qm,this))||void 0===n?void 0:n.element,r=M(iv,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=M(Vm,this))||void 0===c?void 0:c.containerWidth)&&void 0!==l?l:null===(u=M(Vm,this))||void 0===u?void 0:u.width),e=Number(null!==(d=null===(h=M(Vm,this))||void 0===h?void 0:h.containerHeight)&&void 0!==d?d:null===(f=M(Vm,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=A(bv,this,Fv).call(this,o,s,{useDevicePixelRatio:a}),v=m.width,g=m.height,y=M(sv,this);return!(y&&y.width===v&&y.height===g||(C(sv,this,{width:v,height:g}),r(null,null,v,g),0))}function Ov(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 Pv(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=A(bv,this,Rv).call(this,t),s=A(bv,this,Dv).call(this,o);return Qp.getRenderTiming({type:o,timing:{duration:i,normalizedTime:r},timelineTime:e,active:t,renderNodeParams:n,state:s})}function Rv(t){return Qp.normalizeType(null==t?void 0:t.type)||Qp.defaultType}function Dv(t){if(!t||!M(hv,this))return null;let e=M(hv,this).get(t);return e||(e={},M(hv,this).set(t,e)),e}function Lv(t){if(!t||!M(hv,this))return;const e=M(hv,this).get(t);e&&Qp.resetRenderState(t,e),M(hv,this).delete(t)}function Bv(){M(hv,this)&&(Qp.resetAllRenderStates(M(hv,this)),M(hv,this).clear())}function zv(t,e,n,i){const r=A(bv,this,Rv).call(this,t);M(fv,this)&&M(fv,this)!==r&&A(bv,this,Lv).call(this,M(fv,this)),C(fv,this,r);const o=A(bv,this,Dv).call(this,r);return Qp.prepareRenderFrames({type:r,frames:e,timelineTime:n,timeline:M(jm,this),active:t,renderNodeParams:i,state:o})}function Wv(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 $v(t){return t?String(t.renderPlacementId||t.type||"unknown"):"default"}function Uv(){if(!M(jm,this)||!M(av,this))return;const t=M(jm,this).currentTime,e=M(jm,this).getActiveRenderPlacement(t),n=A(bv,this,$v).call(this,e);n!==M(pv,this)&&(C(pv,this,n),A(bv,this,Zv).call(this,{...M(av,this),time:t}))}function jv(t){return!t||"object"!=typeof t||!Object.prototype.hasOwnProperty.call(t,"panAndScan")||!1!==t.panAndScan}function qv(t,e){const n=A(bv,this,Wv).call(this,t),i=null==n?void 0:n.stages;let r=Dm(null==i?void 0:i.pre),o=Dm(null==i?void 0:i.post);const s=A(bv,this,jv).call(this,n),a=A(bv,this,Rv).call(this,t),l=Lm(r,"retarget")||Lm(o,"retarget");if(s&&!l){const t=Qp.getPanAndScanTarget(a);if("pre"===t){const t=Bm(Array.isArray(e)?e.length:0);t&&(r=[t,...r])}else if("post"===t){const t=Bm(1);t&&(o=[...o,t])}}else s||(r=zm(r),o=zm(o));return{preStages:r,postStages:o,renderNodeParams:n}}function Vv(t,e,n,i,r){const o=r||A(bv,this,Pv).call(this,t,n,i),s=A(bv,this,qv).call(this,t,e);return M(Jm,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,timelineTime:n})}function Hv(){var t,e;const n=null===(t=M(ev,this))||void 0===t||null===(e=t.getState)||void 0===e?void 0:e.call(t);return"out"===(null==n?void 0:n.phase)?M(ev,this).buildOutgoingGraph():"in"===(null==n?void 0:n.phase)?M(ev,this).buildIncomingGraph():null}function Gv(t,e,n,i){const r=n||e!==M(Zm,this),o=r||i;return r&&M(nv,this)&&"function"==typeof M(nv,this).updateOptions&&(M(nv,this).updateOptions(se.pipelineNodeId,{graph:t}),C(Zm,this,e)),M(nv,this)&&"function"==typeof M(nv,this).selectNode&&M(tv,this)!==se.pipelineNodeId&&(M(nv,this).selectNode(se.pipelineNodeId),C(tv,this,se.pipelineNodeId)),!(!o||!M(nv,this)||"function"!=typeof M(nv,this).render||(M(nv,this).render({noRaf:!0}),0))}function Kv(t){if(!Array.isArray(M(rv,this))||!M(rv,this).length)return;const e=Number.isFinite(t)?Math.max(0,t):0;if(!(M(rv,this).length<=e)){for(let t=e;t<M(rv,this).length;t+=1){const e=M(rv,this)[t];if(e&&M(nv,this)&&"function"==typeof M(nv,this).releaseTexture)try{M(nv,this).releaseTexture(e)}catch(t){}}M(rv,this).length=e,M(ov,this).length=e}}function Xv(t=[]){if(!M(nv,this)||"function"!=typeof M(nv,this).addTexture)return!1;if("function"==typeof M(nv,this).isContextUnavailable&&M(nv,this).isContextUnavailable())return!1;if(!Array.isArray(t)||!t.length)return A(bv,this,Kv).call(this,0),!1;A(bv,this,Kv).call(this,t.length);let e=!1;for(let i=0;i<t.length;i+=1){var n;M(rv,this)[i]||"function"!=typeof M(nv,this).addTexture||(M(rv,this)[i]=M(nv,this).addTexture(null,"frame",i));const r=A(bv,this,Ov).call(this,t[i]),o=null===(n=t[i])||void 0===n?void 0:n.frame;if(M(rv,this)[i]&&o&&(!r||r!==M(ov,this)[i]))try{M(rv,this)[i].fill(o),M(ov,this)[i]=r,e=!0}catch(t){}}return e}function Yv(){if(M(cv,this))return;const t="function"==typeof Au.requestAnimationFrame?t=>Au.requestAnimationFrame(t):t=>setTimeout(t,16),e="function"==typeof Au.cancelAnimationFrame?t=>Au.cancelAnimationFrame(t):clearTimeout;C(uv,this,e);const n=()=>{var e,i;if(null!==(e=M(ev,this))&&void 0!==e&&null!==(i=e.getState)&&void 0!==i&&i.call(e)){if(M(av,this)){const t=A(bv,this,Mv).call(this),e=Date.now();(!t||!M(dv,this)||e-M(dv,this)>=t)&&(C(dv,this,e),A(bv,this,Zv).call(this,M(av,this)))}C(cv,this,t(n))}else C(cv,this,null)};C(cv,this,t(n))}function Qv(){M(cv,this)&&M(uv,this)&&M(uv,this).call(this,M(cv,this)),C(cv,this,null),C(uv,this,null),C(dv,this,null)}function Jv(t){var e,n;const i=null===(e=M(ev,this))||void 0===e||null===(n=e.getState)||void 0===n?void 0:n.call(e);return"out"===(null==i?void 0:i.phase)&&M(lv,this)?M(lv,this):t}function Zv(t={}){var e,n;const i=null===(e=M(qm,this))||void 0===e?void 0:e.element,r=null===(n=M(qm,this))||void 0===n?void 0:n.gl;if(!i||!r)return;if(t&&C(av,this,t),!A(bv,this,tg).call(this))return;const o=A(bv,this,Jv).call(this,t),s=Number.isFinite(null==o?void 0:o.time)?o.time:void 0;if(!Number.isFinite(s))return;if(A(bv,this,Sv).call(this,i),!M(nv,this))return;const a=M(jm,this)&&"function"==typeof M(jm,this).getActiveRenderPlacement?M(jm,this).getActiveRenderPlacement(s):void 0,l=A(bv,this,$v).call(this,a);l!==M(pv,this)&&C(pv,this,l);const c=Array.isArray(null==o?void 0:o.frames)?o.frames:[],u=A(bv,this,Wv).call(this,a),d=A(bv,this,jv).call(this,u),h=A(bv,this,zv).call(this,a,c,s,u),f=A(bv,this,Pv).call(this,a,s,u),p=A(bv,this,Cv).call(this,h,{useViewportSize:d}),m=A(bv,this,Xv).call(this,h),v=A(bv,this,Vv).call(this,a,h,s,u,f),g=A(bv,this,Hv).call(this);let y=v.graph,b=v.signature,k=!!v.isDynamic;g&&Array.isArray(g.graph)&&g.graph.length&&(y=y.concat(g.graph),b=`${b}|${g.signature||"transition"}`,k=k||!!g.forceUpdate);const x=p||m||k||g&&Array.isArray(g.graph)&&g.graph.length;A(bv,this,Gv).call(this,y,b,k,x)&&h.length&&A(bv,this,Ev).call(this)}function tg(){var t;const e=null===(t=M(jm,this))||void 0===t?void 0:t.state;return e===Nm||e===Fm||e===Mm||e===Om}function eg(t){return"number"==typeof t&&Number.isFinite(t)&&t>0}function ng(t){return t&&"resource"===t.entryType&&t.transferSize>0&&t.duration>0&&t.responseEnd>=t.requestStart}function ig(t){return Array.isArray(t)&&0!==t.length?t.reduce(((t,e)=>t+e),0)/t.length:NaN}se=kv;var rg=new WeakMap,og=new WeakMap,sg=new WeakMap,ag=new WeakMap,lg=new WeakSet;class cg extends Iu{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),O(this,lg),F(this,rg,void 0),F(this,og,void 0),F(this,sg,void 0),F(this,ag,void 0),C(rg,this,!!(Au&&Au.navigator&&Au.navigator.connection)),C(og,this,!(!Au||!Au.performance||"function"!=typeof Au.performance.getEntriesByType)),C(sg,this,A(lg,this,dg).call(this)),C(ag,this,A(lg,this,vg).call(this))}guesstimate(){const t=A(lg,this,yg).call(this);this.log.debug("[guesstimate] Data:",t);const e=A(lg,this,gg).call(this,t),n=eg(e)?e:t.defaultKbps;return A(lg,this,hg).call(this,n),this.log.info(`[guesstimate] Result: ${n} kbps`),n}update(t){eg(t)&&A(lg,this,hg).call(this,t)}onDispose(){C(sg,this,void 0),C(ag,this,void 0)}}function ug(){return Math.round(Date.now()/1e3)}function dg(){try{if(!Au||!Au.localStorage||"function"!=typeof Au.localStorage.getItem)return}catch(t){return}const t=this.settings.persistentStorage.key,e=Au.localStorage.getItem(t);if(e)try{const t=JSON.parse(e),n=this.settings.persistentStorage.ttl,i=A(lg,this,ug).call(this)-t.timestamp;if("number"==typeof n&&n>=0&&i>n)return null;if(!eg(t.value))return;return t.value}catch(t){return}}function hg(t){if(!eg(t))return;try{if(!Au||!Au.localStorage||"function"!=typeof Au.localStorage.setItem)return}catch(t){return}const e=this.settings.persistentStorage.key,n=JSON.stringify({value:t,timestamp:A(lg,this,ug).call(this)});try{Au.localStorage.setItem(e,n),C(sg,this,t)}catch(t){}}function fg(){return Au&&Au.performance&&"function"==typeof Au.performance.getEntriesByType?ig(Au.performance.getEntriesByType("resource").filter(ng).map((t=>8*t.transferSize/t.duration))):NaN}function pg(){if(!Au||!Au.navigator||!Au.navigator.connection)return NaN;const t=Au.navigator.connection.downlink;return eg(t)?1e3*t:NaN}function mg(){if(!M(rg,this))return NaN;const t=Au.navigator.connection,e=t.effectiveType||t.type,n=this.settings.connectionType||{};return e&&Object.prototype.hasOwnProperty.call(n,e)?n[e]:NaN}function vg(){const t=this.settings.ua||{};return gm()?t.android:ym()?t.ios:t.desktop}function gg(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=>eg(t)));if(r.length===i.length)return this.log.debug("[#selectFromPriorities] Selected from priorities:",i,"with values:",r),ig(r)}return NaN}function yg(){const t=this.settings.testOverrides||{},e=eg(t.resourceTiming)?t.resourceTiming:A(lg,this,fg).call(this),n=eg(t.downlink)?t.downlink:A(lg,this,pg).call(this),i=eg(t.persistentValue)?t.persistentValue:M(sg,this),r=eg(t.connectionType)?t.connectionType:A(lg,this,mg).call(this),o=eg(t.ua)?t.ua:M(ag,this);return{defaultKbps:this.settings.defaultKbps,resourceTiming:e,downlink:n,connectionType:r,persistentValue:i,ua:o}}const bg=new bu;function kg(t){return"string"!=typeof t||0===t.length?[]:t.split(".").filter((t=>t.length>0))}function xg(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 wg(t){return null!==t&&"object"==typeof t}function _g(t,e,n){const i=kg(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 Tg(t,e,n){if(!wg(t))return t;const i=kg(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}wg(r[e])||(r[e]=xg(i[t+1])?[]:{}),r=r[e]}return t}const Ig={get:(t,e)=>Au&&Au.eko?_g(Au.eko,t,e):e,set(t,e){if(Au)return Au.eko&&"object"==typeof Au.eko||(Au.eko={}),Tg(Au.eko,t,e),Au.eko}},Eg=Au&&Au.performance,Sg=Eg&&"function"==typeof Eg.now?()=>Eg.now():()=>Date.now();function Ag(){return"undefined"==typeof AbortController?null:new AbortController}function Ng(){const t=new Error("The operation was aborted");return t.name="AbortError",t.code="ABORT_ERR",t}function Mg(t,e){return!(!e||!e.aborted)||!!t&&("AbortError"===t.name||"ABORT_ERR"===t.code||20===t.code)}const Fg=2,Cg=100,Og=2,Pg="runtime.downloadSpeedSamples",Rg=yu("download","warn");function Dg(t){return new Promise((e=>{setTimeout(e,t)}))}function Lg(t){return t>=500}function Bg(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 zg(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=Ig.get(r);t||(t=[],Ig.set(r,t)),t.push(s)}catch(t){}return s}async function Wg(t,e={}){const{method:n="GET",headers:i,body:r,retries:o=Fg,retryDelay:s=Cg,backoffFactor:a=Og,samplesTargetPath:l=Pg,fetch:c,loglevel:u="warn",cache:d,signal:h,onProgress:f,returnType:p="default"}=e;Rg.setLevel(u);const m=function(t){if(t)return t;if(Au&&"function"==typeof Au.fetch)return Au.fetch.bind(Au);throw new Error("fetch is not available in this environment")}(c);let v=0,g=s;for(;;){if(h&&h.aborted)throw Ng();const e=Sg();try{const s=await m(t,{method:n,headers:i,body:r,cache:d,mode:"cors",signal:h});if(h&&h.aborted)throw Ng();if(!s.ok){if(v<o&&Lg(s.status)){v+=1,Rg.warn(`[${t}] Download attempt #${v} failed with status ${s.status}, retrying in ${g}ms...`),await Dg(g),g*=a;continue}Rg.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=Sg();const u=Bg(s),y="arrayBuffer"===p||"bytes"===p,b=y&&"function"==typeof f;let k,x,w,_,T,I=0;if(y&&s.body&&"function"==typeof s.body.getReader&&b){const t=s.body.getReader(),e=[];for(;;){if(h&&h.aborted)throw Ng();const{done:n,value:i}=await t.read();if(n)break;if(i&&i.length){const t=Sg();Number.isFinite(_)||(_=t),T=t,e.push(i),I+=i.length,f({loaded:I,total:u||void 0,chunk:i})}}k=new Uint8Array(I);let n=0;e.forEach((t=>{k.set(t,n),n+=t.length})),c=Sg()}else if(y){const t=await s.arrayBuffer();k=new Uint8Array(t),I=k.length,c=Sg()}else"text"===p?(x=await s.text(),c=Sg()):"json"===p&&(w=await s.json(),c=Sg());if(h&&h.aborted)throw Ng();const E=y?k?k.length:I:("text"===p&&"string"==typeof x?x.length:0)||("json"===p&&w?JSON.stringify(w).length:0),S=u||E||0;let A=e,N=c;Number.isFinite(_)&&(A=_,Number.isFinite(T)&&(N=Math.max(T,c))),(!Number.isFinite(A)||!Number.isFinite(N)||N<A)&&(A=e,N=c);const M=Math.max(0,N-A),F=zg(S,M,A,N,l,t);try{bg.trigger("download:sample",F)}catch(t){}const C={response:s,bytes:S,durationMs:M,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(Mg(e,h))throw"AbortError"===e.name?e:Ng();if(!(v<o)||e.status&&!Lg(e.status))throw Rg.error(`[${t}] Download attempt #${v} failed with error ${e}, no more retries.`),e;v+=1,Rg.warn(`[${t}] Download attempt #${v} failed with error ${e}, retrying in ${g}ms...`),await Dg(g),g*=a}}}const $g={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"]}},Ug=Object.freeze(Object.entries($g).reduce(((t,[e,n])=>(Object.prototype.hasOwnProperty.call(n,"default")&&(t[e]=n.default),t)),{})),jg=yu("config","warn");function qg(t){return Ug[t]}var Vg=new WeakMap,Hg=new WeakMap,Gg=new WeakMap,Kg=new WeakMap,Xg=new WeakMap,Yg=new WeakSet;class Qg extends Iu{get name(){return"DownloadSpeed"}get defaults(){return{alpha:.3,maxSamples:30,minBytesPerSample:1024,minDurationMs:5,maxSampleKbpsCap:void 0,ignoreCacheHits:!0,samplesPath:"runtime.downloadSpeedSamples",initialKbps:qg("initialKbps"),probeUrl:void 0,defaultKbps:2500}}constructor(...t){super(...t),O(this,Yg),F(this,Vg,void 0),F(this,Hg,void 0),F(this,Gg,void 0),F(this,Kg,void 0),F(this,Xg,void 0),C(Gg,this,[]),C(Hg,this,0),C(Vg,this,A(Yg,this,ty).call(this)),C(Xg,this,Ag()),C(Kg,this,(t=>{A(Yg,this,sy).call(this,t,"event")})),A(Yg,this,ey).call(this),bg.on("download:sample",M(Kg,this)),A(Yg,this,ny).call(this),this.log.debug(`[#constructor] Initial estimate: ${M(Vg,this)} kbps`)}getKbps(){return M(Vg,this)}addSample(t){A(Yg,this,sy).call(this,t,"manual")}reset(){C(Gg,this,[]),C(Hg,this,0),C(Vg,this,A(Yg,this,ty).call(this))}onDispose(){M(Xg,this)&&M(Xg,this).abort(),C(Xg,this,null),bg.off("download:sample",M(Kg,this)),C(Gg,this,[]),C(Hg,this,0),C(Vg,this,void 0),C(Kg,this,null)}}function Jg(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 Zg(t){if(!t||"object"!=typeof t)return null;const e=Number(t.bytes),n=Number(t.durationMs);let i=eg(t.kbps)?Number(t.kbps):NaN;return!eg(i)&&n>0&&eg(e)&&(i=8*e/n),eg(i)?e<=this.settings.minBytesPerSample||n<=this.settings.minDurationMs||A(Yg,this,Jg).call(this,t,e)?null:(eg(this.settings.maxSampleKbpsCap)&&i>this.settings.maxSampleKbpsCap&&(i=this.settings.maxSampleKbpsCap),{...t,bytes:e,durationMs:n,kbps:i}):null}function ty(){const t=this.settings.initialKbps;if(eg(t))return t;if("auto"===t)try{const t=(new cg).guesstimate();if(eg(t))return t}catch(t){}return this.settings.defaultKbps}function ey(){const t=Ig.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)A(Yg,this,sy).call(this,e[t],"replay",{emit:!1})}async function ny(){if(!this.settings.probeUrl||M(Hg,this)>0)return;const t=M(Xg,this)?M(Xg,this).signal:void 0;if(!t||!t.aborted)try{await Wg(this.settings.probeUrl,{cache:"no-store",samplesTargetPath:this.settings.samplesPath,signal:t})}catch(t){}}function iy(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 ry(t,e){if(!A(Yg,this,iy).call(this,t)||!A(Yg,this,iy).call(this,e))return 0;const n=Math.max(t.startTime,e.startTime);return Math.min(t.endTime,e.endTime)-n}function oy(t){if(!A(Yg,this,iy).call(this,t))return t;const e=[];for(let n=0;n<M(Gg,this).length;n+=1){const i=M(Gg,this)[n];A(Yg,this,iy).call(this,i)&&(A(Yg,this,ry).call(this,t,i)>0&&e.push(i))}if(0===e.length)return t;C(Gg,this,M(Gg,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(!eg(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 A(Yg,this,Zg).call(this,a)}function sy(t,e,{emit:n=!0}={}){const i=A(Yg,this,Zg).call(this,t);if(!i)return;const r=A(Yg,this,oy).call(this,i);if(!r)return;C(Hg,this,M(Hg,this)+1),M(Gg,this).push(r),M(Gg,this).length>this.settings.maxSamples&&M(Gg,this).shift();const o=this.defaults.alpha,s="number"==typeof this.settings.alpha?this.settings.alpha:o,a=eg(M(Vg,this)),l=a?M(Vg,this):r.kbps,c=a||1!==M(Hg,this)?s*r.kbps+(1-s)*l:r.kbps;C(Vg,this,c),this.log.debug(`[#ingestSample] Next estimate: ${c} kbps`),n&&this.trigger("download:speed",{kbps:M(Vg,this),sample:r,source:e,samplesCount:M(Hg,this)})}class ay{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=function(t=""){if(!t||"string"!=typeof t)return;const e=t.split(",")[0].trim();if(!e)return;const n=e.match(/^[a-z0-9]+/i);return n?n[0].toLowerCase():void 0}(o),eg(s)&&(this.bandwidth=s),eg(a)&&(this.timescale=a),eg(l)&&(this.sizeBytes=l),Object.assign(this,c)}}class ly{#P=new Map;#R;#D;#L=0;#B;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 ay?t:new ay(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.#L=Math.max(this.#L,n));const i=Number(e);Number.isFinite(i)&&i>0&&(this.#B=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=eg(this.#B)?this.#B:null===(t=this.#R)||void 0===t?void 0:t.sizeBytes;return eg(e)?Math.min(1,Math.max(0,this.#L/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.#L=0,this.#B=void 0}}class cy{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 uy(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 dy(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=uy(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 hy=new Set(["video","audio","image","cue","data","bbox"]);class fy{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(!hy.has(n))throw new Error(`Track type must be one of ${Array.from(hy).join("|")}`);this.id=e,this.type=n,this.offset=i,this.duration=eg(r)?r:void 0,this.source=o,"cue"===n?(this._cues=a.map((t=>t instanceof cy?t:new cy(t))),this._segments=[]):(this._segments=s.map((t=>t instanceof ly?t:new ly(t))),this._cues=void 0)}get segments(){return this._segments.slice()}get cues(){if("cue"===this.type)return this._cues.slice()}get endTime(){if(eg(this.duration))return this.offset+this.duration;if(!this._segments.length)return;const t=this._segments.reduce(((t,e)=>{const n=eg(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:eg(null==t?void 0:t.duration)?t.duration:0,offset:eg(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 dy(this._segments,t,e)}setSegments(t=[]){if("cue"===this.type)return;const e=Array.isArray(t)?t:[];this._segments=e.map((t=>t instanceof ly?t:new ly(t)))}}function py(t){return"string"==typeof t?t:t&&"object"==typeof t?t.nodeId||t.nodeIdOrRef||t.id:void 0}function my(t){const e=py(t);let n=1;if(t&&"object"==typeof t&&eg(t.weight)&&(n=t.weight),!e)throw new Error("Child entry requires a nodeId");return{nodeId:e,weight:n}}function vy(t){return(Array.isArray(t)?t:[]).map((t=>my(t)))}function gy(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 yy(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 by(t,e){if(e)try{var n;return new URL(e,t||(null==Au||null===(n=Au.location)||void 0===n?void 0:n.href)||void 0).toString()}catch(t){return e}}const ky=new Map;class xy{static register(t,e){if(!t||"function"!=typeof e)throw new Error("ManifestFactory.register requires type and parser function");ky.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=xy.inferType(t);if(!e||!ky.has(e))throw new Error("Unsupported manifest type");return ky.get(e)(t)}}xy.register("dash",(function(t={}){const{body:e,url:n}=t,i=function(){if(Au&&"function"==typeof Au.DOMParser)return new Au.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=gy(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=gy(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:gy(a&&a.getAttribute("timescale"))||gy(e&&e.getAttribute("timescale"),1)||1,startNumber:gy(a&&a.getAttribute("startNumber"))||gy(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=gy(n.getAttribute("t")),s=gy(n.getAttribute("d")),a=gy(n.getAttribute("r"),0);if(!eg(s))continue;eg(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:by(n,yy(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:by(n,yy(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}})),xy.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:eg(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=>eg(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+(eg(e.duration)?e.duration:0)),0),l=eg(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}})),xy.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=eg(null==t?void 0:t.duration)?t.duration:30,i=eg(null==t?void 0:t.width)?t.width:void 0,r=eg(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};eg(i)&&eg(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 wy=["video/mp4"];function _y(t){return wy.includes(t.mime)}var Ty={name:"containers",fn:function(t=[]){return t.filter(_y)},isRelevantForTrack:function(t){return"video"===(null==t?void 0:t.type)}};const Iy=new(ae=new WeakMap,le=new WeakSet,class extends Iu{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),O(this,le),F(this,ae,void 0),C(ae,this,new Map)}onDispose(){M(ae,this)&&M(ae,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 A(le,this,My).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 Ey(){return!!(Au&&Au.navigator&&Au.navigator.mediaCapabilities&&"function"==typeof Au.navigator.mediaCapabilities.decodingInfo)}function Sy(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 function(t=""){return t.toLowerCase().includes("video")}(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 Ay(t){return t?JSON.stringify(t):"invalid"}async function Ny(t){if(!this.settings.enabled||!A(le,this,Ey).call(this)||!t)return this.log.debug("[#queryCapabilities] Not supported, returning false",t),{supported:!1,smooth:!1,powerEfficient:!1};const e=A(le,this,Ay).call(this,t),n=M(ae,this).get(e);if(n)return n;let i;try{i=await Au.navigator.mediaCapabilities.decodingInfo(t)}catch(t){i={supported:!1,smooth:!1,powerEfficient:!1}}return this.log.debug("[#queryCapabilities] Config:",t,"\nDecoding info result:",i),M(ae,this).set(e,i),i}async function My(t){if(A(le,this,Cy).call(this,t))return this.log.debug("[#scoreRepresentation] Blocking HEVC on Firefox versions below support threshold",null==t?void 0:t.codecs),{score:-1e3,capability:{supported:!1,smooth:!1,powerEfficient:!1}};const e=A(le,this,Sy).call(this,t),n=await A(le,this,Ny).call(this,e),i=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 r=0;return n.supported&&(r+=1),!this.settings.ignoreSmooth&&n.smooth&&(r+=this.settings.smoothWeight),!this.settings.ignorePower&&n.powerEfficient&&(r+=this.settings.powerWeight),r+=i,{score:r,capability:n}}function Fy(){if(!xm())return!1;const t=wm();return!Number.isFinite(t)||t<150}function Cy(t){if(!A(le,this,Fy).call(this))return!1;const e=function(t=""){const e=String(t||"").toLowerCase(),[n]=e.split(".");return n||""}((null==t?void 0:t.baseCodec)||(null==t?void 0:t.codecs)||"");return"hvc1"===e||"hev1"===e}const Oy=[],Py=()=>!0;[Ty,{name:"force-video-codec",fn:function(t=[],{node:e}={}){const n=function(t){if("string"!=typeof t)return;const e=t.split(",")[0].trim();if(!e)return;const n=e.match(/^[a-z0-9]+/i);return n?n[0].toLowerCase():void 0}(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)}},{name:"media-capabilities",fn:async function(t=[],{track:e}){if(null==e||!e.preferredCodec){const n=await Iy.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:Py;Oy.push({name:t,fn:e,isRelevantForTrack:i})}(t,e,{isRelevantForTrack:n})}));const Ry=yu("Node","warn"),Dy={start:0,end:0},Ly=.001;function By(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)<=Ly&&Math.abs(t.duration-n.duration)<=Ly))?{offset:n.start,duration:n.duration}:void 0}var zy=new WeakMap,Wy=new WeakMap,$y=new WeakMap,Uy=new WeakMap,jy=new WeakMap,qy=new WeakMap,Vy=new WeakMap,Hy=new WeakMap,Gy=new WeakMap,Ky=new WeakMap,Xy=new WeakSet;class Yy extends bu{constructor(t={},e={}){super(),O(this,Xy),F(this,zy,void 0),F(this,Wy,void 0),F(this,$y,void 0),F(this,Uy,void 0),F(this,jy,void 0),F(this,qy,void 0),F(this,Vy,void 0),F(this,Hy,void 0),F(this,Gy,void 0),F(this,Ky,[]);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,C(Vy,this,!0===e.forceImageFallback),C(zy,this,e.abrSelector),C(Wy,this,e.assetsDeliveryService),C(Uy,this,eg(r)?r:void 0),C(jy,this,eg(o)?o:void 0),C(qy,this,eg(s)?s:void 0),C(Hy,this,e&&"object"==typeof e.mediaHostRewriteMap?e.mediaHostRewriteMap:void 0),C(Gy,this,eg(e.maxManifestLoadAttempts)?e.maxManifestLoadAttempts:1/0),this.manifestLoadAttempts=0,this.manifestLoadError=void 0,C(Ky,this,vy(l))}setChildren(t){const e=vy(t);return A(Xy,this,pb).call(this,e,{emit:!0})}addChild(t){const e=my(t),n=M(Ky,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 A(Xy,this,pb).call(this,n,{emit:!0})}removeChild(t){const e=py(t);if(!e)return this.children;const n=M(Ky,this).filter((t=>(null==t?void 0:t.nodeId)!==e));return n.length===M(Ky,this).length?this.children:A(Xy,this,pb).call(this,n,{emit:!0})}async load(t={}){const{loadingMode:e="full",signal:n}=t;Ry.info(`[load] [${this.id}] Loading node in '${e}' mode`);try{if(n&&n.aborted)throw Ng();"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})=>A(Xy,this,ub).call(this,t,e,n))),l=s?A(Xy,this,db).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 A(Xy,this,db).call(this,t.segment,t.track,n);if(n&&n.aborted)throw Ng();return this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:e}),this}catch(t){if(Mg(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(Ry.info(`[loadMediaSegmentsAtOffset] [${this.id}] Loading media segments at offset ${n}`),!Number.isFinite(n))return;const{signal:i}=e;if(i&&i.aborted)throw Ng();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(A(Xy,this,ub).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)<=Ly&&!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})=>A(Xy,this,db).call(this,t,e,i)))),i&&i.aborted)throw Ng();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 M($y,this)}catch(t){if(!Mg(t)||e&&e.aborted)throw t;i=!0;continue}if(e&&e.aborted)throw Ng();if(this.hasExceededManifestLoadAttempts()){const t=this.manifestLoadError||new Error("Manifest load retry limit reached");throw this.state="failed",this.error=t,t}const t=A(Xy,this,ib).call(this);return this.state="resolving",this.error=void 0,C($y,this,(async()=>{try{const t=await A(Xy,this,hb).call(this,{signal:e,manifestOverride:n});if(e&&e.aborted)throw Ng();let i=xy.parse(t);return i=A(Xy,this,nb).call(this,i),this.tracks=(i.tracks||[]).map((t=>t instanceof fy?t:new fy(t))),this.mainTrackId=i.mainTrackId||this.mainTrackId,this.metadata=i.metadata||this.metadata,A(Xy,this,vb).call(this),A(Xy,this,mb).call(this),await A(Xy,this,fb).call(this),this.state="ready",this}catch(n){if(Mg(n,e))throw A(Xy,this,rb).call(this,t),n;throw this.state="failed",this.error=n,n}})()),M($y,this)}return M($y,this)}evict(){this.tracks.forEach((t=>{(t.segments||[]).forEach((t=>{t.evict()}))}))}get children(){return M(Ky,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?eg(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+=eg(e.retainedByteLength)?e.retainedByteLength:0}))})),t}get buffered(){if("ready"!==this.state)return Dy;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||!eg(e))return Dy;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 Dy;if(n.length===this.tracks.length&&n.every((({track:t,range:e})=>{const n=t.endTime,i=eg(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 Dy;const r=Math.min(i,e);return r>0?{start:0,end:r}:Dy}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(M(Gy,this))||M(Gy,this)<=0)return!1;if(!this.manifestLoadError)return!1;const t=Number(this.manifestLoadAttempts);return Number.isFinite(t)&&t>=M(Gy,this)}}function Qy(t){return function(t,e){if(!t||"string"!=typeof t)return t;if(!e||"object"!=typeof e)return t;const n=Au&&"function"==typeof Au.URL?Au.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,M(Hy,this))}function Jy(){return M(Vy,this)||void 0===Au.VideoDecoder}function Zy(){return this.manifestRef&&"object"==typeof this.manifestRef&&"assets-delivery-service"===this.manifestRef.type}function tb(t){if(!A(Xy,this,Zy).call(this))return!1;if(!A(Xy,this,Jy).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 eb(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 eg(n)?n:eg(M(Uy,this))?M(Uy,this):void 0}function nb(t){if(this.imageFallbackActive=!1,!A(Xy,this,tb).call(this,t))return t;if(!M(Wy,this)||"function"!=typeof M(Wy,this).resolveImageOne)return t;const e=M(Wy,this).resolveImageOne(this.manifestRef),n=A(Xy,this,Qy).call(this,null==e?void 0:e.url);if(!n)return t;const i={typeHint:"image",url:n,duration:A(Xy,this,eb).call(this,t),width:M(jy,this),height:M(qy,this)},r=xy.parse(i);return t&&"object"==typeof t.metadata&&!Array.isArray(t.metadata)&&(r.metadata=t.metadata),this.imageFallbackActive=!0,r}function ib(){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 rb(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 ob(){const t=Number(this.manifestLoadAttempts);this.manifestLoadAttempts=Number.isFinite(t)&&t>0?t+1:1,this.manifestLoadError=void 0}function sb(t){this.manifestLoadError=t||new Error("Manifest load failed")}function ab(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 lb(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 cb(t,e){t&&("function"!=typeof t.setLoadError?t.loadError=e||new Error("Segment load failed"):t.setLoadError(e))}async function ub(t,e,n){const i=A(Xy,this,ab).call(this,e);try{const i=e.representations.map((async i=>{const r=A(Xy,this,Qy).call(this,i.url),o=await Wg(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(Mg(t,n))throw A(Xy,this,lb).call(this,e,i),t;throw A(Xy,this,cb).call(this,e,t),t}}async function db(t,e,n){const i=M(zy,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=A(Xy,this,ab).call(this,t);try{const i=A(Xy,this,Qy).call(this,s.url),r=await Wg(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(Mg(e,n))throw A(Xy,this,lb).call(this,t,a),e;throw A(Xy,this,cb).call(this,t,e),e}}async function hb(t={}){const{signal:e,manifestOverride:n}=t;if(e&&e.aborted)throw Ng();A(Xy,this,ob).call(this);try{let t=this.manifestRef;if(n&&"object"==typeof n){if(A(Xy,this,Zy).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=A(Xy,this,Qy).call(this,n.url);return{typeHint:n.typeHint,url:t,mimeType:n.mimeType,body:n.body,duration:M(Uy,this),width:M(jy,this),height:M(qy,this)}}"string"==typeof n.url&&n.url&&(t=n)}if(t&&"object"==typeof t&&"assets-delivery-service"===t.type){if(!M(Wy,this)||"function"!=typeof M(Wy,this).resolveOne)throw new Error("AssetsDeliveryService is required for assets-delivery-service manifestRef");const n=await M(Wy,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=A(Xy,this,Qy).call(this,n.url),o=n.mimeType,s=n.body;if(r||s||o)return{typeHint:i,url:r,mimeType:o,body:s,duration:M(Uy,this),width:M(jy,this),height:M(qy,this)};throw new Error("AssetsDeliveryService returned unsupported manifest shape")}if(t&&"object"==typeof t){const e=A(Xy,this,Qy).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=A(Xy,this,Qy).call(this,n),r="object"==typeof t?t.typeHint:void 0,o="object"==typeof t?t.mimeType:void 0;if("image"===xy.inferType({typeHint:r,url:i,mimeType:o})){const e="object"==typeof t&&eg(t.duration)?t.duration:M(Uy,this);return{typeHint:"image",url:i,mimeType:o,duration:e,width:"object"==typeof t&&eg(t.width)?t.width:M(jy,this),height:"object"==typeof t&&eg(t.height)?t.height:M(qy,this)}}const s=await Wg(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(Mg(t,e))throw t;throw A(Xy,this,sb).call(this,t),t}}async function fb(){const t=Oy.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=By(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 pb(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}(M(Ky,this),t)||(C(Ky,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 mb(){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 vb(){if(!Array.isArray(this.tracks)||!this.tracks.length)return;const t=this.duration;if(!eg(t))return;const e=[new cy({name:"nodestart",timestamp:0,data:{id:this.id},isSticky:!0}),new cy({name:"nodeend",timestamp:t,data:{id:this.id}})],n=new fy({id:`${this.id}-auto-cue`,type:"cue",cues:e,offset:0,duration:t});this.tracks.push(n)}var gb=new WeakMap,yb=new WeakMap,bb=new WeakMap,kb=new WeakMap,xb=new WeakSet;class wb extends Iu{constructor(...t){super(...t),O(this,xb),F(this,gb,new Map),F(this,yb,new Map),F(this,bb,void 0),F(this,kb,void 0);const[e,n]=t;C(bb,this,e),C(kb,this,n)}get name(){return"NodeRepository"}get defaults(){return{enabledRepFilters:["containers","force-video-codec","media-capabilities"],disabledTracks:qg("disabledTracks"),forceVideoCodec:qg("forceVideoCodec"),forceImageFallback:qg("forceImageFallback"),mediaHostRewriteMap:qg("mediaHostRewriteMap"),maxManifestLoadAttempts:3}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"get","list"])}onDispose(){M(gb,this).forEach(((t,e)=>{const n=M(yb,this).get(e);n&&t&&"function"==typeof t.off&&t.off(Im.NODE_CHILDREN_CHANGED,n)})),M(yb,this).clear(),M(gb,this).clear()}add(t){const e=t instanceof Yy?t:new Yy(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:M(bb,this),assetsDeliveryService:M(kb,this)});if(!e.id)throw new Error("NodeRepository.add requires node with id");if(M(gb,this).has(e.id))throw new Error(`NodeRepository.add: node with id ${e.id} already exists`);return M(gb,this).set(e.id,e),A(xb,this,_b).call(this,e),this.trigger(Im.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 M(gb,this).get(e)}list(){return Array.from(M(gb,this).values())}}function _b(t){if(!t||"function"!=typeof t.on||!t.id)return;const e=t=>{this.trigger(Im.NODE_CHILDREN_CHANGED,t)};t.on(Im.NODE_CHILDREN_CHANGED,e),M(yb,this).set(t.id,e)}var Tb=new WeakMap,Ib=new WeakMap,Eb=new WeakSet;class Sb extends Iu{constructor(...t){super(...t),O(this,Eb),F(this,Tb,void 0),F(this,Ib,new Map);const[e]=t;C(Tb,this,e)}get name(){return"ABRSelector"}get defaults(){return{safetyMargin:.35,minBufferForUpgrade:5,minBufferCritical:1,hysteresisRatio:1.1,abrStrategy:qg("abrStrategy")}}select(t={}){var e;const{representations:n=[],bufferSeconds:i}=t;if(!Array.isArray(n)||0===n.length)return;const r=M(Tb,this)&&"function"==typeof M(Tb,this).getKbps?M(Tb,this).getKbps():void 0,o=A(Eb,this,Ab).call(this,n[0]),s=M(Ib,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)=>A(Eb,this,Nb).call(this,t.bandwidth)-A(Eb,this,Nb).call(this,e.bandwidth)));if("bottom"===a){const e=l[0];return A(Eb,this,Cb).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 A(Eb,this,Cb).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 A(Eb,this,Cb).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=eg(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),A(Eb,this,Cb).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=>A(Eb,this,Nb).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&&eg(e.bandwidth)&&eg(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 A(Eb,this,Cb).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(){M(Ib,this).clear(),C(Tb,this,null)}}function Ab(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 Nb(t){return eg(t)?t/1e3:0}function Mb(t){return eg(t)?t/1e3:void 0}function Fb(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:A(Eb,this,Mb).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:A(Eb,this,Mb).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 Cb(t,e,n={}){if(!t)return;const i=A(Eb,this,Fb).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=A(Eb,this,Ab).call(this,t);M(Ib,this).set(r,t.id)}var Ob=new WeakMap,Pb=new WeakSet;class Rb extends Iu{constructor(...t){super(...t),O(this,Pb),F(this,Ob,void 0);const[e]=t;if(C(Ob,this,e),!M(Ob,this)||"function"!=typeof M(Ob,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(){C(Ob,this,null)}getPrioritizationSnapshot(t){const e=M(Ob,this).list();if(!e.length)return{orderedIds:[],reachableIds:[]};const{levels:n,weights:i}=A(Pb,this,Db).call(this,e,t);return{orderedIds:A(Pb,this,Lb).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 Db(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=eg(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 Lb(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 Bb(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 zb(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 Wb(t){return"string"==typeof t&&t.startsWith("cmaf:")}function $b(t){return"image"===(null==t?void 0:t.assetType)?"image":"ivd"}function Ub(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 jb=new WeakMap,qb=new WeakMap,Vb=new WeakSet;class Hb extends Iu{constructor(...t){super(...t),O(this,Vb),F(this,jb,void 0),F(this,qb,void 0);const[,e={}]=t;C(jb,this,"function"==typeof e.fetchFn?e.fetchFn:void 0),C(qb,this,Ag())}get name(){return"AssetsDeliveryService"}get defaults(){return{assetsDeliveryServiceUrl:"https://assets.eko.com",profile:qg("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(!A(Vb,this,Kb).call(this,t))return;const e=Bb(t,this.settings.profile),n=function(t,e,n){const i=(t||"").replace(/\/$/,""),r=null==e?void 0:e.assetId,o=null==e?void 0:e.assetRevision;if(!i||"string"!=typeof r||"number"!=typeof o)return;const s=`${i}/image/${encodeURIComponent(r)}/${o}`,a=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 a?`${s}?${a}`:s}(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=>A(Vb,this,Kb).call(this,t)));if(!n.length)return[];const i=A(Vb,this,Gb).call(this,e);if(i&&i.aborted)return[];const r=[],o=this.settings.profile;n.forEach((t=>{if("image"!==$b(t))return;const e=this.resolveImageOne(t);e&&e.url&&r.push({manifestRef:zb(t,e.encodeProfile),manifest:{typeHint:"image",url:e.url}})}));const s=n.filter((t=>"image"!==$b(t))).map((t=>function(t,e){const n=Bb(t,e);return{ref:t,profile:n,route:Wb(n)?"dash":"ivd"}}(t,o))),a=A(Vb,this,Yb).call(this,s);for(const{refs:t,route:e}of a){if(i&&i.aborted)return r;const{url:n}=A(Vb,this,Qb).call(this,t,e),o=await A(Vb,this,Jb).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:zb(t,e),manifest:Ub(i)})}))}return r}onDispose(){M(qb,this)&&M(qb,this).abort(),C(qb,this,null),C(jb,this,null)}}function Gb(t){return t&&t.signal?t.signal:M(qb,this)?M(qb,this).signal:void 0}function Kb(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 Xb(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 Yb(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=>{A(Vb,this,Xb).call(this,t.refs,this.settings.maxBatchSize).forEach((e=>{n.push({route:t.route,refs:e})}))})),n}function Qb(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 Jb(t,e){return M(jb,this)?M(jb,this).call(this,t,e):await Wg(t,{returnType:"json",method:(null==e?void 0:e.method)||"GET",signal:null==e?void 0:e.signal})}function Zb({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 tk=(Au.requestAnimationFrame||Au.mozRequestAnimationFrame||Au.webkitRequestAnimationFrame||Au.msRequestAnimationFrame||(t=>Au.setTimeout(t,1e3/60))).bind(Au),ek=(Au.cancelAnimationFrame||Au.mozCancelAnimationFrame||Au.webkitCancelAnimationFrame||Au.msCancelAnimationFrame||(t=>Au.clearTimeout(t))).bind(Au),nk=yu("ticker","warn");let ik,rk=[],ok=null,sk=Sg();function ak(){sk=Sg();const t=[];let e,n;for(n=rk.length-1;n>=0;--n)e=rk[n],sk>=e.lastTick+e.interval&&t.push(e);for(n=t.length-1;n>=0;--n)if(e=t[n],!e.stopped){e.lastTick=sk;try{e.callback()}catch(t){console&&"function"==typeof console.error?console.error(t):nk.error(t)}}ik=tk(ak)}function lk(){Sg()-sk>=200&&(ek(ik),ak())}function ck(t){let e=-1;for(let n=0;n<rk.length;n+=1)if(rk[n].callback===t){e=n;break}return e}function uk(t,e=0){if(!t||"function"!=typeof t||"number"!=typeof e||e<0)return void nk.error("[start] Invalid arguments given to start method.",arguments);const n=ck(t);return-1!==n?(nk.debug("[start] Callback already exists, overriding interval.",arguments),rk[n].interval=e,t):(rk.push({callback:t,interval:e,lastTick:Sg()}),1===rk.length&&(ik=tk(ak),ok||(ok=Au.setInterval(lk,1e3))),t)}function dk(t){const e=ck(t);-1!==e?(rk[e].stopped=!0,rk.splice(e,1),rk.length||(ek(ik),Au.clearInterval(ok),ok=null)):nk.debug("[stop] Callback not found, doing nothing.",arguments)}function hk(t){return-1!==ck(t)}function fk(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 nk.error("[createThrottler] Bad argument given to createThrottler, first argument must be a function.",arguments);nk.debug("[createThrottler] Creating a new throttler instance.",arguments);const s=[];function a(){nk.debug("[onThrottlerTick] Calling callback with "+s.length+" queued items.");const e=s.slice(0);s.length=0,dk(a),t(e)}const l={push:function(t){nk.debug("[push] Queuing argument:",t),0===s.length&&uk(a,e),s.push(t),o+=1,(o<=r||s.length>=i)&&a()},flush:function(){nk.debug("[flush] Flushing queue."),0!==s.length&&a()},dispose:function(){nk.debug("[dispose] Disposing of throttler.");const t=s.slice(0);return s.length=0,dk(a),t}};return Object.defineProperty(l,"interval",{enumerable:!0,get:function(){return e},set:function(t){"number"==typeof t&&(e=t)}}),l}function pk(t,e){if(t&&"function"==typeof t)return t.__tickerThrottler||(t.__tickerThrottler=fk((function(){t()}),e)),"number"==typeof e&&(t.__tickerThrottler.interval=e),t.__tickerThrottler.push(),t.__tickerThrottler;nk.error("[scheduleExecution] Bad argument given to scheduleExecution, first argument must be a function.",arguments)}var mk=new WeakMap,vk=new WeakMap,gk=new WeakMap,yk=new WeakMap,bk=new WeakMap,kk=new WeakMap,xk=new WeakMap,wk=new WeakMap,_k=new WeakMap,Tk=new WeakMap,Ik=new WeakMap,Ek=new WeakMap,Sk=new WeakMap,Ak=new WeakMap,Nk=new WeakMap,Mk=new WeakMap,Fk=new WeakSet;class Ck extends Iu{constructor(...t){super(...t),O(this,Fk),F(this,mk,void 0),F(this,vk,void 0),F(this,gk,void 0),F(this,yk,void 0),F(this,bk,[]),F(this,kk,[]),F(this,xk,new Set),F(this,wk,new Set),F(this,_k,!1),F(this,Tk,void 0),F(this,Ik,void 0),F(this,Ek,void 0),F(this,Sk,void 0),F(this,Ak,void 0),F(this,Nk,void 0),F(this,Mk,void 0);const[e,n,i,r]=t;C(mk,this,e),C(vk,this,n),C(gk,this,i),C(yk,this,r),C(Tk,this,Ag());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),C(Mk,this,(()=>A(Fk,this,jk).call(this))),A(Fk,this,Dk).call(this),A(Fk,this,Rk).call(this)}get name(){return"NodeResolver"}get defaults(){return{maxConcurrent:5}}onDispose(){var t;M(Tk,this)&&M(Tk,this).abort(),C(Tk,this,null),M(yk,this)&&"function"==typeof M(yk,this).off&&M(Ek,this)&&M(yk,this).off(Im.PLACEMENT_ADDED,M(Ek,this)),M(yk,this)&&"function"==typeof M(yk,this).off&&M(Nk,this)&&M(yk,this).off(Im.TIMELINE_RESET,M(Nk,this)),M(mk,this)&&"function"==typeof M(mk,this).off&&M(Sk,this)&&M(mk,this).off(Im.NODE_ADD,M(Sk,this)),M(mk,this)&&"function"==typeof M(mk,this).off&&M(Ak,this)&&M(mk,this).off(Im.NODE_CHILDREN_CHANGED,M(Ak,this)),C(Ek,this,null),C(Sk,this,null),C(Ak,this,null),C(Nk,this,null),C(bk,this,[]),C(kk,this,[]),M(xk,this).clear(),M(wk,this).clear(),C(_k,this,!1),C(Ik,this,void 0),null!==(t=M(Mk,this))&&void 0!==t&&t.__tickerThrottler&&M(Mk,this).__tickerThrottler.dispose(),C(Mk,this,null)}}function Ok(){return M(Tk,this)?M(Tk,this).signal:void 0}function Pk(){return this._disposed||M(Tk,this)&&M(Tk,this).signal.aborted}function Rk(){M(yk,this)&&"function"==typeof M(yk,this).on&&(C(Ek,this,(t=>{A(Fk,this,Bk).call(this,null==t?void 0:t.nodeId)})),M(yk,this).on(Im.PLACEMENT_ADDED,M(Ek,this)),C(Nk,this,(()=>A(Fk,this,Lk).call(this))),M(yk,this).on(Im.TIMELINE_RESET,M(Nk,this))),M(mk,this)&&"function"==typeof M(mk,this).on&&(C(Sk,this,(({node:t})=>{(null==t?void 0:t.id)&&A(Fk,this,Bk).call(this,t.id,{fromRepoAdd:!0})})),M(mk,this).on(Im.NODE_ADD,M(Sk,this)),C(Ak,this,(()=>{pk(M(Mk,this),100)})),M(mk,this).on(Im.NODE_CHILDREN_CHANGED,M(Ak,this)))}function Dk(){const t=M(yk,this)&&Array.isArray(M(yk,this).placements)?M(yk,this).placements:[];t.forEach((t=>A(Fk,this,Bk).call(this,t.nodeId)));const e=t.length?t[t.length-1]:void 0;e&&e.nodeId&&C(Ik,this,e.nodeId)}function Lk(){M(Tk,this)&&M(Tk,this).abort(),C(Tk,this,Ag()),C(bk,this,[]),C(kk,this,[]),M(xk,this).clear(),C(_k,this,!1),C(Ik,this,void 0)}function Bk(t,{fromRepoAdd:e=!1}={}){A(Fk,this,Pk).call(this)||t&&(M(wk,this).has(t)||M(xk,this).has(t)||(M(bk,this).push(t),M(Ik,this)||e||C(Ik,this,t),!M(_k,this)&&e||A(Fk,this,zk).call(this)))}function zk(){if(M(_k,this))return void A(Fk,this,Wk).call(this);if(0===M(bk,this).length)return;C(_k,this,!0);const t=M(bk,this).shift();A(Fk,this,qk).call(this,t).finally((()=>{A(Fk,this,Wk).call(this)}))}async function Wk(){if(!A(Fk,this,Pk).call(this))for(M(bk,this).length||M(kk,this).length||C(kk,this,A(Fk,this,$k).call(this));M(xk,this).size<this.settings.maxConcurrent;){const t=this.settings.maxConcurrent-M(xk,this).size;if(t<=0)break;const e=[];for(;e.length<t&&(M(bk,this).length||M(kk,this).length);){let t=M(bk,this).shift();t||(t=M(kk,this).shift()),t&&e.push(t)}if(!e.length)break;const n=A(Fk,this,Vk).call(this,e);n.length&&M(gk,this)&&"function"==typeof M(gk,this).resolve&&A(Fk,this,Hk).call(this,n).finally((()=>A(Fk,this,Wk).call(this))),e.filter((t=>!n.find((e=>e.nodeId===t)))).forEach((t=>{A(Fk,this,qk).call(this,t).finally((()=>A(Fk,this,Wk).call(this)))}))}}function $k(){const t=new Set([...M(wk,this),...M(xk,this),...M(bk,this)]);return A(Fk,this,Uk).call(this,t)}function Uk(t){const e=M(yk,this)&&Array.isArray(M(yk,this).placements)?M(yk,this).placements:[],n=(e.length?e[e.length-1].nodeId:void 0)||M(Ik,this);return Zb({prioritizer:M(vk,this),repository:M(mk,this),startNodeId:n,pendingIds:t,fallbackToRepository:!1})}function jk(){A(Fk,this,Pk).call(this)||(M(_k,this)||0!==M(bk,this).length)&&(C(kk,this,A(Fk,this,$k).call(this)),M(_k,this)&&A(Fk,this,Wk).call(this))}async function qk(t,e){if(!t||M(wk,this).has(t)||M(xk,this).has(t))return;const n=A(Fk,this,Ok).call(this);if(n&&n.aborted)return;const i=M(mk,this)&&"function"==typeof M(mk,this).get?M(mk,this).get(t):void 0;if(i&&"function"==typeof i.resolve)if("function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts())M(wk,this).add(t);else{M(xk,this).add(t);try{const r={signal:n};e&&(r.manifestOverride=e),await i.resolve(r),M(wk,this).add(t)}catch(e){if(Mg(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()&&M(wk,this).add(t)}finally{M(xk,this).delete(t)}}}function Vk(t){const e=[];return t.forEach((t=>{const n=M(mk,this)&&"function"==typeof M(mk,this).get?M(mk,this).get(t):void 0;n&&n.manifestRef&&"assets-delivery-service"===n.manifestRef.type&&e.push({nodeId:t,ref:n.manifestRef})})),e}async function Hk(t){const e=A(Fk,this,Ok).call(this);if(!e||!e.aborted){t.forEach((({nodeId:t})=>M(xk,this).add(t)));try{const n=t.map((t=>t.ref)),i=await M(gk,this).resolve(n,{signal:e});t.forEach((({nodeId:t,ref:e})=>{var n;const r=M(mk,this)&&"function"==typeof M(mk,this).get?M(mk,this).get(t):void 0;if(M(xk,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?A(Fk,this,Gk).call(this,o.manifest,s):void 0;A(Fk,this,qk).call(this,t,a)}))}catch(n){Mg(n,e)||this.log.warn(`NodeResolver ADS batch failed: ${(null==n?void 0:n.message)||n}`),t.forEach((({nodeId:t})=>M(xk,this).delete(t)))}}}function Gk(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 Kk=.001,Xk="priority";function Yk(t){const e=Number(t);return Number.isFinite(e)?e:0}var Qk=new WeakMap,Jk=new WeakMap,Zk=new WeakMap,tx=new WeakMap,ex=new WeakMap,nx=new WeakMap,ix=new WeakMap,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 WeakMap,mx=new WeakMap,vx=new WeakMap,gx=new WeakSet;class yx extends Iu{constructor(...t){super(...t),O(this,gx),F(this,Qk,void 0),F(this,Jk,void 0),F(this,Zk,void 0),F(this,tx,new Map),F(this,ex,new Map),F(this,nx,[]),F(this,ix,new Set),F(this,rx,new Map),F(this,ox,!1),F(this,sx,void 0),F(this,ax,void 0),F(this,lx,void 0),F(this,cx,void 0),F(this,ux,void 0),F(this,dx,void 0),F(this,hx,void 0),F(this,fx,void 0),F(this,px,!1),F(this,mx,[]),F(this,vx,void 0);const[e,n,i]=t;C(Qk,this,e),C(Jk,this,n),C(Zk,this,i),C(ax,this,Ag()),C(vx,this,(()=>A(gx,this,tw).call(this))),A(gx,this,Ox).call(this)}get name(){return"SegmentLoadCoordinator"}get defaults(){return{maxConcurrentLoads:3,maxSegmentLoadAttempts:3}}onDispose(){var t;M(ax,this)&&M(ax,this).abort(),C(ax,this,null),M(rx,this).size&&M(rx,this).forEach((t=>{(null==t?void 0:t.controller)&&t.controller.abort()})),M(rx,this).clear(),M(Zk,this)&&"function"==typeof M(Zk,this).off&&(M(lx,this)&&M(Zk,this).off(Im.PLACEMENT_ADDED,M(lx,this)),M(ux,this)&&M(Zk,this).off(Im.TIMELINE_SEEKING,M(ux,this)),M(dx,this)&&M(Zk,this).off(Im.TIMELINE_SEEKED,M(dx,this)),M(hx,this)&&M(Zk,this).off(Im.TIMELINE_RESET,M(hx,this))),M(Qk,this)&&"function"==typeof M(Qk,this).off&&M(cx,this)&&M(Qk,this).off(Im.NODE_CHILDREN_CHANGED,M(cx,this)),M(fx,this)&&"function"==typeof Au.removeEventListener&&Au.removeEventListener("online",M(fx,this)),C(lx,this,null),C(cx,this,null),C(ux,this,null),C(dx,this,null),C(hx,this,null),C(fx,this,null),M(tx,this).clear(),M(ex,this).clear(),C(nx,this,[]),M(ix,this).clear(),M(rx,this).clear(),C(ox,this,!1),C(sx,this,void 0),C(px,this,!1),C(mx,this,[]),null!==(t=M(vx,this))&&void 0!==t&&t.__tickerThrottler&&M(vx,this).__tickerThrottler.dispose(),C(vx,this,null)}}function bx(){return M(ax,this)?M(ax,this).signal:void 0}function kx(){return this._disposed||M(ax,this)&&M(ax,this).signal.aborted}function xx(){const t=Number(this.settings.maxSegmentLoadAttempts);return Number.isFinite(t)&&t>0?t:1/0}function wx(t){const e=A(gx,this,xx).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 _x(t){return!!t&&(!!A(gx,this,wx).call(this,t)||A(gx,this,Tx).call(this,t))}function Tx(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 Ix(t){if(!t||A(gx,this,Tx).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 Ex(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=>{A(gx,this,Ix).call(this,t)}))})))}function Sx(){(M(Qk,this)&&"function"==typeof M(Qk,this).list?M(Qk,this).list():[]).forEach((t=>{A(gx,this,Ex).call(this,t)}))}function Ax(t,{allowSeekKeep:e=!1,segmentOffset:n}={}){const i=Ag(),r=i?i.signal:A(gx,this,bx).call(this);return t&&M(rx,this).set(t,{controller:i,allowSeekKeep:!!e,segmentOffset:n}),{signal:r,controller:i}}function Nx(t,e,n={}){const i=M(rx,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 Mx(t,e){const n=M(rx,this).get(t);n&&(e&&n.controller!==e||M(rx,this).delete(t))}function Fx(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=M(Qk,this)&&"function"==typeof M(Qk,this).get?M(Qk,this).get(i):void 0;if(!r)return;const o=A(gx,this,qx).call(this,r,t,e);Number.isFinite(o)&&n.add(`${i}:${o}`)})),n}function Cx(t){M(rx,this).size&&M(rx,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 Ox(){M(Zk,this)&&"function"==typeof M(Zk,this).on&&(C(lx,this,(t=>{A(gx,this,zx).call(this,t)})),M(Zk,this).on(Im.PLACEMENT_ADDED,M(lx,this)),C(ux,this,(t=>A(gx,this,Px).call(this,t))),M(Zk,this).on(Im.TIMELINE_SEEKING,M(ux,this)),C(dx,this,(t=>A(gx,this,Rx).call(this,t))),M(Zk,this).on(Im.TIMELINE_SEEKED,M(dx,this)),C(hx,this,(()=>A(gx,this,Bx).call(this))),M(Zk,this).on(Im.TIMELINE_RESET,M(hx,this))),M(Qk,this)&&"function"==typeof M(Qk,this).on&&(C(cx,this,(()=>{pk(M(vx,this),100)})),M(Qk,this).on(Im.NODE_CHILDREN_CHANGED,M(cx,this))),"function"==typeof Au.addEventListener&&(C(fx,this,(()=>A(gx,this,Lx).call(this))),Au.addEventListener("online",M(fx,this)))}function Px(t={}){if(A(gx,this,kx).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=A(gx,this,Fx).call(this,n,e);A(gx,this,Cx).call(this,i),C(px,this,!0),C(mx,this,n.map((t=>{const n=null==t?void 0:t.nodeId;if(n)return{nodeId:n,placement:t,targetTime:e}})).filter(Boolean)),setTimeout((()=>A(gx,this,$x).call(this)),0)}function Rx(t={}){var e;if(A(gx,this,kx).call(this))return;C(px,this,!1),C(mx,this,[]);const n=Number.isFinite(null==t?void 0:t.targetTime)?Number(t.targetTime):Number(null===(e=M(Zk,this))||void 0===e?void 0:e.currentTime);A(gx,this,Dx).call(this,n),setTimeout((()=>A(gx,this,$x).call(this)),0)}function Dx(t){var e;(Array.isArray(null===(e=M(Zk,this))||void 0===e?void 0:e.placements)?M(Zk,this).placements:[]).forEach((e=>{if(!e)return;const n=Ap(e);if(Number.isFinite(n)){if(Number.isFinite(t)){if(n>=t)return void A(gx,this,zx).call(this,e);const i=Ep(e,M(Qk,this));return Number.isFinite(i)?void(n+i>t&&A(gx,this,zx).call(this,e)):void(n<=t&&A(gx,this,zx).call(this,e))}A(gx,this,zx).call(this,e)}}))}function Lx(){var t;A(gx,this,kx).call(this)||(A(gx,this,Sx).call(this),C(px,this,!1),C(mx,this,[]),A(gx,this,Dx).call(this,Number(null===(t=M(Zk,this))||void 0===t?void 0:t.currentTime)),C(nx,this,A(gx,this,Jx).call(this)),setTimeout((()=>A(gx,this,$x).call(this)),0))}function Bx(){M(ax,this)&&M(ax,this).abort(),C(ax,this,Ag()),M(rx,this).size&&M(rx,this).forEach((t=>{(null==t?void 0:t.controller)&&t.controller.abort()})),M(rx,this).clear(),M(tx,this).clear(),M(ex,this).clear(),C(nx,this,[]),M(ix,this).clear(),C(ox,this,!1),C(sx,this,void 0),C(px,this,!1),C(mx,this,[])}function zx(t){if(A(gx,this,kx).call(this))return;const e=null==t?void 0:t.nodeId;if(!e)return;const n=M(tx,this).get(e);if(n){const i=Ap(n),r=Ap(t);Number.isFinite(i)?Number.isFinite(r)&&r<i&&M(tx,this).set(e,t):Number.isFinite(r)&&M(tx,this).set(e,t)}else M(tx,this).set(e,t);const i=M(sx,this);C(sx,this,e),i&&i!==e&&C(nx,this,[]),M(ox,this)?setTimeout((()=>A(gx,this,$x).call(this)),0):A(gx,this,Wx).call(this)}function Wx(){M(ox,this)||M(tx,this).size&&(C(ox,this,!0),A(gx,this,$x).call(this))}async function $x(){if(A(gx,this,kx).call(this))return;if(M(ix,this).size>=this.settings.maxConcurrentLoads)return;if(M(px,this))return void(M(mx,this).length&&A(gx,this,Ux).call(this));const t=A(gx,this,Gx).call(this);if(t.hasPending)A(gx,this,Kx).call(this,t);else for(M(nx,this).length||C(nx,this,A(gx,this,Jx).call(this));M(ix,this).size<this.settings.maxConcurrentLoads&&M(nx,this).length;){const t=M(nx,this).shift();A(gx,this,ew).call(this,t,"partial").finally((()=>{setTimeout((()=>A(gx,this,$x).call(this)),0)}))}}function Ux(){if(A(gx,this,kx).call(this))return;const t=Math.max(0,this.settings.maxConcurrentLoads-M(ix,this).size);if(!t||!M(mx,this).length)return;const e=[],n=[];for(let i=0;i<M(mx,this).length;i+=1){const r=M(mx,this)[i];(null==r?void 0:r.nodeId)&&(e.length<t&&!M(ix,this).has(r.nodeId)?e.push(r):n.push(r))}C(mx,this,n),e.forEach((t=>{A(gx,this,jx).call(this,t).finally((()=>{setTimeout((()=>A(gx,this,$x).call(this)),0)}))}))}async function jx(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(M(ix,this).has(e))return;const{signal:r,controller:o}=A(gx,this,Ax).call(this,e);if(r&&r.aborted)A(gx,this,Mx).call(this,e,o);else{M(ix,this).add(e);try{const t=M(Qk,this)&&"function"==typeof M(Qk,this).get?M(Qk,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=A(gx,this,qx).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}`),A(gx,this,Nx).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){Mg(t,r)||this.log.warn(`[#loadSeekWork] SegmentLoadCoordinator failed to seek-load node ${e}: ${(null==t?void 0:t.message)||t}`)}finally{M(ix,this).delete(e),A(gx,this,Mx).call(this,e,o)}}}function qx(t,e,n){var i;const r=Ap(e);if(!Number.isFinite(r))return;const o=Yk(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=Yk(null===(i=l)||void 0===i?void 0:i.offset),d=dy(c,Math.max(0,s-u),{preferRepresentationTime:!0}),h=Number(null==d?void 0:d.offset);return Number.isFinite(h)?h:void 0}function Vx(t,e,n=(t=>null===(t=M(Zk,this))||void 0===t?void 0:t.currentTime)()){var i;const r=(Array.isArray(null===(i=M(Zk,this))||void 0===i?void 0:i.placements)?M(Zk,this).placements:[]).filter((e=>(null==e?void 0:e.nodeId)===t&&Number.isFinite(Ap(e)))).sort(((t,e)=>Ap(t)-Ap(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=Ap(e);if(!Number.isFinite(n))continue;const i=Ep(e,M(Qk,this)),l=Number.isFinite(i)&&i>=0;(!a&&n>=o-Kk&&(a=e),l)?o+Kk>=n&&o<n+i-Kk&&(s=e):o+Kk>=n&&(s=e)}return s||a||r[r.length-1]}function Hx(t,e){var n;const i=Number(Ap(e));if(!Number.isFinite(i))return;const r=Ep(e,M(Qk,this)),o=Number.isFinite(r)&&r>=0?i+r:void 0,s=(Array.isArray(null===(n=M(Zk,this))||void 0===n?void 0:n.placements)?M(Zk,this).placements:[]).filter((e=>(null==e?void 0:e.nodeId)===t&&Number.isFinite(Ap(e)))).sort(((t,e)=>Ap(t)-Ap(e)));for(let t=0;t<s.length;t+=1){const e=s[t],n=Number(Ap(e));if(Number.isFinite(n)&&!(n<=i+Kk)){if(Number.isFinite(o)&&n>o+Kk)return;return e}}}function Gx(){const t=[];let e=!1,n=1/0;if(M(tx,this).forEach(((i,r)=>{if(!r||!i)return;const o=M(ex,this).get(r);if(o)return e=!0,void(n=Math.min(n,Yk(o.timelineStart)));const s=A(gx,this,Xx).call(this,r,i);s&&(e=!0,n=Math.min(n,Yk(s.timelineStart)),t.push(s))})),!e||!Number.isFinite(n))return{hasPending:!1,waveTime:void 0,startable:[]};const i=t.filter((t=>Yk(t.timelineStart)===n&&!M(ix,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 Kx({waveTime:t,startable:e}){const n=Math.max(0,this.settings.maxConcurrentLoads-M(ix,this).size);n&&e.length&&e.slice(0,n).forEach((e=>{A(gx,this,Qx).call(this,e,t).finally((()=>{setTimeout((()=>A(gx,this,$x).call(this)),0)}))}))}function Xx(t,e){var n,i;const r=M(Qk,this)&&"function"==typeof M(Qk,this).get?M(Qk,this).get(t):void 0;if(!r)return;if("function"==typeof r.hasExceededManifestLoadAttempts&&r.hasExceededManifestLoadAttempts())return void M(tx,this).delete(t);const o=A(gx,this,Vx).call(this,t,e,null===(n=M(Zk,this))||void 0===n?void 0:n.currentTime),s=Number(Ap(o)),a=Yk(null===(i=M(Zk,this))||void 0===i?void 0:i.currentTime),l="function"==typeof r.loadMediaSegmentsAtOffset,c="function"==typeof r.load;if(!l&&!c)return void M(tx,this).delete(t);if(r.isLoaded)return void M(tx,this).delete(t);if("ready"!==r.state){if(!Number.isFinite(s))return;return{nodeId:t,segmentOffset:0,timelineStart:s}}if(!A(gx,this,nw).call(this,r))return void M(tx,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&&!A(gx,this,_x).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/Kk)*Kk;h.add(t)}}))}));const f=Array.from(h).sort(((t,e)=>t-e)),p=e=>{const n=Number(Ap(e));if(!Number.isFinite(n))return{status:"none"};const i=Yk(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+Kk;t+=1)s=t;const l=f.slice(s);if(!l.some((t=>A(gx,this,Yx).call(this,r,t))))return{status:f.slice(0,s).some((t=>A(gx,this,Yx).call(this,r,t)))?"beforeOnly":"none"};const c=l.find((t=>A(gx,this,Yx).call(this,r,t))),u=Math.max(0,Yk(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};M(tx,this).delete(t)}else{const e=A(gx,this,Hx).call(this,t,o);if(e){const t=p(e);if("work"===t.status)return t.work}}}function Yx(t,e){const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[],i=Yk(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)<=Kk&&!A(gx,this,_x).call(this,t)}))))}async function Qx(t,e){const n=null==t?void 0:t.nodeId,i=null==t?void 0:t.segmentOffset;if(this.log.debug(`[#loadP0Work] Loading ${Xk} node [${n}] at segmentOffset=${i} wave=${e}`),!n)return;const r=M(Qk,this)&&"function"==typeof M(Qk,this).get?M(Qk,this).get(n):void 0;if(!r)return void M(tx,this).delete(n);const o="function"==typeof r.loadMediaSegmentsAtOffset&&Number.isFinite(i),{signal:s,controller:a}=A(gx,this,Ax).call(this,n,{allowSeekKeep:o,segmentOffset:i});if(s&&s.aborted)A(gx,this,Mx).call(this,n,a);else{M(ix,this).add(n),M(ex,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(Mg(t,s))return;const e=`[#loadP0Work] SegmentLoadCoordinator failed to load ${Xk} work for node ${n}: ${(null==t?void 0:t.message)||t}`;this.log.warn(e)}finally{this.log.debug(`[#loadP0Work] Finished ${Xk} work for node [${n}]`),M(ex,this).delete(n),M(ix,this).delete(n),A(gx,this,Mx).call(this,n,a)}}}function Jx(){const t=new Set([...M(tx,this).keys(),...M(ix,this)]),e=A(gx,this,Zx).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&&A(gx,this,iw).call(this,t));if(i){const e=Zb({prioritizer:M(Jk,this),repository:M(Qk,this),startNodeId:M(sx,this),prioritizedIds:n,pendingIds:t,allowedIds:i,filter:r});if(e.length)return e}return Zb({prioritizer:M(Jk,this),repository:M(Qk,this),startNodeId:M(sx,this),prioritizedIds:n,pendingIds:t,filter:r})}function Zx(){return M(Jk,this)&&M(sx,this)?"function"==typeof M(Jk,this).getPrioritizationSnapshot?M(Jk,this).getPrioritizationSnapshot(M(sx,this)):{orderedIds:"function"==typeof M(Jk,this).sortNodes?M(Jk,this).sortNodes(M(sx,this)):[],reachableIds:"function"==typeof M(Jk,this).getReachableNodeIds?M(Jk,this).getReachableNodeIds(M(sx,this)):[]}:null}function tw(){A(gx,this,kx).call(this)||(M(ox,this)||M(tx,this).size)&&(C(nx,this,A(gx,this,Jx).call(this)),M(ox,this)&&!M(px,this)&&A(gx,this,$x).call(this))}async function ew(t,e){if(this.log.debug(`[#loadNode] Loading node [${t}] in '${e}' mode`),!t)return;const n=M(Qk,this)&&"function"==typeof M(Qk,this).get?M(Qk,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}=A(gx,this,Ax).call(this,t,{allowSeekKeep:!1});if(i&&i.aborted)A(gx,this,Mx).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&&A(gx,this,iw).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${t}: partial already loaded`);if(!A(gx,this,nw).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${t}: no loadable tracks`);M(ix,this).add(t),await n.load({loadingMode:e,signal:i})}catch(e){if(Mg(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}]`),M(ix,this).delete(t),A(gx,this,Mx).call(this,t,r)}}function nw(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 iw(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&&!A(gx,this,_x).call(this,n)||i&&!A(gx,this,_x).call(this,i))}))}class rw extends Iu{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 ow(t){if(!t)throw new Error("Assertion failed.")}const sw=t=>t&&t[t.length-1],aw=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)},lw=t=>t.constructor===Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t),cw=t=>t.constructor===DataView?t:ArrayBuffer.isView(t)?new DataView(t.buffer,t.byteOffset,t.byteLength):new DataView(t),uw=new TextDecoder,dw=t=>Object.fromEntries(Object.entries(t).map((([t,e])=>[e,t]))),hw={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},fw=dw(hw),pw={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},mw=dw(pw),vw={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},gw=dw(vw),yw=t=>[...t].map((t=>t.toString(16).padStart(2,"0"))).join(""),bw=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,kw=(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},xw=(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},ww=()=>{let t,e;return{promise:new Promise(((n,i)=>{t=n,e=i})),resolve:t,reject:e}},_w=(t,e,n)=>t.getUint8(e)<<16|t.getUint8(e+1)<<8|t.getUint8(e+2),Tw=(t,e,n)=>Math.max(e,Math.min(n,t)),Iw=/^[a-z]{3}$/,Ew=1e6*(1+Number.EPSILON);let Sw=null;let Aw=null;const Nw=()=>{if(null!==Aw)return Aw;if("undefined"==typeof navigator)return null;const t=/\bChrome\/(\d+)/.exec(navigator.userAgent);return t?Aw=Number(t[1]):null},Mw=t=>"number"==typeof t&&!Number.isNaN(t);class Fw{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 Cw={default:!0,forced:!1,original:!1,commentary:!1,hearingImpaired:!1,visuallyImpaired:!1};class Ow{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 Ow(this.bytes);return t.pos=this.pos,t}}const Pw=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Rw=[-1,1,2,3,4,5,6,8],Dw=t=>{if(!t||t.byteLength<2)throw new TypeError("AAC description must be at least 2 bytes long.");const e=new Ow(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<Pw.length&&(r=Pw[i]);const o=e.readBits(4);let s=null;return o>=1&&o<=7&&(s=Rw[o]),{objectType:n,frequencyIndex:i,sampleRate:r,channelConfiguration:o,numberOfChannels:s}},Lw=["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"],Bw=[{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}],zw=t=>{const{codec:e,codecDescription:n,colorSpace:i,avcCodecInfo:r,hevcCodecInfo:o,vp9CodecInfo:s,av1CodecInfo:a}=t;if("avc"===e){if(ow(null!==t.avcType),r){const e=new Uint8Array([r.avcProfileIndication,r.profileCompatibility,r.avcLevelIndication]);return`avc${t.avcType}.${yw(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}.${yw(n.subarray(1,4))}`}if("hevc"===e){let t,e,i,r,s,a;if(o)t=o.generalProfileSpace,e=o.generalProfileIdc,i=bw(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=cw(n),l=o.getUint8(1);t=l>>6&3,e=31&l,i=bw(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=sw(Bw).level;for(const t of Bw)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=sw(Bw).level;for(const t of Bw)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?hw[i.primaries]:1,u=null!=i&&i.transfer?pw[i.transfer]:1,d=null!=i&&i.matrix?vw[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}'.`)},Ww=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:Dw(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&&Lw.includes(e))return e;throw new TypeError(`Unhandled codec '${e}'.`)},$w=/^pcm-([usf])(\d+)+(be)?$/,Uw=[48e3,44100,32e3],jw=[24e3,22050,16e3];var qw,Vw;!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"}(qw||(qw={})),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"}(Vw||(Vw={}));const Hw=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})},Gw=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=_w(i,n):(ow(4===e),t=i.getUint32(n,!1)),n+=e,yield{offset:n,length:t},n+=t}},Kw=t=>31&t,Xw=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)},Yw=t=>t>>1&63,Qw=function*(t){const e=new Ow(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);ow(e.pos%8==0),yield{type:i,data:t.subarray(e.pos/8,e.pos/8+s)},e.skipBits(8*s)}};var Jw;!function(t){t[t.STREAMINFO=0]="STREAMINFO",t[t.VORBIS_COMMENT=4]="VORBIS_COMMENT",t[t.PICTURE=6]="PICTURE"}(Jw||(Jw={}));const Zw=[2,1,2,3,3,4,4,5];class t_{constructor(t){this.input=t}}const e_=[],n_=[],i_=new Uint8Array(0);class r_{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===i_&&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===i_}get microsecondTimestamp(){return Math.trunc(Ew*this.timestamp)}get microsecondDuration(){return Math.trunc(Ew*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 r_(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 r_(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 o_=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.")},s_=t=>{if(!Mw(t))throw new TypeError("timestamp must be a number.")},a_=(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 l_{constructor(t){if(!(t instanceof c_))throw new TypeError("track must be an InputTrack.");this._track=t}getFirstPacket(t={}){if(o_(t),this._track.input._disposed)throw new R_;return a_(this._track,this._track._backing.getFirstPacket(t),t)}async getFirstKeyPacket(t={}){o_(t);const e=await this.getFirstPacket(t);return e?"key"===e.type?e:this.getNextKeyPacket(e,t):null}getPacket(t,e={}){if(s_(t),o_(e),this._track.input._disposed)throw new R_;return a_(this._track,this._track._backing.getPacket(t,e),e)}getNextPacket(t,e={}){if(!(t instanceof r_))throw new TypeError("packet must be an EncodedPacket.");if(o_(e),this._track.input._disposed)throw new R_;return a_(this._track,this._track._backing.getNextPacket(t,e),e)}async getKeyPacket(t,e={}){if(s_(t),o_(e),this._track.input._disposed)throw new R_;if(!e.verifyKeyPackets)return this._track._backing.getKeyPacket(t,e);const n=await this._track._backing.getKeyPacket(t,e);return n?(ow("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 r_))throw new TypeError("packet must be an EncodedPacket.");if(o_(e),this._track.input._disposed)throw new R_;if(!e.verifyKeyPackets)return this._track._backing.getNextKeyPacket(t,e);const n=await this._track._backing.getNextKeyPacket(t,e);return n?(ow("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 r_))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 r_))throw new TypeError("endPacket must be an EncodedPacket.");if(o_(n),this._track.input._disposed)throw new R_;const i=[];let{promise:r,resolve:o}=ww(),{promise:s,resolve:a}=ww(),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}=ww()),await s):(i.push(u),o(),({promise:r,resolve:o}=ww()),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 R_;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 c_{constructor(t,e){this.input=t,this._backing=e}isVideoTrack(){return this instanceof u_}isAudioTrack(){return this instanceof d_}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 l_(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 u_ extends c_{constructor(t,e){super(t,e),this._backing=e,this.pixelAspectRatio=(t=>{ow(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 ow(null!==e),e_.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 r_))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 ow(e),((t,e,n)=>{switch(t){case"avc":for(const t of((t,e)=>{if(e.description){const n=3&lw(e.description)[4];return Gw(t,n+1)}return Hw(t)})(n,e)){const e=n[t.offset],r=Kw(e);if(r>=qw.NON_IDR_SLICE&&r<=qw.SLICE_DPC)return"delta";if(r===qw.IDR)return"key";if(r===qw.SEI&&(i=void 0,!(null!==Sw?Sw:Sw=!("undefined"==typeof navigator||(null===(i=navigator.vendor)||void 0===i||!i.includes("Google Inc"))&&!/Chrome/.test(navigator.userAgent)))||Nw()>=144)){const e=n.subarray(t.offset,t.offset+t.length),i=Xw(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 Ow(i);t.pos=8*r;const e=aw(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&lw(e.description)[21];return Gw(t,n+1)}return Hw(t)})(n,e)){const e=Yw(n[t.offset]);if(e<Vw.BLA_W_LP)return"delta";if(e<=Vw.RSV_IRAP_VCL23)return"key"}return"delta";case"vp8":return 1&n[0]?"delta":"key";case"vp9":{const t=new Ow(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 Qw(n))if(1===e){const e=new Ow(i);e.skipBits(4),t=!!e.readBits(1)}else if(3===e||6===e||7===e){if(t)return"key";const e=new Ow(i);return e.readBits(1)?null:0===e.readBits(2)?"key":"delta"}return null}default:(t=>{throw new Error(`Unexpected value: ${t}`)})(t),ow(!1)}var i})(this.codec,e,t.data)}}class d_ extends c_{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 ow(null!==e),n_.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 r_))throw new TypeError("packet must be an EncodedPacket.");return null===this.codec?null:"key"}}const h_=t=>{let e=q_(t);const n=X_(t,4);let i=8;1===e&&(e=H_(t),i=16);const r=e-i;return r<0?null:{name:n,totalSize:e,headerSize:i,contentSize:r}},f_=t=>V_(t)/65536,p_=t=>V_(t)/1073741824,m_=t=>{let e=0;for(let n=0;n<4;n++){e<<=7;const n=W_(t);if(e|=127&n,!(128&n))break}return e},v_=t=>{let e=$_(t);return t.skip(2),e=Math.min(e,t.remainingLength),uw.decode(z_(t,e))},g_=t=>{const e=h_(t);if(!e||"data"!==e.name)return null;if(t.remainingLength<8)return null;const n=q_(t);t.skip(4);const i=z_(t,e.contentSize-8);switch(n){case 1:return uw.decode(i);case 2:return new TextDecoder("utf-16be").decode(i);case 13:return new Fw(i,"image/jpeg");case 14:return new Fw(i,"image/png");case 27:return new Fw(i,"image/bmp");default:return i}};class y_ extends t_{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=h_(e);if(!i)break;if("ftyp"===i.name){const t=X_(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),ow(t);const e=q_(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=h_(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,ow(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&&Lw.includes(t.info.codec)&&0===n.sampleCompositionTimeOffsets.length){var r;ow("audio"===(null===(r=t.info)||void 0===r?void 0:r.type));const e=(t=>{if(ow(Lw.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=$w.exec(t);let n;return ow(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=xw(n.sampleTimingEntries,a,(t=>t.startIndex)),u=n.sampleTimingEntries[c],d=xw(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=sw(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),ow(n);const i=h_(n);ow("moof"===(null==i?void 0:i.name));let r=this.reader.requestSlice(t,i.totalSize);r instanceof Promise&&(r=await r),ow(r),this.traverseBox(r);const o=this.lastReadFragment;ow(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)E_(t,i.timestamp);else{const e=xw(n,o.moofOffset-1,(t=>t.moofOffset));if(-1!==e){const i=n[e];E_(t,i.endTimestamp)}}t.startTimestampIsFinal=!0}const i=xw(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=h_(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,_,T,I,E,S,A,N,M,F,C,O,P,R,D;const L=t.filePos,B=h_(t);if(!B)return!1;const z=t.filePos,W=L+B.totalSize;switch(B.name){case"mdia":case"minf":case"dinf":case"mfra":case"edts":case"wave":this.readContiguousBoxes(t.slice(z,B.contentSize));break;case"mvhd":{const e=W_(t);t.skip(3),1===e?(t.skip(16),this.movieTimescale=q_(t),this.movieDurationInTimescale=H_(t)):(t.skip(8),this.movieTimescale=q_(t),this.movieDurationInTimescale=q_(t))}break;case"trak":{const e={id:-1,demuxer:this,inputTrack:null,disposition:{...Cw},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,B.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 u_(this.input,new k_(t)),this.tracks.push(e)}else if("audio"===e.info.type&&-1!==e.info.numberOfChannels){const t=e;e.inputTrack=new d_(this.input,new x_(t)),this.tracks.push(e)}this.currentTrack=null}break;case"tkhd":{const e=this.currentTrack;if(!e)break;const n=W_(t),i=!!(1&U_(t));if(e.disposition.default=i,0===n)t.skip(8),e.id=q_(t),t.skip(4),e.durationInMovieTimescale=q_(t);else{if(1!==n)throw new Error(`Incorrect track header version ${n}.`);t.skip(16),e.id=q_(t),t.skip(4),e.durationInMovieTimescale=H_(t)}t.skip(16);const r=[f_(t),f_(t),p_(t),f_(t),f_(t),p_(t),f_(t),f_(t),p_(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=S_(r),90*Math.round(Ct/90)));ow(0===o||90===o||180===o||270===o),e.rotation=o}break;case"elst":{const e=this.currentTrack;if(!e)break;const n=W_(t);t.skip(3);let i=!1,r=0;const o=q_(t);for(let s=0;s<o;s++){const o=1===n?H_(t):q_(t),s=1===n?G_(t):V_(t),a=f_(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=W_(t);t.skip(3),0===n?(t.skip(8),e.timescale=q_(t),e.durationInMediaTimescale=q_(t)):1===n&&(t.skip(16),e.timescale=q_(t),e.durationInMediaTimescale=H_(t));let i=$_(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,Iw.test(Ft)||(e.languageCode="und")}}break;case"hdlr":{const e=this.currentTrack;if(!e)break;t.skip(8);const n=X_(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=L,this.readContiguousBoxes(t.slice(z,B.contentSize))}break;case"stsd":{const e=this.currentTrack;if(!e)break;if(null===e.info||e.sampleTable)break;const n=W_(t);t.skip(3);const i=q_(t);for(let r=0;r<i;r++){const i=t.filePos,r=h_(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=$_(t),e.info.height=$_(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=$_(t);t.skip(6);let a=$_(t),l=$_(t);t.skip(4);let c=q_(t)/65536;if(0===n&&s>0)if(1===s)t.skip(4),l=8*q_(t),t.skip(8);else if(2===s){t.skip(4),c=K_(t),a=q_(t),t.skip(4),l=q_(t);const n=q_(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;ow(e.info),e.info.codecDescription=z_(t,B.contentSize)}break;case"hvcC":{const e=this.currentTrack;if(!e)break;ow(e.info),e.info.codecDescription=z_(t,B.contentSize)}break;case"vpcC":{var $;const e=this.currentTrack;if(!e)break;ow("video"===(null===($=e.info)||void 0===$?void 0:$.type)),t.skip(4);const n=W_(t),i=W_(t),r=W_(t),o=r>>4,s=r>>1&7,a=1&r,l=W_(t),c=W_(t),u=W_(t);e.info.vp9CodecInfo={profile:n,level:i,bitDepth:o,chromaSubsampling:s,videoFullRangeFlag:a,colourPrimaries:l,transferCharacteristics:c,matrixCoefficients:u}}break;case"av1C":{var U;const e=this.currentTrack;if(!e)break;ow("video"===(null===(U=e.info)||void 0===U?void 0:U.type)),t.skip(1);const n=W_(t),i=n>>5,r=31&n,o=W_(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 j;const e=this.currentTrack;if(!e)break;if(ow("video"===(null===(j=e.info)||void 0===j?void 0:j.type)),"nclx"!==X_(t,4))break;const n=$_(t),i=$_(t),r=$_(t),o=Boolean(128&W_(t));e.info.colorSpace={primaries:fw[n],transfer:mw[i],matrix:gw[r],fullRange:o}}break;case"pasp":{var q;const e=this.currentTrack;if(!e)break;ow("video"===(null===(q=e.info)||void 0===q?void 0:q.type));const n=q_(t),i=q_(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;ow("audio"===(null===(V=e.info)||void 0===V?void 0:V.type)),t.skip(4),ow(3===W_(t)),m_(t),t.skip(2);const n=W_(t),i=!!(64&n),r=!!(32&n);if(!!(128&n)&&t.skip(2),i){const e=W_(t);t.skip(e)}r&&t.skip(2),ow(4===W_(t));const o=m_(t),s=t.filePos,a=W_(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){ow(5===W_(t));const n=m_(t);if(e.info.codecDescription=z_(t,n),"aac"===e.info.codec){const t=Dw(e.info.codecDescription);null!==t.numberOfChannels&&(e.info.numberOfChannels=t.numberOfChannels),null!==t.sampleRate&&(e.info.sampleRate=t.sampleRate)}}}break;case"enda":{var H;const e=this.currentTrack;if(!e)break;ow("audio"===(null===(H=e.info)||void 0===H?void 0:H.type)),255&$_(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 G;const e=this.currentTrack;if(!e)break;ow("audio"===(null===(G=e.info)||void 0===G?void 0:G.type)),t.skip(4);const n=W_(t),i=Boolean(1&n),r=W_(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;ow("audio"===(null===(K=e.info)||void 0===K?void 0:K.type)),t.skip(1);const n=W_(t),i=$_(t),r=q_(t),o=j_(t),s=W_(t);let a;a=0!==s?z_(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;ow("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=W_(t),o=U_(t);if((r&n)===Jw.STREAMINFO){t.skip(10);const n=q_(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=z_(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;ow("audio"===(null===(Y=e.info)||void 0===Y?void 0:Y.type));const n=z_(t,3),i=new Ow(n),r=i.readBits(2);i.skipBits(8);const o=i.readBits(3),s=i.readBits(1);r<3&&(e.info.sampleRate=Uw[r]),e.info.numberOfChannels=Zw[o]+s}break;case"dec3":{var Q;const e=this.currentTrack;if(!e)break;ow("audio"===(null===(Q=e.info)||void 0===Q?void 0:Q.type));const n=(t=>{if(t.length<2)return null;const e=new Ow(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}})(z_(t,B.contentSize));if(!n){console.warn("Invalid dec3 box contents, ignoring.");break}const i=(t=>{const e=t.substreams[0];return ow(e),e.fscod<3?Uw[e.fscod]:null!==e.fscod2&&e.fscod2<3?jw[e.fscod2]:null})(n);null!==i&&(e.info.sampleRate=i),e.info.numberOfChannels=(t=>{const e=t.substreams[0];ow(e);let n=Zw[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=q_(t);let i=0,r=0;for(let o=0;o<n;o++){const n=q_(t),o=q_(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=q_(t);let i=0;for(let r=0;r<n;r++){const n=q_(t),r=V_(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=q_(t),i=q_(t);if(0===n)for(let n=0;n<i;n++){const n=q_(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=W_(t),i=q_(t),r=z_(t,Math.ceil(i*n/8)),o=new Ow(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=q_(t);for(let i=0;i<n;i++){const n=q_(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=q_(t);for(let i=0;i<n;i++){const n=q_(t)-1,i=q_(t),r=q_(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=q_(t);for(let i=0;i<n;i++){const n=q_(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=q_(t);for(let i=0;i<n;i++){const n=H_(t);e.sampleTable.chunkOffsets.push(n)}}break;case"mvex":this.isFragmented=!0,this.readContiguousBoxes(t.slice(z,B.contentSize));break;case"mehd":{const e=W_(t);t.skip(3);const n=1===e?H_(t):q_(t);this.movieDurationInTimescale=n}break;case"trex":{t.skip(4);const e=q_(t),n=q_(t),i=q_(t),r=q_(t),o=q_(t);this.fragmentTrackDefaults.push({trackId:e,defaultSampleDescriptionIndex:n,defaultSampleDuration:i,defaultSampleSize:r,defaultSampleFlags:o})}break;case"tfra":{const e=W_(t);t.skip(3);const n=q_(t),i=this.tracks.find((t=>t.id===n));if(!i)break;const r=q_(t),o=(12&r)>>2,s=3&r,a=[W_,$_,U_,q_],l=a[(48&r)>>4],c=a[o],u=a[s],d=q_(t);for(let n=0;n<d;n++){const n=1===e?H_(t):q_(t),r=1===e?H_(t):q_(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:L,moofSize:B.totalSize,implicitBaseDataOffset:L,trackData:new Map},this.readContiguousBoxes(t.slice(z,B.contentSize)),this.lastReadFragment=this.currentFragment,this.currentFragment=null;break;case"traf":if(ow(this.currentFragment),this.readContiguousBoxes(t.slice(z,B.contentSize)),this.currentTrack){const t=this.currentFragment.trackData.get(this.currentTrack.id);if(t){const{currentFragmentState:e}=this.currentTrack;ow(e),null!==e.startTimestamp&&(E_(t,e.startTimestamp),t.startTimestampIsFinal=!0)}this.currentTrack.currentFragmentState=null,this.currentTrack=null}break;case"tfhd":{var J,Z,tt,et;ow(this.currentFragment),t.skip(1);const e=U_(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=q_(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=H_(t):l&&(u.currentFragmentState.baseDataOffset=this.currentFragment.moofOffset),i&&(u.currentFragmentState.sampleDescriptionIndex=q_(t)),r&&(u.currentFragmentState.defaultSampleDuration=q_(t)),o&&(u.currentFragmentState.defaultSampleSize=q_(t)),s&&(u.currentFragmentState.defaultSampleFlags=q_(t)),a&&(u.currentFragmentState.defaultSampleDuration=0)}break;case"tfdt":{const e=this.currentTrack;if(!e)break;ow(e.currentFragmentState);const n=W_(t);t.skip(3);const i=0===n?q_(t):H_(t);e.currentFragmentState.startTimestamp=i}break;case"trun":{const e=this.currentTrack;if(!e)break;if(ow(this.currentFragment),ow(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=W_(t),i=U_(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=q_(t);let d=e.currentFragmentState.baseDataOffset;r&&(d+=V_(t));let h=null;o&&(h=q_(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=q_(t):(ow(null!==e.currentFragmentState.defaultSampleDuration),r=e.currentFragmentState.defaultSampleDuration),a?o=q_(t):(ow(null!==e.currentFragmentState.defaultSampleSize),o=e.currentFragmentState.defaultSampleSize),l?u=q_(t):(ow(null!==e.currentFragmentState.defaultSampleFlags),u=e.currentFragmentState.defaultSampleFlags),0===i&&null!==h&&(u=h);let d=0;c&&(d=0===n?q_(t):V_(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[sw(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,B.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]=v_(y)):null!==(ct=(at=this.metadataTags.raw)[lt=t.name])&&void 0!==ct||(at[lt]=z_(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=uw.decode(z_(y,t.contentSize)):null!==(n=(e=this.metadataTags).title)&&void 0!==n||(e.title=v_(y));break;case"©des":this.currentTrack||null!==(r=(i=this.metadataTags).description)&&void 0!==r||(i.description=v_(y));break;case"©ART":this.currentTrack||null!==(s=(o=this.metadataTags).artist)&&void 0!==s||(o.artist=v_(y));break;case"©alb":this.currentTrack||null!==(l=(a=this.metadataTags).album)&&void 0!==l||(a.album=v_(y));break;case"albr":this.currentTrack||null!==(u=(c=this.metadataTags).albumArtist)&&void 0!==u||(c.albumArtist=v_(y));break;case"©gen":this.currentTrack||null!==(h=(d=this.metadataTags).genre)&&void 0!==h||(d.genre=v_(y));break;case"©day":if(!this.currentTrack){var ut,dt;const t=new Date(v_(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=v_(y));break;case"©lyr":this.currentTrack||null!==(v=(m=this.metadataTags).lyrics)&&void 0!==v||(m.lyrics=v_(y))}}}break;case"meta":{if(this.currentTrack)break;const e=0!==q_(t);this.currentMetadataKeys=new Map,e?this.readContiguousBoxes(t.slice(z,B.contentSize)):this.readContiguousBoxes(t.slice(z+4,B.contentSize-4)),this.currentMetadataKeys=null}break;case"keys":{if(!this.currentMetadataKeys)break;t.skip(4);const e=q_(t);for(let n=0;n<e;n++){const e=q_(t);t.skip(4);const i=uw.decode(z_(t,e-8));this.currentMetadataKeys.set(n+1,i)}}break;case"ilst":{if(!this.currentMetadataKeys)break;const e=this.iterateContiguousBoxes(t.slice(z,B.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=g_(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!==(T=(_=this.metadataTags).album)&&void 0!==T||(_.album=r));break;case"aART":case"album_artist":"string"==typeof r&&(null!==(E=(I=this.metadataTags).albumArtist)&&void 0!==E||(I.albumArtist=r));break;case"©cmt":case"com.apple.quicktime.comment":case"comment":"string"==typeof r&&(null!==(A=(S=this.metadataTags).comment)&&void 0!==A||(S.comment=r));break;case"©gen":case"gnre":case"com.apple.quicktime.genre":case"genre":"string"==typeof r&&(null!==(M=(N=this.metadataTags).genre)&&void 0!==M||(N.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 Fw?(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,Tt,It,Et;const t=cw(r),e=t.getUint16(2,!1),n=t.getUint16(4,!1);e>0&&(null!==(Tt=(_t=this.metadataTags).trackNumber)&&void 0!==Tt||(_t.trackNumber=e)),n>0&&(null!==(Et=(It=this.metadataTags).tracksTotal)&&void 0!==Et||(It.tracksTotal=n))}break;case"disc":case"disk":if(r instanceof Uint8Array&&r.length>=6){var St,At,Nt,Mt;const t=cw(r),e=t.getUint16(2,!1),n=t.getUint16(4,!1);e>0&&(null!==(At=(St=this.metadataTags).discNumber)&&void 0!==At||(St.discNumber=e)),n>0&&(null!==(Mt=(Nt=this.metadataTags).discsTotal)&&void 0!==Mt||(Nt.discsTotal=n))}}}}}var Ft,Ct;return t.filePos=W,!0}}class b_{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=w_(i,n),o=await this.fetchPacketForSampleIndex(r,e);return A_(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=xw(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=__(i,n),o=await this.fetchPacketForSampleIndex(r,e);return A_(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=I_(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 ow(-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=T_(n,t);if(!i)return null;let r;if(e.metadataOnly)r=i_;else{let t=this.internalTrack.demuxer.reader.requestSlice(i.sampleOffset,i.sampleSize);t instanceof Promise&&(t=await t),ow(t),r=z_(t,i.sampleSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new r_(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(ow(i),n.metadataOnly)r=i_;else{let t=this.internalTrack.demuxer.reader.requestSlice(i.byteOffset,i.byteSize);t instanceof Promise&&(t=await t),ow(t),r=z_(t,i.byteSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new r_(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=xw(this.internalTrack.fragmentLookupTable,n,(t=>t.timestamp)),h=-1!==d?this.internalTrack.fragmentLookupTable[d]:null,f=xw(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=h_(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];ow(!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 k_ extends b_{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 Qw(t)){if(1!==e)continue;const t=new Ow(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 Ow(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=sw(Bw).level;for(const t of Bw)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:zw(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 x_ extends b_{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:Ww(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 w_=(t,e)=>{if(t.presentationTimestamps){const n=xw(t.presentationTimestamps,e,(t=>t.presentationTimestamp));return-1===n?-1:t.presentationTimestamps[n].sampleIndex}{const n=xw(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,e)=>{if(!t.keySampleIndices)return w_(t,e);if(t.presentationTimestamps){const n=xw(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!==kw(t.keySampleIndices,n,(t=>t)))return n}return-1}{var n;const i=w_(t,e),r=xw(t.keySampleIndices,i,(t=>t));return null!==(n=t.keySampleIndices[r])&&void 0!==n?n:-1}},T_=(t,e)=>{const n=xw(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=xw(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=xw(t.sampleToChunk,e,(t=>t.startSampleIndex)),c=t.sampleToChunk[l];ow(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];ow(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!==kw(t.keySampleIndices,e,(t=>t))}},I_=(t,e)=>{var n;if(!t.keySampleIndices)return e+1;const i=xw(t.keySampleIndices,e,(t=>t));return null!==(n=t.keySampleIndices[i+1])&&void 0!==n?n:-1},E_=(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},S_=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},A_=t=>0===t.sampleSizes.length;class N_{}class M_ extends N_{async _getMajorBrand(t){let e=t._reader.requestSlice(0,12);return e instanceof Promise&&(e=await e),e?(e.skip(4),"ftyp"!==X_(e,4)?null:X_(e,4)):null}_createDemuxer(t){return new y_(t)}}const F_=new class extends M_{async _canReadInput(t){const e=await this._getMajorBrand(t);return!!e&&"qt "!==e}get name(){return"MP4"}get mimeType(){return"video/mp4"}};class C_{constructor(){this._disposed=!1,this._sizePromise=null,this.onread=null}async getSizeOrNull(){var t;if(this._disposed)throw new R_;return null!==(t=this._sizePromise)&&void 0!==t?t:this._sizePromise=Promise.resolve(this._retrieveSize())}async getSize(){if(this._disposed)throw new R_;const t=await this.getSizeOrNull();if(null===t)throw new Error("Cannot determine the size of an unsized source.");return t}}class O_ extends C_{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&&(!Mw(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=xw(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:cw(o),offset:t};this._currentIndex>r&&this._throwDueToCacheMiss();const{promise:s,resolve:a,reject:l}=ww();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:cw(e.bytes),offset:e.start}),this._pendingSlices.splice(t,1),t--))}for(this._cache.push({start:i,end:r,bytes:n,view:cw(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!==(ce=Symbol.dispose)&&void 0!==ce||(Symbol.dispose=Symbol("Symbol.dispose"));class P_{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 N_))))throw new TypeError("options.formats must be an array of InputFormat.");if(!(t.source instanceof C_))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 D_(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(),ow(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 R_ extends Error{constructor(t="Input has been disposed."){super(t),this.name="InputDisposedError"}}class D_{constructor(t){this.source=t}requestSlice(t,e){if(this.source._disposed)throw new R_;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 L_(e.bytes,e.view,e.offset,t,n):null)):i?new L_(i.bytes,i.view,i.offset,t,n):null}requestSliceRange(t,e,n){if(this.source._disposed)throw new R_;if(t<0)return null;if(null!==this.fileSize)return this.requestSlice(t,Tw(this.fileSize-t,e,n));{const i=this.requestSlice(t,n),r=i=>{if(i)return i;const r=i=>(ow(null!==i),this.requestSlice(t,Tw(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 L_{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 L_(t,cw(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 L_(this.bytes,this.view,this.offset,t,t+e)}}const B_=(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.`)},z_=(t,e)=>{B_(t,e);const n=t.bytes.subarray(t.bufferPos,t.bufferPos+e);return t.bufferPos+=e,n},W_=t=>(B_(t,1),t.view.getUint8(t.bufferPos++)),$_=t=>{B_(t,2);const e=t.view.getUint16(t.bufferPos,!1);return t.bufferPos+=2,e},U_=t=>{B_(t,3);const e=_w(t.view,t.bufferPos);return t.bufferPos+=3,e},j_=t=>{B_(t,2);const e=t.view.getInt16(t.bufferPos,!1);return t.bufferPos+=2,e},q_=t=>{B_(t,4);const e=t.view.getUint32(t.bufferPos,!1);return t.bufferPos+=4,e},V_=t=>{B_(t,4);const e=t.view.getInt32(t.bufferPos,!1);return t.bufferPos+=4,e},H_=t=>4294967296*q_(t)+q_(t),G_=t=>4294967296*V_(t)+q_(t),K_=t=>{B_(t,8);const e=t.view.getFloat64(t.bufferPos,!1);return t.bufferPos+=8,e},X_=(t,e)=>{B_(t,e);let n="";for(let i=0;i<e;i++)n+=String.fromCharCode(t.bytes[t.bufferPos++]);return n};var Y_=new WeakMap,Q_=new WeakMap,J_=new WeakMap,Z_=new WeakMap,tT=new WeakMap,eT=new WeakMap,nT=new WeakMap,iT=new WeakMap,rT=new WeakMap,oT=new WeakMap,sT=new WeakMap,aT=new WeakMap,lT=new WeakMap,cT=new WeakMap,uT=new WeakMap,dT=new WeakSet;class hT extends Iu{constructor(...t){super(...t),O(this,dT),F(this,Y_,null),F(this,Q_,null),F(this,J_,null),F(this,Z_,null),F(this,tT,!1),F(this,eT,!1),F(this,nT,!1),F(this,iT,!1),F(this,rT,void 0),F(this,oT,null),F(this,sT,null),F(this,aT,!1),F(this,lT,!1),F(this,cT,null),F(this,uT,!1)}get name(){return"FMP4Demuxer"}get defaults(){return{}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"pushChunk","endOfStream"])}pushChunk(t,e={}){if(M(nT,this)||M(iT,this))return;const n=t instanceof Uint8Array?t:new Uint8Array(t),i=!!e.isInit;C(oT,this,A(dT,this,yT).call(this,n,e,i)),i&&(C(rT,this,n),C(sT,this,null),this.trigger("demux:init",{data:n})),A(dT,this,gT).call(this);try{var r;const t=null===(r=M(Y_,this))||void 0===r?void 0:r.write(n);t&&"function"==typeof t.catch&&t.catch((t=>{A(dT,this,bT).call(this,t)}))}catch(t){if(M(nT,this)||A(dT,this,fT).call(this,t))return;return this.log.warn("[FMP4Demuxer] mediabunny demux failed",t),void A(dT,this,bT).call(this,t)}const o=A(dT,this,wT).call(this);o&&"function"==typeof o.catch&&o.catch((t=>{A(dT,this,bT).call(this,t)}))}endOfStream(){if(M(iT,this))return;if(M(aT,this))return;let t;C(aT,this,!0),C(lT,this,!1),C(uT,this,!1);try{var e;t=null===(e=M(Y_,this))||void 0===e?void 0:e.close()}catch(e){t=Promise.resolve()}let n=!1;A(dT,this,mT).call(this),C(cT,this,setTimeout((()=>{C(cT,this,null),n||M(lT,this)||M(iT,this)||A(dT,this,vT).call(this)}),20)),Promise.resolve(t).catch((()=>{})).finally((()=>{n=!0,A(dT,this,mT).call(this),A(dT,this,vT).call(this)}))}onDispose(){super.onDispose(),C(iT,this,!0);try{var t,e;null===(t=M(J_,this))||void 0===t||null===(e=t.close)||void 0===e||e.call(t)}catch(t){}this.endOfStream();try{var n,i;null===(n=M(Q_,this))||void 0===n||null===(i=n.dispose)||void 0===i||i.call(n)}catch(t){}C(J_,this,null),C(Q_,this,null),C(nT,this,!1),C(oT,this,null),C(Z_,this,null),C(tT,this,!1),C(eT,this,!1),C(aT,this,!1),C(lT,this,!1),C(uT,this,!1),A(dT,this,mT).call(this)}}function fT(t){return!!M(iT,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 pT(){try{var t,e;const n=null===(t=M(Y_,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){}C(Y_,this,null)}function mT(){null!==M(cT,this)&&(clearTimeout(M(cT,this)),C(cT,this,null))}function vT(){if(M(lT,this)||M(iT,this)||M(nT,this))return;if(C(lT,this,!0),M(eT,this))return void C(uT,this,!0);C(uT,this,!1);const t=A(dT,this,wT).call(this);t&&"function"==typeof t.catch&&t.catch((t=>{A(dT,this,bT).call(this,t)}))}function gT(){if(M(Q_,this)&&M(Y_,this))return;const t=Au.TransformStream;if(void 0===t)throw new Error("TransformStream is not available in this environment");const{readable:e,writable:n}=new t;C(Y_,this,n.getWriter()),C(Q_,this,new P_({source:new O_(e),formats:[F_]})),C(tT,this,!1)}function yT(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 bT(t){if(M(nT,this)||A(dT,this,fT).call(this,t))return;if(A(dT,this,xT).call(this,t))return void C(tT,this,!1);C(nT,this,!0),A(dT,this,pT).call(this);try{var e,n;null===(e=M(J_,this))||void 0===e||null===(n=e.close)||void 0===n||n.call(e)}catch(t){}C(J_,this,null);try{var i,r;null===(i=M(Q_,this))||void 0===i||null===(r=i.dispose)||void 0===r||r.call(i)}catch(t){}C(Q_,this,null);const o={error:t,recoverable:!1,severity:"fatal",streamClosed:M(aT,this),streamFinalized:M(lT,this)};M(oT,this)&&(o.context={...M(oT,this)}),this.trigger("demux:error",o)}function kT(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 xT(t){return!!A(dT,this,kT).call(this,t)&&(!M(lT,this)||M(uT,this))}async function wT(){if(!(M(iT,this)||M(nT,this)||M(tT,this)||M(eT,this))){C(eT,this,!0);try{A(dT,this,gT).call(this);const t=await M(Q_,this).getPrimaryVideoTrack(),e=t?null:await M(Q_,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 M(Q_,this).getMimeType();this.trigger("demux:init",{...M(rT,this)?{data:M(rT,this)}:{},decoderConfig:i,codec:r,mimeType:o}),C(J_,this,new l_(n)),C(tT,this,!0),C(Z_,this,(async()=>{try{for await(const t of M(J_,this).packets()){if(M(iT,this))break;const e="number"==typeof t.timestamp?t.timestamp:0;null===M(sT,this)&&C(sT,this,e);let n=e-M(sT,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){A(dT,this,bT).call(this,t)}})())}catch(t){if(A(dT,this,xT).call(this,t))return;throw t}finally{C(eT,this,!1),!M(uT,this)||M(nT,this)||M(iT,this)||A(dT,this,vT).call(this)}}}const _T=1e6,TT=24e3/1001,IT={primaries:"bt709",transfer:"bt709",matrix:"bt709",fullRange:!0},ET=new Uint8Array;function ST(t){return t?t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):ET:ET}let AT=null;const NT={video:(ue=new WeakMap,de=new WeakMap,he=new WeakMap,fe=new WeakMap,pe=new WeakMap,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,Te=new WeakMap,Ie=new WeakMap,Ee=new WeakMap,Se=new WeakMap,Ae=new WeakMap,Ne=new WeakMap,Me=new WeakMap,Fe=new WeakMap,Ce=new WeakMap,Oe=new WeakMap,Pe=new WeakMap,Re=new WeakMap,De=new WeakMap,Le=new WeakMap,Be=new WeakMap,ze=new WeakMap,We=new WeakMap,$e=new WeakMap,Ue=new WeakMap,je=new WeakMap,qe=new WeakSet,class extends rw{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),O(this,qe),F(this,ue,void 0),F(this,de,[]),F(this,he,void 0),F(this,fe,void 0),F(this,pe,void 0),F(this,me,void 0),F(this,ve,[]),F(this,ge,void 0),F(this,ye,new Map),F(this,be,!0),F(this,ke,!1),F(this,xe,!1),F(this,we,!1),F(this,_e,void 0),F(this,Te,!1),F(this,Ie,!1),F(this,Ee,0),F(this,Se,void 0),F(this,Ae,void 0),F(this,Ne,{}),F(this,Me,void 0),F(this,Fe,0),F(this,Ce,null),F(this,Oe,!1),F(this,Pe,null),F(this,Re,void 0),F(this,De,0),F(this,Le,0),F(this,Be,0),F(this,ze,0),F(this,We,!1),F(this,$e,!1),F(this,Ue,.2),F(this,je,Promise.resolve()),C(he,this,this.settings.decodedHorizonSeconds||1),C(fe,this,A(qe,this,kI).call(this,this.settings.maxDecodedFrames)),C(pe,this,A(qe,this,wI).call(this,this.settings.maxDecodeQueueSize)),C(We,this,gm()),C($e,this,A(qe,this,hI).call(this,this.settings.convertFramesToBitmapsOnAndroid)),C(Ue,this,A(qe,this,fI).call(this,this.settings.androidFixEndOfSegmentDelta)),C(me,this,(()=>0)),C(ge,this,(()=>A(qe,this,nI).call(this)));const e=this.settings.demuxerOptions?{FMP4Demuxer:this.settings.demuxerOptions}:{};C(ue,this,new hT(e)),M(ue,this).on("demux:init",(t=>A(qe,this,HT).call(this,t))),M(ue,this).on("demux:sample",(t=>A(qe,this,GT).call(this,t))),M(ue,this).on("demux:complete",(()=>A(qe,this,KT).call(this))),M(ue,this).on("demux:error",(t=>A(qe,this,RT).call(this,t)))}setCurrentTimeProvider(t){"function"==typeof t&&C(me,this,t)}setTimeOffsetSeconds(t){const e=Number(t);C(Fe,this,Number.isFinite(e)?e:0)}setSeekTargetTimeSeconds(t){const e=Number(t);C(Ce,this,Number.isFinite(e)?e:null),C(Oe,this,!1),C(Pe,this,null)}endOfStream(){M(ue,this)&&"function"==typeof M(ue,this).endOfStream&&M(ue,this).endOfStream()}configure(t){super.configure(t),C(Ne,this,{codec:A(qe,this,SI).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)}),C(Se,this,M(Ne,this).codec)}setSegment(t){this.lastSegment=t,A(qe,this,UT).call(this)}setNodeId(t){C(Re,this,t)}decode(t){this.setSegment(t);const e=null==t?void 0:t.arrayBuffer;e&&M(ue,this).pushChunk(e,{isInit:!(null==t||!t.isInit)})}async decodeChunk(t,e={}){await M(ue,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 M(de,this).slice()}onDispose(){if(super.onDispose(),A(qe,this,oI).call(this),M(ue,this)&&"function"==typeof M(ue,this).dispose&&M(ue,this).dispose(),C(de,this,[]),C(ve,this,[]),M(ye,this).clear(),C(Pe,this,null),M(_e,this)&&"function"==typeof M(_e,this).close)try{M(_e,this).close()}catch(t){}C(_e,this,null),C(Te,this,!1),C(Ae,this,null),C(Se,this,null),C(Re,this,null),C(je,this,Promise.resolve()),A(qe,this,UT).call(this)}}),audio:(Ve=new WeakMap,He=new WeakMap,Ge=new WeakMap,Ke=new WeakMap,Xe=new WeakMap,Ye=new WeakMap,Qe=new WeakMap,Je=new WeakSet,class extends rw{constructor(...t){super(...t),O(this,Je),F(this,Ve,void 0),F(this,He,[]),F(this,Ge,0),F(this,Ke,!1),F(this,Xe,!1),F(this,Ye,void 0),F(this,Qe,0)}get name(){return"WebAudioDecoder"}setSegment(t){C(Ye,this,t)}setTimeOffsetSeconds(t){const e=Number(t);C(Qe,this,Number.isFinite(e)?e:0)}decode(t){if(this.lastSegment=t,!t)return;if(t.isInit)return void C(Ve,this,ST(t.arrayBuffer));const e=t.arrayBuffer;e&&A(Je,this,CT).call(this,ST(e),!0)}decodeChunk(t,e={}){if(!t)return;if(e.isInit)return void C(Ve,this,ST(t));const n=ST(t);if(!n.length)return;M(He,this).push(n),C(Ge,this,M(Ge,this)+n.length);const i=Number(e.loaded),r=Number(e.total);Number.isFinite(i)&&Number.isFinite(r)&&r>0&&i>=r&&A(Je,this,MT).call(this)}endOfStream(){A(Je,this,MT).call(this)}onDispose(){super.onDispose(),C(Ve,this,void 0),C(He,this,[]),C(Ge,this,0),C(Ke,this,!1),C(Xe,this,!1),C(Ye,this,void 0)}}),image:class extends rw{#z;#W=0;#$=[];#U=0;#j;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.#$=[new Uint8Array(e)],this.#U=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.#$.push(n),this.#U+=n.length)}async endOfStream(){var t,e,n;if(this.#j)return;if(!(this.#$.length&&this.#U>0))return;const i=new Uint8Array(this.#U);let r=0;for(let t=0;t<this.#$.length;t+=1){const e=this.#$[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 Au.Blob)return;const n="string"==typeof e?e:"";return new Au.Blob([t],n?{type:n}:void 0)}(t,e);if(!n)throw new Error("Image decode requires Blob support");let i;if("function"==typeof Au.Image&&Au.URL&&"function"==typeof Au.URL.createObjectURL&&"function"==typeof Au.URL.revokeObjectURL){const t=Au.URL.createObjectURL(n);try{const e=new Au.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{Au.URL.revokeObjectURL(t)}}if("function"==typeof Au.createImageBitmap)try{return Au.createImageBitmap(n)}catch(t){i=t}if(i)throw i;throw new Error("No supported image decode mechanism")}(i,s);this.#j=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&&(eg(o.width)||(o.width=e.width),eg(o.height)||(o.height=e.height)),this.trigger("decoder:frame",{pts:this.#W,duration:eg(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.#j&&"function"==typeof this.#j.close)try{this.#j.close()}catch(t){}this.#j=null,this.#$=[],this.#U=0,this.#z=null}}};function MT(){if(M(Ke,this)||M(Xe,this))return;if(!M(Ge,this))return;const t=A(Je,this,FT).call(this);t.length&&A(Je,this,CT).call(this,t,!1)}function FT(){const t=M(Ve,this),e=t?t.length:0,n=e+M(Ge,this);if(!n)return ET;const i=new Uint8Array(n);let r=0;e&&(i.set(t,r),r+=e);for(let t=0;t<M(He,this).length;t+=1){const e=M(He,this)[t];e&&e.length&&(i.set(e,r),r+=e.length)}return i}function CT(t,e){if(M(Ke,this)||M(Xe,this))return;const n=e?A(Je,this,OT).call(this,t):t;if(!n||!n.length)return;const i=function(){if(AT)return AT;const t=Au.AudioContext||Au.webkitAudioContext;return t?(AT=new t,AT):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);C(Xe,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;C(Ke,this,!0);const n=Number.isFinite(null==t?void 0:t.duration)?t.duration:Number(null===(e=M(Ye,this))||void 0===e?void 0:e.duration)||void 0;this.trigger("decoder:audio",{audioBuffer:t,pts:M(Qe,this),duration:n})})).catch((t=>{this.trigger("decoder:error",{error:t})})).finally((()=>{C(He,this,[]),C(Ge,this,0),C(Xe,this,!1)}))}function OT(t){const e=M(Ve,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 PT(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:M(Re,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=M(Ne,this))||void 0===r?void 0:r.codec)||M(Se,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 RT(t){const e=(null==t?void 0:t.error)||t,n=A(qe,this,PT).call(this,t,e);if(A(qe,this,DT).call(this,t,e))return this.log.warn("[onDemuxError] recoverable demux error",n),void A(qe,this,KT).call(this);const i=A(qe,this,VT).call(this,t),r=A(qe,this,LT).call(this,i);if(i&&0===i.missingFrames)return this.log.warn(`[onDemuxError] ignoring demux error (no missing frames)${r}`,{...n,missingFrameStats:i}),void A(qe,this,KT).call(this);let o=n;i&&(o={...n,missingFrameStats:i}),this.log.warn(`[onDemuxError] demux error${r}`,o),this.trigger("decoder:error",t)}function DT(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 LT(t){return t?` expectedFrames=${A(qe,this,BT).call(this,t.expectedFrames)} demuxedFrames=${A(qe,this,BT).call(this,t.demuxedFrames)} missingFrames=${A(qe,this,BT).call(this,t.missingFrames)}`:""}function BT(t){if(null==t)return"unknown";const e=Number(t);return Number.isFinite(e)?String(e):"unknown"}function zT(t,e={}){return{expectedFrames:null,demuxedFrames:M(De,this),missingFrames:null,reason:t,...e}}function WT(t){const e=Number(t);return Number.isFinite(e)?e:null}function $T(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 A(qe,this,zT).call(this,"segment_duration_unavailable",{segmentDurationSeconds:A(qe,this,WT).call(this,s),demuxedCoverageSeconds:M(ze,this),frameDurationSeconds:null});const a=A(qe,this,qT).call(this);if(!Number.isFinite(a)||a<=0){const t=Math.max(1,Math.round(s*TT));return{expectedFrames:t,demuxedFrames:M(De,this),missingFrames:Math.max(0,t-M(De,this)),reason:"fallback_fps",fallbackFps:TT,segmentDurationSeconds:s,demuxedCoverageSeconds:M(ze,this),frameDurationSeconds:A(qe,this,WT).call(this,a)}}const l=Math.min(.5*a,.02),c=Math.max(0,s-M(ze,this)),u=c<=l?0:c,d=Math.max(1,Math.floor((s+l)/a)),h=Math.max(0,d-M(De,this)),f=u>0?Math.ceil(u/a):0;return{expectedFrames:d,demuxedFrames:M(De,this),missingFrames:Math.max(h,f),segmentDurationSeconds:s,demuxedCoverageSeconds:M(ze,this),frameDurationSeconds:a}}function UT(){C(De,this,0),C(Le,this,0),C(Be,this,0),C(ze,this,0)}function jT(t){C(De,this,M(De,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&&(C(Le,this,M(Le,this)+n),C(Be,this,M(Be,this)+1)),!Number.isFinite(e))return;const i=Number.isFinite(n)&&n>0?e+n:e;Number.isFinite(i)&&i>M(ze,this)&&C(ze,this,i)}function qT(){return M(Be,this)>0?M(Le,this)/M(Be,this):M(De,this)>0&&M(ze,this)>0?M(ze,this)/M(De,this):null}function VT(t){return A(qe,this,$T).call(this,t)}function HT(t){(null==t?void 0:t.data)instanceof Uint8Array&&(C(Ae,this,t.data.buffer),A(qe,this,aI).call(this)),null!=t&&t.decoderConfig&&(C(Me,this,t.decoderConfig),C(Se,this,t.decoderConfig.codec||M(Se,this)),A(qe,this,aI).call(this)),this.trigger("decoder:init",t)}function GT(t){A(qe,this,jT).call(this,t),M(ve,this).push(t),A(qe,this,nI).call(this)}function KT(){C(ke,this,!0),A(qe,this,cI).call(this)}function XT(t){const e="number"==typeof(null==t?void 0:t.pts)?t.pts:void 0;if(Number.isFinite(e))return M(Fe,this)+e}function YT(t){return M(ve,this).some((e=>{const n=A(qe,this,XT).call(this,e);return Number.isFinite(n)&&n>=t}))}function QT(t){let e=-1,n=null;for(let i=0;i<M(ve,this).length;i+=1){const r=M(ve,this)[i],o=A(qe,this,XT).call(this,r);Number.isFinite(o)&&(null==r?void 0:r.isKey)&&o<=t&&(e=i,n=o)}return{chosenIndex:e,chosenPtsSeconds:n}}function JT(t){let e=-1,n=null;for(let i=0;i<M(ve,this).length;i+=1){const r=M(ve,this)[i],o=A(qe,this,XT).call(this,r);if(Number.isFinite(o)&&null!=r&&r.isKey&&(e=i,n=o,o>=t))break}return{chosenIndex:e,chosenPtsSeconds:n}}function ZT(t){const e=t+M(he,this),n=M(Ce,this);if(!Number.isFinite(n))return e;const i=Number.isFinite(M(Pe,this))?M(Pe,this):null;if(Number.isFinite(i))return Math.max(e,i);const{chosenPtsSeconds:r}=A(qe,this,JT).call(this,n);return Number.isFinite(r)?Math.max(e,r):e}function tI(t){const e=M(Ce,this);Number.isFinite(e)&&Number.isFinite(t)&&t>=e&&(C(Ce,this,null),C(Pe,this,null))}function eI(){const t=M(Ce,this);if(!Number.isFinite(t)||M(Oe,this))return!0;if(!A(qe,this,YT).call(this,t)&&!M(ke,this))return!1;const e=A(qe,this,QT).call(this,t);let n=e;if(-1===e.chosenIndex&&(n=A(qe,this,JT).call(this,t)),n.chosenIndex>0){const t=`[#maybeAlignToSeekKeyframe] Dropping ${n.chosenIndex} samples before keyframe @ ${n.chosenPtsSeconds}`;this.log.debug(t),M(ve,this).splice(0,n.chosenIndex)}return C(be,this,!0),Number.isFinite(n.chosenPtsSeconds)&&C(Pe,this,n.chosenPtsSeconds),C(Oe,this,!0),!0}function nI(){const t=M(me,this)?M(me,this).call(this):0,e=A(qe,this,ZT).call(this,t);if(A(qe,this,yI).call(this,t),A(qe,this,bI).call(this),!A(qe,this,eI).call(this))return void A(qe,this,rI).call(this);const n=void 0!==Au.VideoDecoder&&void 0!==Au.EncodedVideoChunk;for(n&&!M(Te,this)&&M(Me,this)&&A(qe,this,aI).call(this);M(ve,this).length&&!A(qe,this,xI).call(this)&&!(n&&M(_e,this)&&A(qe,this,_I).call(this));){const t=M(ve,this)[0],i="number"==typeof(null==t?void 0:t.pts)?t.pts:0,r=M(Fe,this)+i;if(r>e)break;if(null!=t&&t.raw)M(ve,this).shift(),A(qe,this,iI).call(this,t);else{if(n){if(!M(Te,this)||!M(_e,this))break;if(M(be,this)&&!t.isKey){M(ve,this).shift();continue}M(ve,this).shift();const e=Math.max(0,Math.round(r*_T));M(ye,this).set(e,!!t.isKey);try{const n=new Au.EncodedVideoChunk({type:t.isKey?"key":"delta",timestamp:e,duration:t.duration?Math.round(t.duration*_T):void 0,data:t.data instanceof Uint8Array?t.data:new Uint8Array(t.data)});M(_e,this).decode(n),t.isKey&&C(be,this,!1);continue}catch(t){M(ye,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")){C(be,this,!0);continue}this.log.warn("[#drainDecodeQueue] decode failed, falling back to placeholder",t)}}M(ve,this).shift(),A(qe,this,iI).call(this,t)}}A(qe,this,cI).call(this),A(qe,this,rI).call(this)}function iI(t){const e=M(me,this)?M(me,this).call(this):0,n=A(qe,this,ZT).call(this,e),i=M(Fe,this)+("number"==typeof t.pts?t.pts:0);if(i<e||i>n)return;A(qe,this,yI).call(this,e);const r={pts:i,duration:t.duration,data:t.data,isKey:t.isKey};M(de,this).push(r),A(qe,this,bI).call(this),this.trigger("decoder:frame",r),A(qe,this,tI).call(this,i)}function rI(){if(M(ve,this).length>0&&void 0!==Au.VideoDecoder){if(hk(M(ge,this)))return;uk(M(ge,this),50)}else A(qe,this,oI).call(this)}function oI(){M(ge,this)&&hk(M(ge,this))&&dk(M(ge,this))}function sI(){return null!=Au&&Au.performance&&"function"==typeof Au.performance.now?Au.performance.now():Date.now()}function aI(){if(M(Te,this))return;if(void 0===Au.VideoDecoder)return;if(!M(Me,this))return;if(M(Ie,this)&&A(qe,this,sI).call(this)<M(Ee,this))return;const t=A(qe,this,lI).call(this);try{C(_e,this,new Au.VideoDecoder({output:t=>A(qe,this,dI).call(this,t),error:t=>A(qe,this,uI).call(this,t)})),M(_e,this).configure(t),C(Te,this,!0),C(be,this,!0),C(Ie,this,!1),C(Ee,this,0),A(qe,this,nI).call(this)}catch(t){this.log.warn("[#maybeConfigureDecoder] configure failed, falling back to placeholder decode",t),C(_e,this,null),C(Te,this,!1),C(Me,this,null)}}function lI(){const t={...M(Me,this)};return A(qe,this,II).call(this,t)&&M(Ne,this).codec?t.codec=M(Ne,this).codec:!t.codec&&M(Se,this)&&(t.codec=M(Se,this)),M(Ae,this)&&!t.description&&(t.description=M(Ae,this)),M(Ne,this).width&&!t.codedWidth&&(t.codedWidth=M(Ne,this).width),M(Ne,this).height&&!t.codedHeight&&(t.codedHeight=M(Ne,this).height),A(qe,this,EI).call(this,t),t}function cI(){void 0!==Au.VideoDecoder&&void 0!==Au.EncodedVideoChunk&&(M(Ie,this)||!M(ke,this)||M(we,this)||M(xe,this)||M(Te,this)&&M(_e,this)&&"function"==typeof M(_e,this).flush&&(M(ve,this).length||(C(xe,this,!0),Promise.resolve().then((()=>M(_e,this).flush())).then((()=>{C(we,this,!0),C(be,this,!0)})).catch((t=>{"AbortError"!==(null==t?void 0:t.name)&&this.log.warn("[#maybeFlushDecoder] flush failed",t)})).finally((()=>{C(xe,this,!1)})))))}function uI(t){if(this.log.warn("[#handleDecoderError] decoder error",t),this.trigger("decoder:error",{error:t}),M(_e,this)&&"function"==typeof M(_e,this).close)try{M(_e,this).close()}catch(t){}C(_e,this,null),C(Te,this,!1),C(xe,this,!1),C(we,this,!1),C(be,this,!0),M(ye,this).clear(),C(Ie,this,!0),C(Ee,this,A(qe,this,sI).call(this)+1e3)}function dI(t){C(je,this,M(je,this).then((()=>{var e;if(!this._disposed)return A(qe,this,gI).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 hI(t){return"boolean"!=typeof t||t}function fI(t){const e=Number(t);return!Number.isFinite(e)||e<0?.2:e}function pI(){return!!M($e,this)&&"function"==typeof Au.createImageBitmap&&M(We,this)}function mI(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(M(Fe,this));return!!Number.isFinite(i)&&t>=i+n-M(Ue,this)}async function vI(t,e){try{var n;const i=A(qe,this,mI).call(this,e),r=await Au.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 gI(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/_T:M(me,this)?M(me,this).call(this):0,s="number"==typeof t.duration?t.duration/_T:void 0;let a;void 0!==r&&(a=M(ye,this).get(r),M(ye,this).delete(r));try{var l,c,u,d;let e=M(me,this)?M(me,this).call(this):0,n=A(qe,this,ZT).call(this,e);if(o<e||o>n)return void(null===(l=(c=i).close)||void 0===l||l.call(c));if(A(qe,this,pI).call(this)){var h,f,p,m;if(i=await A(qe,this,vI).call(this,t,o),this._disposed)return void(null===(h=(f=i).close)||void 0===h||h.call(f));if(e=M(me,this)?M(me,this).call(this):0,n=A(qe,this,ZT).call(this,e),o<e||o>n)return void(null===(p=(m=i).close)||void 0===p||p.call(m))}if(A(qe,this,yI).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};M(de,this).push(r),A(qe,this,bI).call(this),this.trigger("decoder:frame",r),A(qe,this,tI).call(this,o),this.log.debug(`[#handleDecodedFrame] [${M(Ne,this).codec}] Decoded frame:`,r)}catch(t){this.log.warn(`[#handleDecodedFrame] [${M(Ne,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 yI(t){const e=A(qe,this,ZT).call(this,t),n=[];M(de,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)})),C(de,this,n)}function bI(){const t=M(fe,this);if(!Number.isFinite(t)||t<=0)return;if(M(de,this).length<=t)return;const e=M(de,this).length-t;M(de,this).splice(0,e)}function kI(t){const e=Number(t);return!Number.isFinite(e)||e<=0?0:Math.floor(e)}function xI(){const t=M(fe,this);return!(!Number.isFinite(t)||t<=0)&&M(de,this).length>=t}function wI(t){const e=Number(t);return!Number.isFinite(e)||e<=0?0:Math.floor(e)}function _I(){var t;const e=M(pe,this);if(!Number.isFinite(e)||e<=0)return!1;const n=Number(null===(t=M(_e,this))||void 0===t?void 0:t.decodeQueueSize);return!!Number.isFinite(n)&&n>=e}function TI(t){return"string"==typeof t&&t.toLowerCase().startsWith("av01")}function II(t){var e;return!1!==this.settings.av1ColorSpaceOverrideEnabled&&A(qe,this,TI).call(this,(null===(e=M(Ne,this))||void 0===e?void 0:e.codec)||(null==t?void 0:t.codec))}function EI(t){A(qe,this,II).call(this,t)&&(t.colorSpace={...IT})}function SI(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 AI extends Iu{#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 rw(e);const n=NT[t.type];return n?(this.log.debug(`[#create] [${t.type}] Creating decoder:`,n),new n(e)):new rw(e)}}class NI{#V;#H;#G;#K;constructor(t={}){this.#V=t.getActiveRenderPlacement,this.#H=t.getPlacementsActiveAtTime,this.#G=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.#G)return;const n="function"==typeof this.#H?this.#H:()=>[],i=n(e),r=new Set;i.forEach((t=>{null!=t&&t.placementId&&r.add(t.placementId),this.#G(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.#G(t,s)}))}dispose(){}}class MI{#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 FI=new Set(["video","audio","image"]);function CI(t){const e=Number(t);return Number.isFinite(e)?e:0}var OI=new WeakMap,PI=new WeakMap,RI=new WeakMap,DI=new WeakMap,LI=new WeakMap,BI=new WeakMap,zI=new WeakMap,WI=new WeakMap,$I=new WeakMap,UI=new WeakMap,jI=new WeakMap,qI=new WeakMap,VI=new WeakMap,HI=new WeakMap,GI=new WeakMap,KI=new WeakMap,XI=new WeakMap,YI=new WeakMap,QI=new WeakMap,JI=new WeakSet;class ZI extends Iu{constructor(...t){super(...t),O(this,JI),F(this,OI,void 0),F(this,PI,void 0),F(this,RI,void 0),F(this,DI,void 0),F(this,LI,void 0),F(this,BI,void 0),F(this,zI,void 0),F(this,WI,void 0),F(this,$I,void 0),F(this,UI,void 0),F(this,jI,void 0),F(this,qI,new Map),F(this,VI,new Map),F(this,HI,new Map),F(this,GI,new Map),F(this,KI,new Set),F(this,XI,0),F(this,YI,!1),F(this,QI,null);const[e,n,i]=t;C(OI,this,e),C(PI,this,n),C(RI,this,i||new AI),C(DI,this,new MI({getNode:t=>A(JI,this,TE).call(this,t),getPlacementState:t=>M(qI,this).get(t),getDecodeTracks:t=>A(JI,this,bE).call(this,t),getSegmentIdForTrackAtTime:(t,e,n)=>A(JI,this,aE).call(this,t,e,n),decodeLoadedMediaSegment:(t,e,n)=>{A(JI,this,qE).call(this,t,e,n)},decodeLoadedMediaSegmentsAfter:(t,e,n)=>{A(JI,this,DE).call(this,t,e,n)}})),C(LI,this,new NI({getActiveRenderPlacement:t=>{var e,n;return null===(e=M(PI,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=M(PI,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=M(DI,this))||void 0===n||null===(i=n.ensureDecodedForPlacementAtTime)||void 0===i||i.call(n,t,e)}})),A(JI,this,tE).call(this),A(JI,this,vE).call(this)}get name(){return"DecodeCoordinator"}onDispose(){var t,e;M(PI,this)&&"function"==typeof M(PI,this).off&&M(BI,this)&&M(PI,this).off(Im.PLACEMENT_ADDED,M(BI,this)),M(PI,this)&&"function"==typeof M(PI,this).off&&M(zI,this)&&M(PI,this).off(Im.TIMELINE_SEEKING,M(zI,this)),M(PI,this)&&"function"==typeof M(PI,this).off&&M(WI,this)&&M(PI,this).off(Im.TIMELINE_SEEKED,M(WI,this)),M(PI,this)&&"function"==typeof M(PI,this).off&&M($I,this)&&M(PI,this).off(Im.TIMELINE_TIME_UPDATE,M($I,this)),M(PI,this)&&"function"==typeof M(PI,this).off&&M(UI,this)&&M(PI,this).off(Im.TIMELINE_RESET,M(UI,this)),A(JI,this,eE).call(this),C(BI,this,null),C(zI,this,null),C(WI,this,null),C($I,this,null),C(UI,this,null),null!==(t=M(DI,this))&&void 0!==t&&null!==(e=t.dispose)&&void 0!==e&&e.call(t),C(DI,this,null),M(LI,this)&&"function"==typeof M(LI,this).dispose&&M(LI,this).dispose(),C(LI,this,null),M(VI,this).forEach(((t,e)=>{const n=A(JI,this,TE).call(this,e);n&&"function"==typeof n.off&&n.off("node:loaded",t)})),M(VI,this).clear(),M(HI,this).forEach(((t,e)=>{const n=A(JI,this,TE).call(this,e);n&&"function"==typeof n.off&&n.off("segment:chunk",t)})),M(HI,this).clear(),M(GI,this).clear(),M(KI,this).clear(),A(JI,this,hE).call(this),M(qI,this).forEach((({trackStates:t})=>{t&&t.forEach((t=>{A(JI,this,AE).call(this,t)}))})),M(qI,this).clear()}}function tE(){M(PI,this)&&"function"==typeof M(PI,this).on&&(C(BI,this,(t=>{A(JI,this,gE).call(this,t)})),M(PI,this).on(Im.PLACEMENT_ADDED,M(BI,this)),C(zI,this,(t=>A(JI,this,nE).call(this,t))),M(PI,this).on(Im.TIMELINE_SEEKING,M(zI,this)),C(WI,this,(()=>A(JI,this,iE).call(this))),M(PI,this).on(Im.TIMELINE_SEEKED,M(WI,this)),C($I,this,(t=>A(JI,this,rE).call(this,t))),M(PI,this).on(Im.TIMELINE_TIME_UPDATE,M($I,this)),C(UI,this,(()=>A(JI,this,oE).call(this))),M(PI,this).on(Im.TIMELINE_RESET,M(UI,this))),(null==Au?void 0:Au.document)&&"function"==typeof Au.document.addEventListener&&(C(jI,this,(()=>{A(JI,this,fE).call(this)})),Au.document.addEventListener("visibilitychange",M(jI,this)))}function eE(){M(jI,this)&&null!=Au&&Au.document&&"function"==typeof Au.document.removeEventListener&&Au.document.removeEventListener("visibilitychange",M(jI,this)),C(jI,this,null)}function nE(t={}){const e=Number(null==t?void 0:t.targetTime);Number.isFinite(e)&&(M(qI,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||(A(JI,this,sE).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=M(qI,this).get(n);if(!r||!r.trackStates)return;const o=A(JI,this,TE).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||A(JI,this,sE).call(this,n,r.placement||t,e)})),A(JI,this,RE).call(this,r.placement||t,o))})))}function iE(){M(qI,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 rE(t={}){var e,n;A(JI,this,PE).call(this,null==t?void 0:t.time),null!==(e=M(LI,this))&&void 0!==e&&null!==(n=e.handleTimeUpdate)&&void 0!==n&&n.call(e,t),A(JI,this,fE).call(this),A(JI,this,NE).call(this,null==t?void 0:t.time)}function oE(){M(VI,this).forEach(((t,e)=>{const n=A(JI,this,TE).call(this,e);n&&"function"==typeof n.off&&n.off("node:loaded",t)})),M(VI,this).clear(),M(HI,this).forEach(((t,e)=>{const n=A(JI,this,TE).call(this,e);n&&"function"==typeof n.off&&n.off("segment:chunk",t)})),M(HI,this).clear(),M(GI,this).clear(),M(KI,this).clear(),M(qI,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()}))}))})),M(qI,this).clear()}function sE(t,e,n){t&&(A(JI,this,AE).call(this,t),t.seekSegmentId=A(JI,this,aE).call(this,t.track,e,n))}function aE(t,e,n){if(!t||!e||!Array.isArray(t.segments))return null;const i=Ap(e);if(!Number.isFinite(i))return null;const r=CI(null==e?void 0:e.nodeOffsetOverride),o=Math.max(0,n-i+r),s=CI(null==t?void 0:t.offset),a=Math.max(0,o-s),l="function"==typeof t.getMediaSegmentAtTime?t.getMediaSegmentAtTime(a,{preferRepresentationTime:!0}):dy(t.segments,a,{preferRepresentationTime:!0});return(null==l?void 0:l.id)||null}function lE(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 cE(){const t=null==Au?void 0:Au.document;return!t||"string"!=typeof t.visibilityState||"visible"===t.visibilityState}function uE(){var t;const e=M(PI,this);if(!e||"number"!=typeof e.currentTime)return!1;if(e.state===Pm)return!1;const n=Date.now();if(n<M(XI,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=A(JI,this,dE).call(this,i),!Number.isFinite(a))return!1;return C(XI,this,n+1500),this.log.warn("[DecodeCoordinator] attempting decoder recovery seek"),e.currentTime=a,!0}function dE(t){var e;const n=M(PI,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=Ap(t);if(!Number.isFinite(e))return;(!Number.isFinite(d)||e<d)&&(d=e);const n=Ep(t,M(OI,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 hE(){C(YI,this,!1),C(QI,this,null)}function fE(){M(YI,this)&&A(JI,this,cE).call(this)&&A(JI,this,uE).call(this)}function pE(t){if(!A(JI,this,lE).call(this,t))return;const e=M(PI,this);e&&"number"==typeof e.currentTime&&(C(YI,this,!0),C(QI,this,t),A(JI,this,cE).call(this)&&A(JI,this,uE).call(this))}function mE(t){var e;return!!t&&(Array.isArray(null===(e=M(PI,this))||void 0===e?void 0:e.placements)?M(PI,this).placements:[]).includes(t)}function vE(t){var e;(Array.isArray(null===(e=M(PI,this))||void 0===e?void 0:e.placements)?[...M(PI,this).placements]:[]).filter((e=>"function"!=typeof t||t(e))).sort(((t,e)=>{const n=Ap(t),i=Ap(e);return(Number.isFinite(n)?n:Number.POSITIVE_INFINITY)-(Number.isFinite(i)?i:Number.POSITIVE_INFINITY)})).forEach((t=>{A(JI,this,gE).call(this,t)}))}async function gE(t){if(!t||!t.placementId||M(qI,this).has(t.placementId))return;if(!A(JI,this,mE).call(this,t))return;const e=t.nodeId;if(!e||!M(OI,this)||"function"!=typeof M(OI,this).get)return;const n=A(JI,this,TE).call(this,e);if(n){if(n.state&&"ready"!==n.state){if("function"==typeof n.resolve)try{await n.resolve()}catch(n){if(!A(JI,this,mE).call(this,t))return;return void this.log.warn(`[#processPlacement] Failed to resolve node ${e}`,n)}if(!A(JI,this,mE).call(this,t))return;if("ready"!==n.state)return}if(A(JI,this,OE).call(this,t))return A(JI,this,CE).call(this,t,n),void M(KI,this).add(t.placementId);A(JI,this,FE).call(this,t,n)}}function yE(t){return A(JI,this,bE).call(this,t).every((t=>A(JI,this,ME).call(this,t)))}function bE(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).filter((t=>FI.has(null==t?void 0:t.type)))}function kE(t){if(!t||!t.id||"function"!=typeof t.on)return;if(M(VI,this).has(t.id))return;const e=()=>{A(JI,this,LE).call(this,t.id)};t.on("node:loaded",e),M(VI,this).set(t.id,e)}function xE(t){if(!t||!t.id||"function"!=typeof t.on)return;if(M(HI,this).has(t.id))return;const e=t=>A(JI,this,BE).call(this,t);t.on("segment:chunk",e),M(HI,this).set(t.id,e)}function wE(t,e){if(!t||!e)return;const n=M(GI,this).get(t)||new Set;n.add(e),M(GI,this).set(t,n)}function _E(t){return M(GI,this).get(t)||new Set}function TE(t){if(t&&M(OI,this)&&"function"==typeof M(OI,this).get)return M(OI,this).get(t)}function IE(t){if(!t)return;const e=t.fullBufferRetryTimer;null!=e&&("function"==typeof(null==Au?void 0:Au.clearTimeout)?Au.clearTimeout.bind(Au):clearTimeout)(e),t.fullBufferRetryTimer=null,t.fullBufferDecodeScheduled=!1,t.fullBufferRetryAttempts=0}function EE(t){const e=null==t?void 0:t.segmentStates;e&&"function"==typeof e.forEach&&e.forEach((t=>{A(JI,this,IE).call(this,t)}))}function SE(t,e,n,i){var r,o;if(!(t&&e&&n&&i))return!1;const s=M(qI,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 AE(t){if(!t)return;A(JI,this,EE).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 NE(t){const e=CI(t);if(!Number.isFinite(e))return;const n=e-2;Number.isFinite(n)&&M(qI,this).forEach((t=>{const e=null==t?void 0:t.placement;if(!e)return;const i=Ap(e),r=Ep(e,M(OI,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||A(JI,this,AE).call(this,t)}))}))}function ME(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 FE(t,e){if(this.log.debug(`[#startDecode] [${t.placementId}] [${e.id}] Starting decode`),A(JI,this,CE).call(this,t,e)){if(A(JI,this,wE).call(this,e.id,t.placementId),!A(JI,this,yE).call(this,e))return A(JI,this,kE).call(this,e),void A(JI,this,xE).call(this,e);A(JI,this,RE).call(this,t,e),A(JI,this,xE).call(this,e)}}function CE(t,e){if(!t||!t.placementId||!e)return;const n=M(qI,this).get(t.placementId);if(n)return n.placement=t,n;const i=A(JI,this,bE).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(Im.DECODE_ERROR,Am({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 M(qI,this).set(t.placementId,o),o}function OE(t){var e;const n=Ap(t),i=CI(null===(e=M(PI,this))||void 0===e?void 0:e.currentTime);return!Number.isFinite(n)||!!Number.isFinite(i)&&n-i>2}function PE(t){if(!M(KI,this).size)return;const e=CI(t);if(!Number.isFinite(e))return;const n=[];M(KI,this).forEach((t=>{const i=M(qI,this).get(t),r=null==i?void 0:i.placement;if(!r)return void n.push(t);const o=Ap(r);Number.isFinite(o)&&o-e<=2&&n.push(t)})),n.forEach((t=>{M(KI,this).delete(t);const e=M(qI,this).get(t),n=null==e?void 0:e.placement;if(!n)return;const i=A(JI,this,TE).call(this,n.nodeId);i&&A(JI,this,FE).call(this,n,i)}))}function RE(t,e){const n=M(qI,this).get(t.placementId);n&&A(JI,this,bE).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;A(JI,this,qE).call(this,t,i,n),r.seekSegmentId&&"video"===(null==i?void 0:i.type)&&A(JI,this,DE).call(this,t,i,n),r.ready=!0,this.trigger(Im.DECODE_READY,Sm({placementId:t.placementId,nodeId:e.id,trackId:i.id,trackType:i.type}))}catch(n){this.trigger(Im.DECODE_ERROR,Am({placementId:t.placementId,nodeId:e.id,trackId:null==i?void 0:i.id,trackType:null==i?void 0:i.type,error:n}))}}))}function DE(t,e,n){var i;if(!(t&&e&&n&&Array.isArray(e.segments)))return;const r=null==t?void 0:t.placementId,o=r?M(qI,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(A(JI,this,qE).call(this,t,e,i),u+=1,u>=2)break}}function LE(t){const e=A(JI,this,TE).call(this,t);e&&A(JI,this,yE).call(this,e)&&A(JI,this,_E).call(this,t).forEach((t=>{const n=M(qI,this).get(t);A(JI,this,RE).call(this,(null==n?void 0:n.placement)||{placementId:t},e)}))}function BE(t){t&&t.nodeId&&t.trackId&&t.chunk&&A(JI,this,_E).call(this,t.nodeId).forEach((e=>A(JI,this,zE).call(this,e,t)))}function zE(t,e){const n=M(qI,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&&A(JI,this,qE).call(this,n.placement,s,a)&&(i.ready=!0,this.trigger(Im.DECODE_READY,Sm({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType}))));if((null===(o=M(PI,this))||void 0===o?void 0:o.state)===Pm&&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=A(JI,this,UE).call(this,n.placement,s,a);if(!u||"function"!=typeof u.decodeChunk)return;if(i.hasInit&&!c.initSent){const t=A(JI,this,jE).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;A(JI,this,WE).call(this,c,e)?d&&!c.ended&&A(JI,this,$E).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(Im.DECODE_READY,Sm({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType})))}catch(n){this.trigger(Im.DECODE_ERROR,Am({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType,error:n}))}}function WE(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 $E(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==Au?void 0:Au.setTimeout)?Au.setTimeout.bind(Au):setTimeout;i.fullBufferDecodeScheduled=!0,i.fullBufferRetryAttempts=0;const l=()=>{if(!A(JI,this,SE).call(this,r,o,s,i)||i.ended)return void A(JI,this,IE).call(this,i);if(A(JI,this,qE).call(this,t,e,n))return void A(JI,this,IE).call(this,i);i.fullBufferRetryAttempts+=1;const c=i.fullBufferRetryAttempts<=8?0:50;i.fullBufferRetryTimer=a((()=>{l()}),c)};i.fullBufferRetryTimer=a((()=>{l()}),0)}function UE(t,e,n){var i,r;const o=null==t?void 0:t.placementId;if(!o||!e||!n)return;const s=M(qI,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=M(RI,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=M(PI,this))||void 0===t?void 0:t.currentTime)?M(PI,this).currentTime:0})),c&&"function"==typeof c.setTimeOffsetSeconds){var u,d;const i=Ap(t),r=CI(null==e?void 0:e.offset),o=CI(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=M(PI,this))||void 0===r?void 0:r.state)===Pm&&"video"===(null==e?void 0:e.type)&&c.setSeekTargetTimeSeconds(M(PI,this).currentTime),c&&"function"==typeof c.on&&(c.on(Im.DECODER_FRAME,(i=>{i&&(!M(YI,this)||"video"!==(null==e?void 0:e.type)&&"image"!==(null==e?void 0:e.type)||(C(YI,this,!1),C(QI,this,null)),M(PI,this)&&"function"==typeof M(PI,this).notifyDecodedFrame&&(i.frame||i.data)&&M(PI,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(Im.DECODER_AUDIO,(i=>{i&&i.audioBuffer&&this.trigger(Im.DECODER_AUDIO,Sm({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(Im.DECODER_ERROR,(i=>{const r=(null==i?void 0:i.error)||i;this.trigger(Im.DECODER_ERROR,Am({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})),A(JI,this,pE).call(this,r)}))),a.segmentDecoders.set(n.id,c),c}function jE(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 qE(t,e,n){var i;if(!t||!e||!n)return!1;const r=t.placementId,o=M(qI,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=A(JI,this,UE).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 A(JI,this,IE).call(this,l),!0;if(s.hasInit&&!l.initSent){const t=A(JI,this,jE).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()),A(JI,this,IE).call(this,l),0))}const VE=1e-6;var HE=new WeakMap,GE=new WeakMap,KE=new WeakMap,XE=new WeakMap,YE=new WeakMap,QE=new WeakMap,JE=new WeakMap,ZE=new WeakMap,tS=new WeakSet;class eS extends Iu{get name(){return"TransitionManager"}get defaults(){return{durationSeconds:.5}}constructor(t,e,n){super(n),O(this,tS),F(this,HE,void 0),F(this,GE,void 0),F(this,KE,null),F(this,XE,null),F(this,YE,null),F(this,QE,0),F(this,JE,[]),F(this,ZE,null),C(HE,this,t),C(GE,this,e),M(HE,this)&&"function"==typeof M(HE,this).on&&(C(ZE,this,(()=>A(tS,this,uS).call(this))),M(HE,this).on(Im.TIMELINE_RESET,M(ZE,this)))}transitionTo(t,e={}){const n=Number(t);if(!Number.isFinite(n))throw new Error("TransitionManager.transitionTo requires a numeric time");A(tS,this,uS).call(this);const i=A(tS,this,nS).call(this),r=A(tS,this,sS).call(this,n,e);return r?A(tS,this,aS).call(this,n,e,i,r):Promise.resolve()}onDispose(){M(HE,this)&&"function"==typeof M(HE,this).off&&M(ZE,this)&&M(HE,this).off(Im.TIMELINE_RESET,M(ZE,this)),C(ZE,this,null),A(tS,this,uS).call(this),C(GE,this,null),C(HE,this,null)}}function nS(){return C(QE,this,M(QE,this)+1),M(QE,this)}function iS(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 rS(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 oS(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 sS(t,e={}){var n;const i=M(GE,this),r=A(tS,this,iS).call(this,e);if(!i||"function"!=typeof i.startTransition)return M(HE,this).currentTime=t,null;if(!(r>0))return M(HE,this).currentTime=t,null!==(n=i.resetTransition)&&void 0!==n&&n.call(i),null;const o=A(tS,this,rS).call(this,e,r);"function"==typeof(null==e?void 0:e.onTransitionInStart)&&e.onTransitionInStart();const s=i.startTransition(o),{outDurationMs:a,inDurationMs:l}=A(tS,this,oS).call(this,r,s);return{renderer:i,transitionOptions:o,outDurationMs:a,inDurationMs:l,shouldWaitForFrames:!1!==(null==e?void 0:e.waitForVisualFrames)}}function aS(t,e={},n,i){const{renderer:r,transitionOptions:o,outDurationMs:s,inDurationMs:a,shouldWaitForFrames:l}=i,c=A(tS,this,mS).call(this,t,e,n),u=l?A(tS,this,vS).call(this,t,n):Promise.resolve();let d=!1,h=!1,f=!1,p=!l;const m=()=>{var t;A(tS,this,dS).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),C(XE,this,setTimeout((()=>{var t;A(tS,this,dS).call(this,n)&&(null!==(t=r.resetTransition)&&void 0!==t&&t.call(r),"function"==typeof(null==e?void 0:e.onTransitionOutEnd)&&e.onTransitionOutEnd(),A(tS,this,lS).call(this))}),a)))};return C(KE,this,setTimeout((()=>{d=!0,m()}),s)),c.then((()=>{h=!0,m()})).catch((()=>{var t;A(tS,this,dS).call(this,n)&&(null!==(t=r.resetTransition)&&void 0!==t&&t.call(r),A(tS,this,lS).call(this))})),u.then((()=>{p=!0,m()})).catch((()=>{p=!0,m()})),M(HE,this).currentTime=t,new Promise((t=>{C(YE,this,t)}))}function lS(){const t=M(YE,this);C(YE,this,null),A(tS,this,cS).call(this),A(tS,this,pS).call(this),t&&t()}function cS(){M(KE,this)&&clearTimeout(M(KE,this)),M(XE,this)&&clearTimeout(M(XE,this)),C(KE,this,null),C(XE,this,null)}function uS(){var t,e;M(GE,this)&&null!==(t=(e=M(GE,this)).resetTransition)&&void 0!==t&&t.call(e),A(tS,this,cS).call(this),A(tS,this,pS).call(this),M(YE,this)&&(M(YE,this).call(this),C(YE,this,null))}function dS(t){return M(QE,this)===t}function hS(t,e){M(HE,this)&&"function"==typeof M(HE,this).on&&(M(HE,this).on(t,e),M(JE,this).push({eventName:t,handler:e}))}function fS(t,e){M(HE,this)&&"function"==typeof M(HE,this).off&&(M(HE,this).off(t,e),C(JE,this,M(JE,this).filter((n=>n.eventName!==t||n.handler!==e))))}function pS(){M(HE,this)&&"function"==typeof M(HE,this).off?(M(JE,this).forEach((t=>{M(HE,this).off(t.eventName,t.handler)})),C(JE,this,[])):C(JE,this,[])}function mS(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(!M(HE,this)||"function"!=typeof M(HE,this).on)return Promise.resolve();const r=A(tS,this,gS).call(this);return new Promise((e=>{let i=!1;const o=r?Im.TIMELINE_SEEKED:"nodestart";let s,a;const l=()=>{A(tS,this,fS).call(this,Im.TIMELINE_SEEKING,s),A(tS,this,fS).call(this,o,a),e()};s=(e={})=>{A(tS,this,dS).call(this,n)?A(tS,this,yS).call(this,e,t)&&(i=!0):l()},a=(e={})=>{A(tS,this,dS).call(this,n)?(o!==Im.TIMELINE_SEEKED||A(tS,this,yS).call(this,e,t))&&(o===Im.TIMELINE_SEEKED||i)&&l():l()},A(tS,this,hS).call(this,Im.TIMELINE_SEEKING,s),A(tS,this,hS).call(this,o,a)}))}function vS(t,e){if(!M(HE,this)||"function"!=typeof M(HE,this).on)return Promise.resolve();const n=Number(t);return new Promise((t=>{const i=(r={})=>{if(!A(tS,this,dS).call(this,e))return A(tS,this,fS).call(this,Im.VISUAL_FRAMES_AVAILABLE,i),void t();const o=Number(null==r?void 0:r.time);Number.isFinite(n)&&Number.isFinite(o)&&o+VE<n||(Array.isArray(null==r?void 0:r.frames)?r.frames:[]).length&&(A(tS,this,fS).call(this,Im.VISUAL_FRAMES_AVAILABLE,i),t())};A(tS,this,hS).call(this,Im.VISUAL_FRAMES_AVAILABLE,i)}))}function gS(){var t,e;const n=null===(t=M(HE,this))||void 0===t?void 0:t.state;if(n===Om||n===Nm)return!0;const i=null===(e=M(HE,this))||void 0===e?void 0:e.placements;return!Array.isArray(i)||0===i.length}function yS(t,e){const n=Number(null==t?void 0:t.targetTime);return!Number.isFinite(n)||Math.abs(n-e)<VE}function bS(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}var kS=new WeakMap,xS=new WeakMap,wS=new WeakMap,_S=new WeakMap,TS=new WeakMap,IS=new WeakMap,ES=new WeakMap,SS=new WeakMap,AS=new WeakMap,NS=new WeakMap,MS=new WeakMap,FS=new WeakMap,CS=new WeakMap,OS=new WeakMap,PS=new WeakSet;class RS extends Iu{get name(){return"AudioPlaybackManager"}get defaults(){return{muted:!1,volume:1,lookaheadSeconds:1}}constructor(t,e,n){super(n),O(this,PS),F(this,kS,void 0),F(this,xS,void 0),F(this,wS,null),F(this,_S,null),F(this,TS,[]),F(this,IS,new Set),F(this,ES,new Map),F(this,SS,!1),F(this,AS,1),F(this,NS,!0),F(this,MS,null),F(this,FS,null),F(this,CS,null),F(this,OS,null),C(kS,this,t),C(xS,this,e),C(SS,this,!!this.settings.muted),C(AS,this,Tp(this.settings.volume));const i=Array.isArray(null==n?void 0:n.disabledTracks)?n.disabledTracks:[];C(NS,this,!i.includes("audio")),A(PS,this,DS).call(this)}get muted(){return M(SS,this)}set muted(t){C(SS,this,!!t),A(PS,this,GS).call(this)}get volume(){return M(AS,this)}set volume(t){C(AS,this,Tp(t)),A(PS,this,GS).call(this)}handleDecodedAudio(t={}){if(!M(NS,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=bS(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}`;M(IS,this).has(s)||(M(TS,this).push({key:s,placementId:n,pts:r,duration:o,audioBuffer:e}),M(TS,this).sort(((t,e)=>t.pts-e.pts)),A(PS,this,$S).call(this))}onDispose(){A(PS,this,LS).call(this),A(PS,this,VS).call(this,!0),M(wS,this)&&"function"==typeof M(wS,this).close&&M(wS,this).close(),C(wS,this,null),C(_S,this,null),C(kS,this,null),C(xS,this,null)}}function DS(){M(kS,this)&&"function"==typeof M(kS,this).on&&(C(MS,this,(t=>A(PS,this,BS).call(this,t))),M(kS,this).on(Im.TIMELINE_TIME_UPDATE,M(MS,this)),C(FS,this,(t=>A(PS,this,zS).call(this,t))),M(kS,this).on(Im.TIMELINE_STATE_CHANGE,M(FS,this)),C(OS,this,(()=>A(PS,this,WS).call(this))),M(kS,this).on(Im.TIMELINE_RESET,M(OS,this))),M(xS,this)&&"function"==typeof M(xS,this).on&&(C(CS,this,(t=>this.handleDecodedAudio(t))),M(xS,this).on(Im.DECODER_AUDIO,M(CS,this)))}function LS(){M(kS,this)&&"function"==typeof M(kS,this).off&&(M(MS,this)&&M(kS,this).off(Im.TIMELINE_TIME_UPDATE,M(MS,this)),M(FS,this)&&M(kS,this).off(Im.TIMELINE_STATE_CHANGE,M(FS,this)),M(OS,this)&&M(kS,this).off(Im.TIMELINE_RESET,M(OS,this))),M(xS,this)&&"function"==typeof M(xS,this).off&&M(CS,this)&&M(xS,this).off(Im.DECODER_AUDIO,M(CS,this)),C(MS,this,null),C(FS,this,null),C(CS,this,null),C(OS,this,null)}function BS(){A(PS,this,$S).call(this)}function zS(t={}){const e=null==t?void 0:t.to;if(e)return e===Mm?(A(PS,this,KS).call(this),void A(PS,this,$S).call(this)):void(e!==Om&&e!==Cm?e!==Pm&&e!==Rm||A(PS,this,WS).call(this):A(PS,this,XS).call(this))}function WS(){A(PS,this,XS).call(this),A(PS,this,VS).call(this,!0),C(TS,this,[])}function $S(){if(!M(NS,this)||!M(kS,this))return;if(M(kS,this).state!==Mm)return;const t=A(PS,this,HS).call(this);if(!t)return;const e=bS(M(kS,this).currentTime,0),n=e+Math.max(0,bS(this.settings.lookaheadSeconds,1)),i=[];for(let r=0;r<M(TS,this).length;r+=1){const o=M(TS,this)[r];o&&(o.pts>n?i.push(o):A(PS,this,US).call(this,o)&&A(PS,this,qS).call(this,o,t,e))}C(TS,this,i)}function US(t){if(!t||!M(kS,this))return!1;const e=A(PS,this,jS).call(this,t.pts);return!(!e||e!==t.placementId)}function jS(t){if(!M(kS,this)||"function"!=typeof M(kS,this).getPlacementsActiveAtTime)return null;const e=M(kS,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 qS(t,e,n){const i=t.key;if(M(IS,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(M(_S,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)}M(IS,this).add(i),M(ES,this).set(i,l),l.onended=()=>{M(ES,this).delete(i)}}function VS(t){M(ES,this).forEach(((t,e)=>{if(t&&"function"==typeof t.stop)try{t.stop()}catch(t){}M(ES,this).delete(e)})),t&&M(IS,this).clear()}function HS(){if(M(wS,this))return M(wS,this);const t=Au.AudioContext||Au.webkitAudioContext;if(!t)return this.log.warn("[AudioPlaybackManager] AudioContext is not available."),null;try{return C(wS,this,new t),C(_S,this,M(wS,this).createGain()),M(_S,this).connect(M(wS,this).destination),A(PS,this,GS).call(this),M(wS,this)}catch(t){return this.log.warn("[AudioPlaybackManager] Failed to initialize AudioContext",t),C(wS,this,null),C(_S,this,null),null}}function GS(){if(!M(_S,this))return;const t=M(SS,this)?0:M(AS,this);M(_S,this).gain.value=t}function KS(){M(wS,this)&&"function"==typeof M(wS,this).resume&&"suspended"===M(wS,this).state&&M(wS,this).resume().catch((()=>{}))}function XS(){M(wS,this)&&"function"==typeof M(wS,this).suspend&&"running"===M(wS,this).state&&M(wS,this).suspend().catch((()=>{}))}var YS=new WeakMap,QS=new WeakMap,JS=new WeakMap,ZS=new WeakMap,tA=new WeakMap,eA=new WeakSet;class nA extends Iu{constructor(...t){super(...t),O(this,eA),F(this,YS,void 0),F(this,QS,void 0),F(this,JS,void 0),F(this,ZS,void 0),F(this,tA,void 0),C(YS,this,A(eA,this,rA).call(this,this.settings.currentTime)),C(QS,this,A(eA,this,oA).call(this,this.settings.playbackRate)),C(JS,this,null),C(ZS,this,!1),C(tA,this,A(eA,this,iA).bind(this))}get name(){return"PlaybackClock"}get defaults(){return{currentTime:0,playbackRate:qg("playbackRate")}}get currentTime(){return M(YS,this)}get playbackRate(){return M(QS,this)}set playbackRate(t){C(QS,this,A(eA,this,oA).call(this,t))}play(){M(ZS,this)||(C(ZS,this,!0),C(JS,this,Sg()),uk(M(tA,this),0))}pause(){M(ZS,this)&&(C(ZS,this,!1),dk(M(tA,this)))}seek(t){C(YS,this,A(eA,this,rA).call(this,t)),C(JS,this,Sg())}reset(){this.pause(),C(YS,this,0),C(JS,this,null)}onDispose(){this.pause(),C(tA,this,null)}}function iA(){const t=Sg();if(null===M(JS,this))return C(JS,this,t),void this.trigger(Im.CLOCK_TICK,{currentTime:M(YS,this)});const e=t-M(JS,this);C(JS,this,t);const n=e/1e3;C(YS,this,M(YS,this)+n*M(QS,this)),this.trigger(Im.CLOCK_TICK,{currentTime:M(YS,this)})}function rA(t){return"number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t)||t<0?0:t}function oA(t){return"number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t)||t<=0?M(QS,this)||1:t}var sA=new WeakMap,aA=new WeakSet;class lA extends Iu{constructor(...t){super(...t),O(this,aA),F(this,sA,new Map)}get name(){return"TrackBuffers"}get defaults(){return{}}refreshNode(t){if(!t||!Array.isArray(t.tracks))return;const e=t.id,n=M(sA,this).get(e)||new Map;M(sA,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(Im.TRACK_BUFFER_UPDATE,{nodeId:e,trackType:i,range:r})),!s&&a?this.trigger(Im.TRACK_READY,{nodeId:e,trackType:i,range:r}):s&&!a&&this.trigger(Im.TRACK_UNDERFLOW,{nodeId:e,trackType:i,range:r})}))}getTrackRange(t,e){const n=M(sA,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=A(aA,this,uA).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 M(sA,this)}reset(){M(sA,this).clear()}onDispose(){M(sA,this).clear(),"function"==typeof this.off&&this.off()}}function cA(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 uA(t,e,n=0){var i,r;const o=Ap(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 A(aA,this,dA).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=A(aA,this,cA).call(this,d,u)||(null===(r=d)||void 0===r?void 0:r.buffered);return h&&Number.isFinite(h.start)&&Number.isFinite(h.end)?A(aA,this,dA).call(this,s,h,o,e):void 0}function dA(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 hA{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 fA extends Iu{constructor(t,e){super(e),this.timeline=t}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"handleDecodedFrame","handleClockTick","handleMainTrackBufferUpdate"])}enter(){}exit(){}play(){this.timeline.transitionTo(Mm)}pause(){this.timeline.transitionTo(Om)}wait(){this.timeline.transitionTo(Cm)}reset(){this.timeline.transitionTo(Rm)}seek(t){this.timeline.transitionTo(Pm,{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()||Om;this.timeline.transitionTo(e)}handleMainTrackBufferUpdate(t){}handleDecodedFrame(t){}handleClockTick(t){}onDispose(){this.timeline=null}}const pA=24e3/1001;function mA(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 vA(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 gA(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 yA(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 bA(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:pA)}(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+vA(t)}function kA(t,e=(null==t?void 0:t.currentTime)){const n=mA(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=gA(o);if(!s)return!0;if(!t.hasDecodedFirstFrame(r,s))return!0}return!1}function xA(t,e=(null==t?void 0:t.currentTime)){return kA(t,e)||function(t,e=(null==t?void 0:t.currentTime)){const n=mA(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=yA(s);if(null!=a&&a.id&&!bA(t,o,a.id,a.type,n))return!0}return!1}(t,e)}function wA(t,e=(null==t?void 0:t.currentTime)){if("function"!=typeof(null==t?void 0:t.computeBuffered))return!1;const n=mA(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=vA(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=Ap(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 _A={[Nm]:class extends fA{get name(){return Nm}get defaults(){return{autoplay:qg("autoplay")}}enter(){this.timeline.recordStableState(Om),this.timeline.stopPlaybackClock()}play(){const t=xA(this.timeline),e=t?Cm:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t)return this.timeline.recordStableState(Mm),void this.timeline.transitionTo(Cm);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(xA(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)}},[Fm]:class extends fA{get name(){return Fm}enter(t={}){const{from:e,to:n}=t;this.timeline.recordStableState(Mm),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("canplay",{from:e,to:n})}play(){}pause(){this.timeline.transitionTo(Om)}},[Mm]:class extends fA{get name(){return Mm}enter(t={}){const{from:e,to:n,fromFirstFramePending:i}=t;this.timeline.recordStableState(Mm),this.timeline.startPlaybackClock(),!0!==i&&this.emitPlayerStateEvent("canplay",{from:e,to:n}),this.emitPlayerStateEvent("playing",{from:e,to:n})}play(){}pause(){this.timeline.transitionTo(Om)}handleClockTick(t){const e=this.timeline.currentTime;xA(this.timeline,e)&&(this.timeline.recordStableState(Mm),this.timeline.transitionTo(Cm))}},[Cm]:(Ze=new WeakMap,tn=new WeakMap,en=new WeakSet,class extends fA{constructor(...t){super(...t),O(this,en),F(this,Ze,void 0),F(this,tn,null)}get name(){return Cm}enter(t={}){const{from:e,to:n}=t;this.timeline.stopPlaybackClock(),A(en,this,TA).call(this),A(en,this,EA).call(this),this.emitPlayerStateEvent("waiting",{from:e,to:n}),A(en,this,NA).call(this)}exit(){A(en,this,IA).call(this),A(en,this,SA).call(this)}play(){this.timeline.recordStableState(Mm);const t=A(en,this,AA).call(this),e=t?Cm:this.timeline.getPlaybackStartState();this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t||this.timeline.transitionTo(e)}pause(){this.timeline.transitionTo(Om)}handleMainTrackReady(t){const e=this.timeline.getLastStableState()||Om;e!==Mm?this.timeline.transitionTo(e):A(en,this,NA).call(this)}handleDecodedFrame(t){A(en,this,NA).call(this)}handleMainTrackBufferUpdate(t){A(en,this,NA).call(this)}}),[Om]:class extends fA{get name(){return Om}enter(t={}){const{from:e,to:n}=t;this.timeline.recordStableState(Om),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("pause",{from:e,to:n})}play(){const t=xA(this.timeline),e=t?Cm:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t)return this.timeline.recordStableState(Mm),void this.timeline.transitionTo(Cm);this.timeline.transitionTo(e)}pause(){}},[Pm]:class extends fA{get name(){return Pm}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===Mm||n===Fm,r=i&&"function"==typeof this.timeline.getPlaybackStartState?this.timeline.getPlaybackStartState(e):i?Mm:Om;this.timeline.transitionTo(r,{fromSeeking:!0})}play(){var t;if(this.timeline&&"function"==typeof this.timeline.setSeekReturnState)return void this.timeline.setSeekReturnState(Mm);const e="function"==typeof(null===(t=this.timeline)||void 0===t?void 0:t.getPlaybackStartState)?this.timeline.getPlaybackStartState():Mm;this.timeline.transitionTo(e)}pause(){this.timeline&&"function"==typeof this.timeline.setSeekReturnState?this.timeline.setSeekReturnState(Om):this.timeline.transitionTo(Om)}handleDecodedFrame(t){this.timeline&&"function"==typeof this.timeline.maybeCompleteSeek&&this.timeline.maybeCompleteSeek(t)}},[Rm]:class extends fA{get name(){return Rm}enter(){this.timeline.resetClock(),this.timeline.transitionTo(Nm,{fromReset:!0})}play(){}pause(){}get buffered(){return{start:0,end:0}}}};function TA(){var t;const e=null===(t=this.timeline)||void 0===t?void 0:t.trackBuffers;e&&"function"==typeof e.on&&(C(Ze,this,(t=>this.handleMainTrackBufferUpdate(t))),e.on(Im.TRACK_BUFFER_UPDATE,M(Ze,this)))}function IA(){var t;const e=null===(t=this.timeline)||void 0===t?void 0:t.trackBuffers;M(Ze,this)&&e&&"function"==typeof e.off?(e.off(Im.TRACK_BUFFER_UPDATE,M(Ze,this)),C(Ze,this,null)):C(Ze,this,null)}function EA(){if(null!==M(tn,this))return;const t="function"==typeof(null==Au?void 0:Au.setInterval)?Au.setInterval.bind(Au):setInterval;C(tn,this,t((()=>{var t;(null===(t=this.timeline)||void 0===t?void 0:t.state)===Cm&&A(en,this,NA).call(this)}),200))}function SA(){null!==M(tn,this)&&(("function"==typeof(null==Au?void 0:Au.clearInterval)?Au.clearInterval.bind(Au):clearInterval)(M(tn,this)),C(tn,this,null))}function AA(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!!kA(t,e)||!0===n.skipBufferResume||!wA(t,e)}(this.timeline,t)}function NA(t=(t=>null===(t=this.timeline)||void 0===t?void 0:t.currentTime)()){return(this.timeline.getLastStableState()||Om)===Mm&&!A(en,this,AA).call(this,t)&&(this.timeline.transitionTo(this.timeline.getPlaybackStartState(t)),!0)}function MA(t){return t&&("string"!=typeof t.state||"ready"===t.state)}function FA(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).some((t=>"video"===(null==t?void 0:t.type)))}function CA(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 OA(t){return t===Mm||t===Fm}var PA=new WeakMap,RA=new WeakMap,DA=new WeakMap,LA=new WeakMap,BA=new WeakMap,zA=new WeakMap,WA=new WeakMap,$A=new WeakMap,UA=new WeakMap,jA=new WeakMap,qA=new WeakMap,VA=new WeakMap,HA=new WeakMap,GA=new WeakMap,KA=new WeakSet;class XA{constructor(t={}){O(this,KA),F(this,PA,void 0),F(this,RA,void 0),F(this,DA,void 0),F(this,LA,void 0),F(this,BA,void 0),F(this,zA,void 0),F(this,WA,void 0),F(this,$A,void 0),F(this,UA,void 0),F(this,jA,null),F(this,qA,Om),F(this,VA,[]),F(this,HA,new Set),F(this,GA,new Map),C(PA,this,t.getState),C(RA,this,t.getNode),C(DA,this,t.getPlacementsActiveAtTime),C(LA,this,t.getLastStableState),C(BA,this,t.getPlaybackStartState),C(zA,this,t.clearVisualFrameBuffers),C(WA,this,t.updateTime),C($A,this,t.transitionTo),C(UA,this,t.trigger)}start(t,e){const n=Number(t);if(!Number.isFinite(n))return;let i=e;i===Pm?i=M(qA,this):i===Cm&&"function"==typeof M(LA,this)&&(i=M(LA,this).call(this)),C(qA,this,OA(i)?Mm:Om),C(jA,this,n),M(HA,this).clear(),M(GA,this).clear(),C(VA,this,"function"==typeof M(DA,this)?M(DA,this).call(this,n):[]),"function"==typeof M(zA,this)&&M(zA,this).call(this),"function"==typeof M(WA,this)&&M(WA,this).call(this,n,{source:"seek"}),"function"==typeof M(UA,this)&&M(UA,this).call(this,Im.TIMELINE_SEEKING,{targetTime:n,placements:M(VA,this).slice()}),this.maybeComplete()}setReturnState(t){C(qA,this,OA(t)?Mm:Om)}maybeComplete(t){if(("function"==typeof M(PA,this)?M(PA,this).call(this):void 0)!==Pm)return;const e=M(jA,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){M(HA,this).add(i);const t=M(GA,this).get(i);(!Number.isFinite(t)||n<t)&&M(GA,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)&&M(HA,this).add(i);const r=Array.isArray(M(VA,this))?M(VA,this):[];if(r.length){if("function"==typeof M(RA,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=M(RA,this).call(this,e.nodeId);if(!MA(i))return;if(CA(i)&&!M(HA,this).has(n))return}A(KA,this,YA).call(this,e,r)}}else A(KA,this,YA).call(this,e,[])}dispose(){C(VA,this,[]),M(HA,this).clear(),M(GA,this).clear(),C(jA,this,null)}}function YA(t,e){const n=A(KA,this,QA).call(this,t,e);if("function"==typeof M(WA,this)&&M(WA,this).call(this,n,{source:"seek"}),C(jA,this,null),C(VA,this,[]),M(HA,this).clear(),M(GA,this).clear(),"function"==typeof M(UA,this)&&M(UA,this).call(this,Im.TIMELINE_SEEKED,{targetTime:t,placements:Array.isArray(e)?e.slice():[]}),"function"==typeof M($A,this)){const t=M(qA,this)===Mm&&"function"==typeof M(BA,this)?M(BA,this).call(this,n):M(qA,this);M($A,this).call(this,t,{fromSeeking:!0})}}function QA(t,e){const n=Number(t);if(!Number.isFinite(n))return t;if(!Array.isArray(e)||!e.length||"function"!=typeof M(RA,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(!FA(M(RA,this).call(this,n.nodeId)))continue;const o=M(GA,this).get(r);Number.isFinite(o)&&o>i&&(i=o)}return i}function JA(t){if(t&&"function"==typeof t.close)try{t.close()}catch(t){}}function ZA(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=>JA(null==t?void 0:t.frame)))}function tN(t){return Ap(t)}function eN(t){return Number.isFinite(null==t?void 0:t.loopRootOffset)?t.loopRootOffset:tN(t)}function nN(t,e){return"string"==typeof(null==t?void 0:t.loopRootPlacementId)&&t.loopRootPlacementId?t.loopRootPlacementId:e}function iN(t){if("string"!=typeof t)return Number.NaN;const e=t.match(/(\d+)/);return e?Number(e[1]):Number.NaN}function rN(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 oN=1e-6;function sN(t){return t&&("string"!=typeof t.state||"ready"===t.state)}function aN(t){const e=Number(t);return Number.isFinite(e)?e:0}function lN(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 cN(t){return t&&"cue"===t.type&&Array.isArray(t.cues)?t.cues:[]}var uN=new WeakMap,dN=new WeakMap,hN=new WeakMap,fN=new WeakMap,pN=new WeakMap,mN=new WeakMap,vN=new WeakMap,gN=new WeakMap,yN=new WeakSet;class bN{constructor(t={}){O(this,yN),F(this,uN,void 0),F(this,dN,void 0),F(this,hN,void 0),F(this,fN,void 0),F(this,pN,void 0),F(this,mN,void 0),F(this,vN,-1e-6),F(this,gN,null),C(uN,this,t.getPlacements),C(dN,this,t.getPlacementsActiveAtTime),C(hN,this,t.getPlacementDuration),C(fN,this,t.getNode),C(pN,this,t.triggerTimeline),C(mN,this,t.triggerNode)}handleSeeking(t,e){const n=aN(t);C(gN,this,n)}handleSeeked(t){const e=aN(t),n=M(gN,this);C(gN,this,null),Number.isFinite(n)?(A(yN,this,xN).call(this,n,e),C(vN,this,e)):C(vN,this,e)}handleTimeUpdate(t,e={}){const n=aN(t),i=M(vN,this);!0===(null==e?void 0:e.isSeeking)?C(vN,this,n):Number.isFinite(i)?n<=i?n<i&&C(vN,this,n-oN):(A(yN,this,kN).call(this,i,n),C(vN,this,n)):C(vN,this,n)}dispose(){C(gN,this,null),C(vN,this,-1e-6)}}function kN(t,e){const n="function"==typeof M(uN,this)?M(uN,this).call(this):[];A(yN,this,wN).call(this,n,t,e,{onlySticky:!1})}function xN(t,e){if("function"!=typeof M(dN,this))return;const n=M(dN,this).call(this,e);A(yN,this,wN).call(this,n,t,e,{onlySticky:!0})}function wN(t,e,n,i={}){if("function"!=typeof M(fN,this)||"function"!=typeof M(pN,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=M(fN,this).call(this,l);if(!sN(c))continue;const u=lN(c);if(!u.length)continue;const d=Ap(s);if(!Number.isFinite(d))continue;const h=Number.isFinite(null==s?void 0:s.nodeOffsetOverride)?s.nodeOffsetOverride:0,f="function"==typeof M(hN,this)?M(hN,this).call(this,s):void 0,p="number"==typeof f&&Number.isFinite(f)?d+f:Number.POSITIVE_INFINITY,m=r?d-oN:e;for(let t=0;t<u.length;t+=1){const e=cN(u[t]);for(let i=0;i<e.length;i+=1){const s=e[i],c=aN(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};M(pN,this).call(this,"cuepoint",n),M(pN,this).call(this,e.name,n),"function"==typeof M(mN,this)&&(M(mN,this).call(this,t.nodeId,"cuepoint",n),M(mN,this).call(this,t.nodeId,e.name,n))})))}class _N{#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 TN=24e3/1001;function IN(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}:rN(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 EN=new WeakMap,SN=new WeakMap,AN=new WeakMap,NN=new WeakMap,MN=new WeakMap,FN=new WeakMap,CN=new WeakMap,ON=new WeakMap,PN=new WeakMap,RN=new WeakMap,DN=new WeakMap,LN=new WeakMap,BN=new WeakMap,zN=new WeakMap,WN=new WeakMap,$N=new WeakMap,UN=new WeakMap,jN=new WeakMap,qN=new WeakMap,VN=new WeakMap,HN=new WeakMap,GN=new WeakMap,KN=new WeakMap,XN=new WeakMap,YN=new WeakMap,QN=new WeakMap,JN=new WeakMap,ZN=new WeakMap,tM=new WeakMap,eM=new WeakMap,nM=new WeakMap,iM=new WeakMap,rM=new WeakMap,oM=new WeakSet;class sM extends Iu{constructor(...t){super(...t),O(this,oM),F(this,EN,void 0),F(this,SN,void 0),F(this,AN,void 0),F(this,NN,void 0),F(this,MN,void 0),F(this,FN,!1),F(this,CN,[]),F(this,ON,new _N("placement-")),F(this,PN,[]),F(this,RN,new _N("renderplacement-")),F(this,DN,void 0),F(this,LN,void 0),F(this,BN,void 0),F(this,zN,!1),F(this,WN,new Set),F(this,$N,new Set),F(this,UN,new Map),F(this,jN,[]),F(this,qN,0),F(this,VN,new Set),F(this,HN,new Set),F(this,GN,Number.NEGATIVE_INFINITY),F(this,KN,[]),F(this,XN,Number.NEGATIVE_INFINITY),F(this,YN,0),F(this,QN,void 0),F(this,JN,void 0),F(this,ZN,new Map),F(this,tM,null),F(this,eM,void 0),F(this,nM,void 0),F(this,iM,void 0),F(this,rM,void 0);const[e,n={}]=t;C(EN,this,e),C(QN,this,n),C(MN,this,new nA(n)),C(DN,this,new lA(n)),C(NN,this,Om),A(oM,this,gM).call(this),A(oM,this,yM).call(this),C(eM,this,new XA({getState:()=>this.state,getNode:t=>M(EN,this)&&"function"==typeof M(EN,this).get?M(EN,this).get(t):void 0,getPlacementsActiveAtTime:t=>A(oM,this,QM).call(this,t,{endEpsilonSeconds:A(oM,this,sF).call(this)}),getLastStableState:()=>this.getLastStableState(),getPlaybackStartState:t=>this.getPlaybackStartState(t),clearVisualFrameBuffers:()=>A(oM,this,XM).call(this),updateTime:(t,e)=>this.updateTime(t,e),transitionTo:(t,e)=>this.transitionTo(t,e),trigger:(t,e)=>this.trigger(t,e)})),C(nM,this,new bN({getPlacements:()=>M(CN,this).slice(),getPlacementsActiveAtTime:t=>A(oM,this,QM).call(this,t),getPlacementDuration:t=>A(oM,this,CM).call(this,t),getNode:t=>M(EN,this)&&"function"==typeof M(EN,this).get?M(EN,this).get(t):void 0,triggerTimeline:(t,e)=>this.trigger(t,e),triggerNode:(t,e,n)=>{const i=M(EN,this)&&"function"==typeof M(EN,this).get?M(EN,this).get(t):void 0;i&&"function"==typeof i.trigger&&i.trigger(e,n)}})),C(iM,this,(()=>{var t,e;null===(t=M(nM,this))||void 0===t||null===(e=t.handleSeeked)||void 0===e||e.call(t,this.currentTime)})),this.on(Im.TIMELINE_SEEKED,M(iM,this)),C(rM,this,(t=>A(oM,this,IM).call(this,t))),this.on("nodestart",M(rM,this)),this.transitionTo(Nm)}get name(){return"Timeline"}get defaults(){return{snapToFps:TN,maxBufferedVideoFrames:24}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"computeBuffered","notifyDecodedFrame","getDecodedFrameStats","getActiveRenderPlacement","maybeCompleteSeek","getPlacementsActiveAtTime","hasDecodedFirstFrame","getDecodedVisualBuffer","getPlacementDuration","getNode"])}transitionTo(t,e={}){const n=M(AN,this),i=function(t,e,n={}){const i=_A[t];return i?new i(e,n):null}(t,this,M(QN,this)),r=e&&"object"==typeof e&&!Array.isArray(e)?{...e,from:n,to:t}:{from:n,to:t};i?(M(SN,this)&&"function"==typeof M(SN,this).exit&&M(SN,this).exit(),C(SN,this,i),C(AN,this,t),"function"==typeof i.enter&&i.enter(r),this.trigger(Im.TIMELINE_STATE_CHANGE,{from:n,to:t,options:e})):this.log.warn(`Unknown state "${t}"`)}recordStableState(t){C(NN,this,t)}getLastStableState(){return M(NN,this)}enableFirstFrameRenderedGate(){C(FN,this,!0)}getPlaybackStartState(t=this.currentTime){return this.shouldWaitForFirstRenderedFrame(t)?Fm:Mm}shouldWaitForFirstRenderedFrame(t=this.currentTime){if(!M(FN,this)||M(zN,this))return!1;const e=Number.isFinite(t)?t:this.currentTime,n=A(oM,this,QM).call(this,e);return Array.isArray(n)&&n.length>0}notifyFirstFrameRendered(){M(zN,this)||(C(zN,this,!0),this.state===Fm&&this.transitionTo(Mm,{fromFirstFramePending:!0}))}get state(){return M(AN,this)}get paused(){return M(AN,this)===Nm||M(AN,this)===Om}get currentTime(){return M(MN,this).currentTime}set currentTime(t){M(SN,this).seek(t)}get playbackRate(){return M(MN,this).playbackRate}set playbackRate(t){M(MN,this).playbackRate=t}play(){M(SN,this).play()}pause(){M(SN,this).pause()}reset(){M(SN,this).reset()}seekToPlacement(t){if(!t)throw new Error("Timeline.seekToPlacement requires placement id");A(oM,this,AM).call(this);const e=A(oM,this,nF).call(this,t);if(!e)throw new Error("Timeline.seekToPlacement requires placement id");const n=Ap(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;A(oM,this,AM).call(this),A(oM,this,NM).call(this),M(MN,this).seek(t),A(oM,this,YM).call(this,this.currentTime),A(oM,this,JM).call(this);const r="string"==typeof(null==e?void 0:e.source)?e.source:"set";null!==(n=M(nM,this))&&void 0!==n&&null!==(i=n.handleTimeUpdate)&&void 0!==i&&i.call(n,this.currentTime,{isSeeking:this.state===Pm}),A(oM,this,EM).call(this,this.currentTime),A(oM,this,qM).call(this,this.currentTime),this.trigger(Im.TIMELINE_TIME_UPDATE,Em(this.currentTime,r))}startSeeking(t,e){var n,i;null!==(n=M(nM,this))&&void 0!==n&&null!==(i=n.handleSeeking)&&void 0!==i&&i.call(n,this.currentTime,t),M(eM,this)&&"function"==typeof M(eM,this).start&&M(eM,this).start(t,e)}setSeekReturnState(t){M(eM,this)&&"function"==typeof M(eM,this).setReturnState&&M(eM,this).setReturnState(t)}maybeCompleteSeek(t){M(eM,this)&&"function"==typeof M(eM,this).maybeComplete&&M(eM,this).maybeComplete(t)}startPlaybackClock(){M(MN,this).play()}stopPlaybackClock(){M(MN,this).pause()}resetClock(){var t,e;M(MN,this).reset(),null===(t=M(nM,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:[];A(oM,this,aM).call(this),A(oM,this,lM).call(this,e),A(oM,this,cM).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=M(ON,this).claim(n.placementId),o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=Pp(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}:Op(e,n);let u,d,h,f=!1;const p=null!==a;if(A(oM,this,AM).call(this),a){const t=M(CN,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=Ap(t);if("start"===a.anchor)Number.isFinite(e)?u=A(oM,this,OM).call(this,e,{nodeOffsetOverride:o}):f=!0;else{const n=A(oM,this,CM).call(this,t);if(Number.isFinite(e)&&n>0){const t=e+n,i=A(oM,this,OM).call(this,t,{nodeOffsetOverride:o});u=Math.max(i,t)}else f=!0}}else if(l){const t=n.offsetAnchorPlacementId?M(CN,this).find((t=>(null==t?void 0:t.placementId)===n.offsetAnchorPlacementId)):M(CN,this).length?M(CN,this)[M(CN,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==t?void 0:t.placementId),d){const e=Ap(t),n=A(oM,this,CM).call(this,t);Number.isFinite(e)&&n>0?u=A(oM,this,OM).call(this,e+n-c,{nodeOffsetOverride:o}):(f=!0,h="end")}else u=A(oM,this,OM).call(this,-c,{nodeOffsetOverride:o})}else u=Cp(e),u=A(oM,this,OM).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 hA({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(M(CN,this).push(y),Mp(M(CN,this)),A(oM,this,UM).call(this,y),A(oM,this,WM).call(this),f&&d){const t=M(CN,this).find((t=>(null==t?void 0:t.placementId)===d));A(oM,this,RM).call(this,null==t?void 0:t.nodeId)}return this.trigger(Im.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=A(oM,this,PM).call(this,e,i),s=o.offset,a=!0===o.offsetPending,l=o.offsetAnchorPlacementId,c=o.offsetAnchorEdge,u=o.offsetAnchorIsReference,d=M(RN,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;Rp(M(PN,this),t,e,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements")}if(M(PN,this).push(v),Mp(M(PN,this)),a&&l){const t=M(CN,this).find((t=>(null==t?void 0:t.placementId)===l));A(oM,this,RM).call(this,null==t?void 0:t.nodeId)}return this.trigger(Im.RENDER_PLACEMENT_ADDED,v),d}get placements(){return M(CN,this).slice()}getPlacementsActiveAtTime(t){return A(oM,this,QM).call(this,t)}getNodesAtTime(t){const e=A(oM,this,iF).call(this,t);if(!Number.isFinite(e))return[];const n=A(oM,this,QM).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 A(oM,this,CM).call(this,t)}getNode(t){if(M(EN,this)&&"function"==typeof M(EN,this).get)return M(EN,this).get(t)}get renderPlacements(){return M(PN,this).slice()}get placementsAhead(){const t=this.currentTime;return M(CN,this).filter((e=>{const n=Ap(e);if(!Number.isFinite(n))return!1;const i=A(oM,this,CM).call(this,e);return"number"==typeof i?n+i>t:n>=t}))}get buffered(){return M(SN,this)?M(SN,this).buffered:{start:0,end:0}}get trackBuffers(){return M(DN,this)}onDispose(){A(oM,this,mM).call(this),M($N,this)&&M($N,this).clear(),M(nM,this)&&"function"==typeof M(nM,this).dispose&&M(nM,this).dispose(),C(nM,this,null),A(oM,this,pM).call(this),A(oM,this,vM).call(this),M(eM,this)&&"function"==typeof M(eM,this).dispose&&M(eM,this).dispose(),C(eM,this,null),M(MN,this)&&"function"==typeof M(MN,this).dispose&&(M(JN,this)&&"function"==typeof M(MN,this).off&&(M(MN,this).off("tick",M(JN,this)),C(JN,this,null)),M(MN,this).dispose(),C(MN,this,null)),A(oM,this,BM).call(this),C(SN,this,null),C(AN,this,null),C(CN,this,[]),C(PN,this,[]),A(oM,this,zM).call(this),A(oM,this,WM).call(this),M(ZN,this).clear(),C(tM,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}`;M(WN,this).add(i),A(oM,this,KM).call(this,t),A(oM,this,JM).call(this),M(SN,this)&&"function"==typeof M(SN,this).handleDecodedFrame&&M(SN,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=IN(t);Number.isFinite(i)&&i>0&&(e.totalBytes+=i)}))}return e.available=!0,e}(M(ZN,this))}hasDecodedFirstFrame(t,e){return!(!t||!e)&&M(WN,this).has(`${t}:${e}`)}getDecodedVisualBuffer(t,e){if(t&&e)return M(ZN,this).get(`${t}:${e}`)}computeBuffered(t){const e=M(EN,this);if(e&&"function"==typeof e.get)return M(DN,this).computeBuffered(M(CN,this),t,e)}getActiveRenderPlacement(t=this.currentTime){const e=Number.isFinite(t)?t:this.currentTime,n=Array.isArray(M(PN,this))?M(PN,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 aM(){C(zN,this,!1),this.trigger(Im.TIMELINE_RESET,{reason:"switch"}),A(oM,this,XM).call(this),M(DN,this)&&"function"==typeof M(DN,this).reset&&M(DN,this).reset(),M($N,this)&&M($N,this).clear(),C(CN,this,[]),C(PN,this,[]),A(oM,this,zM).call(this),A(oM,this,WM).call(this),M(ON,this).reset(),M(RN,this).reset()}function lM(t=[]){for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||!n.nodeId)continue;const i=A(oM,this,uM).call(this,n),r=A(oM,this,hM).call(this,n);this.placeOnTimeline(n.nodeId,r,i)}}function cM(t=[]){for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||!n.type)continue;const i=A(oM,this,dM).call(this,n),r=A(oM,this,fM).call(this,n);this.placeRenderNodeOnTimeline(n.type,r,n.duration,i)}}function uM(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 dM(t){const e={};return t.renderPlacementId&&(e.renderPlacementId=t.renderPlacementId),t.params&&"object"==typeof t.params&&(e.params=t.params),e}function hM(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 fM(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 pM(){M(SN,this)&&"function"==typeof M(SN,this).exit&&M(SN,this).exit()}function mM(){M(iM,this)&&"function"==typeof this.off&&(this.off(Im.TIMELINE_SEEKED,M(iM,this)),C(iM,this,null)),M(rM,this)&&"function"==typeof this.off&&(this.off("nodestart",M(rM,this)),C(rM,this,null))}function vM(){M(DN,this)&&(M(LN,this)&&(M(DN,this).off("track:underflow",M(LN,this)),C(LN,this,null)),M(BN,this)&&(M(DN,this).off("track:ready",M(BN,this)),C(BN,this,null)),"function"==typeof M(DN,this).dispose&&M(DN,this).dispose(),C(DN,this,null))}function gM(){M(DN,this)&&"function"==typeof M(DN,this).on&&(C(LN,this,(t=>A(oM,this,kM).call(this,t))),C(BN,this,(t=>A(oM,this,xM).call(this,t))),M(DN,this).on(Im.TRACK_UNDERFLOW,M(LN,this)),M(DN,this).on(Im.TRACK_READY,M(BN,this)))}function yM(){M(MN,this)&&"function"==typeof M(MN,this).on&&(C(JN,this,(t=>A(oM,this,bM).call(this,t))),M(MN,this).on(Im.CLOCK_TICK,M(JN,this)))}function bM(t){var e,n;A(oM,this,AM).call(this),A(oM,this,JM).call(this),null!==(e=M(nM,this))&&void 0!==e&&null!==(n=e.handleTimeUpdate)&&void 0!==n&&n.call(e,this.currentTime,{isSeeking:!1}),A(oM,this,EM).call(this,this.currentTime),this.trigger(Im.TIMELINE_TIME_UPDATE,Em(this.currentTime,"clock")),M(SN,this)&&"function"==typeof M(SN,this).handleClockTick&&M(SN,this).handleClockTick(t)}function kM(t){A(oM,this,AM).call(this);const e=A(oM,this,wM).call(this);e&&(null==t?void 0:t.trackType)===e.trackType&&(M(SN,this)&&"function"==typeof M(SN,this).handleMainTrackUnderflow?M(SN,this).handleMainTrackUnderflow(t):this.transitionTo(Cm))}function xM(t){if(A(oM,this,AM).call(this),this.state!==Cm)return;const e=A(oM,this,wM).call(this);if(!e)return;if((null==t?void 0:t.trackType)!==e.trackType)return;if(M(SN,this)&&"function"==typeof M(SN,this).handleMainTrackReady)return void M(SN,this).handleMainTrackReady(t);const n=this.getLastStableState()||Om;this.transitionTo(n)}function wM(t=this.currentTime){const e=A(oM,this,TM).call(this,t);if(!e)return;const n=M(EN,this)&&"function"==typeof M(EN,this).get?M(EN,this).get(e.nodeId):void 0;if(!n)return;const i=A(oM,this,_M).call(this,n);return i?{placement:e,trackType:i}:void 0}function _M(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 TM(t=this.currentTime){const e=M(CN,this)||[];let n;for(let i=0;i<e.length;i+=1){const r=e[i],o=Ap(r);if(!Number.isFinite(o))continue;const s=A(oM,this,CM).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 IM(t={}){if(this.state!==Mm)return;const e=null==t?void 0:t.placementId;if(!e)return;const n=A(oM,this,nF).call(this,e);n&&A(oM,this,SM).call(this,n)}function EM(t=this.currentTime){if(this.state!==Mm)return;const e=A(oM,this,QM).call(this,t);Array.isArray(e)&&e.length&&e.forEach((t=>A(oM,this,SM).call(this,t)))}function SM(t){const e=null==t?void 0:t.placementId;if(!e)return;if(M($N,this).has(e))return;if(!t||!0!==t.loop)return;if(!t.nodeId)return;const n=A(oM,this,CM).call(this,t);if(!Number.isFinite(n)||n<=0)return;const i=Ap(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;M($N,this).add(e),this.placeOnTimeline(t.nodeId,r,{nodeOffsetOverride:t.nodeOffsetOverride,nodeDurationOverride:t.nodeDurationOverride,loop:!0,loopRootPlacementId:o,loopRootOffset:s})}function AM(){const t=Fp(M(CN,this),{getPlacementDuration:t=>A(oM,this,CM).call(this,t),snapPlacementOffset:(t,e)=>A(oM,this,OM).call(this,t,{nodeOffsetOverride:null==e?void 0:e.nodeOffsetOverride}),onResolvedPlacement:(t,e)=>{!0!==t.loop||Number.isFinite(t.loopRootOffset)||(t.loopRootOffset=t.offset),A(oM,this,DM).call(this,null==e?void 0:e.nodeId)}});return t.updated&&(A(oM,this,WM).call(this),t.resolvedPlacements.forEach((t=>{A(oM,this,UM).call(this,t),this.trigger(Im.PLACEMENT_ADDED,t)}))),t.updated}function NM(){if(!M(PN,this).length||!M(CN,this).length)return!1;const t=new Map;M(CN,this).forEach((e=>{(null==e?void 0:e.placementId)&&t.set(e.placementId,e)}));const e=M(PN,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];A(oM,this,MM).call(this,o,t)&&(n=!0,i.push(o))}return n&&(Mp(M(PN,this)),i.forEach((t=>{this.trigger(Im.RENDER_PLACEMENT_ADDED,t)}))),n}function MM(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=A(oM,this,FM).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 Rp(M(PN,this).filter((e=>e!==t&&!0!==(null==e?void 0:e.offsetPending))),s,a,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements"),A(oM,this,DM).call(this,null==r?void 0:r.nodeId),!0}function FM(t,e){const n=Ap(t);if(!Number.isFinite(n))return;if("start"===e.offsetAnchorEdge)return A(oM,this,OM).call(this,n);const i=A(oM,this,CM).call(this,t);if(!(i>0))return;const r=n+i;if(!Number.isFinite(r))return;const o=A(oM,this,OM).call(this,r);return!0===e.offsetAnchorIsReference?Math.max(o,r):o}function CM(t){return Ep(t,M(EN,this))}function OM(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 PM(t,e={}){const n=Pp(t);if("string"==typeof t&&t.includes("@")&&!n)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");if(!n){const n=Cp(t);return{offset:A(oM,this,OM).call(this,n,e)}}const i=M(CN,this).find((t=>(null==t?void 0:t.placementId)===n.placementId));if(!i)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");const r=Ap(i);if("start"===n.anchor)return Number.isFinite(r)?{offset:A(oM,this,OM).call(this,r,e)}:{offset:void 0,offsetPending:!0,offsetAnchorPlacementId:i.placementId,offsetAnchorEdge:"start",offsetAnchorIsReference:!0};const o=A(oM,this,CM).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=A(oM,this,OM).call(this,s,e);return{offset:Math.max(a,s)}}function RM(t){if(!t||!M(EN,this)||"function"!=typeof M(EN,this).get)return;if(M(UN,this).has(t))return;let e;try{e=M(EN,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),A(oM,this,DM).call(this,t)};e.on(Im.NODE_LOADED,n),M(UN,this).set(t,n)}function DM(t){if(!t)return;if(A(oM,this,LM).call(this,t))return;const e=M(UN,this).get(t);if(!e)return;let n;try{n=M(EN,this).get(t)}catch(t){n=null}n&&"function"==typeof n.off&&n.off(Im.NODE_LOADED,e),M(UN,this).delete(t)}function LM(t){if(!t)return!1;const e=new Map;M(CN,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!!M(CN,this).some((t=>n(t)))||!!M(PN,this).some((t=>n(t)))}function BM(){M(UN,this).size&&M(EN,this)?(M(UN,this).forEach(((t,e)=>{let n;try{n=M(EN,this).get(e)}catch(t){n=null}n&&"function"==typeof n.off&&n.off(Im.NODE_LOADED,t)})),M(UN,this).clear()):M(UN,this).clear()}function zM(){C(jN,this,[]),C(qN,this,0),M(VN,this).clear(),M(HN,this).clear(),C(GN,this,Number.NEGATIVE_INFINITY)}function WM(){C(KN,this,[]),C(YN,this,0),C(XN,this,Number.NEGATIVE_INFINITY)}function $M(t,e){const n=M(jN,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<M(qN,this)&&C(qN,this,M(qN,this)+1)}function UM(t){const e=null==t?void 0:t.placementId;if(!e||M(VN,this).has(e))return;const n=Ap(t),i=A(oM,this,CM).call(this,t);if(!Number.isFinite(n)||!Number.isFinite(i)||i<0)return void M(HN,this).add(e);const r=n+i;Number.isFinite(r)&&(M(VN,this).add(e),M(HN,this).delete(e),A(oM,this,$M).call(this,e,r))}function jM(){M(HN,this).size&&Array.from(M(HN,this)).forEach((t=>{const e=A(oM,this,nF).call(this,t);e?A(oM,this,UM).call(this,e):M(HN,this).delete(t)}))}function qM(t){const e=Number(t);if(!Number.isFinite(e))return;if(e<M(GN,this))return void C(GN,this,e);if(C(GN,this,e),A(oM,this,jM).call(this),!M(jN,this).length)return;const n=new Set;let i=M(qN,this);for(;i<M(jN,this).length;){const t=M(jN,this)[i];if(!t||!Number.isFinite(t.endTime)||t.endTime>e)break;t.placementId&&n.add(t.placementId),i+=1}i!==M(qN,this)&&(C(qN,this,i),n.size&&(A(oM,this,GM).call(this,n),A(oM,this,VM).call(this,n)))}function VM(t){if(t&&t.size)for(const e of M(WN,this)){const n=e.split(":")[0];t.has(n)&&M(WN,this).delete(e)}}function HM(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 GM(t){if(t&&t.size)for(const[e,n]of M(ZN,this).entries())t.has(null==n?void 0:n.placementId)&&(A(oM,this,HM).call(this,n),M(ZN,this).delete(e))}function KM(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=rN(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=M(ZN,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||M(ZN,this).set(f,m)}function XM(){for(const t of M(ZN,this).values())A(oM,this,HM).call(this,t);M(ZN,this).clear(),C(tM,this,null),M(WN,this).clear()}function YM(t){const e=Number.isFinite(t)?t:this.currentTime;if(!Number.isFinite(e))return;e<M(XN,this)&&(C(KN,this,[]),C(YN,this,0));const n=Array.isArray(M(CN,this))?M(CN,this):[],i=[],r=new Set;M(KN,this).forEach((t=>{A(oM,this,aF).call(this,t,e)&&(i.push(t),(null==t?void 0:t.placementId)&&r.add(t.placementId))}));let o=M(YN,this);for(;o<n.length;){const t=n[o],s=Ap(t);if(!Number.isFinite(s))break;if(s>e)break;if(A(oM,this,aF).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}C(KN,this,i),C(YN,this,o),C(XN,this,e)}function QM(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===M(XN,this)?M(KN,this).slice():(Array.isArray(M(CN,this))?M(CN,this):[]).filter((t=>A(oM,this,aF).call(this,t,n,i)))}function JM(){const t=this.currentTime,e=A(oM,this,tF).call(this,t);if(!e.length)return void C(tM,this,null);const n=this.getActiveRenderPlacement(t),i=A(oM,this,eF).call(this,e,n);(i!==M(tM,this)||A(oM,this,ZM).call(this,t,n))&&(C(tM,this,i),this.trigger(Im.VISUAL_FRAMES_AVAILABLE,{time:t,frames:e}))}function ZM(t,e){const n=e||this.getActiveRenderPlacement(t);if(!n)return!1;if(!Qp.doesRenderNodeTypeRequireFrameCadence(null==n?void 0:n.type))return!1;const i=n.duration;return"number"==typeof i&&i>0}function tF(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){ZA(c),a.push(t);continue}if("function"==typeof r&&!r(u,n)){const e=tN(u),i="function"==typeof o?o(u):void 0;Number.isFinite(i)&&Number.isFinite(e)&&n>=e+i&&(ZA(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&&JA(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:tN(u),placementSortOffset:eN(u),placementSortId:nN(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=iN(r),a=iN(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:M(ZN,this),time:t,getPlacementById:t=>A(oM,this,nF).call(this,t),isPlacementActiveAtTime:(t,e)=>A(oM,this,aF).call(this,t,e),getPlacementDuration:t=>A(oM,this,CM).call(this,t)})}function eF(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 nF(t){if(t)return(M(CN,this)||[]).find((e=>(null==e?void 0:e.placementId)===t))}function iF(t){if("end"===t){const t=A(oM,this,rF).call(this);if(!Number.isFinite(t))return;const e=A(oM,this,oF).call(this);return Math.max(0,t-Math.min(t,e))}const e=Number(t);return Number.isFinite(e)?e:0}function rF(){let t;return(Array.isArray(M(CN,this))?M(CN,this):[]).forEach((e=>{const n=Ap(e);if(!Number.isFinite(n))return;const i=A(oM,this,CM).call(this,e);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(t)||r>t)&&(t=r)})),t}function oF(){const t=A(oM,this,sF).call(this);return t>0?t:.001}function sF(){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 aF(t,e,n=0){if(!Np(t,e,M(EN,this)))return!1;const i=Number(n);if(!Number.isFinite(i)||i<=0)return!0;const r=A(oM,this,CM).call(this,t);if(!Number.isFinite(r))return!0;const o=Ap(t);return!Number.isFinite(o)||e<o+r-i}var lF=new WeakMap,cF=new WeakMap,uF=new WeakMap,dF=new WeakMap,hF=new WeakMap,fF=new WeakMap,pF=new WeakMap,mF=new WeakMap,vF=new WeakMap,gF=new WeakMap,yF=new WeakMap,bF=new WeakMap,kF=new WeakMap,xF=new WeakMap,wF=new WeakMap,_F=new WeakMap,TF=new WeakMap,IF=new WeakSet;class EF extends Iu{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),O(this,IF),F(this,lF,void 0),F(this,cF,void 0),F(this,uF,1),F(this,dF,1),F(this,hF,1),F(this,fF,""),F(this,pF,0),F(this,mF,[]),F(this,vF,null),F(this,gF,void 0),F(this,yF,[]),F(this,bF,null),F(this,kF,null),F(this,xF,0),F(this,wF,0),F(this,_F,0),F(this,TF,void 0);const[e]=t;C(lF,this,e),C(xF,this,Sg()),C(TF,this,A(IF,this,SF).call(this)),A(IF,this,AF).call(this),A(IF,this,NF).call(this),A(IF,this,PF).call(this),A(IF,this,CF).call(this)}get publicAPI(){return M(TF,this)}calcScore(){A(IF,this,jF).call(this)}onDispose(){M(lF,this)&&M(cF,this)&&"function"==typeof M(lF,this).off&&M(lF,this).off(Im.TIMELINE_PLAYER_STATE,M(cF,this)),C(cF,this,null),A(IF,this,OF).call(this),A(IF,this,RF).call(this),C(lF,this,null),C(yF,this,[]),C(mF,this,[]),C(TF,this,null)}}function SF(){const t=this;return{get score(){return M(uF,t)},get status(){return M(fF,t)},get streamQualityScore(){return M(dF,t)},get fpsScore(){return M(hF,t)},get browserFps(){return M(pF,t)},get waitingSeconds(){return M(wF,t)/1e3},get playingSeconds(){return M(_F,t)/1e3}}}function AF(){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 NF(){M(lF,this)&&"function"==typeof M(lF,this).on&&(C(cF,this,(t=>A(IF,this,MF).call(this,t))),M(lF,this).on(Im.TIMELINE_PLAYER_STATE,M(cF,this)))}function MF(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||A(IF,this,FF).call(this,null):A(IF,this,FF).call(this,"waiting"):A(IF,this,FF).call(this,"playing")}function FF(t){if(t===M(bF,this))return;const e=Sg();M(bF,this)&&Number.isFinite(M(kF,this))&&M(yF,this).push({state:M(bF,this),startMs:M(kF,this),endMs:e}),C(bF,this,t),C(kF,this,t?e:null),A(IF,this,BF).call(this,e)}function CF(){const t=Number(this.settings.calcScoreInterval);!Number.isFinite(t)||t<=0||(C(gF,this,(()=>A(IF,this,jF).call(this))),uk(M(gF,this),1e3*t))}function OF(){M(gF,this)&&dk(M(gF,this)),C(gF,this,null)}function PF(){if("function"!=typeof tk)return;const t=()=>{if(this._disposed)return;const e=Sg();C(pF,this,A(IF,this,DF).call(this,M(mF,this),e)),C(vF,this,tk(t))};C(vF,this,tk(t))}function RF(){M(vF,this)&&"function"==typeof ek&&ek(M(vF,this)),C(vF,this,null)}function DF(t,e){const n=A(IF,this,LF).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 LF(){const t=Number(this.settings.windowSeconds);return!Number.isFinite(t)||t<=0?3e4:1e3*t}function BF(t){const e=t-A(IF,this,LF).call(this);for(;M(yF,this).length&&M(yF,this)[0].endMs<=e;)M(yF,this).shift()}function zF(t){const e=t-A(IF,this,LF).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 M(yF,this).forEach((t=>{r(t.state,t.startMs,t.endMs)})),M(bF,this)&&Number.isFinite(M(kF,this))&&r(M(bF,this),M(kF,this),t),C(wF,this,n),C(_F,this,i),{waitingMs:n,playingMs:i}}function WF(t,e){if(t<=0)return 1;if(t>e)return 0;const n=e||1;return Tp(1-t*this.settings.waitingMultiplier/n)}function $F(){if(Sg()-M(xF,this)<=1e3*this.settings.fpsGracePeriod)return 1;const t=Number(M(pF,this)),e=_m.isDesktop()?this.settings.bestFpsDesktop:this.settings.bestFpsMobile,n=Tp(e>0?t/e:0);return"quad"===this.settings.fpsMathFuncType?n*n:n}function UF(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 jF(){const t=Sg(),{waitingMs:e,playingMs:n}=A(IF,this,zF).call(this,t),i=A(IF,this,WF).call(this,e,n),r=A(IF,this,$F).call(this),o=Tp(i*this.settings.streamQualityWeight+r*this.settings.fpsWeight);o!==M(uF,this)&&(C(uF,this,o),this.trigger(Im.QOE_SCORE,o)),C(dF,this,i),C(hF,this,r);const s=A(IF,this,UF).call(this,o,e);s!==M(fF,this)&&(C(fF,this,s),this.trigger(Im.QOE_STATUS,s))}function qF(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}function VF(t){const e=Number(t);return!Number.isFinite(e)||e<0?0:e}var HF=new WeakMap,GF=new WeakMap,KF=new WeakMap,XF=new WeakMap,YF=new WeakSet;class QF extends Iu{get name(){return"SegmentEvictionCoordinator"}get defaults(){return{enabled:qg("segmentEvictionEnabled"),bufferBehindSeconds:qg("segmentEvictionBufferBehindSeconds"),bufferAheadSeconds:qg("segmentEvictionBufferAheadSeconds"),maxRetainedBytes:qg("segmentEvictionMaxRetainedBytes")}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"evictAtTime"])}constructor(t,e,n={}){super(n),O(this,YF),F(this,HF,void 0),F(this,GF,void 0),F(this,KF,void 0),F(this,XF,void 0),C(HF,this,t),C(GF,this,e),C(KF,this,(t=>A(YF,this,JF).call(this,t))),C(XF,this,(t=>A(YF,this,ZF).call(this,t))),M(HF,this)&&"function"==typeof M(HF,this).on&&(M(HF,this).on(Im.TIMELINE_TIME_UPDATE,M(KF,this)),M(HF,this).on(Im.TIMELINE_SEEKED,M(XF,this)))}onDispose(){M(HF,this)&&"function"==typeof M(HF,this).off&&(M(HF,this).off(Im.TIMELINE_TIME_UPDATE,M(KF,this)),M(HF,this).off(Im.TIMELINE_SEEKED,M(XF,this))),C(HF,this,null),C(GF,this,null),C(KF,this,null),C(XF,this,null)}evictAtTime(t){if(!0!==this.settings.enabled)return;const e=Number(t);if(!Number.isFinite(e))return;const n=VF(this.settings.bufferBehindSeconds),i=VF(this.settings.bufferAheadSeconds),r=e-n,o=e+i,s=A(YF,this,tC).call(this);if(!s.length)return;const a=Number(this.settings.maxRetainedBytes);if(Number.isFinite(a)&&a>0&&A(YF,this,eC).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=Ap(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=A(YF,this,nC).call(this,e);if(!n)return;const i=t.filter((t=>A(YF,this,iC).call(this,t,r,o)));i.length?A(YF,this,rC).call(this,n,i,r,o):"function"==typeof n.evict&&n.evict()}))}}function JF(t){var e,n;if(!0!==this.settings.enabled)return;if((null===(e=M(HF,this))||void 0===e?void 0:e.state)===Pm)return;const i=Number(null==t?void 0:t.time),r=Number.isFinite(i)?i:Number(null===(n=M(HF,this))||void 0===n?void 0:n.currentTime);this.evictAtTime(r)}function ZF(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=M(HF,this))||void 0===e?void 0:e.currentTime);this.evictAtTime(i)}function tC(){var t;const e=null===(t=M(HF,this))||void 0===t?void 0:t.placements;return Array.isArray(e)?e:[]}function eC(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=A(YF,this,nC).call(this,i),o=Number(null==r?void 0:r.retainedByteLength);eg(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=>{eg(null==t?void 0:t.retainedByteLength)&&(n+=t.retainedByteLength)}))}))})),n}function nC(t){if(M(GF,this)&&"function"==typeof M(GF,this).get)return M(GF,this).get(t)}function iC(t,e,n){const i=Ap(t);if(!Number.isFinite(i))return!1;const r=Ep(t,M(GF,this));return(Number.isFinite(r)?i+r:Number.POSITIVE_INFINITY)>e&&i<n}function rC(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=qF(null==t?void 0:t.offset,0);r.forEach((t=>{if(!t||!eg(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=Ap(a);if(!Number.isFinite(l))continue;const c=qF(null==a?void 0:a.nodeOffsetOverride,0),u=qF(null==t?void 0:t.offset,NaN);if(!Number.isFinite(u))continue;const d=qF(null==t?void 0:t.duration,0),h=l+o+u-c,f=h+(d>0?d:0),p=Ep(a,M(GF,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 oC=new WeakMap,sC=new WeakMap,aC=new WeakMap,lC=new WeakSet;let cC=class extends Iu{get name(){return"DocumentVisibility"}get defaults(){return{autoPauseOnVisibilityChange:!0,autoResumeOnVisibilityChange:!0}}constructor(t,e={}){super(e),O(this,lC),F(this,oC,void 0),F(this,sC,null),F(this,aC,!1),C(oC,this,t),A(lC,this,uC).call(this)}onDispose(){A(lC,this,dC).call(this),C(oC,this,null),C(aC,this,!1)}};function uC(){const t=null==Au?void 0:Au.document;t&&"function"==typeof t.addEventListener&&(C(sC,this,(()=>A(lC,this,hC).call(this))),t.addEventListener("visibilitychange",M(sC,this)))}function dC(){const t=null==Au?void 0:Au.document;M(sC,this)&&t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",M(sC,this)),C(sC,this,null)}function hC(){const t=null==Au?void 0:Au.document,e=null==t?void 0:t.visibilityState;"string"==typeof e&&("hidden"!==e?"visible"===e&&A(lC,this,pC).call(this):A(lC,this,fC).call(this))}function fC(){var t;(null===(t=this.settings)||void 0===t?void 0:t.autoPauseOnVisibilityChange)&&M(oC,this)&&"function"==typeof M(oC,this).pause&&(M(oC,this).state===Mm?(this.log.info("[#handleHidden] Pausing timeline due to document visibility change"),M(oC,this).pause(),C(aC,this,!0)):C(aC,this,!1))}function pC(){var t;M(aC,this)&&(null===(t=this.settings)||void 0===t?void 0:t.autoResumeOnVisibilityChange)&&M(oC,this)&&"function"==typeof M(oC,this).play&&(M(oC,this).state!==Mm?(this.log.info("[#handleVisible] Resuming timeline due to document visibility change"),M(oC,this).play(),C(aC,this,!1)):C(aC,this,!1))}const mC=[{event:"canplay",once:!0,trackAs:"canplay"},{event:"playing",once:!0,trackAs:"startedplaying"},"play","playing","waiting","pause","seeking","seeked","nodestart","nodeend"];function vC(t,e=0){return Number.isFinite(t)?t:e}function gC(t){const e=null==t?void 0:t.exposedPlayerAPI;return e&&"object"==typeof e?e:t}const yC=[function(t){return{schema:"iglu:com.helloeko/player/jsonschema/1-0-6",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:vC(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:vC(null==r?void 0:r.volume),playercontainerwidth:vC(null==r?void 0:r.containerWidth),playercontainerheight:vC(null==r?void 0:r.containerHeight)}}}},function(t){return{schema:"iglu:com.helloeko/currentnode/jsonschema/1-0-1",match:/^.*$/,getData:()=>{var e;const n=gC(t),i=function(t){const e=gC(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==Au||null===(t=Au.eko)||void 0===t||null===(t=t.environment)||void 0===t?void 0:t.embeddingApp;return e?{embeddingapp:e}:{}}}}],bC=Object.freeze({once:!1,trackAs:""});var kC=new WeakMap,xC=new WeakMap,wC=new WeakMap,_C=new WeakMap,TC=new WeakSet;class IC extends Iu{get name(){return"Tracker"}get defaults(){return{trackingEnabled:qg("trackingEnabled"),defaultForwarders:mC,defaultContextPackers:yC}}constructor(t,e={}){super(e),O(this,TC),F(this,kC,void 0),F(this,xC,new Map),F(this,wC,[]),F(this,_C,!1),C(kC,this,t),A(TC,this,FC).call(this),A(TC,this,EC).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=A(TC,this,OC).call(this);n&&n("track",t,...e)}registerContextPacker(t){if(!t||"object"!=typeof t)return void this.log.warn("[registerContextPacker] Expected a packer object.");const e={schema:t.schema,match:t.match,getData: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=A(TC,this,OC).call(this);n&&n("registerContextPacker",e)}onDispose(){A(TC,this,MC).call(this),A(TC,this,CC).call(this),C(kC,this,null),C(_C,this,!1)}}function EC(){(Array.isArray(this.settings.defaultForwarders)?this.settings.defaultForwarders:[]).forEach((t=>A(TC,this,SC).call(this,t)))}function SC(t){const e=A(TC,this,AC).call(this,t);if(!e)return void this.log.warn("[#addEventForwarder] Invalid forwarder input.",t);const n=M(kC,this);if(!n||"function"!=typeof n.on)return;const i=A(TC,this,NC).call(this,e);if(M(xC,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),M(xC,this).set(i,{event:e.event,listener:r})}function AC(t){return"string"==typeof t&&t?{event:t,...bC}: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 NC({event:t,once:e,trackAs:n}){return`${t}:${e}:${n}`}function MC(){const t=M(kC,this);t&&"function"==typeof t.off&&M(xC,this).forEach((({event:e,listener:n})=>{t.off(e,n)})),M(xC,this).clear()}function FC(){(Array.isArray(this.settings.defaultContextPackers)?this.settings.defaultContextPackers:[]).forEach((t=>{if("function"!=typeof t)return;const e=t(M(kC,this),this);e&&"object"==typeof e&&("function"==typeof e.dispose&&M(wC,this).push(e.dispose),e.disabled||this.registerContextPacker({schema:e.schema,match:e.match,getData:e.getData}))}))}function CC(){M(wC,this).forEach((t=>{try{t()}catch(t){this.log.warn("[#teardownContextPackers] Failed disposing context packer.",t)}})),C(wC,this,[])}function OC(){const t=null==Au?void 0:Au.EkoAnalytics;return"function"==typeof t?t:(A(TC,this,PC).call(this),null)}function PC(){this.settings.trackingEnabled&&!M(_C,this)&&(this.log.warn("EkoAnalytics not found on window."),C(_C,this,!0))}class RC{#E;#rt;#ot;#st;#at;#lt;#ct;#ut;#dt;#ht;#ft;#pt;#mt;#vt;#gt;#yt;#bt;#kt;#xt;constructor(t,e={},n=null){this.#E=new Mu(t,e),this.#rt=new Bu(this.#E,e),this.#ot=new Hb(e),this.#st=new Qg(e),this.#at=new Sb(this.#st,e),this.#lt=new wb(this.#at,this.#ot,e),this.#ct=new Rb(this.#lt,e),this.#ut=new sM(this.#lt,e),this.#dt=new cC(this.#ut,e),this.#kt=new QF(this.#ut,this.#lt,e),this.#ht=new Ck(this.#lt,this.#ct,this.#ot,this.#ut,e),this.#ft=new yx(this.#lt,this.#ct,this.#ut,e),this.#pt=new AI(e),this.#mt=new ZI(this.#lt,this.#ut,this.#pt,e),this.#gt=new EF(this.#ut,e),this.#xt=new IC(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.#yt=r?r({timeline:this.#ut,canvas:this.#E,containerSize:this.#rt,options:e}):new kv(this.#ut,this.#E,this.#rt,e),this.#vt=o?o({timeline:this.#ut,decodeCoordinator:this.#mt,options:e}):new RS(this.#ut,this.#mt,e),this.#bt=new eS(this.#ut,this.#yt,e)}get canvas(){return this.#E}get containerSize(){return this.#rt}get assetsDeliveryService(){return this.#ot}get downloadSpeed(){return this.#st}get abrSelector(){return this.#at}get nodeRepository(){return this.#lt}get nodePrioritizer(){return this.#ct}get timeline(){return this.#ut}get documentVisibility(){return this.#dt}get nodeResolver(){return this.#ht}get segmentLoadCoordinator(){return this.#ft}get decoderFactory(){return this.#pt}get parsingManager(){return this.#mt}get audioAdapter(){return this.#vt}get audioPlaybackManager(){return this.#vt}get qoe(){return this.#gt}get renderAdapter(){return this.#yt}get renderer(){return this.#yt}get transitionManager(){return this.#bt}get tracker(){return this.#xt}dispose(){[this.#xt,this.#ut,this.#dt,this.#ft,this.#ht,this.#ct,this.#lt,this.#ot,this.#at,this.#st,this.#mt,this.#pt,this.#vt,this.#gt,this.#yt,this.#bt,this.#kt,this.#rt,this.#E].forEach((t=>{t&&"function"==typeof t.dispose&&t.dispose()})),this.#ut=null,this.#dt=null,this.#ft=null,this.#ht=null,this.#ct=null,this.#lt=null,this.#ot=null,this.#at=null,this.#st=null,this.#mt=null,this.#pt=null,this.#vt=null,this.#gt=null,this.#yt=null,this.#bt=null,this.#kt=null,this.#E=null,this.#xt=null}}const DC="main.1154004";var LC={isPlainObject:ku,deepMerge:xu,get:_g,set:Tg,ekoGlobalStore:Ig,download:Wg,isPositiveNumber:eg,clamp01:Tp,root:Au,now:Sg,getFrameDimensions:rN,useragent:Tm,requestAnimationFrame:tk,cancelAnimationFrame:ek,start:uk,stop:dk,isTicking:hk,predicator:function(t,e){const n=e||{};if("function"!=typeof t)return void nk.error("[predicator] Bad argument given to predicator, first argument must be a function.",arguments);if(t.apply())return nk.debug("[predicator] Invoking onFulfilled immediately."),void("function"==typeof n.onFulfilled&&n.onFulfilled.call(null,0));const i=n.timeout||1e4,r=n.interval,o=Sg();let s,a,l,c,u;c=function(){t.apply()&&l()},l=function(){dk(c),Au.clearTimeout(s),u=Sg()-o,nk.debug("[predicator] Invoking onFulfilled after "+u+" ms."),"function"==typeof n.onFulfilled&&n.onFulfilled.call(null,u)},a=function(){dk(c),u=Sg()-o,nk.debug("[predicator] Invoking onTimeout after "+u+" ms."),"function"==typeof n.onTimeout&&n.onTimeout.call(null,u)},s=Au.setTimeout(a,i),uk(c,r)},createThrottler:fk,scheduleExecution:pk},BC=new WeakMap,zC=new WeakMap,WC=new WeakMap,$C=new WeakMap,UC=new WeakMap,jC=new WeakMap,qC=new WeakMap,VC=new WeakSet;class HC{constructor(t){O(this,VC),F(this,BC,[]),F(this,zC,[]),F(this,WC,new _N("placement-")),F(this,$C,new _N("renderplacement-")),F(this,UC,void 0),F(this,jC,new Map),F(this,qC,void 0),C(UC,this,t),C(qC,this,{allowUnready:!0,getNode:t=>A(VC,this,GC).call(this,t)})}get placements(){return M(BC,this).slice()}get renderPlacements(){return M(zC,this).slice()}getNodesAtTime(t){A(VC,this,KC).call(this);const e=A(VC,this,YC).call(this,t);if(!Number.isFinite(e))return[];const n=M(BC,this).filter((t=>Np(t,e,null,M(qC,this)))),i=[];return n.forEach((t=>{const e=A(VC,this,GC).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&&M(jC,this).set(r,i);const o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=Pp(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}:Op(e,n);let u,d,h,f=!1;const p=null!==a;if(a){const t=M(BC,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=Ap(t);if("start"===a.anchor)Number.isFinite(e)?u=e:f=!0;else{const n=A(VC,this,XC).call(this,t);Number.isFinite(e)&&n>0?u=e+n:f=!0}}else if(l){const t=n.offsetAnchorPlacementId?M(BC,this).find((t=>(null==t?void 0:t.placementId)===n.offsetAnchorPlacementId)):M(BC,this).length?M(BC,this)[M(BC,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==t?void 0:t.placementId),d){const e=Ap(t),n=A(VC,this,XC).call(this,t);Number.isFinite(e)&&n>0?u=e+n-c:(f=!0,h="end")}else u=-c}else u=Cp(e);const m=M(WC,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 M(BC,this).push(v),Mp(M(BC,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=Pp(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=M(BC,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=Ap(t);if("start"===c.anchor)Number.isFinite(e)?o=e:l=!0;else{const n=A(VC,this,XC).call(this,t);Number.isFinite(e)&&Number.isFinite(n)?o=e+n:l=!0}}else o=Cp(e);const d=M($C,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;Rp(M(zC,this),t,e,"TimelineDefinition.placeRenderNodeOnTimeline does not allow overlapping render nodes")}return M(zC,this).push(m),Mp(M(zC,this)),d}}function GC(t){if(t)return M(UC,this)&&"function"==typeof M(UC,this).get?M(UC,this).get(t):M(jC,this).get(t)}function KC(){return Fp(M(BC,this),{getPlacementDuration:t=>A(VC,this,XC).call(this,t)}).updated}function XC(t){return Ep(t,null,M(qC,this))}function YC(t){if("end"===t){const t=A(VC,this,QC).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 QC(){let t;return M(BC,this).forEach((e=>{const n=Ap(e);if(!Number.isFinite(n))return;const i=A(VC,this,XC).call(this,e);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(t)||r>t)&&(t=r)})),t}const JC=new Set(["canplay","play","playing","waiting","pause","seeking","seeked"]);var ZC=new WeakMap,tO=new WeakMap,eO=new WeakMap,nO=new WeakMap,iO=new WeakMap,rO=new WeakMap,oO=new WeakMap,sO=new WeakMap,aO=new WeakMap,lO=new WeakMap,cO=new WeakMap,uO=new WeakMap,dO=new WeakMap,hO=new WeakMap,fO=new WeakMap,pO=new WeakMap,mO=new WeakMap,vO=new WeakMap,gO=new WeakMap,yO=new WeakMap,bO=new WeakMap,kO=new WeakMap,xO=new WeakMap,wO=new WeakMap,_O=new WeakMap,TO=new WeakSet;class IO extends Iu{get name(){return"EkoPlayer"}get exposedPlayerAPI(){return M(nO,this)}constructor(t,e={}){const{options:n,publicOptions:i}=function(t={}){const e=xu({},Ug,t);Object.entries($g).forEach((([t,{targetPaths:n}])=>{void 0!==e[t]&&n.forEach((n=>{void 0===_g(e,n)&&Tg(e,n,e[t])}))}));const n=function(t){const e={};return Object.keys($g).forEach((n=>{Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})),Object.freeze(e)}(e);return jg.info("Processed options:",e),jg.info("Public options:",n),{options:e,publicOptions:n}}(e);return super(n),O(this,TO),F(this,ZC,void 0),F(this,tO,void 0),F(this,eO,void 0),F(this,nO,void 0),F(this,iO,void 0),F(this,rO,void 0),F(this,oO,void 0),F(this,sO,void 0),F(this,aO,void 0),F(this,lO,void 0),F(this,cO,void 0),F(this,uO,void 0),F(this,dO,void 0),F(this,hO,void 0),F(this,fO,void 0),F(this,pO,void 0),F(this,mO,void 0),F(this,vO,void 0),F(this,gO,void 0),F(this,yO,void 0),F(this,bO,void 0),F(this,kO,void 0),F(this,xO,void 0),F(this,wO,void 0),F(this,_O,0),C(eO,this,i),this.log.info("Initializing EkoPlayer with options:",i),C(uO,this,new RC(t,n,this)),A(TO,this,RO).call(this,M(uO,this)),C(fO,this,(t=>A(TO,this,EO).call(this,t))),M(tO,this)&&"function"==typeof M(tO,this).on&&M(tO,this).on(Im.TIMELINE_CUEPOINT,M(fO,this)),C(pO,this,null),C(vO,this,(t=>A(TO,this,SO).call(this,t))),C(gO,this,(t=>{const e=t&&"object"==typeof t?t:{};A(TO,this,SO).call(this,{...e,event:"seeking"})})),C(yO,this,(t=>{const e=t&&"object"==typeof t?t:{};A(TO,this,SO).call(this,{...e,event:"seeked"})})),M(tO,this)&&"function"==typeof M(tO,this).on&&(M(tO,this).on(Im.TIMELINE_PLAYER_STATE,M(vO,this)),M(tO,this).on(Im.TIMELINE_SEEKING,M(gO,this)),M(tO,this).on(Im.TIMELINE_SEEKED,M(yO,this))),C(xO,this,(t=>{const e=t&&"object"==typeof t?t:{};this.trigger(Im.CONTAINER_RESIZE,e)})),M(dO,this)&&"function"==typeof M(dO,this).on&&M(dO,this).on(Im.CONTAINER_RESIZE,M(xO,this)),A(TO,this,FO).call(this),A(TO,this,MO).call(this),C(nO,this,A(TO,this,PO).call(this)),M(nO,this)}onDispose(){M(tO,this)&&"function"==typeof M(tO,this).off&&M(fO,this)&&M(tO,this).off(Im.TIMELINE_CUEPOINT,M(fO,this)),C(fO,this,null),M(tO,this)&&"function"==typeof M(tO,this).off&&(M(vO,this)&&M(tO,this).off(Im.TIMELINE_PLAYER_STATE,M(vO,this)),M(gO,this)&&M(tO,this).off(Im.TIMELINE_SEEKING,M(gO,this)),M(yO,this)&&M(tO,this).off(Im.TIMELINE_SEEKED,M(yO,this))),C(vO,this,null),C(gO,this,null),C(yO,this,null),C(pO,this,null),M(dO,this)&&"function"==typeof M(dO,this).off&&M(xO,this)&&M(dO,this).off(Im.CONTAINER_RESIZE,M(xO,this)),C(xO,this,null),M(cO,this)&&"function"==typeof M(cO,this).off&&(M(bO,this)&&M(cO,this).off("qoescore",M(bO,this)),M(kO,this)&&M(cO,this).off("qoestatus",M(kO,this))),C(bO,this,null),C(kO,this,null),M(lO,this)&&"function"==typeof M(lO,this).off&&M(wO,this)&&M(lO,this).off(Im.DECODER_ERROR,M(wO,this)),C(wO,this,null),C(_O,this,0),M(hO,this)&&"function"==typeof M(hO,this).dispose&&M(hO,this).dispose(),C(hO,this,null),M(uO,this)&&"function"==typeof M(uO,this).dispose&&M(uO,this).dispose(),C(tO,this,null),C(ZC,this,null),C(rO,this,null),C(oO,this,null),C(sO,this,null),C(aO,this,null),C(lO,this,null),C(cO,this,null),C(dO,this,null),C(iO,this,null),C(nO,this,null),C(uO,this,null)}}function EO(t={}){var e;this.trigger(Im.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 SO(t={}){const e="string"==typeof(null==t?void 0:t.event)?t.event:"";if(!JC.has(e))return;if("playing"!==e||Number.isFinite(M(mO,this))||(C(mO,this,Sg()),this.log.info(`[#handlePlayerStateEvent] Playback started @ ${(M(mO,this)/1e3).toFixed(3)}s (${Date.now()})`)),M(pO,this)===e)return;C(pO,this,e);const n=Number.isFinite(null==t?void 0:t.time)?t.time:M(tO,this)&&Number.isFinite(M(tO,this).currentTime)?M(tO,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 AO(){return new HC(M(ZC,this))}function NO(t){if(!t||"object"!=typeof t)throw new Error("EkoPlayer.switchTimeline requires a timeline definition");if(!M(tO,this)||"function"!=typeof M(tO,this).applyTimelineDefinition)throw new Error("EkoPlayer.switchTimeline requires an active timeline");M(tO,this).applyTimelineDefinition(t),"function"==typeof M(tO,this).play&&M(tO,this).play()}function MO(){M(cO,this)&&"function"==typeof M(cO,this).on&&(C(bO,this,(t=>{this.trigger(Im.QOE_SCORE,t)})),C(kO,this,(t=>{this.trigger(Im.QOE_STATUS,t)})),M(cO,this).on(Im.QOE_SCORE,M(bO,this)),M(cO,this).on(Im.QOE_STATUS,M(kO,this)))}function FO(){M(lO,this)&&"function"==typeof M(lO,this).on&&(C(wO,this,(t=>{const e=t&&"object"==typeof t?t:{error:t};this.trigger(Im.DECODER_ERROR,e),A(TO,this,CO).call(this,e)})),M(lO,this).on(Im.DECODER_ERROR,M(wO,this)))}function CO(t={}){var e;const n=M(tO,this);if(!n||"number"!=typeof n.currentTime)return;const i=Date.now();if(i<M(_O,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;C(_O,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 OO(t={}){if(M(hO,this))return M(hO,this);const e=t&&"object"==typeof t&&!Array.isArray(t)?{...t}:{},n=M(iO,this)&&M(iO,this).element?M(iO,this).element:null;if(!n)throw new Error("Debug overlay requires an initialized player canvas and mount element.");const i=function({canvasElement:t,containerElement:e}={}){const n=t&&t.parentNode?t.parentNode:null;if(null==e)return n;const i=function(t,e=(null==Au?void 0:Au.document)){if(Nu(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 Nu(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:n,containerElement:e.containerElement});if(!i)throw new Error("Debug overlay requires an initialized player canvas and mount element.");Object.prototype.hasOwnProperty.call(e,"containerElement")&&delete e.containerElement;const r=await Promise.resolve().then((function(){return rR})),o=(null==r?void 0:r.createDebugOverlay)||(null==r?void 0:r.default);if("function"!=typeof o)throw new Error("Debug overlay bundle does not export createDebugOverlay().");return e.publicOptions=M(eO,this),e.playerVersion=DC,C(hO,this,o({mountElement:i,canvasElement:n,timeline:M(tO,this),getNode:t=>M(ZC,this)&&"function"==typeof M(ZC,this).get?M(ZC,this).get(t):void 0,listNodes:()=>M(ZC,this)&&"function"==typeof M(ZC,this).list?M(ZC,this).list():[],downloadSpeed:M(uO,this)?M(uO,this).downloadSpeed:void 0,downloadEvents:bg,qoe:M(cO,this)?M(cO,this).publicAPI:void 0,qoeEvents:this,options:e,playbackStartedAtMs:M(mO,this)})),M(hO,this)}function PO(){const t=this;return{createTimeline:()=>A(TO,t,AO).call(t),switchTimeline:e=>A(TO,t,NO).call(t,e),play:M(tO,this).play,pause:M(tO,this).pause,reset:M(tO,this).reset,placeOnTimeline:M(tO,this).placeOnTimeline,placeRenderNodeOnTimeline:M(tO,this).placeRenderNodeOnTimeline,addNode:M(ZC,this).add,getNode:M(ZC,this).get,listNodes:M(ZC,this).list,getNodesAtTime:e=>M(tO,t).getNodesAtTime(e),dispose:this.dispose,on:t.on,off:t.off,once:t.once,trigger:t.trigger,transitionTo:(e,n)=>M(oO,t).transitionTo(e,n),track:(e,...n)=>{if(M(aO,t)&&"function"==typeof M(aO,t).track)return M(aO,t).track(e,...n)},seekToPlacement:e=>M(tO,t).seekToPlacement(e),get currentTime(){return M(tO,t).currentTime},set currentTime(e){M(tO,t).currentTime=e},get buffered(){return M(tO,t).buffered},get options(){return M(eO,t)},get containerWidth(){return M(dO,t)?M(dO,t).containerWidth:0},get containerHeight(){return M(dO,t)?M(dO,t).containerHeight:0},get playbackRate(){return M(tO,t).playbackRate},set playbackRate(e){M(tO,t).playbackRate=e},get paused(){return!!M(tO,t)&&!0===M(tO,t).paused},get muted(){return!!M(sO,t)&&M(sO,t).muted},set muted(e){M(sO,t)&&(M(sO,t).muted=e)},get volume(){return M(sO,t)?M(sO,t).volume:1},set volume(e){M(sO,t)&&(M(sO,t).volume=e)},get qoe(){return M(cO,t)?M(cO,t).publicAPI:void 0},get utils(){return LC},get version(){return DC},loadDebugOverlay:(...e)=>A(TO,t,OO).call(t,...e)}}function RO(t){t&&(C(iO,this,t.canvas),C(ZC,this,t.nodeRepository),C(tO,this,t.timeline),C(sO,this,t.audioAdapter||t.audioPlaybackManager),C(aO,this,t.tracker),C(lO,this,t.parsingManager),C(cO,this,t.qoe),C(rO,this,t.renderAdapter||t.renderer),C(oO,this,t.transitionManager),C(dO,this,t.containerSize))}class DO{constructor({target:t,props:e}){if(!t)throw new Error("`options.target` is required");Zr(this.#wt,e,!0),this.#wt.v.EkoPlayer=IO;const n=t.hasChildNodes()?Ls:Ds;this.#_t=n(tu,{target:t,props:this.#wt.v})}#_t;#wt=Qr(io({}));destroy(t){if(this.#_t)return function(t,e){const n=Ws.get(t);return n?(Ws.delete(t),n(e)):Promise.resolve()}(this.#_t,t)}get props(){return ps(this.#wt)}}const LO=u("gallery-react");const BO=e.forwardRef(((t,n)=>{const{config:i,debug:r,ssrHtml:o,activeItem:s={index:0,step:0},forceMobile:a,videoAspectRatio:l,onEvent:c=()=>{}}=t,u=e.useRef(null),d=e.useRef({}),h=function(t){return void 0!==t}(i),f=e.useRef(s),p=e.useRef(o);d.current.initEventSent||(c("galleryinit"),d.current.initEventSent=!0);const m=e.useCallback((t=>{d.current.state=t,t.activeItemIndex===f.current.index&&t.activeModuleIndex===f.current.step||c("activeitemchanged",{index:t.activeItemIndex,step:t.activeModuleIndex})}),[]),v=e.useCallback((t=>{d.current.API=t,0===s.index&&0===s.step||t.selectItemAndStep(s.index,s.step),d.current.unsubscribe&&d.current.unsubscribe(),d.current.unsubscribe=t.subscribe(m)}),[]),g=e.useCallback(((t,e)=>{c(t,e)}),[c]);return e.useEffect((()=>(LO.setDataStorage("gallery-react",{config:i}),window.eko=window.eko||{},window.eko.config=i,window.eko.gallery={version:"4.0.4"},()=>{window.eko.config=void 0})),[i]),e.useImperativeHandle(n,(()=>({prev:()=>{var t;null===(t=d.current.API)||void 0===t||t.prev()},next:()=>{var t;null===(t=d.current.API)||void 0===t||t.next()}}))),e.useEffect((()=>{if(null==u||!u.current)return;const t=u.current;return d.current.app=new DO({target:t,props:{config:i,forceMobile:a,videoAspectRatio:l,hideNav:!0,onGalleryReady:v,onEvent:g}}),()=>{var t;null===(t=d.current.app)||void 0===t||t.destroy()}}),[]),e.useEffect((()=>{d.current.app&&(d.current.app.props.config=i)}),[i]),e.useEffect((()=>{d.current.app&&(d.current.app.props.debug=r,d.current.app.props.forceMobile=a,d.current.app.props.videoAspectRatio=l,d.current.app.props.onEvent=g)}),[r,a,l,g]),e.useEffect((()=>{f.current=s,d.current.state&&(d.current.state.activeItemIndex===s.index&&d.current.state.activeModuleIndex===s.step||d.current.API.selectItemAndStep(s.index,s.step))}),[s]),h?e.createElement("div",R({style:{position:"relative",width:"100%",height:"100%"},ref:u},p.current?{dangerouslySetInnerHTML:{__html:p.current}}:{})):t.children}));BO.propTypes={className:Tt.string,config:Tt.object,variantId:Tt.string,onEvent:Tt.func,ssrHtml:Tt.string,videoAspectRatio:Tt.string,debug:Tt.bool,activeItem:Tt.shape({index:Tt.number,step:Tt.number}),forceMobile:Tt.bool,instanceId:Tt.string,children:Tt.node},BO.displayName="EkoGallerySvelte";const zO=n("v2"),WO=n("v1"),$O="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{},UO=$O&&$O.performance,jO=UO&&"function"==typeof UO.now?()=>UO.now():()=>Date.now(),qO=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"}),VO=["ui-monospace,","SFMono-Regular,","Menlo,","Monaco,","Consolas,",'"Liberation Mono",','"Courier New",',"monospace"].join(" "),HO=`11px ${VO}`,GO=`12px ${VO}`;function KO(t){return"number"==typeof t&&Number.isFinite(t)}function XO(t){return KO(t)&&t>0}function YO(t){return KO(t)?Math.min(1,Math.max(0,t)):0}function QO(t,e=3){return KO(t)?t.toFixed(e):String(t)}function JO(t,e){const n=Number(t),i=Number(e);return!Number.isFinite(n)||!Number.isFinite(i)||n<=0||i<=0?"n/a":`${Math.round(n)}x${Math.round(i)}`}var ZO=new WeakMap,tP=new WeakMap,eP=new WeakMap,nP=new WeakMap,iP=new WeakMap,rP=new WeakMap,oP=new WeakMap,sP=new WeakSet;class aP{constructor({width:t=220,height:e=48,windowMs:n=6e4,maxValue:i=60,autoScale:r=!1,formatValue:o}={}){O(this,sP),F(this,ZO,void 0),F(this,tP,void 0),F(this,eP,[]),F(this,nP,void 0),F(this,iP,void 0),F(this,rP,void 0),F(this,oP,void 0);const s=null==$O?void 0:$O.document;if(!s||"function"!=typeof s.createElement)throw new Error("Debug overlay graph requires document.createElement.");C(ZO,this,s.createElement("canvas")),M(ZO,this).width=t,M(ZO,this).height=e,M(ZO,this).style.width=`${t}px`,M(ZO,this).style.height=`${e}px`,M(ZO,this).style.borderRadius="6px",M(ZO,this).style.background="#111",C(tP,this,M(ZO,this).getContext("2d")),C(nP,this,n),C(iP,this,i),C(rP,this,!!r),C(oP,this,"function"==typeof o?o:null)}get element(){return M(ZO,this)}push(t,e){if(M(ZO,this)&&M(tP,this)&&Number.isFinite(t)&&Number.isFinite(e)){for(M(eP,this).push({t:e,v:t});M(eP,this).length&&e-M(eP,this)[0].t>M(nP,this);)M(eP,this).shift();A(sP,this,lP).call(this)}}dispose(){C(eP,this,[]),C(tP,this,null),C(ZO,this,null)}}function lP(){const t=M(tP,this),e=M(ZO,this);if(!t||!e)return;const n=e.width,i=e.height;if(!n||!i)return;if(t.clearRect(0,0,n,i),t.fillStyle="#111",t.fillRect(0,0,n,i),!M(eP,this).length)return;const r=M(eP,this)[0].t;if(!(M(eP,this)[M(eP,this).length-1].t>r))return;const o=M(rP,this)?M(eP,this).reduce(((t,e)=>e.v>t?e.v:t),0):M(iP,this),s=o>0?o:M(iP,this);t.strokeStyle="#0f0",t.lineWidth=2,t.beginPath();for(let e=0;e<M(eP,this).length;e+=1){const o=M(eP,this)[e],a=(o.t-r)/M(nP,this)*n,l=i-(s>0?Math.min(1,Math.max(0,o.v/s)):0)*i;0===e?t.moveTo(a,l):t.lineTo(a,l)}t.stroke();const a=M(eP,this).length?M(eP,this)[M(eP,this).length-1]:null,l=Number.isFinite(null==a?void 0:a.v)?a.v:null;if(null===l)return;const c=M(oP,this)?M(oP,this).call(this,l):l.toFixed(1);if("string"!=typeof c||!c)return;t.font=HO,t.textAlign="right",t.textBaseline="top";const u=t.measureText(c),d=Math.ceil(u.width)+8,h=n-d-2;t.fillStyle="rgba(0,0,0,0.55)",t.fillRect(h,2,d,14),t.fillStyle="#fff",t.fillText(c,n-2-4,4)}const cP=new Intl.NumberFormat("en-US");function uP(t,e){const n=(null==t?void 0:t.trackId)||"",i=(null==e?void 0:e.trackId)||"";if(n!==i)return n<i?-1:1;const r=(null==t?void 0:t.nodeId)||"",o=(null==e?void 0:e.nodeId)||"";if(r!==o)return r<o?-1:1;const s=(null==t?void 0:t.segmentId)||"",a=(null==e?void 0:e.segmentId)||"";return s!==a?s<a?-1:1:("number"==typeof(null==t?void 0:t.presentationTime)?t.presentationTime:0)-("number"==typeof(null==e?void 0:e.presentationTime)?e.presentationTime:0)}function dP(t,e){for(t.push(e);t.length&&e-t[0]>1e3;)t.shift();if(t.length<2)return 0;const n=t[t.length-1]-t[0];return n<=0?0:1e3*(t.length-1)/n}function hP(t,e){if("function"!=typeof t||!e)return;const n=t(e.nodeId),i=null==n?void 0:n.tracks;if(!Array.isArray(i))return;const r=i.find((t=>(null==t?void 0:t.id)===e.trackId)),o=null==r?void 0:r.segments;return Array.isArray(o)?o.find((t=>(null==t?void 0:t.id)===e.segmentId)):void 0}function fP(t,e){var n;const i=hP(t,e);return(null==i?void 0:i.abrDecision)||(null==i||null===(n=i.chosenRepresentation)||void 0===n?void 0:n.abrDecision)}function pP(t){const e=Number(t);return!Number.isFinite(e)||e<=0?"n/a":`${cP.format(Math.round(e))}kbps`}function mP(t){const e=Number(t);return!Number.isFinite(e)||e<=0?"n/a":`${cP.format(Math.round(e/1e3))}kbps`}function vP(t,e=3){const n=Number(t);return Number.isFinite(n)?n.toLocaleString("en-US",{minimumFractionDigits:e,maximumFractionDigits:e}):String(t)}function gP(t,e){var n;if("function"!=typeof t||!e)return;const i=t(e.nodeId),r=null==i||null===(n=i.manifestRef)||void 0===n?void 0:n.encodeProfile;return"string"==typeof r&&r?r:void 0}function yP(t,e){if("function"!=typeof t||!e)return;const n=t(e.nodeId);return!0===(null==n?void 0:n.imageFallbackActive)?"image":void 0}function bP(t,e){const n=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}}}(null==e?void 0:e.frame)||{},i=Number.isFinite(null==e?void 0:e.width)?e.width:n.width,r=Number.isFinite(null==e?void 0:e.height)?e.height:n.height,o=function(t,e,n){return null===(n=hP(t,e))||void 0===n?void 0:n.chosenRepresentation}(t,e);if(!o)return KO(i)&&KO(r)?{width:i,height:r}:null;const s=o.width||o.codedWidth||i,a=o.height||o.codedHeight||r;return{id:o.id,codecs:o.codecs,mime:o.mime,bandwidth:o.bandwidth,width:s,height:a}}function kP(t){const e=Number(t);if(Number.isFinite(e)&&!(e<=0))return e/1e3}function xP(t,e){const n=Number(null==t?void 0:t.bandwidthKbps),i=Number(null==e?void 0:e.bandwidthKbps),r=Number.isFinite(n)&&n>0,o=Number.isFinite(i)&&i>0;if(r&&o&&n!==i)return n-i;if(r!==o)return r?-1:1;const s=(null==t?void 0:t.id)||"",a=(null==e?void 0:e.id)||"";return s===a?0:s<a?-1:1}function wP(t,e,n,i){const r=[];if(Array.isArray(null==i?void 0:i.availableRepresentations)&&i.availableRepresentations.forEach((t=>{const e="string"==typeof(null==t?void 0:t.id)&&t.id?t.id:void 0;if(!e)return;const n=Number(null==t?void 0:t.bandwidthKbps);r.push({id:e,bandwidthKbps:Number.isFinite(n)&&n>0?n:void 0})})),!r.length){const n=hP(t,e);(Array.isArray(null==n?void 0:n.representations)?n.representations:[]).forEach((t=>{const e="string"==typeof(null==t?void 0:t.id)&&t.id?t.id:void 0;e&&r.push({id:e,bandwidthKbps:kP(null==t?void 0:t.bandwidth)})}))}!r.length&&(null==n?void 0:n.id)&&r.push({id:n.id,bandwidthKbps:kP(n.bandwidth)});const o=new Map;return r.forEach((t=>{const e=null==t?void 0:t.id;e&&!o.has(e)&&o.set(e,t)})),Array.from(o.values()).sort(xP)}const _P=1024,TP=1048576,IP=1073741824;function EP(t){return KO(t)?t>=1e3?`${QO(t/1e3,1)} Mbps`:`${QO(t,1)} kbps`:"n/a"}function SP({downloadSpeed:t,downloadEvents:e}={}){const n=$O.document,i="function"==typeof(null==t?void 0:t.getKbps)?t.getKbps():void 0;let r=0;const{metricsRow:o,setInitial:s,setTotal:a}=function(t){const e=t.createElement("div");e.style.display="grid",e.style.gridTemplateColumns="1fr 1fr",e.style.gap="8px",e.style.font=GO;const n=t.createElement("div"),i=t.createElement("div");return e.appendChild(n),e.appendChild(i),{metricsRow:e,setInitial:t=>{n.textContent=`initial=${EP(t)}`},setTotal:t=>{var e;i.textContent="total="+(KO(e=t)?e<_P?`${Math.round(e)} B`:e<TP?`${QO(e/_P,1)} KB`:e<IP?`${QO(e/TP,2)} MB`:`${QO(e/IP,2)} GB`:"n/a")}}}(n),{graphWrap:l,speedGraph:c}=function(t,e){const n=t.createElement("div");n.style.marginTop="10px";const i=t.createElement("div");i.textContent="download speed",i.style.font=HO,i.style.opacity="0.9";const r=KO(e)&&e>0?e:1,o=new aP({autoScale:!0,maxValue:r,formatValue:EP});return n.appendChild(i),n.appendChild(o.element),{graphWrap:n,speedGraph:o}}(n,i);s(i),a(r);const u=t=>{const e=Number(null==t?void 0:t.kbps);Number.isFinite(e)&&c.push(e,null!=$O&&$O.performance&&"function"==typeof $O.performance.now?$O.performance.now():Date.now())},d=t=>{const e=Number(null==t?void 0:t.bytes);Number.isFinite(e)&&(r+=e,a(r))};return t&&"function"==typeof t.on&&t.on("download:speed",u),e&&"function"==typeof e.on&&e.on("download:sample",d),{id:"downloads",title:"Downloads",render:t=>{t.appendChild(o),t.appendChild(l)},dispose:()=>{t&&"function"==typeof t.off&&t.off("download:speed",u),e&&"function"==typeof e.off&&e.off("download:sample",d),c.dispose()}}}function AP(t){return KO(t)?QO(t,3):"n/a"}function NP(){return null!=$O&&$O.performance&&"function"==typeof $O.performance.now?$O.performance.now():Date.now()}const MP=18,FP="rgba(83,170,255,0.9)",CP={pending:"rgba(255,255,255,0.55)",resolving:"rgba(255,200,87,0.9)",ready:"rgba(102,214,141,0.9)",failed:"rgba(255,92,92,0.9)",missing:"rgba(160,160,160,0.9)"};function OP(t,e){if(XO(null==t?void 0:t.nodeDurationOverride))return t.nodeDurationOverride;if("function"!=typeof e)return null;const n=e(null==t?void 0:t.nodeId),i=null==n?void 0:n.duration;return XO(i)?i:null}function PP(t){const e=Number(null==t?void 0:t.duration);return e===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:XO(e)?e:null}function RP(t){return t===Number.POSITIVE_INFINITY}function DP(t){return KO(t)?String(t):""}function LP(t=[],e=[],n){const i=function(t=[],e){return Array.isArray(t)&&t.length?t.map((t=>t?["string"==typeof t.placementId?t.placementId:"","string"==typeof t.nodeId?t.nodeId:"",DP(t.offset),DP(OP(t,e)),!0===t.offsetPending?"1":"0",DP(t.nodeOffsetOverride),DP(t.nodeDurationOverride)].join("|"):"null")).join(";"):""}(t,n);return`${i}::${function(t=[]){return Array.isArray(t)&&t.length?t.map((t=>{if(!t)return"null";const e="string"==typeof t.renderPlacementId?t.renderPlacementId:"",n="string"==typeof t.type?t.type:"",i=DP(t.offset),r=PP(t);return[e,n,i,r===Number.POSITIVE_INFINITY?"inf":DP(r),!0===t.offsetPending?"1":"0"].join("|")})).join(";"):""}(e)}`}function BP(t=[],e){if(!Array.isArray(t)||!t.length)return!1;for(let n=0;n<t.length;n+=1){const i=t[n];if(!i||!0===i.offsetPending)continue;if(XO(i.nodeDurationOverride))continue;if("function"!=typeof e)return!0;const r=e(i.nodeId);if(!XO(null==r?void 0:r.duration))return!0}return!1}function zP(t=[]){return!(!Array.isArray(t)||!t.length)&&t.some((t=>!0===(null==t?void 0:t.offsetPending)))}function WP(t=[],e=[]){return zP(t)||zP(e)}function $P(t,e=[],n){if(!t||!Array.isArray(e)||!e.length)return;const i=t.querySelector('[data-segment-boundary="true"]');e.forEach((e=>{if(!e||!KO(e.startRatio)||!KO(e.endRatio))return;const r=YO(e.startRatio),o=YO(e.endRatio);if(!(o>r))return;const s=$O.document.createElement("div");s.dataset.bufferedSegment="true",s.style.position="absolute",s.style.top="0",s.style.bottom="0",s.style.left=100*r+"%",s.style.width=100*(o-r)+"%",s.style.background=n,s.style.opacity="0.8",s.style.pointerEvents="none",s.style.zIndex="0",i?t.insertBefore(s,i):t.appendChild(s)}))}function UP(t,e){if(!t)return;const n=t.querySelector('[data-active-highlight="true"]');if(!e)return void(n&&n.remove());if(n)return;const i=$O.document.createElement("div");i.dataset.activeHighlight="true",i.style.position="absolute",i.style.top="0",i.style.bottom="0",i.style.left="0",i.style.right="0",i.style.border="1px solid rgba(255,255,255,0.9)",i.style.borderRadius="4px",i.style.pointerEvents="none",i.style.zIndex="1",t.appendChild(i)}function jP({timeline:t,getNode:e}={}){const n=null==$O?void 0:$O.document;if(!n||"function"!=typeof n.createElement)throw new Error("Debug overlay timeline tab requires document.createElement.");const i=n.createElement("div");i.style.display="flex",i.style.flexDirection="column",i.style.gap="8px",i.style.position="relative";const r=n.createElement("div");r.style.position="absolute",r.style.display="none",r.style.pointerEvents="none",r.style.zIndex="2",r.style.padding="4px 6px",r.style.borderRadius="6px",r.style.background="rgba(0,0,0,0.8)",r.style.border="1px solid rgba(255,255,255,0.2)",r.style.color="#fff",r.style.font=HO,r.style.maxWidth="220px",r.style.whiteSpace="nowrap",r.style.overflow="hidden",r.style.textOverflow="ellipsis";const o=n.createElement("div");o.dataset.timelineHoverDetails="true",o.style.position="absolute",o.style.display="none",o.style.pointerEvents="none",o.style.zIndex="3",o.style.padding="6px 8px",o.style.borderRadius="8px",o.style.background="rgba(0,0,0,0.85)",o.style.border="1px solid rgba(255,255,255,0.25)",o.style.color="#fff",o.style.font=HO,o.style.maxWidth="260px",o.style.flexDirection="column",o.style.gap="6px";const s=n.createElement("div");s.style.font=GO,s.style.opacity="0.95";const a=n.createElement("div");a.style.font=HO,a.style.opacity="0.7",a.style.textTransform="uppercase",a.style.marginTop="4px";const l=n.createElement("div");l.style.display="flex",l.style.flexDirection="column",l.style.gap="4px",o.appendChild(s),o.appendChild(a),o.appendChild(l);const c=n.createElement("div");c.style.display="flex",c.style.justifyContent="space-between",c.style.alignItems="center";const u=n.createElement("div");u.style.display="flex",u.style.alignItems="baseline",u.style.gap="10px";const d=n.createElement("div");d.style.font=GO,d.style.opacity="0.9";const h=n.createElement("div");h.style.font=HO,h.style.opacity="0.65",u.appendChild(d),u.appendChild(h);const f=n.createElement("label");f.style.display="inline-flex",f.style.alignItems="center",f.style.gap="6px",f.style.font=HO,f.style.cursor="pointer";const p=n.createElement("input");p.type="checkbox",p.checked=!1;const m=n.createElement("span");m.textContent="Click to seek",f.appendChild(p),f.appendChild(m),c.appendChild(u),c.appendChild(f);const v=n.createElement("div");function g(t,e,{alignTop:i=!1}={}){const r=n.createElement("div");r.style.display="grid",r.style.gridTemplateColumns="64px 1fr",r.style.alignItems=i?"start":"center",r.style.gap="8px";const o=n.createElement("div");o.textContent=t,o.style.font=HO,o.style.opacity="0.8",i&&(o.style.paddingTop="2px");const s=n.createElement("div");s.style.position="relative",s.style.borderRadius="6px",s.style.background="rgba(255,255,255,0.08)",s.style.overflow="hidden",e&&(s.dataset.timelineLane=e);const a=n.createElement("div");return a.style.position="absolute",a.style.top="0",a.style.bottom="0",a.style.width="2px",a.style.background="rgba(255,255,255,0.8)",s.appendChild(a),r.appendChild(o),r.appendChild(s),v.appendChild(r),{track:s,indicator:a}}v.style.display="grid",v.style.gridTemplateRows="auto auto",v.style.gap="8px",i.appendChild(c),i.appendChild(v),i.appendChild(r),i.appendChild(o);const y=g("Nodes","nodes",{alignTop:!0}),b=g("Render","render");let k=[],x=[],w=0,_=!1,T=1;const I=new Map,E=new Map,S=new Map,A=new Map;let N=new Set,M=null,F=!1,C="",O=!1,P=0,R=0,D=null;function L(t){for(;t.childNodes.length>1;)t.removeChild(t.lastChild)}function B(){D&&(clearTimeout(D),D=null)}function z(){return!!O||!!t&&(Array.isArray(t.placements)||Array.isArray(t.renderPlacements))}function W(){if(!t)return!1;const e=Array.isArray(t.placements),n=Array.isArray(t.renderPlacements);if(!e&&!n)return!1;const i=e?t.placements:[],r=n?t.renderPlacements:[];return(i.length!==P||r.length!==R)&&(et(i,r),!0)}function $(){if(!O)return!1;const t=LP(k,x,e);return t!==C&&(C=t,Q(),tt(),!0)}function U(){z()?D=function({shouldSchedule:t,isScheduled:e,intervalMs:n,onTick:i}){return e?null:setTimeout(i,n)}({shouldSchedule:!0,isScheduled:!!D,intervalMs:O?100:250,onTick:()=>{D=null,z()&&(W()||$()||U())}}):B()}function j(t,e){const n=e>0?w/e:0;t.style.left=100*YO(n)+"%",t.style.transform="translateX(-1px)"}function q(){r.style.display="none"}function V(t,e){if(!t)return void q();r.textContent=t,r.style.display="block";const n=i.getBoundingClientRect(),o=r.getBoundingClientRect(),s=((null==e?void 0:e.clientX)||0)-n.left+12,a=((null==e?void 0:e.clientY)||0)-n.top+12,l=n.width-o.width-8,c=n.height-o.height-8,u=Math.max(8,Math.min(s,l)),d=Math.max(8,Math.min(a,c));r.style.left=`${u}px`,r.style.top=`${d}px`}function H(){o.style.display="none"}function G(t,r){const c="function"==typeof e&&t?e(t):null,u=Array.isArray(null==c?void 0:c.children)?c.children:[];if(!u.length)return void H();if(s.textContent=t,a.textContent="children",function(){for(;l.firstChild;)l.removeChild(l.firstChild)}(),u.forEach((t=>{t&&t.nodeId&&l.appendChild(function(t){const i=n.createElement("div");i.style.display="grid",i.style.gridTemplateColumns="10px 1fr auto auto",i.style.alignItems="center",i.style.gap="6px";const r="string"==typeof(null==t?void 0:t.nodeId)?t.nodeId:"",o=XO(null==t?void 0:t.weight)?t.weight:1,s=function(t){if(!t||"function"!=typeof e)return"missing";const n=e(t);if(!n)return"missing";const i="string"==typeof n.state?n.state.trim().toLowerCase():"";return"pending"===i||"resolving"===i||"ready"===i||"failed"===i?i:"pending"}(r);i.dataset.childId=r,i.dataset.childStatus=s;const a=n.createElement("span");a.dataset.statusIndicator=s,a.style.width="8px",a.style.height="8px",a.style.borderRadius="999px",a.style.background=CP[s]||CP.pending,a.style.display="inline-block";const l=n.createElement("span");l.textContent=r||"unknown",l.style.overflow="hidden",l.style.textOverflow="ellipsis",l.style.whiteSpace="nowrap";const c=n.createElement("span");c.textContent=`w=${QO(o,0)}`,c.style.opacity="0.8";const u=n.createElement("span");return u.textContent=s,u.style.opacity="0.75",i.appendChild(a),i.appendChild(l),i.appendChild(c),i.appendChild(u),i}(t))})),!l.childNodes.length)return void H();o.style.display="flex";const d=i.getBoundingClientRect(),h=o.getBoundingClientRect(),f=((null==r?void 0:r.clientX)||0)-d.left+12,p=((null==r?void 0:r.clientY)||0)-d.top+12,m=d.width-h.width-8,v=d.height-h.height-8,g=Math.max(8,Math.min(f,m)),y=Math.max(8,Math.min(p,v));o.style.left=`${g}px`,o.style.top=`${y}px`}function K(){const e=w;if(t&&"function"==typeof t.getPlacementsActiveAtTime){const n=t.getPlacementsActiveAtTime(e),i=new Set(n.map((t=>null==t?void 0:t.placementId)).filter((t=>"string"==typeof t&&t.length)));N.forEach((t=>{i.has(t)||UP(S.get(t),!1)})),i.forEach((t=>{N.has(t)||UP(S.get(t),!0)})),N=i}else y.track.querySelectorAll('[data-timeline-item="nodes"]').forEach((t=>{const n="true"===t.dataset.hasDuration,i=Number(t.dataset.start),r=Number(t.dataset.end);UP(t,n&&KO(e)&&e>=i&&e<r)}));if(t&&"function"==typeof t.getActiveRenderPlacement){const n=t.getActiveRenderPlacement(e),i=null==n?void 0:n.renderPlacementId;M&&M!==i&&UP(A.get(M),!1),i&&M!==i&&UP(A.get(i),!0),M=i||null}else b.track.querySelectorAll('[data-timeline-item="render"]').forEach((t=>{const n="true"===t.dataset.hasDuration,i=Number(t.dataset.start),r=Number(t.dataset.end);UP(t,n&&KO(e)&&e>=i&&e<r)}))}function X(t){const n=OP(t,e);if(!XO(n)||"function"!=typeof e)return{boundaries:[],buffered:[]};const i=e(null==t?void 0:t.nodeId),r=function(t){const e=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];if(!e.length)return null;if(null!=t&&t.mainTrackId){const n=e.find((e=>(null==e?void 0:e.id)===t.mainTrackId));if(n)return n}return e.find((t=>Array.isArray(null==t?void 0:t.segments)&&t.segments.length))||null}(i);if(!r)return{boundaries:[],buffered:[]};const o=t=>{if(!t)return 0;const e=Number(null==t?void 0:t.bufferedRatio);if(Number.isFinite(e))return YO(e);const n=Number(null==t?void 0:t.retainedByteLength);if(!XO(n))return 0;const i=null==t?void 0:t.chosenRepresentation,r=XO(null==i?void 0:i.sizeBytes)?i.sizeBytes:null;return XO(r)?YO(n/r):1},s=Array.isArray(r.segments)?r.segments:[],a=KO(null==r?void 0:r.offset)?r.offset:0,l=KO(null==t?void 0:t.nodeOffsetOverride)?t.nodeOffsetOverride:0;if(!s.length){const t=null==i?void 0:i.buffered,e=KO(null==t?void 0:t.start)?t.start-l:0,r=KO(null==t?void 0:t.end)?t.end-l:0,o=Math.max(0,e),s=Math.min(n,r);return s>o?{boundaries:[],buffered:[{startRatio:o/n,endRatio:s/n}]}:{boundaries:[],buffered:[]}}if("image"===(null==r?void 0:r.type)){const t=s.find((t=>t&&!t.isInit))||s[0],e=t?o(t):0;return e>0?{boundaries:[],buffered:[{startRatio:0,endRatio:YO(e)}]}:{boundaries:[],buffered:[]}}return function(t,e,n,i,r){const o=[],s=[];let a=0;return t.forEach((t=>{if(null!=t&&t.isInit)return;KO(null==t?void 0:t.offset)&&(a=t.offset);const l=a;if(!KO(l))return;const c=KO(null==t?void 0:t.duration)?t.duration:0,u=n+l-i,d=n+(l+c)-i;u>0&&u<e&&o.push(u/e);const h="function"==typeof r?r(t):0;if(c>0&&d>0&&u<e&&h>0){const t=Math.max(0,u),n=Math.min(e,d);if(n>t){const i=t+(n-t)*YO(h);s.push({startRatio:t/e,endRatio:i/e})}}c>0&&(KO(null==t?void 0:t.offset)?a=t.offset+c:a+=c)})),{boundaries:o,buffered:s}}(s,n,a,l,o)}function Y(){const t=Array.isArray(k)?k:[],e=new Map(t.map((t=>[null==t?void 0:t.placementId,t])));for(const[t,n]of S.entries()){if(!t)continue;const i=e.get(t);i&&(n.querySelectorAll('[data-buffered-segment="true"]').forEach((t=>t.remove())),$P(n,X(i).buffered,FP))}}function Q(){const t=new Set(k.map((t=>null==t?void 0:t.nodeId)).filter((t=>"string"==typeof t&&t.length)));t.forEach((t=>{if(E.has(t))return;const n="function"==typeof e?e(t):null;if(!n||"function"!=typeof n.on)return;const i=t=>function(t={}){if(!t||t.isInit)return;const e=null==t?void 0:t.nodeId,n=null==t?void 0:t.segmentId,i=Number(null==t?void 0:t.loaded),r=Number(null==t?void 0:t.total);if(!e||!n||!KO(i))return;const o=`${e}:${n}`,s=I.get(o)||{},a={loaded:Math.max(KO(s.loaded)?s.loaded:0,i),total:XO(r)?r:s.total};I.set(o,a),function(){if(F)return;F=!0;const t=null==$O?void 0:$O.requestAnimationFrame;"function"!=typeof t?((null==$O?void 0:$O.setTimeout)||setTimeout)((()=>{F=!1,Y()}),0):t((()=>{F=!1,Y()}))}()}(t);n.on("segment:chunk",i),E.set(t,{node:n,handler:i})}));for(const[e,n]of E.entries())t.has(e)||(null!=n&&n.node&&"function"==typeof n.node.off&&n.node.off("segment:chunk",n.handler),E.delete(e))}function J({track:t,color:e,start:i,duration:r,startTime:o,durationSeconds:s,segmentRatios:a,bufferedSegments:l,placementId:c,nodeId:u,label:d,rowIndex:h=0,rowHeight:f=18,rowGap:p=0,laneId:m,isClickable:v,isActive:g,tooltip:y,hoverDetailsNodeId:b,showLabel:k,onClick:x}){const w=n.createElement("div");var _,T;T=e,(_=w).style.position="absolute",_.style.borderRadius="4px",_.style.background=T,_.style.opacity="0.9",_.style.font=HO,_.style.color="#fff",_.style.display="flex",_.style.alignItems="center",_.style.whiteSpace="nowrap",_.style.overflow="hidden",_.style.textOverflow="ellipsis",function(t,{startRatio:e,durationRatio:n,rowIndex:i=0,rowHeight:r=18,rowGap:o=0}={}){const s=i*(r+o)+2,a=Math.max(1,r-4);t.style.top=`${s}px`,t.style.height=`${a}px`;const l=YO(e);if(XO(n)){const e=Math.max(0,Math.min(n,1-l));return t.style.left=100*l+"%",t.style.width=100*e+"%",void(t.style.padding="0 4px")}t.style.left=100*l+"%",t.style.width="2px",t.style.padding="0"}(w,{startRatio:i,durationRatio:r,rowIndex:h,rowHeight:f,rowGap:p}),function(t,{laneId:e,label:n,isClickable:i,shouldShowLabel:r,onClick:o}={}){if(e&&(t.dataset.timelineItem=e),r&&n){const e=$O.document.createElement("span");e.textContent=n,e.style.position="relative",e.style.zIndex="2",e.style.pointerEvents="none",t.appendChild(e)}i&&(t.style.cursor="pointer"),"function"==typeof o&&t.addEventListener("click",o)}(w,{laneId:m,label:d,isClickable:v,shouldShowLabel:"boolean"==typeof k?k:XO(r),onClick:x}),y&&(w.title=y),KO(o)&&(w.dataset.start=String(o)),XO(s)||RP(s)?(w.dataset.end=String(o+s),w.dataset.hasDuration="true"):(w.dataset.end="",w.dataset.hasDuration="false"),c&&(w.dataset.placementId=c),u&&(w.dataset.nodeId=u),w.style.pointerEvents="auto",$P(w,l,FP),function(t,e=[]){t&&Array.isArray(e)&&e.length&&e.forEach((e=>{if(!KO(e)||e<=0||e>=1)return;const n=$O.document.createElement("div");n.dataset.segmentBoundary="true",n.style.position="absolute",n.style.top="2px",n.style.bottom="2px",n.style.width="1px",n.style.left=100*YO(e)+"%",n.style.transform="translateX(-0.5px)",n.style.background="rgba(255,255,255,0.35)",n.style.pointerEvents="none",n.style.zIndex="1",t.appendChild(n)}))}(w,a),UP(w,g),y&&(w.addEventListener("mouseenter",(t=>V(y,t))),w.addEventListener("mousemove",(t=>V(y,t))),w.addEventListener("mouseleave",q)),b&&(w.addEventListener("mouseenter",(t=>G(b,t))),w.addEventListener("mousemove",(t=>G(b,t))),w.addEventListener("mouseleave",H)),t.appendChild(w),"nodes"===m&&c?S.set(c,w):"render"===m&&c&&A.set(c,w)}function Z(){let t=0;const n=Array.isArray(k)?k:[],i=Array.isArray(x)?x.filter((t=>!0!==(null==t?void 0:t.offsetPending))):[];return n.forEach((n=>{if(!0===(null==n?void 0:n.offsetPending))return;const i=KO(null==n?void 0:n.offset)?n.offset:void 0;if(!KO(i))return;const r=OP(n,e);t=XO(r)?Math.max(t,i+r):Math.max(t,i)})),i.forEach((e=>{const n=KO(null==e?void 0:e.offset)?e.offset:0,i=PP(e);t=XO(i)?Math.max(t,n+i):Math.max(t,n)})),XO(t)?t:1}function tt(){const n=Z();T=n,d.textContent=`t=${QO(w)}s`,h.textContent=`range=0-${QO(n)}s`,q(),H(),L(y.track),L(b.track),S.clear(),A.clear(),N=new Set,M=null,F=!1;const i=Array.isArray(k)?k:[],r=Array.isArray(x)?x:[],o=function(n){const i=(Array.isArray(n)?n.slice():[]).map((t=>{if(!0===(null==t?void 0:t.offsetPending))return null;const n=KO(null==t?void 0:t.offset)?t.offset:void 0;if(!KO(n))return null;const i=OP(t,e);return{placement:t,offset:n,duration:i,end:XO(i)?n+i:n,rowIndex:0}})).filter(Boolean).sort(((t,e)=>{var n,i,r,o;const s=t.offset-e.offset;if(0!==s)return s;const a="string"==typeof(null===(n=t.placement)||void 0===n?void 0:n.nodeId)?t.placement.nodeId:"",l="string"==typeof(null===(i=e.placement)||void 0===i?void 0:i.nodeId)?e.placement.nodeId:"";if(a!==l)return a.localeCompare(l);const c="string"==typeof(null===(r=t.placement)||void 0===r?void 0:r.placementId)?t.placement.placementId:"",u="string"==typeof(null===(o=e.placement)||void 0===o?void 0:o.placementId)?e.placement.placementId:"";return c.localeCompare(u)})),r=[],o=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);return i.forEach((t=>{const e=t.offset,n=KO(t.end)?t.end:e;let i=-1;for(let t=0;t<r.length;t+=1)if(r[t]<=e+o){i=t;break}-1===i?(i=r.length,r.push(n)):r[i]=Math.max(r[i],n),t.rowIndex=i})),{items:i,rowCount:Math.max(1,r.length)}}(i);var s;!function(t){const e=t.rowCount*MP+4*(t.rowCount-1);y.track.style.height=`${e}px`,b.track.style.height="18px",y.track.style.cursor=_?"pointer":"default",y.track.style.pointerEvents="auto",b.track.style.pointerEvents="auto"}(o),s=n,o.items.forEach((t=>{const e=t.placement,n=t.offset,i=t.duration,r=(null==e?void 0:e.nodeId)||(null==e?void 0:e.placementId)||"node",o=!!KO(w)&&w>=n&&(!XO(i)||w<n+i),a=X(e);J({track:y.track,color:"rgba(255,255,255,0.16)",start:YO(n/s),duration:XO(i)?YO(i/s):null,startTime:n,durationSeconds:i,segmentRatios:a.boundaries,bufferedSegments:a.buffered,placementId:null==e?void 0:e.placementId,nodeId:null==e?void 0:e.nodeId,label:r,rowIndex:t.rowIndex,rowHeight:MP,rowGap:4,laneId:"nodes",isClickable:_,isActive:o,tooltip:(null==e?void 0:e.nodeId)||(null==e?void 0:e.placementId),hoverDetailsNodeId:null==e?void 0:e.nodeId})})),function(t,e){t.forEach((t=>{const n=KO(null==t?void 0:t.offset)?t.offset:void 0;if(!KO(n))return;const i=PP(t),r=RP(i),o=(null==t?void 0:t.type)||(null==t?void 0:t.renderPlacementId)||"render",s=function(t){const e="string"==typeof t?t.trim().toLowerCase():"";return"switch"===e||"switching"===e||"switchingrendernode"===e}(null==t?void 0:t.type),a=s?()=>{"function"==typeof(null==$O?void 0:$O.switchTo)&&$O.switchTo("next")}:void 0;let l=!1;KO(w)&&(r?l=w>=n:XO(i)&&(l=w>=n&&w<n+i));const c=r&&XO(e)?YO((e-n)/e):XO(i)?YO(i/e):null;J({track:b.track,color:"rgba(248,162,62,0.9)",start:YO(n/e),duration:c,startTime:n,durationSeconds:i,label:o,placementId:null==t?void 0:t.renderPlacementId,rowIndex:0,rowHeight:MP,rowGap:0,laneId:"render",isClickable:!!s,isActive:l,tooltip:(null==t?void 0:t.type)||(null==t?void 0:t.renderPlacementId),showLabel:XO(i)||r,onClick:a})}))}(r,n),j(y.indicator,n),j(b.indicator,n),K(),Y(),O=WP(k,x)||BP(k,e),C=O?LP(k,x,e):"",P=Array.isArray(k)?k.length:0,R=Array.isArray(x)?x.length:0,U()}function et(t,n){k=Array.isArray(t)?t.slice():[],x=Array.isArray(n)?n.slice():[],O=WP(k,x)||BP(k,e),Q(),tt()}return p.addEventListener("change",(()=>{_=p.checked,tt()})),y.track.addEventListener("click",(e=>{!function(e,n,i){if(!_||!t)return;if(!XO(n)||!i)return;const r="function"==typeof i.getBoundingClientRect?i.getBoundingClientRect():null,o=XO(null==r?void 0:r.width)?r.width:i.clientWidth;if(!XO(o))return;const s=KO(null==r?void 0:r.left)?r.left:0,a=YO(((KO(null==e?void 0:e.clientX)?e.clientX:0)-s)/o)*n;KO(a)&&(t.currentTime=a)}(e,Z(),y.track)})),{id:"timeline",title:"Timeline",render:t=>{t.appendChild(i),tt()},updatePlacements:et,updateTime:function(t){if(w=KO(t)?t:w,W())return;if(O&&$())return;const e=T;KO(e)&&(d.textContent=`t=${QO(w)}s`,h.textContent=`range=0-${QO(e)}s`,j(y.indicator,e),j(b.indicator,e),K())},refresh:()=>tt(),dispose:()=>{B();for(const t of E.values())(null==t?void 0:t.node)&&"function"==typeof t.node.off&&t.node.off("segment:chunk",t.handler);E.clear(),I.clear()}}}const qP=1024,VP=1048576,HP=1073741824;function GP(t){return KO(t)?t<qP?`${Math.round(t)} B`:t<VP?`${QO(t/qP,1)} KB`:t<HP?`${QO(t/VP,2)} MB`:`${QO(t/HP,2)} GB`:"n/a"}const KP="ekoplayer-debug-overlay";var XP=new WeakMap,YP=new WeakMap,QP=new WeakMap,JP=new WeakMap,ZP=new WeakSet;class tR{constructor({tabBarEl:t,contentEl:e}){O(this,ZP),F(this,XP,[]),F(this,YP,void 0),F(this,QP,void 0),F(this,JP,void 0),C(QP,this,t),C(JP,this,e)}registerTab(t){t&&"string"==typeof t.id&&"string"==typeof t.title&&"function"==typeof t.render&&(M(XP,this).some((e=>e.id===t.id))||(M(XP,this).push(t),A(ZP,this,eR).call(this),M(YP,this)||this.selectTab(t.id)))}selectTab(t){M(XP,this).find((e=>e.id===t))&&(C(YP,this,t),A(ZP,this,eR).call(this),A(ZP,this,nR).call(this))}dispose(){M(QP,this)&&(M(QP,this).innerHTML=""),M(JP,this)&&(M(JP,this).innerHTML=""),C(XP,this,[]),C(QP,this,null),C(JP,this,null)}}function eR(){const t=M(QP,this);t&&(t.innerHTML="",M(XP,this).forEach((e=>{const n=$O.document.createElement("button");n.type="button",n.textContent=e.title,n.style.cursor="pointer",n.style.padding="6px 10px",n.style.borderRadius="6px",n.style.border="1px solid rgba(255,255,255,0.2)",n.style.background=e.id===M(YP,this)?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.2)",n.style.color="#fff",n.style.font=GO,n.addEventListener("click",(()=>this.selectTab(e.id))),t.appendChild(n)})))}function nR(){const t=M(JP,this);if(!t)return;t.innerHTML="";const e=M(XP,this).find((t=>t.id===M(YP,this)));e&&e.render(t)}function iR({mountElement:t,canvasElement:e,timeline:n,getNode:i,listNodes:r,downloadSpeed:o,downloadEvents:s,qoe:a,qoeEvents:l,options:c={},playbackStartedAtMs:u,playerVersion:d}={}){if(!t)throw new Error("Debug overlay requires mountElement.");if(!n||"function"!=typeof n.on)throw new Error("Debug overlay requires a Timeline with .on/.off.");!function(t){if(!t||!t.style)return;const e=null==$O?void 0:$O.window,n=e&&"function"==typeof e.getComputedStyle?e.getComputedStyle(t):null,i=n?n.position:t.style.position;i&&"static"!==i||(t.style.position="relative")}(t);const h=$O.document.getElementById(KP);h&&h.parentNode&&h.parentNode.removeChild(h);const f=function({mountElement:t,playerVersion:e}){const n=null==$O?void 0:$O.document;if(!n||"function"!=typeof n.createElement)throw new Error("Debug overlay requires document.createElement.");const i=n.createElement("div");i.id=KP,i.style.position="absolute",i.style.inset="0",i.style.zIndex="999999",i.style.pointerEvents="none";const r=n.createElement("div");r.style.position="absolute",r.style.top="8px",r.style.left="8px",r.style.width="460px",r.style.maxWidth="calc(100% - 16px)",r.style.background="rgba(0,0,0,0.65)",r.style.border="1px solid rgba(255,255,255,0.18)",r.style.borderRadius="10px",r.style.padding="10px",r.style.color="#fff",r.style.pointerEvents="auto",r.style.backdropFilter="blur(6px)";const o=n.createElement("div");o.style.display="flex",o.style.justifyContent="space-between",o.style.alignItems="center",o.style.gap="10px";const s=n.createElement("div");s.textContent="EkoPlayer Debug",s.style.font="600 13px ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial";const a=n.createElement("button");a.type="button",a.textContent="Hide",a.style.cursor="pointer",a.style.padding="6px 10px",a.style.borderRadius="8px",a.style.border="1px solid rgba(255,255,255,0.2)",a.style.background="rgba(0,0,0,0.2)",a.style.color="#fff",o.appendChild(s),o.appendChild(a);const l=n.createElement("div");l.style.display="flex",l.style.gap="8px",l.style.marginTop="10px";const c=n.createElement("div");c.style.marginTop="10px";const u=n.createElement("div");u.style.marginTop="10px",u.style.font=HO,u.style.display="flex",u.style.justifyContent="space-between",u.style.alignItems="center",u.style.gap="10px";const d=n.createElement("div");d.style.color="rgba(140, 224, 255, 0.9)",d.textContent="Playback started @ --";const h=n.createElement("div");h.style.opacity="0.7",h.style.marginLeft="auto",h.textContent=e?`version ${e}`:"version n/a",u.appendChild(d),u.appendChild(h);const f=n.createElement("button");return f.type="button",f.textContent="Debug",f.style.position="absolute",f.style.top="8px",f.style.left="8px",f.style.cursor="pointer",f.style.padding="6px 10px",f.style.borderRadius="10px",f.style.border="1px solid rgba(255,255,255,0.25)",f.style.background="rgba(0,0,0,0.55)",f.style.color="#fff",f.style.pointerEvents="auto",f.style.display="none",r.appendChild(o),r.appendChild(l),r.appendChild(c),r.appendChild(u),i.appendChild(r),i.appendChild(f),t.appendChild(i),{overlayRoot:i,panel:r,tabBar:l,content:c,hideBtn:a,showBtn:f,footerPlayback:d}}({mountElement:t,playerVersion:d||(null==c?void 0:c.playerVersion)}),p=new tR({tabBarEl:f.tabBar,contentEl:f.content});let m=!0;function v(){m=!1,f.panel.style.display="none",f.showBtn.style.display="inline-block"}function g(){m=!0,f.panel.style.display="block",f.showBtn.style.display="none"}f.hideBtn.addEventListener("click",v),f.showBtn.addEventListener("click",g);const y=jP({timeline:n,getNode:i}),b=function({getNode:t}){const e=$O.document,n=e.createElement("pre");n.style.margin="0",n.style.whiteSpace="pre-wrap",n.style.font=GO,n.style.lineHeight="1.35";const i=e.createElement("div");i.style.display="flex",i.style.flexDirection="column",i.style.gap="8px",i.style.marginTop="6px";const r=e.createElement("div");r.style.display="flex",r.style.gap="10px",r.style.marginTop="10px",r.style.alignItems="center",r.style.flexWrap="wrap";const o=new aP({maxValue:60}),s=new aP({maxValue:60}),a=e.createElement("div"),l=e.createElement("div");l.textContent="browserfps",l.style.font=HO,l.style.opacity="0.9",a.appendChild(l),a.appendChild(o.element);const c=e.createElement("div"),u=e.createElement("div");return u.textContent="fps",u.style.font=l.style.font,u.style.opacity="0.9",c.appendChild(u),c.appendChild(s.element),r.appendChild(a),r.appendChild(c),{id:"frames",title:"Frames",render:t=>{t.appendChild(n),t.appendChild(i),t.appendChild(r)},pushBrowserFps:(t,e)=>o.push(t,e),pushVisualFps:(t,e)=>s.push(t,e),updateInfo:function({time:r,entries:o}){const s=Array.isArray(o)?o.slice().sort(uP):[];if(!s.length)return n.textContent="",void(i.innerHTML="");n.textContent=`t=${vP(r)}s tracks=${s.length}`,i.innerHTML="";for(let n=0;n<s.length;n+=1){const r=s[n],o=bP(t,r),a=(null==o?void 0:o.id)||"n/a",l=(null==o?void 0:o.codecs)||(null==o?void 0:o.mime)||"n/a",c=mP(null==o?void 0:o.bandwidth),u=JO(null==o?void 0:o.width,null==o?void 0:o.height),d=gP(t,r)||"n/a",h=yP(t,r),f=h?` fallback=${h}`:"",p=fP(t,r),m=(null==p?void 0:p.strategy)||"n/a",v=(null==p?void 0:p.decisionReason)||"n/a",g=pP(null==p?void 0:p.measuredDownloadSpeedKbps),y=pP(null==p?void 0:p.safeBandwidthKbps),b=e.createElement("div");b.style.display="flex",b.style.flexDirection="column",b.style.gap="2px";const k=e.createElement("pre");k.style.margin="0",k.style.whiteSpace="pre-wrap",k.style.font=GO,k.style.lineHeight="1.35",k.textContent=[`${(null==r?void 0:r.nodeId)||"?"} ${(null==r?void 0:r.trackId)||"?"} ${(null==r?void 0:r.segmentId)||"?"} pts=${vP(null==r?void 0:r.presentationTime)}s`,`rep=${a} encodeProfile=${d}${f} res=${u} codec=${l} repBW=${c}`,`abr=strategy:${m} reason:${v} measuredBW:${g} safeBW:${y}`].join("\n"),b.appendChild(k);const x=(null==p?void 0:p.selectedRepresentationId)||(null==o?void 0:o.id),w=wP(t,r,o,p);if(w.length){const t=e.createElement("div");t.style.display="flex",t.style.alignItems="center",t.dataset.abrLadderRow="true",t.dataset.trackId=(null==r?void 0:r.trackId)||"",t.dataset.segmentId=(null==r?void 0:r.segmentId)||"";const n=e.createElement("div");n.style.display="inline-flex",n.style.alignItems="center",n.style.gap="2px",n.dataset.abrLadder="true",w.forEach((t=>{const i=e.createElement("span"),r=!!x&&t.id===x;i.dataset.abrLadderBlock="true",i.dataset.repId=t.id||"",i.dataset.selected=r?"true":"false",i.style.display="inline-block",i.style.width="10px",i.style.height="8px",i.style.borderRadius="2px",i.style.border="1px solid rgba(255,255,255,0.35)",i.style.background=r?"rgba(74, 222, 128, 0.95)":"rgba(156, 163, 175, 0.55)",i.title=`${t.id||"?"} ${pP(t.bandwidthKbps)}`,n.appendChild(i)})),t.appendChild(n),b.appendChild(t)}i.appendChild(b)}},dispose:()=>{o.dispose(),s.dispose()}}}({getNode:i}),k=SP({downloadSpeed:o,downloadEvents:s}),x=function({qoe:t,qoeEvents:e}={}){const n=null==$O?void 0:$O.document;if(!n||"function"!=typeof n.createElement)throw new Error("Debug overlay QoE tab requires document.createElement.");const i=n.createElement("pre");i.style.margin="0",i.style.whiteSpace="pre-wrap",i.style.font=GO;const{graphWrap:r,graph:o}=function(t){const e=t.createElement("div");e.style.marginTop="10px";const n=t.createElement("div");n.textContent="qoe score",n.style.font=HO,n.style.opacity="0.9";const i=new aP({maxValue:1,windowMs:3e4,formatValue:t=>AP(t)});return e.appendChild(n),e.appendChild(i.element),{graphWrap:e,graph:i}}(n);let s=null;const a=()=>{i.textContent=function(t){if(!t)return"QoE unavailable";const e="string"==typeof t.status?t.status:"n/a";return[`score=${AP(t.score)}`,`status=${e}`,`streamQualityScore=${AP(t.streamQualityScore)}`,`fpsScore=${AP(t.fpsScore)}`,`browserFps=${AP(t.browserFps)}`,`waitingSeconds=${AP(t.waitingSeconds)}`,`playingSeconds=${AP(t.playingSeconds)}`].join("\n")}(t)},l=()=>{if(!t)return;const e=Number(t.score);Number.isFinite(e)&&o.push(e,NP())},c=t=>{const e=Number(t);Number.isFinite(e)&&o.push(e,NP()),a()},u=()=>{a()};if(a(),l(),e&&"function"==typeof e.on&&(e.on("qoescore",c),e.on("qoestatus",u)),t){const t="function"==typeof(null==$O?void 0:$O.setInterval)?$O.setInterval:setInterval;s=t((()=>{l(),a()}),1e3)}return{id:"qoe",title:"QoE",render:t=>{t.appendChild(i),t.appendChild(r)},dispose:()=>{e&&"function"==typeof e.off&&(e.off("qoescore",c),e.off("qoestatus",u)),s&&(("function"==typeof(null==$O?void 0:$O.clearInterval)?$O.clearInterval:clearInterval)(s),s=null),o.dispose()}}}({qoe:a,qoeEvents:l}),w=function({timeline:t,getNode:e,listNodes:n,options:i}={}){const r=null==$O?void 0:$O.document;if(!r||"function"!=typeof r.createElement)throw new Error("Debug overlay Memory tab requires document.createElement.");const o=r.createElement("pre");o.style.margin="0",o.style.whiteSpace="pre-wrap",o.style.font=GO;const s=r.createElement("div");s.textContent="nodes",s.style.marginTop="10px",s.style.font=HO,s.style.opacity="0.9";const a=r.createElement("pre");a.style.margin="6px 0 0 0",a.style.whiteSpace="pre-wrap",a.style.font=GO;let l=null;const c=()=>{const r=function({timeline:t,getNode:e,listNodes:n}){const i=[];let r=0;if("function"==typeof n){let t;try{t=n()}catch(e){t=null}if(Array.isArray(t))return t.forEach((t=>{const e=null==t?void 0:t.id;if("string"!=typeof e||!e.length)return;const n=Number(null==t?void 0:t.retainedByteLength);Number.isFinite(n)&&(r+=n,i.push({nodeId:e,bytes:n}))})),i.sort(((t,e)=>e.bytes-t.bytes)),{totalBytes:r,nodes:i,available:!0}}if(!t||"function"!=typeof e)return{totalBytes:0,nodes:[],available:!1};const o=Array.isArray(t.placements)?t.placements:[];return new Set(o.map((t=>null==t?void 0:t.nodeId)).filter((t=>"string"==typeof t&&t.length))).forEach((t=>{const n=e(t),o=Number(null==n?void 0:n.retainedByteLength);Number.isFinite(o)&&(r+=o,i.push({nodeId:t,bytes:o}))})),i.sort(((t,e)=>e.bytes-t.bytes)),{totalBytes:r,nodes:i,available:!0}}({timeline:t,getNode:e,listNodes:n}),s=function({timeline:t}){if(!t||"function"!=typeof t.getDecodedFrameStats)return{totalBytes:0,frames:0,available:!1};try{const e=t.getDecodedFrameStats(),n=Number(null==e?void 0:e.totalBytes),i=Number(null==e?void 0:e.frames);return{totalBytes:Number.isFinite(n)?n:0,frames:Number.isFinite(i)?i:0,available:!1!==(null==e?void 0:e.available)}}catch(t){return{totalBytes:0,frames:0,available:!1}}}({timeline:t}),l=function(t,e,n,i){const r=Number(null!==(n=null==t||null===(i=t.publicOptions)||void 0===i?void 0:i.segmentEvictionMaxRetainedBytes)&&void 0!==n?n:null==t?void 0:t.segmentEvictionMaxRetainedBytes),o=KO(r)&&r>=0,s=o?GP(r):"n/a";return{active:o&&KO(e)&&e>r,thresholdLabel:s}}(i,r.available?r.totalBytes:NaN),c=l.active?"on":"off",u=s.available?GP(s.totalBytes):"n/a",d=s.available?s.frames:"n/a";if(!r.available)return o.textContent=[`decoded=${u} decodedFrames=${d}`,`retained=n/a eviction=${c} threshold=${l.thresholdLabel}`].join("\n"),void(a.textContent="");if(o.textContent=[`decoded=${u} decodedFrames=${d}`,[`retained=${GP(r.totalBytes)}`,`nodes=${r.nodes.length}`,`eviction=${c}`,`threshold=${l.thresholdLabel}`].join(" ")].join("\n"),!r.nodes.length)return void(a.textContent="none");const h=r.nodes.slice(0,8).map((t=>`${t.nodeId}: ${GP(t.bytes)}`));a.textContent=h.join("\n")};c();const u="function"==typeof(null==$O?void 0:$O.setInterval)?$O.setInterval:setInterval;return l=u(c,1e3),{id:"memory",title:"Memory",render:t=>{t.appendChild(o),t.appendChild(s),t.appendChild(a)},refresh:c,dispose:()=>{l&&(("function"==typeof(null==$O?void 0:$O.clearInterval)?$O.clearInterval:clearInterval)(l),l=null)}}}({timeline:n,getNode:i,listNodes:r,options:c});p.registerTab(y),p.registerTab(b),p.registerTab(k),p.registerTab(x),p.registerTab(w),p.registerTab(function({options:t}={}){const e=null==$O?void 0:$O.document;if(!e||"function"!=typeof e.createElement)throw new Error("Debug overlay options tab requires document.createElement.");const n=e.createElement("pre");n.style.margin="0",n.style.font=GO,n.style.whiteSpace="pre-wrap",n.style.wordBreak="break-word";const i=null==t?void 0:t.publicOptions,r=i&&"object"==typeof i?Object.keys(i):[];if(r.length){const t=r.map((t=>`${t}=${function(t){if(null===t)return"null";if(void 0===t)return"undefined";const e=typeof t;if("string"===e)return t;if("number"===e||"boolean"===e)return String(t);try{return JSON.stringify(t)}catch(e){return String(t)}}(i[t])}`));n.textContent=t.join("\n")}else n.textContent="publicOptions unavailable";return{id:"options",title:"Options",render:t=>{t.appendChild(n)}}}({options:c}));const _=[],T=[];let I=0,E=0,S=null,A=!1,N=0,M=null;function F(t){const e=Number(t);Number.isFinite(e)&&(e-N<250||(N=e,b.pushBrowserFps(I,e),b.pushVisualFps(E,e)))}$O.window&&"function"==typeof $O.window.requestAnimationFrame&&(S=$O.window.requestAnimationFrame((function t(e){A||(I=dP(_,e),F(e),S=$O.window.requestAnimationFrame(t))})));const C=(t={})=>{if(A||!m)return;const e=Array.isArray(t.frames)?t.frames:[];if(!e.length)return void(M=null);const n=null!=$O&&$O.performance&&"function"==typeof $O.performance.now?$O.performance.now():Date.now(),i=e.map((t=>`${null==t?void 0:t.nodeId}:${null==t?void 0:t.trackId}:${null==t?void 0:t.segmentId}@${null==t?void 0:t.presentationTime}`)).join("|");i!==M&&(E=dP(T,n),M=i),b.updateInfo({time:t.time,entries:e}),F(n)};let O=Number.isFinite(u)?u:void 0;if(Number.isFinite(O)&&f.footerPlayback){const t=O/1e3;f.footerPlayback.textContent=`Playback started @ ${QO(t)}s`}const P=(t={})=>{if(!A&&void 0===O&&"playing"===(null==t?void 0:t.event)&&(O=jO(),f.footerPlayback)){const t=O/1e3;f.footerPlayback.textContent=`Playback started @ ${QO(t)}s`}},R=()=>{const t=Array.isArray(null==n?void 0:n.placements)?n.placements:[],e=Array.isArray(null==n?void 0:n.renderPlacements)?n.renderPlacements:[];y.updatePlacements(t,e)},D=(t={})=>{if(A)return;const e=Number.isFinite(null==t?void 0:t.time)?t.time:null==n?void 0:n.currentTime;y.updateTime(e),w&&"function"==typeof w.refresh&&w.refresh()},L=()=>{A||R()},B=()=>{A||R()},z=null==n?void 0:n.trackBuffers,W=()=>{A||("function"==typeof y.refresh?y.refresh():R(),w&&"function"==typeof w.refresh&&w.refresh())};return n.on(qO.VISUAL_FRAMES_AVAILABLE,C),n.on(qO.TIMELINE_TIME_UPDATE,D),n.on(qO.PLACEMENT_ADDED,L),n.on(qO.RENDER_PLACEMENT_ADDED,B),n.on(qO.TIMELINE_PLAYER_STATE,P),z&&"function"==typeof z.on&&z.on("track:bufferupdate",W),R(),y.updateTime(null==n?void 0:n.currentTime),{show:g,hide:v,dispose:function(){A||(A=!0,S&&$O.window&&"function"==typeof $O.window.cancelAnimationFrame&&$O.window.cancelAnimationFrame(S),S=null,n&&"function"==typeof n.off&&(n.off(qO.VISUAL_FRAMES_AVAILABLE,C),n.off(qO.TIMELINE_TIME_UPDATE,D),n.off(qO.PLACEMENT_ADDED,L),n.off(qO.RENDER_PLACEMENT_ADDED,B),n.off(qO.TIMELINE_PLAYER_STATE,P)),z&&"function"==typeof z.off&&z.off("track:bufferupdate",W),b&&"function"==typeof b.dispose&&b.dispose(),y&&"function"==typeof y.dispose&&y.dispose(),k&&"function"==typeof k.dispose&&k.dispose(),x&&"function"==typeof x.dispose&&x.dispose(),w&&"function"==typeof w.dispose&&w.dispose(),p.dispose(),f.overlayRoot&&f.overlayRoot.parentNode&&f.overlayRoot.parentNode.removeChild(f.overlayRoot))},registerTab:function(t){p.registerTab(t)},selectTab:function(t){p.selectTab(t)}}}var rR=Object.freeze({__proto__:null,createDebugOverlay:iR,default:iR});exports.EkoGallery=BO,exports.EkoGalleryLegacy=nn,exports.ekoWebPixel=S,exports.getEkoAnalyticsSnippet=function(t){return`if (!window.EkoAnalytics) {\n !function () {\n var t, a, e, s, n;\n 'undefined' == typeof window || window.EkoAnalytics || (t = window, a = 'EkoAnalytics', e = document, s = 'script', t[a] || (t[a] = function () {\n t[a].f ? (t[a].q.push(arguments), t[a].ts.push(Date.now())) : t[a].apply(t, arguments);\n }, t[a].f = !0, t[a].q = t[a].q || [], t[a].ts = t[a].ts || [], t[a].t = Number(new Date), t[a].sa = [], t[a].cb = [], t[a].init = function (ids) {\n t[a].id = ids;\n }, t[a].childRequestIdsCallback = function (e) {\n e.data && 'ea-ids-request' === e.data.type && t[a].sa.push(e.source);\n }, t.addEventListener('message', t[a].childRequestIdsCallback)));\n }();\n\n window.EkoAnalytics.cb.push(() => {\n let setCookie = (key, value, additionalProperties = '') => {\n let hostname = window.location.hostname;\n let domain = hostname;\n \n let parts = hostname.split('.');\n if (parts.length > 2) {\n domain = parts.slice(-2).join('.');\n }\n\n // "samesite=lax" is needed for cross-site situations (like NZXT getting checkout url attributes from lambda).\n window.document.cookie = \`\${key}=\${value}; domain=.\${domain}; path=/; secure; samesite=lax; \${additionalProperties}\`;\n };\n\n setCookie('easid', encodeURIComponent(window.EkoAnalytics('getSid')));\n setCookie('eauid', encodeURIComponent(window.EkoAnalytics('getUid')), 'max-age=2147483647');\n });\n\n window.EkoAnalytics('configure', {\n snowplow: {\n options: {\n appId: 'ekoGalleryReact',\n },\n },\n ekoEnv: '${t?"production":"development"}',\n env: 'website',\n });\n window.EkoAnalytics('track', 'PageView');\n }`},exports.getEkoProductConfigUrl=zO,exports.getEkoProductConfigUrlLegacy=WO;
|
|
14
|
+
*/var ut=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]))lt.call(n,s)&&(r[s]=n[s]);if(at){i=at(n);for(var a=0;a<i.length;a++)ct.call(n,i[a])&&(r[i[a]]=n[i[a]])}}return r},dt="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",ht=Function.call.bind(Object.prototype.hasOwnProperty),ft=function(){};if("production"!==process.env.NODE_ENV){var pt=dt,mt={},vt=ht;ft=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(t){}}}function gt(t,e,n,i,r){if("production"!==process.env.NODE_ENV)for(var o in t)if(vt(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,pt)}catch(t){s=t}if(!s||s instanceof Error||ft((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 mt)){mt[s.message]=!0;var l=r?r():"";ft("Failed "+n+" type: "+s.message+(null!=l?l:""))}}}gt.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(mt={})};var yt=gt,bt=function(){};function kt(){return null}"production"!==process.env.NODE_ENV&&(bt=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(t){}});var xt=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(kt),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+"]",dt);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 st.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(ht(s,c)){var u=t(s,c,i,r,o+"."+c,dt);if(u instanceof Error)return u}return null}))},oneOf:function(t){if(!Array.isArray(t))return"production"!==process.env.NODE_ENV&&bt(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."),kt;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&&bt("Invalid argument supplied to oneOfType, expected an instance of array."),kt;for(var e=0;e<t.length;e++){var n=t[e];if("function"!=typeof n)return bt("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+p(n)+" at index "+e+"."),kt}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,dt);if(null==c)return null;c.data&&ht(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,dt);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=ut({},e[n],t);for(var d in c){var p=t[d];if(ht(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,dt);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!==dt){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&&(bt("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=yt,o.resetWarningCache=yt.resetWarningCache,o.PropTypes=o,o};function wt(){}function _t(){}_t.resetWarningCache=wt;var Tt=D((function(t){if("production"!==process.env.NODE_ENV){var e=st;t.exports=xt(e.isElement,!0)}else t.exports=function(){function t(t,e,n,i,r,o){if(o!==dt){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:_t,resetWarningCache:wt};return n.PropTypes=n,n}()}));const It=/https?:\/\/(.*?\.)?eko.com/,Et={"eko.project.interaction":"interaction","eko.project.swipe":"swipe"};let St=null,At=null,Nt=[];function Mt(t){return e=>{var n;if(!It.test(e.origin)||"eko.embedapi"!==(null===(n=e.data)||void 0===n?void 0:n.source))return;const i=e.data,r=Et[i.type];r&&(t?t(r,i.data):Nt.push({type:r,data:i.data}))}}"undefined"!=typeof window&&(At=Mt(null),window.addEventListener("message",At));var Ft={subscribe:function(t){"function"==typeof t?St?console.warn("[eko-gallery-react] Ignoring events subscribe since already subscribed"):(St=t,At=Mt(t),window.addEventListener("message",At),function(t){Nt.forEach((e=>{t(e.type,e.data)})),Nt=[]}(t)):console.warn("[eko-gallery-react] Ignoring events subscribe since a callback function was not provided as argument")},unsubscribe:function(){At?(window.removeEventListener("message",At),At=null,St=null,Nt=[]):console.warn("[eko-gallery-react] Ignoring events unsubscribe since not subscribed")},send:function(t,e){St?St(t,e):Nt.push({type:t,data:e})}};const Ct=({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){S.track("gallery.interaction",{elementid:`thumbnail-${t}`,interactiontype:"click"}),Ft.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})`}}))))};Ct.propTypes={index:Tt.number,activeIndex:Tt.number,setActiveIndex:Tt.func.isRequired,item:Tt.object.isRequired,src:Tt.string,navItemRefs:Tt.object.isRequired,itemIcon:Tt.string};const Ot=({layout:t,nav:n,isVerticalNav:i,showPrevArrow:r,showNextArrow:o})=>{var s,a,l,c,u;const d=e.useRef(null),h=e.useRef(null),f="arrows"===(null==t||null===(s=t.mobile)||void 0===s||null===(s=s.config)||void 0===s||null===(s=s.navPagination)||void 0===s?void 0:s.type)?"eko-mobile-arrows":"",p="arrows"===(null!==(a=null==t||null===(l=t.desktop)||void 0===l||null===(l=l.config)||void 0===l||null===(l=l.navPagination)||void 0===l?void 0:l.type)&&void 0!==a?a:"arrows")?"eko-desktop-arrows":"",m=f||p,v=i?null==n||null===(c=n.current)||void 0===c?void 0:c.scrollHeight:null==n||null===(u=n.current)||void 0===u?void 0:u.scrollWidth;function g(t){const e=i?n.current.clientHeight:n.current.clientWidth,r=function(t,e){const n=i?e.scrollTop:e.scrollLeft;return Math.max(-n,Math.min(v-t-n,t))}("next"===t?e:-e,n.current);return{top:i?r:0,left:i?0:r,behavior:"smooth"}}function y(t){var e,i,r;const o=g(t),s="next"===t?null==h||null===(e=h.current)||void 0===e?void 0:e.id:null==d||null===(i=d.current)||void 0===i?void 0:i.id;var a,l;window.EkoAnalytics("track","gallery.interaction",{elementid:s,interactiontype:"click"}),null==n||null===(r=n.current)||void 0===r||r.scrollBy(o),a=s,l="click",S.track("gallery.interaction",{elementId:a,interactiontype:l}),Ft.send("interaction",{elementId:a,interactiontype:l})}return e.createElement(e.Fragment,null,m&&e.createElement(e.Fragment,null,e.createElement("button",R({type:"button","aria-label":"Go to previous item","aria-hidden":r?"false":"true",onClick:()=>y("prev"),ref:d,id:"eko-nav-prev-arrow",className:`eko-nav-arrow eko-prev-nav-button ${f} ${p} ${r?"":"eko-hidden-nav-button"}`},r?{}:{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",R({type:"button","aria-label":"Go to next item","aria-hidden":o?"false":"true",onClick:()=>y("next"),ref:h,className:`eko-nav-arrow eko-next-nav-button ${f} ${p} ${o?"":"eko-hidden-nav-button"}`,id:"eko-nav-next-arrow"},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:"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 Pt(t,e,n){let i;return function(){const n=this,r=arguments;clearTimeout(i),i=setTimeout((function(){i=null,t.apply(n,r)}),e)}}Ot.propTypes={layout:Tt.object.isRequired,nav:Tt.object.isRequired,isVerticalNav:Tt.bool.isRequired,showPrevArrow:Tt.bool.isRequired,showNextArrow:Tt.bool.isRequired};const Rt=({items:t,setActiveIndex:n,activeIndex:i,layout:r,carouselMounted:o,forceMobile:s})=>{const l=e.useRef(null),c=e.useRef(null),u=e.useRef([]),d=3,[h,f]=e.useState(null),[p,m]=e.useState(!1),[v,g]=e.useState(0),[y,b]=e.useState(!1),[k,x]=e.useState(!1);function w(){var t;const e=s||window.innerWidth<768?"mobile":"desktop",n=(null==r||null===(t=r[e])||void 0===t||null===(t=t.config)||void 0===t?void 0:t.orientation)||("desktop"===e?"left":"bottom");m("left"===n||"right"===n);const i=c.current.parentNode,a=o?".eko-smart-gallery-container iframe":".eko-carousel",l=i.querySelector(a);setTimeout((()=>{g(l.clientHeight)}),0)}function _(){var t,e;const n=s||a()?"mobile":"desktop",i=null!==(t=null==r||null===(e=r[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:d;!function(t=d){var e,n;const i=l.current;if(!i)return;const o="none"!==(null==r||null===(e=r.desktop)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.navPagination)||void 0===e?void 0:e.type),c=(u=null==r||null===(n=r.mobile)||void 0===n||null===(n=n.config)||void 0===n||null===(n=n.navPagination)||void 0===n?void 0:n.type,"mask"===u||"arrows"===u);var u;if((s||a())&&!c)return void i.style.setProperty("-webkit-mask","none");if(!a()&&!o)return void i.style.setProperty("-webkit-mask","none");const h=i.scrollHeight-i.clientHeight,f=i.scrollTop>t?"85%":"100%",m=i.scrollTop<=h-t?"15%":"0%",v=i.scrollWidth-i.clientWidth,g=i.scrollLeft>t?"15%":"0%",y=i.scrollLeft<=v-t?"85%":"100%";p?i.style.setProperty("-webkit-mask",`linear-gradient(0deg,#0000,#000 ${m} ${f},#0000)`):i.style.setProperty("-webkit-mask",`linear-gradient(90deg,#0000,#000 ${g} ${y},#0000)`)}(i),function(t=d){var e,n,i,r,o,s;const a=p?null==l||null===(e=l.current)||void 0===e?void 0:e.scrollTop:null==l||null===(n=l.current)||void 0===n?void 0:n.scrollLeft,c=p?null==l||null===(i=l.current)||void 0===i?void 0:i.clientHeight:null==l||null===(r=l.current)||void 0===r?void 0:r.clientWidth,u=p?null==l||null===(o=l.current)||void 0===o?void 0:o.scrollHeight:null==l||null===(s=l.current)||void 0===s?void 0:s.scrollWidth;u-t<c?(b(!1),x(!1)):a<=t?(b(!1),x(!0)):a+c>u-t?(b(!0),x(!1)):a+t>0&&a<u-t&&(b(!0),x(!0))}(i)}u.current=null==t?void 0:t.map(((t,n)=>{var i,r;return null!==(i=null==u||null===(r=u.current)||void 0===r?void 0:r[n])&&void 0!==i?i:e.createRef()}));const T=Pt((t=>{var e;e=t,S.track("gallery.interaction",{elementid:"nav",interactiontype:e}),Ft.send("interaction",{elementid:"nav",interactiontype:e})}),200);const I=e.useCallback((t=>{n({index:t,step:0,source:"nav"})}),[]);return e.useEffect((()=>{var t;f(null===(t=u.current)||void 0===t?void 0:t[i])}),[i]),e.useEffect((()=>{if(null!=h&&h.current&&null!=l&&l.current){const t=h.current,e=l.current.clientWidth/2,n=t.clientWidth/2,i=l.current.clientHeight/2,r=t.clientHeight/2;l.current.scrollTo({left:t.offsetLeft-e+n,top:t.offsetTop-i+r,behavior:"smooth"})}}),[h]),e.useEffect((()=>{w()}),[]),e.useEffect((()=>(window.addEventListener("resize",w),()=>{window.removeEventListener("resize",w)})),[c,o,s]),e.useEffect((()=>{g(0),w()}),[t,c,o,s]),e.useEffect((()=>{_();const t=new ResizeObserver(_);return t.observe(l.current),()=>{t.disconnect()}}),[t,s,p]),e.createElement("div",{className:"eko-nav-container",ref:c,style:{opacity:v>0?1:0,height:""+(v&&p?v+"px":"auto")}},e.createElement(Ot,{layout:r,nav:l,isVerticalNav:p,showPrevArrow:y,showNextArrow:k}),e.createElement("ul",{className:`eko-nav eko-mobile-nav-selected-${null!==(E=null==r||null===(A=r.mobile)||void 0===A||null===(A=A.config)||void 0===A?void 0:A.navItemsSelectedType)&&void 0!==E?E:"underline"} eko-desktop-nav-selected-${null!==(N=null==r||null===(M=r.desktop)||void 0===M||null===(M=M.config)||void 0===M?void 0:M.navItemsSelectedType)&&void 0!==N?N:"underline"}`,ref:l,onScroll:function(){_()},onWheel:function(){T("wheel")},onTouchMove:function(){T("swipe")}},null==t?void 0:t.map(((t,n)=>{var r;const o=(null==t||null===(r=t.media)||void 0===r?void 0:r.url)||(null==t?void 0:t.media)||"";return e.createElement(Ct,{key:o+n,index:n,activeIndex:i,setActiveIndex:I,item:t,src:o,navItemRefs:u,itemIcon:null==t?void 0:t.icon})}))));var E,A,N,M};Rt.propTypes={items:Tt.array.isRequired,activeIndex:Tt.number,setActiveIndex:Tt.func.isRequired,layout:Tt.object,carouselMounted:Tt.bool,forceMobile:Tt.bool};function Dt(){S.track("gallery.cover.displayed"),Ft.send("gallerycoverdisplayed")}function Lt(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 Bt=({item:t,src:n,srcset:i,sizes:r,isCoverElement:o})=>{const s=e.useRef(null);return e.useEffect((()=>{var t;if(o){if(null===(t=s.current)||void 0===t||!t.complete)return s.current.addEventListener("load",Dt,{once:!0}),()=>{var t;null===(t=s.current)||void 0===t||t.removeEventListener("load",Dt,{once:!0})};Dt()}}),[]),e.createElement("img",{ref:s,src:Lt(n),srcSet:i,sizes:r,alt:t.name,fetchPriority:o?"high":"auto",loading:o?"eager":"lazy",style:{width:"100%",height:"100%"}})};Bt.propTypes={item:Tt.object.isRequired,src:Tt.string,srcset:Tt.string,sizes:Tt.string,isCoverElement:Tt.bool};const zt=Pt((t=>{var e;e=t,S.track("gallery.interaction",{elementid:"carousel",interactiontype:e}),Ft.send("interaction",{elementid:"carousel",interactiontype:e})}),200);function Wt(){zt("wheel")}const $t=e.forwardRef((({items:t,setActiveIndex:n,activeIndex:i,showSmartLoaders:r},o)=>{const s=e.useRef(null),a=e.useRef([]);a.current=null==t?void 0:t.map(((t,n)=>{var i,r;return null!==(i=null==a||null===(r=a.current)||void 0===r?void 0:r[n])&&void 0!==i?i:e.createRef()}));const[l,c]=e.useState(),[u,d]=e.useState(),h=e.useRef(i),f=e.useRef(!1);function p(){const e=function(t){const e=t.scrollLeft,n=t.scrollWidth-t.clientWidth;return 0===e?0:e>n?100:e/n*100}(s.current)*(null==t?void 0:t.length)/100,i=Math.min(Math.trunc(e),(null==t?void 0:t.length)-1),r=h.current;"nav"!==r.source&&"external-nav"!==r.source?(f.current&&i!==r.index&&(f.current=!1),f.current||(i>(null==t?void 0:t.length)-1?n({index:(null==t?void 0:t.length)-1,source:"carousel"}):n({index:i,source:"carousel"}))):i===r.index?f.current=!0:f.current&&i!==r.index&&(f.current=!1,n({index:i,source:"carousel"}))}return e.useImperativeHandle(o,(()=>({prev:()=>{n({index:Math.max(0,h.current.index-1),source:"carousel"})},next:()=>{n({index:Math.min((null==t?void 0:t.length)-1,h.current.index+1),source:"carousel"})}}))),e.useEffect((()=>{const t=s.current;if(t)return t.addEventListener("scroll",p),()=>{t.removeEventListener("scroll",p)}}),[t]),e.useEffect((()=>{var t;let e=null===(t=a.current)||void 0===t?void 0:t[i.index];if(e&&("nav"===i.source||"external-nav"===i.source)){const t=e.current,n=s.current.clientWidth/2,i=(null==t?void 0:t.clientWidth)/2,r=(null==t?void 0:t.offsetLeft)-n+i;s.current.scrollTo({left:r,behavior:"smooth"})}}),[i]),e.useEffect((()=>{h.current=i,"nav"!==i.source&&"external-nav"!==i.source||(f.current=!1)}),[i]),e.createElement("ul",{className:"eko-carousel",ref:s,onScroll:p,onWheel:Wt,onTouchMove:function(t){d(t.targetTouches[0].clientX)},onTouchStart:function(t){c(t.targetTouches[0].clientX),d(null)},onTouchEnd:function(){u&&l&&(l-u>75||l-u<-75)&&zt("swipe")}},null==t?void 0:t.map(((t,n)=>{const i=(null==t?void 0:t.cover)||(null==t?void 0:t.media),o=(null==i?void 0:i.url)||i;return e.createElement("li",{className:"eko-carousel-item",key:o+n,ref:a.current[n]},e.createElement(Bt,{item:t,src:o,srcset:null==i?void 0:i.srcset,sizes:null==i?void 0:i.sizes,isCoverElement:0===n}),r&&"image"!==t.type&&e.createElement("div",{className:"eko-smart-loading"},e.createElement("div",null),e.createElement("p",null,"Loading video experience")))})))}));function Ut(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)}$t.propTypes={items:Tt.array.isRequired,setActiveIndex:Tt.func.isRequired,activeIndex:Tt.object,showSmartLoaders:Tt.bool},$t.displayName="CarouselLoop";const jt="eko.project.invoke",qt="eko.block.invoke";function Vt(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 Gt(t){return`#variantId=${encodeURIComponent(t)}`}const Ht=e.forwardRef((({config:t,instanceId:n,setActiveItem:i,activeItem:r,variantId:o,smartGalleryLoaded:s,onLoad:l,forceMobile:c},u)=>{var d,h,f;const p=null!==(d=null===(h=t.options)||void 0===h?void 0:h.galleryEnv)&&void 0!==d?d:"",m=null===(f=t.__autoGenerated)||void 0===f||null===(f=f.publishItem)||void 0===f?void 0:f.id,v=function(t={}){let e="";return Object.entries(t).forEach((([t,n])=>{e+=`&${t}=${n}`})),e}(null==t?void 0:t.qp),g=function(t,e,n){return`https://${t}play.eko.com/embed?${n?`id=${n}`:`piid=${e}`}&nocover=true&galleryBlockMode=gallery&eko_pixel=true`}(p,m,n),y=e.useRef(null),b=e.useRef(null),k=e.useRef(!1),[x,w]=e.useState(Gt(o||"ekonovar")),[_,T]=e.useState(g+v+x);let I;function E(){S.track("gallery.project.display"),l(),Ft.send("galleryloaded")}return e.useImperativeHandle(u,(()=>({prev:()=>{Vt(null==b?void 0:b.current,qt,{action:"onPrevModule"})},next:()=>{Vt(null==b?void 0:b.current,qt,{action:"onNextModule"})}}))),e.useEffect((()=>{k.current?Vt(null==b?void 0:b.current,jt,{action:"updateVariant",args:{id:o}}):w(Gt(o))}),[o]),e.useEffect((()=>{Vt(null==b?void 0:b.current,qt,{action:"updateActiveModule",args:{activeItemIndex:null==r?void 0:r.index,activeModuleIndex:null==r?void 0:r.step}})}),[r]),e.useEffect((()=>{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))&&!k.current)return e=t.data.data.blockType,k.current=!0,void("GalleryBlock"===e?Vt(null==b?void 0:b.current,qt,{action:"updateActiveModule",args:{activeItemIndex:null==r?void 0:r.index,activeModuleIndex:null==r?void 0:r.step}}):E());var e;if(k.current){if(function(t){var e;return Ut(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==r?void 0:r.index)&&n===(null==r?void 0:r.step)||i({index:e,step:n,source:"carousel"})}(t);(function(t){var e;return Ut(t)&&"activeModuleChangeDone"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.name)})(t)&&!s&&E()}}return I=c||a()?"mobile":"desktop",function(t,e={}){window.addEventListener("message",t,e)}(t),()=>{!function(t,e={}){window.removeEventListener("message",t,e)}(t)}}),[r]),e.useEffect((()=>{k.current||Vt(null==b?void 0:b.current,jt,{action:"queryProjectStarted"})}),[r,s]),e.useEffect((()=>{k.current=!1}),[t]),e.useEffect((()=>{T(g+v+x)}),[x]),e.createElement("div",{className:"eko-smart-gallery-container "+(s?"":"eko-project-not-ready"),ref:y,"data-type":"smart-gallery","data-qp":v,"data-variant":o,"data-device":I},e.createElement("iframe",{allow:"autoplay; fullscreen",title:"eko gallery",src:_,style:{border:0},ref:b}))}));Ht.propTypes={config:Tt.object.isRequired,instanceId:Tt.string,setActiveItem:Tt.func.isRequired,activeItem:Tt.object.isRequired,variantId:Tt.string,smartGalleryLoaded:Tt.bool,onLoad:Tt.func,forceMobile:Tt.bool},Ht.displayName="SmartGallery";const Kt=()=>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}'),Xt=({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")}}`)};Xt.propTypes={layout:Tt.object,style:Tt.object},u("experiment");const Yt=({activeVariantId:t,activeElementId:n,hasInteractive:i,experiments:r,publishItem:o})=>{const s="gallery",a=e.useRef(t),l=e.useRef(n),c=e.useRef(i),u=e.useRef(r),d=e.useRef(o);e.useEffect((()=>{a.current=t,l.current=n,c.current=i,u.current=r,d.current=o}),[t,n,i,r,o]);const h={publishItemPacker:{tag:s,schema:"iglu:com.helloeko/publishitem/jsonschema/1-0-0",match:/.*/,getData:function(){const t=d.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:s,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:s,schema:"iglu:com.helloeko/gallery/jsonschema/1-0-2",match:/^gallery.*/,getData:function(){var t;return{activeitemid:l.current.toString(),activevariantid:a.current,hasinteractive:c.current,version:(null===(t=window.eko)||void 0===t||null===(t=t.gallery)||void 0===t?void 0:t.version)||""}}},activeVariantIdPacker:{tag:s,schema:"iglu:com.helloeko/variant/jsonschema/1-0-1",match:/.*/,getData:function(){if(a.current)return{id:a.current}}},experimentPacker:{tag:s,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}(u.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 e.useEffect((()=>(Object.values(h).forEach((t=>{window.EkoAnalytics("registerContextPacker",t)})),()=>{window.EkoAnalytics("reset",s)})),[]),null};Yt.propTypes={activeVariantId:Tt.string,activeElementId:Tt.number,hasInteractive:Tt.bool,experiments:Tt.array,publishItem:Tt.object};const Qt=({variantId:t,activeItem:n,hasInteractive:i,activeIndex:r,experiments:o,publishItem:s})=>{const a=e.useRef(!0);return e.useEffect((()=>{a.current||t&&S.track("gallery.variant.change")}),[t]),e.useEffect((()=>{a.current||S.track("gallery.element.change",{activeIndex:r})}),[r]),e.useEffect((()=>{a.current||n&&null!=s&&s.id&&S.track("gallery.asset.view",{publishitemid:s.id,type:n.type,name:n.name})}),[n]),e.useEffect((()=>{a.current=!1}),[]),e.createElement(Yt,{activeVariantId:t||"ekonovar",activeElementId:r,hasInteractive:i,experiments:o,publishItem:s})};Qt.propTypes={variantId:Tt.string,activeItem:Tt.object,hasInteractive:Tt.bool,activeIndex:Tt.number,experiments:Tt.array,publishItem:Tt.object};const Jt="eko-gallery-react";function Zt(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 te=e.forwardRef((({className:t,config:n,instanceId:i,variantId:r,activeItem:o={index:0,step:0},onEvent:s,forceMobile:a},l)=>{var c,u,d,h,f,p;const m=null!==(c=null===(u=n.options)||void 0===u?void 0:u.loadingTimeout)&&void 0!==c?c:12,v=null===(d=null===(h=n.options)||void 0===h?void 0:h.showCoverLoadAnimation)||void 0===d||d,[g,y]=e.useState(Zt(n,r)),[b,k]=e.useState({index:o.index,step:o.step,source:"external-nav"}),[x,w]=e.useState(!1),[_,T]=e.useState(!1),[I,E]=e.useState("eko-desktop"),A=e.useRef(!1),N=e.useRef(!1),M=e.useRef(o),F=e.useRef(null),C=e.useRef(r);function O(){const t=a||window.innerWidth<768?"eko-mobile":"eko-desktop";E(t)}return N.current||(Ft.send("galleryinit"),N.current=!0),e.useEffect((()=>{const t=C.current!==r;C.current=r,y(Zt(n,r)),t&&!A.current&&k({index:0,step:0,source:"external-nav"})}),[n,r]),e.useEffect((()=>{if(s)return Ft.subscribe(s),()=>{Ft.unsubscribe()}}),[s]),e.useEffect((()=>{A.current=_}),[_]),e.useEffect((()=>{w(!1),T(!1);const t=setTimeout((()=>{A.current||(w(!0),S.track("gallery.load.timeout"))}),1e3*m);return()=>{clearTimeout(t)}}),[n]),e.useEffect((()=>{O()}),[a]),e.useEffect((()=>(window.addEventListener("resize",O),O(),()=>{window.removeEventListener("resize",O)})),[a]),e.useEffect((()=>(window.EkoAnalytics("trackElementVisibility",F.current,Jt),()=>{window.EkoAnalytics("stopTrackingElementVisibility",Jt)})),[]),e.useEffect((()=>{!("carousel"===(null==b?void 0:b.source)||"nav"===(null==b?void 0:b.source))||(null==b?void 0:b.index)===o.index&&(null==b?void 0:b.step)===o.step||Ft.send("activeitemchanged",{index:null==b?void 0:b.index,step:null==b?void 0:b.step})}),[b,o]),e.useEffect((()=>{M.current.index===o.index&&M.current.step===o.step||(M.current=o,k({index:o.index,step:o.step,source:"external-nav"}))}),[o]),e.createElement(e.Fragment,null,e.createElement(Kt,null),e.createElement(Xt,{layout:n.layout,style:n.style,forceMobile:a}),e.createElement(Qt,{variantId:r,activeItem:null==g||null===(f=g.items)||void 0===f?void 0:f[b.index],activeIndex:b.index,hasInteractive:_,experiments:n.experiments,publishItem:null==n||null===(p=n.__autoGenerated)||void 0===p?void 0:p.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}(n.layout)} ${null!=t?t:""}`.trim()} ${I}`,"aria-controls":"main-content",ref:F},e.createElement(Rt,{items:(null==g?void 0:g.items)||[],setActiveIndex:k,activeIndex:b.index,layout:n.layout,carouselMounted:_,forceMobile:a}),!_&&e.createElement($t,{ref:l,items:(null==g?void 0:g.items)||[],setActiveIndex:k,activeIndex:{index:b.index,source:null==b?void 0:b.source},showSmartLoaders:!x&&v}),!x&&e.createElement(Ht,{ref:l,config:n,instanceId:i,activeItem:b,setActiveItem:k,variantId:null==g?void 0:g.variantId,smartGalleryLoaded:_,forceMobile:a,onLoad:function(){T(!0)}})))}));te.propTypes={className:Tt.string,config:Tt.object.isRequired,instanceId:Tt.string,variantId:Tt.string,activeItem:Tt.object,onEvent:Tt.func,forceMobile:Tt.bool,onPrev:Tt.func,onNext:Tt.func},te.displayName="EkoGallery";var ee=e.memo(te);const ne=u("gallery-react");const ie=e.forwardRef(((t,n)=>{var i;e.useEffect((()=>(ne.setDataStorage("gallery-react",{config:t.config}),window.eko=window.eko||{},window.eko.config=t.config,window.eko.gallery={version:"backstage-global-workflows/4.0.4"},()=>{window.eko.config=void 0})),[t.config]);const{children:r,...o}=t;return void 0!==t.config?e.createElement(ee,R({ref:n},o,{key:null===(i=t.config.__autoGenerated)||void 0===i||null===(i=i.publishItem)||void 0===i?void 0:i.id})):r}));ie.propTypes={className:Tt.string,config:Tt.object,variantId:Tt.string,onEvent:Tt.func,instanceId:Tt.string,children:Tt.node},ie.displayName="EkoGalleryWrapper";var re,oe,se,ae,le,ce,ue,de,he,fe,pe,me,ve,ge,ye,be,ke,xe,we,_e,Te,Ie,Ee,Se,Ae,Ne,Me,Fe,Ce,Oe,Pe,Re,De,Le,Be,ze,We,$e,Ue,je,qe,Ve,Ge,He,Ke,Xe,Ye,Qe,Je,Ze,tn,en,nn=e.memo(ie);const rn=1,on=2,sn=4,an=8,ln=16,cn=1,un=4,dn=8,hn=16,fn="[",pn="[!",mn="]",vn={},gn=Symbol(),yn=Symbol("filename"),bn="http://www.w3.org/1999/xhtml",kn="@attach",xn=!0;var wn=Array.isArray,_n=Array.prototype.indexOf,Tn=Array.from,In=Object.defineProperty,En=Object.getOwnPropertyDescriptor,Sn=Object.getOwnPropertyDescriptors,An=Object.prototype,Nn=Array.prototype,Mn=Object.getPrototypeOf,Fn=Object.isExtensible;function Cn(){var t,e;return{promise:new Promise(((n,i)=>{t=n,e=i})),resolve:t,reject:e}}const On=2,Pn=4,Rn=8,Dn=1<<24,Ln=16,Bn=32,zn=64,Wn=128,$n=512,Un=1024,jn=2048,qn=4096,Vn=8192,Gn=16384,Hn=32768,Kn=65536,Xn=1<<17,Yn=1<<18,Qn=1<<19,Jn=1<<20,Zn=1<<25,ti=32768,ei=1<<21,ni=1<<22,ii=1<<23,ri=Symbol("$state"),oi=Symbol("legacy props"),si=Symbol(""),ai=Symbol("proxy path"),li=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},ci=3,ui=8;function di(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 hi="font-weight: bold",fi="font-weight: normal";function pi(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",hi,fi)}function mi(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`,hi,fi)}let vi,gi=!1;function yi(t){gi=t}function bi(t){if(null===t)throw pi(),vn;return vi=t}function ki(){return bi(Ro(vi))}function xi(t){if(gi){if(null!==Ro(vi))throw pi(),vn;vi=t}}function wi(t=!0){for(var e=0,n=vi;;){if(n.nodeType===ui){var i=n.data;if(i===mn){if(0===e)return n;e-=1}else i!==fn&&i!==pn||(e+=1)}var r=Ro(n);t&&n.remove(),n=r}}function _i(t){if(!t||t.nodeType!==ui)throw pi(),vn;return t.data}function Ti(t){return t===this.v}function Ii(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 Ei=!1;function Si(t,e){return t.label=e,Ai(t.v,e),t}function Ai(t,e){var n;return null==t||null===(n=t[ai])||void 0===n||n.call(t,e),t}function Ni(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"),In(e,"stack",{value:n.join("\n")}),In(e,"name",{value:t}),e)}let Mi=null;function Fi(t){Mi=t}let Ci=null;function Oi(t){Ci=t}let Pi=null;function Ri(t){Pi=t}function Di(t){return zi("getContext").get(t)}function Li(t,e=!1,n){Mi={p:Mi,i:!1,c:null,e:null,s:t,x:null,l:null},Mi.function=n,Pi=n}function Bi(t){var e,n,i=Mi,r=i.e;if(null!==r)for(var o of(i.e=null,r))Ko(o);return i.i=!0,Mi=i.p,Pi=null!==(e=null===(n=Mi)||void 0===n?void 0:n.function)&&void 0!==e?e:null,{}}function zi(t){var e,n;return null===Mi&&di(t),null!==(n=(e=Mi).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}(Mi)||void 0)}let Wi=[];function $i(){var t=Wi;Wi=[],function(t){for(var e=0;e<t.length;e++)t[e]()}(t)}function Ui(t){if(0===Wi.length&&!or){var e=Wi;queueMicrotask((()=>{e===Wi&&$i()}))}Wi.push(t)}function ji(){for(;Wi.length>0;)$i()}const qi=new WeakMap;function Vi(t){var e=gs;if(null===e)return ps.f|=ii,t;if(t instanceof Error&&!qi.has(t)&&qi.set(t,function(t,e){var n,i;const r=En(t,"message");if(r&&!r.configurable)return;var o=No?" ":"\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[yn].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&Hn)Gi(t,e);else{if(!(e.f&Wn))throw!e.parent&&t instanceof Error&&Hi(t),t;e.b.error(t)}}function Gi(t,e){for(;null!==e;){if(e.f&Wn)try{return void e.b.error(t)}catch(e){t=e}e=e.parent}throw t instanceof Error&&Hi(t),t}function Hi(t){const e=qi.get(t);e&&(In(t,"message",{value:e.message}),In(t,"stack",{value:e.stack}))}const Ki=-7169;function Xi(t,e){t.f=t.f&Ki|e}function Yi(t){t.f&$n||null===t.deps?Xi(t,Un):Xi(t,qn)}function Qi(t){if(null!==t)for(const e of t)e.f&On&&e.f&ti&&(e.f^=ti,Qi(e.deps))}function Ji(t,e,n){t.f&jn?e.add(t):t.f&qn&&n.add(t),Qi(t.deps),Xi(t,Un)}const Zi=new Set;let tr=null,er=null,nr=[],ir=null,rr=!1,or=!1;var 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(){O(this,fr),P(this,"committed",!1),P(this,"current",new Map),P(this,"previous",new Map),F(this,sr,new Set),F(this,ar,new Set),F(this,lr,0),F(this,cr,0),F(this,ur,null),F(this,dr,new Set),F(this,hr,new Set),P(this,"skipped_effects",new Set),P(this,"is_fork",!1)}is_deferred(){return this.is_fork||M(cr,this)>0}process(t){nr=[],this.apply();var e,n=[],i=[];for(const e of t)A(fr,this,mr).call(this,e,n,i);(this.is_fork||A(fr,this,gr).call(this),this.is_deferred())?(A(fr,this,vr).call(this,i),A(fr,this,vr).call(this,n)):(tr=null,wr(i),wr(n),null===(e=M(ur,this))||void 0===e||e.resolve());er=null}capture(t,e){var n;(e===gn||this.previous.has(t)||this.previous.set(t,e),t.f&ii)||(this.current.set(t,t.v),null===(n=er)||void 0===n||n.set(t,t.v))}activate(){tr=this,this.apply()}deactivate(){tr===this&&(tr=null,er=null)}flush(){if(this.activate(),nr.length>0){if(br(),null!==tr&&tr!==this)return}else 0===M(lr,this)&&this.process([]);this.deactivate()}discard(){for(const t of M(ar,this))t(this);M(ar,this).clear()}increment(t){C(lr,this,M(lr,this)+1),t&&C(cr,this,M(cr,this)+1)}decrement(t){C(lr,this,M(lr,this)-1),t&&C(cr,this,M(cr,this)-1),this.revive()}revive(){for(const t of M(dr,this))M(hr,this).delete(t),Xi(t,jn),Ir(t);for(const t of M(hr,this))Xi(t,qn),Ir(t);this.flush()}oncommit(t){M(sr,this).add(t)}ondiscard(t){M(ar,this).add(t)}settled(){var t;return(null!==(t=M(ur,this))&&void 0!==t?t:C(ur,this,Cn())).promise}static ensure(){if(null===tr){const t=tr=new pr;Zi.add(tr),or||pr.enqueue((()=>{tr===t&&t.flush()}))}return tr}static enqueue(t){Ui(t)}apply(){}}function mr(t,e,n){t.f^=Un;for(var i=t.first,r=null;null!==i;){var o=i.f,s=!!(o&(Bn|zn));if(!(s&&!!(o&Un)||!!(o&Vn)||this.skipped_effects.has(i))&&null!==i.fn){s?i.f^=Un:null!==r&&o&(Pn|Rn|Dn)?r.b.defer_effect(i):o&Pn?e.push(i):Ns(i)&&(o&Ln&&M(dr,this).add(i),Ps(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 vr(t){for(var e=0;e<t.length;e+=1)Ji(t[e],M(dr,this),M(hr,this))}function gr(){if(0===M(cr,this)){for(const t of M(sr,this))t();M(sr,this).clear()}0===M(lr,this)&&A(fr,this,yr).call(this)}function yr(){if(Zi.size>1){this.previous.clear();var t=er,e=!0;for(const t of Zi){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=nr;nr=[];const e=new Set,o=new Map;for(const t of i)_r(t,r,e,o);if(nr.length>0){tr=t,t.apply();for(const e of nr)A(fr,t,mr).call(t,e,[],[]);t.deactivate()}nr=n}}tr=null,er=t}this.committed=!0,Zi.delete(this)}function br(){var t=us;rr=!0;var e=new Set;try{var n=0;for(ds(!0);nr.length>0;){var i=pr.ensure();if(n++>1e3){if(xn){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)}kr()}if(i.process(nr),uo.clear(),xn)for(const t of i.current.keys())e.add(t)}}finally{rr=!1,ds(t),ir=null;for(const t of e)t.updated=null}}function kr(){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){In(t,"stack",{value:""}),Gi(t,ir)}}let xr=null;function wr(t){var e=t.length;if(0!==e){for(var n=0;n<e;){var i,r=t[n++];if(!(r.f&(Gn|Vn))&&Ns(r))if(xr=new Set,Ps(r),null===r.deps&&null===r.first&&null===r.nodes&&(null===r.teardown&&null===r.ac?rs(r):r.fn=null),(null===(i=xr)||void 0===i?void 0:i.size)>0){uo.clear();for(const t of xr){if(t.f&(Gn|Vn))continue;const e=[t];let n=t.parent;for(;null!==n;)xr.has(n)&&(xr.delete(n),e.push(n)),n=n.parent;for(let t=e.length-1;t>=0;t--){const n=e[t];n.f&(Gn|Vn)||Ps(n)}}xr.clear()}}xr=null}}function _r(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&On?_r(r,e,n,i):t&(ni|Ln)&&!(t&jn)&&Tr(r,e,i)&&(Xi(r,jn),Ir(r))}}function Tr(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&On&&Tr(i,e,n))return n.set(i,!0),!0}return n.set(t,!1),!1}function Ir(t){for(var e=ir=t;null!==e.parent;){var n=(e=e.parent).f;if(rr&&e===gs&&n&Ln&&!(n&Yn))return;if(n&(zn|Bn)){if(!(n&Un))return;e.f^=Un}}nr.push(e)}var Er=Kn|Qn|Wn;var Sr=new WeakMap,Ar=new WeakMap,Nr=new WeakMap,Mr=new WeakMap,Fr=new WeakMap,Cr=new WeakMap,Or=new WeakMap,Pr=new WeakMap,Rr=new WeakMap,Dr=new WeakMap,Lr=new WeakMap,Br=new WeakMap,zr=new WeakMap,Wr=new WeakMap,$r=new WeakMap,Ur=new WeakMap,jr=new WeakMap,qr=new WeakSet;class Vr{constructor(t,e,n){O(this,qr),P(this,"parent",void 0),P(this,"is_pending",!1),F(this,Sr,void 0),F(this,Ar,gi?vi:null),F(this,Nr,void 0),F(this,Mr,void 0),F(this,Fr,void 0),F(this,Cr,null),F(this,Or,null),F(this,Pr,null),F(this,Rr,null),F(this,Dr,null),F(this,Lr,0),F(this,Br,0),F(this,zr,!1),F(this,Wr,new Set),F(this,$r,new Set),F(this,Ur,null),F(this,jr,function(t){let e,n=0,i=po(0);return Si(i,"createSubscriber version"),()=>{Vo()&&(Ds(i),Yo((()=>(0===n&&(e=zs((()=>t((()=>ko(i)))))),n+=1,()=>{Ui((()=>{var t;n-=1,0===n&&(null===(t=e)||void 0===t||t(),e=void 0,ko(i))}))}))))}}((()=>(C(Ur,this,po(M(Lr,this))),Si(M(Ur,this),"$effect.pending()"),()=>{C(Ur,this,null)})))),C(Sr,this,t),C(Nr,this,e),C(Mr,this,n),this.parent=gs.b,this.is_pending=!!M(Nr,this).pending,C(Fr,this,Jo((()=>{if(gs.b=this,gi){const t=M(Ar,this);ki();t.nodeType===ui&&t.data===pn?A(qr,this,Hr).call(this):(A(qr,this,Gr).call(this),0===M(Br,this)&&(this.is_pending=!1))}else{var t=A(qr,this,Kr).call(this);try{C(Cr,this,ts((()=>n(t))))}catch(t){this.error(t)}M(Br,this)>0?A(qr,this,Yr).call(this):this.is_pending=!1}return()=>{var t;null===(t=M(Dr,this))||void 0===t||t.remove()}}),Er)),gi&&C(Sr,this,vi)}defer_effect(t){Ji(t,M(Wr,this),M($r,this))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!M(Nr,this).pending}update_pending_count(t){A(qr,this,Qr).call(this,t),C(Lr,this,M(Lr,this)+t),M(Ur,this)&&yo(M(Ur,this),M(Lr,this))}get_effect_pending(){return M(jr,this).call(this),Ds(M(Ur,this))}error(t){var e=M(Nr,this).onerror;let n=M(Nr,this).failed;if(M(zr,this)||!e&&!n)throw t;M(Cr,this)&&(is(M(Cr,this)),C(Cr,this,null)),M(Or,this)&&(is(M(Or,this)),C(Or,this,null)),M(Pr,this)&&(is(M(Pr,this)),C(Pr,this,null)),gi&&(bi(M(Ar,this)),function(t=1){if(gi){for(var e=t,n=vi;e--;)n=Ro(n);vi=n}}(),bi(wi()));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",hi,fi):(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}}(),pr.ensure(),C(Lr,this,0),null!==M(Pr,this)&&os(M(Pr,this),(()=>{C(Pr,this,null)})),this.is_pending=this.has_pending_snippet(),C(Cr,this,A(qr,this,Xr).call(this,(()=>(C(zr,this,!1),ts((()=>M(Mr,this).call(this,M(Sr,this)))))))),M(Br,this)>0?A(qr,this,Yr).call(this):this.is_pending=!1)};var s=ps;try{vs(null),r=!0,null==e||e(t,o),r=!1}catch(t){Gi(t,M(Fr,this)&&M(Fr,this).parent)}finally{vs(s)}n&&Ui((()=>{C(Pr,this,A(qr,this,Xr).call(this,(()=>{pr.ensure(),C(zr,this,!0);try{return ts((()=>{n(M(Sr,this),(()=>t),(()=>o))}))}catch(t){return Gi(t,M(Fr,this).parent),null}finally{C(zr,this,!1)}})))}))}}function Gr(){try{C(Cr,this,ts((()=>M(Mr,this).call(this,M(Sr,this)))))}catch(t){this.error(t)}}function Hr(){const t=M(Nr,this).pending;t&&(C(Or,this,ts((()=>t(M(Sr,this))))),pr.enqueue((()=>{var t=A(qr,this,Kr).call(this);C(Cr,this,A(qr,this,Xr).call(this,(()=>(pr.ensure(),ts((()=>M(Mr,this).call(this,t))))))),M(Br,this)>0?A(qr,this,Yr).call(this):(os(M(Or,this),(()=>{C(Or,this,null)})),this.is_pending=!1)})))}function Kr(){var t=M(Sr,this);return this.is_pending&&(C(Dr,this,Oo()),M(Sr,this).before(M(Dr,this)),t=M(Dr,this)),t}function Xr(t){var e=gs,n=ps,i=Mi;ys(M(Fr,this)),vs(M(Fr,this)),Fi(M(Fr,this).ctx);try{return t()}catch(t){return Vi(t),null}finally{ys(e),vs(n),Fi(i)}}function Yr(){const t=M(Nr,this).pending;null!==M(Cr,this)&&(C(Rr,this,document.createDocumentFragment()),M(Rr,this).append(M(Dr,this)),cs(M(Cr,this),M(Rr,this))),null===M(Or,this)&&C(Or,this,ts((()=>t(M(Sr,this)))))}function Qr(t){var e;if(this.has_pending_snippet()){if(C(Br,this,M(Br,this)+t),0===M(Br,this)){this.is_pending=!1;for(const t of M(Wr,this))Xi(t,jn),Ir(t);for(const t of M($r,this))Xi(t,qn),Ir(t);M(Wr,this).clear(),M($r,this).clear(),M(Or,this)&&os(M(Or,this),(()=>{C(Or,this,null)})),M(Rr,this)&&(M(Sr,this).before(M(Rr,this)),C(Rr,this,null))}}else this.parent&&A(qr,e=this.parent,Qr).call(e,t)}function Jr(t,e,n,i){const r=eo;if(0!==n.length||0!==t.length){var o,s,a,l,c,u=tr,d=gs,h=(o=gs,s=ps,a=Mi,l=tr,c=Ci,function(t=!0){ys(o),vs(s),Fi(a),t&&(null==l||l.activate()),Oi(c)});t.length>0?Promise.all(t).then((()=>{h();try{return f()}finally{null==u||u.deactivate(),Zr()}})):f()}else i(e.map(r));function f(){Promise.all(n.map((t=>no(t)))).then((t=>{h();try{i([...e.map(r),...t])}catch(t){d.f&Gn||Gi(t,d)}null==u||u.deactivate(),Zr()})).catch((t=>{Gi(t,d)}))}}function Zr(){ys(null),vs(null),Fi(null),Oi(null)}const to=new Set;function eo(t){var e=On|jn,n=null!==ps&&ps.f&On?ps:null;null!==gs&&(gs.f|=Qn);return{ctx:Mi,deps:null,effects:null,equals:Ti,f:e,fn:t,reactions:null,rv:0,v:gn,wv:0,parent:null!=n?n:gs,ac:null}}function no(t,e,n){let i=gs;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=po(gn);s.label=e;var a=!ps,l=new Map;return function(t){qo(ni|Qn,t,!0)}((()=>{var e=Cn();o=e.promise;try{Promise.resolve(t()).then(e.resolve,e.reject).then((()=>{n===tr&&n.committed&&n.deactivate(),Zr()}))}catch(t){e.reject(t),Zr()}var n=tr;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(li),l.delete(n),l.set(n,e)}const u=(t,e=void 0)=>{if(n.activate(),e)e!==li&&(s.f|=ii,yo(s,e));else{s.f&ii&&(s.f^=ii),yo(s,t);for(const[t,e]of l){if(l.delete(t),t===n)break;e.reject(li)}}a&&(r.update_pending_count(-1),n.decrement(c))};e.promise.then(u,(t=>u(null,t||"unknown")))})),Go((()=>{for(const t of l.values())t.reject(li)})),s.f|=ni,new Promise((t=>{!function e(n){function i(){n===o?t(s):e(o)}n.then(i,i)}(o)}))}function io(t){const e=eo(t);return ks(e),e}function ro(t){const e=eo(t);return e.equals=Ii,e}function oo(t){var e=t.effects;if(null!==e){t.effects=null;for(var n=0;n<e.length;n+=1)is(e[n])}}let so=[];function ao(t){var e,n=gs;ys(function(t){for(var e=t.parent;null!==e;){if(!(e.f&On))return e.f&Gn?null:e;e=e.parent}return null}(t));{let i=co;ho(new Set);try{so.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}}(),so.push(t),t.f&=~ti,oo(t),e=Fs(t)}finally{ys(n),ho(i),so.pop()}}return e}function lo(t){var e,n,i=ao(t);if(!t.equals(i)&&(t.wv=As(),(null===(e=tr)||void 0===e||!e.is_fork||null===t.deps)&&(t.v=i,null===t.deps)))return void Xi(t,Un);hs||(null!==er?(Vo()||null!==(n=tr)&&void 0!==n&&n.is_fork)&&er.set(t,i):Yi(t))}let co=new Set;const uo=new Map;function ho(t){co=t}let fo=!1;function po(t,e){return{f:0,v:t,reactions:null,equals:Ti,rv:0,wv:0}}function mo(t,e){const n=po(t);return ks(n),n}function vo(t,e=!1,n=!0){const i=po(t);return e||(i.equals=Ii),i}function go(t,e,n=!1){var i;null!==ps&&(!ms||ps.f&Xn)&&ps.f&(On|Ln|ni|Xn)&&(null===(i=bs)||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?_o(e):e;return Ai(r,t.label),yo(t,r)}function yo(t,e){if(!t.equals(e)){var n=t.v;hs?uo.set(t,e):uo.set(t,n),t.v=e;var i=pr.ensure();if(i.capture(t,n),null!==gs){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=Ni("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!==gs&&(t.set_during_effect=!0),t.f&On){const e=t;t.f&jn&&ao(e),Yi(e)}t.wv=As(),xo(t,jn),null!==gs&&gs.f&Un&&!(gs.f&(Bn|zn))&&(null===_s?function(t){_s=t}([t]):_s.push(t)),!i.is_fork&&co.size>0&&!fo&&bo()}return e}function bo(){fo=!1;var t=us;ds(!0);const e=Array.from(co);try{for(const t of e)t.f&Un&&Xi(t,qn),Ns(t)&&Ps(t)}finally{ds(t)}co.clear()}function ko(t){go(t,t.v+1)}function xo(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&Xn)co.add(o);else{var a=!(s&jn);if(a&&Xi(o,e),s&On){var l,c=o;null===(l=er)||void 0===l||l.delete(c),s&ti||(s&$n&&(o.f|=ti),xo(c,qn))}else a&&(s&Ln&&null!==xr&&xr.add(o),Ir(o))}}}const wo=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function _o(t){if("object"!=typeof t||null===t||ri in t)return t;const e=Mn(t);if(e!==An&&e!==Nn)return t;var n=new Map,i=wn(t),r=mo(0),o=Es,s=t=>{if(Es===o)return t();var e=ps,n=Es;vs(null),Ss(o);var i=t();return vs(e),Ss(n),i};i&&(n.set("length",mo(t.length)),t=new Proxy(t,{get(t,e,n){var i=Reflect.get(t,e,n);return Eo.has(e)?function(...t){fo=!0;var e=i.apply(this,t);return bo(),e}:i}}));var a="";let l=!1;function c(t){if(!l){l=!0,Si(r,`${a=t} version`);for(const[t,e]of n)Si(e,To(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=mo(i.value);return n.set(e,t),"string"==typeof e&&Si(t,To(a,e)),t})):go(r,i.value,!0),!0},deleteProperty(t,e){var i=n.get(e);if(void 0===i){if(e in t){const t=s((()=>mo(gn)));n.set(e,t),ko(r),Si(t,To(a,e))}}else go(i,gn),ko(r);return!0},get(e,i,r){var o;if(i===ri)return t;if(i===ai)return c;var l=n.get(i),u=i in e;if(void 0===l&&(!u||null!==(o=En(e,i))&&void 0!==o&&o.writable)&&(l=s((()=>{var t=mo(_o(u?e[i]:gn));return Si(t,To(a,i)),t})),n.set(i,l)),void 0!==l){var d=Ds(l);return d===gn?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=Ds(r))}else if(void 0===i){var o=n.get(e),s=null==o?void 0:o.v;if(void 0!==o&&s!==gn)return{enumerable:!0,configurable:!0,value:s,writable:!0}}return i},has(t,e){var i;if(e===ri)return!0;var r=n.get(e),o=void 0!==r&&r.v!==gn||Reflect.has(t,e);if((void 0!==r||null!==gs&&(!o||null!==(i=En(t,e))&&void 0!==i&&i.writable))&&(void 0===r&&(r=s((()=>{var n=mo(o?_o(t[e]):gn);return Si(n,To(a,e)),n})),n.set(e,r)),Ds(r)===gn))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?go(f,gn):h in t&&(f=s((()=>mo(gn))),n.set(h+"",f),Si(f,To(a,h)))}void 0===u?(!d||null!==(c=En(t,e))&&void 0!==c&&c.writable)&&(Si(u=s((()=>mo(void 0))),To(a,e)),go(u,_o(o)),n.set(e,u)):(d=u.v!==gn,go(u,s((()=>_o(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&&go(m,v+1)}ko(r)}return!0},ownKeys(t){Ds(r);var e=Reflect.ownKeys(t).filter((t=>{var e=n.get(t);return void 0===e||e.v!==gn}));for(var[i,o]of n)o.v===gn||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 To(t,e){var n;return"symbol"==typeof e?`${t}[Symbol(${null!==(n=e.description)&&void 0!==n?n:""})]`:wo.test(e)?`${t}.${e}`:/^\d+$/.test(e)?`${t}[${e}]`:`${t}['${e}']`}function Io(t){try{if(null!==t&&"object"==typeof t&&ri in t)return t[ri]}catch{}return t}const Eo=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function So(t,e,n=!0){try{t===e!=(Io(t)===Io(e))&&mi(n?"===":"!==")}catch{}return t===e===n}var Ao,No,Mo,Fo;function Co(){if(void 0===Ao){Ao=window,No=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;Mo=En(e,"firstChild").get,Fo=En(e,"nextSibling").get,Fn(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),Fn(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(Io(this[n])===t){mi("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(Io(this[n])===t){mi("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(Io(this[e])===t){mi("array.includes(...)");break}return n},Array.__svelte_cleanup=()=>{t.indexOf=n,t.lastIndexOf=i,t.includes=r}}()}}function Oo(t=""){return document.createTextNode(t)}function Po(t){return Mo.call(t)}function Ro(t){return Fo.call(t)}function Do(t,e){if(!gi)return Po(t);var n=Po(vi);if(null===n)n=vi.appendChild(Oo());else if(e&&n.nodeType!==ci){var i,r=Oo();return null===(i=n)||void 0===i||i.before(r),bi(r),r}return bi(n),n}function Lo(t,e=!1){var n;if(!gi){var i=Po(t);return i instanceof Comment&&""===i.data?Ro(i):i}if(e&&(null===(n=vi)||void 0===n?void 0:n.nodeType)!==ci){var r,o=Oo();return null===(r=vi)||void 0===r||r.before(o),bi(o),o}return vi}function Bo(t,e=1,n=!1){var i;let r=gi?vi:t;for(var o;e--;)o=r,r=Ro(r);if(!gi)return r;if(n&&(null===(i=r)||void 0===i?void 0:i.nodeType)!==ci){var s,a=Oo();if(null===r)null===(s=o)||void 0===s||s.after(a);else r.before(a);return bi(a),a}return bi(r),r}function zo(t){t.textContent=""}function Wo(t,e){if(e){const e=document.body;t.autofocus=!0,Ui((()=>{document.activeElement===e&&t.focus()}))}}let $o=!1;function Uo(t){var e=ps,n=gs;vs(null),ys(null);try{return t()}finally{vs(e),ys(n)}}function jo(t){null===gs&&(null===ps&&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}}()),hs&&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 qo(t,e,n){for(var i=gs;null!==i&&i.f&Xn;)i=i.parent;null!==i&&i.f&Vn&&(t|=Vn);var r={ctx:Mi,deps:null,nodes:null,f:t|jn|$n,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=Pi,n)try{Ps(r),r.f|=Hn}catch(t){throw is(r),t}else null!==e&&Ir(r);var o=r;if(!n||null!==o.deps||null!==o.teardown||null!==o.nodes||o.first!==o.last||o.f&Qn||(o=o.first,t&Ln&&t&Kn&&null!==o&&(o.f|=Kn)),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!==ps&&ps.f&On&&!(t&zn))){var s,a=ps;(null!==(s=a.effects)&&void 0!==s?s:a.effects=[]).push(o)}return r}function Vo(){return null!==ps&&!ms}function Go(t){const e=qo(Rn,null,!1);return Xi(e,Un),e.teardown=t,e}function Ho(t){jo("$effect"),In(t,"name",{value:"$effect"});var e=gs.f;if(!!(ps||!(e&Bn)||e&Hn))return Ko(t);var n,i=Mi;(null!==(n=i.e)&&void 0!==n?n:i.e=[]).push(t)}function Ko(t){return qo(Pn|Jn,t,!1)}function Xo(t){return qo(Pn,t,!1)}function Yo(t,e=0){return qo(Rn|e,t,!0)}function Qo(t,e=[],n=[],i=[]){Jr(i,e,n,(e=>{qo(Rn,(()=>t(...e.map(Ds))),!0)}))}function Jo(t,e=0){var n=qo(Ln|e,t,!0);return n.dev_stack=Ci,n}function Zo(t,e=0){var n=qo(Dn|e,t,!0);return n.dev_stack=Ci,n}function ts(t){return qo(Bn|Qn,t,!0)}function es(t){var e=t.teardown;if(null!==e){const t=hs,n=ps;fs(!0),vs(null);try{e.call(null)}finally{fs(t),vs(n)}}}function ns(t,e=!1){var n=t.first;for(t.first=t.last=null;null!==n;){const t=n.ac;null!==t&&Uo((()=>{t.abort(li)}));var i=n.next;n.f&zn?n.parent=null:is(n,e),n=i}}function is(t,e=!0){var n=!1;(e||t.f&Yn)&&null!==t.nodes&&null!==t.nodes.end&&(!function(t,e){for(;null!==t;){var n=t===e?null:Ro(t);t.remove(),t=n}}(t.nodes.start,t.nodes.end),n=!0),ns(t,e&&!n),Os(t,0),Xi(t,Gn);var i=t.nodes&&t.nodes.t;if(null!==i)for(const t of i)t.stop();es(t);var r=t.parent;null!==r&&null!==r.first&&rs(t),t.component_function=null,t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=null}function rs(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 os(t,e,n=!0){var i=[];ss(t,i,!0);var r=()=>{n&&is(t),e&&e()},o=i.length;if(o>0){var s=()=>--o||r();for(var a of i)a.out(s)}else r()}function ss(t,e,n){if(!(t.f&Vn)){t.f^=Vn;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;ss(r,e,!!(!!(r.f&Kn)||!!(r.f&Bn)&&!!(t.f&Ln))&&n),r=o}}}function as(t){ls(t,!0)}function ls(t,e){if(t.f&Vn){t.f^=Vn,t.f&Un||(Xi(t,jn),Ir(t));for(var n=t.first;null!==n;){var i=n.next;ls(n,!!(!!(n.f&Kn)||!!(n.f&Bn))&&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 cs(t,e){if(t.nodes)for(var n=t.nodes.start,i=t.nodes.end;null!==n;){var r=n===i?null:Ro(n);e.append(n),n=r}}let us=!1;function ds(t){us=t}let hs=!1;function fs(t){hs=t}let ps=null,ms=!1;function vs(t){ps=t}let gs=null;function ys(t){gs=t}let bs=null;function ks(t){null!==ps&&(null===bs?bs=[t]:bs.push(t))}let xs=null,ws=0,_s=null;let Ts=1,Is=0,Es=Is;function Ss(t){Es=t}function As(){return++Ts}function Ns(t){var e=t.f;if(e&jn)return!0;if(e&On&&(t.f&=~ti),e&qn){for(var n=t.deps,i=n.length,r=0;r<i;r++){var o=n[r];if(Ns(o)&&lo(o),o.wv>t.wv)return!0}e&$n&&null===er&&Xi(t,Un)}return!1}function Ms(t,e,n=!0){var i,r=t.reactions;if(null!==r&&(null===(i=bs)||void 0===i||!i.includes(t)))for(var o=0;o<r.length;o++){var s=r[o];s.f&On?Ms(s,e,!1):e===s&&(n?Xi(s,jn):s.f&Un&&Xi(s,qn),Ir(s))}}function Fs(t){var e=xs,n=ws,i=_s,r=ps,o=bs,s=Mi,a=ms,l=Es,c=t.f;xs=null,ws=0,_s=null,ps=c&(Bn|zn)?null:t,bs=null,Fi(t.ctx),ms=!1,Es=++Is,null!==t.ac&&(Uo((()=>{t.ac.abort(li)})),t.ac=null);try{t.f|=ei;var u=(0,t.fn)(),d=t.deps;if(null!==xs){var h;if(Os(t,ws),null!==d&&ws>0)for(d.length=ws+xs.length,h=0;h<xs.length;h++)d[ws+h]=xs[h];else t.deps=d=xs;if(Vo()&&t.f&$n)for(h=ws;h<d.length;h++){var f,p;(null!==(p=(f=d[h]).reactions)&&void 0!==p?p:f.reactions=[]).push(t)}}else null!==d&&ws<d.length&&(Os(t,ws),d.length=ws);if(!(null===_s||ms||null===d||t.f&(On|qn|jn)))for(h=0;h<_s.length;h++)Ms(_s[h],t);return null!==r&&r!==t&&(Is++,null!==_s&&(null===i?i=_s:i.push(..._s))),t.f&ii&&(t.f^=ii),u}catch(t){return Vi(t)}finally{t.f^=ei,xs=e,ws=n,_s=i,ps=r,bs=o,Fi(s),ms=a,Es=l}}function Cs(t,e){let n=e.reactions;if(null!==n){var i=_n.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&On&&(null===xs||!xs.includes(e))){var o=e;o.f&$n&&(o.f^=$n,o.f&=~ti),Yi(o),oo(o),Os(o,0)}}function Os(t,e){var n=t.deps;if(null!==n)for(var i=e;i<n.length;i++)Cs(t,n[i])}function Ps(t){var e=t.f;if(!(e&Gn)){Xi(t,Un);var n=gs,i=us;gs=t,us=!0;var r,o=Pi;Ri(t.component_function);var s=Ci;Oi(null!==(r=t.dev_stack)&&void 0!==r?r:Ci);try{e&(Ln|Dn)?function(t){for(var e=t.first;null!==e;){var n=e.next;e.f&Bn||is(e),e=n}}(t):ns(t),es(t);var a=Fs(t);t.teardown="function"==typeof a?a:null,t.wv=Ts,xn&&Ei&&t.f&jn&&t.deps}finally{us=i,gs=n,Ri(o),Oi(s)}}}async function Rs(){await Promise.resolve(),function(){var t=or;or=!0;try{for(;;){var e;if(ji(),0===nr.length&&(null===(e=tr)||void 0===e||e.flush(),0===nr.length))return void(ir=null);br()}}finally{or=t}}()}function Ds(t){var e,n,i=!!(t.f&On);if(null!==ps&&!ms&&!(null!==gs&&!!(gs.f&Gn)||null!==(n=bs)&&void 0!==n&&n.includes(t))){var r=ps.deps;if(ps.f&ei)t.rv<Is&&(t.rv=Is,null===xs&&null!==r&&r[ws]===t?ws++:null===xs?xs=[t]:xs.includes(t)||xs.push(t));else{var o,s;(null!==(s=(o=ps).deps)&&void 0!==s?s:o.deps=[]).push(t);var a=t.reactions;null===a?t.reactions=[ps]:a.includes(ps)||a.push(ps)}}if(to.delete(t),hs&&uo.has(t))return uo.get(t);if(i){var l=t;if(hs){var c=l.v;return(l.f&Un||null===l.reactions)&&!Bs(l)||(c=ao(l)),uo.set(l,c),c}var u=!(l.f&$n)&&!ms&&null!==ps&&(us||!!(ps.f&$n)),d=null===l.deps;Ns(l)&&(u&&(l.f|=$n),lo(l)),u&&!d&&Ls(l)}if(null!==(e=er)&&void 0!==e&&e.has(t))return er.get(t);if(t.f&ii)throw t.v;return t.v}function Ls(t){if(null!==t.deps){t.f|=$n;for(const n of t.deps){var e;(null!==(e=n.reactions)&&void 0!==e?e:n.reactions=[]).push(t),n.f&On&&!(n.f&$n)&&Ls(n)}}}function Bs(t){if(t.v===gn)return!0;if(null===t.deps)return!1;for(const e of t.deps){if(uo.has(e))return!0;if(e.f&On&&Bs(e))return!0}return!1}function zs(t){var e=ms;try{return ms=!0,t()}finally{ms=e}}const Ws=new Set,$s=new Set;function Us(t,e,n,i={}){function r(t){if(i.capture||Gs.call(e,t),!t.cancelBubble)return Uo((()=>null==n?void 0:n.call(this,t)))}return t.startsWith("pointer")||t.startsWith("touch")||"wheel"===t?Ui((()=>{e.addEventListener(t,r,i)})):e.addEventListener(t,r,i),r}function js(t,e,n,i,r){var o={capture:i,passive:r},s=Us(t,e,n,o);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&Go((()=>{e.removeEventListener(t,s,o)}))}function qs(t){for(var e=0;e<t.length;e++)Ws.add(t[e]);for(var n of $s)n(t)}let Vs=null;function Gs(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;Vs=t;var a=0,l=Vs===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){In(t,"currentTarget",{configurable:!0,get:()=>s||i});var d=ps,h=gs;vs(null),ys(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,vs(d),ys(h)}}}function Hs(t,e){var n=gs;null===n.nodes&&(n.nodes={start:t,end:e,a:null,t:null})}function Ks(t,e){var n,i=!!(1&e),r=!!(2&e),o=!t.startsWith("<!>");return()=>{if(gi)return Hs(vi,null),vi;var e,s;void 0===n&&(e=o?t:"<!>"+t,(s=document.createElement("template")).innerHTML=e.replaceAll("<!>","\x3c!----\x3e"),n=s.content,i||(n=Po(n)));var a=r||No?document.importNode(n,!0):n.cloneNode(!0);i?Hs(Po(a),a.lastChild):Hs(a,a);return a}}function Xs(){if(gi)return Hs(vi,null),vi;var t=document.createDocumentFragment(),e=document.createComment(""),n=Oo();return t.append(e,n),Hs(e,n),t}function Ys(t,e){if(gi){var n=gs;return n.f&Hn&&null!==n.nodes.end||(n.nodes.end=vi),void ki()}null!==t&&t.before(e)}function Qs(t){return t.endsWith("capture")&&"gotpointercapture"!==t&&"lostpointercapture"!==t}const Js=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function Zs(t){return Js.includes(t)}const ta={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 ea(t){var e;return t=t.toLowerCase(),null!==(e=ta[t])&&void 0!==e?e:t}const na=["touchstart","touchmove"];function ia(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 ra(t,e){return aa(t,e)}function oa(t,e){var n;Co(),e.intro=null!==(n=e.intro)&&void 0!==n&&n;const i=e.target,r=gi,o=vi;try{for(var s=Po(i);s&&(s.nodeType!==ui||s.data!==fn);)s=Ro(s);if(!s)throw vn;yi(!0),bi(s);const n=aa(t,{...e,anchor:s});return yi(!1),n}catch(n){if(n instanceof Error&&n.message.split("\n").some((t=>t.startsWith("https://svelte.dev/e/"))))throw n;return n!==vn&&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}}(),Co(),zo(i),yi(!1),ra(t,e)}finally{yi(r),bi(o)}}const sa=new Map;function aa(t,{target:e,anchor:n,props:i={},events:r,context:o,intro:s=!0}){Co();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,na.includes(s));e.addEventListener(i,Gs,{passive:r});var o=sa.get(i);void 0===o?(document.addEventListener(i,Gs,{passive:r}),sa.set(i,1)):sa.set(i,o+1)}}var s};l(Tn(Ws)),$s.add(l);var c=void 0,u=function(t){pr.ensure();const e=qo(zn|Qn,t,!0);return(t={})=>new Promise((n=>{t.outro?os(e,(()=>{is(e),n(void 0)})):(is(e),n(void 0))}))}((()=>{var s=null!=n?n:e.appendChild(Oo());return function(t,e,n){new Vr(t,e,n)}(s,{pending:()=>{}},(e=>{o&&(Li({}),Mi.c=o);if(r&&(i.$$events=r),gi&&Hs(e,null),c=t(e,i)||{},gi&&(gs.nodes.end=vi,null===vi||vi.nodeType!==ui||vi.data!==mn))throw pi(),vn;o&&Bi()})),()=>{for(var t of a){e.removeEventListener(t,Gs);var i=sa.get(t);0==--i?(document.removeEventListener(t,Gs),sa.delete(t)):sa.set(t,i)}var r;($s.delete(l),s!==n)&&(null===(r=s.parentNode)||void 0===r||r.removeChild(s))}}));return la.set(c,u),c}let la=new WeakMap;function ca(t,e){const n=la.get(t);return n?(la.delete(t),n(e)):(ri 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",hi,fi):console.warn("%c[svelte] lifecycle_double_unmount\n%cTried to unmount a component that was not mounted\nhttps://svelte.dev/e/lifecycle_double_unmount",hi,fi),Promise.resolve())}class ua{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=tr;if(this.#t.has(t)){var e=this.#t.get(t),n=this.#e.get(e);if(n)as(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&&(is(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();cs(i,e),e.append(Oo()),this.#n.set(t,{effect:i,fragment:e})}else is(i);this.#i.delete(t),this.#e.delete(t)};this.#r||!n?(this.#i.add(t),os(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)||(is(n.effect),this.#n.delete(t))};ensure(t,e){var n=tr;!e||this.#e.has(t)||this.#n.has(t)||this.#e.set(t,ts((()=>e(this.anchor)))),this.#t.set(n,t),gi&&(this.anchor=vi),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")}var da,ha=new Map;function fa(t,e,n=!1){gi&&ki();var i=new ua(t);function r(e,n){if(gi){if(e===(_i(t)===pn)){var r=wi();return bi(r),i.anchor=r,yi(!1),i.ensure(e,n),void yi(!0)}}i.ensure(e,n)}Jo((()=>{var t=!1;e(((e,n=!0)=>{t=!0,r(n,e)})),t||r(!1,null)}),n?Kn:0)}function pa(t,e){return e}function ma(t,e=!0){for(var n=0;n<t.length;n++)is(t[n],e)}function va(t,e,n,i,r,o=null){var s=t,a=new Map;if(!!(e&sn)){var l=t;s=gi?bi(Po(l)):l.appendChild(Oo())}gi&&ki();var c,u=null,d=ro((()=>{var t=n();return wn(t)?t:null==t?[]:Tn(t)})),h=!0;function f(){m.fallback=u,function(t,e,n,i,r){var o,s,a,l,c,u=!!(i&an),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&Zn))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&Zn){if(l.f^=Zn,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),ba(t,p,l),ba(t,l,b),ya(l,b,n),m=[],v=[],f=(p=l).next;continue}ya(l,null,n)}var k,x;if(l.f&Vn)if(as(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 T=m[0],I=m[m.length-1];for(w=0;w<m.length;w+=1)ya(m[w],_,n);for(w=0;w<v.length;w+=1)o.delete(v[w]);ba(t,T.prev,I.next),ba(t,p,T),ba(t,I,_),f=_,p=I,c-=1,m=[],v=[]}else o.delete(l),ya(l,f,n),ba(t,l.prev,l.next),ba(t,l,null===p?t.effect.first:p.next),ba(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&Zn||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)ma(Tn(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 A=[];if(void 0!==o)for(l of o)l.f&Vn||A.push(l);for(;null!==f;)f.f&Vn||f===t.fallback||A.push(f),f=f.next;var N=A.length;if(N>0){var M=i&sn&&0===d?n:null;if(u){for(c=0;c<N;c+=1){var F;null===(F=A[c].nodes)||void 0===F||null===(F=F.a)||void 0===F||F.measure()}for(c=0;c<N;c+=1){var C;null===(C=A[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];os(n,(()=>{if(i){if(i.pending.delete(n),i.done.add(n),0===i.pending.size){var e=t.outrogroups;ma(Tn(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;zo(c),c.append(l),t.items.clear()}ma(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,A,M)}}u&&Ui((()=>{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&Zn?(u.f^=Zn,ya(u,null,s)):as(u):os(u,(()=>{u=null})))}var p=Jo((()=>{var t=(c=Ds(d)).length;let l=!1;gi&&(_i(s)===pn!==(0===t)&&(bi(s=wi()),yi(!1),l=!0));for(var p=new Set,m=0;m<t;m+=1){gi&&vi.nodeType===ui&&vi.data===mn&&(s=vi,l=!0,yi(!1));var v,g=c[m],y=i(g,m),b=h?null:a.get(y);if(b)b.v&&yo(b.v,g),b.i&&yo(b.i,m);else b=ga(a,h?s:null!==(v=da)&&void 0!==v?v:da=Oo(),g,y,m,r,e,n),h||(b.e.f|=Zn),a.set(y,b);p.add(y)}0===t&&o&&!u&&(h?u=ts((()=>o(s))):(u=ts((()=>{var t;return o(null!==(t=da)&&void 0!==t?t:da=Oo())}))).f|=Zn),gi&&t>0&&bi(wi()),h||f(),l&&yi(!0),Ds(d)})),m={effect:p,items:a,outrogroups:null,fallback:u};h=!1,gi&&(s=vi)}function ga(t,e,n,i,r,o,s,a){var l=s&rn?s&ln?po(n):vo(n,!1,!1):null,c=s&on?po(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:ts((()=>(o(e,null!=l?l:n,null!=c?c:r,a),()=>{t.delete(i)})))}}function ya(t,e,n){if(t.nodes)for(var i=t.nodes.start,r=t.nodes.end,o=!e||e.f&Zn?n:e.nodes.start;null!==i;){var s=Ro(i);if(o.before(i),i===r)return;i=s}}function ba(t,e,n){null===e?t.effect.first=n:e.next=n,null===n?t.effect.last=e:n.prev=e}function ka(t,e){Xo((()=>{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=ha.get(t);n||(n=new Set,ha.set(t,n)),n.add(e)}(e.hash,t)}}))}function xa(t,e){var n,i=void 0;Zo((()=>{i!==(i=e())&&(n&&(is(n),n=null),i&&(n=ts((()=>{Xo((()=>i(t)))}))))}))}function wa(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=wa(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function _a(t){return"object"==typeof t?function(){for(var t,e,n=0,i="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=wa(t))&&(i&&(i+=" "),i+=e);return i}(t):null!=t?t:""}const Ta=[..." \t\n\r\f \v\ufeff"];function Ia(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 Ea(t){return"-"!==t[0]||"-"!==t[1]?t.toLowerCase():t}function Sa(t,e,n,i,r,o){var s=t.__className;if(gi||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&&!Ta.includes(i[s-1])||a!==i.length&&!Ta.includes(i[a])?s=a:i=(0===s?"":i.substring(0,s))+i.substring(a+1)}return""===i?null:i}(n,i,o);gi&&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 Aa(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 Na(t,e,n,i){var r=t.__style;if(gi||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(Ea)),i&&l.push(...Object.keys(i).map(Ea));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=Ea(t.substring(c,u).trim());l.includes(f)||(";"!==h&&d++,r+=" "+t.substring(c,d).trim()+";")}c=d+1,u=-1}}}return n&&(r+=Ia(n)),i&&(r+=Ia(i,!0)),""===(r=r.trim())?null:r}return null==t?null:String(t)}(e,i);gi&&o===t.getAttribute("style")||(null==o?t.removeAttribute("style"):t.style.cssText=o),t.__style=e}else i&&(Array.isArray(i)?(Aa(t,null==n?void 0:n[0],i[0]),Aa(t,null==n?void 0:n[1],i[1],"important")):Aa(t,n,i));return i}function Ma(t,e,n=!1){if(t.multiple){if(null==e)return;if(!wn(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",hi,fi);for(var i of t.options)i.selected=e.includes(Fa(i))}else{for(i of t.options){var r=Fa(i);if(o=r,s=e,Object.is(Io(o),Io(s)))return void(i.selected=!0)}var o,s;n&&void 0===e||(t.selectedIndex=-1)}}function Fa(t){return"__value"in t?t.__value:t.value}const Ca=Symbol("class"),Oa=Symbol("style"),Pa=Symbol("is custom element"),Ra=Symbol("is html");function Da(t){if(gi){var e=!1,n=()=>{if(!e){if(e=!0,t.hasAttribute("value")){var n=t.value;Ba(t,"value",null),t.value=n}if(t.hasAttribute("checked")){var i=t.checked;Ba(t,"checked",null),t.checked=i}}};t.__on_r=n,Ui(n),$o||($o=!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 La(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function Ba(t,e,n,i){var r=Wa(t);gi&&(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=qa(t.srcset),i=qa(e);return i.length===n.length&&i.every((([t,e],i)=>e===n[i][1]&&(ja(n[i][0],t)||ja(t,n[i][0]))))}(t,n))return;if(ja(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`,hi,fi)}(e,t.outerHTML.replace(t.innerHTML,t.innerHTML&&"..."),String(n))}(t,e,null!=n?n:""):r[e]!==(r[e]=n)&&("loading"===e&&(t[si]=n),null==n?t.removeAttribute(e):"string"!=typeof n&&Ua(t).includes(e)?t[e]=n:t.setAttribute(e,n))}function za(t,e,n=[],i=[],r=[],o,s=!1,a=!1){Jr(r,n,i,(n=>{var i=void 0,r={},l="SELECT"===t.nodeName,c=!1;if(Zo((()=>{var u=e(...n.map(Ds)),d=function(t,e,n,i,r=!1,o=!1){if(gi&&r&&"INPUT"===t.tagName){var s=t;("checkbox"===s.type?"defaultChecked":"defaultValue")in n||Da(s)}var a=Wa(t),l=a[Pa],c=!a[Ra];let u=gi&&l;u&&yi(!1);var d,h=e||{},f="OPTION"===t.tagName;for(var p in e)p in n||(n[p]=null);n.class?n.class=_a(n.class):n.class=null,n[Oa]&&(null!==(d=n.style)&&void 0!==d||(n.style=null));var m=Ua(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=Zs(i);if(Qs(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,qs([i]);else{let o=function(t){h[r].call(this,t)};h[n]=Us(i,t,o,e)}else y&&(t[`__${i}`]=void 0)}else if("style"===r)Ba(t,r,s);else if("autofocus"===r)Wo(t,Boolean(s));else if(l||"__value"!==r&&("value"!==r||null==s))if("selected"===r&&f)La(t,s);else{var b=r;c||(b=ea(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]=gn)):"function"!=typeof s&&Ba(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 Na(t,s,null==e?void 0:e[Oa],n[Oa]),h[r]=s,h[Oa]=n[Oa];else Sa(t,"http://www.w3.org/1999/xhtml"===t.namespaceURI,s,i,null==e?void 0:e[Ca],n[Ca]),h[r]=s,h[Ca]=n[Ca]}return u&&yi(!0),h}(t,i,u,o,s,a);c&&l&&"value"in u&&Ma(t,u.value);for(let t of Object.getOwnPropertySymbols(r))u[t]||is(r[t]);for(let e of Object.getOwnPropertySymbols(u)){var h=u[e];e.description!==kn||i&&h===i[e]||(r[e]&&is(r[e]),r[e]=ts((()=>xa(t,(()=>h))))),d[e]=h}i=d})),l){var u=t;Xo((()=>{Ma(u,i.value,!0),function(t){var e=new MutationObserver((()=>{Ma(t,t.__value)}));e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Go((()=>{e.disconnect()}))}(u)}))}c=!0}))}function Wa(t){var e;return null!==(e=t.__attributes)&&void 0!==e?e:t.__attributes={[Pa]:t.nodeName.includes("-"),[Ra]:t.namespaceURI===bn}}var $a=new Map;function Ua(t){var e,n=t.getAttribute("is")||t.nodeName,i=$a.get(n);if(i)return i;$a.set(n,i=[]);for(var r=t,o=Element.prototype;o!==r;){for(var s in e=Sn(r))e[s].set&&i.push(s);r=Mn(r)}return i}function ja(t,e){return t===e||new URL(t,document.baseURI).href===new URL(e,document.baseURI).href}function qa(t){return t.split(",").map((t=>t.trim().split(" ").filter(Boolean)))}function Va(t,e){return t===e||(null==t?void 0:t[ri])===e}function Ga(t={},e,n,i){return Xo((()=>{var i,r;return Yo((()=>{i=r,r=[],zs((()=>{t!==n(...r)&&(e(t,...r),i&&Va(n(...i),t)&&e(null,...i))}))})),()=>{Ui((()=>{r&&Va(n(...r),t)&&e(null,...r)}))}})),t}let Ha=!1;function Ka(t,e,n,i){var r,o,s=!!(n&dn),a=!!(n&hn),l=i,c=!0,u=()=>(c&&(c=!1,l=a?zs(i):i),l);if(s){var d,h,f=ri in t||oi in t;r=null!==(d=null===(h=En(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=Ha;try{return Ha=!1,[t(),Ha]}finally{Ha=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&un))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&cn?eo:ro)((()=>(g=!1,p())));y.label=e,s&&Ds(y);var b=gs;return function(t,e){if(arguments.length>0){const n=e?Ds(y):s?_o(t):t;return go(y,n),g=!0,void 0!==l&&(l=n),t}return hs&&g||b.f&Gn?y.v:Ds(y)}}var Xa,Ya,Qa,Ja;"undefined"!=typeof window&&(null!==(Ya=(Xa=null!==(Ja=(Qa=window).__svelte)&&void 0!==Ja?Ja:Qa.__svelte={}).v)&&void 0!==Ya?Ya:Xa.v=new Set).add("5");function Za(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 tl(t,e){t.getNodesAtTime(0)[0].once("nodestart",e)}class el{constructor({position:t,galleryState:e,config:n}){this.config=n,this.position=t,this.galleryState=e,this.name=n.name;const{variantId:i,itemIndex:r,moduleIndex:o}=t;this.id=`${n.itemType}_${i}_${r}_${o}`,Za(this)}#a=Si(mo(_o({})),"BaseModule.#state");#l=Si(mo(null),"BaseModule.#cover");#c=Si(mo(!1),"BaseModule.#showCover");#u=Si(mo(null),"BaseModule.#Component");id;player;position;config;timeline;moduleEndListener;hasDuration=!1;coverAssets=[];get state(){return Ds(this.#a)}set state(t){go(this.#a,t,!0)}get cover(){return Ds(this.#l)}set cover(t){go(this.#l,t)}get showCover(){return Ds(this.#c)}set showCover(t){go(this.#c,t,!0)}get Component(){return Ds(this.#u)}set Component(t){go(this.#u,t)}emitModuleEnd(){var t;null===(t=this.moduleEndListener)||void 0===t||t.call(this)}start(t){this.player=t}setPosition(){this.galleryState.playingModulePosition=this.position}play(){tl(this.timeline,(()=>{this.setPosition()})),this.player.switchTimeline(this.timeline)}get duration(){return this.hasDuration?this.timeline.placements.reduce(((t,e)=>t+this.player.getNode(e.nodeId).duration),0):0}}function nl(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;return n.addNode({id:t,manifestRef:{type:"assets-delivery-service",assetId:s,assetRevision:a,availableEncodeProfiles:e.availableEncodeProfiles}})}var il=Ks('<h3 class="text-box-title svelte-17x2i38"> </h3>'),rl=Ks('<span class="text-box-title svelte-17x2i38"> </span>'),ol=Ks('<span class="text-box-description minimized-description svelte-17x2i38"> </span>'),sl=Ks('<span class="read-more-cta svelte-17x2i38" aria-hidden="true">Read more</span>'),al=Ks('<button class="expand-description-button svelte-17x2i38" aria-expanded="false" aria-controls="expanded-text-content" aria-label="Expand feature description"><!> <!></button>'),ll=Ks('<button aria-expanded="true" aria-label="Collapse feature description" class="svelte-17x2i38">Read less</button>'),cl=Ks('<section aria-label="Feature description" aria-live="polite"><div class="text-wrapper svelte-17x2i38"><div class="expanded-text-content svelte-17x2i38"><!> <p class="text-box-description svelte-17x2i38"> </p></div> <!></div> <!></section>');const ul={hash:"svelte-17x2i38",code:".step-description-container.svelte-17x2i38 {width:100%;position:absolute;bottom:0;display:flex;justify-content:space-between;gap:8px;box-sizing:border-box;font-size:12px;font-weight:400;font-style:normal;line-height:16px;letter-spacing:0px;overflow:hidden;pointer-events:none;background: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 );&.expanded {flex-direction:column;justify-content:flex-start;}&:not(.expanded) {button:where(.svelte-17x2i38) {line-height:16px;}}}.expanded-text-content.svelte-17x2i38:not([hidden]) {display:flex;flex-direction:column;gap:8px;}button.svelte-17x2i38 {background:none;border:none;padding:0;cursor:pointer;line-height:18px;gap:8px;letter-spacing:0%;color:#014FD3;font-size:12px;font-weight:500;flex-shrink:0;text-align:left;font-family:inherit;pointer-events:auto;}h3.svelte-17x2i38, p.svelte-17x2i38, span.svelte-17x2i38 {color:#030303;}.text-wrapper.svelte-17x2i38 {width:100%;}.text-box-title.svelte-17x2i38 {margin:0;font-weight:500;font-size:12px;}.text-box-description.svelte-17x2i38 {margin:0;text-align:left;font-weight:400;}.minimized-description.svelte-17x2i38 {overflow:hidden;line-clamp:1;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;font-weight:400;}.expand-description-button.svelte-17x2i38 {width:100%;display:flex;justify-content:space-between;gap:6px;flex-wrap:nowrap;.read-more-cta:where(.svelte-17x2i38) {color:#014FD3;flex-shrink:0;}}"};function dl(t,e){const n=io((()=>e.state.textBox));!function(t,e){Li(e,!0),ka(t,ul);let n=Ka(e,"textBox",3,null),i=Ka(e,"isMobile",3,!1),r=mo(!1),o=mo(null),s=mo(!1),a=io((()=>{var t;return(null===(t=n())||void 0===t?void 0:t.title)||""})),l=io((()=>{var t;return(null===(t=n())||void 0===t?void 0:t.description)||""})),c=io((()=>i()?16:18)),u=io((()=>i()?12:16));function d(){Ds(o)&&go(s,Ds(o).scrollWidth>Ds(o).clientWidth||Ds(o).scrollHeight>Ds(o).clientHeight,!0)}Ho((()=>{Ds(o)&&d()}));var h=Xs();js("resize",Ao,d);var f=Lo(h),p=t=>{var e=cl(),n=Do(e),d=Do(n),h=Do(d),f=t=>{var e=il(),n=Do(e,!0);xi(e),Qo((()=>ia(n,Ds(a)))),Ys(t,e)};fa(h,(t=>{i()&&t(f)}));var p=Bo(h,2),m=Do(p,!0);xi(p),xi(d);var v=Bo(d,2),g=t=>{var e=al();e.__click=()=>go(r,!0);var n=Do(e),u=t=>{var e=rl(),n=Do(e,!0);xi(e),Qo((()=>ia(n,Ds(a)))),Ys(t,e)},d=t=>{var e=ol(),n=Do(e,!0);xi(e),Ga(e,(t=>go(o,t)),(()=>Ds(o))),Qo((()=>ia(n,Ds(l)))),Ys(t,e)};fa(n,(t=>{i()&&Ds(a)?t(u):t(d,!1)}));var h=Bo(n,2),f=t=>{Ys(t,sl())};fa(h,(t=>{(i()||!i()&&Ds(s))&&t(f)})),xi(e),Qo((()=>Na(e,`line-height: ${Ds(c)}px;`))),Ys(t,e)};fa(v,(t=>{Ds(r)||t(g)})),xi(n);var y=Bo(n,2),b=t=>{var e=ll();e.__click=()=>go(r,!1),Qo((()=>Na(e,`margin-bottom: ${!i()&&Ds(r)?"8px":"0px"};\n line-height: ${Ds(u)}px;`))),Ys(t,e)};fa(y,(t=>{Ds(r)&&t(b)})),xi(e),Qo((()=>{Sa(e,1,"step-description-container "+(Ds(r)?"expanded":""),"svelte-17x2i38"),Na(e,`padding: ${i()?"8px 16px":"16px 16px 56px 16px"};`),Na(d,`line-height: ${Ds(c)}px;`),Ba(d,"hidden",!Ds(r)),ia(m,Ds(l))})),Ys(t,e)};fa(f,(t=>{(Ds(a)||Ds(l))&&t(p)})),Ys(t,h),Bi()}(t,{get textBox(){return Ds(n)},get isMobile(){return e.isMobile}})}qs(["click"]);var hl=Ks('<div class="toggle-option-container svelte-16pmvvn"><button> </button></div>'),fl=Ks('<div class="toggle-container svelte-16pmvvn"><div></div></div>');const pl={hash:"svelte-16pmvvn",code:".eko-gallery-app {--toggleModule_gap: 8px;--toggleModule_padding: 10px 58px 0 0;--toggleModule_options_padding: 0;--toggleModule_options_height: auto;--toggleModule_options_width: 100%;--toggleModule_options_gap: 8px;--toggleModule_button_backgroundColor: #FFFFFF;--toggleModule_button_padding: 8px 12px;--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_border_radius: 100px;--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:center;gap:var(--toggleModule_gap);pointer-events:auto;box-sizing:border-box;}.toggle-options.svelte-16pmvvn {width:var(--toggleModule_options_width);height:var(--toggleModule_options_height);padding:var(--toggleModule_options_padding);gap:var(--toggleModule_options_gap);display:flex;justify-content:end;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:#E4E5E8 solid 1px;background:#FBFBFB;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;border-radius:var(--toggleModule_button_border_radius);}.toggle-option-button.selected.svelte-16pmvvn {box-shadow:none;color:#FFFFFF;background:#014FD3;border-color:#014FD3;}.toggle-option-button.svelte-16pmvvn:hover:not(.selected) {background:#F3F4F6;}.toggle-option-button.svelte-16pmvvn:active:not(.selected) {background:#E4E5E8;}.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 ml(t,e){ka(t,pl);const n=io((()=>e.state.options)),i=io((()=>e.state.currentOptionIndex)),r=io((()=>e.state.onOptionClicked));var o=fl(),s=Do(o);va(s,21,(()=>Ds(n)),pa,((t,e,n)=>{var o=hl();Na(o,`--button-index: ${n};`);var s=Do(o);let a;s.__click=()=>Ds(r)(n);var l=Do(s,!0);xi(s),xi(o),Qo((()=>{a=Sa(s,1,"toggle-option-button svelte-16pmvvn",null,a,{selected:Ds(i)===n}),ia(l,Ds(e).label)})),Ys(t,o)})),xi(s),xi(o),Qo((()=>{var t;return Sa(s,1,`toggle-options selected-${null!==(t=Ds(i))&&void 0!==t?t:""}`,"svelte-16pmvvn")})),Ys(t,o)}qs(["click"]);var vl=new WeakSet;function gl(t){var e,n;t!==this.state.currentOptionIndex&&(this.state.currentOptionIndex=t,this.cover=this.coverAssets[t],this.synced?this.switchTo(t):(this.timeline=null===(e=this.timelines)||void 0===e?void 0:e[t],this.showCover=!0,tl(this.timeline,(()=>{this.showCover=!1})),null===(n=this.player)||void 0===n||n.switchTimeline(this.timeline)))}const yl=(t,e,n)=>n>e?e:n<t?t:n;function bl(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let kl=()=>{},xl=()=>{};function wl(t){let e;return()=>(void 0===e&&(e=t()),e)}"undefined"!=typeof process&&"production"!==(null===(re=process.env)||void 0===re?void 0:re.NODE_ENV)&&(kl=(t,e,n)=>{t||"undefined"==typeof console||console.warn(bl(e,n))},xl=(t,e,n)=>{if(!t)throw new Error(bl(e,n))});const _l=t=>t,Tl=t=>1e3*t,Il=t=>t/1e3;const El=t=>Array.isArray(t)&&"number"==typeof t[0],Sl=(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)})`},Al=2e4;function Nl(t){let e=0;let n=t.next(e);for(;!n.done&&e<Al;)e+=50,n=t.next(e);return e>=Al?1/0:e}const Ml=5;const Fl={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},Cl=.001;function Ol({duration:t=Fl.duration,bounce:e=Fl.bounce,velocity:n=Fl.velocity,mass:i=Fl.mass}){let r,o;kl(t<=Tl(Fl.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let s=1-e;s=yl(Fl.minDamping,Fl.maxDamping,s),t=yl(Fl.minDuration,Fl.maxDuration,Il(t)),s<1?(r=e=>{const i=e*s,r=i*t,o=i-n,a=Rl(e,s),l=Math.exp(-r);return Cl-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=Rl(Math.pow(e,2),s);return(-r(e)+Cl>0?-1:1)*((o-a)*l)/c}):(r=e=>Math.exp(-e*t)*((e-n)*t+1)-Cl,o=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let i=n;for(let n=1;n<Pl;n++)i-=t(i)/e(i);return i}(r,o,5/t);if(t=Tl(t),isNaN(a))return{stiffness:Fl.stiffness,damping:Fl.damping,duration:t};{const e=Math.pow(a,2)*i;return{stiffness:e,damping:2*s*Math.sqrt(i*e),duration:t}}}const Pl=12;function Rl(t,e){return t*Math.sqrt(1-e*e)}const Dl=["duration","bounce"],Ll=["stiffness","damping","mass"];function Bl(t,e){return e.some((e=>void 0!==t[e]))}function zl(t=Fl.visualDuration,e=Fl.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:Fl.velocity,stiffness:Fl.stiffness,damping:Fl.damping,mass:Fl.mass,isResolvedFromDuration:!1,...t};if(!Bl(t,Ll)&&Bl(t,Dl))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(1.2*n),r=i*i,o=2*yl(.05,1,1-(t.bounce||0))*Math.sqrt(r);e={...e,mass:Fl.mass,stiffness:r,damping:o}}else{const n=Ol(t);e={...e,...n,mass:Fl.mass},e.isResolvedFromDuration=!0}return e}({...n,velocity:-Il(n.velocity||0)}),p=h||0,m=c/(2*Math.sqrt(l*u)),v=s-o,g=Il(Math.sqrt(l/u)),y=Math.abs(v)<5;let b;if(i||(i=y?Fl.restSpeed.granular:Fl.restSpeed.default),r||(r=y?Fl.restDelta.granular:Fl.restDelta.default),m<1){const t=Rl(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?Tl(p):function(t,e,n){const i=Math.max(e-Ml,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(Nl(k),Al),e=Sl((e=>k.next(t*e).value),t,30);return t+"ms "+e},toTransition:()=>{}};return k}zl.applyToOptions=t=>{const e=function(t,e=100,n){const i=n({...t,keyframes:[0,e]}),r=Math.min(Nl(i),Al);return{type:"keyframes",ease:t=>i.next(r*t).value/e,duration:Il(r)}}(t,100,zl);return t.ease=e.ease,t.duration=Tl(e.duration),t.type="keyframes",t};const Wl=t=>null!==t;class $l{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 Ul(t){for(let n=1;n<t.length;n++){var e;null!==(e=t[n])&&void 0!==e||(t[n]=t[n-1])}}const jl=t=>t.startsWith("--");const ql=wl((()=>void 0!==window.ScrollTimeline)),Vl={};function Gl(t,e){const n=wl(t);return()=>{var t;return null!==(t=Vl[e])&&void 0!==t?t:n()}}const Hl=Gl((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing"),Kl=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,Xl={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Kl([0,.65,.55,1]),circOut:Kl([.55,0,1,.45]),backIn:Kl([.31,.01,.66,-.59]),backOut:Kl([.33,1.53,.69,.99])};function Yl(t,e){return t?"function"==typeof t?Hl()?Sl(t,e):"ease-out":El(t)?Kl(t):Array.isArray(t)?t.map((t=>Yl(t,e)||Xl.easeOut)):Xl[t]:void 0}function Ql(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=Yl(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 Jl extends $l{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,xl("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)&&Hl()?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=Ql(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(Wl),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){jl(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 Il(Number(n))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Il(t)}get time(){return Il(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Tl(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&&ql()?(this.animation.timeline=t,_l):e(this)}}class Zl{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 tc(this.animations,"duration")}get iterationDuration(){return tc(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 tc(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 ec extends Zl{then(t,e){return this.finished.finally(t).then((()=>{}))}}const nc=new WeakMap,ic=(t,e="")=>`${t}:${e}`;function rc(t){const e=nc.get(t)||new Map;return nc.set(t,e),e}function oc(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 sc=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 ac(t,e){for(let n=0;n<t.length;n++)"number"==typeof t[n]&&sc.has(e)&&(t[n]=t[n]+"px")}function lc(t,e){const n=window.getComputedStyle(t);return jl(e)?n.getPropertyValue(e):n[e]}function cc(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;xl(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={...oc(a,t)};r.duration&&(r.duration=Tl(r.duration)),r.delay&&(r.delay=Tl(r.delay));const o=rc(i),l=ic(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]=lc(i,r)),Ul(e),ac(e,r),!o&&e.length<2&&e.unshift(lc(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 Jl(i);e.set(n,r),r.finished.finally((()=>e.delete(n))),a.push(r)}return a}const uc=(()=>function(t,e,n){return new ec(cc(t,e,n))})();var dc=Ks('<button class="svelte-16kucsb"><div class="svelte-16kucsb"> </div></button>'),hc=Ks('<div class="tryIt-container svelte-16kucsb"><!></div>');const fc={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) {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;overflow:hidden;}.tryIt-container.svelte-16kucsb button:where(.svelte-16kucsb) div:where(.svelte-16kucsb) {opacity:0;}"};function pc(t,e){Li(e,!0),ka(t,fc);const n=io((()=>e.state.ctaText)),i=io((()=>e.state.animationConfig)),r=io((()=>e.state.showCta)),o=io((()=>e.state.onCtaClick));let s=null,a=null,l=mo(!1),c=!1;function u(){c&&uc(s,{transform:"scale(1.05)"},{type:zl,mass:1.5,stiffness:400,damping:30})}function d(){c&&uc(s,{transform:"scale(1)"},{type:zl,mass:1.5,stiffness:400,damping:30})}function h(){c&&uc(s,{transform:"scale(0.95)"},{type:zl,mass:1,stiffness:600,damping:30})}Ho((()=>{const{mass:t,stiffness:e,damping:n,delay:o}=Ds(i);let u;return Ds(r)&&(u=setTimeout((async()=>{go(l,!0),u=null,uc(s,{transform:["translateY(40px) scale(0, 0.2)","translateY(0) scale(1, 1)"],opacity:1},{type:zl,mass:t,stiffness:e,damping:n}),await uc(a,{transform:["translateY(20px) scale(0.8)","translateY(0) scale(1)"],opacity:1},{type:zl,mass:t,stiffness:e,damping:n,delay:.15}),c=!0}),o)),()=>{u&&clearTimeout(u)}}));var f=hc(),p=Do(f),m=t=>{var e=dc();e.__mousedown=h,e.__touchstart=h,e.__click=function(...t){var e;null===(e=Ds(o))||void 0===e||e.apply(this,t)};var i=Do(e),r=Do(i,!0);xi(i),Ga(i,(t=>a=t),(()=>a)),xi(e),Ga(e,(t=>s=t),(()=>s)),Qo((()=>{Na(e,"pointer-events: "+(Ds(l)?"auto":"none")),ia(r,Ds(n))})),js("mouseenter",e,u),js("mouseleave",e,d),Ys(t,e)};fa(p,(t=>{Ds(r)&&t(m)})),xi(f),Ys(t,f),Bi()}qs(["mousedown","touchstart","click"]);var mc=new WeakSet;function vc(){this.mainTimeline?this.player.switchTimeline(this.mainTimeline):this.emitModuleEnd(),this.state.showCta=!1}const gc={videoModule:class extends el{constructor({config:t,...e}){var n;super({...e,config:t}),this.Component=dl,this.hasDuration=!t.loop,Za(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(nl(`${this.id}_intro`,e.intro,t),"end");const n=nl(this.id,e.video,t);this.timeline.placeOnTimeline(n,"end",{loop:e.loop}),e.loop||n.on("nodeend",this.emitModuleEnd)}},toggleModule:class extends el{constructor({config:t,...e}){super({...e,config:t}),O(this,vl),this.Component=ml,this.synced=t.sync,this.switchTo=()=>{},Za(this),this.coverAssets=t.options.map((t=>{var e;return null!==(e=t.intro)&&void 0!==e?e:t.video})),this.cover=this.coverAssets[0],this.state={options:t.options.map((t=>({label:t.label,note:t.note}))),currentOptionIndex:0,onOptionClicked:A(vl,this,gl).bind(this)}}start(t){super.start(t),this.synced?(this.timeline=t.createTimeline(),this.config.options.forEach(((e,n)=>{this.timeline.placeOnTimeline(nl(`${this.id}_option_${n}`,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.currentOptionIndex,{crossfadeSeconds:0})}}})):(this.timelines=this.config.options.map(((e,n)=>{const i=t.createTimeline();return e.intro&&i.placeOnTimeline(nl(`${this.id}_option_${n}_intro`,e.intro,t),"end"),i.placeOnTimeline(nl(`${this.id}_option_${n}`,e.video,t),"end",{loop:!0}),i})),this.timeline=this.timelines[this.state.currentOptionIndex])}},tryItModule:class extends el{constructor({config:t,...e}){var n;super({...e,config:t}),O(this,mc),Za(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:A(mc,this,vc).bind(this)}}start(t){super.start(t),this.Component=pc,this.timeline=t.createTimeline();const{introVideo:e,mainVideo:n}=this.config;if(e.intro&&this.timeline.placeOnTimeline(nl(`${this.id}_intro_intro`,e.intro,t)),this.timeline.placeOnTimeline(nl(`${this.id}_intro_loop`,e.loop,t),"end",{loop:!0}),n){this.mainTimeline=t.createTimeline(),n.intro&&this.mainTimeline.placeOnTimeline(nl(`${this.id}_main_intro`,n.intro,t));const e=nl(`${this.id}_main_loop`,n.loop,t);this.mainTimeline.placeOnTimeline(e,"end",{loop:!0})}}play(){this.state.showCta=!0,super.play()}}};class yc{#d=Si(mo({}),"GalleryState.#variants");#h=Si(mo("ekonovar"),"GalleryState.#activeVariant");#f=Si(mo(0),"GalleryState.#activeItemIndex");#p=Si(mo(0),"GalleryState.#activeModuleIndex");#m=Si(mo(_o({itemIndex:0,moduleIndex:0})),"GalleryState.#playingModulePosition");#v=Si(io((()=>{var t;return null===(t=Ds(this.#d))||void 0===t?void 0:t[Ds(this.#h)]})),"GalleryState.#currentItemsList");#g=Si(io((()=>{var t;return null===(t=Ds(this.#v))||void 0===t?void 0:t[Ds(this.#f)]})),"GalleryState.#currentItem");#y=Si(io((()=>{var t,e;return Ds(this.#b)?null===(e=Ds(this.#v))||void 0===e?void 0:e[Ds(this.#m).itemIndex].modules[Ds(this.#m).moduleIndex]:null===(t=Ds(this.#g))||void 0===t?void 0:t.modules[Ds(this.#p)]})),"GalleryState.#currentModule");#k=Si(io((()=>{var t;return(null===(t=Ds(this.#v))||void 0===t?void 0:t.flatMap((t=>t.modules)))||[]})),"GalleryState.#currentModulesList");#x=Si(mo(!1),"GalleryState.#playerLoaded");#w=Si(mo(!1),"GalleryState.#paused");#b=Si(mo(!1),"GalleryState.#startedPlaying");#_=Si(io((()=>!(So(Ds(this.#m).itemIndex,this.activeItemIndex)&&So(Ds(this.#m).moduleIndex,this.activeModuleIndex)))),"GalleryState.#seeking");set variants(t){go(this.#d,t)}set activeVariant(t){go(this.#h,t,!0)}set activeItemIndex(t){go(this.#f,t,!0)}set activeModuleIndex(t){go(this.#p,t,!0)}set playingModulePosition(t){go(this.#m,t,!0)}set playerLoaded(t){go(this.#x,t,!0)}set paused(t){go(this.#w,t,!0)}set startedPlaying(t){go(this.#b,t,!0)}get variants(){return Ds(this.#d)}get activeVariant(){return Ds(this.#h)}get activeItemIndex(){return Ds(this.#f)}get activeModuleIndex(){return Ds(this.#p)}get playingModulePosition(){return Ds(this.#m)}get currentItemsList(){return Ds(this.#v)}get currentItem(){return Ds(this.#g)}get currentModule(){return Ds(this.#y)}get playerLoaded(){return Ds(this.#x)}get paused(){return Ds(this.#w)}get startedPlaying(){return Ds(this.#b)}get seeking(){return Ds(this.#_)}get currentModulesList(){return Ds(this.#k)}}const bc={assetsDeliveryBase:"https://{{env}}assets.eko.com"},kc=2,xc=5,wc=["activeItemIndex","activeModuleIndex","paused","startedPlaying"],_c=["version","selectItem","selectItemAndStep","next","prev","subscribe"];var Tc=new WeakMap,Ic=new WeakMap,Ec=new WeakMap,Sc=new WeakMap,Ac=new WeakSet;class Nc{constructor(t){var e,n,i;O(this,Ac),F(this,Tc,void 0),F(this,Ic,void 0),F(this,Ec,void 0),F(this,Sc,void 0),P(this,"public",void 0),P(this,"version","0.0.7"),Za(this),C(Ec,this,t),C(Tc,this,new yc(null==t||null===(e=t.options)||void 0===e?void 0:e.galleryEnv)),C(Sc,this,((t="")=>(So(t,"production")&&(t=""),Object.fromEntries(Object.entries(bc).map((([e,n])=>[e,n.replaceAll("{{env}}",t)])))))(null==t||null===(n=t.options)||void 0===n?void 0:n.galleryEnv)),C(Ic,this,[]);const r=null==t||null===(i=t.instance)||void 0===i||null===(i=i.data)||void 0===i||null===(i=i.blocks)||void 0===i||null===(i=i.blocksArr)||void 0===i||null===(i=i.find((t=>So(t.blockType,"GalleryBlock"))))||void 0===i?void 0:i.config;var o;r?(A(Ac,this,Mc).call(this,r.items),A(Ac,this,Fc).call(this,r.items)):console.warn("[eko-gallery-app] Gallery initiated without an instance, results will be empty"),this.public=(o=this,_c.reduce(((t,e)=>{if(!(e in o))throw new Error(`[eko-gallery-app] Public API member "${e}" does not exist on GalleryLogic`);const n=o[e];return t[e]=So(typeof n,"function")?n.bind(o):n,t}),{}))}start(t){M(Tc,this).playerLoaded=!0,M(Ic,this).forEach((e=>{e.start(t)})),C(Ic,this,null),A(Ac,this,Cc).call(this,t),M(Tc,this).currentModule.play()}selectItem(t){const e=M(Tc,this);So(t,e.activeItemIndex)||(e.activeItemIndex=t,e.activeModuleIndex=0)}selectItemAndStep(t,e){const n=M(Tc,this);So(t,n.activeItemIndex)&&So(e,n.activeModuleIndex)||(n.activeItemIndex=t,n.activeModuleIndex=e)}next(){A(Ac,this,Pc).call(this)}prev(){const t=M(Tc,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}subscribe(t){const e=M(Tc,this);return function(t){pr.ensure();const e=qo(zn|Qn,t,!0);return()=>{is(e)}}((()=>{Ho((()=>{const n=wc.reduce(((t,n)=>(t[n]=e[n],t)),{});t(n)}))}))}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&&So(a,0,!1))throw new Error(`[getCoverUrl] No assetRevision found for asset ${s}.`);let l;return null!==(o=M(Ec,this))&&void 0!==o&&null!==(o=o.coverAssetsMap)&&void 0!==o&&o[s]?(l=new URL(M(Ec,this).coverAssetsMap[s]),/^[a-z0-9]*assets.eko.com$/.test(l.host)&&e&&(l.pathname=l.pathname.replace(".png",".webp"))):(l=new URL(`${M(Sc,this).assetsDeliveryBase}/image/${s}/${a}?startOffset=0`),l.pathname+=e?".webp":".png"),e&&l.searchParams.set("width",e),l.href}get currentConfig(){return M(Ec,this)}get state(){return M(Tc,this)}get urls(){return M(Sc,this)}}function Mc(t){const e={};for(let n of t)for(let t of Object.keys(n.variants||{}))e[t]=[];e.ekonovar=[],M(Tc,this).variants=e}function Fc(t){const e=(t=[],e)=>{const n=[];for(let[i,r]of t.entries()){if(!gc[r.itemType])throw new Error(`Unknown module type ${r.itemType}`);const t=new gc[r.itemType]({position:{...e,moduleIndex:i},config:r,galleryState:M(Tc,this)});t.moduleEndListener=A(Ac,this,Oc).bind(this),n.push(t)}return n};for(const[i,r]of t.entries())if(So(r.itemType,"galleryItemV2")){const{modules:t,...o}=r;for(const[s,a]of Object.entries(M(Tc,this).variants)){var n;if(null===(n=r.variants)||void 0===n?void 0:n[s])console.log("NO IMPLEMENTED");else{const n={...o};n.modules=e(t,{variantId:s,itemIndex:i}),C(Ic,this,[...M(Ic,this),...n.modules]),a.push(n)}}}}function Cc(t){for(const[,e]of Object.entries(M(Tc,this).variants))for(const[n,i]of e.entries()){const r=i.modules,o=e.filter((t=>So(t,i,!1))).map((t=>t.modules[0]));for(const[i,s]of r.entries()){let a=r[i+1];a||(a=e[(n+1)%e.length].modules[0]);const l=a.timeline.getNodesAtTime(0)[0],c=o.filter((t=>So(t,a,!1))).map((t=>t.timeline.getNodesAtTime(0)[0])),u=[{nodeId:l.id,weight:kc},...c.map((t=>({nodeId:t.id,weight:xc})))];for(const e of s.timeline.placements){t.getNode(e.nodeId).setChildren(u)}}}}function Oc(){const t=M(Tc,this),e=t.currentItem.modules;e.length>1&&So(t.activeModuleIndex,e.length-1)?t.activeModuleIndex=0:A(Ac,this,Pc).call(this)}function Pc(){const t=M(Tc,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)}var Rc=Ks('<button><span class="svelte-er27y2"> </span></button>'),Dc=Ks('<div class="nav-buttons-container svelte-er27y2"><div class="nav-buttons svelte-er27y2"></div></div>');const Lc={hash:"svelte-er27y2",code:".eko-gallery-app {--nav_gap: 10px;--nav_padding: 12px 16px;--nav_bgColor: #FFFFFF;--nav_justifyContent: center;--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_arrow_color: var(--secondaryColor);--nav_arrow_bgColor: var(--primaryColor);--nav_arrow_padding: 9px;--nav_arrow_size: 28px;--nav_arrow_boxShadow: 0 0 8px 0 rgba(0, 0, 0, 0.3);}.nav-buttons-container.svelte-er27y2 {width:100%;background-color:var(--nav_bgColor);height:var(--buttonsContainerHeight);display:flex;box-sizing:border-box;text-align:center;justify-content:var(--nav_justifyContent);align-items:center;position:relative;flex-shrink:0;}.nav-buttons-container.svelte-er27y2 :where(.svelte-er27y2) {touch-action:auto;}.nav-buttons.svelte-er27y2 {display:flex;margin:0;gap:var(--nav_gap);height:100%;align-items:center;padding:var(--nav_padding);box-sizing:border-box;overflow-x:auto;scrollbar-width:none;max-width:100%;width:fit-content;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 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 span:where(.svelte-er27y2) {color:var(--nav_button_selected_text_color);font-weight:var(--nav_button_selected_text_fontWeight);}"};qs(["click"]);const Bc="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 zc=Ks('<button><img class="svelte-1al44kl"/></button>');const Wc={hash:"svelte-1al44kl",code:'.nav-button.svelte-1al44kl {height:30px;width:30px;border-radius:100%;background-color:transparent;padding:9px;box-sizing:border-box;display:flex;align-items:center;justify-content:center;pointer-events:auto;border:0;opacity:100%;cursor:pointer;transition-property:background-color, box-shadow, opacity;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%;}'};function $c(t,e){ka(t,Wc);const n=Ka(e,"hidden",3,!1);var i=zc();let r;i.__click=function(...t){var n;null===(n=e.onClick)||void 0===n||n.apply(this,t)};var o=Do(i);xi(i),Qo((()=>{var t;r=Sa(i,1,`nav-button ${null!==(t=e.type)&&void 0!==t?t:""}`,"svelte-1al44kl",r,{hidden:n()}),Ba(i,"aria-label",e.type),Ba(o,"src",Bc),Ba(o,"alt",e.type)})),Ys(t,i)}qs(["click"]);var Uc=Ks('<button><span class="svelte-1mxltt0"> </span></button>'),jc=Ks('<div class="steps-indicator-container svelte-1mxltt0"><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 qc={hash:"svelte-1mxltt0",code:'.steps-indicator-container.svelte-1mxltt0 {width:calc(100% - 32px);position:absolute;bottom:12px;left:16px;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.svelte-1mxltt0 {--stepSize: 6px;--stepPadding: 7px;padding:4px 0px;display:flex;gap:8px;align-items:center;overflow-x:auto;pointer-events:all;scrollbar-width:none;}.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:8px 12px;border:#E4E5E8 solid 1px;background-color:#FBFBFB;cursor:pointer;pointer-events:all;flex-shrink:0;border-radius:100px;font-size:12px;font-weight:500;line-height:16px;color:#030303;transition:all 0.3s ease-in-out;outline-color:#3191fc;}.step-button.active.svelte-1mxltt0 {background-color:#014FD3;color:#FFFFFF;box-shadow:none;border-color:#014FD3;}.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:#F3F4F6;}.step-button.svelte-1mxltt0:active:not(.active) {background:#E4E5E8;}.step-button.svelte-1mxltt0:focus {outline-offset:4px;outline-width:2px;}.step-button.svelte-1mxltt0 span:where(.svelte-1mxltt0) {display:block;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-arrow.svelte-1mxltt0 {max-height:34px;position:absolute;padding-top:4px;padding-bottom:4px;z-index:10;bottom:4px;border:none;background-color:#FFF;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 {padding-right:8px;padding-left:0;left:0;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 {padding-right:0;padding-left:8px;right:0;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 Vc(t,e){Li(e,!0),ka(t,qc);const n=16,i=32,r=Di("state");let o=mo(null),s=mo(null),a=mo(!1),l=mo(!1);const c=io((()=>{let t=[];return t=r().currentItem.modules.map(((t,e)=>({index:e,type:e===r().activeModuleIndex?"active":"",name:t.name}))),t}));function u(){Ds(o)&&(go(a,Ds(o).scrollLeft>3),go(l,Ds(o).scrollLeft+Ds(o).clientWidth<Ds(o).scrollWidth-3))}function d(t){Ds(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(Ds(o).querySelectorAll(".step-button")).find((t=>{const e=t.getBoundingClientRect(),n=Ds(o).getBoundingClientRect();return e.left>n.left+i}));if(t){const e=t.previousElementSibling;e&&h(Ds(o),e)}}function p(){const t=Array.from(Ds(o).querySelectorAll(".step-button")).reverse().find((t=>{const e=t.getBoundingClientRect(),n=Ds(o).getBoundingClientRect();return e.right<n.right-i}));if(t){const e=t.nextElementSibling;e&&h(Ds(o),e)}}Ho((()=>{if(Ds(o)){u();const t=new MutationObserver((()=>{const t=Ds(o).querySelector(".step-button.active");t&&go(s,t,!0)}));return t.observe(Ds(o),{attributes:!0,attributeFilter:["class"],subtree:!0}),()=>{t.disconnect()}}})),Ho((()=>{Ds(s)&&Ds(o)&&h(Ds(o),Ds(s))}));var m=Xs();js("resize",Ao,u),function(t,e,n){gi&&ki();var i=new ua(t);Jo((()=>{var t=e();i.ensure(t,n)}))}(Lo(m),(()=>r().activeItemIndex),(t=>{var e=jc(),n=Do(e);let i;n.__click=f;var s=Bo(n,2);let d;va(s,21,(()=>Ds(c)),pa,((t,e)=>{var n=Uc();let i;n.__click=t=>{return n=t.currentTarget,i=Ds(e).index,r().activeModuleIndex=i,void h(Ds(o),n);var n,i};var s=Do(n),a=Do(s,!0);xi(s),xi(n),Qo((()=>{i=Sa(n,1,"step-button svelte-1mxltt0",null,i,{active:"active"===Ds(e).type}),Ba(n,"aria-label",`Go to step $${Ds(e).index+1}`),ia(a,Ds(e).name)})),Ys(t,n)})),xi(s),Ga(s,(t=>go(o,t)),(()=>Ds(o)));var m=Bo(s,2);let v;m.__click=p,xi(e),Qo(((t,e)=>{i=Sa(n,1,"step-arrow step-arrow-prev svelte-1mxltt0",null,i,{visible:Ds(a)}),d=Sa(s,1,"steps-indicator svelte-1mxltt0",null,d,t),Na(s,`--stepDuration: ${null!=e?e:""}s`),v=Sa(m,1,"step-arrow step-arrow-next svelte-1mxltt0",null,v,{visible:Ds(l)})}),[()=>({"with-duration":r().currentModule.hasDuration,paused:r().paused}),()=>r().currentModule.duration]),js("scroll",s,u),Ys(t,e)})),Ys(t,m),Bi()}qs(["click"]);const Gc="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.01318%203.42005C3.01318%202.06672%204.50652%201.26672%205.66652%201.90672C6.82652%202.54672%2014.0732%206.48672%2014.0732%206.48672C15.2865%207.15339%2015.2865%208.86005%2014.0732%209.52005L5.66652%2014.1001C4.50652%2014.7334%203.01318%2013.9401%203.01318%2012.5801V3.42005ZM3.98652%2012.5801C3.98652%2013.1334%204.63318%2013.5467%205.19985%2013.2401L13.6065%208.66005C14.1399%208.36672%2014.1465%207.63339%2013.6065%207.34005C13.0665%207.04672%205.19985%202.76005%205.19985%202.76005C4.63985%202.44672%203.98652%202.86005%203.98652%203.42005V12.5801Z'%20fill='%23030303'/%3e%3c/svg%3e",Hc="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M10.8332%2014C10.5598%2014%2010.3332%2013.7733%2010.3332%2013.5V2.5C10.3332%202.22667%2010.5598%202%2010.8332%202C11.1065%202%2011.3332%202.22667%2011.3332%202.5V13.5C11.3332%2013.7733%2011.1065%2014%2010.8332%2014ZM5.1665%2014C4.89317%2014%204.6665%2013.7733%204.6665%2013.5V2.5C4.6665%202.22667%204.89317%202%205.1665%202C5.43984%202%205.6665%202.22667%205.6665%202.5V13.5C5.6665%2013.7733%205.43984%2014%205.1665%2014Z'%20fill='%23030303'/%3e%3c/svg%3e";var Kc=Ks('<img alt="Play" class="svelte-a3r6re"/>'),Xc=Ks('<img alt="Pause" class="svelte-a3r6re"/>'),Yc=Ks('<button class="pause-button svelte-a3r6re"><!></button>');const Qc={hash:"svelte-a3r6re",code:".pause-button.svelte-a3r6re {position:absolute;top:10px;right:10px;background:#FFFFFF;border-radius:100%;border:1px #C4C8CF solid;padding:0;width:32px;height:32px;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:#F6F6F7;}.pause-button.svelte-a3r6re:active {background:#E4E5E8;}.pause-button.svelte-a3r6re:focus {outline-offset:8px;outline-width:2px;}.pause-button.svelte-a3r6re img:where(.svelte-a3r6re) {width:16px;height:16px;pointer-events:none;}"};qs(["click"]);const Jc=300,Zc=60,tu="none";function eu(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function nu(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 iu(t,e,n,i,r){const o=nu(t,n,i);return t.dispatchEvent(new CustomEvent(`${e}${r}`,{detail:o})),o}function ru(){let t=[],e=()=>{},n=[];return{setPointerControls:(i,r,o,s,a,l=tu,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=iu(r,i,e,t,"down");function c(e){const o=t.length;t=function(t,e){return e.filter((e=>So(t.pointerId,e.pointerId,!1)))}(e,t);if(o>t.length){t.length||(u(),d(),h(),f());const o=iu(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=eu(r,"pointermove",(e=>{t=t.map((t=>So(e.pointerId,t.pointerId)?e:t));const s=iu(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=eu(r,"lostpointercapture",(t=>{c(t)})),h=eu(r,"pointerup",(t=>{c(t)})),f=eu(r,"pointerleave",(t=>{c(t)}))};e=eu(r,"pointerdown",l)}return{destroy:()=>{t.length||(e(),n.forEach((t=>{var e;null===(e=t.onDestroy)||void 0===e||e.call(t)})))}}}}}const ou="@attach";const su="swipe";function au(t,e,n,i=!1){const{setPointerControls:r}=ru(),o=i?su:Symbol(ou);return{...n,[`on${su}`]:t,[o]:t=>{const{onDown:n,onUp:i,parameters:o}=function(t,e){const n={timeframe:Jc,minSwipeDistance:Zc,touchAction:tu,composed:!1,...e};let i,r,o,s;function a(t,e){r=e.clientX,o=e.clientY,i=Date.now(),So(t.length,1)&&(s=e.target)}function l(e,a){if(So(a.type,"pointerup")&&So(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(su,{detail:{direction:u,target:s,pointerType:a.pointerType}}))}}return{onDown:a,onUp:l,parameters:n}}(t,null==e?void 0:e());return r(su,t,null,n,i,o.touchAction,o.plugins).destroy}}}const lu=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,So(u.x,void 0,!1)&&So(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)=>{So(e.length,0)&&m()},onDestroy:m,onInit:t=>{t.length&&(u.x=void 0,u.y=void 0,p())}}};var cu=Ks("<div></div>");const uu={hash:"svelte-1fv6njc",code:".swiper.svelte-1fv6njc {position:absolute;top:0;left:0;pointer-events:auto;width:100%;height:100%;}"};var du=Ks("<img/>"),hu=Ks('<div class="ui-container svelte-1rvgxfc"><!></div>'),fu=Ks('<div class="cover-container svelte-1rvgxfc"><!> <!> <!></div>'),pu=Ks('<div class="covers-container svelte-1rvgxfc" style="scroll-behavior: auto;"></div>');const mu={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;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.hidden.svelte-1rvgxfc {opacity:0;}.cover-image.hidden.force-show.svelte-1rvgxfc {opacity:1;background:transparent;}.ui-container.svelte-1rvgxfc {position:absolute;top:0;left:0;bottom:0;right:0;pointer-events:none;}"};function vu(t,e){Li(e,!0),ka(t,mu);const n=[375,768,1024,1400,1920];let i=Ka(e,"scrollOffset",15),r=Ka(e,"isMobile",3,!1);const o=Di("state");let s,a=io((()=>o().playingModulePosition)),l=null,c=null,u=io((()=>o().startedPlaying)),d=io((()=>o().currentModulesList)),h=io((()=>Ds(d).findIndex((t=>f(o().playingModulePosition,t.position)))));function f(t,e){return t.itemIndex===e.itemIndex&&t.moduleIndex===e.moduleIndex}function p(t){const e=t.scrollLeft,n=t.scrollWidth-t.clientWidth;return 0===e?0:e>n?100:e/n*100}function m(t){var e;r()&&t.preventDefault();const{target:n}=t,u=p(n),m=(null===(e=Ds(d))||void 0===e?void 0:e.length)||1,v=100/(m-1||1),g=Math.round(u/v);let y=Math.min(g,m-1);const b=Ds(d)[y],k={itemIndex:o().activeItemIndex,moduleIndex:o().activeModuleIndex};if(!l){const t=s.children[Ds(h)],e=s.getBoundingClientRect(),n=t.getBoundingClientRect();i(n.x-e.x)}c&&clearTimeout(c),c=setTimeout((()=>{const t=p(n);Math.abs(t-g*v)<.25&&async function(){o().seeking&&(o().playerLoaded?o().currentItemsList[o().activeItemIndex].modules[o().activeModuleIndex].play():o().playingModulePosition=Ds(a),i(0))}()}),l?0:150),null!==l||f(b.position,k)?null!==l&&f(b.position,l)&&(l=null):(o().activeItemIndex=b.position.itemIndex,o().activeModuleIndex=b.position.moduleIndex),go(a,b.position)}function v(){}Ho((()=>{const{activeItemIndex:t,activeModuleIndex:e}=o();t===Ds(a).itemIndex&&e===Ds(a).moduleIndex||zs((()=>{var n,i;const r=Ds(d).findIndex((n=>{const{itemIndex:i,moduleIndex:r}=n.position;return t===i&&e===r}));l=(null===(n=Ds(d)[r])||void 0===n?void 0:n.position)||null;const o=null===(i=s)||void 0===i||null===(i=i.children)||void 0===i?void 0:i[r];if(!s||!o)return;const a=s.getBoundingClientRect(),c=o.getBoundingClientRect();let u=s.scrollLeft+(c.left-a.left);const h=Math.max(0,s.scrollWidth-s.clientWidth);u=Math.max(0,Math.min(h,u)),s.scrollTo({left:u,behavior:"auto"})}))})),Ho((()=>{Ds(u)&&zs((()=>{}))}));var g=Xs(),y=Lo(g),b=t=>{var i=pu();va(i,23,(()=>Ds(d)),(t=>t.id),((t,i,o)=>{var s=fu(),a=Do(s),l=t=>{var r=du();let s;Qo((t=>{s=Sa(r,1,"cover-image svelte-1rvgxfc",null,s,{hidden:Ds(u)&&Ds(o)===Ds(h),"force-show":Ds(i).showCover}),Ba(r,"src",t),Ba(r,"alt",Ds(i).name),Ba(r,"fetchpriority",0===Ds(o)?"high":"auto")}),[()=>e.gallery.getCoverUrl(Ds(i).cover,n[n.length-1])]),js("load",r,(function(...t){var e;null===(e=0===Ds(o)?v:()=>{})||void 0===e||e.apply(this,t)})),function(t){if(!gi)return;t.removeAttribute("onload"),t.removeAttribute("onerror");const e=t.__e;void 0!==e&&(t.__e=void 0,queueMicrotask((()=>{t.isConnected&&t.dispatchEvent(e)})))}(r),Ys(t,r)};fa(a,(t=>{t(l)}));var c=Bo(a,2),d=t=>{!function(t,e){Li(e,!0),ka(t,uu);const n={color:"#e3e3e3",fadeTime:300,lineWidth:8};function i(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])}}var r=cu();za(r,(t=>({...t,class:"swiper"})),[()=>au(i,(()=>({touchAction:"pan-y",plugins:e.debug?[lu(n)]:[]})))],void 0,void 0,"svelte-1fv6njc"),Ys(t,r),Bi()}(t,{get gallery(){return e.gallery},get debug(){return e.debug},get onEvent(){return e.onEvent}})};fa(c,(t=>{r()&&t(d)}));var f=Bo(c,2),p=t=>{var e=hu();!function(t,e,n){gi&&ki();var i=new ua(t);Jo((()=>{var t,r=null!==(t=e())&&void 0!==t?t:null;i.ensure(r,r&&(t=>n(t,r)))}),Kn)}(Do(e),(()=>Ds(i).Component),((t,e)=>{e(t,{get state(){return Ds(i).state},get isMobile(){return r()}})})),xi(e),Ys(t,e)};fa(f,(t=>{var e;null!==(e=Ds(i))&&void 0!==e&&e.Component&&t(p)})),xi(s),Ys(t,s)})),xi(i),Ga(i,(t=>s=t),(()=>s)),js("scroll",i,m),Ys(t,i)};fa(y,(t=>{Ds(d)&&t(b)})),Ys(t,g),Bi()}const gu="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};let yu;function bu(){const t=gu&&gu.navigator&&(gu.navigator.userAgent||gu.navigator.platform||gu.navigator.vendor)||"";if(yu&&yu.ua===t)return yu;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 yu={ua:t,isMobile:r},yu}"undefined"!=typeof window&&window.addEventListener("pageshow",(function(t){t.persisted&&setTimeout((function(){window.location.reload()}),10)}),!1);var ku=Ks('<div class="paging-buttons svelte-1n46o8q"><!> <!></div>'),xu=Ks('<div style="position: absolute; top: 0; left: 0; width: 100%;"></div>'),wu=Ks("<!> <!>",1),_u=Ks('<div class="player-container svelte-1n46o8q"><div class="player-div swipable svelte-1n46o8q"></div> <!> <!> <!> <!></div> <!>',1),Tu=Ks('<div class="eko-gallery-app svelte-1n46o8q"><!></div>');const Iu={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:#FFFFFF;box-shadow: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:"Human BBY Digital", sans-serif;}.player-container.svelte-1n46o8q {position:relative;flex:1;width:100%;pointer-events:none;overflow:hidden;display:flex;align-items:center;justify-content:center;}.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 Eu(t,e){Li(e,!0),ka(t,Iu);const n=Ka(e,"config",19,(()=>({}))),i=Ka(e,"forceMobile",3,!1),r=Ka(e,"videoAspectRatio",3,"unset"),o=Ka(e,"onGalleryReady",3,(()=>{})),s=Ka(e,"onEvent",3,(()=>{}));let a,l=!1,c=mo(new Nc(n())),u=mo(null),d=io((()=>i()||bu().isMobile)),h=mo(0),f=mo(void 0),p=mo(!0),m=mo(_o({width:"100%",height:"100%"}));var v,g,y;function b(){const t={AssetsDeliveryService:{assetsDeliveryServiceUrl:Ds(c).urls.assetsDeliveryBase}};go(u,new e.EkoPlayer(a,Object.assign(t,e.playerOptions))),Ds(u).on("playing",(()=>{Ds(c).state.paused=!1})),Ds(u).on("pause",(()=>{Ds(c).state.paused=!0})),Ds(u).once("playing",(()=>{Ds(c).state.startedPlaying=!0,s()("galleryloaded")}))}function k(t){var e;null===(e=Ds(c))||void 0===e||e.selectItem(t)}function x(){var t;null===(t=Ds(c))||void 0===t||t.next()}function w(){var t;null===(t=Ds(c))||void 0===t||t.prev()}function _(){Ds(u).paused?Ds(u).play():Ds(u).pause()}function T(){return`--uiTranformX: ${Ds(h)}px;--videoAspect: ${r()};--videoWidth: ${Ds(m).width};--videoHeight: ${Ds(m).height};`}v="state",g=()=>Ds(c).state,zi("setContext").set(v,g),y=()=>(o()(Ds(c).public),n()&&e.EkoPlayer&&(b(),Ds(c).start(Ds(u))),()=>{var t;null===(t=Ds(u))||void 0===t||t.dispose()}),null===Mi&&di("onMount"),Ho((()=>{const t=zs(y);if("function"==typeof t)return t})),Ho((()=>{n()&&e.EkoPlayer&&(l?zs((()=>{var t;go(c,new Nc(n())),null===(t=Ds(u))||void 0===t||t.dispose(),go(p,!1),Rs().then((()=>(go(p,!0),Rs()))).then((()=>{o()(Ds(c).public),b(),Ds(c).start(Ds(u))}))})):l=!0)})),Ho((()=>{Ds(f)&&Ds(u)&&Ds(u).loadDebugOverlay({containerElement:Ds(f)})})),Ho((()=>{if("unset"!==r()&&r().includes("/")){const[t,e]=r().split("/").map((t=>Number(t)));isNaN(t)||isNaN(e)||go(m,t>e?{width:"100%",height:"auto"}:{width:"auto",height:"100%"},!0)}else go(m,{width:"100%",height:"100%"},!0)}));var I=Tu(),E=Do(I),S=t=>{var n=_u(),i=Lo(n),r=Do(i);Ga(r,(t=>a=t),(()=>a));var o=Bo(r,2);vu(o,{get isMobile(){return Ds(d)},get gallery(){return Ds(c)},get debug(){return e.debug},get onEvent(){return s()},get scrollOffset(){return Ds(h)},set scrollOffset(t){go(h,t,!0)}});var l=Bo(o,2),u=t=>{var e=ku(),n=Do(e);$c(n,{type:"prev",onClick:w}),$c(Bo(n,2),{type:"next",onClick:x}),xi(e),Ys(t,e)};fa(l,(t=>{Ds(d)||e.hideNav||t(u)}));var p=Bo(l,2),m=t=>{Vc(t,{})};fa(p,(t=>{var e;!Ds(d)&&(null===(e=Ds(c).state.currentItem)||void 0===e?void 0:e.modules.length)>1&&t(m)}));var v=Bo(p,2),g=t=>{var n=wu(),i=Lo(n);!function(t,e){Li(e,!0),ka(t,Qc);const n=Di("state");var i=Yc();i.__click=function(...t){var n;null===(n=e.onPauseClick)||void 0===n||n.apply(this,t)};var r=Do(i),o=t=>{var e=Kc();Qo((()=>Ba(e,"src",Gc))),Ys(t,e)},s=t=>{var e=Xc();Qo((()=>Ba(e,"src",Hc))),Ys(t,e)};fa(r,(t=>{n().paused?t(o):t(s,!1)})),xi(i),Qo((t=>Ba(i,"aria-label",t)),[()=>n().paused?"Play":"Pause"]),Ys(t,i),Bi()}(i,{onPauseClick:_});var r=Bo(i,2),o=t=>{var e=xu();Ga(e,(t=>go(f,t)),(()=>Ds(f))),Ys(t,e)};fa(r,(t=>{e.debug&&t(o)})),Ys(t,n)};fa(v,(t=>{Ds(c).state.startedPlaying&&t(g)})),xi(i);var y=Bo(i,2),b=t=>{!function(t,e){Li(e,!0),ka(t,Lc);let n=Ka(e,"onNavItemClick",3,(()=>{}));const i=Di("state");var r=Dc(),o=Do(r);va(o,23,(()=>i().currentItemsList),(t=>t.id),((t,e,r)=>{var o=Rc();let s;o.__click=()=>n()(Ds(r));var a=Do(o),l=Do(a,!0);xi(a),xi(o),Qo((t=>{s=Sa(o,1,"nav-button svelte-er27y2",null,s,t),ia(l,Ds(e).name)}),[()=>({selected:Ds(r)===i().activeItemIndex})]),Ys(t,o)})),xi(o),xi(r),Ys(t,r),Bi()}(t,{onNavItemClick:k})};fa(y,(t=>{e.hideNav||t(b)})),Qo((t=>Na(i,t)),[T]),Ys(t,n)};fa(E,(t=>{n()&&Ds(p)&&t(S)})),xi(I),Ys(t,I),Bi()}function Su(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Au,Nu,Mu,Fu,Cu={exports:{}},Ou=Su((Au||(Au=1,Mu=Cu.exports,Fu=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},(Nu=Cu).exports?Nu.exports=Fu():Mu.log=Fu()),Cu.exports));const Pu=()=>{},Ru=["trace","log","debug","info","warn","error","getLevel","setLevel"],Du=["trace","debug","info","warn","error","silent"],Lu={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;"},Bu="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global;let zu={level:"trace",appName:""},Wu=[];const $u="object"==typeof Bu&&Bu.performance&&"function"==typeof Bu.performance.now?Bu.performance.now.bind(Bu.performance):Date.now.bind(Date),Uu=t=>t&&"string"==typeof t?t.toLowerCase().trim():"",ju=(()=>{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[Uu(e)]=Uu(i)||"trace"})),n}catch(t){return{}}})(),qu=(t,e="")=>{const n=Uu(t),i=Ou.getLogger(n);if(i.__ekologger)return i.__ekologger;e||ju[n]||ju["*"]||(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)=>($u()/1e3).toFixed(e))()}] %c[${s}] ${zu.appName?`[${zu.appName}] `:""}[${t}]`,Lu[s],...e)}},e=ju[n]||ju["*"]||e||zu.level,i.setLevel(e,!1);const o=(...t)=>i.log(...t);return Ru.forEach((t=>{o[t]=(...e)=>(Wu.forEach((n=>{n[t](...e)})),i[t](...e))})),i.__ekologger=o,o};qu.setDefaults=({appName:t="",level:e})=>{t&&"string"==typeof t&&(zu.appName=t),(e=Uu(e))&&Du.includes(e)&&(zu.level=e,Object.values(Ou.getLoggers()).filter((t=>t.__noExplicitLevel)).forEach((t=>t.setLevel(zu.level,!1))))},qu.installDriver=t=>{const e={...Ru.reduce(((e,n)=>(e[n]="function"==typeof(null==t?void 0:t[n])?t[n]:Pu,e)),{})};Wu.push(e)};let Vu=class{#T=new Map;on(t,e){if("function"!=typeof e)return this;const n=this.#T.get(t)||new Set;return n.add(e),this.#T.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.#T.clear(),this;const n=this.#T.get(t);return n?e?(n.delete(e),0===n.size&&this.#T.delete(t),this):(this.#T.delete(t),this):this}trigger(t,...e){const n=this.#T.get(t);return n?(n.forEach((t=>t(...e))),this):this}};function Gu(t){return"[object Object]"===Object.prototype.toString.call(t)}function Hu(t,...e){const n=Gu(t)?{...t}:{};return e.forEach((t=>{Gu(t)&&Object.keys(t).forEach((e=>{const i=t[e],r=n[e];Gu(i)&&Gu(r)?n[e]=Hu(r,i):Array.isArray(i)?n[e]=i.slice():n[e]=i}))})),n}function Ku(t){if("string"==typeof t)return`'${t}'`;if(Array.isArray(t))return`[${t.map((t=>Ku(t))).join(", ")}]`;if(Gu(t))try{return JSON.stringify(t)}catch(t){return"[object Object]"}return null===t?"null":void 0===t?"undefined":String(t)}function Xu(t){return Array.from(t).map((t=>Ku(t))).join(", ")}var Yu=new WeakSet;let Qu=class extends Vu{constructor(...t){super(),O(this,Yu);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=qu(n,this.loglevel);const i=Gu(this.defaults)?this.defaults:{},r=Gu(e)&&Gu(e[n])?e[n]:{};this.settings=Hu({},i,r),A(Yu,this,Ju).call(this),A(Yu,this,Zu).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 Ju(){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}(${Xu(t)})`),a(...t)):a,t.add(o)}n=Object.getPrototypeOf(n)}}function Zu(){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 td="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};function ed(t){return Boolean(t)&&"object"==typeof t&&1===t.nodeType&&"function"==typeof t.appendChild}let nd=class extends Qu{#I;#E;#S;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);const[i]=t,r=function(t,e=(null==td?void 0:td.document)){if(ed(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 ed(i)?i:null}(i);if(!r)throw new Error("Canvas requires a valid mount target (HTMLElement or selector string).");this.#I=r;const o=null==td?void 0:td.document;if(!o||"function"!=typeof o.createElement)throw new Error("Canvas requires document.createElement.");var s,a;this.#E=o.createElement("canvas"),s=this.#E,a=null===(e=this.settings)||void 0===e?void 0:e.style,s&&a&&"object"==typeof a&&!Array.isArray(a)&&Object.keys(a).forEach((t=>{const e=a[t];null!=e&&(s.style[t]=String(e))})),this.#I.appendChild(this.#E);const l=null===(n=this.settings)||void 0===n?void 0:n.contextAttributes,c=l&&"object"==typeof l&&!Array.isArray(l)?l:void 0;if(this.#S=this.#E.getContext("webgl2",c),!this.#S)throw new Error("Canvas WebGL2 context is not available.")}get name(){return"Canvas"}get element(){return this.#E}get gl(){return this.#S}onDispose(){this.#E&&this.#E.parentNode&&this.#E.parentNode.removeChild(this.#E),this.#S=null,this.#E=null,this.#I=null}};var id=new WeakMap,rd=new WeakMap,od=new WeakMap,sd=new WeakMap,ad=new WeakMap,ld=new WeakMap,cd=new WeakSet;let ud=class extends Qu{get name(){return"ContainerSize"}get containerWidth(){return M(rd,this)}get containerHeight(){return M(od,this)}get width(){return M(rd,this)}get height(){return M(od,this)}constructor(...t){super(...t),O(this,cd),F(this,id,void 0),F(this,rd,0),F(this,od,0),F(this,sd,null),F(this,ad,null),F(this,ld,null);const[e]=t;var n;C(id,this,(n=e)&&n.element&&ed(n.element)?n.element:ed(n)?n:null),M(id,this)&&(A(cd,this,hd).call(this,!0),A(cd,this,dd).call(this))}onDispose(){M(sd,this)&&"function"==typeof M(sd,this).disconnect&&M(sd,this).disconnect(),C(sd,this,null),M(ld,this)&&"function"==typeof(null==td?void 0:td.removeEventListener)&&td.removeEventListener("resize",M(ld,this)),C(ld,this,null),M(ad,this)&&((null==td?void 0:td.clearInterval)||clearInterval)(M(ad,this)),C(ad,this,null),C(id,this,null)}};function dd(){if(!M(id,this))return;const t=null==td?void 0:td.ResizeObserver;if("function"==typeof t)return C(sd,this,new t((()=>A(cd,this,hd).call(this)))),void M(sd,this).observe(M(id,this));C(ld,this,(()=>A(cd,this,hd).call(this))),"function"==typeof(null==td?void 0:td.addEventListener)&&td.addEventListener("resize",M(ld,this));const e=(null==td?void 0:td.setInterval)||setInterval;C(ad,this,e((()=>A(cd,this,hd).call(this)),250))}function hd(t=!1){if(!M(id,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}}(M(id,this));(t||e!==M(rd,this)||n!==M(od,this))&&(C(rd,this,e),C(od,this,n),this.trigger("containerresize",{width:e,height:n}))}var fd={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"}};let pd=class{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;return{contextType:e||"webgl",contextAttributes:Object.prototype.hasOwnProperty.call(t,"contextAttributes")?n:r}}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 md,vd={exports:{}},gd=(md||(md=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}(vd)),vd.exports),yd=Su(gd);let bd=class extends pd{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 yd;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);const a={contextType:r};s&&void 0!==o&&(a.contextAttributes=o),t.initPlugin("canvas",a);const l={drawFrame:this.canvasDrawFrameFn.bind(this),resize:n,contextType:r,offscreenVideoCanvasEnabled:!1,viewportModeEnabled:!0,fps:0};return s&&void 0!==o&&(l.contextAttributes=o),t.canvas.init(l),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)}},kd=class extends pd{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)}},xd=class extends pd{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 wd=function(t){let e;return e="string"==typeof t?new kd(t):t&&t.src&&t.dest?new xd(t):new bd(t),e};function _d(t){return Array.isArray(t)||(t=[t]),t}let Td=class{constructor(t){this.store=t?{...t.get()}:{}}reset(){this.store={}}get(t){if(!t)return this.store;const e=(t=_d(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=_d(t),e=_d(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]}))}},Id=class{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 Ed=qu("frame","warn");let Sd=!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");Sd=e||n}function Ad(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))}let Nd=class extends Id{fill(t){if(Sd&&(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?Ad(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,Ad(t,e)):t.__useSubImage=!0))}(this,t,e);const i=(performance.now()-n)/1e3;i>=.1&&Ed.warn(`[fill] texImage2D() took ${i.toFixed(3)} seconds to execute.`),"function"==typeof t.close&&!0!==t.__keepOpen&&(t.close(),t.__closed=!0)}},Md=class extends Id{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 Fd=function(t,e,n,i,r){let o;switch(t){case"frame":o=new Nd(e,n,i,r);break;case"pixel":o=new Md(e,n,i,r);break;default:throw new Error(`cant recognize type ${t}`)}return o};let Cd=class{constructor(t){return this.gl=t.gl,this.textureObjectPool=[],this.textureUnitsPool=new Set(Array(20).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=Fd(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(20).keys()),t.forEach((t=>{this.textureUnitsPool.delete(t)}))}};const Od=fd.VIDEO_SOURCE_PREFIX,Pd=fd.TEXTURE_SOURCE_PREFIX,Rd=fd.PREVIOUS_OUTPUT_PREFIX,Dd=fd.SAVED_FRAME_PREFIX;function Ld(t,e,n){t.set(`${Od}${n}`,e)}function Bd(t,e,n){t.set(`${Rd}${n}`,e)}function zd(t,e,n){t.set(`${Dd}${n}`,e)}let Wd=class{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()))Ld(t,n,e),Bd(t,n,e);for(const[e,n]of Object.entries(this.capturedFramesManager.getSavedFrames()))zd(t,n,e)}setTextureSource(t,e,n){t.set(`${Pd}${n}`,e)}getInput(t,e){return t.get(e)}getPrevOutput(t,e){return e=Number.isInteger(e)?e:0,t.get(`${Rd}${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)=>{Bd(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))}))}},$d=class{constructor(t){this.context=t}bind(){throw new Error("impl in concrete")}},Ud=100,jd=100;function qd(t,e){Ud=t,jd=e}let Vd=class extends $d{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),qd(i,r)),t}},Gd=class extends $d{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),!1!==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 Hd{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===fd.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS?new Vd({gl:this.gl}):new Gd({gl:this.gl,textureManager:this.textureManager,frameBufferObject:this.getFrameBufferObject(),useCanvasSizedFilterTargets:this.useCanvasSizedFilterTargets}),e}}function Kd(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 Xd=function(t,e){return Kd(t,t.VERTEX_SHADER,e)},Yd=function(t,e){return Kd(t,t.FRAGMENT_SHADER,e)};const Qd={position_3d:0,texture_coordinate_2d:1};var Jd=function(t,e,n){const i=t.createProgram();if(t.attachShader(i,e),t.attachShader(i,n),Object.entries(Qd).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)},Zd=[-1,-1,1,1,-1,1,-1,1,1,1,1,1],th=[0,1,2,2,1,3],eh=[0,0,1,0,0,1,1,1];const nh=96,ih=[new Float32Array(new ArrayBuffer(nh)),new Float32Array(new ArrayBuffer(nh)),new Float32Array(new ArrayBuffer(nh)),new Float32Array(new ArrayBuffer(nh)),new Float32Array(new ArrayBuffer(nh)),new Float32Array(new ArrayBuffer(nh))],rh=[new Int16Array(6),new Int16Array(6),new Int16Array(6)];class oh{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=ih[this.floatBufferCounter],this.floatBufferCounter=this.floatBufferCounter++%ih.length;break;case this.gl.ELEMENT_ARRAY_BUFFER:t=rh[this.unit16BufferCounter],this.unit16BufferCounter=this.unit16BufferCounter++%rh.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 sh={position_3d:class extends oh{getPointerData(){return{size:3,type:this.gl.FLOAT,normalize:!1,stride:0,offset:0}}},position_indexes:class extends oh{setPointer(){}getPointerData(){}enable(){}},texture_coordinate_2d:class extends oh{getPointerData(){return{size:2,type:this.gl.FLOAT,normalize:!0,stride:0,offset:0}}}};var ah=function(t,e,n){const i=sh[t];if(!i)throw new Error(`${t} is not a attribute name,choose from list: ${Object.keys(sh)}`);return new i(t,e,n)};class lh{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}}let ch=class extends lh{set(t){this.gl.uniform1fv(this.location,t)}};class uh extends lh{set(t){t&&(t.beforeUse(),this.gl.uniform1i(this.location,t.getUnit()))}}const dh="first_texture_dimensions",hh="viewport_dimensions",fh="time",ph={RUNTIME_OPTIONS:"runtimeOptions[0]",STATIC_OPTIONS:"staticOptions[0]",FIRST_TEXTURE:"first_texture",SECOND_TEXTURE:"second_texture",FIRST_MATRIX:"first_mat4"},mh={[ph.FIRST_TEXTURE]:uh,[ph.SECOND_TEXTURE]:uh,[ph.FIRST_MATRIX]:class extends lh{set(t){this.gl.uniformMatrix4fv(this.location,!1,t)}},[ph.STATIC_OPTIONS]:ch,[ph.RUNTIME_OPTIONS]:ch};var vh=function(t,e){const n=mh[t];if(!n)throw new Error(`${t} is not a attribute name,choose from list: ${Object.keys(mh)}`);return new n(t,e)},gh=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 yh="position_3d",bh="position_indexes",kh="texture_coordinate_2d";class xh{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=Xd(this.gl,e.vertex),this.fragmentShader=Yd(this.gl,e.fragment),this.program=Jd(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:yh,bindPoint:e.gl.ARRAY_BUFFER},{id:bh,bindPoint:e.gl.ELEMENT_ARRAY_BUFFER},{id:kh,bindPoint:e.gl.ARRAY_BUFFER}].concat(t)).forEach((t=>{const i=t.id;n[i]=ah(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]=vh(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:ph.RUNTIME_OPTIONS},{id:ph.STATIC_OPTIONS}];return(t.getUniformList||xh.getUniformList)().forEach((t=>{Object.values(ph).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||xh.getUniformList)().forEach((t=>{switch(t){case ph.FIRST_TEXTURE:this.uniforms[ph.FIRST_TEXTURE].set(r[0]);break;case ph.SECOND_TEXTURE:this.uniforms[ph.SECOND_TEXTURE].set(r[1]);break;case dh:o=[...o,r[0].getWidth(),r[0].getHeight()];break;case hh:o=[...o,i.width,i.height];break;case fh:{const t=gh(e.startTime,e.duration);o=[...o,t];break}}})),o.length>0&&this.uniforms[ph.RUNTIME_OPTIONS].set(o)}static getUniformList(){return[ph.FIRST_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(){}handleAttributes(){this.attributes[yh].fillBuffer(Zd),this.attributes[yh].setPointer(),this.attributes[bh].fillBuffer(th),this.attributes[kh].fillBuffer(eh),this.attributes[kh].setPointer()}disposeAttributes(){Object.values(this.attributes).forEach((t=>{t.dispose()}))}render(t,e){const n=this.frameBuffer.bind(t);let i={width:Ud,height:jd};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 wh extends xh{constructor(t){const e={uniforms:xh.getUniformInfo(wh)};super(wh.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 _h,Th="undefined"!=typeof Float32Array?Float32Array:Array;function Ih(){var t=new Th(3);return Th!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Eh(t,e,n){var i=new Th(3);return i[0]=t,i[1]=e,i[2]=n,i}function Sh(){var t=new Th(4);return Th!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}Ih(),function(){var t;t=new Th(4),Th!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}(),Ih(),Eh(1,0,0),Eh(0,1,0),Sh(),Sh(),_h=new Th(9),Th!=Float32Array&&(_h[1]=0,_h[2]=0,_h[3]=0,_h[5]=0,_h[6]=0,_h[7]=0),_h[0]=1,_h[4]=1,_h[8]=1;class Ah extends xh{constructor(t){const e={uniforms:xh.getUniformInfo(Ah)};super(Ah.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:Ah.getInitialOptions().translate.x},{properties:["translate","y"],type:"slider",minValue:-2,maxValue:2,step:.001,initialValue:Ah.getInitialOptions().translate.y},{properties:["scale","x"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:Ah.getInitialOptions().scale.x},{properties:["scale","y"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:Ah.getInitialOptions().scale.y},{properties:["rotate"],type:"slider",minValue:-360,maxValue:360,step:1,initialValue:Ah.getInitialOptions().rotate}]}static getUniformList(){return[ph.FIRST_TEXTURE,ph.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 Th(16),Th!=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}(Sh(),0,0,o),Eh(e,n,0),Eh(i,r,1)),this.uniforms[ph.FIRST_MATRIX].set(this.transformMatrix)}}class Nh extends xh{constructor(t){const e={uniforms:xh.getUniformInfo(Nh)};super(Nh.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[ph.FIRST_TEXTURE,dh]}}class Mh extends xh{constructor(t){const e={uniforms:xh.getUniformInfo(Mh)};super(Mh.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[ph.FIRST_TEXTURE,dh]}}class Fh extends xh{constructor(t){const e={uniforms:xh.getUniformInfo(Fh)};super(Fh.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[ph.FIRST_TEXTURE,dh,hh]}handleStaticUniforms(t){var e;const n=(null!==(e=Number.parseFloat(t.offsetDist))&&void 0!==e?e:4).toFixed(3);this.uniforms[ph.STATIC_OPTIONS].set([n])}}class Ch extends xh{constructor(t){const e={uniforms:xh.getUniformInfo(Ch)};super(Ch.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[ph.FIRST_TEXTURE,dh,hh]}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[ph.STATIC_OPTIONS].set([i,r])}}class Oh extends xh{constructor(t){const e={uniforms:xh.getUniformInfo(Oh)};super(Oh.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[ph.STATIC_OPTIONS].set([e])}}class Ph extends xh{constructor(t){const e={uniforms:xh.getUniformInfo(Ph)};super(Ph.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[ph.FIRST_TEXTURE,dh,ph.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[ph.STATIC_OPTIONS].set([e,n,i,r,o,s,a])}}class Rh extends xh{constructor(t){const e={uniforms:xh.getUniformInfo(Rh)};super(Rh.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[ph.FIRST_TEXTURE,ph.SECOND_TEXTURE]}}class Dh extends xh{constructor(t){const e={uniforms:xh.getUniformInfo(Dh)};super(Dh.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[ph.FIRST_TEXTURE,ph.SECOND_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(t){const e=Number.parseFloat(t.lutSize).toFixed(1);this.uniforms[ph.STATIC_OPTIONS].set([e])}}var Lh="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",Bh='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:zh,cos:Wh,sin:$h,acos:Uh,atan2:jh,sqrt:qh,pow:Vh}=Math;function Gh(t){return t<0?-Vh(-t,1/3):Vh(t,1/3)}const Hh=Math.PI,Kh=2*Hh,Xh=Hh/2,Yh=Number.MAX_SAFE_INTEGER||9007199254740991,Qh=Number.MIN_SAFE_INTEGER||-9007199254740991,Jh={x:0,y:0,z:0},Zh={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),qh(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],Jh],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||Zh.approximately(t,e)||Zh.approximately(t,n)},approximately:function(t,e,n){return zh(t-e)<=(n||1e-6)},length:function(t){const e=Zh.Tvalues.length;let n=0;for(let i,r=0;r<e;r++)i=.5*Zh.Tvalues[r]+.5,n+=Zh.Cvalues[r]*Zh.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(Zh.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 jh(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 qh(n*n+i*i)},closest:function(t,e){let n,i,r=Vh(2,63);return t.forEach((function(t,o){i=Zh.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=Vh(t,e)+Vh(1-t,e);return zh((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=Vh(1-t,e);return n/(Vh(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 Zh.lli8(r,o,s,a,l,c,u,d)},lli:function(t,e){return Zh.lli4(t,t.c,e,e.c)},makeline:function(t,e){return new uf(t.x,t.y,(t.x+e.x)/2,(t.y+e.y)/2,e.x,e.y)},findbbox:function(t){let e=Yh,n=Yh,i=Qh,r=Qh;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(!Zh.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=Zh.makeline(e.points[i-1],t.points[0]),s=Zh.makeline(t.points[r-1],e.points[0]),a={startcap:o,forward:t,back:e,endcap:s,bbox:Zh.findbbox([o,t,e,s]),intersections:function(t){return Zh.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=Yh,s=Qh;-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=-jh(e.p2.y-i,e.p2.x-n);return t.map((function(t){return{x:(t.x-n)*Wh(r)-(t.y-i)*$h(r),y:(t.x-n)*$h(r)+(t.y-i)*Wh(r)}}))},roots:function(t,e){e=e||{p1:{x:0,y:0},p2:{x:1,y:0}};const n=t.length-1,i=Zh.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=-qh(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(Zh.approximately(l,0)){if(Zh.approximately(c,0))return Zh.approximately(u,0)?[]:[-d/u].filter(r);const t=qh(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=qh(t*t*t),n=-p/(2*e),i=Uh(n<-1?-1:n>1?1:n),o=2*Gh(e);return b=o*Wh(i/3)-c/3,k=o*Wh((i+Kh)/3)-c/3,x=o*Wh((i+2*Kh)/3)-c/3,[b,k,x].filter(r)}if(0===v)return g=m<0?Gh(-m):-Gh(m),b=2*g-c/3,k=-g-c/3,[b,k].filter(r);{const t=qh(v);return g=Gh(-m+t),y=Gh(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=-qh(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=Zh.compute(t,e),h=Zh.compute(t,n),f=d.x*d.x+d.y*d.y;if(i?(o=qh(Vh(d.y*h.z-h.y*d.z,2)+Vh(d.z*h.x-h.z*d.x,2)+Vh(d.x*h.y-h.x*d.y,2)),s=Vh(f+d.z*d.z,1.5)):(o=d.x*h.y-d.y*h.x,s=Vh(f,1.5)),0===o||0===s)return{k:0,r:0};if(c=o/s,u=s/o,!r){const r=Zh.curvature(t-.001,e,n,i,!0).k,o=Zh.curvature(t+.001,e,n,i,!0).k;l=(o-c+(c-r))/2,a=(zh(o-c)+zh(c-r))/2}return{k:c,r:u,dk:l,adk:a}},inflections:function(t){if(t.length<4)return[];const e=Zh.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(Zh.approximately(o,0)){if(!Zh.approximately(s,0)){let t=-a/s;if(0<=t&&t<=1)return[t]}return[]}const l=2*o;if(Zh.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,zh(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 Zh.bboxoverlap(t.left.bbox(),t.right.bbox())}));let u=[];return 0===c.length||(c.forEach((function(t){u=u.concat(Zh.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*Wh(Xh)-r*$h(Xh),l=i*$h(Xh)+r*Wh(Xh),c=o*Wh(Xh)-s*$h(Xh),u=o*$h(Xh)+s*Wh(Xh),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=Zh.lli8(d,h,m,v,f,p,g,y),k=Zh.dist(b,t);let x,w=jh(t.y-b.y,t.x-b.x),_=jh(e.y-b.y,e.x-b.x),T=jh(n.y-b.y,n.x-b.x);return w<T?((w>_||_>T)&&(w+=Kh),w>T&&(x=T,T=w,w=x)):T<_&&_<w?(x=T,T=w,w=x):T+=Kh,b.s=w,b.e=T,b.r=k,b},numberSort:function(t,e){return t-e}};class tf{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 Zh.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++)Zh.expandbox(e,t[n].bbox());return e}offset(t){const e=[];return this.curves.forEach((function(n){e.push(...n.offset(t))})),new tf(e)}}const{abs:ef,min:nf,max:rf,cos:of,sin:sf,acos:af,sqrt:lf}=Math,cf=Math.PI;let uf=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=Zh.align(s,{p1:s[0],p2:s[l]}),d=Zh.dist(s[0],s[l]);this._linear=u.reduce(((t,e)=>t+ef(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=Zh.dist(n,s.C));const a=o*(1-r)/r,l=Zh.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,T={x:t.x+(k-t.x)/r,y:t.y+(x-t.y)/r},I={x:i.x+(w-i.x)/(1-r),y:i.y+(_-i.y)/(1-r)};return new e(t,T,I,i)}static getUtils(){return Zh}getUtils(){return e.getUtils()}static get PolyBezier(){return tf}valueOf(){return this.toString()}toString(){return Zh.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=Zh.derive(this.points,this._3d),this.computedirection()}computedirection(){const t=this.points,e=Zh.angle(t[0],t[this.order],t[1]);this.clockwise=e>0}length(){return Zh.length(this.derivative.bind(this))}static getABC(t=2,e,n,i,r=.5){const o=Zh.projectionratio(r,t),s=1-o,a={x:o*e.x+s*i.x,y:o*e.y+s*i.y},l=Zh.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],Zh.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=Zh.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=Zh.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?Zh.computeWithRatios(t,this.points,this.ratios,this._3d):Zh.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 Zh.compute(t,this.dpoints[0],this._3d)}dderivative(t){return Zh.compute(t,this.dpoints[1],this._3d)}align(){let t=this.points;return new e(Zh.align(t,{p1:t[0],p2:t[t.length-1]}))}curvature(t){return Zh.curvature(t,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return Zh.inflections(this.points)}normal(t){return this._3d?this.__normal3(t):this.__normal2(t)}__normal2(t){const e=this.derivative(t),n=lf(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=lf(e.x*e.x+e.y*e.y+e.z*e.z),r=lf(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=lf(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=Zh.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=Zh.map(0,0,1,this._t1,this._t2),r.left._t2=Zh.map(t,0,1,this._t1,this._t2),r.right._t1=Zh.map(t,0,1,this._t1,this._t2),r.right._t2=Zh.map(1,0,1,this._t1,this._t2),n?(n=Zh.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]=Zh.droots(r),3===this.order&&(r=this.dpoints[1].map(i),t[n]=t[n].concat(Zh.droots(r))),t[n]=t[n].filter((function(t){return t>=0&&t<=1})),e=e.concat(t[n].sort(Zh.numberSort))}.bind(this)),t.values=e.sort(Zh.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]=Zh.getminmax(this,n,t[n])}.bind(this)),e}overlaps(t){const e=this.bbox(),n=t.bbox();return Zh.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=Zh.angle(this.points[0],this.points[3],this.points[1]),e=Zh.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),ef(af(n))<cf/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,ef(n-i)<r)return[];e=t.split(n,i),e._t1=Zh.map(n,0,1,t._t1,t._t2),e._t2=Zh.map(i,0,1,t._t1,t._t2),s.push(e),n=i;break}n<1&&(e=t.split(n,1),e._t1=Zh.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=Zh.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]=Zh.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=lf(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]=Zh.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=Zh.makeline(h[2],d[0]),p=Zh.makeline(d[2],h[0]),m=[f,new e(d),p,new e(h)];return new tf(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 Zh.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=Zh.makeline(v,p),b=Zh.makeline(m,g),k=[y].concat(a).concat([b]).concat(c);return new tf(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=Zh.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=nf(t.p1.x,t.p2.x),n=nf(t.p1.y,t.p2.y),i=rf(t.p1.x,t.p2.x),r=rf(t.p1.y,t.p2.y);return Zh.roots(this.points,t).filter((t=>{var o=this.get(t);return Zh.between(o.x,e,i)&&Zh.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=Zh.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=Zh.dist(t,e),l=Zh.dist(t,o),c=Zh.dist(t,s);return ef(l-a)+ef(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=Zh.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*of(a.e),y:a.y+a.r*sf(a.e)};a.e+=Zh.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 df={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 uf({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 uf(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 uf(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 hf{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{ff(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 ff(t,e,n){let i=t[e];t[e]=t[n],t[n]=i}function pf(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 mf={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 hf(n,i);let o=[];for(let n=0;n<e;n++)o.push(pf(n/(e-1),r,t));return o}};function vf(t,e=256,n={}){return"bezier"===n.type?df.pointsToCurve(t,e,n):mf.pointsToCurve(t,e)}const gf=[];for(let t=0;t<256;t++)gf[t]=t;class yf extends xh{constructor(t){const e={vertex:Lh,fragment:Bh},n={uniforms:xh.getUniformInfo(yf)};super(yf.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,vf(n,256).map((t=>255*t))):gf],this.uniforms[ph.STATIC_OPTIONS].set(e)}}function bf(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 kf extends xh{constructor(t){const e={vertex:Lh,fragment:Bh},n={uniforms:xh.getUniformInfo(kf)};super(kf.getFilterType(),e,n,t)}static getFilterType(){return"levels"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=[...bf(t.black,t.white,t.gamma)];this.uniforms[ph.STATIC_OPTIONS].set(e)}}const xf=360,wf=[];for(let t=0;t<xf;t++)wf[t]=t;class _f extends xh{constructor(t){const e={uniforms:xh.getUniformInfo(_f)};super(_f.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 vf(t,xf,{type:"bezier"}).map((t=>{return e=t,((Math.round(e.x*xf)+180)%xf+(1-e.y-.5)*xf+xf)%xf;var e}))}(t.points)||wf;this.uniforms[ph.STATIC_OPTIONS].set(e)}}class Tf extends xh{constructor(t){const e={uniforms:xh.getUniformInfo(Tf)};super(Tf.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[ph.STATIC_OPTIONS].set([e,n])}}class If extends xh{constructor(t){const e={uniforms:xh.getUniformInfo(If)};super(If.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[ph.STATIC_OPTIONS].set([e,n,i,r])}}class Ef extends xh{constructor(t){const e={uniforms:xh.getUniformInfo(Ef)};super(Ef.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[ph.STATIC_OPTIONS].set([e])}}class Sf extends xh{constructor(t){const e={uniforms:xh.getUniformInfo(Sf)};super(Sf.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[ph.FIRST_TEXTURE,dh,hh]}handleStaticUniforms(t){let e={...Sf.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[ph.STATIC_OPTIONS].set([n,i,r,o,s,a,l,c,h,f,d,u])}}class Af extends xh{constructor(t){const e={uniforms:xh.getUniformInfo(Af)};super(Af.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[ph.STATIC_OPTIONS].set([n,i,r,o])}}class Nf extends xh{constructor(t){const e={uniforms:xh.getUniformInfo(Nf)};super(Nf.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 Mf extends xh{constructor(t){const e={uniforms:xh.getUniformInfo(Mf)};super(Mf.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[ph.STATIC_OPTIONS].set([e,n])}}class Ff extends xh{constructor(t){const e={uniforms:xh.getUniformInfo(Ff)};super(Ff.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[ph.STATIC_OPTIONS].set([e])}}var Cf,Of,Pf,Rf,Df,Lf,Bf,zf;function Wf(){if(Rf)return Pf;Rf=1;const t=Of?Cf:(Of=1,Cf={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"]}};Pf=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]},Pf}function $f(){if(Lf)return Df;Lf=1;const t=Wf();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 Df=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 Uf=function(){if(zf)return Bf;zf=1;const t=Wf(),e=$f(),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)}))})),Bf=n}(),jf=Su(Uf);class qf extends xh{constructor(t){const e={uniforms:xh.getUniformInfo(qf)};super(qf.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=jf.hex.rgb(t.color).map((t=>t/255));this.uniforms[ph.STATIC_OPTIONS].set([e[0],e[1],e[2]])}}class Vf extends xh{constructor(t){const e={uniforms:xh.getUniformInfo(Vf)};super(Vf.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[ph.STATIC_OPTIONS].set([e.from,e.to,...e.ease])}static getUniformList(){return[ph.FIRST_TEXTURE,fh]}}class Gf extends xh{constructor(t){const e={uniforms:xh.getUniformInfo(Gf)};super(Gf.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[ph.STATIC_OPTIONS].set([e.from,e.to,...e.ease])}static getUniformList(){return[ph.FIRST_TEXTURE,fh]}}class Hf extends xh{constructor(t){const e={uniforms:xh.getUniformInfo(Hf)};super(Hf.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[ph.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[ph.FIRST_TEXTURE,fh]}}class Kf extends xh{constructor(t){const e={uniforms:xh.getUniformInfo(Kf)};super(Kf.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[ph.STATIC_OPTIONS].set([e.from,e.to,...e.ease,n.x,n.y])}static getUniformList(){return[ph.FIRST_TEXTURE,fh,dh]}}class Xf extends xh{constructor(t){const e={uniforms:xh.getUniformInfo(Xf)};super(Xf.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=jf.hex.rgb(n).map((t=>t/255));this.uniforms[ph.STATIC_OPTIONS].set([e.from,e.to,...e.ease,i[0],i[1],i[2]])}static getUniformList(){return[ph.FIRST_TEXTURE,fh]}}var Yf=Object.freeze({__proto__:null,Crop:Sf,Curves:yf,Default:wh,DipToBlackTransition:Gf,DirectionalBlur:Ch,Exposure:Ff,ExposureTransition:Vf,FadeToColorTransition:Xf,FastBlur:Fh,HardLight:qf,HorizontalBlur:Nh,Hue:_f,Lab:Mf,Levels:kf,Lut:Dh,MotionBlurTransition:Kf,Opacity:Oh,Saturation:Ef,ShapeComposite:Rh,ShapeCompositeMask:Ph,Solid:Af,SolidImage:Nf,Transform:Ah,TransformTransition:Hf,VerticalBlur:Mh,Vibrance:If,WhiteBalance:Tf});const Qf=Object.values(Yf).reduce(((t,e)=>(t[e.getFilterType()]=e,t)),{});class Jf{constructor(t){this.context=t}static getFilterClass(t){return Qf[t]}getFilterIds(){return Object.keys(this.filterTypeToInstanceMap)}create(t,e){this.context={...this.context,options:e.options};const n=new Qf[t](this.context);if(!n)throw new Error(`${t} is not a atom filter, atomFilter list: `,this.getFilterIds());return n}}const Zf=fd.PREVIOUS_OUTPUT_PREFIX,tp=Object.values(Yf).reduce(((t,e)=>(t[e.getFilterType()]={type:e.getFilterType(),options:e.getInitialOptions(),inputs:[...Array(e.getInputsCount())].map(((t,e)=>`${Zf}${e}`)),outputs:[]},t)),{});var ep,np,ip=function(){if(np)return ep;np=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)}),{})},ep=s}(),rp=Su(ip),op=function(t,e){return rp(t,e,{arrayMerge:(t,e)=>e})};const sp=fd.MESSAGES.UPDATE_OPTIONS;let ap=class{constructor(t,e){this.eventEmitter=new yd,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(sp,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 lp extends ap{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=op(this.options,t),this.filter.updateStaticUniforms(this.options)}dispose(){this.filter.dispose()}}const cp=fd.MESSAGES.UPDATE_OPTIONS;class up extends lp{constructor(t,e,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}baseNodeUpdateOptions(t){this.options=op(this.options,t),this.filter.updateStaticUniforms(this.options)}registerListeners(){this.baseNode.getEventEmitter().on(cp,this.baseNodeUpdateOptions,this)}dispose(){this.filter.dispose(),this.baseNode.getEventEmitter().off(cp,this.baseNodeUpdateOptions,this)}}function dp(t){return null!==t&&"object"==typeof t}function hp(t){if(!dp(t)||(e=t,Array.isArray(e)))return t;var e;const n=Object.keys(t).sort(),i={};return n.forEach((e=>{i[e]=hp(t[e])})),i}function fp(t,e){return null!=t&&t.id&&null!=e&&e.id?t.type===e.type&&t.id===e.id:t.type===e.type}function pp(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)),dp(i=n)&&dp(r)?JSON.stringify(hp(i))===JSON.stringify(hp(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]&&fp(a,c[l])?l:c.findIndex((t=>fp(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 mp(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=Sp.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 vp=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 mp(pp(r,o),r,n,i)};class gp extends ap{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=>Sp.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 Td(e),r=[];this.nodes.forEach(((e,o)=>{const s={ioStore:t,graphIOManager:n};i=e.render(s),o!==this.nodes.length-1&&r.push(i)})),n.disposeTextures(r,i)}return n.setOutputs(e,r,i),i}getOptionsDisplay(){return[]}_updateOptions(t){this.nodes=vp(t,this.options,this.nodes,this.context),this.options=t}dispose(){this.nodes.forEach((t=>{t.dispose()}))}}const yp=fd.MESSAGES.UPDATE_OPTIONS;class bp extends gp{constructor(t,e,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}registerListeners(){this.baseNode.getEventEmitter().on(yp,this.updateOptions,this)}dispose(){this.nodes.forEach((t=>{t.dispose()})),this.baseNode.getEventEmitter().off(yp,this.updateOptions,this)}}const kp=fd.SYSTEM_NODES.TAGS.ATOM,xp=fd.SYSTEM_NODES.TAGS.FILTER,wp=fd.SYSTEM_NODES.TAGS.COMPOSITE_FILTER,_p=fd.SYSTEM_NODES.TAGS.TRANSITION_FILTER,Tp=fd.PREVIOUS_OUTPUT_PREFIX,Ip=Object.keys(tp);function Ep(t,e){const n=(i=t.type,tp[i]);var i;return t=op(n,t),new lp(t.type,t,e)}var Sp={create:function(t,e){let n;switch(function(t){let e;return n=t,e=Ip.includes(n)?kp:t===wp?wp:t===_p?_p:xp,e;var n}((t=JSON.parse(JSON.stringify(t))).type)){case kp:n=Ep(t,e);break;case xp: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=op(r,t),e={...e,baseNode:n},o=i===wp?new bp(i,t,e):new up(i,t,e),o}(t,e);break;case wp:n=function(t,e){const n=t.type;return t=op({inputs:[`${Tp}0`]},t),new gp(n,t,e)}(t,e);break;case _p: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`,Ep(t,e)}(t,e);break;default:throw new Error("cant create node",t.type)}return n}};const Ap=fd.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS;var Np=function(t){const e={[Ap]:tp[Ap]};for(const[n,i]of Object.entries(e)){const e=Sp.create(i,t);t.nodeStore.set(n,e)}},Mp=function(t,e){for(const[n,i]of Object.entries(t)){const t=Sp.create(i,e);e.nodeStore.set(n,t)}};const Fp=fd.CAPTURED_FRAME_PREFIX;class Cp{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=`${Fp}${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 Op=qu("ShaderGraphApplication","warn"),Pp=fd.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS,Rp=Object.freeze({useCanvasSizedFilterTargets:!1,rebindAttributesOnProgramSwitch:!0,forwardContextAttributes:!0});function Dp(t={}){const e=null==t?void 0:t.performanceToggles;return e&&"object"==typeof e?{...Rp,...e}:{...Rp}}class Lp{constructor(t,e={}){return this.glSource=t,this.config=e,this.performanceToggles=Dp(e),this.isContextLost=!1,this.isRecovering=!1,this.isDisposed=!1,this.pendingNodeOptionUpdates=new Map,this.doInit(t,e)}doInit(t,e){this.source=wd(t),this.performanceToggles=Dp(e),this.isDisposed=!1,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=Rp){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(),"undefined"!=typeof window&&(window.ekoShaderGraph=this),this.selectedRenderNode=null,this.activeTextures=this.activeTextures||new Set,this.textureManager=new Cd({gl:this.gl,activeTextures:this.activeTextures}),this.capturedFramesManager=new Cp({textureManager:this.textureManager}),this.graphIOManager=new Wd({glSource:t,gl:this.gl,textureManager:this.textureManager,capturedFramesManager:this.capturedFramesManager}),this.frameBufferFactory=new Hd({gl:this.gl,textureManager:this.textureManager,useCanvasSizedFilterTargets:this.performanceToggles.useCanvasSizedFilterTargets}),this.filterFactory=new Jf({gl:this.gl,frameBufferFactory:this.frameBufferFactory,rebindAttributesOnProgramSwitch:this.performanceToggles.rebindAttributesOnProgramSwitch}),this.nodeStore=new Td,this.ioStore=new Td,Np({nodeStore:this.nodeStore,filterFactory:this.filterFactory}),this.addClientNodes(e.nodes,this.isRecovering),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)}}getNodes(){return Op.debug("[getNodes]"),this.nodeStore.get()}addClientNodes(t,e=!1){if(Op.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));Mp(n,{nodeStore:this.nodeStore,filterFactory:this.filterFactory})}addTexture(t,e,n){if(Op.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){Op.debug("[releaseTexture]",t),this.isContextUnavailable()||this.textureManager.releaseTexture(t)}selectNode(t){if(Op.debug("[selectNode]",t),!this.isContextUnavailable())return this.nodeStore.get(t)||Op.warn("Missing render node",t),void(this.selectedRenderNodeId=t);this.selectedRenderNodeId=t}captureTexture(){return Op.debug("[captureTexture]"),this.isContextUnavailable()?null:this.capturedFramesManager.createCaptureId()}disposeTexture(t){return Op.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}}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){Op.error("Failed to apply pending node options",e,t),this.queueNodeOptionUpdate(e,n)}return}this.updateOptions(e,n)}catch(t){Op.error("Failed to apply pending node options",e,t)}}))}render(t={}){var e,n;const{noRaf:i=!1}=t;if(this.isContextUnavailable())return;if(this.dirtyCanvasSize){let{width:t=this.gl.canvas.width,height:e=this.gl.canvas.height}=this.dirtyCanvasSize;qd(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}const r=null===(e=this.gl)||void 0===e||null===(e=e.canvas)||void 0===e?void 0:e.width,o=null===(n=this.gl)||void 0===n||null===(n=n.canvas)||void 0===n?void 0:n.height;Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0&&(qd(r,o),this.gl.viewport(0,0,r,o)),this.graphIOManager.setVideoSources(this.ioStore);let s={ioStore:this.ioStore,graphIOManager:this.graphIOManager};this.renderSelectedNode(s),this.config.onPreRenderToScreen&&this.config.onPreRenderToScreen(),this.renderToCanvas(s),this.config.onPostRenderToScreen&&this.config.onPostRenderToScreen(),this.graphIOManager.disposeAllStore(this.ioStore),s=null,!i&&!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):(Op.warn("Missing selected render node",this.selectedRenderNodeId),this.selectedRenderNodeId=null)}renderToCanvas(t){const e=this.nodeStore.get(Pp);e&&"function"==typeof e.render?e.render(t):Op.warn("Missing render-to-canvas node")}updateOptions(t,e){if(Op.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){Op.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(){Op.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),Op.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=>{Op.debug("Re-adding client nodes",t),this.addClientNodes(t,!0)})),Object.entries(e).forEach((([t,e])=>{Op.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&&(Op.debug("Recovering glSource (i.e. seeking/resetting player)"),await this.source.recover()),this.isContextLost=!1,this.isRecovering=!1,o&&this.render()}catch(t){Op.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 Bp{constructor(t={}){this.options=t}get type(){return"stage"}getSignature(){return this.type}build({inputs:t=[]}={}){return{graph:[],outputs:t,signature:this.getSignature()}}}function zp(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 Wp extends Bp{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:zp(a)}),o.push(l)}return{graph:r,outputs:o,signature:this.getSignature()}}}class $p{#A=new Map;constructor(){this.register("retarget",Wp)}register(t,e){t&&"function"==typeof e&&this.#A.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.#A.get(e);return n?new n((null==t?void 0:t.options)||{}):null}}class Up{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 jp extends Up{#N=null;#M=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=jp.buildLayoutGraph({inputs:t}),r=e.signature;this.#N!==r&&(i.updateOptions(o,{graph:e.graph}),this.#N=r),this.#M!==o&&(i.selectNode(o),this.#M=o),i.render({noRaf:!0})}catch(t){}}}var qp=new WeakMap,Vp=new WeakMap,Gp=new WeakSet;class Hp extends Up{constructor(...t){super(...t),O(this,Gp),F(this,qp,null),F(this,Vp,null)}static get type(){return"side-by-side"}static get aliases(){return["SideBySideRenderNode","side-by-side","sidebyside"]}static get requiresFrameCadence(){return!1}static get panAndScanTarget(){return"skip"}static buildLayoutGraph({inputs:t=[]}={}){const e=t.length;if(e<=1)return super.buildDefaultLayoutGraph(t);const n=1/e,i=[],r=t.map(((t,e)=>{const r=(e+.5)*n,o=`slice-${e}`;return i.push({id:`side-by-side-crop-${e}`,type:"crop",inputs:[t],outputs:[o],options:{source:{center:{x:.5,y:.5},width:1,height:1},target:{center:{x:r,y:.5},width:n,height:1},fitType:"fill",cornerRadius:0,edgeSoftness:0}}),o}));let o=r[0];for(let t=1;t<e;t+=1){const e=(t+.5)*n*2-1;i.push({id:`side-by-side-mask-${t}`,type:"shapeCompositeMask",inputs:[r[t],o],outputs:["accum"],options:{type:"box",center:{x:e,y:0},area:{width:n,height:1},radius:0,edgeSoftness:0}}),o="accum"}return{type:Hp.type,signature:`${Hp.type}:${t.length}`,isDynamic:!1,graph:i}}static prepareRenderFrames({frames:t,state:e}={}){const n=Array.isArray(t)?t:[],i=e&&"object"==typeof e?e:{},r=Array.isArray(i.frames)?i.frames:[];if(!n.length&&!r.length)return i.frames=[],i!==e&&e&&"object"==typeof e&&Object.assign(e,i),[];const o=Math.max(n.length,r.length,2),s=Array.from({length:o}),a=n[0]||r[0];for(let t=0;t<o;t+=1)s[t]=n[t]||r[t]||a;return i.frames=s,i!==e&&e&&"object"==typeof e&&Object.assign(e,i),s}static resetRenderState(t){t&&"object"==typeof t&&(t.frames=null)}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.sideBySide;if(o){if(1===n.length){const t=null==r?void 0:r.default;try{A(Gp,this,Kp).call(this,i,t)}catch(t){}return}try{A(Gp,this,Xp).call(this,i,o,n)}catch(t){}}}}function Kp(t,e){if(!e)return;const n=oe.buildLayoutGraph({inputs:["__SRC_TEXTURE:0"]}),i=n.signature;M(qp,this)!==i&&(t.updateOptions(e,{graph:n.graph}),C(qp,this,i)),M(Vp,this)!==e&&(t.selectNode(e),C(Vp,this,e)),t.render({noRaf:!0})}function Xp(t,e,n){const i=Array.isArray(n)?n.length:0;if(!e||!i||i<2)return;const r=n.map(((t,e)=>t?`__SRC_TEXTURE:${e}`:null)).filter(Boolean),o=oe.buildLayoutGraph({inputs:r}),s=o.signature;M(qp,this)!==s&&(t.updateOptions(e,{graph:o.graph}),C(qp,this,s)),M(Vp,this)!==e&&(t.selectNode(e),C(Vp,this,e)),t.render({noRaf:!0})}function Yp(t){const e=Number(t);return Number.isFinite(e)?e<=0?0:e>=1?1:e:0}oe=Hp;class Qp extends Up{#N=null;#M=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=Yp(e),i=[{type:"opacity",inputs:[t[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",t[0]],options:{}}];return{type:Qp.type,signature:`${Qp.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=Yp((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.#N!==e){const n=Qp.buildLayoutGraph({inputs:["__SRC_TEXTURE:0"]});i.updateOptions(t,{graph:n.graph}),this.#N=e}this.#M!==t&&(i.selectNode(t),this.#M=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=Qp.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.#N===r&&this.#F===a||(i.updateOptions(o,{graph:n.graph}),this.#N=r,this.#F=a),this.#M!==o&&(i.selectNode(o),this.#M=o),i.render({noRaf:!0})}catch(t){}}}function Jp(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 Zp(t){return!(!t||!0===t.offsetPending)&&Number.isFinite(t.offset)}function tm(t){return Zp(t)?t.offset:void 0}function em(t,e,n,i={}){if(!t)return!1;const r=tm(t);if(!Number.isFinite(r))return!1;const o=Jp(t,n,i);return Number.isFinite(o)?e>=r&&e<r+o:e>=r}function nm(t=[]){if(!Array.isArray(t))return t;const e=[],n=[];return t.forEach((t=>{Zp(t)?e.push(t):n.push(t)})),e.sort(((t,e)=>t.offset-e.offset)),t.splice(0,t.length,...e,...n),t}function im(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=tm(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&&nm(t),{updated:a,resolvedPlacements:l}}function rm(t){const e=Number(t);return Number.isFinite(e)?e:0}function om(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 sm(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 am(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 lm(t){const e=Number(t);return Number.isFinite(e)&&e>0?e:0}function cm(t){return(null==t?void 0:t.id)||(null==t?void 0:t.nodeId)||null}function um(t,e){return Array.isArray(t)&&e?t.findIndex((t=>cm(t)===e)):-1}function dm(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=um(e,n);return t>=0?(t+1)%i:0}if("prev"===t){const t=um(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)?cm(e[i]):null}function hm(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=tm(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)=>tm(t)-tm(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 fm(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 pm(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 mm(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(fm(n,r,t))return r}return null}function vm(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 gm extends Up{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=Yp(e),i=[{type:"opacity",inputs:[t[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",t[0]],options:{}}];return{type:gm.type,signature:`${gm.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:Yp(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&&(vm(a),a.activeRenderPlacementId=l);const c=null==r?void 0:r.initSwitching,u=hm(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=pm(a.placements,a.selectedPlacementId),i=dm(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=dm(Number.isInteger(t)&&t>=0?t:0,a.nodes,null);let n=null;if(e&&(n=mm(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&&fm(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=mm(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=lm(a.pendingSwitch.crossfadeSeconds),s=lm(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=Yp(t/a.switchDuration))}a.switchNormalizedTime=Number.isFinite(p)?p:void 0;const m=pm(a.placements,a.selectedPlacementId),v=fm(s,a.selectedPlacementId,m)||s[0];let g=null;if(Number.isFinite(a.switchNormalizedTime)&&a.previousPlacementId){const t=pm(a.placements,a.previousPlacementId),e=pm(a.placements,a.selectedPlacementId),n=fm(s,a.previousPlacementId,t),i=fm(s,a.selectedPlacementId,e);n&&i&&(g=[n,i])}return g||(g=v?[v]:s),g}static resetRenderState(t){t&&"object"==typeof t&&vm(t)}}const ym=[jp,Hp,Qp,gm],bm=new Map;function km(t){if("string"!=typeof t)return null;const e=t.trim();return e?e.toLowerCase():null}function xm(t){const e=km(t);return e&&bm.get(e)||null}function wm(t){return xm(t)||jp}ym.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=km(e);n&&bm.set(n,t)}))}(t)));class _m{static get defaultType(){return jp.type||"default"}static getRenderNodeClass(t){return xm(t)}static normalizeType(t){const e=xm(t);return e?e.type:null}static doesRenderNodeTypeRequireFrameCadence(t){const e=xm(t);return!!e&&!0===e.requiresFrameCadence}static buildLayoutGraph({type:t,inputs:e=[],normalizedTime:n}={}){const i=wm(t);return i&&"function"==typeof i.buildLayoutGraph?i.buildLayoutGraph({inputs:e,normalizedTime:n}):jp.buildLayoutGraph({inputs:e,normalizedTime:n})}static getPanAndScanTarget(t){const e=wm(t);return"post"===(n=null==e?void 0:e.panAndScanTarget)||"skip"===n?n:"pre";var n}static prepareRenderFrames({type:t,frames:e,timelineTime:n,timeline:i,active:r,renderNodeParams:o,state:s}={}){const a=wm(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=wm(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=wm(t);n&&"function"==typeof n.resetRenderState&&n.resetRenderState(e)}static resetAllRenderStates(t){t&&"function"==typeof t.forEach&&t.forEach(((t,e)=>{_m.resetRenderState(e,t)}))}create(t,e){return t&&"function"==typeof t.render?t:new(wm(t))(e)}}function Tm(t){return Array.isArray(t)?t.filter((t=>t&&"string"==typeof t.type)):[]}function Im(t,e){return t&&"function"==typeof t.getSignature?t.getSignature():(null==e?void 0:e.type)||"stage"}class Em{#C;constructor(t){this.#C=t||new $p}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=_m.normalizeType(null==t?void 0:t.layoutType)||_m.defaultType,r=null==t?void 0:t.normalizedTime,o=Tm(null==t?void 0:t.preStages),s=Tm(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(Im(i,e))}));const u=_m.buildLayoutGraph({type:i,inputs:c,normalizedTime:r}),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(Im(i,e))})),{graph:a,signature:l.join("|"),isDynamic:d}}}const Sm=[0,0,1,1],Am="zoomInExposure",Nm=["transform","exposure","fadeToColor","dipToBlack"],Mm={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 Fm(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}function Cm(t,e=Sm){return Array.isArray(t)&&t.length>=4?t:e}function Om(t){return"string"==typeof t&&t.trim()?t.trim():"#ffffff"}function Pm(t,e){const n=null==t?void 0:t[e];return!1===n||null==n?null:Gu(n)?n:{}}function Rm(t={}){let e=0;return Nm.forEach((n=>{const i=Pm(t,n);if(!i)return;const r=Fm(null==i?void 0:i.duration);r>e&&(e=r)})),e}function Dm(t,e,n,i,r){const o=[];return Nm.forEach((s=>{const a=Pm(t,s);if(!a)return;const l=function(t,e,n){const i=Fm(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=Cm(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=Cm(null==e?void 0:e.ease),n=(null==e?void 0:e.power)||{from:0,to:1};return o.options.properties.power={from:Fm(null==n?void 0:n.from,0),to:Fm(null==n?void 0:n.to,1),ease:t},o.options.properties.color=Om((null==e?void 0:e.color)||r),o}if("exposure"===t||"dipToBlack"===t){const t=Cm(null==e?void 0:e.ease),n=(null==e?void 0:e.power)||{from:0,to:1};return o.options.properties.power={from:Fm(null==n?void 0:n.from,0),to:Fm(null==n?void 0:n.to,1),ease:t},o}return null}(s,a,e,l,r);c&&o.push(c)})),o}function Lm(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 Bm{#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(Gu(null==t?void 0:t.transition))return t.transition;if("string"==typeof(null==t?void 0:t.transition))return Mm[t.transition]||Mm[Am];if(Gu(null==t?void 0:t.filters)||Gu(null==t?void 0:t.reverseFilters))return{filters:t.filters||{},reverseFilters:t.reverseFilters||{}};if("string"==typeof(null==t?void 0:t.filter)){const e=Fm(t.duration)>0?1e3*t.duration:500;return{filters:{[t.filter]:{duration:e,power:{from:0,to:1}}},reverseFilters:{}}}return Mm[Am]}(t),n=Hu({},(null==e?void 0:e.filters)||{},Gu(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(Gu(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=Hu({},(null==e?void 0:e.reverseFilters)||{},Gu(null==t?void 0:t.reverseFilters)?t.reverseFilters:{});return{baseFilters:n,reverseFilters:Hu({},i,r)}}(t),r=Fm(null==t?void 0:t.duration),o=r>0?1e3*r:null,s=Rm(n),a=Rm(i),l=o&&s>0?o/s:1,c=o&&a>0?o/a:1,u=o||s||500,d=o||a||u,h=Om(null==t?void 0:t.color),f=e.captureTexture(),p=Date.now(),m=Dm(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:Lm(m),inGraph:null,inSignature:null},{captureId:f,outDurationMs:u,inDurationMs:d}}beginIncoming(){if(!this.#O)return;const t=Date.now(),e=Dm(this.#O.reverseFilters,t,this.#O.inScale,this.#O.durationOverrideMs,this.#O.color);this.#O={...this.#O,phase:"in",startTime:t,inGraph:e,inSignature:Lm(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 zm;const Wm=[/firefox\/(\d+)/,/edg\/(\d+)/,/opr\/(\d+)/,/chrome\/(\d+)/];function $m(){const t=td&&td.navigator&&(td.navigator.userAgent||td.navigator.platform||td.navigator.vendor)||"";if(zm&&zm.ua===t)return zm;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<Wm.length;e+=1){const n=Wm[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 zm={ua:t,lowerUA:e,isAndroid:n,isiOS:i,isMobile:r,isDesktop:o,isFirefox:s,browserMajorVersion:a},zm}function Um(){return $m().ua}function jm(){return $m().isAndroid}function qm(){return $m().isiOS}function Vm(){return $m().isMobile}function Gm(){return $m().isDesktop}function Hm(){return $m().isFirefox}function Km(){return $m().browserMajorVersion}var Xm={getUserAgent:Um,isAndroid:jm,isiOS:qm,isMobile:Vm,isDesktop:Gm,isFirefox:Hm,getBrowserMajorVersion:Km},Ym=Object.freeze({__proto__:null,default:Xm,getBrowserMajorVersion:Km,getUserAgent:Um,isAndroid:jm,isDesktop:Gm,isFirefox:Hm,isMobile:Vm,isiOS:qm});const Qm=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"});function Jm(t,e){const n={};return Number.isFinite(t)&&(n.time=t),"string"==typeof e&&(n.source=e),n}function Zm({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 tv({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}const ev="Idle",nv="Playing",iv="FirstFramePending",rv="Waiting",ov="Paused",sv="Seeking",av="Resetting";function lv(t){return Array.isArray(t)?t.filter((t=>t&&"string"==typeof t.type)):[]}function cv(t,e){return!!Array.isArray(t)&&t.some((t=>(null==t?void 0:t.type)===e))}function uv(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 dv(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 hv=2073600;function fv(t,e){const n=Number(t);return Number.isFinite(n)&&n>0?n:e}function pv(t,e){if(null==t)return e;const n=Number(t);return Number.isFinite(n)?n:e}var mv=new WeakMap,vv=new WeakMap,gv=new WeakMap,yv=new WeakMap,bv=new WeakMap,kv=new WeakMap,xv=new WeakMap,wv=new WeakMap,_v=new WeakMap,Tv=new WeakMap,Iv=new WeakMap,Ev=new WeakMap,Sv=new WeakMap,Av=new WeakMap,Nv=new WeakMap,Mv=new WeakMap,Fv=new WeakMap,Cv=new WeakMap,Ov=new WeakMap,Pv=new WeakMap,Rv=new WeakMap,Dv=new WeakMap,Lv=new WeakMap,Bv=new WeakMap,zv=new WeakMap,Wv=new WeakMap,$v=new WeakMap,Uv=new WeakMap,jv=new WeakMap,qv=new WeakMap,Vv=new WeakSet;class Gv extends Qu{static get pipelineNodeId(){return"ekoplayer-render-pipeline"}get defaults(){return{defaultRenderParams:void 0,resourceLimits:{enabled:!0,maxCanvasPixels:hv,maxDevicePixelRatio:0,renderScale:1,transitionMinFrameIntervalMs:33}}}constructor(...t){super(...t),O(this,Vv),F(this,mv,void 0),F(this,vv,void 0),F(this,gv,void 0),F(this,yv,void 0),F(this,bv,void 0),F(this,kv,void 0),F(this,xv,void 0),F(this,wv,void 0),F(this,_v,void 0),F(this,Tv,void 0),F(this,Iv,null),F(this,Ev,null),F(this,Sv,void 0),F(this,Av,void 0),F(this,Nv,void 0),F(this,Mv,[]),F(this,Fv,[]),F(this,Cv,null),F(this,Ov,null),F(this,Pv,null),F(this,Rv,null),F(this,Dv,null),F(this,Lv,null),F(this,Bv,new Map),F(this,zv,null),F(this,Wv,null),F(this,$v,!1),F(this,Uv,!1),F(this,jv,[]),F(this,qv,null);const[e,n,i]=t;C(mv,this,e),C(vv,this,n),C(gv,this,i),M(mv,this)&&"function"==typeof M(mv,this).enableFirstFrameRenderedGate&&M(mv,this).enableFirstFrameRenderedGate(),C(Tv,this,new Em),C(Sv,this,new Bm),C(Av,this,null),C(Nv,this,null),C(Pv,this,null),C(yv,this,(t=>A(Vv,this,Ig).call(this,t))),M(mv,this)&&"function"==typeof M(mv,this).on&&(M(mv,this).on(Qm.VISUAL_FRAMES_AVAILABLE,M(yv,this)),C(bv,this,(()=>{var t,e,n,i;A(Vv,this,Yv).call(this),A(Vv,this,kg).call(this,0),C(Fv,this,[]),C(Cv,this,null),C(Iv,this,null),C(Ev,this,null),A(Vv,this,ug).call(this),C(zv,this,null);(null===(t=M(Sv,this))||void 0===t||null===(e=t.getState)||void 0===e?void 0:e.call(t))||null===(n=M(Sv,this))||void 0===n||null===(i=n.reset)||void 0===i||i.call(n,M(Av,this))})),M(mv,this).on(Qm.TIMELINE_SEEKING,M(bv,this)),C(kv,this,(()=>A(Vv,this,Qv).call(this))),M(mv,this).on(Qm.TIMELINE_RESET,M(kv,this)),C(_v,this,(()=>A(Vv,this,pg).call(this))),M(mv,this).on(Qm.TIMELINE_TIME_UPDATE,M(_v,this)),C(xv,this,(()=>{A(Vv,this,Eg).call(this)&&M(Ov,this)&&A(Vv,this,Ig).call(this,M(Ov,this))})),M(mv,this).on(Qm.TIMELINE_STATE_CHANGE,M(xv,this))),C(wv,this,(()=>{C(Cv,this,null),M(Ov,this)&&A(Vv,this,Eg).call(this)&&A(Vv,this,Ig).call(this,M(Ov,this))})),M(gv,this)&&"function"==typeof M(gv,this).on&&M(gv,this).on(Qm.CONTAINER_RESIZE,M(wv,this))}get name(){return"Renderer"}onDispose(){M(mv,this)&&M(yv,this)&&"function"==typeof M(mv,this).off&&M(mv,this).off(Qm.VISUAL_FRAMES_AVAILABLE,M(yv,this)),M(mv,this)&&M(bv,this)&&"function"==typeof M(mv,this).off&&M(mv,this).off(Qm.TIMELINE_SEEKING,M(bv,this)),M(mv,this)&&M(kv,this)&&"function"==typeof M(mv,this).off&&M(mv,this).off(Qm.TIMELINE_RESET,M(kv,this)),M(mv,this)&&M(_v,this)&&"function"==typeof M(mv,this).off&&M(mv,this).off(Qm.TIMELINE_TIME_UPDATE,M(_v,this)),M(mv,this)&&M(xv,this)&&"function"==typeof M(mv,this).off&&M(mv,this).off(Qm.TIMELINE_STATE_CHANGE,M(xv,this)),M(gv,this)&&M(wv,this)&&"function"==typeof M(gv,this).off&&M(gv,this).off(Qm.CONTAINER_RESIZE,M(wv,this)),A(Vv,this,Hv).call(this),C(yv,this,null),C(bv,this,null),C(kv,this,null),C(_v,this,null),C(xv,this,null),C(wv,this,null),C(Tv,this,null),C(Sv,this,null),C(Bv,this,null),C(zv,this,null),C(vv,this,null),C(gv,this,null),C(mv,this,null)}startTransition(t={}){var e;const n=null===(e=M(vv,this))||void 0===e?void 0:e.element;if(!n)return null;if(A(Vv,this,Zv).call(this,n),!M(Av,this))return null;const i=M(Sv,this).start({shaderGraph:M(Av,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 C(Pv,this,M(Ov,this)||null),A(Vv,this,wg).call(this),i}beginTransitionIn(t={}){var e,n;null!==(e=M(Sv,this))&&void 0!==e&&null!==(n=e.beginIncoming)&&void 0!==n&&n.call(e,t),C(Pv,this,null),A(Vv,this,wg).call(this)}resetTransition(){var t,e;null!==(t=M(Sv,this))&&void 0!==t&&null!==(e=t.reset)&&void 0!==e&&e.call(t,M(Av,this)),C(Pv,this,null),A(Vv,this,_g).call(this)}}function Hv(){if(A(Vv,this,Yv).call(this),M(Sv,this)&&"function"==typeof M(Sv,this).reset&&M(Sv,this).reset(M(Av,this)),A(Vv,this,kg).call(this,0),M(Av,this)&&"function"==typeof M(Av,this).dispose)try{M(Av,this).dispose()}catch(t){}C(Av,this,null),C(Nv,this,null),C(Mv,this,[]),C(Fv,this,[]),C(Cv,this,null),C(Iv,this,null),C(Ev,this,null),C(Ov,this,null),C(Pv,this,null),A(Vv,this,_g).call(this),A(Vv,this,ug).call(this),C(zv,this,null)}function Kv(){return{schedule:"function"==typeof td.requestAnimationFrame?td.requestAnimationFrame.bind(td):t=>setTimeout(t,16),cancel:"function"==typeof td.cancelAnimationFrame?td.cancelAnimationFrame.bind(td):clearTimeout}}function Xv(t){C(jv,this,M(jv,this).filter((e=>e!==t))),M(jv,this).length||C(qv,this,null)}function Yv(){M(qv,this)&&M(jv,this).forEach((t=>M(qv,this).call(this,t))),C(jv,this,[]),C(qv,this,null),C(Uv,this,!1)}function Qv(){A(Vv,this,Yv).call(this),C($v,this,!1)}function Jv(){if(M($v,this)||M(Uv,this))return;const{schedule:t,cancel:e}=A(Vv,this,Kv).call(this);let n;C(qv,this,e),C(Uv,this,!0),n=t((()=>{let e;A(Vv,this,Xv).call(this,n),e=t((()=>{A(Vv,this,Xv).call(this,e),C(Uv,this,!1),M($v,this)||(C($v,this,!0),M(mv,this)&&"function"==typeof M(mv,this).notifyFirstFrameRendered&&M(mv,this).notifyFirstFrameRendered())})),M(jv,this).push(e)})),M(jv,this).push(n)}function Zv(t){if(M(Av,this)||!t)return;const e=this,n={dest:t,src:(t,n)=>{C(Nv,e,n)}};C(Av,e,new Lp(n,{userWillCallRender:!0,glOptions:{contextType:"webgl2"},performanceToggles:{useCanvasSizedFilterTargets:!0}})),M(Av,e)&&"function"==typeof M(Av,e).addNodes&&M(Av,e).addNodes({[se.pipelineNodeId]:{type:"composite",options:{graph:[]}}})}function tg(){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 eg(){const t=A(Vv,this,tg).call(this).enabled;return!0===t||!1!==t&&qm()}function ng(){if(!A(Vv,this,eg).call(this))return 0;const t=pv(A(Vv,this,tg).call(this).transitionMinFrameIntervalMs,33);return Number.isFinite(t)&&t>0?t:0}function ig(t,e,n={}){const i=!0===(null==n?void 0:n.useDevicePixelRatio),r=A(Vv,this,eg).call(this),o=i?fv(null==td?void 0:td.devicePixelRatio,1):1;let s=o,a=0;if(r){const t=A(Vv,this,tg).call(this);a=pv(t.maxCanvasPixels,hv);const e=pv(t.maxDevicePixelRatio,0);s=fv(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 rg(t=[],e={}){var n;const i=null===(n=M(vv,this))||void 0===n?void 0:n.element,r=M(Nv,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=M(gv,this))||void 0===c?void 0:c.containerWidth)&&void 0!==l?l:null===(u=M(gv,this))||void 0===u?void 0:u.width),e=Number(null!==(d=null===(h=M(gv,this))||void 0===h?void 0:h.containerHeight)&&void 0!==d?d:null===(f=M(gv,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=A(Vv,this,ig).call(this,o,s,{useDevicePixelRatio:a}),v=m.width,g=m.height,y=M(Cv,this);return!(y&&y.width===v&&y.height===g||(C(Cv,this,{width:v,height:g}),r(null,null,v,g),0))}function og(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 sg(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=A(Vv,this,ag).call(this,t),s=A(Vv,this,lg).call(this,o);return _m.getRenderTiming({type:o,timing:{duration:i,normalizedTime:r},timelineTime:e,active:t,renderNodeParams:n,state:s})}function ag(t){return _m.normalizeType(null==t?void 0:t.type)||_m.defaultType}function lg(t){if(!t||!M(Bv,this))return null;let e=M(Bv,this).get(t);return e||(e={},M(Bv,this).set(t,e)),e}function cg(t){if(!t||!M(Bv,this))return;const e=M(Bv,this).get(t);e&&_m.resetRenderState(t,e),M(Bv,this).delete(t)}function ug(){M(Bv,this)&&(_m.resetAllRenderStates(M(Bv,this)),M(Bv,this).clear())}function dg(t,e,n,i){const r=A(Vv,this,ag).call(this,t);M(zv,this)&&M(zv,this)!==r&&A(Vv,this,cg).call(this,M(zv,this)),C(zv,this,r);const o=A(Vv,this,lg).call(this,r);return _m.prepareRenderFrames({type:r,frames:e,timelineTime:n,timeline:M(mv,this),active:t,renderNodeParams:i,state:o})}function hg(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 fg(t){return t?String(t.renderPlacementId||t.type||"unknown"):"default"}function pg(){if(!M(mv,this)||!M(Ov,this))return;const t=M(mv,this).currentTime,e=M(mv,this).getActiveRenderPlacement(t),n=A(Vv,this,fg).call(this,e);n!==M(Wv,this)&&(C(Wv,this,n),A(Vv,this,Ig).call(this,{...M(Ov,this),time:t}))}function mg(t){return!t||"object"!=typeof t||!Object.prototype.hasOwnProperty.call(t,"panAndScan")||!1!==t.panAndScan}function vg(t,e){const n=A(Vv,this,hg).call(this,t),i=null==n?void 0:n.stages;let r=lv(null==i?void 0:i.pre),o=lv(null==i?void 0:i.post);const s=A(Vv,this,mg).call(this,n),a=A(Vv,this,ag).call(this,t),l=cv(r,"retarget")||cv(o,"retarget");if(s&&!l){const t=_m.getPanAndScanTarget(a);if("pre"===t){const t=uv(Array.isArray(e)?e.length:0);t&&(r=[t,...r])}else if("post"===t){const t=uv(1);t&&(o=[...o,t])}}else s||(r=dv(r),o=dv(o));return{preStages:r,postStages:o,renderNodeParams:n}}function gg(t,e,n,i,r){const o=r||A(Vv,this,sg).call(this,t,n,i),s=A(Vv,this,vg).call(this,t,e);return M(Tv,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,timelineTime:n})}function yg(){var t,e;const n=null===(t=M(Sv,this))||void 0===t||null===(e=t.getState)||void 0===e?void 0:e.call(t);return"out"===(null==n?void 0:n.phase)?M(Sv,this).buildOutgoingGraph():"in"===(null==n?void 0:n.phase)?M(Sv,this).buildIncomingGraph():null}function bg(t,e,n,i){const r=n||e!==M(Iv,this),o=r||i;return r&&M(Av,this)&&"function"==typeof M(Av,this).updateOptions&&(M(Av,this).updateOptions(se.pipelineNodeId,{graph:t}),C(Iv,this,e)),M(Av,this)&&"function"==typeof M(Av,this).selectNode&&M(Ev,this)!==se.pipelineNodeId&&(M(Av,this).selectNode(se.pipelineNodeId),C(Ev,this,se.pipelineNodeId)),!(!o||!M(Av,this)||"function"!=typeof M(Av,this).render||(M(Av,this).render({noRaf:!0}),0))}function kg(t){if(!Array.isArray(M(Mv,this))||!M(Mv,this).length)return;const e=Number.isFinite(t)?Math.max(0,t):0;if(!(M(Mv,this).length<=e)){for(let t=e;t<M(Mv,this).length;t+=1){const e=M(Mv,this)[t];if(e&&M(Av,this)&&"function"==typeof M(Av,this).releaseTexture)try{M(Av,this).releaseTexture(e)}catch(t){}}M(Mv,this).length=e,M(Fv,this).length=e}}function xg(t=[]){if(!M(Av,this)||"function"!=typeof M(Av,this).addTexture)return!1;if("function"==typeof M(Av,this).isContextUnavailable&&M(Av,this).isContextUnavailable())return!1;if(!Array.isArray(t)||!t.length)return A(Vv,this,kg).call(this,0),!1;A(Vv,this,kg).call(this,t.length);let e=!1;for(let i=0;i<t.length;i+=1){var n;M(Mv,this)[i]||"function"!=typeof M(Av,this).addTexture||(M(Mv,this)[i]=M(Av,this).addTexture(null,"frame",i));const r=A(Vv,this,og).call(this,t[i]),o=null===(n=t[i])||void 0===n?void 0:n.frame;if(M(Mv,this)[i]&&o&&(!r||r!==M(Fv,this)[i]))try{M(Mv,this)[i].fill(o),M(Fv,this)[i]=r,e=!0}catch(t){}}return e}function wg(){if(M(Rv,this))return;const t="function"==typeof td.requestAnimationFrame?t=>td.requestAnimationFrame(t):t=>setTimeout(t,16),e="function"==typeof td.cancelAnimationFrame?t=>td.cancelAnimationFrame(t):clearTimeout;C(Dv,this,e);const n=()=>{var e,i;if(null!==(e=M(Sv,this))&&void 0!==e&&null!==(i=e.getState)&&void 0!==i&&i.call(e)){if(M(Ov,this)){const t=A(Vv,this,ng).call(this),e=Date.now();(!t||!M(Lv,this)||e-M(Lv,this)>=t)&&(C(Lv,this,e),A(Vv,this,Ig).call(this,M(Ov,this)))}C(Rv,this,t(n))}else C(Rv,this,null)};C(Rv,this,t(n))}function _g(){M(Rv,this)&&M(Dv,this)&&M(Dv,this).call(this,M(Rv,this)),C(Rv,this,null),C(Dv,this,null),C(Lv,this,null)}function Tg(t){var e,n;const i=null===(e=M(Sv,this))||void 0===e||null===(n=e.getState)||void 0===n?void 0:n.call(e);return"out"===(null==i?void 0:i.phase)&&M(Pv,this)?M(Pv,this):t}function Ig(t={}){var e,n;const i=null===(e=M(vv,this))||void 0===e?void 0:e.element,r=null===(n=M(vv,this))||void 0===n?void 0:n.gl;if(!i||!r)return;if(t&&C(Ov,this,t),!A(Vv,this,Eg).call(this))return;const o=A(Vv,this,Tg).call(this,t),s=Number.isFinite(null==o?void 0:o.time)?o.time:void 0;if(!Number.isFinite(s))return;if(A(Vv,this,Zv).call(this,i),!M(Av,this))return;const a=M(mv,this)&&"function"==typeof M(mv,this).getActiveRenderPlacement?M(mv,this).getActiveRenderPlacement(s):void 0,l=A(Vv,this,fg).call(this,a);l!==M(Wv,this)&&C(Wv,this,l);const c=Array.isArray(null==o?void 0:o.frames)?o.frames:[],u=A(Vv,this,hg).call(this,a),d=A(Vv,this,mg).call(this,u),h=A(Vv,this,dg).call(this,a,c,s,u),f=A(Vv,this,sg).call(this,a,s,u),p=A(Vv,this,rg).call(this,h,{useViewportSize:d}),m=A(Vv,this,xg).call(this,h),v=A(Vv,this,gg).call(this,a,h,s,u,f),g=A(Vv,this,yg).call(this);let y=v.graph,b=v.signature,k=!!v.isDynamic;g&&Array.isArray(g.graph)&&g.graph.length&&(y=y.concat(g.graph),b=`${b}|${g.signature||"transition"}`,k=k||!!g.forceUpdate);const x=p||m||k||g&&Array.isArray(g.graph)&&g.graph.length;A(Vv,this,bg).call(this,y,b,k,x)&&h.length&&A(Vv,this,Jv).call(this)}function Eg(){var t;const e=null===(t=M(mv,this))||void 0===t?void 0:t.state;return e===ev||e===iv||e===nv||e===ov}function Sg(t){return"number"==typeof t&&Number.isFinite(t)&&t>0}function Ag(t){return t&&"resource"===t.entryType&&t.transferSize>0&&t.duration>0&&t.responseEnd>=t.requestStart}function Ng(t){return Array.isArray(t)&&0!==t.length?t.reduce(((t,e)=>t+e),0)/t.length:NaN}se=Gv;var Mg=new WeakMap,Fg=new WeakMap,Cg=new WeakMap,Og=new WeakMap,Pg=new WeakSet;class Rg extends Qu{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),O(this,Pg),F(this,Mg,void 0),F(this,Fg,void 0),F(this,Cg,void 0),F(this,Og,void 0),C(Mg,this,!!(td&&td.navigator&&td.navigator.connection)),C(Fg,this,!(!td||!td.performance||"function"!=typeof td.performance.getEntriesByType)),C(Cg,this,A(Pg,this,Lg).call(this)),C(Og,this,A(Pg,this,Ug).call(this))}guesstimate(){const t=A(Pg,this,qg).call(this);this.log.debug("[guesstimate] Data:",t);const e=A(Pg,this,jg).call(this,t),n=Sg(e)?e:t.defaultKbps;return A(Pg,this,Bg).call(this,n),this.log.info(`[guesstimate] Result: ${n} kbps`),n}update(t){Sg(t)&&A(Pg,this,Bg).call(this,t)}onDispose(){C(Cg,this,void 0),C(Og,this,void 0)}}function Dg(){return Math.round(Date.now()/1e3)}function Lg(){try{if(!td||!td.localStorage||"function"!=typeof td.localStorage.getItem)return}catch(t){return}const t=this.settings.persistentStorage.key,e=td.localStorage.getItem(t);if(e)try{const t=JSON.parse(e),n=this.settings.persistentStorage.ttl,i=A(Pg,this,Dg).call(this)-t.timestamp;if("number"==typeof n&&n>=0&&i>n)return null;if(!Sg(t.value))return;return t.value}catch(t){return}}function Bg(t){if(!Sg(t))return;try{if(!td||!td.localStorage||"function"!=typeof td.localStorage.setItem)return}catch(t){return}const e=this.settings.persistentStorage.key,n=JSON.stringify({value:t,timestamp:A(Pg,this,Dg).call(this)});try{td.localStorage.setItem(e,n),C(Cg,this,t)}catch(t){}}function zg(){return td&&td.performance&&"function"==typeof td.performance.getEntriesByType?Ng(td.performance.getEntriesByType("resource").filter(Ag).map((t=>8*t.transferSize/t.duration))):NaN}function Wg(){if(!td||!td.navigator||!td.navigator.connection)return NaN;const t=td.navigator.connection.downlink;return Sg(t)?1e3*t:NaN}function $g(){if(!M(Mg,this))return NaN;const t=td.navigator.connection,e=t.effectiveType||t.type,n=this.settings.connectionType||{};return e&&Object.prototype.hasOwnProperty.call(n,e)?n[e]:NaN}function Ug(){const t=this.settings.ua||{};return jm()?t.android:qm()?t.ios:t.desktop}function jg(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=>Sg(t)));if(r.length===i.length)return this.log.debug("[#selectFromPriorities] Selected from priorities:",i,"with values:",r),Ng(r)}return NaN}function qg(){const t=this.settings.testOverrides||{},e=Sg(t.resourceTiming)?t.resourceTiming:A(Pg,this,zg).call(this),n=Sg(t.downlink)?t.downlink:A(Pg,this,Wg).call(this),i=Sg(t.persistentValue)?t.persistentValue:M(Cg,this),r=Sg(t.connectionType)?t.connectionType:A(Pg,this,$g).call(this),o=Sg(t.ua)?t.ua:M(Og,this);return{defaultKbps:this.settings.defaultKbps,resourceTiming:e,downlink:n,connectionType:r,persistentValue:i,ua:o}}const Vg=new Vu;function Gg(t){return"string"!=typeof t||0===t.length?[]:t.split(".").filter((t=>t.length>0))}function Hg(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 Kg(t){return null!==t&&"object"==typeof t}function Xg(t,e,n){const i=Gg(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 Yg(t,e,n){if(!Kg(t))return t;const i=Gg(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}Kg(r[e])||(r[e]=Hg(i[t+1])?[]:{}),r=r[e]}return t}const Qg={get:(t,e)=>td&&td.eko?Xg(td.eko,t,e):e,set(t,e){if(td)return td.eko&&"object"==typeof td.eko||(td.eko={}),Yg(td.eko,t,e),td.eko}},Jg=td&&td.performance,Zg=Jg&&"function"==typeof Jg.now?()=>Jg.now():()=>Date.now();function ty(){return"undefined"==typeof AbortController?null:new AbortController}function ey(){const t=new Error("The operation was aborted");return t.name="AbortError",t.code="ABORT_ERR",t}function ny(t,e){return!(!e||!e.aborted)||!!t&&("AbortError"===t.name||"ABORT_ERR"===t.code||20===t.code)}const iy=2,ry=100,oy=2,sy="runtime.downloadSpeedSamples",ay=qu("download","warn");function ly(t){return new Promise((e=>{setTimeout(e,t)}))}function cy(t){return t>=500}function uy(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 dy(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=Qg.get(r);t||(t=[],Qg.set(r,t)),t.push(s)}catch(t){}return s}async function hy(t,e={}){const{method:n="GET",headers:i,body:r,retries:o=iy,retryDelay:s=ry,backoffFactor:a=oy,samplesTargetPath:l=sy,fetch:c,loglevel:u="warn",cache:d,signal:h,onProgress:f,returnType:p="default"}=e;ay.setLevel(u);const m=function(t){if(t)return t;if(td&&"function"==typeof td.fetch)return td.fetch.bind(td);throw new Error("fetch is not available in this environment")}(c);let v=0,g=s;for(;;){if(h&&h.aborted)throw ey();const e=Zg();try{const s=await m(t,{method:n,headers:i,body:r,cache:d,mode:"cors",signal:h});if(h&&h.aborted)throw ey();if(!s.ok){if(v<o&&cy(s.status)){v+=1,ay.warn(`[${t}] Download attempt #${v} failed with status ${s.status}, retrying in ${g}ms...`),await ly(g),g*=a;continue}ay.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=Zg();const u=uy(s),y="arrayBuffer"===p||"bytes"===p,b=y&&"function"==typeof f;let k,x,w,_,T,I=0;if(y&&s.body&&"function"==typeof s.body.getReader&&b){const t=s.body.getReader(),e=[];for(;;){if(h&&h.aborted)throw ey();const{done:n,value:i}=await t.read();if(n)break;if(i&&i.length){const t=Zg();Number.isFinite(_)||(_=t),T=t,e.push(i),I+=i.length,f({loaded:I,total:u||void 0,chunk:i})}}k=new Uint8Array(I);let n=0;e.forEach((t=>{k.set(t,n),n+=t.length})),c=Zg()}else if(y){const t=await s.arrayBuffer();k=new Uint8Array(t),I=k.length,c=Zg()}else"text"===p?(x=await s.text(),c=Zg()):"json"===p&&(w=await s.json(),c=Zg());if(h&&h.aborted)throw ey();const E=y?k?k.length:I:("text"===p&&"string"==typeof x?x.length:0)||("json"===p&&w?JSON.stringify(w).length:0),S=u||E||0;let A=e,N=c;Number.isFinite(_)&&(A=_,Number.isFinite(T)&&(N=Math.max(T,c))),(!Number.isFinite(A)||!Number.isFinite(N)||N<A)&&(A=e,N=c);const M=Math.max(0,N-A),F=dy(S,M,A,N,l,t);try{Vg.trigger("download:sample",F)}catch(t){}const C={response:s,bytes:S,durationMs:M,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(ny(e,h))throw"AbortError"===e.name?e:ey();if(!(v<o)||e.status&&!cy(e.status))throw ay.error(`[${t}] Download attempt #${v} failed with error ${e}, no more retries.`),e;v+=1,ay.warn(`[${t}] Download attempt #${v} failed with error ${e}, retrying in ${g}ms...`),await ly(g),g*=a}}}const fy={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"]}},py=Object.freeze(Object.entries(fy).reduce(((t,[e,n])=>(Object.prototype.hasOwnProperty.call(n,"default")&&(t[e]=n.default),t)),{})),my=qu("config","warn");function vy(t){return py[t]}var gy=new WeakMap,yy=new WeakMap,by=new WeakMap,ky=new WeakMap,xy=new WeakMap,wy=new WeakSet;class _y extends Qu{get name(){return"DownloadSpeed"}get defaults(){return{alpha:.3,maxSamples:30,minBytesPerSample:1024,minDurationMs:5,maxSampleKbpsCap:void 0,ignoreCacheHits:!0,samplesPath:"runtime.downloadSpeedSamples",initialKbps:vy("initialKbps"),probeUrl:void 0,defaultKbps:2500}}constructor(...t){super(...t),O(this,wy),F(this,gy,void 0),F(this,yy,void 0),F(this,by,void 0),F(this,ky,void 0),F(this,xy,void 0),C(by,this,[]),C(yy,this,0),C(gy,this,A(wy,this,Ey).call(this)),C(xy,this,ty()),C(ky,this,(t=>{A(wy,this,Cy).call(this,t,"event")})),A(wy,this,Sy).call(this),Vg.on("download:sample",M(ky,this)),A(wy,this,Ay).call(this),this.log.debug(`[#constructor] Initial estimate: ${M(gy,this)} kbps`)}getKbps(){return M(gy,this)}addSample(t){A(wy,this,Cy).call(this,t,"manual")}reset(){C(by,this,[]),C(yy,this,0),C(gy,this,A(wy,this,Ey).call(this))}onDispose(){M(xy,this)&&M(xy,this).abort(),C(xy,this,null),Vg.off("download:sample",M(ky,this)),C(by,this,[]),C(yy,this,0),C(gy,this,void 0),C(ky,this,null)}}function Ty(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 Iy(t){if(!t||"object"!=typeof t)return null;const e=Number(t.bytes),n=Number(t.durationMs);let i=Sg(t.kbps)?Number(t.kbps):NaN;return!Sg(i)&&n>0&&Sg(e)&&(i=8*e/n),Sg(i)?e<=this.settings.minBytesPerSample||n<=this.settings.minDurationMs||A(wy,this,Ty).call(this,t,e)?null:(Sg(this.settings.maxSampleKbpsCap)&&i>this.settings.maxSampleKbpsCap&&(i=this.settings.maxSampleKbpsCap),{...t,bytes:e,durationMs:n,kbps:i}):null}function Ey(){const t=this.settings.initialKbps;if(Sg(t))return t;if("auto"===t)try{const t=(new Rg).guesstimate();if(Sg(t))return t}catch(t){}return this.settings.defaultKbps}function Sy(){const t=Qg.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)A(wy,this,Cy).call(this,e[t],"replay",{emit:!1})}async function Ay(){if(!this.settings.probeUrl||M(yy,this)>0)return;const t=M(xy,this)?M(xy,this).signal:void 0;if(!t||!t.aborted)try{await hy(this.settings.probeUrl,{cache:"no-store",samplesTargetPath:this.settings.samplesPath,signal:t})}catch(t){}}function Ny(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 My(t,e){if(!A(wy,this,Ny).call(this,t)||!A(wy,this,Ny).call(this,e))return 0;const n=Math.max(t.startTime,e.startTime);return Math.min(t.endTime,e.endTime)-n}function Fy(t){if(!A(wy,this,Ny).call(this,t))return t;const e=[];for(let n=0;n<M(by,this).length;n+=1){const i=M(by,this)[n];A(wy,this,Ny).call(this,i)&&(A(wy,this,My).call(this,t,i)>0&&e.push(i))}if(0===e.length)return t;C(by,this,M(by,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(!Sg(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 A(wy,this,Iy).call(this,a)}function Cy(t,e,{emit:n=!0}={}){const i=A(wy,this,Iy).call(this,t);if(!i)return;const r=A(wy,this,Fy).call(this,i);if(!r)return;C(yy,this,M(yy,this)+1),M(by,this).push(r),M(by,this).length>this.settings.maxSamples&&M(by,this).shift();const o=this.defaults.alpha,s="number"==typeof this.settings.alpha?this.settings.alpha:o,a=Sg(M(gy,this)),l=a?M(gy,this):r.kbps,c=a||1!==M(yy,this)?s*r.kbps+(1-s)*l:r.kbps;C(gy,this,c),this.log.debug(`[#ingestSample] Next estimate: ${c} kbps`),n&&this.trigger("download:speed",{kbps:M(gy,this),sample:r,source:e,samplesCount:M(yy,this)})}class Oy{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=function(t=""){if(!t||"string"!=typeof t)return;const e=t.split(",")[0].trim();if(!e)return;const n=e.match(/^[a-z0-9]+/i);return n?n[0].toLowerCase():void 0}(o),Sg(s)&&(this.bandwidth=s),Sg(a)&&(this.timescale=a),Sg(l)&&(this.sizeBytes=l),Object.assign(this,c)}}class Py{#P=new Map;#R;#D;#L=0;#B;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 Oy?t:new Oy(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.#L=Math.max(this.#L,n));const i=Number(e);Number.isFinite(i)&&i>0&&(this.#B=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=Sg(this.#B)?this.#B:null===(t=this.#R)||void 0===t?void 0:t.sizeBytes;return Sg(e)?Math.min(1,Math.max(0,this.#L/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.#L=0,this.#B=void 0}}class Ry{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 Dy(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 Ly(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=Dy(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 By=new Set(["video","audio","image","cue","data","bbox"]);class zy{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(!By.has(n))throw new Error(`Track type must be one of ${Array.from(By).join("|")}`);this.id=e,this.type=n,this.offset=i,this.duration=Sg(r)?r:void 0,this.source=o,"cue"===n?(this._cues=a.map((t=>t instanceof Ry?t:new Ry(t))),this._segments=[]):(this._segments=s.map((t=>t instanceof Py?t:new Py(t))),this._cues=void 0)}get segments(){return this._segments.slice()}get cues(){if("cue"===this.type)return this._cues.slice()}get endTime(){if(Sg(this.duration))return this.offset+this.duration;if(!this._segments.length)return;const t=this._segments.reduce(((t,e)=>{const n=Sg(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:Sg(null==t?void 0:t.duration)?t.duration:0,offset:Sg(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 Ly(this._segments,t,e)}setSegments(t=[]){if("cue"===this.type)return;const e=Array.isArray(t)?t:[];this._segments=e.map((t=>t instanceof Py?t:new Py(t)))}}function Wy(t){return"string"==typeof t?t:t&&"object"==typeof t?t.nodeId||t.nodeIdOrRef||t.id:void 0}function $y(t){const e=Wy(t);let n=1;if(t&&"object"==typeof t&&Sg(t.weight)&&(n=t.weight),!e)throw new Error("Child entry requires a nodeId");return{nodeId:e,weight:n}}function Uy(t){return(Array.isArray(t)?t:[]).map((t=>$y(t)))}function jy(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 qy(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 Vy(t,e){if(e)try{var n;return new URL(e,t||(null==td||null===(n=td.location)||void 0===n?void 0:n.href)||void 0).toString()}catch(t){return e}}const Gy=new Map;class Hy{static register(t,e){if(!t||"function"!=typeof e)throw new Error("ManifestFactory.register requires type and parser function");Gy.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=Hy.inferType(t);if(!e||!Gy.has(e))throw new Error("Unsupported manifest type");return Gy.get(e)(t)}}Hy.register("dash",(function(t={}){const{body:e,url:n}=t,i=function(){if(td&&"function"==typeof td.DOMParser)return new td.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=jy(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=jy(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:jy(a&&a.getAttribute("timescale"))||jy(e&&e.getAttribute("timescale"),1)||1,startNumber:jy(a&&a.getAttribute("startNumber"))||jy(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=jy(n.getAttribute("t")),s=jy(n.getAttribute("d")),a=jy(n.getAttribute("r"),0);if(!Sg(s))continue;Sg(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:Vy(n,qy(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:Vy(n,qy(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}})),Hy.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:Sg(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=>Sg(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+(Sg(e.duration)?e.duration:0)),0),l=Sg(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}})),Hy.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=Sg(null==t?void 0:t.duration)?t.duration:30,i=Sg(null==t?void 0:t.width)?t.width:void 0,r=Sg(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};Sg(i)&&Sg(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 Ky=["video/mp4"];function Xy(t){return Ky.includes(t.mime)}var Yy={name:"containers",fn:function(t=[]){return t.filter(Xy)},isRelevantForTrack:function(t){return"video"===(null==t?void 0:t.type)}};const Qy=new(ae=new WeakMap,le=new WeakSet,class extends Qu{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),O(this,le),F(this,ae,void 0),C(ae,this,new Map)}onDispose(){M(ae,this)&&M(ae,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 A(le,this,nb).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 Jy(){return!!(td&&td.navigator&&td.navigator.mediaCapabilities&&"function"==typeof td.navigator.mediaCapabilities.decodingInfo)}function Zy(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 function(t=""){return t.toLowerCase().includes("video")}(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 tb(t){return t?JSON.stringify(t):"invalid"}async function eb(t){if(!this.settings.enabled||!A(le,this,Jy).call(this)||!t)return this.log.debug("[#queryCapabilities] Not supported, returning false",t),{supported:!1,smooth:!1,powerEfficient:!1};const e=A(le,this,tb).call(this,t),n=M(ae,this).get(e);if(n)return n;let i;try{i=await td.navigator.mediaCapabilities.decodingInfo(t)}catch(t){i={supported:!1,smooth:!1,powerEfficient:!1}}return this.log.debug("[#queryCapabilities] Config:",t,"\nDecoding info result:",i),M(ae,this).set(e,i),i}async function nb(t){if(A(le,this,rb).call(this,t))return this.log.debug("[#scoreRepresentation] Blocking HEVC on Firefox versions below support threshold",null==t?void 0:t.codecs),{score:-1e3,capability:{supported:!1,smooth:!1,powerEfficient:!1}};const e=A(le,this,Zy).call(this,t),n=await A(le,this,eb).call(this,e),i=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 r=0;return n.supported&&(r+=1),!this.settings.ignoreSmooth&&n.smooth&&(r+=this.settings.smoothWeight),!this.settings.ignorePower&&n.powerEfficient&&(r+=this.settings.powerWeight),r+=i,{score:r,capability:n}}function ib(){if(!Hm())return!1;const t=Km();return!Number.isFinite(t)||t<150}function rb(t){if(!A(le,this,ib).call(this))return!1;const e=function(t=""){const e=String(t||"").toLowerCase(),[n]=e.split(".");return n||""}((null==t?void 0:t.baseCodec)||(null==t?void 0:t.codecs)||"");return"hvc1"===e||"hev1"===e}const ob=[],sb=()=>!0;[Yy,{name:"force-video-codec",fn:function(t=[],{node:e}={}){const n=function(t){if("string"!=typeof t)return;const e=t.split(",")[0].trim();if(!e)return;const n=e.match(/^[a-z0-9]+/i);return n?n[0].toLowerCase():void 0}(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)}},{name:"media-capabilities",fn:async function(t=[],{track:e}){if(null==e||!e.preferredCodec){const n=await Qy.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:sb;ob.push({name:t,fn:e,isRelevantForTrack:i})}(t,e,{isRelevantForTrack:n})}));const ab=qu("Node","warn"),lb={start:0,end:0},cb=.001;function ub(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)<=cb&&Math.abs(t.duration-n.duration)<=cb))?{offset:n.start,duration:n.duration}:void 0}var db=new WeakMap,hb=new WeakMap,fb=new WeakMap,pb=new WeakMap,mb=new WeakMap,vb=new WeakMap,gb=new WeakMap,yb=new WeakMap,bb=new WeakMap,kb=new WeakMap,xb=new WeakSet;class wb extends Vu{constructor(t={},e={}){super(),O(this,xb),F(this,db,void 0),F(this,hb,void 0),F(this,fb,void 0),F(this,pb,void 0),F(this,mb,void 0),F(this,vb,void 0),F(this,gb,void 0),F(this,yb,void 0),F(this,bb,void 0),F(this,kb,[]);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,C(gb,this,!0===e.forceImageFallback),C(db,this,e.abrSelector),C(hb,this,e.assetsDeliveryService),C(pb,this,Sg(r)?r:void 0),C(mb,this,Sg(o)?o:void 0),C(vb,this,Sg(s)?s:void 0),C(yb,this,e&&"object"==typeof e.mediaHostRewriteMap?e.mediaHostRewriteMap:void 0),C(bb,this,Sg(e.maxManifestLoadAttempts)?e.maxManifestLoadAttempts:1/0),this.manifestLoadAttempts=0,this.manifestLoadError=void 0,C(kb,this,Uy(l))}setChildren(t){const e=Uy(t);return A(xb,this,Wb).call(this,e,{emit:!0})}addChild(t){const e=$y(t),n=M(kb,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 A(xb,this,Wb).call(this,n,{emit:!0})}removeChild(t){const e=Wy(t);if(!e)return this.children;const n=M(kb,this).filter((t=>(null==t?void 0:t.nodeId)!==e));return n.length===M(kb,this).length?this.children:A(xb,this,Wb).call(this,n,{emit:!0})}async load(t={}){const{loadingMode:e="full",signal:n}=t;ab.info(`[load] [${this.id}] Loading node in '${e}' mode`);try{if(n&&n.aborted)throw ey();"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})=>A(xb,this,Db).call(this,t,e,n))),l=s?A(xb,this,Lb).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 A(xb,this,Lb).call(this,t.segment,t.track,n);if(n&&n.aborted)throw ey();return this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:e}),this}catch(t){if(ny(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(ab.info(`[loadMediaSegmentsAtOffset] [${this.id}] Loading media segments at offset ${n}`),!Number.isFinite(n))return;const{signal:i}=e;if(i&&i.aborted)throw ey();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(A(xb,this,Db).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)<=cb&&!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})=>A(xb,this,Lb).call(this,t,e,i)))),i&&i.aborted)throw ey();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 M(fb,this)}catch(t){if(!ny(t)||e&&e.aborted)throw t;i=!0;continue}if(e&&e.aborted)throw ey();if(this.hasExceededManifestLoadAttempts()){const t=this.manifestLoadError||new Error("Manifest load retry limit reached");throw this.state="failed",this.error=t,t}const t=A(xb,this,Nb).call(this);return this.state="resolving",this.error=void 0,C(fb,this,(async()=>{try{const t=await A(xb,this,Bb).call(this,{signal:e,manifestOverride:n});if(e&&e.aborted)throw ey();let i=Hy.parse(t);return i=A(xb,this,Ab).call(this,i),this.tracks=(i.tracks||[]).map((t=>t instanceof zy?t:new zy(t))),this.mainTrackId=i.mainTrackId||this.mainTrackId,this.metadata=i.metadata||this.metadata,A(xb,this,Ub).call(this),A(xb,this,$b).call(this),await A(xb,this,zb).call(this),this.state="ready",this}catch(n){if(ny(n,e))throw A(xb,this,Mb).call(this,t),n;throw this.state="failed",this.error=n,n}})()),M(fb,this)}return M(fb,this)}evict(){this.tracks.forEach((t=>{(t.segments||[]).forEach((t=>{t.evict()}))}))}get children(){return M(kb,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?Sg(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+=Sg(e.retainedByteLength)?e.retainedByteLength:0}))})),t}get buffered(){if("ready"!==this.state)return lb;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||!Sg(e))return lb;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 lb;if(n.length===this.tracks.length&&n.every((({track:t,range:e})=>{const n=t.endTime,i=Sg(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 lb;const r=Math.min(i,e);return r>0?{start:0,end:r}:lb}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(M(bb,this))||M(bb,this)<=0)return!1;if(!this.manifestLoadError)return!1;const t=Number(this.manifestLoadAttempts);return Number.isFinite(t)&&t>=M(bb,this)}}function _b(t){return function(t,e){if(!t||"string"!=typeof t)return t;if(!e||"object"!=typeof e)return t;const n=td&&"function"==typeof td.URL?td.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,M(yb,this))}function Tb(){return M(gb,this)||void 0===td.VideoDecoder}function Ib(){return this.manifestRef&&"object"==typeof this.manifestRef&&"assets-delivery-service"===this.manifestRef.type}function Eb(t){if(!A(xb,this,Ib).call(this))return!1;if(!A(xb,this,Tb).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 Sb(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 Sg(n)?n:Sg(M(pb,this))?M(pb,this):void 0}function Ab(t){if(this.imageFallbackActive=!1,!A(xb,this,Eb).call(this,t))return t;if(!M(hb,this)||"function"!=typeof M(hb,this).resolveImageOne)return t;const e=M(hb,this).resolveImageOne(this.manifestRef),n=A(xb,this,_b).call(this,null==e?void 0:e.url);if(!n)return t;const i={typeHint:"image",url:n,duration:A(xb,this,Sb).call(this,t),width:M(mb,this),height:M(vb,this)},r=Hy.parse(i);return t&&"object"==typeof t.metadata&&!Array.isArray(t.metadata)&&(r.metadata=t.metadata),this.imageFallbackActive=!0,r}function Nb(){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 Mb(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 Fb(){const t=Number(this.manifestLoadAttempts);this.manifestLoadAttempts=Number.isFinite(t)&&t>0?t+1:1,this.manifestLoadError=void 0}function Cb(t){this.manifestLoadError=t||new Error("Manifest load failed")}function Ob(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 Pb(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 Rb(t,e){t&&("function"!=typeof t.setLoadError?t.loadError=e||new Error("Segment load failed"):t.setLoadError(e))}async function Db(t,e,n){const i=A(xb,this,Ob).call(this,e);try{const i=e.representations.map((async i=>{const r=A(xb,this,_b).call(this,i.url),o=await hy(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(ny(t,n))throw A(xb,this,Pb).call(this,e,i),t;throw A(xb,this,Rb).call(this,e,t),t}}async function Lb(t,e,n){const i=M(db,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=A(xb,this,Ob).call(this,t);try{const i=A(xb,this,_b).call(this,s.url),r=await hy(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(ny(e,n))throw A(xb,this,Pb).call(this,t,a),e;throw A(xb,this,Rb).call(this,t,e),e}}async function Bb(t={}){const{signal:e,manifestOverride:n}=t;if(e&&e.aborted)throw ey();A(xb,this,Fb).call(this);try{let t=this.manifestRef;if(n&&"object"==typeof n){if(A(xb,this,Ib).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=A(xb,this,_b).call(this,n.url);return{typeHint:n.typeHint,url:t,mimeType:n.mimeType,body:n.body,duration:M(pb,this),width:M(mb,this),height:M(vb,this)}}"string"==typeof n.url&&n.url&&(t=n)}if(t&&"object"==typeof t&&"assets-delivery-service"===t.type){if(!M(hb,this)||"function"!=typeof M(hb,this).resolveOne)throw new Error("AssetsDeliveryService is required for assets-delivery-service manifestRef");const n=await M(hb,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=A(xb,this,_b).call(this,n.url),o=n.mimeType,s=n.body;if(r||s||o)return{typeHint:i,url:r,mimeType:o,body:s,duration:M(pb,this),width:M(mb,this),height:M(vb,this)};throw new Error("AssetsDeliveryService returned unsupported manifest shape")}if(t&&"object"==typeof t){const e=A(xb,this,_b).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=A(xb,this,_b).call(this,n),r="object"==typeof t?t.typeHint:void 0,o="object"==typeof t?t.mimeType:void 0;if("image"===Hy.inferType({typeHint:r,url:i,mimeType:o})){const e="object"==typeof t&&Sg(t.duration)?t.duration:M(pb,this);return{typeHint:"image",url:i,mimeType:o,duration:e,width:"object"==typeof t&&Sg(t.width)?t.width:M(mb,this),height:"object"==typeof t&&Sg(t.height)?t.height:M(vb,this)}}const s=await hy(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(ny(t,e))throw t;throw A(xb,this,Cb).call(this,t),t}}async function zb(){const t=ob.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=ub(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 Wb(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}(M(kb,this),t)||(C(kb,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 $b(){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 Ub(){if(!Array.isArray(this.tracks)||!this.tracks.length)return;const t=this.duration;if(!Sg(t))return;const e=[new Ry({name:"nodestart",timestamp:0,data:{id:this.id},isSticky:!0}),new Ry({name:"nodeend",timestamp:t,data:{id:this.id}})],n=new zy({id:`${this.id}-auto-cue`,type:"cue",cues:e,offset:0,duration:t});this.tracks.push(n)}var jb=new WeakMap,qb=new WeakMap,Vb=new WeakMap,Gb=new WeakMap,Hb=new WeakSet;class Kb extends Qu{constructor(...t){super(...t),O(this,Hb),F(this,jb,new Map),F(this,qb,new Map),F(this,Vb,void 0),F(this,Gb,void 0);const[e,n]=t;C(Vb,this,e),C(Gb,this,n)}get name(){return"NodeRepository"}get defaults(){return{enabledRepFilters:["containers","force-video-codec","media-capabilities"],disabledTracks:vy("disabledTracks"),forceVideoCodec:vy("forceVideoCodec"),forceImageFallback:vy("forceImageFallback"),mediaHostRewriteMap:vy("mediaHostRewriteMap"),maxManifestLoadAttempts:3}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"get","list"])}onDispose(){M(jb,this).forEach(((t,e)=>{const n=M(qb,this).get(e);n&&t&&"function"==typeof t.off&&t.off(Qm.NODE_CHILDREN_CHANGED,n)})),M(qb,this).clear(),M(jb,this).clear()}add(t){const e=t instanceof wb?t:new wb(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:M(Vb,this),assetsDeliveryService:M(Gb,this)});if(!e.id)throw new Error("NodeRepository.add requires node with id");if(M(jb,this).has(e.id))throw new Error(`NodeRepository.add: node with id ${e.id} already exists`);return M(jb,this).set(e.id,e),A(Hb,this,Xb).call(this,e),this.trigger(Qm.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 M(jb,this).get(e)}list(){return Array.from(M(jb,this).values())}}function Xb(t){if(!t||"function"!=typeof t.on||!t.id)return;const e=t=>{this.trigger(Qm.NODE_CHILDREN_CHANGED,t)};t.on(Qm.NODE_CHILDREN_CHANGED,e),M(qb,this).set(t.id,e)}var Yb=new WeakMap,Qb=new WeakMap,Jb=new WeakSet;class Zb extends Qu{constructor(...t){super(...t),O(this,Jb),F(this,Yb,void 0),F(this,Qb,new Map);const[e]=t;C(Yb,this,e)}get name(){return"ABRSelector"}get defaults(){return{safetyMargin:.35,minBufferForUpgrade:5,minBufferCritical:1,hysteresisRatio:1.1,abrStrategy:vy("abrStrategy")}}select(t={}){var e;const{representations:n=[],bufferSeconds:i}=t;if(!Array.isArray(n)||0===n.length)return;const r=M(Yb,this)&&"function"==typeof M(Yb,this).getKbps?M(Yb,this).getKbps():void 0,o=A(Jb,this,tk).call(this,n[0]),s=M(Qb,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)=>A(Jb,this,ek).call(this,t.bandwidth)-A(Jb,this,ek).call(this,e.bandwidth)));if("bottom"===a){const e=l[0];return A(Jb,this,rk).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 A(Jb,this,rk).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 A(Jb,this,rk).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=Sg(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),A(Jb,this,rk).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=>A(Jb,this,ek).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&&Sg(e.bandwidth)&&Sg(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 A(Jb,this,rk).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(){M(Qb,this).clear(),C(Yb,this,null)}}function tk(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 ek(t){return Sg(t)?t/1e3:0}function nk(t){return Sg(t)?t/1e3:void 0}function ik(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:A(Jb,this,nk).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:A(Jb,this,nk).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 rk(t,e,n={}){if(!t)return;const i=A(Jb,this,ik).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=A(Jb,this,tk).call(this,t);M(Qb,this).set(r,t.id)}var ok=new WeakMap,sk=new WeakSet;class ak extends Qu{constructor(...t){super(...t),O(this,sk),F(this,ok,void 0);const[e]=t;if(C(ok,this,e),!M(ok,this)||"function"!=typeof M(ok,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(){C(ok,this,null)}getPrioritizationSnapshot(t){const e=M(ok,this).list();if(!e.length)return{orderedIds:[],reachableIds:[]};const{levels:n,weights:i}=A(sk,this,lk).call(this,e,t);return{orderedIds:A(sk,this,ck).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 lk(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=Sg(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 ck(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 uk(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 dk(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 hk(t){return"string"==typeof t&&t.startsWith("cmaf:")}function fk(t){return"image"===(null==t?void 0:t.assetType)?"image":"ivd"}function pk(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 mk=new WeakMap,vk=new WeakMap,gk=new WeakSet;class yk extends Qu{constructor(...t){super(...t),O(this,gk),F(this,mk,void 0),F(this,vk,void 0);const[,e={}]=t;C(mk,this,"function"==typeof e.fetchFn?e.fetchFn:void 0),C(vk,this,ty())}get name(){return"AssetsDeliveryService"}get defaults(){return{assetsDeliveryServiceUrl:"https://assets.eko.com",profile:vy("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(!A(gk,this,kk).call(this,t))return;const e=uk(t,this.settings.profile),n=function(t,e,n){const i=(t||"").replace(/\/$/,""),r=null==e?void 0:e.assetId,o=null==e?void 0:e.assetRevision;if(!i||"string"!=typeof r||"number"!=typeof o)return;const s=`${i}/image/${encodeURIComponent(r)}/${o}`,a=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 a?`${s}?${a}`:s}(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=>A(gk,this,kk).call(this,t)));if(!n.length)return[];const i=A(gk,this,bk).call(this,e);if(i&&i.aborted)return[];const r=[],o=this.settings.profile;n.forEach((t=>{if("image"!==fk(t))return;const e=this.resolveImageOne(t);e&&e.url&&r.push({manifestRef:dk(t,e.encodeProfile),manifest:{typeHint:"image",url:e.url}})}));const s=n.filter((t=>"image"!==fk(t))).map((t=>function(t,e){const n=uk(t,e);return{ref:t,profile:n,route:hk(n)?"dash":"ivd"}}(t,o))),a=A(gk,this,wk).call(this,s);for(const{refs:t,route:e}of a){if(i&&i.aborted)return r;const{url:n}=A(gk,this,_k).call(this,t,e),o=await A(gk,this,Tk).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:dk(t,e),manifest:pk(i)})}))}return r}onDispose(){M(vk,this)&&M(vk,this).abort(),C(vk,this,null),C(mk,this,null)}}function bk(t){return t&&t.signal?t.signal:M(vk,this)?M(vk,this).signal:void 0}function kk(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 xk(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 wk(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=>{A(gk,this,xk).call(this,t.refs,this.settings.maxBatchSize).forEach((e=>{n.push({route:t.route,refs:e})}))})),n}function _k(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 Tk(t,e){return M(mk,this)?M(mk,this).call(this,t,e):await hy(t,{returnType:"json",method:(null==e?void 0:e.method)||"GET",signal:null==e?void 0:e.signal})}function Ik({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 Ek=(td.requestAnimationFrame||td.mozRequestAnimationFrame||td.webkitRequestAnimationFrame||td.msRequestAnimationFrame||(t=>td.setTimeout(t,1e3/60))).bind(td),Sk=(td.cancelAnimationFrame||td.mozCancelAnimationFrame||td.webkitCancelAnimationFrame||td.msCancelAnimationFrame||(t=>td.clearTimeout(t))).bind(td),Ak=qu("ticker","warn");let Nk,Mk=[],Fk=null,Ck=Zg();function Ok(){Ck=Zg();const t=[];let e,n;for(n=Mk.length-1;n>=0;--n)e=Mk[n],Ck>=e.lastTick+e.interval&&t.push(e);for(n=t.length-1;n>=0;--n)if(e=t[n],!e.stopped){e.lastTick=Ck;try{e.callback()}catch(t){console&&"function"==typeof console.error?console.error(t):Ak.error(t)}}Nk=Ek(Ok)}function Pk(){Zg()-Ck>=200&&(Sk(Nk),Ok())}function Rk(t){let e=-1;for(let n=0;n<Mk.length;n+=1)if(Mk[n].callback===t){e=n;break}return e}function Dk(t,e=0){if(!t||"function"!=typeof t||"number"!=typeof e||e<0)return void Ak.error("[start] Invalid arguments given to start method.",arguments);const n=Rk(t);return-1!==n?(Ak.debug("[start] Callback already exists, overriding interval.",arguments),Mk[n].interval=e,t):(Mk.push({callback:t,interval:e,lastTick:Zg()}),1===Mk.length&&(Nk=Ek(Ok),Fk||(Fk=td.setInterval(Pk,1e3))),t)}function Lk(t){const e=Rk(t);-1!==e?(Mk[e].stopped=!0,Mk.splice(e,1),Mk.length||(Sk(Nk),td.clearInterval(Fk),Fk=null)):Ak.debug("[stop] Callback not found, doing nothing.",arguments)}function Bk(t){return-1!==Rk(t)}function zk(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 Ak.error("[createThrottler] Bad argument given to createThrottler, first argument must be a function.",arguments);Ak.debug("[createThrottler] Creating a new throttler instance.",arguments);const s=[];function a(){Ak.debug("[onThrottlerTick] Calling callback with "+s.length+" queued items.");const e=s.slice(0);s.length=0,Lk(a),t(e)}const l={push:function(t){Ak.debug("[push] Queuing argument:",t),0===s.length&&Dk(a,e),s.push(t),o+=1,(o<=r||s.length>=i)&&a()},flush:function(){Ak.debug("[flush] Flushing queue."),0!==s.length&&a()},dispose:function(){Ak.debug("[dispose] Disposing of throttler.");const t=s.slice(0);return s.length=0,Lk(a),t}};return Object.defineProperty(l,"interval",{enumerable:!0,get:function(){return e},set:function(t){"number"==typeof t&&(e=t)}}),l}function Wk(t,e){if(t&&"function"==typeof t)return t.__tickerThrottler||(t.__tickerThrottler=zk((function(){t()}),e)),"number"==typeof e&&(t.__tickerThrottler.interval=e),t.__tickerThrottler.push(),t.__tickerThrottler;Ak.error("[scheduleExecution] Bad argument given to scheduleExecution, first argument must be a function.",arguments)}var $k=new WeakMap,Uk=new WeakMap,jk=new WeakMap,qk=new WeakMap,Vk=new WeakMap,Gk=new WeakMap,Hk=new WeakMap,Kk=new WeakMap,Xk=new WeakMap,Yk=new WeakMap,Qk=new WeakMap,Jk=new WeakMap,Zk=new WeakMap,tx=new WeakMap,ex=new WeakMap,nx=new WeakMap,ix=new WeakSet;class rx extends Qu{constructor(...t){super(...t),O(this,ix),F(this,$k,void 0),F(this,Uk,void 0),F(this,jk,void 0),F(this,qk,void 0),F(this,Vk,[]),F(this,Gk,[]),F(this,Hk,new Set),F(this,Kk,new Set),F(this,Xk,!1),F(this,Yk,void 0),F(this,Qk,void 0),F(this,Jk,void 0),F(this,Zk,void 0),F(this,tx,void 0),F(this,ex,void 0),F(this,nx,void 0);const[e,n,i,r]=t;C($k,this,e),C(Uk,this,n),C(jk,this,i),C(qk,this,r),C(Yk,this,ty());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),C(nx,this,(()=>A(ix,this,mx).call(this))),A(ix,this,lx).call(this),A(ix,this,ax).call(this)}get name(){return"NodeResolver"}get defaults(){return{maxConcurrent:5}}onDispose(){var t;M(Yk,this)&&M(Yk,this).abort(),C(Yk,this,null),M(qk,this)&&"function"==typeof M(qk,this).off&&M(Jk,this)&&M(qk,this).off(Qm.PLACEMENT_ADDED,M(Jk,this)),M(qk,this)&&"function"==typeof M(qk,this).off&&M(ex,this)&&M(qk,this).off(Qm.TIMELINE_RESET,M(ex,this)),M($k,this)&&"function"==typeof M($k,this).off&&M(Zk,this)&&M($k,this).off(Qm.NODE_ADD,M(Zk,this)),M($k,this)&&"function"==typeof M($k,this).off&&M(tx,this)&&M($k,this).off(Qm.NODE_CHILDREN_CHANGED,M(tx,this)),C(Jk,this,null),C(Zk,this,null),C(tx,this,null),C(ex,this,null),C(Vk,this,[]),C(Gk,this,[]),M(Hk,this).clear(),M(Kk,this).clear(),C(Xk,this,!1),C(Qk,this,void 0),null!==(t=M(nx,this))&&void 0!==t&&t.__tickerThrottler&&M(nx,this).__tickerThrottler.dispose(),C(nx,this,null)}}function ox(){return M(Yk,this)?M(Yk,this).signal:void 0}function sx(){return this._disposed||M(Yk,this)&&M(Yk,this).signal.aborted}function ax(){M(qk,this)&&"function"==typeof M(qk,this).on&&(C(Jk,this,(t=>{A(ix,this,ux).call(this,null==t?void 0:t.nodeId)})),M(qk,this).on(Qm.PLACEMENT_ADDED,M(Jk,this)),C(ex,this,(()=>A(ix,this,cx).call(this))),M(qk,this).on(Qm.TIMELINE_RESET,M(ex,this))),M($k,this)&&"function"==typeof M($k,this).on&&(C(Zk,this,(({node:t})=>{(null==t?void 0:t.id)&&A(ix,this,ux).call(this,t.id,{fromRepoAdd:!0})})),M($k,this).on(Qm.NODE_ADD,M(Zk,this)),C(tx,this,(()=>{Wk(M(nx,this),100)})),M($k,this).on(Qm.NODE_CHILDREN_CHANGED,M(tx,this)))}function lx(){const t=M(qk,this)&&Array.isArray(M(qk,this).placements)?M(qk,this).placements:[];t.forEach((t=>A(ix,this,ux).call(this,t.nodeId)));const e=t.length?t[t.length-1]:void 0;e&&e.nodeId&&C(Qk,this,e.nodeId)}function cx(){M(Yk,this)&&M(Yk,this).abort(),C(Yk,this,ty()),C(Vk,this,[]),C(Gk,this,[]),M(Hk,this).clear(),C(Xk,this,!1),C(Qk,this,void 0)}function ux(t,{fromRepoAdd:e=!1}={}){A(ix,this,sx).call(this)||t&&(M(Kk,this).has(t)||M(Hk,this).has(t)||(M(Vk,this).push(t),M(Qk,this)||e||C(Qk,this,t),!M(Xk,this)&&e||A(ix,this,dx).call(this)))}function dx(){if(M(Xk,this))return void A(ix,this,hx).call(this);if(0===M(Vk,this).length)return;C(Xk,this,!0);const t=M(Vk,this).shift();A(ix,this,vx).call(this,t).finally((()=>{A(ix,this,hx).call(this)}))}async function hx(){if(!A(ix,this,sx).call(this))for(M(Vk,this).length||M(Gk,this).length||C(Gk,this,A(ix,this,fx).call(this));M(Hk,this).size<this.settings.maxConcurrent;){const t=this.settings.maxConcurrent-M(Hk,this).size;if(t<=0)break;const e=[];for(;e.length<t&&(M(Vk,this).length||M(Gk,this).length);){let t=M(Vk,this).shift();t||(t=M(Gk,this).shift()),t&&e.push(t)}if(!e.length)break;const n=A(ix,this,gx).call(this,e);n.length&&M(jk,this)&&"function"==typeof M(jk,this).resolve&&A(ix,this,yx).call(this,n).finally((()=>A(ix,this,hx).call(this))),e.filter((t=>!n.find((e=>e.nodeId===t)))).forEach((t=>{A(ix,this,vx).call(this,t).finally((()=>A(ix,this,hx).call(this)))}))}}function fx(){const t=new Set([...M(Kk,this),...M(Hk,this),...M(Vk,this)]);return A(ix,this,px).call(this,t)}function px(t){const e=M(qk,this)&&Array.isArray(M(qk,this).placements)?M(qk,this).placements:[],n=(e.length?e[e.length-1].nodeId:void 0)||M(Qk,this);return Ik({prioritizer:M(Uk,this),repository:M($k,this),startNodeId:n,pendingIds:t,fallbackToRepository:!1})}function mx(){A(ix,this,sx).call(this)||(M(Xk,this)||0!==M(Vk,this).length)&&(C(Gk,this,A(ix,this,fx).call(this)),M(Xk,this)&&A(ix,this,hx).call(this))}async function vx(t,e){if(!t||M(Kk,this).has(t)||M(Hk,this).has(t))return;const n=A(ix,this,ox).call(this);if(n&&n.aborted)return;const i=M($k,this)&&"function"==typeof M($k,this).get?M($k,this).get(t):void 0;if(i&&"function"==typeof i.resolve)if("function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts())M(Kk,this).add(t);else{M(Hk,this).add(t);try{const r={signal:n};e&&(r.manifestOverride=e),await i.resolve(r),M(Kk,this).add(t)}catch(e){if(ny(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()&&M(Kk,this).add(t)}finally{M(Hk,this).delete(t)}}}function gx(t){const e=[];return t.forEach((t=>{const n=M($k,this)&&"function"==typeof M($k,this).get?M($k,this).get(t):void 0;n&&n.manifestRef&&"assets-delivery-service"===n.manifestRef.type&&e.push({nodeId:t,ref:n.manifestRef})})),e}async function yx(t){const e=A(ix,this,ox).call(this);if(!e||!e.aborted){t.forEach((({nodeId:t})=>M(Hk,this).add(t)));try{const n=t.map((t=>t.ref)),i=await M(jk,this).resolve(n,{signal:e});t.forEach((({nodeId:t,ref:e})=>{var n;const r=M($k,this)&&"function"==typeof M($k,this).get?M($k,this).get(t):void 0;if(M(Hk,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?A(ix,this,bx).call(this,o.manifest,s):void 0;A(ix,this,vx).call(this,t,a)}))}catch(n){ny(n,e)||this.log.warn(`NodeResolver ADS batch failed: ${(null==n?void 0:n.message)||n}`),t.forEach((({nodeId:t})=>M(Hk,this).delete(t)))}}}function bx(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 kx=.001,xx="priority";function wx(t){const e=Number(t);return Number.isFinite(e)?e:0}var _x=new WeakMap,Tx=new WeakMap,Ix=new WeakMap,Ex=new WeakMap,Sx=new WeakMap,Ax=new WeakMap,Nx=new WeakMap,Mx=new WeakMap,Fx=new WeakMap,Cx=new WeakMap,Ox=new WeakMap,Px=new WeakMap,Rx=new WeakMap,Dx=new WeakMap,Lx=new WeakMap,Bx=new WeakMap,zx=new WeakMap,Wx=new WeakMap,$x=new WeakMap,Ux=new WeakSet;class jx extends Qu{constructor(...t){super(...t),O(this,Ux),F(this,_x,void 0),F(this,Tx,void 0),F(this,Ix,void 0),F(this,Ex,new Map),F(this,Sx,new Map),F(this,Ax,[]),F(this,Nx,new Set),F(this,Mx,new Map),F(this,Fx,!1),F(this,Cx,void 0),F(this,Ox,void 0),F(this,Px,void 0),F(this,Rx,void 0),F(this,Dx,void 0),F(this,Lx,void 0),F(this,Bx,void 0),F(this,zx,!1),F(this,Wx,[]),F(this,$x,void 0);const[e,n,i]=t;C(_x,this,e),C(Tx,this,n),C(Ix,this,i),C(Ox,this,ty()),C($x,this,(()=>A(Ux,this,bw).call(this))),A(Ux,this,tw).call(this)}get name(){return"SegmentLoadCoordinator"}get defaults(){return{maxConcurrentLoads:3,maxSegmentLoadAttempts:3}}onDispose(){var t;M(Ox,this)&&M(Ox,this).abort(),C(Ox,this,null),M(Mx,this).size&&M(Mx,this).forEach((t=>{(null==t?void 0:t.controller)&&t.controller.abort()})),M(Mx,this).clear(),M(Ix,this)&&"function"==typeof M(Ix,this).off&&(M(Px,this)&&M(Ix,this).off(Qm.PLACEMENT_ADDED,M(Px,this)),M(Dx,this)&&M(Ix,this).off(Qm.TIMELINE_SEEKING,M(Dx,this)),M(Lx,this)&&M(Ix,this).off(Qm.TIMELINE_SEEKED,M(Lx,this)),M(Bx,this)&&M(Ix,this).off(Qm.TIMELINE_RESET,M(Bx,this))),M(_x,this)&&"function"==typeof M(_x,this).off&&M(Rx,this)&&M(_x,this).off(Qm.NODE_CHILDREN_CHANGED,M(Rx,this)),C(Px,this,null),C(Rx,this,null),C(Dx,this,null),C(Lx,this,null),C(Bx,this,null),M(Ex,this).clear(),M(Sx,this).clear(),C(Ax,this,[]),M(Nx,this).clear(),M(Mx,this).clear(),C(Fx,this,!1),C(Cx,this,void 0),C(zx,this,!1),C(Wx,this,[]),null!==(t=M($x,this))&&void 0!==t&&t.__tickerThrottler&&M($x,this).__tickerThrottler.dispose(),C($x,this,null)}}function qx(){return M(Ox,this)?M(Ox,this).signal:void 0}function Vx(){return this._disposed||M(Ox,this)&&M(Ox,this).signal.aborted}function Gx(){const t=Number(this.settings.maxSegmentLoadAttempts);return Number.isFinite(t)&&t>0?t:1/0}function Hx(t){const e=A(Ux,this,Gx).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 Kx(t){if(!t)return!1;if(A(Ux,this,Hx).call(this,t))return!0;if("boolean"==typeof t.isLoaded)return t.isLoaded;const e=Number(t.retainedByteLength);return Number.isFinite(e)&&e>0}function Xx(t,{allowSeekKeep:e=!1,segmentOffset:n}={}){const i=ty(),r=i?i.signal:A(Ux,this,qx).call(this);return t&&M(Mx,this).set(t,{controller:i,allowSeekKeep:!!e,segmentOffset:n}),{signal:r,controller:i}}function Yx(t,e,n={}){const i=M(Mx,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 Qx(t,e){const n=M(Mx,this).get(t);n&&(e&&n.controller!==e||M(Mx,this).delete(t))}function Jx(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=M(_x,this)&&"function"==typeof M(_x,this).get?M(_x,this).get(i):void 0;if(!r)return;const o=A(Ux,this,cw).call(this,r,t,e);Number.isFinite(o)&&n.add(`${i}:${o}`)})),n}function Zx(t){M(Mx,this).size&&M(Mx,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 tw(){M(Ix,this)&&"function"==typeof M(Ix,this).on&&(C(Px,this,(t=>{A(Ux,this,rw).call(this,t)})),M(Ix,this).on(Qm.PLACEMENT_ADDED,M(Px,this)),C(Dx,this,(t=>A(Ux,this,ew).call(this,t))),M(Ix,this).on(Qm.TIMELINE_SEEKING,M(Dx,this)),C(Lx,this,(t=>A(Ux,this,nw).call(this,t))),M(Ix,this).on(Qm.TIMELINE_SEEKED,M(Lx,this)),C(Bx,this,(()=>A(Ux,this,iw).call(this))),M(Ix,this).on(Qm.TIMELINE_RESET,M(Bx,this))),M(_x,this)&&"function"==typeof M(_x,this).on&&(C(Rx,this,(()=>{Wk(M($x,this),100)})),M(_x,this).on(Qm.NODE_CHILDREN_CHANGED,M(Rx,this)))}function ew(t={}){if(A(Ux,this,Vx).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=A(Ux,this,Jx).call(this,n,e);A(Ux,this,Zx).call(this,i),C(zx,this,!0),C(Wx,this,n.map((t=>{const n=null==t?void 0:t.nodeId;if(n)return{nodeId:n,placement:t,targetTime:e}})).filter(Boolean)),setTimeout((()=>A(Ux,this,sw).call(this)),0)}function nw(t={}){var e,n;if(A(Ux,this,Vx).call(this))return;C(zx,this,!1),C(Wx,this,[]);const i=Number.isFinite(null==t?void 0:t.targetTime)?Number(t.targetTime):Number(null===(e=M(Ix,this))||void 0===e?void 0:e.currentTime);(Array.isArray(null===(n=M(Ix,this))||void 0===n?void 0:n.placements)?M(Ix,this).placements:[]).forEach((t=>{if(!t)return;const e=tm(t);if(Number.isFinite(e)){if(Number.isFinite(i)){if(e>=i)return void A(Ux,this,rw).call(this,t);const n=Jp(t,M(_x,this));return Number.isFinite(n)?void(e+n>i&&A(Ux,this,rw).call(this,t)):void(e<=i&&A(Ux,this,rw).call(this,t))}A(Ux,this,rw).call(this,t)}})),setTimeout((()=>A(Ux,this,sw).call(this)),0)}function iw(){M(Ox,this)&&M(Ox,this).abort(),C(Ox,this,ty()),M(Mx,this).size&&M(Mx,this).forEach((t=>{(null==t?void 0:t.controller)&&t.controller.abort()})),M(Mx,this).clear(),M(Ex,this).clear(),M(Sx,this).clear(),C(Ax,this,[]),M(Nx,this).clear(),C(Fx,this,!1),C(Cx,this,void 0),C(zx,this,!1),C(Wx,this,[])}function rw(t){if(A(Ux,this,Vx).call(this))return;const e=null==t?void 0:t.nodeId;if(!e)return;const n=M(Ex,this).get(e);if(n){const i=tm(n),r=tm(t);Number.isFinite(i)?Number.isFinite(r)&&r<i&&M(Ex,this).set(e,t):Number.isFinite(r)&&M(Ex,this).set(e,t)}else M(Ex,this).set(e,t);const i=M(Cx,this);C(Cx,this,e),i&&i!==e&&C(Ax,this,[]),M(Fx,this)?setTimeout((()=>A(Ux,this,sw).call(this)),0):A(Ux,this,ow).call(this)}function ow(){M(Fx,this)||M(Ex,this).size&&(C(Fx,this,!0),A(Ux,this,sw).call(this))}async function sw(){if(A(Ux,this,Vx).call(this))return;if(M(Nx,this).size>=this.settings.maxConcurrentLoads)return;if(M(zx,this))return void(M(Wx,this).length&&A(Ux,this,aw).call(this));const t=A(Ux,this,hw).call(this);if(t.hasPending)A(Ux,this,fw).call(this,t);else for(M(Ax,this).length||C(Ax,this,A(Ux,this,gw).call(this));M(Nx,this).size<this.settings.maxConcurrentLoads&&M(Ax,this).length;){const t=M(Ax,this).shift();A(Ux,this,kw).call(this,t,"partial").finally((()=>{setTimeout((()=>A(Ux,this,sw).call(this)),0)}))}}function aw(){if(A(Ux,this,Vx).call(this))return;const t=Math.max(0,this.settings.maxConcurrentLoads-M(Nx,this).size);if(!t||!M(Wx,this).length)return;const e=[],n=[];for(let i=0;i<M(Wx,this).length;i+=1){const r=M(Wx,this)[i];(null==r?void 0:r.nodeId)&&(e.length<t&&!M(Nx,this).has(r.nodeId)?e.push(r):n.push(r))}C(Wx,this,n),e.forEach((t=>{A(Ux,this,lw).call(this,t).finally((()=>{setTimeout((()=>A(Ux,this,sw).call(this)),0)}))}))}async function lw(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(M(Nx,this).has(e))return;const{signal:r,controller:o}=A(Ux,this,Xx).call(this,e);if(r&&r.aborted)A(Ux,this,Qx).call(this,e,o);else{M(Nx,this).add(e);try{const t=M(_x,this)&&"function"==typeof M(_x,this).get?M(_x,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=A(Ux,this,cw).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}`),A(Ux,this,Yx).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){ny(t,r)||this.log.warn(`[#loadSeekWork] SegmentLoadCoordinator failed to seek-load node ${e}: ${(null==t?void 0:t.message)||t}`)}finally{M(Nx,this).delete(e),A(Ux,this,Qx).call(this,e,o)}}}function cw(t,e,n){var i;const r=tm(e);if(!Number.isFinite(r))return;const o=wx(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=wx(null===(i=l)||void 0===i?void 0:i.offset),d=Ly(c,Math.max(0,s-u),{preferRepresentationTime:!0}),h=Number(null==d?void 0:d.offset);return Number.isFinite(h)?h:void 0}function uw(t,e,n=(t=>null===(t=M(Ix,this))||void 0===t?void 0:t.currentTime)()){var i;const r=(Array.isArray(null===(i=M(Ix,this))||void 0===i?void 0:i.placements)?M(Ix,this).placements:[]).filter((e=>(null==e?void 0:e.nodeId)===t&&Number.isFinite(tm(e)))).sort(((t,e)=>tm(t)-tm(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=tm(e);if(!Number.isFinite(n))continue;const i=Jp(e,M(_x,this)),l=Number.isFinite(i)&&i>=0;(!a&&n>=o-kx&&(a=e),l)?o+kx>=n&&o<n+i-kx&&(s=e):o+kx>=n&&(s=e)}return s||a||r[r.length-1]}function dw(t,e){var n;const i=Number(tm(e));if(!Number.isFinite(i))return;const r=Jp(e,M(_x,this)),o=Number.isFinite(r)&&r>=0?i+r:void 0,s=(Array.isArray(null===(n=M(Ix,this))||void 0===n?void 0:n.placements)?M(Ix,this).placements:[]).filter((e=>(null==e?void 0:e.nodeId)===t&&Number.isFinite(tm(e)))).sort(((t,e)=>tm(t)-tm(e)));for(let t=0;t<s.length;t+=1){const e=s[t],n=Number(tm(e));if(Number.isFinite(n)&&!(n<=i+kx)){if(Number.isFinite(o)&&n>o+kx)return;return e}}}function hw(){const t=[];let e=!1,n=1/0;if(M(Ex,this).forEach(((i,r)=>{if(!r||!i)return;const o=M(Sx,this).get(r);if(o)return e=!0,void(n=Math.min(n,wx(o.timelineStart)));const s=A(Ux,this,pw).call(this,r,i);s&&(e=!0,n=Math.min(n,wx(s.timelineStart)),t.push(s))})),!e||!Number.isFinite(n))return{hasPending:!1,waveTime:void 0,startable:[]};const i=t.filter((t=>wx(t.timelineStart)===n&&!M(Nx,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 fw({waveTime:t,startable:e}){const n=Math.max(0,this.settings.maxConcurrentLoads-M(Nx,this).size);n&&e.length&&e.slice(0,n).forEach((e=>{A(Ux,this,vw).call(this,e,t).finally((()=>{setTimeout((()=>A(Ux,this,sw).call(this)),0)}))}))}function pw(t,e){var n,i;const r=M(_x,this)&&"function"==typeof M(_x,this).get?M(_x,this).get(t):void 0;if(!r)return;if("function"==typeof r.hasExceededManifestLoadAttempts&&r.hasExceededManifestLoadAttempts())return void M(Ex,this).delete(t);const o=A(Ux,this,uw).call(this,t,e,null===(n=M(Ix,this))||void 0===n?void 0:n.currentTime),s=Number(tm(o)),a=wx(null===(i=M(Ix,this))||void 0===i?void 0:i.currentTime),l="function"==typeof r.loadMediaSegmentsAtOffset,c="function"==typeof r.load;if(!l&&!c)return void M(Ex,this).delete(t);if(r.isLoaded)return void M(Ex,this).delete(t);if("ready"!==r.state){if(!Number.isFinite(s))return;return{nodeId:t,segmentOffset:0,timelineStart:s}}if(!A(Ux,this,xw).call(this,r))return void M(Ex,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&&!A(Ux,this,Kx).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/kx)*kx;h.add(t)}}))}));const f=Array.from(h).sort(((t,e)=>t-e)),p=e=>{const n=Number(tm(e));if(!Number.isFinite(n))return{status:"none"};const i=wx(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+kx;t+=1)s=t;const l=f.slice(s);if(!l.some((t=>A(Ux,this,mw).call(this,r,t))))return{status:f.slice(0,s).some((t=>A(Ux,this,mw).call(this,r,t)))?"beforeOnly":"none"};const c=l.find((t=>A(Ux,this,mw).call(this,r,t))),u=Math.max(0,wx(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};M(Ex,this).delete(t)}else{const e=A(Ux,this,dw).call(this,t,o);if(e){const t=p(e);if("work"===t.status)return t.work}}}function mw(t,e){const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[],i=wx(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)<=kx&&!A(Ux,this,Kx).call(this,t)}))))}async function vw(t,e){const n=null==t?void 0:t.nodeId,i=null==t?void 0:t.segmentOffset;if(this.log.debug(`[#loadP0Work] Loading ${xx} node [${n}] at segmentOffset=${i} wave=${e}`),!n)return;const r=M(_x,this)&&"function"==typeof M(_x,this).get?M(_x,this).get(n):void 0;if(!r)return void M(Ex,this).delete(n);const o="function"==typeof r.loadMediaSegmentsAtOffset&&Number.isFinite(i),{signal:s,controller:a}=A(Ux,this,Xx).call(this,n,{allowSeekKeep:o,segmentOffset:i});if(s&&s.aborted)A(Ux,this,Qx).call(this,n,a);else{M(Nx,this).add(n),M(Sx,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(ny(t,s))return;const e=`[#loadP0Work] SegmentLoadCoordinator failed to load ${xx} work for node ${n}: ${(null==t?void 0:t.message)||t}`;this.log.warn(e)}finally{this.log.debug(`[#loadP0Work] Finished ${xx} work for node [${n}]`),M(Sx,this).delete(n),M(Nx,this).delete(n),A(Ux,this,Qx).call(this,n,a)}}}function gw(){const t=new Set([...M(Ex,this).keys(),...M(Nx,this)]),e=A(Ux,this,yw).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&&A(Ux,this,ww).call(this,t));if(i){const e=Ik({prioritizer:M(Tx,this),repository:M(_x,this),startNodeId:M(Cx,this),prioritizedIds:n,pendingIds:t,allowedIds:i,filter:r});if(e.length)return e}return Ik({prioritizer:M(Tx,this),repository:M(_x,this),startNodeId:M(Cx,this),prioritizedIds:n,pendingIds:t,filter:r})}function yw(){return M(Tx,this)&&M(Cx,this)?"function"==typeof M(Tx,this).getPrioritizationSnapshot?M(Tx,this).getPrioritizationSnapshot(M(Cx,this)):{orderedIds:"function"==typeof M(Tx,this).sortNodes?M(Tx,this).sortNodes(M(Cx,this)):[],reachableIds:"function"==typeof M(Tx,this).getReachableNodeIds?M(Tx,this).getReachableNodeIds(M(Cx,this)):[]}:null}function bw(){A(Ux,this,Vx).call(this)||(M(Fx,this)||M(Ex,this).size)&&(C(Ax,this,A(Ux,this,gw).call(this)),M(Fx,this)&&!M(zx,this)&&A(Ux,this,sw).call(this))}async function kw(t,e){if(this.log.debug(`[#loadNode] Loading node [${t}] in '${e}' mode`),!t)return;const n=M(_x,this)&&"function"==typeof M(_x,this).get?M(_x,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}=A(Ux,this,Xx).call(this,t,{allowSeekKeep:!1});if(i&&i.aborted)A(Ux,this,Qx).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&&A(Ux,this,ww).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${t}: partial already loaded`);if(!A(Ux,this,xw).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${t}: no loadable tracks`);M(Nx,this).add(t),await n.load({loadingMode:e,signal:i})}catch(e){if(ny(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}]`),M(Nx,this).delete(t),A(Ux,this,Qx).call(this,t,r)}}function xw(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 ww(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&&!A(Ux,this,Kx).call(this,n)||i&&!A(Ux,this,Kx).call(this,i))}))}class _w extends Qu{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 Tw(t){if(!t)throw new Error("Assertion failed.")}const Iw=t=>t&&t[t.length-1],Ew=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)},Sw=t=>t.constructor===Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t),Aw=t=>t.constructor===DataView?t:ArrayBuffer.isView(t)?new DataView(t.buffer,t.byteOffset,t.byteLength):new DataView(t),Nw=new TextDecoder,Mw=t=>Object.fromEntries(Object.entries(t).map((([t,e])=>[e,t]))),Fw={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},Cw=Mw(Fw),Ow={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},Pw=Mw(Ow),Rw={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},Dw=Mw(Rw),Lw=t=>[...t].map((t=>t.toString(16).padStart(2,"0"))).join(""),Bw=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,zw=(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},Ww=(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},$w=()=>{let t,e;return{promise:new Promise(((n,i)=>{t=n,e=i})),resolve:t,reject:e}},Uw=(t,e,n)=>t.getUint8(e)<<16|t.getUint8(e+1)<<8|t.getUint8(e+2),jw=(t,e,n)=>Math.max(e,Math.min(n,t)),qw=/^[a-z]{3}$/,Vw=1e6*(1+Number.EPSILON);let Gw=null;let Hw=null;const Kw=()=>{if(null!==Hw)return Hw;if("undefined"==typeof navigator)return null;const t=/\bChrome\/(\d+)/.exec(navigator.userAgent);return t?Hw=Number(t[1]):null},Xw=t=>"number"==typeof t&&!Number.isNaN(t);class Yw{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 Qw={default:!0,forced:!1,original:!1,commentary:!1,hearingImpaired:!1,visuallyImpaired:!1};class Jw{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 Jw(this.bytes);return t.pos=this.pos,t}}const Zw=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],t_=[-1,1,2,3,4,5,6,8],e_=t=>{if(!t||t.byteLength<2)throw new TypeError("AAC description must be at least 2 bytes long.");const e=new Jw(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<Zw.length&&(r=Zw[i]);const o=e.readBits(4);let s=null;return o>=1&&o<=7&&(s=t_[o]),{objectType:n,frequencyIndex:i,sampleRate:r,channelConfiguration:o,numberOfChannels:s}},n_=["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"],i_=[{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}],r_=t=>{const{codec:e,codecDescription:n,colorSpace:i,avcCodecInfo:r,hevcCodecInfo:o,vp9CodecInfo:s,av1CodecInfo:a}=t;if("avc"===e){if(Tw(null!==t.avcType),r){const e=new Uint8Array([r.avcProfileIndication,r.profileCompatibility,r.avcLevelIndication]);return`avc${t.avcType}.${Lw(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}.${Lw(n.subarray(1,4))}`}if("hevc"===e){let t,e,i,r,s,a;if(o)t=o.generalProfileSpace,e=o.generalProfileIdc,i=Bw(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=Aw(n),l=o.getUint8(1);t=l>>6&3,e=31&l,i=Bw(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=Iw(i_).level;for(const t of i_)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=Iw(i_).level;for(const t of i_)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?Fw[i.primaries]:1,u=null!=i&&i.transfer?Ow[i.transfer]:1,d=null!=i&&i.matrix?Rw[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}'.`)},o_=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:e_(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&&n_.includes(e))return e;throw new TypeError(`Unhandled codec '${e}'.`)},s_=/^pcm-([usf])(\d+)+(be)?$/,a_=[48e3,44100,32e3],l_=[24e3,22050,16e3];var c_,u_;!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"}(c_||(c_={})),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"}(u_||(u_={}));const d_=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})},h_=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=Uw(i,n):(Tw(4===e),t=i.getUint32(n,!1)),n+=e,yield{offset:n,length:t},n+=t}},f_=t=>31&t,p_=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)},m_=t=>t>>1&63,v_=function*(t){const e=new Jw(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);Tw(e.pos%8==0),yield{type:i,data:t.subarray(e.pos/8,e.pos/8+s)},e.skipBits(8*s)}};var g_;!function(t){t[t.STREAMINFO=0]="STREAMINFO",t[t.VORBIS_COMMENT=4]="VORBIS_COMMENT",t[t.PICTURE=6]="PICTURE"}(g_||(g_={}));const y_=[2,1,2,3,3,4,4,5];class b_{constructor(t){this.input=t}}const k_=[],x_=[],w_=new Uint8Array(0);class __{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===w_&&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===w_}get microsecondTimestamp(){return Math.trunc(Vw*this.timestamp)}get microsecondDuration(){return Math.trunc(Vw*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 __(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 __(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 T_=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.")},I_=t=>{if(!Xw(t))throw new TypeError("timestamp must be a number.")},E_=(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 S_{constructor(t){if(!(t instanceof A_))throw new TypeError("track must be an InputTrack.");this._track=t}getFirstPacket(t={}){if(T_(t),this._track.input._disposed)throw new tT;return E_(this._track,this._track._backing.getFirstPacket(t),t)}async getFirstKeyPacket(t={}){T_(t);const e=await this.getFirstPacket(t);return e?"key"===e.type?e:this.getNextKeyPacket(e,t):null}getPacket(t,e={}){if(I_(t),T_(e),this._track.input._disposed)throw new tT;return E_(this._track,this._track._backing.getPacket(t,e),e)}getNextPacket(t,e={}){if(!(t instanceof __))throw new TypeError("packet must be an EncodedPacket.");if(T_(e),this._track.input._disposed)throw new tT;return E_(this._track,this._track._backing.getNextPacket(t,e),e)}async getKeyPacket(t,e={}){if(I_(t),T_(e),this._track.input._disposed)throw new tT;if(!e.verifyKeyPackets)return this._track._backing.getKeyPacket(t,e);const n=await this._track._backing.getKeyPacket(t,e);return n?(Tw("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 __))throw new TypeError("packet must be an EncodedPacket.");if(T_(e),this._track.input._disposed)throw new tT;if(!e.verifyKeyPackets)return this._track._backing.getNextKeyPacket(t,e);const n=await this._track._backing.getNextKeyPacket(t,e);return n?(Tw("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 __))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 __))throw new TypeError("endPacket must be an EncodedPacket.");if(T_(n),this._track.input._disposed)throw new tT;const i=[];let{promise:r,resolve:o}=$w(),{promise:s,resolve:a}=$w(),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}=$w()),await s):(i.push(u),o(),({promise:r,resolve:o}=$w()),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 tT;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 A_{constructor(t,e){this.input=t,this._backing=e}isVideoTrack(){return this instanceof N_}isAudioTrack(){return this instanceof M_}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 S_(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 N_ extends A_{constructor(t,e){super(t,e),this._backing=e,this.pixelAspectRatio=(t=>{Tw(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 Tw(null!==e),k_.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 __))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 Tw(e),((t,e,n)=>{switch(t){case"avc":for(const t of((t,e)=>{if(e.description){const n=3&Sw(e.description)[4];return h_(t,n+1)}return d_(t)})(n,e)){const e=n[t.offset],r=f_(e);if(r>=c_.NON_IDR_SLICE&&r<=c_.SLICE_DPC)return"delta";if(r===c_.IDR)return"key";if(r===c_.SEI&&(i=void 0,!(null!==Gw?Gw:Gw=!("undefined"==typeof navigator||(null===(i=navigator.vendor)||void 0===i||!i.includes("Google Inc"))&&!/Chrome/.test(navigator.userAgent)))||Kw()>=144)){const e=n.subarray(t.offset,t.offset+t.length),i=p_(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 Jw(i);t.pos=8*r;const e=Ew(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&Sw(e.description)[21];return h_(t,n+1)}return d_(t)})(n,e)){const e=m_(n[t.offset]);if(e<u_.BLA_W_LP)return"delta";if(e<=u_.RSV_IRAP_VCL23)return"key"}return"delta";case"vp8":return 1&n[0]?"delta":"key";case"vp9":{const t=new Jw(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 v_(n))if(1===e){const e=new Jw(i);e.skipBits(4),t=!!e.readBits(1)}else if(3===e||6===e||7===e){if(t)return"key";const e=new Jw(i);return e.readBits(1)?null:0===e.readBits(2)?"key":"delta"}return null}default:(t=>{throw new Error(`Unexpected value: ${t}`)})(t),Tw(!1)}var i})(this.codec,e,t.data)}}class M_ extends A_{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 Tw(null!==e),x_.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 __))throw new TypeError("packet must be an EncodedPacket.");return null===this.codec?null:"key"}}const F_=t=>{let e=cT(t);const n=pT(t,4);let i=8;1===e&&(e=dT(t),i=16);const r=e-i;return r<0?null:{name:n,totalSize:e,headerSize:i,contentSize:r}},C_=t=>uT(t)/65536,O_=t=>uT(t)/1073741824,P_=t=>{let e=0;for(let n=0;n<4;n++){e<<=7;const n=oT(t);if(e|=127&n,!(128&n))break}return e},R_=t=>{let e=sT(t);return t.skip(2),e=Math.min(e,t.remainingLength),Nw.decode(rT(t,e))},D_=t=>{const e=F_(t);if(!e||"data"!==e.name)return null;if(t.remainingLength<8)return null;const n=cT(t);t.skip(4);const i=rT(t,e.contentSize-8);switch(n){case 1:return Nw.decode(i);case 2:return new TextDecoder("utf-16be").decode(i);case 13:return new Yw(i,"image/jpeg");case 14:return new Yw(i,"image/png");case 27:return new Yw(i,"image/bmp");default:return i}};class L_ extends b_{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=F_(e);if(!i)break;if("ftyp"===i.name){const t=pT(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),Tw(t);const e=cT(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=F_(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,Tw(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&&n_.includes(t.info.codec)&&0===n.sampleCompositionTimeOffsets.length){var r;Tw("audio"===(null===(r=t.info)||void 0===r?void 0:r.type));const e=(t=>{if(Tw(n_.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=s_.exec(t);let n;return Tw(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=Ww(n.sampleTimingEntries,a,(t=>t.startIndex)),u=n.sampleTimingEntries[c],d=Ww(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=Iw(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),Tw(n);const i=F_(n);Tw("moof"===(null==i?void 0:i.name));let r=this.reader.requestSlice(t,i.totalSize);r instanceof Promise&&(r=await r),Tw(r),this.traverseBox(r);const o=this.lastReadFragment;Tw(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)V_(t,i.timestamp);else{const e=Ww(n,o.moofOffset-1,(t=>t.moofOffset));if(-1!==e){const i=n[e];V_(t,i.endTimestamp)}}t.startTimestampIsFinal=!0}const i=Ww(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=F_(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,_,T,I,E,S,A,N,M,F,C,O,P,R,D;const L=t.filePos,B=F_(t);if(!B)return!1;const z=t.filePos,W=L+B.totalSize;switch(B.name){case"mdia":case"minf":case"dinf":case"mfra":case"edts":case"wave":this.readContiguousBoxes(t.slice(z,B.contentSize));break;case"mvhd":{const e=oT(t);t.skip(3),1===e?(t.skip(16),this.movieTimescale=cT(t),this.movieDurationInTimescale=dT(t)):(t.skip(8),this.movieTimescale=cT(t),this.movieDurationInTimescale=cT(t))}break;case"trak":{const e={id:-1,demuxer:this,inputTrack:null,disposition:{...Qw},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,B.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 N_(this.input,new z_(t)),this.tracks.push(e)}else if("audio"===e.info.type&&-1!==e.info.numberOfChannels){const t=e;e.inputTrack=new M_(this.input,new W_(t)),this.tracks.push(e)}this.currentTrack=null}break;case"tkhd":{const e=this.currentTrack;if(!e)break;const n=oT(t),i=!!(1&aT(t));if(e.disposition.default=i,0===n)t.skip(8),e.id=cT(t),t.skip(4),e.durationInMovieTimescale=cT(t);else{if(1!==n)throw new Error(`Incorrect track header version ${n}.`);t.skip(16),e.id=cT(t),t.skip(4),e.durationInMovieTimescale=dT(t)}t.skip(16);const r=[C_(t),C_(t),O_(t),C_(t),C_(t),O_(t),C_(t),C_(t),O_(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=G_(r),90*Math.round(Ct/90)));Tw(0===o||90===o||180===o||270===o),e.rotation=o}break;case"elst":{const e=this.currentTrack;if(!e)break;const n=oT(t);t.skip(3);let i=!1,r=0;const o=cT(t);for(let s=0;s<o;s++){const o=1===n?dT(t):cT(t),s=1===n?hT(t):uT(t),a=C_(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=oT(t);t.skip(3),0===n?(t.skip(8),e.timescale=cT(t),e.durationInMediaTimescale=cT(t)):1===n&&(t.skip(16),e.timescale=cT(t),e.durationInMediaTimescale=dT(t));let i=sT(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,qw.test(Ft)||(e.languageCode="und")}}break;case"hdlr":{const e=this.currentTrack;if(!e)break;t.skip(8);const n=pT(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=L,this.readContiguousBoxes(t.slice(z,B.contentSize))}break;case"stsd":{const e=this.currentTrack;if(!e)break;if(null===e.info||e.sampleTable)break;const n=oT(t);t.skip(3);const i=cT(t);for(let r=0;r<i;r++){const i=t.filePos,r=F_(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=sT(t),e.info.height=sT(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=sT(t);t.skip(6);let a=sT(t),l=sT(t);t.skip(4);let c=cT(t)/65536;if(0===n&&s>0)if(1===s)t.skip(4),l=8*cT(t),t.skip(8);else if(2===s){t.skip(4),c=fT(t),a=cT(t),t.skip(4),l=cT(t);const n=cT(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;Tw(e.info),e.info.codecDescription=rT(t,B.contentSize)}break;case"hvcC":{const e=this.currentTrack;if(!e)break;Tw(e.info),e.info.codecDescription=rT(t,B.contentSize)}break;case"vpcC":{var $;const e=this.currentTrack;if(!e)break;Tw("video"===(null===($=e.info)||void 0===$?void 0:$.type)),t.skip(4);const n=oT(t),i=oT(t),r=oT(t),o=r>>4,s=r>>1&7,a=1&r,l=oT(t),c=oT(t),u=oT(t);e.info.vp9CodecInfo={profile:n,level:i,bitDepth:o,chromaSubsampling:s,videoFullRangeFlag:a,colourPrimaries:l,transferCharacteristics:c,matrixCoefficients:u}}break;case"av1C":{var U;const e=this.currentTrack;if(!e)break;Tw("video"===(null===(U=e.info)||void 0===U?void 0:U.type)),t.skip(1);const n=oT(t),i=n>>5,r=31&n,o=oT(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 j;const e=this.currentTrack;if(!e)break;if(Tw("video"===(null===(j=e.info)||void 0===j?void 0:j.type)),"nclx"!==pT(t,4))break;const n=sT(t),i=sT(t),r=sT(t),o=Boolean(128&oT(t));e.info.colorSpace={primaries:Cw[n],transfer:Pw[i],matrix:Dw[r],fullRange:o}}break;case"pasp":{var q;const e=this.currentTrack;if(!e)break;Tw("video"===(null===(q=e.info)||void 0===q?void 0:q.type));const n=cT(t),i=cT(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;Tw("audio"===(null===(V=e.info)||void 0===V?void 0:V.type)),t.skip(4),Tw(3===oT(t)),P_(t),t.skip(2);const n=oT(t),i=!!(64&n),r=!!(32&n);if(!!(128&n)&&t.skip(2),i){const e=oT(t);t.skip(e)}r&&t.skip(2),Tw(4===oT(t));const o=P_(t),s=t.filePos,a=oT(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){Tw(5===oT(t));const n=P_(t);if(e.info.codecDescription=rT(t,n),"aac"===e.info.codec){const t=e_(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;Tw("audio"===(null===(G=e.info)||void 0===G?void 0:G.type)),255&sT(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;Tw("audio"===(null===(H=e.info)||void 0===H?void 0:H.type)),t.skip(4);const n=oT(t),i=Boolean(1&n),r=oT(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;Tw("audio"===(null===(K=e.info)||void 0===K?void 0:K.type)),t.skip(1);const n=oT(t),i=sT(t),r=cT(t),o=lT(t),s=oT(t);let a;a=0!==s?rT(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;Tw("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=oT(t),o=aT(t);if((r&n)===g_.STREAMINFO){t.skip(10);const n=cT(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=rT(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;Tw("audio"===(null===(Y=e.info)||void 0===Y?void 0:Y.type));const n=rT(t,3),i=new Jw(n),r=i.readBits(2);i.skipBits(8);const o=i.readBits(3),s=i.readBits(1);r<3&&(e.info.sampleRate=a_[r]),e.info.numberOfChannels=y_[o]+s}break;case"dec3":{var Q;const e=this.currentTrack;if(!e)break;Tw("audio"===(null===(Q=e.info)||void 0===Q?void 0:Q.type));const n=(t=>{if(t.length<2)return null;const e=new Jw(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}})(rT(t,B.contentSize));if(!n){console.warn("Invalid dec3 box contents, ignoring.");break}const i=(t=>{const e=t.substreams[0];return Tw(e),e.fscod<3?a_[e.fscod]:null!==e.fscod2&&e.fscod2<3?l_[e.fscod2]:null})(n);null!==i&&(e.info.sampleRate=i),e.info.numberOfChannels=(t=>{const e=t.substreams[0];Tw(e);let n=y_[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=cT(t);let i=0,r=0;for(let o=0;o<n;o++){const n=cT(t),o=cT(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=cT(t);let i=0;for(let r=0;r<n;r++){const n=cT(t),r=uT(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=cT(t),i=cT(t);if(0===n)for(let n=0;n<i;n++){const n=cT(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=oT(t),i=cT(t),r=rT(t,Math.ceil(i*n/8)),o=new Jw(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=cT(t);for(let i=0;i<n;i++){const n=cT(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=cT(t);for(let i=0;i<n;i++){const n=cT(t)-1,i=cT(t),r=cT(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=cT(t);for(let i=0;i<n;i++){const n=cT(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=cT(t);for(let i=0;i<n;i++){const n=dT(t);e.sampleTable.chunkOffsets.push(n)}}break;case"mvex":this.isFragmented=!0,this.readContiguousBoxes(t.slice(z,B.contentSize));break;case"mehd":{const e=oT(t);t.skip(3);const n=1===e?dT(t):cT(t);this.movieDurationInTimescale=n}break;case"trex":{t.skip(4);const e=cT(t),n=cT(t),i=cT(t),r=cT(t),o=cT(t);this.fragmentTrackDefaults.push({trackId:e,defaultSampleDescriptionIndex:n,defaultSampleDuration:i,defaultSampleSize:r,defaultSampleFlags:o})}break;case"tfra":{const e=oT(t);t.skip(3);const n=cT(t),i=this.tracks.find((t=>t.id===n));if(!i)break;const r=cT(t),o=(12&r)>>2,s=3&r,a=[oT,sT,aT,cT],l=a[(48&r)>>4],c=a[o],u=a[s],d=cT(t);for(let n=0;n<d;n++){const n=1===e?dT(t):cT(t),r=1===e?dT(t):cT(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:L,moofSize:B.totalSize,implicitBaseDataOffset:L,trackData:new Map},this.readContiguousBoxes(t.slice(z,B.contentSize)),this.lastReadFragment=this.currentFragment,this.currentFragment=null;break;case"traf":if(Tw(this.currentFragment),this.readContiguousBoxes(t.slice(z,B.contentSize)),this.currentTrack){const t=this.currentFragment.trackData.get(this.currentTrack.id);if(t){const{currentFragmentState:e}=this.currentTrack;Tw(e),null!==e.startTimestamp&&(V_(t,e.startTimestamp),t.startTimestampIsFinal=!0)}this.currentTrack.currentFragmentState=null,this.currentTrack=null}break;case"tfhd":{var J,Z,tt,et;Tw(this.currentFragment),t.skip(1);const e=aT(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=cT(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=dT(t):l&&(u.currentFragmentState.baseDataOffset=this.currentFragment.moofOffset),i&&(u.currentFragmentState.sampleDescriptionIndex=cT(t)),r&&(u.currentFragmentState.defaultSampleDuration=cT(t)),o&&(u.currentFragmentState.defaultSampleSize=cT(t)),s&&(u.currentFragmentState.defaultSampleFlags=cT(t)),a&&(u.currentFragmentState.defaultSampleDuration=0)}break;case"tfdt":{const e=this.currentTrack;if(!e)break;Tw(e.currentFragmentState);const n=oT(t);t.skip(3);const i=0===n?cT(t):dT(t);e.currentFragmentState.startTimestamp=i}break;case"trun":{const e=this.currentTrack;if(!e)break;if(Tw(this.currentFragment),Tw(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=oT(t),i=aT(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=cT(t);let d=e.currentFragmentState.baseDataOffset;r&&(d+=uT(t));let h=null;o&&(h=cT(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=cT(t):(Tw(null!==e.currentFragmentState.defaultSampleDuration),r=e.currentFragmentState.defaultSampleDuration),a?o=cT(t):(Tw(null!==e.currentFragmentState.defaultSampleSize),o=e.currentFragmentState.defaultSampleSize),l?u=cT(t):(Tw(null!==e.currentFragmentState.defaultSampleFlags),u=e.currentFragmentState.defaultSampleFlags),0===i&&null!==h&&(u=h);let d=0;c&&(d=0===n?cT(t):uT(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[Iw(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,B.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]=R_(y)):null!==(ct=(at=this.metadataTags.raw)[lt=t.name])&&void 0!==ct||(at[lt]=rT(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=Nw.decode(rT(y,t.contentSize)):null!==(n=(e=this.metadataTags).title)&&void 0!==n||(e.title=R_(y));break;case"©des":this.currentTrack||null!==(r=(i=this.metadataTags).description)&&void 0!==r||(i.description=R_(y));break;case"©ART":this.currentTrack||null!==(s=(o=this.metadataTags).artist)&&void 0!==s||(o.artist=R_(y));break;case"©alb":this.currentTrack||null!==(l=(a=this.metadataTags).album)&&void 0!==l||(a.album=R_(y));break;case"albr":this.currentTrack||null!==(u=(c=this.metadataTags).albumArtist)&&void 0!==u||(c.albumArtist=R_(y));break;case"©gen":this.currentTrack||null!==(h=(d=this.metadataTags).genre)&&void 0!==h||(d.genre=R_(y));break;case"©day":if(!this.currentTrack){var ut,dt;const t=new Date(R_(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=R_(y));break;case"©lyr":this.currentTrack||null!==(v=(m=this.metadataTags).lyrics)&&void 0!==v||(m.lyrics=R_(y))}}}break;case"meta":{if(this.currentTrack)break;const e=0!==cT(t);this.currentMetadataKeys=new Map,e?this.readContiguousBoxes(t.slice(z,B.contentSize)):this.readContiguousBoxes(t.slice(z+4,B.contentSize-4)),this.currentMetadataKeys=null}break;case"keys":{if(!this.currentMetadataKeys)break;t.skip(4);const e=cT(t);for(let n=0;n<e;n++){const e=cT(t);t.skip(4);const i=Nw.decode(rT(t,e-8));this.currentMetadataKeys.set(n+1,i)}}break;case"ilst":{if(!this.currentMetadataKeys)break;const e=this.iterateContiguousBoxes(t.slice(z,B.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=D_(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!==(T=(_=this.metadataTags).album)&&void 0!==T||(_.album=r));break;case"aART":case"album_artist":"string"==typeof r&&(null!==(E=(I=this.metadataTags).albumArtist)&&void 0!==E||(I.albumArtist=r));break;case"©cmt":case"com.apple.quicktime.comment":case"comment":"string"==typeof r&&(null!==(A=(S=this.metadataTags).comment)&&void 0!==A||(S.comment=r));break;case"©gen":case"gnre":case"com.apple.quicktime.genre":case"genre":"string"==typeof r&&(null!==(M=(N=this.metadataTags).genre)&&void 0!==M||(N.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 Yw?(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,Tt,It,Et;const t=Aw(r),e=t.getUint16(2,!1),n=t.getUint16(4,!1);e>0&&(null!==(Tt=(_t=this.metadataTags).trackNumber)&&void 0!==Tt||(_t.trackNumber=e)),n>0&&(null!==(Et=(It=this.metadataTags).tracksTotal)&&void 0!==Et||(It.tracksTotal=n))}break;case"disc":case"disk":if(r instanceof Uint8Array&&r.length>=6){var St,At,Nt,Mt;const t=Aw(r),e=t.getUint16(2,!1),n=t.getUint16(4,!1);e>0&&(null!==(At=(St=this.metadataTags).discNumber)&&void 0!==At||(St.discNumber=e)),n>0&&(null!==(Mt=(Nt=this.metadataTags).discsTotal)&&void 0!==Mt||(Nt.discsTotal=n))}}}}}var Ft,Ct;return t.filePos=W,!0}}class B_{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=$_(i,n),o=await this.fetchPacketForSampleIndex(r,e);return H_(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=Ww(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=U_(i,n),o=await this.fetchPacketForSampleIndex(r,e);return H_(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=q_(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 Tw(-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=j_(n,t);if(!i)return null;let r;if(e.metadataOnly)r=w_;else{let t=this.internalTrack.demuxer.reader.requestSlice(i.sampleOffset,i.sampleSize);t instanceof Promise&&(t=await t),Tw(t),r=rT(t,i.sampleSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new __(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(Tw(i),n.metadataOnly)r=w_;else{let t=this.internalTrack.demuxer.reader.requestSlice(i.byteOffset,i.byteSize);t instanceof Promise&&(t=await t),Tw(t),r=rT(t,i.byteSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new __(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=Ww(this.internalTrack.fragmentLookupTable,n,(t=>t.timestamp)),h=-1!==d?this.internalTrack.fragmentLookupTable[d]:null,f=Ww(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=F_(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];Tw(!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 z_ extends B_{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 v_(t)){if(1!==e)continue;const t=new Jw(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 Jw(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=Iw(i_).level;for(const t of i_)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:r_(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 W_ extends B_{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:o_(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 $_=(t,e)=>{if(t.presentationTimestamps){const n=Ww(t.presentationTimestamps,e,(t=>t.presentationTimestamp));return-1===n?-1:t.presentationTimestamps[n].sampleIndex}{const n=Ww(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)}},U_=(t,e)=>{if(!t.keySampleIndices)return $_(t,e);if(t.presentationTimestamps){const n=Ww(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!==zw(t.keySampleIndices,n,(t=>t)))return n}return-1}{var n;const i=$_(t,e),r=Ww(t.keySampleIndices,i,(t=>t));return null!==(n=t.keySampleIndices[r])&&void 0!==n?n:-1}},j_=(t,e)=>{const n=Ww(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=Ww(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=Ww(t.sampleToChunk,e,(t=>t.startSampleIndex)),c=t.sampleToChunk[l];Tw(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];Tw(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!==zw(t.keySampleIndices,e,(t=>t))}},q_=(t,e)=>{var n;if(!t.keySampleIndices)return e+1;const i=Ww(t.keySampleIndices,e,(t=>t));return null!==(n=t.keySampleIndices[i+1])&&void 0!==n?n:-1},V_=(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},G_=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},H_=t=>0===t.sampleSizes.length;class K_{}class X_ extends K_{async _getMajorBrand(t){let e=t._reader.requestSlice(0,12);return e instanceof Promise&&(e=await e),e?(e.skip(4),"ftyp"!==pT(e,4)?null:pT(e,4)):null}_createDemuxer(t){return new L_(t)}}const Y_=new class extends X_{async _canReadInput(t){const e=await this._getMajorBrand(t);return!!e&&"qt "!==e}get name(){return"MP4"}get mimeType(){return"video/mp4"}};class Q_{constructor(){this._disposed=!1,this._sizePromise=null,this.onread=null}async getSizeOrNull(){var t;if(this._disposed)throw new tT;return null!==(t=this._sizePromise)&&void 0!==t?t:this._sizePromise=Promise.resolve(this._retrieveSize())}async getSize(){if(this._disposed)throw new tT;const t=await this.getSizeOrNull();if(null===t)throw new Error("Cannot determine the size of an unsized source.");return t}}class J_ extends Q_{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&&(!Xw(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=Ww(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:Aw(o),offset:t};this._currentIndex>r&&this._throwDueToCacheMiss();const{promise:s,resolve:a,reject:l}=$w();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:Aw(e.bytes),offset:e.start}),this._pendingSlices.splice(t,1),t--))}for(this._cache.push({start:i,end:r,bytes:n,view:Aw(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!==(ce=Symbol.dispose)&&void 0!==ce||(Symbol.dispose=Symbol("Symbol.dispose"));class Z_{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 K_))))throw new TypeError("options.formats must be an array of InputFormat.");if(!(t.source instanceof Q_))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 eT(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(),Tw(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 tT extends Error{constructor(t="Input has been disposed."){super(t),this.name="InputDisposedError"}}class eT{constructor(t){this.source=t}requestSlice(t,e){if(this.source._disposed)throw new tT;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 nT(e.bytes,e.view,e.offset,t,n):null)):i?new nT(i.bytes,i.view,i.offset,t,n):null}requestSliceRange(t,e,n){if(this.source._disposed)throw new tT;if(t<0)return null;if(null!==this.fileSize)return this.requestSlice(t,jw(this.fileSize-t,e,n));{const i=this.requestSlice(t,n),r=i=>{if(i)return i;const r=i=>(Tw(null!==i),this.requestSlice(t,jw(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 nT{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 nT(t,Aw(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 nT(this.bytes,this.view,this.offset,t,t+e)}}const iT=(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.`)},rT=(t,e)=>{iT(t,e);const n=t.bytes.subarray(t.bufferPos,t.bufferPos+e);return t.bufferPos+=e,n},oT=t=>(iT(t,1),t.view.getUint8(t.bufferPos++)),sT=t=>{iT(t,2);const e=t.view.getUint16(t.bufferPos,!1);return t.bufferPos+=2,e},aT=t=>{iT(t,3);const e=Uw(t.view,t.bufferPos);return t.bufferPos+=3,e},lT=t=>{iT(t,2);const e=t.view.getInt16(t.bufferPos,!1);return t.bufferPos+=2,e},cT=t=>{iT(t,4);const e=t.view.getUint32(t.bufferPos,!1);return t.bufferPos+=4,e},uT=t=>{iT(t,4);const e=t.view.getInt32(t.bufferPos,!1);return t.bufferPos+=4,e},dT=t=>4294967296*cT(t)+cT(t),hT=t=>4294967296*uT(t)+cT(t),fT=t=>{iT(t,8);const e=t.view.getFloat64(t.bufferPos,!1);return t.bufferPos+=8,e},pT=(t,e)=>{iT(t,e);let n="";for(let i=0;i<e;i++)n+=String.fromCharCode(t.bytes[t.bufferPos++]);return n};var mT=new WeakMap,vT=new WeakMap,gT=new WeakMap,yT=new WeakMap,bT=new WeakMap,kT=new WeakMap,xT=new WeakMap,wT=new WeakMap,_T=new WeakMap,TT=new WeakMap,IT=new WeakMap,ET=new WeakMap,ST=new WeakMap,AT=new WeakMap,NT=new WeakMap,MT=new WeakSet;class FT extends Qu{constructor(...t){super(...t),O(this,MT),F(this,mT,null),F(this,vT,null),F(this,gT,null),F(this,yT,null),F(this,bT,!1),F(this,kT,!1),F(this,xT,!1),F(this,wT,!1),F(this,_T,void 0),F(this,TT,null),F(this,IT,null),F(this,ET,!1),F(this,ST,!1),F(this,AT,null),F(this,NT,!1)}get name(){return"FMP4Demuxer"}get defaults(){return{}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"pushChunk","endOfStream"])}pushChunk(t,e={}){if(M(xT,this)||M(wT,this))return;const n=t instanceof Uint8Array?t:new Uint8Array(t),i=!!e.isInit;C(TT,this,A(MT,this,LT).call(this,n,e,i)),i&&(C(_T,this,n),C(IT,this,null),this.trigger("demux:init",{data:n})),A(MT,this,DT).call(this);try{var r;const t=null===(r=M(mT,this))||void 0===r?void 0:r.write(n);t&&"function"==typeof t.catch&&t.catch((t=>{A(MT,this,BT).call(this,t)}))}catch(t){if(M(xT,this)||A(MT,this,CT).call(this,t))return;return this.log.warn("[FMP4Demuxer] mediabunny demux failed",t),void A(MT,this,BT).call(this,t)}const o=A(MT,this,$T).call(this);o&&"function"==typeof o.catch&&o.catch((t=>{A(MT,this,BT).call(this,t)}))}endOfStream(){if(M(wT,this))return;if(M(ET,this))return;let t;C(ET,this,!0),C(ST,this,!1),C(NT,this,!1);try{var e;t=null===(e=M(mT,this))||void 0===e?void 0:e.close()}catch(e){t=Promise.resolve()}let n=!1;A(MT,this,PT).call(this),C(AT,this,setTimeout((()=>{C(AT,this,null),n||M(ST,this)||M(wT,this)||A(MT,this,RT).call(this)}),20)),Promise.resolve(t).catch((()=>{})).finally((()=>{n=!0,A(MT,this,PT).call(this),A(MT,this,RT).call(this)}))}onDispose(){super.onDispose(),C(wT,this,!0);try{var t,e;null===(t=M(gT,this))||void 0===t||null===(e=t.close)||void 0===e||e.call(t)}catch(t){}this.endOfStream();try{var n,i;null===(n=M(vT,this))||void 0===n||null===(i=n.dispose)||void 0===i||i.call(n)}catch(t){}C(gT,this,null),C(vT,this,null),C(xT,this,!1),C(TT,this,null),C(yT,this,null),C(bT,this,!1),C(kT,this,!1),C(ET,this,!1),C(ST,this,!1),C(NT,this,!1),A(MT,this,PT).call(this)}}function CT(t){return!!M(wT,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 OT(){try{var t,e;const n=null===(t=M(mT,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){}C(mT,this,null)}function PT(){null!==M(AT,this)&&(clearTimeout(M(AT,this)),C(AT,this,null))}function RT(){if(M(ST,this)||M(wT,this)||M(xT,this))return;if(C(ST,this,!0),M(kT,this))return void C(NT,this,!0);C(NT,this,!1);const t=A(MT,this,$T).call(this);t&&"function"==typeof t.catch&&t.catch((t=>{A(MT,this,BT).call(this,t)}))}function DT(){if(M(vT,this)&&M(mT,this))return;const t=td.TransformStream;if(void 0===t)throw new Error("TransformStream is not available in this environment");const{readable:e,writable:n}=new t;C(mT,this,n.getWriter()),C(vT,this,new Z_({source:new J_(e),formats:[Y_]})),C(bT,this,!1)}function LT(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 BT(t){if(M(xT,this)||A(MT,this,CT).call(this,t))return;if(A(MT,this,WT).call(this,t))return void C(bT,this,!1);C(xT,this,!0),A(MT,this,OT).call(this);try{var e,n;null===(e=M(gT,this))||void 0===e||null===(n=e.close)||void 0===n||n.call(e)}catch(t){}C(gT,this,null);try{var i,r;null===(i=M(vT,this))||void 0===i||null===(r=i.dispose)||void 0===r||r.call(i)}catch(t){}C(vT,this,null);const o={error:t,recoverable:!1,severity:"fatal",streamClosed:M(ET,this),streamFinalized:M(ST,this)};M(TT,this)&&(o.context={...M(TT,this)}),this.trigger("demux:error",o)}function zT(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 WT(t){return!!A(MT,this,zT).call(this,t)&&(!M(ST,this)||M(NT,this))}async function $T(){if(!(M(wT,this)||M(xT,this)||M(bT,this)||M(kT,this))){C(kT,this,!0);try{A(MT,this,DT).call(this);const t=await M(vT,this).getPrimaryVideoTrack(),e=t?null:await M(vT,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 M(vT,this).getMimeType();this.trigger("demux:init",{...M(_T,this)?{data:M(_T,this)}:{},decoderConfig:i,codec:r,mimeType:o}),C(gT,this,new S_(n)),C(bT,this,!0),C(yT,this,(async()=>{try{for await(const t of M(gT,this).packets()){if(M(wT,this))break;const e="number"==typeof t.timestamp?t.timestamp:0;null===M(IT,this)&&C(IT,this,e);let n=e-M(IT,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){A(MT,this,BT).call(this,t)}})())}catch(t){if(A(MT,this,WT).call(this,t))return;throw t}finally{C(kT,this,!1),!M(NT,this)||M(xT,this)||M(wT,this)||A(MT,this,RT).call(this)}}}const UT=1e6,jT=24e3/1001,qT=new Uint8Array;function VT(t){return t?t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):qT:qT}let GT=null;const HT={video:(ue=new WeakMap,de=new WeakMap,he=new WeakMap,fe=new WeakMap,pe=new WeakMap,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,Te=new WeakMap,Ie=new WeakMap,Ee=new WeakMap,Se=new WeakMap,Ae=new WeakMap,Ne=new WeakMap,Me=new WeakMap,Fe=new WeakMap,Ce=new WeakMap,Oe=new WeakMap,Pe=new WeakMap,Re=new WeakMap,De=new WeakMap,Le=new WeakMap,Be=new WeakMap,ze=new WeakMap,We=new WeakMap,$e=new WeakMap,Ue=new WeakMap,je=new WeakMap,qe=new WeakSet,class extends _w{get name(){return"WebCodecsSegmentDecoder"}get defaults(){return{decodedHorizonSeconds:1,maxDecodedFrames:24,maxDecodeQueueSize:4,convertFramesToBitmapsOnAndroid:!0,androidFixEndOfSegmentDelta:.2}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"decodeChunk"])}constructor(...t){super(...t),O(this,qe),F(this,ue,void 0),F(this,de,[]),F(this,he,void 0),F(this,fe,void 0),F(this,pe,void 0),F(this,me,void 0),F(this,ve,[]),F(this,ge,void 0),F(this,ye,new Map),F(this,be,!0),F(this,ke,!1),F(this,xe,!1),F(this,we,!1),F(this,_e,void 0),F(this,Te,!1),F(this,Ie,!1),F(this,Ee,0),F(this,Se,void 0),F(this,Ae,void 0),F(this,Ne,{}),F(this,Me,void 0),F(this,Fe,0),F(this,Ce,null),F(this,Oe,!1),F(this,Pe,null),F(this,Re,void 0),F(this,De,0),F(this,Le,0),F(this,Be,0),F(this,ze,0),F(this,We,!1),F(this,$e,!1),F(this,Ue,.2),F(this,je,Promise.resolve()),C(he,this,this.settings.decodedHorizonSeconds||1),C(fe,this,A(qe,this,LI).call(this,this.settings.maxDecodedFrames)),C(pe,this,A(qe,this,zI).call(this,this.settings.maxDecodeQueueSize)),C(We,this,jm()),C($e,this,A(qe,this,NI).call(this,this.settings.convertFramesToBitmapsOnAndroid)),C(Ue,this,A(qe,this,MI).call(this,this.settings.androidFixEndOfSegmentDelta)),C(me,this,(()=>0)),C(ge,this,(()=>A(qe,this,kI).call(this)));const e=this.settings.demuxerOptions?{FMP4Demuxer:this.settings.demuxerOptions}:{};C(ue,this,new FT(e)),M(ue,this).on("demux:init",(t=>A(qe,this,uI).call(this,t))),M(ue,this).on("demux:sample",(t=>A(qe,this,dI).call(this,t))),M(ue,this).on("demux:complete",(()=>A(qe,this,hI).call(this))),M(ue,this).on("demux:error",(t=>A(qe,this,ZT).call(this,t)))}setCurrentTimeProvider(t){"function"==typeof t&&C(me,this,t)}setTimeOffsetSeconds(t){const e=Number(t);C(Fe,this,Number.isFinite(e)?e:0)}setSeekTargetTimeSeconds(t){const e=Number(t);C(Ce,this,Number.isFinite(e)?e:null),C(Oe,this,!1),C(Pe,this,null)}endOfStream(){M(ue,this)&&"function"==typeof M(ue,this).endOfStream&&M(ue,this).endOfStream()}configure(t){super.configure(t),C(Ne,this,{codec:A(qe,this,$I).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)}),C(Se,this,M(Ne,this).codec)}setSegment(t){this.lastSegment=t,A(qe,this,sI).call(this)}setNodeId(t){C(Re,this,t)}decode(t){this.setSegment(t);const e=null==t?void 0:t.arrayBuffer;e&&M(ue,this).pushChunk(e,{isInit:!(null==t||!t.isInit)})}async decodeChunk(t,e={}){await M(ue,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 M(de,this).slice()}onDispose(){if(super.onDispose(),A(qe,this,_I).call(this),M(ue,this)&&"function"==typeof M(ue,this).dispose&&M(ue,this).dispose(),C(de,this,[]),C(ve,this,[]),M(ye,this).clear(),C(Pe,this,null),M(_e,this)&&"function"==typeof M(_e,this).close)try{M(_e,this).close()}catch(t){}C(_e,this,null),C(Te,this,!1),C(Ae,this,null),C(Se,this,null),C(Re,this,null),C(je,this,Promise.resolve()),A(qe,this,sI).call(this)}}),audio:(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 _w{constructor(...t){super(...t),O(this,Je),F(this,Ve,void 0),F(this,Ge,[]),F(this,He,0),F(this,Ke,!1),F(this,Xe,!1),F(this,Ye,void 0),F(this,Qe,0)}get name(){return"WebAudioDecoder"}setSegment(t){C(Ye,this,t)}setTimeOffsetSeconds(t){const e=Number(t);C(Qe,this,Number.isFinite(e)?e:0)}decode(t){if(this.lastSegment=t,!t)return;if(t.isInit)return void C(Ve,this,VT(t.arrayBuffer));const e=t.arrayBuffer;e&&A(Je,this,YT).call(this,VT(e),!0)}decodeChunk(t,e={}){if(!t)return;if(e.isInit)return void C(Ve,this,VT(t));const n=VT(t);if(!n.length)return;M(Ge,this).push(n),C(He,this,M(He,this)+n.length);const i=Number(e.loaded),r=Number(e.total);Number.isFinite(i)&&Number.isFinite(r)&&r>0&&i>=r&&A(Je,this,KT).call(this)}endOfStream(){A(Je,this,KT).call(this)}onDispose(){super.onDispose(),C(Ve,this,void 0),C(Ge,this,[]),C(He,this,0),C(Ke,this,!1),C(Xe,this,!1),C(Ye,this,void 0)}}),image:class extends _w{#z;#W=0;#$=[];#U=0;#j;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.#$=[new Uint8Array(e)],this.#U=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.#$.push(n),this.#U+=n.length)}async endOfStream(){var t,e,n;if(this.#j)return;if(!(this.#$.length&&this.#U>0))return;const i=new Uint8Array(this.#U);let r=0;for(let t=0;t<this.#$.length;t+=1){const e=this.#$[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 td.Blob)return;const n="string"==typeof e?e:"";return new td.Blob([t],n?{type:n}:void 0)}(t,e);if(!n)throw new Error("Image decode requires Blob support");let i;if("function"==typeof td.Image&&td.URL&&"function"==typeof td.URL.createObjectURL&&"function"==typeof td.URL.revokeObjectURL){const t=td.URL.createObjectURL(n);try{const e=new td.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{td.URL.revokeObjectURL(t)}}if("function"==typeof td.createImageBitmap)try{return td.createImageBitmap(n)}catch(t){i=t}if(i)throw i;throw new Error("No supported image decode mechanism")}(i,s);this.#j=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&&(Sg(o.width)||(o.width=e.width),Sg(o.height)||(o.height=e.height)),this.trigger("decoder:frame",{pts:this.#W,duration:Sg(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.#j&&"function"==typeof this.#j.close)try{this.#j.close()}catch(t){}this.#j=null,this.#$=[],this.#U=0,this.#z=null}}};function KT(){if(M(Ke,this)||M(Xe,this))return;if(!M(He,this))return;const t=A(Je,this,XT).call(this);t.length&&A(Je,this,YT).call(this,t,!1)}function XT(){const t=M(Ve,this),e=t?t.length:0,n=e+M(He,this);if(!n)return qT;const i=new Uint8Array(n);let r=0;e&&(i.set(t,r),r+=e);for(let t=0;t<M(Ge,this).length;t+=1){const e=M(Ge,this)[t];e&&e.length&&(i.set(e,r),r+=e.length)}return i}function YT(t,e){if(M(Ke,this)||M(Xe,this))return;const n=e?A(Je,this,QT).call(this,t):t;if(!n||!n.length)return;const i=function(){if(GT)return GT;const t=td.AudioContext||td.webkitAudioContext;return t?(GT=new t,GT):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);C(Xe,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;C(Ke,this,!0);const n=Number.isFinite(null==t?void 0:t.duration)?t.duration:Number(null===(e=M(Ye,this))||void 0===e?void 0:e.duration)||void 0;this.trigger("decoder:audio",{audioBuffer:t,pts:M(Qe,this),duration:n})})).catch((t=>{this.trigger("decoder:error",{error:t})})).finally((()=>{C(Ge,this,[]),C(He,this,0),C(Xe,this,!1)}))}function QT(t){const e=M(Ve,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 JT(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:M(Re,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=M(Ne,this))||void 0===r?void 0:r.codec)||M(Se,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 ZT(t){const e=(null==t?void 0:t.error)||t,n=A(qe,this,JT).call(this,t,e);if(A(qe,this,tI).call(this,t,e))return this.log.warn("[onDemuxError] recoverable demux error",n),void A(qe,this,hI).call(this);const i=A(qe,this,cI).call(this,t),r=A(qe,this,eI).call(this,i);if(i&&0===i.missingFrames)return this.log.warn(`[onDemuxError] ignoring demux error (no missing frames)${r}`,{...n,missingFrameStats:i}),void A(qe,this,hI).call(this);let o=n;i&&(o={...n,missingFrameStats:i}),this.log.warn(`[onDemuxError] demux error${r}`,o),this.trigger("decoder:error",t)}function tI(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 eI(t){return t?` expectedFrames=${A(qe,this,nI).call(this,t.expectedFrames)} demuxedFrames=${A(qe,this,nI).call(this,t.demuxedFrames)} missingFrames=${A(qe,this,nI).call(this,t.missingFrames)}`:""}function nI(t){if(null==t)return"unknown";const e=Number(t);return Number.isFinite(e)?String(e):"unknown"}function iI(t,e={}){return{expectedFrames:null,demuxedFrames:M(De,this),missingFrames:null,reason:t,...e}}function rI(t){const e=Number(t);return Number.isFinite(e)?e:null}function oI(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 A(qe,this,iI).call(this,"segment_duration_unavailable",{segmentDurationSeconds:A(qe,this,rI).call(this,s),demuxedCoverageSeconds:M(ze,this),frameDurationSeconds:null});const a=A(qe,this,lI).call(this);if(!Number.isFinite(a)||a<=0){const t=Math.max(1,Math.round(s*jT));return{expectedFrames:t,demuxedFrames:M(De,this),missingFrames:Math.max(0,t-M(De,this)),reason:"fallback_fps",fallbackFps:jT,segmentDurationSeconds:s,demuxedCoverageSeconds:M(ze,this),frameDurationSeconds:A(qe,this,rI).call(this,a)}}const l=Math.min(.5*a,.02),c=Math.max(0,s-M(ze,this)),u=c<=l?0:c,d=Math.max(1,Math.floor((s+l)/a)),h=Math.max(0,d-M(De,this)),f=u>0?Math.ceil(u/a):0;return{expectedFrames:d,demuxedFrames:M(De,this),missingFrames:Math.max(h,f),segmentDurationSeconds:s,demuxedCoverageSeconds:M(ze,this),frameDurationSeconds:a}}function sI(){C(De,this,0),C(Le,this,0),C(Be,this,0),C(ze,this,0)}function aI(t){C(De,this,M(De,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&&(C(Le,this,M(Le,this)+n),C(Be,this,M(Be,this)+1)),!Number.isFinite(e))return;const i=Number.isFinite(n)&&n>0?e+n:e;Number.isFinite(i)&&i>M(ze,this)&&C(ze,this,i)}function lI(){return M(Be,this)>0?M(Le,this)/M(Be,this):M(De,this)>0&&M(ze,this)>0?M(ze,this)/M(De,this):null}function cI(t){return A(qe,this,oI).call(this,t)}function uI(t){(null==t?void 0:t.data)instanceof Uint8Array&&(C(Ae,this,t.data.buffer),A(qe,this,II).call(this)),null!=t&&t.decoderConfig&&(C(Me,this,t.decoderConfig),C(Se,this,t.decoderConfig.codec||M(Se,this)),A(qe,this,II).call(this)),this.trigger("decoder:init",t)}function dI(t){A(qe,this,aI).call(this,t),M(ve,this).push(t),A(qe,this,kI).call(this)}function hI(){C(ke,this,!0),A(qe,this,EI).call(this)}function fI(t){const e="number"==typeof(null==t?void 0:t.pts)?t.pts:void 0;if(Number.isFinite(e))return M(Fe,this)+e}function pI(t){return M(ve,this).some((e=>{const n=A(qe,this,fI).call(this,e);return Number.isFinite(n)&&n>=t}))}function mI(t){let e=-1,n=null;for(let i=0;i<M(ve,this).length;i+=1){const r=M(ve,this)[i],o=A(qe,this,fI).call(this,r);Number.isFinite(o)&&(null==r?void 0:r.isKey)&&o<=t&&(e=i,n=o)}return{chosenIndex:e,chosenPtsSeconds:n}}function vI(t){let e=-1,n=null;for(let i=0;i<M(ve,this).length;i+=1){const r=M(ve,this)[i],o=A(qe,this,fI).call(this,r);if(Number.isFinite(o)&&null!=r&&r.isKey&&(e=i,n=o,o>=t))break}return{chosenIndex:e,chosenPtsSeconds:n}}function gI(t){const e=t+M(he,this),n=M(Ce,this);if(!Number.isFinite(n))return e;const i=Number.isFinite(M(Pe,this))?M(Pe,this):null;if(Number.isFinite(i))return Math.max(e,i);const{chosenPtsSeconds:r}=A(qe,this,vI).call(this,n);return Number.isFinite(r)?Math.max(e,r):e}function yI(t){const e=M(Ce,this);Number.isFinite(e)&&Number.isFinite(t)&&t>=e&&(C(Ce,this,null),C(Pe,this,null))}function bI(){const t=M(Ce,this);if(!Number.isFinite(t)||M(Oe,this))return!0;if(!A(qe,this,pI).call(this,t)&&!M(ke,this))return!1;const e=A(qe,this,mI).call(this,t);let n=e;if(-1===e.chosenIndex&&(n=A(qe,this,vI).call(this,t)),n.chosenIndex>0){const t=`[#maybeAlignToSeekKeyframe] Dropping ${n.chosenIndex} samples before keyframe @ ${n.chosenPtsSeconds}`;this.log.debug(t),M(ve,this).splice(0,n.chosenIndex)}return C(be,this,!0),Number.isFinite(n.chosenPtsSeconds)&&C(Pe,this,n.chosenPtsSeconds),C(Oe,this,!0),!0}function kI(){const t=M(me,this)?M(me,this).call(this):0,e=A(qe,this,gI).call(this,t);if(A(qe,this,RI).call(this,t),A(qe,this,DI).call(this),!A(qe,this,bI).call(this))return void A(qe,this,wI).call(this);const n=void 0!==td.VideoDecoder&&void 0!==td.EncodedVideoChunk;for(n&&!M(Te,this)&&M(Me,this)&&A(qe,this,II).call(this);M(ve,this).length&&!A(qe,this,BI).call(this)&&!(n&&M(_e,this)&&A(qe,this,WI).call(this));){const t=M(ve,this)[0],i="number"==typeof(null==t?void 0:t.pts)?t.pts:0,r=M(Fe,this)+i;if(r>e)break;if(null!=t&&t.raw)M(ve,this).shift(),A(qe,this,xI).call(this,t);else{if(n){if(!M(Te,this)||!M(_e,this))break;if(M(be,this)&&!t.isKey){M(ve,this).shift();continue}M(ve,this).shift();const e=Math.max(0,Math.round(r*UT));M(ye,this).set(e,!!t.isKey);try{const n=new td.EncodedVideoChunk({type:t.isKey?"key":"delta",timestamp:e,duration:t.duration?Math.round(t.duration*UT):void 0,data:t.data instanceof Uint8Array?t.data:new Uint8Array(t.data)});M(_e,this).decode(n),t.isKey&&C(be,this,!1);continue}catch(t){M(ye,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")){C(be,this,!0);continue}this.log.warn("[#drainDecodeQueue] decode failed, falling back to placeholder",t)}}M(ve,this).shift(),A(qe,this,xI).call(this,t)}}A(qe,this,EI).call(this),A(qe,this,wI).call(this)}function xI(t){const e=M(me,this)?M(me,this).call(this):0,n=A(qe,this,gI).call(this,e),i=M(Fe,this)+("number"==typeof t.pts?t.pts:0);if(i<e||i>n)return;A(qe,this,RI).call(this,e);const r={pts:i,duration:t.duration,data:t.data,isKey:t.isKey};M(de,this).push(r),A(qe,this,DI).call(this),this.trigger("decoder:frame",r),A(qe,this,yI).call(this,i)}function wI(){if(M(ve,this).length>0&&void 0!==td.VideoDecoder){if(Bk(M(ge,this)))return;Dk(M(ge,this),50)}else A(qe,this,_I).call(this)}function _I(){M(ge,this)&&Bk(M(ge,this))&&Lk(M(ge,this))}function TI(){return null!=td&&td.performance&&"function"==typeof td.performance.now?td.performance.now():Date.now()}function II(){if(M(Te,this))return;if(void 0===td.VideoDecoder)return;if(!M(Me,this))return;if(M(Ie,this)&&A(qe,this,TI).call(this)<M(Ee,this))return;const t={...M(Me,this)};!t.codec&&M(Se,this)&&(t.codec=M(Se,this)),M(Ae,this)&&!t.description&&(t.description=M(Ae,this)),M(Ne,this).width&&!t.codedWidth&&(t.codedWidth=M(Ne,this).width),M(Ne,this).height&&!t.codedHeight&&(t.codedHeight=M(Ne,this).height);try{C(_e,this,new td.VideoDecoder({output:t=>A(qe,this,AI).call(this,t),error:t=>A(qe,this,SI).call(this,t)})),M(_e,this).configure(t),C(Te,this,!0),C(be,this,!0),C(Ie,this,!1),C(Ee,this,0),A(qe,this,kI).call(this)}catch(t){this.log.warn("[#maybeConfigureDecoder] configure failed, falling back to placeholder decode",t),C(_e,this,null),C(Te,this,!1),C(Me,this,null)}}function EI(){void 0!==td.VideoDecoder&&void 0!==td.EncodedVideoChunk&&(M(Ie,this)||!M(ke,this)||M(we,this)||M(xe,this)||M(Te,this)&&M(_e,this)&&"function"==typeof M(_e,this).flush&&(M(ve,this).length||(C(xe,this,!0),Promise.resolve().then((()=>M(_e,this).flush())).then((()=>{C(we,this,!0),C(be,this,!0)})).catch((t=>{"AbortError"!==(null==t?void 0:t.name)&&this.log.warn("[#maybeFlushDecoder] flush failed",t)})).finally((()=>{C(xe,this,!1)})))))}function SI(t){if(this.log.warn("[#handleDecoderError] decoder error",t),this.trigger("decoder:error",{error:t}),M(_e,this)&&"function"==typeof M(_e,this).close)try{M(_e,this).close()}catch(t){}C(_e,this,null),C(Te,this,!1),C(xe,this,!1),C(we,this,!1),C(be,this,!0),M(ye,this).clear(),C(Ie,this,!0),C(Ee,this,A(qe,this,TI).call(this)+1e3)}function AI(t){C(je,this,M(je,this).then((()=>{var e;if(!this._disposed)return A(qe,this,PI).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 NI(t){return"boolean"!=typeof t||t}function MI(t){const e=Number(t);return!Number.isFinite(e)||e<0?.2:e}function FI(){return!!M($e,this)&&"function"==typeof td.createImageBitmap&&M(We,this)}function CI(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(M(Fe,this));return!!Number.isFinite(i)&&t>=i+n-M(Ue,this)}async function OI(t,e){try{var n;const i=A(qe,this,CI).call(this,e),r=await td.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 PI(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/UT:M(me,this)?M(me,this).call(this):0,s="number"==typeof t.duration?t.duration/UT:void 0;let a;void 0!==r&&(a=M(ye,this).get(r),M(ye,this).delete(r));try{var l,c,u,d;let e=M(me,this)?M(me,this).call(this):0,n=A(qe,this,gI).call(this,e);if(o<e||o>n)return void(null===(l=(c=i).close)||void 0===l||l.call(c));if(A(qe,this,FI).call(this)){var h,f,p,m;if(i=await A(qe,this,OI).call(this,t,o),this._disposed)return void(null===(h=(f=i).close)||void 0===h||h.call(f));if(e=M(me,this)?M(me,this).call(this):0,n=A(qe,this,gI).call(this,e),o<e||o>n)return void(null===(p=(m=i).close)||void 0===p||p.call(m))}if(A(qe,this,RI).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};M(de,this).push(r),A(qe,this,DI).call(this),this.trigger("decoder:frame",r),A(qe,this,yI).call(this,o),this.log.debug(`[#handleDecodedFrame] [${M(Ne,this).codec}] Decoded frame:`,r)}catch(t){this.log.warn(`[#handleDecodedFrame] [${M(Ne,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 RI(t){const e=A(qe,this,gI).call(this,t),n=[];M(de,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)})),C(de,this,n)}function DI(){const t=M(fe,this);if(!Number.isFinite(t)||t<=0)return;if(M(de,this).length<=t)return;const e=M(de,this).length-t;M(de,this).splice(0,e)}function LI(t){const e=Number(t);return!Number.isFinite(e)||e<=0?0:Math.floor(e)}function BI(){const t=M(fe,this);return!(!Number.isFinite(t)||t<=0)&&M(de,this).length>=t}function zI(t){const e=Number(t);return!Number.isFinite(e)||e<=0?0:Math.floor(e)}function WI(){var t;const e=M(pe,this);if(!Number.isFinite(e)||e<=0)return!1;const n=Number(null===(t=M(_e,this))||void 0===t?void 0:t.decodeQueueSize);return!!Number.isFinite(n)&&n>=e}function $I(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 UI extends Qu{get name(){return"DecoderFactory"}create(t,e){if(!t||!t.type)return new _w(e);const n=HT[t.type];return n?(this.log.debug(`[#create] [${t.type}] Creating decoder:`,n),new n(e)):new _w(e)}}class jI{#q;#V;#G;#H;constructor(t={}){this.#q=t.getActiveRenderPlacement,this.#V=t.getPlacementsActiveAtTime,this.#G=t.ensureDecodedForPlacementAtTime;const e=Number(t.lookaheadSeconds);this.#H=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.#G)return;const n="function"==typeof this.#V?this.#V:()=>[],i=n(e),r=new Set;i.forEach((t=>{null!=t&&t.placementId&&r.add(t.placementId),this.#G(t,e)}));const o=this.#H;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.#G(t,s)}))}dispose(){}}class qI{#K;#X;#Y;#Q;#J;#Z;constructor(t={}){this.#K=t.getNode,this.#X=t.getPlacementState,this.#Y=t.getDecodeTracks,this.#Q=t.getSegmentIdForTrackAtTime,this.#J=t.decodeLoadedMediaSegment,this.#Z=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.#K?this.#K(i):void 0;if(!r)return;const o="function"==typeof this.#X?this.#X(n):void 0,s=null==o?void 0:o.trackStates;s&&"function"==typeof s.get&&("function"==typeof this.#Y?this.#Y(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.#Q?this.#Q(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.#J||this.#J(t,n,a),"video"===(null==n?void 0:n.type)&&"function"==typeof this.#Z&&this.#Z(t,n,a))}))}dispose(){}}const VI=new Set(["video","audio","image"]);function GI(t){const e=Number(t);return Number.isFinite(e)?e:0}var HI=new WeakMap,KI=new WeakMap,XI=new WeakMap,YI=new WeakMap,QI=new WeakMap,JI=new WeakMap,ZI=new WeakMap,tE=new WeakMap,eE=new WeakMap,nE=new WeakMap,iE=new WeakMap,rE=new WeakMap,oE=new WeakMap,sE=new WeakMap,aE=new WeakMap,lE=new WeakMap,cE=new WeakMap,uE=new WeakMap,dE=new WeakMap,hE=new WeakSet;class fE extends Qu{constructor(...t){super(...t),O(this,hE),F(this,HI,void 0),F(this,KI,void 0),F(this,XI,void 0),F(this,YI,void 0),F(this,QI,void 0),F(this,JI,void 0),F(this,ZI,void 0),F(this,tE,void 0),F(this,eE,void 0),F(this,nE,void 0),F(this,iE,void 0),F(this,rE,new Map),F(this,oE,new Map),F(this,sE,new Map),F(this,aE,new Map),F(this,lE,new Set),F(this,cE,0),F(this,uE,!1),F(this,dE,null);const[e,n,i]=t;C(HI,this,e),C(KI,this,n),C(XI,this,i||new UI),C(YI,this,new qI({getNode:t=>A(hE,this,BE).call(this,t),getPlacementState:t=>M(rE,this).get(t),getDecodeTracks:t=>A(hE,this,OE).call(this,t),getSegmentIdForTrackAtTime:(t,e,n)=>A(hE,this,xE).call(this,t,e,n),decodeLoadedMediaSegment:(t,e,n)=>{A(hE,this,rS).call(this,t,e,n)},decodeLoadedMediaSegmentsAfter:(t,e,n)=>{A(hE,this,YE).call(this,t,e,n)}})),C(QI,this,new jI({getActiveRenderPlacement:t=>{var e,n;return null===(e=M(KI,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=M(KI,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=M(YI,this))||void 0===n||null===(i=n.ensureDecodedForPlacementAtTime)||void 0===i||i.call(n,t,e)}})),A(hE,this,pE).call(this),A(hE,this,ME).call(this)}get name(){return"DecodeCoordinator"}onDispose(){var t,e;M(KI,this)&&"function"==typeof M(KI,this).off&&M(JI,this)&&M(KI,this).off(Qm.PLACEMENT_ADDED,M(JI,this)),M(KI,this)&&"function"==typeof M(KI,this).off&&M(ZI,this)&&M(KI,this).off(Qm.TIMELINE_SEEKING,M(ZI,this)),M(KI,this)&&"function"==typeof M(KI,this).off&&M(tE,this)&&M(KI,this).off(Qm.TIMELINE_SEEKED,M(tE,this)),M(KI,this)&&"function"==typeof M(KI,this).off&&M(eE,this)&&M(KI,this).off(Qm.TIMELINE_TIME_UPDATE,M(eE,this)),M(KI,this)&&"function"==typeof M(KI,this).off&&M(nE,this)&&M(KI,this).off(Qm.TIMELINE_RESET,M(nE,this)),A(hE,this,mE).call(this),C(JI,this,null),C(ZI,this,null),C(tE,this,null),C(eE,this,null),C(nE,this,null),null!==(t=M(YI,this))&&void 0!==t&&null!==(e=t.dispose)&&void 0!==e&&e.call(t),C(YI,this,null),M(QI,this)&&"function"==typeof M(QI,this).dispose&&M(QI,this).dispose(),C(QI,this,null),M(oE,this).forEach(((t,e)=>{const n=A(hE,this,BE).call(this,e);n&&"function"==typeof n.off&&n.off("node:loaded",t)})),M(oE,this).clear(),M(sE,this).forEach(((t,e)=>{const n=A(hE,this,BE).call(this,e);n&&"function"==typeof n.off&&n.off("segment:chunk",t)})),M(sE,this).clear(),M(aE,this).clear(),M(lE,this).clear(),A(hE,this,EE).call(this),M(rE,this).forEach((({trackStates:t})=>{t&&t.forEach((t=>{A(hE,this,UE).call(this,t)}))})),M(rE,this).clear()}}function pE(){M(KI,this)&&"function"==typeof M(KI,this).on&&(C(JI,this,(t=>{A(hE,this,FE).call(this,t)})),M(KI,this).on(Qm.PLACEMENT_ADDED,M(JI,this)),C(ZI,this,(t=>A(hE,this,vE).call(this,t))),M(KI,this).on(Qm.TIMELINE_SEEKING,M(ZI,this)),C(tE,this,(()=>A(hE,this,gE).call(this))),M(KI,this).on(Qm.TIMELINE_SEEKED,M(tE,this)),C(eE,this,(t=>A(hE,this,yE).call(this,t))),M(KI,this).on(Qm.TIMELINE_TIME_UPDATE,M(eE,this)),C(nE,this,(()=>A(hE,this,bE).call(this))),M(KI,this).on(Qm.TIMELINE_RESET,M(nE,this))),(null==td?void 0:td.document)&&"function"==typeof td.document.addEventListener&&(C(iE,this,(()=>{A(hE,this,SE).call(this)})),td.document.addEventListener("visibilitychange",M(iE,this)))}function mE(){M(iE,this)&&null!=td&&td.document&&"function"==typeof td.document.removeEventListener&&td.document.removeEventListener("visibilitychange",M(iE,this)),C(iE,this,null)}function vE(t={}){const e=Number(null==t?void 0:t.targetTime);Number.isFinite(e)&&(M(rE,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||(A(hE,this,kE).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=M(rE,this).get(n);if(!r||!r.trackStates)return;const o=A(hE,this,BE).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||A(hE,this,kE).call(this,n,r.placement||t,e)})),A(hE,this,XE).call(this,r.placement||t,o))})))}function gE(){M(rE,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 yE(t={}){var e,n;A(hE,this,KE).call(this,null==t?void 0:t.time),null!==(e=M(QI,this))&&void 0!==e&&null!==(n=e.handleTimeUpdate)&&void 0!==n&&n.call(e,t),A(hE,this,SE).call(this),A(hE,this,jE).call(this,null==t?void 0:t.time)}function bE(){M(oE,this).forEach(((t,e)=>{const n=A(hE,this,BE).call(this,e);n&&"function"==typeof n.off&&n.off("node:loaded",t)})),M(oE,this).clear(),M(sE,this).forEach(((t,e)=>{const n=A(hE,this,BE).call(this,e);n&&"function"==typeof n.off&&n.off("segment:chunk",t)})),M(sE,this).clear(),M(aE,this).clear(),M(lE,this).clear(),M(rE,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()}))}))})),M(rE,this).clear()}function kE(t,e,n){t&&(A(hE,this,UE).call(this,t),t.seekSegmentId=A(hE,this,xE).call(this,t.track,e,n))}function xE(t,e,n){if(!t||!e||!Array.isArray(t.segments))return null;const i=tm(e);if(!Number.isFinite(i))return null;const r=GI(null==e?void 0:e.nodeOffsetOverride),o=Math.max(0,n-i+r),s=GI(null==t?void 0:t.offset),a=Math.max(0,o-s),l="function"==typeof t.getMediaSegmentAtTime?t.getMediaSegmentAtTime(a,{preferRepresentationTime:!0}):Ly(t.segments,a,{preferRepresentationTime:!0});return(null==l?void 0:l.id)||null}function wE(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 _E(){const t=null==td?void 0:td.document;return!t||"string"!=typeof t.visibilityState||"visible"===t.visibilityState}function TE(){var t;const e=M(KI,this);if(!e||"number"!=typeof e.currentTime)return!1;if(e.state===sv)return!1;const n=Date.now();if(n<M(cE,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=A(hE,this,IE).call(this,i),!Number.isFinite(a))return!1;return C(cE,this,n+1500),this.log.warn("[DecodeCoordinator] attempting decoder recovery seek"),e.currentTime=a,!0}function IE(t){var e;const n=M(KI,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=tm(t);if(!Number.isFinite(e))return;(!Number.isFinite(d)||e<d)&&(d=e);const n=Jp(t,M(HI,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 EE(){C(uE,this,!1),C(dE,this,null)}function SE(){M(uE,this)&&A(hE,this,_E).call(this)&&A(hE,this,TE).call(this)}function AE(t){if(!A(hE,this,wE).call(this,t))return;const e=M(KI,this);e&&"number"==typeof e.currentTime&&(C(uE,this,!0),C(dE,this,t),A(hE,this,_E).call(this)&&A(hE,this,TE).call(this))}function NE(t){var e;return!!t&&(Array.isArray(null===(e=M(KI,this))||void 0===e?void 0:e.placements)?M(KI,this).placements:[]).includes(t)}function ME(t){var e;(Array.isArray(null===(e=M(KI,this))||void 0===e?void 0:e.placements)?[...M(KI,this).placements]:[]).filter((e=>"function"!=typeof t||t(e))).sort(((t,e)=>{const n=tm(t),i=tm(e);return(Number.isFinite(n)?n:Number.POSITIVE_INFINITY)-(Number.isFinite(i)?i:Number.POSITIVE_INFINITY)})).forEach((t=>{A(hE,this,FE).call(this,t)}))}async function FE(t){if(!t||!t.placementId||M(rE,this).has(t.placementId))return;if(!A(hE,this,NE).call(this,t))return;const e=t.nodeId;if(!e||!M(HI,this)||"function"!=typeof M(HI,this).get)return;const n=A(hE,this,BE).call(this,e);if(n){if(n.state&&"ready"!==n.state){if("function"==typeof n.resolve)try{await n.resolve()}catch(n){if(!A(hE,this,NE).call(this,t))return;return void this.log.warn(`[#processPlacement] Failed to resolve node ${e}`,n)}if(!A(hE,this,NE).call(this,t))return;if("ready"!==n.state)return}if(A(hE,this,HE).call(this,t))return A(hE,this,GE).call(this,t,n),void M(lE,this).add(t.placementId);A(hE,this,VE).call(this,t,n)}}function CE(t){return A(hE,this,OE).call(this,t).every((t=>A(hE,this,qE).call(this,t)))}function OE(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).filter((t=>VI.has(null==t?void 0:t.type)))}function PE(t){if(!t||!t.id||"function"!=typeof t.on)return;if(M(oE,this).has(t.id))return;const e=()=>{A(hE,this,QE).call(this,t.id)};t.on("node:loaded",e),M(oE,this).set(t.id,e)}function RE(t){if(!t||!t.id||"function"!=typeof t.on)return;if(M(sE,this).has(t.id))return;const e=t=>A(hE,this,JE).call(this,t);t.on("segment:chunk",e),M(sE,this).set(t.id,e)}function DE(t,e){if(!t||!e)return;const n=M(aE,this).get(t)||new Set;n.add(e),M(aE,this).set(t,n)}function LE(t){return M(aE,this).get(t)||new Set}function BE(t){if(t&&M(HI,this)&&"function"==typeof M(HI,this).get)return M(HI,this).get(t)}function zE(t){if(!t)return;const e=t.fullBufferRetryTimer;null!=e&&("function"==typeof(null==td?void 0:td.clearTimeout)?td.clearTimeout.bind(td):clearTimeout)(e),t.fullBufferRetryTimer=null,t.fullBufferDecodeScheduled=!1,t.fullBufferRetryAttempts=0}function WE(t){const e=null==t?void 0:t.segmentStates;e&&"function"==typeof e.forEach&&e.forEach((t=>{A(hE,this,zE).call(this,t)}))}function $E(t,e,n,i){var r,o;if(!(t&&e&&n&&i))return!1;const s=M(rE,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 UE(t){if(!t)return;A(hE,this,WE).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 jE(t){const e=GI(t);if(!Number.isFinite(e))return;const n=e-2;Number.isFinite(n)&&M(rE,this).forEach((t=>{const e=null==t?void 0:t.placement;if(!e)return;const i=tm(e),r=Jp(e,M(HI,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||A(hE,this,UE).call(this,t)}))}))}function qE(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 VE(t,e){if(this.log.debug(`[#startDecode] [${t.placementId}] [${e.id}] Starting decode`),A(hE,this,GE).call(this,t,e)){if(A(hE,this,DE).call(this,e.id,t.placementId),!A(hE,this,CE).call(this,e))return A(hE,this,PE).call(this,e),void A(hE,this,RE).call(this,e);A(hE,this,XE).call(this,t,e),A(hE,this,RE).call(this,e)}}function GE(t,e){if(!t||!t.placementId||!e)return;const n=M(rE,this).get(t.placementId);if(n)return n.placement=t,n;const i=A(hE,this,OE).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(Qm.DECODE_ERROR,tv({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 M(rE,this).set(t.placementId,o),o}function HE(t){var e;const n=tm(t),i=GI(null===(e=M(KI,this))||void 0===e?void 0:e.currentTime);return!Number.isFinite(n)||!!Number.isFinite(i)&&n-i>2}function KE(t){if(!M(lE,this).size)return;const e=GI(t);if(!Number.isFinite(e))return;const n=[];M(lE,this).forEach((t=>{const i=M(rE,this).get(t),r=null==i?void 0:i.placement;if(!r)return void n.push(t);const o=tm(r);Number.isFinite(o)&&o-e<=2&&n.push(t)})),n.forEach((t=>{M(lE,this).delete(t);const e=M(rE,this).get(t),n=null==e?void 0:e.placement;if(!n)return;const i=A(hE,this,BE).call(this,n.nodeId);i&&A(hE,this,VE).call(this,n,i)}))}function XE(t,e){const n=M(rE,this).get(t.placementId);n&&A(hE,this,OE).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;A(hE,this,rS).call(this,t,i,n),r.seekSegmentId&&"video"===(null==i?void 0:i.type)&&A(hE,this,YE).call(this,t,i,n),r.ready=!0,this.trigger(Qm.DECODE_READY,Zm({placementId:t.placementId,nodeId:e.id,trackId:i.id,trackType:i.type}))}catch(n){this.trigger(Qm.DECODE_ERROR,tv({placementId:t.placementId,nodeId:e.id,trackId:null==i?void 0:i.id,trackType:null==i?void 0:i.type,error:n}))}}))}function YE(t,e,n){var i;if(!(t&&e&&n&&Array.isArray(e.segments)))return;const r=null==t?void 0:t.placementId,o=r?M(rE,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(A(hE,this,rS).call(this,t,e,i),u+=1,u>=2)break}}function QE(t){const e=A(hE,this,BE).call(this,t);e&&A(hE,this,CE).call(this,e)&&A(hE,this,LE).call(this,t).forEach((t=>{const n=M(rE,this).get(t);A(hE,this,XE).call(this,(null==n?void 0:n.placement)||{placementId:t},e)}))}function JE(t){t&&t.nodeId&&t.trackId&&t.chunk&&A(hE,this,LE).call(this,t.nodeId).forEach((e=>A(hE,this,ZE).call(this,e,t)))}function ZE(t,e){const n=M(rE,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&&A(hE,this,rS).call(this,n.placement,s,a)&&(i.ready=!0,this.trigger(Qm.DECODE_READY,Zm({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType}))));if((null===(o=M(KI,this))||void 0===o?void 0:o.state)===sv&&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=A(hE,this,nS).call(this,n.placement,s,a);if(!u||"function"!=typeof u.decodeChunk)return;if(i.hasInit&&!c.initSent){const t=A(hE,this,iS).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;A(hE,this,tS).call(this,c,e)?d&&!c.ended&&A(hE,this,eS).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(Qm.DECODE_READY,Zm({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType})))}catch(n){this.trigger(Qm.DECODE_ERROR,tv({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType,error:n}))}}function tS(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 eS(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==td?void 0:td.setTimeout)?td.setTimeout.bind(td):setTimeout;i.fullBufferDecodeScheduled=!0,i.fullBufferRetryAttempts=0;const l=()=>{if(!A(hE,this,$E).call(this,r,o,s,i)||i.ended)return void A(hE,this,zE).call(this,i);if(A(hE,this,rS).call(this,t,e,n))return void A(hE,this,zE).call(this,i);i.fullBufferRetryAttempts+=1;const c=i.fullBufferRetryAttempts<=8?0:50;i.fullBufferRetryTimer=a((()=>{l()}),c)};i.fullBufferRetryTimer=a((()=>{l()}),0)}function nS(t,e,n){var i,r;const o=null==t?void 0:t.placementId;if(!o||!e||!n)return;const s=M(rE,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=M(XI,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=M(KI,this))||void 0===t?void 0:t.currentTime)?M(KI,this).currentTime:0})),c&&"function"==typeof c.setTimeOffsetSeconds){var u,d;const i=tm(t),r=GI(null==e?void 0:e.offset),o=GI(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=M(KI,this))||void 0===r?void 0:r.state)===sv&&"video"===(null==e?void 0:e.type)&&c.setSeekTargetTimeSeconds(M(KI,this).currentTime),c&&"function"==typeof c.on&&(c.on(Qm.DECODER_FRAME,(i=>{i&&(!M(uE,this)||"video"!==(null==e?void 0:e.type)&&"image"!==(null==e?void 0:e.type)||(C(uE,this,!1),C(dE,this,null)),M(KI,this)&&"function"==typeof M(KI,this).notifyDecodedFrame&&(i.frame||i.data)&&M(KI,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(Qm.DECODER_AUDIO,(i=>{i&&i.audioBuffer&&this.trigger(Qm.DECODER_AUDIO,Zm({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(Qm.DECODER_ERROR,(i=>{const r=(null==i?void 0:i.error)||i;this.trigger(Qm.DECODER_ERROR,tv({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})),A(hE,this,AE).call(this,r)}))),a.segmentDecoders.set(n.id,c),c}function iS(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 rS(t,e,n){var i;if(!t||!e||!n)return!1;const r=t.placementId,o=M(rE,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=A(hE,this,nS).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 A(hE,this,zE).call(this,l),!0;if(s.hasInit&&!l.initSent){const t=A(hE,this,iS).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()),A(hE,this,zE).call(this,l),0))}const oS=1e-6;var sS=new WeakMap,aS=new WeakMap,lS=new WeakMap,cS=new WeakMap,uS=new WeakMap,dS=new WeakMap,hS=new WeakMap,fS=new WeakMap,pS=new WeakSet;class mS extends Qu{get name(){return"TransitionManager"}get defaults(){return{durationSeconds:.5}}constructor(t,e,n){super(n),O(this,pS),F(this,sS,void 0),F(this,aS,void 0),F(this,lS,null),F(this,cS,null),F(this,uS,null),F(this,dS,0),F(this,hS,[]),F(this,fS,null),C(sS,this,t),C(aS,this,e),M(sS,this)&&"function"==typeof M(sS,this).on&&(C(fS,this,(()=>A(pS,this,TS).call(this))),M(sS,this).on(Qm.TIMELINE_RESET,M(fS,this)))}transitionTo(t,e={}){const n=Number(t);if(!Number.isFinite(n))throw new Error("TransitionManager.transitionTo requires a numeric time");A(pS,this,TS).call(this);const i=A(pS,this,vS).call(this),r=A(pS,this,kS).call(this,n,e);return r?A(pS,this,xS).call(this,n,e,i,r):Promise.resolve()}onDispose(){M(sS,this)&&"function"==typeof M(sS,this).off&&M(fS,this)&&M(sS,this).off(Qm.TIMELINE_RESET,M(fS,this)),C(fS,this,null),A(pS,this,TS).call(this),C(aS,this,null),C(sS,this,null)}}function vS(){return C(dS,this,M(dS,this)+1),M(dS,this)}function gS(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 yS(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 bS(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 kS(t,e={}){var n;const i=M(aS,this),r=A(pS,this,gS).call(this,e);if(!i||"function"!=typeof i.startTransition)return M(sS,this).currentTime=t,null;if(!(r>0))return M(sS,this).currentTime=t,null!==(n=i.resetTransition)&&void 0!==n&&n.call(i),null;const o=A(pS,this,yS).call(this,e,r);"function"==typeof(null==e?void 0:e.onTransitionInStart)&&e.onTransitionInStart();const s=i.startTransition(o),{outDurationMs:a,inDurationMs:l}=A(pS,this,bS).call(this,r,s);return{renderer:i,transitionOptions:o,outDurationMs:a,inDurationMs:l,shouldWaitForFrames:!1!==(null==e?void 0:e.waitForVisualFrames)}}function xS(t,e={},n,i){const{renderer:r,transitionOptions:o,outDurationMs:s,inDurationMs:a,shouldWaitForFrames:l}=i,c=A(pS,this,NS).call(this,t,e,n),u=l?A(pS,this,MS).call(this,t,n):Promise.resolve();let d=!1,h=!1,f=!1,p=!l;const m=()=>{var t;A(pS,this,IS).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),C(cS,this,setTimeout((()=>{var t;A(pS,this,IS).call(this,n)&&(null!==(t=r.resetTransition)&&void 0!==t&&t.call(r),"function"==typeof(null==e?void 0:e.onTransitionOutEnd)&&e.onTransitionOutEnd(),A(pS,this,wS).call(this))}),a)))};return C(lS,this,setTimeout((()=>{d=!0,m()}),s)),c.then((()=>{h=!0,m()})).catch((()=>{var t;A(pS,this,IS).call(this,n)&&(null!==(t=r.resetTransition)&&void 0!==t&&t.call(r),A(pS,this,wS).call(this))})),u.then((()=>{p=!0,m()})).catch((()=>{p=!0,m()})),M(sS,this).currentTime=t,new Promise((t=>{C(uS,this,t)}))}function wS(){const t=M(uS,this);C(uS,this,null),A(pS,this,_S).call(this),A(pS,this,AS).call(this),t&&t()}function _S(){M(lS,this)&&clearTimeout(M(lS,this)),M(cS,this)&&clearTimeout(M(cS,this)),C(lS,this,null),C(cS,this,null)}function TS(){var t,e;M(aS,this)&&null!==(t=(e=M(aS,this)).resetTransition)&&void 0!==t&&t.call(e),A(pS,this,_S).call(this),A(pS,this,AS).call(this),M(uS,this)&&(M(uS,this).call(this),C(uS,this,null))}function IS(t){return M(dS,this)===t}function ES(t,e){M(sS,this)&&"function"==typeof M(sS,this).on&&(M(sS,this).on(t,e),M(hS,this).push({eventName:t,handler:e}))}function SS(t,e){M(sS,this)&&"function"==typeof M(sS,this).off&&(M(sS,this).off(t,e),C(hS,this,M(hS,this).filter((n=>n.eventName!==t||n.handler!==e))))}function AS(){M(sS,this)&&"function"==typeof M(sS,this).off?(M(hS,this).forEach((t=>{M(sS,this).off(t.eventName,t.handler)})),C(hS,this,[])):C(hS,this,[])}function NS(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(!M(sS,this)||"function"!=typeof M(sS,this).on)return Promise.resolve();const r=A(pS,this,FS).call(this);return new Promise((e=>{let i=!1;const o=r?Qm.TIMELINE_SEEKED:"nodestart";let s,a;const l=()=>{A(pS,this,SS).call(this,Qm.TIMELINE_SEEKING,s),A(pS,this,SS).call(this,o,a),e()};s=(e={})=>{A(pS,this,IS).call(this,n)?A(pS,this,CS).call(this,e,t)&&(i=!0):l()},a=(e={})=>{A(pS,this,IS).call(this,n)?(o!==Qm.TIMELINE_SEEKED||A(pS,this,CS).call(this,e,t))&&(o===Qm.TIMELINE_SEEKED||i)&&l():l()},A(pS,this,ES).call(this,Qm.TIMELINE_SEEKING,s),A(pS,this,ES).call(this,o,a)}))}function MS(t,e){if(!M(sS,this)||"function"!=typeof M(sS,this).on)return Promise.resolve();const n=Number(t);return new Promise((t=>{const i=(r={})=>{if(!A(pS,this,IS).call(this,e))return A(pS,this,SS).call(this,Qm.VISUAL_FRAMES_AVAILABLE,i),void t();const o=Number(null==r?void 0:r.time);Number.isFinite(n)&&Number.isFinite(o)&&o+oS<n||(Array.isArray(null==r?void 0:r.frames)?r.frames:[]).length&&(A(pS,this,SS).call(this,Qm.VISUAL_FRAMES_AVAILABLE,i),t())};A(pS,this,ES).call(this,Qm.VISUAL_FRAMES_AVAILABLE,i)}))}function FS(){var t,e;const n=null===(t=M(sS,this))||void 0===t?void 0:t.state;if(n===ov||n===ev)return!0;const i=null===(e=M(sS,this))||void 0===e?void 0:e.placements;return!Array.isArray(i)||0===i.length}function CS(t,e){const n=Number(null==t?void 0:t.targetTime);return!Number.isFinite(n)||Math.abs(n-e)<oS}function OS(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}var PS=new WeakMap,RS=new WeakMap,DS=new WeakMap,LS=new WeakMap,BS=new WeakMap,zS=new WeakMap,WS=new WeakMap,$S=new WeakMap,US=new WeakMap,jS=new WeakMap,qS=new WeakMap,VS=new WeakMap,GS=new WeakMap,HS=new WeakMap,KS=new WeakSet;class XS extends Qu{get name(){return"AudioPlaybackManager"}get defaults(){return{muted:!1,volume:1,lookaheadSeconds:1}}constructor(t,e,n){super(n),O(this,KS),F(this,PS,void 0),F(this,RS,void 0),F(this,DS,null),F(this,LS,null),F(this,BS,[]),F(this,zS,new Set),F(this,WS,new Map),F(this,$S,!1),F(this,US,1),F(this,jS,!0),F(this,qS,null),F(this,VS,null),F(this,GS,null),F(this,HS,null),C(PS,this,t),C(RS,this,e),C($S,this,!!this.settings.muted),C(US,this,Yp(this.settings.volume));const i=Array.isArray(null==n?void 0:n.disabledTracks)?n.disabledTracks:[];C(jS,this,!i.includes("audio")),A(KS,this,YS).call(this)}get muted(){return M($S,this)}set muted(t){C($S,this,!!t),A(KS,this,aA).call(this)}get volume(){return M(US,this)}set volume(t){C(US,this,Yp(t)),A(KS,this,aA).call(this)}handleDecodedAudio(t={}){if(!M(jS,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=OS(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}`;M(zS,this).has(s)||(M(BS,this).push({key:s,placementId:n,pts:r,duration:o,audioBuffer:e}),M(BS,this).sort(((t,e)=>t.pts-e.pts)),A(KS,this,eA).call(this))}onDispose(){A(KS,this,QS).call(this),A(KS,this,oA).call(this,!0),M(DS,this)&&"function"==typeof M(DS,this).close&&M(DS,this).close(),C(DS,this,null),C(LS,this,null),C(PS,this,null),C(RS,this,null)}}function YS(){M(PS,this)&&"function"==typeof M(PS,this).on&&(C(qS,this,(t=>A(KS,this,JS).call(this,t))),M(PS,this).on(Qm.TIMELINE_TIME_UPDATE,M(qS,this)),C(VS,this,(t=>A(KS,this,ZS).call(this,t))),M(PS,this).on(Qm.TIMELINE_STATE_CHANGE,M(VS,this)),C(HS,this,(()=>A(KS,this,tA).call(this))),M(PS,this).on(Qm.TIMELINE_RESET,M(HS,this))),M(RS,this)&&"function"==typeof M(RS,this).on&&(C(GS,this,(t=>this.handleDecodedAudio(t))),M(RS,this).on(Qm.DECODER_AUDIO,M(GS,this)))}function QS(){M(PS,this)&&"function"==typeof M(PS,this).off&&(M(qS,this)&&M(PS,this).off(Qm.TIMELINE_TIME_UPDATE,M(qS,this)),M(VS,this)&&M(PS,this).off(Qm.TIMELINE_STATE_CHANGE,M(VS,this)),M(HS,this)&&M(PS,this).off(Qm.TIMELINE_RESET,M(HS,this))),M(RS,this)&&"function"==typeof M(RS,this).off&&M(GS,this)&&M(RS,this).off(Qm.DECODER_AUDIO,M(GS,this)),C(qS,this,null),C(VS,this,null),C(GS,this,null),C(HS,this,null)}function JS(){A(KS,this,eA).call(this)}function ZS(t={}){const e=null==t?void 0:t.to;if(e)return e===nv?(A(KS,this,lA).call(this),void A(KS,this,eA).call(this)):void(e!==ov&&e!==rv?e!==sv&&e!==av||A(KS,this,tA).call(this):A(KS,this,cA).call(this))}function tA(){A(KS,this,cA).call(this),A(KS,this,oA).call(this,!0),C(BS,this,[])}function eA(){if(!M(jS,this)||!M(PS,this))return;if(M(PS,this).state!==nv)return;const t=A(KS,this,sA).call(this);if(!t)return;const e=OS(M(PS,this).currentTime,0),n=e+Math.max(0,OS(this.settings.lookaheadSeconds,1)),i=[];for(let r=0;r<M(BS,this).length;r+=1){const o=M(BS,this)[r];o&&(o.pts>n?i.push(o):A(KS,this,nA).call(this,o)&&A(KS,this,rA).call(this,o,t,e))}C(BS,this,i)}function nA(t){if(!t||!M(PS,this))return!1;const e=A(KS,this,iA).call(this,t.pts);return!(!e||e!==t.placementId)}function iA(t){if(!M(PS,this)||"function"!=typeof M(PS,this).getPlacementsActiveAtTime)return null;const e=M(PS,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 rA(t,e,n){const i=t.key;if(M(zS,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(M(LS,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)}M(zS,this).add(i),M(WS,this).set(i,l),l.onended=()=>{M(WS,this).delete(i)}}function oA(t){M(WS,this).forEach(((t,e)=>{if(t&&"function"==typeof t.stop)try{t.stop()}catch(t){}M(WS,this).delete(e)})),t&&M(zS,this).clear()}function sA(){if(M(DS,this))return M(DS,this);const t=td.AudioContext||td.webkitAudioContext;if(!t)return this.log.warn("[AudioPlaybackManager] AudioContext is not available."),null;try{return C(DS,this,new t),C(LS,this,M(DS,this).createGain()),M(LS,this).connect(M(DS,this).destination),A(KS,this,aA).call(this),M(DS,this)}catch(t){return this.log.warn("[AudioPlaybackManager] Failed to initialize AudioContext",t),C(DS,this,null),C(LS,this,null),null}}function aA(){if(!M(LS,this))return;const t=M($S,this)?0:M(US,this);M(LS,this).gain.value=t}function lA(){M(DS,this)&&"function"==typeof M(DS,this).resume&&"suspended"===M(DS,this).state&&M(DS,this).resume().catch((()=>{}))}function cA(){M(DS,this)&&"function"==typeof M(DS,this).suspend&&"running"===M(DS,this).state&&M(DS,this).suspend().catch((()=>{}))}var uA=new WeakMap,dA=new WeakMap,hA=new WeakMap,fA=new WeakMap,pA=new WeakMap,mA=new WeakSet;class vA extends Qu{constructor(...t){super(...t),O(this,mA),F(this,uA,void 0),F(this,dA,void 0),F(this,hA,void 0),F(this,fA,void 0),F(this,pA,void 0),C(uA,this,A(mA,this,yA).call(this,this.settings.currentTime)),C(dA,this,A(mA,this,bA).call(this,this.settings.playbackRate)),C(hA,this,null),C(fA,this,!1),C(pA,this,A(mA,this,gA).bind(this))}get name(){return"PlaybackClock"}get defaults(){return{currentTime:0,playbackRate:vy("playbackRate")}}get currentTime(){return M(uA,this)}get playbackRate(){return M(dA,this)}set playbackRate(t){C(dA,this,A(mA,this,bA).call(this,t))}play(){M(fA,this)||(C(fA,this,!0),C(hA,this,Zg()),Dk(M(pA,this),0))}pause(){M(fA,this)&&(C(fA,this,!1),Lk(M(pA,this)))}seek(t){C(uA,this,A(mA,this,yA).call(this,t)),C(hA,this,Zg())}reset(){this.pause(),C(uA,this,0),C(hA,this,null)}onDispose(){this.pause(),C(pA,this,null)}}function gA(){const t=Zg();if(null===M(hA,this))return C(hA,this,t),void this.trigger(Qm.CLOCK_TICK,{currentTime:M(uA,this)});const e=t-M(hA,this);C(hA,this,t);const n=e/1e3;C(uA,this,M(uA,this)+n*M(dA,this)),this.trigger(Qm.CLOCK_TICK,{currentTime:M(uA,this)})}function yA(t){return"number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t)||t<0?0:t}function bA(t){return"number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t)||t<=0?M(dA,this)||1:t}var kA=new WeakMap,xA=new WeakSet;class wA extends Qu{constructor(...t){super(...t),O(this,xA),F(this,kA,new Map)}get name(){return"TrackBuffers"}get defaults(){return{}}refreshNode(t){if(!t||!Array.isArray(t.tracks))return;const e=t.id,n=M(kA,this).get(e)||new Map;M(kA,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(Qm.TRACK_BUFFER_UPDATE,{nodeId:e,trackType:i,range:r})),!s&&a?this.trigger(Qm.TRACK_READY,{nodeId:e,trackType:i,range:r}):s&&!a&&this.trigger(Qm.TRACK_UNDERFLOW,{nodeId:e,trackType:i,range:r})}))}getTrackRange(t,e){const n=M(kA,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=A(xA,this,TA).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 M(kA,this)}reset(){M(kA,this).clear()}onDispose(){M(kA,this).clear(),"function"==typeof this.off&&this.off()}}function _A(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 TA(t,e,n=0){var i,r;const o=tm(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 A(xA,this,IA).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=A(xA,this,_A).call(this,d,u)||(null===(r=d)||void 0===r?void 0:r.buffered);return h&&Number.isFinite(h.start)&&Number.isFinite(h.end)?A(xA,this,IA).call(this,s,h,o,e):void 0}function IA(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 EA{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 SA extends Qu{constructor(t,e){super(e),this.timeline=t}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"handleDecodedFrame","handleClockTick","handleMainTrackBufferUpdate"])}enter(){}exit(){}play(){this.timeline.transitionTo(nv)}pause(){this.timeline.transitionTo(ov)}wait(){this.timeline.transitionTo(rv)}reset(){this.timeline.transitionTo(av)}seek(t){this.timeline.transitionTo(sv,{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()||ov;this.timeline.transitionTo(e)}handleMainTrackBufferUpdate(t){}handleDecodedFrame(t){}handleClockTick(t){}onDispose(){this.timeline=null}}const AA=24e3/1001;function NA(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 MA(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 FA(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 CA(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 OA(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:AA)}(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+MA(t)}function PA(t,e=(null==t?void 0:t.currentTime)){const n=NA(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=FA(o);if(!s)return!0;if(!t.hasDecodedFirstFrame(r,s))return!0}return!1}function RA(t,e=(null==t?void 0:t.currentTime)){return PA(t,e)||function(t,e=(null==t?void 0:t.currentTime)){const n=NA(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=CA(s);if(null!=a&&a.id&&!OA(t,o,a.id,a.type,n))return!0}return!1}(t,e)}function DA(t,e=(null==t?void 0:t.currentTime)){if("function"!=typeof(null==t?void 0:t.computeBuffered))return!1;const n=NA(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=MA(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=tm(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 LA={[ev]:class extends SA{get name(){return ev}get defaults(){return{autoplay:vy("autoplay")}}enter(){this.timeline.recordStableState(ov),this.timeline.stopPlaybackClock()}play(){const t=RA(this.timeline),e=t?rv:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t)return this.timeline.recordStableState(nv),void this.timeline.transitionTo(rv);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(RA(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)}},[iv]:class extends SA{get name(){return iv}enter(t={}){const{from:e,to:n}=t;this.timeline.recordStableState(nv),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("canplay",{from:e,to:n})}play(){}pause(){this.timeline.transitionTo(ov)}},[nv]:class extends SA{get name(){return nv}enter(t={}){const{from:e,to:n,fromFirstFramePending:i}=t;this.timeline.recordStableState(nv),this.timeline.startPlaybackClock(),!0!==i&&this.emitPlayerStateEvent("canplay",{from:e,to:n}),this.emitPlayerStateEvent("playing",{from:e,to:n})}play(){}pause(){this.timeline.transitionTo(ov)}handleClockTick(t){const e=this.timeline.currentTime;RA(this.timeline,e)&&(this.timeline.recordStableState(nv),this.timeline.transitionTo(rv))}},[rv]:(Ze=new WeakMap,tn=new WeakMap,en=new WeakSet,class extends SA{constructor(...t){super(...t),O(this,en),F(this,Ze,void 0),F(this,tn,null)}get name(){return rv}enter(t={}){const{from:e,to:n}=t;this.timeline.stopPlaybackClock(),A(en,this,BA).call(this),A(en,this,WA).call(this),this.emitPlayerStateEvent("waiting",{from:e,to:n}),A(en,this,jA).call(this)}exit(){A(en,this,zA).call(this),A(en,this,$A).call(this)}play(){this.timeline.recordStableState(nv);const t=A(en,this,UA).call(this),e=t?rv:this.timeline.getPlaybackStartState();this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t||this.timeline.transitionTo(e)}pause(){this.timeline.transitionTo(ov)}handleMainTrackReady(t){const e=this.timeline.getLastStableState()||ov;e!==nv?this.timeline.transitionTo(e):A(en,this,jA).call(this)}handleDecodedFrame(t){A(en,this,jA).call(this)}handleMainTrackBufferUpdate(t){A(en,this,jA).call(this)}}),[ov]:class extends SA{get name(){return ov}enter(t={}){const{from:e,to:n}=t;this.timeline.recordStableState(ov),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("pause",{from:e,to:n})}play(){const t=RA(this.timeline),e=t?rv:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t)return this.timeline.recordStableState(nv),void this.timeline.transitionTo(rv);this.timeline.transitionTo(e)}pause(){}},[sv]:class extends SA{get name(){return sv}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===nv||n===iv,r=i&&"function"==typeof this.timeline.getPlaybackStartState?this.timeline.getPlaybackStartState(e):i?nv:ov;this.timeline.transitionTo(r,{fromSeeking:!0})}play(){var t;if(this.timeline&&"function"==typeof this.timeline.setSeekReturnState)return void this.timeline.setSeekReturnState(nv);const e="function"==typeof(null===(t=this.timeline)||void 0===t?void 0:t.getPlaybackStartState)?this.timeline.getPlaybackStartState():nv;this.timeline.transitionTo(e)}pause(){this.timeline&&"function"==typeof this.timeline.setSeekReturnState?this.timeline.setSeekReturnState(ov):this.timeline.transitionTo(ov)}handleDecodedFrame(t){this.timeline&&"function"==typeof this.timeline.maybeCompleteSeek&&this.timeline.maybeCompleteSeek(t)}},[av]:class extends SA{get name(){return av}enter(){this.timeline.resetClock(),this.timeline.transitionTo(ev,{fromReset:!0})}play(){}pause(){}get buffered(){return{start:0,end:0}}}};function BA(){var t;const e=null===(t=this.timeline)||void 0===t?void 0:t.trackBuffers;e&&"function"==typeof e.on&&(C(Ze,this,(t=>this.handleMainTrackBufferUpdate(t))),e.on(Qm.TRACK_BUFFER_UPDATE,M(Ze,this)))}function zA(){var t;const e=null===(t=this.timeline)||void 0===t?void 0:t.trackBuffers;M(Ze,this)&&e&&"function"==typeof e.off?(e.off(Qm.TRACK_BUFFER_UPDATE,M(Ze,this)),C(Ze,this,null)):C(Ze,this,null)}function WA(){if(null!==M(tn,this))return;const t="function"==typeof(null==td?void 0:td.setInterval)?td.setInterval.bind(td):setInterval;C(tn,this,t((()=>{var t;(null===(t=this.timeline)||void 0===t?void 0:t.state)===rv&&A(en,this,jA).call(this)}),200))}function $A(){null!==M(tn,this)&&(("function"==typeof(null==td?void 0:td.clearInterval)?td.clearInterval.bind(td):clearInterval)(M(tn,this)),C(tn,this,null))}function UA(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!!PA(t,e)||!0===n.skipBufferResume||!DA(t,e)}(this.timeline,t)}function jA(t=(t=>null===(t=this.timeline)||void 0===t?void 0:t.currentTime)()){return(this.timeline.getLastStableState()||ov)===nv&&!A(en,this,UA).call(this,t)&&(this.timeline.transitionTo(this.timeline.getPlaybackStartState(t)),!0)}function qA(t){return t&&("string"!=typeof t.state||"ready"===t.state)}function VA(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).some((t=>"video"===(null==t?void 0:t.type)))}function GA(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 HA(t){return t===nv||t===iv}var KA=new WeakMap,XA=new WeakMap,YA=new WeakMap,QA=new WeakMap,JA=new WeakMap,ZA=new WeakMap,tN=new WeakMap,eN=new WeakMap,nN=new WeakMap,iN=new WeakMap,rN=new WeakMap,oN=new WeakMap,sN=new WeakMap,aN=new WeakMap,lN=new WeakSet;class cN{constructor(t={}){O(this,lN),F(this,KA,void 0),F(this,XA,void 0),F(this,YA,void 0),F(this,QA,void 0),F(this,JA,void 0),F(this,ZA,void 0),F(this,tN,void 0),F(this,eN,void 0),F(this,nN,void 0),F(this,iN,null),F(this,rN,ov),F(this,oN,[]),F(this,sN,new Set),F(this,aN,new Map),C(KA,this,t.getState),C(XA,this,t.getNode),C(YA,this,t.getPlacementsActiveAtTime),C(QA,this,t.getLastStableState),C(JA,this,t.getPlaybackStartState),C(ZA,this,t.clearVisualFrameBuffers),C(tN,this,t.updateTime),C(eN,this,t.transitionTo),C(nN,this,t.trigger)}start(t,e){const n=Number(t);if(!Number.isFinite(n))return;let i=e;i===sv?i=M(rN,this):i===rv&&"function"==typeof M(QA,this)&&(i=M(QA,this).call(this)),C(rN,this,HA(i)?nv:ov),C(iN,this,n),M(sN,this).clear(),M(aN,this).clear(),C(oN,this,"function"==typeof M(YA,this)?M(YA,this).call(this,n):[]),"function"==typeof M(ZA,this)&&M(ZA,this).call(this),"function"==typeof M(tN,this)&&M(tN,this).call(this,n,{source:"seek"}),"function"==typeof M(nN,this)&&M(nN,this).call(this,Qm.TIMELINE_SEEKING,{targetTime:n,placements:M(oN,this).slice()}),this.maybeComplete()}setReturnState(t){C(rN,this,HA(t)?nv:ov)}maybeComplete(t){if(("function"==typeof M(KA,this)?M(KA,this).call(this):void 0)!==sv)return;const e=M(iN,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){M(sN,this).add(i);const t=M(aN,this).get(i);(!Number.isFinite(t)||n<t)&&M(aN,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)&&M(sN,this).add(i);const r=Array.isArray(M(oN,this))?M(oN,this):[];if(r.length){if("function"==typeof M(XA,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=M(XA,this).call(this,e.nodeId);if(!qA(i))return;if(GA(i)&&!M(sN,this).has(n))return}A(lN,this,uN).call(this,e,r)}}else A(lN,this,uN).call(this,e,[])}dispose(){C(oN,this,[]),M(sN,this).clear(),M(aN,this).clear(),C(iN,this,null)}}function uN(t,e){const n=A(lN,this,dN).call(this,t,e);if("function"==typeof M(tN,this)&&M(tN,this).call(this,n,{source:"seek"}),C(iN,this,null),C(oN,this,[]),M(sN,this).clear(),M(aN,this).clear(),"function"==typeof M(nN,this)&&M(nN,this).call(this,Qm.TIMELINE_SEEKED,{targetTime:t,placements:Array.isArray(e)?e.slice():[]}),"function"==typeof M(eN,this)){const t=M(rN,this)===nv&&"function"==typeof M(JA,this)?M(JA,this).call(this,n):M(rN,this);M(eN,this).call(this,t,{fromSeeking:!0})}}function dN(t,e){const n=Number(t);if(!Number.isFinite(n))return t;if(!Array.isArray(e)||!e.length||"function"!=typeof M(XA,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(!VA(M(XA,this).call(this,n.nodeId)))continue;const o=M(aN,this).get(r);Number.isFinite(o)&&o>i&&(i=o)}return i}function hN(t){if(t&&"function"==typeof t.close)try{t.close()}catch(t){}}function fN(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=>hN(null==t?void 0:t.frame)))}function pN(t){return tm(t)}function mN(t){return Number.isFinite(null==t?void 0:t.loopRootOffset)?t.loopRootOffset:pN(t)}function vN(t,e){return"string"==typeof(null==t?void 0:t.loopRootPlacementId)&&t.loopRootPlacementId?t.loopRootPlacementId:e}function gN(t){if("string"!=typeof t)return Number.NaN;const e=t.match(/(\d+)/);return e?Number(e[1]):Number.NaN}function yN(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 bN=1e-6;function kN(t){return t&&("string"!=typeof t.state||"ready"===t.state)}function xN(t){const e=Number(t);return Number.isFinite(e)?e:0}function wN(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 _N(t){return t&&"cue"===t.type&&Array.isArray(t.cues)?t.cues:[]}var TN=new WeakMap,IN=new WeakMap,EN=new WeakMap,SN=new WeakMap,AN=new WeakMap,NN=new WeakMap,MN=new WeakMap,FN=new WeakMap,CN=new WeakSet;class ON{constructor(t={}){O(this,CN),F(this,TN,void 0),F(this,IN,void 0),F(this,EN,void 0),F(this,SN,void 0),F(this,AN,void 0),F(this,NN,void 0),F(this,MN,-1e-6),F(this,FN,null),C(TN,this,t.getPlacements),C(IN,this,t.getPlacementsActiveAtTime),C(EN,this,t.getPlacementDuration),C(SN,this,t.getNode),C(AN,this,t.triggerTimeline),C(NN,this,t.triggerNode)}handleSeeking(t,e){const n=xN(t);C(FN,this,n)}handleSeeked(t){const e=xN(t),n=M(FN,this);C(FN,this,null),Number.isFinite(n)?(A(CN,this,RN).call(this,n,e),C(MN,this,e)):C(MN,this,e)}handleTimeUpdate(t,e={}){const n=xN(t),i=M(MN,this);!0===(null==e?void 0:e.isSeeking)?C(MN,this,n):Number.isFinite(i)?n<=i?n<i&&C(MN,this,n-bN):(A(CN,this,PN).call(this,i,n),C(MN,this,n)):C(MN,this,n)}dispose(){C(FN,this,null),C(MN,this,-1e-6)}}function PN(t,e){const n="function"==typeof M(TN,this)?M(TN,this).call(this):[];A(CN,this,DN).call(this,n,t,e,{onlySticky:!1})}function RN(t,e){if("function"!=typeof M(IN,this))return;const n=M(IN,this).call(this,e);A(CN,this,DN).call(this,n,t,e,{onlySticky:!0})}function DN(t,e,n,i={}){if("function"!=typeof M(SN,this)||"function"!=typeof M(AN,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=M(SN,this).call(this,l);if(!kN(c))continue;const u=wN(c);if(!u.length)continue;const d=tm(s);if(!Number.isFinite(d))continue;const h=Number.isFinite(null==s?void 0:s.nodeOffsetOverride)?s.nodeOffsetOverride:0,f="function"==typeof M(EN,this)?M(EN,this).call(this,s):void 0,p="number"==typeof f&&Number.isFinite(f)?d+f:Number.POSITIVE_INFINITY,m=r?d-bN:e;for(let t=0;t<u.length;t+=1){const e=_N(u[t]);for(let i=0;i<e.length;i+=1){const s=e[i],c=xN(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};M(AN,this).call(this,"cuepoint",n),M(AN,this).call(this,e.name,n),"function"==typeof M(NN,this)&&(M(NN,this).call(this,t.nodeId,"cuepoint",n),M(NN,this).call(this,t.nodeId,e.name,n))})))}class LN{#tt;#et=0;#nt=new Set;constructor(t){this.#tt="string"==typeof t?t:""}claim(t){if(t)return this.#nt.add(t),t;let e;do{e=`${this.#tt}${++this.#et}`}while(this.#nt.has(e));return this.#nt.add(e),e}reset(){this.#et=0,this.#nt.clear()}}const BN=24e3/1001;function zN(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}:yN(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 WN=new WeakMap,$N=new WeakMap,UN=new WeakMap,jN=new WeakMap,qN=new WeakMap,VN=new WeakMap,GN=new WeakMap,HN=new WeakMap,KN=new WeakMap,XN=new WeakMap,YN=new WeakMap,QN=new WeakMap,JN=new WeakMap,ZN=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 WeakMap,yM=new WeakMap,bM=new WeakSet;class kM extends Qu{constructor(...t){super(...t),O(this,bM),F(this,WN,void 0),F(this,$N,void 0),F(this,UN,void 0),F(this,jN,void 0),F(this,qN,void 0),F(this,VN,!1),F(this,GN,[]),F(this,HN,new LN("placement-")),F(this,KN,[]),F(this,XN,new LN("renderplacement-")),F(this,YN,void 0),F(this,QN,void 0),F(this,JN,void 0),F(this,ZN,!1),F(this,tM,new Set),F(this,eM,new Set),F(this,nM,new Map),F(this,iM,[]),F(this,rM,0),F(this,oM,new Set),F(this,sM,new Set),F(this,aM,Number.NEGATIVE_INFINITY),F(this,lM,[]),F(this,cM,Number.NEGATIVE_INFINITY),F(this,uM,0),F(this,dM,void 0),F(this,hM,void 0),F(this,fM,new Map),F(this,pM,null),F(this,mM,void 0),F(this,vM,void 0),F(this,gM,void 0),F(this,yM,void 0);const[e,n={}]=t;C(WN,this,e),C(dM,this,n),C(qN,this,new vA(n)),C(YN,this,new wA(n)),C(jN,this,ov),A(bM,this,FM).call(this),A(bM,this,CM).call(this),C(mM,this,new cN({getState:()=>this.state,getNode:t=>M(WN,this)&&"function"==typeof M(WN,this).get?M(WN,this).get(t):void 0,getPlacementsActiveAtTime:t=>A(bM,this,dF).call(this,t,{endEpsilonSeconds:A(bM,this,kF).call(this)}),getLastStableState:()=>this.getLastStableState(),getPlaybackStartState:t=>this.getPlaybackStartState(t),clearVisualFrameBuffers:()=>A(bM,this,cF).call(this),updateTime:(t,e)=>this.updateTime(t,e),transitionTo:(t,e)=>this.transitionTo(t,e),trigger:(t,e)=>this.trigger(t,e)})),C(vM,this,new ON({getPlacements:()=>M(GN,this).slice(),getPlacementsActiveAtTime:t=>A(bM,this,dF).call(this,t),getPlacementDuration:t=>A(bM,this,GM).call(this,t),getNode:t=>M(WN,this)&&"function"==typeof M(WN,this).get?M(WN,this).get(t):void 0,triggerTimeline:(t,e)=>this.trigger(t,e),triggerNode:(t,e,n)=>{const i=M(WN,this)&&"function"==typeof M(WN,this).get?M(WN,this).get(t):void 0;i&&"function"==typeof i.trigger&&i.trigger(e,n)}})),C(gM,this,(()=>{var t,e;null===(t=M(vM,this))||void 0===t||null===(e=t.handleSeeked)||void 0===e||e.call(t,this.currentTime)})),this.on(Qm.TIMELINE_SEEKED,M(gM,this)),C(yM,this,(t=>A(bM,this,zM).call(this,t))),this.on("nodestart",M(yM,this)),this.transitionTo(ev)}get name(){return"Timeline"}get defaults(){return{snapToFps:BN,maxBufferedVideoFrames:24}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"computeBuffered","notifyDecodedFrame","getDecodedFrameStats","getActiveRenderPlacement","maybeCompleteSeek","getPlacementsActiveAtTime","hasDecodedFirstFrame","getDecodedVisualBuffer","getPlacementDuration","getNode"])}transitionTo(t,e={}){const n=M(UN,this),i=function(t,e,n={}){const i=LA[t];return i?new i(e,n):null}(t,this,M(dM,this)),r=e&&"object"==typeof e&&!Array.isArray(e)?{...e,from:n,to:t}:{from:n,to:t};i?(M($N,this)&&"function"==typeof M($N,this).exit&&M($N,this).exit(),C($N,this,i),C(UN,this,t),"function"==typeof i.enter&&i.enter(r),this.trigger(Qm.TIMELINE_STATE_CHANGE,{from:n,to:t,options:e})):this.log.warn(`Unknown state "${t}"`)}recordStableState(t){C(jN,this,t)}getLastStableState(){return M(jN,this)}enableFirstFrameRenderedGate(){C(VN,this,!0)}getPlaybackStartState(t=this.currentTime){return this.shouldWaitForFirstRenderedFrame(t)?iv:nv}shouldWaitForFirstRenderedFrame(t=this.currentTime){if(!M(VN,this)||M(ZN,this))return!1;const e=Number.isFinite(t)?t:this.currentTime,n=A(bM,this,dF).call(this,e);return Array.isArray(n)&&n.length>0}notifyFirstFrameRendered(){M(ZN,this)||(C(ZN,this,!0),this.state===iv&&this.transitionTo(nv,{fromFirstFramePending:!0}))}get state(){return M(UN,this)}get paused(){return M(UN,this)===ev||M(UN,this)===ov}get currentTime(){return M(qN,this).currentTime}set currentTime(t){M($N,this).seek(t)}get playbackRate(){return M(qN,this).playbackRate}set playbackRate(t){M(qN,this).playbackRate=t}play(){M($N,this).play()}pause(){M($N,this).pause()}reset(){M($N,this).reset()}seekToPlacement(t){if(!t)throw new Error("Timeline.seekToPlacement requires placement id");A(bM,this,UM).call(this);const e=A(bM,this,vF).call(this,t);if(!e)throw new Error("Timeline.seekToPlacement requires placement id");const n=tm(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;A(bM,this,UM).call(this),A(bM,this,jM).call(this),M(qN,this).seek(t),A(bM,this,uF).call(this,this.currentTime),A(bM,this,hF).call(this);const r="string"==typeof(null==e?void 0:e.source)?e.source:"set";null!==(n=M(vM,this))&&void 0!==n&&null!==(i=n.handleTimeUpdate)&&void 0!==i&&i.call(n,this.currentTime,{isSeeking:this.state===sv}),A(bM,this,WM).call(this,this.currentTime),A(bM,this,rF).call(this,this.currentTime),this.trigger(Qm.TIMELINE_TIME_UPDATE,Jm(this.currentTime,r))}startSeeking(t,e){var n,i;null!==(n=M(vM,this))&&void 0!==n&&null!==(i=n.handleSeeking)&&void 0!==i&&i.call(n,this.currentTime,t),M(mM,this)&&"function"==typeof M(mM,this).start&&M(mM,this).start(t,e)}setSeekReturnState(t){M(mM,this)&&"function"==typeof M(mM,this).setReturnState&&M(mM,this).setReturnState(t)}maybeCompleteSeek(t){M(mM,this)&&"function"==typeof M(mM,this).maybeComplete&&M(mM,this).maybeComplete(t)}startPlaybackClock(){M(qN,this).play()}stopPlaybackClock(){M(qN,this).pause()}resetClock(){var t,e;M(qN,this).reset(),null===(t=M(vM,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:[];A(bM,this,xM).call(this),A(bM,this,wM).call(this,e),A(bM,this,_M).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=M(HN,this).claim(n.placementId),o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=sm(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}:om(e,n);let u,d,h,f=!1;const p=null!==a;if(A(bM,this,UM).call(this),a){const t=M(GN,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=tm(t);if("start"===a.anchor)Number.isFinite(e)?u=A(bM,this,HM).call(this,e,{nodeOffsetOverride:o}):f=!0;else{const n=A(bM,this,GM).call(this,t);if(Number.isFinite(e)&&n>0){const t=e+n,i=A(bM,this,HM).call(this,t,{nodeOffsetOverride:o});u=Math.max(i,t)}else f=!0}}else if(l){const t=n.offsetAnchorPlacementId?M(GN,this).find((t=>(null==t?void 0:t.placementId)===n.offsetAnchorPlacementId)):M(GN,this).length?M(GN,this)[M(GN,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==t?void 0:t.placementId),d){const e=tm(t),n=A(bM,this,GM).call(this,t);Number.isFinite(e)&&n>0?u=A(bM,this,HM).call(this,e+n-c,{nodeOffsetOverride:o}):(f=!0,h="end")}else u=A(bM,this,HM).call(this,-c,{nodeOffsetOverride:o})}else u=rm(e),u=A(bM,this,HM).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 EA({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(M(GN,this).push(y),nm(M(GN,this)),A(bM,this,nF).call(this,y),A(bM,this,tF).call(this),f&&d){const t=M(GN,this).find((t=>(null==t?void 0:t.placementId)===d));A(bM,this,XM).call(this,null==t?void 0:t.nodeId)}return this.trigger(Qm.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=A(bM,this,KM).call(this,e,i),s=o.offset,a=!0===o.offsetPending,l=o.offsetAnchorPlacementId,c=o.offsetAnchorEdge,u=o.offsetAnchorIsReference,d=M(XN,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;am(M(KN,this),t,e,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements")}if(M(KN,this).push(v),nm(M(KN,this)),a&&l){const t=M(GN,this).find((t=>(null==t?void 0:t.placementId)===l));A(bM,this,XM).call(this,null==t?void 0:t.nodeId)}return this.trigger(Qm.RENDER_PLACEMENT_ADDED,v),d}get placements(){return M(GN,this).slice()}getPlacementsActiveAtTime(t){return A(bM,this,dF).call(this,t)}getNodesAtTime(t){const e=A(bM,this,gF).call(this,t);if(!Number.isFinite(e))return[];const n=A(bM,this,dF).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 A(bM,this,GM).call(this,t)}getNode(t){if(M(WN,this)&&"function"==typeof M(WN,this).get)return M(WN,this).get(t)}get renderPlacements(){return M(KN,this).slice()}get placementsAhead(){const t=this.currentTime;return M(GN,this).filter((e=>{const n=tm(e);if(!Number.isFinite(n))return!1;const i=A(bM,this,GM).call(this,e);return"number"==typeof i?n+i>t:n>=t}))}get buffered(){return M($N,this)?M($N,this).buffered:{start:0,end:0}}get trackBuffers(){return M(YN,this)}onDispose(){A(bM,this,NM).call(this),M(eM,this)&&M(eM,this).clear(),M(vM,this)&&"function"==typeof M(vM,this).dispose&&M(vM,this).dispose(),C(vM,this,null),A(bM,this,AM).call(this),A(bM,this,MM).call(this),M(mM,this)&&"function"==typeof M(mM,this).dispose&&M(mM,this).dispose(),C(mM,this,null),M(qN,this)&&"function"==typeof M(qN,this).dispose&&(M(hM,this)&&"function"==typeof M(qN,this).off&&(M(qN,this).off("tick",M(hM,this)),C(hM,this,null)),M(qN,this).dispose(),C(qN,this,null)),A(bM,this,JM).call(this),C($N,this,null),C(UN,this,null),C(GN,this,[]),C(KN,this,[]),A(bM,this,ZM).call(this),A(bM,this,tF).call(this),M(fM,this).clear(),C(pM,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}`;M(tM,this).add(i),A(bM,this,lF).call(this,t),A(bM,this,hF).call(this),M($N,this)&&"function"==typeof M($N,this).handleDecodedFrame&&M($N,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=zN(t);Number.isFinite(i)&&i>0&&(e.totalBytes+=i)}))}return e.available=!0,e}(M(fM,this))}hasDecodedFirstFrame(t,e){return!(!t||!e)&&M(tM,this).has(`${t}:${e}`)}getDecodedVisualBuffer(t,e){if(t&&e)return M(fM,this).get(`${t}:${e}`)}computeBuffered(t){const e=M(WN,this);if(e&&"function"==typeof e.get)return M(YN,this).computeBuffered(M(GN,this),t,e)}getActiveRenderPlacement(t=this.currentTime){const e=Number.isFinite(t)?t:this.currentTime,n=Array.isArray(M(KN,this))?M(KN,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 xM(){C(ZN,this,!1),this.trigger(Qm.TIMELINE_RESET,{reason:"switch"}),A(bM,this,cF).call(this),M(YN,this)&&"function"==typeof M(YN,this).reset&&M(YN,this).reset(),M(eM,this)&&M(eM,this).clear(),C(GN,this,[]),C(KN,this,[]),A(bM,this,ZM).call(this),A(bM,this,tF).call(this),M(HN,this).reset(),M(XN,this).reset()}function wM(t=[]){for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||!n.nodeId)continue;const i=A(bM,this,TM).call(this,n),r=A(bM,this,EM).call(this,n);this.placeOnTimeline(n.nodeId,r,i)}}function _M(t=[]){for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||!n.type)continue;const i=A(bM,this,IM).call(this,n),r=A(bM,this,SM).call(this,n);this.placeRenderNodeOnTimeline(n.type,r,n.duration,i)}}function TM(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 IM(t){const e={};return t.renderPlacementId&&(e.renderPlacementId=t.renderPlacementId),t.params&&"object"==typeof t.params&&(e.params=t.params),e}function EM(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 SM(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 AM(){M($N,this)&&"function"==typeof M($N,this).exit&&M($N,this).exit()}function NM(){M(gM,this)&&"function"==typeof this.off&&(this.off(Qm.TIMELINE_SEEKED,M(gM,this)),C(gM,this,null)),M(yM,this)&&"function"==typeof this.off&&(this.off("nodestart",M(yM,this)),C(yM,this,null))}function MM(){M(YN,this)&&(M(QN,this)&&(M(YN,this).off("track:underflow",M(QN,this)),C(QN,this,null)),M(JN,this)&&(M(YN,this).off("track:ready",M(JN,this)),C(JN,this,null)),"function"==typeof M(YN,this).dispose&&M(YN,this).dispose(),C(YN,this,null))}function FM(){M(YN,this)&&"function"==typeof M(YN,this).on&&(C(QN,this,(t=>A(bM,this,PM).call(this,t))),C(JN,this,(t=>A(bM,this,RM).call(this,t))),M(YN,this).on(Qm.TRACK_UNDERFLOW,M(QN,this)),M(YN,this).on(Qm.TRACK_READY,M(JN,this)))}function CM(){M(qN,this)&&"function"==typeof M(qN,this).on&&(C(hM,this,(t=>A(bM,this,OM).call(this,t))),M(qN,this).on(Qm.CLOCK_TICK,M(hM,this)))}function OM(t){var e,n;A(bM,this,UM).call(this),A(bM,this,hF).call(this),null!==(e=M(vM,this))&&void 0!==e&&null!==(n=e.handleTimeUpdate)&&void 0!==n&&n.call(e,this.currentTime,{isSeeking:!1}),A(bM,this,WM).call(this,this.currentTime),this.trigger(Qm.TIMELINE_TIME_UPDATE,Jm(this.currentTime,"clock")),M($N,this)&&"function"==typeof M($N,this).handleClockTick&&M($N,this).handleClockTick(t)}function PM(t){A(bM,this,UM).call(this);const e=A(bM,this,DM).call(this);e&&(null==t?void 0:t.trackType)===e.trackType&&(M($N,this)&&"function"==typeof M($N,this).handleMainTrackUnderflow?M($N,this).handleMainTrackUnderflow(t):this.transitionTo(rv))}function RM(t){if(A(bM,this,UM).call(this),this.state!==rv)return;const e=A(bM,this,DM).call(this);if(!e)return;if((null==t?void 0:t.trackType)!==e.trackType)return;if(M($N,this)&&"function"==typeof M($N,this).handleMainTrackReady)return void M($N,this).handleMainTrackReady(t);const n=this.getLastStableState()||ov;this.transitionTo(n)}function DM(t=this.currentTime){const e=A(bM,this,BM).call(this,t);if(!e)return;const n=M(WN,this)&&"function"==typeof M(WN,this).get?M(WN,this).get(e.nodeId):void 0;if(!n)return;const i=A(bM,this,LM).call(this,n);return i?{placement:e,trackType:i}:void 0}function LM(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 BM(t=this.currentTime){const e=M(GN,this)||[];let n;for(let i=0;i<e.length;i+=1){const r=e[i],o=tm(r);if(!Number.isFinite(o))continue;const s=A(bM,this,GM).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 zM(t={}){if(this.state!==nv)return;const e=null==t?void 0:t.placementId;if(!e)return;const n=A(bM,this,vF).call(this,e);n&&A(bM,this,$M).call(this,n)}function WM(t=this.currentTime){if(this.state!==nv)return;const e=A(bM,this,dF).call(this,t);Array.isArray(e)&&e.length&&e.forEach((t=>A(bM,this,$M).call(this,t)))}function $M(t){const e=null==t?void 0:t.placementId;if(!e)return;if(M(eM,this).has(e))return;if(!t||!0!==t.loop)return;if(!t.nodeId)return;const n=A(bM,this,GM).call(this,t);if(!Number.isFinite(n)||n<=0)return;const i=tm(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;M(eM,this).add(e),this.placeOnTimeline(t.nodeId,r,{nodeOffsetOverride:t.nodeOffsetOverride,nodeDurationOverride:t.nodeDurationOverride,loop:!0,loopRootPlacementId:o,loopRootOffset:s})}function UM(){const t=im(M(GN,this),{getPlacementDuration:t=>A(bM,this,GM).call(this,t),snapPlacementOffset:(t,e)=>A(bM,this,HM).call(this,t,{nodeOffsetOverride:null==e?void 0:e.nodeOffsetOverride}),onResolvedPlacement:(t,e)=>{!0!==t.loop||Number.isFinite(t.loopRootOffset)||(t.loopRootOffset=t.offset),A(bM,this,YM).call(this,null==e?void 0:e.nodeId)}});return t.updated&&(A(bM,this,tF).call(this),t.resolvedPlacements.forEach((t=>{A(bM,this,nF).call(this,t),this.trigger(Qm.PLACEMENT_ADDED,t)}))),t.updated}function jM(){if(!M(KN,this).length||!M(GN,this).length)return!1;const t=new Map;M(GN,this).forEach((e=>{(null==e?void 0:e.placementId)&&t.set(e.placementId,e)}));const e=M(KN,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];A(bM,this,qM).call(this,o,t)&&(n=!0,i.push(o))}return n&&(nm(M(KN,this)),i.forEach((t=>{this.trigger(Qm.RENDER_PLACEMENT_ADDED,t)}))),n}function qM(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=A(bM,this,VM).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 am(M(KN,this).filter((e=>e!==t&&!0!==(null==e?void 0:e.offsetPending))),s,a,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements"),A(bM,this,YM).call(this,null==r?void 0:r.nodeId),!0}function VM(t,e){const n=tm(t);if(!Number.isFinite(n))return;if("start"===e.offsetAnchorEdge)return A(bM,this,HM).call(this,n);const i=A(bM,this,GM).call(this,t);if(!(i>0))return;const r=n+i;if(!Number.isFinite(r))return;const o=A(bM,this,HM).call(this,r);return!0===e.offsetAnchorIsReference?Math.max(o,r):o}function GM(t){return Jp(t,M(WN,this))}function HM(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 KM(t,e={}){const n=sm(t);if("string"==typeof t&&t.includes("@")&&!n)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");if(!n){const n=rm(t);return{offset:A(bM,this,HM).call(this,n,e)}}const i=M(GN,this).find((t=>(null==t?void 0:t.placementId)===n.placementId));if(!i)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");const r=tm(i);if("start"===n.anchor)return Number.isFinite(r)?{offset:A(bM,this,HM).call(this,r,e)}:{offset:void 0,offsetPending:!0,offsetAnchorPlacementId:i.placementId,offsetAnchorEdge:"start",offsetAnchorIsReference:!0};const o=A(bM,this,GM).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=A(bM,this,HM).call(this,s,e);return{offset:Math.max(a,s)}}function XM(t){if(!t||!M(WN,this)||"function"!=typeof M(WN,this).get)return;if(M(nM,this).has(t))return;let e;try{e=M(WN,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),A(bM,this,YM).call(this,t)};e.on(Qm.NODE_LOADED,n),M(nM,this).set(t,n)}function YM(t){if(!t)return;if(A(bM,this,QM).call(this,t))return;const e=M(nM,this).get(t);if(!e)return;let n;try{n=M(WN,this).get(t)}catch(t){n=null}n&&"function"==typeof n.off&&n.off(Qm.NODE_LOADED,e),M(nM,this).delete(t)}function QM(t){if(!t)return!1;const e=new Map;M(GN,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!!M(GN,this).some((t=>n(t)))||!!M(KN,this).some((t=>n(t)))}function JM(){M(nM,this).size&&M(WN,this)?(M(nM,this).forEach(((t,e)=>{let n;try{n=M(WN,this).get(e)}catch(t){n=null}n&&"function"==typeof n.off&&n.off(Qm.NODE_LOADED,t)})),M(nM,this).clear()):M(nM,this).clear()}function ZM(){C(iM,this,[]),C(rM,this,0),M(oM,this).clear(),M(sM,this).clear(),C(aM,this,Number.NEGATIVE_INFINITY)}function tF(){C(lM,this,[]),C(uM,this,0),C(cM,this,Number.NEGATIVE_INFINITY)}function eF(t,e){const n=M(iM,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<M(rM,this)&&C(rM,this,M(rM,this)+1)}function nF(t){const e=null==t?void 0:t.placementId;if(!e||M(oM,this).has(e))return;const n=tm(t),i=A(bM,this,GM).call(this,t);if(!Number.isFinite(n)||!Number.isFinite(i)||i<0)return void M(sM,this).add(e);const r=n+i;Number.isFinite(r)&&(M(oM,this).add(e),M(sM,this).delete(e),A(bM,this,eF).call(this,e,r))}function iF(){M(sM,this).size&&Array.from(M(sM,this)).forEach((t=>{const e=A(bM,this,vF).call(this,t);e?A(bM,this,nF).call(this,e):M(sM,this).delete(t)}))}function rF(t){const e=Number(t);if(!Number.isFinite(e))return;if(e<M(aM,this))return void C(aM,this,e);if(C(aM,this,e),A(bM,this,iF).call(this),!M(iM,this).length)return;const n=new Set;let i=M(rM,this);for(;i<M(iM,this).length;){const t=M(iM,this)[i];if(!t||!Number.isFinite(t.endTime)||t.endTime>e)break;t.placementId&&n.add(t.placementId),i+=1}i!==M(rM,this)&&(C(rM,this,i),n.size&&(A(bM,this,aF).call(this,n),A(bM,this,oF).call(this,n)))}function oF(t){if(t&&t.size)for(const e of M(tM,this)){const n=e.split(":")[0];t.has(n)&&M(tM,this).delete(e)}}function sF(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 aF(t){if(t&&t.size)for(const[e,n]of M(fM,this).entries())t.has(null==n?void 0:n.placementId)&&(A(bM,this,sF).call(this,n),M(fM,this).delete(e))}function lF(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=yN(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=M(fM,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||M(fM,this).set(f,m)}function cF(){for(const t of M(fM,this).values())A(bM,this,sF).call(this,t);M(fM,this).clear(),C(pM,this,null),M(tM,this).clear()}function uF(t){const e=Number.isFinite(t)?t:this.currentTime;if(!Number.isFinite(e))return;e<M(cM,this)&&(C(lM,this,[]),C(uM,this,0));const n=Array.isArray(M(GN,this))?M(GN,this):[],i=[],r=new Set;M(lM,this).forEach((t=>{A(bM,this,xF).call(this,t,e)&&(i.push(t),(null==t?void 0:t.placementId)&&r.add(t.placementId))}));let o=M(uM,this);for(;o<n.length;){const t=n[o],s=tm(t);if(!Number.isFinite(s))break;if(s>e)break;if(A(bM,this,xF).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}C(lM,this,i),C(uM,this,o),C(cM,this,e)}function dF(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===M(cM,this)?M(lM,this).slice():(Array.isArray(M(GN,this))?M(GN,this):[]).filter((t=>A(bM,this,xF).call(this,t,n,i)))}function hF(){const t=this.currentTime,e=A(bM,this,pF).call(this,t);if(!e.length)return void C(pM,this,null);const n=this.getActiveRenderPlacement(t),i=A(bM,this,mF).call(this,e,n);(i!==M(pM,this)||A(bM,this,fF).call(this,t,n))&&(C(pM,this,i),this.trigger(Qm.VISUAL_FRAMES_AVAILABLE,{time:t,frames:e}))}function fF(t,e){const n=e||this.getActiveRenderPlacement(t);if(!n)return!1;if(!_m.doesRenderNodeTypeRequireFrameCadence(null==n?void 0:n.type))return!1;const i=n.duration;return"number"==typeof i&&i>0}function pF(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){fN(c),a.push(t);continue}if("function"==typeof r&&!r(u,n)){const e=pN(u),i="function"==typeof o?o(u):void 0;Number.isFinite(i)&&Number.isFinite(e)&&n>=e+i&&(fN(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&&hN(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:pN(u),placementSortOffset:mN(u),placementSortId:vN(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=gN(r),a=gN(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:M(fM,this),time:t,getPlacementById:t=>A(bM,this,vF).call(this,t),isPlacementActiveAtTime:(t,e)=>A(bM,this,xF).call(this,t,e),getPlacementDuration:t=>A(bM,this,GM).call(this,t)})}function mF(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 vF(t){if(t)return(M(GN,this)||[]).find((e=>(null==e?void 0:e.placementId)===t))}function gF(t){if("end"===t){const t=A(bM,this,yF).call(this);if(!Number.isFinite(t))return;const e=A(bM,this,bF).call(this);return Math.max(0,t-Math.min(t,e))}const e=Number(t);return Number.isFinite(e)?e:0}function yF(){let t;return(Array.isArray(M(GN,this))?M(GN,this):[]).forEach((e=>{const n=tm(e);if(!Number.isFinite(n))return;const i=A(bM,this,GM).call(this,e);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(t)||r>t)&&(t=r)})),t}function bF(){const t=A(bM,this,kF).call(this);return t>0?t:.001}function kF(){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 xF(t,e,n=0){if(!em(t,e,M(WN,this)))return!1;const i=Number(n);if(!Number.isFinite(i)||i<=0)return!0;const r=A(bM,this,GM).call(this,t);if(!Number.isFinite(r))return!0;const o=tm(t);return!Number.isFinite(o)||e<o+r-i}var wF=new WeakMap,_F=new WeakMap,TF=new WeakMap,IF=new WeakMap,EF=new WeakMap,SF=new WeakMap,AF=new WeakMap,NF=new WeakMap,MF=new WeakMap,FF=new WeakMap,CF=new WeakMap,OF=new WeakMap,PF=new WeakMap,RF=new WeakMap,DF=new WeakMap,LF=new WeakMap,BF=new WeakMap,zF=new WeakSet;class WF extends Qu{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),O(this,zF),F(this,wF,void 0),F(this,_F,void 0),F(this,TF,1),F(this,IF,1),F(this,EF,1),F(this,SF,""),F(this,AF,0),F(this,NF,[]),F(this,MF,null),F(this,FF,void 0),F(this,CF,[]),F(this,OF,null),F(this,PF,null),F(this,RF,0),F(this,DF,0),F(this,LF,0),F(this,BF,void 0);const[e]=t;C(wF,this,e),C(RF,this,Zg()),C(BF,this,A(zF,this,$F).call(this)),A(zF,this,UF).call(this),A(zF,this,jF).call(this),A(zF,this,KF).call(this),A(zF,this,GF).call(this)}get publicAPI(){return M(BF,this)}calcScore(){A(zF,this,iC).call(this)}onDispose(){M(wF,this)&&M(_F,this)&&"function"==typeof M(wF,this).off&&M(wF,this).off(Qm.TIMELINE_PLAYER_STATE,M(_F,this)),C(_F,this,null),A(zF,this,HF).call(this),A(zF,this,XF).call(this),C(wF,this,null),C(CF,this,[]),C(NF,this,[]),C(BF,this,null)}}function $F(){const t=this;return{get score(){return M(TF,t)},get status(){return M(SF,t)},get streamQualityScore(){return M(IF,t)},get fpsScore(){return M(EF,t)},get browserFps(){return M(AF,t)},get waitingSeconds(){return M(DF,t)/1e3},get playingSeconds(){return M(LF,t)/1e3}}}function UF(){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 jF(){M(wF,this)&&"function"==typeof M(wF,this).on&&(C(_F,this,(t=>A(zF,this,qF).call(this,t))),M(wF,this).on(Qm.TIMELINE_PLAYER_STATE,M(_F,this)))}function qF(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||A(zF,this,VF).call(this,null):A(zF,this,VF).call(this,"waiting"):A(zF,this,VF).call(this,"playing")}function VF(t){if(t===M(OF,this))return;const e=Zg();M(OF,this)&&Number.isFinite(M(PF,this))&&M(CF,this).push({state:M(OF,this),startMs:M(PF,this),endMs:e}),C(OF,this,t),C(PF,this,t?e:null),A(zF,this,JF).call(this,e)}function GF(){const t=Number(this.settings.calcScoreInterval);!Number.isFinite(t)||t<=0||(C(FF,this,(()=>A(zF,this,iC).call(this))),Dk(M(FF,this),1e3*t))}function HF(){M(FF,this)&&Lk(M(FF,this)),C(FF,this,null)}function KF(){if("function"!=typeof Ek)return;const t=()=>{if(this._disposed)return;const e=Zg();C(AF,this,A(zF,this,YF).call(this,M(NF,this),e)),C(MF,this,Ek(t))};C(MF,this,Ek(t))}function XF(){M(MF,this)&&"function"==typeof Sk&&Sk(M(MF,this)),C(MF,this,null)}function YF(t,e){const n=A(zF,this,QF).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 QF(){const t=Number(this.settings.windowSeconds);return!Number.isFinite(t)||t<=0?3e4:1e3*t}function JF(t){const e=t-A(zF,this,QF).call(this);for(;M(CF,this).length&&M(CF,this)[0].endMs<=e;)M(CF,this).shift()}function ZF(t){const e=t-A(zF,this,QF).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 M(CF,this).forEach((t=>{r(t.state,t.startMs,t.endMs)})),M(OF,this)&&Number.isFinite(M(PF,this))&&r(M(OF,this),M(PF,this),t),C(DF,this,n),C(LF,this,i),{waitingMs:n,playingMs:i}}function tC(t,e){if(t<=0)return 1;if(t>e)return 0;const n=e||1;return Yp(1-t*this.settings.waitingMultiplier/n)}function eC(){if(Zg()-M(RF,this)<=1e3*this.settings.fpsGracePeriod)return 1;const t=Number(M(AF,this)),e=Xm.isDesktop()?this.settings.bestFpsDesktop:this.settings.bestFpsMobile,n=Yp(e>0?t/e:0);return"quad"===this.settings.fpsMathFuncType?n*n:n}function nC(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 iC(){const t=Zg(),{waitingMs:e,playingMs:n}=A(zF,this,ZF).call(this,t),i=A(zF,this,tC).call(this,e,n),r=A(zF,this,eC).call(this),o=Yp(i*this.settings.streamQualityWeight+r*this.settings.fpsWeight);o!==M(TF,this)&&(C(TF,this,o),this.trigger(Qm.QOE_SCORE,o)),C(IF,this,i),C(EF,this,r);const s=A(zF,this,nC).call(this,o,e);s!==M(SF,this)&&(C(SF,this,s),this.trigger(Qm.QOE_STATUS,s))}function rC(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}function oC(t){const e=Number(t);return!Number.isFinite(e)||e<0?0:e}var sC=new WeakMap,aC=new WeakMap,lC=new WeakMap,cC=new WeakMap,uC=new WeakSet;class dC extends Qu{get name(){return"SegmentEvictionCoordinator"}get defaults(){return{enabled:vy("segmentEvictionEnabled"),bufferBehindSeconds:vy("segmentEvictionBufferBehindSeconds"),bufferAheadSeconds:vy("segmentEvictionBufferAheadSeconds"),maxRetainedBytes:vy("segmentEvictionMaxRetainedBytes")}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"evictAtTime"])}constructor(t,e,n={}){super(n),O(this,uC),F(this,sC,void 0),F(this,aC,void 0),F(this,lC,void 0),F(this,cC,void 0),C(sC,this,t),C(aC,this,e),C(lC,this,(t=>A(uC,this,hC).call(this,t))),C(cC,this,(t=>A(uC,this,fC).call(this,t))),M(sC,this)&&"function"==typeof M(sC,this).on&&(M(sC,this).on(Qm.TIMELINE_TIME_UPDATE,M(lC,this)),M(sC,this).on(Qm.TIMELINE_SEEKED,M(cC,this)))}onDispose(){M(sC,this)&&"function"==typeof M(sC,this).off&&(M(sC,this).off(Qm.TIMELINE_TIME_UPDATE,M(lC,this)),M(sC,this).off(Qm.TIMELINE_SEEKED,M(cC,this))),C(sC,this,null),C(aC,this,null),C(lC,this,null),C(cC,this,null)}evictAtTime(t){if(!0!==this.settings.enabled)return;const e=Number(t);if(!Number.isFinite(e))return;const n=oC(this.settings.bufferBehindSeconds),i=oC(this.settings.bufferAheadSeconds),r=e-n,o=e+i,s=A(uC,this,pC).call(this);if(!s.length)return;const a=Number(this.settings.maxRetainedBytes);if(Number.isFinite(a)&&a>0&&A(uC,this,mC).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=tm(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=A(uC,this,vC).call(this,e);if(!n)return;const i=t.filter((t=>A(uC,this,gC).call(this,t,r,o)));i.length?A(uC,this,yC).call(this,n,i,r,o):"function"==typeof n.evict&&n.evict()}))}}function hC(t){var e,n;if(!0!==this.settings.enabled)return;if((null===(e=M(sC,this))||void 0===e?void 0:e.state)===sv)return;const i=Number(null==t?void 0:t.time),r=Number.isFinite(i)?i:Number(null===(n=M(sC,this))||void 0===n?void 0:n.currentTime);this.evictAtTime(r)}function fC(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=M(sC,this))||void 0===e?void 0:e.currentTime);this.evictAtTime(i)}function pC(){var t;const e=null===(t=M(sC,this))||void 0===t?void 0:t.placements;return Array.isArray(e)?e:[]}function mC(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=A(uC,this,vC).call(this,i),o=Number(null==r?void 0:r.retainedByteLength);Sg(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=>{Sg(null==t?void 0:t.retainedByteLength)&&(n+=t.retainedByteLength)}))}))})),n}function vC(t){if(M(aC,this)&&"function"==typeof M(aC,this).get)return M(aC,this).get(t)}function gC(t,e,n){const i=tm(t);if(!Number.isFinite(i))return!1;const r=Jp(t,M(aC,this));return(Number.isFinite(r)?i+r:Number.POSITIVE_INFINITY)>e&&i<n}function yC(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=rC(null==t?void 0:t.offset,0);r.forEach((t=>{if(!t||!Sg(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=tm(a);if(!Number.isFinite(l))continue;const c=rC(null==a?void 0:a.nodeOffsetOverride,0),u=rC(null==t?void 0:t.offset,NaN);if(!Number.isFinite(u))continue;const d=rC(null==t?void 0:t.duration,0),h=l+o+u-c,f=h+(d>0?d:0),p=Jp(a,M(aC,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 bC=new WeakMap,kC=new WeakMap,xC=new WeakMap,wC=new WeakSet;let _C=class extends Qu{get name(){return"DocumentVisibility"}get defaults(){return{autoPauseOnVisibilityChange:!0,autoResumeOnVisibilityChange:!0}}constructor(t,e={}){super(e),O(this,wC),F(this,bC,void 0),F(this,kC,null),F(this,xC,!1),C(bC,this,t),A(wC,this,TC).call(this)}onDispose(){A(wC,this,IC).call(this),C(bC,this,null),C(xC,this,!1)}};function TC(){const t=null==td?void 0:td.document;t&&"function"==typeof t.addEventListener&&(C(kC,this,(()=>A(wC,this,EC).call(this))),t.addEventListener("visibilitychange",M(kC,this)))}function IC(){const t=null==td?void 0:td.document;M(kC,this)&&t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",M(kC,this)),C(kC,this,null)}function EC(){const t=null==td?void 0:td.document,e=null==t?void 0:t.visibilityState;"string"==typeof e&&("hidden"!==e?"visible"===e&&A(wC,this,AC).call(this):A(wC,this,SC).call(this))}function SC(){var t;(null===(t=this.settings)||void 0===t?void 0:t.autoPauseOnVisibilityChange)&&M(bC,this)&&"function"==typeof M(bC,this).pause&&(M(bC,this).state===nv?(this.log.info("[#handleHidden] Pausing timeline due to document visibility change"),M(bC,this).pause(),C(xC,this,!0)):C(xC,this,!1))}function AC(){var t;M(xC,this)&&(null===(t=this.settings)||void 0===t?void 0:t.autoResumeOnVisibilityChange)&&M(bC,this)&&"function"==typeof M(bC,this).play&&(M(bC,this).state!==nv?(this.log.info("[#handleVisible] Resuming timeline due to document visibility change"),M(bC,this).play(),C(xC,this,!1)):C(xC,this,!1))}const NC=[{event:"canplay",once:!0,trackAs:"canplay"},{event:"playing",once:!0,trackAs:"startedplaying"},"play","playing","waiting","pause","seeking","seeked","nodestart","nodeend"];function MC(t,e=0){return Number.isFinite(t)?t:e}function FC(t){const e=null==t?void 0:t.exposedPlayerAPI;return e&&"object"==typeof e?e:t}const CC=[function(t){return{schema:"iglu:com.helloeko/player/jsonschema/1-0-6",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:MC(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:MC(null==r?void 0:r.volume),playercontainerwidth:MC(null==r?void 0:r.containerWidth),playercontainerheight:MC(null==r?void 0:r.containerHeight)}}}},function(t){return{schema:"iglu:com.helloeko/currentnode/jsonschema/1-0-1",match:/^.*$/,getData:()=>{var e;const n=FC(t),i=function(t){const e=FC(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==td||null===(t=td.eko)||void 0===t||null===(t=t.environment)||void 0===t?void 0:t.embeddingApp;return e?{embeddingapp:e}:{}}}}],OC=Object.freeze({once:!1,trackAs:""});var PC=new WeakMap,RC=new WeakMap,DC=new WeakMap,LC=new WeakMap,BC=new WeakSet;class zC extends Qu{get name(){return"Tracker"}get defaults(){return{trackingEnabled:vy("trackingEnabled"),defaultForwarders:NC,defaultContextPackers:CC}}constructor(t,e={}){super(e),O(this,BC),F(this,PC,void 0),F(this,RC,new Map),F(this,DC,[]),F(this,LC,!1),C(PC,this,t),A(BC,this,VC).call(this),A(BC,this,WC).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=A(BC,this,HC).call(this);n&&n("track",t,...e)}registerContextPacker(t){if(!t||"object"!=typeof t)return void this.log.warn("[registerContextPacker] Expected a packer object.");const e={schema:t.schema,match:t.match,getData: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=A(BC,this,HC).call(this);n&&n("registerContextPacker",e)}onDispose(){A(BC,this,qC).call(this),A(BC,this,GC).call(this),C(PC,this,null),C(LC,this,!1)}}function WC(){(Array.isArray(this.settings.defaultForwarders)?this.settings.defaultForwarders:[]).forEach((t=>A(BC,this,$C).call(this,t)))}function $C(t){const e=A(BC,this,UC).call(this,t);if(!e)return void this.log.warn("[#addEventForwarder] Invalid forwarder input.",t);const n=M(PC,this);if(!n||"function"!=typeof n.on)return;const i=A(BC,this,jC).call(this,e);if(M(RC,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),M(RC,this).set(i,{event:e.event,listener:r})}function UC(t){return"string"==typeof t&&t?{event:t,...OC}: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 jC({event:t,once:e,trackAs:n}){return`${t}:${e}:${n}`}function qC(){const t=M(PC,this);t&&"function"==typeof t.off&&M(RC,this).forEach((({event:e,listener:n})=>{t.off(e,n)})),M(RC,this).clear()}function VC(){(Array.isArray(this.settings.defaultContextPackers)?this.settings.defaultContextPackers:[]).forEach((t=>{if("function"!=typeof t)return;const e=t(M(PC,this),this);e&&"object"==typeof e&&("function"==typeof e.dispose&&M(DC,this).push(e.dispose),e.disabled||this.registerContextPacker({schema:e.schema,match:e.match,getData:e.getData}))}))}function GC(){M(DC,this).forEach((t=>{try{t()}catch(t){this.log.warn("[#teardownContextPackers] Failed disposing context packer.",t)}})),C(DC,this,[])}function HC(){const t=null==td?void 0:td.EkoAnalytics;return"function"==typeof t?t:(A(BC,this,KC).call(this),null)}function KC(){this.settings.trackingEnabled&&!M(LC,this)&&(this.log.warn("EkoAnalytics not found on window."),C(LC,this,!0))}class XC{#E;#it;#rt;#ot;#st;#at;#lt;#ct;#ut;#dt;#ht;#ft;#pt;#mt;#vt;#gt;#yt;#bt;#kt;constructor(t,e={},n=null){this.#E=new nd(t,e),this.#it=new ud(this.#E,e),this.#rt=new yk(e),this.#ot=new _y(e),this.#st=new Zb(this.#ot,e),this.#at=new Kb(this.#st,this.#rt,e),this.#lt=new ak(this.#at,e),this.#ct=new kM(this.#at,e),this.#ut=new _C(this.#ct,e),this.#bt=new dC(this.#ct,this.#at,e),this.#dt=new rx(this.#at,this.#lt,this.#rt,this.#ct,e),this.#ht=new jx(this.#at,this.#lt,this.#ct,e),this.#ft=new UI(e),this.#pt=new fE(this.#at,this.#ct,this.#ft,e),this.#vt=new WF(this.#ct,e),this.#kt=new zC(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.#gt=r?r({timeline:this.#ct,canvas:this.#E,containerSize:this.#it,options:e}):new Gv(this.#ct,this.#E,this.#it,e),this.#mt=o?o({timeline:this.#ct,decodeCoordinator:this.#pt,options:e}):new XS(this.#ct,this.#pt,e),this.#yt=new mS(this.#ct,this.#gt,e)}get canvas(){return this.#E}get containerSize(){return this.#it}get assetsDeliveryService(){return this.#rt}get downloadSpeed(){return this.#ot}get abrSelector(){return this.#st}get nodeRepository(){return this.#at}get nodePrioritizer(){return this.#lt}get timeline(){return this.#ct}get documentVisibility(){return this.#ut}get nodeResolver(){return this.#dt}get segmentLoadCoordinator(){return this.#ht}get decoderFactory(){return this.#ft}get parsingManager(){return this.#pt}get audioAdapter(){return this.#mt}get audioPlaybackManager(){return this.#mt}get qoe(){return this.#vt}get renderAdapter(){return this.#gt}get renderer(){return this.#gt}get transitionManager(){return this.#yt}get tracker(){return this.#kt}dispose(){[this.#kt,this.#ct,this.#ut,this.#ht,this.#dt,this.#lt,this.#at,this.#rt,this.#st,this.#ot,this.#pt,this.#ft,this.#mt,this.#vt,this.#gt,this.#yt,this.#bt,this.#it,this.#E].forEach((t=>{t&&"function"==typeof t.dispose&&t.dispose()})),this.#ct=null,this.#ut=null,this.#ht=null,this.#dt=null,this.#lt=null,this.#at=null,this.#rt=null,this.#st=null,this.#ot=null,this.#pt=null,this.#ft=null,this.#mt=null,this.#vt=null,this.#gt=null,this.#yt=null,this.#bt=null,this.#E=null,this.#kt=null}}const YC="backstage-global-workflows.1156289";var QC={isPlainObject:Gu,deepMerge:Hu,get:Xg,set:Yg,ekoGlobalStore:Qg,download:hy,isPositiveNumber:Sg,clamp01:Yp,root:td,now:Zg,getFrameDimensions:yN,useragent:Ym,requestAnimationFrame:Ek,cancelAnimationFrame:Sk,start:Dk,stop:Lk,isTicking:Bk,predicator:function(t,e){const n=e||{};if("function"!=typeof t)return void Ak.error("[predicator] Bad argument given to predicator, first argument must be a function.",arguments);if(t.apply())return Ak.debug("[predicator] Invoking onFulfilled immediately."),void("function"==typeof n.onFulfilled&&n.onFulfilled.call(null,0));const i=n.timeout||1e4,r=n.interval,o=Zg();let s,a,l,c,u;c=function(){t.apply()&&l()},l=function(){Lk(c),td.clearTimeout(s),u=Zg()-o,Ak.debug("[predicator] Invoking onFulfilled after "+u+" ms."),"function"==typeof n.onFulfilled&&n.onFulfilled.call(null,u)},a=function(){Lk(c),u=Zg()-o,Ak.debug("[predicator] Invoking onTimeout after "+u+" ms."),"function"==typeof n.onTimeout&&n.onTimeout.call(null,u)},s=td.setTimeout(a,i),Dk(c,r)},createThrottler:zk,scheduleExecution:Wk},JC=new WeakMap,ZC=new WeakMap,tO=new WeakMap,eO=new WeakMap,nO=new WeakMap,iO=new WeakMap,rO=new WeakMap,oO=new WeakSet;class sO{constructor(t){O(this,oO),F(this,JC,[]),F(this,ZC,[]),F(this,tO,new LN("placement-")),F(this,eO,new LN("renderplacement-")),F(this,nO,void 0),F(this,iO,new Map),F(this,rO,void 0),C(nO,this,t),C(rO,this,{allowUnready:!0,getNode:t=>A(oO,this,aO).call(this,t)})}get placements(){return M(JC,this).slice()}get renderPlacements(){return M(ZC,this).slice()}getNodesAtTime(t){A(oO,this,lO).call(this);const e=A(oO,this,uO).call(this,t);if(!Number.isFinite(e))return[];const n=M(JC,this).filter((t=>em(t,e,null,M(rO,this)))),i=[];return n.forEach((t=>{const e=A(oO,this,aO).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&&M(iO,this).set(r,i);const o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=sm(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}:om(e,n);let u,d,h,f=!1;const p=null!==a;if(a){const t=M(JC,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=tm(t);if("start"===a.anchor)Number.isFinite(e)?u=e:f=!0;else{const n=A(oO,this,cO).call(this,t);Number.isFinite(e)&&n>0?u=e+n:f=!0}}else if(l){const t=n.offsetAnchorPlacementId?M(JC,this).find((t=>(null==t?void 0:t.placementId)===n.offsetAnchorPlacementId)):M(JC,this).length?M(JC,this)[M(JC,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==t?void 0:t.placementId),d){const e=tm(t),n=A(oO,this,cO).call(this,t);Number.isFinite(e)&&n>0?u=e+n-c:(f=!0,h="end")}else u=-c}else u=rm(e);const m=M(tO,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 M(JC,this).push(v),nm(M(JC,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=sm(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=M(JC,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=tm(t);if("start"===c.anchor)Number.isFinite(e)?o=e:l=!0;else{const n=A(oO,this,cO).call(this,t);Number.isFinite(e)&&Number.isFinite(n)?o=e+n:l=!0}}else o=rm(e);const d=M(eO,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;am(M(ZC,this),t,e,"TimelineDefinition.placeRenderNodeOnTimeline does not allow overlapping render nodes")}return M(ZC,this).push(m),nm(M(ZC,this)),d}}function aO(t){if(t)return M(nO,this)&&"function"==typeof M(nO,this).get?M(nO,this).get(t):M(iO,this).get(t)}function lO(){return im(M(JC,this),{getPlacementDuration:t=>A(oO,this,cO).call(this,t)}).updated}function cO(t){return Jp(t,null,M(rO,this))}function uO(t){if("end"===t){const t=A(oO,this,dO).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 dO(){let t;return M(JC,this).forEach((e=>{const n=tm(e);if(!Number.isFinite(n))return;const i=A(oO,this,cO).call(this,e);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(t)||r>t)&&(t=r)})),t}const hO=new Set(["canplay","play","playing","waiting","pause","seeking","seeked"]);var fO=new WeakMap,pO=new WeakMap,mO=new WeakMap,vO=new WeakMap,gO=new WeakMap,yO=new WeakMap,bO=new WeakMap,kO=new WeakMap,xO=new WeakMap,wO=new WeakMap,_O=new WeakMap,TO=new WeakMap,IO=new WeakMap,EO=new WeakMap,SO=new WeakMap,AO=new WeakMap,NO=new WeakMap,MO=new WeakMap,FO=new WeakMap,CO=new WeakMap,OO=new WeakMap,PO=new WeakMap,RO=new WeakMap,DO=new WeakMap,LO=new WeakMap,BO=new WeakSet;class zO extends Qu{get name(){return"EkoPlayer"}get exposedPlayerAPI(){return M(vO,this)}constructor(t,e={}){const{options:n,publicOptions:i}=function(t={}){const e=Hu({},py,t);Object.entries(fy).forEach((([t,{targetPaths:n}])=>{void 0!==e[t]&&n.forEach((n=>{void 0===Xg(e,n)&&Yg(e,n,e[t])}))}));const n=function(t){const e={};return Object.keys(fy).forEach((n=>{Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})),Object.freeze(e)}(e);return my.info("Processed options:",e),my.info("Public options:",n),{options:e,publicOptions:n}}(e);return super(n),O(this,BO),F(this,fO,void 0),F(this,pO,void 0),F(this,mO,void 0),F(this,vO,void 0),F(this,gO,void 0),F(this,yO,void 0),F(this,bO,void 0),F(this,kO,void 0),F(this,xO,void 0),F(this,wO,void 0),F(this,_O,void 0),F(this,TO,void 0),F(this,IO,void 0),F(this,EO,void 0),F(this,SO,void 0),F(this,AO,void 0),F(this,NO,void 0),F(this,MO,void 0),F(this,FO,void 0),F(this,CO,void 0),F(this,OO,void 0),F(this,PO,void 0),F(this,RO,void 0),F(this,DO,void 0),F(this,LO,0),C(mO,this,i),this.log.info("Initializing EkoPlayer with options:",i),C(TO,this,new XC(t,n,this)),A(BO,this,XO).call(this,M(TO,this)),C(SO,this,(t=>A(BO,this,WO).call(this,t))),M(pO,this)&&"function"==typeof M(pO,this).on&&M(pO,this).on(Qm.TIMELINE_CUEPOINT,M(SO,this)),C(AO,this,null),C(MO,this,(t=>A(BO,this,$O).call(this,t))),C(FO,this,(t=>{const e=t&&"object"==typeof t?t:{};A(BO,this,$O).call(this,{...e,event:"seeking"})})),C(CO,this,(t=>{const e=t&&"object"==typeof t?t:{};A(BO,this,$O).call(this,{...e,event:"seeked"})})),M(pO,this)&&"function"==typeof M(pO,this).on&&(M(pO,this).on(Qm.TIMELINE_PLAYER_STATE,M(MO,this)),M(pO,this).on(Qm.TIMELINE_SEEKING,M(FO,this)),M(pO,this).on(Qm.TIMELINE_SEEKED,M(CO,this))),C(RO,this,(t=>{const e=t&&"object"==typeof t?t:{};this.trigger(Qm.CONTAINER_RESIZE,e)})),M(IO,this)&&"function"==typeof M(IO,this).on&&M(IO,this).on(Qm.CONTAINER_RESIZE,M(RO,this)),A(BO,this,VO).call(this),A(BO,this,qO).call(this),C(vO,this,A(BO,this,KO).call(this)),M(vO,this)}onDispose(){M(pO,this)&&"function"==typeof M(pO,this).off&&M(SO,this)&&M(pO,this).off(Qm.TIMELINE_CUEPOINT,M(SO,this)),C(SO,this,null),M(pO,this)&&"function"==typeof M(pO,this).off&&(M(MO,this)&&M(pO,this).off(Qm.TIMELINE_PLAYER_STATE,M(MO,this)),M(FO,this)&&M(pO,this).off(Qm.TIMELINE_SEEKING,M(FO,this)),M(CO,this)&&M(pO,this).off(Qm.TIMELINE_SEEKED,M(CO,this))),C(MO,this,null),C(FO,this,null),C(CO,this,null),C(AO,this,null),M(IO,this)&&"function"==typeof M(IO,this).off&&M(RO,this)&&M(IO,this).off(Qm.CONTAINER_RESIZE,M(RO,this)),C(RO,this,null),M(_O,this)&&"function"==typeof M(_O,this).off&&(M(OO,this)&&M(_O,this).off("qoescore",M(OO,this)),M(PO,this)&&M(_O,this).off("qoestatus",M(PO,this))),C(OO,this,null),C(PO,this,null),M(wO,this)&&"function"==typeof M(wO,this).off&&M(DO,this)&&M(wO,this).off(Qm.DECODER_ERROR,M(DO,this)),C(DO,this,null),C(LO,this,0),M(EO,this)&&"function"==typeof M(EO,this).dispose&&M(EO,this).dispose(),C(EO,this,null),M(TO,this)&&"function"==typeof M(TO,this).dispose&&M(TO,this).dispose(),C(pO,this,null),C(fO,this,null),C(yO,this,null),C(bO,this,null),C(kO,this,null),C(xO,this,null),C(wO,this,null),C(_O,this,null),C(IO,this,null),C(gO,this,null),C(vO,this,null),C(TO,this,null)}}function WO(t={}){var e;this.trigger(Qm.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 $O(t={}){const e="string"==typeof(null==t?void 0:t.event)?t.event:"";if(!hO.has(e))return;if("playing"!==e||Number.isFinite(M(NO,this))||(C(NO,this,Zg()),this.log.info(`[#handlePlayerStateEvent] Playback started @ ${(M(NO,this)/1e3).toFixed(3)}s (${Date.now()})`)),M(AO,this)===e)return;C(AO,this,e);const n=Number.isFinite(null==t?void 0:t.time)?t.time:M(pO,this)&&Number.isFinite(M(pO,this).currentTime)?M(pO,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 UO(){return new sO(M(fO,this))}function jO(t){if(!t||"object"!=typeof t)throw new Error("EkoPlayer.switchTimeline requires a timeline definition");if(!M(pO,this)||"function"!=typeof M(pO,this).applyTimelineDefinition)throw new Error("EkoPlayer.switchTimeline requires an active timeline");M(pO,this).applyTimelineDefinition(t),"function"==typeof M(pO,this).play&&M(pO,this).play()}function qO(){M(_O,this)&&"function"==typeof M(_O,this).on&&(C(OO,this,(t=>{this.trigger(Qm.QOE_SCORE,t)})),C(PO,this,(t=>{this.trigger(Qm.QOE_STATUS,t)})),M(_O,this).on(Qm.QOE_SCORE,M(OO,this)),M(_O,this).on(Qm.QOE_STATUS,M(PO,this)))}function VO(){M(wO,this)&&"function"==typeof M(wO,this).on&&(C(DO,this,(t=>{const e=t&&"object"==typeof t?t:{error:t};this.trigger(Qm.DECODER_ERROR,e),A(BO,this,GO).call(this,e)})),M(wO,this).on(Qm.DECODER_ERROR,M(DO,this)))}function GO(t={}){var e;const n=M(pO,this);if(!n||"number"!=typeof n.currentTime)return;const i=Date.now();if(i<M(LO,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;C(LO,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 HO(t={}){if(M(EO,this))return M(EO,this);const e=t&&"object"==typeof t&&!Array.isArray(t)?{...t}:{},n=M(gO,this)&&M(gO,this).element?M(gO,this).element:null;if(!n)throw new Error("Debug overlay requires an initialized player canvas and mount element.");const i=function({canvasElement:t,containerElement:e}={}){const n=t&&t.parentNode?t.parentNode:null;if(null==e)return n;const i=function(t,e=(null==td?void 0:td.document)){if(ed(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 ed(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:n,containerElement:e.containerElement});if(!i)throw new Error("Debug overlay requires an initialized player canvas and mount element.");Object.prototype.hasOwnProperty.call(e,"containerElement")&&delete e.containerElement;const r=await Promise.resolve().then((function(){return yR})),o=(null==r?void 0:r.createDebugOverlay)||(null==r?void 0:r.default);if("function"!=typeof o)throw new Error("Debug overlay bundle does not export createDebugOverlay().");return e.publicOptions=M(mO,this),e.playerVersion=YC,C(EO,this,o({mountElement:i,canvasElement:n,timeline:M(pO,this),getNode:t=>M(fO,this)&&"function"==typeof M(fO,this).get?M(fO,this).get(t):void 0,listNodes:()=>M(fO,this)&&"function"==typeof M(fO,this).list?M(fO,this).list():[],downloadSpeed:M(TO,this)?M(TO,this).downloadSpeed:void 0,downloadEvents:Vg,qoe:M(_O,this)?M(_O,this).publicAPI:void 0,qoeEvents:this,options:e,playbackStartedAtMs:M(NO,this)})),M(EO,this)}function KO(){const t=this;return{createTimeline:()=>A(BO,t,UO).call(t),switchTimeline:e=>A(BO,t,jO).call(t,e),play:M(pO,this).play,pause:M(pO,this).pause,reset:M(pO,this).reset,placeOnTimeline:M(pO,this).placeOnTimeline,placeRenderNodeOnTimeline:M(pO,this).placeRenderNodeOnTimeline,addNode:M(fO,this).add,getNode:M(fO,this).get,listNodes:M(fO,this).list,getNodesAtTime:e=>M(pO,t).getNodesAtTime(e),dispose:this.dispose,on:t.on,off:t.off,once:t.once,trigger:t.trigger,transitionTo:(e,n)=>M(bO,t).transitionTo(e,n),track:(e,...n)=>{if(M(xO,t)&&"function"==typeof M(xO,t).track)return M(xO,t).track(e,...n)},seekToPlacement:e=>M(pO,t).seekToPlacement(e),get currentTime(){return M(pO,t).currentTime},set currentTime(e){M(pO,t).currentTime=e},get buffered(){return M(pO,t).buffered},get options(){return M(mO,t)},get containerWidth(){return M(IO,t)?M(IO,t).containerWidth:0},get containerHeight(){return M(IO,t)?M(IO,t).containerHeight:0},get playbackRate(){return M(pO,t).playbackRate},set playbackRate(e){M(pO,t).playbackRate=e},get paused(){return!!M(pO,t)&&!0===M(pO,t).paused},get muted(){return!!M(kO,t)&&M(kO,t).muted},set muted(e){M(kO,t)&&(M(kO,t).muted=e)},get volume(){return M(kO,t)?M(kO,t).volume:1},set volume(e){M(kO,t)&&(M(kO,t).volume=e)},get qoe(){return M(_O,t)?M(_O,t).publicAPI:void 0},get utils(){return QC},get version(){return YC},loadDebugOverlay:(...e)=>A(BO,t,HO).call(t,...e)}}function XO(t){t&&(C(gO,this,t.canvas),C(fO,this,t.nodeRepository),C(pO,this,t.timeline),C(kO,this,t.audioAdapter||t.audioPlaybackManager),C(xO,this,t.tracker),C(wO,this,t.parsingManager),C(_O,this,t.qoe),C(yO,this,t.renderAdapter||t.renderer),C(bO,this,t.transitionManager),C(IO,this,t.containerSize))}class YO{constructor({target:t,props:e}){if(!t)throw new Error("`options.target` is required");go(this.#xt,e,!0),this.#xt.v.EkoPlayer=zO;const n=t.hasChildNodes()?oa:ra;this.#wt=n(Eu,{target:t,props:this.#xt.v})}#wt;#xt=Si(mo(_o({})),"EkoGallery.#props");destroy(t){if(this.#wt)return ca(this.#wt,t)}get props(){return Ds(this.#xt)}}const QO=u("gallery-react");const JO=e.forwardRef(((t,n)=>{const{config:i,debug:r,ssrHtml:o,activeItem:s={index:0,step:0},forceMobile:a,videoAspectRatio:l,onEvent:c=()=>{}}=t,u=e.useRef(null),d=e.useRef({}),h=function(t){return void 0!==t}(i),f=e.useRef(s),p=e.useRef(o);d.current.initEventSent||(c("galleryinit"),d.current.initEventSent=!0);const m=e.useCallback((t=>{d.current.state=t,t.activeItemIndex===f.current.index&&t.activeModuleIndex===f.current.step||c("activeitemchanged",{index:t.activeItemIndex,step:t.activeModuleIndex})}),[]),v=e.useCallback((t=>{d.current.API=t,0===s.index&&0===s.step||t.selectItemAndStep(s.index,s.step),d.current.unsubscribe&&d.current.unsubscribe(),d.current.unsubscribe=t.subscribe(m)}),[]),g=e.useCallback(((t,e)=>{c(t,e)}),[c]);return e.useEffect((()=>(QO.setDataStorage("gallery-react",{config:i}),window.eko=window.eko||{},window.eko.config=i,window.eko.gallery={version:"backstage-global-workflows/4.0.4"},()=>{window.eko.config=void 0})),[i]),e.useImperativeHandle(n,(()=>({prev:()=>{var t;null===(t=d.current.API)||void 0===t||t.prev()},next:()=>{var t;null===(t=d.current.API)||void 0===t||t.next()}}))),e.useEffect((()=>{if(null==u||!u.current)return;const t=u.current;return d.current.app=new YO({target:t,props:{config:i,forceMobile:a,videoAspectRatio:l,hideNav:!0,onGalleryReady:v,onEvent:g}}),()=>{var t;null===(t=d.current.app)||void 0===t||t.destroy()}}),[]),e.useEffect((()=>{d.current.app&&(d.current.app.props.config=i)}),[i]),e.useEffect((()=>{d.current.app&&(d.current.app.props.debug=r,d.current.app.props.forceMobile=a,d.current.app.props.videoAspectRatio=l,d.current.app.props.onEvent=g)}),[r,a,l,g]),e.useEffect((()=>{f.current=s,d.current.state&&(d.current.state.activeItemIndex===s.index&&d.current.state.activeModuleIndex===s.step||d.current.API.selectItemAndStep(s.index,s.step))}),[s]),h?e.createElement("div",R({style:{position:"relative",width:"100%",height:"100%"},ref:u},p.current?{dangerouslySetInnerHTML:{__html:p.current}}:{})):t.children}));JO.propTypes={className:Tt.string,config:Tt.object,variantId:Tt.string,onEvent:Tt.func,ssrHtml:Tt.string,videoAspectRatio:Tt.string,debug:Tt.bool,activeItem:Tt.shape({index:Tt.number,step:Tt.number}),forceMobile:Tt.bool,instanceId:Tt.string,children:Tt.node},JO.displayName="EkoGallerySvelte";const ZO=n("v2"),tP=n("v1"),eP="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{},nP=eP&&eP.performance,iP=nP&&"function"==typeof nP.now?()=>nP.now():()=>Date.now(),rP=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"}),oP=["ui-monospace,","SFMono-Regular,","Menlo,","Monaco,","Consolas,",'"Liberation Mono",','"Courier New",',"monospace"].join(" "),sP=`11px ${oP}`,aP=`12px ${oP}`;function lP(t){return"number"==typeof t&&Number.isFinite(t)}function cP(t){return lP(t)&&t>0}function uP(t){return lP(t)?Math.min(1,Math.max(0,t)):0}function dP(t,e=3){return lP(t)?t.toFixed(e):String(t)}function hP(t,e){const n=Number(t),i=Number(e);return!Number.isFinite(n)||!Number.isFinite(i)||n<=0||i<=0?"n/a":`${Math.round(n)}x${Math.round(i)}`}var fP=new WeakMap,pP=new WeakMap,mP=new WeakMap,vP=new WeakMap,gP=new WeakMap,yP=new WeakMap,bP=new WeakMap,kP=new WeakSet;class xP{constructor({width:t=220,height:e=48,windowMs:n=6e4,maxValue:i=60,autoScale:r=!1,formatValue:o}={}){O(this,kP),F(this,fP,void 0),F(this,pP,void 0),F(this,mP,[]),F(this,vP,void 0),F(this,gP,void 0),F(this,yP,void 0),F(this,bP,void 0);const s=null==eP?void 0:eP.document;if(!s||"function"!=typeof s.createElement)throw new Error("Debug overlay graph requires document.createElement.");C(fP,this,s.createElement("canvas")),M(fP,this).width=t,M(fP,this).height=e,M(fP,this).style.width=`${t}px`,M(fP,this).style.height=`${e}px`,M(fP,this).style.borderRadius="6px",M(fP,this).style.background="#111",C(pP,this,M(fP,this).getContext("2d")),C(vP,this,n),C(gP,this,i),C(yP,this,!!r),C(bP,this,"function"==typeof o?o:null)}get element(){return M(fP,this)}push(t,e){if(M(fP,this)&&M(pP,this)&&Number.isFinite(t)&&Number.isFinite(e)){for(M(mP,this).push({t:e,v:t});M(mP,this).length&&e-M(mP,this)[0].t>M(vP,this);)M(mP,this).shift();A(kP,this,wP).call(this)}}dispose(){C(mP,this,[]),C(pP,this,null),C(fP,this,null)}}function wP(){const t=M(pP,this),e=M(fP,this);if(!t||!e)return;const n=e.width,i=e.height;if(!n||!i)return;if(t.clearRect(0,0,n,i),t.fillStyle="#111",t.fillRect(0,0,n,i),!M(mP,this).length)return;const r=M(mP,this)[0].t;if(!(M(mP,this)[M(mP,this).length-1].t>r))return;const o=M(yP,this)?M(mP,this).reduce(((t,e)=>e.v>t?e.v:t),0):M(gP,this),s=o>0?o:M(gP,this);t.strokeStyle="#0f0",t.lineWidth=2,t.beginPath();for(let e=0;e<M(mP,this).length;e+=1){const o=M(mP,this)[e],a=(o.t-r)/M(vP,this)*n,l=i-(s>0?Math.min(1,Math.max(0,o.v/s)):0)*i;0===e?t.moveTo(a,l):t.lineTo(a,l)}t.stroke();const a=M(mP,this).length?M(mP,this)[M(mP,this).length-1]:null,l=Number.isFinite(null==a?void 0:a.v)?a.v:null;if(null===l)return;const c=M(bP,this)?M(bP,this).call(this,l):l.toFixed(1);if("string"!=typeof c||!c)return;t.font=sP,t.textAlign="right",t.textBaseline="top";const u=t.measureText(c),d=Math.ceil(u.width)+8,h=n-d-2;t.fillStyle="rgba(0,0,0,0.55)",t.fillRect(h,2,d,14),t.fillStyle="#fff",t.fillText(c,n-2-4,4)}const _P=new Intl.NumberFormat("en-US");function TP(t,e){const n=(null==t?void 0:t.trackId)||"",i=(null==e?void 0:e.trackId)||"";if(n!==i)return n<i?-1:1;const r=(null==t?void 0:t.nodeId)||"",o=(null==e?void 0:e.nodeId)||"";if(r!==o)return r<o?-1:1;const s=(null==t?void 0:t.segmentId)||"",a=(null==e?void 0:e.segmentId)||"";return s!==a?s<a?-1:1:("number"==typeof(null==t?void 0:t.presentationTime)?t.presentationTime:0)-("number"==typeof(null==e?void 0:e.presentationTime)?e.presentationTime:0)}function IP(t,e){for(t.push(e);t.length&&e-t[0]>1e3;)t.shift();if(t.length<2)return 0;const n=t[t.length-1]-t[0];return n<=0?0:1e3*(t.length-1)/n}function EP(t,e){if("function"!=typeof t||!e)return;const n=t(e.nodeId),i=null==n?void 0:n.tracks;if(!Array.isArray(i))return;const r=i.find((t=>(null==t?void 0:t.id)===e.trackId)),o=null==r?void 0:r.segments;return Array.isArray(o)?o.find((t=>(null==t?void 0:t.id)===e.segmentId)):void 0}function SP(t,e){var n;const i=EP(t,e);return(null==i?void 0:i.abrDecision)||(null==i||null===(n=i.chosenRepresentation)||void 0===n?void 0:n.abrDecision)}function AP(t){const e=Number(t);return!Number.isFinite(e)||e<=0?"n/a":`${_P.format(Math.round(e))}kbps`}function NP(t){const e=Number(t);return!Number.isFinite(e)||e<=0?"n/a":`${_P.format(Math.round(e/1e3))}kbps`}function MP(t,e=3){const n=Number(t);return Number.isFinite(n)?n.toLocaleString("en-US",{minimumFractionDigits:e,maximumFractionDigits:e}):String(t)}function FP(t,e){var n;if("function"!=typeof t||!e)return;const i=t(e.nodeId),r=null==i||null===(n=i.manifestRef)||void 0===n?void 0:n.encodeProfile;return"string"==typeof r&&r?r:void 0}function CP(t,e){if("function"!=typeof t||!e)return;const n=t(e.nodeId);return!0===(null==n?void 0:n.imageFallbackActive)?"image":void 0}function OP(t,e){const n=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}}}(null==e?void 0:e.frame)||{},i=Number.isFinite(null==e?void 0:e.width)?e.width:n.width,r=Number.isFinite(null==e?void 0:e.height)?e.height:n.height,o=function(t,e,n){return null===(n=EP(t,e))||void 0===n?void 0:n.chosenRepresentation}(t,e);if(!o)return lP(i)&&lP(r)?{width:i,height:r}:null;const s=o.width||o.codedWidth||i,a=o.height||o.codedHeight||r;return{id:o.id,codecs:o.codecs,mime:o.mime,bandwidth:o.bandwidth,width:s,height:a}}function PP(t){const e=Number(t);if(Number.isFinite(e)&&!(e<=0))return e/1e3}function RP(t,e){const n=Number(null==t?void 0:t.bandwidthKbps),i=Number(null==e?void 0:e.bandwidthKbps),r=Number.isFinite(n)&&n>0,o=Number.isFinite(i)&&i>0;if(r&&o&&n!==i)return n-i;if(r!==o)return r?-1:1;const s=(null==t?void 0:t.id)||"",a=(null==e?void 0:e.id)||"";return s===a?0:s<a?-1:1}function DP(t,e,n,i){const r=[];if(Array.isArray(null==i?void 0:i.availableRepresentations)&&i.availableRepresentations.forEach((t=>{const e="string"==typeof(null==t?void 0:t.id)&&t.id?t.id:void 0;if(!e)return;const n=Number(null==t?void 0:t.bandwidthKbps);r.push({id:e,bandwidthKbps:Number.isFinite(n)&&n>0?n:void 0})})),!r.length){const n=EP(t,e);(Array.isArray(null==n?void 0:n.representations)?n.representations:[]).forEach((t=>{const e="string"==typeof(null==t?void 0:t.id)&&t.id?t.id:void 0;e&&r.push({id:e,bandwidthKbps:PP(null==t?void 0:t.bandwidth)})}))}!r.length&&(null==n?void 0:n.id)&&r.push({id:n.id,bandwidthKbps:PP(n.bandwidth)});const o=new Map;return r.forEach((t=>{const e=null==t?void 0:t.id;e&&!o.has(e)&&o.set(e,t)})),Array.from(o.values()).sort(RP)}const LP=1024,BP=1048576,zP=1073741824;function WP(t){return lP(t)?t>=1e3?`${dP(t/1e3,1)} Mbps`:`${dP(t,1)} kbps`:"n/a"}function $P({downloadSpeed:t,downloadEvents:e}={}){const n=eP.document,i="function"==typeof(null==t?void 0:t.getKbps)?t.getKbps():void 0;let r=0;const{metricsRow:o,setInitial:s,setTotal:a}=function(t){const e=t.createElement("div");e.style.display="grid",e.style.gridTemplateColumns="1fr 1fr",e.style.gap="8px",e.style.font=aP;const n=t.createElement("div"),i=t.createElement("div");return e.appendChild(n),e.appendChild(i),{metricsRow:e,setInitial:t=>{n.textContent=`initial=${WP(t)}`},setTotal:t=>{var e;i.textContent="total="+(lP(e=t)?e<LP?`${Math.round(e)} B`:e<BP?`${dP(e/LP,1)} KB`:e<zP?`${dP(e/BP,2)} MB`:`${dP(e/zP,2)} GB`:"n/a")}}}(n),{graphWrap:l,speedGraph:c}=function(t,e){const n=t.createElement("div");n.style.marginTop="10px";const i=t.createElement("div");i.textContent="download speed",i.style.font=sP,i.style.opacity="0.9";const r=lP(e)&&e>0?e:1,o=new xP({autoScale:!0,maxValue:r,formatValue:WP});return n.appendChild(i),n.appendChild(o.element),{graphWrap:n,speedGraph:o}}(n,i);s(i),a(r);const u=t=>{const e=Number(null==t?void 0:t.kbps);Number.isFinite(e)&&c.push(e,null!=eP&&eP.performance&&"function"==typeof eP.performance.now?eP.performance.now():Date.now())},d=t=>{const e=Number(null==t?void 0:t.bytes);Number.isFinite(e)&&(r+=e,a(r))};return t&&"function"==typeof t.on&&t.on("download:speed",u),e&&"function"==typeof e.on&&e.on("download:sample",d),{id:"downloads",title:"Downloads",render:t=>{t.appendChild(o),t.appendChild(l)},dispose:()=>{t&&"function"==typeof t.off&&t.off("download:speed",u),e&&"function"==typeof e.off&&e.off("download:sample",d),c.dispose()}}}function UP(t){return lP(t)?dP(t,3):"n/a"}function jP(){return null!=eP&&eP.performance&&"function"==typeof eP.performance.now?eP.performance.now():Date.now()}const qP=18,VP="rgba(83,170,255,0.9)",GP={pending:"rgba(255,255,255,0.55)",resolving:"rgba(255,200,87,0.9)",ready:"rgba(102,214,141,0.9)",failed:"rgba(255,92,92,0.9)",missing:"rgba(160,160,160,0.9)"};function HP(t,e){if(cP(null==t?void 0:t.nodeDurationOverride))return t.nodeDurationOverride;if("function"!=typeof e)return null;const n=e(null==t?void 0:t.nodeId),i=null==n?void 0:n.duration;return cP(i)?i:null}function KP(t){const e=Number(null==t?void 0:t.duration);return e===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:cP(e)?e:null}function XP(t){return t===Number.POSITIVE_INFINITY}function YP(t){return lP(t)?String(t):""}function QP(t=[],e=[],n){const i=function(t=[],e){return Array.isArray(t)&&t.length?t.map((t=>t?["string"==typeof t.placementId?t.placementId:"","string"==typeof t.nodeId?t.nodeId:"",YP(t.offset),YP(HP(t,e)),!0===t.offsetPending?"1":"0",YP(t.nodeOffsetOverride),YP(t.nodeDurationOverride)].join("|"):"null")).join(";"):""}(t,n);return`${i}::${function(t=[]){return Array.isArray(t)&&t.length?t.map((t=>{if(!t)return"null";const e="string"==typeof t.renderPlacementId?t.renderPlacementId:"",n="string"==typeof t.type?t.type:"",i=YP(t.offset),r=KP(t);return[e,n,i,r===Number.POSITIVE_INFINITY?"inf":YP(r),!0===t.offsetPending?"1":"0"].join("|")})).join(";"):""}(e)}`}function JP(t=[],e){if(!Array.isArray(t)||!t.length)return!1;for(let n=0;n<t.length;n+=1){const i=t[n];if(!i||!0===i.offsetPending)continue;if(cP(i.nodeDurationOverride))continue;if("function"!=typeof e)return!0;const r=e(i.nodeId);if(!cP(null==r?void 0:r.duration))return!0}return!1}function ZP(t=[]){return!(!Array.isArray(t)||!t.length)&&t.some((t=>!0===(null==t?void 0:t.offsetPending)))}function tR(t=[],e=[]){return ZP(t)||ZP(e)}function eR(t,e=[],n){if(!t||!Array.isArray(e)||!e.length)return;const i=t.querySelector('[data-segment-boundary="true"]');e.forEach((e=>{if(!e||!lP(e.startRatio)||!lP(e.endRatio))return;const r=uP(e.startRatio),o=uP(e.endRatio);if(!(o>r))return;const s=eP.document.createElement("div");s.dataset.bufferedSegment="true",s.style.position="absolute",s.style.top="0",s.style.bottom="0",s.style.left=100*r+"%",s.style.width=100*(o-r)+"%",s.style.background=n,s.style.opacity="0.8",s.style.pointerEvents="none",s.style.zIndex="0",i?t.insertBefore(s,i):t.appendChild(s)}))}function nR(t,e){if(!t)return;const n=t.querySelector('[data-active-highlight="true"]');if(!e)return void(n&&n.remove());if(n)return;const i=eP.document.createElement("div");i.dataset.activeHighlight="true",i.style.position="absolute",i.style.top="0",i.style.bottom="0",i.style.left="0",i.style.right="0",i.style.border="1px solid rgba(255,255,255,0.9)",i.style.borderRadius="4px",i.style.pointerEvents="none",i.style.zIndex="1",t.appendChild(i)}function iR({timeline:t,getNode:e}={}){const n=null==eP?void 0:eP.document;if(!n||"function"!=typeof n.createElement)throw new Error("Debug overlay timeline tab requires document.createElement.");const i=n.createElement("div");i.style.display="flex",i.style.flexDirection="column",i.style.gap="8px",i.style.position="relative";const r=n.createElement("div");r.style.position="absolute",r.style.display="none",r.style.pointerEvents="none",r.style.zIndex="2",r.style.padding="4px 6px",r.style.borderRadius="6px",r.style.background="rgba(0,0,0,0.8)",r.style.border="1px solid rgba(255,255,255,0.2)",r.style.color="#fff",r.style.font=sP,r.style.maxWidth="220px",r.style.whiteSpace="nowrap",r.style.overflow="hidden",r.style.textOverflow="ellipsis";const o=n.createElement("div");o.dataset.timelineHoverDetails="true",o.style.position="absolute",o.style.display="none",o.style.pointerEvents="none",o.style.zIndex="3",o.style.padding="6px 8px",o.style.borderRadius="8px",o.style.background="rgba(0,0,0,0.85)",o.style.border="1px solid rgba(255,255,255,0.25)",o.style.color="#fff",o.style.font=sP,o.style.maxWidth="260px",o.style.flexDirection="column",o.style.gap="6px";const s=n.createElement("div");s.style.font=aP,s.style.opacity="0.95";const a=n.createElement("div");a.style.font=sP,a.style.opacity="0.7",a.style.textTransform="uppercase",a.style.marginTop="4px";const l=n.createElement("div");l.style.display="flex",l.style.flexDirection="column",l.style.gap="4px",o.appendChild(s),o.appendChild(a),o.appendChild(l);const c=n.createElement("div");c.style.display="flex",c.style.justifyContent="space-between",c.style.alignItems="center";const u=n.createElement("div");u.style.display="flex",u.style.alignItems="baseline",u.style.gap="10px";const d=n.createElement("div");d.style.font=aP,d.style.opacity="0.9";const h=n.createElement("div");h.style.font=sP,h.style.opacity="0.65",u.appendChild(d),u.appendChild(h);const f=n.createElement("label");f.style.display="inline-flex",f.style.alignItems="center",f.style.gap="6px",f.style.font=sP,f.style.cursor="pointer";const p=n.createElement("input");p.type="checkbox",p.checked=!1;const m=n.createElement("span");m.textContent="Click to seek",f.appendChild(p),f.appendChild(m),c.appendChild(u),c.appendChild(f);const v=n.createElement("div");function g(t,e,{alignTop:i=!1}={}){const r=n.createElement("div");r.style.display="grid",r.style.gridTemplateColumns="64px 1fr",r.style.alignItems=i?"start":"center",r.style.gap="8px";const o=n.createElement("div");o.textContent=t,o.style.font=sP,o.style.opacity="0.8",i&&(o.style.paddingTop="2px");const s=n.createElement("div");s.style.position="relative",s.style.borderRadius="6px",s.style.background="rgba(255,255,255,0.08)",s.style.overflow="hidden",e&&(s.dataset.timelineLane=e);const a=n.createElement("div");return a.style.position="absolute",a.style.top="0",a.style.bottom="0",a.style.width="2px",a.style.background="rgba(255,255,255,0.8)",s.appendChild(a),r.appendChild(o),r.appendChild(s),v.appendChild(r),{track:s,indicator:a}}v.style.display="grid",v.style.gridTemplateRows="auto auto",v.style.gap="8px",i.appendChild(c),i.appendChild(v),i.appendChild(r),i.appendChild(o);const y=g("Nodes","nodes",{alignTop:!0}),b=g("Render","render");let k=[],x=[],w=0,_=!1,T=1;const I=new Map,E=new Map,S=new Map,A=new Map;let N=new Set,M=null,F=!1,C="",O=!1,P=0,R=0,D=null;function L(t){for(;t.childNodes.length>1;)t.removeChild(t.lastChild)}function B(){D&&(clearTimeout(D),D=null)}function z(){return!!O||!!t&&(Array.isArray(t.placements)||Array.isArray(t.renderPlacements))}function W(){if(!t)return!1;const e=Array.isArray(t.placements),n=Array.isArray(t.renderPlacements);if(!e&&!n)return!1;const i=e?t.placements:[],r=n?t.renderPlacements:[];return(i.length!==P||r.length!==R)&&(et(i,r),!0)}function $(){if(!O)return!1;const t=QP(k,x,e);return t!==C&&(C=t,Q(),tt(),!0)}function U(){z()?D=function({shouldSchedule:t,isScheduled:e,intervalMs:n,onTick:i}){return e?null:setTimeout(i,n)}({shouldSchedule:!0,isScheduled:!!D,intervalMs:O?100:250,onTick:()=>{D=null,z()&&(W()||$()||U())}}):B()}function j(t,e){const n=e>0?w/e:0;t.style.left=100*uP(n)+"%",t.style.transform="translateX(-1px)"}function q(){r.style.display="none"}function V(t,e){if(!t)return void q();r.textContent=t,r.style.display="block";const n=i.getBoundingClientRect(),o=r.getBoundingClientRect(),s=((null==e?void 0:e.clientX)||0)-n.left+12,a=((null==e?void 0:e.clientY)||0)-n.top+12,l=n.width-o.width-8,c=n.height-o.height-8,u=Math.max(8,Math.min(s,l)),d=Math.max(8,Math.min(a,c));r.style.left=`${u}px`,r.style.top=`${d}px`}function G(){o.style.display="none"}function H(t,r){const c="function"==typeof e&&t?e(t):null,u=Array.isArray(null==c?void 0:c.children)?c.children:[];if(!u.length)return void G();if(s.textContent=t,a.textContent="children",function(){for(;l.firstChild;)l.removeChild(l.firstChild)}(),u.forEach((t=>{t&&t.nodeId&&l.appendChild(function(t){const i=n.createElement("div");i.style.display="grid",i.style.gridTemplateColumns="10px 1fr auto auto",i.style.alignItems="center",i.style.gap="6px";const r="string"==typeof(null==t?void 0:t.nodeId)?t.nodeId:"",o=cP(null==t?void 0:t.weight)?t.weight:1,s=function(t){if(!t||"function"!=typeof e)return"missing";const n=e(t);if(!n)return"missing";const i="string"==typeof n.state?n.state.trim().toLowerCase():"";return"pending"===i||"resolving"===i||"ready"===i||"failed"===i?i:"pending"}(r);i.dataset.childId=r,i.dataset.childStatus=s;const a=n.createElement("span");a.dataset.statusIndicator=s,a.style.width="8px",a.style.height="8px",a.style.borderRadius="999px",a.style.background=GP[s]||GP.pending,a.style.display="inline-block";const l=n.createElement("span");l.textContent=r||"unknown",l.style.overflow="hidden",l.style.textOverflow="ellipsis",l.style.whiteSpace="nowrap";const c=n.createElement("span");c.textContent=`w=${dP(o,0)}`,c.style.opacity="0.8";const u=n.createElement("span");return u.textContent=s,u.style.opacity="0.75",i.appendChild(a),i.appendChild(l),i.appendChild(c),i.appendChild(u),i}(t))})),!l.childNodes.length)return void G();o.style.display="flex";const d=i.getBoundingClientRect(),h=o.getBoundingClientRect(),f=((null==r?void 0:r.clientX)||0)-d.left+12,p=((null==r?void 0:r.clientY)||0)-d.top+12,m=d.width-h.width-8,v=d.height-h.height-8,g=Math.max(8,Math.min(f,m)),y=Math.max(8,Math.min(p,v));o.style.left=`${g}px`,o.style.top=`${y}px`}function K(){const e=w;if(t&&"function"==typeof t.getPlacementsActiveAtTime){const n=t.getPlacementsActiveAtTime(e),i=new Set(n.map((t=>null==t?void 0:t.placementId)).filter((t=>"string"==typeof t&&t.length)));N.forEach((t=>{i.has(t)||nR(S.get(t),!1)})),i.forEach((t=>{N.has(t)||nR(S.get(t),!0)})),N=i}else y.track.querySelectorAll('[data-timeline-item="nodes"]').forEach((t=>{const n="true"===t.dataset.hasDuration,i=Number(t.dataset.start),r=Number(t.dataset.end);nR(t,n&&lP(e)&&e>=i&&e<r)}));if(t&&"function"==typeof t.getActiveRenderPlacement){const n=t.getActiveRenderPlacement(e),i=null==n?void 0:n.renderPlacementId;M&&M!==i&&nR(A.get(M),!1),i&&M!==i&&nR(A.get(i),!0),M=i||null}else b.track.querySelectorAll('[data-timeline-item="render"]').forEach((t=>{const n="true"===t.dataset.hasDuration,i=Number(t.dataset.start),r=Number(t.dataset.end);nR(t,n&&lP(e)&&e>=i&&e<r)}))}function X(t){const n=HP(t,e);if(!cP(n)||"function"!=typeof e)return{boundaries:[],buffered:[]};const i=e(null==t?void 0:t.nodeId),r=function(t){const e=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];if(!e.length)return null;if(null!=t&&t.mainTrackId){const n=e.find((e=>(null==e?void 0:e.id)===t.mainTrackId));if(n)return n}return e.find((t=>Array.isArray(null==t?void 0:t.segments)&&t.segments.length))||null}(i);if(!r)return{boundaries:[],buffered:[]};const o=t=>{if(!t)return 0;const e=Number(null==t?void 0:t.bufferedRatio);if(Number.isFinite(e))return uP(e);const n=Number(null==t?void 0:t.retainedByteLength);if(!cP(n))return 0;const i=null==t?void 0:t.chosenRepresentation,r=cP(null==i?void 0:i.sizeBytes)?i.sizeBytes:null;return cP(r)?uP(n/r):1},s=Array.isArray(r.segments)?r.segments:[],a=lP(null==r?void 0:r.offset)?r.offset:0,l=lP(null==t?void 0:t.nodeOffsetOverride)?t.nodeOffsetOverride:0;if(!s.length){const t=null==i?void 0:i.buffered,e=lP(null==t?void 0:t.start)?t.start-l:0,r=lP(null==t?void 0:t.end)?t.end-l:0,o=Math.max(0,e),s=Math.min(n,r);return s>o?{boundaries:[],buffered:[{startRatio:o/n,endRatio:s/n}]}:{boundaries:[],buffered:[]}}if("image"===(null==r?void 0:r.type)){const t=s.find((t=>t&&!t.isInit))||s[0],e=t?o(t):0;return e>0?{boundaries:[],buffered:[{startRatio:0,endRatio:uP(e)}]}:{boundaries:[],buffered:[]}}return function(t,e,n,i,r){const o=[],s=[];let a=0;return t.forEach((t=>{if(null!=t&&t.isInit)return;lP(null==t?void 0:t.offset)&&(a=t.offset);const l=a;if(!lP(l))return;const c=lP(null==t?void 0:t.duration)?t.duration:0,u=n+l-i,d=n+(l+c)-i;u>0&&u<e&&o.push(u/e);const h="function"==typeof r?r(t):0;if(c>0&&d>0&&u<e&&h>0){const t=Math.max(0,u),n=Math.min(e,d);if(n>t){const i=t+(n-t)*uP(h);s.push({startRatio:t/e,endRatio:i/e})}}c>0&&(lP(null==t?void 0:t.offset)?a=t.offset+c:a+=c)})),{boundaries:o,buffered:s}}(s,n,a,l,o)}function Y(){const t=Array.isArray(k)?k:[],e=new Map(t.map((t=>[null==t?void 0:t.placementId,t])));for(const[t,n]of S.entries()){if(!t)continue;const i=e.get(t);i&&(n.querySelectorAll('[data-buffered-segment="true"]').forEach((t=>t.remove())),eR(n,X(i).buffered,VP))}}function Q(){const t=new Set(k.map((t=>null==t?void 0:t.nodeId)).filter((t=>"string"==typeof t&&t.length)));t.forEach((t=>{if(E.has(t))return;const n="function"==typeof e?e(t):null;if(!n||"function"!=typeof n.on)return;const i=t=>function(t={}){if(!t||t.isInit)return;const e=null==t?void 0:t.nodeId,n=null==t?void 0:t.segmentId,i=Number(null==t?void 0:t.loaded),r=Number(null==t?void 0:t.total);if(!e||!n||!lP(i))return;const o=`${e}:${n}`,s=I.get(o)||{},a={loaded:Math.max(lP(s.loaded)?s.loaded:0,i),total:cP(r)?r:s.total};I.set(o,a),function(){if(F)return;F=!0;const t=null==eP?void 0:eP.requestAnimationFrame;"function"!=typeof t?((null==eP?void 0:eP.setTimeout)||setTimeout)((()=>{F=!1,Y()}),0):t((()=>{F=!1,Y()}))}()}(t);n.on("segment:chunk",i),E.set(t,{node:n,handler:i})}));for(const[e,n]of E.entries())t.has(e)||(null!=n&&n.node&&"function"==typeof n.node.off&&n.node.off("segment:chunk",n.handler),E.delete(e))}function J({track:t,color:e,start:i,duration:r,startTime:o,durationSeconds:s,segmentRatios:a,bufferedSegments:l,placementId:c,nodeId:u,label:d,rowIndex:h=0,rowHeight:f=18,rowGap:p=0,laneId:m,isClickable:v,isActive:g,tooltip:y,hoverDetailsNodeId:b,showLabel:k,onClick:x}){const w=n.createElement("div");var _,T;T=e,(_=w).style.position="absolute",_.style.borderRadius="4px",_.style.background=T,_.style.opacity="0.9",_.style.font=sP,_.style.color="#fff",_.style.display="flex",_.style.alignItems="center",_.style.whiteSpace="nowrap",_.style.overflow="hidden",_.style.textOverflow="ellipsis",function(t,{startRatio:e,durationRatio:n,rowIndex:i=0,rowHeight:r=18,rowGap:o=0}={}){const s=i*(r+o)+2,a=Math.max(1,r-4);t.style.top=`${s}px`,t.style.height=`${a}px`;const l=uP(e);if(cP(n)){const e=Math.max(0,Math.min(n,1-l));return t.style.left=100*l+"%",t.style.width=100*e+"%",void(t.style.padding="0 4px")}t.style.left=100*l+"%",t.style.width="2px",t.style.padding="0"}(w,{startRatio:i,durationRatio:r,rowIndex:h,rowHeight:f,rowGap:p}),function(t,{laneId:e,label:n,isClickable:i,shouldShowLabel:r,onClick:o}={}){if(e&&(t.dataset.timelineItem=e),r&&n){const e=eP.document.createElement("span");e.textContent=n,e.style.position="relative",e.style.zIndex="2",e.style.pointerEvents="none",t.appendChild(e)}i&&(t.style.cursor="pointer"),"function"==typeof o&&t.addEventListener("click",o)}(w,{laneId:m,label:d,isClickable:v,shouldShowLabel:"boolean"==typeof k?k:cP(r),onClick:x}),y&&(w.title=y),lP(o)&&(w.dataset.start=String(o)),cP(s)||XP(s)?(w.dataset.end=String(o+s),w.dataset.hasDuration="true"):(w.dataset.end="",w.dataset.hasDuration="false"),c&&(w.dataset.placementId=c),u&&(w.dataset.nodeId=u),w.style.pointerEvents="auto",eR(w,l,VP),function(t,e=[]){t&&Array.isArray(e)&&e.length&&e.forEach((e=>{if(!lP(e)||e<=0||e>=1)return;const n=eP.document.createElement("div");n.dataset.segmentBoundary="true",n.style.position="absolute",n.style.top="2px",n.style.bottom="2px",n.style.width="1px",n.style.left=100*uP(e)+"%",n.style.transform="translateX(-0.5px)",n.style.background="rgba(255,255,255,0.35)",n.style.pointerEvents="none",n.style.zIndex="1",t.appendChild(n)}))}(w,a),nR(w,g),y&&(w.addEventListener("mouseenter",(t=>V(y,t))),w.addEventListener("mousemove",(t=>V(y,t))),w.addEventListener("mouseleave",q)),b&&(w.addEventListener("mouseenter",(t=>H(b,t))),w.addEventListener("mousemove",(t=>H(b,t))),w.addEventListener("mouseleave",G)),t.appendChild(w),"nodes"===m&&c?S.set(c,w):"render"===m&&c&&A.set(c,w)}function Z(){let t=0;const n=Array.isArray(k)?k:[],i=Array.isArray(x)?x.filter((t=>!0!==(null==t?void 0:t.offsetPending))):[];return n.forEach((n=>{if(!0===(null==n?void 0:n.offsetPending))return;const i=lP(null==n?void 0:n.offset)?n.offset:void 0;if(!lP(i))return;const r=HP(n,e);t=cP(r)?Math.max(t,i+r):Math.max(t,i)})),i.forEach((e=>{const n=lP(null==e?void 0:e.offset)?e.offset:0,i=KP(e);t=cP(i)?Math.max(t,n+i):Math.max(t,n)})),cP(t)?t:1}function tt(){const n=Z();T=n,d.textContent=`t=${dP(w)}s`,h.textContent=`range=0-${dP(n)}s`,q(),G(),L(y.track),L(b.track),S.clear(),A.clear(),N=new Set,M=null,F=!1;const i=Array.isArray(k)?k:[],r=Array.isArray(x)?x:[],o=function(n){const i=(Array.isArray(n)?n.slice():[]).map((t=>{if(!0===(null==t?void 0:t.offsetPending))return null;const n=lP(null==t?void 0:t.offset)?t.offset:void 0;if(!lP(n))return null;const i=HP(t,e);return{placement:t,offset:n,duration:i,end:cP(i)?n+i:n,rowIndex:0}})).filter(Boolean).sort(((t,e)=>{var n,i,r,o;const s=t.offset-e.offset;if(0!==s)return s;const a="string"==typeof(null===(n=t.placement)||void 0===n?void 0:n.nodeId)?t.placement.nodeId:"",l="string"==typeof(null===(i=e.placement)||void 0===i?void 0:i.nodeId)?e.placement.nodeId:"";if(a!==l)return a.localeCompare(l);const c="string"==typeof(null===(r=t.placement)||void 0===r?void 0:r.placementId)?t.placement.placementId:"",u="string"==typeof(null===(o=e.placement)||void 0===o?void 0:o.placementId)?e.placement.placementId:"";return c.localeCompare(u)})),r=[],o=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);return i.forEach((t=>{const e=t.offset,n=lP(t.end)?t.end:e;let i=-1;for(let t=0;t<r.length;t+=1)if(r[t]<=e+o){i=t;break}-1===i?(i=r.length,r.push(n)):r[i]=Math.max(r[i],n),t.rowIndex=i})),{items:i,rowCount:Math.max(1,r.length)}}(i);var s;!function(t){const e=t.rowCount*qP+4*(t.rowCount-1);y.track.style.height=`${e}px`,b.track.style.height="18px",y.track.style.cursor=_?"pointer":"default",y.track.style.pointerEvents="auto",b.track.style.pointerEvents="auto"}(o),s=n,o.items.forEach((t=>{const e=t.placement,n=t.offset,i=t.duration,r=(null==e?void 0:e.nodeId)||(null==e?void 0:e.placementId)||"node",o=!!lP(w)&&w>=n&&(!cP(i)||w<n+i),a=X(e);J({track:y.track,color:"rgba(255,255,255,0.16)",start:uP(n/s),duration:cP(i)?uP(i/s):null,startTime:n,durationSeconds:i,segmentRatios:a.boundaries,bufferedSegments:a.buffered,placementId:null==e?void 0:e.placementId,nodeId:null==e?void 0:e.nodeId,label:r,rowIndex:t.rowIndex,rowHeight:qP,rowGap:4,laneId:"nodes",isClickable:_,isActive:o,tooltip:(null==e?void 0:e.nodeId)||(null==e?void 0:e.placementId),hoverDetailsNodeId:null==e?void 0:e.nodeId})})),function(t,e){t.forEach((t=>{const n=lP(null==t?void 0:t.offset)?t.offset:void 0;if(!lP(n))return;const i=KP(t),r=XP(i),o=(null==t?void 0:t.type)||(null==t?void 0:t.renderPlacementId)||"render",s=function(t){const e="string"==typeof t?t.trim().toLowerCase():"";return"switch"===e||"switching"===e||"switchingrendernode"===e}(null==t?void 0:t.type),a=s?()=>{"function"==typeof(null==eP?void 0:eP.switchTo)&&eP.switchTo("next")}:void 0;let l=!1;lP(w)&&(r?l=w>=n:cP(i)&&(l=w>=n&&w<n+i));const c=r&&cP(e)?uP((e-n)/e):cP(i)?uP(i/e):null;J({track:b.track,color:"rgba(248,162,62,0.9)",start:uP(n/e),duration:c,startTime:n,durationSeconds:i,label:o,placementId:null==t?void 0:t.renderPlacementId,rowIndex:0,rowHeight:qP,rowGap:0,laneId:"render",isClickable:!!s,isActive:l,tooltip:(null==t?void 0:t.type)||(null==t?void 0:t.renderPlacementId),showLabel:cP(i)||r,onClick:a})}))}(r,n),j(y.indicator,n),j(b.indicator,n),K(),Y(),O=tR(k,x)||JP(k,e),C=O?QP(k,x,e):"",P=Array.isArray(k)?k.length:0,R=Array.isArray(x)?x.length:0,U()}function et(t,n){k=Array.isArray(t)?t.slice():[],x=Array.isArray(n)?n.slice():[],O=tR(k,x)||JP(k,e),Q(),tt()}return p.addEventListener("change",(()=>{_=p.checked,tt()})),y.track.addEventListener("click",(e=>{!function(e,n,i){if(!_||!t)return;if(!cP(n)||!i)return;const r="function"==typeof i.getBoundingClientRect?i.getBoundingClientRect():null,o=cP(null==r?void 0:r.width)?r.width:i.clientWidth;if(!cP(o))return;const s=lP(null==r?void 0:r.left)?r.left:0,a=uP(((lP(null==e?void 0:e.clientX)?e.clientX:0)-s)/o)*n;lP(a)&&(t.currentTime=a)}(e,Z(),y.track)})),{id:"timeline",title:"Timeline",render:t=>{t.appendChild(i),tt()},updatePlacements:et,updateTime:function(t){if(w=lP(t)?t:w,W())return;if(O&&$())return;const e=T;lP(e)&&(d.textContent=`t=${dP(w)}s`,h.textContent=`range=0-${dP(e)}s`,j(y.indicator,e),j(b.indicator,e),K())},refresh:()=>tt(),dispose:()=>{B();for(const t of E.values())(null==t?void 0:t.node)&&"function"==typeof t.node.off&&t.node.off("segment:chunk",t.handler);E.clear(),I.clear()}}}const rR=1024,oR=1048576,sR=1073741824;function aR(t){return lP(t)?t<rR?`${Math.round(t)} B`:t<oR?`${dP(t/rR,1)} KB`:t<sR?`${dP(t/oR,2)} MB`:`${dP(t/sR,2)} GB`:"n/a"}const lR="ekoplayer-debug-overlay";var cR=new WeakMap,uR=new WeakMap,dR=new WeakMap,hR=new WeakMap,fR=new WeakSet;class pR{constructor({tabBarEl:t,contentEl:e}){O(this,fR),F(this,cR,[]),F(this,uR,void 0),F(this,dR,void 0),F(this,hR,void 0),C(dR,this,t),C(hR,this,e)}registerTab(t){t&&"string"==typeof t.id&&"string"==typeof t.title&&"function"==typeof t.render&&(M(cR,this).some((e=>e.id===t.id))||(M(cR,this).push(t),A(fR,this,mR).call(this),M(uR,this)||this.selectTab(t.id)))}selectTab(t){M(cR,this).find((e=>e.id===t))&&(C(uR,this,t),A(fR,this,mR).call(this),A(fR,this,vR).call(this))}dispose(){M(dR,this)&&(M(dR,this).innerHTML=""),M(hR,this)&&(M(hR,this).innerHTML=""),C(cR,this,[]),C(dR,this,null),C(hR,this,null)}}function mR(){const t=M(dR,this);t&&(t.innerHTML="",M(cR,this).forEach((e=>{const n=eP.document.createElement("button");n.type="button",n.textContent=e.title,n.style.cursor="pointer",n.style.padding="6px 10px",n.style.borderRadius="6px",n.style.border="1px solid rgba(255,255,255,0.2)",n.style.background=e.id===M(uR,this)?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.2)",n.style.color="#fff",n.style.font=aP,n.addEventListener("click",(()=>this.selectTab(e.id))),t.appendChild(n)})))}function vR(){const t=M(hR,this);if(!t)return;t.innerHTML="";const e=M(cR,this).find((t=>t.id===M(uR,this)));e&&e.render(t)}function gR({mountElement:t,canvasElement:e,timeline:n,getNode:i,listNodes:r,downloadSpeed:o,downloadEvents:s,qoe:a,qoeEvents:l,options:c={},playbackStartedAtMs:u,playerVersion:d}={}){if(!t)throw new Error("Debug overlay requires mountElement.");if(!n||"function"!=typeof n.on)throw new Error("Debug overlay requires a Timeline with .on/.off.");!function(t){if(!t||!t.style)return;const e=null==eP?void 0:eP.window,n=e&&"function"==typeof e.getComputedStyle?e.getComputedStyle(t):null,i=n?n.position:t.style.position;i&&"static"!==i||(t.style.position="relative")}(t);const h=eP.document.getElementById(lR);h&&h.parentNode&&h.parentNode.removeChild(h);const f=function({mountElement:t,playerVersion:e}){const n=null==eP?void 0:eP.document;if(!n||"function"!=typeof n.createElement)throw new Error("Debug overlay requires document.createElement.");const i=n.createElement("div");i.id=lR,i.style.position="absolute",i.style.inset="0",i.style.zIndex="999999",i.style.pointerEvents="none";const r=n.createElement("div");r.style.position="absolute",r.style.top="8px",r.style.left="8px",r.style.width="460px",r.style.maxWidth="calc(100% - 16px)",r.style.background="rgba(0,0,0,0.65)",r.style.border="1px solid rgba(255,255,255,0.18)",r.style.borderRadius="10px",r.style.padding="10px",r.style.color="#fff",r.style.pointerEvents="auto",r.style.backdropFilter="blur(6px)";const o=n.createElement("div");o.style.display="flex",o.style.justifyContent="space-between",o.style.alignItems="center",o.style.gap="10px";const s=n.createElement("div");s.textContent="EkoPlayer Debug",s.style.font="600 13px ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial";const a=n.createElement("button");a.type="button",a.textContent="Hide",a.style.cursor="pointer",a.style.padding="6px 10px",a.style.borderRadius="8px",a.style.border="1px solid rgba(255,255,255,0.2)",a.style.background="rgba(0,0,0,0.2)",a.style.color="#fff",o.appendChild(s),o.appendChild(a);const l=n.createElement("div");l.style.display="flex",l.style.gap="8px",l.style.marginTop="10px";const c=n.createElement("div");c.style.marginTop="10px";const u=n.createElement("div");u.style.marginTop="10px",u.style.font=sP,u.style.display="flex",u.style.justifyContent="space-between",u.style.alignItems="center",u.style.gap="10px";const d=n.createElement("div");d.style.color="rgba(140, 224, 255, 0.9)",d.textContent="Playback started @ --";const h=n.createElement("div");h.style.opacity="0.7",h.style.marginLeft="auto",h.textContent=e?`version ${e}`:"version n/a",u.appendChild(d),u.appendChild(h);const f=n.createElement("button");return f.type="button",f.textContent="Debug",f.style.position="absolute",f.style.top="8px",f.style.left="8px",f.style.cursor="pointer",f.style.padding="6px 10px",f.style.borderRadius="10px",f.style.border="1px solid rgba(255,255,255,0.25)",f.style.background="rgba(0,0,0,0.55)",f.style.color="#fff",f.style.pointerEvents="auto",f.style.display="none",r.appendChild(o),r.appendChild(l),r.appendChild(c),r.appendChild(u),i.appendChild(r),i.appendChild(f),t.appendChild(i),{overlayRoot:i,panel:r,tabBar:l,content:c,hideBtn:a,showBtn:f,footerPlayback:d}}({mountElement:t,playerVersion:d||(null==c?void 0:c.playerVersion)}),p=new pR({tabBarEl:f.tabBar,contentEl:f.content});let m=!0;function v(){m=!1,f.panel.style.display="none",f.showBtn.style.display="inline-block"}function g(){m=!0,f.panel.style.display="block",f.showBtn.style.display="none"}f.hideBtn.addEventListener("click",v),f.showBtn.addEventListener("click",g);const y=iR({timeline:n,getNode:i}),b=function({getNode:t}){const e=eP.document,n=e.createElement("pre");n.style.margin="0",n.style.whiteSpace="pre-wrap",n.style.font=aP,n.style.lineHeight="1.35";const i=e.createElement("div");i.style.display="flex",i.style.flexDirection="column",i.style.gap="8px",i.style.marginTop="6px";const r=e.createElement("div");r.style.display="flex",r.style.gap="10px",r.style.marginTop="10px",r.style.alignItems="center",r.style.flexWrap="wrap";const o=new xP({maxValue:60}),s=new xP({maxValue:60}),a=e.createElement("div"),l=e.createElement("div");l.textContent="browserfps",l.style.font=sP,l.style.opacity="0.9",a.appendChild(l),a.appendChild(o.element);const c=e.createElement("div"),u=e.createElement("div");return u.textContent="fps",u.style.font=l.style.font,u.style.opacity="0.9",c.appendChild(u),c.appendChild(s.element),r.appendChild(a),r.appendChild(c),{id:"frames",title:"Frames",render:t=>{t.appendChild(n),t.appendChild(i),t.appendChild(r)},pushBrowserFps:(t,e)=>o.push(t,e),pushVisualFps:(t,e)=>s.push(t,e),updateInfo:function({time:r,entries:o}){const s=Array.isArray(o)?o.slice().sort(TP):[];if(!s.length)return n.textContent="",void(i.innerHTML="");n.textContent=`t=${MP(r)}s tracks=${s.length}`,i.innerHTML="";for(let n=0;n<s.length;n+=1){const r=s[n],o=OP(t,r),a=(null==o?void 0:o.id)||"n/a",l=(null==o?void 0:o.codecs)||(null==o?void 0:o.mime)||"n/a",c=NP(null==o?void 0:o.bandwidth),u=hP(null==o?void 0:o.width,null==o?void 0:o.height),d=FP(t,r)||"n/a",h=CP(t,r),f=h?` fallback=${h}`:"",p=SP(t,r),m=(null==p?void 0:p.strategy)||"n/a",v=(null==p?void 0:p.decisionReason)||"n/a",g=AP(null==p?void 0:p.measuredDownloadSpeedKbps),y=AP(null==p?void 0:p.safeBandwidthKbps),b=e.createElement("div");b.style.display="flex",b.style.flexDirection="column",b.style.gap="2px";const k=e.createElement("pre");k.style.margin="0",k.style.whiteSpace="pre-wrap",k.style.font=aP,k.style.lineHeight="1.35",k.textContent=[`${(null==r?void 0:r.nodeId)||"?"} ${(null==r?void 0:r.trackId)||"?"} ${(null==r?void 0:r.segmentId)||"?"} pts=${MP(null==r?void 0:r.presentationTime)}s`,`rep=${a} encodeProfile=${d}${f} res=${u} codec=${l} repBW=${c}`,`abr=strategy:${m} reason:${v} measuredBW:${g} safeBW:${y}`].join("\n"),b.appendChild(k);const x=(null==p?void 0:p.selectedRepresentationId)||(null==o?void 0:o.id),w=DP(t,r,o,p);if(w.length){const t=e.createElement("div");t.style.display="flex",t.style.alignItems="center",t.dataset.abrLadderRow="true",t.dataset.trackId=(null==r?void 0:r.trackId)||"",t.dataset.segmentId=(null==r?void 0:r.segmentId)||"";const n=e.createElement("div");n.style.display="inline-flex",n.style.alignItems="center",n.style.gap="2px",n.dataset.abrLadder="true",w.forEach((t=>{const i=e.createElement("span"),r=!!x&&t.id===x;i.dataset.abrLadderBlock="true",i.dataset.repId=t.id||"",i.dataset.selected=r?"true":"false",i.style.display="inline-block",i.style.width="10px",i.style.height="8px",i.style.borderRadius="2px",i.style.border="1px solid rgba(255,255,255,0.35)",i.style.background=r?"rgba(74, 222, 128, 0.95)":"rgba(156, 163, 175, 0.55)",i.title=`${t.id||"?"} ${AP(t.bandwidthKbps)}`,n.appendChild(i)})),t.appendChild(n),b.appendChild(t)}i.appendChild(b)}},dispose:()=>{o.dispose(),s.dispose()}}}({getNode:i}),k=$P({downloadSpeed:o,downloadEvents:s}),x=function({qoe:t,qoeEvents:e}={}){const n=null==eP?void 0:eP.document;if(!n||"function"!=typeof n.createElement)throw new Error("Debug overlay QoE tab requires document.createElement.");const i=n.createElement("pre");i.style.margin="0",i.style.whiteSpace="pre-wrap",i.style.font=aP;const{graphWrap:r,graph:o}=function(t){const e=t.createElement("div");e.style.marginTop="10px";const n=t.createElement("div");n.textContent="qoe score",n.style.font=sP,n.style.opacity="0.9";const i=new xP({maxValue:1,windowMs:3e4,formatValue:t=>UP(t)});return e.appendChild(n),e.appendChild(i.element),{graphWrap:e,graph:i}}(n);let s=null;const a=()=>{i.textContent=function(t){if(!t)return"QoE unavailable";const e="string"==typeof t.status?t.status:"n/a";return[`score=${UP(t.score)}`,`status=${e}`,`streamQualityScore=${UP(t.streamQualityScore)}`,`fpsScore=${UP(t.fpsScore)}`,`browserFps=${UP(t.browserFps)}`,`waitingSeconds=${UP(t.waitingSeconds)}`,`playingSeconds=${UP(t.playingSeconds)}`].join("\n")}(t)},l=()=>{if(!t)return;const e=Number(t.score);Number.isFinite(e)&&o.push(e,jP())},c=t=>{const e=Number(t);Number.isFinite(e)&&o.push(e,jP()),a()},u=()=>{a()};if(a(),l(),e&&"function"==typeof e.on&&(e.on("qoescore",c),e.on("qoestatus",u)),t){const t="function"==typeof(null==eP?void 0:eP.setInterval)?eP.setInterval:setInterval;s=t((()=>{l(),a()}),1e3)}return{id:"qoe",title:"QoE",render:t=>{t.appendChild(i),t.appendChild(r)},dispose:()=>{e&&"function"==typeof e.off&&(e.off("qoescore",c),e.off("qoestatus",u)),s&&(("function"==typeof(null==eP?void 0:eP.clearInterval)?eP.clearInterval:clearInterval)(s),s=null),o.dispose()}}}({qoe:a,qoeEvents:l}),w=function({timeline:t,getNode:e,listNodes:n,options:i}={}){const r=null==eP?void 0:eP.document;if(!r||"function"!=typeof r.createElement)throw new Error("Debug overlay Memory tab requires document.createElement.");const o=r.createElement("pre");o.style.margin="0",o.style.whiteSpace="pre-wrap",o.style.font=aP;const s=r.createElement("div");s.textContent="nodes",s.style.marginTop="10px",s.style.font=sP,s.style.opacity="0.9";const a=r.createElement("pre");a.style.margin="6px 0 0 0",a.style.whiteSpace="pre-wrap",a.style.font=aP;let l=null;const c=()=>{const r=function({timeline:t,getNode:e,listNodes:n}){const i=[];let r=0;if("function"==typeof n){let t;try{t=n()}catch(e){t=null}if(Array.isArray(t))return t.forEach((t=>{const e=null==t?void 0:t.id;if("string"!=typeof e||!e.length)return;const n=Number(null==t?void 0:t.retainedByteLength);Number.isFinite(n)&&(r+=n,i.push({nodeId:e,bytes:n}))})),i.sort(((t,e)=>e.bytes-t.bytes)),{totalBytes:r,nodes:i,available:!0}}if(!t||"function"!=typeof e)return{totalBytes:0,nodes:[],available:!1};const o=Array.isArray(t.placements)?t.placements:[];return new Set(o.map((t=>null==t?void 0:t.nodeId)).filter((t=>"string"==typeof t&&t.length))).forEach((t=>{const n=e(t),o=Number(null==n?void 0:n.retainedByteLength);Number.isFinite(o)&&(r+=o,i.push({nodeId:t,bytes:o}))})),i.sort(((t,e)=>e.bytes-t.bytes)),{totalBytes:r,nodes:i,available:!0}}({timeline:t,getNode:e,listNodes:n}),s=function({timeline:t}){if(!t||"function"!=typeof t.getDecodedFrameStats)return{totalBytes:0,frames:0,available:!1};try{const e=t.getDecodedFrameStats(),n=Number(null==e?void 0:e.totalBytes),i=Number(null==e?void 0:e.frames);return{totalBytes:Number.isFinite(n)?n:0,frames:Number.isFinite(i)?i:0,available:!1!==(null==e?void 0:e.available)}}catch(t){return{totalBytes:0,frames:0,available:!1}}}({timeline:t}),l=function(t,e,n,i){const r=Number(null!==(n=null==t||null===(i=t.publicOptions)||void 0===i?void 0:i.segmentEvictionMaxRetainedBytes)&&void 0!==n?n:null==t?void 0:t.segmentEvictionMaxRetainedBytes),o=lP(r)&&r>=0,s=o?aR(r):"n/a";return{active:o&&lP(e)&&e>r,thresholdLabel:s}}(i,r.available?r.totalBytes:NaN),c=l.active?"on":"off",u=s.available?aR(s.totalBytes):"n/a",d=s.available?s.frames:"n/a";if(!r.available)return o.textContent=[`decoded=${u} decodedFrames=${d}`,`retained=n/a eviction=${c} threshold=${l.thresholdLabel}`].join("\n"),void(a.textContent="");if(o.textContent=[`decoded=${u} decodedFrames=${d}`,[`retained=${aR(r.totalBytes)}`,`nodes=${r.nodes.length}`,`eviction=${c}`,`threshold=${l.thresholdLabel}`].join(" ")].join("\n"),!r.nodes.length)return void(a.textContent="none");const h=r.nodes.slice(0,8).map((t=>`${t.nodeId}: ${aR(t.bytes)}`));a.textContent=h.join("\n")};c();const u="function"==typeof(null==eP?void 0:eP.setInterval)?eP.setInterval:setInterval;return l=u(c,1e3),{id:"memory",title:"Memory",render:t=>{t.appendChild(o),t.appendChild(s),t.appendChild(a)},refresh:c,dispose:()=>{l&&(("function"==typeof(null==eP?void 0:eP.clearInterval)?eP.clearInterval:clearInterval)(l),l=null)}}}({timeline:n,getNode:i,listNodes:r,options:c});p.registerTab(y),p.registerTab(b),p.registerTab(k),p.registerTab(x),p.registerTab(w),p.registerTab(function({options:t}={}){const e=null==eP?void 0:eP.document;if(!e||"function"!=typeof e.createElement)throw new Error("Debug overlay options tab requires document.createElement.");const n=e.createElement("pre");n.style.margin="0",n.style.font=aP,n.style.whiteSpace="pre-wrap",n.style.wordBreak="break-word";const i=null==t?void 0:t.publicOptions,r=i&&"object"==typeof i?Object.keys(i):[];if(r.length){const t=r.map((t=>`${t}=${function(t){if(null===t)return"null";if(void 0===t)return"undefined";const e=typeof t;if("string"===e)return t;if("number"===e||"boolean"===e)return String(t);try{return JSON.stringify(t)}catch(e){return String(t)}}(i[t])}`));n.textContent=t.join("\n")}else n.textContent="publicOptions unavailable";return{id:"options",title:"Options",render:t=>{t.appendChild(n)}}}({options:c}));const _=[],T=[];let I=0,E=0,S=null,A=!1,N=0,M=null;function F(t){const e=Number(t);Number.isFinite(e)&&(e-N<250||(N=e,b.pushBrowserFps(I,e),b.pushVisualFps(E,e)))}eP.window&&"function"==typeof eP.window.requestAnimationFrame&&(S=eP.window.requestAnimationFrame((function t(e){A||(I=IP(_,e),F(e),S=eP.window.requestAnimationFrame(t))})));const C=(t={})=>{if(A||!m)return;const e=Array.isArray(t.frames)?t.frames:[];if(!e.length)return void(M=null);const n=null!=eP&&eP.performance&&"function"==typeof eP.performance.now?eP.performance.now():Date.now(),i=e.map((t=>`${null==t?void 0:t.nodeId}:${null==t?void 0:t.trackId}:${null==t?void 0:t.segmentId}@${null==t?void 0:t.presentationTime}`)).join("|");i!==M&&(E=IP(T,n),M=i),b.updateInfo({time:t.time,entries:e}),F(n)};let O=Number.isFinite(u)?u:void 0;if(Number.isFinite(O)&&f.footerPlayback){const t=O/1e3;f.footerPlayback.textContent=`Playback started @ ${dP(t)}s`}const P=(t={})=>{if(!A&&void 0===O&&"playing"===(null==t?void 0:t.event)&&(O=iP(),f.footerPlayback)){const t=O/1e3;f.footerPlayback.textContent=`Playback started @ ${dP(t)}s`}},R=()=>{const t=Array.isArray(null==n?void 0:n.placements)?n.placements:[],e=Array.isArray(null==n?void 0:n.renderPlacements)?n.renderPlacements:[];y.updatePlacements(t,e)},D=(t={})=>{if(A)return;const e=Number.isFinite(null==t?void 0:t.time)?t.time:null==n?void 0:n.currentTime;y.updateTime(e),w&&"function"==typeof w.refresh&&w.refresh()},L=()=>{A||R()},B=()=>{A||R()},z=null==n?void 0:n.trackBuffers,W=()=>{A||("function"==typeof y.refresh?y.refresh():R(),w&&"function"==typeof w.refresh&&w.refresh())};return n.on(rP.VISUAL_FRAMES_AVAILABLE,C),n.on(rP.TIMELINE_TIME_UPDATE,D),n.on(rP.PLACEMENT_ADDED,L),n.on(rP.RENDER_PLACEMENT_ADDED,B),n.on(rP.TIMELINE_PLAYER_STATE,P),z&&"function"==typeof z.on&&z.on("track:bufferupdate",W),R(),y.updateTime(null==n?void 0:n.currentTime),{show:g,hide:v,dispose:function(){A||(A=!0,S&&eP.window&&"function"==typeof eP.window.cancelAnimationFrame&&eP.window.cancelAnimationFrame(S),S=null,n&&"function"==typeof n.off&&(n.off(rP.VISUAL_FRAMES_AVAILABLE,C),n.off(rP.TIMELINE_TIME_UPDATE,D),n.off(rP.PLACEMENT_ADDED,L),n.off(rP.RENDER_PLACEMENT_ADDED,B),n.off(rP.TIMELINE_PLAYER_STATE,P)),z&&"function"==typeof z.off&&z.off("track:bufferupdate",W),b&&"function"==typeof b.dispose&&b.dispose(),y&&"function"==typeof y.dispose&&y.dispose(),k&&"function"==typeof k.dispose&&k.dispose(),x&&"function"==typeof x.dispose&&x.dispose(),w&&"function"==typeof w.dispose&&w.dispose(),p.dispose(),f.overlayRoot&&f.overlayRoot.parentNode&&f.overlayRoot.parentNode.removeChild(f.overlayRoot))},registerTab:function(t){p.registerTab(t)},selectTab:function(t){p.selectTab(t)}}}var yR=Object.freeze({__proto__:null,createDebugOverlay:gR,default:gR});exports.EkoGallery=JO,exports.EkoGalleryLegacy=nn,exports.ekoWebPixel=S,exports.getEkoAnalyticsSnippet=function(t){return`if (!window.EkoAnalytics) {\n !function () {\n var t, a, e, s, n;\n 'undefined' == typeof window || window.EkoAnalytics || (t = window, a = 'EkoAnalytics', e = document, s = 'script', t[a] || (t[a] = function () {\n t[a].f ? (t[a].q.push(arguments), t[a].ts.push(Date.now())) : t[a].apply(t, arguments);\n }, t[a].f = !0, t[a].q = t[a].q || [], t[a].ts = t[a].ts || [], t[a].t = Number(new Date), t[a].sa = [], t[a].cb = [], t[a].init = function (ids) {\n t[a].id = ids;\n }, t[a].childRequestIdsCallback = function (e) {\n e.data && 'ea-ids-request' === e.data.type && t[a].sa.push(e.source);\n }, t.addEventListener('message', t[a].childRequestIdsCallback)));\n }();\n\n window.EkoAnalytics.cb.push(() => {\n let setCookie = (key, value, additionalProperties = '') => {\n let hostname = window.location.hostname;\n let domain = hostname;\n \n let parts = hostname.split('.');\n if (parts.length > 2) {\n domain = parts.slice(-2).join('.');\n }\n\n // "samesite=lax" is needed for cross-site situations (like NZXT getting checkout url attributes from lambda).\n window.document.cookie = \`\${key}=\${value}; domain=.\${domain}; path=/; secure; samesite=lax; \${additionalProperties}\`;\n };\n\n setCookie('easid', encodeURIComponent(window.EkoAnalytics('getSid')));\n setCookie('eauid', encodeURIComponent(window.EkoAnalytics('getUid')), 'max-age=2147483647');\n });\n\n window.EkoAnalytics('configure', {\n snowplow: {\n options: {\n appId: 'ekoGalleryReact',\n },\n },\n ekoEnv: '${t?"production":"development"}',\n env: 'website',\n });\n window.EkoAnalytics('track', 'PageView');\n }`},exports.getEkoProductConfigUrl=ZO,exports.getEkoProductConfigUrlLegacy=tP;
|