@ekolabs/eko-gallery-react 4.0.5-temporal-queue-autoscaling-1153253.0 → 4.0.5
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
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import e,{useRef as n,useState as i,createRef as r,useCallback as o,useEffect as s,forwardRef as a,useImperativeHandle as l,memo as c}from"react";function u(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 }`}function d(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 h(t){return"object"==typeof t&&!Array.isArray(t)&&null!==t}var f={pack:function(t){const e={};if(!h(t))return e;if(t.itemId&&(e.item_id=t.itemId),t.itemName&&(e.item_name=t.itemName),h(t.itemPrice)){const n=t.itemPrice;e.item_price=function(t){const e={};return h(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 p="mobile",m="notmobile";function v(){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))?p:m)===p}const g={};class y{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 b(t){return g[t]||(g[t]=new y(t)),g[t]}const k=b("gallery-react").getDataStorage("gallery-react");function x(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=f.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==k||null===(n=k.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 w(t){return"object"==typeof t&&!Array.isArray(t)&&null!==t}function _(t){const e={};return w(t)&&(t.amount&&(e.amount=Number(t.amount)),t.currency&&(e.currency=t.currency)),e}var T={isObject:w,pricePack:_,itemPack:function(t){const e={};if(!w(t))return e;if(t.itemId&&(e.item_id=t.itemId),t.itemName&&(e.item_name=t.itemName),w(t.itemPrice)){const n=t.itemPrice;e.item_price=_(n)}return t.quantity&&(e.quantity=Number(t.quantity)),t.sellingPlan&&(e.selling_plan=function(t){const e={};return w(t)&&(t.id&&(e.id=t.id),t.name&&(e.name=t.name)),e}(t.sellingPlan)),e}};const I=b("gallery-react").getDataStorage("gallery-react");const E=b("gallery-react").getDataStorage("gallery-react");const S=b("gallery-react").getDataStorage("gallery-react");const A="eko-gallery-react";var N={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||""}}})}(A),x(A),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=>T.itemPack(t)))),T.isObject(t.totalPrice)){const n=t.totalPrice;e.total_price=T.pricePack(n)}return t.totalQuantity&&(e.total_quantity=Number(t.totalQuantity)),e}})}(A),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==I||null===(e=I.config)||void 0===e?void 0:e.customer);if(n)return{id:null==n?void 0:n.organizationId}}})}(A),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==E||null===(e=E.config)||void 0===e?void 0:e.customer);if(n)return{id:null==n?void 0:n.spaceId}}})}(A),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==S||null===(n=S.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}})}(A),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}})}(A),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=>T.itemPack(t)))),T.isObject(t.totalPrice)){const n=t.totalPrice;e.total_price=T.pricePack(n)}return t.totalQuantity&&(e.total_quantity=Number(t.totalQuantity)),e}})}(A),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=>T.itemPack(t)))),T.isObject(t.totalPrice)){const n=t.totalPrice;e.total_price=T.pricePack(n)}return t.totalQuantity&&(e.total_quantity=Number(t.totalQuantity)),e}})}(A)}};function M(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 F(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 O(t){return{cartId:t.cartId,items:F(t),totalPrice:t.totalPrice,totalQuantity:t.totalQuantity}}var P={"pixel.cart.add":O,"pixel.cart.remove":O,"pixel.product_viewed":function(t){let e=F(t);return e=e.map((t=>function(t){let e=M("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:F(t),totalPrice:t.totalPrice,totalQuantity:t.totalQuantity}},"pixel.order":function(t){return{checkoutId:t.checkoutId,orderId:t.orderId,items:F(t),totalPrice:t.totalPrice,totalQuantity:t.totalQuantity}}};const C="https://storage.eko.com/efu/ekoanalytics/master/latest/EkoAnalyticsPlatform.min.gz.js";let D=!1;var R={init:function(t){N.register(),function(t){if(D)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=C,document.body.appendChild(n),D=!0}(t)},onRouteChanged:function(){window.EkoAnalytics("reset")},track:function(t,e){P[t]&&(e=P[t](e)),window.EkoAnalytics("track",t,e)}};function L(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 B(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function z(t,e){return t.get(L(t,e))}function W(t,e,n){B(t,e),e.set(t,n)}function U(t,e,n){return t.set(L(t,e),n),n}function j(t,e){B(t,e),e.add(t)}function $(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 q(){return q=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},q.apply(null,arguments)}function V(t,e){return t(e={exports:{}},e.exports),e.exports
|
|
1
|
+
import e,{useRef as n,useState as i,createRef as r,useCallback as o,useEffect as s,forwardRef as a,useImperativeHandle as l,memo as c}from"react";function u(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 }`}function d(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 h(t){return"object"==typeof t&&!Array.isArray(t)&&null!==t}var f={pack:function(t){const e={};if(!h(t))return e;if(t.itemId&&(e.item_id=t.itemId),t.itemName&&(e.item_name=t.itemName),h(t.itemPrice)){const n=t.itemPrice;e.item_price=function(t){const e={};return h(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 p="mobile",m="notmobile";function v(){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))?p:m)===p}const g={};class y{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 b(t){return g[t]||(g[t]=new y(t)),g[t]}const k=b("gallery-react").getDataStorage("gallery-react");function x(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=f.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==k||null===(n=k.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 w(t){return"object"==typeof t&&!Array.isArray(t)&&null!==t}function _(t){const e={};return w(t)&&(t.amount&&(e.amount=Number(t.amount)),t.currency&&(e.currency=t.currency)),e}var T={isObject:w,pricePack:_,itemPack:function(t){const e={};if(!w(t))return e;if(t.itemId&&(e.item_id=t.itemId),t.itemName&&(e.item_name=t.itemName),w(t.itemPrice)){const n=t.itemPrice;e.item_price=_(n)}return t.quantity&&(e.quantity=Number(t.quantity)),t.sellingPlan&&(e.selling_plan=function(t){const e={};return w(t)&&(t.id&&(e.id=t.id),t.name&&(e.name=t.name)),e}(t.sellingPlan)),e}};const I=b("gallery-react").getDataStorage("gallery-react");const E=b("gallery-react").getDataStorage("gallery-react");const S=b("gallery-react").getDataStorage("gallery-react");const A="eko-gallery-react";var N={register:function(){var t;t=A,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||""}}}),x(A),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=>T.itemPack(t)))),T.isObject(t.totalPrice)){const n=t.totalPrice;e.total_price=T.pricePack(n)}return t.totalQuantity&&(e.total_quantity=Number(t.totalQuantity)),e}})}(A),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==I||null===(e=I.config)||void 0===e?void 0:e.customer);if(n)return{id:null==n?void 0:n.organizationId}}})}(A),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==E||null===(e=E.config)||void 0===e?void 0:e.customer);if(n)return{id:null==n?void 0:n.spaceId}}})}(A),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==S||null===(n=S.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}})}(A),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}})}(A),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=>T.itemPack(t)))),T.isObject(t.totalPrice)){const n=t.totalPrice;e.total_price=T.pricePack(n)}return t.totalQuantity&&(e.total_quantity=Number(t.totalQuantity)),e}})}(A),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=>T.itemPack(t)))),T.isObject(t.totalPrice)){const n=t.totalPrice;e.total_price=T.pricePack(n)}return t.totalQuantity&&(e.total_quantity=Number(t.totalQuantity)),e}})}(A)}};function M(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 F(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 O(t){return{cartId:t.cartId,items:F(t),totalPrice:t.totalPrice,totalQuantity:t.totalQuantity}}var C={"pixel.cart.add":O,"pixel.cart.remove":O,"pixel.product_viewed":function(t){let e=F(t);return e=e.map((t=>function(t){let e=M("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:F(t),totalPrice:t.totalPrice,totalQuantity:t.totalQuantity}},"pixel.order":function(t){return{checkoutId:t.checkoutId,orderId:t.orderId,items:F(t),totalPrice:t.totalPrice,totalQuantity:t.totalQuantity}}};const P="https://storage.eko.com/efu/ekoanalytics/master/latest/EkoAnalyticsPlatform.min.gz.js";let D=!1;var R={init:function(t){N.register(),function(t){if(D)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=P,document.body.appendChild(n),D=!0}(t)},onRouteChanged:function(){window.EkoAnalytics("reset")},track:function(t,e){C[t]&&(e=C[t](e)),window.EkoAnalytics("track",t,e)}};function L(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 B(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function z(t,e){return t.get(L(t,e))}function W(t,e,n){B(t,e),e.set(t,n)}function j(t,e,n){return t.set(L(t,e),n),n}function U(t,e){B(t,e),e.add(t)}function $(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 q(){return q=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},q.apply(null,arguments)}function V(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 @@ import e,{useRef as n,useState as i,createRef as r,useCallback as o,useEffect as
|
|
|
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 G="function"==typeof Symbol&&Symbol.for,H=G?Symbol.for("react.element"):60103,K=G?Symbol.for("react.portal"):60106,X=G?Symbol.for("react.fragment"):60107,Y=G?Symbol.for("react.strict_mode"):60108,Q=G?Symbol.for("react.profiler"):60114,J=G?Symbol.for("react.provider"):60109,Z=G?Symbol.for("react.context"):60110,tt=G?Symbol.for("react.async_mode"):60111,et=G?Symbol.for("react.concurrent_mode"):60111,nt=G?Symbol.for("react.forward_ref"):60112,it=G?Symbol.for("react.suspense"):60113,rt=G?Symbol.for("react.suspense_list"):60120,ot=G?Symbol.for("react.memo"):60115,st=G?Symbol.for("react.lazy"):60116,at=G?Symbol.for("react.block"):60121,lt=G?Symbol.for("react.fundamental"):60117,ct=G?Symbol.for("react.responder"):60118,ut=G?Symbol.for("react.scope"):60119;function dt(t){if("object"==typeof t&&null!==t){var e=t.$$typeof;switch(e){case H:switch(t=t.type){case tt:case et:case X:case Q:case Y:case it:return t;default:switch(t=t&&t.$$typeof){case Z:case nt:case st:case ot:case J:return t;default:return e}}case K:return e}}}function ht(t){return dt(t)===et}var ft={AsyncMode:tt,ConcurrentMode:et,ContextConsumer:Z,ContextProvider:J,Element:H,ForwardRef:nt,Fragment:X,Lazy:st,Memo:ot,Portal:K,Profiler:Q,StrictMode:Y,Suspense:it,isAsyncMode:function(t){return ht(t)||dt(t)===tt},isConcurrentMode:ht,isContextConsumer:function(t){return dt(t)===Z},isContextProvider:function(t){return dt(t)===J},isElement:function(t){return"object"==typeof t&&null!==t&&t.$$typeof===H},isForwardRef:function(t){return dt(t)===nt},isFragment:function(t){return dt(t)===X},isLazy:function(t){return dt(t)===st},isMemo:function(t){return dt(t)===ot},isPortal:function(t){return dt(t)===K},isProfiler:function(t){return dt(t)===Q},isStrictMode:function(t){return dt(t)===Y},isSuspense:function(t){return dt(t)===it},isValidElementType:function(t){return"string"==typeof t||"function"==typeof t||t===X||t===et||t===Q||t===Y||t===it||t===rt||"object"==typeof t&&null!==t&&(t.$$typeof===st||t.$$typeof===ot||t.$$typeof===J||t.$$typeof===Z||t.$$typeof===nt||t.$$typeof===lt||t.$$typeof===ct||t.$$typeof===ut||t.$$typeof===at)},typeOf:dt},pt=V((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,O=o,
|
|
9
|
+
*/}var G="function"==typeof Symbol&&Symbol.for,H=G?Symbol.for("react.element"):60103,K=G?Symbol.for("react.portal"):60106,X=G?Symbol.for("react.fragment"):60107,Y=G?Symbol.for("react.strict_mode"):60108,Q=G?Symbol.for("react.profiler"):60114,J=G?Symbol.for("react.provider"):60109,Z=G?Symbol.for("react.context"):60110,tt=G?Symbol.for("react.async_mode"):60111,et=G?Symbol.for("react.concurrent_mode"):60111,nt=G?Symbol.for("react.forward_ref"):60112,it=G?Symbol.for("react.suspense"):60113,rt=G?Symbol.for("react.suspense_list"):60120,ot=G?Symbol.for("react.memo"):60115,st=G?Symbol.for("react.lazy"):60116,at=G?Symbol.for("react.block"):60121,lt=G?Symbol.for("react.fundamental"):60117,ct=G?Symbol.for("react.responder"):60118,ut=G?Symbol.for("react.scope"):60119;function dt(t){if("object"==typeof t&&null!==t){var e=t.$$typeof;switch(e){case H:switch(t=t.type){case tt:case et:case X:case Q:case Y:case it:return t;default:switch(t=t&&t.$$typeof){case Z:case nt:case st:case ot:case J:return t;default:return e}}case K:return e}}}function ht(t){return dt(t)===et}var ft={AsyncMode:tt,ConcurrentMode:et,ContextConsumer:Z,ContextProvider:J,Element:H,ForwardRef:nt,Fragment:X,Lazy:st,Memo:ot,Portal:K,Profiler:Q,StrictMode:Y,Suspense:it,isAsyncMode:function(t){return ht(t)||dt(t)===tt},isConcurrentMode:ht,isContextConsumer:function(t){return dt(t)===Z},isContextProvider:function(t){return dt(t)===J},isElement:function(t){return"object"==typeof t&&null!==t&&t.$$typeof===H},isForwardRef:function(t){return dt(t)===nt},isFragment:function(t){return dt(t)===X},isLazy:function(t){return dt(t)===st},isMemo:function(t){return dt(t)===ot},isPortal:function(t){return dt(t)===K},isProfiler:function(t){return dt(t)===Q},isStrictMode:function(t){return dt(t)===Y},isSuspense:function(t){return dt(t)===it},isValidElementType:function(t){return"string"==typeof t||"function"==typeof t||t===X||t===et||t===Q||t===Y||t===it||t===rt||"object"==typeof t&&null!==t&&(t.$$typeof===st||t.$$typeof===ot||t.$$typeof===J||t.$$typeof===Z||t.$$typeof===nt||t.$$typeof===lt||t.$$typeof===ct||t.$$typeof===ut||t.$$typeof===at)},typeOf:dt},pt=V((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,O=o,C=h,P=!1;function D(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=O,e.Suspense=C,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.")),D(t)||k(t)===c},e.isConcurrentMode=D,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}()}));pt.AsyncMode,pt.ConcurrentMode,pt.ContextConsumer,pt.ContextProvider,pt.Element,pt.ForwardRef,pt.Fragment,pt.Lazy,pt.Memo,pt.Portal,pt.Profiler,pt.StrictMode,pt.Suspense,pt.isAsyncMode,pt.isConcurrentMode,pt.isContextConsumer,pt.isContextProvider,pt.isElement,pt.isForwardRef,pt.isFragment,pt.isLazy,pt.isMemo,pt.isPortal,pt.isProfiler,pt.isStrictMode,pt.isSuspense,pt.isValidElementType,pt.typeOf;var mt=V((function(t){"production"===process.env.NODE_ENV?t.exports=ft:t.exports=pt})),vt=Object.getOwnPropertySymbols,gt=Object.prototype.hasOwnProperty,yt=Object.prototype.propertyIsEnumerable;
|
|
10
10
|
/*
|
|
11
11
|
object-assign
|
|
12
12
|
(c) Sindre Sorhus
|
|
13
13
|
@license MIT
|
|
14
|
-
*/var bt=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;var i=Object.getOwnPropertyNames(e).map((function(t){return e[t]}));if("0123456789"!==i.join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(t){r[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,i,r=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),o=1;o<arguments.length;o++){for(var s in n=Object(arguments[o]))gt.call(n,s)&&(r[s]=n[s]);if(vt){i=vt(n);for(var a=0;a<i.length;a++)yt.call(n,i[a])&&(r[i[a]]=n[i[a]])}}return r},kt="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",xt=Function.call.bind(Object.prototype.hasOwnProperty),wt=function(){};if("production"!==process.env.NODE_ENV){var _t=kt,Tt={},It=xt;wt=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(t){}}}function Et(t,e,n,i,r){if("production"!==process.env.NODE_ENV)for(var o in t)if(It(t,o)){var s;try{if("function"!=typeof t[o]){var a=Error((i||"React class")+": "+n+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof t[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw a.name="Invariant Violation",a}s=t[o](e,o,i,n,null,_t)}catch(t){s=t}if(!s||s instanceof Error||wt((i||"React class")+": type specification of "+n+" `"+o+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof s+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),s instanceof Error&&!(s.message in Tt)){Tt[s.message]=!0;var l=r?r():"";wt("Failed "+n+" type: "+s.message+(null!=l?l:""))}}}Et.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(Tt={})};var St=Et,At=function(){};function Nt(){return null}"production"!==process.env.NODE_ENV&&(At=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(t){}});var Mt=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(Nt),arrayOf:function(t){return l((function(e,n,i,r,o){if("function"!=typeof t)return new a("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside arrayOf.");var s=e[n];if(!Array.isArray(s))return new a("Invalid "+r+" `"+o+"` of type `"+h(s)+"` supplied to `"+i+"`, expected an array.");for(var l=0;l<s.length;l++){var c=t(s,l,i,r,o+"["+l+"]",kt);if(c instanceof Error)return c}return null}))},element:l((function(e,n,i,r,o){var s=e[n];return t(s)?null:new a("Invalid "+r+" `"+o+"` of type `"+h(s)+"` supplied to `"+i+"`, expected a single ReactElement.")})),elementType:l((function(t,e,n,i,r){var o=t[e];return mt.isValidElementType(o)?null:new a("Invalid "+i+" `"+r+"` of type `"+h(o)+"` supplied to `"+n+"`, expected a single ReactElement type.")})),instanceOf:function(t){return l((function(e,n,i,o,s){if(!(e[n]instanceof t)){var l=t.name||r;return new a("Invalid "+o+" `"+s+"` of type `"+(((c=e[n]).constructor&&c.constructor.name?c.constructor.name:r)+"` supplied to `")+i+"`, expected instance of `"+l+"`.")}var c;return null}))},node:l((function(t,e,n,i,r){return d(t[e])?null:new a("Invalid "+i+" `"+r+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(t){return l((function(e,n,i,r,o){if("function"!=typeof t)return new a("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var s=e[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected an object.");for(var c in s)if(xt(s,c)){var u=t(s,c,i,r,o+"."+c,kt);if(u instanceof Error)return u}return null}))},oneOf:function(t){if(!Array.isArray(t))return"production"!==process.env.NODE_ENV&&At(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."),Nt;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&&At("Invalid argument supplied to oneOfType, expected an instance of array."),Nt;for(var e=0;e<t.length;e++){var n=t[e];if("function"!=typeof n)return At("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+p(n)+" at index "+e+"."),Nt}return l((function(e,n,i,r,o){for(var s=[],l=0;l<t.length;l++){var c=(0,t[l])(e,n,i,r,o,kt);if(null==c)return null;c.data&&xt(c.data,"expectedType")&&s.push(c.data.expectedType)}return new a("Invalid "+r+" `"+o+"` supplied to `"+i+"`"+(s.length>0?", expected one of type ["+s.join(", ")+"]":"")+".")}))},shape:function(t){return l((function(e,n,i,r,o){var s=e[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected `object`.");for(var c in t){var d=t[c];if("function"!=typeof d)return u(i,r,o,c,f(d));var p=d(s,c,i,r,o+"."+c,kt);if(p)return p}return null}))},exact:function(t){return l((function(e,n,i,r,o){var s=e[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected `object`.");var c=bt({},e[n],t);for(var d in c){var p=t[d];if(xt(t,d)&&"function"!=typeof p)return u(i,r,o,d,f(p));if(!p)return new a("Invalid "+r+" `"+o+"` key `"+d+"` supplied to `"+i+"`.\nBad object: "+JSON.stringify(e[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(t),null," "));var m=p(s,d,i,r,o+"."+d,kt);if(m)return m}return null}))}};function s(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}function a(t,e){this.message=t,this.data=e&&"object"==typeof e?e:{},this.stack=""}function l(t){if("production"!==process.env.NODE_ENV)var n={},i=0;function o(o,s,l,c,u,d,h){if(c=c||r,d=d||l,h!==kt){if(e){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var p=c+":"+l;!n[p]&&i<3&&(At("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+c+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),n[p]=!0,i++)}}return null==s[l]?o?null===s[l]?new a("The "+u+" `"+d+"` is marked as required in `"+c+"`, but its value is `null`."):new a("The "+u+" `"+d+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:t(s,l,c,u,d)}var s=o.bind(null,!1);return s.isRequired=o.bind(null,!0),s}function c(t){return l((function(e,n,i,r,o,s){var l=e[n];return h(l)!==t?new a("Invalid "+r+" `"+o+"` of type `"+f(l)+"` supplied to `"+i+"`, expected `"+t+"`.",{expectedType:t}):null}))}function u(t,e,n,i,r){return new a((t||"React class")+": "+e+" type `"+n+"."+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+r+"`.")}function d(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(d);if(null===e||t(e))return!0;var r=function(t){var e=t&&(n&&t[n]||t[i]);if("function"==typeof e)return e}(e);if(!r)return!1;var o,s=r.call(e);if(r!==e.entries){for(;!(o=s.next()).done;)if(!d(o.value))return!1}else for(;!(o=s.next()).done;){var a=o.value;if(a&&!d(a[1]))return!1}return!0;default:return!1}}function h(t){var e=typeof t;return Array.isArray(t)?"array":t instanceof RegExp?"object":function(t,e){return"symbol"===t||!!e&&("Symbol"===e["@@toStringTag"]||"function"==typeof Symbol&&e instanceof Symbol)}(e,t)?"symbol":e}function f(t){if(null==t)return""+t;var e=h(t);if("object"===e){if(t instanceof Date)return"date";if(t instanceof RegExp)return"regexp"}return e}function p(t){var e=f(t);switch(e){case"array":case"object":return"an "+e;case"boolean":case"date":case"regexp":return"a "+e;default:return e}}return a.prototype=Error.prototype,o.checkPropTypes=St,o.resetWarningCache=St.resetWarningCache,o.PropTypes=o,o};function Ft(){}function Ot(){}Ot.resetWarningCache=Ft;var Pt=V((function(t){if("production"!==process.env.NODE_ENV){var e=mt;t.exports=Mt(e.isElement,!0)}else t.exports=function(){function t(t,e,n,i,r,o){if(o!==kt){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function e(){return t}t.isRequired=t;var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:Ot,resetWarningCache:Ft};return n.PropTypes=n,n}()}));const Ct=/https?:\/\/(.*?\.)?eko.com/,Dt={"eko.project.interaction":"interaction","eko.project.swipe":"swipe"};let Rt=null,Lt=null,Bt=[];function zt(t){return e=>{var n;if(!Ct.test(e.origin)||"eko.embedapi"!==(null===(n=e.data)||void 0===n?void 0:n.source))return;const i=e.data,r=Dt[i.type];r&&(t?t(r,i.data):Bt.push({type:r,data:i.data}))}}"undefined"!=typeof window&&(Lt=zt(null),window.addEventListener("message",Lt));var Wt={subscribe:function(t){"function"==typeof t?Rt?console.warn("[eko-gallery-react] Ignoring events subscribe since already subscribed"):(Rt=t,Lt=zt(t),window.addEventListener("message",Lt),function(t){Bt.forEach((e=>{t(e.type,e.data)})),Bt=[]}(t)):console.warn("[eko-gallery-react] Ignoring events subscribe since a callback function was not provided as argument")},unsubscribe:function(){Lt?(window.removeEventListener("message",Lt),Lt=null,Rt=null,Bt=[]):console.warn("[eko-gallery-react] Ignoring events unsubscribe since not subscribed")},send:function(t,e){Rt?Rt(t,e):Bt.push({type:t,data:e})}};const Ut=({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){R.track("gallery.interaction",{elementid:`thumbnail-${t}`,interactiontype:"click"}),Wt.send("interaction",{elementid:`thumbnail-${t}`,interactiontype:"click"})}(t)},ref:s.current[t]},e.createElement("button",{type:"button","aria-label":`Go to item ${t}`},!h&&e.createElement("img",{src:f,srcSet:u,sizes:d,alt:null==r?void 0:r.name,loading:"eager",fetchPriority:"high"}),e.createElement("div",{className:p},(null==r?void 0:r.stepsIndication)&&e.createElement("div",{className:"step-indicator"},e.createElement("span",null),e.createElement("span",null),e.createElement("span",null)),(null==r?void 0:r.label)&&e.createElement("div",{className:"thumb-label"},null==r?void 0:r.label)),a&&e.createElement("div",{className:"item-icon"},e.createElement("span",{style:{backgroundImage:`url(${a})`}}))))};Ut.propTypes={index:Pt.number,activeIndex:Pt.number,setActiveIndex:Pt.func.isRequired,item:Pt.object.isRequired,src:Pt.string,navItemRefs:Pt.object.isRequired,itemIcon:Pt.string};const jt=({layout:t,nav:i,isVerticalNav:r,showPrevArrow:o,showNextArrow:s})=>{var a,l,c,u,d;const h=n(null),f=n(null),p="arrows"===(null==t||null===(a=t.mobile)||void 0===a||null===(a=a.config)||void 0===a||null===(a=a.navPagination)||void 0===a?void 0:a.type)?"eko-mobile-arrows":"",m="arrows"===(null!==(l=null==t||null===(c=t.desktop)||void 0===c||null===(c=c.config)||void 0===c||null===(c=c.navPagination)||void 0===c?void 0:c.type)&&void 0!==l?l:"arrows")?"eko-desktop-arrows":"",v=p||m,g=r?null==i||null===(u=i.current)||void 0===u?void 0:u.scrollHeight:null==i||null===(d=i.current)||void 0===d?void 0:d.scrollWidth;function y(t){const e=r?i.current.clientHeight:i.current.clientWidth,n=function(t,e){const n=r?e.scrollTop:e.scrollLeft;return Math.max(-n,Math.min(g-t-n,t))}("next"===t?e:-e,i.current);return{top:r?n:0,left:r?0:n,behavior:"smooth"}}function b(t){var e,n,r;const o=y(t),s="next"===t?null==f||null===(e=f.current)||void 0===e?void 0:e.id:null==h||null===(n=h.current)||void 0===n?void 0:n.id;var a,l;window.EkoAnalytics("track","gallery.interaction",{elementid:s,interactiontype:"click"}),null==i||null===(r=i.current)||void 0===r||r.scrollBy(o),a=s,l="click",R.track("gallery.interaction",{elementId:a,interactiontype:l}),Wt.send("interaction",{elementId:a,interactiontype:l})}return e.createElement(e.Fragment,null,v&&e.createElement(e.Fragment,null,e.createElement("button",q({type:"button","aria-label":"Go to previous item","aria-hidden":o?"false":"true",onClick:()=>b("prev"),ref:h,id:"eko-nav-prev-arrow",className:`eko-nav-arrow eko-prev-nav-button ${p} ${m} ${o?"":"eko-hidden-nav-button"}`},o?{}:{tabIndex:"-1"}),e.createElement("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M5.56127 9.52817C5.28966 9.22635 5.28966 8.77361 5.56127 8.502L10.39 3.67331C10.6918 3.37157 11.1445 3.37157 11.4161 3.67331C11.7179 3.94492 11.7179 4.39766 11.4161 4.66927L7.10044 8.98487L11.4161 13.3307C11.7179 13.6023 11.7179 14.055 11.4161 14.3266C11.1445 14.6285 10.6918 14.6285 10.4202 14.3266L5.56127 9.52817Z",fill:"black"}))),e.createElement("button",q({type:"button","aria-label":"Go to next item","aria-hidden":s?"false":"true",onClick:()=>b("next"),ref:f,className:`eko-nav-arrow eko-next-nav-button ${p} ${m} ${s?"":"eko-hidden-nav-button"}`,id:"eko-nav-next-arrow"},s?{}:{tabIndex:"-1"}),e.createElement("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M12.4387 8.47185C12.7103 8.77367 12.7103 9.22641 12.4387 9.49802L7.61003 14.3267C7.30821 14.6284 6.85547 14.6284 6.58386 14.3267C6.28212 14.0551 6.28212 13.6024 6.58386 13.3308L10.8996 9.01515L6.58386 4.66933C6.28212 4.39772 6.28212 3.94499 6.58386 3.67338C6.85547 3.37155 7.30821 3.37155 7.57982 3.67338L12.4387 8.47185Z",fill:"black"})))))};function $t(t,e,n){let i;return function(){const n=this,r=arguments;clearTimeout(i),i=setTimeout((function(){i=null,t.apply(n,r)}),e)}}jt.propTypes={layout:Pt.object.isRequired,nav:Pt.object.isRequired,isVerticalNav:Pt.bool.isRequired,showPrevArrow:Pt.bool.isRequired,showNextArrow:Pt.bool.isRequired};const qt=({items:t,setActiveIndex:a,activeIndex:l,layout:c,carouselMounted:u,forceMobile:d})=>{const h=n(null),f=n(null),p=n([]),m=3,[g,y]=i(null),[b,k]=i(!1),[x,w]=i(0),[_,T]=i(!1),[I,E]=i(!1);function S(){var t;const e=d||window.innerWidth<768?"mobile":"desktop",n=(null==c||null===(t=c[e])||void 0===t||null===(t=t.config)||void 0===t?void 0:t.orientation)||("desktop"===e?"left":"bottom");k("left"===n||"right"===n);const i=f.current.parentNode,r=u?".eko-smart-gallery-container iframe":".eko-carousel",o=i.querySelector(r);setTimeout((()=>{w(o.clientHeight)}),0)}function A(){var t,e;const n=d||v()?"mobile":"desktop",i=null!==(t=null==c||null===(e=c[n])||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.navPagination)||void 0===e?void 0:e.scrollThreshold)&&void 0!==t?t:m;!function(t=m){var e,n;const i=h.current;if(!i)return;const r="none"!==(null==c||null===(e=c.desktop)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.navPagination)||void 0===e?void 0:e.type),o=(s=null==c||null===(n=c.mobile)||void 0===n||null===(n=n.config)||void 0===n||null===(n=n.navPagination)||void 0===n?void 0:n.type,"mask"===s||"arrows"===s);var s;if((d||v())&&!o)return void i.style.setProperty("-webkit-mask","none");if(!v()&&!r)return void i.style.setProperty("-webkit-mask","none");const a=i.scrollHeight-i.clientHeight,l=i.scrollTop>t?"85%":"100%",u=i.scrollTop<=a-t?"15%":"0%",f=i.scrollWidth-i.clientWidth,p=i.scrollLeft>t?"15%":"0%",g=i.scrollLeft<=f-t?"85%":"100%";b?i.style.setProperty("-webkit-mask",`linear-gradient(0deg,#0000,#000 ${u} ${l},#0000)`):i.style.setProperty("-webkit-mask",`linear-gradient(90deg,#0000,#000 ${p} ${g},#0000)`)}(i),function(t=m){var e,n,i,r,o,s;const a=b?null==h||null===(e=h.current)||void 0===e?void 0:e.scrollTop:null==h||null===(n=h.current)||void 0===n?void 0:n.scrollLeft,l=b?null==h||null===(i=h.current)||void 0===i?void 0:i.clientHeight:null==h||null===(r=h.current)||void 0===r?void 0:r.clientWidth,c=b?null==h||null===(o=h.current)||void 0===o?void 0:o.scrollHeight:null==h||null===(s=h.current)||void 0===s?void 0:s.scrollWidth;c-t<l?(T(!1),E(!1)):a<=t?(T(!1),E(!0)):a+l>c-t?(T(!0),E(!1)):a+t>0&&a<c-t&&(T(!0),E(!0))}(i)}p.current=null==t?void 0:t.map(((t,e)=>{var n,i;return null!==(n=null==p||null===(i=p.current)||void 0===i?void 0:i[e])&&void 0!==n?n:r()}));const N=$t((t=>{var e;e=t,R.track("gallery.interaction",{elementid:"nav",interactiontype:e}),Wt.send("interaction",{elementid:"nav",interactiontype:e})}),200);const M=o((t=>{a({index:t,step:0,source:"nav"})}),[]);return s((()=>{var t;y(null===(t=p.current)||void 0===t?void 0:t[l])}),[l]),s((()=>{if(null!=g&&g.current&&null!=h&&h.current){const t=g.current,e=h.current.clientWidth/2,n=t.clientWidth/2,i=h.current.clientHeight/2,r=t.clientHeight/2;h.current.scrollTo({left:t.offsetLeft-e+n,top:t.offsetTop-i+r,behavior:"smooth"})}}),[g]),s((()=>{S()}),[]),s((()=>(window.addEventListener("resize",S),()=>{window.removeEventListener("resize",S)})),[f,u,d]),s((()=>{w(0),S()}),[t,f,u,d]),s((()=>{A();const t=new ResizeObserver(A);return t.observe(h.current),()=>{t.disconnect()}}),[t,d,b]),e.createElement("div",{className:"eko-nav-container",ref:f,style:{opacity:x>0?1:0,height:""+(x&&b?x+"px":"auto")}},e.createElement(jt,{layout:c,nav:h,isVerticalNav:b,showPrevArrow:_,showNextArrow:I}),e.createElement("ul",{className:`eko-nav eko-mobile-nav-selected-${null!==(F=null==c||null===(O=c.mobile)||void 0===O||null===(O=O.config)||void 0===O?void 0:O.navItemsSelectedType)&&void 0!==F?F:"underline"} eko-desktop-nav-selected-${null!==(P=null==c||null===(C=c.desktop)||void 0===C||null===(C=C.config)||void 0===C?void 0:C.navItemsSelectedType)&&void 0!==P?P:"underline"}`,ref:h,onScroll:function(){A()},onWheel:function(){N("wheel")},onTouchMove:function(){N("swipe")}},null==t?void 0:t.map(((t,n)=>{var i;const r=(null==t||null===(i=t.media)||void 0===i?void 0:i.url)||(null==t?void 0:t.media)||"";return e.createElement(Ut,{key:r+n,index:n,activeIndex:l,setActiveIndex:M,item:t,src:r,navItemRefs:p,itemIcon:null==t?void 0:t.icon})}))));var F,O,P,C};qt.propTypes={items:Pt.array.isRequired,activeIndex:Pt.number,setActiveIndex:Pt.func.isRequired,layout:Pt.object,carouselMounted:Pt.bool,forceMobile:Pt.bool};function Vt(){R.track("gallery.cover.displayed"),Wt.send("gallerycoverdisplayed")}function Gt(t){if(!t)return t;try{const e=new URL(t);return e.host.includes("assets.eko.com")&&e.pathname.startsWith("/image")&&!e.searchParams.has("width")?(e.pathname.endsWith(".png")&&(e.pathname=e.pathname.replace(/\.png$/,".webp")),e.searchParams.set("width",1920),e.toString()):t}catch(e){return t}}const Ht=({item:t,src:i,srcset:r,sizes:o,isCoverElement:a})=>{const l=n(null);return s((()=>{var t;if(a){if(null===(t=l.current)||void 0===t||!t.complete)return l.current.addEventListener("load",Vt,{once:!0}),()=>{var t;null===(t=l.current)||void 0===t||t.removeEventListener("load",Vt,{once:!0})};Vt()}}),[]),e.createElement("img",{ref:l,src:Gt(i),srcSet:r,sizes:o,alt:t.name,fetchPriority:a?"high":"auto",loading:a?"eager":"lazy",style:{width:"100%",height:"100%"}})};Ht.propTypes={item:Pt.object.isRequired,src:Pt.string,srcset:Pt.string,sizes:Pt.string,isCoverElement:Pt.bool};const Kt=$t((t=>{var e;e=t,R.track("gallery.interaction",{elementid:"carousel",interactiontype:e}),Wt.send("interaction",{elementid:"carousel",interactiontype:e})}),200);function Xt(){Kt("wheel")}const Yt=a((({items:t,setActiveIndex:o,activeIndex:a,showSmartLoaders:c},u)=>{const d=n(null),h=n([]);h.current=null==t?void 0:t.map(((t,e)=>{var n,i;return null!==(n=null==h||null===(i=h.current)||void 0===i?void 0:i[e])&&void 0!==n?n:r()}));const[f,p]=i(),[m,v]=i(),g=n(a),y=n(!1);function b(){const e=function(t){const e=t.scrollLeft,n=t.scrollWidth-t.clientWidth;return 0===e?0:e>n?100:e/n*100}(d.current)*(null==t?void 0:t.length)/100,n=Math.min(Math.trunc(e),(null==t?void 0:t.length)-1),i=g.current;"nav"!==i.source&&"external-nav"!==i.source?(y.current&&n!==i.index&&(y.current=!1),y.current||(n>(null==t?void 0:t.length)-1?o({index:(null==t?void 0:t.length)-1,source:"carousel"}):o({index:n,source:"carousel"}))):n===i.index?y.current=!0:y.current&&n!==i.index&&(y.current=!1,o({index:n,source:"carousel"}))}return l(u,(()=>({prev:()=>{o({index:Math.max(0,g.current.index-1),source:"carousel"})},next:()=>{o({index:Math.min((null==t?void 0:t.length)-1,g.current.index+1),source:"carousel"})}}))),s((()=>{const t=d.current;if(t)return t.addEventListener("scroll",b),()=>{t.removeEventListener("scroll",b)}}),[t]),s((()=>{var t;let e=null===(t=h.current)||void 0===t?void 0:t[a.index];if(e&&("nav"===a.source||"external-nav"===a.source)){const t=e.current,n=d.current.clientWidth/2,i=(null==t?void 0:t.clientWidth)/2,r=(null==t?void 0:t.offsetLeft)-n+i;d.current.scrollTo({left:r,behavior:"smooth"})}}),[a]),s((()=>{g.current=a,"nav"!==a.source&&"external-nav"!==a.source||(y.current=!1)}),[a]),e.createElement("ul",{className:"eko-carousel",ref:d,onScroll:b,onWheel:Xt,onTouchMove:function(t){v(t.targetTouches[0].clientX)},onTouchStart:function(t){p(t.targetTouches[0].clientX),v(null)},onTouchEnd:function(){m&&f&&(f-m>75||f-m<-75)&&Kt("swipe")}},null==t?void 0:t.map(((t,n)=>{const i=(null==t?void 0:t.cover)||(null==t?void 0:t.media),r=(null==i?void 0:i.url)||i;return e.createElement("li",{className:"eko-carousel-item",key:r+n,ref:h.current[n]},e.createElement(Ht,{item:t,src:r,srcset:null==i?void 0:i.srcset,sizes:null==i?void 0:i.sizes,isCoverElement:0===n}),c&&"image"!==t.type&&e.createElement("div",{className:"eko-smart-loading"},e.createElement("div",null),e.createElement("p",null,"Loading video experience")))})))}));function Qt(t){var e;return function(t){var e;return"eko.block.event"===(null==t||null===(e=t.data)||void 0===e?void 0:e.type)}(t)&&"GalleryBlock"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.blockType)}Yt.propTypes={items:Pt.array.isRequired,setActiveIndex:Pt.func.isRequired,activeIndex:Pt.object,showSmartLoaders:Pt.bool},Yt.displayName="CarouselLoop";const Jt="eko.project.invoke",Zt="eko.block.invoke";function te(t,e,n){var i;null!=t&&t.contentWindow&&(null==t||null===(i=t.contentWindow)||void 0===i||i.postMessage({target:"eko.embedapi",type:e,data:n},"*"))}function ee(t){return`#variantId=${encodeURIComponent(t)}`}const ne=a((({config:t,instanceId:r,setActiveItem:o,activeItem:a,variantId:c,smartGalleryLoaded:u,onLoad:d,forceMobile:h},f)=>{var p,m,g;const y=null!==(p=null===(m=t.options)||void 0===m?void 0:m.galleryEnv)&&void 0!==p?p:"",b=null===(g=t.__autoGenerated)||void 0===g||null===(g=g.publishItem)||void 0===g?void 0:g.id,k=function(t={}){let e="";return Object.entries(t).forEach((([t,n])=>{e+=`&${t}=${n}`})),e}(null==t?void 0:t.qp),x=function(t,e,n){return`https://${t}play.eko.com/embed?${n?`id=${n}`:`piid=${e}`}&nocover=true&galleryBlockMode=gallery&eko_pixel=true`}(y,b,r),w=n(null),_=n(null),T=n(!1),[I,E]=i(ee(c||"ekonovar")),[S,A]=i(x+k+I);let N;function M(){R.track("gallery.project.display"),d(),Wt.send("galleryloaded")}return l(f,(()=>({prev:()=>{te(null==_?void 0:_.current,Zt,{action:"onPrevModule"})},next:()=>{te(null==_?void 0:_.current,Zt,{action:"onNextModule"})}}))),s((()=>{T.current?te(null==_?void 0:_.current,Jt,{action:"updateVariant",args:{id:c}}):E(ee(c))}),[c]),s((()=>{te(null==_?void 0:_.current,Zt,{action:"updateActiveModule",args:{activeItemIndex:null==a?void 0:a.index,activeModuleIndex:null==a?void 0:a.step}})}),[a]),s((()=>{function t(t){if((function(t){var e;return"eko.project.blockstart"===(null==t||null===(e=t.data)||void 0===e?void 0:e.type)}(t)||function(t){var e,n;return"eko.project.started"===(null==t||null===(e=t.data)||void 0===e?void 0:e.type)&&(null==t||null===(n=t.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.started)}(t))&&!T.current)return e=t.data.data.blockType,T.current=!0,void("GalleryBlock"===e?te(null==_?void 0:_.current,Zt,{action:"updateActiveModule",args:{activeItemIndex:null==a?void 0:a.index,activeModuleIndex:null==a?void 0:a.step}}):M());var e;if(T.current){if(function(t){var e;return Qt(t)&&"activeModuleChanged"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.name)}(t))return void function(t){const e=t.data.data.data.activeItemIndex,n=t.data.data.data.activeModuleIndex;e===(null==a?void 0:a.index)&&n===(null==a?void 0:a.step)||o({index:e,step:n,source:"carousel"})}(t);(function(t){var e;return Qt(t)&&"activeModuleChangeDone"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.name)})(t)&&!u&&M()}}return N=h||v()?"mobile":"desktop",function(t,e={}){window.addEventListener("message",t,e)}(t),()=>{!function(t,e={}){window.removeEventListener("message",t,e)}(t)}}),[a]),s((()=>{T.current||te(null==_?void 0:_.current,Jt,{action:"queryProjectStarted"})}),[a,u]),s((()=>{T.current=!1}),[t]),s((()=>{A(x+k+I)}),[I]),e.createElement("div",{className:"eko-smart-gallery-container "+(u?"":"eko-project-not-ready"),ref:w,"data-type":"smart-gallery","data-qp":k,"data-variant":c,"data-device":N},e.createElement("iframe",{allow:"autoplay; fullscreen",title:"eko gallery",src:S,style:{border:0},ref:_}))}));ne.propTypes={config:Pt.object.isRequired,instanceId:Pt.string,setActiveItem:Pt.func.isRequired,activeItem:Pt.object.isRequired,variantId:Pt.string,smartGalleryLoaded:Pt.bool,onLoad:Pt.func,forceMobile:Pt.bool},ne.displayName="SmartGallery";const ie=()=>e.createElement("style",{suppressHydrationWarning:!0},'.eko-gallery {\n --accentColorEko: #000;\n --primaryColorEko: #000;\n --backgroundColorEko: #25D7A2;\n --navItemsBackgroundColorEko: transparent;\n --navItemsBannerBackgroundColorEko: #EEEEEE;\n --carouselItemsBackgroundColorEko: transparent;\n --carouselInteractiveCoverBackgroundColorEko: transparent;\n --galleryGapEkoMobile: 12px;\n --galleryGapEkoDesktop: 12px;\n --galleryPaddingEkoMobile: 0;\n --galleryPaddingEkoDesktop: 0;\n --galleryMaxWidthEkoMobile: 100%;\n --galleryMaxWidthEkoDesktop: 900px;\n --galleryTransition: .8s cubic-bezier(.35, 0, 0, 1) 1.5s;\n --navBarPaddingEkoMobile: 0 0 0 20px;\n --navBarPaddingEkoDesktop: 0;\n --navItemsWidthEkoMobile: 80px;\n --navItemsWidthEkoDesktop: 80px;\n --navItemsHeightEkoMobile: 80px;\n --navItemsHeightEkoDesktop: 80px;\n --navItemsGapEkoMobile: 14px;\n --navItemsGapEkoDesktop: 14px;\n --navItemsRadiusEkoMobile: 8px;\n --navItemsRadiusEkoDesktop: 8px;\n --navItemsSelectedMarginEkoMobile: 3px;\n --navItemsSelectedMarginEkoDesktop: 3px;\n --navItemsSelectedThicknessEkoMobile: 3px;\n --navItemsSelectedThicknessEkoDesktop: 3px;\n --navItemsSelectedUnderlineRadiusEkoMobile: 100px;\n --navItemsSelectedUnderlineRadiusEkoDesktop: 100px;\n --navItemsObjectFitEkoMobile: cover;\n --navItemsObjectFitEkoDesktop: cover;\n --navMediaBadgeSizeEkoMobile: 22px;\n --navMediaBadgeSizeEkoDesktop: 22px;\n --navMediaBadgeMarginTopEkoMobile: 4px;\n --navMediaBadgeMarginTopEkoDesktop: 4px;\n --navMediaBadgeMarginRightEkoMobile: 4px;\n --navMediaBadgeMarginRightEkoDesktop: 4px;\n --carouselItemsAspectRatioEkoMobile: 1 / 1;\n --carouselItemsAspectRatioEkoDesktop: 1 / 1;\n --carouselItemsRadiusEkoMobile: 0px;\n --carouselItemsRadiusEkoDesktop: 12px;\n --carouselItemsObjectFitEkoMobile: cover;\n --carouselItemsObjectFitEkoDesktop: cover;\n --navBannerFontSizeEkoMobile: 12px;\n --navBannerFontSizeEkoDesktop: 12px;\n --navBannerFontLineHeightEkoMobile: 120%;\n --navBannerFontLineHeightEkoDesktop: 120%;\n --navBannerFontFamilyEkoMobile: inherit;\n --navBannerFontFamilyEkoDesktop: inherit;\n --navBannerFontWeightEkoMobile: 400;\n --navBannerFontWeightEkoDesktop: 400;\n --outerWidth: 0\n}\n\n.eko-gallery * {\n box-sizing: border-box\n}\n\n.eko-gallery ul,\n.eko-gallery li {\n padding: 0;\n text-indent: 0;\n list-style-type: none;\n font-size: 0;\n margin: 0\n}\n\n.eko-gallery button {\n border: none;\n padding: 0\n}\n\n.eko-gallery .eko-hidden {\n display: none !important\n}\n\n.eko-gallery .eko-not-visible {\n visibility: hidden !important\n}\n\n.eko-hidden-variant {\n display: none !important\n}\n\n.eko-sr-only {\n width: 1px;\n height: 1px;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n margin: -1px;\n padding: 0;\n position: absolute;\n overflow: hidden\n}\n\n.eko-sticky-top {\n position: sticky;\n top: 0\n}\n\n.eko-gallery .eko-nav {\n height: 100%;\n display: flex;\n align-items: start;\n align-self: start;\n flex-shrink: 0;\n scrollbar-width: none;\n -ms-overflow-style: none\n}\n\n.eko-gallery .eko-nav li {\n font-size: 0;\n position: relative;\n display: flex;\n flex-shrink: 0;\n justify-content: center;\n -webkit-box-pack: center;\n cursor: pointer\n}\n\n.eko-gallery .eko-nav li button {\n position: relative;\n background-color: transparent;\n border-radius: 0;\n line-height: 0;\n overflow: hidden;\n cursor: pointer\n}\n\n.eko-gallery .eko-nav li button img {\n background-color: var(--navItemsBackgroundColorEko);\n pointer-events: none\n}\n\n.eko-gallery .eko-nav li button .item-icon {\n position: absolute;\n top: 0;\n right: 0;\n width: 32px;\n height: 32px;\n transform: scale(.25);\n transform-origin: top right\n}\n\n.eko-gallery .eko-nav li button .item-icon span {\n display: block;\n width: 400%;\n height: 400%;\n position: absolute;\n top: 0;\n right: 0;\n background-position: top right;\n background-repeat: no-repeat;\n background-size: contain\n}\n\n.eko-gallery .eko-nav li .addons-container {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n display: flex;\n flex-direction: column;\n font-size: 10px;\n line-height: 100%\n}\n\n.eko-gallery .eko-nav li .addons-container .thumb-label {\n width: 100%;\n background: var(--navItemsBannerBackgroundColorEko);\n padding: 4px;\n text-align: center;\n text-wrap: balance;\n color: var(--primaryColorEko)\n}\n\n.eko-gallery .eko-nav li .addons-container .step-indicator {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: center;\n gap: 5px;\n padding: 6px\n}\n\n.eko-gallery .eko-nav li .addons-container .step-indicator span {\n width: 5px;\n height: 5px;\n border-radius: 100px;\n background: #fff;\n box-shadow: 0 0 3px #00000094\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label {\n position: relative\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .step-indicator {\n position: absolute;\n bottom: 0\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n align-content: center\n}\n\n.eko-gallery .eko-nav::-webkit-scrollbar {\n display: none\n}\n\n.eko-nav-container {\n display: flex\n}\n\n.eko-nav-container:has(.eko-nav.eko-not-visible) .eko-nav-arrow {\n display: none\n}\n\n.eko-nav-container {\n position: relative;\n opacity: 0;\n transition: opacity .15s ease-in\n}\n\n.eko-nav-container .eko-nav-arrow {\n width: 28px;\n height: 28px;\n position: absolute;\n display: none;\n justify-content: center;\n align-items: center;\n border-radius: 28px;\n background-color: #fff;\n box-shadow: 0 0 6px #0000001f;\n z-index: 1;\n bottom: 50%;\n opacity: 1;\n transition: opacity .15s ease-in;\n transform: translateY(50%);\n cursor: pointer\n}\n\n.eko-nav-container .eko-nav-arrow.eko-prev-nav-button svg,\n.eko-nav-container .eko-nav-arrow.eko-next-nav-button svg {\n padding: 1px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-prev-nav-button {\n left: 8px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-next-nav-button {\n right: 8px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-hidden-nav-button {\n opacity: 0;\n pointer-events: none\n}\n\n.eko-gallery .eko-nav {\n gap: var(--navItemsGapEkoMobile);\n padding: var(--navBarPaddingEkoMobile)\n}\n\n.eko-gallery .eko-nav li button img {\n width: var(--navItemsWidthEkoMobile);\n height: var(--navItemsHeightEkoMobile);\n object-fit: var(--navItemsObjectFitEkoMobile)\n}\n\n.eko-gallery .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoMobile);\n font-size: var(--navBannerFontSizeEkoMobile);\n line-height: var(--navBannerFontLineHeightEkoMobile);\n font-weight: var(--navBannerFontWeightEkoMobile)\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoMobile);\n height: var(--navItemsHeightEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li {\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile))\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoMobile);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoMobile);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoMobile) + var(--navItemsSelectedMarginEkoMobile));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoMobile) var(--accentColorEko)\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-nav {\n gap: var(--navItemsGapEkoDesktop);\n padding: var(--navBarPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li button img {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop);\n object-fit: var(--navItemsObjectFitEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoDesktop);\n font-size: var(--navBannerFontSizeEkoDesktop);\n line-height: var(--navBannerFontLineHeightEkoDesktop);\n font-weight: var(--navBannerFontWeightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li {\n border-radius: 0;\n padding: 0;\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop))\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true] {\n box-shadow: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoDesktop);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoDesktop);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoDesktop) var(--accentColorEko)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true]:after {\n content: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container .eko-nav-arrow {\n width: 30px;\n height: 30px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container .eko-nav-arrow.eko-desktop-arrows {\n display: flex\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container:has(.eko-desktop-nav-selected-underline) .eko-nav-arrow.eko-desktop-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop)) / 2))\n }\n}\n\n@media screen and (max-width: 767px) {\n .eko-gallery.eko-liquid-gallery .eko-nav-arrow.eko-mobile-arrows {\n display: flex\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container:has(.eko-mobile-nav-selected-underline) .eko-nav-arrow.eko-mobile-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile)) / 2))\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav {\n gap: var(--navItemsGapEkoDesktop);\n padding: var(--navBarPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li button img {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop);\n object-fit: var(--navItemsObjectFitEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoDesktop);\n font-size: var(--navBannerFontSizeEkoDesktop);\n line-height: var(--navBannerFontLineHeightEkoDesktop);\n font-weight: var(--navBannerFontWeightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li {\n border-radius: 0;\n padding: 0;\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop))\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true] {\n box-shadow: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoDesktop);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoDesktop);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoDesktop) var(--accentColorEko)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true]:after {\n content: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container .eko-nav-arrow {\n width: 30px;\n height: 30px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container .eko-nav-arrow.eko-desktop-arrows {\n display: flex\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container:has(.eko-desktop-nav-selected-underline) .eko-nav-arrow.eko-desktop-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop)) / 2))\n }\n}\n\n@media screen and (max-width: 767px) {\n .eko-gallery.eko-react-gallery.eko-mobile .eko-nav-arrow.eko-mobile-arrows {\n display: flex\n }\n\n .eko-gallery.eko-react-gallery.eko-mobile .eko-nav-container:has(.eko-mobile-nav-selected-underline) .eko-nav-arrow.eko-mobile-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile)) / 2))\n }\n}\n\n.eko-media-badge {\n display: none;\n width: var(--navMediaBadgeSizeEkoMobile);\n height: var(--navMediaBadgeSizeEkoMobile);\n background: #fff;\n align-items: center;\n justify-content: center;\n border-radius: 100%;\n box-shadow: 0 0 4px #00000014;\n place-content: center;\n position: absolute;\n top: var(--navMediaBadgeMarginTopEkoMobile);\n right: var(--navMediaBadgeMarginRightEkoMobile)\n}\n\n.eko-media-badge svg {\n width: 100%;\n height: 100%\n}\n\n.eko-media-badge svg path {\n fill: #000\n}\n\n.eko-nav li .eko-media-badge-mobile {\n display: flex\n}\n\nsvg.interactiveThumb {\n position: absolute;\n top: 3px;\n right: -2.5px;\n width: 100%;\n height: 100%\n}\n\nsvg.interactiveThumb.hand {\n animation: handAnim 2.5s linear infinite\n}\n\nsvg.interactiveThumb.beam {\n animation: beamAnim 2.5s linear infinite;\n transform-origin: 26% 40%;\n top: 0\n}\n\n@keyframes handAnim {\n 0% {\n transform: translateY(0)\n }\n\n 3% {\n transform: translateY(-4px)\n }\n\n 15% {\n transform: translateY(0)\n }\n\n to {\n transform: translateY(0)\n }\n}\n\n@keyframes beamAnim {\n 0% {\n transform: scale(1);\n opacity: 0\n }\n\n 5% {\n transform: scale(1.1);\n opacity: 1\n }\n\n 30% {\n transform: scale(1.4);\n opacity: 0\n }\n\n to {\n transform: scale(1.4);\n opacity: 0\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-media-badge {\n width: var(--navMediaBadgeSizeEkoDesktop);\n height: var(--navMediaBadgeSizeEkoDesktop);\n top: var(--navMediaBadgeMarginTopEkoDesktop);\n right: var(--navMediaBadgeMarginRightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .eko-media-badge-mobile {\n display: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .eko-media-badge-desktop {\n display: flex\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-media-badge {\n width: var(--navMediaBadgeSizeEkoDesktop);\n height: var(--navMediaBadgeSizeEkoDesktop);\n top: var(--navMediaBadgeMarginTopEkoDesktop);\n right: var(--navMediaBadgeMarginRightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .eko-media-badge-mobile {\n display: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .eko-media-badge-desktop {\n display: flex\n }\n}\n\n.eko-loading-animation {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow: hidden;\n pointer-events: none\n}\n\n.eko-loading-animation.eko-show-loading-animation .eko-animated-bar {\n opacity: .6\n}\n\n.eko-loading-animation.eko-show-loading-animation .eko-animated-bar .eko-animated-bar-inner {\n animation: eko-loading-bar-inner-animation 2s infinite\n}\n\n.eko-loading-animation.eko-show-loading-text .eko-loading-text {\n opacity: 1\n}\n\n.eko-loading-animation .eko-animated-bar {\n width: 100%;\n height: 4px;\n background-color: #e8e8e8b2;\n opacity: 0;\n transition: opacity .5s;\n position: relative\n}\n\n.eko-loading-animation .eko-animated-bar .eko-animated-bar-inner {\n width: 150px;\n height: 100%;\n transform: translate(-150px);\n background-color: var(--accentColorEko, #4d484b);\n display: block;\n position: absolute\n}\n\n.eko-loading-animation .eko-loading-text {\n position: absolute;\n top: 10px;\n left: 50%;\n transform: translate(-50%);\n color: #656565;\n font-size: 12px;\n font-family: Bogle-Medium, sans-serif;\n font-weight: 500;\n opacity: 0;\n align-items: center;\n display: flex;\n gap: 2px;\n transition: opacity .5s\n}\n\n.eko-loading-animation .eko-loading-text-icon {\n opacity: 60%\n}\n\n.eko-loading-animation .eko-loading-text-icon svg {\n transform: translate(2px, 2px)\n}\n\n.eko-loading-animation .eko-loading-text-icon path {\n fill: var(--accentColorEko, #4d484b)\n}\n\n.eko-loading-animation.eko-hide-icon .eko-loading-text-icon {\n display: none\n}\n\n@keyframes eko-loading-bar-inner-animation {\n 0% {\n left: -350px\n }\n\n to {\n left: calc(100% + 350px)\n }\n}\n\n.eko-smart-loading {\n position: absolute;\n top: 8px;\n left: 50%;\n transform: translate(-50%);\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px\n}\n\n.eko-smart-loading div {\n position: relative;\n width: 158px;\n height: 3px;\n background-color: #dcdcdc;\n overflow: hidden;\n opacity: 0;\n animation: eko-smart-loading-show-animation .2s linear forwards 1s\n}\n\n.eko-smart-loading div:after {\n content: "";\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background-color: #878787;\n animation: eko-smart-loading-animation 2.5s ease-in-out infinite\n}\n\n.eko-smart-loading p {\n font-size: 11px;\n line-height: 120%;\n font-weight: 500;\n color: #6b6b6b;\n text-shadow: 0 0 2px white;\n opacity: 0;\n animation: eko-smart-loading-show-animation .2s linear forwards 3s\n}\n\n@keyframes eko-smart-loading-animation {\n 0% {\n transform: translate(-100%)\n }\n\n to {\n transform: translate(100%)\n }\n}\n\n@keyframes eko-smart-loading-show-animation {\n 0% {\n opacity: 0\n }\n\n to {\n opacity: 100%\n }\n}\n\n@media screen and (min-width: 450px) {\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-animated-bar {\n height: 6px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-loading-text {\n font-size: 16px;\n top: 12px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-loading-text-icon {\n transform: rotate(180deg)\n }\n}\n\n@media screen and (min-width: 450px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-animated-bar {\n height: 6px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-loading-text {\n font-size: 16px;\n top: 12px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-loading-text-icon {\n transform: rotate(180deg)\n }\n}\n\n.eko-carousel {\n width: 100%;\n white-space: nowrap;\n overflow-x: auto;\n overflow-y: hidden;\n scroll-snap-type: x mandatory;\n overscroll-behavior-x: contain;\n align-self: start;\n align-items: start;\n display: flex;\n gap: 10px;\n scrollbar-width: none;\n -ms-overflow-style: none\n}\n\n.eko-carousel li {\n width: 100%;\n display: inline-block;\n position: relative;\n align-items: start;\n overflow: hidden;\n scroll-snap-align: center;\n scroll-snap-stop: always;\n flex-shrink: 0\n}\n\n.eko-carousel li img.eko-cover-image {\n position: relative;\n pointer-events: none;\n transition: opacity .5s;\n z-index: 1;\n width: 100%;\n height: 100%;\n background-color: var(--carouselInteractiveCoverBackgroundColorEko)\n}\n\n.eko-carousel li iframe {\n position: absolute;\n border: none;\n top: 0;\n left: 0\n}\n\n.eko-carousel li img,\n.eko-carousel li video {\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n min-width: 0;\n background-color: var(--carouselItemsBackgroundColorEko)\n}\n\n.eko-carousel li[data-type=videoembed],\n.eko-carousel li[data-type=video] {\n cursor: pointer\n}\n\n.eko-carousel::-webkit-scrollbar {\n display: none\n}\n\n.eko-carousel:has(.zoomed) {\n overflow: hidden\n}\n\n.eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoMobile)\n}\n\n.eko-carousel li img.eko-desktop-cover-image {\n display: none\n}\n\n.eko-carousel li img.eko-mobile-cover-image {\n display: inline\n}\n\n.eko-carousel li img,\n.eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoMobile);\n object-fit: var(--carouselItemsObjectFitEkoMobile)\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-carousel li img,\n .eko-gallery.eko-liquid-gallery .eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop);\n object-fit: var(--carouselItemsObjectFitEkoDesktop)\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li img,\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop);\n object-fit: var(--carouselItemsObjectFitEkoDesktop)\n }\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-nav-container {\n display: none\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-carousel {\n overflow-x: hidden\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-mobile-carousel-scroll {\n overflow-x: auto\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-nav-container {\n display: none\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-carousel {\n overflow-x: hidden\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-carousel.eko-desktop-carousel-scroll {\n overflow-x: auto\n }\n\n .eko-gallery.eko-liquid-gallery.eko-mobile-embed-layout.eko-desktop-nav-layout .eko-nav-container {\n display: flex\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-nav-container {\n display: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-carousel {\n overflow-x: hidden\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-carousel.eko-desktop-carousel-scroll {\n overflow-x: auto\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-mobile-embed-layout.eko-desktop-nav-layout .eko-nav-container {\n display: flex\n }\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-bottom .eko-nav,\n.eko-gallery.eko-desktop-nav-layout.eko-desktop-nav-bottom .eko-nav,\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-top .eko-nav,\n.eko-gallery.eko-desktop-nav-layout.eko-desktop-nav-top .eko-nav {\n flex-direction: row;\n overflow-x: auto;\n overflow-y: hidden;\n max-width: 100%;\n margin: auto\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-bottom {\n flex-direction: column-reverse\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-top {\n flex-direction: column\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-bottom {\n flex-direction: column-reverse\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-top {\n flex-direction: column\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-bottom {\n flex-direction: column-reverse\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-top {\n flex-direction: column\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right {\n flex-direction: row-reverse\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left {\n flex-direction: row\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav {\n display: flex;\n flex-direction: column;\n justify-content: start;\n overflow-x: hidden;\n overflow-y: auto;\n gap: var(--navItemsGapEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container {\n display: flex;\n flex-shrink: 0\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button {\n top: 4px;\n left: auto\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n bottom: 4px\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n right: 50%;\n transform: translate(50%)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg {\n transform: rotate(90deg)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout .eko-carousel {\n align-self: start\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right {\n flex-direction: row-reverse\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left {\n flex-direction: row\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav {\n display: flex;\n flex-direction: column;\n justify-content: start;\n overflow-x: hidden;\n overflow-y: auto;\n gap: var(--navItemsGapEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container {\n display: flex;\n flex-shrink: 0\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button {\n top: 4px;\n left: auto\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n bottom: 4px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n right: 50%;\n transform: translate(50%)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg {\n transform: rotate(90deg)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout .eko-carousel {\n align-self: start\n }\n}\n\n.eko-gallery .eko-introButton {\n cursor: pointer;\n white-space: nowrap;\n pointer-events: auto;\n position: absolute;\n bottom: 100px;\n left: 50%;\n transform: translate(-50%);\n padding: 15px 20px\n}\n\n.eko-gallery .eko-introButton .eko-handContainer {\n display: none\n}\n\n.eko-gallery {\n position: relative;\n overflow: hidden;\n display: flex;\n flex-direction: row;\n justify-content: start;\n margin-inline-start: calc(-1 * var(--outerWidth));\n margin-inline-end: calc(-1 * var(--outerWidth));\n padding: var(--galleryPaddingEkoMobile);\n margin: auto;\n max-width: var(--galleryMaxWidthEkoMobile);\n transition: height var(--galleryTransition, .8s cubic-bezier(.35, 0, 0, 1) 1.5s), padding 0s;\n gap: var(--galleryGapEkoMobile)\n}\n\n.eko-gallery .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoMobile);\n overflow: hidden;\n flex: 1;\n display: flex;\n height: fit-content\n}\n\n.eko-gallery .eko-smart-gallery-container iframe {\n width: 100%;\n aspect-ratio: var(--carouselItemsAspectRatioEkoMobile)\n}\n\n.eko-gallery .eko-smart-gallery-container.eko-project-not-ready {\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n opacity: 0;\n pointer-events: none;\n touch-action: none\n}\n\n.eko-gallery .eko-smart-gallery-container.eko-project-not-ready iframe {\n pointer-events: none;\n touch-action: none\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery {\n max-width: var(--galleryMaxWidthEkoDesktop);\n gap: var(--galleryGapEkoDesktop);\n padding: var(--galleryPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-smart-gallery-container iframe {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop)\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop {\n max-width: var(--galleryMaxWidthEkoDesktop);\n gap: var(--galleryGapEkoDesktop);\n padding: var(--galleryPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-smart-gallery-container iframe {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop)\n }\n}'),re=({layout:t,style:n})=>{let i={};return function(t={}){Object.keys(t).forEach((e=>{i[`--${e}Eko`]=t[e]}))}(n),function(t){var e,n;const r=(null==t||null===(e=t.desktop)||void 0===e?void 0:e.config)||{},o=(null==t||null===(n=t.mobile)||void 0===n?void 0:n.config)||{};Object.keys(r).forEach((t=>{"string"==typeof r[t]&&(i[`--${t}EkoDesktop`]=r[t])})),Object.keys(o).forEach((t=>{"string"==typeof o[t]&&(i[`--${t}EkoMobile`]=o[t])}))}(t),e.createElement("style",{key:{layout:t,style:n}},`.eko-gallery {${Object.keys(i).map((t=>`${t}: ${i[t]};`)).join("\n")}}`)};re.propTypes={layout:Pt.object,style:Pt.object},b("experiment");const oe=({activeVariantId:t,activeElementId:e,hasInteractive:i,experiments:r,publishItem:o})=>{const a="gallery",l=n(t),c=n(e),u=n(i),d=n(r),h=n(o);s((()=>{l.current=t,c.current=e,u.current=i,d.current=r,h.current=o}),[t,e,i,r,o]);const f={publishItemPacker:{tag:a,schema:"iglu:com.helloeko/publishitem/jsonschema/1-0-0",match:/.*/,getData:function(){const t=h.current;if(t){const e={};return null!=t&&t.id&&(e.id=t.id),null!=t&&t.productId&&(e.productid=t.productId),t.salesChannelId&&(e.saleschannelid=t.salesChannelId),null!=t&&t.salesChannelName&&(e.saleschannelname=t.salesChannelName),t.salesChannelType&&(e.saleschanneltype=t.salesChannelType),e.id?e:void 0}}},galleryInteractionPacker:{tag:a,schema:"iglu:com.helloeko/gallery_interaction/jsonschema/1-0-0",match:"gallery.interaction",getData:function({elementid:t,interactiontype:e}){return{elementid:String(t),interactiontype:e}}},galleryPacker:{tag:a,schema:"iglu:com.helloeko/gallery/jsonschema/1-0-2",match:/^gallery.*/,getData:function(){var t;return{activeitemid:c.current.toString(),activevariantid:l.current,hasinteractive:u.current,version:(null===(t=window.eko)||void 0===t||null===(t=t.gallery)||void 0===t?void 0:t.version)||""}}},activeVariantIdPacker:{tag:a,schema:"iglu:com.helloeko/variant/jsonschema/1-0-1",match:/.*/,getData:function(){if(l.current)return{id:l.current}}},experimentPacker:{tag:a,schema:"iglu:com.helloeko/experiment/jsonschema/1-0-3",match:/.*/,getData:function(){var t;let e=function(t){let e=null;if(t){const n=Math.floor(Date.now()/1e3);for(const i of t){if("deliverable"!==i.type)return;const t=Math.floor(new Date(i.startDate).getTime()/1e3),r=Math.floor(new Date(i.endDate).getTime()/1e3);!0===i.active&&n>t&&n<r&&(e=i)}}return e}(d.current);if(!e)return;let n={experimentid:e.id||"",experimentvariant:e.chosen||"pending decision",experimenttype:e.type||""},i=null===(t=e.targetDevice)||void 0===t?void 0:t.toLowerCase();return"mobile"!==i&&"notmobile"!==i||(n.experimenttargeting={device:i}),n}}};return s((()=>(Object.values(f).forEach((t=>{window.EkoAnalytics("registerContextPacker",t)})),()=>{window.EkoAnalytics("reset",a)})),[]),null};oe.propTypes={activeVariantId:Pt.string,activeElementId:Pt.number,hasInteractive:Pt.bool,experiments:Pt.array,publishItem:Pt.object};const se=({variantId:t,activeItem:i,hasInteractive:r,activeIndex:o,experiments:a,publishItem:l})=>{const c=n(!0);return s((()=>{c.current||t&&R.track("gallery.variant.change")}),[t]),s((()=>{c.current||R.track("gallery.element.change",{activeIndex:o})}),[o]),s((()=>{c.current||i&&null!=l&&l.id&&R.track("gallery.asset.view",{publishitemid:l.id,type:i.type,name:i.name})}),[i]),s((()=>{c.current=!1}),[]),e.createElement(oe,{activeVariantId:t||"ekonovar",activeElementId:o,hasInteractive:r,experiments:a,publishItem:l})};se.propTypes={variantId:Pt.string,activeItem:Pt.object,hasInteractive:Pt.bool,activeIndex:Pt.number,experiments:Pt.array,publishItem:Pt.object};const ae="eko-gallery-react";function le(t,e){var n,i,r;const o=(null==t||null===(n=t.variantMap)||void 0===n?void 0:n[e])||"ekonovar";return(null==t||null===(i=t.items)||void 0===i?void 0:i.find((t=>(null==t?void 0:t.variantId)===o)))||(null==t||null===(r=t.items)||void 0===r?void 0:r[0])}"undefined"!=typeof window&&(window.EkoAnalytics||(console.log("EkoAnalytics is not defined, initializing a no-op function..."),window.EkoAnalytics=()=>{}));const ce=a((({className:t,config:r,instanceId:o,variantId:a,activeItem:l={index:0,step:0},onEvent:c,forceMobile:u},d)=>{var h,f,p,m,v,g;const y=null!==(h=null===(f=r.options)||void 0===f?void 0:f.loadingTimeout)&&void 0!==h?h:12,b=null===(p=null===(m=r.options)||void 0===m?void 0:m.showCoverLoadAnimation)||void 0===p||p,[k,x]=i(le(r,a)),[w,_]=i({index:l.index,step:l.step,source:"external-nav"}),[T,I]=i(!1),[E,S]=i(!1),[A,N]=i("eko-desktop"),M=n(!1),F=n(!1),O=n(l),P=n(null),C=n(a);function D(){const t=u||window.innerWidth<768?"eko-mobile":"eko-desktop";N(t)}return F.current||(Wt.send("galleryinit"),F.current=!0),s((()=>{const t=C.current!==a;C.current=a,x(le(r,a)),t&&!M.current&&_({index:0,step:0,source:"external-nav"})}),[r,a]),s((()=>{if(c)return Wt.subscribe(c),()=>{Wt.unsubscribe()}}),[c]),s((()=>{M.current=E}),[E]),s((()=>{I(!1),S(!1);const t=setTimeout((()=>{M.current||(I(!0),R.track("gallery.load.timeout"))}),1e3*y);return()=>{clearTimeout(t)}}),[r]),s((()=>{D()}),[u]),s((()=>(window.addEventListener("resize",D),D(),()=>{window.removeEventListener("resize",D)})),[u]),s((()=>(window.EkoAnalytics("trackElementVisibility",P.current,ae),()=>{window.EkoAnalytics("stopTrackingElementVisibility",ae)})),[]),s((()=>{!("carousel"===(null==w?void 0:w.source)||"nav"===(null==w?void 0:w.source))||(null==w?void 0:w.index)===l.index&&(null==w?void 0:w.step)===l.step||Wt.send("activeitemchanged",{index:null==w?void 0:w.index,step:null==w?void 0:w.step})}),[w,l]),s((()=>{O.current.index===l.index&&O.current.step===l.step||(O.current=l,_({index:l.index,step:l.step,source:"external-nav"}))}),[l]),e.createElement(e.Fragment,null,e.createElement(ie,null),e.createElement(re,{layout:r.layout,style:r.style,forceMobile:u}),e.createElement(se,{variantId:a,activeItem:null==k||null===(v=k.items)||void 0===v?void 0:v[w.index],activeIndex:w.index,hasInteractive:E,experiments:r.experiments,publishItem:null==r||null===(g=r.__autoGenerated)||void 0===g?void 0:g.publishItem}),e.createElement("section",{className:`${`eko-gallery eko-react-gallery ${function(t){let e="";return["mobile","desktop"].forEach((n=>{var i,r;const o=null!==(i=null==t||null===(r=t[n])||void 0===r?void 0:r.type)&&void 0!==i?i:"nav";if(e+=`eko-${n}-${o}-layout `,"nav"===o){var s;const i="desktop"===n,r=(null==t||null===(s=t[n])||void 0===s||null===(s=s.config)||void 0===s?void 0:s.orientation)||(i?"left":"bottom");e+=`eko-${n}-nav-${r} `}})),e}(r.layout)} ${null!=t?t:""}`.trim()} ${A}`,"aria-controls":"main-content",ref:P},e.createElement(qt,{items:(null==k?void 0:k.items)||[],setActiveIndex:_,activeIndex:w.index,layout:r.layout,carouselMounted:E,forceMobile:u}),!E&&e.createElement(Yt,{ref:d,items:(null==k?void 0:k.items)||[],setActiveIndex:_,activeIndex:{index:w.index,source:null==w?void 0:w.source},showSmartLoaders:!T&&b}),!T&&e.createElement(ne,{ref:d,config:r,instanceId:o,activeItem:w,setActiveItem:_,variantId:null==k?void 0:k.variantId,smartGalleryLoaded:E,forceMobile:u,onLoad:function(){S(!0)}})))}));ce.propTypes={className:Pt.string,config:Pt.object.isRequired,instanceId:Pt.string,variantId:Pt.string,activeItem:Pt.object,onEvent:Pt.func,forceMobile:Pt.bool,onPrev:Pt.func,onNext:Pt.func},ce.displayName="EkoGallery";var ue=c(ce);const de=b("gallery-react");const he=a(((t,n)=>{var i;s((()=>(de.setDataStorage("gallery-react",{config:t.config}),window.eko=window.eko||{},window.eko.config=t.config,window.eko.gallery={version:"temporal-queue-autoscaling/4.0.4"},()=>{window.eko.config=void 0})),[t.config]);const{children:r,...o}=t;return void 0!==t.config?e.createElement(ue,q({ref:n},o,{key:null===(i=t.config.__autoGenerated)||void 0===i||null===(i=i.publishItem)||void 0===i?void 0:i.id})):r}));he.propTypes={className:Pt.string,config:Pt.object,variantId:Pt.string,onEvent:Pt.func,instanceId:Pt.string,children:Pt.node},he.displayName="EkoGalleryWrapper";var fe,pe,me,ve,ge,ye,be,ke,xe,we,_e,Te,Ie,Ee,Se,Ae,Ne,Me,Fe,Oe,Pe,Ce,De,Re,Le,Be,ze,We,Ue,je,$e,qe,Ve,Ge,He,Ke,Xe,Ye,Qe,Je,Ze,tn,en,nn,rn,on,sn,an,ln,cn,un,dn,hn=c(he);const fn=1,pn=2,mn=4,vn=8,gn=16,yn=1,bn=4,kn=8,xn=16,wn="[",_n="[!",Tn="]",In={},En=Symbol(),Sn=Symbol("filename"),An="http://www.w3.org/1999/xhtml",Nn="@attach",Mn=!0;var Fn=Array.isArray,On=Array.prototype.indexOf,Pn=Array.from,Cn=Object.defineProperty,Dn=Object.getOwnPropertyDescriptor,Rn=Object.getOwnPropertyDescriptors,Ln=Object.prototype,Bn=Array.prototype,zn=Object.getPrototypeOf,Wn=Object.isExtensible;function Un(){var t,e;return{promise:new Promise(((n,i)=>{t=n,e=i})),resolve:t,reject:e}}const jn=2,$n=4,qn=8,Vn=1<<24,Gn=16,Hn=32,Kn=64,Xn=128,Yn=512,Qn=1024,Jn=2048,Zn=4096,ti=8192,ei=16384,ni=32768,ii=65536,ri=1<<17,oi=1<<18,si=1<<19,ai=1<<20,li=1<<25,ci=32768,ui=1<<21,di=1<<22,hi=1<<23,fi=Symbol("$state"),pi=Symbol("legacy props"),mi=Symbol(""),vi=Symbol("proxy path"),gi=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},yi=3,bi=8;function ki(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 xi="font-weight: bold",wi="font-weight: normal";function _i(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",xi,wi)}function Ti(t){console.warn(`%c[svelte] state_proxy_equality_mismatch\n%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${t}\` will produce unexpected results\nhttps://svelte.dev/e/state_proxy_equality_mismatch`,xi,wi)}let Ii,Ei=!1;function Si(t){Ei=t}function Ai(t){if(null===t)throw _i(),In;return Ii=t}function Ni(){return Ai(qo(Ii))}function Mi(t){if(Ei){if(null!==qo(Ii))throw _i(),In;Ii=t}}function Fi(t=!0){for(var e=0,n=Ii;;){if(n.nodeType===bi){var i=n.data;if(i===Tn){if(0===e)return n;e-=1}else i!==wn&&i!==_n||(e+=1)}var r=qo(n);t&&n.remove(),n=r}}function Oi(t){if(!t||t.nodeType!==bi)throw _i(),In;return t.data}function Pi(t){return t===this.v}function Ci(t){return e=t,n=this.v,!(e!=e?n==n:e!==n||null!==e&&"object"==typeof e||"function"==typeof e);var e,n}let Di=!1;function Ri(t,e){return t.label=e,Li(t.v,e),t}function Li(t,e){var n;return null==t||null===(n=t[vi])||void 0===n||n.call(t,e),t}function Bi(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"),Cn(e,"stack",{value:n.join("\n")}),Cn(e,"name",{value:t}),e)}let zi=null;function Wi(t){zi=t}let Ui=null;function ji(t){Ui=t}let $i=null;function qi(t){$i=t}function Vi(t){return Ki("getContext").get(t)}function Gi(t,e=!1,n){zi={p:zi,i:!1,c:null,e:null,s:t,x:null,l:null},zi.function=n,$i=n}function Hi(t){var e,n,i=zi,r=i.e;if(null!==r)for(var o of(i.e=null,r))is(o);return i.i=!0,zi=i.p,$i=null!==(e=null===(n=zi)||void 0===n?void 0:n.function)&&void 0!==e?e:null,{}}function Ki(t){var e,n;return null===zi&&ki(t),null!==(n=(e=zi).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}(zi)||void 0)}let Xi=[];function Yi(){var t=Xi;Xi=[],function(t){for(var e=0;e<t.length;e++)t[e]()}(t)}function Qi(t){if(0===Xi.length&&!pr){var e=Xi;queueMicrotask((()=>{e===Xi&&Yi()}))}Xi.push(t)}function Ji(){for(;Xi.length>0;)Yi()}const Zi=new WeakMap;function tr(t){var e=Es;if(null===e)return _s.f|=hi,t;if(t instanceof Error&&!Zi.has(t)&&Zi.set(t,function(t,e){var n,i;const r=Dn(t,"message");if(r&&!r.configurable)return;var o=Bo?" ":"\t",s=`\n${o}in ${(null===(n=e.fn)||void 0===n?void 0:n.name)||"<unknown>"}`,a=e.ctx;for(;null!==a;){var l;s+=`\n${o}in ${null===(l=a.function)||void 0===l?void 0:l[Sn].split("/").pop()}`,a=a.p}return{message:t.message+`\n${s}\n`,stack:null===(i=t.stack)||void 0===i?void 0:i.split("\n").filter((t=>!t.includes("svelte/src/internal"))).join("\n")}}(t,e)),e.f&ni)er(t,e);else{if(!(e.f&Xn))throw!e.parent&&t instanceof Error&&nr(t),t;e.b.error(t)}}function er(t,e){for(;null!==e;){if(e.f&Xn)try{return void e.b.error(t)}catch(e){t=e}e=e.parent}throw t instanceof Error&&nr(t),t}function nr(t){const e=Zi.get(t);e&&(Cn(t,"message",{value:e.message}),Cn(t,"stack",{value:e.stack}))}const ir=-7169;function rr(t,e){t.f=t.f&ir|e}function or(t){t.f&Yn||null===t.deps?rr(t,Qn):rr(t,Zn)}function sr(t){if(null!==t)for(const e of t)e.f&jn&&e.f&ci&&(e.f^=ci,sr(e.deps))}function ar(t,e,n){t.f&Jn?e.add(t):t.f&Zn&&n.add(t),sr(t.deps),rr(t,Qn)}const lr=new Set;let cr=null,ur=null,dr=[],hr=null,fr=!1,pr=!1;var mr=new WeakMap,vr=new WeakMap,gr=new WeakMap,yr=new WeakMap,br=new WeakMap,kr=new WeakMap,xr=new WeakMap,wr=new WeakSet;class _r{constructor(){j(this,wr),$(this,"committed",!1),$(this,"current",new Map),$(this,"previous",new Map),W(this,mr,new Set),W(this,vr,new Set),W(this,gr,0),W(this,yr,0),W(this,br,null),W(this,kr,new Set),W(this,xr,new Set),$(this,"skipped_effects",new Set),$(this,"is_fork",!1)}is_deferred(){return this.is_fork||z(yr,this)>0}process(t){dr=[],this.apply();var e,n=[],i=[];for(const e of t)L(wr,this,Tr).call(this,e,n,i);(this.is_fork||L(wr,this,Er).call(this),this.is_deferred())?(L(wr,this,Ir).call(this,i),L(wr,this,Ir).call(this,n)):(cr=null,Fr(i),Fr(n),null===(e=z(br,this))||void 0===e||e.resolve());ur=null}capture(t,e){var n;(e===En||this.previous.has(t)||this.previous.set(t,e),t.f&hi)||(this.current.set(t,t.v),null===(n=ur)||void 0===n||n.set(t,t.v))}activate(){cr=this,this.apply()}deactivate(){cr===this&&(cr=null,ur=null)}flush(){if(this.activate(),dr.length>0){if(Ar(),null!==cr&&cr!==this)return}else 0===z(gr,this)&&this.process([]);this.deactivate()}discard(){for(const t of z(vr,this))t(this);z(vr,this).clear()}increment(t){U(gr,this,z(gr,this)+1),t&&U(yr,this,z(yr,this)+1)}decrement(t){U(gr,this,z(gr,this)-1),t&&U(yr,this,z(yr,this)-1),this.revive()}revive(){for(const t of z(kr,this))z(xr,this).delete(t),rr(t,Jn),Cr(t);for(const t of z(xr,this))rr(t,Zn),Cr(t);this.flush()}oncommit(t){z(mr,this).add(t)}ondiscard(t){z(vr,this).add(t)}settled(){var t;return(null!==(t=z(br,this))&&void 0!==t?t:U(br,this,Un())).promise}static ensure(){if(null===cr){const t=cr=new _r;lr.add(cr),pr||_r.enqueue((()=>{cr===t&&t.flush()}))}return cr}static enqueue(t){Qi(t)}apply(){}}function Tr(t,e,n){t.f^=Qn;for(var i=t.first,r=null;null!==i;){var o=i.f,s=!!(o&(Hn|Kn));if(!(s&&!!(o&Qn)||!!(o&ti)||this.skipped_effects.has(i))&&null!==i.fn){s?i.f^=Qn:null!==r&&o&($n|qn|Vn)?r.b.defer_effect(i):o&$n?e.push(i):Bs(i)&&(o&Gn&&z(kr,this).add(i),$s(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 Ir(t){for(var e=0;e<t.length;e+=1)ar(t[e],z(kr,this),z(xr,this))}function Er(){if(0===z(yr,this)){for(const t of z(mr,this))t();z(mr,this).clear()}0===z(gr,this)&&L(wr,this,Sr).call(this)}function Sr(){if(lr.size>1){this.previous.clear();var t=ur,e=!0;for(const t of lr){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=dr;dr=[];const e=new Set,o=new Map;for(const t of i)Or(t,r,e,o);if(dr.length>0){cr=t,t.apply();for(const e of dr)L(wr,t,Tr).call(t,e,[],[]);t.deactivate()}dr=n}}cr=null,ur=t}this.committed=!0,lr.delete(this)}function Ar(){var t=bs;fr=!0;var e=new Set;try{var n=0;for(ks(!0);dr.length>0;){var i=_r.ensure();if(n++>1e3){if(Mn){var r=new Map;for(const t of i.current.keys())for(const[e,n]of null!==(o=t.updated)&&void 0!==o?o:[]){var o,s=r.get(e);s||(s={error:n.error,count:0},r.set(e,s)),s.count+=n.count}for(const t of r.values())t.error&&console.error(t.error)}Nr()}if(i.process(dr),ko.clear(),Mn)for(const t of i.current.keys())e.add(t)}}finally{fr=!1,ks(t),hr=null;for(const t of e)t.updated=null}}function Nr(){try{!function(){{const t=new Error("effect_update_depth_exceeded\nMaximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state\nhttps://svelte.dev/e/effect_update_depth_exceeded");throw t.name="Svelte error",t}}()}catch(t){Cn(t,"stack",{value:""}),er(t,hr)}}let Mr=null;function Fr(t){var e=t.length;if(0!==e){for(var n=0;n<e;){var i,r=t[n++];if(!(r.f&(ei|ti))&&Bs(r))if(Mr=new Set,$s(r),null===r.deps&&null===r.first&&null===r.nodes&&(null===r.teardown&&null===r.ac?fs(r):r.fn=null),(null===(i=Mr)||void 0===i?void 0:i.size)>0){ko.clear();for(const t of Mr){if(t.f&(ei|ti))continue;const e=[t];let n=t.parent;for(;null!==n;)Mr.has(n)&&(Mr.delete(n),e.push(n)),n=n.parent;for(let t=e.length-1;t>=0;t--){const n=e[t];n.f&(ei|ti)||$s(n)}}Mr.clear()}}Mr=null}}function Or(t,e,n,i){if(!n.has(t)&&(n.add(t),null!==t.reactions))for(const r of t.reactions){const t=r.f;t&jn?Or(r,e,n,i):t&(di|Gn)&&!(t&Jn)&&Pr(r,e,i)&&(rr(r,Jn),Cr(r))}}function Pr(t,e,n){const i=n.get(t);if(void 0!==i)return i;if(null!==t.deps)for(const i of t.deps){if(e.includes(i))return!0;if(i.f&jn&&Pr(i,e,n))return n.set(i,!0),!0}return n.set(t,!1),!1}function Cr(t){for(var e=hr=t;null!==e.parent;){var n=(e=e.parent).f;if(fr&&e===Es&&n&Gn&&!(n&oi))return;if(n&(Kn|Hn)){if(!(n&Qn))return;e.f^=Qn}}dr.push(e)}var Dr=ii|si|Xn;var Rr=new WeakMap,Lr=new WeakMap,Br=new WeakMap,zr=new WeakMap,Wr=new WeakMap,Ur=new WeakMap,jr=new WeakMap,$r=new WeakMap,qr=new WeakMap,Vr=new WeakMap,Gr=new WeakMap,Hr=new WeakMap,Kr=new WeakMap,Xr=new WeakMap,Yr=new WeakMap,Qr=new WeakMap,Jr=new WeakMap,Zr=new WeakSet;class to{constructor(t,e,n){j(this,Zr),$(this,"parent",void 0),$(this,"is_pending",!1),W(this,Rr,void 0),W(this,Lr,Ei?Ii:null),W(this,Br,void 0),W(this,zr,void 0),W(this,Wr,void 0),W(this,Ur,null),W(this,jr,null),W(this,$r,null),W(this,qr,null),W(this,Vr,null),W(this,Gr,0),W(this,Hr,0),W(this,Kr,!1),W(this,Xr,new Set),W(this,Yr,new Set),W(this,Qr,null),W(this,Jr,function(t){let e,n=0,i=_o(0);return Ri(i,"createSubscriber version"),()=>{ts()&&(Vs(i),os((()=>(0===n&&(e=Ks((()=>t((()=>No(i)))))),n+=1,()=>{Qi((()=>{var t;n-=1,0===n&&(null===(t=e)||void 0===t||t(),e=void 0,No(i))}))}))))}}((()=>(U(Qr,this,_o(z(Gr,this))),Ri(z(Qr,this),"$effect.pending()"),()=>{U(Qr,this,null)})))),U(Rr,this,t),U(Br,this,e),U(zr,this,n),this.parent=Es.b,this.is_pending=!!z(Br,this).pending,U(Wr,this,as((()=>{if(Es.b=this,Ei){const t=z(Lr,this);Ni();t.nodeType===bi&&t.data===_n?L(Zr,this,no).call(this):(L(Zr,this,eo).call(this),0===z(Hr,this)&&(this.is_pending=!1))}else{var t=L(Zr,this,io).call(this);try{U(Ur,this,cs((()=>n(t))))}catch(t){this.error(t)}z(Hr,this)>0?L(Zr,this,oo).call(this):this.is_pending=!1}return()=>{var t;null===(t=z(Vr,this))||void 0===t||t.remove()}}),Dr)),Ei&&U(Rr,this,Ii)}defer_effect(t){ar(t,z(Xr,this),z(Yr,this))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!z(Br,this).pending}update_pending_count(t){L(Zr,this,so).call(this,t),U(Gr,this,z(Gr,this)+t),z(Qr,this)&&So(z(Qr,this),z(Gr,this))}get_effect_pending(){return z(Jr,this).call(this),Vs(z(Qr,this))}error(t){var e=z(Br,this).onerror;let n=z(Br,this).failed;if(z(Kr,this)||!e&&!n)throw t;z(Ur,this)&&(hs(z(Ur,this)),U(Ur,this,null)),z(jr,this)&&(hs(z(jr,this)),U(jr,this,null)),z($r,this)&&(hs(z($r,this)),U($r,this,null)),Ei&&(Ai(z(Lr,this)),function(t=1){if(Ei){for(var e=t,n=Ii;e--;)n=qo(n);Ii=n}}(),Ai(Fi()));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",xi,wi):(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}}(),_r.ensure(),U(Gr,this,0),null!==z($r,this)&&ps(z($r,this),(()=>{U($r,this,null)})),this.is_pending=this.has_pending_snippet(),U(Ur,this,L(Zr,this,ro).call(this,(()=>(U(Kr,this,!1),cs((()=>z(zr,this).call(this,z(Rr,this)))))))),z(Hr,this)>0?L(Zr,this,oo).call(this):this.is_pending=!1)};var s=_s;try{Is(null),r=!0,null==e||e(t,o),r=!1}catch(t){er(t,z(Wr,this)&&z(Wr,this).parent)}finally{Is(s)}n&&Qi((()=>{U($r,this,L(Zr,this,ro).call(this,(()=>{_r.ensure(),U(Kr,this,!0);try{return cs((()=>{n(z(Rr,this),(()=>t),(()=>o))}))}catch(t){return er(t,z(Wr,this).parent),null}finally{U(Kr,this,!1)}})))}))}}function eo(){try{U(Ur,this,cs((()=>z(zr,this).call(this,z(Rr,this)))))}catch(t){this.error(t)}}function no(){const t=z(Br,this).pending;t&&(U(jr,this,cs((()=>t(z(Rr,this))))),_r.enqueue((()=>{var t=L(Zr,this,io).call(this);U(Ur,this,L(Zr,this,ro).call(this,(()=>(_r.ensure(),cs((()=>z(zr,this).call(this,t))))))),z(Hr,this)>0?L(Zr,this,oo).call(this):(ps(z(jr,this),(()=>{U(jr,this,null)})),this.is_pending=!1)})))}function io(){var t=z(Rr,this);return this.is_pending&&(U(Vr,this,jo()),z(Rr,this).before(z(Vr,this)),t=z(Vr,this)),t}function ro(t){var e=Es,n=_s,i=zi;Ss(z(Wr,this)),Is(z(Wr,this)),Wi(z(Wr,this).ctx);try{return t()}catch(t){return tr(t),null}finally{Ss(e),Is(n),Wi(i)}}function oo(){const t=z(Br,this).pending;null!==z(Ur,this)&&(U(qr,this,document.createDocumentFragment()),z(qr,this).append(z(Vr,this)),ys(z(Ur,this),z(qr,this))),null===z(jr,this)&&U(jr,this,cs((()=>t(z(Rr,this)))))}function so(t){var e;if(this.has_pending_snippet()){if(U(Hr,this,z(Hr,this)+t),0===z(Hr,this)){this.is_pending=!1;for(const t of z(Xr,this))rr(t,Jn),Cr(t);for(const t of z(Yr,this))rr(t,Zn),Cr(t);z(Xr,this).clear(),z(Yr,this).clear(),z(jr,this)&&ps(z(jr,this),(()=>{U(jr,this,null)})),z(qr,this)&&(z(Rr,this).before(z(qr,this)),U(qr,this,null))}}else this.parent&&L(Zr,e=this.parent,so).call(e,t)}function ao(t,e,n,i){const r=uo;if(0!==n.length||0!==t.length){var o,s,a,l,c,u=cr,d=Es,h=(o=Es,s=_s,a=zi,l=cr,c=Ui,function(t=!0){Ss(o),Is(s),Wi(a),t&&(null==l||l.activate()),ji(c)});t.length>0?Promise.all(t).then((()=>{h();try{return f()}finally{null==u||u.deactivate(),lo()}})):f()}else i(e.map(r));function f(){Promise.all(n.map((t=>ho(t)))).then((t=>{h();try{i([...e.map(r),...t])}catch(t){d.f&ei||er(t,d)}null==u||u.deactivate(),lo()})).catch((t=>{er(t,d)}))}}function lo(){Ss(null),Is(null),Wi(null),ji(null)}const co=new Set;function uo(t){var e=jn|Jn,n=null!==_s&&_s.f&jn?_s:null;null!==Es&&(Es.f|=si);return{ctx:zi,deps:null,effects:null,equals:Pi,f:e,fn:t,reactions:null,rv:0,v:En,wv:0,parent:null!=n?n:Es,ac:null}}function ho(t,e,n){let i=Es;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=_o(En);s.label=e;var a=!_s,l=new Map;return function(t){Zo(di|si,t,!0)}((()=>{var e=Un();o=e.promise;try{Promise.resolve(t()).then(e.resolve,e.reject).then((()=>{n===cr&&n.committed&&n.deactivate(),lo()}))}catch(t){e.reject(t),lo()}var n=cr;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(gi),l.delete(n),l.set(n,e)}const u=(t,e=void 0)=>{if(n.activate(),e)e!==gi&&(s.f|=hi,So(s,e));else{s.f&hi&&(s.f^=hi),So(s,t);for(const[t,e]of l){if(l.delete(t),t===n)break;e.reject(gi)}}a&&(r.update_pending_count(-1),n.decrement(c))};e.promise.then(u,(t=>u(null,t||"unknown")))})),es((()=>{for(const t of l.values())t.reject(gi)})),s.f|=di,new Promise((t=>{!function e(n){function i(){n===o?t(s):e(o)}n.then(i,i)}(o)}))}function fo(t){const e=uo(t);return Ns(e),e}function po(t){const e=uo(t);return e.equals=Ci,e}function mo(t){var e=t.effects;if(null!==e){t.effects=null;for(var n=0;n<e.length;n+=1)hs(e[n])}}let vo=[];function go(t){var e,n=Es;Ss(function(t){for(var e=t.parent;null!==e;){if(!(e.f&jn))return e.f&ei?null:e;e=e.parent}return null}(t));{let i=bo;xo(new Set);try{vo.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}}(),vo.push(t),t.f&=~ci,mo(t),e=Ws(t)}finally{Ss(n),xo(i),vo.pop()}}return e}function yo(t){var e,n,i=go(t);if(!t.equals(i)&&(t.wv=Ls(),(null===(e=cr)||void 0===e||!e.is_fork||null===t.deps)&&(t.v=i,null===t.deps)))return void rr(t,Qn);xs||(null!==ur?(ts()||null!==(n=cr)&&void 0!==n&&n.is_fork)&&ur.set(t,i):or(t))}let bo=new Set;const ko=new Map;function xo(t){bo=t}let wo=!1;function _o(t,e){return{f:0,v:t,reactions:null,equals:Pi,rv:0,wv:0}}function To(t,e){const n=_o(t);return Ns(n),n}function Io(t,e=!1,n=!0){const i=_o(t);return e||(i.equals=Ci),i}function Eo(t,e,n=!1){var i;null!==_s&&(!Ts||_s.f&ri)&&_s.f&(jn|Gn|di|ri)&&(null===(i=As)||void 0===i||!i.includes(t))&&function(){{const t=new Error("state_unsafe_mutation\nUpdating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw t.name="Svelte error",t}}();let r=n?Oo(e):e;return Li(r,t.label),So(t,r)}function So(t,e){if(!t.equals(e)){var n=t.v;xs?ko.set(t,e):ko.set(t,n),t.v=e;var i=_r.ensure();if(i.capture(t,n),null!==Es){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=Bi("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!==Es&&(t.set_during_effect=!0),t.f&jn){const e=t;t.f&Jn&&go(e),or(e)}t.wv=Ls(),Mo(t,Jn),null!==Es&&Es.f&Qn&&!(Es.f&(Hn|Kn))&&(null===Os?function(t){Os=t}([t]):Os.push(t)),!i.is_fork&&bo.size>0&&!wo&&Ao()}return e}function Ao(){wo=!1;var t=bs;ks(!0);const e=Array.from(bo);try{for(const t of e)t.f&Qn&&rr(t,Zn),Bs(t)&&$s(t)}finally{ks(t)}bo.clear()}function No(t){Eo(t,t.v+1)}function Mo(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&ri)bo.add(o);else{var a=!(s&Jn);if(a&&rr(o,e),s&jn){var l,c=o;null===(l=ur)||void 0===l||l.delete(c),s&ci||(s&Yn&&(o.f|=ci),Mo(c,Zn))}else a&&(s&Gn&&null!==Mr&&Mr.add(o),Cr(o))}}}const Fo=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function Oo(t){if("object"!=typeof t||null===t||fi in t)return t;const e=zn(t);if(e!==Ln&&e!==Bn)return t;var n=new Map,i=Fn(t),r=To(0),o=Ds,s=t=>{if(Ds===o)return t();var e=_s,n=Ds;Is(null),Rs(o);var i=t();return Is(e),Rs(n),i};i&&(n.set("length",To(t.length)),t=new Proxy(t,{get(t,e,n){var i=Reflect.get(t,e,n);return Do.has(e)?function(...t){wo=!0;var e=i.apply(this,t);return Ao(),e}:i}}));var a="";let l=!1;function c(t){if(!l){l=!0,Ri(r,`${a=t} version`);for(const[t,e]of n)Ri(e,Po(a,t));l=!1}}return new Proxy(t,{defineProperty(t,e,i){"value"in i&&!1!==i.configurable&&!1!==i.enumerable&&!1!==i.writable||function(){{const t=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw t.name="Svelte error",t}}();var r=n.get(e);return void 0===r?r=s((()=>{var t=To(i.value);return n.set(e,t),"string"==typeof e&&Ri(t,Po(a,e)),t})):Eo(r,i.value,!0),!0},deleteProperty(t,e){var i=n.get(e);if(void 0===i){if(e in t){const t=s((()=>To(En)));n.set(e,t),No(r),Ri(t,Po(a,e))}}else Eo(i,En),No(r);return!0},get(e,i,r){var o;if(i===fi)return t;if(i===vi)return c;var l=n.get(i),u=i in e;if(void 0===l&&(!u||null!==(o=Dn(e,i))&&void 0!==o&&o.writable)&&(l=s((()=>{var t=To(Oo(u?e[i]:En));return Ri(t,Po(a,i)),t})),n.set(i,l)),void 0!==l){var d=Vs(l);return d===En?void 0:d}return Reflect.get(e,i,r)},getOwnPropertyDescriptor(t,e){var i=Reflect.getOwnPropertyDescriptor(t,e);if(i&&"value"in i){var r=n.get(e);r&&(i.value=Vs(r))}else if(void 0===i){var o=n.get(e),s=null==o?void 0:o.v;if(void 0!==o&&s!==En)return{enumerable:!0,configurable:!0,value:s,writable:!0}}return i},has(t,e){var i;if(e===fi)return!0;var r=n.get(e),o=void 0!==r&&r.v!==En||Reflect.has(t,e);if((void 0!==r||null!==Es&&(!o||null!==(i=Dn(t,e))&&void 0!==i&&i.writable))&&(void 0===r&&(r=s((()=>{var n=To(o?Oo(t[e]):En);return Ri(n,Po(a,e)),n})),n.set(e,r)),Vs(r)===En))return!1;return o},set(t,e,o,l){var c,u=n.get(e),d=e in t;if(i&&"length"===e)for(var h=o;h<u.v;h+=1){var f=n.get(h+"");void 0!==f?Eo(f,En):h in t&&(f=s((()=>To(En))),n.set(h+"",f),Ri(f,Po(a,h)))}void 0===u?(!d||null!==(c=Dn(t,e))&&void 0!==c&&c.writable)&&(Ri(u=s((()=>To(void 0))),Po(a,e)),Eo(u,Oo(o)),n.set(e,u)):(d=u.v!==En,Eo(u,s((()=>Oo(o)))));var p=Reflect.getOwnPropertyDescriptor(t,e);if(null!=p&&p.set&&p.set.call(l,o),!d){if(i&&"string"==typeof e){var m=n.get("length"),v=Number(e);Number.isInteger(v)&&v>=m.v&&Eo(m,v+1)}No(r)}return!0},ownKeys(t){Vs(r);var e=Reflect.ownKeys(t).filter((t=>{var e=n.get(t);return void 0===e||e.v!==En}));for(var[i,o]of n)o.v===En||i in t||e.push(i);return e},setPrototypeOf(){!function(){{const t=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw t.name="Svelte error",t}}()}})}function Po(t,e){var n;return"symbol"==typeof e?`${t}[Symbol(${null!==(n=e.description)&&void 0!==n?n:""})]`:Fo.test(e)?`${t}.${e}`:/^\d+$/.test(e)?`${t}[${e}]`:`${t}['${e}']`}function Co(t){try{if(null!==t&&"object"==typeof t&&fi in t)return t[fi]}catch{}return t}const Do=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function Ro(t,e,n=!0){try{t===e!=(Co(t)===Co(e))&&Ti(n?"===":"!==")}catch{}return t===e===n}var Lo,Bo,zo,Wo;function Uo(){if(void 0===Lo){Lo=window,Bo=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;zo=Dn(e,"firstChild").get,Wo=Dn(e,"nextSibling").get,Wn(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),Wn(n)&&(n.__t=void 0),t.__svelte_meta=null,function(){const t=Array.prototype,e=Array.__svelte_cleanup;e&&e();const{indexOf:n,lastIndexOf:i,includes:r}=t;t.indexOf=function(t,e){const i=n.call(this,t,e);if(-1===i)for(let n=null!=e?e:0;n<this.length;n+=1)if(Co(this[n])===t){Ti("array.indexOf(...)");break}return i},t.lastIndexOf=function(t,e){const n=i.call(this,t,null!=e?e:this.length-1);if(-1===n)for(let n=0;n<=(null!=e?e:this.length-1);n+=1)if(Co(this[n])===t){Ti("array.lastIndexOf(...)");break}return n},t.includes=function(t,e){const n=r.call(this,t,e);if(!n)for(let e=0;e<this.length;e+=1)if(Co(this[e])===t){Ti("array.includes(...)");break}return n},Array.__svelte_cleanup=()=>{t.indexOf=n,t.lastIndexOf=i,t.includes=r}}()}}function jo(t=""){return document.createTextNode(t)}function $o(t){return zo.call(t)}function qo(t){return Wo.call(t)}function Vo(t,e){if(!Ei)return $o(t);var n=$o(Ii);if(null===n)n=Ii.appendChild(jo());else if(e&&n.nodeType!==yi){var i,r=jo();return null===(i=n)||void 0===i||i.before(r),Ai(r),r}return Ai(n),n}function Go(t,e=!1){var n;if(!Ei){var i=$o(t);return i instanceof Comment&&""===i.data?qo(i):i}if(e&&(null===(n=Ii)||void 0===n?void 0:n.nodeType)!==yi){var r,o=jo();return null===(r=Ii)||void 0===r||r.before(o),Ai(o),o}return Ii}function Ho(t,e=1,n=!1){var i;let r=Ei?Ii:t;for(var o;e--;)o=r,r=qo(r);if(!Ei)return r;if(n&&(null===(i=r)||void 0===i?void 0:i.nodeType)!==yi){var s,a=jo();if(null===r)null===(s=o)||void 0===s||s.after(a);else r.before(a);return Ai(a),a}return Ai(r),r}function Ko(t){t.textContent=""}function Xo(t,e){if(e){const e=document.body;t.autofocus=!0,Qi((()=>{document.activeElement===e&&t.focus()}))}}let Yo=!1;function Qo(t){var e=_s,n=Es;Is(null),Ss(null);try{return t()}finally{Is(e),Ss(n)}}function Jo(t){null===Es&&(null===_s&&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}}()),xs&&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 Zo(t,e,n){for(var i=Es;null!==i&&i.f&ri;)i=i.parent;null!==i&&i.f&ti&&(t|=ti);var r={ctx:zi,deps:null,nodes:null,f:t|Jn|Yn,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=$i,n)try{$s(r),r.f|=ni}catch(t){throw hs(r),t}else null!==e&&Cr(r);var o=r;if(!n||null!==o.deps||null!==o.teardown||null!==o.nodes||o.first!==o.last||o.f&si||(o=o.first,t&Gn&&t&ii&&null!==o&&(o.f|=ii)),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!==_s&&_s.f&jn&&!(t&Kn))){var s,a=_s;(null!==(s=a.effects)&&void 0!==s?s:a.effects=[]).push(o)}return r}function ts(){return null!==_s&&!Ts}function es(t){const e=Zo(qn,null,!1);return rr(e,Qn),e.teardown=t,e}function ns(t){Jo("$effect"),Cn(t,"name",{value:"$effect"});var e=Es.f;if(!!(_s||!(e&Hn)||e&ni))return is(t);var n,i=zi;(null!==(n=i.e)&&void 0!==n?n:i.e=[]).push(t)}function is(t){return Zo($n|ai,t,!1)}function rs(t){return Zo($n,t,!1)}function os(t,e=0){return Zo(qn|e,t,!0)}function ss(t,e=[],n=[],i=[]){ao(i,e,n,(e=>{Zo(qn,(()=>t(...e.map(Vs))),!0)}))}function as(t,e=0){var n=Zo(Gn|e,t,!0);return n.dev_stack=Ui,n}function ls(t,e=0){var n=Zo(Vn|e,t,!0);return n.dev_stack=Ui,n}function cs(t){return Zo(Hn|si,t,!0)}function us(t){var e=t.teardown;if(null!==e){const t=xs,n=_s;ws(!0),Is(null);try{e.call(null)}finally{ws(t),Is(n)}}}function ds(t,e=!1){var n=t.first;for(t.first=t.last=null;null!==n;){const t=n.ac;null!==t&&Qo((()=>{t.abort(gi)}));var i=n.next;n.f&Kn?n.parent=null:hs(n,e),n=i}}function hs(t,e=!0){var n=!1;(e||t.f&oi)&&null!==t.nodes&&null!==t.nodes.end&&(!function(t,e){for(;null!==t;){var n=t===e?null:qo(t);t.remove(),t=n}}(t.nodes.start,t.nodes.end),n=!0),ds(t,e&&!n),js(t,0),rr(t,ei);var i=t.nodes&&t.nodes.t;if(null!==i)for(const t of i)t.stop();us(t);var r=t.parent;null!==r&&null!==r.first&&fs(t),t.component_function=null,t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=null}function fs(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 ps(t,e,n=!0){var i=[];ms(t,i,!0);var r=()=>{n&&hs(t),e&&e()},o=i.length;if(o>0){var s=()=>--o||r();for(var a of i)a.out(s)}else r()}function ms(t,e,n){if(!(t.f&ti)){t.f^=ti;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;ms(r,e,!!(!!(r.f&ii)||!!(r.f&Hn)&&!!(t.f&Gn))&&n),r=o}}}function vs(t){gs(t,!0)}function gs(t,e){if(t.f&ti){t.f^=ti,t.f&Qn||(rr(t,Jn),Cr(t));for(var n=t.first;null!==n;){var i=n.next;gs(n,!!(!!(n.f&ii)||!!(n.f&Hn))&&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 ys(t,e){if(t.nodes)for(var n=t.nodes.start,i=t.nodes.end;null!==n;){var r=n===i?null:qo(n);e.append(n),n=r}}let bs=!1;function ks(t){bs=t}let xs=!1;function ws(t){xs=t}let _s=null,Ts=!1;function Is(t){_s=t}let Es=null;function Ss(t){Es=t}let As=null;function Ns(t){null!==_s&&(null===As?As=[t]:As.push(t))}let Ms=null,Fs=0,Os=null;let Ps=1,Cs=0,Ds=Cs;function Rs(t){Ds=t}function Ls(){return++Ps}function Bs(t){var e=t.f;if(e&Jn)return!0;if(e&jn&&(t.f&=~ci),e&Zn){for(var n=t.deps,i=n.length,r=0;r<i;r++){var o=n[r];if(Bs(o)&&yo(o),o.wv>t.wv)return!0}e&Yn&&null===ur&&rr(t,Qn)}return!1}function zs(t,e,n=!0){var i,r=t.reactions;if(null!==r&&(null===(i=As)||void 0===i||!i.includes(t)))for(var o=0;o<r.length;o++){var s=r[o];s.f&jn?zs(s,e,!1):e===s&&(n?rr(s,Jn):s.f&Qn&&rr(s,Zn),Cr(s))}}function Ws(t){var e=Ms,n=Fs,i=Os,r=_s,o=As,s=zi,a=Ts,l=Ds,c=t.f;Ms=null,Fs=0,Os=null,_s=c&(Hn|Kn)?null:t,As=null,Wi(t.ctx),Ts=!1,Ds=++Cs,null!==t.ac&&(Qo((()=>{t.ac.abort(gi)})),t.ac=null);try{t.f|=ui;var u=(0,t.fn)(),d=t.deps;if(null!==Ms){var h;if(js(t,Fs),null!==d&&Fs>0)for(d.length=Fs+Ms.length,h=0;h<Ms.length;h++)d[Fs+h]=Ms[h];else t.deps=d=Ms;if(ts()&&t.f&Yn)for(h=Fs;h<d.length;h++){var f,p;(null!==(p=(f=d[h]).reactions)&&void 0!==p?p:f.reactions=[]).push(t)}}else null!==d&&Fs<d.length&&(js(t,Fs),d.length=Fs);if(!(null===Os||Ts||null===d||t.f&(jn|Zn|Jn)))for(h=0;h<Os.length;h++)zs(Os[h],t);return null!==r&&r!==t&&(Cs++,null!==Os&&(null===i?i=Os:i.push(...Os))),t.f&hi&&(t.f^=hi),u}catch(t){return tr(t)}finally{t.f^=ui,Ms=e,Fs=n,Os=i,_s=r,As=o,Wi(s),Ts=a,Ds=l}}function Us(t,e){let n=e.reactions;if(null!==n){var i=On.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&jn&&(null===Ms||!Ms.includes(e))){var o=e;o.f&Yn&&(o.f^=Yn,o.f&=~ci),or(o),mo(o),js(o,0)}}function js(t,e){var n=t.deps;if(null!==n)for(var i=e;i<n.length;i++)Us(t,n[i])}function $s(t){var e=t.f;if(!(e&ei)){rr(t,Qn);var n=Es,i=bs;Es=t,bs=!0;var r,o=$i;qi(t.component_function);var s=Ui;ji(null!==(r=t.dev_stack)&&void 0!==r?r:Ui);try{e&(Gn|Vn)?function(t){for(var e=t.first;null!==e;){var n=e.next;e.f&Hn||hs(e),e=n}}(t):ds(t),us(t);var a=Ws(t);t.teardown="function"==typeof a?a:null,t.wv=Ps,Mn&&Di&&t.f&Jn&&t.deps}finally{bs=i,Es=n,qi(o),ji(s)}}}async function qs(){await Promise.resolve(),function(){var t=pr;pr=!0;try{for(;;){var e;if(Ji(),0===dr.length&&(null===(e=cr)||void 0===e||e.flush(),0===dr.length))return void(hr=null);Ar()}}finally{pr=t}}()}function Vs(t){var e,n,i=!!(t.f&jn);if(null!==_s&&!Ts&&!(null!==Es&&!!(Es.f&ei)||null!==(n=As)&&void 0!==n&&n.includes(t))){var r=_s.deps;if(_s.f&ui)t.rv<Cs&&(t.rv=Cs,null===Ms&&null!==r&&r[Fs]===t?Fs++:null===Ms?Ms=[t]:Ms.includes(t)||Ms.push(t));else{var o,s;(null!==(s=(o=_s).deps)&&void 0!==s?s:o.deps=[]).push(t);var a=t.reactions;null===a?t.reactions=[_s]:a.includes(_s)||a.push(_s)}}if(co.delete(t),xs&&ko.has(t))return ko.get(t);if(i){var l=t;if(xs){var c=l.v;return(l.f&Qn||null===l.reactions)&&!Hs(l)||(c=go(l)),ko.set(l,c),c}var u=!(l.f&Yn)&&!Ts&&null!==_s&&(bs||!!(_s.f&Yn)),d=null===l.deps;Bs(l)&&(u&&(l.f|=Yn),yo(l)),u&&!d&&Gs(l)}if(null!==(e=ur)&&void 0!==e&&e.has(t))return ur.get(t);if(t.f&hi)throw t.v;return t.v}function Gs(t){if(null!==t.deps){t.f|=Yn;for(const n of t.deps){var e;(null!==(e=n.reactions)&&void 0!==e?e:n.reactions=[]).push(t),n.f&jn&&!(n.f&Yn)&&Gs(n)}}}function Hs(t){if(t.v===En)return!0;if(null===t.deps)return!1;for(const e of t.deps){if(ko.has(e))return!0;if(e.f&jn&&Hs(e))return!0}return!1}function Ks(t){var e=Ts;try{return Ts=!0,t()}finally{Ts=e}}const Xs=new Set,Ys=new Set;function Qs(t,e,n,i={}){function r(t){if(i.capture||ea.call(e,t),!t.cancelBubble)return Qo((()=>null==n?void 0:n.call(this,t)))}return t.startsWith("pointer")||t.startsWith("touch")||"wheel"===t?Qi((()=>{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=Qs(t,e,n,o);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&es((()=>{e.removeEventListener(t,s,o)}))}function Zs(t){for(var e=0;e<t.length;e++)Xs.add(t[e]);for(var n of Ys)n(t)}let ta=null;function ea(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;ta=t;var a=0,l=ta===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){Cn(t,"currentTarget",{configurable:!0,get:()=>s||i});var d=_s,h=Es;Is(null),Ss(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,Is(d),Ss(h)}}}function na(t,e){var n=Es;null===n.nodes&&(n.nodes={start:t,end:e,a:null,t:null})}function ia(t,e){var n,i=!!(1&e),r=!!(2&e),o=!t.startsWith("<!>");return()=>{if(Ei)return na(Ii,null),Ii;var e,s;void 0===n&&(e=o?t:"<!>"+t,(s=document.createElement("template")).innerHTML=e.replaceAll("<!>","\x3c!----\x3e"),n=s.content,i||(n=$o(n)));var a=r||Bo?document.importNode(n,!0):n.cloneNode(!0);i?na($o(a),a.lastChild):na(a,a);return a}}function ra(){if(Ei)return na(Ii,null),Ii;var t=document.createDocumentFragment(),e=document.createComment(""),n=jo();return t.append(e,n),na(e,n),t}function oa(t,e){if(Ei){var n=Es;return n.f&ni&&null!==n.nodes.end||(n.nodes.end=Ii),void Ni()}null!==t&&t.before(e)}function sa(t){return t.endsWith("capture")&&"gotpointercapture"!==t&&"lostpointercapture"!==t}const aa=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function la(t){return aa.includes(t)}const ca={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 ua(t){var e;return t=t.toLowerCase(),null!==(e=ca[t])&&void 0!==e?e:t}const da=["touchstart","touchmove"];function ha(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 fa(t,e){return va(t,e)}function pa(t,e){var n;Uo(),e.intro=null!==(n=e.intro)&&void 0!==n&&n;const i=e.target,r=Ei,o=Ii;try{for(var s=$o(i);s&&(s.nodeType!==bi||s.data!==wn);)s=qo(s);if(!s)throw In;Si(!0),Ai(s);const n=va(t,{...e,anchor:s});return Si(!1),n}catch(n){if(n instanceof Error&&n.message.split("\n").some((t=>t.startsWith("https://svelte.dev/e/"))))throw n;return n!==In&&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}}(),Uo(),Ko(i),Si(!1),fa(t,e)}finally{Si(r),Ai(o)}}const ma=new Map;function va(t,{target:e,anchor:n,props:i={},events:r,context:o,intro:s=!0}){Uo();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,da.includes(s));e.addEventListener(i,ea,{passive:r});var o=ma.get(i);void 0===o?(document.addEventListener(i,ea,{passive:r}),ma.set(i,1)):ma.set(i,o+1)}}var s};l(Pn(Xs)),Ys.add(l);var c=void 0,u=function(t){_r.ensure();const e=Zo(Kn|si,t,!0);return(t={})=>new Promise((n=>{t.outro?ps(e,(()=>{hs(e),n(void 0)})):(hs(e),n(void 0))}))}((()=>{var s=null!=n?n:e.appendChild(jo());return function(t,e,n){new to(t,e,n)}(s,{pending:()=>{}},(e=>{o&&(Gi({}),zi.c=o);if(r&&(i.$$events=r),Ei&&na(e,null),c=t(e,i)||{},Ei&&(Es.nodes.end=Ii,null===Ii||Ii.nodeType!==bi||Ii.data!==Tn))throw _i(),In;o&&Hi()})),()=>{for(var t of a){e.removeEventListener(t,ea);var i=ma.get(t);0==--i?(document.removeEventListener(t,ea),ma.delete(t)):ma.set(t,i)}var r;(Ys.delete(l),s!==n)&&(null===(r=s.parentNode)||void 0===r||r.removeChild(s))}}));return ga.set(c,u),c}let ga=new WeakMap;function ya(t,e){const n=ga.get(t);return n?(ga.delete(t),n(e)):(fi 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",xi,wi):console.warn("%c[svelte] lifecycle_double_unmount\n%cTried to unmount a component that was not mounted\nhttps://svelte.dev/e/lifecycle_double_unmount",xi,wi),Promise.resolve())}class ba{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=cr;if(this.#t.has(t)){var e=this.#t.get(t),n=this.#e.get(e);if(n)vs(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&&(hs(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();ys(i,e),e.append(jo()),this.#n.set(t,{effect:i,fragment:e})}else hs(i);this.#i.delete(t),this.#e.delete(t)};this.#r||!n?(this.#i.add(t),ps(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)||(hs(n.effect),this.#n.delete(t))};ensure(t,e){var n=cr;!e||this.#e.has(t)||this.#n.has(t)||this.#e.set(t,cs((()=>e(this.anchor)))),this.#t.set(n,t),Ei&&(this.anchor=Ii),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 ka,xa=new Map;function wa(t,e,n=!1){Ei&&Ni();var i=new ba(t);function r(e,n){if(Ei){if(e===(Oi(t)===_n)){var r=Fi();return Ai(r),i.anchor=r,Si(!1),i.ensure(e,n),void Si(!0)}}i.ensure(e,n)}as((()=>{var t=!1;e(((e,n=!0)=>{t=!0,r(n,e)})),t||r(!1,null)}),n?ii:0)}function _a(t,e){return e}function Ta(t,e=!0){for(var n=0;n<t.length;n++)hs(t[n],e)}function Ia(t,e,n,i,r,o=null){var s=t,a=new Map;if(!!(e&mn)){var l=t;s=Ei?Ai($o(l)):l.appendChild(jo())}Ei&&Ni();var c,u=null,d=po((()=>{var t=n();return Fn(t)?t:null==t?[]:Pn(t)})),h=!0;function f(){m.fallback=u,function(t,e,n,i,r){var o,s,a,l,c,u=!!(i&vn),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&li))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&li){if(l.f^=li,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),Aa(t,p,l),Aa(t,l,b),Sa(l,b,n),m=[],v=[],f=(p=l).next;continue}Sa(l,null,n)}var k,x;if(l.f&ti)if(vs(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)Sa(m[w],_,n);for(w=0;w<v.length;w+=1)o.delete(v[w]);Aa(t,T.prev,I.next),Aa(t,p,T),Aa(t,I,_),f=_,p=I,c-=1,m=[],v=[]}else o.delete(l),Sa(l,f,n),Aa(t,l.prev,l.next),Aa(t,l,null===p?t.effect.first:p.next),Aa(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&li||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)Ta(Pn(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&ti||A.push(l);for(;null!==f;)f.f&ti||f===t.fallback||A.push(f),f=f.next;var N=A.length;if(N>0){var M=i&mn&&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 O;null===(O=A[c].nodes)||void 0===O||null===(O=O.a)||void 0===O||O.fix()}}!function(t,e,n){for(var i,r=e.length,o=e.length,s=0;s<r;s++){let n=e[s];ps(n,(()=>{if(i){if(i.pending.delete(n),i.done.add(n),0===i.pending.size){var e=t.outrogroups;Ta(Pn(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;Ko(c),c.append(l),t.items.clear()}Ta(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&&Qi((()=>{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&li?(u.f^=li,Sa(u,null,s)):vs(u):ps(u,(()=>{u=null})))}var p=as((()=>{var t=(c=Vs(d)).length;let l=!1;Ei&&(Oi(s)===_n!==(0===t)&&(Ai(s=Fi()),Si(!1),l=!0));for(var p=new Set,m=0;m<t;m+=1){Ei&&Ii.nodeType===bi&&Ii.data===Tn&&(s=Ii,l=!0,Si(!1));var v,g=c[m],y=i(g,m),b=h?null:a.get(y);if(b)b.v&&So(b.v,g),b.i&&So(b.i,m);else b=Ea(a,h?s:null!==(v=ka)&&void 0!==v?v:ka=jo(),g,y,m,r,e,n),h||(b.e.f|=li),a.set(y,b);p.add(y)}0===t&&o&&!u&&(h?u=cs((()=>o(s))):(u=cs((()=>{var t;return o(null!==(t=ka)&&void 0!==t?t:ka=jo())}))).f|=li),Ei&&t>0&&Ai(Fi()),h||f(),l&&Si(!0),Vs(d)})),m={effect:p,items:a,outrogroups:null,fallback:u};h=!1,Ei&&(s=Ii)}function Ea(t,e,n,i,r,o,s,a){var l=s&fn?s&gn?_o(n):Io(n,!1,!1):null,c=s&pn?_o(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:cs((()=>(o(e,null!=l?l:n,null!=c?c:r,a),()=>{t.delete(i)})))}}function Sa(t,e,n){if(t.nodes)for(var i=t.nodes.start,r=t.nodes.end,o=!e||e.f&li?n:e.nodes.start;null!==i;){var s=qo(i);if(o.before(i),i===r)return;i=s}}function Aa(t,e,n){null===e?t.effect.first=n:e.next=n,null===n?t.effect.last=e:n.prev=e}function Na(t,e){rs((()=>{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=xa.get(t);n||(n=new Set,xa.set(t,n)),n.add(e)}(e.hash,t)}}))}function Ma(t,e){var n,i=void 0;ls((()=>{i!==(i=e())&&(n&&(hs(n),n=null),i&&(n=cs((()=>{rs((()=>i(t)))}))))}))}function Fa(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=Fa(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function Oa(t){return"object"==typeof t?function(){for(var t,e,n=0,i="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=Fa(t))&&(i&&(i+=" "),i+=e);return i}(t):null!=t?t:""}const Pa=[..." \t\n\r\f \v\ufeff"];function Ca(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 Da(t){return"-"!==t[0]||"-"!==t[1]?t.toLowerCase():t}function Ra(t,e,n,i,r,o){var s=t.__className;if(Ei||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&&!Pa.includes(i[s-1])||a!==i.length&&!Pa.includes(i[a])?s=a:i=(0===s?"":i.substring(0,s))+i.substring(a+1)}return""===i?null:i}(n,i,o);Ei&&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 La(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 Ba(t,e,n,i){var r=t.__style;if(Ei||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(Da)),i&&l.push(...Object.keys(i).map(Da));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=Da(t.substring(c,u).trim());l.includes(f)||(";"!==h&&d++,r+=" "+t.substring(c,d).trim()+";")}c=d+1,u=-1}}}return n&&(r+=Ca(n)),i&&(r+=Ca(i,!0)),""===(r=r.trim())?null:r}return null==t?null:String(t)}(e,i);Ei&&o===t.getAttribute("style")||(null==o?t.removeAttribute("style"):t.style.cssText=o),t.__style=e}else i&&(Array.isArray(i)?(La(t,null==n?void 0:n[0],i[0]),La(t,null==n?void 0:n[1],i[1],"important")):La(t,n,i));return i}function za(t,e,n=!1){if(t.multiple){if(null==e)return;if(!Fn(e))return void console.warn("%c[svelte] select_multiple_invalid_value\n%cThe `value` property of a `<select multiple>` element should be an array, but it received a non-array value. The selection will be kept as is.\nhttps://svelte.dev/e/select_multiple_invalid_value",xi,wi);for(var i of t.options)i.selected=e.includes(Wa(i))}else{for(i of t.options){var r=Wa(i);if(o=r,s=e,Object.is(Co(o),Co(s)))return void(i.selected=!0)}var o,s;n&&void 0===e||(t.selectedIndex=-1)}}function Wa(t){return"__value"in t?t.__value:t.value}const Ua=Symbol("class"),ja=Symbol("style"),$a=Symbol("is custom element"),qa=Symbol("is html");function Va(t){if(Ei){var e=!1,n=()=>{if(!e){if(e=!0,t.hasAttribute("value")){var n=t.value;Ha(t,"value",null),t.value=n}if(t.hasAttribute("checked")){var i=t.checked;Ha(t,"checked",null),t.checked=i}}};t.__on_r=n,Qi(n),Yo||(Yo=!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 Ga(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function Ha(t,e,n,i){var r=Xa(t);Ei&&(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=Za(t.srcset),i=Za(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`,xi,wi)}(e,t.outerHTML.replace(t.innerHTML,t.innerHTML&&"..."),String(n))}(t,e,null!=n?n:""):r[e]!==(r[e]=n)&&("loading"===e&&(t[mi]=n),null==n?t.removeAttribute(e):"string"!=typeof n&&Qa(t).includes(e)?t[e]=n:t.setAttribute(e,n))}function Ka(t,e,n=[],i=[],r=[],o,s=!1,a=!1){ao(r,n,i,(n=>{var i=void 0,r={},l="SELECT"===t.nodeName,c=!1;if(ls((()=>{var u=e(...n.map(Vs)),d=function(t,e,n,i,r=!1,o=!1){if(Ei&&r&&"INPUT"===t.tagName){var s=t;("checkbox"===s.type?"defaultChecked":"defaultValue")in n||Va(s)}var a=Xa(t),l=a[$a],c=!a[qa];let u=Ei&&l;u&&Si(!1);var d,h=e||{},f="OPTION"===t.tagName;for(var p in e)p in n||(n[p]=null);n.class?n.class=Oa(n.class):n.class=null,n[ja]&&(null!==(d=n.style)&&void 0!==d||(n.style=null));var m=Qa(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=la(i);if(sa(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,Zs([i]);else{let o=function(t){h[r].call(this,t)};h[n]=Qs(i,t,o,e)}else y&&(t[`__${i}`]=void 0)}else if("style"===r)Ha(t,r,s);else if("autofocus"===r)Xo(t,Boolean(s));else if(l||"__value"!==r&&("value"!==r||null==s))if("selected"===r&&f)Ga(t,s);else{var b=r;c||(b=ua(b));var k="defaultValue"===b||"defaultChecked"===b;if(null!=s||l||k)k||m.includes(b)&&(l||"string"!=typeof s)?(t[b]=s,b in a&&(a[b]=En)):"function"!=typeof s&&Ha(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 Ba(t,s,null==e?void 0:e[ja],n[ja]),h[r]=s,h[ja]=n[ja];else Ra(t,"http://www.w3.org/1999/xhtml"===t.namespaceURI,s,i,null==e?void 0:e[Ua],n[Ua]),h[r]=s,h[Ua]=n[Ua]}return u&&Si(!0),h}(t,i,u,o,s,a);c&&l&&"value"in u&&za(t,u.value);for(let t of Object.getOwnPropertySymbols(r))u[t]||hs(r[t]);for(let e of Object.getOwnPropertySymbols(u)){var h=u[e];e.description!==Nn||i&&h===i[e]||(r[e]&&hs(r[e]),r[e]=cs((()=>Ma(t,(()=>h))))),d[e]=h}i=d})),l){var u=t;rs((()=>{za(u,i.value,!0),function(t){var e=new MutationObserver((()=>{za(t,t.__value)}));e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),es((()=>{e.disconnect()}))}(u)}))}c=!0}))}function Xa(t){var e;return null!==(e=t.__attributes)&&void 0!==e?e:t.__attributes={[$a]:t.nodeName.includes("-"),[qa]:t.namespaceURI===An}}var Ya=new Map;function Qa(t){var e,n=t.getAttribute("is")||t.nodeName,i=Ya.get(n);if(i)return i;Ya.set(n,i=[]);for(var r=t,o=Element.prototype;o!==r;){for(var s in e=Rn(r))e[s].set&&i.push(s);r=zn(r)}return i}function Ja(t,e){return t===e||new URL(t,document.baseURI).href===new URL(e,document.baseURI).href}function Za(t){return t.split(",").map((t=>t.trim().split(" ").filter(Boolean)))}function tl(t,e){return t===e||(null==t?void 0:t[fi])===e}function el(t={},e,n,i){return rs((()=>{var i,r;return os((()=>{i=r,r=[],Ks((()=>{t!==n(...r)&&(e(t,...r),i&&tl(n(...i),t)&&e(null,...i))}))})),()=>{Qi((()=>{r&&tl(n(...r),t)&&e(null,...r)}))}})),t}let nl=!1;function il(t,e,n,i){var r,o,s=!!(n&kn),a=!!(n&xn),l=i,c=!0,u=()=>(c&&(c=!1,l=a?Ks(i):i),l);if(s){var d,h,f=fi in t||pi in t;r=null!==(d=null===(h=Dn(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=nl;try{return nl=!1,[t(),nl]}finally{nl=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&bn))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&yn?uo:po)((()=>(g=!1,p())));y.label=e,s&&Vs(y);var b=Es;return function(t,e){if(arguments.length>0){const n=e?Vs(y):s?Oo(t):t;return Eo(y,n),g=!0,void 0!==l&&(l=n),t}return xs&&g||b.f&ei?y.v:Vs(y)}}var rl,ol,sl,al;"undefined"!=typeof window&&(null!==(ol=(rl=null!==(al=(sl=window).__svelte)&&void 0!==al?al:sl.__svelte={}).v)&&void 0!==ol?ol:rl.v=new Set).add("5");function ll(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 cl(t,e){t.getNodesAtTime(0)[0].once("nodestart",e)}class ul{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}`,ll(this)}#a=Ri(To(Oo({})),"BaseModule.#state");#l=Ri(To(null),"BaseModule.#cover");#c=Ri(To(!1),"BaseModule.#showCover");#u=Ri(To(null),"BaseModule.#Component");id;player;position;config;timeline;moduleEndListener;hasDuration=!1;coverAssets=[];get state(){return Vs(this.#a)}set state(t){Eo(this.#a,t,!0)}get cover(){return Vs(this.#l)}set cover(t){Eo(this.#l,t)}get showCover(){return Vs(this.#c)}set showCover(t){Eo(this.#c,t,!0)}get Component(){return Vs(this.#u)}set Component(t){Eo(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(){cl(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 dl(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 hl=ia('<h3 class="text-box-title svelte-17x2i38"> </h3>'),fl=ia('<span class="text-box-title svelte-17x2i38"> </span>'),pl=ia('<span class="text-box-description minimized-description svelte-17x2i38"> </span>'),ml=ia('<span class="read-more-cta svelte-17x2i38" aria-hidden="true">Read more</span>'),vl=ia('<button class="expand-description-button svelte-17x2i38" aria-expanded="false" aria-controls="expanded-text-content" aria-label="Expand feature description"><!> <!></button>'),gl=ia('<button aria-expanded="true" aria-label="Collapse feature description" class="svelte-17x2i38">Read less</button>'),yl=ia('<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 bl={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 kl(t,e){const n=fo((()=>e.state.textBox));!function(t,e){Gi(e,!0),Na(t,bl);let n=il(e,"textBox",3,null),i=il(e,"isMobile",3,!1),r=To(!1),o=To(null),s=To(!1),a=fo((()=>{var t;return(null===(t=n())||void 0===t?void 0:t.title)||""})),l=fo((()=>{var t;return(null===(t=n())||void 0===t?void 0:t.description)||""})),c=fo((()=>i()?16:18)),u=fo((()=>i()?12:16));function d(){Vs(o)&&Eo(s,Vs(o).scrollWidth>Vs(o).clientWidth||Vs(o).scrollHeight>Vs(o).clientHeight,!0)}ns((()=>{Vs(o)&&d()}));var h=ra();Js("resize",Lo,d);var f=Go(h),p=t=>{var e=yl(),n=Vo(e),d=Vo(n),h=Vo(d),f=t=>{var e=hl(),n=Vo(e,!0);Mi(e),ss((()=>ha(n,Vs(a)))),oa(t,e)};wa(h,(t=>{i()&&t(f)}));var p=Ho(h,2),m=Vo(p,!0);Mi(p),Mi(d);var v=Ho(d,2),g=t=>{var e=vl();e.__click=()=>Eo(r,!0);var n=Vo(e),u=t=>{var e=fl(),n=Vo(e,!0);Mi(e),ss((()=>ha(n,Vs(a)))),oa(t,e)},d=t=>{var e=pl(),n=Vo(e,!0);Mi(e),el(e,(t=>Eo(o,t)),(()=>Vs(o))),ss((()=>ha(n,Vs(l)))),oa(t,e)};wa(n,(t=>{i()&&Vs(a)?t(u):t(d,!1)}));var h=Ho(n,2),f=t=>{oa(t,ml())};wa(h,(t=>{(i()||!i()&&Vs(s))&&t(f)})),Mi(e),ss((()=>Ba(e,`line-height: ${Vs(c)}px;`))),oa(t,e)};wa(v,(t=>{Vs(r)||t(g)})),Mi(n);var y=Ho(n,2),b=t=>{var e=gl();e.__click=()=>Eo(r,!1),ss((()=>Ba(e,`margin-bottom: ${!i()&&Vs(r)?"8px":"0px"};\n line-height: ${Vs(u)}px;`))),oa(t,e)};wa(y,(t=>{Vs(r)&&t(b)})),Mi(e),ss((()=>{Ra(e,1,"step-description-container "+(Vs(r)?"expanded":""),"svelte-17x2i38"),Ba(e,`padding: ${i()?"8px 16px":"16px 16px 56px 16px"};`),Ba(d,`line-height: ${Vs(c)}px;`),Ha(d,"hidden",!Vs(r)),ha(m,Vs(l))})),oa(t,e)};wa(f,(t=>{(Vs(a)||Vs(l))&&t(p)})),oa(t,h),Hi()}(t,{get textBox(){return Vs(n)},get isMobile(){return e.isMobile}})}Zs(["click"]);var xl=ia('<div class="toggle-option-container svelte-16pmvvn"><button> </button></div>'),wl=ia('<div class="toggle-container svelte-16pmvvn"><div></div></div>');const _l={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 Tl(t,e){Na(t,_l);const n=fo((()=>e.state.options)),i=fo((()=>e.state.currentOptionIndex)),r=fo((()=>e.state.onOptionClicked));var o=wl(),s=Vo(o);Ia(s,21,(()=>Vs(n)),_a,((t,e,n)=>{var o=xl();Ba(o,`--button-index: ${n};`);var s=Vo(o);let a;s.__click=()=>Vs(r)(n);var l=Vo(s,!0);Mi(s),Mi(o),ss((()=>{a=Ra(s,1,"toggle-option-button svelte-16pmvvn",null,a,{selected:Vs(i)===n}),ha(l,Vs(e).label)})),oa(t,o)})),Mi(s),Mi(o),ss((()=>{var t;return Ra(s,1,`toggle-options selected-${null!==(t=Vs(i))&&void 0!==t?t:""}`,"svelte-16pmvvn")})),oa(t,o)}Zs(["click"]);var Il=new WeakSet;function El(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,cl(this.timeline,(()=>{this.showCover=!1})),null===(n=this.player)||void 0===n||n.switchTimeline(this.timeline)))}const Sl=(t,e,n)=>n>e?e:n<t?t:n;function Al(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let Nl=()=>{},Ml=()=>{};function Fl(t){let e;return()=>(void 0===e&&(e=t()),e)}"undefined"!=typeof process&&"production"!==(null===(fe=process.env)||void 0===fe?void 0:fe.NODE_ENV)&&(Nl=(t,e,n)=>{t||"undefined"==typeof console||console.warn(Al(e,n))},Ml=(t,e,n)=>{if(!t)throw new Error(Al(e,n))});const Ol=t=>t,Pl=t=>1e3*t,Cl=t=>t/1e3;const Dl=t=>Array.isArray(t)&&"number"==typeof t[0],Rl=(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)})`},Ll=2e4;function Bl(t){let e=0;let n=t.next(e);for(;!n.done&&e<Ll;)e+=50,n=t.next(e);return e>=Ll?1/0:e}const zl=5;const Wl={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},Ul=.001;function jl({duration:t=Wl.duration,bounce:e=Wl.bounce,velocity:n=Wl.velocity,mass:i=Wl.mass}){let r,o;Nl(t<=Pl(Wl.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let s=1-e;s=Sl(Wl.minDamping,Wl.maxDamping,s),t=Sl(Wl.minDuration,Wl.maxDuration,Cl(t)),s<1?(r=e=>{const i=e*s,r=i*t,o=i-n,a=ql(e,s),l=Math.exp(-r);return Ul-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=ql(Math.pow(e,2),s);return(-r(e)+Ul>0?-1:1)*((o-a)*l)/c}):(r=e=>Math.exp(-e*t)*((e-n)*t+1)-Ul,o=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let i=n;for(let n=1;n<$l;n++)i-=t(i)/e(i);return i}(r,o,5/t);if(t=Pl(t),isNaN(a))return{stiffness:Wl.stiffness,damping:Wl.damping,duration:t};{const e=Math.pow(a,2)*i;return{stiffness:e,damping:2*s*Math.sqrt(i*e),duration:t}}}const $l=12;function ql(t,e){return t*Math.sqrt(1-e*e)}const Vl=["duration","bounce"],Gl=["stiffness","damping","mass"];function Hl(t,e){return e.some((e=>void 0!==t[e]))}function Kl(t=Wl.visualDuration,e=Wl.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:Wl.velocity,stiffness:Wl.stiffness,damping:Wl.damping,mass:Wl.mass,isResolvedFromDuration:!1,...t};if(!Hl(t,Gl)&&Hl(t,Vl))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(1.2*n),r=i*i,o=2*Sl(.05,1,1-(t.bounce||0))*Math.sqrt(r);e={...e,mass:Wl.mass,stiffness:r,damping:o}}else{const n=jl(t);e={...e,...n,mass:Wl.mass},e.isResolvedFromDuration=!0}return e}({...n,velocity:-Cl(n.velocity||0)}),p=h||0,m=c/(2*Math.sqrt(l*u)),v=s-o,g=Cl(Math.sqrt(l/u)),y=Math.abs(v)<5;let b;if(i||(i=y?Wl.restSpeed.granular:Wl.restSpeed.default),r||(r=y?Wl.restDelta.granular:Wl.restDelta.default),m<1){const t=ql(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?Pl(p):function(t,e,n){const i=Math.max(e-zl,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(Bl(k),Ll),e=Rl((e=>k.next(t*e).value),t,30);return t+"ms "+e},toTransition:()=>{}};return k}Kl.applyToOptions=t=>{const e=function(t,e=100,n){const i=n({...t,keyframes:[0,e]}),r=Math.min(Bl(i),Ll);return{type:"keyframes",ease:t=>i.next(r*t).value/e,duration:Cl(r)}}(t,100,Kl);return t.ease=e.ease,t.duration=Pl(e.duration),t.type="keyframes",t};const Xl=t=>null!==t;class Yl{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 Ql(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 Zl=Fl((()=>void 0!==window.ScrollTimeline)),tc={};function ec(t,e){const n=Fl(t);return()=>{var t;return null!==(t=tc[e])&&void 0!==t?t:n()}}const nc=ec((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing"),ic=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,rc={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ic([0,.65,.55,1]),circOut:ic([.55,0,1,.45]),backIn:ic([.31,.01,.66,-.59]),backOut:ic([.33,1.53,.69,.99])};function oc(t,e){return t?"function"==typeof t?nc()?Rl(t,e):"ease-out":Dl(t)?ic(t):Array.isArray(t)?t.map((t=>oc(t,e)||rc.easeOut)):rc[t]:void 0}function sc(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=oc(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 ac extends Yl{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,Ml("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)&&nc()?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=sc(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(Xl),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 Cl(Number(n))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Cl(t)}get time(){return Cl(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Pl(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&&Zl()?(this.animation.timeline=t,Ol):e(this)}}class lc{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 cc(this.animations,"duration")}get iterationDuration(){return cc(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 cc(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 uc extends lc{then(t,e){return this.finished.finally(t).then((()=>{}))}}const dc=new WeakMap,hc=(t,e="")=>`${t}:${e}`;function fc(t){const e=dc.get(t)||new Map;return dc.set(t,e),e}function pc(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 mc=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 vc(t,e){for(let n=0;n<t.length;n++)"number"==typeof t[n]&&mc.has(e)&&(t[n]=t[n]+"px")}function gc(t,e){const n=window.getComputedStyle(t);return Jl(e)?n.getPropertyValue(e):n[e]}function yc(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;Ml(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={...pc(a,t)};r.duration&&(r.duration=Pl(r.duration)),r.delay&&(r.delay=Pl(r.delay));const o=fc(i),l=hc(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]=gc(i,r)),Ql(e),vc(e,r),!o&&e.length<2&&e.unshift(gc(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 ac(i);e.set(n,r),r.finished.finally((()=>e.delete(n))),a.push(r)}return a}const bc=(()=>function(t,e,n){return new uc(yc(t,e,n))})();var kc=ia('<button class="svelte-16kucsb"><div class="svelte-16kucsb"> </div></button>'),xc=ia('<div class="tryIt-container svelte-16kucsb"><!></div>');const wc={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 _c(t,e){Gi(e,!0),Na(t,wc);const n=fo((()=>e.state.ctaText)),i=fo((()=>e.state.animationConfig)),r=fo((()=>e.state.showCta)),o=fo((()=>e.state.onCtaClick));let s=null,a=null,l=To(!1),c=!1;function u(){c&&bc(s,{transform:"scale(1.05)"},{type:Kl,mass:1.5,stiffness:400,damping:30})}function d(){c&&bc(s,{transform:"scale(1)"},{type:Kl,mass:1.5,stiffness:400,damping:30})}function h(){c&&bc(s,{transform:"scale(0.95)"},{type:Kl,mass:1,stiffness:600,damping:30})}ns((()=>{const{mass:t,stiffness:e,damping:n,delay:o}=Vs(i);let u;return Vs(r)&&(u=setTimeout((async()=>{Eo(l,!0),u=null,bc(s,{transform:["translateY(40px) scale(0, 0.2)","translateY(0) scale(1, 1)"],opacity:1},{type:Kl,mass:t,stiffness:e,damping:n}),await bc(a,{transform:["translateY(20px) scale(0.8)","translateY(0) scale(1)"],opacity:1},{type:Kl,mass:t,stiffness:e,damping:n,delay:.15}),c=!0}),o)),()=>{u&&clearTimeout(u)}}));var f=xc(),p=Vo(f),m=t=>{var e=kc();e.__mousedown=h,e.__touchstart=h,e.__click=function(...t){var e;null===(e=Vs(o))||void 0===e||e.apply(this,t)};var i=Vo(e),r=Vo(i,!0);Mi(i),el(i,(t=>a=t),(()=>a)),Mi(e),el(e,(t=>s=t),(()=>s)),ss((()=>{Ba(e,"pointer-events: "+(Vs(l)?"auto":"none")),ha(r,Vs(n))})),Js("mouseenter",e,u),Js("mouseleave",e,d),oa(t,e)};wa(p,(t=>{Vs(r)&&t(m)})),Mi(f),oa(t,f),Hi()}Zs(["mousedown","touchstart","click"]);var Tc=new WeakSet;function Ic(){this.mainTimeline?this.player.switchTimeline(this.mainTimeline):this.emitModuleEnd(),this.state.showCta=!1}const Ec={videoModule:class extends ul{constructor({config:t,...e}){var n;super({...e,config:t}),this.Component=kl,this.hasDuration=!t.loop,ll(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(dl(`${this.id}_intro`,e.intro,t),"end");const n=dl(this.id,e.video,t);this.timeline.placeOnTimeline(n,"end",{loop:e.loop}),e.loop||n.on("nodeend",this.emitModuleEnd)}},toggleModule:class extends ul{constructor({config:t,...e}){super({...e,config:t}),j(this,Il),this.Component=Tl,this.synced=t.sync,this.switchTo=()=>{},ll(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:L(Il,this,El).bind(this)}}start(t){super.start(t),this.synced?(this.timeline=t.createTimeline(),this.config.options.forEach(((e,n)=>{this.timeline.placeOnTimeline(dl(`${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(dl(`${this.id}_option_${n}_intro`,e.intro,t),"end"),i.placeOnTimeline(dl(`${this.id}_option_${n}`,e.video,t),"end",{loop:!0}),i})),this.timeline=this.timelines[this.state.currentOptionIndex])}},tryItModule:class extends ul{constructor({config:t,...e}){var n;super({...e,config:t}),j(this,Tc),ll(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:L(Tc,this,Ic).bind(this)}}start(t){super.start(t),this.Component=_c,this.timeline=t.createTimeline();const{introVideo:e,mainVideo:n}=this.config;if(e.intro&&this.timeline.placeOnTimeline(dl(`${this.id}_intro_intro`,e.intro,t)),this.timeline.placeOnTimeline(dl(`${this.id}_intro_loop`,e.loop,t),"end",{loop:!0}),n){this.mainTimeline=t.createTimeline(),n.intro&&this.mainTimeline.placeOnTimeline(dl(`${this.id}_main_intro`,n.intro,t));const e=dl(`${this.id}_main_loop`,n.loop,t);this.mainTimeline.placeOnTimeline(e,"end",{loop:!0})}}play(){this.state.showCta=!0,super.play()}}};class Sc{#d=Ri(To({}),"GalleryState.#variants");#h=Ri(To("ekonovar"),"GalleryState.#activeVariant");#f=Ri(To(0),"GalleryState.#activeItemIndex");#p=Ri(To(0),"GalleryState.#activeModuleIndex");#m=Ri(To(Oo({itemIndex:0,moduleIndex:0})),"GalleryState.#playingModulePosition");#v=Ri(fo((()=>{var t;return null===(t=Vs(this.#d))||void 0===t?void 0:t[Vs(this.#h)]})),"GalleryState.#currentItemsList");#g=Ri(fo((()=>{var t;return null===(t=Vs(this.#v))||void 0===t?void 0:t[Vs(this.#f)]})),"GalleryState.#currentItem");#y=Ri(fo((()=>{var t,e;return Vs(this.#b)?null===(e=Vs(this.#v))||void 0===e?void 0:e[Vs(this.#m).itemIndex].modules[Vs(this.#m).moduleIndex]:null===(t=Vs(this.#g))||void 0===t?void 0:t.modules[Vs(this.#p)]})),"GalleryState.#currentModule");#k=Ri(fo((()=>{var t;return(null===(t=Vs(this.#v))||void 0===t?void 0:t.flatMap((t=>t.modules)))||[]})),"GalleryState.#currentModulesList");#x=Ri(To(!1),"GalleryState.#playerLoaded");#w=Ri(To(!1),"GalleryState.#paused");#b=Ri(To(!1),"GalleryState.#startedPlaying");#_=Ri(fo((()=>!(Ro(Vs(this.#m).itemIndex,this.activeItemIndex)&&Ro(Vs(this.#m).moduleIndex,this.activeModuleIndex)))),"GalleryState.#seeking");set variants(t){Eo(this.#d,t)}set activeVariant(t){Eo(this.#h,t,!0)}set activeItemIndex(t){Eo(this.#f,t,!0)}set activeModuleIndex(t){Eo(this.#p,t,!0)}set playingModulePosition(t){Eo(this.#m,t,!0)}set playerLoaded(t){Eo(this.#x,t,!0)}set paused(t){Eo(this.#w,t,!0)}set startedPlaying(t){Eo(this.#b,t,!0)}get variants(){return Vs(this.#d)}get activeVariant(){return Vs(this.#h)}get activeItemIndex(){return Vs(this.#f)}get activeModuleIndex(){return Vs(this.#p)}get playingModulePosition(){return Vs(this.#m)}get currentItemsList(){return Vs(this.#v)}get currentItem(){return Vs(this.#g)}get currentModule(){return Vs(this.#y)}get playerLoaded(){return Vs(this.#x)}get paused(){return Vs(this.#w)}get startedPlaying(){return Vs(this.#b)}get seeking(){return Vs(this.#_)}get currentModulesList(){return Vs(this.#k)}}const Ac={assetsDeliveryBase:"https://{{env}}assets.eko.com"},Nc=2,Mc=5,Fc=["activeItemIndex","activeModuleIndex","paused","startedPlaying"],Oc=["version","selectItem","selectItemAndStep","next","prev","subscribe"];var Pc=new WeakMap,Cc=new WeakMap,Dc=new WeakMap,Rc=new WeakMap,Lc=new WeakSet;class Bc{constructor(t){var e,n,i;j(this,Lc),W(this,Pc,void 0),W(this,Cc,void 0),W(this,Dc,void 0),W(this,Rc,void 0),$(this,"public",void 0),$(this,"version","0.0.7"),ll(this),U(Dc,this,t),U(Pc,this,new Sc(null==t||null===(e=t.options)||void 0===e?void 0:e.galleryEnv)),U(Rc,this,((t="")=>(Ro(t,"production")&&(t=""),Object.fromEntries(Object.entries(Ac).map((([e,n])=>[e,n.replaceAll("{{env}}",t)])))))(null==t||null===(n=t.options)||void 0===n?void 0:n.galleryEnv)),U(Cc,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=>Ro(t.blockType,"GalleryBlock"))))||void 0===i?void 0:i.config;var o;r?(L(Lc,this,zc).call(this,r.items),L(Lc,this,Wc).call(this,r.items)):console.warn("[eko-gallery-app] Gallery initiated without an instance, results will be empty"),this.public=(o=this,Oc.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]=Ro(typeof n,"function")?n.bind(o):n,t}),{}))}start(t){z(Pc,this).playerLoaded=!0,z(Cc,this).forEach((e=>{e.start(t)})),U(Cc,this,null),L(Lc,this,Uc).call(this,t),z(Pc,this).currentModule.play()}selectItem(t){const e=z(Pc,this);Ro(t,e.activeItemIndex)||(e.activeItemIndex=t,e.activeModuleIndex=0)}selectItemAndStep(t,e){const n=z(Pc,this);Ro(t,n.activeItemIndex)&&Ro(e,n.activeModuleIndex)||(n.activeItemIndex=t,n.activeModuleIndex=e)}next(){L(Lc,this,$c).call(this)}prev(){const t=z(Pc,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=z(Pc,this);return function(t){_r.ensure();const e=Zo(Kn|si,t,!0);return()=>{hs(e)}}((()=>{ns((()=>{const n=Fc.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&&Ro(a,0,!1))throw new Error(`[getCoverUrl] No assetRevision found for asset ${s}.`);let l;return null!==(o=z(Dc,this))&&void 0!==o&&null!==(o=o.coverAssetsMap)&&void 0!==o&&o[s]?(l=new URL(z(Dc,this).coverAssetsMap[s]),/^[a-z0-9]*assets.eko.com$/.test(l.host)&&e&&(l.pathname=l.pathname.replace(".png",".webp"))):(l=new URL(`${z(Rc,this).assetsDeliveryBase}/image/${s}/${a}?startOffset=0`),l.pathname+=e?".webp":".png"),e&&l.searchParams.set("width",e),l.href}get currentConfig(){return z(Dc,this)}get state(){return z(Pc,this)}get urls(){return z(Rc,this)}}function zc(t){const e={};for(let n of t)for(let t of Object.keys(n.variants||{}))e[t]=[];e.ekonovar=[],z(Pc,this).variants=e}function Wc(t){const e=(t=[],e)=>{const n=[];for(let[i,r]of t.entries()){if(!Ec[r.itemType])throw new Error(`Unknown module type ${r.itemType}`);const t=new Ec[r.itemType]({position:{...e,moduleIndex:i},config:r,galleryState:z(Pc,this)});t.moduleEndListener=L(Lc,this,jc).bind(this),n.push(t)}return n};for(const[i,r]of t.entries())if(Ro(r.itemType,"galleryItemV2")){const{modules:t,...o}=r;for(const[s,a]of Object.entries(z(Pc,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}),U(Cc,this,[...z(Cc,this),...n.modules]),a.push(n)}}}}function Uc(t){for(const[,e]of Object.entries(z(Pc,this).variants))for(const[n,i]of e.entries()){const r=i.modules,o=e.filter((t=>Ro(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=>Ro(t,a,!1))).map((t=>t.timeline.getNodesAtTime(0)[0])),u=[{nodeId:l.id,weight:Nc},...c.map((t=>({nodeId:t.id,weight:Mc})))];for(const e of s.timeline.placements){t.getNode(e.nodeId).setChildren(u)}}}}function jc(){const t=z(Pc,this),e=t.currentItem.modules;e.length>1&&Ro(t.activeModuleIndex,e.length-1)?t.activeModuleIndex=0:L(Lc,this,$c).call(this)}function $c(){const t=z(Pc,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 qc=ia('<button><span class="svelte-er27y2"> </span></button>'),Vc=ia('<div class="nav-buttons-container svelte-er27y2"><div class="nav-buttons svelte-er27y2"></div></div>');const Gc={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);}"};Zs(["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 Kc=ia('<button><img class="svelte-1al44kl"/></button>');const Xc={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 Yc(t,e){Na(t,Xc);const n=il(e,"hidden",3,!1);var i=Kc();let r;i.__click=function(...t){var n;null===(n=e.onClick)||void 0===n||n.apply(this,t)};var o=Vo(i);Mi(i),ss((()=>{var t;r=Ra(i,1,`nav-button ${null!==(t=e.type)&&void 0!==t?t:""}`,"svelte-1al44kl",r,{hidden:n()}),Ha(i,"aria-label",e.type),Ha(o,"src",Hc),Ha(o,"alt",e.type)})),oa(t,i)}Zs(["click"]);var Qc=ia('<button><span class="svelte-1mxltt0"> </span></button>'),Jc=ia('<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 Zc={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 tu(t,e){Gi(e,!0),Na(t,Zc);const n=16,i=32,r=Vi("state");let o=To(null),s=To(null),a=To(!1),l=To(!1);const c=fo((()=>{let t=[];return t=r().currentItem.modules.map(((t,e)=>({index:e,type:e===r().activeModuleIndex?"active":"",name:t.name}))),t}));function u(){Vs(o)&&(Eo(a,Vs(o).scrollLeft>3),Eo(l,Vs(o).scrollLeft+Vs(o).clientWidth<Vs(o).scrollWidth-3))}function d(t){Vs(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(Vs(o).querySelectorAll(".step-button")).find((t=>{const e=t.getBoundingClientRect(),n=Vs(o).getBoundingClientRect();return e.left>n.left+i}));if(t){const e=t.previousElementSibling;e&&h(Vs(o),e)}}function p(){const t=Array.from(Vs(o).querySelectorAll(".step-button")).reverse().find((t=>{const e=t.getBoundingClientRect(),n=Vs(o).getBoundingClientRect();return e.right<n.right-i}));if(t){const e=t.nextElementSibling;e&&h(Vs(o),e)}}ns((()=>{if(Vs(o)){u();const t=new MutationObserver((()=>{const t=Vs(o).querySelector(".step-button.active");t&&Eo(s,t,!0)}));return t.observe(Vs(o),{attributes:!0,attributeFilter:["class"],subtree:!0}),()=>{t.disconnect()}}})),ns((()=>{Vs(s)&&Vs(o)&&h(Vs(o),Vs(s))}));var m=ra();Js("resize",Lo,u),function(t,e,n){Ei&&Ni();var i=new ba(t);as((()=>{var t=e();i.ensure(t,n)}))}(Go(m),(()=>r().activeItemIndex),(t=>{var e=Jc(),n=Vo(e);let i;n.__click=f;var s=Ho(n,2);let d;Ia(s,21,(()=>Vs(c)),_a,((t,e)=>{var n=Qc();let i;n.__click=t=>{return n=t.currentTarget,i=Vs(e).index,r().activeModuleIndex=i,void h(Vs(o),n);var n,i};var s=Vo(n),a=Vo(s,!0);Mi(s),Mi(n),ss((()=>{i=Ra(n,1,"step-button svelte-1mxltt0",null,i,{active:"active"===Vs(e).type}),Ha(n,"aria-label",`Go to step $${Vs(e).index+1}`),ha(a,Vs(e).name)})),oa(t,n)})),Mi(s),el(s,(t=>Eo(o,t)),(()=>Vs(o)));var m=Ho(s,2);let v;m.__click=p,Mi(e),ss(((t,e)=>{i=Ra(n,1,"step-arrow step-arrow-prev svelte-1mxltt0",null,i,{visible:Vs(a)}),d=Ra(s,1,"steps-indicator svelte-1mxltt0",null,d,t),Ba(s,`--stepDuration: ${null!=e?e:""}s`),v=Ra(m,1,"step-arrow step-arrow-next svelte-1mxltt0",null,v,{visible:Vs(l)})}),[()=>({"with-duration":r().currentModule.hasDuration,paused:r().paused}),()=>r().currentModule.duration]),Js("scroll",s,u),oa(t,e)})),oa(t,m),Hi()}Zs(["click"]);const eu="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",nu="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 iu=ia('<img alt="Play" class="svelte-a3r6re"/>'),ru=ia('<img alt="Pause" class="svelte-a3r6re"/>'),ou=ia('<button class="pause-button svelte-a3r6re"><!></button>');const su={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;}"};Zs(["click"]);const au=300,lu=60,cu="none";function uu(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function du(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 hu(t,e,n,i,r){const o=du(t,n,i);return t.dispatchEvent(new CustomEvent(`${e}${r}`,{detail:o})),o}function fu(){let t=[],e=()=>{},n=[];return{setPointerControls:(i,r,o,s,a,l=cu,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=hu(r,i,e,t,"down");function c(e){const o=t.length;t=function(t,e){return e.filter((e=>Ro(t.pointerId,e.pointerId,!1)))}(e,t);if(o>t.length){t.length||(u(),d(),h(),f());const o=hu(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=uu(r,"pointermove",(e=>{t=t.map((t=>Ro(e.pointerId,t.pointerId)?e:t));const s=hu(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=uu(r,"lostpointercapture",(t=>{c(t)})),h=uu(r,"pointerup",(t=>{c(t)})),f=uu(r,"pointerleave",(t=>{c(t)}))};e=uu(r,"pointerdown",l)}return{destroy:()=>{t.length||(e(),n.forEach((t=>{var e;null===(e=t.onDestroy)||void 0===e||e.call(t)})))}}}}}const pu="@attach";const mu="swipe";function vu(t,e,n,i=!1){const{setPointerControls:r}=fu(),o=i?mu:Symbol(pu);return{...n,[`on${mu}`]:t,[o]:t=>{const{onDown:n,onUp:i,parameters:o}=function(t,e){const n={timeframe:au,minSwipeDistance:lu,touchAction:cu,composed:!1,...e};let i,r,o,s;function a(t,e){r=e.clientX,o=e.clientY,i=Date.now(),Ro(t.length,1)&&(s=e.target)}function l(e,a){if(Ro(a.type,"pointerup")&&Ro(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(mu,{detail:{direction:u,target:s,pointerType:a.pointerType}}))}}return{onDown:a,onUp:l,parameters:n}}(t,null==e?void 0:e());return r(mu,t,null,n,i,o.touchAction,o.plugins).destroy}}}const gu=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,Ro(u.x,void 0,!1)&&Ro(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)=>{Ro(e.length,0)&&m()},onDestroy:m,onInit:t=>{t.length&&(u.x=void 0,u.y=void 0,p())}}};var yu=ia("<div></div>");const bu={hash:"svelte-1fv6njc",code:".swiper.svelte-1fv6njc {position:absolute;top:0;left:0;pointer-events:auto;width:100%;height:100%;}"};var ku=ia("<img/>"),xu=ia('<div class="ui-container svelte-1rvgxfc"><!></div>'),wu=ia('<div class="cover-container svelte-1rvgxfc"><!> <!> <!></div>'),_u=ia('<div class="covers-container svelte-1rvgxfc" style="scroll-behavior: auto;"></div>');const Tu={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 Iu(t,e){Gi(e,!0),Na(t,Tu);const n=[375,768,1024,1400,1920];let i=il(e,"scrollOffset",15),r=il(e,"isMobile",3,!1);const o=Vi("state");let s,a=fo((()=>o().playingModulePosition)),l=null,c=null,u=fo((()=>o().startedPlaying)),d=fo((()=>o().currentModulesList)),h=fo((()=>Vs(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=Vs(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=Vs(d)[y],k={itemIndex:o().activeItemIndex,moduleIndex:o().activeModuleIndex};if(!l){const t=s.children[Vs(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=Vs(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),Eo(a,b.position)}function v(){}ns((()=>{const{activeItemIndex:t,activeModuleIndex:e}=o();t===Vs(a).itemIndex&&e===Vs(a).moduleIndex||Ks((()=>{var n,i;const r=Vs(d).findIndex((n=>{const{itemIndex:i,moduleIndex:r}=n.position;return t===i&&e===r}));l=(null===(n=Vs(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"})}))})),ns((()=>{Vs(u)&&Ks((()=>{}))}));var g=ra(),y=Go(g),b=t=>{var i=_u();Ia(i,23,(()=>Vs(d)),(t=>t.id),((t,i,o)=>{var s=wu(),a=Vo(s),l=t=>{var r=ku();let s;ss((t=>{s=Ra(r,1,"cover-image svelte-1rvgxfc",null,s,{hidden:Vs(u)&&Vs(o)===Vs(h),"force-show":Vs(i).showCover}),Ha(r,"src",t),Ha(r,"alt",Vs(i).name),Ha(r,"fetchpriority",0===Vs(o)?"high":"auto")}),[()=>e.gallery.getCoverUrl(Vs(i).cover,n[n.length-1])]),Js("load",r,(function(...t){var e;null===(e=0===Vs(o)?v:()=>{})||void 0===e||e.apply(this,t)})),function(t){if(!Ei)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),oa(t,r)};wa(a,(t=>{t(l)}));var c=Ho(a,2),d=t=>{!function(t,e){Gi(e,!0),Na(t,bu);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=yu();Ka(r,(t=>({...t,class:"swiper"})),[()=>vu(i,(()=>({touchAction:"pan-y",plugins:e.debug?[gu(n)]:[]})))],void 0,void 0,"svelte-1fv6njc"),oa(t,r),Hi()}(t,{get gallery(){return e.gallery},get debug(){return e.debug},get onEvent(){return e.onEvent}})};wa(c,(t=>{r()&&t(d)}));var f=Ho(c,2),p=t=>{var e=xu();!function(t,e,n){Ei&&Ni();var i=new ba(t);as((()=>{var t,r=null!==(t=e())&&void 0!==t?t:null;i.ensure(r,r&&(t=>n(t,r)))}),ii)}(Vo(e),(()=>Vs(i).Component),((t,e)=>{e(t,{get state(){return Vs(i).state},get isMobile(){return r()}})})),Mi(e),oa(t,e)};wa(f,(t=>{var e;null!==(e=Vs(i))&&void 0!==e&&e.Component&&t(p)})),Mi(s),oa(t,s)})),Mi(i),el(i,(t=>s=t),(()=>s)),Js("scroll",i,m),oa(t,i)};wa(y,(t=>{Vs(d)&&t(b)})),oa(t,g),Hi()}const Eu="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};let Su;function Au(){const t=Eu&&Eu.navigator&&(Eu.navigator.userAgent||Eu.navigator.platform||Eu.navigator.vendor)||"";if(Su&&Su.ua===t)return Su;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 Su={ua:t,isMobile:r},Su}"undefined"!=typeof window&&window.addEventListener("pageshow",(function(t){t.persisted&&setTimeout((function(){window.location.reload()}),10)}),!1);var Nu=ia('<div class="paging-buttons svelte-1n46o8q"><!> <!></div>'),Mu=ia('<div style="position: absolute; top: 0; left: 0; width: 100%;"></div>'),Fu=ia("<!> <!>",1),Ou=ia('<div class="player-container svelte-1n46o8q"><div class="player-div swipable svelte-1n46o8q"></div> <!> <!> <!> <!></div> <!>',1),Pu=ia('<div class="eko-gallery-app svelte-1n46o8q"><!></div>');const Cu={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 Du(t,e){Gi(e,!0),Na(t,Cu);const n=il(e,"config",19,(()=>({}))),i=il(e,"forceMobile",3,!1),r=il(e,"videoAspectRatio",3,"unset"),o=il(e,"onGalleryReady",3,(()=>{})),s=il(e,"onEvent",3,(()=>{}));let a,l=!1,c=To(new Bc(n())),u=To(null),d=fo((()=>i()||Au().isMobile)),h=To(0),f=To(void 0),p=To(!0),m=To(Oo({width:"100%",height:"100%"}));var v,g,y;function b(){const t={AssetsDeliveryService:{assetsDeliveryServiceUrl:Vs(c).urls.assetsDeliveryBase}};Eo(u,new e.EkoPlayer(a,Object.assign(t,e.playerOptions))),Vs(u).on("playing",(()=>{Vs(c).state.paused=!1})),Vs(u).on("pause",(()=>{Vs(c).state.paused=!0})),Vs(u).once("playing",(()=>{Vs(c).state.startedPlaying=!0,s()("galleryloaded")}))}function k(t){var e;null===(e=Vs(c))||void 0===e||e.selectItem(t)}function x(){var t;null===(t=Vs(c))||void 0===t||t.next()}function w(){var t;null===(t=Vs(c))||void 0===t||t.prev()}function _(){Vs(u).paused?Vs(u).play():Vs(u).pause()}function T(){return`--uiTranformX: ${Vs(h)}px;--videoAspect: ${r()};--videoWidth: ${Vs(m).width};--videoHeight: ${Vs(m).height};`}v="state",g=()=>Vs(c).state,Ki("setContext").set(v,g),y=()=>(o()(Vs(c).public),n()&&e.EkoPlayer&&(b(),Vs(c).start(Vs(u))),()=>{var t;null===(t=Vs(u))||void 0===t||t.dispose()}),null===zi&&ki("onMount"),ns((()=>{const t=Ks(y);if("function"==typeof t)return t})),ns((()=>{n()&&e.EkoPlayer&&(l?Ks((()=>{var t;Eo(c,new Bc(n())),null===(t=Vs(u))||void 0===t||t.dispose(),Eo(p,!1),qs().then((()=>(Eo(p,!0),qs()))).then((()=>{o()(Vs(c).public),b(),Vs(c).start(Vs(u))}))})):l=!0)})),ns((()=>{Vs(f)&&Vs(u)&&Vs(u).loadDebugOverlay({containerElement:Vs(f)})})),ns((()=>{if("unset"!==r()&&r().includes("/")){const[t,e]=r().split("/").map((t=>Number(t)));isNaN(t)||isNaN(e)||Eo(m,t>e?{width:"100%",height:"auto"}:{width:"auto",height:"100%"},!0)}else Eo(m,{width:"100%",height:"100%"},!0)}));var I=Pu(),E=Vo(I),S=t=>{var n=Ou(),i=Go(n),r=Vo(i);el(r,(t=>a=t),(()=>a));var o=Ho(r,2);Iu(o,{get isMobile(){return Vs(d)},get gallery(){return Vs(c)},get debug(){return e.debug},get onEvent(){return s()},get scrollOffset(){return Vs(h)},set scrollOffset(t){Eo(h,t,!0)}});var l=Ho(o,2),u=t=>{var e=Nu(),n=Vo(e);Yc(n,{type:"prev",onClick:w}),Yc(Ho(n,2),{type:"next",onClick:x}),Mi(e),oa(t,e)};wa(l,(t=>{Vs(d)||e.hideNav||t(u)}));var p=Ho(l,2),m=t=>{tu(t,{})};wa(p,(t=>{var e;!Vs(d)&&(null===(e=Vs(c).state.currentItem)||void 0===e?void 0:e.modules.length)>1&&t(m)}));var v=Ho(p,2),g=t=>{var n=Fu(),i=Go(n);!function(t,e){Gi(e,!0),Na(t,su);const n=Vi("state");var i=ou();i.__click=function(...t){var n;null===(n=e.onPauseClick)||void 0===n||n.apply(this,t)};var r=Vo(i),o=t=>{var e=iu();ss((()=>Ha(e,"src",eu))),oa(t,e)},s=t=>{var e=ru();ss((()=>Ha(e,"src",nu))),oa(t,e)};wa(r,(t=>{n().paused?t(o):t(s,!1)})),Mi(i),ss((t=>Ha(i,"aria-label",t)),[()=>n().paused?"Play":"Pause"]),oa(t,i),Hi()}(i,{onPauseClick:_});var r=Ho(i,2),o=t=>{var e=Mu();el(e,(t=>Eo(f,t)),(()=>Vs(f))),oa(t,e)};wa(r,(t=>{e.debug&&t(o)})),oa(t,n)};wa(v,(t=>{Vs(c).state.startedPlaying&&t(g)})),Mi(i);var y=Ho(i,2),b=t=>{!function(t,e){Gi(e,!0),Na(t,Gc);let n=il(e,"onNavItemClick",3,(()=>{}));const i=Vi("state");var r=Vc(),o=Vo(r);Ia(o,23,(()=>i().currentItemsList),(t=>t.id),((t,e,r)=>{var o=qc();let s;o.__click=()=>n()(Vs(r));var a=Vo(o),l=Vo(a,!0);Mi(a),Mi(o),ss((t=>{s=Ra(o,1,"nav-button svelte-er27y2",null,s,t),ha(l,Vs(e).name)}),[()=>({selected:Vs(r)===i().activeItemIndex})]),oa(t,o)})),Mi(o),Mi(r),oa(t,r),Hi()}(t,{onNavItemClick:k})};wa(y,(t=>{e.hideNav||t(b)})),ss((t=>Ba(i,t)),[T]),oa(t,n)};wa(E,(t=>{n()&&Vs(p)&&t(S)})),Mi(I),oa(t,I),Hi()}function Ru(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Lu,Bu,zu,Wu,Uu={exports:{}},ju=Ru((Lu||(Lu=1,zu=Uu.exports,Wu=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},(Bu=Uu).exports?Bu.exports=Wu():zu.log=Wu()),Uu.exports));const $u=()=>{},qu=["trace","log","debug","info","warn","error","getLevel","setLevel"],Vu=["trace","debug","info","warn","error","silent"],Gu={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 Ku={level:"trace",appName:""},Xu=[];const Yu="object"==typeof Hu&&Hu.performance&&"function"==typeof Hu.performance.now?Hu.performance.now.bind(Hu.performance):Date.now.bind(Date),Qu=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[Qu(e)]=Qu(i)||"trace"})),n}catch(t){return{}}})(),Zu=(t,e="")=>{const n=Qu(t),i=ju.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)=>(Yu()/1e3).toFixed(e))()}] %c[${s}] ${Ku.appName?`[${Ku.appName}] `:""}[${t}]`,Gu[s],...e)}},e=Ju[n]||Ju["*"]||e||Ku.level,i.setLevel(e,!1);const o=(...t)=>i.log(...t);return qu.forEach((t=>{o[t]=(...e)=>(Xu.forEach((n=>{n[t](...e)})),i[t](...e))})),i.__ekologger=o,o};Zu.setDefaults=({appName:t="",level:e})=>{t&&"string"==typeof t&&(Ku.appName=t),(e=Qu(e))&&Vu.includes(e)&&(Ku.level=e,Object.values(ju.getLoggers()).filter((t=>t.__noExplicitLevel)).forEach((t=>t.setLevel(Ku.level,!1))))},Zu.installDriver=t=>{const e={...qu.reduce(((e,n)=>(e[n]="function"==typeof(null==t?void 0:t[n])?t[n]:$u,e)),{})};Xu.push(e)};let td=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 ed(t){return"[object Object]"===Object.prototype.toString.call(t)}function nd(t,...e){const n=ed(t)?{...t}:{};return e.forEach((t=>{ed(t)&&Object.keys(t).forEach((e=>{const i=t[e],r=n[e];ed(i)&&ed(r)?n[e]=nd(r,i):Array.isArray(i)?n[e]=i.slice():n[e]=i}))})),n}function id(t){if("string"==typeof t)return`'${t}'`;if(Array.isArray(t))return`[${t.map((t=>id(t))).join(", ")}]`;if(ed(t))try{return JSON.stringify(t)}catch(t){return"[object Object]"}return null===t?"null":void 0===t?"undefined":String(t)}function rd(t){return Array.from(t).map((t=>id(t))).join(", ")}var od=new WeakSet;class sd extends td{constructor(...t){super(),j(this,od);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=Zu(n,this.loglevel);const i=ed(this.defaults)?this.defaults:{},r=ed(e)&&ed(e[n])?e[n]:{};this.settings=nd({},i,r),L(od,this,ad).call(this),L(od,this,ld).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 ad(){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}(${rd(t)})`),a(...t)):a,t.add(o)}n=Object.getPrototypeOf(n)}}function ld(){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 cd="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};function ud(t){return Boolean(t)&&"object"==typeof t&&1===t.nodeType&&"function"==typeof t.appendChild}class dd extends sd{#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==cd?void 0:cd.document)){if(ud(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 ud(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==cd?void 0:cd.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 hd=new WeakMap,fd=new WeakMap,pd=new WeakMap,md=new WeakMap,vd=new WeakMap,gd=new WeakMap,yd=new WeakSet;class bd extends sd{get name(){return"ContainerSize"}get containerWidth(){return z(fd,this)}get containerHeight(){return z(pd,this)}get width(){return z(fd,this)}get height(){return z(pd,this)}constructor(...t){super(...t),j(this,yd),W(this,hd,void 0),W(this,fd,0),W(this,pd,0),W(this,md,null),W(this,vd,null),W(this,gd,null);const[e]=t;var n;U(hd,this,(n=e)&&n.element&&ud(n.element)?n.element:ud(n)?n:null),z(hd,this)&&(L(yd,this,xd).call(this,!0),L(yd,this,kd).call(this))}onDispose(){z(md,this)&&"function"==typeof z(md,this).disconnect&&z(md,this).disconnect(),U(md,this,null),z(gd,this)&&"function"==typeof(null==cd?void 0:cd.removeEventListener)&&cd.removeEventListener("resize",z(gd,this)),U(gd,this,null),z(vd,this)&&((null==cd?void 0:cd.clearInterval)||clearInterval)(z(vd,this)),U(vd,this,null),U(hd,this,null)}}function kd(){if(!z(hd,this))return;const t=null==cd?void 0:cd.ResizeObserver;if("function"==typeof t)return U(md,this,new t((()=>L(yd,this,xd).call(this)))),void z(md,this).observe(z(hd,this));U(gd,this,(()=>L(yd,this,xd).call(this))),"function"==typeof(null==cd?void 0:cd.addEventListener)&&cd.addEventListener("resize",z(gd,this));const e=(null==cd?void 0:cd.setInterval)||setInterval;U(vd,this,e((()=>L(yd,this,xd).call(this)),250))}function xd(t=!1){if(!z(hd,this))return;const{width:e,height:n}=function(t){const e=Number(null==t?void 0:t.clientWidth),n=Number(null==t?void 0:t.clientHeight);return{width:Number.isFinite(e)&&e>0?Math.round(e):0,height:Number.isFinite(n)&&n>0?Math.round(n):0}}(z(hd,this));(t||e!==z(fd,this)||n!==z(pd,this))&&(U(fd,this,e),U(pd,this,n),this.trigger("containerresize",{width:e,height:n}))}var wd={VIDEO_SOURCE_PREFIX:"__SRC_VID:",TEXTURE_SOURCE_PREFIX:"__SRC_TEXTURE:",PREVIOUS_OUTPUT_PREFIX:"__PREVIOUS:",SAVED_FRAME_PREFIX:"__SAVED_FRAME:",SYSTEM_NODES:{FILTERS:{RENDER_TO_CANVAS:"__default"},TAGS:{ATOM:"atom",FILTER:"filter",COMPOSITE_FILTER:"composite",TRANSITION_FILTER:"transition"}},MESSAGES:{UPDATE_OPTIONS:"update_options"}};class _d{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 Td,Id={exports:{}},Ed=(Td||(Td=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}(Id)),Id.exports),Sd=Ru(Ed);class Ad extends _d{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 Sd;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)}}class Nd extends _d{constructor(t){super(t,!1)}initCanvas(t,e){const n=function(){const t=document.querySelector("video");t&&t.videoHeight&&e(t),requestAnimationFrame(n)};return requestAnimationFrame(n),document.getElementById(t)}}class Md extends _d{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 Fd=function(t){let e;return e="string"==typeof t?new Nd(t):t&&t.src&&t.dest?new Md(t):new Ad(t),e};function Od(t){return Array.isArray(t)||(t=[t]),t}class Pd{constructor(t){this.store=t?{...t.get()}:{}}reset(){this.store={}}get(t){if(!t)return this.store;const e=(t=Od(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=Od(t),e=Od(e),t.length!==e.length)throw new Error(`cant set values ${e} to keys ${t}, length did not match`);t.forEach(((t,n)=>{this.store[t]=e[n]}))}}class Cd{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 Dd=Zu("frame","warn");let Rd=!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");Rd=e||n}function Ld(t,e){const n=t.gl;var i;n.texImage2D(t.bindPoint,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e),t.__hasAllocated=!0,i=t,Number.isFinite(i.width)&&Number.isFinite(i.height)&&(i.actualWidth=i.width,i.actualHeight=i.height,i.textureObjectInfo&&(i.textureObjectInfo.allocatedWidth=i.width,i.textureObjectInfo.allocatedHeight=i.height))}class Bd extends Cd{fill(t){if(Rd&&(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?Ld(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,Ld(t,e)):t.__useSubImage=!0))}(this,t,e);const i=(performance.now()-n)/1e3;i>=.1&&Dd.warn(`[fill] texImage2D() took ${i.toFixed(3)} seconds to execute.`),"function"==typeof t.close&&!0!==t.__keepOpen&&(t.close(),t.__closed=!0)}}class zd extends Cd{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 Wd=function(t,e,n,i,r){let o;switch(t){case"frame":o=new Bd(e,n,i,r);break;case"pixel":o=new zd(e,n,i,r);break;default:throw new Error(`cant recognize type ${t}`)}return o};class Ud{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=Wd(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 jd=wd.VIDEO_SOURCE_PREFIX,$d=wd.TEXTURE_SOURCE_PREFIX,qd=wd.PREVIOUS_OUTPUT_PREFIX,Vd=wd.SAVED_FRAME_PREFIX;function Gd(t,e,n){t.set(`${jd}${n}`,e)}function Hd(t,e,n){t.set(`${qd}${n}`,e)}function Kd(t,e,n){t.set(`${Vd}${n}`,e)}class Xd{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()))Gd(t,n,e),Hd(t,n,e);for(const[e,n]of Object.entries(this.capturedFramesManager.getSavedFrames()))Kd(t,n,e)}setTextureSource(t,e,n){t.set(`${$d}${n}`,e)}getInput(t,e){return t.get(e)}getPrevOutput(t,e){return e=Number.isInteger(e)?e:0,t.get(`${qd}${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))}))}}class Yd{constructor(t){this.context=t}bind(){throw new Error("impl in concrete")}}let Qd=100,Jd=100;function Zd(t,e){Qd=t,Jd=e}let th=class extends Yd{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),Zd(i,r)),t}},eh=class extends Yd{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 nh{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===wd.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS?new th({gl:this.gl}):new eh({gl:this.gl,textureManager:this.textureManager,frameBufferObject:this.getFrameBufferObject(),useCanvasSizedFilterTargets:this.useCanvasSizedFilterTargets}),e}}function ih(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 rh=function(t,e){return ih(t,t.VERTEX_SHADER,e)},oh=function(t,e){return ih(t,t.FRAGMENT_SHADER,e)};const sh={position_3d:0,texture_coordinate_2d:1};var ah=function(t,e,n){const i=t.createProgram();if(t.attachShader(i,e),t.attachShader(i,n),Object.entries(sh).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)},lh=[-1,-1,1,1,-1,1,-1,1,1,1,1,1],ch=[0,1,2,2,1,3],uh=[0,0,1,0,0,1,1,1];const dh=96,hh=[new Float32Array(new ArrayBuffer(dh)),new Float32Array(new ArrayBuffer(dh)),new Float32Array(new ArrayBuffer(dh)),new Float32Array(new ArrayBuffer(dh)),new Float32Array(new ArrayBuffer(dh)),new Float32Array(new ArrayBuffer(dh))],fh=[new Int16Array(6),new Int16Array(6),new Int16Array(6)];class ph{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=hh[this.floatBufferCounter],this.floatBufferCounter=this.floatBufferCounter++%hh.length;break;case this.gl.ELEMENT_ARRAY_BUFFER:t=fh[this.unit16BufferCounter],this.unit16BufferCounter=this.unit16BufferCounter++%fh.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 mh={position_3d:class extends ph{getPointerData(){return{size:3,type:this.gl.FLOAT,normalize:!1,stride:0,offset:0}}},position_indexes:class extends ph{setPointer(){}getPointerData(){}enable(){}},texture_coordinate_2d:class extends ph{getPointerData(){return{size:2,type:this.gl.FLOAT,normalize:!0,stride:0,offset:0}}}};var vh=function(t,e,n){const i=mh[t];if(!i)throw new Error(`${t} is not a attribute name,choose from list: ${Object.keys(mh)}`);return new i(t,e,n)};class gh{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 yh extends gh{set(t){this.gl.uniform1fv(this.location,t)}}class bh extends gh{set(t){t&&(t.beforeUse(),this.gl.uniform1i(this.location,t.getUnit()))}}const kh="first_texture_dimensions",xh="viewport_dimensions",wh="time",_h={RUNTIME_OPTIONS:"runtimeOptions[0]",STATIC_OPTIONS:"staticOptions[0]",FIRST_TEXTURE:"first_texture",SECOND_TEXTURE:"second_texture",FIRST_MATRIX:"first_mat4"},Th={[_h.FIRST_TEXTURE]:bh,[_h.SECOND_TEXTURE]:bh,[_h.FIRST_MATRIX]:class extends gh{set(t){this.gl.uniformMatrix4fv(this.location,!1,t)}},[_h.STATIC_OPTIONS]:yh,[_h.RUNTIME_OPTIONS]:yh};var Ih=function(t,e){const n=Th[t];if(!n)throw new Error(`${t} is not a attribute name,choose from list: ${Object.keys(Th)}`);return new n(t,e)},Eh=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 Sh="position_3d",Ah="position_indexes",Nh="texture_coordinate_2d";class Mh{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=rh(this.gl,e.vertex),this.fragmentShader=oh(this.gl,e.fragment),this.program=ah(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:Sh,bindPoint:e.gl.ARRAY_BUFFER},{id:Ah,bindPoint:e.gl.ELEMENT_ARRAY_BUFFER},{id:Nh,bindPoint:e.gl.ARRAY_BUFFER}].concat(t)).forEach((t=>{const i=t.id;n[i]=vh(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]=Ih(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:_h.RUNTIME_OPTIONS},{id:_h.STATIC_OPTIONS}];return(t.getUniformList||Mh.getUniformList)().forEach((t=>{Object.values(_h).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||Mh.getUniformList)().forEach((t=>{switch(t){case _h.FIRST_TEXTURE:this.uniforms[_h.FIRST_TEXTURE].set(r[0]);break;case _h.SECOND_TEXTURE:this.uniforms[_h.SECOND_TEXTURE].set(r[1]);break;case kh:o=[...o,r[0].getWidth(),r[0].getHeight()];break;case xh:o=[...o,i.width,i.height];break;case wh:{const t=Eh(e.startTime,e.duration);o=[...o,t];break}}})),o.length>0&&this.uniforms[_h.RUNTIME_OPTIONS].set(o)}static getUniformList(){return[_h.FIRST_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(){}handleAttributes(){this.attributes[Sh].fillBuffer(lh),this.attributes[Sh].setPointer(),this.attributes[Ah].fillBuffer(ch),this.attributes[Nh].fillBuffer(uh),this.attributes[Nh].setPointer()}disposeAttributes(){Object.values(this.attributes).forEach((t=>{t.dispose()}))}render(t,e){const n=this.frameBuffer.bind(t);let i={width:Qd,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 Fh extends Mh{constructor(t){const e={uniforms:Mh.getUniformInfo(Fh)};super(Fh.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 Oh,Ph="undefined"!=typeof Float32Array?Float32Array:Array;function Ch(){var t=new Ph(3);return Ph!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Dh(t,e,n){var i=new Ph(3);return i[0]=t,i[1]=e,i[2]=n,i}function Rh(){var t=new Ph(4);return Ph!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}Ch(),function(){var t;t=new Ph(4),Ph!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}(),Ch(),Dh(1,0,0),Dh(0,1,0),Rh(),Rh(),Oh=new Ph(9),Ph!=Float32Array&&(Oh[1]=0,Oh[2]=0,Oh[3]=0,Oh[5]=0,Oh[6]=0,Oh[7]=0),Oh[0]=1,Oh[4]=1,Oh[8]=1;class Lh extends Mh{constructor(t){const e={uniforms:Mh.getUniformInfo(Lh)};super(Lh.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:Lh.getInitialOptions().translate.x},{properties:["translate","y"],type:"slider",minValue:-2,maxValue:2,step:.001,initialValue:Lh.getInitialOptions().translate.y},{properties:["scale","x"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:Lh.getInitialOptions().scale.x},{properties:["scale","y"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:Lh.getInitialOptions().scale.y},{properties:["rotate"],type:"slider",minValue:-360,maxValue:360,step:1,initialValue:Lh.getInitialOptions().rotate}]}static getUniformList(){return[_h.FIRST_TEXTURE,_h.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 Ph(16),Ph!=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}(Rh(),0,0,o),Dh(e,n,0),Dh(i,r,1)),this.uniforms[_h.FIRST_MATRIX].set(this.transformMatrix)}}class Bh extends Mh{constructor(t){const e={uniforms:Mh.getUniformInfo(Bh)};super(Bh.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[_h.FIRST_TEXTURE,kh]}}class zh extends Mh{constructor(t){const e={uniforms:Mh.getUniformInfo(zh)};super(zh.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[_h.FIRST_TEXTURE,kh]}}class Wh extends Mh{constructor(t){const e={uniforms:Mh.getUniformInfo(Wh)};super(Wh.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[_h.FIRST_TEXTURE,kh,xh]}handleStaticUniforms(t){var e;const n=(null!==(e=Number.parseFloat(t.offsetDist))&&void 0!==e?e:4).toFixed(3);this.uniforms[_h.STATIC_OPTIONS].set([n])}}class Uh extends Mh{constructor(t){const e={uniforms:Mh.getUniformInfo(Uh)};super(Uh.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[_h.FIRST_TEXTURE,kh,xh]}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[_h.STATIC_OPTIONS].set([i,r])}}class jh extends Mh{constructor(t){const e={uniforms:Mh.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}",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[_h.STATIC_OPTIONS].set([e])}}class $h extends Mh{constructor(t){const e={uniforms:Mh.getUniformInfo($h)};super($h.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[_h.FIRST_TEXTURE,kh,_h.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[_h.STATIC_OPTIONS].set([e,n,i,r,o,s,a])}}class qh extends Mh{constructor(t){const e={uniforms:Mh.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}",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[_h.FIRST_TEXTURE,_h.SECOND_TEXTURE]}}class Vh extends Mh{constructor(t){const e={uniforms:Mh.getUniformInfo(Vh)};super(Vh.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[_h.FIRST_TEXTURE,_h.SECOND_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(t){const e=Number.parseFloat(t.lutSize).toFixed(1);this.uniforms[_h.STATIC_OPTIONS].set([e])}}var Gh="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:Kh,cos:Xh,sin:Yh,acos:Qh,atan2:Jh,sqrt:Zh,pow:tf}=Math;function ef(t){return t<0?-tf(-t,1/3):tf(t,1/3)}const nf=Math.PI,rf=2*nf,of=nf/2,sf=Number.MAX_SAFE_INTEGER||9007199254740991,af=Number.MIN_SAFE_INTEGER||-9007199254740991,lf={x:0,y:0,z:0},cf={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),Zh(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],lf],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||cf.approximately(t,e)||cf.approximately(t,n)},approximately:function(t,e,n){return Kh(t-e)<=(n||1e-6)},length:function(t){const e=cf.Tvalues.length;let n=0;for(let i,r=0;r<e;r++)i=.5*cf.Tvalues[r]+.5,n+=cf.Cvalues[r]*cf.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(cf.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 Zh(n*n+i*i)},closest:function(t,e){let n,i,r=tf(2,63);return t.forEach((function(t,o){i=cf.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=tf(t,e)+tf(1-t,e);return Kh((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=tf(1-t,e);return n/(tf(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 cf.lli8(r,o,s,a,l,c,u,d)},lli:function(t,e){return cf.lli4(t,t.c,e,e.c)},makeline:function(t,e){return new bf(t.x,t.y,(t.x+e.x)/2,(t.y+e.y)/2,e.x,e.y)},findbbox:function(t){let e=sf,n=sf,i=af,r=af;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(!cf.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=cf.makeline(e.points[i-1],t.points[0]),s=cf.makeline(t.points[r-1],e.points[0]),a={startcap:o,forward:t,back:e,endcap:s,bbox:cf.findbbox([o,t,e,s]),intersections:function(t){return cf.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=sf,s=af;-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)*Xh(r)-(t.y-i)*Yh(r),y:(t.x-n)*Yh(r)+(t.y-i)*Xh(r)}}))},roots:function(t,e){e=e||{p1:{x:0,y:0},p2:{x:1,y:0}};const n=t.length-1,i=cf.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=-Zh(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(cf.approximately(l,0)){if(cf.approximately(c,0))return cf.approximately(u,0)?[]:[-d/u].filter(r);const t=Zh(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=Zh(t*t*t),n=-p/(2*e),i=Qh(n<-1?-1:n>1?1:n),o=2*ef(e);return b=o*Xh(i/3)-c/3,k=o*Xh((i+rf)/3)-c/3,x=o*Xh((i+2*rf)/3)-c/3,[b,k,x].filter(r)}if(0===v)return g=m<0?ef(-m):-ef(m),b=2*g-c/3,k=-g-c/3,[b,k].filter(r);{const t=Zh(v);return g=ef(-m+t),y=ef(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=-Zh(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=cf.compute(t,e),h=cf.compute(t,n),f=d.x*d.x+d.y*d.y;if(i?(o=Zh(tf(d.y*h.z-h.y*d.z,2)+tf(d.z*h.x-h.z*d.x,2)+tf(d.x*h.y-h.x*d.y,2)),s=tf(f+d.z*d.z,1.5)):(o=d.x*h.y-d.y*h.x,s=tf(f,1.5)),0===o||0===s)return{k:0,r:0};if(c=o/s,u=s/o,!r){const r=cf.curvature(t-.001,e,n,i,!0).k,o=cf.curvature(t+.001,e,n,i,!0).k;l=(o-c+(c-r))/2,a=(Kh(o-c)+Kh(c-r))/2}return{k:c,r:u,dk:l,adk:a}},inflections:function(t){if(t.length<4)return[];const e=cf.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(cf.approximately(o,0)){if(!cf.approximately(s,0)){let t=-a/s;if(0<=t&&t<=1)return[t]}return[]}const l=2*o;if(cf.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,Kh(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 cf.bboxoverlap(t.left.bbox(),t.right.bbox())}));let u=[];return 0===c.length||(c.forEach((function(t){u=u.concat(cf.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*Xh(of)-r*Yh(of),l=i*Yh(of)+r*Xh(of),c=o*Xh(of)-s*Yh(of),u=o*Yh(of)+s*Xh(of),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=cf.lli8(d,h,m,v,f,p,g,y),k=cf.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+=rf),w>T&&(x=T,T=w,w=x)):T<_&&_<w?(x=T,T=w,w=x):T+=rf,b.s=w,b.e=T,b.r=k,b},numberSort:function(t,e){return t-e}};class uf{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 cf.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++)cf.expandbox(e,t[n].bbox());return e}offset(t){const e=[];return this.curves.forEach((function(n){e.push(...n.offset(t))})),new uf(e)}}const{abs:df,min:hf,max:ff,cos:pf,sin:mf,acos:vf,sqrt:gf}=Math,yf=Math.PI;let bf=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=cf.align(s,{p1:s[0],p2:s[l]}),d=cf.dist(s[0],s[l]);this._linear=u.reduce(((t,e)=>t+df(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=cf.dist(n,s.C));const a=o*(1-r)/r,l=cf.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 cf}getUtils(){return e.getUtils()}static get PolyBezier(){return uf}valueOf(){return this.toString()}toString(){return cf.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=cf.derive(this.points,this._3d),this.computedirection()}computedirection(){const t=this.points,e=cf.angle(t[0],t[this.order],t[1]);this.clockwise=e>0}length(){return cf.length(this.derivative.bind(this))}static getABC(t=2,e,n,i,r=.5){const o=cf.projectionratio(r,t),s=1-o,a={x:o*e.x+s*i.x,y:o*e.y+s*i.y},l=cf.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],cf.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=cf.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=cf.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?cf.computeWithRatios(t,this.points,this.ratios,this._3d):cf.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 cf.compute(t,this.dpoints[0],this._3d)}dderivative(t){return cf.compute(t,this.dpoints[1],this._3d)}align(){let t=this.points;return new e(cf.align(t,{p1:t[0],p2:t[t.length-1]}))}curvature(t){return cf.curvature(t,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return cf.inflections(this.points)}normal(t){return this._3d?this.__normal3(t):this.__normal2(t)}__normal2(t){const e=this.derivative(t),n=gf(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=gf(e.x*e.x+e.y*e.y+e.z*e.z),r=gf(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=gf(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=cf.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=cf.map(0,0,1,this._t1,this._t2),r.left._t2=cf.map(t,0,1,this._t1,this._t2),r.right._t1=cf.map(t,0,1,this._t1,this._t2),r.right._t2=cf.map(1,0,1,this._t1,this._t2),n?(n=cf.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]=cf.droots(r),3===this.order&&(r=this.dpoints[1].map(i),t[n]=t[n].concat(cf.droots(r))),t[n]=t[n].filter((function(t){return t>=0&&t<=1})),e=e.concat(t[n].sort(cf.numberSort))}.bind(this)),t.values=e.sort(cf.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]=cf.getminmax(this,n,t[n])}.bind(this)),e}overlaps(t){const e=this.bbox(),n=t.bbox();return cf.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=cf.angle(this.points[0],this.points[3],this.points[1]),e=cf.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),df(vf(n))<yf/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,df(n-i)<r)return[];e=t.split(n,i),e._t1=cf.map(n,0,1,t._t1,t._t2),e._t2=cf.map(i,0,1,t._t1,t._t2),s.push(e),n=i;break}n<1&&(e=t.split(n,1),e._t1=cf.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=cf.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]=cf.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=gf(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]=cf.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=cf.makeline(h[2],d[0]),p=cf.makeline(d[2],h[0]),m=[f,new e(d),p,new e(h)];return new uf(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 cf.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=cf.makeline(v,p),b=cf.makeline(m,g),k=[y].concat(a).concat([b]).concat(c);return new uf(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=cf.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=hf(t.p1.x,t.p2.x),n=hf(t.p1.y,t.p2.y),i=ff(t.p1.x,t.p2.x),r=ff(t.p1.y,t.p2.y);return cf.roots(this.points,t).filter((t=>{var o=this.get(t);return cf.between(o.x,e,i)&&cf.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=cf.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=cf.dist(t,e),l=cf.dist(t,o),c=cf.dist(t,s);return df(l-a)+df(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=cf.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*pf(a.e),y:a.y+a.r*mf(a.e)};a.e+=cf.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 kf={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 bf({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 bf(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 bf(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 xf{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{wf(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 wf(t,e,n){let i=t[e];t[e]=t[n],t[n]=i}function _f(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 Tf={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 xf(n,i);let o=[];for(let n=0;n<e;n++)o.push(_f(n/(e-1),r,t));return o}};function If(t,e=256,n={}){return"bezier"===n.type?kf.pointsToCurve(t,e,n):Tf.pointsToCurve(t,e)}const Ef=[];for(let t=0;t<256;t++)Ef[t]=t;class Sf extends Mh{constructor(t){const e={vertex:Gh,fragment:Hh},n={uniforms:Mh.getUniformInfo(Sf)};super(Sf.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,If(n,256).map((t=>255*t))):Ef],this.uniforms[_h.STATIC_OPTIONS].set(e)}}function Af(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 Nf extends Mh{constructor(t){const e={vertex:Gh,fragment:Hh},n={uniforms:Mh.getUniformInfo(Nf)};super(Nf.getFilterType(),e,n,t)}static getFilterType(){return"levels"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=[...Af(t.black,t.white,t.gamma)];this.uniforms[_h.STATIC_OPTIONS].set(e)}}const Mf=360,Ff=[];for(let t=0;t<Mf;t++)Ff[t]=t;class Of extends Mh{constructor(t){const e={uniforms:Mh.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}\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 If(t,Mf,{type:"bezier"}).map((t=>{return e=t,((Math.round(e.x*Mf)+180)%Mf+(1-e.y-.5)*Mf+Mf)%Mf;var e}))}(t.points)||Ff;this.uniforms[_h.STATIC_OPTIONS].set(e)}}class Pf extends Mh{constructor(t){const e={uniforms:Mh.getUniformInfo(Pf)};super(Pf.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[_h.STATIC_OPTIONS].set([e,n])}}class Cf extends Mh{constructor(t){const e={uniforms:Mh.getUniformInfo(Cf)};super(Cf.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[_h.STATIC_OPTIONS].set([e,n,i,r])}}class Df extends Mh{constructor(t){const e={uniforms:Mh.getUniformInfo(Df)};super(Df.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[_h.STATIC_OPTIONS].set([e])}}class Rf extends Mh{constructor(t){const e={uniforms:Mh.getUniformInfo(Rf)};super(Rf.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[_h.FIRST_TEXTURE,kh,xh]}handleStaticUniforms(t){let e={...Rf.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[_h.STATIC_OPTIONS].set([n,i,r,o,s,a,l,c,h,f,d,u])}}class Lf extends Mh{constructor(t){const e={uniforms:Mh.getUniformInfo(Lf)};super(Lf.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[_h.STATIC_OPTIONS].set([n,i,r,o])}}class Bf extends Mh{constructor(t){const e={uniforms:Mh.getUniformInfo(Bf)};super(Bf.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 zf extends Mh{constructor(t){const e={uniforms:Mh.getUniformInfo(zf)};super(zf.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[_h.STATIC_OPTIONS].set([e,n])}}class Wf extends Mh{constructor(t){const e={uniforms:Mh.getUniformInfo(Wf)};super(Wf.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[_h.STATIC_OPTIONS].set([e])}}var Uf,jf,$f,qf,Vf,Gf,Hf,Kf;function Xf(){if(qf)return $f;qf=1;const t=jf?Uf:(jf=1,Uf={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"]}};$f=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]},$f}function Yf(){if(Gf)return Vf;Gf=1;const t=Xf();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 Vf=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 Qf=function(){if(Kf)return Hf;Kf=1;const t=Xf(),e=Yf(),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}(),Jf=Ru(Qf);class Zf extends Mh{constructor(t){const e={uniforms:Mh.getUniformInfo(Zf)};super(Zf.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[_h.STATIC_OPTIONS].set([e[0],e[1],e[2]])}}class tp extends Mh{constructor(t){const e={uniforms:Mh.getUniformInfo(tp)};super(tp.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[_h.STATIC_OPTIONS].set([e.from,e.to,...e.ease])}static getUniformList(){return[_h.FIRST_TEXTURE,wh]}}class ep extends Mh{constructor(t){const e={uniforms:Mh.getUniformInfo(ep)};super(ep.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[_h.STATIC_OPTIONS].set([e.from,e.to,...e.ease])}static getUniformList(){return[_h.FIRST_TEXTURE,wh]}}class np extends Mh{constructor(t){const e={uniforms:Mh.getUniformInfo(np)};super(np.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[_h.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[_h.FIRST_TEXTURE,wh]}}class ip extends Mh{constructor(t){const e={uniforms:Mh.getUniformInfo(ip)};super(ip.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[_h.STATIC_OPTIONS].set([e.from,e.to,...e.ease,n.x,n.y])}static getUniformList(){return[_h.FIRST_TEXTURE,wh,kh]}}class rp extends Mh{constructor(t){const e={uniforms:Mh.getUniformInfo(rp)};super(rp.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[_h.STATIC_OPTIONS].set([e.from,e.to,...e.ease,i[0],i[1],i[2]])}static getUniformList(){return[_h.FIRST_TEXTURE,wh]}}var op=Object.freeze({__proto__:null,Crop:Rf,Curves:Sf,Default:Fh,DipToBlackTransition:ep,DirectionalBlur:Uh,Exposure:Wf,ExposureTransition:tp,FadeToColorTransition:rp,FastBlur:Wh,HardLight:Zf,HorizontalBlur:Bh,Hue:Of,Lab:zf,Levels:Nf,Lut:Vh,MotionBlurTransition:ip,Opacity:jh,Saturation:Df,ShapeComposite:qh,ShapeCompositeMask:$h,Solid:Lf,SolidImage:Bf,Transform:Lh,TransformTransition:np,VerticalBlur:zh,Vibrance:Cf,WhiteBalance:Pf});const sp=Object.values(op).reduce(((t,e)=>(t[e.getFilterType()]=e,t)),{});class ap{constructor(t){this.context=t}static getFilterClass(t){return sp[t]}getFilterIds(){return Object.keys(this.filterTypeToInstanceMap)}create(t,e){this.context={...this.context,options:e.options};const n=new sp[t](this.context);if(!n)throw new Error(`${t} is not a atom filter, atomFilter list: `,this.getFilterIds());return n}}const lp=wd.PREVIOUS_OUTPUT_PREFIX,cp=Object.values(op).reduce(((t,e)=>(t[e.getFilterType()]={type:e.getFilterType(),options:e.getInitialOptions(),inputs:[...Array(e.getInputsCount())].map(((t,e)=>`${lp}${e}`)),outputs:[]},t)),{});var up,dp,hp=function(){if(dp)return up;dp=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)}),{})},up=s}(),fp=Ru(hp),pp=function(t,e){return fp(t,e,{arrayMerge:(t,e)=>e})};const mp=wd.MESSAGES.UPDATE_OPTIONS;let vp=class{constructor(t,e){this.eventEmitter=new Sd,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(mp,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 gp extends vp{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=pp(this.options,t),this.filter.updateStaticUniforms(this.options)}dispose(){this.filter.dispose()}}const yp=wd.MESSAGES.UPDATE_OPTIONS;class bp extends gp{constructor(t,e,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}baseNodeUpdateOptions(t){this.options=pp(this.options,t),this.filter.updateStaticUniforms(this.options)}registerListeners(){this.baseNode.getEventEmitter().on(yp,this.baseNodeUpdateOptions,this)}dispose(){this.filter.dispose(),this.baseNode.getEventEmitter().off(yp,this.baseNodeUpdateOptions,this)}}function kp(t){return null!==t&&"object"==typeof t}function xp(t){if(!kp(t)||(e=t,Array.isArray(e)))return t;var e;const n=Object.keys(t).sort(),i={};return n.forEach((e=>{i[e]=xp(t[e])})),i}function wp(t,e){return null!=t&&t.id&&null!=e&&e.id?t.type===e.type&&t.id===e.id:t.type===e.type}function _p(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)),kp(i=n)&&kp(r)?JSON.stringify(xp(i))===JSON.stringify(xp(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]&&wp(a,c[l])?l:c.findIndex((t=>wp(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 Tp(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=Rp.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 Ip=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 Tp(_p(r,o),r,n,i)};class Ep extends vp{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=>Rp.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 Pd(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=Ip(t,this.options,this.nodes,this.context),this.options=t}dispose(){this.nodes.forEach((t=>{t.dispose()}))}}const Sp=wd.MESSAGES.UPDATE_OPTIONS;class Ap extends Ep{constructor(t,e,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}registerListeners(){this.baseNode.getEventEmitter().on(Sp,this.updateOptions,this)}dispose(){this.nodes.forEach((t=>{t.dispose()})),this.baseNode.getEventEmitter().off(Sp,this.updateOptions,this)}}const Np=wd.SYSTEM_NODES.TAGS.ATOM,Mp=wd.SYSTEM_NODES.TAGS.FILTER,Fp=wd.SYSTEM_NODES.TAGS.COMPOSITE_FILTER,Op=wd.SYSTEM_NODES.TAGS.TRANSITION_FILTER,Pp=wd.PREVIOUS_OUTPUT_PREFIX,Cp=Object.keys(cp);function Dp(t,e){const n=(i=t.type,cp[i]);var i;return t=pp(n,t),new gp(t.type,t,e)}var Rp={create:function(t,e){let n;switch(function(t){let e;return n=t,e=Cp.includes(n)?Np:t===Fp?Fp:t===Op?Op:Mp,e;var n}((t=JSON.parse(JSON.stringify(t))).type)){case Np:n=Dp(t,e);break;case Mp: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=pp(r,t),e={...e,baseNode:n},o=i===Fp?new Ap(i,t,e):new bp(i,t,e),o}(t,e);break;case Fp:n=function(t,e){const n=t.type;return t=pp({inputs:[`${Pp}0`]},t),new Ep(n,t,e)}(t,e);break;case Op: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`,Dp(t,e)}(t,e);break;default:throw new Error("cant create node",t.type)}return n}};const Lp=wd.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS;var Bp=function(t){const e={[Lp]:cp[Lp]};for(const[n,i]of Object.entries(e)){const e=Rp.create(i,t);t.nodeStore.set(n,e)}},zp=function(t,e){for(const[n,i]of Object.entries(t)){const t=Rp.create(i,e);e.nodeStore.set(n,t)}};const Wp=wd.CAPTURED_FRAME_PREFIX;class Up{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=`${Wp}${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 jp=Zu("ShaderGraphApplication","warn"),$p=wd.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS,qp=Object.freeze({useCanvasSizedFilterTargets:!1,rebindAttributesOnProgramSwitch:!0,forwardContextAttributes:!0});function Vp(t={}){const e=null==t?void 0:t.performanceToggles;return e&&"object"==typeof e?{...qp,...e}:{...qp}}class Gp{constructor(t,e={}){return this.glSource=t,this.config=e,this.performanceToggles=Vp(e),this.isContextLost=!1,this.isRecovering=!1,this.isDisposed=!1,this.pendingNodeOptionUpdates=new Map,this.doInit(t,e)}doInit(t,e){this.source=Fd(t),this.performanceToggles=Vp(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=qp){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 Ud({gl:this.gl,activeTextures:this.activeTextures}),this.capturedFramesManager=new Up({textureManager:this.textureManager}),this.graphIOManager=new Xd({glSource:t,gl:this.gl,textureManager:this.textureManager,capturedFramesManager:this.capturedFramesManager}),this.frameBufferFactory=new nh({gl:this.gl,textureManager:this.textureManager,useCanvasSizedFilterTargets:this.performanceToggles.useCanvasSizedFilterTargets}),this.filterFactory=new ap({gl:this.gl,frameBufferFactory:this.frameBufferFactory,rebindAttributesOnProgramSwitch:this.performanceToggles.rebindAttributesOnProgramSwitch}),this.nodeStore=new Pd,this.ioStore=new Pd,Bp({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 jp.debug("[getNodes]"),this.nodeStore.get()}addClientNodes(t,e=!1){if(jp.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));zp(n,{nodeStore:this.nodeStore,filterFactory:this.filterFactory})}addTexture(t,e,n){if(jp.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){jp.debug("[releaseTexture]",t),this.isContextUnavailable()||this.textureManager.releaseTexture(t)}selectNode(t){if(jp.debug("[selectNode]",t),!this.isContextUnavailable())return this.nodeStore.get(t)||jp.warn("Missing render node",t),void(this.selectedRenderNodeId=t);this.selectedRenderNodeId=t}captureTexture(){return jp.debug("[captureTexture]"),this.isContextUnavailable()?null:this.capturedFramesManager.createCaptureId()}disposeTexture(t){return jp.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){jp.error("Failed to apply pending node options",e,t),this.queueNodeOptionUpdate(e,n)}return}this.updateOptions(e,n)}catch(t){jp.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;Zd(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&&(Zd(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):(jp.warn("Missing selected render node",this.selectedRenderNodeId),this.selectedRenderNodeId=null)}renderToCanvas(t){const e=this.nodeStore.get($p);e&&"function"==typeof e.render?e.render(t):jp.warn("Missing render-to-canvas node")}updateOptions(t,e){if(jp.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){jp.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(){jp.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),jp.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=>{jp.debug("Re-adding client nodes",t),this.addClientNodes(t,!0)})),Object.entries(e).forEach((([t,e])=>{jp.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&&(jp.debug("Recovering glSource (i.e. seeking/resetting player)"),await this.source.recover()),this.isContextLost=!1,this.isRecovering=!1,o&&this.render()}catch(t){jp.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 Kp(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 Xp 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:Kp(a)}),o.push(l)}return{graph:r,outputs:o,signature:this.getSignature()}}}class Yp{#A=new Map;constructor(){this.register("retarget",Xp)}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 Qp{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 Qp{#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 Zp=new WeakMap,tm=new WeakMap,em=new WeakSet;class nm extends Qp{constructor(...t){super(...t),j(this,em),W(this,Zp,null),W(this,tm,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:nm.type,signature:`${nm.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{L(em,this,im).call(this,i,t)}catch(t){}return}try{L(em,this,rm).call(this,i,o,n)}catch(t){}}}}function im(t,e){if(!e)return;const n=pe.buildLayoutGraph({inputs:["__SRC_TEXTURE:0"]}),i=n.signature;z(Zp,this)!==i&&(t.updateOptions(e,{graph:n.graph}),U(Zp,this,i)),z(tm,this)!==e&&(t.selectNode(e),U(tm,this,e)),t.render({noRaf:!0})}function rm(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=pe.buildLayoutGraph({inputs:r}),s=o.signature;z(Zp,this)!==s&&(t.updateOptions(e,{graph:o.graph}),U(Zp,this,s)),z(tm,this)!==e&&(t.selectNode(e),U(tm,this,e)),t.render({noRaf:!0})}function om(t){const e=Number(t);return Number.isFinite(e)?e<=0?0:e>=1?1:e:0}pe=nm;class sm extends Qp{#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=om(e),i=[{type:"opacity",inputs:[t[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",t[0]],options:{}}];return{type:sm.type,signature:`${sm.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=om((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=sm.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=sm.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 am(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 lm(t){return!(!t||!0===t.offsetPending)&&Number.isFinite(t.offset)}function cm(t){return lm(t)?t.offset:void 0}function um(t,e,n,i={}){if(!t)return!1;const r=cm(t);if(!Number.isFinite(r))return!1;const o=am(t,n,i);return Number.isFinite(o)?e>=r&&e<r+o:e>=r}function dm(t=[]){if(!Array.isArray(t))return t;const e=[],n=[];return t.forEach((t=>{lm(t)?e.push(t):n.push(t)})),e.sort(((t,e)=>t.offset-e.offset)),t.splice(0,t.length,...e,...n),t}function hm(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=cm(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&&dm(t),{updated:a,resolvedPlacements:l}}function fm(t){const e=Number(t);return Number.isFinite(e)?e:0}function pm(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 mm(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 vm(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 gm(t){const e=Number(t);return Number.isFinite(e)&&e>0?e:0}function ym(t){return(null==t?void 0:t.id)||(null==t?void 0:t.nodeId)||null}function bm(t,e){return Array.isArray(t)&&e?t.findIndex((t=>ym(t)===e)):-1}function km(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=bm(e,n);return t>=0?(t+1)%i:0}if("prev"===t){const t=bm(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)?ym(e[i]):null}function xm(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=cm(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)=>cm(t)-cm(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 wm(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 _m(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 Tm(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(wm(n,r,t))return r}return null}function Im(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 Em extends Qp{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=om(e),i=[{type:"opacity",inputs:[t[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",t[0]],options:{}}];return{type:Em.type,signature:`${Em.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:om(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&&(Im(a),a.activeRenderPlacementId=l);const c=null==r?void 0:r.initSwitching,u=xm(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=_m(a.placements,a.selectedPlacementId),i=km(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=km(Number.isInteger(t)&&t>=0?t:0,a.nodes,null);let n=null;if(e&&(n=Tm(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&&wm(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=Tm(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=gm(a.pendingSwitch.crossfadeSeconds),s=gm(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=om(t/a.switchDuration))}a.switchNormalizedTime=Number.isFinite(p)?p:void 0;const m=_m(a.placements,a.selectedPlacementId),v=wm(s,a.selectedPlacementId,m)||s[0];let g=null;if(Number.isFinite(a.switchNormalizedTime)&&a.previousPlacementId){const t=_m(a.placements,a.previousPlacementId),e=_m(a.placements,a.selectedPlacementId),n=wm(s,a.previousPlacementId,t),i=wm(s,a.selectedPlacementId,e);n&&i&&(g=[n,i])}return g||(g=v?[v]:s),g}static resetRenderState(t){t&&"object"==typeof t&&Im(t)}}const Sm=[Jp,nm,sm,Em],Am=new Map;function Nm(t){if("string"!=typeof t)return null;const e=t.trim();return e?e.toLowerCase():null}function Mm(t){const e=Nm(t);return e&&Am.get(e)||null}function Fm(t){return Mm(t)||Jp}Sm.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=Nm(e);n&&Am.set(n,t)}))}(t)));class Om{static get defaultType(){return Jp.type||"default"}static getRenderNodeClass(t){return Mm(t)}static normalizeType(t){const e=Mm(t);return e?e.type:null}static doesRenderNodeTypeRequireFrameCadence(t){const e=Mm(t);return!!e&&!0===e.requiresFrameCadence}static buildLayoutGraph({type:t,inputs:e=[],normalizedTime:n}={}){const i=Fm(t);return i&&"function"==typeof i.buildLayoutGraph?i.buildLayoutGraph({inputs:e,normalizedTime:n}):Jp.buildLayoutGraph({inputs:e,normalizedTime:n})}static getPanAndScanTarget(t){const e=Fm(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=Fm(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=Fm(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=Fm(t);n&&"function"==typeof n.resetRenderState&&n.resetRenderState(e)}static resetAllRenderStates(t){t&&"function"==typeof t.forEach&&t.forEach(((t,e)=>{Om.resetRenderState(e,t)}))}create(t,e){return t&&"function"==typeof t.render?t:new(Fm(t))(e)}}function Pm(t){return Array.isArray(t)?t.filter((t=>t&&"string"==typeof t.type)):[]}function Cm(t,e){return t&&"function"==typeof t.getSignature?t.getSignature():(null==e?void 0:e.type)||"stage"}class Dm{#O;constructor(t){this.#O=t||new Yp}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=Om.normalizeType(null==t?void 0:t.layoutType)||Om.defaultType,r=null==t?void 0:t.normalizedTime,o=Pm(null==t?void 0:t.preStages),s=Pm(null==t?void 0:t.postStages),a=[],l=[`layout:${i}`,`inputs:${e}`];let c=n;o.forEach(((e,n)=>{const i=this.#O.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(Cm(i,e))}));const u=Om.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.#O.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(Cm(i,e))})),{graph:a,signature:l.join("|"),isDynamic:d}}}const Rm=[0,0,1,1],Lm="zoomInExposure",Bm=["transform","exposure","fadeToColor","dipToBlack"],zm={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 Wm(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}function Um(t,e=Rm){return Array.isArray(t)&&t.length>=4?t:e}function jm(t){return"string"==typeof t&&t.trim()?t.trim():"#ffffff"}function $m(t,e){const n=null==t?void 0:t[e];return!1===n||null==n?null:ed(n)?n:{}}function qm(t={}){let e=0;return Bm.forEach((n=>{const i=$m(t,n);if(!i)return;const r=Wm(null==i?void 0:i.duration);r>e&&(e=r)})),e}function Vm(t,e,n,i,r){const o=[];return Bm.forEach((s=>{const a=$m(t,s);if(!a)return;const l=function(t,e,n){const i=Wm(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=Um(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=Um(null==e?void 0:e.ease),n=(null==e?void 0:e.power)||{from:0,to:1};return o.options.properties.power={from:Wm(null==n?void 0:n.from,0),to:Wm(null==n?void 0:n.to,1),ease:t},o.options.properties.color=jm((null==e?void 0:e.color)||r),o}if("exposure"===t||"dipToBlack"===t){const t=Um(null==e?void 0:e.ease),n=(null==e?void 0:e.power)||{from:0,to:1};return o.options.properties.power={from:Wm(null==n?void 0:n.from,0),to:Wm(null==n?void 0:n.to,1),ease:t},o}return null}(s,a,e,l,r);c&&o.push(c)})),o}function Gm(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{#P=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(ed(null==t?void 0:t.transition))return t.transition;if("string"==typeof(null==t?void 0:t.transition))return zm[t.transition]||zm[Lm];if(ed(null==t?void 0:t.filters)||ed(null==t?void 0:t.reverseFilters))return{filters:t.filters||{},reverseFilters:t.reverseFilters||{}};if("string"==typeof(null==t?void 0:t.filter)){const e=Wm(t.duration)>0?1e3*t.duration:500;return{filters:{[t.filter]:{duration:e,power:{from:0,to:1}}},reverseFilters:{}}}return zm[Lm]}(t),n=nd({},(null==e?void 0:e.filters)||{},ed(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(ed(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=nd({},(null==e?void 0:e.reverseFilters)||{},ed(null==t?void 0:t.reverseFilters)?t.reverseFilters:{});return{baseFilters:n,reverseFilters:nd({},i,r)}}(t),r=Wm(null==t?void 0:t.duration),o=r>0?1e3*r:null,s=qm(n),a=qm(i),l=o&&s>0?o/s:1,c=o&&a>0?o/a:1,u=o||s||500,d=o||a||u,h=jm(null==t?void 0:t.color),f=e.captureTexture(),p=Date.now(),m=Vm(n,p,l,o,h);return this.#P={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:Gm(m),inGraph:null,inSignature:null},{captureId:f,outDurationMs:u,inDurationMs:d}}beginIncoming(){if(!this.#P)return;const t=Date.now(),e=Vm(this.#P.reverseFilters,t,this.#P.inScale,this.#P.durationOverrideMs,this.#P.color);this.#P={...this.#P,phase:"in",startTime:t,inGraph:e,inSignature:Gm(e)}}reset(t){var e;t&&"function"==typeof t.disposeTexture&&null!==(e=this.#P)&&void 0!==e&&e.captureId&&t.disposeTexture(this.#P.captureId),this.#P=null}getState(){return this.#P}buildOutgoingGraph(){const t=this.#P;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.#P;return t&&"in"===t.phase&&Array.isArray(t.inGraph)&&t.inGraph.length?{signature:`transition:in:${t.inSignature||""}`,forceUpdate:!1,graph:t.inGraph}:null}}let Km;const Xm=[/firefox\/(\d+)/,/edg\/(\d+)/,/opr\/(\d+)/,/chrome\/(\d+)/];function Ym(){const t=cd&&cd.navigator&&(cd.navigator.userAgent||cd.navigator.platform||cd.navigator.vendor)||"";if(Km&&Km.ua===t)return Km;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<Xm.length;e+=1){const n=Xm[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 Km={ua:t,lowerUA:e,isAndroid:n,isiOS:i,isMobile:r,isDesktop:o,isFirefox:s,browserMajorVersion:a},Km}function Qm(){return Ym().ua}function Jm(){return Ym().isAndroid}function Zm(){return Ym().isiOS}function tv(){return Ym().isMobile}function ev(){return Ym().isDesktop}function nv(){return Ym().isFirefox}function iv(){return Ym().browserMajorVersion}var rv={getUserAgent:Qm,isAndroid:Jm,isiOS:Zm,isMobile:tv,isDesktop:ev,isFirefox:nv,getBrowserMajorVersion:iv},ov=Object.freeze({__proto__:null,default:rv,getBrowserMajorVersion:iv,getUserAgent:Qm,isAndroid:Jm,isDesktop:ev,isFirefox:nv,isMobile:tv,isiOS:Zm});const sv=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 av(t,e){const n={};return Number.isFinite(t)&&(n.time=t),"string"==typeof e&&(n.source=e),n}function lv({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 cv({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 uv="Idle",dv="Playing",hv="FirstFramePending",fv="Waiting",pv="Paused",mv="Seeking",vv="Resetting";function gv(t){return Array.isArray(t)?t.filter((t=>t&&"string"==typeof t.type)):[]}function yv(t,e){return!!Array.isArray(t)&&t.some((t=>(null==t?void 0:t.type)===e))}function bv(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 kv(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 xv=2073600;function wv(t,e){const n=Number(t);return Number.isFinite(n)&&n>0?n:e}function _v(t,e){if(null==t)return e;const n=Number(t);return Number.isFinite(n)?n:e}var Tv=new WeakMap,Iv=new WeakMap,Ev=new WeakMap,Sv=new WeakMap,Av=new WeakMap,Nv=new WeakMap,Mv=new WeakMap,Fv=new WeakMap,Ov=new WeakMap,Pv=new WeakMap,Cv=new WeakMap,Dv=new WeakMap,Rv=new WeakMap,Lv=new WeakMap,Bv=new WeakMap,zv=new WeakMap,Wv=new WeakMap,Uv=new WeakMap,jv=new WeakMap,$v=new WeakMap,qv=new WeakMap,Vv=new WeakMap,Gv=new WeakMap,Hv=new WeakMap,Kv=new WeakMap,Xv=new WeakMap,Yv=new WeakMap,Qv=new WeakMap,Jv=new WeakMap,Zv=new WeakMap,tg=new WeakSet;class eg extends sd{static get pipelineNodeId(){return"ekoplayer-render-pipeline"}get defaults(){return{defaultRenderParams:void 0,resourceLimits:{enabled:!0,maxCanvasPixels:xv,maxDevicePixelRatio:0,renderScale:1,transitionMinFrameIntervalMs:33}}}constructor(...t){super(...t),j(this,tg),W(this,Tv,void 0),W(this,Iv,void 0),W(this,Ev,void 0),W(this,Sv,void 0),W(this,Av,void 0),W(this,Nv,void 0),W(this,Mv,void 0),W(this,Fv,void 0),W(this,Ov,void 0),W(this,Pv,void 0),W(this,Cv,null),W(this,Dv,null),W(this,Rv,void 0),W(this,Lv,void 0),W(this,Bv,void 0),W(this,zv,[]),W(this,Wv,[]),W(this,Uv,null),W(this,jv,null),W(this,$v,null),W(this,qv,null),W(this,Vv,null),W(this,Gv,null),W(this,Hv,new Map),W(this,Kv,null),W(this,Xv,null),W(this,Yv,!1),W(this,Qv,!1),W(this,Jv,[]),W(this,Zv,null);const[e,n,i]=t;U(Tv,this,e),U(Iv,this,n),U(Ev,this,i),z(Tv,this)&&"function"==typeof z(Tv,this).enableFirstFrameRenderedGate&&z(Tv,this).enableFirstFrameRenderedGate(),U(Pv,this,new Dm),U(Rv,this,new Hm),U(Lv,this,null),U(Bv,this,null),U($v,this,null),U(Sv,this,(t=>L(tg,this,Cg).call(this,t))),z(Tv,this)&&"function"==typeof z(Tv,this).on&&(z(Tv,this).on(sv.VISUAL_FRAMES_AVAILABLE,z(Sv,this)),U(Av,this,(()=>{var t,e,n,i;L(tg,this,og).call(this),L(tg,this,Ng).call(this,0),U(Wv,this,[]),U(Uv,this,null),U(Cv,this,null),U(Dv,this,null),L(tg,this,bg).call(this),U(Kv,this,null);(null===(t=z(Rv,this))||void 0===t||null===(e=t.getState)||void 0===e?void 0:e.call(t))||null===(n=z(Rv,this))||void 0===n||null===(i=n.reset)||void 0===i||i.call(n,z(Lv,this))})),z(Tv,this).on(sv.TIMELINE_SEEKING,z(Av,this)),U(Nv,this,(()=>L(tg,this,sg).call(this))),z(Tv,this).on(sv.TIMELINE_RESET,z(Nv,this)),U(Ov,this,(()=>L(tg,this,_g).call(this))),z(Tv,this).on(sv.TIMELINE_TIME_UPDATE,z(Ov,this)),U(Mv,this,(()=>{L(tg,this,Dg).call(this)&&z(jv,this)&&L(tg,this,Cg).call(this,z(jv,this))})),z(Tv,this).on(sv.TIMELINE_STATE_CHANGE,z(Mv,this))),U(Fv,this,(()=>{U(Uv,this,null),z(jv,this)&&L(tg,this,Dg).call(this)&&L(tg,this,Cg).call(this,z(jv,this))})),z(Ev,this)&&"function"==typeof z(Ev,this).on&&z(Ev,this).on(sv.CONTAINER_RESIZE,z(Fv,this))}get name(){return"Renderer"}onDispose(){z(Tv,this)&&z(Sv,this)&&"function"==typeof z(Tv,this).off&&z(Tv,this).off(sv.VISUAL_FRAMES_AVAILABLE,z(Sv,this)),z(Tv,this)&&z(Av,this)&&"function"==typeof z(Tv,this).off&&z(Tv,this).off(sv.TIMELINE_SEEKING,z(Av,this)),z(Tv,this)&&z(Nv,this)&&"function"==typeof z(Tv,this).off&&z(Tv,this).off(sv.TIMELINE_RESET,z(Nv,this)),z(Tv,this)&&z(Ov,this)&&"function"==typeof z(Tv,this).off&&z(Tv,this).off(sv.TIMELINE_TIME_UPDATE,z(Ov,this)),z(Tv,this)&&z(Mv,this)&&"function"==typeof z(Tv,this).off&&z(Tv,this).off(sv.TIMELINE_STATE_CHANGE,z(Mv,this)),z(Ev,this)&&z(Fv,this)&&"function"==typeof z(Ev,this).off&&z(Ev,this).off(sv.CONTAINER_RESIZE,z(Fv,this)),L(tg,this,ng).call(this),U(Sv,this,null),U(Av,this,null),U(Nv,this,null),U(Ov,this,null),U(Mv,this,null),U(Fv,this,null),U(Pv,this,null),U(Rv,this,null),U(Hv,this,null),U(Kv,this,null),U(Iv,this,null),U(Ev,this,null),U(Tv,this,null)}startTransition(t={}){var e;const n=null===(e=z(Iv,this))||void 0===e?void 0:e.element;if(!n)return null;if(L(tg,this,lg).call(this,n),!z(Lv,this))return null;const i=z(Rv,this).start({shaderGraph:z(Lv,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 U($v,this,z(jv,this)||null),L(tg,this,Fg).call(this),i}beginTransitionIn(t={}){var e,n;null!==(e=z(Rv,this))&&void 0!==e&&null!==(n=e.beginIncoming)&&void 0!==n&&n.call(e,t),U($v,this,null),L(tg,this,Fg).call(this)}resetTransition(){var t,e;null!==(t=z(Rv,this))&&void 0!==t&&null!==(e=t.reset)&&void 0!==e&&e.call(t,z(Lv,this)),U($v,this,null),L(tg,this,Og).call(this)}}function ng(){if(L(tg,this,og).call(this),z(Rv,this)&&"function"==typeof z(Rv,this).reset&&z(Rv,this).reset(z(Lv,this)),L(tg,this,Ng).call(this,0),z(Lv,this)&&"function"==typeof z(Lv,this).dispose)try{z(Lv,this).dispose()}catch(t){}U(Lv,this,null),U(Bv,this,null),U(zv,this,[]),U(Wv,this,[]),U(Uv,this,null),U(Cv,this,null),U(Dv,this,null),U(jv,this,null),U($v,this,null),L(tg,this,Og).call(this),L(tg,this,bg).call(this),U(Kv,this,null)}function ig(){return{schedule:"function"==typeof cd.requestAnimationFrame?cd.requestAnimationFrame.bind(cd):t=>setTimeout(t,16),cancel:"function"==typeof cd.cancelAnimationFrame?cd.cancelAnimationFrame.bind(cd):clearTimeout}}function rg(t){U(Jv,this,z(Jv,this).filter((e=>e!==t))),z(Jv,this).length||U(Zv,this,null)}function og(){z(Zv,this)&&z(Jv,this).forEach((t=>z(Zv,this).call(this,t))),U(Jv,this,[]),U(Zv,this,null),U(Qv,this,!1)}function sg(){L(tg,this,og).call(this),U(Yv,this,!1)}function ag(){if(z(Yv,this)||z(Qv,this))return;const{schedule:t,cancel:e}=L(tg,this,ig).call(this);let n;U(Zv,this,e),U(Qv,this,!0),n=t((()=>{let e;L(tg,this,rg).call(this,n),e=t((()=>{L(tg,this,rg).call(this,e),U(Qv,this,!1),z(Yv,this)||(U(Yv,this,!0),z(Tv,this)&&"function"==typeof z(Tv,this).notifyFirstFrameRendered&&z(Tv,this).notifyFirstFrameRendered())})),z(Jv,this).push(e)})),z(Jv,this).push(n)}function lg(t){if(z(Lv,this)||!t)return;const e=this,n={dest:t,src:(t,n)=>{U(Bv,e,n)}};U(Lv,e,new Gp(n,{userWillCallRender:!0,glOptions:{contextType:"webgl2"},performanceToggles:{useCanvasSizedFilterTargets:!0}})),z(Lv,e)&&"function"==typeof z(Lv,e).addNodes&&z(Lv,e).addNodes({[me.pipelineNodeId]:{type:"composite",options:{graph:[]}}})}function cg(){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 ug(){const t=L(tg,this,cg).call(this).enabled;return!0===t||!1!==t&&Zm()}function dg(){if(!L(tg,this,ug).call(this))return 0;const t=_v(L(tg,this,cg).call(this).transitionMinFrameIntervalMs,33);return Number.isFinite(t)&&t>0?t:0}function hg(t,e,n={}){const i=!0===(null==n?void 0:n.useDevicePixelRatio),r=L(tg,this,ug).call(this),o=i?wv(null==cd?void 0:cd.devicePixelRatio,1):1;let s=o,a=0;if(r){const t=L(tg,this,cg).call(this);a=_v(t.maxCanvasPixels,xv);const e=_v(t.maxDevicePixelRatio,0);s=wv(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 fg(t=[],e={}){var n;const i=null===(n=z(Iv,this))||void 0===n?void 0:n.element,r=z(Bv,this);if(!i||"function"!=typeof r)return!1;let o=0,s=0;const a=!0===(null==e?void 0:e.useViewportSize);if(a){var l,c,u,d,h,f;const t=Number(null!==(l=null===(c=z(Ev,this))||void 0===c?void 0:c.containerWidth)&&void 0!==l?l:null===(u=z(Ev,this))||void 0===u?void 0:u.width),e=Number(null!==(d=null===(h=z(Ev,this))||void 0===h?void 0:h.containerHeight)&&void 0!==d?d:null===(f=z(Ev,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=L(tg,this,hg).call(this,o,s,{useDevicePixelRatio:a}),v=m.width,g=m.height,y=z(Uv,this);return!(y&&y.width===v&&y.height===g||(U(Uv,this,{width:v,height:g}),r(null,null,v,g),0))}function pg(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 mg(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=L(tg,this,vg).call(this,t),s=L(tg,this,gg).call(this,o);return Om.getRenderTiming({type:o,timing:{duration:i,normalizedTime:r},timelineTime:e,active:t,renderNodeParams:n,state:s})}function vg(t){return Om.normalizeType(null==t?void 0:t.type)||Om.defaultType}function gg(t){if(!t||!z(Hv,this))return null;let e=z(Hv,this).get(t);return e||(e={},z(Hv,this).set(t,e)),e}function yg(t){if(!t||!z(Hv,this))return;const e=z(Hv,this).get(t);e&&Om.resetRenderState(t,e),z(Hv,this).delete(t)}function bg(){z(Hv,this)&&(Om.resetAllRenderStates(z(Hv,this)),z(Hv,this).clear())}function kg(t,e,n,i){const r=L(tg,this,vg).call(this,t);z(Kv,this)&&z(Kv,this)!==r&&L(tg,this,yg).call(this,z(Kv,this)),U(Kv,this,r);const o=L(tg,this,gg).call(this,r);return Om.prepareRenderFrames({type:r,frames:e,timelineTime:n,timeline:z(Tv,this),active:t,renderNodeParams:i,state:o})}function xg(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 wg(t){return t?String(t.renderPlacementId||t.type||"unknown"):"default"}function _g(){if(!z(Tv,this)||!z(jv,this))return;const t=z(Tv,this).currentTime,e=z(Tv,this).getActiveRenderPlacement(t),n=L(tg,this,wg).call(this,e);n!==z(Xv,this)&&(U(Xv,this,n),L(tg,this,Cg).call(this,{...z(jv,this),time:t}))}function Tg(t){return!t||"object"!=typeof t||!Object.prototype.hasOwnProperty.call(t,"panAndScan")||!1!==t.panAndScan}function Ig(t,e){const n=L(tg,this,xg).call(this,t),i=null==n?void 0:n.stages;let r=gv(null==i?void 0:i.pre),o=gv(null==i?void 0:i.post);const s=L(tg,this,Tg).call(this,n),a=L(tg,this,vg).call(this,t),l=yv(r,"retarget")||yv(o,"retarget");if(s&&!l){const t=Om.getPanAndScanTarget(a);if("pre"===t){const t=bv(Array.isArray(e)?e.length:0);t&&(r=[t,...r])}else if("post"===t){const t=bv(1);t&&(o=[...o,t])}}else s||(r=kv(r),o=kv(o));return{preStages:r,postStages:o,renderNodeParams:n}}function Eg(t,e,n,i,r){const o=r||L(tg,this,mg).call(this,t,n,i),s=L(tg,this,Ig).call(this,t,e);return z(Pv,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 Sg(){var t,e;const n=null===(t=z(Rv,this))||void 0===t||null===(e=t.getState)||void 0===e?void 0:e.call(t);return"out"===(null==n?void 0:n.phase)?z(Rv,this).buildOutgoingGraph():"in"===(null==n?void 0:n.phase)?z(Rv,this).buildIncomingGraph():null}function Ag(t,e,n,i){const r=n||e!==z(Cv,this),o=r||i;return r&&z(Lv,this)&&"function"==typeof z(Lv,this).updateOptions&&(z(Lv,this).updateOptions(me.pipelineNodeId,{graph:t}),U(Cv,this,e)),z(Lv,this)&&"function"==typeof z(Lv,this).selectNode&&z(Dv,this)!==me.pipelineNodeId&&(z(Lv,this).selectNode(me.pipelineNodeId),U(Dv,this,me.pipelineNodeId)),!(!o||!z(Lv,this)||"function"!=typeof z(Lv,this).render||(z(Lv,this).render({noRaf:!0}),0))}function Ng(t){if(!Array.isArray(z(zv,this))||!z(zv,this).length)return;const e=Number.isFinite(t)?Math.max(0,t):0;if(!(z(zv,this).length<=e)){for(let t=e;t<z(zv,this).length;t+=1){const e=z(zv,this)[t];if(e&&z(Lv,this)&&"function"==typeof z(Lv,this).releaseTexture)try{z(Lv,this).releaseTexture(e)}catch(t){}}z(zv,this).length=e,z(Wv,this).length=e}}function Mg(t=[]){if(!z(Lv,this)||"function"!=typeof z(Lv,this).addTexture)return!1;if("function"==typeof z(Lv,this).isContextUnavailable&&z(Lv,this).isContextUnavailable())return!1;if(!Array.isArray(t)||!t.length)return L(tg,this,Ng).call(this,0),!1;L(tg,this,Ng).call(this,t.length);let e=!1;for(let i=0;i<t.length;i+=1){var n;z(zv,this)[i]||"function"!=typeof z(Lv,this).addTexture||(z(zv,this)[i]=z(Lv,this).addTexture(null,"frame",i));const r=L(tg,this,pg).call(this,t[i]),o=null===(n=t[i])||void 0===n?void 0:n.frame;if(z(zv,this)[i]&&o&&(!r||r!==z(Wv,this)[i]))try{z(zv,this)[i].fill(o),z(Wv,this)[i]=r,e=!0}catch(t){}}return e}function Fg(){if(z(qv,this))return;const t="function"==typeof cd.requestAnimationFrame?t=>cd.requestAnimationFrame(t):t=>setTimeout(t,16),e="function"==typeof cd.cancelAnimationFrame?t=>cd.cancelAnimationFrame(t):clearTimeout;U(Vv,this,e);const n=()=>{var e,i;if(null!==(e=z(Rv,this))&&void 0!==e&&null!==(i=e.getState)&&void 0!==i&&i.call(e)){if(z(jv,this)){const t=L(tg,this,dg).call(this),e=Date.now();(!t||!z(Gv,this)||e-z(Gv,this)>=t)&&(U(Gv,this,e),L(tg,this,Cg).call(this,z(jv,this)))}U(qv,this,t(n))}else U(qv,this,null)};U(qv,this,t(n))}function Og(){z(qv,this)&&z(Vv,this)&&z(Vv,this).call(this,z(qv,this)),U(qv,this,null),U(Vv,this,null),U(Gv,this,null)}function Pg(t){var e,n;const i=null===(e=z(Rv,this))||void 0===e||null===(n=e.getState)||void 0===n?void 0:n.call(e);return"out"===(null==i?void 0:i.phase)&&z($v,this)?z($v,this):t}function Cg(t={}){var e,n;const i=null===(e=z(Iv,this))||void 0===e?void 0:e.element,r=null===(n=z(Iv,this))||void 0===n?void 0:n.gl;if(!i||!r)return;if(t&&U(jv,this,t),!L(tg,this,Dg).call(this))return;const o=L(tg,this,Pg).call(this,t),s=Number.isFinite(null==o?void 0:o.time)?o.time:void 0;if(!Number.isFinite(s))return;if(L(tg,this,lg).call(this,i),!z(Lv,this))return;const a=z(Tv,this)&&"function"==typeof z(Tv,this).getActiveRenderPlacement?z(Tv,this).getActiveRenderPlacement(s):void 0,l=L(tg,this,wg).call(this,a);l!==z(Xv,this)&&U(Xv,this,l);const c=Array.isArray(null==o?void 0:o.frames)?o.frames:[],u=L(tg,this,xg).call(this,a),d=L(tg,this,Tg).call(this,u),h=L(tg,this,kg).call(this,a,c,s,u),f=L(tg,this,mg).call(this,a,s,u),p=L(tg,this,fg).call(this,h,{useViewportSize:d}),m=L(tg,this,Mg).call(this,h),v=L(tg,this,Eg).call(this,a,h,s,u,f),g=L(tg,this,Sg).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;L(tg,this,Ag).call(this,y,b,k,x)&&h.length&&L(tg,this,ag).call(this)}function Dg(){var t;const e=null===(t=z(Tv,this))||void 0===t?void 0:t.state;return e===uv||e===hv||e===dv||e===pv}function Rg(t){return"number"==typeof t&&Number.isFinite(t)&&t>0}function Lg(t){return t&&"resource"===t.entryType&&t.transferSize>0&&t.duration>0&&t.responseEnd>=t.requestStart}function Bg(t){return Array.isArray(t)&&0!==t.length?t.reduce(((t,e)=>t+e),0)/t.length:NaN}me=eg;var zg=new WeakMap,Wg=new WeakMap,Ug=new WeakMap,jg=new WeakMap,$g=new WeakSet;class qg extends sd{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),j(this,$g),W(this,zg,void 0),W(this,Wg,void 0),W(this,Ug,void 0),W(this,jg,void 0),U(zg,this,!!(cd&&cd.navigator&&cd.navigator.connection)),U(Wg,this,!(!cd||!cd.performance||"function"!=typeof cd.performance.getEntriesByType)),U(Ug,this,L($g,this,Gg).call(this)),U(jg,this,L($g,this,Qg).call(this))}guesstimate(){const t=L($g,this,Zg).call(this);this.log.debug("[guesstimate] Data:",t);const e=L($g,this,Jg).call(this,t),n=Rg(e)?e:t.defaultKbps;return L($g,this,Hg).call(this,n),this.log.info(`[guesstimate] Result: ${n} kbps`),n}update(t){Rg(t)&&L($g,this,Hg).call(this,t)}onDispose(){U(Ug,this,void 0),U(jg,this,void 0)}}function Vg(){return Math.round(Date.now()/1e3)}function Gg(){try{if(!cd||!cd.localStorage||"function"!=typeof cd.localStorage.getItem)return}catch(t){return}const t=this.settings.persistentStorage.key,e=cd.localStorage.getItem(t);if(e)try{const t=JSON.parse(e),n=this.settings.persistentStorage.ttl,i=L($g,this,Vg).call(this)-t.timestamp;if("number"==typeof n&&n>=0&&i>n)return null;if(!Rg(t.value))return;return t.value}catch(t){return}}function Hg(t){if(!Rg(t))return;try{if(!cd||!cd.localStorage||"function"!=typeof cd.localStorage.setItem)return}catch(t){return}const e=this.settings.persistentStorage.key,n=JSON.stringify({value:t,timestamp:L($g,this,Vg).call(this)});try{cd.localStorage.setItem(e,n),U(Ug,this,t)}catch(t){}}function Kg(){return cd&&cd.performance&&"function"==typeof cd.performance.getEntriesByType?Bg(cd.performance.getEntriesByType("resource").filter(Lg).map((t=>8*t.transferSize/t.duration))):NaN}function Xg(){if(!cd||!cd.navigator||!cd.navigator.connection)return NaN;const t=cd.navigator.connection.downlink;return Rg(t)?1e3*t:NaN}function Yg(){if(!z(zg,this))return NaN;const t=cd.navigator.connection,e=t.effectiveType||t.type,n=this.settings.connectionType||{};return e&&Object.prototype.hasOwnProperty.call(n,e)?n[e]:NaN}function Qg(){const t=this.settings.ua||{};return Jm()?t.android:Zm()?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=>Rg(t)));if(r.length===i.length)return this.log.debug("[#selectFromPriorities] Selected from priorities:",i,"with values:",r),Bg(r)}return NaN}function Zg(){const t=this.settings.testOverrides||{},e=Rg(t.resourceTiming)?t.resourceTiming:L($g,this,Kg).call(this),n=Rg(t.downlink)?t.downlink:L($g,this,Xg).call(this),i=Rg(t.persistentValue)?t.persistentValue:z(Ug,this),r=Rg(t.connectionType)?t.connectionType:L($g,this,Yg).call(this),o=Rg(t.ua)?t.ua:z(jg,this);return{defaultKbps:this.settings.defaultKbps,resourceTiming:e,downlink:n,connectionType:r,persistentValue:i,ua:o}}const ty=new td;function ey(t){return"string"!=typeof t||0===t.length?[]:t.split(".").filter((t=>t.length>0))}function ny(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 iy(t){return null!==t&&"object"==typeof t}function ry(t,e,n){const i=ey(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 oy(t,e,n){if(!iy(t))return t;const i=ey(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}iy(r[e])||(r[e]=ny(i[t+1])?[]:{}),r=r[e]}return t}const sy={get:(t,e)=>cd&&cd.eko?ry(cd.eko,t,e):e,set(t,e){if(cd)return cd.eko&&"object"==typeof cd.eko||(cd.eko={}),oy(cd.eko,t,e),cd.eko}},ay=cd&&cd.performance,ly=ay&&"function"==typeof ay.now?()=>ay.now():()=>Date.now();function cy(){return"undefined"==typeof AbortController?null:new AbortController}function uy(){const t=new Error("The operation was aborted");return t.name="AbortError",t.code="ABORT_ERR",t}function dy(t,e){return!(!e||!e.aborted)||!!t&&("AbortError"===t.name||"ABORT_ERR"===t.code||20===t.code)}const hy=2,fy=100,py=2,my="runtime.downloadSpeedSamples",vy=Zu("download","warn");function gy(t){return new Promise((e=>{setTimeout(e,t)}))}function yy(t){return t>=500}function by(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 ky(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=sy.get(r);t||(t=[],sy.set(r,t)),t.push(s)}catch(t){}return s}async function xy(t,e={}){const{method:n="GET",headers:i,body:r,retries:o=hy,retryDelay:s=fy,backoffFactor:a=py,samplesTargetPath:l=my,fetch:c,loglevel:u="warn",cache:d,signal:h,onProgress:f,returnType:p="default"}=e;vy.setLevel(u);const m=function(t){if(t)return t;if(cd&&"function"==typeof cd.fetch)return cd.fetch.bind(cd);throw new Error("fetch is not available in this environment")}(c);let v=0,g=s;for(;;){if(h&&h.aborted)throw uy();const e=ly();try{const s=await m(t,{method:n,headers:i,body:r,cache:d,mode:"cors",signal:h});if(h&&h.aborted)throw uy();if(!s.ok){if(v<o&&yy(s.status)){v+=1,vy.warn(`[${t}] Download attempt #${v} failed with status ${s.status}, retrying in ${g}ms...`),await gy(g),g*=a;continue}vy.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=ly();const u=by(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 uy();const{done:n,value:i}=await t.read();if(n)break;if(i&&i.length){const t=ly();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=ly()}else if(y){const t=await s.arrayBuffer();k=new Uint8Array(t),I=k.length,c=ly()}else"text"===p?(x=await s.text(),c=ly()):"json"===p&&(w=await s.json(),c=ly());if(h&&h.aborted)throw uy();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=ky(S,M,A,N,l,t);try{ty.trigger("download:sample",F)}catch(t){}const O={response:s,bytes:S,durationMs:M,kbps:F.kbps,startTime:F.startTime,endTime:F.endTime};if("default"===p)return O;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:O}catch(e){if(dy(e,h))throw"AbortError"===e.name?e:uy();if(!(v<o)||e.status&&!yy(e.status))throw vy.error(`[${t}] Download attempt #${v} failed with error ${e}, no more retries.`),e;v+=1,vy.warn(`[${t}] Download attempt #${v} failed with error ${e}, retrying in ${g}ms...`),await gy(g),g*=a}}}const wy={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"]}},_y=Object.freeze(Object.entries(wy).reduce(((t,[e,n])=>(Object.prototype.hasOwnProperty.call(n,"default")&&(t[e]=n.default),t)),{})),Ty=Zu("config","warn");function Iy(t){return _y[t]}var Ey=new WeakMap,Sy=new WeakMap,Ay=new WeakMap,Ny=new WeakMap,My=new WeakMap,Fy=new WeakSet;class Oy extends sd{get name(){return"DownloadSpeed"}get defaults(){return{alpha:.3,maxSamples:30,minBytesPerSample:1024,minDurationMs:5,maxSampleKbpsCap:void 0,ignoreCacheHits:!0,samplesPath:"runtime.downloadSpeedSamples",initialKbps:Iy("initialKbps"),probeUrl:void 0,defaultKbps:2500}}constructor(...t){super(...t),j(this,Fy),W(this,Ey,void 0),W(this,Sy,void 0),W(this,Ay,void 0),W(this,Ny,void 0),W(this,My,void 0),U(Ay,this,[]),U(Sy,this,0),U(Ey,this,L(Fy,this,Dy).call(this)),U(My,this,cy()),U(Ny,this,(t=>{L(Fy,this,Uy).call(this,t,"event")})),L(Fy,this,Ry).call(this),ty.on("download:sample",z(Ny,this)),L(Fy,this,Ly).call(this),this.log.debug(`[#constructor] Initial estimate: ${z(Ey,this)} kbps`)}getKbps(){return z(Ey,this)}addSample(t){L(Fy,this,Uy).call(this,t,"manual")}reset(){U(Ay,this,[]),U(Sy,this,0),U(Ey,this,L(Fy,this,Dy).call(this))}onDispose(){z(My,this)&&z(My,this).abort(),U(My,this,null),ty.off("download:sample",z(Ny,this)),U(Ay,this,[]),U(Sy,this,0),U(Ey,this,void 0),U(Ny,this,null)}}function Py(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 Cy(t){if(!t||"object"!=typeof t)return null;const e=Number(t.bytes),n=Number(t.durationMs);let i=Rg(t.kbps)?Number(t.kbps):NaN;return!Rg(i)&&n>0&&Rg(e)&&(i=8*e/n),Rg(i)?e<=this.settings.minBytesPerSample||n<=this.settings.minDurationMs||L(Fy,this,Py).call(this,t,e)?null:(Rg(this.settings.maxSampleKbpsCap)&&i>this.settings.maxSampleKbpsCap&&(i=this.settings.maxSampleKbpsCap),{...t,bytes:e,durationMs:n,kbps:i}):null}function Dy(){const t=this.settings.initialKbps;if(Rg(t))return t;if("auto"===t)try{const t=(new qg).guesstimate();if(Rg(t))return t}catch(t){}return this.settings.defaultKbps}function Ry(){const t=sy.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)L(Fy,this,Uy).call(this,e[t],"replay",{emit:!1})}async function Ly(){if(!this.settings.probeUrl||z(Sy,this)>0)return;const t=z(My,this)?z(My,this).signal:void 0;if(!t||!t.aborted)try{await xy(this.settings.probeUrl,{cache:"no-store",samplesTargetPath:this.settings.samplesPath,signal:t})}catch(t){}}function By(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 zy(t,e){if(!L(Fy,this,By).call(this,t)||!L(Fy,this,By).call(this,e))return 0;const n=Math.max(t.startTime,e.startTime);return Math.min(t.endTime,e.endTime)-n}function Wy(t){if(!L(Fy,this,By).call(this,t))return t;const e=[];for(let n=0;n<z(Ay,this).length;n+=1){const i=z(Ay,this)[n];L(Fy,this,By).call(this,i)&&(L(Fy,this,zy).call(this,t,i)>0&&e.push(i))}if(0===e.length)return t;U(Ay,this,z(Ay,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(!Rg(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 L(Fy,this,Cy).call(this,a)}function Uy(t,e,{emit:n=!0}={}){const i=L(Fy,this,Cy).call(this,t);if(!i)return;const r=L(Fy,this,Wy).call(this,i);if(!r)return;U(Sy,this,z(Sy,this)+1),z(Ay,this).push(r),z(Ay,this).length>this.settings.maxSamples&&z(Ay,this).shift();const o=this.defaults.alpha,s="number"==typeof this.settings.alpha?this.settings.alpha:o,a=Rg(z(Ey,this)),l=a?z(Ey,this):r.kbps,c=a||1!==z(Sy,this)?s*r.kbps+(1-s)*l:r.kbps;U(Ey,this,c),this.log.debug(`[#ingestSample] Next estimate: ${c} kbps`),n&&this.trigger("download:speed",{kbps:z(Ey,this),sample:r,source:e,samplesCount:z(Sy,this)})}class jy{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),Rg(s)&&(this.bandwidth=s),Rg(a)&&(this.timescale=a),Rg(l)&&(this.sizeBytes=l),Object.assign(this,c)}}class $y{#C=new Map;#D;#R;#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 jy?t:new jy(t))),this.representations=this.originalRepresentations.map((t=>t)),this.appliedFilters=[],this.loadAttempts=0,this.loadError=void 0}setRepresentationBuffer(t,e){t&&e&&this.#C.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.#D=t;const e=null==t?void 0:t.id;if(!(this.isInit||!e||this.#C.size<=1))for(const t of this.#C.keys())t!==e&&this.#C.delete(t)}setABRDecisionSnapshot(t){if(!t||"object"!=typeof t)return void(this.#R=void 0);const e={...t};Array.isArray(t.availableRepresentations)&&(e.availableRepresentations=t.availableRepresentations.map((t=>({...t})))),this.#R=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.#C.get(t)}get chosenRepresentation(){return this.#D}get abrDecision(){return this.#R}get arrayBuffer(){return this.#D?this.#C.get(this.#D.id):void 0}get retainedByteLength(){let t=0;for(const e of this.#C.values())e&&"number"==typeof e.byteLength&&(t+=e.byteLength);return t}get bufferedRatio(){var t;const e=Rg(this.#B)?this.#B:null===(t=this.#D)||void 0===t?void 0:t.sizeBytes;return Rg(e)?Math.min(1,Math.max(0,this.#L/e)):this.retainedByteLength>0?1:0}get isLoaded(){return this.retainedByteLength>0}evict(){this.#D=void 0,this.#R=void 0,this.#C.clear(),this.#L=0,this.#B=void 0}}class qy{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 Vy(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 Gy(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=Vy(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 Ky{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=Rg(r)?r:void 0,this.source=o,"cue"===n?(this._cues=a.map((t=>t instanceof qy?t:new qy(t))),this._segments=[]):(this._segments=s.map((t=>t instanceof $y?t:new $y(t))),this._cues=void 0)}get segments(){return this._segments.slice()}get cues(){if("cue"===this.type)return this._cues.slice()}get endTime(){if(Rg(this.duration))return this.offset+this.duration;if(!this._segments.length)return;const t=this._segments.reduce(((t,e)=>{const n=Rg(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:Rg(null==t?void 0:t.duration)?t.duration:0,offset:Rg(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 Gy(this._segments,t,e)}setSegments(t=[]){if("cue"===this.type)return;const e=Array.isArray(t)?t:[];this._segments=e.map((t=>t instanceof $y?t:new $y(t)))}}function Xy(t){return"string"==typeof t?t:t&&"object"==typeof t?t.nodeId||t.nodeIdOrRef||t.id:void 0}function Yy(t){const e=Xy(t);let n=1;if(t&&"object"==typeof t&&Rg(t.weight)&&(n=t.weight),!e)throw new Error("Child entry requires a nodeId");return{nodeId:e,weight:n}}function Qy(t){return(Array.isArray(t)?t:[]).map((t=>Yy(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 Zy(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 tb(t,e){if(e)try{var n;return new URL(e,t||(null==cd||null===(n=cd.location)||void 0===n?void 0:n.href)||void 0).toString()}catch(t){return e}}const eb=new Map;class nb{static register(t,e){if(!t||"function"!=typeof e)throw new Error("ManifestFactory.register requires type and parser function");eb.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=nb.inferType(t);if(!e||!eb.has(e))throw new Error("Unsupported manifest type");return eb.get(e)(t)}}nb.register("dash",(function(t={}){const{body:e,url:n}=t,i=function(){if(cd&&"function"==typeof cd.DOMParser)return new cd.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(!Rg(s))continue;Rg(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:tb(n,Zy(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:tb(n,Zy(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}})),nb.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:Rg(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=>Rg(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+(Rg(e.duration)?e.duration:0)),0),l=Rg(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}})),nb.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=Rg(null==t?void 0:t.duration)?t.duration:30,i=Rg(null==t?void 0:t.width)?t.width:void 0,r=Rg(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};Rg(i)&&Rg(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 ib=["video/mp4"];function rb(t){return ib.includes(t.mime)}var ob={name:"containers",fn:function(t=[]){return t.filter(rb)},isRelevantForTrack:function(t){return"video"===(null==t?void 0:t.type)}};const sb=new(ve=new WeakMap,ge=new WeakSet,class extends sd{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),j(this,ge),W(this,ve,void 0),U(ve,this,new Map)}onDispose(){z(ve,this)&&z(ve,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 L(ge,this,db).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 ab(){return!!(cd&&cd.navigator&&cd.navigator.mediaCapabilities&&"function"==typeof cd.navigator.mediaCapabilities.decodingInfo)}function lb(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 cb(t){return t?JSON.stringify(t):"invalid"}async function ub(t){if(!this.settings.enabled||!L(ge,this,ab).call(this)||!t)return this.log.debug("[#queryCapabilities] Not supported, returning false",t),{supported:!1,smooth:!1,powerEfficient:!1};const e=L(ge,this,cb).call(this,t),n=z(ve,this).get(e);if(n)return n;let i;try{i=await cd.navigator.mediaCapabilities.decodingInfo(t)}catch(t){i={supported:!1,smooth:!1,powerEfficient:!1}}return this.log.debug("[#queryCapabilities] Config:",t,"\nDecoding info result:",i),z(ve,this).set(e,i),i}async function db(t){if(L(ge,this,fb).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=L(ge,this,lb).call(this,t),n=await L(ge,this,ub).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 hb(){if(!nv())return!1;const t=iv();return!Number.isFinite(t)||t<150}function fb(t){if(!L(ge,this,hb).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 pb=[],mb=()=>!0;[ob,{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 sb.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:mb;pb.push({name:t,fn:e,isRelevantForTrack:i})}(t,e,{isRelevantForTrack:n})}));const vb=Zu("Node","warn"),gb={start:0,end:0},yb=.001;function bb(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)<=yb&&Math.abs(t.duration-n.duration)<=yb))?{offset:n.start,duration:n.duration}:void 0}var kb=new WeakMap,xb=new WeakMap,wb=new WeakMap,_b=new WeakMap,Tb=new WeakMap,Ib=new WeakMap,Eb=new WeakMap,Sb=new WeakMap,Ab=new WeakMap,Nb=new WeakMap,Mb=new WeakSet;class Fb extends td{constructor(t={},e={}){super(),j(this,Mb),W(this,kb,void 0),W(this,xb,void 0),W(this,wb,void 0),W(this,_b,void 0),W(this,Tb,void 0),W(this,Ib,void 0),W(this,Eb,void 0),W(this,Sb,void 0),W(this,Ab,void 0),W(this,Nb,[]);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,U(Eb,this,!0===e.forceImageFallback),U(kb,this,e.abrSelector),U(xb,this,e.assetsDeliveryService),U(_b,this,Rg(r)?r:void 0),U(Tb,this,Rg(o)?o:void 0),U(Ib,this,Rg(s)?s:void 0),U(Sb,this,e&&"object"==typeof e.mediaHostRewriteMap?e.mediaHostRewriteMap:void 0),U(Ab,this,Rg(e.maxManifestLoadAttempts)?e.maxManifestLoadAttempts:1/0),this.manifestLoadAttempts=0,this.manifestLoadError=void 0,U(Nb,this,Qy(l))}setChildren(t){const e=Qy(t);return L(Mb,this,Xb).call(this,e,{emit:!0})}addChild(t){const e=Yy(t),n=z(Nb,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 L(Mb,this,Xb).call(this,n,{emit:!0})}removeChild(t){const e=Xy(t);if(!e)return this.children;const n=z(Nb,this).filter((t=>(null==t?void 0:t.nodeId)!==e));return n.length===z(Nb,this).length?this.children:L(Mb,this,Xb).call(this,n,{emit:!0})}async load(t={}){const{loadingMode:e="full",signal:n}=t;vb.info(`[load] [${this.id}] Loading node in '${e}' mode`);try{if(n&&n.aborted)throw uy();"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})=>L(Mb,this,Vb).call(this,t,e,n))),l=s?L(Mb,this,Gb).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 L(Mb,this,Gb).call(this,t.segment,t.track,n);if(n&&n.aborted)throw uy();return this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:e}),this}catch(t){if(dy(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(vb.info(`[loadMediaSegmentsAtOffset] [${this.id}] Loading media segments at offset ${n}`),!Number.isFinite(n))return;const{signal:i}=e;if(i&&i.aborted)throw uy();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(L(Mb,this,Vb).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)<=yb&&!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})=>L(Mb,this,Gb).call(this,t,e,i)))),i&&i.aborted)throw uy();this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:"segment-offset",offsetSeconds:n})}}async resolve(t={}){const{signal:e,manifestOverride:n}=t;let i=!0;for(;i;){if(i=!1,"ready"===this.state)return this;if("resolving"===this.state)try{return await z(wb,this)}catch(t){if(!dy(t)||e&&e.aborted)throw t;i=!0;continue}if(e&&e.aborted)throw uy();if(this.hasExceededManifestLoadAttempts()){const t=this.manifestLoadError||new Error("Manifest load retry limit reached");throw this.state="failed",this.error=t,t}const t=L(Mb,this,Bb).call(this);return this.state="resolving",this.error=void 0,U(wb,this,(async()=>{try{const t=await L(Mb,this,Hb).call(this,{signal:e,manifestOverride:n});if(e&&e.aborted)throw uy();let i=nb.parse(t);return i=L(Mb,this,Lb).call(this,i),this.tracks=(i.tracks||[]).map((t=>t instanceof Ky?t:new Ky(t))),this.mainTrackId=i.mainTrackId||this.mainTrackId,this.metadata=i.metadata||this.metadata,L(Mb,this,Qb).call(this),L(Mb,this,Yb).call(this),await L(Mb,this,Kb).call(this),this.state="ready",this}catch(n){if(dy(n,e))throw L(Mb,this,zb).call(this,t),n;throw this.state="failed",this.error=n,n}})()),z(wb,this)}return z(wb,this)}evict(){this.tracks.forEach((t=>{(t.segments||[]).forEach((t=>{t.evict()}))}))}get children(){return z(Nb,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?Rg(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+=Rg(e.retainedByteLength)?e.retainedByteLength:0}))})),t}get buffered(){if("ready"!==this.state)return gb;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||!Rg(e))return gb;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 gb;if(n.length===this.tracks.length&&n.every((({track:t,range:e})=>{const n=t.endTime,i=Rg(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 gb;const r=Math.min(i,e);return r>0?{start:0,end:r}:gb}get isLoaded(){return"ready"===this.state&&(Array.isArray(this.tracks)?this.tracks:[]).flatMap((t=>Array.isArray(null==t?void 0:t.segments)?t.segments:[])).every((t=>t.isLoaded))}hasExceededManifestLoadAttempts(){if(!Number.isFinite(z(Ab,this))||z(Ab,this)<=0)return!1;if(!this.manifestLoadError)return!1;const t=Number(this.manifestLoadAttempts);return Number.isFinite(t)&&t>=z(Ab,this)}}function Ob(t){return function(t,e){if(!t||"string"!=typeof t)return t;if(!e||"object"!=typeof e)return t;const n=cd&&"function"==typeof cd.URL?cd.URL:"function"==typeof URL?URL:null;if(!n)return t;let i;try{i=new n(t)}catch(e){return t}const r=function(t,e){const n=null==t?void 0:t.hostname,i=null==t?void 0:t.pathname;if("string"!=typeof n||"string"!=typeof i)return t;if(!/^s3(?:[.-][a-z0-9-]+)?\.amazonaws\.com$/i.test(n))return t;const r=i.split("/").filter(Boolean);if(r.length<2)return t;const o=r[0],s=new e(t.toString());return s.hostname=`${o}.${n}`,s.pathname=`/${r.slice(1).join("/")}`,s}(i,n),o=e[r.hostname]?r:i,s=e[o.hostname];if(!s||"string"!=typeof s)return t;let a;try{a=new n(s)}catch(e){return t}return a.protocol&&a.host?(o.protocol=a.protocol,o.host=a.host,o.toString()):t}(t,z(Sb,this))}function Pb(){return z(Eb,this)||void 0===cd.VideoDecoder}function Cb(){return this.manifestRef&&"object"==typeof this.manifestRef&&"assets-delivery-service"===this.manifestRef.type}function Db(t){if(!L(Mb,this,Cb).call(this))return!1;if(!L(Mb,this,Pb).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 Rb(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 Rg(n)?n:Rg(z(_b,this))?z(_b,this):void 0}function Lb(t){if(this.imageFallbackActive=!1,!L(Mb,this,Db).call(this,t))return t;if(!z(xb,this)||"function"!=typeof z(xb,this).resolveImageOne)return t;const e=z(xb,this).resolveImageOne(this.manifestRef),n=L(Mb,this,Ob).call(this,null==e?void 0:e.url);if(!n)return t;const i={typeHint:"image",url:n,duration:L(Mb,this,Rb).call(this,t),width:z(Tb,this),height:z(Ib,this)},r=nb.parse(i);return t&&"object"==typeof t.metadata&&!Array.isArray(t.metadata)&&(r.metadata=t.metadata),this.imageFallbackActive=!0,r}function Bb(){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 zb(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 Wb(){const t=Number(this.manifestLoadAttempts);this.manifestLoadAttempts=Number.isFinite(t)&&t>0?t+1:1,this.manifestLoadError=void 0}function Ub(t){this.manifestLoadError=t||new Error("Manifest load failed")}function jb(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 $b(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 qb(t,e){t&&("function"!=typeof t.setLoadError?t.loadError=e||new Error("Segment load failed"):t.setLoadError(e))}async function Vb(t,e,n){const i=L(Mb,this,jb).call(this,e);try{const i=e.representations.map((async i=>{const r=L(Mb,this,Ob).call(this,i.url),o=await xy(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(dy(t,n))throw L(Mb,this,$b).call(this,e,i),t;throw L(Mb,this,qb).call(this,e,t),t}}async function Gb(t,e,n){const i=z(kb,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=L(Mb,this,jb).call(this,t);try{const i=L(Mb,this,Ob).call(this,s.url),r=await xy(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(dy(e,n))throw L(Mb,this,$b).call(this,t,a),e;throw L(Mb,this,qb).call(this,t,e),e}}async function Hb(t={}){const{signal:e,manifestOverride:n}=t;if(e&&e.aborted)throw uy();L(Mb,this,Wb).call(this);try{let t=this.manifestRef;if(n&&"object"==typeof n){if(L(Mb,this,Cb).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=L(Mb,this,Ob).call(this,n.url);return{typeHint:n.typeHint,url:t,mimeType:n.mimeType,body:n.body,duration:z(_b,this),width:z(Tb,this),height:z(Ib,this)}}"string"==typeof n.url&&n.url&&(t=n)}if(t&&"object"==typeof t&&"assets-delivery-service"===t.type){if(!z(xb,this)||"function"!=typeof z(xb,this).resolveOne)throw new Error("AssetsDeliveryService is required for assets-delivery-service manifestRef");const n=await z(xb,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=L(Mb,this,Ob).call(this,n.url),o=n.mimeType,s=n.body;if(r||s||o)return{typeHint:i,url:r,mimeType:o,body:s,duration:z(_b,this),width:z(Tb,this),height:z(Ib,this)};throw new Error("AssetsDeliveryService returned unsupported manifest shape")}if(t&&"object"==typeof t){const e=L(Mb,this,Ob).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=L(Mb,this,Ob).call(this,n),r="object"==typeof t?t.typeHint:void 0,o="object"==typeof t?t.mimeType:void 0;if("image"===nb.inferType({typeHint:r,url:i,mimeType:o})){const e="object"==typeof t&&Rg(t.duration)?t.duration:z(_b,this);return{typeHint:"image",url:i,mimeType:o,duration:e,width:"object"==typeof t&&Rg(t.width)?t.width:z(Tb,this),height:"object"==typeof t&&Rg(t.height)?t.height:z(Ib,this)}}const s=await xy(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(dy(t,e))throw t;throw L(Mb,this,Ub).call(this,t),t}}async function Kb(){const t=pb.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=bb(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 Xb(t,{emit:e=!1}={}){return function(t=[],e=[]){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n+=1){const i=t[n],r=e[n];if((null==i?void 0:i.nodeId)!==(null==r?void 0:r.nodeId)||(null==i?void 0:i.weight)!==(null==r?void 0:r.weight))return!1}return!0}(z(Nb,this),t)||(U(Nb,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 Yb(){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 Qb(){if(!Array.isArray(this.tracks)||!this.tracks.length)return;const t=this.duration;if(!Rg(t))return;const e=[new qy({name:"nodestart",timestamp:0,data:{id:this.id},isSticky:!0}),new qy({name:"nodeend",timestamp:t,data:{id:this.id}})],n=new Ky({id:`${this.id}-auto-cue`,type:"cue",cues:e,offset:0,duration:t});this.tracks.push(n)}var Jb=new WeakMap,Zb=new WeakMap,tk=new WeakMap,ek=new WeakMap,nk=new WeakSet;class ik extends sd{constructor(...t){super(...t),j(this,nk),W(this,Jb,new Map),W(this,Zb,new Map),W(this,tk,void 0),W(this,ek,void 0);const[e,n]=t;U(tk,this,e),U(ek,this,n)}get name(){return"NodeRepository"}get defaults(){return{enabledRepFilters:["containers","force-video-codec","media-capabilities"],disabledTracks:Iy("disabledTracks"),forceVideoCodec:Iy("forceVideoCodec"),forceImageFallback:Iy("forceImageFallback"),mediaHostRewriteMap:Iy("mediaHostRewriteMap"),maxManifestLoadAttempts:3}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"get","list"])}onDispose(){z(Jb,this).forEach(((t,e)=>{const n=z(Zb,this).get(e);n&&t&&"function"==typeof t.off&&t.off(sv.NODE_CHILDREN_CHANGED,n)})),z(Zb,this).clear(),z(Jb,this).clear()}add(t){const e=t instanceof Fb?t:new Fb(t,{enabledRepFilters:this.settings.enabledRepFilters,disabledTracks:this.settings.disabledTracks,forceVideoCodec:this.settings.forceVideoCodec,forceImageFallback:this.settings.forceImageFallback,mediaHostRewriteMap:this.settings.mediaHostRewriteMap,maxManifestLoadAttempts:this.settings.maxManifestLoadAttempts,abrSelector:z(tk,this),assetsDeliveryService:z(ek,this)});if(!e.id)throw new Error("NodeRepository.add requires node with id");if(z(Jb,this).has(e.id))throw new Error(`NodeRepository.add: node with id ${e.id} already exists`);return z(Jb,this).set(e.id,e),L(nk,this,rk).call(this,e),this.trigger(sv.NODE_ADD,{node:e}),e}get(t){const e=(null==t?void 0:t.id)||t;if(!e)throw new Error("NodeRepository.get requires node or id");return z(Jb,this).get(e)}list(){return Array.from(z(Jb,this).values())}}function rk(t){if(!t||"function"!=typeof t.on||!t.id)return;const e=t=>{this.trigger(sv.NODE_CHILDREN_CHANGED,t)};t.on(sv.NODE_CHILDREN_CHANGED,e),z(Zb,this).set(t.id,e)}var ok=new WeakMap,sk=new WeakMap,ak=new WeakSet;class lk extends sd{constructor(...t){super(...t),j(this,ak),W(this,ok,void 0),W(this,sk,new Map);const[e]=t;U(ok,this,e)}get name(){return"ABRSelector"}get defaults(){return{safetyMargin:.35,minBufferForUpgrade:5,minBufferCritical:1,hysteresisRatio:1.1,abrStrategy:Iy("abrStrategy")}}select(t={}){var e;const{representations:n=[],bufferSeconds:i}=t;if(!Array.isArray(n)||0===n.length)return;const r=z(ok,this)&&"function"==typeof z(ok,this).getKbps?z(ok,this).getKbps():void 0,o=L(ak,this,ck).call(this,n[0]),s=z(sk,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)=>L(ak,this,uk).call(this,t.bandwidth)-L(ak,this,uk).call(this,e.bandwidth)));if("bottom"===a){const e=l[0];return L(ak,this,fk).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 L(ak,this,fk).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 L(ak,this,fk).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=Rg(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),L(ak,this,fk).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=>L(ak,this,uk).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&&Rg(e.bandwidth)&&Rg(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 L(ak,this,fk).call(this,h,t,{decisionReason:d,trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:u,bufferSeconds:c}),null===(e=h)||void 0===e?void 0:e.id}onDispose(){z(sk,this).clear(),U(ok,this,null)}}function ck(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 uk(t){return Rg(t)?t/1e3:0}function dk(t){return Rg(t)?t/1e3:void 0}function hk(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:L(ak,this,dk).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:L(ak,this,dk).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 fk(t,e,n={}){if(!t)return;const i=L(ak,this,hk).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=L(ak,this,ck).call(this,t);z(sk,this).set(r,t.id)}var pk=new WeakMap,mk=new WeakSet;class vk extends sd{constructor(...t){super(...t),j(this,mk),W(this,pk,void 0);const[e]=t;if(U(pk,this,e),!z(pk,this)||"function"!=typeof z(pk,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(){U(pk,this,null)}getPrioritizationSnapshot(t){const e=z(pk,this).list();if(!e.length)return{orderedIds:[],reachableIds:[]};const{levels:n,weights:i}=L(mk,this,gk).call(this,e,t);return{orderedIds:L(mk,this,yk).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 gk(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=Rg(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 yk(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 bk(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 kk(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 xk(t){return"string"==typeof t&&t.startsWith("cmaf:")}function wk(t){return"image"===(null==t?void 0:t.assetType)?"image":"ivd"}function _k(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 Tk=new WeakMap,Ik=new WeakMap,Ek=new WeakSet;class Sk extends sd{constructor(...t){super(...t),j(this,Ek),W(this,Tk,void 0),W(this,Ik,void 0);const[,e={}]=t;U(Tk,this,"function"==typeof e.fetchFn?e.fetchFn:void 0),U(Ik,this,cy())}get name(){return"AssetsDeliveryService"}get defaults(){return{assetsDeliveryServiceUrl:"https://assets.eko.com",profile:Iy("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(!L(Ek,this,Nk).call(this,t))return;const e=bk(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=>L(Ek,this,Nk).call(this,t)));if(!n.length)return[];const i=L(Ek,this,Ak).call(this,e);if(i&&i.aborted)return[];const r=[],o=this.settings.profile;n.forEach((t=>{if("image"!==wk(t))return;const e=this.resolveImageOne(t);e&&e.url&&r.push({manifestRef:kk(t,e.encodeProfile),manifest:{typeHint:"image",url:e.url}})}));const s=n.filter((t=>"image"!==wk(t))).map((t=>function(t,e){const n=bk(t,e);return{ref:t,profile:n,route:xk(n)?"dash":"ivd"}}(t,o))),a=L(Ek,this,Fk).call(this,s);for(const{refs:t,route:e}of a){if(i&&i.aborted)return r;const{url:n}=L(Ek,this,Ok).call(this,t,e),o=await L(Ek,this,Pk).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:kk(t,e),manifest:_k(i)})}))}return r}onDispose(){z(Ik,this)&&z(Ik,this).abort(),U(Ik,this,null),U(Tk,this,null)}}function Ak(t){return t&&t.signal?t.signal:z(Ik,this)?z(Ik,this).signal:void 0}function Nk(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 Mk(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 Fk(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=>{L(Ek,this,Mk).call(this,t.refs,this.settings.maxBatchSize).forEach((e=>{n.push({route:t.route,refs:e})}))})),n}function Ok(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 Pk(t,e){return z(Tk,this)?z(Tk,this).call(this,t,e):await xy(t,{returnType:"json",method:(null==e?void 0:e.method)||"GET",signal:null==e?void 0:e.signal})}function Ck({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 Dk=(cd.requestAnimationFrame||cd.mozRequestAnimationFrame||cd.webkitRequestAnimationFrame||cd.msRequestAnimationFrame||(t=>cd.setTimeout(t,1e3/60))).bind(cd),Rk=(cd.cancelAnimationFrame||cd.mozCancelAnimationFrame||cd.webkitCancelAnimationFrame||cd.msCancelAnimationFrame||(t=>cd.clearTimeout(t))).bind(cd),Lk=Zu("ticker","warn");let Bk,zk=[],Wk=null,Uk=ly();function jk(){Uk=ly();const t=[];let e,n;for(n=zk.length-1;n>=0;--n)e=zk[n],Uk>=e.lastTick+e.interval&&t.push(e);for(n=t.length-1;n>=0;--n)if(e=t[n],!e.stopped){e.lastTick=Uk;try{e.callback()}catch(t){console&&"function"==typeof console.error?console.error(t):Lk.error(t)}}Bk=Dk(jk)}function $k(){ly()-Uk>=200&&(Rk(Bk),jk())}function qk(t){let e=-1;for(let n=0;n<zk.length;n+=1)if(zk[n].callback===t){e=n;break}return e}function Vk(t,e=0){if(!t||"function"!=typeof t||"number"!=typeof e||e<0)return void Lk.error("[start] Invalid arguments given to start method.",arguments);const n=qk(t);return-1!==n?(Lk.debug("[start] Callback already exists, overriding interval.",arguments),zk[n].interval=e,t):(zk.push({callback:t,interval:e,lastTick:ly()}),1===zk.length&&(Bk=Dk(jk),Wk||(Wk=cd.setInterval($k,1e3))),t)}function Gk(t){const e=qk(t);-1!==e?(zk[e].stopped=!0,zk.splice(e,1),zk.length||(Rk(Bk),cd.clearInterval(Wk),Wk=null)):Lk.debug("[stop] Callback not found, doing nothing.",arguments)}function Hk(t){return-1!==qk(t)}function Kk(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 Lk.error("[createThrottler] Bad argument given to createThrottler, first argument must be a function.",arguments);Lk.debug("[createThrottler] Creating a new throttler instance.",arguments);const s=[];function a(){Lk.debug("[onThrottlerTick] Calling callback with "+s.length+" queued items.");const e=s.slice(0);s.length=0,Gk(a),t(e)}const l={push:function(t){Lk.debug("[push] Queuing argument:",t),0===s.length&&Vk(a,e),s.push(t),o+=1,(o<=r||s.length>=i)&&a()},flush:function(){Lk.debug("[flush] Flushing queue."),0!==s.length&&a()},dispose:function(){Lk.debug("[dispose] Disposing of throttler.");const t=s.slice(0);return s.length=0,Gk(a),t}};return Object.defineProperty(l,"interval",{enumerable:!0,get:function(){return e},set:function(t){"number"==typeof t&&(e=t)}}),l}function Xk(t,e){if(t&&"function"==typeof t)return t.__tickerThrottler||(t.__tickerThrottler=Kk((function(){t()}),e)),"number"==typeof e&&(t.__tickerThrottler.interval=e),t.__tickerThrottler.push(),t.__tickerThrottler;Lk.error("[scheduleExecution] Bad argument given to scheduleExecution, first argument must be a function.",arguments)}var Yk=new WeakMap,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 WeakSet;class fx extends sd{constructor(...t){super(...t),j(this,hx),W(this,Yk,void 0),W(this,Qk,void 0),W(this,Jk,void 0),W(this,Zk,void 0),W(this,tx,[]),W(this,ex,[]),W(this,nx,new Set),W(this,ix,new Set),W(this,rx,!1),W(this,ox,void 0),W(this,sx,void 0),W(this,ax,void 0),W(this,lx,void 0),W(this,cx,void 0),W(this,ux,void 0),W(this,dx,void 0);const[e,n,i,r]=t;U(Yk,this,e),U(Qk,this,n),U(Jk,this,i),U(Zk,this,r),U(ox,this,cy());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),U(dx,this,(()=>L(hx,this,Tx).call(this))),L(hx,this,gx).call(this),L(hx,this,vx).call(this)}get name(){return"NodeResolver"}get defaults(){return{maxConcurrent:5}}onDispose(){var t;z(ox,this)&&z(ox,this).abort(),U(ox,this,null),z(Zk,this)&&"function"==typeof z(Zk,this).off&&z(ax,this)&&z(Zk,this).off(sv.PLACEMENT_ADDED,z(ax,this)),z(Zk,this)&&"function"==typeof z(Zk,this).off&&z(ux,this)&&z(Zk,this).off(sv.TIMELINE_RESET,z(ux,this)),z(Yk,this)&&"function"==typeof z(Yk,this).off&&z(lx,this)&&z(Yk,this).off(sv.NODE_ADD,z(lx,this)),z(Yk,this)&&"function"==typeof z(Yk,this).off&&z(cx,this)&&z(Yk,this).off(sv.NODE_CHILDREN_CHANGED,z(cx,this)),U(ax,this,null),U(lx,this,null),U(cx,this,null),U(ux,this,null),U(tx,this,[]),U(ex,this,[]),z(nx,this).clear(),z(ix,this).clear(),U(rx,this,!1),U(sx,this,void 0),null!==(t=z(dx,this))&&void 0!==t&&t.__tickerThrottler&&z(dx,this).__tickerThrottler.dispose(),U(dx,this,null)}}function px(){return z(ox,this)?z(ox,this).signal:void 0}function mx(){return this._disposed||z(ox,this)&&z(ox,this).signal.aborted}function vx(){z(Zk,this)&&"function"==typeof z(Zk,this).on&&(U(ax,this,(t=>{L(hx,this,bx).call(this,null==t?void 0:t.nodeId)})),z(Zk,this).on(sv.PLACEMENT_ADDED,z(ax,this)),U(ux,this,(()=>L(hx,this,yx).call(this))),z(Zk,this).on(sv.TIMELINE_RESET,z(ux,this))),z(Yk,this)&&"function"==typeof z(Yk,this).on&&(U(lx,this,(({node:t})=>{(null==t?void 0:t.id)&&L(hx,this,bx).call(this,t.id,{fromRepoAdd:!0})})),z(Yk,this).on(sv.NODE_ADD,z(lx,this)),U(cx,this,(()=>{Xk(z(dx,this),100)})),z(Yk,this).on(sv.NODE_CHILDREN_CHANGED,z(cx,this)))}function gx(){const t=z(Zk,this)&&Array.isArray(z(Zk,this).placements)?z(Zk,this).placements:[];t.forEach((t=>L(hx,this,bx).call(this,t.nodeId)));const e=t.length?t[t.length-1]:void 0;e&&e.nodeId&&U(sx,this,e.nodeId)}function yx(){z(ox,this)&&z(ox,this).abort(),U(ox,this,cy()),U(tx,this,[]),U(ex,this,[]),z(nx,this).clear(),U(rx,this,!1),U(sx,this,void 0)}function bx(t,{fromRepoAdd:e=!1}={}){L(hx,this,mx).call(this)||t&&(z(ix,this).has(t)||z(nx,this).has(t)||(z(tx,this).push(t),z(sx,this)||e||U(sx,this,t),!z(rx,this)&&e||L(hx,this,kx).call(this)))}function kx(){if(z(rx,this))return void L(hx,this,xx).call(this);if(0===z(tx,this).length)return;U(rx,this,!0);const t=z(tx,this).shift();L(hx,this,Ix).call(this,t).finally((()=>{L(hx,this,xx).call(this)}))}async function xx(){if(!L(hx,this,mx).call(this))for(z(tx,this).length||z(ex,this).length||U(ex,this,L(hx,this,wx).call(this));z(nx,this).size<this.settings.maxConcurrent;){const t=this.settings.maxConcurrent-z(nx,this).size;if(t<=0)break;const e=[];for(;e.length<t&&(z(tx,this).length||z(ex,this).length);){let t=z(tx,this).shift();t||(t=z(ex,this).shift()),t&&e.push(t)}if(!e.length)break;const n=L(hx,this,Ex).call(this,e);n.length&&z(Jk,this)&&"function"==typeof z(Jk,this).resolve&&L(hx,this,Sx).call(this,n).finally((()=>L(hx,this,xx).call(this))),e.filter((t=>!n.find((e=>e.nodeId===t)))).forEach((t=>{L(hx,this,Ix).call(this,t).finally((()=>L(hx,this,xx).call(this)))}))}}function wx(){const t=new Set([...z(ix,this),...z(nx,this),...z(tx,this)]);return L(hx,this,_x).call(this,t)}function _x(t){const e=z(Zk,this)&&Array.isArray(z(Zk,this).placements)?z(Zk,this).placements:[],n=(e.length?e[e.length-1].nodeId:void 0)||z(sx,this);return Ck({prioritizer:z(Qk,this),repository:z(Yk,this),startNodeId:n,pendingIds:t,fallbackToRepository:!1})}function Tx(){L(hx,this,mx).call(this)||(z(rx,this)||0!==z(tx,this).length)&&(U(ex,this,L(hx,this,wx).call(this)),z(rx,this)&&L(hx,this,xx).call(this))}async function Ix(t,e){if(!t||z(ix,this).has(t)||z(nx,this).has(t))return;const n=L(hx,this,px).call(this);if(n&&n.aborted)return;const i=z(Yk,this)&&"function"==typeof z(Yk,this).get?z(Yk,this).get(t):void 0;if(i&&"function"==typeof i.resolve)if("function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts())z(ix,this).add(t);else{z(nx,this).add(t);try{const r={signal:n};e&&(r.manifestOverride=e),await i.resolve(r),z(ix,this).add(t)}catch(e){if(dy(e,n))return;this.log.warn(`NodeResolver failed to resolve node ${t}: ${(null==e?void 0:e.message)||e}`),"function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts()&&z(ix,this).add(t)}finally{z(nx,this).delete(t)}}}function Ex(t){const e=[];return t.forEach((t=>{const n=z(Yk,this)&&"function"==typeof z(Yk,this).get?z(Yk,this).get(t):void 0;n&&n.manifestRef&&"assets-delivery-service"===n.manifestRef.type&&e.push({nodeId:t,ref:n.manifestRef})})),e}async function Sx(t){const e=L(hx,this,px).call(this);if(!e||!e.aborted){t.forEach((({nodeId:t})=>z(nx,this).add(t)));try{const n=t.map((t=>t.ref)),i=await z(Jk,this).resolve(n,{signal:e});t.forEach((({nodeId:t,ref:e})=>{var n;const r=z(Yk,this)&&"function"==typeof z(Yk,this).get?z(Yk,this).get(t):void 0;if(z(nx,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?L(hx,this,Ax).call(this,o.manifest,s):void 0;L(hx,this,Ix).call(this,t,a)}))}catch(n){dy(n,e)||this.log.warn(`NodeResolver ADS batch failed: ${(null==n?void 0:n.message)||n}`),t.forEach((({nodeId:t})=>z(nx,this).delete(t)))}}}function Ax(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 Nx=.001,Mx="priority";function Fx(t){const e=Number(t);return Number.isFinite(e)?e:0}var Ox=new WeakMap,Px=new WeakMap,Cx=new WeakMap,Dx=new WeakMap,Rx=new WeakMap,Lx=new WeakMap,Bx=new WeakMap,zx=new WeakMap,Wx=new WeakMap,Ux=new WeakMap,jx=new WeakMap,$x=new WeakMap,qx=new WeakMap,Vx=new WeakMap,Gx=new WeakMap,Hx=new WeakMap,Kx=new WeakMap,Xx=new WeakMap,Yx=new WeakMap,Qx=new WeakSet;class Jx extends sd{constructor(...t){super(...t),j(this,Qx),W(this,Ox,void 0),W(this,Px,void 0),W(this,Cx,void 0),W(this,Dx,new Map),W(this,Rx,new Map),W(this,Lx,[]),W(this,Bx,new Set),W(this,zx,new Map),W(this,Wx,!1),W(this,Ux,void 0),W(this,jx,void 0),W(this,$x,void 0),W(this,qx,void 0),W(this,Vx,void 0),W(this,Gx,void 0),W(this,Hx,void 0),W(this,Kx,!1),W(this,Xx,[]),W(this,Yx,void 0);const[e,n,i]=t;U(Ox,this,e),U(Px,this,n),U(Cx,this,i),U(jx,this,cy()),U(Yx,this,(()=>L(Qx,this,Aw).call(this))),L(Qx,this,cw).call(this)}get name(){return"SegmentLoadCoordinator"}get defaults(){return{maxConcurrentLoads:3,maxSegmentLoadAttempts:3}}onDispose(){var t;z(jx,this)&&z(jx,this).abort(),U(jx,this,null),z(zx,this).size&&z(zx,this).forEach((t=>{(null==t?void 0:t.controller)&&t.controller.abort()})),z(zx,this).clear(),z(Cx,this)&&"function"==typeof z(Cx,this).off&&(z($x,this)&&z(Cx,this).off(sv.PLACEMENT_ADDED,z($x,this)),z(Vx,this)&&z(Cx,this).off(sv.TIMELINE_SEEKING,z(Vx,this)),z(Gx,this)&&z(Cx,this).off(sv.TIMELINE_SEEKED,z(Gx,this)),z(Hx,this)&&z(Cx,this).off(sv.TIMELINE_RESET,z(Hx,this))),z(Ox,this)&&"function"==typeof z(Ox,this).off&&z(qx,this)&&z(Ox,this).off(sv.NODE_CHILDREN_CHANGED,z(qx,this)),U($x,this,null),U(qx,this,null),U(Vx,this,null),U(Gx,this,null),U(Hx,this,null),z(Dx,this).clear(),z(Rx,this).clear(),U(Lx,this,[]),z(Bx,this).clear(),z(zx,this).clear(),U(Wx,this,!1),U(Ux,this,void 0),U(Kx,this,!1),U(Xx,this,[]),null!==(t=z(Yx,this))&&void 0!==t&&t.__tickerThrottler&&z(Yx,this).__tickerThrottler.dispose(),U(Yx,this,null)}}function Zx(){return z(jx,this)?z(jx,this).signal:void 0}function tw(){return this._disposed||z(jx,this)&&z(jx,this).signal.aborted}function ew(){const t=Number(this.settings.maxSegmentLoadAttempts);return Number.isFinite(t)&&t>0?t:1/0}function nw(t){const e=L(Qx,this,ew).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 iw(t){if(!t)return!1;if(L(Qx,this,nw).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 rw(t,{allowSeekKeep:e=!1,segmentOffset:n}={}){const i=cy(),r=i?i.signal:L(Qx,this,Zx).call(this);return t&&z(zx,this).set(t,{controller:i,allowSeekKeep:!!e,segmentOffset:n}),{signal:r,controller:i}}function ow(t,e,n={}){const i=z(zx,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 sw(t,e){const n=z(zx,this).get(t);n&&(e&&n.controller!==e||z(zx,this).delete(t))}function aw(t,e){const n=new Set;return(Array.isArray(t)?t:[]).forEach((t=>{const i=null==t?void 0:t.nodeId;if(!i)return;const r=z(Ox,this)&&"function"==typeof z(Ox,this).get?z(Ox,this).get(i):void 0;if(!r)return;const o=L(Qx,this,yw).call(this,r,t,e);Number.isFinite(o)&&n.add(`${i}:${o}`)})),n}function lw(t){z(zx,this).size&&z(zx,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 cw(){z(Cx,this)&&"function"==typeof z(Cx,this).on&&(U($x,this,(t=>{L(Qx,this,fw).call(this,t)})),z(Cx,this).on(sv.PLACEMENT_ADDED,z($x,this)),U(Vx,this,(t=>L(Qx,this,uw).call(this,t))),z(Cx,this).on(sv.TIMELINE_SEEKING,z(Vx,this)),U(Gx,this,(t=>L(Qx,this,dw).call(this,t))),z(Cx,this).on(sv.TIMELINE_SEEKED,z(Gx,this)),U(Hx,this,(()=>L(Qx,this,hw).call(this))),z(Cx,this).on(sv.TIMELINE_RESET,z(Hx,this))),z(Ox,this)&&"function"==typeof z(Ox,this).on&&(U(qx,this,(()=>{Xk(z(Yx,this),100)})),z(Ox,this).on(sv.NODE_CHILDREN_CHANGED,z(qx,this)))}function uw(t={}){if(L(Qx,this,tw).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=L(Qx,this,aw).call(this,n,e);L(Qx,this,lw).call(this,i),U(Kx,this,!0),U(Xx,this,n.map((t=>{const n=null==t?void 0:t.nodeId;if(n)return{nodeId:n,placement:t,targetTime:e}})).filter(Boolean)),setTimeout((()=>L(Qx,this,mw).call(this)),0)}function dw(t={}){var e,n;if(L(Qx,this,tw).call(this))return;U(Kx,this,!1),U(Xx,this,[]);const i=Number.isFinite(null==t?void 0:t.targetTime)?Number(t.targetTime):Number(null===(e=z(Cx,this))||void 0===e?void 0:e.currentTime);(Array.isArray(null===(n=z(Cx,this))||void 0===n?void 0:n.placements)?z(Cx,this).placements:[]).forEach((t=>{if(!t)return;const e=cm(t);if(Number.isFinite(e)){if(Number.isFinite(i)){if(e>=i)return void L(Qx,this,fw).call(this,t);const n=am(t,z(Ox,this));return Number.isFinite(n)?void(e+n>i&&L(Qx,this,fw).call(this,t)):void(e<=i&&L(Qx,this,fw).call(this,t))}L(Qx,this,fw).call(this,t)}})),setTimeout((()=>L(Qx,this,mw).call(this)),0)}function hw(){z(jx,this)&&z(jx,this).abort(),U(jx,this,cy()),z(zx,this).size&&z(zx,this).forEach((t=>{(null==t?void 0:t.controller)&&t.controller.abort()})),z(zx,this).clear(),z(Dx,this).clear(),z(Rx,this).clear(),U(Lx,this,[]),z(Bx,this).clear(),U(Wx,this,!1),U(Ux,this,void 0),U(Kx,this,!1),U(Xx,this,[])}function fw(t){if(L(Qx,this,tw).call(this))return;const e=null==t?void 0:t.nodeId;if(!e)return;const n=z(Dx,this).get(e);if(n){const i=cm(n),r=cm(t);Number.isFinite(i)?Number.isFinite(r)&&r<i&&z(Dx,this).set(e,t):Number.isFinite(r)&&z(Dx,this).set(e,t)}else z(Dx,this).set(e,t);const i=z(Ux,this);U(Ux,this,e),i&&i!==e&&U(Lx,this,[]),z(Wx,this)?setTimeout((()=>L(Qx,this,mw).call(this)),0):L(Qx,this,pw).call(this)}function pw(){z(Wx,this)||z(Dx,this).size&&(U(Wx,this,!0),L(Qx,this,mw).call(this))}async function mw(){if(L(Qx,this,tw).call(this))return;if(z(Bx,this).size>=this.settings.maxConcurrentLoads)return;if(z(Kx,this))return void(z(Xx,this).length&&L(Qx,this,vw).call(this));const t=L(Qx,this,xw).call(this);if(t.hasPending)L(Qx,this,ww).call(this,t);else for(z(Lx,this).length||U(Lx,this,L(Qx,this,Ew).call(this));z(Bx,this).size<this.settings.maxConcurrentLoads&&z(Lx,this).length;){const t=z(Lx,this).shift();L(Qx,this,Nw).call(this,t,"partial").finally((()=>{setTimeout((()=>L(Qx,this,mw).call(this)),0)}))}}function vw(){if(L(Qx,this,tw).call(this))return;const t=Math.max(0,this.settings.maxConcurrentLoads-z(Bx,this).size);if(!t||!z(Xx,this).length)return;const e=[],n=[];for(let i=0;i<z(Xx,this).length;i+=1){const r=z(Xx,this)[i];(null==r?void 0:r.nodeId)&&(e.length<t&&!z(Bx,this).has(r.nodeId)?e.push(r):n.push(r))}U(Xx,this,n),e.forEach((t=>{L(Qx,this,gw).call(this,t).finally((()=>{setTimeout((()=>L(Qx,this,mw).call(this)),0)}))}))}async function gw(t={}){const e=null==t?void 0:t.nodeId,n=null==t?void 0:t.placement,i=Number(null==t?void 0:t.targetTime);if(!e||!n||!Number.isFinite(i))return;if(z(Bx,this).has(e))return;const{signal:r,controller:o}=L(Qx,this,rw).call(this,e);if(r&&r.aborted)L(Qx,this,sw).call(this,e,o);else{z(Bx,this).add(e);try{const t=z(Ox,this)&&"function"==typeof z(Ox,this).get?z(Ox,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=L(Qx,this,yw).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}`),L(Qx,this,ow).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){dy(t,r)||this.log.warn(`[#loadSeekWork] SegmentLoadCoordinator failed to seek-load node ${e}: ${(null==t?void 0:t.message)||t}`)}finally{z(Bx,this).delete(e),L(Qx,this,sw).call(this,e,o)}}}function yw(t,e,n){var i;const r=cm(e);if(!Number.isFinite(r))return;const o=Fx(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=Fx(null===(i=l)||void 0===i?void 0:i.offset),d=Gy(c,Math.max(0,s-u),{preferRepresentationTime:!0}),h=Number(null==d?void 0:d.offset);return Number.isFinite(h)?h:void 0}function bw(t,e,n=(t=>null===(t=z(Cx,this))||void 0===t?void 0:t.currentTime)()){var i;const r=(Array.isArray(null===(i=z(Cx,this))||void 0===i?void 0:i.placements)?z(Cx,this).placements:[]).filter((e=>(null==e?void 0:e.nodeId)===t&&Number.isFinite(cm(e)))).sort(((t,e)=>cm(t)-cm(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=cm(e);if(!Number.isFinite(n))continue;const i=am(e,z(Ox,this)),l=Number.isFinite(i)&&i>=0;(!a&&n>=o-Nx&&(a=e),l)?o+Nx>=n&&o<n+i-Nx&&(s=e):o+Nx>=n&&(s=e)}return s||a||r[r.length-1]}function kw(t,e){var n;const i=Number(cm(e));if(!Number.isFinite(i))return;const r=am(e,z(Ox,this)),o=Number.isFinite(r)&&r>=0?i+r:void 0,s=(Array.isArray(null===(n=z(Cx,this))||void 0===n?void 0:n.placements)?z(Cx,this).placements:[]).filter((e=>(null==e?void 0:e.nodeId)===t&&Number.isFinite(cm(e)))).sort(((t,e)=>cm(t)-cm(e)));for(let t=0;t<s.length;t+=1){const e=s[t],n=Number(cm(e));if(Number.isFinite(n)&&!(n<=i+Nx)){if(Number.isFinite(o)&&n>o+Nx)return;return e}}}function xw(){const t=[];let e=!1,n=1/0;if(z(Dx,this).forEach(((i,r)=>{if(!r||!i)return;const o=z(Rx,this).get(r);if(o)return e=!0,void(n=Math.min(n,Fx(o.timelineStart)));const s=L(Qx,this,_w).call(this,r,i);s&&(e=!0,n=Math.min(n,Fx(s.timelineStart)),t.push(s))})),!e||!Number.isFinite(n))return{hasPending:!1,waveTime:void 0,startable:[]};const i=t.filter((t=>Fx(t.timelineStart)===n&&!z(Bx,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 ww({waveTime:t,startable:e}){const n=Math.max(0,this.settings.maxConcurrentLoads-z(Bx,this).size);n&&e.length&&e.slice(0,n).forEach((e=>{L(Qx,this,Iw).call(this,e,t).finally((()=>{setTimeout((()=>L(Qx,this,mw).call(this)),0)}))}))}function _w(t,e){var n,i;const r=z(Ox,this)&&"function"==typeof z(Ox,this).get?z(Ox,this).get(t):void 0;if(!r)return;if("function"==typeof r.hasExceededManifestLoadAttempts&&r.hasExceededManifestLoadAttempts())return void z(Dx,this).delete(t);const o=L(Qx,this,bw).call(this,t,e,null===(n=z(Cx,this))||void 0===n?void 0:n.currentTime),s=Number(cm(o)),a=Fx(null===(i=z(Cx,this))||void 0===i?void 0:i.currentTime),l="function"==typeof r.loadMediaSegmentsAtOffset,c="function"==typeof r.load;if(!l&&!c)return void z(Dx,this).delete(t);if(r.isLoaded)return void z(Dx,this).delete(t);if("ready"!==r.state){if(!Number.isFinite(s))return;return{nodeId:t,segmentOffset:0,timelineStart:s}}if(!L(Qx,this,Mw).call(this,r))return void z(Dx,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&&!L(Qx,this,iw).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/Nx)*Nx;h.add(t)}}))}));const f=Array.from(h).sort(((t,e)=>t-e)),p=e=>{const n=Number(cm(e));if(!Number.isFinite(n))return{status:"none"};const i=Fx(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+Nx;t+=1)s=t;const l=f.slice(s);if(!l.some((t=>L(Qx,this,Tw).call(this,r,t))))return{status:f.slice(0,s).some((t=>L(Qx,this,Tw).call(this,r,t)))?"beforeOnly":"none"};const c=l.find((t=>L(Qx,this,Tw).call(this,r,t))),u=Math.max(0,Fx(c)-i);return{status:"work",work:{nodeId:t,segmentOffset:c,timelineStart:n+u}}},m=p(o);if("work"===m.status)return m.work;if("beforeOnly"!==m.status){if(d&&Number.isFinite(s))return{nodeId:t,segmentOffset:0,timelineStart:s};z(Dx,this).delete(t)}else{const e=L(Qx,this,kw).call(this,t,o);if(e){const t=p(e);if("work"===t.status)return t.work}}}function Tw(t,e){const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[],i=Fx(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)<=Nx&&!L(Qx,this,iw).call(this,t)}))))}async function Iw(t,e){const n=null==t?void 0:t.nodeId,i=null==t?void 0:t.segmentOffset;if(this.log.debug(`[#loadP0Work] Loading ${Mx} node [${n}] at segmentOffset=${i} wave=${e}`),!n)return;const r=z(Ox,this)&&"function"==typeof z(Ox,this).get?z(Ox,this).get(n):void 0;if(!r)return void z(Dx,this).delete(n);const o="function"==typeof r.loadMediaSegmentsAtOffset&&Number.isFinite(i),{signal:s,controller:a}=L(Qx,this,rw).call(this,n,{allowSeekKeep:o,segmentOffset:i});if(s&&s.aborted)L(Qx,this,sw).call(this,n,a);else{z(Bx,this).add(n),z(Rx,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(dy(t,s))return;const e=`[#loadP0Work] SegmentLoadCoordinator failed to load ${Mx} work for node ${n}: ${(null==t?void 0:t.message)||t}`;this.log.warn(e)}finally{this.log.debug(`[#loadP0Work] Finished ${Mx} work for node [${n}]`),z(Rx,this).delete(n),z(Bx,this).delete(n),L(Qx,this,sw).call(this,n,a)}}}function Ew(){const t=new Set([...z(Dx,this).keys(),...z(Bx,this)]),e=L(Qx,this,Sw).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&&L(Qx,this,Fw).call(this,t));if(i){const e=Ck({prioritizer:z(Px,this),repository:z(Ox,this),startNodeId:z(Ux,this),prioritizedIds:n,pendingIds:t,allowedIds:i,filter:r});if(e.length)return e}return Ck({prioritizer:z(Px,this),repository:z(Ox,this),startNodeId:z(Ux,this),prioritizedIds:n,pendingIds:t,filter:r})}function Sw(){return z(Px,this)&&z(Ux,this)?"function"==typeof z(Px,this).getPrioritizationSnapshot?z(Px,this).getPrioritizationSnapshot(z(Ux,this)):{orderedIds:"function"==typeof z(Px,this).sortNodes?z(Px,this).sortNodes(z(Ux,this)):[],reachableIds:"function"==typeof z(Px,this).getReachableNodeIds?z(Px,this).getReachableNodeIds(z(Ux,this)):[]}:null}function Aw(){L(Qx,this,tw).call(this)||(z(Wx,this)||z(Dx,this).size)&&(U(Lx,this,L(Qx,this,Ew).call(this)),z(Wx,this)&&!z(Kx,this)&&L(Qx,this,mw).call(this))}async function Nw(t,e){if(this.log.debug(`[#loadNode] Loading node [${t}] in '${e}' mode`),!t)return;const n=z(Ox,this)&&"function"==typeof z(Ox,this).get?z(Ox,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}=L(Qx,this,rw).call(this,t,{allowSeekKeep:!1});if(i&&i.aborted)L(Qx,this,sw).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&&L(Qx,this,Fw).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${t}: partial already loaded`);if(!L(Qx,this,Mw).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${t}: no loadable tracks`);z(Bx,this).add(t),await n.load({loadingMode:e,signal:i})}catch(e){if(dy(e,i))return;this.log.warn(`[#loadNode] SegmentLoadCoordinator failed to load node ${t}: ${(null==e?void 0:e.message)||e}`)}finally{this.log.debug(`[#loadNode] Finished loading node [${t}]`),z(Bx,this).delete(t),L(Qx,this,sw).call(this,t,r)}}function Mw(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 Fw(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&&!L(Qx,this,iw).call(this,n)||i&&!L(Qx,this,iw).call(this,i))}))}class Ow extends sd{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 Pw(t){if(!t)throw new Error("Assertion failed.")}const Cw=t=>t&&t[t.length-1],Dw=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)},Rw=t=>t.constructor===Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t),Lw=t=>t.constructor===DataView?t:ArrayBuffer.isView(t)?new DataView(t.buffer,t.byteOffset,t.byteLength):new DataView(t),Bw=new TextDecoder,zw=t=>Object.fromEntries(Object.entries(t).map((([t,e])=>[e,t]))),Ww={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},Uw=zw(Ww),jw={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},$w=zw(jw),qw={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},Vw=zw(qw),Gw=t=>[...t].map((t=>t.toString(16).padStart(2,"0"))).join(""),Hw=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},Yw=()=>{let t,e;return{promise:new Promise(((n,i)=>{t=n,e=i})),resolve:t,reject:e}},Qw=(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)),Zw=/^[a-z]{3}$/,t_=1e6*(1+Number.EPSILON);let e_=null;let n_=null;const i_=()=>{if(null!==n_)return n_;if("undefined"==typeof navigator)return null;const t=/\bChrome\/(\d+)/.exec(navigator.userAgent);return t?n_=Number(t[1]):null},r_=t=>"number"==typeof t&&!Number.isNaN(t);class o_{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 s_={default:!0,forced:!1,original:!1,commentary:!1,hearingImpaired:!1,visuallyImpaired:!1};class a_{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 a_(this.bytes);return t.pos=this.pos,t}}const l_=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],c_=[-1,1,2,3,4,5,6,8],u_=t=>{if(!t||t.byteLength<2)throw new TypeError("AAC description must be at least 2 bytes long.");const e=new a_(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<l_.length&&(r=l_[i]);const o=e.readBits(4);let s=null;return o>=1&&o<=7&&(s=c_[o]),{objectType:n,frequencyIndex:i,sampleRate:r,channelConfiguration:o,numberOfChannels:s}},d_=["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"],h_=[{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}],f_=t=>{const{codec:e,codecDescription:n,colorSpace:i,avcCodecInfo:r,hevcCodecInfo:o,vp9CodecInfo:s,av1CodecInfo:a}=t;if("avc"===e){if(Pw(null!==t.avcType),r){const e=new Uint8Array([r.avcProfileIndication,r.profileCompatibility,r.avcLevelIndication]);return`avc${t.avcType}.${Gw(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}.${Gw(n.subarray(1,4))}`}if("hevc"===e){let t,e,i,r,s,a;if(o)t=o.generalProfileSpace,e=o.generalProfileIdc,i=Hw(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=Lw(n),l=o.getUint8(1);t=l>>6&3,e=31&l,i=Hw(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=Cw(h_).level;for(const t of h_)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=Cw(h_).level;for(const t of h_)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?Ww[i.primaries]:1,u=null!=i&&i.transfer?jw[i.transfer]:1,d=null!=i&&i.matrix?qw[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}'.`)},p_=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:u_(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&&d_.includes(e))return e;throw new TypeError(`Unhandled codec '${e}'.`)},m_=/^pcm-([usf])(\d+)+(be)?$/,v_=[48e3,44100,32e3],g_=[24e3,22050,16e3];var y_,b_;!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"}(y_||(y_={})),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"}(b_||(b_={}));const k_=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})},x_=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=Qw(i,n):(Pw(4===e),t=i.getUint32(n,!1)),n+=e,yield{offset:n,length:t},n+=t}},w_=t=>31&t,__=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)},T_=t=>t>>1&63,I_=function*(t){const e=new a_(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);Pw(e.pos%8==0),yield{type:i,data:t.subarray(e.pos/8,e.pos/8+s)},e.skipBits(8*s)}};var E_;!function(t){t[t.STREAMINFO=0]="STREAMINFO",t[t.VORBIS_COMMENT=4]="VORBIS_COMMENT",t[t.PICTURE=6]="PICTURE"}(E_||(E_={}));const S_=[2,1,2,3,3,4,4,5];class A_{constructor(t){this.input=t}}const N_=[],M_=[],F_=new Uint8Array(0);class O_{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===F_&&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===F_}get microsecondTimestamp(){return Math.trunc(t_*this.timestamp)}get microsecondDuration(){return Math.trunc(t_*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 O_(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 O_(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 P_=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.")},C_=t=>{if(!r_(t))throw new TypeError("timestamp must be a number.")},D_=(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 R_{constructor(t){if(!(t instanceof L_))throw new TypeError("track must be an InputTrack.");this._track=t}getFirstPacket(t={}){if(P_(t),this._track.input._disposed)throw new cT;return D_(this._track,this._track._backing.getFirstPacket(t),t)}async getFirstKeyPacket(t={}){P_(t);const e=await this.getFirstPacket(t);return e?"key"===e.type?e:this.getNextKeyPacket(e,t):null}getPacket(t,e={}){if(C_(t),P_(e),this._track.input._disposed)throw new cT;return D_(this._track,this._track._backing.getPacket(t,e),e)}getNextPacket(t,e={}){if(!(t instanceof O_))throw new TypeError("packet must be an EncodedPacket.");if(P_(e),this._track.input._disposed)throw new cT;return D_(this._track,this._track._backing.getNextPacket(t,e),e)}async getKeyPacket(t,e={}){if(C_(t),P_(e),this._track.input._disposed)throw new cT;if(!e.verifyKeyPackets)return this._track._backing.getKeyPacket(t,e);const n=await this._track._backing.getKeyPacket(t,e);return n?(Pw("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 O_))throw new TypeError("packet must be an EncodedPacket.");if(P_(e),this._track.input._disposed)throw new cT;if(!e.verifyKeyPackets)return this._track._backing.getNextKeyPacket(t,e);const n=await this._track._backing.getNextKeyPacket(t,e);return n?(Pw("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 O_))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 O_))throw new TypeError("endPacket must be an EncodedPacket.");if(P_(n),this._track.input._disposed)throw new cT;const i=[];let{promise:r,resolve:o}=Yw(),{promise:s,resolve:a}=Yw(),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}=Yw()),await s):(i.push(u),o(),({promise:r,resolve:o}=Yw()),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 cT;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 L_{constructor(t,e){this.input=t,this._backing=e}isVideoTrack(){return this instanceof B_}isAudioTrack(){return this instanceof z_}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 R_(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 B_ extends L_{constructor(t,e){super(t,e),this._backing=e,this.pixelAspectRatio=(t=>{Pw(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 Pw(null!==e),N_.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 O_))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 Pw(e),((t,e,n)=>{switch(t){case"avc":for(const t of((t,e)=>{if(e.description){const n=3&Rw(e.description)[4];return x_(t,n+1)}return k_(t)})(n,e)){const e=n[t.offset],r=w_(e);if(r>=y_.NON_IDR_SLICE&&r<=y_.SLICE_DPC)return"delta";if(r===y_.IDR)return"key";if(r===y_.SEI&&(i=void 0,!(null!==e_?e_:e_=!("undefined"==typeof navigator||(null===(i=navigator.vendor)||void 0===i||!i.includes("Google Inc"))&&!/Chrome/.test(navigator.userAgent)))||i_()>=144)){const e=n.subarray(t.offset,t.offset+t.length),i=__(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 a_(i);t.pos=8*r;const e=Dw(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&Rw(e.description)[21];return x_(t,n+1)}return k_(t)})(n,e)){const e=T_(n[t.offset]);if(e<b_.BLA_W_LP)return"delta";if(e<=b_.RSV_IRAP_VCL23)return"key"}return"delta";case"vp8":return 1&n[0]?"delta":"key";case"vp9":{const t=new a_(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 I_(n))if(1===e){const e=new a_(i);e.skipBits(4),t=!!e.readBits(1)}else if(3===e||6===e||7===e){if(t)return"key";const e=new a_(i);return e.readBits(1)?null:0===e.readBits(2)?"key":"delta"}return null}default:(t=>{throw new Error(`Unexpected value: ${t}`)})(t),Pw(!1)}var i})(this.codec,e,t.data)}}class z_ extends L_{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 Pw(null!==e),M_.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 O_))throw new TypeError("packet must be an EncodedPacket.");return null===this.codec?null:"key"}}const W_=t=>{let e=yT(t);const n=_T(t,4);let i=8;1===e&&(e=kT(t),i=16);const r=e-i;return r<0?null:{name:n,totalSize:e,headerSize:i,contentSize:r}},U_=t=>bT(t)/65536,j_=t=>bT(t)/1073741824,$_=t=>{let e=0;for(let n=0;n<4;n++){e<<=7;const n=pT(t);if(e|=127&n,!(128&n))break}return e},q_=t=>{let e=mT(t);return t.skip(2),e=Math.min(e,t.remainingLength),Bw.decode(fT(t,e))},V_=t=>{const e=W_(t);if(!e||"data"!==e.name)return null;if(t.remainingLength<8)return null;const n=yT(t);t.skip(4);const i=fT(t,e.contentSize-8);switch(n){case 1:return Bw.decode(i);case 2:return new TextDecoder("utf-16be").decode(i);case 13:return new o_(i,"image/jpeg");case 14:return new o_(i,"image/png");case 27:return new o_(i,"image/bmp");default:return i}};class G_ extends A_{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=W_(e);if(!i)break;if("ftyp"===i.name){const t=_T(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),Pw(t);const e=yT(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=W_(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,Pw(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&&d_.includes(t.info.codec)&&0===n.sampleCompositionTimeOffsets.length){var r;Pw("audio"===(null===(r=t.info)||void 0===r?void 0:r.type));const e=(t=>{if(Pw(d_.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=m_.exec(t);let n;return Pw(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=Cw(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),Pw(n);const i=W_(n);Pw("moof"===(null==i?void 0:i.name));let r=this.reader.requestSlice(t,i.totalSize);r instanceof Promise&&(r=await r),Pw(r),this.traverseBox(r);const o=this.lastReadFragment;Pw(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)tT(t,i.timestamp);else{const e=Xw(n,o.moofOffset-1,(t=>t.moofOffset));if(-1!==e){const i=n[e];tT(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=W_(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,O,P,C,D,R;const L=t.filePos,B=W_(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=pT(t);t.skip(3),1===e?(t.skip(16),this.movieTimescale=yT(t),this.movieDurationInTimescale=kT(t)):(t.skip(8),this.movieTimescale=yT(t),this.movieDurationInTimescale=yT(t))}break;case"trak":{const e={id:-1,demuxer:this,inputTrack:null,disposition:{...s_},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 B_(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 z_(this.input,new X_(t)),this.tracks.push(e)}this.currentTrack=null}break;case"tkhd":{const e=this.currentTrack;if(!e)break;const n=pT(t),i=!!(1&vT(t));if(e.disposition.default=i,0===n)t.skip(8),e.id=yT(t),t.skip(4),e.durationInMovieTimescale=yT(t);else{if(1!==n)throw new Error(`Incorrect track header version ${n}.`);t.skip(16),e.id=yT(t),t.skip(4),e.durationInMovieTimescale=kT(t)}t.skip(16);const r=[U_(t),U_(t),j_(t),U_(t),U_(t),j_(t),U_(t),U_(t),j_(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}.`)})((Ot=eT(r),90*Math.round(Ot/90)));Pw(0===o||90===o||180===o||270===o),e.rotation=o}break;case"elst":{const e=this.currentTrack;if(!e)break;const n=pT(t);t.skip(3);let i=!1,r=0;const o=yT(t);for(let s=0;s<o;s++){const o=1===n?kT(t):yT(t),s=1===n?xT(t):bT(t),a=U_(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=pT(t);t.skip(3),0===n?(t.skip(8),e.timescale=yT(t),e.durationInMediaTimescale=yT(t)):1===n&&(t.skip(16),e.timescale=yT(t),e.durationInMediaTimescale=kT(t));let i=mT(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,Zw.test(Ft)||(e.languageCode="und")}}break;case"hdlr":{const e=this.currentTrack;if(!e)break;t.skip(8);const n=_T(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=pT(t);t.skip(3);const i=yT(t);for(let r=0;r<i;r++){const i=t.filePos,r=W_(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=mT(t),e.info.height=mT(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=mT(t);t.skip(6);let a=mT(t),l=mT(t);t.skip(4);let c=yT(t)/65536;if(0===n&&s>0)if(1===s)t.skip(4),l=8*yT(t),t.skip(8);else if(2===s){t.skip(4),c=wT(t),a=yT(t),t.skip(4),l=yT(t);const n=yT(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;Pw(e.info),e.info.codecDescription=fT(t,B.contentSize)}break;case"hvcC":{const e=this.currentTrack;if(!e)break;Pw(e.info),e.info.codecDescription=fT(t,B.contentSize)}break;case"vpcC":{var U;const e=this.currentTrack;if(!e)break;Pw("video"===(null===(U=e.info)||void 0===U?void 0:U.type)),t.skip(4);const n=pT(t),i=pT(t),r=pT(t),o=r>>4,s=r>>1&7,a=1&r,l=pT(t),c=pT(t),u=pT(t);e.info.vp9CodecInfo={profile:n,level:i,bitDepth:o,chromaSubsampling:s,videoFullRangeFlag:a,colourPrimaries:l,transferCharacteristics:c,matrixCoefficients:u}}break;case"av1C":{var j;const e=this.currentTrack;if(!e)break;Pw("video"===(null===(j=e.info)||void 0===j?void 0:j.type)),t.skip(1);const n=pT(t),i=n>>5,r=31&n,o=pT(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 $;const e=this.currentTrack;if(!e)break;if(Pw("video"===(null===($=e.info)||void 0===$?void 0:$.type)),"nclx"!==_T(t,4))break;const n=mT(t),i=mT(t),r=mT(t),o=Boolean(128&pT(t));e.info.colorSpace={primaries:Uw[n],transfer:$w[i],matrix:Vw[r],fullRange:o}}break;case"pasp":{var q;const e=this.currentTrack;if(!e)break;Pw("video"===(null===(q=e.info)||void 0===q?void 0:q.type));const n=yT(t),i=yT(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;Pw("audio"===(null===(V=e.info)||void 0===V?void 0:V.type)),t.skip(4),Pw(3===pT(t)),$_(t),t.skip(2);const n=pT(t),i=!!(64&n),r=!!(32&n);if(!!(128&n)&&t.skip(2),i){const e=pT(t);t.skip(e)}r&&t.skip(2),Pw(4===pT(t));const o=$_(t),s=t.filePos,a=pT(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){Pw(5===pT(t));const n=$_(t);if(e.info.codecDescription=fT(t,n),"aac"===e.info.codec){const t=u_(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;Pw("audio"===(null===(G=e.info)||void 0===G?void 0:G.type)),255&mT(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;Pw("audio"===(null===(H=e.info)||void 0===H?void 0:H.type)),t.skip(4);const n=pT(t),i=Boolean(1&n),r=pT(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;Pw("audio"===(null===(K=e.info)||void 0===K?void 0:K.type)),t.skip(1);const n=pT(t),i=mT(t),r=yT(t),o=gT(t),s=pT(t);let a;a=0!==s?fT(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;Pw("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=pT(t),o=vT(t);if((r&n)===E_.STREAMINFO){t.skip(10);const n=yT(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=fT(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;Pw("audio"===(null===(Y=e.info)||void 0===Y?void 0:Y.type));const n=fT(t,3),i=new a_(n),r=i.readBits(2);i.skipBits(8);const o=i.readBits(3),s=i.readBits(1);r<3&&(e.info.sampleRate=v_[r]),e.info.numberOfChannels=S_[o]+s}break;case"dec3":{var Q;const e=this.currentTrack;if(!e)break;Pw("audio"===(null===(Q=e.info)||void 0===Q?void 0:Q.type));const n=(t=>{if(t.length<2)return null;const e=new a_(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}})(fT(t,B.contentSize));if(!n){console.warn("Invalid dec3 box contents, ignoring.");break}const i=(t=>{const e=t.substreams[0];return Pw(e),e.fscod<3?v_[e.fscod]:null!==e.fscod2&&e.fscod2<3?g_[e.fscod2]:null})(n);null!==i&&(e.info.sampleRate=i),e.info.numberOfChannels=(t=>{const e=t.substreams[0];Pw(e);let n=S_[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=yT(t);let i=0,r=0;for(let o=0;o<n;o++){const n=yT(t),o=yT(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=yT(t);let i=0;for(let r=0;r<n;r++){const n=yT(t),r=bT(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=yT(t),i=yT(t);if(0===n)for(let n=0;n<i;n++){const n=yT(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=pT(t),i=yT(t),r=fT(t,Math.ceil(i*n/8)),o=new a_(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=yT(t);for(let i=0;i<n;i++){const n=yT(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=yT(t);for(let i=0;i<n;i++){const n=yT(t)-1,i=yT(t),r=yT(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=yT(t);for(let i=0;i<n;i++){const n=yT(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=yT(t);for(let i=0;i<n;i++){const n=kT(t);e.sampleTable.chunkOffsets.push(n)}}break;case"mvex":this.isFragmented=!0,this.readContiguousBoxes(t.slice(z,B.contentSize));break;case"mehd":{const e=pT(t);t.skip(3);const n=1===e?kT(t):yT(t);this.movieDurationInTimescale=n}break;case"trex":{t.skip(4);const e=yT(t),n=yT(t),i=yT(t),r=yT(t),o=yT(t);this.fragmentTrackDefaults.push({trackId:e,defaultSampleDescriptionIndex:n,defaultSampleDuration:i,defaultSampleSize:r,defaultSampleFlags:o})}break;case"tfra":{const e=pT(t);t.skip(3);const n=yT(t),i=this.tracks.find((t=>t.id===n));if(!i)break;const r=yT(t),o=(12&r)>>2,s=3&r,a=[pT,mT,vT,yT],l=a[(48&r)>>4],c=a[o],u=a[s],d=yT(t);for(let n=0;n<d;n++){const n=1===e?kT(t):yT(t),r=1===e?kT(t):yT(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(Pw(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;Pw(e),null!==e.startTimestamp&&(tT(t,e.startTimestamp),t.startTimestampIsFinal=!0)}this.currentTrack.currentFragmentState=null,this.currentTrack=null}break;case"tfhd":{var J,Z,tt,et;Pw(this.currentFragment),t.skip(1);const e=vT(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=yT(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=kT(t):l&&(u.currentFragmentState.baseDataOffset=this.currentFragment.moofOffset),i&&(u.currentFragmentState.sampleDescriptionIndex=yT(t)),r&&(u.currentFragmentState.defaultSampleDuration=yT(t)),o&&(u.currentFragmentState.defaultSampleSize=yT(t)),s&&(u.currentFragmentState.defaultSampleFlags=yT(t)),a&&(u.currentFragmentState.defaultSampleDuration=0)}break;case"tfdt":{const e=this.currentTrack;if(!e)break;Pw(e.currentFragmentState);const n=pT(t);t.skip(3);const i=0===n?yT(t):kT(t);e.currentFragmentState.startTimestamp=i}break;case"trun":{const e=this.currentTrack;if(!e)break;if(Pw(this.currentFragment),Pw(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=pT(t),i=vT(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=yT(t);let d=e.currentFragmentState.baseDataOffset;r&&(d+=bT(t));let h=null;o&&(h=yT(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=yT(t):(Pw(null!==e.currentFragmentState.defaultSampleDuration),r=e.currentFragmentState.defaultSampleDuration),a?o=yT(t):(Pw(null!==e.currentFragmentState.defaultSampleSize),o=e.currentFragmentState.defaultSampleSize),l?u=yT(t):(Pw(null!==e.currentFragmentState.defaultSampleFlags),u=e.currentFragmentState.defaultSampleFlags),0===i&&null!==h&&(u=h);let d=0;c&&(d=0===n?yT(t):bT(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[Cw(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]=q_(y)):null!==(ct=(at=this.metadataTags.raw)[lt=t.name])&&void 0!==ct||(at[lt]=fT(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=Bw.decode(fT(y,t.contentSize)):null!==(n=(e=this.metadataTags).title)&&void 0!==n||(e.title=q_(y));break;case"©des":this.currentTrack||null!==(r=(i=this.metadataTags).description)&&void 0!==r||(i.description=q_(y));break;case"©ART":this.currentTrack||null!==(s=(o=this.metadataTags).artist)&&void 0!==s||(o.artist=q_(y));break;case"©alb":this.currentTrack||null!==(l=(a=this.metadataTags).album)&&void 0!==l||(a.album=q_(y));break;case"albr":this.currentTrack||null!==(u=(c=this.metadataTags).albumArtist)&&void 0!==u||(c.albumArtist=q_(y));break;case"©gen":this.currentTrack||null!==(h=(d=this.metadataTags).genre)&&void 0!==h||(d.genre=q_(y));break;case"©day":if(!this.currentTrack){var ut,dt;const t=new Date(q_(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=q_(y));break;case"©lyr":this.currentTrack||null!==(v=(m=this.metadataTags).lyrics)&&void 0!==v||(m.lyrics=q_(y))}}}break;case"meta":{if(this.currentTrack)break;const e=0!==yT(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=yT(t);for(let n=0;n<e;n++){const e=yT(t);t.skip(4);const i=Bw.decode(fT(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=V_(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!==(O=(F=this.metadataTags).lyrics)&&void 0!==O||(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 o_?(null!==(C=(P=this.metadataTags).images)&&void 0!==C||(P.images=[]),this.metadataTags.images.push({data:r.data,kind:"coverFront",mimeType:r.mimeType})):r instanceof Uint8Array&&(null!==(R=(D=this.metadataTags).images)&&void 0!==R||(D.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=Lw(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=Lw(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,Ot;return t.filePos=W,!0}}class H_{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=Y_(i,n),o=await this.fetchPacketForSampleIndex(r,e);return nT(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=Q_(i,n),o=await this.fetchPacketForSampleIndex(r,e);return nT(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=Z_(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 Pw(-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=F_;else{let t=this.internalTrack.demuxer.reader.requestSlice(i.sampleOffset,i.sampleSize);t instanceof Promise&&(t=await t),Pw(t),r=fT(t,i.sampleSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new O_(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(Pw(i),n.metadataOnly)r=F_;else{let t=this.internalTrack.demuxer.reader.requestSlice(i.byteOffset,i.byteSize);t instanceof Promise&&(t=await t),Pw(t),r=fT(t,i.byteSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new O_(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=W_(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];Pw(!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 H_{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 I_(t)){if(1!==e)continue;const t=new a_(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 a_(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=Cw(h_).level;for(const t of h_)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:f_(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 H_{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:p_(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 Y_=(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)}},Q_=(t,e)=>{if(!t.keySampleIndices)return Y_(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=Y_(t,e),r=Xw(t.keySampleIndices,i,(t=>t));return null!==(n=t.keySampleIndices[r])&&void 0!==n?n:-1}},J_=(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];Pw(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];Pw(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))}},Z_=(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},tT=(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},eT=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},nT=t=>0===t.sampleSizes.length;class iT{}class rT extends iT{async _getMajorBrand(t){let e=t._reader.requestSlice(0,12);return e instanceof Promise&&(e=await e),e?(e.skip(4),"ftyp"!==_T(e,4)?null:_T(e,4)):null}_createDemuxer(t){return new G_(t)}}const oT=new class extends rT{async _canReadInput(t){const e=await this._getMajorBrand(t);return!!e&&"qt "!==e}get name(){return"MP4"}get mimeType(){return"video/mp4"}};class sT{constructor(){this._disposed=!1,this._sizePromise=null,this.onread=null}async getSizeOrNull(){var t;if(this._disposed)throw new cT;return null!==(t=this._sizePromise)&&void 0!==t?t:this._sizePromise=Promise.resolve(this._retrieveSize())}async getSize(){if(this._disposed)throw new cT;const t=await this.getSizeOrNull();if(null===t)throw new Error("Cannot determine the size of an unsized source.");return t}}class aT extends sT{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&&(!r_(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:Lw(o),offset:t};this._currentIndex>r&&this._throwDueToCacheMiss();const{promise:s,resolve:a,reject:l}=Yw();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:Lw(e.bytes),offset:e.start}),this._pendingSlices.splice(t,1),t--))}for(this._cache.push({start:i,end:r,bytes:n,view:Lw(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!==(ye=Symbol.dispose)&&void 0!==ye||(Symbol.dispose=Symbol("Symbol.dispose"));class lT{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 iT))))throw new TypeError("options.formats must be an array of InputFormat.");if(!(t.source instanceof sT))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 uT(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(),Pw(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 cT extends Error{constructor(t="Input has been disposed."){super(t),this.name="InputDisposedError"}}class uT{constructor(t){this.source=t}requestSlice(t,e){if(this.source._disposed)throw new cT;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 dT(e.bytes,e.view,e.offset,t,n):null)):i?new dT(i.bytes,i.view,i.offset,t,n):null}requestSliceRange(t,e,n){if(this.source._disposed)throw new cT;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=>(Pw(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 dT{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 dT(t,Lw(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 dT(this.bytes,this.view,this.offset,t,t+e)}}const hT=(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.`)},fT=(t,e)=>{hT(t,e);const n=t.bytes.subarray(t.bufferPos,t.bufferPos+e);return t.bufferPos+=e,n},pT=t=>(hT(t,1),t.view.getUint8(t.bufferPos++)),mT=t=>{hT(t,2);const e=t.view.getUint16(t.bufferPos,!1);return t.bufferPos+=2,e},vT=t=>{hT(t,3);const e=Qw(t.view,t.bufferPos);return t.bufferPos+=3,e},gT=t=>{hT(t,2);const e=t.view.getInt16(t.bufferPos,!1);return t.bufferPos+=2,e},yT=t=>{hT(t,4);const e=t.view.getUint32(t.bufferPos,!1);return t.bufferPos+=4,e},bT=t=>{hT(t,4);const e=t.view.getInt32(t.bufferPos,!1);return t.bufferPos+=4,e},kT=t=>4294967296*yT(t)+yT(t),xT=t=>4294967296*bT(t)+yT(t),wT=t=>{hT(t,8);const e=t.view.getFloat64(t.bufferPos,!1);return t.bufferPos+=8,e},_T=(t,e)=>{hT(t,e);let n="";for(let i=0;i<e;i++)n+=String.fromCharCode(t.bytes[t.bufferPos++]);return n};var TT=new WeakMap,IT=new WeakMap,ET=new WeakMap,ST=new WeakMap,AT=new WeakMap,NT=new WeakMap,MT=new WeakMap,FT=new WeakMap,OT=new WeakMap,PT=new WeakMap,CT=new WeakMap,DT=new WeakMap,RT=new WeakMap,LT=new WeakMap,BT=new WeakMap,zT=new WeakSet;class WT extends sd{constructor(...t){super(...t),j(this,zT),W(this,TT,null),W(this,IT,null),W(this,ET,null),W(this,ST,null),W(this,AT,!1),W(this,NT,!1),W(this,MT,!1),W(this,FT,!1),W(this,OT,void 0),W(this,PT,null),W(this,CT,null),W(this,DT,!1),W(this,RT,!1),W(this,LT,null),W(this,BT,!1)}get name(){return"FMP4Demuxer"}get defaults(){return{}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"pushChunk","endOfStream"])}pushChunk(t,e={}){if(z(MT,this)||z(FT,this))return;const n=t instanceof Uint8Array?t:new Uint8Array(t),i=!!e.isInit;U(PT,this,L(zT,this,GT).call(this,n,e,i)),i&&(U(OT,this,n),U(CT,this,null),this.trigger("demux:init",{data:n})),L(zT,this,VT).call(this);try{var r;const t=null===(r=z(TT,this))||void 0===r?void 0:r.write(n);t&&"function"==typeof t.catch&&t.catch((t=>{L(zT,this,HT).call(this,t)}))}catch(t){if(z(MT,this)||L(zT,this,UT).call(this,t))return;return this.log.warn("[FMP4Demuxer] mediabunny demux failed",t),void L(zT,this,HT).call(this,t)}const o=L(zT,this,YT).call(this);o&&"function"==typeof o.catch&&o.catch((t=>{L(zT,this,HT).call(this,t)}))}endOfStream(){if(z(FT,this))return;if(z(DT,this))return;let t;U(DT,this,!0),U(RT,this,!1),U(BT,this,!1);try{var e;t=null===(e=z(TT,this))||void 0===e?void 0:e.close()}catch(e){t=Promise.resolve()}let n=!1;L(zT,this,$T).call(this),U(LT,this,setTimeout((()=>{U(LT,this,null),n||z(RT,this)||z(FT,this)||L(zT,this,qT).call(this)}),20)),Promise.resolve(t).catch((()=>{})).finally((()=>{n=!0,L(zT,this,$T).call(this),L(zT,this,qT).call(this)}))}onDispose(){super.onDispose(),U(FT,this,!0);try{var t,e;null===(t=z(ET,this))||void 0===t||null===(e=t.close)||void 0===e||e.call(t)}catch(t){}this.endOfStream();try{var n,i;null===(n=z(IT,this))||void 0===n||null===(i=n.dispose)||void 0===i||i.call(n)}catch(t){}U(ET,this,null),U(IT,this,null),U(MT,this,!1),U(PT,this,null),U(ST,this,null),U(AT,this,!1),U(NT,this,!1),U(DT,this,!1),U(RT,this,!1),U(BT,this,!1),L(zT,this,$T).call(this)}}function UT(t){return!!z(FT,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 jT(){try{var t,e;const n=null===(t=z(TT,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){}U(TT,this,null)}function $T(){null!==z(LT,this)&&(clearTimeout(z(LT,this)),U(LT,this,null))}function qT(){if(z(RT,this)||z(FT,this)||z(MT,this))return;if(U(RT,this,!0),z(NT,this))return void U(BT,this,!0);U(BT,this,!1);const t=L(zT,this,YT).call(this);t&&"function"==typeof t.catch&&t.catch((t=>{L(zT,this,HT).call(this,t)}))}function VT(){if(z(IT,this)&&z(TT,this))return;const t=cd.TransformStream;if(void 0===t)throw new Error("TransformStream is not available in this environment");const{readable:e,writable:n}=new t;U(TT,this,n.getWriter()),U(IT,this,new lT({source:new aT(e),formats:[oT]})),U(AT,this,!1)}function GT(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 HT(t){if(z(MT,this)||L(zT,this,UT).call(this,t))return;if(L(zT,this,XT).call(this,t))return void U(AT,this,!1);U(MT,this,!0),L(zT,this,jT).call(this);try{var e,n;null===(e=z(ET,this))||void 0===e||null===(n=e.close)||void 0===n||n.call(e)}catch(t){}U(ET,this,null);try{var i,r;null===(i=z(IT,this))||void 0===i||null===(r=i.dispose)||void 0===r||r.call(i)}catch(t){}U(IT,this,null);const o={error:t,recoverable:!1,severity:"fatal",streamClosed:z(DT,this),streamFinalized:z(RT,this)};z(PT,this)&&(o.context={...z(PT,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!!L(zT,this,KT).call(this,t)&&(!z(RT,this)||z(BT,this))}async function YT(){if(!(z(FT,this)||z(MT,this)||z(AT,this)||z(NT,this))){U(NT,this,!0);try{L(zT,this,VT).call(this);const t=await z(IT,this).getPrimaryVideoTrack(),e=t?null:await z(IT,this).getPrimaryAudioTrack(),n=t||e;if(!n)throw new Error("No supported tracks found in MP4");const i=await n.getDecoderConfig(),r=await n.getCodecParameterString(),o=await z(IT,this).getMimeType();this.trigger("demux:init",{...z(OT,this)?{data:z(OT,this)}:{},decoderConfig:i,codec:r,mimeType:o}),U(ET,this,new R_(n)),U(AT,this,!0),U(ST,this,(async()=>{try{for await(const t of z(ET,this).packets()){if(z(FT,this))break;const e="number"==typeof t.timestamp?t.timestamp:0;null===z(CT,this)&&U(CT,this,e);let n=e-z(CT,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){L(zT,this,HT).call(this,t)}})())}catch(t){if(L(zT,this,XT).call(this,t))return;throw t}finally{U(NT,this,!1),!z(BT,this)||z(MT,this)||z(FT,this)||L(zT,this,qT).call(this)}}}const QT=1e6,JT=24e3/1001,ZT=new Uint8Array;function tI(t){return t?t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):ZT:ZT}let eI=null;const nI={video:(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,Oe=new WeakMap,Pe=new WeakMap,Ce=new WeakMap,De=new WeakMap,Re=new WeakMap,Le=new WeakMap,Be=new WeakMap,ze=new WeakMap,We=new WeakMap,Ue=new WeakMap,je=new WeakMap,$e=new WeakMap,qe=new WeakMap,Ve=new WeakMap,Ge=new WeakMap,He=new WeakMap,Ke=new WeakMap,Xe=new WeakMap,Ye=new WeakMap,Qe=new WeakMap,Je=new WeakMap,Ze=new WeakSet,class extends Ow{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),j(this,Ze),W(this,be,void 0),W(this,ke,[]),W(this,xe,void 0),W(this,we,void 0),W(this,_e,void 0),W(this,Te,void 0),W(this,Ie,[]),W(this,Ee,void 0),W(this,Se,new Map),W(this,Ae,!0),W(this,Ne,!1),W(this,Me,!1),W(this,Fe,!1),W(this,Oe,void 0),W(this,Pe,!1),W(this,Ce,!1),W(this,De,0),W(this,Re,void 0),W(this,Le,void 0),W(this,Be,{}),W(this,ze,void 0),W(this,We,0),W(this,Ue,null),W(this,je,!1),W(this,$e,null),W(this,qe,void 0),W(this,Ve,0),W(this,Ge,0),W(this,He,0),W(this,Ke,0),W(this,Xe,!1),W(this,Ye,!1),W(this,Qe,.2),W(this,Je,Promise.resolve()),U(xe,this,this.settings.decodedHorizonSeconds||1),U(we,this,L(Ze,this,GI).call(this,this.settings.maxDecodedFrames)),U(_e,this,L(Ze,this,KI).call(this,this.settings.maxDecodeQueueSize)),U(Xe,this,Jm()),U(Ye,this,L(Ze,this,BI).call(this,this.settings.convertFramesToBitmapsOnAndroid)),U(Qe,this,L(Ze,this,zI).call(this,this.settings.androidFixEndOfSegmentDelta)),U(Te,this,(()=>0)),U(Ee,this,(()=>L(Ze,this,NI).call(this)));const e=this.settings.demuxerOptions?{FMP4Demuxer:this.settings.demuxerOptions}:{};U(be,this,new WT(e)),z(be,this).on("demux:init",(t=>L(Ze,this,bI).call(this,t))),z(be,this).on("demux:sample",(t=>L(Ze,this,kI).call(this,t))),z(be,this).on("demux:complete",(()=>L(Ze,this,xI).call(this))),z(be,this).on("demux:error",(t=>L(Ze,this,lI).call(this,t)))}setCurrentTimeProvider(t){"function"==typeof t&&U(Te,this,t)}setTimeOffsetSeconds(t){const e=Number(t);U(We,this,Number.isFinite(e)?e:0)}setSeekTargetTimeSeconds(t){const e=Number(t);U(Ue,this,Number.isFinite(e)?e:null),U(je,this,!1),U($e,this,null)}endOfStream(){z(be,this)&&"function"==typeof z(be,this).endOfStream&&z(be,this).endOfStream()}configure(t){super.configure(t),U(Be,this,{codec:L(Ze,this,YI).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)}),U(Re,this,z(Be,this).codec)}setSegment(t){this.lastSegment=t,L(Ze,this,mI).call(this)}setNodeId(t){U(qe,this,t)}decode(t){this.setSegment(t);const e=null==t?void 0:t.arrayBuffer;e&&z(be,this).pushChunk(e,{isInit:!(null==t||!t.isInit)})}async decodeChunk(t,e={}){await z(be,this).pushChunk(t,{isInit:!!e.isInit,pts:"number"==typeof e.pts?e.pts:void 0,dts:"number"==typeof e.dts?e.dts:void 0,duration:"number"==typeof e.duration?e.duration:void 0,isKey:!!e.isKey,loaded:"number"==typeof e.loaded?e.loaded:void 0,total:"number"==typeof e.total?e.total:void 0})}get decodedFrames(){return z(ke,this).slice()}onDispose(){if(super.onDispose(),L(Ze,this,OI).call(this),z(be,this)&&"function"==typeof z(be,this).dispose&&z(be,this).dispose(),U(ke,this,[]),U(Ie,this,[]),z(Se,this).clear(),U($e,this,null),z(Oe,this)&&"function"==typeof z(Oe,this).close)try{z(Oe,this).close()}catch(t){}U(Oe,this,null),U(Pe,this,!1),U(Le,this,null),U(Re,this,null),U(qe,this,null),U(Je,this,Promise.resolve()),L(Ze,this,mI).call(this)}}),audio:(tn=new WeakMap,en=new WeakMap,nn=new WeakMap,rn=new WeakMap,on=new WeakMap,sn=new WeakMap,an=new WeakMap,ln=new WeakSet,class extends Ow{constructor(...t){super(...t),j(this,ln),W(this,tn,void 0),W(this,en,[]),W(this,nn,0),W(this,rn,!1),W(this,on,!1),W(this,sn,void 0),W(this,an,0)}get name(){return"WebAudioDecoder"}setSegment(t){U(sn,this,t)}setTimeOffsetSeconds(t){const e=Number(t);U(an,this,Number.isFinite(e)?e:0)}decode(t){if(this.lastSegment=t,!t)return;if(t.isInit)return void U(tn,this,tI(t.arrayBuffer));const e=t.arrayBuffer;e&&L(ln,this,oI).call(this,tI(e),!0)}decodeChunk(t,e={}){if(!t)return;if(e.isInit)return void U(tn,this,tI(t));const n=tI(t);if(!n.length)return;z(en,this).push(n),U(nn,this,z(nn,this)+n.length);const i=Number(e.loaded),r=Number(e.total);Number.isFinite(i)&&Number.isFinite(r)&&r>0&&i>=r&&L(ln,this,iI).call(this)}endOfStream(){L(ln,this,iI).call(this)}onDispose(){super.onDispose(),U(tn,this,void 0),U(en,this,[]),U(nn,this,0),U(rn,this,!1),U(on,this,!1),U(sn,this,void 0)}}),image:class extends Ow{#z;#W=0;#U=[];#j=0;#$;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.#U=[new Uint8Array(e)],this.#j=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.#U.push(n),this.#j+=n.length)}async endOfStream(){var t,e,n;if(this.#$)return;if(!(this.#U.length&&this.#j>0))return;const i=new Uint8Array(this.#j);let r=0;for(let t=0;t<this.#U.length;t+=1){const e=this.#U[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 cd.Blob)return;const n="string"==typeof e?e:"";return new cd.Blob([t],n?{type:n}:void 0)}(t,e);if(!n)throw new Error("Image decode requires Blob support");let i;if("function"==typeof cd.Image&&cd.URL&&"function"==typeof cd.URL.createObjectURL&&"function"==typeof cd.URL.revokeObjectURL){const t=cd.URL.createObjectURL(n);try{const e=new cd.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{cd.URL.revokeObjectURL(t)}}if("function"==typeof cd.createImageBitmap)try{return cd.createImageBitmap(n)}catch(t){i=t}if(i)throw i;throw new Error("No supported image decode mechanism")}(i,s);this.#$=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&&(Rg(o.width)||(o.width=e.width),Rg(o.height)||(o.height=e.height)),this.trigger("decoder:frame",{pts:this.#W,duration:Rg(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.#$&&"function"==typeof this.#$.close)try{this.#$.close()}catch(t){}this.#$=null,this.#U=[],this.#j=0,this.#z=null}}};function iI(){if(z(rn,this)||z(on,this))return;if(!z(nn,this))return;const t=L(ln,this,rI).call(this);t.length&&L(ln,this,oI).call(this,t,!1)}function rI(){const t=z(tn,this),e=t?t.length:0,n=e+z(nn,this);if(!n)return ZT;const i=new Uint8Array(n);let r=0;e&&(i.set(t,r),r+=e);for(let t=0;t<z(en,this).length;t+=1){const e=z(en,this)[t];e&&e.length&&(i.set(e,r),r+=e.length)}return i}function oI(t,e){if(z(rn,this)||z(on,this))return;const n=e?L(ln,this,sI).call(this,t):t;if(!n||!n.length)return;const i=function(){if(eI)return eI;const t=cd.AudioContext||cd.webkitAudioContext;return t?(eI=new t,eI):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);U(on,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;U(rn,this,!0);const n=Number.isFinite(null==t?void 0:t.duration)?t.duration:Number(null===(e=z(sn,this))||void 0===e?void 0:e.duration)||void 0;this.trigger("decoder:audio",{audioBuffer:t,pts:z(an,this),duration:n})})).catch((t=>{this.trigger("decoder:error",{error:t})})).finally((()=>{U(en,this,[]),U(nn,this,0),U(on,this,!1)}))}function sI(t){const e=z(tn,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 aI(t,e){var n,i,r,o,s;const a=null!=t&&t.context&&"object"==typeof t.context?t.context:void 0;return{error:e,errorName:null==e?void 0:e.name,errorMessage:"string"==typeof(null==e?void 0:e.message)?e.message:void 0,nodeId:z(qe,this),trackId:null===(n=this.track)||void 0===n?void 0:n.id,trackType:null===(i=this.track)||void 0===i?void 0:i.type,codec:(null===(r=z(Be,this))||void 0===r?void 0:r.codec)||z(Re,this),segmentId:null===(o=this.lastSegment)||void 0===o?void 0:o.id,segmentIsInit:!(null===(s=this.lastSegment)||void 0===s||!s.isInit),chunkContext:a}}function lI(t){const e=(null==t?void 0:t.error)||t,n=L(Ze,this,aI).call(this,t,e);if(L(Ze,this,cI).call(this,t,e))return this.log.warn("[onDemuxError] recoverable demux error",n),void L(Ze,this,xI).call(this);const i=L(Ze,this,yI).call(this,t),r=L(Ze,this,uI).call(this,i);if(i&&0===i.missingFrames)return this.log.warn(`[onDemuxError] ignoring demux error (no missing frames)${r}`,{...n,missingFrameStats:i}),void L(Ze,this,xI).call(this);let o=n;i&&(o={...n,missingFrameStats:i}),this.log.warn(`[onDemuxError] demux error${r}`,o),this.trigger("decoder:error",t)}function cI(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 uI(t){return t?` expectedFrames=${L(Ze,this,dI).call(this,t.expectedFrames)} demuxedFrames=${L(Ze,this,dI).call(this,t.demuxedFrames)} missingFrames=${L(Ze,this,dI).call(this,t.missingFrames)}`:""}function dI(t){if(null==t)return"unknown";const e=Number(t);return Number.isFinite(e)?String(e):"unknown"}function hI(t,e={}){return{expectedFrames:null,demuxedFrames:z(Ve,this),missingFrames:null,reason:t,...e}}function fI(t){const e=Number(t);return Number.isFinite(e)?e:null}function pI(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 L(Ze,this,hI).call(this,"segment_duration_unavailable",{segmentDurationSeconds:L(Ze,this,fI).call(this,s),demuxedCoverageSeconds:z(Ke,this),frameDurationSeconds:null});const a=L(Ze,this,gI).call(this);if(!Number.isFinite(a)||a<=0){const t=Math.max(1,Math.round(s*JT));return{expectedFrames:t,demuxedFrames:z(Ve,this),missingFrames:Math.max(0,t-z(Ve,this)),reason:"fallback_fps",fallbackFps:JT,segmentDurationSeconds:s,demuxedCoverageSeconds:z(Ke,this),frameDurationSeconds:L(Ze,this,fI).call(this,a)}}const l=Math.min(.5*a,.02),c=Math.max(0,s-z(Ke,this)),u=c<=l?0:c,d=Math.max(1,Math.floor((s+l)/a)),h=Math.max(0,d-z(Ve,this)),f=u>0?Math.ceil(u/a):0;return{expectedFrames:d,demuxedFrames:z(Ve,this),missingFrames:Math.max(h,f),segmentDurationSeconds:s,demuxedCoverageSeconds:z(Ke,this),frameDurationSeconds:a}}function mI(){U(Ve,this,0),U(Ge,this,0),U(He,this,0),U(Ke,this,0)}function vI(t){U(Ve,this,z(Ve,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&&(U(Ge,this,z(Ge,this)+n),U(He,this,z(He,this)+1)),!Number.isFinite(e))return;const i=Number.isFinite(n)&&n>0?e+n:e;Number.isFinite(i)&&i>z(Ke,this)&&U(Ke,this,i)}function gI(){return z(He,this)>0?z(Ge,this)/z(He,this):z(Ve,this)>0&&z(Ke,this)>0?z(Ke,this)/z(Ve,this):null}function yI(t){return L(Ze,this,pI).call(this,t)}function bI(t){(null==t?void 0:t.data)instanceof Uint8Array&&(U(Le,this,t.data.buffer),L(Ze,this,CI).call(this)),null!=t&&t.decoderConfig&&(U(ze,this,t.decoderConfig),U(Re,this,t.decoderConfig.codec||z(Re,this)),L(Ze,this,CI).call(this)),this.trigger("decoder:init",t)}function kI(t){L(Ze,this,vI).call(this,t),z(Ie,this).push(t),L(Ze,this,NI).call(this)}function xI(){U(Ne,this,!0),L(Ze,this,DI).call(this)}function wI(t){const e="number"==typeof(null==t?void 0:t.pts)?t.pts:void 0;if(Number.isFinite(e))return z(We,this)+e}function _I(t){return z(Ie,this).some((e=>{const n=L(Ze,this,wI).call(this,e);return Number.isFinite(n)&&n>=t}))}function TI(t){let e=-1,n=null;for(let i=0;i<z(Ie,this).length;i+=1){const r=z(Ie,this)[i],o=L(Ze,this,wI).call(this,r);Number.isFinite(o)&&(null==r?void 0:r.isKey)&&o<=t&&(e=i,n=o)}return{chosenIndex:e,chosenPtsSeconds:n}}function II(t){let e=-1,n=null;for(let i=0;i<z(Ie,this).length;i+=1){const r=z(Ie,this)[i],o=L(Ze,this,wI).call(this,r);if(Number.isFinite(o)&&null!=r&&r.isKey&&(e=i,n=o,o>=t))break}return{chosenIndex:e,chosenPtsSeconds:n}}function EI(t){const e=t+z(xe,this),n=z(Ue,this);if(!Number.isFinite(n))return e;const i=Number.isFinite(z($e,this))?z($e,this):null;if(Number.isFinite(i))return Math.max(e,i);const{chosenPtsSeconds:r}=L(Ze,this,II).call(this,n);return Number.isFinite(r)?Math.max(e,r):e}function SI(t){const e=z(Ue,this);Number.isFinite(e)&&Number.isFinite(t)&&t>=e&&(U(Ue,this,null),U($e,this,null))}function AI(){const t=z(Ue,this);if(!Number.isFinite(t)||z(je,this))return!0;if(!L(Ze,this,_I).call(this,t)&&!z(Ne,this))return!1;const e=L(Ze,this,TI).call(this,t);let n=e;if(-1===e.chosenIndex&&(n=L(Ze,this,II).call(this,t)),n.chosenIndex>0){const t=`[#maybeAlignToSeekKeyframe] Dropping ${n.chosenIndex} samples before keyframe @ ${n.chosenPtsSeconds}`;this.log.debug(t),z(Ie,this).splice(0,n.chosenIndex)}return U(Ae,this,!0),Number.isFinite(n.chosenPtsSeconds)&&U($e,this,n.chosenPtsSeconds),U(je,this,!0),!0}function NI(){const t=z(Te,this)?z(Te,this).call(this):0,e=L(Ze,this,EI).call(this,t);if(L(Ze,this,qI).call(this,t),L(Ze,this,VI).call(this),!L(Ze,this,AI).call(this))return void L(Ze,this,FI).call(this);const n=void 0!==cd.VideoDecoder&&void 0!==cd.EncodedVideoChunk;for(n&&!z(Pe,this)&&z(ze,this)&&L(Ze,this,CI).call(this);z(Ie,this).length&&!L(Ze,this,HI).call(this)&&!(n&&z(Oe,this)&&L(Ze,this,XI).call(this));){const t=z(Ie,this)[0],i="number"==typeof(null==t?void 0:t.pts)?t.pts:0,r=z(We,this)+i;if(r>e)break;if(null!=t&&t.raw)z(Ie,this).shift(),L(Ze,this,MI).call(this,t);else{if(n){if(!z(Pe,this)||!z(Oe,this))break;if(z(Ae,this)&&!t.isKey){z(Ie,this).shift();continue}z(Ie,this).shift();const e=Math.max(0,Math.round(r*QT));z(Se,this).set(e,!!t.isKey);try{const n=new cd.EncodedVideoChunk({type:t.isKey?"key":"delta",timestamp:e,duration:t.duration?Math.round(t.duration*QT):void 0,data:t.data instanceof Uint8Array?t.data:new Uint8Array(t.data)});z(Oe,this).decode(n),t.isKey&&U(Ae,this,!1);continue}catch(t){z(Se,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")){U(Ae,this,!0);continue}this.log.warn("[#drainDecodeQueue] decode failed, falling back to placeholder",t)}}z(Ie,this).shift(),L(Ze,this,MI).call(this,t)}}L(Ze,this,DI).call(this),L(Ze,this,FI).call(this)}function MI(t){const e=z(Te,this)?z(Te,this).call(this):0,n=L(Ze,this,EI).call(this,e),i=z(We,this)+("number"==typeof t.pts?t.pts:0);if(i<e||i>n)return;L(Ze,this,qI).call(this,e);const r={pts:i,duration:t.duration,data:t.data,isKey:t.isKey};z(ke,this).push(r),L(Ze,this,VI).call(this),this.trigger("decoder:frame",r),L(Ze,this,SI).call(this,i)}function FI(){if(z(Ie,this).length>0&&void 0!==cd.VideoDecoder){if(Hk(z(Ee,this)))return;Vk(z(Ee,this),50)}else L(Ze,this,OI).call(this)}function OI(){z(Ee,this)&&Hk(z(Ee,this))&&Gk(z(Ee,this))}function PI(){return null!=cd&&cd.performance&&"function"==typeof cd.performance.now?cd.performance.now():Date.now()}function CI(){if(z(Pe,this))return;if(void 0===cd.VideoDecoder)return;if(!z(ze,this))return;if(z(Ce,this)&&L(Ze,this,PI).call(this)<z(De,this))return;const t={...z(ze,this)};!t.codec&&z(Re,this)&&(t.codec=z(Re,this)),z(Le,this)&&!t.description&&(t.description=z(Le,this)),z(Be,this).width&&!t.codedWidth&&(t.codedWidth=z(Be,this).width),z(Be,this).height&&!t.codedHeight&&(t.codedHeight=z(Be,this).height);try{U(Oe,this,new cd.VideoDecoder({output:t=>L(Ze,this,LI).call(this,t),error:t=>L(Ze,this,RI).call(this,t)})),z(Oe,this).configure(t),U(Pe,this,!0),U(Ae,this,!0),U(Ce,this,!1),U(De,this,0),L(Ze,this,NI).call(this)}catch(t){this.log.warn("[#maybeConfigureDecoder] configure failed, falling back to placeholder decode",t),U(Oe,this,null),U(Pe,this,!1),U(ze,this,null)}}function DI(){void 0!==cd.VideoDecoder&&void 0!==cd.EncodedVideoChunk&&(z(Ce,this)||!z(Ne,this)||z(Fe,this)||z(Me,this)||z(Pe,this)&&z(Oe,this)&&"function"==typeof z(Oe,this).flush&&(z(Ie,this).length||(U(Me,this,!0),Promise.resolve().then((()=>z(Oe,this).flush())).then((()=>{U(Fe,this,!0),U(Ae,this,!0)})).catch((t=>{"AbortError"!==(null==t?void 0:t.name)&&this.log.warn("[#maybeFlushDecoder] flush failed",t)})).finally((()=>{U(Me,this,!1)})))))}function RI(t){if(this.log.warn("[#handleDecoderError] decoder error",t),this.trigger("decoder:error",{error:t}),z(Oe,this)&&"function"==typeof z(Oe,this).close)try{z(Oe,this).close()}catch(t){}U(Oe,this,null),U(Pe,this,!1),U(Me,this,!1),U(Fe,this,!1),U(Ae,this,!0),z(Se,this).clear(),U(Ce,this,!0),U(De,this,L(Ze,this,PI).call(this)+1e3)}function LI(t){U(Je,this,z(Je,this).then((()=>{var e;if(!this._disposed)return L(Ze,this,$I).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 BI(t){return"boolean"!=typeof t||t}function zI(t){const e=Number(t);return!Number.isFinite(e)||e<0?.2:e}function WI(){return!!z(Ye,this)&&"function"==typeof cd.createImageBitmap&&z(Xe,this)}function UI(t){var e;const n=Number(null===(e=this.lastSegment)||void 0===e?void 0:e.duration);if(!Number.isFinite(n)||n<=0)return!1;if(!Number.isFinite(t))return!1;const i=Number(z(We,this));return!!Number.isFinite(i)&&t>=i+n-z(Qe,this)}async function jI(t,e){try{var n;const i=L(Ze,this,UI).call(this,e),r=await cd.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 $I(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/QT:z(Te,this)?z(Te,this).call(this):0,s="number"==typeof t.duration?t.duration/QT:void 0;let a;void 0!==r&&(a=z(Se,this).get(r),z(Se,this).delete(r));try{var l,c,u,d;let e=z(Te,this)?z(Te,this).call(this):0,n=L(Ze,this,EI).call(this,e);if(o<e||o>n)return void(null===(l=(c=i).close)||void 0===l||l.call(c));if(L(Ze,this,WI).call(this)){var h,f,p,m;if(i=await L(Ze,this,jI).call(this,t,o),this._disposed)return void(null===(h=(f=i).close)||void 0===h||h.call(f));if(e=z(Te,this)?z(Te,this).call(this):0,n=L(Ze,this,EI).call(this,e),o<e||o>n)return void(null===(p=(m=i).close)||void 0===p||p.call(m))}if(L(Ze,this,qI).call(this,e),this._disposed)return void(null===(u=(d=i).close)||void 0===u||u.call(d));const r={frame:i,pts:o,duration:s,isKey:void 0!==a&&a};z(ke,this).push(r),L(Ze,this,VI).call(this),this.trigger("decoder:frame",r),L(Ze,this,SI).call(this,o),this.log.debug(`[#handleDecodedFrame] [${z(Be,this).codec}] Decoded frame:`,r)}catch(t){this.log.warn(`[#handleDecodedFrame] [${z(Be,this).codec}] Failed to handle decoded frame`,t);try{var v,g;null===(v=(g=i).close)||void 0===v||v.call(g)}catch(t){}}}function qI(t){const e=L(Ze,this,EI).call(this,t),n=[];z(ke,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)})),U(ke,this,n)}function VI(){const t=z(we,this);if(!Number.isFinite(t)||t<=0)return;if(z(ke,this).length<=t)return;const e=z(ke,this).length-t;z(ke,this).splice(0,e)}function GI(t){const e=Number(t);return!Number.isFinite(e)||e<=0?0:Math.floor(e)}function HI(){const t=z(we,this);return!(!Number.isFinite(t)||t<=0)&&z(ke,this).length>=t}function KI(t){const e=Number(t);return!Number.isFinite(e)||e<=0?0:Math.floor(e)}function XI(){var t;const e=z(_e,this);if(!Number.isFinite(e)||e<=0)return!1;const n=Number(null===(t=z(Oe,this))||void 0===t?void 0:t.decodeQueueSize);return!!Number.isFinite(n)&&n>=e}function YI(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 QI extends sd{get name(){return"DecoderFactory"}create(t,e){if(!t||!t.type)return new Ow(e);const n=nI[t.type];return n?(this.log.debug(`[#create] [${t.type}] Creating decoder:`,n),new n(e)):new Ow(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 ZI{#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 tE=new Set(["video","audio","image"]);function eE(t){const e=Number(t);return Number.isFinite(e)?e:0}var 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 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 WeakSet;class wE extends sd{constructor(...t){super(...t),j(this,xE),W(this,nE,void 0),W(this,iE,void 0),W(this,rE,void 0),W(this,oE,void 0),W(this,sE,void 0),W(this,aE,void 0),W(this,lE,void 0),W(this,cE,void 0),W(this,uE,void 0),W(this,dE,void 0),W(this,hE,void 0),W(this,fE,new Map),W(this,pE,new Map),W(this,mE,new Map),W(this,vE,new Map),W(this,gE,new Set),W(this,yE,0),W(this,bE,!1),W(this,kE,null);const[e,n,i]=t;U(nE,this,e),U(iE,this,n),U(rE,this,i||new QI),U(oE,this,new ZI({getNode:t=>L(xE,this,HE).call(this,t),getPlacementState:t=>z(fE,this).get(t),getDecodeTracks:t=>L(xE,this,jE).call(this,t),getSegmentIdForTrackAtTime:(t,e,n)=>L(xE,this,ME).call(this,t,e,n),decodeLoadedMediaSegment:(t,e,n)=>{L(xE,this,fS).call(this,t,e,n)},decodeLoadedMediaSegmentsAfter:(t,e,n)=>{L(xE,this,oS).call(this,t,e,n)}})),U(sE,this,new JI({getActiveRenderPlacement:t=>{var e,n;return null===(e=z(iE,this))||void 0===e||null===(n=e.getActiveRenderPlacement)||void 0===n?void 0:n.call(e,t)},getPlacementsActiveAtTime:t=>{var e,n;return(null===(e=z(iE,this))||void 0===e||null===(n=e.getPlacementsActiveAtTime)||void 0===n?void 0:n.call(e,t))||[]},ensureDecodedForPlacementAtTime:(t,e)=>{var n,i;null===(n=z(oE,this))||void 0===n||null===(i=n.ensureDecodedForPlacementAtTime)||void 0===i||i.call(n,t,e)}})),L(xE,this,_E).call(this),L(xE,this,zE).call(this)}get name(){return"DecodeCoordinator"}onDispose(){var t,e;z(iE,this)&&"function"==typeof z(iE,this).off&&z(aE,this)&&z(iE,this).off(sv.PLACEMENT_ADDED,z(aE,this)),z(iE,this)&&"function"==typeof z(iE,this).off&&z(lE,this)&&z(iE,this).off(sv.TIMELINE_SEEKING,z(lE,this)),z(iE,this)&&"function"==typeof z(iE,this).off&&z(cE,this)&&z(iE,this).off(sv.TIMELINE_SEEKED,z(cE,this)),z(iE,this)&&"function"==typeof z(iE,this).off&&z(uE,this)&&z(iE,this).off(sv.TIMELINE_TIME_UPDATE,z(uE,this)),z(iE,this)&&"function"==typeof z(iE,this).off&&z(dE,this)&&z(iE,this).off(sv.TIMELINE_RESET,z(dE,this)),L(xE,this,TE).call(this),U(aE,this,null),U(lE,this,null),U(cE,this,null),U(uE,this,null),U(dE,this,null),null!==(t=z(oE,this))&&void 0!==t&&null!==(e=t.dispose)&&void 0!==e&&e.call(t),U(oE,this,null),z(sE,this)&&"function"==typeof z(sE,this).dispose&&z(sE,this).dispose(),U(sE,this,null),z(pE,this).forEach(((t,e)=>{const n=L(xE,this,HE).call(this,e);n&&"function"==typeof n.off&&n.off("node:loaded",t)})),z(pE,this).clear(),z(mE,this).forEach(((t,e)=>{const n=L(xE,this,HE).call(this,e);n&&"function"==typeof n.off&&n.off("segment:chunk",t)})),z(mE,this).clear(),z(vE,this).clear(),z(gE,this).clear(),L(xE,this,DE).call(this),z(fE,this).forEach((({trackStates:t})=>{t&&t.forEach((t=>{L(xE,this,QE).call(this,t)}))})),z(fE,this).clear()}}function _E(){z(iE,this)&&"function"==typeof z(iE,this).on&&(U(aE,this,(t=>{L(xE,this,WE).call(this,t)})),z(iE,this).on(sv.PLACEMENT_ADDED,z(aE,this)),U(lE,this,(t=>L(xE,this,IE).call(this,t))),z(iE,this).on(sv.TIMELINE_SEEKING,z(lE,this)),U(cE,this,(()=>L(xE,this,EE).call(this))),z(iE,this).on(sv.TIMELINE_SEEKED,z(cE,this)),U(uE,this,(t=>L(xE,this,SE).call(this,t))),z(iE,this).on(sv.TIMELINE_TIME_UPDATE,z(uE,this)),U(dE,this,(()=>L(xE,this,AE).call(this))),z(iE,this).on(sv.TIMELINE_RESET,z(dE,this))),(null==cd?void 0:cd.document)&&"function"==typeof cd.document.addEventListener&&(U(hE,this,(()=>{L(xE,this,RE).call(this)})),cd.document.addEventListener("visibilitychange",z(hE,this)))}function TE(){z(hE,this)&&null!=cd&&cd.document&&"function"==typeof cd.document.removeEventListener&&cd.document.removeEventListener("visibilitychange",z(hE,this)),U(hE,this,null)}function IE(t={}){const e=Number(null==t?void 0:t.targetTime);Number.isFinite(e)&&(z(fE,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||(L(xE,this,NE).call(this,n,null==t?void 0:t.placement,e),n.seekSegmentId=null)}))})),(Array.isArray(null==t?void 0:t.placements)?t.placements:[]).forEach((t=>{const n=null==t?void 0:t.placementId,i=null==t?void 0:t.nodeId;if(!n||!i)return;const r=z(fE,this).get(n);if(!r||!r.trackStates)return;const o=L(xE,this,HE).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||L(xE,this,NE).call(this,n,r.placement||t,e)})),L(xE,this,rS).call(this,r.placement||t,o))})))}function EE(){z(fE,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 SE(t={}){var e,n;L(xE,this,iS).call(this,null==t?void 0:t.time),null!==(e=z(sE,this))&&void 0!==e&&null!==(n=e.handleTimeUpdate)&&void 0!==n&&n.call(e,t),L(xE,this,RE).call(this),L(xE,this,JE).call(this,null==t?void 0:t.time)}function AE(){z(pE,this).forEach(((t,e)=>{const n=L(xE,this,HE).call(this,e);n&&"function"==typeof n.off&&n.off("node:loaded",t)})),z(pE,this).clear(),z(mE,this).forEach(((t,e)=>{const n=L(xE,this,HE).call(this,e);n&&"function"==typeof n.off&&n.off("segment:chunk",t)})),z(mE,this).clear(),z(vE,this).clear(),z(gE,this).clear(),z(fE,this).forEach((({trackStates:t})=>{t&&t.forEach((t=>{const e=null==t?void 0:t.segmentDecoders;e&&e.forEach((t=>{t&&"function"==typeof t.dispose&&t.dispose()}))}))})),z(fE,this).clear()}function NE(t,e,n){t&&(L(xE,this,QE).call(this,t),t.seekSegmentId=L(xE,this,ME).call(this,t.track,e,n))}function ME(t,e,n){if(!t||!e||!Array.isArray(t.segments))return null;const i=cm(e);if(!Number.isFinite(i))return null;const r=eE(null==e?void 0:e.nodeOffsetOverride),o=Math.max(0,n-i+r),s=eE(null==t?void 0:t.offset),a=Math.max(0,o-s),l="function"==typeof t.getMediaSegmentAtTime?t.getMediaSegmentAtTime(a,{preferRepresentationTime:!0}):Gy(t.segments,a,{preferRepresentationTime:!0});return(null==l?void 0:l.id)||null}function FE(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 OE(){const t=null==cd?void 0:cd.document;return!t||"string"!=typeof t.visibilityState||"visible"===t.visibilityState}function PE(){var t;const e=z(iE,this);if(!e||"number"!=typeof e.currentTime)return!1;if(e.state===mv)return!1;const n=Date.now();if(n<z(yE,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=L(xE,this,CE).call(this,i),!Number.isFinite(a))return!1;return U(yE,this,n+1500),this.log.warn("[DecodeCoordinator] attempting decoder recovery seek"),e.currentTime=a,!0}function CE(t){var e;const n=z(iE,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=cm(t);if(!Number.isFinite(e))return;(!Number.isFinite(d)||e<d)&&(d=e);const n=am(t,z(nE,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 DE(){U(bE,this,!1),U(kE,this,null)}function RE(){z(bE,this)&&L(xE,this,OE).call(this)&&L(xE,this,PE).call(this)}function LE(t){if(!L(xE,this,FE).call(this,t))return;const e=z(iE,this);e&&"number"==typeof e.currentTime&&(U(bE,this,!0),U(kE,this,t),L(xE,this,OE).call(this)&&L(xE,this,PE).call(this))}function BE(t){var e;return!!t&&(Array.isArray(null===(e=z(iE,this))||void 0===e?void 0:e.placements)?z(iE,this).placements:[]).includes(t)}function zE(t){var e;(Array.isArray(null===(e=z(iE,this))||void 0===e?void 0:e.placements)?[...z(iE,this).placements]:[]).filter((e=>"function"!=typeof t||t(e))).sort(((t,e)=>{const n=cm(t),i=cm(e);return(Number.isFinite(n)?n:Number.POSITIVE_INFINITY)-(Number.isFinite(i)?i:Number.POSITIVE_INFINITY)})).forEach((t=>{L(xE,this,WE).call(this,t)}))}async function WE(t){if(!t||!t.placementId||z(fE,this).has(t.placementId))return;if(!L(xE,this,BE).call(this,t))return;const e=t.nodeId;if(!e||!z(nE,this)||"function"!=typeof z(nE,this).get)return;const n=L(xE,this,HE).call(this,e);if(n){if(n.state&&"ready"!==n.state){if("function"==typeof n.resolve)try{await n.resolve()}catch(n){if(!L(xE,this,BE).call(this,t))return;return void this.log.warn(`[#processPlacement] Failed to resolve node ${e}`,n)}if(!L(xE,this,BE).call(this,t))return;if("ready"!==n.state)return}if(L(xE,this,nS).call(this,t))return L(xE,this,eS).call(this,t,n),void z(gE,this).add(t.placementId);L(xE,this,tS).call(this,t,n)}}function UE(t){return L(xE,this,jE).call(this,t).every((t=>L(xE,this,ZE).call(this,t)))}function jE(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).filter((t=>tE.has(null==t?void 0:t.type)))}function $E(t){if(!t||!t.id||"function"!=typeof t.on)return;if(z(pE,this).has(t.id))return;const e=()=>{L(xE,this,sS).call(this,t.id)};t.on("node:loaded",e),z(pE,this).set(t.id,e)}function qE(t){if(!t||!t.id||"function"!=typeof t.on)return;if(z(mE,this).has(t.id))return;const e=t=>L(xE,this,aS).call(this,t);t.on("segment:chunk",e),z(mE,this).set(t.id,e)}function VE(t,e){if(!t||!e)return;const n=z(vE,this).get(t)||new Set;n.add(e),z(vE,this).set(t,n)}function GE(t){return z(vE,this).get(t)||new Set}function HE(t){if(t&&z(nE,this)&&"function"==typeof z(nE,this).get)return z(nE,this).get(t)}function KE(t){if(!t)return;const e=t.fullBufferRetryTimer;null!=e&&("function"==typeof(null==cd?void 0:cd.clearTimeout)?cd.clearTimeout.bind(cd):clearTimeout)(e),t.fullBufferRetryTimer=null,t.fullBufferDecodeScheduled=!1,t.fullBufferRetryAttempts=0}function XE(t){const e=null==t?void 0:t.segmentStates;e&&"function"==typeof e.forEach&&e.forEach((t=>{L(xE,this,KE).call(this,t)}))}function YE(t,e,n,i){var r,o;if(!(t&&e&&n&&i))return!1;const s=z(fE,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 QE(t){if(!t)return;L(xE,this,XE).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=eE(t);if(!Number.isFinite(e))return;const n=e-2;Number.isFinite(n)&&z(fE,this).forEach((t=>{const e=null==t?void 0:t.placement;if(!e)return;const i=cm(e),r=am(e,z(nE,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||L(xE,this,QE).call(this,t)}))}))}function ZE(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 tS(t,e){if(this.log.debug(`[#startDecode] [${t.placementId}] [${e.id}] Starting decode`),L(xE,this,eS).call(this,t,e)){if(L(xE,this,VE).call(this,e.id,t.placementId),!L(xE,this,UE).call(this,e))return L(xE,this,$E).call(this,e),void L(xE,this,qE).call(this,e);L(xE,this,rS).call(this,t,e),L(xE,this,qE).call(this,e)}}function eS(t,e){if(!t||!t.placementId||!e)return;const n=z(fE,this).get(t.placementId);if(n)return n.placement=t,n;const i=L(xE,this,jE).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(sv.DECODE_ERROR,cv({placementId:t.placementId,nodeId:e.id,trackId:null==n?void 0:n.id,trackType:null==n?void 0:n.type,error:i}))}}));const o={trackStates:r,nodeId:e.id,placement:t};return z(fE,this).set(t.placementId,o),o}function nS(t){var e;const n=cm(t),i=eE(null===(e=z(iE,this))||void 0===e?void 0:e.currentTime);return!Number.isFinite(n)||!!Number.isFinite(i)&&n-i>2}function iS(t){if(!z(gE,this).size)return;const e=eE(t);if(!Number.isFinite(e))return;const n=[];z(gE,this).forEach((t=>{const i=z(fE,this).get(t),r=null==i?void 0:i.placement;if(!r)return void n.push(t);const o=cm(r);Number.isFinite(o)&&o-e<=2&&n.push(t)})),n.forEach((t=>{z(gE,this).delete(t);const e=z(fE,this).get(t),n=null==e?void 0:e.placement;if(!n)return;const i=L(xE,this,HE).call(this,n.nodeId);i&&L(xE,this,tS).call(this,n,i)}))}function rS(t,e){const n=z(fE,this).get(t.placementId);n&&L(xE,this,jE).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;L(xE,this,fS).call(this,t,i,n),r.seekSegmentId&&"video"===(null==i?void 0:i.type)&&L(xE,this,oS).call(this,t,i,n),r.ready=!0,this.trigger(sv.DECODE_READY,lv({placementId:t.placementId,nodeId:e.id,trackId:i.id,trackType:i.type}))}catch(n){this.trigger(sv.DECODE_ERROR,cv({placementId:t.placementId,nodeId:e.id,trackId:null==i?void 0:i.id,trackType:null==i?void 0:i.type,error:n}))}}))}function oS(t,e,n){var i;if(!(t&&e&&n&&Array.isArray(e.segments)))return;const r=null==t?void 0:t.placementId,o=r?z(fE,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(L(xE,this,fS).call(this,t,e,i),u+=1,u>=2)break}}function sS(t){const e=L(xE,this,HE).call(this,t);e&&L(xE,this,UE).call(this,e)&&L(xE,this,GE).call(this,t).forEach((t=>{const n=z(fE,this).get(t);L(xE,this,rS).call(this,(null==n?void 0:n.placement)||{placementId:t},e)}))}function aS(t){t&&t.nodeId&&t.trackId&&t.chunk&&L(xE,this,GE).call(this,t.nodeId).forEach((e=>L(xE,this,lS).call(this,e,t)))}function lS(t,e){const n=z(fE,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&&L(xE,this,fS).call(this,n.placement,s,a)&&(i.ready=!0,this.trigger(sv.DECODE_READY,lv({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType}))));if((null===(o=z(iE,this))||void 0===o?void 0:o.state)===mv&&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=L(xE,this,dS).call(this,n.placement,s,a);if(!u||"function"!=typeof u.decodeChunk)return;if(i.hasInit&&!c.initSent){const t=L(xE,this,hS).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;L(xE,this,cS).call(this,c,e)?d&&!c.ended&&L(xE,this,uS).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(sv.DECODE_READY,lv({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType})))}catch(n){this.trigger(sv.DECODE_ERROR,cv({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType,error:n}))}}function cS(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 uS(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==cd?void 0:cd.setTimeout)?cd.setTimeout.bind(cd):setTimeout;i.fullBufferDecodeScheduled=!0,i.fullBufferRetryAttempts=0;const l=()=>{if(!L(xE,this,YE).call(this,r,o,s,i)||i.ended)return void L(xE,this,KE).call(this,i);if(L(xE,this,fS).call(this,t,e,n))return void L(xE,this,KE).call(this,i);i.fullBufferRetryAttempts+=1;const c=i.fullBufferRetryAttempts<=8?0:50;i.fullBufferRetryTimer=a((()=>{l()}),c)};i.fullBufferRetryTimer=a((()=>{l()}),0)}function dS(t,e,n){var i,r;const o=null==t?void 0:t.placementId;if(!o||!e||!n)return;const s=z(fE,this).get(o),a=null==s||null===(i=s.trackStates)||void 0===i?void 0:i.get(e.id);if(!a)return;const l=a.segmentDecoders.get(n.id);if(l)return l;const c=z(rE,this).create(e);if(c&&"function"==typeof c.configure&&c.configure(e),c&&"function"==typeof c.setNodeId&&c.setNodeId(null==t?void 0:t.nodeId),c&&"function"==typeof c.setSegment&&c.setSegment(n),c&&"function"==typeof c.setCurrentTimeProvider&&c.setCurrentTimeProvider((()=>{var t;return"number"==typeof(null===(t=z(iE,this))||void 0===t?void 0:t.currentTime)?z(iE,this).currentTime:0})),c&&"function"==typeof c.setTimeOffsetSeconds){var u,d;const i=cm(t),r=eE(null==e?void 0:e.offset),o=eE(null!==(u=null==n||null===(d=n.chosenRepresentation)||void 0===d?void 0:d.segStart)&&void 0!==u?u:null==n?void 0:n.offset);Number.isFinite(i)&&c.setTimeOffsetSeconds(i+r+o)}return c&&"function"==typeof c.setSeekTargetTimeSeconds&&(null===(r=z(iE,this))||void 0===r?void 0:r.state)===mv&&"video"===(null==e?void 0:e.type)&&c.setSeekTargetTimeSeconds(z(iE,this).currentTime),c&&"function"==typeof c.on&&(c.on(sv.DECODER_FRAME,(i=>{i&&(!z(bE,this)||"video"!==(null==e?void 0:e.type)&&"image"!==(null==e?void 0:e.type)||(U(bE,this,!1),U(kE,this,null)),z(iE,this)&&"function"==typeof z(iE,this).notifyDecodedFrame&&(i.frame||i.data)&&z(iE,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(sv.DECODER_AUDIO,(i=>{i&&i.audioBuffer&&this.trigger(sv.DECODER_AUDIO,lv({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(sv.DECODER_ERROR,(i=>{const r=(null==i?void 0:i.error)||i;this.trigger(sv.DECODER_ERROR,cv({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})),L(xE,this,LE).call(this,r)}))),a.segmentDecoders.set(n.id,c),c}function hS(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 fS(t,e,n){var i;if(!t||!e||!n)return!1;const r=t.placementId,o=z(fE,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=L(xE,this,dS).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 L(xE,this,KE).call(this,l),!0;if(s.hasInit&&!l.initSent){const t=L(xE,this,hS).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()),L(xE,this,KE).call(this,l),0))}const pS=1e-6;var mS=new WeakMap,vS=new WeakMap,gS=new WeakMap,yS=new WeakMap,bS=new WeakMap,kS=new WeakMap,xS=new WeakMap,wS=new WeakMap,_S=new WeakSet;class TS extends sd{get name(){return"TransitionManager"}get defaults(){return{durationSeconds:.5}}constructor(t,e,n){super(n),j(this,_S),W(this,mS,void 0),W(this,vS,void 0),W(this,gS,null),W(this,yS,null),W(this,bS,null),W(this,kS,0),W(this,xS,[]),W(this,wS,null),U(mS,this,t),U(vS,this,e),z(mS,this)&&"function"==typeof z(mS,this).on&&(U(wS,this,(()=>L(_S,this,PS).call(this))),z(mS,this).on(sv.TIMELINE_RESET,z(wS,this)))}transitionTo(t,e={}){const n=Number(t);if(!Number.isFinite(n))throw new Error("TransitionManager.transitionTo requires a numeric time");L(_S,this,PS).call(this);const i=L(_S,this,IS).call(this),r=L(_S,this,NS).call(this,n,e);return r?L(_S,this,MS).call(this,n,e,i,r):Promise.resolve()}onDispose(){z(mS,this)&&"function"==typeof z(mS,this).off&&z(wS,this)&&z(mS,this).off(sv.TIMELINE_RESET,z(wS,this)),U(wS,this,null),L(_S,this,PS).call(this),U(vS,this,null),U(mS,this,null)}}function IS(){return U(kS,this,z(kS,this)+1),z(kS,this)}function ES(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 SS(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 AS(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 NS(t,e={}){var n;const i=z(vS,this),r=L(_S,this,ES).call(this,e);if(!i||"function"!=typeof i.startTransition)return z(mS,this).currentTime=t,null;if(!(r>0))return z(mS,this).currentTime=t,null!==(n=i.resetTransition)&&void 0!==n&&n.call(i),null;const o=L(_S,this,SS).call(this,e,r);"function"==typeof(null==e?void 0:e.onTransitionInStart)&&e.onTransitionInStart();const s=i.startTransition(o),{outDurationMs:a,inDurationMs:l}=L(_S,this,AS).call(this,r,s);return{renderer:i,transitionOptions:o,outDurationMs:a,inDurationMs:l,shouldWaitForFrames:!1!==(null==e?void 0:e.waitForVisualFrames)}}function MS(t,e={},n,i){const{renderer:r,transitionOptions:o,outDurationMs:s,inDurationMs:a,shouldWaitForFrames:l}=i,c=L(_S,this,BS).call(this,t,e,n),u=l?L(_S,this,zS).call(this,t,n):Promise.resolve();let d=!1,h=!1,f=!1,p=!l;const m=()=>{var t;L(_S,this,CS).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),U(yS,this,setTimeout((()=>{var t;L(_S,this,CS).call(this,n)&&(null!==(t=r.resetTransition)&&void 0!==t&&t.call(r),"function"==typeof(null==e?void 0:e.onTransitionOutEnd)&&e.onTransitionOutEnd(),L(_S,this,FS).call(this))}),a)))};return U(gS,this,setTimeout((()=>{d=!0,m()}),s)),c.then((()=>{h=!0,m()})).catch((()=>{var t;L(_S,this,CS).call(this,n)&&(null!==(t=r.resetTransition)&&void 0!==t&&t.call(r),L(_S,this,FS).call(this))})),u.then((()=>{p=!0,m()})).catch((()=>{p=!0,m()})),z(mS,this).currentTime=t,new Promise((t=>{U(bS,this,t)}))}function FS(){const t=z(bS,this);U(bS,this,null),L(_S,this,OS).call(this),L(_S,this,LS).call(this),t&&t()}function OS(){z(gS,this)&&clearTimeout(z(gS,this)),z(yS,this)&&clearTimeout(z(yS,this)),U(gS,this,null),U(yS,this,null)}function PS(){var t,e;z(vS,this)&&null!==(t=(e=z(vS,this)).resetTransition)&&void 0!==t&&t.call(e),L(_S,this,OS).call(this),L(_S,this,LS).call(this),z(bS,this)&&(z(bS,this).call(this),U(bS,this,null))}function CS(t){return z(kS,this)===t}function DS(t,e){z(mS,this)&&"function"==typeof z(mS,this).on&&(z(mS,this).on(t,e),z(xS,this).push({eventName:t,handler:e}))}function RS(t,e){z(mS,this)&&"function"==typeof z(mS,this).off&&(z(mS,this).off(t,e),U(xS,this,z(xS,this).filter((n=>n.eventName!==t||n.handler!==e))))}function LS(){z(mS,this)&&"function"==typeof z(mS,this).off?(z(xS,this).forEach((t=>{z(mS,this).off(t.eventName,t.handler)})),U(xS,this,[])):U(xS,this,[])}function BS(t,e,n){const i=null==e?void 0:e.transitionOutPromise;if(i&&"function"==typeof i.then)return i;if("function"==typeof i)try{const t=i();if(t&&"function"==typeof t.then)return t}catch(t){return Promise.resolve()}if(!z(mS,this)||"function"!=typeof z(mS,this).on)return Promise.resolve();const r=L(_S,this,WS).call(this);return new Promise((e=>{let i=!1;const o=r?sv.TIMELINE_SEEKED:"nodestart";let s,a;const l=()=>{L(_S,this,RS).call(this,sv.TIMELINE_SEEKING,s),L(_S,this,RS).call(this,o,a),e()};s=(e={})=>{L(_S,this,CS).call(this,n)?L(_S,this,US).call(this,e,t)&&(i=!0):l()},a=(e={})=>{L(_S,this,CS).call(this,n)?(o!==sv.TIMELINE_SEEKED||L(_S,this,US).call(this,e,t))&&(o===sv.TIMELINE_SEEKED||i)&&l():l()},L(_S,this,DS).call(this,sv.TIMELINE_SEEKING,s),L(_S,this,DS).call(this,o,a)}))}function zS(t,e){if(!z(mS,this)||"function"!=typeof z(mS,this).on)return Promise.resolve();const n=Number(t);return new Promise((t=>{const i=(r={})=>{if(!L(_S,this,CS).call(this,e))return L(_S,this,RS).call(this,sv.VISUAL_FRAMES_AVAILABLE,i),void t();const o=Number(null==r?void 0:r.time);Number.isFinite(n)&&Number.isFinite(o)&&o+pS<n||(Array.isArray(null==r?void 0:r.frames)?r.frames:[]).length&&(L(_S,this,RS).call(this,sv.VISUAL_FRAMES_AVAILABLE,i),t())};L(_S,this,DS).call(this,sv.VISUAL_FRAMES_AVAILABLE,i)}))}function WS(){var t,e;const n=null===(t=z(mS,this))||void 0===t?void 0:t.state;if(n===pv||n===uv)return!0;const i=null===(e=z(mS,this))||void 0===e?void 0:e.placements;return!Array.isArray(i)||0===i.length}function US(t,e){const n=Number(null==t?void 0:t.targetTime);return!Number.isFinite(n)||Math.abs(n-e)<pS}function jS(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}var $S=new WeakMap,qS=new WeakMap,VS=new WeakMap,GS=new WeakMap,HS=new WeakMap,KS=new WeakMap,XS=new WeakMap,YS=new WeakMap,QS=new WeakMap,JS=new WeakMap,ZS=new WeakMap,tA=new WeakMap,eA=new WeakMap,nA=new WeakMap,iA=new WeakSet;class rA extends sd{get name(){return"AudioPlaybackManager"}get defaults(){return{muted:!1,volume:1,lookaheadSeconds:1}}constructor(t,e,n){super(n),j(this,iA),W(this,$S,void 0),W(this,qS,void 0),W(this,VS,null),W(this,GS,null),W(this,HS,[]),W(this,KS,new Set),W(this,XS,new Map),W(this,YS,!1),W(this,QS,1),W(this,JS,!0),W(this,ZS,null),W(this,tA,null),W(this,eA,null),W(this,nA,null),U($S,this,t),U(qS,this,e),U(YS,this,!!this.settings.muted),U(QS,this,om(this.settings.volume));const i=Array.isArray(null==n?void 0:n.disabledTracks)?n.disabledTracks:[];U(JS,this,!i.includes("audio")),L(iA,this,oA).call(this)}get muted(){return z(YS,this)}set muted(t){U(YS,this,!!t),L(iA,this,vA).call(this)}get volume(){return z(QS,this)}set volume(t){U(QS,this,om(t)),L(iA,this,vA).call(this)}handleDecodedAudio(t={}){if(!z(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=jS(null==t?void 0:t.pts,null);if(!(e&&n&&i&&Number.isFinite(r)))return;const o=Number.isFinite(null==t?void 0:t.duration)?t.duration:e.duration,s=`${n}:${i}`;z(KS,this).has(s)||(z(HS,this).push({key:s,placementId:n,pts:r,duration:o,audioBuffer:e}),z(HS,this).sort(((t,e)=>t.pts-e.pts)),L(iA,this,uA).call(this))}onDispose(){L(iA,this,sA).call(this),L(iA,this,pA).call(this,!0),z(VS,this)&&"function"==typeof z(VS,this).close&&z(VS,this).close(),U(VS,this,null),U(GS,this,null),U($S,this,null),U(qS,this,null)}}function oA(){z($S,this)&&"function"==typeof z($S,this).on&&(U(ZS,this,(t=>L(iA,this,aA).call(this,t))),z($S,this).on(sv.TIMELINE_TIME_UPDATE,z(ZS,this)),U(tA,this,(t=>L(iA,this,lA).call(this,t))),z($S,this).on(sv.TIMELINE_STATE_CHANGE,z(tA,this)),U(nA,this,(()=>L(iA,this,cA).call(this))),z($S,this).on(sv.TIMELINE_RESET,z(nA,this))),z(qS,this)&&"function"==typeof z(qS,this).on&&(U(eA,this,(t=>this.handleDecodedAudio(t))),z(qS,this).on(sv.DECODER_AUDIO,z(eA,this)))}function sA(){z($S,this)&&"function"==typeof z($S,this).off&&(z(ZS,this)&&z($S,this).off(sv.TIMELINE_TIME_UPDATE,z(ZS,this)),z(tA,this)&&z($S,this).off(sv.TIMELINE_STATE_CHANGE,z(tA,this)),z(nA,this)&&z($S,this).off(sv.TIMELINE_RESET,z(nA,this))),z(qS,this)&&"function"==typeof z(qS,this).off&&z(eA,this)&&z(qS,this).off(sv.DECODER_AUDIO,z(eA,this)),U(ZS,this,null),U(tA,this,null),U(eA,this,null),U(nA,this,null)}function aA(){L(iA,this,uA).call(this)}function lA(t={}){const e=null==t?void 0:t.to;if(e)return e===dv?(L(iA,this,gA).call(this),void L(iA,this,uA).call(this)):void(e!==pv&&e!==fv?e!==mv&&e!==vv||L(iA,this,cA).call(this):L(iA,this,yA).call(this))}function cA(){L(iA,this,yA).call(this),L(iA,this,pA).call(this,!0),U(HS,this,[])}function uA(){if(!z(JS,this)||!z($S,this))return;if(z($S,this).state!==dv)return;const t=L(iA,this,mA).call(this);if(!t)return;const e=jS(z($S,this).currentTime,0),n=e+Math.max(0,jS(this.settings.lookaheadSeconds,1)),i=[];for(let r=0;r<z(HS,this).length;r+=1){const o=z(HS,this)[r];o&&(o.pts>n?i.push(o):L(iA,this,dA).call(this,o)&&L(iA,this,fA).call(this,o,t,e))}U(HS,this,i)}function dA(t){if(!t||!z($S,this))return!1;const e=L(iA,this,hA).call(this,t.pts);return!(!e||e!==t.placementId)}function hA(t){if(!z($S,this)||"function"!=typeof z($S,this).getPlacementsActiveAtTime)return null;const e=z($S,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 fA(t,e,n){const i=t.key;if(z(KS,this).has(i))return;const r=t.audioBuffer;if(!r)return;const o=Number.isFinite(t.duration)?t.duration:r.duration,s=t.pts;if(!Number.isFinite(s))return;const a=n-s;if(Number.isFinite(o)&&o>0&&a>=o)return;const l=e.createBufferSource();l.buffer=r,l.connect(z(GS,this));let c=e.currentTime,u=0;a>0?u=a:a<0&&(c=e.currentTime+Math.abs(a));try{l.start(c,u)}catch(t){return void this.log.warn("[AudioPlaybackManager] Failed to start audio buffer",t)}z(KS,this).add(i),z(XS,this).set(i,l),l.onended=()=>{z(XS,this).delete(i)}}function pA(t){z(XS,this).forEach(((t,e)=>{if(t&&"function"==typeof t.stop)try{t.stop()}catch(t){}z(XS,this).delete(e)})),t&&z(KS,this).clear()}function mA(){if(z(VS,this))return z(VS,this);const t=cd.AudioContext||cd.webkitAudioContext;if(!t)return this.log.warn("[AudioPlaybackManager] AudioContext is not available."),null;try{return U(VS,this,new t),U(GS,this,z(VS,this).createGain()),z(GS,this).connect(z(VS,this).destination),L(iA,this,vA).call(this),z(VS,this)}catch(t){return this.log.warn("[AudioPlaybackManager] Failed to initialize AudioContext",t),U(VS,this,null),U(GS,this,null),null}}function vA(){if(!z(GS,this))return;const t=z(YS,this)?0:z(QS,this);z(GS,this).gain.value=t}function gA(){z(VS,this)&&"function"==typeof z(VS,this).resume&&"suspended"===z(VS,this).state&&z(VS,this).resume().catch((()=>{}))}function yA(){z(VS,this)&&"function"==typeof z(VS,this).suspend&&"running"===z(VS,this).state&&z(VS,this).suspend().catch((()=>{}))}var bA=new WeakMap,kA=new WeakMap,xA=new WeakMap,wA=new WeakMap,_A=new WeakMap,TA=new WeakSet;class IA extends sd{constructor(...t){super(...t),j(this,TA),W(this,bA,void 0),W(this,kA,void 0),W(this,xA,void 0),W(this,wA,void 0),W(this,_A,void 0),U(bA,this,L(TA,this,SA).call(this,this.settings.currentTime)),U(kA,this,L(TA,this,AA).call(this,this.settings.playbackRate)),U(xA,this,null),U(wA,this,!1),U(_A,this,L(TA,this,EA).bind(this))}get name(){return"PlaybackClock"}get defaults(){return{currentTime:0,playbackRate:Iy("playbackRate")}}get currentTime(){return z(bA,this)}get playbackRate(){return z(kA,this)}set playbackRate(t){U(kA,this,L(TA,this,AA).call(this,t))}play(){z(wA,this)||(U(wA,this,!0),U(xA,this,ly()),Vk(z(_A,this),0))}pause(){z(wA,this)&&(U(wA,this,!1),Gk(z(_A,this)))}seek(t){U(bA,this,L(TA,this,SA).call(this,t)),U(xA,this,ly())}reset(){this.pause(),U(bA,this,0),U(xA,this,null)}onDispose(){this.pause(),U(_A,this,null)}}function EA(){const t=ly();if(null===z(xA,this))return U(xA,this,t),void this.trigger(sv.CLOCK_TICK,{currentTime:z(bA,this)});const e=t-z(xA,this);U(xA,this,t);const n=e/1e3;U(bA,this,z(bA,this)+n*z(kA,this)),this.trigger(sv.CLOCK_TICK,{currentTime:z(bA,this)})}function SA(t){return"number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t)||t<0?0:t}function AA(t){return"number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t)||t<=0?z(kA,this)||1:t}var NA=new WeakMap,MA=new WeakSet;class FA extends sd{constructor(...t){super(...t),j(this,MA),W(this,NA,new Map)}get name(){return"TrackBuffers"}get defaults(){return{}}refreshNode(t){if(!t||!Array.isArray(t.tracks))return;const e=t.id,n=z(NA,this).get(e)||new Map;z(NA,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(sv.TRACK_BUFFER_UPDATE,{nodeId:e,trackType:i,range:r})),!s&&a?this.trigger(sv.TRACK_READY,{nodeId:e,trackType:i,range:r}):s&&!a&&this.trigger(sv.TRACK_UNDERFLOW,{nodeId:e,trackType:i,range:r})}))}getTrackRange(t,e){const n=z(NA,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=L(MA,this,PA).call(this,n,t[e],i);if(!a||a.end<=i)continue;if(void 0===r){r=a.start,o=a.end,s=a.full;continue}const l=a.start<=o,c=s&&a.full;if(!l&&!c)break;o=Math.max(o,a.end),s=a.full}return void 0===r||void 0===o?{start:0,end:0}:{start:r,end:o}}get buffered(){return z(NA,this)}reset(){z(NA,this).clear()}onDispose(){z(NA,this).clear(),"function"==typeof this.off&&this.off()}}function OA(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 PA(t,e,n=0){var i,r;const o=cm(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 L(MA,this,CA).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=L(MA,this,OA).call(this,d,u)||(null===(r=d)||void 0===r?void 0:r.buffered);return h&&Number.isFinite(h.start)&&Number.isFinite(h.end)?L(MA,this,CA).call(this,s,h,o,e):void 0}function CA(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 DA{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 RA extends sd{constructor(t,e){super(e),this.timeline=t}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"handleDecodedFrame","handleClockTick","handleMainTrackBufferUpdate"])}enter(){}exit(){}play(){this.timeline.transitionTo(dv)}pause(){this.timeline.transitionTo(pv)}wait(){this.timeline.transitionTo(fv)}reset(){this.timeline.transitionTo(vv)}seek(t){this.timeline.transitionTo(mv,{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()||pv;this.timeline.transitionTo(e)}handleMainTrackBufferUpdate(t){}handleDecodedFrame(t){}handleClockTick(t){}onDispose(){this.timeline=null}}const LA=24e3/1001;function BA(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 zA(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 WA(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 UA(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 jA(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:LA)}(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+zA(t)}function $A(t,e=(null==t?void 0:t.currentTime)){const n=BA(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=WA(o);if(!s)return!0;if(!t.hasDecodedFirstFrame(r,s))return!0}return!1}function qA(t,e=(null==t?void 0:t.currentTime)){return $A(t,e)||function(t,e=(null==t?void 0:t.currentTime)){const n=BA(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=UA(s);if(null!=a&&a.id&&!jA(t,o,a.id,a.type,n))return!0}return!1}(t,e)}function VA(t,e=(null==t?void 0:t.currentTime)){if("function"!=typeof(null==t?void 0:t.computeBuffered))return!1;const n=BA(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=zA(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=cm(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 GA={[uv]:class extends RA{get name(){return uv}get defaults(){return{autoplay:Iy("autoplay")}}enter(){this.timeline.recordStableState(pv),this.timeline.stopPlaybackClock()}play(){const t=qA(this.timeline),e=t?fv:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t)return this.timeline.recordStableState(dv),void this.timeline.transitionTo(fv);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(qA(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)}},[hv]:class extends RA{get name(){return hv}enter(t={}){const{from:e,to:n}=t;this.timeline.recordStableState(dv),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("canplay",{from:e,to:n})}play(){}pause(){this.timeline.transitionTo(pv)}},[dv]:class extends RA{get name(){return dv}enter(t={}){const{from:e,to:n,fromFirstFramePending:i}=t;this.timeline.recordStableState(dv),this.timeline.startPlaybackClock(),!0!==i&&this.emitPlayerStateEvent("canplay",{from:e,to:n}),this.emitPlayerStateEvent("playing",{from:e,to:n})}play(){}pause(){this.timeline.transitionTo(pv)}handleClockTick(t){const e=this.timeline.currentTime;qA(this.timeline,e)&&(this.timeline.recordStableState(dv),this.timeline.transitionTo(fv))}},[fv]:(cn=new WeakMap,un=new WeakMap,dn=new WeakSet,class extends RA{constructor(...t){super(...t),j(this,dn),W(this,cn,void 0),W(this,un,null)}get name(){return fv}enter(t={}){const{from:e,to:n}=t;this.timeline.stopPlaybackClock(),L(dn,this,HA).call(this),L(dn,this,XA).call(this),this.emitPlayerStateEvent("waiting",{from:e,to:n}),L(dn,this,JA).call(this)}exit(){L(dn,this,KA).call(this),L(dn,this,YA).call(this)}play(){this.timeline.recordStableState(dv);const t=L(dn,this,QA).call(this),e=t?fv:this.timeline.getPlaybackStartState();this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t||this.timeline.transitionTo(e)}pause(){this.timeline.transitionTo(pv)}handleMainTrackReady(t){const e=this.timeline.getLastStableState()||pv;e!==dv?this.timeline.transitionTo(e):L(dn,this,JA).call(this)}handleDecodedFrame(t){L(dn,this,JA).call(this)}handleMainTrackBufferUpdate(t){L(dn,this,JA).call(this)}}),[pv]:class extends RA{get name(){return pv}enter(t={}){const{from:e,to:n}=t;this.timeline.recordStableState(pv),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("pause",{from:e,to:n})}play(){const t=qA(this.timeline),e=t?fv:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t)return this.timeline.recordStableState(dv),void this.timeline.transitionTo(fv);this.timeline.transitionTo(e)}pause(){}},[mv]:class extends RA{get name(){return mv}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===dv||n===hv,r=i&&"function"==typeof this.timeline.getPlaybackStartState?this.timeline.getPlaybackStartState(e):i?dv:pv;this.timeline.transitionTo(r,{fromSeeking:!0})}play(){var t;if(this.timeline&&"function"==typeof this.timeline.setSeekReturnState)return void this.timeline.setSeekReturnState(dv);const e="function"==typeof(null===(t=this.timeline)||void 0===t?void 0:t.getPlaybackStartState)?this.timeline.getPlaybackStartState():dv;this.timeline.transitionTo(e)}pause(){this.timeline&&"function"==typeof this.timeline.setSeekReturnState?this.timeline.setSeekReturnState(pv):this.timeline.transitionTo(pv)}handleDecodedFrame(t){this.timeline&&"function"==typeof this.timeline.maybeCompleteSeek&&this.timeline.maybeCompleteSeek(t)}},[vv]:class extends RA{get name(){return vv}enter(){this.timeline.resetClock(),this.timeline.transitionTo(uv,{fromReset:!0})}play(){}pause(){}get buffered(){return{start:0,end:0}}}};function HA(){var t;const e=null===(t=this.timeline)||void 0===t?void 0:t.trackBuffers;e&&"function"==typeof e.on&&(U(cn,this,(t=>this.handleMainTrackBufferUpdate(t))),e.on(sv.TRACK_BUFFER_UPDATE,z(cn,this)))}function KA(){var t;const e=null===(t=this.timeline)||void 0===t?void 0:t.trackBuffers;z(cn,this)&&e&&"function"==typeof e.off?(e.off(sv.TRACK_BUFFER_UPDATE,z(cn,this)),U(cn,this,null)):U(cn,this,null)}function XA(){if(null!==z(un,this))return;const t="function"==typeof(null==cd?void 0:cd.setInterval)?cd.setInterval.bind(cd):setInterval;U(un,this,t((()=>{var t;(null===(t=this.timeline)||void 0===t?void 0:t.state)===fv&&L(dn,this,JA).call(this)}),200))}function YA(){null!==z(un,this)&&(("function"==typeof(null==cd?void 0:cd.clearInterval)?cd.clearInterval.bind(cd):clearInterval)(z(un,this)),U(un,this,null))}function QA(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!!$A(t,e)||!0===n.skipBufferResume||!VA(t,e)}(this.timeline,t)}function JA(t=(t=>null===(t=this.timeline)||void 0===t?void 0:t.currentTime)()){return(this.timeline.getLastStableState()||pv)===dv&&!L(dn,this,QA).call(this,t)&&(this.timeline.transitionTo(this.timeline.getPlaybackStartState(t)),!0)}function ZA(t){return t&&("string"!=typeof t.state||"ready"===t.state)}function tN(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).some((t=>"video"===(null==t?void 0:t.type)))}function eN(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 nN(t){return t===dv||t===hv}var iN=new WeakMap,rN=new WeakMap,oN=new WeakMap,sN=new WeakMap,aN=new WeakMap,lN=new WeakMap,cN=new WeakMap,uN=new WeakMap,dN=new WeakMap,hN=new WeakMap,fN=new WeakMap,pN=new WeakMap,mN=new WeakMap,vN=new WeakMap,gN=new WeakSet;class yN{constructor(t={}){j(this,gN),W(this,iN,void 0),W(this,rN,void 0),W(this,oN,void 0),W(this,sN,void 0),W(this,aN,void 0),W(this,lN,void 0),W(this,cN,void 0),W(this,uN,void 0),W(this,dN,void 0),W(this,hN,null),W(this,fN,pv),W(this,pN,[]),W(this,mN,new Set),W(this,vN,new Map),U(iN,this,t.getState),U(rN,this,t.getNode),U(oN,this,t.getPlacementsActiveAtTime),U(sN,this,t.getLastStableState),U(aN,this,t.getPlaybackStartState),U(lN,this,t.clearVisualFrameBuffers),U(cN,this,t.updateTime),U(uN,this,t.transitionTo),U(dN,this,t.trigger)}start(t,e){const n=Number(t);if(!Number.isFinite(n))return;let i=e;i===mv?i=z(fN,this):i===fv&&"function"==typeof z(sN,this)&&(i=z(sN,this).call(this)),U(fN,this,nN(i)?dv:pv),U(hN,this,n),z(mN,this).clear(),z(vN,this).clear(),U(pN,this,"function"==typeof z(oN,this)?z(oN,this).call(this,n):[]),"function"==typeof z(lN,this)&&z(lN,this).call(this),"function"==typeof z(cN,this)&&z(cN,this).call(this,n,{source:"seek"}),"function"==typeof z(dN,this)&&z(dN,this).call(this,sv.TIMELINE_SEEKING,{targetTime:n,placements:z(pN,this).slice()}),this.maybeComplete()}setReturnState(t){U(fN,this,nN(t)?dv:pv)}maybeComplete(t){if(("function"==typeof z(iN,this)?z(iN,this).call(this):void 0)!==mv)return;const e=z(hN,this);if(!Number.isFinite(e))return;const n=null==t?void 0:t.trackType,i=null==t?void 0:t.placementId;if(i&&"video"===n){const n=Number(null==t?void 0:t.pts);if(Number.isFinite(n)&&n>=e){z(mN,this).add(i);const t=z(vN,this).get(i);(!Number.isFinite(t)||n<t)&&z(vN,this).set(i,n)}}else i&&"image"===n&&function(t,e){const n=Number(null==t?void 0:t.pts),i=Number(null==t?void 0:t.duration);return!Number.isFinite(n)||(Number.isFinite(i)&&i>0?e>=n&&e<n+i:e>=n)}(t,e)&&z(mN,this).add(i);const r=Array.isArray(z(pN,this))?z(pN,this):[];if(r.length){if("function"==typeof z(rN,this)){for(let t=0;t<r.length;t+=1){const e=r[t],n=null==e?void 0:e.placementId;if(!n)return;const i=z(rN,this).call(this,e.nodeId);if(!ZA(i))return;if(eN(i)&&!z(mN,this).has(n))return}L(gN,this,bN).call(this,e,r)}}else L(gN,this,bN).call(this,e,[])}dispose(){U(pN,this,[]),z(mN,this).clear(),z(vN,this).clear(),U(hN,this,null)}}function bN(t,e){const n=L(gN,this,kN).call(this,t,e);if("function"==typeof z(cN,this)&&z(cN,this).call(this,n,{source:"seek"}),U(hN,this,null),U(pN,this,[]),z(mN,this).clear(),z(vN,this).clear(),"function"==typeof z(dN,this)&&z(dN,this).call(this,sv.TIMELINE_SEEKED,{targetTime:t,placements:Array.isArray(e)?e.slice():[]}),"function"==typeof z(uN,this)){const t=z(fN,this)===dv&&"function"==typeof z(aN,this)?z(aN,this).call(this,n):z(fN,this);z(uN,this).call(this,t,{fromSeeking:!0})}}function kN(t,e){const n=Number(t);if(!Number.isFinite(n))return t;if(!Array.isArray(e)||!e.length||"function"!=typeof z(rN,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(!tN(z(rN,this).call(this,n.nodeId)))continue;const o=z(vN,this).get(r);Number.isFinite(o)&&o>i&&(i=o)}return i}function xN(t){if(t&&"function"==typeof t.close)try{t.close()}catch(t){}}function wN(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=>xN(null==t?void 0:t.frame)))}function _N(t){return cm(t)}function TN(t){return Number.isFinite(null==t?void 0:t.loopRootOffset)?t.loopRootOffset:_N(t)}function IN(t,e){return"string"==typeof(null==t?void 0:t.loopRootPlacementId)&&t.loopRootPlacementId?t.loopRootPlacementId:e}function EN(t){if("string"!=typeof t)return Number.NaN;const e=t.match(/(\d+)/);return e?Number(e[1]):Number.NaN}function SN(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 AN=1e-6;function NN(t){return t&&("string"!=typeof t.state||"ready"===t.state)}function MN(t){const e=Number(t);return Number.isFinite(e)?e:0}function FN(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 ON(t){return t&&"cue"===t.type&&Array.isArray(t.cues)?t.cues:[]}var PN=new WeakMap,CN=new WeakMap,DN=new WeakMap,RN=new WeakMap,LN=new WeakMap,BN=new WeakMap,zN=new WeakMap,WN=new WeakMap,UN=new WeakSet;class jN{constructor(t={}){j(this,UN),W(this,PN,void 0),W(this,CN,void 0),W(this,DN,void 0),W(this,RN,void 0),W(this,LN,void 0),W(this,BN,void 0),W(this,zN,-1e-6),W(this,WN,null),U(PN,this,t.getPlacements),U(CN,this,t.getPlacementsActiveAtTime),U(DN,this,t.getPlacementDuration),U(RN,this,t.getNode),U(LN,this,t.triggerTimeline),U(BN,this,t.triggerNode)}handleSeeking(t,e){const n=MN(t);U(WN,this,n)}handleSeeked(t){const e=MN(t),n=z(WN,this);U(WN,this,null),Number.isFinite(n)?(L(UN,this,qN).call(this,n,e),U(zN,this,e)):U(zN,this,e)}handleTimeUpdate(t,e={}){const n=MN(t),i=z(zN,this);!0===(null==e?void 0:e.isSeeking)?U(zN,this,n):Number.isFinite(i)?n<=i?n<i&&U(zN,this,n-AN):(L(UN,this,$N).call(this,i,n),U(zN,this,n)):U(zN,this,n)}dispose(){U(WN,this,null),U(zN,this,-1e-6)}}function $N(t,e){const n="function"==typeof z(PN,this)?z(PN,this).call(this):[];L(UN,this,VN).call(this,n,t,e,{onlySticky:!1})}function qN(t,e){if("function"!=typeof z(CN,this))return;const n=z(CN,this).call(this,e);L(UN,this,VN).call(this,n,t,e,{onlySticky:!0})}function VN(t,e,n,i={}){if("function"!=typeof z(RN,this)||"function"!=typeof z(LN,this))return;if(!Array.isArray(t)||!t.length)return;const r=!0===i.onlySticky,o=[];for(let i=0;i<t.length;i+=1){const s=t[i],a=null==s?void 0:s.placementId,l=null==s?void 0:s.nodeId;if(!a||!l)continue;const c=z(RN,this).call(this,l);if(!NN(c))continue;const u=FN(c);if(!u.length)continue;const d=cm(s);if(!Number.isFinite(d))continue;const h=Number.isFinite(null==s?void 0:s.nodeOffsetOverride)?s.nodeOffsetOverride:0,f="function"==typeof z(DN,this)?z(DN,this).call(this,s):void 0,p="number"==typeof f&&Number.isFinite(f)?d+f:Number.POSITIVE_INFINITY,m=r?d-AN:e;for(let t=0;t<u.length;t+=1){const e=ON(u[t]);for(let i=0;i<e.length;i+=1){const s=e[i],c=MN(null==s?void 0:s.timestamp),u=d+Math.max(0,c-h);u<=p&&(r&&!0!==(null==s?void 0:s.isSticky)||u>m&&u<=n&&"string"==typeof(null==s?void 0:s.name)&&s.name&&o.push({time:u,placementOffset:d,placementId:a,nodeId:l,cuepoint:s,trackIndex:t,cueIndex:i}))}}}o.length&&(o.sort(((t,e)=>t.time!==e.time?t.time-e.time:t.placementOffset!==e.placementOffset?t.placementOffset-e.placementOffset:t.placementId!==e.placementId?t.placementId<e.placementId?-1:1:t.trackIndex!==e.trackIndex?t.trackIndex-e.trackIndex:t.cueIndex-e.cueIndex)),o.forEach((t=>{const e=t.cuepoint,n={time:t.time,nodeId:t.nodeId,placementId:t.placementId,cuepoint:e};z(LN,this).call(this,"cuepoint",n),z(LN,this).call(this,e.name,n),"function"==typeof z(BN,this)&&(z(BN,this).call(this,t.nodeId,"cuepoint",n),z(BN,this).call(this,t.nodeId,e.name,n))})))}class GN{#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 HN=24e3/1001;function KN(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}:SN(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 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 WeakMap,kM=new WeakMap,xM=new WeakMap,wM=new WeakMap,_M=new WeakMap,TM=new WeakMap,IM=new WeakMap,EM=new WeakMap,SM=new WeakMap,AM=new WeakSet;class NM extends sd{constructor(...t){super(...t),j(this,AM),W(this,XN,void 0),W(this,YN,void 0),W(this,QN,void 0),W(this,JN,void 0),W(this,ZN,void 0),W(this,tM,!1),W(this,eM,[]),W(this,nM,new GN("placement-")),W(this,iM,[]),W(this,rM,new GN("renderplacement-")),W(this,oM,void 0),W(this,sM,void 0),W(this,aM,void 0),W(this,lM,!1),W(this,cM,new Set),W(this,uM,new Set),W(this,dM,new Map),W(this,hM,[]),W(this,fM,0),W(this,pM,new Set),W(this,mM,new Set),W(this,vM,Number.NEGATIVE_INFINITY),W(this,gM,[]),W(this,yM,Number.NEGATIVE_INFINITY),W(this,bM,0),W(this,kM,void 0),W(this,xM,void 0),W(this,wM,new Map),W(this,_M,null),W(this,TM,void 0),W(this,IM,void 0),W(this,EM,void 0),W(this,SM,void 0);const[e,n={}]=t;U(XN,this,e),U(kM,this,n),U(ZN,this,new IA(n)),U(oM,this,new FA(n)),U(JN,this,pv),L(AM,this,WM).call(this),L(AM,this,UM).call(this),U(TM,this,new yN({getState:()=>this.state,getNode:t=>z(XN,this)&&"function"==typeof z(XN,this).get?z(XN,this).get(t):void 0,getPlacementsActiveAtTime:t=>L(AM,this,kF).call(this,t,{endEpsilonSeconds:L(AM,this,NF).call(this)}),getLastStableState:()=>this.getLastStableState(),getPlaybackStartState:t=>this.getPlaybackStartState(t),clearVisualFrameBuffers:()=>L(AM,this,yF).call(this),updateTime:(t,e)=>this.updateTime(t,e),transitionTo:(t,e)=>this.transitionTo(t,e),trigger:(t,e)=>this.trigger(t,e)})),U(IM,this,new jN({getPlacements:()=>z(eM,this).slice(),getPlacementsActiveAtTime:t=>L(AM,this,kF).call(this,t),getPlacementDuration:t=>L(AM,this,eF).call(this,t),getNode:t=>z(XN,this)&&"function"==typeof z(XN,this).get?z(XN,this).get(t):void 0,triggerTimeline:(t,e)=>this.trigger(t,e),triggerNode:(t,e,n)=>{const i=z(XN,this)&&"function"==typeof z(XN,this).get?z(XN,this).get(t):void 0;i&&"function"==typeof i.trigger&&i.trigger(e,n)}})),U(EM,this,(()=>{var t,e;null===(t=z(IM,this))||void 0===t||null===(e=t.handleSeeked)||void 0===e||e.call(t,this.currentTime)})),this.on(sv.TIMELINE_SEEKED,z(EM,this)),U(SM,this,(t=>L(AM,this,KM).call(this,t))),this.on("nodestart",z(SM,this)),this.transitionTo(uv)}get name(){return"Timeline"}get defaults(){return{snapToFps:HN,maxBufferedVideoFrames:24}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"computeBuffered","notifyDecodedFrame","getDecodedFrameStats","getActiveRenderPlacement","maybeCompleteSeek","getPlacementsActiveAtTime","hasDecodedFirstFrame","getDecodedVisualBuffer","getPlacementDuration","getNode"])}transitionTo(t,e={}){const n=z(QN,this),i=function(t,e,n={}){const i=GA[t];return i?new i(e,n):null}(t,this,z(kM,this)),r=e&&"object"==typeof e&&!Array.isArray(e)?{...e,from:n,to:t}:{from:n,to:t};i?(z(YN,this)&&"function"==typeof z(YN,this).exit&&z(YN,this).exit(),U(YN,this,i),U(QN,this,t),"function"==typeof i.enter&&i.enter(r),this.trigger(sv.TIMELINE_STATE_CHANGE,{from:n,to:t,options:e})):this.log.warn(`Unknown state "${t}"`)}recordStableState(t){U(JN,this,t)}getLastStableState(){return z(JN,this)}enableFirstFrameRenderedGate(){U(tM,this,!0)}getPlaybackStartState(t=this.currentTime){return this.shouldWaitForFirstRenderedFrame(t)?hv:dv}shouldWaitForFirstRenderedFrame(t=this.currentTime){if(!z(tM,this)||z(lM,this))return!1;const e=Number.isFinite(t)?t:this.currentTime,n=L(AM,this,kF).call(this,e);return Array.isArray(n)&&n.length>0}notifyFirstFrameRendered(){z(lM,this)||(U(lM,this,!0),this.state===hv&&this.transitionTo(dv,{fromFirstFramePending:!0}))}get state(){return z(QN,this)}get paused(){return z(QN,this)===uv||z(QN,this)===pv}get currentTime(){return z(ZN,this).currentTime}set currentTime(t){z(YN,this).seek(t)}get playbackRate(){return z(ZN,this).playbackRate}set playbackRate(t){z(ZN,this).playbackRate=t}play(){z(YN,this).play()}pause(){z(YN,this).pause()}reset(){z(YN,this).reset()}seekToPlacement(t){if(!t)throw new Error("Timeline.seekToPlacement requires placement id");L(AM,this,QM).call(this);const e=L(AM,this,IF).call(this,t);if(!e)throw new Error("Timeline.seekToPlacement requires placement id");const n=cm(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;L(AM,this,QM).call(this),L(AM,this,JM).call(this),z(ZN,this).seek(t),L(AM,this,bF).call(this,this.currentTime),L(AM,this,xF).call(this);const r="string"==typeof(null==e?void 0:e.source)?e.source:"set";null!==(n=z(IM,this))&&void 0!==n&&null!==(i=n.handleTimeUpdate)&&void 0!==i&&i.call(n,this.currentTime,{isSeeking:this.state===mv}),L(AM,this,XM).call(this,this.currentTime),L(AM,this,fF).call(this,this.currentTime),this.trigger(sv.TIMELINE_TIME_UPDATE,av(this.currentTime,r))}startSeeking(t,e){var n,i;null!==(n=z(IM,this))&&void 0!==n&&null!==(i=n.handleSeeking)&&void 0!==i&&i.call(n,this.currentTime,t),z(TM,this)&&"function"==typeof z(TM,this).start&&z(TM,this).start(t,e)}setSeekReturnState(t){z(TM,this)&&"function"==typeof z(TM,this).setReturnState&&z(TM,this).setReturnState(t)}maybeCompleteSeek(t){z(TM,this)&&"function"==typeof z(TM,this).maybeComplete&&z(TM,this).maybeComplete(t)}startPlaybackClock(){z(ZN,this).play()}stopPlaybackClock(){z(ZN,this).pause()}resetClock(){var t,e;z(ZN,this).reset(),null===(t=z(IM,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:[];L(AM,this,MM).call(this),L(AM,this,FM).call(this,e),L(AM,this,OM).call(this,n),this.currentTime=0}placeOnTimeline(t,e,n={}){const i=t&&"object"==typeof t?t.id:t;if(!i)throw new Error("Timeline.placeOnTimeline requires node id");const r=z(nM,this).claim(n.placementId),o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=mm(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}:pm(e,n);let u,d,h,f=!1;const p=null!==a;if(L(AM,this,QM).call(this),a){const t=z(eM,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=cm(t);if("start"===a.anchor)Number.isFinite(e)?u=L(AM,this,nF).call(this,e,{nodeOffsetOverride:o}):f=!0;else{const n=L(AM,this,eF).call(this,t);if(Number.isFinite(e)&&n>0){const t=e+n,i=L(AM,this,nF).call(this,t,{nodeOffsetOverride:o});u=Math.max(i,t)}else f=!0}}else if(l){const t=n.offsetAnchorPlacementId?z(eM,this).find((t=>(null==t?void 0:t.placementId)===n.offsetAnchorPlacementId)):z(eM,this).length?z(eM,this)[z(eM,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==t?void 0:t.placementId),d){const e=cm(t),n=L(AM,this,eF).call(this,t);Number.isFinite(e)&&n>0?u=L(AM,this,nF).call(this,e+n-c,{nodeOffsetOverride:o}):(f=!0,h="end")}else u=L(AM,this,nF).call(this,-c,{nodeOffsetOverride:o})}else u=fm(e),u=L(AM,this,nF).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 DA({placementId:r,nodeId:i,offset:u,offsetPending:f,offsetAnchorPlacementId:f?d:void 0,offsetAnchorEdge:f?h:void 0,offsetAnchorIsReference:f?p:void 0,offsetEndSeconds:g,nodeOffsetOverride:o,nodeDurationOverride:s,loop:!0===n.loop,loopRootPlacementId:m,loopRootOffset:v});if(z(eM,this).push(y),dm(z(eM,this)),L(AM,this,dF).call(this,y),L(AM,this,cF).call(this),f&&d){const t=z(eM,this).find((t=>(null==t?void 0:t.placementId)===d));L(AM,this,rF).call(this,null==t?void 0:t.nodeId)}return this.trigger(sv.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=L(AM,this,iF).call(this,e,i),s=o.offset,a=!0===o.offsetPending,l=o.offsetAnchorPlacementId,c=o.offsetAnchorEdge,u=o.offsetAnchorIsReference,d=z(rM,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;vm(z(iM,this),t,e,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements")}if(z(iM,this).push(v),dm(z(iM,this)),a&&l){const t=z(eM,this).find((t=>(null==t?void 0:t.placementId)===l));L(AM,this,rF).call(this,null==t?void 0:t.nodeId)}return this.trigger(sv.RENDER_PLACEMENT_ADDED,v),d}get placements(){return z(eM,this).slice()}getPlacementsActiveAtTime(t){return L(AM,this,kF).call(this,t)}getNodesAtTime(t){const e=L(AM,this,EF).call(this,t);if(!Number.isFinite(e))return[];const n=L(AM,this,kF).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 L(AM,this,eF).call(this,t)}getNode(t){if(z(XN,this)&&"function"==typeof z(XN,this).get)return z(XN,this).get(t)}get renderPlacements(){return z(iM,this).slice()}get placementsAhead(){const t=this.currentTime;return z(eM,this).filter((e=>{const n=cm(e);if(!Number.isFinite(n))return!1;const i=L(AM,this,eF).call(this,e);return"number"==typeof i?n+i>t:n>=t}))}get buffered(){return z(YN,this)?z(YN,this).buffered:{start:0,end:0}}get trackBuffers(){return z(oM,this)}onDispose(){L(AM,this,BM).call(this),z(uM,this)&&z(uM,this).clear(),z(IM,this)&&"function"==typeof z(IM,this).dispose&&z(IM,this).dispose(),U(IM,this,null),L(AM,this,LM).call(this),L(AM,this,zM).call(this),z(TM,this)&&"function"==typeof z(TM,this).dispose&&z(TM,this).dispose(),U(TM,this,null),z(ZN,this)&&"function"==typeof z(ZN,this).dispose&&(z(xM,this)&&"function"==typeof z(ZN,this).off&&(z(ZN,this).off("tick",z(xM,this)),U(xM,this,null)),z(ZN,this).dispose(),U(ZN,this,null)),L(AM,this,aF).call(this),U(YN,this,null),U(QN,this,null),U(eM,this,[]),U(iM,this,[]),L(AM,this,lF).call(this),L(AM,this,cF).call(this),z(wM,this).clear(),U(_M,this,null)}notifyDecodedFrame(t={}){const e=null==t?void 0:t.placementId,n=null==t?void 0:t.trackType;if(!e||!n)return;const i=`${e}:${n}`;z(cM,this).add(i),L(AM,this,gF).call(this,t),L(AM,this,xF).call(this),z(YN,this)&&"function"==typeof z(YN,this).handleDecodedFrame&&z(YN,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=KN(t);Number.isFinite(i)&&i>0&&(e.totalBytes+=i)}))}return e.available=!0,e}(z(wM,this))}hasDecodedFirstFrame(t,e){return!(!t||!e)&&z(cM,this).has(`${t}:${e}`)}getDecodedVisualBuffer(t,e){if(t&&e)return z(wM,this).get(`${t}:${e}`)}computeBuffered(t){const e=z(XN,this);if(e&&"function"==typeof e.get)return z(oM,this).computeBuffered(z(eM,this),t,e)}getActiveRenderPlacement(t=this.currentTime){const e=Number.isFinite(t)?t:this.currentTime,n=Array.isArray(z(iM,this))?z(iM,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 MM(){U(lM,this,!1),this.trigger(sv.TIMELINE_RESET,{reason:"switch"}),L(AM,this,yF).call(this),z(oM,this)&&"function"==typeof z(oM,this).reset&&z(oM,this).reset(),z(uM,this)&&z(uM,this).clear(),U(eM,this,[]),U(iM,this,[]),L(AM,this,lF).call(this),L(AM,this,cF).call(this),z(nM,this).reset(),z(rM,this).reset()}function FM(t=[]){for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||!n.nodeId)continue;const i=L(AM,this,PM).call(this,n),r=L(AM,this,DM).call(this,n);this.placeOnTimeline(n.nodeId,r,i)}}function OM(t=[]){for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||!n.type)continue;const i=L(AM,this,CM).call(this,n),r=L(AM,this,RM).call(this,n);this.placeRenderNodeOnTimeline(n.type,r,n.duration,i)}}function PM(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 CM(t){const e={};return t.renderPlacementId&&(e.renderPlacementId=t.renderPlacementId),t.params&&"object"==typeof t.params&&(e.params=t.params),e}function DM(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 RM(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 LM(){z(YN,this)&&"function"==typeof z(YN,this).exit&&z(YN,this).exit()}function BM(){z(EM,this)&&"function"==typeof this.off&&(this.off(sv.TIMELINE_SEEKED,z(EM,this)),U(EM,this,null)),z(SM,this)&&"function"==typeof this.off&&(this.off("nodestart",z(SM,this)),U(SM,this,null))}function zM(){z(oM,this)&&(z(sM,this)&&(z(oM,this).off("track:underflow",z(sM,this)),U(sM,this,null)),z(aM,this)&&(z(oM,this).off("track:ready",z(aM,this)),U(aM,this,null)),"function"==typeof z(oM,this).dispose&&z(oM,this).dispose(),U(oM,this,null))}function WM(){z(oM,this)&&"function"==typeof z(oM,this).on&&(U(sM,this,(t=>L(AM,this,$M).call(this,t))),U(aM,this,(t=>L(AM,this,qM).call(this,t))),z(oM,this).on(sv.TRACK_UNDERFLOW,z(sM,this)),z(oM,this).on(sv.TRACK_READY,z(aM,this)))}function UM(){z(ZN,this)&&"function"==typeof z(ZN,this).on&&(U(xM,this,(t=>L(AM,this,jM).call(this,t))),z(ZN,this).on(sv.CLOCK_TICK,z(xM,this)))}function jM(t){var e,n;L(AM,this,QM).call(this),L(AM,this,xF).call(this),null!==(e=z(IM,this))&&void 0!==e&&null!==(n=e.handleTimeUpdate)&&void 0!==n&&n.call(e,this.currentTime,{isSeeking:!1}),L(AM,this,XM).call(this,this.currentTime),this.trigger(sv.TIMELINE_TIME_UPDATE,av(this.currentTime,"clock")),z(YN,this)&&"function"==typeof z(YN,this).handleClockTick&&z(YN,this).handleClockTick(t)}function $M(t){L(AM,this,QM).call(this);const e=L(AM,this,VM).call(this);e&&(null==t?void 0:t.trackType)===e.trackType&&(z(YN,this)&&"function"==typeof z(YN,this).handleMainTrackUnderflow?z(YN,this).handleMainTrackUnderflow(t):this.transitionTo(fv))}function qM(t){if(L(AM,this,QM).call(this),this.state!==fv)return;const e=L(AM,this,VM).call(this);if(!e)return;if((null==t?void 0:t.trackType)!==e.trackType)return;if(z(YN,this)&&"function"==typeof z(YN,this).handleMainTrackReady)return void z(YN,this).handleMainTrackReady(t);const n=this.getLastStableState()||pv;this.transitionTo(n)}function VM(t=this.currentTime){const e=L(AM,this,HM).call(this,t);if(!e)return;const n=z(XN,this)&&"function"==typeof z(XN,this).get?z(XN,this).get(e.nodeId):void 0;if(!n)return;const i=L(AM,this,GM).call(this,n);return i?{placement:e,trackType:i}:void 0}function GM(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 HM(t=this.currentTime){const e=z(eM,this)||[];let n;for(let i=0;i<e.length;i+=1){const r=e[i],o=cm(r);if(!Number.isFinite(o))continue;const s=L(AM,this,eF).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 KM(t={}){if(this.state!==dv)return;const e=null==t?void 0:t.placementId;if(!e)return;const n=L(AM,this,IF).call(this,e);n&&L(AM,this,YM).call(this,n)}function XM(t=this.currentTime){if(this.state!==dv)return;const e=L(AM,this,kF).call(this,t);Array.isArray(e)&&e.length&&e.forEach((t=>L(AM,this,YM).call(this,t)))}function YM(t){const e=null==t?void 0:t.placementId;if(!e)return;if(z(uM,this).has(e))return;if(!t||!0!==t.loop)return;if(!t.nodeId)return;const n=L(AM,this,eF).call(this,t);if(!Number.isFinite(n)||n<=0)return;const i=cm(t);if(!Number.isFinite(i))return;const r=i+n;if(!Number.isFinite(r))return;const o=t.loopRootPlacementId||t.placementId,s=Number.isFinite(t.loopRootOffset)?t.loopRootOffset:i;z(uM,this).add(e),this.placeOnTimeline(t.nodeId,r,{nodeOffsetOverride:t.nodeOffsetOverride,nodeDurationOverride:t.nodeDurationOverride,loop:!0,loopRootPlacementId:o,loopRootOffset:s})}function QM(){const t=hm(z(eM,this),{getPlacementDuration:t=>L(AM,this,eF).call(this,t),snapPlacementOffset:(t,e)=>L(AM,this,nF).call(this,t,{nodeOffsetOverride:null==e?void 0:e.nodeOffsetOverride}),onResolvedPlacement:(t,e)=>{!0!==t.loop||Number.isFinite(t.loopRootOffset)||(t.loopRootOffset=t.offset),L(AM,this,oF).call(this,null==e?void 0:e.nodeId)}});return t.updated&&(L(AM,this,cF).call(this),t.resolvedPlacements.forEach((t=>{L(AM,this,dF).call(this,t),this.trigger(sv.PLACEMENT_ADDED,t)}))),t.updated}function JM(){if(!z(iM,this).length||!z(eM,this).length)return!1;const t=new Map;z(eM,this).forEach((e=>{(null==e?void 0:e.placementId)&&t.set(e.placementId,e)}));const e=z(iM,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];L(AM,this,ZM).call(this,o,t)&&(n=!0,i.push(o))}return n&&(dm(z(iM,this)),i.forEach((t=>{this.trigger(sv.RENDER_PLACEMENT_ADDED,t)}))),n}function ZM(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=L(AM,this,tF).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 vm(z(iM,this).filter((e=>e!==t&&!0!==(null==e?void 0:e.offsetPending))),s,a,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements"),L(AM,this,oF).call(this,null==r?void 0:r.nodeId),!0}function tF(t,e){const n=cm(t);if(!Number.isFinite(n))return;if("start"===e.offsetAnchorEdge)return L(AM,this,nF).call(this,n);const i=L(AM,this,eF).call(this,t);if(!(i>0))return;const r=n+i;if(!Number.isFinite(r))return;const o=L(AM,this,nF).call(this,r);return!0===e.offsetAnchorIsReference?Math.max(o,r):o}function eF(t){return am(t,z(XN,this))}function nF(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 iF(t,e={}){const n=mm(t);if("string"==typeof t&&t.includes("@")&&!n)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");if(!n){const n=fm(t);return{offset:L(AM,this,nF).call(this,n,e)}}const i=z(eM,this).find((t=>(null==t?void 0:t.placementId)===n.placementId));if(!i)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");const r=cm(i);if("start"===n.anchor)return Number.isFinite(r)?{offset:L(AM,this,nF).call(this,r,e)}:{offset:void 0,offsetPending:!0,offsetAnchorPlacementId:i.placementId,offsetAnchorEdge:"start",offsetAnchorIsReference:!0};const o=L(AM,this,eF).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=L(AM,this,nF).call(this,s,e);return{offset:Math.max(a,s)}}function rF(t){if(!t||!z(XN,this)||"function"!=typeof z(XN,this).get)return;if(z(dM,this).has(t))return;let e;try{e=z(XN,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),L(AM,this,oF).call(this,t)};e.on(sv.NODE_LOADED,n),z(dM,this).set(t,n)}function oF(t){if(!t)return;if(L(AM,this,sF).call(this,t))return;const e=z(dM,this).get(t);if(!e)return;let n;try{n=z(XN,this).get(t)}catch(t){n=null}n&&"function"==typeof n.off&&n.off(sv.NODE_LOADED,e),z(dM,this).delete(t)}function sF(t){if(!t)return!1;const e=new Map;z(eM,this).forEach((t=>{(null==t?void 0:t.placementId)&&e.set(t.placementId,t)}));const n=n=>{if(null==n||!n.offsetPending||null==n||!n.offsetAnchorPlacementId)return!1;const i=e.get(n.offsetAnchorPlacementId);return(null==i?void 0:i.nodeId)===t};return!!z(eM,this).some((t=>n(t)))||!!z(iM,this).some((t=>n(t)))}function aF(){z(dM,this).size&&z(XN,this)?(z(dM,this).forEach(((t,e)=>{let n;try{n=z(XN,this).get(e)}catch(t){n=null}n&&"function"==typeof n.off&&n.off(sv.NODE_LOADED,t)})),z(dM,this).clear()):z(dM,this).clear()}function lF(){U(hM,this,[]),U(fM,this,0),z(pM,this).clear(),z(mM,this).clear(),U(vM,this,Number.NEGATIVE_INFINITY)}function cF(){U(gM,this,[]),U(bM,this,0),U(yM,this,Number.NEGATIVE_INFINITY)}function uF(t,e){const n=z(hM,this),i={placementId:t,endTime:e};if(!n.length||e>=n[n.length-1].endTime)return void n.push(i);const r=n.findIndex((t=>e<t.endTime)),o=-1===r?n.length:r;n.splice(o,0,i),o<z(fM,this)&&U(fM,this,z(fM,this)+1)}function dF(t){const e=null==t?void 0:t.placementId;if(!e||z(pM,this).has(e))return;const n=cm(t),i=L(AM,this,eF).call(this,t);if(!Number.isFinite(n)||!Number.isFinite(i)||i<0)return void z(mM,this).add(e);const r=n+i;Number.isFinite(r)&&(z(pM,this).add(e),z(mM,this).delete(e),L(AM,this,uF).call(this,e,r))}function hF(){z(mM,this).size&&Array.from(z(mM,this)).forEach((t=>{const e=L(AM,this,IF).call(this,t);e?L(AM,this,dF).call(this,e):z(mM,this).delete(t)}))}function fF(t){const e=Number(t);if(!Number.isFinite(e))return;if(e<z(vM,this))return void U(vM,this,e);if(U(vM,this,e),L(AM,this,hF).call(this),!z(hM,this).length)return;const n=new Set;let i=z(fM,this);for(;i<z(hM,this).length;){const t=z(hM,this)[i];if(!t||!Number.isFinite(t.endTime)||t.endTime>e)break;t.placementId&&n.add(t.placementId),i+=1}i!==z(fM,this)&&(U(fM,this,i),n.size&&(L(AM,this,vF).call(this,n),L(AM,this,pF).call(this,n)))}function pF(t){if(t&&t.size)for(const e of z(cM,this)){const n=e.split(":")[0];t.has(n)&&z(cM,this).delete(e)}}function mF(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 vF(t){if(t&&t.size)for(const[e,n]of z(wM,this).entries())t.has(null==n?void 0:n.placementId)&&(L(AM,this,mF).call(this,n),z(wM,this).delete(e))}function gF(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=SN(a),c=Number.isFinite(null==l?void 0:l.width)?l.width:void 0,u=Number.isFinite(null==l?void 0:l.height)?l.height:void 0,d=Number.isFinite(null==t?void 0:t.pts)?t.pts:void 0;if(!Number.isFinite(d))return;const h=Number.isFinite(null==t?void 0:t.duration)?t.duration:void 0,f=`${n}:${r}`,p=z(wM,this).get(f),m=p||{placementId:n,nodeId:i,trackId:r,trackType:s,frames:[],current:void 0},v={placementId:n,nodeId:i,trackId:r,segmentId:o,frame:a,width:c,height:u,presentationTime:d,duration:h},g=m.frames,y=g.length?g[g.length-1]:void 0;if(!y||y.presentationTime<=v.presentationTime)g.push(v);else{let t=g.findIndex((t=>t.presentationTime>v.presentationTime));-1===t&&(t=g.length),g.splice(t,0,v)}const b=Number(null===(e=this.settings)||void 0===e?void 0:e.maxBufferedVideoFrames);if("video"===s&&Number.isFinite(b)&&b>0&&g.length>b){const t=g.length-b;for(let e=0;e<t;e+=1){const t=g.pop(),e=null==t?void 0:t.frame;if(e&&"function"==typeof e.close)try{e.close()}catch(t){}}}p||z(wM,this).set(f,m)}function yF(){for(const t of z(wM,this).values())L(AM,this,mF).call(this,t);z(wM,this).clear(),U(_M,this,null),z(cM,this).clear()}function bF(t){const e=Number.isFinite(t)?t:this.currentTime;if(!Number.isFinite(e))return;e<z(yM,this)&&(U(gM,this,[]),U(bM,this,0));const n=Array.isArray(z(eM,this))?z(eM,this):[],i=[],r=new Set;z(gM,this).forEach((t=>{L(AM,this,MF).call(this,t,e)&&(i.push(t),(null==t?void 0:t.placementId)&&r.add(t.placementId))}));let o=z(bM,this);for(;o<n.length;){const t=n[o],s=cm(t);if(!Number.isFinite(s))break;if(s>e)break;if(L(AM,this,MF).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}U(gM,this,i),U(bM,this,o),U(yM,this,e)}function kF(t,e={}){const n=Number.isFinite(t)?t:this.currentTime,i=Number.isFinite(null==e?void 0:e.endEpsilonSeconds)?e.endEpsilonSeconds:0;return 0===i&&n===this.currentTime&&n===z(yM,this)?z(gM,this).slice():(Array.isArray(z(eM,this))?z(eM,this):[]).filter((t=>L(AM,this,MF).call(this,t,n,i)))}function xF(){const t=this.currentTime,e=L(AM,this,_F).call(this,t);if(!e.length)return void U(_M,this,null);const n=this.getActiveRenderPlacement(t),i=L(AM,this,TF).call(this,e,n);(i!==z(_M,this)||L(AM,this,wF).call(this,t,n))&&(U(_M,this,i),this.trigger(sv.VISUAL_FRAMES_AVAILABLE,{time:t,frames:e}))}function wF(t,e){const n=e||this.getActiveRenderPlacement(t);if(!n)return!1;if(!Om.doesRenderNodeTypeRequireFrameCadence(null==n?void 0:n.type))return!1;const i=n.duration;return"number"==typeof i&&i>0}function _F(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){wN(c),a.push(t);continue}if("function"==typeof r&&!r(u,n)){const e=_N(u),i="function"==typeof o?o(u):void 0;Number.isFinite(i)&&Number.isFinite(e)&&n>=e+i&&(wN(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&&xN(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:_N(u),placementSortOffset:TN(u),placementSortId:IN(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=EN(r),a=EN(o);return Number.isFinite(s)&&Number.isFinite(a)&&s!==a?s-a:r&&o&&r!==o?r<o?-1:1:function(t,e){const n=(null==t?void 0:t.frame)||{},i=(null==e?void 0:e.frame)||{};return n.trackId!==i.trackId?n.trackId<i.trackId?-1:1:n.nodeId!==i.nodeId?n.nodeId<i.nodeId?-1:1:n.segmentId!==i.segmentId?n.segmentId<i.segmentId?-1:1:("number"==typeof n.presentationTime?n.presentationTime:0)-("number"==typeof i.presentationTime?i.presentationTime:0)}(t,e)})),s.map((t=>t.frame))}({buffers:z(wM,this),time:t,getPlacementById:t=>L(AM,this,IF).call(this,t),isPlacementActiveAtTime:(t,e)=>L(AM,this,MF).call(this,t,e),getPlacementDuration:t=>L(AM,this,eF).call(this,t)})}function TF(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 IF(t){if(t)return(z(eM,this)||[]).find((e=>(null==e?void 0:e.placementId)===t))}function EF(t){if("end"===t){const t=L(AM,this,SF).call(this);if(!Number.isFinite(t))return;const e=L(AM,this,AF).call(this);return Math.max(0,t-Math.min(t,e))}const e=Number(t);return Number.isFinite(e)?e:0}function SF(){let t;return(Array.isArray(z(eM,this))?z(eM,this):[]).forEach((e=>{const n=cm(e);if(!Number.isFinite(n))return;const i=L(AM,this,eF).call(this,e);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(t)||r>t)&&(t=r)})),t}function AF(){const t=L(AM,this,NF).call(this);return t>0?t:.001}function NF(){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 MF(t,e,n=0){if(!um(t,e,z(XN,this)))return!1;const i=Number(n);if(!Number.isFinite(i)||i<=0)return!0;const r=L(AM,this,eF).call(this,t);if(!Number.isFinite(r))return!0;const o=cm(t);return!Number.isFinite(o)||e<o+r-i}var FF=new WeakMap,OF=new WeakMap,PF=new WeakMap,CF=new WeakMap,DF=new WeakMap,RF=new WeakMap,LF=new WeakMap,BF=new WeakMap,zF=new WeakMap,WF=new WeakMap,UF=new WeakMap,jF=new WeakMap,$F=new WeakMap,qF=new WeakMap,VF=new WeakMap,GF=new WeakMap,HF=new WeakMap,KF=new WeakSet;class XF extends sd{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),j(this,KF),W(this,FF,void 0),W(this,OF,void 0),W(this,PF,1),W(this,CF,1),W(this,DF,1),W(this,RF,""),W(this,LF,0),W(this,BF,[]),W(this,zF,null),W(this,WF,void 0),W(this,UF,[]),W(this,jF,null),W(this,$F,null),W(this,qF,0),W(this,VF,0),W(this,GF,0),W(this,HF,void 0);const[e]=t;U(FF,this,e),U(qF,this,ly()),U(HF,this,L(KF,this,YF).call(this)),L(KF,this,QF).call(this),L(KF,this,JF).call(this),L(KF,this,iO).call(this),L(KF,this,eO).call(this)}get publicAPI(){return z(HF,this)}calcScore(){L(KF,this,hO).call(this)}onDispose(){z(FF,this)&&z(OF,this)&&"function"==typeof z(FF,this).off&&z(FF,this).off(sv.TIMELINE_PLAYER_STATE,z(OF,this)),U(OF,this,null),L(KF,this,nO).call(this),L(KF,this,rO).call(this),U(FF,this,null),U(UF,this,[]),U(BF,this,[]),U(HF,this,null)}}function YF(){const t=this;return{get score(){return z(PF,t)},get status(){return z(RF,t)},get streamQualityScore(){return z(CF,t)},get fpsScore(){return z(DF,t)},get browserFps(){return z(LF,t)},get waitingSeconds(){return z(VF,t)/1e3},get playingSeconds(){return z(GF,t)/1e3}}}function QF(){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(){z(FF,this)&&"function"==typeof z(FF,this).on&&(U(OF,this,(t=>L(KF,this,ZF).call(this,t))),z(FF,this).on(sv.TIMELINE_PLAYER_STATE,z(OF,this)))}function ZF(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||L(KF,this,tO).call(this,null):L(KF,this,tO).call(this,"waiting"):L(KF,this,tO).call(this,"playing")}function tO(t){if(t===z(jF,this))return;const e=ly();z(jF,this)&&Number.isFinite(z($F,this))&&z(UF,this).push({state:z(jF,this),startMs:z($F,this),endMs:e}),U(jF,this,t),U($F,this,t?e:null),L(KF,this,aO).call(this,e)}function eO(){const t=Number(this.settings.calcScoreInterval);!Number.isFinite(t)||t<=0||(U(WF,this,(()=>L(KF,this,hO).call(this))),Vk(z(WF,this),1e3*t))}function nO(){z(WF,this)&&Gk(z(WF,this)),U(WF,this,null)}function iO(){if("function"!=typeof Dk)return;const t=()=>{if(this._disposed)return;const e=ly();U(LF,this,L(KF,this,oO).call(this,z(BF,this),e)),U(zF,this,Dk(t))};U(zF,this,Dk(t))}function rO(){z(zF,this)&&"function"==typeof Rk&&Rk(z(zF,this)),U(zF,this,null)}function oO(t,e){const n=L(KF,this,sO).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 sO(){const t=Number(this.settings.windowSeconds);return!Number.isFinite(t)||t<=0?3e4:1e3*t}function aO(t){const e=t-L(KF,this,sO).call(this);for(;z(UF,this).length&&z(UF,this)[0].endMs<=e;)z(UF,this).shift()}function lO(t){const e=t-L(KF,this,sO).call(this);let n=0,i=0;const r=(r,o,s)=>{const a=Math.max(o,e),l=Math.min(s,t);l<=a||("waiting"===r?n+=l-a:"playing"===r&&(i+=l-a))};return z(UF,this).forEach((t=>{r(t.state,t.startMs,t.endMs)})),z(jF,this)&&Number.isFinite(z($F,this))&&r(z(jF,this),z($F,this),t),U(VF,this,n),U(GF,this,i),{waitingMs:n,playingMs:i}}function cO(t,e){if(t<=0)return 1;if(t>e)return 0;const n=e||1;return om(1-t*this.settings.waitingMultiplier/n)}function uO(){if(ly()-z(qF,this)<=1e3*this.settings.fpsGracePeriod)return 1;const t=Number(z(LF,this)),e=rv.isDesktop()?this.settings.bestFpsDesktop:this.settings.bestFpsMobile,n=om(e>0?t/e:0);return"quad"===this.settings.fpsMathFuncType?n*n:n}function dO(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 hO(){const t=ly(),{waitingMs:e,playingMs:n}=L(KF,this,lO).call(this,t),i=L(KF,this,cO).call(this,e,n),r=L(KF,this,uO).call(this),o=om(i*this.settings.streamQualityWeight+r*this.settings.fpsWeight);o!==z(PF,this)&&(U(PF,this,o),this.trigger(sv.QOE_SCORE,o)),U(CF,this,i),U(DF,this,r);const s=L(KF,this,dO).call(this,o,e);s!==z(RF,this)&&(U(RF,this,s),this.trigger(sv.QOE_STATUS,s))}function fO(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}function pO(t){const e=Number(t);return!Number.isFinite(e)||e<0?0:e}var mO=new WeakMap,vO=new WeakMap,gO=new WeakMap,yO=new WeakMap,bO=new WeakSet;class kO extends sd{get name(){return"SegmentEvictionCoordinator"}get defaults(){return{enabled:Iy("segmentEvictionEnabled"),bufferBehindSeconds:Iy("segmentEvictionBufferBehindSeconds"),bufferAheadSeconds:Iy("segmentEvictionBufferAheadSeconds"),maxRetainedBytes:Iy("segmentEvictionMaxRetainedBytes")}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"evictAtTime"])}constructor(t,e,n={}){super(n),j(this,bO),W(this,mO,void 0),W(this,vO,void 0),W(this,gO,void 0),W(this,yO,void 0),U(mO,this,t),U(vO,this,e),U(gO,this,(t=>L(bO,this,xO).call(this,t))),U(yO,this,(t=>L(bO,this,wO).call(this,t))),z(mO,this)&&"function"==typeof z(mO,this).on&&(z(mO,this).on(sv.TIMELINE_TIME_UPDATE,z(gO,this)),z(mO,this).on(sv.TIMELINE_SEEKED,z(yO,this)))}onDispose(){z(mO,this)&&"function"==typeof z(mO,this).off&&(z(mO,this).off(sv.TIMELINE_TIME_UPDATE,z(gO,this)),z(mO,this).off(sv.TIMELINE_SEEKED,z(yO,this))),U(mO,this,null),U(vO,this,null),U(gO,this,null),U(yO,this,null)}evictAtTime(t){if(!0!==this.settings.enabled)return;const e=Number(t);if(!Number.isFinite(e))return;const n=pO(this.settings.bufferBehindSeconds),i=pO(this.settings.bufferAheadSeconds),r=e-n,o=e+i,s=L(bO,this,_O).call(this);if(!s.length)return;const a=Number(this.settings.maxRetainedBytes);if(Number.isFinite(a)&&a>0&&L(bO,this,TO).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=cm(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=L(bO,this,IO).call(this,e);if(!n)return;const i=t.filter((t=>L(bO,this,EO).call(this,t,r,o)));i.length?L(bO,this,SO).call(this,n,i,r,o):"function"==typeof n.evict&&n.evict()}))}}function xO(t){var e,n;if(!0!==this.settings.enabled)return;if((null===(e=z(mO,this))||void 0===e?void 0:e.state)===mv)return;const i=Number(null==t?void 0:t.time),r=Number.isFinite(i)?i:Number(null===(n=z(mO,this))||void 0===n?void 0:n.currentTime);this.evictAtTime(r)}function wO(t){var e;if(!0!==this.settings.enabled)return;const n=Number(null==t?void 0:t.targetTime),i=Number.isFinite(n)?n:Number(null===(e=z(mO,this))||void 0===e?void 0:e.currentTime);this.evictAtTime(i)}function _O(){var t;const e=null===(t=z(mO,this))||void 0===t?void 0:t.placements;return Array.isArray(e)?e:[]}function TO(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=L(bO,this,IO).call(this,i),o=Number(null==r?void 0:r.retainedByteLength);Rg(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=>{Rg(null==t?void 0:t.retainedByteLength)&&(n+=t.retainedByteLength)}))}))})),n}function IO(t){if(z(vO,this)&&"function"==typeof z(vO,this).get)return z(vO,this).get(t)}function EO(t,e,n){const i=cm(t);if(!Number.isFinite(i))return!1;const r=am(t,z(vO,this));return(Number.isFinite(r)?i+r:Number.POSITIVE_INFINITY)>e&&i<n}function SO(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=fO(null==t?void 0:t.offset,0);r.forEach((t=>{if(!t||!Rg(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=cm(a);if(!Number.isFinite(l))continue;const c=fO(null==a?void 0:a.nodeOffsetOverride,0),u=fO(null==t?void 0:t.offset,NaN);if(!Number.isFinite(u))continue;const d=fO(null==t?void 0:t.duration,0),h=l+o+u-c,f=h+(d>0?d:0),p=am(a,z(vO,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 AO=new WeakMap,NO=new WeakMap,MO=new WeakMap,FO=new WeakSet;class OO extends sd{get name(){return"DocumentVisibility"}get defaults(){return{autoPauseOnVisibilityChange:!0,autoResumeOnVisibilityChange:!0}}constructor(t,e={}){super(e),j(this,FO),W(this,AO,void 0),W(this,NO,null),W(this,MO,!1),U(AO,this,t),L(FO,this,PO).call(this)}onDispose(){L(FO,this,CO).call(this),U(AO,this,null),U(MO,this,!1)}}function PO(){const t=null==cd?void 0:cd.document;t&&"function"==typeof t.addEventListener&&(U(NO,this,(()=>L(FO,this,DO).call(this))),t.addEventListener("visibilitychange",z(NO,this)))}function CO(){const t=null==cd?void 0:cd.document;z(NO,this)&&t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",z(NO,this)),U(NO,this,null)}function DO(){const t=null==cd?void 0:cd.document,e=null==t?void 0:t.visibilityState;"string"==typeof e&&("hidden"!==e?"visible"===e&&L(FO,this,LO).call(this):L(FO,this,RO).call(this))}function RO(){var t;(null===(t=this.settings)||void 0===t?void 0:t.autoPauseOnVisibilityChange)&&z(AO,this)&&"function"==typeof z(AO,this).pause&&(z(AO,this).state===dv?(this.log.info("[#handleHidden] Pausing timeline due to document visibility change"),z(AO,this).pause(),U(MO,this,!0)):U(MO,this,!1))}function LO(){var t;z(MO,this)&&(null===(t=this.settings)||void 0===t?void 0:t.autoResumeOnVisibilityChange)&&z(AO,this)&&"function"==typeof z(AO,this).play&&(z(AO,this).state!==dv?(this.log.info("[#handleVisible] Resuming timeline due to document visibility change"),z(AO,this).play(),U(MO,this,!1)):U(MO,this,!1))}const BO=[{event:"canplay",once:!0,trackAs:"canplay"},{event:"playing",once:!0,trackAs:"startedplaying"},"play","playing","waiting","pause","seeking","seeked","nodestart","nodeend"];function zO(t,e=0){return Number.isFinite(t)?t:e}function WO(t){const e=null==t?void 0:t.exposedPlayerAPI;return e&&"object"==typeof e?e:t}const UO=[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:zO(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:zO(null==r?void 0:r.volume),playercontainerwidth:zO(null==r?void 0:r.containerWidth),playercontainerheight:zO(null==r?void 0:r.containerHeight)}}}},function(t){return{schema:"iglu:com.helloeko/currentnode/jsonschema/1-0-1",match:/^.*$/,getData:()=>{var e;const n=WO(t),i=function(t){const e=WO(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==cd||null===(t=cd.eko)||void 0===t||null===(t=t.environment)||void 0===t?void 0:t.embeddingApp;return e?{embeddingapp:e}:{}}}}],jO=Object.freeze({once:!1,trackAs:""});var $O=new WeakMap,qO=new WeakMap,VO=new WeakMap,GO=new WeakMap,HO=new WeakSet;class KO extends sd{get name(){return"Tracker"}get defaults(){return{trackingEnabled:Iy("trackingEnabled"),defaultForwarders:BO,defaultContextPackers:UO}}constructor(t,e={}){super(e),j(this,HO),W(this,$O,void 0),W(this,qO,new Map),W(this,VO,[]),W(this,GO,!1),U($O,this,t),L(HO,this,tP).call(this),L(HO,this,XO).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=L(HO,this,nP).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=L(HO,this,nP).call(this);n&&n("registerContextPacker",e)}onDispose(){L(HO,this,ZO).call(this),L(HO,this,eP).call(this),U($O,this,null),U(GO,this,!1)}}function XO(){(Array.isArray(this.settings.defaultForwarders)?this.settings.defaultForwarders:[]).forEach((t=>L(HO,this,YO).call(this,t)))}function YO(t){const e=L(HO,this,QO).call(this,t);if(!e)return void this.log.warn("[#addEventForwarder] Invalid forwarder input.",t);const n=z($O,this);if(!n||"function"!=typeof n.on)return;const i=L(HO,this,JO).call(this,e);if(z(qO,this).has(i))return;const r=(...t)=>{e.once&&n&&"function"==typeof n.off&&n.off(e.event,r);const i=e.trackAs||e.event;this.track(i,...t)};n.on(e.event,r),z(qO,this).set(i,{event:e.event,listener:r})}function QO(t){return"string"==typeof t&&t?{event:t,...jO}: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 JO({event:t,once:e,trackAs:n}){return`${t}:${e}:${n}`}function ZO(){const t=z($O,this);t&&"function"==typeof t.off&&z(qO,this).forEach((({event:e,listener:n})=>{t.off(e,n)})),z(qO,this).clear()}function tP(){(Array.isArray(this.settings.defaultContextPackers)?this.settings.defaultContextPackers:[]).forEach((t=>{if("function"!=typeof t)return;const e=t(z($O,this),this);e&&"object"==typeof e&&("function"==typeof e.dispose&&z(VO,this).push(e.dispose),e.disabled||this.registerContextPacker({schema:e.schema,match:e.match,getData:e.getData}))}))}function eP(){z(VO,this).forEach((t=>{try{t()}catch(t){this.log.warn("[#teardownContextPackers] Failed disposing context packer.",t)}})),U(VO,this,[])}function nP(){const t=null==cd?void 0:cd.EkoAnalytics;return"function"==typeof t?t:(L(HO,this,iP).call(this),null)}function iP(){this.settings.trackingEnabled&&!z(GO,this)&&(this.log.warn("EkoAnalytics not found on window."),U(GO,this,!0))}class rP{#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 dd(t,e),this.#it=new bd(this.#E,e),this.#rt=new Sk(e),this.#ot=new Oy(e),this.#st=new lk(this.#ot,e),this.#at=new ik(this.#st,this.#rt,e),this.#lt=new vk(this.#at,e),this.#ct=new NM(this.#at,e),this.#ut=new OO(this.#ct,e),this.#bt=new kO(this.#ct,this.#at,e),this.#dt=new fx(this.#at,this.#lt,this.#rt,this.#ct,e),this.#ht=new Jx(this.#at,this.#lt,this.#ct,e),this.#ft=new QI(e),this.#pt=new wE(this.#at,this.#ct,this.#ft,e),this.#vt=new XF(this.#ct,e),this.#kt=new KO(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 eg(this.#ct,this.#E,this.#it,e),this.#mt=o?o({timeline:this.#ct,decodeCoordinator:this.#pt,options:e}):new rA(this.#ct,this.#pt,e),this.#yt=new TS(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 oP="temporal-queue-autoscaling.1153253";var sP={isPlainObject:ed,deepMerge:nd,get:ry,set:oy,ekoGlobalStore:sy,download:xy,isPositiveNumber:Rg,clamp01:om,root:cd,now:ly,getFrameDimensions:SN,useragent:ov,requestAnimationFrame:Dk,cancelAnimationFrame:Rk,start:Vk,stop:Gk,isTicking:Hk,predicator:function(t,e){const n=e||{};if("function"!=typeof t)return void Lk.error("[predicator] Bad argument given to predicator, first argument must be a function.",arguments);if(t.apply())return Lk.debug("[predicator] Invoking onFulfilled immediately."),void("function"==typeof n.onFulfilled&&n.onFulfilled.call(null,0));const i=n.timeout||1e4,r=n.interval,o=ly();let s,a,l,c,u;c=function(){t.apply()&&l()},l=function(){Gk(c),cd.clearTimeout(s),u=ly()-o,Lk.debug("[predicator] Invoking onFulfilled after "+u+" ms."),"function"==typeof n.onFulfilled&&n.onFulfilled.call(null,u)},a=function(){Gk(c),u=ly()-o,Lk.debug("[predicator] Invoking onTimeout after "+u+" ms."),"function"==typeof n.onTimeout&&n.onTimeout.call(null,u)},s=cd.setTimeout(a,i),Vk(c,r)},createThrottler:Kk,scheduleExecution:Xk},aP=new WeakMap,lP=new WeakMap,cP=new WeakMap,uP=new WeakMap,dP=new WeakMap,hP=new WeakMap,fP=new WeakMap,pP=new WeakSet;class mP{constructor(t){j(this,pP),W(this,aP,[]),W(this,lP,[]),W(this,cP,new GN("placement-")),W(this,uP,new GN("renderplacement-")),W(this,dP,void 0),W(this,hP,new Map),W(this,fP,void 0),U(dP,this,t),U(fP,this,{allowUnready:!0,getNode:t=>L(pP,this,vP).call(this,t)})}get placements(){return z(aP,this).slice()}get renderPlacements(){return z(lP,this).slice()}getNodesAtTime(t){L(pP,this,gP).call(this);const e=L(pP,this,bP).call(this,t);if(!Number.isFinite(e))return[];const n=z(aP,this).filter((t=>um(t,e,null,z(fP,this)))),i=[];return n.forEach((t=>{const e=L(pP,this,vP).call(this,null==t?void 0:t.nodeId);e&&i.push(e)})),i}placeOnTimeline(t,e,n={}){const i=t&&"object"==typeof t?t:null,r=i?i.id:t;if(!r)throw new Error("TimelineDefinition.placeOnTimeline requires node id");i&&z(hP,this).set(r,i);const o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=mm(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}:pm(e,n);let u,d,h,f=!1;const p=null!==a;if(a){const t=z(aP,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=cm(t);if("start"===a.anchor)Number.isFinite(e)?u=e:f=!0;else{const n=L(pP,this,yP).call(this,t);Number.isFinite(e)&&n>0?u=e+n:f=!0}}else if(l){const t=n.offsetAnchorPlacementId?z(aP,this).find((t=>(null==t?void 0:t.placementId)===n.offsetAnchorPlacementId)):z(aP,this).length?z(aP,this)[z(aP,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==t?void 0:t.placementId),d){const e=cm(t),n=L(pP,this,yP).call(this,t);Number.isFinite(e)&&n>0?u=e+n-c:(f=!0,h="end")}else u=-c}else u=fm(e);const m=z(cP,this).claim(n.placementId),v={placementId:m,nodeId:r,offset:u,offsetPending:f,offsetAnchorPlacementId:f?d:void 0,offsetAnchorEdge:f?h:void 0,offsetAnchorIsReference:f?p:void 0,offsetEndSeconds:l?c:a&&"end"===a.anchor?0:void 0,nodeOffsetOverride:o,nodeDurationOverride:s,loop:!0===n.loop};return z(aP,this).push(v),dm(z(aP,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=mm(e);if("string"==typeof e&&e.includes("@")&&!c)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires valid placement reference");const u=null!==c;if(c){const t=z(aP,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=cm(t);if("start"===c.anchor)Number.isFinite(e)?o=e:l=!0;else{const n=L(pP,this,yP).call(this,t);Number.isFinite(e)&&Number.isFinite(n)?o=e+n:l=!0}}else o=fm(e);const d=z(uP,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;vm(z(lP,this),t,e,"TimelineDefinition.placeRenderNodeOnTimeline does not allow overlapping render nodes")}return z(lP,this).push(m),dm(z(lP,this)),d}}function vP(t){if(t)return z(dP,this)&&"function"==typeof z(dP,this).get?z(dP,this).get(t):z(hP,this).get(t)}function gP(){return hm(z(aP,this),{getPlacementDuration:t=>L(pP,this,yP).call(this,t)}).updated}function yP(t){return am(t,null,z(fP,this))}function bP(t){if("end"===t){const t=L(pP,this,kP).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 kP(){let t;return z(aP,this).forEach((e=>{const n=cm(e);if(!Number.isFinite(n))return;const i=L(pP,this,yP).call(this,e);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(t)||r>t)&&(t=r)})),t}const xP=new Set(["canplay","play","playing","waiting","pause","seeking","seeked"]);var wP=new WeakMap,_P=new WeakMap,TP=new WeakMap,IP=new WeakMap,EP=new WeakMap,SP=new WeakMap,AP=new WeakMap,NP=new WeakMap,MP=new WeakMap,FP=new WeakMap,OP=new WeakMap,PP=new WeakMap,CP=new WeakMap,DP=new WeakMap,RP=new WeakMap,LP=new WeakMap,BP=new WeakMap,zP=new WeakMap,WP=new WeakMap,UP=new WeakMap,jP=new WeakMap,$P=new WeakMap,qP=new WeakMap,VP=new WeakMap,GP=new WeakMap,HP=new WeakSet;class KP extends sd{get name(){return"EkoPlayer"}get exposedPlayerAPI(){return z(IP,this)}constructor(t,e={}){const{options:n,publicOptions:i}=function(t={}){const e=nd({},_y,t);Object.entries(wy).forEach((([t,{targetPaths:n}])=>{void 0!==e[t]&&n.forEach((n=>{void 0===ry(e,n)&&oy(e,n,e[t])}))}));const n=function(t){const e={};return Object.keys(wy).forEach((n=>{Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})),Object.freeze(e)}(e);return Ty.info("Processed options:",e),Ty.info("Public options:",n),{options:e,publicOptions:n}}(e);return super(n),j(this,HP),W(this,wP,void 0),W(this,_P,void 0),W(this,TP,void 0),W(this,IP,void 0),W(this,EP,void 0),W(this,SP,void 0),W(this,AP,void 0),W(this,NP,void 0),W(this,MP,void 0),W(this,FP,void 0),W(this,OP,void 0),W(this,PP,void 0),W(this,CP,void 0),W(this,DP,void 0),W(this,RP,void 0),W(this,LP,void 0),W(this,BP,void 0),W(this,zP,void 0),W(this,WP,void 0),W(this,UP,void 0),W(this,jP,void 0),W(this,$P,void 0),W(this,qP,void 0),W(this,VP,void 0),W(this,GP,0),U(TP,this,i),this.log.info("Initializing EkoPlayer with options:",i),U(PP,this,new rP(t,n,this)),L(HP,this,rC).call(this,z(PP,this)),U(RP,this,(t=>L(HP,this,XP).call(this,t))),z(_P,this)&&"function"==typeof z(_P,this).on&&z(_P,this).on(sv.TIMELINE_CUEPOINT,z(RP,this)),U(LP,this,null),U(zP,this,(t=>L(HP,this,YP).call(this,t))),U(WP,this,(t=>{const e=t&&"object"==typeof t?t:{};L(HP,this,YP).call(this,{...e,event:"seeking"})})),U(UP,this,(t=>{const e=t&&"object"==typeof t?t:{};L(HP,this,YP).call(this,{...e,event:"seeked"})})),z(_P,this)&&"function"==typeof z(_P,this).on&&(z(_P,this).on(sv.TIMELINE_PLAYER_STATE,z(zP,this)),z(_P,this).on(sv.TIMELINE_SEEKING,z(WP,this)),z(_P,this).on(sv.TIMELINE_SEEKED,z(UP,this))),U(qP,this,(t=>{const e=t&&"object"==typeof t?t:{};this.trigger(sv.CONTAINER_RESIZE,e)})),z(CP,this)&&"function"==typeof z(CP,this).on&&z(CP,this).on(sv.CONTAINER_RESIZE,z(qP,this)),L(HP,this,tC).call(this),L(HP,this,ZP).call(this),U(IP,this,L(HP,this,iC).call(this)),z(IP,this)}onDispose(){z(_P,this)&&"function"==typeof z(_P,this).off&&z(RP,this)&&z(_P,this).off(sv.TIMELINE_CUEPOINT,z(RP,this)),U(RP,this,null),z(_P,this)&&"function"==typeof z(_P,this).off&&(z(zP,this)&&z(_P,this).off(sv.TIMELINE_PLAYER_STATE,z(zP,this)),z(WP,this)&&z(_P,this).off(sv.TIMELINE_SEEKING,z(WP,this)),z(UP,this)&&z(_P,this).off(sv.TIMELINE_SEEKED,z(UP,this))),U(zP,this,null),U(WP,this,null),U(UP,this,null),U(LP,this,null),z(CP,this)&&"function"==typeof z(CP,this).off&&z(qP,this)&&z(CP,this).off(sv.CONTAINER_RESIZE,z(qP,this)),U(qP,this,null),z(OP,this)&&"function"==typeof z(OP,this).off&&(z(jP,this)&&z(OP,this).off("qoescore",z(jP,this)),z($P,this)&&z(OP,this).off("qoestatus",z($P,this))),U(jP,this,null),U($P,this,null),z(FP,this)&&"function"==typeof z(FP,this).off&&z(VP,this)&&z(FP,this).off(sv.DECODER_ERROR,z(VP,this)),U(VP,this,null),U(GP,this,0),z(DP,this)&&"function"==typeof z(DP,this).dispose&&z(DP,this).dispose(),U(DP,this,null),z(PP,this)&&"function"==typeof z(PP,this).dispose&&z(PP,this).dispose(),U(_P,this,null),U(wP,this,null),U(SP,this,null),U(AP,this,null),U(NP,this,null),U(MP,this,null),U(FP,this,null),U(OP,this,null),U(CP,this,null),U(EP,this,null),U(IP,this,null),U(PP,this,null)}}function XP(t={}){var e;this.trigger(sv.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 YP(t={}){const e="string"==typeof(null==t?void 0:t.event)?t.event:"";if(!xP.has(e))return;if("playing"!==e||Number.isFinite(z(BP,this))||(U(BP,this,ly()),this.log.info(`[#handlePlayerStateEvent] Playback started @ ${(z(BP,this)/1e3).toFixed(3)}s (${Date.now()})`)),z(LP,this)===e)return;U(LP,this,e);const n=Number.isFinite(null==t?void 0:t.time)?t.time:z(_P,this)&&Number.isFinite(z(_P,this).currentTime)?z(_P,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 QP(){return new mP(z(wP,this))}function JP(t){if(!t||"object"!=typeof t)throw new Error("EkoPlayer.switchTimeline requires a timeline definition");if(!z(_P,this)||"function"!=typeof z(_P,this).applyTimelineDefinition)throw new Error("EkoPlayer.switchTimeline requires an active timeline");z(_P,this).applyTimelineDefinition(t),"function"==typeof z(_P,this).play&&z(_P,this).play()}function ZP(){z(OP,this)&&"function"==typeof z(OP,this).on&&(U(jP,this,(t=>{this.trigger(sv.QOE_SCORE,t)})),U($P,this,(t=>{this.trigger(sv.QOE_STATUS,t)})),z(OP,this).on(sv.QOE_SCORE,z(jP,this)),z(OP,this).on(sv.QOE_STATUS,z($P,this)))}function tC(){z(FP,this)&&"function"==typeof z(FP,this).on&&(U(VP,this,(t=>{const e=t&&"object"==typeof t?t:{error:t};this.trigger(sv.DECODER_ERROR,e),L(HP,this,eC).call(this,e)})),z(FP,this).on(sv.DECODER_ERROR,z(VP,this)))}function eC(t={}){var e;const n=z(_P,this);if(!n||"number"!=typeof n.currentTime)return;const i=Date.now();if(i<z(GP,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;U(GP,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 nC(t={}){if(z(DP,this))return z(DP,this);const e=t&&"object"==typeof t&&!Array.isArray(t)?{...t}:{},n=z(EP,this)&&z(EP,this).element?z(EP,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==cd?void 0:cd.document)){if(ud(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 ud(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 import("./debug-overlay-BIxN1VnC.esm.js"),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=z(TP,this),e.playerVersion=oP,U(DP,this,o({mountElement:i,canvasElement:n,timeline:z(_P,this),getNode:t=>z(wP,this)&&"function"==typeof z(wP,this).get?z(wP,this).get(t):void 0,listNodes:()=>z(wP,this)&&"function"==typeof z(wP,this).list?z(wP,this).list():[],downloadSpeed:z(PP,this)?z(PP,this).downloadSpeed:void 0,downloadEvents:ty,qoe:z(OP,this)?z(OP,this).publicAPI:void 0,qoeEvents:this,options:e,playbackStartedAtMs:z(BP,this)})),z(DP,this)}function iC(){const t=this;return{createTimeline:()=>L(HP,t,QP).call(t),switchTimeline:e=>L(HP,t,JP).call(t,e),play:z(_P,this).play,pause:z(_P,this).pause,reset:z(_P,this).reset,placeOnTimeline:z(_P,this).placeOnTimeline,placeRenderNodeOnTimeline:z(_P,this).placeRenderNodeOnTimeline,addNode:z(wP,this).add,getNode:z(wP,this).get,listNodes:z(wP,this).list,getNodesAtTime:e=>z(_P,t).getNodesAtTime(e),dispose:this.dispose,on:t.on,off:t.off,once:t.once,trigger:t.trigger,transitionTo:(e,n)=>z(AP,t).transitionTo(e,n),track:(e,...n)=>{if(z(MP,t)&&"function"==typeof z(MP,t).track)return z(MP,t).track(e,...n)},seekToPlacement:e=>z(_P,t).seekToPlacement(e),get currentTime(){return z(_P,t).currentTime},set currentTime(e){z(_P,t).currentTime=e},get buffered(){return z(_P,t).buffered},get options(){return z(TP,t)},get containerWidth(){return z(CP,t)?z(CP,t).containerWidth:0},get containerHeight(){return z(CP,t)?z(CP,t).containerHeight:0},get playbackRate(){return z(_P,t).playbackRate},set playbackRate(e){z(_P,t).playbackRate=e},get paused(){return!!z(_P,t)&&!0===z(_P,t).paused},get muted(){return!!z(NP,t)&&z(NP,t).muted},set muted(e){z(NP,t)&&(z(NP,t).muted=e)},get volume(){return z(NP,t)?z(NP,t).volume:1},set volume(e){z(NP,t)&&(z(NP,t).volume=e)},get qoe(){return z(OP,t)?z(OP,t).publicAPI:void 0},get utils(){return sP},get version(){return oP},loadDebugOverlay:(...e)=>L(HP,t,nC).call(t,...e)}}function rC(t){t&&(U(EP,this,t.canvas),U(wP,this,t.nodeRepository),U(_P,this,t.timeline),U(NP,this,t.audioAdapter||t.audioPlaybackManager),U(MP,this,t.tracker),U(FP,this,t.parsingManager),U(OP,this,t.qoe),U(SP,this,t.renderAdapter||t.renderer),U(AP,this,t.transitionManager),U(CP,this,t.containerSize))}class oC{constructor({target:t,props:e}){if(!t)throw new Error("`options.target` is required");Eo(this.#xt,e,!0),this.#xt.v.EkoPlayer=KP;const n=t.hasChildNodes()?pa:fa;this.#wt=n(Du,{target:t,props:this.#xt.v})}#wt;#xt=Ri(To(Oo({})),"EkoGallery.#props");destroy(t){if(this.#wt)return ya(this.#wt,t)}get props(){return Vs(this.#xt)}}const sC=b("gallery-react");const aC=a(((t,i)=>{const{config:r,debug:a,ssrHtml:c,activeItem:u={index:0,step:0},forceMobile:d,videoAspectRatio:h,onEvent:f=()=>{}}=t,p=n(null),m=n({}),v=function(t){return void 0!==t}(r),g=n(u),y=n(c);m.current.initEventSent||(f("galleryinit"),m.current.initEventSent=!0);const b=o((t=>{m.current.state=t,t.activeItemIndex===g.current.index&&t.activeModuleIndex===g.current.step||f("activeitemchanged",{index:t.activeItemIndex,step:t.activeModuleIndex})}),[]),k=o((t=>{m.current.API=t,0===u.index&&0===u.step||t.selectItemAndStep(u.index,u.step),m.current.unsubscribe&&m.current.unsubscribe(),m.current.unsubscribe=t.subscribe(b)}),[]),x=o(((t,e)=>{f(t,e)}),[f]);return s((()=>(sC.setDataStorage("gallery-react",{config:r}),window.eko=window.eko||{},window.eko.config=r,window.eko.gallery={version:"temporal-queue-autoscaling/4.0.4"},()=>{window.eko.config=void 0})),[r]),l(i,(()=>({prev:()=>{var t;null===(t=m.current.API)||void 0===t||t.prev()},next:()=>{var t;null===(t=m.current.API)||void 0===t||t.next()}}))),s((()=>{if(null==p||!p.current)return;const t=p.current;return m.current.app=new oC({target:t,props:{config:r,forceMobile:d,videoAspectRatio:h,hideNav:!0,onGalleryReady:k,onEvent:x}}),()=>{var t;null===(t=m.current.app)||void 0===t||t.destroy()}}),[]),s((()=>{m.current.app&&(m.current.app.props.config=r)}),[r]),s((()=>{m.current.app&&(m.current.app.props.debug=a,m.current.app.props.forceMobile=d,m.current.app.props.videoAspectRatio=h,m.current.app.props.onEvent=x)}),[a,d,h,x]),s((()=>{g.current=u,m.current.state&&(m.current.state.activeItemIndex===u.index&&m.current.state.activeModuleIndex===u.step||m.current.API.selectItemAndStep(u.index,u.step))}),[u]),v?e.createElement("div",q({style:{position:"relative",width:"100%",height:"100%"},ref:p},y.current?{dangerouslySetInnerHTML:{__html:y.current}}:{})):t.children}));aC.propTypes={className:Pt.string,config:Pt.object,variantId:Pt.string,onEvent:Pt.func,ssrHtml:Pt.string,videoAspectRatio:Pt.string,debug:Pt.bool,activeItem:Pt.shape({index:Pt.number,step:Pt.number}),forceMobile:Pt.bool,instanceId:Pt.string,children:Pt.node},aC.displayName="EkoGallerySvelte";const lC=d("v2"),cC=d("v1");export{hn as E,j as _,W as a,U as b,z as c,L as d,u as e,cC as f,lC as g,aC as h,R as w};
|
|
14
|
+
*/var bt=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;var i=Object.getOwnPropertyNames(e).map((function(t){return e[t]}));if("0123456789"!==i.join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(t){r[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,i,r=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),o=1;o<arguments.length;o++){for(var s in n=Object(arguments[o]))gt.call(n,s)&&(r[s]=n[s]);if(vt){i=vt(n);for(var a=0;a<i.length;a++)yt.call(n,i[a])&&(r[i[a]]=n[i[a]])}}return r},kt="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",xt=Function.call.bind(Object.prototype.hasOwnProperty),wt=function(){};if("production"!==process.env.NODE_ENV){var _t=kt,Tt={},It=xt;wt=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(t){}}}function Et(t,e,n,i,r){if("production"!==process.env.NODE_ENV)for(var o in t)if(It(t,o)){var s;try{if("function"!=typeof t[o]){var a=Error((i||"React class")+": "+n+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof t[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw a.name="Invariant Violation",a}s=t[o](e,o,i,n,null,_t)}catch(t){s=t}if(!s||s instanceof Error||wt((i||"React class")+": type specification of "+n+" `"+o+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof s+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),s instanceof Error&&!(s.message in Tt)){Tt[s.message]=!0;var l=r?r():"";wt("Failed "+n+" type: "+s.message+(null!=l?l:""))}}}Et.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(Tt={})};var St=Et,At=function(){};function Nt(){return null}"production"!==process.env.NODE_ENV&&(At=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(t){}});var Mt=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(Nt),arrayOf:function(t){return l((function(e,n,i,r,o){if("function"!=typeof t)return new a("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside arrayOf.");var s=e[n];if(!Array.isArray(s))return new a("Invalid "+r+" `"+o+"` of type `"+h(s)+"` supplied to `"+i+"`, expected an array.");for(var l=0;l<s.length;l++){var c=t(s,l,i,r,o+"["+l+"]",kt);if(c instanceof Error)return c}return null}))},element:l((function(e,n,i,r,o){var s=e[n];return t(s)?null:new a("Invalid "+r+" `"+o+"` of type `"+h(s)+"` supplied to `"+i+"`, expected a single ReactElement.")})),elementType:l((function(t,e,n,i,r){var o=t[e];return mt.isValidElementType(o)?null:new a("Invalid "+i+" `"+r+"` of type `"+h(o)+"` supplied to `"+n+"`, expected a single ReactElement type.")})),instanceOf:function(t){return l((function(e,n,i,o,s){if(!(e[n]instanceof t)){var l=t.name||r;return new a("Invalid "+o+" `"+s+"` of type `"+(((c=e[n]).constructor&&c.constructor.name?c.constructor.name:r)+"` supplied to `")+i+"`, expected instance of `"+l+"`.")}var c;return null}))},node:l((function(t,e,n,i,r){return d(t[e])?null:new a("Invalid "+i+" `"+r+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(t){return l((function(e,n,i,r,o){if("function"!=typeof t)return new a("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var s=e[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected an object.");for(var c in s)if(xt(s,c)){var u=t(s,c,i,r,o+"."+c,kt);if(u instanceof Error)return u}return null}))},oneOf:function(t){if(!Array.isArray(t))return"production"!==process.env.NODE_ENV&&At(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."),Nt;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&&At("Invalid argument supplied to oneOfType, expected an instance of array."),Nt;for(var e=0;e<t.length;e++){var n=t[e];if("function"!=typeof n)return At("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+p(n)+" at index "+e+"."),Nt}return l((function(e,n,i,r,o){for(var s=[],l=0;l<t.length;l++){var c=(0,t[l])(e,n,i,r,o,kt);if(null==c)return null;c.data&&xt(c.data,"expectedType")&&s.push(c.data.expectedType)}return new a("Invalid "+r+" `"+o+"` supplied to `"+i+"`"+(s.length>0?", expected one of type ["+s.join(", ")+"]":"")+".")}))},shape:function(t){return l((function(e,n,i,r,o){var s=e[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected `object`.");for(var c in t){var d=t[c];if("function"!=typeof d)return u(i,r,o,c,f(d));var p=d(s,c,i,r,o+"."+c,kt);if(p)return p}return null}))},exact:function(t){return l((function(e,n,i,r,o){var s=e[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected `object`.");var c=bt({},e[n],t);for(var d in c){var p=t[d];if(xt(t,d)&&"function"!=typeof p)return u(i,r,o,d,f(p));if(!p)return new a("Invalid "+r+" `"+o+"` key `"+d+"` supplied to `"+i+"`.\nBad object: "+JSON.stringify(e[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(t),null," "));var m=p(s,d,i,r,o+"."+d,kt);if(m)return m}return null}))}};function s(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}function a(t,e){this.message=t,this.data=e&&"object"==typeof e?e:{},this.stack=""}function l(t){if("production"!==process.env.NODE_ENV)var n={},i=0;function o(o,s,l,c,u,d,h){if(c=c||r,d=d||l,h!==kt){if(e){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var p=c+":"+l;!n[p]&&i<3&&(At("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+c+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),n[p]=!0,i++)}}return null==s[l]?o?null===s[l]?new a("The "+u+" `"+d+"` is marked as required in `"+c+"`, but its value is `null`."):new a("The "+u+" `"+d+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:t(s,l,c,u,d)}var s=o.bind(null,!1);return s.isRequired=o.bind(null,!0),s}function c(t){return l((function(e,n,i,r,o,s){var l=e[n];return h(l)!==t?new a("Invalid "+r+" `"+o+"` of type `"+f(l)+"` supplied to `"+i+"`, expected `"+t+"`.",{expectedType:t}):null}))}function u(t,e,n,i,r){return new a((t||"React class")+": "+e+" type `"+n+"."+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+r+"`.")}function d(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(d);if(null===e||t(e))return!0;var r=function(t){var e=t&&(n&&t[n]||t[i]);if("function"==typeof e)return e}(e);if(!r)return!1;var o,s=r.call(e);if(r!==e.entries){for(;!(o=s.next()).done;)if(!d(o.value))return!1}else for(;!(o=s.next()).done;){var a=o.value;if(a&&!d(a[1]))return!1}return!0;default:return!1}}function h(t){var e=typeof t;return Array.isArray(t)?"array":t instanceof RegExp?"object":function(t,e){return"symbol"===t||!!e&&("Symbol"===e["@@toStringTag"]||"function"==typeof Symbol&&e instanceof Symbol)}(e,t)?"symbol":e}function f(t){if(null==t)return""+t;var e=h(t);if("object"===e){if(t instanceof Date)return"date";if(t instanceof RegExp)return"regexp"}return e}function p(t){var e=f(t);switch(e){case"array":case"object":return"an "+e;case"boolean":case"date":case"regexp":return"a "+e;default:return e}}return a.prototype=Error.prototype,o.checkPropTypes=St,o.resetWarningCache=St.resetWarningCache,o.PropTypes=o,o};function Ft(){}function Ot(){}Ot.resetWarningCache=Ft;var Ct=V((function(t){if("production"!==process.env.NODE_ENV){var e=mt;t.exports=Mt(e.isElement,!0)}else t.exports=function(){function t(t,e,n,i,r,o){if(o!==kt){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function e(){return t}t.isRequired=t;var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:Ot,resetWarningCache:Ft};return n.PropTypes=n,n}()}));const Pt=/https?:\/\/(.*?\.)?eko.com/,Dt={"eko.project.interaction":"interaction","eko.project.swipe":"swipe"};let Rt=null,Lt=null,Bt=[];function zt(t){return e=>{var n;if(!Pt.test(e.origin)||"eko.embedapi"!==(null===(n=e.data)||void 0===n?void 0:n.source))return;const i=e.data,r=Dt[i.type];r&&(t?t(r,i.data):Bt.push({type:r,data:i.data}))}}"undefined"!=typeof window&&(Lt=zt(null),window.addEventListener("message",Lt));var Wt={subscribe:function(t){"function"==typeof t?Rt?console.warn("[eko-gallery-react] Ignoring events subscribe since already subscribed"):(Rt=t,Lt=zt(t),window.addEventListener("message",Lt),function(t){Bt.forEach((e=>{t(e.type,e.data)})),Bt=[]}(t)):console.warn("[eko-gallery-react] Ignoring events subscribe since a callback function was not provided as argument")},unsubscribe:function(){Lt?(window.removeEventListener("message",Lt),Lt=null,Rt=null,Bt=[]):console.warn("[eko-gallery-react] Ignoring events unsubscribe since not subscribed")},send:function(t,e){Rt?Rt(t,e):Bt.push({type:t,data:e})}};const jt=({index:t,activeIndex:n,setActiveIndex:i,item:r,src:o,navItemRefs:s,itemIcon:a})=>{var l,c;const u=null==r||null===(l=r.media)||void 0===l?void 0:l.srcset,d=null==r||null===(c=r.media)||void 0===c?void 0:c.sizes,h=!o&&(null==r?void 0:r.label),f=u?o:function(t,e=200){if(!t)return null;try{let n=t;t.includes("assets.eko.com")&&t.includes("/raw/")&&(n=t.replace("/raw/","/image/"));const i=new URL(n);return i.searchParams.set("width",e),i.href}catch(e){return t}}(o,150);let p=["addons-container",h?"full-thumb-label":""].join(" ").trim();return e.createElement("li",{className:"eko-nav-item","aria-current":n===t,onClick:function(){i(t),function(t){R.track("gallery.interaction",{elementid:`thumbnail-${t}`,interactiontype:"click"}),Wt.send("interaction",{elementid:`thumbnail-${t}`,interactiontype:"click"})}(t)},ref:s.current[t]},e.createElement("button",{type:"button","aria-label":`Go to item ${t}`},!h&&e.createElement("img",{src:f,srcSet:u,sizes:d,alt:null==r?void 0:r.name,loading:"eager",fetchPriority:"high"}),e.createElement("div",{className:p},(null==r?void 0:r.stepsIndication)&&e.createElement("div",{className:"step-indicator"},e.createElement("span",null),e.createElement("span",null),e.createElement("span",null)),(null==r?void 0:r.label)&&e.createElement("div",{className:"thumb-label"},null==r?void 0:r.label)),a&&e.createElement("div",{className:"item-icon"},e.createElement("span",{style:{backgroundImage:`url(${a})`}}))))};jt.propTypes={index:Ct.number,activeIndex:Ct.number,setActiveIndex:Ct.func.isRequired,item:Ct.object.isRequired,src:Ct.string,navItemRefs:Ct.object.isRequired,itemIcon:Ct.string};const Ut=({layout:t,nav:i,isVerticalNav:r,showPrevArrow:o,showNextArrow:s})=>{var a,l,c,u,d;const h=n(null),f=n(null),p="arrows"===(null==t||null===(a=t.mobile)||void 0===a||null===(a=a.config)||void 0===a||null===(a=a.navPagination)||void 0===a?void 0:a.type)?"eko-mobile-arrows":"",m="arrows"===(null!==(l=null==t||null===(c=t.desktop)||void 0===c||null===(c=c.config)||void 0===c||null===(c=c.navPagination)||void 0===c?void 0:c.type)&&void 0!==l?l:"arrows")?"eko-desktop-arrows":"",v=p||m,g=r?null==i||null===(u=i.current)||void 0===u?void 0:u.scrollHeight:null==i||null===(d=i.current)||void 0===d?void 0:d.scrollWidth;function y(t){const e=r?i.current.clientHeight:i.current.clientWidth,n=function(t,e){const n=r?e.scrollTop:e.scrollLeft;return Math.max(-n,Math.min(g-t-n,t))}("next"===t?e:-e,i.current);return{top:r?n:0,left:r?0:n,behavior:"smooth"}}function b(t){var e,n,r;const o=y(t),s="next"===t?null==f||null===(e=f.current)||void 0===e?void 0:e.id:null==h||null===(n=h.current)||void 0===n?void 0:n.id;var a,l;window.EkoAnalytics("track","gallery.interaction",{elementid:s,interactiontype:"click"}),null==i||null===(r=i.current)||void 0===r||r.scrollBy(o),a=s,l="click",R.track("gallery.interaction",{elementId:a,interactiontype:l}),Wt.send("interaction",{elementId:a,interactiontype:l})}return e.createElement(e.Fragment,null,v&&e.createElement(e.Fragment,null,e.createElement("button",q({type:"button","aria-label":"Go to previous item","aria-hidden":o?"false":"true",onClick:()=>b("prev"),ref:h,id:"eko-nav-prev-arrow",className:`eko-nav-arrow eko-prev-nav-button ${p} ${m} ${o?"":"eko-hidden-nav-button"}`},o?{}:{tabIndex:"-1"}),e.createElement("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M5.56127 9.52817C5.28966 9.22635 5.28966 8.77361 5.56127 8.502L10.39 3.67331C10.6918 3.37157 11.1445 3.37157 11.4161 3.67331C11.7179 3.94492 11.7179 4.39766 11.4161 4.66927L7.10044 8.98487L11.4161 13.3307C11.7179 13.6023 11.7179 14.055 11.4161 14.3266C11.1445 14.6285 10.6918 14.6285 10.4202 14.3266L5.56127 9.52817Z",fill:"black"}))),e.createElement("button",q({type:"button","aria-label":"Go to next item","aria-hidden":s?"false":"true",onClick:()=>b("next"),ref:f,className:`eko-nav-arrow eko-next-nav-button ${p} ${m} ${s?"":"eko-hidden-nav-button"}`,id:"eko-nav-next-arrow"},s?{}:{tabIndex:"-1"}),e.createElement("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M12.4387 8.47185C12.7103 8.77367 12.7103 9.22641 12.4387 9.49802L7.61003 14.3267C7.30821 14.6284 6.85547 14.6284 6.58386 14.3267C6.28212 14.0551 6.28212 13.6024 6.58386 13.3308L10.8996 9.01515L6.58386 4.66933C6.28212 4.39772 6.28212 3.94499 6.58386 3.67338C6.85547 3.37155 7.30821 3.37155 7.57982 3.67338L12.4387 8.47185Z",fill:"black"})))))};function $t(t,e,n){let i;return function(){const n=this,r=arguments;clearTimeout(i),i=setTimeout((function(){i=null,t.apply(n,r)}),e)}}Ut.propTypes={layout:Ct.object.isRequired,nav:Ct.object.isRequired,isVerticalNav:Ct.bool.isRequired,showPrevArrow:Ct.bool.isRequired,showNextArrow:Ct.bool.isRequired};const qt=({items:t,setActiveIndex:a,activeIndex:l,layout:c,carouselMounted:u,forceMobile:d})=>{const h=n(null),f=n(null),p=n([]),m=3,[g,y]=i(null),[b,k]=i(!1),[x,w]=i(0),[_,T]=i(!1),[I,E]=i(!1);function S(){var t;const e=d||window.innerWidth<768?"mobile":"desktop",n=(null==c||null===(t=c[e])||void 0===t||null===(t=t.config)||void 0===t?void 0:t.orientation)||("desktop"===e?"left":"bottom");k("left"===n||"right"===n);const i=f.current.parentNode,r=u?".eko-smart-gallery-container iframe":".eko-carousel",o=i.querySelector(r);setTimeout((()=>{w(o.clientHeight)}),0)}function A(){var t,e;const n=d||v()?"mobile":"desktop",i=null!==(t=null==c||null===(e=c[n])||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.navPagination)||void 0===e?void 0:e.scrollThreshold)&&void 0!==t?t:m;!function(t=m){var e,n;const i=h.current;if(!i)return;const r="none"!==(null==c||null===(e=c.desktop)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.navPagination)||void 0===e?void 0:e.type),o=(s=null==c||null===(n=c.mobile)||void 0===n||null===(n=n.config)||void 0===n||null===(n=n.navPagination)||void 0===n?void 0:n.type,"mask"===s||"arrows"===s);var s;if((d||v())&&!o)return void i.style.setProperty("-webkit-mask","none");if(!v()&&!r)return void i.style.setProperty("-webkit-mask","none");const a=i.scrollHeight-i.clientHeight,l=i.scrollTop>t?"85%":"100%",u=i.scrollTop<=a-t?"15%":"0%",f=i.scrollWidth-i.clientWidth,p=i.scrollLeft>t?"15%":"0%",g=i.scrollLeft<=f-t?"85%":"100%";b?i.style.setProperty("-webkit-mask",`linear-gradient(0deg,#0000,#000 ${u} ${l},#0000)`):i.style.setProperty("-webkit-mask",`linear-gradient(90deg,#0000,#000 ${p} ${g},#0000)`)}(i),function(t=m){var e,n,i,r,o,s;const a=b?null==h||null===(e=h.current)||void 0===e?void 0:e.scrollTop:null==h||null===(n=h.current)||void 0===n?void 0:n.scrollLeft,l=b?null==h||null===(i=h.current)||void 0===i?void 0:i.clientHeight:null==h||null===(r=h.current)||void 0===r?void 0:r.clientWidth,c=b?null==h||null===(o=h.current)||void 0===o?void 0:o.scrollHeight:null==h||null===(s=h.current)||void 0===s?void 0:s.scrollWidth;c-t<l?(T(!1),E(!1)):a<=t?(T(!1),E(!0)):a+l>c-t?(T(!0),E(!1)):a+t>0&&a<c-t&&(T(!0),E(!0))}(i)}p.current=null==t?void 0:t.map(((t,e)=>{var n,i;return null!==(n=null==p||null===(i=p.current)||void 0===i?void 0:i[e])&&void 0!==n?n:r()}));const N=$t((t=>{var e;e=t,R.track("gallery.interaction",{elementid:"nav",interactiontype:e}),Wt.send("interaction",{elementid:"nav",interactiontype:e})}),200);const M=o((t=>{a({index:t,step:0,source:"nav"})}),[]);return s((()=>{var t;y(null===(t=p.current)||void 0===t?void 0:t[l])}),[l]),s((()=>{if(null!=g&&g.current&&null!=h&&h.current){const t=g.current,e=h.current.clientWidth/2,n=t.clientWidth/2,i=h.current.clientHeight/2,r=t.clientHeight/2;h.current.scrollTo({left:t.offsetLeft-e+n,top:t.offsetTop-i+r,behavior:"smooth"})}}),[g]),s((()=>{S()}),[]),s((()=>(window.addEventListener("resize",S),()=>{window.removeEventListener("resize",S)})),[f,u,d]),s((()=>{w(0),S()}),[t,f,u,d]),s((()=>{A();const t=new ResizeObserver(A);return t.observe(h.current),()=>{t.disconnect()}}),[t,d,b]),e.createElement("div",{className:"eko-nav-container",ref:f,style:{opacity:x>0?1:0,height:""+(x&&b?x+"px":"auto")}},e.createElement(Ut,{layout:c,nav:h,isVerticalNav:b,showPrevArrow:_,showNextArrow:I}),e.createElement("ul",{className:`eko-nav eko-mobile-nav-selected-${null!==(F=null==c||null===(O=c.mobile)||void 0===O||null===(O=O.config)||void 0===O?void 0:O.navItemsSelectedType)&&void 0!==F?F:"underline"} eko-desktop-nav-selected-${null!==(C=null==c||null===(P=c.desktop)||void 0===P||null===(P=P.config)||void 0===P?void 0:P.navItemsSelectedType)&&void 0!==C?C:"underline"}`,ref:h,onScroll:function(){A()},onWheel:function(){N("wheel")},onTouchMove:function(){N("swipe")}},null==t?void 0:t.map(((t,n)=>{var i;const r=(null==t||null===(i=t.media)||void 0===i?void 0:i.url)||(null==t?void 0:t.media)||"";return e.createElement(jt,{key:r+n,index:n,activeIndex:l,setActiveIndex:M,item:t,src:r,navItemRefs:p,itemIcon:null==t?void 0:t.icon})}))));var F,O,C,P};qt.propTypes={items:Ct.array.isRequired,activeIndex:Ct.number,setActiveIndex:Ct.func.isRequired,layout:Ct.object,carouselMounted:Ct.bool,forceMobile:Ct.bool};function Vt(){R.track("gallery.cover.displayed"),Wt.send("gallerycoverdisplayed")}function Gt(t){if(!t)return t;try{const e=new URL(t);return e.host.includes("assets.eko.com")&&e.pathname.startsWith("/image")&&!e.searchParams.has("width")?(e.pathname.endsWith(".png")&&(e.pathname=e.pathname.replace(/\.png$/,".webp")),e.searchParams.set("width",1920),e.toString()):t}catch(e){return t}}const Ht=({item:t,src:i,srcset:r,sizes:o,isCoverElement:a})=>{const l=n(null);return s((()=>{var t;if(a){if(null===(t=l.current)||void 0===t||!t.complete)return l.current.addEventListener("load",Vt,{once:!0}),()=>{var t;null===(t=l.current)||void 0===t||t.removeEventListener("load",Vt,{once:!0})};Vt()}}),[]),e.createElement("img",{ref:l,src:Gt(i),srcSet:r,sizes:o,alt:t.name,fetchPriority:a?"high":"auto",loading:a?"eager":"lazy",style:{width:"100%",height:"100%"}})};Ht.propTypes={item:Ct.object.isRequired,src:Ct.string,srcset:Ct.string,sizes:Ct.string,isCoverElement:Ct.bool};const Kt=$t((t=>{var e;e=t,R.track("gallery.interaction",{elementid:"carousel",interactiontype:e}),Wt.send("interaction",{elementid:"carousel",interactiontype:e})}),200);function Xt(){Kt("wheel")}const Yt=a((({items:t,setActiveIndex:o,activeIndex:a,showSmartLoaders:c},u)=>{const d=n(null),h=n([]);h.current=null==t?void 0:t.map(((t,e)=>{var n,i;return null!==(n=null==h||null===(i=h.current)||void 0===i?void 0:i[e])&&void 0!==n?n:r()}));const[f,p]=i(),[m,v]=i(),g=n(a),y=n(!1);function b(){const e=function(t){const e=t.scrollLeft,n=t.scrollWidth-t.clientWidth;return 0===e?0:e>n?100:e/n*100}(d.current)*(null==t?void 0:t.length)/100,n=Math.min(Math.trunc(e),(null==t?void 0:t.length)-1),i=g.current;"nav"!==i.source&&"external-nav"!==i.source?(y.current&&n!==i.index&&(y.current=!1),y.current||(n>(null==t?void 0:t.length)-1?o({index:(null==t?void 0:t.length)-1,source:"carousel"}):o({index:n,source:"carousel"}))):n===i.index?y.current=!0:y.current&&n!==i.index&&(y.current=!1,o({index:n,source:"carousel"}))}return l(u,(()=>({prev:()=>{o({index:Math.max(0,g.current.index-1),source:"carousel"})},next:()=>{o({index:Math.min((null==t?void 0:t.length)-1,g.current.index+1),source:"carousel"})}}))),s((()=>{const t=d.current;if(t)return t.addEventListener("scroll",b),()=>{t.removeEventListener("scroll",b)}}),[t]),s((()=>{var t;let e=null===(t=h.current)||void 0===t?void 0:t[a.index];if(e&&("nav"===a.source||"external-nav"===a.source)){const t=e.current,n=d.current.clientWidth/2,i=(null==t?void 0:t.clientWidth)/2,r=(null==t?void 0:t.offsetLeft)-n+i;d.current.scrollTo({left:r,behavior:"smooth"})}}),[a]),s((()=>{g.current=a,"nav"!==a.source&&"external-nav"!==a.source||(y.current=!1)}),[a]),e.createElement("ul",{className:"eko-carousel",ref:d,onScroll:b,onWheel:Xt,onTouchMove:function(t){v(t.targetTouches[0].clientX)},onTouchStart:function(t){p(t.targetTouches[0].clientX),v(null)},onTouchEnd:function(){m&&f&&(f-m>75||f-m<-75)&&Kt("swipe")}},null==t?void 0:t.map(((t,n)=>{const i=(null==t?void 0:t.cover)||(null==t?void 0:t.media),r=(null==i?void 0:i.url)||i;return e.createElement("li",{className:"eko-carousel-item",key:r+n,ref:h.current[n]},e.createElement(Ht,{item:t,src:r,srcset:null==i?void 0:i.srcset,sizes:null==i?void 0:i.sizes,isCoverElement:0===n}),c&&"image"!==t.type&&e.createElement("div",{className:"eko-smart-loading"},e.createElement("div",null),e.createElement("p",null,"Loading video experience")))})))}));function Qt(t){var e;return function(t){var e;return"eko.block.event"===(null==t||null===(e=t.data)||void 0===e?void 0:e.type)}(t)&&"GalleryBlock"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.blockType)}Yt.propTypes={items:Ct.array.isRequired,setActiveIndex:Ct.func.isRequired,activeIndex:Ct.object,showSmartLoaders:Ct.bool},Yt.displayName="CarouselLoop";const Jt="eko.project.invoke",Zt="eko.block.invoke";function te(t,e,n){var i;null!=t&&t.contentWindow&&(null==t||null===(i=t.contentWindow)||void 0===i||i.postMessage({target:"eko.embedapi",type:e,data:n},"*"))}function ee(t){return`#variantId=${encodeURIComponent(t)}`}const ne=a((({config:t,instanceId:r,setActiveItem:o,activeItem:a,variantId:c,smartGalleryLoaded:u,onLoad:d,forceMobile:h},f)=>{var p,m,g;const y=null!==(p=null===(m=t.options)||void 0===m?void 0:m.galleryEnv)&&void 0!==p?p:"",b=null===(g=t.__autoGenerated)||void 0===g||null===(g=g.publishItem)||void 0===g?void 0:g.id,k=function(t={}){let e="";return Object.entries(t).forEach((([t,n])=>{e+=`&${t}=${n}`})),e}(null==t?void 0:t.qp),x=function(t,e,n){return`https://${t}play.eko.com/embed?${n?`id=${n}`:`piid=${e}`}&nocover=true&galleryBlockMode=gallery&eko_pixel=true`}(y,b,r),w=n(null),_=n(null),T=n(!1),[I,E]=i(ee(c||"ekonovar")),[S,A]=i(x+k+I);let N;function M(){R.track("gallery.project.display"),d(),Wt.send("galleryloaded")}return l(f,(()=>({prev:()=>{te(null==_?void 0:_.current,Zt,{action:"onPrevModule"})},next:()=>{te(null==_?void 0:_.current,Zt,{action:"onNextModule"})}}))),s((()=>{T.current?te(null==_?void 0:_.current,Jt,{action:"updateVariant",args:{id:c}}):E(ee(c))}),[c]),s((()=>{te(null==_?void 0:_.current,Zt,{action:"updateActiveModule",args:{activeItemIndex:null==a?void 0:a.index,activeModuleIndex:null==a?void 0:a.step}})}),[a]),s((()=>{function t(t){if((function(t){var e;return"eko.project.blockstart"===(null==t||null===(e=t.data)||void 0===e?void 0:e.type)}(t)||function(t){var e,n;return"eko.project.started"===(null==t||null===(e=t.data)||void 0===e?void 0:e.type)&&(null==t||null===(n=t.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.started)}(t))&&!T.current)return e=t.data.data.blockType,T.current=!0,void("GalleryBlock"===e?te(null==_?void 0:_.current,Zt,{action:"updateActiveModule",args:{activeItemIndex:null==a?void 0:a.index,activeModuleIndex:null==a?void 0:a.step}}):M());var e;if(T.current){if(function(t){var e;return Qt(t)&&"activeModuleChanged"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.name)}(t))return void function(t){const e=t.data.data.data.activeItemIndex,n=t.data.data.data.activeModuleIndex;e===(null==a?void 0:a.index)&&n===(null==a?void 0:a.step)||o({index:e,step:n,source:"carousel"})}(t);(function(t){var e;return Qt(t)&&"activeModuleChangeDone"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.name)})(t)&&!u&&M()}}return N=h||v()?"mobile":"desktop",function(t,e={}){window.addEventListener("message",t,e)}(t),()=>{!function(t,e={}){window.removeEventListener("message",t,e)}(t)}}),[a]),s((()=>{T.current||te(null==_?void 0:_.current,Jt,{action:"queryProjectStarted"})}),[a,u]),s((()=>{T.current=!1}),[t]),s((()=>{A(x+k+I)}),[I]),e.createElement("div",{className:"eko-smart-gallery-container "+(u?"":"eko-project-not-ready"),ref:w,"data-type":"smart-gallery","data-qp":k,"data-variant":c,"data-device":N},e.createElement("iframe",{allow:"autoplay; fullscreen",title:"eko gallery",src:S,style:{border:0},ref:_}))}));ne.propTypes={config:Ct.object.isRequired,instanceId:Ct.string,setActiveItem:Ct.func.isRequired,activeItem:Ct.object.isRequired,variantId:Ct.string,smartGalleryLoaded:Ct.bool,onLoad:Ct.func,forceMobile:Ct.bool},ne.displayName="SmartGallery";const ie=()=>e.createElement("style",{suppressHydrationWarning:!0},'.eko-gallery {\n --accentColorEko: #000;\n --primaryColorEko: #000;\n --backgroundColorEko: #25D7A2;\n --navItemsBackgroundColorEko: transparent;\n --navItemsBannerBackgroundColorEko: #EEEEEE;\n --carouselItemsBackgroundColorEko: transparent;\n --carouselInteractiveCoverBackgroundColorEko: transparent;\n --galleryGapEkoMobile: 12px;\n --galleryGapEkoDesktop: 12px;\n --galleryPaddingEkoMobile: 0;\n --galleryPaddingEkoDesktop: 0;\n --galleryMaxWidthEkoMobile: 100%;\n --galleryMaxWidthEkoDesktop: 900px;\n --galleryTransition: .8s cubic-bezier(.35, 0, 0, 1) 1.5s;\n --navBarPaddingEkoMobile: 0 0 0 20px;\n --navBarPaddingEkoDesktop: 0;\n --navItemsWidthEkoMobile: 80px;\n --navItemsWidthEkoDesktop: 80px;\n --navItemsHeightEkoMobile: 80px;\n --navItemsHeightEkoDesktop: 80px;\n --navItemsGapEkoMobile: 14px;\n --navItemsGapEkoDesktop: 14px;\n --navItemsRadiusEkoMobile: 8px;\n --navItemsRadiusEkoDesktop: 8px;\n --navItemsSelectedMarginEkoMobile: 3px;\n --navItemsSelectedMarginEkoDesktop: 3px;\n --navItemsSelectedThicknessEkoMobile: 3px;\n --navItemsSelectedThicknessEkoDesktop: 3px;\n --navItemsSelectedUnderlineRadiusEkoMobile: 100px;\n --navItemsSelectedUnderlineRadiusEkoDesktop: 100px;\n --navItemsObjectFitEkoMobile: cover;\n --navItemsObjectFitEkoDesktop: cover;\n --navMediaBadgeSizeEkoMobile: 22px;\n --navMediaBadgeSizeEkoDesktop: 22px;\n --navMediaBadgeMarginTopEkoMobile: 4px;\n --navMediaBadgeMarginTopEkoDesktop: 4px;\n --navMediaBadgeMarginRightEkoMobile: 4px;\n --navMediaBadgeMarginRightEkoDesktop: 4px;\n --carouselItemsAspectRatioEkoMobile: 1 / 1;\n --carouselItemsAspectRatioEkoDesktop: 1 / 1;\n --carouselItemsRadiusEkoMobile: 0px;\n --carouselItemsRadiusEkoDesktop: 12px;\n --carouselItemsObjectFitEkoMobile: cover;\n --carouselItemsObjectFitEkoDesktop: cover;\n --navBannerFontSizeEkoMobile: 12px;\n --navBannerFontSizeEkoDesktop: 12px;\n --navBannerFontLineHeightEkoMobile: 120%;\n --navBannerFontLineHeightEkoDesktop: 120%;\n --navBannerFontFamilyEkoMobile: inherit;\n --navBannerFontFamilyEkoDesktop: inherit;\n --navBannerFontWeightEkoMobile: 400;\n --navBannerFontWeightEkoDesktop: 400;\n --outerWidth: 0\n}\n\n.eko-gallery * {\n box-sizing: border-box\n}\n\n.eko-gallery ul,\n.eko-gallery li {\n padding: 0;\n text-indent: 0;\n list-style-type: none;\n font-size: 0;\n margin: 0\n}\n\n.eko-gallery button {\n border: none;\n padding: 0\n}\n\n.eko-gallery .eko-hidden {\n display: none !important\n}\n\n.eko-gallery .eko-not-visible {\n visibility: hidden !important\n}\n\n.eko-hidden-variant {\n display: none !important\n}\n\n.eko-sr-only {\n width: 1px;\n height: 1px;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n margin: -1px;\n padding: 0;\n position: absolute;\n overflow: hidden\n}\n\n.eko-sticky-top {\n position: sticky;\n top: 0\n}\n\n.eko-gallery .eko-nav {\n height: 100%;\n display: flex;\n align-items: start;\n align-self: start;\n flex-shrink: 0;\n scrollbar-width: none;\n -ms-overflow-style: none\n}\n\n.eko-gallery .eko-nav li {\n font-size: 0;\n position: relative;\n display: flex;\n flex-shrink: 0;\n justify-content: center;\n -webkit-box-pack: center;\n cursor: pointer\n}\n\n.eko-gallery .eko-nav li button {\n position: relative;\n background-color: transparent;\n border-radius: 0;\n line-height: 0;\n overflow: hidden;\n cursor: pointer\n}\n\n.eko-gallery .eko-nav li button img {\n background-color: var(--navItemsBackgroundColorEko);\n pointer-events: none\n}\n\n.eko-gallery .eko-nav li button .item-icon {\n position: absolute;\n top: 0;\n right: 0;\n width: 32px;\n height: 32px;\n transform: scale(.25);\n transform-origin: top right\n}\n\n.eko-gallery .eko-nav li button .item-icon span {\n display: block;\n width: 400%;\n height: 400%;\n position: absolute;\n top: 0;\n right: 0;\n background-position: top right;\n background-repeat: no-repeat;\n background-size: contain\n}\n\n.eko-gallery .eko-nav li .addons-container {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n display: flex;\n flex-direction: column;\n font-size: 10px;\n line-height: 100%\n}\n\n.eko-gallery .eko-nav li .addons-container .thumb-label {\n width: 100%;\n background: var(--navItemsBannerBackgroundColorEko);\n padding: 4px;\n text-align: center;\n text-wrap: balance;\n color: var(--primaryColorEko)\n}\n\n.eko-gallery .eko-nav li .addons-container .step-indicator {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: center;\n gap: 5px;\n padding: 6px\n}\n\n.eko-gallery .eko-nav li .addons-container .step-indicator span {\n width: 5px;\n height: 5px;\n border-radius: 100px;\n background: #fff;\n box-shadow: 0 0 3px #00000094\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label {\n position: relative\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .step-indicator {\n position: absolute;\n bottom: 0\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n align-content: center\n}\n\n.eko-gallery .eko-nav::-webkit-scrollbar {\n display: none\n}\n\n.eko-nav-container {\n display: flex\n}\n\n.eko-nav-container:has(.eko-nav.eko-not-visible) .eko-nav-arrow {\n display: none\n}\n\n.eko-nav-container {\n position: relative;\n opacity: 0;\n transition: opacity .15s ease-in\n}\n\n.eko-nav-container .eko-nav-arrow {\n width: 28px;\n height: 28px;\n position: absolute;\n display: none;\n justify-content: center;\n align-items: center;\n border-radius: 28px;\n background-color: #fff;\n box-shadow: 0 0 6px #0000001f;\n z-index: 1;\n bottom: 50%;\n opacity: 1;\n transition: opacity .15s ease-in;\n transform: translateY(50%);\n cursor: pointer\n}\n\n.eko-nav-container .eko-nav-arrow.eko-prev-nav-button svg,\n.eko-nav-container .eko-nav-arrow.eko-next-nav-button svg {\n padding: 1px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-prev-nav-button {\n left: 8px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-next-nav-button {\n right: 8px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-hidden-nav-button {\n opacity: 0;\n pointer-events: none\n}\n\n.eko-gallery .eko-nav {\n gap: var(--navItemsGapEkoMobile);\n padding: var(--navBarPaddingEkoMobile)\n}\n\n.eko-gallery .eko-nav li button img {\n width: var(--navItemsWidthEkoMobile);\n height: var(--navItemsHeightEkoMobile);\n object-fit: var(--navItemsObjectFitEkoMobile)\n}\n\n.eko-gallery .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoMobile);\n font-size: var(--navBannerFontSizeEkoMobile);\n line-height: var(--navBannerFontLineHeightEkoMobile);\n font-weight: var(--navBannerFontWeightEkoMobile)\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoMobile);\n height: var(--navItemsHeightEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li {\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile))\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoMobile);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoMobile);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoMobile) + var(--navItemsSelectedMarginEkoMobile));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoMobile) var(--accentColorEko)\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-nav {\n gap: var(--navItemsGapEkoDesktop);\n padding: var(--navBarPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li button img {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop);\n object-fit: var(--navItemsObjectFitEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoDesktop);\n font-size: var(--navBannerFontSizeEkoDesktop);\n line-height: var(--navBannerFontLineHeightEkoDesktop);\n font-weight: var(--navBannerFontWeightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li {\n border-radius: 0;\n padding: 0;\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop))\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true] {\n box-shadow: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoDesktop);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoDesktop);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoDesktop) var(--accentColorEko)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true]:after {\n content: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container .eko-nav-arrow {\n width: 30px;\n height: 30px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container .eko-nav-arrow.eko-desktop-arrows {\n display: flex\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container:has(.eko-desktop-nav-selected-underline) .eko-nav-arrow.eko-desktop-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop)) / 2))\n }\n}\n\n@media screen and (max-width: 767px) {\n .eko-gallery.eko-liquid-gallery .eko-nav-arrow.eko-mobile-arrows {\n display: flex\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container:has(.eko-mobile-nav-selected-underline) .eko-nav-arrow.eko-mobile-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile)) / 2))\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav {\n gap: var(--navItemsGapEkoDesktop);\n padding: var(--navBarPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li button img {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop);\n object-fit: var(--navItemsObjectFitEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoDesktop);\n font-size: var(--navBannerFontSizeEkoDesktop);\n line-height: var(--navBannerFontLineHeightEkoDesktop);\n font-weight: var(--navBannerFontWeightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li {\n border-radius: 0;\n padding: 0;\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop))\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true] {\n box-shadow: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoDesktop);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoDesktop);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoDesktop) var(--accentColorEko)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true]:after {\n content: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container .eko-nav-arrow {\n width: 30px;\n height: 30px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container .eko-nav-arrow.eko-desktop-arrows {\n display: flex\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container:has(.eko-desktop-nav-selected-underline) .eko-nav-arrow.eko-desktop-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop)) / 2))\n }\n}\n\n@media screen and (max-width: 767px) {\n .eko-gallery.eko-react-gallery.eko-mobile .eko-nav-arrow.eko-mobile-arrows {\n display: flex\n }\n\n .eko-gallery.eko-react-gallery.eko-mobile .eko-nav-container:has(.eko-mobile-nav-selected-underline) .eko-nav-arrow.eko-mobile-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile)) / 2))\n }\n}\n\n.eko-media-badge {\n display: none;\n width: var(--navMediaBadgeSizeEkoMobile);\n height: var(--navMediaBadgeSizeEkoMobile);\n background: #fff;\n align-items: center;\n justify-content: center;\n border-radius: 100%;\n box-shadow: 0 0 4px #00000014;\n place-content: center;\n position: absolute;\n top: var(--navMediaBadgeMarginTopEkoMobile);\n right: var(--navMediaBadgeMarginRightEkoMobile)\n}\n\n.eko-media-badge svg {\n width: 100%;\n height: 100%\n}\n\n.eko-media-badge svg path {\n fill: #000\n}\n\n.eko-nav li .eko-media-badge-mobile {\n display: flex\n}\n\nsvg.interactiveThumb {\n position: absolute;\n top: 3px;\n right: -2.5px;\n width: 100%;\n height: 100%\n}\n\nsvg.interactiveThumb.hand {\n animation: handAnim 2.5s linear infinite\n}\n\nsvg.interactiveThumb.beam {\n animation: beamAnim 2.5s linear infinite;\n transform-origin: 26% 40%;\n top: 0\n}\n\n@keyframes handAnim {\n 0% {\n transform: translateY(0)\n }\n\n 3% {\n transform: translateY(-4px)\n }\n\n 15% {\n transform: translateY(0)\n }\n\n to {\n transform: translateY(0)\n }\n}\n\n@keyframes beamAnim {\n 0% {\n transform: scale(1);\n opacity: 0\n }\n\n 5% {\n transform: scale(1.1);\n opacity: 1\n }\n\n 30% {\n transform: scale(1.4);\n opacity: 0\n }\n\n to {\n transform: scale(1.4);\n opacity: 0\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-media-badge {\n width: var(--navMediaBadgeSizeEkoDesktop);\n height: var(--navMediaBadgeSizeEkoDesktop);\n top: var(--navMediaBadgeMarginTopEkoDesktop);\n right: var(--navMediaBadgeMarginRightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .eko-media-badge-mobile {\n display: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .eko-media-badge-desktop {\n display: flex\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-media-badge {\n width: var(--navMediaBadgeSizeEkoDesktop);\n height: var(--navMediaBadgeSizeEkoDesktop);\n top: var(--navMediaBadgeMarginTopEkoDesktop);\n right: var(--navMediaBadgeMarginRightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .eko-media-badge-mobile {\n display: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .eko-media-badge-desktop {\n display: flex\n }\n}\n\n.eko-loading-animation {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow: hidden;\n pointer-events: none\n}\n\n.eko-loading-animation.eko-show-loading-animation .eko-animated-bar {\n opacity: .6\n}\n\n.eko-loading-animation.eko-show-loading-animation .eko-animated-bar .eko-animated-bar-inner {\n animation: eko-loading-bar-inner-animation 2s infinite\n}\n\n.eko-loading-animation.eko-show-loading-text .eko-loading-text {\n opacity: 1\n}\n\n.eko-loading-animation .eko-animated-bar {\n width: 100%;\n height: 4px;\n background-color: #e8e8e8b2;\n opacity: 0;\n transition: opacity .5s;\n position: relative\n}\n\n.eko-loading-animation .eko-animated-bar .eko-animated-bar-inner {\n width: 150px;\n height: 100%;\n transform: translate(-150px);\n background-color: var(--accentColorEko, #4d484b);\n display: block;\n position: absolute\n}\n\n.eko-loading-animation .eko-loading-text {\n position: absolute;\n top: 10px;\n left: 50%;\n transform: translate(-50%);\n color: #656565;\n font-size: 12px;\n font-family: Bogle-Medium, sans-serif;\n font-weight: 500;\n opacity: 0;\n align-items: center;\n display: flex;\n gap: 2px;\n transition: opacity .5s\n}\n\n.eko-loading-animation .eko-loading-text-icon {\n opacity: 60%\n}\n\n.eko-loading-animation .eko-loading-text-icon svg {\n transform: translate(2px, 2px)\n}\n\n.eko-loading-animation .eko-loading-text-icon path {\n fill: var(--accentColorEko, #4d484b)\n}\n\n.eko-loading-animation.eko-hide-icon .eko-loading-text-icon {\n display: none\n}\n\n@keyframes eko-loading-bar-inner-animation {\n 0% {\n left: -350px\n }\n\n to {\n left: calc(100% + 350px)\n }\n}\n\n.eko-smart-loading {\n position: absolute;\n top: 8px;\n left: 50%;\n transform: translate(-50%);\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px\n}\n\n.eko-smart-loading div {\n position: relative;\n width: 158px;\n height: 3px;\n background-color: #dcdcdc;\n overflow: hidden;\n opacity: 0;\n animation: eko-smart-loading-show-animation .2s linear forwards 1s\n}\n\n.eko-smart-loading div:after {\n content: "";\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background-color: #878787;\n animation: eko-smart-loading-animation 2.5s ease-in-out infinite\n}\n\n.eko-smart-loading p {\n font-size: 11px;\n line-height: 120%;\n font-weight: 500;\n color: #6b6b6b;\n text-shadow: 0 0 2px white;\n opacity: 0;\n animation: eko-smart-loading-show-animation .2s linear forwards 3s\n}\n\n@keyframes eko-smart-loading-animation {\n 0% {\n transform: translate(-100%)\n }\n\n to {\n transform: translate(100%)\n }\n}\n\n@keyframes eko-smart-loading-show-animation {\n 0% {\n opacity: 0\n }\n\n to {\n opacity: 100%\n }\n}\n\n@media screen and (min-width: 450px) {\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-animated-bar {\n height: 6px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-loading-text {\n font-size: 16px;\n top: 12px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-loading-text-icon {\n transform: rotate(180deg)\n }\n}\n\n@media screen and (min-width: 450px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-animated-bar {\n height: 6px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-loading-text {\n font-size: 16px;\n top: 12px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-loading-text-icon {\n transform: rotate(180deg)\n }\n}\n\n.eko-carousel {\n width: 100%;\n white-space: nowrap;\n overflow-x: auto;\n overflow-y: hidden;\n scroll-snap-type: x mandatory;\n overscroll-behavior-x: contain;\n align-self: start;\n align-items: start;\n display: flex;\n gap: 10px;\n scrollbar-width: none;\n -ms-overflow-style: none\n}\n\n.eko-carousel li {\n width: 100%;\n display: inline-block;\n position: relative;\n align-items: start;\n overflow: hidden;\n scroll-snap-align: center;\n scroll-snap-stop: always;\n flex-shrink: 0\n}\n\n.eko-carousel li img.eko-cover-image {\n position: relative;\n pointer-events: none;\n transition: opacity .5s;\n z-index: 1;\n width: 100%;\n height: 100%;\n background-color: var(--carouselInteractiveCoverBackgroundColorEko)\n}\n\n.eko-carousel li iframe {\n position: absolute;\n border: none;\n top: 0;\n left: 0\n}\n\n.eko-carousel li img,\n.eko-carousel li video {\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n min-width: 0;\n background-color: var(--carouselItemsBackgroundColorEko)\n}\n\n.eko-carousel li[data-type=videoembed],\n.eko-carousel li[data-type=video] {\n cursor: pointer\n}\n\n.eko-carousel::-webkit-scrollbar {\n display: none\n}\n\n.eko-carousel:has(.zoomed) {\n overflow: hidden\n}\n\n.eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoMobile)\n}\n\n.eko-carousel li img.eko-desktop-cover-image {\n display: none\n}\n\n.eko-carousel li img.eko-mobile-cover-image {\n display: inline\n}\n\n.eko-carousel li img,\n.eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoMobile);\n object-fit: var(--carouselItemsObjectFitEkoMobile)\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-carousel li img,\n .eko-gallery.eko-liquid-gallery .eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop);\n object-fit: var(--carouselItemsObjectFitEkoDesktop)\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li img,\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop);\n object-fit: var(--carouselItemsObjectFitEkoDesktop)\n }\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-nav-container {\n display: none\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-carousel {\n overflow-x: hidden\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-mobile-carousel-scroll {\n overflow-x: auto\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-nav-container {\n display: none\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-carousel {\n overflow-x: hidden\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-carousel.eko-desktop-carousel-scroll {\n overflow-x: auto\n }\n\n .eko-gallery.eko-liquid-gallery.eko-mobile-embed-layout.eko-desktop-nav-layout .eko-nav-container {\n display: flex\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-nav-container {\n display: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-carousel {\n overflow-x: hidden\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-carousel.eko-desktop-carousel-scroll {\n overflow-x: auto\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-mobile-embed-layout.eko-desktop-nav-layout .eko-nav-container {\n display: flex\n }\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-bottom .eko-nav,\n.eko-gallery.eko-desktop-nav-layout.eko-desktop-nav-bottom .eko-nav,\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-top .eko-nav,\n.eko-gallery.eko-desktop-nav-layout.eko-desktop-nav-top .eko-nav {\n flex-direction: row;\n overflow-x: auto;\n overflow-y: hidden;\n max-width: 100%;\n margin: auto\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-bottom {\n flex-direction: column-reverse\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-top {\n flex-direction: column\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-bottom {\n flex-direction: column-reverse\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-top {\n flex-direction: column\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-bottom {\n flex-direction: column-reverse\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-top {\n flex-direction: column\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right {\n flex-direction: row-reverse\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left {\n flex-direction: row\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav {\n display: flex;\n flex-direction: column;\n justify-content: start;\n overflow-x: hidden;\n overflow-y: auto;\n gap: var(--navItemsGapEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container {\n display: flex;\n flex-shrink: 0\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button {\n top: 4px;\n left: auto\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n bottom: 4px\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n right: 50%;\n transform: translate(50%)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg {\n transform: rotate(90deg)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout .eko-carousel {\n align-self: start\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right {\n flex-direction: row-reverse\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left {\n flex-direction: row\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav {\n display: flex;\n flex-direction: column;\n justify-content: start;\n overflow-x: hidden;\n overflow-y: auto;\n gap: var(--navItemsGapEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container {\n display: flex;\n flex-shrink: 0\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button {\n top: 4px;\n left: auto\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n bottom: 4px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n right: 50%;\n transform: translate(50%)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg {\n transform: rotate(90deg)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout .eko-carousel {\n align-self: start\n }\n}\n\n.eko-gallery .eko-introButton {\n cursor: pointer;\n white-space: nowrap;\n pointer-events: auto;\n position: absolute;\n bottom: 100px;\n left: 50%;\n transform: translate(-50%);\n padding: 15px 20px\n}\n\n.eko-gallery .eko-introButton .eko-handContainer {\n display: none\n}\n\n.eko-gallery {\n position: relative;\n overflow: hidden;\n display: flex;\n flex-direction: row;\n justify-content: start;\n margin-inline-start: calc(-1 * var(--outerWidth));\n margin-inline-end: calc(-1 * var(--outerWidth));\n padding: var(--galleryPaddingEkoMobile);\n margin: auto;\n max-width: var(--galleryMaxWidthEkoMobile);\n transition: height var(--galleryTransition, .8s cubic-bezier(.35, 0, 0, 1) 1.5s), padding 0s;\n gap: var(--galleryGapEkoMobile)\n}\n\n.eko-gallery .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoMobile);\n overflow: hidden;\n flex: 1;\n display: flex;\n height: fit-content\n}\n\n.eko-gallery .eko-smart-gallery-container iframe {\n width: 100%;\n aspect-ratio: var(--carouselItemsAspectRatioEkoMobile)\n}\n\n.eko-gallery .eko-smart-gallery-container.eko-project-not-ready {\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n opacity: 0;\n pointer-events: none;\n touch-action: none\n}\n\n.eko-gallery .eko-smart-gallery-container.eko-project-not-ready iframe {\n pointer-events: none;\n touch-action: none\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery {\n max-width: var(--galleryMaxWidthEkoDesktop);\n gap: var(--galleryGapEkoDesktop);\n padding: var(--galleryPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-smart-gallery-container iframe {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop)\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop {\n max-width: var(--galleryMaxWidthEkoDesktop);\n gap: var(--galleryGapEkoDesktop);\n padding: var(--galleryPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-smart-gallery-container iframe {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop)\n }\n}'),re=({layout:t,style:n})=>{let i={};return function(t={}){Object.keys(t).forEach((e=>{i[`--${e}Eko`]=t[e]}))}(n),function(t){var e,n;const r=(null==t||null===(e=t.desktop)||void 0===e?void 0:e.config)||{},o=(null==t||null===(n=t.mobile)||void 0===n?void 0:n.config)||{};Object.keys(r).forEach((t=>{"string"==typeof r[t]&&(i[`--${t}EkoDesktop`]=r[t])})),Object.keys(o).forEach((t=>{"string"==typeof o[t]&&(i[`--${t}EkoMobile`]=o[t])}))}(t),e.createElement("style",{key:{layout:t,style:n}},`.eko-gallery {${Object.keys(i).map((t=>`${t}: ${i[t]};`)).join("\n")}}`)};re.propTypes={layout:Ct.object,style:Ct.object},b("experiment");const oe=({activeVariantId:t,activeElementId:e,hasInteractive:i,experiments:r,publishItem:o})=>{const a="gallery",l=n(t),c=n(e),u=n(i),d=n(r),h=n(o);s((()=>{l.current=t,c.current=e,u.current=i,d.current=r,h.current=o}),[t,e,i,r,o]);const f={publishItemPacker:{tag:a,schema:"iglu:com.helloeko/publishitem/jsonschema/1-0-0",match:/.*/,getData:function(){const t=h.current;if(t){const e={};return null!=t&&t.id&&(e.id=t.id),null!=t&&t.productId&&(e.productid=t.productId),t.salesChannelId&&(e.saleschannelid=t.salesChannelId),null!=t&&t.salesChannelName&&(e.saleschannelname=t.salesChannelName),t.salesChannelType&&(e.saleschanneltype=t.salesChannelType),e.id?e:void 0}}},galleryInteractionPacker:{tag:a,schema:"iglu:com.helloeko/gallery_interaction/jsonschema/1-0-0",match:"gallery.interaction",getData:function({elementid:t,interactiontype:e}){return{elementid:String(t),interactiontype:e}}},galleryPacker:{tag:a,schema:"iglu:com.helloeko/gallery/jsonschema/1-0-2",match:/^gallery.*/,getData:function(){var t;return{activeitemid:c.current.toString(),activevariantid:l.current,hasinteractive:u.current,version:(null===(t=window.eko)||void 0===t||null===(t=t.gallery)||void 0===t?void 0:t.version)||""}}},activeVariantIdPacker:{tag:a,schema:"iglu:com.helloeko/variant/jsonschema/1-0-1",match:/.*/,getData:function(){if(l.current)return{id:l.current}}},experimentPacker:{tag:a,schema:"iglu:com.helloeko/experiment/jsonschema/1-0-3",match:/.*/,getData:function(){var t;let e=function(t){let e=null;if(t){const n=Math.floor(Date.now()/1e3);for(const i of t){if("deliverable"!==i.type)return;const t=Math.floor(new Date(i.startDate).getTime()/1e3),r=Math.floor(new Date(i.endDate).getTime()/1e3);!0===i.active&&n>t&&n<r&&(e=i)}}return e}(d.current);if(!e)return;let n={experimentid:e.id||"",experimentvariant:e.chosen||"pending decision",experimenttype:e.type||""},i=null===(t=e.targetDevice)||void 0===t?void 0:t.toLowerCase();return"mobile"!==i&&"notmobile"!==i||(n.experimenttargeting={device:i}),n}}};return s((()=>(Object.values(f).forEach((t=>{window.EkoAnalytics("registerContextPacker",t)})),()=>{window.EkoAnalytics("reset",a)})),[]),null};oe.propTypes={activeVariantId:Ct.string,activeElementId:Ct.number,hasInteractive:Ct.bool,experiments:Ct.array,publishItem:Ct.object};const se=({variantId:t,activeItem:i,hasInteractive:r,activeIndex:o,experiments:a,publishItem:l})=>{const c=n(!0);return s((()=>{c.current||t&&R.track("gallery.variant.change")}),[t]),s((()=>{c.current||R.track("gallery.element.change",{activeIndex:o})}),[o]),s((()=>{c.current||i&&null!=l&&l.id&&R.track("gallery.asset.view",{publishitemid:l.id,type:i.type,name:i.name})}),[i]),s((()=>{c.current=!1}),[]),e.createElement(oe,{activeVariantId:t||"ekonovar",activeElementId:o,hasInteractive:r,experiments:a,publishItem:l})};se.propTypes={variantId:Ct.string,activeItem:Ct.object,hasInteractive:Ct.bool,activeIndex:Ct.number,experiments:Ct.array,publishItem:Ct.object};const ae="eko-gallery-react";function le(t,e){var n,i,r;const o=(null==t||null===(n=t.variantMap)||void 0===n?void 0:n[e])||"ekonovar";return(null==t||null===(i=t.items)||void 0===i?void 0:i.find((t=>(null==t?void 0:t.variantId)===o)))||(null==t||null===(r=t.items)||void 0===r?void 0:r[0])}"undefined"!=typeof window&&(window.EkoAnalytics||(console.log("EkoAnalytics is not defined, initializing a no-op function..."),window.EkoAnalytics=()=>{}));const ce=a((({className:t,config:r,instanceId:o,variantId:a,activeItem:l={index:0,step:0},onEvent:c,forceMobile:u},d)=>{var h,f,p,m,v,g;const y=null!==(h=null===(f=r.options)||void 0===f?void 0:f.loadingTimeout)&&void 0!==h?h:12,b=null===(p=null===(m=r.options)||void 0===m?void 0:m.showCoverLoadAnimation)||void 0===p||p,[k,x]=i(le(r,a)),[w,_]=i({index:l.index,step:l.step,source:"external-nav"}),[T,I]=i(!1),[E,S]=i(!1),[A,N]=i("eko-desktop"),M=n(!1),F=n(!1),O=n(l),C=n(null),P=n(a);function D(){const t=u||window.innerWidth<768?"eko-mobile":"eko-desktop";N(t)}return F.current||(Wt.send("galleryinit"),F.current=!0),s((()=>{const t=P.current!==a;P.current=a,x(le(r,a)),t&&!M.current&&_({index:0,step:0,source:"external-nav"})}),[r,a]),s((()=>{if(c)return Wt.subscribe(c),()=>{Wt.unsubscribe()}}),[c]),s((()=>{M.current=E}),[E]),s((()=>{I(!1),S(!1);const t=setTimeout((()=>{M.current||(I(!0),R.track("gallery.load.timeout"))}),1e3*y);return()=>{clearTimeout(t)}}),[r]),s((()=>{D()}),[u]),s((()=>(window.addEventListener("resize",D),D(),()=>{window.removeEventListener("resize",D)})),[u]),s((()=>(window.EkoAnalytics("trackElementVisibility",C.current,ae),()=>{window.EkoAnalytics("stopTrackingElementVisibility",ae)})),[]),s((()=>{!("carousel"===(null==w?void 0:w.source)||"nav"===(null==w?void 0:w.source))||(null==w?void 0:w.index)===l.index&&(null==w?void 0:w.step)===l.step||Wt.send("activeitemchanged",{index:null==w?void 0:w.index,step:null==w?void 0:w.step})}),[w,l]),s((()=>{O.current.index===l.index&&O.current.step===l.step||(O.current=l,_({index:l.index,step:l.step,source:"external-nav"}))}),[l]),e.createElement(e.Fragment,null,e.createElement(ie,null),e.createElement(re,{layout:r.layout,style:r.style,forceMobile:u}),e.createElement(se,{variantId:a,activeItem:null==k||null===(v=k.items)||void 0===v?void 0:v[w.index],activeIndex:w.index,hasInteractive:E,experiments:r.experiments,publishItem:null==r||null===(g=r.__autoGenerated)||void 0===g?void 0:g.publishItem}),e.createElement("section",{className:`${`eko-gallery eko-react-gallery ${function(t){let e="";return["mobile","desktop"].forEach((n=>{var i,r;const o=null!==(i=null==t||null===(r=t[n])||void 0===r?void 0:r.type)&&void 0!==i?i:"nav";if(e+=`eko-${n}-${o}-layout `,"nav"===o){var s;const i="desktop"===n,r=(null==t||null===(s=t[n])||void 0===s||null===(s=s.config)||void 0===s?void 0:s.orientation)||(i?"left":"bottom");e+=`eko-${n}-nav-${r} `}})),e}(r.layout)} ${null!=t?t:""}`.trim()} ${A}`,"aria-controls":"main-content",ref:C},e.createElement(qt,{items:(null==k?void 0:k.items)||[],setActiveIndex:_,activeIndex:w.index,layout:r.layout,carouselMounted:E,forceMobile:u}),!E&&e.createElement(Yt,{ref:d,items:(null==k?void 0:k.items)||[],setActiveIndex:_,activeIndex:{index:w.index,source:null==w?void 0:w.source},showSmartLoaders:!T&&b}),!T&&e.createElement(ne,{ref:d,config:r,instanceId:o,activeItem:w,setActiveItem:_,variantId:null==k?void 0:k.variantId,smartGalleryLoaded:E,forceMobile:u,onLoad:function(){S(!0)}})))}));ce.propTypes={className:Ct.string,config:Ct.object.isRequired,instanceId:Ct.string,variantId:Ct.string,activeItem:Ct.object,onEvent:Ct.func,forceMobile:Ct.bool,onPrev:Ct.func,onNext:Ct.func},ce.displayName="EkoGallery";var ue=c(ce);const de=b("gallery-react");const he=a(((t,n)=>{var i;s((()=>(de.setDataStorage("gallery-react",{config:t.config}),window.eko=window.eko||{},window.eko.config=t.config,window.eko.gallery={version:"4.0.5"},()=>{window.eko.config=void 0})),[t.config]);const{children:r,...o}=t;return void 0!==t.config?e.createElement(ue,q({ref:n},o,{key:null===(i=t.config.__autoGenerated)||void 0===i||null===(i=i.publishItem)||void 0===i?void 0:i.id})):r}));he.propTypes={className:Ct.string,config:Ct.object,variantId:Ct.string,onEvent:Ct.func,instanceId:Ct.string,children:Ct.node},he.displayName="EkoGalleryWrapper";var fe,pe,me,ve,ge,ye,be,ke,xe,we,_e,Te,Ie,Ee,Se,Ae,Ne,Me,Fe,Oe,Ce,Pe,De,Re,Le,Be,ze,We,je,Ue,$e,qe,Ve,Ge,He,Ke,Xe,Ye,Qe,Je,Ze,tn,en,nn,rn,on,sn,an,ln,cn,un,dn,hn=c(he);const fn=1,pn=2,mn=4,vn=8,gn=16,yn=1,bn=4,kn=8,xn=16,wn="[",_n="[!",Tn="]",In={},En=Symbol(),Sn="http://www.w3.org/1999/xhtml",An="@attach",Nn=!1;var Mn=Array.isArray,Fn=Array.prototype.indexOf,On=Array.from,Cn=Object.defineProperty,Pn=Object.getOwnPropertyDescriptor,Dn=Object.getOwnPropertyDescriptors,Rn=Object.prototype,Ln=Array.prototype,Bn=Object.getPrototypeOf,zn=Object.isExtensible;function Wn(){var t,e;return{promise:new Promise(((n,i)=>{t=n,e=i})),resolve:t,reject:e}}const jn=2,Un=4,$n=8,qn=1<<24,Vn=16,Gn=32,Hn=64,Kn=128,Xn=512,Yn=1024,Qn=2048,Jn=4096,Zn=8192,ti=16384,ei=32768,ni=65536,ii=1<<17,ri=1<<18,oi=1<<19,si=1<<20,ai=1<<25,li=32768,ci=1<<21,ui=1<<22,di=1<<23,hi=Symbol("$state"),fi=Symbol("legacy props"),pi=Symbol(""),mi=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},vi=3,gi=8;function yi(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function bi(t){console.warn("https://svelte.dev/e/hydration_mismatch")}let ki,xi=!1;function wi(t){xi=t}function _i(t){if(null===t)throw bi(),In;return ki=t}function Ti(){return _i(wo(ki))}function Ii(t){if(xi){if(null!==wo(ki))throw bi(),In;ki=t}}function Ei(t=!0){for(var e=0,n=ki;;){if(n.nodeType===gi){var i=n.data;if(i===Tn){if(0===e)return n;e-=1}else i!==wn&&i!==_n||(e+=1)}var r=wo(n);t&&n.remove(),n=r}}function Si(t){if(!t||t.nodeType!==gi)throw bi(),In;return t.data}function Ai(t){return t===this.v}function Ni(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 Mi=!1,Fi=null;function Oi(t){Fi=t}function Ci(t){return Ri().get(t)}function Pi(t,e=!1,n){Fi={p:Fi,i:!1,c:null,e:null,s:t,x:null,l:null}}function Di(t){var e=Fi,n=e.e;if(null!==n)for(var i of(e.e=null,n))Do(i);return e.i=!0,Fi=e.p,{}}function Ri(t){var e,n;return null===Fi&&yi(),null!==(n=(e=Fi).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}(Fi)||void 0)}let Li=[];function Bi(){var t=Li;Li=[],function(t){for(var e=0;e<t.length;e++)t[e]()}(t)}function zi(t){if(0===Li.length&&!tr){var e=Li;queueMicrotask((()=>{e===Li&&Bi()}))}Li.push(t)}function Wi(){for(;Li.length>0;)Bi()}function ji(t){var e=rs;if(null===e)return es.f|=di,t;if(e.f&ei)Ui(t,e);else{if(!(e.f&Kn))throw t;e.b.error(t)}}function Ui(t,e){for(;null!==e;){if(e.f&Kn)try{return void e.b.error(t)}catch(e){t=e}e=e.parent}throw t}const $i=-7169;function qi(t,e){t.f=t.f&$i|e}function Vi(t){t.f&Xn||null===t.deps?qi(t,Yn):qi(t,Jn)}function Gi(t){if(null!==t)for(const e of t)e.f&jn&&e.f&li&&(e.f^=li,Gi(e.deps))}function Hi(t,e,n){t.f&Qn?e.add(t):t.f&Jn&&n.add(t),Gi(t.deps),qi(t,Yn)}const Ki=new Set;let Xi=null,Yi=null,Qi=[],Ji=null,Zi=!1,tr=!1;var er=new WeakMap,nr=new WeakMap,ir=new WeakMap,rr=new WeakMap,or=new WeakMap,sr=new WeakMap,ar=new WeakMap,lr=new WeakSet;class cr{constructor(){U(this,lr),$(this,"committed",!1),$(this,"current",new Map),$(this,"previous",new Map),W(this,er,new Set),W(this,nr,new Set),W(this,ir,0),W(this,rr,0),W(this,or,null),W(this,sr,new Set),W(this,ar,new Set),$(this,"skipped_effects",new Set),$(this,"is_fork",!1)}is_deferred(){return this.is_fork||z(rr,this)>0}process(t){Qi=[],this.apply();var e,n=[],i=[];for(const e of t)L(lr,this,ur).call(this,e,n,i);(this.is_fork||L(lr,this,hr).call(this),this.is_deferred())?(L(lr,this,dr).call(this,i),L(lr,this,dr).call(this,n)):(Xi=null,gr(i),gr(n),null===(e=z(or,this))||void 0===e||e.resolve());Yi=null}capture(t,e){var n;(e===En||this.previous.has(t)||this.previous.set(t,e),t.f&di)||(this.current.set(t,t.v),null===(n=Yi)||void 0===n||n.set(t,t.v))}activate(){Xi=this,this.apply()}deactivate(){Xi===this&&(Xi=null,Yi=null)}flush(){if(this.activate(),Qi.length>0){if(pr(),null!==Xi&&Xi!==this)return}else 0===z(ir,this)&&this.process([]);this.deactivate()}discard(){for(const t of z(nr,this))t(this);z(nr,this).clear()}increment(t){j(ir,this,z(ir,this)+1),t&&j(rr,this,z(rr,this)+1)}decrement(t){j(ir,this,z(ir,this)-1),t&&j(rr,this,z(rr,this)-1),this.revive()}revive(){for(const t of z(sr,this))z(ar,this).delete(t),qi(t,Qn),kr(t);for(const t of z(ar,this))qi(t,Jn),kr(t);this.flush()}oncommit(t){z(er,this).add(t)}ondiscard(t){z(nr,this).add(t)}settled(){var t;return(null!==(t=z(or,this))&&void 0!==t?t:j(or,this,Wn())).promise}static ensure(){if(null===Xi){const t=Xi=new cr;Ki.add(Xi),tr||cr.enqueue((()=>{Xi===t&&t.flush()}))}return Xi}static enqueue(t){zi(t)}apply(){}}function ur(t,e,n){t.f^=Yn;for(var i=t.first,r=null;null!==i;){var o=i.f,s=!!(o&(Gn|Hn));if(!(s&&!!(o&Yn)||!!(o&Zn)||this.skipped_effects.has(i))&&null!==i.fn){s?i.f^=Yn:null!==r&&o&(Un|$n|qn)?r.b.defer_effect(i):o&Un?e.push(i):vs(i)&&(o&Vn&&z(sr,this).add(i),xs(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 dr(t){for(var e=0;e<t.length;e+=1)Hi(t[e],z(sr,this),z(ar,this))}function hr(){if(0===z(rr,this)){for(const t of z(er,this))t();z(er,this).clear()}0===z(ir,this)&&L(lr,this,fr).call(this)}function fr(){if(Ki.size>1){this.previous.clear();var t=Yi,e=!0;for(const t of Ki){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=Qi;Qi=[];const e=new Set,o=new Map;for(const t of i)yr(t,r,e,o);if(Qi.length>0){Xi=t,t.apply();for(const e of Qi)L(lr,t,ur).call(t,e,[],[]);t.deactivate()}Qi=n}}Xi=null,Yi=t}this.committed=!0,Ki.delete(this)}function pr(){var t=Qo;Zi=!0;try{var e=0;for(Jo(!0);Qi.length>0;){var n=cr.ensure();if(e++>1e3)mr();n.process(Qi),io.clear()}}finally{Zi=!1,Jo(t),Ji=null}}function mr(){try{!function(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}()}catch(t){Ui(t,Ji)}}let vr=null;function gr(t){var e=t.length;if(0!==e){for(var n=0;n<e;){var i,r=t[n++];if(!(r.f&(ti|Zn))&&vs(r))if(vr=new Set,xs(r),null===r.deps&&null===r.first&&null===r.nodes&&(null===r.teardown&&null===r.ac?Vo(r):r.fn=null),(null===(i=vr)||void 0===i?void 0:i.size)>0){io.clear();for(const t of vr){if(t.f&(ti|Zn))continue;const e=[t];let n=t.parent;for(;null!==n;)vr.has(n)&&(vr.delete(n),e.push(n)),n=n.parent;for(let t=e.length-1;t>=0;t--){const n=e[t];n.f&(ti|Zn)||xs(n)}}vr.clear()}}vr=null}}function yr(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&jn?yr(r,e,n,i):t&(ui|Vn)&&!(t&Qn)&&br(r,e,i)&&(qi(r,Qn),kr(r))}}function br(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&jn&&br(i,e,n))return n.set(i,!0),!0}return n.set(t,!1),!1}function kr(t){for(var e=Ji=t;null!==e.parent;){var n=(e=e.parent).f;if(Zi&&e===rs&&n&Vn&&!(n&ri))return;if(n&(Hn|Gn)){if(!(n&Yn))return;e.f^=Yn}}Qi.push(e)}var xr=ni|oi|Kn;var 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 WeakMap,Fr=new WeakMap,Or=new WeakMap,Cr=new WeakMap,Pr=new WeakMap,Dr=new WeakMap,Rr=new WeakMap,Lr=new WeakMap,Br=new WeakMap,zr=new WeakSet;class Wr{constructor(t,e,n){U(this,zr),$(this,"parent",void 0),$(this,"is_pending",!1),W(this,wr,void 0),W(this,_r,xi?ki:null),W(this,Tr,void 0),W(this,Ir,void 0),W(this,Er,void 0),W(this,Sr,null),W(this,Ar,null),W(this,Nr,null),W(this,Mr,null),W(this,Fr,null),W(this,Or,0),W(this,Cr,0),W(this,Pr,!1),W(this,Dr,new Set),W(this,Rr,new Set),W(this,Lr,null),W(this,Br,function(t){let e,n=0,i=oo(0);return()=>{Oo()&&(_s(i),Lo((()=>(0===n&&(e=Es((()=>t((()=>uo(i)))))),n+=1,()=>{zi((()=>{var t;n-=1,0===n&&(null===(t=e)||void 0===t||t(),e=void 0,uo(i))}))}))))}}((()=>(j(Lr,this,oo(z(Or,this))),()=>{j(Lr,this,null)})))),j(wr,this,t),j(Tr,this,e),j(Ir,this,n),this.parent=rs.b,this.is_pending=!!z(Tr,this).pending,j(Er,this,zo((()=>{if(rs.b=this,xi){const t=z(_r,this);Ti();t.nodeType===gi&&t.data===_n?L(zr,this,Ur).call(this):(L(zr,this,jr).call(this),0===z(Cr,this)&&(this.is_pending=!1))}else{var t=L(zr,this,$r).call(this);try{j(Sr,this,jo((()=>n(t))))}catch(t){this.error(t)}z(Cr,this)>0?L(zr,this,Vr).call(this):this.is_pending=!1}return()=>{var t;null===(t=z(Fr,this))||void 0===t||t.remove()}}),xr)),xi&&j(wr,this,ki)}defer_effect(t){Hi(t,z(Dr,this),z(Rr,this))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!z(Tr,this).pending}update_pending_count(t){L(zr,this,Gr).call(this,t),j(Or,this,z(Or,this)+t),z(Lr,this)&&co(z(Lr,this),z(Or,this))}get_effect_pending(){return z(Br,this).call(this),_s(z(Lr,this))}error(t){var e=z(Tr,this).onerror;let n=z(Tr,this).failed;if(z(Pr,this)||!e&&!n)throw t;z(Sr,this)&&(qo(z(Sr,this)),j(Sr,this,null)),z(Ar,this)&&(qo(z(Ar,this)),j(Ar,this,null)),z(Nr,this)&&(qo(z(Nr,this)),j(Nr,this,null)),xi&&(_i(z(_r,this)),function(t=1){if(xi){for(var e=t,n=ki;e--;)n=wo(n);ki=n}}(),_i(Ei()));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")}(),cr.ensure(),j(Or,this,0),null!==z(Nr,this)&&Go(z(Nr,this),(()=>{j(Nr,this,null)})),this.is_pending=this.has_pending_snippet(),j(Sr,this,L(zr,this,qr).call(this,(()=>(j(Pr,this,!1),jo((()=>z(Ir,this).call(this,z(wr,this)))))))),z(Cr,this)>0?L(zr,this,Vr).call(this):this.is_pending=!1)};var s=es;try{is(null),r=!0,null==e||e(t,o),r=!1}catch(t){Ui(t,z(Er,this)&&z(Er,this).parent)}finally{is(s)}n&&zi((()=>{j(Nr,this,L(zr,this,qr).call(this,(()=>{cr.ensure(),j(Pr,this,!0);try{return jo((()=>{n(z(wr,this),(()=>t),(()=>o))}))}catch(t){return Ui(t,z(Er,this).parent),null}finally{j(Pr,this,!1)}})))}))}}function jr(){try{j(Sr,this,jo((()=>z(Ir,this).call(this,z(wr,this)))))}catch(t){this.error(t)}}function Ur(){const t=z(Tr,this).pending;t&&(j(Ar,this,jo((()=>t(z(wr,this))))),cr.enqueue((()=>{var t=L(zr,this,$r).call(this);j(Sr,this,L(zr,this,qr).call(this,(()=>(cr.ensure(),jo((()=>z(Ir,this).call(this,t))))))),z(Cr,this)>0?L(zr,this,Vr).call(this):(Go(z(Ar,this),(()=>{j(Ar,this,null)})),this.is_pending=!1)})))}function $r(){var t=z(wr,this);return this.is_pending&&(j(Fr,this,ko()),z(wr,this).before(z(Fr,this)),t=z(Fr,this)),t}function qr(t){var e=rs,n=es,i=Fi;os(z(Er,this)),is(z(Er,this)),Oi(z(Er,this).ctx);try{return t()}catch(t){return ji(t),null}finally{os(e),is(n),Oi(i)}}function Vr(){const t=z(Tr,this).pending;null!==z(Sr,this)&&(j(Mr,this,document.createDocumentFragment()),z(Mr,this).append(z(Fr,this)),Yo(z(Sr,this),z(Mr,this))),null===z(Ar,this)&&j(Ar,this,jo((()=>t(z(wr,this)))))}function Gr(t){var e;if(this.has_pending_snippet()){if(j(Cr,this,z(Cr,this)+t),0===z(Cr,this)){this.is_pending=!1;for(const t of z(Dr,this))qi(t,Qn),kr(t);for(const t of z(Rr,this))qi(t,Jn),kr(t);z(Dr,this).clear(),z(Rr,this).clear(),z(Ar,this)&&Go(z(Ar,this),(()=>{j(Ar,this,null)})),z(Mr,this)&&(z(wr,this).before(z(Mr,this)),j(Mr,this,null))}}else this.parent&&L(zr,e=this.parent,Gr).call(e,t)}function Hr(t,e,n,i){const r=Xr;if(0!==n.length||0!==t.length){var o,s,a,l,c=Xi,u=rs,d=(o=rs,s=es,a=Fi,l=Xi,function(t=!0){os(o),is(s),Oi(a),t&&(null==l||l.activate())});t.length>0?Promise.all(t).then((()=>{d();try{return h()}finally{null==c||c.deactivate(),Kr()}})):h()}else i(e.map(r));function h(){Promise.all(n.map((t=>Yr(t)))).then((t=>{d();try{i([...e.map(r),...t])}catch(t){u.f&ti||Ui(t,u)}null==c||c.deactivate(),Kr()})).catch((t=>{Ui(t,u)}))}}function Kr(){os(null),is(null),Oi(null)}function Xr(t){var e=jn|Qn,n=null!==es&&es.f&jn?es:null;null!==rs&&(rs.f|=oi);return{ctx:Fi,deps:null,effects:null,equals:Ai,f:e,fn:t,reactions:null,rv:0,v:En,wv:0,parent:null!=n?n:rs,ac:null}}function Yr(t,e,n){let i=rs;null===i&&function(){throw new Error("https://svelte.dev/e/async_derived_orphan")}();var r=i.b,o=void 0,s=oo(En),a=!es,l=new Map;return function(t){Fo(ui|oi,t,!0)}((()=>{var e=Wn();o=e.promise;try{Promise.resolve(t()).then(e.resolve,e.reject).then((()=>{n===Xi&&n.committed&&n.deactivate(),Kr()}))}catch(t){e.reject(t),Kr()}var n=Xi;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(mi),l.delete(n),l.set(n,e)}const u=(t,e=void 0)=>{if(n.activate(),e)e!==mi&&(s.f|=di,co(s,e));else{s.f&di&&(s.f^=di),co(s,t);for(const[t,e]of l){if(l.delete(t),t===n)break;e.reject(mi)}}a&&(r.update_pending_count(-1),n.decrement(c))};e.promise.then(u,(t=>u(null,t||"unknown")))})),Co((()=>{for(const t of l.values())t.reject(mi)})),new Promise((t=>{!function e(n){function i(){n===o?t(s):e(o)}n.then(i,i)}(o)}))}function Qr(t){const e=Xr(t);return as(e),e}function Jr(t){const e=Xr(t);return e.equals=Ni,e}function Zr(t){var e=t.effects;if(null!==e){t.effects=null;for(var n=0;n<e.length;n+=1)qo(e[n])}}function to(t){var e,n=rs;os(function(t){for(var e=t.parent;null!==e;){if(!(e.f&jn))return e.f&ti?null:e;e=e.parent}return null}(t));try{t.f&=~li,Zr(t),e=ys(t)}finally{os(n)}return e}function eo(t){var e,n,i=to(t);if(!t.equals(i)&&(t.wv=ms(),(null===(e=Xi)||void 0===e||!e.is_fork||null===t.deps)&&(t.v=i,null===t.deps)))return void qi(t,Yn);Zo||(null!==Yi?(Oo()||null!==(n=Xi)&&void 0!==n&&n.is_fork)&&Yi.set(t,i):Vi(t))}let no=new Set;const io=new Map;let ro=!1;function oo(t,e){return{f:0,v:t,reactions:null,equals:Ai,rv:0,wv:0}}function so(t,e){const n=oo(t);return as(n),n}function ao(t,e=!1,n=!0){const i=oo(t);return e||(i.equals=Ni),i}function lo(t,e,n=!1){var i;return null!==es&&(!ns||es.f&ii)&&es.f&(jn|Vn|ui|ii)&&(null===(i=ss)||void 0===i||!i.includes(t))&&function(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}(),co(t,n?fo(e):e)}function co(t,e){if(!t.equals(e)){var n=t.v;Zo?io.set(t,e):io.set(t,n),t.v=e;var i=cr.ensure();if(i.capture(t,n),t.f&jn){const e=t;t.f&Qn&&to(e),Vi(e)}t.wv=ms(),ho(t,Qn),null!==rs&&rs.f&Yn&&!(rs.f&(Gn|Hn))&&(null===us?function(t){us=t}([t]):us.push(t)),!i.is_fork&&no.size>0&&!ro&&function(){ro=!1;var t=Qo;Jo(!0);const e=Array.from(no);try{for(const t of e)t.f&Yn&&qi(t,Jn),vs(t)&&xs(t)}finally{Jo(t)}no.clear()}()}return e}function uo(t){lo(t,t.v+1)}function ho(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&Qn);if(a&&qi(o,e),s&jn){var l,c=o;null===(l=Yi)||void 0===l||l.delete(c),s&li||(s&Xn&&(o.f|=li),ho(c,Jn))}else a&&(s&Vn&&null!==vr&&vr.add(o),kr(o))}}function fo(t){if("object"!=typeof t||null===t||hi in t)return t;const e=Bn(t);if(e!==Rn&&e!==Ln)return t;var n=new Map,i=Mn(t),r=so(0),o=fs,s=t=>{if(fs===o)return t();var e=es,n=fs;is(null),ps(o);var i=t();return is(e),ps(n),i};return i&&n.set("length",so(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=so(i.value);return n.set(e,t),t})):lo(r,i.value,!0),!0},deleteProperty(t,e){var i=n.get(e);if(void 0===i){if(e in t){const t=s((()=>so(En)));n.set(e,t),uo(r)}}else lo(i,En),uo(r);return!0},get(e,i,r){var o;if(i===hi)return t;var a=n.get(i),l=i in e;if(void 0===a&&(!l||null!==(o=Pn(e,i))&&void 0!==o&&o.writable)&&(a=s((()=>so(fo(l?e[i]:En)))),n.set(i,a)),void 0!==a){var c=_s(a);return c===En?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=_s(r))}else if(void 0===i){var o=n.get(e),s=null==o?void 0:o.v;if(void 0!==o&&s!==En)return{enumerable:!0,configurable:!0,value:s,writable:!0}}return i},has(t,e){var i;if(e===hi)return!0;var r=n.get(e),o=void 0!==r&&r.v!==En||Reflect.has(t,e);if((void 0!==r||null!==rs&&(!o||null!==(i=Pn(t,e))&&void 0!==i&&i.writable))&&(void 0===r&&(r=s((()=>so(o?fo(t[e]):En))),n.set(e,r)),_s(r)===En))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?lo(h,En):d in t&&(h=s((()=>so(En))),n.set(d+"",h))}void 0===c?(!u||null!==(l=Pn(t,e))&&void 0!==l&&l.writable)&&(lo(c=s((()=>so(void 0))),fo(o)),n.set(e,c)):(u=c.v!==En,lo(c,s((()=>fo(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&&lo(p,m+1)}uo(r)}return!0},ownKeys(t){_s(r);var e=Reflect.ownKeys(t).filter((t=>{var e=n.get(t);return void 0===e||e.v!==En}));for(var[i,o]of n)o.v===En||i in t||e.push(i);return e},setPrototypeOf(){!function(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}()}})}function po(t){try{if(null!==t&&"object"==typeof t&&hi in t)return t[hi]}catch{}return t}var mo,vo,go,yo;function bo(){if(void 0===mo){mo=window,vo=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;go=Pn(e,"firstChild").get,yo=Pn(e,"nextSibling").get,zn(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),zn(n)&&(n.__t=void 0)}}function ko(t=""){return document.createTextNode(t)}function xo(t){return go.call(t)}function wo(t){return yo.call(t)}function _o(t,e){if(!xi)return xo(t);var n=xo(ki);if(null===n)n=ki.appendChild(ko());else if(e&&n.nodeType!==vi){var i,r=ko();return null===(i=n)||void 0===i||i.before(r),_i(r),r}return _i(n),n}function To(t,e=!1){var n;if(!xi){var i=xo(t);return i instanceof Comment&&""===i.data?wo(i):i}if(e&&(null===(n=ki)||void 0===n?void 0:n.nodeType)!==vi){var r,o=ko();return null===(r=ki)||void 0===r||r.before(o),_i(o),o}return ki}function Io(t,e=1,n=!1){var i;let r=xi?ki:t;for(var o;e--;)o=r,r=wo(r);if(!xi)return r;if(n&&(null===(i=r)||void 0===i?void 0:i.nodeType)!==vi){var s,a=ko();if(null===r)null===(s=o)||void 0===s||s.after(a);else r.before(a);return _i(a),a}return _i(r),r}function Eo(t){t.textContent=""}function So(t,e){if(e){const e=document.body;t.autofocus=!0,zi((()=>{document.activeElement===e&&t.focus()}))}}let Ao=!1;function No(t){var e=es,n=rs;is(null),os(null);try{return t()}finally{is(e),os(n)}}function Mo(t){null===rs&&(null===es&&function(){throw new Error("https://svelte.dev/e/effect_orphan")}(),function(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}()),Zo&&function(){throw new Error("https://svelte.dev/e/effect_in_teardown")}()}function Fo(t,e,n){var i=rs;null!==i&&i.f&Zn&&(t|=Zn);var r={ctx:Fi,deps:null,nodes:null,f:t|Qn|Xn,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{xs(r),r.f|=ei}catch(t){throw qo(r),t}else null!==e&&kr(r);var o=r;if(!n||null!==o.deps||null!==o.teardown||null!==o.nodes||o.first!==o.last||o.f&oi||(o=o.first,t&Vn&&t&ni&&null!==o&&(o.f|=ni)),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!==es&&es.f&jn&&!(t&Hn))){var s,a=es;(null!==(s=a.effects)&&void 0!==s?s:a.effects=[]).push(o)}return r}function Oo(){return null!==es&&!ns}function Co(t){const e=Fo($n,null,!1);return qi(e,Yn),e.teardown=t,e}function Po(t){Mo();var e=rs.f;if(!!(es||!(e&Gn)||e&ei))return Do(t);var n,i=Fi;(null!==(n=i.e)&&void 0!==n?n:i.e=[]).push(t)}function Do(t){return Fo(Un|si,t,!1)}function Ro(t){return Fo(Un,t,!1)}function Lo(t,e=0){return Fo($n|e,t,!0)}function Bo(t,e=[],n=[],i=[]){Hr(i,e,n,(e=>{Fo($n,(()=>t(...e.map(_s))),!0)}))}function zo(t,e=0){return Fo(Vn|e,t,!0)}function Wo(t,e=0){return Fo(qn|e,t,!0)}function jo(t){return Fo(Gn|oi,t,!0)}function Uo(t){var e=t.teardown;if(null!==e){const t=Zo,n=es;ts(!0),is(null);try{e.call(null)}finally{ts(t),is(n)}}}function $o(t,e=!1){var n=t.first;for(t.first=t.last=null;null!==n;){const t=n.ac;null!==t&&No((()=>{t.abort(mi)}));var i=n.next;n.f&Hn?n.parent=null:qo(n,e),n=i}}function qo(t,e=!0){var n=!1;(e||t.f&ri)&&null!==t.nodes&&null!==t.nodes.end&&(!function(t,e){for(;null!==t;){var n=t===e?null:wo(t);t.remove(),t=n}}(t.nodes.start,t.nodes.end),n=!0),$o(t,e&&!n),ks(t,0),qi(t,ti);var i=t.nodes&&t.nodes.t;if(null!==i)for(const t of i)t.stop();Uo(t);var r=t.parent;null!==r&&null!==r.first&&Vo(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=null}function Vo(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 Go(t,e,n=!0){var i=[];Ho(t,i,!0);var r=()=>{n&&qo(t),e&&e()},o=i.length;if(o>0){var s=()=>--o||r();for(var a of i)a.out(s)}else r()}function Ho(t,e,n){if(!(t.f&Zn)){t.f^=Zn;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;Ho(r,e,!!(!!(r.f&ni)||!!(r.f&Gn)&&!!(t.f&Vn))&&n),r=o}}}function Ko(t){Xo(t,!0)}function Xo(t,e){if(t.f&Zn){t.f^=Zn,t.f&Yn||(qi(t,Qn),kr(t));for(var n=t.first;null!==n;){var i=n.next;Xo(n,!!(!!(n.f&ni)||!!(n.f&Gn))&&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 Yo(t,e){if(t.nodes)for(var n=t.nodes.start,i=t.nodes.end;null!==n;){var r=n===i?null:wo(n);e.append(n),n=r}}let Qo=!1;function Jo(t){Qo=t}let Zo=!1;function ts(t){Zo=t}let es=null,ns=!1;function is(t){es=t}let rs=null;function os(t){rs=t}let ss=null;function as(t){null!==es&&(null===ss?ss=[t]:ss.push(t))}let ls=null,cs=0,us=null;let ds=1,hs=0,fs=hs;function ps(t){fs=t}function ms(){return++ds}function vs(t){var e=t.f;if(e&Qn)return!0;if(e&jn&&(t.f&=~li),e&Jn){for(var n=t.deps,i=n.length,r=0;r<i;r++){var o=n[r];if(vs(o)&&eo(o),o.wv>t.wv)return!0}e&Xn&&null===Yi&&qi(t,Yn)}return!1}function gs(t,e,n=!0){var i,r=t.reactions;if(null!==r&&(null===(i=ss)||void 0===i||!i.includes(t)))for(var o=0;o<r.length;o++){var s=r[o];s.f&jn?gs(s,e,!1):e===s&&(n?qi(s,Qn):s.f&Yn&&qi(s,Jn),kr(s))}}function ys(t){var e=ls,n=cs,i=us,r=es,o=ss,s=Fi,a=ns,l=fs,c=t.f;ls=null,cs=0,us=null,es=c&(Gn|Hn)?null:t,ss=null,Oi(t.ctx),ns=!1,fs=++hs,null!==t.ac&&(No((()=>{t.ac.abort(mi)})),t.ac=null);try{t.f|=ci;var u=(0,t.fn)(),d=t.deps;if(null!==ls){var h;if(ks(t,cs),null!==d&&cs>0)for(d.length=cs+ls.length,h=0;h<ls.length;h++)d[cs+h]=ls[h];else t.deps=d=ls;if(Oo()&&t.f&Xn)for(h=cs;h<d.length;h++){var f,p;(null!==(p=(f=d[h]).reactions)&&void 0!==p?p:f.reactions=[]).push(t)}}else null!==d&&cs<d.length&&(ks(t,cs),d.length=cs);if(!(null===us||ns||null===d||t.f&(jn|Jn|Qn)))for(h=0;h<us.length;h++)gs(us[h],t);return null!==r&&r!==t&&(hs++,null!==us&&(null===i?i=us:i.push(...us))),t.f&di&&(t.f^=di),u}catch(t){return ji(t)}finally{t.f^=ci,ls=e,cs=n,us=i,es=r,ss=o,Oi(s),ns=a,fs=l}}function bs(t,e){let n=e.reactions;if(null!==n){var i=Fn.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&jn&&(null===ls||!ls.includes(e))){var o=e;o.f&Xn&&(o.f^=Xn,o.f&=~li),Vi(o),Zr(o),ks(o,0)}}function ks(t,e){var n=t.deps;if(null!==n)for(var i=e;i<n.length;i++)bs(t,n[i])}function xs(t){var e=t.f;if(!(e&ti)){qi(t,Yn);var n=rs,i=Qo;rs=t,Qo=!0;try{e&(Vn|qn)?function(t){for(var e=t.first;null!==e;){var n=e.next;e.f&Gn||qo(e),e=n}}(t):$o(t),Uo(t);var r=ys(t);t.teardown="function"==typeof r?r:null,t.wv=ds,Nn&&Mi&&t.f&Qn&&t.deps}finally{Qo=i,rs=n}}}async function ws(){await Promise.resolve(),function(){var t=tr;tr=!0;try{for(;;){var e;if(Wi(),0===Qi.length&&(null===(e=Xi)||void 0===e||e.flush(),0===Qi.length))return void(Ji=null);pr()}}finally{tr=t}}()}function _s(t){var e,n,i=!!(t.f&jn);if(null!==es&&!ns&&!(null!==rs&&!!(rs.f&ti)||null!==(n=ss)&&void 0!==n&&n.includes(t))){var r=es.deps;if(es.f&ci)t.rv<hs&&(t.rv=hs,null===ls&&null!==r&&r[cs]===t?cs++:null===ls?ls=[t]:ls.includes(t)||ls.push(t));else{var o,s;(null!==(s=(o=es).deps)&&void 0!==s?s:o.deps=[]).push(t);var a=t.reactions;null===a?t.reactions=[es]:a.includes(es)||a.push(es)}}if(Zo&&io.has(t))return io.get(t);if(i){var l=t;if(Zo){var c=l.v;return(l.f&Yn||null===l.reactions)&&!Is(l)||(c=to(l)),io.set(l,c),c}var u=!(l.f&Xn)&&!ns&&null!==es&&(Qo||!!(es.f&Xn)),d=null===l.deps;vs(l)&&(u&&(l.f|=Xn),eo(l)),u&&!d&&Ts(l)}if(null!==(e=Yi)&&void 0!==e&&e.has(t))return Yi.get(t);if(t.f&di)throw t.v;return t.v}function Ts(t){if(null!==t.deps){t.f|=Xn;for(const n of t.deps){var e;(null!==(e=n.reactions)&&void 0!==e?e:n.reactions=[]).push(t),n.f&jn&&!(n.f&Xn)&&Ts(n)}}}function Is(t){if(t.v===En)return!0;if(null===t.deps)return!1;for(const e of t.deps){if(io.has(e))return!0;if(e.f&jn&&Is(e))return!0}return!1}function Es(t){var e=ns;try{return ns=!0,t()}finally{ns=e}}const Ss=new Set,As=new Set;function Ns(t,e,n,i={}){function r(t){if(i.capture||Cs.call(e,t),!t.cancelBubble)return No((()=>null==n?void 0:n.call(this,t)))}return t.startsWith("pointer")||t.startsWith("touch")||"wheel"===t?zi((()=>{e.addEventListener(t,r,i)})):e.addEventListener(t,r,i),r}function Ms(t,e,n,i,r){var o={capture:i,passive:r},s=Ns(t,e,n,o);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&Co((()=>{e.removeEventListener(t,s,o)}))}function Fs(t){for(var e=0;e<t.length;e++)Ss.add(t[e]);for(var n of As)n(t)}let Os=null;function Cs(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;Os=t;var a=0,l=Os===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){Cn(t,"currentTarget",{configurable:!0,get:()=>s||i});var d=es,h=rs;is(null),os(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,is(d),os(h)}}}function Ps(t,e){var n=rs;null===n.nodes&&(n.nodes={start:t,end:e,a:null,t:null})}function Ds(t,e){var n,i=!!(1&e),r=!!(2&e),o=!t.startsWith("<!>");return()=>{if(xi)return Ps(ki,null),ki;var e,s;void 0===n&&(e=o?t:"<!>"+t,(s=document.createElement("template")).innerHTML=e.replaceAll("<!>","\x3c!----\x3e"),n=s.content,i||(n=xo(n)));var a=r||vo?document.importNode(n,!0):n.cloneNode(!0);i?Ps(xo(a),a.lastChild):Ps(a,a);return a}}function Rs(){if(xi)return Ps(ki,null),ki;var t=document.createDocumentFragment(),e=document.createComment(""),n=ko();return t.append(e,n),Ps(e,n),t}function Ls(t,e){if(xi){var n=rs;return n.f&ei&&null!==n.nodes.end||(n.nodes.end=ki),void Ti()}null!==t&&t.before(e)}function Bs(t){return t.endsWith("capture")&&"gotpointercapture"!==t&&"lostpointercapture"!==t}const zs=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function Ws(t){return zs.includes(t)}const js={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 Us(t){var e;return t=t.toLowerCase(),null!==(e=js[t])&&void 0!==e?e:t}const $s=["touchstart","touchmove"];function qs(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 Vs(t,e){return Ks(t,e)}function Gs(t,e){var n;bo(),e.intro=null!==(n=e.intro)&&void 0!==n&&n;const i=e.target,r=xi,o=ki;try{for(var s=xo(i);s&&(s.nodeType!==gi||s.data!==wn);)s=wo(s);if(!s)throw In;wi(!0),_i(s);const n=Ks(t,{...e,anchor:s});return wi(!1),n}catch(n){if(n instanceof Error&&n.message.split("\n").some((t=>t.startsWith("https://svelte.dev/e/"))))throw n;return n!==In&&console.warn("Failed to hydrate: ",n),!1===e.recover&&function(){throw new Error("https://svelte.dev/e/hydration_failed")}(),bo(),Eo(i),wi(!1),Vs(t,e)}finally{wi(r),_i(o)}}const Hs=new Map;function Ks(t,{target:e,anchor:n,props:i={},events:r,context:o,intro:s=!0}){bo();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,$s.includes(s));e.addEventListener(i,Cs,{passive:r});var o=Hs.get(i);void 0===o?(document.addEventListener(i,Cs,{passive:r}),Hs.set(i,1)):Hs.set(i,o+1)}}var s};l(On(Ss)),As.add(l);var c=void 0,u=function(t){cr.ensure();const e=Fo(Hn|oi,t,!0);return(t={})=>new Promise((n=>{t.outro?Go(e,(()=>{qo(e),n(void 0)})):(qo(e),n(void 0))}))}((()=>{var s=null!=n?n:e.appendChild(ko());return function(t,e,n){new Wr(t,e,n)}(s,{pending:()=>{}},(e=>{o&&(Pi({}),Fi.c=o);if(r&&(i.$$events=r),xi&&Ps(e,null),c=t(e,i)||{},xi&&(rs.nodes.end=ki,null===ki||ki.nodeType!==gi||ki.data!==Tn))throw bi(),In;o&&Di()})),()=>{for(var t of a){e.removeEventListener(t,Cs);var i=Hs.get(t);0==--i?(document.removeEventListener(t,Cs),Hs.delete(t)):Hs.set(t,i)}var r;(As.delete(l),s!==n)&&(null===(r=s.parentNode)||void 0===r||r.removeChild(s))}}));return Xs.set(c,u),c}let Xs=new WeakMap;class Ys{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=Xi;if(this.#t.has(t)){var e=this.#t.get(t),n=this.#e.get(e);if(n)Ko(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&&(qo(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();Yo(i,e),e.append(ko()),this.#n.set(t,{effect:i,fragment:e})}else qo(i);this.#i.delete(t),this.#e.delete(t)};this.#r||!n?(this.#i.add(t),Go(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)||(qo(n.effect),this.#n.delete(t))};ensure(t,e){var n=Xi;!e||this.#e.has(t)||this.#n.has(t)||this.#e.set(t,jo((()=>e(this.anchor)))),this.#t.set(n,t),xi&&(this.anchor=ki),this.#o()}}function Qs(t,e,n=!1){xi&&Ti();var i=new Ys(t);function r(e,n){if(xi){if(e===(Si(t)===_n)){var r=Ei();return _i(r),i.anchor=r,wi(!1),i.ensure(e,n),void wi(!0)}}i.ensure(e,n)}zo((()=>{var t=!1;e(((e,n=!0)=>{t=!0,r(n,e)})),t||r(!1,null)}),n?ni:0)}function Js(t,e){return e}function Zs(t,e=!0){for(var n=0;n<t.length;n++)qo(t[n],e)}var ta;function ea(t,e,n,i,r,o=null){var s=t,a=new Map;if(!!(e&mn)){var l=t;s=xi?_i(xo(l)):l.appendChild(ko())}xi&&Ti();var c,u=null,d=Jr((()=>{var t=n();return Mn(t)?t:null==t?[]:On(t)})),h=!0;function f(){m.fallback=u,function(t,e,n,i,r){var o,s,a,l,c,u=!!(i&vn),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&ai))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&ai){if(l.f^=ai,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),ra(t,p,l),ra(t,l,b),ia(l,b,n),m=[],v=[],f=(p=l).next;continue}ia(l,null,n)}var k,x;if(l.f&Zn)if(Ko(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)ia(m[w],_,n);for(w=0;w<v.length;w+=1)o.delete(v[w]);ra(t,T.prev,I.next),ra(t,p,T),ra(t,I,_),f=_,p=I,c-=1,m=[],v=[]}else o.delete(l),ia(l,f,n),ra(t,l.prev,l.next),ra(t,l,null===p?t.effect.first:p.next),ra(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&ai||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)Zs(On(e.done)),null===(S=t.outrogroups)||void 0===S||S.delete(e)}0===t.outrogroups.size&&(t.outrogroups=null)}if(null!==f||void 0!==o){var A=[];if(void 0!==o)for(l of o)l.f&Zn||A.push(l);for(;null!==f;)f.f&Zn||f===t.fallback||A.push(f),f=f.next;var N=A.length;if(N>0){var M=i&mn&&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 O;null===(O=A[c].nodes)||void 0===O||null===(O=O.a)||void 0===O||O.fix()}}!function(t,e,n){for(var i,r=e.length,o=e.length,s=0;s<r;s++){let n=e[s];Go(n,(()=>{if(i){if(i.pending.delete(n),i.done.add(n),0===i.pending.size){var e=t.outrogroups;Zs(On(i.done)),e.delete(i),0===e.size&&(t.outrogroups=null)}}else o-=1}),!1)}if(0===o){var a=null!==n;if(a){var l=n,c=l.parentNode;Eo(c),c.append(l),t.items.clear()}Zs(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&&zi((()=>{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&ai?(u.f^=ai,ia(u,null,s)):Ko(u):Go(u,(()=>{u=null})))}var p=zo((()=>{var t=(c=_s(d)).length;let l=!1;xi&&(Si(s)===_n!==(0===t)&&(_i(s=Ei()),wi(!1),l=!0));for(var p=new Set,m=0;m<t;m+=1){xi&&ki.nodeType===gi&&ki.data===Tn&&(s=ki,l=!0,wi(!1));var v,g=c[m],y=i(g,m),b=h?null:a.get(y);if(b)b.v&&co(b.v,g),b.i&&co(b.i,m);else b=na(a,h?s:null!==(v=ta)&&void 0!==v?v:ta=ko(),g,y,m,r,e,n),h||(b.e.f|=ai),a.set(y,b);p.add(y)}0===t&&o&&!u&&(h?u=jo((()=>o(s))):(u=jo((()=>{var t;return o(null!==(t=ta)&&void 0!==t?t:ta=ko())}))).f|=ai),xi&&t>0&&_i(Ei()),h||f(),l&&wi(!0),_s(d)})),m={effect:p,items:a,outrogroups:null,fallback:u};h=!1,xi&&(s=ki)}function na(t,e,n,i,r,o,s,a){var l=s&fn?s&gn?oo(n):ao(n,!1,!1):null,c=s&pn?oo(r):null;return{v:l,i:c,e:jo((()=>(o(e,null!=l?l:n,null!=c?c:r,a),()=>{t.delete(i)})))}}function ia(t,e,n){if(t.nodes)for(var i=t.nodes.start,r=t.nodes.end,o=!e||e.f&ai?n:e.nodes.start;null!==i;){var s=wo(i);if(o.before(i),i===r)return;i=s}}function ra(t,e,n){null===e?t.effect.first=n:e.next=n,null===n?t.effect.last=e:n.prev=e}function oa(t,e){Ro((()=>{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 sa(t,e){var n,i=void 0;Wo((()=>{i!==(i=e())&&(n&&(qo(n),n=null),i&&(n=jo((()=>{Ro((()=>i(t)))}))))}))}function aa(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=aa(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function la(t){return"object"==typeof t?function(){for(var t,e,n=0,i="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=aa(t))&&(i&&(i+=" "),i+=e);return i}(t):null!=t?t:""}const ca=[..." \t\n\r\f \v\ufeff"];function ua(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 da(t){return"-"!==t[0]||"-"!==t[1]?t.toLowerCase():t}function ha(t,e,n,i,r,o){var s=t.__className;if(xi||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&&!ca.includes(i[s-1])||a!==i.length&&!ca.includes(i[a])?s=a:i=(0===s?"":i.substring(0,s))+i.substring(a+1)}return""===i?null:i}(n,i,o);xi&&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 fa(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 pa(t,e,n,i){var r=t.__style;if(xi||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(da)),i&&l.push(...Object.keys(i).map(da));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=da(t.substring(c,u).trim());l.includes(f)||(";"!==h&&d++,r+=" "+t.substring(c,d).trim()+";")}c=d+1,u=-1}}}return n&&(r+=ua(n)),i&&(r+=ua(i,!0)),""===(r=r.trim())?null:r}return null==t?null:String(t)}(e,i);xi&&o===t.getAttribute("style")||(null==o?t.removeAttribute("style"):t.style.cssText=o),t.__style=e}else i&&(Array.isArray(i)?(fa(t,null==n?void 0:n[0],i[0]),fa(t,null==n?void 0:n[1],i[1],"important")):fa(t,n,i));return i}function ma(t,e,n=!1){if(t.multiple){if(null==e)return;if(!Mn(e))return void console.warn("https://svelte.dev/e/select_multiple_invalid_value");for(var i of t.options)i.selected=e.includes(va(i))}else{for(i of t.options){var r=va(i);if(o=r,s=e,Object.is(po(o),po(s)))return void(i.selected=!0)}var o,s;n&&void 0===e||(t.selectedIndex=-1)}}function va(t){return"__value"in t?t.__value:t.value}const ga=Symbol("class"),ya=Symbol("style"),ba=Symbol("is custom element"),ka=Symbol("is html");function xa(t){if(xi){var e=!1,n=()=>{if(!e){if(e=!0,t.hasAttribute("value")){var n=t.value;_a(t,"value",null),t.value=n}if(t.hasAttribute("checked")){var i=t.checked;_a(t,"checked",null),t.checked=i}}};t.__on_r=n,zi(n),Ao||(Ao=!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 wa(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function _a(t,e,n,i){var r=Ia(t);xi&&(r[e]=t.getAttribute(e),"src"===e||"srcset"===e||"href"===e&&"LINK"===t.nodeName)||r[e]!==(r[e]=n)&&("loading"===e&&(t[pi]=n),null==n?t.removeAttribute(e):"string"!=typeof n&&Sa(t).includes(e)?t[e]=n:t.setAttribute(e,n))}function Ta(t,e,n=[],i=[],r=[],o,s=!1,a=!1){Hr(r,n,i,(n=>{var i=void 0,r={},l="SELECT"===t.nodeName,c=!1;if(Wo((()=>{var u=e(...n.map(_s)),d=function(t,e,n,i,r=!1){if(xi&&r&&"INPUT"===t.tagName){var o=t;("checkbox"===o.type?"defaultChecked":"defaultValue")in n||xa(o)}var s=Ia(t),a=s[ba],l=!s[ka];let c=xi&&a;c&&wi(!1);var u,d=e||{},h="OPTION"===t.tagName;for(var f in e)f in n||(n[f]=null);n.class?n.class=la(n.class):n.class=null,n[ya]&&(null!==(u=n.style)&&void 0!==u||(n.style=null));var p=Sa(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=Ws(i);if(Bs(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,Fs([i]);else{let o=function(t){d[r].call(this,t)};d[n]=Ns(i,t,o,e)}else g&&(t[`__${i}`]=void 0)}else if("style"===r)_a(t,r,o);else if("autofocus"===r)So(t,Boolean(o));else if(a||"__value"!==r&&("value"!==r||null==o))if("selected"===r&&h)wa(t,o);else{var y=r;l||(y=Us(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]=En)):"function"!=typeof o&&_a(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 pa(t,o,null==e?void 0:e[ya],n[ya]),d[r]=o,d[ya]=n[ya];else ha(t,"http://www.w3.org/1999/xhtml"===t.namespaceURI,o,i,null==e?void 0:e[ga],n[ga]),d[r]=o,d[ga]=n[ga]}return c&&wi(!0),d}(t,i,u,o,s,a);c&&l&&"value"in u&&ma(t,u.value);for(let t of Object.getOwnPropertySymbols(r))u[t]||qo(r[t]);for(let e of Object.getOwnPropertySymbols(u)){var h=u[e];e.description!==An||i&&h===i[e]||(r[e]&&qo(r[e]),r[e]=jo((()=>sa(t,(()=>h))))),d[e]=h}i=d})),l){var u=t;Ro((()=>{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"]}),Co((()=>{e.disconnect()}))}(u)}))}c=!0}))}function Ia(t){var e;return null!==(e=t.__attributes)&&void 0!==e?e:t.__attributes={[ba]:t.nodeName.includes("-"),[ka]:t.namespaceURI===Sn}}var Ea=new Map;function Sa(t){var e,n=t.getAttribute("is")||t.nodeName,i=Ea.get(n);if(i)return i;Ea.set(n,i=[]);for(var r=t,o=Element.prototype;o!==r;){for(var s in e=Dn(r))e[s].set&&i.push(s);r=Bn(r)}return i}function Aa(t,e){return t===e||(null==t?void 0:t[hi])===e}function Na(t={},e,n,i){return Ro((()=>{var i,r;return Lo((()=>{i=r,r=[],Es((()=>{t!==n(...r)&&(e(t,...r),i&&Aa(n(...i),t)&&e(null,...i))}))})),()=>{zi((()=>{r&&Aa(n(...r),t)&&e(null,...r)}))}})),t}let Ma=!1;function Fa(t,e,n,i){var r,o,s=!!(n&kn),a=!!(n&xn),l=i,c=!0,u=()=>(c&&(c=!1,l=a?Es(i):i),l);if(s){var d,h,f=hi in t||fi in t;r=null!==(d=null===(h=Pn(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=Ma;try{return Ma=!1,[t(),Ma]}finally{Ma=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&bn))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&yn?Xr:Jr)((()=>(g=!1,p())));s&&_s(y);var b=rs;return function(t,e){if(arguments.length>0){const n=e?_s(y):s?fo(t):t;return lo(y,n),g=!0,void 0!==l&&(l=n),t}return Zo&&g||b.f&ti?y.v:_s(y)}}var Oa,Ca,Pa,Da;"undefined"!=typeof window&&(null!==(Ca=(Oa=null!==(Da=(Pa=window).__svelte)&&void 0!==Da?Da:Pa.__svelte={}).v)&&void 0!==Ca?Ca:Oa.v=new Set).add("5");function Ra(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 La(t,e){t.getNodesAtTime(0)[0].once("nodestart",e)}class Ba{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}`,Ra(this)}#a=so(fo({}));#l=so(null);#c=so(!1);#u=so(null);id;player;position;config;timeline;moduleEndListener;hasDuration=!1;coverAssets=[];get state(){return _s(this.#a)}set state(t){lo(this.#a,t,!0)}get cover(){return _s(this.#l)}set cover(t){lo(this.#l,t)}get showCover(){return _s(this.#c)}set showCover(t){lo(this.#c,t,!0)}get Component(){return _s(this.#u)}set Component(t){lo(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(){La(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 za(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 Wa=Ds('<h3 class="text-box-title svelte-wejicf"> </h3>'),ja=Ds('<span class="text-box-title svelte-wejicf"> </span>'),Ua=Ds('<span class="text-box-description minimized-description svelte-wejicf"> </span>'),$a=Ds('<span class="read-more-cta svelte-wejicf" aria-hidden="true">Read more</span>'),qa=Ds('<button class="expand-description-button svelte-wejicf" aria-expanded="false" aria-controls="expanded-text-content" aria-label="Expand feature description"><!> <!></button>'),Va=Ds('<button aria-expanded="true" aria-label="Collapse feature description" class="svelte-wejicf">Read less</button>'),Ga=Ds('<section aria-label="Feature description" aria-live="polite"><div class="text-wrapper svelte-wejicf"><div class="expanded-text-content svelte-wejicf"><!> <p class="text-box-description svelte-wejicf"> </p></div> <!></div> <!></section>');const Ha={hash:"svelte-wejicf",code:".step-description-container.svelte-wejicf {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-wejicf) {line-height:16px;}}}.expanded-text-content.svelte-wejicf:not([hidden]) {display:flex;flex-direction:column;gap:8px;}button.svelte-wejicf {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-wejicf, p.svelte-wejicf, span.svelte-wejicf {color:#030303;}.text-wrapper.svelte-wejicf {width:100%;}.text-box-title.svelte-wejicf {margin:0;font-weight:500;font-size:12px;}.text-box-description.svelte-wejicf {margin:0;text-align:left;font-weight:400;}.minimized-description.svelte-wejicf {overflow:hidden;line-clamp:1;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;font-weight:400;}.expand-description-button.svelte-wejicf {width:100%;display:flex;justify-content:space-between;gap:6px;flex-wrap:nowrap;.read-more-cta:where(.svelte-wejicf) {color:#014FD3;flex-shrink:0;}}"};function Ka(t,e){Pi(e,!0),oa(t,Ha);let n=Fa(e,"textBox",3,null),i=Fa(e,"isMobile",3,!1),r=so(!1),o=so(null),s=so(!1),a=Qr((()=>{var t;return(null===(t=n())||void 0===t?void 0:t.title)||""})),l=Qr((()=>{var t;return(null===(t=n())||void 0===t?void 0:t.description)||""})),c=Qr((()=>i()?16:18)),u=Qr((()=>i()?12:16));function d(){_s(o)&&lo(s,_s(o).scrollWidth>_s(o).clientWidth||_s(o).scrollHeight>_s(o).clientHeight,!0)}Po((()=>{_s(o)&&d()}));var h=Rs();Ms("resize",mo,d);var f=To(h),p=t=>{var e=Ga(),n=_o(e),d=_o(n),h=_o(d),f=t=>{var e=Wa(),n=_o(e,!0);Ii(e),Bo((()=>qs(n,_s(a)))),Ls(t,e)};Qs(h,(t=>{i()&&t(f)}));var p=Io(h,2),m=_o(p,!0);Ii(p),Ii(d);var v=Io(d,2),g=t=>{var e=qa();e.__click=()=>lo(r,!0);var n=_o(e),u=t=>{var e=ja(),n=_o(e,!0);Ii(e),Bo((()=>qs(n,_s(a)))),Ls(t,e)},d=t=>{var e=Ua(),n=_o(e,!0);Ii(e),Na(e,(t=>lo(o,t)),(()=>_s(o))),Bo((()=>qs(n,_s(l)))),Ls(t,e)};Qs(n,(t=>{i()&&_s(a)?t(u):t(d,!1)}));var h=Io(n,2),f=t=>{Ls(t,$a())};Qs(h,(t=>{(i()||!i()&&_s(s))&&t(f)})),Ii(e),Bo((()=>pa(e,`line-height: ${_s(c)}px;`))),Ls(t,e)};Qs(v,(t=>{_s(r)||t(g)})),Ii(n);var y=Io(n,2),b=t=>{var e=Va();e.__click=()=>lo(r,!1),Bo((()=>pa(e,`margin-bottom: ${!i()&&_s(r)?"8px":"0px"};\n line-height: ${_s(u)}px;`))),Ls(t,e)};Qs(y,(t=>{_s(r)&&t(b)})),Ii(e),Bo((()=>{ha(e,1,"step-description-container "+(_s(r)?"expanded":""),"svelte-wejicf"),pa(e,`padding: ${i()?"8px 16px":"16px 16px 56px 16px"};`),pa(d,`line-height: ${_s(c)}px;`),_a(d,"hidden",!_s(r)),qs(m,_s(l))})),Ls(t,e)};Qs(f,(t=>{(_s(a)||_s(l))&&t(p)})),Ls(t,h),Di()}function Xa(t,e){const n=Qr((()=>e.state.textBox));Ka(t,{get textBox(){return _s(n)},get isMobile(){return e.isMobile}})}Fs(["click"]);var Ya=Ds('<div class="toggle-option-container svelte-16pmvvn"><button> </button></div>'),Qa=Ds('<div class="toggle-container svelte-16pmvvn"><div></div></div> <!>',1);const Ja={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 Za(t,e){oa(t,Ja);const n=Qr((()=>e.state.options)),i=Qr((()=>e.state.currentOptionIndex)),r=Qr((()=>e.state.onOptionClicked)),o=Qr((()=>e.state.textBox));var s=Qa(),a=To(s),l=_o(a);ea(l,21,(()=>_s(n)),Js,((t,e,n)=>{var o=Ya();pa(o,`--button-index: ${n};`);var s=_o(o);let a;s.__click=()=>_s(r)(n);var l=_o(s,!0);Ii(s),Ii(o),Bo((()=>{a=ha(s,1,"toggle-option-button svelte-16pmvvn",null,a,{selected:_s(i)===n}),qs(l,_s(e).label)})),Ls(t,o)})),Ii(l),Ii(a);var c=Io(a,2),u=t=>{Ka(t,{get textBox(){return _s(o)},get isMobile(){return e.isMobile}})};Qs(c,(t=>{_s(o)&&t(u)})),Bo((()=>{var t;return ha(l,1,`toggle-options selected-${null!==(t=_s(i))&&void 0!==t?t:""}`,"svelte-16pmvvn")})),Ls(t,s)}Fs(["click"]);var tl=new WeakSet;function el(t){var e,n;t!==this.state.currentOptionIndex&&(this.state.currentOptionIndex=t,this.state.textBox=this.config.options[t].textBox,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,La(this.timeline,(()=>{this.showCover=!1})),null===(n=this.player)||void 0===n||n.switchTimeline(this.timeline)))}const nl=(t,e,n)=>n>e?e:n<t?t:n;function il(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let rl=()=>{},ol=()=>{};function sl(t){let e;return()=>(void 0===e&&(e=t()),e)}"undefined"!=typeof process&&"production"!==(null===(fe=process.env)||void 0===fe?void 0:fe.NODE_ENV)&&(rl=(t,e,n)=>{t||"undefined"==typeof console||console.warn(il(e,n))},ol=(t,e,n)=>{if(!t)throw new Error(il(e,n))});const al=t=>t,ll=t=>1e3*t,cl=t=>t/1e3;const ul=t=>Array.isArray(t)&&"number"==typeof t[0],dl=(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)})`},hl=2e4;function fl(t){let e=0;let n=t.next(e);for(;!n.done&&e<hl;)e+=50,n=t.next(e);return e>=hl?1/0:e}const pl=5;const ml={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},vl=.001;function gl({duration:t=ml.duration,bounce:e=ml.bounce,velocity:n=ml.velocity,mass:i=ml.mass}){let r,o;rl(t<=ll(ml.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let s=1-e;s=nl(ml.minDamping,ml.maxDamping,s),t=nl(ml.minDuration,ml.maxDuration,cl(t)),s<1?(r=e=>{const i=e*s,r=i*t,o=i-n,a=bl(e,s),l=Math.exp(-r);return vl-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=bl(Math.pow(e,2),s);return(-r(e)+vl>0?-1:1)*((o-a)*l)/c}):(r=e=>Math.exp(-e*t)*((e-n)*t+1)-vl,o=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let i=n;for(let n=1;n<yl;n++)i-=t(i)/e(i);return i}(r,o,5/t);if(t=ll(t),isNaN(a))return{stiffness:ml.stiffness,damping:ml.damping,duration:t};{const e=Math.pow(a,2)*i;return{stiffness:e,damping:2*s*Math.sqrt(i*e),duration:t}}}const yl=12;function bl(t,e){return t*Math.sqrt(1-e*e)}const kl=["duration","bounce"],xl=["stiffness","damping","mass"];function wl(t,e){return e.some((e=>void 0!==t[e]))}function _l(t=ml.visualDuration,e=ml.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:ml.velocity,stiffness:ml.stiffness,damping:ml.damping,mass:ml.mass,isResolvedFromDuration:!1,...t};if(!wl(t,xl)&&wl(t,kl))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(1.2*n),r=i*i,o=2*nl(.05,1,1-(t.bounce||0))*Math.sqrt(r);e={...e,mass:ml.mass,stiffness:r,damping:o}}else{const n=gl(t);e={...e,...n,mass:ml.mass},e.isResolvedFromDuration=!0}return e}({...n,velocity:-cl(n.velocity||0)}),p=h||0,m=c/(2*Math.sqrt(l*u)),v=s-o,g=cl(Math.sqrt(l/u)),y=Math.abs(v)<5;let b;if(i||(i=y?ml.restSpeed.granular:ml.restSpeed.default),r||(r=y?ml.restDelta.granular:ml.restDelta.default),m<1){const t=bl(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?ll(p):function(t,e,n){const i=Math.max(e-pl,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(fl(k),hl),e=dl((e=>k.next(t*e).value),t,30);return t+"ms "+e},toTransition:()=>{}};return k}_l.applyToOptions=t=>{const e=function(t,e=100,n){const i=n({...t,keyframes:[0,e]}),r=Math.min(fl(i),hl);return{type:"keyframes",ease:t=>i.next(r*t).value/e,duration:cl(r)}}(t,100,_l);return t.ease=e.ease,t.duration=ll(e.duration),t.type="keyframes",t};const Tl=t=>null!==t;class Il{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 El(t){for(let n=1;n<t.length;n++){var e;null!==(e=t[n])&&void 0!==e||(t[n]=t[n-1])}}const Sl=t=>t.startsWith("--");const Al=sl((()=>void 0!==window.ScrollTimeline)),Nl={};function Ml(t,e){const n=sl(t);return()=>{var t;return null!==(t=Nl[e])&&void 0!==t?t:n()}}const Fl=Ml((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing"),Ol=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,Cl={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ol([0,.65,.55,1]),circOut:Ol([.55,0,1,.45]),backIn:Ol([.31,.01,.66,-.59]),backOut:Ol([.33,1.53,.69,.99])};function Pl(t,e){return t?"function"==typeof t?Fl()?dl(t,e):"ease-out":ul(t)?Ol(t):Array.isArray(t)?t.map((t=>Pl(t,e)||Cl.easeOut)):Cl[t]:void 0}function Dl(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=Pl(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 Rl extends Il{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,ol("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)&&Fl()?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=Dl(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(Tl),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){Sl(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 cl(Number(n))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+cl(t)}get time(){return cl(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=ll(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&&Al()?(this.animation.timeline=t,al):e(this)}}class Ll{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 Bl(this.animations,"duration")}get iterationDuration(){return Bl(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 Bl(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 zl extends Ll{then(t,e){return this.finished.finally(t).then((()=>{}))}}const Wl=new WeakMap,jl=(t,e="")=>`${t}:${e}`;function Ul(t){const e=Wl.get(t)||new Map;return Wl.set(t,e),e}function $l(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 ql=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 Vl(t,e){for(let n=0;n<t.length;n++)"number"==typeof t[n]&&ql.has(e)&&(t[n]=t[n]+"px")}function Gl(t,e){const n=window.getComputedStyle(t);return Sl(e)?n.getPropertyValue(e):n[e]}function Hl(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;ol(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={...$l(a,t)};r.duration&&(r.duration=ll(r.duration)),r.delay&&(r.delay=ll(r.delay));const o=Ul(i),l=jl(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]=Gl(i,r)),El(e),Vl(e,r),!o&&e.length<2&&e.unshift(Gl(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 Rl(i);e.set(n,r),r.finished.finally((()=>e.delete(n))),a.push(r)}return a}const Kl=(()=>function(t,e,n){return new zl(Hl(t,e,n))})();var Xl=Ds('<button class="svelte-16kucsb"><div class="svelte-16kucsb"> </div></button>'),Yl=Ds('<div class="tryIt-container svelte-16kucsb"><!></div>');const Ql={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 Jl(t,e){Pi(e,!0),oa(t,Ql);const n=Qr((()=>e.state.ctaText)),i=Qr((()=>e.state.animationConfig)),r=Qr((()=>e.state.showCta)),o=Qr((()=>e.state.onCtaClick));let s=null,a=null,l=so(!1),c=!1;function u(){c&&Kl(s,{transform:"scale(1.05)"},{type:_l,mass:1.5,stiffness:400,damping:30})}function d(){c&&Kl(s,{transform:"scale(1)"},{type:_l,mass:1.5,stiffness:400,damping:30})}function h(){c&&Kl(s,{transform:"scale(0.95)"},{type:_l,mass:1,stiffness:600,damping:30})}Po((()=>{const{mass:t,stiffness:e,damping:n,delay:o}=_s(i);let u;return _s(r)&&(u=setTimeout((async()=>{lo(l,!0),u=null,Kl(s,{transform:["translateY(40px) scale(0, 0.2)","translateY(0) scale(1, 1)"],opacity:1},{type:_l,mass:t,stiffness:e,damping:n}),await Kl(a,{transform:["translateY(20px) scale(0.8)","translateY(0) scale(1)"],opacity:1},{type:_l,mass:t,stiffness:e,damping:n,delay:.15}),c=!0}),o)),()=>{u&&clearTimeout(u)}}));var f=Yl(),p=_o(f),m=t=>{var e=Xl();e.__mousedown=h,e.__touchstart=h,e.__click=function(...t){var e;null===(e=_s(o))||void 0===e||e.apply(this,t)};var i=_o(e),r=_o(i,!0);Ii(i),Na(i,(t=>a=t),(()=>a)),Ii(e),Na(e,(t=>s=t),(()=>s)),Bo((()=>{pa(e,"pointer-events: "+(_s(l)?"auto":"none")),qs(r,_s(n))})),Ms("mouseenter",e,u),Ms("mouseleave",e,d),Ls(t,e)};Qs(p,(t=>{_s(r)&&t(m)})),Ii(f),Ls(t,f),Di()}Fs(["mousedown","touchstart","click"]);var Zl=new WeakSet;function tc(){this.mainTimeline?this.player.switchTimeline(this.mainTimeline):this.emitModuleEnd(),this.state.showCta=!1}const ec={videoModule:class extends Ba{constructor({config:t,...e}){var n;super({...e,config:t}),this.Component=Xa,this.hasDuration=!t.loop,Ra(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(za(`${this.id}_intro`,e.intro,t),"end");const n=za(this.id,e.video,t);this.timeline.placeOnTimeline(n,"end",{loop:e.loop}),e.loop||n.on("nodeend",this.emitModuleEnd)}},toggleModule:class extends Ba{constructor({config:t,...e}){super({...e,config:t}),U(this,tl),this.Component=Za,this.synced=t.sync,this.switchTo=()=>{},Ra(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:L(tl,this,el).bind(this),textBox:t.options[0].textBox}}start(t){super.start(t),this.synced?(this.timeline=t.createTimeline(),this.config.options.forEach(((e,n)=>{this.timeline.placeOnTimeline(za(`${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(za(`${this.id}_option_${n}_intro`,e.intro,t),"end"),i.placeOnTimeline(za(`${this.id}_option_${n}`,e.video,t),"end",{loop:!0}),i})),this.timeline=this.timelines[this.state.currentOptionIndex])}},tryItModule:class extends Ba{constructor({config:t,...e}){var n;super({...e,config:t}),U(this,Zl),Ra(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:L(Zl,this,tc).bind(this)}}start(t){super.start(t),this.Component=Jl,this.timeline=t.createTimeline();const{introVideo:e,mainVideo:n}=this.config;if(e.intro&&this.timeline.placeOnTimeline(za(`${this.id}_intro_intro`,e.intro,t)),this.timeline.placeOnTimeline(za(`${this.id}_intro_loop`,e.loop,t),"end",{loop:!0}),n){this.mainTimeline=t.createTimeline(),n.intro&&this.mainTimeline.placeOnTimeline(za(`${this.id}_main_intro`,n.intro,t));const e=za(`${this.id}_main_loop`,n.loop,t);this.mainTimeline.placeOnTimeline(e,"end",{loop:!0})}}play(){this.state.showCta=!0,super.play()}}};class nc{#d=so({});#h=so("ekonovar");#f=so(0);#p=so(0);#m=so(fo({itemIndex:0,moduleIndex:0}));#v=Qr((()=>{var t;return null===(t=_s(this.#d))||void 0===t?void 0:t[_s(this.#h)]}));#g=Qr((()=>{var t;return null===(t=_s(this.#v))||void 0===t?void 0:t[_s(this.#f)]}));#y=Qr((()=>{var t,e;return _s(this.#b)?null===(e=_s(this.#v))||void 0===e?void 0:e[_s(this.#m).itemIndex].modules[_s(this.#m).moduleIndex]:null===(t=_s(this.#g))||void 0===t?void 0:t.modules[_s(this.#p)]}));#k=Qr((()=>{var t;return(null===(t=_s(this.#v))||void 0===t?void 0:t.flatMap((t=>t.modules)))||[]}));#x=so(!1);#w=so(!1);#b=so(!1);#_=Qr((()=>!(_s(this.#m).itemIndex===this.activeItemIndex&&_s(this.#m).moduleIndex===this.activeModuleIndex)));set variants(t){lo(this.#d,t)}set activeVariant(t){lo(this.#h,t,!0)}set activeItemIndex(t){lo(this.#f,t,!0)}set activeModuleIndex(t){lo(this.#p,t,!0)}set playingModulePosition(t){lo(this.#m,t,!0)}set playerLoaded(t){lo(this.#x,t,!0)}set paused(t){lo(this.#w,t,!0)}set startedPlaying(t){lo(this.#b,t,!0)}get variants(){return _s(this.#d)}get activeVariant(){return _s(this.#h)}get activeItemIndex(){return _s(this.#f)}get activeModuleIndex(){return _s(this.#p)}get playingModulePosition(){return _s(this.#m)}get currentItemsList(){return _s(this.#v)}get currentItem(){return _s(this.#g)}get currentModule(){return _s(this.#y)}get playerLoaded(){return _s(this.#x)}get paused(){return _s(this.#w)}get startedPlaying(){return _s(this.#b)}get seeking(){return _s(this.#_)}get currentModulesList(){return _s(this.#k)}}const ic={assetsDeliveryBase:"https://{{env}}assets.eko.com"},rc=2,oc=5,sc=["activeItemIndex","activeModuleIndex","paused","startedPlaying"],ac=["version","selectItem","selectItemAndStep","next","prev","subscribe"];var lc=new WeakMap,cc=new WeakMap,uc=new WeakMap,dc=new WeakMap,hc=new WeakSet;class fc{constructor(t){var e,n,i;U(this,hc),W(this,lc,void 0),W(this,cc,void 0),W(this,uc,void 0),W(this,dc,void 0),$(this,"public",void 0),$(this,"version","0.0.8"),Ra(this),j(uc,this,t),j(lc,this,new nc(null==t||null===(e=t.options)||void 0===e?void 0:e.galleryEnv)),j(dc,this,((t="")=>("production"===t&&(t=""),Object.fromEntries(Object.entries(ic).map((([e,n])=>[e,n.replaceAll("{{env}}",t)])))))(null==t||null===(n=t.options)||void 0===n?void 0:n.galleryEnv)),j(cc,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?(L(hc,this,pc).call(this,r.items),L(hc,this,mc).call(this,r.items)):console.warn("[eko-gallery-app] Gallery initiated without an instance, results will be empty"),this.public=(o=this,ac.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){z(lc,this).playerLoaded=!0,z(cc,this).forEach((e=>{e.start(t)})),j(cc,this,null),L(hc,this,vc).call(this,t),z(lc,this).currentModule.play()}selectItem(t){const e=z(lc,this);t!==e.activeItemIndex&&(e.activeItemIndex=t,e.activeModuleIndex=0)}selectItemAndStep(t,e){const n=z(lc,this);t===n.activeItemIndex&&e===n.activeModuleIndex||(n.activeItemIndex=t,n.activeModuleIndex=e)}next(){L(hc,this,yc).call(this)}prev(){const t=z(lc,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=z(lc,this);return function(t){cr.ensure();const e=Fo(Hn|oi,t,!0);return()=>{qo(e)}}((()=>{Po((()=>{const n=sc.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=z(uc,this))&&void 0!==o&&null!==(o=o.coverAssetsMap)&&void 0!==o&&o[s]?(l=new URL(z(uc,this).coverAssetsMap[s]),/^[a-z0-9]*assets.eko.com$/.test(l.host)&&e&&(l.pathname=l.pathname.replace(".png",".webp"))):(l=new URL(`${z(dc,this).assetsDeliveryBase}/image/${s}/${a}?startOffset=0`),l.pathname+=e?".webp":".png"),e&&l.searchParams.set("width",e),l.href}get currentConfig(){return z(uc,this)}get state(){return z(lc,this)}get urls(){return z(dc,this)}}function pc(t){const e={};for(let n of t)for(let t of Object.keys(n.variants||{}))e[t]=[];e.ekonovar=[],z(lc,this).variants=e}function mc(t){const e=(t=[],e)=>{const n=[];for(let[i,r]of t.entries()){if(!ec[r.itemType])throw new Error(`Unknown module type ${r.itemType}`);const t=new ec[r.itemType]({position:{...e,moduleIndex:i},config:r,galleryState:z(lc,this)});t.moduleEndListener=L(hc,this,gc).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(z(lc,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}),j(cc,this,[...z(cc,this),...n.modules]),a.push(n)}}}}function vc(t){for(const[,e]of Object.entries(z(lc,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:rc},...c.map((t=>({nodeId:t.id,weight:oc})))];for(const e of s.timeline.placements){t.getNode(e.nodeId).setChildren(u)}}}}function gc(){const t=z(lc,this),e=t.currentItem.modules;e.length>1&&t.activeModuleIndex===e.length-1?t.activeModuleIndex=0:L(hc,this,yc).call(this)}function yc(){const t=z(lc,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 bc=Ds('<button><span class="svelte-er27y2"> </span></button>'),kc=Ds('<div class="nav-buttons-container svelte-er27y2"><div class="nav-buttons svelte-er27y2"></div></div>');const xc={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);}"};Fs(["click"]);const wc="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 _c=Ds('<button><img class="svelte-1al44kl"/></button>');const Tc={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 Ic(t,e){oa(t,Tc);const n=Fa(e,"hidden",3,!1);var i=_c();let r;i.__click=function(...t){var n;null===(n=e.onClick)||void 0===n||n.apply(this,t)};var o=_o(i);Ii(i),Bo((()=>{var t;r=ha(i,1,`nav-button ${null!==(t=e.type)&&void 0!==t?t:""}`,"svelte-1al44kl",r,{hidden:n()}),_a(i,"aria-label",e.type),_a(o,"src",wc),_a(o,"alt",e.type)})),Ls(t,i)}Fs(["click"]);var Ec=Ds('<button><span class="svelte-1mxltt0"> </span></button>'),Sc=Ds('<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 Ac={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 {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 Nc(t,e){Pi(e,!0),oa(t,Ac);const n=16,i=32,r=Ci("state");let o=so(null),s=so(null),a=so(!1),l=so(!1);const c=Qr((()=>{let t=[];return t=r().currentItem.modules.map(((t,e)=>({index:e,type:e===r().activeModuleIndex?"active":"",name:t.name}))),t}));function u(){_s(o)&&(lo(a,_s(o).scrollLeft>3),lo(l,_s(o).scrollLeft+_s(o).clientWidth<_s(o).scrollWidth-3))}function d(t){_s(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(_s(o).querySelectorAll(".step-button")).find((t=>{const e=t.getBoundingClientRect(),n=_s(o).getBoundingClientRect();return e.left>n.left+i}));if(t){const e=t.previousElementSibling;e&&h(_s(o),e)}}function p(){const t=Array.from(_s(o).querySelectorAll(".step-button")).reverse().find((t=>{const e=t.getBoundingClientRect(),n=_s(o).getBoundingClientRect();return e.right<n.right-i}));if(t){const e=t.nextElementSibling;e&&h(_s(o),e)}}Po((()=>{if(_s(o)){u();const t=new MutationObserver((()=>{const t=_s(o).querySelector(".step-button.active");t&&lo(s,t,!0)}));return t.observe(_s(o),{attributes:!0,attributeFilter:["class"],subtree:!0}),()=>{t.disconnect()}}})),Po((()=>{_s(s)&&_s(o)&&h(_s(o),_s(s))}));var m=Rs();Ms("resize",mo,u),function(t,e,n){xi&&Ti();var i=new Ys(t);zo((()=>{var t=e();i.ensure(t,n)}))}(To(m),(()=>r().activeItemIndex),(t=>{var e=Sc(),n=_o(e);let i;n.__click=f;var s=Io(n,2);let d;ea(s,21,(()=>_s(c)),Js,((t,e)=>{var n=Ec();let i;n.__click=t=>{return n=t.currentTarget,i=_s(e).index,r().activeModuleIndex=i,void h(_s(o),n);var n,i};var s=_o(n),a=_o(s,!0);Ii(s),Ii(n),Bo((()=>{i=ha(n,1,"step-button svelte-1mxltt0",null,i,{active:"active"===_s(e).type}),_a(n,"aria-label",`Go to step $${_s(e).index+1}`),qs(a,_s(e).name)})),Ls(t,n)})),Ii(s),Na(s,(t=>lo(o,t)),(()=>_s(o)));var m=Io(s,2);let v;m.__click=p,Ii(e),Bo(((t,e)=>{i=ha(n,1,"step-arrow step-arrow-prev svelte-1mxltt0",null,i,{visible:_s(a)}),d=ha(s,1,"steps-indicator svelte-1mxltt0",null,d,t),pa(s,`--stepDuration: ${null!=e?e:""}s`),v=ha(m,1,"step-arrow step-arrow-next svelte-1mxltt0",null,v,{visible:_s(l)})}),[()=>({"with-duration":r().currentModule.hasDuration,paused:r().paused}),()=>r().currentModule.duration]),Ms("scroll",s,u),Ls(t,e)})),Ls(t,m),Di()}Fs(["click"]);const Mc="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",Fc="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 Oc=Ds('<img alt="Play" class="svelte-a3r6re"/>'),Cc=Ds('<img alt="Pause" class="svelte-a3r6re"/>'),Pc=Ds('<button class="pause-button svelte-a3r6re"><!></button>');const Dc={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;}"};Fs(["click"]);const Rc=300,Lc=60,Bc="none";function zc(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function Wc(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 jc(t,e,n,i,r){const o=Wc(t,n,i);return t.dispatchEvent(new CustomEvent(`${e}${r}`,{detail:o})),o}function Uc(){let t=[],e=()=>{},n=[];return{setPointerControls:(i,r,o,s,a,l=Bc,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=jc(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=jc(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=zc(r,"pointermove",(e=>{t=t.map((t=>e.pointerId===t.pointerId?e:t));const s=jc(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=zc(r,"lostpointercapture",(t=>{c(t)})),h=zc(r,"pointerup",(t=>{c(t)})),f=zc(r,"pointerleave",(t=>{c(t)}))};e=zc(r,"pointerdown",l)}return{destroy:()=>{t.length||(e(),n.forEach((t=>{var e;null===(e=t.onDestroy)||void 0===e||e.call(t)})))}}}}}const $c="@attach";const qc="swipe";function Vc(t,e,n,i=!1){const{setPointerControls:r}=Uc(),o=i?qc:Symbol($c);return{...n,[`on${qc}`]:t,[o]:t=>{const{onDown:n,onUp:i,parameters:o}=function(t,e){const n={timeframe:Rc,minSwipeDistance:Lc,touchAction:Bc,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(qc,{detail:{direction:u,target:s,pointerType:a.pointerType}}))}}return{onDown:a,onUp:l,parameters:n}}(t,null==e?void 0:e());return r(qc,t,null,n,i,o.touchAction,o.plugins).destroy}}}const Gc=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 Hc=Ds("<div></div>");const Kc={hash:"svelte-1fv6njc",code:".swiper.svelte-1fv6njc {position:absolute;top:0;left:0;pointer-events:auto;width:100%;height:100%;}"};var Xc=Ds("<img/>"),Yc=Ds('<div class="ui-container svelte-1rvgxfc"><!></div>'),Qc=Ds('<div class="cover-container svelte-1rvgxfc"><!> <!> <!></div>'),Jc=Ds('<div class="covers-container svelte-1rvgxfc" style="scroll-behavior: auto;"></div>');const Zc={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 tu(t,e){Pi(e,!0),oa(t,Zc);const n=[375,768,1024,1400,1920];let i=Fa(e,"scrollOffset",15),r=Fa(e,"isMobile",3,!1);const o=Ci("state");let s,a=Qr((()=>o().playingModulePosition)),l=null,c=null,u=Qr((()=>o().startedPlaying)),d=Qr((()=>o().currentModulesList)),h=Qr((()=>_s(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=_s(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=_s(d)[y],k={itemIndex:o().activeItemIndex,moduleIndex:o().activeModuleIndex};if(!l){const t=s.children[_s(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=_s(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),lo(a,b.position)}function v(){}Po((()=>{const{activeItemIndex:t,activeModuleIndex:e}=o();t===_s(a).itemIndex&&e===_s(a).moduleIndex||Es((()=>{var n,i;const r=_s(d).findIndex((n=>{const{itemIndex:i,moduleIndex:r}=n.position;return t===i&&e===r}));l=(null===(n=_s(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"})}))})),Po((()=>{_s(u)&&Es((()=>{}))}));var g=Rs(),y=To(g),b=t=>{var i=Jc();ea(i,23,(()=>_s(d)),(t=>t.id),((t,i,o)=>{var s=Qc(),a=_o(s),l=t=>{var r=Xc();let s;Bo((t=>{s=ha(r,1,"cover-image svelte-1rvgxfc",null,s,{hidden:_s(u)&&_s(o)===_s(h),"force-show":_s(i).showCover}),_a(r,"src",t),_a(r,"alt",_s(i).name),_a(r,"fetchpriority",0===_s(o)?"high":"auto")}),[()=>e.gallery.getCoverUrl(_s(i).cover,n[n.length-1])]),Ms("load",r,(function(...t){var e;null===(e=0===_s(o)?v:()=>{})||void 0===e||e.apply(this,t)})),function(t){if(!xi)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),Ls(t,r)};Qs(a,(t=>{t(l)}));var c=Io(a,2),d=t=>{!function(t,e){Pi(e,!0),oa(t,Kc);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=Hc();Ta(r,(t=>({...t,class:"swiper"})),[()=>Vc(i,(()=>({touchAction:"pan-y",plugins:e.debug?[Gc(n)]:[]})))],void 0,void 0,"svelte-1fv6njc"),Ls(t,r),Di()}(t,{get gallery(){return e.gallery},get debug(){return e.debug},get onEvent(){return e.onEvent}})};Qs(c,(t=>{r()&&t(d)}));var f=Io(c,2),p=t=>{var e=Yc();!function(t,e,n){xi&&Ti();var i=new Ys(t);zo((()=>{var t,r=null!==(t=e())&&void 0!==t?t:null;i.ensure(r,r&&(t=>n(t,r)))}),ni)}(_o(e),(()=>_s(i).Component),((t,e)=>{e(t,{get state(){return _s(i).state},get isMobile(){return r()}})})),Ii(e),Ls(t,e)};Qs(f,(t=>{var e;null!==(e=_s(i))&&void 0!==e&&e.Component&&t(p)})),Ii(s),Ls(t,s)})),Ii(i),Na(i,(t=>s=t),(()=>s)),Ms("scroll",i,m),Ls(t,i)};Qs(y,(t=>{_s(d)&&t(b)})),Ls(t,g),Di()}const eu="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};let nu;function iu(){const t=eu&&eu.navigator&&(eu.navigator.userAgent||eu.navigator.platform||eu.navigator.vendor)||"";if(nu&&nu.ua===t)return nu;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 nu={ua:t,isMobile:r},nu}"undefined"!=typeof window&&window.addEventListener("pageshow",(function(t){t.persisted&&setTimeout((function(){window.location.reload()}),10)}),!1);var ru=Ds('<div class="paging-buttons svelte-1n46o8q"><!> <!></div>'),ou=Ds('<div style="position: absolute; top: 0; left: 0; width: 100%;"></div>'),su=Ds("<!> <!>",1),au=Ds('<div class="player-container svelte-1n46o8q"><div class="player-div swipable svelte-1n46o8q"></div> <!> <!> <!> <!></div> <!>',1),lu=Ds('<div class="eko-gallery-app svelte-1n46o8q"><!></div>');const cu={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 uu(t,e){Pi(e,!0),oa(t,cu);const n=Fa(e,"config",19,(()=>({}))),i=Fa(e,"forceMobile",3,!1),r=Fa(e,"videoAspectRatio",3,"unset"),o=Fa(e,"onGalleryReady",3,(()=>{})),s=Fa(e,"onEvent",3,(()=>{}));let a,l=!1,c=so(new fc(n())),u=so(null),d=Qr((()=>i()||iu().isMobile)),h=so(0),f=so(void 0),p=so(!0),m=so(fo({width:"100%",height:"100%"}));var v,g,y;function b(){const t={AssetsDeliveryService:{assetsDeliveryServiceUrl:_s(c).urls.assetsDeliveryBase}};lo(u,new e.EkoPlayer(a,Object.assign(t,e.playerOptions))),_s(u).on("playing",(()=>{_s(c).state.paused=!1})),_s(u).on("pause",(()=>{_s(c).state.paused=!0})),_s(u).once("playing",(()=>{_s(c).state.startedPlaying=!0,s()("galleryloaded")}))}function k(t){var e;null===(e=_s(c))||void 0===e||e.selectItem(t)}function x(){var t;null===(t=_s(c))||void 0===t||t.next()}function w(){var t;null===(t=_s(c))||void 0===t||t.prev()}function _(){_s(u).paused?_s(u).play():_s(u).pause()}function T(){return`--uiTranformX: ${_s(h)}px;--videoAspect: ${r()};--videoWidth: ${_s(m).width};--videoHeight: ${_s(m).height};`}v="state",g=()=>_s(c).state,Ri().set(v,g),y=()=>(o()(_s(c).public),n()&&e.EkoPlayer&&(b(),_s(c).start(_s(u))),()=>{var t;null===(t=_s(u))||void 0===t||t.dispose()}),null===Fi&&yi(),Po((()=>{const t=Es(y);if("function"==typeof t)return t})),Po((()=>{n()&&e.EkoPlayer&&(l?Es((()=>{var t;lo(c,new fc(n())),null===(t=_s(u))||void 0===t||t.dispose(),lo(p,!1),ws().then((()=>(lo(p,!0),ws()))).then((()=>{o()(_s(c).public),b(),_s(c).start(_s(u))}))})):l=!0)})),Po((()=>{_s(f)&&_s(u)&&_s(u).loadDebugOverlay({containerElement:_s(f)})})),Po((()=>{if("unset"!==r()&&r().includes("/")){const[t,e]=r().split("/").map((t=>Number(t)));isNaN(t)||isNaN(e)||lo(m,t>e?{width:"100%",height:"auto"}:{width:"auto",height:"100%"},!0)}else lo(m,{width:"100%",height:"100%"},!0)}));var I=lu(),E=_o(I),S=t=>{var n=au(),i=To(n),r=_o(i);Na(r,(t=>a=t),(()=>a));var o=Io(r,2);tu(o,{get isMobile(){return _s(d)},get gallery(){return _s(c)},get debug(){return e.debug},get onEvent(){return s()},get scrollOffset(){return _s(h)},set scrollOffset(t){lo(h,t,!0)}});var l=Io(o,2),u=t=>{var e=ru(),n=_o(e);Ic(n,{type:"prev",onClick:w}),Ic(Io(n,2),{type:"next",onClick:x}),Ii(e),Ls(t,e)};Qs(l,(t=>{_s(d)||e.hideNav||t(u)}));var p=Io(l,2),m=t=>{Nc(t,{})};Qs(p,(t=>{var e;!_s(d)&&(null===(e=_s(c).state.currentItem)||void 0===e?void 0:e.modules.length)>1&&t(m)}));var v=Io(p,2),g=t=>{var n=su(),i=To(n);!function(t,e){Pi(e,!0),oa(t,Dc);const n=Ci("state");var i=Pc();i.__click=function(...t){var n;null===(n=e.onPauseClick)||void 0===n||n.apply(this,t)};var r=_o(i),o=t=>{var e=Oc();Bo((()=>_a(e,"src",Mc))),Ls(t,e)},s=t=>{var e=Cc();Bo((()=>_a(e,"src",Fc))),Ls(t,e)};Qs(r,(t=>{n().paused?t(o):t(s,!1)})),Ii(i),Bo((t=>_a(i,"aria-label",t)),[()=>n().paused?"Play":"Pause"]),Ls(t,i),Di()}(i,{onPauseClick:_});var r=Io(i,2),o=t=>{var e=ou();Na(e,(t=>lo(f,t)),(()=>_s(f))),Ls(t,e)};Qs(r,(t=>{e.debug&&t(o)})),Ls(t,n)};Qs(v,(t=>{_s(c).state.startedPlaying&&t(g)})),Ii(i);var y=Io(i,2),b=t=>{!function(t,e){Pi(e,!0),oa(t,xc);let n=Fa(e,"onNavItemClick",3,(()=>{}));const i=Ci("state");var r=kc(),o=_o(r);ea(o,23,(()=>i().currentItemsList),(t=>t.id),((t,e,r)=>{var o=bc();let s;o.__click=()=>n()(_s(r));var a=_o(o),l=_o(a,!0);Ii(a),Ii(o),Bo((t=>{s=ha(o,1,"nav-button svelte-er27y2",null,s,t),qs(l,_s(e).name)}),[()=>({selected:_s(r)===i().activeItemIndex})]),Ls(t,o)})),Ii(o),Ii(r),Ls(t,r),Di()}(t,{onNavItemClick:k})};Qs(y,(t=>{e.hideNav||t(b)})),Bo((t=>pa(i,t)),[T]),Ls(t,n)};Qs(E,(t=>{n()&&_s(p)&&t(S)})),Ii(I),Ls(t,I),Di()}function du(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var hu,fu,pu,mu,vu={exports:{}},gu=du((hu||(hu=1,pu=vu.exports,mu=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},(fu=vu).exports?fu.exports=mu():pu.log=mu()),vu.exports));const yu=()=>{},bu=["trace","log","debug","info","warn","error","getLevel","setLevel"],ku=["trace","debug","info","warn","error","silent"],xu={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;"},wu="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global;let _u={level:"trace",appName:""},Tu=[];const Iu="object"==typeof wu&&wu.performance&&"function"==typeof wu.performance.now?wu.performance.now.bind(wu.performance):Date.now.bind(Date),Eu=t=>t&&"string"==typeof t?t.toLowerCase().trim():"",Su=(()=>{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[Eu(e)]=Eu(i)||"trace"})),n}catch(t){return{}}})(),Au=(t,e="")=>{const n=Eu(t),i=gu.getLogger(n);if(i.__ekologger)return i.__ekologger;e||Su[n]||Su["*"]||(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)=>(Iu()/1e3).toFixed(e))()}] %c[${s}] ${_u.appName?`[${_u.appName}] `:""}[${t}]`,xu[s],...e)}},e=Su[n]||Su["*"]||e||_u.level,i.setLevel(e,!1);const o=(...t)=>i.log(...t);return bu.forEach((t=>{o[t]=(...e)=>(Tu.forEach((n=>{n[t](...e)})),i[t](...e))})),i.__ekologger=o,o};Au.setDefaults=({appName:t="",level:e})=>{t&&"string"==typeof t&&(_u.appName=t),(e=Eu(e))&&ku.includes(e)&&(_u.level=e,Object.values(gu.getLoggers()).filter((t=>t.__noExplicitLevel)).forEach((t=>t.setLevel(_u.level,!1))))},Au.installDriver=t=>{const e={...bu.reduce(((e,n)=>(e[n]="function"==typeof(null==t?void 0:t[n])?t[n]:yu,e)),{})};Tu.push(e)};let Nu=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 Mu(t){return"[object Object]"===Object.prototype.toString.call(t)}function Fu(t,...e){const n=Mu(t)?{...t}:{};return e.forEach((t=>{Mu(t)&&Object.keys(t).forEach((e=>{const i=t[e],r=n[e];Mu(i)&&Mu(r)?n[e]=Fu(r,i):Array.isArray(i)?n[e]=i.slice():n[e]=i}))})),n}function Ou(t){if("string"==typeof t)return`'${t}'`;if(Array.isArray(t))return`[${t.map((t=>Ou(t))).join(", ")}]`;if(Mu(t))try{return JSON.stringify(t)}catch(t){return"[object Object]"}return null===t?"null":void 0===t?"undefined":String(t)}function Cu(t){return Array.from(t).map((t=>Ou(t))).join(", ")}var Pu=new WeakSet;class Du extends Nu{constructor(...t){super(),U(this,Pu);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=Au(n,this.loglevel);const i=Mu(this.defaults)?this.defaults:{},r=Mu(e)&&Mu(e[n])?e[n]:{};this.settings=Fu({},i,r),L(Pu,this,Ru).call(this),L(Pu,this,Lu).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 Ru(){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}(${Cu(t)})`),a(...t)):a,t.add(o)}n=Object.getPrototypeOf(n)}}function Lu(){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 Bu="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};function zu(t){return Boolean(t)&&"object"==typeof t&&1===t.nodeType&&"function"==typeof t.appendChild}class Wu extends Du{#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==Bu?void 0:Bu.document)){if(zu(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 zu(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==Bu?void 0:Bu.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 ju=new WeakMap,Uu=new WeakMap,$u=new WeakMap,qu=new WeakMap,Vu=new WeakMap,Gu=new WeakMap,Hu=new WeakSet;class Ku extends Du{get name(){return"ContainerSize"}get containerWidth(){return z(Uu,this)}get containerHeight(){return z($u,this)}get width(){return z(Uu,this)}get height(){return z($u,this)}constructor(...t){super(...t),U(this,Hu),W(this,ju,void 0),W(this,Uu,0),W(this,$u,0),W(this,qu,null),W(this,Vu,null),W(this,Gu,null);const[e]=t;var n;j(ju,this,(n=e)&&n.element&&zu(n.element)?n.element:zu(n)?n:null),z(ju,this)&&(L(Hu,this,Yu).call(this,!0),L(Hu,this,Xu).call(this))}onDispose(){z(qu,this)&&"function"==typeof z(qu,this).disconnect&&z(qu,this).disconnect(),j(qu,this,null),z(Gu,this)&&"function"==typeof(null==Bu?void 0:Bu.removeEventListener)&&Bu.removeEventListener("resize",z(Gu,this)),j(Gu,this,null),z(Vu,this)&&((null==Bu?void 0:Bu.clearInterval)||clearInterval)(z(Vu,this)),j(Vu,this,null),j(ju,this,null)}}function Xu(){if(!z(ju,this))return;const t=null==Bu?void 0:Bu.ResizeObserver;if("function"==typeof t)return j(qu,this,new t((()=>L(Hu,this,Yu).call(this)))),void z(qu,this).observe(z(ju,this));j(Gu,this,(()=>L(Hu,this,Yu).call(this))),"function"==typeof(null==Bu?void 0:Bu.addEventListener)&&Bu.addEventListener("resize",z(Gu,this));const e=(null==Bu?void 0:Bu.setInterval)||setInterval;j(Vu,this,e((()=>L(Hu,this,Yu).call(this)),250))}function Yu(t=!1){if(!z(ju,this))return;const{width:e,height:n}=function(t){const e=Number(null==t?void 0:t.clientWidth),n=Number(null==t?void 0:t.clientHeight);return{width:Number.isFinite(e)&&e>0?Math.round(e):0,height:Number.isFinite(n)&&n>0?Math.round(n):0}}(z(ju,this));(t||e!==z(Uu,this)||n!==z($u,this))&&(j(Uu,this,e),j($u,this,n),this.trigger("containerresize",{width:e,height:n}))}var Qu={VIDEO_SOURCE_PREFIX:"__SRC_VID:",TEXTURE_SOURCE_PREFIX:"__SRC_TEXTURE:",PREVIOUS_OUTPUT_PREFIX:"__PREVIOUS:",SAVED_FRAME_PREFIX:"__SAVED_FRAME:",SYSTEM_NODES:{FILTERS:{RENDER_TO_CANVAS:"__default"},TAGS:{ATOM:"atom",FILTER:"filter",COMPOSITE_FILTER:"composite",TRANSITION_FILTER:"transition"}},MESSAGES:{UPDATE_OPTIONS:"update_options"}};class Ju{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 Zu,td={exports:{}},ed=(Zu||(Zu=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}(td)),td.exports),nd=du(ed);class id extends Ju{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 nd;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)}}class rd extends Ju{constructor(t){super(t,!1)}initCanvas(t,e){const n=function(){const t=document.querySelector("video");t&&t.videoHeight&&e(t),requestAnimationFrame(n)};return requestAnimationFrame(n),document.getElementById(t)}}class od extends Ju{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 sd=function(t){let e;return e="string"==typeof t?new rd(t):t&&t.src&&t.dest?new od(t):new id(t),e};function ad(t){return Array.isArray(t)||(t=[t]),t}class ld{constructor(t){this.store=t?{...t.get()}:{}}reset(){this.store={}}get(t){if(!t)return this.store;const e=(t=ad(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=ad(t),e=ad(e),t.length!==e.length)throw new Error(`cant set values ${e} to keys ${t}, length did not match`);t.forEach(((t,n)=>{this.store[t]=e[n]}))}}class cd{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 ud=Au("frame","warn");let dd=!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");dd=e||n}function hd(t,e){const n=t.gl;var i;n.texImage2D(t.bindPoint,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e),t.__hasAllocated=!0,i=t,Number.isFinite(i.width)&&Number.isFinite(i.height)&&(i.actualWidth=i.width,i.actualHeight=i.height,i.textureObjectInfo&&(i.textureObjectInfo.allocatedWidth=i.width,i.textureObjectInfo.allocatedHeight=i.height))}class fd extends cd{fill(t){if(dd&&(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?hd(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,hd(t,e)):t.__useSubImage=!0))}(this,t,e);const i=(performance.now()-n)/1e3;i>=.1&&ud.warn(`[fill] texImage2D() took ${i.toFixed(3)} seconds to execute.`),"function"==typeof t.close&&!0!==t.__keepOpen&&(t.close(),t.__closed=!0)}}class pd extends cd{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 md=function(t,e,n,i,r){let o;switch(t){case"frame":o=new fd(e,n,i,r);break;case"pixel":o=new pd(e,n,i,r);break;default:throw new Error(`cant recognize type ${t}`)}return o};class vd{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=md(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 gd=Qu.VIDEO_SOURCE_PREFIX,yd=Qu.TEXTURE_SOURCE_PREFIX,bd=Qu.PREVIOUS_OUTPUT_PREFIX,kd=Qu.SAVED_FRAME_PREFIX;function xd(t,e,n){t.set(`${gd}${n}`,e)}function wd(t,e,n){t.set(`${bd}${n}`,e)}function _d(t,e,n){t.set(`${kd}${n}`,e)}class Td{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()))xd(t,n,e),wd(t,n,e);for(const[e,n]of Object.entries(this.capturedFramesManager.getSavedFrames()))_d(t,n,e)}setTextureSource(t,e,n){t.set(`${yd}${n}`,e)}getInput(t,e){return t.get(e)}getPrevOutput(t,e){return e=Number.isInteger(e)?e:0,t.get(`${bd}${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)=>{wd(t,e,n)})),e.forEach(((e,i)=>{t.set(e,n[i])}))}disposeTextures(t,e){const n=e.getUnit();t.forEach((t=>{const e=t.getUnit();this.capturedFramesManager.isReservedUnit(e)||n===e||this.textureManager.releaseTexture(t)}))}disposeAllStore(t){const e=new Set;Object.values(t.get()).forEach((t=>{const n=t.getUnit();this.capturedFramesManager.isReservedUnit(n)||e.has(n)||t.isStatic||(this.textureManager.releaseTexture(t),e.add(n))}))}}class Id{constructor(t){this.context=t}bind(){throw new Error("impl in concrete")}}let Ed=100,Sd=100;function Ad(t,e){Ed=t,Sd=e}let Nd=class extends Id{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),Ad(i,r)),t}},Md=class extends Id{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 Fd{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===Qu.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS?new Nd({gl:this.gl}):new Md({gl:this.gl,textureManager:this.textureManager,frameBufferObject:this.getFrameBufferObject(),useCanvasSizedFilterTargets:this.useCanvasSizedFilterTargets}),e}}function Od(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 Cd=function(t,e){return Od(t,t.VERTEX_SHADER,e)},Pd=function(t,e){return Od(t,t.FRAGMENT_SHADER,e)};const Dd={position_3d:0,texture_coordinate_2d:1};var Rd=function(t,e,n){const i=t.createProgram();if(t.attachShader(i,e),t.attachShader(i,n),Object.entries(Dd).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)},Ld=[-1,-1,1,1,-1,1,-1,1,1,1,1,1],Bd=[0,1,2,2,1,3],zd=[0,0,1,0,0,1,1,1];const Wd=96,jd=[new Float32Array(new ArrayBuffer(Wd)),new Float32Array(new ArrayBuffer(Wd)),new Float32Array(new ArrayBuffer(Wd)),new Float32Array(new ArrayBuffer(Wd)),new Float32Array(new ArrayBuffer(Wd)),new Float32Array(new ArrayBuffer(Wd))],Ud=[new Int16Array(6),new Int16Array(6),new Int16Array(6)];class $d{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=jd[this.floatBufferCounter],this.floatBufferCounter=this.floatBufferCounter++%jd.length;break;case this.gl.ELEMENT_ARRAY_BUFFER:t=Ud[this.unit16BufferCounter],this.unit16BufferCounter=this.unit16BufferCounter++%Ud.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 qd={position_3d:class extends $d{getPointerData(){return{size:3,type:this.gl.FLOAT,normalize:!1,stride:0,offset:0}}},position_indexes:class extends $d{setPointer(){}getPointerData(){}enable(){}},texture_coordinate_2d:class extends $d{getPointerData(){return{size:2,type:this.gl.FLOAT,normalize:!0,stride:0,offset:0}}}};var Vd=function(t,e,n){const i=qd[t];if(!i)throw new Error(`${t} is not a attribute name,choose from list: ${Object.keys(qd)}`);return new i(t,e,n)};class Gd{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 Hd extends Gd{set(t){this.gl.uniform1fv(this.location,t)}}class Kd extends Gd{set(t){t&&(t.beforeUse(),this.gl.uniform1i(this.location,t.getUnit()))}}const Xd="first_texture_dimensions",Yd="viewport_dimensions",Qd="time",Jd={RUNTIME_OPTIONS:"runtimeOptions[0]",STATIC_OPTIONS:"staticOptions[0]",FIRST_TEXTURE:"first_texture",SECOND_TEXTURE:"second_texture",FIRST_MATRIX:"first_mat4"},Zd={[Jd.FIRST_TEXTURE]:Kd,[Jd.SECOND_TEXTURE]:Kd,[Jd.FIRST_MATRIX]:class extends Gd{set(t){this.gl.uniformMatrix4fv(this.location,!1,t)}},[Jd.STATIC_OPTIONS]:Hd,[Jd.RUNTIME_OPTIONS]:Hd};var th=function(t,e){const n=Zd[t];if(!n)throw new Error(`${t} is not a attribute name,choose from list: ${Object.keys(Zd)}`);return new n(t,e)},eh=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 nh="position_3d",ih="position_indexes",rh="texture_coordinate_2d";class oh{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=Cd(this.gl,e.vertex),this.fragmentShader=Pd(this.gl,e.fragment),this.program=Rd(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:nh,bindPoint:e.gl.ARRAY_BUFFER},{id:ih,bindPoint:e.gl.ELEMENT_ARRAY_BUFFER},{id:rh,bindPoint:e.gl.ARRAY_BUFFER}].concat(t)).forEach((t=>{const i=t.id;n[i]=Vd(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]=th(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:Jd.RUNTIME_OPTIONS},{id:Jd.STATIC_OPTIONS}];return(t.getUniformList||oh.getUniformList)().forEach((t=>{Object.values(Jd).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||oh.getUniformList)().forEach((t=>{switch(t){case Jd.FIRST_TEXTURE:this.uniforms[Jd.FIRST_TEXTURE].set(r[0]);break;case Jd.SECOND_TEXTURE:this.uniforms[Jd.SECOND_TEXTURE].set(r[1]);break;case Xd:o=[...o,r[0].getWidth(),r[0].getHeight()];break;case Yd:o=[...o,i.width,i.height];break;case Qd:{const t=eh(e.startTime,e.duration);o=[...o,t];break}}})),o.length>0&&this.uniforms[Jd.RUNTIME_OPTIONS].set(o)}static getUniformList(){return[Jd.FIRST_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(){}handleAttributes(){this.attributes[nh].fillBuffer(Ld),this.attributes[nh].setPointer(),this.attributes[ih].fillBuffer(Bd),this.attributes[rh].fillBuffer(zd),this.attributes[rh].setPointer()}disposeAttributes(){Object.values(this.attributes).forEach((t=>{t.dispose()}))}render(t,e){const n=this.frameBuffer.bind(t);let i={width:Ed,height:Sd};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 sh extends oh{constructor(t){const e={uniforms:oh.getUniformInfo(sh)};super(sh.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 ah,lh="undefined"!=typeof Float32Array?Float32Array:Array;function ch(){var t=new lh(3);return lh!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function uh(t,e,n){var i=new lh(3);return i[0]=t,i[1]=e,i[2]=n,i}function dh(){var t=new lh(4);return lh!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}ch(),function(){var t;t=new lh(4),lh!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}(),ch(),uh(1,0,0),uh(0,1,0),dh(),dh(),ah=new lh(9),lh!=Float32Array&&(ah[1]=0,ah[2]=0,ah[3]=0,ah[5]=0,ah[6]=0,ah[7]=0),ah[0]=1,ah[4]=1,ah[8]=1;class hh extends oh{constructor(t){const e={uniforms:oh.getUniformInfo(hh)};super(hh.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:hh.getInitialOptions().translate.x},{properties:["translate","y"],type:"slider",minValue:-2,maxValue:2,step:.001,initialValue:hh.getInitialOptions().translate.y},{properties:["scale","x"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:hh.getInitialOptions().scale.x},{properties:["scale","y"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:hh.getInitialOptions().scale.y},{properties:["rotate"],type:"slider",minValue:-360,maxValue:360,step:1,initialValue:hh.getInitialOptions().rotate}]}static getUniformList(){return[Jd.FIRST_TEXTURE,Jd.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 lh(16),lh!=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}(dh(),0,0,o),uh(e,n,0),uh(i,r,1)),this.uniforms[Jd.FIRST_MATRIX].set(this.transformMatrix)}}class fh extends oh{constructor(t){const e={uniforms:oh.getUniformInfo(fh)};super(fh.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[Jd.FIRST_TEXTURE,Xd]}}class ph extends oh{constructor(t){const e={uniforms:oh.getUniformInfo(ph)};super(ph.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[Jd.FIRST_TEXTURE,Xd]}}class mh extends oh{constructor(t){const e={uniforms:oh.getUniformInfo(mh)};super(mh.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[Jd.FIRST_TEXTURE,Xd,Yd]}handleStaticUniforms(t){var e;const n=(null!==(e=Number.parseFloat(t.offsetDist))&&void 0!==e?e:4).toFixed(3);this.uniforms[Jd.STATIC_OPTIONS].set([n])}}class vh extends oh{constructor(t){const e={uniforms:oh.getUniformInfo(vh)};super(vh.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[Jd.FIRST_TEXTURE,Xd,Yd]}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[Jd.STATIC_OPTIONS].set([i,r])}}class gh extends oh{constructor(t){const e={uniforms:oh.getUniformInfo(gh)};super(gh.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[Jd.STATIC_OPTIONS].set([e])}}class yh extends oh{constructor(t){const e={uniforms:oh.getUniformInfo(yh)};super(yh.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[Jd.FIRST_TEXTURE,Xd,Jd.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[Jd.STATIC_OPTIONS].set([e,n,i,r,o,s,a])}}class bh extends oh{constructor(t){const e={uniforms:oh.getUniformInfo(bh)};super(bh.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[Jd.FIRST_TEXTURE,Jd.SECOND_TEXTURE]}}class kh extends oh{constructor(t){const e={uniforms:oh.getUniformInfo(kh)};super(kh.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[Jd.FIRST_TEXTURE,Jd.SECOND_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(t){const e=Number.parseFloat(t.lutSize).toFixed(1);this.uniforms[Jd.STATIC_OPTIONS].set([e])}}var xh="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",wh='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:_h,cos:Th,sin:Ih,acos:Eh,atan2:Sh,sqrt:Ah,pow:Nh}=Math;function Mh(t){return t<0?-Nh(-t,1/3):Nh(t,1/3)}const Fh=Math.PI,Oh=2*Fh,Ch=Fh/2,Ph=Number.MAX_SAFE_INTEGER||9007199254740991,Dh=Number.MIN_SAFE_INTEGER||-9007199254740991,Rh={x:0,y:0,z:0},Lh={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),Ah(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],Rh],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||Lh.approximately(t,e)||Lh.approximately(t,n)},approximately:function(t,e,n){return _h(t-e)<=(n||1e-6)},length:function(t){const e=Lh.Tvalues.length;let n=0;for(let i,r=0;r<e;r++)i=.5*Lh.Tvalues[r]+.5,n+=Lh.Cvalues[r]*Lh.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(Lh.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 Sh(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 Ah(n*n+i*i)},closest:function(t,e){let n,i,r=Nh(2,63);return t.forEach((function(t,o){i=Lh.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=Nh(t,e)+Nh(1-t,e);return _h((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=Nh(1-t,e);return n/(Nh(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 Lh.lli8(r,o,s,a,l,c,u,d)},lli:function(t,e){return Lh.lli4(t,t.c,e,e.c)},makeline:function(t,e){return new Hh(t.x,t.y,(t.x+e.x)/2,(t.y+e.y)/2,e.x,e.y)},findbbox:function(t){let e=Ph,n=Ph,i=Dh,r=Dh;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(!Lh.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=Lh.makeline(e.points[i-1],t.points[0]),s=Lh.makeline(t.points[r-1],e.points[0]),a={startcap:o,forward:t,back:e,endcap:s,bbox:Lh.findbbox([o,t,e,s]),intersections:function(t){return Lh.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=Ph,s=Dh;-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=-Sh(e.p2.y-i,e.p2.x-n);return t.map((function(t){return{x:(t.x-n)*Th(r)-(t.y-i)*Ih(r),y:(t.x-n)*Ih(r)+(t.y-i)*Th(r)}}))},roots:function(t,e){e=e||{p1:{x:0,y:0},p2:{x:1,y:0}};const n=t.length-1,i=Lh.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=-Ah(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(Lh.approximately(l,0)){if(Lh.approximately(c,0))return Lh.approximately(u,0)?[]:[-d/u].filter(r);const t=Ah(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=Ah(t*t*t),n=-p/(2*e),i=Eh(n<-1?-1:n>1?1:n),o=2*Mh(e);return b=o*Th(i/3)-c/3,k=o*Th((i+Oh)/3)-c/3,x=o*Th((i+2*Oh)/3)-c/3,[b,k,x].filter(r)}if(0===v)return g=m<0?Mh(-m):-Mh(m),b=2*g-c/3,k=-g-c/3,[b,k].filter(r);{const t=Ah(v);return g=Mh(-m+t),y=Mh(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=-Ah(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=Lh.compute(t,e),h=Lh.compute(t,n),f=d.x*d.x+d.y*d.y;if(i?(o=Ah(Nh(d.y*h.z-h.y*d.z,2)+Nh(d.z*h.x-h.z*d.x,2)+Nh(d.x*h.y-h.x*d.y,2)),s=Nh(f+d.z*d.z,1.5)):(o=d.x*h.y-d.y*h.x,s=Nh(f,1.5)),0===o||0===s)return{k:0,r:0};if(c=o/s,u=s/o,!r){const r=Lh.curvature(t-.001,e,n,i,!0).k,o=Lh.curvature(t+.001,e,n,i,!0).k;l=(o-c+(c-r))/2,a=(_h(o-c)+_h(c-r))/2}return{k:c,r:u,dk:l,adk:a}},inflections:function(t){if(t.length<4)return[];const e=Lh.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(Lh.approximately(o,0)){if(!Lh.approximately(s,0)){let t=-a/s;if(0<=t&&t<=1)return[t]}return[]}const l=2*o;if(Lh.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,_h(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 Lh.bboxoverlap(t.left.bbox(),t.right.bbox())}));let u=[];return 0===c.length||(c.forEach((function(t){u=u.concat(Lh.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*Th(Ch)-r*Ih(Ch),l=i*Ih(Ch)+r*Th(Ch),c=o*Th(Ch)-s*Ih(Ch),u=o*Ih(Ch)+s*Th(Ch),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=Lh.lli8(d,h,m,v,f,p,g,y),k=Lh.dist(b,t);let x,w=Sh(t.y-b.y,t.x-b.x),_=Sh(e.y-b.y,e.x-b.x),T=Sh(n.y-b.y,n.x-b.x);return w<T?((w>_||_>T)&&(w+=Oh),w>T&&(x=T,T=w,w=x)):T<_&&_<w?(x=T,T=w,w=x):T+=Oh,b.s=w,b.e=T,b.r=k,b},numberSort:function(t,e){return t-e}};class Bh{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 Lh.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++)Lh.expandbox(e,t[n].bbox());return e}offset(t){const e=[];return this.curves.forEach((function(n){e.push(...n.offset(t))})),new Bh(e)}}const{abs:zh,min:Wh,max:jh,cos:Uh,sin:$h,acos:qh,sqrt:Vh}=Math,Gh=Math.PI;let Hh=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=Lh.align(s,{p1:s[0],p2:s[l]}),d=Lh.dist(s[0],s[l]);this._linear=u.reduce(((t,e)=>t+zh(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=Lh.dist(n,s.C));const a=o*(1-r)/r,l=Lh.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 Lh}getUtils(){return e.getUtils()}static get PolyBezier(){return Bh}valueOf(){return this.toString()}toString(){return Lh.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=Lh.derive(this.points,this._3d),this.computedirection()}computedirection(){const t=this.points,e=Lh.angle(t[0],t[this.order],t[1]);this.clockwise=e>0}length(){return Lh.length(this.derivative.bind(this))}static getABC(t=2,e,n,i,r=.5){const o=Lh.projectionratio(r,t),s=1-o,a={x:o*e.x+s*i.x,y:o*e.y+s*i.y},l=Lh.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],Lh.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=Lh.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=Lh.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?Lh.computeWithRatios(t,this.points,this.ratios,this._3d):Lh.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 Lh.compute(t,this.dpoints[0],this._3d)}dderivative(t){return Lh.compute(t,this.dpoints[1],this._3d)}align(){let t=this.points;return new e(Lh.align(t,{p1:t[0],p2:t[t.length-1]}))}curvature(t){return Lh.curvature(t,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return Lh.inflections(this.points)}normal(t){return this._3d?this.__normal3(t):this.__normal2(t)}__normal2(t){const e=this.derivative(t),n=Vh(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=Vh(e.x*e.x+e.y*e.y+e.z*e.z),r=Vh(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=Vh(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=Lh.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=Lh.map(0,0,1,this._t1,this._t2),r.left._t2=Lh.map(t,0,1,this._t1,this._t2),r.right._t1=Lh.map(t,0,1,this._t1,this._t2),r.right._t2=Lh.map(1,0,1,this._t1,this._t2),n?(n=Lh.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]=Lh.droots(r),3===this.order&&(r=this.dpoints[1].map(i),t[n]=t[n].concat(Lh.droots(r))),t[n]=t[n].filter((function(t){return t>=0&&t<=1})),e=e.concat(t[n].sort(Lh.numberSort))}.bind(this)),t.values=e.sort(Lh.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]=Lh.getminmax(this,n,t[n])}.bind(this)),e}overlaps(t){const e=this.bbox(),n=t.bbox();return Lh.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=Lh.angle(this.points[0],this.points[3],this.points[1]),e=Lh.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),zh(qh(n))<Gh/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,zh(n-i)<r)return[];e=t.split(n,i),e._t1=Lh.map(n,0,1,t._t1,t._t2),e._t2=Lh.map(i,0,1,t._t1,t._t2),s.push(e),n=i;break}n<1&&(e=t.split(n,1),e._t1=Lh.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=Lh.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]=Lh.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=Vh(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]=Lh.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=Lh.makeline(h[2],d[0]),p=Lh.makeline(d[2],h[0]),m=[f,new e(d),p,new e(h)];return new Bh(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 Lh.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=Lh.makeline(v,p),b=Lh.makeline(m,g),k=[y].concat(a).concat([b]).concat(c);return new Bh(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=Lh.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=Wh(t.p1.x,t.p2.x),n=Wh(t.p1.y,t.p2.y),i=jh(t.p1.x,t.p2.x),r=jh(t.p1.y,t.p2.y);return Lh.roots(this.points,t).filter((t=>{var o=this.get(t);return Lh.between(o.x,e,i)&&Lh.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=Lh.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=Lh.dist(t,e),l=Lh.dist(t,o),c=Lh.dist(t,s);return zh(l-a)+zh(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=Lh.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*Uh(a.e),y:a.y+a.r*$h(a.e)};a.e+=Lh.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 Kh={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 Hh({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 Hh(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 Hh(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 Xh{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{Yh(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 Yh(t,e,n){let i=t[e];t[e]=t[n],t[n]=i}function Qh(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 Jh={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 Xh(n,i);let o=[];for(let n=0;n<e;n++)o.push(Qh(n/(e-1),r,t));return o}};function Zh(t,e=256,n={}){return"bezier"===n.type?Kh.pointsToCurve(t,e,n):Jh.pointsToCurve(t,e)}const tf=[];for(let t=0;t<256;t++)tf[t]=t;class ef extends oh{constructor(t){const e={vertex:xh,fragment:wh},n={uniforms:oh.getUniformInfo(ef)};super(ef.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,Zh(n,256).map((t=>255*t))):tf],this.uniforms[Jd.STATIC_OPTIONS].set(e)}}function nf(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 rf extends oh{constructor(t){const e={vertex:xh,fragment:wh},n={uniforms:oh.getUniformInfo(rf)};super(rf.getFilterType(),e,n,t)}static getFilterType(){return"levels"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=[...nf(t.black,t.white,t.gamma)];this.uniforms[Jd.STATIC_OPTIONS].set(e)}}const of=360,sf=[];for(let t=0;t<of;t++)sf[t]=t;class af extends oh{constructor(t){const e={uniforms:oh.getUniformInfo(af)};super(af.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 Zh(t,of,{type:"bezier"}).map((t=>{return e=t,((Math.round(e.x*of)+180)%of+(1-e.y-.5)*of+of)%of;var e}))}(t.points)||sf;this.uniforms[Jd.STATIC_OPTIONS].set(e)}}class lf extends oh{constructor(t){const e={uniforms:oh.getUniformInfo(lf)};super(lf.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[Jd.STATIC_OPTIONS].set([e,n])}}class cf extends oh{constructor(t){const e={uniforms:oh.getUniformInfo(cf)};super(cf.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[Jd.STATIC_OPTIONS].set([e,n,i,r])}}class uf extends oh{constructor(t){const e={uniforms:oh.getUniformInfo(uf)};super(uf.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[Jd.STATIC_OPTIONS].set([e])}}class df extends oh{constructor(t){const e={uniforms:oh.getUniformInfo(df)};super(df.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[Jd.FIRST_TEXTURE,Xd,Yd]}handleStaticUniforms(t){let e={...df.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[Jd.STATIC_OPTIONS].set([n,i,r,o,s,a,l,c,h,f,d,u])}}class hf extends oh{constructor(t){const e={uniforms:oh.getUniformInfo(hf)};super(hf.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[Jd.STATIC_OPTIONS].set([n,i,r,o])}}class ff extends oh{constructor(t){const e={uniforms:oh.getUniformInfo(ff)};super(ff.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 pf extends oh{constructor(t){const e={uniforms:oh.getUniformInfo(pf)};super(pf.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[Jd.STATIC_OPTIONS].set([e,n])}}class mf extends oh{constructor(t){const e={uniforms:oh.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_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[Jd.STATIC_OPTIONS].set([e])}}var vf,gf,yf,bf,kf,xf,wf,_f;function Tf(){if(bf)return yf;bf=1;const t=gf?vf:(gf=1,vf={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"]}};yf=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]},yf}function If(){if(xf)return kf;xf=1;const t=Tf();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 kf=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 Ef=function(){if(_f)return wf;_f=1;const t=Tf(),e=If(),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)}))})),wf=n}(),Sf=du(Ef);class Af extends oh{constructor(t){const e={uniforms:oh.getUniformInfo(Af)};super(Af.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=Sf.hex.rgb(t.color).map((t=>t/255));this.uniforms[Jd.STATIC_OPTIONS].set([e[0],e[1],e[2]])}}class Nf extends oh{constructor(t){const e={uniforms:oh.getUniformInfo(Nf)};super(Nf.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[Jd.STATIC_OPTIONS].set([e.from,e.to,...e.ease])}static getUniformList(){return[Jd.FIRST_TEXTURE,Qd]}}class Mf extends oh{constructor(t){const e={uniforms:oh.getUniformInfo(Mf)};super(Mf.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[Jd.STATIC_OPTIONS].set([e.from,e.to,...e.ease])}static getUniformList(){return[Jd.FIRST_TEXTURE,Qd]}}class Ff extends oh{constructor(t){const e={uniforms:oh.getUniformInfo(Ff)};super(Ff.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[Jd.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[Jd.FIRST_TEXTURE,Qd]}}class Of extends oh{constructor(t){const e={uniforms:oh.getUniformInfo(Of)};super(Of.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[Jd.STATIC_OPTIONS].set([e.from,e.to,...e.ease,n.x,n.y])}static getUniformList(){return[Jd.FIRST_TEXTURE,Qd,Xd]}}class Cf extends oh{constructor(t){const e={uniforms:oh.getUniformInfo(Cf)};super(Cf.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=Sf.hex.rgb(n).map((t=>t/255));this.uniforms[Jd.STATIC_OPTIONS].set([e.from,e.to,...e.ease,i[0],i[1],i[2]])}static getUniformList(){return[Jd.FIRST_TEXTURE,Qd]}}var Pf=Object.freeze({__proto__:null,Crop:df,Curves:ef,Default:sh,DipToBlackTransition:Mf,DirectionalBlur:vh,Exposure:mf,ExposureTransition:Nf,FadeToColorTransition:Cf,FastBlur:mh,HardLight:Af,HorizontalBlur:fh,Hue:af,Lab:pf,Levels:rf,Lut:kh,MotionBlurTransition:Of,Opacity:gh,Saturation:uf,ShapeComposite:bh,ShapeCompositeMask:yh,Solid:hf,SolidImage:ff,Transform:hh,TransformTransition:Ff,VerticalBlur:ph,Vibrance:cf,WhiteBalance:lf});const Df=Object.values(Pf).reduce(((t,e)=>(t[e.getFilterType()]=e,t)),{});class Rf{constructor(t){this.context=t}static getFilterClass(t){return Df[t]}getFilterIds(){return Object.keys(this.filterTypeToInstanceMap)}create(t,e){this.context={...this.context,options:e.options};const n=new Df[t](this.context);if(!n)throw new Error(`${t} is not a atom filter, atomFilter list: `,this.getFilterIds());return n}}const Lf=Qu.PREVIOUS_OUTPUT_PREFIX,Bf=Object.values(Pf).reduce(((t,e)=>(t[e.getFilterType()]={type:e.getFilterType(),options:e.getInitialOptions(),inputs:[...Array(e.getInputsCount())].map(((t,e)=>`${Lf}${e}`)),outputs:[]},t)),{});var zf,Wf,jf=function(){if(Wf)return zf;Wf=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)}),{})},zf=s}(),Uf=du(jf),$f=function(t,e){return Uf(t,e,{arrayMerge:(t,e)=>e})};const qf=Qu.MESSAGES.UPDATE_OPTIONS;let Vf=class{constructor(t,e){this.eventEmitter=new nd,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(qf,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 Gf extends Vf{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=$f(this.options,t),this.filter.updateStaticUniforms(this.options)}dispose(){this.filter.dispose()}}const Hf=Qu.MESSAGES.UPDATE_OPTIONS;class Kf extends Gf{constructor(t,e,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}baseNodeUpdateOptions(t){this.options=$f(this.options,t),this.filter.updateStaticUniforms(this.options)}registerListeners(){this.baseNode.getEventEmitter().on(Hf,this.baseNodeUpdateOptions,this)}dispose(){this.filter.dispose(),this.baseNode.getEventEmitter().off(Hf,this.baseNodeUpdateOptions,this)}}function Xf(t){return null!==t&&"object"==typeof t}function Yf(t){if(!Xf(t)||(e=t,Array.isArray(e)))return t;var e;const n=Object.keys(t).sort(),i={};return n.forEach((e=>{i[e]=Yf(t[e])})),i}function Qf(t,e){return null!=t&&t.id&&null!=e&&e.id?t.type===e.type&&t.id===e.id:t.type===e.type}function Jf(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)),Xf(i=n)&&Xf(r)?JSON.stringify(Yf(i))===JSON.stringify(Yf(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]&&Qf(a,c[l])?l:c.findIndex((t=>Qf(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 Zf(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=dp.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 tp=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 Zf(Jf(r,o),r,n,i)};class ep extends Vf{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=>dp.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 ld(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=tp(t,this.options,this.nodes,this.context),this.options=t}dispose(){this.nodes.forEach((t=>{t.dispose()}))}}const np=Qu.MESSAGES.UPDATE_OPTIONS;class ip extends ep{constructor(t,e,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}registerListeners(){this.baseNode.getEventEmitter().on(np,this.updateOptions,this)}dispose(){this.nodes.forEach((t=>{t.dispose()})),this.baseNode.getEventEmitter().off(np,this.updateOptions,this)}}const rp=Qu.SYSTEM_NODES.TAGS.ATOM,op=Qu.SYSTEM_NODES.TAGS.FILTER,sp=Qu.SYSTEM_NODES.TAGS.COMPOSITE_FILTER,ap=Qu.SYSTEM_NODES.TAGS.TRANSITION_FILTER,lp=Qu.PREVIOUS_OUTPUT_PREFIX,cp=Object.keys(Bf);function up(t,e){const n=(i=t.type,Bf[i]);var i;return t=$f(n,t),new Gf(t.type,t,e)}var dp={create:function(t,e){let n;switch(function(t){let e;return n=t,e=cp.includes(n)?rp:t===sp?sp:t===ap?ap:op,e;var n}((t=JSON.parse(JSON.stringify(t))).type)){case rp:n=up(t,e);break;case op: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=$f(r,t),e={...e,baseNode:n},o=i===sp?new ip(i,t,e):new Kf(i,t,e),o}(t,e);break;case sp:n=function(t,e){const n=t.type;return t=$f({inputs:[`${lp}0`]},t),new ep(n,t,e)}(t,e);break;case ap: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`,up(t,e)}(t,e);break;default:throw new Error("cant create node",t.type)}return n}};const hp=Qu.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS;var fp=function(t){const e={[hp]:Bf[hp]};for(const[n,i]of Object.entries(e)){const e=dp.create(i,t);t.nodeStore.set(n,e)}},pp=function(t,e){for(const[n,i]of Object.entries(t)){const t=dp.create(i,e);e.nodeStore.set(n,t)}};const mp=Qu.CAPTURED_FRAME_PREFIX;class vp{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=`${mp}${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 gp=Au("ShaderGraphApplication","warn"),yp=Qu.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS,bp=Object.freeze({useCanvasSizedFilterTargets:!1,rebindAttributesOnProgramSwitch:!0,forwardContextAttributes:!0});function kp(t={}){const e=null==t?void 0:t.performanceToggles;return e&&"object"==typeof e?{...bp,...e}:{...bp}}class xp{constructor(t,e={}){return this.glSource=t,this.config=e,this.performanceToggles=kp(e),this.isContextLost=!1,this.isRecovering=!1,this.isDisposed=!1,this.pendingNodeOptionUpdates=new Map,this.doInit(t,e)}doInit(t,e){this.source=sd(t),this.performanceToggles=kp(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=bp){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 vd({gl:this.gl,activeTextures:this.activeTextures}),this.capturedFramesManager=new vp({textureManager:this.textureManager}),this.graphIOManager=new Td({glSource:t,gl:this.gl,textureManager:this.textureManager,capturedFramesManager:this.capturedFramesManager}),this.frameBufferFactory=new Fd({gl:this.gl,textureManager:this.textureManager,useCanvasSizedFilterTargets:this.performanceToggles.useCanvasSizedFilterTargets}),this.filterFactory=new Rf({gl:this.gl,frameBufferFactory:this.frameBufferFactory,rebindAttributesOnProgramSwitch:this.performanceToggles.rebindAttributesOnProgramSwitch}),this.nodeStore=new ld,this.ioStore=new ld,fp({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 gp.debug("[getNodes]"),this.nodeStore.get()}addClientNodes(t,e=!1){if(gp.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));pp(n,{nodeStore:this.nodeStore,filterFactory:this.filterFactory})}addTexture(t,e,n){if(gp.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){gp.debug("[releaseTexture]",t),this.isContextUnavailable()||this.textureManager.releaseTexture(t)}selectNode(t){if(gp.debug("[selectNode]",t),!this.isContextUnavailable())return this.nodeStore.get(t)||gp.warn("Missing render node",t),void(this.selectedRenderNodeId=t);this.selectedRenderNodeId=t}captureTexture(){return gp.debug("[captureTexture]"),this.isContextUnavailable()?null:this.capturedFramesManager.createCaptureId()}disposeTexture(t){return gp.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){gp.error("Failed to apply pending node options",e,t),this.queueNodeOptionUpdate(e,n)}return}this.updateOptions(e,n)}catch(t){gp.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;Ad(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&&(Ad(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):(gp.warn("Missing selected render node",this.selectedRenderNodeId),this.selectedRenderNodeId=null)}renderToCanvas(t){const e=this.nodeStore.get(yp);e&&"function"==typeof e.render?e.render(t):gp.warn("Missing render-to-canvas node")}updateOptions(t,e){if(gp.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){gp.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(){gp.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),gp.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=>{gp.debug("Re-adding client nodes",t),this.addClientNodes(t,!0)})),Object.entries(e).forEach((([t,e])=>{gp.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&&(gp.debug("Recovering glSource (i.e. seeking/resetting player)"),await this.source.recover()),this.isContextLost=!1,this.isRecovering=!1,o&&this.render()}catch(t){gp.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 wp{constructor(t={}){this.options=t}get type(){return"stage"}getSignature(){return this.type}build({inputs:t=[]}={}){return{graph:[],outputs:t,signature:this.getSignature()}}}function _p(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 Tp extends wp{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:_p(a)}),o.push(l)}return{graph:r,outputs:o,signature:this.getSignature()}}}class Ip{#A=new Map;constructor(){this.register("retarget",Tp)}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 Ep{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 Sp extends Ep{#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=Sp.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 Ap=new WeakMap,Np=new WeakMap,Mp=new WeakSet;class Fp extends Ep{constructor(...t){super(...t),U(this,Mp),W(this,Ap,null),W(this,Np,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:Fp.type,signature:`${Fp.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{L(Mp,this,Op).call(this,i,t)}catch(t){}return}try{L(Mp,this,Cp).call(this,i,o,n)}catch(t){}}}}function Op(t,e){if(!e)return;const n=pe.buildLayoutGraph({inputs:["__SRC_TEXTURE:0"]}),i=n.signature;z(Ap,this)!==i&&(t.updateOptions(e,{graph:n.graph}),j(Ap,this,i)),z(Np,this)!==e&&(t.selectNode(e),j(Np,this,e)),t.render({noRaf:!0})}function Cp(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=pe.buildLayoutGraph({inputs:r}),s=o.signature;z(Ap,this)!==s&&(t.updateOptions(e,{graph:o.graph}),j(Ap,this,s)),z(Np,this)!==e&&(t.selectNode(e),j(Np,this,e)),t.render({noRaf:!0})}function Pp(t){const e=Number(t);return Number.isFinite(e)?e<=0?0:e>=1?1:e:0}pe=Fp;class Dp extends Ep{#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=Pp(e),i=[{type:"opacity",inputs:[t[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",t[0]],options:{}}];return{type:Dp.type,signature:`${Dp.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=Pp((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=Dp.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=Dp.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 Rp(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 Lp(t){return!(!t||!0===t.offsetPending)&&Number.isFinite(t.offset)}function Bp(t){return Lp(t)?t.offset:void 0}function zp(t,e,n,i={}){if(!t)return!1;const r=Bp(t);if(!Number.isFinite(r))return!1;const o=Rp(t,n,i);return Number.isFinite(o)?e>=r&&e<r+o:e>=r}function Wp(t=[]){if(!Array.isArray(t))return t;const e=[],n=[];return t.forEach((t=>{Lp(t)?e.push(t):n.push(t)})),e.sort(((t,e)=>t.offset-e.offset)),t.splice(0,t.length,...e,...n),t}function jp(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=Bp(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&&Wp(t),{updated:a,resolvedPlacements:l}}function Up(t){const e=Number(t);return Number.isFinite(e)?e:0}function $p(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 qp(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 Vp(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 Gp(t){const e=Number(t);return Number.isFinite(e)&&e>0?e:0}function Hp(t){return(null==t?void 0:t.id)||(null==t?void 0:t.nodeId)||null}function Kp(t,e){return Array.isArray(t)&&e?t.findIndex((t=>Hp(t)===e)):-1}function Xp(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=Kp(e,n);return t>=0?(t+1)%i:0}if("prev"===t){const t=Kp(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)?Hp(e[i]):null}function Yp(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=Bp(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)=>Bp(t)-Bp(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 Qp(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 Jp(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 Zp(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(Qp(n,r,t))return r}return null}function tm(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 em extends Ep{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=Pp(e),i=[{type:"opacity",inputs:[t[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",t[0]],options:{}}];return{type:em.type,signature:`${em.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:Pp(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&&(tm(a),a.activeRenderPlacementId=l);const c=null==r?void 0:r.initSwitching,u=Yp(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=Jp(a.placements,a.selectedPlacementId),i=Xp(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=Xp(Number.isInteger(t)&&t>=0?t:0,a.nodes,null);let n=null;if(e&&(n=Zp(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&&Qp(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=Zp(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=Gp(a.pendingSwitch.crossfadeSeconds),s=Gp(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=Pp(t/a.switchDuration))}a.switchNormalizedTime=Number.isFinite(p)?p:void 0;const m=Jp(a.placements,a.selectedPlacementId),v=Qp(s,a.selectedPlacementId,m)||s[0];let g=null;if(Number.isFinite(a.switchNormalizedTime)&&a.previousPlacementId){const t=Jp(a.placements,a.previousPlacementId),e=Jp(a.placements,a.selectedPlacementId),n=Qp(s,a.previousPlacementId,t),i=Qp(s,a.selectedPlacementId,e);n&&i&&(g=[n,i])}return g||(g=v?[v]:s),g}static resetRenderState(t){t&&"object"==typeof t&&tm(t)}}const nm=[Sp,Fp,Dp,em],im=new Map;function rm(t){if("string"!=typeof t)return null;const e=t.trim();return e?e.toLowerCase():null}function om(t){const e=rm(t);return e&&im.get(e)||null}function sm(t){return om(t)||Sp}nm.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=rm(e);n&&im.set(n,t)}))}(t)));class am{static get defaultType(){return Sp.type||"default"}static getRenderNodeClass(t){return om(t)}static normalizeType(t){const e=om(t);return e?e.type:null}static doesRenderNodeTypeRequireFrameCadence(t){const e=om(t);return!!e&&!0===e.requiresFrameCadence}static buildLayoutGraph({type:t,inputs:e=[],normalizedTime:n}={}){const i=sm(t);return i&&"function"==typeof i.buildLayoutGraph?i.buildLayoutGraph({inputs:e,normalizedTime:n}):Sp.buildLayoutGraph({inputs:e,normalizedTime:n})}static getPanAndScanTarget(t){const e=sm(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=sm(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=sm(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=sm(t);n&&"function"==typeof n.resetRenderState&&n.resetRenderState(e)}static resetAllRenderStates(t){t&&"function"==typeof t.forEach&&t.forEach(((t,e)=>{am.resetRenderState(e,t)}))}create(t,e){return t&&"function"==typeof t.render?t:new(sm(t))(e)}}function lm(t){return Array.isArray(t)?t.filter((t=>t&&"string"==typeof t.type)):[]}function cm(t,e){return t&&"function"==typeof t.getSignature?t.getSignature():(null==e?void 0:e.type)||"stage"}class um{#O;constructor(t){this.#O=t||new Ip}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=am.normalizeType(null==t?void 0:t.layoutType)||am.defaultType,r=null==t?void 0:t.normalizedTime,o=lm(null==t?void 0:t.preStages),s=lm(null==t?void 0:t.postStages),a=[],l=[`layout:${i}`,`inputs:${e}`];let c=n;o.forEach(((e,n)=>{const i=this.#O.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(cm(i,e))}));const u=am.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.#O.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(cm(i,e))})),{graph:a,signature:l.join("|"),isDynamic:d}}}const dm=[0,0,1,1],hm="zoomInExposure",fm=["transform","exposure","fadeToColor","dipToBlack"],pm={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 mm(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}function vm(t,e=dm){return Array.isArray(t)&&t.length>=4?t:e}function gm(t){return"string"==typeof t&&t.trim()?t.trim():"#ffffff"}function ym(t,e){const n=null==t?void 0:t[e];return!1===n||null==n?null:Mu(n)?n:{}}function bm(t={}){let e=0;return fm.forEach((n=>{const i=ym(t,n);if(!i)return;const r=mm(null==i?void 0:i.duration);r>e&&(e=r)})),e}function km(t,e,n,i,r){const o=[];return fm.forEach((s=>{const a=ym(t,s);if(!a)return;const l=function(t,e,n){const i=mm(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=vm(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=vm(null==e?void 0:e.ease),n=(null==e?void 0:e.power)||{from:0,to:1};return o.options.properties.power={from:mm(null==n?void 0:n.from,0),to:mm(null==n?void 0:n.to,1),ease:t},o.options.properties.color=gm((null==e?void 0:e.color)||r),o}if("exposure"===t||"dipToBlack"===t){const t=vm(null==e?void 0:e.ease),n=(null==e?void 0:e.power)||{from:0,to:1};return o.options.properties.power={from:mm(null==n?void 0:n.from,0),to:mm(null==n?void 0:n.to,1),ease:t},o}return null}(s,a,e,l,r);c&&o.push(c)})),o}function xm(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 wm{#C=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(Mu(null==t?void 0:t.transition))return t.transition;if("string"==typeof(null==t?void 0:t.transition))return pm[t.transition]||pm[hm];if(Mu(null==t?void 0:t.filters)||Mu(null==t?void 0:t.reverseFilters))return{filters:t.filters||{},reverseFilters:t.reverseFilters||{}};if("string"==typeof(null==t?void 0:t.filter)){const e=mm(t.duration)>0?1e3*t.duration:500;return{filters:{[t.filter]:{duration:e,power:{from:0,to:1}}},reverseFilters:{}}}return pm[hm]}(t),n=Fu({},(null==e?void 0:e.filters)||{},Mu(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(Mu(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=Fu({},(null==e?void 0:e.reverseFilters)||{},Mu(null==t?void 0:t.reverseFilters)?t.reverseFilters:{});return{baseFilters:n,reverseFilters:Fu({},i,r)}}(t),r=mm(null==t?void 0:t.duration),o=r>0?1e3*r:null,s=bm(n),a=bm(i),l=o&&s>0?o/s:1,c=o&&a>0?o/a:1,u=o||s||500,d=o||a||u,h=gm(null==t?void 0:t.color),f=e.captureTexture(),p=Date.now(),m=km(n,p,l,o,h);return this.#C={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:xm(m),inGraph:null,inSignature:null},{captureId:f,outDurationMs:u,inDurationMs:d}}beginIncoming(){if(!this.#C)return;const t=Date.now(),e=km(this.#C.reverseFilters,t,this.#C.inScale,this.#C.durationOverrideMs,this.#C.color);this.#C={...this.#C,phase:"in",startTime:t,inGraph:e,inSignature:xm(e)}}reset(t){var e;t&&"function"==typeof t.disposeTexture&&null!==(e=this.#C)&&void 0!==e&&e.captureId&&t.disposeTexture(this.#C.captureId),this.#C=null}getState(){return this.#C}buildOutgoingGraph(){const t=this.#C;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.#C;return t&&"in"===t.phase&&Array.isArray(t.inGraph)&&t.inGraph.length?{signature:`transition:in:${t.inSignature||""}`,forceUpdate:!1,graph:t.inGraph}:null}}let _m;const Tm=[/firefox\/(\d+)/,/edg\/(\d+)/,/opr\/(\d+)/,/chrome\/(\d+)/];function Im(){const t=Bu&&Bu.navigator&&(Bu.navigator.userAgent||Bu.navigator.platform||Bu.navigator.vendor)||"";if(_m&&_m.ua===t)return _m;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<Tm.length;e+=1){const n=Tm[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 _m={ua:t,lowerUA:e,isAndroid:n,isiOS:i,isMobile:r,isDesktop:o,isFirefox:s,browserMajorVersion:a},_m}function Em(){return Im().ua}function Sm(){return Im().isAndroid}function Am(){return Im().isiOS}function Nm(){return Im().isMobile}function Mm(){return Im().isDesktop}function Fm(){return Im().isFirefox}function Om(){return Im().browserMajorVersion}var Cm={getUserAgent:Em,isAndroid:Sm,isiOS:Am,isMobile:Nm,isDesktop:Mm,isFirefox:Fm,getBrowserMajorVersion:Om},Pm=Object.freeze({__proto__:null,default:Cm,getBrowserMajorVersion:Om,getUserAgent:Em,isAndroid:Sm,isDesktop:Mm,isFirefox:Fm,isMobile:Nm,isiOS:Am});const Dm=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 Rm(t,e){const n={};return Number.isFinite(t)&&(n.time=t),"string"==typeof e&&(n.source=e),n}function Lm({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 Bm({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 zm="Idle",Wm="Playing",jm="FirstFramePending",Um="Waiting",$m="Paused",qm="Seeking",Vm="Resetting";function Gm(t){return Array.isArray(t)?t.filter((t=>t&&"string"==typeof t.type)):[]}function Hm(t,e){return!!Array.isArray(t)&&t.some((t=>(null==t?void 0:t.type)===e))}function Km(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 Xm(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 Ym=2073600;function Qm(t,e){const n=Number(t);return Number.isFinite(n)&&n>0?n:e}function Jm(t,e){if(null==t)return e;const n=Number(t);return Number.isFinite(n)?n:e}var 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 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 WeakSet;class Mv extends Du{static get pipelineNodeId(){return"ekoplayer-render-pipeline"}get defaults(){return{defaultRenderParams:void 0,resourceLimits:{enabled:!0,maxCanvasPixels:Ym,maxDevicePixelRatio:0,renderScale:1,transitionMinFrameIntervalMs:33}}}constructor(...t){super(...t),U(this,Nv),W(this,Zm,void 0),W(this,tv,void 0),W(this,ev,void 0),W(this,nv,void 0),W(this,iv,void 0),W(this,rv,void 0),W(this,ov,void 0),W(this,sv,void 0),W(this,av,void 0),W(this,lv,void 0),W(this,cv,null),W(this,uv,null),W(this,dv,void 0),W(this,hv,void 0),W(this,fv,void 0),W(this,pv,[]),W(this,mv,[]),W(this,vv,null),W(this,gv,null),W(this,yv,null),W(this,bv,null),W(this,kv,null),W(this,xv,null),W(this,wv,new Map),W(this,_v,null),W(this,Tv,null),W(this,Iv,!1),W(this,Ev,!1),W(this,Sv,[]),W(this,Av,null);const[e,n,i]=t;j(Zm,this,e),j(tv,this,n),j(ev,this,i),z(Zm,this)&&"function"==typeof z(Zm,this).enableFirstFrameRenderedGate&&z(Zm,this).enableFirstFrameRenderedGate(),j(lv,this,new um),j(dv,this,new wm),j(hv,this,null),j(fv,this,null),j(yv,this,null),j(nv,this,(t=>L(Nv,this,cg).call(this,t))),z(Zm,this)&&"function"==typeof z(Zm,this).on&&(z(Zm,this).on(Dm.VISUAL_FRAMES_AVAILABLE,z(nv,this)),j(iv,this,(()=>{var t,e,n,i;L(Nv,this,Pv).call(this),L(Nv,this,rg).call(this,0),j(mv,this,[]),j(vv,this,null),j(cv,this,null),j(uv,this,null),L(Nv,this,Kv).call(this),j(_v,this,null);(null===(t=z(dv,this))||void 0===t||null===(e=t.getState)||void 0===e?void 0:e.call(t))||null===(n=z(dv,this))||void 0===n||null===(i=n.reset)||void 0===i||i.call(n,z(hv,this))})),z(Zm,this).on(Dm.TIMELINE_SEEKING,z(iv,this)),j(rv,this,(()=>L(Nv,this,Dv).call(this))),z(Zm,this).on(Dm.TIMELINE_RESET,z(rv,this)),j(av,this,(()=>L(Nv,this,Jv).call(this))),z(Zm,this).on(Dm.TIMELINE_TIME_UPDATE,z(av,this)),j(ov,this,(()=>{L(Nv,this,ug).call(this)&&z(gv,this)&&L(Nv,this,cg).call(this,z(gv,this))})),z(Zm,this).on(Dm.TIMELINE_STATE_CHANGE,z(ov,this))),j(sv,this,(()=>{j(vv,this,null),z(gv,this)&&L(Nv,this,ug).call(this)&&L(Nv,this,cg).call(this,z(gv,this))})),z(ev,this)&&"function"==typeof z(ev,this).on&&z(ev,this).on(Dm.CONTAINER_RESIZE,z(sv,this))}get name(){return"Renderer"}onDispose(){z(Zm,this)&&z(nv,this)&&"function"==typeof z(Zm,this).off&&z(Zm,this).off(Dm.VISUAL_FRAMES_AVAILABLE,z(nv,this)),z(Zm,this)&&z(iv,this)&&"function"==typeof z(Zm,this).off&&z(Zm,this).off(Dm.TIMELINE_SEEKING,z(iv,this)),z(Zm,this)&&z(rv,this)&&"function"==typeof z(Zm,this).off&&z(Zm,this).off(Dm.TIMELINE_RESET,z(rv,this)),z(Zm,this)&&z(av,this)&&"function"==typeof z(Zm,this).off&&z(Zm,this).off(Dm.TIMELINE_TIME_UPDATE,z(av,this)),z(Zm,this)&&z(ov,this)&&"function"==typeof z(Zm,this).off&&z(Zm,this).off(Dm.TIMELINE_STATE_CHANGE,z(ov,this)),z(ev,this)&&z(sv,this)&&"function"==typeof z(ev,this).off&&z(ev,this).off(Dm.CONTAINER_RESIZE,z(sv,this)),L(Nv,this,Fv).call(this),j(nv,this,null),j(iv,this,null),j(rv,this,null),j(av,this,null),j(ov,this,null),j(sv,this,null),j(lv,this,null),j(dv,this,null),j(wv,this,null),j(_v,this,null),j(tv,this,null),j(ev,this,null),j(Zm,this,null)}startTransition(t={}){var e;const n=null===(e=z(tv,this))||void 0===e?void 0:e.element;if(!n)return null;if(L(Nv,this,Lv).call(this,n),!z(hv,this))return null;const i=z(dv,this).start({shaderGraph:z(hv,this),duration:null==t?void 0:t.duration,filter:null==t?void 0:t.filter,color:null==t?void 0:t.color,filters:null==t?void 0:t.filters,reverseFilters:null==t?void 0:t.reverseFilters,transition:null==t?void 0:t.transition});return j(yv,this,z(gv,this)||null),L(Nv,this,sg).call(this),i}beginTransitionIn(t={}){var e,n;null!==(e=z(dv,this))&&void 0!==e&&null!==(n=e.beginIncoming)&&void 0!==n&&n.call(e,t),j(yv,this,null),L(Nv,this,sg).call(this)}resetTransition(){var t,e;null!==(t=z(dv,this))&&void 0!==t&&null!==(e=t.reset)&&void 0!==e&&e.call(t,z(hv,this)),j(yv,this,null),L(Nv,this,ag).call(this)}}function Fv(){if(L(Nv,this,Pv).call(this),z(dv,this)&&"function"==typeof z(dv,this).reset&&z(dv,this).reset(z(hv,this)),L(Nv,this,rg).call(this,0),z(hv,this)&&"function"==typeof z(hv,this).dispose)try{z(hv,this).dispose()}catch(t){}j(hv,this,null),j(fv,this,null),j(pv,this,[]),j(mv,this,[]),j(vv,this,null),j(cv,this,null),j(uv,this,null),j(gv,this,null),j(yv,this,null),L(Nv,this,ag).call(this),L(Nv,this,Kv).call(this),j(_v,this,null)}function Ov(){return{schedule:"function"==typeof Bu.requestAnimationFrame?Bu.requestAnimationFrame.bind(Bu):t=>setTimeout(t,16),cancel:"function"==typeof Bu.cancelAnimationFrame?Bu.cancelAnimationFrame.bind(Bu):clearTimeout}}function Cv(t){j(Sv,this,z(Sv,this).filter((e=>e!==t))),z(Sv,this).length||j(Av,this,null)}function Pv(){z(Av,this)&&z(Sv,this).forEach((t=>z(Av,this).call(this,t))),j(Sv,this,[]),j(Av,this,null),j(Ev,this,!1)}function Dv(){L(Nv,this,Pv).call(this),j(Iv,this,!1)}function Rv(){if(z(Iv,this)||z(Ev,this))return;const{schedule:t,cancel:e}=L(Nv,this,Ov).call(this);let n;j(Av,this,e),j(Ev,this,!0),n=t((()=>{let e;L(Nv,this,Cv).call(this,n),e=t((()=>{L(Nv,this,Cv).call(this,e),j(Ev,this,!1),z(Iv,this)||(j(Iv,this,!0),z(Zm,this)&&"function"==typeof z(Zm,this).notifyFirstFrameRendered&&z(Zm,this).notifyFirstFrameRendered())})),z(Sv,this).push(e)})),z(Sv,this).push(n)}function Lv(t){if(z(hv,this)||!t)return;const e=this,n={dest:t,src:(t,n)=>{j(fv,e,n)}};j(hv,e,new xp(n,{userWillCallRender:!0,glOptions:{contextType:"webgl2"},performanceToggles:{useCanvasSizedFilterTargets:!0}})),z(hv,e)&&"function"==typeof z(hv,e).addNodes&&z(hv,e).addNodes({[me.pipelineNodeId]:{type:"composite",options:{graph:[]}}})}function Bv(){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 zv(){const t=L(Nv,this,Bv).call(this).enabled;return!0===t||!1!==t&&Am()}function Wv(){if(!L(Nv,this,zv).call(this))return 0;const t=Jm(L(Nv,this,Bv).call(this).transitionMinFrameIntervalMs,33);return Number.isFinite(t)&&t>0?t:0}function jv(t,e,n={}){const i=!0===(null==n?void 0:n.useDevicePixelRatio),r=L(Nv,this,zv).call(this),o=i?Qm(null==Bu?void 0:Bu.devicePixelRatio,1):1;let s=o,a=0;if(r){const t=L(Nv,this,Bv).call(this);a=Jm(t.maxCanvasPixels,Ym);const e=Jm(t.maxDevicePixelRatio,0);s=Qm(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 Uv(t=[],e={}){var n;const i=null===(n=z(tv,this))||void 0===n?void 0:n.element,r=z(fv,this);if(!i||"function"!=typeof r)return!1;let o=0,s=0;const a=!0===(null==e?void 0:e.useViewportSize);if(a){var l,c,u,d,h,f;const t=Number(null!==(l=null===(c=z(ev,this))||void 0===c?void 0:c.containerWidth)&&void 0!==l?l:null===(u=z(ev,this))||void 0===u?void 0:u.width),e=Number(null!==(d=null===(h=z(ev,this))||void 0===h?void 0:h.containerHeight)&&void 0!==d?d:null===(f=z(ev,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=L(Nv,this,jv).call(this,o,s,{useDevicePixelRatio:a}),v=m.width,g=m.height,y=z(vv,this);return!(y&&y.width===v&&y.height===g||(j(vv,this,{width:v,height:g}),r(null,null,v,g),0))}function $v(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 qv(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=L(Nv,this,Vv).call(this,t),s=L(Nv,this,Gv).call(this,o);return am.getRenderTiming({type:o,timing:{duration:i,normalizedTime:r},timelineTime:e,active:t,renderNodeParams:n,state:s})}function Vv(t){return am.normalizeType(null==t?void 0:t.type)||am.defaultType}function Gv(t){if(!t||!z(wv,this))return null;let e=z(wv,this).get(t);return e||(e={},z(wv,this).set(t,e)),e}function Hv(t){if(!t||!z(wv,this))return;const e=z(wv,this).get(t);e&&am.resetRenderState(t,e),z(wv,this).delete(t)}function Kv(){z(wv,this)&&(am.resetAllRenderStates(z(wv,this)),z(wv,this).clear())}function Xv(t,e,n,i){const r=L(Nv,this,Vv).call(this,t);z(_v,this)&&z(_v,this)!==r&&L(Nv,this,Hv).call(this,z(_v,this)),j(_v,this,r);const o=L(Nv,this,Gv).call(this,r);return am.prepareRenderFrames({type:r,frames:e,timelineTime:n,timeline:z(Zm,this),active:t,renderNodeParams:i,state:o})}function Yv(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 Qv(t){return t?String(t.renderPlacementId||t.type||"unknown"):"default"}function Jv(){if(!z(Zm,this)||!z(gv,this))return;const t=z(Zm,this).currentTime,e=z(Zm,this).getActiveRenderPlacement(t),n=L(Nv,this,Qv).call(this,e);n!==z(Tv,this)&&(j(Tv,this,n),L(Nv,this,cg).call(this,{...z(gv,this),time:t}))}function Zv(t){return!t||"object"!=typeof t||!Object.prototype.hasOwnProperty.call(t,"panAndScan")||!1!==t.panAndScan}function tg(t,e){const n=L(Nv,this,Yv).call(this,t),i=null==n?void 0:n.stages;let r=Gm(null==i?void 0:i.pre),o=Gm(null==i?void 0:i.post);const s=L(Nv,this,Zv).call(this,n),a=L(Nv,this,Vv).call(this,t),l=Hm(r,"retarget")||Hm(o,"retarget");if(s&&!l){const t=am.getPanAndScanTarget(a);if("pre"===t){const t=Km(Array.isArray(e)?e.length:0);t&&(r=[t,...r])}else if("post"===t){const t=Km(1);t&&(o=[...o,t])}}else s||(r=Xm(r),o=Xm(o));return{preStages:r,postStages:o,renderNodeParams:n}}function eg(t,e,n,i,r){const o=r||L(Nv,this,qv).call(this,t,n,i),s=L(Nv,this,tg).call(this,t,e);return z(lv,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 ng(){var t,e;const n=null===(t=z(dv,this))||void 0===t||null===(e=t.getState)||void 0===e?void 0:e.call(t);return"out"===(null==n?void 0:n.phase)?z(dv,this).buildOutgoingGraph():"in"===(null==n?void 0:n.phase)?z(dv,this).buildIncomingGraph():null}function ig(t,e,n,i){const r=n||e!==z(cv,this),o=r||i;return r&&z(hv,this)&&"function"==typeof z(hv,this).updateOptions&&(z(hv,this).updateOptions(me.pipelineNodeId,{graph:t}),j(cv,this,e)),z(hv,this)&&"function"==typeof z(hv,this).selectNode&&z(uv,this)!==me.pipelineNodeId&&(z(hv,this).selectNode(me.pipelineNodeId),j(uv,this,me.pipelineNodeId)),!(!o||!z(hv,this)||"function"!=typeof z(hv,this).render||(z(hv,this).render({noRaf:!0}),0))}function rg(t){if(!Array.isArray(z(pv,this))||!z(pv,this).length)return;const e=Number.isFinite(t)?Math.max(0,t):0;if(!(z(pv,this).length<=e)){for(let t=e;t<z(pv,this).length;t+=1){const e=z(pv,this)[t];if(e&&z(hv,this)&&"function"==typeof z(hv,this).releaseTexture)try{z(hv,this).releaseTexture(e)}catch(t){}}z(pv,this).length=e,z(mv,this).length=e}}function og(t=[]){if(!z(hv,this)||"function"!=typeof z(hv,this).addTexture)return!1;if("function"==typeof z(hv,this).isContextUnavailable&&z(hv,this).isContextUnavailable())return!1;if(!Array.isArray(t)||!t.length)return L(Nv,this,rg).call(this,0),!1;L(Nv,this,rg).call(this,t.length);let e=!1;for(let i=0;i<t.length;i+=1){var n;z(pv,this)[i]||"function"!=typeof z(hv,this).addTexture||(z(pv,this)[i]=z(hv,this).addTexture(null,"frame",i));const r=L(Nv,this,$v).call(this,t[i]),o=null===(n=t[i])||void 0===n?void 0:n.frame;if(z(pv,this)[i]&&o&&(!r||r!==z(mv,this)[i]))try{z(pv,this)[i].fill(o),z(mv,this)[i]=r,e=!0}catch(t){}}return e}function sg(){if(z(bv,this))return;const t="function"==typeof Bu.requestAnimationFrame?t=>Bu.requestAnimationFrame(t):t=>setTimeout(t,16),e="function"==typeof Bu.cancelAnimationFrame?t=>Bu.cancelAnimationFrame(t):clearTimeout;j(kv,this,e);const n=()=>{var e,i;if(null!==(e=z(dv,this))&&void 0!==e&&null!==(i=e.getState)&&void 0!==i&&i.call(e)){if(z(gv,this)){const t=L(Nv,this,Wv).call(this),e=Date.now();(!t||!z(xv,this)||e-z(xv,this)>=t)&&(j(xv,this,e),L(Nv,this,cg).call(this,z(gv,this)))}j(bv,this,t(n))}else j(bv,this,null)};j(bv,this,t(n))}function ag(){z(bv,this)&&z(kv,this)&&z(kv,this).call(this,z(bv,this)),j(bv,this,null),j(kv,this,null),j(xv,this,null)}function lg(t){var e,n;const i=null===(e=z(dv,this))||void 0===e||null===(n=e.getState)||void 0===n?void 0:n.call(e);return"out"===(null==i?void 0:i.phase)&&z(yv,this)?z(yv,this):t}function cg(t={}){var e,n;const i=null===(e=z(tv,this))||void 0===e?void 0:e.element,r=null===(n=z(tv,this))||void 0===n?void 0:n.gl;if(!i||!r)return;if(t&&j(gv,this,t),!L(Nv,this,ug).call(this))return;const o=L(Nv,this,lg).call(this,t),s=Number.isFinite(null==o?void 0:o.time)?o.time:void 0;if(!Number.isFinite(s))return;if(L(Nv,this,Lv).call(this,i),!z(hv,this))return;const a=z(Zm,this)&&"function"==typeof z(Zm,this).getActiveRenderPlacement?z(Zm,this).getActiveRenderPlacement(s):void 0,l=L(Nv,this,Qv).call(this,a);l!==z(Tv,this)&&j(Tv,this,l);const c=Array.isArray(null==o?void 0:o.frames)?o.frames:[],u=L(Nv,this,Yv).call(this,a),d=L(Nv,this,Zv).call(this,u),h=L(Nv,this,Xv).call(this,a,c,s,u),f=L(Nv,this,qv).call(this,a,s,u),p=L(Nv,this,Uv).call(this,h,{useViewportSize:d}),m=L(Nv,this,og).call(this,h),v=L(Nv,this,eg).call(this,a,h,s,u,f),g=L(Nv,this,ng).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;L(Nv,this,ig).call(this,y,b,k,x)&&h.length&&L(Nv,this,Rv).call(this)}function ug(){var t;const e=null===(t=z(Zm,this))||void 0===t?void 0:t.state;return e===zm||e===jm||e===Wm||e===$m}function dg(t){return"number"==typeof t&&Number.isFinite(t)&&t>0}function hg(t){return t&&"resource"===t.entryType&&t.transferSize>0&&t.duration>0&&t.responseEnd>=t.requestStart}function fg(t){return Array.isArray(t)&&0!==t.length?t.reduce(((t,e)=>t+e),0)/t.length:NaN}me=Mv;var pg=new WeakMap,mg=new WeakMap,vg=new WeakMap,gg=new WeakMap,yg=new WeakSet;class bg extends Du{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),U(this,yg),W(this,pg,void 0),W(this,mg,void 0),W(this,vg,void 0),W(this,gg,void 0),j(pg,this,!!(Bu&&Bu.navigator&&Bu.navigator.connection)),j(mg,this,!(!Bu||!Bu.performance||"function"!=typeof Bu.performance.getEntriesByType)),j(vg,this,L(yg,this,xg).call(this)),j(gg,this,L(yg,this,Eg).call(this))}guesstimate(){const t=L(yg,this,Ag).call(this);this.log.debug("[guesstimate] Data:",t);const e=L(yg,this,Sg).call(this,t),n=dg(e)?e:t.defaultKbps;return L(yg,this,wg).call(this,n),this.log.info(`[guesstimate] Result: ${n} kbps`),n}update(t){dg(t)&&L(yg,this,wg).call(this,t)}onDispose(){j(vg,this,void 0),j(gg,this,void 0)}}function kg(){return Math.round(Date.now()/1e3)}function xg(){try{if(!Bu||!Bu.localStorage||"function"!=typeof Bu.localStorage.getItem)return}catch(t){return}const t=this.settings.persistentStorage.key,e=Bu.localStorage.getItem(t);if(e)try{const t=JSON.parse(e),n=this.settings.persistentStorage.ttl,i=L(yg,this,kg).call(this)-t.timestamp;if("number"==typeof n&&n>=0&&i>n)return null;if(!dg(t.value))return;return t.value}catch(t){return}}function wg(t){if(!dg(t))return;try{if(!Bu||!Bu.localStorage||"function"!=typeof Bu.localStorage.setItem)return}catch(t){return}const e=this.settings.persistentStorage.key,n=JSON.stringify({value:t,timestamp:L(yg,this,kg).call(this)});try{Bu.localStorage.setItem(e,n),j(vg,this,t)}catch(t){}}function _g(){return Bu&&Bu.performance&&"function"==typeof Bu.performance.getEntriesByType?fg(Bu.performance.getEntriesByType("resource").filter(hg).map((t=>8*t.transferSize/t.duration))):NaN}function Tg(){if(!Bu||!Bu.navigator||!Bu.navigator.connection)return NaN;const t=Bu.navigator.connection.downlink;return dg(t)?1e3*t:NaN}function Ig(){if(!z(pg,this))return NaN;const t=Bu.navigator.connection,e=t.effectiveType||t.type,n=this.settings.connectionType||{};return e&&Object.prototype.hasOwnProperty.call(n,e)?n[e]:NaN}function Eg(){const t=this.settings.ua||{};return Sm()?t.android:Am()?t.ios:t.desktop}function Sg(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=>dg(t)));if(r.length===i.length)return this.log.debug("[#selectFromPriorities] Selected from priorities:",i,"with values:",r),fg(r)}return NaN}function Ag(){const t=this.settings.testOverrides||{},e=dg(t.resourceTiming)?t.resourceTiming:L(yg,this,_g).call(this),n=dg(t.downlink)?t.downlink:L(yg,this,Tg).call(this),i=dg(t.persistentValue)?t.persistentValue:z(vg,this),r=dg(t.connectionType)?t.connectionType:L(yg,this,Ig).call(this),o=dg(t.ua)?t.ua:z(gg,this);return{defaultKbps:this.settings.defaultKbps,resourceTiming:e,downlink:n,connectionType:r,persistentValue:i,ua:o}}const Ng=new Nu;function Mg(t){return"string"!=typeof t||0===t.length?[]:t.split(".").filter((t=>t.length>0))}function Fg(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 Og(t){return null!==t&&"object"==typeof t}function Cg(t,e,n){const i=Mg(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 Pg(t,e,n){if(!Og(t))return t;const i=Mg(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}Og(r[e])||(r[e]=Fg(i[t+1])?[]:{}),r=r[e]}return t}const Dg={get:(t,e)=>Bu&&Bu.eko?Cg(Bu.eko,t,e):e,set(t,e){if(Bu)return Bu.eko&&"object"==typeof Bu.eko||(Bu.eko={}),Pg(Bu.eko,t,e),Bu.eko}},Rg=Bu&&Bu.performance,Lg=Rg&&"function"==typeof Rg.now?()=>Rg.now():()=>Date.now();function Bg(){return"undefined"==typeof AbortController?null:new AbortController}function zg(){const t=new Error("The operation was aborted");return t.name="AbortError",t.code="ABORT_ERR",t}function Wg(t,e){return!(!e||!e.aborted)||!!t&&("AbortError"===t.name||"ABORT_ERR"===t.code||20===t.code)}const jg=2,Ug=100,$g=2,qg="runtime.downloadSpeedSamples",Vg=Au("download","warn");function Gg(t){return new Promise((e=>{setTimeout(e,t)}))}function Hg(t){return t>=500}function Kg(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 Xg(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=Dg.get(r);t||(t=[],Dg.set(r,t)),t.push(s)}catch(t){}return s}async function Yg(t,e={}){const{method:n="GET",headers:i,body:r,retries:o=jg,retryDelay:s=Ug,backoffFactor:a=$g,samplesTargetPath:l=qg,fetch:c,loglevel:u="warn",cache:d,signal:h,onProgress:f,returnType:p="default"}=e;Vg.setLevel(u);const m=function(t){if(t)return t;if(Bu&&"function"==typeof Bu.fetch)return Bu.fetch.bind(Bu);throw new Error("fetch is not available in this environment")}(c);let v=0,g=s;for(;;){if(h&&h.aborted)throw zg();const e=Lg();try{const s=await m(t,{method:n,headers:i,body:r,cache:d,mode:"cors",signal:h});if(h&&h.aborted)throw zg();if(!s.ok){if(v<o&&Hg(s.status)){v+=1,Vg.warn(`[${t}] Download attempt #${v} failed with status ${s.status}, retrying in ${g}ms...`),await Gg(g),g*=a;continue}Vg.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=Lg();const u=Kg(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 zg();const{done:n,value:i}=await t.read();if(n)break;if(i&&i.length){const t=Lg();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=Lg()}else if(y){const t=await s.arrayBuffer();k=new Uint8Array(t),I=k.length,c=Lg()}else"text"===p?(x=await s.text(),c=Lg()):"json"===p&&(w=await s.json(),c=Lg());if(h&&h.aborted)throw zg();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=Xg(S,M,A,N,l,t);try{Ng.trigger("download:sample",F)}catch(t){}const O={response:s,bytes:S,durationMs:M,kbps:F.kbps,startTime:F.startTime,endTime:F.endTime};if("default"===p)return O;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:O}catch(e){if(Wg(e,h))throw"AbortError"===e.name?e:zg();if(!(v<o)||e.status&&!Hg(e.status))throw Vg.error(`[${t}] Download attempt #${v} failed with error ${e}, no more retries.`),e;v+=1,Vg.warn(`[${t}] Download attempt #${v} failed with error ${e}, retrying in ${g}ms...`),await Gg(g),g*=a}}}const Qg={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"]}},Jg=Object.freeze(Object.entries(Qg).reduce(((t,[e,n])=>(Object.prototype.hasOwnProperty.call(n,"default")&&(t[e]=n.default),t)),{})),Zg=Au("config","warn");function ty(t){return Jg[t]}var ey=new WeakMap,ny=new WeakMap,iy=new WeakMap,ry=new WeakMap,oy=new WeakMap,sy=new WeakSet;class ay extends Du{get name(){return"DownloadSpeed"}get defaults(){return{alpha:.3,maxSamples:30,minBytesPerSample:1024,minDurationMs:5,maxSampleKbpsCap:void 0,ignoreCacheHits:!0,samplesPath:"runtime.downloadSpeedSamples",initialKbps:ty("initialKbps"),probeUrl:void 0,defaultKbps:2500}}constructor(...t){super(...t),U(this,sy),W(this,ey,void 0),W(this,ny,void 0),W(this,iy,void 0),W(this,ry,void 0),W(this,oy,void 0),j(iy,this,[]),j(ny,this,0),j(ey,this,L(sy,this,uy).call(this)),j(oy,this,Bg()),j(ry,this,(t=>{L(sy,this,vy).call(this,t,"event")})),L(sy,this,dy).call(this),Ng.on("download:sample",z(ry,this)),L(sy,this,hy).call(this),this.log.debug(`[#constructor] Initial estimate: ${z(ey,this)} kbps`)}getKbps(){return z(ey,this)}addSample(t){L(sy,this,vy).call(this,t,"manual")}reset(){j(iy,this,[]),j(ny,this,0),j(ey,this,L(sy,this,uy).call(this))}onDispose(){z(oy,this)&&z(oy,this).abort(),j(oy,this,null),Ng.off("download:sample",z(ry,this)),j(iy,this,[]),j(ny,this,0),j(ey,this,void 0),j(ry,this,null)}}function ly(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 cy(t){if(!t||"object"!=typeof t)return null;const e=Number(t.bytes),n=Number(t.durationMs);let i=dg(t.kbps)?Number(t.kbps):NaN;return!dg(i)&&n>0&&dg(e)&&(i=8*e/n),dg(i)?e<=this.settings.minBytesPerSample||n<=this.settings.minDurationMs||L(sy,this,ly).call(this,t,e)?null:(dg(this.settings.maxSampleKbpsCap)&&i>this.settings.maxSampleKbpsCap&&(i=this.settings.maxSampleKbpsCap),{...t,bytes:e,durationMs:n,kbps:i}):null}function uy(){const t=this.settings.initialKbps;if(dg(t))return t;if("auto"===t)try{const t=(new bg).guesstimate();if(dg(t))return t}catch(t){}return this.settings.defaultKbps}function dy(){const t=Dg.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)L(sy,this,vy).call(this,e[t],"replay",{emit:!1})}async function hy(){if(!this.settings.probeUrl||z(ny,this)>0)return;const t=z(oy,this)?z(oy,this).signal:void 0;if(!t||!t.aborted)try{await Yg(this.settings.probeUrl,{cache:"no-store",samplesTargetPath:this.settings.samplesPath,signal:t})}catch(t){}}function fy(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 py(t,e){if(!L(sy,this,fy).call(this,t)||!L(sy,this,fy).call(this,e))return 0;const n=Math.max(t.startTime,e.startTime);return Math.min(t.endTime,e.endTime)-n}function my(t){if(!L(sy,this,fy).call(this,t))return t;const e=[];for(let n=0;n<z(iy,this).length;n+=1){const i=z(iy,this)[n];L(sy,this,fy).call(this,i)&&(L(sy,this,py).call(this,t,i)>0&&e.push(i))}if(0===e.length)return t;j(iy,this,z(iy,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(!dg(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 L(sy,this,cy).call(this,a)}function vy(t,e,{emit:n=!0}={}){const i=L(sy,this,cy).call(this,t);if(!i)return;const r=L(sy,this,my).call(this,i);if(!r)return;j(ny,this,z(ny,this)+1),z(iy,this).push(r),z(iy,this).length>this.settings.maxSamples&&z(iy,this).shift();const o=this.defaults.alpha,s="number"==typeof this.settings.alpha?this.settings.alpha:o,a=dg(z(ey,this)),l=a?z(ey,this):r.kbps,c=a||1!==z(ny,this)?s*r.kbps+(1-s)*l:r.kbps;j(ey,this,c),this.log.debug(`[#ingestSample] Next estimate: ${c} kbps`),n&&this.trigger("download:speed",{kbps:z(ey,this),sample:r,source:e,samplesCount:z(ny,this)})}class gy{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),dg(s)&&(this.bandwidth=s),dg(a)&&(this.timescale=a),dg(l)&&(this.sizeBytes=l),Object.assign(this,c)}}class yy{#P=new Map;#D;#R;#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 gy?t:new gy(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.#D=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.#R=void 0);const e={...t};Array.isArray(t.availableRepresentations)&&(e.availableRepresentations=t.availableRepresentations.map((t=>({...t})))),this.#R=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.#D}get abrDecision(){return this.#R}get arrayBuffer(){return this.#D?this.#P.get(this.#D.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=dg(this.#B)?this.#B:null===(t=this.#D)||void 0===t?void 0:t.sizeBytes;return dg(e)?Math.min(1,Math.max(0,this.#L/e)):this.retainedByteLength>0?1:0}get isLoaded(){return this.retainedByteLength>0}evict(){this.#D=void 0,this.#R=void 0,this.#P.clear(),this.#L=0,this.#B=void 0}}class by{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 ky(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 xy(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=ky(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 wy=new Set(["video","audio","image","cue","data","bbox"]);class _y{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(!wy.has(n))throw new Error(`Track type must be one of ${Array.from(wy).join("|")}`);this.id=e,this.type=n,this.offset=i,this.duration=dg(r)?r:void 0,this.source=o,"cue"===n?(this._cues=a.map((t=>t instanceof by?t:new by(t))),this._segments=[]):(this._segments=s.map((t=>t instanceof yy?t:new yy(t))),this._cues=void 0)}get segments(){return this._segments.slice()}get cues(){if("cue"===this.type)return this._cues.slice()}get endTime(){if(dg(this.duration))return this.offset+this.duration;if(!this._segments.length)return;const t=this._segments.reduce(((t,e)=>{const n=dg(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:dg(null==t?void 0:t.duration)?t.duration:0,offset:dg(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 xy(this._segments,t,e)}setSegments(t=[]){if("cue"===this.type)return;const e=Array.isArray(t)?t:[];this._segments=e.map((t=>t instanceof yy?t:new yy(t)))}}function Ty(t){return"string"==typeof t?t:t&&"object"==typeof t?t.nodeId||t.nodeIdOrRef||t.id:void 0}function Iy(t){const e=Ty(t);let n=1;if(t&&"object"==typeof t&&dg(t.weight)&&(n=t.weight),!e)throw new Error("Child entry requires a nodeId");return{nodeId:e,weight:n}}function Ey(t){return(Array.isArray(t)?t:[]).map((t=>Iy(t)))}function Sy(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 Ay(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 Ny(t,e){if(e)try{var n;return new URL(e,t||(null==Bu||null===(n=Bu.location)||void 0===n?void 0:n.href)||void 0).toString()}catch(t){return e}}const My=new Map;class Fy{static register(t,e){if(!t||"function"!=typeof e)throw new Error("ManifestFactory.register requires type and parser function");My.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=Fy.inferType(t);if(!e||!My.has(e))throw new Error("Unsupported manifest type");return My.get(e)(t)}}Fy.register("dash",(function(t={}){const{body:e,url:n}=t,i=function(){if(Bu&&"function"==typeof Bu.DOMParser)return new Bu.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=Sy(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=Sy(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:Sy(a&&a.getAttribute("timescale"))||Sy(e&&e.getAttribute("timescale"),1)||1,startNumber:Sy(a&&a.getAttribute("startNumber"))||Sy(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=Sy(n.getAttribute("t")),s=Sy(n.getAttribute("d")),a=Sy(n.getAttribute("r"),0);if(!dg(s))continue;dg(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:Ny(n,Ay(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:Ny(n,Ay(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}})),Fy.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:dg(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=>dg(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+(dg(e.duration)?e.duration:0)),0),l=dg(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}})),Fy.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=dg(null==t?void 0:t.duration)?t.duration:30,i=dg(null==t?void 0:t.width)?t.width:void 0,r=dg(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};dg(i)&&dg(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 Oy=["video/mp4"];function Cy(t){return Oy.includes(t.mime)}var Py={name:"containers",fn:function(t=[]){return t.filter(Cy)},isRelevantForTrack:function(t){return"video"===(null==t?void 0:t.type)}};const Dy=new(ve=new WeakMap,ge=new WeakSet,class extends Du{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),U(this,ge),W(this,ve,void 0),j(ve,this,new Map)}onDispose(){z(ve,this)&&z(ve,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 L(ge,this,Wy).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 Ry(){return!!(Bu&&Bu.navigator&&Bu.navigator.mediaCapabilities&&"function"==typeof Bu.navigator.mediaCapabilities.decodingInfo)}function Ly(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 By(t){return t?JSON.stringify(t):"invalid"}async function zy(t){if(!this.settings.enabled||!L(ge,this,Ry).call(this)||!t)return this.log.debug("[#queryCapabilities] Not supported, returning false",t),{supported:!1,smooth:!1,powerEfficient:!1};const e=L(ge,this,By).call(this,t),n=z(ve,this).get(e);if(n)return n;let i;try{i=await Bu.navigator.mediaCapabilities.decodingInfo(t)}catch(t){i={supported:!1,smooth:!1,powerEfficient:!1}}return this.log.debug("[#queryCapabilities] Config:",t,"\nDecoding info result:",i),z(ve,this).set(e,i),i}async function Wy(t){if(L(ge,this,Uy).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=L(ge,this,Ly).call(this,t),n=await L(ge,this,zy).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 jy(){if(!Fm())return!1;const t=Om();return!Number.isFinite(t)||t<150}function Uy(t){if(!L(ge,this,jy).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 $y=[],qy=()=>!0;[Py,{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 Dy.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:qy;$y.push({name:t,fn:e,isRelevantForTrack:i})}(t,e,{isRelevantForTrack:n})}));const Vy=Au("Node","warn"),Gy={start:0,end:0},Hy=.001;function Ky(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)<=Hy&&Math.abs(t.duration-n.duration)<=Hy))?{offset:n.start,duration:n.duration}:void 0}var Xy=new WeakMap,Yy=new WeakMap,Qy=new WeakMap,Jy=new WeakMap,Zy=new WeakMap,tb=new WeakMap,eb=new WeakMap,nb=new WeakMap,ib=new WeakMap,rb=new WeakMap,ob=new WeakSet;class sb extends Nu{constructor(t={},e={}){super(),U(this,ob),W(this,Xy,void 0),W(this,Yy,void 0),W(this,Qy,void 0),W(this,Jy,void 0),W(this,Zy,void 0),W(this,tb,void 0),W(this,eb,void 0),W(this,nb,void 0),W(this,ib,void 0),W(this,rb,[]);const{id:n,manifestRef:i,duration:r,width:o,height:s,metadata:a={},children:l=[]}=t;if(!n)throw new Error("Node requires id");if(!i)throw new Error("Node requires manifestRef");this.id=n,this.manifestRef=i,this.metadata=a,this.state="pending",this.error=void 0,this.tracks=[],this.mainTrackId=void 0,this.imageFallbackActive=!1,this.disabledTracks=[],this.disabledTrackTypes=Array.isArray(e.disabledTracks)?e.disabledTracks.filter((t=>"string"==typeof t)):[],this.enabledRepFilters=Array.isArray(e.enabledRepFilters)?e.enabledRepFilters:void 0,this.forceVideoCodec="string"==typeof e.forceVideoCodec&&e.forceVideoCodec.trim()?e.forceVideoCodec.trim():void 0,j(eb,this,!0===e.forceImageFallback),j(Xy,this,e.abrSelector),j(Yy,this,e.assetsDeliveryService),j(Jy,this,dg(r)?r:void 0),j(Zy,this,dg(o)?o:void 0),j(tb,this,dg(s)?s:void 0),j(nb,this,e&&"object"==typeof e.mediaHostRewriteMap?e.mediaHostRewriteMap:void 0),j(ib,this,dg(e.maxManifestLoadAttempts)?e.maxManifestLoadAttempts:1/0),this.manifestLoadAttempts=0,this.manifestLoadError=void 0,j(rb,this,Ey(l))}setChildren(t){const e=Ey(t);return L(ob,this,Tb).call(this,e,{emit:!0})}addChild(t){const e=Iy(t),n=z(rb,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 L(ob,this,Tb).call(this,n,{emit:!0})}removeChild(t){const e=Ty(t);if(!e)return this.children;const n=z(rb,this).filter((t=>(null==t?void 0:t.nodeId)!==e));return n.length===z(rb,this).length?this.children:L(ob,this,Tb).call(this,n,{emit:!0})}async load(t={}){const{loadingMode:e="full",signal:n}=t;Vy.info(`[load] [${this.id}] Loading node in '${e}' mode`);try{if(n&&n.aborted)throw zg();"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})=>L(ob,this,kb).call(this,t,e,n))),l=s?L(ob,this,xb).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 L(ob,this,xb).call(this,t.segment,t.track,n);if(n&&n.aborted)throw zg();return this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:e}),this}catch(t){if(Wg(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(Vy.info(`[loadMediaSegmentsAtOffset] [${this.id}] Loading media segments at offset ${n}`),!Number.isFinite(n))return;const{signal:i}=e;if(i&&i.aborted)throw zg();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(L(ob,this,kb).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)<=Hy&&!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})=>L(ob,this,xb).call(this,t,e,i)))),i&&i.aborted)throw zg();this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:"segment-offset",offsetSeconds:n})}}async resolve(t={}){const{signal:e,manifestOverride:n}=t;let i=!0;for(;i;){if(i=!1,"ready"===this.state)return this;if("resolving"===this.state)try{return await z(Qy,this)}catch(t){if(!Wg(t)||e&&e.aborted)throw t;i=!0;continue}if(e&&e.aborted)throw zg();if(this.hasExceededManifestLoadAttempts()){const t=this.manifestLoadError||new Error("Manifest load retry limit reached");throw this.state="failed",this.error=t,t}const t=L(ob,this,fb).call(this);return this.state="resolving",this.error=void 0,j(Qy,this,(async()=>{try{const t=await L(ob,this,wb).call(this,{signal:e,manifestOverride:n});if(e&&e.aborted)throw zg();let i=Fy.parse(t);return i=L(ob,this,hb).call(this,i),this.tracks=(i.tracks||[]).map((t=>t instanceof _y?t:new _y(t))),this.mainTrackId=i.mainTrackId||this.mainTrackId,this.metadata=i.metadata||this.metadata,L(ob,this,Eb).call(this),L(ob,this,Ib).call(this),await L(ob,this,_b).call(this),this.state="ready",this}catch(n){if(Wg(n,e))throw L(ob,this,pb).call(this,t),n;throw this.state="failed",this.error=n,n}})()),z(Qy,this)}return z(Qy,this)}evict(){this.tracks.forEach((t=>{(t.segments||[]).forEach((t=>{t.evict()}))}))}get children(){return z(rb,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?dg(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+=dg(e.retainedByteLength)?e.retainedByteLength:0}))})),t}get buffered(){if("ready"!==this.state)return Gy;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||!dg(e))return Gy;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 Gy;if(n.length===this.tracks.length&&n.every((({track:t,range:e})=>{const n=t.endTime,i=dg(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 Gy;const r=Math.min(i,e);return r>0?{start:0,end:r}:Gy}get isLoaded(){return"ready"===this.state&&(Array.isArray(this.tracks)?this.tracks:[]).flatMap((t=>Array.isArray(null==t?void 0:t.segments)?t.segments:[])).every((t=>t.isLoaded))}hasExceededManifestLoadAttempts(){if(!Number.isFinite(z(ib,this))||z(ib,this)<=0)return!1;if(!this.manifestLoadError)return!1;const t=Number(this.manifestLoadAttempts);return Number.isFinite(t)&&t>=z(ib,this)}}function ab(t){return function(t,e){if(!t||"string"!=typeof t)return t;if(!e||"object"!=typeof e)return t;const n=Bu&&"function"==typeof Bu.URL?Bu.URL:"function"==typeof URL?URL:null;if(!n)return t;let i;try{i=new n(t)}catch(e){return t}const r=function(t,e){const n=null==t?void 0:t.hostname,i=null==t?void 0:t.pathname;if("string"!=typeof n||"string"!=typeof i)return t;if(!/^s3(?:[.-][a-z0-9-]+)?\.amazonaws\.com$/i.test(n))return t;const r=i.split("/").filter(Boolean);if(r.length<2)return t;const o=r[0],s=new e(t.toString());return s.hostname=`${o}.${n}`,s.pathname=`/${r.slice(1).join("/")}`,s}(i,n),o=e[r.hostname]?r:i,s=e[o.hostname];if(!s||"string"!=typeof s)return t;let a;try{a=new n(s)}catch(e){return t}return a.protocol&&a.host?(o.protocol=a.protocol,o.host=a.host,o.toString()):t}(t,z(nb,this))}function lb(){return z(eb,this)||void 0===Bu.VideoDecoder}function cb(){return this.manifestRef&&"object"==typeof this.manifestRef&&"assets-delivery-service"===this.manifestRef.type}function ub(t){if(!L(ob,this,cb).call(this))return!1;if(!L(ob,this,lb).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 db(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 dg(n)?n:dg(z(Jy,this))?z(Jy,this):void 0}function hb(t){if(this.imageFallbackActive=!1,!L(ob,this,ub).call(this,t))return t;if(!z(Yy,this)||"function"!=typeof z(Yy,this).resolveImageOne)return t;const e=z(Yy,this).resolveImageOne(this.manifestRef),n=L(ob,this,ab).call(this,null==e?void 0:e.url);if(!n)return t;const i={typeHint:"image",url:n,duration:L(ob,this,db).call(this,t),width:z(Zy,this),height:z(tb,this)},r=Fy.parse(i);return t&&"object"==typeof t.metadata&&!Array.isArray(t.metadata)&&(r.metadata=t.metadata),this.imageFallbackActive=!0,r}function fb(){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 pb(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 mb(){const t=Number(this.manifestLoadAttempts);this.manifestLoadAttempts=Number.isFinite(t)&&t>0?t+1:1,this.manifestLoadError=void 0}function vb(t){this.manifestLoadError=t||new Error("Manifest load failed")}function gb(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 yb(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 bb(t,e){t&&("function"!=typeof t.setLoadError?t.loadError=e||new Error("Segment load failed"):t.setLoadError(e))}async function kb(t,e,n){const i=L(ob,this,gb).call(this,e);try{const i=e.representations.map((async i=>{const r=L(ob,this,ab).call(this,i.url),o=await Yg(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(Wg(t,n))throw L(ob,this,yb).call(this,e,i),t;throw L(ob,this,bb).call(this,e,t),t}}async function xb(t,e,n){const i=z(Xy,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=L(ob,this,gb).call(this,t);try{const i=L(ob,this,ab).call(this,s.url),r=await Yg(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(Wg(e,n))throw L(ob,this,yb).call(this,t,a),e;throw L(ob,this,bb).call(this,t,e),e}}async function wb(t={}){const{signal:e,manifestOverride:n}=t;if(e&&e.aborted)throw zg();L(ob,this,mb).call(this);try{let t=this.manifestRef;if(n&&"object"==typeof n){if(L(ob,this,cb).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=L(ob,this,ab).call(this,n.url);return{typeHint:n.typeHint,url:t,mimeType:n.mimeType,body:n.body,duration:z(Jy,this),width:z(Zy,this),height:z(tb,this)}}"string"==typeof n.url&&n.url&&(t=n)}if(t&&"object"==typeof t&&"assets-delivery-service"===t.type){if(!z(Yy,this)||"function"!=typeof z(Yy,this).resolveOne)throw new Error("AssetsDeliveryService is required for assets-delivery-service manifestRef");const n=await z(Yy,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=L(ob,this,ab).call(this,n.url),o=n.mimeType,s=n.body;if(r||s||o)return{typeHint:i,url:r,mimeType:o,body:s,duration:z(Jy,this),width:z(Zy,this),height:z(tb,this)};throw new Error("AssetsDeliveryService returned unsupported manifest shape")}if(t&&"object"==typeof t){const e=L(ob,this,ab).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=L(ob,this,ab).call(this,n),r="object"==typeof t?t.typeHint:void 0,o="object"==typeof t?t.mimeType:void 0;if("image"===Fy.inferType({typeHint:r,url:i,mimeType:o})){const e="object"==typeof t&&dg(t.duration)?t.duration:z(Jy,this);return{typeHint:"image",url:i,mimeType:o,duration:e,width:"object"==typeof t&&dg(t.width)?t.width:z(Zy,this),height:"object"==typeof t&&dg(t.height)?t.height:z(tb,this)}}const s=await Yg(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(Wg(t,e))throw t;throw L(ob,this,vb).call(this,t),t}}async function _b(){const t=$y.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=Ky(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 Tb(t,{emit:e=!1}={}){return function(t=[],e=[]){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n+=1){const i=t[n],r=e[n];if((null==i?void 0:i.nodeId)!==(null==r?void 0:r.nodeId)||(null==i?void 0:i.weight)!==(null==r?void 0:r.weight))return!1}return!0}(z(rb,this),t)||(j(rb,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 Ib(){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 Eb(){if(!Array.isArray(this.tracks)||!this.tracks.length)return;const t=this.duration;if(!dg(t))return;const e=[new by({name:"nodestart",timestamp:0,data:{id:this.id},isSticky:!0}),new by({name:"nodeend",timestamp:t,data:{id:this.id}})],n=new _y({id:`${this.id}-auto-cue`,type:"cue",cues:e,offset:0,duration:t});this.tracks.push(n)}var Sb=new WeakMap,Ab=new WeakMap,Nb=new WeakMap,Mb=new WeakMap,Fb=new WeakSet;class Ob extends Du{constructor(...t){super(...t),U(this,Fb),W(this,Sb,new Map),W(this,Ab,new Map),W(this,Nb,void 0),W(this,Mb,void 0);const[e,n]=t;j(Nb,this,e),j(Mb,this,n)}get name(){return"NodeRepository"}get defaults(){return{enabledRepFilters:["containers","force-video-codec","media-capabilities"],disabledTracks:ty("disabledTracks"),forceVideoCodec:ty("forceVideoCodec"),forceImageFallback:ty("forceImageFallback"),mediaHostRewriteMap:ty("mediaHostRewriteMap"),maxManifestLoadAttempts:3}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"get","list"])}onDispose(){z(Sb,this).forEach(((t,e)=>{const n=z(Ab,this).get(e);n&&t&&"function"==typeof t.off&&t.off(Dm.NODE_CHILDREN_CHANGED,n)})),z(Ab,this).clear(),z(Sb,this).clear()}add(t){const e=t instanceof sb?t:new sb(t,{enabledRepFilters:this.settings.enabledRepFilters,disabledTracks:this.settings.disabledTracks,forceVideoCodec:this.settings.forceVideoCodec,forceImageFallback:this.settings.forceImageFallback,mediaHostRewriteMap:this.settings.mediaHostRewriteMap,maxManifestLoadAttempts:this.settings.maxManifestLoadAttempts,abrSelector:z(Nb,this),assetsDeliveryService:z(Mb,this)});if(!e.id)throw new Error("NodeRepository.add requires node with id");if(z(Sb,this).has(e.id))throw new Error(`NodeRepository.add: node with id ${e.id} already exists`);return z(Sb,this).set(e.id,e),L(Fb,this,Cb).call(this,e),this.trigger(Dm.NODE_ADD,{node:e}),e}get(t){const e=(null==t?void 0:t.id)||t;if(!e)throw new Error("NodeRepository.get requires node or id");return z(Sb,this).get(e)}list(){return Array.from(z(Sb,this).values())}}function Cb(t){if(!t||"function"!=typeof t.on||!t.id)return;const e=t=>{this.trigger(Dm.NODE_CHILDREN_CHANGED,t)};t.on(Dm.NODE_CHILDREN_CHANGED,e),z(Ab,this).set(t.id,e)}var Pb=new WeakMap,Db=new WeakMap,Rb=new WeakSet;class Lb extends Du{constructor(...t){super(...t),U(this,Rb),W(this,Pb,void 0),W(this,Db,new Map);const[e]=t;j(Pb,this,e)}get name(){return"ABRSelector"}get defaults(){return{safetyMargin:.35,minBufferForUpgrade:5,minBufferCritical:1,hysteresisRatio:1.1,abrStrategy:ty("abrStrategy")}}select(t={}){var e;const{representations:n=[],bufferSeconds:i}=t;if(!Array.isArray(n)||0===n.length)return;const r=z(Pb,this)&&"function"==typeof z(Pb,this).getKbps?z(Pb,this).getKbps():void 0,o=L(Rb,this,Bb).call(this,n[0]),s=z(Db,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)=>L(Rb,this,zb).call(this,t.bandwidth)-L(Rb,this,zb).call(this,e.bandwidth)));if("bottom"===a){const e=l[0];return L(Rb,this,Ub).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 L(Rb,this,Ub).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 L(Rb,this,Ub).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=dg(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),L(Rb,this,Ub).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=>L(Rb,this,zb).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&&dg(e.bandwidth)&&dg(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 L(Rb,this,Ub).call(this,h,t,{decisionReason:d,trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:u,bufferSeconds:c}),null===(e=h)||void 0===e?void 0:e.id}onDispose(){z(Db,this).clear(),j(Pb,this,null)}}function Bb(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 zb(t){return dg(t)?t/1e3:0}function Wb(t){return dg(t)?t/1e3:void 0}function jb(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:L(Rb,this,Wb).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:L(Rb,this,Wb).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 Ub(t,e,n={}){if(!t)return;const i=L(Rb,this,jb).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=L(Rb,this,Bb).call(this,t);z(Db,this).set(r,t.id)}var $b=new WeakMap,qb=new WeakSet;class Vb extends Du{constructor(...t){super(...t),U(this,qb),W(this,$b,void 0);const[e]=t;if(j($b,this,e),!z($b,this)||"function"!=typeof z($b,this).list)throw new Error("NodePrioritizer requires a NodeRepository instance")}get name(){return"NodePrioritizer"}get defaults(){return{levelMultiplier:1,priorityMultiplier:.3}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"sortNodes"])}onDispose(){j($b,this,null)}getPrioritizationSnapshot(t){const e=z($b,this).list();if(!e.length)return{orderedIds:[],reachableIds:[]};const{levels:n,weights:i}=L(qb,this,Gb).call(this,e,t);return{orderedIds:L(qb,this,Hb).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 Gb(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=dg(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 Hb(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 Kb(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 Xb(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 Yb(t){return"string"==typeof t&&t.startsWith("cmaf:")}function Qb(t){return"image"===(null==t?void 0:t.assetType)?"image":"ivd"}function Jb(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 Zb=new WeakMap,tk=new WeakMap,ek=new WeakSet;class nk extends Du{constructor(...t){super(...t),U(this,ek),W(this,Zb,void 0),W(this,tk,void 0);const[,e={}]=t;j(Zb,this,"function"==typeof e.fetchFn?e.fetchFn:void 0),j(tk,this,Bg())}get name(){return"AssetsDeliveryService"}get defaults(){return{assetsDeliveryServiceUrl:"https://assets.eko.com",profile:ty("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(!L(ek,this,rk).call(this,t))return;const e=Kb(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=>L(ek,this,rk).call(this,t)));if(!n.length)return[];const i=L(ek,this,ik).call(this,e);if(i&&i.aborted)return[];const r=[],o=this.settings.profile;n.forEach((t=>{if("image"!==Qb(t))return;const e=this.resolveImageOne(t);e&&e.url&&r.push({manifestRef:Xb(t,e.encodeProfile),manifest:{typeHint:"image",url:e.url}})}));const s=n.filter((t=>"image"!==Qb(t))).map((t=>function(t,e){const n=Kb(t,e);return{ref:t,profile:n,route:Yb(n)?"dash":"ivd"}}(t,o))),a=L(ek,this,sk).call(this,s);for(const{refs:t,route:e}of a){if(i&&i.aborted)return r;const{url:n}=L(ek,this,ak).call(this,t,e),o=await L(ek,this,lk).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:Xb(t,e),manifest:Jb(i)})}))}return r}onDispose(){z(tk,this)&&z(tk,this).abort(),j(tk,this,null),j(Zb,this,null)}}function ik(t){return t&&t.signal?t.signal:z(tk,this)?z(tk,this).signal:void 0}function rk(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 ok(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 sk(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=>{L(ek,this,ok).call(this,t.refs,this.settings.maxBatchSize).forEach((e=>{n.push({route:t.route,refs:e})}))})),n}function ak(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 lk(t,e){return z(Zb,this)?z(Zb,this).call(this,t,e):await Yg(t,{returnType:"json",method:(null==e?void 0:e.method)||"GET",signal:null==e?void 0:e.signal})}function ck({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 uk=(Bu.requestAnimationFrame||Bu.mozRequestAnimationFrame||Bu.webkitRequestAnimationFrame||Bu.msRequestAnimationFrame||(t=>Bu.setTimeout(t,1e3/60))).bind(Bu),dk=(Bu.cancelAnimationFrame||Bu.mozCancelAnimationFrame||Bu.webkitCancelAnimationFrame||Bu.msCancelAnimationFrame||(t=>Bu.clearTimeout(t))).bind(Bu),hk=Au("ticker","warn");let fk,pk=[],mk=null,vk=Lg();function gk(){vk=Lg();const t=[];let e,n;for(n=pk.length-1;n>=0;--n)e=pk[n],vk>=e.lastTick+e.interval&&t.push(e);for(n=t.length-1;n>=0;--n)if(e=t[n],!e.stopped){e.lastTick=vk;try{e.callback()}catch(t){console&&"function"==typeof console.error?console.error(t):hk.error(t)}}fk=uk(gk)}function yk(){Lg()-vk>=200&&(dk(fk),gk())}function bk(t){let e=-1;for(let n=0;n<pk.length;n+=1)if(pk[n].callback===t){e=n;break}return e}function kk(t,e=0){if(!t||"function"!=typeof t||"number"!=typeof e||e<0)return void hk.error("[start] Invalid arguments given to start method.",arguments);const n=bk(t);return-1!==n?(hk.debug("[start] Callback already exists, overriding interval.",arguments),pk[n].interval=e,t):(pk.push({callback:t,interval:e,lastTick:Lg()}),1===pk.length&&(fk=uk(gk),mk||(mk=Bu.setInterval(yk,1e3))),t)}function xk(t){const e=bk(t);-1!==e?(pk[e].stopped=!0,pk.splice(e,1),pk.length||(dk(fk),Bu.clearInterval(mk),mk=null)):hk.debug("[stop] Callback not found, doing nothing.",arguments)}function wk(t){return-1!==bk(t)}function _k(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 hk.error("[createThrottler] Bad argument given to createThrottler, first argument must be a function.",arguments);hk.debug("[createThrottler] Creating a new throttler instance.",arguments);const s=[];function a(){hk.debug("[onThrottlerTick] Calling callback with "+s.length+" queued items.");const e=s.slice(0);s.length=0,xk(a),t(e)}const l={push:function(t){hk.debug("[push] Queuing argument:",t),0===s.length&&kk(a,e),s.push(t),o+=1,(o<=r||s.length>=i)&&a()},flush:function(){hk.debug("[flush] Flushing queue."),0!==s.length&&a()},dispose:function(){hk.debug("[dispose] Disposing of throttler.");const t=s.slice(0);return s.length=0,xk(a),t}};return Object.defineProperty(l,"interval",{enumerable:!0,get:function(){return e},set:function(t){"number"==typeof t&&(e=t)}}),l}function Tk(t,e){if(t&&"function"==typeof t)return t.__tickerThrottler||(t.__tickerThrottler=_k((function(){t()}),e)),"number"==typeof e&&(t.__tickerThrottler.interval=e),t.__tickerThrottler.push(),t.__tickerThrottler;hk.error("[scheduleExecution] Bad argument given to scheduleExecution, first argument must be a function.",arguments)}var Ik=new WeakMap,Ek=new WeakMap,Sk=new WeakMap,Ak=new WeakMap,Nk=new WeakMap,Mk=new WeakMap,Fk=new WeakMap,Ok=new WeakMap,Ck=new WeakMap,Pk=new WeakMap,Dk=new WeakMap,Rk=new WeakMap,Lk=new WeakMap,Bk=new WeakMap,zk=new WeakMap,Wk=new WeakMap,jk=new WeakSet;class Uk extends Du{constructor(...t){super(...t),U(this,jk),W(this,Ik,void 0),W(this,Ek,void 0),W(this,Sk,void 0),W(this,Ak,void 0),W(this,Nk,[]),W(this,Mk,[]),W(this,Fk,new Set),W(this,Ok,new Set),W(this,Ck,!1),W(this,Pk,void 0),W(this,Dk,void 0),W(this,Rk,void 0),W(this,Lk,void 0),W(this,Bk,void 0),W(this,zk,void 0),W(this,Wk,void 0);const[e,n,i,r]=t;j(Ik,this,e),j(Ek,this,n),j(Sk,this,i),j(Ak,this,r),j(Pk,this,Bg());const o=t.length?t[t.length-1]:void 0,s=o&&"object"==typeof o&&Number.isFinite(o.maxConcurrent)?o.maxConcurrent:void 0;Number.isFinite(s)&&(this.settings.maxConcurrent=s),j(Wk,this,(()=>L(jk,this,Zk).call(this))),L(jk,this,Gk).call(this),L(jk,this,Vk).call(this)}get name(){return"NodeResolver"}get defaults(){return{maxConcurrent:5}}onDispose(){var t;z(Pk,this)&&z(Pk,this).abort(),j(Pk,this,null),z(Ak,this)&&"function"==typeof z(Ak,this).off&&z(Rk,this)&&z(Ak,this).off(Dm.PLACEMENT_ADDED,z(Rk,this)),z(Ak,this)&&"function"==typeof z(Ak,this).off&&z(zk,this)&&z(Ak,this).off(Dm.TIMELINE_RESET,z(zk,this)),z(Ik,this)&&"function"==typeof z(Ik,this).off&&z(Lk,this)&&z(Ik,this).off(Dm.NODE_ADD,z(Lk,this)),z(Ik,this)&&"function"==typeof z(Ik,this).off&&z(Bk,this)&&z(Ik,this).off(Dm.NODE_CHILDREN_CHANGED,z(Bk,this)),j(Rk,this,null),j(Lk,this,null),j(Bk,this,null),j(zk,this,null),j(Nk,this,[]),j(Mk,this,[]),z(Fk,this).clear(),z(Ok,this).clear(),j(Ck,this,!1),j(Dk,this,void 0),null!==(t=z(Wk,this))&&void 0!==t&&t.__tickerThrottler&&z(Wk,this).__tickerThrottler.dispose(),j(Wk,this,null)}}function $k(){return z(Pk,this)?z(Pk,this).signal:void 0}function qk(){return this._disposed||z(Pk,this)&&z(Pk,this).signal.aborted}function Vk(){z(Ak,this)&&"function"==typeof z(Ak,this).on&&(j(Rk,this,(t=>{L(jk,this,Kk).call(this,null==t?void 0:t.nodeId)})),z(Ak,this).on(Dm.PLACEMENT_ADDED,z(Rk,this)),j(zk,this,(()=>L(jk,this,Hk).call(this))),z(Ak,this).on(Dm.TIMELINE_RESET,z(zk,this))),z(Ik,this)&&"function"==typeof z(Ik,this).on&&(j(Lk,this,(({node:t})=>{(null==t?void 0:t.id)&&L(jk,this,Kk).call(this,t.id,{fromRepoAdd:!0})})),z(Ik,this).on(Dm.NODE_ADD,z(Lk,this)),j(Bk,this,(()=>{Tk(z(Wk,this),100)})),z(Ik,this).on(Dm.NODE_CHILDREN_CHANGED,z(Bk,this)))}function Gk(){const t=z(Ak,this)&&Array.isArray(z(Ak,this).placements)?z(Ak,this).placements:[];t.forEach((t=>L(jk,this,Kk).call(this,t.nodeId)));const e=t.length?t[t.length-1]:void 0;e&&e.nodeId&&j(Dk,this,e.nodeId)}function Hk(){z(Pk,this)&&z(Pk,this).abort(),j(Pk,this,Bg()),j(Nk,this,[]),j(Mk,this,[]),z(Fk,this).clear(),j(Ck,this,!1),j(Dk,this,void 0)}function Kk(t,{fromRepoAdd:e=!1}={}){L(jk,this,qk).call(this)||t&&(z(Ok,this).has(t)||z(Fk,this).has(t)||(z(Nk,this).push(t),z(Dk,this)||e||j(Dk,this,t),!z(Ck,this)&&e||L(jk,this,Xk).call(this)))}function Xk(){if(z(Ck,this))return void L(jk,this,Yk).call(this);if(0===z(Nk,this).length)return;j(Ck,this,!0);const t=z(Nk,this).shift();L(jk,this,tx).call(this,t).finally((()=>{L(jk,this,Yk).call(this)}))}async function Yk(){if(!L(jk,this,qk).call(this))for(z(Nk,this).length||z(Mk,this).length||j(Mk,this,L(jk,this,Qk).call(this));z(Fk,this).size<this.settings.maxConcurrent;){const t=this.settings.maxConcurrent-z(Fk,this).size;if(t<=0)break;const e=[];for(;e.length<t&&(z(Nk,this).length||z(Mk,this).length);){let t=z(Nk,this).shift();t||(t=z(Mk,this).shift()),t&&e.push(t)}if(!e.length)break;const n=L(jk,this,ex).call(this,e);n.length&&z(Sk,this)&&"function"==typeof z(Sk,this).resolve&&L(jk,this,nx).call(this,n).finally((()=>L(jk,this,Yk).call(this))),e.filter((t=>!n.find((e=>e.nodeId===t)))).forEach((t=>{L(jk,this,tx).call(this,t).finally((()=>L(jk,this,Yk).call(this)))}))}}function Qk(){const t=new Set([...z(Ok,this),...z(Fk,this),...z(Nk,this)]);return L(jk,this,Jk).call(this,t)}function Jk(t){const e=z(Ak,this)&&Array.isArray(z(Ak,this).placements)?z(Ak,this).placements:[],n=(e.length?e[e.length-1].nodeId:void 0)||z(Dk,this);return ck({prioritizer:z(Ek,this),repository:z(Ik,this),startNodeId:n,pendingIds:t,fallbackToRepository:!1})}function Zk(){L(jk,this,qk).call(this)||(z(Ck,this)||0!==z(Nk,this).length)&&(j(Mk,this,L(jk,this,Qk).call(this)),z(Ck,this)&&L(jk,this,Yk).call(this))}async function tx(t,e){if(!t||z(Ok,this).has(t)||z(Fk,this).has(t))return;const n=L(jk,this,$k).call(this);if(n&&n.aborted)return;const i=z(Ik,this)&&"function"==typeof z(Ik,this).get?z(Ik,this).get(t):void 0;if(i&&"function"==typeof i.resolve)if("function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts())z(Ok,this).add(t);else{z(Fk,this).add(t);try{const r={signal:n};e&&(r.manifestOverride=e),await i.resolve(r),z(Ok,this).add(t)}catch(e){if(Wg(e,n))return;this.log.warn(`NodeResolver failed to resolve node ${t}: ${(null==e?void 0:e.message)||e}`),"function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts()&&z(Ok,this).add(t)}finally{z(Fk,this).delete(t)}}}function ex(t){const e=[];return t.forEach((t=>{const n=z(Ik,this)&&"function"==typeof z(Ik,this).get?z(Ik,this).get(t):void 0;n&&n.manifestRef&&"assets-delivery-service"===n.manifestRef.type&&e.push({nodeId:t,ref:n.manifestRef})})),e}async function nx(t){const e=L(jk,this,$k).call(this);if(!e||!e.aborted){t.forEach((({nodeId:t})=>z(Fk,this).add(t)));try{const n=t.map((t=>t.ref)),i=await z(Sk,this).resolve(n,{signal:e});t.forEach((({nodeId:t,ref:e})=>{var n;const r=z(Ik,this)&&"function"==typeof z(Ik,this).get?z(Ik,this).get(t):void 0;if(z(Fk,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?L(jk,this,ix).call(this,o.manifest,s):void 0;L(jk,this,tx).call(this,t,a)}))}catch(n){Wg(n,e)||this.log.warn(`NodeResolver ADS batch failed: ${(null==n?void 0:n.message)||n}`),t.forEach((({nodeId:t})=>z(Fk,this).delete(t)))}}}function ix(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 rx=.001,ox="priority";function sx(t){const e=Number(t);return Number.isFinite(e)?e:0}var 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 WeakMap,yx=new WeakMap,bx=new WeakMap,kx=new WeakMap,xx=new WeakMap,wx=new WeakMap,_x=new WeakMap,Tx=new WeakMap,Ix=new WeakMap,Ex=new WeakMap,Sx=new WeakSet;class Ax extends Du{constructor(...t){super(...t),U(this,Sx),W(this,ax,void 0),W(this,lx,void 0),W(this,cx,void 0),W(this,ux,new Map),W(this,dx,new Map),W(this,hx,[]),W(this,fx,new Set),W(this,px,new Map),W(this,mx,!1),W(this,vx,void 0),W(this,gx,void 0),W(this,yx,void 0),W(this,bx,void 0),W(this,kx,void 0),W(this,xx,void 0),W(this,wx,void 0),W(this,_x,void 0),W(this,Tx,!1),W(this,Ix,[]),W(this,Ex,void 0);const[e,n,i]=t;j(ax,this,e),j(lx,this,n),j(cx,this,i),j(gx,this,Bg()),j(Ex,this,(()=>L(Sx,this,uw).call(this))),L(Sx,this,$x).call(this)}get name(){return"SegmentLoadCoordinator"}get defaults(){return{maxConcurrentLoads:3,maxSegmentLoadAttempts:3}}onDispose(){var t;z(gx,this)&&z(gx,this).abort(),j(gx,this,null),z(px,this).size&&z(px,this).forEach((t=>{(null==t?void 0:t.controller)&&t.controller.abort()})),z(px,this).clear(),z(cx,this)&&"function"==typeof z(cx,this).off&&(z(yx,this)&&z(cx,this).off(Dm.PLACEMENT_ADDED,z(yx,this)),z(kx,this)&&z(cx,this).off(Dm.TIMELINE_SEEKING,z(kx,this)),z(xx,this)&&z(cx,this).off(Dm.TIMELINE_SEEKED,z(xx,this)),z(wx,this)&&z(cx,this).off(Dm.TIMELINE_RESET,z(wx,this))),z(ax,this)&&"function"==typeof z(ax,this).off&&z(bx,this)&&z(ax,this).off(Dm.NODE_CHILDREN_CHANGED,z(bx,this)),z(_x,this)&&"function"==typeof Bu.removeEventListener&&Bu.removeEventListener("online",z(_x,this)),j(yx,this,null),j(bx,this,null),j(kx,this,null),j(xx,this,null),j(wx,this,null),j(_x,this,null),z(ux,this).clear(),z(dx,this).clear(),j(hx,this,[]),z(fx,this).clear(),z(px,this).clear(),j(mx,this,!1),j(vx,this,void 0),j(Tx,this,!1),j(Ix,this,[]),null!==(t=z(Ex,this))&&void 0!==t&&t.__tickerThrottler&&z(Ex,this).__tickerThrottler.dispose(),j(Ex,this,null)}}function Nx(){return z(gx,this)?z(gx,this).signal:void 0}function Mx(){return this._disposed||z(gx,this)&&z(gx,this).signal.aborted}function Fx(){const t=Number(this.settings.maxSegmentLoadAttempts);return Number.isFinite(t)&&t>0?t:1/0}function Ox(t){const e=L(Sx,this,Fx).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 Cx(t){return!!t&&(!!L(Sx,this,Ox).call(this,t)||L(Sx,this,Px).call(this,t))}function Px(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 Dx(t){if(!t||L(Sx,this,Px).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 Rx(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=>{L(Sx,this,Dx).call(this,t)}))})))}function Lx(){(z(ax,this)&&"function"==typeof z(ax,this).list?z(ax,this).list():[]).forEach((t=>{L(Sx,this,Rx).call(this,t)}))}function Bx(t,{allowSeekKeep:e=!1,segmentOffset:n}={}){const i=Bg(),r=i?i.signal:L(Sx,this,Nx).call(this);return t&&z(px,this).set(t,{controller:i,allowSeekKeep:!!e,segmentOffset:n}),{signal:r,controller:i}}function zx(t,e,n={}){const i=z(px,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 Wx(t,e){const n=z(px,this).get(t);n&&(e&&n.controller!==e||z(px,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=z(ax,this)&&"function"==typeof z(ax,this).get?z(ax,this).get(i):void 0;if(!r)return;const o=L(Sx,this,tw).call(this,r,t,e);Number.isFinite(o)&&n.add(`${i}:${o}`)})),n}function Ux(t){z(px,this).size&&z(px,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 $x(){z(cx,this)&&"function"==typeof z(cx,this).on&&(j(yx,this,(t=>{L(Sx,this,Xx).call(this,t)})),z(cx,this).on(Dm.PLACEMENT_ADDED,z(yx,this)),j(kx,this,(t=>L(Sx,this,qx).call(this,t))),z(cx,this).on(Dm.TIMELINE_SEEKING,z(kx,this)),j(xx,this,(t=>L(Sx,this,Vx).call(this,t))),z(cx,this).on(Dm.TIMELINE_SEEKED,z(xx,this)),j(wx,this,(()=>L(Sx,this,Kx).call(this))),z(cx,this).on(Dm.TIMELINE_RESET,z(wx,this))),z(ax,this)&&"function"==typeof z(ax,this).on&&(j(bx,this,(()=>{Tk(z(Ex,this),100)})),z(ax,this).on(Dm.NODE_CHILDREN_CHANGED,z(bx,this))),"function"==typeof Bu.addEventListener&&(j(_x,this,(()=>L(Sx,this,Hx).call(this))),Bu.addEventListener("online",z(_x,this)))}function qx(t={}){if(L(Sx,this,Mx).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=L(Sx,this,jx).call(this,n,e);L(Sx,this,Ux).call(this,i),j(Tx,this,!0),j(Ix,this,n.map((t=>{const n=null==t?void 0:t.nodeId;if(n)return{nodeId:n,placement:t,targetTime:e}})).filter(Boolean)),setTimeout((()=>L(Sx,this,Qx).call(this)),0)}function Vx(t={}){var e;if(L(Sx,this,Mx).call(this))return;j(Tx,this,!1),j(Ix,this,[]);const n=Number.isFinite(null==t?void 0:t.targetTime)?Number(t.targetTime):Number(null===(e=z(cx,this))||void 0===e?void 0:e.currentTime);L(Sx,this,Gx).call(this,n),setTimeout((()=>L(Sx,this,Qx).call(this)),0)}function Gx(t){var e;(Array.isArray(null===(e=z(cx,this))||void 0===e?void 0:e.placements)?z(cx,this).placements:[]).forEach((e=>{if(!e)return;const n=Bp(e);if(Number.isFinite(n)){if(Number.isFinite(t)){if(n>=t)return void L(Sx,this,Xx).call(this,e);const i=Rp(e,z(ax,this));return Number.isFinite(i)?void(n+i>t&&L(Sx,this,Xx).call(this,e)):void(n<=t&&L(Sx,this,Xx).call(this,e))}L(Sx,this,Xx).call(this,e)}}))}function Hx(){var t;L(Sx,this,Mx).call(this)||(L(Sx,this,Lx).call(this),j(Tx,this,!1),j(Ix,this,[]),L(Sx,this,Gx).call(this,Number(null===(t=z(cx,this))||void 0===t?void 0:t.currentTime)),j(hx,this,L(Sx,this,lw).call(this)),setTimeout((()=>L(Sx,this,Qx).call(this)),0))}function Kx(){z(gx,this)&&z(gx,this).abort(),j(gx,this,Bg()),z(px,this).size&&z(px,this).forEach((t=>{(null==t?void 0:t.controller)&&t.controller.abort()})),z(px,this).clear(),z(ux,this).clear(),z(dx,this).clear(),j(hx,this,[]),z(fx,this).clear(),j(mx,this,!1),j(vx,this,void 0),j(Tx,this,!1),j(Ix,this,[])}function Xx(t){if(L(Sx,this,Mx).call(this))return;const e=null==t?void 0:t.nodeId;if(!e)return;const n=z(ux,this).get(e);if(n){const i=Bp(n),r=Bp(t);Number.isFinite(i)?Number.isFinite(r)&&r<i&&z(ux,this).set(e,t):Number.isFinite(r)&&z(ux,this).set(e,t)}else z(ux,this).set(e,t);const i=z(vx,this);j(vx,this,e),i&&i!==e&&j(hx,this,[]),z(mx,this)?setTimeout((()=>L(Sx,this,Qx).call(this)),0):L(Sx,this,Yx).call(this)}function Yx(){z(mx,this)||z(ux,this).size&&(j(mx,this,!0),L(Sx,this,Qx).call(this))}async function Qx(){if(L(Sx,this,Mx).call(this))return;if(z(fx,this).size>=this.settings.maxConcurrentLoads)return;if(z(Tx,this))return void(z(Ix,this).length&&L(Sx,this,Jx).call(this));const t=L(Sx,this,iw).call(this);if(t.hasPending)L(Sx,this,rw).call(this,t);else for(z(hx,this).length||j(hx,this,L(Sx,this,lw).call(this));z(fx,this).size<this.settings.maxConcurrentLoads&&z(hx,this).length;){const t=z(hx,this).shift();L(Sx,this,dw).call(this,t,"partial").finally((()=>{setTimeout((()=>L(Sx,this,Qx).call(this)),0)}))}}function Jx(){if(L(Sx,this,Mx).call(this))return;const t=Math.max(0,this.settings.maxConcurrentLoads-z(fx,this).size);if(!t||!z(Ix,this).length)return;const e=[],n=[];for(let i=0;i<z(Ix,this).length;i+=1){const r=z(Ix,this)[i];(null==r?void 0:r.nodeId)&&(e.length<t&&!z(fx,this).has(r.nodeId)?e.push(r):n.push(r))}j(Ix,this,n),e.forEach((t=>{L(Sx,this,Zx).call(this,t).finally((()=>{setTimeout((()=>L(Sx,this,Qx).call(this)),0)}))}))}async function Zx(t={}){const e=null==t?void 0:t.nodeId,n=null==t?void 0:t.placement,i=Number(null==t?void 0:t.targetTime);if(!e||!n||!Number.isFinite(i))return;if(z(fx,this).has(e))return;const{signal:r,controller:o}=L(Sx,this,Bx).call(this,e);if(r&&r.aborted)L(Sx,this,Wx).call(this,e,o);else{z(fx,this).add(e);try{const t=z(ax,this)&&"function"==typeof z(ax,this).get?z(ax,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=L(Sx,this,tw).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}`),L(Sx,this,zx).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){Wg(t,r)||this.log.warn(`[#loadSeekWork] SegmentLoadCoordinator failed to seek-load node ${e}: ${(null==t?void 0:t.message)||t}`)}finally{z(fx,this).delete(e),L(Sx,this,Wx).call(this,e,o)}}}function tw(t,e,n){var i;const r=Bp(e);if(!Number.isFinite(r))return;const o=sx(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=sx(null===(i=l)||void 0===i?void 0:i.offset),d=xy(c,Math.max(0,s-u),{preferRepresentationTime:!0}),h=Number(null==d?void 0:d.offset);return Number.isFinite(h)?h:void 0}function ew(t,e,n=(t=>null===(t=z(cx,this))||void 0===t?void 0:t.currentTime)()){var i;const r=(Array.isArray(null===(i=z(cx,this))||void 0===i?void 0:i.placements)?z(cx,this).placements:[]).filter((e=>(null==e?void 0:e.nodeId)===t&&Number.isFinite(Bp(e)))).sort(((t,e)=>Bp(t)-Bp(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=Bp(e);if(!Number.isFinite(n))continue;const i=Rp(e,z(ax,this)),l=Number.isFinite(i)&&i>=0;(!a&&n>=o-rx&&(a=e),l)?o+rx>=n&&o<n+i-rx&&(s=e):o+rx>=n&&(s=e)}return s||a||r[r.length-1]}function nw(t,e){var n;const i=Number(Bp(e));if(!Number.isFinite(i))return;const r=Rp(e,z(ax,this)),o=Number.isFinite(r)&&r>=0?i+r:void 0,s=(Array.isArray(null===(n=z(cx,this))||void 0===n?void 0:n.placements)?z(cx,this).placements:[]).filter((e=>(null==e?void 0:e.nodeId)===t&&Number.isFinite(Bp(e)))).sort(((t,e)=>Bp(t)-Bp(e)));for(let t=0;t<s.length;t+=1){const e=s[t],n=Number(Bp(e));if(Number.isFinite(n)&&!(n<=i+rx)){if(Number.isFinite(o)&&n>o+rx)return;return e}}}function iw(){const t=[];let e=!1,n=1/0;if(z(ux,this).forEach(((i,r)=>{if(!r||!i)return;const o=z(dx,this).get(r);if(o)return e=!0,void(n=Math.min(n,sx(o.timelineStart)));const s=L(Sx,this,ow).call(this,r,i);s&&(e=!0,n=Math.min(n,sx(s.timelineStart)),t.push(s))})),!e||!Number.isFinite(n))return{hasPending:!1,waveTime:void 0,startable:[]};const i=t.filter((t=>sx(t.timelineStart)===n&&!z(fx,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 rw({waveTime:t,startable:e}){const n=Math.max(0,this.settings.maxConcurrentLoads-z(fx,this).size);n&&e.length&&e.slice(0,n).forEach((e=>{L(Sx,this,aw).call(this,e,t).finally((()=>{setTimeout((()=>L(Sx,this,Qx).call(this)),0)}))}))}function ow(t,e){var n,i;const r=z(ax,this)&&"function"==typeof z(ax,this).get?z(ax,this).get(t):void 0;if(!r)return;if("function"==typeof r.hasExceededManifestLoadAttempts&&r.hasExceededManifestLoadAttempts())return void z(ux,this).delete(t);const o=L(Sx,this,ew).call(this,t,e,null===(n=z(cx,this))||void 0===n?void 0:n.currentTime),s=Number(Bp(o)),a=sx(null===(i=z(cx,this))||void 0===i?void 0:i.currentTime),l="function"==typeof r.loadMediaSegmentsAtOffset,c="function"==typeof r.load;if(!l&&!c)return void z(ux,this).delete(t);if(r.isLoaded)return void z(ux,this).delete(t);if("ready"!==r.state){if(!Number.isFinite(s))return;return{nodeId:t,segmentOffset:0,timelineStart:s}}if(!L(Sx,this,hw).call(this,r))return void z(ux,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&&!L(Sx,this,Cx).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/rx)*rx;h.add(t)}}))}));const f=Array.from(h).sort(((t,e)=>t-e)),p=e=>{const n=Number(Bp(e));if(!Number.isFinite(n))return{status:"none"};const i=sx(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+rx;t+=1)s=t;const l=f.slice(s);if(!l.some((t=>L(Sx,this,sw).call(this,r,t))))return{status:f.slice(0,s).some((t=>L(Sx,this,sw).call(this,r,t)))?"beforeOnly":"none"};const c=l.find((t=>L(Sx,this,sw).call(this,r,t))),u=Math.max(0,sx(c)-i);return{status:"work",work:{nodeId:t,segmentOffset:c,timelineStart:n+u}}},m=p(o);if("work"===m.status)return m.work;if("beforeOnly"!==m.status){if(d&&Number.isFinite(s))return{nodeId:t,segmentOffset:0,timelineStart:s};z(ux,this).delete(t)}else{const e=L(Sx,this,nw).call(this,t,o);if(e){const t=p(e);if("work"===t.status)return t.work}}}function sw(t,e){const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[],i=sx(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)<=rx&&!L(Sx,this,Cx).call(this,t)}))))}async function aw(t,e){const n=null==t?void 0:t.nodeId,i=null==t?void 0:t.segmentOffset;if(this.log.debug(`[#loadP0Work] Loading ${ox} node [${n}] at segmentOffset=${i} wave=${e}`),!n)return;const r=z(ax,this)&&"function"==typeof z(ax,this).get?z(ax,this).get(n):void 0;if(!r)return void z(ux,this).delete(n);const o="function"==typeof r.loadMediaSegmentsAtOffset&&Number.isFinite(i),{signal:s,controller:a}=L(Sx,this,Bx).call(this,n,{allowSeekKeep:o,segmentOffset:i});if(s&&s.aborted)L(Sx,this,Wx).call(this,n,a);else{z(fx,this).add(n),z(dx,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(Wg(t,s))return;const e=`[#loadP0Work] SegmentLoadCoordinator failed to load ${ox} work for node ${n}: ${(null==t?void 0:t.message)||t}`;this.log.warn(e)}finally{this.log.debug(`[#loadP0Work] Finished ${ox} work for node [${n}]`),z(dx,this).delete(n),z(fx,this).delete(n),L(Sx,this,Wx).call(this,n,a)}}}function lw(){const t=new Set([...z(ux,this).keys(),...z(fx,this)]),e=L(Sx,this,cw).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&&L(Sx,this,fw).call(this,t));if(i){const e=ck({prioritizer:z(lx,this),repository:z(ax,this),startNodeId:z(vx,this),prioritizedIds:n,pendingIds:t,allowedIds:i,filter:r});if(e.length)return e}return ck({prioritizer:z(lx,this),repository:z(ax,this),startNodeId:z(vx,this),prioritizedIds:n,pendingIds:t,filter:r})}function cw(){return z(lx,this)&&z(vx,this)?"function"==typeof z(lx,this).getPrioritizationSnapshot?z(lx,this).getPrioritizationSnapshot(z(vx,this)):{orderedIds:"function"==typeof z(lx,this).sortNodes?z(lx,this).sortNodes(z(vx,this)):[],reachableIds:"function"==typeof z(lx,this).getReachableNodeIds?z(lx,this).getReachableNodeIds(z(vx,this)):[]}:null}function uw(){L(Sx,this,Mx).call(this)||(z(mx,this)||z(ux,this).size)&&(j(hx,this,L(Sx,this,lw).call(this)),z(mx,this)&&!z(Tx,this)&&L(Sx,this,Qx).call(this))}async function dw(t,e){if(this.log.debug(`[#loadNode] Loading node [${t}] in '${e}' mode`),!t)return;const n=z(ax,this)&&"function"==typeof z(ax,this).get?z(ax,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}=L(Sx,this,Bx).call(this,t,{allowSeekKeep:!1});if(i&&i.aborted)L(Sx,this,Wx).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&&L(Sx,this,fw).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${t}: partial already loaded`);if(!L(Sx,this,hw).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${t}: no loadable tracks`);z(fx,this).add(t),await n.load({loadingMode:e,signal:i})}catch(e){if(Wg(e,i))return;this.log.warn(`[#loadNode] SegmentLoadCoordinator failed to load node ${t}: ${(null==e?void 0:e.message)||e}`)}finally{this.log.debug(`[#loadNode] Finished loading node [${t}]`),z(fx,this).delete(t),L(Sx,this,Wx).call(this,t,r)}}function hw(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 fw(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&&!L(Sx,this,Cx).call(this,n)||i&&!L(Sx,this,Cx).call(this,i))}))}class pw extends Du{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 mw(t){if(!t)throw new Error("Assertion failed.")}const vw=t=>t&&t[t.length-1],gw=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)},yw=t=>t.constructor===Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t),bw=t=>t.constructor===DataView?t:ArrayBuffer.isView(t)?new DataView(t.buffer,t.byteOffset,t.byteLength):new DataView(t),kw=new TextDecoder,xw=t=>Object.fromEntries(Object.entries(t).map((([t,e])=>[e,t]))),ww={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},_w=xw(ww),Tw={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},Iw=xw(Tw),Ew={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},Sw=xw(Ew),Aw=t=>[...t].map((t=>t.toString(16).padStart(2,"0"))).join(""),Nw=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,Mw=(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},Fw=(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},Ow=()=>{let t,e;return{promise:new Promise(((n,i)=>{t=n,e=i})),resolve:t,reject:e}},Cw=(t,e,n)=>t.getUint8(e)<<16|t.getUint8(e+1)<<8|t.getUint8(e+2),Pw=(t,e,n)=>Math.max(e,Math.min(n,t)),Dw=/^[a-z]{3}$/,Rw=1e6*(1+Number.EPSILON);let Lw=null;let Bw=null;const zw=()=>{if(null!==Bw)return Bw;if("undefined"==typeof navigator)return null;const t=/\bChrome\/(\d+)/.exec(navigator.userAgent);return t?Bw=Number(t[1]):null},Ww=t=>"number"==typeof t&&!Number.isNaN(t);class jw{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 Uw={default:!0,forced:!1,original:!1,commentary:!1,hearingImpaired:!1,visuallyImpaired:!1};class $w{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 $w(this.bytes);return t.pos=this.pos,t}}const qw=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Vw=[-1,1,2,3,4,5,6,8],Gw=t=>{if(!t||t.byteLength<2)throw new TypeError("AAC description must be at least 2 bytes long.");const e=new $w(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<qw.length&&(r=qw[i]);const o=e.readBits(4);let s=null;return o>=1&&o<=7&&(s=Vw[o]),{objectType:n,frequencyIndex:i,sampleRate:r,channelConfiguration:o,numberOfChannels:s}},Hw=["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"],Kw=[{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}],Xw=t=>{const{codec:e,codecDescription:n,colorSpace:i,avcCodecInfo:r,hevcCodecInfo:o,vp9CodecInfo:s,av1CodecInfo:a}=t;if("avc"===e){if(mw(null!==t.avcType),r){const e=new Uint8Array([r.avcProfileIndication,r.profileCompatibility,r.avcLevelIndication]);return`avc${t.avcType}.${Aw(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}.${Aw(n.subarray(1,4))}`}if("hevc"===e){let t,e,i,r,s,a;if(o)t=o.generalProfileSpace,e=o.generalProfileIdc,i=Nw(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=bw(n),l=o.getUint8(1);t=l>>6&3,e=31&l,i=Nw(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=vw(Kw).level;for(const t of Kw)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=vw(Kw).level;for(const t of Kw)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?ww[i.primaries]:1,u=null!=i&&i.transfer?Tw[i.transfer]:1,d=null!=i&&i.matrix?Ew[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}'.`)},Yw=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:Gw(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&&Hw.includes(e))return e;throw new TypeError(`Unhandled codec '${e}'.`)},Qw=/^pcm-([usf])(\d+)+(be)?$/,Jw=[48e3,44100,32e3],Zw=[24e3,22050,16e3];var t_,e_;!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"}(t_||(t_={})),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"}(e_||(e_={}));const n_=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})},i_=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=Cw(i,n):(mw(4===e),t=i.getUint32(n,!1)),n+=e,yield{offset:n,length:t},n+=t}},r_=t=>31&t,o_=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)},s_=t=>t>>1&63,a_=function*(t){const e=new $w(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);mw(e.pos%8==0),yield{type:i,data:t.subarray(e.pos/8,e.pos/8+s)},e.skipBits(8*s)}};var l_;!function(t){t[t.STREAMINFO=0]="STREAMINFO",t[t.VORBIS_COMMENT=4]="VORBIS_COMMENT",t[t.PICTURE=6]="PICTURE"}(l_||(l_={}));const c_=[2,1,2,3,3,4,4,5];class u_{constructor(t){this.input=t}}const d_=[],h_=[],f_=new Uint8Array(0);class p_{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===f_&&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===f_}get microsecondTimestamp(){return Math.trunc(Rw*this.timestamp)}get microsecondDuration(){return Math.trunc(Rw*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 p_(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 p_(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 m_=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.")},v_=t=>{if(!Ww(t))throw new TypeError("timestamp must be a number.")},g_=(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 y_{constructor(t){if(!(t instanceof b_))throw new TypeError("track must be an InputTrack.");this._track=t}getFirstPacket(t={}){if(m_(t),this._track.input._disposed)throw new V_;return g_(this._track,this._track._backing.getFirstPacket(t),t)}async getFirstKeyPacket(t={}){m_(t);const e=await this.getFirstPacket(t);return e?"key"===e.type?e:this.getNextKeyPacket(e,t):null}getPacket(t,e={}){if(v_(t),m_(e),this._track.input._disposed)throw new V_;return g_(this._track,this._track._backing.getPacket(t,e),e)}getNextPacket(t,e={}){if(!(t instanceof p_))throw new TypeError("packet must be an EncodedPacket.");if(m_(e),this._track.input._disposed)throw new V_;return g_(this._track,this._track._backing.getNextPacket(t,e),e)}async getKeyPacket(t,e={}){if(v_(t),m_(e),this._track.input._disposed)throw new V_;if(!e.verifyKeyPackets)return this._track._backing.getKeyPacket(t,e);const n=await this._track._backing.getKeyPacket(t,e);return n?(mw("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 p_))throw new TypeError("packet must be an EncodedPacket.");if(m_(e),this._track.input._disposed)throw new V_;if(!e.verifyKeyPackets)return this._track._backing.getNextKeyPacket(t,e);const n=await this._track._backing.getNextKeyPacket(t,e);return n?(mw("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 p_))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 p_))throw new TypeError("endPacket must be an EncodedPacket.");if(m_(n),this._track.input._disposed)throw new V_;const i=[];let{promise:r,resolve:o}=Ow(),{promise:s,resolve:a}=Ow(),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}=Ow()),await s):(i.push(u),o(),({promise:r,resolve:o}=Ow()),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 V_;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 b_{constructor(t,e){this.input=t,this._backing=e}isVideoTrack(){return this instanceof k_}isAudioTrack(){return this instanceof x_}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 y_(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 k_ extends b_{constructor(t,e){super(t,e),this._backing=e,this.pixelAspectRatio=(t=>{mw(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 mw(null!==e),d_.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 p_))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 mw(e),((t,e,n)=>{switch(t){case"avc":for(const t of((t,e)=>{if(e.description){const n=3&yw(e.description)[4];return i_(t,n+1)}return n_(t)})(n,e)){const e=n[t.offset],r=r_(e);if(r>=t_.NON_IDR_SLICE&&r<=t_.SLICE_DPC)return"delta";if(r===t_.IDR)return"key";if(r===t_.SEI&&(i=void 0,!(null!==Lw?Lw:Lw=!("undefined"==typeof navigator||(null===(i=navigator.vendor)||void 0===i||!i.includes("Google Inc"))&&!/Chrome/.test(navigator.userAgent)))||zw()>=144)){const e=n.subarray(t.offset,t.offset+t.length),i=o_(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 $w(i);t.pos=8*r;const e=gw(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&yw(e.description)[21];return i_(t,n+1)}return n_(t)})(n,e)){const e=s_(n[t.offset]);if(e<e_.BLA_W_LP)return"delta";if(e<=e_.RSV_IRAP_VCL23)return"key"}return"delta";case"vp8":return 1&n[0]?"delta":"key";case"vp9":{const t=new $w(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 a_(n))if(1===e){const e=new $w(i);e.skipBits(4),t=!!e.readBits(1)}else if(3===e||6===e||7===e){if(t)return"key";const e=new $w(i);return e.readBits(1)?null:0===e.readBits(2)?"key":"delta"}return null}default:(t=>{throw new Error(`Unexpected value: ${t}`)})(t),mw(!1)}var i})(this.codec,e,t.data)}}class x_ extends b_{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 mw(null!==e),h_.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 p_))throw new TypeError("packet must be an EncodedPacket.");return null===this.codec?null:"key"}}const w_=t=>{let e=tT(t);const n=oT(t,4);let i=8;1===e&&(e=nT(t),i=16);const r=e-i;return r<0?null:{name:n,totalSize:e,headerSize:i,contentSize:r}},__=t=>eT(t)/65536,T_=t=>eT(t)/1073741824,I_=t=>{let e=0;for(let n=0;n<4;n++){e<<=7;const n=Y_(t);if(e|=127&n,!(128&n))break}return e},E_=t=>{let e=Q_(t);return t.skip(2),e=Math.min(e,t.remainingLength),kw.decode(X_(t,e))},S_=t=>{const e=w_(t);if(!e||"data"!==e.name)return null;if(t.remainingLength<8)return null;const n=tT(t);t.skip(4);const i=X_(t,e.contentSize-8);switch(n){case 1:return kw.decode(i);case 2:return new TextDecoder("utf-16be").decode(i);case 13:return new jw(i,"image/jpeg");case 14:return new jw(i,"image/png");case 27:return new jw(i,"image/bmp");default:return i}};class A_ extends u_{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=w_(e);if(!i)break;if("ftyp"===i.name){const t=oT(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),mw(t);const e=tT(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=w_(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,mw(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&&Hw.includes(t.info.codec)&&0===n.sampleCompositionTimeOffsets.length){var r;mw("audio"===(null===(r=t.info)||void 0===r?void 0:r.type));const e=(t=>{if(mw(Hw.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=Qw.exec(t);let n;return mw(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=Fw(n.sampleTimingEntries,a,(t=>t.startIndex)),u=n.sampleTimingEntries[c],d=Fw(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=vw(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),mw(n);const i=w_(n);mw("moof"===(null==i?void 0:i.name));let r=this.reader.requestSlice(t,i.totalSize);r instanceof Promise&&(r=await r),mw(r),this.traverseBox(r);const o=this.lastReadFragment;mw(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)R_(t,i.timestamp);else{const e=Fw(n,o.moofOffset-1,(t=>t.moofOffset));if(-1!==e){const i=n[e];R_(t,i.endTimestamp)}}t.startTimestampIsFinal=!0}const i=Fw(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=w_(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,O,C,P,D,R;const L=t.filePos,B=w_(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=Y_(t);t.skip(3),1===e?(t.skip(16),this.movieTimescale=tT(t),this.movieDurationInTimescale=nT(t)):(t.skip(8),this.movieTimescale=tT(t),this.movieDurationInTimescale=tT(t))}break;case"trak":{const e={id:-1,demuxer:this,inputTrack:null,disposition:{...Uw},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 k_(this.input,new M_(t)),this.tracks.push(e)}else if("audio"===e.info.type&&-1!==e.info.numberOfChannels){const t=e;e.inputTrack=new x_(this.input,new F_(t)),this.tracks.push(e)}this.currentTrack=null}break;case"tkhd":{const e=this.currentTrack;if(!e)break;const n=Y_(t),i=!!(1&J_(t));if(e.disposition.default=i,0===n)t.skip(8),e.id=tT(t),t.skip(4),e.durationInMovieTimescale=tT(t);else{if(1!==n)throw new Error(`Incorrect track header version ${n}.`);t.skip(16),e.id=tT(t),t.skip(4),e.durationInMovieTimescale=nT(t)}t.skip(16);const r=[__(t),__(t),T_(t),__(t),__(t),T_(t),__(t),__(t),T_(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}.`)})((Ot=L_(r),90*Math.round(Ot/90)));mw(0===o||90===o||180===o||270===o),e.rotation=o}break;case"elst":{const e=this.currentTrack;if(!e)break;const n=Y_(t);t.skip(3);let i=!1,r=0;const o=tT(t);for(let s=0;s<o;s++){const o=1===n?nT(t):tT(t),s=1===n?iT(t):eT(t),a=__(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=Y_(t);t.skip(3),0===n?(t.skip(8),e.timescale=tT(t),e.durationInMediaTimescale=tT(t)):1===n&&(t.skip(16),e.timescale=tT(t),e.durationInMediaTimescale=nT(t));let i=Q_(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,Dw.test(Ft)||(e.languageCode="und")}}break;case"hdlr":{const e=this.currentTrack;if(!e)break;t.skip(8);const n=oT(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=Y_(t);t.skip(3);const i=tT(t);for(let r=0;r<i;r++){const i=t.filePos,r=w_(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=Q_(t),e.info.height=Q_(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=Q_(t);t.skip(6);let a=Q_(t),l=Q_(t);t.skip(4);let c=tT(t)/65536;if(0===n&&s>0)if(1===s)t.skip(4),l=8*tT(t),t.skip(8);else if(2===s){t.skip(4),c=rT(t),a=tT(t),t.skip(4),l=tT(t);const n=tT(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;mw(e.info),e.info.codecDescription=X_(t,B.contentSize)}break;case"hvcC":{const e=this.currentTrack;if(!e)break;mw(e.info),e.info.codecDescription=X_(t,B.contentSize)}break;case"vpcC":{var j;const e=this.currentTrack;if(!e)break;mw("video"===(null===(j=e.info)||void 0===j?void 0:j.type)),t.skip(4);const n=Y_(t),i=Y_(t),r=Y_(t),o=r>>4,s=r>>1&7,a=1&r,l=Y_(t),c=Y_(t),u=Y_(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;mw("video"===(null===(U=e.info)||void 0===U?void 0:U.type)),t.skip(1);const n=Y_(t),i=n>>5,r=31&n,o=Y_(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 $;const e=this.currentTrack;if(!e)break;if(mw("video"===(null===($=e.info)||void 0===$?void 0:$.type)),"nclx"!==oT(t,4))break;const n=Q_(t),i=Q_(t),r=Q_(t),o=Boolean(128&Y_(t));e.info.colorSpace={primaries:_w[n],transfer:Iw[i],matrix:Sw[r],fullRange:o}}break;case"pasp":{var q;const e=this.currentTrack;if(!e)break;mw("video"===(null===(q=e.info)||void 0===q?void 0:q.type));const n=tT(t),i=tT(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;mw("audio"===(null===(V=e.info)||void 0===V?void 0:V.type)),t.skip(4),mw(3===Y_(t)),I_(t),t.skip(2);const n=Y_(t),i=!!(64&n),r=!!(32&n);if(!!(128&n)&&t.skip(2),i){const e=Y_(t);t.skip(e)}r&&t.skip(2),mw(4===Y_(t));const o=I_(t),s=t.filePos,a=Y_(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){mw(5===Y_(t));const n=I_(t);if(e.info.codecDescription=X_(t,n),"aac"===e.info.codec){const t=Gw(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;mw("audio"===(null===(G=e.info)||void 0===G?void 0:G.type)),255&Q_(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;mw("audio"===(null===(H=e.info)||void 0===H?void 0:H.type)),t.skip(4);const n=Y_(t),i=Boolean(1&n),r=Y_(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;mw("audio"===(null===(K=e.info)||void 0===K?void 0:K.type)),t.skip(1);const n=Y_(t),i=Q_(t),r=tT(t),o=Z_(t),s=Y_(t);let a;a=0!==s?X_(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;mw("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=Y_(t),o=J_(t);if((r&n)===l_.STREAMINFO){t.skip(10);const n=tT(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=X_(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;mw("audio"===(null===(Y=e.info)||void 0===Y?void 0:Y.type));const n=X_(t,3),i=new $w(n),r=i.readBits(2);i.skipBits(8);const o=i.readBits(3),s=i.readBits(1);r<3&&(e.info.sampleRate=Jw[r]),e.info.numberOfChannels=c_[o]+s}break;case"dec3":{var Q;const e=this.currentTrack;if(!e)break;mw("audio"===(null===(Q=e.info)||void 0===Q?void 0:Q.type));const n=(t=>{if(t.length<2)return null;const e=new $w(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}})(X_(t,B.contentSize));if(!n){console.warn("Invalid dec3 box contents, ignoring.");break}const i=(t=>{const e=t.substreams[0];return mw(e),e.fscod<3?Jw[e.fscod]:null!==e.fscod2&&e.fscod2<3?Zw[e.fscod2]:null})(n);null!==i&&(e.info.sampleRate=i),e.info.numberOfChannels=(t=>{const e=t.substreams[0];mw(e);let n=c_[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=tT(t);let i=0,r=0;for(let o=0;o<n;o++){const n=tT(t),o=tT(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=tT(t);let i=0;for(let r=0;r<n;r++){const n=tT(t),r=eT(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=tT(t),i=tT(t);if(0===n)for(let n=0;n<i;n++){const n=tT(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=Y_(t),i=tT(t),r=X_(t,Math.ceil(i*n/8)),o=new $w(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=tT(t);for(let i=0;i<n;i++){const n=tT(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=tT(t);for(let i=0;i<n;i++){const n=tT(t)-1,i=tT(t),r=tT(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=tT(t);for(let i=0;i<n;i++){const n=tT(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=tT(t);for(let i=0;i<n;i++){const n=nT(t);e.sampleTable.chunkOffsets.push(n)}}break;case"mvex":this.isFragmented=!0,this.readContiguousBoxes(t.slice(z,B.contentSize));break;case"mehd":{const e=Y_(t);t.skip(3);const n=1===e?nT(t):tT(t);this.movieDurationInTimescale=n}break;case"trex":{t.skip(4);const e=tT(t),n=tT(t),i=tT(t),r=tT(t),o=tT(t);this.fragmentTrackDefaults.push({trackId:e,defaultSampleDescriptionIndex:n,defaultSampleDuration:i,defaultSampleSize:r,defaultSampleFlags:o})}break;case"tfra":{const e=Y_(t);t.skip(3);const n=tT(t),i=this.tracks.find((t=>t.id===n));if(!i)break;const r=tT(t),o=(12&r)>>2,s=3&r,a=[Y_,Q_,J_,tT],l=a[(48&r)>>4],c=a[o],u=a[s],d=tT(t);for(let n=0;n<d;n++){const n=1===e?nT(t):tT(t),r=1===e?nT(t):tT(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(mw(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;mw(e),null!==e.startTimestamp&&(R_(t,e.startTimestamp),t.startTimestampIsFinal=!0)}this.currentTrack.currentFragmentState=null,this.currentTrack=null}break;case"tfhd":{var J,Z,tt,et;mw(this.currentFragment),t.skip(1);const e=J_(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=tT(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=nT(t):l&&(u.currentFragmentState.baseDataOffset=this.currentFragment.moofOffset),i&&(u.currentFragmentState.sampleDescriptionIndex=tT(t)),r&&(u.currentFragmentState.defaultSampleDuration=tT(t)),o&&(u.currentFragmentState.defaultSampleSize=tT(t)),s&&(u.currentFragmentState.defaultSampleFlags=tT(t)),a&&(u.currentFragmentState.defaultSampleDuration=0)}break;case"tfdt":{const e=this.currentTrack;if(!e)break;mw(e.currentFragmentState);const n=Y_(t);t.skip(3);const i=0===n?tT(t):nT(t);e.currentFragmentState.startTimestamp=i}break;case"trun":{const e=this.currentTrack;if(!e)break;if(mw(this.currentFragment),mw(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=Y_(t),i=J_(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=tT(t);let d=e.currentFragmentState.baseDataOffset;r&&(d+=eT(t));let h=null;o&&(h=tT(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=tT(t):(mw(null!==e.currentFragmentState.defaultSampleDuration),r=e.currentFragmentState.defaultSampleDuration),a?o=tT(t):(mw(null!==e.currentFragmentState.defaultSampleSize),o=e.currentFragmentState.defaultSampleSize),l?u=tT(t):(mw(null!==e.currentFragmentState.defaultSampleFlags),u=e.currentFragmentState.defaultSampleFlags),0===i&&null!==h&&(u=h);let d=0;c&&(d=0===n?tT(t):eT(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[vw(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]=E_(y)):null!==(ct=(at=this.metadataTags.raw)[lt=t.name])&&void 0!==ct||(at[lt]=X_(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=kw.decode(X_(y,t.contentSize)):null!==(n=(e=this.metadataTags).title)&&void 0!==n||(e.title=E_(y));break;case"©des":this.currentTrack||null!==(r=(i=this.metadataTags).description)&&void 0!==r||(i.description=E_(y));break;case"©ART":this.currentTrack||null!==(s=(o=this.metadataTags).artist)&&void 0!==s||(o.artist=E_(y));break;case"©alb":this.currentTrack||null!==(l=(a=this.metadataTags).album)&&void 0!==l||(a.album=E_(y));break;case"albr":this.currentTrack||null!==(u=(c=this.metadataTags).albumArtist)&&void 0!==u||(c.albumArtist=E_(y));break;case"©gen":this.currentTrack||null!==(h=(d=this.metadataTags).genre)&&void 0!==h||(d.genre=E_(y));break;case"©day":if(!this.currentTrack){var ut,dt;const t=new Date(E_(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=E_(y));break;case"©lyr":this.currentTrack||null!==(v=(m=this.metadataTags).lyrics)&&void 0!==v||(m.lyrics=E_(y))}}}break;case"meta":{if(this.currentTrack)break;const e=0!==tT(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=tT(t);for(let n=0;n<e;n++){const e=tT(t);t.skip(4);const i=kw.decode(X_(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=S_(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!==(O=(F=this.metadataTags).lyrics)&&void 0!==O||(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 jw?(null!==(P=(C=this.metadataTags).images)&&void 0!==P||(C.images=[]),this.metadataTags.images.push({data:r.data,kind:"coverFront",mimeType:r.mimeType})):r instanceof Uint8Array&&(null!==(R=(D=this.metadataTags).images)&&void 0!==R||(D.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=bw(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=bw(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,Ot;return t.filePos=W,!0}}class N_{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=O_(i,n),o=await this.fetchPacketForSampleIndex(r,e);return B_(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=Fw(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=C_(i,n),o=await this.fetchPacketForSampleIndex(r,e);return B_(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=D_(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 mw(-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=P_(n,t);if(!i)return null;let r;if(e.metadataOnly)r=f_;else{let t=this.internalTrack.demuxer.reader.requestSlice(i.sampleOffset,i.sampleSize);t instanceof Promise&&(t=await t),mw(t),r=X_(t,i.sampleSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new p_(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(mw(i),n.metadataOnly)r=f_;else{let t=this.internalTrack.demuxer.reader.requestSlice(i.byteOffset,i.byteSize);t instanceof Promise&&(t=await t),mw(t),r=X_(t,i.byteSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new p_(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=Fw(this.internalTrack.fragmentLookupTable,n,(t=>t.timestamp)),h=-1!==d?this.internalTrack.fragmentLookupTable[d]:null,f=Fw(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=w_(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];mw(!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 M_ extends N_{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 a_(t)){if(1!==e)continue;const t=new $w(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 $w(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=vw(Kw).level;for(const t of Kw)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:Xw(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 F_ extends N_{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:Yw(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 O_=(t,e)=>{if(t.presentationTimestamps){const n=Fw(t.presentationTimestamps,e,(t=>t.presentationTimestamp));return-1===n?-1:t.presentationTimestamps[n].sampleIndex}{const n=Fw(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)}},C_=(t,e)=>{if(!t.keySampleIndices)return O_(t,e);if(t.presentationTimestamps){const n=Fw(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!==Mw(t.keySampleIndices,n,(t=>t)))return n}return-1}{var n;const i=O_(t,e),r=Fw(t.keySampleIndices,i,(t=>t));return null!==(n=t.keySampleIndices[r])&&void 0!==n?n:-1}},P_=(t,e)=>{const n=Fw(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=Fw(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=Fw(t.sampleToChunk,e,(t=>t.startSampleIndex)),c=t.sampleToChunk[l];mw(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];mw(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!==Mw(t.keySampleIndices,e,(t=>t))}},D_=(t,e)=>{var n;if(!t.keySampleIndices)return e+1;const i=Fw(t.keySampleIndices,e,(t=>t));return null!==(n=t.keySampleIndices[i+1])&&void 0!==n?n:-1},R_=(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},L_=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},B_=t=>0===t.sampleSizes.length;class z_{}class W_ extends z_{async _getMajorBrand(t){let e=t._reader.requestSlice(0,12);return e instanceof Promise&&(e=await e),e?(e.skip(4),"ftyp"!==oT(e,4)?null:oT(e,4)):null}_createDemuxer(t){return new A_(t)}}const j_=new class extends W_{async _canReadInput(t){const e=await this._getMajorBrand(t);return!!e&&"qt "!==e}get name(){return"MP4"}get mimeType(){return"video/mp4"}};class U_{constructor(){this._disposed=!1,this._sizePromise=null,this.onread=null}async getSizeOrNull(){var t;if(this._disposed)throw new V_;return null!==(t=this._sizePromise)&&void 0!==t?t:this._sizePromise=Promise.resolve(this._retrieveSize())}async getSize(){if(this._disposed)throw new V_;const t=await this.getSizeOrNull();if(null===t)throw new Error("Cannot determine the size of an unsized source.");return t}}class $_ extends U_{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&&(!Ww(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=Fw(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:bw(o),offset:t};this._currentIndex>r&&this._throwDueToCacheMiss();const{promise:s,resolve:a,reject:l}=Ow();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:bw(e.bytes),offset:e.start}),this._pendingSlices.splice(t,1),t--))}for(this._cache.push({start:i,end:r,bytes:n,view:bw(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!==(ye=Symbol.dispose)&&void 0!==ye||(Symbol.dispose=Symbol("Symbol.dispose"));class q_{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 z_))))throw new TypeError("options.formats must be an array of InputFormat.");if(!(t.source instanceof U_))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 G_(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(),mw(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 V_ extends Error{constructor(t="Input has been disposed."){super(t),this.name="InputDisposedError"}}class G_{constructor(t){this.source=t}requestSlice(t,e){if(this.source._disposed)throw new V_;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 H_(e.bytes,e.view,e.offset,t,n):null)):i?new H_(i.bytes,i.view,i.offset,t,n):null}requestSliceRange(t,e,n){if(this.source._disposed)throw new V_;if(t<0)return null;if(null!==this.fileSize)return this.requestSlice(t,Pw(this.fileSize-t,e,n));{const i=this.requestSlice(t,n),r=i=>{if(i)return i;const r=i=>(mw(null!==i),this.requestSlice(t,Pw(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 H_{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 H_(t,bw(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 H_(this.bytes,this.view,this.offset,t,t+e)}}const K_=(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.`)},X_=(t,e)=>{K_(t,e);const n=t.bytes.subarray(t.bufferPos,t.bufferPos+e);return t.bufferPos+=e,n},Y_=t=>(K_(t,1),t.view.getUint8(t.bufferPos++)),Q_=t=>{K_(t,2);const e=t.view.getUint16(t.bufferPos,!1);return t.bufferPos+=2,e},J_=t=>{K_(t,3);const e=Cw(t.view,t.bufferPos);return t.bufferPos+=3,e},Z_=t=>{K_(t,2);const e=t.view.getInt16(t.bufferPos,!1);return t.bufferPos+=2,e},tT=t=>{K_(t,4);const e=t.view.getUint32(t.bufferPos,!1);return t.bufferPos+=4,e},eT=t=>{K_(t,4);const e=t.view.getInt32(t.bufferPos,!1);return t.bufferPos+=4,e},nT=t=>4294967296*tT(t)+tT(t),iT=t=>4294967296*eT(t)+tT(t),rT=t=>{K_(t,8);const e=t.view.getFloat64(t.bufferPos,!1);return t.bufferPos+=8,e},oT=(t,e)=>{K_(t,e);let n="";for(let i=0;i<e;i++)n+=String.fromCharCode(t.bytes[t.bufferPos++]);return n};var sT=new WeakMap,aT=new WeakMap,lT=new WeakMap,cT=new WeakMap,uT=new WeakMap,dT=new WeakMap,hT=new WeakMap,fT=new WeakMap,pT=new WeakMap,mT=new WeakMap,vT=new WeakMap,gT=new WeakMap,yT=new WeakMap,bT=new WeakMap,kT=new WeakMap,xT=new WeakSet;class wT extends Du{constructor(...t){super(...t),U(this,xT),W(this,sT,null),W(this,aT,null),W(this,lT,null),W(this,cT,null),W(this,uT,!1),W(this,dT,!1),W(this,hT,!1),W(this,fT,!1),W(this,pT,void 0),W(this,mT,null),W(this,vT,null),W(this,gT,!1),W(this,yT,!1),W(this,bT,null),W(this,kT,!1)}get name(){return"FMP4Demuxer"}get defaults(){return{}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"pushChunk","endOfStream"])}pushChunk(t,e={}){if(z(hT,this)||z(fT,this))return;const n=t instanceof Uint8Array?t:new Uint8Array(t),i=!!e.isInit;j(mT,this,L(xT,this,AT).call(this,n,e,i)),i&&(j(pT,this,n),j(vT,this,null),this.trigger("demux:init",{data:n})),L(xT,this,ST).call(this);try{var r;const t=null===(r=z(sT,this))||void 0===r?void 0:r.write(n);t&&"function"==typeof t.catch&&t.catch((t=>{L(xT,this,NT).call(this,t)}))}catch(t){if(z(hT,this)||L(xT,this,_T).call(this,t))return;return this.log.warn("[FMP4Demuxer] mediabunny demux failed",t),void L(xT,this,NT).call(this,t)}const o=L(xT,this,OT).call(this);o&&"function"==typeof o.catch&&o.catch((t=>{L(xT,this,NT).call(this,t)}))}endOfStream(){if(z(fT,this))return;if(z(gT,this))return;let t;j(gT,this,!0),j(yT,this,!1),j(kT,this,!1);try{var e;t=null===(e=z(sT,this))||void 0===e?void 0:e.close()}catch(e){t=Promise.resolve()}let n=!1;L(xT,this,IT).call(this),j(bT,this,setTimeout((()=>{j(bT,this,null),n||z(yT,this)||z(fT,this)||L(xT,this,ET).call(this)}),20)),Promise.resolve(t).catch((()=>{})).finally((()=>{n=!0,L(xT,this,IT).call(this),L(xT,this,ET).call(this)}))}onDispose(){super.onDispose(),j(fT,this,!0);try{var t,e;null===(t=z(lT,this))||void 0===t||null===(e=t.close)||void 0===e||e.call(t)}catch(t){}this.endOfStream();try{var n,i;null===(n=z(aT,this))||void 0===n||null===(i=n.dispose)||void 0===i||i.call(n)}catch(t){}j(lT,this,null),j(aT,this,null),j(hT,this,!1),j(mT,this,null),j(cT,this,null),j(uT,this,!1),j(dT,this,!1),j(gT,this,!1),j(yT,this,!1),j(kT,this,!1),L(xT,this,IT).call(this)}}function _T(t){return!!z(fT,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 TT(){try{var t,e;const n=null===(t=z(sT,this))||void 0===t||null===(e=t.close)||void 0===e?void 0:e.call(t);n&&"function"==typeof n.catch&&n.catch((()=>{}))}catch(t){}j(sT,this,null)}function IT(){null!==z(bT,this)&&(clearTimeout(z(bT,this)),j(bT,this,null))}function ET(){if(z(yT,this)||z(fT,this)||z(hT,this))return;if(j(yT,this,!0),z(dT,this))return void j(kT,this,!0);j(kT,this,!1);const t=L(xT,this,OT).call(this);t&&"function"==typeof t.catch&&t.catch((t=>{L(xT,this,NT).call(this,t)}))}function ST(){if(z(aT,this)&&z(sT,this))return;const t=Bu.TransformStream;if(void 0===t)throw new Error("TransformStream is not available in this environment");const{readable:e,writable:n}=new t;j(sT,this,n.getWriter()),j(aT,this,new q_({source:new $_(e),formats:[j_]})),j(uT,this,!1)}function AT(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 NT(t){if(z(hT,this)||L(xT,this,_T).call(this,t))return;if(L(xT,this,FT).call(this,t))return void j(uT,this,!1);j(hT,this,!0),L(xT,this,TT).call(this);try{var e,n;null===(e=z(lT,this))||void 0===e||null===(n=e.close)||void 0===n||n.call(e)}catch(t){}j(lT,this,null);try{var i,r;null===(i=z(aT,this))||void 0===i||null===(r=i.dispose)||void 0===r||r.call(i)}catch(t){}j(aT,this,null);const o={error:t,recoverable:!1,severity:"fatal",streamClosed:z(gT,this),streamFinalized:z(yT,this)};z(mT,this)&&(o.context={...z(mT,this)}),this.trigger("demux:error",o)}function MT(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 FT(t){return!!L(xT,this,MT).call(this,t)&&(!z(yT,this)||z(kT,this))}async function OT(){if(!(z(fT,this)||z(hT,this)||z(uT,this)||z(dT,this))){j(dT,this,!0);try{L(xT,this,ST).call(this);const t=await z(aT,this).getPrimaryVideoTrack(),e=t?null:await z(aT,this).getPrimaryAudioTrack(),n=t||e;if(!n)throw new Error("No supported tracks found in MP4");const i=await n.getDecoderConfig(),r=await n.getCodecParameterString(),o=await z(aT,this).getMimeType();this.trigger("demux:init",{...z(pT,this)?{data:z(pT,this)}:{},decoderConfig:i,codec:r,mimeType:o}),j(lT,this,new y_(n)),j(uT,this,!0),j(cT,this,(async()=>{try{for await(const t of z(lT,this).packets()){if(z(fT,this))break;const e="number"==typeof t.timestamp?t.timestamp:0;null===z(vT,this)&&j(vT,this,e);let n=e-z(vT,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){L(xT,this,NT).call(this,t)}})())}catch(t){if(L(xT,this,FT).call(this,t))return;throw t}finally{j(dT,this,!1),!z(kT,this)||z(hT,this)||z(fT,this)||L(xT,this,ET).call(this)}}}const CT=1e6,PT=24e3/1001,DT={primaries:"bt709",transfer:"bt709",matrix:"bt709",fullRange:!0},RT=new Uint8Array;function LT(t){return t?t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):RT:RT}let BT=null;const zT={video:(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,Oe=new WeakMap,Ce=new WeakMap,Pe=new WeakMap,De=new WeakMap,Re=new WeakMap,Le=new WeakMap,Be=new WeakMap,ze=new WeakMap,We=new WeakMap,je=new WeakMap,Ue=new WeakMap,$e=new WeakMap,qe=new WeakMap,Ve=new WeakMap,Ge=new WeakMap,He=new WeakMap,Ke=new WeakMap,Xe=new WeakMap,Ye=new WeakMap,Qe=new WeakMap,Je=new WeakMap,Ze=new WeakSet,class extends pw{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),U(this,Ze),W(this,be,void 0),W(this,ke,[]),W(this,xe,void 0),W(this,we,void 0),W(this,_e,void 0),W(this,Te,void 0),W(this,Ie,[]),W(this,Ee,void 0),W(this,Se,new Map),W(this,Ae,!0),W(this,Ne,!1),W(this,Me,!1),W(this,Fe,!1),W(this,Oe,void 0),W(this,Ce,!1),W(this,Pe,!1),W(this,De,0),W(this,Re,void 0),W(this,Le,void 0),W(this,Be,{}),W(this,ze,void 0),W(this,We,0),W(this,je,null),W(this,Ue,!1),W(this,$e,null),W(this,qe,void 0),W(this,Ve,0),W(this,Ge,0),W(this,He,0),W(this,Ke,0),W(this,Xe,!1),W(this,Ye,!1),W(this,Qe,.2),W(this,Je,Promise.resolve()),j(xe,this,this.settings.decodedHorizonSeconds||1),j(we,this,L(Ze,this,MI).call(this,this.settings.maxDecodedFrames)),j(_e,this,L(Ze,this,OI).call(this,this.settings.maxDecodeQueueSize)),j(Xe,this,Sm()),j(Ye,this,L(Ze,this,wI).call(this,this.settings.convertFramesToBitmapsOnAndroid)),j(Qe,this,L(Ze,this,_I).call(this,this.settings.androidFixEndOfSegmentDelta)),j(Te,this,(()=>0)),j(Ee,this,(()=>L(Ze,this,hI).call(this)));const e=this.settings.demuxerOptions?{FMP4Demuxer:this.settings.demuxerOptions}:{};j(be,this,new wT(e)),z(be,this).on("demux:init",(t=>L(Ze,this,nI).call(this,t))),z(be,this).on("demux:sample",(t=>L(Ze,this,iI).call(this,t))),z(be,this).on("demux:complete",(()=>L(Ze,this,rI).call(this))),z(be,this).on("demux:error",(t=>L(Ze,this,VT).call(this,t)))}setCurrentTimeProvider(t){"function"==typeof t&&j(Te,this,t)}setTimeOffsetSeconds(t){const e=Number(t);j(We,this,Number.isFinite(e)?e:0)}setSeekTargetTimeSeconds(t){const e=Number(t);j(je,this,Number.isFinite(e)?e:null),j(Ue,this,!1),j($e,this,null)}endOfStream(){z(be,this)&&"function"==typeof z(be,this).endOfStream&&z(be,this).endOfStream()}configure(t){super.configure(t),j(Be,this,{codec:L(Ze,this,LI).call(this,t),width:(null==t?void 0:t.codedWidth)||(null==t?void 0:t.width),height:(null==t?void 0:t.codedHeight)||(null==t?void 0:t.height)}),j(Re,this,z(Be,this).codec)}setSegment(t){this.lastSegment=t,L(Ze,this,JT).call(this)}setNodeId(t){j(qe,this,t)}decode(t){this.setSegment(t);const e=null==t?void 0:t.arrayBuffer;e&&z(be,this).pushChunk(e,{isInit:!(null==t||!t.isInit)})}async decodeChunk(t,e={}){await z(be,this).pushChunk(t,{isInit:!!e.isInit,pts:"number"==typeof e.pts?e.pts:void 0,dts:"number"==typeof e.dts?e.dts:void 0,duration:"number"==typeof e.duration?e.duration:void 0,isKey:!!e.isKey,loaded:"number"==typeof e.loaded?e.loaded:void 0,total:"number"==typeof e.total?e.total:void 0})}get decodedFrames(){return z(ke,this).slice()}onDispose(){if(super.onDispose(),L(Ze,this,mI).call(this),z(be,this)&&"function"==typeof z(be,this).dispose&&z(be,this).dispose(),j(ke,this,[]),j(Ie,this,[]),z(Se,this).clear(),j($e,this,null),z(Oe,this)&&"function"==typeof z(Oe,this).close)try{z(Oe,this).close()}catch(t){}j(Oe,this,null),j(Ce,this,!1),j(Le,this,null),j(Re,this,null),j(qe,this,null),j(Je,this,Promise.resolve()),L(Ze,this,JT).call(this)}}),audio:(tn=new WeakMap,en=new WeakMap,nn=new WeakMap,rn=new WeakMap,on=new WeakMap,sn=new WeakMap,an=new WeakMap,ln=new WeakSet,class extends pw{constructor(...t){super(...t),U(this,ln),W(this,tn,void 0),W(this,en,[]),W(this,nn,0),W(this,rn,!1),W(this,on,!1),W(this,sn,void 0),W(this,an,0)}get name(){return"WebAudioDecoder"}setSegment(t){j(sn,this,t)}setTimeOffsetSeconds(t){const e=Number(t);j(an,this,Number.isFinite(e)?e:0)}decode(t){if(this.lastSegment=t,!t)return;if(t.isInit)return void j(tn,this,LT(t.arrayBuffer));const e=t.arrayBuffer;e&&L(ln,this,UT).call(this,LT(e),!0)}decodeChunk(t,e={}){if(!t)return;if(e.isInit)return void j(tn,this,LT(t));const n=LT(t);if(!n.length)return;z(en,this).push(n),j(nn,this,z(nn,this)+n.length);const i=Number(e.loaded),r=Number(e.total);Number.isFinite(i)&&Number.isFinite(r)&&r>0&&i>=r&&L(ln,this,WT).call(this)}endOfStream(){L(ln,this,WT).call(this)}onDispose(){super.onDispose(),j(tn,this,void 0),j(en,this,[]),j(nn,this,0),j(rn,this,!1),j(on,this,!1),j(sn,this,void 0)}}),image:class extends pw{#z;#W=0;#j=[];#U=0;#$;get name(){return"ImageDecoder"}setSegment(t){this.#z=t}setTimeOffsetSeconds(t){const e=Number(t);this.#W=Number.isFinite(e)?e:0}decode(t){super.decode(t),t&&(this.#z=t);const e=null==t?void 0:t.arrayBuffer;e instanceof ArrayBuffer&&(this.#j=[new Uint8Array(e)],this.#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.#j.push(n),this.#U+=n.length)}async endOfStream(){var t,e,n;if(this.#$)return;if(!(this.#j.length&&this.#U>0))return;const i=new Uint8Array(this.#U);let r=0;for(let t=0;t<this.#j.length;t+=1){const e=this.#j[t];i.set(e,r),r+=e.length}const o=null===(t=this.#z)||void 0===t?void 0:t.chosenRepresentation,s=(null==o?void 0:o.mime)||(null===(e=this.track)||void 0===e?void 0:e.mimeType)||(null===(n=this.track)||void 0===n?void 0:n.mime)||function(t){if(t instanceof Uint8Array&&!(t.byteLength<4))return t.byteLength>=8&&137===t[0]&&80===t[1]&&78===t[2]&&71===t[3]&&13===t[4]&&10===t[5]&&26===t[6]&&10===t[7]?"image/png":255===t[0]&&216===t[1]&&255===t[2]?"image/jpeg":t.byteLength>=6&&71===t[0]&&73===t[1]&&70===t[2]&&56===t[3]?"image/gif":t.byteLength>=12&&82===t[0]&&73===t[1]&&70===t[2]&&70===t[3]&&87===t[8]&&69===t[9]&&66===t[10]&&80===t[11]?"image/webp":void 0}(i);try{var a,l;const t=await async function(t,e){const n=function(t,e){if(!(t&&t.byteLength>0))return;if("function"!=typeof Bu.Blob)return;const n="string"==typeof e?e:"";return new Bu.Blob([t],n?{type:n}:void 0)}(t,e);if(!n)throw new Error("Image decode requires Blob support");let i;if("function"==typeof Bu.Image&&Bu.URL&&"function"==typeof Bu.URL.createObjectURL&&"function"==typeof Bu.URL.revokeObjectURL){const t=Bu.URL.createObjectURL(n);try{const e=new Bu.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{Bu.URL.revokeObjectURL(t)}}if("function"==typeof Bu.createImageBitmap)try{return Bu.createImageBitmap(n)}catch(t){i=t}if(i)throw i;throw new Error("No supported image decode mechanism")}(i,s);this.#$=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&&(dg(o.width)||(o.width=e.width),dg(o.height)||(o.height=e.height)),this.trigger("decoder:frame",{pts:this.#W,duration:dg(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.#$&&"function"==typeof this.#$.close)try{this.#$.close()}catch(t){}this.#$=null,this.#j=[],this.#U=0,this.#z=null}}};function WT(){if(z(rn,this)||z(on,this))return;if(!z(nn,this))return;const t=L(ln,this,jT).call(this);t.length&&L(ln,this,UT).call(this,t,!1)}function jT(){const t=z(tn,this),e=t?t.length:0,n=e+z(nn,this);if(!n)return RT;const i=new Uint8Array(n);let r=0;e&&(i.set(t,r),r+=e);for(let t=0;t<z(en,this).length;t+=1){const e=z(en,this)[t];e&&e.length&&(i.set(e,r),r+=e.length)}return i}function UT(t,e){if(z(rn,this)||z(on,this))return;const n=e?L(ln,this,$T).call(this,t):t;if(!n||!n.length)return;const i=function(){if(BT)return BT;const t=Bu.AudioContext||Bu.webkitAudioContext;return t?(BT=new t,BT):null}();if(!i||"function"!=typeof i.decodeAudioData)return void this.trigger("decoder:error",{error:new Error("AudioContext is not available")});const r=n.buffer.slice(0);j(on,this,!0),new Promise(((t,e)=>{const n=i.decodeAudioData(r,t,e);n&&"function"==typeof n.then&&n.then(t).catch(e)})).then((t=>{var e;j(rn,this,!0);const n=Number.isFinite(null==t?void 0:t.duration)?t.duration:Number(null===(e=z(sn,this))||void 0===e?void 0:e.duration)||void 0;this.trigger("decoder:audio",{audioBuffer:t,pts:z(an,this),duration:n})})).catch((t=>{this.trigger("decoder:error",{error:t})})).finally((()=>{j(en,this,[]),j(nn,this,0),j(on,this,!1)}))}function $T(t){const e=z(tn,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 qT(t,e){var n,i,r,o,s;const a=null!=t&&t.context&&"object"==typeof t.context?t.context:void 0;return{error:e,errorName:null==e?void 0:e.name,errorMessage:"string"==typeof(null==e?void 0:e.message)?e.message:void 0,nodeId:z(qe,this),trackId:null===(n=this.track)||void 0===n?void 0:n.id,trackType:null===(i=this.track)||void 0===i?void 0:i.type,codec:(null===(r=z(Be,this))||void 0===r?void 0:r.codec)||z(Re,this),segmentId:null===(o=this.lastSegment)||void 0===o?void 0:o.id,segmentIsInit:!(null===(s=this.lastSegment)||void 0===s||!s.isInit),chunkContext:a}}function VT(t){const e=(null==t?void 0:t.error)||t,n=L(Ze,this,qT).call(this,t,e);if(L(Ze,this,GT).call(this,t,e))return this.log.warn("[onDemuxError] recoverable demux error",n),void L(Ze,this,rI).call(this);const i=L(Ze,this,eI).call(this,t),r=L(Ze,this,HT).call(this,i);if(i&&0===i.missingFrames)return this.log.warn(`[onDemuxError] ignoring demux error (no missing frames)${r}`,{...n,missingFrameStats:i}),void L(Ze,this,rI).call(this);let o=n;i&&(o={...n,missingFrameStats:i}),this.log.warn(`[onDemuxError] demux error${r}`,o),this.trigger("decoder:error",t)}function GT(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 HT(t){return t?` expectedFrames=${L(Ze,this,KT).call(this,t.expectedFrames)} demuxedFrames=${L(Ze,this,KT).call(this,t.demuxedFrames)} missingFrames=${L(Ze,this,KT).call(this,t.missingFrames)}`:""}function KT(t){if(null==t)return"unknown";const e=Number(t);return Number.isFinite(e)?String(e):"unknown"}function XT(t,e={}){return{expectedFrames:null,demuxedFrames:z(Ve,this),missingFrames:null,reason:t,...e}}function YT(t){const e=Number(t);return Number.isFinite(e)?e:null}function QT(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 L(Ze,this,XT).call(this,"segment_duration_unavailable",{segmentDurationSeconds:L(Ze,this,YT).call(this,s),demuxedCoverageSeconds:z(Ke,this),frameDurationSeconds:null});const a=L(Ze,this,tI).call(this);if(!Number.isFinite(a)||a<=0){const t=Math.max(1,Math.round(s*PT));return{expectedFrames:t,demuxedFrames:z(Ve,this),missingFrames:Math.max(0,t-z(Ve,this)),reason:"fallback_fps",fallbackFps:PT,segmentDurationSeconds:s,demuxedCoverageSeconds:z(Ke,this),frameDurationSeconds:L(Ze,this,YT).call(this,a)}}const l=Math.min(.5*a,.02),c=Math.max(0,s-z(Ke,this)),u=c<=l?0:c,d=Math.max(1,Math.floor((s+l)/a)),h=Math.max(0,d-z(Ve,this)),f=u>0?Math.ceil(u/a):0;return{expectedFrames:d,demuxedFrames:z(Ve,this),missingFrames:Math.max(h,f),segmentDurationSeconds:s,demuxedCoverageSeconds:z(Ke,this),frameDurationSeconds:a}}function JT(){j(Ve,this,0),j(Ge,this,0),j(He,this,0),j(Ke,this,0)}function ZT(t){j(Ve,this,z(Ve,this)+1);const e=Number(null==t?void 0:t.pts),n=Number(null==t?void 0:t.duration);if(Number.isFinite(n)&&n>0&&(j(Ge,this,z(Ge,this)+n),j(He,this,z(He,this)+1)),!Number.isFinite(e))return;const i=Number.isFinite(n)&&n>0?e+n:e;Number.isFinite(i)&&i>z(Ke,this)&&j(Ke,this,i)}function tI(){return z(He,this)>0?z(Ge,this)/z(He,this):z(Ve,this)>0&&z(Ke,this)>0?z(Ke,this)/z(Ve,this):null}function eI(t){return L(Ze,this,QT).call(this,t)}function nI(t){(null==t?void 0:t.data)instanceof Uint8Array&&(j(Le,this,t.data.buffer),L(Ze,this,gI).call(this)),null!=t&&t.decoderConfig&&(j(ze,this,t.decoderConfig),j(Re,this,t.decoderConfig.codec||z(Re,this)),L(Ze,this,gI).call(this)),this.trigger("decoder:init",t)}function iI(t){L(Ze,this,ZT).call(this,t),z(Ie,this).push(t),L(Ze,this,hI).call(this)}function rI(){j(Ne,this,!0),L(Ze,this,bI).call(this)}function oI(t){const e="number"==typeof(null==t?void 0:t.pts)?t.pts:void 0;if(Number.isFinite(e))return z(We,this)+e}function sI(t){return z(Ie,this).some((e=>{const n=L(Ze,this,oI).call(this,e);return Number.isFinite(n)&&n>=t}))}function aI(t){let e=-1,n=null;for(let i=0;i<z(Ie,this).length;i+=1){const r=z(Ie,this)[i],o=L(Ze,this,oI).call(this,r);Number.isFinite(o)&&(null==r?void 0:r.isKey)&&o<=t&&(e=i,n=o)}return{chosenIndex:e,chosenPtsSeconds:n}}function lI(t){let e=-1,n=null;for(let i=0;i<z(Ie,this).length;i+=1){const r=z(Ie,this)[i],o=L(Ze,this,oI).call(this,r);if(Number.isFinite(o)&&null!=r&&r.isKey&&(e=i,n=o,o>=t))break}return{chosenIndex:e,chosenPtsSeconds:n}}function cI(t){const e=t+z(xe,this),n=z(je,this);if(!Number.isFinite(n))return e;const i=Number.isFinite(z($e,this))?z($e,this):null;if(Number.isFinite(i))return Math.max(e,i);const{chosenPtsSeconds:r}=L(Ze,this,lI).call(this,n);return Number.isFinite(r)?Math.max(e,r):e}function uI(t){const e=z(je,this);Number.isFinite(e)&&Number.isFinite(t)&&t>=e&&(j(je,this,null),j($e,this,null))}function dI(){const t=z(je,this);if(!Number.isFinite(t)||z(Ue,this))return!0;if(!L(Ze,this,sI).call(this,t)&&!z(Ne,this))return!1;const e=L(Ze,this,aI).call(this,t);let n=e;if(-1===e.chosenIndex&&(n=L(Ze,this,lI).call(this,t)),n.chosenIndex>0){const t=`[#maybeAlignToSeekKeyframe] Dropping ${n.chosenIndex} samples before keyframe @ ${n.chosenPtsSeconds}`;this.log.debug(t),z(Ie,this).splice(0,n.chosenIndex)}return j(Ae,this,!0),Number.isFinite(n.chosenPtsSeconds)&&j($e,this,n.chosenPtsSeconds),j(Ue,this,!0),!0}function hI(){const t=z(Te,this)?z(Te,this).call(this):0,e=L(Ze,this,cI).call(this,t);if(L(Ze,this,AI).call(this,t),L(Ze,this,NI).call(this),!L(Ze,this,dI).call(this))return void L(Ze,this,pI).call(this);const n=void 0!==Bu.VideoDecoder&&void 0!==Bu.EncodedVideoChunk;for(n&&!z(Ce,this)&&z(ze,this)&&L(Ze,this,gI).call(this);z(Ie,this).length&&!L(Ze,this,FI).call(this)&&!(n&&z(Oe,this)&&L(Ze,this,CI).call(this));){const t=z(Ie,this)[0],i="number"==typeof(null==t?void 0:t.pts)?t.pts:0,r=z(We,this)+i;if(r>e)break;if(null!=t&&t.raw)z(Ie,this).shift(),L(Ze,this,fI).call(this,t);else{if(n){if(!z(Ce,this)||!z(Oe,this))break;if(z(Ae,this)&&!t.isKey){z(Ie,this).shift();continue}z(Ie,this).shift();const e=Math.max(0,Math.round(r*CT));z(Se,this).set(e,!!t.isKey);try{const n=new Bu.EncodedVideoChunk({type:t.isKey?"key":"delta",timestamp:e,duration:t.duration?Math.round(t.duration*CT):void 0,data:t.data instanceof Uint8Array?t.data:new Uint8Array(t.data)});z(Oe,this).decode(n),t.isKey&&j(Ae,this,!1);continue}catch(t){z(Se,this).delete(e);const n="string"==typeof(null==t?void 0:t.message)?t.message:"";if("DataError"===(null==t?void 0:t.name)&&n.includes("key frame")){j(Ae,this,!0);continue}this.log.warn("[#drainDecodeQueue] decode failed, falling back to placeholder",t)}}z(Ie,this).shift(),L(Ze,this,fI).call(this,t)}}L(Ze,this,bI).call(this),L(Ze,this,pI).call(this)}function fI(t){const e=z(Te,this)?z(Te,this).call(this):0,n=L(Ze,this,cI).call(this,e),i=z(We,this)+("number"==typeof t.pts?t.pts:0);if(i<e||i>n)return;L(Ze,this,AI).call(this,e);const r={pts:i,duration:t.duration,data:t.data,isKey:t.isKey};z(ke,this).push(r),L(Ze,this,NI).call(this),this.trigger("decoder:frame",r),L(Ze,this,uI).call(this,i)}function pI(){if(z(Ie,this).length>0&&void 0!==Bu.VideoDecoder){if(wk(z(Ee,this)))return;kk(z(Ee,this),50)}else L(Ze,this,mI).call(this)}function mI(){z(Ee,this)&&wk(z(Ee,this))&&xk(z(Ee,this))}function vI(){return null!=Bu&&Bu.performance&&"function"==typeof Bu.performance.now?Bu.performance.now():Date.now()}function gI(){if(z(Ce,this))return;if(void 0===Bu.VideoDecoder)return;if(!z(ze,this))return;if(z(Pe,this)&&L(Ze,this,vI).call(this)<z(De,this))return;const t=L(Ze,this,yI).call(this);try{j(Oe,this,new Bu.VideoDecoder({output:t=>L(Ze,this,xI).call(this,t),error:t=>L(Ze,this,kI).call(this,t)})),z(Oe,this).configure(t),j(Ce,this,!0),j(Ae,this,!0),j(Pe,this,!1),j(De,this,0),L(Ze,this,hI).call(this)}catch(t){this.log.warn("[#maybeConfigureDecoder] configure failed, falling back to placeholder decode",t),j(Oe,this,null),j(Ce,this,!1),j(ze,this,null)}}function yI(){const t={...z(ze,this)};return L(Ze,this,DI).call(this,t)&&z(Be,this).codec?t.codec=z(Be,this).codec:!t.codec&&z(Re,this)&&(t.codec=z(Re,this)),z(Le,this)&&!t.description&&(t.description=z(Le,this)),z(Be,this).width&&!t.codedWidth&&(t.codedWidth=z(Be,this).width),z(Be,this).height&&!t.codedHeight&&(t.codedHeight=z(Be,this).height),L(Ze,this,RI).call(this,t),t}function bI(){void 0!==Bu.VideoDecoder&&void 0!==Bu.EncodedVideoChunk&&(z(Pe,this)||!z(Ne,this)||z(Fe,this)||z(Me,this)||z(Ce,this)&&z(Oe,this)&&"function"==typeof z(Oe,this).flush&&(z(Ie,this).length||(j(Me,this,!0),Promise.resolve().then((()=>z(Oe,this).flush())).then((()=>{j(Fe,this,!0),j(Ae,this,!0)})).catch((t=>{"AbortError"!==(null==t?void 0:t.name)&&this.log.warn("[#maybeFlushDecoder] flush failed",t)})).finally((()=>{j(Me,this,!1)})))))}function kI(t){if(this.log.warn("[#handleDecoderError] decoder error",t),this.trigger("decoder:error",{error:t}),z(Oe,this)&&"function"==typeof z(Oe,this).close)try{z(Oe,this).close()}catch(t){}j(Oe,this,null),j(Ce,this,!1),j(Me,this,!1),j(Fe,this,!1),j(Ae,this,!0),z(Se,this).clear(),j(Pe,this,!0),j(De,this,L(Ze,this,vI).call(this)+1e3)}function xI(t){j(Je,this,z(Je,this).then((()=>{var e;if(!this._disposed)return L(Ze,this,SI).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 wI(t){return"boolean"!=typeof t||t}function _I(t){const e=Number(t);return!Number.isFinite(e)||e<0?.2:e}function TI(){return!!z(Ye,this)&&"function"==typeof Bu.createImageBitmap&&z(Xe,this)}function II(t){var e;const n=Number(null===(e=this.lastSegment)||void 0===e?void 0:e.duration);if(!Number.isFinite(n)||n<=0)return!1;if(!Number.isFinite(t))return!1;const i=Number(z(We,this));return!!Number.isFinite(i)&&t>=i+n-z(Qe,this)}async function EI(t,e){try{var n;const i=L(Ze,this,II).call(this,e),r=await Bu.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 SI(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/CT:z(Te,this)?z(Te,this).call(this):0,s="number"==typeof t.duration?t.duration/CT:void 0;let a;void 0!==r&&(a=z(Se,this).get(r),z(Se,this).delete(r));try{var l,c,u,d;let e=z(Te,this)?z(Te,this).call(this):0,n=L(Ze,this,cI).call(this,e);if(o<e||o>n)return void(null===(l=(c=i).close)||void 0===l||l.call(c));if(L(Ze,this,TI).call(this)){var h,f,p,m;if(i=await L(Ze,this,EI).call(this,t,o),this._disposed)return void(null===(h=(f=i).close)||void 0===h||h.call(f));if(e=z(Te,this)?z(Te,this).call(this):0,n=L(Ze,this,cI).call(this,e),o<e||o>n)return void(null===(p=(m=i).close)||void 0===p||p.call(m))}if(L(Ze,this,AI).call(this,e),this._disposed)return void(null===(u=(d=i).close)||void 0===u||u.call(d));const r={frame:i,pts:o,duration:s,isKey:void 0!==a&&a};z(ke,this).push(r),L(Ze,this,NI).call(this),this.trigger("decoder:frame",r),L(Ze,this,uI).call(this,o),this.log.debug(`[#handleDecodedFrame] [${z(Be,this).codec}] Decoded frame:`,r)}catch(t){this.log.warn(`[#handleDecodedFrame] [${z(Be,this).codec}] Failed to handle decoded frame`,t);try{var v,g;null===(v=(g=i).close)||void 0===v||v.call(g)}catch(t){}}}function AI(t){const e=L(Ze,this,cI).call(this,t),n=[];z(ke,this).forEach((i=>{var r;const o=null!==(r=null==i?void 0:i.pts)&&void 0!==r?r:0;o<t||o>e||n.push(i)})),j(ke,this,n)}function NI(){const t=z(we,this);if(!Number.isFinite(t)||t<=0)return;if(z(ke,this).length<=t)return;const e=z(ke,this).length-t;z(ke,this).splice(0,e)}function MI(t){const e=Number(t);return!Number.isFinite(e)||e<=0?0:Math.floor(e)}function FI(){const t=z(we,this);return!(!Number.isFinite(t)||t<=0)&&z(ke,this).length>=t}function OI(t){const e=Number(t);return!Number.isFinite(e)||e<=0?0:Math.floor(e)}function CI(){var t;const e=z(_e,this);if(!Number.isFinite(e)||e<=0)return!1;const n=Number(null===(t=z(Oe,this))||void 0===t?void 0:t.decodeQueueSize);return!!Number.isFinite(n)&&n>=e}function PI(t){return"string"==typeof t&&t.toLowerCase().startsWith("av01")}function DI(t){var e;return!1!==this.settings.av1ColorSpaceOverrideEnabled&&L(Ze,this,PI).call(this,(null===(e=z(Be,this))||void 0===e?void 0:e.codec)||(null==t?void 0:t.codec))}function RI(t){L(Ze,this,DI).call(this,t)&&(t.colorSpace={...DT})}function LI(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 BI extends Du{#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 pw(e);const n=zT[t.type];return n?(this.log.debug(`[#create] [${t.type}] Creating decoder:`,n),new n(e)):new pw(e)}}class zI{#V;#G;#H;#K;constructor(t={}){this.#V=t.getActiveRenderPlacement,this.#G=t.getPlacementsActiveAtTime,this.#H=t.ensureDecodedForPlacementAtTime;const e=Number(t.lookaheadSeconds);this.#K=Number.isFinite(e)&&e>=0?e:1}handleTimeUpdate(t={}){const e=Number(null==t?void 0:t.time);if(!Number.isFinite(e))return;if("function"!=typeof this.#H)return;const n="function"==typeof this.#G?this.#G:()=>[],i=n(e),r=new Set;i.forEach((t=>{null!=t&&t.placementId&&r.add(t.placementId),this.#H(t,e)}));const o=this.#K;if(!(o>0))return;const s=e+o;n(s).forEach((t=>{const e=null==t?void 0:t.placementId;e&&!r.has(e)&&this.#H(t,s)}))}dispose(){}}class WI{#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 jI=new Set(["video","audio","image"]);function UI(t){const e=Number(t);return Number.isFinite(e)?e:0}var $I=new WeakMap,qI=new WeakMap,VI=new WeakMap,GI=new WeakMap,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 WeakSet;class cE extends Du{constructor(...t){super(...t),U(this,lE),W(this,$I,void 0),W(this,qI,void 0),W(this,VI,void 0),W(this,GI,void 0),W(this,HI,void 0),W(this,KI,void 0),W(this,XI,void 0),W(this,YI,void 0),W(this,QI,void 0),W(this,JI,void 0),W(this,ZI,void 0),W(this,tE,new Map),W(this,eE,new Map),W(this,nE,new Map),W(this,iE,new Map),W(this,rE,new Set),W(this,oE,0),W(this,sE,!1),W(this,aE,null);const[e,n,i]=t;j($I,this,e),j(qI,this,n),j(VI,this,i||new BI),j(GI,this,new WI({getNode:t=>L(lE,this,PE).call(this,t),getPlacementState:t=>z(tE,this).get(t),getDecodeTracks:t=>L(lE,this,NE).call(this,t),getSegmentIdForTrackAtTime:(t,e,n)=>L(lE,this,gE).call(this,t,e,n),decodeLoadedMediaSegment:(t,e,n)=>{L(lE,this,tS).call(this,t,e,n)},decodeLoadedMediaSegmentsAfter:(t,e,n)=>{L(lE,this,GE).call(this,t,e,n)}})),j(HI,this,new zI({getActiveRenderPlacement:t=>{var e,n;return null===(e=z(qI,this))||void 0===e||null===(n=e.getActiveRenderPlacement)||void 0===n?void 0:n.call(e,t)},getPlacementsActiveAtTime:t=>{var e,n;return(null===(e=z(qI,this))||void 0===e||null===(n=e.getPlacementsActiveAtTime)||void 0===n?void 0:n.call(e,t))||[]},ensureDecodedForPlacementAtTime:(t,e)=>{var n,i;null===(n=z(GI,this))||void 0===n||null===(i=n.ensureDecodedForPlacementAtTime)||void 0===i||i.call(n,t,e)}})),L(lE,this,uE).call(this),L(lE,this,EE).call(this)}get name(){return"DecodeCoordinator"}onDispose(){var t,e;z(qI,this)&&"function"==typeof z(qI,this).off&&z(KI,this)&&z(qI,this).off(Dm.PLACEMENT_ADDED,z(KI,this)),z(qI,this)&&"function"==typeof z(qI,this).off&&z(XI,this)&&z(qI,this).off(Dm.TIMELINE_SEEKING,z(XI,this)),z(qI,this)&&"function"==typeof z(qI,this).off&&z(YI,this)&&z(qI,this).off(Dm.TIMELINE_SEEKED,z(YI,this)),z(qI,this)&&"function"==typeof z(qI,this).off&&z(QI,this)&&z(qI,this).off(Dm.TIMELINE_TIME_UPDATE,z(QI,this)),z(qI,this)&&"function"==typeof z(qI,this).off&&z(JI,this)&&z(qI,this).off(Dm.TIMELINE_RESET,z(JI,this)),L(lE,this,dE).call(this),j(KI,this,null),j(XI,this,null),j(YI,this,null),j(QI,this,null),j(JI,this,null),null!==(t=z(GI,this))&&void 0!==t&&null!==(e=t.dispose)&&void 0!==e&&e.call(t),j(GI,this,null),z(HI,this)&&"function"==typeof z(HI,this).dispose&&z(HI,this).dispose(),j(HI,this,null),z(eE,this).forEach(((t,e)=>{const n=L(lE,this,PE).call(this,e);n&&"function"==typeof n.off&&n.off("node:loaded",t)})),z(eE,this).clear(),z(nE,this).forEach(((t,e)=>{const n=L(lE,this,PE).call(this,e);n&&"function"==typeof n.off&&n.off("segment:chunk",t)})),z(nE,this).clear(),z(iE,this).clear(),z(rE,this).clear(),L(lE,this,wE).call(this),z(tE,this).forEach((({trackStates:t})=>{t&&t.forEach((t=>{L(lE,this,BE).call(this,t)}))})),z(tE,this).clear()}}function uE(){z(qI,this)&&"function"==typeof z(qI,this).on&&(j(KI,this,(t=>{L(lE,this,SE).call(this,t)})),z(qI,this).on(Dm.PLACEMENT_ADDED,z(KI,this)),j(XI,this,(t=>L(lE,this,hE).call(this,t))),z(qI,this).on(Dm.TIMELINE_SEEKING,z(XI,this)),j(YI,this,(()=>L(lE,this,fE).call(this))),z(qI,this).on(Dm.TIMELINE_SEEKED,z(YI,this)),j(QI,this,(t=>L(lE,this,pE).call(this,t))),z(qI,this).on(Dm.TIMELINE_TIME_UPDATE,z(QI,this)),j(JI,this,(()=>L(lE,this,mE).call(this))),z(qI,this).on(Dm.TIMELINE_RESET,z(JI,this))),(null==Bu?void 0:Bu.document)&&"function"==typeof Bu.document.addEventListener&&(j(ZI,this,(()=>{L(lE,this,_E).call(this)})),Bu.document.addEventListener("visibilitychange",z(ZI,this)))}function dE(){z(ZI,this)&&null!=Bu&&Bu.document&&"function"==typeof Bu.document.removeEventListener&&Bu.document.removeEventListener("visibilitychange",z(ZI,this)),j(ZI,this,null)}function hE(t={}){const e=Number(null==t?void 0:t.targetTime);Number.isFinite(e)&&(z(tE,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||(L(lE,this,vE).call(this,n,null==t?void 0:t.placement,e),n.seekSegmentId=null)}))})),(Array.isArray(null==t?void 0:t.placements)?t.placements:[]).forEach((t=>{const n=null==t?void 0:t.placementId,i=null==t?void 0:t.nodeId;if(!n||!i)return;const r=z(tE,this).get(n);if(!r||!r.trackStates)return;const o=L(lE,this,PE).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||L(lE,this,vE).call(this,n,r.placement||t,e)})),L(lE,this,VE).call(this,r.placement||t,o))})))}function fE(){z(tE,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 pE(t={}){var e,n;L(lE,this,qE).call(this,null==t?void 0:t.time),null!==(e=z(HI,this))&&void 0!==e&&null!==(n=e.handleTimeUpdate)&&void 0!==n&&n.call(e,t),L(lE,this,_E).call(this),L(lE,this,zE).call(this,null==t?void 0:t.time)}function mE(){z(eE,this).forEach(((t,e)=>{const n=L(lE,this,PE).call(this,e);n&&"function"==typeof n.off&&n.off("node:loaded",t)})),z(eE,this).clear(),z(nE,this).forEach(((t,e)=>{const n=L(lE,this,PE).call(this,e);n&&"function"==typeof n.off&&n.off("segment:chunk",t)})),z(nE,this).clear(),z(iE,this).clear(),z(rE,this).clear(),z(tE,this).forEach((({trackStates:t})=>{t&&t.forEach((t=>{const e=null==t?void 0:t.segmentDecoders;e&&e.forEach((t=>{t&&"function"==typeof t.dispose&&t.dispose()}))}))})),z(tE,this).clear()}function vE(t,e,n){t&&(L(lE,this,BE).call(this,t),t.seekSegmentId=L(lE,this,gE).call(this,t.track,e,n))}function gE(t,e,n){if(!t||!e||!Array.isArray(t.segments))return null;const i=Bp(e);if(!Number.isFinite(i))return null;const r=UI(null==e?void 0:e.nodeOffsetOverride),o=Math.max(0,n-i+r),s=UI(null==t?void 0:t.offset),a=Math.max(0,o-s),l="function"==typeof t.getMediaSegmentAtTime?t.getMediaSegmentAtTime(a,{preferRepresentationTime:!0}):xy(t.segments,a,{preferRepresentationTime:!0});return(null==l?void 0:l.id)||null}function yE(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 bE(){const t=null==Bu?void 0:Bu.document;return!t||"string"!=typeof t.visibilityState||"visible"===t.visibilityState}function kE(){var t;const e=z(qI,this);if(!e||"number"!=typeof e.currentTime)return!1;if(e.state===qm)return!1;const n=Date.now();if(n<z(oE,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=L(lE,this,xE).call(this,i),!Number.isFinite(a))return!1;return j(oE,this,n+1500),this.log.warn("[DecodeCoordinator] attempting decoder recovery seek"),e.currentTime=a,!0}function xE(t){var e;const n=z(qI,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=Bp(t);if(!Number.isFinite(e))return;(!Number.isFinite(d)||e<d)&&(d=e);const n=Rp(t,z($I,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 wE(){j(sE,this,!1),j(aE,this,null)}function _E(){z(sE,this)&&L(lE,this,bE).call(this)&&L(lE,this,kE).call(this)}function TE(t){if(!L(lE,this,yE).call(this,t))return;const e=z(qI,this);e&&"number"==typeof e.currentTime&&(j(sE,this,!0),j(aE,this,t),L(lE,this,bE).call(this)&&L(lE,this,kE).call(this))}function IE(t){var e;return!!t&&(Array.isArray(null===(e=z(qI,this))||void 0===e?void 0:e.placements)?z(qI,this).placements:[]).includes(t)}function EE(t){var e;(Array.isArray(null===(e=z(qI,this))||void 0===e?void 0:e.placements)?[...z(qI,this).placements]:[]).filter((e=>"function"!=typeof t||t(e))).sort(((t,e)=>{const n=Bp(t),i=Bp(e);return(Number.isFinite(n)?n:Number.POSITIVE_INFINITY)-(Number.isFinite(i)?i:Number.POSITIVE_INFINITY)})).forEach((t=>{L(lE,this,SE).call(this,t)}))}async function SE(t){if(!t||!t.placementId||z(tE,this).has(t.placementId))return;if(!L(lE,this,IE).call(this,t))return;const e=t.nodeId;if(!e||!z($I,this)||"function"!=typeof z($I,this).get)return;const n=L(lE,this,PE).call(this,e);if(n){if(n.state&&"ready"!==n.state){if("function"==typeof n.resolve)try{await n.resolve()}catch(n){if(!L(lE,this,IE).call(this,t))return;return void this.log.warn(`[#processPlacement] Failed to resolve node ${e}`,n)}if(!L(lE,this,IE).call(this,t))return;if("ready"!==n.state)return}if(L(lE,this,$E).call(this,t))return L(lE,this,UE).call(this,t,n),void z(rE,this).add(t.placementId);L(lE,this,jE).call(this,t,n)}}function AE(t){return L(lE,this,NE).call(this,t).every((t=>L(lE,this,WE).call(this,t)))}function NE(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).filter((t=>jI.has(null==t?void 0:t.type)))}function ME(t){if(!t||!t.id||"function"!=typeof t.on)return;if(z(eE,this).has(t.id))return;const e=()=>{L(lE,this,HE).call(this,t.id)};t.on("node:loaded",e),z(eE,this).set(t.id,e)}function FE(t){if(!t||!t.id||"function"!=typeof t.on)return;if(z(nE,this).has(t.id))return;const e=t=>L(lE,this,KE).call(this,t);t.on("segment:chunk",e),z(nE,this).set(t.id,e)}function OE(t,e){if(!t||!e)return;const n=z(iE,this).get(t)||new Set;n.add(e),z(iE,this).set(t,n)}function CE(t){return z(iE,this).get(t)||new Set}function PE(t){if(t&&z($I,this)&&"function"==typeof z($I,this).get)return z($I,this).get(t)}function DE(t){if(!t)return;const e=t.fullBufferRetryTimer;null!=e&&("function"==typeof(null==Bu?void 0:Bu.clearTimeout)?Bu.clearTimeout.bind(Bu):clearTimeout)(e),t.fullBufferRetryTimer=null,t.fullBufferDecodeScheduled=!1,t.fullBufferRetryAttempts=0}function RE(t){const e=null==t?void 0:t.segmentStates;e&&"function"==typeof e.forEach&&e.forEach((t=>{L(lE,this,DE).call(this,t)}))}function LE(t,e,n,i){var r,o;if(!(t&&e&&n&&i))return!1;const s=z(tE,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 BE(t){if(!t)return;L(lE,this,RE).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 zE(t){const e=UI(t);if(!Number.isFinite(e))return;const n=e-2;Number.isFinite(n)&&z(tE,this).forEach((t=>{const e=null==t?void 0:t.placement;if(!e)return;const i=Bp(e),r=Rp(e,z($I,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||L(lE,this,BE).call(this,t)}))}))}function WE(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 jE(t,e){if(this.log.debug(`[#startDecode] [${t.placementId}] [${e.id}] Starting decode`),L(lE,this,UE).call(this,t,e)){if(L(lE,this,OE).call(this,e.id,t.placementId),!L(lE,this,AE).call(this,e))return L(lE,this,ME).call(this,e),void L(lE,this,FE).call(this,e);L(lE,this,VE).call(this,t,e),L(lE,this,FE).call(this,e)}}function UE(t,e){if(!t||!t.placementId||!e)return;const n=z(tE,this).get(t.placementId);if(n)return n.placement=t,n;const i=L(lE,this,NE).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(Dm.DECODE_ERROR,Bm({placementId:t.placementId,nodeId:e.id,trackId:null==n?void 0:n.id,trackType:null==n?void 0:n.type,error:i}))}}));const o={trackStates:r,nodeId:e.id,placement:t};return z(tE,this).set(t.placementId,o),o}function $E(t){var e;const n=Bp(t),i=UI(null===(e=z(qI,this))||void 0===e?void 0:e.currentTime);return!Number.isFinite(n)||!!Number.isFinite(i)&&n-i>2}function qE(t){if(!z(rE,this).size)return;const e=UI(t);if(!Number.isFinite(e))return;const n=[];z(rE,this).forEach((t=>{const i=z(tE,this).get(t),r=null==i?void 0:i.placement;if(!r)return void n.push(t);const o=Bp(r);Number.isFinite(o)&&o-e<=2&&n.push(t)})),n.forEach((t=>{z(rE,this).delete(t);const e=z(tE,this).get(t),n=null==e?void 0:e.placement;if(!n)return;const i=L(lE,this,PE).call(this,n.nodeId);i&&L(lE,this,jE).call(this,n,i)}))}function VE(t,e){const n=z(tE,this).get(t.placementId);n&&L(lE,this,NE).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;L(lE,this,tS).call(this,t,i,n),r.seekSegmentId&&"video"===(null==i?void 0:i.type)&&L(lE,this,GE).call(this,t,i,n),r.ready=!0,this.trigger(Dm.DECODE_READY,Lm({placementId:t.placementId,nodeId:e.id,trackId:i.id,trackType:i.type}))}catch(n){this.trigger(Dm.DECODE_ERROR,Bm({placementId:t.placementId,nodeId:e.id,trackId:null==i?void 0:i.id,trackType:null==i?void 0:i.type,error:n}))}}))}function GE(t,e,n){var i;if(!(t&&e&&n&&Array.isArray(e.segments)))return;const r=null==t?void 0:t.placementId,o=r?z(tE,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(L(lE,this,tS).call(this,t,e,i),u+=1,u>=2)break}}function HE(t){const e=L(lE,this,PE).call(this,t);e&&L(lE,this,AE).call(this,e)&&L(lE,this,CE).call(this,t).forEach((t=>{const n=z(tE,this).get(t);L(lE,this,VE).call(this,(null==n?void 0:n.placement)||{placementId:t},e)}))}function KE(t){t&&t.nodeId&&t.trackId&&t.chunk&&L(lE,this,CE).call(this,t.nodeId).forEach((e=>L(lE,this,XE).call(this,e,t)))}function XE(t,e){const n=z(tE,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&&L(lE,this,tS).call(this,n.placement,s,a)&&(i.ready=!0,this.trigger(Dm.DECODE_READY,Lm({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType}))));if((null===(o=z(qI,this))||void 0===o?void 0:o.state)===qm&&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=L(lE,this,JE).call(this,n.placement,s,a);if(!u||"function"!=typeof u.decodeChunk)return;if(i.hasInit&&!c.initSent){const t=L(lE,this,ZE).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;L(lE,this,YE).call(this,c,e)?d&&!c.ended&&L(lE,this,QE).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(Dm.DECODE_READY,Lm({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType})))}catch(n){this.trigger(Dm.DECODE_ERROR,Bm({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType,error:n}))}}function YE(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 QE(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==Bu?void 0:Bu.setTimeout)?Bu.setTimeout.bind(Bu):setTimeout;i.fullBufferDecodeScheduled=!0,i.fullBufferRetryAttempts=0;const l=()=>{if(!L(lE,this,LE).call(this,r,o,s,i)||i.ended)return void L(lE,this,DE).call(this,i);if(L(lE,this,tS).call(this,t,e,n))return void L(lE,this,DE).call(this,i);i.fullBufferRetryAttempts+=1;const c=i.fullBufferRetryAttempts<=8?0:50;i.fullBufferRetryTimer=a((()=>{l()}),c)};i.fullBufferRetryTimer=a((()=>{l()}),0)}function JE(t,e,n){var i,r;const o=null==t?void 0:t.placementId;if(!o||!e||!n)return;const s=z(tE,this).get(o),a=null==s||null===(i=s.trackStates)||void 0===i?void 0:i.get(e.id);if(!a)return;const l=a.segmentDecoders.get(n.id);if(l)return l;const c=z(VI,this).create(e);if(c&&"function"==typeof c.configure&&c.configure(e),c&&"function"==typeof c.setNodeId&&c.setNodeId(null==t?void 0:t.nodeId),c&&"function"==typeof c.setSegment&&c.setSegment(n),c&&"function"==typeof c.setCurrentTimeProvider&&c.setCurrentTimeProvider((()=>{var t;return"number"==typeof(null===(t=z(qI,this))||void 0===t?void 0:t.currentTime)?z(qI,this).currentTime:0})),c&&"function"==typeof c.setTimeOffsetSeconds){var u,d;const i=Bp(t),r=UI(null==e?void 0:e.offset),o=UI(null!==(u=null==n||null===(d=n.chosenRepresentation)||void 0===d?void 0:d.segStart)&&void 0!==u?u:null==n?void 0:n.offset);Number.isFinite(i)&&c.setTimeOffsetSeconds(i+r+o)}return c&&"function"==typeof c.setSeekTargetTimeSeconds&&(null===(r=z(qI,this))||void 0===r?void 0:r.state)===qm&&"video"===(null==e?void 0:e.type)&&c.setSeekTargetTimeSeconds(z(qI,this).currentTime),c&&"function"==typeof c.on&&(c.on(Dm.DECODER_FRAME,(i=>{i&&(!z(sE,this)||"video"!==(null==e?void 0:e.type)&&"image"!==(null==e?void 0:e.type)||(j(sE,this,!1),j(aE,this,null)),z(qI,this)&&"function"==typeof z(qI,this).notifyDecodedFrame&&(i.frame||i.data)&&z(qI,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(Dm.DECODER_AUDIO,(i=>{i&&i.audioBuffer&&this.trigger(Dm.DECODER_AUDIO,Lm({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(Dm.DECODER_ERROR,(i=>{const r=(null==i?void 0:i.error)||i;this.trigger(Dm.DECODER_ERROR,Bm({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})),L(lE,this,TE).call(this,r)}))),a.segmentDecoders.set(n.id,c),c}function ZE(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 tS(t,e,n){var i;if(!t||!e||!n)return!1;const r=t.placementId,o=z(tE,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=L(lE,this,JE).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 L(lE,this,DE).call(this,l),!0;if(s.hasInit&&!l.initSent){const t=L(lE,this,ZE).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()),L(lE,this,DE).call(this,l),0))}const eS=1e-6;var nS=new WeakMap,iS=new WeakMap,rS=new WeakMap,oS=new WeakMap,sS=new WeakMap,aS=new WeakMap,lS=new WeakMap,cS=new WeakMap,uS=new WeakSet;class dS extends Du{get name(){return"TransitionManager"}get defaults(){return{durationSeconds:.5}}constructor(t,e,n){super(n),U(this,uS),W(this,nS,void 0),W(this,iS,void 0),W(this,rS,null),W(this,oS,null),W(this,sS,null),W(this,aS,0),W(this,lS,[]),W(this,cS,null),j(nS,this,t),j(iS,this,e),z(nS,this)&&"function"==typeof z(nS,this).on&&(j(cS,this,(()=>L(uS,this,kS).call(this))),z(nS,this).on(Dm.TIMELINE_RESET,z(cS,this)))}transitionTo(t,e={}){const n=Number(t);if(!Number.isFinite(n))throw new Error("TransitionManager.transitionTo requires a numeric time");L(uS,this,kS).call(this);const i=L(uS,this,hS).call(this),r=L(uS,this,vS).call(this,n,e);return r?L(uS,this,gS).call(this,n,e,i,r):Promise.resolve()}onDispose(){z(nS,this)&&"function"==typeof z(nS,this).off&&z(cS,this)&&z(nS,this).off(Dm.TIMELINE_RESET,z(cS,this)),j(cS,this,null),L(uS,this,kS).call(this),j(iS,this,null),j(nS,this,null)}}function hS(){return j(aS,this,z(aS,this)+1),z(aS,this)}function fS(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 pS(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 mS(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 vS(t,e={}){var n;const i=z(iS,this),r=L(uS,this,fS).call(this,e);if(!i||"function"!=typeof i.startTransition)return z(nS,this).currentTime=t,null;if(!(r>0))return z(nS,this).currentTime=t,null!==(n=i.resetTransition)&&void 0!==n&&n.call(i),null;const o=L(uS,this,pS).call(this,e,r);"function"==typeof(null==e?void 0:e.onTransitionInStart)&&e.onTransitionInStart();const s=i.startTransition(o),{outDurationMs:a,inDurationMs:l}=L(uS,this,mS).call(this,r,s);return{renderer:i,transitionOptions:o,outDurationMs:a,inDurationMs:l,shouldWaitForFrames:!1!==(null==e?void 0:e.waitForVisualFrames)}}function gS(t,e={},n,i){const{renderer:r,transitionOptions:o,outDurationMs:s,inDurationMs:a,shouldWaitForFrames:l}=i,c=L(uS,this,IS).call(this,t,e,n),u=l?L(uS,this,ES).call(this,t,n):Promise.resolve();let d=!1,h=!1,f=!1,p=!l;const m=()=>{var t;L(uS,this,xS).call(this,n)&&!f&&d&&h&&p&&(f=!0,"function"==typeof(null==e?void 0:e.onTransitionInEnd)&&e.onTransitionInEnd(),"function"==typeof(null==e?void 0:e.onTransitionOutStart)&&e.onTransitionOutStart(),null!==(t=r.beginTransitionIn)&&void 0!==t&&t.call(r,o),j(oS,this,setTimeout((()=>{var t;L(uS,this,xS).call(this,n)&&(null!==(t=r.resetTransition)&&void 0!==t&&t.call(r),"function"==typeof(null==e?void 0:e.onTransitionOutEnd)&&e.onTransitionOutEnd(),L(uS,this,yS).call(this))}),a)))};return j(rS,this,setTimeout((()=>{d=!0,m()}),s)),c.then((()=>{h=!0,m()})).catch((()=>{var t;L(uS,this,xS).call(this,n)&&(null!==(t=r.resetTransition)&&void 0!==t&&t.call(r),L(uS,this,yS).call(this))})),u.then((()=>{p=!0,m()})).catch((()=>{p=!0,m()})),z(nS,this).currentTime=t,new Promise((t=>{j(sS,this,t)}))}function yS(){const t=z(sS,this);j(sS,this,null),L(uS,this,bS).call(this),L(uS,this,TS).call(this),t&&t()}function bS(){z(rS,this)&&clearTimeout(z(rS,this)),z(oS,this)&&clearTimeout(z(oS,this)),j(rS,this,null),j(oS,this,null)}function kS(){var t,e;z(iS,this)&&null!==(t=(e=z(iS,this)).resetTransition)&&void 0!==t&&t.call(e),L(uS,this,bS).call(this),L(uS,this,TS).call(this),z(sS,this)&&(z(sS,this).call(this),j(sS,this,null))}function xS(t){return z(aS,this)===t}function wS(t,e){z(nS,this)&&"function"==typeof z(nS,this).on&&(z(nS,this).on(t,e),z(lS,this).push({eventName:t,handler:e}))}function _S(t,e){z(nS,this)&&"function"==typeof z(nS,this).off&&(z(nS,this).off(t,e),j(lS,this,z(lS,this).filter((n=>n.eventName!==t||n.handler!==e))))}function TS(){z(nS,this)&&"function"==typeof z(nS,this).off?(z(lS,this).forEach((t=>{z(nS,this).off(t.eventName,t.handler)})),j(lS,this,[])):j(lS,this,[])}function IS(t,e,n){const i=null==e?void 0:e.transitionOutPromise;if(i&&"function"==typeof i.then)return i;if("function"==typeof i)try{const t=i();if(t&&"function"==typeof t.then)return t}catch(t){return Promise.resolve()}if(!z(nS,this)||"function"!=typeof z(nS,this).on)return Promise.resolve();const r=L(uS,this,SS).call(this);return new Promise((e=>{let i=!1;const o=r?Dm.TIMELINE_SEEKED:"nodestart";let s,a;const l=()=>{L(uS,this,_S).call(this,Dm.TIMELINE_SEEKING,s),L(uS,this,_S).call(this,o,a),e()};s=(e={})=>{L(uS,this,xS).call(this,n)?L(uS,this,AS).call(this,e,t)&&(i=!0):l()},a=(e={})=>{L(uS,this,xS).call(this,n)?(o!==Dm.TIMELINE_SEEKED||L(uS,this,AS).call(this,e,t))&&(o===Dm.TIMELINE_SEEKED||i)&&l():l()},L(uS,this,wS).call(this,Dm.TIMELINE_SEEKING,s),L(uS,this,wS).call(this,o,a)}))}function ES(t,e){if(!z(nS,this)||"function"!=typeof z(nS,this).on)return Promise.resolve();const n=Number(t);return new Promise((t=>{const i=(r={})=>{if(!L(uS,this,xS).call(this,e))return L(uS,this,_S).call(this,Dm.VISUAL_FRAMES_AVAILABLE,i),void t();const o=Number(null==r?void 0:r.time);Number.isFinite(n)&&Number.isFinite(o)&&o+eS<n||(Array.isArray(null==r?void 0:r.frames)?r.frames:[]).length&&(L(uS,this,_S).call(this,Dm.VISUAL_FRAMES_AVAILABLE,i),t())};L(uS,this,wS).call(this,Dm.VISUAL_FRAMES_AVAILABLE,i)}))}function SS(){var t,e;const n=null===(t=z(nS,this))||void 0===t?void 0:t.state;if(n===$m||n===zm)return!0;const i=null===(e=z(nS,this))||void 0===e?void 0:e.placements;return!Array.isArray(i)||0===i.length}function AS(t,e){const n=Number(null==t?void 0:t.targetTime);return!Number.isFinite(n)||Math.abs(n-e)<eS}function NS(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}var MS=new WeakMap,FS=new WeakMap,OS=new WeakMap,CS=new WeakMap,PS=new WeakMap,DS=new WeakMap,RS=new WeakMap,LS=new WeakMap,BS=new WeakMap,zS=new WeakMap,WS=new WeakMap,jS=new WeakMap,US=new WeakMap,$S=new WeakMap,qS=new WeakSet;class VS extends Du{get name(){return"AudioPlaybackManager"}get defaults(){return{muted:!1,volume:1,lookaheadSeconds:1}}constructor(t,e,n){super(n),U(this,qS),W(this,MS,void 0),W(this,FS,void 0),W(this,OS,null),W(this,CS,null),W(this,PS,[]),W(this,DS,new Set),W(this,RS,new Map),W(this,LS,!1),W(this,BS,1),W(this,zS,!0),W(this,WS,null),W(this,jS,null),W(this,US,null),W(this,$S,null),j(MS,this,t),j(FS,this,e),j(LS,this,!!this.settings.muted),j(BS,this,Pp(this.settings.volume));const i=Array.isArray(null==n?void 0:n.disabledTracks)?n.disabledTracks:[];j(zS,this,!i.includes("audio")),L(qS,this,GS).call(this)}get muted(){return z(LS,this)}set muted(t){j(LS,this,!!t),L(qS,this,iA).call(this)}get volume(){return z(BS,this)}set volume(t){j(BS,this,Pp(t)),L(qS,this,iA).call(this)}handleDecodedAudio(t={}){if(!z(zS,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=NS(null==t?void 0:t.pts,null);if(!(e&&n&&i&&Number.isFinite(r)))return;const o=Number.isFinite(null==t?void 0:t.duration)?t.duration:e.duration,s=`${n}:${i}`;z(DS,this).has(s)||(z(PS,this).push({key:s,placementId:n,pts:r,duration:o,audioBuffer:e}),z(PS,this).sort(((t,e)=>t.pts-e.pts)),L(qS,this,QS).call(this))}onDispose(){L(qS,this,HS).call(this),L(qS,this,eA).call(this,!0),z(OS,this)&&"function"==typeof z(OS,this).close&&z(OS,this).close(),j(OS,this,null),j(CS,this,null),j(MS,this,null),j(FS,this,null)}}function GS(){z(MS,this)&&"function"==typeof z(MS,this).on&&(j(WS,this,(t=>L(qS,this,KS).call(this,t))),z(MS,this).on(Dm.TIMELINE_TIME_UPDATE,z(WS,this)),j(jS,this,(t=>L(qS,this,XS).call(this,t))),z(MS,this).on(Dm.TIMELINE_STATE_CHANGE,z(jS,this)),j($S,this,(()=>L(qS,this,YS).call(this))),z(MS,this).on(Dm.TIMELINE_RESET,z($S,this))),z(FS,this)&&"function"==typeof z(FS,this).on&&(j(US,this,(t=>this.handleDecodedAudio(t))),z(FS,this).on(Dm.DECODER_AUDIO,z(US,this)))}function HS(){z(MS,this)&&"function"==typeof z(MS,this).off&&(z(WS,this)&&z(MS,this).off(Dm.TIMELINE_TIME_UPDATE,z(WS,this)),z(jS,this)&&z(MS,this).off(Dm.TIMELINE_STATE_CHANGE,z(jS,this)),z($S,this)&&z(MS,this).off(Dm.TIMELINE_RESET,z($S,this))),z(FS,this)&&"function"==typeof z(FS,this).off&&z(US,this)&&z(FS,this).off(Dm.DECODER_AUDIO,z(US,this)),j(WS,this,null),j(jS,this,null),j(US,this,null),j($S,this,null)}function KS(){L(qS,this,QS).call(this)}function XS(t={}){const e=null==t?void 0:t.to;if(e)return e===Wm?(L(qS,this,rA).call(this),void L(qS,this,QS).call(this)):void(e!==$m&&e!==Um?e!==qm&&e!==Vm||L(qS,this,YS).call(this):L(qS,this,oA).call(this))}function YS(){L(qS,this,oA).call(this),L(qS,this,eA).call(this,!0),j(PS,this,[])}function QS(){if(!z(zS,this)||!z(MS,this))return;if(z(MS,this).state!==Wm)return;const t=L(qS,this,nA).call(this);if(!t)return;const e=NS(z(MS,this).currentTime,0),n=e+Math.max(0,NS(this.settings.lookaheadSeconds,1)),i=[];for(let r=0;r<z(PS,this).length;r+=1){const o=z(PS,this)[r];o&&(o.pts>n?i.push(o):L(qS,this,JS).call(this,o)&&L(qS,this,tA).call(this,o,t,e))}j(PS,this,i)}function JS(t){if(!t||!z(MS,this))return!1;const e=L(qS,this,ZS).call(this,t.pts);return!(!e||e!==t.placementId)}function ZS(t){if(!z(MS,this)||"function"!=typeof z(MS,this).getPlacementsActiveAtTime)return null;const e=z(MS,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 tA(t,e,n){const i=t.key;if(z(DS,this).has(i))return;const r=t.audioBuffer;if(!r)return;const o=Number.isFinite(t.duration)?t.duration:r.duration,s=t.pts;if(!Number.isFinite(s))return;const a=n-s;if(Number.isFinite(o)&&o>0&&a>=o)return;const l=e.createBufferSource();l.buffer=r,l.connect(z(CS,this));let c=e.currentTime,u=0;a>0?u=a:a<0&&(c=e.currentTime+Math.abs(a));try{l.start(c,u)}catch(t){return void this.log.warn("[AudioPlaybackManager] Failed to start audio buffer",t)}z(DS,this).add(i),z(RS,this).set(i,l),l.onended=()=>{z(RS,this).delete(i)}}function eA(t){z(RS,this).forEach(((t,e)=>{if(t&&"function"==typeof t.stop)try{t.stop()}catch(t){}z(RS,this).delete(e)})),t&&z(DS,this).clear()}function nA(){if(z(OS,this))return z(OS,this);const t=Bu.AudioContext||Bu.webkitAudioContext;if(!t)return this.log.warn("[AudioPlaybackManager] AudioContext is not available."),null;try{return j(OS,this,new t),j(CS,this,z(OS,this).createGain()),z(CS,this).connect(z(OS,this).destination),L(qS,this,iA).call(this),z(OS,this)}catch(t){return this.log.warn("[AudioPlaybackManager] Failed to initialize AudioContext",t),j(OS,this,null),j(CS,this,null),null}}function iA(){if(!z(CS,this))return;const t=z(LS,this)?0:z(BS,this);z(CS,this).gain.value=t}function rA(){z(OS,this)&&"function"==typeof z(OS,this).resume&&"suspended"===z(OS,this).state&&z(OS,this).resume().catch((()=>{}))}function oA(){z(OS,this)&&"function"==typeof z(OS,this).suspend&&"running"===z(OS,this).state&&z(OS,this).suspend().catch((()=>{}))}var sA=new WeakMap,aA=new WeakMap,lA=new WeakMap,cA=new WeakMap,uA=new WeakMap,dA=new WeakSet;class hA extends Du{constructor(...t){super(...t),U(this,dA),W(this,sA,void 0),W(this,aA,void 0),W(this,lA,void 0),W(this,cA,void 0),W(this,uA,void 0),j(sA,this,L(dA,this,pA).call(this,this.settings.currentTime)),j(aA,this,L(dA,this,mA).call(this,this.settings.playbackRate)),j(lA,this,null),j(cA,this,!1),j(uA,this,L(dA,this,fA).bind(this))}get name(){return"PlaybackClock"}get defaults(){return{currentTime:0,playbackRate:ty("playbackRate")}}get currentTime(){return z(sA,this)}get playbackRate(){return z(aA,this)}set playbackRate(t){j(aA,this,L(dA,this,mA).call(this,t))}play(){z(cA,this)||(j(cA,this,!0),j(lA,this,Lg()),kk(z(uA,this),0))}pause(){z(cA,this)&&(j(cA,this,!1),xk(z(uA,this)))}seek(t){j(sA,this,L(dA,this,pA).call(this,t)),j(lA,this,Lg())}reset(){this.pause(),j(sA,this,0),j(lA,this,null)}onDispose(){this.pause(),j(uA,this,null)}}function fA(){const t=Lg();if(null===z(lA,this))return j(lA,this,t),void this.trigger(Dm.CLOCK_TICK,{currentTime:z(sA,this)});const e=t-z(lA,this);j(lA,this,t);const n=e/1e3;j(sA,this,z(sA,this)+n*z(aA,this)),this.trigger(Dm.CLOCK_TICK,{currentTime:z(sA,this)})}function pA(t){return"number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t)||t<0?0:t}function mA(t){return"number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t)||t<=0?z(aA,this)||1:t}var vA=new WeakMap,gA=new WeakSet;class yA extends Du{constructor(...t){super(...t),U(this,gA),W(this,vA,new Map)}get name(){return"TrackBuffers"}get defaults(){return{}}refreshNode(t){if(!t||!Array.isArray(t.tracks))return;const e=t.id,n=z(vA,this).get(e)||new Map;z(vA,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(Dm.TRACK_BUFFER_UPDATE,{nodeId:e,trackType:i,range:r})),!s&&a?this.trigger(Dm.TRACK_READY,{nodeId:e,trackType:i,range:r}):s&&!a&&this.trigger(Dm.TRACK_UNDERFLOW,{nodeId:e,trackType:i,range:r})}))}getTrackRange(t,e){const n=z(vA,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=L(gA,this,kA).call(this,n,t[e],i);if(!a||a.end<=i)continue;if(void 0===r){r=a.start,o=a.end,s=a.full;continue}const l=a.start<=o,c=s&&a.full;if(!l&&!c)break;o=Math.max(o,a.end),s=a.full}return void 0===r||void 0===o?{start:0,end:0}:{start:r,end:o}}get buffered(){return z(vA,this)}reset(){z(vA,this).clear()}onDispose(){z(vA,this).clear(),"function"==typeof this.off&&this.off()}}function bA(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 kA(t,e,n=0){var i,r;const o=Bp(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 L(gA,this,xA).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=L(gA,this,bA).call(this,d,u)||(null===(r=d)||void 0===r?void 0:r.buffered);return h&&Number.isFinite(h.start)&&Number.isFinite(h.end)?L(gA,this,xA).call(this,s,h,o,e):void 0}function xA(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 wA{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 _A extends Du{constructor(t,e){super(e),this.timeline=t}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"handleDecodedFrame","handleClockTick","handleMainTrackBufferUpdate"])}enter(){}exit(){}play(){this.timeline.transitionTo(Wm)}pause(){this.timeline.transitionTo($m)}wait(){this.timeline.transitionTo(Um)}reset(){this.timeline.transitionTo(Vm)}seek(t){this.timeline.transitionTo(qm,{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()||$m;this.timeline.transitionTo(e)}handleMainTrackBufferUpdate(t){}handleDecodedFrame(t){}handleClockTick(t){}onDispose(){this.timeline=null}}const TA=24e3/1001;function IA(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 EA(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 SA(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 AA(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 NA(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:TA)}(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+EA(t)}function MA(t,e=(null==t?void 0:t.currentTime)){const n=IA(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=SA(o);if(!s)return!0;if(!t.hasDecodedFirstFrame(r,s))return!0}return!1}function FA(t,e=(null==t?void 0:t.currentTime)){return MA(t,e)||function(t,e=(null==t?void 0:t.currentTime)){const n=IA(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=AA(s);if(null!=a&&a.id&&!NA(t,o,a.id,a.type,n))return!0}return!1}(t,e)}function OA(t,e=(null==t?void 0:t.currentTime)){if("function"!=typeof(null==t?void 0:t.computeBuffered))return!1;const n=IA(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=EA(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=Bp(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 CA={[zm]:class extends _A{get name(){return zm}get defaults(){return{autoplay:ty("autoplay")}}enter(){this.timeline.recordStableState($m),this.timeline.stopPlaybackClock()}play(){const t=FA(this.timeline),e=t?Um:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t)return this.timeline.recordStableState(Wm),void this.timeline.transitionTo(Um);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(FA(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)}},[jm]:class extends _A{get name(){return jm}enter(t={}){const{from:e,to:n}=t;this.timeline.recordStableState(Wm),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("canplay",{from:e,to:n})}play(){}pause(){this.timeline.transitionTo($m)}},[Wm]:class extends _A{get name(){return Wm}enter(t={}){const{from:e,to:n,fromFirstFramePending:i}=t;this.timeline.recordStableState(Wm),this.timeline.startPlaybackClock(),!0!==i&&this.emitPlayerStateEvent("canplay",{from:e,to:n}),this.emitPlayerStateEvent("playing",{from:e,to:n})}play(){}pause(){this.timeline.transitionTo($m)}handleClockTick(t){const e=this.timeline.currentTime;FA(this.timeline,e)&&(this.timeline.recordStableState(Wm),this.timeline.transitionTo(Um))}},[Um]:(cn=new WeakMap,un=new WeakMap,dn=new WeakSet,class extends _A{constructor(...t){super(...t),U(this,dn),W(this,cn,void 0),W(this,un,null)}get name(){return Um}enter(t={}){const{from:e,to:n}=t;this.timeline.stopPlaybackClock(),L(dn,this,PA).call(this),L(dn,this,RA).call(this),this.emitPlayerStateEvent("waiting",{from:e,to:n}),L(dn,this,zA).call(this)}exit(){L(dn,this,DA).call(this),L(dn,this,LA).call(this)}play(){this.timeline.recordStableState(Wm);const t=L(dn,this,BA).call(this),e=t?Um:this.timeline.getPlaybackStartState();this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t||this.timeline.transitionTo(e)}pause(){this.timeline.transitionTo($m)}handleMainTrackReady(t){const e=this.timeline.getLastStableState()||$m;e!==Wm?this.timeline.transitionTo(e):L(dn,this,zA).call(this)}handleDecodedFrame(t){L(dn,this,zA).call(this)}handleMainTrackBufferUpdate(t){L(dn,this,zA).call(this)}}),[$m]:class extends _A{get name(){return $m}enter(t={}){const{from:e,to:n}=t;this.timeline.recordStableState($m),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("pause",{from:e,to:n})}play(){const t=FA(this.timeline),e=t?Um:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t)return this.timeline.recordStableState(Wm),void this.timeline.transitionTo(Um);this.timeline.transitionTo(e)}pause(){}},[qm]:class extends _A{get name(){return qm}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===Wm||n===jm,r=i&&"function"==typeof this.timeline.getPlaybackStartState?this.timeline.getPlaybackStartState(e):i?Wm:$m;this.timeline.transitionTo(r,{fromSeeking:!0})}play(){var t;if(this.timeline&&"function"==typeof this.timeline.setSeekReturnState)return void this.timeline.setSeekReturnState(Wm);const e="function"==typeof(null===(t=this.timeline)||void 0===t?void 0:t.getPlaybackStartState)?this.timeline.getPlaybackStartState():Wm;this.timeline.transitionTo(e)}pause(){this.timeline&&"function"==typeof this.timeline.setSeekReturnState?this.timeline.setSeekReturnState($m):this.timeline.transitionTo($m)}handleDecodedFrame(t){this.timeline&&"function"==typeof this.timeline.maybeCompleteSeek&&this.timeline.maybeCompleteSeek(t)}},[Vm]:class extends _A{get name(){return Vm}enter(){this.timeline.resetClock(),this.timeline.transitionTo(zm,{fromReset:!0})}play(){}pause(){}get buffered(){return{start:0,end:0}}}};function PA(){var t;const e=null===(t=this.timeline)||void 0===t?void 0:t.trackBuffers;e&&"function"==typeof e.on&&(j(cn,this,(t=>this.handleMainTrackBufferUpdate(t))),e.on(Dm.TRACK_BUFFER_UPDATE,z(cn,this)))}function DA(){var t;const e=null===(t=this.timeline)||void 0===t?void 0:t.trackBuffers;z(cn,this)&&e&&"function"==typeof e.off?(e.off(Dm.TRACK_BUFFER_UPDATE,z(cn,this)),j(cn,this,null)):j(cn,this,null)}function RA(){if(null!==z(un,this))return;const t="function"==typeof(null==Bu?void 0:Bu.setInterval)?Bu.setInterval.bind(Bu):setInterval;j(un,this,t((()=>{var t;(null===(t=this.timeline)||void 0===t?void 0:t.state)===Um&&L(dn,this,zA).call(this)}),200))}function LA(){null!==z(un,this)&&(("function"==typeof(null==Bu?void 0:Bu.clearInterval)?Bu.clearInterval.bind(Bu):clearInterval)(z(un,this)),j(un,this,null))}function BA(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!!MA(t,e)||!0===n.skipBufferResume||!OA(t,e)}(this.timeline,t)}function zA(t=(t=>null===(t=this.timeline)||void 0===t?void 0:t.currentTime)()){return(this.timeline.getLastStableState()||$m)===Wm&&!L(dn,this,BA).call(this,t)&&(this.timeline.transitionTo(this.timeline.getPlaybackStartState(t)),!0)}function WA(t){return t&&("string"!=typeof t.state||"ready"===t.state)}function jA(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).some((t=>"video"===(null==t?void 0:t.type)))}function UA(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 $A(t){return t===Wm||t===jm}var qA=new WeakMap,VA=new WeakMap,GA=new WeakMap,HA=new WeakMap,KA=new WeakMap,XA=new WeakMap,YA=new WeakMap,QA=new WeakMap,JA=new WeakMap,ZA=new WeakMap,tN=new WeakMap,eN=new WeakMap,nN=new WeakMap,iN=new WeakMap,rN=new WeakSet;class oN{constructor(t={}){U(this,rN),W(this,qA,void 0),W(this,VA,void 0),W(this,GA,void 0),W(this,HA,void 0),W(this,KA,void 0),W(this,XA,void 0),W(this,YA,void 0),W(this,QA,void 0),W(this,JA,void 0),W(this,ZA,null),W(this,tN,$m),W(this,eN,[]),W(this,nN,new Set),W(this,iN,new Map),j(qA,this,t.getState),j(VA,this,t.getNode),j(GA,this,t.getPlacementsActiveAtTime),j(HA,this,t.getLastStableState),j(KA,this,t.getPlaybackStartState),j(XA,this,t.clearVisualFrameBuffers),j(YA,this,t.updateTime),j(QA,this,t.transitionTo),j(JA,this,t.trigger)}start(t,e){const n=Number(t);if(!Number.isFinite(n))return;let i=e;i===qm?i=z(tN,this):i===Um&&"function"==typeof z(HA,this)&&(i=z(HA,this).call(this)),j(tN,this,$A(i)?Wm:$m),j(ZA,this,n),z(nN,this).clear(),z(iN,this).clear(),j(eN,this,"function"==typeof z(GA,this)?z(GA,this).call(this,n):[]),"function"==typeof z(XA,this)&&z(XA,this).call(this),"function"==typeof z(YA,this)&&z(YA,this).call(this,n,{source:"seek"}),"function"==typeof z(JA,this)&&z(JA,this).call(this,Dm.TIMELINE_SEEKING,{targetTime:n,placements:z(eN,this).slice()}),this.maybeComplete()}setReturnState(t){j(tN,this,$A(t)?Wm:$m)}maybeComplete(t){if(("function"==typeof z(qA,this)?z(qA,this).call(this):void 0)!==qm)return;const e=z(ZA,this);if(!Number.isFinite(e))return;const n=null==t?void 0:t.trackType,i=null==t?void 0:t.placementId;if(i&&"video"===n){const n=Number(null==t?void 0:t.pts);if(Number.isFinite(n)&&n>=e){z(nN,this).add(i);const t=z(iN,this).get(i);(!Number.isFinite(t)||n<t)&&z(iN,this).set(i,n)}}else i&&"image"===n&&function(t,e){const n=Number(null==t?void 0:t.pts),i=Number(null==t?void 0:t.duration);return!Number.isFinite(n)||(Number.isFinite(i)&&i>0?e>=n&&e<n+i:e>=n)}(t,e)&&z(nN,this).add(i);const r=Array.isArray(z(eN,this))?z(eN,this):[];if(r.length){if("function"==typeof z(VA,this)){for(let t=0;t<r.length;t+=1){const e=r[t],n=null==e?void 0:e.placementId;if(!n)return;const i=z(VA,this).call(this,e.nodeId);if(!WA(i))return;if(UA(i)&&!z(nN,this).has(n))return}L(rN,this,sN).call(this,e,r)}}else L(rN,this,sN).call(this,e,[])}dispose(){j(eN,this,[]),z(nN,this).clear(),z(iN,this).clear(),j(ZA,this,null)}}function sN(t,e){const n=L(rN,this,aN).call(this,t,e);if("function"==typeof z(YA,this)&&z(YA,this).call(this,n,{source:"seek"}),j(ZA,this,null),j(eN,this,[]),z(nN,this).clear(),z(iN,this).clear(),"function"==typeof z(JA,this)&&z(JA,this).call(this,Dm.TIMELINE_SEEKED,{targetTime:t,placements:Array.isArray(e)?e.slice():[]}),"function"==typeof z(QA,this)){const t=z(tN,this)===Wm&&"function"==typeof z(KA,this)?z(KA,this).call(this,n):z(tN,this);z(QA,this).call(this,t,{fromSeeking:!0})}}function aN(t,e){const n=Number(t);if(!Number.isFinite(n))return t;if(!Array.isArray(e)||!e.length||"function"!=typeof z(VA,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(!jA(z(VA,this).call(this,n.nodeId)))continue;const o=z(iN,this).get(r);Number.isFinite(o)&&o>i&&(i=o)}return i}function lN(t){if(t&&"function"==typeof t.close)try{t.close()}catch(t){}}function cN(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=>lN(null==t?void 0:t.frame)))}function uN(t){return Bp(t)}function dN(t){return Number.isFinite(null==t?void 0:t.loopRootOffset)?t.loopRootOffset:uN(t)}function hN(t,e){return"string"==typeof(null==t?void 0:t.loopRootPlacementId)&&t.loopRootPlacementId?t.loopRootPlacementId:e}function fN(t){if("string"!=typeof t)return Number.NaN;const e=t.match(/(\d+)/);return e?Number(e[1]):Number.NaN}function pN(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 mN=1e-6;function vN(t){return t&&("string"!=typeof t.state||"ready"===t.state)}function gN(t){const e=Number(t);return Number.isFinite(e)?e:0}function yN(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 bN(t){return t&&"cue"===t.type&&Array.isArray(t.cues)?t.cues:[]}var kN=new WeakMap,xN=new WeakMap,wN=new WeakMap,_N=new WeakMap,TN=new WeakMap,IN=new WeakMap,EN=new WeakMap,SN=new WeakMap,AN=new WeakSet;class NN{constructor(t={}){U(this,AN),W(this,kN,void 0),W(this,xN,void 0),W(this,wN,void 0),W(this,_N,void 0),W(this,TN,void 0),W(this,IN,void 0),W(this,EN,-1e-6),W(this,SN,null),j(kN,this,t.getPlacements),j(xN,this,t.getPlacementsActiveAtTime),j(wN,this,t.getPlacementDuration),j(_N,this,t.getNode),j(TN,this,t.triggerTimeline),j(IN,this,t.triggerNode)}handleSeeking(t,e){const n=gN(t);j(SN,this,n)}handleSeeked(t){const e=gN(t),n=z(SN,this);j(SN,this,null),Number.isFinite(n)?(L(AN,this,FN).call(this,n,e),j(EN,this,e)):j(EN,this,e)}handleTimeUpdate(t,e={}){const n=gN(t),i=z(EN,this);!0===(null==e?void 0:e.isSeeking)?j(EN,this,n):Number.isFinite(i)?n<=i?n<i&&j(EN,this,n-mN):(L(AN,this,MN).call(this,i,n),j(EN,this,n)):j(EN,this,n)}dispose(){j(SN,this,null),j(EN,this,-1e-6)}}function MN(t,e){const n="function"==typeof z(kN,this)?z(kN,this).call(this):[];L(AN,this,ON).call(this,n,t,e,{onlySticky:!1})}function FN(t,e){if("function"!=typeof z(xN,this))return;const n=z(xN,this).call(this,e);L(AN,this,ON).call(this,n,t,e,{onlySticky:!0})}function ON(t,e,n,i={}){if("function"!=typeof z(_N,this)||"function"!=typeof z(TN,this))return;if(!Array.isArray(t)||!t.length)return;const r=!0===i.onlySticky,o=[];for(let i=0;i<t.length;i+=1){const s=t[i],a=null==s?void 0:s.placementId,l=null==s?void 0:s.nodeId;if(!a||!l)continue;const c=z(_N,this).call(this,l);if(!vN(c))continue;const u=yN(c);if(!u.length)continue;const d=Bp(s);if(!Number.isFinite(d))continue;const h=Number.isFinite(null==s?void 0:s.nodeOffsetOverride)?s.nodeOffsetOverride:0,f="function"==typeof z(wN,this)?z(wN,this).call(this,s):void 0,p="number"==typeof f&&Number.isFinite(f)?d+f:Number.POSITIVE_INFINITY,m=r?d-mN:e;for(let t=0;t<u.length;t+=1){const e=bN(u[t]);for(let i=0;i<e.length;i+=1){const s=e[i],c=gN(null==s?void 0:s.timestamp),u=d+Math.max(0,c-h);u<=p&&(r&&!0!==(null==s?void 0:s.isSticky)||u>m&&u<=n&&"string"==typeof(null==s?void 0:s.name)&&s.name&&o.push({time:u,placementOffset:d,placementId:a,nodeId:l,cuepoint:s,trackIndex:t,cueIndex:i}))}}}o.length&&(o.sort(((t,e)=>t.time!==e.time?t.time-e.time:t.placementOffset!==e.placementOffset?t.placementOffset-e.placementOffset:t.placementId!==e.placementId?t.placementId<e.placementId?-1:1:t.trackIndex!==e.trackIndex?t.trackIndex-e.trackIndex:t.cueIndex-e.cueIndex)),o.forEach((t=>{const e=t.cuepoint,n={time:t.time,nodeId:t.nodeId,placementId:t.placementId,cuepoint:e};z(TN,this).call(this,"cuepoint",n),z(TN,this).call(this,e.name,n),"function"==typeof z(IN,this)&&(z(IN,this).call(this,t.nodeId,"cuepoint",n),z(IN,this).call(this,t.nodeId,e.name,n))})))}class CN{#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 PN=24e3/1001;function DN(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}:pN(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 RN=new WeakMap,LN=new WeakMap,BN=new WeakMap,zN=new WeakMap,WN=new WeakMap,jN=new WeakMap,UN=new WeakMap,$N=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 WeakSet;class vM extends Du{constructor(...t){super(...t),U(this,mM),W(this,RN,void 0),W(this,LN,void 0),W(this,BN,void 0),W(this,zN,void 0),W(this,WN,void 0),W(this,jN,!1),W(this,UN,[]),W(this,$N,new CN("placement-")),W(this,qN,[]),W(this,VN,new CN("renderplacement-")),W(this,GN,void 0),W(this,HN,void 0),W(this,KN,void 0),W(this,XN,!1),W(this,YN,new Set),W(this,QN,new Set),W(this,JN,new Map),W(this,ZN,[]),W(this,tM,0),W(this,eM,new Set),W(this,nM,new Set),W(this,iM,Number.NEGATIVE_INFINITY),W(this,rM,[]),W(this,oM,Number.NEGATIVE_INFINITY),W(this,sM,0),W(this,aM,void 0),W(this,lM,void 0),W(this,cM,new Map),W(this,uM,null),W(this,dM,void 0),W(this,hM,void 0),W(this,fM,void 0),W(this,pM,void 0);const[e,n={}]=t;j(RN,this,e),j(aM,this,n),j(WN,this,new hA(n)),j(GN,this,new yA(n)),j(zN,this,$m),L(mM,this,SM).call(this),L(mM,this,AM).call(this),j(dM,this,new oN({getState:()=>this.state,getNode:t=>z(RN,this)&&"function"==typeof z(RN,this).get?z(RN,this).get(t):void 0,getPlacementsActiveAtTime:t=>L(mM,this,aF).call(this,t,{endEpsilonSeconds:L(mM,this,vF).call(this)}),getLastStableState:()=>this.getLastStableState(),getPlaybackStartState:t=>this.getPlaybackStartState(t),clearVisualFrameBuffers:()=>L(mM,this,oF).call(this),updateTime:(t,e)=>this.updateTime(t,e),transitionTo:(t,e)=>this.transitionTo(t,e),trigger:(t,e)=>this.trigger(t,e)})),j(hM,this,new NN({getPlacements:()=>z(UN,this).slice(),getPlacementsActiveAtTime:t=>L(mM,this,aF).call(this,t),getPlacementDuration:t=>L(mM,this,UM).call(this,t),getNode:t=>z(RN,this)&&"function"==typeof z(RN,this).get?z(RN,this).get(t):void 0,triggerTimeline:(t,e)=>this.trigger(t,e),triggerNode:(t,e,n)=>{const i=z(RN,this)&&"function"==typeof z(RN,this).get?z(RN,this).get(t):void 0;i&&"function"==typeof i.trigger&&i.trigger(e,n)}})),j(fM,this,(()=>{var t,e;null===(t=z(hM,this))||void 0===t||null===(e=t.handleSeeked)||void 0===e||e.call(t,this.currentTime)})),this.on(Dm.TIMELINE_SEEKED,z(fM,this)),j(pM,this,(t=>L(mM,this,DM).call(this,t))),this.on("nodestart",z(pM,this)),this.transitionTo(zm)}get name(){return"Timeline"}get defaults(){return{snapToFps:PN,maxBufferedVideoFrames:24}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"computeBuffered","notifyDecodedFrame","getDecodedFrameStats","getActiveRenderPlacement","maybeCompleteSeek","getPlacementsActiveAtTime","hasDecodedFirstFrame","getDecodedVisualBuffer","getPlacementDuration","getNode"])}transitionTo(t,e={}){const n=z(BN,this),i=function(t,e,n={}){const i=CA[t];return i?new i(e,n):null}(t,this,z(aM,this)),r=e&&"object"==typeof e&&!Array.isArray(e)?{...e,from:n,to:t}:{from:n,to:t};i?(z(LN,this)&&"function"==typeof z(LN,this).exit&&z(LN,this).exit(),j(LN,this,i),j(BN,this,t),"function"==typeof i.enter&&i.enter(r),this.trigger(Dm.TIMELINE_STATE_CHANGE,{from:n,to:t,options:e})):this.log.warn(`Unknown state "${t}"`)}recordStableState(t){j(zN,this,t)}getLastStableState(){return z(zN,this)}enableFirstFrameRenderedGate(){j(jN,this,!0)}getPlaybackStartState(t=this.currentTime){return this.shouldWaitForFirstRenderedFrame(t)?jm:Wm}shouldWaitForFirstRenderedFrame(t=this.currentTime){if(!z(jN,this)||z(XN,this))return!1;const e=Number.isFinite(t)?t:this.currentTime,n=L(mM,this,aF).call(this,e);return Array.isArray(n)&&n.length>0}notifyFirstFrameRendered(){z(XN,this)||(j(XN,this,!0),this.state===jm&&this.transitionTo(Wm,{fromFirstFramePending:!0}))}get state(){return z(BN,this)}get paused(){return z(BN,this)===zm||z(BN,this)===$m}get currentTime(){return z(WN,this).currentTime}set currentTime(t){z(LN,this).seek(t)}get playbackRate(){return z(WN,this).playbackRate}set playbackRate(t){z(WN,this).playbackRate=t}play(){z(LN,this).play()}pause(){z(LN,this).pause()}reset(){z(LN,this).reset()}seekToPlacement(t){if(!t)throw new Error("Timeline.seekToPlacement requires placement id");L(mM,this,BM).call(this);const e=L(mM,this,hF).call(this,t);if(!e)throw new Error("Timeline.seekToPlacement requires placement id");const n=Bp(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;L(mM,this,BM).call(this),L(mM,this,zM).call(this),z(WN,this).seek(t),L(mM,this,sF).call(this,this.currentTime),L(mM,this,lF).call(this);const r="string"==typeof(null==e?void 0:e.source)?e.source:"set";null!==(n=z(hM,this))&&void 0!==n&&null!==(i=n.handleTimeUpdate)&&void 0!==i&&i.call(n,this.currentTime,{isSeeking:this.state===qm}),L(mM,this,RM).call(this,this.currentTime),L(mM,this,tF).call(this,this.currentTime),this.trigger(Dm.TIMELINE_TIME_UPDATE,Rm(this.currentTime,r))}startSeeking(t,e){var n,i;null!==(n=z(hM,this))&&void 0!==n&&null!==(i=n.handleSeeking)&&void 0!==i&&i.call(n,this.currentTime,t),z(dM,this)&&"function"==typeof z(dM,this).start&&z(dM,this).start(t,e)}setSeekReturnState(t){z(dM,this)&&"function"==typeof z(dM,this).setReturnState&&z(dM,this).setReturnState(t)}maybeCompleteSeek(t){z(dM,this)&&"function"==typeof z(dM,this).maybeComplete&&z(dM,this).maybeComplete(t)}startPlaybackClock(){z(WN,this).play()}stopPlaybackClock(){z(WN,this).pause()}resetClock(){var t,e;z(WN,this).reset(),null===(t=z(hM,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:[];L(mM,this,gM).call(this),L(mM,this,yM).call(this,e),L(mM,this,bM).call(this,n),this.currentTime=0}placeOnTimeline(t,e,n={}){const i=t&&"object"==typeof t?t.id:t;if(!i)throw new Error("Timeline.placeOnTimeline requires node id");const r=z($N,this).claim(n.placementId),o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=qp(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}:$p(e,n);let u,d,h,f=!1;const p=null!==a;if(L(mM,this,BM).call(this),a){const t=z(UN,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=Bp(t);if("start"===a.anchor)Number.isFinite(e)?u=L(mM,this,$M).call(this,e,{nodeOffsetOverride:o}):f=!0;else{const n=L(mM,this,UM).call(this,t);if(Number.isFinite(e)&&n>0){const t=e+n,i=L(mM,this,$M).call(this,t,{nodeOffsetOverride:o});u=Math.max(i,t)}else f=!0}}else if(l){const t=n.offsetAnchorPlacementId?z(UN,this).find((t=>(null==t?void 0:t.placementId)===n.offsetAnchorPlacementId)):z(UN,this).length?z(UN,this)[z(UN,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==t?void 0:t.placementId),d){const e=Bp(t),n=L(mM,this,UM).call(this,t);Number.isFinite(e)&&n>0?u=L(mM,this,$M).call(this,e+n-c,{nodeOffsetOverride:o}):(f=!0,h="end")}else u=L(mM,this,$M).call(this,-c,{nodeOffsetOverride:o})}else u=Up(e),u=L(mM,this,$M).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 wA({placementId:r,nodeId:i,offset:u,offsetPending:f,offsetAnchorPlacementId:f?d:void 0,offsetAnchorEdge:f?h:void 0,offsetAnchorIsReference:f?p:void 0,offsetEndSeconds:g,nodeOffsetOverride:o,nodeDurationOverride:s,loop:!0===n.loop,loopRootPlacementId:m,loopRootOffset:v});if(z(UN,this).push(y),Wp(z(UN,this)),L(mM,this,JM).call(this,y),L(mM,this,YM).call(this),f&&d){const t=z(UN,this).find((t=>(null==t?void 0:t.placementId)===d));L(mM,this,VM).call(this,null==t?void 0:t.nodeId)}return this.trigger(Dm.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=L(mM,this,qM).call(this,e,i),s=o.offset,a=!0===o.offsetPending,l=o.offsetAnchorPlacementId,c=o.offsetAnchorEdge,u=o.offsetAnchorIsReference,d=z(VN,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;Vp(z(qN,this),t,e,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements")}if(z(qN,this).push(v),Wp(z(qN,this)),a&&l){const t=z(UN,this).find((t=>(null==t?void 0:t.placementId)===l));L(mM,this,VM).call(this,null==t?void 0:t.nodeId)}return this.trigger(Dm.RENDER_PLACEMENT_ADDED,v),d}get placements(){return z(UN,this).slice()}getPlacementsActiveAtTime(t){return L(mM,this,aF).call(this,t)}getNodesAtTime(t){const e=L(mM,this,fF).call(this,t);if(!Number.isFinite(e))return[];const n=L(mM,this,aF).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 L(mM,this,UM).call(this,t)}getNode(t){if(z(RN,this)&&"function"==typeof z(RN,this).get)return z(RN,this).get(t)}get renderPlacements(){return z(qN,this).slice()}get placementsAhead(){const t=this.currentTime;return z(UN,this).filter((e=>{const n=Bp(e);if(!Number.isFinite(n))return!1;const i=L(mM,this,UM).call(this,e);return"number"==typeof i?n+i>t:n>=t}))}get buffered(){return z(LN,this)?z(LN,this).buffered:{start:0,end:0}}get trackBuffers(){return z(GN,this)}onDispose(){L(mM,this,IM).call(this),z(QN,this)&&z(QN,this).clear(),z(hM,this)&&"function"==typeof z(hM,this).dispose&&z(hM,this).dispose(),j(hM,this,null),L(mM,this,TM).call(this),L(mM,this,EM).call(this),z(dM,this)&&"function"==typeof z(dM,this).dispose&&z(dM,this).dispose(),j(dM,this,null),z(WN,this)&&"function"==typeof z(WN,this).dispose&&(z(lM,this)&&"function"==typeof z(WN,this).off&&(z(WN,this).off("tick",z(lM,this)),j(lM,this,null)),z(WN,this).dispose(),j(WN,this,null)),L(mM,this,KM).call(this),j(LN,this,null),j(BN,this,null),j(UN,this,[]),j(qN,this,[]),L(mM,this,XM).call(this),L(mM,this,YM).call(this),z(cM,this).clear(),j(uM,this,null)}notifyDecodedFrame(t={}){const e=null==t?void 0:t.placementId,n=null==t?void 0:t.trackType;if(!e||!n)return;const i=`${e}:${n}`;z(YN,this).add(i),L(mM,this,rF).call(this,t),L(mM,this,lF).call(this),z(LN,this)&&"function"==typeof z(LN,this).handleDecodedFrame&&z(LN,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=DN(t);Number.isFinite(i)&&i>0&&(e.totalBytes+=i)}))}return e.available=!0,e}(z(cM,this))}hasDecodedFirstFrame(t,e){return!(!t||!e)&&z(YN,this).has(`${t}:${e}`)}getDecodedVisualBuffer(t,e){if(t&&e)return z(cM,this).get(`${t}:${e}`)}computeBuffered(t){const e=z(RN,this);if(e&&"function"==typeof e.get)return z(GN,this).computeBuffered(z(UN,this),t,e)}getActiveRenderPlacement(t=this.currentTime){const e=Number.isFinite(t)?t:this.currentTime,n=Array.isArray(z(qN,this))?z(qN,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 gM(){j(XN,this,!1),this.trigger(Dm.TIMELINE_RESET,{reason:"switch"}),L(mM,this,oF).call(this),z(GN,this)&&"function"==typeof z(GN,this).reset&&z(GN,this).reset(),z(QN,this)&&z(QN,this).clear(),j(UN,this,[]),j(qN,this,[]),L(mM,this,XM).call(this),L(mM,this,YM).call(this),z($N,this).reset(),z(VN,this).reset()}function yM(t=[]){for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||!n.nodeId)continue;const i=L(mM,this,kM).call(this,n),r=L(mM,this,wM).call(this,n);this.placeOnTimeline(n.nodeId,r,i)}}function bM(t=[]){for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||!n.type)continue;const i=L(mM,this,xM).call(this,n),r=L(mM,this,_M).call(this,n);this.placeRenderNodeOnTimeline(n.type,r,n.duration,i)}}function kM(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 xM(t){const e={};return t.renderPlacementId&&(e.renderPlacementId=t.renderPlacementId),t.params&&"object"==typeof t.params&&(e.params=t.params),e}function wM(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 _M(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 TM(){z(LN,this)&&"function"==typeof z(LN,this).exit&&z(LN,this).exit()}function IM(){z(fM,this)&&"function"==typeof this.off&&(this.off(Dm.TIMELINE_SEEKED,z(fM,this)),j(fM,this,null)),z(pM,this)&&"function"==typeof this.off&&(this.off("nodestart",z(pM,this)),j(pM,this,null))}function EM(){z(GN,this)&&(z(HN,this)&&(z(GN,this).off("track:underflow",z(HN,this)),j(HN,this,null)),z(KN,this)&&(z(GN,this).off("track:ready",z(KN,this)),j(KN,this,null)),"function"==typeof z(GN,this).dispose&&z(GN,this).dispose(),j(GN,this,null))}function SM(){z(GN,this)&&"function"==typeof z(GN,this).on&&(j(HN,this,(t=>L(mM,this,MM).call(this,t))),j(KN,this,(t=>L(mM,this,FM).call(this,t))),z(GN,this).on(Dm.TRACK_UNDERFLOW,z(HN,this)),z(GN,this).on(Dm.TRACK_READY,z(KN,this)))}function AM(){z(WN,this)&&"function"==typeof z(WN,this).on&&(j(lM,this,(t=>L(mM,this,NM).call(this,t))),z(WN,this).on(Dm.CLOCK_TICK,z(lM,this)))}function NM(t){var e,n;L(mM,this,BM).call(this),L(mM,this,lF).call(this),null!==(e=z(hM,this))&&void 0!==e&&null!==(n=e.handleTimeUpdate)&&void 0!==n&&n.call(e,this.currentTime,{isSeeking:!1}),L(mM,this,RM).call(this,this.currentTime),this.trigger(Dm.TIMELINE_TIME_UPDATE,Rm(this.currentTime,"clock")),z(LN,this)&&"function"==typeof z(LN,this).handleClockTick&&z(LN,this).handleClockTick(t)}function MM(t){L(mM,this,BM).call(this);const e=L(mM,this,OM).call(this);e&&(null==t?void 0:t.trackType)===e.trackType&&(z(LN,this)&&"function"==typeof z(LN,this).handleMainTrackUnderflow?z(LN,this).handleMainTrackUnderflow(t):this.transitionTo(Um))}function FM(t){if(L(mM,this,BM).call(this),this.state!==Um)return;const e=L(mM,this,OM).call(this);if(!e)return;if((null==t?void 0:t.trackType)!==e.trackType)return;if(z(LN,this)&&"function"==typeof z(LN,this).handleMainTrackReady)return void z(LN,this).handleMainTrackReady(t);const n=this.getLastStableState()||$m;this.transitionTo(n)}function OM(t=this.currentTime){const e=L(mM,this,PM).call(this,t);if(!e)return;const n=z(RN,this)&&"function"==typeof z(RN,this).get?z(RN,this).get(e.nodeId):void 0;if(!n)return;const i=L(mM,this,CM).call(this,n);return i?{placement:e,trackType:i}:void 0}function CM(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 PM(t=this.currentTime){const e=z(UN,this)||[];let n;for(let i=0;i<e.length;i+=1){const r=e[i],o=Bp(r);if(!Number.isFinite(o))continue;const s=L(mM,this,UM).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 DM(t={}){if(this.state!==Wm)return;const e=null==t?void 0:t.placementId;if(!e)return;const n=L(mM,this,hF).call(this,e);n&&L(mM,this,LM).call(this,n)}function RM(t=this.currentTime){if(this.state!==Wm)return;const e=L(mM,this,aF).call(this,t);Array.isArray(e)&&e.length&&e.forEach((t=>L(mM,this,LM).call(this,t)))}function LM(t){const e=null==t?void 0:t.placementId;if(!e)return;if(z(QN,this).has(e))return;if(!t||!0!==t.loop)return;if(!t.nodeId)return;const n=L(mM,this,UM).call(this,t);if(!Number.isFinite(n)||n<=0)return;const i=Bp(t);if(!Number.isFinite(i))return;const r=i+n;if(!Number.isFinite(r))return;const o=t.loopRootPlacementId||t.placementId,s=Number.isFinite(t.loopRootOffset)?t.loopRootOffset:i;z(QN,this).add(e),this.placeOnTimeline(t.nodeId,r,{nodeOffsetOverride:t.nodeOffsetOverride,nodeDurationOverride:t.nodeDurationOverride,loop:!0,loopRootPlacementId:o,loopRootOffset:s})}function BM(){const t=jp(z(UN,this),{getPlacementDuration:t=>L(mM,this,UM).call(this,t),snapPlacementOffset:(t,e)=>L(mM,this,$M).call(this,t,{nodeOffsetOverride:null==e?void 0:e.nodeOffsetOverride}),onResolvedPlacement:(t,e)=>{!0!==t.loop||Number.isFinite(t.loopRootOffset)||(t.loopRootOffset=t.offset),L(mM,this,GM).call(this,null==e?void 0:e.nodeId)}});return t.updated&&(L(mM,this,YM).call(this),t.resolvedPlacements.forEach((t=>{L(mM,this,JM).call(this,t),this.trigger(Dm.PLACEMENT_ADDED,t)}))),t.updated}function zM(){if(!z(qN,this).length||!z(UN,this).length)return!1;const t=new Map;z(UN,this).forEach((e=>{(null==e?void 0:e.placementId)&&t.set(e.placementId,e)}));const e=z(qN,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];L(mM,this,WM).call(this,o,t)&&(n=!0,i.push(o))}return n&&(Wp(z(qN,this)),i.forEach((t=>{this.trigger(Dm.RENDER_PLACEMENT_ADDED,t)}))),n}function WM(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=L(mM,this,jM).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 Vp(z(qN,this).filter((e=>e!==t&&!0!==(null==e?void 0:e.offsetPending))),s,a,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements"),L(mM,this,GM).call(this,null==r?void 0:r.nodeId),!0}function jM(t,e){const n=Bp(t);if(!Number.isFinite(n))return;if("start"===e.offsetAnchorEdge)return L(mM,this,$M).call(this,n);const i=L(mM,this,UM).call(this,t);if(!(i>0))return;const r=n+i;if(!Number.isFinite(r))return;const o=L(mM,this,$M).call(this,r);return!0===e.offsetAnchorIsReference?Math.max(o,r):o}function UM(t){return Rp(t,z(RN,this))}function $M(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 qM(t,e={}){const n=qp(t);if("string"==typeof t&&t.includes("@")&&!n)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");if(!n){const n=Up(t);return{offset:L(mM,this,$M).call(this,n,e)}}const i=z(UN,this).find((t=>(null==t?void 0:t.placementId)===n.placementId));if(!i)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");const r=Bp(i);if("start"===n.anchor)return Number.isFinite(r)?{offset:L(mM,this,$M).call(this,r,e)}:{offset:void 0,offsetPending:!0,offsetAnchorPlacementId:i.placementId,offsetAnchorEdge:"start",offsetAnchorIsReference:!0};const o=L(mM,this,UM).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=L(mM,this,$M).call(this,s,e);return{offset:Math.max(a,s)}}function VM(t){if(!t||!z(RN,this)||"function"!=typeof z(RN,this).get)return;if(z(JN,this).has(t))return;let e;try{e=z(RN,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),L(mM,this,GM).call(this,t)};e.on(Dm.NODE_LOADED,n),z(JN,this).set(t,n)}function GM(t){if(!t)return;if(L(mM,this,HM).call(this,t))return;const e=z(JN,this).get(t);if(!e)return;let n;try{n=z(RN,this).get(t)}catch(t){n=null}n&&"function"==typeof n.off&&n.off(Dm.NODE_LOADED,e),z(JN,this).delete(t)}function HM(t){if(!t)return!1;const e=new Map;z(UN,this).forEach((t=>{(null==t?void 0:t.placementId)&&e.set(t.placementId,t)}));const n=n=>{if(null==n||!n.offsetPending||null==n||!n.offsetAnchorPlacementId)return!1;const i=e.get(n.offsetAnchorPlacementId);return(null==i?void 0:i.nodeId)===t};return!!z(UN,this).some((t=>n(t)))||!!z(qN,this).some((t=>n(t)))}function KM(){z(JN,this).size&&z(RN,this)?(z(JN,this).forEach(((t,e)=>{let n;try{n=z(RN,this).get(e)}catch(t){n=null}n&&"function"==typeof n.off&&n.off(Dm.NODE_LOADED,t)})),z(JN,this).clear()):z(JN,this).clear()}function XM(){j(ZN,this,[]),j(tM,this,0),z(eM,this).clear(),z(nM,this).clear(),j(iM,this,Number.NEGATIVE_INFINITY)}function YM(){j(rM,this,[]),j(sM,this,0),j(oM,this,Number.NEGATIVE_INFINITY)}function QM(t,e){const n=z(ZN,this),i={placementId:t,endTime:e};if(!n.length||e>=n[n.length-1].endTime)return void n.push(i);const r=n.findIndex((t=>e<t.endTime)),o=-1===r?n.length:r;n.splice(o,0,i),o<z(tM,this)&&j(tM,this,z(tM,this)+1)}function JM(t){const e=null==t?void 0:t.placementId;if(!e||z(eM,this).has(e))return;const n=Bp(t),i=L(mM,this,UM).call(this,t);if(!Number.isFinite(n)||!Number.isFinite(i)||i<0)return void z(nM,this).add(e);const r=n+i;Number.isFinite(r)&&(z(eM,this).add(e),z(nM,this).delete(e),L(mM,this,QM).call(this,e,r))}function ZM(){z(nM,this).size&&Array.from(z(nM,this)).forEach((t=>{const e=L(mM,this,hF).call(this,t);e?L(mM,this,JM).call(this,e):z(nM,this).delete(t)}))}function tF(t){const e=Number(t);if(!Number.isFinite(e))return;if(e<z(iM,this))return void j(iM,this,e);if(j(iM,this,e),L(mM,this,ZM).call(this),!z(ZN,this).length)return;const n=new Set;let i=z(tM,this);for(;i<z(ZN,this).length;){const t=z(ZN,this)[i];if(!t||!Number.isFinite(t.endTime)||t.endTime>e)break;t.placementId&&n.add(t.placementId),i+=1}i!==z(tM,this)&&(j(tM,this,i),n.size&&(L(mM,this,iF).call(this,n),L(mM,this,eF).call(this,n)))}function eF(t){if(t&&t.size)for(const e of z(YN,this)){const n=e.split(":")[0];t.has(n)&&z(YN,this).delete(e)}}function nF(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 iF(t){if(t&&t.size)for(const[e,n]of z(cM,this).entries())t.has(null==n?void 0:n.placementId)&&(L(mM,this,nF).call(this,n),z(cM,this).delete(e))}function rF(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=pN(a),c=Number.isFinite(null==l?void 0:l.width)?l.width:void 0,u=Number.isFinite(null==l?void 0:l.height)?l.height:void 0,d=Number.isFinite(null==t?void 0:t.pts)?t.pts:void 0;if(!Number.isFinite(d))return;const h=Number.isFinite(null==t?void 0:t.duration)?t.duration:void 0,f=`${n}:${r}`,p=z(cM,this).get(f),m=p||{placementId:n,nodeId:i,trackId:r,trackType:s,frames:[],current:void 0},v={placementId:n,nodeId:i,trackId:r,segmentId:o,frame:a,width:c,height:u,presentationTime:d,duration:h},g=m.frames,y=g.length?g[g.length-1]:void 0;if(!y||y.presentationTime<=v.presentationTime)g.push(v);else{let t=g.findIndex((t=>t.presentationTime>v.presentationTime));-1===t&&(t=g.length),g.splice(t,0,v)}const b=Number(null===(e=this.settings)||void 0===e?void 0:e.maxBufferedVideoFrames);if("video"===s&&Number.isFinite(b)&&b>0&&g.length>b){const t=g.length-b;for(let e=0;e<t;e+=1){const t=g.pop(),e=null==t?void 0:t.frame;if(e&&"function"==typeof e.close)try{e.close()}catch(t){}}}p||z(cM,this).set(f,m)}function oF(){for(const t of z(cM,this).values())L(mM,this,nF).call(this,t);z(cM,this).clear(),j(uM,this,null),z(YN,this).clear()}function sF(t){const e=Number.isFinite(t)?t:this.currentTime;if(!Number.isFinite(e))return;e<z(oM,this)&&(j(rM,this,[]),j(sM,this,0));const n=Array.isArray(z(UN,this))?z(UN,this):[],i=[],r=new Set;z(rM,this).forEach((t=>{L(mM,this,gF).call(this,t,e)&&(i.push(t),(null==t?void 0:t.placementId)&&r.add(t.placementId))}));let o=z(sM,this);for(;o<n.length;){const t=n[o],s=Bp(t);if(!Number.isFinite(s))break;if(s>e)break;if(L(mM,this,gF).call(this,t,e)){const e=null==t?void 0:t.placementId;e&&r.has(e)||(i.push(t),e&&r.add(e))}o+=1}j(rM,this,i),j(sM,this,o),j(oM,this,e)}function aF(t,e={}){const n=Number.isFinite(t)?t:this.currentTime,i=Number.isFinite(null==e?void 0:e.endEpsilonSeconds)?e.endEpsilonSeconds:0;return 0===i&&n===this.currentTime&&n===z(oM,this)?z(rM,this).slice():(Array.isArray(z(UN,this))?z(UN,this):[]).filter((t=>L(mM,this,gF).call(this,t,n,i)))}function lF(){const t=this.currentTime,e=L(mM,this,uF).call(this,t);if(!e.length)return void j(uM,this,null);const n=this.getActiveRenderPlacement(t),i=L(mM,this,dF).call(this,e,n);(i!==z(uM,this)||L(mM,this,cF).call(this,t,n))&&(j(uM,this,i),this.trigger(Dm.VISUAL_FRAMES_AVAILABLE,{time:t,frames:e}))}function cF(t,e){const n=e||this.getActiveRenderPlacement(t);if(!n)return!1;if(!am.doesRenderNodeTypeRequireFrameCadence(null==n?void 0:n.type))return!1;const i=n.duration;return"number"==typeof i&&i>0}function uF(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){cN(c),a.push(t);continue}if("function"==typeof r&&!r(u,n)){const e=uN(u),i="function"==typeof o?o(u):void 0;Number.isFinite(i)&&Number.isFinite(e)&&n>=e+i&&(cN(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&&lN(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:uN(u),placementSortOffset:dN(u),placementSortId:hN(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=fN(r),a=fN(o);return Number.isFinite(s)&&Number.isFinite(a)&&s!==a?s-a:r&&o&&r!==o?r<o?-1:1:function(t,e){const n=(null==t?void 0:t.frame)||{},i=(null==e?void 0:e.frame)||{};return n.trackId!==i.trackId?n.trackId<i.trackId?-1:1:n.nodeId!==i.nodeId?n.nodeId<i.nodeId?-1:1:n.segmentId!==i.segmentId?n.segmentId<i.segmentId?-1:1:("number"==typeof n.presentationTime?n.presentationTime:0)-("number"==typeof i.presentationTime?i.presentationTime:0)}(t,e)})),s.map((t=>t.frame))}({buffers:z(cM,this),time:t,getPlacementById:t=>L(mM,this,hF).call(this,t),isPlacementActiveAtTime:(t,e)=>L(mM,this,gF).call(this,t,e),getPlacementDuration:t=>L(mM,this,UM).call(this,t)})}function dF(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 hF(t){if(t)return(z(UN,this)||[]).find((e=>(null==e?void 0:e.placementId)===t))}function fF(t){if("end"===t){const t=L(mM,this,pF).call(this);if(!Number.isFinite(t))return;const e=L(mM,this,mF).call(this);return Math.max(0,t-Math.min(t,e))}const e=Number(t);return Number.isFinite(e)?e:0}function pF(){let t;return(Array.isArray(z(UN,this))?z(UN,this):[]).forEach((e=>{const n=Bp(e);if(!Number.isFinite(n))return;const i=L(mM,this,UM).call(this,e);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(t)||r>t)&&(t=r)})),t}function mF(){const t=L(mM,this,vF).call(this);return t>0?t:.001}function vF(){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 gF(t,e,n=0){if(!zp(t,e,z(RN,this)))return!1;const i=Number(n);if(!Number.isFinite(i)||i<=0)return!0;const r=L(mM,this,UM).call(this,t);if(!Number.isFinite(r))return!0;const o=Bp(t);return!Number.isFinite(o)||e<o+r-i}var yF=new WeakMap,bF=new WeakMap,kF=new WeakMap,xF=new WeakMap,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,OF=new WeakMap,CF=new WeakMap,PF=new WeakMap,DF=new WeakSet;class RF extends Du{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),U(this,DF),W(this,yF,void 0),W(this,bF,void 0),W(this,kF,1),W(this,xF,1),W(this,wF,1),W(this,_F,""),W(this,TF,0),W(this,IF,[]),W(this,EF,null),W(this,SF,void 0),W(this,AF,[]),W(this,NF,null),W(this,MF,null),W(this,FF,0),W(this,OF,0),W(this,CF,0),W(this,PF,void 0);const[e]=t;j(yF,this,e),j(FF,this,Lg()),j(PF,this,L(DF,this,LF).call(this)),L(DF,this,BF).call(this),L(DF,this,zF).call(this),L(DF,this,qF).call(this),L(DF,this,UF).call(this)}get publicAPI(){return z(PF,this)}calcScore(){L(DF,this,ZF).call(this)}onDispose(){z(yF,this)&&z(bF,this)&&"function"==typeof z(yF,this).off&&z(yF,this).off(Dm.TIMELINE_PLAYER_STATE,z(bF,this)),j(bF,this,null),L(DF,this,$F).call(this),L(DF,this,VF).call(this),j(yF,this,null),j(AF,this,[]),j(IF,this,[]),j(PF,this,null)}}function LF(){const t=this;return{get score(){return z(kF,t)},get status(){return z(_F,t)},get streamQualityScore(){return z(xF,t)},get fpsScore(){return z(wF,t)},get browserFps(){return z(TF,t)},get waitingSeconds(){return z(OF,t)/1e3},get playingSeconds(){return z(CF,t)/1e3}}}function BF(){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 zF(){z(yF,this)&&"function"==typeof z(yF,this).on&&(j(bF,this,(t=>L(DF,this,WF).call(this,t))),z(yF,this).on(Dm.TIMELINE_PLAYER_STATE,z(bF,this)))}function WF(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||L(DF,this,jF).call(this,null):L(DF,this,jF).call(this,"waiting"):L(DF,this,jF).call(this,"playing")}function jF(t){if(t===z(NF,this))return;const e=Lg();z(NF,this)&&Number.isFinite(z(MF,this))&&z(AF,this).push({state:z(NF,this),startMs:z(MF,this),endMs:e}),j(NF,this,t),j(MF,this,t?e:null),L(DF,this,KF).call(this,e)}function UF(){const t=Number(this.settings.calcScoreInterval);!Number.isFinite(t)||t<=0||(j(SF,this,(()=>L(DF,this,ZF).call(this))),kk(z(SF,this),1e3*t))}function $F(){z(SF,this)&&xk(z(SF,this)),j(SF,this,null)}function qF(){if("function"!=typeof uk)return;const t=()=>{if(this._disposed)return;const e=Lg();j(TF,this,L(DF,this,GF).call(this,z(IF,this),e)),j(EF,this,uk(t))};j(EF,this,uk(t))}function VF(){z(EF,this)&&"function"==typeof dk&&dk(z(EF,this)),j(EF,this,null)}function GF(t,e){const n=L(DF,this,HF).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 HF(){const t=Number(this.settings.windowSeconds);return!Number.isFinite(t)||t<=0?3e4:1e3*t}function KF(t){const e=t-L(DF,this,HF).call(this);for(;z(AF,this).length&&z(AF,this)[0].endMs<=e;)z(AF,this).shift()}function XF(t){const e=t-L(DF,this,HF).call(this);let n=0,i=0;const r=(r,o,s)=>{const a=Math.max(o,e),l=Math.min(s,t);l<=a||("waiting"===r?n+=l-a:"playing"===r&&(i+=l-a))};return z(AF,this).forEach((t=>{r(t.state,t.startMs,t.endMs)})),z(NF,this)&&Number.isFinite(z(MF,this))&&r(z(NF,this),z(MF,this),t),j(OF,this,n),j(CF,this,i),{waitingMs:n,playingMs:i}}function YF(t,e){if(t<=0)return 1;if(t>e)return 0;const n=e||1;return Pp(1-t*this.settings.waitingMultiplier/n)}function QF(){if(Lg()-z(FF,this)<=1e3*this.settings.fpsGracePeriod)return 1;const t=Number(z(TF,this)),e=Cm.isDesktop()?this.settings.bestFpsDesktop:this.settings.bestFpsMobile,n=Pp(e>0?t/e:0);return"quad"===this.settings.fpsMathFuncType?n*n:n}function JF(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 ZF(){const t=Lg(),{waitingMs:e,playingMs:n}=L(DF,this,XF).call(this,t),i=L(DF,this,YF).call(this,e,n),r=L(DF,this,QF).call(this),o=Pp(i*this.settings.streamQualityWeight+r*this.settings.fpsWeight);o!==z(kF,this)&&(j(kF,this,o),this.trigger(Dm.QOE_SCORE,o)),j(xF,this,i),j(wF,this,r);const s=L(DF,this,JF).call(this,o,e);s!==z(_F,this)&&(j(_F,this,s),this.trigger(Dm.QOE_STATUS,s))}function tO(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}function eO(t){const e=Number(t);return!Number.isFinite(e)||e<0?0:e}var nO=new WeakMap,iO=new WeakMap,rO=new WeakMap,oO=new WeakMap,sO=new WeakSet;class aO extends Du{get name(){return"SegmentEvictionCoordinator"}get defaults(){return{enabled:ty("segmentEvictionEnabled"),bufferBehindSeconds:ty("segmentEvictionBufferBehindSeconds"),bufferAheadSeconds:ty("segmentEvictionBufferAheadSeconds"),maxRetainedBytes:ty("segmentEvictionMaxRetainedBytes")}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"evictAtTime"])}constructor(t,e,n={}){super(n),U(this,sO),W(this,nO,void 0),W(this,iO,void 0),W(this,rO,void 0),W(this,oO,void 0),j(nO,this,t),j(iO,this,e),j(rO,this,(t=>L(sO,this,lO).call(this,t))),j(oO,this,(t=>L(sO,this,cO).call(this,t))),z(nO,this)&&"function"==typeof z(nO,this).on&&(z(nO,this).on(Dm.TIMELINE_TIME_UPDATE,z(rO,this)),z(nO,this).on(Dm.TIMELINE_SEEKED,z(oO,this)))}onDispose(){z(nO,this)&&"function"==typeof z(nO,this).off&&(z(nO,this).off(Dm.TIMELINE_TIME_UPDATE,z(rO,this)),z(nO,this).off(Dm.TIMELINE_SEEKED,z(oO,this))),j(nO,this,null),j(iO,this,null),j(rO,this,null),j(oO,this,null)}evictAtTime(t){if(!0!==this.settings.enabled)return;const e=Number(t);if(!Number.isFinite(e))return;const n=eO(this.settings.bufferBehindSeconds),i=eO(this.settings.bufferAheadSeconds),r=e-n,o=e+i,s=L(sO,this,uO).call(this);if(!s.length)return;const a=Number(this.settings.maxRetainedBytes);if(Number.isFinite(a)&&a>0&&L(sO,this,dO).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=Bp(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=L(sO,this,hO).call(this,e);if(!n)return;const i=t.filter((t=>L(sO,this,fO).call(this,t,r,o)));i.length?L(sO,this,pO).call(this,n,i,r,o):"function"==typeof n.evict&&n.evict()}))}}function lO(t){var e,n;if(!0!==this.settings.enabled)return;if((null===(e=z(nO,this))||void 0===e?void 0:e.state)===qm)return;const i=Number(null==t?void 0:t.time),r=Number.isFinite(i)?i:Number(null===(n=z(nO,this))||void 0===n?void 0:n.currentTime);this.evictAtTime(r)}function cO(t){var e;if(!0!==this.settings.enabled)return;const n=Number(null==t?void 0:t.targetTime),i=Number.isFinite(n)?n:Number(null===(e=z(nO,this))||void 0===e?void 0:e.currentTime);this.evictAtTime(i)}function uO(){var t;const e=null===(t=z(nO,this))||void 0===t?void 0:t.placements;return Array.isArray(e)?e:[]}function dO(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=L(sO,this,hO).call(this,i),o=Number(null==r?void 0:r.retainedByteLength);dg(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=>{dg(null==t?void 0:t.retainedByteLength)&&(n+=t.retainedByteLength)}))}))})),n}function hO(t){if(z(iO,this)&&"function"==typeof z(iO,this).get)return z(iO,this).get(t)}function fO(t,e,n){const i=Bp(t);if(!Number.isFinite(i))return!1;const r=Rp(t,z(iO,this));return(Number.isFinite(r)?i+r:Number.POSITIVE_INFINITY)>e&&i<n}function pO(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=tO(null==t?void 0:t.offset,0);r.forEach((t=>{if(!t||!dg(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=Bp(a);if(!Number.isFinite(l))continue;const c=tO(null==a?void 0:a.nodeOffsetOverride,0),u=tO(null==t?void 0:t.offset,NaN);if(!Number.isFinite(u))continue;const d=tO(null==t?void 0:t.duration,0),h=l+o+u-c,f=h+(d>0?d:0),p=Rp(a,z(iO,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 mO=new WeakMap,vO=new WeakMap,gO=new WeakMap,yO=new WeakSet;class bO extends Du{get name(){return"DocumentVisibility"}get defaults(){return{autoPauseOnVisibilityChange:!0,autoResumeOnVisibilityChange:!0}}constructor(t,e={}){super(e),U(this,yO),W(this,mO,void 0),W(this,vO,null),W(this,gO,!1),j(mO,this,t),L(yO,this,kO).call(this)}onDispose(){L(yO,this,xO).call(this),j(mO,this,null),j(gO,this,!1)}}function kO(){const t=null==Bu?void 0:Bu.document;t&&"function"==typeof t.addEventListener&&(j(vO,this,(()=>L(yO,this,wO).call(this))),t.addEventListener("visibilitychange",z(vO,this)))}function xO(){const t=null==Bu?void 0:Bu.document;z(vO,this)&&t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",z(vO,this)),j(vO,this,null)}function wO(){const t=null==Bu?void 0:Bu.document,e=null==t?void 0:t.visibilityState;"string"==typeof e&&("hidden"!==e?"visible"===e&&L(yO,this,TO).call(this):L(yO,this,_O).call(this))}function _O(){var t;(null===(t=this.settings)||void 0===t?void 0:t.autoPauseOnVisibilityChange)&&z(mO,this)&&"function"==typeof z(mO,this).pause&&(z(mO,this).state===Wm?(this.log.info("[#handleHidden] Pausing timeline due to document visibility change"),z(mO,this).pause(),j(gO,this,!0)):j(gO,this,!1))}function TO(){var t;z(gO,this)&&(null===(t=this.settings)||void 0===t?void 0:t.autoResumeOnVisibilityChange)&&z(mO,this)&&"function"==typeof z(mO,this).play&&(z(mO,this).state!==Wm?(this.log.info("[#handleVisible] Resuming timeline due to document visibility change"),z(mO,this).play(),j(gO,this,!1)):j(gO,this,!1))}const IO=[{event:"canplay",once:!0,trackAs:"canplay"},{event:"playing",once:!0,trackAs:"startedplaying"},"play","playing","waiting","pause","seeking","seeked","nodestart","nodeend"];function EO(t,e=0){return Number.isFinite(t)?t:e}function SO(t){const e=null==t?void 0:t.exposedPlayerAPI;return e&&"object"==typeof e?e:t}const AO=[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:EO(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:EO(null==r?void 0:r.volume),playercontainerwidth:EO(null==r?void 0:r.containerWidth),playercontainerheight:EO(null==r?void 0:r.containerHeight)}}}},function(t){return{schema:"iglu:com.helloeko/currentnode/jsonschema/1-0-1",match:/^.*$/,getData:()=>{var e;const n=SO(t),i=function(t){const e=SO(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==Bu||null===(t=Bu.eko)||void 0===t||null===(t=t.environment)||void 0===t?void 0:t.embeddingApp;return e?{embeddingapp:e}:{}}}}],NO=Object.freeze({once:!1,trackAs:""});var MO=new WeakMap,FO=new WeakMap,OO=new WeakMap,CO=new WeakMap,PO=new WeakSet;class DO extends Du{get name(){return"Tracker"}get defaults(){return{trackingEnabled:ty("trackingEnabled"),defaultForwarders:IO,defaultContextPackers:AO}}constructor(t,e={}){super(e),U(this,PO),W(this,MO,void 0),W(this,FO,new Map),W(this,OO,[]),W(this,CO,!1),j(MO,this,t),L(PO,this,jO).call(this),L(PO,this,RO).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=L(PO,this,$O).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=L(PO,this,$O).call(this);n&&n("registerContextPacker",e)}onDispose(){L(PO,this,WO).call(this),L(PO,this,UO).call(this),j(MO,this,null),j(CO,this,!1)}}function RO(){(Array.isArray(this.settings.defaultForwarders)?this.settings.defaultForwarders:[]).forEach((t=>L(PO,this,LO).call(this,t)))}function LO(t){const e=L(PO,this,BO).call(this,t);if(!e)return void this.log.warn("[#addEventForwarder] Invalid forwarder input.",t);const n=z(MO,this);if(!n||"function"!=typeof n.on)return;const i=L(PO,this,zO).call(this,e);if(z(FO,this).has(i))return;const r=(...t)=>{e.once&&n&&"function"==typeof n.off&&n.off(e.event,r);const i=e.trackAs||e.event;this.track(i,...t)};n.on(e.event,r),z(FO,this).set(i,{event:e.event,listener:r})}function BO(t){return"string"==typeof t&&t?{event:t,...NO}: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 zO({event:t,once:e,trackAs:n}){return`${t}:${e}:${n}`}function WO(){const t=z(MO,this);t&&"function"==typeof t.off&&z(FO,this).forEach((({event:e,listener:n})=>{t.off(e,n)})),z(FO,this).clear()}function jO(){(Array.isArray(this.settings.defaultContextPackers)?this.settings.defaultContextPackers:[]).forEach((t=>{if("function"!=typeof t)return;const e=t(z(MO,this),this);e&&"object"==typeof e&&("function"==typeof e.dispose&&z(OO,this).push(e.dispose),e.disabled||this.registerContextPacker({schema:e.schema,match:e.match,getData:e.getData}))}))}function UO(){z(OO,this).forEach((t=>{try{t()}catch(t){this.log.warn("[#teardownContextPackers] Failed disposing context packer.",t)}})),j(OO,this,[])}function $O(){const t=null==Bu?void 0:Bu.EkoAnalytics;return"function"==typeof t?t:(L(PO,this,qO).call(this),null)}function qO(){this.settings.trackingEnabled&&!z(CO,this)&&(this.log.warn("EkoAnalytics not found on window."),j(CO,this,!0))}class VO{#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 Wu(t,e),this.#rt=new Ku(this.#E,e),this.#ot=new nk(e),this.#st=new ay(e),this.#at=new Lb(this.#st,e),this.#lt=new Ob(this.#at,this.#ot,e),this.#ct=new Vb(this.#lt,e),this.#ut=new vM(this.#lt,e),this.#dt=new bO(this.#ut,e),this.#kt=new aO(this.#ut,this.#lt,e),this.#ht=new Uk(this.#lt,this.#ct,this.#ot,this.#ut,e),this.#ft=new Ax(this.#lt,this.#ct,this.#ut,e),this.#pt=new BI(e),this.#mt=new cE(this.#lt,this.#ut,this.#pt,e),this.#gt=new RF(this.#ut,e),this.#xt=new DO(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 Mv(this.#ut,this.#E,this.#rt,e),this.#vt=o?o({timeline:this.#ut,decodeCoordinator:this.#mt,options:e}):new VS(this.#ut,this.#mt,e),this.#bt=new dS(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 GO="main.1155755";var HO={isPlainObject:Mu,deepMerge:Fu,get:Cg,set:Pg,ekoGlobalStore:Dg,download:Yg,isPositiveNumber:dg,clamp01:Pp,root:Bu,now:Lg,getFrameDimensions:pN,useragent:Pm,requestAnimationFrame:uk,cancelAnimationFrame:dk,start:kk,stop:xk,isTicking:wk,predicator:function(t,e){const n=e||{};if("function"!=typeof t)return void hk.error("[predicator] Bad argument given to predicator, first argument must be a function.",arguments);if(t.apply())return hk.debug("[predicator] Invoking onFulfilled immediately."),void("function"==typeof n.onFulfilled&&n.onFulfilled.call(null,0));const i=n.timeout||1e4,r=n.interval,o=Lg();let s,a,l,c,u;c=function(){t.apply()&&l()},l=function(){xk(c),Bu.clearTimeout(s),u=Lg()-o,hk.debug("[predicator] Invoking onFulfilled after "+u+" ms."),"function"==typeof n.onFulfilled&&n.onFulfilled.call(null,u)},a=function(){xk(c),u=Lg()-o,hk.debug("[predicator] Invoking onTimeout after "+u+" ms."),"function"==typeof n.onTimeout&&n.onTimeout.call(null,u)},s=Bu.setTimeout(a,i),kk(c,r)},createThrottler:_k,scheduleExecution:Tk},KO=new WeakMap,XO=new WeakMap,YO=new WeakMap,QO=new WeakMap,JO=new WeakMap,ZO=new WeakMap,tC=new WeakMap,eC=new WeakSet;class nC{constructor(t){U(this,eC),W(this,KO,[]),W(this,XO,[]),W(this,YO,new CN("placement-")),W(this,QO,new CN("renderplacement-")),W(this,JO,void 0),W(this,ZO,new Map),W(this,tC,void 0),j(JO,this,t),j(tC,this,{allowUnready:!0,getNode:t=>L(eC,this,iC).call(this,t)})}get placements(){return z(KO,this).slice()}get renderPlacements(){return z(XO,this).slice()}getNodesAtTime(t){L(eC,this,rC).call(this);const e=L(eC,this,sC).call(this,t);if(!Number.isFinite(e))return[];const n=z(KO,this).filter((t=>zp(t,e,null,z(tC,this)))),i=[];return n.forEach((t=>{const e=L(eC,this,iC).call(this,null==t?void 0:t.nodeId);e&&i.push(e)})),i}placeOnTimeline(t,e,n={}){const i=t&&"object"==typeof t?t:null,r=i?i.id:t;if(!r)throw new Error("TimelineDefinition.placeOnTimeline requires node id");i&&z(ZO,this).set(r,i);const o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=qp(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}:$p(e,n);let u,d,h,f=!1;const p=null!==a;if(a){const t=z(KO,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=Bp(t);if("start"===a.anchor)Number.isFinite(e)?u=e:f=!0;else{const n=L(eC,this,oC).call(this,t);Number.isFinite(e)&&n>0?u=e+n:f=!0}}else if(l){const t=n.offsetAnchorPlacementId?z(KO,this).find((t=>(null==t?void 0:t.placementId)===n.offsetAnchorPlacementId)):z(KO,this).length?z(KO,this)[z(KO,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==t?void 0:t.placementId),d){const e=Bp(t),n=L(eC,this,oC).call(this,t);Number.isFinite(e)&&n>0?u=e+n-c:(f=!0,h="end")}else u=-c}else u=Up(e);const m=z(YO,this).claim(n.placementId),v={placementId:m,nodeId:r,offset:u,offsetPending:f,offsetAnchorPlacementId:f?d:void 0,offsetAnchorEdge:f?h:void 0,offsetAnchorIsReference:f?p:void 0,offsetEndSeconds:l?c:a&&"end"===a.anchor?0:void 0,nodeOffsetOverride:o,nodeDurationOverride:s,loop:!0===n.loop};return z(KO,this).push(v),Wp(z(KO,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=qp(e);if("string"==typeof e&&e.includes("@")&&!c)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires valid placement reference");const u=null!==c;if(c){const t=z(KO,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=Bp(t);if("start"===c.anchor)Number.isFinite(e)?o=e:l=!0;else{const n=L(eC,this,oC).call(this,t);Number.isFinite(e)&&Number.isFinite(n)?o=e+n:l=!0}}else o=Up(e);const d=z(QO,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;Vp(z(XO,this),t,e,"TimelineDefinition.placeRenderNodeOnTimeline does not allow overlapping render nodes")}return z(XO,this).push(m),Wp(z(XO,this)),d}}function iC(t){if(t)return z(JO,this)&&"function"==typeof z(JO,this).get?z(JO,this).get(t):z(ZO,this).get(t)}function rC(){return jp(z(KO,this),{getPlacementDuration:t=>L(eC,this,oC).call(this,t)}).updated}function oC(t){return Rp(t,null,z(tC,this))}function sC(t){if("end"===t){const t=L(eC,this,aC).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 aC(){let t;return z(KO,this).forEach((e=>{const n=Bp(e);if(!Number.isFinite(n))return;const i=L(eC,this,oC).call(this,e);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(t)||r>t)&&(t=r)})),t}const lC=new Set(["canplay","play","playing","waiting","pause","seeking","seeked"]);var cC=new WeakMap,uC=new WeakMap,dC=new WeakMap,hC=new WeakMap,fC=new WeakMap,pC=new WeakMap,mC=new WeakMap,vC=new WeakMap,gC=new WeakMap,yC=new WeakMap,bC=new WeakMap,kC=new WeakMap,xC=new WeakMap,wC=new WeakMap,_C=new WeakMap,TC=new WeakMap,IC=new WeakMap,EC=new WeakMap,SC=new WeakMap,AC=new WeakMap,NC=new WeakMap,MC=new WeakMap,FC=new WeakMap,OC=new WeakMap,CC=new WeakMap,PC=new WeakSet;class DC extends Du{get name(){return"EkoPlayer"}get exposedPlayerAPI(){return z(hC,this)}constructor(t,e={}){const{options:n,publicOptions:i}=function(t={}){const e=Fu({},Jg,t);Object.entries(Qg).forEach((([t,{targetPaths:n}])=>{void 0!==e[t]&&n.forEach((n=>{void 0===Cg(e,n)&&Pg(e,n,e[t])}))}));const n=function(t){const e={};return Object.keys(Qg).forEach((n=>{Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})),Object.freeze(e)}(e);return Zg.info("Processed options:",e),Zg.info("Public options:",n),{options:e,publicOptions:n}}(e);return super(n),U(this,PC),W(this,cC,void 0),W(this,uC,void 0),W(this,dC,void 0),W(this,hC,void 0),W(this,fC,void 0),W(this,pC,void 0),W(this,mC,void 0),W(this,vC,void 0),W(this,gC,void 0),W(this,yC,void 0),W(this,bC,void 0),W(this,kC,void 0),W(this,xC,void 0),W(this,wC,void 0),W(this,_C,void 0),W(this,TC,void 0),W(this,IC,void 0),W(this,EC,void 0),W(this,SC,void 0),W(this,AC,void 0),W(this,NC,void 0),W(this,MC,void 0),W(this,FC,void 0),W(this,OC,void 0),W(this,CC,0),j(dC,this,i),this.log.info("Initializing EkoPlayer with options:",i),j(kC,this,new VO(t,n,this)),L(PC,this,VC).call(this,z(kC,this)),j(_C,this,(t=>L(PC,this,RC).call(this,t))),z(uC,this)&&"function"==typeof z(uC,this).on&&z(uC,this).on(Dm.TIMELINE_CUEPOINT,z(_C,this)),j(TC,this,null),j(EC,this,(t=>L(PC,this,LC).call(this,t))),j(SC,this,(t=>{const e=t&&"object"==typeof t?t:{};L(PC,this,LC).call(this,{...e,event:"seeking"})})),j(AC,this,(t=>{const e=t&&"object"==typeof t?t:{};L(PC,this,LC).call(this,{...e,event:"seeked"})})),z(uC,this)&&"function"==typeof z(uC,this).on&&(z(uC,this).on(Dm.TIMELINE_PLAYER_STATE,z(EC,this)),z(uC,this).on(Dm.TIMELINE_SEEKING,z(SC,this)),z(uC,this).on(Dm.TIMELINE_SEEKED,z(AC,this))),j(FC,this,(t=>{const e=t&&"object"==typeof t?t:{};this.trigger(Dm.CONTAINER_RESIZE,e)})),z(xC,this)&&"function"==typeof z(xC,this).on&&z(xC,this).on(Dm.CONTAINER_RESIZE,z(FC,this)),L(PC,this,jC).call(this),L(PC,this,WC).call(this),j(hC,this,L(PC,this,qC).call(this)),z(hC,this)}onDispose(){z(uC,this)&&"function"==typeof z(uC,this).off&&z(_C,this)&&z(uC,this).off(Dm.TIMELINE_CUEPOINT,z(_C,this)),j(_C,this,null),z(uC,this)&&"function"==typeof z(uC,this).off&&(z(EC,this)&&z(uC,this).off(Dm.TIMELINE_PLAYER_STATE,z(EC,this)),z(SC,this)&&z(uC,this).off(Dm.TIMELINE_SEEKING,z(SC,this)),z(AC,this)&&z(uC,this).off(Dm.TIMELINE_SEEKED,z(AC,this))),j(EC,this,null),j(SC,this,null),j(AC,this,null),j(TC,this,null),z(xC,this)&&"function"==typeof z(xC,this).off&&z(FC,this)&&z(xC,this).off(Dm.CONTAINER_RESIZE,z(FC,this)),j(FC,this,null),z(bC,this)&&"function"==typeof z(bC,this).off&&(z(NC,this)&&z(bC,this).off("qoescore",z(NC,this)),z(MC,this)&&z(bC,this).off("qoestatus",z(MC,this))),j(NC,this,null),j(MC,this,null),z(yC,this)&&"function"==typeof z(yC,this).off&&z(OC,this)&&z(yC,this).off(Dm.DECODER_ERROR,z(OC,this)),j(OC,this,null),j(CC,this,0),z(wC,this)&&"function"==typeof z(wC,this).dispose&&z(wC,this).dispose(),j(wC,this,null),z(kC,this)&&"function"==typeof z(kC,this).dispose&&z(kC,this).dispose(),j(uC,this,null),j(cC,this,null),j(pC,this,null),j(mC,this,null),j(vC,this,null),j(gC,this,null),j(yC,this,null),j(bC,this,null),j(xC,this,null),j(fC,this,null),j(hC,this,null),j(kC,this,null)}}function RC(t={}){var e;this.trigger(Dm.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 LC(t={}){const e="string"==typeof(null==t?void 0:t.event)?t.event:"";if(!lC.has(e))return;if("playing"!==e||Number.isFinite(z(IC,this))||(j(IC,this,Lg()),this.log.info(`[#handlePlayerStateEvent] Playback started @ ${(z(IC,this)/1e3).toFixed(3)}s (${Date.now()})`)),z(TC,this)===e)return;j(TC,this,e);const n=Number.isFinite(null==t?void 0:t.time)?t.time:z(uC,this)&&Number.isFinite(z(uC,this).currentTime)?z(uC,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 BC(){return new nC(z(cC,this))}function zC(t){if(!t||"object"!=typeof t)throw new Error("EkoPlayer.switchTimeline requires a timeline definition");if(!z(uC,this)||"function"!=typeof z(uC,this).applyTimelineDefinition)throw new Error("EkoPlayer.switchTimeline requires an active timeline");z(uC,this).applyTimelineDefinition(t),"function"==typeof z(uC,this).play&&z(uC,this).play()}function WC(){z(bC,this)&&"function"==typeof z(bC,this).on&&(j(NC,this,(t=>{this.trigger(Dm.QOE_SCORE,t)})),j(MC,this,(t=>{this.trigger(Dm.QOE_STATUS,t)})),z(bC,this).on(Dm.QOE_SCORE,z(NC,this)),z(bC,this).on(Dm.QOE_STATUS,z(MC,this)))}function jC(){z(yC,this)&&"function"==typeof z(yC,this).on&&(j(OC,this,(t=>{const e=t&&"object"==typeof t?t:{error:t};this.trigger(Dm.DECODER_ERROR,e),L(PC,this,UC).call(this,e)})),z(yC,this).on(Dm.DECODER_ERROR,z(OC,this)))}function UC(t={}){var e;const n=z(uC,this);if(!n||"number"!=typeof n.currentTime)return;const i=Date.now();if(i<z(CC,this))return;const r=Number(n.currentTime);if(!Number.isFinite(r))return;const o=Number(null==n||null===(e=n.settings)||void 0===e?void 0:e.snapToFps),s=Number.isFinite(o)&&o>0?1/o:1/60;j(CC,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 $C(t={}){if(z(wC,this))return z(wC,this);const e=t&&"object"==typeof t&&!Array.isArray(t)?{...t}:{},n=z(fC,this)&&z(fC,this).element?z(fC,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==Bu?void 0:Bu.document)){if(zu(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 zu(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 import("./debug-overlay-BIxN1VnC.esm.js"),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=z(dC,this),e.playerVersion=GO,j(wC,this,o({mountElement:i,canvasElement:n,timeline:z(uC,this),getNode:t=>z(cC,this)&&"function"==typeof z(cC,this).get?z(cC,this).get(t):void 0,listNodes:()=>z(cC,this)&&"function"==typeof z(cC,this).list?z(cC,this).list():[],downloadSpeed:z(kC,this)?z(kC,this).downloadSpeed:void 0,downloadEvents:Ng,qoe:z(bC,this)?z(bC,this).publicAPI:void 0,qoeEvents:this,options:e,playbackStartedAtMs:z(IC,this)})),z(wC,this)}function qC(){const t=this;return{createTimeline:()=>L(PC,t,BC).call(t),switchTimeline:e=>L(PC,t,zC).call(t,e),play:z(uC,this).play,pause:z(uC,this).pause,reset:z(uC,this).reset,placeOnTimeline:z(uC,this).placeOnTimeline,placeRenderNodeOnTimeline:z(uC,this).placeRenderNodeOnTimeline,addNode:z(cC,this).add,getNode:z(cC,this).get,listNodes:z(cC,this).list,getNodesAtTime:e=>z(uC,t).getNodesAtTime(e),dispose:this.dispose,on:t.on,off:t.off,once:t.once,trigger:t.trigger,transitionTo:(e,n)=>z(mC,t).transitionTo(e,n),track:(e,...n)=>{if(z(gC,t)&&"function"==typeof z(gC,t).track)return z(gC,t).track(e,...n)},seekToPlacement:e=>z(uC,t).seekToPlacement(e),get currentTime(){return z(uC,t).currentTime},set currentTime(e){z(uC,t).currentTime=e},get buffered(){return z(uC,t).buffered},get options(){return z(dC,t)},get containerWidth(){return z(xC,t)?z(xC,t).containerWidth:0},get containerHeight(){return z(xC,t)?z(xC,t).containerHeight:0},get playbackRate(){return z(uC,t).playbackRate},set playbackRate(e){z(uC,t).playbackRate=e},get paused(){return!!z(uC,t)&&!0===z(uC,t).paused},get muted(){return!!z(vC,t)&&z(vC,t).muted},set muted(e){z(vC,t)&&(z(vC,t).muted=e)},get volume(){return z(vC,t)?z(vC,t).volume:1},set volume(e){z(vC,t)&&(z(vC,t).volume=e)},get qoe(){return z(bC,t)?z(bC,t).publicAPI:void 0},get utils(){return HO},get version(){return GO},loadDebugOverlay:(...e)=>L(PC,t,$C).call(t,...e)}}function VC(t){t&&(j(fC,this,t.canvas),j(cC,this,t.nodeRepository),j(uC,this,t.timeline),j(vC,this,t.audioAdapter||t.audioPlaybackManager),j(gC,this,t.tracker),j(yC,this,t.parsingManager),j(bC,this,t.qoe),j(pC,this,t.renderAdapter||t.renderer),j(mC,this,t.transitionManager),j(xC,this,t.containerSize))}class GC{constructor({target:t,props:e}){if(!t)throw new Error("`options.target` is required");lo(this.#wt,e,!0),this.#wt.v.EkoPlayer=DC;const n=t.hasChildNodes()?Gs:Vs;this.#_t=n(uu,{target:t,props:this.#wt.v})}#_t;#wt=so(fo({}));destroy(t){if(this.#_t)return function(t,e){const n=Xs.get(t);return n?(Xs.delete(t),n(e)):Promise.resolve()}(this.#_t,t)}get props(){return _s(this.#wt)}}const HC=b("gallery-react");const KC=a(((t,i)=>{const{config:r,debug:a,ssrHtml:c,activeItem:u={index:0,step:0},forceMobile:d,videoAspectRatio:h,onEvent:f=()=>{}}=t,p=n(null),m=n({}),v=function(t){return void 0!==t}(r),g=n(u),y=n(c);m.current.initEventSent||(f("galleryinit"),m.current.initEventSent=!0);const b=o((t=>{m.current.state=t,t.activeItemIndex===g.current.index&&t.activeModuleIndex===g.current.step||f("activeitemchanged",{index:t.activeItemIndex,step:t.activeModuleIndex})}),[]),k=o((t=>{m.current.API=t,0===g.current.index&&0===g.current.step||t.selectItemAndStep(g.current.index,g.current.step),m.current.unsubscribe&&m.current.unsubscribe(),m.current.unsubscribe=t.subscribe(b)}),[]),x=o(((t,e)=>{f(t,e)}),[f]);return s((()=>(HC.setDataStorage("gallery-react",{config:r}),window.eko=window.eko||{},window.eko.config=r,window.eko.gallery={version:"4.0.5"},()=>{window.eko.config=void 0})),[r]),l(i,(()=>({prev:()=>{var t;null===(t=m.current.API)||void 0===t||t.prev()},next:()=>{var t;null===(t=m.current.API)||void 0===t||t.next()}}))),s((()=>{if(null==p||!p.current)return;const t=p.current;return m.current.app=new GC({target:t,props:{config:r,forceMobile:d,videoAspectRatio:h,hideNav:!0,onGalleryReady:k,onEvent:x}}),()=>{var t;null===(t=m.current.app)||void 0===t||t.destroy()}}),[]),s((()=>{m.current.app&&(m.current.app.props.config=r)}),[r]),s((()=>{m.current.app&&(m.current.app.props.debug=a,m.current.app.props.forceMobile=d,m.current.app.props.videoAspectRatio=h,m.current.app.props.onEvent=x)}),[a,d,h,x]),s((()=>{g.current=u,m.current.state&&(m.current.state.activeItemIndex===u.index&&m.current.state.activeModuleIndex===u.step||m.current.API.selectItemAndStep(u.index,u.step))}),[u]),v?e.createElement("div",q({style:{position:"relative",width:"100%",height:"100%"},ref:p},y.current?{dangerouslySetInnerHTML:{__html:y.current}}:{})):t.children}));KC.propTypes={className:Ct.string,config:Ct.object,variantId:Ct.string,onEvent:Ct.func,ssrHtml:Ct.string,videoAspectRatio:Ct.string,debug:Ct.bool,activeItem:Ct.shape({index:Ct.number,step:Ct.number}),forceMobile:Ct.bool,instanceId:Ct.string,children:Ct.node},KC.displayName="EkoGallerySvelte";const XC=d("v2"),YC=d("v1");export{hn as E,U as _,W as a,j as b,z as c,L as d,u as e,YC as f,XC as g,KC as h,R as w};
|