@ekolabs/eko-gallery-react 4.0.10 → 4.0.11-omer-upc-validation-workflow-1168411.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eko-gallery-react.cjs.js +3 -3
- package/dist/index.esm.js +2 -2
- package/dist/server.cjs.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e=require("react");function n(
|
|
1
|
+
"use strict";var e=require("react");function n(e="v1"){return function(t,n="*",i=""){let r=`https://${i}play.eko.com/api/${e}/channels/${t}/configs`;return r+="*"!==n?`/${n}`:"",r}}function i(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}var r={pack:function(e){const t={};if(!i(e))return t;if(e.itemId&&(t.item_id=e.itemId),e.itemName&&(t.item_name=e.itemName),i(e.itemPrice)){const n=e.itemPrice;t.item_price=function(e){const t={};return i(e)&&(e.amount&&(t.amount=Number(e.amount)),e.currency&&(t.currency=e.currency)),t}(n)}return e.quantity&&(t.quantity=Number(e.quantity)),t}};const o="mobile",s="notmobile";function a(){return((window.navigator.userAgentData?window.navigator.userAgentData.mobile:navigator.maxTouchPoints>0&&/Mobile|Android|webOS|iPhone|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&!/Tablet|iPad/i.test(navigator.userAgent))?o:s)===o}const l={};class c{constructor(e){this.key=`eko.${e}`}setDataStorage(e,t){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[e]=t,null===(i=window.localStorage)||void 0===i||i.setItem(this.key,JSON.stringify(r))}catch(e){console.error(`[setDataStorage]: ${e}`)}}getDataStorage(e){if("undefined"!=typeof window)try{var t;let n=null===(t=window.localStorage)||void 0===t?void 0:t.getItem(this.key);return n=JSON.parse(n)||{},n[e]}catch(e){console.error(`[getDataStorage]: ${e}`)}}removeDataStorage(e){if("undefined"!=typeof window)try{var t;let i=null===(t=window.localStorage)||void 0===t?void 0:t.getItem(this.key);var n;if(i)if(i=JSON.parse(i),delete i[e],Object.keys(i).length>0)null===(n=window.localStorage)||void 0===n||n.setItem(this.key,JSON.stringify(i));else this.removeAll()}catch(e){console.error(`[removeDataStorage]: ${e}`)}}removeAll(){if("undefined"!=typeof window)try{var e;null===(e=window.localStorage)||void 0===e||e.removeItem(this.key)}catch(e){console.error(`[removeAll]: ${e}`)}}}function u(e){return l[e]||(l[e]=new c(e)),l[e]}const d=u("gallery-react").getDataStorage("gallery-react");function h(e){window.EkoAnalytics("registerContextPacker",{tag:e,match:/.*/,schema:"iglu:com.helloeko/products/jsonschema/1-0-1",getData(e={}){var t,n;if(e.items)return{items:e.items.map((e=>function(e){const t=r.pack(e);return e.id&&(t.id=e.id),e.sku&&(t.sku=e.sku),e.upc&&(t.upc=e.upc),e.name&&(t.name=e.name),t}(e)))};const i=(null===(t=window.eko)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.product)||(null==d||null===(n=d.config)||void 0===n?void 0:n.product);if(i){return{items:[{id:i.id,item_id:i.sku,sku:i.sku,upc:i.upc,typeid:i.type,name:i.name}]}}return null}})}function f(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}function p(e){const t={};return f(e)&&(e.amount&&(t.amount=Number(e.amount)),e.currency&&(t.currency=e.currency)),t}var m={isObject:f,pricePack:p,itemPack:function(e){const t={};if(!f(e))return t;if(e.itemId&&(t.item_id=e.itemId),e.itemName&&(t.item_name=e.itemName),f(e.itemPrice)){const n=e.itemPrice;t.item_price=p(n)}return e.quantity&&(t.quantity=Number(e.quantity)),e.sellingPlan&&(t.selling_plan=function(e){const t={};return f(e)&&(e.id&&(t.id=e.id),e.name&&(t.name=e.name)),t}(e.sellingPlan)),t}};const v=u("gallery-react").getDataStorage("gallery-react");const g=u("gallery-react").getDataStorage("gallery-react");const y=u("gallery-react").getDataStorage("gallery-react");const b="eko-gallery-react";var k={register:function(){!function(e){window.EkoAnalytics("registerContextPacker",{tag:e,schema:"iglu:com.helloeko/page/jsonschema/1-0-0",match:/^pixel\..*/,getData:function(){return{url:document.location.href||"",referrer:document.referrer||"",title:document.title||""}}})}(b),h(b),function(e){window.EkoAnalytics("registerContextPacker",{tag:e,schema:"iglu:com.helloeko/cart/jsonschema/1-0-1",match:/pixel\.cart\.(add|remove)$/,getData(e){const t={};if((e=e||{}).cartId&&(t.cart_id=e.cartId),Array.isArray(e.items)&&(t.items=e.items.map((e=>m.itemPack(e)))),m.isObject(e.totalPrice)){const n=e.totalPrice;t.total_price=m.pricePack(n)}return e.totalQuantity&&(t.total_quantity=Number(e.totalQuantity)),t}})}(b),function(e){window.EkoAnalytics("registerContextPacker",{tag:e,schema:"iglu:com.helloeko/organization/jsonschema/1-0-0",match:/.*/,getData:function(){var e,t;const n=(null===(e=window.eko)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.customer)||(null==v||null===(t=v.config)||void 0===t?void 0:t.customer);if(n)return{id:null==n?void 0:n.organizationId}}})}(b),function(e){window.EkoAnalytics("registerContextPacker",{tag:e,schema:"iglu:com.helloeko/space/jsonschema/1-0-2",match:/.*/,getData:function(){var e,t;const n=(null===(e=window.eko)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.customer)||(null==g||null===(t=g.config)||void 0===t?void 0:t.customer);if(n)return{id:null==n?void 0:n.spaceId}}})}(b),function(e){window.EkoAnalytics("registerContextPacker",{tag:e,schema:"iglu:com.helloeko/asset/jsonschema/1-0-1",match:/.*/,getData:function(e){var t,n;if(null!=e&&e.type&&null!=e&&e.publishitemid&&null!=e&&e.name)return{deliverableid:"",publishitemid:null==e?void 0:e.publishitemid,type:null==e?void 0:e.type,name:null==e?void 0:e.name,artifactid:""};const i=null===(t=window.eko)||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.__autoGenerated)||void 0===t?void 0:t.publishItem,r=null==y||null===(n=y.config)||void 0===n||null===(n=n.__autoGenerated)||void 0===n?void 0:n.publishItem,o=i||r;return o?{deliverableid:"",publishitemid:null==o?void 0:o.id,type:"interactive",name:"",artifactid:""}:void 0}})}(b),function(e){window.EkoAnalytics("registerContextPacker",{tag:e,schema:"iglu:com.helloeko/traffic_allocation/jsonschema/1-0-0",match:"trafficallocation.decision",getData:function(e){if(!e)return;const t={decision:e.decision};return e.config&&(t.config=e.config),isNaN(e.traffic_split)||(t.traffic_split=e.traffic_split),e.provider&&(t.provider=e.provider),t}})}(b),function(e){window.EkoAnalytics("registerContextPacker",{tag:e,schema:"iglu:com.helloeko/checkout/jsonschema/1-0-4",match:/pixel\.(checkout|order)$/,getData(e){const t={};if((e=e||{}).checkoutId&&(t.checkout_id=e.checkoutId),Array.isArray(e.items)&&(t.items=e.items.map((e=>m.itemPack(e)))),m.isObject(e.totalPrice)){const n=e.totalPrice;t.total_price=m.pricePack(n)}return e.totalQuantity&&(t.total_quantity=Number(e.totalQuantity)),t}})}(b),function(e){window.EkoAnalytics("registerContextPacker",{tag:e,schema:"iglu:com.helloeko/order/jsonschema/1-0-2",match:"pixel.order",getData(e){const t={};if((e=e||{}).orderId&&(t.order_id=e.orderId),Array.isArray(e.items)&&(t.items=e.items.map((e=>m.itemPack(e)))),m.isObject(e.totalPrice)){const n=e.totalPrice;t.total_price=m.pricePack(n)}return e.totalQuantity&&(t.total_quantity=Number(e.totalQuantity)),t}})}(b)}};function w(e,t){let n="";try{n=window[e].getItem(t),n||(n=function(e){const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const i=t[n].trim();if(0===i.indexOf(e+"="))return i.substring(e.length+1)}return""}(t))}catch(e){console.warn("[eko-gallery-react] Error while getting the id from storage:",t,e)}return n}function x(e){let t=Array.isArray(e.items)?e.items:[e];return t=t.map((e=>({itemId:e.id,itemName:e.name,itemPrice:e.price,quantity:e.quantity||1,variantId:e.variantId,sellingPlan:e.sellingPlan}))),t}function _(e){return{cartId:e.cartId,items:x(e),totalPrice:e.totalPrice,totalQuantity:e.totalQuantity}}var T={"pixel.cart.add":_,"pixel.cart.remove":_,"pixel.product_viewed":function(e){let t=x(e);return t=t.map((e=>function(e){let t=w("localStorage","eko.metadata");if(t&&t[e.itemId]){let n=t[e.itemId].product;e.id=null==n?void 0:n.id,e.sku=null==n?void 0:n.sku,e.upc=null==n?void 0:n.upc,e.name=null==n?void 0:n.name}return e}(e))),{items:t}},"pixel.checkout":function(e){return{checkoutId:e.checkoutId,items:x(e),totalPrice:e.totalPrice,totalQuantity:e.totalQuantity}},"pixel.order":function(e){return{checkoutId:e.checkoutId,orderId:e.orderId,items:x(e),totalPrice:e.totalPrice,totalQuantity:e.totalQuantity}}};const E="https://storage.eko.com/efu/ekoanalytics/master/latest/EkoAnalyticsPlatform.min.gz.js";let I=!1;var S={init:function(e){k.register(),function(e){if(I)return;let t=e?window.location.host:"development";const n=document.createElement("script");n.setAttribute("pxid",t),n.type="text/javascript",n.async=!0,n.src=E,document.body.appendChild(n),I=!0}(e)},onRouteChanged:function(){window.EkoAnalytics("reset")},track:function(e,t){T[e]&&(t=T[e](t)),window.EkoAnalytics("track",e,t)}};function A(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function N(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function M(e,t){return e.get(A(e,t))}function F(e,t,n){N(e,t),t.set(e,n)}function C(e,t,n){return e.set(A(e,t),n),n}function O(e,t){N(e,t),t.add(e)}function P(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function R(){return R=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},R.apply(null,arguments)}function D(e,t){return e(t={exports:{}},t.exports),t.exports
|
|
2
2
|
/** @license React v16.13.1
|
|
3
3
|
* react-is.production.min.js
|
|
4
4
|
*
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/}var L="function"==typeof Symbol&&Symbol.for,B=L?Symbol.for("react.element"):60103,z=L?Symbol.for("react.portal"):60106,W=L?Symbol.for("react.fragment"):60107
|
|
9
|
+
*/}var L="function"==typeof Symbol&&Symbol.for,B=L?Symbol.for("react.element"):60103,z=L?Symbol.for("react.portal"):60106,W=L?Symbol.for("react.fragment"):60107,$=L?Symbol.for("react.strict_mode"):60108,j=L?Symbol.for("react.profiler"):60114,U=L?Symbol.for("react.provider"):60109,q=L?Symbol.for("react.context"):60110,V=L?Symbol.for("react.async_mode"):60111,G=L?Symbol.for("react.concurrent_mode"):60111,H=L?Symbol.for("react.forward_ref"):60112,K=L?Symbol.for("react.suspense"):60113,X=L?Symbol.for("react.suspense_list"):60120,Y=L?Symbol.for("react.memo"):60115,Q=L?Symbol.for("react.lazy"):60116,J=L?Symbol.for("react.block"):60121,Z=L?Symbol.for("react.fundamental"):60117,ee=L?Symbol.for("react.responder"):60118,te=L?Symbol.for("react.scope"):60119;function ne(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case B:switch(e=e.type){case V:case G:case W:case j:case $:case K:return e;default:switch(e=e&&e.$$typeof){case q:case H:case Q:case Y:case U:return e;default:return t}}case z:return t}}}function ie(e){return ne(e)===G}var re={AsyncMode:V,ConcurrentMode:G,ContextConsumer:q,ContextProvider:U,Element:B,ForwardRef:H,Fragment:W,Lazy:Q,Memo:Y,Portal:z,Profiler:j,StrictMode:$,Suspense:K,isAsyncMode:function(e){return ie(e)||ne(e)===V},isConcurrentMode:ie,isContextConsumer:function(e){return ne(e)===q},isContextProvider:function(e){return ne(e)===U},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===B},isForwardRef:function(e){return ne(e)===H},isFragment:function(e){return ne(e)===W},isLazy:function(e){return ne(e)===Q},isMemo:function(e){return ne(e)===Y},isPortal:function(e){return ne(e)===z},isProfiler:function(e){return ne(e)===j},isStrictMode:function(e){return ne(e)===$},isSuspense:function(e){return ne(e)===K},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===W||e===G||e===j||e===$||e===K||e===X||"object"==typeof e&&null!==e&&(e.$$typeof===Q||e.$$typeof===Y||e.$$typeof===U||e.$$typeof===q||e.$$typeof===H||e.$$typeof===Z||e.$$typeof===ee||e.$$typeof===te||e.$$typeof===J)},typeOf:ne},oe=D((function(e,t){"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,n=e?Symbol.for("react.element"):60103,i=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,s=e?Symbol.for("react.profiler"):60114,a=e?Symbol.for("react.provider"):60109,l=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,f=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,m=e?Symbol.for("react.lazy"):60116,v=e?Symbol.for("react.block"):60121,g=e?Symbol.for("react.fundamental"):60117,y=e?Symbol.for("react.responder"):60118,b=e?Symbol.for("react.scope"):60119;function k(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:var f=e.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 t}}case i:return t}}}var w=c,x=u,_=l,T=a,E=n,I=d,S=r,A=m,N=p,M=i,F=s,C=o,O=h,P=!1;function R(e){return k(e)===u}t.AsyncMode=w,t.ConcurrentMode=x,t.ContextConsumer=_,t.ContextProvider=T,t.Element=E,t.ForwardRef=I,t.Fragment=S,t.Lazy=A,t.Memo=N,t.Portal=M,t.Profiler=F,t.StrictMode=C,t.Suspense=O,t.isAsyncMode=function(e){return P||(P=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),R(e)||k(e)===c},t.isConcurrentMode=R,t.isContextConsumer=function(e){return k(e)===l},t.isContextProvider=function(e){return k(e)===a},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return k(e)===d},t.isFragment=function(e){return k(e)===r},t.isLazy=function(e){return k(e)===m},t.isMemo=function(e){return k(e)===p},t.isPortal=function(e){return k(e)===i},t.isProfiler=function(e){return k(e)===s},t.isStrictMode=function(e){return k(e)===o},t.isSuspense=function(e){return k(e)===h},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===u||e===s||e===o||e===h||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===p||e.$$typeof===a||e.$$typeof===l||e.$$typeof===d||e.$$typeof===g||e.$$typeof===y||e.$$typeof===b||e.$$typeof===v)},t.typeOf=k}()}));oe.AsyncMode,oe.ConcurrentMode,oe.ContextConsumer,oe.ContextProvider,oe.Element,oe.ForwardRef,oe.Fragment,oe.Lazy,oe.Memo,oe.Portal,oe.Profiler,oe.StrictMode,oe.Suspense,oe.isAsyncMode,oe.isConcurrentMode,oe.isContextConsumer,oe.isContextProvider,oe.isElement,oe.isForwardRef,oe.isFragment,oe.isLazy,oe.isMemo,oe.isPortal,oe.isProfiler,oe.isStrictMode,oe.isSuspense,oe.isValidElementType,oe.typeOf;var se=D((function(e){"production"===process.env.NODE_ENV?e.exports=re:e.exports=oe})),ae=Object.getOwnPropertySymbols,le=Object.prototype.hasOwnProperty,ce=Object.prototype.propertyIsEnumerable;
|
|
10
10
|
/*
|
|
11
11
|
object-assign
|
|
12
12
|
(c) Sindre Sorhus
|
|
13
13
|
@license MIT
|
|
14
|
-
*/var ut=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;var i=Object.getOwnPropertyNames(e).map((function(t){return e[t]}));if("0123456789"!==i.join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(t){r[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,i,r=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),o=1;o<arguments.length;o++){for(var s in n=Object(arguments[o]))lt.call(n,s)&&(r[s]=n[s]);if(at){i=at(n);for(var a=0;a<i.length;a++)ct.call(n,i[a])&&(r[i[a]]=n[i[a]])}}return r},dt="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",ht=Function.call.bind(Object.prototype.hasOwnProperty),ft=function(){};if("production"!==process.env.NODE_ENV){var pt=dt,mt={},vt=ht;ft=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(t){}}}function gt(t,e,n,i,r){if("production"!==process.env.NODE_ENV)for(var o in t)if(vt(t,o)){var s;try{if("function"!=typeof t[o]){var a=Error((i||"React class")+": "+n+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof t[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw a.name="Invariant Violation",a}s=t[o](e,o,i,n,null,pt)}catch(t){s=t}if(!s||s instanceof Error||ft((i||"React class")+": type specification of "+n+" `"+o+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof s+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),s instanceof Error&&!(s.message in mt)){mt[s.message]=!0;var l=r?r():"";ft("Failed "+n+" type: "+s.message+(null!=l?l:""))}}}gt.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(mt={})};var yt=gt,bt=function(){};function kt(){return null}"production"!==process.env.NODE_ENV&&(bt=function(t){var e="Warning: "+t;"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(t){}});var wt=function(t,e){var n="function"==typeof Symbol&&Symbol.iterator,i="@@iterator";var r="<<anonymous>>",o={array:c("array"),bigint:c("bigint"),bool:c("boolean"),func:c("function"),number:c("number"),object:c("object"),string:c("string"),symbol:c("symbol"),any:l(kt),arrayOf:function(t){return l((function(e,n,i,r,o){if("function"!=typeof t)return new a("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside arrayOf.");var s=e[n];if(!Array.isArray(s))return new a("Invalid "+r+" `"+o+"` of type `"+h(s)+"` supplied to `"+i+"`, expected an array.");for(var l=0;l<s.length;l++){var c=t(s,l,i,r,o+"["+l+"]",dt);if(c instanceof Error)return c}return null}))},element:l((function(e,n,i,r,o){var s=e[n];return t(s)?null:new a("Invalid "+r+" `"+o+"` of type `"+h(s)+"` supplied to `"+i+"`, expected a single ReactElement.")})),elementType:l((function(t,e,n,i,r){var o=t[e];return st.isValidElementType(o)?null:new a("Invalid "+i+" `"+r+"` of type `"+h(o)+"` supplied to `"+n+"`, expected a single ReactElement type.")})),instanceOf:function(t){return l((function(e,n,i,o,s){if(!(e[n]instanceof t)){var l=t.name||r;return new a("Invalid "+o+" `"+s+"` of type `"+(((c=e[n]).constructor&&c.constructor.name?c.constructor.name:r)+"` supplied to `")+i+"`, expected instance of `"+l+"`.")}var c;return null}))},node:l((function(t,e,n,i,r){return d(t[e])?null:new a("Invalid "+i+" `"+r+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(t){return l((function(e,n,i,r,o){if("function"!=typeof t)return new a("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var s=e[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected an object.");for(var c in s)if(ht(s,c)){var u=t(s,c,i,r,o+"."+c,dt);if(u instanceof Error)return u}return null}))},oneOf:function(t){if(!Array.isArray(t))return"production"!==process.env.NODE_ENV&&bt(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),kt;return l((function(e,n,i,r,o){for(var l=e[n],c=0;c<t.length;c++)if(s(l,t[c]))return null;var u=JSON.stringify(t,(function(t,e){return"symbol"===f(e)?String(e):e}));return new a("Invalid "+r+" `"+o+"` of value `"+String(l)+"` supplied to `"+i+"`, expected one of "+u+".")}))},oneOfType:function(t){if(!Array.isArray(t))return"production"!==process.env.NODE_ENV&&bt("Invalid argument supplied to oneOfType, expected an instance of array."),kt;for(var e=0;e<t.length;e++){var n=t[e];if("function"!=typeof n)return bt("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+p(n)+" at index "+e+"."),kt}return l((function(e,n,i,r,o){for(var s=[],l=0;l<t.length;l++){var c=(0,t[l])(e,n,i,r,o,dt);if(null==c)return null;c.data&&ht(c.data,"expectedType")&&s.push(c.data.expectedType)}return new a("Invalid "+r+" `"+o+"` supplied to `"+i+"`"+(s.length>0?", expected one of type ["+s.join(", ")+"]":"")+".")}))},shape:function(t){return l((function(e,n,i,r,o){var s=e[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected `object`.");for(var c in t){var d=t[c];if("function"!=typeof d)return u(i,r,o,c,f(d));var p=d(s,c,i,r,o+"."+c,dt);if(p)return p}return null}))},exact:function(t){return l((function(e,n,i,r,o){var s=e[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected `object`.");var c=ut({},e[n],t);for(var d in c){var p=t[d];if(ht(t,d)&&"function"!=typeof p)return u(i,r,o,d,f(p));if(!p)return new a("Invalid "+r+" `"+o+"` key `"+d+"` supplied to `"+i+"`.\nBad object: "+JSON.stringify(e[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(t),null," "));var m=p(s,d,i,r,o+"."+d,dt);if(m)return m}return null}))}};function s(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}function a(t,e){this.message=t,this.data=e&&"object"==typeof e?e:{},this.stack=""}function l(t){if("production"!==process.env.NODE_ENV)var n={},i=0;function o(o,s,l,c,u,d,h){if(c=c||r,d=d||l,h!==dt){if(e){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var p=c+":"+l;!n[p]&&i<3&&(bt("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+c+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),n[p]=!0,i++)}}return null==s[l]?o?null===s[l]?new a("The "+u+" `"+d+"` is marked as required in `"+c+"`, but its value is `null`."):new a("The "+u+" `"+d+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:t(s,l,c,u,d)}var s=o.bind(null,!1);return s.isRequired=o.bind(null,!0),s}function c(t){return l((function(e,n,i,r,o,s){var l=e[n];return h(l)!==t?new a("Invalid "+r+" `"+o+"` of type `"+f(l)+"` supplied to `"+i+"`, expected `"+t+"`.",{expectedType:t}):null}))}function u(t,e,n,i,r){return new a((t||"React class")+": "+e+" type `"+n+"."+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+r+"`.")}function d(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(d);if(null===e||t(e))return!0;var r=function(t){var e=t&&(n&&t[n]||t[i]);if("function"==typeof e)return e}(e);if(!r)return!1;var o,s=r.call(e);if(r!==e.entries){for(;!(o=s.next()).done;)if(!d(o.value))return!1}else for(;!(o=s.next()).done;){var a=o.value;if(a&&!d(a[1]))return!1}return!0;default:return!1}}function h(t){var e=typeof t;return Array.isArray(t)?"array":t instanceof RegExp?"object":function(t,e){return"symbol"===t||!!e&&("Symbol"===e["@@toStringTag"]||"function"==typeof Symbol&&e instanceof Symbol)}(e,t)?"symbol":e}function f(t){if(null==t)return""+t;var e=h(t);if("object"===e){if(t instanceof Date)return"date";if(t instanceof RegExp)return"regexp"}return e}function p(t){var e=f(t);switch(e){case"array":case"object":return"an "+e;case"boolean":case"date":case"regexp":return"a "+e;default:return e}}return a.prototype=Error.prototype,o.checkPropTypes=yt,o.resetWarningCache=yt.resetWarningCache,o.PropTypes=o,o};function xt(){}function _t(){}_t.resetWarningCache=xt;var Tt=D((function(t){if("production"!==process.env.NODE_ENV){var e=st;t.exports=wt(e.isElement,!0)}else t.exports=function(){function t(t,e,n,i,r,o){if(o!==dt){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function e(){return t}t.isRequired=t;var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:_t,resetWarningCache:xt};return n.PropTypes=n,n}()}));const Et=/https?:\/\/(.*?\.)?eko.com/,It={"eko.project.interaction":"interaction","eko.project.swipe":"swipe"};let St=null,At=null,Nt=[];function Mt(t){return e=>{var n;if(!Et.test(e.origin)||"eko.embedapi"!==(null===(n=e.data)||void 0===n?void 0:n.source))return;const i=e.data,r=It[i.type];r&&(t?t(r,i.data):Nt.push({type:r,data:i.data}))}}"undefined"!=typeof window&&(At=Mt(null),window.addEventListener("message",At));var Ft={subscribe:function(t){"function"==typeof t?St?console.warn("[eko-gallery-react] Ignoring events subscribe since already subscribed"):(St=t,At=Mt(t),window.addEventListener("message",At),function(t){Nt.forEach((e=>{t(e.type,e.data)})),Nt=[]}(t)):console.warn("[eko-gallery-react] Ignoring events subscribe since a callback function was not provided as argument")},unsubscribe:function(){At?(window.removeEventListener("message",At),At=null,St=null,Nt=[]):console.warn("[eko-gallery-react] Ignoring events unsubscribe since not subscribed")},send:function(t,e){St?St(t,e):Nt.push({type:t,data:e})}};const Ct=({index:t,activeIndex:n,setActiveIndex:i,item:r,src:o,navItemRefs:s,itemIcon:a})=>{var l,c;const u=null==r||null===(l=r.media)||void 0===l?void 0:l.srcset,d=null==r||null===(c=r.media)||void 0===c?void 0:c.sizes,h=!o&&(null==r?void 0:r.label),f=u?o:function(t,e=200){if(!t)return null;try{let n=t;t.includes("assets.eko.com")&&t.includes("/raw/")&&(n=t.replace("/raw/","/image/"));const i=new URL(n);return i.searchParams.set("width",e),i.href}catch(e){return t}}(o,150);let p=["addons-container",h?"full-thumb-label":""].join(" ").trim();return e.createElement("li",{className:"eko-nav-item","aria-current":n===t,onClick:function(){i(t),function(t){S.track("gallery.interaction",{elementid:`thumbnail-${t}`,interactiontype:"click"}),Ft.send("interaction",{elementid:`thumbnail-${t}`,interactiontype:"click"})}(t)},ref:s.current[t]},e.createElement("button",{type:"button","aria-label":`Go to item ${t}`},!h&&e.createElement("img",{src:f,srcSet:u,sizes:d,alt:null==r?void 0:r.name,loading:"eager",fetchPriority:"high"}),e.createElement("div",{className:p},(null==r?void 0:r.stepsIndication)&&e.createElement("div",{className:"step-indicator"},e.createElement("span",null),e.createElement("span",null),e.createElement("span",null)),(null==r?void 0:r.label)&&e.createElement("div",{className:"thumb-label"},null==r?void 0:r.label)),a&&e.createElement("div",{className:"item-icon"},e.createElement("span",{style:{backgroundImage:`url(${a})`}}))))};Ct.propTypes={index:Tt.number,activeIndex:Tt.number,setActiveIndex:Tt.func.isRequired,item:Tt.object.isRequired,src:Tt.string,navItemRefs:Tt.object.isRequired,itemIcon:Tt.string};const Ot=({layout:t,nav:n,isVerticalNav:i,showPrevArrow:r,showNextArrow:o})=>{var s,a,l,c,u;const d=e.useRef(null),h=e.useRef(null),f="arrows"===(null==t||null===(s=t.mobile)||void 0===s||null===(s=s.config)||void 0===s||null===(s=s.navPagination)||void 0===s?void 0:s.type)?"eko-mobile-arrows":"",p="arrows"===(null!==(a=null==t||null===(l=t.desktop)||void 0===l||null===(l=l.config)||void 0===l||null===(l=l.navPagination)||void 0===l?void 0:l.type)&&void 0!==a?a:"arrows")?"eko-desktop-arrows":"",m=f||p,v=i?null==n||null===(c=n.current)||void 0===c?void 0:c.scrollHeight:null==n||null===(u=n.current)||void 0===u?void 0:u.scrollWidth;function g(t){const e=i?n.current.clientHeight:n.current.clientWidth,r=function(t,e){const n=i?e.scrollTop:e.scrollLeft;return Math.max(-n,Math.min(v-t-n,t))}("next"===t?e:-e,n.current);return{top:i?r:0,left:i?0:r,behavior:"smooth"}}function y(t){var e,i,r;const o=g(t),s="next"===t?null==h||null===(e=h.current)||void 0===e?void 0:e.id:null==d||null===(i=d.current)||void 0===i?void 0:i.id;var a,l;window.EkoAnalytics("track","gallery.interaction",{elementid:s,interactiontype:"click"}),null==n||null===(r=n.current)||void 0===r||r.scrollBy(o),a=s,l="click",S.track("gallery.interaction",{elementId:a,interactiontype:l}),Ft.send("interaction",{elementId:a,interactiontype:l})}return e.createElement(e.Fragment,null,m&&e.createElement(e.Fragment,null,e.createElement("button",R({type:"button","aria-label":"Go to previous item","aria-hidden":r?"false":"true",onClick:()=>y("prev"),ref:d,id:"eko-nav-prev-arrow",className:`eko-nav-arrow eko-prev-nav-button ${f} ${p} ${r?"":"eko-hidden-nav-button"}`},r?{}:{tabIndex:"-1"}),e.createElement("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M5.56127 9.52817C5.28966 9.22635 5.28966 8.77361 5.56127 8.502L10.39 3.67331C10.6918 3.37157 11.1445 3.37157 11.4161 3.67331C11.7179 3.94492 11.7179 4.39766 11.4161 4.66927L7.10044 8.98487L11.4161 13.3307C11.7179 13.6023 11.7179 14.055 11.4161 14.3266C11.1445 14.6285 10.6918 14.6285 10.4202 14.3266L5.56127 9.52817Z",fill:"black"}))),e.createElement("button",R({type:"button","aria-label":"Go to next item","aria-hidden":o?"false":"true",onClick:()=>y("next"),ref:h,className:`eko-nav-arrow eko-next-nav-button ${f} ${p} ${o?"":"eko-hidden-nav-button"}`,id:"eko-nav-next-arrow"},o?{}:{tabIndex:"-1"}),e.createElement("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M12.4387 8.47185C12.7103 8.77367 12.7103 9.22641 12.4387 9.49802L7.61003 14.3267C7.30821 14.6284 6.85547 14.6284 6.58386 14.3267C6.28212 14.0551 6.28212 13.6024 6.58386 13.3308L10.8996 9.01515L6.58386 4.66933C6.28212 4.39772 6.28212 3.94499 6.58386 3.67338C6.85547 3.37155 7.30821 3.37155 7.57982 3.67338L12.4387 8.47185Z",fill:"black"})))))};function Pt(t,e,n){let i;return function(){const n=this,r=arguments;clearTimeout(i),i=setTimeout((function(){i=null,t.apply(n,r)}),e)}}Ot.propTypes={layout:Tt.object.isRequired,nav:Tt.object.isRequired,isVerticalNav:Tt.bool.isRequired,showPrevArrow:Tt.bool.isRequired,showNextArrow:Tt.bool.isRequired};const Rt=({items:t,setActiveIndex:n,activeIndex:i,layout:r,carouselMounted:o,forceMobile:s})=>{const l=e.useRef(null),c=e.useRef(null),u=e.useRef([]),d=3,[h,f]=e.useState(null),[p,m]=e.useState(!1),[v,g]=e.useState(0),[y,b]=e.useState(!1),[k,w]=e.useState(!1);function x(){var t;const e=s||window.innerWidth<768?"mobile":"desktop",n=(null==r||null===(t=r[e])||void 0===t||null===(t=t.config)||void 0===t?void 0:t.orientation)||("desktop"===e?"left":"bottom");m("left"===n||"right"===n);const i=c.current.parentNode,a=o?".eko-smart-gallery-container iframe":".eko-carousel",l=i.querySelector(a);setTimeout((()=>{g(l.clientHeight)}),0)}function _(){var t,e;const n=s||a()?"mobile":"desktop",i=null!==(t=null==r||null===(e=r[n])||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.navPagination)||void 0===e?void 0:e.scrollThreshold)&&void 0!==t?t:d;!function(t=d){var e,n;const i=l.current;if(!i)return;const o="none"!==(null==r||null===(e=r.desktop)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.navPagination)||void 0===e?void 0:e.type),c=(u=null==r||null===(n=r.mobile)||void 0===n||null===(n=n.config)||void 0===n||null===(n=n.navPagination)||void 0===n?void 0:n.type,"mask"===u||"arrows"===u);var u;if((s||a())&&!c)return void i.style.setProperty("-webkit-mask","none");if(!a()&&!o)return void i.style.setProperty("-webkit-mask","none");const h=i.scrollHeight-i.clientHeight,f=i.scrollTop>t?"85%":"100%",m=i.scrollTop<=h-t?"15%":"0%",v=i.scrollWidth-i.clientWidth,g=i.scrollLeft>t?"15%":"0%",y=i.scrollLeft<=v-t?"85%":"100%";p?i.style.setProperty("-webkit-mask",`linear-gradient(0deg,#0000,#000 ${m} ${f},#0000)`):i.style.setProperty("-webkit-mask",`linear-gradient(90deg,#0000,#000 ${g} ${y},#0000)`)}(i),function(t=d){var e,n,i,r,o,s;const a=p?null==l||null===(e=l.current)||void 0===e?void 0:e.scrollTop:null==l||null===(n=l.current)||void 0===n?void 0:n.scrollLeft,c=p?null==l||null===(i=l.current)||void 0===i?void 0:i.clientHeight:null==l||null===(r=l.current)||void 0===r?void 0:r.clientWidth,u=p?null==l||null===(o=l.current)||void 0===o?void 0:o.scrollHeight:null==l||null===(s=l.current)||void 0===s?void 0:s.scrollWidth;u-t<c?(b(!1),w(!1)):a<=t?(b(!1),w(!0)):a+c>u-t?(b(!0),w(!1)):a+t>0&&a<u-t&&(b(!0),w(!0))}(i)}u.current=null==t?void 0:t.map(((t,n)=>{var i,r;return null!==(i=null==u||null===(r=u.current)||void 0===r?void 0:r[n])&&void 0!==i?i:e.createRef()}));const T=Pt((t=>{var e;e=t,S.track("gallery.interaction",{elementid:"nav",interactiontype:e}),Ft.send("interaction",{elementid:"nav",interactiontype:e})}),200);const E=e.useCallback((t=>{n({index:t,step:0,source:"nav"})}),[]);return e.useEffect((()=>{var t;f(null===(t=u.current)||void 0===t?void 0:t[i])}),[i]),e.useEffect((()=>{if(null!=h&&h.current&&null!=l&&l.current){const t=h.current,e=l.current.clientWidth/2,n=t.clientWidth/2,i=l.current.clientHeight/2,r=t.clientHeight/2;l.current.scrollTo({left:t.offsetLeft-e+n,top:t.offsetTop-i+r,behavior:"smooth"})}}),[h]),e.useEffect((()=>{x()}),[]),e.useEffect((()=>(window.addEventListener("resize",x),()=>{window.removeEventListener("resize",x)})),[c,o,s]),e.useEffect((()=>{g(0),x()}),[t,c,o,s]),e.useEffect((()=>{_();const t=new ResizeObserver(_);return t.observe(l.current),()=>{t.disconnect()}}),[t,s,p]),e.createElement("div",{className:"eko-nav-container",ref:c,style:{opacity:v>0?1:0,height:""+(v&&p?v+"px":"auto")}},e.createElement(Ot,{layout:r,nav:l,isVerticalNav:p,showPrevArrow:y,showNextArrow:k}),e.createElement("ul",{className:`eko-nav eko-mobile-nav-selected-${null!==(I=null==r||null===(A=r.mobile)||void 0===A||null===(A=A.config)||void 0===A?void 0:A.navItemsSelectedType)&&void 0!==I?I:"underline"} eko-desktop-nav-selected-${null!==(N=null==r||null===(M=r.desktop)||void 0===M||null===(M=M.config)||void 0===M?void 0:M.navItemsSelectedType)&&void 0!==N?N:"underline"}`,ref:l,onScroll:function(){_()},onWheel:function(){T("wheel")},onTouchMove:function(){T("swipe")}},null==t?void 0:t.map(((t,n)=>{var r;const o=(null==t||null===(r=t.media)||void 0===r?void 0:r.url)||(null==t?void 0:t.media)||"";return e.createElement(Ct,{key:o+n,index:n,activeIndex:i,setActiveIndex:E,item:t,src:o,navItemRefs:u,itemIcon:null==t?void 0:t.icon})}))));var I,A,N,M};Rt.propTypes={items:Tt.array.isRequired,activeIndex:Tt.number,setActiveIndex:Tt.func.isRequired,layout:Tt.object,carouselMounted:Tt.bool,forceMobile:Tt.bool};function Dt(){S.track("gallery.cover.displayed"),Ft.send("gallerycoverdisplayed")}function Lt(t){if(!t)return t;try{const e=new URL(t);return e.host.includes("assets.eko.com")&&e.pathname.startsWith("/image")&&!e.searchParams.has("width")?(e.pathname.endsWith(".png")&&(e.pathname=e.pathname.replace(/\.png$/,".webp")),e.searchParams.set("width",1920),e.toString()):t}catch(e){return t}}const Bt=({item:t,src:n,srcset:i,sizes:r,isCoverElement:o})=>{const s=e.useRef(null);return e.useEffect((()=>{var t;if(o){if(null===(t=s.current)||void 0===t||!t.complete)return s.current.addEventListener("load",Dt,{once:!0}),()=>{var t;null===(t=s.current)||void 0===t||t.removeEventListener("load",Dt,{once:!0})};Dt()}}),[]),e.createElement("img",{ref:s,src:Lt(n),srcSet:i,sizes:r,alt:t.name,fetchPriority:o?"high":"auto",loading:o?"eager":"lazy",style:{width:"100%",height:"100%"}})};Bt.propTypes={item:Tt.object.isRequired,src:Tt.string,srcset:Tt.string,sizes:Tt.string,isCoverElement:Tt.bool};const zt=Pt((t=>{var e;e=t,S.track("gallery.interaction",{elementid:"carousel",interactiontype:e}),Ft.send("interaction",{elementid:"carousel",interactiontype:e})}),200);function Wt(){zt("wheel")}const jt=e.forwardRef((({items:t,setActiveIndex:n,activeIndex:i,showSmartLoaders:r},o)=>{const s=e.useRef(null),a=e.useRef([]);a.current=null==t?void 0:t.map(((t,n)=>{var i,r;return null!==(i=null==a||null===(r=a.current)||void 0===r?void 0:r[n])&&void 0!==i?i:e.createRef()}));const[l,c]=e.useState(),[u,d]=e.useState(),h=e.useRef(i),f=e.useRef(!1);function p(){const e=function(t){const e=t.scrollLeft,n=t.scrollWidth-t.clientWidth;return 0===e?0:e>n?100:e/n*100}(s.current)*(null==t?void 0:t.length)/100,i=Math.min(Math.trunc(e),(null==t?void 0:t.length)-1),r=h.current;"nav"!==r.source&&"external-nav"!==r.source?(f.current&&i!==r.index&&(f.current=!1),f.current||(i>(null==t?void 0:t.length)-1?n({index:(null==t?void 0:t.length)-1,source:"carousel"}):n({index:i,source:"carousel"}))):i===r.index?f.current=!0:f.current&&i!==r.index&&(f.current=!1,n({index:i,source:"carousel"}))}return e.useImperativeHandle(o,(()=>({prev:()=>{n({index:Math.max(0,h.current.index-1),source:"carousel"})},next:()=>{n({index:Math.min((null==t?void 0:t.length)-1,h.current.index+1),source:"carousel"})}}))),e.useEffect((()=>{const t=s.current;if(t)return t.addEventListener("scroll",p),()=>{t.removeEventListener("scroll",p)}}),[t]),e.useEffect((()=>{var t;let e=null===(t=a.current)||void 0===t?void 0:t[i.index];if(e&&("nav"===i.source||"external-nav"===i.source)){const t=e.current,n=s.current.clientWidth/2,i=(null==t?void 0:t.clientWidth)/2,r=(null==t?void 0:t.offsetLeft)-n+i;s.current.scrollTo({left:r,behavior:"smooth"})}}),[i]),e.useEffect((()=>{h.current=i,"nav"!==i.source&&"external-nav"!==i.source||(f.current=!1)}),[i]),e.createElement("ul",{className:"eko-carousel",ref:s,onScroll:p,onWheel:Wt,onTouchMove:function(t){d(t.targetTouches[0].clientX)},onTouchStart:function(t){c(t.targetTouches[0].clientX),d(null)},onTouchEnd:function(){u&&l&&(l-u>75||l-u<-75)&&zt("swipe")}},null==t?void 0:t.map(((t,n)=>{const i=(null==t?void 0:t.cover)||(null==t?void 0:t.media),o=(null==i?void 0:i.url)||i;return e.createElement("li",{className:"eko-carousel-item",key:o+n,ref:a.current[n]},e.createElement(Bt,{item:t,src:o,srcset:null==i?void 0:i.srcset,sizes:null==i?void 0:i.sizes,isCoverElement:0===n}),r&&"image"!==t.type&&e.createElement("div",{className:"eko-smart-loading"},e.createElement("div",null),e.createElement("p",null,"Loading video experience")))})))}));function Ut(t){var e;return function(t){var e;return"eko.block.event"===(null==t||null===(e=t.data)||void 0===e?void 0:e.type)}(t)&&"GalleryBlock"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.blockType)}jt.propTypes={items:Tt.array.isRequired,setActiveIndex:Tt.func.isRequired,activeIndex:Tt.object,showSmartLoaders:Tt.bool},jt.displayName="CarouselLoop";const $t="eko.project.invoke",qt="eko.block.invoke";function Vt(t,e,n){var i;null!=t&&t.contentWindow&&(null==t||null===(i=t.contentWindow)||void 0===i||i.postMessage({target:"eko.embedapi",type:e,data:n},"*"))}function Gt(t){return`#variantId=${encodeURIComponent(t)}`}const Ht=e.forwardRef((({config:t,instanceId:n,setActiveItem:i,activeItem:r,variantId:o,smartGalleryLoaded:s,onLoad:l,forceMobile:c},u)=>{var d,h,f;const p=null!==(d=null===(h=t.options)||void 0===h?void 0:h.galleryEnv)&&void 0!==d?d:"",m=null===(f=t.__autoGenerated)||void 0===f||null===(f=f.publishItem)||void 0===f?void 0:f.id,v=function(t={}){let e="";return Object.entries(t).forEach((([t,n])=>{e+=`&${t}=${n}`})),e}(null==t?void 0:t.qp),g=function(t,e,n){return`https://${t}play.eko.com/embed?${n?`id=${n}`:`piid=${e}`}&nocover=true&galleryBlockMode=gallery&eko_pixel=true`}(p,m,n),y=e.useRef(null),b=e.useRef(null),k=e.useRef(!1),[w,x]=e.useState(Gt(o||"ekonovar")),[_,T]=e.useState(g+v+w);let E;function I(){S.track("gallery.project.display"),l(),Ft.send("galleryloaded")}return e.useImperativeHandle(u,(()=>({prev:()=>{Vt(null==b?void 0:b.current,qt,{action:"onPrevModule"})},next:()=>{Vt(null==b?void 0:b.current,qt,{action:"onNextModule"})}}))),e.useEffect((()=>{k.current?Vt(null==b?void 0:b.current,$t,{action:"updateVariant",args:{id:o}}):x(Gt(o))}),[o]),e.useEffect((()=>{Vt(null==b?void 0:b.current,qt,{action:"updateActiveModule",args:{activeItemIndex:null==r?void 0:r.index,activeModuleIndex:null==r?void 0:r.step}})}),[r]),e.useEffect((()=>{function t(t){if((function(t){var e;return"eko.project.blockstart"===(null==t||null===(e=t.data)||void 0===e?void 0:e.type)}(t)||function(t){var e,n;return"eko.project.started"===(null==t||null===(e=t.data)||void 0===e?void 0:e.type)&&(null==t||null===(n=t.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.started)}(t))&&!k.current)return e=t.data.data.blockType,k.current=!0,void("GalleryBlock"===e?Vt(null==b?void 0:b.current,qt,{action:"updateActiveModule",args:{activeItemIndex:null==r?void 0:r.index,activeModuleIndex:null==r?void 0:r.step}}):I());var e;if(k.current){if(function(t){var e;return Ut(t)&&"activeModuleChanged"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.name)}(t))return void function(t){const e=t.data.data.data.activeItemIndex,n=t.data.data.data.activeModuleIndex;e===(null==r?void 0:r.index)&&n===(null==r?void 0:r.step)||i({index:e,step:n,source:"carousel"})}(t);(function(t){var e;return Ut(t)&&"activeModuleChangeDone"===(null==t||null===(e=t.data)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.name)})(t)&&!s&&I()}}return E=c||a()?"mobile":"desktop",function(t,e={}){window.addEventListener("message",t,e)}(t),()=>{!function(t,e={}){window.removeEventListener("message",t,e)}(t)}}),[r]),e.useEffect((()=>{k.current||Vt(null==b?void 0:b.current,$t,{action:"queryProjectStarted"})}),[r,s]),e.useEffect((()=>{k.current=!1}),[t]),e.useEffect((()=>{T(g+v+w)}),[w]),e.createElement("div",{className:"eko-smart-gallery-container "+(s?"":"eko-project-not-ready"),ref:y,"data-type":"smart-gallery","data-qp":v,"data-variant":o,"data-device":E},e.createElement("iframe",{allow:"autoplay; fullscreen",title:"eko gallery",src:_,style:{border:0},ref:b}))}));Ht.propTypes={config:Tt.object.isRequired,instanceId:Tt.string,setActiveItem:Tt.func.isRequired,activeItem:Tt.object.isRequired,variantId:Tt.string,smartGalleryLoaded:Tt.bool,onLoad:Tt.func,forceMobile:Tt.bool},Ht.displayName="SmartGallery";const Kt=()=>e.createElement("style",{suppressHydrationWarning:!0},'.eko-gallery {\n --accentColorEko: #000;\n --primaryColorEko: #000;\n --backgroundColorEko: #25D7A2;\n --navItemsBackgroundColorEko: transparent;\n --navItemsBannerBackgroundColorEko: #EEEEEE;\n --carouselItemsBackgroundColorEko: transparent;\n --carouselInteractiveCoverBackgroundColorEko: transparent;\n --galleryGapEkoMobile: 12px;\n --galleryGapEkoDesktop: 12px;\n --galleryPaddingEkoMobile: 0;\n --galleryPaddingEkoDesktop: 0;\n --galleryMaxWidthEkoMobile: 100%;\n --galleryMaxWidthEkoDesktop: 900px;\n --galleryTransition: .8s cubic-bezier(.35, 0, 0, 1) 1.5s;\n --navBarPaddingEkoMobile: 0 0 0 20px;\n --navBarPaddingEkoDesktop: 0;\n --navItemsWidthEkoMobile: 80px;\n --navItemsWidthEkoDesktop: 80px;\n --navItemsHeightEkoMobile: 80px;\n --navItemsHeightEkoDesktop: 80px;\n --navItemsGapEkoMobile: 14px;\n --navItemsGapEkoDesktop: 14px;\n --navItemsRadiusEkoMobile: 8px;\n --navItemsRadiusEkoDesktop: 8px;\n --navItemsSelectedMarginEkoMobile: 3px;\n --navItemsSelectedMarginEkoDesktop: 3px;\n --navItemsSelectedThicknessEkoMobile: 3px;\n --navItemsSelectedThicknessEkoDesktop: 3px;\n --navItemsSelectedUnderlineRadiusEkoMobile: 100px;\n --navItemsSelectedUnderlineRadiusEkoDesktop: 100px;\n --navItemsObjectFitEkoMobile: cover;\n --navItemsObjectFitEkoDesktop: cover;\n --navMediaBadgeSizeEkoMobile: 22px;\n --navMediaBadgeSizeEkoDesktop: 22px;\n --navMediaBadgeMarginTopEkoMobile: 4px;\n --navMediaBadgeMarginTopEkoDesktop: 4px;\n --navMediaBadgeMarginRightEkoMobile: 4px;\n --navMediaBadgeMarginRightEkoDesktop: 4px;\n --carouselItemsAspectRatioEkoMobile: 1 / 1;\n --carouselItemsAspectRatioEkoDesktop: 1 / 1;\n --carouselItemsRadiusEkoMobile: 0px;\n --carouselItemsRadiusEkoDesktop: 12px;\n --carouselItemsObjectFitEkoMobile: cover;\n --carouselItemsObjectFitEkoDesktop: cover;\n --navBannerFontSizeEkoMobile: 12px;\n --navBannerFontSizeEkoDesktop: 12px;\n --navBannerFontLineHeightEkoMobile: 120%;\n --navBannerFontLineHeightEkoDesktop: 120%;\n --navBannerFontFamilyEkoMobile: inherit;\n --navBannerFontFamilyEkoDesktop: inherit;\n --navBannerFontWeightEkoMobile: 400;\n --navBannerFontWeightEkoDesktop: 400;\n --outerWidth: 0\n}\n\n.eko-gallery * {\n box-sizing: border-box\n}\n\n.eko-gallery ul,\n.eko-gallery li {\n padding: 0;\n text-indent: 0;\n list-style-type: none;\n font-size: 0;\n margin: 0\n}\n\n.eko-gallery button {\n border: none;\n padding: 0\n}\n\n.eko-gallery .eko-hidden {\n display: none !important\n}\n\n.eko-gallery .eko-not-visible {\n visibility: hidden !important\n}\n\n.eko-hidden-variant {\n display: none !important\n}\n\n.eko-sr-only {\n width: 1px;\n height: 1px;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n margin: -1px;\n padding: 0;\n position: absolute;\n overflow: hidden\n}\n\n.eko-sticky-top {\n position: sticky;\n top: 0\n}\n\n.eko-gallery .eko-nav {\n height: 100%;\n display: flex;\n align-items: start;\n align-self: start;\n flex-shrink: 0;\n scrollbar-width: none;\n -ms-overflow-style: none\n}\n\n.eko-gallery .eko-nav li {\n font-size: 0;\n position: relative;\n display: flex;\n flex-shrink: 0;\n justify-content: center;\n -webkit-box-pack: center;\n cursor: pointer\n}\n\n.eko-gallery .eko-nav li button {\n position: relative;\n background-color: transparent;\n border-radius: 0;\n line-height: 0;\n overflow: hidden;\n cursor: pointer\n}\n\n.eko-gallery .eko-nav li button img {\n background-color: var(--navItemsBackgroundColorEko);\n pointer-events: none\n}\n\n.eko-gallery .eko-nav li button .item-icon {\n position: absolute;\n top: 0;\n right: 0;\n width: 32px;\n height: 32px;\n transform: scale(.25);\n transform-origin: top right\n}\n\n.eko-gallery .eko-nav li button .item-icon span {\n display: block;\n width: 400%;\n height: 400%;\n position: absolute;\n top: 0;\n right: 0;\n background-position: top right;\n background-repeat: no-repeat;\n background-size: contain\n}\n\n.eko-gallery .eko-nav li .addons-container {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n display: flex;\n flex-direction: column;\n font-size: 10px;\n line-height: 100%\n}\n\n.eko-gallery .eko-nav li .addons-container .thumb-label {\n width: 100%;\n background: var(--navItemsBannerBackgroundColorEko);\n padding: 4px;\n text-align: center;\n text-wrap: balance;\n color: var(--primaryColorEko)\n}\n\n.eko-gallery .eko-nav li .addons-container .step-indicator {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: center;\n gap: 5px;\n padding: 6px\n}\n\n.eko-gallery .eko-nav li .addons-container .step-indicator span {\n width: 5px;\n height: 5px;\n border-radius: 100px;\n background: #fff;\n box-shadow: 0 0 3px #00000094\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label {\n position: relative\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .step-indicator {\n position: absolute;\n bottom: 0\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n align-content: center\n}\n\n.eko-gallery .eko-nav::-webkit-scrollbar {\n display: none\n}\n\n.eko-nav-container {\n display: flex\n}\n\n.eko-nav-container:has(.eko-nav.eko-not-visible) .eko-nav-arrow {\n display: none\n}\n\n.eko-nav-container {\n position: relative;\n opacity: 0;\n transition: opacity .15s ease-in\n}\n\n.eko-nav-container .eko-nav-arrow {\n width: 28px;\n height: 28px;\n position: absolute;\n display: none;\n justify-content: center;\n align-items: center;\n border-radius: 28px;\n background-color: #fff;\n box-shadow: 0 0 6px #0000001f;\n z-index: 1;\n bottom: 50%;\n opacity: 1;\n transition: opacity .15s ease-in;\n transform: translateY(50%);\n cursor: pointer\n}\n\n.eko-nav-container .eko-nav-arrow.eko-prev-nav-button svg,\n.eko-nav-container .eko-nav-arrow.eko-next-nav-button svg {\n padding: 1px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-prev-nav-button {\n left: 8px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-next-nav-button {\n right: 8px\n}\n\n.eko-nav-container .eko-nav-arrow.eko-hidden-nav-button {\n opacity: 0;\n pointer-events: none\n}\n\n.eko-gallery .eko-nav {\n gap: var(--navItemsGapEkoMobile);\n padding: var(--navBarPaddingEkoMobile)\n}\n\n.eko-gallery .eko-nav li button img {\n width: var(--navItemsWidthEkoMobile);\n height: var(--navItemsHeightEkoMobile);\n object-fit: var(--navItemsObjectFitEkoMobile)\n}\n\n.eko-gallery .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoMobile);\n font-size: var(--navBannerFontSizeEkoMobile);\n line-height: var(--navBannerFontLineHeightEkoMobile);\n font-weight: var(--navBannerFontWeightEkoMobile)\n}\n\n.eko-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoMobile);\n height: var(--navItemsHeightEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li {\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile))\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoMobile);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoMobile);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoMobile)\n}\n\n.eko-gallery .eko-nav.eko-mobile-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoMobile) + var(--navItemsSelectedMarginEkoMobile));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoMobile) var(--accentColorEko)\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-nav {\n gap: var(--navItemsGapEkoDesktop);\n padding: var(--navBarPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li button img {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop);\n object-fit: var(--navItemsObjectFitEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoDesktop);\n font-size: var(--navBannerFontSizeEkoDesktop);\n line-height: var(--navBannerFontLineHeightEkoDesktop);\n font-weight: var(--navBannerFontWeightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li {\n border-radius: 0;\n padding: 0;\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop))\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true] {\n box-shadow: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoDesktop);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoDesktop);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoDesktop) var(--accentColorEko)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true]:after {\n content: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container .eko-nav-arrow {\n width: 30px;\n height: 30px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container .eko-nav-arrow.eko-desktop-arrows {\n display: flex\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container:has(.eko-desktop-nav-selected-underline) .eko-nav-arrow.eko-desktop-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop)) / 2))\n }\n}\n\n@media screen and (max-width: 767px) {\n .eko-gallery.eko-liquid-gallery .eko-nav-arrow.eko-mobile-arrows {\n display: flex\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav-container:has(.eko-mobile-nav-selected-underline) .eko-nav-arrow.eko-mobile-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile)) / 2))\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav {\n gap: var(--navItemsGapEkoDesktop);\n padding: var(--navBarPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li button img {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop);\n object-fit: var(--navItemsObjectFitEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .addons-container .thumb-label {\n font-family: var(--navBannerFontFamilyEkoDesktop);\n font-size: var(--navBannerFontSizeEkoDesktop);\n line-height: var(--navBannerFontLineHeightEkoDesktop);\n font-weight: var(--navBannerFontWeightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .addons-container.full-thumb-label .thumb-label {\n width: var(--navItemsWidthEkoDesktop);\n height: var(--navItemsHeightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li {\n border-radius: 0;\n padding: 0;\n padding-bottom: calc(var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop))\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true] {\n box-shadow: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-underline li[aria-current=true]:after {\n content: "";\n width: 100%;\n height: var(--navItemsSelectedThicknessEkoDesktop);\n border-radius: var(--navItemsSelectedUnderlineRadiusEkoDesktop);\n background-color: var(--accentColorEko);\n display: block;\n position: absolute;\n bottom: 0;\n left: 0\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li {\n padding: var(--navItemsSelectedMarginEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li button {\n border-radius: var(--navItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true] {\n border-radius: calc(var(--navItemsRadiusEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop));\n box-shadow: 0 0 0 var(--navItemsSelectedThicknessEkoDesktop) var(--accentColorEko)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav.eko-desktop-nav-selected-outline li[aria-current=true]:after {\n content: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container .eko-nav-arrow {\n width: 30px;\n height: 30px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container .eko-nav-arrow.eko-desktop-arrows {\n display: flex\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav-container:has(.eko-desktop-nav-selected-underline) .eko-nav-arrow.eko-desktop-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoDesktop) + var(--navItemsSelectedMarginEkoDesktop)) / 2))\n }\n}\n\n@media screen and (max-width: 767px) {\n .eko-gallery.eko-react-gallery.eko-mobile .eko-nav-arrow.eko-mobile-arrows {\n display: flex\n }\n\n .eko-gallery.eko-react-gallery.eko-mobile .eko-nav-container:has(.eko-mobile-nav-selected-underline) .eko-nav-arrow.eko-mobile-arrows {\n transform: translateY(calc(50% - (var(--navItemsSelectedThicknessEkoMobile) + var(--navItemsSelectedMarginEkoMobile)) / 2))\n }\n}\n\n.eko-media-badge {\n display: none;\n width: var(--navMediaBadgeSizeEkoMobile);\n height: var(--navMediaBadgeSizeEkoMobile);\n background: #fff;\n align-items: center;\n justify-content: center;\n border-radius: 100%;\n box-shadow: 0 0 4px #00000014;\n place-content: center;\n position: absolute;\n top: var(--navMediaBadgeMarginTopEkoMobile);\n right: var(--navMediaBadgeMarginRightEkoMobile)\n}\n\n.eko-media-badge svg {\n width: 100%;\n height: 100%\n}\n\n.eko-media-badge svg path {\n fill: #000\n}\n\n.eko-nav li .eko-media-badge-mobile {\n display: flex\n}\n\nsvg.interactiveThumb {\n position: absolute;\n top: 3px;\n right: -2.5px;\n width: 100%;\n height: 100%\n}\n\nsvg.interactiveThumb.hand {\n animation: handAnim 2.5s linear infinite\n}\n\nsvg.interactiveThumb.beam {\n animation: beamAnim 2.5s linear infinite;\n transform-origin: 26% 40%;\n top: 0\n}\n\n@keyframes handAnim {\n 0% {\n transform: translateY(0)\n }\n\n 3% {\n transform: translateY(-4px)\n }\n\n 15% {\n transform: translateY(0)\n }\n\n to {\n transform: translateY(0)\n }\n}\n\n@keyframes beamAnim {\n 0% {\n transform: scale(1);\n opacity: 0\n }\n\n 5% {\n transform: scale(1.1);\n opacity: 1\n }\n\n 30% {\n transform: scale(1.4);\n opacity: 0\n }\n\n to {\n transform: scale(1.4);\n opacity: 0\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-media-badge {\n width: var(--navMediaBadgeSizeEkoDesktop);\n height: var(--navMediaBadgeSizeEkoDesktop);\n top: var(--navMediaBadgeMarginTopEkoDesktop);\n right: var(--navMediaBadgeMarginRightEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .eko-media-badge-mobile {\n display: none\n }\n\n .eko-gallery.eko-liquid-gallery .eko-nav li .eko-media-badge-desktop {\n display: flex\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-media-badge {\n width: var(--navMediaBadgeSizeEkoDesktop);\n height: var(--navMediaBadgeSizeEkoDesktop);\n top: var(--navMediaBadgeMarginTopEkoDesktop);\n right: var(--navMediaBadgeMarginRightEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .eko-media-badge-mobile {\n display: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-nav li .eko-media-badge-desktop {\n display: flex\n }\n}\n\n.eko-loading-animation {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow: hidden;\n pointer-events: none\n}\n\n.eko-loading-animation.eko-show-loading-animation .eko-animated-bar {\n opacity: .6\n}\n\n.eko-loading-animation.eko-show-loading-animation .eko-animated-bar .eko-animated-bar-inner {\n animation: eko-loading-bar-inner-animation 2s infinite\n}\n\n.eko-loading-animation.eko-show-loading-text .eko-loading-text {\n opacity: 1\n}\n\n.eko-loading-animation .eko-animated-bar {\n width: 100%;\n height: 4px;\n background-color: #e8e8e8b2;\n opacity: 0;\n transition: opacity .5s;\n position: relative\n}\n\n.eko-loading-animation .eko-animated-bar .eko-animated-bar-inner {\n width: 150px;\n height: 100%;\n transform: translate(-150px);\n background-color: var(--accentColorEko, #4d484b);\n display: block;\n position: absolute\n}\n\n.eko-loading-animation .eko-loading-text {\n position: absolute;\n top: 10px;\n left: 50%;\n transform: translate(-50%);\n color: #656565;\n font-size: 12px;\n font-family: Bogle-Medium, sans-serif;\n font-weight: 500;\n opacity: 0;\n align-items: center;\n display: flex;\n gap: 2px;\n transition: opacity .5s\n}\n\n.eko-loading-animation .eko-loading-text-icon {\n opacity: 60%\n}\n\n.eko-loading-animation .eko-loading-text-icon svg {\n transform: translate(2px, 2px)\n}\n\n.eko-loading-animation .eko-loading-text-icon path {\n fill: var(--accentColorEko, #4d484b)\n}\n\n.eko-loading-animation.eko-hide-icon .eko-loading-text-icon {\n display: none\n}\n\n@keyframes eko-loading-bar-inner-animation {\n 0% {\n left: -350px\n }\n\n to {\n left: calc(100% + 350px)\n }\n}\n\n.eko-smart-loading {\n position: absolute;\n top: 8px;\n left: 50%;\n transform: translate(-50%);\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px\n}\n\n.eko-smart-loading div {\n position: relative;\n width: 158px;\n height: 3px;\n background-color: #dcdcdc;\n overflow: hidden;\n opacity: 0;\n animation: eko-smart-loading-show-animation .2s linear forwards 1s\n}\n\n.eko-smart-loading div:after {\n content: "";\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background-color: #878787;\n animation: eko-smart-loading-animation 2.5s ease-in-out infinite\n}\n\n.eko-smart-loading p {\n font-size: 11px;\n line-height: 120%;\n font-weight: 500;\n color: #6b6b6b;\n text-shadow: 0 0 2px white;\n opacity: 0;\n animation: eko-smart-loading-show-animation .2s linear forwards 3s\n}\n\n@keyframes eko-smart-loading-animation {\n 0% {\n transform: translate(-100%)\n }\n\n to {\n transform: translate(100%)\n }\n}\n\n@keyframes eko-smart-loading-show-animation {\n 0% {\n opacity: 0\n }\n\n to {\n opacity: 100%\n }\n}\n\n@media screen and (min-width: 450px) {\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-animated-bar {\n height: 6px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-loading-text {\n font-size: 16px;\n top: 12px\n }\n\n .eko-gallery.eko-liquid-gallery .eko-loading-animation .eko-loading-text-icon {\n transform: rotate(180deg)\n }\n}\n\n@media screen and (min-width: 450px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-animated-bar {\n height: 6px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-loading-text {\n font-size: 16px;\n top: 12px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-loading-animation .eko-loading-text-icon {\n transform: rotate(180deg)\n }\n}\n\n.eko-carousel {\n width: 100%;\n white-space: nowrap;\n overflow-x: auto;\n overflow-y: hidden;\n scroll-snap-type: x mandatory;\n overscroll-behavior-x: contain;\n align-self: start;\n align-items: start;\n display: flex;\n gap: 10px;\n scrollbar-width: none;\n -ms-overflow-style: none\n}\n\n.eko-carousel li {\n width: 100%;\n display: inline-block;\n position: relative;\n align-items: start;\n overflow: hidden;\n scroll-snap-align: center;\n scroll-snap-stop: always;\n flex-shrink: 0\n}\n\n.eko-carousel li img.eko-cover-image {\n position: relative;\n pointer-events: none;\n transition: opacity .5s;\n z-index: 1;\n width: 100%;\n height: 100%;\n background-color: var(--carouselInteractiveCoverBackgroundColorEko)\n}\n\n.eko-carousel li iframe {\n position: absolute;\n border: none;\n top: 0;\n left: 0\n}\n\n.eko-carousel li img,\n.eko-carousel li video {\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n min-width: 0;\n background-color: var(--carouselItemsBackgroundColorEko)\n}\n\n.eko-carousel li[data-type=videoembed],\n.eko-carousel li[data-type=video] {\n cursor: pointer\n}\n\n.eko-carousel::-webkit-scrollbar {\n display: none\n}\n\n.eko-carousel:has(.zoomed) {\n overflow: hidden\n}\n\n.eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoMobile)\n}\n\n.eko-carousel li img.eko-desktop-cover-image {\n display: none\n}\n\n.eko-carousel li img.eko-mobile-cover-image {\n display: inline\n}\n\n.eko-carousel li img,\n.eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoMobile);\n object-fit: var(--carouselItemsObjectFitEkoMobile)\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery .eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-carousel li img,\n .eko-gallery.eko-liquid-gallery .eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop);\n object-fit: var(--carouselItemsObjectFitEkoDesktop)\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li img,\n .eko-gallery.eko-react-gallery.eko-desktop .eko-carousel li video {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop);\n object-fit: var(--carouselItemsObjectFitEkoDesktop)\n }\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-nav-container {\n display: none\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-carousel {\n overflow-x: hidden\n}\n\n.eko-gallery.eko-mobile-embed-layout .eko-mobile-carousel-scroll {\n overflow-x: auto\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-nav-container {\n display: none\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-carousel {\n overflow-x: hidden\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-embed-layout .eko-carousel.eko-desktop-carousel-scroll {\n overflow-x: auto\n }\n\n .eko-gallery.eko-liquid-gallery.eko-mobile-embed-layout.eko-desktop-nav-layout .eko-nav-container {\n display: flex\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-nav-container {\n display: none\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-carousel {\n overflow-x: hidden\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-embed-layout .eko-carousel.eko-desktop-carousel-scroll {\n overflow-x: auto\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-mobile-embed-layout.eko-desktop-nav-layout .eko-nav-container {\n display: flex\n }\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-bottom .eko-nav,\n.eko-gallery.eko-desktop-nav-layout.eko-desktop-nav-bottom .eko-nav,\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-top .eko-nav,\n.eko-gallery.eko-desktop-nav-layout.eko-desktop-nav-top .eko-nav {\n flex-direction: row;\n overflow-x: auto;\n overflow-y: hidden;\n max-width: 100%;\n margin: auto\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-bottom {\n flex-direction: column-reverse\n}\n\n.eko-gallery.eko-mobile-nav-layout.eko-mobile-nav-top {\n flex-direction: column\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-bottom {\n flex-direction: column-reverse\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-top {\n flex-direction: column\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-bottom {\n flex-direction: column-reverse\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-top {\n flex-direction: column\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right {\n flex-direction: row-reverse\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left {\n flex-direction: row\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav {\n display: flex;\n flex-direction: column;\n justify-content: start;\n overflow-x: hidden;\n overflow-y: auto;\n gap: var(--navItemsGapEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container {\n display: flex;\n flex-shrink: 0\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button {\n top: 4px;\n left: auto\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n bottom: 4px\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n right: 50%;\n transform: translate(50%)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg {\n transform: rotate(90deg)\n }\n\n .eko-gallery.eko-liquid-gallery.eko-desktop-nav-layout .eko-carousel {\n align-self: start\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right {\n flex-direction: row-reverse\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left {\n flex-direction: row\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav {\n display: flex;\n flex-direction: column;\n justify-content: start;\n overflow-x: hidden;\n overflow-y: auto;\n gap: var(--navItemsGapEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container {\n display: flex;\n flex-shrink: 0\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button {\n top: 4px;\n left: auto\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n bottom: 4px\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button {\n right: 50%;\n transform: translate(50%)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-left .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-prev-nav-button svg,\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout.eko-desktop-nav-right .eko-nav-container button.eko-nav-arrow.eko-next-nav-button svg {\n transform: rotate(90deg)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop.eko-desktop-nav-layout .eko-carousel {\n align-self: start\n }\n}\n\n.eko-gallery .eko-introButton {\n cursor: pointer;\n white-space: nowrap;\n pointer-events: auto;\n position: absolute;\n bottom: 100px;\n left: 50%;\n transform: translate(-50%);\n padding: 15px 20px\n}\n\n.eko-gallery .eko-introButton .eko-handContainer {\n display: none\n}\n\n.eko-gallery {\n position: relative;\n overflow: hidden;\n display: flex;\n flex-direction: row;\n justify-content: start;\n margin-inline-start: calc(-1 * var(--outerWidth));\n margin-inline-end: calc(-1 * var(--outerWidth));\n padding: var(--galleryPaddingEkoMobile);\n margin: auto;\n max-width: var(--galleryMaxWidthEkoMobile);\n transition: height var(--galleryTransition, .8s cubic-bezier(.35, 0, 0, 1) 1.5s), padding 0s;\n gap: var(--galleryGapEkoMobile)\n}\n\n.eko-gallery .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoMobile);\n overflow: hidden;\n flex: 1;\n display: flex;\n height: fit-content\n}\n\n.eko-gallery .eko-smart-gallery-container iframe {\n width: 100%;\n aspect-ratio: var(--carouselItemsAspectRatioEkoMobile)\n}\n\n.eko-gallery .eko-smart-gallery-container.eko-project-not-ready {\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n opacity: 0;\n pointer-events: none;\n touch-action: none\n}\n\n.eko-gallery .eko-smart-gallery-container.eko-project-not-ready iframe {\n pointer-events: none;\n touch-action: none\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-liquid-gallery {\n max-width: var(--galleryMaxWidthEkoDesktop);\n gap: var(--galleryGapEkoDesktop);\n padding: var(--galleryPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-liquid-gallery .eko-smart-gallery-container iframe {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop)\n }\n}\n\n@media screen and (min-width: 768px) {\n .eko-gallery.eko-react-gallery.eko-desktop {\n max-width: var(--galleryMaxWidthEkoDesktop);\n gap: var(--galleryGapEkoDesktop);\n padding: var(--galleryPaddingEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-smart-gallery-container {\n border-radius: var(--carouselItemsRadiusEkoDesktop)\n }\n\n .eko-gallery.eko-react-gallery.eko-desktop .eko-smart-gallery-container iframe {\n aspect-ratio: var(--carouselItemsAspectRatioEkoDesktop)\n }\n}'),Xt=({layout:t,style:n})=>{let i={};return function(t={}){Object.keys(t).forEach((e=>{i[`--${e}Eko`]=t[e]}))}(n),function(t){var e,n;const r=(null==t||null===(e=t.desktop)||void 0===e?void 0:e.config)||{},o=(null==t||null===(n=t.mobile)||void 0===n?void 0:n.config)||{};Object.keys(r).forEach((t=>{"string"==typeof r[t]&&(i[`--${t}EkoDesktop`]=r[t])})),Object.keys(o).forEach((t=>{"string"==typeof o[t]&&(i[`--${t}EkoMobile`]=o[t])}))}(t),e.createElement("style",{key:{layout:t,style:n}},`.eko-gallery {${Object.keys(i).map((t=>`${t}: ${i[t]};`)).join("\n")}}`)};Xt.propTypes={layout:Tt.object,style:Tt.object},u("experiment");const Yt=({activeVariantId:t,activeElementId:n,hasInteractive:i,experiments:r,publishItem:o})=>{const s="gallery",a=e.useRef(t),l=e.useRef(n),c=e.useRef(i),u=e.useRef(r),d=e.useRef(o);e.useEffect((()=>{a.current=t,l.current=n,c.current=i,u.current=r,d.current=o}),[t,n,i,r,o]);const h={publishItemPacker:{tag:s,schema:"iglu:com.helloeko/publishitem/jsonschema/1-0-0",match:/.*/,getData:function(){const t=d.current;if(t){const e={};return null!=t&&t.id&&(e.id=t.id),null!=t&&t.productId&&(e.productid=t.productId),t.salesChannelId&&(e.saleschannelid=t.salesChannelId),null!=t&&t.salesChannelName&&(e.saleschannelname=t.salesChannelName),t.salesChannelType&&(e.saleschanneltype=t.salesChannelType),e.id?e:void 0}}},galleryInteractionPacker:{tag:s,schema:"iglu:com.helloeko/gallery_interaction/jsonschema/1-0-0",match:"gallery.interaction",getData:function({elementid:t,interactiontype:e}){return{elementid:String(t),interactiontype:e}}},galleryPacker:{tag:s,schema:"iglu:com.helloeko/gallery/jsonschema/1-0-2",match:/^gallery.*/,getData:function(){var t;return{activeitemid:l.current.toString(),activevariantid:a.current,hasinteractive:c.current,version:(null===(t=window.eko)||void 0===t||null===(t=t.gallery)||void 0===t?void 0:t.version)||""}}},activeVariantIdPacker:{tag:s,schema:"iglu:com.helloeko/variant/jsonschema/1-0-1",match:/.*/,getData:function(){if(a.current)return{id:a.current}}},experimentPacker:{tag:s,schema:"iglu:com.helloeko/experiment/jsonschema/1-0-3",match:/.*/,getData:function(){var t;let e=function(t){let e=null;if(t){const n=Math.floor(Date.now()/1e3);for(const i of t){if("deliverable"!==i.type)return;const t=Math.floor(new Date(i.startDate).getTime()/1e3),r=Math.floor(new Date(i.endDate).getTime()/1e3);!0===i.active&&n>t&&n<r&&(e=i)}}return e}(u.current);if(!e)return;let n={experimentid:e.id||"",experimentvariant:e.chosen||"pending decision",experimenttype:e.type||""},i=null===(t=e.targetDevice)||void 0===t?void 0:t.toLowerCase();return"mobile"!==i&&"notmobile"!==i||(n.experimenttargeting={device:i}),n}}};return e.useEffect((()=>(Object.values(h).forEach((t=>{window.EkoAnalytics("registerContextPacker",t)})),()=>{window.EkoAnalytics("reset",s)})),[]),null};Yt.propTypes={activeVariantId:Tt.string,activeElementId:Tt.number,hasInteractive:Tt.bool,experiments:Tt.array,publishItem:Tt.object};const Qt=({variantId:t,activeItem:n,hasInteractive:i,activeIndex:r,experiments:o,publishItem:s})=>{const a=e.useRef(!0);return e.useEffect((()=>{a.current||t&&S.track("gallery.variant.change")}),[t]),e.useEffect((()=>{a.current||S.track("gallery.element.change",{activeIndex:r})}),[r]),e.useEffect((()=>{a.current||n&&null!=s&&s.id&&S.track("gallery.asset.view",{publishitemid:s.id,type:n.type,name:n.name})}),[n]),e.useEffect((()=>{a.current=!1}),[]),e.createElement(Yt,{activeVariantId:t||"ekonovar",activeElementId:r,hasInteractive:i,experiments:o,publishItem:s})};Qt.propTypes={variantId:Tt.string,activeItem:Tt.object,hasInteractive:Tt.bool,activeIndex:Tt.number,experiments:Tt.array,publishItem:Tt.object};const Jt="eko-gallery-react";function Zt(t,e){var n,i,r;const o=(null==t||null===(n=t.variantMap)||void 0===n?void 0:n[e])||"ekonovar";return(null==t||null===(i=t.items)||void 0===i?void 0:i.find((t=>(null==t?void 0:t.variantId)===o)))||(null==t||null===(r=t.items)||void 0===r?void 0:r[0])}"undefined"!=typeof window&&(window.EkoAnalytics||(console.log("EkoAnalytics is not defined, initializing a no-op function..."),window.EkoAnalytics=()=>{}));const te=e.forwardRef((({className:t,config:n,instanceId:i,variantId:r,activeItem:o={index:0,step:0},onEvent:s,forceMobile:a},l)=>{var c,u,d,h,f,p;const m=null!==(c=null===(u=n.options)||void 0===u?void 0:u.loadingTimeout)&&void 0!==c?c:12,v=null===(d=null===(h=n.options)||void 0===h?void 0:h.showCoverLoadAnimation)||void 0===d||d,[g,y]=e.useState(Zt(n,r)),[b,k]=e.useState({index:o.index,step:o.step,source:"external-nav"}),[w,x]=e.useState(!1),[_,T]=e.useState(!1),[E,I]=e.useState("eko-desktop"),A=e.useRef(!1),N=e.useRef(!1),M=e.useRef(o),F=e.useRef(null),C=e.useRef(r);function O(){const t=a||window.innerWidth<768?"eko-mobile":"eko-desktop";I(t)}return N.current||(Ft.send("galleryinit"),N.current=!0),e.useEffect((()=>{const t=C.current!==r;C.current=r,y(Zt(n,r)),t&&!A.current&&k({index:0,step:0,source:"external-nav"})}),[n,r]),e.useEffect((()=>{if(s)return Ft.subscribe(s),()=>{Ft.unsubscribe()}}),[s]),e.useEffect((()=>{A.current=_}),[_]),e.useEffect((()=>{x(!1),T(!1);const t=setTimeout((()=>{A.current||(x(!0),S.track("gallery.load.timeout"))}),1e3*m);return()=>{clearTimeout(t)}}),[n]),e.useEffect((()=>{O()}),[a]),e.useEffect((()=>(window.addEventListener("resize",O),O(),()=>{window.removeEventListener("resize",O)})),[a]),e.useEffect((()=>(window.EkoAnalytics("trackElementVisibility",F.current,Jt),()=>{window.EkoAnalytics("stopTrackingElementVisibility",Jt)})),[]),e.useEffect((()=>{!("carousel"===(null==b?void 0:b.source)||"nav"===(null==b?void 0:b.source))||(null==b?void 0:b.index)===o.index&&(null==b?void 0:b.step)===o.step||Ft.send("activeitemchanged",{index:null==b?void 0:b.index,step:null==b?void 0:b.step})}),[b,o]),e.useEffect((()=>{M.current.index===o.index&&M.current.step===o.step||(M.current=o,k({index:o.index,step:o.step,source:"external-nav"}))}),[o]),e.createElement(e.Fragment,null,e.createElement(Kt,null),e.createElement(Xt,{layout:n.layout,style:n.style,forceMobile:a}),e.createElement(Qt,{variantId:r,activeItem:null==g||null===(f=g.items)||void 0===f?void 0:f[b.index],activeIndex:b.index,hasInteractive:_,experiments:n.experiments,publishItem:null==n||null===(p=n.__autoGenerated)||void 0===p?void 0:p.publishItem}),e.createElement("section",{className:`${`eko-gallery eko-react-gallery ${function(t){let e="";return["mobile","desktop"].forEach((n=>{var i,r;const o=null!==(i=null==t||null===(r=t[n])||void 0===r?void 0:r.type)&&void 0!==i?i:"nav";if(e+=`eko-${n}-${o}-layout `,"nav"===o){var s;const i="desktop"===n,r=(null==t||null===(s=t[n])||void 0===s||null===(s=s.config)||void 0===s?void 0:s.orientation)||(i?"left":"bottom");e+=`eko-${n}-nav-${r} `}})),e}(n.layout)} ${null!=t?t:""}`.trim()} ${E}`,"aria-controls":"main-content",ref:F},e.createElement(Rt,{items:(null==g?void 0:g.items)||[],setActiveIndex:k,activeIndex:b.index,layout:n.layout,carouselMounted:_,forceMobile:a}),!_&&e.createElement(jt,{ref:l,items:(null==g?void 0:g.items)||[],setActiveIndex:k,activeIndex:{index:b.index,source:null==b?void 0:b.source},showSmartLoaders:!w&&v}),!w&&e.createElement(Ht,{ref:l,config:n,instanceId:i,activeItem:b,setActiveItem:k,variantId:null==g?void 0:g.variantId,smartGalleryLoaded:_,forceMobile:a,onLoad:function(){T(!0)}})))}));te.propTypes={className:Tt.string,config:Tt.object.isRequired,instanceId:Tt.string,variantId:Tt.string,activeItem:Tt.object,onEvent:Tt.func,forceMobile:Tt.bool,onPrev:Tt.func,onNext:Tt.func},te.displayName="EkoGallery";var ee=e.memo(te);const ne=u("gallery-react");const ie=e.forwardRef(((t,n)=>{var i;e.useEffect((()=>(ne.setDataStorage("gallery-react",{config:t.config}),window.eko=window.eko||{},window.eko.config=t.config,window.eko.gallery={version:"4.0.10"},()=>{window.eko.config=void 0})),[t.config]);const{children:r,...o}=t;return void 0!==t.config?e.createElement(ee,R({ref:n},o,{key:null===(i=t.config.__autoGenerated)||void 0===i||null===(i=i.publishItem)||void 0===i?void 0:i.id})):r}));ie.propTypes={className:Tt.string,config:Tt.object,variantId:Tt.string,onEvent:Tt.func,instanceId:Tt.string,children:Tt.node},ie.displayName="EkoGalleryWrapper";var re,oe,se,ae,le,ce,ue,de,he,fe,pe,me,ve,ge,ye,be,ke,we,xe,_e,Te,Ee,Ie,Se,Ae,Ne,Me,Fe,Ce,Oe,Pe,Re,De,Le,Be,ze,We,je,Ue,$e,qe,Ve,Ge,He,Ke,Xe,Ye,Qe,Je,Ze,tn,en=e.memo(ie);const nn=1,rn=2,on=4,sn=8,an=16,ln=1,cn=4,un=8,dn=16,hn="[",fn="[!",pn="]",mn={},vn=Symbol(),gn="http://www.w3.org/1999/xhtml",yn="@attach",bn=!1;var kn=Array.isArray,wn=Array.prototype.indexOf,xn=Array.from,_n=Object.defineProperty,Tn=Object.getOwnPropertyDescriptor,En=Object.getOwnPropertyDescriptors,In=Object.prototype,Sn=Array.prototype,An=Object.getPrototypeOf,Nn=Object.isExtensible;function Mn(){var t,e;return{promise:new Promise(((n,i)=>{t=n,e=i})),resolve:t,reject:e}}const Fn=2,Cn=4,On=8,Pn=1<<24,Rn=16,Dn=32,Ln=64,Bn=128,zn=512,Wn=1024,jn=2048,Un=4096,$n=8192,qn=16384,Vn=32768,Gn=65536,Hn=1<<17,Kn=1<<18,Xn=1<<19,Yn=1<<20,Qn=1<<25,Jn=32768,Zn=1<<21,ti=1<<22,ei=1<<23,ni=Symbol("$state"),ii=Symbol("legacy props"),ri=Symbol(""),oi=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},si=3,ai=8;function li(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function ci(t){console.warn("https://svelte.dev/e/hydration_mismatch")}let ui,di=!1;function hi(t){di=t}function fi(t){if(null===t)throw ci(),mn;return ui=t}function pi(){return fi(ho(ui))}function mi(t){if(di){if(null!==ho(ui))throw ci(),mn;ui=t}}function vi(t=!0){for(var e=0,n=ui;;){if(n.nodeType===ai){var i=n.data;if(i===pn){if(0===e)return n;e-=1}else i!==hn&&i!==fn||(e+=1)}var r=ho(n);t&&n.remove(),n=r}}function gi(t){if(!t||t.nodeType!==ai)throw ci(),mn;return t.data}function yi(t){return t===this.v}function bi(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 ki=!1,wi=null;function xi(t){wi=t}function _i(t){return Ii().get(t)}function Ti(t,e=!1,n){wi={p:wi,i:!1,c:null,e:null,s:t,x:null,l:null}}function Ei(t){var e=wi,n=e.e;if(null!==n)for(var i of(e.e=null,n))Eo(i);return e.i=!0,wi=e.p,{}}function Ii(t){var e,n;return null===wi&&li(),null!==(n=(e=wi).c)&&void 0!==n?n:e.c=new Map(function(t){let e=t.p;for(;null!==e;){const t=e.c;if(null!==t)return t;e=e.p}return null}(wi)||void 0)}let Si=[];function Ai(){var t=Si;Si=[],function(t){for(var e=0;e<t.length;e++)t[e]()}(t)}function Ni(t){if(0===Si.length&&!qi){var e=Si;queueMicrotask((()=>{e===Si&&Ai()}))}Si.push(t)}function Mi(){for(;Si.length>0;)Ai()}function Fi(t){var e=Ko;if(null===e)return Vo.f|=ei,t;if(e.f&Vn)Ci(t,e);else{if(!(e.f&Bn))throw t;e.b.error(t)}}function Ci(t,e){for(;null!==e;){if(e.f&Bn)try{return void e.b.error(t)}catch(e){t=e}e=e.parent}throw t}const Oi=-7169;function Pi(t,e){t.f=t.f&Oi|e}function Ri(t){t.f&zn||null===t.deps?Pi(t,Wn):Pi(t,Un)}function Di(t){if(null!==t)for(const e of t)e.f&Fn&&e.f&Jn&&(e.f^=Jn,Di(e.deps))}function Li(t,e,n){t.f&jn?e.add(t):t.f&Un&&n.add(t),Di(t.deps),Pi(t,Wn)}const Bi=new Set;let zi=null,Wi=null,ji=[],Ui=null,$i=!1,qi=!1;var Vi=new WeakMap,Gi=new WeakMap,Hi=new WeakMap,Ki=new WeakMap,Xi=new WeakMap,Yi=new WeakMap,Qi=new WeakMap,Ji=new WeakSet;class Zi{constructor(){O(this,Ji),P(this,"committed",!1),P(this,"current",new Map),P(this,"previous",new Map),F(this,Vi,new Set),F(this,Gi,new Set),F(this,Hi,0),F(this,Ki,0),F(this,Xi,null),F(this,Yi,new Set),F(this,Qi,new Set),P(this,"skipped_effects",new Set),P(this,"is_fork",!1)}is_deferred(){return this.is_fork||M(Ki,this)>0}process(t){ji=[],this.apply();var e,n=[],i=[];for(const e of t)A(Ji,this,tr).call(this,e,n,i);(this.is_fork||A(Ji,this,nr).call(this),this.is_deferred())?(A(Ji,this,er).call(this,i),A(Ji,this,er).call(this,n)):(zi=null,ar(i),ar(n),null===(e=M(Xi,this))||void 0===e||e.resolve());Wi=null}capture(t,e){var n;(e===vn||this.previous.has(t)||this.previous.set(t,e),t.f&ei)||(this.current.set(t,t.v),null===(n=Wi)||void 0===n||n.set(t,t.v))}activate(){zi=this,this.apply()}deactivate(){zi===this&&(zi=null,Wi=null)}flush(){if(this.activate(),ji.length>0){if(rr(),null!==zi&&zi!==this)return}else 0===M(Hi,this)&&this.process([]);this.deactivate()}discard(){for(const t of M(Gi,this))t(this);M(Gi,this).clear()}increment(t){C(Hi,this,M(Hi,this)+1),t&&C(Ki,this,M(Ki,this)+1)}decrement(t){C(Hi,this,M(Hi,this)-1),t&&C(Ki,this,M(Ki,this)-1),this.revive()}revive(){for(const t of M(Yi,this))M(Qi,this).delete(t),Pi(t,jn),ur(t);for(const t of M(Qi,this))Pi(t,Un),ur(t);this.flush()}oncommit(t){M(Vi,this).add(t)}ondiscard(t){M(Gi,this).add(t)}settled(){var t;return(null!==(t=M(Xi,this))&&void 0!==t?t:C(Xi,this,Mn())).promise}static ensure(){if(null===zi){const t=zi=new Zi;Bi.add(zi),qi||Zi.enqueue((()=>{zi===t&&t.flush()}))}return zi}static enqueue(t){Ni(t)}apply(){}}function tr(t,e,n){t.f^=Wn;for(var i=t.first,r=null;null!==i;){var o=i.f,s=!!(o&(Dn|Ln));if(!(s&&!!(o&Wn)||!!(o&$n)||this.skipped_effects.has(i))&&null!==i.fn){s?i.f^=Wn:null!==r&&o&(Cn|On|Pn)?r.b.defer_effect(i):o&Cn?e.push(i):ss(i)&&(o&Rn&&M(Yi,this).add(i),ds(i));var a=i.first;if(null!==a){i=a;continue}}var l=i.parent;for(i=i.next;null===i&&null!==l;)l===r&&(r=null),i=l.next,l=l.parent}}function er(t){for(var e=0;e<t.length;e+=1)Li(t[e],M(Yi,this),M(Qi,this))}function nr(){if(0===M(Ki,this)){for(const t of M(Vi,this))t();M(Vi,this).clear()}0===M(Hi,this)&&A(Ji,this,ir).call(this)}function ir(){if(Bi.size>1){this.previous.clear();var t=Wi,e=!0;for(const t of Bi){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=ji;ji=[];const e=new Set,o=new Map;for(const t of i)lr(t,r,e,o);if(ji.length>0){zi=t,t.apply();for(const e of ji)A(Ji,t,tr).call(t,e,[],[]);t.deactivate()}ji=n}}zi=null,Wi=t}this.committed=!0,Bi.delete(this)}function rr(){var t=jo;$i=!0;try{var e=0;for(Uo(!0);ji.length>0;){var n=Zi.ensure();if(e++>1e3)or();n.process(ji),Hr.clear()}}finally{$i=!1,Uo(t),Ui=null}}function or(){try{!function(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}()}catch(t){Ci(t,Ui)}}let sr=null;function ar(t){var e=t.length;if(0!==e){for(var n=0;n<e;){var i,r=t[n++];if(!(r.f&(qn|$n))&&ss(r))if(sr=new Set,ds(r),null===r.deps&&null===r.first&&null===r.nodes&&(null===r.teardown&&null===r.ac?Ro(r):r.fn=null),(null===(i=sr)||void 0===i?void 0:i.size)>0){Hr.clear();for(const t of sr){if(t.f&(qn|$n))continue;const e=[t];let n=t.parent;for(;null!==n;)sr.has(n)&&(sr.delete(n),e.push(n)),n=n.parent;for(let t=e.length-1;t>=0;t--){const n=e[t];n.f&(qn|$n)||ds(n)}}sr.clear()}}sr=null}}function lr(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&Fn?lr(r,e,n,i):t&(ti|Rn)&&!(t&jn)&&cr(r,e,i)&&(Pi(r,jn),ur(r))}}function cr(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&Fn&&cr(i,e,n))return n.set(i,!0),!0}return n.set(t,!1),!1}function ur(t){for(var e=Ui=t;null!==e.parent;){var n=(e=e.parent).f;if($i&&e===Ko&&n&Rn&&!(n&Kn))return;if(n&(Ln|Dn)){if(!(n&Wn))return;e.f^=Wn}}ji.push(e)}var dr=Gn|Xn|Bn;var hr=new WeakMap,fr=new WeakMap,pr=new WeakMap,mr=new WeakMap,vr=new WeakMap,gr=new WeakMap,yr=new WeakMap,br=new WeakMap,kr=new WeakMap,wr=new WeakMap,xr=new WeakMap,_r=new WeakMap,Tr=new WeakMap,Er=new WeakMap,Ir=new WeakMap,Sr=new WeakMap,Ar=new WeakMap,Nr=new WeakSet;class Mr{constructor(t,e,n){O(this,Nr),P(this,"parent",void 0),P(this,"is_pending",!1),F(this,hr,void 0),F(this,fr,di?ui:null),F(this,pr,void 0),F(this,mr,void 0),F(this,vr,void 0),F(this,gr,null),F(this,yr,null),F(this,br,null),F(this,kr,null),F(this,wr,null),F(this,xr,0),F(this,_r,0),F(this,Tr,!1),F(this,Er,new Set),F(this,Ir,new Set),F(this,Sr,null),F(this,Ar,function(t){let e,n=0,i=Xr(0);return()=>{xo()&&(fs(i),So((()=>(0===n&&(e=vs((()=>t((()=>to(i)))))),n+=1,()=>{Ni((()=>{var t;n-=1,0===n&&(null===(t=e)||void 0===t||t(),e=void 0,to(i))}))}))))}}((()=>(C(Sr,this,Xr(M(xr,this))),()=>{C(Sr,this,null)})))),C(hr,this,t),C(pr,this,e),C(mr,this,n),this.parent=Ko.b,this.is_pending=!!M(pr,this).pending,C(vr,this,No((()=>{if(Ko.b=this,di){const t=M(fr,this);pi();t.nodeType===ai&&t.data===fn?A(Nr,this,Cr).call(this):(A(Nr,this,Fr).call(this),0===M(_r,this)&&(this.is_pending=!1))}else{var t=A(Nr,this,Or).call(this);try{C(gr,this,Fo((()=>n(t))))}catch(t){this.error(t)}M(_r,this)>0?A(Nr,this,Rr).call(this):this.is_pending=!1}return()=>{var t;null===(t=M(wr,this))||void 0===t||t.remove()}}),dr)),di&&C(hr,this,ui)}defer_effect(t){Li(t,M(Er,this),M(Ir,this))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!M(pr,this).pending}update_pending_count(t){A(Nr,this,Dr).call(this,t),C(xr,this,M(xr,this)+t),M(Sr,this)&&Zr(M(Sr,this),M(xr,this))}get_effect_pending(){return M(Ar,this).call(this),fs(M(Sr,this))}error(t){var e=M(pr,this).onerror;let n=M(pr,this).failed;if(M(Tr,this)||!e&&!n)throw t;M(gr,this)&&(Po(M(gr,this)),C(gr,this,null)),M(yr,this)&&(Po(M(yr,this)),C(yr,this,null)),M(br,this)&&(Po(M(br,this)),C(br,this,null)),di&&(fi(M(fr,this)),function(t=1){if(di){for(var e=t,n=ui;e--;)n=ho(n);ui=n}}(),fi(vi()));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")}(),Zi.ensure(),C(xr,this,0),null!==M(br,this)&&Do(M(br,this),(()=>{C(br,this,null)})),this.is_pending=this.has_pending_snippet(),C(gr,this,A(Nr,this,Pr).call(this,(()=>(C(Tr,this,!1),Fo((()=>M(mr,this).call(this,M(hr,this)))))))),M(_r,this)>0?A(Nr,this,Rr).call(this):this.is_pending=!1)};var s=Vo;try{Ho(null),r=!0,null==e||e(t,o),r=!1}catch(t){Ci(t,M(vr,this)&&M(vr,this).parent)}finally{Ho(s)}n&&Ni((()=>{C(br,this,A(Nr,this,Pr).call(this,(()=>{Zi.ensure(),C(Tr,this,!0);try{return Fo((()=>{n(M(hr,this),(()=>t),(()=>o))}))}catch(t){return Ci(t,M(vr,this).parent),null}finally{C(Tr,this,!1)}})))}))}}function Fr(){try{C(gr,this,Fo((()=>M(mr,this).call(this,M(hr,this)))))}catch(t){this.error(t)}}function Cr(){const t=M(pr,this).pending;t&&(C(yr,this,Fo((()=>t(M(hr,this))))),Zi.enqueue((()=>{var t=A(Nr,this,Or).call(this);C(gr,this,A(Nr,this,Pr).call(this,(()=>(Zi.ensure(),Fo((()=>M(mr,this).call(this,t))))))),M(_r,this)>0?A(Nr,this,Rr).call(this):(Do(M(yr,this),(()=>{C(yr,this,null)})),this.is_pending=!1)})))}function Or(){var t=M(hr,this);return this.is_pending&&(C(wr,this,co()),M(hr,this).before(M(wr,this)),t=M(wr,this)),t}function Pr(t){var e=Ko,n=Vo,i=wi;Xo(M(vr,this)),Ho(M(vr,this)),xi(M(vr,this).ctx);try{return t()}catch(t){return Fi(t),null}finally{Xo(e),Ho(n),xi(i)}}function Rr(){const t=M(pr,this).pending;null!==M(gr,this)&&(C(kr,this,document.createDocumentFragment()),M(kr,this).append(M(wr,this)),Wo(M(gr,this),M(kr,this))),null===M(yr,this)&&C(yr,this,Fo((()=>t(M(hr,this)))))}function Dr(t){var e;if(this.has_pending_snippet()){if(C(_r,this,M(_r,this)+t),0===M(_r,this)){this.is_pending=!1;for(const t of M(Er,this))Pi(t,jn),ur(t);for(const t of M(Ir,this))Pi(t,Un),ur(t);M(Er,this).clear(),M(Ir,this).clear(),M(yr,this)&&Do(M(yr,this),(()=>{C(yr,this,null)})),M(kr,this)&&(M(hr,this).before(M(kr,this)),C(kr,this,null))}}else this.parent&&A(Nr,e=this.parent,Dr).call(e,t)}function Lr(t,e,n,i){const r=zr;if(0!==n.length||0!==t.length){var o,s,a,l,c=zi,u=Ko,d=(o=Ko,s=Vo,a=wi,l=zi,function(t=!0){Xo(o),Ho(s),xi(a),t&&(null==l||l.activate())});t.length>0?Promise.all(t).then((()=>{d();try{return h()}finally{null==c||c.deactivate(),Br()}})):h()}else i(e.map(r));function h(){Promise.all(n.map((t=>Wr(t)))).then((t=>{d();try{i([...e.map(r),...t])}catch(t){u.f&qn||Ci(t,u)}null==c||c.deactivate(),Br()})).catch((t=>{Ci(t,u)}))}}function Br(){Xo(null),Ho(null),xi(null)}function zr(t){var e=Fn|jn,n=null!==Vo&&Vo.f&Fn?Vo:null;null!==Ko&&(Ko.f|=Xn);return{ctx:wi,deps:null,effects:null,equals:yi,f:e,fn:t,reactions:null,rv:0,v:vn,wv:0,parent:null!=n?n:Ko,ac:null}}function Wr(t,e,n){let i=Ko;null===i&&function(){throw new Error("https://svelte.dev/e/async_derived_orphan")}();var r=i.b,o=void 0,s=Xr(vn),a=!Vo,l=new Map;return function(t){wo(ti|Xn,t,!0)}((()=>{var e=Mn();o=e.promise;try{Promise.resolve(t()).then(e.resolve,e.reject).then((()=>{n===zi&&n.committed&&n.deactivate(),Br()}))}catch(t){e.reject(t),Br()}var n=zi;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(oi),l.delete(n),l.set(n,e)}const u=(t,e=void 0)=>{if(n.activate(),e)e!==oi&&(s.f|=ei,Zr(s,e));else{s.f&ei&&(s.f^=ei),Zr(s,t);for(const[t,e]of l){if(l.delete(t),t===n)break;e.reject(oi)}}a&&(r.update_pending_count(-1),n.decrement(c))};e.promise.then(u,(t=>u(null,t||"unknown")))})),_o((()=>{for(const t of l.values())t.reject(oi)})),new Promise((t=>{!function e(n){function i(){n===o?t(s):e(o)}n.then(i,i)}(o)}))}function jr(t){const e=zr(t);return Qo(e),e}function Ur(t){const e=zr(t);return e.equals=bi,e}function $r(t){var e=t.effects;if(null!==e){t.effects=null;for(var n=0;n<e.length;n+=1)Po(e[n])}}function qr(t){var e,n=Ko;Xo(function(t){for(var e=t.parent;null!==e;){if(!(e.f&Fn))return e.f&qn?null:e;e=e.parent}return null}(t));try{t.f&=~Jn,$r(t),e=ls(t)}finally{Xo(n)}return e}function Vr(t){var e,n,i=qr(t);if(!t.equals(i)&&(t.wv=os(),(null===(e=zi)||void 0===e||!e.is_fork||null===t.deps)&&(t.v=i,null===t.deps)))return void Pi(t,Wn);$o||(null!==Wi?(xo()||null!==(n=zi)&&void 0!==n&&n.is_fork)&&Wi.set(t,i):Ri(t))}let Gr=new Set;const Hr=new Map;let Kr=!1;function Xr(t,e){return{f:0,v:t,reactions:null,equals:yi,rv:0,wv:0}}function Yr(t,e){const n=Xr(t);return Qo(n),n}function Qr(t,e=!1,n=!0){const i=Xr(t);return e||(i.equals=bi),i}function Jr(t,e,n=!1){var i;return null!==Vo&&(!Go||Vo.f&Hn)&&Vo.f&(Fn|Rn|ti|Hn)&&(null===(i=Yo)||void 0===i||!i.includes(t))&&function(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}(),Zr(t,n?no(e):e)}function Zr(t,e){if(!t.equals(e)){var n=t.v;$o?Hr.set(t,e):Hr.set(t,n),t.v=e;var i=Zi.ensure();if(i.capture(t,n),t.f&Fn){const e=t;t.f&jn&&qr(e),Ri(e)}t.wv=os(),eo(t,jn),null!==Ko&&Ko.f&Wn&&!(Ko.f&(Dn|Ln))&&(null===ts?function(t){ts=t}([t]):ts.push(t)),!i.is_fork&&Gr.size>0&&!Kr&&function(){Kr=!1;var t=jo;Uo(!0);const e=Array.from(Gr);try{for(const t of e)t.f&Wn&&Pi(t,Un),ss(t)&&ds(t)}finally{Uo(t)}Gr.clear()}()}return e}function to(t){Jr(t,t.v+1)}function eo(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&jn);if(a&&Pi(o,e),s&Fn){var l,c=o;null===(l=Wi)||void 0===l||l.delete(c),s&Jn||(s&zn&&(o.f|=Jn),eo(c,Un))}else a&&(s&Rn&&null!==sr&&sr.add(o),ur(o))}}function no(t){if("object"!=typeof t||null===t||ni in t)return t;const e=An(t);if(e!==In&&e!==Sn)return t;var n=new Map,i=kn(t),r=Yr(0),o=is,s=t=>{if(is===o)return t();var e=Vo,n=is;Ho(null),rs(o);var i=t();return Ho(e),rs(n),i};return i&&n.set("length",Yr(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=Yr(i.value);return n.set(e,t),t})):Jr(r,i.value,!0),!0},deleteProperty(t,e){var i=n.get(e);if(void 0===i){if(e in t){const t=s((()=>Yr(vn)));n.set(e,t),to(r)}}else Jr(i,vn),to(r);return!0},get(e,i,r){var o;if(i===ni)return t;var a=n.get(i),l=i in e;if(void 0===a&&(!l||null!==(o=Tn(e,i))&&void 0!==o&&o.writable)&&(a=s((()=>Yr(no(l?e[i]:vn)))),n.set(i,a)),void 0!==a){var c=fs(a);return c===vn?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=fs(r))}else if(void 0===i){var o=n.get(e),s=null==o?void 0:o.v;if(void 0!==o&&s!==vn)return{enumerable:!0,configurable:!0,value:s,writable:!0}}return i},has(t,e){var i;if(e===ni)return!0;var r=n.get(e),o=void 0!==r&&r.v!==vn||Reflect.has(t,e);if((void 0!==r||null!==Ko&&(!o||null!==(i=Tn(t,e))&&void 0!==i&&i.writable))&&(void 0===r&&(r=s((()=>Yr(o?no(t[e]):vn))),n.set(e,r)),fs(r)===vn))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?Jr(h,vn):d in t&&(h=s((()=>Yr(vn))),n.set(d+"",h))}void 0===c?(!u||null!==(l=Tn(t,e))&&void 0!==l&&l.writable)&&(Jr(c=s((()=>Yr(void 0))),no(o)),n.set(e,c)):(u=c.v!==vn,Jr(c,s((()=>no(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&&Jr(p,m+1)}to(r)}return!0},ownKeys(t){fs(r);var e=Reflect.ownKeys(t).filter((t=>{var e=n.get(t);return void 0===e||e.v!==vn}));for(var[i,o]of n)o.v===vn||i in t||e.push(i);return e},setPrototypeOf(){!function(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}()}})}function io(t){try{if(null!==t&&"object"==typeof t&&ni in t)return t[ni]}catch{}return t}var ro,oo,so,ao;function lo(){if(void 0===ro){ro=window,oo=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;so=Tn(e,"firstChild").get,ao=Tn(e,"nextSibling").get,Nn(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),Nn(n)&&(n.__t=void 0)}}function co(t=""){return document.createTextNode(t)}function uo(t){return so.call(t)}function ho(t){return ao.call(t)}function fo(t,e){if(!di)return uo(t);var n=uo(ui);if(null===n)n=ui.appendChild(co());else if(e&&n.nodeType!==si){var i,r=co();return null===(i=n)||void 0===i||i.before(r),fi(r),r}return fi(n),n}function po(t,e=!1){var n;if(!di){var i=uo(t);return i instanceof Comment&&""===i.data?ho(i):i}if(e&&(null===(n=ui)||void 0===n?void 0:n.nodeType)!==si){var r,o=co();return null===(r=ui)||void 0===r||r.before(o),fi(o),o}return ui}function mo(t,e=1,n=!1){var i;let r=di?ui:t;for(var o;e--;)o=r,r=ho(r);if(!di)return r;if(n&&(null===(i=r)||void 0===i?void 0:i.nodeType)!==si){var s,a=co();if(null===r)null===(s=o)||void 0===s||s.after(a);else r.before(a);return fi(a),a}return fi(r),r}function vo(t){t.textContent=""}function go(t,e){if(e){const e=document.body;t.autofocus=!0,Ni((()=>{document.activeElement===e&&t.focus()}))}}let yo=!1;function bo(t){var e=Vo,n=Ko;Ho(null),Xo(null);try{return t()}finally{Ho(e),Xo(n)}}function ko(t){null===Ko&&(null===Vo&&function(){throw new Error("https://svelte.dev/e/effect_orphan")}(),function(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}()),$o&&function(){throw new Error("https://svelte.dev/e/effect_in_teardown")}()}function wo(t,e,n){var i=Ko;null!==i&&i.f&$n&&(t|=$n);var r={ctx:wi,deps:null,nodes:null,f:t|jn|zn,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{ds(r),r.f|=Vn}catch(t){throw Po(r),t}else null!==e&&ur(r);var o=r;if(!n||null!==o.deps||null!==o.teardown||null!==o.nodes||o.first!==o.last||o.f&Xn||(o=o.first,t&Rn&&t&Gn&&null!==o&&(o.f|=Gn)),null!==o&&(o.parent=i,null!==i&&function(t,e){var n=e.last;null===n?e.last=e.first=t:(n.next=t,t.prev=n,e.last=t)}(o,i),null!==Vo&&Vo.f&Fn&&!(t&Ln))){var s,a=Vo;(null!==(s=a.effects)&&void 0!==s?s:a.effects=[]).push(o)}return r}function xo(){return null!==Vo&&!Go}function _o(t){const e=wo(On,null,!1);return Pi(e,Wn),e.teardown=t,e}function To(t){ko();var e=Ko.f;if(!!(Vo||!(e&Dn)||e&Vn))return Eo(t);var n,i=wi;(null!==(n=i.e)&&void 0!==n?n:i.e=[]).push(t)}function Eo(t){return wo(Cn|Yn,t,!1)}function Io(t){return wo(Cn,t,!1)}function So(t,e=0){return wo(On|e,t,!0)}function Ao(t,e=[],n=[],i=[]){Lr(i,e,n,(e=>{wo(On,(()=>t(...e.map(fs))),!0)}))}function No(t,e=0){return wo(Rn|e,t,!0)}function Mo(t,e=0){return wo(Pn|e,t,!0)}function Fo(t){return wo(Dn|Xn,t,!0)}function Co(t){var e=t.teardown;if(null!==e){const t=$o,n=Vo;qo(!0),Ho(null);try{e.call(null)}finally{qo(t),Ho(n)}}}function Oo(t,e=!1){var n=t.first;for(t.first=t.last=null;null!==n;){const t=n.ac;null!==t&&bo((()=>{t.abort(oi)}));var i=n.next;n.f&Ln?n.parent=null:Po(n,e),n=i}}function Po(t,e=!0){var n=!1;(e||t.f&Kn)&&null!==t.nodes&&null!==t.nodes.end&&(!function(t,e){for(;null!==t;){var n=t===e?null:ho(t);t.remove(),t=n}}(t.nodes.start,t.nodes.end),n=!0),Oo(t,e&&!n),us(t,0),Pi(t,qn);var i=t.nodes&&t.nodes.t;if(null!==i)for(const t of i)t.stop();Co(t);var r=t.parent;null!==r&&null!==r.first&&Ro(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=null}function Ro(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 Do(t,e,n=!0){var i=[];Lo(t,i,!0);var r=()=>{n&&Po(t),e&&e()},o=i.length;if(o>0){var s=()=>--o||r();for(var a of i)a.out(s)}else r()}function Lo(t,e,n){if(!(t.f&$n)){t.f^=$n;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;Lo(r,e,!!(!!(r.f&Gn)||!!(r.f&Dn)&&!!(t.f&Rn))&&n),r=o}}}function Bo(t){zo(t,!0)}function zo(t,e){if(t.f&$n){t.f^=$n,t.f&Wn||(Pi(t,jn),ur(t));for(var n=t.first;null!==n;){var i=n.next;zo(n,!!(!!(n.f&Gn)||!!(n.f&Dn))&&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 Wo(t,e){if(t.nodes)for(var n=t.nodes.start,i=t.nodes.end;null!==n;){var r=n===i?null:ho(n);e.append(n),n=r}}let jo=!1;function Uo(t){jo=t}let $o=!1;function qo(t){$o=t}let Vo=null,Go=!1;function Ho(t){Vo=t}let Ko=null;function Xo(t){Ko=t}let Yo=null;function Qo(t){null!==Vo&&(null===Yo?Yo=[t]:Yo.push(t))}let Jo=null,Zo=0,ts=null;let es=1,ns=0,is=ns;function rs(t){is=t}function os(){return++es}function ss(t){var e=t.f;if(e&jn)return!0;if(e&Fn&&(t.f&=~Jn),e&Un){for(var n=t.deps,i=n.length,r=0;r<i;r++){var o=n[r];if(ss(o)&&Vr(o),o.wv>t.wv)return!0}e&zn&&null===Wi&&Pi(t,Wn)}return!1}function as(t,e,n=!0){var i,r=t.reactions;if(null!==r&&(null===(i=Yo)||void 0===i||!i.includes(t)))for(var o=0;o<r.length;o++){var s=r[o];s.f&Fn?as(s,e,!1):e===s&&(n?Pi(s,jn):s.f&Wn&&Pi(s,Un),ur(s))}}function ls(t){var e=Jo,n=Zo,i=ts,r=Vo,o=Yo,s=wi,a=Go,l=is,c=t.f;Jo=null,Zo=0,ts=null,Vo=c&(Dn|Ln)?null:t,Yo=null,xi(t.ctx),Go=!1,is=++ns,null!==t.ac&&(bo((()=>{t.ac.abort(oi)})),t.ac=null);try{t.f|=Zn;var u=(0,t.fn)(),d=t.deps;if(null!==Jo){var h;if(us(t,Zo),null!==d&&Zo>0)for(d.length=Zo+Jo.length,h=0;h<Jo.length;h++)d[Zo+h]=Jo[h];else t.deps=d=Jo;if(xo()&&t.f&zn)for(h=Zo;h<d.length;h++){var f,p;(null!==(p=(f=d[h]).reactions)&&void 0!==p?p:f.reactions=[]).push(t)}}else null!==d&&Zo<d.length&&(us(t,Zo),d.length=Zo);if(!(null===ts||Go||null===d||t.f&(Fn|Un|jn)))for(h=0;h<ts.length;h++)as(ts[h],t);return null!==r&&r!==t&&(ns++,null!==ts&&(null===i?i=ts:i.push(...ts))),t.f&ei&&(t.f^=ei),u}catch(t){return Fi(t)}finally{t.f^=Zn,Jo=e,Zo=n,ts=i,Vo=r,Yo=o,xi(s),Go=a,is=l}}function cs(t,e){let n=e.reactions;if(null!==n){var i=wn.call(n,t);if(-1!==i){var r=n.length-1;0===r?n=e.reactions=null:(n[i]=n[r],n.pop())}}if(null===n&&e.f&Fn&&(null===Jo||!Jo.includes(e))){var o=e;o.f&zn&&(o.f^=zn,o.f&=~Jn),Ri(o),$r(o),us(o,0)}}function us(t,e){var n=t.deps;if(null!==n)for(var i=e;i<n.length;i++)cs(t,n[i])}function ds(t){var e=t.f;if(!(e&qn)){Pi(t,Wn);var n=Ko,i=jo;Ko=t,jo=!0;try{e&(Rn|Pn)?function(t){for(var e=t.first;null!==e;){var n=e.next;e.f&Dn||Po(e),e=n}}(t):Oo(t),Co(t);var r=ls(t);t.teardown="function"==typeof r?r:null,t.wv=es,bn&&ki&&t.f&jn&&t.deps}finally{jo=i,Ko=n}}}async function hs(){await Promise.resolve(),function(){var t=qi;qi=!0;try{for(;;){var e;if(Mi(),0===ji.length&&(null===(e=zi)||void 0===e||e.flush(),0===ji.length))return void(Ui=null);rr()}}finally{qi=t}}()}function fs(t){var e,n,i=!!(t.f&Fn);if(null!==Vo&&!Go&&!(null!==Ko&&!!(Ko.f&qn)||null!==(n=Yo)&&void 0!==n&&n.includes(t))){var r=Vo.deps;if(Vo.f&Zn)t.rv<ns&&(t.rv=ns,null===Jo&&null!==r&&r[Zo]===t?Zo++:null===Jo?Jo=[t]:Jo.includes(t)||Jo.push(t));else{var o,s;(null!==(s=(o=Vo).deps)&&void 0!==s?s:o.deps=[]).push(t);var a=t.reactions;null===a?t.reactions=[Vo]:a.includes(Vo)||a.push(Vo)}}if($o&&Hr.has(t))return Hr.get(t);if(i){var l=t;if($o){var c=l.v;return(l.f&Wn||null===l.reactions)&&!ms(l)||(c=qr(l)),Hr.set(l,c),c}var u=!(l.f&zn)&&!Go&&null!==Vo&&(jo||!!(Vo.f&zn)),d=null===l.deps;ss(l)&&(u&&(l.f|=zn),Vr(l)),u&&!d&&ps(l)}if(null!==(e=Wi)&&void 0!==e&&e.has(t))return Wi.get(t);if(t.f&ei)throw t.v;return t.v}function ps(t){if(null!==t.deps){t.f|=zn;for(const n of t.deps){var e;(null!==(e=n.reactions)&&void 0!==e?e:n.reactions=[]).push(t),n.f&Fn&&!(n.f&zn)&&ps(n)}}}function ms(t){if(t.v===vn)return!0;if(null===t.deps)return!1;for(const e of t.deps){if(Hr.has(e))return!0;if(e.f&Fn&&ms(e))return!0}return!1}function vs(t){var e=Go;try{return Go=!0,t()}finally{Go=e}}const gs=new Set,ys=new Set;function bs(t,e,n,i={}){function r(t){if(i.capture||_s.call(e,t),!t.cancelBubble)return bo((()=>null==n?void 0:n.call(this,t)))}return t.startsWith("pointer")||t.startsWith("touch")||"wheel"===t?Ni((()=>{e.addEventListener(t,r,i)})):e.addEventListener(t,r,i),r}function ks(t,e,n,i,r){var o={capture:i,passive:r},s=bs(t,e,n,o);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&_o((()=>{e.removeEventListener(t,s,o)}))}function ws(t){for(var e=0;e<t.length;e++)gs.add(t[e]);for(var n of ys)n(t)}let xs=null;function _s(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;xs=t;var a=0,l=xs===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){_n(t,"currentTarget",{configurable:!0,get:()=>s||i});var d=Vo,h=Ko;Ho(null),Xo(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,Ho(d),Xo(h)}}}function Ts(t,e){var n=Ko;null===n.nodes&&(n.nodes={start:t,end:e,a:null,t:null})}function Es(t,e){var n,i=!!(1&e),r=!!(2&e),o=!t.startsWith("<!>");return()=>{if(di)return Ts(ui,null),ui;var e,s;void 0===n&&(e=o?t:"<!>"+t,(s=document.createElement("template")).innerHTML=e.replaceAll("<!>","\x3c!----\x3e"),n=s.content,i||(n=uo(n)));var a=r||oo?document.importNode(n,!0):n.cloneNode(!0);i?Ts(uo(a),a.lastChild):Ts(a,a);return a}}function Is(){if(di)return Ts(ui,null),ui;var t=document.createDocumentFragment(),e=document.createComment(""),n=co();return t.append(e,n),Ts(e,n),t}function Ss(t,e){if(di){var n=Ko;return n.f&Vn&&null!==n.nodes.end||(n.nodes.end=ui),void pi()}null!==t&&t.before(e)}function As(t){return t.endsWith("capture")&&"gotpointercapture"!==t&&"lostpointercapture"!==t}const Ns=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function Ms(t){return Ns.includes(t)}const Fs={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 Cs(t){var e;return t=t.toLowerCase(),null!==(e=Fs[t])&&void 0!==e?e:t}const Os=["touchstart","touchmove"];function Ps(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 Rs(t,e){return Bs(t,e)}function Ds(t,e){var n;lo(),e.intro=null!==(n=e.intro)&&void 0!==n&&n;const i=e.target,r=di,o=ui;try{for(var s=uo(i);s&&(s.nodeType!==ai||s.data!==hn);)s=ho(s);if(!s)throw mn;hi(!0),fi(s);const n=Bs(t,{...e,anchor:s});return hi(!1),n}catch(n){if(n instanceof Error&&n.message.split("\n").some((t=>t.startsWith("https://svelte.dev/e/"))))throw n;return n!==mn&&console.warn("Failed to hydrate: ",n),!1===e.recover&&function(){throw new Error("https://svelte.dev/e/hydration_failed")}(),lo(),vo(i),hi(!1),Rs(t,e)}finally{hi(r),fi(o)}}const Ls=new Map;function Bs(t,{target:e,anchor:n,props:i={},events:r,context:o,intro:s=!0}){lo();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,Os.includes(s));e.addEventListener(i,_s,{passive:r});var o=Ls.get(i);void 0===o?(document.addEventListener(i,_s,{passive:r}),Ls.set(i,1)):Ls.set(i,o+1)}}var s};l(xn(gs)),ys.add(l);var c=void 0,u=function(t){Zi.ensure();const e=wo(Ln|Xn,t,!0);return(t={})=>new Promise((n=>{t.outro?Do(e,(()=>{Po(e),n(void 0)})):(Po(e),n(void 0))}))}((()=>{var s=null!=n?n:e.appendChild(co());return function(t,e,n){new Mr(t,e,n)}(s,{pending:()=>{}},(e=>{o&&(Ti({}),wi.c=o);if(r&&(i.$$events=r),di&&Ts(e,null),c=t(e,i)||{},di&&(Ko.nodes.end=ui,null===ui||ui.nodeType!==ai||ui.data!==pn))throw ci(),mn;o&&Ei()})),()=>{for(var t of a){e.removeEventListener(t,_s);var i=Ls.get(t);0==--i?(document.removeEventListener(t,_s),Ls.delete(t)):Ls.set(t,i)}var r;(ys.delete(l),s!==n)&&(null===(r=s.parentNode)||void 0===r||r.removeChild(s))}}));return zs.set(c,u),c}let zs=new WeakMap;class Ws{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=zi;if(this.#t.has(t)){var e=this.#t.get(t),n=this.#e.get(e);if(n)Bo(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&&(Po(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();Wo(i,e),e.append(co()),this.#n.set(t,{effect:i,fragment:e})}else Po(i);this.#i.delete(t),this.#e.delete(t)};this.#r||!n?(this.#i.add(t),Do(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)||(Po(n.effect),this.#n.delete(t))};ensure(t,e){var n=zi;!e||this.#e.has(t)||this.#n.has(t)||this.#e.set(t,Fo((()=>e(this.anchor)))),this.#t.set(n,t),di&&(this.anchor=ui),this.#o()}}function js(t,e,n=!1){di&&pi();var i=new Ws(t);function r(e,n){if(di){if(e===(gi(t)===fn)){var r=vi();return fi(r),i.anchor=r,hi(!1),i.ensure(e,n),void hi(!0)}}i.ensure(e,n)}No((()=>{var t=!1;e(((e,n=!0)=>{t=!0,r(n,e)})),t||r(!1,null)}),n?Gn:0)}function Us(t,e){return e}function $s(t,e=!0){for(var n=0;n<t.length;n++)Po(t[n],e)}var qs;function Vs(t,e,n,i,r,o=null){var s=t,a=new Map;if(!!(e&on)){var l=t;s=di?fi(uo(l)):l.appendChild(co())}di&&pi();var c,u=null,d=Ur((()=>{var t=n();return kn(t)?t:null==t?[]:xn(t)})),h=!0;function f(){m.fallback=u,function(t,e,n,i,r){var o,s,a,l,c,u=!!(i&sn),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&Qn))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&Qn){if(l.f^=Qn,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),Ks(t,p,l),Ks(t,l,b),Hs(l,b,n),m=[],v=[],f=(p=l).next;continue}Hs(l,null,n)}var k,w;if(l.f&$n)if(Bo(l),u)null===(k=l.nodes)||void 0===k||null===(k=k.a)||void 0===k||k.unfix(),(null!==(w=s)&&void 0!==w?w:s=new Set).delete(l);if(l!==f){if(void 0!==o&&o.has(l)){if(m.length<v.length){var x,_=v[0];p=_.prev;var T=m[0],E=m[m.length-1];for(x=0;x<m.length;x+=1)Hs(m[x],_,n);for(x=0;x<v.length;x+=1)o.delete(v[x]);Ks(t,T.prev,E.next),Ks(t,p,T),Ks(t,E,_),f=_,p=E,c-=1,m=[],v=[]}else o.delete(l),Hs(l,f,n),Ks(t,l.prev,l.next),Ks(t,l,null===p?t.effect.first:p.next),Ks(t,p,l),p=l;continue}for(m=[],v=[];null!==f&&f!==l;){var I;(null!==(I=o)&&void 0!==I?I:o=new Set).add(f),v.push(f),f=f.next}if(null===f)continue}l.f&Qn||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)$s(xn(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&$n||A.push(l);for(;null!==f;)f.f&$n||f===t.fallback||A.push(f),f=f.next;var N=A.length;if(N>0){var M=i&on&&0===d?n:null;if(u){for(c=0;c<N;c+=1){var F;null===(F=A[c].nodes)||void 0===F||null===(F=F.a)||void 0===F||F.measure()}for(c=0;c<N;c+=1){var C;null===(C=A[c].nodes)||void 0===C||null===(C=C.a)||void 0===C||C.fix()}}!function(t,e,n){for(var i,r=e.length,o=e.length,s=0;s<r;s++){let n=e[s];Do(n,(()=>{if(i){if(i.pending.delete(n),i.done.add(n),0===i.pending.size){var e=t.outrogroups;$s(xn(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;vo(c),c.append(l),t.items.clear()}$s(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&&Ni((()=>{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&Qn?(u.f^=Qn,Hs(u,null,s)):Bo(u):Do(u,(()=>{u=null})))}var p=No((()=>{var t=(c=fs(d)).length;let l=!1;di&&(gi(s)===fn!==(0===t)&&(fi(s=vi()),hi(!1),l=!0));for(var p=new Set,m=0;m<t;m+=1){di&&ui.nodeType===ai&&ui.data===pn&&(s=ui,l=!0,hi(!1));var v,g=c[m],y=i(g,m),b=h?null:a.get(y);if(b)b.v&&Zr(b.v,g),b.i&&Zr(b.i,m);else b=Gs(a,h?s:null!==(v=qs)&&void 0!==v?v:qs=co(),g,y,m,r,e,n),h||(b.e.f|=Qn),a.set(y,b);p.add(y)}0===t&&o&&!u&&(h?u=Fo((()=>o(s))):(u=Fo((()=>{var t;return o(null!==(t=qs)&&void 0!==t?t:qs=co())}))).f|=Qn),di&&t>0&&fi(vi()),h||f(),l&&hi(!0),fs(d)})),m={effect:p,items:a,outrogroups:null,fallback:u};h=!1,di&&(s=ui)}function Gs(t,e,n,i,r,o,s,a){var l=s&nn?s&an?Xr(n):Qr(n,!1,!1):null,c=s&rn?Xr(r):null;return{v:l,i:c,e:Fo((()=>(o(e,null!=l?l:n,null!=c?c:r,a),()=>{t.delete(i)})))}}function Hs(t,e,n){if(t.nodes)for(var i=t.nodes.start,r=t.nodes.end,o=!e||e.f&Qn?n:e.nodes.start;null!==i;){var s=ho(i);if(o.before(i),i===r)return;i=s}}function Ks(t,e,n){null===e?t.effect.first=n:e.next=n,null===n?t.effect.last=e:n.prev=e}function Xs(t,e){Io((()=>{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 Ys(t,e){var n,i=void 0;Mo((()=>{i!==(i=e())&&(n&&(Po(n),n=null),i&&(n=Fo((()=>{Io((()=>i(t)))}))))}))}function Qs(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=Qs(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function Js(t){return"object"==typeof t?function(){for(var t,e,n=0,i="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=Qs(t))&&(i&&(i+=" "),i+=e);return i}(t):null!=t?t:""}const Zs=[..." \t\n\r\f \v\ufeff"];function ta(t,e=!1){var n=e?" !important;":";",i="";for(var r in t){var o=t[r];null!=o&&""!==o&&(i+=" "+r+": "+o+n)}return i}function ea(t){return"-"!==t[0]||"-"!==t[1]?t.toLowerCase():t}function na(t,e,n,i,r,o){var s=t.__className;if(di||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&&!Zs.includes(i[s-1])||a!==i.length&&!Zs.includes(i[a])?s=a:i=(0===s?"":i.substring(0,s))+i.substring(a+1)}return""===i?null:i}(n,i,o);di&&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 ia(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 ra(t,e,n,i){var r=t.__style;if(di||r!==e){var o=function(t,e){if(e){var n,i,r="";if(Array.isArray(e)?(n=e[0],i=e[1]):n=e,t){t=String(t).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var o=!1,s=0,a=!1,l=[];n&&l.push(...Object.keys(n).map(ea)),i&&l.push(...Object.keys(i).map(ea));var c=0,u=-1;const e=t.length;for(var d=0;d<e;d++){var h=t[d];if(a?"/"===h&&"*"===t[d-1]&&(a=!1):o?o===h&&(o=!1):"/"===h&&"*"===t[d+1]?a=!0:'"'===h||"'"===h?o=h:"("===h?s++:")"===h&&s--,!a&&!1===o&&0===s)if(":"===h&&-1===u)u=d;else if(";"===h||d===e-1){if(-1!==u){var f=ea(t.substring(c,u).trim());l.includes(f)||(";"!==h&&d++,r+=" "+t.substring(c,d).trim()+";")}c=d+1,u=-1}}}return n&&(r+=ta(n)),i&&(r+=ta(i,!0)),""===(r=r.trim())?null:r}return null==t?null:String(t)}(e,i);di&&o===t.getAttribute("style")||(null==o?t.removeAttribute("style"):t.style.cssText=o),t.__style=e}else i&&(Array.isArray(i)?(ia(t,null==n?void 0:n[0],i[0]),ia(t,null==n?void 0:n[1],i[1],"important")):ia(t,n,i));return i}function oa(t,e,n=!1){if(t.multiple){if(null==e)return;if(!kn(e))return void console.warn("https://svelte.dev/e/select_multiple_invalid_value");for(var i of t.options)i.selected=e.includes(sa(i))}else{for(i of t.options){var r=sa(i);if(o=r,s=e,Object.is(io(o),io(s)))return void(i.selected=!0)}var o,s;n&&void 0===e||(t.selectedIndex=-1)}}function sa(t){return"__value"in t?t.__value:t.value}const aa=Symbol("class"),la=Symbol("style"),ca=Symbol("is custom element"),ua=Symbol("is html");function da(t){if(di){var e=!1,n=()=>{if(!e){if(e=!0,t.hasAttribute("value")){var n=t.value;fa(t,"value",null),t.value=n}if(t.hasAttribute("checked")){var i=t.checked;fa(t,"checked",null),t.checked=i}}};t.__on_r=n,Ni(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 ha(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function fa(t,e,n,i){var r=ma(t);di&&(r[e]=t.getAttribute(e),"src"===e||"srcset"===e||"href"===e&&"LINK"===t.nodeName)||r[e]!==(r[e]=n)&&("loading"===e&&(t[ri]=n),null==n?t.removeAttribute(e):"string"!=typeof n&&ga(t).includes(e)?t[e]=n:t.setAttribute(e,n))}function pa(t,e,n=[],i=[],r=[],o,s=!1,a=!1){Lr(r,n,i,(n=>{var i=void 0,r={},l="SELECT"===t.nodeName,c=!1;if(Mo((()=>{var u=e(...n.map(fs)),d=function(t,e,n,i,r=!1){if(di&&r&&"INPUT"===t.tagName){var o=t;("checkbox"===o.type?"defaultChecked":"defaultValue")in n||da(o)}var s=ma(t),a=s[ca],l=!s[ua];let c=di&&a;c&&hi(!1);var u,d=e||{},h="OPTION"===t.tagName;for(var f in e)f in n||(n[f]=null);n.class?n.class=Js(n.class):n.class=null,n[la]&&(null!==(u=n.style)&&void 0!==u||(n.style=null));var p=ga(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=Ms(i);if(As(i)&&(i=i.slice(0,-7),e.capture=!0),!g&&m){if(null!=o)continue;t.removeEventListener(i,d[n],e),d[n]=null}if(null!=o)if(g)t[`__${i}`]=o,ws([i]);else{let o=function(t){d[r].call(this,t)};d[n]=bs(i,t,o,e)}else g&&(t[`__${i}`]=void 0)}else if("style"===r)fa(t,r,o);else if("autofocus"===r)go(t,Boolean(o));else if(a||"__value"!==r&&("value"!==r||null==o))if("selected"===r&&h)ha(t,o);else{var y=r;l||(y=Cs(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]=vn)):"function"!=typeof o&&fa(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 ra(t,o,null==e?void 0:e[la],n[la]),d[r]=o,d[la]=n[la];else na(t,"http://www.w3.org/1999/xhtml"===t.namespaceURI,o,i,null==e?void 0:e[aa],n[aa]),d[r]=o,d[aa]=n[aa]}return c&&hi(!0),d}(t,i,u,o,s,a);c&&l&&"value"in u&&oa(t,u.value);for(let t of Object.getOwnPropertySymbols(r))u[t]||Po(r[t]);for(let e of Object.getOwnPropertySymbols(u)){var h=u[e];e.description!==yn||i&&h===i[e]||(r[e]&&Po(r[e]),r[e]=Fo((()=>Ys(t,(()=>h))))),d[e]=h}i=d})),l){var u=t;Io((()=>{oa(u,i.value,!0),function(t){var e=new MutationObserver((()=>{oa(t,t.__value)}));e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),_o((()=>{e.disconnect()}))}(u)}))}c=!0}))}function ma(t){var e;return null!==(e=t.__attributes)&&void 0!==e?e:t.__attributes={[ca]:t.nodeName.includes("-"),[ua]:t.namespaceURI===gn}}var va=new Map;function ga(t){var e,n=t.getAttribute("is")||t.nodeName,i=va.get(n);if(i)return i;va.set(n,i=[]);for(var r=t,o=Element.prototype;o!==r;){for(var s in e=En(r))e[s].set&&i.push(s);r=An(r)}return i}function ya(t,e){return t===e||(null==t?void 0:t[ni])===e}function ba(t={},e,n,i){return Io((()=>{var i,r;return So((()=>{i=r,r=[],vs((()=>{t!==n(...r)&&(e(t,...r),i&&ya(n(...i),t)&&e(null,...i))}))})),()=>{Ni((()=>{r&&ya(n(...r),t)&&e(null,...r)}))}})),t}let ka=!1;function wa(t,e,n,i){var r,o,s=!!(n&un),a=!!(n&dn),l=i,c=!0,u=()=>(c&&(c=!1,l=a?vs(i):i),l);if(s){var d,h,f=ni in t||ii in t;r=null!==(d=null===(h=Tn(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=ka;try{return ka=!1,[t(),ka]}finally{ka=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&cn))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&ln?zr:Ur)((()=>(g=!1,p())));s&&fs(y);var b=Ko;return function(t,e){if(arguments.length>0){const n=e?fs(y):s?no(t):t;return Jr(y,n),g=!0,void 0!==l&&(l=n),t}return $o&&g||b.f&qn?y.v:fs(y)}}var xa,_a,Ta,Ea;"undefined"!=typeof window&&(null!==(_a=(xa=null!==(Ea=(Ta=window).__svelte)&&void 0!==Ea?Ea:Ta.__svelte={}).v)&&void 0!==_a?_a:xa.v=new Set).add("5");function Ia(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 Sa(t,e){t.getNodesAtTime(0)[0].once("nodestart",e)}class Aa{constructor({position:t,gallery:e,config:n}){this.config=n,this.position=t,this.gallery=e,this.name=n.name;const{variantId:i,itemIndex:r,moduleIndex:o}=t;this.id=`${n.itemType}_${i}_${r}_${o}`,Ia(this)}#a=Yr(no({}));#l=Yr(null);#c=Yr(!1);#u=Yr(null);id;player;position;config;timeline;moduleEndListener;hasDuration=!1;coverAssets=[];get state(){return fs(this.#a)}set state(t){Jr(this.#a,t,!0)}get cover(){return fs(this.#l)}set cover(t){Jr(this.#l,t)}get showCover(){return fs(this.#c)}set showCover(t){Jr(this.#c,t,!0)}get Component(){return fs(this.#u)}set Component(t){Jr(this.#u,t)}emitModuleEnd(){var t;null===(t=this.moduleEndListener)||void 0===t||t.call(this)}start(t){this.player=t}setPosition(){this.gallery.state.playingModulePosition=this.position}play(){this.gallery.track("moduleview"),Sa(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 Na(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 Ma=Es('<h3 class="text-box-title svelte-wejicf"> </h3>'),Fa=Es('<span class="text-box-title svelte-wejicf"> </span>'),Ca=Es('<span class="text-box-description minimized-description svelte-wejicf"> </span>'),Oa=Es('<span class="read-more-cta svelte-wejicf" aria-hidden="true">Read more</span>'),Pa=Es('<button class="expand-description-button svelte-wejicf" aria-expanded="false" aria-controls="expanded-text-content" aria-label="Expand feature description"><!> <!></button>'),Ra=Es('<button aria-expanded="true" aria-label="Collapse feature description" data-elementid="textbox-expand" data-elementtype="textbox" data-elementname="Read less" data-interactiontype="module-ui" class="svelte-wejicf">Read less</button>'),Da=Es('<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 La={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 Ba(t,e){Ti(e,!0),Xs(t,La);let n=wa(e,"textBox",3,null),i=wa(e,"isMobile",3,!1),r=Yr(!1),o=Yr(null),s=Yr(!1),a=jr((()=>{var t;return(null===(t=n())||void 0===t?void 0:t.title)||""})),l=jr((()=>{var t;return(null===(t=n())||void 0===t?void 0:t.description)||""})),c=jr((()=>i()?16:18)),u=jr((()=>i()?12:16));function d(){fs(o)&&Jr(s,fs(o).scrollWidth>fs(o).clientWidth||fs(o).scrollHeight>fs(o).clientHeight,!0)}To((()=>{fs(o)&&d()}));var h=Is();ks("resize",ro,d);var f=po(h),p=t=>{var n=Da(),d=fo(n),h=fo(d),f=fo(h),p=t=>{var e=Ma(),n=fo(e,!0);mi(e),Ao((()=>Ps(n,fs(a)))),Ss(t,e)};js(f,(t=>{i()&&t(p)}));var m=mo(f,2),v=fo(m,!0);mi(m),mi(h);var g=mo(h,2),y=t=>{var n=Pa(),u=jr((()=>e.gallery.interaction((()=>Jr(r,!0)),{elementid:"textbox-expand",elementtype:"textbox",elementname:"Read more",interactiontype:"module-ui"})));n.__click=function(...t){var e;null===(e=fs(u))||void 0===e||e.apply(this,t)};var d=fo(n),h=t=>{var e=Fa(),n=fo(e,!0);mi(e),Ao((()=>Ps(n,fs(a)))),Ss(t,e)},f=t=>{var e=Ca(),n=fo(e,!0);mi(e),ba(e,(t=>Jr(o,t)),(()=>fs(o))),Ao((()=>Ps(n,fs(l)))),Ss(t,e)};js(d,(t=>{i()&&fs(a)?t(h):t(f,!1)}));var p=mo(d,2),m=t=>{Ss(t,Oa())};js(p,(t=>{(i()||!i()&&fs(s))&&t(m)})),mi(n),Ao((()=>ra(n,`line-height: ${fs(c)}px;`))),Ss(t,n)};js(g,(t=>{fs(r)||t(y)})),mi(d);var b=mo(d,2),k=t=>{var n=Ra(),o=jr((()=>e.gallery.interaction((()=>Jr(r,!1)))));n.__click=function(...t){var e;null===(e=fs(o))||void 0===e||e.apply(this,t)},Ao((()=>ra(n,`margin-bottom: ${!i()&&fs(r)?"8px":"0px"};\n line-height: ${fs(u)}px;`))),Ss(t,n)};js(b,(t=>{fs(r)&&t(k)})),mi(n),Ao((()=>{na(n,1,"step-description-container "+(fs(r)?"expanded":""),"svelte-wejicf"),ra(n,`padding: ${i()?"8px 16px":"16px 16px 64px 16px"};`),ra(h,`line-height: ${fs(c)}px;`),fa(h,"hidden",!fs(r)),Ps(v,fs(l))})),Ss(t,n)};js(f,(t=>{(fs(a)||fs(l))&&t(p)})),Ss(t,h),Ei()}function za(t,e){const n=jr((()=>e.state.textBox));Ba(t,{get textBox(){return fs(n)},get isMobile(){return e.isMobile},get gallery(){return e.gallery}})}ws(["click"]);var Wa=Es('<div class="toggle-option-container svelte-16pmvvn"><button data-elementtype="toggle" data-interactiontype="module-ui"> </button></div>'),ja=Es('<div class="toggle-container svelte-16pmvvn"><div></div></div> <!>',1);const Ua={hash:"svelte-16pmvvn",code:".eko-gallery-app {--toggleModule_gap: 8px;--toggleModule_padding: 10px 58px 0 0;--toggleModule_options_padding: 0;--toggleModule_options_height: auto;--toggleModule_options_width: 100%;--toggleModule_options_gap: 8px;--toggleModule_button_backgroundColor: #FFFFFF;--toggleModule_button_padding: 8px 12px;--toggleModule_button_boxShadow: 0px 2px 8px 2px rgba(0, 0, 0, 0.07);--toggleModule_button_text_fontFamily: var(--fontName);--toggleModule_button_text_fontSize: 12px;--toggleModule_button_text_fontWeight: 400;--toggleModule_button_text_fontStyle: normal;--toggleModule_button_text_lineHeight: 16px;--toggleModule_button_text_letterSpacing: -0.2px;--toggleModule_button_text_color: #000;--toggleModule_button_border_radius: 100px;--toggleModule_title_fontFamily: var(--fontName);--toggleModule_title_fontSize: 13px;--toggleModule_title_fontWeight: 400;--toggleModule_title_fontStyle: normal;--toggleModule_title_lineHeight: 120%;--toggleModule_title_letterSpacing: 0;--toggleModule_title_color: #666;--toggleModule_title_textAlignment: center;--toggleModule_note_fontFamily: var(--fontName);--toggleModule_note_fontSize: 12px;--toggleModule_note_fontWeight: 400;--toggleModule_note_fontStyle: normal;--toggleModule_note_lineHeight: 120%;--toggleModule_note_letterSpacing: 0;--toggleModule_note_color: #888;--toggleModule_note_topMargin: 4px;}.toggle-container.svelte-16pmvvn {position:absolute;top:0;padding:var(--toggleModule_padding);width:100%;display:flex;flex-direction:column;align-items:center;gap:var(--toggleModule_gap);pointer-events:auto;box-sizing:border-box;}.toggle-options.svelte-16pmvvn {width:var(--toggleModule_options_width);height:var(--toggleModule_options_height);padding:var(--toggleModule_options_padding);gap:var(--toggleModule_options_gap);display:flex;justify-content:end;margin:0;}.toggle-option-container.svelte-16pmvvn {position:relative;min-width:0;}.toggle-option-button.svelte-16pmvvn {border-radius:var(--toggleModule_button_borderRadius);font-family:var(--toggleModule_button_text_fontFamily);font-size:var(--toggleModule_button_text_fontSize);font-weight:var(--toggleModule_button_text_fontWeight);font-style:var(--toggleModule_button_text_fontStyle);line-height:var(--toggleModule_button_text_lineHeight);letter-spacing:var(--toggleModule_button_text_letterSpacing);color:var(--toggleModule_button_text_color);padding:var(--toggleModule_button_padding);border:#E4E5E8 solid 1px;background:#FBFBFB;display:flex;width:100%;height:100%;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;cursor:pointer;position:relative;transition:all 0.3s ease-in-out;animation-duration:0.5s;animation-timing-function:cubic-bezier(0.36, 0, 0, 1);animation-fill-mode:both;animation-delay:calc(var(--button-index) * 90ms);\n animation-name: svelte-16pmvvn-button-back-appear-anim;transform-origin:bottom center;border-radius:var(--toggleModule_button_border_radius);}.toggle-option-button.selected.svelte-16pmvvn {box-shadow:none;color:#FFFFFF;background:#014FD3;border-color:#014FD3;}.toggle-option-button.svelte-16pmvvn:hover:not(.selected) {background:#F3F4F6;}.toggle-option-button.svelte-16pmvvn:active:not(.selected) {background:#E4E5E8;}.toggle-option-button.svelte-16pmvvn:focus {outline-offset:4px;outline-width:2px;}\n\n@keyframes svelte-16pmvvn-button-back-appear-anim {\n from {\n transform: scale(0);\n }\n to {\n transform: scale(1);\n }\n}\n@keyframes svelte-16pmvvn-optionNoteIn {\n 0% {\n opacity: 0;\n translate: -50% -5px;\n }\n 100% {\n opacity: 1;\n translate: -50% var(--toggleModule_note_topMargin);\n }\n}"};function $a(t,e){Ti(e,!0),Xs(t,Ua);const n=jr((()=>e.state.options)),i=jr((()=>e.state.currentOptionIndex)),r=jr((()=>e.state.onOptionClicked)),o=jr((()=>e.state.textBox));var s=ja(),a=po(s),l=fo(a);Vs(l,21,(()=>fs(n)),Us,((t,n,o)=>{var s=Wa();ra(s,`--button-index: ${o};`);var a=fo(s);let l;var c=jr((()=>e.gallery.interaction((()=>fs(r)(o)))));a.__click=function(...t){var e;null===(e=fs(c))||void 0===e||e.apply(this,t)},fa(a,"data-elementid",`${o+1}`);var u=fo(a,!0);mi(a),mi(s),Ao((()=>{l=na(a,1,"toggle-option-button svelte-16pmvvn",null,l,{selected:fs(i)===o}),fa(a,"data-elementname",fs(n).label),Ps(u,fs(n).label)})),Ss(t,s)})),mi(l),mi(a);var c=mo(a,2),u=t=>{Ba(t,{get textBox(){return fs(o)},get isMobile(){return e.isMobile},get gallery(){return e.gallery}})};js(c,(t=>{fs(o)&&t(u)})),Ao((()=>{var t;return na(l,1,`toggle-options selected-${null!==(t=fs(i))&&void 0!==t?t:""}`,"svelte-16pmvvn")})),Ss(t,s),Ei()}ws(["click"]);var qa=new WeakSet;function Va(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,Sa(this.timeline,(()=>{this.showCover=!1})),null===(n=this.player)||void 0===n||n.switchTimeline(this.timeline)))}const Ga=(t,e,n)=>n>e?e:n<t?t:n;function Ha(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let Ka=()=>{},Xa=()=>{};function Ya(t){let e;return()=>(void 0===e&&(e=t()),e)}"undefined"!=typeof process&&"production"!==(null===(re=process.env)||void 0===re?void 0:re.NODE_ENV)&&(Ka=(t,e,n)=>{t||"undefined"==typeof console||console.warn(Ha(e,n))},Xa=(t,e,n)=>{if(!t)throw new Error(Ha(e,n))});const Qa=t=>t,Ja=t=>1e3*t,Za=t=>t/1e3;const tl=t=>Array.isArray(t)&&"number"==typeof t[0],el=(t,e,n=10)=>{let i="";const r=Math.max(Math.round(e/n),2);for(let e=0;e<r;e++)i+=Math.round(1e4*t(e/(r-1)))/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},nl=2e4;function il(t){let e=0;let n=t.next(e);for(;!n.done&&e<nl;)e+=50,n=t.next(e);return e>=nl?1/0:e}const rl=5;const ol={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},sl=.001;function al({duration:t=ol.duration,bounce:e=ol.bounce,velocity:n=ol.velocity,mass:i=ol.mass}){let r,o;Ka(t<=Ja(ol.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let s=1-e;s=Ga(ol.minDamping,ol.maxDamping,s),t=Ga(ol.minDuration,ol.maxDuration,Za(t)),s<1?(r=e=>{const i=e*s,r=i*t,o=i-n,a=cl(e,s),l=Math.exp(-r);return sl-o/a*l},o=e=>{const i=e*s*t,o=i*n+n,a=Math.pow(s,2)*Math.pow(e,2)*t,l=Math.exp(-i),c=cl(Math.pow(e,2),s);return(-r(e)+sl>0?-1:1)*((o-a)*l)/c}):(r=e=>Math.exp(-e*t)*((e-n)*t+1)-sl,o=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let i=n;for(let n=1;n<ll;n++)i-=t(i)/e(i);return i}(r,o,5/t);if(t=Ja(t),isNaN(a))return{stiffness:ol.stiffness,damping:ol.damping,duration:t};{const e=Math.pow(a,2)*i;return{stiffness:e,damping:2*s*Math.sqrt(i*e),duration:t}}}const ll=12;function cl(t,e){return t*Math.sqrt(1-e*e)}const ul=["duration","bounce"],dl=["stiffness","damping","mass"];function hl(t,e){return e.some((e=>void 0!==t[e]))}function fl(t=ol.visualDuration,e=ol.bounce){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:i,restDelta:r}=n;const o=n.keyframes[0],s=n.keyframes[n.keyframes.length-1],a={done:!1,value:o},{stiffness:l,damping:c,mass:u,duration:d,velocity:h,isResolvedFromDuration:f}=function(t){let e={velocity:ol.velocity,stiffness:ol.stiffness,damping:ol.damping,mass:ol.mass,isResolvedFromDuration:!1,...t};if(!hl(t,dl)&&hl(t,ul))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(1.2*n),r=i*i,o=2*Ga(.05,1,1-(t.bounce||0))*Math.sqrt(r);e={...e,mass:ol.mass,stiffness:r,damping:o}}else{const n=al(t);e={...e,...n,mass:ol.mass},e.isResolvedFromDuration=!0}return e}({...n,velocity:-Za(n.velocity||0)}),p=h||0,m=c/(2*Math.sqrt(l*u)),v=s-o,g=Za(Math.sqrt(l/u)),y=Math.abs(v)<5;let b;if(i||(i=y?ol.restSpeed.granular:ol.restSpeed.default),r||(r=y?ol.restDelta.granular:ol.restDelta.default),m<1){const t=cl(g,m);b=e=>{const n=Math.exp(-m*g*e);return s-n*((p+m*g*v)/t*Math.sin(t*e)+v*Math.cos(t*e))}}else if(1===m)b=t=>s-Math.exp(-g*t)*(v+(p+g*v)*t);else{const t=g*Math.sqrt(m*m-1);b=e=>{const n=Math.exp(-m*g*e),i=Math.min(t*e,300);return s-n*((p+m*g*v)*Math.sinh(i)+t*v*Math.cosh(i))/t}}const k={calculatedDuration:f&&d||null,next:t=>{const e=b(t);if(f)a.done=t>=d;else{let n=0===t?p:0;m<1&&(n=0===t?Ja(p):function(t,e,n){const i=Math.max(e-rl,0);return r=n-t(i),(o=e-i)?r*(1e3/o):0;var r,o}(b,t,e));const o=Math.abs(n)<=i,l=Math.abs(s-e)<=r;a.done=o&&l}return a.value=a.done?s:e,a},toString:()=>{const t=Math.min(il(k),nl),e=el((e=>k.next(t*e).value),t,30);return t+"ms "+e},toTransition:()=>{}};return k}fl.applyToOptions=t=>{const e=function(t,e=100,n){const i=n({...t,keyframes:[0,e]}),r=Math.min(il(i),nl);return{type:"keyframes",ease:t=>i.next(r*t).value/e,duration:Za(r)}}(t,100,fl);return t.ease=e.ease,t.duration=Ja(e.duration),t.type="keyframes",t};const pl=t=>null!==t;class ml{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise((t=>{this.resolve=t}))}notifyFinished(){this.resolve()}then(t,e){return this.finished.then(t,e)}}function vl(t){for(let n=1;n<t.length;n++){var e;null!==(e=t[n])&&void 0!==e||(t[n]=t[n-1])}}const gl=t=>t.startsWith("--");const yl=Ya((()=>void 0!==window.ScrollTimeline)),bl={};function kl(t,e){const n=Ya(t);return()=>{var t;return null!==(t=bl[e])&&void 0!==t?t:n()}}const wl=kl((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing"),xl=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,_l={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:xl([0,.65,.55,1]),circOut:xl([.55,0,1,.45]),backIn:xl([.31,.01,.66,-.59]),backOut:xl([.33,1.53,.69,.99])};function Tl(t,e){return t?"function"==typeof t?wl()?el(t,e):"ease-out":tl(t)?xl(t):Array.isArray(t)?t.map((t=>Tl(t,e)||_l.easeOut)):_l[t]:void 0}function El(t,e,n,{delay:i=0,duration:r=300,repeat:o=0,repeatType:s="loop",ease:a="easeOut",times:l}={},c=void 0){const u={[e]:n};l&&(u.offset=l);const d=Tl(a,r);Array.isArray(d)&&(u.easing=d);const h={delay:i,duration:r,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:o+1,direction:"reverse"===s?"alternate":"normal"};c&&(h.pseudoElement=c);return t.animate(u,h)}class Il extends ml{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:e,name:n,keyframes:i,pseudoElement:r,allowFlatten:o=!1,finalKeyframe:s,onComplete:a}=t;this.isPseudoElement=Boolean(r),this.allowFlatten=o,this.options=t,Xa("string"!=typeof t.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:t,...e}){return function(t){return"function"==typeof t&&"applyToOptions"in t}(t)&&wl()?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=El(e,n,i,l,r),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!r){const t=function(t,{repeat:e,repeatType:n="loop"},i,r=1){const o=t.filter(pl),s=r<0||e&&"loop"!==n&&e%2==1?0:o.length-1;return s&&void 0!==i?i:o[s]}(i,this.options,s,this.speed);this.updateMotionValue?this.updateMotionValue(t):function(t,e,n){gl(e)?t.style.setProperty(e,n):t.style[e]=n}(e,n,t),this.animation.cancel()}null==a||a(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,e;null===(t=(e=this.animation).finish)||void 0===t||t.call(e)}cancel(){try{this.animation.cancel()}catch(t){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;"idle"!==t&&"finished"!==t&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,e;this.isPseudoElement||(null===(t=(e=this.animation).commitStyles)||void 0===t||t.call(e))}get duration(){var t,e;const n=(null===(t=this.animation.effect)||void 0===t||null===(e=t.getComputedTiming)||void 0===e?void 0:e.call(t).duration)||0;return Za(Number(n))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Za(t)}get time(){return Za(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Ja(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){var t;return null!==(t=this.manualStartTime)&&void 0!==t?t:Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,observe:e}){var n;this.allowFlatten&&(null===(n=this.animation.effect)||void 0===n||n.updateTiming({easing:"linear"}));return this.animation.onfinish=null,t&&yl()?(this.animation.timeline=t,Qa):e(this)}}class Sl{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map((t=>t.finished)))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t){const e=this.animations.map((e=>e.attachTimeline(t)));return()=>{e.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return Al(this.animations,"duration")}get iterationDuration(){return Al(this.animations,"iterationDuration")}runAll(t){this.animations.forEach((e=>e[t]()))}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function Al(t,e){let n=0;for(let i=0;i<t.length;i++){const r=t[i][e];null!==r&&r>n&&(n=r)}return n}class Nl extends Sl{then(t,e){return this.finished.finally(t).then((()=>{}))}}const Ml=new WeakMap,Fl=(t,e="")=>`${t}:${e}`;function Cl(t){const e=Ml.get(t)||new Map;return Ml.set(t,e),e}function Ol(t,e){var n,i;return null!==(n=null!==(i=null==t?void 0:t[e])&&void 0!==i?i:null==t?void 0:t.default)&&void 0!==n?n:t}const Pl=new Set(["borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","width","maxWidth","height","maxHeight","top","right","bottom","left","inset","insetBlock","insetBlockStart","insetBlockEnd","insetInline","insetInlineStart","insetInlineEnd","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingBlock","paddingBlockStart","paddingBlockEnd","paddingInline","paddingInlineStart","paddingInlineEnd","margin","marginTop","marginRight","marginBottom","marginLeft","marginBlock","marginBlockStart","marginBlockEnd","marginInline","marginInlineStart","marginInlineEnd","fontSize","backgroundPositionX","backgroundPositionY"]);function Rl(t,e){for(let n=0;n<t.length;n++)"number"==typeof t[n]&&Pl.has(e)&&(t[n]=t[n]+"px")}function Dl(t,e){const n=window.getComputedStyle(t);return gl(e)?n.getPropertyValue(e):n[e]}function Ll(t,e,n,i){if(null==t)return[];const r=function(t){if(null==t)return[];if(t instanceof EventTarget)return[t];if("string"==typeof t){const e=document.querySelectorAll(t);return e?Array.from(e):[]}return Array.from(t).filter((t=>null!=t))}(t),o=r.length;Xa(Boolean(o),"No valid elements provided.","no-valid-elements");const s=[];for(let t=0;t<o;t++){const i=r[t],a={...n};"function"==typeof a.delay&&(a.delay=a.delay(t,o));for(const t in e){let n=e[t];Array.isArray(n)||(n=[n]);const r={...Ol(a,t)};r.duration&&(r.duration=Ja(r.duration)),r.delay&&(r.delay=Ja(r.delay));const o=Cl(i),l=Fl(t,r.pseudoElement||""),c=o.get(l);c&&c.stop(),s.push({map:o,key:l,unresolvedKeyframes:n,options:{...r,element:i,name:t,allowFlatten:!a.type&&!a.ease}})}}for(let t=0;t<s.length;t++){const{unresolvedKeyframes:e,options:n}=s[t],{element:i,name:r,pseudoElement:o}=n;o||null!==e[0]||(e[0]=Dl(i,r)),vl(e),Rl(e,r),!o&&e.length<2&&e.unshift(Dl(i,r)),n.keyframes=e}const a=[];for(let t=0;t<s.length;t++){const{map:e,key:n,options:i}=s[t],r=new Il(i);e.set(n,r),r.finished.finally((()=>e.delete(n))),a.push(r)}return a}const Bl=(()=>function(t,e,n){return new Nl(Ll(t,e,n))})();var zl=Es('<button class="svelte-16kucsb"><div class="svelte-16kucsb"> </div></button>'),Wl=Es('<div class="tryIt-container svelte-16kucsb"><!></div>');const jl={hash:"svelte-16kucsb",code:".eko-gallery-app {--tryItModule_justifyContent: center;--tryItModule_alignItems: flex-end;--tryItModule_padding: 16px 20px 48px 20px;--tryItModule_button_padding: 16px 32px;--tryItModule_button_textAlign: center;--tryItModule_button_borderRadius: 100px;--tryItModule_button_border: 0;--tryItModule_button_boxShadow: 0 4px 24px 2px rgba(0, 0, 0, 0.12);--tryItModule_button_background: #FFFFFF;--tryItModule_button_text_fontFamily: var(--fontName);--tryItModule_button_text_fontSize: 18px;--tryItModule_button_text_color: #222;--tryItModule_button_text_weight: 500;--tryItModule_button_text_lineHeight: 120%;--tryItModule_button_text_letterSpacing: -0.1px;}.tryIt-container.svelte-16kucsb {position:relative;padding:var(--tryItModule_padding);width:100%;height:100%;box-sizing:border-box;display:flex;justify-content:var(--tryItModule_justifyContent);align-items:var(--tryItModule_alignItems);}.tryIt-container.svelte-16kucsb button:where(.svelte-16kucsb) {padding:var(--tryItModule_button_padding);text-align:var(--tryItModule_button_textAlign);border-radius:var(--tryItModule_button_borderRadius);border:var(--tryItModule_button_border);background:var(--tryItModule_button_background);box-shadow:var(--tryItModule_button_boxShadow);font-family:var(--tryItModule_button_text_fontFamily);font-size:var(--tryItModule_button_text_fontSize);color:var(--tryItModule_button_text_color);font-weight:var(--tryItModule_button_text_weight);line-height:var(--tryItModule_button_text_lineHeight);letter-spacing:var(--tryItModule_button_text_letterSpacing);cursor:pointer;opacity:0;overflow:hidden;}.tryIt-container.svelte-16kucsb button:where(.svelte-16kucsb) div:where(.svelte-16kucsb) {opacity:0;}"};function Ul(t,e){Ti(e,!0),Xs(t,jl);const n=jr((()=>e.state.ctaText)),i=jr((()=>e.state.animationConfig)),r=jr((()=>e.state.showCta)),o=jr((()=>e.state.onCtaClick));let s=null,a=null,l=Yr(!1),c=!1;function u(){c&&Bl(s,{transform:"scale(1.05)"},{type:fl,mass:1.5,stiffness:400,damping:30})}function d(){c&&Bl(s,{transform:"scale(1)"},{type:fl,mass:1.5,stiffness:400,damping:30})}function h(){c&&Bl(s,{transform:"scale(0.95)"},{type:fl,mass:1,stiffness:600,damping:30})}To((()=>{const{mass:t,stiffness:e,damping:n,delay:o}=fs(i);let u;return fs(r)&&(u=setTimeout((async()=>{Jr(l,!0),u=null,Bl(s,{transform:["translateY(40px) scale(0, 0.2)","translateY(0) scale(1, 1)"],opacity:1},{type:fl,mass:t,stiffness:e,damping:n}),await Bl(a,{transform:["translateY(20px) scale(0.8)","translateY(0) scale(1)"],opacity:1},{type:fl,mass:t,stiffness:e,damping:n,delay:.15}),c=!0}),o)),()=>{u&&clearTimeout(u)}}));var f=Wl(),p=fo(f),m=t=>{var e=zl();e.__mousedown=h,e.__touchstart=h,e.__click=function(...t){var e;null===(e=fs(o))||void 0===e||e.apply(this,t)};var i=fo(e),r=fo(i,!0);mi(i),ba(i,(t=>a=t),(()=>a)),mi(e),ba(e,(t=>s=t),(()=>s)),Ao((()=>{ra(e,"pointer-events: "+(fs(l)?"auto":"none")),Ps(r,fs(n))})),ks("mouseenter",e,u),ks("mouseleave",e,d),Ss(t,e)};js(p,(t=>{fs(r)&&t(m)})),mi(f),Ss(t,f),Ei()}ws(["mousedown","touchstart","click"]);var $l=new WeakSet;function ql(){this.mainTimeline?this.player.switchTimeline(this.mainTimeline):this.emitModuleEnd(),this.state.showCta=!1}const Vl={videoModule:class extends Aa{constructor({config:t,...e}){var n;super({...e,config:t}),this.Component=za,this.hasDuration=!t.loop,Ia(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(Na(`${this.id}_intro`,e.intro,t),"end");const n=Na(this.id,e.video,t);this.timeline.placeOnTimeline(n,"end",{loop:e.loop}),e.loop||n.on("nodeend",this.emitModuleEnd)}},toggleModule:class extends Aa{constructor({config:t,...e}){super({...e,config:t}),O(this,qa),this.Component=$a,this.synced=t.sync,this.switchTo=()=>{},Ia(this),this.coverAssets=t.options.map((t=>{var e;return null!==(e=t.intro)&&void 0!==e?e:t.video})),this.cover=this.coverAssets[0],this.state={options:t.options.map((t=>({label:t.label,note:t.note}))),currentOptionIndex:0,onOptionClicked:A(qa,this,Va).bind(this),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(Na(`${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(Na(`${this.id}_option_${n}_intro`,e.intro,t),"end"),i.placeOnTimeline(Na(`${this.id}_option_${n}`,e.video,t),"end",{loop:!0}),i})),this.timeline=this.timelines[this.state.currentOptionIndex])}},tryItModule:class extends Aa{constructor({config:t,...e}){var n;super({...e,config:t}),O(this,$l),Ia(this);const{introVideo:i}=t;this.coverAssets.push(null!==(n=i.intro)&&void 0!==n?n:i.loop),this.cover=this.coverAssets[0],this.state={ctaText:t.ctaText,animationConfig:t.animationConfig,showCta:!0,onCtaClick:A($l,this,ql).bind(this)}}start(t){super.start(t),this.Component=Ul,this.timeline=t.createTimeline();const{introVideo:e,mainVideo:n}=this.config;if(e.intro&&this.timeline.placeOnTimeline(Na(`${this.id}_intro_intro`,e.intro,t)),this.timeline.placeOnTimeline(Na(`${this.id}_intro_loop`,e.loop,t),"end",{loop:!0}),n){this.mainTimeline=t.createTimeline(),n.intro&&this.mainTimeline.placeOnTimeline(Na(`${this.id}_main_intro`,n.intro,t));const e=Na(`${this.id}_main_loop`,n.loop,t);this.mainTimeline.placeOnTimeline(e,"end",{loop:!0})}}play(){this.state.showCta=!0,super.play()}}};class Gl{#d=Yr({});#h=Yr("ekonovar");#f=Yr(0);#p=Yr(0);#m=Yr(no({itemIndex:0,moduleIndex:0}));#v=jr((()=>{var t;return null===(t=fs(this.#d))||void 0===t?void 0:t[fs(this.#h)]}));#g=jr((()=>{var t;return null===(t=fs(this.#v))||void 0===t?void 0:t[fs(this.#f)]}));#y=jr((()=>{var t,e;return fs(this.#b)?null===(e=fs(this.#v))||void 0===e?void 0:e[fs(this.#m).itemIndex].modules[fs(this.#m).moduleIndex]:null===(t=fs(this.#g))||void 0===t?void 0:t.modules[fs(this.#p)]}));#k=jr((()=>{var t;return(null===(t=fs(this.#v))||void 0===t?void 0:t.flatMap((t=>t.modules)))||[]}));#w=Yr(!1);#x=Yr(!1);#b=Yr(!1);#_=jr((()=>!(fs(this.#m).itemIndex===this.activeItemIndex&&fs(this.#m).moduleIndex===this.activeModuleIndex)));set variants(t){Jr(this.#d,t)}set activeVariant(t){Jr(this.#h,t,!0)}set activeItemIndex(t){Jr(this.#f,t,!0)}set activeModuleIndex(t){Jr(this.#p,t,!0)}set playingModulePosition(t){Jr(this.#m,t,!0)}set playerLoaded(t){Jr(this.#w,t,!0)}set paused(t){Jr(this.#x,t,!0)}set startedPlaying(t){Jr(this.#b,t,!0)}get variants(){return fs(this.#d)}get activeVariant(){return fs(this.#h)}get activeItemIndex(){return fs(this.#f)}get activeModuleIndex(){return fs(this.#p)}get playingModulePosition(){return fs(this.#m)}get currentItemsList(){return fs(this.#v)}get currentItem(){return fs(this.#g)}get currentModule(){return fs(this.#y)}get playerLoaded(){return fs(this.#w)}get paused(){return fs(this.#x)}get startedPlaying(){return fs(this.#b)}get seeking(){return fs(this.#_)}get currentModulesList(){return fs(this.#k)}}const Hl={assetsDeliveryBase:"https://{{env}}assets.eko.com"};const Kl=2,Xl=5,Yl=["activeItemIndex","activeModuleIndex","paused","startedPlaying"],Ql=["version","selectItem","selectItemAndStep","next","prev","subscribe"];var Jl=new WeakMap,Zl=new WeakMap,tc=new WeakMap,ec=new WeakMap,nc=new WeakMap,ic=new WeakMap,rc=new WeakSet;class oc{constructor(t){var e,n,i,r,o;O(this,rc),F(this,Jl,void 0),F(this,Zl,void 0),F(this,tc,void 0),F(this,ec,void 0),F(this,nc,void 0),F(this,ic,void 0),P(this,"public",void 0),P(this,"version","0.0.13"),Ia(this),C(Jl,this,(null===(e=crypto)||void 0===e||null===(n=e.randomUUID)||void 0===n?void 0:n.call(e))||`eko-gallery-${Date.now()}`),C(ec,this,t),C(ic,this,(null==t?void 0:t.onEvent)||(()=>{})),C(Zl,this,new Gl(null==t||null===(i=t.options)||void 0===i?void 0:i.galleryEnv)),C(nc,this,((t="")=>("production"===t&&(t=""),Object.fromEntries(Object.entries(Hl).map((([e,n])=>[e,n.replaceAll("{{env}}",t)])))))(null==t||null===(r=t.options)||void 0===r?void 0:r.galleryEnv)),C(tc,this,[]);const s=null==t||null===(o=t.instance)||void 0===o||null===(o=o.data)||void 0===o||null===(o=o.blocks)||void 0===o||null===(o=o.blocksArr)||void 0===o||null===(o=o.find((t=>"GalleryBlock"===t.blockType)))||void 0===o?void 0:o.config;var a;s?(A(rc,this,sc).call(this,s.items),A(rc,this,ac).call(this,s.items),function(t,e){function n(e){window.EkoAnalytics("registerContextPacker",{tag:t,...e})}function i(e){return function(...n){return n.pop()!==t?null:e(...n)}}"undefined"!=typeof window&&window.EkoAnalytics&&(n({schema:"iglu:com.helloeko/gallery-app/jsonschema/1-0-0",match:/.*/,getData:i((()=>{var t,n,i,r,o;const s=null===(t=e.currentItem)||void 0===t?void 0:t.modules[e.activeModuleIndex];return{itemid:(null===(n=e.currentItem)||void 0===n?void 0:n.id)||"",itemindex:e.activeItemIndex,totalitems:(null===(i=e.currentItemsList)||void 0===i?void 0:i.length)||0,itemname:(null===(r=e.currentItem)||void 0===r?void 0:r.name)||"",moduleid:(null==s?void 0:s.id)||"",modulename:(null==s?void 0:s.name)||"",moduletype:(null==s?void 0:s.config.itemType)||"",moduleindex:e.activeModuleIndex,totalmodules:(null===(o=e.currentItem)||void 0===o?void 0:o.modules.length)||0,version:"0.0.13"}}))}),n({schema:"iglu:com.helloeko/implementation_interactions/jsonschema/1-0-6",match:"interaction",getData:i((t=>t))}))}(M(Jl,this),M(Zl,this))):console.warn("[eko-gallery-app] Gallery initiated without an instance, results will be empty"),this.public=(a=this,Ql.reduce(((t,e)=>{if(!(e in a))throw new Error(`[eko-gallery-app] Public API member "${e}" does not exist on GalleryLogic`);const n=a[e];return t[e]="function"==typeof n?n.bind(a):n,t}),{}))}dispose(){var t,e;"undefined"!=typeof window&&(null===(t=(e=window).EkoAnalytics)||void 0===t||t.call(e,"reset",M(Jl,this)))}start(t){M(Zl,this).playerLoaded=!0,M(tc,this).forEach((e=>{e.start(t)})),C(tc,this,null),A(rc,this,lc).call(this,t),M(Zl,this).currentModule.play()}selectItem(t){const e=M(Zl,this);t!==e.activeItemIndex&&(e.activeItemIndex=t,e.activeModuleIndex=0)}selectItemAndStep(t,e){const n=M(Zl,this);t===n.activeItemIndex&&e===n.activeModuleIndex||(n.activeItemIndex=t,n.activeModuleIndex=e)}next(){A(rc,this,uc).call(this)}prev(){const t=M(Zl,this);if(t.activeModuleIndex=t.activeModuleIndex-1,!t.currentItem.modules[t.activeModuleIndex])if(t.currentItemsList[t.activeItemIndex-1]){t.activeItemIndex=t.activeItemIndex-1;const e=t.currentItemsList[t.activeItemIndex];t.activeModuleIndex=e.modules.length-1}else t.activeModuleIndex=t.activeModuleIndex+1}subscribe(t){const e=M(Zl,this);return function(t){Zi.ensure();const e=wo(Ln|Xn,t,!0);return()=>{Po(e)}}((()=>{To((()=>{const n=Yl.reduce(((t,n)=>(t[n]=e[n],t)),{});t(n)}))}))}getCoverUrl(t,e){var n,i,r,o;const s=(null==t||null===(n=t.entity)||void 0===n?void 0:n.entityId)||(null==t?void 0:t.assetId),a=null!==(i=null==t||null===(r=t.entity)||void 0===r?void 0:r.entityRevision)&&void 0!==i?i:null==t?void 0:t.assetRevision;if(!s)throw new Error(`[getCoverUrl] No assetId found in assetConfig: ${JSON.stringify(t||{},null,2)}`);if(!a&&0!==a)throw new Error(`[getCoverUrl] No assetRevision found for asset ${s}.`);let l;return null!==(o=M(ec,this))&&void 0!==o&&null!==(o=o.coverAssetsMap)&&void 0!==o&&o[s]?(l=new URL(M(ec,this).coverAssetsMap[s]),/^[a-z0-9]*assets.eko.com$/.test(l.host)&&e&&(l.pathname=l.pathname.replace(".png",".webp"))):(l=new URL(`${M(nc,this).assetsDeliveryBase}/image/${s}/${a}?startOffset=0`),l.pathname+=e?".webp":".png"),e&&l.searchParams.set("width",e),l.href}track(t,...e){var n,i;"undefined"!=typeof window&&(null===(n=(i=window).EkoAnalytics)||void 0===n||n.call(i,"track",t,...e,M(Jl,this)))}interaction(t,e){const n=M(Jl,this);return i=>{if("undefined"!=typeof window){var r,o,s,a;const t=null==i||null===(r=i.target)||void 0===r?void 0:r.dataset;let l;null!=i&&null!==(o=i.detail)&&void 0!==o&&o.direction&&("left"===i.detail.direction?l="swipe_next":"right"===i.detail.direction&&(l="swipe_prev"));const c={elementid:(null==t?void 0:t.elementid)||(null==e?void 0:e.elementid)||"",elementtype:(null==t?void 0:t.elementtype)||(null==e?void 0:e.elementtype)||"",elementname:(null==t?void 0:t.elementname)||(null==e?void 0:e.elementname)||"",interactiontype:l||(null==t?void 0:t.interactiontype)||(null==e?void 0:e.interactiontype)||""};null===(s=(a=window).EkoAnalytics)||void 0===s||s.call(a,"track","interaction",c,n),M(ic,this).call(this,"interaction",c)}t(i)}}get uuid(){return M(Jl,this)}get state(){return M(Zl,this)}get urls(){return M(nc,this)}}function sc(t){const e={};for(let n of t)for(let t of Object.keys(n.variants||{}))e[t]=[];e.ekonovar=[],M(Zl,this).variants=e}function ac(t){const e=(t=[],e)=>{const n=[];for(let[i,r]of t.entries()){if(!Vl[r.itemType])throw new Error(`Unknown module type ${r.itemType}`);const t=new Vl[r.itemType]({position:{...e,moduleIndex:i},config:r,gallery:this});t.moduleEndListener=A(rc,this,cc).bind(this),n.push(t)}return n};for(const[i,r]of t.entries())if("galleryItemV2"===r.itemType){const{modules:t,...o}=r;for(const[s,a]of Object.entries(M(Zl,this).variants)){var n;if(null===(n=r.variants)||void 0===n?void 0:n[s])console.log("NO IMPLEMENTED");else{const n={...o};n.modules=e(t,{variantId:s,itemIndex:i}),C(tc,this,[...M(tc,this),...n.modules]),a.push(n)}}}}function lc(t){for(const[,e]of Object.entries(M(Zl,this).variants))for(const[n,i]of e.entries()){const r=i.modules,o=e.filter((t=>t!==i)).map((t=>t.modules[0]));for(const[i,s]of r.entries()){let a=r[i+1];a||(a=e[(n+1)%e.length].modules[0]);const l=a.timeline.getNodesAtTime(0)[0],c=o.filter((t=>t!==a)).map((t=>t.timeline.getNodesAtTime(0)[0])),u=[{nodeId:l.id,weight:Kl},...c.map((t=>({nodeId:t.id,weight:Xl})))];for(const e of s.timeline.placements){t.getNode(e.nodeId).setChildren(u)}}}}function cc(){const t=M(Zl,this),e=t.currentItem.modules;e.length>1&&t.activeModuleIndex===e.length-1?t.activeModuleIndex=0:A(rc,this,uc).call(this)}function uc(){const t=M(Zl,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 dc=Es('<button><span class="svelte-er27y2"> </span></button>'),hc=Es('<div class="nav-buttons-container svelte-er27y2"><div class="nav-buttons svelte-er27y2"></div></div>');const fc={hash:"svelte-er27y2",code:".eko-gallery-app {--nav_gap: 10px;--nav_padding: 12px 16px;--nav_bgColor: #FFFFFF;--nav_justifyContent: center;--nav_button_width: fit-content;--nav_button_bgColor: #FFFFFF;--nav_button_borderRadius: 100px;--nav_button_paddingTop: 8px;--nav_button_paddingBottom: var(--nav_button_paddingTop);--nav_button_paddingLeft: 12px;--nav_button_paddingRight: var(--nav_button_paddingLeft);--nav_button_boxShadow: 0 0 0 1px #E7E7E7;--nav_button_gap: 2px;--nav_button_selected_boxShadow: 0 0 0 1px #000000;--nav_button_selected_bgColor: var(--nav_button_bgColor);--nav_button_text_color: #000000;--nav_button_text_fontSize: 14px;--nav_button_text_fontWeight: 500;--nav_button_text_fontFamily: var(--fontName);--nav_button_text_lineHeight: 120%;--nav_button_text_letterSpacing: 0px;--nav_button_text_align: center;--nav_button_selected_text_color: var(--nav_button_text_color);--nav_button_selected_text_fontWeight: var(--nav_button_text_fontWeight);--nav_button_image_borderRadius: calc(var(--nav_button_borderRadius) - var(--nav_button_paddingTop));--nav_arrow_color: var(--secondaryColor);--nav_arrow_bgColor: var(--primaryColor);--nav_arrow_padding: 9px;--nav_arrow_size: 28px;--nav_arrow_boxShadow: 0 0 8px 0 rgba(0, 0, 0, 0.3);}.nav-buttons-container.svelte-er27y2 {width:100%;background-color:var(--nav_bgColor);height:var(--buttonsContainerHeight);display:flex;box-sizing:border-box;text-align:center;justify-content:var(--nav_justifyContent);align-items:center;position:relative;flex-shrink:0;}.nav-buttons-container.svelte-er27y2 :where(.svelte-er27y2) {touch-action:auto;}.nav-buttons.svelte-er27y2 {display:flex;margin:0;gap:var(--nav_gap);height:100%;align-items:center;padding:var(--nav_padding);box-sizing:border-box;overflow-x:auto;scrollbar-width:none;max-width:100%;width:fit-content;overflow-y:hidden;overscroll-behavior-y:none;}.nav-button.svelte-er27y2 {display:flex;outline:none;flex-shrink:0;height:100%;width:var(--nav_button_width);border:none;cursor:pointer;align-items:center;gap:var(--nav_button_gap);background-color:var(--nav_button_bgColor);border-radius:var(--nav_button_borderRadius);\n /* eslint-disable-next-line max-len */padding:var(--nav_button_paddingTop) var(--nav_button_paddingRight) var(--nav_button_paddingBottom) var(--nav_button_paddingLeft);box-shadow:var(--nav_button_boxShadow);}.nav-button.svelte-er27y2 span:where(.svelte-er27y2) {flex:1 0 0;transition:color 0.2s ease-in-out;color:var(--nav_button_text_color);font-weight:var(--nav_button_text_fontWeight);font-size:var(--nav_button_text_fontSize);font-family:var(--nav_button_text_fontFamily);line-height:var(--nav_button_text_lineHeight);letter-spacing:var(--nav_button_text_letterSpacing);text-align:var(--nav_button_text_align);}.nav-button.selected.svelte-er27y2 {background-color:var(--nav_button_selected_bgColor);box-shadow:var(--nav_button_selected_boxShadow);}.nav-button.selected.svelte-er27y2 span:where(.svelte-er27y2) {color:var(--nav_button_selected_text_color);font-weight:var(--nav_button_selected_text_fontWeight);}"};ws(["click"]);const pc="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 mc=Es('<button><img class="svelte-1al44kl"/></button>');const vc={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 gc(t,e){Xs(t,vc);const n=wa(e,"hidden",3,!1);var i=mc();let r;i.__click=function(...t){var n;null===(n=e.onClick)||void 0===n||n.apply(this,t)};var o=fo(i);mi(i),Ao((()=>{var t;r=na(i,1,`nav-button ${null!==(t=e.type)&&void 0!==t?t:""}`,"svelte-1al44kl",r,{hidden:n()}),fa(i,"aria-label",e.type),fa(o,"src",pc),fa(o,"alt",e.type)})),Ss(t,i)}ws(["click"]);var yc=Es('<button data-elementtype="step-indicator" data-interactiontype="navigation"><span class="svelte-1mxltt0"> </span></button>'),bc=Es('<div class="steps-indicator-container svelte-1mxltt0"><button aria-label="Scroll to previous steps"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="svelte-1mxltt0"><path d="M12.8333 16.6668C12.68 16.6668 12.5266 16.5935 12.4266 16.4601L9.42663 12.2935C9.36482 12.2081 9.33154 12.1055 9.33154 12.0001C9.33154 11.8948 9.36482 11.7921 9.42663 11.7068L12.4266 7.54012C12.4651 7.48671 12.5138 7.44142 12.5698 7.40682C12.6259 7.37222 12.6882 7.349 12.7532 7.33848C12.8182 7.32795 12.8846 7.33033 12.9487 7.34549C13.0128 7.36064 13.0732 7.38826 13.1266 7.42678C13.18 7.46531 13.2253 7.51397 13.2599 7.56999C13.2945 7.62602 13.3177 7.68831 13.3283 7.75331C13.3388 7.81831 13.3364 7.88475 13.3213 7.94883C13.3061 8.01291 13.2785 8.07338 13.24 8.12678L10.4466 12.0001L13.2333 15.8735C13.2864 15.9479 13.3181 16.0355 13.3251 16.1267C13.332 16.2179 13.314 16.3092 13.2728 16.3909C13.2316 16.4725 13.1689 16.5414 13.0915 16.59C13.014 16.6386 12.9247 16.6652 12.8333 16.6668Z" fill="#030303" class="svelte-1mxltt0"></path></svg></button> <div role="group" aria-roledescription="Sequence navigation buttons"></div> <button aria-label="Scroll to next steps"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="svelte-1mxltt0"><path d="M11.1668 16.6666C11.0668 16.6666 10.9601 16.6333 10.8734 16.5733C10.8199 16.5348 10.7746 16.4862 10.7399 16.4302C10.7053 16.3741 10.682 16.3118 10.6715 16.2468C10.6609 16.1818 10.6634 16.1153 10.6786 16.0512C10.6938 15.9871 10.7215 15.9266 10.7601 15.8733L13.5534 11.9999L10.7601 8.12661C10.6001 7.89994 10.6468 7.59328 10.8734 7.42661C11.1001 7.26661 11.4068 7.31994 11.5734 7.53994L14.5734 11.7066C14.7001 11.8799 14.7001 12.1133 14.5734 12.2933L11.5734 16.4599C11.4734 16.5933 11.3201 16.6666 11.1668 16.6666Z" fill="#030303" class="svelte-1mxltt0"></path></svg></button></div>');const kc={hash:"svelte-1mxltt0",code:'.steps-indicator-container.svelte-1mxltt0 {width:calc(100% - 16px);position:absolute;bottom:12px;left:8px;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 4px;margin:0 16px;display:flex;gap:8px;align-items:center;overflow-x:auto;pointer-events:all;scrollbar-width:none;}.steps-indicator.fade-right.svelte-1mxltt0 {mask-image:linear-gradient(to right, black calc(100% - 20px), transparent);}.steps-indicator.fade-left.svelte-1mxltt0 {mask-image:linear-gradient(to left, black calc(100% - 20px), transparent);}.steps-indicator.fade-left.fade-right.svelte-1mxltt0 {mask-image:linear-gradient(to right, transparent, black 20px, black calc(100% - 20px), transparent);}.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 {width:34px;height:34px;position:absolute;z-index:10;bottom:4px;border:1px solid #C4C8CF;border-radius:50%;background-color:#FFFFFF;box-shadow:0 2px 3px 0 rgba(0, 0, 0, 0.05);box-sizing:border-box;display:flex;align-items:center;justify-content:center;pointer-events:none;cursor:pointer;opacity:0;}.step-arrow.svelte-1mxltt0:hover {background:#F6F6F7;}.step-arrow.svelte-1mxltt0:active {background:#E4E5E8;}.step-arrow-prev.svelte-1mxltt0 {left:3px;transform:translateX(-100%);\n animation: svelte-1mxltt0-arrow-left-disappear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}.step-arrow-prev.visible.svelte-1mxltt0 {pointer-events:auto;\n animation: svelte-1mxltt0-arrow-left-appear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}.step-arrow-next.svelte-1mxltt0 {right:3px;transform:translateX(100%);\n animation: svelte-1mxltt0-arrow-right-disappear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}.step-arrow-next.visible.svelte-1mxltt0 {pointer-events:auto;\n animation: svelte-1mxltt0-arrow-right-appear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}\n\n@keyframes svelte-1mxltt0-gallery-steps-appear-anim {\n from {\n opacity: 0;\n transform: translate(0, 10px);\n }\n to {\n opacity: 1;\n transform: translate(0, 0);\n }\n}\n@keyframes svelte-1mxltt0-gallery-steps-disappear-anim {\n from {\n opacity: 1;\n transform: translate(0, 0);\n }\n to {\n opacity: 0;\n transform: translate(0, 10px);\n }\n}\n@keyframes svelte-1mxltt0-arrow-left-appear {\n from {\n opacity: 0;\n transform: translateX(-100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n@keyframes svelte-1mxltt0-arrow-left-disappear {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(-100%);\n }\n}\n@keyframes svelte-1mxltt0-arrow-right-appear {\n from {\n opacity: 0;\n transform: translateX(100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n@keyframes svelte-1mxltt0-arrow-right-disappear {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(100%);\n }\n}\n@keyframes svelte-1mxltt0-stepDurationAnimation {\n 0% {\n transform: translateX(0);\n }\n 100% {\n transform: translateX(100%);\n }\n}'};function wc(t,e){Ti(e,!0),Xs(t,kc);const n=16,i=32;let r=wa(e,"gallery",7),o=Yr(null),s=Yr(null),a=Yr(!1),l=Yr(!1);const c=jr((()=>{let t=[];return t=r().state.currentItem.modules.map(((t,e)=>({index:e,type:e===r().state.activeModuleIndex?"active":"",name:t.name}))),t}));function u(){fs(o)&&(Jr(a,fs(o).scrollLeft>0),Jr(l,fs(o).scrollLeft+fs(o).clientWidth<fs(o).scrollWidth-0))}function d(t){fs(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(fs(o).querySelectorAll(".step-button")).find((t=>{const e=t.getBoundingClientRect(),n=fs(o).getBoundingClientRect();return e.left>n.left+i}));if(t){const e=t.previousElementSibling;e&&h(fs(o),e)}}function p(){const t=Array.from(fs(o).querySelectorAll(".step-button")).reverse().find((t=>{const e=t.getBoundingClientRect(),n=fs(o).getBoundingClientRect();return e.right<n.right-i}));if(t){const e=t.nextElementSibling;e&&h(fs(o),e)}}To((()=>{if(fs(o)){u();const t=fs(o).querySelector(".step-button.active");t&&Jr(s,t,!0);const e=new MutationObserver((()=>{const t=fs(o).querySelector(".step-button.active");t&&Jr(s,t,!0)}));e.observe(fs(o),{attributes:!0,attributeFilter:["class"],subtree:!0});const n=new ResizeObserver((()=>{u()}));return n.observe(fs(o)),()=>{e.disconnect(),n.disconnect()}}})),To((()=>{fs(c),fs(o)&&hs().then(u)})),To((()=>{fs(s)&&fs(o)&&h(fs(o),fs(s))}));var m=Is();ks("resize",ro,u),function(t,e,n){di&&pi();var i=new Ws(t);No((()=>{var t=e();i.ensure(t,n)}))}(po(m),(()=>r().state.activeItemIndex),(t=>{var e=bc(),n=fo(e);let i;n.__click=f;var s=mo(n,2);let d;Vs(s,21,(()=>fs(c)),Us,((t,e)=>{var n=yc();let i;var s=jr((()=>r().interaction((t=>{return n=t.currentTarget,i=fs(e).index,r().state.activeModuleIndex=i,void h(fs(o),n);var n,i}))));n.__click=function(...t){var e;null===(e=fs(s))||void 0===e||e.apply(this,t)};var a=fo(n),l=fo(a,!0);mi(a),mi(n),Ao((()=>{i=na(n,1,"step-button svelte-1mxltt0",null,i,{active:"active"===fs(e).type}),fa(n,"aria-label",`Go to step $${fs(e).index+1}`),fa(n,"data-elementid",`${fs(e).index+1}`),fa(n,"data-elementname",fs(e).name),Ps(l,fs(e).name)})),Ss(t,n)})),mi(s),ba(s,(t=>Jr(o,t)),(()=>fs(o)));var m=mo(s,2);let v;m.__click=p,mi(e),Ao((()=>{var t;i=na(n,1,"step-arrow step-arrow-prev svelte-1mxltt0",null,i,{visible:fs(a)}),d=na(s,1,"steps-indicator svelte-1mxltt0",null,d,{"with-duration":r().state.currentModule.hasDuration,paused:r().state.paused,"fade-left":fs(a),"fade-right":fs(l)}),ra(s,`--stepDuration: ${null!==(t=r().state.currentModule.duration)&&void 0!==t?t:""}s`),v=na(m,1,"step-arrow step-arrow-next svelte-1mxltt0",null,v,{visible:fs(l)})})),ks("scroll",s,u),Ss(t,e)})),Ss(t,m),Ei()}ws(["click"]);const xc="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='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",_c="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 Tc=Es('<img alt="Play" class="svelte-a3r6re"/>'),Ec=Es('<img alt="Pause" class="svelte-a3r6re"/>'),Ic=Es('<button class="pause-button svelte-a3r6re"><!></button>');const Sc={hash:"svelte-a3r6re",code:".pause-button.svelte-a3r6re {position:absolute;top:10px;right:10px;background:#FFFFFF;border-radius:100%;border:1px #C4C8CF solid;padding:0;width:32px;height:32px;display:flex;justify-content:center;align-items:center;pointer-events:auto;transition:background 0.2s ease-in-out;cursor:pointer;outline-color:#3191fc;}.pause-button.svelte-a3r6re:hover {background:#F6F6F7;}.pause-button.svelte-a3r6re:active {background:#E4E5E8;}.pause-button.svelte-a3r6re:focus {outline-offset:8px;outline-width:2px;}.pause-button.svelte-a3r6re img:where(.svelte-a3r6re) {width:16px;height:16px;pointer-events:none;}"};ws(["click"]);const Ac=300,Nc=60,Mc="none";function Fc(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function Cc(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 Oc(t,e,n,i,r){const o=Cc(t,n,i);return t.dispatchEvent(new CustomEvent(`${e}${r}`,{detail:o})),o}function Pc(){let t=[],e=()=>{},n=[];return{setPointerControls:(i,r,o,s,a,l=Mc,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=Oc(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=Oc(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=Fc(r,"pointermove",(e=>{t=t.map((t=>e.pointerId===t.pointerId?e:t));const s=Oc(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=Fc(r,"lostpointercapture",(t=>{c(t)})),h=Fc(r,"pointerup",(t=>{c(t)})),f=Fc(r,"pointerleave",(t=>{c(t)}))};e=Fc(r,"pointerdown",l)}return{destroy:()=>{t.length||(e(),n.forEach((t=>{var e;null===(e=t.onDestroy)||void 0===e||e.call(t)})))}}}}}const Rc="@attach";function Dc(){return Symbol(Rc)}const Lc="swipe";function Bc(t,e,n,i=!1){const{setPointerControls:r}=Pc(),o=i?Lc:Dc();return{...n,[`on${Lc}`]:t,[o]:t=>{const{onDown:n,onUp:i,parameters:o}=function(t,e){const n={timeframe:Ac,minSwipeDistance:Nc,touchAction:Mc,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(Lc,{detail:{direction:u,target:s,pointerType:a.pointerType}}))}}return{onDown:a,onUp:l,parameters:n}}(t,null==e?void 0:e());return r(Lc,t,null,n,i,o.touchAction,o.plugins).destroy}}}const zc="tap";function Wc(t,e,n,i=!1){const{setPointerControls:r}=Pc(),o=i?zc:Dc();return{...n,[`on${zc}`]:t,[o]:t=>{const{onDown:n,onUp:i,parameters:o}=function(t,e){const n={timeframe:Ac,composed:!1,touchAction:"auto",...e};let i,r,o;function s(e,s){if(Math.abs(s.clientX-r)<4&&Math.abs(s.clientY-o)<4&&Date.now()-i<n.timeframe){const e=t.getBoundingClientRect(),n=Math.round(s.clientX-e.left),i=Math.round(s.clientY-e.top);t.dispatchEvent(new CustomEvent(zc,{detail:{x:n,y:i,target:s.target,pointerType:s.pointerType}}))}}function a(t,e){r=e.clientX,o=e.clientY,i=Date.now()}return{onDown:a,onUp:s,parameters:n}}(t,null==e?void 0:e());return r(zc,t,null,n,i,o.touchAction,o.plugins).destroy}}}const jc=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 Uc=Es("<div></div>"),$c=Es("<div></div>");const qc={hash:"svelte-1fv6njc",code:".swiper.svelte-1fv6njc {position:absolute;top:0;left:0;pointer-events:auto;width:100%;height:100%;}"};var Vc=Es("<img/>"),Gc=Es('<div class="ui-container svelte-1rvgxfc"><!></div>'),Hc=Es('<div class="cover-container svelte-1rvgxfc"><!> <!> <!></div>'),Kc=Es('<div class="covers-container svelte-1rvgxfc" style="scroll-behavior: auto;"></div>');const Xc={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 Yc(t,e){Ti(e,!0),Xs(t,Xc);const n=[375,768,1024,1400,1920];let i,r=wa(e,"scrollOffset",15),o=wa(e,"isMobile",3,!1),s=wa(e,"gallery",7),a=jr((()=>s().state.playingModulePosition)),l=null,c=null,u=jr((()=>s().state.startedPlaying)),d=jr((()=>s().state.currentModulesList)),h=jr((()=>fs(d).findIndex((t=>p(s().state.playingModulePosition,t.position))))),f=!1;function p(t,e){return t.itemIndex===e.itemIndex&&t.moduleIndex===e.moduleIndex}function m(t){const e=t.scrollLeft,n=t.scrollWidth-t.clientWidth;return 0===e?0:e>n?100:e/n*100}function v(t){var e;o()&&t.preventDefault();const{target:n}=t,u=m(n),f=(null===(e=fs(d))||void 0===e?void 0:e.length)||1,v=100/(f-1||1),g=Math.round(u/v);let y=Math.min(g,f-1);const b=fs(d)[y],k={itemIndex:s().state.activeItemIndex,moduleIndex:s().state.activeModuleIndex};if(!l){const t=i.children[fs(h)],e=i.getBoundingClientRect(),n=t.getBoundingClientRect();r(n.x-e.x)}c&&clearTimeout(c),c=setTimeout((()=>{const t=m(n);Math.abs(t-g*v)<.25&&async function(){s().state.seeking&&(s().state.playerLoaded?s().state.currentItemsList[s().state.activeItemIndex].modules[s().state.activeModuleIndex].play():s().state.playingModulePosition=fs(a),r(0))}()}),l?0:150),null!==l||p(b.position,k)?null!==l&&p(b.position,l)&&(l=null):(s().state.activeItemIndex=b.position.itemIndex,s().state.activeModuleIndex=b.position.moduleIndex),Jr(a,b.position)}function g(){f||(s().track("coverdisplay"),f=!0)}To((()=>{const{activeItemIndex:t,activeModuleIndex:e}=s().state;t===fs(a).itemIndex&&e===fs(a).moduleIndex||vs((()=>{var n,r;const o=fs(d).findIndex((n=>{const{itemIndex:i,moduleIndex:r}=n.position;return t===i&&e===r}));l=(null===(n=fs(d)[o])||void 0===n?void 0:n.position)||null;const s=null===(r=i)||void 0===r||null===(r=r.children)||void 0===r?void 0:r[o];if(!i||!s)return;const a=i.getBoundingClientRect(),c=s.getBoundingClientRect();let u=i.scrollLeft+(c.left-a.left);const h=Math.max(0,i.scrollWidth-i.clientWidth);u=Math.max(0,Math.min(h,u)),i.scrollTo({left:u,behavior:"auto"})}))})),To((()=>{fs(u)&&vs((()=>{s().track("projectstartedplaying")}))}));var y=Is(),b=po(y),k=t=>{var r=Kc();Vs(r,23,(()=>fs(d)),(t=>t.id),((t,i,r)=>{var a=Hc(),l=fo(a),c=t=>{var e=Vc();let o;Ao((t=>{o=na(e,1,"cover-image svelte-1rvgxfc",null,o,{hidden:fs(u)&&fs(r)===fs(h),"force-show":fs(i).showCover}),fa(e,"src",t),fa(e,"alt",fs(i).name),fa(e,"fetchpriority",0===fs(r)?"high":"auto")}),[()=>s().getCoverUrl(fs(i).cover,n[n.length-1])]),ks("load",e,(function(...t){var e;null===(e=0===fs(r)?g:()=>{})||void 0===e||e.apply(this,t)})),function(t){if(!di)return;t.removeAttribute("onload"),t.removeAttribute("onerror");const e=t.__e;void 0!==e&&(t.__e=void 0,queueMicrotask((()=>{t.isConnected&&t.dispatchEvent(e)})))}(e),Ss(t,e)};js(l,(t=>{t(c)}));var d=mo(l,2);!function(t,e){Ti(e,!0),Xs(t,qc);const n={color:"#e3e3e3",fadeTime:300,lineWidth:8},i=Bc(e.gallery.interaction((t=>{const{direction:n}=t.detail;var i;if("left"===n)null===(i=e.gallery)||void 0===i||i.next(),e.onEvent("swipe",[-1,0]);else if("right"===n){var r;null===(r=e.gallery)||void 0===r||r.prev(),e.onEvent("swipe",[1,0])}}),{elementid:"swiper"}),(()=>({touchAction:"pan-y",plugins:e.debug?[jc(n)]:[]}))),r=Wc((function(t){const{x:n,y:i}=t.detail;e.onEvent("click",{x:n,y:i})}),(()=>({touchAction:"pan-y"})));var o=Is(),s=po(o),a=t=>{var e=Uc();pa(e,(()=>({...i,...r,class:"swiper"})),void 0,void 0,void 0,"svelte-1fv6njc"),Ss(t,e)},l=t=>{var e=$c();pa(e,(()=>({...r,class:"swiper"})),void 0,void 0,void 0,"svelte-1fv6njc"),Ss(t,e)};js(s,(t=>{e.isMobile?t(a):t(l,!1)})),Ss(t,o),Ei()}(d,{get gallery(){return s()},get debug(){return e.debug},get isMobile(){return o()},get onEvent(){return e.onEvent}});var f=mo(d,2),p=t=>{var e=Gc();!function(t,e,n){di&&pi();var i=new Ws(t);No((()=>{var t,r=null!==(t=e())&&void 0!==t?t:null;i.ensure(r,r&&(t=>n(t,r)))}),Gn)}(fo(e),(()=>fs(i).Component),((t,e)=>{e(t,{get state(){return fs(i).state},get gallery(){return s()},get isMobile(){return o()}})})),mi(e),Ss(t,e)};js(f,(t=>{var e;null!==(e=fs(i))&&void 0!==e&&e.Component&&t(p)})),mi(a),Ss(t,a)})),mi(r),ba(r,(t=>i=t),(()=>i)),ks("scroll",r,v),Ss(t,r)};js(b,(t=>{fs(d)&&t(k)})),Ss(t,y),Ei()}const Qc="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};let Jc;function Zc(){const t=Qc&&Qc.navigator&&(Qc.navigator.userAgent||Qc.navigator.platform||Qc.navigator.vendor)||"";if(Jc&&Jc.ua===t)return Jc;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 Jc={ua:t,isMobile:r},Jc}var tu,eu;"undefined"!=typeof window&&(window.addEventListener("pageshow",(function(t){t.persisted&&setTimeout((function(){window.location.reload()}),10)}),!1),null===(tu=(eu=window).EkoAnalytics)||void 0===tu||tu.call(eu,"track","init"));var nu=Es('<div class="paging-buttons svelte-1n46o8q"><!> <!></div>'),iu=Es('<div style="position: absolute; top: 0; left: 0; width: 100%;"></div>'),ru=Es("<!> <!>",1),ou=Es('<div class="player-container svelte-1n46o8q"><div class="player-div swipable svelte-1n46o8q"></div> <!> <!> <!> <!></div> <!>',1),su=Es('<div class="eko-gallery-app svelte-1n46o8q"><!></div>');const au={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;border-radius:16px;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 lu(t,e){Ti(e,!0),Xs(t,au);const n=wa(e,"config",19,(()=>({}))),i=wa(e,"forceMobile",3,!1),r=wa(e,"videoAspectRatio",3,"unset"),o=wa(e,"onGalleryReady",3,(()=>{})),s=wa(e,"onEvent",3,(()=>{}));let a,l=!1,c=Yr(new oc({...n(),onEvent:s()})),u=Yr(null),d=jr((()=>i()||Zc().isMobile)),h=Yr(0),f=Yr(void 0),p=Yr(!0),m=Yr(no({width:"100%",height:"100%"}));var v,g,y;function b(){const t={AssetsDeliveryService:{assetsDeliveryServiceUrl:fs(c).urls.assetsDeliveryBase},Tracker:{tag:fs(c).uuid}};Jr(u,new e.EkoPlayer(a,function(t,...e){function n(t){return"[object Object]"===Object.prototype.toString.call(t)}function i(t,e){if(Array.isArray(e)){Array.isArray(t)||(t=Array.isArray(t)?t.slice():[]);const r=Math.max(t.length,e.length);for(let o=0;o<r;o++){const r=t[o],s=e[o];null!=s&&(n(r)&&n(s)?t[o]=i({...r},s):Array.isArray(r)&&Array.isArray(s)?t[o]=i(r.slice(),s):n(s)?t[o]=i({},s):Array.isArray(s)?t[o]=i([],s):t[o]=s)}return t}if(n(e)){n(t)||(t={});for(const r of Object.keys(e)){const o=t[r],s=e[r];n(o)&&n(s)?t[r]=i({...o},s):Array.isArray(o)&&Array.isArray(s)?t[r]=i(o.slice(),s):n(s)?t[r]=i({},s):Array.isArray(s)?t[r]=i([],s):void 0!==s&&(t[r]=s)}return t}return e}for(const n of e)null!==n&&i(t,n);return t}({},e.playerOptions,t))),fs(u).on("playing",(()=>{fs(c).state.paused=!1})),fs(u).on("pause",(()=>{fs(c).state.paused=!0})),fs(u).once("playing",(()=>{fs(c).state.startedPlaying=!0,s()("galleryloaded")}))}function k(t){var e;null===(e=fs(c))||void 0===e||e.selectItem(t)}function w(){var t;null===(t=fs(c))||void 0===t||t.next()}function x(){var t;null===(t=fs(c))||void 0===t||t.prev()}function _(){fs(u).paused?fs(u).play():fs(u).pause()}function T(){return`--uiTranformX: ${fs(h)}px;--videoAspect: ${r()};--videoWidth: ${fs(m).width};--videoHeight: ${fs(m).height};`}v="state",g=()=>fs(c).state,Ii().set(v,g),y=()=>(o()(fs(c).public),n()&&e.EkoPlayer&&(b(),fs(c).start(fs(u))),()=>{var t;null===(t=fs(u))||void 0===t||t.dispose(),fs(c).dispose()}),null===wi&&li(),To((()=>{const t=vs(y);if("function"==typeof t)return t})),To((()=>{n()&&e.EkoPlayer&&(l?vs((()=>{var t;fs(c).dispose(),Jr(c,new oc({...n(),onEvent:s()})),null===(t=fs(u))||void 0===t||t.dispose(),Jr(p,!1),hs().then((()=>(Jr(p,!0),hs()))).then((()=>{o()(fs(c).public),b(),fs(c).start(fs(u))}))})):l=!0)})),To((()=>{fs(f)&&fs(u)&&fs(u).loadDebugOverlay({containerElement:fs(f)})})),To((()=>{if("unset"!==r()&&r().includes("/")){const[t,e]=r().split("/").map((t=>Number(t)));isNaN(t)||isNaN(e)||Jr(m,t>e?{width:"100%",height:"auto"}:{width:"auto",height:"100%"},!0)}else Jr(m,{width:"100%",height:"100%"},!0)}));var E=su(),I=fo(E),S=t=>{var n=ou(),i=po(n),r=fo(i);ba(r,(t=>a=t),(()=>a));var o=mo(r,2);Yc(o,{get isMobile(){return fs(d)},get gallery(){return fs(c)},get debug(){return e.debug},get onEvent(){return s()},get scrollOffset(){return fs(h)},set scrollOffset(t){Jr(h,t,!0)}});var l=mo(o,2),u=t=>{var e=nu(),n=fo(e);gc(n,{type:"prev",onClick:x}),gc(mo(n,2),{type:"next",onClick:w}),mi(e),Ss(t,e)};js(l,(t=>{fs(d)||e.hideNav||t(u)}));var p=mo(l,2),m=t=>{wc(t,{get gallery(){return fs(c)}})};js(p,(t=>{var e;!fs(d)&&(null===(e=fs(c).state.currentItem)||void 0===e?void 0:e.modules.length)>1&&t(m)}));var v=mo(p,2),g=t=>{var n=ru(),i=po(n);!function(t,e){Ti(e,!0),Xs(t,Sc);const n=_i("state");var i=Ic();i.__click=function(...t){var n;null===(n=e.onPauseClick)||void 0===n||n.apply(this,t)};var r=fo(i),o=t=>{var e=Tc();Ao((()=>fa(e,"src",xc))),Ss(t,e)},s=t=>{var e=Ec();Ao((()=>fa(e,"src",_c))),Ss(t,e)};js(r,(t=>{n().paused?t(o):t(s,!1)})),mi(i),Ao((t=>fa(i,"aria-label",t)),[()=>n().paused?"Play":"Pause"]),Ss(t,i),Ei()}(i,{onPauseClick:_});var r=mo(i,2),o=t=>{var e=iu();ba(e,(t=>Jr(f,t)),(()=>fs(f))),Ss(t,e)};js(r,(t=>{e.debug&&t(o)})),Ss(t,n)};js(v,(t=>{fs(c).state.startedPlaying&&t(g)})),mi(i);var y=mo(i,2),b=t=>{!function(t,e){Ti(e,!0),Xs(t,fc);let n=wa(e,"onNavItemClick",3,(()=>{}));const i=_i("state");var r=hc(),o=fo(r);Vs(o,23,(()=>i().currentItemsList),(t=>t.id),((t,e,r)=>{var o=dc();let s;o.__click=()=>n()(fs(r));var a=fo(o),l=fo(a,!0);mi(a),mi(o),Ao((t=>{s=na(o,1,"nav-button svelte-er27y2",null,s,t),Ps(l,fs(e).name)}),[()=>({selected:fs(r)===i().activeItemIndex})]),Ss(t,o)})),mi(o),mi(r),Ss(t,r),Ei()}(t,{onNavItemClick:k})};js(y,(t=>{e.hideNav||t(b)})),Ao((t=>ra(i,t)),[T]),Ss(t,n)};js(I,(t=>{n()&&fs(p)&&t(S)})),mi(E),Ss(t,E),Ei()}function cu(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var uu,du,hu,fu,pu={exports:{}},mu=cu((uu||(uu=1,hu=pu.exports,fu=function(){var t=function(){},e="undefined",n=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},o=null;function s(t,e){var n=t[e];if("function"==typeof n.bind)return n.bind(t);try{return Function.prototype.bind.call(n,t)}catch(e){return function(){return Function.prototype.apply.apply(n,[t,arguments])}}}function a(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function l(){for(var n=this.getLevel(),r=0;r<i.length;r++){var o=i[r];this[o]=r<n?t:this.methodFactory(o,n,this.name)}if(this.log=this.debug,typeof console===e&&n<this.levels.SILENT)return"No console available for logging"}function c(t){return function(){typeof console!==e&&(l.call(this),this[t].apply(this,arguments))}}function u(i,r,o){return"debug"===(l=i)&&(l="log"),typeof console!==e&&("trace"===l&&n?a:void 0!==console[l]?s(console,l):void 0!==console.log?s(console,"log"):t)||c.apply(this,arguments);var l}function d(t,n){var s,a,c,d=this,h="loglevel";function f(){var t;if(typeof window!==e&&h){try{t=window.localStorage[h]}catch(t){}if(typeof t===e)try{var n=window.document.cookie,i=encodeURIComponent(h),r=n.indexOf(i+"=");-1!==r&&(t=/^([^;]+)/.exec(n.slice(r+i.length+1))[1])}catch(t){}return void 0===d.levels[t]&&(t=void 0),t}}function p(t){var e=t;if("string"==typeof e&&void 0!==d.levels[e.toUpperCase()]&&(e=d.levels[e.toUpperCase()]),"number"==typeof e&&e>=0&&e<=d.levels.SILENT)return e;throw new TypeError("log.setLevel() called with invalid level: "+t)}"string"==typeof t?h+=":"+t:"symbol"==typeof t&&(h=void 0),d.name=t,d.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},d.methodFactory=n||u,d.getLevel=function(){return null!=c?c:null!=a?a:s},d.setLevel=function(t,n){return c=p(t),!1!==n&&function(t){var n=(i[t]||"silent").toUpperCase();if(typeof window!==e&&h){try{return void(window.localStorage[h]=n)}catch(t){}try{window.document.cookie=encodeURIComponent(h)+"="+n+";"}catch(t){}}}(c),l.call(d)},d.setDefaultLevel=function(t){a=p(t),f()||d.setLevel(t,!1)},d.resetLevel=function(){c=null,function(){if(typeof window!==e&&h){try{window.localStorage.removeItem(h)}catch(t){}try{window.document.cookie=encodeURIComponent(h)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(t){}}}(),l.call(d)},d.enableAll=function(t){d.setLevel(d.levels.TRACE,t)},d.disableAll=function(t){d.setLevel(d.levels.SILENT,t)},d.rebuild=function(){if(o!==d&&(s=p(o.getLevel())),l.call(d),o===d)for(var t in r)r[t].rebuild()},s=p(o?o.getLevel():"WARN");var m=f();null!=m&&(c=p(m)),l.call(d)}(o=new d).getLogger=function(t){if("symbol"!=typeof t&&"string"!=typeof t||""===t)throw new TypeError("You must supply a name when creating a logger.");var e=r[t];return e||(e=r[t]=new d(t,o.methodFactory)),e};var h=typeof window!==e?window.log:void 0;return o.noConflict=function(){return typeof window!==e&&window.log===o&&(window.log=h),o},o.getLoggers=function(){return r},o.default=o,o},(du=pu).exports?du.exports=fu():hu.log=fu()),pu.exports));const vu=()=>{},gu=["trace","log","debug","info","warn","error","getLevel","setLevel"],yu=["trace","debug","info","warn","error","silent"],bu={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;"},ku="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global;let wu={level:"trace",appName:""},xu=[];const _u="object"==typeof ku&&ku.performance&&"function"==typeof ku.performance.now?ku.performance.now.bind(ku.performance):Date.now.bind(Date),Tu=t=>t&&"string"==typeof t?t.toLowerCase().trim():"",Eu=(()=>{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[Tu(e)]=Tu(i)||"trace"})),n}catch(t){return{}}})(),Iu=(t,e="")=>{const n=Tu(t),i=mu.getLogger(n);if(i.__ekologger)return i.__ekologger;e||Eu[n]||Eu["*"]||(i.__noExplicitLevel=!0);const r=i.methodFactory;i.methodFactory=(e,n,i)=>{const o=r(e,n,i),s=e.toUpperCase();return(...e)=>{o(`[${((t,e=3)=>(_u()/1e3).toFixed(e))()}] %c[${s}] ${wu.appName?`[${wu.appName}] `:""}[${t}]`,bu[s],...e)}},e=Eu[n]||Eu["*"]||e||wu.level,i.setLevel(e,!1);const o=(...t)=>i.log(...t);return gu.forEach((t=>{o[t]=(...e)=>(xu.forEach((n=>{n[t](...e)})),i[t](...e))})),i.__ekologger=o,o};Iu.setDefaults=({appName:t="",level:e})=>{t&&"string"==typeof t&&(wu.appName=t),(e=Tu(e))&&yu.includes(e)&&(wu.level=e,Object.values(mu.getLoggers()).filter((t=>t.__noExplicitLevel)).forEach((t=>t.setLevel(wu.level,!1))))},Iu.installDriver=t=>{const e={...gu.reduce(((e,n)=>(e[n]="function"==typeof(null==t?void 0:t[n])?t[n]:vu,e)),{})};xu.push(e)};let Su=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 Au(t){return"[object Object]"===Object.prototype.toString.call(t)}function Nu(t,...e){const n=Au(t)?{...t}:{};return e.forEach((t=>{Au(t)&&Object.keys(t).forEach((e=>{const i=t[e],r=n[e];Au(i)&&Au(r)?n[e]=Nu(r,i):Array.isArray(i)?n[e]=i.slice():n[e]=i}))})),n}function Mu(t){if("string"==typeof t)return`'${t}'`;if(Array.isArray(t))return`[${t.map((t=>Mu(t))).join(", ")}]`;if(Au(t))try{return JSON.stringify(t)}catch(t){return"[object Object]"}return null===t?"null":void 0===t?"undefined":String(t)}function Fu(t){return Array.from(t).map((t=>Mu(t))).join(", ")}var Cu=new WeakSet;let Ou=class extends Su{constructor(...t){super(),O(this,Cu);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=Iu(n,this.loglevel);const i=Au(this.defaults)?this.defaults:{},r=Au(e)&&Au(e[n])?e[n]:{};this.settings=Nu({},i,r),A(Cu,this,Pu).call(this),A(Cu,this,Ru).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 Pu(){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}(${Fu(t)})`),a(...t)):a,t.add(o)}n=Object.getPrototypeOf(n)}}function Ru(){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 Du="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};function Lu(t){return Boolean(t)&&"object"==typeof t&&1===t.nodeType&&"function"==typeof t.appendChild}const Bu=Object.freeze({NODE_ADD:"node:add",NODE_CHILDREN_CHANGED:"node:childrenchanged",NODE_LOADED:"node:loaded",NODE_LOAD_ERROR:"node:loaderror",PLACEMENT_ADDED:"placement:added",RENDER_PLACEMENT_ADDED:"renderplacement:added",TIMELINE_TIME_UPDATE:"timeline:timeupdate",TIMELINE_STATE_CHANGE:"statechange",TIMELINE_SEEKING:"seeking",TIMELINE_SEEKED:"seeked",TIMELINE_RESET:"timeline:reset",TIMELINE_PLAYER_STATE:"player:state",TIMELINE_CUEPOINT:"cuepoint",VISUAL_FRAMES_AVAILABLE:"visualframesavailable",TRACK_BUFFER_UPDATE:"track:bufferupdate",TRACK_READY:"track:ready",TRACK_UNDERFLOW:"track:underflow",CLOCK_TICK:"tick",DECODE_READY:"decode:ready",DECODE_ERROR:"decode:error",DECODER_AUDIO:"decoder:audio",DECODER_FRAME:"decoder:frame",DECODER_INIT:"decoder:init",DECODER_ERROR:"decoder:error",QOE_SCORE:"qoescore",QOE_STATUS:"qoestatus",CONTAINER_RESIZE:"containerresize",CANVAS_WEBGL_CONTEXT_LOST:"canvas.webglcontextlost",CANVAS_WEBGL_CONTEXT_RESTORED:"canvas.webglcontextrestored"});function zu(t,e){const n={};return Number.isFinite(t)&&(n.time=t),"string"==typeof e&&(n.source=e),n}function Wu({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 ju({placementId:t,nodeId:e,trackId:n,segmentId:i,trackType:r,error:o}={}){const s={};return t&&(s.placementId=t),e&&(s.nodeId=e),n&&(s.trackId=n),i&&(s.segmentId=i),r&&(s.trackType=r),o&&(s.error=o),s}var Uu=new WeakMap,$u=new WeakMap,qu=new WeakMap,Vu=new WeakMap,Gu=new WeakMap,Hu=new WeakMap,Ku=new WeakMap,Xu=new WeakSet;let Yu=class extends Ou{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),O(this,Xu),F(this,Uu,void 0),F(this,$u,void 0),F(this,qu,void 0),F(this,Vu,void 0),F(this,Gu,void 0),F(this,Hu,void 0),F(this,Ku,void 0);const[i,r=null]=t;C(Hu,this,r);const o=function(t,e=(null==Du?void 0:Du.document)){if(Lu(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 Lu(i)?i:null}(i);if(!o)throw new Error("Canvas requires a valid mount target (HTMLElement or selector string).");C(Uu,this,o);const s=null==Du?void 0:Du.document;if(!s||"function"!=typeof s.createElement)throw new Error("Canvas requires document.createElement.");var a,l;C($u,this,s.createElement("canvas")),a=M($u,this),l=null===(e=this.settings)||void 0===e?void 0:e.style,a&&l&&"object"==typeof l&&!Array.isArray(l)&&Object.keys(l).forEach((t=>{const e=l[t];null!=e&&(a.style[t]=String(e))})),M(Uu,this).appendChild(M($u,this));const c=null===(n=this.settings)||void 0===n?void 0:n.contextAttributes,u=c&&"object"==typeof c&&!Array.isArray(c)?c:void 0;if(C(Ku,this,u),C(qu,this,M($u,this).getContext("webgl2",u)),!M(qu,this))throw new Error("Canvas WebGL2 context is not available.");A(Xu,this,Ju).call(this)}get name(){return"Canvas"}get element(){return M($u,this)}get gl(){return M(qu,this)}onDispose(){A(Xu,this,Zu).call(this),M($u,this)&&M($u,this).parentNode&&M($u,this).parentNode.removeChild(M($u,this)),C(qu,this,null),C($u,this,null),C(Uu,this,null),C(Hu,this,null),C(Ku,this,null),C(Vu,this,null),C(Gu,this,null)}};function Qu(t,e){var n,i;this.trigger(t,e),null===(n=M(Hu,this))||void 0===n||null===(i=n.trigger)||void 0===i||i.call(n,t,e)}function Ju(){M($u,this)&&(C(Vu,this,(t=>{"function"==typeof(null==t?void 0:t.preventDefault)&&t.preventDefault(),this.log.error("WebGL context lost",t),A(Xu,this,Qu).call(this,Bu.CANVAS_WEBGL_CONTEXT_LOST,t)})),C(Gu,this,(t=>{var e;C(qu,this,(null===(e=M($u,this))||void 0===e?void 0:e.getContext("webgl2",M(Ku,this)))||null),M(qu,this)?A(Xu,this,Qu).call(this,Bu.CANVAS_WEBGL_CONTEXT_RESTORED,t):this.log.error("WebGL context restored event fired but WebGL2 context is still unavailable.",t)})),M($u,this).addEventListener("webglcontextlost",M(Vu,this)),M($u,this).addEventListener("webglcontextrestored",M(Gu,this)))}function Zu(){M($u,this)&&(M($u,this).removeEventListener("webglcontextlost",M(Vu,this)),M($u,this).removeEventListener("webglcontextrestored",M(Gu,this)))}var td=new WeakMap,ed=new WeakMap,nd=new WeakMap,id=new WeakMap,rd=new WeakMap,od=new WeakMap,sd=new WeakSet;let ad=class extends Ou{get name(){return"ContainerSize"}get containerWidth(){return M(ed,this)}get containerHeight(){return M(nd,this)}get width(){return M(ed,this)}get height(){return M(nd,this)}constructor(...t){super(...t),O(this,sd),F(this,td,void 0),F(this,ed,0),F(this,nd,0),F(this,id,null),F(this,rd,null),F(this,od,null);const[e]=t;var n;C(td,this,(n=e)&&n.element&&Lu(n.element)?n.element:Lu(n)?n:null),M(td,this)&&(A(sd,this,cd).call(this,!0),A(sd,this,ld).call(this))}onDispose(){M(id,this)&&"function"==typeof M(id,this).disconnect&&M(id,this).disconnect(),C(id,this,null),M(od,this)&&"function"==typeof(null==Du?void 0:Du.removeEventListener)&&Du.removeEventListener("resize",M(od,this)),C(od,this,null),M(rd,this)&&((null==Du?void 0:Du.clearInterval)||clearInterval)(M(rd,this)),C(rd,this,null),C(td,this,null)}};function ld(){if(!M(td,this))return;const t=null==Du?void 0:Du.ResizeObserver;if("function"==typeof t)return C(id,this,new t((()=>A(sd,this,cd).call(this)))),void M(id,this).observe(M(td,this));C(od,this,(()=>A(sd,this,cd).call(this))),"function"==typeof(null==Du?void 0:Du.addEventListener)&&Du.addEventListener("resize",M(od,this));const e=(null==Du?void 0:Du.setInterval)||setInterval;C(rd,this,e((()=>A(sd,this,cd).call(this)),250))}function cd(t=!1){if(!M(td,this))return;const{width:e,height:n}=function(t){const e=Number(null==t?void 0:t.clientWidth),n=Number(null==t?void 0:t.clientHeight);return{width:Number.isFinite(e)&&e>0?Math.round(e):0,height:Number.isFinite(n)&&n>0?Math.round(n):0}}(M(td,this));(t||e!==M(ed,this)||n!==M(nd,this))&&(C(ed,this,e),C(nd,this,n),this.trigger("containerresize",{width:e,height:n}))}var ud={VIDEO_SOURCE_PREFIX:"__SRC_VID:",TEXTURE_SOURCE_PREFIX:"__SRC_TEXTURE:",PREVIOUS_OUTPUT_PREFIX:"__PREVIOUS:",SAVED_FRAME_PREFIX:"__SAVED_FRAME:",SYSTEM_NODES:{FILTERS:{RENDER_TO_CANVAS:"__default"},TAGS:{ATOM:"atom",FILTER:"filter",COMPOSITE_FILTER:"composite",TRANSITION_FILTER:"transition"}},MESSAGES:{UPDATE_OPTIONS:"update_options"}};let dd=class{constructor(t,e){this.canvasSource=t,this.startRendering=e,this.gl=null,this.glOptions=null}init(t,e,n){this.glOptions=n||{};const i=this.initCanvas(this.canvasSource,t,e);return this.initWebgl(i,this.glOptions)}initCanvas(){throw new Error("implement on concrete class")}getContextConfig(t={}){if(!t||"object"!=typeof t)return{contextType:"webgl",contextAttributes:void 0};const{contextType:e,contextAttributes:n,__shaderGraph:i,...r}=t,o=Object.prototype.hasOwnProperty.call(t,"contextAttributes");let s=o?n:r;return o||!s||"object"!=typeof s||Array.isArray(s)||0!==Object.keys(s).length||(s=void 0),{contextType:e||"webgl",contextAttributes:s}}initWebgl(t,e={}){const{contextType:n,contextAttributes:i}=this.getContextConfig(e),r=t.getContext(n,i);if(!r)throw new Error(`Browser doesn't support ${n}`);return r.enable(r.BLEND),r.disable(r.DEPTH_TEST),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),r}isStartRendering(){return this.startRendering}};var hd,fd={exports:{}},pd=(hd||(hd=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}(fd)),fd.exports),md=cu(pd);let vd=class extends dd{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 md;this.on=e.on.bind(e),this.off=e.off.bind(e),this.once=e.once.bind(e),this.trigger=e.emit.bind(e)}onPlayerSeeking(){this.shouldUpdateTexture=!1}onPlayerSeeked(){this.shouldUpdateTexture=!0}onPlayerNodeStart(){this.shouldUpdateTexture=!0,"function"==typeof this.player.canvas.drawFrame&&this.player.canvas.drawFrame(),this.trigger("forcerender")}oncePlayerPlaying(){this.onPlayerNodeStart()}addPlayerListeners(){this.player&&(this.player.on("seeking",this.onPlayerSeeking),this.player.on("seeked",this.onPlayerSeeked),this.player.on("nodestart",this.onPlayerNodeStart),this.player.once("playing",this.oncePlayerPlaying))}removePlayerListeners(){this.player&&(this.player.off("seeking",this.onPlayerSeeking),this.player.off("seeked",this.onPlayerSeeked),this.player.off("nodestart",this.onPlayerNodeStart),this.player.off("playing",this.oncePlayerPlaying))}initCanvas(t,e,n){var i;this.player=t,this.setSrcVidTracksFn=e;const{contextType:r,contextAttributes:o}=this.getContextConfig(this.glOptions),s=!1!==(null===(i=this.glOptions)||void 0===i||null===(i=i.__shaderGraph)||void 0===i?void 0:i.forwardContextAttributes)&&null!=(a=o)&&"object"==typeof a&&!Array.isArray(a)&&Object.keys(a).length>0;var a;const l={contextType:r};s&&(l.contextAttributes=o),t.initPlugin("canvas",l);const c={drawFrame:this.canvasDrawFrameFn.bind(this),resize:n,contextType:r,offscreenVideoCanvasEnabled:!1,viewportModeEnabled:!0,fps:0};return s&&(c.contextAttributes=o),t.canvas.init(c),t.paused&&0===t.currentTime&&(this.shouldUpdateTexture=!1),this.addPlayerListeners(),t.canvas.canvas}canvasDrawFrameFn(t,e,n){var i;this.setSrcVidTracksFn&&this.shouldUpdateTexture&&t&&e&&n&&(n.videoWidth||n.displayWidth)&&(n.videoHeight||n.displayHeight)&&(!(i=n)||"boolean"!=typeof i.isDataLoaded||i&&i.isDataLoaded&&(void 0===i.isFrameTextureReady||i.isFrameTextureReady))&&this.setSrcVidTracksFn(n)}async recover(){if(this.player&&this.player.paused)return new Promise((t=>{this.player.once("seeked",(()=>{this.shouldUpdateTexture=!0,t()})),this.player.currentTime=this.player.currentTime}))}dispose(){this.player&&(this.player.canvas&&"function"==typeof this.player.canvas.dispose&&this.player.canvas.dispose(),this.removePlayerListeners(),this.player=null)}},gd=class extends dd{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)}},yd=class extends dd{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 bd=function(t){let e;return e="string"==typeof t?new gd(t):t&&t.src&&t.dest?new yd(t):new vd(t),e};function kd(t){return Array.isArray(t)||(t=[t]),t}let wd=class{constructor(t){this.store=t?{...t.get()}:{}}reset(){this.store={}}get(t){if(!t)return this.store;const e=(t=kd(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=kd(t),e=kd(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]}))}},xd=class{constructor(t,e,n,i){this.gl=i.gl,this.unit=t,this.bindPoint=e,this.height=1080,this.width=1920,this.textureObject=n.object,this.textureObjectInfo=n,this.isStatic=!1,n.needRefresh&&this.setParameters()}getUnit(){return this.unit}getObject(){return this.textureObject}bind(){this.gl.bindTexture(this.bindPoint,this.textureObject)}fill(){throw new Error("impl in concrete class")}setParameters(){this.bind(),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.bindPoint,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR)}active(){this.gl.activeTexture(this.gl.TEXTURE0+this.getUnit())}beforeUse(){this.active(),this.bind()}dispose(){this.gl.deleteTexture(this.textureObject)}setHeight(t){this.height=t}setWidth(t){this.width=t}getHeight(){if(!this.height)throw new Error(`texture ${this.unit} no height init `);return this.height}getWidth(){if(!this.width)throw new Error(`texture ${this.unit} no width init `);return this.width}};const _d=Iu("frame","warn");let Td=!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");Td=e||n}function Ed(t,e){const n=t.gl;var i;n.texImage2D(t.bindPoint,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e),t.__hasAllocated=!0,i=t,Number.isFinite(i.width)&&Number.isFinite(i.height)&&(i.actualWidth=i.width,i.actualHeight=i.height,i.textureObjectInfo&&(i.textureObjectInfo.allocatedWidth=i.width,i.textureObjectInfo.allocatedHeight=i.height))}let Id=class extends xd{fill(t){if(Td&&(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?Ed(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,Ed(t,e)):t.__useSubImage=!0))}(this,t,e);const i=(performance.now()-n)/1e3;i>=.1&&_d.warn(`[fill] texImage2D() took ${i.toFixed(3)} seconds to execute.`),"function"==typeof t.close&&!0!==t.__keepOpen&&(t.close(),t.__closed=!0)}},Sd=class extends xd{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 Ad=function(t,e,n,i,r){let o;switch(t){case"frame":o=new Id(e,n,i,r);break;case"pixel":o=new Sd(e,n,i,r);break;default:throw new Error(`cant recognize type ${t}`)}return o};let Nd=class{constructor(t){this.gl=t.gl;const e=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS)||20;return this.maxTextures=Math.min(20,e),this.textureObjectPool=[],this.textureUnitsPool=new Set(Array(this.maxTextures).keys()),this.activeTextures=t.activeTextures instanceof Set?t.activeTextures:new Set,{createTexture:this.createTexture.bind(this),releaseTexture:this.releaseTexture.bind(this),refreshTextureObjects:this.refreshTextureObjects.bind(this),refreshActiveTextures:this.refreshActiveTextures.bind(this)}}getTextureObject(){return this.textureObjectPool.pop()||{object:this.gl.createTexture(),needRefresh:!0}}getTextureUnit(){const t=this.textureUnitsPool.values(),e=Math.min.apply(null,[...t]);return this.textureUnitsPool.delete(e),e}createTexture(t){const e=t&&t.type||{},n=this.gl.TEXTURE_2D,i=this.getTextureUnit(),r=this.getTextureObject(),o=Ad(e,i,n,r,{gl:this.gl});return this.activeTextures.add(o),o}releaseTexture(t){this.textureUnitsPool.has(t.getUnit())||(this.textureObjectPool.push({object:t.getObject(),needRefresh:!1}),this.textureUnitsPool.add(t.getUnit())),this.activeTextures.delete(t)}refreshTextureObjects(){this.textureObjectPool.forEach((t=>{t.needRefresh=!0}))}refreshActiveTextures(){const t=new Set;this.activeTextures.forEach((e=>{if(!e||"function"!=typeof e.getUnit)return;t.add(e.getUnit());const n={object:this.gl.createTexture(),needRefresh:!0};e.gl=this.gl,e.textureObjectInfo=n,e.textureObject=n.object,e.__hasAllocated=!1,e.__useSubImage=void 0,e.actualWidth=null,e.actualHeight=null,"function"==typeof e.setParameters&&e.setParameters()})),this.textureObjectPool=[],this.textureUnitsPool=new Set(Array(this.maxTextures).keys()),t.forEach((t=>{this.textureUnitsPool.delete(t)}))}};const Md=ud.VIDEO_SOURCE_PREFIX,Fd=ud.TEXTURE_SOURCE_PREFIX,Cd=ud.PREVIOUS_OUTPUT_PREFIX,Od=ud.SAVED_FRAME_PREFIX;function Pd(t,e,n){t.set(`${Md}${n}`,e)}function Rd(t,e,n){t.set(`${Cd}${n}`,e)}function Dd(t,e,n){t.set(`${Od}${n}`,e)}let Ld=class{constructor(t){return this.gl=t.gl,this.glSource=t.glSource,this.textureManager=t.textureManager,this.capturedFramesManager=t.capturedFramesManager,{setVideoSources:this.setVideoSources.bind(this),setTextureSource:this.setTextureSource.bind(this),getInput:this.getInput.bind(this),getPrevOutput:this.getPrevOutput.bind(this),setOutputs:this.setOutputs.bind(this),disposeTextures:this.disposeTextures.bind(this),disposeAllStore:this.disposeAllStore.bind(this)}}setVideoSources(t){for(const[e,n]of Object.entries(this.capturedFramesManager.getCurrentFrames()))Pd(t,n,e),Rd(t,n,e);for(const[e,n]of Object.entries(this.capturedFramesManager.getSavedFrames()))Dd(t,n,e)}setTextureSource(t,e,n){t.set(`${Fd}${n}`,e)}getInput(t,e){return t.get(e)}getPrevOutput(t,e){return e=Number.isInteger(e)?e:0,t.get(`${Cd}${e}`)}setOutputs(t,e=[],n=[]){if(Array.isArray(n)||(n=[n]),e.length>n.length)throw new Error(`output ids ${e.length} is bigger then supplied outputs ${n.length}`);n.forEach(((e,n)=>{Rd(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))}))}},Bd=class{constructor(t){this.context=t}bind(){throw new Error("impl in concrete")}},zd=100,Wd=100;function jd(t,e){zd=t,Wd=e}let Ud=class extends Bd{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),jd(i,r)),t}},$d=class extends Bd{bind(t){Array.isArray(t)||(t=[t]),this.context.gl.bindFramebuffer(this.context.gl.FRAMEBUFFER,this.context.frameBufferObject);const e=this.context.textureManager.createTexture({type:"pixel"}),n=this.context.gl.COLOR_ATTACHMENT0;if(this.context.gl.framebufferTexture2D(this.context.gl.FRAMEBUFFER,n,this.context.gl.TEXTURE_2D,e.textureObject,0),this.context.gl.clear(this.context.gl.COLOR_BUFFER_BIT),!0===this.context.useCanvasSizedFilterTargets){var i,r;const t=null===(i=this.context.gl)||void 0===i||null===(i=i.canvas)||void 0===i?void 0:i.width,n=null===(r=this.context.gl)||void 0===r||null===(r=r.canvas)||void 0===r?void 0:r.height;Number.isFinite(t)&&t>0&&e.setWidth(t),Number.isFinite(n)&&n>0&&e.setHeight(n);const o=e.textureObjectInfo,s=null==o?void 0:o.allocatedWidth,a=null==o?void 0:o.allocatedHeight;Number.isFinite(t)&&Number.isFinite(n)&&(s!==t||a!==n)&&"function"==typeof e.fill&&e.fill(null)}else t[0]&&(e.setHeight(t[0].getHeight()),e.setWidth(t[0].getWidth()));return e}},qd=class{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===ud.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS?new Ud({gl:this.gl}):new $d({gl:this.gl,textureManager:this.textureManager,frameBufferObject:this.getFrameBufferObject(),useCanvasSizedFilterTargets:this.useCanvasSizedFilterTargets}),e}};function Vd(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 Gd=function(t,e){return Vd(t,t.VERTEX_SHADER,e)},Hd=function(t,e){return Vd(t,t.FRAGMENT_SHADER,e)};const Kd={position_3d:0,texture_coordinate_2d:1};var Xd=function(t,e,n){const i=t.createProgram();if(t.attachShader(i,e),t.attachShader(i,n),Object.entries(Kd).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)},Yd=[-1,-1,1,1,-1,1,-1,1,1,1,1,1],Qd=[0,1,2,2,1,3],Jd=[0,0,1,0,0,1,1,1];const Zd=96,th=[new Float32Array(new ArrayBuffer(Zd)),new Float32Array(new ArrayBuffer(Zd)),new Float32Array(new ArrayBuffer(Zd)),new Float32Array(new ArrayBuffer(Zd)),new Float32Array(new ArrayBuffer(Zd)),new Float32Array(new ArrayBuffer(Zd))],eh=[new Int16Array(6),new Int16Array(6),new Int16Array(6)];let nh=class{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=th[this.floatBufferCounter],this.floatBufferCounter=this.floatBufferCounter++%th.length;break;case this.gl.ELEMENT_ARRAY_BUFFER:t=eh[this.unit16BufferCounter],this.unit16BufferCounter=this.unit16BufferCounter++%eh.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 ih={position_3d:class extends nh{getPointerData(){return{size:3,type:this.gl.FLOAT,normalize:!1,stride:0,offset:0}}},position_indexes:class extends nh{setPointer(){}getPointerData(){}enable(){}},texture_coordinate_2d:class extends nh{getPointerData(){return{size:2,type:this.gl.FLOAT,normalize:!0,stride:0,offset:0}}}};var rh=function(t,e,n){const i=ih[t];if(!i)throw new Error(`${t} is not a attribute name,choose from list: ${Object.keys(ih)}`);return new i(t,e,n)};let oh=class{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}},sh=class extends oh{set(t){this.gl.uniform1fv(this.location,t)}},ah=class extends oh{set(t){t&&(t.beforeUse(),this.gl.uniform1i(this.location,t.getUnit()))}};const lh="first_texture_dimensions",ch="viewport_dimensions",uh="time",dh={RUNTIME_OPTIONS:"runtimeOptions[0]",STATIC_OPTIONS:"staticOptions[0]",FIRST_TEXTURE:"first_texture",SECOND_TEXTURE:"second_texture",FIRST_MATRIX:"first_mat4"},hh={[dh.FIRST_TEXTURE]:ah,[dh.SECOND_TEXTURE]:ah,[dh.FIRST_MATRIX]:class extends oh{set(t){this.gl.uniformMatrix4fv(this.location,!1,t)}},[dh.STATIC_OPTIONS]:sh,[dh.RUNTIME_OPTIONS]:sh};var fh=function(t,e){const n=hh[t];if(!n)throw new Error(`${t} is not a attribute name,choose from list: ${Object.keys(hh)}`);return new n(t,e)},ph=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 mh="position_3d",vh="position_indexes",gh="texture_coordinate_2d";class yh{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=Gd(this.gl,e.vertex),this.fragmentShader=Hd(this.gl,e.fragment),this.program=Xd(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:mh,bindPoint:e.gl.ARRAY_BUFFER},{id:vh,bindPoint:e.gl.ELEMENT_ARRAY_BUFFER},{id:gh,bindPoint:e.gl.ARRAY_BUFFER}].concat(t)).forEach((t=>{const i=t.id;n[i]=rh(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]=fh(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:dh.RUNTIME_OPTIONS},{id:dh.STATIC_OPTIONS}];return(t.getUniformList||yh.getUniformList)().forEach((t=>{Object.values(dh).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||yh.getUniformList)().forEach((t=>{switch(t){case dh.FIRST_TEXTURE:this.uniforms[dh.FIRST_TEXTURE].set(r[0]);break;case dh.SECOND_TEXTURE:this.uniforms[dh.SECOND_TEXTURE].set(r[1]);break;case lh:o=[...o,r[0].getWidth(),r[0].getHeight()];break;case ch:o=[...o,i.width,i.height];break;case uh:{const t=ph(e.startTime,e.duration);o=[...o,t];break}}})),o.length>0&&this.uniforms[dh.RUNTIME_OPTIONS].set(o)}static getUniformList(){return[dh.FIRST_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(){}handleAttributes(){this.attributes[mh].fillBuffer(Yd),this.attributes[mh].setPointer(),this.attributes[vh].fillBuffer(Qd),this.attributes[gh].fillBuffer(Jd),this.attributes[gh].setPointer()}disposeAttributes(){Object.values(this.attributes).forEach((t=>{t.dispose()}))}render(t,e){const n=this.frameBuffer.bind(t);let i={width:zd,height:Wd};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)}}var bh,kh="undefined"!=typeof Float32Array?Float32Array:Array;function wh(){var t=new kh(3);return kh!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function xh(t,e,n){var i=new kh(3);return i[0]=t,i[1]=e,i[2]=n,i}function _h(){var t=new kh(4);return kh!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}wh(),function(){var t;t=new kh(4),kh!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}(),wh(),xh(1,0,0),xh(0,1,0),_h(),_h(),bh=new kh(9),kh!=Float32Array&&(bh[1]=0,bh[2]=0,bh[3]=0,bh[5]=0,bh[6]=0,bh[7]=0),bh[0]=1,bh[4]=1,bh[8]=1;class Th extends yh{constructor(t){const e={uniforms:yh.getUniformInfo(Th)};super(Th.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:Th.getInitialOptions().translate.x},{properties:["translate","y"],type:"slider",minValue:-2,maxValue:2,step:.001,initialValue:Th.getInitialOptions().translate.y},{properties:["scale","x"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:Th.getInitialOptions().scale.x},{properties:["scale","y"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:Th.getInitialOptions().scale.y},{properties:["rotate"],type:"slider",minValue:-360,maxValue:360,step:1,initialValue:Th.getInitialOptions().rotate}]}static getUniformList(){return[dh.FIRST_TEXTURE,dh.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],w=i[1],x=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)*w,t[5]=(1-(d+v))*w,t[6]=(m+g)*w,t[7]=0,t[8]=(f+y)*x,t[9]=(m-g)*x,t[10]=(1-(d+p))*x,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}((s=new kh(16),kh!=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}(_h(),0,0,o),xh(e,n,0),xh(i,r,1)),this.uniforms[dh.FIRST_MATRIX].set(this.transformMatrix)}}class Eh extends yh{constructor(t){const e={uniforms:yh.getUniformInfo(Eh)};super(Eh.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[dh.FIRST_TEXTURE,lh]}}class Ih extends yh{constructor(t){const e={uniforms:yh.getUniformInfo(Ih)};super(Ih.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[2];\n\nvarying vec2 blur_texture_coordinate_2d[11];\n\n\nvoid main() {\n vec2 normalize_poistion = vec2(position_3d.xy);\n gl_Position = vec4(normalize_poistion, 1, 1);\n\n float texture_width = runtimeOptions[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[dh.FIRST_TEXTURE,lh]}}class Sh extends yh{constructor(t){const e={uniforms:yh.getUniformInfo(Sh)};super(Sh.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float staticOptions[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[dh.FIRST_TEXTURE,lh,ch]}handleStaticUniforms(t){var e;const n=(null!==(e=Number.parseFloat(t.offsetDist))&&void 0!==e?e:4).toFixed(3);this.uniforms[dh.STATIC_OPTIONS].set([n])}}class Ah extends yh{constructor(t){const e={uniforms:yh.getUniformInfo(Ah)};super(Ah.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[dh.FIRST_TEXTURE,lh,ch]}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[dh.STATIC_OPTIONS].set([i,r])}}class Nh extends yh{constructor(t){const e={uniforms:yh.getUniformInfo(Nh)};super(Nh.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[dh.STATIC_OPTIONS].set([e])}}class Mh extends yh{constructor(t){const e={uniforms:yh.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;\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[dh.FIRST_TEXTURE,lh,dh.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[dh.STATIC_OPTIONS].set([e,n,i,r,o,s,a])}}class Fh extends yh{constructor(t){const e={uniforms:yh.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 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[dh.FIRST_TEXTURE,dh.SECOND_TEXTURE]}}class Ch extends yh{constructor(t){const e={uniforms:yh.getUniformInfo(Ch)};super(Ch.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n}\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[dh.FIRST_TEXTURE,dh.SECOND_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(t){const e=Number.parseFloat(t.lutSize).toFixed(1);this.uniforms[dh.STATIC_OPTIONS].set([e])}}var Oh="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",Ph='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:Rh,cos:Dh,sin:Lh,acos:Bh,atan2:zh,sqrt:Wh,pow:jh}=Math;function Uh(t){return t<0?-jh(-t,1/3):jh(t,1/3)}const $h=Math.PI,qh=2*$h,Vh=$h/2,Gh=Number.MAX_SAFE_INTEGER||9007199254740991,Hh=Number.MIN_SAFE_INTEGER||-9007199254740991,Kh={x:0,y:0,z:0},Xh={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),Wh(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],Kh],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||Xh.approximately(t,e)||Xh.approximately(t,n)},approximately:function(t,e,n){return Rh(t-e)<=(n||1e-6)},length:function(t){const e=Xh.Tvalues.length;let n=0;for(let i,r=0;r<e;r++)i=.5*Xh.Tvalues[r]+.5,n+=Xh.Cvalues[r]*Xh.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(Xh.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 zh(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 Wh(n*n+i*i)},closest:function(t,e){let n,i,r=jh(2,63);return t.forEach((function(t,o){i=Xh.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=jh(t,e)+jh(1-t,e);return Rh((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=jh(1-t,e);return n/(jh(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 Xh.lli8(r,o,s,a,l,c,u,d)},lli:function(t,e){return Xh.lli4(t,t.c,e,e.c)},makeline:function(t,e){return new sf(t.x,t.y,(t.x+e.x)/2,(t.y+e.y)/2,e.x,e.y)},findbbox:function(t){let e=Gh,n=Gh,i=Hh,r=Hh;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(!Xh.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=Xh.makeline(e.points[i-1],t.points[0]),s=Xh.makeline(t.points[r-1],e.points[0]),a={startcap:o,forward:t,back:e,endcap:s,bbox:Xh.findbbox([o,t,e,s]),intersections:function(t){return Xh.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=Gh,s=Hh;-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=-zh(e.p2.y-i,e.p2.x-n);return t.map((function(t){return{x:(t.x-n)*Dh(r)-(t.y-i)*Lh(r),y:(t.x-n)*Lh(r)+(t.y-i)*Dh(r)}}))},roots:function(t,e){e=e||{p1:{x:0,y:0},p2:{x:1,y:0}};const n=t.length-1,i=Xh.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=-Wh(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(Xh.approximately(l,0)){if(Xh.approximately(c,0))return Xh.approximately(u,0)?[]:[-d/u].filter(r);const t=Wh(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,w;if(v<0){const t=-h/3,e=Wh(t*t*t),n=-p/(2*e),i=Bh(n<-1?-1:n>1?1:n),o=2*Uh(e);return b=o*Dh(i/3)-c/3,k=o*Dh((i+qh)/3)-c/3,w=o*Dh((i+2*qh)/3)-c/3,[b,k,w].filter(r)}if(0===v)return g=m<0?Uh(-m):-Uh(m),b=2*g-c/3,k=-g-c/3,[b,k].filter(r);{const t=Wh(v);return g=Uh(-m+t),y=Uh(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=-Wh(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=Xh.compute(t,e),h=Xh.compute(t,n),f=d.x*d.x+d.y*d.y;if(i?(o=Wh(jh(d.y*h.z-h.y*d.z,2)+jh(d.z*h.x-h.z*d.x,2)+jh(d.x*h.y-h.x*d.y,2)),s=jh(f+d.z*d.z,1.5)):(o=d.x*h.y-d.y*h.x,s=jh(f,1.5)),0===o||0===s)return{k:0,r:0};if(c=o/s,u=s/o,!r){const r=Xh.curvature(t-.001,e,n,i,!0).k,o=Xh.curvature(t+.001,e,n,i,!0).k;l=(o-c+(c-r))/2,a=(Rh(o-c)+Rh(c-r))/2}return{k:c,r:u,dk:l,adk:a}},inflections:function(t){if(t.length<4)return[];const e=Xh.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(Xh.approximately(o,0)){if(!Xh.approximately(s,0)){let t=-a/s;if(0<=t&&t<=1)return[t]}return[]}const l=2*o;if(Xh.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,Rh(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 Xh.bboxoverlap(t.left.bbox(),t.right.bbox())}));let u=[];return 0===c.length||(c.forEach((function(t){u=u.concat(Xh.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*Dh(Vh)-r*Lh(Vh),l=i*Lh(Vh)+r*Dh(Vh),c=o*Dh(Vh)-s*Lh(Vh),u=o*Lh(Vh)+s*Dh(Vh),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=Xh.lli8(d,h,m,v,f,p,g,y),k=Xh.dist(b,t);let w,x=zh(t.y-b.y,t.x-b.x),_=zh(e.y-b.y,e.x-b.x),T=zh(n.y-b.y,n.x-b.x);return x<T?((x>_||_>T)&&(x+=qh),x>T&&(w=T,T=x,x=w)):T<_&&_<x?(w=T,T=x,x=w):T+=qh,b.s=x,b.e=T,b.r=k,b},numberSort:function(t,e){return t-e}};class Yh{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 Xh.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++)Xh.expandbox(e,t[n].bbox());return e}offset(t){const e=[];return this.curves.forEach((function(n){e.push(...n.offset(t))})),new Yh(e)}}const{abs:Qh,min:Jh,max:Zh,cos:tf,sin:ef,acos:nf,sqrt:rf}=Math,of=Math.PI;let sf=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=Xh.align(s,{p1:s[0],p2:s[l]}),d=Xh.dist(s[0],s[l]);this._linear=u.reduce(((t,e)=>t+Qh(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=Xh.dist(n,s.C));const a=o*(1-r)/r,l=Xh.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),w=b.y+(v-b.y)/(1-r),x=b.x+(g-b.x)/r,_=b.y+(y-b.y)/r,T={x:t.x+(k-t.x)/r,y:t.y+(w-t.y)/r},E={x:i.x+(x-i.x)/(1-r),y:i.y+(_-i.y)/(1-r)};return new e(t,T,E,i)}static getUtils(){return Xh}getUtils(){return e.getUtils()}static get PolyBezier(){return Yh}valueOf(){return this.toString()}toString(){return Xh.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=Xh.derive(this.points,this._3d),this.computedirection()}computedirection(){const t=this.points,e=Xh.angle(t[0],t[this.order],t[1]);this.clockwise=e>0}length(){return Xh.length(this.derivative.bind(this))}static getABC(t=2,e,n,i,r=.5){const o=Xh.projectionratio(r,t),s=1-o,a={x:o*e.x+s*i.x,y:o*e.y+s*i.y},l=Xh.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],Xh.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=Xh.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=Xh.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?Xh.computeWithRatios(t,this.points,this.ratios,this._3d):Xh.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 Xh.compute(t,this.dpoints[0],this._3d)}dderivative(t){return Xh.compute(t,this.dpoints[1],this._3d)}align(){let t=this.points;return new e(Xh.align(t,{p1:t[0],p2:t[t.length-1]}))}curvature(t){return Xh.curvature(t,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return Xh.inflections(this.points)}normal(t){return this._3d?this.__normal3(t):this.__normal2(t)}__normal2(t){const e=this.derivative(t),n=rf(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=rf(e.x*e.x+e.y*e.y+e.z*e.z),r=rf(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=rf(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=Xh.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=Xh.map(0,0,1,this._t1,this._t2),r.left._t2=Xh.map(t,0,1,this._t1,this._t2),r.right._t1=Xh.map(t,0,1,this._t1,this._t2),r.right._t2=Xh.map(1,0,1,this._t1,this._t2),n?(n=Xh.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]=Xh.droots(r),3===this.order&&(r=this.dpoints[1].map(i),t[n]=t[n].concat(Xh.droots(r))),t[n]=t[n].filter((function(t){return t>=0&&t<=1})),e=e.concat(t[n].sort(Xh.numberSort))}.bind(this)),t.values=e.sort(Xh.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]=Xh.getminmax(this,n,t[n])}.bind(this)),e}overlaps(t){const e=this.bbox(),n=t.bbox();return Xh.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=Xh.angle(this.points[0],this.points[3],this.points[1]),e=Xh.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),Qh(nf(n))<of/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,Qh(n-i)<r)return[];e=t.split(n,i),e._t1=Xh.map(n,0,1,t._t1,t._t2),e._t2=Xh.map(i,0,1,t._t1,t._t2),s.push(e),n=i;break}n<1&&(e=t.split(n,1),e._t1=Xh.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=Xh.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]=Xh.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=rf(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]=Xh.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=Xh.makeline(h[2],d[0]),p=Xh.makeline(d[2],h[0]),m=[f,new e(d),p,new e(h)];return new Yh(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 Xh.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=Xh.makeline(v,p),b=Xh.makeline(m,g),k=[y].concat(a).concat([b]).concat(c);return new Yh(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=Xh.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=Jh(t.p1.x,t.p2.x),n=Jh(t.p1.y,t.p2.y),i=Zh(t.p1.x,t.p2.x),r=Zh(t.p1.y,t.p2.y);return Xh.roots(this.points,t).filter((t=>{var o=this.get(t);return Xh.between(o.x,e,i)&&Xh.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=Xh.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=Xh.dist(t,e),l=Xh.dist(t,o),c=Xh.dist(t,s);return Qh(l-a)+Qh(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=Xh.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*tf(a.e),y:a.y+a.r*ef(a.e)};a.e+=Xh.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 af={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 sf({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 sf(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 sf(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 lf{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{cf(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 cf(t,e,n){let i=t[e];t[e]=t[n],t[n]=i}function uf(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 df={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 lf(n,i);let o=[];for(let n=0;n<e;n++)o.push(uf(n/(e-1),r,t));return o}};function hf(t,e=256,n={}){return"bezier"===n.type?af.pointsToCurve(t,e,n):df.pointsToCurve(t,e)}const ff=[];for(let t=0;t<256;t++)ff[t]=t;class pf extends yh{constructor(t){const e={vertex:Oh,fragment:Ph},n={uniforms:yh.getUniformInfo(pf)};super(pf.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,hf(n,256).map((t=>255*t))):ff],this.uniforms[dh.STATIC_OPTIONS].set(e)}}function mf(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 vf extends yh{constructor(t){const e={vertex:Oh,fragment:Ph},n={uniforms:yh.getUniformInfo(vf)};super(vf.getFilterType(),e,n,t)}static getFilterType(){return"levels"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(t){let e=[...mf(t.black,t.white,t.gamma)];this.uniforms[dh.STATIC_OPTIONS].set(e)}}const gf=360,yf=[];for(let t=0;t<gf;t++)yf[t]=t;class bf extends yh{constructor(t){const e={uniforms:yh.getUniformInfo(bf)};super(bf.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 hf(t,gf,{type:"bezier"}).map((t=>{return e=t,((Math.round(e.x*gf)+180)%gf+(1-e.y-.5)*gf+gf)%gf;var e}))}(t.points)||yf;this.uniforms[dh.STATIC_OPTIONS].set(e)}}class kf extends yh{constructor(t){const e={uniforms:yh.getUniformInfo(kf)};super(kf.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[dh.STATIC_OPTIONS].set([e,n])}}class wf extends yh{constructor(t){const e={uniforms:yh.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}\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[dh.STATIC_OPTIONS].set([e,n,i,r])}}class xf extends yh{constructor(t){const e={uniforms:yh.getUniformInfo(xf)};super(xf.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[dh.STATIC_OPTIONS].set([e])}}class _f extends yh{constructor(t){const e={uniforms:yh.getUniformInfo(_f)};super(_f.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[dh.FIRST_TEXTURE,lh,ch]}handleStaticUniforms(t){let e={..._f.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[dh.STATIC_OPTIONS].set([n,i,r,o,s,a,l,c,h,f,d,u])}}class Tf extends yh{constructor(t){const e={uniforms:yh.getUniformInfo(Tf)};super(Tf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float staticOptions[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[dh.STATIC_OPTIONS].set([n,i,r,o])}}class Ef extends yh{constructor(t){const e={uniforms:yh.getUniformInfo(Ef)};super(Ef.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float 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 If extends yh{constructor(t){const e={uniforms:yh.getUniformInfo(If)};super(If.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_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[dh.STATIC_OPTIONS].set([e,n])}}class Sf extends yh{constructor(t){const e={uniforms:yh.getUniformInfo(Sf)};super(Sf.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[dh.STATIC_OPTIONS].set([e])}}var Af,Nf,Mf,Ff,Cf,Of,Pf,Rf;function Df(){if(Ff)return Mf;Ff=1;const t=Nf?Af:(Nf=1,Af={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"]}};Mf=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]},Mf}function Lf(){if(Of)return Cf;Of=1;const t=Df();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 Cf=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 Bf=function(){if(Rf)return Pf;Rf=1;const t=Df(),e=Lf(),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)}))})),Pf=n}(),zf=cu(Bf);class Wf extends yh{constructor(t){const e={uniforms:yh.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;\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=zf.hex.rgb(t.color).map((t=>t/255));this.uniforms[dh.STATIC_OPTIONS].set([e[0],e[1],e[2]])}}class jf extends yh{constructor(t){const e={uniforms:yh.getUniformInfo(jf)};super(jf.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[dh.STATIC_OPTIONS].set([e.from,e.to,...e.ease])}static getUniformList(){return[dh.FIRST_TEXTURE,uh]}}class Uf extends yh{constructor(t){const e={uniforms:yh.getUniformInfo(Uf)};super(Uf.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[dh.STATIC_OPTIONS].set([e.from,e.to,...e.ease])}static getUniformList(){return[dh.FIRST_TEXTURE,uh]}}class $f extends yh{constructor(t){const e={uniforms:yh.getUniformInfo($f)};super($f.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[dh.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[dh.FIRST_TEXTURE,uh]}}class qf extends yh{constructor(t){const e={uniforms:yh.getUniformInfo(qf)};super(qf.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[dh.STATIC_OPTIONS].set([e.from,e.to,...e.ease,n.x,n.y])}static getUniformList(){return[dh.FIRST_TEXTURE,uh,lh]}}class Vf extends yh{constructor(t){const e={uniforms:yh.getUniformInfo(Vf)};super(Vf.getFilterType(),{vertex:"precision lowp float;\n\nattribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nuniform float runtimeOptions[1];\nuniform float staticOptions[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=zf.hex.rgb(n).map((t=>t/255));this.uniforms[dh.STATIC_OPTIONS].set([e.from,e.to,...e.ease,i[0],i[1],i[2]])}static getUniformList(){return[dh.FIRST_TEXTURE,uh]}}var Gf=Object.freeze({__proto__:null,Crop:_f,Curves:pf,Default:class t extends yh{constructor(e){const n={uniforms:yh.getUniformInfo(t)};super(t.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}"},n,e)}static getFilterType(){return"__default"}static getInputsCount(){return 1}static getInitialOptions(){return{}}},DipToBlackTransition:Uf,DirectionalBlur:Ah,Exposure:Sf,ExposureTransition:jf,FadeToColorTransition:Vf,FastBlur:Sh,HardLight:Wf,HorizontalBlur:Eh,Hue:bf,Lab:If,Levels:vf,Lut:Ch,MotionBlurTransition:qf,Opacity:Nh,Saturation:xf,ShapeComposite:Fh,ShapeCompositeMask:Mh,Solid:Tf,SolidImage:Ef,Transform:Th,TransformTransition:$f,VerticalBlur:Ih,Vibrance:wf,WhiteBalance:kf});const Hf=Object.values(Gf).reduce(((t,e)=>(t[e.getFilterType()]=e,t)),{});class Kf{constructor(t){this.context=t}static getFilterClass(t){return Hf[t]}getFilterIds(){return Object.keys(this.filterTypeToInstanceMap)}create(t,e){this.context={...this.context,options:e.options};const n=new Hf[t](this.context);if(!n)throw new Error(`${t} is not a atom filter, atomFilter list: `,this.getFilterIds());return n}}const Xf=ud.PREVIOUS_OUTPUT_PREFIX,Yf=Object.values(Gf).reduce(((t,e)=>(t[e.getFilterType()]={type:e.getFilterType(),options:e.getInitialOptions(),inputs:[...Array(e.getInputsCount())].map(((t,e)=>`${Xf}${e}`)),outputs:[]},t)),{});var Qf,Jf,Zf=function(){if(Jf)return Qf;Jf=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)}),{})},Qf=s}(),tp=cu(Zf),ep=function(t,e){return tp(t,e,{arrayMerge:(t,e)=>e})};const np=ud.MESSAGES.UPDATE_OPTIONS;let ip=class{constructor(t,e){this.eventEmitter=new md,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(np,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 rp extends ip{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=ep(this.options,t),this.filter.updateStaticUniforms(this.options)}dispose(){this.filter.dispose()}}const op=ud.MESSAGES.UPDATE_OPTIONS;class sp extends rp{constructor(t,e,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}baseNodeUpdateOptions(t){this.options=ep(this.options,t),this.filter.updateStaticUniforms(this.options)}registerListeners(){this.baseNode.getEventEmitter().on(op,this.baseNodeUpdateOptions,this)}dispose(){this.filter.dispose(),this.baseNode.getEventEmitter().off(op,this.baseNodeUpdateOptions,this)}}function ap(t){return null!==t&&"object"==typeof t}function lp(t){if(!ap(t)||(e=t,Array.isArray(e)))return t;var e;const n=Object.keys(t).sort(),i={};return n.forEach((e=>{i[e]=lp(t[e])})),i}function cp(t,e){return null!=t&&t.id&&null!=e&&e.id?t.type===e.type&&t.id===e.id:t.type===e.type}function up(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)),ap(i=n)&&ap(r)?JSON.stringify(lp(i))===JSON.stringify(lp(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]&&cp(a,c[l])?l:c.findIndex((t=>cp(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 dp(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=_p.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 hp=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 dp(up(r,o),r,n,i)};class fp extends ip{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=>_p.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 wd(e),r="__PREVIOUS:0",o=[],s=new Set;this.nodes.forEach(((e,a)=>{const l={ioStore:t,graphIOManager:n},c=e.getOutputs?e.getOutputs():void 0,u=Array.isArray(c)?c:[],d={};u.forEach((e=>{d[e]=t.get(e)}));const h=t.get(r);i=e.render(l),a!==this.nodes.length-1&&o.push(i);const f=new Set;if(h&&h!==i&&f.add(h),u.forEach((t=>{const e=d[t];e&&e!==i&&f.add(e)})),f.size){const e=new Set(Object.values(t.get()));f.forEach((t=>{e.has(t)||(n.disposeTextures([t],i),s.add(t))}))}}));const a=o.filter((t=>!s.has(t)));n.disposeTextures(a,i)}return n.setOutputs(e,r,i),i}getOptionsDisplay(){return[]}_updateOptions(t){this.nodes=hp(t,this.options,this.nodes,this.context),this.options=t}dispose(){this.nodes.forEach((t=>{t.dispose()}))}}const pp=ud.MESSAGES.UPDATE_OPTIONS;class mp extends fp{constructor(t,e,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}registerListeners(){this.baseNode.getEventEmitter().on(pp,this.updateOptions,this)}dispose(){this.nodes.forEach((t=>{t.dispose()})),this.baseNode.getEventEmitter().off(pp,this.updateOptions,this)}}const vp=ud.SYSTEM_NODES.TAGS.ATOM,gp=ud.SYSTEM_NODES.TAGS.FILTER,yp=ud.SYSTEM_NODES.TAGS.COMPOSITE_FILTER,bp=ud.SYSTEM_NODES.TAGS.TRANSITION_FILTER,kp=ud.PREVIOUS_OUTPUT_PREFIX,wp=Object.keys(Yf);function xp(t,e){const n=(i=t.type,Yf[i]);var i;return t=ep(n,t),new rp(t.type,t,e)}var _p={create:function(t,e){let n;switch(function(t){let e;return n=t,e=wp.includes(n)?vp:t===yp?yp:t===bp?bp:gp,e;var n}((t=JSON.parse(JSON.stringify(t))).type)){case vp:n=xp(t,e);break;case gp: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=ep(r,t),e={...e,baseNode:n},o=i===yp?new mp(i,t,e):new sp(i,t,e),o}(t,e);break;case yp:n=function(t,e){const n=t.type;return t=ep({inputs:[`${kp}0`]},t),new fp(n,t,e)}(t,e);break;case bp: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`,xp(t,e)}(t,e);break;default:throw new Error("cant create node",t.type)}return n}};const Tp=ud.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS;var Ep=function(t){const e={[Tp]:Yf[Tp]};for(const[n,i]of Object.entries(e)){const e=_p.create(i,t);t.nodeStore.set(n,e)}},Ip=function(t,e){for(const[n,i]of Object.entries(t)){const t=_p.create(i,e);e.nodeStore.set(n,t)}};const Sp=ud.CAPTURED_FRAME_PREFIX;class Ap{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=`${Sp}${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 Np=Iu("ShaderGraphApplication","warn"),Mp=ud.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS,Fp=Object.freeze({useCanvasSizedFilterTargets:!1,rebindAttributesOnProgramSwitch:!0,forwardContextAttributes:!0});function Cp(t={}){const e=null==t?void 0:t.performanceToggles;return e&&"object"==typeof e?{...Fp,...e}:{...Fp}}class Op{constructor(t,e={}){return this.glSource=t,this.config=e,this.performanceToggles=Cp(e),this.isContextLost=!1,this.isRecovering=!1,this.isDisposed=!1,this.pendingNodeOptionUpdates=new Map,this.doInit(t,e)}doInit(t,e){this.source=bd(t),this.performanceToggles=Cp(e),this.isDisposed=!1,this.resetViewportSyncState(),this.render=this.render.bind(this),this.resizeCanvasSize=this.resizeCanvasSize.bind(this),this.setSrcVidTracks=this.setSrcVidTracks.bind(this),this.onWebGLContextLost=this.onWebGLContextLost.bind(this),this.onForceRender=this.onForceRender.bind(this),this.resizeCanvasSize._shouldPreventDefault=!0;const n=function(t={},e=Fp){const n=null!=t&&t.glOptions&&"object"==typeof t.glOptions?{...t.glOptions}:{},i=n.__shaderGraph&&"object"==typeof n.__shaderGraph?n.__shaderGraph:{};return{...n,__shaderGraph:{...i,forwardContextAttributes:!1!==e.forwardContextAttributes}}}(e,this.performanceToggles);return this.gl=this.source.init(this.setSrcVidTracks,this.resizeCanvasSize,n),this.addCanvasListeners(),this.addSourceListeners(),this.exposeDebugGlobalIfBrowser(),this.selectedRenderNode=null,this.setupRenderInfrastructure(t,e),e.userWillCallRender||(this.rafId=requestAnimationFrame(this.render)),this.dirtyCanvasSize=!0,{getNodes:this.getNodes.bind(this),addNodes:this.addClientNodes.bind(this),selectNode:this.selectNode.bind(this),addTexture:this.addTexture.bind(this),releaseTexture:this.releaseTexture.bind(this),captureTexture:this.captureTexture.bind(this),disposeTexture:this.disposeTexture.bind(this),updateOptions:this.updateOptions.bind(this),render:this.render,dispose:this.dispose.bind(this)}}exposeDebugGlobalIfBrowser(){"undefined"!=typeof window&&(window.ekoShaderGraph=this)}setupRenderInfrastructure(t,e){this.activeTextures=this.activeTextures||new Set,this.textureManager=new Nd({gl:this.gl,activeTextures:this.activeTextures}),this.capturedFramesManager=new Ap({textureManager:this.textureManager}),this.graphIOManager=new Ld({glSource:t,gl:this.gl,textureManager:this.textureManager,capturedFramesManager:this.capturedFramesManager}),this.frameBufferFactory=new qd({gl:this.gl,textureManager:this.textureManager,useCanvasSizedFilterTargets:this.performanceToggles.useCanvasSizedFilterTargets}),this.filterFactory=new Kf({gl:this.gl,frameBufferFactory:this.frameBufferFactory,rebindAttributesOnProgramSwitch:this.performanceToggles.rebindAttributesOnProgramSwitch}),this.nodeStore=new wd,this.ioStore=new wd,Ep({nodeStore:this.nodeStore,filterFactory:this.filterFactory}),this.addClientNodes(e.nodes,this.isRecovering)}getNodes(){return Np.debug("[getNodes]"),this.nodeStore.get()}addClientNodes(t,e=!1){if(Np.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));Ip(n,{nodeStore:this.nodeStore,filterFactory:this.filterFactory})}addTexture(t,e,n){if(Np.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){Np.debug("[releaseTexture]",t),this.isContextUnavailable()||this.textureManager.releaseTexture(t)}selectNode(t){if(Np.debug("[selectNode]",t),!this.isContextUnavailable())return this.nodeStore.get(t)||Np.warn("Missing render node",t),void(this.selectedRenderNodeId=t);this.selectedRenderNodeId=t}captureTexture(){return Np.debug("[captureTexture]"),this.isContextUnavailable()?null:this.capturedFramesManager.createCaptureId()}disposeTexture(t){return Np.debug("[disposeTexture]",t),this.isContextUnavailable()||"string"!=typeof t?null:this.capturedFramesManager.releaseCaptureId(t)}setSrcVidTracks(t){this.isContextUnavailable()||this.capturedFramesManager&&this.capturedFramesManager.capture(t)}resizeCanvasSize(t,e,n,i){this.dirtyCanvasSize={width:n,height:i}}resetViewportSyncState(){this._lastSyncedViewportCanvasWidth=null,this._lastSyncedViewportCanvasHeight=null}syncViewportToCanvasBackingStoreIfChanged(){var t,e;const n=null===(t=this.gl)||void 0===t||null===(t=t.canvas)||void 0===t?void 0:t.width,i=null===(e=this.gl)||void 0===e||null===(e=e.canvas)||void 0===e?void 0:e.height;!Number.isFinite(n)||!Number.isFinite(i)||n<=0||i<=0||n===this._lastSyncedViewportCanvasWidth&&i===this._lastSyncedViewportCanvasHeight||(jd(n,i),this.gl.viewport(0,0,n,i),this._lastSyncedViewportCanvasWidth=n,this._lastSyncedViewportCanvasHeight=i)}isContextUnavailable(){return!!this.isDisposed||!(!this.isRecovering&&!this.isContextLost)||!(!this.gl||"function"!=typeof this.gl.isContextLost)&&this.gl.isContextLost()}queueNodeOptionUpdate(t,e){t&&e&&"object"==typeof e&&(this.pendingNodeOptionUpdates||(this.pendingNodeOptionUpdates=new Map),this.pendingNodeOptionUpdates.set(t,e))}applyPendingNodeOptionUpdates(t=!1){if(!this.pendingNodeOptionUpdates||!this.pendingNodeOptionUpdates.size)return;const e=Array.from(this.pendingNodeOptionUpdates.entries());this.pendingNodeOptionUpdates.clear(),e.forEach((([e,n])=>{try{if(t){const t=this.nodeStore.get(e);if(!t||"function"!=typeof t.updateOptions)return void this.queueNodeOptionUpdate(e,n);try{t.updateOptions(n)}catch(t){Np.error("Failed to apply pending node options",e,t),this.queueNodeOptionUpdate(e,n)}return}this.updateOptions(e,n)}catch(t){Np.error("Failed to apply pending node options",e,t)}}))}render(t={}){const{noRaf:e=!1}=t;if(this.isContextUnavailable())return;if(this.dirtyCanvasSize){let{width:t=this.gl.canvas.width,height:e=this.gl.canvas.height}=this.dirtyCanvasSize;jd(t,e),this.gl.canvas.width=t,this.gl.canvas.height=e,this.textureManager.refreshTextureObjects(),this.gl.viewport(0,0,t,e),this.dirtyCanvasSize=!1,this._lastSyncedViewportCanvasWidth=t,this._lastSyncedViewportCanvasHeight=e}this.syncViewportToCanvasBackingStoreIfChanged(),this.graphIOManager.setVideoSources(this.ioStore);let n={ioStore:this.ioStore,graphIOManager:this.graphIOManager};this.renderSelectedNode(n),this.config.onPreRenderToScreen&&this.config.onPreRenderToScreen(),this.renderToCanvas(n),this.config.onPostRenderToScreen&&this.config.onPostRenderToScreen(),this.graphIOManager.disposeAllStore(this.ioStore),n=null,!e&&!this.config.userWillCallRender&&(this.rafId=requestAnimationFrame(this.render))}renderSelectedNode(t){if(!this.selectedRenderNodeId)return;const e=this.nodeStore.get(this.selectedRenderNodeId);e&&"function"==typeof e.render?e.render(t):(Np.warn("Missing selected render node",this.selectedRenderNodeId),this.selectedRenderNodeId=null)}renderToCanvas(t){const e=this.nodeStore.get(Mp);e&&"function"==typeof e.render?e.render(t):Np.warn("Missing render-to-canvas node")}updateOptions(t,e){if(Np.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){Np.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(){Np.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),Np.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=>{Np.debug("Re-adding client nodes",t),this.addClientNodes(t,!0)})),Object.entries(e).forEach((([t,e])=>{Np.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&&(Np.debug("Recovering glSource (i.e. seeking/resetting player)"),await this.source.recover()),this.isContextLost=!1,this.isRecovering=!1,o&&this.render()}catch(t){Np.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 Pp{constructor(t={}){this.options=t}get type(){return"stage"}getSignature(){return this.type}build({inputs:t=[]}={}){return{graph:[],outputs:t,signature:this.getSignature()}}}function Rp(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 Dp extends Pp{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:Rp(a)}),o.push(l)}return{graph:r,outputs:o,signature:this.getSignature()}}}class Lp{#E=new Map;constructor(){this.register("retarget",Dp)}register(t,e){t&&"function"==typeof e&&this.#E.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.#E.get(e);return n?new n((null==t?void 0:t.options)||{}):null}}class Bp{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 zp extends Bp{#I=null;#S=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=zp.buildLayoutGraph({inputs:t}),r=e.signature;this.#I!==r&&(i.updateOptions(o,{graph:e.graph}),this.#I=r),this.#S!==o&&(i.selectNode(o),this.#S=o),i.render({noRaf:!0})}catch(t){}}}function Wp(t){const e=Number(t);return Number.isFinite(e)?e<=0?0:e>=1?1:e:0}class jp extends Bp{#I=null;#S=null;#A=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=Wp(e),i=[{type:"opacity",inputs:[t[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",t[0]],options:{}}];return{type:jp.type,signature:`${jp.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=Wp((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.#I!==e){const n=jp.buildLayoutGraph({inputs:["__SRC_TEXTURE:0"]});i.updateOptions(t,{graph:n.graph}),this.#I=e}this.#S!==t&&(i.selectNode(t),this.#S=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=jp.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.#I===r&&this.#A===a||(i.updateOptions(o,{graph:n.graph}),this.#I=r,this.#A=a),this.#S!==o&&(i.selectNode(o),this.#S=o),i.render({noRaf:!0})}catch(t){}}}function Up(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 $p(t){return!(!t||!0===t.offsetPending)&&Number.isFinite(t.offset)}function qp(t){return $p(t)?t.offset:void 0}function Vp(t,e,n,i={}){if(!t)return!1;const r=qp(t);if(!Number.isFinite(r))return!1;const o=Up(t,n,i);return Number.isFinite(o)?e>=r&&e<r+o:e>=r}function Gp(t=[]){if(!Array.isArray(t))return t;const e=[],n=[];return t.forEach((t=>{$p(t)?e.push(t):n.push(t)})),e.sort(((t,e)=>t.offset-e.offset)),t.splice(0,t.length,...e,...n),t}function Hp(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=qp(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&&Gp(t),{updated:a,resolvedPlacements:l}}function Kp(t){const e=Number(t);return Number.isFinite(e)?e:0}function Xp(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 Yp(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 Qp(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 Jp(t){const e=Number(t);return Number.isFinite(e)&&e>0?e:0}function Zp(t){return(null==t?void 0:t.id)||(null==t?void 0:t.nodeId)||null}function tm(t,e){return Array.isArray(t)&&e?t.findIndex((t=>Zp(t)===e)):-1}function em(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=tm(e,n);return t>=0?(t+1)%i:0}if("prev"===t){const t=tm(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)?Zp(e[i]):null}function nm(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=qp(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)=>qp(t)-qp(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 im(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 rm(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 om(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(im(n,r,t))return r}return null}function sm(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 am extends Bp{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=Wp(e),i=[{type:"opacity",inputs:[t[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",t[0]],options:{}}];return{type:am.type,signature:`${am.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:Wp(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&&(sm(a),a.activeRenderPlacementId=l);const c=null==r?void 0:r.initSwitching,u=nm(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=rm(a.placements,a.selectedPlacementId),i=em(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=em(Number.isInteger(t)&&t>=0?t:0,a.nodes,null);let n=null;if(e&&(n=om(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&&im(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=om(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=Jp(a.pendingSwitch.crossfadeSeconds),s=Jp(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=Wp(t/a.switchDuration))}a.switchNormalizedTime=Number.isFinite(p)?p:void 0;const m=rm(a.placements,a.selectedPlacementId),v=im(s,a.selectedPlacementId,m)||s[0];let g=null;if(Number.isFinite(a.switchNormalizedTime)&&a.previousPlacementId){const t=rm(a.placements,a.previousPlacementId),e=rm(a.placements,a.selectedPlacementId),n=im(s,a.previousPlacementId,t),i=im(s,a.selectedPlacementId,e);n&&i&&(g=[n,i])}return g||(g=v?[v]:s),g}static resetRenderState(t){t&&"object"==typeof t&&sm(t)}}const lm=.5,cm="auto";function um(t){return"vertical"===t?"vertical":"horizontal"}function dm(t){return void 0===t||t===cm?cm:"manual"}function hm(t){const e=Number(t);return Number.isFinite(e)&&e>=0?e:.004}function fm(t,e){const n=Number(null==t?void 0:t.width),i=Number(null==t?void 0:t.height);return Number.isFinite(n)&&Number.isFinite(i)&&n>0&&i>0?i>n?"vertical":"horizontal":um(e)}function pm(t,e){const n=e&&"object"==typeof e&&e.runtimeParams&&"object"==typeof e.runtimeParams?e.runtimeParams:{},i=Object.prototype.hasOwnProperty.call(n,"orientationMode")?n.orientationMode:null==t?void 0:t.orientationMode,r=Object.prototype.hasOwnProperty.call(n,"orientation")?n.orientation:null==t?void 0:t.orientation,o=Object.prototype.hasOwnProperty.call(n,"gap")?n.gap:null==t?void 0:t.gap,s=dm(i);return{orientationMode:s,orientation:s===cm?fm(null==e?void 0:e.viewportSize,r):um(r),gap:hm(o)}}function mm(t){t&&"object"==typeof t&&(t.activeRenderPlacementId=null,t.frames=null,t.gridInitialized=!1,t.runtimeParams=null,t.setGridParams=null)}class vm extends Bp{static get type(){return"grid"}static get aliases(){return["GridRenderNode","grid","SideBySideRenderNode","side-by-side","sidebyside"]}static get requiresFrameCadence(){return!1}static get panAndScanTarget(){return"skip"}static resolvePanAndScanTarget({frameCount:t}={}){return t<2?"pre":vm.panAndScanTarget}static buildLayoutGraph({inputs:t=[],renderNodeParams:e,state:n}={}){const i=Array.isArray(t)?t.slice(0,12):[],r=i.length;if(r<2)return super.buildDefaultLayoutGraph(i);const{orientation:o,gap:s}=pm(e,n),{rows:a,cols:l}=(p=o,(f=r)<=3?"vertical"===p?{rows:f,cols:1}:{rows:1,cols:f}:4===f?{rows:2,cols:2}:f<=6?"vertical"===p?{rows:3,cols:2}:{rows:2,cols:3}:f<=8?"vertical"===p?{rows:4,cols:2}:{rows:2,cols:4}:9===f?{rows:3,cols:3}:"vertical"===p?{rows:4,cols:3}:{rows:3,cols:4}),c=1/a,u=Math.max(0,c-s),d=[],h="grid-slice";var f,p;function m(t){const e=Math.floor(t/l),n=function(t,e,n,i){const r=(e-1)*n;return t===e-1&&i>r?i-r:n}(e,a,l,r),i=n<l?t-e*l:t%l,o=1/n;return{row:e,cellWidth:o,cropWidth:Math.max(0,o-s),targetCenterX:(i+lm)*o,targetCenterY:(e+lm)*c}}function v(t,e,n){const i=m(t);return{id:`grid-crop-${t}`,type:"crop",inputs:[e],outputs:[n],options:{source:{center:{x:lm,y:lm},width:1,height:1},target:{center:{x:i.targetCenterX,y:i.targetCenterY},width:i.cropWidth,height:u},fitType:"fill",cornerRadius:0,edgeSoftness:0}}}function g(t){const e=m(t);return{id:`grid-mask-${t}`,type:"shapeCompositeMask",inputs:[h,"accum"],outputs:["accum"],options:{type:"box",center:{x:2*e.targetCenterX-1,y:1-2*e.targetCenterY},area:{width:e.cellWidth,height:c},radius:0,edgeSoftness:0}}}d.push(v(0,i[0],"accum"));for(let t=1;t<r;t+=1)d.push(v(t,i[t],h)),d.push(g(t));return{type:vm.type,signature:`${vm.type}:${r}:${a}x${l}:${o}:${s}`,isDynamic:!1,graph:d}}static prepareRenderFrames({frames:t,renderNodeParams:e,active:n,state:i}={}){const r=Array.isArray(t)?t.slice(0,12):[],o=i&&"object"==typeof i?i:{},s=null==n?void 0:n.renderPlacementId;s&&o.activeRenderPlacementId!==s&&(mm(o),o.activeRenderPlacementId=s);const a=Array.isArray(o.frames)?o.frames:[],l=null==e?void 0:e.initGrid;if("function"==typeof l&&(o.setGridParams||(o.setGridParams=t=>{!function(t,e){if(!t||"object"!=typeof t||!e||"object"!=typeof e)return;const n=t.runtimeParams&&"object"==typeof t.runtimeParams?{...t.runtimeParams}:{};Object.prototype.hasOwnProperty.call(e,"orientationMode")&&(n.orientationMode=dm(e.orientationMode)),Object.prototype.hasOwnProperty.call(e,"orientation")&&(n.orientation=um(e.orientation)),Object.prototype.hasOwnProperty.call(e,"gap")&&(n.gap=hm(e.gap)),t.runtimeParams=n}(o,t),"function"==typeof o.requestRender&&o.requestRender()}),!o.gridInitialized)){o.gridInitialized=!0;const t=pm(e,o);try{l({orientationMode:t.orientationMode,orientation:t.orientation,gap:t.gap,setGridParams:o.setGridParams})}catch(t){}}if(r.length<2){const t=function(t,e){if(!Array.isArray(e)||e.length<2)return t.length?[t[t.length-1]]:[];const n=Math.min(12,Math.max(t.length,e.length,2)),i=t[0]||e[0];return Array.from({length:n},((n,r)=>t[r]||e[r]||i))}(r,a);return o.frames=t,t}return o.frames=r,r}static resetRenderState(t){mm(t)}}const gm=[zp,jp,am,vm],ym=new Map;function bm(t){if("string"!=typeof t)return null;const e=t.trim();return e?e.toLowerCase():null}function km(t){const e=bm(t);return e&&ym.get(e)||null}function wm(t){return km(t)||zp}gm.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=bm(e);n&&ym.set(n,t)}))}(t)));class xm{static get defaultType(){return zp.type||"default"}static getRenderNodeClass(t){return km(t)}static normalizeType(t){const e=km(t);return e?e.type:null}static doesRenderNodeTypeRequireFrameCadence(t){const e=km(t);return!!e&&!0===e.requiresFrameCadence}static buildLayoutGraph({type:t,inputs:e=[],normalizedTime:n,renderNodeParams:i,state:r}={}){const o=wm(t);return o&&"function"==typeof o.buildLayoutGraph?o.buildLayoutGraph({inputs:e,normalizedTime:n,renderNodeParams:i,state:r}):zp.buildLayoutGraph({inputs:e,normalizedTime:n,renderNodeParams:i,state:r})}static getPanAndScanTarget(t,e={}){const n=wm(t);return"post"===(i=n&&"function"==typeof n.resolvePanAndScanTarget?n.resolvePanAndScanTarget(e):null==n?void 0:n.panAndScanTarget)||"skip"===i?i:"pre";var i}static prepareRenderFrames({type:t,frames:e,timelineTime:n,timeline:i,active:r,renderNodeParams:o,state:s}={}){const a=wm(t);if(a&&"function"==typeof a.prepareRenderFrames){const t=a.prepareRenderFrames({frames:e,timelineTime:n,timeline:i,active:r,renderNodeParams:o,state:s});if(Array.isArray(t))return t}return Array.isArray(e)?e:[]}static getRenderTiming({type:t,timing:e,timelineTime:n,active:i,renderNodeParams:r,state:o}={}){const s=wm(t),a=e&&"object"==typeof e?e:{};if(s&&"function"==typeof s.getRenderTiming){const t=s.getRenderTiming({timing:a,timelineTime:n,active:i,renderNodeParams:r,state:o});if(t&&"object"==typeof t)return{...a,...t}}return a}static resetRenderState(t,e){const n=wm(t);n&&"function"==typeof n.resetRenderState&&n.resetRenderState(e)}static resetAllRenderStates(t){t&&"function"==typeof t.forEach&&t.forEach(((t,e)=>{xm.resetRenderState(e,t)}))}create(t,e){return t&&"function"==typeof t.render?t:new(wm(t))(e)}}function _m(t){return Array.isArray(t)?t.filter((t=>t&&"string"==typeof t.type)):[]}function Tm(t,e){return t&&"function"==typeof t.getSignature?t.getSignature():(null==e?void 0:e.type)||"stage"}class Em{#N;constructor(t){this.#N=t||new Lp}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=xm.normalizeType(null==t?void 0:t.layoutType)||xm.defaultType,r=null==t?void 0:t.normalizedTime,o=_m(null==t?void 0:t.preStages),s=_m(null==t?void 0:t.postStages),a=[],l=[`layout:${i}`,`inputs:${e}`];let c=n;o.forEach(((e,n)=>{const i=this.#N.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(Tm(i,e))}));const u=xm.buildLayoutGraph({type:i,inputs:c,normalizedTime:r,renderNodeParams:null==t?void 0:t.renderNodeParams,state:null==t?void 0:t.renderNodeState}),d=!(null==u||!u.isDynamic);Array.isArray(null==u?void 0:u.graph)&&u.graph.length&&a.push(...u.graph),l.push((null==u?void 0:u.signature)||`${i}:${c.length}`);let h="__PREVIOUS:0";return s.forEach(((e,n)=>{const i=this.#N.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(Tm(i,e))})),{graph:a,signature:l.join("|"),isDynamic:d}}}const Im=[0,0,1,1],Sm="zoomInExposure",Am=["transform","exposure","fadeToColor","dipToBlack"],Nm={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 Fm(t,e=Im){return Array.isArray(t)&&t.length>=4?t:e}function Cm(t){return"string"==typeof t&&t.trim()?t.trim():"#ffffff"}function Om(t,e){const n=null==t?void 0:t[e];return!1===n||null==n?null:Au(n)?n:{}}function Pm(t={}){let e=0;return Am.forEach((n=>{const i=Om(t,n);if(!i)return;const r=Mm(null==i?void 0:i.duration);r>e&&(e=r)})),e}function Rm(t,e,n,i,r){const o=[];return Am.forEach((s=>{const a=Om(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=Fm(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=Fm(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=Cm((null==e?void 0:e.color)||r),o}if("exposure"===t||"dipToBlack"===t){const t=Fm(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 Dm(t=[]){const e=t.map((t=>{const e=JSON.parse(JSON.stringify(t));return null!=e&&e.options&&(e.options.startTime=0),e}));return JSON.stringify(e)}class Lm{#M=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(Au(null==t?void 0:t.transition))return t.transition;if("string"==typeof(null==t?void 0:t.transition))return Nm[t.transition]||Nm[Sm];if(Au(null==t?void 0:t.filters)||Au(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 Nm[Sm]}(t),n=Nu({},(null==e?void 0:e.filters)||{},Au(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(Au(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=Nu({},(null==e?void 0:e.reverseFilters)||{},Au(null==t?void 0:t.reverseFilters)?t.reverseFilters:{});return{baseFilters:n,reverseFilters:Nu({},i,r)}}(t),r=Mm(null==t?void 0:t.duration),o=r>0?1e3*r:null,s=Pm(n),a=Pm(i),l=o&&s>0?o/s:1,c=o&&a>0?o/a:1,u=o||s||500,d=o||a||u,h=Cm(null==t?void 0:t.color),f=e.captureTexture(),p=Date.now(),m=Rm(n,p,l,o,h);return this.#M={phase:"out",startTime:p,outDurationMs:u,inDurationMs:d,color:h,captureId:f,baseFilters:n,reverseFilters:i,outScale:l,inScale:c,durationOverrideMs:o,outGraph:m,outSignature:Dm(m),inGraph:null,inSignature:null},{captureId:f,outDurationMs:u,inDurationMs:d}}beginIncoming(){if(!this.#M)return;const t=Date.now(),e=Rm(this.#M.reverseFilters,t,this.#M.inScale,this.#M.durationOverrideMs,this.#M.color);this.#M={...this.#M,phase:"in",startTime:t,inGraph:e,inSignature:Dm(e)}}reset(t){var e;t&&"function"==typeof t.disposeTexture&&null!==(e=this.#M)&&void 0!==e&&e.captureId&&t.disposeTexture(this.#M.captureId),this.#M=null}getState(){return this.#M}buildOutgoingGraph(){const t=this.#M;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.#M;return t&&"in"===t.phase&&Array.isArray(t.inGraph)&&t.inGraph.length?{signature:`transition:in:${t.inSignature||""}`,forceUpdate:!1,graph:t.inGraph}:null}}let Bm;const zm=[/firefox\/(\d+)/,/edg\/(\d+)/,/opr\/(\d+)/,/chrome\/(\d+)/];function Wm(){const t=Du&&Du.navigator&&(Du.navigator.userAgent||Du.navigator.platform||Du.navigator.vendor)||"";if(Bm&&Bm.ua===t)return Bm;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<zm.length;e+=1){const n=zm[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 Bm={ua:t,lowerUA:e,isAndroid:n,isiOS:i,isMobile:r,isDesktop:o,isFirefox:s,browserMajorVersion:a},Bm}function jm(){return Wm().ua}function Um(){return Wm().isAndroid}function $m(){return Wm().isiOS}function qm(){return Wm().isMobile}function Vm(){return Wm().isDesktop}function Gm(){return Wm().isFirefox}function Hm(){return Wm().browserMajorVersion}var Km={getUserAgent:jm,isAndroid:Um,isiOS:$m,isMobile:qm,isDesktop:Vm,isFirefox:Gm,getBrowserMajorVersion:Hm},Xm=Object.freeze({__proto__:null,default:Km,getBrowserMajorVersion:Hm,getUserAgent:jm,isAndroid:Um,isDesktop:Vm,isFirefox:Gm,isMobile:qm,isiOS:$m});const Ym="Idle",Qm="Playing",Jm="FirstFramePending",Zm="Waiting",tv="Paused",ev="Seeking",nv="Resetting";function iv(t){return Array.isArray(t)?t.filter((t=>t&&"string"==typeof t.type)):[]}function rv(t,e){return!!Array.isArray(t)&&t.some((t=>(null==t?void 0:t.type)===e))}function ov(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 sv(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 av=2073600;function lv(t,e){const n=Number(t);return Number.isFinite(n)&&n>0?n:e}function cv(t,e){if(null==t)return e;const n=Number(t);return Number.isFinite(n)?n:e}var 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,wv=new WeakMap,xv=new WeakMap,_v=new WeakMap,Tv=new WeakMap,Ev=new WeakMap,Iv=new WeakMap,Sv=new WeakMap,Av=new WeakMap,Nv=new WeakMap,Mv=new WeakMap,Fv=new WeakMap,Cv=new WeakMap,Ov=new WeakMap,Pv=new WeakMap,Rv=new WeakMap,Dv=new WeakMap,Lv=new WeakMap,Bv=new WeakMap,zv=new WeakMap,Wv=new WeakMap,jv=new WeakMap,Uv=new WeakMap,$v=new WeakMap,qv=new WeakSet;class Vv extends Ou{static get pipelineNodeId(){return"ekoplayer-render-pipeline"}get defaults(){return{defaultRenderParams:void 0,resourceLimits:{enabled:!0,maxCanvasPixels:av,maxDevicePixelRatio:0,renderScale:1,transitionMinFrameIntervalMs:33}}}constructor(...t){super(...t),O(this,qv),F(this,uv,void 0),F(this,dv,void 0),F(this,hv,void 0),F(this,fv,void 0),F(this,pv,void 0),F(this,mv,void 0),F(this,vv,void 0),F(this,gv,void 0),F(this,yv,void 0),F(this,bv,void 0),F(this,kv,void 0),F(this,wv,void 0),F(this,xv,null),F(this,_v,null),F(this,Tv,void 0),F(this,Ev,void 0),F(this,Iv,void 0),F(this,Sv,[]),F(this,Av,[]),F(this,Nv,null),F(this,Mv,null),F(this,Fv,null),F(this,Cv,null),F(this,Ov,null),F(this,Pv,null),F(this,Rv,new Map),F(this,Dv,null),F(this,Lv,null),F(this,Bv,!1),F(this,zv,!1),F(this,Wv,!1),F(this,jv,!1),F(this,Uv,[]),F(this,$v,null);const[e,n,i]=t;C(uv,this,e),C(dv,this,n),C(hv,this,i),M(uv,this)&&"function"==typeof M(uv,this).enableFirstFrameRenderedGate&&M(uv,this).enableFirstFrameRenderedGate(),C(wv,this,new Em),C(Tv,this,new Lm),C(Ev,this,null),C(Iv,this,null),C(Fv,this,null),C(fv,this,(t=>A(qv,this,Mg).call(this,t))),M(uv,this)&&"function"==typeof M(uv,this).on&&(M(uv,this).on(Bu.VISUAL_FRAMES_AVAILABLE,M(fv,this)),C(pv,this,(()=>{var t,e,n,i;A(qv,this,Yv).call(this),A(qv,this,Eg).call(this,0),C(Av,this,[]),C(Nv,this,null),C(xv,this,null),C(_v,this,null),A(qv,this,mg).call(this),C(Dv,this,null);(null===(t=M(Tv,this))||void 0===t||null===(e=t.getState)||void 0===e?void 0:e.call(t))||null===(n=M(Tv,this))||void 0===n||null===(i=n.reset)||void 0===i||i.call(n,M(Ev,this))})),M(uv,this).on(Bu.TIMELINE_SEEKING,M(pv,this)),C(mv,this,((t={})=>{"switch"===(null==t?void 0:t.reason)||"reset"===(null==t?void 0:t.reason)?A(qv,this,Hv).call(this):A(qv,this,Gv).call(this),A(qv,this,Qv).call(this)})),M(uv,this).on(Bu.TIMELINE_RESET,M(mv,this)),C(yv,this,(()=>A(qv,this,bg).call(this))),M(uv,this).on(Bu.TIMELINE_TIME_UPDATE,M(yv,this)),C(vv,this,(()=>{A(qv,this,Fg).call(this)&&M(Mv,this)&&A(qv,this,Mg).call(this,M(Mv,this))})),M(uv,this).on(Bu.TIMELINE_STATE_CHANGE,M(vv,this))),M(dv,this)&&"function"==typeof M(dv,this).on&&(C(bv,this,(()=>{const t=M(Mv,this);C(jv,this,!0),A(qv,this,Gv).call(this),C(Mv,this,t)})),M(dv,this).on(Bu.CANVAS_WEBGL_CONTEXT_LOST,M(bv,this)),C(kv,this,(()=>{var t;const e=null===(t=M(dv,this))||void 0===t?void 0:t.gl;if(!e||"function"==typeof e.isContextLost&&e.isContextLost())return void C(jv,this,!0);const n=M(Mv,this);C(jv,this,!1),A(qv,this,Gv).call(this),C(Mv,this,n),n&&A(qv,this,Fg).call(this)&&A(qv,this,Mg).call(this,n)})),M(dv,this).on(Bu.CANVAS_WEBGL_CONTEXT_RESTORED,M(kv,this))),C(gv,this,(()=>{C(Nv,this,null),M(Mv,this)&&A(qv,this,Fg).call(this)&&A(qv,this,Mg).call(this,M(Mv,this))})),M(hv,this)&&"function"==typeof M(hv,this).on&&M(hv,this).on(Bu.CONTAINER_RESIZE,M(gv,this))}get name(){return"Renderer"}onDispose(){M(uv,this)&&M(fv,this)&&"function"==typeof M(uv,this).off&&M(uv,this).off(Bu.VISUAL_FRAMES_AVAILABLE,M(fv,this)),M(uv,this)&&M(pv,this)&&"function"==typeof M(uv,this).off&&M(uv,this).off(Bu.TIMELINE_SEEKING,M(pv,this)),M(uv,this)&&M(mv,this)&&"function"==typeof M(uv,this).off&&M(uv,this).off(Bu.TIMELINE_RESET,M(mv,this)),M(uv,this)&&M(yv,this)&&"function"==typeof M(uv,this).off&&M(uv,this).off(Bu.TIMELINE_TIME_UPDATE,M(yv,this)),M(uv,this)&&M(vv,this)&&"function"==typeof M(uv,this).off&&M(uv,this).off(Bu.TIMELINE_STATE_CHANGE,M(vv,this)),M(hv,this)&&M(gv,this)&&"function"==typeof M(hv,this).off&&M(hv,this).off(Bu.CONTAINER_RESIZE,M(gv,this)),M(dv,this)&&M(bv,this)&&"function"==typeof M(dv,this).off&&M(dv,this).off(Bu.CANVAS_WEBGL_CONTEXT_LOST,M(bv,this)),M(dv,this)&&M(kv,this)&&"function"==typeof M(dv,this).off&&M(dv,this).off(Bu.CANVAS_WEBGL_CONTEXT_RESTORED,M(kv,this)),A(qv,this,Gv).call(this),C(fv,this,null),C(pv,this,null),C(mv,this,null),C(yv,this,null),C(vv,this,null),C(gv,this,null),C(bv,this,null),C(kv,this,null),C(wv,this,null),C(Tv,this,null),C(Rv,this,null),C(Dv,this,null),C(dv,this,null),C(hv,this,null),C(uv,this,null)}startTransition(t={}){var e,n;const i=null===(e=M(dv,this))||void 0===e?void 0:e.element,r=null===(n=M(dv,this))||void 0===n?void 0:n.gl;if(!i||!r)return null;if(M(jv,this)||"function"==typeof r.isContextLost&&r.isContextLost())return C(jv,this,!0),null;if(A(qv,this,Zv).call(this,i),!M(Ev,this))return null;const o=M(Tv,this).start({shaderGraph:M(Ev,this),duration:null==t?void 0:t.duration,filter:null==t?void 0:t.filter,color:null==t?void 0:t.color,filters:null==t?void 0:t.filters,reverseFilters:null==t?void 0:t.reverseFilters,transition:null==t?void 0:t.transition});return C(Fv,this,M(Mv,this)||null),A(qv,this,Sg).call(this),o}beginTransitionIn(t={}){var e,n;null!==(e=M(Tv,this))&&void 0!==e&&null!==(n=e.beginIncoming)&&void 0!==n&&n.call(e,t),C(Fv,this,null),A(qv,this,Sg).call(this)}resetTransition(){var t,e;null!==(t=M(Tv,this))&&void 0!==t&&null!==(e=t.reset)&&void 0!==e&&e.call(t,M(Ev,this)),C(Fv,this,null),A(qv,this,Ag).call(this)}}function Gv(){if(A(qv,this,Yv).call(this),M(Tv,this)&&"function"==typeof M(Tv,this).reset&&M(Tv,this).reset(M(Ev,this)),A(qv,this,Eg).call(this,0),M(Ev,this)&&"function"==typeof M(Ev,this).dispose)try{M(Ev,this).dispose()}catch(t){}C(Ev,this,null),C(Iv,this,null),C(Sv,this,[]),C(Av,this,[]),C(Bv,this,!1),C(Nv,this,null),C(xv,this,null),C(_v,this,null),C(Mv,this,null),C(Fv,this,null),A(qv,this,Ag).call(this),A(qv,this,mg).call(this),C(Dv,this,null)}function Hv(){A(qv,this,Yv).call(this),M(Tv,this)&&"function"==typeof M(Tv,this).reset&&M(Tv,this).reset(M(Ev,this)),A(qv,this,Eg).call(this,0),C(Sv,this,[]),C(Av,this,[]),C(Nv,this,null),C(xv,this,null),C(_v,this,null),C(Mv,this,null),C(Fv,this,null),A(qv,this,Ag).call(this),A(qv,this,mg).call(this),C(Dv,this,null),C(Lv,this,null)}function Kv(){const t="function"==typeof Du.requestAnimationFrame?Du.requestAnimationFrame.bind(Du):null,e="function"==typeof Du.cancelAnimationFrame?Du.cancelAnimationFrame.bind(Du):null;return t?{schedule:e=>t(e),cancel(t){"number"==typeof t&&e&&e(t)}}:null}function Xv(t){C(Uv,this,M(Uv,this).filter((e=>e!==t))),M(Uv,this).length||C($v,this,null)}function Yv(){M($v,this)&&M(Uv,this).forEach((t=>M($v,this).call(this,t))),C(Uv,this,[]),C($v,this,null),C(Wv,this,!1)}function Qv(){A(qv,this,Yv).call(this),C(zv,this,!1)}function Jv(){if(M(zv,this)||M(Wv,this))return;const t=A(qv,this,Kv).call(this);if(!t)return;const{schedule:e,cancel:n}=t;let i;C($v,this,n),C(Wv,this,!0),i=e((()=>{let t;A(qv,this,Xv).call(this,i),t=e((()=>{A(qv,this,Xv).call(this,t),C(Wv,this,!1),M(zv,this)||(C(zv,this,!0),M(uv,this)&&"function"==typeof M(uv,this).notifyFirstFrameRendered&&M(uv,this).notifyFirstFrameRendered())})),M(Uv,this).push(t)})),M(Uv,this).push(i)}function Zv(t){if(M(Ev,this)||!t)return;const e=this,n={dest:t,src:(t,n)=>{C(Iv,e,n)}};C(Ev,e,new Op(n,{userWillCallRender:!0,glOptions:{contextType:"webgl2"},performanceToggles:{useCanvasSizedFilterTargets:!0}})),M(Ev,e)&&"function"==typeof M(Ev,e).addNodes&&M(Ev,e).addNodes({[oe.pipelineNodeId]:{type:"composite",options:{graph:[]}}})}function tg(t){var e;if("null"===(null==t?void 0:t.message))return!0;const n=null===(e=M(dv,this))||void 0===e?void 0:e.gl;return!(!n||"function"!=typeof n.isContextLost||!n.isContextLost())}function eg(t,e,n){const i=e||M(Mv,this)||null;if(A(qv,this,Gv).call(this),C(Mv,this,i),!n)return this.log.warn("Shader graph render failed; rebuilding graph once.",t),void A(qv,this,Mg).call(this,i,!0);this.log.warn("Shader graph render is still unavailable after rebuild; deferring until the next render pass.",t)}function ng(){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 ig(){const t=A(qv,this,ng).call(this).enabled;return!0===t||!1!==t&&$m()}function rg(){if(!A(qv,this,ig).call(this))return 0;const t=cv(A(qv,this,ng).call(this).transitionMinFrameIntervalMs,33);return Number.isFinite(t)&&t>0?t:0}function og(t,e,n={}){const i=!0===(null==n?void 0:n.useDevicePixelRatio),r=A(qv,this,ig).call(this),o=i?lv(null==Du?void 0:Du.devicePixelRatio,1):1;let s=o,a=0;if(r){const t=A(qv,this,ng).call(this);a=cv(t.maxCanvasPixels,av);const e=cv(t.maxDevicePixelRatio,0);s=lv(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 sg(t=[],e={}){var n;const i=null===(n=M(dv,this))||void 0===n?void 0:n.element,r=M(Iv,this);if(!i||"function"!=typeof r)return!1;let o=0,s=0;const a=!0===(null==e?void 0:e.useViewportSize);if(a){var l,c,u,d,h,f;const t=Number(null!==(l=null===(c=M(hv,this))||void 0===c?void 0:c.containerWidth)&&void 0!==l?l:null===(u=M(hv,this))||void 0===u?void 0:u.width),e=Number(null!==(d=null===(h=M(hv,this))||void 0===h?void 0:h.containerHeight)&&void 0!==d?d:null===(f=M(hv,this))||void 0===f?void 0:f.height);if(Number.isFinite(t)&&Number.isFinite(e)&&t>0&&e>0)o=Math.round(t),s=Math.round(e);else{const t=Number(i.clientWidth),e=Number(i.clientHeight);Number.isFinite(t)&&Number.isFinite(e)&&t>0&&e>0&&(o=Math.round(t),s=Math.round(e))}}if(!(o>0&&s>0)){if(!Array.isArray(t)||!t.length)return;for(let e=0;e<t.length;e+=1){var p;const n=null===(p=t[e])||void 0===p?void 0:p.frame,i=Number((null==n?void 0:n.displayWidth)||(null==n?void 0:n.codedWidth)||(null==n?void 0:n.videoWidth)||(null==n?void 0:n.naturalWidth)||(null==n?void 0:n.width)),r=Number((null==n?void 0:n.displayHeight)||(null==n?void 0:n.codedHeight)||(null==n?void 0:n.videoHeight)||(null==n?void 0:n.naturalHeight)||(null==n?void 0:n.height));!Number.isFinite(i)||!Number.isFinite(r)||i<=0||r<=0||(i>o&&(o=i),r>s&&(s=r))}}if(!(o>0&&s>0))return!1;const m=A(qv,this,og).call(this,o,s,{useDevicePixelRatio:a}),v=m.width,g=m.height,y=M(Nv,this);return!(y&&y.width===v&&y.height===g||(C(Nv,this,{width:v,height:g}),r(null,null,v,g),0))}function ag(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 lg(t,e,n){const i=Number.isFinite(null==t?void 0:t.duration)&&t.duration>0?t.duration:void 0;let r;if(i&&Number.isFinite(null==t?void 0:t.offset)){const n=(e-t.offset)/i;r=n<0?0:n>1?1:n}const o=A(qv,this,cg).call(this,t),s=A(qv,this,ug).call(this,o);return xm.getRenderTiming({type:o,timing:{duration:i,normalizedTime:r},timelineTime:e,active:t,renderNodeParams:n,state:s})}function cg(t){return xm.normalizeType(null==t?void 0:t.type)||xm.defaultType}function ug(t){if(!t||!M(Rv,this))return null;let e=M(Rv,this).get(t);return e||(e={},M(Rv,this).set(t,e)),e}function dg(){var t,e,n,i,r,o,s,a,l,c,u;const d=Number(null!==(t=null===(e=M(hv,this))||void 0===e?void 0:e.containerWidth)&&void 0!==t?t:null===(n=M(hv,this))||void 0===n?void 0:n.width),h=Number(null!==(i=null===(r=M(hv,this))||void 0===r?void 0:r.containerHeight)&&void 0!==i?i:null===(o=M(hv,this))||void 0===o?void 0:o.height);if(Number.isFinite(d)&&Number.isFinite(h)&&d>0&&h>0)return{width:Math.round(d),height:Math.round(h)};const f=null===(s=M(dv,this))||void 0===s?void 0:s.element,p=Number(null==f?void 0:f.clientWidth),m=Number(null==f?void 0:f.clientHeight);if(Number.isFinite(p)&&Number.isFinite(m)&&p>0&&m>0)return{width:Math.round(p),height:Math.round(m)};const v=Number(null!==(a=null==f?void 0:f.width)&&void 0!==a?a:null===(l=M(Nv,this))||void 0===l?void 0:l.width),g=Number(null!==(c=null==f?void 0:f.height)&&void 0!==c?c:null===(u=M(Nv,this))||void 0===u?void 0:u.height);return Number.isFinite(v)&&Number.isFinite(g)&&v>0&&g>0?{width:Math.round(v),height:Math.round(g)}:null}function hg(t){const e=A(qv,this,ug).call(this,t);return e&&"object"==typeof e&&(e.requestRender=()=>A(qv,this,fg).call(this),e.viewportSize=A(qv,this,dg).call(this)),e}function fg(){M(Bv,this)||(C(Bv,this,!0),Promise.resolve().then((()=>{C(Bv,this,!1),M(Mv,this)&&A(qv,this,Fg).call(this)&&A(qv,this,Mg).call(this,M(Mv,this))})))}function pg(t){if(!t||!M(Rv,this))return;const e=M(Rv,this).get(t);e&&xm.resetRenderState(t,e),M(Rv,this).delete(t)}function mg(){M(Rv,this)&&(xm.resetAllRenderStates(M(Rv,this)),M(Rv,this).clear())}function vg(t,e,n,i){const r=A(qv,this,cg).call(this,t);M(Dv,this)&&M(Dv,this)!==r&&A(qv,this,pg).call(this,M(Dv,this)),C(Dv,this,r);const o=A(qv,this,hg).call(this,r);return xm.prepareRenderFrames({type:r,frames:e,timelineTime:n,timeline:M(uv,this),active:t,renderNodeParams:i,state:o})}function gg(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 yg(t){return t?String(t.renderPlacementId||t.type||"unknown"):"default"}function bg(){if(!M(uv,this)||!M(Mv,this))return;const t=M(uv,this).currentTime,e=M(uv,this).getActiveRenderPlacement(t),n=A(qv,this,yg).call(this,e);n!==M(Lv,this)&&(C(Lv,this,n),A(qv,this,Mg).call(this,{...M(Mv,this),time:t}))}function kg(t){return!t||"object"!=typeof t||!Object.prototype.hasOwnProperty.call(t,"panAndScan")||!1!==t.panAndScan}function wg(t,e){const n=A(qv,this,gg).call(this,t),i=null==n?void 0:n.stages;let r=iv(null==i?void 0:i.pre),o=iv(null==i?void 0:i.post);const s=A(qv,this,kg).call(this,n),a=A(qv,this,cg).call(this,t),l=rv(r,"retarget")||rv(o,"retarget");if(s&&!l){const i=xm.getPanAndScanTarget(a,{frameCount:Array.isArray(e)?e.length:0,active:t,renderNodeParams:n});if("pre"===i){const t=ov(Array.isArray(e)?e.length:0);t&&(r=[t,...r])}else if("post"===i){const t=ov(1);t&&(o=[...o,t])}}else s||(r=sv(r),o=sv(o));return{preStages:r,postStages:o,renderNodeParams:n}}function xg(t,e,n,i,r){const o=r||A(qv,this,lg).call(this,t,n,i),s=A(qv,this,wg).call(this,t,e),a=A(qv,this,cg).call(this,t),l=A(qv,this,hg).call(this,a);return M(wv,this).build({layoutType:null==t?void 0:t.type,frames:e,preStages:s.preStages,postStages:s.postStages,normalizedTime:o.normalizedTime,renderNodeDuration:o.duration,renderNodeParams:s.renderNodeParams,renderNodeState:l,timelineTime:n})}function _g(){var t,e;const n=null===(t=M(Tv,this))||void 0===t||null===(e=t.getState)||void 0===e?void 0:e.call(t);return"out"===(null==n?void 0:n.phase)?M(Tv,this).buildOutgoingGraph():"in"===(null==n?void 0:n.phase)?M(Tv,this).buildIncomingGraph():null}function Tg(t,e,n,i){const r=n||e!==M(xv,this),o=r||i;return r&&M(Ev,this)&&"function"==typeof M(Ev,this).updateOptions&&(M(Ev,this).updateOptions(oe.pipelineNodeId,{graph:t}),C(xv,this,e)),M(Ev,this)&&"function"==typeof M(Ev,this).selectNode&&M(_v,this)!==oe.pipelineNodeId&&(M(Ev,this).selectNode(oe.pipelineNodeId),C(_v,this,oe.pipelineNodeId)),!(!o||!M(Ev,this)||"function"!=typeof M(Ev,this).render||(M(Ev,this).render({noRaf:!0}),0))}function Eg(t){if(!Array.isArray(M(Sv,this))||!M(Sv,this).length)return;const e=Number.isFinite(t)?Math.max(0,t):0;if(!(M(Sv,this).length<=e)){for(let t=e;t<M(Sv,this).length;t+=1){const e=M(Sv,this)[t];if(e&&M(Ev,this)&&"function"==typeof M(Ev,this).releaseTexture)try{M(Ev,this).releaseTexture(e)}catch(t){}}M(Sv,this).length=e,M(Av,this).length=e}}function Ig(t=[]){if(!M(Ev,this)||"function"!=typeof M(Ev,this).addTexture)return{didUpdate:!1,hasUploadFailure:!1,ready:!1};if("function"==typeof M(Ev,this).isContextUnavailable&&M(Ev,this).isContextUnavailable())return{didUpdate:!1,hasUploadFailure:!1,ready:!1};if(!Array.isArray(t)||!t.length)return A(qv,this,Eg).call(this,0),{didUpdate:!1,hasUploadFailure:!1,ready:!1};A(qv,this,Eg).call(this,t.length);let e=!1,n=!1,i=!0;for(let o=0;o<t.length;o+=1){var r;M(Sv,this)[o]||"function"!=typeof M(Ev,this).addTexture||(M(Sv,this)[o]=M(Ev,this).addTexture(null,"frame",o));const s=A(qv,this,ag).call(this,t[o]),a=null===(r=t[o])||void 0===r?void 0:r.frame;if(M(Sv,this)[o]&&a){if(!s||s!==M(Av,this)[o])try{M(Sv,this)[o].fill(a),M(Av,this)[o]=s,e=!0}catch(t){i=!1,n=!0,M(Av,this)[o]=null}}else i=!1}return{didUpdate:e,hasUploadFailure:n,ready:i}}function Sg(){if(M(Cv,this))return;const t="function"==typeof Du.requestAnimationFrame?t=>Du.requestAnimationFrame(t):t=>setTimeout(t,16),e="function"==typeof Du.cancelAnimationFrame?t=>Du.cancelAnimationFrame(t):clearTimeout;C(Ov,this,e);const n=()=>{var e,i;if(null!==(e=M(Tv,this))&&void 0!==e&&null!==(i=e.getState)&&void 0!==i&&i.call(e)){if(M(Mv,this)){const t=A(qv,this,rg).call(this),e=Date.now();(!t||!M(Pv,this)||e-M(Pv,this)>=t)&&(C(Pv,this,e),A(qv,this,Mg).call(this,M(Mv,this)))}C(Cv,this,t(n))}else C(Cv,this,null)};C(Cv,this,t(n))}function Ag(){M(Cv,this)&&M(Ov,this)&&M(Ov,this).call(this,M(Cv,this)),C(Cv,this,null),C(Ov,this,null),C(Pv,this,null)}function Ng(t){var e,n;const i=null===(e=M(Tv,this))||void 0===e||null===(n=e.getState)||void 0===n?void 0:n.call(e);return"out"===(null==i?void 0:i.phase)&&M(Fv,this)?M(Fv,this):t}function Mg(t={},e=!1){try{var n,i;t&&C(Mv,this,t);const e=null===(n=M(dv,this))||void 0===n?void 0:n.element,r=null===(i=M(dv,this))||void 0===i?void 0:i.gl;if(!e||!r)return;if(M(jv,this)||"function"==typeof r.isContextLost&&r.isContextLost())return void C(jv,this,!0);if(!A(qv,this,Fg).call(this))return;const o=A(qv,this,Ng).call(this,t),s=Number.isFinite(null==o?void 0:o.time)?o.time:void 0;if(!Number.isFinite(s))return;if(A(qv,this,Zv).call(this,e),!M(Ev,this))return;const a=M(uv,this)&&"function"==typeof M(uv,this).getActiveRenderPlacement?M(uv,this).getActiveRenderPlacement(s):void 0,l=A(qv,this,yg).call(this,a);l!==M(Lv,this)&&C(Lv,this,l);const c=Array.isArray(null==o?void 0:o.frames)?o.frames:[],u=A(qv,this,gg).call(this,a),d=A(qv,this,kg).call(this,u),h=A(qv,this,vg).call(this,a,c,s,u),f=A(qv,this,lg).call(this,a,s,u),p=A(qv,this,sg).call(this,h,{useViewportSize:d}),m=A(qv,this,Ig).call(this,h),v=m.didUpdate;if(h.length>0&&!m.ready)return void(m.hasUploadFailure&&this.log.warn("Skipping render because one or more input textures could not be uploaded."));const g=A(qv,this,xg).call(this,a,h,s,u,f),y=A(qv,this,_g).call(this);let b=g.graph,k=g.signature,w=!!g.isDynamic;y&&Array.isArray(y.graph)&&y.graph.length&&(b=b.concat(y.graph),k=`${k}|${y.signature||"transition"}`,w=w||!!y.forceUpdate);const x=p||v||w||y&&Array.isArray(y.graph)&&y.graph.length;A(qv,this,Tg).call(this,b,k,w,x)&&h.length>0&&A(qv,this,Jv).call(this)}catch(n){if(A(qv,this,tg).call(this,n))return void A(qv,this,eg).call(this,n,t,e);throw n}}function Fg(){var t;const e=null===(t=M(uv,this))||void 0===t?void 0:t.state;return e===Ym||e===Jm||e===Qm||e===tv}function Cg(t){return"number"==typeof t&&Number.isFinite(t)&&t>0}function Og(t){return t&&"resource"===t.entryType&&t.transferSize>0&&t.duration>0&&t.responseEnd>=t.requestStart}function Pg(t){return Array.isArray(t)&&0!==t.length?t.reduce(((t,e)=>t+e),0)/t.length:NaN}oe=Vv;var Rg=new WeakMap,Dg=new WeakMap,Lg=new WeakMap,Bg=new WeakMap,zg=new WeakSet;class Wg extends Ou{get name(){return"DownloadSpeedGuesstimator"}get defaults(){return{persistentStorage:{key:"ekoDownloadSpeedKbps",ttl:-1},priorities:[["resourceTiming","downlink","persistentValue"],["resourceTiming","downlink"],["resourceTiming","persistentValue","ua"],["resourceTiming","ua","defaultKbps"],["downlink","persistentValue"],["downlink"],["persistentValue"],["connectionType"],["ua"],["defaultKbps"]],defaultKbps:2500,connectionType:{"slow-2g":50,"2g":70,"3g":700,"4g":3500,bluetooth:750,cellular:750,ethernet:3500,wifi:2500,wimax:2500,none:0},ua:{desktop:2500,ios:2500,android:2500}}}constructor(...t){super(...t),O(this,zg),F(this,Rg,void 0),F(this,Dg,void 0),F(this,Lg,void 0),F(this,Bg,void 0),C(Rg,this,!!(Du&&Du.navigator&&Du.navigator.connection)),C(Dg,this,!(!Du||!Du.performance||"function"!=typeof Du.performance.getEntriesByType)),C(Lg,this,A(zg,this,Ug).call(this)),C(Bg,this,A(zg,this,Hg).call(this))}guesstimate(){const t=A(zg,this,Xg).call(this);this.log.debug("[guesstimate] Data:",t);const e=A(zg,this,Kg).call(this,t),n=Cg(e)?e:t.defaultKbps;return A(zg,this,$g).call(this,n),this.log.info(`[guesstimate] Result: ${n} kbps`),n}update(t){Cg(t)&&A(zg,this,$g).call(this,t)}onDispose(){C(Lg,this,void 0),C(Bg,this,void 0)}}function jg(){return Math.round(Date.now()/1e3)}function Ug(){try{if(!Du||!Du.localStorage||"function"!=typeof Du.localStorage.getItem)return}catch(t){return}const t=this.settings.persistentStorage.key,e=Du.localStorage.getItem(t);if(e)try{const t=JSON.parse(e),n=this.settings.persistentStorage.ttl,i=A(zg,this,jg).call(this)-t.timestamp;if("number"==typeof n&&n>=0&&i>n)return null;if(!Cg(t.value))return;return t.value}catch(t){return}}function $g(t){if(!Cg(t))return;try{if(!Du||!Du.localStorage||"function"!=typeof Du.localStorage.setItem)return}catch(t){return}const e=this.settings.persistentStorage.key,n=JSON.stringify({value:t,timestamp:A(zg,this,jg).call(this)});try{Du.localStorage.setItem(e,n),C(Lg,this,t)}catch(t){}}function qg(){return Du&&Du.performance&&"function"==typeof Du.performance.getEntriesByType?Pg(Du.performance.getEntriesByType("resource").filter(Og).map((t=>8*t.transferSize/t.duration))):NaN}function Vg(){if(!Du||!Du.navigator||!Du.navigator.connection)return NaN;const t=Du.navigator.connection.downlink;return Cg(t)?1e3*t:NaN}function Gg(){if(!M(Rg,this))return NaN;const t=Du.navigator.connection,e=t.effectiveType||t.type,n=this.settings.connectionType||{};return e&&Object.prototype.hasOwnProperty.call(n,e)?n[e]:NaN}function Hg(){const t=this.settings.ua||{};return Um()?t.android:$m()?t.ios:t.desktop}function Kg(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=>Cg(t)));if(r.length===i.length)return this.log.debug("[#selectFromPriorities] Selected from priorities:",i,"with values:",r),Pg(r)}return NaN}function Xg(){const t=this.settings.testOverrides||{},e=Cg(t.resourceTiming)?t.resourceTiming:A(zg,this,qg).call(this),n=Cg(t.downlink)?t.downlink:A(zg,this,Vg).call(this),i=Cg(t.persistentValue)?t.persistentValue:M(Lg,this),r=Cg(t.connectionType)?t.connectionType:A(zg,this,Gg).call(this),o=Cg(t.ua)?t.ua:M(Bg,this);return{defaultKbps:this.settings.defaultKbps,resourceTiming:e,downlink:n,connectionType:r,persistentValue:i,ua:o}}const Yg=new Su;function Qg(t){return"string"!=typeof t||0===t.length?[]:t.split(".").filter((t=>t.length>0))}function Jg(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 Zg(t){return null!==t&&"object"==typeof t}function ty(t,e,n){const i=Qg(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 ey(t,e,n){if(!Zg(t))return t;const i=Qg(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}Zg(r[e])||(r[e]=Jg(i[t+1])?[]:{}),r=r[e]}return t}const ny={get:(t,e)=>Du&&Du.eko?ty(Du.eko,t,e):e,set(t,e){if(Du)return Du.eko&&"object"==typeof Du.eko||(Du.eko={}),ey(Du.eko,t,e),Du.eko}},iy=Du&&Du.performance,ry=iy&&"function"==typeof iy.now?()=>iy.now():()=>Date.now();function oy(){return"undefined"==typeof AbortController?null:new AbortController}function sy(){const t=new Error("The operation was aborted");return t.name="AbortError",t.code="ABORT_ERR",t}function ay(t,e){return!(!e||!e.aborted)||!!t&&("AbortError"===t.name||"ABORT_ERR"===t.code||20===t.code)}const ly=2,cy=100,uy=2,dy="runtime.downloadSpeedSamples",hy=Iu("download","warn");function fy(t){return new Promise((e=>{setTimeout(e,t)}))}function py(t){return t>=500}function my(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 vy(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=ny.get(r);t||(t=[],ny.set(r,t)),t.push(s)}catch(t){}return s}async function gy(t,e={}){const{method:n="GET",headers:i,body:r,retries:o=ly,retryDelay:s=cy,backoffFactor:a=uy,samplesTargetPath:l=dy,fetch:c,loglevel:u="warn",cache:d,signal:h,onProgress:f,returnType:p="default"}=e;hy.setLevel(u);const m=function(t){if(t)return t;if(Du&&"function"==typeof Du.fetch)return Du.fetch.bind(Du);throw new Error("fetch is not available in this environment")}(c);let v=0,g=s;for(;;){if(h&&h.aborted)throw sy();const e=ry();try{const s=await m(t,{method:n,headers:i,body:r,cache:d,mode:"cors",signal:h});if(h&&h.aborted)throw sy();if(!s.ok){if(v<o&&py(s.status)){v+=1,hy.warn(`[${t}] Download attempt #${v} failed with status ${s.status}, retrying in ${g}ms...`),await fy(g),g*=a;continue}hy.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=ry();const u=my(s),y="arrayBuffer"===p||"bytes"===p,b=y&&"function"==typeof f;let k,w,x,_,T,E=0;if(y&&s.body&&"function"==typeof s.body.getReader&&b){const t=s.body.getReader(),e=[];for(;;){if(h&&h.aborted)throw sy();const{done:n,value:i}=await t.read();if(n)break;if(i&&i.length){const t=ry();Number.isFinite(_)||(_=t),T=t,e.push(i),E+=i.length,f({loaded:E,total:u||void 0,chunk:i})}}k=new Uint8Array(E);let n=0;e.forEach((t=>{k.set(t,n),n+=t.length})),c=ry()}else if(y){const t=await s.arrayBuffer();k=new Uint8Array(t),E=k.length,c=ry()}else"text"===p?(w=await s.text(),c=ry()):"json"===p&&(x=await s.json(),c=ry());if(h&&h.aborted)throw sy();const I=y?k?k.length:E:("text"===p&&"string"==typeof w?w.length:0)||("json"===p&&x?JSON.stringify(x).length:0),S=u||I||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=vy(S,M,A,N,l,t);try{Yg.trigger("download:sample",F)}catch(t){}const C={response:s,bytes:S,durationMs:M,kbps:F.kbps,startTime:F.startTime,endTime:F.endTime};if("default"===p)return C;if("arrayBuffer"===p||"bytes"===p){const t=k||new Uint8Array(await s.arrayBuffer());return"arrayBuffer"===p?t.buffer:t}return"text"===p?w:"json"===p?x:C}catch(e){if(ay(e,h))throw"AbortError"===e.name?e:sy();if(!(v<o)||e.status&&!py(e.status))throw hy.error(`[${t}] Download attempt #${v} failed with error ${e}, no more retries.`),e;v+=1,hy.warn(`[${t}] Download attempt #${v} failed with error ${e}, retrying in ${g}ms...`),await fy(g),g*=a}}}const yy={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"]}},by=Object.freeze(Object.entries(yy).reduce(((t,[e,n])=>(Object.prototype.hasOwnProperty.call(n,"default")&&(t[e]=n.default),t)),{})),ky=Iu("config","warn");function wy(t){return by[t]}var xy=new WeakMap,_y=new WeakMap,Ty=new WeakMap,Ey=new WeakMap,Iy=new WeakMap,Sy=new WeakSet;class Ay extends Ou{get name(){return"DownloadSpeed"}get defaults(){return{alpha:.3,maxSamples:30,minBytesPerSample:1024,minDurationMs:5,maxSampleKbpsCap:void 0,ignoreCacheHits:!0,samplesPath:"runtime.downloadSpeedSamples",initialKbps:wy("initialKbps"),probeUrl:void 0,defaultKbps:2500}}constructor(...t){super(...t),O(this,Sy),F(this,xy,void 0),F(this,_y,void 0),F(this,Ty,void 0),F(this,Ey,void 0),F(this,Iy,void 0),C(Ty,this,[]),C(_y,this,0),C(xy,this,A(Sy,this,Fy).call(this)),C(Iy,this,oy()),C(Ey,this,(t=>{A(Sy,this,Ly).call(this,t,"event")})),A(Sy,this,Cy).call(this),Yg.on("download:sample",M(Ey,this)),A(Sy,this,Oy).call(this),this.log.debug(`[#constructor] Initial estimate: ${M(xy,this)} kbps`)}getKbps(){return M(xy,this)}addSample(t){A(Sy,this,Ly).call(this,t,"manual")}reset(){C(Ty,this,[]),C(_y,this,0),C(xy,this,A(Sy,this,Fy).call(this))}onDispose(){M(Iy,this)&&M(Iy,this).abort(),C(Iy,this,null),Yg.off("download:sample",M(Ey,this)),C(Ty,this,[]),C(_y,this,0),C(xy,this,void 0),C(Ey,this,null)}}function Ny(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 My(t){if(!t||"object"!=typeof t)return null;const e=Number(t.bytes),n=Number(t.durationMs);let i=Cg(t.kbps)?Number(t.kbps):NaN;return!Cg(i)&&n>0&&Cg(e)&&(i=8*e/n),Cg(i)?e<=this.settings.minBytesPerSample||n<=this.settings.minDurationMs||A(Sy,this,Ny).call(this,t,e)?null:(Cg(this.settings.maxSampleKbpsCap)&&i>this.settings.maxSampleKbpsCap&&(i=this.settings.maxSampleKbpsCap),{...t,bytes:e,durationMs:n,kbps:i}):null}function Fy(){const t=this.settings.initialKbps;if(Cg(t))return t;if("auto"===t)try{const t=(new Wg).guesstimate();if(Cg(t))return t}catch(t){}return this.settings.defaultKbps}function Cy(){const t=ny.get(this.settings.samplesPath,[]);if(!Array.isArray(t)||0===t.length)return;const e=t.slice(-this.settings.maxSamples);for(let t=0;t<e.length;t+=1)A(Sy,this,Ly).call(this,e[t],"replay",{emit:!1})}async function Oy(){if(!this.settings.probeUrl||M(_y,this)>0)return;const t=M(Iy,this)?M(Iy,this).signal:void 0;if(!t||!t.aborted)try{await gy(this.settings.probeUrl,{cache:"no-store",samplesTargetPath:this.settings.samplesPath,signal:t})}catch(t){}}function Py(t){return"number"==typeof t.startTime&&"number"==typeof t.endTime&&Number.isFinite(t.startTime)&&Number.isFinite(t.endTime)&&t.startTime>=0&&t.endTime>t.startTime}function Ry(t,e){if(!A(Sy,this,Py).call(this,t)||!A(Sy,this,Py).call(this,e))return 0;const n=Math.max(t.startTime,e.startTime);return Math.min(t.endTime,e.endTime)-n}function Dy(t){if(!A(Sy,this,Py).call(this,t))return t;const e=[];for(let n=0;n<M(Ty,this).length;n+=1){const i=M(Ty,this)[n];A(Sy,this,Py).call(this,i)&&(A(Sy,this,Ry).call(this,t,i)>0&&e.push(i))}if(0===e.length)return t;C(Ty,this,M(Ty,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(!Cg(i)||s<=0)return t;const a={bytes:i,durationMs:s,kbps:8*i/s,startTime:r,endTime:o,url:t.url||e[e.length-1].url};return A(Sy,this,My).call(this,a)}function Ly(t,e,{emit:n=!0}={}){const i=A(Sy,this,My).call(this,t);if(!i)return;const r=A(Sy,this,Dy).call(this,i);if(!r)return;C(_y,this,M(_y,this)+1),M(Ty,this).push(r),M(Ty,this).length>this.settings.maxSamples&&M(Ty,this).shift();const o=this.defaults.alpha,s="number"==typeof this.settings.alpha?this.settings.alpha:o,a=Cg(M(xy,this)),l=a?M(xy,this):r.kbps,c=a||1!==M(_y,this)?s*r.kbps+(1-s)*l:r.kbps;C(xy,this,c),this.log.debug(`[#ingestSample] Next estimate: ${c} kbps`),n&&this.trigger("download:speed",{kbps:M(xy,this),sample:r,source:e,samplesCount:M(_y,this)})}class By{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),Cg(s)&&(this.bandwidth=s),Cg(a)&&(this.timescale=a),Cg(l)&&(this.sizeBytes=l),Object.assign(this,c)}}class zy{#F=new Map;#C;#O;#P=0;#R;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 By?t:new By(t))),this.representations=this.originalRepresentations.map((t=>t)),this.appliedFilters=[],this.loadAttempts=0,this.loadError=void 0}setRepresentationBuffer(t,e){t&&e&&this.#F.set(t,e)}setDownloadProgress(t,e){const n=Number(t);Number.isFinite(n)&&n>=0&&(this.#P=Math.max(this.#P,n));const i=Number(e);Number.isFinite(i)&&i>0&&(this.#R=i)}setChosenRepresentation(t){this.#C=t;const e=null==t?void 0:t.id;if(!(this.isInit||!e||this.#F.size<=1))for(const t of this.#F.keys())t!==e&&this.#F.delete(t)}setABRDecisionSnapshot(t){if(!t||"object"!=typeof t)return void(this.#O=void 0);const e={...t};Array.isArray(t.availableRepresentations)&&(e.availableRepresentations=t.availableRepresentations.map((t=>({...t})))),this.#O=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.#F.get(t)}get chosenRepresentation(){return this.#C}get abrDecision(){return this.#O}get arrayBuffer(){return this.#C?this.#F.get(this.#C.id):void 0}get retainedByteLength(){let t=0;for(const e of this.#F.values())e&&"number"==typeof e.byteLength&&(t+=e.byteLength);return t}get bufferedRatio(){var t;const e=Cg(this.#R)?this.#R:null===(t=this.#C)||void 0===t?void 0:t.sizeBytes;return Cg(e)?Math.min(1,Math.max(0,this.#P/e)):this.retainedByteLength>0?1:0}get isLoaded(){return this.retainedByteLength>0}evict(){this.#C=void 0,this.#O=void 0,this.#F.clear(),this.#P=0,this.#R=void 0}}class Wy{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 jy(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 Uy(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=jy(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 $y=new Set(["video","audio","image","cue","data","bbox"]);let qy=class{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(!$y.has(n))throw new Error(`Track type must be one of ${Array.from($y).join("|")}`);this.id=e,this.type=n,this.offset=i,this.duration=Cg(r)?r:void 0,this.source=o,"cue"===n?(this._cues=a.map((t=>t instanceof Wy?t:new Wy(t))),this._segments=[]):(this._segments=s.map((t=>t instanceof zy?t:new zy(t))),this._cues=void 0)}get segments(){return this._segments.slice()}get cues(){if("cue"===this.type)return this._cues.slice()}get endTime(){if(Cg(this.duration))return this.offset+this.duration;if(!this._segments.length)return;const t=this._segments.reduce(((t,e)=>{const n=Cg(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:Cg(null==t?void 0:t.duration)?t.duration:0,offset:Cg(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 Uy(this._segments,t,e)}setSegments(t=[]){if("cue"===this.type)return;const e=Array.isArray(t)?t:[];this._segments=e.map((t=>t instanceof zy?t:new zy(t)))}};function Vy(t){return"string"==typeof t?t:t&&"object"==typeof t?t.nodeId||t.nodeIdOrRef||t.id:void 0}function Gy(t){const e=Vy(t);let n=1;if(t&&"object"==typeof t&&Cg(t.weight)&&(n=t.weight),!e)throw new Error("Child entry requires a nodeId");return{nodeId:e,weight:n}}function Hy(t){return(Array.isArray(t)?t:[]).map((t=>Gy(t)))}function Ky(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 Xy(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 Yy(t,e){if(e)try{var n;return new URL(e,t||(null==Du||null===(n=Du.location)||void 0===n?void 0:n.href)||void 0).toString()}catch(t){return e}}const Qy=new Map;class Jy{static register(t,e){if(!t||"function"!=typeof e)throw new Error("ManifestFactory.register requires type and parser function");Qy.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=Jy.inferType(t);if(!e||!Qy.has(e))throw new Error("Unsupported manifest type");return Qy.get(e)(t)}}Jy.register("dash",(function(t={}){const{body:e,url:n}=t,i=function(){if(Du&&"function"==typeof Du.DOMParser)return new Du.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=Ky(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=Ky(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:Ky(a&&a.getAttribute("timescale"))||Ky(e&&e.getAttribute("timescale"),1)||1,startNumber:Ky(a&&a.getAttribute("startNumber"))||Ky(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=Ky(n.getAttribute("t")),s=Ky(n.getAttribute("d")),a=Ky(n.getAttribute("r"),0);if(!Cg(s))continue;Cg(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:Yy(n,Xy(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:Yy(n,Xy(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}})),Jy.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:Cg(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=>Cg(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+(Cg(e.duration)?e.duration:0)),0),l=Cg(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}})),Jy.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=Cg(null==t?void 0:t.duration)?t.duration:30,i=Cg(null==t?void 0:t.width)?t.width:void 0,r=Cg(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};Cg(i)&&Cg(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 Zy=["video/mp4"];function tb(t){return Zy.includes(t.mime)}var eb={name:"containers",fn:function(t=[]){return t.filter(tb)},isRelevantForTrack:function(t){return"video"===(null==t?void 0:t.type)}};const nb=new(se=new WeakMap,ae=new WeakSet,class extends Ou{get name(){return"MediaCapabilities"}get defaults(){return{enabled:!0,smoothWeight:10,powerWeight:10,ignoreSmooth:!1,ignorePower:!0,codecBonus:{av01:.2,hvc1:.15,hev1:.15,vp09:.1,avc1:0}}}constructor(...t){super(...t),O(this,ae),F(this,se,void 0),C(se,this,new Map)}onDispose(){M(se,this)&&M(se,this).clear()}async sortRepsCodecs(t=[]){if(!Array.isArray(t)||0===t.length)return[];const e=[],n=new Set;let i=0;t.forEach((t=>{const r=null==t?void 0:t.baseCodec;r&&!n.has(r)&&(n.add(r),e.push({codec:r,rep:t,index:i}),i+=1)}));const r=(await Promise.all(e.map((async t=>{const{score:e}=await A(ae,this,ab).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 ib(){return!!(Du&&Du.navigator&&Du.navigator.mediaCapabilities&&"function"==typeof Du.navigator.mediaCapabilities.decodingInfo)}function rb(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 ob(t){return t?JSON.stringify(t):"invalid"}async function sb(t){if(!this.settings.enabled||!A(ae,this,ib).call(this)||!t)return this.log.debug("[#queryCapabilities] Not supported, returning false",t),{supported:!1,smooth:!1,powerEfficient:!1};const e=A(ae,this,ob).call(this,t),n=M(se,this).get(e);if(n)return n;let i;try{i=await Du.navigator.mediaCapabilities.decodingInfo(t)}catch(t){i={supported:!1,smooth:!1,powerEfficient:!1}}return this.log.debug("[#queryCapabilities] Config:",t,"\nDecoding info result:",i),M(se,this).set(e,i),i}async function ab(t){if(A(ae,this,cb).call(this,t))return this.log.debug("[#scoreRepresentation] Blocking HEVC on Firefox versions below support threshold",null==t?void 0:t.codecs),{score:-1e3,capability:{supported:!1,smooth:!1,powerEfficient:!1}};const e=A(ae,this,rb).call(this,t),n=await A(ae,this,sb).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 lb(){if(!Gm())return!1;const t=Hm();return!Number.isFinite(t)||t<150}function cb(t){if(!A(ae,this,lb).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 ub=[],db=()=>!0;[eb,{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 nb.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:db;ub.push({name:t,fn:e,isRelevantForTrack:i})}(t,e,{isRelevantForTrack:n})}));const hb=Iu("Node","warn"),fb={start:0,end:0},pb=.001;function mb(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)<=pb&&Math.abs(t.duration-n.duration)<=pb))?{offset:n.start,duration:n.duration}:void 0}var vb=new WeakMap,gb=new WeakMap,yb=new WeakMap,bb=new WeakMap,kb=new WeakMap,wb=new WeakMap,xb=new WeakMap,_b=new WeakMap,Tb=new WeakMap,Eb=new WeakMap,Ib=new WeakSet;class Sb extends Su{constructor(t={},e={}){super(),O(this,Ib),F(this,vb,void 0),F(this,gb,void 0),F(this,yb,void 0),F(this,bb,void 0),F(this,kb,void 0),F(this,wb,void 0),F(this,xb,void 0),F(this,_b,void 0),F(this,Tb,void 0),F(this,Eb,[]);const{id:n,manifestRef:i,duration:r,width:o,height:s,metadata:a={},children:l=[]}=t;if(!n)throw new Error("Node requires id");if(!i)throw new Error("Node requires manifestRef");this.id=n,this.manifestRef=i,this.metadata=a,this.state="pending",this.error=void 0,this.tracks=[],this.mainTrackId=void 0,this.imageFallbackActive=!1,this.disabledTracks=[],this.disabledTrackTypes=Array.isArray(e.disabledTracks)?e.disabledTracks.filter((t=>"string"==typeof t)):[],this.enabledRepFilters=Array.isArray(e.enabledRepFilters)?e.enabledRepFilters:void 0,this.forceVideoCodec="string"==typeof e.forceVideoCodec&&e.forceVideoCodec.trim()?e.forceVideoCodec.trim():void 0,C(xb,this,!0===e.forceImageFallback),C(vb,this,e.abrSelector),C(gb,this,e.assetsDeliveryService),C(bb,this,Cg(r)?r:void 0),C(kb,this,Cg(o)?o:void 0),C(wb,this,Cg(s)?s:void 0),C(_b,this,e&&"object"==typeof e.mediaHostRewriteMap?e.mediaHostRewriteMap:void 0),C(Tb,this,Cg(e.maxManifestLoadAttempts)?e.maxManifestLoadAttempts:1/0),this.manifestLoadAttempts=0,this.manifestLoadError=void 0,C(Eb,this,Hy(l))}setChildren(t){const e=Hy(t);return A(Ib,this,Vb).call(this,e,{emit:!0})}addChild(t){const e=Gy(t),n=M(Eb,this).slice(),i=n.findIndex((t=>(null==t?void 0:t.nodeId)===e.nodeId));if(i>=0){var r;if((null===(r=n[i])||void 0===r?void 0:r.weight)===e.weight)return this.children;n[i]=e}else n.push(e);return A(Ib,this,Vb).call(this,n,{emit:!0})}removeChild(t){const e=Vy(t);if(!e)return this.children;const n=M(Eb,this).filter((t=>(null==t?void 0:t.nodeId)!==e));return n.length===M(Eb,this).length?this.children:A(Ib,this,Vb).call(this,n,{emit:!0})}async load(t={}){const{loadingMode:e="full",signal:n}=t;hb.info(`[load] [${this.id}] Loading node in '${e}' mode`);try{if(n&&n.aborted)throw sy();"ready"!==this.state&&await this.resolve({signal:n});const t="partial"===e,i=[];this.tracks.forEach((e=>{const n=e.segments||[];if(t){const t=n.find((t=>t.isInit)),r=n.find((t=>!t.isInit));t&&Array.isArray(t.representations)&&!t.isLoaded&&i.push({track:e,segment:t}),r&&Array.isArray(r.representations)&&!r.isLoaded&&i.push({track:e,segment:r})}else n.forEach((t=>{Array.isArray(t.representations)&&!t.isLoaded&&i.push({track:e,segment:t})}))}));const r=i.filter((({segment:t})=>t.isInit)),o=i.filter((({segment:t})=>!t.isInit)),s=o.length?o[0]:void 0,a=r.map((({track:t,segment:e})=>A(Ib,this,jb).call(this,t,e,n))),l=s?A(Ib,this,Ub).call(this,s.segment,s.track,n):Promise.resolve();await Promise.all([...a,l]);const c=s?o.slice(1):o;for(const t of c)await A(Ib,this,Ub).call(this,t.segment,t.track,n);if(n&&n.aborted)throw sy();return this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:e}),this}catch(t){if(ay(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(hb.info(`[loadMediaSegmentsAtOffset] [${this.id}] Loading media segments at offset ${n}`),!Number.isFinite(n))return;const{signal:i}=e;if(i&&i.aborted)throw sy();if("ready"!==this.state&&await this.resolve({signal:i}),"ready"!==this.state)return;const r=[],o=[];if(this.tracks.forEach((t=>{const e=(null==t?void 0:t.segments)||[];if(!Array.isArray(e)||!e.length)return;const s=e.find((t=>(null==t?void 0:t.isInit)&&Array.isArray(null==t?void 0:t.representations)));s&&!s.isLoaded&&r.push(A(Ib,this,jb).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)<=pb&&!e.isLoaded&&o.push({segment:e,track:t})}))})),r.length||o.length){if(await Promise.all(r),o.length&&await Promise.all(o.map((({segment:t,track:e})=>A(Ib,this,Ub).call(this,t,e,i)))),i&&i.aborted)throw sy();this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:"segment-offset",offsetSeconds:n})}}async resolve(t={}){const{signal:e,manifestOverride:n}=t;let i=!0;for(;i;){if(i=!1,"ready"===this.state)return this;if("resolving"===this.state)try{return await M(yb,this)}catch(t){if(!ay(t)||e&&e.aborted)throw t;i=!0;continue}if(e&&e.aborted)throw sy();if(this.hasExceededManifestLoadAttempts()){const t=this.manifestLoadError||new Error("Manifest load retry limit reached");throw this.state="failed",this.error=t,t}const t=A(Ib,this,Pb).call(this);return this.state="resolving",this.error=void 0,C(yb,this,(async()=>{try{const t=await A(Ib,this,$b).call(this,{signal:e,manifestOverride:n});if(e&&e.aborted)throw sy();let i=Jy.parse(t);return i=A(Ib,this,Ob).call(this,i),this.tracks=(i.tracks||[]).map((t=>t instanceof qy?t:new qy(t))),this.mainTrackId=i.mainTrackId||this.mainTrackId,this.metadata=i.metadata||this.metadata,A(Ib,this,Hb).call(this),A(Ib,this,Gb).call(this),await A(Ib,this,qb).call(this),this.state="ready",this}catch(n){if(ay(n,e))throw A(Ib,this,Rb).call(this,t),n;throw this.state="failed",this.error=n,n}})()),M(yb,this)}return M(yb,this)}evict(){this.tracks.forEach((t=>{(t.segments||[]).forEach((t=>{t.evict()}))}))}get children(){return M(Eb,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?Cg(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+=Cg(e.retainedByteLength)?e.retainedByteLength:0}))})),t}get buffered(){if("ready"!==this.state)return fb;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||!Cg(e))return fb;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 fb;if(n.length===this.tracks.length&&n.every((({track:t,range:e})=>{const n=t.endTime,i=Cg(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 fb;const r=Math.min(i,e);return r>0?{start:0,end:r}:fb}get isLoaded(){return"ready"===this.state&&(Array.isArray(this.tracks)?this.tracks:[]).flatMap((t=>Array.isArray(null==t?void 0:t.segments)?t.segments:[])).every((t=>t.isLoaded))}hasExceededManifestLoadAttempts(){if(!Number.isFinite(M(Tb,this))||M(Tb,this)<=0)return!1;if(!this.manifestLoadError)return!1;const t=Number(this.manifestLoadAttempts);return Number.isFinite(t)&&t>=M(Tb,this)}}function Ab(t){return function(t,e){if(!t||"string"!=typeof t)return t;if(!e||"object"!=typeof e)return t;const n=Du&&"function"==typeof Du.URL?Du.URL:"function"==typeof URL?URL:null;if(!n)return t;let i;try{i=new n(t)}catch(e){return t}const r=function(t,e){const n=null==t?void 0:t.hostname,i=null==t?void 0:t.pathname;if("string"!=typeof n||"string"!=typeof i)return t;if(!/^s3(?:[.-][a-z0-9-]+)?\.amazonaws\.com$/i.test(n))return t;const r=i.split("/").filter(Boolean);if(r.length<2)return t;const o=r[0],s=new e(t.toString());return s.hostname=`${o}.${n}`,s.pathname=`/${r.slice(1).join("/")}`,s}(i,n),o=e[r.hostname]?r:i,s=e[o.hostname];if(!s||"string"!=typeof s)return t;let a;try{a=new n(s)}catch(e){return t}return a.protocol&&a.host?(o.protocol=a.protocol,o.host=a.host,o.toString()):t}(t,M(_b,this))}function Nb(){return M(xb,this)||void 0===Du.VideoDecoder}function Mb(){return this.manifestRef&&"object"==typeof this.manifestRef&&"assets-delivery-service"===this.manifestRef.type}function Fb(t){if(!A(Ib,this,Mb).call(this))return!1;if(!A(Ib,this,Nb).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 Cb(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 Cg(n)?n:Cg(M(bb,this))?M(bb,this):void 0}function Ob(t){if(this.imageFallbackActive=!1,!A(Ib,this,Fb).call(this,t))return t;if(!M(gb,this)||"function"!=typeof M(gb,this).resolveImageOne)return t;const e=M(gb,this).resolveImageOne(this.manifestRef),n=A(Ib,this,Ab).call(this,null==e?void 0:e.url);if(!n)return t;const i={typeHint:"image",url:n,duration:A(Ib,this,Cb).call(this,t),width:M(kb,this),height:M(wb,this)},r=Jy.parse(i);return t&&"object"==typeof t.metadata&&!Array.isArray(t.metadata)&&(r.metadata=t.metadata),this.imageFallbackActive=!0,r}function Pb(){return{state:this.state,error:this.error,tracks:this.tracks,mainTrackId:this.mainTrackId,metadata:this.metadata,imageFallbackActive:this.imageFallbackActive,disabledTracks:this.disabledTracks,manifestRef:this.manifestRef,manifestLoadAttempts:this.manifestLoadAttempts,manifestLoadError:this.manifestLoadError}}function Rb(t){t&&(this.state=t.state,this.error=t.error,this.tracks=t.tracks,this.mainTrackId=t.mainTrackId,this.metadata=t.metadata,this.imageFallbackActive=t.imageFallbackActive,this.disabledTracks=t.disabledTracks,this.manifestRef=t.manifestRef,this.manifestLoadAttempts=t.manifestLoadAttempts,this.manifestLoadError=t.manifestLoadError)}function Db(){const t=Number(this.manifestLoadAttempts);this.manifestLoadAttempts=Number.isFinite(t)&&t>0?t+1:1,this.manifestLoadError=void 0}function Lb(t){this.manifestLoadError=t||new Error("Manifest load failed")}function Bb(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 zb(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 Wb(t,e){t&&("function"!=typeof t.setLoadError?t.loadError=e||new Error("Segment load failed"):t.setLoadError(e))}async function jb(t,e,n){const i=A(Ib,this,Bb).call(this,e);try{const i=e.representations.map((async i=>{const r=A(Ib,this,Ab).call(this,i.url),o=await gy(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(ay(t,n))throw A(Ib,this,zb).call(this,e,i),t;throw A(Ib,this,Wb).call(this,e,t),t}}async function Ub(t,e,n){const i=M(vb,this),r={representations:t.representations,nodeId:this.id,trackId:null==e?void 0:e.id,segmentId:t.id},o=i&&"function"==typeof i.select?i.select(r):void 0,s=t.representations.find((t=>t.id===o))||t.representations[0];if(!s)return;t&&"function"==typeof t.setABRDecisionSnapshot&&t.setABRDecisionSnapshot(r.abrDecision),t.setChosenRepresentation(s);const a=A(Ib,this,Bb).call(this,t);try{const i=A(Ib,this,Ab).call(this,s.url),r=await gy(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(ay(e,n))throw A(Ib,this,zb).call(this,t,a),e;throw A(Ib,this,Wb).call(this,t,e),e}}async function $b(t={}){const{signal:e,manifestOverride:n}=t;if(e&&e.aborted)throw sy();A(Ib,this,Db).call(this);try{let t=this.manifestRef;if(n&&"object"==typeof n){if(A(Ib,this,Mb).call(this)&&"string"==typeof n.encodeProfile&&n.encodeProfile&&(this.manifestRef={...this.manifestRef,encodeProfile:n.encodeProfile},t=this.manifestRef),n.ivd)return{typeHint:"ivd",body:n.ivd};if(n.body){const t=A(Ib,this,Ab).call(this,n.url);return{typeHint:n.typeHint,url:t,mimeType:n.mimeType,body:n.body,duration:M(bb,this),width:M(kb,this),height:M(wb,this)}}"string"==typeof n.url&&n.url&&(t=n)}if(t&&"object"==typeof t&&"assets-delivery-service"===t.type){if(!M(gb,this)||"function"!=typeof M(gb,this).resolveOne)throw new Error("AssetsDeliveryService is required for assets-delivery-service manifestRef");const n=await M(gb,this).resolveOne(t,{signal:e});if(!n)throw new Error("AssetsDeliveryService returned empty result");if("string"==typeof n.encodeProfile&&n.encodeProfile&&(this.manifestRef={...t,encodeProfile:n.encodeProfile}),n.ivd)return{typeHint:"ivd",body:n.ivd};const i=n.typeHint,r=A(Ib,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:M(bb,this),width:M(kb,this),height:M(wb,this)};throw new Error("AssetsDeliveryService returned unsupported manifest shape")}if(t&&"object"==typeof t){const e=A(Ib,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=A(Ib,this,Ab).call(this,n),r="object"==typeof t?t.typeHint:void 0,o="object"==typeof t?t.mimeType:void 0;if("image"===Jy.inferType({typeHint:r,url:i,mimeType:o})){const e="object"==typeof t&&Cg(t.duration)?t.duration:M(bb,this);return{typeHint:"image",url:i,mimeType:o,duration:e,width:"object"==typeof t&&Cg(t.width)?t.width:M(kb,this),height:"object"==typeof t&&Cg(t.height)?t.height:M(wb,this)}}const s=await gy(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(ay(t,e))throw t;throw A(Ib,this,Lb).call(this,t),t}}async function qb(){const t=ub.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=mb(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 Vb(t,{emit:e=!1}={}){return function(t=[],e=[]){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n+=1){const i=t[n],r=e[n];if((null==i?void 0:i.nodeId)!==(null==r?void 0:r.nodeId)||(null==i?void 0:i.weight)!==(null==r?void 0:r.weight))return!1}return!0}(M(Eb,this),t)||(C(Eb,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 Gb(){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 Hb(){if(!Array.isArray(this.tracks)||!this.tracks.length)return;const t=this.duration;if(!Cg(t))return;const e=[new Wy({name:"nodestart",timestamp:0,data:{id:this.id},isSticky:!0}),new Wy({name:"nodeend",timestamp:t,data:{id:this.id}})],n=new qy({id:`${this.id}-auto-cue`,type:"cue",cues:e,offset:0,duration:t});this.tracks.push(n)}var Kb=new WeakMap,Xb=new WeakMap,Yb=new WeakMap,Qb=new WeakMap,Jb=new WeakSet;class Zb extends Ou{constructor(...t){super(...t),O(this,Jb),F(this,Kb,new Map),F(this,Xb,new Map),F(this,Yb,void 0),F(this,Qb,void 0);const[e,n]=t;C(Yb,this,e),C(Qb,this,n)}get name(){return"NodeRepository"}get defaults(){return{enabledRepFilters:["containers","force-video-codec","media-capabilities"],disabledTracks:wy("disabledTracks"),forceVideoCodec:wy("forceVideoCodec"),forceImageFallback:wy("forceImageFallback"),mediaHostRewriteMap:wy("mediaHostRewriteMap"),maxManifestLoadAttempts:3}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"get","list"])}onDispose(){M(Kb,this).forEach(((t,e)=>{const n=M(Xb,this).get(e);n&&t&&"function"==typeof t.off&&t.off(Bu.NODE_CHILDREN_CHANGED,n)})),M(Xb,this).clear(),M(Kb,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:M(Yb,this),assetsDeliveryService:M(Qb,this)});if(!e.id)throw new Error("NodeRepository.add requires node with id");if(M(Kb,this).has(e.id))throw new Error(`NodeRepository.add: node with id ${e.id} already exists`);return M(Kb,this).set(e.id,e),A(Jb,this,tk).call(this,e),this.trigger(Bu.NODE_ADD,{node:e}),e}get(t){const e=(null==t?void 0:t.id)||t;if(!e)throw new Error("NodeRepository.get requires node or id");return M(Kb,this).get(e)}list(){return Array.from(M(Kb,this).values())}}function tk(t){if(!t||"function"!=typeof t.on||!t.id)return;const e=t=>{this.trigger(Bu.NODE_CHILDREN_CHANGED,t)};t.on(Bu.NODE_CHILDREN_CHANGED,e),M(Xb,this).set(t.id,e)}var ek=new WeakMap,nk=new WeakMap,ik=new WeakSet;class rk extends Ou{constructor(...t){super(...t),O(this,ik),F(this,ek,void 0),F(this,nk,new Map);const[e]=t;C(ek,this,e)}get name(){return"ABRSelector"}get defaults(){return{safetyMargin:.35,minBufferForUpgrade:5,minBufferCritical:1,hysteresisRatio:1.1,abrStrategy:wy("abrStrategy")}}select(t={}){var e;const{representations:n=[],bufferSeconds:i}=t;if(!Array.isArray(n)||0===n.length)return;const r=M(ek,this)&&"function"==typeof M(ek,this).getKbps?M(ek,this).getKbps():void 0,o=A(ik,this,ok).call(this,n[0]),s=M(nk,this).get(o),a=this.settings.abrStrategy||"auto";this.log.debug(`[select] strategy=${a}, bw=${r}, buffer=${i}, prev=${s}`);const l=n.slice().sort(((t,e)=>A(ik,this,sk).call(this,t.bandwidth)-A(ik,this,sk).call(this,e.bandwidth)));if("bottom"===a){const e=l[0];return A(ik,this,ck).call(this,e,t,{decisionReason:"strategy:bottom",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==e?void 0:e.id}if("top"===a){const e=l[l.length-1];return A(ik,this,ck).call(this,e,t,{decisionReason:"strategy:top",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==e?void 0:e.id}if("random"===a){const e=l[Math.floor(Math.random()*l.length)];return A(ik,this,ck).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=Cg(r)?r*this.settings.safetyMargin:void 0;let d="auto:highest-available";if(s&&void 0!==c&&c<this.settings.minBufferCritical){const e=l[0];return this.log.debug("[select] critical buffer -> lowest",t),A(ik,this,ck).call(this,e,t,{decisionReason:"auto:critical-buffer",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:u,bufferSeconds:c}),null==e?void 0:e.id}let h=l[l.length-1];if(void 0!==u){const e=l.filter((t=>A(ik,this,sk).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&&Cg(e.bandwidth)&&Cg(h.bandwidth)&&h.bandwidth/e.bandwidth>this.settings.hysteresisRatio&&(h=n.filter((t=>t.bandwidth&&t.bandwidth<=e.bandwidth*this.settings.hysteresisRatio)).sort(((t,e)=>t.bandwidth-e.bandwidth)).pop()||e,d="auto:hysteresis-hold",this.log.debug("[select] hysteresis prevents upgrade; hold",h.id,t))}return A(ik,this,ck).call(this,h,t,{decisionReason:d,trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:u,bufferSeconds:c}),null===(e=h)||void 0===e?void 0:e.id}onDispose(){M(nk,this).clear(),C(ek,this,null)}}function ok(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 sk(t){return Cg(t)?t/1e3:0}function ak(t){return Cg(t)?t/1e3:void 0}function lk(t,e,n={}){const i=Array.isArray(null==e?void 0:e.representations)?e.representations.map((t=>({id:null==t?void 0:t.id,bandwidthKbps:A(ik,this,ak).call(this,null==t?void 0:t.bandwidth)}))):[];return{timeMs:Date.now(),strategy:this.settings.abrStrategy||"auto",decisionReason:n.decisionReason,nodeId:null==e?void 0:e.nodeId,trackId:null==e?void 0:e.trackId,segmentId:null==e?void 0:e.segmentId,trackType:n.trackType,measuredDownloadSpeedKbps:Number.isFinite(n.measuredDownloadSpeedKbps)?n.measuredDownloadSpeedKbps:void 0,safeBandwidthKbps:Number.isFinite(n.safeBandwidthKbps)?n.safeBandwidthKbps:void 0,bufferSeconds:Number.isFinite(n.bufferSeconds)?n.bufferSeconds:void 0,previousRepresentationId:n.previousRepresentationId,selectedRepresentationId:null==t?void 0:t.id,selectedRepresentationBandwidthKbps:A(ik,this,ak).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 ck(t,e,n={}){if(!t)return;const i=A(ik,this,lk).call(this,t,e,n);e&&"object"==typeof e&&(e.abrDecision=i),this.log.info("[select] Chosen representation:",t,"context:",e,"decision:",i),this.trigger("abr:selection",{representation:t,context:e,strategy:this.settings.abrStrategy,decision:i});const r=A(ik,this,ok).call(this,t);M(nk,this).set(r,t.id)}var uk=new WeakMap,dk=new WeakSet;class hk extends Ou{constructor(...t){super(...t),O(this,dk),F(this,uk,void 0);const[e]=t;if(C(uk,this,e),!M(uk,this)||"function"!=typeof M(uk,this).list)throw new Error("NodePrioritizer requires a NodeRepository instance")}get name(){return"NodePrioritizer"}get defaults(){return{levelMultiplier:1,priorityMultiplier:.3}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"sortNodes"])}onDispose(){C(uk,this,null)}getPrioritizationSnapshot(t){const e=M(uk,this).list();if(!e.length)return{orderedIds:[],reachableIds:[]};const{levels:n,weights:i}=A(dk,this,fk).call(this,e,t);return{orderedIds:A(dk,this,pk).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 fk(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=Cg(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 pk(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 mk(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 vk(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 gk(t){return"string"==typeof t&&t.startsWith("cmaf:")}function yk(t){return"image"===(null==t?void 0:t.assetType)?"image":"ivd"}function bk(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 kk=new WeakMap,wk=new WeakMap,xk=new WeakSet;class _k extends Ou{constructor(...t){super(...t),O(this,xk),F(this,kk,void 0),F(this,wk,void 0);const[,e={}]=t;C(kk,this,"function"==typeof e.fetchFn?e.fetchFn:void 0),C(wk,this,oy())}get name(){return"AssetsDeliveryService"}get defaults(){return{assetsDeliveryServiceUrl:"https://assets.eko.com",profile:wy("encodeProfile"),maxBatchSize:5,imageQueryParams:{startOffset:0,width:1024}}}async resolveOne(t,e={}){var n;const i=await this.resolve([t],e);if(!i.length)return;const r=i[0],o=null==r?void 0:r.manifest,s=null==r||null===(n=r.manifestRef)||void 0===n?void 0:n.encodeProfile;return o&&"object"==typeof o&&"string"==typeof s&&s?{...o,encodeProfile:s}:o}resolveImageOne(t){if(!A(xk,this,Ek).call(this,t))return;const e=mk(t,this.settings.profile),n=function(t,e,n){const i=function(t,e,n){const i=(t||"").replace(/\/$/,""),r=null==n?void 0:n.assetId,o=null==n?void 0:n.assetRevision;if(i&&e&&"string"==typeof r&&"number"==typeof o)return`${i}/${e}/${encodeURIComponent(r)}/${o}`}(t,"image",e);if(!i)return;const r=function(t){if(!t||"object"!=typeof t||Array.isArray(t))return"";const e=new URLSearchParams;return Object.keys(t).forEach((n=>{if("string"!=typeof n||!n)return;const i=t[n];null!=i&&("number"!=typeof i||Number.isFinite(i))&&("string"!=typeof i&&"number"!=typeof i&&"boolean"!=typeof i||e.set(n,String(i)))})),e.toString()}(n);return r?`${i}?${r}`:i}(this.settings.assetsDeliveryServiceUrl||"",t,this.settings.imageQueryParams);if(!n)return;const i={typeHint:"image",url:n};return"string"==typeof e&&e&&(i.encodeProfile=e),i}async resolve(t=[],e={}){const n=(Array.isArray(t)?t:[t]).filter((t=>A(xk,this,Ek).call(this,t)));if(!n.length)return[];const i=A(xk,this,Tk).call(this,e);if(i&&i.aborted)return[];const r=[],o=this.settings.profile;n.forEach((t=>{if("image"!==yk(t))return;const e=this.resolveImageOne(t);e&&e.url&&r.push({manifestRef:vk(t,e.encodeProfile),manifest:{typeHint:"image",url:e.url}})}));const s=n.filter((t=>"image"!==yk(t))).map((t=>function(t,e){const n=mk(t,e);return{ref:t,profile:n,route:gk(n)?"dash":"ivd"}}(t,o))),a=A(xk,this,Sk).call(this,s);for(const{refs:t,route:e}of a){if(i&&i.aborted)return r;const{url:n}=A(xk,this,Ak).call(this,t,e),o=await A(xk,this,Nk).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:vk(t,e),manifest:bk(i)})}))}return r}onDispose(){M(wk,this)&&M(wk,this).abort(),C(wk,this,null),C(kk,this,null)}}function Tk(t){return t&&t.signal?t.signal:M(wk,this)?M(wk,this).signal:void 0}function Ek(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 Ik(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=>{A(xk,this,Ik).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 Nk(t,e){return M(kk,this)?M(kk,this).call(this,t,e):await gy(t,{returnType:"json",method:(null==e?void 0:e.method)||"GET",signal:null==e?void 0:e.signal})}function Mk({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 Fk=(Du.requestAnimationFrame||Du.mozRequestAnimationFrame||Du.webkitRequestAnimationFrame||Du.msRequestAnimationFrame||(t=>Du.setTimeout(t,1e3/60))).bind(Du),Ck=(Du.cancelAnimationFrame||Du.mozCancelAnimationFrame||Du.webkitCancelAnimationFrame||Du.msCancelAnimationFrame||(t=>Du.clearTimeout(t))).bind(Du),Ok=Iu("ticker","warn");let Pk,Rk=[],Dk=null,Lk=ry();function Bk(){Lk=ry();const t=[];let e,n;for(n=Rk.length-1;n>=0;--n)e=Rk[n],Lk>=e.lastTick+e.interval&&t.push(e);for(n=t.length-1;n>=0;--n)if(e=t[n],!e.stopped){e.lastTick=Lk;try{e.callback()}catch(t){console&&"function"==typeof console.error?console.error(t):Ok.error(t)}}Pk=Fk(Bk)}function zk(){ry()-Lk>=200&&(Ck(Pk),Bk())}function Wk(t){let e=-1;for(let n=0;n<Rk.length;n+=1)if(Rk[n].callback===t){e=n;break}return e}function jk(t,e=0){if(!t||"function"!=typeof t||"number"!=typeof e||e<0)return void Ok.error("[start] Invalid arguments given to start method.",arguments);const n=Wk(t);return-1!==n?(Ok.debug("[start] Callback already exists, overriding interval.",arguments),Rk[n].interval=e,t):(Rk.push({callback:t,interval:e,lastTick:ry()}),1===Rk.length&&(Pk=Fk(Bk),Dk||(Dk=Du.setInterval(zk,1e3))),t)}function Uk(t){const e=Wk(t);-1!==e?(Rk[e].stopped=!0,Rk.splice(e,1),Rk.length||(Ck(Pk),Du.clearInterval(Dk),Dk=null)):Ok.debug("[stop] Callback not found, doing nothing.",arguments)}function $k(t){return-1!==Wk(t)}function qk(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 Ok.error("[createThrottler] Bad argument given to createThrottler, first argument must be a function.",arguments);Ok.debug("[createThrottler] Creating a new throttler instance.",arguments);const s=[];function a(){Ok.debug("[onThrottlerTick] Calling callback with "+s.length+" queued items.");const e=s.slice(0);s.length=0,Uk(a),t(e)}const l={push:function(t){Ok.debug("[push] Queuing argument:",t),0===s.length&&jk(a,e),s.push(t),o+=1,(o<=r||s.length>=i)&&a()},flush:function(){Ok.debug("[flush] Flushing queue."),0!==s.length&&a()},dispose:function(){Ok.debug("[dispose] Disposing of throttler.");const t=s.slice(0);return s.length=0,Uk(a),t}};return Object.defineProperty(l,"interval",{enumerable:!0,get:function(){return e},set:function(t){"number"==typeof t&&(e=t)}}),l}function Vk(t,e){if(t&&"function"==typeof t)return t.__tickerThrottler||(t.__tickerThrottler=qk((function(){t()}),e)),"number"==typeof e&&(t.__tickerThrottler.interval=e),t.__tickerThrottler.push(),t.__tickerThrottler;Ok.error("[scheduleExecution] Bad argument given to scheduleExecution, first argument must be a function.",arguments)}var Gk=new WeakMap,Hk=new WeakMap,Kk=new WeakMap,Xk=new WeakMap,Yk=new WeakMap,Qk=new WeakMap,Jk=new WeakMap,Zk=new WeakMap,tw=new WeakMap,ew=new WeakMap,nw=new WeakMap,iw=new WeakMap,rw=new WeakMap,ow=new WeakMap,sw=new WeakMap,aw=new WeakMap,lw=new WeakSet;class cw extends Ou{constructor(...t){super(...t),O(this,lw),F(this,Gk,void 0),F(this,Hk,void 0),F(this,Kk,void 0),F(this,Xk,void 0),F(this,Yk,[]),F(this,Qk,[]),F(this,Jk,new Set),F(this,Zk,new Set),F(this,tw,!1),F(this,ew,void 0),F(this,nw,void 0),F(this,iw,void 0),F(this,rw,void 0),F(this,ow,void 0),F(this,sw,void 0),F(this,aw,void 0);const[e,n,i,r]=t;C(Gk,this,e),C(Hk,this,n),C(Kk,this,i),C(Xk,this,r),C(ew,this,oy());const o=t.length?t[t.length-1]:void 0,s=o&&"object"==typeof o&&Number.isFinite(o.maxConcurrent)?o.maxConcurrent:void 0;Number.isFinite(s)&&(this.settings.maxConcurrent=s),C(aw,this,(()=>A(lw,this,kw).call(this))),A(lw,this,fw).call(this),A(lw,this,hw).call(this)}get name(){return"NodeResolver"}get defaults(){return{maxConcurrent:5}}onDispose(){var t;M(ew,this)&&M(ew,this).abort(),C(ew,this,null),M(Xk,this)&&"function"==typeof M(Xk,this).off&&M(iw,this)&&M(Xk,this).off(Bu.PLACEMENT_ADDED,M(iw,this)),M(Xk,this)&&"function"==typeof M(Xk,this).off&&M(sw,this)&&M(Xk,this).off(Bu.TIMELINE_RESET,M(sw,this)),M(Gk,this)&&"function"==typeof M(Gk,this).off&&M(rw,this)&&M(Gk,this).off(Bu.NODE_ADD,M(rw,this)),M(Gk,this)&&"function"==typeof M(Gk,this).off&&M(ow,this)&&M(Gk,this).off(Bu.NODE_CHILDREN_CHANGED,M(ow,this)),C(iw,this,null),C(rw,this,null),C(ow,this,null),C(sw,this,null),C(Yk,this,[]),C(Qk,this,[]),M(Jk,this).clear(),M(Zk,this).clear(),C(tw,this,!1),C(nw,this,void 0),null!==(t=M(aw,this))&&void 0!==t&&t.__tickerThrottler&&M(aw,this).__tickerThrottler.dispose(),C(aw,this,null)}}function uw(){return M(ew,this)?M(ew,this).signal:void 0}function dw(){return this._disposed||M(ew,this)&&M(ew,this).signal.aborted}function hw(){M(Xk,this)&&"function"==typeof M(Xk,this).on&&(C(iw,this,(t=>{A(lw,this,mw).call(this,null==t?void 0:t.nodeId)})),M(Xk,this).on(Bu.PLACEMENT_ADDED,M(iw,this)),C(sw,this,(()=>A(lw,this,pw).call(this))),M(Xk,this).on(Bu.TIMELINE_RESET,M(sw,this))),M(Gk,this)&&"function"==typeof M(Gk,this).on&&(C(rw,this,(({node:t})=>{(null==t?void 0:t.id)&&A(lw,this,mw).call(this,t.id,{fromRepoAdd:!0})})),M(Gk,this).on(Bu.NODE_ADD,M(rw,this)),C(ow,this,(()=>{Vk(M(aw,this),100)})),M(Gk,this).on(Bu.NODE_CHILDREN_CHANGED,M(ow,this)))}function fw(){const t=M(Xk,this)&&Array.isArray(M(Xk,this).placements)?M(Xk,this).placements:[];t.forEach((t=>A(lw,this,mw).call(this,t.nodeId)));const e=t.length?t[t.length-1]:void 0;e&&e.nodeId&&C(nw,this,e.nodeId)}function pw(){M(ew,this)&&M(ew,this).abort(),C(ew,this,oy()),C(Yk,this,[]),C(Qk,this,[]),M(Jk,this).clear(),C(tw,this,!1),C(nw,this,void 0)}function mw(t,{fromRepoAdd:e=!1}={}){A(lw,this,dw).call(this)||t&&(M(Zk,this).has(t)||M(Jk,this).has(t)||(M(Yk,this).push(t),M(nw,this)||e||C(nw,this,t),!M(tw,this)&&e||A(lw,this,vw).call(this)))}function vw(){if(M(tw,this))return void A(lw,this,gw).call(this);if(0===M(Yk,this).length)return;C(tw,this,!0);const t=M(Yk,this).shift();A(lw,this,ww).call(this,t).finally((()=>{A(lw,this,gw).call(this)}))}async function gw(){if(!A(lw,this,dw).call(this))for(M(Yk,this).length||M(Qk,this).length||C(Qk,this,A(lw,this,yw).call(this));M(Jk,this).size<this.settings.maxConcurrent;){const t=this.settings.maxConcurrent-M(Jk,this).size;if(t<=0)break;const e=[];for(;e.length<t&&(M(Yk,this).length||M(Qk,this).length);){let t=M(Yk,this).shift();t||(t=M(Qk,this).shift()),t&&e.push(t)}if(!e.length)break;const n=A(lw,this,xw).call(this,e);n.length&&M(Kk,this)&&"function"==typeof M(Kk,this).resolve&&A(lw,this,_w).call(this,n).finally((()=>A(lw,this,gw).call(this))),e.filter((t=>!n.find((e=>e.nodeId===t)))).forEach((t=>{A(lw,this,ww).call(this,t).finally((()=>A(lw,this,gw).call(this)))}))}}function yw(){const t=new Set([...M(Zk,this),...M(Jk,this),...M(Yk,this)]);return A(lw,this,bw).call(this,t)}function bw(t){const e=M(Xk,this)&&Array.isArray(M(Xk,this).placements)?M(Xk,this).placements:[],n=(e.length?e[e.length-1].nodeId:void 0)||M(nw,this);return Mk({prioritizer:M(Hk,this),repository:M(Gk,this),startNodeId:n,pendingIds:t,fallbackToRepository:!1})}function kw(){A(lw,this,dw).call(this)||(M(tw,this)||0!==M(Yk,this).length)&&(C(Qk,this,A(lw,this,yw).call(this)),M(tw,this)&&A(lw,this,gw).call(this))}async function ww(t,e){if(!t||M(Zk,this).has(t)||M(Jk,this).has(t))return;const n=A(lw,this,uw).call(this);if(n&&n.aborted)return;const i=M(Gk,this)&&"function"==typeof M(Gk,this).get?M(Gk,this).get(t):void 0;if(i&&"function"==typeof i.resolve)if("function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts())M(Zk,this).add(t);else{M(Jk,this).add(t);try{const r={signal:n};e&&(r.manifestOverride=e),await i.resolve(r),M(Zk,this).add(t)}catch(e){if(ay(e,n))return;this.log.warn(`NodeResolver failed to resolve node ${t}: ${(null==e?void 0:e.message)||e}`),"function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts()&&M(Zk,this).add(t)}finally{M(Jk,this).delete(t)}}}function xw(t){const e=[];return t.forEach((t=>{const n=M(Gk,this)&&"function"==typeof M(Gk,this).get?M(Gk,this).get(t):void 0;n&&n.manifestRef&&"assets-delivery-service"===n.manifestRef.type&&e.push({nodeId:t,ref:n.manifestRef})})),e}async function _w(t){const e=A(lw,this,uw).call(this);if(!e||!e.aborted){t.forEach((({nodeId:t})=>M(Jk,this).add(t)));try{const n=t.map((t=>t.ref)),i=await M(Kk,this).resolve(n,{signal:e});t.forEach((({nodeId:t,ref:e})=>{var n;const r=M(Gk,this)&&"function"==typeof M(Gk,this).get?M(Gk,this).get(t):void 0;if(M(Jk,this).delete(t),!r||"function"!=typeof r.resolve)return;const o=Array.isArray(i)?i.find((t=>{const n=null==t?void 0:t.manifestRef;return n&&n.assetId===e.assetId&&n.assetRevision===e.assetRevision})):void 0,s="string"==typeof(null==o||null===(n=o.manifestRef)||void 0===n?void 0:n.encodeProfile)&&o.manifestRef.encodeProfile?o.manifestRef.encodeProfile:void 0,a=o?A(lw,this,Tw).call(this,o.manifest,s):void 0;A(lw,this,ww).call(this,t,a)}))}catch(n){ay(n,e)||this.log.warn(`NodeResolver ADS batch failed: ${(null==n?void 0:n.message)||n}`),t.forEach((({nodeId:t})=>M(Jk,this).delete(t)))}}}function Tw(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 Ew=.001,Iw="priority";function Sw(t){const e=Number(t);return Number.isFinite(e)?e:0}var Aw=new WeakMap,Nw=new WeakMap,Mw=new WeakMap,Fw=new WeakMap,Cw=new WeakMap,Ow=new WeakMap,Pw=new WeakMap,Rw=new WeakMap,Dw=new WeakMap,Lw=new WeakMap,Bw=new WeakMap,zw=new WeakMap,Ww=new WeakMap,jw=new WeakMap,Uw=new WeakMap,$w=new WeakMap,qw=new WeakMap,Vw=new WeakMap,Gw=new WeakMap,Hw=new WeakMap,Kw=new WeakSet;class Xw extends Ou{constructor(...t){super(...t),O(this,Kw),F(this,Aw,void 0),F(this,Nw,void 0),F(this,Mw,void 0),F(this,Fw,new Map),F(this,Cw,new Map),F(this,Ow,[]),F(this,Pw,new Set),F(this,Rw,new Map),F(this,Dw,!1),F(this,Lw,void 0),F(this,Bw,void 0),F(this,zw,void 0),F(this,Ww,void 0),F(this,jw,void 0),F(this,Uw,void 0),F(this,$w,void 0),F(this,qw,void 0),F(this,Vw,!1),F(this,Gw,[]),F(this,Hw,void 0);const[e,n,i]=t;C(Aw,this,e),C(Nw,this,n),C(Mw,this,i),C(Bw,this,oy()),C(Hw,this,(()=>A(Kw,this,Fx).call(this))),A(Kw,this,ux).call(this)}get name(){return"SegmentLoadCoordinator"}get defaults(){return{maxConcurrentLoads:3,maxSegmentLoadAttempts:3}}onDispose(){var t;M(Bw,this)&&M(Bw,this).abort(),C(Bw,this,null),M(Rw,this).size&&M(Rw,this).forEach((t=>{(null==t?void 0:t.controller)&&t.controller.abort()})),M(Rw,this).clear(),M(Mw,this)&&"function"==typeof M(Mw,this).off&&(M(zw,this)&&M(Mw,this).off(Bu.PLACEMENT_ADDED,M(zw,this)),M(jw,this)&&M(Mw,this).off(Bu.TIMELINE_SEEKING,M(jw,this)),M(Uw,this)&&M(Mw,this).off(Bu.TIMELINE_SEEKED,M(Uw,this)),M($w,this)&&M(Mw,this).off(Bu.TIMELINE_RESET,M($w,this))),M(Aw,this)&&"function"==typeof M(Aw,this).off&&M(Ww,this)&&M(Aw,this).off(Bu.NODE_CHILDREN_CHANGED,M(Ww,this)),M(qw,this)&&"function"==typeof Du.removeEventListener&&Du.removeEventListener("online",M(qw,this)),C(zw,this,null),C(Ww,this,null),C(jw,this,null),C(Uw,this,null),C($w,this,null),C(qw,this,null),M(Fw,this).clear(),M(Cw,this).clear(),C(Ow,this,[]),M(Pw,this).clear(),M(Rw,this).clear(),C(Dw,this,!1),C(Lw,this,void 0),C(Vw,this,!1),C(Gw,this,[]),null!==(t=M(Hw,this))&&void 0!==t&&t.__tickerThrottler&&M(Hw,this).__tickerThrottler.dispose(),C(Hw,this,null)}}function Yw(){return M(Bw,this)?M(Bw,this).signal:void 0}function Qw(){return this._disposed||M(Bw,this)&&M(Bw,this).signal.aborted}function Jw(){const t=Number(this.settings.maxSegmentLoadAttempts);return Number.isFinite(t)&&t>0?t:1/0}function Zw(t){const e=A(Kw,this,Jw).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 tx(t){return!!t&&(!!A(Kw,this,Zw).call(this,t)||A(Kw,this,ex).call(this,t))}function ex(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 nx(t){if(!t||A(Kw,this,ex).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 ix(t){t&&(t.manifestLoadError&&(t.manifestLoadAttempts=0,t.manifestLoadError=void 0,"failed"===t.state&&(t.state="pending",t.error=void 0)),(Array.isArray(t.tracks)?t.tracks:[]).forEach((t=>{(Array.isArray(null==t?void 0:t.segments)?t.segments:[]).forEach((t=>{A(Kw,this,nx).call(this,t)}))})))}function rx(){(M(Aw,this)&&"function"==typeof M(Aw,this).list?M(Aw,this).list():[]).forEach((t=>{A(Kw,this,ix).call(this,t)}))}function ox(t,{allowSeekKeep:e=!1,segmentOffset:n}={}){const i=oy(),r=i?i.signal:A(Kw,this,Yw).call(this);return t&&M(Rw,this).set(t,{controller:i,allowSeekKeep:!!e,segmentOffset:n}),{signal:r,controller:i}}function sx(t,e,n={}){const i=M(Rw,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 ax(t,e){const n=M(Rw,this).get(t);n&&(e&&n.controller!==e||M(Rw,this).delete(t))}function lx(t,e){const n=new Set;return(Array.isArray(t)?t:[]).forEach((t=>{const i=null==t?void 0:t.nodeId;if(!i)return;const r=M(Aw,this)&&"function"==typeof M(Aw,this).get?M(Aw,this).get(i):void 0;if(!r)return;const o=A(Kw,this,wx).call(this,r,t,e);Number.isFinite(o)&&n.add(`${i}:${o}`)})),n}function cx(t){M(Rw,this).size&&M(Rw,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 ux(){M(Mw,this)&&"function"==typeof M(Mw,this).on&&(C(zw,this,(t=>{A(Kw,this,vx).call(this,t)})),M(Mw,this).on(Bu.PLACEMENT_ADDED,M(zw,this)),C(jw,this,(t=>A(Kw,this,dx).call(this,t))),M(Mw,this).on(Bu.TIMELINE_SEEKING,M(jw,this)),C(Uw,this,(t=>A(Kw,this,hx).call(this,t))),M(Mw,this).on(Bu.TIMELINE_SEEKED,M(Uw,this)),C($w,this,(()=>A(Kw,this,mx).call(this))),M(Mw,this).on(Bu.TIMELINE_RESET,M($w,this))),M(Aw,this)&&"function"==typeof M(Aw,this).on&&(C(Ww,this,(()=>{Vk(M(Hw,this),100)})),M(Aw,this).on(Bu.NODE_CHILDREN_CHANGED,M(Ww,this))),"function"==typeof Du.addEventListener&&(C(qw,this,(()=>A(Kw,this,px).call(this))),Du.addEventListener("online",M(qw,this)))}function dx(t={}){if(A(Kw,this,Qw).call(this))return;const e=Number(null==t?void 0:t.targetTime);if(!Number.isFinite(e))return;const n=Array.isArray(null==t?void 0:t.placements)?t.placements:[],i=A(Kw,this,lx).call(this,n,e);A(Kw,this,cx).call(this,i),C(Vw,this,!0),C(Gw,this,n.map((t=>{const n=null==t?void 0:t.nodeId;if(n)return{nodeId:n,placement:t,targetTime:e}})).filter(Boolean)),setTimeout((()=>A(Kw,this,yx).call(this)),0)}function hx(t={}){var e;if(A(Kw,this,Qw).call(this))return;C(Vw,this,!1),C(Gw,this,[]);const n=Number.isFinite(null==t?void 0:t.targetTime)?Number(t.targetTime):Number(null===(e=M(Mw,this))||void 0===e?void 0:e.currentTime);A(Kw,this,fx).call(this,n),setTimeout((()=>A(Kw,this,yx).call(this)),0)}function fx(t){var e;(Array.isArray(null===(e=M(Mw,this))||void 0===e?void 0:e.placements)?M(Mw,this).placements:[]).forEach((e=>{if(!e)return;const n=qp(e);if(Number.isFinite(n)){if(Number.isFinite(t)){if(n>=t)return void A(Kw,this,vx).call(this,e);const i=Up(e,M(Aw,this));return Number.isFinite(i)?void(n+i>t&&A(Kw,this,vx).call(this,e)):void(n<=t&&A(Kw,this,vx).call(this,e))}A(Kw,this,vx).call(this,e)}}))}function px(){var t;A(Kw,this,Qw).call(this)||(A(Kw,this,rx).call(this),C(Vw,this,!1),C(Gw,this,[]),A(Kw,this,fx).call(this,Number(null===(t=M(Mw,this))||void 0===t?void 0:t.currentTime)),C(Ow,this,A(Kw,this,Nx).call(this)),setTimeout((()=>A(Kw,this,yx).call(this)),0))}function mx(){M(Bw,this)&&M(Bw,this).abort(),C(Bw,this,oy()),M(Rw,this).size&&M(Rw,this).forEach((t=>{(null==t?void 0:t.controller)&&t.controller.abort()})),M(Rw,this).clear(),M(Fw,this).clear(),M(Cw,this).clear(),C(Ow,this,[]),M(Pw,this).clear(),C(Dw,this,!1),C(Lw,this,void 0),C(Vw,this,!1),C(Gw,this,[])}function vx(t){if(A(Kw,this,Qw).call(this))return;const e=null==t?void 0:t.nodeId;if(!e)return;const n=M(Fw,this).get(e);if(n){const i=qp(n),r=qp(t);Number.isFinite(i)?Number.isFinite(r)&&r<i&&M(Fw,this).set(e,t):Number.isFinite(r)&&M(Fw,this).set(e,t)}else M(Fw,this).set(e,t);const i=M(Lw,this);C(Lw,this,e),i&&i!==e&&C(Ow,this,[]),M(Dw,this)?setTimeout((()=>A(Kw,this,yx).call(this)),0):A(Kw,this,gx).call(this)}function gx(){M(Dw,this)||M(Fw,this).size&&(C(Dw,this,!0),A(Kw,this,yx).call(this))}async function yx(){if(A(Kw,this,Qw).call(this))return;if(M(Pw,this).size>=this.settings.maxConcurrentLoads)return;if(M(Vw,this))return void(M(Gw,this).length&&A(Kw,this,bx).call(this));const t=A(Kw,this,Tx).call(this);if(t.hasPending)A(Kw,this,Ex).call(this,t);else for(M(Ow,this).length||C(Ow,this,A(Kw,this,Nx).call(this));M(Pw,this).size<this.settings.maxConcurrentLoads&&M(Ow,this).length;){const t=M(Ow,this).shift();A(Kw,this,Cx).call(this,t,"partial").finally((()=>{setTimeout((()=>A(Kw,this,yx).call(this)),0)}))}}function bx(){if(A(Kw,this,Qw).call(this))return;const t=Math.max(0,this.settings.maxConcurrentLoads-M(Pw,this).size);if(!t||!M(Gw,this).length)return;const e=[],n=[];for(let i=0;i<M(Gw,this).length;i+=1){const r=M(Gw,this)[i];(null==r?void 0:r.nodeId)&&(e.length<t&&!M(Pw,this).has(r.nodeId)?e.push(r):n.push(r))}C(Gw,this,n),e.forEach((t=>{A(Kw,this,kx).call(this,t).finally((()=>{setTimeout((()=>A(Kw,this,yx).call(this)),0)}))}))}async function kx(t={}){const e=null==t?void 0:t.nodeId,n=null==t?void 0:t.placement,i=Number(null==t?void 0:t.targetTime);if(!e||!n||!Number.isFinite(i))return;if(M(Pw,this).has(e))return;const{signal:r,controller:o}=A(Kw,this,ox).call(this,e);if(r&&r.aborted)A(Kw,this,ax).call(this,e,o);else{M(Pw,this).add(e);try{const t=M(Aw,this)&&"function"==typeof M(Aw,this).get?M(Aw,this).get(e):void 0;if(!t)return;if("ready"!==t.state&&"function"==typeof t.resolve)try{await t.resolve({signal:r})}catch(t){return}if("ready"!==t.state)return;const s=A(Kw,this,wx).call(this,t,n,i);if(!Number.isFinite(s)){const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks.map((t=>null==t?void 0:t.type)).filter(Boolean):[];return void this.log.debug(`[#loadSeekWork] No seek segment offset for node [${e}] targetTime=${i} mainTrackId=${(null==t?void 0:t.mainTrackId)||"n/a"} trackTypes=[${n.join(",")}]`)}"function"==typeof t.loadMediaSegmentsAtOffset?(this.log.debug(`[#loadSeekWork] Loading seek segment for node [${e}] at offset=${s}`),A(Kw,this,sx).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){ay(t,r)||this.log.warn(`[#loadSeekWork] SegmentLoadCoordinator failed to seek-load node ${e}: ${(null==t?void 0:t.message)||t}`)}finally{M(Pw,this).delete(e),A(Kw,this,ax).call(this,e,o)}}}function wx(t,e,n){var i;const r=qp(e);if(!Number.isFinite(r))return;const o=Sw(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=Sw(null===(i=l)||void 0===i?void 0:i.offset),d=Uy(c,Math.max(0,s-u),{preferRepresentationTime:!0}),h=Number(null==d?void 0:d.offset);return Number.isFinite(h)?h:void 0}function xx(t,e,n=(t=>null===(t=M(Mw,this))||void 0===t?void 0:t.currentTime)()){var i;const r=(Array.isArray(null===(i=M(Mw,this))||void 0===i?void 0:i.placements)?M(Mw,this).placements:[]).filter((e=>(null==e?void 0:e.nodeId)===t&&Number.isFinite(qp(e)))).sort(((t,e)=>qp(t)-qp(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=qp(e);if(!Number.isFinite(n))continue;const i=Up(e,M(Aw,this)),l=Number.isFinite(i)&&i>=0;(!a&&n>=o-Ew&&(a=e),l)?o+Ew>=n&&o<n+i-Ew&&(s=e):o+Ew>=n&&(s=e)}return s||a||r[r.length-1]}function _x(t,e){var n;const i=Number(qp(e));if(!Number.isFinite(i))return;const r=Up(e,M(Aw,this)),o=Number.isFinite(r)&&r>=0?i+r:void 0,s=(Array.isArray(null===(n=M(Mw,this))||void 0===n?void 0:n.placements)?M(Mw,this).placements:[]).filter((e=>(null==e?void 0:e.nodeId)===t&&Number.isFinite(qp(e)))).sort(((t,e)=>qp(t)-qp(e)));for(let t=0;t<s.length;t+=1){const e=s[t],n=Number(qp(e));if(Number.isFinite(n)&&!(n<=i+Ew)){if(Number.isFinite(o)&&n>o+Ew)return;return e}}}function Tx(){const t=[];let e=!1,n=1/0;if(M(Fw,this).forEach(((i,r)=>{if(!r||!i)return;const o=M(Cw,this).get(r);if(o)return e=!0,void(n=Math.min(n,Sw(o.timelineStart)));const s=A(Kw,this,Ix).call(this,r,i);s&&(e=!0,n=Math.min(n,Sw(s.timelineStart)),t.push(s))})),!e||!Number.isFinite(n))return{hasPending:!1,waveTime:void 0,startable:[]};const i=t.filter((t=>Sw(t.timelineStart)===n&&!M(Pw,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 Ex({waveTime:t,startable:e}){const n=Math.max(0,this.settings.maxConcurrentLoads-M(Pw,this).size);n&&e.length&&e.slice(0,n).forEach((e=>{A(Kw,this,Ax).call(this,e,t).finally((()=>{setTimeout((()=>A(Kw,this,yx).call(this)),0)}))}))}function Ix(t,e){var n,i;const r=M(Aw,this)&&"function"==typeof M(Aw,this).get?M(Aw,this).get(t):void 0;if(!r)return;if("function"==typeof r.hasExceededManifestLoadAttempts&&r.hasExceededManifestLoadAttempts())return void M(Fw,this).delete(t);const o=A(Kw,this,xx).call(this,t,e,null===(n=M(Mw,this))||void 0===n?void 0:n.currentTime),s=Number(qp(o)),a=Sw(null===(i=M(Mw,this))||void 0===i?void 0:i.currentTime),l="function"==typeof r.loadMediaSegmentsAtOffset,c="function"==typeof r.load;if(!l&&!c)return void M(Fw,this).delete(t);if(r.isLoaded)return void M(Fw,this).delete(t);if("ready"!==r.state){if(!Number.isFinite(s))return;return{nodeId:t,segmentOffset:0,timelineStart:s}}if(!A(Kw,this,Ox).call(this,r))return void M(Fw,this).delete(t);const u=Array.isArray(r.tracks)?r.tracks:[],d=u.some((t=>{const e=(Array.isArray(null==t?void 0:t.segments)?t.segments:[]).find((t=>(null==t?void 0:t.isInit)&&Array.isArray(null==t?void 0:t.representations)));return!!e&&!A(Kw,this,tx).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/Ew)*Ew;h.add(t)}}))}));const f=Array.from(h).sort(((t,e)=>t-e)),p=e=>{const n=Number(qp(e));if(!Number.isFinite(n))return{status:"none"};const i=Sw(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+Ew;t+=1)s=t;const l=f.slice(s);if(!l.some((t=>A(Kw,this,Sx).call(this,r,t))))return{status:f.slice(0,s).some((t=>A(Kw,this,Sx).call(this,r,t)))?"beforeOnly":"none"};const c=l.find((t=>A(Kw,this,Sx).call(this,r,t))),u=Math.max(0,Sw(c)-i);return{status:"work",work:{nodeId:t,segmentOffset:c,timelineStart:n+u}}},m=p(o);if("work"===m.status)return m.work;if("beforeOnly"!==m.status){if(d&&Number.isFinite(s))return{nodeId:t,segmentOffset:0,timelineStart:s};M(Fw,this).delete(t)}else{const e=A(Kw,this,_x).call(this,t,o);if(e){const t=p(e);if("work"===t.status)return t.work}}}function Sx(t,e){const n=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[],i=Sw(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)<=Ew&&!A(Kw,this,tx).call(this,t)}))))}async function Ax(t,e){const n=null==t?void 0:t.nodeId,i=null==t?void 0:t.segmentOffset;if(this.log.debug(`[#loadP0Work] Loading ${Iw} node [${n}] at segmentOffset=${i} wave=${e}`),!n)return;const r=M(Aw,this)&&"function"==typeof M(Aw,this).get?M(Aw,this).get(n):void 0;if(!r)return void M(Fw,this).delete(n);const o="function"==typeof r.loadMediaSegmentsAtOffset&&Number.isFinite(i),{signal:s,controller:a}=A(Kw,this,ox).call(this,n,{allowSeekKeep:o,segmentOffset:i});if(s&&s.aborted)A(Kw,this,ax).call(this,n,a);else{M(Pw,this).add(n),M(Cw,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(ay(t,s))return;const e=`[#loadP0Work] SegmentLoadCoordinator failed to load ${Iw} work for node ${n}: ${(null==t?void 0:t.message)||t}`;this.log.warn(e)}finally{this.log.debug(`[#loadP0Work] Finished ${Iw} work for node [${n}]`),M(Cw,this).delete(n),M(Pw,this).delete(n),A(Kw,this,ax).call(this,n,a)}}}function Nx(){const t=new Set([...M(Fw,this).keys(),...M(Pw,this)]),e=A(Kw,this,Mx).call(this),n=Array.isArray(null==e?void 0:e.orderedIds)?e.orderedIds:null,i=Array.isArray(null==e?void 0:e.reachableIds)&&e.reachableIds.length?new Set(e.reachableIds):null,r=t=>!("function"==typeof t.hasExceededManifestLoadAttempts&&t.hasExceededManifestLoadAttempts()||t.isLoaded||"ready"===t.state&&A(Kw,this,Px).call(this,t));if(i){const e=Mk({prioritizer:M(Nw,this),repository:M(Aw,this),startNodeId:M(Lw,this),prioritizedIds:n,pendingIds:t,allowedIds:i,filter:r});if(e.length)return e}return Mk({prioritizer:M(Nw,this),repository:M(Aw,this),startNodeId:M(Lw,this),prioritizedIds:n,pendingIds:t,filter:r})}function Mx(){return M(Nw,this)&&M(Lw,this)?"function"==typeof M(Nw,this).getPrioritizationSnapshot?M(Nw,this).getPrioritizationSnapshot(M(Lw,this)):{orderedIds:"function"==typeof M(Nw,this).sortNodes?M(Nw,this).sortNodes(M(Lw,this)):[],reachableIds:"function"==typeof M(Nw,this).getReachableNodeIds?M(Nw,this).getReachableNodeIds(M(Lw,this)):[]}:null}function Fx(){A(Kw,this,Qw).call(this)||(M(Dw,this)||M(Fw,this).size)&&(C(Ow,this,A(Kw,this,Nx).call(this)),M(Dw,this)&&!M(Vw,this)&&A(Kw,this,yx).call(this))}async function Cx(t,e){if(this.log.debug(`[#loadNode] Loading node [${t}] in '${e}' mode`),!t)return;const n=M(Aw,this)&&"function"==typeof M(Aw,this).get?M(Aw,this).get(t):void 0;if(!n||"function"!=typeof n.load)return;if("function"==typeof n.hasExceededManifestLoadAttempts&&n.hasExceededManifestLoadAttempts())return;if(n.isLoaded)return void this.log.debug(`[#loadNode] Skipping load for ${t}: already loaded`);const{signal:i,controller:r}=A(Kw,this,ox).call(this,t,{allowSeekKeep:!1});if(i&&i.aborted)A(Kw,this,ax).call(this,t,r);else try{if("ready"!==n.state&&await n.resolve({signal:i}),"ready"!==n.state)return void this.log.debug(`[#loadNode] Skipping load for ${t}: not ready`);if("partial"===e&&A(Kw,this,Px).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${t}: partial already loaded`);if(!A(Kw,this,Ox).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${t}: no loadable tracks`);M(Pw,this).add(t),await n.load({loadingMode:e,signal:i})}catch(e){if(ay(e,i))return;this.log.warn(`[#loadNode] SegmentLoadCoordinator failed to load node ${t}: ${(null==e?void 0:e.message)||e}`)}finally{this.log.debug(`[#loadNode] Finished loading node [${t}]`),M(Pw,this).delete(t),A(Kw,this,ax).call(this,t,r)}}function Ox(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 Px(t){const e=(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).filter((t=>Array.isArray(null==t?void 0:t.segments)&&t.segments.length));return!e.length||e.every((t=>{const e=Array.isArray(null==t?void 0:t.segments)?t.segments:[];if(!e.length)return!0;const n=e.find((t=>null==t?void 0:t.isInit)),i=e.find((t=>t&&!t.isInit));return!(n&&!A(Kw,this,tx).call(this,n)||i&&!A(Kw,this,tx).call(this,i))}))}class Rx extends Ou{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 Dx(t){if(!t)throw new Error("Assertion failed.")}const Lx=t=>t&&t[t.length-1],Bx=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)},zx=t=>t.constructor===Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t),Wx=t=>t.constructor===DataView?t:ArrayBuffer.isView(t)?new DataView(t.buffer,t.byteOffset,t.byteLength):new DataView(t),jx=new TextDecoder,Ux=t=>Object.fromEntries(Object.entries(t).map((([t,e])=>[e,t]))),$x={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},qx=Ux($x),Vx={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},Gx=Ux(Vx),Hx={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},Kx=Ux(Hx),Xx=t=>[...t].map((t=>t.toString(16).padStart(2,"0"))).join(""),Yx=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,Qx=(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},Jx=(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},Zx=()=>{let t,e;return{promise:new Promise(((n,i)=>{t=n,e=i})),resolve:t,reject:e}},t_=(t,e,n)=>t.getUint8(e)<<16|t.getUint8(e+1)<<8|t.getUint8(e+2),e_=(t,e,n)=>Math.max(e,Math.min(n,t)),n_=/^[a-z]{3}$/,i_=1e6*(1+Number.EPSILON);let r_=null;let o_=null;const s_=()=>{if(null!==o_)return o_;if("undefined"==typeof navigator)return null;const t=/\bChrome\/(\d+)/.exec(navigator.userAgent);return t?o_=Number(t[1]):null},a_=t=>"number"==typeof t&&!Number.isNaN(t);class l_{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 c_={default:!0,forced:!1,original:!1,commentary:!1,hearingImpaired:!1,visuallyImpaired:!1};class u_{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 u_(this.bytes);return t.pos=this.pos,t}}const d_=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],h_=[-1,1,2,3,4,5,6,8],f_=t=>{if(!t||t.byteLength<2)throw new TypeError("AAC description must be at least 2 bytes long.");const e=new u_(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<d_.length&&(r=d_[i]);const o=e.readBits(4);let s=null;return o>=1&&o<=7&&(s=h_[o]),{objectType:n,frequencyIndex:i,sampleRate:r,channelConfiguration:o,numberOfChannels:s}},p_=["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"],m_=[{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}],v_=t=>{const{codec:e,codecDescription:n,colorSpace:i,avcCodecInfo:r,hevcCodecInfo:o,vp9CodecInfo:s,av1CodecInfo:a}=t;if("avc"===e){if(Dx(null!==t.avcType),r){const e=new Uint8Array([r.avcProfileIndication,r.profileCompatibility,r.avcLevelIndication]);return`avc${t.avcType}.${Xx(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}.${Xx(n.subarray(1,4))}`}if("hevc"===e){let t,e,i,r,s,a;if(o)t=o.generalProfileSpace,e=o.generalProfileIdc,i=Yx(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=Wx(n),l=o.getUint8(1);t=l>>6&3,e=31&l,i=Yx(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=Lx(m_).level;for(const t of m_)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=Lx(m_).level;for(const t of m_)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?$x[i.primaries]:1,u=null!=i&&i.transfer?Vx[i.transfer]:1,d=null!=i&&i.matrix?Hx[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}'.`)},g_=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:f_(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&&p_.includes(e))return e;throw new TypeError(`Unhandled codec '${e}'.`)},y_=/^pcm-([usf])(\d+)+(be)?$/,b_=[48e3,44100,32e3],k_=[24e3,22050,16e3];var w_,x_;!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"}(w_||(w_={})),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"}(x_||(x_={}));const __=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})},T_=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=t_(i,n):(Dx(4===e),t=i.getUint32(n,!1)),n+=e,yield{offset:n,length:t},n+=t}},E_=t=>31&t,I_=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 u_(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);Dx(e.pos%8==0),yield{type:i,data:t.subarray(e.pos/8,e.pos/8+s)},e.skipBits(8*s)}};var N_;!function(t){t[t.STREAMINFO=0]="STREAMINFO",t[t.VORBIS_COMMENT=4]="VORBIS_COMMENT",t[t.PICTURE=6]="PICTURE"}(N_||(N_={}));const M_=[2,1,2,3,3,4,4,5];class F_{constructor(t){this.input=t}}const C_=[],O_=[],P_=new Uint8Array(0);class R_{constructor(t,e,n,i,r=-1,o,s){if(this.data=t,this.type=e,this.timestamp=n,this.duration=i,this.sequenceNumber=r,t===P_&&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===P_}get microsecondTimestamp(){return Math.trunc(i_*this.timestamp)}get microsecondDuration(){return Math.trunc(i_*this.duration)}toEncodedVideoChunk(){if(this.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be converted to a video chunk.");if("undefined"==typeof EncodedVideoChunk)throw new Error("Your browser does not support EncodedVideoChunk.");return new EncodedVideoChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}alphaToEncodedVideoChunk(t=this.type){if(!this.sideData.alpha)throw new TypeError("This packet does not contain alpha side data.");if(this.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be converted to a video chunk.");if("undefined"==typeof EncodedVideoChunk)throw new Error("Your browser does not support EncodedVideoChunk.");return new EncodedVideoChunk({data:this.sideData.alpha,type:t,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}toEncodedAudioChunk(){if(this.isMetadataOnly)throw new TypeError("Metadata-only packets cannot be converted to an audio chunk.");if("undefined"==typeof EncodedAudioChunk)throw new Error("Your browser does not support EncodedAudioChunk.");return new EncodedAudioChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}static fromEncodedChunk(t,e){var n;if(!(t instanceof EncodedVideoChunk||t instanceof EncodedAudioChunk))throw new TypeError("chunk must be an EncodedVideoChunk or EncodedAudioChunk.");const i=new Uint8Array(t.byteLength);return t.copyTo(i),new R_(i,t.type,t.timestamp/1e6,(null!==(n=t.duration)&&void 0!==n?n:0)/1e6,void 0,void 0,e)}clone(t){var e,n,i,r,o,s;if(void 0!==t&&("object"!=typeof t||null===t))throw new TypeError("options, when provided, must be an object.");if(void 0!==(null==t?void 0:t.data)&&!(t.data instanceof Uint8Array))throw new TypeError("options.data, when provided, must be a Uint8Array.");if(void 0!==(null==t?void 0:t.type)&&"key"!==t.type&&"delta"!==t.type)throw new TypeError('options.type, when provided, must be either "key" or "delta".');if(void 0!==(null==t?void 0:t.timestamp)&&!Number.isFinite(t.timestamp))throw new TypeError("options.timestamp, when provided, must be a number.");if(void 0!==(null==t?void 0:t.duration)&&!Number.isFinite(t.duration))throw new TypeError("options.duration, when provided, must be a number.");if(void 0!==(null==t?void 0:t.sequenceNumber)&&!Number.isFinite(t.sequenceNumber))throw new TypeError("options.sequenceNumber, when provided, must be a number.");if(void 0!==(null==t?void 0:t.sideData)&&("object"!=typeof t.sideData||null===t.sideData))throw new TypeError("options.sideData, when provided, must be an object.");return new R_(null!==(e=null==t?void 0:t.data)&&void 0!==e?e:this.data,null!==(n=null==t?void 0:t.type)&&void 0!==n?n:this.type,null!==(i=null==t?void 0:t.timestamp)&&void 0!==i?i:this.timestamp,null!==(r=null==t?void 0:t.duration)&&void 0!==r?r:this.duration,null!==(o=null==t?void 0:t.sequenceNumber)&&void 0!==o?o:this.sequenceNumber,this.byteLength,null!==(s=null==t?void 0:t.sideData)&&void 0!==s?s:this.sideData)}}const D_=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.")},L_=t=>{if(!a_(t))throw new TypeError("timestamp must be a number.")},B_=(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 z_{constructor(t){if(!(t instanceof W_))throw new TypeError("track must be an InputTrack.");this._track=t}getFirstPacket(t={}){if(D_(t),this._track.input._disposed)throw new hT;return B_(this._track,this._track._backing.getFirstPacket(t),t)}async getFirstKeyPacket(t={}){D_(t);const e=await this.getFirstPacket(t);return e?"key"===e.type?e:this.getNextKeyPacket(e,t):null}getPacket(t,e={}){if(L_(t),D_(e),this._track.input._disposed)throw new hT;return B_(this._track,this._track._backing.getPacket(t,e),e)}getNextPacket(t,e={}){if(!(t instanceof R_))throw new TypeError("packet must be an EncodedPacket.");if(D_(e),this._track.input._disposed)throw new hT;return B_(this._track,this._track._backing.getNextPacket(t,e),e)}async getKeyPacket(t,e={}){if(L_(t),D_(e),this._track.input._disposed)throw new hT;if(!e.verifyKeyPackets)return this._track._backing.getKeyPacket(t,e);const n=await this._track._backing.getKeyPacket(t,e);return n?(Dx("key"===n.type),"delta"===await this._track.determinePacketType(n)?this.getKeyPacket(n.timestamp-1/this._track.timeResolution,e):n):n}async getNextKeyPacket(t,e={}){if(!(t instanceof R_))throw new TypeError("packet must be an EncodedPacket.");if(D_(e),this._track.input._disposed)throw new hT;if(!e.verifyKeyPackets)return this._track._backing.getNextKeyPacket(t,e);const n=await this._track._backing.getNextKeyPacket(t,e);return n?(Dx("key"===n.type),"delta"===await this._track.determinePacketType(n)?this.getNextKeyPacket(n,e):n):n}packets(t,e,n={}){if(void 0!==t&&!(t instanceof R_))throw new TypeError("startPacket must be an EncodedPacket.");if(void 0!==t&&t.isMetadataOnly&&(null==n||!n.metadataOnly))throw new TypeError("startPacket can only be metadata-only if options.metadataOnly is enabled.");if(void 0!==e&&!(e instanceof R_))throw new TypeError("endPacket must be an EncodedPacket.");if(D_(n),this._track.input._disposed)throw new hT;const i=[];let{promise:r,resolve:o}=Zx(),{promise:s,resolve:a}=Zx(),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}=Zx()),await s):(i.push(u),o(),({promise:r,resolve:o}=Zx()),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 hT;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 W_{constructor(t,e){this.input=t,this._backing=e}isVideoTrack(){return this instanceof j_}isAudioTrack(){return this instanceof U_}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 z_(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 j_ extends W_{constructor(t,e){super(t,e),this._backing=e,this.pixelAspectRatio=(t=>{Dx(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 Dx(null!==e),C_.some((n=>n.supports(e,t)))?!0:"undefined"!=typeof VideoDecoder&&!0===(await VideoDecoder.isConfigSupported(t)).supported}catch(t){return console.error("Error during decodability check:",t),!1}}async determinePacketType(t){if(!(t instanceof R_))throw new TypeError("packet must be an EncodedPacket.");if(t.isMetadataOnly)throw new TypeError("packet must not be metadata-only to determine its type.");if(null===this.codec)return null;const e=await this.getDecoderConfig();return Dx(e),((t,e,n)=>{switch(t){case"avc":for(const t of((t,e)=>{if(e.description){const n=3&zx(e.description)[4];return T_(t,n+1)}return __(t)})(n,e)){const e=n[t.offset],r=E_(e);if(r>=w_.NON_IDR_SLICE&&r<=w_.SLICE_DPC)return"delta";if(r===w_.IDR)return"key";if(r===w_.SEI&&(i=void 0,!(null!==r_?r_:r_=!("undefined"==typeof navigator||(null===(i=navigator.vendor)||void 0===i||!i.includes("Google Inc"))&&!/Chrome/.test(navigator.userAgent)))||s_()>=144)){const e=n.subarray(t.offset,t.offset+t.length),i=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 u_(i);t.pos=8*r;const e=Bx(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&zx(e.description)[21];return T_(t,n+1)}return __(t)})(n,e)){const e=S_(n[t.offset]);if(e<x_.BLA_W_LP)return"delta";if(e<=x_.RSV_IRAP_VCL23)return"key"}return"delta";case"vp8":return 1&n[0]?"delta":"key";case"vp9":{const t=new u_(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 u_(i);e.skipBits(4),t=!!e.readBits(1)}else if(3===e||6===e||7===e){if(t)return"key";const e=new u_(i);return e.readBits(1)?null:0===e.readBits(2)?"key":"delta"}return null}default:(t=>{throw new Error(`Unexpected value: ${t}`)})(t),Dx(!1)}var i})(this.codec,e,t.data)}}class U_ extends W_{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 Dx(null!==e),O_.some((n=>n.supports(e,t)))?!0:!!t.codec.startsWith("pcm-")||"undefined"!=typeof AudioDecoder&&!0===(await AudioDecoder.isConfigSupported(t)).supported}catch(t){return console.error("Error during decodability check:",t),!1}}async determinePacketType(t){if(!(t instanceof R_))throw new TypeError("packet must be an EncodedPacket.");return null===this.codec?null:"key"}}const $_=t=>{let e=wT(t);const n=IT(t,4);let i=8;1===e&&(e=_T(t),i=16);const r=e-i;return r<0?null:{name:n,totalSize:e,headerSize:i,contentSize:r}},q_=t=>xT(t)/65536,V_=t=>xT(t)/1073741824,G_=t=>{let e=0;for(let n=0;n<4;n++){e<<=7;const n=gT(t);if(e|=127&n,!(128&n))break}return e},H_=t=>{let e=yT(t);return t.skip(2),e=Math.min(e,t.remainingLength),jx.decode(vT(t,e))},K_=t=>{const e=$_(t);if(!e||"data"!==e.name)return null;if(t.remainingLength<8)return null;const n=wT(t);t.skip(4);const i=vT(t,e.contentSize-8);switch(n){case 1:return jx.decode(i);case 2:return new TextDecoder("utf-16be").decode(i);case 13:return new l_(i,"image/jpeg");case 14:return new l_(i,"image/png");case 27:return new l_(i,"image/bmp");default:return i}};class X_ extends F_{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=$_(e);if(!i)break;if("ftyp"===i.name){const t=IT(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),Dx(t);const e=wT(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=$_(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,Dx(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&&p_.includes(t.info.codec)&&0===n.sampleCompositionTimeOffsets.length){var r;Dx("audio"===(null===(r=t.info)||void 0===r?void 0:r.type));const e=(t=>{if(Dx(p_.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=y_.exec(t);let n;return Dx(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=Jx(n.sampleTimingEntries,a,(t=>t.startIndex)),u=n.sampleTimingEntries[c],d=Jx(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=Lx(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),Dx(n);const i=$_(n);Dx("moof"===(null==i?void 0:i.name));let r=this.reader.requestSlice(t,i.totalSize);r instanceof Promise&&(r=await r),Dx(r),this.traverseBox(r);const o=this.lastReadFragment;Dx(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)iT(t,i.timestamp);else{const e=Jx(n,o.moofOffset-1,(t=>t.moofOffset));if(-1!==e){const i=n[e];iT(t,i.endTimestamp)}}t.startTimestampIsFinal=!0}const i=Jx(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=$_(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,w,x,_,T,E,I,S,A,N,M,F,C,O,P,R,D;const L=t.filePos,B=$_(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=gT(t);t.skip(3),1===e?(t.skip(16),this.movieTimescale=wT(t),this.movieDurationInTimescale=_T(t)):(t.skip(8),this.movieTimescale=wT(t),this.movieDurationInTimescale=wT(t))}break;case"trak":{const e={id:-1,demuxer:this,inputTrack:null,disposition:{...c_},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 j_(this.input,new Q_(t)),this.tracks.push(e)}else if("audio"===e.info.type&&-1!==e.info.numberOfChannels){const t=e;e.inputTrack=new U_(this.input,new J_(t)),this.tracks.push(e)}this.currentTrack=null}break;case"tkhd":{const e=this.currentTrack;if(!e)break;const n=gT(t),i=!!(1&bT(t));if(e.disposition.default=i,0===n)t.skip(8),e.id=wT(t),t.skip(4),e.durationInMovieTimescale=wT(t);else{if(1!==n)throw new Error(`Incorrect track header version ${n}.`);t.skip(16),e.id=wT(t),t.skip(4),e.durationInMovieTimescale=_T(t)}t.skip(16);const r=[q_(t),q_(t),V_(t),q_(t),q_(t),V_(t),q_(t),q_(t),V_(t)],o=(t=>{const e=(t%360+360)%360;if(0===e||90===e||180===e||270===e)return e;throw new Error(`Invalid rotation ${t}.`)})((Ct=rT(r),90*Math.round(Ct/90)));Dx(0===o||90===o||180===o||270===o),e.rotation=o}break;case"elst":{const e=this.currentTrack;if(!e)break;const n=gT(t);t.skip(3);let i=!1,r=0;const o=wT(t);for(let s=0;s<o;s++){const o=1===n?_T(t):wT(t),s=1===n?TT(t):xT(t),a=q_(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=gT(t);t.skip(3),0===n?(t.skip(8),e.timescale=wT(t),e.durationInMediaTimescale=wT(t)):1===n&&(t.skip(16),e.timescale=wT(t),e.durationInMediaTimescale=_T(t));let i=yT(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,n_.test(Ft)||(e.languageCode="und")}}break;case"hdlr":{const e=this.currentTrack;if(!e)break;t.skip(8);const n=IT(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=gT(t);t.skip(3);const i=wT(t);for(let r=0;r<i;r++){const i=t.filePos,r=$_(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=yT(t),e.info.height=yT(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=yT(t);t.skip(6);let a=yT(t),l=yT(t);t.skip(4);let c=wT(t)/65536;if(0===n&&s>0)if(1===s)t.skip(4),l=8*wT(t),t.skip(8);else if(2===s){t.skip(4),c=ET(t),a=wT(t),t.skip(4),l=wT(t);const n=wT(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;Dx(e.info),e.info.codecDescription=vT(t,B.contentSize)}break;case"hvcC":{const e=this.currentTrack;if(!e)break;Dx(e.info),e.info.codecDescription=vT(t,B.contentSize)}break;case"vpcC":{var j;const e=this.currentTrack;if(!e)break;Dx("video"===(null===(j=e.info)||void 0===j?void 0:j.type)),t.skip(4);const n=gT(t),i=gT(t),r=gT(t),o=r>>4,s=r>>1&7,a=1&r,l=gT(t),c=gT(t),u=gT(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;Dx("video"===(null===(U=e.info)||void 0===U?void 0:U.type)),t.skip(1);const n=gT(t),i=n>>5,r=31&n,o=gT(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(Dx("video"===(null===($=e.info)||void 0===$?void 0:$.type)),"nclx"!==IT(t,4))break;const n=yT(t),i=yT(t),r=yT(t),o=Boolean(128&gT(t));e.info.colorSpace={primaries:qx[n],transfer:Gx[i],matrix:Kx[r],fullRange:o}}break;case"pasp":{var q;const e=this.currentTrack;if(!e)break;Dx("video"===(null===(q=e.info)||void 0===q?void 0:q.type));const n=wT(t),i=wT(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;Dx("audio"===(null===(V=e.info)||void 0===V?void 0:V.type)),t.skip(4),Dx(3===gT(t)),G_(t),t.skip(2);const n=gT(t),i=!!(64&n),r=!!(32&n);if(!!(128&n)&&t.skip(2),i){const e=gT(t);t.skip(e)}r&&t.skip(2),Dx(4===gT(t));const o=G_(t),s=t.filePos,a=gT(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){Dx(5===gT(t));const n=G_(t);if(e.info.codecDescription=vT(t,n),"aac"===e.info.codec){const t=f_(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;Dx("audio"===(null===(G=e.info)||void 0===G?void 0:G.type)),255&yT(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;Dx("audio"===(null===(H=e.info)||void 0===H?void 0:H.type)),t.skip(4);const n=gT(t),i=Boolean(1&n),r=gT(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;Dx("audio"===(null===(K=e.info)||void 0===K?void 0:K.type)),t.skip(1);const n=gT(t),i=yT(t),r=wT(t),o=kT(t),s=gT(t);let a;a=0!==s?vT(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;Dx("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=gT(t),o=bT(t);if((r&n)===N_.STREAMINFO){t.skip(10);const n=wT(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=vT(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;Dx("audio"===(null===(Y=e.info)||void 0===Y?void 0:Y.type));const n=vT(t,3),i=new u_(n),r=i.readBits(2);i.skipBits(8);const o=i.readBits(3),s=i.readBits(1);r<3&&(e.info.sampleRate=b_[r]),e.info.numberOfChannels=M_[o]+s}break;case"dec3":{var Q;const e=this.currentTrack;if(!e)break;Dx("audio"===(null===(Q=e.info)||void 0===Q?void 0:Q.type));const n=(t=>{if(t.length<2)return null;const e=new u_(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}})(vT(t,B.contentSize));if(!n){console.warn("Invalid dec3 box contents, ignoring.");break}const i=(t=>{const e=t.substreams[0];return Dx(e),e.fscod<3?b_[e.fscod]:null!==e.fscod2&&e.fscod2<3?k_[e.fscod2]:null})(n);null!==i&&(e.info.sampleRate=i),e.info.numberOfChannels=(t=>{const e=t.substreams[0];Dx(e);let n=M_[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=wT(t);let i=0,r=0;for(let o=0;o<n;o++){const n=wT(t),o=wT(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=wT(t);let i=0;for(let r=0;r<n;r++){const n=wT(t),r=xT(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=wT(t),i=wT(t);if(0===n)for(let n=0;n<i;n++){const n=wT(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=gT(t),i=wT(t),r=vT(t,Math.ceil(i*n/8)),o=new u_(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=wT(t);for(let i=0;i<n;i++){const n=wT(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=wT(t);for(let i=0;i<n;i++){const n=wT(t)-1,i=wT(t),r=wT(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=wT(t);for(let i=0;i<n;i++){const n=wT(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=wT(t);for(let i=0;i<n;i++){const n=_T(t);e.sampleTable.chunkOffsets.push(n)}}break;case"mvex":this.isFragmented=!0,this.readContiguousBoxes(t.slice(z,B.contentSize));break;case"mehd":{const e=gT(t);t.skip(3);const n=1===e?_T(t):wT(t);this.movieDurationInTimescale=n}break;case"trex":{t.skip(4);const e=wT(t),n=wT(t),i=wT(t),r=wT(t),o=wT(t);this.fragmentTrackDefaults.push({trackId:e,defaultSampleDescriptionIndex:n,defaultSampleDuration:i,defaultSampleSize:r,defaultSampleFlags:o})}break;case"tfra":{const e=gT(t);t.skip(3);const n=wT(t),i=this.tracks.find((t=>t.id===n));if(!i)break;const r=wT(t),o=(12&r)>>2,s=3&r,a=[gT,yT,bT,wT],l=a[(48&r)>>4],c=a[o],u=a[s],d=wT(t);for(let n=0;n<d;n++){const n=1===e?_T(t):wT(t),r=1===e?_T(t):wT(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(Dx(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;Dx(e),null!==e.startTimestamp&&(iT(t,e.startTimestamp),t.startTimestampIsFinal=!0)}this.currentTrack.currentFragmentState=null,this.currentTrack=null}break;case"tfhd":{var J,Z,tt,et;Dx(this.currentFragment),t.skip(1);const e=bT(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=wT(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=_T(t):l&&(u.currentFragmentState.baseDataOffset=this.currentFragment.moofOffset),i&&(u.currentFragmentState.sampleDescriptionIndex=wT(t)),r&&(u.currentFragmentState.defaultSampleDuration=wT(t)),o&&(u.currentFragmentState.defaultSampleSize=wT(t)),s&&(u.currentFragmentState.defaultSampleFlags=wT(t)),a&&(u.currentFragmentState.defaultSampleDuration=0)}break;case"tfdt":{const e=this.currentTrack;if(!e)break;Dx(e.currentFragmentState);const n=gT(t);t.skip(3);const i=0===n?wT(t):_T(t);e.currentFragmentState.startTimestamp=i}break;case"trun":{const e=this.currentTrack;if(!e)break;if(Dx(this.currentFragment),Dx(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=gT(t),i=bT(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=wT(t);let d=e.currentFragmentState.baseDataOffset;r&&(d+=xT(t));let h=null;o&&(h=wT(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=wT(t):(Dx(null!==e.currentFragmentState.defaultSampleDuration),r=e.currentFragmentState.defaultSampleDuration),a?o=wT(t):(Dx(null!==e.currentFragmentState.defaultSampleSize),o=e.currentFragmentState.defaultSampleSize),l?u=wT(t):(Dx(null!==e.currentFragmentState.defaultSampleFlags),u=e.currentFragmentState.defaultSampleFlags),0===i&&null!==h&&(u=h);let d=0;c&&(d=0===n?wT(t):xT(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[Lx(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]=H_(y)):null!==(ct=(at=this.metadataTags.raw)[lt=t.name])&&void 0!==ct||(at[lt]=vT(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=jx.decode(vT(y,t.contentSize)):null!==(n=(e=this.metadataTags).title)&&void 0!==n||(e.title=H_(y));break;case"©des":this.currentTrack||null!==(r=(i=this.metadataTags).description)&&void 0!==r||(i.description=H_(y));break;case"©ART":this.currentTrack||null!==(s=(o=this.metadataTags).artist)&&void 0!==s||(o.artist=H_(y));break;case"©alb":this.currentTrack||null!==(l=(a=this.metadataTags).album)&&void 0!==l||(a.album=H_(y));break;case"albr":this.currentTrack||null!==(u=(c=this.metadataTags).albumArtist)&&void 0!==u||(c.albumArtist=H_(y));break;case"©gen":this.currentTrack||null!==(h=(d=this.metadataTags).genre)&&void 0!==h||(d.genre=H_(y));break;case"©day":if(!this.currentTrack){var ut,dt;const t=new Date(H_(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=H_(y));break;case"©lyr":this.currentTrack||null!==(v=(m=this.metadataTags).lyrics)&&void 0!==v||(m.lyrics=H_(y))}}}break;case"meta":{if(this.currentTrack)break;const e=0!==wT(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=wT(t);for(let n=0;n<e;n++){const e=wT(t);t.skip(4);const i=jx.decode(vT(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=K_(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!==(x=(w=this.metadataTags).artist)&&void 0!==x||(w.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!==(I=(E=this.metadataTags).albumArtist)&&void 0!==I||(E.albumArtist=r));break;case"©cmt":case"com.apple.quicktime.comment":case"comment":"string"==typeof r&&(null!==(A=(S=this.metadataTags).comment)&&void 0!==A||(S.comment=r));break;case"©gen":case"gnre":case"com.apple.quicktime.genre":case"genre":"string"==typeof r&&(null!==(M=(N=this.metadataTags).genre)&&void 0!==M||(N.genre=r));break;case"©lyr":case"lyrics":"string"==typeof r&&(null!==(C=(F=this.metadataTags).lyrics)&&void 0!==C||(F.lyrics=r));break;case"©day":case"rldt":case"com.apple.quicktime.creationdate":case"date":if("string"==typeof r){var gt,yt;const t=new Date(r);Number.isNaN(t.getTime())||null!==(yt=(gt=this.metadataTags).date)&&void 0!==yt||(gt.date=t)}break;case"covr":case"com.apple.quicktime.artwork":r instanceof l_?(null!==(P=(O=this.metadataTags).images)&&void 0!==P||(O.images=[]),this.metadataTags.images.push({data:r.data,kind:"coverFront",mimeType:r.mimeType})):r instanceof Uint8Array&&(null!==(D=(R=this.metadataTags).images)&&void 0!==D||(R.images=[]),this.metadataTags.images.push({data:r,kind:"coverFront",mimeType:"image/*"}));break;case"track":if("string"==typeof r){var bt,kt,wt,xt;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!==(xt=(wt=this.metadataTags).tracksTotal)&&void 0!==xt||(wt.tracksTotal=n))}break;case"trkn":if(r instanceof Uint8Array&&r.length>=6){var _t,Tt,Et,It;const t=Wx(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!==(It=(Et=this.metadataTags).tracksTotal)&&void 0!==It||(Et.tracksTotal=n))}break;case"disc":case"disk":if(r instanceof Uint8Array&&r.length>=6){var St,At,Nt,Mt;const t=Wx(r),e=t.getUint16(2,!1),n=t.getUint16(4,!1);e>0&&(null!==(At=(St=this.metadataTags).discNumber)&&void 0!==At||(St.discNumber=e)),n>0&&(null!==(Mt=(Nt=this.metadataTags).discsTotal)&&void 0!==Mt||(Nt.discsTotal=n))}}}}}var Ft,Ct;return t.filePos=W,!0}}class Y_{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=Z_(i,n),o=await this.fetchPacketForSampleIndex(r,e);return oT(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=Jx(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=tT(i,n),o=await this.fetchPacketForSampleIndex(r,e);return oT(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=nT(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 Dx(-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=eT(n,t);if(!i)return null;let r;if(e.metadataOnly)r=P_;else{let t=this.internalTrack.demuxer.reader.requestSlice(i.sampleOffset,i.sampleSize);t instanceof Promise&&(t=await t),Dx(t),r=vT(t,i.sampleSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new R_(r,i.isKeyFrame?"key":"delta",o,s,t,i.sampleSize);return this.packetToSampleIndex.set(a,t),a}async fetchPacketInFragment(t,e,n){if(-1===e)return null;const i=t.trackData.get(this.internalTrack.id).samples[e];let r;if(Dx(i),n.metadataOnly)r=P_;else{let t=this.internalTrack.demuxer.reader.requestSlice(i.byteOffset,i.byteSize);t instanceof Promise&&(t=await t),Dx(t),r=vT(t,i.byteSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new R_(r,i.isKeyFrame?"key":"delta",o,s,t.moofOffset+e,i.byteSize);return this.packetToFragmentLocation.set(a,{fragment:t,sampleIndex:e}),a}async performFragmentedLookup(t,e,n,i,r){var o,s;const a=this.internalTrack.demuxer;let l=null,c=null,u=-1;if(t){const{sampleIndex:n,correctSampleFound:i}=e(t);if(i)return this.fetchPacketInFragment(t,n,r);-1!==n&&(c=t,u=n)}const d=Jx(this.internalTrack.fragmentLookupTable,n,(t=>t.timestamp)),h=-1!==d?this.internalTrack.fragmentLookupTable[d]:null,f=Jx(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=$_(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];Dx(!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 Q_ extends Y_{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 u_(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 u_(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=Lx(m_).level;for(const t of m_)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:v_(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 J_ extends Y_{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:g_(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 Z_=(t,e)=>{if(t.presentationTimestamps){const n=Jx(t.presentationTimestamps,e,(t=>t.presentationTimestamp));return-1===n?-1:t.presentationTimestamps[n].sampleIndex}{const n=Jx(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)}},tT=(t,e)=>{if(!t.keySampleIndices)return Z_(t,e);if(t.presentationTimestamps){const n=Jx(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!==Qx(t.keySampleIndices,n,(t=>t)))return n}return-1}{var n;const i=Z_(t,e),r=Jx(t.keySampleIndices,i,(t=>t));return null!==(n=t.keySampleIndices[r])&&void 0!==n?n:-1}},eT=(t,e)=>{const n=Jx(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=Jx(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=Jx(t.sampleToChunk,e,(t=>t.startSampleIndex)),c=t.sampleToChunk[l];Dx(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];Dx(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!==Qx(t.keySampleIndices,e,(t=>t))}},nT=(t,e)=>{var n;if(!t.keySampleIndices)return e+1;const i=Jx(t.keySampleIndices,e,(t=>t));return null!==(n=t.keySampleIndices[i+1])&&void 0!==n?n:-1},iT=(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},rT=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},oT=t=>0===t.sampleSizes.length;class sT{}class aT extends sT{async _getMajorBrand(t){let e=t._reader.requestSlice(0,12);return e instanceof Promise&&(e=await e),e?(e.skip(4),"ftyp"!==IT(e,4)?null:IT(e,4)):null}_createDemuxer(t){return new X_(t)}}const lT=new class extends aT{async _canReadInput(t){const e=await this._getMajorBrand(t);return!!e&&"qt "!==e}get name(){return"MP4"}get mimeType(){return"video/mp4"}};class cT{constructor(){this._disposed=!1,this._sizePromise=null,this.onread=null}async getSizeOrNull(){var t;if(this._disposed)throw new hT;return null!==(t=this._sizePromise)&&void 0!==t?t:this._sizePromise=Promise.resolve(this._retrieveSize())}async getSize(){if(this._disposed)throw new hT;const t=await this.getSizeOrNull();if(null===t)throw new Error("Cannot determine the size of an unsized source.");return t}}class uT extends cT{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&&(!a_(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=Jx(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:Wx(o),offset:t};this._currentIndex>r&&this._throwDueToCacheMiss();const{promise:s,resolve:a,reject:l}=Zx();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:Wx(e.bytes),offset:e.start}),this._pendingSlices.splice(t,1),t--))}for(this._cache.push({start:i,end:r,bytes:n,view:Wx(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!==(le=Symbol.dispose)&&void 0!==le||(Symbol.dispose=Symbol("Symbol.dispose"));class dT{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 sT))))throw new TypeError("options.formats must be an array of InputFormat.");if(!(t.source instanceof cT))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 fT(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(),Dx(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 hT extends Error{constructor(t="Input has been disposed."){super(t),this.name="InputDisposedError"}}class fT{constructor(t){this.source=t}requestSlice(t,e){if(this.source._disposed)throw new hT;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 pT(e.bytes,e.view,e.offset,t,n):null)):i?new pT(i.bytes,i.view,i.offset,t,n):null}requestSliceRange(t,e,n){if(this.source._disposed)throw new hT;if(t<0)return null;if(null!==this.fileSize)return this.requestSlice(t,e_(this.fileSize-t,e,n));{const i=this.requestSlice(t,n),r=i=>{if(i)return i;const r=i=>(Dx(null!==i),this.requestSlice(t,e_(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 pT{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 pT(t,Wx(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 pT(this.bytes,this.view,this.offset,t,t+e)}}const mT=(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.`)},vT=(t,e)=>{mT(t,e);const n=t.bytes.subarray(t.bufferPos,t.bufferPos+e);return t.bufferPos+=e,n},gT=t=>(mT(t,1),t.view.getUint8(t.bufferPos++)),yT=t=>{mT(t,2);const e=t.view.getUint16(t.bufferPos,!1);return t.bufferPos+=2,e},bT=t=>{mT(t,3);const e=t_(t.view,t.bufferPos);return t.bufferPos+=3,e},kT=t=>{mT(t,2);const e=t.view.getInt16(t.bufferPos,!1);return t.bufferPos+=2,e},wT=t=>{mT(t,4);const e=t.view.getUint32(t.bufferPos,!1);return t.bufferPos+=4,e},xT=t=>{mT(t,4);const e=t.view.getInt32(t.bufferPos,!1);return t.bufferPos+=4,e},_T=t=>4294967296*wT(t)+wT(t),TT=t=>4294967296*xT(t)+wT(t),ET=t=>{mT(t,8);const e=t.view.getFloat64(t.bufferPos,!1);return t.bufferPos+=8,e},IT=(t,e)=>{mT(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,NT=new WeakMap,MT=new WeakMap,FT=new WeakMap,CT=new WeakMap,OT=new WeakMap,PT=new WeakMap,RT=new WeakMap,DT=new WeakMap,LT=new WeakMap,BT=new WeakMap,zT=new WeakMap,WT=new WeakMap,jT=new WeakMap,UT=new WeakSet;class $T extends Ou{constructor(...t){super(...t),O(this,UT),F(this,ST,null),F(this,AT,null),F(this,NT,null),F(this,MT,null),F(this,FT,!1),F(this,CT,!1),F(this,OT,!1),F(this,PT,!1),F(this,RT,void 0),F(this,DT,null),F(this,LT,null),F(this,BT,!1),F(this,zT,!1),F(this,WT,null),F(this,jT,!1)}get name(){return"FMP4Demuxer"}get defaults(){return{}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"pushChunk","endOfStream"])}pushChunk(t,e={}){if(M(OT,this)||M(PT,this))return;const n=t instanceof Uint8Array?t:new Uint8Array(t),i=!!e.isInit;C(DT,this,A(UT,this,XT).call(this,n,e,i)),i&&(C(RT,this,n),C(LT,this,null),this.trigger("demux:init",{data:n})),A(UT,this,KT).call(this);try{var r;const t=null===(r=M(ST,this))||void 0===r?void 0:r.write(n);t&&"function"==typeof t.catch&&t.catch((t=>{A(UT,this,YT).call(this,t)}))}catch(t){if(M(OT,this)||A(UT,this,qT).call(this,t))return;return this.log.warn("[FMP4Demuxer] mediabunny demux failed",t),void A(UT,this,YT).call(this,t)}const o=A(UT,this,ZT).call(this);o&&"function"==typeof o.catch&&o.catch((t=>{A(UT,this,YT).call(this,t)}))}endOfStream(){if(M(PT,this))return;if(M(BT,this))return;let t;C(BT,this,!0),C(zT,this,!1),C(jT,this,!1);try{var e;t=null===(e=M(ST,this))||void 0===e?void 0:e.close()}catch(e){t=Promise.resolve()}let n=!1;A(UT,this,GT).call(this),C(WT,this,setTimeout((()=>{C(WT,this,null),n||M(zT,this)||M(PT,this)||A(UT,this,HT).call(this)}),20)),Promise.resolve(t).catch((()=>{})).finally((()=>{n=!0,A(UT,this,GT).call(this),A(UT,this,HT).call(this)}))}onDispose(){super.onDispose(),C(PT,this,!0);try{var t,e;null===(t=M(NT,this))||void 0===t||null===(e=t.close)||void 0===e||e.call(t)}catch(t){}this.endOfStream();try{var n,i;null===(n=M(AT,this))||void 0===n||null===(i=n.dispose)||void 0===i||i.call(n)}catch(t){}C(NT,this,null),C(AT,this,null),C(OT,this,!1),C(DT,this,null),C(MT,this,null),C(FT,this,!1),C(CT,this,!1),C(BT,this,!1),C(zT,this,!1),C(jT,this,!1),A(UT,this,GT).call(this)}}function qT(t){return!!M(PT,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 VT(){try{var t,e;const n=null===(t=M(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){}C(ST,this,null)}function GT(){null!==M(WT,this)&&(clearTimeout(M(WT,this)),C(WT,this,null))}function HT(){if(M(zT,this)||M(PT,this)||M(OT,this))return;if(C(zT,this,!0),M(CT,this))return void C(jT,this,!0);C(jT,this,!1);const t=A(UT,this,ZT).call(this);t&&"function"==typeof t.catch&&t.catch((t=>{A(UT,this,YT).call(this,t)}))}function KT(){if(M(AT,this)&&M(ST,this))return;const t=Du.TransformStream;if(void 0===t)throw new Error("TransformStream is not available in this environment");const{readable:e,writable:n}=new t;C(ST,this,n.getWriter()),C(AT,this,new dT({source:new uT(e),formats:[lT]})),C(FT,this,!1)}function XT(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 YT(t){if(M(OT,this)||A(UT,this,qT).call(this,t))return;if(A(UT,this,JT).call(this,t))return void C(FT,this,!1);C(OT,this,!0),A(UT,this,VT).call(this);try{var e,n;null===(e=M(NT,this))||void 0===e||null===(n=e.close)||void 0===n||n.call(e)}catch(t){}C(NT,this,null);try{var i,r;null===(i=M(AT,this))||void 0===i||null===(r=i.dispose)||void 0===r||r.call(i)}catch(t){}C(AT,this,null);const o={error:t,recoverable:!1,severity:"fatal",streamClosed:M(BT,this),streamFinalized:M(zT,this)};M(DT,this)&&(o.context={...M(DT,this)}),this.trigger("demux:error",o)}function QT(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 JT(t){return!!A(UT,this,QT).call(this,t)&&(!M(zT,this)||M(jT,this))}async function ZT(){if(!(M(PT,this)||M(OT,this)||M(FT,this)||M(CT,this))){C(CT,this,!0);try{A(UT,this,KT).call(this);const t=await M(AT,this).getPrimaryVideoTrack(),e=t?null:await M(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 M(AT,this).getMimeType();this.trigger("demux:init",{...M(RT,this)?{data:M(RT,this)}:{},decoderConfig:i,codec:r,mimeType:o}),C(NT,this,new z_(n)),C(FT,this,!0),C(MT,this,(async()=>{try{for await(const t of M(NT,this).packets()){if(M(PT,this))break;const e="number"==typeof t.timestamp?t.timestamp:0;null===M(LT,this)&&C(LT,this,e);let n=e-M(LT,this);n<0&&(n=0),this.trigger("demux:sample",{data:t.data,pts:n,dts:n,duration:t.duration,isKey:"key"===t.type})}this.trigger("demux:complete")}catch(t){A(UT,this,YT).call(this,t)}})())}catch(t){if(A(UT,this,JT).call(this,t))return;throw t}finally{C(CT,this,!1),!M(jT,this)||M(OT,this)||M(PT,this)||A(UT,this,HT).call(this)}}}const tE=1e6,eE=24e3/1001,nE={primaries:"bt709",transfer:"bt709",matrix:"bt709",fullRange:!0},iE=new Uint8Array;function rE(t){return t?t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):iE:iE}let oE=null;const sE={video:(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,we=new WeakMap,xe=new WeakMap,_e=new WeakMap,Te=new WeakMap,Ee=new WeakMap,Ie=new WeakMap,Se=new WeakMap,Ae=new WeakMap,Ne=new WeakMap,Me=new WeakMap,Fe=new WeakMap,Ce=new WeakMap,Oe=new WeakMap,Pe=new WeakMap,Re=new WeakMap,De=new WeakMap,Le=new WeakMap,Be=new WeakMap,ze=new WeakMap,We=new WeakMap,je=new WeakMap,Ue=new WeakMap,$e=new WeakSet,class extends Rx{get name(){return"WebCodecsSegmentDecoder"}get defaults(){return{decodedHorizonSeconds:1,maxDecodedFrames:24,maxDecodeQueueSize:4,av1ColorSpaceOverrideEnabled:!0,convertFramesToBitmapsOnAndroid:!0,androidFixEndOfSegmentDelta:.2}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"decodeChunk"])}constructor(...t){super(...t),O(this,$e),F(this,ce,void 0),F(this,ue,[]),F(this,de,void 0),F(this,he,void 0),F(this,fe,void 0),F(this,pe,void 0),F(this,me,[]),F(this,ve,void 0),F(this,ge,new Map),F(this,ye,!0),F(this,be,!1),F(this,ke,!1),F(this,we,!1),F(this,xe,void 0),F(this,_e,!1),F(this,Te,!1),F(this,Ee,0),F(this,Ie,void 0),F(this,Se,void 0),F(this,Ae,{}),F(this,Ne,void 0),F(this,Me,0),F(this,Fe,null),F(this,Ce,!1),F(this,Oe,null),F(this,Pe,void 0),F(this,Re,0),F(this,De,0),F(this,Le,0),F(this,Be,0),F(this,ze,!1),F(this,We,!1),F(this,je,.2),F(this,Ue,Promise.resolve()),C(de,this,this.settings.decodedHorizonSeconds||1),C(he,this,A($e,this,QE).call(this,this.settings.maxDecodedFrames)),C(fe,this,A($e,this,ZE).call(this,this.settings.maxDecodeQueueSize)),C(ze,this,Um()),C(We,this,A($e,this,$E).call(this,this.settings.convertFramesToBitmapsOnAndroid)),C(je,this,A($e,this,qE).call(this,this.settings.androidFixEndOfSegmentDelta)),C(pe,this,(()=>0)),C(ve,this,(()=>A($e,this,OE).call(this)));const e=this.settings.demuxerOptions?{FMP4Demuxer:this.settings.demuxerOptions}:{};C(ce,this,new $T(e)),M(ce,this).on("demux:init",(t=>A($e,this,_E).call(this,t))),M(ce,this).on("demux:sample",(t=>A($e,this,TE).call(this,t))),M(ce,this).on("demux:complete",(()=>A($e,this,EE).call(this))),M(ce,this).on("demux:error",(t=>A($e,this,hE).call(this,t)))}setCurrentTimeProvider(t){"function"==typeof t&&C(pe,this,t)}setTimeOffsetSeconds(t){const e=Number(t);C(Me,this,Number.isFinite(e)?e:0)}setSeekTargetTimeSeconds(t){const e=Number(t);C(Fe,this,Number.isFinite(e)?e:null),C(Ce,this,!1),C(Oe,this,null)}endOfStream(){M(ce,this)&&"function"==typeof M(ce,this).endOfStream&&M(ce,this).endOfStream()}configure(t){super.configure(t),C(Ae,this,{codec:A($e,this,rI).call(this,t),width:(null==t?void 0:t.codedWidth)||(null==t?void 0:t.width),height:(null==t?void 0:t.codedHeight)||(null==t?void 0:t.height)}),C(Ie,this,M(Ae,this).codec)}setSegment(t){this.lastSegment=t,A($e,this,bE).call(this)}setNodeId(t){C(Pe,this,t)}decode(t){this.setSegment(t);const e=null==t?void 0:t.arrayBuffer;e&&M(ce,this).pushChunk(e,{isInit:!(null==t||!t.isInit)})}async decodeChunk(t,e={}){await M(ce,this).pushChunk(t,{isInit:!!e.isInit,pts:"number"==typeof e.pts?e.pts:void 0,dts:"number"==typeof e.dts?e.dts:void 0,duration:"number"==typeof e.duration?e.duration:void 0,isKey:!!e.isKey,loaded:"number"==typeof e.loaded?e.loaded:void 0,total:"number"==typeof e.total?e.total:void 0})}get decodedFrames(){return M(ue,this).slice()}onDispose(){if(super.onDispose(),A($e,this,DE).call(this),M(ce,this)&&"function"==typeof M(ce,this).dispose&&M(ce,this).dispose(),C(ue,this,[]),C(me,this,[]),M(ge,this).clear(),C(Oe,this,null),M(xe,this)&&"function"==typeof M(xe,this).close)try{M(xe,this).close()}catch(t){}C(xe,this,null),C(_e,this,!1),C(Se,this,null),C(Ie,this,null),C(Pe,this,null),C(Ue,this,Promise.resolve()),A($e,this,bE).call(this)}}),audio:(qe=new WeakMap,Ve=new WeakMap,Ge=new WeakMap,He=new WeakMap,Ke=new WeakMap,Xe=new WeakMap,Ye=new WeakMap,Qe=new WeakSet,class extends Rx{constructor(...t){super(...t),O(this,Qe),F(this,qe,void 0),F(this,Ve,[]),F(this,Ge,0),F(this,He,!1),F(this,Ke,!1),F(this,Xe,void 0),F(this,Ye,0)}get name(){return"WebAudioDecoder"}setSegment(t){C(Xe,this,t)}setTimeOffsetSeconds(t){const e=Number(t);C(Ye,this,Number.isFinite(e)?e:0)}decode(t){if(this.lastSegment=t,!t)return;if(t.isInit)return void C(qe,this,rE(t.arrayBuffer));const e=t.arrayBuffer;e&&A(Qe,this,cE).call(this,rE(e),!0)}decodeChunk(t,e={}){if(!t)return;if(e.isInit)return void C(qe,this,rE(t));const n=rE(t);if(!n.length)return;M(Ve,this).push(n),C(Ge,this,M(Ge,this)+n.length);const i=Number(e.loaded),r=Number(e.total);Number.isFinite(i)&&Number.isFinite(r)&&r>0&&i>=r&&A(Qe,this,aE).call(this)}endOfStream(){A(Qe,this,aE).call(this)}onDispose(){super.onDispose(),C(qe,this,void 0),C(Ve,this,[]),C(Ge,this,0),C(He,this,!1),C(Ke,this,!1),C(Xe,this,void 0)}}),image:class extends Rx{#D;#L=0;#B=[];#z=0;#W;get name(){return"ImageDecoder"}setSegment(t){this.#D=t}setTimeOffsetSeconds(t){const e=Number(t);this.#L=Number.isFinite(e)?e:0}decode(t){super.decode(t),t&&(this.#D=t);const e=null==t?void 0:t.arrayBuffer;e instanceof ArrayBuffer&&(this.#B=[new Uint8Array(e)],this.#z=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.#B.push(n),this.#z+=n.length)}async endOfStream(){var t,e,n;if(this.#W)return;if(!(this.#B.length&&this.#z>0))return;const i=new Uint8Array(this.#z);let r=0;for(let t=0;t<this.#B.length;t+=1){const e=this.#B[t];i.set(e,r),r+=e.length}const o=null===(t=this.#D)||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 Du.Blob)return;const n="string"==typeof e?e:"";return new Du.Blob([t],n?{type:n}:void 0)}(t,e);if(!n)throw new Error("Image decode requires Blob support");let i;if("function"==typeof Du.Image&&Du.URL&&"function"==typeof Du.URL.createObjectURL&&"function"==typeof Du.URL.revokeObjectURL){const t=Du.URL.createObjectURL(n);try{const e=new Du.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{Du.URL.revokeObjectURL(t)}}if("function"==typeof Du.createImageBitmap)try{return Du.createImageBitmap(n)}catch(t){i=t}if(i)throw i;throw new Error("No supported image decode mechanism")}(i,s);this.#W=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&&(Cg(o.width)||(o.width=e.width),Cg(o.height)||(o.height=e.height)),this.trigger("decoder:frame",{pts:this.#L,duration:Cg(null===(a=this.#D)||void 0===a?void 0:a.duration)?this.#D.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.#W&&"function"==typeof this.#W.close)try{this.#W.close()}catch(t){}this.#W=null,this.#B=[],this.#z=0,this.#D=null}}};function aE(){if(M(He,this)||M(Ke,this))return;if(!M(Ge,this))return;const t=A(Qe,this,lE).call(this);t.length&&A(Qe,this,cE).call(this,t,!1)}function lE(){const t=M(qe,this),e=t?t.length:0,n=e+M(Ge,this);if(!n)return iE;const i=new Uint8Array(n);let r=0;e&&(i.set(t,r),r+=e);for(let t=0;t<M(Ve,this).length;t+=1){const e=M(Ve,this)[t];e&&e.length&&(i.set(e,r),r+=e.length)}return i}function cE(t,e){if(M(He,this)||M(Ke,this))return;const n=e?A(Qe,this,uE).call(this,t):t;if(!n||!n.length)return;const i=function(){if(oE)return oE;const t=Du.AudioContext||Du.webkitAudioContext;return t?(oE=new t,oE):null}();if(!i||"function"!=typeof i.decodeAudioData)return void this.trigger("decoder:error",{error:new Error("AudioContext is not available")});const r=n.buffer.slice(0);C(Ke,this,!0),new Promise(((t,e)=>{const n=i.decodeAudioData(r,t,e);n&&"function"==typeof n.then&&n.then(t).catch(e)})).then((t=>{var e;C(He,this,!0);const n=Number.isFinite(null==t?void 0:t.duration)?t.duration:Number(null===(e=M(Xe,this))||void 0===e?void 0:e.duration)||void 0;this.trigger("decoder:audio",{audioBuffer:t,pts:M(Ye,this),duration:n})})).catch((t=>{this.trigger("decoder:error",{error:t})})).finally((()=>{C(Ve,this,[]),C(Ge,this,0),C(Ke,this,!1)}))}function uE(t){const e=M(qe,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 dE(t,e){var n,i,r,o,s;const a=null!=t&&t.context&&"object"==typeof t.context?t.context:void 0;return{error:e,errorName:null==e?void 0:e.name,errorMessage:"string"==typeof(null==e?void 0:e.message)?e.message:void 0,nodeId:M(Pe,this),trackId:null===(n=this.track)||void 0===n?void 0:n.id,trackType:null===(i=this.track)||void 0===i?void 0:i.type,codec:(null===(r=M(Ae,this))||void 0===r?void 0:r.codec)||M(Ie,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 hE(t){const e=(null==t?void 0:t.error)||t,n=A($e,this,dE).call(this,t,e);if(A($e,this,fE).call(this,t,e))return this.log.warn("[onDemuxError] recoverable demux error",n),void A($e,this,EE).call(this);const i=A($e,this,xE).call(this,t),r=A($e,this,pE).call(this,i);if(i&&0===i.missingFrames)return this.log.warn(`[onDemuxError] ignoring demux error (no missing frames)${r}`,{...n,missingFrameStats:i}),void A($e,this,EE).call(this);let o=n;i&&(o={...n,missingFrameStats:i}),this.log.warn(`[onDemuxError] demux error${r}`,o),this.trigger("decoder:error",t)}function fE(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 pE(t){return t?` expectedFrames=${A($e,this,mE).call(this,t.expectedFrames)} demuxedFrames=${A($e,this,mE).call(this,t.demuxedFrames)} missingFrames=${A($e,this,mE).call(this,t.missingFrames)}`:""}function mE(t){if(null==t)return"unknown";const e=Number(t);return Number.isFinite(e)?String(e):"unknown"}function vE(t,e={}){return{expectedFrames:null,demuxedFrames:M(Re,this),missingFrames:null,reason:t,...e}}function gE(t){const e=Number(t);return Number.isFinite(e)?e:null}function yE(t){var e,n;const i=(null==t?void 0:t.context)||{},r=Number(i.loaded),o=Number(i.total);if(!Number.isFinite(o)||o<=0||!Number.isFinite(r)||r<o)return null;if(null!==(e=this.lastSegment)&&void 0!==e&&e.isInit)return null;const s=Number(null===(n=this.lastSegment)||void 0===n?void 0:n.duration);if(!Number.isFinite(s)||s<=0)return A($e,this,vE).call(this,"segment_duration_unavailable",{segmentDurationSeconds:A($e,this,gE).call(this,s),demuxedCoverageSeconds:M(Be,this),frameDurationSeconds:null});const a=A($e,this,wE).call(this);if(!Number.isFinite(a)||a<=0){const t=Math.max(1,Math.round(s*eE));return{expectedFrames:t,demuxedFrames:M(Re,this),missingFrames:Math.max(0,t-M(Re,this)),reason:"fallback_fps",fallbackFps:eE,segmentDurationSeconds:s,demuxedCoverageSeconds:M(Be,this),frameDurationSeconds:A($e,this,gE).call(this,a)}}const l=Math.min(.5*a,.02),c=Math.max(0,s-M(Be,this)),u=c<=l?0:c,d=Math.max(1,Math.floor((s+l)/a)),h=Math.max(0,d-M(Re,this)),f=u>0?Math.ceil(u/a):0;return{expectedFrames:d,demuxedFrames:M(Re,this),missingFrames:Math.max(h,f),segmentDurationSeconds:s,demuxedCoverageSeconds:M(Be,this),frameDurationSeconds:a}}function bE(){C(Re,this,0),C(De,this,0),C(Le,this,0),C(Be,this,0)}function kE(t){C(Re,this,M(Re,this)+1);const e=Number(null==t?void 0:t.pts),n=Number(null==t?void 0:t.duration);if(Number.isFinite(n)&&n>0&&(C(De,this,M(De,this)+n),C(Le,this,M(Le,this)+1)),!Number.isFinite(e))return;const i=Number.isFinite(n)&&n>0?e+n:e;Number.isFinite(i)&&i>M(Be,this)&&C(Be,this,i)}function wE(){return M(Le,this)>0?M(De,this)/M(Le,this):M(Re,this)>0&&M(Be,this)>0?M(Be,this)/M(Re,this):null}function xE(t){return A($e,this,yE).call(this,t)}function _E(t){(null==t?void 0:t.data)instanceof Uint8Array&&(C(Se,this,t.data.buffer),A($e,this,BE).call(this)),null!=t&&t.decoderConfig&&(C(Ne,this,t.decoderConfig),C(Ie,this,t.decoderConfig.codec||M(Ie,this)),A($e,this,BE).call(this)),this.trigger("decoder:init",t)}function TE(t){A($e,this,kE).call(this,t),M(me,this).push(t),A($e,this,OE).call(this)}function EE(){C(be,this,!0),A($e,this,WE).call(this)}function IE(t){const e="number"==typeof(null==t?void 0:t.pts)?t.pts:void 0;if(Number.isFinite(e))return M(Me,this)+e}function SE(t){return M(me,this).some((e=>{const n=A($e,this,IE).call(this,e);return Number.isFinite(n)&&n>=t}))}function AE(t){let e=-1,n=null;for(let i=0;i<M(me,this).length;i+=1){const r=M(me,this)[i],o=A($e,this,IE).call(this,r);Number.isFinite(o)&&(null==r?void 0:r.isKey)&&o<=t&&(e=i,n=o)}return{chosenIndex:e,chosenPtsSeconds:n}}function NE(t){let e=-1,n=null;for(let i=0;i<M(me,this).length;i+=1){const r=M(me,this)[i],o=A($e,this,IE).call(this,r);if(Number.isFinite(o)&&null!=r&&r.isKey&&(e=i,n=o,o>=t))break}return{chosenIndex:e,chosenPtsSeconds:n}}function ME(t){const e=t+M(de,this),n=M(Fe,this);if(!Number.isFinite(n))return e;const i=Number.isFinite(M(Oe,this))?M(Oe,this):null;if(Number.isFinite(i))return Math.max(e,i);const{chosenPtsSeconds:r}=A($e,this,NE).call(this,n);return Number.isFinite(r)?Math.max(e,r):e}function FE(t){const e=M(Fe,this);Number.isFinite(e)&&Number.isFinite(t)&&t>=e&&(C(Fe,this,null),C(Oe,this,null))}function CE(){const t=M(Fe,this);if(!Number.isFinite(t)||M(Ce,this))return!0;if(!A($e,this,SE).call(this,t)&&!M(be,this))return!1;const e=A($e,this,AE).call(this,t);let n=e;if(-1===e.chosenIndex&&(n=A($e,this,NE).call(this,t)),n.chosenIndex>0){const t=`[#maybeAlignToSeekKeyframe] Dropping ${n.chosenIndex} samples before keyframe @ ${n.chosenPtsSeconds}`;this.log.debug(t),M(me,this).splice(0,n.chosenIndex)}return C(ye,this,!0),Number.isFinite(n.chosenPtsSeconds)&&C(Oe,this,n.chosenPtsSeconds),C(Ce,this,!0),!0}function OE(){const t=M(pe,this)?M(pe,this).call(this):0,e=A($e,this,ME).call(this,t);if(A($e,this,XE).call(this,t),A($e,this,YE).call(this),!A($e,this,CE).call(this))return void A($e,this,RE).call(this);const n=void 0!==Du.VideoDecoder&&void 0!==Du.EncodedVideoChunk;for(n&&!M(_e,this)&&M(Ne,this)&&A($e,this,BE).call(this);M(me,this).length&&!A($e,this,JE).call(this)&&!(n&&M(xe,this)&&A($e,this,tI).call(this));){const t=M(me,this)[0],i="number"==typeof(null==t?void 0:t.pts)?t.pts:0,r=M(Me,this)+i;if(r>e)break;if(null!=t&&t.raw)M(me,this).shift(),A($e,this,PE).call(this,t);else{if(n){if(!M(_e,this)||!M(xe,this))break;if(M(ye,this)&&!t.isKey){M(me,this).shift();continue}M(me,this).shift();const e=Math.max(0,Math.round(r*tE));M(ge,this).set(e,!!t.isKey);try{const n=new Du.EncodedVideoChunk({type:t.isKey?"key":"delta",timestamp:e,duration:t.duration?Math.round(t.duration*tE):void 0,data:t.data instanceof Uint8Array?t.data:new Uint8Array(t.data)});M(xe,this).decode(n),t.isKey&&C(ye,this,!1);continue}catch(t){M(ge,this).delete(e);const n="string"==typeof(null==t?void 0:t.message)?t.message:"";if("DataError"===(null==t?void 0:t.name)&&n.includes("key frame")){C(ye,this,!0);continue}this.log.warn("[#drainDecodeQueue] decode failed, falling back to placeholder",t)}}M(me,this).shift(),A($e,this,PE).call(this,t)}}A($e,this,WE).call(this),A($e,this,RE).call(this)}function PE(t){const e=M(pe,this)?M(pe,this).call(this):0,n=A($e,this,ME).call(this,e),i=M(Me,this)+("number"==typeof t.pts?t.pts:0);if(i<e||i>n)return;A($e,this,XE).call(this,e);const r={pts:i,duration:t.duration,data:t.data,isKey:t.isKey};M(ue,this).push(r),A($e,this,YE).call(this),this.trigger("decoder:frame",r),A($e,this,FE).call(this,i)}function RE(){if(M(me,this).length>0&&void 0!==Du.VideoDecoder){if($k(M(ve,this)))return;jk(M(ve,this),50)}else A($e,this,DE).call(this)}function DE(){M(ve,this)&&$k(M(ve,this))&&Uk(M(ve,this))}function LE(){return null!=Du&&Du.performance&&"function"==typeof Du.performance.now?Du.performance.now():Date.now()}function BE(){if(M(_e,this))return;if(void 0===Du.VideoDecoder)return;if(!M(Ne,this))return;if(M(Te,this)&&A($e,this,LE).call(this)<M(Ee,this))return;const t=A($e,this,zE).call(this);try{C(xe,this,new Du.VideoDecoder({output:t=>A($e,this,UE).call(this,t),error:t=>A($e,this,jE).call(this,t)})),M(xe,this).configure(t),C(_e,this,!0),C(ye,this,!0),C(Te,this,!1),C(Ee,this,0),A($e,this,OE).call(this)}catch(t){this.log.warn("[#maybeConfigureDecoder] configure failed, falling back to placeholder decode",t),C(xe,this,null),C(_e,this,!1),C(Ne,this,null)}}function zE(){const t={...M(Ne,this)};return A($e,this,nI).call(this,t)&&M(Ae,this).codec?t.codec=M(Ae,this).codec:!t.codec&&M(Ie,this)&&(t.codec=M(Ie,this)),M(Se,this)&&!t.description&&(t.description=M(Se,this)),M(Ae,this).width&&!t.codedWidth&&(t.codedWidth=M(Ae,this).width),M(Ae,this).height&&!t.codedHeight&&(t.codedHeight=M(Ae,this).height),A($e,this,iI).call(this,t),t}function WE(){void 0!==Du.VideoDecoder&&void 0!==Du.EncodedVideoChunk&&(M(Te,this)||!M(be,this)||M(we,this)||M(ke,this)||M(_e,this)&&M(xe,this)&&"function"==typeof M(xe,this).flush&&(M(me,this).length||(C(ke,this,!0),Promise.resolve().then((()=>M(xe,this).flush())).then((()=>{C(we,this,!0),C(ye,this,!0)})).catch((t=>{"AbortError"!==(null==t?void 0:t.name)&&this.log.warn("[#maybeFlushDecoder] flush failed",t)})).finally((()=>{C(ke,this,!1)})))))}function jE(t){if(this.log.warn("[#handleDecoderError] decoder error",t),this.trigger("decoder:error",{error:t}),M(xe,this)&&"function"==typeof M(xe,this).close)try{M(xe,this).close()}catch(t){}C(xe,this,null),C(_e,this,!1),C(ke,this,!1),C(we,this,!1),C(ye,this,!0),M(ge,this).clear(),C(Te,this,!0),C(Ee,this,A($e,this,LE).call(this)+1e3)}function UE(t){C(Ue,this,M(Ue,this).then((()=>{var e;if(!this._disposed)return A($e,this,KE).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 $E(t){return"boolean"!=typeof t||t}function qE(t){const e=Number(t);return!Number.isFinite(e)||e<0?.2:e}function VE(){return!!M(We,this)&&"function"==typeof Du.createImageBitmap&&M(ze,this)}function GE(t){var e;const n=Number(null===(e=this.lastSegment)||void 0===e?void 0:e.duration);if(!Number.isFinite(n)||n<=0)return!1;if(!Number.isFinite(t))return!1;const i=Number(M(Me,this));return!!Number.isFinite(i)&&t>=i+n-M(je,this)}async function HE(t,e){try{var n;const i=A($e,this,GE).call(this,e),r=await Du.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 KE(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/tE:M(pe,this)?M(pe,this).call(this):0,s="number"==typeof t.duration?t.duration/tE:void 0;let a;void 0!==r&&(a=M(ge,this).get(r),M(ge,this).delete(r));try{var l,c,u,d;let e=M(pe,this)?M(pe,this).call(this):0,n=A($e,this,ME).call(this,e);if(o<e||o>n)return void(null===(l=(c=i).close)||void 0===l||l.call(c));if(A($e,this,VE).call(this)){var h,f,p,m;if(i=await A($e,this,HE).call(this,t,o),this._disposed)return void(null===(h=(f=i).close)||void 0===h||h.call(f));if(e=M(pe,this)?M(pe,this).call(this):0,n=A($e,this,ME).call(this,e),o<e||o>n)return void(null===(p=(m=i).close)||void 0===p||p.call(m))}if(A($e,this,XE).call(this,e),this._disposed)return void(null===(u=(d=i).close)||void 0===u||u.call(d));const r={frame:i,pts:o,duration:s,isKey:void 0!==a&&a};M(ue,this).push(r),A($e,this,YE).call(this),this.trigger("decoder:frame",r),A($e,this,FE).call(this,o),this.log.debug(`[#handleDecodedFrame] [${M(Ae,this).codec}] Decoded frame:`,r)}catch(t){this.log.warn(`[#handleDecodedFrame] [${M(Ae,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 XE(t){const e=A($e,this,ME).call(this,t),n=[];M(ue,this).forEach((i=>{var r;const o=null!==(r=null==i?void 0:i.pts)&&void 0!==r?r:0;o<t||o>e||n.push(i)})),C(ue,this,n)}function YE(){const t=M(he,this);if(!Number.isFinite(t)||t<=0)return;if(M(ue,this).length<=t)return;const e=M(ue,this).length-t;M(ue,this).splice(0,e)}function QE(t){const e=Number(t);return!Number.isFinite(e)||e<=0?0:Math.floor(e)}function JE(){const t=M(he,this);return!(!Number.isFinite(t)||t<=0)&&M(ue,this).length>=t}function ZE(t){const e=Number(t);return!Number.isFinite(e)||e<=0?0:Math.floor(e)}function tI(){var t;const e=M(fe,this);if(!Number.isFinite(e)||e<=0)return!1;const n=Number(null===(t=M(xe,this))||void 0===t?void 0:t.decodeQueueSize);return!!Number.isFinite(n)&&n>=e}function eI(t){return"string"==typeof t&&t.toLowerCase().startsWith("av01")}function nI(t){var e;return!1!==this.settings.av1ColorSpaceOverrideEnabled&&A($e,this,eI).call(this,(null===(e=M(Ae,this))||void 0===e?void 0:e.codec)||(null==t?void 0:t.codec))}function iI(t){A($e,this,nI).call(this,t)&&(t.colorSpace={...nE})}function rI(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 oI extends Ou{#j;get name(){return"DecoderFactory"}constructor(...t){super(...t);const e=t.length?t[t.length-1]:void 0;this.#j=e&&"object"==typeof e&&!Array.isArray(e)?e:{}}create(t,e=this.#j){if(!t||!t.type)return new Rx(e);const n=sE[t.type];return n?(this.log.debug(`[#create] [${t.type}] Creating decoder:`,n),new n(e)):new Rx(e)}}class sI{#U;#$;#q;#V;constructor(t={}){this.#U=t.getActiveRenderPlacement,this.#$=t.getPlacementsActiveAtTime,this.#q=t.ensureDecodedForPlacementAtTime;const e=Number(t.lookaheadSeconds);this.#V=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.#q)return;const n="function"==typeof this.#$?this.#$:()=>[],i=n(e),r=new Set;i.forEach((t=>{null!=t&&t.placementId&&r.add(t.placementId),this.#q(t,e)}));const o=this.#V;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.#q(t,s)}))}dispose(){}}class aI{#G;#H;#K;#X;#Y;#Q;constructor(t={}){this.#G=t.getNode,this.#H=t.getPlacementState,this.#K=t.getDecodeTracks,this.#X=t.getSegmentIdForTrackAtTime,this.#Y=t.decodeLoadedMediaSegment,this.#Q=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.#G?this.#G(i):void 0;if(!r)return;const o="function"==typeof this.#H?this.#H(n):void 0,s=null==o?void 0:o.trackStates;s&&"function"==typeof s.get&&("function"==typeof this.#K?this.#K(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.#X?this.#X(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.#Y||this.#Y(t,n,a),"video"===(null==n?void 0:n.type)&&"function"==typeof this.#Q&&this.#Q(t,n,a))}))}dispose(){}}const lI=new Set(["video","audio","image"]);function cI(t){const e=Number(t);return Number.isFinite(e)?e:0}var uI=new WeakMap,dI=new WeakMap,hI=new WeakMap,fI=new WeakMap,pI=new WeakMap,mI=new WeakMap,vI=new WeakMap,gI=new WeakMap,yI=new WeakMap,bI=new WeakMap,kI=new WeakMap,wI=new WeakMap,xI=new WeakMap,_I=new WeakMap,TI=new WeakMap,EI=new WeakMap,II=new WeakMap,SI=new WeakMap,AI=new WeakMap,NI=new WeakSet;class MI extends Ou{constructor(...t){super(...t),O(this,NI),F(this,uI,void 0),F(this,dI,void 0),F(this,hI,void 0),F(this,fI,void 0),F(this,pI,void 0),F(this,mI,void 0),F(this,vI,void 0),F(this,gI,void 0),F(this,yI,void 0),F(this,bI,void 0),F(this,kI,void 0),F(this,wI,new Map),F(this,xI,new Map),F(this,_I,new Map),F(this,TI,new Map),F(this,EI,new Set),F(this,II,0),F(this,SI,!1),F(this,AI,null);const[e,n,i]=t;C(uI,this,e),C(dI,this,n),C(hI,this,i||new oI),C(fI,this,new aI({getNode:t=>A(NI,this,eS).call(this,t),getPlacementState:t=>M(wI,this).get(t),getDecodeTracks:t=>A(NI,this,YI).call(this,t),getSegmentIdForTrackAtTime:(t,e,n)=>A(NI,this,BI).call(this,t,e,n),decodeLoadedMediaSegment:(t,e,n)=>{A(NI,this,wS).call(this,t,e,n)},decodeLoadedMediaSegmentsAfter:(t,e,n)=>{A(NI,this,fS).call(this,t,e,n)}})),C(pI,this,new sI({getActiveRenderPlacement:t=>{var e,n;return null===(e=M(dI,this))||void 0===e||null===(n=e.getActiveRenderPlacement)||void 0===n?void 0:n.call(e,t)},getPlacementsActiveAtTime:t=>{var e,n;return(null===(e=M(dI,this))||void 0===e||null===(n=e.getPlacementsActiveAtTime)||void 0===n?void 0:n.call(e,t))||[]},ensureDecodedForPlacementAtTime:(t,e)=>{var n,i;null===(n=M(fI,this))||void 0===n||null===(i=n.ensureDecodedForPlacementAtTime)||void 0===i||i.call(n,t,e)}})),A(NI,this,FI).call(this),A(NI,this,HI).call(this)}get name(){return"DecodeCoordinator"}onDispose(){var t,e;M(dI,this)&&"function"==typeof M(dI,this).off&&M(mI,this)&&M(dI,this).off(Bu.PLACEMENT_ADDED,M(mI,this)),M(dI,this)&&"function"==typeof M(dI,this).off&&M(vI,this)&&M(dI,this).off(Bu.TIMELINE_SEEKING,M(vI,this)),M(dI,this)&&"function"==typeof M(dI,this).off&&M(gI,this)&&M(dI,this).off(Bu.TIMELINE_SEEKED,M(gI,this)),M(dI,this)&&"function"==typeof M(dI,this).off&&M(yI,this)&&M(dI,this).off(Bu.TIMELINE_TIME_UPDATE,M(yI,this)),M(dI,this)&&"function"==typeof M(dI,this).off&&M(bI,this)&&M(dI,this).off(Bu.TIMELINE_RESET,M(bI,this)),A(NI,this,CI).call(this),C(mI,this,null),C(vI,this,null),C(gI,this,null),C(yI,this,null),C(bI,this,null),null!==(t=M(fI,this))&&void 0!==t&&null!==(e=t.dispose)&&void 0!==e&&e.call(t),C(fI,this,null),M(pI,this)&&"function"==typeof M(pI,this).dispose&&M(pI,this).dispose(),C(pI,this,null),M(xI,this).forEach(((t,e)=>{const n=A(NI,this,eS).call(this,e);n&&"function"==typeof n.off&&n.off("node:loaded",t)})),M(xI,this).clear(),M(_I,this).forEach(((t,e)=>{const n=A(NI,this,eS).call(this,e);n&&"function"==typeof n.off&&n.off("segment:chunk",t)})),M(_I,this).clear(),M(TI,this).clear(),M(EI,this).clear(),A(NI,this,$I).call(this),M(wI,this).forEach((({trackStates:t})=>{t&&t.forEach((t=>{A(NI,this,oS).call(this,t)}))})),M(wI,this).clear()}}function FI(){M(dI,this)&&"function"==typeof M(dI,this).on&&(C(mI,this,(t=>{A(NI,this,KI).call(this,t)})),M(dI,this).on(Bu.PLACEMENT_ADDED,M(mI,this)),C(vI,this,(t=>A(NI,this,OI).call(this,t))),M(dI,this).on(Bu.TIMELINE_SEEKING,M(vI,this)),C(gI,this,(()=>A(NI,this,PI).call(this))),M(dI,this).on(Bu.TIMELINE_SEEKED,M(gI,this)),C(yI,this,(t=>A(NI,this,RI).call(this,t))),M(dI,this).on(Bu.TIMELINE_TIME_UPDATE,M(yI,this)),C(bI,this,(()=>A(NI,this,DI).call(this))),M(dI,this).on(Bu.TIMELINE_RESET,M(bI,this))),(null==Du?void 0:Du.document)&&"function"==typeof Du.document.addEventListener&&(C(kI,this,(()=>{A(NI,this,qI).call(this)})),Du.document.addEventListener("visibilitychange",M(kI,this)))}function CI(){M(kI,this)&&null!=Du&&Du.document&&"function"==typeof Du.document.removeEventListener&&Du.document.removeEventListener("visibilitychange",M(kI,this)),C(kI,this,null)}function OI(t={}){const e=Number(null==t?void 0:t.targetTime);Number.isFinite(e)&&(M(wI,this).forEach((t=>{const n=null==t?void 0:t.trackStates;n&&n.forEach((n=>{var i;const r=null==n||null===(i=n.track)||void 0===i?void 0:i.type;"video"!==r&&"image"!==r&&"audio"!==r||(A(NI,this,LI).call(this,n,null==t?void 0:t.placement,e),n.seekSegmentId=null)}))})),(Array.isArray(null==t?void 0:t.placements)?t.placements:[]).forEach((t=>{const n=null==t?void 0:t.placementId,i=null==t?void 0:t.nodeId;if(!n||!i)return;const r=M(wI,this).get(n);if(!r||!r.trackStates)return;const o=A(NI,this,eS).call(this,i);o&&(r.trackStates.forEach((n=>{const i=null==n?void 0:n.track;!i||"video"!==i.type&&"image"!==i.type&&"audio"!==i.type||A(NI,this,LI).call(this,n,r.placement||t,e)})),A(NI,this,hS).call(this,r.placement||t,o))})))}function PI(){M(wI,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 RI(t={}){var e,n;A(NI,this,dS).call(this,null==t?void 0:t.time),null!==(e=M(pI,this))&&void 0!==e&&null!==(n=e.handleTimeUpdate)&&void 0!==n&&n.call(e,t),A(NI,this,qI).call(this),A(NI,this,sS).call(this,null==t?void 0:t.time)}function DI(){M(xI,this).forEach(((t,e)=>{const n=A(NI,this,eS).call(this,e);n&&"function"==typeof n.off&&n.off("node:loaded",t)})),M(xI,this).clear(),M(_I,this).forEach(((t,e)=>{const n=A(NI,this,eS).call(this,e);n&&"function"==typeof n.off&&n.off("segment:chunk",t)})),M(_I,this).clear(),M(TI,this).clear(),M(EI,this).clear(),M(wI,this).forEach((({trackStates:t})=>{t&&t.forEach((t=>{const e=null==t?void 0:t.segmentDecoders;e&&e.forEach((t=>{t&&"function"==typeof t.dispose&&t.dispose()}))}))})),M(wI,this).clear()}function LI(t,e,n){t&&(A(NI,this,oS).call(this,t),t.seekSegmentId=A(NI,this,BI).call(this,t.track,e,n))}function BI(t,e,n){if(!t||!e||!Array.isArray(t.segments))return null;const i=qp(e);if(!Number.isFinite(i))return null;const r=cI(null==e?void 0:e.nodeOffsetOverride),o=Math.max(0,n-i+r),s=cI(null==t?void 0:t.offset),a=Math.max(0,o-s),l="function"==typeof t.getMediaSegmentAtTime?t.getMediaSegmentAtTime(a,{preferRepresentationTime:!0}):Uy(t.segments,a,{preferRepresentationTime:!0});return(null==l?void 0:l.id)||null}function zI(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 WI(){const t=null==Du?void 0:Du.document;return!t||"string"!=typeof t.visibilityState||"visible"===t.visibilityState}function jI(){var t;const e=M(dI,this);if(!e||"number"!=typeof e.currentTime)return!1;if(e.state===ev)return!1;const n=Date.now();if(n<M(II,this))return!1;const i=e.currentTime;if(!Number.isFinite(i))return!1;const r="function"==typeof e.getPlacementsActiveAtTime?e.getPlacementsActiveAtTime(i):[],o=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.snapToFps),s=Number.isFinite(o)&&o>0?1/o:1/60;let a;if(Array.isArray(r)&&r.length)a=i+s;else if(a=A(NI,this,UI).call(this,i),!Number.isFinite(a))return!1;return C(II,this,n+1500),this.log.warn("[DecodeCoordinator] attempting decoder recovery seek"),e.currentTime=a,!0}function UI(t){var e;const n=M(dI,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=qp(t);if(!Number.isFinite(e))return;(!Number.isFinite(d)||e<d)&&(d=e);const n=Up(t,M(uI,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 $I(){C(SI,this,!1),C(AI,this,null)}function qI(){M(SI,this)&&A(NI,this,WI).call(this)&&A(NI,this,jI).call(this)}function VI(t){if(!A(NI,this,zI).call(this,t))return;const e=M(dI,this);e&&"number"==typeof e.currentTime&&(C(SI,this,!0),C(AI,this,t),A(NI,this,WI).call(this)&&A(NI,this,jI).call(this))}function GI(t){var e;return!!t&&(Array.isArray(null===(e=M(dI,this))||void 0===e?void 0:e.placements)?M(dI,this).placements:[]).includes(t)}function HI(t){var e;(Array.isArray(null===(e=M(dI,this))||void 0===e?void 0:e.placements)?[...M(dI,this).placements]:[]).filter((e=>"function"!=typeof t||t(e))).sort(((t,e)=>{const n=qp(t),i=qp(e);return(Number.isFinite(n)?n:Number.POSITIVE_INFINITY)-(Number.isFinite(i)?i:Number.POSITIVE_INFINITY)})).forEach((t=>{A(NI,this,KI).call(this,t)}))}async function KI(t){if(!t||!t.placementId||M(wI,this).has(t.placementId))return;if(!A(NI,this,GI).call(this,t))return;const e=t.nodeId;if(!e||!M(uI,this)||"function"!=typeof M(uI,this).get)return;const n=A(NI,this,eS).call(this,e);if(n){if(n.state&&"ready"!==n.state){if("function"==typeof n.resolve)try{await n.resolve()}catch(n){if(!A(NI,this,GI).call(this,t))return;return void this.log.warn(`[#processPlacement] Failed to resolve node ${e}`,n)}if(!A(NI,this,GI).call(this,t))return;if("ready"!==n.state)return}if(A(NI,this,uS).call(this,t))return A(NI,this,cS).call(this,t,n),void M(EI,this).add(t.placementId);A(NI,this,lS).call(this,t,n)}}function XI(t){return A(NI,this,YI).call(this,t).every((t=>A(NI,this,aS).call(this,t)))}function YI(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).filter((t=>lI.has(null==t?void 0:t.type)))}function QI(t){if(!t||!t.id||"function"!=typeof t.on)return;if(M(xI,this).has(t.id))return;const e=()=>{A(NI,this,pS).call(this,t.id)};t.on("node:loaded",e),M(xI,this).set(t.id,e)}function JI(t){if(!t||!t.id||"function"!=typeof t.on)return;if(M(_I,this).has(t.id))return;const e=t=>A(NI,this,mS).call(this,t);t.on("segment:chunk",e),M(_I,this).set(t.id,e)}function ZI(t,e){if(!t||!e)return;const n=M(TI,this).get(t)||new Set;n.add(e),M(TI,this).set(t,n)}function tS(t){return M(TI,this).get(t)||new Set}function eS(t){if(t&&M(uI,this)&&"function"==typeof M(uI,this).get)return M(uI,this).get(t)}function nS(t){if(!t)return;const e=t.fullBufferRetryTimer;null!=e&&("function"==typeof(null==Du?void 0:Du.clearTimeout)?Du.clearTimeout.bind(Du):clearTimeout)(e),t.fullBufferRetryTimer=null,t.fullBufferDecodeScheduled=!1,t.fullBufferRetryAttempts=0}function iS(t){const e=null==t?void 0:t.segmentStates;e&&"function"==typeof e.forEach&&e.forEach((t=>{A(NI,this,nS).call(this,t)}))}function rS(t,e,n,i){var r,o;if(!(t&&e&&n&&i))return!1;const s=M(wI,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 oS(t){if(!t)return;A(NI,this,iS).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 sS(t){const e=cI(t);if(!Number.isFinite(e))return;const n=e-2;Number.isFinite(n)&&M(wI,this).forEach((t=>{const e=null==t?void 0:t.placement;if(!e)return;const i=qp(e),r=Up(e,M(uI,this),{allowUnready:!0});if(!Number.isFinite(i)||!Number.isFinite(r))return;const o=i+r;if(!Number.isFinite(o)||o>n)return;const s=null==t?void 0:t.trackStates;s&&"function"==typeof s.forEach&&s.forEach((t=>{var e;const n=null==t||null===(e=t.track)||void 0===e?void 0:e.type;"video"!==n&&"image"!==n&&"audio"!==n||A(NI,this,oS).call(this,t)}))}))}function aS(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 lS(t,e){if(this.log.debug(`[#startDecode] [${t.placementId}] [${e.id}] Starting decode`),A(NI,this,cS).call(this,t,e)){if(A(NI,this,ZI).call(this,e.id,t.placementId),!A(NI,this,XI).call(this,e))return A(NI,this,QI).call(this,e),void A(NI,this,JI).call(this,e);A(NI,this,hS).call(this,t,e),A(NI,this,JI).call(this,e)}}function cS(t,e){if(!t||!t.placementId||!e)return;const n=M(wI,this).get(t.placementId);if(n)return n.placement=t,n;const i=A(NI,this,YI).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(Bu.DECODE_ERROR,ju({placementId:t.placementId,nodeId:e.id,trackId:null==n?void 0:n.id,trackType:null==n?void 0:n.type,error:i}))}}));const o={trackStates:r,nodeId:e.id,placement:t};return M(wI,this).set(t.placementId,o),o}function uS(t){var e;const n=qp(t),i=cI(null===(e=M(dI,this))||void 0===e?void 0:e.currentTime);return!Number.isFinite(n)||!!Number.isFinite(i)&&n-i>2}function dS(t){if(!M(EI,this).size)return;const e=cI(t);if(!Number.isFinite(e))return;const n=[];M(EI,this).forEach((t=>{const i=M(wI,this).get(t),r=null==i?void 0:i.placement;if(!r)return void n.push(t);const o=qp(r);Number.isFinite(o)&&o-e<=2&&n.push(t)})),n.forEach((t=>{M(EI,this).delete(t);const e=M(wI,this).get(t),n=null==e?void 0:e.placement;if(!n)return;const i=A(NI,this,eS).call(this,n.nodeId);i&&A(NI,this,lS).call(this,n,i)}))}function hS(t,e){const n=M(wI,this).get(t.placementId);n&&A(NI,this,YI).call(this,e).forEach((i=>{const r=n.trackStates.get(i.id);if(r&&!r.ready)try{let n;if(r.seekSegmentId&&(n=i.segments.find((t=>t&&!t.isInit&&t.id===r.seekSegmentId&&t.retainedByteLength>0)),!n))return;if(n||(n=i.segments.find((t=>t&&!t.isInit&&t.retainedByteLength>0))),!n)return;A(NI,this,wS).call(this,t,i,n),r.seekSegmentId&&"video"===(null==i?void 0:i.type)&&A(NI,this,fS).call(this,t,i,n),r.ready=!0,this.trigger(Bu.DECODE_READY,Wu({placementId:t.placementId,nodeId:e.id,trackId:i.id,trackType:i.type}))}catch(n){this.trigger(Bu.DECODE_ERROR,ju({placementId:t.placementId,nodeId:e.id,trackId:null==i?void 0:i.id,trackType:null==i?void 0:i.type,error:n}))}}))}function fS(t,e,n){var i;if(!(t&&e&&n&&Array.isArray(e.segments)))return;const r=null==t?void 0:t.placementId,o=r?M(wI,this).get(r):void 0,s=null==o||null===(i=o.trackStates)||void 0===i?void 0:i.get(e.id),a=null==s?void 0:s.segmentDecoders;if(!a||"function"!=typeof a.has)return;const l=e.segments,c=l.findIndex((t=>(null==t?void 0:t.id)===n.id));if(c<0)return;let u=0;for(let n=c+1;n<l.length;n+=1){const i=l[n];if(!i||i.isInit)continue;if(a.has(i.id))continue;if(!(i.retainedByteLength>0))break;const r=i.arrayBuffer;if(!r||"number"!=typeof r.byteLength||r.byteLength<=0)break;if(A(NI,this,wS).call(this,t,e,i),u+=1,u>=2)break}}function pS(t){const e=A(NI,this,eS).call(this,t);e&&A(NI,this,XI).call(this,e)&&A(NI,this,tS).call(this,t).forEach((t=>{const n=M(wI,this).get(t);A(NI,this,hS).call(this,(null==n?void 0:n.placement)||{placementId:t},e)}))}function mS(t){t&&t.nodeId&&t.trackId&&t.chunk&&A(NI,this,tS).call(this,t.nodeId).forEach((e=>A(NI,this,vS).call(this,e,t)))}function vS(t,e){const n=M(wI,this).get(t);if(!n)return;const i=n.trackStates.get(e.trackId);if(i)try{var r,o;if(e.isInit)return;const s=i.track,a=null==s||null===(r=s.segments)||void 0===r?void 0:r.find((t=>(null==t?void 0:t.id)===e.segmentId));if(!a||a.isInit)return;if("image"===(null==s?void 0:s.type))return void(!i.ready&&a.retainedByteLength>0&&A(NI,this,wS).call(this,n.placement,s,a)&&(i.ready=!0,this.trigger(Bu.DECODE_READY,Wu({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType}))));if((null===(o=M(dI,this))||void 0===o?void 0:o.state)===ev&&i.seekSegmentId&&("video"===(null==s?void 0:s.type)||"audio"===(null==s?void 0:s.type))&&a.id!==i.seekSegmentId)return;const l=a.id,c=i.segmentStates.get(l)||{initSent:!1,pendingChunks:[],ended:!1,firstChunkObserved:!1,missedSegmentPrefix:!1,fullBufferDecodeScheduled:!1,fullBufferRetryTimer:null,fullBufferRetryAttempts:0};i.segmentStates.set(l,c);const u=A(NI,this,bS).call(this,n.placement,s,a);if(!u||"function"!=typeof u.decodeChunk)return;if(i.hasInit&&!c.initSent){const t=A(NI,this,kS).call(this,s,a);if(!t)return void c.pendingChunks.push({chunk:e.chunk,loaded:e.loaded,total:e.total});u.decodeChunk(t,{isInit:!0}),c.initSent=!0,c.pendingChunks.length&&(c.pendingChunks.forEach((t=>{u.decodeChunk(t.chunk,{isInit:!1,loaded:t.loaded,total:t.total})})),c.pendingChunks=[])}const d="number"==typeof e.loaded&&"number"==typeof e.total&&e.total>0&&e.loaded>=e.total;A(NI,this,gS).call(this,c,e)?d&&!c.ended&&A(NI,this,yS).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(Bu.DECODE_READY,Wu({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType})))}catch(n){this.trigger(Bu.DECODE_ERROR,ju({placementId:t,nodeId:e.nodeId,trackId:e.trackId,trackType:e.trackType,error:n}))}}function gS(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 yS(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==Du?void 0:Du.setTimeout)?Du.setTimeout.bind(Du):setTimeout;i.fullBufferDecodeScheduled=!0,i.fullBufferRetryAttempts=0;const l=()=>{if(!A(NI,this,rS).call(this,r,o,s,i)||i.ended)return void A(NI,this,nS).call(this,i);if(A(NI,this,wS).call(this,t,e,n))return void A(NI,this,nS).call(this,i);i.fullBufferRetryAttempts+=1;const c=i.fullBufferRetryAttempts<=8?0:50;i.fullBufferRetryTimer=a((()=>{l()}),c)};i.fullBufferRetryTimer=a((()=>{l()}),0)}function bS(t,e,n){var i,r;const o=null==t?void 0:t.placementId;if(!o||!e||!n)return;const s=M(wI,this).get(o),a=null==s||null===(i=s.trackStates)||void 0===i?void 0:i.get(e.id);if(!a)return;const l=a.segmentDecoders.get(n.id);if(l)return l;const c=M(hI,this).create(e);if(c&&"function"==typeof c.configure&&c.configure(e),c&&"function"==typeof c.setNodeId&&c.setNodeId(null==t?void 0:t.nodeId),c&&"function"==typeof c.setSegment&&c.setSegment(n),c&&"function"==typeof c.setCurrentTimeProvider&&c.setCurrentTimeProvider((()=>{var t;return"number"==typeof(null===(t=M(dI,this))||void 0===t?void 0:t.currentTime)?M(dI,this).currentTime:0})),c&&"function"==typeof c.setTimeOffsetSeconds){var u,d;const i=qp(t),r=cI(null==e?void 0:e.offset),o=cI(null!==(u=null==n||null===(d=n.chosenRepresentation)||void 0===d?void 0:d.segStart)&&void 0!==u?u:null==n?void 0:n.offset);Number.isFinite(i)&&c.setTimeOffsetSeconds(i+r+o)}return c&&"function"==typeof c.setSeekTargetTimeSeconds&&(null===(r=M(dI,this))||void 0===r?void 0:r.state)===ev&&"video"===(null==e?void 0:e.type)&&c.setSeekTargetTimeSeconds(M(dI,this).currentTime),c&&"function"==typeof c.on&&(c.on(Bu.DECODER_FRAME,(i=>{i&&(!M(SI,this)||"video"!==(null==e?void 0:e.type)&&"image"!==(null==e?void 0:e.type)||(C(SI,this,!1),C(AI,this,null)),M(dI,this)&&"function"==typeof M(dI,this).notifyDecodedFrame&&(i.frame||i.data)&&M(dI,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(Bu.DECODER_AUDIO,(i=>{i&&i.audioBuffer&&this.trigger(Bu.DECODER_AUDIO,Wu({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(Bu.DECODER_ERROR,(i=>{const r=(null==i?void 0:i.error)||i;this.trigger(Bu.DECODER_ERROR,ju({placementId:o,nodeId:null==t?void 0:t.nodeId,trackId:null==e?void 0:e.id,trackType:null==e?void 0:e.type,segmentId:null==n?void 0:n.id,error:r})),A(NI,this,VI).call(this,r)}))),a.segmentDecoders.set(n.id,c),c}function kS(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 wS(t,e,n){var i;if(!t||!e||!n)return!1;const r=t.placementId,o=M(wI,this).get(r),s=null==o||null===(i=o.trackStates)||void 0===i?void 0:i.get(e.id);if(!s)return!1;const a=A(NI,this,bS).call(this,t,e,n);if(!a||"function"!=typeof a.decodeChunk)return!1;const l=s.segmentStates.get(n.id)||{initSent:!1,pendingChunks:[],ended:!1,firstChunkObserved:!1,missedSegmentPrefix:!1,fullBufferDecodeScheduled:!1,fullBufferRetryTimer:null,fullBufferRetryAttempts:0};if(s.segmentStates.set(n.id,l),l.ended)return A(NI,this,nS).call(this,l),!0;if(s.hasInit&&!l.initSent){const t=A(NI,this,kS).call(this,e,n);if(!t)return!1;a.decodeChunk(t,{isInit:!0}),l.initSent=!0}const c=n.arrayBuffer;return!(!c||"number"!=typeof c.byteLength||c.byteLength<=0||(a.decodeChunk(new Uint8Array(c),{isInit:!1,loaded:c.byteLength,total:c.byteLength}),l.ended||"function"!=typeof a.endOfStream||(l.ended=!0,a.endOfStream()),A(NI,this,nS).call(this,l),0))}const xS=1e-6;var _S=new WeakMap,TS=new WeakMap,ES=new WeakMap,IS=new WeakMap,SS=new WeakMap,AS=new WeakMap,NS=new WeakMap,MS=new WeakMap,FS=new WeakSet;class CS extends Ou{get name(){return"TransitionManager"}get defaults(){return{durationSeconds:.5}}constructor(t,e,n){super(n),O(this,FS),F(this,_S,void 0),F(this,TS,void 0),F(this,ES,null),F(this,IS,null),F(this,SS,null),F(this,AS,0),F(this,NS,[]),F(this,MS,null),C(_S,this,t),C(TS,this,e),M(_S,this)&&"function"==typeof M(_S,this).on&&(C(MS,this,(()=>A(FS,this,jS).call(this))),M(_S,this).on(Bu.TIMELINE_RESET,M(MS,this)))}transitionTo(t,e={}){const n=Number(t);if(!Number.isFinite(n))throw new Error("TransitionManager.transitionTo requires a numeric time");A(FS,this,jS).call(this);const i=A(FS,this,OS).call(this),r=A(FS,this,LS).call(this,n,e);return r?A(FS,this,BS).call(this,n,e,i,r):Promise.resolve()}onDispose(){M(_S,this)&&"function"==typeof M(_S,this).off&&M(MS,this)&&M(_S,this).off(Bu.TIMELINE_RESET,M(MS,this)),C(MS,this,null),A(FS,this,jS).call(this),C(TS,this,null),C(_S,this,null)}}function OS(){return C(AS,this,M(AS,this)+1),M(AS,this)}function PS(t={}){var e;const n=Number(null==t?void 0:t.duration),i=Number(null===(e=this.settings)||void 0===e?void 0:e.durationSeconds);return Number.isFinite(n)?n:i}function RS(t={},e){return{duration:e,filter:null==t?void 0:t.filter,color:null==t?void 0:t.color,filters:null==t?void 0:t.filters,reverseFilters:null==t?void 0:t.reverseFilters,transition:null==t?void 0:t.transition}}function DS(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 LS(t,e={}){var n;const i=M(TS,this),r=A(FS,this,PS).call(this,e);if(!i||"function"!=typeof i.startTransition)return M(_S,this).currentTime=t,null;if(!(r>0))return M(_S,this).currentTime=t,null!==(n=i.resetTransition)&&void 0!==n&&n.call(i),null;const o=A(FS,this,RS).call(this,e,r);"function"==typeof(null==e?void 0:e.onTransitionInStart)&&e.onTransitionInStart();const s=i.startTransition(o),{outDurationMs:a,inDurationMs:l}=A(FS,this,DS).call(this,r,s);return{renderer:i,transitionOptions:o,outDurationMs:a,inDurationMs:l,shouldWaitForFrames:!1!==(null==e?void 0:e.waitForVisualFrames)}}function BS(t,e={},n,i){const{renderer:r,transitionOptions:o,outDurationMs:s,inDurationMs:a,shouldWaitForFrames:l}=i,c=A(FS,this,GS).call(this,t,e,n),u=l?A(FS,this,HS).call(this,t,n):Promise.resolve();let d=!1,h=!1,f=!1,p=!l;const m=()=>{var t;A(FS,this,US).call(this,n)&&!f&&d&&h&&p&&(f=!0,"function"==typeof(null==e?void 0:e.onTransitionInEnd)&&e.onTransitionInEnd(),"function"==typeof(null==e?void 0:e.onTransitionOutStart)&&e.onTransitionOutStart(),null!==(t=r.beginTransitionIn)&&void 0!==t&&t.call(r,o),C(IS,this,setTimeout((()=>{var t;A(FS,this,US).call(this,n)&&(null!==(t=r.resetTransition)&&void 0!==t&&t.call(r),"function"==typeof(null==e?void 0:e.onTransitionOutEnd)&&e.onTransitionOutEnd(),A(FS,this,zS).call(this))}),a)))};return C(ES,this,setTimeout((()=>{d=!0,m()}),s)),c.then((()=>{h=!0,m()})).catch((()=>{var t;A(FS,this,US).call(this,n)&&(null!==(t=r.resetTransition)&&void 0!==t&&t.call(r),A(FS,this,zS).call(this))})),u.then((()=>{p=!0,m()})).catch((()=>{p=!0,m()})),M(_S,this).currentTime=t,new Promise((t=>{C(SS,this,t)}))}function zS(){const t=M(SS,this);C(SS,this,null),A(FS,this,WS).call(this),A(FS,this,VS).call(this),t&&t()}function WS(){M(ES,this)&&clearTimeout(M(ES,this)),M(IS,this)&&clearTimeout(M(IS,this)),C(ES,this,null),C(IS,this,null)}function jS(){var t,e;M(TS,this)&&null!==(t=(e=M(TS,this)).resetTransition)&&void 0!==t&&t.call(e),A(FS,this,WS).call(this),A(FS,this,VS).call(this),M(SS,this)&&(M(SS,this).call(this),C(SS,this,null))}function US(t){return M(AS,this)===t}function $S(t,e){M(_S,this)&&"function"==typeof M(_S,this).on&&(M(_S,this).on(t,e),M(NS,this).push({eventName:t,handler:e}))}function qS(t,e){M(_S,this)&&"function"==typeof M(_S,this).off&&(M(_S,this).off(t,e),C(NS,this,M(NS,this).filter((n=>n.eventName!==t||n.handler!==e))))}function VS(){M(_S,this)&&"function"==typeof M(_S,this).off?(M(NS,this).forEach((t=>{M(_S,this).off(t.eventName,t.handler)})),C(NS,this,[])):C(NS,this,[])}function GS(t,e,n){const i=null==e?void 0:e.transitionOutPromise;if(i&&"function"==typeof i.then)return i;if("function"==typeof i)try{const t=i();if(t&&"function"==typeof t.then)return t}catch(t){return Promise.resolve()}if(!M(_S,this)||"function"!=typeof M(_S,this).on)return Promise.resolve();const r=A(FS,this,KS).call(this);return new Promise((e=>{let i=!1;const o=r?Bu.TIMELINE_SEEKED:"nodestart";let s,a;const l=()=>{A(FS,this,qS).call(this,Bu.TIMELINE_SEEKING,s),A(FS,this,qS).call(this,o,a),e()};s=(e={})=>{A(FS,this,US).call(this,n)?A(FS,this,XS).call(this,e,t)&&(i=!0):l()},a=(e={})=>{A(FS,this,US).call(this,n)?(o!==Bu.TIMELINE_SEEKED||A(FS,this,XS).call(this,e,t))&&(o===Bu.TIMELINE_SEEKED||i)&&l():l()},A(FS,this,$S).call(this,Bu.TIMELINE_SEEKING,s),A(FS,this,$S).call(this,o,a)}))}function HS(t,e){if(!M(_S,this)||"function"!=typeof M(_S,this).on)return Promise.resolve();const n=Number(t);return new Promise((t=>{const i=(r={})=>{if(!A(FS,this,US).call(this,e))return A(FS,this,qS).call(this,Bu.VISUAL_FRAMES_AVAILABLE,i),void t();const o=Number(null==r?void 0:r.time);Number.isFinite(n)&&Number.isFinite(o)&&o+xS<n||(Array.isArray(null==r?void 0:r.frames)?r.frames:[]).length&&(A(FS,this,qS).call(this,Bu.VISUAL_FRAMES_AVAILABLE,i),t())};A(FS,this,$S).call(this,Bu.VISUAL_FRAMES_AVAILABLE,i)}))}function KS(){var t,e;const n=null===(t=M(_S,this))||void 0===t?void 0:t.state;if(n===tv||n===Ym)return!0;const i=null===(e=M(_S,this))||void 0===e?void 0:e.placements;return!Array.isArray(i)||0===i.length}function XS(t,e){const n=Number(null==t?void 0:t.targetTime);return!Number.isFinite(n)||Math.abs(n-e)<xS}function YS(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}var QS=new WeakMap,JS=new WeakMap,ZS=new WeakMap,tA=new WeakMap,eA=new WeakMap,nA=new WeakMap,iA=new WeakMap,rA=new WeakMap,oA=new WeakMap,sA=new WeakMap,aA=new WeakMap,lA=new WeakMap,cA=new WeakMap,uA=new WeakMap,dA=new WeakSet;class hA extends Ou{get name(){return"AudioPlaybackManager"}get defaults(){return{muted:!1,volume:1,lookaheadSeconds:1}}constructor(t,e,n){super(n),O(this,dA),F(this,QS,void 0),F(this,JS,void 0),F(this,ZS,null),F(this,tA,null),F(this,eA,[]),F(this,nA,new Set),F(this,iA,new Map),F(this,rA,!1),F(this,oA,1),F(this,sA,!0),F(this,aA,null),F(this,lA,null),F(this,cA,null),F(this,uA,null),C(QS,this,t),C(JS,this,e),C(rA,this,!!this.settings.muted),C(oA,this,Wp(this.settings.volume));const i=Array.isArray(null==n?void 0:n.disabledTracks)?n.disabledTracks:[];C(sA,this,!i.includes("audio")),A(dA,this,fA).call(this)}get muted(){return M(rA,this)}set muted(t){C(rA,this,!!t),A(dA,this,TA).call(this)}get volume(){return M(oA,this)}set volume(t){C(oA,this,Wp(t)),A(dA,this,TA).call(this)}handleDecodedAudio(t={}){if(!M(sA,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=YS(null==t?void 0:t.pts,null);if(!(e&&n&&i&&Number.isFinite(r)))return;const o=Number.isFinite(null==t?void 0:t.duration)?t.duration:e.duration,s=`${n}:${i}`;M(nA,this).has(s)||(M(eA,this).push({key:s,placementId:n,pts:r,duration:o,audioBuffer:e}),M(eA,this).sort(((t,e)=>t.pts-e.pts)),A(dA,this,yA).call(this))}onDispose(){A(dA,this,pA).call(this),A(dA,this,xA).call(this,!0),M(ZS,this)&&"function"==typeof M(ZS,this).close&&M(ZS,this).close(),C(ZS,this,null),C(tA,this,null),C(QS,this,null),C(JS,this,null)}}function fA(){M(QS,this)&&"function"==typeof M(QS,this).on&&(C(aA,this,(t=>A(dA,this,mA).call(this,t))),M(QS,this).on(Bu.TIMELINE_TIME_UPDATE,M(aA,this)),C(lA,this,(t=>A(dA,this,vA).call(this,t))),M(QS,this).on(Bu.TIMELINE_STATE_CHANGE,M(lA,this)),C(uA,this,(()=>A(dA,this,gA).call(this))),M(QS,this).on(Bu.TIMELINE_RESET,M(uA,this))),M(JS,this)&&"function"==typeof M(JS,this).on&&(C(cA,this,(t=>this.handleDecodedAudio(t))),M(JS,this).on(Bu.DECODER_AUDIO,M(cA,this)))}function pA(){M(QS,this)&&"function"==typeof M(QS,this).off&&(M(aA,this)&&M(QS,this).off(Bu.TIMELINE_TIME_UPDATE,M(aA,this)),M(lA,this)&&M(QS,this).off(Bu.TIMELINE_STATE_CHANGE,M(lA,this)),M(uA,this)&&M(QS,this).off(Bu.TIMELINE_RESET,M(uA,this))),M(JS,this)&&"function"==typeof M(JS,this).off&&M(cA,this)&&M(JS,this).off(Bu.DECODER_AUDIO,M(cA,this)),C(aA,this,null),C(lA,this,null),C(cA,this,null),C(uA,this,null)}function mA(){A(dA,this,yA).call(this)}function vA(t={}){const e=null==t?void 0:t.to;if(e)return e===Qm?(A(dA,this,EA).call(this),void A(dA,this,yA).call(this)):void(e!==tv&&e!==Zm?e!==ev&&e!==nv||A(dA,this,gA).call(this):A(dA,this,IA).call(this))}function gA(){A(dA,this,IA).call(this),A(dA,this,xA).call(this,!0),C(eA,this,[])}function yA(){if(!M(sA,this)||!M(QS,this))return;if(M(QS,this).state!==Qm)return;const t=A(dA,this,_A).call(this);if(!t)return;const e=YS(M(QS,this).currentTime,0),n=e+Math.max(0,YS(this.settings.lookaheadSeconds,1)),i=[];for(let r=0;r<M(eA,this).length;r+=1){const o=M(eA,this)[r];o&&(o.pts>n?i.push(o):A(dA,this,bA).call(this,o)&&A(dA,this,wA).call(this,o,t,e))}C(eA,this,i)}function bA(t){if(!t||!M(QS,this))return!1;const e=A(dA,this,kA).call(this,t.pts);return!(!e||e!==t.placementId)}function kA(t){if(!M(QS,this)||"function"!=typeof M(QS,this).getPlacementsActiveAtTime)return null;const e=M(QS,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 wA(t,e,n){const i=t.key;if(M(nA,this).has(i))return;const r=t.audioBuffer;if(!r)return;const o=Number.isFinite(t.duration)?t.duration:r.duration,s=t.pts;if(!Number.isFinite(s))return;const a=n-s;if(Number.isFinite(o)&&o>0&&a>=o)return;const l=e.createBufferSource();l.buffer=r,l.connect(M(tA,this));let c=e.currentTime,u=0;a>0?u=a:a<0&&(c=e.currentTime+Math.abs(a));try{l.start(c,u)}catch(t){return void this.log.warn("[AudioPlaybackManager] Failed to start audio buffer",t)}M(nA,this).add(i),M(iA,this).set(i,l),l.onended=()=>{M(iA,this).delete(i)}}function xA(t){M(iA,this).forEach(((t,e)=>{if(t&&"function"==typeof t.stop)try{t.stop()}catch(t){}M(iA,this).delete(e)})),t&&M(nA,this).clear()}function _A(){if(M(ZS,this))return M(ZS,this);const t=Du.AudioContext||Du.webkitAudioContext;if(!t)return this.log.warn("[AudioPlaybackManager] AudioContext is not available."),null;try{return C(ZS,this,new t),C(tA,this,M(ZS,this).createGain()),M(tA,this).connect(M(ZS,this).destination),A(dA,this,TA).call(this),M(ZS,this)}catch(t){return this.log.warn("[AudioPlaybackManager] Failed to initialize AudioContext",t),C(ZS,this,null),C(tA,this,null),null}}function TA(){if(!M(tA,this))return;const t=M(rA,this)?0:M(oA,this);M(tA,this).gain.value=t}function EA(){M(ZS,this)&&"function"==typeof M(ZS,this).resume&&"suspended"===M(ZS,this).state&&M(ZS,this).resume().catch((()=>{}))}function IA(){M(ZS,this)&&"function"==typeof M(ZS,this).suspend&&"running"===M(ZS,this).state&&M(ZS,this).suspend().catch((()=>{}))}var SA=new WeakMap,AA=new WeakMap,NA=new WeakMap,MA=new WeakMap,FA=new WeakMap,CA=new WeakSet;class OA extends Ou{constructor(...t){super(...t),O(this,CA),F(this,SA,void 0),F(this,AA,void 0),F(this,NA,void 0),F(this,MA,void 0),F(this,FA,void 0),C(SA,this,A(CA,this,RA).call(this,this.settings.currentTime)),C(AA,this,A(CA,this,DA).call(this,this.settings.playbackRate)),C(NA,this,null),C(MA,this,!1),C(FA,this,A(CA,this,PA).bind(this))}get name(){return"PlaybackClock"}get defaults(){return{currentTime:0,playbackRate:wy("playbackRate")}}get currentTime(){return M(SA,this)}get playbackRate(){return M(AA,this)}set playbackRate(t){C(AA,this,A(CA,this,DA).call(this,t))}play(){M(MA,this)||(C(MA,this,!0),C(NA,this,ry()),jk(M(FA,this),0))}pause(){M(MA,this)&&(C(MA,this,!1),Uk(M(FA,this)))}seek(t){C(SA,this,A(CA,this,RA).call(this,t)),C(NA,this,ry())}reset(){this.pause(),C(SA,this,0),C(NA,this,null)}onDispose(){this.pause(),C(FA,this,null)}}function PA(){const t=ry();if(null===M(NA,this))return C(NA,this,t),void this.trigger(Bu.CLOCK_TICK,{currentTime:M(SA,this)});const e=t-M(NA,this);C(NA,this,t);const n=e/1e3;C(SA,this,M(SA,this)+n*M(AA,this)),this.trigger(Bu.CLOCK_TICK,{currentTime:M(SA,this)})}function RA(t){return"number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t)||t<0?0:t}function DA(t){return"number"!=typeof t||Number.isNaN(t)||!Number.isFinite(t)||t<=0?M(AA,this)||1:t}var LA=new WeakMap,BA=new WeakSet;class zA extends Ou{constructor(...t){super(...t),O(this,BA),F(this,LA,new Map)}get name(){return"TrackBuffers"}get defaults(){return{}}refreshNode(t){if(!t||!Array.isArray(t.tracks))return;const e=t.id,n=M(LA,this).get(e)||new Map;M(LA,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(Bu.TRACK_BUFFER_UPDATE,{nodeId:e,trackType:i,range:r})),!s&&a?this.trigger(Bu.TRACK_READY,{nodeId:e,trackType:i,range:r}):s&&!a&&this.trigger(Bu.TRACK_UNDERFLOW,{nodeId:e,trackType:i,range:r})}))}getTrackRange(t,e){const n=M(LA,this).get(t),i=null==n?void 0:n.get(e);return null==i?void 0:i.range}computeBuffered(t=[],e=0,n){if(!n||"function"!=typeof n.get)return;const i=Number.isFinite(e)?e:0;let r,o,s=!1;for(let e=0;e<t.length;e+=1){const a=A(BA,this,jA).call(this,n,t[e],i);if(!a||a.end<=i)continue;if(void 0===r){r=a.start,o=a.end,s=a.full;continue}const l=a.start<=o,c=s&&a.full;if(!l&&!c)break;o=Math.max(o,a.end),s=a.full}return void 0===r||void 0===o?{start:0,end:0}:{start:r,end:o}}get buffered(){return M(LA,this)}reset(){M(LA,this).clear()}onDispose(){M(LA,this).clear(),"function"==typeof this.off&&this.off()}}function WA(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 jA(t,e,n=0){var i,r;const o=qp(e);if(!Number.isFinite(o))return;const s=t.get(e.nodeId);if(!s)return;const a=Array.isArray(s.tracks)?s.tracks:[];if(!a.length){const t=s.buffered;if(!t||!Number.isFinite(t.start)||!Number.isFinite(t.end))return;return A(BA,this,UA).call(this,s,t,o,e)}const l=s.mainTrackId,c=Number.isFinite(e.nodeOffsetOverride)?e.nodeOffsetOverride:0,u=Math.max(0,n-o+c);let d;l&&(d=a.find((t=>(null==t?void 0:t.id)===l))),(null===(i=d)||void 0===i?void 0:i.type)||(d=a.find((t=>null==t?void 0:t.type)));const h=A(BA,this,WA).call(this,d,u)||(null===(r=d)||void 0===r?void 0:r.buffered);return h&&Number.isFinite(h.start)&&Number.isFinite(h.end)?A(BA,this,UA).call(this,s,h,o,e):void 0}function UA(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 $A{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 qA extends Ou{constructor(t,e){super(e),this.timeline=t}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"handleDecodedFrame","handleClockTick","handleMainTrackBufferUpdate"])}enter(){}exit(){}play(){this.timeline.transitionTo(Qm)}pause(){this.timeline.transitionTo(tv)}wait(){this.timeline.transitionTo(Zm)}reset(){this.timeline.transitionTo(nv)}seek(t){this.timeline.transitionTo(ev,{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()||tv;this.timeline.transitionTo(e)}handleMainTrackBufferUpdate(t){}handleDecodedFrame(t){}handleClockTick(t){}onDispose(){this.timeline=null}}const VA=24e3/1001;function GA(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 HA(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 KA(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 XA(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 YA(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:VA)}(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+HA(t)}function QA(t,e=(null==t?void 0:t.currentTime)){const n=GA(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=KA(o);if(!s)return!0;if(!t.hasDecodedFirstFrame(r,s))return!0}return!1}function JA(t,e=(null==t?void 0:t.currentTime)){return QA(t,e)||function(t,e=(null==t?void 0:t.currentTime)){const n=GA(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=XA(s);if(null!=a&&a.id&&!YA(t,o,a.id,a.type,n))return!0}return!1}(t,e)}function ZA(t,e=(null==t?void 0:t.currentTime)){if("function"!=typeof(null==t?void 0:t.computeBuffered))return!1;const n=GA(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=HA(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=qp(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 tN={[Ym]:class extends qA{get name(){return Ym}get defaults(){return{autoplay:wy("autoplay")}}enter(){this.timeline.recordStableState(tv),this.timeline.stopPlaybackClock()}play(){const t=JA(this.timeline),e=t?Zm:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t)return this.timeline.recordStableState(Qm),void this.timeline.transitionTo(Zm);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(JA(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 qA{get name(){return Jm}enter(t={}){const{from:e,to:n}=t;this.timeline.recordStableState(Qm),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("canplay",{from:e,to:n})}play(){}handleMainTrackUnderflow(){}pause(){this.timeline.transitionTo(tv)}},[Qm]:class extends qA{get name(){return Qm}enter(t={}){const{from:e,to:n,fromFirstFramePending:i}=t;this.timeline.recordStableState(Qm),this.timeline.startPlaybackClock(),!0!==i&&this.emitPlayerStateEvent("canplay",{from:e,to:n}),this.emitPlayerStateEvent("playing",{from:e,to:n})}play(){}pause(){this.timeline.transitionTo(tv)}handleClockTick(t){const e=this.timeline.currentTime;JA(this.timeline,e)&&(this.timeline.recordStableState(Qm),this.timeline.transitionTo(Zm))}},[Zm]:(Je=new WeakMap,Ze=new WeakMap,tn=new WeakSet,class extends qA{constructor(...t){super(...t),O(this,tn),F(this,Je,void 0),F(this,Ze,null)}get name(){return Zm}enter(t={}){const{from:e,to:n}=t;this.timeline.stopPlaybackClock(),A(tn,this,eN).call(this),A(tn,this,iN).call(this),this.emitPlayerStateEvent("waiting",{from:e,to:n}),A(tn,this,sN).call(this)}exit(){A(tn,this,nN).call(this),A(tn,this,rN).call(this)}play(){this.timeline.recordStableState(Qm);const t=A(tn,this,oN).call(this),e=t?Zm:this.timeline.getPlaybackStartState();this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t||this.timeline.transitionTo(e)}pause(){this.timeline.transitionTo(tv)}handleMainTrackReady(t){const e=this.timeline.getLastStableState()||tv;e!==Qm?this.timeline.transitionTo(e):A(tn,this,sN).call(this)}handleDecodedFrame(t){A(tn,this,sN).call(this)}handleMainTrackBufferUpdate(t){A(tn,this,sN).call(this)}}),[tv]:class extends qA{get name(){return tv}enter(t={}){const{from:e,to:n}=t;this.timeline.recordStableState(tv),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("pause",{from:e,to:n})}play(){const t=JA(this.timeline),e=t?Zm:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:e}),t)return this.timeline.recordStableState(Qm),void this.timeline.transitionTo(Zm);this.timeline.transitionTo(e)}pause(){}},[ev]:class extends qA{get name(){return ev}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===Qm||n===Jm,r=i&&"function"==typeof this.timeline.getPlaybackStartState?this.timeline.getPlaybackStartState(e):i?Qm:tv;this.timeline.transitionTo(r,{fromSeeking:!0})}play(){var t;if(this.timeline&&"function"==typeof this.timeline.setSeekReturnState)return void this.timeline.setSeekReturnState(Qm);const e="function"==typeof(null===(t=this.timeline)||void 0===t?void 0:t.getPlaybackStartState)?this.timeline.getPlaybackStartState():Qm;this.timeline.transitionTo(e)}pause(){this.timeline&&"function"==typeof this.timeline.setSeekReturnState?this.timeline.setSeekReturnState(tv):this.timeline.transitionTo(tv)}handleDecodedFrame(t){this.timeline&&"function"==typeof this.timeline.maybeCompleteSeek&&this.timeline.maybeCompleteSeek(t)}},[nv]:class extends qA{get name(){return nv}enter(){this.timeline.resetClock(),this.timeline.transitionTo(Ym,{fromReset:!0})}play(){}pause(){}get buffered(){return{start:0,end:0}}}};function eN(){var t;const e=null===(t=this.timeline)||void 0===t?void 0:t.trackBuffers;e&&"function"==typeof e.on&&(C(Je,this,(t=>this.handleMainTrackBufferUpdate(t))),e.on(Bu.TRACK_BUFFER_UPDATE,M(Je,this)))}function nN(){var t;const e=null===(t=this.timeline)||void 0===t?void 0:t.trackBuffers;M(Je,this)&&e&&"function"==typeof e.off?(e.off(Bu.TRACK_BUFFER_UPDATE,M(Je,this)),C(Je,this,null)):C(Je,this,null)}function iN(){if(null!==M(Ze,this))return;const t="function"==typeof(null==Du?void 0:Du.setInterval)?Du.setInterval.bind(Du):setInterval;C(Ze,this,t((()=>{var t;(null===(t=this.timeline)||void 0===t?void 0:t.state)===Zm&&A(tn,this,sN).call(this)}),200))}function rN(){null!==M(Ze,this)&&(("function"==typeof(null==Du?void 0:Du.clearInterval)?Du.clearInterval.bind(Du):clearInterval)(M(Ze,this)),C(Ze,this,null))}function oN(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!!QA(t,e)||!0===n.skipBufferResume||!ZA(t,e)}(this.timeline,t)}function sN(t=(t=>null===(t=this.timeline)||void 0===t?void 0:t.currentTime)()){return(this.timeline.getLastStableState()||tv)===Qm&&!A(tn,this,oN).call(this,t)&&(this.timeline.transitionTo(this.timeline.getPlaybackStartState(t)),!0)}function aN(t){return t&&("string"!=typeof t.state||"ready"===t.state)}function lN(t){return(Array.isArray(null==t?void 0:t.tracks)?t.tracks:[]).some((t=>"video"===(null==t?void 0:t.type)))}function cN(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 uN(t){return t===Qm||t===Jm}var dN=new WeakMap,hN=new WeakMap,fN=new WeakMap,pN=new WeakMap,mN=new WeakMap,vN=new WeakMap,gN=new WeakMap,yN=new WeakMap,bN=new WeakMap,kN=new WeakMap,wN=new WeakMap,xN=new WeakMap,_N=new WeakMap,TN=new WeakMap,EN=new WeakSet;class IN{constructor(t={}){O(this,EN),F(this,dN,void 0),F(this,hN,void 0),F(this,fN,void 0),F(this,pN,void 0),F(this,mN,void 0),F(this,vN,void 0),F(this,gN,void 0),F(this,yN,void 0),F(this,bN,void 0),F(this,kN,null),F(this,wN,tv),F(this,xN,[]),F(this,_N,new Set),F(this,TN,new Map),C(dN,this,t.getState),C(hN,this,t.getNode),C(fN,this,t.getPlacementsActiveAtTime),C(pN,this,t.getLastStableState),C(mN,this,t.getPlaybackStartState),C(vN,this,t.clearVisualFrameBuffers),C(gN,this,t.updateTime),C(yN,this,t.transitionTo),C(bN,this,t.trigger)}start(t,e){const n=Number(t);if(!Number.isFinite(n))return;let i=e;i===ev?i=M(wN,this):i===Zm&&"function"==typeof M(pN,this)&&(i=M(pN,this).call(this)),C(wN,this,uN(i)?Qm:tv),C(kN,this,n),M(_N,this).clear(),M(TN,this).clear(),C(xN,this,"function"==typeof M(fN,this)?M(fN,this).call(this,n):[]),"function"==typeof M(vN,this)&&M(vN,this).call(this),"function"==typeof M(gN,this)&&M(gN,this).call(this,n,{source:"seek"}),"function"==typeof M(bN,this)&&M(bN,this).call(this,Bu.TIMELINE_SEEKING,{targetTime:n,placements:M(xN,this).slice()}),this.maybeComplete()}setReturnState(t){C(wN,this,uN(t)?Qm:tv)}maybeComplete(t){if(("function"==typeof M(dN,this)?M(dN,this).call(this):void 0)!==ev)return;const e=M(kN,this);if(!Number.isFinite(e))return;const n=null==t?void 0:t.trackType,i=null==t?void 0:t.placementId;if(i&&"video"===n){const n=Number(null==t?void 0:t.pts);if(Number.isFinite(n)&&n>=e){M(_N,this).add(i);const t=M(TN,this).get(i);(!Number.isFinite(t)||n<t)&&M(TN,this).set(i,n)}}else i&&"image"===n&&function(t,e){const n=Number(null==t?void 0:t.pts),i=Number(null==t?void 0:t.duration);return!Number.isFinite(n)||(Number.isFinite(i)&&i>0?e>=n&&e<n+i:e>=n)}(t,e)&&M(_N,this).add(i);const r=Array.isArray(M(xN,this))?M(xN,this):[];if(r.length){if("function"==typeof M(hN,this)){for(let t=0;t<r.length;t+=1){const e=r[t],n=null==e?void 0:e.placementId;if(!n)return;const i=M(hN,this).call(this,e.nodeId);if(!aN(i))return;if(cN(i)&&!M(_N,this).has(n))return}A(EN,this,SN).call(this,e,r)}}else A(EN,this,SN).call(this,e,[])}dispose(){C(xN,this,[]),M(_N,this).clear(),M(TN,this).clear(),C(kN,this,null)}}function SN(t,e){const n=A(EN,this,AN).call(this,t,e);if("function"==typeof M(gN,this)&&M(gN,this).call(this,n,{source:"seek"}),C(kN,this,null),C(xN,this,[]),M(_N,this).clear(),M(TN,this).clear(),"function"==typeof M(bN,this)&&M(bN,this).call(this,Bu.TIMELINE_SEEKED,{targetTime:t,placements:Array.isArray(e)?e.slice():[]}),"function"==typeof M(yN,this)){const t=M(wN,this)===Qm&&"function"==typeof M(mN,this)?M(mN,this).call(this,n):M(wN,this);M(yN,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 M(hN,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(!lN(M(hN,this).call(this,n.nodeId)))continue;const o=M(TN,this).get(r);Number.isFinite(o)&&o>i&&(i=o)}return i}function NN(t){if(t&&"function"==typeof t.close)try{t.close()}catch(t){}}function MN(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=>NN(null==t?void 0:t.frame)))}function FN(t){return qp(t)}function CN(t){return Number.isFinite(null==t?void 0:t.loopRootOffset)?t.loopRootOffset:FN(t)}function ON(t,e){return"string"==typeof(null==t?void 0:t.loopRootPlacementId)&&t.loopRootPlacementId?t.loopRootPlacementId:e}function PN(t){if("string"!=typeof t)return Number.NaN;const e=t.match(/(\d+)/);return e?Number(e[1]):Number.NaN}function RN(t){if(!t)return;const e=[[t.displayWidth,t.displayHeight],[t.codedWidth,t.codedHeight],[t.videoWidth,t.videoHeight],[t.naturalWidth,t.naturalHeight],[t.width,t.height]];for(let t=0;t<e.length;t+=1){const[n,i]=e[t],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}const DN=1e-6;function LN(t){return t&&("string"!=typeof t.state||"ready"===t.state)}function BN(t){const e=Number(t);return Number.isFinite(e)?e:0}function zN(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 WN(t){return t&&"cue"===t.type&&Array.isArray(t.cues)?t.cues:[]}var 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 WeakSet;class YN{constructor(t={}){O(this,XN),F(this,jN,void 0),F(this,UN,void 0),F(this,$N,void 0),F(this,qN,void 0),F(this,VN,void 0),F(this,GN,void 0),F(this,HN,-1e-6),F(this,KN,null),C(jN,this,t.getPlacements),C(UN,this,t.getPlacementsActiveAtTime),C($N,this,t.getPlacementDuration),C(qN,this,t.getNode),C(VN,this,t.triggerTimeline),C(GN,this,t.triggerNode)}handleSeeking(t,e){const n=BN(t);C(KN,this,n)}handleSeeked(t){const e=BN(t),n=M(KN,this);C(KN,this,null),Number.isFinite(n)?(A(XN,this,JN).call(this,n,e),C(HN,this,e)):C(HN,this,e)}handleTimeUpdate(t,e={}){const n=BN(t),i=M(HN,this);!0===(null==e?void 0:e.isSeeking)?C(HN,this,n):Number.isFinite(i)?n<=i?n<i&&C(HN,this,n-DN):(A(XN,this,QN).call(this,i,n),C(HN,this,n)):C(HN,this,n)}dispose(){C(KN,this,null),C(HN,this,-1e-6)}}function QN(t,e){const n="function"==typeof M(jN,this)?M(jN,this).call(this):[];A(XN,this,ZN).call(this,n,t,e,{onlySticky:!1})}function JN(t,e){if("function"!=typeof M(UN,this))return;const n=M(UN,this).call(this,e);A(XN,this,ZN).call(this,n,t,e,{onlySticky:!0})}function ZN(t,e,n,i={}){if("function"!=typeof M(qN,this)||"function"!=typeof M(VN,this))return;if(!Array.isArray(t)||!t.length)return;const r=!0===i.onlySticky,o=[];for(let i=0;i<t.length;i+=1){const s=t[i],a=null==s?void 0:s.placementId,l=null==s?void 0:s.nodeId;if(!a||!l)continue;const c=M(qN,this).call(this,l);if(!LN(c))continue;const u=zN(c);if(!u.length)continue;const d=qp(s);if(!Number.isFinite(d))continue;const h=Number.isFinite(null==s?void 0:s.nodeOffsetOverride)?s.nodeOffsetOverride:0,f="function"==typeof M($N,this)?M($N,this).call(this,s):void 0,p="number"==typeof f&&Number.isFinite(f)?d+f:Number.POSITIVE_INFINITY,m=r?d-DN:e;for(let t=0;t<u.length;t+=1){const e=WN(u[t]);for(let i=0;i<e.length;i+=1){const s=e[i],c=BN(null==s?void 0:s.timestamp),u=d+Math.max(0,c-h);u<=p&&(r&&!0!==(null==s?void 0:s.isSticky)||u>m&&u<=n&&"string"==typeof(null==s?void 0:s.name)&&s.name&&o.push({time:u,placementOffset:d,placementId:a,nodeId:l,cuepoint:s,trackIndex:t,cueIndex:i}))}}}o.length&&(o.sort(((t,e)=>t.time!==e.time?t.time-e.time:t.placementOffset!==e.placementOffset?t.placementOffset-e.placementOffset:t.placementId!==e.placementId?t.placementId<e.placementId?-1:1:t.trackIndex!==e.trackIndex?t.trackIndex-e.trackIndex:t.cueIndex-e.cueIndex)),o.forEach((t=>{const e=t.cuepoint,n={time:t.time,nodeId:t.nodeId,placementId:t.placementId,cuepoint:e};M(VN,this).call(this,"cuepoint",n),M(VN,this).call(this,e.name,n),"function"==typeof M(GN,this)&&(M(GN,this).call(this,t.nodeId,"cuepoint",n),M(GN,this).call(this,t.nodeId,e.name,n))})))}let tM=class{#J;#Z=0;#tt=new Set;constructor(t){this.#J="string"==typeof t?t:""}claim(t){if(t)return this.#tt.add(t),t;let e;do{e=`${this.#J}${++this.#Z}`}while(this.#tt.has(e));return this.#tt.add(e),e}reset(){this.#Z=0,this.#tt.clear()}};const eM=24e3/1001;function nM(t){var e;const n=null==t?void 0:t.frame;if(!n||!0===n.__closed||!0===n.closed)return 0;if("function"==typeof n.allocationSize)try{const t=Number(n.allocationSize());if(Number.isFinite(t)&&t>0)return t}catch(t){}const i=Number(null==n?void 0:n.byteLength);if(Number.isFinite(i)&&i>0)return i;const r=Number(null==n||null===(e=n.data)||void 0===e?void 0:e.byteLength);if(Number.isFinite(r)&&r>0)return r;const o=function(t,e){const n=Number(null==t?void 0:t.width),i=Number(null==t?void 0:t.height);return Number.isFinite(n)&&Number.isFinite(i)&&n>0&&i>0?{width:n,height:i}:RN(e)}(t,n),s=Number(null==o?void 0:o.width),a=Number(null==o?void 0:o.height);return Number.isFinite(s)&&Number.isFinite(a)&&s>0&&a>0?s*a*4:0}var 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,wM=new WeakMap,xM=new WeakMap,_M=new WeakMap,TM=new WeakMap,EM=new WeakMap,IM=new WeakMap,SM=new WeakMap,AM=new WeakMap,NM=new WeakMap,MM=new WeakMap,FM=new WeakMap,CM=new WeakMap,OM=new WeakMap,PM=new WeakMap,RM=new WeakMap,DM=new WeakSet;class LM extends Ou{constructor(...t){super(...t),O(this,DM),F(this,iM,void 0),F(this,rM,void 0),F(this,oM,void 0),F(this,sM,void 0),F(this,aM,void 0),F(this,lM,!1),F(this,cM,[]),F(this,uM,new tM("placement-")),F(this,dM,[]),F(this,hM,new tM("renderplacement-")),F(this,fM,void 0),F(this,pM,void 0),F(this,mM,void 0),F(this,vM,!1),F(this,gM,new Set),F(this,yM,new Set),F(this,bM,new Map),F(this,kM,[]),F(this,wM,0),F(this,xM,new Set),F(this,_M,new Set),F(this,TM,Number.NEGATIVE_INFINITY),F(this,EM,[]),F(this,IM,Number.NEGATIVE_INFINITY),F(this,SM,0),F(this,AM,void 0),F(this,NM,void 0),F(this,MM,new Map),F(this,FM,null),F(this,CM,void 0),F(this,OM,void 0),F(this,PM,void 0),F(this,RM,void 0);const[e,n={}]=t;C(iM,this,e),C(AM,this,n),C(aM,this,new OA(n)),C(fM,this,new zA(n)),C(sM,this,tv),A(DM,this,KM).call(this),A(DM,this,XM).call(this),C(CM,this,new IN({getState:()=>this.state,getNode:t=>M(iM,this)&&"function"==typeof M(iM,this).get?M(iM,this).get(t):void 0,getPlacementsActiveAtTime:t=>A(DM,this,AF).call(this,t,{endEpsilonSeconds:A(DM,this,LF).call(this)}),getLastStableState:()=>this.getLastStableState(),getPlaybackStartState:t=>this.getPlaybackStartState(t),clearVisualFrameBuffers:()=>A(DM,this,IF).call(this),updateTime:(t,e)=>this.updateTime(t,e),transitionTo:(t,e)=>this.transitionTo(t,e),trigger:(t,e)=>this.trigger(t,e)})),C(OM,this,new YN({getPlacements:()=>M(cM,this).slice(),getPlacementsActiveAtTime:t=>A(DM,this,AF).call(this,t),getPlacementDuration:t=>A(DM,this,cF).call(this,t),getNode:t=>M(iM,this)&&"function"==typeof M(iM,this).get?M(iM,this).get(t):void 0,triggerTimeline:(t,e)=>this.trigger(t,e),triggerNode:(t,e,n)=>{const i=M(iM,this)&&"function"==typeof M(iM,this).get?M(iM,this).get(t):void 0;i&&"function"==typeof i.trigger&&i.trigger(e,n)}})),C(PM,this,(()=>{var t,e;null===(t=M(OM,this))||void 0===t||null===(e=t.handleSeeked)||void 0===e||e.call(t,this.currentTime)})),this.on(Bu.TIMELINE_SEEKED,M(PM,this)),C(RM,this,(t=>A(DM,this,nF).call(this,t))),this.on("nodestart",M(RM,this)),this.transitionTo(Ym)}get name(){return"Timeline"}get defaults(){return{snapToFps:eM,maxBufferedVideoFrames:24}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"computeBuffered","notifyDecodedFrame","getDecodedFrameStats","getActiveRenderPlacement","maybeCompleteSeek","getPlacementsActiveAtTime","hasDecodedFirstFrame","getDecodedVisualBuffer","getPlacementDuration","getNode"])}transitionTo(t,e={}){const n=M(oM,this),i=function(t,e,n={}){const i=tN[t];return i?new i(e,n):null}(t,this,M(AM,this)),r=e&&"object"==typeof e&&!Array.isArray(e)?{...e,from:n,to:t}:{from:n,to:t};i?(M(rM,this)&&"function"==typeof M(rM,this).exit&&M(rM,this).exit(),C(rM,this,i),C(oM,this,t),"function"==typeof i.enter&&i.enter(r),this.trigger(Bu.TIMELINE_STATE_CHANGE,{from:n,to:t,options:e})):this.log.warn(`Unknown state "${t}"`)}recordStableState(t){C(sM,this,t)}getLastStableState(){return M(sM,this)}enableFirstFrameRenderedGate(){C(lM,this,!0)}getPlaybackStartState(t=this.currentTime){return this.shouldWaitForFirstRenderedFrame(t)?Jm:Qm}shouldWaitForFirstRenderedFrame(t=this.currentTime){if(!M(lM,this)||M(vM,this))return!1;const e=Number.isFinite(t)?t:this.currentTime,n=A(DM,this,AF).call(this,e);return Array.isArray(n)&&n.length>0}notifyFirstFrameRendered(){M(vM,this)||(C(vM,this,!0),this.state===Jm&&this.transitionTo(Qm,{fromFirstFramePending:!0}))}get state(){return M(oM,this)}get paused(){return M(oM,this)===Ym||M(oM,this)===tv}get currentTime(){return M(aM,this).currentTime}set currentTime(t){M(rM,this).seek(t)}get playbackRate(){return M(aM,this).playbackRate}set playbackRate(t){M(aM,this).playbackRate=t}play(){M(rM,this).play()}pause(){M(rM,this).pause()}reset(){M(rM,this).reset()}seekToPlacement(t){if(!t)throw new Error("Timeline.seekToPlacement requires placement id");A(DM,this,oF).call(this);const e=A(DM,this,OF).call(this,t);if(!e)throw new Error("Timeline.seekToPlacement requires placement id");const n=qp(e);if(!Number.isFinite(n))throw new Error("Timeline.seekToPlacement requires resolved placement offset");return this.currentTime=n,n}updateTime(t,e={}){var n,i;A(DM,this,oF).call(this),A(DM,this,sF).call(this),M(aM,this).seek(t),A(DM,this,SF).call(this,this.currentTime),A(DM,this,NF).call(this);const r="string"==typeof(null==e?void 0:e.source)?e.source:"set";null!==(n=M(OM,this))&&void 0!==n&&null!==(i=n.handleTimeUpdate)&&void 0!==i&&i.call(n,this.currentTime,{isSeeking:this.state===ev}),A(DM,this,iF).call(this,this.currentTime),A(DM,this,wF).call(this,this.currentTime),this.trigger(Bu.TIMELINE_TIME_UPDATE,zu(this.currentTime,r))}startSeeking(t,e){var n,i;null!==(n=M(OM,this))&&void 0!==n&&null!==(i=n.handleSeeking)&&void 0!==i&&i.call(n,this.currentTime,t),M(CM,this)&&"function"==typeof M(CM,this).start&&M(CM,this).start(t,e)}setSeekReturnState(t){M(CM,this)&&"function"==typeof M(CM,this).setReturnState&&M(CM,this).setReturnState(t)}maybeCompleteSeek(t){M(CM,this)&&"function"==typeof M(CM,this).maybeComplete&&M(CM,this).maybeComplete(t)}startPlaybackClock(){M(aM,this).play()}stopPlaybackClock(){M(aM,this).pause()}resetClock(){var t,e;C(vM,this,!1),M(aM,this).reset(),this.trigger(Bu.TIMELINE_RESET,{reason:"reset"}),null===(t=M(OM,this))||void 0===t||null===(e=t.dispose)||void 0===e||e.call(t)}applyTimelineDefinition(t={}){const e=Array.isArray(null==t?void 0:t.placements)?t.placements:[],n=Array.isArray(null==t?void 0:t.renderPlacements)?t.renderPlacements:[];A(DM,this,BM).call(this),A(DM,this,zM).call(this,e),A(DM,this,WM).call(this,n),this.currentTime=0}placeOnTimeline(t,e,n={}){const i=t&&"object"==typeof t?t.id:t;if(!i)throw new Error("Timeline.placeOnTimeline requires node id");const r=M(uM,this).claim(n.placementId),o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=Yp(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}:Xp(e,n);let u,d,h,f=!1;const p=null!==a;if(A(DM,this,oF).call(this),a){const t=M(cM,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=qp(t);if("start"===a.anchor)Number.isFinite(e)?u=A(DM,this,uF).call(this,e,{nodeOffsetOverride:o}):f=!0;else{const n=A(DM,this,cF).call(this,t);if(Number.isFinite(e)&&n>0){const t=e+n,i=A(DM,this,uF).call(this,t,{nodeOffsetOverride:o});u=Math.max(i,t)}else f=!0}}else if(l){const t=n.offsetAnchorPlacementId?M(cM,this).find((t=>(null==t?void 0:t.placementId)===n.offsetAnchorPlacementId)):M(cM,this).length?M(cM,this)[M(cM,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==t?void 0:t.placementId),d){const e=qp(t),n=A(DM,this,cF).call(this,t);Number.isFinite(e)&&n>0?u=A(DM,this,uF).call(this,e+n-c,{nodeOffsetOverride:o}):(f=!0,h="end")}else u=A(DM,this,uF).call(this,-c,{nodeOffsetOverride:o})}else u=Kp(e),u=A(DM,this,uF).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 $A({placementId:r,nodeId:i,offset:u,offsetPending:f,offsetAnchorPlacementId:f?d:void 0,offsetAnchorEdge:f?h:void 0,offsetAnchorIsReference:f?p:void 0,offsetEndSeconds:g,nodeOffsetOverride:o,nodeDurationOverride:s,loop:!0===n.loop,loopRootPlacementId:m,loopRootOffset:v});if(M(cM,this).push(y),Gp(M(cM,this)),A(DM,this,bF).call(this,y),A(DM,this,gF).call(this),f&&d){const t=M(cM,this).find((t=>(null==t?void 0:t.placementId)===d));A(DM,this,hF).call(this,null==t?void 0:t.nodeId)}return this.trigger(Bu.PLACEMENT_ADDED,y),r}placeRenderNodeOnTimeline(t,e,n,i={}){const r="string"==typeof t?t:null==t?void 0:t.type;if(!r||"string"!=typeof r)throw new Error("Timeline.placeRenderNodeOnTimeline requires render node type");const o=A(DM,this,dF).call(this,e,i),s=o.offset,a=!0===o.offsetPending,l=o.offsetAnchorPlacementId,c=o.offsetAnchorEdge,u=o.offsetAnchorIsReference,d=M(hM,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;Qp(M(dM,this),t,e,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements")}if(M(dM,this).push(v),Gp(M(dM,this)),a&&l){const t=M(cM,this).find((t=>(null==t?void 0:t.placementId)===l));A(DM,this,hF).call(this,null==t?void 0:t.nodeId)}return this.trigger(Bu.RENDER_PLACEMENT_ADDED,v),d}get placements(){return M(cM,this).slice()}getPlacementsActiveAtTime(t){return A(DM,this,AF).call(this,t)}getNodesAtTime(t){const e=A(DM,this,PF).call(this,t);if(!Number.isFinite(e))return[];const n=A(DM,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 A(DM,this,cF).call(this,t)}getNode(t){if(M(iM,this)&&"function"==typeof M(iM,this).get)return M(iM,this).get(t)}get renderPlacements(){return M(dM,this).slice()}get placementsAhead(){const t=this.currentTime;return M(cM,this).filter((e=>{const n=qp(e);if(!Number.isFinite(n))return!1;const i=A(DM,this,cF).call(this,e);return"number"==typeof i?n+i>t:n>=t}))}get buffered(){return M(rM,this)?M(rM,this).buffered:{start:0,end:0}}get trackBuffers(){return M(fM,this)}onDispose(){A(DM,this,GM).call(this),M(yM,this)&&M(yM,this).clear(),M(OM,this)&&"function"==typeof M(OM,this).dispose&&M(OM,this).dispose(),C(OM,this,null),A(DM,this,VM).call(this),A(DM,this,HM).call(this),M(CM,this)&&"function"==typeof M(CM,this).dispose&&M(CM,this).dispose(),C(CM,this,null),M(aM,this)&&"function"==typeof M(aM,this).dispose&&(M(NM,this)&&"function"==typeof M(aM,this).off&&(M(aM,this).off("tick",M(NM,this)),C(NM,this,null)),M(aM,this).dispose(),C(aM,this,null)),A(DM,this,mF).call(this),C(rM,this,null),C(oM,this,null),C(cM,this,[]),C(dM,this,[]),A(DM,this,vF).call(this),A(DM,this,gF).call(this),M(MM,this).clear(),C(FM,this,null)}notifyDecodedFrame(t={}){const e=null==t?void 0:t.placementId,n=null==t?void 0:t.trackType;if(!e||!n)return;const i=`${e}:${n}`;M(gM,this).add(i),A(DM,this,EF).call(this,t),A(DM,this,NF).call(this),M(rM,this)&&"function"==typeof M(rM,this).handleDecodedFrame&&M(rM,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=nM(t);Number.isFinite(i)&&i>0&&(e.totalBytes+=i)}))}return e.available=!0,e}(M(MM,this))}hasDecodedFirstFrame(t,e){return!(!t||!e)&&M(gM,this).has(`${t}:${e}`)}getDecodedVisualBuffer(t,e){if(t&&e)return M(MM,this).get(`${t}:${e}`)}computeBuffered(t){const e=M(iM,this);if(e&&"function"==typeof e.get)return M(fM,this).computeBuffered(M(cM,this),t,e)}getActiveRenderPlacement(t=this.currentTime){const e=Number.isFinite(t)?t:this.currentTime,n=Array.isArray(M(dM,this))?M(dM,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 BM(){C(vM,this,!1),this.trigger(Bu.TIMELINE_RESET,{reason:"switch"}),A(DM,this,IF).call(this),M(fM,this)&&"function"==typeof M(fM,this).reset&&M(fM,this).reset(),M(yM,this)&&M(yM,this).clear(),C(cM,this,[]),C(dM,this,[]),A(DM,this,vF).call(this),A(DM,this,gF).call(this),M(uM,this).reset(),M(hM,this).reset()}function zM(t=[]){for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||!n.nodeId)continue;const i=A(DM,this,jM).call(this,n),r=A(DM,this,$M).call(this,n);this.placeOnTimeline(n.nodeId,r,i)}}function WM(t=[]){for(let e=0;e<t.length;e+=1){const n=t[e];if(!n||!n.type)continue;const i=A(DM,this,UM).call(this,n),r=A(DM,this,qM).call(this,n);this.placeRenderNodeOnTimeline(n.type,r,n.duration,i)}}function jM(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 UM(t){const e={};return t.renderPlacementId&&(e.renderPlacementId=t.renderPlacementId),t.params&&"object"==typeof t.params&&(e.params=t.params),e}function $M(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 qM(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 VM(){M(rM,this)&&"function"==typeof M(rM,this).exit&&M(rM,this).exit()}function GM(){M(PM,this)&&"function"==typeof this.off&&(this.off(Bu.TIMELINE_SEEKED,M(PM,this)),C(PM,this,null)),M(RM,this)&&"function"==typeof this.off&&(this.off("nodestart",M(RM,this)),C(RM,this,null))}function HM(){M(fM,this)&&(M(pM,this)&&(M(fM,this).off("track:underflow",M(pM,this)),C(pM,this,null)),M(mM,this)&&(M(fM,this).off("track:ready",M(mM,this)),C(mM,this,null)),"function"==typeof M(fM,this).dispose&&M(fM,this).dispose(),C(fM,this,null))}function KM(){M(fM,this)&&"function"==typeof M(fM,this).on&&(C(pM,this,(t=>A(DM,this,QM).call(this,t))),C(mM,this,(t=>A(DM,this,JM).call(this,t))),M(fM,this).on(Bu.TRACK_UNDERFLOW,M(pM,this)),M(fM,this).on(Bu.TRACK_READY,M(mM,this)))}function XM(){M(aM,this)&&"function"==typeof M(aM,this).on&&(C(NM,this,(t=>A(DM,this,YM).call(this,t))),M(aM,this).on(Bu.CLOCK_TICK,M(NM,this)))}function YM(t){var e,n;A(DM,this,oF).call(this),A(DM,this,NF).call(this),null!==(e=M(OM,this))&&void 0!==e&&null!==(n=e.handleTimeUpdate)&&void 0!==n&&n.call(e,this.currentTime,{isSeeking:!1}),A(DM,this,iF).call(this,this.currentTime),this.trigger(Bu.TIMELINE_TIME_UPDATE,zu(this.currentTime,"clock")),M(rM,this)&&"function"==typeof M(rM,this).handleClockTick&&M(rM,this).handleClockTick(t)}function QM(t){A(DM,this,oF).call(this);const e=A(DM,this,ZM).call(this);e&&(null==t?void 0:t.trackType)===e.trackType&&(M(rM,this)&&"function"==typeof M(rM,this).handleMainTrackUnderflow?M(rM,this).handleMainTrackUnderflow(t):this.transitionTo(Zm))}function JM(t){if(A(DM,this,oF).call(this),this.state!==Zm)return;const e=A(DM,this,ZM).call(this);if(!e)return;if((null==t?void 0:t.trackType)!==e.trackType)return;if(M(rM,this)&&"function"==typeof M(rM,this).handleMainTrackReady)return void M(rM,this).handleMainTrackReady(t);const n=this.getLastStableState()||tv;this.transitionTo(n)}function ZM(t=this.currentTime){const e=A(DM,this,eF).call(this,t);if(!e)return;const n=M(iM,this)&&"function"==typeof M(iM,this).get?M(iM,this).get(e.nodeId):void 0;if(!n)return;const i=A(DM,this,tF).call(this,n);return i?{placement:e,trackType:i}:void 0}function tF(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 eF(t=this.currentTime){const e=M(cM,this)||[];let n;for(let i=0;i<e.length;i+=1){const r=e[i],o=qp(r);if(!Number.isFinite(o))continue;const s=A(DM,this,cF).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 nF(t={}){if(this.state!==Qm)return;const e=null==t?void 0:t.placementId;if(!e)return;const n=A(DM,this,OF).call(this,e);n&&A(DM,this,rF).call(this,n)}function iF(t=this.currentTime){if(this.state!==Qm)return;const e=A(DM,this,AF).call(this,t);Array.isArray(e)&&e.length&&e.forEach((t=>A(DM,this,rF).call(this,t)))}function rF(t){const e=null==t?void 0:t.placementId;if(!e)return;if(M(yM,this).has(e))return;if(!t||!0!==t.loop)return;if(!t.nodeId)return;const n=A(DM,this,cF).call(this,t);if(!Number.isFinite(n)||n<=0)return;const i=qp(t);if(!Number.isFinite(i))return;const r=i+n;if(!Number.isFinite(r))return;const o=t.loopRootPlacementId||t.placementId,s=Number.isFinite(t.loopRootOffset)?t.loopRootOffset:i;M(yM,this).add(e),this.placeOnTimeline(t.nodeId,r,{nodeOffsetOverride:t.nodeOffsetOverride,nodeDurationOverride:t.nodeDurationOverride,loop:!0,loopRootPlacementId:o,loopRootOffset:s})}function oF(){const t=Hp(M(cM,this),{getPlacementDuration:t=>A(DM,this,cF).call(this,t),snapPlacementOffset:(t,e)=>A(DM,this,uF).call(this,t,{nodeOffsetOverride:null==e?void 0:e.nodeOffsetOverride}),onResolvedPlacement:(t,e)=>{!0!==t.loop||Number.isFinite(t.loopRootOffset)||(t.loopRootOffset=t.offset),A(DM,this,fF).call(this,null==e?void 0:e.nodeId)}});return t.updated&&(A(DM,this,gF).call(this),t.resolvedPlacements.forEach((t=>{A(DM,this,bF).call(this,t),this.trigger(Bu.PLACEMENT_ADDED,t)}))),t.updated}function sF(){if(!M(dM,this).length||!M(cM,this).length)return!1;const t=new Map;M(cM,this).forEach((e=>{(null==e?void 0:e.placementId)&&t.set(e.placementId,e)}));const e=M(dM,this).filter((t=>!0===(null==t?void 0:t.offsetPending)));if(!e.length)return!1;let n=!1;const i=[];for(let r=0;r<e.length;r+=1){const o=e[r];A(DM,this,aF).call(this,o,t)&&(n=!0,i.push(o))}return n&&(Gp(M(dM,this)),i.forEach((t=>{this.trigger(Bu.RENDER_PLACEMENT_ADDED,t)}))),n}function aF(t,e){const n=null==t?void 0:t.offsetAnchorPlacementId,i=null==t?void 0:t.offsetAnchorEdge;if(!n||!i)return!1;const r=e.get(n);if(!r||!0===r.offsetPending)return!1;const o=A(DM,this,lF).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 Qp(M(dM,this).filter((e=>e!==t&&!0!==(null==e?void 0:e.offsetPending))),s,a,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements"),A(DM,this,fF).call(this,null==r?void 0:r.nodeId),!0}function lF(t,e){const n=qp(t);if(!Number.isFinite(n))return;if("start"===e.offsetAnchorEdge)return A(DM,this,uF).call(this,n);const i=A(DM,this,cF).call(this,t);if(!(i>0))return;const r=n+i;if(!Number.isFinite(r))return;const o=A(DM,this,uF).call(this,r);return!0===e.offsetAnchorIsReference?Math.max(o,r):o}function cF(t){return Up(t,M(iM,this))}function uF(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 dF(t,e={}){const n=Yp(t);if("string"==typeof t&&t.includes("@")&&!n)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");if(!n){const n=Kp(t);return{offset:A(DM,this,uF).call(this,n,e)}}const i=M(cM,this).find((t=>(null==t?void 0:t.placementId)===n.placementId));if(!i)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");const r=qp(i);if("start"===n.anchor)return Number.isFinite(r)?{offset:A(DM,this,uF).call(this,r,e)}:{offset:void 0,offsetPending:!0,offsetAnchorPlacementId:i.placementId,offsetAnchorEdge:"start",offsetAnchorIsReference:!0};const o=A(DM,this,cF).call(this,i);if(!(Number.isFinite(r)&&o>0))return{offset:void 0,offsetPending:!0,offsetAnchorPlacementId:i.placementId,offsetAnchorEdge:"end",offsetAnchorIsReference:!0};const s=r+o,a=A(DM,this,uF).call(this,s,e);return{offset:Math.max(a,s)}}function hF(t){if(!t||!M(iM,this)||"function"!=typeof M(iM,this).get)return;if(M(bM,this).has(t))return;let e;try{e=M(iM,this).get(t)}catch(t){return}if(!e||"function"!=typeof e.on)return;if("ready"===e.state&&e.duration>0)return void this.updateTime(this.currentTime);const n=()=>{this.updateTime(this.currentTime),A(DM,this,fF).call(this,t)};e.on(Bu.NODE_LOADED,n),M(bM,this).set(t,n)}function fF(t){if(!t)return;if(A(DM,this,pF).call(this,t))return;const e=M(bM,this).get(t);if(!e)return;let n;try{n=M(iM,this).get(t)}catch(t){n=null}n&&"function"==typeof n.off&&n.off(Bu.NODE_LOADED,e),M(bM,this).delete(t)}function pF(t){if(!t)return!1;const e=new Map;M(cM,this).forEach((t=>{(null==t?void 0:t.placementId)&&e.set(t.placementId,t)}));const n=n=>{if(null==n||!n.offsetPending||null==n||!n.offsetAnchorPlacementId)return!1;const i=e.get(n.offsetAnchorPlacementId);return(null==i?void 0:i.nodeId)===t};return!!M(cM,this).some((t=>n(t)))||!!M(dM,this).some((t=>n(t)))}function mF(){M(bM,this).size&&M(iM,this)?(M(bM,this).forEach(((t,e)=>{let n;try{n=M(iM,this).get(e)}catch(t){n=null}n&&"function"==typeof n.off&&n.off(Bu.NODE_LOADED,t)})),M(bM,this).clear()):M(bM,this).clear()}function vF(){C(kM,this,[]),C(wM,this,0),M(xM,this).clear(),M(_M,this).clear(),C(TM,this,Number.NEGATIVE_INFINITY)}function gF(){C(EM,this,[]),C(SM,this,0),C(IM,this,Number.NEGATIVE_INFINITY)}function yF(t,e){const n=M(kM,this),i={placementId:t,endTime:e};if(!n.length||e>=n[n.length-1].endTime)return void n.push(i);const r=n.findIndex((t=>e<t.endTime)),o=-1===r?n.length:r;n.splice(o,0,i),o<M(wM,this)&&C(wM,this,M(wM,this)+1)}function bF(t){const e=null==t?void 0:t.placementId;if(!e||M(xM,this).has(e))return;const n=qp(t),i=A(DM,this,cF).call(this,t);if(!Number.isFinite(n)||!Number.isFinite(i)||i<0)return void M(_M,this).add(e);const r=n+i;Number.isFinite(r)&&(M(xM,this).add(e),M(_M,this).delete(e),A(DM,this,yF).call(this,e,r))}function kF(){M(_M,this).size&&Array.from(M(_M,this)).forEach((t=>{const e=A(DM,this,OF).call(this,t);e?A(DM,this,bF).call(this,e):M(_M,this).delete(t)}))}function wF(t){const e=Number(t);if(!Number.isFinite(e))return;if(e<M(TM,this))return void C(TM,this,e);if(C(TM,this,e),A(DM,this,kF).call(this),!M(kM,this).length)return;const n=new Set;let i=M(wM,this);for(;i<M(kM,this).length;){const t=M(kM,this)[i];if(!t||!Number.isFinite(t.endTime)||t.endTime>e)break;t.placementId&&n.add(t.placementId),i+=1}i!==M(wM,this)&&(C(wM,this,i),n.size&&(A(DM,this,TF).call(this,n),A(DM,this,xF).call(this,n)))}function xF(t){if(t&&t.size)for(const e of M(gM,this)){const n=e.split(":")[0];t.has(n)&&M(gM,this).delete(e)}}function _F(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 TF(t){if(t&&t.size)for(const[e,n]of M(MM,this).entries())t.has(null==n?void 0:n.placementId)&&(A(DM,this,_F).call(this,n),M(MM,this).delete(e))}function EF(t={}){var e;const n=null==t?void 0:t.placementId,i=null==t?void 0:t.nodeId,r=null==t?void 0:t.trackId,o=null==t?void 0:t.segmentId,s=null==t?void 0:t.trackType;if(!(n&&i&&r&&o))return;if("video"!==s&&"image"!==s)return;const a=(null==t?void 0:t.frame)||(null==t?void 0:t.data);if(!a)return;"video"===s&&"object"==typeof a&&"function"==typeof a.close&&(a.__keepOpen=!0);const l=RN(a),c=Number.isFinite(null==l?void 0:l.width)?l.width:void 0,u=Number.isFinite(null==l?void 0:l.height)?l.height:void 0,d=Number.isFinite(null==t?void 0:t.pts)?t.pts:void 0;if(!Number.isFinite(d))return;const h=Number.isFinite(null==t?void 0:t.duration)?t.duration:void 0,f=`${n}:${r}`,p=M(MM,this).get(f),m=p||{placementId:n,nodeId:i,trackId:r,trackType:s,frames:[],current:void 0},v={placementId:n,nodeId:i,trackId:r,segmentId:o,frame:a,width:c,height:u,presentationTime:d,duration:h},g=m.frames,y=g.length?g[g.length-1]:void 0;if(!y||y.presentationTime<=v.presentationTime)g.push(v);else{let t=g.findIndex((t=>t.presentationTime>v.presentationTime));-1===t&&(t=g.length),g.splice(t,0,v)}const b=Number(null===(e=this.settings)||void 0===e?void 0:e.maxBufferedVideoFrames);if("video"===s&&Number.isFinite(b)&&b>0&&g.length>b){const t=g.length-b;for(let e=0;e<t;e+=1){const t=g.pop(),e=null==t?void 0:t.frame;if(e&&"function"==typeof e.close)try{e.close()}catch(t){}}}p||M(MM,this).set(f,m)}function IF(){for(const t of M(MM,this).values())A(DM,this,_F).call(this,t);M(MM,this).clear(),C(FM,this,null),M(gM,this).clear()}function SF(t){const e=Number.isFinite(t)?t:this.currentTime;if(!Number.isFinite(e))return;e<M(IM,this)&&(C(EM,this,[]),C(SM,this,0));const n=Array.isArray(M(cM,this))?M(cM,this):[],i=[],r=new Set;M(EM,this).forEach((t=>{A(DM,this,BF).call(this,t,e)&&(i.push(t),(null==t?void 0:t.placementId)&&r.add(t.placementId))}));let o=M(SM,this);for(;o<n.length;){const t=n[o],s=qp(t);if(!Number.isFinite(s))break;if(s>e)break;if(A(DM,this,BF).call(this,t,e)){const e=null==t?void 0:t.placementId;e&&r.has(e)||(i.push(t),e&&r.add(e))}o+=1}C(EM,this,i),C(SM,this,o),C(IM,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===M(IM,this)?M(EM,this).slice():(Array.isArray(M(cM,this))?M(cM,this):[]).filter((t=>A(DM,this,BF).call(this,t,n,i)))}function NF(){const t=this.currentTime,e=A(DM,this,FF).call(this,t);if(!e.length)return void C(FM,this,null);const n=this.getActiveRenderPlacement(t),i=A(DM,this,CF).call(this,e,n);(i!==M(FM,this)||A(DM,this,MF).call(this,t,n))&&(C(FM,this,i),this.trigger(Bu.VISUAL_FRAMES_AVAILABLE,{time:t,frames:e}))}function MF(t,e){const n=e||this.getActiveRenderPlacement(t);if(!n)return!1;if(!xm.doesRenderNodeTypeRequireFrameCadence(null==n?void 0:n.type))return!1;const i=n.duration;return"number"==typeof i&&i>0}function FF(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){MN(c),a.push(t);continue}if("function"==typeof r&&!r(u,n)){const e=FN(u),i="function"==typeof o?o(u):void 0;Number.isFinite(i)&&Number.isFinite(e)&&n>=e+i&&(MN(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&&NN(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:FN(u),placementSortOffset:CN(u),placementSortId:ON(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=PN(r),a=PN(o);return Number.isFinite(s)&&Number.isFinite(a)&&s!==a?s-a:r&&o&&r!==o?r<o?-1:1:function(t,e){const n=(null==t?void 0:t.frame)||{},i=(null==e?void 0:e.frame)||{};return n.trackId!==i.trackId?n.trackId<i.trackId?-1:1:n.nodeId!==i.nodeId?n.nodeId<i.nodeId?-1:1:n.segmentId!==i.segmentId?n.segmentId<i.segmentId?-1:1:("number"==typeof n.presentationTime?n.presentationTime:0)-("number"==typeof i.presentationTime?i.presentationTime:0)}(t,e)})),s.map((t=>t.frame))}({buffers:M(MM,this),time:t,getPlacementById:t=>A(DM,this,OF).call(this,t),isPlacementActiveAtTime:(t,e)=>A(DM,this,BF).call(this,t,e),getPlacementDuration:t=>A(DM,this,cF).call(this,t)})}function CF(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 OF(t){if(t)return(M(cM,this)||[]).find((e=>(null==e?void 0:e.placementId)===t))}function PF(t){if("end"===t){const t=A(DM,this,RF).call(this);if(!Number.isFinite(t))return;const e=A(DM,this,DF).call(this);return Math.max(0,t-Math.min(t,e))}const e=Number(t);return Number.isFinite(e)?e:0}function RF(){let t;return(Array.isArray(M(cM,this))?M(cM,this):[]).forEach((e=>{const n=qp(e);if(!Number.isFinite(n))return;const i=A(DM,this,cF).call(this,e);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(t)||r>t)&&(t=r)})),t}function DF(){const t=A(DM,this,LF).call(this);return t>0?t:.001}function LF(){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 BF(t,e,n=0){if(!Vp(t,e,M(iM,this)))return!1;const i=Number(n);if(!Number.isFinite(i)||i<=0)return!0;const r=A(DM,this,cF).call(this,t);if(!Number.isFinite(r))return!0;const o=qp(t);return!Number.isFinite(o)||e<o+r-i}var zF=new WeakMap,WF=new WeakMap,jF=new WeakMap,UF=new WeakMap,$F=new WeakMap,qF=new WeakMap,VF=new WeakMap,GF=new WeakMap,HF=new WeakMap,KF=new WeakMap,XF=new WeakMap,YF=new WeakMap,QF=new WeakMap,JF=new WeakMap,ZF=new WeakMap,tC=new WeakMap,eC=new WeakMap,nC=new WeakSet;class iC extends Ou{get name(){return"QoE"}get defaults(){return{calcScoreInterval:1,streamQualityWeight:.8,fpsWeight:.2,fpsMathFuncType:"quad",bestFpsMobile:27,bestFpsDesktop:57,waitingMultiplier:1,statusFloors:{excellent:.98,good:.85,fair:.7,poor:0,alert:0},alertStatusCeil:.3,fpsGracePeriod:2,windowSeconds:30}}constructor(...t){super(...t),O(this,nC),F(this,zF,void 0),F(this,WF,void 0),F(this,jF,1),F(this,UF,1),F(this,$F,1),F(this,qF,""),F(this,VF,0),F(this,GF,[]),F(this,HF,null),F(this,KF,void 0),F(this,XF,[]),F(this,YF,null),F(this,QF,null),F(this,JF,0),F(this,ZF,0),F(this,tC,0),F(this,eC,void 0);const[e]=t;C(zF,this,e),C(JF,this,ry()),C(eC,this,A(nC,this,rC).call(this)),A(nC,this,oC).call(this),A(nC,this,sC).call(this),A(nC,this,dC).call(this),A(nC,this,cC).call(this)}get publicAPI(){return M(eC,this)}calcScore(){A(nC,this,kC).call(this)}onDispose(){M(zF,this)&&M(WF,this)&&"function"==typeof M(zF,this).off&&M(zF,this).off(Bu.TIMELINE_PLAYER_STATE,M(WF,this)),C(WF,this,null),A(nC,this,uC).call(this),A(nC,this,hC).call(this),C(zF,this,null),C(XF,this,[]),C(GF,this,[]),C(eC,this,null)}}function rC(){const t=this;return{get score(){return M(jF,t)},get status(){return M(qF,t)},get streamQualityScore(){return M(UF,t)},get fpsScore(){return M($F,t)},get browserFps(){return M(VF,t)},get waitingSeconds(){return M(ZF,t)/1e3},get playingSeconds(){return M(tC,t)/1e3}}}function oC(){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 sC(){M(zF,this)&&"function"==typeof M(zF,this).on&&(C(WF,this,(t=>A(nC,this,aC).call(this,t))),M(zF,this).on(Bu.TIMELINE_PLAYER_STATE,M(WF,this)))}function aC(t={}){const e="string"==typeof(null==t?void 0:t.event)?t.event:"";"playing"!==e?"waiting"!==e?"pause"!==e&&"seeking"!==e&&"seeked"!==e&&"reset"!==e||A(nC,this,lC).call(this,null):A(nC,this,lC).call(this,"waiting"):A(nC,this,lC).call(this,"playing")}function lC(t){if(t===M(YF,this))return;const e=ry();M(YF,this)&&Number.isFinite(M(QF,this))&&M(XF,this).push({state:M(YF,this),startMs:M(QF,this),endMs:e}),C(YF,this,t),C(QF,this,t?e:null),A(nC,this,mC).call(this,e)}function cC(){const t=Number(this.settings.calcScoreInterval);!Number.isFinite(t)||t<=0||(C(KF,this,(()=>A(nC,this,kC).call(this))),jk(M(KF,this),1e3*t))}function uC(){M(KF,this)&&Uk(M(KF,this)),C(KF,this,null)}function dC(){if("function"!=typeof Fk)return;const t=()=>{if(this._disposed)return;const e=ry();C(VF,this,A(nC,this,fC).call(this,M(GF,this),e)),C(HF,this,Fk(t))};C(HF,this,Fk(t))}function hC(){M(HF,this)&&"function"==typeof Ck&&Ck(M(HF,this)),C(HF,this,null)}function fC(t,e){const n=A(nC,this,pC).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 pC(){const t=Number(this.settings.windowSeconds);return!Number.isFinite(t)||t<=0?3e4:1e3*t}function mC(t){const e=t-A(nC,this,pC).call(this);for(;M(XF,this).length&&M(XF,this)[0].endMs<=e;)M(XF,this).shift()}function vC(t){const e=t-A(nC,this,pC).call(this);let n=0,i=0;const r=(r,o,s)=>{const a=Math.max(o,e),l=Math.min(s,t);l<=a||("waiting"===r?n+=l-a:"playing"===r&&(i+=l-a))};return M(XF,this).forEach((t=>{r(t.state,t.startMs,t.endMs)})),M(YF,this)&&Number.isFinite(M(QF,this))&&r(M(YF,this),M(QF,this),t),C(ZF,this,n),C(tC,this,i),{waitingMs:n,playingMs:i}}function gC(t,e){if(t<=0)return 1;if(t>e)return 0;const n=e||1;return Wp(1-t*this.settings.waitingMultiplier/n)}function yC(){if(ry()-M(JF,this)<=1e3*this.settings.fpsGracePeriod)return 1;const t=Number(M(VF,this)),e=Km.isDesktop()?this.settings.bestFpsDesktop:this.settings.bestFpsMobile,n=Wp(e>0?t/e:0);return"quad"===this.settings.fpsMathFuncType?n*n:n}function bC(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 kC(){const t=ry(),{waitingMs:e,playingMs:n}=A(nC,this,vC).call(this,t),i=A(nC,this,gC).call(this,e,n),r=A(nC,this,yC).call(this),o=Wp(i*this.settings.streamQualityWeight+r*this.settings.fpsWeight);o!==M(jF,this)&&(C(jF,this,o),this.trigger(Bu.QOE_SCORE,o)),C(UF,this,i),C($F,this,r);const s=A(nC,this,bC).call(this,o,e);s!==M(qF,this)&&(C(qF,this,s),this.trigger(Bu.QOE_STATUS,s))}function wC(t,e=0){const n=Number(t);return Number.isFinite(n)?n:e}function xC(t){const e=Number(t);return!Number.isFinite(e)||e<0?0:e}var _C=new WeakMap,TC=new WeakMap,EC=new WeakMap,IC=new WeakMap,SC=new WeakSet;class AC extends Ou{get name(){return"SegmentEvictionCoordinator"}get defaults(){return{enabled:wy("segmentEvictionEnabled"),bufferBehindSeconds:wy("segmentEvictionBufferBehindSeconds"),bufferAheadSeconds:wy("segmentEvictionBufferAheadSeconds"),maxRetainedBytes:wy("segmentEvictionMaxRetainedBytes")}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"evictAtTime"])}constructor(t,e,n={}){super(n),O(this,SC),F(this,_C,void 0),F(this,TC,void 0),F(this,EC,void 0),F(this,IC,void 0),C(_C,this,t),C(TC,this,e),C(EC,this,(t=>A(SC,this,NC).call(this,t))),C(IC,this,(t=>A(SC,this,MC).call(this,t))),M(_C,this)&&"function"==typeof M(_C,this).on&&(M(_C,this).on(Bu.TIMELINE_TIME_UPDATE,M(EC,this)),M(_C,this).on(Bu.TIMELINE_SEEKED,M(IC,this)))}onDispose(){M(_C,this)&&"function"==typeof M(_C,this).off&&(M(_C,this).off(Bu.TIMELINE_TIME_UPDATE,M(EC,this)),M(_C,this).off(Bu.TIMELINE_SEEKED,M(IC,this))),C(_C,this,null),C(TC,this,null),C(EC,this,null),C(IC,this,null)}evictAtTime(t){if(!0!==this.settings.enabled)return;const e=Number(t);if(!Number.isFinite(e))return;const n=xC(this.settings.bufferBehindSeconds),i=xC(this.settings.bufferAheadSeconds),r=e-n,o=e+i,s=A(SC,this,FC).call(this);if(!s.length)return;const a=Number(this.settings.maxRetainedBytes);if(Number.isFinite(a)&&a>0&&A(SC,this,CC).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=qp(t);if(!Number.isFinite(n))return;const i=l.get(e)||[];i.push(t),l.set(e,i)})),l.size&&l.forEach(((t,e)=>{const n=A(SC,this,OC).call(this,e);if(!n)return;const i=t.filter((t=>A(SC,this,PC).call(this,t,r,o)));i.length?A(SC,this,RC).call(this,n,i,r,o):"function"==typeof n.evict&&n.evict()}))}}function NC(t){var e,n;if(!0!==this.settings.enabled)return;if((null===(e=M(_C,this))||void 0===e?void 0:e.state)===ev)return;const i=Number(null==t?void 0:t.time),r=Number.isFinite(i)?i:Number(null===(n=M(_C,this))||void 0===n?void 0:n.currentTime);this.evictAtTime(r)}function MC(t){var e;if(!0!==this.settings.enabled)return;const n=Number(null==t?void 0:t.targetTime),i=Number.isFinite(n)?n:Number(null===(e=M(_C,this))||void 0===e?void 0:e.currentTime);this.evictAtTime(i)}function FC(){var t;const e=null===(t=M(_C,this))||void 0===t?void 0:t.placements;return Array.isArray(e)?e:[]}function CC(t){if(!Array.isArray(t)||!t.length)return 0;const e=new Set;let n=0;return t.forEach((t=>{const i=null==t?void 0:t.nodeId;if(!i||e.has(i))return;e.add(i);const r=A(SC,this,OC).call(this,i),o=Number(null==r?void 0:r.retainedByteLength);Cg(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=>{Cg(null==t?void 0:t.retainedByteLength)&&(n+=t.retainedByteLength)}))}))})),n}function OC(t){if(M(TC,this)&&"function"==typeof M(TC,this).get)return M(TC,this).get(t)}function PC(t,e,n){const i=qp(t);if(!Number.isFinite(i))return!1;const r=Up(t,M(TC,this));return(Number.isFinite(r)?i+r:Number.POSITIVE_INFINITY)>e&&i<n}function RC(t,e,n,i){const r=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];r.length&&r.forEach((t=>{const r=Array.isArray(null==t?void 0:t.segments)?t.segments:[],o=wC(null==t?void 0:t.offset,0);r.forEach((t=>{if(!t||!Cg(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=qp(a);if(!Number.isFinite(l))continue;const c=wC(null==a?void 0:a.nodeOffsetOverride,0),u=wC(null==t?void 0:t.offset,NaN);if(!Number.isFinite(u))continue;const d=wC(null==t?void 0:t.duration,0),h=l+o+u-c,f=h+(d>0?d:0),p=Up(a,M(TC,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 DC=new WeakMap,LC=new WeakMap,BC=new WeakMap,zC=new WeakSet;class WC extends Ou{get name(){return"DocumentVisibility"}get defaults(){return{autoPauseOnVisibilityChange:!0,autoResumeOnVisibilityChange:!0}}constructor(t,e={}){super(e),O(this,zC),F(this,DC,void 0),F(this,LC,null),F(this,BC,!1),C(DC,this,t),A(zC,this,jC).call(this)}onDispose(){A(zC,this,UC).call(this),C(DC,this,null),C(BC,this,!1)}}function jC(){const t=null==Du?void 0:Du.document;t&&"function"==typeof t.addEventListener&&(C(LC,this,(()=>A(zC,this,$C).call(this))),t.addEventListener("visibilitychange",M(LC,this)))}function UC(){const t=null==Du?void 0:Du.document;M(LC,this)&&t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",M(LC,this)),C(LC,this,null)}function $C(){const t=null==Du?void 0:Du.document,e=null==t?void 0:t.visibilityState;"string"==typeof e&&("hidden"!==e?"visible"===e&&A(zC,this,VC).call(this):A(zC,this,qC).call(this))}function qC(){var t;(null===(t=this.settings)||void 0===t?void 0:t.autoPauseOnVisibilityChange)&&M(DC,this)&&"function"==typeof M(DC,this).pause&&(M(DC,this).state===Qm?(this.log.info("[#handleHidden] Pausing timeline due to document visibility change"),M(DC,this).pause(),C(BC,this,!0)):C(BC,this,!1))}function VC(){var t;M(BC,this)&&(null===(t=this.settings)||void 0===t?void 0:t.autoResumeOnVisibilityChange)&&M(DC,this)&&"function"==typeof M(DC,this).play&&(M(DC,this).state!==Qm?(this.log.info("[#handleVisible] Resuming timeline due to document visibility change"),M(DC,this).play(),C(BC,this,!1)):C(BC,this,!1))}const GC=[{event:"canplay",once:!0,trackAs:"canplay"},{event:"playing",once:!0,trackAs:"startedplaying"},"seeked","canvas.webglcontextlost"];function HC(t,e=0){return Number.isFinite(t)?t:e}function KC(t){const e=null==t?void 0:t.exposedPlayerAPI;return e&&"object"==typeof e?e:t}const XC=[function(t){return{schema:"iglu:com.helloeko/player/jsonschema/1-0-7",match:/^.*$/,getData:()=>{var e,n,i;const r=function(t){const e=null==t?void 0:t.exposedPlayerAPI;return e&&"object"==typeof e?e:t}(t);return{playerversion:"string"==typeof(null==r?void 0:r.version)?r.version:"0.0.0",isautoplay:!(null==r||null===(e=r.options)||void 0===e||!e.autoplay),playerqoe:HC(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:HC(null==r?void 0:r.volume),playercontainerwidth:HC(null==r?void 0:r.containerWidth),playercontainerheight:HC(null==r?void 0:r.containerHeight)}}}},function(t){return{schema:"iglu:com.helloeko/currentnode/jsonschema/1-0-2",match:/^.*$/,getData:()=>{var e;const n=KC(t),i=function(t){const e=KC(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==Du||null===(t=Du.eko)||void 0===t||null===(t=t.environment)||void 0===t?void 0:t.embeddingApp;return e?{embeddingapp:e}:{}}}}],YC=Object.freeze({once:!1,trackAs:""});var QC=new WeakMap,JC=new WeakMap,ZC=new WeakMap,tO=new WeakMap,eO=new WeakMap,nO=new WeakMap,iO=new WeakSet;class rO extends Ou{get name(){return"Tracker"}get defaults(){return{tag:null,trackingEnabled:wy("trackingEnabled"),defaultForwarders:GC,defaultContextPackers:XC}}constructor(t,e={}){var n,i;super(e),O(this,iO),F(this,QC,void 0),F(this,JC,new Map),F(this,ZC,[]),F(this,tO,!1),F(this,eO,void 0),F(this,nO,void 0),C(nO,this,!this.settings.tag),C(eO,this,this.settings.tag||(null===(n=crypto)||void 0===n||null===(i=n.randomUUID)||void 0===i?void 0:i.call(n))||`eko-player-${Date.now()}`),C(QC,this,t),A(iO,this,dO).call(this),A(iO,this,sO).call(this)}track(t,...e){if(!this.settings.trackingEnabled)return;if("string"!=typeof t||!t)return void this.log.warn("[track] Expected event to be a non-empty string.");const n=A(iO,this,fO).call(this);n&&n("track",t,...e,M(eO,this))}registerContextPacker(t){if(!t||"object"!=typeof t)return void this.log.warn("[registerContextPacker] Expected a packer object.");const e={tag:M(eO,this),schema:t.schema,match:t.match,getData:A(iO,this,oO).call(this,t.getData)};if("string"!=typeof e.schema||!e.schema)return void this.log.warn('[registerContextPacker] Expected "schema" to be a non-empty string.');if("function"!=typeof e.getData)return void this.log.warn('[registerContextPacker] Expected "getData" to be a function.');if(!this.settings.trackingEnabled)return;const n=A(iO,this,fO).call(this);n&&n("registerContextPacker",e)}onDispose(){if(A(iO,this,uO).call(this),A(iO,this,hO).call(this),C(QC,this,null),M(nO,this)){const t=A(iO,this,fO).call(this);t&&(t("reset",M(eO,this)),C(eO,this,null))}}}function oO(t){return"function"!=typeof t?null:(...e)=>e.pop()!==M(eO,this)?null:t(...e)}function sO(){(Array.isArray(this.settings.defaultForwarders)?this.settings.defaultForwarders:[]).forEach((t=>A(iO,this,aO).call(this,t)))}function aO(t){const e=A(iO,this,lO).call(this,t);if(!e)return void this.log.warn("[#addEventForwarder] Invalid forwarder input.",t);const n=M(QC,this);if(!n||"function"!=typeof n.on)return;const i=A(iO,this,cO).call(this,e);if(M(JC,this).has(i))return;const r=(...t)=>{e.once&&n&&"function"==typeof n.off&&n.off(e.event,r);const i=e.trackAs||e.event;this.track(i,...t)};n.on(e.event,r),M(JC,this).set(i,{event:e.event,listener:r})}function lO(t){return"string"==typeof t&&t?{event:t,...YC}: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 cO({event:t,once:e,trackAs:n}){return`${t}:${e}:${n}`}function uO(){const t=M(QC,this);t&&"function"==typeof t.off&&M(JC,this).forEach((({event:e,listener:n})=>{t.off(e,n)})),M(JC,this).clear()}function dO(){(Array.isArray(this.settings.defaultContextPackers)?this.settings.defaultContextPackers:[]).forEach((t=>{if("function"!=typeof t)return;const e=t(M(QC,this),this);e&&"object"==typeof e&&("function"==typeof e.dispose&&M(ZC,this).push(e.dispose),e.disabled||this.registerContextPacker({schema:e.schema,match:e.match,getData:e.getData}))}))}function hO(){M(ZC,this).forEach((t=>{try{t()}catch(t){this.log.warn("[#teardownContextPackers] Failed disposing context packer.",t)}})),C(ZC,this,[])}function fO(){const t=null==Du?void 0:Du.EkoAnalytics;return"function"==typeof t?t:(A(iO,this,pO).call(this),null)}function pO(){this.settings.trackingEnabled&&!M(tO,this)&&(this.log.warn("EkoAnalytics not found on window."),C(tO,this,!0))}class mO{#et;#nt;#it;#rt;#ot;#st;#at;#lt;#ct;#ut;#dt;#ht;#ft;#pt;#mt;#vt;#gt;#yt;#bt;constructor(t,e={},n=null){this.#et=new Yu(t,n,e),this.#nt=new ad(this.#et,e),this.#it=new _k(e),this.#rt=new Ay(e),this.#ot=new rk(this.#rt,e),this.#st=new Zb(this.#ot,this.#it,e),this.#at=new hk(this.#st,e),this.#lt=new LM(this.#st,e),this.#ct=new WC(this.#lt,e),this.#yt=new AC(this.#lt,this.#st,e),this.#ut=new cw(this.#st,this.#at,this.#it,this.#lt,e),this.#dt=new Xw(this.#st,this.#at,this.#lt,e),this.#ht=new oI(e),this.#ft=new MI(this.#st,this.#lt,this.#ht,e),this.#mt=new iC(this.#lt,e),this.#bt=new rO(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.#vt=r?r({timeline:this.#lt,canvas:this.#et,containerSize:this.#nt,options:e}):new Vv(this.#lt,this.#et,this.#nt,e),this.#pt=o?o({timeline:this.#lt,decodeCoordinator:this.#ft,options:e}):new hA(this.#lt,this.#ft,e),this.#gt=new CS(this.#lt,this.#vt,e)}get canvas(){return this.#et}get containerSize(){return this.#nt}get assetsDeliveryService(){return this.#it}get downloadSpeed(){return this.#rt}get abrSelector(){return this.#ot}get nodeRepository(){return this.#st}get nodePrioritizer(){return this.#at}get timeline(){return this.#lt}get documentVisibility(){return this.#ct}get nodeResolver(){return this.#ut}get segmentLoadCoordinator(){return this.#dt}get decoderFactory(){return this.#ht}get parsingManager(){return this.#ft}get audioAdapter(){return this.#pt}get audioPlaybackManager(){return this.#pt}get qoe(){return this.#mt}get renderAdapter(){return this.#vt}get renderer(){return this.#vt}get transitionManager(){return this.#gt}get tracker(){return this.#bt}dispose(){[this.#bt,this.#lt,this.#ct,this.#dt,this.#ut,this.#at,this.#st,this.#it,this.#ot,this.#rt,this.#ft,this.#ht,this.#pt,this.#mt,this.#vt,this.#gt,this.#yt,this.#nt,this.#et].forEach((t=>{t&&"function"==typeof t.dispose&&t.dispose()})),this.#lt=null,this.#ct=null,this.#dt=null,this.#ut=null,this.#at=null,this.#st=null,this.#it=null,this.#ot=null,this.#rt=null,this.#ft=null,this.#ht=null,this.#pt=null,this.#mt=null,this.#vt=null,this.#gt=null,this.#yt=null,this.#et=null,this.#bt=null}}const vO="main.1168115";var gO={isPlainObject:Au,deepMerge:Nu,get:ty,set:ey,ekoGlobalStore:ny,download:gy,isPositiveNumber:Cg,clamp01:Wp,root:Du,now:ry,getFrameDimensions:RN,useragent:Xm,requestAnimationFrame:Fk,cancelAnimationFrame:Ck,start:jk,stop:Uk,isTicking:$k,predicator:function(t,e){const n=e||{};if("function"!=typeof t)return void Ok.error("[predicator] Bad argument given to predicator, first argument must be a function.",arguments);if(t.apply())return Ok.debug("[predicator] Invoking onFulfilled immediately."),void("function"==typeof n.onFulfilled&&n.onFulfilled.call(null,0));const i=n.timeout||1e4,r=n.interval,o=ry();let s,a,l,c,u;c=function(){t.apply()&&l()},l=function(){Uk(c),Du.clearTimeout(s),u=ry()-o,Ok.debug("[predicator] Invoking onFulfilled after "+u+" ms."),"function"==typeof n.onFulfilled&&n.onFulfilled.call(null,u)},a=function(){Uk(c),u=ry()-o,Ok.debug("[predicator] Invoking onTimeout after "+u+" ms."),"function"==typeof n.onTimeout&&n.onTimeout.call(null,u)},s=Du.setTimeout(a,i),jk(c,r)},createThrottler:qk,scheduleExecution:Vk},yO=new WeakMap,bO=new WeakMap,kO=new WeakMap,wO=new WeakMap,xO=new WeakMap,_O=new WeakMap,TO=new WeakMap,EO=new WeakSet;class IO{constructor(t){O(this,EO),F(this,yO,[]),F(this,bO,[]),F(this,kO,new tM("placement-")),F(this,wO,new tM("renderplacement-")),F(this,xO,void 0),F(this,_O,new Map),F(this,TO,void 0),C(xO,this,t),C(TO,this,{allowUnready:!0,getNode:t=>A(EO,this,SO).call(this,t)})}get placements(){return M(yO,this).slice()}get renderPlacements(){return M(bO,this).slice()}getNodesAtTime(t){A(EO,this,AO).call(this);const e=A(EO,this,MO).call(this,t);if(!Number.isFinite(e))return[];const n=M(yO,this).filter((t=>Vp(t,e,null,M(TO,this)))),i=[];return n.forEach((t=>{const e=A(EO,this,SO).call(this,null==t?void 0:t.nodeId);e&&i.push(e)})),i}placeOnTimeline(t,e,n={}){const i=t&&"object"==typeof t?t:null,r=i?i.id:t;if(!r)throw new Error("TimelineDefinition.placeOnTimeline requires node id");i&&M(_O,this).set(r,i);const o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=Yp(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}:Xp(e,n);let u,d,h,f=!1;const p=null!==a;if(a){const t=M(yO,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=qp(t);if("start"===a.anchor)Number.isFinite(e)?u=e:f=!0;else{const n=A(EO,this,NO).call(this,t);Number.isFinite(e)&&n>0?u=e+n:f=!0}}else if(l){const t=n.offsetAnchorPlacementId?M(yO,this).find((t=>(null==t?void 0:t.placementId)===n.offsetAnchorPlacementId)):M(yO,this).length?M(yO,this)[M(yO,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==t?void 0:t.placementId),d){const e=qp(t),n=A(EO,this,NO).call(this,t);Number.isFinite(e)&&n>0?u=e+n-c:(f=!0,h="end")}else u=-c}else u=Kp(e);const m=M(kO,this).claim(n.placementId),v={placementId:m,nodeId:r,offset:u,offsetPending:f,offsetAnchorPlacementId:f?d:void 0,offsetAnchorEdge:f?h:void 0,offsetAnchorIsReference:f?p:void 0,offsetEndSeconds:l?c:a&&"end"===a.anchor?0:void 0,nodeOffsetOverride:o,nodeDurationOverride:s,loop:!0===n.loop};return M(yO,this).push(v),Gp(M(yO,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=Yp(e);if("string"==typeof e&&e.includes("@")&&!c)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires valid placement reference");const u=null!==c;if(c){const t=M(yO,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=qp(t);if("start"===c.anchor)Number.isFinite(e)?o=e:l=!0;else{const n=A(EO,this,NO).call(this,t);Number.isFinite(e)&&Number.isFinite(n)?o=e+n:l=!0}}else o=Kp(e);const d=M(wO,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;Qp(M(bO,this),t,e,"TimelineDefinition.placeRenderNodeOnTimeline does not allow overlapping render nodes")}return M(bO,this).push(m),Gp(M(bO,this)),d}}function SO(t){if(t)return M(xO,this)&&"function"==typeof M(xO,this).get?M(xO,this).get(t):M(_O,this).get(t)}function AO(){return Hp(M(yO,this),{getPlacementDuration:t=>A(EO,this,NO).call(this,t)}).updated}function NO(t){return Up(t,null,M(TO,this))}function MO(t){if("end"===t){const t=A(EO,this,FO).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 FO(){let t;return M(yO,this).forEach((e=>{const n=qp(e);if(!Number.isFinite(n))return;const i=A(EO,this,NO).call(this,e);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(t)||r>t)&&(t=r)})),t}const CO=new Set(["canplay","play","playing","waiting","pause","seeking","seeked"]);var OO=new WeakMap,PO=new WeakMap,RO=new WeakMap,DO=new WeakMap,LO=new WeakMap,BO=new WeakMap,zO=new WeakMap,WO=new WeakMap,jO=new WeakMap,UO=new WeakMap,$O=new WeakMap,qO=new WeakMap,VO=new WeakMap,GO=new WeakMap,HO=new WeakMap,KO=new WeakMap,XO=new WeakMap,YO=new WeakMap,QO=new WeakMap,JO=new WeakMap,ZO=new WeakMap,tP=new WeakMap,eP=new WeakMap,nP=new WeakMap,iP=new WeakMap,rP=new WeakSet;class oP extends Ou{get name(){return"EkoPlayer"}get exposedPlayerAPI(){return M(DO,this)}constructor(t,e={}){const{options:n,publicOptions:i}=function(t={}){const e=Nu({},by,t);Object.entries(yy).forEach((([t,{targetPaths:n}])=>{void 0!==e[t]&&n.forEach((n=>{void 0===ty(e,n)&&ey(e,n,e[t])}))}));const n=function(t){const e={};return Object.keys(yy).forEach((n=>{Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})),Object.freeze(e)}(e);return ky.info("Processed options:",e),ky.info("Public options:",n),{options:e,publicOptions:n}}(e);return super(n),O(this,rP),F(this,OO,void 0),F(this,PO,void 0),F(this,RO,void 0),F(this,DO,void 0),F(this,LO,void 0),F(this,BO,void 0),F(this,zO,void 0),F(this,WO,void 0),F(this,jO,void 0),F(this,UO,void 0),F(this,$O,void 0),F(this,qO,void 0),F(this,VO,void 0),F(this,GO,void 0),F(this,HO,void 0),F(this,KO,void 0),F(this,XO,void 0),F(this,YO,void 0),F(this,QO,void 0),F(this,JO,void 0),F(this,ZO,void 0),F(this,tP,void 0),F(this,eP,void 0),F(this,nP,void 0),F(this,iP,0),C(RO,this,i),this.log.info("Initializing EkoPlayer with options:",i),C(qO,this,new mO(t,n,this)),A(rP,this,mP).call(this,M(qO,this)),C(HO,this,(t=>A(rP,this,sP).call(this,t))),M(PO,this)&&"function"==typeof M(PO,this).on&&M(PO,this).on(Bu.TIMELINE_CUEPOINT,M(HO,this)),C(KO,this,null),C(YO,this,(t=>A(rP,this,aP).call(this,t))),C(QO,this,(t=>{const e=t&&"object"==typeof t?t:{};A(rP,this,aP).call(this,{...e,event:"seeking"})})),C(JO,this,(t=>{const e=t&&"object"==typeof t?t:{};A(rP,this,aP).call(this,{...e,event:"seeked"})})),M(PO,this)&&"function"==typeof M(PO,this).on&&(M(PO,this).on(Bu.TIMELINE_PLAYER_STATE,M(YO,this)),M(PO,this).on(Bu.TIMELINE_SEEKING,M(QO,this)),M(PO,this).on(Bu.TIMELINE_SEEKED,M(JO,this))),C(eP,this,(t=>{const e=t&&"object"==typeof t?t:{};this.trigger(Bu.CONTAINER_RESIZE,e)})),M(VO,this)&&"function"==typeof M(VO,this).on&&M(VO,this).on(Bu.CONTAINER_RESIZE,M(eP,this)),A(rP,this,dP).call(this),A(rP,this,uP).call(this),C(DO,this,A(rP,this,pP).call(this)),M(DO,this)}onDispose(){M(PO,this)&&"function"==typeof M(PO,this).off&&M(HO,this)&&M(PO,this).off(Bu.TIMELINE_CUEPOINT,M(HO,this)),C(HO,this,null),M(PO,this)&&"function"==typeof M(PO,this).off&&(M(YO,this)&&M(PO,this).off(Bu.TIMELINE_PLAYER_STATE,M(YO,this)),M(QO,this)&&M(PO,this).off(Bu.TIMELINE_SEEKING,M(QO,this)),M(JO,this)&&M(PO,this).off(Bu.TIMELINE_SEEKED,M(JO,this))),C(YO,this,null),C(QO,this,null),C(JO,this,null),C(KO,this,null),M(VO,this)&&"function"==typeof M(VO,this).off&&M(eP,this)&&M(VO,this).off(Bu.CONTAINER_RESIZE,M(eP,this)),C(eP,this,null),M($O,this)&&"function"==typeof M($O,this).off&&(M(ZO,this)&&M($O,this).off("qoescore",M(ZO,this)),M(tP,this)&&M($O,this).off("qoestatus",M(tP,this))),C(ZO,this,null),C(tP,this,null),M(UO,this)&&"function"==typeof M(UO,this).off&&M(nP,this)&&M(UO,this).off(Bu.DECODER_ERROR,M(nP,this)),C(nP,this,null),C(iP,this,0),M(GO,this)&&"function"==typeof M(GO,this).dispose&&M(GO,this).dispose(),C(GO,this,null),M(qO,this)&&"function"==typeof M(qO,this).dispose&&M(qO,this).dispose(),C(PO,this,null),C(OO,this,null),C(BO,this,null),C(zO,this,null),C(WO,this,null),C(jO,this,null),C(UO,this,null),C($O,this,null),C(VO,this,null),C(LO,this,null),C(DO,this,null),C(qO,this,null)}}function sP(t={}){var e;this.trigger(Bu.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 aP(t={}){const e="string"==typeof(null==t?void 0:t.event)?t.event:"";if(!CO.has(e))return;if("playing"!==e||Number.isFinite(M(XO,this))||(C(XO,this,ry()),this.log.info(`[#handlePlayerStateEvent] Playback started @ ${(M(XO,this)/1e3).toFixed(3)}s (${Date.now()})`)),M(KO,this)===e)return;C(KO,this,e);const n=Number.isFinite(null==t?void 0:t.time)?t.time:M(PO,this)&&Number.isFinite(M(PO,this).currentTime)?M(PO,this).currentTime:0,i={};Number.isFinite(n)&&(i.time=n),"string"==typeof(null==t?void 0:t.from)&&(i.from=t.from),"string"==typeof(null==t?void 0:t.to)&&(i.to=t.to),Number.isFinite(null==t?void 0:t.targetTime)&&(i.targetTime=t.targetTime),Array.isArray(null==t?void 0:t.placements)&&(i.placements=t.placements.slice()),this.trigger(e,i)}function lP(){return new IO(M(OO,this))}function cP(t){if(!t||"object"!=typeof t)throw new Error("EkoPlayer.switchTimeline requires a timeline definition");if(!M(PO,this)||"function"!=typeof M(PO,this).applyTimelineDefinition)throw new Error("EkoPlayer.switchTimeline requires an active timeline");M(PO,this).applyTimelineDefinition(t),"function"==typeof M(PO,this).play&&M(PO,this).play()}function uP(){M($O,this)&&"function"==typeof M($O,this).on&&(C(ZO,this,(t=>{this.trigger(Bu.QOE_SCORE,t)})),C(tP,this,(t=>{this.trigger(Bu.QOE_STATUS,t)})),M($O,this).on(Bu.QOE_SCORE,M(ZO,this)),M($O,this).on(Bu.QOE_STATUS,M(tP,this)))}function dP(){M(UO,this)&&"function"==typeof M(UO,this).on&&(C(nP,this,(t=>{const e=t&&"object"==typeof t?t:{error:t};this.trigger(Bu.DECODER_ERROR,e),A(rP,this,hP).call(this,e)})),M(UO,this).on(Bu.DECODER_ERROR,M(nP,this)))}function hP(t={}){var e;const n=M(PO,this);if(!n||"number"!=typeof n.currentTime)return;const i=Date.now();if(i<M(iP,this))return;const r=Number(n.currentTime);if(!Number.isFinite(r))return;const o=Number(null==n||null===(e=n.settings)||void 0===e?void 0:e.snapToFps),s=Number.isFinite(o)&&o>0?1/o:1/60;C(iP,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 fP(t={}){var e;if(M(GO,this))return M(GO,this);const n=t&&"object"==typeof t&&!Array.isArray(t)?{...t}:{},i=M(LO,this)&&M(LO,this).element?M(LO,this).element:null;if(!i)throw new Error("Debug overlay requires an initialized player canvas and mount element.");const r=function({canvasElement:t,containerElement:e}={}){const n=t&&t.parentNode?t.parentNode:null;if(null==e)return n;const i=function(t,e=(null==Du?void 0:Du.document)){if(Lu(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 Lu(i)?i:null}(e,t&&t.ownerDocument?t.ownerDocument:null);if(i)return i;if("string"==typeof e){const t=e.trim(),n="#"===t.charAt(0)?t.slice(1):t;if(!n)throw new Error("Debug overlay containerElement id cannot be empty.");throw new Error(`Debug overlay containerElement id "${n}" was not found.`)}throw new Error("Debug overlay containerElement must be an element id string or DOM element.")}({canvasElement:i,containerElement:n.containerElement});if(!r)throw new Error("Debug overlay requires an initialized player canvas and mount element.");Object.prototype.hasOwnProperty.call(n,"containerElement")&&delete n.containerElement;const o=await Promise.resolve().then((function(){return gD})),s=(null==o?void 0:o.createDebugOverlay)||(null==o?void 0:o.default);if("function"!=typeof s)throw new Error("Debug overlay bundle does not export createDebugOverlay().");return n.publicOptions=M(RO,this),n.playerVersion=vO,C(GO,this,s({mountElement:r,canvasElement:i,timeline:M(PO,this),assetsDeliveryServiceUrl:null===(e=M(qO,this))||void 0===e||null===(e=e.assetsDeliveryService)||void 0===e||null===(e=e.settings)||void 0===e?void 0:e.assetsDeliveryServiceUrl,getNode:t=>M(OO,this)&&"function"==typeof M(OO,this).get?M(OO,this).get(t):void 0,listNodes:()=>M(OO,this)&&"function"==typeof M(OO,this).list?M(OO,this).list():[],downloadSpeed:M(qO,this)?M(qO,this).downloadSpeed:void 0,downloadEvents:Yg,qoe:M($O,this)?M($O,this).publicAPI:void 0,qoeEvents:this,options:n,playbackStartedAtMs:M(XO,this)})),M(GO,this)}function pP(){const t=this;return{createTimeline:()=>A(rP,t,lP).call(t),switchTimeline:e=>A(rP,t,cP).call(t,e),play:M(PO,this).play,pause:M(PO,this).pause,reset:M(PO,this).reset,placeOnTimeline:M(PO,this).placeOnTimeline,placeRenderNodeOnTimeline:M(PO,this).placeRenderNodeOnTimeline,addNode:M(OO,this).add,getNode:M(OO,this).get,listNodes:M(OO,this).list,getNodesAtTime:e=>M(PO,t).getNodesAtTime(e),dispose:this.dispose,on:t.on,off:t.off,once:t.once,trigger:t.trigger,transitionTo:(e,n)=>M(zO,t).transitionTo(e,n),track:(e,...n)=>{if(M(jO,t)&&"function"==typeof M(jO,t).track)return M(jO,t).track(e,...n)},seekToPlacement:e=>M(PO,t).seekToPlacement(e),get currentTime(){return M(PO,t).currentTime},set currentTime(e){M(PO,t).currentTime=e},get buffered(){return M(PO,t).buffered},get options(){return M(RO,t)},get containerWidth(){return M(VO,t)?M(VO,t).containerWidth:0},get containerHeight(){return M(VO,t)?M(VO,t).containerHeight:0},get playbackRate(){return M(PO,t).playbackRate},set playbackRate(e){M(PO,t).playbackRate=e},get paused(){return!!M(PO,t)&&!0===M(PO,t).paused},get muted(){return!!M(WO,t)&&M(WO,t).muted},set muted(e){M(WO,t)&&(M(WO,t).muted=e)},get volume(){return M(WO,t)?M(WO,t).volume:1},set volume(e){M(WO,t)&&(M(WO,t).volume=e)},get qoe(){return M($O,t)?M($O,t).publicAPI:void 0},get utils(){return gO},get version(){return vO},loadDebugOverlay:(...e)=>A(rP,t,fP).call(t,...e)}}function mP(t){t&&(C(LO,this,t.canvas),C(OO,this,t.nodeRepository),C(PO,this,t.timeline),C(WO,this,t.audioAdapter||t.audioPlaybackManager),C(jO,this,t.tracker),C(UO,this,t.parsingManager),C($O,this,t.qoe),C(BO,this,t.renderAdapter||t.renderer),C(zO,this,t.transitionManager),C(VO,this,t.containerSize))}class vP{constructor({target:t,props:e}){if(!t)throw new Error("`options.target` is required");Jr(this.#kt,e,!0),this.#kt.v.EkoPlayer=oP;const n=t.hasChildNodes()?Ds:Rs;this.#wt=n(lu,{target:t,props:this.#kt.v})}#wt;#kt=Yr(no({}));destroy(t){if(this.#wt)return function(t,e){const n=zs.get(t);return n?(zs.delete(t),n(e)):Promise.resolve()}(this.#wt,t)}get props(){return fs(this.#kt)}}const gP=u("gallery-react");const yP=e.forwardRef(((t,n)=>{const{config:i,debug:r,ssrHtml:o,activeItem:s={index:0,step:0},forceMobile:a,videoAspectRatio:l,onEvent:c=()=>{}}=t,u=e.useRef(null),d=e.useRef({}),h=function(t){return void 0!==t}(i),f=e.useRef(s),p=e.useRef(o);d.current.initEventSent||(c("galleryinit"),d.current.initEventSent=!0);const m=e.useCallback((t=>{d.current.state=t,t.activeItemIndex===f.current.index&&t.activeModuleIndex===f.current.step||c("activeitemchanged",{index:t.activeItemIndex,step:t.activeModuleIndex})}),[]),v=e.useCallback((t=>{d.current.API=t,0===f.current.index&&0===f.current.step||t.selectItemAndStep(f.current.index,f.current.step),d.current.unsubscribe&&d.current.unsubscribe(),d.current.unsubscribe=t.subscribe(m)}),[]),g=e.useCallback(((t,e)=>{c(t,e)}),[c]);return e.useEffect((()=>(gP.setDataStorage("gallery-react",{config:i}),window.eko=window.eko||{},window.eko.config=i,window.eko.gallery={version:"4.0.10"},()=>{window.eko.config=void 0})),[i]),e.useImperativeHandle(n,(()=>({prev:()=>{var t;null===(t=d.current.API)||void 0===t||t.prev()},next:()=>{var t;null===(t=d.current.API)||void 0===t||t.next()}}))),e.useEffect((()=>{if(null==u||!u.current)return;const t=u.current;return d.current.app=new vP({target:t,props:{config:i,forceMobile:a,videoAspectRatio:l,hideNav:!0,onGalleryReady:v,onEvent:g}}),()=>{var t;null===(t=d.current.app)||void 0===t||t.destroy()}}),[]),e.useEffect((()=>{d.current.app&&(d.current.app.props.config=i)}),[i]),e.useEffect((()=>{d.current.app&&(d.current.app.props.debug=r,d.current.app.props.forceMobile=a,d.current.app.props.videoAspectRatio=l,d.current.app.props.onEvent=g)}),[r,a,l,g]),e.useEffect((()=>{f.current=s,d.current.state&&(d.current.state.activeItemIndex===s.index&&d.current.state.activeModuleIndex===s.step||d.current.API.selectItemAndStep(s.index,s.step))}),[s]),h?e.createElement("div",R({style:{position:"relative",width:"100%",height:"100%"},ref:u},p.current?{dangerouslySetInnerHTML:{__html:p.current}}:{})):t.children}));yP.propTypes={className:Tt.string,config:Tt.object,variantId:Tt.string,onEvent:Tt.func,ssrHtml:Tt.string,videoAspectRatio:Tt.string,debug:Tt.bool,activeItem:Tt.shape({index:Tt.number,step:Tt.number}),forceMobile:Tt.bool,instanceId:Tt.string,children:Tt.node},yP.displayName="EkoGallerySvelte";const bP=n("v2"),kP=n("v1"),wP="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{},xP=wP&&wP.performance,_P=xP&&"function"==typeof xP.now?()=>xP.now():()=>Date.now(),TP=Object.freeze({NODE_ADD:"node:add",NODE_CHILDREN_CHANGED:"node:childrenchanged",NODE_LOADED:"node:loaded",NODE_LOAD_ERROR:"node:loaderror",PLACEMENT_ADDED:"placement:added",RENDER_PLACEMENT_ADDED:"renderplacement:added",TIMELINE_TIME_UPDATE:"timeline:timeupdate",TIMELINE_STATE_CHANGE:"statechange",TIMELINE_SEEKING:"seeking",TIMELINE_SEEKED:"seeked",TIMELINE_RESET:"timeline:reset",TIMELINE_PLAYER_STATE:"player:state",TIMELINE_CUEPOINT:"cuepoint",VISUAL_FRAMES_AVAILABLE:"visualframesavailable",TRACK_BUFFER_UPDATE:"track:bufferupdate",TRACK_READY:"track:ready",TRACK_UNDERFLOW:"track:underflow",CLOCK_TICK:"tick",DECODE_READY:"decode:ready",DECODE_ERROR:"decode:error",DECODER_AUDIO:"decoder:audio",DECODER_FRAME:"decoder:frame",DECODER_INIT:"decoder:init",DECODER_ERROR:"decoder:error",QOE_SCORE:"qoescore",QOE_STATUS:"qoestatus",CONTAINER_RESIZE:"containerresize",CANVAS_WEBGL_CONTEXT_LOST:"canvas.webglcontextlost",CANVAS_WEBGL_CONTEXT_RESTORED:"canvas.webglcontextrestored"}),EP=["ui-monospace,","SFMono-Regular,","Menlo,","Monaco,","Consolas,",'"Liberation Mono",','"Courier New",',"monospace"].join(" "),IP=`11px ${EP}`,SP=`12px ${EP}`;function AP(t){return"number"==typeof t&&Number.isFinite(t)}function NP(t){return AP(t)&&t>0}function MP(t){return AP(t)?Math.min(1,Math.max(0,t)):0}function FP(t,e=3){return AP(t)?t.toFixed(e):String(t)}function CP(t,e){const n=Number(t),i=Number(e);return!Number.isFinite(n)||!Number.isFinite(i)||n<=0||i<=0?"n/a":`${Math.round(n)}x${Math.round(i)}`}var OP=new WeakMap,PP=new WeakMap,RP=new WeakMap,DP=new WeakMap,LP=new WeakMap,BP=new WeakMap,zP=new WeakMap,WP=new WeakSet;class jP{constructor({width:t=220,height:e=48,windowMs:n=6e4,maxValue:i=60,autoScale:r=!1,formatValue:o}={}){O(this,WP),F(this,OP,void 0),F(this,PP,void 0),F(this,RP,[]),F(this,DP,void 0),F(this,LP,void 0),F(this,BP,void 0),F(this,zP,void 0);const s=null==wP?void 0:wP.document;if(!s||"function"!=typeof s.createElement)throw new Error("Debug overlay graph requires document.createElement.");C(OP,this,s.createElement("canvas")),M(OP,this).width=t,M(OP,this).height=e,M(OP,this).style.width=`${t}px`,M(OP,this).style.height=`${e}px`,M(OP,this).style.borderRadius="6px",M(OP,this).style.background="#111",C(PP,this,M(OP,this).getContext("2d")),C(DP,this,n),C(LP,this,i),C(BP,this,!!r),C(zP,this,"function"==typeof o?o:null)}get element(){return M(OP,this)}push(t,e){if(M(OP,this)&&M(PP,this)&&Number.isFinite(t)&&Number.isFinite(e)){for(M(RP,this).push({t:e,v:t});M(RP,this).length&&e-M(RP,this)[0].t>M(DP,this);)M(RP,this).shift();A(WP,this,UP).call(this)}}dispose(){C(RP,this,[]),C(PP,this,null),C(OP,this,null)}}function UP(){const t=M(PP,this),e=M(OP,this);if(!t||!e)return;const n=e.width,i=e.height;if(!n||!i)return;if(t.clearRect(0,0,n,i),t.fillStyle="#111",t.fillRect(0,0,n,i),!M(RP,this).length)return;const r=M(RP,this)[0].t;if(!(M(RP,this)[M(RP,this).length-1].t>r))return;const o=M(BP,this)?M(RP,this).reduce(((t,e)=>e.v>t?e.v:t),0):M(LP,this),s=o>0?o:M(LP,this);t.strokeStyle="#0f0",t.lineWidth=2,t.beginPath();for(let e=0;e<M(RP,this).length;e+=1){const o=M(RP,this)[e],a=(o.t-r)/M(DP,this)*n,l=i-(s>0?Math.min(1,Math.max(0,o.v/s)):0)*i;0===e?t.moveTo(a,l):t.lineTo(a,l)}t.stroke();const a=M(RP,this).length?M(RP,this)[M(RP,this).length-1]:null,l=Number.isFinite(null==a?void 0:a.v)?a.v:null;if(null===l)return;const c=M(zP,this)?M(zP,this).call(this,l):l.toFixed(1);if("string"!=typeof c||!c)return;t.font=IP,t.textAlign="right",t.textBaseline="top";const u=t.measureText(c),d=Math.ceil(u.width)+8,h=n-d-2;t.fillStyle="rgba(0,0,0,0.55)",t.fillRect(h,2,d,14),t.fillStyle="#fff",t.fillText(c,n-2-4,4)}const $P=new Intl.NumberFormat("en-US");function qP(t,e){const n=(null==t?void 0:t.trackId)||"",i=(null==e?void 0:e.trackId)||"";if(n!==i)return n<i?-1:1;const r=(null==t?void 0:t.nodeId)||"",o=(null==e?void 0:e.nodeId)||"";if(r!==o)return r<o?-1:1;const s=(null==t?void 0:t.segmentId)||"",a=(null==e?void 0:e.segmentId)||"";return s!==a?s<a?-1:1:("number"==typeof(null==t?void 0:t.presentationTime)?t.presentationTime:0)-("number"==typeof(null==e?void 0:e.presentationTime)?e.presentationTime:0)}function VP(t,e){for(t.push(e);t.length&&e-t[0]>1e3;)t.shift();if(t.length<2)return 0;const n=t[t.length-1]-t[0];return n<=0?0:1e3*(t.length-1)/n}function GP(t,e){if("function"!=typeof t||!e)return;const n=t(e.nodeId),i=null==n?void 0:n.tracks;if(!Array.isArray(i))return;const r=i.find((t=>(null==t?void 0:t.id)===e.trackId)),o=null==r?void 0:r.segments;return Array.isArray(o)?o.find((t=>(null==t?void 0:t.id)===e.segmentId)):void 0}function HP(t,e){var n;const i=GP(t,e);return(null==i?void 0:i.abrDecision)||(null==i||null===(n=i.chosenRepresentation)||void 0===n?void 0:n.abrDecision)}function KP(t){const e=Number(t);return!Number.isFinite(e)||e<=0?"n/a":`${$P.format(Math.round(e))}kbps`}function XP(t){const e=Number(t);return!Number.isFinite(e)||e<=0?"n/a":`${$P.format(Math.round(e/1e3))}kbps`}function YP(t,e=3){const n=Number(t);return Number.isFinite(n)?n.toLocaleString("en-US",{minimumFractionDigits:e,maximumFractionDigits:e}):String(t)}function QP(t,e){var n;if("function"!=typeof t||!e)return;const i=t(e.nodeId),r=null==i||null===(n=i.manifestRef)||void 0===n?void 0:n.encodeProfile;return"string"==typeof r&&r?r:void 0}function JP(t,e){if("function"!=typeof t||!e)return;const n=t(e.nodeId);return!0===(null==n?void 0:n.imageFallbackActive)?"image":void 0}function ZP(t,e){const n=function(t){if(!t)return;const e=[[t.displayWidth,t.displayHeight],[t.codedWidth,t.codedHeight],[t.videoWidth,t.videoHeight],[t.naturalWidth,t.naturalHeight],[t.width,t.height]];for(let t=0;t<e.length;t+=1){const[n,i]=e[t],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}(null==e?void 0:e.frame)||{},i=Number.isFinite(null==e?void 0:e.width)?e.width:n.width,r=Number.isFinite(null==e?void 0:e.height)?e.height:n.height,o=function(t,e,n){return null===(n=GP(t,e))||void 0===n?void 0:n.chosenRepresentation}(t,e);if(!o)return AP(i)&&AP(r)?{width:i,height:r}:null;const s=o.width||o.codedWidth||i,a=o.height||o.codedHeight||r;return{id:o.id,codecs:o.codecs,mime:o.mime,bandwidth:o.bandwidth,width:s,height:a}}function tR(t){const e=Number(t);if(Number.isFinite(e)&&!(e<=0))return e/1e3}function eR(t,e){const n=Number(null==t?void 0:t.bandwidthKbps),i=Number(null==e?void 0:e.bandwidthKbps),r=Number.isFinite(n)&&n>0,o=Number.isFinite(i)&&i>0;if(r&&o&&n!==i)return n-i;if(r!==o)return r?-1:1;const s=(null==t?void 0:t.id)||"",a=(null==e?void 0:e.id)||"";return s===a?0:s<a?-1:1}function nR(t,e,n,i){const r=[];if(Array.isArray(null==i?void 0:i.availableRepresentations)&&i.availableRepresentations.forEach((t=>{const e="string"==typeof(null==t?void 0:t.id)&&t.id?t.id:void 0;if(!e)return;const n=Number(null==t?void 0:t.bandwidthKbps);r.push({id:e,bandwidthKbps:Number.isFinite(n)&&n>0?n:void 0})})),!r.length){const n=GP(t,e);(Array.isArray(null==n?void 0:n.representations)?n.representations:[]).forEach((t=>{const e="string"==typeof(null==t?void 0:t.id)&&t.id?t.id:void 0;e&&r.push({id:e,bandwidthKbps:tR(null==t?void 0:t.bandwidth)})}))}!r.length&&(null==n?void 0:n.id)&&r.push({id:n.id,bandwidthKbps:tR(n.bandwidth)});const o=new Map;return r.forEach((t=>{const e=null==t?void 0:t.id;e&&!o.has(e)&&o.set(e,t)})),Array.from(o.values()).sort(eR)}const iR=1024,rR=1048576,oR=1073741824;function sR(t){return AP(t)?t>=1e3?`${FP(t/1e3,1)} Mbps`:`${FP(t,1)} kbps`:"n/a"}function aR({downloadSpeed:t,downloadEvents:e}={}){const n=wP.document,i="function"==typeof(null==t?void 0:t.getKbps)?t.getKbps():void 0;let r=0;const{metricsRow:o,setInitial:s,setTotal:a}=function(t){const e=t.createElement("div");e.style.display="grid",e.style.gridTemplateColumns="1fr 1fr",e.style.gap="8px",e.style.font=SP;const n=t.createElement("div"),i=t.createElement("div");return e.appendChild(n),e.appendChild(i),{metricsRow:e,setInitial:t=>{n.textContent=`initial=${sR(t)}`},setTotal:t=>{var e;i.textContent="total="+(AP(e=t)?e<iR?`${Math.round(e)} B`:e<rR?`${FP(e/iR,1)} KB`:e<oR?`${FP(e/rR,2)} MB`:`${FP(e/oR,2)} GB`:"n/a")}}}(n),{graphWrap:l,speedGraph:c}=function(t,e){const n=t.createElement("div");n.style.marginTop="10px";const i=t.createElement("div");i.textContent="download speed",i.style.font=IP,i.style.opacity="0.9";const r=AP(e)&&e>0?e:1,o=new jP({autoScale:!0,maxValue:r,formatValue:sR});return n.appendChild(i),n.appendChild(o.element),{graphWrap:n,speedGraph:o}}(n,i);s(i),a(r);const u=t=>{const e=Number(null==t?void 0:t.kbps);Number.isFinite(e)&&c.push(e,null!=wP&&wP.performance&&"function"==typeof wP.performance.now?wP.performance.now():Date.now())},d=t=>{const e=Number(null==t?void 0:t.bytes);Number.isFinite(e)&&(r+=e,a(r))};return t&&"function"==typeof t.on&&t.on("download:speed",u),e&&"function"==typeof e.on&&e.on("download:sample",d),{id:"downloads",title:"Downloads",render:t=>{t.appendChild(o),t.appendChild(l)},dispose:()=>{t&&"function"==typeof t.off&&t.off("download:speed",u),e&&"function"==typeof e.off&&e.off("download:sample",d),c.dispose()}}}function lR(t){return AP(t)?FP(t,3):"n/a"}function cR(){return null!=wP&&wP.performance&&"function"==typeof wP.performance.now?wP.performance.now():Date.now()}var uR,dR,hR,fR={exports:{}},pR=(uR||(uR=1,dR=fR,function(t,e){dR.exports?dR.exports=e():t.log=e()}(fR.exports,(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}))),fR.exports),mR=(hR=pR)&&hR.__esModule&&Object.prototype.hasOwnProperty.call(hR,"default")?hR.default:hR;const vR=()=>{},gR=["trace","log","debug","info","warn","error","getLevel","setLevel"],yR=["trace","debug","info","warn","error","silent"],bR={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;"},kR="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global;let wR={level:"trace",appName:""},xR=[];const _R="object"==typeof kR&&kR.performance&&"function"==typeof kR.performance.now?kR.performance.now.bind(kR.performance):Date.now.bind(Date),TR=t=>t&&"string"==typeof t?t.toLowerCase().trim():"",ER=(()=>{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[TR(e)]=TR(i)||"trace"})),n}catch(t){return{}}})(),IR=(t,e="")=>{const n=TR(t),i=mR.getLogger(n);if(i.__ekologger)return i.__ekologger;e||ER[n]||ER["*"]||(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)=>(_R()/1e3).toFixed(e))()}] %c[${s}] ${wR.appName?`[${wR.appName}] `:""}[${t}]`,bR[s],...e)}},e=ER[n]||ER["*"]||e||wR.level,i.setLevel(e,!1);const o=(...t)=>i.log(...t);return gR.forEach((t=>{o[t]=(...e)=>(xR.forEach((n=>{n[t](...e)})),i[t](...e))})),i.__ekologger=o,o};IR.setDefaults=({appName:t="",level:e})=>{t&&"string"==typeof t&&(wR.appName=t),(e=TR(e))&&yR.includes(e)&&(wR.level=e,Object.values(mR.getLoggers()).filter((t=>t.__noExplicitLevel)).forEach((t=>t.setLevel(wR.level,!1))))},IR.installDriver=t=>{const e={...gR.reduce(((e,n)=>(e[n]="function"==typeof(null==t?void 0:t[n])?t[n]:vR,e)),{})};xR.push(e)},IR("download","warn");Object.freeze(Object.entries({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"]}}).reduce(((t,[e,n])=>(Object.prototype.hasOwnProperty.call(n,"default")&&(t[e]=n.default),t)),{})),IR("config","warn");const SR=18,AR="rgba(83,170,255,0.9)",NR={pending:"rgba(255,255,255,0.55)",resolving:"rgba(255,200,87,0.9)",ready:"rgba(102,214,141,0.9)",failed:"rgba(255,92,92,0.9)",missing:"rgba(160,160,160,0.9)"},MR={border:"1px solid rgba(102,214,141,0.28)",background:"rgba(102,214,141,0.16)",color:"rgba(167,240,185,1)"},FR={border:"1px solid rgba(255,200,87,0.3)",background:"rgba(255,200,87,0.16)",color:"rgba(255,227,171,1)"},CR="noop",OR="seek",PR="copy-node-id",RR="copy-node-context",DR="copy-source-video-url",LR=[{value:CR,label:"NOOP"},{value:OR,label:"Seek"},{value:PR,label:"Copy Node ID"},{value:RR,label:"Copy Node Context"},{value:DR,label:"Copy Source Video URL"}],BR=["type","url","mimeType","assetId","assetRevision","encodeProfile","duration","width","height"],zR=["id","url","mime","codecs","baseCodec","bandwidth","timescale","sizeBytes","width","height","frameRate","segStart","segDuration"];function WR(t,e){if(NP(null==t?void 0:t.nodeDurationOverride))return t.nodeDurationOverride;if("function"!=typeof e)return null;const n=e(null==t?void 0:t.nodeId),i=null==n?void 0:n.duration;return NP(i)?i:null}function jR(t){const e=Number(null==t?void 0:t.duration);return e===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:NP(e)?e:null}function UR(t){return t===Number.POSITIVE_INFINITY}function $R(t){return AP(t)?String(t):""}function qR(t,e=[]){return e.reduce(((e,n)=>(void 0!==(null==t?void 0:t[n])&&(e[n]=t[n]),e)),{})}function VR(t){const e=LR.find((e=>e.value===t));return e?e.value:CR}function GR(t){return t?"string"==typeof(null==t?void 0:t.message)&&t.message?t.message:"string"==typeof t&&t?t:null:null}function HR(t){return t&&AP(t.start)&&AP(t.end)?{start:t.start,end:t.end}:null}function KR(t){return t?qR(t,zR):null}function XR(t,e){const n="string"==typeof(null==t?void 0:t.nodeId)?t.nodeId:"",i="function"==typeof e&&n?e(n):null,r=function(t){return t?"string"==typeof t?t:qR(t,BR):null}(null==i?void 0:i.manifestRef),o=r&&"object"==typeof r?r.assetId:void 0,s={placement:{placementId:"string"==typeof(null==t?void 0:t.placementId)?t.placementId:void 0,nodeId:n||void 0,offset:AP(null==t?void 0:t.offset)?t.offset:void 0,duration:WR(t,e),offsetPending:!0===(null==t?void 0:t.offsetPending),nodeOffsetOverride:AP(null==t?void 0:t.nodeOffsetOverride)?t.nodeOffsetOverride:void 0,nodeDurationOverride:AP(null==t?void 0:t.nodeDurationOverride)?t.nodeDurationOverride:void 0},node:i?{id:i.id||n||void 0,state:"string"==typeof i.state?i.state:void 0,duration:AP(i.duration)?i.duration:null,mainTrackId:"string"==typeof i.mainTrackId?i.mainTrackId:void 0,assetId:"string"==typeof o?o:void 0,manifestRef:r,buffered:HR(i.buffered),imageFallbackActive:!0===i.imageFallbackActive,retainedByteLength:AP(i.retainedByteLength)?i.retainedByteLength:0,children:Array.isArray(i.children)?i.children.map((t=>({nodeId:"string"==typeof(null==t?void 0:t.nodeId)?t.nodeId:void 0,weight:AP(null==t?void 0:t.weight)?t.weight:void 0}))):[],tracks:Array.isArray(i.tracks)?i.tracks.map((t=>function(t){return t?{id:t.id,type:t.type,offset:AP(t.offset)?t.offset:0,duration:AP(t.duration)?t.duration:null,endTime:AP(t.endTime)?t.endTime:null,buffered:HR(t.buffered),segments:Array.isArray(t.segments)?t.segments.map((t=>function(t){if(!t)return null;const e={id:t.id,isInit:!0===t.isInit,offset:AP(t.offset)?t.offset:0,duration:AP(t.duration)?t.duration:0,bufferedRatio:AP(t.bufferedRatio)?t.bufferedRatio:0,retainedByteLength:AP(t.retainedByteLength)?t.retainedByteLength:0,isLoaded:!0===t.isLoaded,loadAttempts:AP(Number(t.loadAttempts))?Number(t.loadAttempts):0,appliedFilters:Array.isArray(t.appliedFilters)?t.appliedFilters.slice():[],chosenRepresentation:KR(t.chosenRepresentation),representations:Array.isArray(t.representations)?t.representations.map((t=>KR(t))).filter(Boolean):[]},n=GR(t.loadError);return n&&(e.loadError=n),e}(t))).filter(Boolean):[]}:null}(t))).filter(Boolean):[]}:null};if(i){const t=Number(i.manifestLoadAttempts);AP(t)&&t>0&&(s.node.manifestLoadAttempts=t);const e=GR(i.manifestLoadError);e&&(s.node.manifestLoadError=e);const n=GR(i.error);n&&(s.node.error=n)}return s}function YR(t=[],e=[],n){const i=function(t=[],e){return Array.isArray(t)&&t.length?t.map((t=>t?["string"==typeof t.placementId?t.placementId:"","string"==typeof t.nodeId?t.nodeId:"",$R(t.offset),$R(WR(t,e)),!0===t.offsetPending?"1":"0",$R(t.nodeOffsetOverride),$R(t.nodeDurationOverride)].join("|"):"null")).join(";"):""}(t,n);return`${i}::${function(t=[]){return Array.isArray(t)&&t.length?t.map((t=>{if(!t)return"null";const e="string"==typeof t.renderPlacementId?t.renderPlacementId:"",n="string"==typeof t.type?t.type:"",i=$R(t.offset),r=jR(t);return[e,n,i,r===Number.POSITIVE_INFINITY?"inf":$R(r),!0===t.offsetPending?"1":"0"].join("|")})).join(";"):""}(e)}`}function QR(t=[],e){if(!Array.isArray(t)||!t.length)return!1;for(let n=0;n<t.length;n+=1){const i=t[n];if(!i||!0===i.offsetPending)continue;if(NP(i.nodeDurationOverride))continue;if("function"!=typeof e)return!0;const r=e(i.nodeId);if(!NP(null==r?void 0:r.duration))return!0}return!1}function JR(t=[]){return!(!Array.isArray(t)||!t.length)&&t.some((t=>!0===(null==t?void 0:t.offsetPending)))}function ZR(t=[],e=[]){return JR(t)||JR(e)}function tD(t,e=[],n){if(!t||!Array.isArray(e)||!e.length)return;const i=t.querySelector('[data-segment-boundary="true"]');e.forEach((e=>{if(!e||!AP(e.startRatio)||!AP(e.endRatio))return;const r=MP(e.startRatio),o=MP(e.endRatio);if(!(o>r))return;const s=wP.document.createElement("div");s.dataset.bufferedSegment="true",s.style.position="absolute",s.style.top="0",s.style.bottom="0",s.style.left=100*r+"%",s.style.width=100*(o-r)+"%",s.style.background=n,s.style.opacity="0.8",s.style.pointerEvents="none",s.style.zIndex="0",i?t.insertBefore(s,i):t.appendChild(s)}))}function eD(t,e){if(!t)return;const n=t.querySelector('[data-active-highlight="true"]');if(!e)return void(n&&n.remove());if(n)return;const i=wP.document.createElement("div");i.dataset.activeHighlight="true",i.style.position="absolute",i.style.top="0",i.style.bottom="0",i.style.left="0",i.style.right="0",i.style.border="1px solid rgba(255,255,255,0.9)",i.style.borderRadius="4px",i.style.pointerEvents="none",i.style.zIndex="1",t.appendChild(i)}function nD({timeline:t,getNode:e,assetsDeliveryServiceUrl:n}={}){const i=null==wP?void 0:wP.document;if(!i||"function"!=typeof i.createElement)throw new Error("Debug overlay timeline tab requires document.createElement.");const r=i.createElement("div");r.style.display="flex",r.style.flexDirection="column",r.style.gap="8px",r.style.position="relative";const o=i.createElement("div");o.style.position="absolute",o.style.display="none",o.style.pointerEvents="none",o.style.zIndex="2",o.style.padding="4px 6px",o.style.borderRadius="6px",o.style.background="rgba(0,0,0,0.8)",o.style.border="1px solid rgba(255,255,255,0.2)",o.style.color="#fff",o.style.font=IP,o.style.maxWidth="220px",o.style.whiteSpace="nowrap",o.style.overflow="hidden",o.style.textOverflow="ellipsis";const s=i.createElement("div");s.dataset.timelineHoverDetails="true",s.style.position="absolute",s.style.display="none",s.style.pointerEvents="none",s.style.zIndex="3",s.style.padding="6px 8px",s.style.borderRadius="8px",s.style.background="rgba(0,0,0,0.85)",s.style.border="1px solid rgba(255,255,255,0.25)",s.style.color="#fff",s.style.font=IP,s.style.maxWidth="260px",s.style.flexDirection="column",s.style.gap="6px";const a=i.createElement("div");a.style.font=SP,a.style.opacity="0.95";const l=i.createElement("div");l.style.font=IP,l.style.opacity="0.7",l.style.textTransform="uppercase",l.style.marginTop="4px";const c=i.createElement("div");c.style.display="flex",c.style.flexDirection="column",c.style.gap="4px",s.appendChild(a),s.appendChild(l),s.appendChild(c);const u=i.createElement("div");u.style.display="flex",u.style.justifyContent="space-between",u.style.alignItems="center";const d=i.createElement("div");d.style.display="flex",d.style.alignItems="baseline",d.style.gap="10px";const h=i.createElement("div");h.style.font=SP,h.style.opacity="0.9";const f=i.createElement("div");f.style.font=IP,f.style.opacity="0.65",d.appendChild(h),d.appendChild(f);const p=i.createElement("label");p.style.display="inline-flex",p.style.alignItems="center",p.style.gap="6px",p.style.font=IP;const m=i.createElement("span");m.textContent="Click action";const v=i.createElement("select");v.style.font=IP,v.style.background="rgba(255,255,255,0.08)",v.style.color="#fff",v.style.border="1px solid rgba(255,255,255,0.2)",v.style.borderRadius="4px",v.style.padding="2px 6px",v.style.minHeight="24px",v.style.cursor="pointer",LR.forEach((t=>{const e=i.createElement("option");e.value=t.value,e.textContent=t.label,v.appendChild(e)})),v.value=CR;const g=i.createElement("div");g.dataset.timelineCopyStatus="true",g.setAttribute("role","status"),g.setAttribute("aria-live","polite"),g.style.display="none",g.style.position="absolute",g.style.right="0",g.style.bottom="calc(100% + 4px)",g.style.alignItems="center",g.style.padding="1px 6px",g.style.borderRadius="999px",g.style.border=MR.border,g.style.background=MR.background,g.style.color=MR.color,g.style.font=IP,g.style.whiteSpace="nowrap",g.style.pointerEvents="none",g.style.zIndex="4",g.style.opacity="0",g.style.transform="translateY(2px)",g.style.transition=["opacity 180ms ease","transform 180ms ease"].join(", "),p.appendChild(m),p.appendChild(v);const y=i.createElement("div");y.style.display="flex",y.style.alignItems="center",y.style.position="relative",y.style.flexShrink="0",y.appendChild(g),y.appendChild(p),u.appendChild(d),u.appendChild(y);const b=i.createElement("div");function k(t,e,{alignTop:n=!1}={}){const r=i.createElement("div");r.style.display="grid",r.style.gridTemplateColumns="64px 1fr",r.style.alignItems=n?"start":"center",r.style.gap="8px";const o=i.createElement("div");o.textContent=t,o.style.font=IP,o.style.opacity="0.8",n&&(o.style.paddingTop="2px");const s=i.createElement("div");s.style.position="relative",s.style.borderRadius="6px",s.style.background="rgba(255,255,255,0.08)",s.style.overflow="hidden",e&&(s.dataset.timelineLane=e);const a=i.createElement("div");return a.style.position="absolute",a.style.top="0",a.style.bottom="0",a.style.width="2px",a.style.background="rgba(255,255,255,0.8)",s.appendChild(a),r.appendChild(o),r.appendChild(s),b.appendChild(r),{track:s,indicator:a}}b.style.display="grid",b.style.gridTemplateRows="auto auto",b.style.gap="8px",r.appendChild(u),r.appendChild(b),r.appendChild(o),r.appendChild(s);const w=k("Nodes","nodes",{alignTop:!0}),x=k("Render","render");let _=[],T=[],E=0,I=CR,S=1;const A=new Map,N=new Map,M=new Map,F=new Map;let C=new Set,O=null,P=!1,R="",D=!1,L=0,B=0,z=null,W=null,j=null;function U(t){for(;t.childNodes.length>1;)t.removeChild(t.lastChild)}function $(){z&&(clearTimeout(z),z=null)}function q(){W&&(((null==wP?void 0:wP.clearTimeout)||clearTimeout)(W),W=null)}function V(){j&&(((null==wP?void 0:wP.clearTimeout)||clearTimeout)(j),j=null)}function G(){g.style.display="none",g.style.opacity="0",g.style.transform="translateY(2px)",g.textContent=""}function H(){return!!D||!!t&&(Array.isArray(t.placements)||Array.isArray(t.renderPlacements))}function K(){if(!t)return!1;const e=Array.isArray(t.placements),n=Array.isArray(t.renderPlacements);if(!e&&!n)return!1;const i=e?t.placements:[],r=n?t.renderPlacements:[];return(i.length!==L||r.length!==B)&&(dt(i,r),!0)}function X(){if(!D)return!1;const t=YR(_,T,e);return t!==R&&(R=t,at(),ut(),!0)}function Y(){H()?z=function({shouldSchedule:t,isScheduled:e,intervalMs:n,onTick:i}){return e?null:setTimeout(i,n)}({shouldSchedule:!0,isScheduled:!!z,intervalMs:D?100:250,onTick:()=>{z=null,H()&&(K()||X()||Y())}}):$()}function Q(t,e){const n=e>0?E/e:0;t.style.left=100*MP(n)+"%",t.style.transform="translateX(-1px)"}function J(){o.style.display="none"}function Z(){q(),V(),G()}function tt(t,{tone:e="success"}={}){if(!t)return void Z();q(),V(),function(t="success"){const e=function(t="success"){return"warning"===t?FR:MR}(t);g.style.border=e.border,g.style.background=e.background,g.style.color=e.color}(e),g.textContent=t,g.style.display="inline-flex",g.style.opacity="0",g.style.transform="translateY(2px)","function"==typeof g.getBoundingClientRect&&g.getBoundingClientRect(),g.style.opacity="1",g.style.transform="translateY(0)";const n=(null==wP?void 0:wP.setTimeout)||setTimeout;W=n((()=>{W=null,function(){q(),V(),g.style.opacity="0",g.style.transform="translateY(-2px)";const t=(null==wP?void 0:wP.setTimeout)||setTimeout;j=t((()=>{j=null,G()}),180)}()}),1800)}function et(t,e){if(!t)return void J();o.textContent=t,o.style.display="block";const n=r.getBoundingClientRect(),i=o.getBoundingClientRect(),s=((null==e?void 0:e.clientX)||0)-n.left+12,a=((null==e?void 0:e.clientY)||0)-n.top+12,l=n.width-i.width-8,c=n.height-i.height-8,u=Math.max(8,Math.min(s,l)),d=Math.max(8,Math.min(a,c));o.style.left=`${u}px`,o.style.top=`${d}px`}function nt(){s.style.display="none"}function it(t,n){const o="function"==typeof e&&t?e(t):null,u=Array.isArray(null==o?void 0:o.children)?o.children:[];if(!u.length)return void nt();if(a.textContent=t,l.textContent="children",function(){for(;c.firstChild;)c.removeChild(c.firstChild)}(),u.forEach((t=>{t&&t.nodeId&&c.appendChild(function(t){const n=i.createElement("div");n.style.display="grid",n.style.gridTemplateColumns="10px 1fr auto auto",n.style.alignItems="center",n.style.gap="6px";const r="string"==typeof(null==t?void 0:t.nodeId)?t.nodeId:"",o=NP(null==t?void 0:t.weight)?t.weight:1,s=function(t){if(!t||"function"!=typeof e)return"missing";const n=e(t);if(!n)return"missing";const i="string"==typeof n.state?n.state.trim().toLowerCase():"";return"pending"===i||"resolving"===i||"ready"===i||"failed"===i?i:"pending"}(r);n.dataset.childId=r,n.dataset.childStatus=s;const a=i.createElement("span");a.dataset.statusIndicator=s,a.style.width="8px",a.style.height="8px",a.style.borderRadius="999px",a.style.background=NR[s]||NR.pending,a.style.display="inline-block";const l=i.createElement("span");l.textContent=r||"unknown",l.style.overflow="hidden",l.style.textOverflow="ellipsis",l.style.whiteSpace="nowrap";const c=i.createElement("span");c.textContent=`w=${FP(o,0)}`,c.style.opacity="0.8";const u=i.createElement("span");return u.textContent=s,u.style.opacity="0.75",n.appendChild(a),n.appendChild(l),n.appendChild(c),n.appendChild(u),n}(t))})),!c.childNodes.length)return void nt();s.style.display="flex";const d=r.getBoundingClientRect(),h=s.getBoundingClientRect(),f=((null==n?void 0:n.clientX)||0)-d.left+12,p=((null==n?void 0:n.clientY)||0)-d.top+12,m=d.width-h.width-8,v=d.height-h.height-8,g=Math.max(8,Math.min(f,m)),y=Math.max(8,Math.min(p,v));s.style.left=`${g}px`,s.style.top=`${y}px`}function rt(){const e=E;if(t&&"function"==typeof t.getPlacementsActiveAtTime){const n=t.getPlacementsActiveAtTime(e),i=new Set(n.map((t=>null==t?void 0:t.placementId)).filter((t=>"string"==typeof t&&t.length)));C.forEach((t=>{i.has(t)||eD(M.get(t),!1)})),i.forEach((t=>{C.has(t)||eD(M.get(t),!0)})),C=i}else w.track.querySelectorAll('[data-timeline-item="nodes"]').forEach((t=>{const n="true"===t.dataset.hasDuration,i=Number(t.dataset.start),r=Number(t.dataset.end);eD(t,n&&AP(e)&&e>=i&&e<r)}));if(t&&"function"==typeof t.getActiveRenderPlacement){const n=t.getActiveRenderPlacement(e),i=null==n?void 0:n.renderPlacementId;O&&O!==i&&eD(F.get(O),!1),i&&O!==i&&eD(F.get(i),!0),O=i||null}else x.track.querySelectorAll('[data-timeline-item="render"]').forEach((t=>{const n="true"===t.dataset.hasDuration,i=Number(t.dataset.start),r=Number(t.dataset.end);eD(t,n&&AP(e)&&e>=i&&e<r)}))}function ot(t){const n=WR(t,e);if(!NP(n)||"function"!=typeof e)return{boundaries:[],buffered:[]};const i=e(null==t?void 0:t.nodeId),r=function(t){const e=Array.isArray(null==t?void 0:t.tracks)?t.tracks:[];if(!e.length)return null;if(null!=t&&t.mainTrackId){const n=e.find((e=>(null==e?void 0:e.id)===t.mainTrackId));if(n)return n}return e.find((t=>Array.isArray(null==t?void 0:t.segments)&&t.segments.length))||null}(i);if(!r)return{boundaries:[],buffered:[]};const o=t=>{if(!t)return 0;const e=Number(null==t?void 0:t.bufferedRatio);if(Number.isFinite(e))return MP(e);const n=Number(null==t?void 0:t.retainedByteLength);if(!NP(n))return 0;const i=null==t?void 0:t.chosenRepresentation,r=NP(null==i?void 0:i.sizeBytes)?i.sizeBytes:null;return NP(r)?MP(n/r):1},s=Array.isArray(r.segments)?r.segments:[],a=AP(null==r?void 0:r.offset)?r.offset:0,l=AP(null==t?void 0:t.nodeOffsetOverride)?t.nodeOffsetOverride:0;if(!s.length){const t=null==i?void 0:i.buffered,e=AP(null==t?void 0:t.start)?t.start-l:0,r=AP(null==t?void 0:t.end)?t.end-l:0,o=Math.max(0,e),s=Math.min(n,r);return s>o?{boundaries:[],buffered:[{startRatio:o/n,endRatio:s/n}]}:{boundaries:[],buffered:[]}}if("image"===(null==r?void 0:r.type)){const t=s.find((t=>t&&!t.isInit))||s[0],e=t?o(t):0;return e>0?{boundaries:[],buffered:[{startRatio:0,endRatio:MP(e)}]}:{boundaries:[],buffered:[]}}return function(t,e,n,i,r){const o=[],s=[];let a=0;return t.forEach((t=>{if(null!=t&&t.isInit)return;AP(null==t?void 0:t.offset)&&(a=t.offset);const l=a;if(!AP(l))return;const c=AP(null==t?void 0:t.duration)?t.duration:0,u=n+l-i,d=n+(l+c)-i;u>0&&u<e&&o.push(u/e);const h="function"==typeof r?r(t):0;if(c>0&&d>0&&u<e&&h>0){const t=Math.max(0,u),n=Math.min(e,d);if(n>t){const i=t+(n-t)*MP(h);s.push({startRatio:t/e,endRatio:i/e})}}c>0&&(AP(null==t?void 0:t.offset)?a=t.offset+c:a+=c)})),{boundaries:o,buffered:s}}(s,n,a,l,o)}function st(){const t=Array.isArray(_)?_:[],e=new Map(t.map((t=>[null==t?void 0:t.placementId,t])));for(const[t,n]of M.entries()){if(!t)continue;const i=e.get(t);i&&(n.querySelectorAll('[data-buffered-segment="true"]').forEach((t=>t.remove())),tD(n,ot(i).buffered,AR))}}function at(){const t=new Set(_.map((t=>null==t?void 0:t.nodeId)).filter((t=>"string"==typeof t&&t.length)));t.forEach((t=>{if(N.has(t))return;const n="function"==typeof e?e(t):null;if(!n||"function"!=typeof n.on)return;const i=t=>function(t={}){if(!t||t.isInit)return;const e=null==t?void 0:t.nodeId,n=null==t?void 0:t.segmentId,i=Number(null==t?void 0:t.loaded),r=Number(null==t?void 0:t.total);if(!e||!n||!AP(i))return;const o=`${e}:${n}`,s=A.get(o)||{},a={loaded:Math.max(AP(s.loaded)?s.loaded:0,i),total:NP(r)?r:s.total};A.set(o,a),function(){if(P)return;P=!0;const t=null==wP?void 0:wP.requestAnimationFrame;"function"!=typeof t?((null==wP?void 0:wP.setTimeout)||setTimeout)((()=>{P=!1,st()}),0):t((()=>{P=!1,st()}))}()}(t);n.on("segment:chunk",i),N.set(t,{node:n,handler:i})}));for(const[e,n]of N.entries())t.has(e)||(null!=n&&n.node&&"function"==typeof n.node.off&&n.node.off("segment:chunk",n.handler),N.delete(e))}function lt({track:t,color:e,start:n,duration:r,startTime:o,durationSeconds:s,segmentRatios:a,bufferedSegments:l,placementId:c,nodeId:u,label:d,rowIndex:h=0,rowHeight:f=18,rowGap:p=0,laneId:m,isClickable:v,isActive:g,tooltip:y,hoverDetailsNodeId:b,showLabel:k,onClick:w}){const x=i.createElement("div");!function(t,e){t.style.position="absolute",t.style.borderRadius="4px",t.style.background=e,t.style.opacity="0.9",t.style.font=IP,t.style.color="#fff",t.style.display="flex",t.style.alignItems="center",t.style.whiteSpace="nowrap",t.style.overflow="hidden",t.style.textOverflow="ellipsis"}(x,e),function(t,{startRatio:e,durationRatio:n,rowIndex:i=0,rowHeight:r=18,rowGap:o=0}={}){const s=i*(r+o)+2,a=Math.max(1,r-4);t.style.top=`${s}px`,t.style.height=`${a}px`;const l=MP(e);if(NP(n)){const e=Math.max(0,Math.min(n,1-l));return t.style.left=100*l+"%",t.style.width=100*e+"%",void(t.style.padding="0 4px")}t.style.left=100*l+"%",t.style.width="2px",t.style.padding="0"}(x,{startRatio:n,durationRatio:r,rowIndex:h,rowHeight:f,rowGap:p}),function(t,{laneId:e,label:n,isClickable:i,shouldShowLabel:r,onClick:o}={}){if(e&&(t.dataset.timelineItem=e),r&&n){const e=wP.document.createElement("span");e.textContent=n,e.style.position="relative",e.style.zIndex="2",e.style.pointerEvents="none",t.appendChild(e)}i&&(t.style.cursor="pointer"),"function"==typeof o&&t.addEventListener("click",o)}(x,{laneId:m,label:d,isClickable:v,shouldShowLabel:"boolean"==typeof k?k:NP(r),onClick:w}),y&&(x.title=y),AP(o)&&(x.dataset.start=String(o)),NP(s)||UR(s)?(x.dataset.end=String(o+s),x.dataset.hasDuration="true"):(x.dataset.end="",x.dataset.hasDuration="false"),c&&(x.dataset.placementId=c),u&&(x.dataset.nodeId=u),x.style.pointerEvents="auto",tD(x,l,AR),function(t,e=[]){t&&Array.isArray(e)&&e.length&&e.forEach((e=>{if(!AP(e)||e<=0||e>=1)return;const n=wP.document.createElement("div");n.dataset.segmentBoundary="true",n.style.position="absolute",n.style.top="2px",n.style.bottom="2px",n.style.width="1px",n.style.left=100*MP(e)+"%",n.style.transform="translateX(-0.5px)",n.style.background="rgba(255,255,255,0.35)",n.style.pointerEvents="none",n.style.zIndex="1",t.appendChild(n)}))}(x,a),eD(x,g),y&&(x.addEventListener("mouseenter",(t=>et(y,t))),x.addEventListener("mousemove",(t=>et(y,t))),x.addEventListener("mouseleave",J)),b&&(x.addEventListener("mouseenter",(t=>it(b,t))),x.addEventListener("mousemove",(t=>it(b,t))),x.addEventListener("mouseleave",nt)),t.appendChild(x),"nodes"===m&&c?M.set(c,x):"render"===m&&c&&F.set(c,x)}async function ct({event:i,placement:r,rangeEnd:o,track:s}){const a=VR(I);if(a===CR)return;if(a===OR)return void function(e,n,i){if(!t)return;if(!NP(n)||!i)return;const r="function"==typeof i.getBoundingClientRect?i.getBoundingClientRect():null,o=NP(null==r?void 0:r.width)?r.width:i.clientWidth;if(!NP(o))return;const s=AP(null==r?void 0:r.left)?r.left:0,a=MP(((AP(null==e?void 0:e.clientX)?e.clientX:0)-s)/o)*n;AP(a)&&(t.currentTime=a)}(i,o,s);const l="string"==typeof(null==r?void 0:r.nodeId)?r.nodeId:"",c="function"==typeof e&&l?e(l):null,u=a===PR?l:a===RR?JSON.stringify(XR(r,e),null,2):function(t,e){return function(t,e){return function(t,e,n){const i=(t||"").replace(/\/$/,""),r=null==n?void 0:n.assetId,o=null==n?void 0:n.assetRevision;if(i&&"string"==typeof r&&"number"==typeof o)return`${i}/raw/${encodeURIComponent(r)}/${o}`}(t,0,e)}(e,null==t?void 0:t.manifestRef)}(c,n),d=a===PR?"Copied node ID":a===RR?"Copied node context":"Copied source video URL";if(u)try{await async function(t,e){const n=null==wP||null===(e=wP.navigator)||void 0===e?void 0:e.clipboard;if(!n||"function"!=typeof n.writeText)throw new Error("Clipboard API unavailable.");await n.writeText(t)}(u),tt(d)}catch(t){}else a===DR&&tt("Source video URL unavailable",{tone:"warning"})}function ut(){const n=function(){let t=0;const n=Array.isArray(_)?_:[],i=Array.isArray(T)?T.filter((t=>!0!==(null==t?void 0:t.offsetPending))):[];return n.forEach((n=>{if(!0===(null==n?void 0:n.offsetPending))return;const i=AP(null==n?void 0:n.offset)?n.offset:void 0;if(!AP(i))return;const r=WR(n,e);t=NP(r)?Math.max(t,i+r):Math.max(t,i)})),i.forEach((e=>{const n=AP(null==e?void 0:e.offset)?e.offset:0,i=jR(e);t=NP(i)?Math.max(t,n+i):Math.max(t,n)})),NP(t)?t:1}();S=n,h.textContent=`t=${FP(E)}s`,f.textContent=`range=0-${FP(n)}s`,J(),nt(),U(w.track),U(x.track),M.clear(),F.clear(),C=new Set,O=null,P=!1;const i=Array.isArray(_)?_:[],r=Array.isArray(T)?T:[],o=function(n){const i=(Array.isArray(n)?n.slice():[]).map((t=>{if(!0===(null==t?void 0:t.offsetPending))return null;const n=AP(null==t?void 0:t.offset)?t.offset:void 0;if(!AP(n))return null;const i=WR(t,e);return{placement:t,offset:n,duration:i,end:NP(i)?n+i:n,rowIndex:0}})).filter(Boolean).sort(((t,e)=>{var n,i,r,o;const s=t.offset-e.offset;if(0!==s)return s;const a="string"==typeof(null===(n=t.placement)||void 0===n?void 0:n.nodeId)?t.placement.nodeId:"",l="string"==typeof(null===(i=e.placement)||void 0===i?void 0:i.nodeId)?e.placement.nodeId:"";if(a!==l)return a.localeCompare(l);const c="string"==typeof(null===(r=t.placement)||void 0===r?void 0:r.placementId)?t.placement.placementId:"",u="string"==typeof(null===(o=e.placement)||void 0===o?void 0:o.placementId)?e.placement.placementId:"";return c.localeCompare(u)})),r=[],o=function(t,e){const n=Number(null==t||null===(e=t.settings)||void 0===e?void 0:e.snapToFps);return!Number.isFinite(n)||n<=0?0:.5/n}(t);return i.forEach((t=>{const e=t.offset,n=AP(t.end)?t.end:e;let i=-1;for(let t=0;t<r.length;t+=1)if(r[t]<=e+o){i=t;break}-1===i?(i=r.length,r.push(n)):r[i]=Math.max(r[i],n),t.rowIndex=i})),{items:i,rowCount:Math.max(1,r.length)}}(i);var s;!function(t){const e=t.rowCount*SR+4*(t.rowCount-1);w.track.style.height=`${e}px`,x.track.style.height="18px",w.track.style.cursor="default",w.track.style.pointerEvents="auto",x.track.style.pointerEvents="auto"}(o),function(t,e){t.items.forEach((t=>{const n=t.placement,i=t.offset,r=t.duration,o=(null==n?void 0:n.nodeId)||(null==n?void 0:n.placementId)||"node",s=!!AP(E)&&E>=i&&(!NP(r)||E<i+r),a=ot(n),l=VR(I)!==CR;lt({track:w.track,color:"rgba(255,255,255,0.16)",start:MP(i/e),duration:NP(r)?MP(r/e):null,startTime:i,durationSeconds:r,segmentRatios:a.boundaries,bufferedSegments:a.buffered,placementId:null==n?void 0:n.placementId,nodeId:null==n?void 0:n.nodeId,label:o,rowIndex:t.rowIndex,rowHeight:SR,rowGap:4,laneId:"nodes",isClickable:l,isActive:s,tooltip:(null==n?void 0:n.nodeId)||(null==n?void 0:n.placementId),hoverDetailsNodeId:null==n?void 0:n.nodeId,onClick:l?t=>{ct({event:t,placement:n,rangeEnd:e,track:w.track})}:void 0})}))}(o,n),s=n,r.forEach((t=>{const e=AP(null==t?void 0:t.offset)?t.offset:void 0;if(!AP(e))return;const n=jR(t),i=UR(n),r=(null==t?void 0:t.type)||(null==t?void 0:t.renderPlacementId)||"render",o=function(t){const e="string"==typeof t?t.trim().toLowerCase():"";return"switch"===e||"switching"===e||"switchingrendernode"===e}(null==t?void 0:t.type),a=o?()=>{"function"==typeof(null==wP?void 0:wP.switchTo)&&wP.switchTo("next")}:void 0;let l=!1;AP(E)&&(i?l=E>=e:NP(n)&&(l=E>=e&&E<e+n));const c=i&&NP(s)?MP((s-e)/s):NP(n)?MP(n/s):null;lt({track:x.track,color:"rgba(248,162,62,0.9)",start:MP(e/s),duration:c,startTime:e,durationSeconds:n,label:r,placementId:null==t?void 0:t.renderPlacementId,rowIndex:0,rowHeight:SR,rowGap:0,laneId:"render",isClickable:!!o,isActive:l,tooltip:(null==t?void 0:t.type)||(null==t?void 0:t.renderPlacementId),showLabel:NP(n)||i,onClick:a})})),Q(w.indicator,n),Q(x.indicator,n),rt(),st(),D=ZR(_,T)||QR(_,e),R=D?YR(_,T,e):"",L=Array.isArray(_)?_.length:0,B=Array.isArray(T)?T.length:0,Y()}function dt(t,n){_=Array.isArray(t)?t.slice():[],T=Array.isArray(n)?n.slice():[],D=ZR(_,T)||QR(_,e),at(),ut()}return v.addEventListener("change",(()=>{I=VR(v.value),v.value=I,ut()})),{id:"timeline",title:"Timeline",render:t=>{t.appendChild(r),ut()},updatePlacements:dt,updateTime:function(t){if(E=AP(t)?t:E,K())return;if(D&&X())return;const e=S;AP(e)&&(h.textContent=`t=${FP(E)}s`,f.textContent=`range=0-${FP(e)}s`,Q(w.indicator,e),Q(x.indicator,e),rt())},refresh:()=>ut(),dispose:()=>{$(),Z();for(const t of N.values())(null==t?void 0:t.node)&&"function"==typeof t.node.off&&t.node.off("segment:chunk",t.handler);N.clear(),A.clear()}}}const iD=1024,rD=1048576,oD=1073741824;function sD(t){return AP(t)?t<iD?`${Math.round(t)} B`:t<rD?`${FP(t/iD,1)} KB`:t<oD?`${FP(t/rD,2)} MB`:`${FP(t/oD,2)} GB`:"n/a"}const aD="ekoplayer-debug-overlay";var lD=new WeakMap,cD=new WeakMap,uD=new WeakMap,dD=new WeakMap,hD=new WeakSet;class fD{constructor({tabBarEl:t,contentEl:e}){O(this,hD),F(this,lD,[]),F(this,cD,void 0),F(this,uD,void 0),F(this,dD,void 0),C(uD,this,t),C(dD,this,e)}registerTab(t){t&&"string"==typeof t.id&&"string"==typeof t.title&&"function"==typeof t.render&&(M(lD,this).some((e=>e.id===t.id))||(M(lD,this).push(t),A(hD,this,pD).call(this),M(cD,this)||this.selectTab(t.id)))}selectTab(t){M(lD,this).find((e=>e.id===t))&&(C(cD,this,t),A(hD,this,pD).call(this),A(hD,this,mD).call(this))}dispose(){M(uD,this)&&(M(uD,this).innerHTML=""),M(dD,this)&&(M(dD,this).innerHTML=""),C(lD,this,[]),C(uD,this,null),C(dD,this,null)}}function pD(){const t=M(uD,this);t&&(t.innerHTML="",M(lD,this).forEach((e=>{const n=wP.document.createElement("button");n.type="button",n.textContent=e.title,n.style.cursor="pointer",n.style.padding="6px 10px",n.style.borderRadius="6px",n.style.border="1px solid rgba(255,255,255,0.2)",n.style.background=e.id===M(cD,this)?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.2)",n.style.color="#fff",n.style.font=SP,n.addEventListener("click",(()=>this.selectTab(e.id))),t.appendChild(n)})))}function mD(){const t=M(dD,this);if(!t)return;t.innerHTML="";const e=M(lD,this).find((t=>t.id===M(cD,this)));e&&e.render(t)}function vD({mountElement:t,canvasElement:e,timeline:n,assetsDeliveryServiceUrl:i,getNode:r,listNodes:o,downloadSpeed:s,downloadEvents:a,qoe:l,qoeEvents:c,options:u={},playbackStartedAtMs:d,playerVersion:h}={}){if(!t)throw new Error("Debug overlay requires mountElement.");if(!n||"function"!=typeof n.on)throw new Error("Debug overlay requires a Timeline with .on/.off.");!function(t){if(!t||!t.style)return;const e=null==wP?void 0:wP.window,n=e&&"function"==typeof e.getComputedStyle?e.getComputedStyle(t):null,i=n?n.position:t.style.position;i&&"static"!==i||(t.style.position="relative")}(t);const f=wP.document.getElementById(aD);f&&f.parentNode&&f.parentNode.removeChild(f);const p=function({mountElement:t,playerVersion:e}){const n=null==wP?void 0:wP.document;if(!n||"function"!=typeof n.createElement)throw new Error("Debug overlay requires document.createElement.");const i=n.createElement("div");i.id=aD,i.style.position="absolute",i.style.inset="0",i.style.zIndex="999999",i.style.pointerEvents="none";const r=n.createElement("div");r.style.position="absolute",r.style.top="8px",r.style.left="8px",r.style.width="460px",r.style.maxWidth="calc(100% - 16px)",r.style.background="rgba(0,0,0,0.65)",r.style.border="1px solid rgba(255,255,255,0.18)",r.style.borderRadius="10px",r.style.padding="10px",r.style.color="#fff",r.style.pointerEvents="auto",r.style.backdropFilter="blur(6px)";const o=n.createElement("div");o.style.display="flex",o.style.justifyContent="space-between",o.style.alignItems="center",o.style.gap="10px";const s=n.createElement("div");s.textContent="EkoPlayer Debug",s.style.font="600 13px ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial";const a=n.createElement("button");a.type="button",a.textContent="Hide",a.style.cursor="pointer",a.style.padding="6px 10px",a.style.borderRadius="8px",a.style.border="1px solid rgba(255,255,255,0.2)",a.style.background="rgba(0,0,0,0.2)",a.style.color="#fff",o.appendChild(s),o.appendChild(a);const l=n.createElement("div");l.style.display="flex",l.style.gap="8px",l.style.marginTop="10px";const c=n.createElement("div");c.style.marginTop="10px";const u=n.createElement("div");u.style.marginTop="10px",u.style.font=IP,u.style.display="flex",u.style.justifyContent="space-between",u.style.alignItems="center",u.style.gap="10px";const d=n.createElement("div");d.style.color="rgba(140, 224, 255, 0.9)",d.textContent="Playback started @ --";const h=n.createElement("div");h.style.opacity="0.7",h.style.marginLeft="auto",h.textContent=e?`version ${e}`:"version n/a",u.appendChild(d),u.appendChild(h);const f=n.createElement("button");return f.type="button",f.textContent="Debug",f.style.position="absolute",f.style.top="8px",f.style.left="8px",f.style.cursor="pointer",f.style.padding="6px 10px",f.style.borderRadius="10px",f.style.border="1px solid rgba(255,255,255,0.25)",f.style.background="rgba(0,0,0,0.55)",f.style.color="#fff",f.style.pointerEvents="auto",f.style.display="none",r.appendChild(o),r.appendChild(l),r.appendChild(c),r.appendChild(u),i.appendChild(r),i.appendChild(f),t.appendChild(i),{overlayRoot:i,panel:r,tabBar:l,content:c,hideBtn:a,showBtn:f,footerPlayback:d}}({mountElement:t,playerVersion:h||(null==u?void 0:u.playerVersion)}),m=new fD({tabBarEl:p.tabBar,contentEl:p.content});let v=!0;function g(){v=!1,p.panel.style.display="none",p.showBtn.style.display="inline-block"}function y(){v=!0,p.panel.style.display="block",p.showBtn.style.display="none"}p.hideBtn.addEventListener("click",g),p.showBtn.addEventListener("click",y);const b=nD({timeline:n,getNode:r,assetsDeliveryServiceUrl:i}),k=function({getNode:t}){const e=wP.document,n=e.createElement("pre");n.style.margin="0",n.style.whiteSpace="pre-wrap",n.style.font=SP,n.style.lineHeight="1.35";const i=e.createElement("div");i.style.display="flex",i.style.flexDirection="column",i.style.gap="8px",i.style.marginTop="6px";const r=e.createElement("div");r.style.display="flex",r.style.gap="10px",r.style.marginTop="10px",r.style.alignItems="center",r.style.flexWrap="wrap";const o=new jP({maxValue:60}),s=new jP({maxValue:60}),a=e.createElement("div"),l=e.createElement("div");l.textContent="browserfps",l.style.font=IP,l.style.opacity="0.9",a.appendChild(l),a.appendChild(o.element);const c=e.createElement("div"),u=e.createElement("div");return u.textContent="fps",u.style.font=l.style.font,u.style.opacity="0.9",c.appendChild(u),c.appendChild(s.element),r.appendChild(a),r.appendChild(c),{id:"frames",title:"Frames",render:t=>{t.appendChild(n),t.appendChild(i),t.appendChild(r)},pushBrowserFps:(t,e)=>o.push(t,e),pushVisualFps:(t,e)=>s.push(t,e),updateInfo:function({time:r,entries:o}){const s=Array.isArray(o)?o.slice().sort(qP):[];if(!s.length)return n.textContent="",void(i.innerHTML="");n.textContent=`t=${YP(r)}s tracks=${s.length}`,i.innerHTML="";for(let n=0;n<s.length;n+=1){const r=s[n],o=ZP(t,r),a=(null==o?void 0:o.id)||"n/a",l=(null==o?void 0:o.codecs)||(null==o?void 0:o.mime)||"n/a",c=XP(null==o?void 0:o.bandwidth),u=CP(null==o?void 0:o.width,null==o?void 0:o.height),d=QP(t,r)||"n/a",h=JP(t,r),f=h?` fallback=${h}`:"",p=HP(t,r),m=(null==p?void 0:p.strategy)||"n/a",v=(null==p?void 0:p.decisionReason)||"n/a",g=KP(null==p?void 0:p.measuredDownloadSpeedKbps),y=KP(null==p?void 0:p.safeBandwidthKbps),b=e.createElement("div");b.style.display="flex",b.style.flexDirection="column",b.style.gap="2px";const k=e.createElement("pre");k.style.margin="0",k.style.whiteSpace="pre-wrap",k.style.font=SP,k.style.lineHeight="1.35",k.textContent=[`${(null==r?void 0:r.nodeId)||"?"} ${(null==r?void 0:r.trackId)||"?"} ${(null==r?void 0:r.segmentId)||"?"} pts=${YP(null==r?void 0:r.presentationTime)}s`,`rep=${a} encodeProfile=${d}${f} res=${u} codec=${l} repBW=${c}`,`abr=strategy:${m} reason:${v} measuredBW:${g} safeBW:${y}`].join("\n"),b.appendChild(k);const w=(null==p?void 0:p.selectedRepresentationId)||(null==o?void 0:o.id),x=nR(t,r,o,p);if(x.length){const t=e.createElement("div");t.style.display="flex",t.style.alignItems="center",t.dataset.abrLadderRow="true",t.dataset.trackId=(null==r?void 0:r.trackId)||"",t.dataset.segmentId=(null==r?void 0:r.segmentId)||"";const n=e.createElement("div");n.style.display="inline-flex",n.style.alignItems="center",n.style.gap="2px",n.dataset.abrLadder="true",x.forEach((t=>{const i=e.createElement("span"),r=!!w&&t.id===w;i.dataset.abrLadderBlock="true",i.dataset.repId=t.id||"",i.dataset.selected=r?"true":"false",i.style.display="inline-block",i.style.width="10px",i.style.height="8px",i.style.borderRadius="2px",i.style.border="1px solid rgba(255,255,255,0.35)",i.style.background=r?"rgba(74, 222, 128, 0.95)":"rgba(156, 163, 175, 0.55)",i.title=`${t.id||"?"} ${KP(t.bandwidthKbps)}`,n.appendChild(i)})),t.appendChild(n),b.appendChild(t)}i.appendChild(b)}},dispose:()=>{o.dispose(),s.dispose()}}}({getNode:r}),w=aR({downloadSpeed:s,downloadEvents:a}),x=function({qoe:t,qoeEvents:e}={}){const n=null==wP?void 0:wP.document;if(!n||"function"!=typeof n.createElement)throw new Error("Debug overlay QoE tab requires document.createElement.");const i=n.createElement("pre");i.style.margin="0",i.style.whiteSpace="pre-wrap",i.style.font=SP;const{graphWrap:r,graph:o}=function(t){const e=t.createElement("div");e.style.marginTop="10px";const n=t.createElement("div");n.textContent="qoe score",n.style.font=IP,n.style.opacity="0.9";const i=new jP({maxValue:1,windowMs:3e4,formatValue:t=>lR(t)});return e.appendChild(n),e.appendChild(i.element),{graphWrap:e,graph:i}}(n);let s=null;const a=()=>{i.textContent=function(t){if(!t)return"QoE unavailable";const e="string"==typeof t.status?t.status:"n/a";return[`score=${lR(t.score)}`,`status=${e}`,`streamQualityScore=${lR(t.streamQualityScore)}`,`fpsScore=${lR(t.fpsScore)}`,`browserFps=${lR(t.browserFps)}`,`waitingSeconds=${lR(t.waitingSeconds)}`,`playingSeconds=${lR(t.playingSeconds)}`].join("\n")}(t)},l=()=>{if(!t)return;const e=Number(t.score);Number.isFinite(e)&&o.push(e,cR())},c=t=>{const e=Number(t);Number.isFinite(e)&&o.push(e,cR()),a()},u=()=>{a()};if(a(),l(),e&&"function"==typeof e.on&&(e.on("qoescore",c),e.on("qoestatus",u)),t){const t="function"==typeof(null==wP?void 0:wP.setInterval)?wP.setInterval:setInterval;s=t((()=>{l(),a()}),1e3)}return{id:"qoe",title:"QoE",render:t=>{t.appendChild(i),t.appendChild(r)},dispose:()=>{e&&"function"==typeof e.off&&(e.off("qoescore",c),e.off("qoestatus",u)),s&&(("function"==typeof(null==wP?void 0:wP.clearInterval)?wP.clearInterval:clearInterval)(s),s=null),o.dispose()}}}({qoe:l,qoeEvents:c}),_=function({timeline:t,getNode:e,listNodes:n,options:i}={}){const r=null==wP?void 0:wP.document;if(!r||"function"!=typeof r.createElement)throw new Error("Debug overlay Memory tab requires document.createElement.");const o=r.createElement("pre");o.style.margin="0",o.style.whiteSpace="pre-wrap",o.style.font=SP;const s=r.createElement("div");s.textContent="nodes",s.style.marginTop="10px",s.style.font=IP,s.style.opacity="0.9";const a=r.createElement("pre");a.style.margin="6px 0 0 0",a.style.whiteSpace="pre-wrap",a.style.font=SP;let l=null;const c=()=>{const r=function({timeline:t,getNode:e,listNodes:n}){const i=[];let r=0;if("function"==typeof n){let t;try{t=n()}catch(e){t=null}if(Array.isArray(t))return t.forEach((t=>{const e=null==t?void 0:t.id;if("string"!=typeof e||!e.length)return;const n=Number(null==t?void 0:t.retainedByteLength);Number.isFinite(n)&&(r+=n,i.push({nodeId:e,bytes:n}))})),i.sort(((t,e)=>e.bytes-t.bytes)),{totalBytes:r,nodes:i,available:!0}}if(!t||"function"!=typeof e)return{totalBytes:0,nodes:[],available:!1};const o=Array.isArray(t.placements)?t.placements:[];return new Set(o.map((t=>null==t?void 0:t.nodeId)).filter((t=>"string"==typeof t&&t.length))).forEach((t=>{const n=e(t),o=Number(null==n?void 0:n.retainedByteLength);Number.isFinite(o)&&(r+=o,i.push({nodeId:t,bytes:o}))})),i.sort(((t,e)=>e.bytes-t.bytes)),{totalBytes:r,nodes:i,available:!0}}({timeline:t,getNode:e,listNodes:n}),s=function({timeline:t}){if(!t||"function"!=typeof t.getDecodedFrameStats)return{totalBytes:0,frames:0,available:!1};try{const e=t.getDecodedFrameStats(),n=Number(null==e?void 0:e.totalBytes),i=Number(null==e?void 0:e.frames);return{totalBytes:Number.isFinite(n)?n:0,frames:Number.isFinite(i)?i:0,available:!1!==(null==e?void 0:e.available)}}catch(t){return{totalBytes:0,frames:0,available:!1}}}({timeline:t}),l=function(t,e,n,i){const r=Number(null!==(n=null==t||null===(i=t.publicOptions)||void 0===i?void 0:i.segmentEvictionMaxRetainedBytes)&&void 0!==n?n:null==t?void 0:t.segmentEvictionMaxRetainedBytes),o=AP(r)&&r>=0,s=o?sD(r):"n/a";return{active:o&&AP(e)&&e>r,thresholdLabel:s}}(i,r.available?r.totalBytes:NaN),c=l.active?"on":"off",u=s.available?sD(s.totalBytes):"n/a",d=s.available?s.frames:"n/a";if(!r.available)return o.textContent=[`decoded=${u} decodedFrames=${d}`,`retained=n/a eviction=${c} threshold=${l.thresholdLabel}`].join("\n"),void(a.textContent="");if(o.textContent=[`decoded=${u} decodedFrames=${d}`,[`retained=${sD(r.totalBytes)}`,`nodes=${r.nodes.length}`,`eviction=${c}`,`threshold=${l.thresholdLabel}`].join(" ")].join("\n"),!r.nodes.length)return void(a.textContent="none");const h=r.nodes.slice(0,8).map((t=>`${t.nodeId}: ${sD(t.bytes)}`));a.textContent=h.join("\n")};c();const u="function"==typeof(null==wP?void 0:wP.setInterval)?wP.setInterval:setInterval;return l=u(c,1e3),{id:"memory",title:"Memory",render:t=>{t.appendChild(o),t.appendChild(s),t.appendChild(a)},refresh:c,dispose:()=>{l&&(("function"==typeof(null==wP?void 0:wP.clearInterval)?wP.clearInterval:clearInterval)(l),l=null)}}}({timeline:n,getNode:r,listNodes:o,options:u});m.registerTab(b),m.registerTab(k),m.registerTab(w),m.registerTab(x),m.registerTab(_),m.registerTab(function({options:t}={}){const e=null==wP?void 0:wP.document;if(!e||"function"!=typeof e.createElement)throw new Error("Debug overlay options tab requires document.createElement.");const n=e.createElement("pre");n.style.margin="0",n.style.font=SP,n.style.whiteSpace="pre-wrap",n.style.wordBreak="break-word";const i=null==t?void 0:t.publicOptions,r=i&&"object"==typeof i?Object.keys(i):[];if(r.length){const t=r.map((t=>`${t}=${function(t){if(null===t)return"null";if(void 0===t)return"undefined";const e=typeof t;if("string"===e)return t;if("number"===e||"boolean"===e)return String(t);try{return JSON.stringify(t)}catch(e){return String(t)}}(i[t])}`));n.textContent=t.join("\n")}else n.textContent="publicOptions unavailable";return{id:"options",title:"Options",render:t=>{t.appendChild(n)}}}({options:u}));const T=[],E=[];let I=0,S=0,A=null,N=!1,M=0,F=null;function C(t){const e=Number(t);Number.isFinite(e)&&(e-M<250||(M=e,k.pushBrowserFps(I,e),k.pushVisualFps(S,e)))}wP.window&&"function"==typeof wP.window.requestAnimationFrame&&(A=wP.window.requestAnimationFrame((function t(e){N||(I=VP(T,e),C(e),A=wP.window.requestAnimationFrame(t))})));const O=(t={})=>{if(N||!v)return;const e=Array.isArray(t.frames)?t.frames:[];if(!e.length)return void(F=null);const n=null!=wP&&wP.performance&&"function"==typeof wP.performance.now?wP.performance.now():Date.now(),i=e.map((t=>`${null==t?void 0:t.nodeId}:${null==t?void 0:t.trackId}:${null==t?void 0:t.segmentId}@${null==t?void 0:t.presentationTime}`)).join("|");i!==F&&(S=VP(E,n),F=i),k.updateInfo({time:t.time,entries:e}),C(n)};let P=Number.isFinite(d)?d:void 0;if(Number.isFinite(P)&&p.footerPlayback){const t=P/1e3;p.footerPlayback.textContent=`Playback started @ ${FP(t)}s`}const R=(t={})=>{if(!N&&void 0===P&&"playing"===(null==t?void 0:t.event)&&(P=_P(),p.footerPlayback)){const t=P/1e3;p.footerPlayback.textContent=`Playback started @ ${FP(t)}s`}},D=()=>{const t=Array.isArray(null==n?void 0:n.placements)?n.placements:[],e=Array.isArray(null==n?void 0:n.renderPlacements)?n.renderPlacements:[];b.updatePlacements(t,e)},L=(t={})=>{if(N)return;const e=Number.isFinite(null==t?void 0:t.time)?t.time:null==n?void 0:n.currentTime;b.updateTime(e),_&&"function"==typeof _.refresh&&_.refresh()},B=()=>{N||D()},z=()=>{N||D()},W=null==n?void 0:n.trackBuffers,j=()=>{N||("function"==typeof b.refresh?b.refresh():D(),_&&"function"==typeof _.refresh&&_.refresh())};return n.on(TP.VISUAL_FRAMES_AVAILABLE,O),n.on(TP.TIMELINE_TIME_UPDATE,L),n.on(TP.PLACEMENT_ADDED,B),n.on(TP.RENDER_PLACEMENT_ADDED,z),n.on(TP.TIMELINE_PLAYER_STATE,R),W&&"function"==typeof W.on&&W.on("track:bufferupdate",j),D(),b.updateTime(null==n?void 0:n.currentTime),{show:y,hide:g,dispose:function(){N||(N=!0,A&&wP.window&&"function"==typeof wP.window.cancelAnimationFrame&&wP.window.cancelAnimationFrame(A),A=null,n&&"function"==typeof n.off&&(n.off(TP.VISUAL_FRAMES_AVAILABLE,O),n.off(TP.TIMELINE_TIME_UPDATE,L),n.off(TP.PLACEMENT_ADDED,B),n.off(TP.RENDER_PLACEMENT_ADDED,z),n.off(TP.TIMELINE_PLAYER_STATE,R)),W&&"function"==typeof W.off&&W.off("track:bufferupdate",j),k&&"function"==typeof k.dispose&&k.dispose(),b&&"function"==typeof b.dispose&&b.dispose(),w&&"function"==typeof w.dispose&&w.dispose(),x&&"function"==typeof x.dispose&&x.dispose(),_&&"function"==typeof _.dispose&&_.dispose(),m.dispose(),p.overlayRoot&&p.overlayRoot.parentNode&&p.overlayRoot.parentNode.removeChild(p.overlayRoot))},registerTab:function(t){m.registerTab(t)},selectTab:function(t){m.selectTab(t)}}}var gD=Object.freeze({__proto__:null,createDebugOverlay:vD,default:vD});exports.EkoGallery=yP,exports.EkoGalleryLegacy=en,exports.ekoWebPixel=S,exports.getEkoAnalyticsSnippet=function(t){return`if (!window.EkoAnalytics) {\n !function () {\n var t, a, e, s, n;\n 'undefined' == typeof window || window.EkoAnalytics || (t = window, a = 'EkoAnalytics', e = document, s = 'script', t[a] || (t[a] = function () {\n t[a].f ? (t[a].q.push(arguments), t[a].ts.push(Date.now())) : t[a].apply(t, arguments);\n }, t[a].f = !0, t[a].q = t[a].q || [], t[a].ts = t[a].ts || [], t[a].t = Number(new Date), t[a].sa = [], t[a].cb = [], t[a].init = function (ids) {\n t[a].id = ids;\n }, t[a].childRequestIdsCallback = function (e) {\n e.data && 'ea-ids-request' === e.data.type && t[a].sa.push(e.source);\n }, t.addEventListener('message', t[a].childRequestIdsCallback)));\n }();\n\n window.EkoAnalytics.cb.push(() => {\n let setCookie = (key, value, additionalProperties = '') => {\n let hostname = window.location.hostname;\n let domain = hostname;\n \n let parts = hostname.split('.');\n if (parts.length > 2) {\n domain = parts.slice(-2).join('.');\n }\n\n // "samesite=lax" is needed for cross-site situations (like NZXT getting checkout url attributes from lambda).\n window.document.cookie = \`\${key}=\${value}; domain=.\${domain}; path=/; secure; samesite=lax; \${additionalProperties}\`;\n };\n\n setCookie('easid', encodeURIComponent(window.EkoAnalytics('getSid')));\n setCookie('eauid', encodeURIComponent(window.EkoAnalytics('getUid')), 'max-age=2147483647');\n });\n\n window.EkoAnalytics('configure', {\n snowplow: {\n options: {\n appId: 'ekoGalleryReactV4',\n },\n },\n ekoEnv: '${t?"production":"development"}',\n env: 'website',\n });\n window.EkoAnalytics('track', 'PageView');\n }`},exports.getEkoProductConfigUrl=bP,exports.getEkoProductConfigUrlLegacy=kP;
|
|
14
|
+
*/var ue=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;var i=Object.getOwnPropertyNames(t).map((function(e){return t[e]}));if("0123456789"!==i.join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,i,r=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),o=1;o<arguments.length;o++){for(var s in n=Object(arguments[o]))le.call(n,s)&&(r[s]=n[s]);if(ae){i=ae(n);for(var a=0;a<i.length;a++)ce.call(n,i[a])&&(r[i[a]]=n[i[a]])}}return r},de="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",he=Function.call.bind(Object.prototype.hasOwnProperty),fe=function(){};if("production"!==process.env.NODE_ENV){var pe=de,me={},ve=he;fe=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function ge(e,t,n,i,r){if("production"!==process.env.NODE_ENV)for(var o in e)if(ve(e,o)){var s;try{if("function"!=typeof e[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 e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw a.name="Invariant Violation",a}s=e[o](t,o,i,n,null,pe)}catch(e){s=e}if(!s||s instanceof Error||fe((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 me)){me[s.message]=!0;var l=r?r():"";fe("Failed "+n+" type: "+s.message+(null!=l?l:""))}}}ge.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(me={})};var ye=ge,be=function(){};function ke(){return null}"production"!==process.env.NODE_ENV&&(be=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}});var we=function(e,t){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(ke),arrayOf:function(e){return l((function(t,n,i,r,o){if("function"!=typeof e)return new a("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside arrayOf.");var s=t[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=e(s,l,i,r,o+"["+l+"]",de);if(c instanceof Error)return c}return null}))},element:l((function(t,n,i,r,o){var s=t[n];return e(s)?null:new a("Invalid "+r+" `"+o+"` of type `"+h(s)+"` supplied to `"+i+"`, expected a single ReactElement.")})),elementType:l((function(e,t,n,i,r){var o=e[t];return se.isValidElementType(o)?null:new a("Invalid "+i+" `"+r+"` of type `"+h(o)+"` supplied to `"+n+"`, expected a single ReactElement type.")})),instanceOf:function(e){return l((function(t,n,i,o,s){if(!(t[n]instanceof e)){var l=e.name||r;return new a("Invalid "+o+" `"+s+"` of type `"+(((c=t[n]).constructor&&c.constructor.name?c.constructor.name:r)+"` supplied to `")+i+"`, expected instance of `"+l+"`.")}var c;return null}))},node:l((function(e,t,n,i,r){return d(e[t])?null:new a("Invalid "+i+" `"+r+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(e){return l((function(t,n,i,r,o){if("function"!=typeof e)return new a("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var s=t[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(he(s,c)){var u=e(s,c,i,r,o+"."+c,de);if(u instanceof Error)return u}return null}))},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&be(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."),ke;return l((function(t,n,i,r,o){for(var l=t[n],c=0;c<e.length;c++)if(s(l,e[c]))return null;var u=JSON.stringify(e,(function(e,t){return"symbol"===f(t)?String(t):t}));return new a("Invalid "+r+" `"+o+"` of value `"+String(l)+"` supplied to `"+i+"`, expected one of "+u+".")}))},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&be("Invalid argument supplied to oneOfType, expected an instance of array."),ke;for(var t=0;t<e.length;t++){var n=e[t];if("function"!=typeof n)return be("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+p(n)+" at index "+t+"."),ke}return l((function(t,n,i,r,o){for(var s=[],l=0;l<e.length;l++){var c=(0,e[l])(t,n,i,r,o,de);if(null==c)return null;c.data&&he(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(e){return l((function(t,n,i,r,o){var s=t[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 e){var d=e[c];if("function"!=typeof d)return u(i,r,o,c,f(d));var p=d(s,c,i,r,o+"."+c,de);if(p)return p}return null}))},exact:function(e){return l((function(t,n,i,r,o){var s=t[n],l=h(s);if("object"!==l)return new a("Invalid "+r+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected `object`.");var c=ue({},t[n],e);for(var d in c){var p=e[d];if(he(e,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(t[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var m=p(s,d,i,r,o+"."+d,de);if(m)return m}return null}))}};function s(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function a(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function l(e){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!==de){if(t){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&&(be("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:e(s,l,c,u,d)}var s=o.bind(null,!1);return s.isRequired=o.bind(null,!0),s}function c(e){return l((function(t,n,i,r,o,s){var l=t[n];return h(l)!==e?new a("Invalid "+r+" `"+o+"` of type `"+f(l)+"` supplied to `"+i+"`, expected `"+e+"`.",{expectedType:e}):null}))}function u(e,t,n,i,r){return new a((e||"React class")+": "+t+" type `"+n+"."+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+r+"`.")}function d(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(d);if(null===t||e(t))return!0;var r=function(e){var t=e&&(n&&e[n]||e[i]);if("function"==typeof t)return t}(t);if(!r)return!1;var o,s=r.call(t);if(r!==t.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(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function f(e){if(null==e)return""+e;var t=h(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function p(e){var t=f(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return a.prototype=Error.prototype,o.checkPropTypes=ye,o.resetWarningCache=ye.resetWarningCache,o.PropTypes=o,o};function xe(){}function _e(){}_e.resetWarningCache=xe;var Te=D((function(e){if("production"!==process.env.NODE_ENV){var t=se;e.exports=we(t.isElement,!0)}else e.exports=function(){function e(e,t,n,i,r,o){if(o!==de){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 t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:_e,resetWarningCache:xe};return n.PropTypes=n,n}()}));const Ee=/https?:\/\/(.*?\.)?eko.com/,Ie={"eko.project.interaction":"interaction","eko.project.swipe":"swipe"};let Se=null,Ae=null,Ne=[];function Me(e){return t=>{var n;if(!Ee.test(t.origin)||"eko.embedapi"!==(null===(n=t.data)||void 0===n?void 0:n.source))return;const i=t.data,r=Ie[i.type];r&&(e?e(r,i.data):Ne.push({type:r,data:i.data}))}}"undefined"!=typeof window&&(Ae=Me(null),window.addEventListener("message",Ae));var Fe={subscribe:function(e){"function"==typeof e?Se?console.warn("[eko-gallery-react] Ignoring events subscribe since already subscribed"):(Se=e,Ae=Me(e),window.addEventListener("message",Ae),function(e){Ne.forEach((t=>{e(t.type,t.data)})),Ne=[]}(e)):console.warn("[eko-gallery-react] Ignoring events subscribe since a callback function was not provided as argument")},unsubscribe:function(){Ae?(window.removeEventListener("message",Ae),Ae=null,Se=null,Ne=[]):console.warn("[eko-gallery-react] Ignoring events unsubscribe since not subscribed")},send:function(e,t){Se?Se(e,t):Ne.push({type:e,data:t})}};const Ce=({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(e,t=200){if(!e)return null;try{let n=e;e.includes("assets.eko.com")&&e.includes("/raw/")&&(n=e.replace("/raw/","/image/"));const i=new URL(n);return i.searchParams.set("width",t),i.href}catch(t){return e}}(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(e){S.track("gallery.interaction",{elementid:`thumbnail-${e}`,interactiontype:"click"}),Fe.send("interaction",{elementid:`thumbnail-${e}`,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})`}}))))};Ce.propTypes={index:Te.number,activeIndex:Te.number,setActiveIndex:Te.func.isRequired,item:Te.object.isRequired,src:Te.string,navItemRefs:Te.object.isRequired,itemIcon:Te.string};const Oe=({layout:t,nav:n,isVerticalNav:i,showPrevArrow:r,showNextArrow:o})=>{var s,a,l,c,u;const d=e.useRef(null),h=e.useRef(null),f="arrows"===(null==t||null===(s=t.mobile)||void 0===s||null===(s=s.config)||void 0===s||null===(s=s.navPagination)||void 0===s?void 0:s.type)?"eko-mobile-arrows":"",p="arrows"===(null!==(a=null==t||null===(l=t.desktop)||void 0===l||null===(l=l.config)||void 0===l||null===(l=l.navPagination)||void 0===l?void 0:l.type)&&void 0!==a?a:"arrows")?"eko-desktop-arrows":"",m=f||p,v=i?null==n||null===(c=n.current)||void 0===c?void 0:c.scrollHeight:null==n||null===(u=n.current)||void 0===u?void 0:u.scrollWidth;function g(e){const t=i?n.current.clientHeight:n.current.clientWidth,r=function(e,t){const n=i?t.scrollTop:t.scrollLeft;return Math.max(-n,Math.min(v-e-n,e))}("next"===e?t:-t,n.current);return{top:i?r:0,left:i?0:r,behavior:"smooth"}}function y(e){var t,i,r;const o=g(e),s="next"===e?null==h||null===(t=h.current)||void 0===t?void 0:t.id:null==d||null===(i=d.current)||void 0===i?void 0:i.id;var a,l;window.EkoAnalytics("track","gallery.interaction",{elementid:s,interactiontype:"click"}),null==n||null===(r=n.current)||void 0===r||r.scrollBy(o),a=s,l="click",S.track("gallery.interaction",{elementId:a,interactiontype:l}),Fe.send("interaction",{elementId:a,interactiontype:l})}return e.createElement(e.Fragment,null,m&&e.createElement(e.Fragment,null,e.createElement("button",R({type:"button","aria-label":"Go to previous item","aria-hidden":r?"false":"true",onClick:()=>y("prev"),ref:d,id:"eko-nav-prev-arrow",className:`eko-nav-arrow eko-prev-nav-button ${f} ${p} ${r?"":"eko-hidden-nav-button"}`},r?{}:{tabIndex:"-1"}),e.createElement("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M5.56127 9.52817C5.28966 9.22635 5.28966 8.77361 5.56127 8.502L10.39 3.67331C10.6918 3.37157 11.1445 3.37157 11.4161 3.67331C11.7179 3.94492 11.7179 4.39766 11.4161 4.66927L7.10044 8.98487L11.4161 13.3307C11.7179 13.6023 11.7179 14.055 11.4161 14.3266C11.1445 14.6285 10.6918 14.6285 10.4202 14.3266L5.56127 9.52817Z",fill:"black"}))),e.createElement("button",R({type:"button","aria-label":"Go to next item","aria-hidden":o?"false":"true",onClick:()=>y("next"),ref:h,className:`eko-nav-arrow eko-next-nav-button ${f} ${p} ${o?"":"eko-hidden-nav-button"}`,id:"eko-nav-next-arrow"},o?{}:{tabIndex:"-1"}),e.createElement("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M12.4387 8.47185C12.7103 8.77367 12.7103 9.22641 12.4387 9.49802L7.61003 14.3267C7.30821 14.6284 6.85547 14.6284 6.58386 14.3267C6.28212 14.0551 6.28212 13.6024 6.58386 13.3308L10.8996 9.01515L6.58386 4.66933C6.28212 4.39772 6.28212 3.94499 6.58386 3.67338C6.85547 3.37155 7.30821 3.37155 7.57982 3.67338L12.4387 8.47185Z",fill:"black"})))))};function Pe(e,t,n){let i;return function(){const n=this,r=arguments;clearTimeout(i),i=setTimeout((function(){i=null,e.apply(n,r)}),t)}}Oe.propTypes={layout:Te.object.isRequired,nav:Te.object.isRequired,isVerticalNav:Te.bool.isRequired,showPrevArrow:Te.bool.isRequired,showNextArrow:Te.bool.isRequired};const Re=({items:t,setActiveIndex:n,activeIndex:i,layout:r,carouselMounted:o,forceMobile:s})=>{const l=e.useRef(null),c=e.useRef(null),u=e.useRef([]),d=3,[h,f]=e.useState(null),[p,m]=e.useState(!1),[v,g]=e.useState(0),[y,b]=e.useState(!1),[k,w]=e.useState(!1);function x(){var e;const t=s||window.innerWidth<768?"mobile":"desktop",n=(null==r||null===(e=r[t])||void 0===e||null===(e=e.config)||void 0===e?void 0:e.orientation)||("desktop"===t?"left":"bottom");m("left"===n||"right"===n);const i=c.current.parentNode,a=o?".eko-smart-gallery-container iframe":".eko-carousel",l=i.querySelector(a);setTimeout((()=>{g(l.clientHeight)}),0)}function _(){var e,t;const n=s||a()?"mobile":"desktop",i=null!==(e=null==r||null===(t=r[n])||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.navPagination)||void 0===t?void 0:t.scrollThreshold)&&void 0!==e?e:d;!function(e=d){var t,n;const i=l.current;if(!i)return;const o="none"!==(null==r||null===(t=r.desktop)||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.navPagination)||void 0===t?void 0:t.type),c=(u=null==r||null===(n=r.mobile)||void 0===n||null===(n=n.config)||void 0===n||null===(n=n.navPagination)||void 0===n?void 0:n.type,"mask"===u||"arrows"===u);var u;if((s||a())&&!c)return void i.style.setProperty("-webkit-mask","none");if(!a()&&!o)return void i.style.setProperty("-webkit-mask","none");const h=i.scrollHeight-i.clientHeight,f=i.scrollTop>e?"85%":"100%",m=i.scrollTop<=h-e?"15%":"0%",v=i.scrollWidth-i.clientWidth,g=i.scrollLeft>e?"15%":"0%",y=i.scrollLeft<=v-e?"85%":"100%";p?i.style.setProperty("-webkit-mask",`linear-gradient(0deg,#0000,#000 ${m} ${f},#0000)`):i.style.setProperty("-webkit-mask",`linear-gradient(90deg,#0000,#000 ${g} ${y},#0000)`)}(i),function(e=d){var t,n,i,r,o,s;const a=p?null==l||null===(t=l.current)||void 0===t?void 0:t.scrollTop:null==l||null===(n=l.current)||void 0===n?void 0:n.scrollLeft,c=p?null==l||null===(i=l.current)||void 0===i?void 0:i.clientHeight:null==l||null===(r=l.current)||void 0===r?void 0:r.clientWidth,u=p?null==l||null===(o=l.current)||void 0===o?void 0:o.scrollHeight:null==l||null===(s=l.current)||void 0===s?void 0:s.scrollWidth;u-e<c?(b(!1),w(!1)):a<=e?(b(!1),w(!0)):a+c>u-e?(b(!0),w(!1)):a+e>0&&a<u-e&&(b(!0),w(!0))}(i)}u.current=null==t?void 0:t.map(((t,n)=>{var i,r;return null!==(i=null==u||null===(r=u.current)||void 0===r?void 0:r[n])&&void 0!==i?i:e.createRef()}));const T=Pe((e=>{var t;t=e,S.track("gallery.interaction",{elementid:"nav",interactiontype:t}),Fe.send("interaction",{elementid:"nav",interactiontype:t})}),200);const E=e.useCallback((e=>{n({index:e,step:0,source:"nav"})}),[]);return e.useEffect((()=>{var e;f(null===(e=u.current)||void 0===e?void 0:e[i])}),[i]),e.useEffect((()=>{if(null!=h&&h.current&&null!=l&&l.current){const e=h.current,t=l.current.clientWidth/2,n=e.clientWidth/2,i=l.current.clientHeight/2,r=e.clientHeight/2;l.current.scrollTo({left:e.offsetLeft-t+n,top:e.offsetTop-i+r,behavior:"smooth"})}}),[h]),e.useEffect((()=>{x()}),[]),e.useEffect((()=>(window.addEventListener("resize",x),()=>{window.removeEventListener("resize",x)})),[c,o,s]),e.useEffect((()=>{g(0),x()}),[t,c,o,s]),e.useEffect((()=>{_();const e=new ResizeObserver(_);return e.observe(l.current),()=>{e.disconnect()}}),[t,s,p]),e.createElement("div",{className:"eko-nav-container",ref:c,style:{opacity:v>0?1:0,height:""+(v&&p?v+"px":"auto")}},e.createElement(Oe,{layout:r,nav:l,isVerticalNav:p,showPrevArrow:y,showNextArrow:k}),e.createElement("ul",{className:`eko-nav eko-mobile-nav-selected-${null!==(I=null==r||null===(A=r.mobile)||void 0===A||null===(A=A.config)||void 0===A?void 0:A.navItemsSelectedType)&&void 0!==I?I:"underline"} eko-desktop-nav-selected-${null!==(N=null==r||null===(M=r.desktop)||void 0===M||null===(M=M.config)||void 0===M?void 0:M.navItemsSelectedType)&&void 0!==N?N:"underline"}`,ref:l,onScroll:function(){_()},onWheel:function(){T("wheel")},onTouchMove:function(){T("swipe")}},null==t?void 0:t.map(((t,n)=>{var r;const o=(null==t||null===(r=t.media)||void 0===r?void 0:r.url)||(null==t?void 0:t.media)||"";return e.createElement(Ce,{key:o+n,index:n,activeIndex:i,setActiveIndex:E,item:t,src:o,navItemRefs:u,itemIcon:null==t?void 0:t.icon})}))));var I,A,N,M};Re.propTypes={items:Te.array.isRequired,activeIndex:Te.number,setActiveIndex:Te.func.isRequired,layout:Te.object,carouselMounted:Te.bool,forceMobile:Te.bool};function De(){S.track("gallery.cover.displayed"),Fe.send("gallerycoverdisplayed")}function Le(e){if(!e)return e;try{const t=new URL(e);return t.host.includes("assets.eko.com")&&t.pathname.startsWith("/image")&&!t.searchParams.has("width")?(t.pathname.endsWith(".png")&&(t.pathname=t.pathname.replace(/\.png$/,".webp")),t.searchParams.set("width",1920),t.toString()):e}catch(t){return e}}const Be=({item:t,src:n,srcset:i,sizes:r,isCoverElement:o})=>{const s=e.useRef(null);return e.useEffect((()=>{var e;if(o){if(null===(e=s.current)||void 0===e||!e.complete)return s.current.addEventListener("load",De,{once:!0}),()=>{var e;null===(e=s.current)||void 0===e||e.removeEventListener("load",De,{once:!0})};De()}}),[]),e.createElement("img",{ref:s,src:Le(n),srcSet:i,sizes:r,alt:t.name,fetchPriority:o?"high":"auto",loading:o?"eager":"lazy",style:{width:"100%",height:"100%"}})};Be.propTypes={item:Te.object.isRequired,src:Te.string,srcset:Te.string,sizes:Te.string,isCoverElement:Te.bool};const ze=Pe((e=>{var t;t=e,S.track("gallery.interaction",{elementid:"carousel",interactiontype:t}),Fe.send("interaction",{elementid:"carousel",interactiontype:t})}),200);function We(){ze("wheel")}const $e=e.forwardRef((({items:t,setActiveIndex:n,activeIndex:i,showSmartLoaders:r},o)=>{const s=e.useRef(null),a=e.useRef([]);a.current=null==t?void 0:t.map(((t,n)=>{var i,r;return null!==(i=null==a||null===(r=a.current)||void 0===r?void 0:r[n])&&void 0!==i?i:e.createRef()}));const[l,c]=e.useState(),[u,d]=e.useState(),h=e.useRef(i),f=e.useRef(!1);function p(){const e=function(e){const t=e.scrollLeft,n=e.scrollWidth-e.clientWidth;return 0===t?0:t>n?100:t/n*100}(s.current)*(null==t?void 0:t.length)/100,i=Math.min(Math.trunc(e),(null==t?void 0:t.length)-1),r=h.current;"nav"!==r.source&&"external-nav"!==r.source?(f.current&&i!==r.index&&(f.current=!1),f.current||(i>(null==t?void 0:t.length)-1?n({index:(null==t?void 0:t.length)-1,source:"carousel"}):n({index:i,source:"carousel"}))):i===r.index?f.current=!0:f.current&&i!==r.index&&(f.current=!1,n({index:i,source:"carousel"}))}return e.useImperativeHandle(o,(()=>({prev:()=>{n({index:Math.max(0,h.current.index-1),source:"carousel"})},next:()=>{n({index:Math.min((null==t?void 0:t.length)-1,h.current.index+1),source:"carousel"})}}))),e.useEffect((()=>{const e=s.current;if(e)return e.addEventListener("scroll",p),()=>{e.removeEventListener("scroll",p)}}),[t]),e.useEffect((()=>{var e;let t=null===(e=a.current)||void 0===e?void 0:e[i.index];if(t&&("nav"===i.source||"external-nav"===i.source)){const e=t.current,n=s.current.clientWidth/2,i=(null==e?void 0:e.clientWidth)/2,r=(null==e?void 0:e.offsetLeft)-n+i;s.current.scrollTo({left:r,behavior:"smooth"})}}),[i]),e.useEffect((()=>{h.current=i,"nav"!==i.source&&"external-nav"!==i.source||(f.current=!1)}),[i]),e.createElement("ul",{className:"eko-carousel",ref:s,onScroll:p,onWheel:We,onTouchMove:function(e){d(e.targetTouches[0].clientX)},onTouchStart:function(e){c(e.targetTouches[0].clientX),d(null)},onTouchEnd:function(){u&&l&&(l-u>75||l-u<-75)&&ze("swipe")}},null==t?void 0:t.map(((t,n)=>{const i=(null==t?void 0:t.cover)||(null==t?void 0:t.media),o=(null==i?void 0:i.url)||i;return e.createElement("li",{className:"eko-carousel-item",key:o+n,ref:a.current[n]},e.createElement(Be,{item:t,src:o,srcset:null==i?void 0:i.srcset,sizes:null==i?void 0:i.sizes,isCoverElement:0===n}),r&&"image"!==t.type&&e.createElement("div",{className:"eko-smart-loading"},e.createElement("div",null),e.createElement("p",null,"Loading video experience")))})))}));function je(e){var t;return function(e){var t;return"eko.block.event"===(null==e||null===(t=e.data)||void 0===t?void 0:t.type)}(e)&&"GalleryBlock"===(null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.blockType)}$e.propTypes={items:Te.array.isRequired,setActiveIndex:Te.func.isRequired,activeIndex:Te.object,showSmartLoaders:Te.bool},$e.displayName="CarouselLoop";const Ue="eko.project.invoke",qe="eko.block.invoke";function Ve(e,t,n){var i;null!=e&&e.contentWindow&&(null==e||null===(i=e.contentWindow)||void 0===i||i.postMessage({target:"eko.embedapi",type:t,data:n},"*"))}function Ge(e){return`#variantId=${encodeURIComponent(e)}`}const He=e.forwardRef((({config:t,instanceId:n,setActiveItem:i,activeItem:r,variantId:o,smartGalleryLoaded:s,onLoad:l,forceMobile:c},u)=>{var d,h,f;const p=null!==(d=null===(h=t.options)||void 0===h?void 0:h.galleryEnv)&&void 0!==d?d:"",m=null===(f=t.__autoGenerated)||void 0===f||null===(f=f.publishItem)||void 0===f?void 0:f.id,v=function(e={}){let t="";return Object.entries(e).forEach((([e,n])=>{t+=`&${e}=${n}`})),t}(null==t?void 0:t.qp),g=function(e,t,n){return`https://${e}play.eko.com/embed?${n?`id=${n}`:`piid=${t}`}&nocover=true&galleryBlockMode=gallery&eko_pixel=true`}(p,m,n),y=e.useRef(null),b=e.useRef(null),k=e.useRef(!1),[w,x]=e.useState(Ge(o||"ekonovar")),[_,T]=e.useState(g+v+w);let E;function I(){S.track("gallery.project.display"),l(),Fe.send("galleryloaded")}return e.useImperativeHandle(u,(()=>({prev:()=>{Ve(null==b?void 0:b.current,qe,{action:"onPrevModule"})},next:()=>{Ve(null==b?void 0:b.current,qe,{action:"onNextModule"})}}))),e.useEffect((()=>{k.current?Ve(null==b?void 0:b.current,Ue,{action:"updateVariant",args:{id:o}}):x(Ge(o))}),[o]),e.useEffect((()=>{Ve(null==b?void 0:b.current,qe,{action:"updateActiveModule",args:{activeItemIndex:null==r?void 0:r.index,activeModuleIndex:null==r?void 0:r.step}})}),[r]),e.useEffect((()=>{function e(e){if((function(e){var t;return"eko.project.blockstart"===(null==e||null===(t=e.data)||void 0===t?void 0:t.type)}(e)||function(e){var t,n;return"eko.project.started"===(null==e||null===(t=e.data)||void 0===t?void 0:t.type)&&(null==e||null===(n=e.data)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.started)}(e))&&!k.current)return t=e.data.data.blockType,k.current=!0,void("GalleryBlock"===t?Ve(null==b?void 0:b.current,qe,{action:"updateActiveModule",args:{activeItemIndex:null==r?void 0:r.index,activeModuleIndex:null==r?void 0:r.step}}):I());var t;if(k.current){if(function(e){var t;return je(e)&&"activeModuleChanged"===(null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.name)}(e))return void function(e){const t=e.data.data.data.activeItemIndex,n=e.data.data.data.activeModuleIndex;t===(null==r?void 0:r.index)&&n===(null==r?void 0:r.step)||i({index:t,step:n,source:"carousel"})}(e);(function(e){var t;return je(e)&&"activeModuleChangeDone"===(null==e||null===(t=e.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.name)})(e)&&!s&&I()}}return E=c||a()?"mobile":"desktop",function(e,t={}){window.addEventListener("message",e,t)}(e),()=>{!function(e,t={}){window.removeEventListener("message",e,t)}(e)}}),[r]),e.useEffect((()=>{k.current||Ve(null==b?void 0:b.current,Ue,{action:"queryProjectStarted"})}),[r,s]),e.useEffect((()=>{k.current=!1}),[t]),e.useEffect((()=>{T(g+v+w)}),[w]),e.createElement("div",{className:"eko-smart-gallery-container "+(s?"":"eko-project-not-ready"),ref:y,"data-type":"smart-gallery","data-qp":v,"data-variant":o,"data-device":E},e.createElement("iframe",{allow:"autoplay; fullscreen",title:"eko gallery",src:_,style:{border:0},ref:b}))}));He.propTypes={config:Te.object.isRequired,instanceId:Te.string,setActiveItem:Te.func.isRequired,activeItem:Te.object.isRequired,variantId:Te.string,smartGalleryLoaded:Te.bool,onLoad:Te.func,forceMobile:Te.bool},He.displayName="SmartGallery";const Ke=()=>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}'),Xe=({layout:t,style:n})=>{let i={};return function(e={}){Object.keys(e).forEach((t=>{i[`--${t}Eko`]=e[t]}))}(n),function(e){var t,n;const r=(null==e||null===(t=e.desktop)||void 0===t?void 0:t.config)||{},o=(null==e||null===(n=e.mobile)||void 0===n?void 0:n.config)||{};Object.keys(r).forEach((e=>{"string"==typeof r[e]&&(i[`--${e}EkoDesktop`]=r[e])})),Object.keys(o).forEach((e=>{"string"==typeof o[e]&&(i[`--${e}EkoMobile`]=o[e])}))}(t),e.createElement("style",{key:{layout:t,style:n}},`.eko-gallery {${Object.keys(i).map((e=>`${e}: ${i[e]};`)).join("\n")}}`)};Xe.propTypes={layout:Te.object,style:Te.object},u("experiment");const Ye=({activeVariantId:t,activeElementId:n,hasInteractive:i,experiments:r,publishItem:o})=>{const s="gallery",a=e.useRef(t),l=e.useRef(n),c=e.useRef(i),u=e.useRef(r),d=e.useRef(o);e.useEffect((()=>{a.current=t,l.current=n,c.current=i,u.current=r,d.current=o}),[t,n,i,r,o]);const h={publishItemPacker:{tag:s,schema:"iglu:com.helloeko/publishitem/jsonschema/1-0-0",match:/.*/,getData:function(){const e=d.current;if(e){const t={};return null!=e&&e.id&&(t.id=e.id),null!=e&&e.productId&&(t.productid=e.productId),e.salesChannelId&&(t.saleschannelid=e.salesChannelId),null!=e&&e.salesChannelName&&(t.saleschannelname=e.salesChannelName),e.salesChannelType&&(t.saleschanneltype=e.salesChannelType),t.id?t:void 0}}},galleryInteractionPacker:{tag:s,schema:"iglu:com.helloeko/gallery_interaction/jsonschema/1-0-0",match:"gallery.interaction",getData:function({elementid:e,interactiontype:t}){return{elementid:String(e),interactiontype:t}}},galleryPacker:{tag:s,schema:"iglu:com.helloeko/gallery/jsonschema/1-0-2",match:/^gallery.*/,getData:function(){var e;return{activeitemid:l.current.toString(),activevariantid:a.current,hasinteractive:c.current,version:(null===(e=window.eko)||void 0===e||null===(e=e.gallery)||void 0===e?void 0:e.version)||""}}},activeVariantIdPacker:{tag:s,schema:"iglu:com.helloeko/variant/jsonschema/1-0-1",match:/.*/,getData:function(){if(a.current)return{id:a.current}}},experimentPacker:{tag:s,schema:"iglu:com.helloeko/experiment/jsonschema/1-0-3",match:/.*/,getData:function(){var e;let t=function(e){let t=null;if(e){const n=Math.floor(Date.now()/1e3);for(const i of e){if("deliverable"!==i.type)return;const e=Math.floor(new Date(i.startDate).getTime()/1e3),r=Math.floor(new Date(i.endDate).getTime()/1e3);!0===i.active&&n>e&&n<r&&(t=i)}}return t}(u.current);if(!t)return;let n={experimentid:t.id||"",experimentvariant:t.chosen||"pending decision",experimenttype:t.type||""},i=null===(e=t.targetDevice)||void 0===e?void 0:e.toLowerCase();return"mobile"!==i&&"notmobile"!==i||(n.experimenttargeting={device:i}),n}}};return e.useEffect((()=>(Object.values(h).forEach((e=>{window.EkoAnalytics("registerContextPacker",e)})),()=>{window.EkoAnalytics("reset",s)})),[]),null};Ye.propTypes={activeVariantId:Te.string,activeElementId:Te.number,hasInteractive:Te.bool,experiments:Te.array,publishItem:Te.object};const Qe=({variantId:t,activeItem:n,hasInteractive:i,activeIndex:r,experiments:o,publishItem:s})=>{const a=e.useRef(!0);return e.useEffect((()=>{a.current||t&&S.track("gallery.variant.change")}),[t]),e.useEffect((()=>{a.current||S.track("gallery.element.change",{activeIndex:r})}),[r]),e.useEffect((()=>{a.current||n&&null!=s&&s.id&&S.track("gallery.asset.view",{publishitemid:s.id,type:n.type,name:n.name})}),[n]),e.useEffect((()=>{a.current=!1}),[]),e.createElement(Ye,{activeVariantId:t||"ekonovar",activeElementId:r,hasInteractive:i,experiments:o,publishItem:s})};Qe.propTypes={variantId:Te.string,activeItem:Te.object,hasInteractive:Te.bool,activeIndex:Te.number,experiments:Te.array,publishItem:Te.object};const Je="eko-gallery-react";function Ze(e,t){var n,i,r;const o=(null==e||null===(n=e.variantMap)||void 0===n?void 0:n[t])||"ekonovar";return(null==e||null===(i=e.items)||void 0===i?void 0:i.find((e=>(null==e?void 0:e.variantId)===o)))||(null==e||null===(r=e.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 et=e.forwardRef((({className:t,config:n,instanceId:i,variantId:r,activeItem:o={index:0,step:0},onEvent:s,forceMobile:a},l)=>{var c,u,d,h,f,p;const m=null!==(c=null===(u=n.options)||void 0===u?void 0:u.loadingTimeout)&&void 0!==c?c:12,v=null===(d=null===(h=n.options)||void 0===h?void 0:h.showCoverLoadAnimation)||void 0===d||d,[g,y]=e.useState(Ze(n,r)),[b,k]=e.useState({index:o.index,step:o.step,source:"external-nav"}),[w,x]=e.useState(!1),[_,T]=e.useState(!1),[E,I]=e.useState("eko-desktop"),A=e.useRef(!1),N=e.useRef(!1),M=e.useRef(o),F=e.useRef(null),C=e.useRef(r);function O(){const e=a||window.innerWidth<768?"eko-mobile":"eko-desktop";I(e)}return N.current||(Fe.send("galleryinit"),N.current=!0),e.useEffect((()=>{const e=C.current!==r;C.current=r,y(Ze(n,r)),e&&!A.current&&k({index:0,step:0,source:"external-nav"})}),[n,r]),e.useEffect((()=>{if(s)return Fe.subscribe(s),()=>{Fe.unsubscribe()}}),[s]),e.useEffect((()=>{A.current=_}),[_]),e.useEffect((()=>{x(!1),T(!1);const e=setTimeout((()=>{A.current||(x(!0),S.track("gallery.load.timeout"))}),1e3*m);return()=>{clearTimeout(e)}}),[n]),e.useEffect((()=>{O()}),[a]),e.useEffect((()=>(window.addEventListener("resize",O),O(),()=>{window.removeEventListener("resize",O)})),[a]),e.useEffect((()=>(window.EkoAnalytics("trackElementVisibility",F.current,Je),()=>{window.EkoAnalytics("stopTrackingElementVisibility",Je)})),[]),e.useEffect((()=>{!("carousel"===(null==b?void 0:b.source)||"nav"===(null==b?void 0:b.source))||(null==b?void 0:b.index)===o.index&&(null==b?void 0:b.step)===o.step||Fe.send("activeitemchanged",{index:null==b?void 0:b.index,step:null==b?void 0:b.step})}),[b,o]),e.useEffect((()=>{M.current.index===o.index&&M.current.step===o.step||(M.current=o,k({index:o.index,step:o.step,source:"external-nav"}))}),[o]),e.createElement(e.Fragment,null,e.createElement(Ke,null),e.createElement(Xe,{layout:n.layout,style:n.style,forceMobile:a}),e.createElement(Qe,{variantId:r,activeItem:null==g||null===(f=g.items)||void 0===f?void 0:f[b.index],activeIndex:b.index,hasInteractive:_,experiments:n.experiments,publishItem:null==n||null===(p=n.__autoGenerated)||void 0===p?void 0:p.publishItem}),e.createElement("section",{className:`${`eko-gallery eko-react-gallery ${function(e){let t="";return["mobile","desktop"].forEach((n=>{var i,r;const o=null!==(i=null==e||null===(r=e[n])||void 0===r?void 0:r.type)&&void 0!==i?i:"nav";if(t+=`eko-${n}-${o}-layout `,"nav"===o){var s;const i="desktop"===n,r=(null==e||null===(s=e[n])||void 0===s||null===(s=s.config)||void 0===s?void 0:s.orientation)||(i?"left":"bottom");t+=`eko-${n}-nav-${r} `}})),t}(n.layout)} ${null!=t?t:""}`.trim()} ${E}`,"aria-controls":"main-content",ref:F},e.createElement(Re,{items:(null==g?void 0:g.items)||[],setActiveIndex:k,activeIndex:b.index,layout:n.layout,carouselMounted:_,forceMobile:a}),!_&&e.createElement($e,{ref:l,items:(null==g?void 0:g.items)||[],setActiveIndex:k,activeIndex:{index:b.index,source:null==b?void 0:b.source},showSmartLoaders:!w&&v}),!w&&e.createElement(He,{ref:l,config:n,instanceId:i,activeItem:b,setActiveItem:k,variantId:null==g?void 0:g.variantId,smartGalleryLoaded:_,forceMobile:a,onLoad:function(){T(!0)}})))}));et.propTypes={className:Te.string,config:Te.object.isRequired,instanceId:Te.string,variantId:Te.string,activeItem:Te.object,onEvent:Te.func,forceMobile:Te.bool,onPrev:Te.func,onNext:Te.func},et.displayName="EkoGallery";var tt=e.memo(et);const nt=u("gallery-react");const it=e.forwardRef(((t,n)=>{var i;e.useEffect((()=>(nt.setDataStorage("gallery-react",{config:t.config}),window.eko=window.eko||{},window.eko.config=t.config,window.eko.gallery={version:"omer-upc-validation-workflow/4.0.10"},()=>{window.eko.config=void 0})),[t.config]);const{children:r,...o}=t;return void 0!==t.config?e.createElement(tt,R({ref:n},o,{key:null===(i=t.config.__autoGenerated)||void 0===i||null===(i=i.publishItem)||void 0===i?void 0:i.id})):r}));it.propTypes={className:Te.string,config:Te.object,variantId:Te.string,onEvent:Te.func,instanceId:Te.string,children:Te.node},it.displayName="EkoGalleryWrapper";var rt,ot,st,at,lt,ct,ut,dt,ht,ft,pt,mt,vt,gt,yt,bt,kt,wt,xt,_t,Tt,Et,It,St,At,Nt,Mt,Ft,Ct,Ot,Pt,Rt,Dt,Lt,Bt,zt,Wt,$t,jt,Ut,qt,Vt,Gt,Ht,Kt,Xt,Yt,Qt,Jt,Zt,en,tn=e.memo(it);const nn=1,rn=2,on=4,sn=8,an=16,ln=1,cn=4,un=8,dn=16,hn="[",fn="[!",pn="]",mn={},vn=Symbol(),gn=Symbol("filename"),yn="http://www.w3.org/1999/xhtml",bn="@attach",kn=!0;var wn=Array.isArray,xn=Array.prototype.indexOf,_n=Array.from,Tn=Object.defineProperty,En=Object.getOwnPropertyDescriptor,In=Object.getOwnPropertyDescriptors,Sn=Object.prototype,An=Array.prototype,Nn=Object.getPrototypeOf,Mn=Object.isExtensible;function Fn(){var e,t;return{promise:new Promise(((n,i)=>{e=n,t=i})),resolve:e,reject:t}}const Cn=2,On=4,Pn=8,Rn=1<<24,Dn=16,Ln=32,Bn=64,zn=128,Wn=512,$n=1024,jn=2048,Un=4096,qn=8192,Vn=16384,Gn=32768,Hn=65536,Kn=1<<17,Xn=1<<18,Yn=1<<19,Qn=1<<20,Jn=1<<25,Zn=32768,ei=1<<21,ti=1<<22,ni=1<<23,ii=Symbol("$state"),ri=Symbol("legacy props"),oi=Symbol(""),si=Symbol("proxy path"),ai=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},li=3,ci=8;function ui(e){{const t=new Error(`lifecycle_outside_component\n\`${e}(...)\` can only be used during component initialisation\nhttps://svelte.dev/e/lifecycle_outside_component`);throw t.name="Svelte error",t}}var di="font-weight: bold",hi="font-weight: normal";function fi(e){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",di,hi)}function pi(e){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 \`${e}\` will produce unexpected results\nhttps://svelte.dev/e/state_proxy_equality_mismatch`,di,hi)}let mi,vi=!1;function gi(e){vi=e}function yi(e){if(null===e)throw fi(),mn;return mi=e}function bi(){return yi(Po(mi))}function ki(e){if(vi){if(null!==Po(mi))throw fi(),mn;mi=e}}function wi(e=!0){for(var t=0,n=mi;;){if(n.nodeType===ci){var i=n.data;if(i===pn){if(0===t)return n;t-=1}else i!==hn&&i!==fn||(t+=1)}var r=Po(n);e&&n.remove(),n=r}}function xi(e){if(!e||e.nodeType!==ci)throw fi(),mn;return e.data}function _i(e){return e===this.v}function Ti(e){return t=e,n=this.v,!(t!=t?n==n:t!==n||null!==t&&"object"==typeof t||"function"==typeof t);var t,n}let Ei=!1;function Ii(e,t){return e.label=t,Si(e.v,t),e}function Si(e,t){var n;return null==e||null===(n=e[si])||void 0===n||n.call(e,t),e}function Ai(e){const t=new Error,n=function(){const e=Error.stackTraceLimit;Error.stackTraceLimit=1/0;const t=(new Error).stack;if(Error.stackTraceLimit=e,!t)return[];const n=t.split("\n"),i=[];for(let e=0;e<n.length;e++){const t=n[e],r=t.replaceAll("\\","/");if("Error"!==t.trim()){if(t.includes("validate_each_keys"))return[];r.includes("svelte/src/internal")||r.includes("node_modules/.vite")||i.push(t)}}return i}();return 0===n.length?null:(n.unshift("\n"),Tn(t,"stack",{value:n.join("\n")}),Tn(t,"name",{value:e}),t)}let Ni=null;function Mi(e){Ni=e}let Fi=null;function Ci(e){Fi=e}let Oi=null;function Pi(e){Oi=e}function Ri(e){return Bi("getContext").get(e)}function Di(e,t=!1,n){Ni={p:Ni,i:!1,c:null,e:null,s:e,x:null,l:null},Ni.function=n,Oi=n}function Li(e){var t,n,i=Ni,r=i.e;if(null!==r)for(var o of(i.e=null,r))Ho(o);return i.i=!0,Ni=i.p,Oi=null!==(t=null===(n=Ni)||void 0===n?void 0:n.function)&&void 0!==t?t:null,{}}function Bi(e){var t,n;return null===Ni&&ui(e),null!==(n=(t=Ni).c)&&void 0!==n?n:t.c=new Map(function(e){let t=e.p;for(;null!==t;){const e=t.c;if(null!==e)return e;t=t.p}return null}(Ni)||void 0)}let zi=[];function Wi(){var e=zi;zi=[],function(e){for(var t=0;t<e.length;t++)e[t]()}(e)}function $i(e){if(0===zi.length&&!rr){var t=zi;queueMicrotask((()=>{t===zi&&Wi()}))}zi.push(e)}function ji(){for(;zi.length>0;)Wi()}const Ui=new WeakMap;function qi(e){var t=vs;if(null===t)return fs.f|=ni,e;if(e instanceof Error&&!Ui.has(e)&&Ui.set(e,function(e,t){var n,i;const r=En(e,"message");if(r&&!r.configurable)return;var o=Ao?" ":"\t",s=`\n${o}in ${(null===(n=t.fn)||void 0===n?void 0:n.name)||"<unknown>"}`,a=t.ctx;for(;null!==a;){var l;s+=`\n${o}in ${null===(l=a.function)||void 0===l?void 0:l[gn].split("/").pop()}`,a=a.p}return{message:e.message+`\n${s}\n`,stack:null===(i=e.stack)||void 0===i?void 0:i.split("\n").filter((e=>!e.includes("svelte/src/internal"))).join("\n")}}(e,t)),t.f&Gn)Vi(e,t);else{if(!(t.f&zn))throw!t.parent&&e instanceof Error&&Gi(e),e;t.b.error(e)}}function Vi(e,t){for(;null!==t;){if(t.f&zn)try{return void t.b.error(e)}catch(t){e=t}t=t.parent}throw e instanceof Error&&Gi(e),e}function Gi(e){const t=Ui.get(e);t&&(Tn(e,"message",{value:t.message}),Tn(e,"stack",{value:t.stack}))}const Hi=-7169;function Ki(e,t){e.f=e.f&Hi|t}function Xi(e){e.f&Wn||null===e.deps?Ki(e,$n):Ki(e,Un)}function Yi(e){if(null!==e)for(const t of e)t.f&Cn&&t.f&Zn&&(t.f^=Zn,Yi(t.deps))}function Qi(e,t,n){e.f&jn?t.add(e):e.f&Un&&n.add(e),Yi(e.deps),Ki(e,$n)}const Ji=new Set;let Zi=null,er=null,tr=[],nr=null,ir=!1,rr=!1;var or=new WeakMap,sr=new WeakMap,ar=new WeakMap,lr=new WeakMap,cr=new WeakMap,ur=new WeakMap,dr=new WeakMap,hr=new WeakSet;class fr{constructor(){O(this,hr),P(this,"committed",!1),P(this,"current",new Map),P(this,"previous",new Map),F(this,or,new Set),F(this,sr,new Set),F(this,ar,0),F(this,lr,0),F(this,cr,null),F(this,ur,new Set),F(this,dr,new Set),P(this,"skipped_effects",new Set),P(this,"is_fork",!1)}is_deferred(){return this.is_fork||M(lr,this)>0}process(e){tr=[],this.apply();var t,n=[],i=[];for(const t of e)A(hr,this,pr).call(this,t,n,i);(this.is_fork||A(hr,this,vr).call(this),this.is_deferred())?(A(hr,this,mr).call(this,i),A(hr,this,mr).call(this,n)):(Zi=null,wr(i),wr(n),null===(t=M(cr,this))||void 0===t||t.resolve());er=null}capture(e,t){var n;(t===vn||this.previous.has(e)||this.previous.set(e,t),e.f&ni)||(this.current.set(e,e.v),null===(n=er)||void 0===n||n.set(e,e.v))}activate(){Zi=this,this.apply()}deactivate(){Zi===this&&(Zi=null,er=null)}flush(){if(this.activate(),tr.length>0){if(yr(),null!==Zi&&Zi!==this)return}else 0===M(ar,this)&&this.process([]);this.deactivate()}discard(){for(const e of M(sr,this))e(this);M(sr,this).clear()}increment(e){C(ar,this,M(ar,this)+1),e&&C(lr,this,M(lr,this)+1)}decrement(e){C(ar,this,M(ar,this)-1),e&&C(lr,this,M(lr,this)-1),this.revive()}revive(){for(const e of M(ur,this))M(dr,this).delete(e),Ki(e,jn),Tr(e);for(const e of M(dr,this))Ki(e,Un),Tr(e);this.flush()}oncommit(e){M(or,this).add(e)}ondiscard(e){M(sr,this).add(e)}settled(){var e;return(null!==(e=M(cr,this))&&void 0!==e?e:C(cr,this,Fn())).promise}static ensure(){if(null===Zi){const e=Zi=new fr;Ji.add(Zi),rr||fr.enqueue((()=>{Zi===e&&e.flush()}))}return Zi}static enqueue(e){$i(e)}apply(){}}function pr(e,t,n){e.f^=$n;for(var i=e.first,r=null;null!==i;){var o=i.f,s=!!(o&(Ln|Bn));if(!(s&&!!(o&$n)||!!(o&qn)||this.skipped_effects.has(i))&&null!==i.fn){s?i.f^=$n:null!==r&&o&(On|Pn|Rn)?r.b.defer_effect(i):o&On?t.push(i):As(i)&&(o&Dn&&M(ur,this).add(i),Os(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 mr(e){for(var t=0;t<e.length;t+=1)Qi(e[t],M(ur,this),M(dr,this))}function vr(){if(0===M(lr,this)){for(const e of M(or,this))e();M(or,this).clear()}0===M(ar,this)&&A(hr,this,gr).call(this)}function gr(){if(Ji.size>1){this.previous.clear();var e=er,t=!0;for(const e of Ji){if(e===this){t=!1;continue}const i=[];for(const[n,r]of this.current){if(e.current.has(n)){if(!t||r===e.current.get(n))continue;e.current.set(n,r)}i.push(n)}if(0===i.length)continue;const r=[...e.current.keys()].filter((e=>!this.current.has(e)));if(r.length>0){var n=tr;tr=[];const t=new Set,o=new Map;for(const e of i)xr(e,r,t,o);if(tr.length>0){Zi=e,e.apply();for(const t of tr)A(hr,e,pr).call(e,t,[],[]);e.deactivate()}tr=n}}Zi=null,er=e}this.committed=!0,Ji.delete(this)}function yr(){var e=cs;ir=!0;var t=new Set;try{var n=0;for(us(!0);tr.length>0;){var i=fr.ensure();if(n++>1e3){if(kn){var r=new Map;for(const e of i.current.keys())for(const[t,n]of null!==(o=e.updated)&&void 0!==o?o:[]){var o,s=r.get(t);s||(s={error:n.error,count:0},r.set(t,s)),s.count+=n.count}for(const e of r.values())e.error&&console.error(e.error)}br()}if(i.process(tr),co.clear(),kn)for(const e of i.current.keys())t.add(e)}}finally{ir=!1,us(e),nr=null;for(const e of t)e.updated=null}}function br(){try{!function(){{const e=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 e.name="Svelte error",e}}()}catch(e){Tn(e,"stack",{value:""}),Vi(e,nr)}}let kr=null;function wr(e){var t=e.length;if(0!==t){for(var n=0;n<t;){var i,r=e[n++];if(!(r.f&(Vn|qn))&&As(r))if(kr=new Set,Os(r),null===r.deps&&null===r.first&&null===r.nodes&&(null===r.teardown&&null===r.ac?is(r):r.fn=null),(null===(i=kr)||void 0===i?void 0:i.size)>0){co.clear();for(const e of kr){if(e.f&(Vn|qn))continue;const t=[e];let n=e.parent;for(;null!==n;)kr.has(n)&&(kr.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){const n=t[e];n.f&(Vn|qn)||Os(n)}}kr.clear()}}kr=null}}function xr(e,t,n,i){if(!n.has(e)&&(n.add(e),null!==e.reactions))for(const r of e.reactions){const e=r.f;e&Cn?xr(r,t,n,i):e&(ti|Dn)&&!(e&jn)&&_r(r,t,i)&&(Ki(r,jn),Tr(r))}}function _r(e,t,n){const i=n.get(e);if(void 0!==i)return i;if(null!==e.deps)for(const i of e.deps){if(t.includes(i))return!0;if(i.f&Cn&&_r(i,t,n))return n.set(i,!0),!0}return n.set(e,!1),!1}function Tr(e){for(var t=nr=e;null!==t.parent;){var n=(t=t.parent).f;if(ir&&t===vs&&n&Dn&&!(n&Xn))return;if(n&(Bn|Ln)){if(!(n&$n))return;t.f^=$n}}tr.push(t)}var Er=Hn|Yn|zn;var Ir=new WeakMap,Sr=new WeakMap,Ar=new WeakMap,Nr=new WeakMap,Mr=new WeakMap,Fr=new WeakMap,Cr=new WeakMap,Or=new WeakMap,Pr=new WeakMap,Rr=new WeakMap,Dr=new WeakMap,Lr=new WeakMap,Br=new WeakMap,zr=new WeakMap,Wr=new WeakMap,$r=new WeakMap,jr=new WeakMap,Ur=new WeakSet;class qr{constructor(e,t,n){O(this,Ur),P(this,"parent",void 0),P(this,"is_pending",!1),F(this,Ir,void 0),F(this,Sr,vi?mi:null),F(this,Ar,void 0),F(this,Nr,void 0),F(this,Mr,void 0),F(this,Fr,null),F(this,Cr,null),F(this,Or,null),F(this,Pr,null),F(this,Rr,null),F(this,Dr,0),F(this,Lr,0),F(this,Br,!1),F(this,zr,new Set),F(this,Wr,new Set),F(this,$r,null),F(this,jr,function(e){let t,n=0,i=fo(0);return Ii(i,"createSubscriber version"),()=>{qo()&&(Rs(i),Xo((()=>(0===n&&(t=Bs((()=>e((()=>bo(i)))))),n+=1,()=>{$i((()=>{var e;n-=1,0===n&&(null===(e=t)||void 0===e||e(),t=void 0,bo(i))}))}))))}}((()=>(C($r,this,fo(M(Dr,this))),Ii(M($r,this),"$effect.pending()"),()=>{C($r,this,null)})))),C(Ir,this,e),C(Ar,this,t),C(Nr,this,n),this.parent=vs.b,this.is_pending=!!M(Ar,this).pending,C(Mr,this,Qo((()=>{if(vs.b=this,vi){const e=M(Sr,this);bi();e.nodeType===ci&&e.data===fn?A(Ur,this,Gr).call(this):(A(Ur,this,Vr).call(this),0===M(Lr,this)&&(this.is_pending=!1))}else{var e=A(Ur,this,Hr).call(this);try{C(Fr,this,Zo((()=>n(e))))}catch(e){this.error(e)}M(Lr,this)>0?A(Ur,this,Xr).call(this):this.is_pending=!1}return()=>{var e;null===(e=M(Rr,this))||void 0===e||e.remove()}}),Er)),vi&&C(Ir,this,mi)}defer_effect(e){Qi(e,M(zr,this),M(Wr,this))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!M(Ar,this).pending}update_pending_count(e){A(Ur,this,Yr).call(this,e),C(Dr,this,M(Dr,this)+e),M($r,this)&&go(M($r,this),M(Dr,this))}get_effect_pending(){return M(jr,this).call(this),Rs(M($r,this))}error(e){var t=M(Ar,this).onerror;let n=M(Ar,this).failed;if(M(Br,this)||!t&&!n)throw e;M(Fr,this)&&(ns(M(Fr,this)),C(Fr,this,null)),M(Cr,this)&&(ns(M(Cr,this)),C(Cr,this,null)),M(Or,this)&&(ns(M(Or,this)),C(Or,this,null)),vi&&(yi(M(Sr,this)),function(e=1){if(vi){for(var t=e,n=mi;t--;)n=Po(n);mi=n}}(),yi(wi()));var i=!1,r=!1;const o=()=>{i?console.warn("%c[svelte] svelte_boundary_reset_noop\n%cA `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop",di,hi):(i=!0,r&&function(){{const e=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 e.name="Svelte error",e}}(),fr.ensure(),C(Dr,this,0),null!==M(Or,this)&&rs(M(Or,this),(()=>{C(Or,this,null)})),this.is_pending=this.has_pending_snippet(),C(Fr,this,A(Ur,this,Kr).call(this,(()=>(C(Br,this,!1),Zo((()=>M(Nr,this).call(this,M(Ir,this)))))))),M(Lr,this)>0?A(Ur,this,Xr).call(this):this.is_pending=!1)};var s=fs;try{ms(null),r=!0,null==t||t(e,o),r=!1}catch(e){Vi(e,M(Mr,this)&&M(Mr,this).parent)}finally{ms(s)}n&&$i((()=>{C(Or,this,A(Ur,this,Kr).call(this,(()=>{fr.ensure(),C(Br,this,!0);try{return Zo((()=>{n(M(Ir,this),(()=>e),(()=>o))}))}catch(e){return Vi(e,M(Mr,this).parent),null}finally{C(Br,this,!1)}})))}))}}function Vr(){try{C(Fr,this,Zo((()=>M(Nr,this).call(this,M(Ir,this)))))}catch(e){this.error(e)}}function Gr(){const e=M(Ar,this).pending;e&&(C(Cr,this,Zo((()=>e(M(Ir,this))))),fr.enqueue((()=>{var e=A(Ur,this,Hr).call(this);C(Fr,this,A(Ur,this,Kr).call(this,(()=>(fr.ensure(),Zo((()=>M(Nr,this).call(this,e))))))),M(Lr,this)>0?A(Ur,this,Xr).call(this):(rs(M(Cr,this),(()=>{C(Cr,this,null)})),this.is_pending=!1)})))}function Hr(){var e=M(Ir,this);return this.is_pending&&(C(Rr,this,Co()),M(Ir,this).before(M(Rr,this)),e=M(Rr,this)),e}function Kr(e){var t=vs,n=fs,i=Ni;gs(M(Mr,this)),ms(M(Mr,this)),Mi(M(Mr,this).ctx);try{return e()}catch(e){return qi(e),null}finally{gs(t),ms(n),Mi(i)}}function Xr(){const e=M(Ar,this).pending;null!==M(Fr,this)&&(C(Pr,this,document.createDocumentFragment()),M(Pr,this).append(M(Rr,this)),ls(M(Fr,this),M(Pr,this))),null===M(Cr,this)&&C(Cr,this,Zo((()=>e(M(Ir,this)))))}function Yr(e){var t;if(this.has_pending_snippet()){if(C(Lr,this,M(Lr,this)+e),0===M(Lr,this)){this.is_pending=!1;for(const e of M(zr,this))Ki(e,jn),Tr(e);for(const e of M(Wr,this))Ki(e,Un),Tr(e);M(zr,this).clear(),M(Wr,this).clear(),M(Cr,this)&&rs(M(Cr,this),(()=>{C(Cr,this,null)})),M(Pr,this)&&(M(Ir,this).before(M(Pr,this)),C(Pr,this,null))}}else this.parent&&A(Ur,t=this.parent,Yr).call(t,e)}function Qr(e,t,n,i){const r=eo;if(0!==n.length||0!==e.length){var o,s,a,l,c,u=Zi,d=vs,h=(o=vs,s=fs,a=Ni,l=Zi,c=Fi,function(e=!0){gs(o),ms(s),Mi(a),e&&(null==l||l.activate()),Ci(c)});e.length>0?Promise.all(e).then((()=>{h();try{return f()}finally{null==u||u.deactivate(),Jr()}})):f()}else i(t.map(r));function f(){Promise.all(n.map((e=>to(e)))).then((e=>{h();try{i([...t.map(r),...e])}catch(e){d.f&Vn||Vi(e,d)}null==u||u.deactivate(),Jr()})).catch((e=>{Vi(e,d)}))}}function Jr(){gs(null),ms(null),Mi(null),Ci(null)}const Zr=new Set;function eo(e){var t=Cn|jn,n=null!==fs&&fs.f&Cn?fs:null;null!==vs&&(vs.f|=Yn);return{ctx:Ni,deps:null,effects:null,equals:_i,f:t,fn:e,reactions:null,rv:0,v:vn,wv:0,parent:null!=n?n:vs,ac:null}}function to(e,t,n){let i=vs;null===i&&function(){{const e=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 e.name="Svelte error",e}}();var r=i.b,o=void 0,s=fo(vn);s.label=t;var a=!fs,l=new Map;return function(e){Uo(ti|Yn,e,!0)}((()=>{var t=Fn();o=t.promise;try{Promise.resolve(e()).then(t.resolve,t.reject).then((()=>{n===Zi&&n.committed&&n.deactivate(),Jr()}))}catch(e){t.reject(e),Jr()}var n=Zi;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(ai),l.delete(n),l.set(n,t)}const u=(e,t=void 0)=>{if(n.activate(),t)t!==ai&&(s.f|=ni,go(s,t));else{s.f&ni&&(s.f^=ni),go(s,e);for(const[e,t]of l){if(l.delete(e),e===n)break;t.reject(ai)}}a&&(r.update_pending_count(-1),n.decrement(c))};t.promise.then(u,(e=>u(null,e||"unknown")))})),Vo((()=>{for(const e of l.values())e.reject(ai)})),s.f|=ti,new Promise((e=>{!function t(n){function i(){n===o?e(s):t(o)}n.then(i,i)}(o)}))}function no(e){const t=eo(e);return bs(t),t}function io(e){const t=eo(e);return t.equals=Ti,t}function ro(e){var t=e.effects;if(null!==t){e.effects=null;for(var n=0;n<t.length;n+=1)ns(t[n])}}let oo=[];function so(e){var t,n=vs;gs(function(e){for(var t=e.parent;null!==t;){if(!(t.f&Cn))return t.f&Vn?null:t;t=t.parent}return null}(e));{let i=lo;uo(new Set);try{oo.includes(e)&&function(){{const e=new Error("derived_references_self\nA derived value cannot reference itself recursively\nhttps://svelte.dev/e/derived_references_self");throw e.name="Svelte error",e}}(),oo.push(e),e.f&=~Zn,ro(e),t=Ms(e)}finally{gs(n),uo(i),oo.pop()}}return t}function ao(e){var t,n,i=so(e);if(!e.equals(i)&&(e.wv=Ss(),(null===(t=Zi)||void 0===t||!t.is_fork||null===e.deps)&&(e.v=i,null===e.deps)))return void Ki(e,$n);ds||(null!==er?(qo()||null!==(n=Zi)&&void 0!==n&&n.is_fork)&&er.set(e,i):Xi(e))}let lo=new Set;const co=new Map;function uo(e){lo=e}let ho=!1;function fo(e,t){return{f:0,v:e,reactions:null,equals:_i,rv:0,wv:0}}function po(e,t){const n=fo(e);return bs(n),n}function mo(e,t=!1,n=!0){const i=fo(e);return t||(i.equals=Ti),i}function vo(e,t,n=!1){var i;null!==fs&&(!ps||fs.f&Kn)&&fs.f&(Cn|Dn|ti|Kn)&&(null===(i=ys)||void 0===i||!i.includes(e))&&function(){{const e=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 e.name="Svelte error",e}}();let r=n?xo(t):t;return Si(r,e.label),go(e,r)}function go(e,t){if(!e.equals(t)){var n=e.v;ds?co.set(e,t):co.set(e,n),e.v=t;var i=fr.ensure();if(i.capture(e,n),null!==vs){var r,o,s;null!==(r=e.updated)&&void 0!==r||(e.updated=new Map);const t=(null!==(o=null===(s=e.updated.get(""))||void 0===s?void 0:s.count)&&void 0!==o?o:0)+1;if(e.updated.set("",{error:null,count:t}),t>5){const t=Ai("updated at");if(null!==t){let n=e.updated.get(t.stack);n||(n={error:t,count:0},e.updated.set(t.stack,n)),n.count++}}}if(null!==vs&&(e.set_during_effect=!0),e.f&Cn){const t=e;e.f&jn&&so(t),Xi(t)}e.wv=Ss(),ko(e,jn),null!==vs&&vs.f&$n&&!(vs.f&(Ln|Bn))&&(null===xs?function(e){xs=e}([e]):xs.push(e)),!i.is_fork&&lo.size>0&&!ho&&yo()}return t}function yo(){ho=!1;var e=cs;us(!0);const t=Array.from(lo);try{for(const e of t)e.f&$n&&Ki(e,Un),As(e)&&Os(e)}finally{us(e)}lo.clear()}function bo(e){vo(e,e.v+1)}function ko(e,t){var n=e.reactions;if(null!==n)for(var i=n.length,r=0;r<i;r++){var o=n[r],s=o.f;if(s&Kn)lo.add(o);else{var a=!(s&jn);if(a&&Ki(o,t),s&Cn){var l,c=o;null===(l=er)||void 0===l||l.delete(c),s&Zn||(s&Wn&&(o.f|=Zn),ko(c,Un))}else a&&(s&Dn&&null!==kr&&kr.add(o),Tr(o))}}}const wo=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function xo(e){if("object"!=typeof e||null===e||ii in e)return e;const t=Nn(e);if(t!==Sn&&t!==An)return e;var n=new Map,i=wn(e),r=po(0),o=Es,s=e=>{if(Es===o)return e();var t=fs,n=Es;ms(null),Is(o);var i=e();return ms(t),Is(n),i};i&&(n.set("length",po(e.length)),e=new Proxy(e,{get(e,t,n){var i=Reflect.get(e,t,n);return Eo.has(t)?function(...e){ho=!0;var t=i.apply(this,e);return yo(),t}:i}}));var a="";let l=!1;function c(e){if(!l){l=!0,Ii(r,`${a=e} version`);for(const[e,t]of n)Ii(t,_o(a,e));l=!1}}return new Proxy(e,{defineProperty(e,t,i){"value"in i&&!1!==i.configurable&&!1!==i.enumerable&&!1!==i.writable||function(){{const e=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 e.name="Svelte error",e}}();var r=n.get(t);return void 0===r?r=s((()=>{var e=po(i.value);return n.set(t,e),"string"==typeof t&&Ii(e,_o(a,t)),e})):vo(r,i.value,!0),!0},deleteProperty(e,t){var i=n.get(t);if(void 0===i){if(t in e){const e=s((()=>po(vn)));n.set(t,e),bo(r),Ii(e,_o(a,t))}}else vo(i,vn),bo(r);return!0},get(t,i,r){var o;if(i===ii)return e;if(i===si)return c;var l=n.get(i),u=i in t;if(void 0===l&&(!u||null!==(o=En(t,i))&&void 0!==o&&o.writable)&&(l=s((()=>{var e=po(xo(u?t[i]:vn));return Ii(e,_o(a,i)),e})),n.set(i,l)),void 0!==l){var d=Rs(l);return d===vn?void 0:d}return Reflect.get(t,i,r)},getOwnPropertyDescriptor(e,t){var i=Reflect.getOwnPropertyDescriptor(e,t);if(i&&"value"in i){var r=n.get(t);r&&(i.value=Rs(r))}else if(void 0===i){var o=n.get(t),s=null==o?void 0:o.v;if(void 0!==o&&s!==vn)return{enumerable:!0,configurable:!0,value:s,writable:!0}}return i},has(e,t){var i;if(t===ii)return!0;var r=n.get(t),o=void 0!==r&&r.v!==vn||Reflect.has(e,t);if((void 0!==r||null!==vs&&(!o||null!==(i=En(e,t))&&void 0!==i&&i.writable))&&(void 0===r&&(r=s((()=>{var n=po(o?xo(e[t]):vn);return Ii(n,_o(a,t)),n})),n.set(t,r)),Rs(r)===vn))return!1;return o},set(e,t,o,l){var c,u=n.get(t),d=t in e;if(i&&"length"===t)for(var h=o;h<u.v;h+=1){var f=n.get(h+"");void 0!==f?vo(f,vn):h in e&&(f=s((()=>po(vn))),n.set(h+"",f),Ii(f,_o(a,h)))}void 0===u?(!d||null!==(c=En(e,t))&&void 0!==c&&c.writable)&&(Ii(u=s((()=>po(void 0))),_o(a,t)),vo(u,xo(o)),n.set(t,u)):(d=u.v!==vn,vo(u,s((()=>xo(o)))));var p=Reflect.getOwnPropertyDescriptor(e,t);if(null!=p&&p.set&&p.set.call(l,o),!d){if(i&&"string"==typeof t){var m=n.get("length"),v=Number(t);Number.isInteger(v)&&v>=m.v&&vo(m,v+1)}bo(r)}return!0},ownKeys(e){Rs(r);var t=Reflect.ownKeys(e).filter((e=>{var t=n.get(e);return void 0===t||t.v!==vn}));for(var[i,o]of n)o.v===vn||i in e||t.push(i);return t},setPrototypeOf(){!function(){{const e=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw e.name="Svelte error",e}}()}})}function _o(e,t){var n;return"symbol"==typeof t?`${e}[Symbol(${null!==(n=t.description)&&void 0!==n?n:""})]`:wo.test(t)?`${e}.${t}`:/^\d+$/.test(t)?`${e}[${t}]`:`${e}['${t}']`}function To(e){try{if(null!==e&&"object"==typeof e&&ii in e)return e[ii]}catch{}return e}const Eo=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function Io(e,t,n=!0){try{e===t!=(To(e)===To(t))&&pi(n?"===":"!==")}catch{}return e===t===n}var So,Ao,No,Mo;function Fo(){if(void 0===So){So=window,Ao=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;No=En(t,"firstChild").get,Mo=En(t,"nextSibling").get,Mn(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Mn(n)&&(n.__t=void 0),e.__svelte_meta=null,function(){const e=Array.prototype,t=Array.__svelte_cleanup;t&&t();const{indexOf:n,lastIndexOf:i,includes:r}=e;e.indexOf=function(e,t){const i=n.call(this,e,t);if(-1===i)for(let n=null!=t?t:0;n<this.length;n+=1)if(To(this[n])===e){pi("array.indexOf(...)");break}return i},e.lastIndexOf=function(e,t){const n=i.call(this,e,null!=t?t:this.length-1);if(-1===n)for(let n=0;n<=(null!=t?t:this.length-1);n+=1)if(To(this[n])===e){pi("array.lastIndexOf(...)");break}return n},e.includes=function(e,t){const n=r.call(this,e,t);if(!n)for(let t=0;t<this.length;t+=1)if(To(this[t])===e){pi("array.includes(...)");break}return n},Array.__svelte_cleanup=()=>{e.indexOf=n,e.lastIndexOf=i,e.includes=r}}()}}function Co(e=""){return document.createTextNode(e)}function Oo(e){return No.call(e)}function Po(e){return Mo.call(e)}function Ro(e,t){if(!vi)return Oo(e);var n=Oo(mi);if(null===n)n=mi.appendChild(Co());else if(t&&n.nodeType!==li){var i,r=Co();return null===(i=n)||void 0===i||i.before(r),yi(r),r}return yi(n),n}function Do(e,t=!1){var n;if(!vi){var i=Oo(e);return i instanceof Comment&&""===i.data?Po(i):i}if(t&&(null===(n=mi)||void 0===n?void 0:n.nodeType)!==li){var r,o=Co();return null===(r=mi)||void 0===r||r.before(o),yi(o),o}return mi}function Lo(e,t=1,n=!1){var i;let r=vi?mi:e;for(var o;t--;)o=r,r=Po(r);if(!vi)return r;if(n&&(null===(i=r)||void 0===i?void 0:i.nodeType)!==li){var s,a=Co();if(null===r)null===(s=o)||void 0===s||s.after(a);else r.before(a);return yi(a),a}return yi(r),r}function Bo(e){e.textContent=""}function zo(e,t){if(t){const t=document.body;e.autofocus=!0,$i((()=>{document.activeElement===t&&e.focus()}))}}let Wo=!1;function $o(e){var t=fs,n=vs;ms(null),gs(null);try{return e()}finally{ms(t),gs(n)}}function jo(e){null===vs&&(null===fs&&function(e){{const t=new Error(`effect_orphan\n\`${e}\` can only be used inside an effect (e.g. during component initialisation)\nhttps://svelte.dev/e/effect_orphan`);throw t.name="Svelte error",t}}(e),function(){{const e=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 e.name="Svelte error",e}}()),ds&&function(e){{const t=new Error(`effect_in_teardown\n\`${e}\` cannot be used inside an effect cleanup function\nhttps://svelte.dev/e/effect_in_teardown`);throw t.name="Svelte error",t}}(e)}function Uo(e,t,n){for(var i=vs;null!==i&&i.f&Kn;)i=i.parent;null!==i&&i.f&qn&&(e|=qn);var r={ctx:Ni,deps:null,nodes:null,f:e|jn|Wn,first:null,fn:t,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,wv:0,ac:null};if(r.component_function=Oi,n)try{Os(r),r.f|=Gn}catch(e){throw ns(r),e}else null!==t&&Tr(r);var o=r;if(!n||null!==o.deps||null!==o.teardown||null!==o.nodes||o.first!==o.last||o.f&Yn||(o=o.first,e&Dn&&e&Hn&&null!==o&&(o.f|=Hn)),null!==o&&(o.parent=i,null!==i&&function(e,t){var n=t.last;null===n?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}(o,i),null!==fs&&fs.f&Cn&&!(e&Bn))){var s,a=fs;(null!==(s=a.effects)&&void 0!==s?s:a.effects=[]).push(o)}return r}function qo(){return null!==fs&&!ps}function Vo(e){const t=Uo(Pn,null,!1);return Ki(t,$n),t.teardown=e,t}function Go(e){jo("$effect"),Tn(e,"name",{value:"$effect"});var t=vs.f;if(!!(fs||!(t&Ln)||t&Gn))return Ho(e);var n,i=Ni;(null!==(n=i.e)&&void 0!==n?n:i.e=[]).push(e)}function Ho(e){return Uo(On|Qn,e,!1)}function Ko(e){return Uo(On,e,!1)}function Xo(e,t=0){return Uo(Pn|t,e,!0)}function Yo(e,t=[],n=[],i=[]){Qr(i,t,n,(t=>{Uo(Pn,(()=>e(...t.map(Rs))),!0)}))}function Qo(e,t=0){var n=Uo(Dn|t,e,!0);return n.dev_stack=Fi,n}function Jo(e,t=0){var n=Uo(Rn|t,e,!0);return n.dev_stack=Fi,n}function Zo(e){return Uo(Ln|Yn,e,!0)}function es(e){var t=e.teardown;if(null!==t){const e=ds,n=fs;hs(!0),ms(null);try{t.call(null)}finally{hs(e),ms(n)}}}function ts(e,t=!1){var n=e.first;for(e.first=e.last=null;null!==n;){const e=n.ac;null!==e&&$o((()=>{e.abort(ai)}));var i=n.next;n.f&Bn?n.parent=null:ns(n,t),n=i}}function ns(e,t=!0){var n=!1;(t||e.f&Xn)&&null!==e.nodes&&null!==e.nodes.end&&(!function(e,t){for(;null!==e;){var n=e===t?null:Po(e);e.remove(),e=n}}(e.nodes.start,e.nodes.end),n=!0),ts(e,t&&!n),Cs(e,0),Ki(e,Vn);var i=e.nodes&&e.nodes.t;if(null!==i)for(const e of i)e.stop();es(e);var r=e.parent;null!==r&&null!==r.first&&is(e),e.component_function=null,e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function is(e){var t=e.parent,n=e.prev,i=e.next;null!==n&&(n.next=i),null!==i&&(i.prev=n),null!==t&&(t.first===e&&(t.first=i),t.last===e&&(t.last=n))}function rs(e,t,n=!0){var i=[];os(e,i,!0);var r=()=>{n&&ns(e),t&&t()},o=i.length;if(o>0){var s=()=>--o||r();for(var a of i)a.out(s)}else r()}function os(e,t,n){if(!(e.f&qn)){e.f^=qn;var i=e.nodes&&e.nodes.t;if(null!==i)for(const e of i)(e.is_global||n)&&t.push(e);for(var r=e.first;null!==r;){var o=r.next;os(r,t,!!(!!(r.f&Hn)||!!(r.f&Ln)&&!!(e.f&Dn))&&n),r=o}}}function ss(e){as(e,!0)}function as(e,t){if(e.f&qn){e.f^=qn,e.f&$n||(Ki(e,jn),Tr(e));for(var n=e.first;null!==n;){var i=n.next;as(n,!!(!!(n.f&Hn)||!!(n.f&Ln))&&t),n=i}var r=e.nodes&&e.nodes.t;if(null!==r)for(const e of r)(e.is_global||t)&&e.in()}}function ls(e,t){if(e.nodes)for(var n=e.nodes.start,i=e.nodes.end;null!==n;){var r=n===i?null:Po(n);t.append(n),n=r}}let cs=!1;function us(e){cs=e}let ds=!1;function hs(e){ds=e}let fs=null,ps=!1;function ms(e){fs=e}let vs=null;function gs(e){vs=e}let ys=null;function bs(e){null!==fs&&(null===ys?ys=[e]:ys.push(e))}let ks=null,ws=0,xs=null;let _s=1,Ts=0,Es=Ts;function Is(e){Es=e}function Ss(){return++_s}function As(e){var t=e.f;if(t&jn)return!0;if(t&Cn&&(e.f&=~Zn),t&Un){for(var n=e.deps,i=n.length,r=0;r<i;r++){var o=n[r];if(As(o)&&ao(o),o.wv>e.wv)return!0}t&Wn&&null===er&&Ki(e,$n)}return!1}function Ns(e,t,n=!0){var i,r=e.reactions;if(null!==r&&(null===(i=ys)||void 0===i||!i.includes(e)))for(var o=0;o<r.length;o++){var s=r[o];s.f&Cn?Ns(s,t,!1):t===s&&(n?Ki(s,jn):s.f&$n&&Ki(s,Un),Tr(s))}}function Ms(e){var t=ks,n=ws,i=xs,r=fs,o=ys,s=Ni,a=ps,l=Es,c=e.f;ks=null,ws=0,xs=null,fs=c&(Ln|Bn)?null:e,ys=null,Mi(e.ctx),ps=!1,Es=++Ts,null!==e.ac&&($o((()=>{e.ac.abort(ai)})),e.ac=null);try{e.f|=ei;var u=(0,e.fn)(),d=e.deps;if(null!==ks){var h;if(Cs(e,ws),null!==d&&ws>0)for(d.length=ws+ks.length,h=0;h<ks.length;h++)d[ws+h]=ks[h];else e.deps=d=ks;if(qo()&&e.f&Wn)for(h=ws;h<d.length;h++){var f,p;(null!==(p=(f=d[h]).reactions)&&void 0!==p?p:f.reactions=[]).push(e)}}else null!==d&&ws<d.length&&(Cs(e,ws),d.length=ws);if(!(null===xs||ps||null===d||e.f&(Cn|Un|jn)))for(h=0;h<xs.length;h++)Ns(xs[h],e);return null!==r&&r!==e&&(Ts++,null!==xs&&(null===i?i=xs:i.push(...xs))),e.f&ni&&(e.f^=ni),u}catch(e){return qi(e)}finally{e.f^=ei,ks=t,ws=n,xs=i,fs=r,ys=o,Mi(s),ps=a,Es=l}}function Fs(e,t){let n=t.reactions;if(null!==n){var i=xn.call(n,e);if(-1!==i){var r=n.length-1;0===r?n=t.reactions=null:(n[i]=n[r],n.pop())}}if(null===n&&t.f&Cn&&(null===ks||!ks.includes(t))){var o=t;o.f&Wn&&(o.f^=Wn,o.f&=~Zn),Xi(o),ro(o),Cs(o,0)}}function Cs(e,t){var n=e.deps;if(null!==n)for(var i=t;i<n.length;i++)Fs(e,n[i])}function Os(e){var t=e.f;if(!(t&Vn)){Ki(e,$n);var n=vs,i=cs;vs=e,cs=!0;var r,o=Oi;Pi(e.component_function);var s=Fi;Ci(null!==(r=e.dev_stack)&&void 0!==r?r:Fi);try{t&(Dn|Rn)?function(e){for(var t=e.first;null!==t;){var n=t.next;t.f&Ln||ns(t),t=n}}(e):ts(e),es(e);var a=Ms(e);e.teardown="function"==typeof a?a:null,e.wv=_s,kn&&Ei&&e.f&jn&&e.deps}finally{cs=i,vs=n,Pi(o),Ci(s)}}}async function Ps(){await Promise.resolve(),function(){var e=rr;rr=!0;try{for(;;){var t;if(ji(),0===tr.length&&(null===(t=Zi)||void 0===t||t.flush(),0===tr.length))return void(nr=null);yr()}}finally{rr=e}}()}function Rs(e){var t,n,i=!!(e.f&Cn);if(null!==fs&&!ps&&!(null!==vs&&!!(vs.f&Vn)||null!==(n=ys)&&void 0!==n&&n.includes(e))){var r=fs.deps;if(fs.f&ei)e.rv<Ts&&(e.rv=Ts,null===ks&&null!==r&&r[ws]===e?ws++:null===ks?ks=[e]:ks.includes(e)||ks.push(e));else{var o,s;(null!==(s=(o=fs).deps)&&void 0!==s?s:o.deps=[]).push(e);var a=e.reactions;null===a?e.reactions=[fs]:a.includes(fs)||a.push(fs)}}if(Zr.delete(e),ds&&co.has(e))return co.get(e);if(i){var l=e;if(ds){var c=l.v;return(l.f&$n||null===l.reactions)&&!Ls(l)||(c=so(l)),co.set(l,c),c}var u=!(l.f&Wn)&&!ps&&null!==fs&&(cs||!!(fs.f&Wn)),d=null===l.deps;As(l)&&(u&&(l.f|=Wn),ao(l)),u&&!d&&Ds(l)}if(null!==(t=er)&&void 0!==t&&t.has(e))return er.get(e);if(e.f&ni)throw e.v;return e.v}function Ds(e){if(null!==e.deps){e.f|=Wn;for(const n of e.deps){var t;(null!==(t=n.reactions)&&void 0!==t?t:n.reactions=[]).push(e),n.f&Cn&&!(n.f&Wn)&&Ds(n)}}}function Ls(e){if(e.v===vn)return!0;if(null===e.deps)return!1;for(const t of e.deps){if(co.has(t))return!0;if(t.f&Cn&&Ls(t))return!0}return!1}function Bs(e){var t=ps;try{return ps=!0,e()}finally{ps=t}}const zs=new Set,Ws=new Set;function $s(e,t,n,i={}){function r(e){if(i.capture||Vs.call(t,e),!e.cancelBubble)return $o((()=>null==n?void 0:n.call(this,e)))}return e.startsWith("pointer")||e.startsWith("touch")||"wheel"===e?$i((()=>{t.addEventListener(e,r,i)})):t.addEventListener(e,r,i),r}function js(e,t,n,i,r){var o={capture:i,passive:r},s=$s(e,t,n,o);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Vo((()=>{t.removeEventListener(e,s,o)}))}function Us(e){for(var t=0;t<e.length;t++)zs.add(e[t]);for(var n of Ws)n(e)}let qs=null;function Vs(e){var t,n=this,i=n.ownerDocument,r=e.type,o=(null===(t=e.composedPath)||void 0===t?void 0:t.call(e))||[],s=o[0]||e.target;qs=e;var a=0,l=qs===e&&e.__root;if(l){var c=o.indexOf(l);if(-1!==c&&(n===document||n===window))return void(e.__root=n);var u=o.indexOf(n);if(-1===u)return;c<=u&&(a=c)}if((s=o[a]||e.target)!==n){Tn(e,"currentTarget",{configurable:!0,get:()=>s||i});var d=fs,h=vs;ms(null),gs(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&&e.target!==s||v.call(s,e)}catch(e){f?p.push(e):f=e}if(e.cancelBubble||m===n||null===m)break;s=m}if(f){for(let e of p)queueMicrotask((()=>{throw e}));throw f}}finally{e.__root=n,delete e.currentTarget,ms(d),gs(h)}}}function Gs(e,t){var n=vs;null===n.nodes&&(n.nodes={start:e,end:t,a:null,t:null})}function Hs(e,t){var n,i=!!(1&t),r=!!(2&t),o=!e.startsWith("<!>");return()=>{if(vi)return Gs(mi,null),mi;var t,s;void 0===n&&(t=o?e:"<!>"+e,(s=document.createElement("template")).innerHTML=t.replaceAll("<!>","\x3c!----\x3e"),n=s.content,i||(n=Oo(n)));var a=r||Ao?document.importNode(n,!0):n.cloneNode(!0);i?Gs(Oo(a),a.lastChild):Gs(a,a);return a}}function Ks(){if(vi)return Gs(mi,null),mi;var e=document.createDocumentFragment(),t=document.createComment(""),n=Co();return e.append(t,n),Gs(t,n),e}function Xs(e,t){if(vi){var n=vs;return n.f&Gn&&null!==n.nodes.end||(n.nodes.end=mi),void bi()}null!==e&&e.before(t)}function Ys(e){return e.endsWith("capture")&&"gotpointercapture"!==e&&"lostpointercapture"!==e}const Qs=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function Js(e){return Qs.includes(e)}const Zs={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function ea(e){var t;return e=e.toLowerCase(),null!==(t=Zs[e])&&void 0!==t?t:e}const ta=["touchstart","touchmove"];function na(e,t){var n,i=null==t?"":"object"==typeof t?t+"":t;i!==(null!==(n=e.__t)&&void 0!==n?n:e.__t=e.nodeValue)&&(e.__t=i,e.nodeValue=i+"")}function ia(e,t){return sa(e,t)}function ra(e,t){var n;Fo(),t.intro=null!==(n=t.intro)&&void 0!==n&&n;const i=t.target,r=vi,o=mi;try{for(var s=Oo(i);s&&(s.nodeType!==ci||s.data!==hn);)s=Po(s);if(!s)throw mn;gi(!0),yi(s);const n=sa(e,{...t,anchor:s});return gi(!1),n}catch(n){if(n instanceof Error&&n.message.split("\n").some((e=>e.startsWith("https://svelte.dev/e/"))))throw n;return n!==mn&&console.warn("Failed to hydrate: ",n),!1===t.recover&&function(){{const e=new Error("hydration_failed\nFailed to hydrate the application\nhttps://svelte.dev/e/hydration_failed");throw e.name="Svelte error",e}}(),Fo(),Bo(i),gi(!1),ia(e,t)}finally{gi(r),yi(o)}}const oa=new Map;function sa(e,{target:t,anchor:n,props:i={},events:r,context:o,intro:s=!0}){Fo();var a=new Set,l=e=>{for(var n=0;n<e.length;n++){var i=e[n];if(!a.has(i)){a.add(i);var r=(s=i,ta.includes(s));t.addEventListener(i,Vs,{passive:r});var o=oa.get(i);void 0===o?(document.addEventListener(i,Vs,{passive:r}),oa.set(i,1)):oa.set(i,o+1)}}var s};l(_n(zs)),Ws.add(l);var c=void 0,u=function(e){fr.ensure();const t=Uo(Bn|Yn,e,!0);return(e={})=>new Promise((n=>{e.outro?rs(t,(()=>{ns(t),n(void 0)})):(ns(t),n(void 0))}))}((()=>{var s=null!=n?n:t.appendChild(Co());return function(e,t,n){new qr(e,t,n)}(s,{pending:()=>{}},(t=>{o&&(Di({}),Ni.c=o);if(r&&(i.$$events=r),vi&&Gs(t,null),c=e(t,i)||{},vi&&(vs.nodes.end=mi,null===mi||mi.nodeType!==ci||mi.data!==pn))throw fi(),mn;o&&Li()})),()=>{for(var e of a){t.removeEventListener(e,Vs);var i=oa.get(e);0==--i?(document.removeEventListener(e,Vs),oa.delete(e)):oa.set(e,i)}var r;(Ws.delete(l),s!==n)&&(null===(r=s.parentNode)||void 0===r||r.removeChild(s))}}));return aa.set(c,u),c}let aa=new WeakMap;function la(e,t){const n=aa.get(e);return n?(aa.delete(e),n(t)):(ii in e?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",di,hi):console.warn("%c[svelte] lifecycle_double_unmount\n%cTried to unmount a component that was not mounted\nhttps://svelte.dev/e/lifecycle_double_unmount",di,hi),Promise.resolve())}class ca{anchor;#e=new Map;#t=new Map;#n=new Map;#i=new Set;#r=!0;constructor(e,t=!0){this.anchor=e,this.#r=t}#o=()=>{var e=Zi;if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)ss(n),this.#i.delete(t);else{var i=this.#n.get(t);i&&(this.#t.set(t,i.effect),this.#n.delete(t),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),n=i.effect)}for(const[t,n]of this.#e){if(this.#e.delete(t),t===e)break;const i=this.#n.get(n);i&&(ns(i.effect),this.#n.delete(n))}for(const[e,i]of this.#t){if(e===t||this.#i.has(e))continue;const r=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();ls(i,t),t.append(Co()),this.#n.set(e,{effect:i,fragment:t})}else ns(i);this.#i.delete(e),this.#t.delete(e)};this.#r||!n?(this.#i.add(e),rs(i,r,!1)):r()}}};#s=e=>{this.#e.delete(e);const t=Array.from(this.#e.values());for(const[e,n]of this.#n)t.includes(e)||(ns(n.effect),this.#n.delete(e))};ensure(e,t){var n=Zi;!t||this.#t.has(e)||this.#n.has(e)||this.#t.set(e,Zo((()=>t(this.anchor)))),this.#e.set(n,e),vi&&(this.anchor=mi),this.#o()}}{let e=function(e){if(!(e in globalThis)){let t;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(void 0!==t)return t;!function(e){{const t=new Error(`rune_outside_svelte\nThe \`${e}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files\nhttps://svelte.dev/e/rune_outside_svelte`);throw t.name="Svelte error",t}}(e)},set:e=>{t=e}})}};e("$state"),e("$effect"),e("$derived"),e("$inspect"),e("$props"),e("$bindable")}var ua,da=new Map;function ha(e,t,n=!1){vi&&bi();var i=new ca(e);function r(t,n){if(vi){if(t===(xi(e)===fn)){var r=wi();return yi(r),i.anchor=r,gi(!1),i.ensure(t,n),void gi(!0)}}i.ensure(t,n)}Qo((()=>{var e=!1;t(((t,n=!0)=>{e=!0,r(n,t)})),e||r(!1,null)}),n?Hn:0)}function fa(e,t){return t}function pa(e,t=!0){for(var n=0;n<e.length;n++)ns(e[n],t)}function ma(e,t,n,i,r,o=null){var s=e,a=new Map;if(!!(t&on)){var l=e;s=vi?yi(Oo(l)):l.appendChild(Co())}vi&&bi();var c,u=null,d=io((()=>{var e=n();return wn(e)?e:null==e?[]:_n(e)})),h=!0;function f(){m.fallback=u,function(e,t,n,i,r){var o,s,a,l,c,u=!!(i&sn),d=t.length,h=e.items,f=e.effect.first,p=null,m=[],v=[];if(u)for(c=0;c<d;c+=1){var g,y;if(a=r(t[c],c),!((l=h.get(a).e).f&Jn))null===(g=l.nodes)||void 0===g||null===(g=g.a)||void 0===g||g.measure(),(null!==(y=s)&&void 0!==y?y:s=new Set).add(l)}for(c=0;c<d;c+=1){if(a=r(t[c],c),l=h.get(a).e,null!==e.outrogroups)for(const t of e.outrogroups)t.pending.delete(l),t.done.delete(l);if(l.f&Jn){if(l.f^=Jn,l!==f){var b=p?p.next:f;l===e.effect.last&&(e.effect.last=l.prev),l.prev&&(l.prev.next=l.next),l.next&&(l.next.prev=l.prev),ya(e,p,l),ya(e,l,b),ga(l,b,n),m=[],v=[],f=(p=l).next;continue}ga(l,null,n)}var k,w;if(l.f&qn)if(ss(l),u)null===(k=l.nodes)||void 0===k||null===(k=k.a)||void 0===k||k.unfix(),(null!==(w=s)&&void 0!==w?w:s=new Set).delete(l);if(l!==f){if(void 0!==o&&o.has(l)){if(m.length<v.length){var x,_=v[0];p=_.prev;var T=m[0],E=m[m.length-1];for(x=0;x<m.length;x+=1)ga(m[x],_,n);for(x=0;x<v.length;x+=1)o.delete(v[x]);ya(e,T.prev,E.next),ya(e,p,T),ya(e,E,_),f=_,p=E,c-=1,m=[],v=[]}else o.delete(l),ga(l,f,n),ya(e,l.prev,l.next),ya(e,l,null===p?e.effect.first:p.next),ya(e,p,l),p=l;continue}for(m=[],v=[];null!==f&&f!==l;){var I;(null!==(I=o)&&void 0!==I?I:o=new Set).add(f),v.push(f),f=f.next}if(null===f)continue}l.f&Jn||m.push(l),p=l,f=l.next}if(null!==e.outrogroups){for(const t of e.outrogroups){var S;if(0===t.pending.size)pa(_n(t.done)),null===(S=e.outrogroups)||void 0===S||S.delete(t)}0===e.outrogroups.size&&(e.outrogroups=null)}if(null!==f||void 0!==o){var A=[];if(void 0!==o)for(l of o)l.f&qn||A.push(l);for(;null!==f;)f.f&qn||f===e.fallback||A.push(f),f=f.next;var N=A.length;if(N>0){var M=i&on&&0===d?n:null;if(u){for(c=0;c<N;c+=1){var F;null===(F=A[c].nodes)||void 0===F||null===(F=F.a)||void 0===F||F.measure()}for(c=0;c<N;c+=1){var C;null===(C=A[c].nodes)||void 0===C||null===(C=C.a)||void 0===C||C.fix()}}!function(e,t,n){for(var i,r=t.length,o=t.length,s=0;s<r;s++){let n=t[s];rs(n,(()=>{if(i){if(i.pending.delete(n),i.done.add(n),0===i.pending.size){var t=e.outrogroups;pa(_n(i.done)),t.delete(i),0===t.size&&(e.outrogroups=null)}}else o-=1}),!1)}if(0===o){var a=null!==n;if(a){var l=n,c=l.parentNode;Bo(c),c.append(l),e.items.clear()}pa(t,!a)}else{var u;i={pending:new Set(t),done:new Set},(null!==(u=e.outrogroups)&&void 0!==u?u:e.outrogroups=new Set).add(i)}}(e,A,M)}}u&&$i((()=>{if(void 0!==s)for(l of s){var e;null===(e=l.nodes)||void 0===e||null===(e=e.a)||void 0===e||e.apply()}}))}(m,c,s,t,i),null!==u&&(0===c.length?u.f&Jn?(u.f^=Jn,ga(u,null,s)):ss(u):rs(u,(()=>{u=null})))}var p=Qo((()=>{var e=(c=Rs(d)).length;let l=!1;vi&&(xi(s)===fn!==(0===e)&&(yi(s=wi()),gi(!1),l=!0));for(var p=new Set,m=0;m<e;m+=1){vi&&mi.nodeType===ci&&mi.data===pn&&(s=mi,l=!0,gi(!1));var v,g=c[m],y=i(g,m),b=h?null:a.get(y);if(b)b.v&&go(b.v,g),b.i&&go(b.i,m);else b=va(a,h?s:null!==(v=ua)&&void 0!==v?v:ua=Co(),g,y,m,r,t,n),h||(b.e.f|=Jn),a.set(y,b);p.add(y)}0===e&&o&&!u&&(h?u=Zo((()=>o(s))):(u=Zo((()=>{var e;return o(null!==(e=ua)&&void 0!==e?e:ua=Co())}))).f|=Jn),vi&&e>0&&yi(wi()),h||f(),l&&gi(!0),Rs(d)})),m={effect:p,items:a,outrogroups:null,fallback:u};h=!1,vi&&(s=mi)}function va(e,t,n,i,r,o,s,a){var l=s&nn?s&an?fo(n):mo(n,!1,!1):null,c=s&rn?fo(r):null;return l&&(l.trace=()=>{var e;a()[null!==(e=null==c?void 0:c.v)&&void 0!==e?e:r]}),{v:l,i:c,e:Zo((()=>(o(t,null!=l?l:n,null!=c?c:r,a),()=>{e.delete(i)})))}}function ga(e,t,n){if(e.nodes)for(var i=e.nodes.start,r=e.nodes.end,o=!t||t.f&Jn?n:t.nodes.start;null!==i;){var s=Po(i);if(o.before(i),i===r)return;i=s}}function ya(e,t,n){null===t?e.effect.first=n:t.next=n,null===n?e.effect.last=t:n.prev=t}function ba(e,t){Ko((()=>{var n,i=e.getRootNode(),r=i.host?i:null!==(n=i.head)&&void 0!==n?n:i.ownerDocument.head;if(!r.querySelector("#"+t.hash)){const e=document.createElement("style");e.id=t.hash,e.textContent=t.code,r.appendChild(e),function(e,t){var n=da.get(e);n||(n=new Set,da.set(e,n)),n.add(t)}(t.hash,e)}}))}function ka(e,t){var n,i=void 0;Jo((()=>{i!==(i=t())&&(n&&(ns(n),n=null),i&&(n=Zo((()=>{Ko((()=>i(e)))}))))}))}function wa(e){var t,n,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=wa(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function xa(e){return"object"==typeof e?function(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=wa(e))&&(i&&(i+=" "),i+=t);return i}(e):null!=e?e:""}const _a=[..." \t\n\r\f \v\ufeff"];function Ta(e,t=!1){var n=t?" !important;":";",i="";for(var r in e){var o=e[r];null!=o&&""!==o&&(i+=" "+r+": "+o+n)}return i}function Ea(e){return"-"!==e[0]||"-"!==e[1]?e.toLowerCase():e}function Ia(e,t,n,i,r,o){var s=e.__className;if(vi||s!==n||void 0===s){var a=function(e,t,n){var i=null==e?"":""+e;if(t&&(i=i?i+" "+t:t),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&&!_a.includes(i[s-1])||a!==i.length&&!_a.includes(i[a])?s=a:i=(0===s?"":i.substring(0,s))+i.substring(a+1)}return""===i?null:i}(n,i,o);vi&&a===e.getAttribute("class")||(null==a?e.removeAttribute("class"):t?e.className=a:e.setAttribute("class",a)),e.__className=n}else if(o&&r!==o)for(var l in o){var c=!!o[l];null!=r&&c===!!r[l]||e.classList.toggle(l,c)}return o}function Sa(e,t={},n,i){for(var r in n){var o=n[r];t[r]!==o&&(null==n[r]?e.style.removeProperty(r):e.style.setProperty(r,o,i))}}function Aa(e,t,n,i){var r=e.__style;if(vi||r!==t){var o=function(e,t){if(t){var n,i,r="";if(Array.isArray(t)?(n=t[0],i=t[1]):n=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var o=!1,s=0,a=!1,l=[];n&&l.push(...Object.keys(n).map(Ea)),i&&l.push(...Object.keys(i).map(Ea));var c=0,u=-1;const t=e.length;for(var d=0;d<t;d++){var h=e[d];if(a?"/"===h&&"*"===e[d-1]&&(a=!1):o?o===h&&(o=!1):"/"===h&&"*"===e[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===t-1){if(-1!==u){var f=Ea(e.substring(c,u).trim());l.includes(f)||(";"!==h&&d++,r+=" "+e.substring(c,d).trim()+";")}c=d+1,u=-1}}}return n&&(r+=Ta(n)),i&&(r+=Ta(i,!0)),""===(r=r.trim())?null:r}return null==e?null:String(e)}(t,i);vi&&o===e.getAttribute("style")||(null==o?e.removeAttribute("style"):e.style.cssText=o),e.__style=t}else i&&(Array.isArray(i)?(Sa(e,null==n?void 0:n[0],i[0]),Sa(e,null==n?void 0:n[1],i[1],"important")):Sa(e,n,i));return i}function Na(e,t,n=!1){if(e.multiple){if(null==t)return;if(!wn(t))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",di,hi);for(var i of e.options)i.selected=t.includes(Ma(i))}else{for(i of e.options){var r=Ma(i);if(o=r,s=t,Object.is(To(o),To(s)))return void(i.selected=!0)}var o,s;n&&void 0===t||(e.selectedIndex=-1)}}function Ma(e){return"__value"in e?e.__value:e.value}const Fa=Symbol("class"),Ca=Symbol("style"),Oa=Symbol("is custom element"),Pa=Symbol("is html");function Ra(e){if(vi){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute("value")){var n=e.value;La(e,"value",null),e.value=n}if(e.hasAttribute("checked")){var i=e.checked;La(e,"checked",null),e.checked=i}}};e.__on_r=n,$i(n),Wo||(Wo=!0,document.addEventListener("reset",(e=>{Promise.resolve().then((()=>{if(!e.defaultPrevented)for(const n of e.target.elements){var t;null===(t=n.__on_r)||void 0===t||t.call(n)}}))}),{capture:!0}))}}function Da(e,t){t?e.hasAttribute("selected")||e.setAttribute("selected",""):e.removeAttribute("selected")}function La(e,t,n,i){var r=za(e);vi&&(r[t]=e.getAttribute(t),"src"===t||"srcset"===t||"href"===t&&"LINK"===e.nodeName)?i||function(e,t,n){var i;if("srcset"===t&&function(e,t){var n=Ua(e.srcset),i=Ua(t);return i.length===n.length&&i.every((([e,t],i)=>t===n[i][1]&&(ja(n[i][0],e)||ja(e,n[i][0]))))}(e,n))return;if(ja(null!==(i=e.getAttribute(t))&&void 0!==i?i:"",n))return;!function(e,t,n){console.warn(`%c[svelte] hydration_attribute_changed\n%cThe \`${e}\` attribute on \`${t}\` 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`,di,hi)}(t,e.outerHTML.replace(e.innerHTML,e.innerHTML&&"..."),String(n))}(e,t,null!=n?n:""):r[t]!==(r[t]=n)&&("loading"===t&&(e[oi]=n),null==n?e.removeAttribute(t):"string"!=typeof n&&$a(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function Ba(e,t,n=[],i=[],r=[],o,s=!1,a=!1){Qr(r,n,i,(n=>{var i=void 0,r={},l="SELECT"===e.nodeName,c=!1;if(Jo((()=>{var u=t(...n.map(Rs)),d=function(e,t,n,i,r=!1,o=!1){if(vi&&r&&"INPUT"===e.tagName){var s=e;("checkbox"===s.type?"defaultChecked":"defaultValue")in n||Ra(s)}var a=za(e),l=a[Oa],c=!a[Pa];let u=vi&&l;u&&gi(!1);var d,h=t||{},f="OPTION"===e.tagName;for(var p in t)p in n||(n[p]=null);n.class?n.class=xa(n.class):n.class=null,n[Ca]&&(null!==(d=n.style)&&void 0!==d||(n.style=null));var m=$a(e);for(const r in n){let s=n[r];if(f&&"value"===r&&null==s)e.value=e.__value="",h[r]=s;else if("class"!==r)if("style"!==r){var v=h[r];if(s!==v||void 0===s&&e.hasAttribute(r)){h[r]=s;var g=r[0]+r[1];if("$$"!==g)if("on"===g){const t={},n="$$"+r;let i=r.slice(2);var y=Js(i);if(Ys(i)&&(i=i.slice(0,-7),t.capture=!0),!y&&v){if(null!=s)continue;e.removeEventListener(i,h[n],t),h[n]=null}if(null!=s)if(y)e[`__${i}`]=s,Us([i]);else{let o=function(e){h[r].call(this,e)};h[n]=$s(i,e,o,t)}else y&&(e[`__${i}`]=void 0)}else if("style"===r)La(e,r,s);else if("autofocus"===r)zo(e,Boolean(s));else if(l||"__value"!==r&&("value"!==r||null==s))if("selected"===r&&f)Da(e,s);else{var b=r;c||(b=ea(b));var k="defaultValue"===b||"defaultChecked"===b;if(null!=s||l||k)k||m.includes(b)&&(l||"string"!=typeof s)?(e[b]=s,b in a&&(a[b]=vn)):"function"!=typeof s&&La(e,b,s,o);else if(a[r]=null,"value"===b||"checked"===b){let n=e;const i=void 0===t;if("value"===b){let e=n.defaultValue;n.removeAttribute(b),n.defaultValue=e,n.value=n.__value=i?e:null}else{let e=n.defaultChecked;n.removeAttribute(b),n.defaultChecked=e,n.checked=!!i&&e}}else e.removeAttribute(r)}else e.value=e.__value=s}}else Aa(e,s,null==t?void 0:t[Ca],n[Ca]),h[r]=s,h[Ca]=n[Ca];else Ia(e,"http://www.w3.org/1999/xhtml"===e.namespaceURI,s,i,null==t?void 0:t[Fa],n[Fa]),h[r]=s,h[Fa]=n[Fa]}return u&&gi(!0),h}(e,i,u,o,s,a);c&&l&&"value"in u&&Na(e,u.value);for(let e of Object.getOwnPropertySymbols(r))u[e]||ns(r[e]);for(let t of Object.getOwnPropertySymbols(u)){var h=u[t];t.description!==bn||i&&h===i[t]||(r[t]&&ns(r[t]),r[t]=Zo((()=>ka(e,(()=>h))))),d[t]=h}i=d})),l){var u=e;Ko((()=>{Na(u,i.value,!0),function(e){var t=new MutationObserver((()=>{Na(e,e.__value)}));t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Vo((()=>{t.disconnect()}))}(u)}))}c=!0}))}function za(e){var t;return null!==(t=e.__attributes)&&void 0!==t?t:e.__attributes={[Oa]:e.nodeName.includes("-"),[Pa]:e.namespaceURI===yn}}var Wa=new Map;function $a(e){var t,n=e.getAttribute("is")||e.nodeName,i=Wa.get(n);if(i)return i;Wa.set(n,i=[]);for(var r=e,o=Element.prototype;o!==r;){for(var s in t=In(r))t[s].set&&i.push(s);r=Nn(r)}return i}function ja(e,t){return e===t||new URL(e,document.baseURI).href===new URL(t,document.baseURI).href}function Ua(e){return e.split(",").map((e=>e.trim().split(" ").filter(Boolean)))}function qa(e,t){return e===t||(null==e?void 0:e[ii])===t}function Va(e={},t,n,i){return Ko((()=>{var i,r;return Xo((()=>{i=r,r=[],Bs((()=>{e!==n(...r)&&(t(e,...r),i&&qa(n(...i),e)&&t(null,...i))}))})),()=>{$i((()=>{r&&qa(n(...r),e)&&t(null,...r)}))}})),e}let Ga=!1;function Ha(e,t,n,i){var r,o,s=!!(n&un),a=!!(n&dn),l=i,c=!0,u=()=>(c&&(c=!1,l=a?Bs(i):i),l);if(s){var d,h,f=ii in e||ri in e;r=null!==(d=null===(h=En(e,t))||void 0===h?void 0:h.set)&&void 0!==d?d:f&&t in e?n=>e[t]=n:void 0}var p,m=!1;if(s?[o,m]=function(e){var t=Ga;try{return Ga=!1,[e(),Ga]}finally{Ga=t}}((()=>e[t])):o=e[t],void 0===o&&void 0!==i&&(o=u(),r&&(!function(e){{const t=new Error(`props_invalid_value\nCannot do \`bind:${e}={undefined}\` when \`${e}\` has a fallback value\nhttps://svelte.dev/e/props_invalid_value`);throw t.name="Svelte error",t}}(t),r(o))),p=()=>{var n=e[t];return void 0===n?u():(c=!0,n)},!(n&cn))return p;if(r){var v=e.$$legacy;return function(e,t){return arguments.length>0?((!t||v||m)&&r(t?p():e),e):p()}}var g=!1,y=(n&ln?eo:io)((()=>(g=!1,p())));y.label=t,s&&Rs(y);var b=vs;return function(e,t){if(arguments.length>0){const n=t?Rs(y):s?xo(e):e;return vo(y,n),g=!0,void 0!==l&&(l=n),e}return ds&&g||b.f&Vn?y.v:Rs(y)}}var Ka,Xa,Ya,Qa;"undefined"!=typeof window&&(null!==(Xa=(Ka=null!==(Qa=(Ya=window).__svelte)&&void 0!==Qa?Qa:Ya.__svelte={}).v)&&void 0!==Xa?Xa:Ka.v=new Set).add("5");function Ja(e,{include:t,exclude:n}={}){const i=e=>{const i=t=>"string"==typeof t?e===t:t.test(e);return t?t.some(i):!n||!n.some(i)};for(const[t,n]of(e=>{const t=new Set;do{for(const n of Reflect.ownKeys(e))t.add([e,n])}while((e=Reflect.getPrototypeOf(e))&&e!==Object.prototype);return t})(e.constructor.prototype)){if("constructor"===n||!i(n))continue;const r=Reflect.getOwnPropertyDescriptor(t,n);r&&"function"==typeof r.value&&(e[n]=e[n].bind(e))}return e}function Za(e,t){e.getNodesAtTime(0)[0].once("nodestart",t)}class el{constructor({position:e,gallery:t,config:n}){this.config=n,this.position=e,this.gallery=t,this.name=n.name;const{variantId:i,itemIndex:r,moduleIndex:o}=e;this.id=`${n.itemType}_${i}_${r}_${o}`,Ja(this)}#a=Ii(po(xo({})),"BaseModule.#state");#l=Ii(po(null),"BaseModule.#cover");#c=Ii(po(!1),"BaseModule.#showCover");#u=Ii(po(null),"BaseModule.#Component");id;player;position;config;timeline;moduleEndListener;hasDuration=!1;coverAssets=[];get state(){return Rs(this.#a)}set state(e){vo(this.#a,e,!0)}get cover(){return Rs(this.#l)}set cover(e){vo(this.#l,e)}get showCover(){return Rs(this.#c)}set showCover(e){vo(this.#c,e,!0)}get Component(){return Rs(this.#u)}set Component(e){vo(this.#u,e)}emitModuleEnd(){var e;null===(e=this.moduleEndListener)||void 0===e||e.call(this)}start(e){this.player=e}setPosition(){this.gallery.state.playingModulePosition=this.position}play(){this.gallery.track("moduleview"),Za(this.timeline,(()=>{this.setPosition()})),this.player.switchTimeline(this.timeline)}get duration(){return this.hasDuration?this.timeline.placements.reduce(((e,t)=>e+this.player.getNode(t.nodeId).duration),0):0}}function tl(e,t,n){var i,r,o;const s=(null==t||null===(i=t.entity)||void 0===i?void 0:i.entityId)||(null==t?void 0:t.assetId),a=null!==(r=null==t||null===(o=t.entity)||void 0===o?void 0:o.entityRevision)&&void 0!==r?r:null==t?void 0:t.assetRevision;return n.addNode({id:e,manifestRef:{type:"assets-delivery-service",assetId:s,assetRevision:a,availableEncodeProfiles:t.availableEncodeProfiles}})}var nl=Hs('<h3 class="text-box-title svelte-wejicf"> </h3>'),il=Hs('<span class="text-box-title svelte-wejicf"> </span>'),rl=Hs('<span class="text-box-description minimized-description svelte-wejicf"> </span>'),ol=Hs('<span class="read-more-cta svelte-wejicf" aria-hidden="true">Read more</span>'),sl=Hs('<button class="expand-description-button svelte-wejicf" aria-expanded="false" aria-controls="expanded-text-content" aria-label="Expand feature description"><!> <!></button>'),al=Hs('<button aria-expanded="true" aria-label="Collapse feature description" data-elementid="textbox-expand" data-elementtype="textbox" data-elementname="Read less" data-interactiontype="module-ui" class="svelte-wejicf">Read less</button>'),ll=Hs('<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 cl={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 ul(e,t){Di(t,!0),ba(e,cl);let n=Ha(t,"textBox",3,null),i=Ha(t,"isMobile",3,!1),r=po(!1),o=po(null),s=po(!1),a=no((()=>{var e;return(null===(e=n())||void 0===e?void 0:e.title)||""})),l=no((()=>{var e;return(null===(e=n())||void 0===e?void 0:e.description)||""})),c=no((()=>i()?16:18)),u=no((()=>i()?12:16));function d(){Rs(o)&&vo(s,Rs(o).scrollWidth>Rs(o).clientWidth||Rs(o).scrollHeight>Rs(o).clientHeight,!0)}Go((()=>{Rs(o)&&d()}));var h=Ks();js("resize",So,d);var f=Do(h),p=e=>{var n=ll(),d=Ro(n),h=Ro(d),f=Ro(h),p=e=>{var t=nl(),n=Ro(t,!0);ki(t),Yo((()=>na(n,Rs(a)))),Xs(e,t)};ha(f,(e=>{i()&&e(p)}));var m=Lo(f,2),v=Ro(m,!0);ki(m),ki(h);var g=Lo(h,2),y=e=>{var n=sl(),u=no((()=>t.gallery.interaction((()=>vo(r,!0)),{elementid:"textbox-expand",elementtype:"textbox",elementname:"Read more",interactiontype:"module-ui"})));n.__click=function(...e){var t;null===(t=Rs(u))||void 0===t||t.apply(this,e)};var d=Ro(n),h=e=>{var t=il(),n=Ro(t,!0);ki(t),Yo((()=>na(n,Rs(a)))),Xs(e,t)},f=e=>{var t=rl(),n=Ro(t,!0);ki(t),Va(t,(e=>vo(o,e)),(()=>Rs(o))),Yo((()=>na(n,Rs(l)))),Xs(e,t)};ha(d,(e=>{i()&&Rs(a)?e(h):e(f,!1)}));var p=Lo(d,2),m=e=>{Xs(e,ol())};ha(p,(e=>{(i()||!i()&&Rs(s))&&e(m)})),ki(n),Yo((()=>Aa(n,`line-height: ${Rs(c)}px;`))),Xs(e,n)};ha(g,(e=>{Rs(r)||e(y)})),ki(d);var b=Lo(d,2),k=e=>{var n=al(),o=no((()=>t.gallery.interaction((()=>vo(r,!1)))));n.__click=function(...e){var t;null===(t=Rs(o))||void 0===t||t.apply(this,e)},Yo((()=>Aa(n,`margin-bottom: ${!i()&&Rs(r)?"8px":"0px"};\n line-height: ${Rs(u)}px;`))),Xs(e,n)};ha(b,(e=>{Rs(r)&&e(k)})),ki(n),Yo((()=>{Ia(n,1,"step-description-container "+(Rs(r)?"expanded":""),"svelte-wejicf"),Aa(n,`padding: ${i()?"8px 16px":"16px 16px 64px 16px"};`),Aa(h,`line-height: ${Rs(c)}px;`),La(h,"hidden",!Rs(r)),na(v,Rs(l))})),Xs(e,n)};ha(f,(e=>{(Rs(a)||Rs(l))&&e(p)})),Xs(e,h),Li()}function dl(e,t){const n=no((()=>t.state.textBox));ul(e,{get textBox(){return Rs(n)},get isMobile(){return t.isMobile},get gallery(){return t.gallery}})}Us(["click"]);var hl=Hs('<div class="toggle-option-container svelte-16pmvvn"><button data-elementtype="toggle" data-interactiontype="module-ui"> </button></div>'),fl=Hs('<div class="toggle-container svelte-16pmvvn"><div></div></div> <!>',1);const pl={hash:"svelte-16pmvvn",code:".eko-gallery-app {--toggleModule_gap: 8px;--toggleModule_padding: 10px 58px 0 0;--toggleModule_options_padding: 0;--toggleModule_options_height: auto;--toggleModule_options_width: 100%;--toggleModule_options_gap: 8px;--toggleModule_button_backgroundColor: #FFFFFF;--toggleModule_button_padding: 8px 12px;--toggleModule_button_boxShadow: 0px 2px 8px 2px rgba(0, 0, 0, 0.07);--toggleModule_button_text_fontFamily: var(--fontName);--toggleModule_button_text_fontSize: 12px;--toggleModule_button_text_fontWeight: 400;--toggleModule_button_text_fontStyle: normal;--toggleModule_button_text_lineHeight: 16px;--toggleModule_button_text_letterSpacing: -0.2px;--toggleModule_button_text_color: #000;--toggleModule_button_border_radius: 100px;--toggleModule_title_fontFamily: var(--fontName);--toggleModule_title_fontSize: 13px;--toggleModule_title_fontWeight: 400;--toggleModule_title_fontStyle: normal;--toggleModule_title_lineHeight: 120%;--toggleModule_title_letterSpacing: 0;--toggleModule_title_color: #666;--toggleModule_title_textAlignment: center;--toggleModule_note_fontFamily: var(--fontName);--toggleModule_note_fontSize: 12px;--toggleModule_note_fontWeight: 400;--toggleModule_note_fontStyle: normal;--toggleModule_note_lineHeight: 120%;--toggleModule_note_letterSpacing: 0;--toggleModule_note_color: #888;--toggleModule_note_topMargin: 4px;}.toggle-container.svelte-16pmvvn {position:absolute;top:0;padding:var(--toggleModule_padding);width:100%;display:flex;flex-direction:column;align-items:center;gap:var(--toggleModule_gap);pointer-events:auto;box-sizing:border-box;}.toggle-options.svelte-16pmvvn {width:var(--toggleModule_options_width);height:var(--toggleModule_options_height);padding:var(--toggleModule_options_padding);gap:var(--toggleModule_options_gap);display:flex;justify-content:end;margin:0;}.toggle-option-container.svelte-16pmvvn {position:relative;min-width:0;}.toggle-option-button.svelte-16pmvvn {border-radius:var(--toggleModule_button_borderRadius);font-family:var(--toggleModule_button_text_fontFamily);font-size:var(--toggleModule_button_text_fontSize);font-weight:var(--toggleModule_button_text_fontWeight);font-style:var(--toggleModule_button_text_fontStyle);line-height:var(--toggleModule_button_text_lineHeight);letter-spacing:var(--toggleModule_button_text_letterSpacing);color:var(--toggleModule_button_text_color);padding:var(--toggleModule_button_padding);border:#E4E5E8 solid 1px;background:#FBFBFB;display:flex;width:100%;height:100%;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;cursor:pointer;position:relative;transition:all 0.3s ease-in-out;animation-duration:0.5s;animation-timing-function:cubic-bezier(0.36, 0, 0, 1);animation-fill-mode:both;animation-delay:calc(var(--button-index) * 90ms);\n animation-name: svelte-16pmvvn-button-back-appear-anim;transform-origin:bottom center;border-radius:var(--toggleModule_button_border_radius);}.toggle-option-button.selected.svelte-16pmvvn {box-shadow:none;color:#FFFFFF;background:#014FD3;border-color:#014FD3;}.toggle-option-button.svelte-16pmvvn:hover:not(.selected) {background:#F3F4F6;}.toggle-option-button.svelte-16pmvvn:active:not(.selected) {background:#E4E5E8;}.toggle-option-button.svelte-16pmvvn:focus {outline-offset:4px;outline-width:2px;}\n\n@keyframes svelte-16pmvvn-button-back-appear-anim {\n from {\n transform: scale(0);\n }\n to {\n transform: scale(1);\n }\n}\n@keyframes svelte-16pmvvn-optionNoteIn {\n 0% {\n opacity: 0;\n translate: -50% -5px;\n }\n 100% {\n opacity: 1;\n translate: -50% var(--toggleModule_note_topMargin);\n }\n}"};function ml(e,t){Di(t,!0),ba(e,pl);const n=no((()=>t.state.options)),i=no((()=>t.state.currentOptionIndex)),r=no((()=>t.state.onOptionClicked)),o=no((()=>t.state.textBox));var s=fl(),a=Do(s),l=Ro(a);ma(l,21,(()=>Rs(n)),fa,((e,n,o)=>{var s=hl();Aa(s,`--button-index: ${o};`);var a=Ro(s);let l;var c=no((()=>t.gallery.interaction((()=>Rs(r)(o)))));a.__click=function(...e){var t;null===(t=Rs(c))||void 0===t||t.apply(this,e)},La(a,"data-elementid",`${o+1}`);var u=Ro(a,!0);ki(a),ki(s),Yo((()=>{l=Ia(a,1,"toggle-option-button svelte-16pmvvn",null,l,{selected:Rs(i)===o}),La(a,"data-elementname",Rs(n).label),na(u,Rs(n).label)})),Xs(e,s)})),ki(l),ki(a);var c=Lo(a,2),u=e=>{ul(e,{get textBox(){return Rs(o)},get isMobile(){return t.isMobile},get gallery(){return t.gallery}})};ha(c,(e=>{Rs(o)&&e(u)})),Yo((()=>{var e;return Ia(l,1,`toggle-options selected-${null!==(e=Rs(i))&&void 0!==e?e:""}`,"svelte-16pmvvn")})),Xs(e,s),Li()}Us(["click"]);var vl=new WeakSet;function gl(e){var t,n;e!==this.state.currentOptionIndex&&(this.state.currentOptionIndex=e,this.state.textBox=this.config.options[e].textBox,this.cover=this.coverAssets[e],this.synced?this.switchTo(e):(this.timeline=null===(t=this.timelines)||void 0===t?void 0:t[e],this.showCover=!0,Za(this.timeline,(()=>{this.showCover=!1})),null===(n=this.player)||void 0===n||n.switchTimeline(this.timeline)))}const yl=(e,t,n)=>n>t?t:n<e?e:n;function bl(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}let kl=()=>{},wl=()=>{};function xl(e){let t;return()=>(void 0===t&&(t=e()),t)}"undefined"!=typeof process&&"production"!==(null===(rt=process.env)||void 0===rt?void 0:rt.NODE_ENV)&&(kl=(e,t,n)=>{e||"undefined"==typeof console||console.warn(bl(t,n))},wl=(e,t,n)=>{if(!e)throw new Error(bl(t,n))});const _l=e=>e,Tl=e=>1e3*e,El=e=>e/1e3;const Il=e=>Array.isArray(e)&&"number"==typeof e[0],Sl=(e,t,n=10)=>{let i="";const r=Math.max(Math.round(t/n),2);for(let t=0;t<r;t++)i+=Math.round(1e4*e(t/(r-1)))/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},Al=2e4;function Nl(e){let t=0;let n=e.next(t);for(;!n.done&&t<Al;)t+=50,n=e.next(t);return t>=Al?1/0:t}const Ml=5;const Fl={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Cl=.001;function Ol({duration:e=Fl.duration,bounce:t=Fl.bounce,velocity:n=Fl.velocity,mass:i=Fl.mass}){let r,o;kl(e<=Tl(Fl.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let s=1-t;s=yl(Fl.minDamping,Fl.maxDamping,s),e=yl(Fl.minDuration,Fl.maxDuration,El(e)),s<1?(r=t=>{const i=t*s,r=i*e,o=i-n,a=Rl(t,s),l=Math.exp(-r);return Cl-o/a*l},o=t=>{const i=t*s*e,o=i*n+n,a=Math.pow(s,2)*Math.pow(t,2)*e,l=Math.exp(-i),c=Rl(Math.pow(t,2),s);return(-r(t)+Cl>0?-1:1)*((o-a)*l)/c}):(r=t=>Math.exp(-t*e)*((t-n)*e+1)-Cl,o=t=>Math.exp(-t*e)*(e*e*(n-t)));const a=function(e,t,n){let i=n;for(let n=1;n<Pl;n++)i-=e(i)/t(i);return i}(r,o,5/e);if(e=Tl(e),isNaN(a))return{stiffness:Fl.stiffness,damping:Fl.damping,duration:e};{const t=Math.pow(a,2)*i;return{stiffness:t,damping:2*s*Math.sqrt(i*t),duration:e}}}const Pl=12;function Rl(e,t){return e*Math.sqrt(1-t*t)}const Dl=["duration","bounce"],Ll=["stiffness","damping","mass"];function Bl(e,t){return t.some((t=>void 0!==e[t]))}function zl(e=Fl.visualDuration,t=Fl.bounce){const n="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e;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(e){let t={velocity:Fl.velocity,stiffness:Fl.stiffness,damping:Fl.damping,mass:Fl.mass,isResolvedFromDuration:!1,...e};if(!Bl(e,Ll)&&Bl(e,Dl))if(e.visualDuration){const n=e.visualDuration,i=2*Math.PI/(1.2*n),r=i*i,o=2*yl(.05,1,1-(e.bounce||0))*Math.sqrt(r);t={...t,mass:Fl.mass,stiffness:r,damping:o}}else{const n=Ol(e);t={...t,...n,mass:Fl.mass},t.isResolvedFromDuration=!0}return t}({...n,velocity:-El(n.velocity||0)}),p=h||0,m=c/(2*Math.sqrt(l*u)),v=s-o,g=El(Math.sqrt(l/u)),y=Math.abs(v)<5;let b;if(i||(i=y?Fl.restSpeed.granular:Fl.restSpeed.default),r||(r=y?Fl.restDelta.granular:Fl.restDelta.default),m<1){const e=Rl(g,m);b=t=>{const n=Math.exp(-m*g*t);return s-n*((p+m*g*v)/e*Math.sin(e*t)+v*Math.cos(e*t))}}else if(1===m)b=e=>s-Math.exp(-g*e)*(v+(p+g*v)*e);else{const e=g*Math.sqrt(m*m-1);b=t=>{const n=Math.exp(-m*g*t),i=Math.min(e*t,300);return s-n*((p+m*g*v)*Math.sinh(i)+e*v*Math.cosh(i))/e}}const k={calculatedDuration:f&&d||null,next:e=>{const t=b(e);if(f)a.done=e>=d;else{let n=0===e?p:0;m<1&&(n=0===e?Tl(p):function(e,t,n){const i=Math.max(t-Ml,0);return r=n-e(i),(o=t-i)?r*(1e3/o):0;var r,o}(b,e,t));const o=Math.abs(n)<=i,l=Math.abs(s-t)<=r;a.done=o&&l}return a.value=a.done?s:t,a},toString:()=>{const e=Math.min(Nl(k),Al),t=Sl((t=>k.next(e*t).value),e,30);return e+"ms "+t},toTransition:()=>{}};return k}zl.applyToOptions=e=>{const t=function(e,t=100,n){const i=n({...e,keyframes:[0,t]}),r=Math.min(Nl(i),Al);return{type:"keyframes",ease:e=>i.next(r*e).value/t,duration:El(r)}}(e,100,zl);return e.ease=t.ease,e.duration=Tl(t.duration),e.type="keyframes",e};const Wl=e=>null!==e;class $l{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise((e=>{this.resolve=e}))}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}function jl(e){for(let n=1;n<e.length;n++){var t;null!==(t=e[n])&&void 0!==t||(e[n]=e[n-1])}}const Ul=e=>e.startsWith("--");const ql=xl((()=>void 0!==window.ScrollTimeline)),Vl={};function Gl(e,t){const n=xl(e);return()=>{var e;return null!==(e=Vl[t])&&void 0!==e?e:n()}}const Hl=Gl((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0}),"linearEasing"),Kl=([e,t,n,i])=>`cubic-bezier(${e}, ${t}, ${n}, ${i})`,Xl={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Kl([0,.65,.55,1]),circOut:Kl([.55,0,1,.45]),backIn:Kl([.31,.01,.66,-.59]),backOut:Kl([.33,1.53,.69,.99])};function Yl(e,t){return e?"function"==typeof e?Hl()?Sl(e,t):"ease-out":Il(e)?Kl(e):Array.isArray(e)?e.map((e=>Yl(e,t)||Xl.easeOut)):Xl[e]:void 0}function Ql(e,t,n,{delay:i=0,duration:r=300,repeat:o=0,repeatType:s="loop",ease:a="easeOut",times:l}={},c=void 0){const u={[t]:n};l&&(u.offset=l);const d=Yl(a,r);Array.isArray(d)&&(u.easing=d);const h={delay:i,duration:r,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:o+1,direction:"reverse"===s?"alternate":"normal"};c&&(h.pseudoElement=c);return e.animate(u,h)}class Jl extends $l{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:n,keyframes:i,pseudoElement:r,allowFlatten:o=!1,finalKeyframe:s,onComplete:a}=e;this.isPseudoElement=Boolean(r),this.allowFlatten=o,this.options=e,wl("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:e,...t}){return function(e){return"function"==typeof e&&"applyToOptions"in e}(e)&&Hl()?e.applyToOptions(t):(null!==(n=t.duration)&&void 0!==n||(t.duration=300),null!==(i=t.ease)&&void 0!==i||(t.ease="easeOut"),t);var n,i}(e);this.animation=Ql(t,n,i,l,r),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!r){const e=function(e,{repeat:t,repeatType:n="loop"},i,r=1){const o=e.filter(Wl),s=r<0||t&&"loop"!==n&&t%2==1?0:o.length-1;return s&&void 0!==i?i:o[s]}(i,this.options,s,this.speed);this.updateMotionValue?this.updateMotionValue(e):function(e,t,n){Ul(t)?e.style.setProperty(t,n):e.style[t]=n}(t,n,e),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 e,t;null===(e=(t=this.animation).finish)||void 0===e||e.call(t)}cancel(){try{this.animation.cancel()}catch(e){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;"idle"!==e&&"finished"!==e&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var e,t;this.isPseudoElement||(null===(e=(t=this.animation).commitStyles)||void 0===e||e.call(t))}get duration(){var e,t;const n=(null===(e=this.animation.effect)||void 0===e||null===(t=e.getComputedTiming)||void 0===t?void 0:t.call(e).duration)||0;return El(Number(n))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+El(e)}get time(){return El(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Tl(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){var e;return null!==(e=this.manualStartTime)&&void 0!==e?e:Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){var n;this.allowFlatten&&(null===(n=this.animation.effect)||void 0===n||n.updateTiming({easing:"linear"}));return this.animation.onfinish=null,e&&ql()?(this.animation.timeline=e,_l):t(this)}}class Zl{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map((e=>e.finished)))}getAll(e){return this.animations[0][e]}setAll(e,t){for(let n=0;n<this.animations.length;n++)this.animations[n][e]=t}attachTimeline(e){const t=this.animations.map((t=>t.attachTimeline(e)));return()=>{t.forEach(((e,t)=>{e&&e(),this.animations[t].stop()}))}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return ec(this.animations,"duration")}get iterationDuration(){return ec(this.animations,"iterationDuration")}runAll(e){this.animations.forEach((t=>t[e]()))}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function ec(e,t){let n=0;for(let i=0;i<e.length;i++){const r=e[i][t];null!==r&&r>n&&(n=r)}return n}class tc extends Zl{then(e,t){return this.finished.finally(e).then((()=>{}))}}const nc=new WeakMap,ic=(e,t="")=>`${e}:${t}`;function rc(e){const t=nc.get(e)||new Map;return nc.set(e,t),t}function oc(e,t){var n,i;return null!==(n=null!==(i=null==e?void 0:e[t])&&void 0!==i?i:null==e?void 0:e.default)&&void 0!==n?n:e}const sc=new Set(["borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","width","maxWidth","height","maxHeight","top","right","bottom","left","inset","insetBlock","insetBlockStart","insetBlockEnd","insetInline","insetInlineStart","insetInlineEnd","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingBlock","paddingBlockStart","paddingBlockEnd","paddingInline","paddingInlineStart","paddingInlineEnd","margin","marginTop","marginRight","marginBottom","marginLeft","marginBlock","marginBlockStart","marginBlockEnd","marginInline","marginInlineStart","marginInlineEnd","fontSize","backgroundPositionX","backgroundPositionY"]);function ac(e,t){for(let n=0;n<e.length;n++)"number"==typeof e[n]&&sc.has(t)&&(e[n]=e[n]+"px")}function lc(e,t){const n=window.getComputedStyle(e);return Ul(t)?n.getPropertyValue(t):n[t]}function cc(e,t,n,i){if(null==e)return[];const r=function(e){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){const t=document.querySelectorAll(e);return t?Array.from(t):[]}return Array.from(e).filter((e=>null!=e))}(e),o=r.length;wl(Boolean(o),"No valid elements provided.","no-valid-elements");const s=[];for(let e=0;e<o;e++){const i=r[e],a={...n};"function"==typeof a.delay&&(a.delay=a.delay(e,o));for(const e in t){let n=t[e];Array.isArray(n)||(n=[n]);const r={...oc(a,e)};r.duration&&(r.duration=Tl(r.duration)),r.delay&&(r.delay=Tl(r.delay));const o=rc(i),l=ic(e,r.pseudoElement||""),c=o.get(l);c&&c.stop(),s.push({map:o,key:l,unresolvedKeyframes:n,options:{...r,element:i,name:e,allowFlatten:!a.type&&!a.ease}})}}for(let e=0;e<s.length;e++){const{unresolvedKeyframes:t,options:n}=s[e],{element:i,name:r,pseudoElement:o}=n;o||null!==t[0]||(t[0]=lc(i,r)),jl(t),ac(t,r),!o&&t.length<2&&t.unshift(lc(i,r)),n.keyframes=t}const a=[];for(let e=0;e<s.length;e++){const{map:t,key:n,options:i}=s[e],r=new Jl(i);t.set(n,r),r.finished.finally((()=>t.delete(n))),a.push(r)}return a}const uc=(()=>function(e,t,n){return new tc(cc(e,t,n))})();var dc=Hs('<button class="svelte-16kucsb"><div class="svelte-16kucsb"> </div></button>'),hc=Hs('<div class="tryIt-container svelte-16kucsb"><!></div>');const fc={hash:"svelte-16kucsb",code:".eko-gallery-app {--tryItModule_justifyContent: center;--tryItModule_alignItems: flex-end;--tryItModule_padding: 16px 20px 48px 20px;--tryItModule_button_padding: 16px 32px;--tryItModule_button_textAlign: center;--tryItModule_button_borderRadius: 100px;--tryItModule_button_border: 0;--tryItModule_button_boxShadow: 0 4px 24px 2px rgba(0, 0, 0, 0.12);--tryItModule_button_background: #FFFFFF;--tryItModule_button_text_fontFamily: var(--fontName);--tryItModule_button_text_fontSize: 18px;--tryItModule_button_text_color: #222;--tryItModule_button_text_weight: 500;--tryItModule_button_text_lineHeight: 120%;--tryItModule_button_text_letterSpacing: -0.1px;}.tryIt-container.svelte-16kucsb {position:relative;padding:var(--tryItModule_padding);width:100%;height:100%;box-sizing:border-box;display:flex;justify-content:var(--tryItModule_justifyContent);align-items:var(--tryItModule_alignItems);}.tryIt-container.svelte-16kucsb button:where(.svelte-16kucsb) {padding:var(--tryItModule_button_padding);text-align:var(--tryItModule_button_textAlign);border-radius:var(--tryItModule_button_borderRadius);border:var(--tryItModule_button_border);background:var(--tryItModule_button_background);box-shadow:var(--tryItModule_button_boxShadow);font-family:var(--tryItModule_button_text_fontFamily);font-size:var(--tryItModule_button_text_fontSize);color:var(--tryItModule_button_text_color);font-weight:var(--tryItModule_button_text_weight);line-height:var(--tryItModule_button_text_lineHeight);letter-spacing:var(--tryItModule_button_text_letterSpacing);cursor:pointer;opacity:0;overflow:hidden;}.tryIt-container.svelte-16kucsb button:where(.svelte-16kucsb) div:where(.svelte-16kucsb) {opacity:0;}"};function pc(e,t){Di(t,!0),ba(e,fc);const n=no((()=>t.state.ctaText)),i=no((()=>t.state.animationConfig)),r=no((()=>t.state.showCta)),o=no((()=>t.state.onCtaClick));let s=null,a=null,l=po(!1),c=!1;function u(){c&&uc(s,{transform:"scale(1.05)"},{type:zl,mass:1.5,stiffness:400,damping:30})}function d(){c&&uc(s,{transform:"scale(1)"},{type:zl,mass:1.5,stiffness:400,damping:30})}function h(){c&&uc(s,{transform:"scale(0.95)"},{type:zl,mass:1,stiffness:600,damping:30})}Go((()=>{const{mass:e,stiffness:t,damping:n,delay:o}=Rs(i);let u;return Rs(r)&&(u=setTimeout((async()=>{vo(l,!0),u=null,uc(s,{transform:["translateY(40px) scale(0, 0.2)","translateY(0) scale(1, 1)"],opacity:1},{type:zl,mass:e,stiffness:t,damping:n}),await uc(a,{transform:["translateY(20px) scale(0.8)","translateY(0) scale(1)"],opacity:1},{type:zl,mass:e,stiffness:t,damping:n,delay:.15}),c=!0}),o)),()=>{u&&clearTimeout(u)}}));var f=hc(),p=Ro(f),m=e=>{var t=dc();t.__mousedown=h,t.__touchstart=h,t.__click=function(...e){var t;null===(t=Rs(o))||void 0===t||t.apply(this,e)};var i=Ro(t),r=Ro(i,!0);ki(i),Va(i,(e=>a=e),(()=>a)),ki(t),Va(t,(e=>s=e),(()=>s)),Yo((()=>{Aa(t,"pointer-events: "+(Rs(l)?"auto":"none")),na(r,Rs(n))})),js("mouseenter",t,u),js("mouseleave",t,d),Xs(e,t)};ha(p,(e=>{Rs(r)&&e(m)})),ki(f),Xs(e,f),Li()}Us(["mousedown","touchstart","click"]);var mc=new WeakSet;function vc(){this.mainTimeline?this.player.switchTimeline(this.mainTimeline):this.emitModuleEnd(),this.state.showCta=!1}const gc={videoModule:class extends el{constructor({config:e,...t}){var n;super({...t,config:e}),this.Component=dl,this.hasDuration=!e.loop,Ja(this),this.coverAssets.push(null!==(n=e.intro)&&void 0!==n?n:e.video),this.cover=this.coverAssets[0],this.state={textBox:e.textBox}}start(e){super.start(e),this.timeline=e.createTimeline();const t=this.config;t.intro&&this.timeline.placeOnTimeline(tl(`${this.id}_intro`,t.intro,e),"end");const n=tl(this.id,t.video,e);this.timeline.placeOnTimeline(n,"end",{loop:t.loop}),t.loop||n.on("nodeend",this.emitModuleEnd)}},toggleModule:class extends el{constructor({config:e,...t}){super({...t,config:e}),O(this,vl),this.Component=ml,this.synced=e.sync,this.switchTo=()=>{},Ja(this),this.coverAssets=e.options.map((e=>{var t;return null!==(t=e.intro)&&void 0!==t?t:e.video})),this.cover=this.coverAssets[0],this.state={options:e.options.map((e=>({label:e.label,note:e.note}))),currentOptionIndex:0,onOptionClicked:A(vl,this,gl).bind(this),textBox:e.options[0].textBox}}start(e){super.start(e),this.synced?(this.timeline=e.createTimeline(),this.config.options.forEach(((t,n)=>{this.timeline.placeOnTimeline(tl(`${this.id}_option_${n}`,t.video,e),0,{loop:!0})})),this.timeline.placeRenderNodeOnTimeline("switch",0,1/0,{params:{switchCrossfadeSeconds:.25,initSwitching:({switchTo:e})=>{this.switchTo=e,e(this.state.currentOptionIndex,{crossfadeSeconds:0})}}})):(this.timelines=this.config.options.map(((t,n)=>{const i=e.createTimeline();return t.intro&&i.placeOnTimeline(tl(`${this.id}_option_${n}_intro`,t.intro,e),"end"),i.placeOnTimeline(tl(`${this.id}_option_${n}`,t.video,e),"end",{loop:!0}),i})),this.timeline=this.timelines[this.state.currentOptionIndex])}},tryItModule:class extends el{constructor({config:e,...t}){var n;super({...t,config:e}),O(this,mc),Ja(this);const{introVideo:i}=e;this.coverAssets.push(null!==(n=i.intro)&&void 0!==n?n:i.loop),this.cover=this.coverAssets[0],this.state={ctaText:e.ctaText,animationConfig:e.animationConfig,showCta:!0,onCtaClick:A(mc,this,vc).bind(this)}}start(e){super.start(e),this.Component=pc,this.timeline=e.createTimeline();const{introVideo:t,mainVideo:n}=this.config;if(t.intro&&this.timeline.placeOnTimeline(tl(`${this.id}_intro_intro`,t.intro,e)),this.timeline.placeOnTimeline(tl(`${this.id}_intro_loop`,t.loop,e),"end",{loop:!0}),n){this.mainTimeline=e.createTimeline(),n.intro&&this.mainTimeline.placeOnTimeline(tl(`${this.id}_main_intro`,n.intro,e));const t=tl(`${this.id}_main_loop`,n.loop,e);this.mainTimeline.placeOnTimeline(t,"end",{loop:!0})}}play(){this.state.showCta=!0,super.play()}}};class yc{#d=Ii(po({}),"GalleryState.#variants");#h=Ii(po("ekonovar"),"GalleryState.#activeVariant");#f=Ii(po(0),"GalleryState.#activeItemIndex");#p=Ii(po(0),"GalleryState.#activeModuleIndex");#m=Ii(po(xo({itemIndex:0,moduleIndex:0})),"GalleryState.#playingModulePosition");#v=Ii(no((()=>{var e;return null===(e=Rs(this.#d))||void 0===e?void 0:e[Rs(this.#h)]})),"GalleryState.#currentItemsList");#g=Ii(no((()=>{var e;return null===(e=Rs(this.#v))||void 0===e?void 0:e[Rs(this.#f)]})),"GalleryState.#currentItem");#y=Ii(no((()=>{var e,t;return Rs(this.#b)?null===(t=Rs(this.#v))||void 0===t?void 0:t[Rs(this.#m).itemIndex].modules[Rs(this.#m).moduleIndex]:null===(e=Rs(this.#g))||void 0===e?void 0:e.modules[Rs(this.#p)]})),"GalleryState.#currentModule");#k=Ii(no((()=>{var e;return(null===(e=Rs(this.#v))||void 0===e?void 0:e.flatMap((e=>e.modules)))||[]})),"GalleryState.#currentModulesList");#w=Ii(po(!1),"GalleryState.#playerLoaded");#x=Ii(po(!1),"GalleryState.#paused");#b=Ii(po(!1),"GalleryState.#startedPlaying");#_=Ii(no((()=>!(Io(Rs(this.#m).itemIndex,this.activeItemIndex)&&Io(Rs(this.#m).moduleIndex,this.activeModuleIndex)))),"GalleryState.#seeking");set variants(e){vo(this.#d,e)}set activeVariant(e){vo(this.#h,e,!0)}set activeItemIndex(e){vo(this.#f,e,!0)}set activeModuleIndex(e){vo(this.#p,e,!0)}set playingModulePosition(e){vo(this.#m,e,!0)}set playerLoaded(e){vo(this.#w,e,!0)}set paused(e){vo(this.#x,e,!0)}set startedPlaying(e){vo(this.#b,e,!0)}get variants(){return Rs(this.#d)}get activeVariant(){return Rs(this.#h)}get activeItemIndex(){return Rs(this.#f)}get activeModuleIndex(){return Rs(this.#p)}get playingModulePosition(){return Rs(this.#m)}get currentItemsList(){return Rs(this.#v)}get currentItem(){return Rs(this.#g)}get currentModule(){return Rs(this.#y)}get playerLoaded(){return Rs(this.#w)}get paused(){return Rs(this.#x)}get startedPlaying(){return Rs(this.#b)}get seeking(){return Rs(this.#_)}get currentModulesList(){return Rs(this.#k)}}const bc={assetsDeliveryBase:"https://{{env}}assets.eko.com"};const kc=2,wc=5,xc=["activeItemIndex","activeModuleIndex","paused","startedPlaying"],_c=["version","selectItem","selectItemAndStep","next","prev","subscribe"];var Tc=new WeakMap,Ec=new WeakMap,Ic=new WeakMap,Sc=new WeakMap,Ac=new WeakMap,Nc=new WeakMap,Mc=new WeakSet;class Fc{constructor(e){var t,n,i,r,o;O(this,Mc),F(this,Tc,void 0),F(this,Ec,void 0),F(this,Ic,void 0),F(this,Sc,void 0),F(this,Ac,void 0),F(this,Nc,void 0),P(this,"public",void 0),P(this,"version","0.0.13"),Ja(this),C(Tc,this,(null===(t=crypto)||void 0===t||null===(n=t.randomUUID)||void 0===n?void 0:n.call(t))||`eko-gallery-${Date.now()}`),C(Sc,this,e),C(Nc,this,(null==e?void 0:e.onEvent)||(()=>{})),C(Ec,this,new yc(null==e||null===(i=e.options)||void 0===i?void 0:i.galleryEnv)),C(Ac,this,((e="")=>(Io(e,"production")&&(e=""),Object.fromEntries(Object.entries(bc).map((([t,n])=>[t,n.replaceAll("{{env}}",e)])))))(null==e||null===(r=e.options)||void 0===r?void 0:r.galleryEnv)),C(Ic,this,[]);const s=null==e||null===(o=e.instance)||void 0===o||null===(o=o.data)||void 0===o||null===(o=o.blocks)||void 0===o||null===(o=o.blocksArr)||void 0===o||null===(o=o.find((e=>Io(e.blockType,"GalleryBlock"))))||void 0===o?void 0:o.config;var a;s?(A(Mc,this,Cc).call(this,s.items),A(Mc,this,Oc).call(this,s.items),function(e,t){function n(t){window.EkoAnalytics("registerContextPacker",{tag:e,...t})}function i(t){return function(...n){return n.pop()!==e?null:t(...n)}}"undefined"!=typeof window&&window.EkoAnalytics&&(n({schema:"iglu:com.helloeko/gallery-app/jsonschema/1-0-0",match:/.*/,getData:i((()=>{var e,n,i,r,o;const s=null===(e=t.currentItem)||void 0===e?void 0:e.modules[t.activeModuleIndex];return{itemid:(null===(n=t.currentItem)||void 0===n?void 0:n.id)||"",itemindex:t.activeItemIndex,totalitems:(null===(i=t.currentItemsList)||void 0===i?void 0:i.length)||0,itemname:(null===(r=t.currentItem)||void 0===r?void 0:r.name)||"",moduleid:(null==s?void 0:s.id)||"",modulename:(null==s?void 0:s.name)||"",moduletype:(null==s?void 0:s.config.itemType)||"",moduleindex:t.activeModuleIndex,totalmodules:(null===(o=t.currentItem)||void 0===o?void 0:o.modules.length)||0,version:"0.0.13"}}))}),n({schema:"iglu:com.helloeko/implementation_interactions/jsonschema/1-0-6",match:"interaction",getData:i((e=>e))}))}(M(Tc,this),M(Ec,this))):console.warn("[eko-gallery-app] Gallery initiated without an instance, results will be empty"),this.public=(a=this,_c.reduce(((e,t)=>{if(!(t in a))throw new Error(`[eko-gallery-app] Public API member "${t}" does not exist on GalleryLogic`);const n=a[t];return e[t]=Io(typeof n,"function")?n.bind(a):n,e}),{}))}dispose(){var e,t;Io(typeof window,"undefined",!1)&&(null===(e=(t=window).EkoAnalytics)||void 0===e||e.call(t,"reset",M(Tc,this)))}start(e){M(Ec,this).playerLoaded=!0,M(Ic,this).forEach((t=>{t.start(e)})),C(Ic,this,null),A(Mc,this,Pc).call(this,e),M(Ec,this).currentModule.play()}selectItem(e){const t=M(Ec,this);Io(e,t.activeItemIndex)||(t.activeItemIndex=e,t.activeModuleIndex=0)}selectItemAndStep(e,t){const n=M(Ec,this);Io(e,n.activeItemIndex)&&Io(t,n.activeModuleIndex)||(n.activeItemIndex=e,n.activeModuleIndex=t)}next(){A(Mc,this,Dc).call(this)}prev(){const e=M(Ec,this);if(e.activeModuleIndex=e.activeModuleIndex-1,!e.currentItem.modules[e.activeModuleIndex])if(e.currentItemsList[e.activeItemIndex-1]){e.activeItemIndex=e.activeItemIndex-1;const t=e.currentItemsList[e.activeItemIndex];e.activeModuleIndex=t.modules.length-1}else e.activeModuleIndex=e.activeModuleIndex+1}subscribe(e){const t=M(Ec,this);return function(e){fr.ensure();const t=Uo(Bn|Yn,e,!0);return()=>{ns(t)}}((()=>{Go((()=>{const n=xc.reduce(((e,n)=>(e[n]=t[n],e)),{});e(n)}))}))}getCoverUrl(e,t){var n,i,r,o;const s=(null==e||null===(n=e.entity)||void 0===n?void 0:n.entityId)||(null==e?void 0:e.assetId),a=null!==(i=null==e||null===(r=e.entity)||void 0===r?void 0:r.entityRevision)&&void 0!==i?i:null==e?void 0:e.assetRevision;if(!s)throw new Error(`[getCoverUrl] No assetId found in assetConfig: ${JSON.stringify(e||{},null,2)}`);if(!a&&Io(a,0,!1))throw new Error(`[getCoverUrl] No assetRevision found for asset ${s}.`);let l;return null!==(o=M(Sc,this))&&void 0!==o&&null!==(o=o.coverAssetsMap)&&void 0!==o&&o[s]?(l=new URL(M(Sc,this).coverAssetsMap[s]),/^[a-z0-9]*assets.eko.com$/.test(l.host)&&t&&(l.pathname=l.pathname.replace(".png",".webp"))):(l=new URL(`${M(Ac,this).assetsDeliveryBase}/image/${s}/${a}?startOffset=0`),l.pathname+=t?".webp":".png"),t&&l.searchParams.set("width",t),l.href}track(e,...t){var n,i;Io(typeof window,"undefined",!1)&&(null===(n=(i=window).EkoAnalytics)||void 0===n||n.call(i,"track",e,...t,M(Tc,this)))}interaction(e,t){const n=M(Tc,this);return i=>{if(Io(typeof window,"undefined",!1)){var r,o,s,a;const e=null==i||null===(r=i.target)||void 0===r?void 0:r.dataset;let l;null!=i&&null!==(o=i.detail)&&void 0!==o&&o.direction&&(Io(i.detail.direction,"left")?l="swipe_next":Io(i.detail.direction,"right")&&(l="swipe_prev"));const c={elementid:(null==e?void 0:e.elementid)||(null==t?void 0:t.elementid)||"",elementtype:(null==e?void 0:e.elementtype)||(null==t?void 0:t.elementtype)||"",elementname:(null==e?void 0:e.elementname)||(null==t?void 0:t.elementname)||"",interactiontype:l||(null==e?void 0:e.interactiontype)||(null==t?void 0:t.interactiontype)||""};null===(s=(a=window).EkoAnalytics)||void 0===s||s.call(a,"track","interaction",c,n),M(Nc,this).call(this,"interaction",c)}e(i)}}get uuid(){return M(Tc,this)}get state(){return M(Ec,this)}get urls(){return M(Ac,this)}}function Cc(e){const t={};for(let n of e)for(let e of Object.keys(n.variants||{}))t[e]=[];t.ekonovar=[],M(Ec,this).variants=t}function Oc(e){const t=(e=[],t)=>{const n=[];for(let[i,r]of e.entries()){if(!gc[r.itemType])throw new Error(`Unknown module type ${r.itemType}`);const e=new gc[r.itemType]({position:{...t,moduleIndex:i},config:r,gallery:this});e.moduleEndListener=A(Mc,this,Rc).bind(this),n.push(e)}return n};for(const[i,r]of e.entries())if(Io(r.itemType,"galleryItemV2")){const{modules:e,...o}=r;for(const[s,a]of Object.entries(M(Ec,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=t(e,{variantId:s,itemIndex:i}),C(Ic,this,[...M(Ic,this),...n.modules]),a.push(n)}}}}function Pc(e){for(const[,t]of Object.entries(M(Ec,this).variants))for(const[n,i]of t.entries()){const r=i.modules,o=t.filter((e=>Io(e,i,!1))).map((e=>e.modules[0]));for(const[i,s]of r.entries()){let a=r[i+1];a||(a=t[(n+1)%t.length].modules[0]);const l=a.timeline.getNodesAtTime(0)[0],c=o.filter((e=>Io(e,a,!1))).map((e=>e.timeline.getNodesAtTime(0)[0])),u=[{nodeId:l.id,weight:kc},...c.map((e=>({nodeId:e.id,weight:wc})))];for(const t of s.timeline.placements){e.getNode(t.nodeId).setChildren(u)}}}}function Rc(){const e=M(Ec,this),t=e.currentItem.modules;t.length>1&&Io(e.activeModuleIndex,t.length-1)?e.activeModuleIndex=0:A(Mc,this,Dc).call(this)}function Dc(){const e=M(Ec,this);e.activeModuleIndex=e.activeModuleIndex+1,e.currentItem.modules[e.activeModuleIndex]||(e.currentItemsList[e.activeItemIndex+1]?(e.activeItemIndex=e.activeItemIndex+1,e.activeModuleIndex=0):e.activeModuleIndex=e.activeModuleIndex-1)}var Lc=Hs('<button><span class="svelte-er27y2"> </span></button>'),Bc=Hs('<div class="nav-buttons-container svelte-er27y2"><div class="nav-buttons svelte-er27y2"></div></div>');const zc={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);}"};Us(["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=Hs('<button><img class="svelte-1al44kl"/></button>');const jc={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 Uc(e,t){ba(e,jc);const n=Ha(t,"hidden",3,!1);var i=$c();let r;i.__click=function(...e){var n;null===(n=t.onClick)||void 0===n||n.apply(this,e)};var o=Ro(i);ki(i),Yo((()=>{var e;r=Ia(i,1,`nav-button ${null!==(e=t.type)&&void 0!==e?e:""}`,"svelte-1al44kl",r,{hidden:n()}),La(i,"aria-label",t.type),La(o,"src",Wc),La(o,"alt",t.type)})),Xs(e,i)}Us(["click"]);var qc=Hs('<button data-elementtype="step-indicator" data-interactiontype="navigation"><span class="svelte-1mxltt0"> </span></button>'),Vc=Hs('<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 Gc={hash:"svelte-1mxltt0",code:'.steps-indicator-container.svelte-1mxltt0 {width:calc(100% - 16px);position:absolute;bottom:12px;left:8px;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 4px;margin:0 16px;display:flex;gap:8px;align-items:center;overflow-x:auto;pointer-events:all;scrollbar-width:none;}.steps-indicator.fade-right.svelte-1mxltt0 {mask-image:linear-gradient(to right, black calc(100% - 20px), transparent);}.steps-indicator.fade-left.svelte-1mxltt0 {mask-image:linear-gradient(to left, black calc(100% - 20px), transparent);}.steps-indicator.fade-left.fade-right.svelte-1mxltt0 {mask-image:linear-gradient(to right, transparent, black 20px, black calc(100% - 20px), transparent);}.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 {width:34px;height:34px;position:absolute;z-index:10;bottom:4px;border:1px solid #C4C8CF;border-radius:50%;background-color:#FFFFFF;box-shadow:0 2px 3px 0 rgba(0, 0, 0, 0.05);box-sizing:border-box;display:flex;align-items:center;justify-content:center;pointer-events:none;cursor:pointer;opacity:0;}.step-arrow.svelte-1mxltt0:hover {background:#F6F6F7;}.step-arrow.svelte-1mxltt0:active {background:#E4E5E8;}.step-arrow-prev.svelte-1mxltt0 {left:3px;transform:translateX(-100%);\n animation: svelte-1mxltt0-arrow-left-disappear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}.step-arrow-prev.visible.svelte-1mxltt0 {pointer-events:auto;\n animation: svelte-1mxltt0-arrow-left-appear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}.step-arrow-next.svelte-1mxltt0 {right:3px;transform:translateX(100%);\n animation: svelte-1mxltt0-arrow-right-disappear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}.step-arrow-next.visible.svelte-1mxltt0 {pointer-events:auto;\n animation: svelte-1mxltt0-arrow-right-appear 0.3s cubic-bezier(0.36, 0, 0, 1) both;}\n\n@keyframes svelte-1mxltt0-gallery-steps-appear-anim {\n from {\n opacity: 0;\n transform: translate(0, 10px);\n }\n to {\n opacity: 1;\n transform: translate(0, 0);\n }\n}\n@keyframes svelte-1mxltt0-gallery-steps-disappear-anim {\n from {\n opacity: 1;\n transform: translate(0, 0);\n }\n to {\n opacity: 0;\n transform: translate(0, 10px);\n }\n}\n@keyframes svelte-1mxltt0-arrow-left-appear {\n from {\n opacity: 0;\n transform: translateX(-100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n@keyframes svelte-1mxltt0-arrow-left-disappear {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(-100%);\n }\n}\n@keyframes svelte-1mxltt0-arrow-right-appear {\n from {\n opacity: 0;\n transform: translateX(100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n@keyframes svelte-1mxltt0-arrow-right-disappear {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(100%);\n }\n}\n@keyframes svelte-1mxltt0-stepDurationAnimation {\n 0% {\n transform: translateX(0);\n }\n 100% {\n transform: translateX(100%);\n }\n}'};function Hc(e,t){Di(t,!0),ba(e,Gc);const n=16,i=32;let r=Ha(t,"gallery",7),o=po(null),s=po(null),a=po(!1),l=po(!1);const c=no((()=>{let e=[];return e=r().state.currentItem.modules.map(((e,t)=>({index:t,type:t===r().state.activeModuleIndex?"active":"",name:e.name}))),e}));function u(){Rs(o)&&(vo(a,Rs(o).scrollLeft>0),vo(l,Rs(o).scrollLeft+Rs(o).clientWidth<Rs(o).scrollWidth-0))}function d(e){Rs(o).scrollBy({left:e,behavior:"smooth"})}function h(e,t){const r=e.getBoundingClientRect(),o=t.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 e=Array.from(Rs(o).querySelectorAll(".step-button")).find((e=>{const t=e.getBoundingClientRect(),n=Rs(o).getBoundingClientRect();return t.left>n.left+i}));if(e){const t=e.previousElementSibling;t&&h(Rs(o),t)}}function p(){const e=Array.from(Rs(o).querySelectorAll(".step-button")).reverse().find((e=>{const t=e.getBoundingClientRect(),n=Rs(o).getBoundingClientRect();return t.right<n.right-i}));if(e){const t=e.nextElementSibling;t&&h(Rs(o),t)}}Go((()=>{if(Rs(o)){u();const e=Rs(o).querySelector(".step-button.active");e&&vo(s,e,!0);const t=new MutationObserver((()=>{const e=Rs(o).querySelector(".step-button.active");e&&vo(s,e,!0)}));t.observe(Rs(o),{attributes:!0,attributeFilter:["class"],subtree:!0});const n=new ResizeObserver((()=>{u()}));return n.observe(Rs(o)),()=>{t.disconnect(),n.disconnect()}}})),Go((()=>{Rs(c),Rs(o)&&Ps().then(u)})),Go((()=>{Rs(s)&&Rs(o)&&h(Rs(o),Rs(s))}));var m=Ks();js("resize",So,u),function(e,t,n){vi&&bi();var i=new ca(e);Qo((()=>{var e=t();i.ensure(e,n)}))}(Do(m),(()=>r().state.activeItemIndex),(e=>{var t=Vc(),n=Ro(t);let i;n.__click=f;var s=Lo(n,2);let d;ma(s,21,(()=>Rs(c)),fa,((e,t)=>{var n=qc();let i;var s=no((()=>r().interaction((e=>{return n=e.currentTarget,i=Rs(t).index,r().state.activeModuleIndex=i,void h(Rs(o),n);var n,i}))));n.__click=function(...e){var t;null===(t=Rs(s))||void 0===t||t.apply(this,e)};var a=Ro(n),l=Ro(a,!0);ki(a),ki(n),Yo((()=>{i=Ia(n,1,"step-button svelte-1mxltt0",null,i,{active:"active"===Rs(t).type}),La(n,"aria-label",`Go to step $${Rs(t).index+1}`),La(n,"data-elementid",`${Rs(t).index+1}`),La(n,"data-elementname",Rs(t).name),na(l,Rs(t).name)})),Xs(e,n)})),ki(s),Va(s,(e=>vo(o,e)),(()=>Rs(o)));var m=Lo(s,2);let v;m.__click=p,ki(t),Yo((()=>{var e;i=Ia(n,1,"step-arrow step-arrow-prev svelte-1mxltt0",null,i,{visible:Rs(a)}),d=Ia(s,1,"steps-indicator svelte-1mxltt0",null,d,{"with-duration":r().state.currentModule.hasDuration,paused:r().state.paused,"fade-left":Rs(a),"fade-right":Rs(l)}),Aa(s,`--stepDuration: ${null!==(e=r().state.currentModule.duration)&&void 0!==e?e:""}s`),v=Ia(m,1,"step-arrow step-arrow-next svelte-1mxltt0",null,v,{visible:Rs(l)})})),js("scroll",s,u),Xs(e,t)})),Xs(e,m),Li()}Us(["click"]);const Kc="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.01318%203.42005C3.01318%202.06672%204.50652%201.26672%205.66652%201.90672C6.82652%202.54672%2014.0732%206.48672%2014.0732%206.48672C15.2865%207.15339%2015.2865%208.86005%2014.0732%209.52005L5.66652%2014.1001C4.50652%2014.7334%203.01318%2013.9401%203.01318%2012.5801V3.42005ZM3.98652%2012.5801C3.98652%2013.1334%204.63318%2013.5467%205.19985%2013.2401L13.6065%208.66005C14.1399%208.36672%2014.1465%207.63339%2013.6065%207.34005C13.0665%207.04672%205.19985%202.76005%205.19985%202.76005C4.63985%202.44672%203.98652%202.86005%203.98652%203.42005V12.5801Z'%20fill='%23030303'/%3e%3c/svg%3e",Xc="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M10.8332%2014C10.5598%2014%2010.3332%2013.7733%2010.3332%2013.5V2.5C10.3332%202.22667%2010.5598%202%2010.8332%202C11.1065%202%2011.3332%202.22667%2011.3332%202.5V13.5C11.3332%2013.7733%2011.1065%2014%2010.8332%2014ZM5.1665%2014C4.89317%2014%204.6665%2013.7733%204.6665%2013.5V2.5C4.6665%202.22667%204.89317%202%205.1665%202C5.43984%202%205.6665%202.22667%205.6665%202.5V13.5C5.6665%2013.7733%205.43984%2014%205.1665%2014Z'%20fill='%23030303'/%3e%3c/svg%3e";var Yc=Hs('<img alt="Play" class="svelte-a3r6re"/>'),Qc=Hs('<img alt="Pause" class="svelte-a3r6re"/>'),Jc=Hs('<button class="pause-button svelte-a3r6re"><!></button>');const Zc={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;}"};Us(["click"]);const eu=300,tu=60,nu="none";function iu(e,t,n){return e.addEventListener(t,n),()=>e.removeEventListener(t,n)}function ru(e,t,n){const{x:i,y:r}=function(e,t){const n=e.getBoundingClientRect();return{x:Math.round(t.clientX-n.left),y:Math.round(t.clientY-n.top)}}(e,t);return{event:t,pointersCount:n.length,target:t.target,x:i,y:r,attachmentNode:e}}function ou(e,t,n,i,r){const o=ru(e,n,i);return e.dispatchEvent(new CustomEvent(`${t}${r}`,{detail:o})),o}function su(){let e=[],t=()=>{},n=[];return{setPointerControls:(i,r,o,s,a,l=nu,c=[])=>{var u;if(r.style.touchAction=(u=l,Array.isArray(u)?u:[u]).join(" "),n=c,n.forEach((t=>{var n;null===(n=t.onInit)||void 0===n||n.call(t,e)})),!e.length){let l=function(t){e.push(t);const l=ou(r,i,t,e,"down");function c(t){const o=e.length;e=function(e,t){return t.filter((t=>Io(e.pointerId,t.pointerId,!1)))}(t,e);if(o>e.length){e.length||(u(),d(),h(),f());const o=ou(r,i,t,e,"up");null==a||a(e,t),setTimeout((()=>{n.forEach((t=>{var n;null===(n=t.onUp)||void 0===n||n.call(t,o,e)}))}))}}null==s||s(e,t),setTimeout((()=>{n.forEach((t=>{var n;null===(n=t.onDown)||void 0===n||n.call(t,l,e)}))}));const u=iu(r,"pointermove",(t=>{e=e.map((e=>Io(t.pointerId,e.pointerId)?t:e));const s=ou(r,i,t,e,"move");null==o||o(e,t),n.forEach((t=>{var n;null===(n=t.onMove)||void 0===n||n.call(t,s,e)}))})),d=iu(r,"lostpointercapture",(e=>{c(e)})),h=iu(r,"pointerup",(e=>{c(e)})),f=iu(r,"pointerleave",(e=>{c(e)}))};t=iu(r,"pointerdown",l)}return{destroy:()=>{e.length||(t(),n.forEach((e=>{var t;null===(t=e.onDestroy)||void 0===t||t.call(e)})))}}}}}const au="@attach";function lu(){return Symbol(au)}const cu="swipe";function uu(e,t,n,i=!1){const{setPointerControls:r}=su(),o=i?cu:lu();return{...n,[`on${cu}`]:e,[o]:e=>{const{onDown:n,onUp:i,parameters:o}=function(e,t){const n={timeframe:eu,minSwipeDistance:tu,touchAction:nu,composed:!1,...t};let i,r,o,s;function a(e,t){r=t.clientX,o=t.clientY,i=Date.now(),Io(e.length,1)&&(s=t.target)}function l(t,a){if(Io(a.type,"pointerup")&&Io(t.length,0)&&Date.now()-i<n.timeframe){const t=a.clientX-r,i=a.clientY-o,l=Math.abs(t),c=Math.abs(i);let u=null;l>=2*c&&l>n.minSwipeDistance?u=t>0?"right":"left":c>=2*l&&c>n.minSwipeDistance&&(u=i>0?"bottom":"top"),u&&e.dispatchEvent(new CustomEvent(cu,{detail:{direction:u,target:s,pointerType:a.pointerType}}))}}return{onDown:a,onUp:l,parameters:n}}(e,null==t?void 0:t());return r(cu,e,null,n,i,o.touchAction,o.plugins).destroy}}}const du="tap";function hu(e,t,n,i=!1){const{setPointerControls:r}=su(),o=i?du:lu();return{...n,[`on${du}`]:e,[o]:e=>{const{onDown:n,onUp:i,parameters:o}=function(e,t){const n={timeframe:eu,composed:!1,touchAction:"auto",...t};let i,r,o;function s(t,s){if(Math.abs(s.clientX-r)<4&&Math.abs(s.clientY-o)<4&&Date.now()-i<n.timeframe){const t=e.getBoundingClientRect(),n=Math.round(s.clientX-t.left),i=Math.round(s.clientY-t.top);e.dispatchEvent(new CustomEvent(du,{detail:{x:n,y:i,target:s.target,pointerType:s.pointerType}}))}}function a(e,t){r=t.clientX,o=t.clientY,i=Date.now()}return{onDown:a,onUp:s,parameters:n}}(e,null==t?void 0:t());return r(du,e,null,n,i,o.touchAction,o.plugins).destroy}}}const fu=e=>{const t="#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 t=e.fadeTime,n=Date.now(),i=n-c;i>t/20&&(a&&o&&s&&r&&(s.drawImage(r,0,0),a.clearRect(0,0,r.width,r.height),a.globalAlpha=1-3*i/t,a.drawImage(o,0,0),a.globalAlpha=1,s.clearRect(0,0,r.width,r.height)),c=n),l&&requestAnimationFrame(d)}function h(e){u.x=e.x,u.y=e.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(t){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=e.zIndex)&&void 0!==i?i:n};\n`,window.document.body.appendChild(r),window.addEventListener("resize",f),t&&h(t.event),o=document.createElement("canvas"),f(),s=o.getContext("2d"),l=!0,d()}function m(){var e;l=!1,null===(e=window.document.getElementById("svelte-gestures-highlight-plugin"))||void 0===e||e.remove(),window.removeEventListener("resize",f)}return{onMove:n=>{var r,o,s;r=n.event,a&&(a.beginPath(),a.lineWidth=null!==(o=e.lineWidth)&&void 0!==o?o:i,a.lineCap="round",a.strokeStyle=null!==(s=e.color)&&void 0!==s?s:t,Io(u.x,void 0,!1)&&Io(u.y,void 0,!1)?(a.moveTo(u.x,u.y),h(r),a.lineTo(u.x,u.y)):h(r),a.stroke())},onDown:e=>{p(e)},onUp:(e,t)=>{Io(t.length,0)&&m()},onDestroy:m,onInit:e=>{e.length&&(u.x=void 0,u.y=void 0,p())}}};var pu=Hs("<div></div>"),mu=Hs("<div></div>");const vu={hash:"svelte-1fv6njc",code:".swiper.svelte-1fv6njc {position:absolute;top:0;left:0;pointer-events:auto;width:100%;height:100%;}"};var gu=Hs("<img/>"),yu=Hs('<div class="ui-container svelte-1rvgxfc"><!></div>'),bu=Hs('<div class="cover-container svelte-1rvgxfc"><!> <!> <!></div>'),ku=Hs('<div class="covers-container svelte-1rvgxfc" style="scroll-behavior: auto;"></div>');const wu={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 xu(e,t){Di(t,!0),ba(e,wu);const n=[375,768,1024,1400,1920];let i,r=Ha(t,"scrollOffset",15),o=Ha(t,"isMobile",3,!1),s=Ha(t,"gallery",7),a=no((()=>s().state.playingModulePosition)),l=null,c=null,u=no((()=>s().state.startedPlaying)),d=no((()=>s().state.currentModulesList)),h=no((()=>Rs(d).findIndex((e=>p(s().state.playingModulePosition,e.position))))),f=!1;function p(e,t){return e.itemIndex===t.itemIndex&&e.moduleIndex===t.moduleIndex}function m(e){const t=e.scrollLeft,n=e.scrollWidth-e.clientWidth;return 0===t?0:t>n?100:t/n*100}function v(e){var t;o()&&e.preventDefault();const{target:n}=e,u=m(n),f=(null===(t=Rs(d))||void 0===t?void 0:t.length)||1,v=100/(f-1||1),g=Math.round(u/v);let y=Math.min(g,f-1);const b=Rs(d)[y],k={itemIndex:s().state.activeItemIndex,moduleIndex:s().state.activeModuleIndex};if(!l){const e=i.children[Rs(h)],t=i.getBoundingClientRect(),n=e.getBoundingClientRect();r(n.x-t.x)}c&&clearTimeout(c),c=setTimeout((()=>{const e=m(n);Math.abs(e-g*v)<.25&&async function(){s().state.seeking&&(s().state.playerLoaded?s().state.currentItemsList[s().state.activeItemIndex].modules[s().state.activeModuleIndex].play():s().state.playingModulePosition=Rs(a),r(0))}()}),l?0:150),null!==l||p(b.position,k)?null!==l&&p(b.position,l)&&(l=null):(s().state.activeItemIndex=b.position.itemIndex,s().state.activeModuleIndex=b.position.moduleIndex),vo(a,b.position)}function g(){f||(s().track("coverdisplay"),f=!0)}Go((()=>{const{activeItemIndex:e,activeModuleIndex:t}=s().state;e===Rs(a).itemIndex&&t===Rs(a).moduleIndex||Bs((()=>{var n,r;const o=Rs(d).findIndex((n=>{const{itemIndex:i,moduleIndex:r}=n.position;return e===i&&t===r}));l=(null===(n=Rs(d)[o])||void 0===n?void 0:n.position)||null;const s=null===(r=i)||void 0===r||null===(r=r.children)||void 0===r?void 0:r[o];if(!i||!s)return;const a=i.getBoundingClientRect(),c=s.getBoundingClientRect();let u=i.scrollLeft+(c.left-a.left);const h=Math.max(0,i.scrollWidth-i.clientWidth);u=Math.max(0,Math.min(h,u)),i.scrollTo({left:u,behavior:"auto"})}))})),Go((()=>{Rs(u)&&Bs((()=>{s().track("projectstartedplaying")}))}));var y=Ks(),b=Do(y),k=e=>{var r=ku();ma(r,23,(()=>Rs(d)),(e=>e.id),((e,i,r)=>{var a=bu(),l=Ro(a),c=e=>{var t=gu();let o;Yo((e=>{o=Ia(t,1,"cover-image svelte-1rvgxfc",null,o,{hidden:Rs(u)&&Rs(r)===Rs(h),"force-show":Rs(i).showCover}),La(t,"src",e),La(t,"alt",Rs(i).name),La(t,"fetchpriority",0===Rs(r)?"high":"auto")}),[()=>s().getCoverUrl(Rs(i).cover,n[n.length-1])]),js("load",t,(function(...e){var t;null===(t=0===Rs(r)?g:()=>{})||void 0===t||t.apply(this,e)})),function(e){if(!vi)return;e.removeAttribute("onload"),e.removeAttribute("onerror");const t=e.__e;void 0!==t&&(e.__e=void 0,queueMicrotask((()=>{e.isConnected&&e.dispatchEvent(t)})))}(t),Xs(e,t)};ha(l,(e=>{e(c)}));var d=Lo(l,2);!function(e,t){Di(t,!0),ba(e,vu);const n={color:"#e3e3e3",fadeTime:300,lineWidth:8},i=uu(t.gallery.interaction((e=>{const{direction:n}=e.detail;var i;if("left"===n)null===(i=t.gallery)||void 0===i||i.next(),t.onEvent("swipe",[-1,0]);else if("right"===n){var r;null===(r=t.gallery)||void 0===r||r.prev(),t.onEvent("swipe",[1,0])}}),{elementid:"swiper"}),(()=>({touchAction:"pan-y",plugins:t.debug?[fu(n)]:[]}))),r=hu((function(e){const{x:n,y:i}=e.detail;t.onEvent("click",{x:n,y:i})}),(()=>({touchAction:"pan-y"})));var o=Ks(),s=Do(o),a=e=>{var t=pu();Ba(t,(()=>({...i,...r,class:"swiper"})),void 0,void 0,void 0,"svelte-1fv6njc"),Xs(e,t)},l=e=>{var t=mu();Ba(t,(()=>({...r,class:"swiper"})),void 0,void 0,void 0,"svelte-1fv6njc"),Xs(e,t)};ha(s,(e=>{t.isMobile?e(a):e(l,!1)})),Xs(e,o),Li()}(d,{get gallery(){return s()},get debug(){return t.debug},get isMobile(){return o()},get onEvent(){return t.onEvent}});var f=Lo(d,2),p=e=>{var t=yu();!function(e,t,n){vi&&bi();var i=new ca(e);Qo((()=>{var e,r=null!==(e=t())&&void 0!==e?e:null;i.ensure(r,r&&(e=>n(e,r)))}),Hn)}(Ro(t),(()=>Rs(i).Component),((e,t)=>{t(e,{get state(){return Rs(i).state},get gallery(){return s()},get isMobile(){return o()}})})),ki(t),Xs(e,t)};ha(f,(e=>{var t;null!==(t=Rs(i))&&void 0!==t&&t.Component&&e(p)})),ki(a),Xs(e,a)})),ki(r),Va(r,(e=>i=e),(()=>i)),js("scroll",r,v),Xs(e,r)};ha(b,(e=>{Rs(d)&&e(k)})),Xs(e,y),Li()}const _u="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};let Tu;function Eu(){const e=_u&&_u.navigator&&(_u.navigator.userAgent||_u.navigator.platform||_u.navigator.vendor)||"";if(Tu&&Tu.ua===e)return Tu;const t=e.toLowerCase(),n=t.includes("android"),i=t.includes("iphone")||t.includes("ipad")||t.includes("ipod")||t.includes("ios"),r=n||i||t.includes("mobile");return Tu={ua:e,isMobile:r},Tu}var Iu,Su;"undefined"!=typeof window&&(window.addEventListener("pageshow",(function(e){e.persisted&&setTimeout((function(){window.location.reload()}),10)}),!1),null===(Iu=(Su=window).EkoAnalytics)||void 0===Iu||Iu.call(Su,"track","init"));var Au=Hs('<div class="paging-buttons svelte-1n46o8q"><!> <!></div>'),Nu=Hs('<div style="position: absolute; top: 0; left: 0; width: 100%;"></div>'),Mu=Hs("<!> <!>",1),Fu=Hs('<div class="player-container svelte-1n46o8q"><div class="player-div swipable svelte-1n46o8q"></div> <!> <!> <!> <!></div> <!>',1),Cu=Hs('<div class="eko-gallery-app svelte-1n46o8q"><!></div>');const Ou={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;border-radius:16px;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 Pu(e,t){Di(t,!0),ba(e,Ou);const n=Ha(t,"config",19,(()=>({}))),i=Ha(t,"forceMobile",3,!1),r=Ha(t,"videoAspectRatio",3,"unset"),o=Ha(t,"onGalleryReady",3,(()=>{})),s=Ha(t,"onEvent",3,(()=>{}));let a,l=!1,c=po(new Fc({...n(),onEvent:s()})),u=po(null),d=no((()=>i()||Eu().isMobile)),h=po(0),f=po(void 0),p=po(!0),m=po(xo({width:"100%",height:"100%"}));var v,g,y;function b(){const e={AssetsDeliveryService:{assetsDeliveryServiceUrl:Rs(c).urls.assetsDeliveryBase},Tracker:{tag:Rs(c).uuid}};vo(u,new t.EkoPlayer(a,function(e,...t){function n(e){return"[object Object]"===Object.prototype.toString.call(e)}function i(e,t){if(Array.isArray(t)){Array.isArray(e)||(e=Array.isArray(e)?e.slice():[]);const r=Math.max(e.length,t.length);for(let o=0;o<r;o++){const r=e[o],s=t[o];null!=s&&(n(r)&&n(s)?e[o]=i({...r},s):Array.isArray(r)&&Array.isArray(s)?e[o]=i(r.slice(),s):n(s)?e[o]=i({},s):Array.isArray(s)?e[o]=i([],s):e[o]=s)}return e}if(n(t)){n(e)||(e={});for(const r of Object.keys(t)){const o=e[r],s=t[r];n(o)&&n(s)?e[r]=i({...o},s):Array.isArray(o)&&Array.isArray(s)?e[r]=i(o.slice(),s):n(s)?e[r]=i({},s):Array.isArray(s)?e[r]=i([],s):void 0!==s&&(e[r]=s)}return e}return t}for(const n of t)null!==n&&i(e,n);return e}({},t.playerOptions,e))),Rs(u).on("playing",(()=>{Rs(c).state.paused=!1})),Rs(u).on("pause",(()=>{Rs(c).state.paused=!0})),Rs(u).once("playing",(()=>{Rs(c).state.startedPlaying=!0,s()("galleryloaded")}))}function k(e){var t;null===(t=Rs(c))||void 0===t||t.selectItem(e)}function w(){var e;null===(e=Rs(c))||void 0===e||e.next()}function x(){var e;null===(e=Rs(c))||void 0===e||e.prev()}function _(){Rs(u).paused?Rs(u).play():Rs(u).pause()}function T(){return`--uiTranformX: ${Rs(h)}px;--videoAspect: ${r()};--videoWidth: ${Rs(m).width};--videoHeight: ${Rs(m).height};`}v="state",g=()=>Rs(c).state,Bi("setContext").set(v,g),y=()=>(o()(Rs(c).public),n()&&t.EkoPlayer&&(b(),Rs(c).start(Rs(u))),()=>{var e;null===(e=Rs(u))||void 0===e||e.dispose(),Rs(c).dispose()}),null===Ni&&ui("onMount"),Go((()=>{const e=Bs(y);if("function"==typeof e)return e})),Go((()=>{n()&&t.EkoPlayer&&(l?Bs((()=>{var e;Rs(c).dispose(),vo(c,new Fc({...n(),onEvent:s()})),null===(e=Rs(u))||void 0===e||e.dispose(),vo(p,!1),Ps().then((()=>(vo(p,!0),Ps()))).then((()=>{o()(Rs(c).public),b(),Rs(c).start(Rs(u))}))})):l=!0)})),Go((()=>{Rs(f)&&Rs(u)&&Rs(u).loadDebugOverlay({containerElement:Rs(f)})})),Go((()=>{if("unset"!==r()&&r().includes("/")){const[e,t]=r().split("/").map((e=>Number(e)));isNaN(e)||isNaN(t)||vo(m,e>t?{width:"100%",height:"auto"}:{width:"auto",height:"100%"},!0)}else vo(m,{width:"100%",height:"100%"},!0)}));var E=Cu(),I=Ro(E),S=e=>{var n=Fu(),i=Do(n),r=Ro(i);Va(r,(e=>a=e),(()=>a));var o=Lo(r,2);xu(o,{get isMobile(){return Rs(d)},get gallery(){return Rs(c)},get debug(){return t.debug},get onEvent(){return s()},get scrollOffset(){return Rs(h)},set scrollOffset(e){vo(h,e,!0)}});var l=Lo(o,2),u=e=>{var t=Au(),n=Ro(t);Uc(n,{type:"prev",onClick:x}),Uc(Lo(n,2),{type:"next",onClick:w}),ki(t),Xs(e,t)};ha(l,(e=>{Rs(d)||t.hideNav||e(u)}));var p=Lo(l,2),m=e=>{Hc(e,{get gallery(){return Rs(c)}})};ha(p,(e=>{var t;!Rs(d)&&(null===(t=Rs(c).state.currentItem)||void 0===t?void 0:t.modules.length)>1&&e(m)}));var v=Lo(p,2),g=e=>{var n=Mu(),i=Do(n);!function(e,t){Di(t,!0),ba(e,Zc);const n=Ri("state");var i=Jc();i.__click=function(...e){var n;null===(n=t.onPauseClick)||void 0===n||n.apply(this,e)};var r=Ro(i),o=e=>{var t=Yc();Yo((()=>La(t,"src",Kc))),Xs(e,t)},s=e=>{var t=Qc();Yo((()=>La(t,"src",Xc))),Xs(e,t)};ha(r,(e=>{n().paused?e(o):e(s,!1)})),ki(i),Yo((e=>La(i,"aria-label",e)),[()=>n().paused?"Play":"Pause"]),Xs(e,i),Li()}(i,{onPauseClick:_});var r=Lo(i,2),o=e=>{var t=Nu();Va(t,(e=>vo(f,e)),(()=>Rs(f))),Xs(e,t)};ha(r,(e=>{t.debug&&e(o)})),Xs(e,n)};ha(v,(e=>{Rs(c).state.startedPlaying&&e(g)})),ki(i);var y=Lo(i,2),b=e=>{!function(e,t){Di(t,!0),ba(e,zc);let n=Ha(t,"onNavItemClick",3,(()=>{}));const i=Ri("state");var r=Bc(),o=Ro(r);ma(o,23,(()=>i().currentItemsList),(e=>e.id),((e,t,r)=>{var o=Lc();let s;o.__click=()=>n()(Rs(r));var a=Ro(o),l=Ro(a,!0);ki(a),ki(o),Yo((e=>{s=Ia(o,1,"nav-button svelte-er27y2",null,s,e),na(l,Rs(t).name)}),[()=>({selected:Rs(r)===i().activeItemIndex})]),Xs(e,o)})),ki(o),ki(r),Xs(e,r),Li()}(e,{onNavItemClick:k})};ha(y,(e=>{t.hideNav||e(b)})),Yo((e=>Aa(i,e)),[T]),Xs(e,n)};ha(I,(e=>{n()&&Rs(p)&&e(S)})),ki(E),Xs(e,E),Li()}function Ru(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Du,Lu,Bu,zu,Wu={exports:{}},$u=Ru((Du||(Du=1,Bu=Wu.exports,zu=function(){var e=function(){},t="undefined",n=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},o=null;function s(e,t){var n=e[t];if("function"==typeof n.bind)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(t){return function(){return Function.prototype.apply.apply(n,[e,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?e:this.methodFactory(o,n,this.name)}if(this.log=this.debug,typeof console===t&&n<this.levels.SILENT)return"No console available for logging"}function c(e){return function(){typeof console!==t&&(l.call(this),this[e].apply(this,arguments))}}function u(i,r,o){return"debug"===(l=i)&&(l="log"),typeof console!==t&&("trace"===l&&n?a:void 0!==console[l]?s(console,l):void 0!==console.log?s(console,"log"):e)||c.apply(this,arguments);var l}function d(e,n){var s,a,c,d=this,h="loglevel";function f(){var e;if(typeof window!==t&&h){try{e=window.localStorage[h]}catch(e){}if(typeof e===t)try{var n=window.document.cookie,i=encodeURIComponent(h),r=n.indexOf(i+"=");-1!==r&&(e=/^([^;]+)/.exec(n.slice(r+i.length+1))[1])}catch(e){}return void 0===d.levels[e]&&(e=void 0),e}}function p(e){var t=e;if("string"==typeof t&&void 0!==d.levels[t.toUpperCase()]&&(t=d.levels[t.toUpperCase()]),"number"==typeof t&&t>=0&&t<=d.levels.SILENT)return t;throw new TypeError("log.setLevel() called with invalid level: "+e)}"string"==typeof e?h+=":"+e:"symbol"==typeof e&&(h=void 0),d.name=e,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(e,n){return c=p(e),!1!==n&&function(e){var n=(i[e]||"silent").toUpperCase();if(typeof window!==t&&h){try{return void(window.localStorage[h]=n)}catch(e){}try{window.document.cookie=encodeURIComponent(h)+"="+n+";"}catch(e){}}}(c),l.call(d)},d.setDefaultLevel=function(e){a=p(e),f()||d.setLevel(e,!1)},d.resetLevel=function(){c=null,function(){if(typeof window!==t&&h){try{window.localStorage.removeItem(h)}catch(e){}try{window.document.cookie=encodeURIComponent(h)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}(),l.call(d)},d.enableAll=function(e){d.setLevel(d.levels.TRACE,e)},d.disableAll=function(e){d.setLevel(d.levels.SILENT,e)},d.rebuild=function(){if(o!==d&&(s=p(o.getLevel())),l.call(d),o===d)for(var e in r)r[e].rebuild()},s=p(o?o.getLevel():"WARN");var m=f();null!=m&&(c=p(m)),l.call(d)}(o=new d).getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=r[e];return t||(t=r[e]=new d(e,o.methodFactory)),t};var h=typeof window!==t?window.log:void 0;return o.noConflict=function(){return typeof window!==t&&window.log===o&&(window.log=h),o},o.getLoggers=function(){return r},o.default=o,o},(Lu=Wu).exports?Lu.exports=zu():Bu.log=zu()),Wu.exports));const ju=()=>{},Uu=["trace","log","debug","info","warn","error","getLevel","setLevel"],qu=["trace","debug","info","warn","error","silent"],Vu={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;"},Gu="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global;let Hu={level:"trace",appName:""},Ku=[];const Xu="object"==typeof Gu&&Gu.performance&&"function"==typeof Gu.performance.now?Gu.performance.now.bind(Gu.performance):Date.now.bind(Date),Yu=e=>e&&"string"==typeof e?e.toLowerCase().trim():"",Qu=(()=>{try{const e=new URLSearchParams(document.location.search),t=[].concat(e.getAll("log")).concat(e.getAll("ekolog")).concat(e.getAll("ekologger")).join(",").split(",");if(0===t.length)return{};let n={};return t.forEach((e=>{const[t,i]=e.split(":");n[Yu(t)]=Yu(i)||"trace"})),n}catch(e){return{}}})(),Ju=(e,t="")=>{const n=Yu(e),i=$u.getLogger(n);if(i.__ekologger)return i.__ekologger;t||Qu[n]||Qu["*"]||(i.__noExplicitLevel=!0);const r=i.methodFactory;i.methodFactory=(t,n,i)=>{const o=r(t,n,i),s=t.toUpperCase();return(...t)=>{o(`[${((e,t=3)=>(Xu()/1e3).toFixed(t))()}] %c[${s}] ${Hu.appName?`[${Hu.appName}] `:""}[${e}]`,Vu[s],...t)}},t=Qu[n]||Qu["*"]||t||Hu.level,i.setLevel(t,!1);const o=(...e)=>i.log(...e);return Uu.forEach((e=>{o[e]=(...t)=>(Ku.forEach((n=>{n[e](...t)})),i[e](...t))})),i.__ekologger=o,o};Ju.setDefaults=({appName:e="",level:t})=>{e&&"string"==typeof e&&(Hu.appName=e),(t=Yu(t))&&qu.includes(t)&&(Hu.level=t,Object.values($u.getLoggers()).filter((e=>e.__noExplicitLevel)).forEach((e=>e.setLevel(Hu.level,!1))))},Ju.installDriver=e=>{const t={...Uu.reduce(((t,n)=>(t[n]="function"==typeof(null==e?void 0:e[n])?e[n]:ju,t)),{})};Ku.push(t)};let Zu=class{#T=new Map;on(e,t){if("function"!=typeof t)return this;const n=this.#T.get(e)||new Set;return n.add(t),this.#T.set(e,n),this}once(e,t){if("function"!=typeof t)return this;const n=(...i)=>(this.off(e,n),t(...i));return this.on(e,n)}off(e,t){if(!e)return this.#T.clear(),this;const n=this.#T.get(e);return n?t?(n.delete(t),0===n.size&&this.#T.delete(e),this):(this.#T.delete(e),this):this}trigger(e,...t){const n=this.#T.get(e);return n?(n.forEach((e=>e(...t))),this):this}};function ed(e){return"[object Object]"===Object.prototype.toString.call(e)}function td(e,...t){const n=ed(e)?{...e}:{};return t.forEach((e=>{ed(e)&&Object.keys(e).forEach((t=>{const i=e[t],r=n[t];ed(i)&&ed(r)?n[t]=td(r,i):Array.isArray(i)?n[t]=i.slice():n[t]=i}))})),n}function nd(e){if("string"==typeof e)return`'${e}'`;if(Array.isArray(e))return`[${e.map((e=>nd(e))).join(", ")}]`;if(ed(e))try{return JSON.stringify(e)}catch(e){return"[object Object]"}return null===e?"null":void 0===e?"undefined":String(e)}function id(e){return Array.from(e).map((e=>nd(e))).join(", ")}var rd=new WeakSet;let od=class extends Zu{constructor(...e){super(),O(this,rd);const t=e.length?e[e.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=Ju(n,this.loglevel);const i=ed(this.defaults)?this.defaults:{},r=ed(t)&&ed(t[n])?t[n]:{};this.settings=td({},i,r),A(rd,this,sd).call(this),A(rd,this,ad).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 sd(){const e=new Set,t=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(e.has(o))continue;const s=Object.getOwnPropertyDescriptor(n,o);if(!s||"function"!=typeof s.value)continue;const a=s.value.bind(this),l=!t.has(o);this[o]=l?(...e)=>(this.log&&"function"==typeof this.log.debug&&this.log.debug(`${this.name}.${o}(${id(e)})`),a(...e)):a,e.add(o)}n=Object.getPrototypeOf(n)}}function ad(){if("undefined"==typeof window||"function"!=typeof window.addEventListener)return;const e=()=>{try{"function"==typeof this.dispose&&this.dispose()}catch(e){this.log&&"function"==typeof this.log.error&&this.log.error("dispose failed",e)}};window.addEventListener("pagehide",e),window.addEventListener("beforeunload",e),this._lifecycleCleanup=()=>{window.removeEventListener("pagehide",e),window.removeEventListener("beforeunload",e)}}const ld="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{};function cd(e){return Boolean(e)&&"object"==typeof e&&1===e.nodeType&&"function"==typeof e.appendChild}const ud=Object.freeze({NODE_ADD:"node:add",NODE_CHILDREN_CHANGED:"node:childrenchanged",NODE_LOADED:"node:loaded",NODE_LOAD_ERROR:"node:loaderror",PLACEMENT_ADDED:"placement:added",RENDER_PLACEMENT_ADDED:"renderplacement:added",TIMELINE_TIME_UPDATE:"timeline:timeupdate",TIMELINE_STATE_CHANGE:"statechange",TIMELINE_SEEKING:"seeking",TIMELINE_SEEKED:"seeked",TIMELINE_RESET:"timeline:reset",TIMELINE_PLAYER_STATE:"player:state",TIMELINE_CUEPOINT:"cuepoint",VISUAL_FRAMES_AVAILABLE:"visualframesavailable",TRACK_BUFFER_UPDATE:"track:bufferupdate",TRACK_READY:"track:ready",TRACK_UNDERFLOW:"track:underflow",CLOCK_TICK:"tick",DECODE_READY:"decode:ready",DECODE_ERROR:"decode:error",DECODER_AUDIO:"decoder:audio",DECODER_FRAME:"decoder:frame",DECODER_INIT:"decoder:init",DECODER_ERROR:"decoder:error",QOE_SCORE:"qoescore",QOE_STATUS:"qoestatus",CONTAINER_RESIZE:"containerresize",CANVAS_WEBGL_CONTEXT_LOST:"canvas.webglcontextlost",CANVAS_WEBGL_CONTEXT_RESTORED:"canvas.webglcontextrestored"});function dd(e,t){const n={};return Number.isFinite(e)&&(n.time=e),"string"==typeof t&&(n.source=t),n}function hd({placementId:e,nodeId:t,trackId:n,segmentId:i,trackType:r,pts:o,duration:s,frame:a,audioBuffer:l}={}){const c={};return e&&(c.placementId=e),t&&(c.nodeId=t),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 fd({placementId:e,nodeId:t,trackId:n,segmentId:i,trackType:r,error:o}={}){const s={};return e&&(s.placementId=e),t&&(s.nodeId=t),n&&(s.trackId=n),i&&(s.segmentId=i),r&&(s.trackType=r),o&&(s.error=o),s}var pd=new WeakMap,md=new WeakMap,vd=new WeakMap,gd=new WeakMap,yd=new WeakMap,bd=new WeakMap,kd=new WeakMap,wd=new WeakSet;let xd=class extends od{get defaults(){return{style:{width:"100%",height:"100%"},contextAttributes:{alpha:!1,depth:!1,stencil:!1,antialias:!1,preserveDrawingBuffer:!1,powerPreference:"low-power"}}}constructor(...e){var t,n;super(...e),O(this,wd),F(this,pd,void 0),F(this,md,void 0),F(this,vd,void 0),F(this,gd,void 0),F(this,yd,void 0),F(this,bd,void 0),F(this,kd,void 0);const[i,r=null]=e;C(bd,this,r);const o=function(e,t=(null==ld?void 0:ld.document)){if(cd(e))return e;const n="string"==typeof e?e:null;if(!n||!t||"function"!=typeof t.querySelector)return null;const i=t.querySelector(n);return cd(i)?i:null}(i);if(!o)throw new Error("Canvas requires a valid mount target (HTMLElement or selector string).");C(pd,this,o);const s=null==ld?void 0:ld.document;if(!s||"function"!=typeof s.createElement)throw new Error("Canvas requires document.createElement.");var a,l;C(md,this,s.createElement("canvas")),a=M(md,this),l=null===(t=this.settings)||void 0===t?void 0:t.style,a&&l&&"object"==typeof l&&!Array.isArray(l)&&Object.keys(l).forEach((e=>{const t=l[e];null!=t&&(a.style[e]=String(t))})),M(pd,this).appendChild(M(md,this));const c=null===(n=this.settings)||void 0===n?void 0:n.contextAttributes,u=c&&"object"==typeof c&&!Array.isArray(c)?c:void 0;if(C(kd,this,u),C(vd,this,M(md,this).getContext("webgl2",u)),!M(vd,this))throw new Error("Canvas WebGL2 context is not available.");A(wd,this,Td).call(this)}get name(){return"Canvas"}get element(){return M(md,this)}get gl(){return M(vd,this)}onDispose(){A(wd,this,Ed).call(this),M(md,this)&&M(md,this).parentNode&&M(md,this).parentNode.removeChild(M(md,this)),C(vd,this,null),C(md,this,null),C(pd,this,null),C(bd,this,null),C(kd,this,null),C(gd,this,null),C(yd,this,null)}};function _d(e,t){var n,i;this.trigger(e,t),null===(n=M(bd,this))||void 0===n||null===(i=n.trigger)||void 0===i||i.call(n,e,t)}function Td(){M(md,this)&&(C(gd,this,(e=>{"function"==typeof(null==e?void 0:e.preventDefault)&&e.preventDefault(),this.log.error("WebGL context lost",e),A(wd,this,_d).call(this,ud.CANVAS_WEBGL_CONTEXT_LOST,e)})),C(yd,this,(e=>{var t;C(vd,this,(null===(t=M(md,this))||void 0===t?void 0:t.getContext("webgl2",M(kd,this)))||null),M(vd,this)?A(wd,this,_d).call(this,ud.CANVAS_WEBGL_CONTEXT_RESTORED,e):this.log.error("WebGL context restored event fired but WebGL2 context is still unavailable.",e)})),M(md,this).addEventListener("webglcontextlost",M(gd,this)),M(md,this).addEventListener("webglcontextrestored",M(yd,this)))}function Ed(){M(md,this)&&(M(md,this).removeEventListener("webglcontextlost",M(gd,this)),M(md,this).removeEventListener("webglcontextrestored",M(yd,this)))}var Id=new WeakMap,Sd=new WeakMap,Ad=new WeakMap,Nd=new WeakMap,Md=new WeakMap,Fd=new WeakMap,Cd=new WeakSet;let Od=class extends od{get name(){return"ContainerSize"}get containerWidth(){return M(Sd,this)}get containerHeight(){return M(Ad,this)}get width(){return M(Sd,this)}get height(){return M(Ad,this)}constructor(...e){super(...e),O(this,Cd),F(this,Id,void 0),F(this,Sd,0),F(this,Ad,0),F(this,Nd,null),F(this,Md,null),F(this,Fd,null);const[t]=e;var n;C(Id,this,(n=t)&&n.element&&cd(n.element)?n.element:cd(n)?n:null),M(Id,this)&&(A(Cd,this,Rd).call(this,!0),A(Cd,this,Pd).call(this))}onDispose(){M(Nd,this)&&"function"==typeof M(Nd,this).disconnect&&M(Nd,this).disconnect(),C(Nd,this,null),M(Fd,this)&&"function"==typeof(null==ld?void 0:ld.removeEventListener)&&ld.removeEventListener("resize",M(Fd,this)),C(Fd,this,null),M(Md,this)&&((null==ld?void 0:ld.clearInterval)||clearInterval)(M(Md,this)),C(Md,this,null),C(Id,this,null)}};function Pd(){if(!M(Id,this))return;const e=null==ld?void 0:ld.ResizeObserver;if("function"==typeof e)return C(Nd,this,new e((()=>A(Cd,this,Rd).call(this)))),void M(Nd,this).observe(M(Id,this));C(Fd,this,(()=>A(Cd,this,Rd).call(this))),"function"==typeof(null==ld?void 0:ld.addEventListener)&&ld.addEventListener("resize",M(Fd,this));const t=(null==ld?void 0:ld.setInterval)||setInterval;C(Md,this,t((()=>A(Cd,this,Rd).call(this)),250))}function Rd(e=!1){if(!M(Id,this))return;const{width:t,height:n}=function(e){const t=Number(null==e?void 0:e.clientWidth),n=Number(null==e?void 0:e.clientHeight);return{width:Number.isFinite(t)&&t>0?Math.round(t):0,height:Number.isFinite(n)&&n>0?Math.round(n):0}}(M(Id,this));(e||t!==M(Sd,this)||n!==M(Ad,this))&&(C(Sd,this,t),C(Ad,this,n),this.trigger("containerresize",{width:t,height:n}))}var Dd={VIDEO_SOURCE_PREFIX:"__SRC_VID:",TEXTURE_SOURCE_PREFIX:"__SRC_TEXTURE:",PREVIOUS_OUTPUT_PREFIX:"__PREVIOUS:",SAVED_FRAME_PREFIX:"__SAVED_FRAME:",SYSTEM_NODES:{FILTERS:{RENDER_TO_CANVAS:"__default"},TAGS:{ATOM:"atom",FILTER:"filter",COMPOSITE_FILTER:"composite",TRANSITION_FILTER:"transition"}},MESSAGES:{UPDATE_OPTIONS:"update_options"}};let Ld=class{constructor(e,t){this.canvasSource=e,this.startRendering=t,this.gl=null,this.glOptions=null}init(e,t,n){this.glOptions=n||{};const i=this.initCanvas(this.canvasSource,e,t);return this.initWebgl(i,this.glOptions)}initCanvas(){throw new Error("implement on concrete class")}getContextConfig(e={}){if(!e||"object"!=typeof e)return{contextType:"webgl",contextAttributes:void 0};const{contextType:t,contextAttributes:n,__shaderGraph:i,...r}=e,o=Object.prototype.hasOwnProperty.call(e,"contextAttributes");let s=o?n:r;return o||!s||"object"!=typeof s||Array.isArray(s)||0!==Object.keys(s).length||(s=void 0),{contextType:t||"webgl",contextAttributes:s}}initWebgl(e,t={}){const{contextType:n,contextAttributes:i}=this.getContextConfig(t),r=e.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 Bd,zd={exports:{}},Wd=(Bd||(Bd=1,function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}function r(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,i,o,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");var a=new r(i,o||e,s),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}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 e,i,r=[];if(0===this._eventsCount)return r;for(i in e=this._events)t.call(e,i)&&r.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},a.prototype.listeners=function(e){var t=n?n+e:e,i=this._events[t];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(e){var t=n?n+e:e,i=this._events[t];return i?i.fn?1:i.length:0},a.prototype.emit=function(e,t,i,r,o,s){var a=n?n+e:e;if(!this._events[a])return!1;var l,c,u=this._events[a],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,i),!0;case 4:return u.fn.call(u.context,t,i,r),!0;case 5:return u.fn.call(u.context,t,i,r,o),!0;case 6:return u.fn.call(u.context,t,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(e,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,t);break;case 3:u[c].fn.call(u[c].context,t,i);break;case 4:u[c].fn.call(u[c].context,t,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(e,t,n){return o(this,e,t,n,!1)},a.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},a.prototype.removeListener=function(e,t,i,r){var o=n?n+e:e;if(!this._events[o])return this;if(!t)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==t||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!==t||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(e){var t;return e?(t=n?n+e:e,this._events[t]&&s(this,t)):(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,e.exports=a}(zd)),zd.exports),$d=Ru(Wd);let jd=class extends Ld{constructor(e){super(e,!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 t=new $d;this.on=t.on.bind(t),this.off=t.off.bind(t),this.once=t.once.bind(t),this.trigger=t.emit.bind(t)}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(e,t,n){var i;this.player=e,this.setSrcVidTracksFn=t;const{contextType:r,contextAttributes:o}=this.getContextConfig(this.glOptions),s=!1!==(null===(i=this.glOptions)||void 0===i||null===(i=i.__shaderGraph)||void 0===i?void 0:i.forwardContextAttributes)&&null!=(a=o)&&"object"==typeof a&&!Array.isArray(a)&&Object.keys(a).length>0;var a;const l={contextType:r};s&&(l.contextAttributes=o),e.initPlugin("canvas",l);const c={drawFrame:this.canvasDrawFrameFn.bind(this),resize:n,contextType:r,offscreenVideoCanvasEnabled:!1,viewportModeEnabled:!0,fps:0};return s&&(c.contextAttributes=o),e.canvas.init(c),e.paused&&0===e.currentTime&&(this.shouldUpdateTexture=!1),this.addPlayerListeners(),e.canvas.canvas}canvasDrawFrameFn(e,t,n){var i;this.setSrcVidTracksFn&&this.shouldUpdateTexture&&e&&t&&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((e=>{this.player.once("seeked",(()=>{this.shouldUpdateTexture=!0,e()})),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)}},Ud=class extends Ld{constructor(e){super(e,!1)}initCanvas(e,t){const n=function(){const e=document.querySelector("video");e&&e.videoHeight&&t(e),requestAnimationFrame(n)};return requestAnimationFrame(n),document.getElementById(e)}},qd=class extends Ld{constructor(e){super(e,!1)}initCanvas({src:e,dest:t},n,i){const r="string"==typeof t?document.querySelector(t):t,o="undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement,s=()=>{this.isDisposed||(e&&e.videoHeight&&n(e),requestAnimationFrame(s))};return o?requestAnimationFrame(s):"function"==typeof e?e(n,i):n(e),r}dispose(){this.isDisposed=!0}};var Vd=function(e){let t;return t="string"==typeof e?new Ud(e):e&&e.src&&e.dest?new qd(e):new jd(e),t};function Gd(e){return Array.isArray(e)||(e=[e]),e}let Hd=class{constructor(e){this.store=e?{...e.get()}:{}}reset(){this.store={}}get(e){if(!e)return this.store;const t=(e=Gd(e)).reduce(((e,t)=>{const n=this.store[t];return e.push(n),e}),[]);return 1===t.length?t[0]:t}set(e,t){if(e=Gd(e),t=Gd(t),e.length!==t.length)throw new Error(`cant set values ${t} to keys ${e}, length did not match`);e.forEach(((e,n)=>{this.store[e]=t[n]}))}},Kd=class{constructor(e,t,n,i){this.gl=i.gl,this.unit=e,this.bindPoint=t,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(e){this.height=e}setWidth(e){this.width=e}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 Xd=Ju("frame","warn");let Yd=!1;if("undefined"!=typeof window&&window.InterludePlayer){let e=window.InterludePlayer.environment,t=e.isAffectedBySafari17SeekBug,n=e.ua.includes("WMT1H")&&e.ua.includes("iOS/17");Yd=t||n}function Qd(e,t){const n=e.gl;var i;n.texImage2D(e.bindPoint,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t),e.__hasAllocated=!0,i=e,Number.isFinite(i.width)&&Number.isFinite(i.height)&&(i.actualWidth=i.width,i.actualHeight=i.height,i.textureObjectInfo&&(i.textureObjectInfo.allocatedWidth=i.width,i.textureObjectInfo.allocatedHeight=i.height))}let Jd=class extends Kd{fill(e){if(Yd&&(e.paused||"undefined"!=typeof document&&"hidden"===document.visibilityState))return;if(e.__closed)return;this.bind();const t=function(e,t){let n=!e.__hasAllocated;return t?(t.width===e.width&&t.height===e.height||(n=!0),e.width=t.width,e.height=t.height,n):n}(this,function(e){if(!e)return;const t=[[e.displayWidth,e.displayHeight],[e.codedWidth,e.codedHeight],[e.videoWidth,e.videoHeight],[e.naturalWidth,e.naturalHeight],[e.width,e.height]];for(let e=0;e<t.length;e+=1){const[n,i]=t[e],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}(e)),n=performance.now();!function(e,t,n){const i=e.gl,r=function(e){if("undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement)return!0;const t="object"==typeof window?window:"object"==typeof self?self:null,n=t&&t.VideoFrame;return"function"==typeof n&&e instanceof n}(t);r&&(e.__useSubImage=!1),n||!1===e.__useSubImage||r?Qd(e,t):(i.texSubImage2D(e.bindPoint,0,0,0,i.RGBA,i.UNSIGNED_BYTE,t),void 0===e.__useSubImage&&(i.getError()!==i.NO_ERROR?(e.__useSubImage=!1,Qd(e,t)):e.__useSubImage=!0))}(this,e,t);const i=(performance.now()-n)/1e3;i>=.1&&Xd.warn(`[fill] texImage2D() took ${i.toFixed(3)} seconds to execute.`),"function"==typeof e.close&&!0!==e.__keepOpen&&(e.close(),e.__closed=!0)}},Zd=class extends Kd{constructor(e,t,n){super(...arguments),n.needRefresh&&(this.fill(null),n.needRefresh=!1)}fill(e){if(this.bind(),e&&e.tagName&&"IMG"===e.tagName){const t=Number(e.naturalWidth||e.width),n=Number(e.naturalHeight||e.height);this.gl.texImage2D(this.bindPoint,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),Number.isFinite(t)&&Number.isFinite(n)&&(this.actualWidth=t,this.actualHeight=n,this.textureObjectInfo&&(this.textureObjectInfo.allocatedWidth=t,this.textureObjectInfo.allocatedHeight=n))}else{const t=this.gl.canvas.width,n=this.gl.canvas.height;this.gl.texImage2D(this.bindPoint,0,this.gl.RGBA,t,n,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),Number.isFinite(t)&&Number.isFinite(n)&&(this.actualWidth=t,this.actualHeight=n,this.textureObjectInfo&&(this.textureObjectInfo.allocatedWidth=t,this.textureObjectInfo.allocatedHeight=n))}}};var eh=function(e,t,n,i,r){let o;switch(e){case"frame":o=new Jd(t,n,i,r);break;case"pixel":o=new Zd(t,n,i,r);break;default:throw new Error(`cant recognize type ${e}`)}return o};let th=class{constructor(e){this.gl=e.gl;const t=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS)||20;return this.maxTextures=Math.min(20,t),this.textureObjectPool=[],this.textureUnitsPool=new Set(Array(this.maxTextures).keys()),this.activeTextures=e.activeTextures instanceof Set?e.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 e=this.textureUnitsPool.values(),t=Math.min.apply(null,[...e]);return this.textureUnitsPool.delete(t),t}createTexture(e){const t=e&&e.type||{},n=this.gl.TEXTURE_2D,i=this.getTextureUnit(),r=this.getTextureObject(),o=eh(t,i,n,r,{gl:this.gl});return this.activeTextures.add(o),o}releaseTexture(e){this.textureUnitsPool.has(e.getUnit())||(this.textureObjectPool.push({object:e.getObject(),needRefresh:!1}),this.textureUnitsPool.add(e.getUnit())),this.activeTextures.delete(e)}refreshTextureObjects(){this.textureObjectPool.forEach((e=>{e.needRefresh=!0}))}refreshActiveTextures(){const e=new Set;this.activeTextures.forEach((t=>{if(!t||"function"!=typeof t.getUnit)return;e.add(t.getUnit());const n={object:this.gl.createTexture(),needRefresh:!0};t.gl=this.gl,t.textureObjectInfo=n,t.textureObject=n.object,t.__hasAllocated=!1,t.__useSubImage=void 0,t.actualWidth=null,t.actualHeight=null,"function"==typeof t.setParameters&&t.setParameters()})),this.textureObjectPool=[],this.textureUnitsPool=new Set(Array(this.maxTextures).keys()),e.forEach((e=>{this.textureUnitsPool.delete(e)}))}};const nh=Dd.VIDEO_SOURCE_PREFIX,ih=Dd.TEXTURE_SOURCE_PREFIX,rh=Dd.PREVIOUS_OUTPUT_PREFIX,oh=Dd.SAVED_FRAME_PREFIX;function sh(e,t,n){e.set(`${nh}${n}`,t)}function ah(e,t,n){e.set(`${rh}${n}`,t)}function lh(e,t,n){e.set(`${oh}${n}`,t)}let ch=class{constructor(e){return this.gl=e.gl,this.glSource=e.glSource,this.textureManager=e.textureManager,this.capturedFramesManager=e.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(e){for(const[t,n]of Object.entries(this.capturedFramesManager.getCurrentFrames()))sh(e,n,t),ah(e,n,t);for(const[t,n]of Object.entries(this.capturedFramesManager.getSavedFrames()))lh(e,n,t)}setTextureSource(e,t,n){e.set(`${ih}${n}`,t)}getInput(e,t){return e.get(t)}getPrevOutput(e,t){return t=Number.isInteger(t)?t:0,e.get(`${rh}${t}`)}setOutputs(e,t=[],n=[]){if(Array.isArray(n)||(n=[n]),t.length>n.length)throw new Error(`output ids ${t.length} is bigger then supplied outputs ${n.length}`);n.forEach(((t,n)=>{ah(e,t,n)})),t.forEach(((t,i)=>{e.set(t,n[i])}))}disposeTextures(e,t){const n=t.getUnit();e.forEach((e=>{const t=e.getUnit();this.capturedFramesManager.isReservedUnit(t)||n===t||this.textureManager.releaseTexture(e)}))}disposeAllStore(e){const t=new Set;Object.values(e.get()).forEach((e=>{const n=e.getUnit();this.capturedFramesManager.isReservedUnit(n)||t.has(n)||e.isStatic||(this.textureManager.releaseTexture(e),t.add(n))}))}},uh=class{constructor(e){this.context=e}bind(){throw new Error("impl in concrete")}},dh=100,hh=100;function fh(e,t){dh=e,hh=t}let ph=class extends uh{bind(e){var t,n;this.context.gl.bindFramebuffer(this.context.gl.FRAMEBUFFER,null);const i=null===(t=this.context.gl)||void 0===t||null===(t=t.canvas)||void 0===t?void 0:t.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),fh(i,r)),e}},mh=class extends uh{bind(e){Array.isArray(e)||(e=[e]),this.context.gl.bindFramebuffer(this.context.gl.FRAMEBUFFER,this.context.frameBufferObject);const t=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,t.textureObject,0),this.context.gl.clear(this.context.gl.COLOR_BUFFER_BIT),!0===this.context.useCanvasSizedFilterTargets){var i,r;const e=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(e)&&e>0&&t.setWidth(e),Number.isFinite(n)&&n>0&&t.setHeight(n);const o=t.textureObjectInfo,s=null==o?void 0:o.allocatedWidth,a=null==o?void 0:o.allocatedHeight;Number.isFinite(e)&&Number.isFinite(n)&&(s!==e||a!==n)&&"function"==typeof t.fill&&t.fill(null)}else e[0]&&(t.setHeight(e[0].getHeight()),t.setWidth(e[0].getWidth()));return t}},vh=class{constructor(e){this.gl=e.gl,this.textureManager=e.textureManager,this.useCanvasSizedFilterTargets=e.useCanvasSizedFilterTargets,this.bufferIndex=0,this.frameBufferObjectsPool=[this.gl.createFramebuffer(),this.gl.createFramebuffer(),this.gl.createFramebuffer()]}getFrameBufferObject(){const e=this.frameBufferObjectsPool[this.bufferIndex];return this.bufferIndex=this.bufferIndex++%this.frameBufferObjectsPool.length,e}create(e){let t;return t=e===Dd.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS?new ph({gl:this.gl}):new mh({gl:this.gl,textureManager:this.textureManager,frameBufferObject:this.getFrameBufferObject(),useCanvasSizedFilterTargets:this.useCanvasSizedFilterTargets}),t}};function gh(e,t,n){const i=t===e.VERTEX_SHADER?"vertex":"fragment";var r;r=e,Boolean(r)&&("undefined"!=typeof WebGL2RenderingContext&&r instanceof WebGL2RenderingContext||"function"==typeof r.createVertexArray)&&(n=function(e="",t){if("string"!=typeof e||!e||function(e=""){return"string"==typeof e&&e.includes("#version 300 es")}(e))return e;let n=e;if("vertex"===t&&(n=n.replace(/\battribute\b/g,"in"),n=n.replace(/\bvarying\b/g,"out")),"fragment"===t&&(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"===t&&n.includes("fragColor")&&!/\bout\s+vec4\s+fragColor\s*;/.test(n)){const e=n.split("\n");let t=1;for(let n=1;n<e.length;n+=1)if(e[n].trim().startsWith("precision ")){t=n+1;break}e.splice(t,0,"out vec4 fragColor;"),n=e.join("\n")}return n}(n,i));const o=e.createShader(t);if(!o)throw new Error(`Failed to create ${i} shader`);if(e.shaderSource(o,n),e.compileShader(o),e.getShaderParameter(o,e.COMPILE_STATUS))return o;const s=e.getShaderInfoLog(o);throw e.deleteShader(o),new Error(s)}var yh=function(e,t){return gh(e,e.VERTEX_SHADER,t)},bh=function(e,t){return gh(e,e.FRAGMENT_SHADER,t)};const kh={position_3d:0,texture_coordinate_2d:1};var wh=function(e,t,n){const i=e.createProgram();if(e.attachShader(i,t),e.attachShader(i,n),Object.entries(kh).forEach((([t,n])=>{e.bindAttribLocation(i,n,t)})),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS))return i;const r=e.getProgramInfoLog(i);throw e.deleteProgram(i),new Error(r)},xh=[-1,-1,1,1,-1,1,-1,1,1,1,1,1],_h=[0,1,2,2,1,3],Th=[0,0,1,0,0,1,1,1];const Eh=96,Ih=[new Float32Array(new ArrayBuffer(Eh)),new Float32Array(new ArrayBuffer(Eh)),new Float32Array(new ArrayBuffer(Eh)),new Float32Array(new ArrayBuffer(Eh)),new Float32Array(new ArrayBuffer(Eh)),new Float32Array(new ArrayBuffer(Eh))],Sh=[new Int16Array(6),new Int16Array(6),new Int16Array(6)];let Ah=class{constructor(e,t,n){return this.gl=n.gl,this.program=n.program,this.bindPoint=t,this.location=this.gl.getAttribLocation(this.program,e),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 e;switch(this.bindPoint){case this.gl.ARRAY_BUFFER:e=Ih[this.floatBufferCounter],this.floatBufferCounter=this.floatBufferCounter++%Ih.length;break;case this.gl.ELEMENT_ARRAY_BUFFER:e=Sh[this.unit16BufferCounter],this.unit16BufferCounter=this.unit16BufferCounter++%Sh.length;break;default:throw new Error("cant get buffer for this bind point: ",this.bindPoint)}return e}fillBuffer(e){this.bindBuffer();const t=this.getBuffer();t.set(e,0),this.gl.bufferData(this.bindPoint,t,this.gl.STATIC_DRAW)}getPointerData(){throw new Error("you should impl this function")}setPointer(){this.bindBuffer(),this.enable();const e=this.getPointerData();this.gl.vertexAttribPointer(this.location,e.size,e.type,e.normalize,e.stride,e.offset)}dispose(){this.gl.deleteBuffer(this.buffer)}};const Nh={position_3d:class extends Ah{getPointerData(){return{size:3,type:this.gl.FLOAT,normalize:!1,stride:0,offset:0}}},position_indexes:class extends Ah{setPointer(){}getPointerData(){}enable(){}},texture_coordinate_2d:class extends Ah{getPointerData(){return{size:2,type:this.gl.FLOAT,normalize:!0,stride:0,offset:0}}}};var Mh=function(e,t,n){const i=Nh[e];if(!i)throw new Error(`${e} is not a attribute name,choose from list: ${Object.keys(Nh)}`);return new i(e,t,n)};let Fh=class{constructor(e,t){this.gl=t.gl,this.program=t.program,this.location=this.gl.getUniformLocation(this.program,e)}compute(){return this}set(){return this}},Ch=class extends Fh{set(e){this.gl.uniform1fv(this.location,e)}},Oh=class extends Fh{set(e){e&&(e.beforeUse(),this.gl.uniform1i(this.location,e.getUnit()))}};const Ph="first_texture_dimensions",Rh="viewport_dimensions",Dh="time",Lh={RUNTIME_OPTIONS:"runtimeOptions[0]",STATIC_OPTIONS:"staticOptions[0]",FIRST_TEXTURE:"first_texture",SECOND_TEXTURE:"second_texture",FIRST_MATRIX:"first_mat4"},Bh={[Lh.FIRST_TEXTURE]:Oh,[Lh.SECOND_TEXTURE]:Oh,[Lh.FIRST_MATRIX]:class extends Fh{set(e){this.gl.uniformMatrix4fv(this.location,!1,e)}},[Lh.STATIC_OPTIONS]:Ch,[Lh.RUNTIME_OPTIONS]:Ch};var zh=function(e,t){const n=Bh[e];if(!n)throw new Error(`${e} is not a attribute name,choose from list: ${Object.keys(Bh)}`);return new n(e,t)},Wh=function(e,t){let n=(Date.now()-e||0)/(t||1);return n=Number.parseFloat(n).toFixed(7),n=Math.min(1,n),n};const $h="position_3d",jh="position_indexes",Uh="texture_coordinate_2d";class qh{constructor(e,t,n,i){this.type=e,this.gl=i.gl,this.frameBuffer=i.frameBufferFactory.create(e),this.rebindAttributesOnProgramSwitch=!1!==i.rebindAttributesOnProgramSwitch,this.vertexShader=yh(this.gl,t.vertex),this.fragmentShader=bh(this.gl,t.fragment),this.program=wh(this.gl,this.vertexShader,this.fragmentShader);const r={gl:this.gl,program:this.program};this.attributes=function(e,t){const n={};return e=e||[],(e=[{id:$h,bindPoint:t.gl.ARRAY_BUFFER},{id:jh,bindPoint:t.gl.ELEMENT_ARRAY_BUFFER},{id:Uh,bindPoint:t.gl.ARRAY_BUFFER}].concat(e)).forEach((e=>{const i=e.id;n[i]=Mh(i,e.bindPoint,t)})),n}(n.attributes,r),this.uniforms=function(e,t){const n={};return(e=e||[]).forEach((e=>{const i=e.id;n[i]=zh(i,t)})),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(e){let t=[{id:Lh.RUNTIME_OPTIONS},{id:Lh.STATIC_OPTIONS}];return(e.getUniformList||qh.getUniformList)().forEach((e=>{Object.values(Lh).includes(e)&&t.push({id:e})})),t}handleRuntimeUniforms(e,t){const{inputTextures:n,viewportDimensions:i}=e;let r=Array.isArray(n)?n:[n],o=[];(this.constructor.getUniformList||qh.getUniformList)().forEach((e=>{switch(e){case Lh.FIRST_TEXTURE:this.uniforms[Lh.FIRST_TEXTURE].set(r[0]);break;case Lh.SECOND_TEXTURE:this.uniforms[Lh.SECOND_TEXTURE].set(r[1]);break;case Ph:o=[...o,r[0].getWidth(),r[0].getHeight()];break;case Rh:o=[...o,i.width,i.height];break;case Dh:{const e=Wh(t.startTime,t.duration);o=[...o,e];break}}})),o.length>0&&this.uniforms[Lh.RUNTIME_OPTIONS].set(o)}static getUniformList(){return[Lh.FIRST_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(){}handleAttributes(){this.attributes[$h].fillBuffer(xh),this.attributes[$h].setPointer(),this.attributes[jh].fillBuffer(_h),this.attributes[Uh].fillBuffer(Th),this.attributes[Uh].setPointer()}disposeAttributes(){Object.values(this.attributes).forEach((e=>{e.dispose()}))}render(e,t){const n=this.frameBuffer.bind(e);let i={width:dh,height:hh};return this.gl.useProgram(this.program),this.rebindAttributesOnProgramSwitch&&this.gl.__shaderGraphLastProgram!==this.program&&(this.handleAttributes(),this.gl.__shaderGraphLastProgram=this.program),this.handleRuntimeUniforms({inputTextures:e,viewportDimensions:i},t),this.draw(),n}draw(){const e=this.gl.TRIANGLES,t=this.gl.UNSIGNED_SHORT;this.gl.drawElements(e,6,t,0)}updateStaticUniforms(e){this.gl.useProgram(this.program),this.handleStaticUniforms(e)}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)}}var Vh,Gh="undefined"!=typeof Float32Array?Float32Array:Array;function Hh(){var e=new Gh(3);return Gh!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Kh(e,t,n){var i=new Gh(3);return i[0]=e,i[1]=t,i[2]=n,i}function Xh(){var e=new Gh(4);return Gh!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}Hh(),function(){var e;e=new Gh(4),Gh!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0)}(),Hh(),Kh(1,0,0),Kh(0,1,0),Xh(),Xh(),Vh=new Gh(9),Gh!=Float32Array&&(Vh[1]=0,Vh[2]=0,Vh[3]=0,Vh[5]=0,Vh[6]=0,Vh[7]=0),Vh[0]=1,Vh[4]=1,Vh[8]=1;class Yh extends qh{constructor(e){const t={uniforms:qh.getUniformInfo(Yh)};super(Yh.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}"},t,e)}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:Yh.getInitialOptions().translate.x},{properties:["translate","y"],type:"slider",minValue:-2,maxValue:2,step:.001,initialValue:Yh.getInitialOptions().translate.y},{properties:["scale","x"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:Yh.getInitialOptions().scale.x},{properties:["scale","y"],type:"slider",minValue:-10,maxValue:10,step:.001,initialValue:Yh.getInitialOptions().scale.y},{properties:["rotate"],type:"slider",minValue:-360,maxValue:360,step:1,initialValue:Yh.getInitialOptions().rotate}]}static getUniformList(){return[Lh.FIRST_TEXTURE,Lh.FIRST_MATRIX]}handleStaticUniforms(e){if(!e||!e.translate||!e.scale)throw new Error(`bad options object for Transform filter, check ${e}`);const t=Number.parseFloat(e.translate.x).toFixed(7),n=-1*Number.parseFloat(e.translate.y).toFixed(7),i=Number.parseFloat(e.scale.x).toFixed(7),r=Number.parseFloat(e.scale.y).toFixed(7),o=e.rotate||0;var s;this.transformMatrix=function(e,t,n,i){var r=t[0],o=t[1],s=t[2],a=t[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],w=i[1],x=i[2];return e[0]=(1-(p+v))*k,e[1]=(h+b)*k,e[2]=(f-y)*k,e[3]=0,e[4]=(h-b)*w,e[5]=(1-(d+v))*w,e[6]=(m+g)*w,e[7]=0,e[8]=(f+y)*x,e[9]=(m-g)*x,e[10]=(1-(d+p))*x,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}((s=new Gh(16),Gh!=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(e,t,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",o=Math.PI/360;t*=o,i*=o,n*=o;var s=Math.sin(t),a=Math.cos(t),l=Math.sin(n),c=Math.cos(n),u=Math.sin(i),d=Math.cos(i);switch(r){case"xyz":e[0]=s*c*d+a*l*u,e[1]=a*l*d-s*c*u,e[2]=a*c*u+s*l*d,e[3]=a*c*d-s*l*u;break;case"xzy":e[0]=s*c*d-a*l*u,e[1]=a*l*d-s*c*u,e[2]=a*c*u+s*l*d,e[3]=a*c*d+s*l*u;break;case"yxz":e[0]=s*c*d+a*l*u,e[1]=a*l*d-s*c*u,e[2]=a*c*u-s*l*d,e[3]=a*c*d+s*l*u;break;case"yzx":e[0]=s*c*d+a*l*u,e[1]=a*l*d+s*c*u,e[2]=a*c*u-s*l*d,e[3]=a*c*d-s*l*u;break;case"zxy":e[0]=s*c*d-a*l*u,e[1]=a*l*d+s*c*u,e[2]=a*c*u+s*l*d,e[3]=a*c*d-s*l*u;break;case"zyx":e[0]=s*c*d-a*l*u,e[1]=a*l*d+s*c*u,e[2]=a*c*u-s*l*d,e[3]=a*c*d+s*l*u;break;default:throw new Error("Unknown angle order "+r)}return e}(Xh(),0,0,o),Kh(t,n,0),Kh(i,r,1)),this.uniforms[Lh.FIRST_MATRIX].set(this.transformMatrix)}}class Qh extends qh{constructor(e){const t={uniforms:qh.getUniformInfo(Qh)};super(Qh.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}"},t,e)}static getFilterType(){return"horizontalBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[Lh.FIRST_TEXTURE,Ph]}}class Jh extends qh{constructor(e){const t={uniforms:qh.getUniformInfo(Jh)};super(Jh.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}"},t,e)}static getFilterType(){return"verticalBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[Lh.FIRST_TEXTURE,Ph]}}class Zh extends qh{constructor(e){const t={uniforms:qh.getUniformInfo(Zh)};super(Zh.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}"},t,e)}static getFilterType(){return"fastBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[Lh.FIRST_TEXTURE,Ph,Rh]}handleStaticUniforms(e){var t;const n=(null!==(t=Number.parseFloat(e.offsetDist))&&void 0!==t?t:4).toFixed(3);this.uniforms[Lh.STATIC_OPTIONS].set([n])}}class ef extends qh{constructor(e){const t={uniforms:qh.getUniformInfo(ef)};super(ef.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\n\nuniform float staticOptions[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}"},t,e)}static getFilterType(){return"directionalBlur"}static getInputsCount(){return 1}static getInitialOptions(){return{}}static getUniformList(){return[Lh.FIRST_TEXTURE,Ph,Rh]}handleStaticUniforms(e){var t,n;const i=(null!==(t=Number.parseFloat(e.angle))&&void 0!==t?t:90).toFixed(3),r=(null!==(n=Number.parseFloat(e.strength))&&void 0!==n?n:.1).toFixed(3);this.uniforms[Lh.STATIC_OPTIONS].set([i,r])}}class tf extends qh{constructor(e){const t={uniforms:qh.getUniformInfo(tf)};super(tf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n \n current_texture_coordinate_2d = texture_coordinate_2d;\n}",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}"},t,e)}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(e){const t=Number.parseFloat(e.power).toFixed(7);this.uniforms[Lh.STATIC_OPTIONS].set([t])}}class nf extends qh{constructor(e){const t={uniforms:qh.getUniformInfo(nf)};super(nf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\nvarying vec2 current_position_coordinate_2d;\n\nvoid main() {\n vec4 normalize_poistion = vec4(position_3d.xyz, 1);\n gl_Position = normalize_poistion;\n\n current_texture_coordinate_2d = texture_coordinate_2d;\n current_position_coordinate_2d = normalize_poistion.xy;\n}",fragment:"precision lowp float;\n\nuniform sampler2D first_texture;\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}"},t,e)}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[Lh.FIRST_TEXTURE,Ph,Lh.SECOND_TEXTURE]}handleStaticUniforms(e){let t;switch(e.type){case"box":t=0;break;case"rounded":t=1;break;default:throw new Error("cant recognize shape composite mask type")}const n=Number.parseFloat(e.center.x).toFixed(7);let i=Number.parseFloat(e.center.y).toFixed(7);i+=0;const r=Number.parseFloat(e.area.width).toFixed(7),o=Number.parseFloat(e.area.height).toFixed(7),s=Number.parseFloat(e.radius).toFixed(7),a=Number.parseFloat(e.edgeSoftness).toFixed(7);this.uniforms[Lh.STATIC_OPTIONS].set([t,n,i,r,o,s,a])}}class rf extends qh{constructor(e){const t={uniforms:qh.getUniformInfo(rf)};super(rf.getFilterType(),{vertex:"attribute vec3 position_3d;\nattribute vec2 texture_coordinate_2d;\n\nvarying vec2 current_texture_coordinate_2d;\n\nvoid main() {\n vec4 normalize_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}"},t,e)}static getFilterType(){return"shapeComposite"}static getInputsCount(){return 2}static getInitialOptions(){return{}}static getUniformList(){return[Lh.FIRST_TEXTURE,Lh.SECOND_TEXTURE]}}class of extends qh{constructor(e){const t={uniforms:qh.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;\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"},t,e)}static getFilterType(){return"lut"}static getInputsCount(){return 2}static getInitialOptions(){return{}}static getUniformList(){return[Lh.FIRST_TEXTURE,Lh.SECOND_TEXTURE]}getOptionsDisplay(){return[]}handleStaticUniforms(e){const t=Number.parseFloat(e.lutSize).toFixed(1);this.uniforms[Lh.STATIC_OPTIONS].set([t])}}var sf="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",af='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:lf,cos:cf,sin:uf,acos:df,atan2:hf,sqrt:ff,pow:pf}=Math;function mf(e){return e<0?-pf(-e,1/3):pf(e,1/3)}const vf=Math.PI,gf=2*vf,yf=vf/2,bf=Number.MAX_SAFE_INTEGER||9007199254740991,kf=Number.MIN_SAFE_INTEGER||-9007199254740991,wf={x:0,y:0,z:0},xf={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(e,t){const n=t(e);let i=n.x*n.x+n.y*n.y;return void 0!==n.z&&(i+=n.z*n.z),ff(i)},compute:function(e,t,n){if(0===e)return t[0].t=0,t[0];const i=t.length-1;if(1===e)return t[i].t=1,t[i];const r=1-e;let o=t;if(0===i)return t[0].t=e,t[0];if(1===i){const t={x:r*o[0].x+e*o[1].x,y:r*o[0].y+e*o[1].y,t:e};return n&&(t.z=r*o[0].z+e*o[1].z),t}if(i<4){let t,s,a,l=r*r,c=e*e,u=0;2===i?(o=[o[0],o[1],o[2],wf],t=l,s=r*e*2,a=c):3===i&&(t=l*r,s=l*e*3,a=r*c*3,u=e*c);const d={x:t*o[0].x+s*o[1].x+a*o[2].x+u*o[3].x,y:t*o[0].y+s*o[1].y+a*o[2].y+u*o[3].y,t:e};return n&&(d.z=t*o[0].z+s*o[1].z+a*o[2].z+u*o[3].z),d}const s=JSON.parse(JSON.stringify(t));for(;s.length>1;){for(let t=0;t<s.length-1;t++)s[t]={x:s[t].x+(s[t+1].x-s[t].x)*e,y:s[t].y+(s[t+1].y-s[t].y)*e},void 0!==s[t].z&&(s[t].z=s[t].z+(s[t+1].z-s[t].z)*e);s.splice(s.length-1,1)}return s[0].t=e,s[0]},computeWithRatios:function(e,t,n,i){const r=1-e,o=n,s=t;let a,l=o[0],c=o[1],u=o[2],d=o[3];return l*=r,c*=e,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:e}):(l*=r,c*=2*r,u*=e*e,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:e}):(l*=r,c*=1.5*r,u*=3*r,d*=e*e*e,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:e}):void 0))},derive:function(e,t){const n=[];for(let i=e,r=i.length,o=r-1;r>1;r--,o--){const e=[];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)},t&&(n.z=o*(i[r+1].z-i[r].z)),e.push(n);n.push(e),i=e}return n},between:function(e,t,n){return t<=e&&e<=n||xf.approximately(e,t)||xf.approximately(e,n)},approximately:function(e,t,n){return lf(e-t)<=(n||1e-6)},length:function(e){const t=xf.Tvalues.length;let n=0;for(let i,r=0;r<t;r++)i=.5*xf.Tvalues[r]+.5,n+=xf.Cvalues[r]*xf.arcfn(i,e);return.5*n},map:function(e,t,n,i,r){return i+(e-t)/(n-t)*(r-i)},lerp:function(e,t,n){const i={x:t.x+e*(n.x-t.x),y:t.y+e*(n.y-t.y)};return void 0!==t.z&&void 0!==n.z&&(i.z=t.z+e*(n.z-t.z)),i},pointToString:function(e){let t=e.x+"/"+e.y;return void 0!==e.z&&(t+="/"+e.z),t},pointsToString:function(e){return"["+e.map(xf.pointToString).join(", ")+"]"},copy:function(e){return JSON.parse(JSON.stringify(e))},angle:function(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=n.x-e.x,s=n.y-e.y;return hf(i*s-r*o,i*o+r*s)},round:function(e,t){const n=""+e,i=n.indexOf(".");return parseFloat(n.substring(0,i+1+t))},dist:function(e,t){const n=e.x-t.x,i=e.y-t.y;return ff(n*n+i*i)},closest:function(e,t){let n,i,r=pf(2,63);return e.forEach((function(e,o){i=xf.dist(t,e),i<r&&(r=i,n=o)})),{mdist:r,mpos:n}},abcratio:function(e,t){if(2!==t&&3!==t)return!1;if(void 0===e)e=.5;else if(0===e||1===e)return e;const n=pf(e,t)+pf(1-e,t);return lf((n-1)/n)},projectionratio:function(e,t){if(2!==t&&3!==t)return!1;if(void 0===e)e=.5;else if(0===e||1===e)return e;const n=pf(1-e,t);return n/(pf(e,t)+n)},lli8:function(e,t,n,i,r,o,s,a){const l=(e-n)*(o-a)-(t-i)*(r-s);return 0!=l&&{x:((e*i-t*n)*(r-s)-(e-n)*(r*a-o*s))/l,y:((e*i-t*n)*(o-a)-(t-i)*(r*a-o*s))/l}},lli4:function(e,t,n,i){const r=e.x,o=e.y,s=t.x,a=t.y,l=n.x,c=n.y,u=i.x,d=i.y;return xf.lli8(r,o,s,a,l,c,u,d)},lli:function(e,t){return xf.lli4(e,e.c,t,t.c)},makeline:function(e,t){return new Cf(e.x,e.y,(e.x+t.x)/2,(e.y+t.y)/2,t.x,t.y)},findbbox:function(e){let t=bf,n=bf,i=kf,r=kf;return e.forEach((function(e){const o=e.bbox();t>o.x.min&&(t=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:t,mid:(t+i)/2,max:i,size:i-t},y:{min:n,mid:(n+r)/2,max:r,size:r-n}}},shapeintersections:function(e,t,n,i,r){if(!xf.bboxoverlap(t,i))return[];const o=[],s=[e.startcap,e.forward,e.back,e.endcap],a=[n.startcap,n.forward,n.back,n.endcap];return s.forEach((function(t){t.virtual||a.forEach((function(i){if(i.virtual)return;const s=t.intersects(i,r);s.length>0&&(s.c1=t,s.c2=i,s.s1=e,s.s2=n,o.push(s))}))})),o},makeshape:function(e,t,n){const i=t.points.length,r=e.points.length,o=xf.makeline(t.points[i-1],e.points[0]),s=xf.makeline(e.points[r-1],t.points[0]),a={startcap:o,forward:e,back:t,endcap:s,bbox:xf.findbbox([o,e,t,s]),intersections:function(e){return xf.shapeintersections(a,a.bbox,e,e.bbox,n)}};return a},getminmax:function(e,t,n){if(!n)return{min:0,max:0};let i,r,o=bf,s=kf;-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=e.get(i),r[t]<o&&(o=r[t]),r[t]>s&&(s=r[t]);return{min:o,mid:(o+s)/2,max:s,size:s-o}},align:function(e,t){const n=t.p1.x,i=t.p1.y,r=-hf(t.p2.y-i,t.p2.x-n);return e.map((function(e){return{x:(e.x-n)*cf(r)-(e.y-i)*uf(r),y:(e.x-n)*uf(r)+(e.y-i)*cf(r)}}))},roots:function(e,t){t=t||{p1:{x:0,y:0},p2:{x:1,y:0}};const n=e.length-1,i=xf.align(e,t),r=function(e){return 0<=e&&e<=1};if(2===n){const e=i[0].y,t=i[1].y,n=i[2].y,o=e-2*t+n;if(0!==o){const i=-ff(t*t-e*n),s=-e+t;return[-(i+s)/o,-(-i+s)/o].filter(r)}return t!==n&&0===o?[(2*t-n)/(2*t-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(xf.approximately(l,0)){if(xf.approximately(c,0))return xf.approximately(u,0)?[]:[-d/u].filter(r);const e=ff(u*u-4*c*d),t=2*c;return[(e-u)/t,(-u-e)/t].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,w;if(v<0){const e=-h/3,t=ff(e*e*e),n=-p/(2*t),i=df(n<-1?-1:n>1?1:n),o=2*mf(t);return b=o*cf(i/3)-c/3,k=o*cf((i+gf)/3)-c/3,w=o*cf((i+2*gf)/3)-c/3,[b,k,w].filter(r)}if(0===v)return g=m<0?mf(-m):-mf(m),b=2*g-c/3,k=-g-c/3,[b,k].filter(r);{const e=ff(v);return g=mf(-m+e),y=mf(m+e),[g-y-c/3].filter(r)}},droots:function(e){if(3===e.length){const t=e[0],n=e[1],i=e[2],r=t-2*n+i;if(0!==r){const e=-ff(n*n-t*i),o=-t+n;return[-(e+o)/r,-(-e+o)/r]}return n!==i&&0===r?[(2*n-i)/(2*(n-i))]:[]}if(2===e.length){const t=e[0],n=e[1];return t!==n?[t/(t-n)]:[]}return[]},curvature:function(e,t,n,i,r){let o,s,a,l,c=0,u=0;const d=xf.compute(e,t),h=xf.compute(e,n),f=d.x*d.x+d.y*d.y;if(i?(o=ff(pf(d.y*h.z-h.y*d.z,2)+pf(d.z*h.x-h.z*d.x,2)+pf(d.x*h.y-h.x*d.y,2)),s=pf(f+d.z*d.z,1.5)):(o=d.x*h.y-d.y*h.x,s=pf(f,1.5)),0===o||0===s)return{k:0,r:0};if(c=o/s,u=s/o,!r){const r=xf.curvature(e-.001,t,n,i,!0).k,o=xf.curvature(e+.001,t,n,i,!0).k;l=(o-c+(c-r))/2,a=(lf(o-c)+lf(c-r))/2}return{k:c,r:u,dk:l,adk:a}},inflections:function(e){if(e.length<4)return[];const t=xf.align(e,{p1:e[0],p2:e.slice(-1)[0]}),n=t[2].x*t[1].y,i=t[3].x*t[1].y,r=t[1].x*t[2].y,o=18*(-3*n+2*i+3*r-t[3].x*t[2].y),s=18*(3*n-i-3*r),a=18*(r-n);if(xf.approximately(o,0)){if(!xf.approximately(s,0)){let e=-a/s;if(0<=e&&e<=1)return[e]}return[]}const l=2*o;if(xf.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(e){return 0<=e&&e<=1}))},bboxoverlap:function(e,t){const n=["x","y"],i=n.length;for(let r,o,s,a,l=0;l<i;l++)if(r=n[l],o=e[r].mid,s=t[r].mid,a=(e[r].size+t[r].size)/2,lf(o-s)>=a)return!1;return!0},expandbox:function(e,t){t.x.min<e.x.min&&(e.x.min=t.x.min),t.y.min<e.y.min&&(e.y.min=t.y.min),t.z&&t.z.min<e.z.min&&(e.z.min=t.z.min),t.x.max>e.x.max&&(e.x.max=t.x.max),t.y.max>e.y.max&&(e.y.max=t.y.max),t.z&&t.z.max>e.z.max&&(e.z.max=t.z.max),e.x.mid=(e.x.min+e.x.max)/2,e.y.mid=(e.y.min+e.y.max)/2,e.z&&(e.z.mid=(e.z.min+e.z.max)/2),e.x.size=e.x.max-e.x.min,e.y.size=e.y.max-e.y.min,e.z&&(e.z.size=e.z.max-e.z.min)},pairiteration:function(e,t,n){const i=e.bbox(),r=t.bbox(),o=1e5,s=n||.5;if(i.x.size+i.y.size<s&&r.x.size+r.y.size<s)return[(o*(e._t1+e._t2)/2|0)/o+"/"+(o*(t._t1+t._t2)/2|0)/o];let a=e.split(.5),l=t.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(e){return xf.bboxoverlap(e.left.bbox(),e.right.bbox())}));let u=[];return 0===c.length||(c.forEach((function(e){u=u.concat(xf.pairiteration(e.left,e.right,s))})),u=u.filter((function(e,t){return u.indexOf(e)===t}))),u},getccenter:function(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=n.x-t.x,s=n.y-t.y,a=i*cf(yf)-r*uf(yf),l=i*uf(yf)+r*cf(yf),c=o*cf(yf)-s*uf(yf),u=o*uf(yf)+s*cf(yf),d=(e.x+t.x)/2,h=(e.y+t.y)/2,f=(t.x+n.x)/2,p=(t.y+n.y)/2,m=d+a,v=h+l,g=f+c,y=p+u,b=xf.lli8(d,h,m,v,f,p,g,y),k=xf.dist(b,e);let w,x=hf(e.y-b.y,e.x-b.x),_=hf(t.y-b.y,t.x-b.x),T=hf(n.y-b.y,n.x-b.x);return x<T?((x>_||_>T)&&(x+=gf),x>T&&(w=T,T=x,x=w)):T<_&&_<x?(w=T,T=x,x=w):T+=gf,b.s=x,b.e=T,b.r=k,b},numberSort:function(e,t){return e-t}};class _f{constructor(e){this.curves=[],this._3d=!1,e&&(this.curves=e,this._3d=this.curves[0]._3d)}valueOf(){return this.toString()}toString(){return"["+this.curves.map((function(e){return xf.pointsToString(e.points)})).join(", ")+"]"}addCurve(e){this.curves.push(e),this._3d=this._3d||e._3d}length(){return this.curves.map((function(e){return e.length()})).reduce((function(e,t){return e+t}))}curve(e){return this.curves[e]}bbox(){const e=this.curves;for(var t=e[0].bbox(),n=1;n<e.length;n++)xf.expandbox(t,e[n].bbox());return t}offset(e){const t=[];return this.curves.forEach((function(n){t.push(...n.offset(e))})),new _f(t)}}const{abs:Tf,min:Ef,max:If,cos:Sf,sin:Af,acos:Nf,sqrt:Mf}=Math,Ff=Math.PI;let Cf=class e{constructor(e){let t=e&&e.forEach?e:Array.from(arguments).slice(),n=!1;if("object"==typeof t[0]){n=t.length;const e=[];t.forEach((function(t){["x","y","z"].forEach((function(n){void 0!==t[n]&&e.push(t[n])}))})),t=e}let i=!1;const r=t.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)||e&&e[0]&&void 0!==e[0].z,s=this.points=[];for(let e=0,n=o?3:2;e<r;e+=n){var a={x:t[e],y:t[e+1]};o&&(a.z=t[e+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=xf.align(s,{p1:s[0],p2:s[l]}),d=xf.dist(s[0],s[l]);this._linear=u.reduce(((e,t)=>e+Tf(t.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=xf.dist(n,s.C));const a=o*(1-r)/r,l=xf.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),w=b.y+(v-b.y)/(1-r),x=b.x+(g-b.x)/r,_=b.y+(y-b.y)/r,T={x:t.x+(k-t.x)/r,y:t.y+(w-t.y)/r},E={x:i.x+(x-i.x)/(1-r),y:i.y+(_-i.y)/(1-r)};return new e(t,T,E,i)}static getUtils(){return xf}getUtils(){return e.getUtils()}static get PolyBezier(){return _f}valueOf(){return this.toString()}toString(){return xf.pointsToString(this.points)}toSVG(){if(this._3d)return!1;const e=this.points,t=["M",e[0].x,e[0].y,2===this.order?"Q":"C"];for(let n=1,i=e.length;n<i;n++)t.push(e[n].x),t.push(e[n].y);return t.join(" ")}setRatios(e){if(e.length!==this.points.length)throw new Error("incorrect number of ratio values");this.ratios=e,this._lut=[]}verify(){const e=this.coordDigest();e!==this._print&&(this._print=e,this.update())}coordDigest(){return this.points.map((function(e,t){return""+t+e.x+e.y+(e.z?e.z:0)})).join("")}update(){this._lut=[],this.dpoints=xf.derive(this.points,this._3d),this.computedirection()}computedirection(){const e=this.points,t=xf.angle(e[0],e[this.order],e[1]);this.clockwise=t>0}length(){return xf.length(this.derivative.bind(this))}static getABC(e=2,t,n,i,r=.5){const o=xf.projectionratio(r,e),s=1-o,a={x:o*t.x+s*i.x,y:o*t.y+s*i.y},l=xf.abcratio(r,e);return{A:{x:n.x+(n.x-a.x)/l,y:n.y+(n.y-a.y)/l},B:n,C:a,S:t,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(e){if(this.verify(),e=e||100,this._lut.length===e+1)return this._lut;this._lut=[],e++,this._lut=[];for(let t,n,i=0;i<e;i++)n=i/(e-1),t=this.compute(n),t.t=n,this._lut.push(t);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],xf.dist(t,e)<n&&(r.push(t),s+=o/i.length);return!!r.length&&(t/=r.length)}project(e){const t=this.getLUT(),n=t.length-1,i=xf.closest(t,e),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 t;u<s+a;u+=a)l=this.compute(u),t=xf.dist(e,l),t<c&&(c=t,d=u);return d=d<0?0:d>1?1:d,l=this.compute(d),l.t=d,l.d=c,l}get(e){return this.compute(e)}point(e){return this.points[e]}compute(e){return this.ratios?xf.computeWithRatios(e,this.points,this.ratios,this._3d):xf.compute(e,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(e){return xf.compute(e,this.dpoints[0],this._3d)}dderivative(e){return xf.compute(e,this.dpoints[1],this._3d)}align(){let t=this.points;return new e(xf.align(t,{p1:t[0],p2:t[t.length-1]}))}curvature(e){return xf.curvature(e,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return xf.inflections(this.points)}normal(e){return this._3d?this.__normal3(e):this.__normal2(e)}__normal2(e){const t=this.derivative(e),n=Mf(t.x*t.x+t.y*t.y);return{t:e,x:-t.y/n,y:t.x/n}}__normal3(e){const t=this.derivative(e),n=this.derivative(e+.01),i=Mf(t.x*t.x+t.y*t.y+t.z*t.z),r=Mf(n.x*n.x+n.y*n.y+n.z*n.z);t.x/=i,t.y/=i,t.z/=i,n.x/=r,n.y/=r,n.z/=r;const o={x:n.y*t.z-n.z*t.y,y:n.z*t.x-n.x*t.z,z:n.x*t.y-n.y*t.x},s=Mf(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:e,x:a[0]*t.x+a[1]*t.y+a[2]*t.z,y:a[3]*t.x+a[4]*t.y+a[5]*t.z,z:a[6]*t.x+a[7]*t.y+a[8]*t.z}}hull(e){let t=this.points,n=[],i=[],r=0;for(i[r++]=t[0],i[r++]=t[1],i[r++]=t[2],3===this.order&&(i[r++]=t[3]);t.length>1;){n=[];for(let o,s=0,a=t.length-1;s<a;s++)o=xf.lerp(e,t[s],t[s+1]),i[r++]=o,n.push(o);t=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=xf.map(0,0,1,this._t1,this._t2),r.left._t2=xf.map(t,0,1,this._t1,this._t2),r.right._t1=xf.map(t,0,1,this._t1,this._t2),r.right._t2=xf.map(1,0,1,this._t1,this._t2),n?(n=xf.map(n,t,1,0,1),r.right.split(n).left):r}extrema(){const e={};let t=[];return this.dims.forEach(function(n){let i=function(e){return e[n]},r=this.dpoints[0].map(i);e[n]=xf.droots(r),3===this.order&&(r=this.dpoints[1].map(i),e[n]=e[n].concat(xf.droots(r))),e[n]=e[n].filter((function(e){return e>=0&&e<=1})),t=t.concat(e[n].sort(xf.numberSort))}.bind(this)),e.values=t.sort(xf.numberSort).filter((function(e,n){return t.indexOf(e)===n})),e}bbox(){const e=this.extrema(),t={};return this.dims.forEach(function(n){t[n]=xf.getminmax(this,n,e[n])}.bind(this)),t}overlaps(e){const t=this.bbox(),n=e.bbox();return xf.bboxoverlap(t,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 e=xf.angle(this.points[0],this.points[3],this.points[1]),t=xf.angle(this.points[0],this.points[3],this.points[2]);if(e>0&&t<0||e<0&&t>0)return!1}const e=this.normal(0),t=this.normal(1);let n=e.x*t.x+e.y*t.y;return this._3d&&(n+=e.z*t.z),Tf(Nf(n))<Ff/3}reduce(){let e,t,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],e=1;e<a.length;e++)i=a[e],t=this.split(n,i),t._t1=n,t._t2=i,o.push(t),n=i;return o.forEach((function(e){for(n=0,i=0;i<=1;)for(i=n+r;i<=1.01;i+=r)if(t=e.split(n,i),!t.simple()){if(i-=r,Tf(n-i)<r)return[];t=e.split(n,i),t._t1=xf.map(n,0,1,e._t1,e._t2),t._t2=xf.map(i,0,1,e._t1,e._t2),s.push(t),n=i;break}n<1&&(t=e.split(n,1),t._t1=xf.map(n,0,1,e._t1,e._t2),t._t2=e._t2,s.push(t))})),s}translate(t,n,i){i="number"==typeof i?i:n;const r=this.order;let o=this.points.map(((e,t)=>(1-t/r)*n+t/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=xf.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(e){const t=c[e*n]=xf.copy(o[e*n]);t.x+=(e?a:s)*l[e].n.x,t.y+=(e?a:s)*l[e].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=Mf(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((e=>{if(2===n&&e)return;const t=c[e*n],i=this.derivative(e),r={x:t.x+i.x,y:t.y+i.y};c[e+1]=xf.lli4(t,r,u,o[e+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=xf.makeline(h[2],d[0]),p=xf.makeline(d[2],h[0]),m=[f,new e(d),p,new e(h)];return new _f(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(e,t,n,i,r){return function(o){const s=i/n,a=(i+r)/n,l=t-e;return xf.map(o,0,1,e+s*l,e+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(e){return l=e.points,l[3]?e.points=[l[3],l[2],l[1],l[0]]:e.points=[l[2],l[1],l[0]],e})).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=xf.makeline(v,p),b=xf.makeline(m,g),k=[y].concat(a).concat([b]).concat(c);return new _f(k)}outlineshapes(e,t,n){t=t||e;const i=this.outline(e,t).curves,r=[];for(let e=1,t=i.length;e<t/2;e++){const o=xf.makeshape(i[e],i[t-e],n);o.startcap.virtual=e>1,o.endcap.virtual=e<t/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(e){const t=Ef(e.p1.x,e.p2.x),n=Ef(e.p1.y,e.p2.y),i=If(e.p1.x,e.p2.x),r=If(e.p1.y,e.p2.y);return xf.roots(this.points,e).filter((e=>{var o=this.get(e);return xf.between(o.x,t,i)&&xf.between(o.y,n,r)}))}selfintersects(e){const t=this.reduce(),n=t.length-2,i=[];for(let r,o,s,a=0;a<n;a++)o=t.slice(a,a+1),s=t.slice(a+2),r=this.curveintersects(o,s,e),i.push(...r);return i}curveintersects(e,t,n){const i=[];e.forEach((function(e){t.forEach((function(t){e.overlaps(t)&&i.push({left:e,right:t})}))}));let r=[];return i.forEach((function(e){const t=xf.pairiteration(e.left,e.right,n);t.length>0&&(r=r.concat(t))})),r}arcs(e){return e=e||.5,this._iterate(e,[])}_error(e,t,n,i){const r=(i-n)/4,o=this.get(n+r),s=this.get(i-r),a=xf.dist(e,t),l=xf.dist(e,o),c=xf.dist(e,s);return Tf(l-a)+Tf(c-a)}_iterate(e,t){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=xf.getccenter(u,o,s),a.interval={start:i,end:r},d=this._error(a,u,i,r)<=e,c=h&&!d,c||(p=r),d){if(r>=1){if(a.interval.end=p=1,l=a,r>1){let e={x:a.x+a.r*Sf(a.e),y:a.y+a.r*Af(a.e)};a.e+=xf.angle({x:a.x,y:a.y},e,this.get(1))}break}r+=(r-i)/2}else r=f}while(!c&&n++<100);if(n>=100)break;l=l||a,t.push(l),i=p}while(r<1);return t}};var Of={pointsToCurve:function(e,t){let n=1/t;if(0===e.length){let e=[];for(let i=0;i<t;i++){let t=i*n;e.push({x:t,y:.5})}return e}if(1===e.length){let i=e[0].y,r=[{x:0,y:i}];for(let e=0;e<t;e++){let t=e*n+n;r.push({x:t,y:i})}return r}let i=[],r=e[0],o=e[e.length-1],s=new Cf({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 Cf(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 t=0;t<e.length-1;t++){let n=e[t],r=e[t+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 Cf(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 e=0;e<t;e++){let t,r=e*n+n;i.every((e=>{let n=e.intersects({p1:{x:r,y:0},p2:{x:r,y:1}});return!(n.length>0&&(t=e.get(n[0]),l.push(t),1))}))}return l}};class Pf{constructor(e,t){this.xs=e,this.ys=t,this.ks=this.getNaturalKs(new Float64Array(this.xs.length))}getNaturalKs(e){const t=this.xs.length-1,n=function(e,t){const n=[];for(let i=0;i<e;i++)n.push(new Float64Array(t));return n}(t+1,t+2);for(let e=1;e<t;e++)n[e][e-1]=1/(this.xs[e]-this.xs[e-1]),n[e][e]=2*(1/(this.xs[e]-this.xs[e-1])+1/(this.xs[e+1]-this.xs[e])),n[e][e+1]=1/(this.xs[e+1]-this.xs[e]),n[e][t+1]=3*((this.ys[e]-this.ys[e-1])/((this.xs[e]-this.xs[e-1])*(this.xs[e]-this.xs[e-1]))+(this.ys[e+1]-this.ys[e])/((this.xs[e+1]-this.xs[e])*(this.xs[e+1]-this.xs[e])));return n[0][0]=2/(this.xs[1]-this.xs[0]),n[0][1]=1/(this.xs[1]-this.xs[0]),n[0][t+1]=3*(this.ys[1]-this.ys[0])/((this.xs[1]-this.xs[0])*(this.xs[1]-this.xs[0])),n[t][t-1]=1/(this.xs[t]-this.xs[t-1]),n[t][t]=2/(this.xs[t]-this.xs[t-1]),n[t][t+1]=3*(this.ys[t]-this.ys[t-1])/((this.xs[t]-this.xs[t-1])*(this.xs[t]-this.xs[t-1])),function(e,t){const n=e.length;let i=0,r=0;for(;i<n&&r<=n;){let t=0,o=-1/0;for(let s=i;s<n;s++){const n=Math.abs(e[s][r]);n>o&&(t=s,o=n)}if(0===e[t][r])r++;else{Rf(e,i,t);for(let t=i+1;t<n;t++){const o=e[t][r]/e[i][r];e[t][r]=0;for(let s=r+1;s<=n;s++)e[t][s]-=e[i][s]*o}i++,r++}}for(let i=n-1;i>=0;i--){var o=0;e[i][i]&&(o=e[i][n]/e[i][i]),t[i]=o;for(let t=i-1;t>=0;t--)e[t][n]-=e[t][i]*o,e[t][i]=0}return t}(n,e)}getIndexBefore(e){let t=0,n=this.xs.length,i=0;for(;t<n;)i=Math.floor((t+n)/2),this.xs[i]<e&&i!==t?t=i:n=this.xs[i]>=e&&i!==n?i:t;return t===this.xs.length-1?this.xs.length-1:t+1}at(e){let t=this.getIndexBefore(e);const n=(e-this.xs[t-1])/(this.xs[t]-this.xs[t-1]),i=this.ks[t-1]*(this.xs[t]-this.xs[t-1])-(this.ys[t]-this.ys[t-1]),r=-this.ks[t]*(this.xs[t]-this.xs[t-1])+(this.ys[t]-this.ys[t-1]);return(1-n)*this.ys[t-1]+n*this.ys[t]+n*(1-n)*(i*(1-n)+r*n)}}function Rf(e,t,n){let i=e[t];e[t]=e[n],e[n]=i}function Df(e,t,n){const i=n[0],r=n[n.length-1];if(e<i.x)return i.y;if(e>r.x)return r.y;const o=t.at(e);return Math.max(0,Math.min(o,1))}var Lf={pointsToCurve:function(e,t){if(!Array.isArray(e)||!e.every((e=>"object"==typeof e&&"number"==typeof e.x&&"number"==typeof e.y&&e.x>=0&&e.x<=1&&e.y>=0&&e.y<=1)))throw new Error("[pointsToCurve] Invalid points. Expected array of objects with x and y in [0, 1] range.");if(!("number"==typeof t&&t>=1))throw new Error(`[pointsToCurve] Invalid resolution: ${t}. Expected integer >= 1.`);const n=e.map((e=>e.x)),i=e.map((e=>e.y)),r=new Pf(n,i);let o=[];for(let n=0;n<t;n++)o.push(Df(n/(t-1),r,e));return o}};function Bf(e,t=256,n={}){return"bezier"===n.type?Of.pointsToCurve(e,t,n):Lf.pointsToCurve(e,t)}const zf=[];for(let e=0;e<256;e++)zf[e]=e;class Wf extends qh{constructor(e){const t={vertex:sf,fragment:af},n={uniforms:qh.getUniformInfo(Wf)};super(Wf.getFilterType(),t,n,e)}static getFilterType(){return"curves"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=[];var n;t=[...e.master||e.points||e.masterPoints?e.master||(n=e.points||e.masterPoints,Bf(n,256).map((e=>255*e))):zf],this.uniforms[Lh.STATIC_OPTIONS].set(t)}}function $f(e,t,n){if("number"!=typeof e||e<0||e>255)throw new Error(`[levels] Invalid black point: ${e}. Expected integer between 0 and 255`);if("number"!=typeof t||t<0||t>255)throw new Error(`[levels] Invalid white point: ${t}. 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(e>t)throw new Error(`[levels] Invalid black and white points: ${e}, ${t}. Expected black <= white`);let i=[];for(let r=0;r<256;r++){let o;o=r<=e?0:r>=t?255:255*Math.pow((r-e)/(t-e),1/n),i[r]=o}return i}class jf extends qh{constructor(e){const t={vertex:sf,fragment:af},n={uniforms:qh.getUniformInfo(jf)};super(jf.getFilterType(),t,n,e)}static getFilterType(){return"levels"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=[...$f(e.black,e.white,e.gamma)];this.uniforms[Lh.STATIC_OPTIONS].set(t)}}const Uf=360,qf=[];for(let e=0;e<Uf;e++)qf[e]=e;class Vf extends qh{constructor(e){const t={uniforms:qh.getUniformInfo(Vf)};super(Vf.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"},t,e)}static getFilterType(){return"hue"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=e.points&&function(e){return Bf(e,Uf,{type:"bezier"}).map((e=>{return t=e,((Math.round(t.x*Uf)+180)%Uf+(1-t.y-.5)*Uf+Uf)%Uf;var t}))}(e.points)||qf;this.uniforms[Lh.STATIC_OPTIONS].set(t)}}class Gf extends qh{constructor(e){const t={uniforms:qh.getUniformInfo(Gf)};super(Gf.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"},t,e)}static getFilterType(){return"whiteBalance"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=e.temperature?e.temperature:0,n=e.tint?e.tint:0;this.uniforms[Lh.STATIC_OPTIONS].set([t,n])}}class Hf extends qh{constructor(e){const t={uniforms:qh.getUniformInfo(Hf)};super(Hf.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"},t,e)}static getFilterType(){return"vibrance"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=e.amount?e.amount/100*2:0,n=null===e.redBalance?1:e.redBalance,i=null===e.greenBalance?1:e.greenBalance,r=null===e.blueBalance?1:e.blueBalance;this.uniforms[Lh.STATIC_OPTIONS].set([t,n,i,r])}}class Kf extends qh{constructor(e){const t={uniforms:qh.getUniformInfo(Kf)};super(Kf.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"},t,e)}static getFilterType(){return"saturation"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=null===e.amount?1:e.amount;this.uniforms[Lh.STATIC_OPTIONS].set([t])}}class Xf extends qh{constructor(e){const t={uniforms:qh.getUniformInfo(Xf)};super(Xf.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}"},t,e)}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[Lh.FIRST_TEXTURE,Ph,Rh]}handleStaticUniforms(e){let t={...Xf.getInitialOptions(),...e};const n=Number.parseFloat(t.source.center.x).toFixed(5),i=Number.parseFloat(t.source.center.y).toFixed(5),r=Number.parseFloat(t.source.width).toFixed(5),o=Number.parseFloat(t.source.height).toFixed(5),s=Number.parseFloat(t.target.center.x).toFixed(5),a=Number.parseFloat(t.target.center.y).toFixed(5),l=Number.parseFloat(t.target.width).toFixed(5),c=Number.parseFloat(t.target.height).toFixed(5),u=Number.parseFloat(t.edgeSoftness).toFixed(5),d=t.source.aspectRatio?Number.parseFloat(t.source.aspectRatio).toFixed(5):0;let h;h="fill"===t.fitType?0:"contain"===t.fitType?1:2;const f=Number.parseFloat(t.cornerRadius).toFixed(5);this.uniforms[Lh.STATIC_OPTIONS].set([n,i,r,o,s,a,l,c,h,f,d,u])}}class Yf extends qh{constructor(e){const t={uniforms:qh.getUniformInfo(Yf)};super(Yf.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}"},t,e)}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(e){var t;const n=Number.parseFloat(e.color.r).toFixed(5),i=Number.parseFloat(e.color.g).toFixed(5),r=Number.parseFloat(e.color.b).toFixed(5),o=(null!==(t=Number.parseFloat(e.color.a))&&void 0!==t?t:1).toFixed(5);this.uniforms[Lh.STATIC_OPTIONS].set([n,i,r,o])}}class Qf extends qh{constructor(e){const t={uniforms:qh.getUniformInfo(Qf)};super(Qf.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"},t,e)}static getFilterType(){return"solidImage"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}}class Jf extends qh{constructor(e){const t={uniforms:qh.getUniformInfo(Jf)};super(Jf.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"},t,e)}static getFilterType(){return"lab"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=e.temperature?e.temperature:0,n=e.tint?e.tint:0;this.uniforms[Lh.STATIC_OPTIONS].set([t,n])}}class Zf extends qh{constructor(e){const t={uniforms:qh.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;\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} "},t,e)}static getFilterType(){return"exposure"}static getInputsCount(){return 1}static getInitialOptions(){return{}}getOptionsDisplay(){return[]}handleStaticUniforms(e){let t=null===e.exposure?0:e.exposure;this.uniforms[Lh.STATIC_OPTIONS].set([t])}}var ep,tp,np,ip,rp,op,sp,ap;function lp(){if(ip)return np;ip=1;const e=tp?ep:(tp=1,ep={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]}),t={};for(const n of Object.keys(e))t[e[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"]}};np=n;for(const e of Object.keys(n)){if(!("channels"in n[e]))throw new Error("missing channels property: "+e);if(!("labels"in n[e]))throw new Error("missing channel labels property: "+e);if(n[e].labels.length!==n[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:i}=n[e];delete n[e].channels,delete n[e].labels,Object.defineProperty(n[e],"channels",{value:t}),Object.defineProperty(n[e],"labels",{value:i})}function i(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}return n.rgb.hsl=function(e){const t=e[0]/255,n=e[1]/255,i=e[2]/255,r=Math.min(t,n,i),o=Math.max(t,n,i),s=o-r;let a,l;o===r?a=0:t===o?a=(n-i)/s:n===o?a=2+(i-t)/s:i===o&&(a=4+(t-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(e){let t,n,i,r,o;const s=e[0]/255,a=e[1]/255,l=e[2]/255,c=Math.max(s,a,l),u=c-Math.min(s,a,l),d=function(e){return(c-e)/6/u+.5};return 0===u?(r=0,o=0):(o=u/c,t=d(s),n=d(a),i=d(l),s===c?r=i-n:a===c?r=1/3+t-i:l===c&&(r=2/3+n-t),r<0?r+=1:r>1&&(r-=1)),[360*r,100*o,100*c]},n.rgb.hwb=function(e){const t=e[0],i=e[1];let r=e[2];const o=n.rgb.hsl(e)[0],s=1/255*Math.min(t,Math.min(i,r));return r=1-1/255*Math.max(t,Math.max(i,r)),[o,100*s,100*r]},n.rgb.cmyk=function(e){const t=e[0]/255,n=e[1]/255,i=e[2]/255,r=Math.min(1-t,1-n,1-i);return[100*((1-t-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=t[n];if(r)return r;let o,s=1/0;for(const t of Object.keys(e)){const r=i(n,e[t]);r<s&&(s=r,o=t)}return o},n.keyword.rgb=function(t){return e[t]},n.rgb.xyz=function(e){let t=e[0]/255,n=e[1]/255,i=e[2]/255;return t=t>.04045?((t+.055)/1.055)**2.4:t/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*t+.3576*n+.1805*i),100*(.2126*t+.7152*n+.0722*i),100*(.0193*t+.1192*n+.9505*i)]},n.rgb.lab=function(e){const t=n.rgb.xyz(e);let i=t[0],r=t[1],o=t[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(e){const t=e[0]/360,n=e[1]/100,i=e[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 e=0;e<3;e++)o=t+1/3*-(e-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[e]=255*s;return l},n.hsl.hsv=function(e){const t=e[0];let n=e[1]/100,i=e[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,[t,100*(0===i?2*r/(o+r):2*n/(i+n)),(i+n)/2*100]},n.hsv.rgb=function(e){const t=e[0]/60,n=e[1]/100;let i=e[2]/100;const r=Math.floor(t)%6,o=t-Math.floor(t),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(e){const t=e[0],n=e[1]/100,i=e[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,[t,100*o,100*s]},n.hwb.rgb=function(e){const t=e[0]/360;let n=e[1]/100,i=e[2]/100;const r=n+i;let o;r>1&&(n/=r,i/=r);const s=Math.floor(6*t),a=1-i;o=6*t-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(e){const t=e[0]/100,n=e[1]/100,i=e[2]/100,r=e[3]/100;return[255*(1-Math.min(1,t*(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(e){const t=e[0]/100,n=e[1]/100,i=e[2]/100;let r,o,s;return r=3.2406*t+-1.5372*n+-.4986*i,o=-.9689*t+1.8758*n+.0415*i,s=.0557*t+-.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(e){let t=e[0],n=e[1],i=e[2];return t/=95.047,n/=100,i/=108.883,t=t>.008856?t**(1/3):7.787*t+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*(t-n),200*(n-i)]},n.lab.xyz=function(e){let t,n,i;n=(e[0]+16)/116,t=e[1]/500+n,i=n-e[2]/200;const r=n**3,o=t**3,s=i**3;return n=r>.008856?r:(n-16/116)/7.787,t=o>.008856?o:(t-16/116)/7.787,i=s>.008856?s:(i-16/116)/7.787,t*=95.047,n*=100,i*=108.883,[t,n,i]},n.lab.lch=function(e){const t=e[0],n=e[1],i=e[2];let r;return r=360*Math.atan2(i,n)/2/Math.PI,r<0&&(r+=360),[t,Math.sqrt(n*n+i*i),r]},n.lch.lab=function(e){const t=e[0],n=e[1],i=e[2]/360*2*Math.PI;return[t,n*Math.cos(i),n*Math.sin(i)]},n.rgb.ansi16=function(e,t=null){const[i,r,o]=e;let s=null===t?n.rgb.hsv(e)[2]:t;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(e){return n.rgb.ansi16(n.hsv.rgb(e),e[2])},n.rgb.ansi256=function(e){const t=e[0],n=e[1],i=e[2];return t===n&&n===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5)},n.ansi16.rgb=function(e){let t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const n=.5*(1+~~(e>50));return[(1&t)*n*255,(t>>1&1)*n*255,(t>>2&1)*n*255]},n.ansi256.rgb=function(e){if(e>=232){const t=10*(e-232)+8;return[t,t,t]}let t;return e-=16,[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},n.rgb.hex=function(e){const t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},n.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let n=t[0];3===t[0].length&&(n=n.split("").map((e=>e+e)).join(""));const i=parseInt(n,16);return[i>>16&255,i>>8&255,255&i]},n.rgb.hcg=function(e){const t=e[0]/255,n=e[1]/255,i=e[2]/255,r=Math.max(Math.max(t,n),i),o=Math.min(Math.min(t,n),i),s=r-o;let a,l;return a=s<1?o/(1-s):0,l=s<=0?0:r===t?(n-i)/s%6:r===n?2+(i-t)/s:4+(t-n)/s,l/=6,l%=1,[360*l,100*s,100*a]},n.hsl.hcg=function(e){const t=e[1]/100,n=e[2]/100,i=n<.5?2*t*n:2*t*(1-n);let r=0;return i<1&&(r=(n-.5*i)/(1-i)),[e[0],100*i,100*r]},n.hsv.hcg=function(e){const t=e[1]/100,n=e[2]/100,i=t*n;let r=0;return i<1&&(r=(n-i)/(1-i)),[e[0],100*i,100*r]},n.hcg.rgb=function(e){const t=e[0]/360,n=e[1]/100,i=e[2]/100;if(0===n)return[255*i,255*i,255*i];const r=[0,0,0],o=t%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(e){const t=e[1]/100,n=t+e[2]/100*(1-t);let i=0;return n>0&&(i=t/n),[e[0],100*i,100*n]},n.hcg.hsl=function(e){const t=e[1]/100,n=e[2]/100*(1-t)+.5*t;let i=0;return n>0&&n<.5?i=t/(2*n):n>=.5&&n<1&&(i=t/(2*(1-n))),[e[0],100*i,100*n]},n.hcg.hwb=function(e){const t=e[1]/100,n=t+e[2]/100*(1-t);return[e[0],100*(n-t),100*(1-n)]},n.hwb.hcg=function(e){const t=e[1]/100,n=1-e[2]/100,i=n-t;let r=0;return i<1&&(r=(n-i)/(1-i)),[e[0],100*i,100*r]},n.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},n.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},n.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},n.gray.hsl=function(e){return[0,0,e[0]]},n.gray.hsv=n.gray.hsl,n.gray.hwb=function(e){return[0,100,e[0]]},n.gray.cmyk=function(e){return[0,0,0,e[0]]},n.gray.lab=function(e){return[e[0],0,0]},n.gray.hex=function(e){const t=255&Math.round(e[0]/100*255),n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(n.length)+n},n.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]},np}function cp(){if(op)return rp;op=1;const e=lp();function t(e,t){return function(n){return t(e(n))}}function n(n,i){const r=[i[n].parent,n];let o=e[i[n].parent][n],s=i[n].parent;for(;i[s].parent;)r.unshift(i[s].parent),o=t(e[i[s].parent][s],o),s=i[s].parent;return o.conversion=r,o}return rp=function(t){const i=function(t){const n=function(){const t={},n=Object.keys(e);for(let e=n.length,i=0;i<e;i++)t[n[i]]={distance:-1,parent:null};return t}(),i=[t];for(n[t].distance=0;i.length;){const t=i.pop(),r=Object.keys(e[t]);for(let e=r.length,o=0;o<e;o++){const e=r[o],s=n[e];-1===s.distance&&(s.distance=n[t].distance+1,s.parent=t,i.unshift(e))}}return n}(t),r={},o=Object.keys(i);for(let e=o.length,t=0;t<e;t++){const e=o[t];null!==i[e].parent&&(r[e]=n(e,i))}return r}}var up=function(){if(ap)return sp;ap=1;const e=lp(),t=cp(),n={};return Object.keys(e).forEach((i=>{n[i]={},Object.defineProperty(n[i],"channels",{value:e[i].channels}),Object.defineProperty(n[i],"labels",{value:e[i].labels});const r=t(i);Object.keys(r).forEach((e=>{const t=r[e];n[i][e]=function(e){const t=function(...t){const n=t[0];if(null==n)return n;n.length>1&&(t=n);const i=e(t);if("object"==typeof i)for(let e=i.length,t=0;t<e;t++)i[t]=Math.round(i[t]);return i};return"conversion"in e&&(t.conversion=e.conversion),t}(t),n[i][e].raw=function(e){const t=function(...t){const n=t[0];return null==n?n:(n.length>1&&(t=n),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(t)}))})),sp=n}(),dp=Ru(up);class hp extends qh{constructor(e){const t={uniforms:qh.getUniformInfo(hp)};super(hp.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}"},t,e)}static getFilterType(){return"hardLight"}static getInputsCount(){return 1}static getInitialOptions(){return{color:"4b0082"}}getOptionsDisplay(){return[{properties:["color"],type:"colorPicker"}]}handleStaticUniforms(e){const t=dp.hex.rgb(e.color).map((e=>e/255));this.uniforms[Lh.STATIC_OPTIONS].set([t[0],t[1],t[2]])}}class fp extends qh{constructor(e){const t={uniforms:qh.getUniformInfo(fp)};super(fp.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"},t,e)}static getFilterType(){return"exposureTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{properties:{power:{form:0,to:0,ease:[0,0,1,1]}}}}handleStaticUniforms(e){const t=e.properties.power;this.uniforms[Lh.STATIC_OPTIONS].set([t.from,t.to,...t.ease])}static getUniformList(){return[Lh.FIRST_TEXTURE,Dh]}}class pp extends qh{constructor(e){const t={uniforms:qh.getUniformInfo(pp)};super(pp.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}"},t,e)}static getFilterType(){return"dipToBlackTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{}}handleStaticUniforms(e){const t=e.properties.power;this.uniforms[Lh.STATIC_OPTIONS].set([t.from,t.to,...t.ease])}static getUniformList(){return[Lh.FIRST_TEXTURE,Dh]}}class mp extends qh{constructor(e){const t={uniforms:qh.getUniformInfo(mp)};super(mp.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}"},t,e)}static getFilterType(){return"transformTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{}}handleStaticUniforms(e){const t=e.properties.scale||{},n=e.properties.translate||{};t.ease=t.ease||[0,0,1,1],n.ease=n.ease||[0,0,1,1],this.uniforms[Lh.STATIC_OPTIONS].set([t.from&&t.from.x||1,t.to&&t.to.x||1,t.from&&t.from.y||1,t.to&&t.to.y||1,...t.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[Lh.FIRST_TEXTURE,Dh]}}class vp extends qh{constructor(e){const t={uniforms:qh.getUniformInfo(vp)};super(vp.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}"},t,e)}static getFilterType(){return"motionBlurTransition"}static getInputsCount(){return 1}static getInitialOptions(){return{}}handleStaticUniforms(e){const t=e.properties.power||{from:0,to:0},n=e.properties.direction||{x:0,y:0};t.ease=t.ease||[0,0,1,1],this.uniforms[Lh.STATIC_OPTIONS].set([t.from,t.to,...t.ease,n.x,n.y])}static getUniformList(){return[Lh.FIRST_TEXTURE,Dh,Ph]}}class gp extends qh{constructor(e){const t={uniforms:qh.getUniformInfo(gp)};super(gp.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}"},t,e)}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(e){const t=e.properties.power||{from:0,to:0};t.ease=t.ease||[0,0,1,1];const n=e.properties.color,i=dp.hex.rgb(n).map((e=>e/255));this.uniforms[Lh.STATIC_OPTIONS].set([t.from,t.to,...t.ease,i[0],i[1],i[2]])}static getUniformList(){return[Lh.FIRST_TEXTURE,Dh]}}var yp=Object.freeze({__proto__:null,Crop:Xf,Curves:Wf,Default:class e extends qh{constructor(t){const n={uniforms:qh.getUniformInfo(e)};super(e.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}"},n,t)}static getFilterType(){return"__default"}static getInputsCount(){return 1}static getInitialOptions(){return{}}},DipToBlackTransition:pp,DirectionalBlur:ef,Exposure:Zf,ExposureTransition:fp,FadeToColorTransition:gp,FastBlur:Zh,HardLight:hp,HorizontalBlur:Qh,Hue:Vf,Lab:Jf,Levels:jf,Lut:of,MotionBlurTransition:vp,Opacity:tf,Saturation:Kf,ShapeComposite:rf,ShapeCompositeMask:nf,Solid:Yf,SolidImage:Qf,Transform:Yh,TransformTransition:mp,VerticalBlur:Jh,Vibrance:Hf,WhiteBalance:Gf});const bp=Object.values(yp).reduce(((e,t)=>(e[t.getFilterType()]=t,e)),{});class kp{constructor(e){this.context=e}static getFilterClass(e){return bp[e]}getFilterIds(){return Object.keys(this.filterTypeToInstanceMap)}create(e,t){this.context={...this.context,options:t.options};const n=new bp[e](this.context);if(!n)throw new Error(`${e} is not a atom filter, atomFilter list: `,this.getFilterIds());return n}}const wp=Dd.PREVIOUS_OUTPUT_PREFIX,xp=Object.values(yp).reduce(((e,t)=>(e[t.getFilterType()]={type:t.getFilterType(),options:t.getInitialOptions(),inputs:[...Array(t.getInputsCount())].map(((e,t)=>`${wp}${t}`)),outputs:[]},e)),{});var _p,Tp,Ep=function(){if(Tp)return _p;Tp=1;var e=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&(n=e,!("[object RegExp]"===(i=Object.prototype.toString.call(n))||"[object Date]"===i||n.$$typeof===t));var n,i},t="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(e,t){return!1!==t.clone&&t.isMergeableObject(e)?s((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function i(e,t,i){return e.concat(t).map((function(e){return n(e,i)}))}function r(e){return Object.keys(e).concat((t=e,Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter((function(e){return Object.propertyIsEnumerable.call(t,e)})):[]));var t}function o(e,t){try{return t in e}catch(e){return!1}}function s(t,a,l){(l=l||{}).arrayMerge=l.arrayMerge||i,l.isMergeableObject=l.isMergeableObject||e,l.cloneUnlessOtherwiseSpecified=n;var c=Array.isArray(a);return c===Array.isArray(t)?c?l.arrayMerge(t,a,l):function(e,t,i){var a={};return i.isMergeableObject(e)&&r(e).forEach((function(t){a[t]=n(e[t],i)})),r(t).forEach((function(r){var l,c;o(l=e,c=r)&&(!Object.hasOwnProperty.call(l,c)||!Object.propertyIsEnumerable.call(l,c))||(o(e,r)&&i.isMergeableObject(t[r])?a[r]=function(e,t){if(!t.customMerge)return s;var n=t.customMerge(e);return"function"==typeof n?n:s}(r,i)(e[r],t[r],i):a[r]=n(t[r],i))})),a}(t,a,l):n(a,l)}return s.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return s(e,n,t)}),{})},_p=s}(),Ip=Ru(Ep),Sp=function(e,t){return Ip(e,t,{arrayMerge:(e,t)=>t})};const Ap=Dd.MESSAGES.UPDATE_OPTIONS;let Np=class{constructor(e,t){this.eventEmitter=new $d,this.type=e,this.inputs=t.inputs,this.outputs=t.outputs,this.options=t.options}render(){throw new Error("concrete class should implement")}_updateOptions(){throw new Error("concrete class should implement")}updateOptions(e){this._updateOptions(e),this.eventEmitter.emit(Ap,this.options)}updateInputs(e){e&&(this.inputs.length===e.length&&this.inputs.every(((t,n)=>t===e[n]))||(this.inputs=[...e]))}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 Mp extends Np{constructor(e,t,n){super(...arguments),this.filter=n.filterFactory.create(this.type,{options:this.options})}render(e){const t=e.ioStore,n=e.graphIOManager,i=this.getInputs(),r=this.getOutputs(),o=t.get(i),s=this.filter.render(o,this.options);return n.setOutputs(t,r,s),s}_updateOptions(e){this.options=Sp(this.options,e),this.filter.updateStaticUniforms(this.options)}dispose(){this.filter.dispose()}}const Fp=Dd.MESSAGES.UPDATE_OPTIONS;class Cp extends Mp{constructor(e,t,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}baseNodeUpdateOptions(e){this.options=Sp(this.options,e),this.filter.updateStaticUniforms(this.options)}registerListeners(){this.baseNode.getEventEmitter().on(Fp,this.baseNodeUpdateOptions,this)}dispose(){this.filter.dispose(),this.baseNode.getEventEmitter().off(Fp,this.baseNodeUpdateOptions,this)}}function Op(e){return null!==e&&"object"==typeof e}function Pp(e){if(!Op(e)||(t=e,Array.isArray(t)))return e;var t;const n=Object.keys(e).sort(),i={};return n.forEach((t=>{i[t]=Pp(e[t])})),i}function Rp(e,t){return null!=e&&e.id&&null!=t&&t.id?e.type===t.type&&e.id===t.id:e.type===t.type}function Dp(e,t){const n=[];e.forEach(((e,i)=>{const r=(o=e,t.findIndex((e=>function(e,t){const n=JSON.parse(JSON.stringify(e));return r=JSON.parse(JSON.stringify(t)),Op(i=n)&&Op(r)?JSON.stringify(Pp(i))===JSON.stringify(Pp(r)):!(!Number.isNaN(i)||!Number.isNaN(r))||i===r;var i,r}(o,e))));var o;if(-1!==r)return void n.push({type:"take",index:r});const s=(a=e,l=i,(c=t)&&c[l]&&Rp(a,c[l])?l:c.findIndex((e=>Rp(a,e))));var a,l,c;-1===s?n.push({type:"create",newGraphIndex:i}):n.push({type:"update",currentGraphIndex:s,newGraphIndex:i})}));const i=n.reduce(((e,t)=>("take"===t.type?e.push(t.index):"update"===t.type&&e.push(t.currentGraphIndex),e)),[]);return t.reduce(((e,t,n)=>(i.includes(n)||e.push(n),e)),[]).forEach((e=>{n.push({type:"dispose",currentGraphIndex:e})})),n}function Lp(e,t,n,i){const r=[];return e.forEach((e=>{switch(e.type){case"take":r.push(n[e.index]);break;case"update":const o=t[e.newGraphIndex].options,s=n[e.currentGraphIndex];s.updateInputs(t[e.newGraphIndex].inputs),s.updateOptions(o),r.push(s);break;case"create":const a=Xp.create(t[e.newGraphIndex],i);r.push(a);break;case"dispose":n[e.currentGraphIndex].dispose();break;default:throw new Error("cant apply action type: ",e.type)}})),r}var Bp=function(e,t,n,i){const r=e.graph,o=t.graph;if(!(o&&r&&Array.isArray(o)&&Array.isArray(r)))throw new Error("cant apply new composite options",e);return Lp(Dp(r,o),r,n,i)};class zp extends Np{constructor(e,t,n){super(...arguments),this.context=n,this.nodes=this.createNodes(this.options)}createNodes(e){if(!e||!e.graph)throw new Error("cant create composite node, please supply info.options.graph");return e.graph.map((e=>Xp.create(e,this.context)))}render(e){const t=e.ioStore,n=e.graphIOManager;let i=n.getPrevOutput(t);const r=this.outputs;if(this.nodes.length){const e=new Hd(t),r="__PREVIOUS:0",o=[],s=new Set;this.nodes.forEach(((t,a)=>{const l={ioStore:e,graphIOManager:n},c=t.getOutputs?t.getOutputs():void 0,u=Array.isArray(c)?c:[],d={};u.forEach((t=>{d[t]=e.get(t)}));const h=e.get(r);i=t.render(l),a!==this.nodes.length-1&&o.push(i);const f=new Set;if(h&&h!==i&&f.add(h),u.forEach((e=>{const t=d[e];t&&t!==i&&f.add(t)})),f.size){const t=new Set(Object.values(e.get()));f.forEach((e=>{t.has(e)||(n.disposeTextures([e],i),s.add(e))}))}}));const a=o.filter((e=>!s.has(e)));n.disposeTextures(a,i)}return n.setOutputs(t,r,i),i}getOptionsDisplay(){return[]}_updateOptions(e){this.nodes=Bp(e,this.options,this.nodes,this.context),this.options=e}dispose(){this.nodes.forEach((e=>{e.dispose()}))}}const Wp=Dd.MESSAGES.UPDATE_OPTIONS;class $p extends zp{constructor(e,t,n){super(...arguments),this.baseNode=n.baseNode,this.registerListeners()}registerListeners(){this.baseNode.getEventEmitter().on(Wp,this.updateOptions,this)}dispose(){this.nodes.forEach((e=>{e.dispose()})),this.baseNode.getEventEmitter().off(Wp,this.updateOptions,this)}}const jp=Dd.SYSTEM_NODES.TAGS.ATOM,Up=Dd.SYSTEM_NODES.TAGS.FILTER,qp=Dd.SYSTEM_NODES.TAGS.COMPOSITE_FILTER,Vp=Dd.SYSTEM_NODES.TAGS.TRANSITION_FILTER,Gp=Dd.PREVIOUS_OUTPUT_PREFIX,Hp=Object.keys(xp);function Kp(e,t){const n=(i=e.type,xp[i]);var i;return e=Sp(n,e),new Mp(e.type,e,t)}var Xp={create:function(e,t){let n;switch(function(e){let t;return n=e,t=Hp.includes(n)?jp:e===qp?qp:e===Vp?Vp:Up,t;var n}((e=JSON.parse(JSON.stringify(e))).type)){case jp:n=Kp(e,t);break;case Up:n=function(e,t){const n=function(e,t){const n=t.get(e);if(!n)throw new Error(`no base node, cant resolve type: ${e}`);return n}(e.type,t.nodeStore),i=n.getType(),r=n.getInfo();let o;return e=Sp(r,e),t={...t,baseNode:n},o=i===qp?new $p(i,e,t):new Cp(i,e,t),o}(e,t);break;case qp:n=function(e,t){const n=e.type;return e=Sp({inputs:[`${Gp}0`]},e),new zp(n,e,t)}(e,t);break;case Vp:n=function(e,t){const n=e.options.filter;if(!n)throw new Error(`transition filter should supply base filter ${n}`);return e.type=`${n}Transition`,Kp(e,t)}(e,t);break;default:throw new Error("cant create node",e.type)}return n}};const Yp=Dd.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS;var Qp=function(e){const t={[Yp]:xp[Yp]};for(const[n,i]of Object.entries(t)){const t=Xp.create(i,e);e.nodeStore.set(n,t)}},Jp=function(e,t){for(const[n,i]of Object.entries(e)){const e=Xp.create(i,t);t.nodeStore.set(n,e)}};const Zp=Dd.CAPTURED_FRAME_PREFIX;class em{constructor(e){return this.textureManager=e.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(e,t){t=t||0,this.currentFrameTextures[t].fill(e)}saveFrame(e){0!==this.saveInNextFrameTextures.length&&(this.saveInNextFrameTextures.forEach((t=>{t.fill(e)})),this.saveInNextFrameTextures=[])}capture(e,t){(e.videoHeight>150||e.displayHeight>150)&&(this.updateCurrentFrame(e,t),this.saveFrame(e))}createCaptureId(){const e=this.textureManager.createTexture({type:"frame"});this.saveInNextFrameTextures.push(e);const t=e.getUnit(),n=`${Zp}${t}`;return this.savedFramesTextures[n]=e,this.reservedUnits.add(t),n}releaseCaptureId(e){if("string"!=typeof e)throw new Error("capture id should be string");delete this.saveInNextFrameTextures[e];const t=e.split(":")[1];this.reservedUnits.delete(parseInt(t,10))}getCurrentFrames(){return this.currentFrameTextures}getSavedFrames(){return this.savedFramesTextures}isReservedUnit(e){return this.reservedUnits.has(e)}}const tm=Ju("ShaderGraphApplication","warn"),nm=Dd.SYSTEM_NODES.FILTERS.RENDER_TO_CANVAS,im=Object.freeze({useCanvasSizedFilterTargets:!1,rebindAttributesOnProgramSwitch:!0,forwardContextAttributes:!0});function rm(e={}){const t=null==e?void 0:e.performanceToggles;return t&&"object"==typeof t?{...im,...t}:{...im}}class om{constructor(e,t={}){return this.glSource=e,this.config=t,this.performanceToggles=rm(t),this.isContextLost=!1,this.isRecovering=!1,this.isDisposed=!1,this.pendingNodeOptionUpdates=new Map,this.doInit(e,t)}doInit(e,t){this.source=Vd(e),this.performanceToggles=rm(t),this.isDisposed=!1,this.resetViewportSyncState(),this.render=this.render.bind(this),this.resizeCanvasSize=this.resizeCanvasSize.bind(this),this.setSrcVidTracks=this.setSrcVidTracks.bind(this),this.onWebGLContextLost=this.onWebGLContextLost.bind(this),this.onForceRender=this.onForceRender.bind(this),this.resizeCanvasSize._shouldPreventDefault=!0;const n=function(e={},t=im){const n=null!=e&&e.glOptions&&"object"==typeof e.glOptions?{...e.glOptions}:{},i=n.__shaderGraph&&"object"==typeof n.__shaderGraph?n.__shaderGraph:{};return{...n,__shaderGraph:{...i,forwardContextAttributes:!1!==t.forwardContextAttributes}}}(t,this.performanceToggles);return this.gl=this.source.init(this.setSrcVidTracks,this.resizeCanvasSize,n),this.addCanvasListeners(),this.addSourceListeners(),this.exposeDebugGlobalIfBrowser(),this.selectedRenderNode=null,this.setupRenderInfrastructure(e,t),t.userWillCallRender||(this.rafId=requestAnimationFrame(this.render)),this.dirtyCanvasSize=!0,{getNodes:this.getNodes.bind(this),addNodes:this.addClientNodes.bind(this),selectNode:this.selectNode.bind(this),addTexture:this.addTexture.bind(this),releaseTexture:this.releaseTexture.bind(this),captureTexture:this.captureTexture.bind(this),disposeTexture:this.disposeTexture.bind(this),updateOptions:this.updateOptions.bind(this),render:this.render,dispose:this.dispose.bind(this)}}exposeDebugGlobalIfBrowser(){"undefined"!=typeof window&&(window.ekoShaderGraph=this)}setupRenderInfrastructure(e,t){this.activeTextures=this.activeTextures||new Set,this.textureManager=new th({gl:this.gl,activeTextures:this.activeTextures}),this.capturedFramesManager=new em({textureManager:this.textureManager}),this.graphIOManager=new ch({glSource:e,gl:this.gl,textureManager:this.textureManager,capturedFramesManager:this.capturedFramesManager}),this.frameBufferFactory=new vh({gl:this.gl,textureManager:this.textureManager,useCanvasSizedFilterTargets:this.performanceToggles.useCanvasSizedFilterTargets}),this.filterFactory=new kp({gl:this.gl,frameBufferFactory:this.frameBufferFactory,rebindAttributesOnProgramSwitch:this.performanceToggles.rebindAttributesOnProgramSwitch}),this.nodeStore=new Hd,this.ioStore=new Hd,Qp({nodeStore:this.nodeStore,filterFactory:this.filterFactory}),this.addClientNodes(t.nodes,this.isRecovering)}getNodes(){return tm.debug("[getNodes]"),this.nodeStore.get()}addClientNodes(e,t=!1){if(tm.debug("[addClientNodes]",e),e&&!t&&(this.addClientNodeInvocations=this.addClientNodeInvocations||[],this.addClientNodeInvocations.push(e)),!t&&this.isContextUnavailable())return;e=e||{};const n=JSON.parse(JSON.stringify(e));Jp(n,{nodeStore:this.nodeStore,filterFactory:this.filterFactory})}addTexture(e,t,n){if(tm.debug("[addTexture]",e,t,n),this.isContextUnavailable())return null;let i=this.textureManager.createTexture({type:t});return i.isStatic=!0,e&&i.fill(e),this.graphIOManager.setTextureSource(this.ioStore,i,n),i}releaseTexture(e){tm.debug("[releaseTexture]",e),this.isContextUnavailable()||this.textureManager.releaseTexture(e)}selectNode(e){if(tm.debug("[selectNode]",e),!this.isContextUnavailable())return this.nodeStore.get(e)||tm.warn("Missing render node",e),void(this.selectedRenderNodeId=e);this.selectedRenderNodeId=e}captureTexture(){return tm.debug("[captureTexture]"),this.isContextUnavailable()?null:this.capturedFramesManager.createCaptureId()}disposeTexture(e){return tm.debug("[disposeTexture]",e),this.isContextUnavailable()||"string"!=typeof e?null:this.capturedFramesManager.releaseCaptureId(e)}setSrcVidTracks(e){this.isContextUnavailable()||this.capturedFramesManager&&this.capturedFramesManager.capture(e)}resizeCanvasSize(e,t,n,i){this.dirtyCanvasSize={width:n,height:i}}resetViewportSyncState(){this._lastSyncedViewportCanvasWidth=null,this._lastSyncedViewportCanvasHeight=null}syncViewportToCanvasBackingStoreIfChanged(){var e,t;const n=null===(e=this.gl)||void 0===e||null===(e=e.canvas)||void 0===e?void 0:e.width,i=null===(t=this.gl)||void 0===t||null===(t=t.canvas)||void 0===t?void 0:t.height;!Number.isFinite(n)||!Number.isFinite(i)||n<=0||i<=0||n===this._lastSyncedViewportCanvasWidth&&i===this._lastSyncedViewportCanvasHeight||(fh(n,i),this.gl.viewport(0,0,n,i),this._lastSyncedViewportCanvasWidth=n,this._lastSyncedViewportCanvasHeight=i)}isContextUnavailable(){return!!this.isDisposed||!(!this.isRecovering&&!this.isContextLost)||!(!this.gl||"function"!=typeof this.gl.isContextLost)&&this.gl.isContextLost()}queueNodeOptionUpdate(e,t){e&&t&&"object"==typeof t&&(this.pendingNodeOptionUpdates||(this.pendingNodeOptionUpdates=new Map),this.pendingNodeOptionUpdates.set(e,t))}applyPendingNodeOptionUpdates(e=!1){if(!this.pendingNodeOptionUpdates||!this.pendingNodeOptionUpdates.size)return;const t=Array.from(this.pendingNodeOptionUpdates.entries());this.pendingNodeOptionUpdates.clear(),t.forEach((([t,n])=>{try{if(e){const e=this.nodeStore.get(t);if(!e||"function"!=typeof e.updateOptions)return void this.queueNodeOptionUpdate(t,n);try{e.updateOptions(n)}catch(e){tm.error("Failed to apply pending node options",t,e),this.queueNodeOptionUpdate(t,n)}return}this.updateOptions(t,n)}catch(e){tm.error("Failed to apply pending node options",t,e)}}))}render(e={}){const{noRaf:t=!1}=e;if(this.isContextUnavailable())return;if(this.dirtyCanvasSize){let{width:e=this.gl.canvas.width,height:t=this.gl.canvas.height}=this.dirtyCanvasSize;fh(e,t),this.gl.canvas.width=e,this.gl.canvas.height=t,this.textureManager.refreshTextureObjects(),this.gl.viewport(0,0,e,t),this.dirtyCanvasSize=!1,this._lastSyncedViewportCanvasWidth=e,this._lastSyncedViewportCanvasHeight=t}this.syncViewportToCanvasBackingStoreIfChanged(),this.graphIOManager.setVideoSources(this.ioStore);let n={ioStore:this.ioStore,graphIOManager:this.graphIOManager};this.renderSelectedNode(n),this.config.onPreRenderToScreen&&this.config.onPreRenderToScreen(),this.renderToCanvas(n),this.config.onPostRenderToScreen&&this.config.onPostRenderToScreen(),this.graphIOManager.disposeAllStore(this.ioStore),n=null,!t&&!this.config.userWillCallRender&&(this.rafId=requestAnimationFrame(this.render))}renderSelectedNode(e){if(!this.selectedRenderNodeId)return;const t=this.nodeStore.get(this.selectedRenderNodeId);t&&"function"==typeof t.render?t.render(e):(tm.warn("Missing selected render node",this.selectedRenderNodeId),this.selectedRenderNodeId=null)}renderToCanvas(e){const t=this.nodeStore.get(nm);t&&"function"==typeof t.render?t.render(e):tm.warn("Missing render-to-canvas node")}updateOptions(e,t){if(tm.debug("[updateOptions]",e,t),this.isContextUnavailable())return void this.queueNodeOptionUpdate(e,t);const n=this.nodeStore.get(e);if(n&&"function"==typeof n.updateOptions)try{n.updateOptions(t)}catch(n){tm.error("Failed to update node options",e,n),this.queueNodeOptionUpdate(e,t)}else this.queueNodeOptionUpdate(e,t)}addSourceListeners(){var e;"function"==typeof(null===(e=this.source)||void 0===e?void 0:e.on)&&this.source.on("forcerender",this.onForceRender)}removeSourceListeners(){var e;"function"==typeof(null===(e=this.source)||void 0===e?void 0:e.off)&&this.source.off("forcerender",this.onForceRender)}addCanvasListeners(){var e;(null==this||null===(e=this.gl)||void 0===e?void 0:e.canvas)&&(this.config.noWebGLContextLostRecovery||this.gl.canvas.addEventListener("webglcontextlost",this.onWebGLContextLost))}removeCanvasListeners(){var e;(null==this||null===(e=this.gl)||void 0===e?void 0:e.canvas)&&this.gl.canvas.removeEventListener("webglcontextlost",this.onWebGLContextLost)}getNodesOptions(){const e=this.getNodes();let t={};return Object.keys(e).filter((e=>"__default"!==e)).forEach((n=>{t[n]=e[n].options})),t}getDocumentVisibilityPromise(){return new Promise((e=>{"visible"===document.visibilityState&&e();const t=()=>{"visible"===document.visibilityState&&(document.removeEventListener("visibilitychange",t),e())};document.addEventListener("visibilitychange",t)}))}onForceRender(){tm.info("[onForceRender]"),this.render({noRaf:!0})}async onWebGLContextLost(e){if(e&&"function"==typeof e.preventDefault&&e.preventDefault(),this.isDisposed||this.isRecovering)return;this.isContextLost=!0,this.isRecovering=!0;const t=this.getNodesOptions(),n=this.addClientNodeInvocations,i=this.selectedRenderNodeId;cancelAnimationFrame(this.rafId),tm.warn("WebGL context lost - attempting to recover");const r=async()=>{if(this.isDisposed)this.isRecovering=!1;else try{var e;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((e=>{tm.debug("Re-adding client nodes",e),this.addClientNodes(e,!0)})),Object.entries(t).forEach((([e,t])=>{tm.debug("Re-applying node options",e,t);const n=this.nodeStore.get(e);n&&"function"==typeof n.updateOptions&&n.updateOptions(t)})),i&&(this.selectedRenderNodeId=i),this.applyPendingNodeOptionUpdates(!0);const o="function"==typeof(null===(e=this.source)||void 0===e?void 0:e.recover);o&&(tm.debug("Recovering glSource (i.e. seeking/resetting player)"),await this.source.recover()),this.isContextLost=!1,this.isRecovering=!1,o&&this.render()}catch(e){tm.error("Failed to recover WebGL context, retrying",e),setTimeout(r,200)}};await r()}dispose(e=!0){if(this.selectedRenderNode=null,e&&(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 t=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS);for(let e=0;e<t;++e)this.gl.activeTexture(this.gl.TEXTURE0+e),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),e)try{this.gl.getExtension("WEBGL_lose_context").loseContext()}catch(e){console.error(e)}}this.selectedRenderNodeId=null,e&&delete this.addClientNodeInvocations}}class sm{constructor(e={}){this.options=e}get type(){return"stage"}getSignature(){return this.type}build({inputs:e=[]}={}){return{graph:[],outputs:e,signature:this.getSignature()}}}function am(e={}){const t={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={...t.source,...e.source||{}},i={...t.target,...e.target||{}};return{...t,...e,source:n,target:i}}class lm extends sm{get type(){return"retarget"}getSignature(){var e;const t=Array.isArray(null===(e=this.options)||void 0===e?void 0:e.frames)?this.options.frames:[];return`${this.type}:${t.length}`}build({inputs:e=[],stageIndex:t=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:e,signature:this.getSignature()};const r=[],o=[];for(let n=0;n<e.length;n+=1){const s=e[n],a=i[n];if(!a){o.push(s);continue}const l=`retarget-${t}-${n}`;r.push({id:l,type:"crop",inputs:[s],outputs:[l],options:am(a)}),o.push(l)}return{graph:r,outputs:o,signature:this.getSignature()}}}class cm{#E=new Map;constructor(){this.register("retarget",lm)}register(e,t){e&&"function"==typeof t&&this.#E.set(e,t)}create(e={}){const t="string"==typeof(null==e?void 0:e.type)?e.type:null;if(!t)return null;const n=this.#E.get(t);return n?new n((null==e?void 0:e.options)||{}):null}}class um{constructor(e={}){this.params=e}static get panAndScanTarget(){return"pre"}static buildDefaultLayoutGraph(e=[]){const t=e[0]||"__SRC_TEXTURE:0";return{type:"default",signature:`default:${e.length}`,isDynamic:!1,graph:[{type:"opacity",inputs:[t],options:{power:1}}]}}static prepareRenderFrames({frames:e}={}){return Array.isArray(e)?e:[]}static getRenderTiming({timing:e}={}){return e&&"object"==typeof e?e:{}}static resetRenderState(e){}render(e){}}class dm extends um{#I=null;#S=null;static get type(){return"default"}static get aliases(){return["DefaultRenderNode","default"]}static get requiresFrameCadence(){return!1}static buildLayoutGraph({inputs:e=[]}={}){return super.buildDefaultLayoutGraph(e)}static prepareRenderFrames({frames:e}={}){const t=Array.isArray(e)?e:[];if(t.length<=1)return t;const n=t[t.length-1];return n?[n]:t}render(e){var t;const n=(null==e||null===(t=e.visualFramesAvailable)||void 0===t?void 0:t.frames)||[];if(!n.length)return;const i=null==e?void 0:e.shaderGraph,r=null==e?void 0:e.shaderGraphNodeIds;if(!i||"function"!=typeof i.updateOptions||"function"!=typeof i.selectNode)return;const o=null==r?void 0:r.default;if(o)try{const e=n.map(((e,t)=>e?`__SRC_TEXTURE:${t}`:null)).filter(Boolean),t=dm.buildLayoutGraph({inputs:e}),r=t.signature;this.#I!==r&&(i.updateOptions(o,{graph:t.graph}),this.#I=r),this.#S!==o&&(i.selectNode(o),this.#S=o),i.render({noRaf:!0})}catch(e){}}}function hm(e){const t=Number(e);return Number.isFinite(t)?t<=0?0:t>=1?1:t:0}class fm extends um{#I=null;#S=null;#A=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:e=[],normalizedTime:t}={}){if(e.length<2)return super.buildDefaultLayoutGraph(e);const n=hm(t),i=[{type:"opacity",inputs:[e[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",e[0]],options:{}}];return{type:fm.type,signature:`${fm.type}:${e.length}`,isDynamic:!0,graph:i}}static prepareRenderFrames({frames:e,timelineTime:t,active:n}={}){let i=(Array.isArray(e)?e:[]).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(t)||!Number.isFinite(r)||!Number.isFinite(o))return i;const s=hm((t-o)/r);return s<=0?[i[0]]:s>=1?[i[1]]:i}render(e){var t;const n=(null==e||null===(t=e.visualFramesAvailable)||void 0===t?void 0:t.frames)||[];if(!n.length)return;const i=null==e?void 0:e.shaderGraph,r=null==e?void 0:e.shaderGraphNodeIds;if(!i||"function"!=typeof i.updateOptions||"function"!=typeof i.selectNode)return;if(n.length<2){const e=null==r?void 0:r.default;if(!e)return;try{const t="default";if(this.#I!==t){const n=fm.buildLayoutGraph({inputs:["__SRC_TEXTURE:0"]});i.updateOptions(e,{graph:n.graph}),this.#I=t}this.#S!==e&&(i.selectNode(e),this.#S=e),i.render({noRaf:!0})}catch(e){}return}const o=null==r?void 0:r.crossFade;if(o)try{const t=["__SRC_TEXTURE:0","__SRC_TEXTURE:1"],n=fm.buildLayoutGraph({inputs:t,normalizedTime:null==e?void 0:e.renderNodeNormalizedTime}),r=n.signature,s=Number(null==e?void 0:e.renderNodeNormalizedTime),a=Number.isFinite(s)?s:0;this.#I===r&&this.#A===a||(i.updateOptions(o,{graph:n.graph}),this.#I=r,this.#A=a),this.#S!==o&&(i.selectNode(o),this.#S=o),i.render({noRaf:!0})}catch(e){}}}function pm(e,t,n={}){if("number"==typeof(null==e?void 0:e.nodeDurationOverride)&&Number.isFinite(e.nodeDurationOverride))return e.nodeDurationOverride;const i="function"==typeof(null==n?void 0:n.getNode)?n.getNode:t&&"function"==typeof t.get?e=>t.get(e):null;if(!i)return;const r=i(null==e?void 0:e.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 e.nodeOffsetOverride&&Number.isFinite(e.nodeOffsetOverride)&&(a=e.nodeOffsetOverride);const l=o-a;return l>0?l:0}function mm(e){return!(!e||!0===e.offsetPending)&&Number.isFinite(e.offset)}function vm(e){return mm(e)?e.offset:void 0}function gm(e,t,n,i={}){if(!e)return!1;const r=vm(e);if(!Number.isFinite(r))return!1;const o=pm(e,n,i);return Number.isFinite(o)?t>=r&&t<r+o:t>=r}function ym(e=[]){if(!Array.isArray(e))return e;const t=[],n=[];return e.forEach((e=>{mm(e)?t.push(e):n.push(e)})),t.sort(((e,t)=>e.offset-t.offset)),e.splice(0,e.length,...t,...n),e}function bm(e=[],t={}){if(!Array.isArray(e)||!e.length)return{updated:!1,resolvedPlacements:[]};const n="function"==typeof t.getPlacementDuration?t.getPlacementDuration:()=>{},i="function"==typeof t.snapPlacementOffset?t.snapPlacementOffset:e=>e,r="function"==typeof t.onResolvedPlacement?t.onResolvedPlacement:null,o=new Map,s=[];if(e.forEach((e=>{null!=e&&e.placementId&&o.set(e.placementId,e),!0===(null==e?void 0:e.offsetPending)&&s.push(e)})),!s.length)return{updated:!1,resolvedPlacements:[]};let a=!1;const l=[];let c=s,u=!0;for(;c.length&&u;){u=!1;const e=[];for(let t=0;t<c.length;t+=1){const s=c[t],d=null==s?void 0:s.offsetAnchorPlacementId;if(!d){e.push(s);continue}const h=o.get(d);if(!h||!0===h.offsetPending){e.push(s);continue}const f=vm(h);if(!Number.isFinite(f)){e.push(s);continue}let p;if("start"===s.offsetAnchorEdge)p=i(f,s);else{const t=n(h);if(!(t>0)){e.push(s);continue}const r=f+t-(Number.isFinite(s.offsetEndSeconds)?s.offsetEndSeconds:0);if(!Number.isFinite(r)){e.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):e.push(s)}c=e}return a&&!1!==t.sortPlacements&&ym(e),{updated:a,resolvedPlacements:l}}function km(e){const t=Number(e);return Number.isFinite(t)?t:0}function wm(e,t={}){const n=function(e){const t=Number(e);return Number.isFinite(t)&&t<0?Math.abs(t):0}(e),i=Number.isFinite(null==t?void 0:t.offsetEndSeconds)?t.offsetEndSeconds:n;var r;return{wantsEndOffset:"end"===(r=e)||null==r||n>0||!0===(null==t?void 0:t.offsetPending),endOffsetSeconds:i,endOffsetFromAtSeconds:n}}function xm(e){if("string"!=typeof e)return null;const t=e.trim();if(!t||"end"===t)return null;const n=Number(t);if(Number.isFinite(n))return null;const i=t.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 _m(e=[],t,n,i){if(Array.isArray(e))for(let r=0;r<e.length;r+=1){const o=e[r],s="number"==typeof(null==o?void 0:o.offset)?o.offset:0;if(t<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 Tm(e){const t=Number(e);return Number.isFinite(t)&&t>0?t:0}function Em(e){return(null==e?void 0:e.id)||(null==e?void 0:e.nodeId)||null}function Im(e,t){return Array.isArray(e)&&t?e.findIndex((e=>Em(e)===t)):-1}function Sm(e,t,n){const i=function(e,t,n){if(!Array.isArray(t)||0===t.length)return null;const i=t.length;if(null==e||"next"===e){const e=Im(t,n);return e>=0?(e+1)%i:0}if("prev"===e){const e=Im(t,n);return e>=0?(e-1+i)%i:i-1}const r=Number(e);return Number.isInteger(r)&&r>=0&&r<i?r:null}(e,t,n);return Number.isInteger(i)?Em(t[i]):null}function Am(e,t,n,i){const r=function(e,t){if(!Array.isArray(e)||e.length<=1)return e||[];const n=function(e){const t=[],n=new Set;return Array.isArray(e)?(e.forEach((e=>{const i=null==e?void 0:e.placementId;i&&!n.has(i)&&(n.add(i),t.push(i))})),t):t}(t);if(!n.length)return e;const i=new Map;e.forEach((e=>{const t=null==e?void 0:e.placementId;t&&!i.has(t)&&i.set(t,e)}));const r=[],o=new Set;return n.forEach((e=>{const t=i.get(e);t&&!o.has(e)&&(o.add(e),r.push(t))})),e.forEach((e=>{const t=null==e?void 0:e.placementId;t&&!o.has(t)&&(o.add(t),r.push(e))})),r}(function(e,t){const n=function(e){const t=Number(null==e?void 0:e.offset),n=Number(null==e?void 0:e.duration),i=n===Number.POSITIVE_INFINITY,r=Number.isFinite(n)&&n>0||i;return Number.isFinite(t)&&r?{start:t,end:i?Number.POSITIVE_INFINITY:t+n}:null}(t);if(!n||!e||!Array.isArray(e.placements))return[];const i=function(e,t){const n=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.snapToFps);return!Number.isFinite(n)||n<=0?0:.5/n}(e),r=e.placements.filter((t=>{const r=function(e,t){const n=vm(e);if(!Number.isFinite(n))return null;const i="function"==typeof(null==t?void 0:t.getPlacementDuration)?t.getPlacementDuration(e):void 0;return{start:n,end:Number.isFinite(i)&&i>=0?n+i:Number.POSITIVE_INFINITY}}(t,e);return!!r&&r.start<n.end&&r.end>n.start+i}));return r.sort(((e,t)=>vm(e)-vm(t))),r}(t,n),i),o=function(e,t){const n=[],i=new Set;return Array.isArray(e)?(e.forEach((e=>{const r=null==e?void 0:e.nodeId;if(!r||i.has(r))return;const o="function"==typeof(null==t?void 0:t.getNode)?t.getNode(r):null;if(o){const e="object"==typeof o&&null!==o?o.id||o.nodeId?o:{...o,id:r}:{id:r};n.push(e),i.add(r)}})),n):n}(r,t),s=function(e){const t=new Map;return e.forEach((e=>{const n=null==e?void 0:e.placementId,i=null==e?void 0:e.nodeId;n&&i&&(t.has(i)||t.set(i,[]),t.get(i).push(n))})),t}(r),a=Array.isArray(e.nodes)?e.nodes:[];return a.splice(0,a.length,...o),e.nodes=a,e.placements=r,e.nodePlacementMap=s,{nodes:a,placements:r,nodePlacementMap:s}}function Nm(e,t,n){if(!Array.isArray(e))return null;if(t){const n=e.find((e=>(null==e?void 0:e.placementId)===t));if(n)return n}return n&&e.find((e=>(null==e?void 0:e.nodeId)===n))||null}function Mm(e,t){if(!t||!Array.isArray(e))return null;const n=e.find((e=>(null==e?void 0:e.placementId)===t));return(null==n?void 0:n.nodeId)||null}function Fm(e,t,n){if(!e||!t)return null;const i=t.get(e);if(!Array.isArray(i)||!i.length)return null;for(let t=0;t<i.length;t+=1){const r=i[t];if(Nm(n,r,e))return r}return null}function Cm(e){e.initialized=!1,e.activeRenderPlacementId=null,e.nodes=[],e.placements=[],e.nodePlacementMap=null,e.selectedPlacementId=null,e.previousPlacementId=null,e.pendingSwitch=null,e.switchStartTime=null,e.switchDuration=0,e.switchNormalizedTime=void 0,e.switchTo=null,e.countOfConcurrentChannels=null}class Om extends um{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:e=[],normalizedTime:t}={}){if(e.length<2)return super.buildDefaultLayoutGraph(e);const n=hm(t),i=[{type:"opacity",inputs:[e[1]],options:{power:n}},{type:"shapeComposite",inputs:["__PREVIOUS:0",e[0]],options:{}}];return{type:Om.type,signature:`${Om.type}:${e.length}`,isDynamic:!0,graph:i}}static getRenderTiming({timing:e,state:t}={}){const n=e&&"object"==typeof e?e:{},i=Number(null==t?void 0:t.switchNormalizedTime);return Number.isFinite(i)?{...n,normalizedTime:hm(i)}:n}static prepareRenderFrames({frames:e,timelineTime:t,timeline:n,active:i,renderNodeParams:r,state:o}={}){const s=Array.isArray(e)?e:[],a=o&&"object"==typeof o?o:{},l=null==i?void 0:i.renderPlacementId;l&&a.activeRenderPlacementId!==l&&(Cm(a),a.activeRenderPlacementId=l);const c=null==r?void 0:r.initSwitching,u=Am(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=(e,t)=>{const n=Mm(a.placements,a.selectedPlacementId),i=Sm(e,a.nodes,n);if(!i)return;const r={nodeId:i};t&&Object.prototype.hasOwnProperty.call(t,"crossfadeSeconds")&&void 0!==t.crossfadeSeconds&&(r.crossfadeSeconds=t.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 e=Number(null==r?void 0:r.initialChannelIndex),t=Sm(Number.isInteger(e)&&e>=0?e:0,a.nodes,null);let n=null;if(t&&(n=Fm(t,a.nodePlacementMap,s),!n&&a.nodePlacementMap)){const e=a.nodePlacementMap.get(t);Array.isArray(e)&&e.length&&(n=e[0])}a.selectedPlacementId=n||function(e,t){if(Array.isArray(t))for(let i=0;i<t.length;i+=1){var n;const r=null===(n=t[i])||void 0===n?void 0:n.placementId;if(r&&Nm(e,r))return r}const i=Array.isArray(e)?e.find((e=>null==e?void 0:e.placementId)):null;return i?i.placementId:null}(s,a.placements)}if(a.pendingSwitch&&Number.isFinite(t)){const e=Fm(a.pendingSwitch.nodeId,a.nodePlacementMap,s);if(e){const n=a.selectedPlacementId;a.previousPlacementId=n&&n!==e?n:null,a.selectedPlacementId=e;const i=Object.prototype.hasOwnProperty.call(a.pendingSwitch,"crossfadeSeconds"),o=Tm(a.pendingSwitch.crossfadeSeconds),s=Tm(null==r?void 0:r.switchCrossfadeSeconds),l=i?o:s;a.switchDuration=l,l>0?a.switchStartTime=t:(a.switchStartTime=null,a.previousPlacementId=null)}a.pendingSwitch=null}let p;if(Number.isFinite(a.switchStartTime)&&a.switchDuration>0&&Number.isFinite(t)){const e=t-a.switchStartTime;e>=a.switchDuration?(a.switchStartTime=null,a.switchDuration=0,a.previousPlacementId=null):e>=0&&(p=hm(e/a.switchDuration))}a.switchNormalizedTime=Number.isFinite(p)?p:void 0;const m=Mm(a.placements,a.selectedPlacementId),v=Nm(s,a.selectedPlacementId,m)||s[0];let g=null;if(Number.isFinite(a.switchNormalizedTime)&&a.previousPlacementId){const e=Mm(a.placements,a.previousPlacementId),t=Mm(a.placements,a.selectedPlacementId),n=Nm(s,a.previousPlacementId,e),i=Nm(s,a.selectedPlacementId,t);n&&i&&(g=[n,i])}return g||(g=v?[v]:s),g}static resetRenderState(e){e&&"object"==typeof e&&Cm(e)}}const Pm=.5,Rm="auto";function Dm(e){return"vertical"===e?"vertical":"horizontal"}function Lm(e){return void 0===e||e===Rm?Rm:"manual"}function Bm(e){const t=Number(e);return Number.isFinite(t)&&t>=0?t:.004}function zm(e,t){const n=Number(null==e?void 0:e.width),i=Number(null==e?void 0:e.height);return Number.isFinite(n)&&Number.isFinite(i)&&n>0&&i>0?i>n?"vertical":"horizontal":Dm(t)}function Wm(e,t){const n=t&&"object"==typeof t&&t.runtimeParams&&"object"==typeof t.runtimeParams?t.runtimeParams:{},i=Object.prototype.hasOwnProperty.call(n,"orientationMode")?n.orientationMode:null==e?void 0:e.orientationMode,r=Object.prototype.hasOwnProperty.call(n,"orientation")?n.orientation:null==e?void 0:e.orientation,o=Object.prototype.hasOwnProperty.call(n,"gap")?n.gap:null==e?void 0:e.gap,s=Lm(i);return{orientationMode:s,orientation:s===Rm?zm(null==t?void 0:t.viewportSize,r):Dm(r),gap:Bm(o)}}function $m(e){e&&"object"==typeof e&&(e.activeRenderPlacementId=null,e.frames=null,e.gridInitialized=!1,e.runtimeParams=null,e.setGridParams=null)}class jm extends um{static get type(){return"grid"}static get aliases(){return["GridRenderNode","grid","SideBySideRenderNode","side-by-side","sidebyside"]}static get requiresFrameCadence(){return!1}static get panAndScanTarget(){return"skip"}static resolvePanAndScanTarget({frameCount:e}={}){return e<2?"pre":jm.panAndScanTarget}static buildLayoutGraph({inputs:e=[],renderNodeParams:t,state:n}={}){const i=Array.isArray(e)?e.slice(0,12):[],r=i.length;if(r<2)return super.buildDefaultLayoutGraph(i);const{orientation:o,gap:s}=Wm(t,n),{rows:a,cols:l}=(p=o,(f=r)<=3?"vertical"===p?{rows:f,cols:1}:{rows:1,cols:f}:4===f?{rows:2,cols:2}:f<=6?"vertical"===p?{rows:3,cols:2}:{rows:2,cols:3}:f<=8?"vertical"===p?{rows:4,cols:2}:{rows:2,cols:4}:9===f?{rows:3,cols:3}:"vertical"===p?{rows:4,cols:3}:{rows:3,cols:4}),c=1/a,u=Math.max(0,c-s),d=[],h="grid-slice";var f,p;function m(e){const t=Math.floor(e/l),n=function(e,t,n,i){const r=(t-1)*n;return e===t-1&&i>r?i-r:n}(t,a,l,r),i=n<l?e-t*l:e%l,o=1/n;return{row:t,cellWidth:o,cropWidth:Math.max(0,o-s),targetCenterX:(i+Pm)*o,targetCenterY:(t+Pm)*c}}function v(e,t,n){const i=m(e);return{id:`grid-crop-${e}`,type:"crop",inputs:[t],outputs:[n],options:{source:{center:{x:Pm,y:Pm},width:1,height:1},target:{center:{x:i.targetCenterX,y:i.targetCenterY},width:i.cropWidth,height:u},fitType:"fill",cornerRadius:0,edgeSoftness:0}}}function g(e){const t=m(e);return{id:`grid-mask-${e}`,type:"shapeCompositeMask",inputs:[h,"accum"],outputs:["accum"],options:{type:"box",center:{x:2*t.targetCenterX-1,y:1-2*t.targetCenterY},area:{width:t.cellWidth,height:c},radius:0,edgeSoftness:0}}}d.push(v(0,i[0],"accum"));for(let e=1;e<r;e+=1)d.push(v(e,i[e],h)),d.push(g(e));return{type:jm.type,signature:`${jm.type}:${r}:${a}x${l}:${o}:${s}`,isDynamic:!1,graph:d}}static prepareRenderFrames({frames:e,renderNodeParams:t,active:n,state:i}={}){const r=Array.isArray(e)?e.slice(0,12):[],o=i&&"object"==typeof i?i:{},s=null==n?void 0:n.renderPlacementId;s&&o.activeRenderPlacementId!==s&&($m(o),o.activeRenderPlacementId=s);const a=Array.isArray(o.frames)?o.frames:[],l=null==t?void 0:t.initGrid;if("function"==typeof l&&(o.setGridParams||(o.setGridParams=e=>{!function(e,t){if(!e||"object"!=typeof e||!t||"object"!=typeof t)return;const n=e.runtimeParams&&"object"==typeof e.runtimeParams?{...e.runtimeParams}:{};Object.prototype.hasOwnProperty.call(t,"orientationMode")&&(n.orientationMode=Lm(t.orientationMode)),Object.prototype.hasOwnProperty.call(t,"orientation")&&(n.orientation=Dm(t.orientation)),Object.prototype.hasOwnProperty.call(t,"gap")&&(n.gap=Bm(t.gap)),e.runtimeParams=n}(o,e),"function"==typeof o.requestRender&&o.requestRender()}),!o.gridInitialized)){o.gridInitialized=!0;const e=Wm(t,o);try{l({orientationMode:e.orientationMode,orientation:e.orientation,gap:e.gap,setGridParams:o.setGridParams})}catch(e){}}if(r.length<2){const e=function(e,t){if(!Array.isArray(t)||t.length<2)return e.length?[e[e.length-1]]:[];const n=Math.min(12,Math.max(e.length,t.length,2)),i=e[0]||t[0];return Array.from({length:n},((n,r)=>e[r]||t[r]||i))}(r,a);return o.frames=e,e}return o.frames=r,r}static resetRenderState(e){$m(e)}}const Um=[dm,fm,Om,jm],qm=new Map;function Vm(e){if("string"!=typeof e)return null;const t=e.trim();return t?t.toLowerCase():null}function Gm(e){const t=Vm(e);return t&&qm.get(t)||null}function Hm(e){return Gm(e)||dm}Um.forEach((e=>function(e){(function(e){const t=Array.isArray(e.aliases)?e.aliases:[],n=e.type;return(n?[n,...t]:t.slice()).filter((e=>"string"==typeof e&&e.trim().length))})(e).forEach((t=>{const n=Vm(t);n&&qm.set(n,e)}))}(e)));class Km{static get defaultType(){return dm.type||"default"}static getRenderNodeClass(e){return Gm(e)}static normalizeType(e){const t=Gm(e);return t?t.type:null}static doesRenderNodeTypeRequireFrameCadence(e){const t=Gm(e);return!!t&&!0===t.requiresFrameCadence}static buildLayoutGraph({type:e,inputs:t=[],normalizedTime:n,renderNodeParams:i,state:r}={}){const o=Hm(e);return o&&"function"==typeof o.buildLayoutGraph?o.buildLayoutGraph({inputs:t,normalizedTime:n,renderNodeParams:i,state:r}):dm.buildLayoutGraph({inputs:t,normalizedTime:n,renderNodeParams:i,state:r})}static getPanAndScanTarget(e,t={}){const n=Hm(e);return"post"===(i=n&&"function"==typeof n.resolvePanAndScanTarget?n.resolvePanAndScanTarget(t):null==n?void 0:n.panAndScanTarget)||"skip"===i?i:"pre";var i}static prepareRenderFrames({type:e,frames:t,timelineTime:n,timeline:i,active:r,renderNodeParams:o,state:s}={}){const a=Hm(e);if(a&&"function"==typeof a.prepareRenderFrames){const e=a.prepareRenderFrames({frames:t,timelineTime:n,timeline:i,active:r,renderNodeParams:o,state:s});if(Array.isArray(e))return e}return Array.isArray(t)?t:[]}static getRenderTiming({type:e,timing:t,timelineTime:n,active:i,renderNodeParams:r,state:o}={}){const s=Hm(e),a=t&&"object"==typeof t?t:{};if(s&&"function"==typeof s.getRenderTiming){const e=s.getRenderTiming({timing:a,timelineTime:n,active:i,renderNodeParams:r,state:o});if(e&&"object"==typeof e)return{...a,...e}}return a}static resetRenderState(e,t){const n=Hm(e);n&&"function"==typeof n.resetRenderState&&n.resetRenderState(t)}static resetAllRenderStates(e){e&&"function"==typeof e.forEach&&e.forEach(((e,t)=>{Km.resetRenderState(t,e)}))}create(e,t){return e&&"function"==typeof e.render?e:new(Hm(e))(t)}}function Xm(e){return Array.isArray(e)?e.filter((e=>e&&"string"==typeof e.type)):[]}function Ym(e,t){return e&&"function"==typeof e.getSignature?e.getSignature():(null==t?void 0:t.type)||"stage"}class Qm{#N;constructor(e){this.#N=e||new cm}build(e={}){const t=(Array.isArray(null==e?void 0:e.frames)?e.frames:[]).length,n=Array.from({length:t},((e,t)=>`__SRC_TEXTURE:${t}`)),i=Km.normalizeType(null==e?void 0:e.layoutType)||Km.defaultType,r=null==e?void 0:e.normalizedTime,o=Xm(null==e?void 0:e.preStages),s=Xm(null==e?void 0:e.postStages),a=[],l=[`layout:${i}`,`inputs:${t}`];let c=n;o.forEach(((t,n)=>{const i=this.#N.create(t);if(!i)return;const r=i.build({inputs:c,stageIndex:n,context:e});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(Ym(i,t))}));const u=Km.buildLayoutGraph({type:i,inputs:c,normalizedTime:r,renderNodeParams:null==e?void 0:e.renderNodeParams,state:null==e?void 0:e.renderNodeState}),d=!(null==u||!u.isDynamic);Array.isArray(null==u?void 0:u.graph)&&u.graph.length&&a.push(...u.graph),l.push((null==u?void 0:u.signature)||`${i}:${c.length}`);let h="__PREVIOUS:0";return s.forEach(((t,n)=>{const i=this.#N.create(t);if(!i)return;const r=i.build({inputs:[h],stageIndex:n,context:e});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(Ym(i,t))})),{graph:a,signature:l.join("|"),isDynamic:d}}}const Jm=[0,0,1,1],Zm="zoomInExposure",ev=["transform","exposure","fadeToColor","dipToBlack"],tv={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 nv(e,t=0){const n=Number(e);return Number.isFinite(n)?n:t}function iv(e,t=Jm){return Array.isArray(e)&&e.length>=4?e:t}function rv(e){return"string"==typeof e&&e.trim()?e.trim():"#ffffff"}function ov(e,t){const n=null==e?void 0:e[t];return!1===n||null==n?null:ed(n)?n:{}}function sv(e={}){let t=0;return ev.forEach((n=>{const i=ov(e,n);if(!i)return;const r=nv(null==i?void 0:i.duration);r>t&&(t=r)})),t}function av(e,t,n,i,r){const o=[];return ev.forEach((s=>{const a=ov(e,s);if(!a)return;const l=function(e,t,n){const i=nv(null==e?void 0:e.duration);return Number.isFinite(n)&&n>0?i>0&&t>0?i*t:n:i}(a,n,i),c=function(e,t,n,i,r){const o={type:"transition",inputs:["__PREVIOUS:0"],options:{filter:e,startTime:n,duration:i,properties:{}}};if("transform"===e){var s,a,l,c;const e=iv(null==t?void 0:t.ease),n=(null==t||null===(s=t.scale)||void 0===s?void 0:s.from)||{x:1,y:1},i=(null==t||null===(a=t.scale)||void 0===a?void 0:a.to)||{x:1,y:1},r=(null==t||null===(l=t.translate)||void 0===l?void 0:l.from)||{x:0,y:0},u=(null==t||null===(c=t.translate)||void 0===c?void 0:c.to)||{x:0,y:0};return o.options.properties.scale={from:n,to:i,ease:e},o.options.properties.translate={from:r,to:u,ease:e},o}if("fadeToColor"===e){const e=iv(null==t?void 0:t.ease),n=(null==t?void 0:t.power)||{from:0,to:1};return o.options.properties.power={from:nv(null==n?void 0:n.from,0),to:nv(null==n?void 0:n.to,1),ease:e},o.options.properties.color=rv((null==t?void 0:t.color)||r),o}if("exposure"===e||"dipToBlack"===e){const e=iv(null==t?void 0:t.ease),n=(null==t?void 0:t.power)||{from:0,to:1};return o.options.properties.power={from:nv(null==n?void 0:n.from,0),to:nv(null==n?void 0:n.to,1),ease:e},o}return null}(s,a,t,l,r);c&&o.push(c)})),o}function lv(e=[]){const t=e.map((e=>{const t=JSON.parse(JSON.stringify(e));return null!=t&&t.options&&(t.options.startTime=0),t}));return JSON.stringify(t)}class cv{#M=null;start(e={}){const t=null==e?void 0:e.shaderGraph;if(!t||"function"!=typeof t.captureTexture)return null;const{baseFilters:n,reverseFilters:i}=function(e={}){const t=function(e={}){if(ed(null==e?void 0:e.transition))return e.transition;if("string"==typeof(null==e?void 0:e.transition))return tv[e.transition]||tv[Zm];if(ed(null==e?void 0:e.filters)||ed(null==e?void 0:e.reverseFilters))return{filters:e.filters||{},reverseFilters:e.reverseFilters||{}};if("string"==typeof(null==e?void 0:e.filter)){const t=nv(e.duration)>0?1e3*e.duration:500;return{filters:{[e.filter]:{duration:t,power:{from:0,to:1}}},reverseFilters:{}}}return tv[Zm]}(e),n=td({},(null==t?void 0:t.filters)||{},ed(null==e?void 0:e.filters)?e.filters:{}),i=function(e={}){const t={};return Object.keys(e).forEach((n=>{const i=e[n];if(!1===i)return void(t[n]=!1);const r=JSON.parse(JSON.stringify(ed(i)?i:{}));Object.values(r).forEach((e=>function(e){if(e&&"object"==typeof e&&"from"in e&&"to"in e){const t=e.from;e.from=e.to,e.to=t}}(e))),t[n]=r})),t}(n),r=td({},(null==t?void 0:t.reverseFilters)||{},ed(null==e?void 0:e.reverseFilters)?e.reverseFilters:{});return{baseFilters:n,reverseFilters:td({},i,r)}}(e),r=nv(null==e?void 0:e.duration),o=r>0?1e3*r:null,s=sv(n),a=sv(i),l=o&&s>0?o/s:1,c=o&&a>0?o/a:1,u=o||s||500,d=o||a||u,h=rv(null==e?void 0:e.color),f=t.captureTexture(),p=Date.now(),m=av(n,p,l,o,h);return this.#M={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:lv(m),inGraph:null,inSignature:null},{captureId:f,outDurationMs:u,inDurationMs:d}}beginIncoming(){if(!this.#M)return;const e=Date.now(),t=av(this.#M.reverseFilters,e,this.#M.inScale,this.#M.durationOverrideMs,this.#M.color);this.#M={...this.#M,phase:"in",startTime:e,inGraph:t,inSignature:lv(t)}}reset(e){var t;e&&"function"==typeof e.disposeTexture&&null!==(t=this.#M)&&void 0!==t&&t.captureId&&e.disposeTexture(this.#M.captureId),this.#M=null}getState(){return this.#M}buildOutgoingGraph(){const e=this.#M;return e&&"out"===e.phase&&Array.isArray(e.outGraph)&&e.outGraph.length?{signature:`transition:out:${e.outSignature||""}`,forceUpdate:!1,graph:e.outGraph}:null}buildIncomingGraph(){const e=this.#M;return e&&"in"===e.phase&&Array.isArray(e.inGraph)&&e.inGraph.length?{signature:`transition:in:${e.inSignature||""}`,forceUpdate:!1,graph:e.inGraph}:null}}let uv;const dv=[/firefox\/(\d+)/,/edg\/(\d+)/,/opr\/(\d+)/,/chrome\/(\d+)/];function hv(){const e=ld&&ld.navigator&&(ld.navigator.userAgent||ld.navigator.platform||ld.navigator.vendor)||"";if(uv&&uv.ua===e)return uv;const t=e.toLowerCase(),n=t.includes("android"),i=t.includes("iphone")||t.includes("ipad")||t.includes("ipod")||t.includes("ios"),r=n||i||t.includes("mobile"),o=!!e&&!r,s=t.includes("firefox/"),a=function(e=""){for(let t=0;t<dv.length;t+=1){const n=dv[t],i=e.match(n);if(!i)continue;const r=Number(i[1]);return Number.isFinite(r)?r:null}if(e.includes("safari/")&&e.includes("version/")){const t=e.match(/version\/(\d+)/);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)?n:null}return null}(t);return uv={ua:e,lowerUA:t,isAndroid:n,isiOS:i,isMobile:r,isDesktop:o,isFirefox:s,browserMajorVersion:a},uv}function fv(){return hv().ua}function pv(){return hv().isAndroid}function mv(){return hv().isiOS}function vv(){return hv().isMobile}function gv(){return hv().isDesktop}function yv(){return hv().isFirefox}function bv(){return hv().browserMajorVersion}var kv={getUserAgent:fv,isAndroid:pv,isiOS:mv,isMobile:vv,isDesktop:gv,isFirefox:yv,getBrowserMajorVersion:bv},wv=Object.freeze({__proto__:null,default:kv,getBrowserMajorVersion:bv,getUserAgent:fv,isAndroid:pv,isDesktop:gv,isFirefox:yv,isMobile:vv,isiOS:mv});const xv="Idle",_v="Playing",Tv="FirstFramePending",Ev="Waiting",Iv="Paused",Sv="Seeking",Av="Resetting";function Nv(e){return Array.isArray(e)?e.filter((e=>e&&"string"==typeof e.type)):[]}function Mv(e,t){return!!Array.isArray(e)&&e.some((e=>(null==e?void 0:e.type)===t))}function Fv(e){const t=Number(e);return!Number.isFinite(t)||t<=0?null:{type:"retarget",options:{frames:Array.from({length:t},(()=>({fitType:"fill"})))},meta:{source:"panAndScan"}}}function Cv(e){return Array.isArray(e)?e.filter((e=>{return!("panAndScan"===(null==(t=e)||null===(n=t.meta)||void 0===n?void 0:n.source));var t,n})):[]}const Ov=2073600;function Pv(e,t){const n=Number(e);return Number.isFinite(n)&&n>0?n:t}function Rv(e,t){if(null==e)return t;const n=Number(e);return Number.isFinite(n)?n:t}var Dv=new WeakMap,Lv=new WeakMap,Bv=new WeakMap,zv=new WeakMap,Wv=new WeakMap,$v=new WeakMap,jv=new WeakMap,Uv=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,eg=new WeakMap,tg=new WeakMap,ng=new WeakMap,ig=new WeakMap,rg=new WeakMap,og=new WeakMap,sg=new WeakMap,ag=new WeakMap,lg=new WeakMap,cg=new WeakMap,ug=new WeakMap,dg=new WeakMap,hg=new WeakMap,fg=new WeakMap,pg=new WeakMap,mg=new WeakMap,vg=new WeakSet;class gg extends od{static get pipelineNodeId(){return"ekoplayer-render-pipeline"}get defaults(){return{defaultRenderParams:void 0,resourceLimits:{enabled:!0,maxCanvasPixels:Ov,maxDevicePixelRatio:0,renderScale:1,transitionMinFrameIntervalMs:33}}}constructor(...e){super(...e),O(this,vg),F(this,Dv,void 0),F(this,Lv,void 0),F(this,Bv,void 0),F(this,zv,void 0),F(this,Wv,void 0),F(this,$v,void 0),F(this,jv,void 0),F(this,Uv,void 0),F(this,qv,void 0),F(this,Vv,void 0),F(this,Gv,void 0),F(this,Hv,void 0),F(this,Kv,null),F(this,Xv,null),F(this,Yv,void 0),F(this,Qv,void 0),F(this,Jv,void 0),F(this,Zv,[]),F(this,eg,[]),F(this,tg,null),F(this,ng,null),F(this,ig,null),F(this,rg,null),F(this,og,null),F(this,sg,null),F(this,ag,new Map),F(this,lg,null),F(this,cg,null),F(this,ug,!1),F(this,dg,!1),F(this,hg,!1),F(this,fg,!1),F(this,pg,[]),F(this,mg,null);const[t,n,i]=e;C(Dv,this,t),C(Lv,this,n),C(Bv,this,i),M(Dv,this)&&"function"==typeof M(Dv,this).enableFirstFrameRenderedGate&&M(Dv,this).enableFirstFrameRenderedGate(),C(Hv,this,new Qm),C(Yv,this,new cv),C(Qv,this,null),C(Jv,this,null),C(ig,this,null),C(zv,this,(e=>A(vg,this,ny).call(this,e))),M(Dv,this)&&"function"==typeof M(Dv,this).on&&(M(Dv,this).on(ud.VISUAL_FRAMES_AVAILABLE,M(zv,this)),C(Wv,this,(()=>{var e,t,n,i;A(vg,this,xg).call(this),A(vg,this,Qg).call(this,0),C(eg,this,[]),C(tg,this,null),C(Kv,this,null),C(Xv,this,null),A(vg,this,$g).call(this),C(lg,this,null);(null===(e=M(Yv,this))||void 0===e||null===(t=e.getState)||void 0===t?void 0:t.call(e))||null===(n=M(Yv,this))||void 0===n||null===(i=n.reset)||void 0===i||i.call(n,M(Qv,this))})),M(Dv,this).on(ud.TIMELINE_SEEKING,M(Wv,this)),C($v,this,((e={})=>{"switch"===(null==e?void 0:e.reason)||"reset"===(null==e?void 0:e.reason)?A(vg,this,bg).call(this):A(vg,this,yg).call(this),A(vg,this,_g).call(this)})),M(Dv,this).on(ud.TIMELINE_RESET,M($v,this)),C(qv,this,(()=>A(vg,this,Vg).call(this))),M(Dv,this).on(ud.TIMELINE_TIME_UPDATE,M(qv,this)),C(jv,this,(()=>{A(vg,this,iy).call(this)&&M(ng,this)&&A(vg,this,ny).call(this,M(ng,this))})),M(Dv,this).on(ud.TIMELINE_STATE_CHANGE,M(jv,this))),M(Lv,this)&&"function"==typeof M(Lv,this).on&&(C(Vv,this,(()=>{const e=M(ng,this);C(fg,this,!0),A(vg,this,yg).call(this),C(ng,this,e)})),M(Lv,this).on(ud.CANVAS_WEBGL_CONTEXT_LOST,M(Vv,this)),C(Gv,this,(()=>{var e;const t=null===(e=M(Lv,this))||void 0===e?void 0:e.gl;if(!t||"function"==typeof t.isContextLost&&t.isContextLost())return void C(fg,this,!0);const n=M(ng,this);C(fg,this,!1),A(vg,this,yg).call(this),C(ng,this,n),n&&A(vg,this,iy).call(this)&&A(vg,this,ny).call(this,n)})),M(Lv,this).on(ud.CANVAS_WEBGL_CONTEXT_RESTORED,M(Gv,this))),C(Uv,this,(()=>{C(tg,this,null),M(ng,this)&&A(vg,this,iy).call(this)&&A(vg,this,ny).call(this,M(ng,this))})),M(Bv,this)&&"function"==typeof M(Bv,this).on&&M(Bv,this).on(ud.CONTAINER_RESIZE,M(Uv,this))}get name(){return"Renderer"}onDispose(){M(Dv,this)&&M(zv,this)&&"function"==typeof M(Dv,this).off&&M(Dv,this).off(ud.VISUAL_FRAMES_AVAILABLE,M(zv,this)),M(Dv,this)&&M(Wv,this)&&"function"==typeof M(Dv,this).off&&M(Dv,this).off(ud.TIMELINE_SEEKING,M(Wv,this)),M(Dv,this)&&M($v,this)&&"function"==typeof M(Dv,this).off&&M(Dv,this).off(ud.TIMELINE_RESET,M($v,this)),M(Dv,this)&&M(qv,this)&&"function"==typeof M(Dv,this).off&&M(Dv,this).off(ud.TIMELINE_TIME_UPDATE,M(qv,this)),M(Dv,this)&&M(jv,this)&&"function"==typeof M(Dv,this).off&&M(Dv,this).off(ud.TIMELINE_STATE_CHANGE,M(jv,this)),M(Bv,this)&&M(Uv,this)&&"function"==typeof M(Bv,this).off&&M(Bv,this).off(ud.CONTAINER_RESIZE,M(Uv,this)),M(Lv,this)&&M(Vv,this)&&"function"==typeof M(Lv,this).off&&M(Lv,this).off(ud.CANVAS_WEBGL_CONTEXT_LOST,M(Vv,this)),M(Lv,this)&&M(Gv,this)&&"function"==typeof M(Lv,this).off&&M(Lv,this).off(ud.CANVAS_WEBGL_CONTEXT_RESTORED,M(Gv,this)),A(vg,this,yg).call(this),C(zv,this,null),C(Wv,this,null),C($v,this,null),C(qv,this,null),C(jv,this,null),C(Uv,this,null),C(Vv,this,null),C(Gv,this,null),C(Hv,this,null),C(Yv,this,null),C(ag,this,null),C(lg,this,null),C(Lv,this,null),C(Bv,this,null),C(Dv,this,null)}startTransition(e={}){var t,n;const i=null===(t=M(Lv,this))||void 0===t?void 0:t.element,r=null===(n=M(Lv,this))||void 0===n?void 0:n.gl;if(!i||!r)return null;if(M(fg,this)||"function"==typeof r.isContextLost&&r.isContextLost())return C(fg,this,!0),null;if(A(vg,this,Eg).call(this,i),!M(Qv,this))return null;const o=M(Yv,this).start({shaderGraph:M(Qv,this),duration:null==e?void 0:e.duration,filter:null==e?void 0:e.filter,color:null==e?void 0:e.color,filters:null==e?void 0:e.filters,reverseFilters:null==e?void 0:e.reverseFilters,transition:null==e?void 0:e.transition});return C(ig,this,M(ng,this)||null),A(vg,this,Zg).call(this),o}beginTransitionIn(e={}){var t,n;null!==(t=M(Yv,this))&&void 0!==t&&null!==(n=t.beginIncoming)&&void 0!==n&&n.call(t,e),C(ig,this,null),A(vg,this,Zg).call(this)}resetTransition(){var e,t;null!==(e=M(Yv,this))&&void 0!==e&&null!==(t=e.reset)&&void 0!==t&&t.call(e,M(Qv,this)),C(ig,this,null),A(vg,this,ey).call(this)}}function yg(){if(A(vg,this,xg).call(this),M(Yv,this)&&"function"==typeof M(Yv,this).reset&&M(Yv,this).reset(M(Qv,this)),A(vg,this,Qg).call(this,0),M(Qv,this)&&"function"==typeof M(Qv,this).dispose)try{M(Qv,this).dispose()}catch(e){}C(Qv,this,null),C(Jv,this,null),C(Zv,this,[]),C(eg,this,[]),C(ug,this,!1),C(tg,this,null),C(Kv,this,null),C(Xv,this,null),C(ng,this,null),C(ig,this,null),A(vg,this,ey).call(this),A(vg,this,$g).call(this),C(lg,this,null)}function bg(){A(vg,this,xg).call(this),M(Yv,this)&&"function"==typeof M(Yv,this).reset&&M(Yv,this).reset(M(Qv,this)),A(vg,this,Qg).call(this,0),C(Zv,this,[]),C(eg,this,[]),C(tg,this,null),C(Kv,this,null),C(Xv,this,null),C(ng,this,null),C(ig,this,null),A(vg,this,ey).call(this),A(vg,this,$g).call(this),C(lg,this,null),C(cg,this,null)}function kg(){const e="function"==typeof ld.requestAnimationFrame?ld.requestAnimationFrame.bind(ld):null,t="function"==typeof ld.cancelAnimationFrame?ld.cancelAnimationFrame.bind(ld):null;return e?{schedule:t=>e(t),cancel(e){"number"==typeof e&&t&&t(e)}}:null}function wg(e){C(pg,this,M(pg,this).filter((t=>t!==e))),M(pg,this).length||C(mg,this,null)}function xg(){M(mg,this)&&M(pg,this).forEach((e=>M(mg,this).call(this,e))),C(pg,this,[]),C(mg,this,null),C(hg,this,!1)}function _g(){A(vg,this,xg).call(this),C(dg,this,!1)}function Tg(){if(M(dg,this)||M(hg,this))return;const e=A(vg,this,kg).call(this);if(!e)return;const{schedule:t,cancel:n}=e;let i;C(mg,this,n),C(hg,this,!0),i=t((()=>{let e;A(vg,this,wg).call(this,i),e=t((()=>{A(vg,this,wg).call(this,e),C(hg,this,!1),M(dg,this)||(C(dg,this,!0),M(Dv,this)&&"function"==typeof M(Dv,this).notifyFirstFrameRendered&&M(Dv,this).notifyFirstFrameRendered())})),M(pg,this).push(e)})),M(pg,this).push(i)}function Eg(e){if(M(Qv,this)||!e)return;const t=this,n={dest:e,src:(e,n)=>{C(Jv,t,n)}};C(Qv,t,new om(n,{userWillCallRender:!0,glOptions:{contextType:"webgl2"},performanceToggles:{useCanvasSizedFilterTargets:!0}})),M(Qv,t)&&"function"==typeof M(Qv,t).addNodes&&M(Qv,t).addNodes({[ot.pipelineNodeId]:{type:"composite",options:{graph:[]}}})}function Ig(e){var t;if("null"===(null==e?void 0:e.message))return!0;const n=null===(t=M(Lv,this))||void 0===t?void 0:t.gl;return!(!n||"function"!=typeof n.isContextLost||!n.isContextLost())}function Sg(e,t,n){const i=t||M(ng,this)||null;if(A(vg,this,yg).call(this),C(ng,this,i),!n)return this.log.warn("Shader graph render failed; rebuilding graph once.",e),void A(vg,this,ny).call(this,i,!0);this.log.warn("Shader graph render is still unavailable after rebuild; deferring until the next render pass.",e)}function Ag(){var e;const t=null===(e=this.settings)||void 0===e?void 0:e.resourceLimits;return!t||"object"!=typeof t||Array.isArray(t)?{}:t}function Ng(){const e=A(vg,this,Ag).call(this).enabled;return!0===e||!1!==e&&mv()}function Mg(){if(!A(vg,this,Ng).call(this))return 0;const e=Rv(A(vg,this,Ag).call(this).transitionMinFrameIntervalMs,33);return Number.isFinite(e)&&e>0?e:0}function Fg(e,t,n={}){const i=!0===(null==n?void 0:n.useDevicePixelRatio),r=A(vg,this,Ng).call(this),o=i?Pv(null==ld?void 0:ld.devicePixelRatio,1):1;let s=o,a=0;if(r){const e=A(vg,this,Ag).call(this);a=Rv(e.maxCanvasPixels,Ov);const t=Rv(e.maxDevicePixelRatio,0);s=Pv(e.renderScale,1)*(t>0?Math.min(o,t):o)}let l=Math.max(1,Math.round(e*s)),c=Math.max(1,Math.round(t*s));if(r&&a>0){const e=l*c;if(e>a){const t=Math.sqrt(a/e);l=Math.max(1,Math.floor(l*t)),c=Math.max(1,Math.floor(c*t))}}return{width:l,height:c}}function Cg(e=[],t={}){var n;const i=null===(n=M(Lv,this))||void 0===n?void 0:n.element,r=M(Jv,this);if(!i||"function"!=typeof r)return!1;let o=0,s=0;const a=!0===(null==t?void 0:t.useViewportSize);if(a){var l,c,u,d,h,f;const e=Number(null!==(l=null===(c=M(Bv,this))||void 0===c?void 0:c.containerWidth)&&void 0!==l?l:null===(u=M(Bv,this))||void 0===u?void 0:u.width),t=Number(null!==(d=null===(h=M(Bv,this))||void 0===h?void 0:h.containerHeight)&&void 0!==d?d:null===(f=M(Bv,this))||void 0===f?void 0:f.height);if(Number.isFinite(e)&&Number.isFinite(t)&&e>0&&t>0)o=Math.round(e),s=Math.round(t);else{const e=Number(i.clientWidth),t=Number(i.clientHeight);Number.isFinite(e)&&Number.isFinite(t)&&e>0&&t>0&&(o=Math.round(e),s=Math.round(t))}}if(!(o>0&&s>0)){if(!Array.isArray(e)||!e.length)return;for(let t=0;t<e.length;t+=1){var p;const n=null===(p=e[t])||void 0===p?void 0:p.frame,i=Number((null==n?void 0:n.displayWidth)||(null==n?void 0:n.codedWidth)||(null==n?void 0:n.videoWidth)||(null==n?void 0:n.naturalWidth)||(null==n?void 0:n.width)),r=Number((null==n?void 0:n.displayHeight)||(null==n?void 0:n.codedHeight)||(null==n?void 0:n.videoHeight)||(null==n?void 0:n.naturalHeight)||(null==n?void 0:n.height));!Number.isFinite(i)||!Number.isFinite(r)||i<=0||r<=0||(i>o&&(o=i),r>s&&(s=r))}}if(!(o>0&&s>0))return!1;const m=A(vg,this,Fg).call(this,o,s,{useDevicePixelRatio:a}),v=m.width,g=m.height,y=M(tg,this);return!(y&&y.width===v&&y.height===g||(C(tg,this,{width:v,height:g}),r(null,null,v,g),0))}function Og(e){const t=null==e?void 0:e.nodeId,n=null==e?void 0:e.trackId,i=null==e?void 0:e.segmentId,r=null==e?void 0:e.presentationTime;return t&&n&&i&&Number.isFinite(r)?`${t}:${n}:${i}@${r}`:null}function Pg(e,t,n){const i=Number.isFinite(null==e?void 0:e.duration)&&e.duration>0?e.duration:void 0;let r;if(i&&Number.isFinite(null==e?void 0:e.offset)){const n=(t-e.offset)/i;r=n<0?0:n>1?1:n}const o=A(vg,this,Rg).call(this,e),s=A(vg,this,Dg).call(this,o);return Km.getRenderTiming({type:o,timing:{duration:i,normalizedTime:r},timelineTime:t,active:e,renderNodeParams:n,state:s})}function Rg(e){return Km.normalizeType(null==e?void 0:e.type)||Km.defaultType}function Dg(e){if(!e||!M(ag,this))return null;let t=M(ag,this).get(e);return t||(t={},M(ag,this).set(e,t)),t}function Lg(){var e,t,n,i,r,o,s,a,l,c,u;const d=Number(null!==(e=null===(t=M(Bv,this))||void 0===t?void 0:t.containerWidth)&&void 0!==e?e:null===(n=M(Bv,this))||void 0===n?void 0:n.width),h=Number(null!==(i=null===(r=M(Bv,this))||void 0===r?void 0:r.containerHeight)&&void 0!==i?i:null===(o=M(Bv,this))||void 0===o?void 0:o.height);if(Number.isFinite(d)&&Number.isFinite(h)&&d>0&&h>0)return{width:Math.round(d),height:Math.round(h)};const f=null===(s=M(Lv,this))||void 0===s?void 0:s.element,p=Number(null==f?void 0:f.clientWidth),m=Number(null==f?void 0:f.clientHeight);if(Number.isFinite(p)&&Number.isFinite(m)&&p>0&&m>0)return{width:Math.round(p),height:Math.round(m)};const v=Number(null!==(a=null==f?void 0:f.width)&&void 0!==a?a:null===(l=M(tg,this))||void 0===l?void 0:l.width),g=Number(null!==(c=null==f?void 0:f.height)&&void 0!==c?c:null===(u=M(tg,this))||void 0===u?void 0:u.height);return Number.isFinite(v)&&Number.isFinite(g)&&v>0&&g>0?{width:Math.round(v),height:Math.round(g)}:null}function Bg(e){const t=A(vg,this,Dg).call(this,e);return t&&"object"==typeof t&&(t.requestRender=()=>A(vg,this,zg).call(this),t.viewportSize=A(vg,this,Lg).call(this)),t}function zg(){M(ug,this)||(C(ug,this,!0),Promise.resolve().then((()=>{C(ug,this,!1),M(ng,this)&&A(vg,this,iy).call(this)&&A(vg,this,ny).call(this,M(ng,this))})))}function Wg(e){if(!e||!M(ag,this))return;const t=M(ag,this).get(e);t&&Km.resetRenderState(e,t),M(ag,this).delete(e)}function $g(){M(ag,this)&&(Km.resetAllRenderStates(M(ag,this)),M(ag,this).clear())}function jg(e,t,n,i){const r=A(vg,this,Rg).call(this,e);M(lg,this)&&M(lg,this)!==r&&A(vg,this,Wg).call(this,M(lg,this)),C(lg,this,r);const o=A(vg,this,Bg).call(this,r);return Km.prepareRenderFrames({type:r,frames:t,timelineTime:n,timeline:M(Dv,this),active:e,renderNodeParams:i,state:o})}function Ug(e){var t;return null!=e&&e.params&&"object"==typeof e.params?e.params:!e&&null!==(t=this.settings)&&void 0!==t&&t.defaultRenderParams&&"object"==typeof this.settings.defaultRenderParams?this.settings.defaultRenderParams:{}}function qg(e){return e?String(e.renderPlacementId||e.type||"unknown"):"default"}function Vg(){if(!M(Dv,this)||!M(ng,this))return;const e=M(Dv,this).currentTime,t=M(Dv,this).getActiveRenderPlacement(e),n=A(vg,this,qg).call(this,t);n!==M(cg,this)&&(C(cg,this,n),A(vg,this,ny).call(this,{...M(ng,this),time:e}))}function Gg(e){return!e||"object"!=typeof e||!Object.prototype.hasOwnProperty.call(e,"panAndScan")||!1!==e.panAndScan}function Hg(e,t){const n=A(vg,this,Ug).call(this,e),i=null==n?void 0:n.stages;let r=Nv(null==i?void 0:i.pre),o=Nv(null==i?void 0:i.post);const s=A(vg,this,Gg).call(this,n),a=A(vg,this,Rg).call(this,e),l=Mv(r,"retarget")||Mv(o,"retarget");if(s&&!l){const i=Km.getPanAndScanTarget(a,{frameCount:Array.isArray(t)?t.length:0,active:e,renderNodeParams:n});if("pre"===i){const e=Fv(Array.isArray(t)?t.length:0);e&&(r=[e,...r])}else if("post"===i){const e=Fv(1);e&&(o=[...o,e])}}else s||(r=Cv(r),o=Cv(o));return{preStages:r,postStages:o,renderNodeParams:n}}function Kg(e,t,n,i,r){const o=r||A(vg,this,Pg).call(this,e,n,i),s=A(vg,this,Hg).call(this,e,t),a=A(vg,this,Rg).call(this,e),l=A(vg,this,Bg).call(this,a);return M(Hv,this).build({layoutType:null==e?void 0:e.type,frames:t,preStages:s.preStages,postStages:s.postStages,normalizedTime:o.normalizedTime,renderNodeDuration:o.duration,renderNodeParams:s.renderNodeParams,renderNodeState:l,timelineTime:n})}function Xg(){var e,t;const n=null===(e=M(Yv,this))||void 0===e||null===(t=e.getState)||void 0===t?void 0:t.call(e);return"out"===(null==n?void 0:n.phase)?M(Yv,this).buildOutgoingGraph():"in"===(null==n?void 0:n.phase)?M(Yv,this).buildIncomingGraph():null}function Yg(e,t,n,i){const r=n||t!==M(Kv,this),o=r||i;return r&&M(Qv,this)&&"function"==typeof M(Qv,this).updateOptions&&(M(Qv,this).updateOptions(ot.pipelineNodeId,{graph:e}),C(Kv,this,t)),M(Qv,this)&&"function"==typeof M(Qv,this).selectNode&&M(Xv,this)!==ot.pipelineNodeId&&(M(Qv,this).selectNode(ot.pipelineNodeId),C(Xv,this,ot.pipelineNodeId)),!(!o||!M(Qv,this)||"function"!=typeof M(Qv,this).render||(M(Qv,this).render({noRaf:!0}),0))}function Qg(e){if(!Array.isArray(M(Zv,this))||!M(Zv,this).length)return;const t=Number.isFinite(e)?Math.max(0,e):0;if(!(M(Zv,this).length<=t)){for(let e=t;e<M(Zv,this).length;e+=1){const t=M(Zv,this)[e];if(t&&M(Qv,this)&&"function"==typeof M(Qv,this).releaseTexture)try{M(Qv,this).releaseTexture(t)}catch(e){}}M(Zv,this).length=t,M(eg,this).length=t}}function Jg(e=[]){if(!M(Qv,this)||"function"!=typeof M(Qv,this).addTexture)return{didUpdate:!1,hasUploadFailure:!1,ready:!1};if("function"==typeof M(Qv,this).isContextUnavailable&&M(Qv,this).isContextUnavailable())return{didUpdate:!1,hasUploadFailure:!1,ready:!1};if(!Array.isArray(e)||!e.length)return A(vg,this,Qg).call(this,0),{didUpdate:!1,hasUploadFailure:!1,ready:!1};A(vg,this,Qg).call(this,e.length);let t=!1,n=!1,i=!0;for(let o=0;o<e.length;o+=1){var r;M(Zv,this)[o]||"function"!=typeof M(Qv,this).addTexture||(M(Zv,this)[o]=M(Qv,this).addTexture(null,"frame",o));const s=A(vg,this,Og).call(this,e[o]),a=null===(r=e[o])||void 0===r?void 0:r.frame;if(M(Zv,this)[o]&&a){if(!s||s!==M(eg,this)[o])try{M(Zv,this)[o].fill(a),M(eg,this)[o]=s,t=!0}catch(e){i=!1,n=!0,M(eg,this)[o]=null}}else i=!1}return{didUpdate:t,hasUploadFailure:n,ready:i}}function Zg(){if(M(rg,this))return;const e="function"==typeof ld.requestAnimationFrame?e=>ld.requestAnimationFrame(e):e=>setTimeout(e,16),t="function"==typeof ld.cancelAnimationFrame?e=>ld.cancelAnimationFrame(e):clearTimeout;C(og,this,t);const n=()=>{var t,i;if(null!==(t=M(Yv,this))&&void 0!==t&&null!==(i=t.getState)&&void 0!==i&&i.call(t)){if(M(ng,this)){const e=A(vg,this,Mg).call(this),t=Date.now();(!e||!M(sg,this)||t-M(sg,this)>=e)&&(C(sg,this,t),A(vg,this,ny).call(this,M(ng,this)))}C(rg,this,e(n))}else C(rg,this,null)};C(rg,this,e(n))}function ey(){M(rg,this)&&M(og,this)&&M(og,this).call(this,M(rg,this)),C(rg,this,null),C(og,this,null),C(sg,this,null)}function ty(e){var t,n;const i=null===(t=M(Yv,this))||void 0===t||null===(n=t.getState)||void 0===n?void 0:n.call(t);return"out"===(null==i?void 0:i.phase)&&M(ig,this)?M(ig,this):e}function ny(e={},t=!1){try{var n,i;e&&C(ng,this,e);const t=null===(n=M(Lv,this))||void 0===n?void 0:n.element,r=null===(i=M(Lv,this))||void 0===i?void 0:i.gl;if(!t||!r)return;if(M(fg,this)||"function"==typeof r.isContextLost&&r.isContextLost())return void C(fg,this,!0);if(!A(vg,this,iy).call(this))return;const o=A(vg,this,ty).call(this,e),s=Number.isFinite(null==o?void 0:o.time)?o.time:void 0;if(!Number.isFinite(s))return;if(A(vg,this,Eg).call(this,t),!M(Qv,this))return;const a=M(Dv,this)&&"function"==typeof M(Dv,this).getActiveRenderPlacement?M(Dv,this).getActiveRenderPlacement(s):void 0,l=A(vg,this,qg).call(this,a);l!==M(cg,this)&&C(cg,this,l);const c=Array.isArray(null==o?void 0:o.frames)?o.frames:[],u=A(vg,this,Ug).call(this,a),d=A(vg,this,Gg).call(this,u),h=A(vg,this,jg).call(this,a,c,s,u),f=A(vg,this,Pg).call(this,a,s,u),p=A(vg,this,Cg).call(this,h,{useViewportSize:d}),m=A(vg,this,Jg).call(this,h),v=m.didUpdate;if(h.length>0&&!m.ready)return void(m.hasUploadFailure&&this.log.warn("Skipping render because one or more input textures could not be uploaded."));const g=A(vg,this,Kg).call(this,a,h,s,u,f),y=A(vg,this,Xg).call(this);let b=g.graph,k=g.signature,w=!!g.isDynamic;y&&Array.isArray(y.graph)&&y.graph.length&&(b=b.concat(y.graph),k=`${k}|${y.signature||"transition"}`,w=w||!!y.forceUpdate);const x=p||v||w||y&&Array.isArray(y.graph)&&y.graph.length;A(vg,this,Yg).call(this,b,k,w,x)&&h.length>0&&A(vg,this,Tg).call(this)}catch(n){if(A(vg,this,Ig).call(this,n))return void A(vg,this,Sg).call(this,n,e,t);throw n}}function iy(){var e;const t=null===(e=M(Dv,this))||void 0===e?void 0:e.state;return t===xv||t===Tv||t===_v||t===Iv}function ry(e){return"number"==typeof e&&Number.isFinite(e)&&e>0}function oy(e){return e&&"resource"===e.entryType&&e.transferSize>0&&e.duration>0&&e.responseEnd>=e.requestStart}function sy(e){return Array.isArray(e)&&0!==e.length?e.reduce(((e,t)=>e+t),0)/e.length:NaN}ot=gg;var ay=new WeakMap,ly=new WeakMap,cy=new WeakMap,uy=new WeakMap,dy=new WeakSet;class hy extends od{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(...e){super(...e),O(this,dy),F(this,ay,void 0),F(this,ly,void 0),F(this,cy,void 0),F(this,uy,void 0),C(ay,this,!!(ld&&ld.navigator&&ld.navigator.connection)),C(ly,this,!(!ld||!ld.performance||"function"!=typeof ld.performance.getEntriesByType)),C(cy,this,A(dy,this,py).call(this)),C(uy,this,A(dy,this,by).call(this))}guesstimate(){const e=A(dy,this,wy).call(this);this.log.debug("[guesstimate] Data:",e);const t=A(dy,this,ky).call(this,e),n=ry(t)?t:e.defaultKbps;return A(dy,this,my).call(this,n),this.log.info(`[guesstimate] Result: ${n} kbps`),n}update(e){ry(e)&&A(dy,this,my).call(this,e)}onDispose(){C(cy,this,void 0),C(uy,this,void 0)}}function fy(){return Math.round(Date.now()/1e3)}function py(){try{if(!ld||!ld.localStorage||"function"!=typeof ld.localStorage.getItem)return}catch(e){return}const e=this.settings.persistentStorage.key,t=ld.localStorage.getItem(e);if(t)try{const e=JSON.parse(t),n=this.settings.persistentStorage.ttl,i=A(dy,this,fy).call(this)-e.timestamp;if("number"==typeof n&&n>=0&&i>n)return null;if(!ry(e.value))return;return e.value}catch(e){return}}function my(e){if(!ry(e))return;try{if(!ld||!ld.localStorage||"function"!=typeof ld.localStorage.setItem)return}catch(e){return}const t=this.settings.persistentStorage.key,n=JSON.stringify({value:e,timestamp:A(dy,this,fy).call(this)});try{ld.localStorage.setItem(t,n),C(cy,this,e)}catch(e){}}function vy(){return ld&&ld.performance&&"function"==typeof ld.performance.getEntriesByType?sy(ld.performance.getEntriesByType("resource").filter(oy).map((e=>8*e.transferSize/e.duration))):NaN}function gy(){if(!ld||!ld.navigator||!ld.navigator.connection)return NaN;const e=ld.navigator.connection.downlink;return ry(e)?1e3*e:NaN}function yy(){if(!M(ay,this))return NaN;const e=ld.navigator.connection,t=e.effectiveType||e.type,n=this.settings.connectionType||{};return t&&Object.prototype.hasOwnProperty.call(n,t)?n[t]:NaN}function by(){const e=this.settings.ua||{};return pv()?e.android:mv()?e.ios:e.desktop}function ky(e){const t=Array.isArray(this.settings.priorities)?this.settings.priorities:[];for(let n=0;n<t.length;n+=1){const i=t[n];if(!Array.isArray(i)||0===i.length)continue;const r=i.map((t=>e[t])).filter((e=>ry(e)));if(r.length===i.length)return this.log.debug("[#selectFromPriorities] Selected from priorities:",i,"with values:",r),sy(r)}return NaN}function wy(){const e=this.settings.testOverrides||{},t=ry(e.resourceTiming)?e.resourceTiming:A(dy,this,vy).call(this),n=ry(e.downlink)?e.downlink:A(dy,this,gy).call(this),i=ry(e.persistentValue)?e.persistentValue:M(cy,this),r=ry(e.connectionType)?e.connectionType:A(dy,this,yy).call(this),o=ry(e.ua)?e.ua:M(uy,this);return{defaultKbps:this.settings.defaultKbps,resourceTiming:t,downlink:n,connectionType:r,persistentValue:i,ua:o}}const xy=new Zu;function _y(e){return"string"!=typeof e||0===e.length?[]:e.split(".").filter((e=>e.length>0))}function Ty(e){if("string"!=typeof e)return!1;if(0===e.length)return!1;const t=Number(e);return Number.isInteger(t)&&String(t)===e}function Ey(e){return null!==e&&"object"==typeof e}function Iy(e,t,n){const i=_y(t);if(0===i.length)return void 0===e?n:e;let r=e;for(let e=0;e<i.length;e+=1){if(null==r)return n;if(r=r[i[e]],void 0===r)return n}return void 0===r?n:r}function Sy(e,t,n){if(!Ey(e))return e;const i=_y(t);if(0===i.length)return e;let r=e;for(let e=0;e<i.length;e+=1){const t=i[e];if(e===i.length-1){r[t]=n;break}Ey(r[t])||(r[t]=Ty(i[e+1])?[]:{}),r=r[t]}return e}const Ay={get:(e,t)=>ld&&ld.eko?Iy(ld.eko,e,t):t,set(e,t){if(ld)return ld.eko&&"object"==typeof ld.eko||(ld.eko={}),Sy(ld.eko,e,t),ld.eko}},Ny=ld&&ld.performance,My=Ny&&"function"==typeof Ny.now?()=>Ny.now():()=>Date.now();function Fy(){return"undefined"==typeof AbortController?null:new AbortController}function Cy(){const e=new Error("The operation was aborted");return e.name="AbortError",e.code="ABORT_ERR",e}function Oy(e,t){return!(!t||!t.aborted)||!!e&&("AbortError"===e.name||"ABORT_ERR"===e.code||20===e.code)}const Py=2,Ry=100,Dy=2,Ly="runtime.downloadSpeedSamples",By=Ju("download","warn");function zy(e){return new Promise((t=>{setTimeout(t,e)}))}function Wy(e){return e>=500}function $y(e){if(!e||!e.headers||"function"!=typeof e.headers.get)return 0;const t=e.headers.get("content-length");if(!t)return 0;const n=Number(t);return Number.isNaN(n)||n<0?0:n}function jy(e,t,n,i,r,o){const s={bytes:e,durationMs:t,kbps:t>0?8*e/t:0,startTime:n,endTime:i,url:o};try{let e=Ay.get(r);e||(e=[],Ay.set(r,e)),e.push(s)}catch(e){}return s}async function Uy(e,t={}){const{method:n="GET",headers:i,body:r,retries:o=Py,retryDelay:s=Ry,backoffFactor:a=Dy,samplesTargetPath:l=Ly,fetch:c,loglevel:u="warn",cache:d,signal:h,onProgress:f,returnType:p="default"}=t;By.setLevel(u);const m=function(e){if(e)return e;if(ld&&"function"==typeof ld.fetch)return ld.fetch.bind(ld);throw new Error("fetch is not available in this environment")}(c);let v=0,g=s;for(;;){if(h&&h.aborted)throw Cy();const t=My();try{const s=await m(e,{method:n,headers:i,body:r,cache:d,mode:"cors",signal:h});if(h&&h.aborted)throw Cy();if(!s.ok){if(v<o&&Wy(s.status)){v+=1,By.warn(`[${e}] Download attempt #${v} failed with status ${s.status}, retrying in ${g}ms...`),await zy(g),g*=a;continue}By.error(`[${e}] Download attempt #${v} failed with status ${s.status}, no more retries.`);const t=new Error(`Download failed with status ${s.status}`);throw t.status=s.status,t}let c=My();const u=$y(s),y="arrayBuffer"===p||"bytes"===p,b=y&&"function"==typeof f;let k,w,x,_,T,E=0;if(y&&s.body&&"function"==typeof s.body.getReader&&b){const e=s.body.getReader(),t=[];for(;;){if(h&&h.aborted)throw Cy();const{done:n,value:i}=await e.read();if(n)break;if(i&&i.length){const e=My();Number.isFinite(_)||(_=e),T=e,t.push(i),E+=i.length,f({loaded:E,total:u||void 0,chunk:i})}}k=new Uint8Array(E);let n=0;t.forEach((e=>{k.set(e,n),n+=e.length})),c=My()}else if(y){const e=await s.arrayBuffer();k=new Uint8Array(e),E=k.length,c=My()}else"text"===p?(w=await s.text(),c=My()):"json"===p&&(x=await s.json(),c=My());if(h&&h.aborted)throw Cy();const I=y?k?k.length:E:("text"===p&&"string"==typeof w?w.length:0)||("json"===p&&x?JSON.stringify(x).length:0),S=u||I||0;let A=t,N=c;Number.isFinite(_)&&(A=_,Number.isFinite(T)&&(N=Math.max(T,c))),(!Number.isFinite(A)||!Number.isFinite(N)||N<A)&&(A=t,N=c);const M=Math.max(0,N-A),F=jy(S,M,A,N,l,e);try{xy.trigger("download:sample",F)}catch(e){}const C={response:s,bytes:S,durationMs:M,kbps:F.kbps,startTime:F.startTime,endTime:F.endTime};if("default"===p)return C;if("arrayBuffer"===p||"bytes"===p){const e=k||new Uint8Array(await s.arrayBuffer());return"arrayBuffer"===p?e.buffer:e}return"text"===p?w:"json"===p?x:C}catch(t){if(Oy(t,h))throw"AbortError"===t.name?t:Cy();if(!(v<o)||t.status&&!Wy(t.status))throw By.error(`[${e}] Download attempt #${v} failed with error ${t}, no more retries.`),t;v+=1,By.warn(`[${e}] Download attempt #${v} failed with error ${t}, retrying in ${g}ms...`),await zy(g),g*=a}}}const qy={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"]}},Vy=Object.freeze(Object.entries(qy).reduce(((e,[t,n])=>(Object.prototype.hasOwnProperty.call(n,"default")&&(e[t]=n.default),e)),{})),Gy=Ju("config","warn");function Hy(e){return Vy[e]}var Ky=new WeakMap,Xy=new WeakMap,Yy=new WeakMap,Qy=new WeakMap,Jy=new WeakMap,Zy=new WeakSet;class eb extends od{get name(){return"DownloadSpeed"}get defaults(){return{alpha:.3,maxSamples:30,minBytesPerSample:1024,minDurationMs:5,maxSampleKbpsCap:void 0,ignoreCacheHits:!0,samplesPath:"runtime.downloadSpeedSamples",initialKbps:Hy("initialKbps"),probeUrl:void 0,defaultKbps:2500}}constructor(...e){super(...e),O(this,Zy),F(this,Ky,void 0),F(this,Xy,void 0),F(this,Yy,void 0),F(this,Qy,void 0),F(this,Jy,void 0),C(Yy,this,[]),C(Xy,this,0),C(Ky,this,A(Zy,this,ib).call(this)),C(Jy,this,Fy()),C(Qy,this,(e=>{A(Zy,this,cb).call(this,e,"event")})),A(Zy,this,rb).call(this),xy.on("download:sample",M(Qy,this)),A(Zy,this,ob).call(this),this.log.debug(`[#constructor] Initial estimate: ${M(Ky,this)} kbps`)}getKbps(){return M(Ky,this)}addSample(e){A(Zy,this,cb).call(this,e,"manual")}reset(){C(Yy,this,[]),C(Xy,this,0),C(Ky,this,A(Zy,this,ib).call(this))}onDispose(){M(Jy,this)&&M(Jy,this).abort(),C(Jy,this,null),xy.off("download:sample",M(Qy,this)),C(Yy,this,[]),C(Xy,this,0),C(Ky,this,void 0),C(Qy,this,null)}}function tb(e,t){return!!(this.settings.ignoreCacheHits&&(0===t||e&&"boolean"==typeof e.cached&&e.cached||e&&"number"==typeof e.transferSize&&"number"==typeof e.encodedBodySize&&e.transferSize<=e.encodedBodySize))}function nb(e){if(!e||"object"!=typeof e)return null;const t=Number(e.bytes),n=Number(e.durationMs);let i=ry(e.kbps)?Number(e.kbps):NaN;return!ry(i)&&n>0&&ry(t)&&(i=8*t/n),ry(i)?t<=this.settings.minBytesPerSample||n<=this.settings.minDurationMs||A(Zy,this,tb).call(this,e,t)?null:(ry(this.settings.maxSampleKbpsCap)&&i>this.settings.maxSampleKbpsCap&&(i=this.settings.maxSampleKbpsCap),{...e,bytes:t,durationMs:n,kbps:i}):null}function ib(){const e=this.settings.initialKbps;if(ry(e))return e;if("auto"===e)try{const e=(new hy).guesstimate();if(ry(e))return e}catch(e){}return this.settings.defaultKbps}function rb(){const e=Ay.get(this.settings.samplesPath,[]);if(!Array.isArray(e)||0===e.length)return;const t=e.slice(-this.settings.maxSamples);for(let e=0;e<t.length;e+=1)A(Zy,this,cb).call(this,t[e],"replay",{emit:!1})}async function ob(){if(!this.settings.probeUrl||M(Xy,this)>0)return;const e=M(Jy,this)?M(Jy,this).signal:void 0;if(!e||!e.aborted)try{await Uy(this.settings.probeUrl,{cache:"no-store",samplesTargetPath:this.settings.samplesPath,signal:e})}catch(e){}}function sb(e){return"number"==typeof e.startTime&&"number"==typeof e.endTime&&Number.isFinite(e.startTime)&&Number.isFinite(e.endTime)&&e.startTime>=0&&e.endTime>e.startTime}function ab(e,t){if(!A(Zy,this,sb).call(this,e)||!A(Zy,this,sb).call(this,t))return 0;const n=Math.max(e.startTime,t.startTime);return Math.min(e.endTime,t.endTime)-n}function lb(e){if(!A(Zy,this,sb).call(this,e))return e;const t=[];for(let n=0;n<M(Yy,this).length;n+=1){const i=M(Yy,this)[n];A(Zy,this,sb).call(this,i)&&(A(Zy,this,ab).call(this,e,i)>0&&t.push(i))}if(0===t.length)return e;C(Yy,this,M(Yy,this).filter((e=>!t.includes(e))));const n=[e,...t],i=n.reduce(((e,t)=>e+(t.bytes||0)),0),r=Math.min(...n.map((e=>e.startTime))),o=Math.max(...n.map((e=>e.endTime))),s=o-r;if(!ry(i)||s<=0)return e;const a={bytes:i,durationMs:s,kbps:8*i/s,startTime:r,endTime:o,url:e.url||t[t.length-1].url};return A(Zy,this,nb).call(this,a)}function cb(e,t,{emit:n=!0}={}){const i=A(Zy,this,nb).call(this,e);if(!i)return;const r=A(Zy,this,lb).call(this,i);if(!r)return;C(Xy,this,M(Xy,this)+1),M(Yy,this).push(r),M(Yy,this).length>this.settings.maxSamples&&M(Yy,this).shift();const o=this.defaults.alpha,s="number"==typeof this.settings.alpha?this.settings.alpha:o,a=ry(M(Ky,this)),l=a?M(Ky,this):r.kbps,c=a||1!==M(Xy,this)?s*r.kbps+(1-s)*l:r.kbps;C(Ky,this,c),this.log.debug(`[#ingestSample] Next estimate: ${c} kbps`),n&&this.trigger("download:speed",{kbps:M(Ky,this),sample:r,source:t,samplesCount:M(Xy,this)})}class ub{constructor(e={}){const{id:t,url:n,uri:i,mime:r,codecs:o,bandwidth:s,timescale:a,sizeBytes:l,...c}=e;if(!t)throw new Error("Representation requires id");const u=n||i;if(!u)throw new Error("Representation requires url or uri");this.id=t,this.url=u,this.mime=r,this.codecs=o,this.baseCodec=function(e=""){if(!e||"string"!=typeof e)return;const t=e.split(",")[0].trim();if(!t)return;const n=t.match(/^[a-z0-9]+/i);return n?n[0].toLowerCase():void 0}(o),ry(s)&&(this.bandwidth=s),ry(a)&&(this.timescale=a),ry(l)&&(this.sizeBytes=l),Object.assign(this,c)}}class db{#F=new Map;#C;#O;#P=0;#R;constructor(e={}){const{id:t,offset:n=0,duration:i=0,isInit:r=!1,representations:o=[]}=e;if(!t)throw new Error("Segment requires id");o.forEach((e=>{if(!e||!e.url&&!e.uri)throw new Error("Segment representation must include uri or url")})),this.id=t,this.offset=n,this.duration=i,this.isInit=!!r,this.originalRepresentations=o.map((e=>e instanceof ub?e:new ub(e))),this.representations=this.originalRepresentations.map((e=>e)),this.appliedFilters=[],this.loadAttempts=0,this.loadError=void 0}setRepresentationBuffer(e,t){e&&t&&this.#F.set(e,t)}setDownloadProgress(e,t){const n=Number(e);Number.isFinite(n)&&n>=0&&(this.#P=Math.max(this.#P,n));const i=Number(t);Number.isFinite(i)&&i>0&&(this.#R=i)}setChosenRepresentation(e){this.#C=e;const t=null==e?void 0:e.id;if(!(this.isInit||!t||this.#F.size<=1))for(const e of this.#F.keys())e!==t&&this.#F.delete(e)}setABRDecisionSnapshot(e){if(!e||"object"!=typeof e)return void(this.#O=void 0);const t={...e};Array.isArray(e.availableRepresentations)&&(t.availableRepresentations=e.availableRepresentations.map((e=>({...e})))),this.#O=t}markLoadAttempt(){const e=Number(this.loadAttempts);this.loadAttempts=Number.isFinite(e)&&e>0?e+1:1,this.loadError=void 0}setLoadError(e){this.loadError=e||new Error("Segment load failed")}getRepresentationBuffer(e){return this.#F.get(e)}get chosenRepresentation(){return this.#C}get abrDecision(){return this.#O}get arrayBuffer(){return this.#C?this.#F.get(this.#C.id):void 0}get retainedByteLength(){let e=0;for(const t of this.#F.values())t&&"number"==typeof t.byteLength&&(e+=t.byteLength);return e}get bufferedRatio(){var e;const t=ry(this.#R)?this.#R:null===(e=this.#C)||void 0===e?void 0:e.sizeBytes;return ry(t)?Math.min(1,Math.max(0,this.#P/t)):this.retainedByteLength>0?1:0}get isLoaded(){return this.retainedByteLength>0}evict(){this.#C=void 0,this.#O=void 0,this.#F.clear(),this.#P=0,this.#R=void 0}}class hb{constructor(e={}){const{timestamp:t,name:n,data:i,isSticky:r=!1}=e;this.timestamp="number"==typeof t?t:0,this.name="string"==typeof n?n:"",this.data=i,this.isSticky="boolean"==typeof r&&r}}function fb(e,t){const n=Number(null==e?void 0:e.offset),i=Number(null==e?void 0:e.duration);if(!t)return{offset:n,duration:i};const r=(null==e?void 0:e.chosenRepresentation)||(Array.isArray(null==e?void 0:e.representations)?e.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 pb(e,t,n={}){if(!Array.isArray(e)||!e.length)return;const i=Number(t);if(!Number.isFinite(i))return;const r=!!n.preferRepresentationTime;let o,s,a=-1/0;for(let t=0;t<e.length;t+=1){const n=e[t];if(!n||n.isInit)continue;o||(o=n);const l=fb(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 mb=new Set(["video","audio","image","cue","data","bbox"]);let vb=class{constructor(e={}){const{id:t,type:n,offset:i=0,duration:r,source:o,segments:s=[],cues:a=[]}=e;if(!t)throw new Error("Track requires id");if(!mb.has(n))throw new Error(`Track type must be one of ${Array.from(mb).join("|")}`);this.id=t,this.type=n,this.offset=i,this.duration=ry(r)?r:void 0,this.source=o,"cue"===n?(this._cues=a.map((e=>e instanceof hb?e:new hb(e))),this._segments=[]):(this._segments=s.map((e=>e instanceof db?e:new db(e))),this._cues=void 0)}get segments(){return this._segments.slice()}get cues(){if("cue"===this.type)return this._cues.slice()}get endTime(){if(ry(this.duration))return this.offset+this.duration;if(!this._segments.length)return;const e=this._segments.reduce(((e,t)=>{const n=ry(t.duration)?t.duration:0;return Math.max(e,t.offset+n)}),this.offset);return e}get buffered(){const e=this._segments.map((e=>({duration:ry(null==e?void 0:e.duration)?e.duration:0,offset:ry(null==e?void 0:e.offset)?e.offset:0,ratio:e&&!e.isInit&&"number"==typeof e.bufferedRatio?e.bufferedRatio:0}))).filter((e=>e.duration>0&&e.ratio>0));if(!e.length)return;const t=e.reduce(((e,t)=>Math.min(e,t.offset)),1/0),n=e.reduce(((e,t)=>{const n=t.offset+t.duration*Math.min(1,t.ratio);return Math.max(e,n)}),0);return!Number.isFinite(t)||!Number.isFinite(n)||n<=t?void 0:{start:t,end:n}}getMediaSegmentAtTime(e,t={}){return pb(this._segments,e,t)}setSegments(e=[]){if("cue"===this.type)return;const t=Array.isArray(e)?e:[];this._segments=t.map((e=>e instanceof db?e:new db(e)))}};function gb(e){return"string"==typeof e?e:e&&"object"==typeof e?e.nodeId||e.nodeIdOrRef||e.id:void 0}function yb(e){const t=gb(e);let n=1;if(e&&"object"==typeof e&&ry(e.weight)&&(n=e.weight),!t)throw new Error("Child entry requires a nodeId");return{nodeId:t,weight:n}}function bb(e){return(Array.isArray(e)?e:[]).map((e=>yb(e)))}function kb(e,t=void 0){if("string"==typeof e){const t=e.match(/\d+\.?\d*/);if(t){const e=Number(t[0]);if(Number.isFinite(e))return e}}else if("number"==typeof e&&Number.isFinite(e))return e;return t}function wb(e,t){if(e){if(e.includes("$Number%")){const n=e.match(/\$Number%0(\d+)d\$/);if(n){const i=Number(n[1]),r=String(t).padStart(i,"0");return e.replace(/\$Number%0\d+d\$/,r)}}return e.replace(/\$Number\$/g,String(t))}}function xb(e,t){if(t)try{var n;return new URL(t,e||(null==ld||null===(n=ld.location)||void 0===n?void 0:n.href)||void 0).toString()}catch(e){return t}}const _b=new Map;class Tb{static register(e,t){if(!e||"function"!=typeof t)throw new Error("ManifestFactory.register requires type and parser function");_b.set(e,t)}static inferType(e={}){const{typeHint:t,url:n,mimeType:i,body:r}=e;return t||function(e=""){const t=function(e=""){return e&&"string"==typeof e?e.split("#")[0].split("?")[0].toLowerCase():""}(e);return t.endsWith(".mpd")?"dash":t.endsWith(".ivd")?"ivd":t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".png")||t.endsWith(".webp")||t.endsWith(".gif")||t.endsWith(".avif")?"image":void 0}(n||"")||function(e=""){const t=e.toLowerCase();return t.includes("dash")||t.includes("mpd")||t.includes("xml")?"dash":t.includes("ivd")||t.includes("json")?"ivd":t.includes("image/")?"image":void 0}(i||"")||function(e=""){const t="string"==typeof e?e.trim():"";if(t.startsWith("<")&&t.includes("<MPD"))return"dash";if(t.startsWith("{"))try{const e=JSON.parse(t);if(e&&"object"==typeof e)return"ivd"}catch(e){return}}(r||"")}static parse(e={}){const t=Tb.inferType(e);if(!t||!_b.has(t))throw new Error("Unsupported manifest type");return _b.get(t)(e)}}Tb.register("dash",(function(e={}){const{body:t,url:n}=e,i=function(){if(ld&&"function"==typeof ld.DOMParser)return new ld.DOMParser;throw new Error("DOMParser is not available in this environment")}().parseFromString(t||"","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=kb(r.getAttribute("mediaPresentationDuration"));l=Number.isFinite(l)?l:void 0,s.forEach(((e,t)=>{const i=e.getAttribute("mimeType")||"",r=function(e=""){const t=e.toLowerCase();return t.includes("video")?"video":t.includes("audio")?"audio":t.includes("image")?"image":"data"}(i),o=e.getAttribute("id")||`${r}-${t+1}`,s=e.getElementsByTagName("SegmentTemplate")[0],c=Array.from(e.getElementsByTagName("Representation")).map((e=>function(e,t,n){const i=e.getAttribute("id")||e.getAttribute("representationId")||"",r=kb(e.getAttribute("bandwidth")),o=e.getAttribute("codecs"),s=e.getAttribute("mimeType")||t&&t.getAttribute("mimeType")||n,a=e.getElementsByTagName("SegmentTemplate")[0]||t;return{repId:i,bandwidth:r,codecs:o,mime:s,media:a?a.getAttribute("media"):void 0,initialization:a?a.getAttribute("initialization"):void 0,timescale:kb(a&&a.getAttribute("timescale"))||kb(t&&t.getAttribute("timescale"),1)||1,startNumber:kb(a&&a.getAttribute("startNumber"))||kb(t&&t.getAttribute("startNumber"),1)||1,timeline:function(e){const t=[],n=e.getElementsByTagName("SegmentTimeline")[0];if(!n)return t;const i=Array.from(n.getElementsByTagName("S"));let r=0;for(let e=0;e<i.length;e+=1){const n=i[e],o=kb(n.getAttribute("t")),s=kb(n.getAttribute("d")),a=kb(n.getAttribute("r"),0);if(!ry(s))continue;ry(o)&&(r=o);const l=a>=0?a:0;for(let e=0;e<=l;e+=1)t.push({start:r,duration:s}),r+=s}return t}(a)}}(e,s,i))),u=c.map((e=>({id:e.repId,url:xb(n,wb(e.initialization,e.startNumber)),bandwidth:e.bandwidth,mime:e.mime,codecs:e.codecs,timescale:e.timescale}))).filter((e=>e.url)),d=c.reduce(((e,t)=>{const n=Array.isArray(null==e?void 0:e.timeline)?e.timeline.length:0;return(Array.isArray(null==t?void 0:t.timeline)?t.timeline.length:0)>n?t:e}),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 e=0;e<f;e+=1){const t=h[e];if(!t)continue;const i=c.map((t=>{const i=t.startNumber+e,r=t.timescale||m,o=Array.isArray(t.timeline)?t.timeline[e]:void 0;if(!o)return null;const s=o.start,a=o.duration;return{id:t.repId,url:xb(n,wb(t.media,i)),bandwidth:t.bandwidth,mime:t.mime,codecs:t.codecs,timescale:t.timescale,segIndex:e,segStart:s/r,segDuration:a/r}})).filter(Boolean);i.length&&p.push({id:`${o}-seg-${e+1}`,offset:t.start/m,duration:t.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}})),Tb.register("ivd",(function(e={}){var t;const{body:n,url:i}=e;let r;try{r="string"==typeof n?JSON.parse(n):n}catch(e){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(((e,t)=>{const n=function(e){const t=(e.mimeType||"").toLowerCase();return t.includes("video")?"video":t.includes("audio")?"audio":"data"}(e),i=Number.isInteger(e.altIndex)?e.altIndex:0,r=`${n}-${i}`,o=(l=t,{id:`${(a=e).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:ry(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(((e,t)=>{const n=new Map;e.reps.forEach((e=>{const t=Number.isInteger(e.segIndex)?e.segIndex:0;n.has(t)||n.set(t,[]),n.get(t).push(e)}));const i=Array.from(n.keys()).sort(((e,t)=>e-t));let o=0;const s=i.map((i=>{var r;const s=n.get(i)||[],a=(null===(r=s.find((e=>ry(e.duration))))||void 0===r?void 0:r.duration)||0,l={id:`${e.type}-${e.altIndex}-${t+1}-seg-${i+1}`,offset:o,duration:a,isInit:!1,representations:s.map((e=>{const{duration:t,segIndex:n,...i}=e;return i}))};return o+=a,l})),a=s.reduce(((e,t)=>e+(ry(t.duration)?t.duration:0)),0),l=ry(r.duration)?r.duration:a||void 0;return{id:`${e.type}-${e.altIndex}-${t+1}`,type:e.type,offset:0,duration:l,segments:s}})),l=r.mainTrackId||(null===(t=a.find((e=>"video"===e.type)))||void 0===t?void 0:t.id)||a[0]&&a[0].id,c=a.find((e=>e.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}})),Tb.register("image",(function(e={}){const t=null==e?void 0:e.url;if(!t||"string"!=typeof t)throw new Error("ImageParser requires url");const n=ry(null==e?void 0:e.duration)?e.duration:30,i=ry(null==e?void 0:e.width)?e.width:void 0,r=ry(null==e?void 0:e.height)?e.height:void 0,o={id:"image-1",url:t,mime:"string"==typeof(null==e?void 0:e.mimeType)?e.mimeType:void 0};ry(i)&&ry(r)&&(o.width=i,o.height=r);const s="image-1";return{id:t,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 Eb=["video/mp4"];function Ib(e){return Eb.includes(e.mime)}var Sb={name:"containers",fn:function(e=[]){return e.filter(Ib)},isRelevantForTrack:function(e){return"video"===(null==e?void 0:e.type)}};const Ab=new(st=new WeakMap,at=new WeakSet,class extends od{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(...e){super(...e),O(this,at),F(this,st,void 0),C(st,this,new Map)}onDispose(){M(st,this)&&M(st,this).clear()}async sortRepsCodecs(e=[]){if(!Array.isArray(e)||0===e.length)return[];const t=[],n=new Set;let i=0;e.forEach((e=>{const r=null==e?void 0:e.baseCodec;r&&!n.has(r)&&(n.add(r),t.push({codec:r,rep:e,index:i}),i+=1)}));const r=(await Promise.all(t.map((async e=>{const{score:t}=await A(at,this,Ob).call(this,e.rep);return{...e,score:t}})))).sort(((e,t)=>{const n=t.score-e.score;return 0!==n?n:e.index-t.index}));return this.log.info("[sortRepsCodecs] Sorted entries:",r),r.map((e=>e.codec))}});function Nb(){return!!(ld&&ld.navigator&&ld.navigator.mediaCapabilities&&"function"==typeof ld.navigator.mediaCapabilities.decodingInfo)}function Mb(e){if(!e||"object"!=typeof e)return void this.log.debug("[#buildConfig] Invalid representation:",e);const t=e.mime||e.mimeType||"",n=function(e="",t=""){const n=e||"",i=t||"";return i?`${n}; codecs="${i}"`:n}(t,e.codecs||"");return function(e=""){return e.toLowerCase().includes("video")}(t)?(this.log.debug("[#buildConfig] Building video config for:",e),{type:"file",video:{contentType:n,width:e.width||1920,height:e.height||1080,bitrate:e.videoBandwidth||e.bandwidth||0,framerate:e.framerate||e.frameRate||24}}):function(e=""){return e.toLowerCase().includes("audio")}(t)?(this.log.debug("[#buildConfig] Building audio config for:",e),{type:"file",audio:{contentType:n,channels:e.channels||2,bitrate:e.audioBandwidth||e.bandwidth||0,samplerate:e.audioSamplingRate||48e3}}):void this.log.debug("[#buildConfig] Unknown mime type:",t)}function Fb(e){return e?JSON.stringify(e):"invalid"}async function Cb(e){if(!this.settings.enabled||!A(at,this,Nb).call(this)||!e)return this.log.debug("[#queryCapabilities] Not supported, returning false",e),{supported:!1,smooth:!1,powerEfficient:!1};const t=A(at,this,Fb).call(this,e),n=M(st,this).get(t);if(n)return n;let i;try{i=await ld.navigator.mediaCapabilities.decodingInfo(e)}catch(e){i={supported:!1,smooth:!1,powerEfficient:!1}}return this.log.debug("[#queryCapabilities] Config:",e,"\nDecoding info result:",i),M(st,this).set(t,i),i}async function Ob(e){if(A(at,this,Rb).call(this,e))return this.log.debug("[#scoreRepresentation] Blocking HEVC on Firefox versions below support threshold",null==e?void 0:e.codecs),{score:-1e3,capability:{supported:!1,smooth:!1,powerEfficient:!1}};const t=A(at,this,Mb).call(this,e),n=await A(at,this,Cb).call(this,t),i=function(e="",t={}){const n=(e||"").toLowerCase();return Object.keys(t).reduce(((e,i)=>n.includes(i.toLowerCase())?t[i]:e),0)}(e.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 Pb(){if(!yv())return!1;const e=bv();return!Number.isFinite(e)||e<150}function Rb(e){if(!A(at,this,Pb).call(this))return!1;const t=function(e=""){const t=String(e||"").toLowerCase(),[n]=t.split(".");return n||""}((null==e?void 0:e.baseCodec)||(null==e?void 0:e.codecs)||"");return"hvc1"===t||"hev1"===t}const Db=[],Lb=()=>!0;[Sb,{name:"force-video-codec",fn:function(e=[],{node:t}={}){const n=function(e){if("string"!=typeof e)return;const t=e.split(",")[0].trim();if(!t)return;const n=t.match(/^[a-z0-9]+/i);return n?n[0].toLowerCase():void 0}(null==t?void 0:t.forceVideoCodec);if(!n)return e;const i=e.filter((e=>(null==e?void 0:e.baseCodec)===n));return i.length?i:e},isRelevantForTrack:function(e){return"video"===(null==e?void 0:e.type)}},{name:"media-capabilities",fn:async function(e=[],{track:t}){if(null==t||!t.preferredCodec){const n=await Ab.sortRepsCodecs(e);if(!Array.isArray(n)||0===n.length)return e;t.preferredCodec=n[0]}return e.filter((e=>(null==e?void 0:e.baseCodec)===t.preferredCodec))},isRelevantForTrack:function(e){return"video"===(null==e?void 0:e.type)}}].forEach((({name:e,fn:t,isRelevantForTrack:n})=>{!function(e,t,{isRelevantForTrack:n}={}){if(!e||"function"!=typeof t)throw new Error("registerRepresentationFilter requires a name and function");const i="function"==typeof n?n:Lb;Db.push({name:e,fn:t,isRelevantForTrack:i})}(e,t,{isRelevantForTrack:n})}));const Bb=Ju("Node","warn"),zb={start:0,end:0},Wb=.001;function $b(e){if(!Array.isArray(e)||!e.length)return;const t=e.map((e=>{const t=Number(null==e?void 0:e.segStart),n=Number(null==e?void 0:e.segDuration);return!Number.isFinite(t)||!Number.isFinite(n)||n<=0?null:{start:t,duration:n}}));if(t.some((e=>!e)))return;const n=t[0];return t.every((e=>Math.abs(e.start-n.start)<=Wb&&Math.abs(e.duration-n.duration)<=Wb))?{offset:n.start,duration:n.duration}:void 0}var jb=new WeakMap,Ub=new WeakMap,qb=new WeakMap,Vb=new WeakMap,Gb=new WeakMap,Hb=new WeakMap,Kb=new WeakMap,Xb=new WeakMap,Yb=new WeakMap,Qb=new WeakMap,Jb=new WeakSet;class Zb extends Zu{constructor(e={},t={}){super(),O(this,Jb),F(this,jb,void 0),F(this,Ub,void 0),F(this,qb,void 0),F(this,Vb,void 0),F(this,Gb,void 0),F(this,Hb,void 0),F(this,Kb,void 0),F(this,Xb,void 0),F(this,Yb,void 0),F(this,Qb,[]);const{id:n,manifestRef:i,duration:r,width:o,height:s,metadata:a={},children:l=[]}=e;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(t.disabledTracks)?t.disabledTracks.filter((e=>"string"==typeof e)):[],this.enabledRepFilters=Array.isArray(t.enabledRepFilters)?t.enabledRepFilters:void 0,this.forceVideoCodec="string"==typeof t.forceVideoCodec&&t.forceVideoCodec.trim()?t.forceVideoCodec.trim():void 0,C(Kb,this,!0===t.forceImageFallback),C(jb,this,t.abrSelector),C(Ub,this,t.assetsDeliveryService),C(Vb,this,ry(r)?r:void 0),C(Gb,this,ry(o)?o:void 0),C(Hb,this,ry(s)?s:void 0),C(Xb,this,t&&"object"==typeof t.mediaHostRewriteMap?t.mediaHostRewriteMap:void 0),C(Yb,this,ry(t.maxManifestLoadAttempts)?t.maxManifestLoadAttempts:1/0),this.manifestLoadAttempts=0,this.manifestLoadError=void 0,C(Qb,this,bb(l))}setChildren(e){const t=bb(e);return A(Jb,this,gk).call(this,t,{emit:!0})}addChild(e){const t=yb(e),n=M(Qb,this).slice(),i=n.findIndex((e=>(null==e?void 0:e.nodeId)===t.nodeId));if(i>=0){var r;if((null===(r=n[i])||void 0===r?void 0:r.weight)===t.weight)return this.children;n[i]=t}else n.push(t);return A(Jb,this,gk).call(this,n,{emit:!0})}removeChild(e){const t=gb(e);if(!t)return this.children;const n=M(Qb,this).filter((e=>(null==e?void 0:e.nodeId)!==t));return n.length===M(Qb,this).length?this.children:A(Jb,this,gk).call(this,n,{emit:!0})}async load(e={}){const{loadingMode:t="full",signal:n}=e;Bb.info(`[load] [${this.id}] Loading node in '${t}' mode`);try{if(n&&n.aborted)throw Cy();"ready"!==this.state&&await this.resolve({signal:n});const e="partial"===t,i=[];this.tracks.forEach((t=>{const n=t.segments||[];if(e){const e=n.find((e=>e.isInit)),r=n.find((e=>!e.isInit));e&&Array.isArray(e.representations)&&!e.isLoaded&&i.push({track:t,segment:e}),r&&Array.isArray(r.representations)&&!r.isLoaded&&i.push({track:t,segment:r})}else n.forEach((e=>{Array.isArray(e.representations)&&!e.isLoaded&&i.push({track:t,segment:e})}))}));const r=i.filter((({segment:e})=>e.isInit)),o=i.filter((({segment:e})=>!e.isInit)),s=o.length?o[0]:void 0,a=r.map((({track:e,segment:t})=>A(Jb,this,fk).call(this,e,t,n))),l=s?A(Jb,this,pk).call(this,s.segment,s.track,n):Promise.resolve();await Promise.all([...a,l]);const c=s?o.slice(1):o;for(const e of c)await A(Jb,this,pk).call(this,e.segment,e.track,n);if(n&&n.aborted)throw Cy();return this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:t}),this}catch(e){if(Oy(e,n))throw e;throw this.trigger("node:loaderror",{nodeId:this.id,node:this,error:e,loadingMode:t}),e}}async loadMediaSegmentsAtOffset(e,t={}){const n=Number(e);if(Bb.info(`[loadMediaSegmentsAtOffset] [${this.id}] Loading media segments at offset ${n}`),!Number.isFinite(n))return;const{signal:i}=t;if(i&&i.aborted)throw Cy();if("ready"!==this.state&&await this.resolve({signal:i}),"ready"!==this.state)return;const r=[],o=[];if(this.tracks.forEach((e=>{const t=(null==e?void 0:e.segments)||[];if(!Array.isArray(t)||!t.length)return;const s=t.find((e=>(null==e?void 0:e.isInit)&&Array.isArray(null==e?void 0:e.representations)));s&&!s.isLoaded&&r.push(A(Jb,this,fk).call(this,e,s,i)),t.forEach((t=>{if(!t||t.isInit||!Array.isArray(t.representations))return;const i=Number(t.offset);Number.isFinite(i)&&Math.abs(i-n)<=Wb&&!t.isLoaded&&o.push({segment:t,track:e})}))})),r.length||o.length){if(await Promise.all(r),o.length&&await Promise.all(o.map((({segment:e,track:t})=>A(Jb,this,pk).call(this,e,t,i)))),i&&i.aborted)throw Cy();this.trigger("node:loaded",{nodeId:this.id,node:this,loadingMode:"segment-offset",offsetSeconds:n})}}async resolve(e={}){const{signal:t,manifestOverride:n}=e;let i=!0;for(;i;){if(i=!1,"ready"===this.state)return this;if("resolving"===this.state)try{return await M(qb,this)}catch(e){if(!Oy(e)||t&&t.aborted)throw e;i=!0;continue}if(t&&t.aborted)throw Cy();if(this.hasExceededManifestLoadAttempts()){const e=this.manifestLoadError||new Error("Manifest load retry limit reached");throw this.state="failed",this.error=e,e}const e=A(Jb,this,sk).call(this);return this.state="resolving",this.error=void 0,C(qb,this,(async()=>{try{const e=await A(Jb,this,mk).call(this,{signal:t,manifestOverride:n});if(t&&t.aborted)throw Cy();let i=Tb.parse(e);return i=A(Jb,this,ok).call(this,i),this.tracks=(i.tracks||[]).map((e=>e instanceof vb?e:new vb(e))),this.mainTrackId=i.mainTrackId||this.mainTrackId,this.metadata=i.metadata||this.metadata,A(Jb,this,bk).call(this),A(Jb,this,yk).call(this),await A(Jb,this,vk).call(this),this.state="ready",this}catch(n){if(Oy(n,t))throw A(Jb,this,ak).call(this,e),n;throw this.state="failed",this.error=n,n}})()),M(qb,this)}return M(qb,this)}evict(){this.tracks.forEach((e=>{(e.segments||[]).forEach((e=>{e.evict()}))}))}get children(){return M(Qb,this).slice()}set children(e){this.setChildren(e)}get duration(){if(!this.mainTrackId)return 0;const e=this.tracks.find((e=>e.id===this.mainTrackId));return e?ry(e.duration)?e.duration:e.endTime:0}get retainedByteLength(){let e=0;return this.tracks.forEach((t=>{(Array.isArray(t.segments)?t.segments:[]).forEach((t=>{e+=ry(t.retainedByteLength)?t.retainedByteLength:0}))})),e}get buffered(){if("ready"!==this.state)return zb;const e=Array.isArray(this.tracks)?this.tracks.find((e=>(null==e?void 0:e.id)===this.mainTrackId)):void 0,t=this.duration;if(!e||!ry(t))return zb;const n=Array.isArray(this.tracks)?this.tracks.map((e=>{if(!e||void 0===e.buffered)return;const t=e.buffered;return t&&Number.isFinite(t.start)&&Number.isFinite(t.end)?{track:e,range:t}:void 0})).filter(Boolean):[];if(!n.length)return zb;if(n.length===this.tracks.length&&n.every((({track:e,range:t})=>{const n=e.endTime,i=ry(e.offset)?e.offset:0;return Number.isFinite(n)&&t.start<=i&&t.end>=n})))return{start:0,end:t};const i=n.reduce(((e,{range:t})=>Math.min(e,t.end)),1/0);if(!Number.isFinite(i))return zb;const r=Math.min(i,t);return r>0?{start:0,end:r}:zb}get isLoaded(){return"ready"===this.state&&(Array.isArray(this.tracks)?this.tracks:[]).flatMap((e=>Array.isArray(null==e?void 0:e.segments)?e.segments:[])).every((e=>e.isLoaded))}hasExceededManifestLoadAttempts(){if(!Number.isFinite(M(Yb,this))||M(Yb,this)<=0)return!1;if(!this.manifestLoadError)return!1;const e=Number(this.manifestLoadAttempts);return Number.isFinite(e)&&e>=M(Yb,this)}}function ek(e){return function(e,t){if(!e||"string"!=typeof e)return e;if(!t||"object"!=typeof t)return e;const n=ld&&"function"==typeof ld.URL?ld.URL:"function"==typeof URL?URL:null;if(!n)return e;let i;try{i=new n(e)}catch(t){return e}const r=function(e,t){const n=null==e?void 0:e.hostname,i=null==e?void 0:e.pathname;if("string"!=typeof n||"string"!=typeof i)return e;if(!/^s3(?:[.-][a-z0-9-]+)?\.amazonaws\.com$/i.test(n))return e;const r=i.split("/").filter(Boolean);if(r.length<2)return e;const o=r[0],s=new t(e.toString());return s.hostname=`${o}.${n}`,s.pathname=`/${r.slice(1).join("/")}`,s}(i,n),o=t[r.hostname]?r:i,s=t[o.hostname];if(!s||"string"!=typeof s)return e;let a;try{a=new n(s)}catch(t){return e}return a.protocol&&a.host?(o.protocol=a.protocol,o.host=a.host,o.toString()):e}(e,M(Xb,this))}function tk(){return M(Kb,this)||void 0===ld.VideoDecoder}function nk(){return this.manifestRef&&"object"==typeof this.manifestRef&&"assets-delivery-service"===this.manifestRef.type}function ik(e){if(!A(Jb,this,nk).call(this))return!1;if(!A(Jb,this,tk).call(this))return!1;const t=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[],n=t.find((t=>(null==t?void 0:t.id)===(null==e?void 0:e.mainTrackId)))||t[0];return"image"!==(null==n?void 0:n.type)}function rk(e){const t=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[],n=function(e){const t=Number(null==e?void 0:e.duration);if(Number.isFinite(t)&&t>0)return t;const n=Array.isArray(null==e?void 0:e.segments)?e.segments:[];let i=0;return n.forEach((e=>{if(null!=e&&e.isInit)return;const t=Number(null==e?void 0:e.offset),n=Number(null==e?void 0:e.duration);!Number.isFinite(t)||!Number.isFinite(n)||n<=0||(i=Math.max(i,t+n))})),i>0?i:void 0}(t.find((t=>(null==t?void 0:t.id)===(null==e?void 0:e.mainTrackId)))||t[0]);return ry(n)?n:ry(M(Vb,this))?M(Vb,this):void 0}function ok(e){if(this.imageFallbackActive=!1,!A(Jb,this,ik).call(this,e))return e;if(!M(Ub,this)||"function"!=typeof M(Ub,this).resolveImageOne)return e;const t=M(Ub,this).resolveImageOne(this.manifestRef),n=A(Jb,this,ek).call(this,null==t?void 0:t.url);if(!n)return e;const i={typeHint:"image",url:n,duration:A(Jb,this,rk).call(this,e),width:M(Gb,this),height:M(Hb,this)},r=Tb.parse(i);return e&&"object"==typeof e.metadata&&!Array.isArray(e.metadata)&&(r.metadata=e.metadata),this.imageFallbackActive=!0,r}function sk(){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 ak(e){e&&(this.state=e.state,this.error=e.error,this.tracks=e.tracks,this.mainTrackId=e.mainTrackId,this.metadata=e.metadata,this.imageFallbackActive=e.imageFallbackActive,this.disabledTracks=e.disabledTracks,this.manifestRef=e.manifestRef,this.manifestLoadAttempts=e.manifestLoadAttempts,this.manifestLoadError=e.manifestLoadError)}function lk(){const e=Number(this.manifestLoadAttempts);this.manifestLoadAttempts=Number.isFinite(e)&&e>0?e+1:1,this.manifestLoadError=void 0}function ck(e){this.manifestLoadError=e||new Error("Manifest load failed")}function uk(e){if(!e)return null;const t={loadAttempts:Number(e.loadAttempts),loadError:e.loadError};if("function"==typeof e.markLoadAttempt)return e.markLoadAttempt(),t;const n=Number(e.loadAttempts);return e.loadAttempts=Number.isFinite(n)&&n>0?n+1:1,e.loadError=void 0,t}function dk(e,t){if(!e||!t)return;const n=Number(t.loadAttempts);e.loadAttempts=Number.isFinite(n)&&n>=0?n:0,e.loadError=t.loadError}function hk(e,t){e&&("function"!=typeof e.setLoadError?e.loadError=t||new Error("Segment load failed"):e.setLoadError(t))}async function fk(e,t,n){const i=A(Jb,this,uk).call(this,t);try{const i=t.representations.map((async i=>{const r=A(Jb,this,ek).call(this,i.url),o=await Uy(r,{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:!0,loaded:n,total:i,chunk:r})}}),s=o instanceof ArrayBuffer?o:null==o?void 0:o.arrayBuffer;s&&t.setRepresentationBuffer(i.id,s)}));await Promise.all(i)}catch(e){if(Oy(e,n))throw A(Jb,this,dk).call(this,t,i),e;throw A(Jb,this,hk).call(this,t,e),e}}async function pk(e,t,n){const i=M(jb,this),r={representations:e.representations,nodeId:this.id,trackId:null==t?void 0:t.id,segmentId:e.id},o=i&&"function"==typeof i.select?i.select(r):void 0,s=e.representations.find((e=>e.id===o))||e.representations[0];if(!s)return;e&&"function"==typeof e.setABRDecisionSnapshot&&e.setABRDecisionSnapshot(r.abrDecision),e.setChosenRepresentation(s);const a=A(Jb,this,uk).call(this,e);try{const i=A(Jb,this,ek).call(this,s.url),r=await Uy(i,{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:!1,loaded:n,total:i,chunk:r})}}),o=r instanceof ArrayBuffer?r:null==r?void 0:r.arrayBuffer;o&&(e.setRepresentationBuffer(s.id,o),e.setChosenRepresentation(s))}catch(t){if(Oy(t,n))throw A(Jb,this,dk).call(this,e,a),t;throw A(Jb,this,hk).call(this,e,t),t}}async function mk(e={}){const{signal:t,manifestOverride:n}=e;if(t&&t.aborted)throw Cy();A(Jb,this,lk).call(this);try{let e=this.manifestRef;if(n&&"object"==typeof n){if(A(Jb,this,nk).call(this)&&"string"==typeof n.encodeProfile&&n.encodeProfile&&(this.manifestRef={...this.manifestRef,encodeProfile:n.encodeProfile},e=this.manifestRef),n.ivd)return{typeHint:"ivd",body:n.ivd};if(n.body){const e=A(Jb,this,ek).call(this,n.url);return{typeHint:n.typeHint,url:e,mimeType:n.mimeType,body:n.body,duration:M(Vb,this),width:M(Gb,this),height:M(Hb,this)}}"string"==typeof n.url&&n.url&&(e=n)}if(e&&"object"==typeof e&&"assets-delivery-service"===e.type){if(!M(Ub,this)||"function"!=typeof M(Ub,this).resolveOne)throw new Error("AssetsDeliveryService is required for assets-delivery-service manifestRef");const n=await M(Ub,this).resolveOne(e,{signal:t});if(!n)throw new Error("AssetsDeliveryService returned empty result");if("string"==typeof n.encodeProfile&&n.encodeProfile&&(this.manifestRef={...e,encodeProfile:n.encodeProfile}),n.ivd)return{typeHint:"ivd",body:n.ivd};const i=n.typeHint,r=A(Jb,this,ek).call(this,n.url),o=n.mimeType,s=n.body;if(r||s||o)return{typeHint:i,url:r,mimeType:o,body:s,duration:M(Vb,this),width:M(Gb,this),height:M(Hb,this)};throw new Error("AssetsDeliveryService returned unsupported manifest shape")}if(e&&"object"==typeof e){const t=A(Jb,this,ek).call(this,e.url),n=e.mimeType;if(e.body)return{url:t,mimeType:n,body:"string"==typeof e.body?e.body:JSON.stringify(e.body)}}if("string"==typeof e||e&&"string"==typeof e.url){const n="string"==typeof e?e:e.url,i=A(Jb,this,ek).call(this,n),r="object"==typeof e?e.typeHint:void 0,o="object"==typeof e?e.mimeType:void 0;if("image"===Tb.inferType({typeHint:r,url:i,mimeType:o})){const t="object"==typeof e&&ry(e.duration)?e.duration:M(Vb,this);return{typeHint:"image",url:i,mimeType:o,duration:t,width:"object"==typeof e&&ry(e.width)?e.width:M(Gb,this),height:"object"==typeof e&&ry(e.height)?e.height:M(Hb,this)}}const s=await Uy(i,{returnType:"default",signal:t});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(e){if(Oy(e,t))throw e;throw A(Jb,this,ck).call(this,e),e}}async function vk(){const e=Db.slice().filter((e=>!this.enabledRepFilters||this.enabledRepFilters.includes(e.name)));if(e.length)for(let t=0;t<this.tracks.length;t+=1){const n=this.tracks[t],i=Array.isArray(n.segments)?n.segments:[],r=[];for(let t=0;t<i.length;t+=1){const o=i[t];if(!Array.isArray(o.representations)){r.push(o);continue}o.appliedFilters=o.appliedFilters||[];let s=o.representations;for(let t=0;t<e.length;t+=1){const{name:i,fn:r,isRelevantForTrack:a}=e[t];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 e=$b(o.representations);e&&(o.offset=e.offset,o.duration=e.duration)}r.push(o)}}r.length!==i.length&&n&&"function"==typeof n.setSegments&&n.setSegments(r)}}function gk(e,{emit:t=!1}={}){return function(e=[],t=[]){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){const i=e[n],r=t[n];if((null==i?void 0:i.nodeId)!==(null==r?void 0:r.nodeId)||(null==i?void 0:i.weight)!==(null==r?void 0:r.weight))return!1}return!0}(M(Qb,this),e)||(C(Qb,this,e),t&&(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 yk(){var e;const t=Array.isArray(this.disabledTrackTypes)?this.disabledTrackTypes:[];if(!t.length||!Array.isArray(this.tracks)||!this.tracks.length)return void(this.disabledTracks=[]);const n=new Set(t),i=[],r=[];this.tracks.forEach((e=>{e&&n.has(e.type)?r.push(e):e&&i.push(e)})),this.tracks=i,this.disabledTracks=r,this.mainTrackId&&!i.some((e=>e.id===this.mainTrackId))&&(this.mainTrackId=null===(e=i[0])||void 0===e?void 0:e.id)}function bk(){if(!Array.isArray(this.tracks)||!this.tracks.length)return;const e=this.duration;if(!ry(e))return;const t=[new hb({name:"nodestart",timestamp:0,data:{id:this.id},isSticky:!0}),new hb({name:"nodeend",timestamp:e,data:{id:this.id}})],n=new vb({id:`${this.id}-auto-cue`,type:"cue",cues:t,offset:0,duration:e});this.tracks.push(n)}var kk=new WeakMap,wk=new WeakMap,xk=new WeakMap,_k=new WeakMap,Tk=new WeakSet;class Ek extends od{constructor(...e){super(...e),O(this,Tk),F(this,kk,new Map),F(this,wk,new Map),F(this,xk,void 0),F(this,_k,void 0);const[t,n]=e;C(xk,this,t),C(_k,this,n)}get name(){return"NodeRepository"}get defaults(){return{enabledRepFilters:["containers","force-video-codec","media-capabilities"],disabledTracks:Hy("disabledTracks"),forceVideoCodec:Hy("forceVideoCodec"),forceImageFallback:Hy("forceImageFallback"),mediaHostRewriteMap:Hy("mediaHostRewriteMap"),maxManifestLoadAttempts:3}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"get","list"])}onDispose(){M(kk,this).forEach(((e,t)=>{const n=M(wk,this).get(t);n&&e&&"function"==typeof e.off&&e.off(ud.NODE_CHILDREN_CHANGED,n)})),M(wk,this).clear(),M(kk,this).clear()}add(e){const t=e instanceof Zb?e:new Zb(e,{enabledRepFilters:this.settings.enabledRepFilters,disabledTracks:this.settings.disabledTracks,forceVideoCodec:this.settings.forceVideoCodec,forceImageFallback:this.settings.forceImageFallback,mediaHostRewriteMap:this.settings.mediaHostRewriteMap,maxManifestLoadAttempts:this.settings.maxManifestLoadAttempts,abrSelector:M(xk,this),assetsDeliveryService:M(_k,this)});if(!t.id)throw new Error("NodeRepository.add requires node with id");if(M(kk,this).has(t.id))throw new Error(`NodeRepository.add: node with id ${t.id} already exists`);return M(kk,this).set(t.id,t),A(Tk,this,Ik).call(this,t),this.trigger(ud.NODE_ADD,{node:t}),t}get(e){const t=(null==e?void 0:e.id)||e;if(!t)throw new Error("NodeRepository.get requires node or id");return M(kk,this).get(t)}list(){return Array.from(M(kk,this).values())}}function Ik(e){if(!e||"function"!=typeof e.on||!e.id)return;const t=e=>{this.trigger(ud.NODE_CHILDREN_CHANGED,e)};e.on(ud.NODE_CHILDREN_CHANGED,t),M(wk,this).set(e.id,t)}var Sk=new WeakMap,Ak=new WeakMap,Nk=new WeakSet;class Mk extends od{constructor(...e){super(...e),O(this,Nk),F(this,Sk,void 0),F(this,Ak,new Map);const[t]=e;C(Sk,this,t)}get name(){return"ABRSelector"}get defaults(){return{safetyMargin:.35,minBufferForUpgrade:5,minBufferCritical:1,hysteresisRatio:1.1,abrStrategy:Hy("abrStrategy")}}select(e={}){var t;const{representations:n=[],bufferSeconds:i}=e;if(!Array.isArray(n)||0===n.length)return;const r=M(Sk,this)&&"function"==typeof M(Sk,this).getKbps?M(Sk,this).getKbps():void 0,o=A(Nk,this,Fk).call(this,n[0]),s=M(Ak,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(((e,t)=>A(Nk,this,Ck).call(this,e.bandwidth)-A(Nk,this,Ck).call(this,t.bandwidth)));if("bottom"===a){const t=l[0];return A(Nk,this,Rk).call(this,t,e,{decisionReason:"strategy:bottom",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==t?void 0:t.id}if("top"===a){const t=l[l.length-1];return A(Nk,this,Rk).call(this,t,e,{decisionReason:"strategy:top",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==t?void 0:t.id}if("random"===a){const t=l[Math.floor(Math.random()*l.length)];return A(Nk,this,Rk).call(this,t,e,{decisionReason:"strategy:random",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:void 0,bufferSeconds:i}),null==t?void 0:t.id}const c=Number.isFinite(i)?i:void 0,u=ry(r)?r*this.settings.safetyMargin:void 0;let d="auto:highest-available";if(s&&void 0!==c&&c<this.settings.minBufferCritical){const t=l[0];return this.log.debug("[select] critical buffer -> lowest",e),A(Nk,this,Rk).call(this,t,e,{decisionReason:"auto:critical-buffer",trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:u,bufferSeconds:c}),null==t?void 0:t.id}let h=l[l.length-1];if(void 0!==u){const t=l.filter((e=>A(Nk,this,Ck).call(this,e.bandwidth)<=u));t.length>0?(h=t[t.length-1],d="auto:highest-under-safe-bandwidth",this.log.debug("[select] under safe bandwidth ->",h.id,e)):(this.log.debug("[select] no rep under safe bandwidth, fallback lowest",e),h=l[0],d="auto:no-rep-under-safe-bandwidth")}if(s&&void 0!==c&&c<this.settings.minBufferForUpgrade){const t=n.find((e=>e.id===s));t&&ry(t.bandwidth)&&ry(h.bandwidth)&&h.bandwidth/t.bandwidth>this.settings.hysteresisRatio&&(h=n.filter((e=>e.bandwidth&&e.bandwidth<=t.bandwidth*this.settings.hysteresisRatio)).sort(((e,t)=>e.bandwidth-t.bandwidth)).pop()||t,d="auto:hysteresis-hold",this.log.debug("[select] hysteresis prevents upgrade; hold",h.id,e))}return A(Nk,this,Rk).call(this,h,e,{decisionReason:d,trackType:o,previousRepresentationId:s,measuredDownloadSpeedKbps:r,safeBandwidthKbps:u,bufferSeconds:c}),null===(t=h)||void 0===t?void 0:t.id}onDispose(){M(Ak,this).clear(),C(Sk,this,null)}}function Fk(e){var t,n;return(null===(t=e.mime)||void 0===t||null===(n=t.split)||void 0===n||null===(n=n.call(t,"/"))||void 0===n?void 0:n[0])||"unknown"}function Ck(e){return ry(e)?e/1e3:0}function Ok(e){return ry(e)?e/1e3:void 0}function Pk(e,t,n={}){const i=Array.isArray(null==t?void 0:t.representations)?t.representations.map((e=>({id:null==e?void 0:e.id,bandwidthKbps:A(Nk,this,Ok).call(this,null==e?void 0:e.bandwidth)}))):[];return{timeMs:Date.now(),strategy:this.settings.abrStrategy||"auto",decisionReason:n.decisionReason,nodeId:null==t?void 0:t.nodeId,trackId:null==t?void 0:t.trackId,segmentId:null==t?void 0:t.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==e?void 0:e.id,selectedRepresentationBandwidthKbps:A(Nk,this,Ok).call(this,null==e?void 0:e.bandwidth),safetyMargin:Number(this.settings.safetyMargin),minBufferForUpgrade:Number(this.settings.minBufferForUpgrade),minBufferCritical:Number(this.settings.minBufferCritical),hysteresisRatio:Number(this.settings.hysteresisRatio),availableRepresentations:i}}function Rk(e,t,n={}){if(!e)return;const i=A(Nk,this,Pk).call(this,e,t,n);t&&"object"==typeof t&&(t.abrDecision=i),this.log.info("[select] Chosen representation:",e,"context:",t,"decision:",i),this.trigger("abr:selection",{representation:e,context:t,strategy:this.settings.abrStrategy,decision:i});const r=A(Nk,this,Fk).call(this,e);M(Ak,this).set(r,e.id)}var Dk=new WeakMap,Lk=new WeakSet;class Bk extends od{constructor(...e){super(...e),O(this,Lk),F(this,Dk,void 0);const[t]=e;if(C(Dk,this,t),!M(Dk,this)||"function"!=typeof M(Dk,this).list)throw new Error("NodePrioritizer requires a NodeRepository instance")}get name(){return"NodePrioritizer"}get defaults(){return{levelMultiplier:1,priorityMultiplier:.3}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"sortNodes"])}onDispose(){C(Dk,this,null)}getPrioritizationSnapshot(e){const t=M(Dk,this).list();if(!t.length)return{orderedIds:[],reachableIds:[]};const{levels:n,weights:i}=A(Lk,this,zk).call(this,t,e);return{orderedIds:A(Lk,this,Wk).call(this,t,n,i),reachableIds:Array.from(n.keys())}}sortNodes(e){const{orderedIds:t}=this.getPrioritizationSnapshot(e);return t.length?(this.log.info(`[sortNodes(${e})] Sorted nodes: [${t.join(", ")}]`),t):[]}getReachableNodeIds(e){const{reachableIds:t}=this.getPrioritizationSnapshot(e);return t}}function zk(e,t){const n=new Map;e.forEach((e=>{e&&e.id&&n.set(e.id,e)}));const i=new Map,r=new Map;if(!t||!n.has(t))return{levels:i,weights:r};const o=[{id:t,level:0,priority:1}];for(i.set(t,0),r.set(t,1);o.length;){const{id:e,level:t,priority:s}=o.shift(),a=n.get(e),l=Array.isArray(null==a?void 0:a.children)?a.children:[];for(let e=0;e<l.length;e+=1){const a=l[e],c=(null==a?void 0:a.nodeId)||(null==a?void 0:a.id);if(!c||!n.has(c)||i.has(c))continue;const u=ry(null==a?void 0:a.weight)?a.weight:1,d=Math.max(u,s);i.set(c,t+1),r.set(c,d),o.push({id:c,level:t+1,priority:d})}}return{levels:i,weights:r}}function Wk(e,t,n){const i=t.size>0,{levelMultiplier:r,priorityMultiplier:o}=this.settings,s=e.map((e=>{var s;const a=t.has(e.id)?t.get(e.id):i?Number.MAX_SAFE_INTEGER:0,l=Number.isFinite(a)?a:Number.MAX_SAFE_INTEGER,c=null!==(s=n.get(e.id))&&void 0!==s?s:1,u=(Number.isFinite(l)?r*l:Number.MAX_SAFE_INTEGER)+o*c;return{id:e.id,score:u,level:l,priorityWeight:c}}));return s.sort(((e,t)=>e.score!==t.score?e.score-t.score:e.level!==t.level?e.level-t.level:e.priorityWeight!==t.priorityWeight?e.priorityWeight-t.priorityWeight:e.id.localeCompare(t.id))),s.map((e=>e.id))}function $k(e,t){return function(e,t){const n=Array.isArray(e)?e:[];return n.length?t&&n.includes(t)?t:n[0]:t||void 0}(null==e?void 0:e.availableEncodeProfiles,t)}function jk(e,t){const n=e&&"object"==typeof e?{...e}:e;return n&&"object"==typeof n?("string"==typeof t&&t?n.encodeProfile=t:delete n.encodeProfile,n):n}function Uk(e){return"string"==typeof e&&e.startsWith("cmaf:")}function qk(e){return"image"===(null==e?void 0:e.assetType)?"image":"ivd"}function Vk(e){if(!e||"object"!=typeof e)return e;if(Object.prototype.hasOwnProperty.call(e,"mpd")){const t="string"==typeof e.mpdUrl&&e.mpdUrl||"string"==typeof e.url&&e.url||void 0;return{typeHint:"dash",body:e.mpd,url:t}}return e.ivd||e.url||e.body||e.mimeType||e.typeHint?e:(t=e)&&"object"==typeof t&&Array.isArray(t.representations)?{ivd:e}:e;var t}var Gk=new WeakMap,Hk=new WeakMap,Kk=new WeakSet;class Xk extends od{constructor(...e){super(...e),O(this,Kk),F(this,Gk,void 0),F(this,Hk,void 0);const[,t={}]=e;C(Gk,this,"function"==typeof t.fetchFn?t.fetchFn:void 0),C(Hk,this,Fy())}get name(){return"AssetsDeliveryService"}get defaults(){return{assetsDeliveryServiceUrl:"https://assets.eko.com",profile:Hy("encodeProfile"),maxBatchSize:5,imageQueryParams:{startOffset:0,width:1024}}}async resolveOne(e,t={}){var n;const i=await this.resolve([e],t);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(e){if(!A(Kk,this,Qk).call(this,e))return;const t=$k(e,this.settings.profile),n=function(e,t,n){const i=function(e,t,n){const i=(e||"").replace(/\/$/,""),r=null==n?void 0:n.assetId,o=null==n?void 0:n.assetRevision;if(i&&t&&"string"==typeof r&&"number"==typeof o)return`${i}/${t}/${encodeURIComponent(r)}/${o}`}(e,"image",t);if(!i)return;const r=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return"";const t=new URLSearchParams;return Object.keys(e).forEach((n=>{if("string"!=typeof n||!n)return;const i=e[n];null!=i&&("number"!=typeof i||Number.isFinite(i))&&("string"!=typeof i&&"number"!=typeof i&&"boolean"!=typeof i||t.set(n,String(i)))})),t.toString()}(n);return r?`${i}?${r}`:i}(this.settings.assetsDeliveryServiceUrl||"",e,this.settings.imageQueryParams);if(!n)return;const i={typeHint:"image",url:n};return"string"==typeof t&&t&&(i.encodeProfile=t),i}async resolve(e=[],t={}){const n=(Array.isArray(e)?e:[e]).filter((e=>A(Kk,this,Qk).call(this,e)));if(!n.length)return[];const i=A(Kk,this,Yk).call(this,t);if(i&&i.aborted)return[];const r=[],o=this.settings.profile;n.forEach((e=>{if("image"!==qk(e))return;const t=this.resolveImageOne(e);t&&t.url&&r.push({manifestRef:jk(e,t.encodeProfile),manifest:{typeHint:"image",url:t.url}})}));const s=n.filter((e=>"image"!==qk(e))).map((e=>function(e,t){const n=$k(e,t);return{ref:e,profile:n,route:Uk(n)?"dash":"ivd"}}(e,o))),a=A(Kk,this,Zk).call(this,s);for(const{refs:e,route:t}of a){if(i&&i.aborted)return r;const{url:n}=A(Kk,this,ew).call(this,e,t),o=await A(Kk,this,tw).call(this,n,{method:"GET",signal:i});o&&"object"==typeof o&&e.forEach((({ref:e,profile:t})=>{const n=`${e.assetId}:${e.assetRevision}`,i=o[n]||o[e.assetId]||o[e.assetId||n];i&&r.push({manifestRef:jk(e,t),manifest:Vk(i)})}))}return r}onDispose(){M(Hk,this)&&M(Hk,this).abort(),C(Hk,this,null),C(Gk,this,null)}}function Yk(e){return e&&e.signal?e.signal:M(Hk,this)?M(Hk,this).signal:void 0}function Qk(e){const t="number"==typeof(null==e?void 0:e.assetRevision)&&Number.isFinite(e.assetRevision)&&e.assetRevision>=0;return e&&"assets-delivery-service"===e.type&&"string"==typeof e.assetId&&t}function Jk(e,t){const n=Number.isFinite(t)&&t>0?t:e.length,i=[];for(let t=0;t<e.length;t+=n)i.push(e.slice(t,t+n));return i}function Zk(e){if(!Array.isArray(e)||!e.length)return[];const t=[];e.forEach((e=>{const n=t[t.length-1];n&&n.route===e.route?n.refs.push(e):t.push({route:e.route,refs:[e]})}));const n=[];return t.forEach((e=>{A(Kk,this,Jk).call(this,e.refs,this.settings.maxBatchSize).forEach((t=>{n.push({route:e.route,refs:t})}))})),n}function ew(e,t="ivd"){const n=e.map((({ref:e,profile:t})=>function(e,t){const n=`${e.assetId}:${e.assetRevision}`;return t?`${n}:${t}`:n}(e,t))),i=new URLSearchParams({assets:n.join(","),type:"data"});return{url:`${(this.settings.assetsDeliveryServiceUrl||"").replace(/\/$/,"")}/${"dash"===t?"dash":"ivd"}?${i.toString()}`}}async function tw(e,t){return M(Gk,this)?M(Gk,this).call(this,e,t):await Uy(e,{returnType:"json",method:(null==t?void 0:t.method)||"GET",signal:null==t?void 0:t.signal})}function nw({prioritizer:e,repository:t,startNodeId:n,prioritizedIds:i,pendingIds:r,allowedIds:o,filter:s,fallbackToRepository:a=!0}={}){const l=Array.isArray(i)?i:e&&"function"==typeof e.sortNodes?e.sortNodes(n):[],c=a?(f=t)&&"function"==typeof f.list?f.list().map((e=>null==e?void 0:e.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((e=>{if(!e)return!1;if(d&&d.has(e))return!1;if(h&&!h.has(e))return!1;const n=function(e,t){if(e&&"function"==typeof e.get)return e.get(t)}(t,e);return!(!n||"function"==typeof s&&!s(n,e))}))}const iw=(ld.requestAnimationFrame||ld.mozRequestAnimationFrame||ld.webkitRequestAnimationFrame||ld.msRequestAnimationFrame||(e=>ld.setTimeout(e,1e3/60))).bind(ld),rw=(ld.cancelAnimationFrame||ld.mozCancelAnimationFrame||ld.webkitCancelAnimationFrame||ld.msCancelAnimationFrame||(e=>ld.clearTimeout(e))).bind(ld),ow=Ju("ticker","warn");let sw,aw=[],lw=null,cw=My();function uw(){cw=My();const e=[];let t,n;for(n=aw.length-1;n>=0;--n)t=aw[n],cw>=t.lastTick+t.interval&&e.push(t);for(n=e.length-1;n>=0;--n)if(t=e[n],!t.stopped){t.lastTick=cw;try{t.callback()}catch(e){console&&"function"==typeof console.error?console.error(e):ow.error(e)}}sw=iw(uw)}function dw(){My()-cw>=200&&(rw(sw),uw())}function hw(e){let t=-1;for(let n=0;n<aw.length;n+=1)if(aw[n].callback===e){t=n;break}return t}function fw(e,t=0){if(!e||"function"!=typeof e||"number"!=typeof t||t<0)return void ow.error("[start] Invalid arguments given to start method.",arguments);const n=hw(e);return-1!==n?(ow.debug("[start] Callback already exists, overriding interval.",arguments),aw[n].interval=t,e):(aw.push({callback:e,interval:t,lastTick:My()}),1===aw.length&&(sw=iw(uw),lw||(lw=ld.setInterval(dw,1e3))),e)}function pw(e){const t=hw(e);-1!==t?(aw[t].stopped=!0,aw.splice(t,1),aw.length||(rw(sw),ld.clearInterval(lw),lw=null)):ow.debug("[stop] Callback not found, doing nothing.",arguments)}function mw(e){return-1!==hw(e)}function vw(e,t,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 e)return void ow.error("[createThrottler] Bad argument given to createThrottler, first argument must be a function.",arguments);ow.debug("[createThrottler] Creating a new throttler instance.",arguments);const s=[];function a(){ow.debug("[onThrottlerTick] Calling callback with "+s.length+" queued items.");const t=s.slice(0);s.length=0,pw(a),e(t)}const l={push:function(e){ow.debug("[push] Queuing argument:",e),0===s.length&&fw(a,t),s.push(e),o+=1,(o<=r||s.length>=i)&&a()},flush:function(){ow.debug("[flush] Flushing queue."),0!==s.length&&a()},dispose:function(){ow.debug("[dispose] Disposing of throttler.");const e=s.slice(0);return s.length=0,pw(a),e}};return Object.defineProperty(l,"interval",{enumerable:!0,get:function(){return t},set:function(e){"number"==typeof e&&(t=e)}}),l}function gw(e,t){if(e&&"function"==typeof e)return e.__tickerThrottler||(e.__tickerThrottler=vw((function(){e()}),t)),"number"==typeof t&&(e.__tickerThrottler.interval=t),e.__tickerThrottler.push(),e.__tickerThrottler;ow.error("[scheduleExecution] Bad argument given to scheduleExecution, first argument must be a function.",arguments)}var yw=new WeakMap,bw=new WeakMap,kw=new WeakMap,ww=new WeakMap,xw=new WeakMap,_w=new WeakMap,Tw=new WeakMap,Ew=new WeakMap,Iw=new WeakMap,Sw=new WeakMap,Aw=new WeakMap,Nw=new WeakMap,Mw=new WeakMap,Fw=new WeakMap,Cw=new WeakMap,Ow=new WeakMap,Pw=new WeakSet;class Rw extends od{constructor(...e){super(...e),O(this,Pw),F(this,yw,void 0),F(this,bw,void 0),F(this,kw,void 0),F(this,ww,void 0),F(this,xw,[]),F(this,_w,[]),F(this,Tw,new Set),F(this,Ew,new Set),F(this,Iw,!1),F(this,Sw,void 0),F(this,Aw,void 0),F(this,Nw,void 0),F(this,Mw,void 0),F(this,Fw,void 0),F(this,Cw,void 0),F(this,Ow,void 0);const[t,n,i,r]=e;C(yw,this,t),C(bw,this,n),C(kw,this,i),C(ww,this,r),C(Sw,this,Fy());const o=e.length?e[e.length-1]:void 0,s=o&&"object"==typeof o&&Number.isFinite(o.maxConcurrent)?o.maxConcurrent:void 0;Number.isFinite(s)&&(this.settings.maxConcurrent=s),C(Ow,this,(()=>A(Pw,this,Gw).call(this))),A(Pw,this,zw).call(this),A(Pw,this,Bw).call(this)}get name(){return"NodeResolver"}get defaults(){return{maxConcurrent:5}}onDispose(){var e;M(Sw,this)&&M(Sw,this).abort(),C(Sw,this,null),M(ww,this)&&"function"==typeof M(ww,this).off&&M(Nw,this)&&M(ww,this).off(ud.PLACEMENT_ADDED,M(Nw,this)),M(ww,this)&&"function"==typeof M(ww,this).off&&M(Cw,this)&&M(ww,this).off(ud.TIMELINE_RESET,M(Cw,this)),M(yw,this)&&"function"==typeof M(yw,this).off&&M(Mw,this)&&M(yw,this).off(ud.NODE_ADD,M(Mw,this)),M(yw,this)&&"function"==typeof M(yw,this).off&&M(Fw,this)&&M(yw,this).off(ud.NODE_CHILDREN_CHANGED,M(Fw,this)),C(Nw,this,null),C(Mw,this,null),C(Fw,this,null),C(Cw,this,null),C(xw,this,[]),C(_w,this,[]),M(Tw,this).clear(),M(Ew,this).clear(),C(Iw,this,!1),C(Aw,this,void 0),null!==(e=M(Ow,this))&&void 0!==e&&e.__tickerThrottler&&M(Ow,this).__tickerThrottler.dispose(),C(Ow,this,null)}}function Dw(){return M(Sw,this)?M(Sw,this).signal:void 0}function Lw(){return this._disposed||M(Sw,this)&&M(Sw,this).signal.aborted}function Bw(){M(ww,this)&&"function"==typeof M(ww,this).on&&(C(Nw,this,(e=>{A(Pw,this,$w).call(this,null==e?void 0:e.nodeId)})),M(ww,this).on(ud.PLACEMENT_ADDED,M(Nw,this)),C(Cw,this,(()=>A(Pw,this,Ww).call(this))),M(ww,this).on(ud.TIMELINE_RESET,M(Cw,this))),M(yw,this)&&"function"==typeof M(yw,this).on&&(C(Mw,this,(({node:e})=>{(null==e?void 0:e.id)&&A(Pw,this,$w).call(this,e.id,{fromRepoAdd:!0})})),M(yw,this).on(ud.NODE_ADD,M(Mw,this)),C(Fw,this,(()=>{gw(M(Ow,this),100)})),M(yw,this).on(ud.NODE_CHILDREN_CHANGED,M(Fw,this)))}function zw(){const e=M(ww,this)&&Array.isArray(M(ww,this).placements)?M(ww,this).placements:[];e.forEach((e=>A(Pw,this,$w).call(this,e.nodeId)));const t=e.length?e[e.length-1]:void 0;t&&t.nodeId&&C(Aw,this,t.nodeId)}function Ww(){M(Sw,this)&&M(Sw,this).abort(),C(Sw,this,Fy()),C(xw,this,[]),C(_w,this,[]),M(Tw,this).clear(),C(Iw,this,!1),C(Aw,this,void 0)}function $w(e,{fromRepoAdd:t=!1}={}){A(Pw,this,Lw).call(this)||e&&(M(Ew,this).has(e)||M(Tw,this).has(e)||(M(xw,this).push(e),M(Aw,this)||t||C(Aw,this,e),!M(Iw,this)&&t||A(Pw,this,jw).call(this)))}function jw(){if(M(Iw,this))return void A(Pw,this,Uw).call(this);if(0===M(xw,this).length)return;C(Iw,this,!0);const e=M(xw,this).shift();A(Pw,this,Hw).call(this,e).finally((()=>{A(Pw,this,Uw).call(this)}))}async function Uw(){if(!A(Pw,this,Lw).call(this))for(M(xw,this).length||M(_w,this).length||C(_w,this,A(Pw,this,qw).call(this));M(Tw,this).size<this.settings.maxConcurrent;){const e=this.settings.maxConcurrent-M(Tw,this).size;if(e<=0)break;const t=[];for(;t.length<e&&(M(xw,this).length||M(_w,this).length);){let e=M(xw,this).shift();e||(e=M(_w,this).shift()),e&&t.push(e)}if(!t.length)break;const n=A(Pw,this,Kw).call(this,t);n.length&&M(kw,this)&&"function"==typeof M(kw,this).resolve&&A(Pw,this,Xw).call(this,n).finally((()=>A(Pw,this,Uw).call(this))),t.filter((e=>!n.find((t=>t.nodeId===e)))).forEach((e=>{A(Pw,this,Hw).call(this,e).finally((()=>A(Pw,this,Uw).call(this)))}))}}function qw(){const e=new Set([...M(Ew,this),...M(Tw,this),...M(xw,this)]);return A(Pw,this,Vw).call(this,e)}function Vw(e){const t=M(ww,this)&&Array.isArray(M(ww,this).placements)?M(ww,this).placements:[],n=(t.length?t[t.length-1].nodeId:void 0)||M(Aw,this);return nw({prioritizer:M(bw,this),repository:M(yw,this),startNodeId:n,pendingIds:e,fallbackToRepository:!1})}function Gw(){A(Pw,this,Lw).call(this)||(M(Iw,this)||0!==M(xw,this).length)&&(C(_w,this,A(Pw,this,qw).call(this)),M(Iw,this)&&A(Pw,this,Uw).call(this))}async function Hw(e,t){if(!e||M(Ew,this).has(e)||M(Tw,this).has(e))return;const n=A(Pw,this,Dw).call(this);if(n&&n.aborted)return;const i=M(yw,this)&&"function"==typeof M(yw,this).get?M(yw,this).get(e):void 0;if(i&&"function"==typeof i.resolve)if("function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts())M(Ew,this).add(e);else{M(Tw,this).add(e);try{const r={signal:n};t&&(r.manifestOverride=t),await i.resolve(r),M(Ew,this).add(e)}catch(t){if(Oy(t,n))return;this.log.warn(`NodeResolver failed to resolve node ${e}: ${(null==t?void 0:t.message)||t}`),"function"==typeof i.hasExceededManifestLoadAttempts&&i.hasExceededManifestLoadAttempts()&&M(Ew,this).add(e)}finally{M(Tw,this).delete(e)}}}function Kw(e){const t=[];return e.forEach((e=>{const n=M(yw,this)&&"function"==typeof M(yw,this).get?M(yw,this).get(e):void 0;n&&n.manifestRef&&"assets-delivery-service"===n.manifestRef.type&&t.push({nodeId:e,ref:n.manifestRef})})),t}async function Xw(e){const t=A(Pw,this,Dw).call(this);if(!t||!t.aborted){e.forEach((({nodeId:e})=>M(Tw,this).add(e)));try{const n=e.map((e=>e.ref)),i=await M(kw,this).resolve(n,{signal:t});e.forEach((({nodeId:e,ref:t})=>{var n;const r=M(yw,this)&&"function"==typeof M(yw,this).get?M(yw,this).get(e):void 0;if(M(Tw,this).delete(e),!r||"function"!=typeof r.resolve)return;const o=Array.isArray(i)?i.find((e=>{const n=null==e?void 0:e.manifestRef;return n&&n.assetId===t.assetId&&n.assetRevision===t.assetRevision})):void 0,s="string"==typeof(null==o||null===(n=o.manifestRef)||void 0===n?void 0:n.encodeProfile)&&o.manifestRef.encodeProfile?o.manifestRef.encodeProfile:void 0,a=o?A(Pw,this,Yw).call(this,o.manifest,s):void 0;A(Pw,this,Hw).call(this,e,a)}))}catch(n){Oy(n,t)||this.log.warn(`NodeResolver ADS batch failed: ${(null==n?void 0:n.message)||n}`),e.forEach((({nodeId:e})=>M(Tw,this).delete(e)))}}}function Yw(e,t){if(!e)return;const n="string"==typeof t&&t?t:void 0,i=e=>n&&e&&"object"==typeof e?{...e,encodeProfile:n}:e;return e.ivd?i({typeHint:"ivd",body:e.ivd}):e.url||e.body||e.mimeType?i({typeHint:e.typeHint,url:e.url,mimeType:e.mimeType,body:e.body}):i(e)}const Qw=.001,Jw="priority";function Zw(e){const t=Number(e);return Number.isFinite(t)?t:0}var ex=new WeakMap,tx=new WeakMap,nx=new WeakMap,ix=new WeakMap,rx=new WeakMap,ox=new WeakMap,sx=new WeakMap,ax=new WeakMap,lx=new WeakMap,cx=new WeakMap,ux=new WeakMap,dx=new WeakMap,hx=new WeakMap,fx=new WeakMap,px=new WeakMap,mx=new WeakMap,vx=new WeakMap,gx=new WeakMap,yx=new WeakMap,bx=new WeakMap,kx=new WeakSet;class wx extends od{constructor(...e){super(...e),O(this,kx),F(this,ex,void 0),F(this,tx,void 0),F(this,nx,void 0),F(this,ix,new Map),F(this,rx,new Map),F(this,ox,[]),F(this,sx,new Set),F(this,ax,new Map),F(this,lx,!1),F(this,cx,void 0),F(this,ux,void 0),F(this,dx,void 0),F(this,hx,void 0),F(this,fx,void 0),F(this,px,void 0),F(this,mx,void 0),F(this,vx,void 0),F(this,gx,!1),F(this,yx,[]),F(this,bx,void 0);const[t,n,i]=e;C(ex,this,t),C(tx,this,n),C(nx,this,i),C(ux,this,Fy()),C(bx,this,(()=>A(kx,this,i_).call(this))),A(kx,this,Dx).call(this)}get name(){return"SegmentLoadCoordinator"}get defaults(){return{maxConcurrentLoads:3,maxSegmentLoadAttempts:3}}onDispose(){var e;M(ux,this)&&M(ux,this).abort(),C(ux,this,null),M(ax,this).size&&M(ax,this).forEach((e=>{(null==e?void 0:e.controller)&&e.controller.abort()})),M(ax,this).clear(),M(nx,this)&&"function"==typeof M(nx,this).off&&(M(dx,this)&&M(nx,this).off(ud.PLACEMENT_ADDED,M(dx,this)),M(fx,this)&&M(nx,this).off(ud.TIMELINE_SEEKING,M(fx,this)),M(px,this)&&M(nx,this).off(ud.TIMELINE_SEEKED,M(px,this)),M(mx,this)&&M(nx,this).off(ud.TIMELINE_RESET,M(mx,this))),M(ex,this)&&"function"==typeof M(ex,this).off&&M(hx,this)&&M(ex,this).off(ud.NODE_CHILDREN_CHANGED,M(hx,this)),M(vx,this)&&"function"==typeof ld.removeEventListener&&ld.removeEventListener("online",M(vx,this)),C(dx,this,null),C(hx,this,null),C(fx,this,null),C(px,this,null),C(mx,this,null),C(vx,this,null),M(ix,this).clear(),M(rx,this).clear(),C(ox,this,[]),M(sx,this).clear(),M(ax,this).clear(),C(lx,this,!1),C(cx,this,void 0),C(gx,this,!1),C(yx,this,[]),null!==(e=M(bx,this))&&void 0!==e&&e.__tickerThrottler&&M(bx,this).__tickerThrottler.dispose(),C(bx,this,null)}}function xx(){return M(ux,this)?M(ux,this).signal:void 0}function _x(){return this._disposed||M(ux,this)&&M(ux,this).signal.aborted}function Tx(){const e=Number(this.settings.maxSegmentLoadAttempts);return Number.isFinite(e)&&e>0?e:1/0}function Ex(e){const t=A(kx,this,Tx).call(this);if(!Number.isFinite(t)||t===1/0)return!1;if(null==e||!e.loadError)return!1;const n=Number(e.loadAttempts);return Number.isFinite(n)&&n>=t}function Ix(e){return!!e&&(!!A(kx,this,Ex).call(this,e)||A(kx,this,Sx).call(this,e))}function Sx(e){if(!e)return!1;if("boolean"==typeof e.isLoaded)return e.isLoaded;const t=Number(e.retainedByteLength);return Number.isFinite(t)&&t>0}function Ax(e){if(!e||A(kx,this,Sx).call(this,e))return;const t=Number(e.loadAttempts);(Number.isFinite(t)&&t>0||e.loadError)&&("function"==typeof e.evict&&e.evict(),e.loadAttempts=0,e.loadError=void 0)}function Nx(e){e&&(e.manifestLoadError&&(e.manifestLoadAttempts=0,e.manifestLoadError=void 0,"failed"===e.state&&(e.state="pending",e.error=void 0)),(Array.isArray(e.tracks)?e.tracks:[]).forEach((e=>{(Array.isArray(null==e?void 0:e.segments)?e.segments:[]).forEach((e=>{A(kx,this,Ax).call(this,e)}))})))}function Mx(){(M(ex,this)&&"function"==typeof M(ex,this).list?M(ex,this).list():[]).forEach((e=>{A(kx,this,Nx).call(this,e)}))}function Fx(e,{allowSeekKeep:t=!1,segmentOffset:n}={}){const i=Fy(),r=i?i.signal:A(kx,this,xx).call(this);return e&&M(ax,this).set(e,{controller:i,allowSeekKeep:!!t,segmentOffset:n}),{signal:r,controller:i}}function Cx(e,t,n={}){const i=M(ax,this).get(e);i&&i.controller===t&&(Object.prototype.hasOwnProperty.call(n,"allowSeekKeep")&&(i.allowSeekKeep=!!n.allowSeekKeep),Object.prototype.hasOwnProperty.call(n,"segmentOffset")&&(i.segmentOffset=n.segmentOffset))}function Ox(e,t){const n=M(ax,this).get(e);n&&(t&&n.controller!==t||M(ax,this).delete(e))}function Px(e,t){const n=new Set;return(Array.isArray(e)?e:[]).forEach((e=>{const i=null==e?void 0:e.nodeId;if(!i)return;const r=M(ex,this)&&"function"==typeof M(ex,this).get?M(ex,this).get(i):void 0;if(!r)return;const o=A(kx,this,Hx).call(this,r,e,t);Number.isFinite(o)&&n.add(`${i}:${o}`)})),n}function Rx(e){M(ax,this).size&&M(ax,this).forEach(((t,n)=>{const i=null==t?void 0:t.segmentOffset,r=Number.isFinite(i)?`${n}:${i}`:"";!(null!=t&&t.allowSeekKeep&&r&&e&&e.has(r))&&(null==t?void 0:t.controller)&&t.controller.abort()}))}function Dx(){M(nx,this)&&"function"==typeof M(nx,this).on&&(C(dx,this,(e=>{A(kx,this,jx).call(this,e)})),M(nx,this).on(ud.PLACEMENT_ADDED,M(dx,this)),C(fx,this,(e=>A(kx,this,Lx).call(this,e))),M(nx,this).on(ud.TIMELINE_SEEKING,M(fx,this)),C(px,this,(e=>A(kx,this,Bx).call(this,e))),M(nx,this).on(ud.TIMELINE_SEEKED,M(px,this)),C(mx,this,(()=>A(kx,this,$x).call(this))),M(nx,this).on(ud.TIMELINE_RESET,M(mx,this))),M(ex,this)&&"function"==typeof M(ex,this).on&&(C(hx,this,(()=>{gw(M(bx,this),100)})),M(ex,this).on(ud.NODE_CHILDREN_CHANGED,M(hx,this))),"function"==typeof ld.addEventListener&&(C(vx,this,(()=>A(kx,this,Wx).call(this))),ld.addEventListener("online",M(vx,this)))}function Lx(e={}){if(A(kx,this,_x).call(this))return;const t=Number(null==e?void 0:e.targetTime);if(!Number.isFinite(t))return;const n=Array.isArray(null==e?void 0:e.placements)?e.placements:[],i=A(kx,this,Px).call(this,n,t);A(kx,this,Rx).call(this,i),C(gx,this,!0),C(yx,this,n.map((e=>{const n=null==e?void 0:e.nodeId;if(n)return{nodeId:n,placement:e,targetTime:t}})).filter(Boolean)),setTimeout((()=>A(kx,this,qx).call(this)),0)}function Bx(e={}){var t;if(A(kx,this,_x).call(this))return;C(gx,this,!1),C(yx,this,[]);const n=Number.isFinite(null==e?void 0:e.targetTime)?Number(e.targetTime):Number(null===(t=M(nx,this))||void 0===t?void 0:t.currentTime);A(kx,this,zx).call(this,n),setTimeout((()=>A(kx,this,qx).call(this)),0)}function zx(e){var t;(Array.isArray(null===(t=M(nx,this))||void 0===t?void 0:t.placements)?M(nx,this).placements:[]).forEach((t=>{if(!t)return;const n=vm(t);if(Number.isFinite(n)){if(Number.isFinite(e)){if(n>=e)return void A(kx,this,jx).call(this,t);const i=pm(t,M(ex,this));return Number.isFinite(i)?void(n+i>e&&A(kx,this,jx).call(this,t)):void(n<=e&&A(kx,this,jx).call(this,t))}A(kx,this,jx).call(this,t)}}))}function Wx(){var e;A(kx,this,_x).call(this)||(A(kx,this,Mx).call(this),C(gx,this,!1),C(yx,this,[]),A(kx,this,zx).call(this,Number(null===(e=M(nx,this))||void 0===e?void 0:e.currentTime)),C(ox,this,A(kx,this,t_).call(this)),setTimeout((()=>A(kx,this,qx).call(this)),0))}function $x(){M(ux,this)&&M(ux,this).abort(),C(ux,this,Fy()),M(ax,this).size&&M(ax,this).forEach((e=>{(null==e?void 0:e.controller)&&e.controller.abort()})),M(ax,this).clear(),M(ix,this).clear(),M(rx,this).clear(),C(ox,this,[]),M(sx,this).clear(),C(lx,this,!1),C(cx,this,void 0),C(gx,this,!1),C(yx,this,[])}function jx(e){if(A(kx,this,_x).call(this))return;const t=null==e?void 0:e.nodeId;if(!t)return;const n=M(ix,this).get(t);if(n){const i=vm(n),r=vm(e);Number.isFinite(i)?Number.isFinite(r)&&r<i&&M(ix,this).set(t,e):Number.isFinite(r)&&M(ix,this).set(t,e)}else M(ix,this).set(t,e);const i=M(cx,this);C(cx,this,t),i&&i!==t&&C(ox,this,[]),M(lx,this)?setTimeout((()=>A(kx,this,qx).call(this)),0):A(kx,this,Ux).call(this)}function Ux(){M(lx,this)||M(ix,this).size&&(C(lx,this,!0),A(kx,this,qx).call(this))}async function qx(){if(A(kx,this,_x).call(this))return;if(M(sx,this).size>=this.settings.maxConcurrentLoads)return;if(M(gx,this))return void(M(yx,this).length&&A(kx,this,Vx).call(this));const e=A(kx,this,Yx).call(this);if(e.hasPending)A(kx,this,Qx).call(this,e);else for(M(ox,this).length||C(ox,this,A(kx,this,t_).call(this));M(sx,this).size<this.settings.maxConcurrentLoads&&M(ox,this).length;){const e=M(ox,this).shift();A(kx,this,r_).call(this,e,"partial").finally((()=>{setTimeout((()=>A(kx,this,qx).call(this)),0)}))}}function Vx(){if(A(kx,this,_x).call(this))return;const e=Math.max(0,this.settings.maxConcurrentLoads-M(sx,this).size);if(!e||!M(yx,this).length)return;const t=[],n=[];for(let i=0;i<M(yx,this).length;i+=1){const r=M(yx,this)[i];(null==r?void 0:r.nodeId)&&(t.length<e&&!M(sx,this).has(r.nodeId)?t.push(r):n.push(r))}C(yx,this,n),t.forEach((e=>{A(kx,this,Gx).call(this,e).finally((()=>{setTimeout((()=>A(kx,this,qx).call(this)),0)}))}))}async function Gx(e={}){const t=null==e?void 0:e.nodeId,n=null==e?void 0:e.placement,i=Number(null==e?void 0:e.targetTime);if(!t||!n||!Number.isFinite(i))return;if(M(sx,this).has(t))return;const{signal:r,controller:o}=A(kx,this,Fx).call(this,t);if(r&&r.aborted)A(kx,this,Ox).call(this,t,o);else{M(sx,this).add(t);try{const e=M(ex,this)&&"function"==typeof M(ex,this).get?M(ex,this).get(t):void 0;if(!e)return;if("ready"!==e.state&&"function"==typeof e.resolve)try{await e.resolve({signal:r})}catch(e){return}if("ready"!==e.state)return;const s=A(kx,this,Hx).call(this,e,n,i);if(!Number.isFinite(s)){const n=Array.isArray(null==e?void 0:e.tracks)?e.tracks.map((e=>null==e?void 0:e.type)).filter(Boolean):[];return void this.log.debug(`[#loadSeekWork] No seek segment offset for node [${t}] targetTime=${i} mainTrackId=${(null==e?void 0:e.mainTrackId)||"n/a"} trackTypes=[${n.join(",")}]`)}"function"==typeof e.loadMediaSegmentsAtOffset?(this.log.debug(`[#loadSeekWork] Loading seek segment for node [${t}] at offset=${s}`),A(kx,this,Cx).call(this,t,o,{allowSeekKeep:!0,segmentOffset:s}),await e.loadMediaSegmentsAtOffset(s,{signal:r})):"function"==typeof e.load&&await e.load({loadingMode:"partial",signal:r})}catch(e){Oy(e,r)||this.log.warn(`[#loadSeekWork] SegmentLoadCoordinator failed to seek-load node ${t}: ${(null==e?void 0:e.message)||e}`)}finally{M(sx,this).delete(t),A(kx,this,Ox).call(this,t,o)}}}function Hx(e,t,n){var i;const r=vm(t);if(!Number.isFinite(r))return;const o=Zw(null==t?void 0:t.nodeOffsetOverride),s=Math.max(0,n-r+o),a=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[];let l;if(null!=e&&e.mainTrackId){const t=a.find((t=>(null==t?void 0:t.id)===e.mainTrackId));"video"!==(null==t?void 0:t.type)&&"image"!==(null==t?void 0:t.type)||(l=t)}if(l||(l=a.find((e=>"video"===(null==e?void 0:e.type)))||a.find((e=>"image"===(null==e?void 0:e.type)))),!l||!Array.isArray(l.segments))return;const c=l.segments.filter((e=>e&&!e.isInit&&Array.isArray(e.representations)));if(!c.length)return;const u=Zw(null===(i=l)||void 0===i?void 0:i.offset),d=pb(c,Math.max(0,s-u),{preferRepresentationTime:!0}),h=Number(null==d?void 0:d.offset);return Number.isFinite(h)?h:void 0}function Kx(e,t,n=(e=>null===(e=M(nx,this))||void 0===e?void 0:e.currentTime)()){var i;const r=(Array.isArray(null===(i=M(nx,this))||void 0===i?void 0:i.placements)?M(nx,this).placements:[]).filter((t=>(null==t?void 0:t.nodeId)===e&&Number.isFinite(vm(t)))).sort(((e,t)=>vm(e)-vm(t)));if(!r.length)return t;const o=Number(n);if(!Number.isFinite(o))return t||r[0];let s,a;for(let e=0;e<r.length;e+=1){const t=r[e],n=vm(t);if(!Number.isFinite(n))continue;const i=pm(t,M(ex,this)),l=Number.isFinite(i)&&i>=0;(!a&&n>=o-Qw&&(a=t),l)?o+Qw>=n&&o<n+i-Qw&&(s=t):o+Qw>=n&&(s=t)}return s||a||r[r.length-1]}function Xx(e,t){var n;const i=Number(vm(t));if(!Number.isFinite(i))return;const r=pm(t,M(ex,this)),o=Number.isFinite(r)&&r>=0?i+r:void 0,s=(Array.isArray(null===(n=M(nx,this))||void 0===n?void 0:n.placements)?M(nx,this).placements:[]).filter((t=>(null==t?void 0:t.nodeId)===e&&Number.isFinite(vm(t)))).sort(((e,t)=>vm(e)-vm(t)));for(let e=0;e<s.length;e+=1){const t=s[e],n=Number(vm(t));if(Number.isFinite(n)&&!(n<=i+Qw)){if(Number.isFinite(o)&&n>o+Qw)return;return t}}}function Yx(){const e=[];let t=!1,n=1/0;if(M(ix,this).forEach(((i,r)=>{if(!r||!i)return;const o=M(rx,this).get(r);if(o)return t=!0,void(n=Math.min(n,Zw(o.timelineStart)));const s=A(kx,this,Jx).call(this,r,i);s&&(t=!0,n=Math.min(n,Zw(s.timelineStart)),e.push(s))})),!t||!Number.isFinite(n))return{hasPending:!1,waveTime:void 0,startable:[]};const i=e.filter((e=>Zw(e.timelineStart)===n&&!M(sx,this).has(e.nodeId))).sort(((e,t)=>{const n=Number.isFinite(null==e?void 0:e.timelineStart)?e.timelineStart:Number.POSITIVE_INFINITY,i=Number.isFinite(null==t?void 0:t.timelineStart)?t.timelineStart:Number.POSITIVE_INFINITY;return n!==i?n-i:String(e.nodeId).localeCompare(String(t.nodeId))}));return{hasPending:!0,waveTime:n,startable:i}}function Qx({waveTime:e,startable:t}){const n=Math.max(0,this.settings.maxConcurrentLoads-M(sx,this).size);n&&t.length&&t.slice(0,n).forEach((t=>{A(kx,this,e_).call(this,t,e).finally((()=>{setTimeout((()=>A(kx,this,qx).call(this)),0)}))}))}function Jx(e,t){var n,i;const r=M(ex,this)&&"function"==typeof M(ex,this).get?M(ex,this).get(e):void 0;if(!r)return;if("function"==typeof r.hasExceededManifestLoadAttempts&&r.hasExceededManifestLoadAttempts())return void M(ix,this).delete(e);const o=A(kx,this,Kx).call(this,e,t,null===(n=M(nx,this))||void 0===n?void 0:n.currentTime),s=Number(vm(o)),a=Zw(null===(i=M(nx,this))||void 0===i?void 0:i.currentTime),l="function"==typeof r.loadMediaSegmentsAtOffset,c="function"==typeof r.load;if(!l&&!c)return void M(ix,this).delete(e);if(r.isLoaded)return void M(ix,this).delete(e);if("ready"!==r.state){if(!Number.isFinite(s))return;return{nodeId:e,segmentOffset:0,timelineStart:s}}if(!A(kx,this,o_).call(this,r))return void M(ix,this).delete(e);const u=Array.isArray(r.tracks)?r.tracks:[],d=u.some((e=>{const t=(Array.isArray(null==e?void 0:e.segments)?e.segments:[]).find((e=>(null==e?void 0:e.isInit)&&Array.isArray(null==e?void 0:e.representations)));return!!t&&!A(kx,this,Ix).call(this,t)})),h=new Set;u.forEach((e=>{(Array.isArray(null==e?void 0:e.segments)?e.segments:[]).forEach((e=>{if(!e||e.isInit||!Array.isArray(e.representations))return;const t=Number(e.offset);if(Number.isFinite(t)){const e=Math.round(t/Qw)*Qw;h.add(e)}}))}));const f=Array.from(h).sort(((e,t)=>e-t)),p=t=>{const n=Number(vm(t));if(!Number.isFinite(n))return{status:"none"};const i=Zw(null==t?void 0:t.nodeOffsetOverride),o=Math.max(0,a-n+i);let s=0;for(let e=0;e<f.length&&f[e]<=o+Qw;e+=1)s=e;const l=f.slice(s);if(!l.some((e=>A(kx,this,Zx).call(this,r,e))))return{status:f.slice(0,s).some((e=>A(kx,this,Zx).call(this,r,e)))?"beforeOnly":"none"};const c=l.find((e=>A(kx,this,Zx).call(this,r,e))),u=Math.max(0,Zw(c)-i);return{status:"work",work:{nodeId:e,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:e,segmentOffset:0,timelineStart:s};M(ix,this).delete(e)}else{const t=A(kx,this,Xx).call(this,e,o);if(t){const e=p(t);if("work"===e.status)return e.work}}}function Zx(e,t){const n=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[],i=Zw(t);return n.some((e=>(Array.isArray(null==e?void 0:e.segments)?e.segments:[]).some((e=>{if(!e||e.isInit||!Array.isArray(e.representations))return!1;const t=Number(e.offset);return Number.isFinite(t)&&Math.abs(t-i)<=Qw&&!A(kx,this,Ix).call(this,e)}))))}async function e_(e,t){const n=null==e?void 0:e.nodeId,i=null==e?void 0:e.segmentOffset;if(this.log.debug(`[#loadP0Work] Loading ${Jw} node [${n}] at segmentOffset=${i} wave=${t}`),!n)return;const r=M(ex,this)&&"function"==typeof M(ex,this).get?M(ex,this).get(n):void 0;if(!r)return void M(ix,this).delete(n);const o="function"==typeof r.loadMediaSegmentsAtOffset&&Number.isFinite(i),{signal:s,controller:a}=A(kx,this,Fx).call(this,n,{allowSeekKeep:o,segmentOffset:i});if(s&&s.aborted)A(kx,this,Ox).call(this,n,a);else{M(sx,this).add(n),M(rx,this).set(n,{timelineStart:t,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(e){if(Oy(e,s))return;const t=`[#loadP0Work] SegmentLoadCoordinator failed to load ${Jw} work for node ${n}: ${(null==e?void 0:e.message)||e}`;this.log.warn(t)}finally{this.log.debug(`[#loadP0Work] Finished ${Jw} work for node [${n}]`),M(rx,this).delete(n),M(sx,this).delete(n),A(kx,this,Ox).call(this,n,a)}}}function t_(){const e=new Set([...M(ix,this).keys(),...M(sx,this)]),t=A(kx,this,n_).call(this),n=Array.isArray(null==t?void 0:t.orderedIds)?t.orderedIds:null,i=Array.isArray(null==t?void 0:t.reachableIds)&&t.reachableIds.length?new Set(t.reachableIds):null,r=e=>!("function"==typeof e.hasExceededManifestLoadAttempts&&e.hasExceededManifestLoadAttempts()||e.isLoaded||"ready"===e.state&&A(kx,this,s_).call(this,e));if(i){const t=nw({prioritizer:M(tx,this),repository:M(ex,this),startNodeId:M(cx,this),prioritizedIds:n,pendingIds:e,allowedIds:i,filter:r});if(t.length)return t}return nw({prioritizer:M(tx,this),repository:M(ex,this),startNodeId:M(cx,this),prioritizedIds:n,pendingIds:e,filter:r})}function n_(){return M(tx,this)&&M(cx,this)?"function"==typeof M(tx,this).getPrioritizationSnapshot?M(tx,this).getPrioritizationSnapshot(M(cx,this)):{orderedIds:"function"==typeof M(tx,this).sortNodes?M(tx,this).sortNodes(M(cx,this)):[],reachableIds:"function"==typeof M(tx,this).getReachableNodeIds?M(tx,this).getReachableNodeIds(M(cx,this)):[]}:null}function i_(){A(kx,this,_x).call(this)||(M(lx,this)||M(ix,this).size)&&(C(ox,this,A(kx,this,t_).call(this)),M(lx,this)&&!M(gx,this)&&A(kx,this,qx).call(this))}async function r_(e,t){if(this.log.debug(`[#loadNode] Loading node [${e}] in '${t}' mode`),!e)return;const n=M(ex,this)&&"function"==typeof M(ex,this).get?M(ex,this).get(e):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 ${e}: already loaded`);const{signal:i,controller:r}=A(kx,this,Fx).call(this,e,{allowSeekKeep:!1});if(i&&i.aborted)A(kx,this,Ox).call(this,e,r);else try{if("ready"!==n.state&&await n.resolve({signal:i}),"ready"!==n.state)return void this.log.debug(`[#loadNode] Skipping load for ${e}: not ready`);if("partial"===t&&A(kx,this,s_).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${e}: partial already loaded`);if(!A(kx,this,o_).call(this,n))return void this.log.debug(`[#loadNode] Skipping load for ${e}: no loadable tracks`);M(sx,this).add(e),await n.load({loadingMode:t,signal:i})}catch(t){if(Oy(t,i))return;this.log.warn(`[#loadNode] SegmentLoadCoordinator failed to load node ${e}: ${(null==t?void 0:t.message)||t}`)}finally{this.log.debug(`[#loadNode] Finished loading node [${e}]`),M(sx,this).delete(e),A(kx,this,Ox).call(this,e,r)}}function o_(e){return(Array.isArray(e.tracks)?e.tracks:[]).some((e=>{var t;return null==e||null===(t=e.segments)||void 0===t?void 0:t.length}))}function s_(e){const t=(Array.isArray(null==e?void 0:e.tracks)?e.tracks:[]).filter((e=>Array.isArray(null==e?void 0:e.segments)&&e.segments.length));return!t.length||t.every((e=>{const t=Array.isArray(null==e?void 0:e.segments)?e.segments:[];if(!t.length)return!0;const n=t.find((e=>null==e?void 0:e.isInit)),i=t.find((e=>e&&!e.isInit));return!(n&&!A(kx,this,Ix).call(this,n)||i&&!A(kx,this,Ix).call(this,i))}))}class a_ extends od{constructor(...e){super(...e),this.track=void 0,this.lastSegment=void 0}get name(){return"BaseDecoder"}configure(e){this.track=e}decode(e){this.lastSegment=e}decodeChunk(e,t){}onDispose(){this.track=void 0,this.lastSegment=void 0}}function l_(e){if(!e)throw new Error("Assertion failed.")}const c_=e=>e&&e[e.length-1],u_=e=>{let t=0;for(;0===e.readBits(1)&&t<32;)t++;if(t>=32)throw new Error("Invalid exponential-Golomb code.");return(1<<t)-1+e.readBits(t)},d_=e=>e.constructor===Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e),h_=e=>e.constructor===DataView?e:ArrayBuffer.isView(e)?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(e),f_=new TextDecoder,p_=e=>Object.fromEntries(Object.entries(e).map((([e,t])=>[t,e]))),m_={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},v_=p_(m_),g_={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},y_=p_(g_),b_={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},k_=p_(b_),w_=e=>[...e].map((e=>e.toString(16).padStart(2,"0"))).join(""),x_=e=>(e=(e=(e=(e=(e=e>>1&1431655765|(1431655765&e)<<1)>>2&858993459|(858993459&e)<<2)>>4&252645135|(252645135&e)<<4)>>8&16711935|(16711935&e)<<8)>>16&65535|(65535&e)<<16)>>>0,__=(e,t,n)=>{let i=0,r=e.length-1,o=-1;for(;i<=r;){const s=i+r>>1,a=n(e[s]);a===t?(o=s,r=s-1):a<t?i=s+1:r=s-1}return o},T_=(e,t,n)=>{let i=0,r=e.length-1,o=-1;for(;i<=r;){const s=i+(r-i+1)/2|0;n(e[s])<=t?(o=s,i=s+1):r=s-1}return o},E_=()=>{let e,t;return{promise:new Promise(((n,i)=>{e=n,t=i})),resolve:e,reject:t}},I_=(e,t,n)=>e.getUint8(t)<<16|e.getUint8(t+1)<<8|e.getUint8(t+2),S_=(e,t,n)=>Math.max(t,Math.min(n,e)),A_=/^[a-z]{3}$/,N_=1e6*(1+Number.EPSILON);let M_=null;let F_=null;const C_=()=>{if(null!==F_)return F_;if("undefined"==typeof navigator)return null;const e=/\bChrome\/(\d+)/.exec(navigator.userAgent);return e?F_=Number(e[1]):null},O_=e=>"number"==typeof e&&!Number.isNaN(e);class P_{constructor(e,t){if(this.data=e,this.mimeType=t,!(e instanceof Uint8Array))throw new TypeError("data must be a Uint8Array.");if("string"!=typeof t)throw new TypeError("mimeType must be a string.")}}const R_={default:!0,forced:!1,original:!1,commentary:!1,hearingImpaired:!1,visuallyImpaired:!1};class D_{constructor(e){this.bytes=e,this.pos=0}seekToByte(e){this.pos=8*e}readBit(){var e;const t=Math.floor(this.pos/8),n=null!==(e=this.bytes[t])&&void 0!==e?e:0,i=7-(7&this.pos),r=(n&1<<i)>>i;return this.pos++,r}readBits(e){if(1===e)return this.readBit();let t=0;for(let n=0;n<e;n++)t<<=1,t|=this.readBit();return t}writeBits(e,t){const n=this.pos+e;for(let e=this.pos;e<n;e++){const i=Math.floor(e/8);let r=this.bytes[i];const o=7-(7&e);r&=~(1<<o),r|=(t&1<<n-e-1)>>n-e-1<<o,this.bytes[i]=r}this.pos=n}readAlignedByte(){var e;if(this.pos%8!=0)throw new Error("Bitstream is not byte-aligned.");const t=this.pos/8,n=null!==(e=this.bytes[t])&&void 0!==e?e:0;return this.pos+=8,n}skipBits(e){this.pos+=e}getBitsLeft(){return 8*this.bytes.length-this.pos}clone(){const e=new D_(this.bytes);return e.pos=this.pos,e}}const L_=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],B_=[-1,1,2,3,4,5,6,8],z_=e=>{if(!e||e.byteLength<2)throw new TypeError("AAC description must be at least 2 bytes long.");const t=new D_(e);let n=t.readBits(5);31===n&&(n=32+t.readBits(6));const i=t.readBits(4);let r=null;15===i?r=t.readBits(24):i<L_.length&&(r=L_[i]);const o=t.readBits(4);let s=null;return o>=1&&o<=7&&(s=B_[o]),{objectType:n,frequencyIndex:i,sampleRate:r,channelConfiguration:o,numberOfChannels:s}},W_=["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"],$_=[{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}],j_=e=>{const{codec:t,codecDescription:n,colorSpace:i,avcCodecInfo:r,hevcCodecInfo:o,vp9CodecInfo:s,av1CodecInfo:a}=e;if("avc"===t){if(l_(null!==e.avcType),r){const t=new Uint8Array([r.avcProfileIndication,r.profileCompatibility,r.avcLevelIndication]);return`avc${e.avcType}.${w_(t)}`}if(!n||n.byteLength<4)throw new TypeError("AVC decoder description is not provided or is not at least 4 bytes long.");return`avc${e.avcType}.${w_(n.subarray(1,4))}`}if("hevc"===t){let e,t,i,r,s,a;if(o)e=o.generalProfileSpace,t=o.generalProfileIdc,i=x_(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=h_(n),l=o.getUint8(1);e=l>>6&3,t=31&l,i=x_(o.getUint32(2)),r=l>>5&1,s=o.getUint8(12),a=[];for(let e=0;e<6;e++)a.push(o.getUint8(6+e))}let l="hev1.";for(l+=["","A","B","C"][e]+t,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((e=>e.toString(16).toUpperCase())).join(".")),l}if("vp8"===t)return"vp8";if("vp9"===t){if(!s){const t=e.width*e.height;let n=c_($_).level;for(const e of $_)if(t<=e.maxPictureSize){n=e.level;break}return`vp09.00.${n.toString().padStart(2,"0")}.08`}let t=`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 t+=`.${s.colourPrimaries.toString().padStart(2,"0")}.${s.transferCharacteristics.toString().padStart(2,"0")}.${s.matrixCoefficients.toString().padStart(2,"0")}.${s.videoFullRangeFlag.toString().padStart(2,"0")}`,t.endsWith(".01.01.01.01.00")&&(t=t.slice(0,-15)),t}if("av1"===t){if(!a){const t=e.width*e.height;let n=c_($_).level;for(const e of $_)if(t<=e.maxPictureSize){n=e.level;break}return`av01.0.${n.toString().padStart(2,"0")}M.08`}const t=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?m_[i.primaries]:1,u=null!=i&&i.transfer?g_[i.transfer]:1,d=null!=i&&i.matrix?b_[i.matrix]:1,h=null!=i&&i.fullRange?1:0;let f=`av01.${t}.${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 '${t}'.`)},U_=e=>{const{codec:t,codecDescription:n,aacCodecInfo:i}=e;if("aac"===t){if(!i)throw new TypeError("AAC codec info must be provided.");if(i.isMpeg2)return"mp4a.67";{let e;return e=null!==i.objectType?i.objectType:z_(n).objectType,`mp4a.40.${e}`}}if("mp3"===t)return"mp3";if("opus"===t)return"opus";if("vorbis"===t)return"vorbis";if("flac"===t)return"flac";if("ac3"===t)return"ac-3";if("eac3"===t)return"ec-3";if(t&&W_.includes(t))return t;throw new TypeError(`Unhandled codec '${t}'.`)},q_=/^pcm-([usf])(\d+)+(be)?$/,V_=[48e3,44100,32e3],G_=[24e3,22050,16e3];var H_,K_;!function(e){e[e.NON_IDR_SLICE=1]="NON_IDR_SLICE",e[e.SLICE_DPA=2]="SLICE_DPA",e[e.SLICE_DPB=3]="SLICE_DPB",e[e.SLICE_DPC=4]="SLICE_DPC",e[e.IDR=5]="IDR",e[e.SEI=6]="SEI",e[e.SPS=7]="SPS",e[e.PPS=8]="PPS",e[e.AUD=9]="AUD",e[e.SPS_EXT=13]="SPS_EXT"}(H_||(H_={})),function(e){e[e.RASL_N=8]="RASL_N",e[e.RASL_R=9]="RASL_R",e[e.BLA_W_LP=16]="BLA_W_LP",e[e.RSV_IRAP_VCL23=23]="RSV_IRAP_VCL23",e[e.VPS_NUT=32]="VPS_NUT",e[e.SPS_NUT=33]="SPS_NUT",e[e.PPS_NUT=34]="PPS_NUT",e[e.AUD_NUT=35]="AUD_NUT",e[e.PREFIX_SEI_NUT=39]="PREFIX_SEI_NUT",e[e.SUFFIX_SEI_NUT=40]="SUFFIX_SEI_NUT"}(K_||(K_={}));const X_=function*(e){let t=0,n=-1;for(;t<e.length-2;){const i=e.indexOf(0,t);if(-1===i||i>=e.length-2)break;t=i;let r=0;t+3<e.length&&0===e[t+1]&&0===e[t+2]&&1===e[t+3]?r=4:0===e[t+1]&&1===e[t+2]&&(r=3),0!==r?(-1!==n&&t>n&&(yield{offset:n,length:t-n}),n=t+r,t=n):t++}-1!==n&&n<e.length&&(yield{offset:n,length:e.length-n})},Y_=function*(e,t){let n=0;const i=new DataView(e.buffer,e.byteOffset,e.byteLength);for(;n+t<=e.length;){let e;1===t?e=i.getUint8(n):2===t?e=i.getUint16(n,!1):3===t?e=I_(i,n):(l_(4===t),e=i.getUint32(n,!1)),n+=t,yield{offset:n,length:e},n+=e}},Q_=e=>31&e,J_=e=>{const t=[],n=e.length;for(let i=0;i<n;i++)i+2<n&&0===e[i]&&0===e[i+1]&&3===e[i+2]?(t.push(0,0),i+=2):t.push(e[i]);return new Uint8Array(t)},Z_=e=>e>>1&63,eT=function*(e){const t=new D_(e),n=()=>{let e=0;for(let n=0;n<8;n++){const i=t.readAlignedByte();if(e|=(127&i)<<7*n,!(128&i))break;if(7===n&&128&i)return null}return e>=2**32-1?null:e};for(;t.getBitsLeft()>=8;){t.skipBits(1);const i=t.readBits(4),r=t.readBits(1),o=t.readBits(1);let s;if(t.skipBits(1),r&&t.skipBits(8),o){const e=n();if(null===e)return;s=e}else s=Math.floor(t.getBitsLeft()/8);l_(t.pos%8==0),yield{type:i,data:e.subarray(t.pos/8,t.pos/8+s)},t.skipBits(8*s)}};var tT;!function(e){e[e.STREAMINFO=0]="STREAMINFO",e[e.VORBIS_COMMENT=4]="VORBIS_COMMENT",e[e.PICTURE=6]="PICTURE"}(tT||(tT={}));const nT=[2,1,2,3,3,4,4,5];class iT{constructor(e){this.input=e}}const rT=[],oT=[],sT=new Uint8Array(0);class aT{constructor(e,t,n,i,r=-1,o,s){if(this.data=e,this.type=t,this.timestamp=n,this.duration=i,this.sequenceNumber=r,e===sT&&void 0===o)throw new Error("Internal error: byteLength must be explicitly provided when constructing metadata-only packets.");if(void 0===o&&(o=e.byteLength),!(e instanceof Uint8Array))throw new TypeError("data must be a Uint8Array.");if("key"!==t&&"delta"!==t)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===sT}get microsecondTimestamp(){return Math.trunc(N_*this.timestamp)}get microsecondDuration(){return Math.trunc(N_*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(e=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:e,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(e,t){var n;if(!(e instanceof EncodedVideoChunk||e instanceof EncodedAudioChunk))throw new TypeError("chunk must be an EncodedVideoChunk or EncodedAudioChunk.");const i=new Uint8Array(e.byteLength);return e.copyTo(i),new aT(i,e.type,e.timestamp/1e6,(null!==(n=e.duration)&&void 0!==n?n:0)/1e6,void 0,void 0,t)}clone(e){var t,n,i,r,o,s;if(void 0!==e&&("object"!=typeof e||null===e))throw new TypeError("options, when provided, must be an object.");if(void 0!==(null==e?void 0:e.data)&&!(e.data instanceof Uint8Array))throw new TypeError("options.data, when provided, must be a Uint8Array.");if(void 0!==(null==e?void 0:e.type)&&"key"!==e.type&&"delta"!==e.type)throw new TypeError('options.type, when provided, must be either "key" or "delta".');if(void 0!==(null==e?void 0:e.timestamp)&&!Number.isFinite(e.timestamp))throw new TypeError("options.timestamp, when provided, must be a number.");if(void 0!==(null==e?void 0:e.duration)&&!Number.isFinite(e.duration))throw new TypeError("options.duration, when provided, must be a number.");if(void 0!==(null==e?void 0:e.sequenceNumber)&&!Number.isFinite(e.sequenceNumber))throw new TypeError("options.sequenceNumber, when provided, must be a number.");if(void 0!==(null==e?void 0:e.sideData)&&("object"!=typeof e.sideData||null===e.sideData))throw new TypeError("options.sideData, when provided, must be an object.");return new aT(null!==(t=null==e?void 0:e.data)&&void 0!==t?t:this.data,null!==(n=null==e?void 0:e.type)&&void 0!==n?n:this.type,null!==(i=null==e?void 0:e.timestamp)&&void 0!==i?i:this.timestamp,null!==(r=null==e?void 0:e.duration)&&void 0!==r?r:this.duration,null!==(o=null==e?void 0:e.sequenceNumber)&&void 0!==o?o:this.sequenceNumber,this.byteLength,null!==(s=null==e?void 0:e.sideData)&&void 0!==s?s:this.sideData)}}const lT=e=>{if(!e||"object"!=typeof e)throw new TypeError("options must be an object.");if(void 0!==e.metadataOnly&&"boolean"!=typeof e.metadataOnly)throw new TypeError("options.metadataOnly, when defined, must be a boolean.");if(void 0!==e.verifyKeyPackets&&"boolean"!=typeof e.verifyKeyPackets)throw new TypeError("options.verifyKeyPackets, when defined, must be a boolean.");if(e.verifyKeyPackets&&e.metadataOnly)throw new TypeError("options.verifyKeyPackets and options.metadataOnly cannot be enabled together.")},cT=e=>{if(!O_(e))throw new TypeError("timestamp must be a number.")},uT=(e,t,n)=>n.verifyKeyPackets?t.then((async t=>{if(!t||"delta"===t.type)return t;const n=await e.determinePacketType(t);return n&&(t.type=n),t})):t;class dT{constructor(e){if(!(e instanceof hT))throw new TypeError("track must be an InputTrack.");this._track=e}getFirstPacket(e={}){if(lT(e),this._track.input._disposed)throw new BT;return uT(this._track,this._track._backing.getFirstPacket(e),e)}async getFirstKeyPacket(e={}){lT(e);const t=await this.getFirstPacket(e);return t?"key"===t.type?t:this.getNextKeyPacket(t,e):null}getPacket(e,t={}){if(cT(e),lT(t),this._track.input._disposed)throw new BT;return uT(this._track,this._track._backing.getPacket(e,t),t)}getNextPacket(e,t={}){if(!(e instanceof aT))throw new TypeError("packet must be an EncodedPacket.");if(lT(t),this._track.input._disposed)throw new BT;return uT(this._track,this._track._backing.getNextPacket(e,t),t)}async getKeyPacket(e,t={}){if(cT(e),lT(t),this._track.input._disposed)throw new BT;if(!t.verifyKeyPackets)return this._track._backing.getKeyPacket(e,t);const n=await this._track._backing.getKeyPacket(e,t);return n?(l_("key"===n.type),"delta"===await this._track.determinePacketType(n)?this.getKeyPacket(n.timestamp-1/this._track.timeResolution,t):n):n}async getNextKeyPacket(e,t={}){if(!(e instanceof aT))throw new TypeError("packet must be an EncodedPacket.");if(lT(t),this._track.input._disposed)throw new BT;if(!t.verifyKeyPackets)return this._track._backing.getNextKeyPacket(e,t);const n=await this._track._backing.getNextKeyPacket(e,t);return n?(l_("key"===n.type),"delta"===await this._track.determinePacketType(n)?this.getNextKeyPacket(n,t):n):n}packets(e,t,n={}){if(void 0!==e&&!(e instanceof aT))throw new TypeError("startPacket must be an EncodedPacket.");if(void 0!==e&&e.isMetadataOnly&&(null==n||!n.metadataOnly))throw new TypeError("startPacket can only be metadata-only if options.metadataOnly is enabled.");if(void 0!==t&&!(t instanceof aT))throw new TypeError("endPacket must be an EncodedPacket.");if(lT(n),this._track.input._disposed)throw new BT;const i=[];let{promise:r,resolve:o}=E_(),{promise:s,resolve:a}=E_(),l=!1,c=!1,u=null;const d=[];(async()=>{let u=null!=e?e:await this.getFirstPacket(n);for(;u&&!c&&!this._track.input._disposed&&!(t&&u.sequenceNumber>=(null==t?void 0:t.sequenceNumber));)i.length>Math.max(2,d.length)?(({promise:s,resolve:a}=E_()),await s):(i.push(u),o(),({promise:r,resolve:o}=E_()),u=await this.getNextPacket(u,n));l=!0,o()})().catch((e=>{u||(u=e,o())}));const h=this._track;return{async next(){for(;;){if(h.input._disposed)throw new BT;if(c)return{value:void 0,done:!0};if(u)throw u;if(i.length>0){const e=i.shift(),t=performance.now();for(d.push(t);d.length>0&&t-d[0]>=1e3;)d.shift();return a(),{value:e,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(e){throw e},[Symbol.asyncIterator](){return this}}}}class hT{constructor(e,t){this.input=e,this._backing=t}isVideoTrack(){return this instanceof fT}isAudioTrack(){return this instanceof pT}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(e=1/0){const t=new dT(this);let n=1/0,i=-1/0,r=0,o=0;for await(const s of t.packets(void 0,void 0,{metadataOnly:!0})){if(r>=e&&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 fT extends hT{constructor(e,t){super(e,t),this._backing=t,this.pixelAspectRatio=(e=>{l_(0!==e.den);let t=Math.abs(e.num),n=Math.abs(e.den);for(;0!==n;){const e=t%n;t=n,n=e}const i=t||1;return{num:e.num/i,den:e.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 e=await this._backing.getColorSpace();return"bt2020"===e.primaries||"smpte432"===e.primaries||"pg"===e.transfer||"hlg"===e.transfer||"bt2020-ncl"===e.matrix}canBeTransparent(){return this._backing.canBeTransparent()}getDecoderConfig(){return this._backing.getDecoderConfig()}async getCodecParameterString(){var e;const t=await this._backing.getDecoderConfig();return null!==(e=null==t?void 0:t.codec)&&void 0!==e?e:null}async canDecode(){try{const e=await this._backing.getDecoderConfig();if(!e)return!1;const t=this._backing.getCodec();return l_(null!==t),rT.some((n=>n.supports(t,e)))?!0:"undefined"!=typeof VideoDecoder&&!0===(await VideoDecoder.isConfigSupported(e)).supported}catch(e){return console.error("Error during decodability check:",e),!1}}async determinePacketType(e){if(!(e instanceof aT))throw new TypeError("packet must be an EncodedPacket.");if(e.isMetadataOnly)throw new TypeError("packet must not be metadata-only to determine its type.");if(null===this.codec)return null;const t=await this.getDecoderConfig();return l_(t),((e,t,n)=>{switch(e){case"avc":for(const e of((e,t)=>{if(t.description){const n=3&d_(t.description)[4];return Y_(e,n+1)}return X_(e)})(n,t)){const t=n[e.offset],r=Q_(t);if(r>=H_.NON_IDR_SLICE&&r<=H_.SLICE_DPC)return"delta";if(r===H_.IDR)return"key";if(r===H_.SEI&&(i=void 0,!(null!==M_?M_:M_=!("undefined"==typeof navigator||(null===(i=navigator.vendor)||void 0===i||!i.includes("Google Inc"))&&!/Chrome/.test(navigator.userAgent)))||C_()>=144)){const t=n.subarray(e.offset,e.offset+e.length),i=J_(t);let r=1;do{let e=0;for(;;){const t=i[r++];if(void 0===t)break;if(e+=t,t<255)break}let t=0;for(;;){const e=i[r++];if(void 0===e)break;if(t+=e,e<255)break}if(6===e){const e=new D_(i);e.pos=8*r;const t=u_(e),n=e.readBits(1);if(0===t&&1===n)return"key"}r+=t}while(r<i.length-1)}}return"delta";case"hevc":for(const e of((e,t)=>{if(t.description){const n=3&d_(t.description)[21];return Y_(e,n+1)}return X_(e)})(n,t)){const t=Z_(n[e.offset]);if(t<K_.BLA_W_LP)return"delta";if(t<=K_.RSV_IRAP_VCL23)return"key"}return"delta";case"vp8":return 1&n[0]?"delta":"key";case"vp9":{const e=new D_(n);if(2!==e.readBits(2))return null;const t=e.readBits(1);return 3===(e.readBits(1)<<1)+t&&e.skipBits(1),e.readBits(1)?null:0===e.readBits(1)?"key":"delta"}case"av1":{let e=!1;for(const{type:t,data:i}of eT(n))if(1===t){const t=new D_(i);t.skipBits(4),e=!!t.readBits(1)}else if(3===t||6===t||7===t){if(e)return"key";const t=new D_(i);return t.readBits(1)?null:0===t.readBits(2)?"key":"delta"}return null}default:(e=>{throw new Error(`Unexpected value: ${e}`)})(e),l_(!1)}var i})(this.codec,t,e.data)}}class pT extends hT{constructor(e,t){super(e,t),this._backing=t}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 e;const t=await this._backing.getDecoderConfig();return null!==(e=null==t?void 0:t.codec)&&void 0!==e?e:null}async canDecode(){try{const e=await this._backing.getDecoderConfig();if(!e)return!1;const t=this._backing.getCodec();return l_(null!==t),oT.some((n=>n.supports(t,e)))?!0:!!e.codec.startsWith("pcm-")||"undefined"!=typeof AudioDecoder&&!0===(await AudioDecoder.isConfigSupported(e)).supported}catch(e){return console.error("Error during decodability check:",e),!1}}async determinePacketType(e){if(!(e instanceof aT))throw new TypeError("packet must be an EncodedPacket.");return null===this.codec?null:"key"}}const mT=e=>{let t=HT(e);const n=JT(e,4);let i=8;1===t&&(t=XT(e),i=16);const r=t-i;return r<0?null:{name:n,totalSize:t,headerSize:i,contentSize:r}},vT=e=>KT(e)/65536,gT=e=>KT(e)/1073741824,yT=e=>{let t=0;for(let n=0;n<4;n++){t<<=7;const n=UT(e);if(t|=127&n,!(128&n))break}return t},bT=e=>{let t=qT(e);return e.skip(2),t=Math.min(t,e.remainingLength),f_.decode(jT(e,t))},kT=e=>{const t=mT(e);if(!t||"data"!==t.name)return null;if(e.remainingLength<8)return null;const n=HT(e);e.skip(4);const i=jT(e,t.contentSize-8);switch(n){case 1:return f_.decode(i);case 2:return new TextDecoder("utf-16be").decode(i);case 13:return new P_(i,"image/jpeg");case 14:return new P_(i,"image/png");case 27:return new P_(i,"image/bmp");default:return i}};class wT extends iT{constructor(e){super(e),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=e._reader}async computeDuration(){const e=await this.getTracks(),t=await Promise.all(e.map((e=>e.computeDuration())));return Math.max(0,...t)}async getTracks(){return await this.readMetadata(),this.tracks.map((e=>e.inputTrack))}async getMimeType(){await this.readMetadata();const e=await Promise.all(this.tracks.map((e=>e.inputTrack.getCodecParameterString())));return(e=>{let t=(e.hasVideo?"video/":e.hasAudio?"audio/":"application/")+(e.isQuickTime?"quicktime":"mp4");return e.codecStrings.length>0&&(t+=`; codecs="${[...new Set(e.codecStrings)].join(", ")}"`),t})({isQuickTime:this.isQuickTime,hasVideo:this.tracks.some((e=>{var t;return"video"===(null===(t=e.info)||void 0===t?void 0:t.type)})),hasAudio:this.tracks.some((e=>{var t;return"audio"===(null===(t=e.info)||void 0===t?void 0:t.type)})),codecStrings:e.filter(Boolean)})}async getMetadataTags(){return await this.readMetadata(),this.metadataTags}readMetadata(){var e;return null!==(e=this.metadataPromise)&&void 0!==e?e:this.metadataPromise=(async()=>{let e=0;for(;;){let t=this.reader.requestSliceRange(e,8,16);if(t instanceof Promise&&(t=await t),!t)break;const n=e,i=mT(t);if(!i)break;if("ftyp"===i.name){const e=JT(t,4);this.isQuickTime="qt "===e}else if("moov"===i.name){let e=this.reader.requestSlice(t.filePos,i.contentSize);if(e instanceof Promise&&(e=await e),!e)break;this.moovSlice=e,this.readContiguousBoxes(this.moovSlice),this.tracks.sort(((e,t)=>Number(t.disposition.default)-Number(e.disposition.default)));for(const e of this.tracks){const t=e.editListPreviousSegmentDurations/this.movieTimescale;e.editListOffset-=Math.round(t*e.timescale)}break}e=n+i.totalSize}if(this.isFragmented&&null!==this.reader.fileSize){let e=this.reader.requestSlice(this.reader.fileSize-4,4);e instanceof Promise&&(e=await e),l_(e);const t=HT(e),n=this.reader.fileSize-t;if(n>=0&&n<=this.reader.fileSize-16){let e=this.reader.requestSliceRange(n,8,16);if(e instanceof Promise&&(e=await e),e){const t=mT(e);if(t&&"mfra"===t.name){let n=this.reader.requestSlice(e.filePos,t.contentSize);n instanceof Promise&&(n=await n),n&&this.readContiguousBoxes(n)}}}}})()}getSampleTableForTrack(e){var t;if(e.sampleTable)return e.sampleTable;const n={sampleTimingEntries:[],sampleCompositionTimeOffsets:[],sampleSizes:[],keySampleIndices:null,chunkOffsets:[],sampleToChunk:[],presentationTimestamps:null,presentationTimestampIndexMap:null};e.sampleTable=n,l_(this.moovSlice);const i=this.moovSlice.slice(e.sampleTableByteOffset);if(this.currentTrack=e,this.traverseBox(i),this.currentTrack=null,"audio"===(null===(t=e.info)||void 0===t?void 0:t.type)&&e.info.codec&&W_.includes(e.info.codec)&&0===n.sampleCompositionTimeOffsets.length){var r;l_("audio"===(null===(r=e.info)||void 0===r?void 0:r.type));const t=(e=>{if(l_(W_.includes(e)),"ulaw"===e)return{dataType:"ulaw",sampleSize:1,littleEndian:!0,silentValue:255};if("alaw"===e)return{dataType:"alaw",sampleSize:1,littleEndian:!0,silentValue:213};const t=q_.exec(e);let n;return l_(t),n="u"===t[1]?"unsigned":"s"===t[1]?"signed":"float",{dataType:n,sampleSize:Number(t[2])/8,littleEndian:"be"!==t[3],silentValue:"pcm-u8"===e?128:0}})(e.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=T_(n.sampleTimingEntries,a,(e=>e.startIndex)),u=n.sampleTimingEntries[c],d=T_(n.sampleTimingEntries,l,(e=>e.startIndex)),h=n.sampleTimingEntries[d],f=u.startDecodeTimestamp+(a-u.startIndex)*u.delta,p=h.startDecodeTimestamp+(l-h.startIndex)*h.delta-f,m=c_(i);m&&m.delta===p?m.count++:i.push({startIndex:s.startChunkIndex+r,startDecodeTimestamp:f,count:1,delta:p});const v=s.samplesPerChunk*t.sampleSize*e.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 e of n.sampleTimingEntries)for(let t=0;t<e.count;t++)n.presentationTimestamps.push({presentationTimestamp:e.startDecodeTimestamp+t*e.delta,sampleIndex:e.startIndex+t});for(const e of n.sampleCompositionTimeOffsets)for(let t=0;t<e.count;t++){const i=e.startIndex+t,r=n.presentationTimestamps[i];r&&(r.presentationTimestamp+=e.offset)}n.presentationTimestamps.sort(((e,t)=>e.presentationTimestamp-t.presentationTimestamp)),n.presentationTimestampIndexMap=Array(n.presentationTimestamps.length).fill(-1);for(let e=0;e<n.presentationTimestamps.length;e++)n.presentationTimestampIndexMap[n.presentationTimestamps[e].sampleIndex]=e}return n}async readFragment(e){var t;if((null===(t=this.lastReadFragment)||void 0===t?void 0:t.moofOffset)===e)return this.lastReadFragment;let n=this.reader.requestSliceRange(e,8,16);n instanceof Promise&&(n=await n),l_(n);const i=mT(n);l_("moof"===(null==i?void 0:i.name));let r=this.reader.requestSlice(e,i.totalSize);r instanceof Promise&&(r=await r),l_(r),this.traverseBox(r);const o=this.lastReadFragment;l_(o&&o.moofOffset===e);for(const[,e]of o.trackData){const t=e.track,{fragmentPositionCache:n}=t;if(!e.startTimestampIsFinal){const i=t.fragmentLookupTable.find((e=>e.moofOffset===o.moofOffset));if(i)NT(e,i.timestamp);else{const t=T_(n,o.moofOffset-1,(e=>e.moofOffset));if(-1!==t){const i=n[t];NT(e,i.endTimestamp)}}e.startTimestampIsFinal=!0}const i=T_(n,e.startTimestamp,(e=>e.startTimestamp));-1!==i&&n[i].moofOffset===o.moofOffset||n.splice(i+1,0,{moofOffset:o.moofOffset,startTimestamp:e.startTimestamp,endTimestamp:e.endTimestamp})}return o}readContiguousBoxes(e){const t=e.filePos;for(;e.filePos-t<=e.length-8&&this.traverseBox(e););}*iterateContiguousBoxes(e){const t=e.filePos;for(;e.filePos-t<=e.length-8;){const t=e.filePos,n=mT(e);if(!n)break;yield{boxInfo:n,slice:e},e.filePos=t+n.totalSize}}traverseBox(e){var t,n,i,r,o,s,a,l,c,u,d,h,f,p,m,v,g,y,b,k,w,x,_,T,E,I,S,A,N,M,F,C,O,P,R,D;const L=e.filePos,B=mT(e);if(!B)return!1;const z=e.filePos,W=L+B.totalSize;switch(B.name){case"mdia":case"minf":case"dinf":case"mfra":case"edts":case"wave":this.readContiguousBoxes(e.slice(z,B.contentSize));break;case"mvhd":{const t=UT(e);e.skip(3),1===t?(e.skip(16),this.movieTimescale=HT(e),this.movieDurationInTimescale=XT(e)):(e.skip(8),this.movieTimescale=HT(e),this.movieDurationInTimescale=HT(e))}break;case"trak":{const t={id:-1,demuxer:this,inputTrack:null,disposition:{...R_},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=t,this.readContiguousBoxes(e.slice(z,B.contentSize)),-1!==t.id&&-1!==t.timescale&&null!==t.info)if("video"===t.info.type&&-1!==t.info.width){const e=t;t.inputTrack=new fT(this.input,new _T(e)),this.tracks.push(t)}else if("audio"===t.info.type&&-1!==t.info.numberOfChannels){const e=t;t.inputTrack=new pT(this.input,new TT(e)),this.tracks.push(t)}this.currentTrack=null}break;case"tkhd":{const t=this.currentTrack;if(!t)break;const n=UT(e),i=!!(1&VT(e));if(t.disposition.default=i,0===n)e.skip(8),t.id=HT(e),e.skip(4),t.durationInMovieTimescale=HT(e);else{if(1!==n)throw new Error(`Incorrect track header version ${n}.`);e.skip(16),t.id=HT(e),e.skip(4),t.durationInMovieTimescale=XT(e)}e.skip(16);const r=[vT(e),vT(e),gT(e),vT(e),vT(e),gT(e),vT(e),vT(e),gT(e)],o=(e=>{const t=(e%360+360)%360;if(0===t||90===t||180===t||270===t)return t;throw new Error(`Invalid rotation ${e}.`)})((Ce=MT(r),90*Math.round(Ce/90)));l_(0===o||90===o||180===o||270===o),t.rotation=o}break;case"elst":{const t=this.currentTrack;if(!t)break;const n=UT(e);e.skip(3);let i=!1,r=0;const o=HT(e);for(let s=0;s<o;s++){const o=1===n?XT(e):HT(e),s=1===n?YT(e):KT(e),a=vT(e);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}t.editListPreviousSegmentDurations=r,t.editListOffset=s,i=!0}else r+=o}}}break;case"mdhd":{const t=this.currentTrack;if(!t)break;const n=UT(e);e.skip(3),0===n?(e.skip(8),t.timescale=HT(e),t.durationInMediaTimescale=HT(e)):1===n&&(e.skip(16),t.timescale=HT(e),t.durationInMediaTimescale=XT(e));let i=qT(e);if(i>0){t.languageCode="";for(let e=0;e<3;e++)t.languageCode=String.fromCharCode(96+(31&i))+t.languageCode,i>>=5;Fe=t.languageCode,A_.test(Fe)||(t.languageCode="und")}}break;case"hdlr":{const t=this.currentTrack;if(!t)break;e.skip(8);const n=JT(e,4);"vide"===n?t.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&&(t.info={type:"audio",numberOfChannels:-1,sampleRate:-1,codec:null,codecDescription:null,aacCodecInfo:null})}break;case"stbl":{const t=this.currentTrack;if(!t)break;t.sampleTableByteOffset=L,this.readContiguousBoxes(e.slice(z,B.contentSize))}break;case"stsd":{const t=this.currentTrack;if(!t)break;if(null===t.info||t.sampleTable)break;const n=UT(e);e.skip(3);const i=HT(e);for(let r=0;r<i;r++){const i=e.filePos,r=mT(e);if(!r)break;t.internalCodecId=r.name;const o=r.name.toLowerCase();if("video"===t.info.type)"avc1"===o||"avc3"===o?(t.info.codec="avc",t.info.avcType="avc1"===o?1:3):"hvc1"===o||"hev1"===o?t.info.codec="hevc":"vp08"===o?t.info.codec="vp8":"vp09"===o?t.info.codec="vp9":"av01"===o?t.info.codec="av1":console.warn(`Unsupported video codec (sample entry type '${r.name}').`),e.skip(24),t.info.width=qT(e),t.info.height=qT(e),t.info.squarePixelWidth=t.info.width,t.info.squarePixelHeight=t.info.height,e.skip(50),this.readContiguousBoxes(e.slice(e.filePos,i+r.totalSize-e.filePos));else{"mp4a"===o||("opus"===o?t.info.codec="opus":"flac"===o?t.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?t.info.codec="ulaw":"alaw"===o?t.info.codec="alaw":"ac-3"===o?t.info.codec="ac3":"ec-3"===o?t.info.codec="eac3":console.warn(`Unsupported audio codec (sample entry type '${r.name}').`))),e.skip(8);const s=qT(e);e.skip(6);let a=qT(e),l=qT(e);e.skip(4);let c=HT(e)/65536;if(0===n&&s>0)if(1===s)e.skip(4),l=8*HT(e),e.skip(8);else if(2===s){e.skip(4),c=QT(e),a=HT(e),e.skip(4),l=HT(e);const n=HT(e);if(e.skip(8),"lpcm"===o){const e=l+7>>3,i=Boolean(1&n),r=Boolean(2&n),o=4&n?-1:0;l>0&&l<=64&&(i?32===l&&(t.info.codec=r?"pcm-f32be":"pcm-f32"):o&1<<e-1?1===e?t.info.codec="pcm-s8":2===e?t.info.codec=r?"pcm-s16be":"pcm-s16":3===e?t.info.codec=r?"pcm-s24be":"pcm-s24":4===e&&(t.info.codec=r?"pcm-s32be":"pcm-s32"):1===e&&(t.info.codec="pcm-u8")),null===t.info.codec&&console.warn("Unsupported PCM format.")}}"opus"===t.info.codec&&(c=48e3),t.info.numberOfChannels=a,t.info.sampleRate=c,"twos"===o?8===l?t.info.codec="pcm-s8":16===l?t.info.codec="pcm-s16be":(console.warn(`Unsupported sample size ${l} for codec 'twos'.`),t.info.codec=null):"sowt"===o?8===l?t.info.codec="pcm-s8":16===l?t.info.codec="pcm-s16":(console.warn(`Unsupported sample size ${l} for codec 'sowt'.`),t.info.codec=null):"raw "===o?t.info.codec="pcm-u8":"in24"===o?t.info.codec="pcm-s24be":"in32"===o?t.info.codec="pcm-s32be":"fl32"===o?t.info.codec="pcm-f32be":"fl64"===o?t.info.codec="pcm-f64be":"ipcm"===o?t.info.codec="pcm-s16be":"fpcm"===o&&(t.info.codec="pcm-f32be"),this.readContiguousBoxes(e.slice(e.filePos,i+r.totalSize-e.filePos))}}}break;case"avcC":{const t=this.currentTrack;if(!t)break;l_(t.info),t.info.codecDescription=jT(e,B.contentSize)}break;case"hvcC":{const t=this.currentTrack;if(!t)break;l_(t.info),t.info.codecDescription=jT(e,B.contentSize)}break;case"vpcC":{var $;const t=this.currentTrack;if(!t)break;l_("video"===(null===($=t.info)||void 0===$?void 0:$.type)),e.skip(4);const n=UT(e),i=UT(e),r=UT(e),o=r>>4,s=r>>1&7,a=1&r,l=UT(e),c=UT(e),u=UT(e);t.info.vp9CodecInfo={profile:n,level:i,bitDepth:o,chromaSubsampling:s,videoFullRangeFlag:a,colourPrimaries:l,transferCharacteristics:c,matrixCoefficients:u}}break;case"av1C":{var j;const t=this.currentTrack;if(!t)break;l_("video"===(null===(j=t.info)||void 0===j?void 0:j.type)),e.skip(1);const n=UT(e),i=n>>5,r=31&n,o=UT(e),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;t.info.av1CodecInfo={profile:i,level:r,tier:s,bitDepth:h,monochrome:l,chromaSubsamplingX:c,chromaSubsamplingY:u,chromaSamplePosition:d}}break;case"colr":{var U;const t=this.currentTrack;if(!t)break;if(l_("video"===(null===(U=t.info)||void 0===U?void 0:U.type)),"nclx"!==JT(e,4))break;const n=qT(e),i=qT(e),r=qT(e),o=Boolean(128&UT(e));t.info.colorSpace={primaries:v_[n],transfer:y_[i],matrix:k_[r],fullRange:o}}break;case"pasp":{var q;const t=this.currentTrack;if(!t)break;l_("video"===(null===(q=t.info)||void 0===q?void 0:q.type));const n=HT(e),i=HT(e);n>i?t.info.squarePixelWidth=Math.round(t.info.width*n/i):t.info.squarePixelHeight=Math.round(t.info.height*i/n)}break;case"esds":{var V;const t=this.currentTrack;if(!t)break;l_("audio"===(null===(V=t.info)||void 0===V?void 0:V.type)),e.skip(4),l_(3===UT(e)),yT(e),e.skip(2);const n=UT(e),i=!!(64&n),r=!!(32&n);if(!!(128&n)&&e.skip(2),i){const t=UT(e);e.skip(t)}r&&e.skip(2),l_(4===UT(e));const o=yT(e),s=e.filePos,a=UT(e);if(64===a||103===a?(t.info.codec="aac",t.info.aacCodecInfo={isMpeg2:103===a,objectType:null}):105===a||107===a?t.info.codec="mp3":221===a?t.info.codec="vorbis":console.warn(`Unsupported audio codec (objectTypeIndication ${a}) - discarding track.`),e.skip(12),o>e.filePos-s){l_(5===UT(e));const n=yT(e);if(t.info.codecDescription=jT(e,n),"aac"===t.info.codec){const e=z_(t.info.codecDescription);null!==e.numberOfChannels&&(t.info.numberOfChannels=e.numberOfChannels),null!==e.sampleRate&&(t.info.sampleRate=e.sampleRate)}}}break;case"enda":{var G;const t=this.currentTrack;if(!t)break;l_("audio"===(null===(G=t.info)||void 0===G?void 0:G.type)),255&qT(e)&&("pcm-s16be"===t.info.codec?t.info.codec="pcm-s16":"pcm-s24be"===t.info.codec?t.info.codec="pcm-s24":"pcm-s32be"===t.info.codec?t.info.codec="pcm-s32":"pcm-f32be"===t.info.codec?t.info.codec="pcm-f32":"pcm-f64be"===t.info.codec&&(t.info.codec="pcm-f64"))}break;case"pcmC":{var H;const t=this.currentTrack;if(!t)break;l_("audio"===(null===(H=t.info)||void 0===H?void 0:H.type)),e.skip(4);const n=UT(e),i=Boolean(1&n),r=UT(e);"pcm-s16be"===t.info.codec?i?16===r?t.info.codec="pcm-s16":24===r?t.info.codec="pcm-s24":32===r?t.info.codec="pcm-s32":(console.warn(`Invalid ipcm sample size ${r}.`),t.info.codec=null):16===r?t.info.codec="pcm-s16be":24===r?t.info.codec="pcm-s24be":32===r?t.info.codec="pcm-s32be":(console.warn(`Invalid ipcm sample size ${r}.`),t.info.codec=null):"pcm-f32be"===t.info.codec&&(i?32===r?t.info.codec="pcm-f32":64===r?t.info.codec="pcm-f64":(console.warn(`Invalid fpcm sample size ${r}.`),t.info.codec=null):32===r?t.info.codec="pcm-f32be":64===r?t.info.codec="pcm-f64be":(console.warn(`Invalid fpcm sample size ${r}.`),t.info.codec=null));break}case"dOps":{var K;const t=this.currentTrack;if(!t)break;l_("audio"===(null===(K=t.info)||void 0===K?void 0:K.type)),e.skip(1);const n=UT(e),i=qT(e),r=HT(e),o=GT(e),s=UT(e);let a;a=0!==s?jT(e,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),t.info.codecDescription=l,t.info.numberOfChannels=n}break;case"dfLa":{var X;const t=this.currentTrack;if(!t)break;l_("audio"===(null===(X=t.info)||void 0===X?void 0:X.type)),e.skip(4);const n=127,i=128,r=e.filePos;for(;e.filePos<W;){const r=UT(e),o=VT(e);if((r&n)===tT.STREAMINFO){e.skip(10);const n=HT(e),i=n>>>12,r=1+(n>>9&7);t.info.sampleRate=i,t.info.numberOfChannels=r,e.skip(20)}else e.skip(o);if(r&i)break}const o=e.filePos;e.filePos=r;const s=jT(e,o-r),a=new Uint8Array(4+s.byteLength);new DataView(a.buffer).setUint32(0,1716281667,!1),a.set(s,4),t.info.codecDescription=a}break;case"dac3":{var Y;const t=this.currentTrack;if(!t)break;l_("audio"===(null===(Y=t.info)||void 0===Y?void 0:Y.type));const n=jT(e,3),i=new D_(n),r=i.readBits(2);i.skipBits(8);const o=i.readBits(3),s=i.readBits(1);r<3&&(t.info.sampleRate=V_[r]),t.info.numberOfChannels=nT[o]+s}break;case"dec3":{var Q;const t=this.currentTrack;if(!t)break;l_("audio"===(null===(Q=t.info)||void 0===Q?void 0:Q.type));const n=(e=>{if(e.length<2)return null;const t=new D_(e),n=t.readBits(13),i=t.readBits(3),r=[];for(let n=0;n<=i&&!(Math.ceil(t.pos/8)+3>e.length);n++){const e=t.readBits(2),n=t.readBits(5);t.skipBits(1),t.skipBits(1);const i=t.readBits(3),o=t.readBits(3),s=t.readBits(1);t.skipBits(3);const a=t.readBits(4);let l=0;a>0?l=t.readBits(9):t.skipBits(1),r.push({fscod:e,fscod2:null,bsid:n,bsmod:i,acmod:o,lfeon:s,numDepSub:a,chanLoc:l})}return 0===r.length?null:{dataRate:n,substreams:r}})(jT(e,B.contentSize));if(!n){console.warn("Invalid dec3 box contents, ignoring.");break}const i=(e=>{const t=e.substreams[0];return l_(t),t.fscod<3?V_[t.fscod]:null!==t.fscod2&&t.fscod2<3?G_[t.fscod2]:null})(n);null!==i&&(t.info.sampleRate=i),t.info.numberOfChannels=(e=>{const t=e.substreams[0];l_(t);let n=nT[t.acmod]+t.lfeon;if(t.numDepSub>0){const e=[2,2,1,1,2,2,2,1,1];for(let i=0;i<9;i++)t.chanLoc&1<<8-i&&(n+=e[i])}return n})(n)}break;case"stts":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4);const n=HT(e);let i=0,r=0;for(let o=0;o<n;o++){const n=HT(e),o=HT(e);t.sampleTable.sampleTimingEntries.push({startIndex:i,startDecodeTimestamp:r,count:n,delta:o}),i+=n,r+=n*o}}break;case"ctts":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4);const n=HT(e);let i=0;for(let r=0;r<n;r++){const n=HT(e),r=KT(e);t.sampleTable.sampleCompositionTimeOffsets.push({startIndex:i,count:n,offset:r}),i+=n}}break;case"stsz":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4);const n=HT(e),i=HT(e);if(0===n)for(let n=0;n<i;n++){const n=HT(e);t.sampleTable.sampleSizes.push(n)}else t.sampleTable.sampleSizes.push(n)}break;case"stz2":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4),e.skip(3);const n=UT(e),i=HT(e),r=jT(e,Math.ceil(i*n/8)),o=new D_(r);for(let e=0;e<i;e++){const e=o.readBits(n);t.sampleTable.sampleSizes.push(e)}}break;case"stss":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4),t.sampleTable.keySampleIndices=[];const n=HT(e);for(let i=0;i<n;i++){const n=HT(e)-1;t.sampleTable.keySampleIndices.push(n)}0!==t.sampleTable.keySampleIndices[0]&&t.sampleTable.keySampleIndices.unshift(0)}break;case"stsc":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4);const n=HT(e);for(let i=0;i<n;i++){const n=HT(e)-1,i=HT(e),r=HT(e);t.sampleTable.sampleToChunk.push({startSampleIndex:-1,startChunkIndex:n,samplesPerChunk:i,sampleDescriptionIndex:r})}let i=0;for(let e=0;e<t.sampleTable.sampleToChunk.length;e++)t.sampleTable.sampleToChunk[e].startSampleIndex=i,e<t.sampleTable.sampleToChunk.length-1&&(i+=(t.sampleTable.sampleToChunk[e+1].startChunkIndex-t.sampleTable.sampleToChunk[e].startChunkIndex)*t.sampleTable.sampleToChunk[e].samplesPerChunk)}break;case"stco":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4);const n=HT(e);for(let i=0;i<n;i++){const n=HT(e);t.sampleTable.chunkOffsets.push(n)}}break;case"co64":{const t=this.currentTrack;if(!t)break;if(!t.sampleTable)break;e.skip(4);const n=HT(e);for(let i=0;i<n;i++){const n=XT(e);t.sampleTable.chunkOffsets.push(n)}}break;case"mvex":this.isFragmented=!0,this.readContiguousBoxes(e.slice(z,B.contentSize));break;case"mehd":{const t=UT(e);e.skip(3);const n=1===t?XT(e):HT(e);this.movieDurationInTimescale=n}break;case"trex":{e.skip(4);const t=HT(e),n=HT(e),i=HT(e),r=HT(e),o=HT(e);this.fragmentTrackDefaults.push({trackId:t,defaultSampleDescriptionIndex:n,defaultSampleDuration:i,defaultSampleSize:r,defaultSampleFlags:o})}break;case"tfra":{const t=UT(e);e.skip(3);const n=HT(e),i=this.tracks.find((e=>e.id===n));if(!i)break;const r=HT(e),o=(12&r)>>2,s=3&r,a=[UT,qT,VT,HT],l=a[(48&r)>>4],c=a[o],u=a[s],d=HT(e);for(let n=0;n<d;n++){const n=1===t?XT(e):HT(e),r=1===t?XT(e):HT(e);l(e),c(e),u(e),i.fragmentLookupTable.push({timestamp:n,moofOffset:r})}i.fragmentLookupTable.sort(((e,t)=>e.timestamp-t.timestamp));for(let e=0;e<i.fragmentLookupTable.length-1;e++){const t=i.fragmentLookupTable[e],n=i.fragmentLookupTable[e+1];t.timestamp===n.timestamp&&(i.fragmentLookupTable.splice(e+1,1),e--)}}break;case"moof":this.currentFragment={moofOffset:L,moofSize:B.totalSize,implicitBaseDataOffset:L,trackData:new Map},this.readContiguousBoxes(e.slice(z,B.contentSize)),this.lastReadFragment=this.currentFragment,this.currentFragment=null;break;case"traf":if(l_(this.currentFragment),this.readContiguousBoxes(e.slice(z,B.contentSize)),this.currentTrack){const e=this.currentFragment.trackData.get(this.currentTrack.id);if(e){const{currentFragmentState:t}=this.currentTrack;l_(t),null!==t.startTimestamp&&(NT(e,t.startTimestamp),e.startTimestampIsFinal=!0)}this.currentTrack.currentFragmentState=null,this.currentTrack=null}break;case"tfhd":{var J,Z,ee,te;l_(this.currentFragment),e.skip(1);const t=VT(e),n=Boolean(1&t),i=Boolean(2&t),r=Boolean(8&t),o=Boolean(16&t),s=Boolean(32&t),a=Boolean(65536&t),l=Boolean(131072&t),c=HT(e),u=this.tracks.find((e=>e.id===c));if(!u)break;const d=this.fragmentTrackDefaults.find((e=>e.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!==(ee=null==d?void 0:d.defaultSampleSize)&&void 0!==ee?ee:null,defaultSampleFlags:null!==(te=null==d?void 0:d.defaultSampleFlags)&&void 0!==te?te:null,startTimestamp:null},n?u.currentFragmentState.baseDataOffset=XT(e):l&&(u.currentFragmentState.baseDataOffset=this.currentFragment.moofOffset),i&&(u.currentFragmentState.sampleDescriptionIndex=HT(e)),r&&(u.currentFragmentState.defaultSampleDuration=HT(e)),o&&(u.currentFragmentState.defaultSampleSize=HT(e)),s&&(u.currentFragmentState.defaultSampleFlags=HT(e)),a&&(u.currentFragmentState.defaultSampleDuration=0)}break;case"tfdt":{const t=this.currentTrack;if(!t)break;l_(t.currentFragmentState);const n=UT(e);e.skip(3);const i=0===n?HT(e):XT(e);t.currentFragmentState.startTimestamp=i}break;case"trun":{const t=this.currentTrack;if(!t)break;if(l_(this.currentFragment),l_(t.currentFragmentState),this.currentFragment.trackData.has(t.id)){console.warn("Can't have two trun boxes for the same track in one fragment. Ignoring...");break}const n=UT(e),i=VT(e),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=HT(e);let d=t.currentFragmentState.baseDataOffset;r&&(d+=KT(e));let h=null;o&&(h=HT(e));let f=d;if(0===u){this.currentFragment.implicitBaseDataOffset=f;break}let p=0;const m={track:t,startTimestamp:0,endTimestamp:0,firstKeyFrameTimestamp:null,samples:[],presentationTimestamps:[],startTimestampIsFinal:!1};this.currentFragment.trackData.set(t.id,m);for(let i=0;i<u;i++){let r,o,u;s?r=HT(e):(l_(null!==t.currentFragmentState.defaultSampleDuration),r=t.currentFragmentState.defaultSampleDuration),a?o=HT(e):(l_(null!==t.currentFragmentState.defaultSampleSize),o=t.currentFragmentState.defaultSampleSize),l?u=HT(e):(l_(null!==t.currentFragmentState.defaultSampleFlags),u=t.currentFragmentState.defaultSampleFlags),0===i&&null!==h&&(u=h);let d=0;c&&(d=0===n?HT(e):KT(e));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(((e,t)=>({presentationTimestamp:e.presentationTimestamp,sampleIndex:t}))).sort(((e,t)=>e.presentationTimestamp-t.presentationTimestamp));for(let e=0;e<m.presentationTimestamps.length;e++){const t=m.presentationTimestamps[e],n=m.samples[t.sampleIndex];if(null===m.firstKeyFrameTimestamp&&n.isKeyFrame&&(m.firstKeyFrameTimestamp=n.presentationTimestamp),e<m.presentationTimestamps.length-1){const i=m.presentationTimestamps[e+1];n.duration=i.presentationTimestamp-t.presentationTimestamp}}const v=m.samples[m.presentationTimestamps[0].sampleIndex],g=m.samples[c_(m.presentationTimestamps).sampleIndex];m.startTimestamp=v.presentationTimestamp,m.endTimestamp=g.presentationTimestamp+g.duration,this.currentFragment.implicitBaseDataOffset=f}break;case"udta":{const g=this.iterateContiguousBoxes(e.slice(z,B.contentSize));for(const{boxInfo:e,slice:y}of g){if("meta"!==e.name&&!this.currentTrack){var ne,ie,re,oe,se,ae,le,ce;const t=y.filePos;null!==(ie=(ne=this.metadataTags).raw)&&void 0!==ie||(ne.raw={}),"©"===e.name[0]?null!==(se=(re=this.metadataTags.raw)[oe=e.name])&&void 0!==se||(re[oe]=bT(y)):null!==(ce=(ae=this.metadataTags.raw)[le=e.name])&&void 0!==ce||(ae[le]=jT(y,e.contentSize)),y.filePos=t}switch(e.name){case"meta":y.skip(-e.headerSize),this.traverseBox(y);break;case"©nam":case"name":this.currentTrack?this.currentTrack.name=f_.decode(jT(y,e.contentSize)):null!==(n=(t=this.metadataTags).title)&&void 0!==n||(t.title=bT(y));break;case"©des":this.currentTrack||null!==(r=(i=this.metadataTags).description)&&void 0!==r||(i.description=bT(y));break;case"©ART":this.currentTrack||null!==(s=(o=this.metadataTags).artist)&&void 0!==s||(o.artist=bT(y));break;case"©alb":this.currentTrack||null!==(l=(a=this.metadataTags).album)&&void 0!==l||(a.album=bT(y));break;case"albr":this.currentTrack||null!==(u=(c=this.metadataTags).albumArtist)&&void 0!==u||(c.albumArtist=bT(y));break;case"©gen":this.currentTrack||null!==(h=(d=this.metadataTags).genre)&&void 0!==h||(d.genre=bT(y));break;case"©day":if(!this.currentTrack){var ue,de;const e=new Date(bT(y));Number.isNaN(e.getTime())||null!==(de=(ue=this.metadataTags).date)&&void 0!==de||(ue.date=e)}break;case"©cmt":this.currentTrack||null!==(p=(f=this.metadataTags).comment)&&void 0!==p||(f.comment=bT(y));break;case"©lyr":this.currentTrack||null!==(v=(m=this.metadataTags).lyrics)&&void 0!==v||(m.lyrics=bT(y))}}}break;case"meta":{if(this.currentTrack)break;const t=0!==HT(e);this.currentMetadataKeys=new Map,t?this.readContiguousBoxes(e.slice(z,B.contentSize)):this.readContiguousBoxes(e.slice(z+4,B.contentSize-4)),this.currentMetadataKeys=null}break;case"keys":{if(!this.currentMetadataKeys)break;e.skip(4);const t=HT(e);for(let n=0;n<t;n++){const t=HT(e);e.skip(4);const i=f_.decode(jT(e,t-8));this.currentMetadataKeys.set(n+1,i)}}break;case"ilst":{if(!this.currentMetadataKeys)break;const t=this.iterateContiguousBoxes(e.slice(z,B.contentSize));for(const{boxInfo:e,slice:n}of t){var he,fe,pe,me,ve;let t=e.name;const i=(t.charCodeAt(0)<<24)+(t.charCodeAt(1)<<16)+(t.charCodeAt(2)<<8)+t.charCodeAt(3);this.currentMetadataKeys.has(i)&&(t=this.currentMetadataKeys.get(i));const r=kT(n);switch(null!==(fe=(he=this.metadataTags).raw)&&void 0!==fe||(he.raw={}),null!==(ve=(pe=this.metadataTags.raw)[me=t])&&void 0!==ve||(pe[me]=r),t){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!==(x=(w=this.metadataTags).artist)&&void 0!==x||(w.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!==(I=(E=this.metadataTags).albumArtist)&&void 0!==I||(E.albumArtist=r));break;case"©cmt":case"com.apple.quicktime.comment":case"comment":"string"==typeof r&&(null!==(A=(S=this.metadataTags).comment)&&void 0!==A||(S.comment=r));break;case"©gen":case"gnre":case"com.apple.quicktime.genre":case"genre":"string"==typeof r&&(null!==(M=(N=this.metadataTags).genre)&&void 0!==M||(N.genre=r));break;case"©lyr":case"lyrics":"string"==typeof r&&(null!==(C=(F=this.metadataTags).lyrics)&&void 0!==C||(F.lyrics=r));break;case"©day":case"rldt":case"com.apple.quicktime.creationdate":case"date":if("string"==typeof r){var ge,ye;const e=new Date(r);Number.isNaN(e.getTime())||null!==(ye=(ge=this.metadataTags).date)&&void 0!==ye||(ge.date=e)}break;case"covr":case"com.apple.quicktime.artwork":r instanceof P_?(null!==(P=(O=this.metadataTags).images)&&void 0!==P||(O.images=[]),this.metadataTags.images.push({data:r.data,kind:"coverFront",mimeType:r.mimeType})):r instanceof Uint8Array&&(null!==(D=(R=this.metadataTags).images)&&void 0!==D||(R.images=[]),this.metadataTags.images.push({data:r,kind:"coverFront",mimeType:"image/*"}));break;case"track":if("string"==typeof r){var be,ke,we,xe;const e=r.split("/"),t=Number.parseInt(e[0],10),n=e[1]&&Number.parseInt(e[1],10);Number.isInteger(t)&&t>0&&(null!==(ke=(be=this.metadataTags).trackNumber)&&void 0!==ke||(be.trackNumber=t)),n&&Number.isInteger(n)&&n>0&&(null!==(xe=(we=this.metadataTags).tracksTotal)&&void 0!==xe||(we.tracksTotal=n))}break;case"trkn":if(r instanceof Uint8Array&&r.length>=6){var _e,Te,Ee,Ie;const e=h_(r),t=e.getUint16(2,!1),n=e.getUint16(4,!1);t>0&&(null!==(Te=(_e=this.metadataTags).trackNumber)&&void 0!==Te||(_e.trackNumber=t)),n>0&&(null!==(Ie=(Ee=this.metadataTags).tracksTotal)&&void 0!==Ie||(Ee.tracksTotal=n))}break;case"disc":case"disk":if(r instanceof Uint8Array&&r.length>=6){var Se,Ae,Ne,Me;const e=h_(r),t=e.getUint16(2,!1),n=e.getUint16(4,!1);t>0&&(null!==(Ae=(Se=this.metadataTags).discNumber)&&void 0!==Ae||(Se.discNumber=t)),n>0&&(null!==(Me=(Ne=this.metadataTags).discsTotal)&&void 0!==Me||(Ne.discsTotal=n))}}}}}var Fe,Ce;return e.filePos=W,!0}}class xT{constructor(e){this.internalTrack=e,this.packetToSampleIndex=new WeakMap,this.packetToFragmentLocation=new WeakMap}getId(){return this.internalTrack.id}getNumber(){const e=this.internalTrack.demuxer,t=this.internalTrack.inputTrack.type;let n=0;for(const i of e.tracks)if(i.inputTrack.type===t&&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 e,t;const n=await this.getPacket(1/0,{metadataOnly:!0});return(null!==(e=null==n?void 0:n.timestamp)&&void 0!==e?e:0)+(null!==(t=null==n?void 0:n.duration)&&void 0!==t?t:0)}async getFirstTimestamp(){var e;const t=await this.getFirstPacket({metadataOnly:!0});return null!==(e=null==t?void 0:t.timestamp)&&void 0!==e?e:0}async getFirstPacket(e){const t=await this.fetchPacketForSampleIndex(0,e);return t||!this.internalTrack.demuxer.isFragmented?t:this.performFragmentedLookup(null,(e=>e.trackData.get(this.internalTrack.id)?{sampleIndex:0,correctSampleFound:!0}:{sampleIndex:-1,correctSampleFound:!1}),-1/0,1/0,e)}mapTimestampIntoTimescale(e){return(e=>{const t=Math.round(e);return Math.abs(e/t-1)<10*Number.EPSILON?t:e})(e*this.internalTrack.timescale)+this.internalTrack.editListOffset}async getPacket(e,t){const n=this.mapTimestampIntoTimescale(e),i=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),r=ET(i,n),o=await this.fetchPacketForSampleIndex(r,t);return FT(i)&&this.internalTrack.demuxer.isFragmented?this.performFragmentedLookup(null,(e=>{const t=e.trackData.get(this.internalTrack.id);if(!t)return{sampleIndex:-1,correctSampleFound:!1};const i=T_(t.presentationTimestamps,n,(e=>e.presentationTimestamp));return{sampleIndex:-1!==i?t.presentationTimestamps[i].sampleIndex:-1,correctSampleFound:-1!==i&&n<t.endTimestamp}}),n,n,t):o}async getNextPacket(e,t){const n=this.packetToSampleIndex.get(e);if(void 0!==n)return this.fetchPacketForSampleIndex(n+1,t);const i=this.packetToFragmentLocation.get(e);if(void 0===i)throw new Error("Packet was not created from this track.");return this.performFragmentedLookup(i.fragment,(e=>{if(e===i.fragment){const t=e.trackData.get(this.internalTrack.id);if(i.sampleIndex+1<t.samples.length)return{sampleIndex:i.sampleIndex+1,correctSampleFound:!0}}else if(e.trackData.get(this.internalTrack.id))return{sampleIndex:0,correctSampleFound:!0};return{sampleIndex:-1,correctSampleFound:!1}}),-1/0,1/0,t)}async getKeyPacket(e,t){const n=this.mapTimestampIntoTimescale(e),i=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),r=IT(i,n),o=await this.fetchPacketForSampleIndex(r,t);return FT(i)&&this.internalTrack.demuxer.isFragmented?this.performFragmentedLookup(null,(e=>{const t=e.trackData.get(this.internalTrack.id);if(!t)return{sampleIndex:-1,correctSampleFound:!1};const i=((e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1})(t.presentationTimestamps,(e=>t.samples[e.sampleIndex].isKeyFrame&&e.presentationTimestamp<=n));return{sampleIndex:-1!==i?t.presentationTimestamps[i].sampleIndex:-1,correctSampleFound:-1!==i&&n<t.endTimestamp}}),n,n,t):o}async getNextKeyPacket(e,t){const n=this.packetToSampleIndex.get(e);if(void 0!==n){const e=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),i=AT(e,n);return this.fetchPacketForSampleIndex(i,t)}const i=this.packetToFragmentLocation.get(e);if(void 0===i)throw new Error("Packet was not created from this track.");return this.performFragmentedLookup(i.fragment,(e=>{if(e===i.fragment){const t=e.trackData.get(this.internalTrack.id).samples.findIndex(((e,t)=>e.isKeyFrame&&t>i.sampleIndex));if(-1!==t)return{sampleIndex:t,correctSampleFound:!0}}else{const t=e.trackData.get(this.internalTrack.id);if(t&&null!==t.firstKeyFrameTimestamp){const e=t.samples.findIndex((e=>e.isKeyFrame));return l_(-1!==e),{sampleIndex:e,correctSampleFound:!0}}}return{sampleIndex:-1,correctSampleFound:!1}}),-1/0,1/0,t)}async fetchPacketForSampleIndex(e,t){if(-1===e)return null;const n=this.internalTrack.demuxer.getSampleTableForTrack(this.internalTrack),i=ST(n,e);if(!i)return null;let r;if(t.metadataOnly)r=sT;else{let e=this.internalTrack.demuxer.reader.requestSlice(i.sampleOffset,i.sampleSize);e instanceof Promise&&(e=await e),l_(e),r=jT(e,i.sampleSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new aT(r,i.isKeyFrame?"key":"delta",o,s,e,i.sampleSize);return this.packetToSampleIndex.set(a,e),a}async fetchPacketInFragment(e,t,n){if(-1===t)return null;const i=e.trackData.get(this.internalTrack.id).samples[t];let r;if(l_(i),n.metadataOnly)r=sT;else{let e=this.internalTrack.demuxer.reader.requestSlice(i.byteOffset,i.byteSize);e instanceof Promise&&(e=await e),l_(e),r=jT(e,i.byteSize)}const o=(i.presentationTimestamp-this.internalTrack.editListOffset)/this.internalTrack.timescale,s=i.duration/this.internalTrack.timescale,a=new aT(r,i.isKeyFrame?"key":"delta",o,s,e.moofOffset+t,i.byteSize);return this.packetToFragmentLocation.set(a,{fragment:e,sampleIndex:t}),a}async performFragmentedLookup(e,t,n,i,r){var o,s;const a=this.internalTrack.demuxer;let l=null,c=null,u=-1;if(e){const{sampleIndex:n,correctSampleFound:i}=t(e);if(i)return this.fetchPacketInFragment(e,n,r);-1!==n&&(c=e,u=n)}const d=T_(this.internalTrack.fragmentLookupTable,n,(e=>e.timestamp)),h=-1!==d?this.internalTrack.fragmentLookupTable[d]:null,f=T_(this.internalTrack.fragmentPositionCache,n,(e=>e.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(e?null===m||e.moofOffset>=m?(v=e.moofOffset+e.moofSize,l=e):v=m:v=null!=m?m:0;;){if(l){const e=l.trackData.get(this.internalTrack.id);if(e&&e.startTimestamp>i)break}let e=a.reader.requestSliceRange(v,8,16);if(e instanceof Promise&&(e=await e),!e)break;const n=v,o=mT(e);if(!o)break;if("moof"===o.name){l=await a.readFragment(n);const{sampleIndex:e,correctSampleFound:i}=t(l);if(i)return this.fetchPacketInFragment(l,e,r);-1!==e&&(c=l,u=e)}v=n+o.totalSize}if(h&&(!c||c.moofOffset<h.moofOffset)){var g;const e=this.internalTrack.fragmentLookupTable[d-1];l_(!e||e.timestamp<h.timestamp);const n=null!==(g=null==e?void 0:e.timestamp)&&void 0!==g?g:-1/0;return this.performFragmentedLookup(null,t,n,i,r)}return c?this.fetchPacketInFragment(c,u,r):null}}class _T extends xT{constructor(e){super(e),this.decoderConfigPromise=null,this.internalTrack=e}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 e,t,n,i;return{primaries:null===(e=this.internalTrack.info.colorSpace)||void 0===e?void 0:e.primaries,transfer:null===(t=this.internalTrack.info.colorSpace)||void 0===t?void 0:t.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 e;return this.internalTrack.info.codec?null!==(e=this.decoderConfigPromise)&&void 0!==e?e:this.decoderConfigPromise=(async(e,t)=>{if("vp9"!==this.internalTrack.info.codec||this.internalTrack.info.vp9CodecInfo){if("av1"===this.internalTrack.info.codec&&!this.internalTrack.info.av1CodecInfo){const e=await this.getFirstPacket({});this.internalTrack.info.av1CodecInfo=e&&(e=>{for(const{type:t,data:n}of eT(e)){if(1!==t)continue;const e=new D_(n),i=e.readBits(3);e.readBits(1);const r=e.readBits(1);let o=0,s=0,a=0;if(r)o=e.readBits(5);else{if(e.readBits(1)&&(e.skipBits(32),e.skipBits(32),e.readBits(1)))return null;const t=e.readBits(1);t&&(a=e.readBits(5),e.skipBits(32),e.skipBits(5),e.skipBits(5));const n=e.readBits(5);for(let i=0;i<=n;i++){e.skipBits(12);const n=e.readBits(5);if(0===i&&(o=n),n>7){const t=e.readBits(1);0===i&&(s=t)}if(t&&e.readBits(1)){const t=a+1;e.skipBits(t),e.skipBits(t),e.skipBits(1)}e.readBits(1)&&e.skipBits(4)}}const l=e.readBits(4),c=e.readBits(4),u=l+1;e.skipBits(u);const d=c+1;e.skipBits(d);let h=0;if(h=r?0:e.readBits(1),h&&(e.skipBits(4),e.skipBits(3)),e.skipBits(1),e.skipBits(1),e.skipBits(1),!r){e.skipBits(1),e.skipBits(1),e.skipBits(1),e.skipBits(1);const t=e.readBits(1);t&&(e.skipBits(1),e.skipBits(1));let n=0;n=e.readBits(1)?2:e.readBits(1),n>0&&(e.readBits(1)||e.skipBits(1)),t&&e.skipBits(3)}e.skipBits(1),e.skipBits(1),e.skipBits(1);const f=e.readBits(1);let p=8;2===i&&f?p=e.readBits(1)?12:10:i<=2&&(p=f?10:8);let m=0;1!==i&&(m=e.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=e.readBits(1),v&&(g=e.readBits(1))),v&&g&&(y=e.readBits(2))),{profile:i,level:o,tier:s,bitDepth:p,monochrome:m,chromaSubsamplingX:v,chromaSubsamplingY:g,chromaSamplePosition:y}}return null})(e.data)}}else{const e=await this.getFirstPacket({});this.internalTrack.info.vp9CodecInfo=e&&(e=>{const t=new D_(e);if(2!==t.readBits(2))return null;const n=t.readBits(1),i=(t.readBits(1)<<1)+n;if(3===i&&t.skipBits(1),1===t.readBits(1))return null;if(0!==t.readBits(1))return null;if(t.skipBits(2),4817730!==t.readBits(24))return null;let r=8;i>=2&&(r=t.readBits(1)?12:10);const o=t.readBits(3);let s=0,a=0;if(7!==o)if(a=t.readBits(1),1===i||3===i){const e=t.readBits(1),n=t.readBits(1);s=e||n?e&&!n?2:1:3,t.skipBits(1)}else s=1;else s=3,a=1;const l=(t.readBits(16)+1)*(t.readBits(16)+1);let c=c_($_).level;for(const e of $_)if(l<=e.maxPictureSize){c=e.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}})(e.data)}return{codec:j_(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!==(e=this.internalTrack.info.codecDescription)&&void 0!==e?e:void 0,colorSpace:null!==(t=this.internalTrack.info.colorSpace)&&void 0!==t?t:void 0}})():null}}class TT extends xT{constructor(e){super(e),this.decoderConfig=null,this.internalTrack=e}getCodec(){return this.internalTrack.info.codec}getNumberOfChannels(){return this.internalTrack.info.numberOfChannels}getSampleRate(){return this.internalTrack.info.sampleRate}async getDecoderConfig(){var e,t;return this.internalTrack.info.codec?null!==(e=this.decoderConfig)&&void 0!==e?e:this.decoderConfig={codec:U_(this.internalTrack.info),numberOfChannels:this.internalTrack.info.numberOfChannels,sampleRate:this.internalTrack.info.sampleRate,description:null!==(t=this.internalTrack.info.codecDescription)&&void 0!==t?t:void 0}:null}}const ET=(e,t)=>{if(e.presentationTimestamps){const n=T_(e.presentationTimestamps,t,(e=>e.presentationTimestamp));return-1===n?-1:e.presentationTimestamps[n].sampleIndex}{const n=T_(e.sampleTimingEntries,t,(e=>e.startDecodeTimestamp));if(-1===n)return-1;const i=e.sampleTimingEntries[n];return i.startIndex+Math.min(Math.floor((t-i.startDecodeTimestamp)/i.delta),i.count-1)}},IT=(e,t)=>{if(!e.keySampleIndices)return ET(e,t);if(e.presentationTimestamps){const n=T_(e.presentationTimestamps,t,(e=>e.presentationTimestamp));if(-1===n)return-1;for(let t=n;t>=0;t--){const n=e.presentationTimestamps[t].sampleIndex;if(-1!==__(e.keySampleIndices,n,(e=>e)))return n}return-1}{var n;const i=ET(e,t),r=T_(e.keySampleIndices,i,(e=>e));return null!==(n=e.keySampleIndices[r])&&void 0!==n?n:-1}},ST=(e,t)=>{const n=T_(e.sampleTimingEntries,t,(e=>e.startIndex)),i=e.sampleTimingEntries[n];if(!i||i.startIndex+i.count<=t)return null;let r=i.startDecodeTimestamp+(t-i.startIndex)*i.delta;const o=T_(e.sampleCompositionTimeOffsets,t,(e=>e.startIndex)),s=e.sampleCompositionTimeOffsets[o];s&&t-s.startIndex<s.count&&(r+=s.offset);const a=e.sampleSizes[Math.min(t,e.sampleSizes.length-1)],l=T_(e.sampleToChunk,t,(e=>e.startSampleIndex)),c=e.sampleToChunk[l];l_(c);const u=c.startChunkIndex+Math.floor((t-c.startSampleIndex)/c.samplesPerChunk),d=e.chunkOffsets[u],h=c.startSampleIndex+(u-c.startChunkIndex)*c.samplesPerChunk;let f=0,p=d;if(1===e.sampleSizes.length)p+=a*(t-h),f+=a*c.samplesPerChunk;else for(let n=h;n<h+c.samplesPerChunk;n++){const i=e.sampleSizes[n];n<t&&(p+=i),f+=i}let m=i.delta;if(e.presentationTimestamps){const n=e.presentationTimestampIndexMap[t];l_(void 0!==n),n<e.presentationTimestamps.length-1&&(m=e.presentationTimestamps[n+1].presentationTimestamp-r)}return{presentationTimestamp:r,duration:m,sampleOffset:p,sampleSize:a,chunkOffset:d,chunkSize:f,isKeyFrame:!e.keySampleIndices||-1!==__(e.keySampleIndices,t,(e=>e))}},AT=(e,t)=>{var n;if(!e.keySampleIndices)return t+1;const i=T_(e.keySampleIndices,t,(e=>e));return null!==(n=e.keySampleIndices[i+1])&&void 0!==n?n:-1},NT=(e,t)=>{e.startTimestamp+=t,e.endTimestamp+=t;for(const n of e.samples)n.presentationTimestamp+=t;for(const n of e.presentationTimestamps)n.presentationTimestamp+=t},MT=e=>{const[t,,,n]=e,i=Math.hypot(t,n),r=t/i,o=n/i,s=-Math.atan2(o,r)*(180/Math.PI);return Number.isFinite(s)?s:0},FT=e=>0===e.sampleSizes.length;class CT{}class OT extends CT{async _getMajorBrand(e){let t=e._reader.requestSlice(0,12);return t instanceof Promise&&(t=await t),t?(t.skip(4),"ftyp"!==JT(t,4)?null:JT(t,4)):null}_createDemuxer(e){return new wT(e)}}const PT=new class extends OT{async _canReadInput(e){const t=await this._getMajorBrand(e);return!!t&&"qt "!==t}get name(){return"MP4"}get mimeType(){return"video/mp4"}};class RT{constructor(){this._disposed=!1,this._sizePromise=null,this.onread=null}async getSizeOrNull(){var e;if(this._disposed)throw new BT;return null!==(e=this._sizePromise)&&void 0!==e?e:this._sizePromise=Promise.resolve(this._retrieveSize())}async getSize(){if(this._disposed)throw new BT;const e=await this.getSizeOrNull();if(null===e)throw new Error("Cannot determine the size of an unsized source.");return e}}class DT extends RT{constructor(e,t={}){var n;if(!(e instanceof ReadableStream))throw new TypeError("stream must be a ReadableStream.");if(!t||"object"!=typeof t)throw new TypeError("options must be an object.");if(void 0!==t.maxCacheSize&&(!O_(t.maxCacheSize)||t.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=e,this._maxCacheSize=null!==(n=t.maxCacheSize)&&void 0!==n?n:16777216}_retrieveSize(){return this._endIndex}_read(e,t){if(null!==this._endIndex&&t>this._endIndex)return null;this._maxRequestedIndex=Math.max(this._maxRequestedIndex,t);const n=T_(this._cache,e,(e=>e.start)),i=-1!==n?this._cache[n]:null;if(i&&i.start<=e&&t<=i.end)return{bytes:i.bytes,view:i.view,offset:i.start};let r=e;const o=new Uint8Array(t-e);if(-1!==n)for(let i=n;i<this._cache.length;i++){const n=this._cache[i];if(n.start>=t)break;const s=Math.max(e,n.start);s>r&&this._throwDueToCacheMiss();const a=Math.min(t,n.end);s<a&&(o.set(n.bytes.subarray(s-n.start,a-n.start),s-e),r=a)}if(r===t)return{bytes:o,view:h_(o),offset:e};this._currentIndex>r&&this._throwDueToCacheMiss();const{promise:s,resolve:a,reject:l}=E_();return this._pendingSlices.push({start:e,end:t,bytes:o,resolve:a,reject:l}),this._targetIndex=Math.max(this._targetIndex,t),this._pulling||(this._pulling=!0,this._pull().catch((e=>{if(this._pulling=!1,!(this._pendingSlices.length>0))throw e;this._pendingSlices.forEach((t=>t.reject(e))),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!==(e=this._reader)&&void 0!==e||(this._reader=this._stream.getReader());this._currentIndex<this._targetIndex&&!this._disposed;){var e;const{done:t,value:n}=await this._reader.read();if(t){for(const e of this._pendingSlices)e.resolve(null);this._pendingSlices.length=0,this._endIndex=this._currentIndex;break}const i=this._currentIndex,r=this._currentIndex+n.byteLength;for(let e=0;e<this._pendingSlices.length;e++){const t=this._pendingSlices[e],o=Math.max(i,t.start),s=Math.min(r,t.end);o<s&&(t.bytes.set(n.subarray(o-i,s-i),o-t.start),s===t.end&&(t.resolve({bytes:t.bytes,view:h_(t.bytes),offset:t.start}),this._pendingSlices.splice(e,1),e--))}for(this._cache.push({start:i,end:r,bytes:n,view:h_(n),age:0});this._cache.length>0;){const e=this._cache[0];if(this._maxRequestedIndex-e.end<=this._maxCacheSize)break;this._cache.shift()}this._currentIndex+=n.byteLength}this._pulling=!1}_dispose(){this._pendingSlices.length=0,this._cache.length=0}}null!==(lt=Symbol.dispose)&&void 0!==lt||(Symbol.dispose=Symbol("Symbol.dispose"));class LT{get disposed(){return this._disposed}constructor(e){if(this._demuxerPromise=null,this._format=null,this._disposed=!1,!e||"object"!=typeof e)throw new TypeError("options must be an object.");if(!Array.isArray(e.formats)||e.formats.some((e=>!(e instanceof CT))))throw new TypeError("options.formats must be an array of InputFormat.");if(!(e.source instanceof RT))throw new TypeError("options.source must be a Source.");if(e.source._disposed)throw new Error("options.source must not be disposed.");this._formats=e.formats,this._source=e.source,this._reader=new zT(e.source)}_getDemuxer(){var e;return null!==(e=this._demuxerPromise)&&void 0!==e?e:this._demuxerPromise=(async()=>{this._reader.fileSize=await this._source.getSizeOrNull();for(const e of this._formats)if(await e._canReadInput(this))return this._format=e,e._createDemuxer(this);throw new Error("Input has an unsupported or unrecognizable format.")})()}get source(){return this._source}async getFormat(){return await this._getDemuxer(),l_(this._format),this._format}async computeDuration(){return(await this._getDemuxer()).computeDuration()}async getFirstTimestamp(){const e=await this.getTracks();if(0===e.length)return 0;const t=await Promise.all(e.map((e=>e.getFirstTimestamp())));return Math.min(...t)}async getTracks(){return(await this._getDemuxer()).getTracks()}async getVideoTracks(){return(await this.getTracks()).filter((e=>e.isVideoTrack()))}async getAudioTracks(){return(await this.getTracks()).filter((e=>e.isAudioTrack()))}async getPrimaryVideoTrack(){var e;return null!==(e=(await this.getTracks()).find((e=>e.isVideoTrack())))&&void 0!==e?e:null}async getPrimaryAudioTrack(){var e;return null!==(e=(await this.getTracks()).find((e=>e.isAudioTrack())))&&void 0!==e?e: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 BT extends Error{constructor(e="Input has been disposed."){super(e),this.name="InputDisposedError"}}class zT{constructor(e){this.source=e}requestSlice(e,t){if(this.source._disposed)throw new BT;if(e<0)return null;if(null!==this.fileSize&&e+t>this.fileSize)return null;const n=e+t,i=this.source._read(e,n);return i instanceof Promise?i.then((t=>t?new WT(t.bytes,t.view,t.offset,e,n):null)):i?new WT(i.bytes,i.view,i.offset,e,n):null}requestSliceRange(e,t,n){if(this.source._disposed)throw new BT;if(e<0)return null;if(null!==this.fileSize)return this.requestSlice(e,S_(this.fileSize-e,t,n));{const i=this.requestSlice(e,n),r=i=>{if(i)return i;const r=i=>(l_(null!==i),this.requestSlice(e,S_(i-e,t,n))),o=this.source._retrieveSize();return o instanceof Promise?o.then(r):r(o)};return i instanceof Promise?i.then(r):r(i)}}}class WT{constructor(e,t,n,i,r){this.bytes=e,this.view=t,this.offset=n,this.start=i,this.end=r,this.bufferPos=i-n}static tempFromBytes(e){return new WT(e,h_(e),0,0,e.length)}get length(){return this.end-this.start}get filePos(){return this.offset+this.bufferPos}set filePos(e){this.bufferPos=e-this.offset}get remainingLength(){return Math.max(this.end-this.filePos,0)}skip(e){this.bufferPos+=e}slice(e,t=this.end-e){if(e<this.start||e+t>this.end)throw new RangeError("Slicing outside of original slice.");return new WT(this.bytes,this.view,this.offset,e,e+t)}}const $T=(e,t)=>{if(e.filePos<e.start||e.filePos+t>e.end)throw new RangeError(`Tried reading [${e.filePos}, ${e.filePos+t}), but slice is [${e.start}, ${e.end}). This is likely an internal error, please report it alongside the file that caused it.`)},jT=(e,t)=>{$T(e,t);const n=e.bytes.subarray(e.bufferPos,e.bufferPos+t);return e.bufferPos+=t,n},UT=e=>($T(e,1),e.view.getUint8(e.bufferPos++)),qT=e=>{$T(e,2);const t=e.view.getUint16(e.bufferPos,!1);return e.bufferPos+=2,t},VT=e=>{$T(e,3);const t=I_(e.view,e.bufferPos);return e.bufferPos+=3,t},GT=e=>{$T(e,2);const t=e.view.getInt16(e.bufferPos,!1);return e.bufferPos+=2,t},HT=e=>{$T(e,4);const t=e.view.getUint32(e.bufferPos,!1);return e.bufferPos+=4,t},KT=e=>{$T(e,4);const t=e.view.getInt32(e.bufferPos,!1);return e.bufferPos+=4,t},XT=e=>4294967296*HT(e)+HT(e),YT=e=>4294967296*KT(e)+HT(e),QT=e=>{$T(e,8);const t=e.view.getFloat64(e.bufferPos,!1);return e.bufferPos+=8,t},JT=(e,t)=>{$T(e,t);let n="";for(let i=0;i<t;i++)n+=String.fromCharCode(e.bytes[e.bufferPos++]);return n};var ZT=new WeakMap,eE=new WeakMap,tE=new WeakMap,nE=new WeakMap,iE=new WeakMap,rE=new WeakMap,oE=new WeakMap,sE=new WeakMap,aE=new WeakMap,lE=new WeakMap,cE=new WeakMap,uE=new WeakMap,dE=new WeakMap,hE=new WeakMap,fE=new WeakMap,pE=new WeakSet;class mE extends od{constructor(...e){super(...e),O(this,pE),F(this,ZT,null),F(this,eE,null),F(this,tE,null),F(this,nE,null),F(this,iE,!1),F(this,rE,!1),F(this,oE,!1),F(this,sE,!1),F(this,aE,void 0),F(this,lE,null),F(this,cE,null),F(this,uE,!1),F(this,dE,!1),F(this,hE,null),F(this,fE,!1)}get name(){return"FMP4Demuxer"}get defaults(){return{}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"pushChunk","endOfStream"])}pushChunk(e,t={}){if(M(oE,this)||M(sE,this))return;const n=e instanceof Uint8Array?e:new Uint8Array(e),i=!!t.isInit;C(lE,this,A(pE,this,wE).call(this,n,t,i)),i&&(C(aE,this,n),C(cE,this,null),this.trigger("demux:init",{data:n})),A(pE,this,kE).call(this);try{var r;const e=null===(r=M(ZT,this))||void 0===r?void 0:r.write(n);e&&"function"==typeof e.catch&&e.catch((e=>{A(pE,this,xE).call(this,e)}))}catch(e){if(M(oE,this)||A(pE,this,vE).call(this,e))return;return this.log.warn("[FMP4Demuxer] mediabunny demux failed",e),void A(pE,this,xE).call(this,e)}const o=A(pE,this,EE).call(this);o&&"function"==typeof o.catch&&o.catch((e=>{A(pE,this,xE).call(this,e)}))}endOfStream(){if(M(sE,this))return;if(M(uE,this))return;let e;C(uE,this,!0),C(dE,this,!1),C(fE,this,!1);try{var t;e=null===(t=M(ZT,this))||void 0===t?void 0:t.close()}catch(t){e=Promise.resolve()}let n=!1;A(pE,this,yE).call(this),C(hE,this,setTimeout((()=>{C(hE,this,null),n||M(dE,this)||M(sE,this)||A(pE,this,bE).call(this)}),20)),Promise.resolve(e).catch((()=>{})).finally((()=>{n=!0,A(pE,this,yE).call(this),A(pE,this,bE).call(this)}))}onDispose(){super.onDispose(),C(sE,this,!0);try{var e,t;null===(e=M(tE,this))||void 0===e||null===(t=e.close)||void 0===t||t.call(e)}catch(e){}this.endOfStream();try{var n,i;null===(n=M(eE,this))||void 0===n||null===(i=n.dispose)||void 0===i||i.call(n)}catch(e){}C(tE,this,null),C(eE,this,null),C(oE,this,!1),C(lE,this,null),C(nE,this,null),C(iE,this,!1),C(rE,this,!1),C(uE,this,!1),C(dE,this,!1),C(fE,this,!1),A(pE,this,yE).call(this)}}function vE(e){return!!M(sE,this)&&(!e||("InputDisposedError"===(null==e?void 0:e.name)||("string"==typeof(null==e?void 0:e.message)?e.message:"").includes("Input has been disposed")))}function gE(){try{var e,t;const n=null===(e=M(ZT,this))||void 0===e||null===(t=e.close)||void 0===t?void 0:t.call(e);n&&"function"==typeof n.catch&&n.catch((()=>{}))}catch(e){}C(ZT,this,null)}function yE(){null!==M(hE,this)&&(clearTimeout(M(hE,this)),C(hE,this,null))}function bE(){if(M(dE,this)||M(sE,this)||M(oE,this))return;if(C(dE,this,!0),M(rE,this))return void C(fE,this,!0);C(fE,this,!1);const e=A(pE,this,EE).call(this);e&&"function"==typeof e.catch&&e.catch((e=>{A(pE,this,xE).call(this,e)}))}function kE(){if(M(eE,this)&&M(ZT,this))return;const e=ld.TransformStream;if(void 0===e)throw new Error("TransformStream is not available in this environment");const{readable:t,writable:n}=new e;C(ZT,this,n.getWriter()),C(eE,this,new LT({source:new DT(t),formats:[PT]})),C(iE,this,!1)}function wE(e,t,n){const i={isInit:n,byteLength:(null==e?void 0:e.byteLength)||0};return"number"==typeof t.loaded&&(i.loaded=t.loaded),"number"==typeof t.total&&(i.total=t.total),"number"==typeof t.pts&&(i.pts=t.pts),"number"==typeof t.dts&&(i.dts=t.dts),"number"==typeof t.duration&&(i.duration=t.duration),"boolean"==typeof t.isKey&&(i.isKey=t.isKey),i}function xE(e){if(M(oE,this)||A(pE,this,vE).call(this,e))return;if(A(pE,this,TE).call(this,e))return void C(iE,this,!1);C(oE,this,!0),A(pE,this,gE).call(this);try{var t,n;null===(t=M(tE,this))||void 0===t||null===(n=t.close)||void 0===n||n.call(t)}catch(e){}C(tE,this,null);try{var i,r;null===(i=M(eE,this))||void 0===i||null===(r=i.dispose)||void 0===r||r.call(i)}catch(e){}C(eE,this,null);const o={error:e,recoverable:!1,severity:"fatal",streamClosed:M(uE,this),streamFinalized:M(dE,this)};M(lE,this)&&(o.context={...M(lE,this)}),this.trigger("demux:error",o)}function _E(e){if(!e)return!1;const t="string"==typeof(null==e?void 0:e.message)?e.message:"";return!!t&&(t.includes("unsupported or unrecognizable format")||t.includes("No supported tracks found"))}function TE(e){return!!A(pE,this,_E).call(this,e)&&(!M(dE,this)||M(fE,this))}async function EE(){if(!(M(sE,this)||M(oE,this)||M(iE,this)||M(rE,this))){C(rE,this,!0);try{A(pE,this,kE).call(this);const e=await M(eE,this).getPrimaryVideoTrack(),t=e?null:await M(eE,this).getPrimaryAudioTrack(),n=e||t;if(!n)throw new Error("No supported tracks found in MP4");const i=await n.getDecoderConfig(),r=await n.getCodecParameterString(),o=await M(eE,this).getMimeType();this.trigger("demux:init",{...M(aE,this)?{data:M(aE,this)}:{},decoderConfig:i,codec:r,mimeType:o}),C(tE,this,new dT(n)),C(iE,this,!0),C(nE,this,(async()=>{try{for await(const e of M(tE,this).packets()){if(M(sE,this))break;const t="number"==typeof e.timestamp?e.timestamp:0;null===M(cE,this)&&C(cE,this,t);let n=t-M(cE,this);n<0&&(n=0),this.trigger("demux:sample",{data:e.data,pts:n,dts:n,duration:e.duration,isKey:"key"===e.type})}this.trigger("demux:complete")}catch(e){A(pE,this,xE).call(this,e)}})())}catch(e){if(A(pE,this,TE).call(this,e))return;throw e}finally{C(rE,this,!1),!M(fE,this)||M(oE,this)||M(sE,this)||A(pE,this,bE).call(this)}}}const IE=1e6,SE=24e3/1001,AE={primaries:"bt709",transfer:"bt709",matrix:"bt709",fullRange:!0},NE=new Uint8Array;function ME(e){return e?e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):NE:NE}let FE=null;const CE={video:(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,wt=new WeakMap,xt=new WeakMap,_t=new WeakMap,Tt=new WeakMap,Et=new WeakMap,It=new WeakMap,St=new WeakMap,At=new WeakMap,Nt=new WeakMap,Mt=new WeakMap,Ft=new WeakMap,Ct=new WeakMap,Ot=new WeakMap,Pt=new WeakMap,Rt=new WeakMap,Dt=new WeakMap,Lt=new WeakMap,Bt=new WeakMap,zt=new WeakMap,Wt=new WeakMap,$t=new WeakMap,jt=new WeakMap,Ut=new WeakSet,class extends a_{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(...e){super(...e),O(this,Ut),F(this,ct,void 0),F(this,ut,[]),F(this,dt,void 0),F(this,ht,void 0),F(this,ft,void 0),F(this,pt,void 0),F(this,mt,[]),F(this,vt,void 0),F(this,gt,new Map),F(this,yt,!0),F(this,bt,!1),F(this,kt,!1),F(this,wt,!1),F(this,xt,void 0),F(this,_t,!1),F(this,Tt,!1),F(this,Et,0),F(this,It,void 0),F(this,St,void 0),F(this,At,{}),F(this,Nt,void 0),F(this,Mt,0),F(this,Ft,null),F(this,Ct,!1),F(this,Ot,null),F(this,Pt,void 0),F(this,Rt,0),F(this,Dt,0),F(this,Lt,0),F(this,Bt,0),F(this,zt,!1),F(this,Wt,!1),F(this,$t,.2),F(this,jt,Promise.resolve()),C(dt,this,this.settings.decodedHorizonSeconds||1),C(ht,this,A(Ut,this,_I).call(this,this.settings.maxDecodedFrames)),C(ft,this,A(Ut,this,EI).call(this,this.settings.maxDecodeQueueSize)),C(zt,this,pv()),C(Wt,this,A(Ut,this,mI).call(this,this.settings.convertFramesToBitmapsOnAndroid)),C($t,this,A(Ut,this,vI).call(this,this.settings.androidFixEndOfSegmentDelta)),C(pt,this,(()=>0)),C(vt,this,(()=>A(Ut,this,oI).call(this)));const t=this.settings.demuxerOptions?{FMP4Demuxer:this.settings.demuxerOptions}:{};C(ct,this,new mE(t)),M(ct,this).on("demux:init",(e=>A(Ut,this,XE).call(this,e))),M(ct,this).on("demux:sample",(e=>A(Ut,this,YE).call(this,e))),M(ct,this).on("demux:complete",(()=>A(Ut,this,QE).call(this))),M(ct,this).on("demux:error",(e=>A(Ut,this,BE).call(this,e)))}setCurrentTimeProvider(e){"function"==typeof e&&C(pt,this,e)}setTimeOffsetSeconds(e){const t=Number(e);C(Mt,this,Number.isFinite(t)?t:0)}setSeekTargetTimeSeconds(e){const t=Number(e);C(Ft,this,Number.isFinite(t)?t:null),C(Ct,this,!1),C(Ot,this,null)}endOfStream(){M(ct,this)&&"function"==typeof M(ct,this).endOfStream&&M(ct,this).endOfStream()}configure(e){super.configure(e),C(At,this,{codec:A(Ut,this,MI).call(this,e),width:(null==e?void 0:e.codedWidth)||(null==e?void 0:e.width),height:(null==e?void 0:e.codedHeight)||(null==e?void 0:e.height)}),C(It,this,M(At,this).codec)}setSegment(e){this.lastSegment=e,A(Ut,this,VE).call(this)}setNodeId(e){C(Pt,this,e)}decode(e){this.setSegment(e);const t=null==e?void 0:e.arrayBuffer;t&&M(ct,this).pushChunk(t,{isInit:!(null==e||!e.isInit)})}async decodeChunk(e,t={}){await M(ct,this).pushChunk(e,{isInit:!!t.isInit,pts:"number"==typeof t.pts?t.pts:void 0,dts:"number"==typeof t.dts?t.dts:void 0,duration:"number"==typeof t.duration?t.duration:void 0,isKey:!!t.isKey,loaded:"number"==typeof t.loaded?t.loaded:void 0,total:"number"==typeof t.total?t.total:void 0})}get decodedFrames(){return M(ut,this).slice()}onDispose(){if(super.onDispose(),A(Ut,this,lI).call(this),M(ct,this)&&"function"==typeof M(ct,this).dispose&&M(ct,this).dispose(),C(ut,this,[]),C(mt,this,[]),M(gt,this).clear(),C(Ot,this,null),M(xt,this)&&"function"==typeof M(xt,this).close)try{M(xt,this).close()}catch(e){}C(xt,this,null),C(_t,this,!1),C(St,this,null),C(It,this,null),C(Pt,this,null),C(jt,this,Promise.resolve()),A(Ut,this,VE).call(this)}}),audio:(qt=new WeakMap,Vt=new WeakMap,Gt=new WeakMap,Ht=new WeakMap,Kt=new WeakMap,Xt=new WeakMap,Yt=new WeakMap,Qt=new WeakSet,class extends a_{constructor(...e){super(...e),O(this,Qt),F(this,qt,void 0),F(this,Vt,[]),F(this,Gt,0),F(this,Ht,!1),F(this,Kt,!1),F(this,Xt,void 0),F(this,Yt,0)}get name(){return"WebAudioDecoder"}setSegment(e){C(Xt,this,e)}setTimeOffsetSeconds(e){const t=Number(e);C(Yt,this,Number.isFinite(t)?t:0)}decode(e){if(this.lastSegment=e,!e)return;if(e.isInit)return void C(qt,this,ME(e.arrayBuffer));const t=e.arrayBuffer;t&&A(Qt,this,RE).call(this,ME(t),!0)}decodeChunk(e,t={}){if(!e)return;if(t.isInit)return void C(qt,this,ME(e));const n=ME(e);if(!n.length)return;M(Vt,this).push(n),C(Gt,this,M(Gt,this)+n.length);const i=Number(t.loaded),r=Number(t.total);Number.isFinite(i)&&Number.isFinite(r)&&r>0&&i>=r&&A(Qt,this,OE).call(this)}endOfStream(){A(Qt,this,OE).call(this)}onDispose(){super.onDispose(),C(qt,this,void 0),C(Vt,this,[]),C(Gt,this,0),C(Ht,this,!1),C(Kt,this,!1),C(Xt,this,void 0)}}),image:class extends a_{#D;#L=0;#B=[];#z=0;#W;get name(){return"ImageDecoder"}setSegment(e){this.#D=e}setTimeOffsetSeconds(e){const t=Number(e);this.#L=Number.isFinite(t)?t:0}decode(e){super.decode(e),e&&(this.#D=e);const t=null==e?void 0:e.arrayBuffer;t instanceof ArrayBuffer&&(this.#B=[new Uint8Array(t)],this.#z=t.byteLength,this.endOfStream())}decodeChunk(e,t={}){if(null!=t&&t.isInit)return;const n=function(e){if(e)return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):ArrayBuffer.isView(e)&&e.buffer?new Uint8Array(e.buffer):void 0}(e);n&&n.length&&(this.#B.push(n),this.#z+=n.length)}async endOfStream(){var e,t,n;if(this.#W)return;if(!(this.#B.length&&this.#z>0))return;const i=new Uint8Array(this.#z);let r=0;for(let e=0;e<this.#B.length;e+=1){const t=this.#B[e];i.set(t,r),r+=t.length}const o=null===(e=this.#D)||void 0===e?void 0:e.chosenRepresentation,s=(null==o?void 0:o.mime)||(null===(t=this.track)||void 0===t?void 0:t.mimeType)||(null===(n=this.track)||void 0===n?void 0:n.mime)||function(e){if(e instanceof Uint8Array&&!(e.byteLength<4))return e.byteLength>=8&&137===e[0]&&80===e[1]&&78===e[2]&&71===e[3]&&13===e[4]&&10===e[5]&&26===e[6]&&10===e[7]?"image/png":255===e[0]&&216===e[1]&&255===e[2]?"image/jpeg":e.byteLength>=6&&71===e[0]&&73===e[1]&&70===e[2]&&56===e[3]?"image/gif":e.byteLength>=12&&82===e[0]&&73===e[1]&&70===e[2]&&70===e[3]&&87===e[8]&&69===e[9]&&66===e[10]&&80===e[11]?"image/webp":void 0}(i);try{var a,l;const e=await async function(e,t){const n=function(e,t){if(!(e&&e.byteLength>0))return;if("function"!=typeof ld.Blob)return;const n="string"==typeof t?t:"";return new ld.Blob([e],n?{type:n}:void 0)}(e,t);if(!n)throw new Error("Image decode requires Blob support");let i;if("function"==typeof ld.Image&&ld.URL&&"function"==typeof ld.URL.createObjectURL&&"function"==typeof ld.URL.revokeObjectURL){const e=ld.URL.createObjectURL(n);try{const t=new ld.Image;return await new Promise(((n,i)=>{t.onload=()=>n(),t.onerror=e=>i(e||new Error("Image decode failed")),t.src=e})),t}catch(e){i=e}finally{ld.URL.revokeObjectURL(e)}}if("function"==typeof ld.createImageBitmap)try{return ld.createImageBitmap(n)}catch(e){i=e}if(i)throw i;throw new Error("No supported image decode mechanism")}(i,s);this.#W=e;const t=function(e){if(!e)return;const t=[[e.naturalWidth,e.naturalHeight],[e.width,e.height],[e.displayWidth,e.displayHeight],[e.videoWidth,e.videoHeight],[e.codedWidth,e.codedHeight]];for(let e=0;e<t.length;e+=1){const[n,i]=t[e],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}(e);t&&o&&(ry(o.width)||(o.width=t.width),ry(o.height)||(o.height=t.height)),this.trigger("decoder:frame",{pts:this.#L,duration:ry(null===(a=this.#D)||void 0===a?void 0:a.duration)?this.#D.duration:null===(l=this.track)||void 0===l?void 0:l.duration,frame:e})}catch(e){this.trigger("decoder:error",{error:e})}}onDispose(){if(super.onDispose(),this.#W&&"function"==typeof this.#W.close)try{this.#W.close()}catch(e){}this.#W=null,this.#B=[],this.#z=0,this.#D=null}}};function OE(){if(M(Ht,this)||M(Kt,this))return;if(!M(Gt,this))return;const e=A(Qt,this,PE).call(this);e.length&&A(Qt,this,RE).call(this,e,!1)}function PE(){const e=M(qt,this),t=e?e.length:0,n=t+M(Gt,this);if(!n)return NE;const i=new Uint8Array(n);let r=0;t&&(i.set(e,r),r+=t);for(let e=0;e<M(Vt,this).length;e+=1){const t=M(Vt,this)[e];t&&t.length&&(i.set(t,r),r+=t.length)}return i}function RE(e,t){if(M(Ht,this)||M(Kt,this))return;const n=t?A(Qt,this,DE).call(this,e):e;if(!n||!n.length)return;const i=function(){if(FE)return FE;const e=ld.AudioContext||ld.webkitAudioContext;return e?(FE=new e,FE):null}();if(!i||"function"!=typeof i.decodeAudioData)return void this.trigger("decoder:error",{error:new Error("AudioContext is not available")});const r=n.buffer.slice(0);C(Kt,this,!0),new Promise(((e,t)=>{const n=i.decodeAudioData(r,e,t);n&&"function"==typeof n.then&&n.then(e).catch(t)})).then((e=>{var t;C(Ht,this,!0);const n=Number.isFinite(null==e?void 0:e.duration)?e.duration:Number(null===(t=M(Xt,this))||void 0===t?void 0:t.duration)||void 0;this.trigger("decoder:audio",{audioBuffer:e,pts:M(Yt,this),duration:n})})).catch((e=>{this.trigger("decoder:error",{error:e})})).finally((()=>{C(Vt,this,[]),C(Gt,this,0),C(Kt,this,!1)}))}function DE(e){const t=M(qt,this);if(!t||!t.length)return e;const n=t.length+e.length,i=new Uint8Array(n);return i.set(t,0),i.set(e,t.length),i}function LE(e,t){var n,i,r,o,s;const a=null!=e&&e.context&&"object"==typeof e.context?e.context:void 0;return{error:t,errorName:null==t?void 0:t.name,errorMessage:"string"==typeof(null==t?void 0:t.message)?t.message:void 0,nodeId:M(Pt,this),trackId:null===(n=this.track)||void 0===n?void 0:n.id,trackType:null===(i=this.track)||void 0===i?void 0:i.type,codec:(null===(r=M(At,this))||void 0===r?void 0:r.codec)||M(It,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 BE(e){const t=(null==e?void 0:e.error)||e,n=A(Ut,this,LE).call(this,e,t);if(A(Ut,this,zE).call(this,e,t))return this.log.warn("[onDemuxError] recoverable demux error",n),void A(Ut,this,QE).call(this);const i=A(Ut,this,KE).call(this,e),r=A(Ut,this,WE).call(this,i);if(i&&0===i.missingFrames)return this.log.warn(`[onDemuxError] ignoring demux error (no missing frames)${r}`,{...n,missingFrameStats:i}),void A(Ut,this,QE).call(this);let o=n;i&&(o={...n,missingFrameStats:i}),this.log.warn(`[onDemuxError] demux error${r}`,o),this.trigger("decoder:error",e)}function zE(e,t){if("boolean"==typeof(null==e?void 0:e.recoverable))return e.recoverable;const n="string"==typeof(null==e?void 0:e.severity)?e.severity:"";if(n)return"recoverable"===n||"transient"===n;const i="string"==typeof(null==t?void 0:t.message)?t.message:"";return!!i&&(i.includes("unsupported or unrecognizable format")||i.includes("No supported tracks found"))}function WE(e){return e?` expectedFrames=${A(Ut,this,$E).call(this,e.expectedFrames)} demuxedFrames=${A(Ut,this,$E).call(this,e.demuxedFrames)} missingFrames=${A(Ut,this,$E).call(this,e.missingFrames)}`:""}function $E(e){if(null==e)return"unknown";const t=Number(e);return Number.isFinite(t)?String(t):"unknown"}function jE(e,t={}){return{expectedFrames:null,demuxedFrames:M(Rt,this),missingFrames:null,reason:e,...t}}function UE(e){const t=Number(e);return Number.isFinite(t)?t:null}function qE(e){var t,n;const i=(null==e?void 0:e.context)||{},r=Number(i.loaded),o=Number(i.total);if(!Number.isFinite(o)||o<=0||!Number.isFinite(r)||r<o)return null;if(null!==(t=this.lastSegment)&&void 0!==t&&t.isInit)return null;const s=Number(null===(n=this.lastSegment)||void 0===n?void 0:n.duration);if(!Number.isFinite(s)||s<=0)return A(Ut,this,jE).call(this,"segment_duration_unavailable",{segmentDurationSeconds:A(Ut,this,UE).call(this,s),demuxedCoverageSeconds:M(Bt,this),frameDurationSeconds:null});const a=A(Ut,this,HE).call(this);if(!Number.isFinite(a)||a<=0){const e=Math.max(1,Math.round(s*SE));return{expectedFrames:e,demuxedFrames:M(Rt,this),missingFrames:Math.max(0,e-M(Rt,this)),reason:"fallback_fps",fallbackFps:SE,segmentDurationSeconds:s,demuxedCoverageSeconds:M(Bt,this),frameDurationSeconds:A(Ut,this,UE).call(this,a)}}const l=Math.min(.5*a,.02),c=Math.max(0,s-M(Bt,this)),u=c<=l?0:c,d=Math.max(1,Math.floor((s+l)/a)),h=Math.max(0,d-M(Rt,this)),f=u>0?Math.ceil(u/a):0;return{expectedFrames:d,demuxedFrames:M(Rt,this),missingFrames:Math.max(h,f),segmentDurationSeconds:s,demuxedCoverageSeconds:M(Bt,this),frameDurationSeconds:a}}function VE(){C(Rt,this,0),C(Dt,this,0),C(Lt,this,0),C(Bt,this,0)}function GE(e){C(Rt,this,M(Rt,this)+1);const t=Number(null==e?void 0:e.pts),n=Number(null==e?void 0:e.duration);if(Number.isFinite(n)&&n>0&&(C(Dt,this,M(Dt,this)+n),C(Lt,this,M(Lt,this)+1)),!Number.isFinite(t))return;const i=Number.isFinite(n)&&n>0?t+n:t;Number.isFinite(i)&&i>M(Bt,this)&&C(Bt,this,i)}function HE(){return M(Lt,this)>0?M(Dt,this)/M(Lt,this):M(Rt,this)>0&&M(Bt,this)>0?M(Bt,this)/M(Rt,this):null}function KE(e){return A(Ut,this,qE).call(this,e)}function XE(e){(null==e?void 0:e.data)instanceof Uint8Array&&(C(St,this,e.data.buffer),A(Ut,this,uI).call(this)),null!=e&&e.decoderConfig&&(C(Nt,this,e.decoderConfig),C(It,this,e.decoderConfig.codec||M(It,this)),A(Ut,this,uI).call(this)),this.trigger("decoder:init",e)}function YE(e){A(Ut,this,GE).call(this,e),M(mt,this).push(e),A(Ut,this,oI).call(this)}function QE(){C(bt,this,!0),A(Ut,this,hI).call(this)}function JE(e){const t="number"==typeof(null==e?void 0:e.pts)?e.pts:void 0;if(Number.isFinite(t))return M(Mt,this)+t}function ZE(e){return M(mt,this).some((t=>{const n=A(Ut,this,JE).call(this,t);return Number.isFinite(n)&&n>=e}))}function eI(e){let t=-1,n=null;for(let i=0;i<M(mt,this).length;i+=1){const r=M(mt,this)[i],o=A(Ut,this,JE).call(this,r);Number.isFinite(o)&&(null==r?void 0:r.isKey)&&o<=e&&(t=i,n=o)}return{chosenIndex:t,chosenPtsSeconds:n}}function tI(e){let t=-1,n=null;for(let i=0;i<M(mt,this).length;i+=1){const r=M(mt,this)[i],o=A(Ut,this,JE).call(this,r);if(Number.isFinite(o)&&null!=r&&r.isKey&&(t=i,n=o,o>=e))break}return{chosenIndex:t,chosenPtsSeconds:n}}function nI(e){const t=e+M(dt,this),n=M(Ft,this);if(!Number.isFinite(n))return t;const i=Number.isFinite(M(Ot,this))?M(Ot,this):null;if(Number.isFinite(i))return Math.max(t,i);const{chosenPtsSeconds:r}=A(Ut,this,tI).call(this,n);return Number.isFinite(r)?Math.max(t,r):t}function iI(e){const t=M(Ft,this);Number.isFinite(t)&&Number.isFinite(e)&&e>=t&&(C(Ft,this,null),C(Ot,this,null))}function rI(){const e=M(Ft,this);if(!Number.isFinite(e)||M(Ct,this))return!0;if(!A(Ut,this,ZE).call(this,e)&&!M(bt,this))return!1;const t=A(Ut,this,eI).call(this,e);let n=t;if(-1===t.chosenIndex&&(n=A(Ut,this,tI).call(this,e)),n.chosenIndex>0){const e=`[#maybeAlignToSeekKeyframe] Dropping ${n.chosenIndex} samples before keyframe @ ${n.chosenPtsSeconds}`;this.log.debug(e),M(mt,this).splice(0,n.chosenIndex)}return C(yt,this,!0),Number.isFinite(n.chosenPtsSeconds)&&C(Ot,this,n.chosenPtsSeconds),C(Ct,this,!0),!0}function oI(){const e=M(pt,this)?M(pt,this).call(this):0,t=A(Ut,this,nI).call(this,e);if(A(Ut,this,wI).call(this,e),A(Ut,this,xI).call(this),!A(Ut,this,rI).call(this))return void A(Ut,this,aI).call(this);const n=void 0!==ld.VideoDecoder&&void 0!==ld.EncodedVideoChunk;for(n&&!M(_t,this)&&M(Nt,this)&&A(Ut,this,uI).call(this);M(mt,this).length&&!A(Ut,this,TI).call(this)&&!(n&&M(xt,this)&&A(Ut,this,II).call(this));){const e=M(mt,this)[0],i="number"==typeof(null==e?void 0:e.pts)?e.pts:0,r=M(Mt,this)+i;if(r>t)break;if(null!=e&&e.raw)M(mt,this).shift(),A(Ut,this,sI).call(this,e);else{if(n){if(!M(_t,this)||!M(xt,this))break;if(M(yt,this)&&!e.isKey){M(mt,this).shift();continue}M(mt,this).shift();const t=Math.max(0,Math.round(r*IE));M(gt,this).set(t,!!e.isKey);try{const n=new ld.EncodedVideoChunk({type:e.isKey?"key":"delta",timestamp:t,duration:e.duration?Math.round(e.duration*IE):void 0,data:e.data instanceof Uint8Array?e.data:new Uint8Array(e.data)});M(xt,this).decode(n),e.isKey&&C(yt,this,!1);continue}catch(e){M(gt,this).delete(t);const n="string"==typeof(null==e?void 0:e.message)?e.message:"";if("DataError"===(null==e?void 0:e.name)&&n.includes("key frame")){C(yt,this,!0);continue}this.log.warn("[#drainDecodeQueue] decode failed, falling back to placeholder",e)}}M(mt,this).shift(),A(Ut,this,sI).call(this,e)}}A(Ut,this,hI).call(this),A(Ut,this,aI).call(this)}function sI(e){const t=M(pt,this)?M(pt,this).call(this):0,n=A(Ut,this,nI).call(this,t),i=M(Mt,this)+("number"==typeof e.pts?e.pts:0);if(i<t||i>n)return;A(Ut,this,wI).call(this,t);const r={pts:i,duration:e.duration,data:e.data,isKey:e.isKey};M(ut,this).push(r),A(Ut,this,xI).call(this),this.trigger("decoder:frame",r),A(Ut,this,iI).call(this,i)}function aI(){if(M(mt,this).length>0&&void 0!==ld.VideoDecoder){if(mw(M(vt,this)))return;fw(M(vt,this),50)}else A(Ut,this,lI).call(this)}function lI(){M(vt,this)&&mw(M(vt,this))&&pw(M(vt,this))}function cI(){return null!=ld&&ld.performance&&"function"==typeof ld.performance.now?ld.performance.now():Date.now()}function uI(){if(M(_t,this))return;if(void 0===ld.VideoDecoder)return;if(!M(Nt,this))return;if(M(Tt,this)&&A(Ut,this,cI).call(this)<M(Et,this))return;const e=A(Ut,this,dI).call(this);try{C(xt,this,new ld.VideoDecoder({output:e=>A(Ut,this,pI).call(this,e),error:e=>A(Ut,this,fI).call(this,e)})),M(xt,this).configure(e),C(_t,this,!0),C(yt,this,!0),C(Tt,this,!1),C(Et,this,0),A(Ut,this,oI).call(this)}catch(e){this.log.warn("[#maybeConfigureDecoder] configure failed, falling back to placeholder decode",e),C(xt,this,null),C(_t,this,!1),C(Nt,this,null)}}function dI(){const e={...M(Nt,this)};return A(Ut,this,AI).call(this,e)&&M(At,this).codec?e.codec=M(At,this).codec:!e.codec&&M(It,this)&&(e.codec=M(It,this)),M(St,this)&&!e.description&&(e.description=M(St,this)),M(At,this).width&&!e.codedWidth&&(e.codedWidth=M(At,this).width),M(At,this).height&&!e.codedHeight&&(e.codedHeight=M(At,this).height),A(Ut,this,NI).call(this,e),e}function hI(){void 0!==ld.VideoDecoder&&void 0!==ld.EncodedVideoChunk&&(M(Tt,this)||!M(bt,this)||M(wt,this)||M(kt,this)||M(_t,this)&&M(xt,this)&&"function"==typeof M(xt,this).flush&&(M(mt,this).length||(C(kt,this,!0),Promise.resolve().then((()=>M(xt,this).flush())).then((()=>{C(wt,this,!0),C(yt,this,!0)})).catch((e=>{"AbortError"!==(null==e?void 0:e.name)&&this.log.warn("[#maybeFlushDecoder] flush failed",e)})).finally((()=>{C(kt,this,!1)})))))}function fI(e){if(this.log.warn("[#handleDecoderError] decoder error",e),this.trigger("decoder:error",{error:e}),M(xt,this)&&"function"==typeof M(xt,this).close)try{M(xt,this).close()}catch(e){}C(xt,this,null),C(_t,this,!1),C(kt,this,!1),C(wt,this,!1),C(yt,this,!0),M(gt,this).clear(),C(Tt,this,!0),C(Et,this,A(Ut,this,cI).call(this)+1e3)}function pI(e){C(jt,this,M(jt,this).then((()=>{var t;if(!this._disposed)return A(Ut,this,kI).call(this,e);null===(t=e.close)||void 0===t||t.call(e)})).catch((t=>{this.log.warn("[#enqueueDecodedFrame] failed processing decoded frame",t);try{var n;null===(n=e.close)||void 0===n||n.call(e)}catch(e){}})))}function mI(e){return"boolean"!=typeof e||e}function vI(e){const t=Number(e);return!Number.isFinite(t)||t<0?.2:t}function gI(){return!!M(Wt,this)&&"function"==typeof ld.createImageBitmap&&M(zt,this)}function yI(e){var t;const n=Number(null===(t=this.lastSegment)||void 0===t?void 0:t.duration);if(!Number.isFinite(n)||n<=0)return!1;if(!Number.isFinite(e))return!1;const i=Number(M(Mt,this));return!!Number.isFinite(i)&&e>=i+n-M($t,this)}async function bI(e,t){try{var n;const i=A(Ut,this,yI).call(this,t),r=await ld.createImageBitmap(e,{premultiplyAlpha:i?"none":"default"});return null!==(n=e.close)&&void 0!==n&&n.call(e),r}catch(t){return this.log.debug("[#maybeConvertFrameToBitmap] createImageBitmap failed",t),e}}async function kI(e){var t,n;let i=e;if(this._disposed)return void(null===(t=(n=i).close)||void 0===t||t.call(n));const r="number"==typeof e.timestamp?e.timestamp:void 0,o="number"==typeof e.timestamp?e.timestamp/IE:M(pt,this)?M(pt,this).call(this):0,s="number"==typeof e.duration?e.duration/IE:void 0;let a;void 0!==r&&(a=M(gt,this).get(r),M(gt,this).delete(r));try{var l,c,u,d;let t=M(pt,this)?M(pt,this).call(this):0,n=A(Ut,this,nI).call(this,t);if(o<t||o>n)return void(null===(l=(c=i).close)||void 0===l||l.call(c));if(A(Ut,this,gI).call(this)){var h,f,p,m;if(i=await A(Ut,this,bI).call(this,e,o),this._disposed)return void(null===(h=(f=i).close)||void 0===h||h.call(f));if(t=M(pt,this)?M(pt,this).call(this):0,n=A(Ut,this,nI).call(this,t),o<t||o>n)return void(null===(p=(m=i).close)||void 0===p||p.call(m))}if(A(Ut,this,wI).call(this,t),this._disposed)return void(null===(u=(d=i).close)||void 0===u||u.call(d));const r={frame:i,pts:o,duration:s,isKey:void 0!==a&&a};M(ut,this).push(r),A(Ut,this,xI).call(this),this.trigger("decoder:frame",r),A(Ut,this,iI).call(this,o),this.log.debug(`[#handleDecodedFrame] [${M(At,this).codec}] Decoded frame:`,r)}catch(e){this.log.warn(`[#handleDecodedFrame] [${M(At,this).codec}] Failed to handle decoded frame`,e);try{var v,g;null===(v=(g=i).close)||void 0===v||v.call(g)}catch(e){}}}function wI(e){const t=A(Ut,this,nI).call(this,e),n=[];M(ut,this).forEach((i=>{var r;const o=null!==(r=null==i?void 0:i.pts)&&void 0!==r?r:0;o<e||o>t||n.push(i)})),C(ut,this,n)}function xI(){const e=M(ht,this);if(!Number.isFinite(e)||e<=0)return;if(M(ut,this).length<=e)return;const t=M(ut,this).length-e;M(ut,this).splice(0,t)}function _I(e){const t=Number(e);return!Number.isFinite(t)||t<=0?0:Math.floor(t)}function TI(){const e=M(ht,this);return!(!Number.isFinite(e)||e<=0)&&M(ut,this).length>=e}function EI(e){const t=Number(e);return!Number.isFinite(t)||t<=0?0:Math.floor(t)}function II(){var e;const t=M(ft,this);if(!Number.isFinite(t)||t<=0)return!1;const n=Number(null===(e=M(xt,this))||void 0===e?void 0:e.decodeQueueSize);return!!Number.isFinite(n)&&n>=t}function SI(e){return"string"==typeof e&&e.toLowerCase().startsWith("av01")}function AI(e){var t;return!1!==this.settings.av1ColorSpaceOverrideEnabled&&A(Ut,this,SI).call(this,(null===(t=M(At,this))||void 0===t?void 0:t.codec)||(null==e?void 0:e.codec))}function NI(e){A(Ut,this,AI).call(this,e)&&(e.colorSpace={...AE})}function MI(e){if(e&&Array.isArray(e.segments))for(let t=0;t<e.segments.length;t+=1){const n=e.segments[t];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 FI extends od{#$;get name(){return"DecoderFactory"}constructor(...e){super(...e);const t=e.length?e[e.length-1]:void 0;this.#$=t&&"object"==typeof t&&!Array.isArray(t)?t:{}}create(e,t=this.#$){if(!e||!e.type)return new a_(t);const n=CE[e.type];return n?(this.log.debug(`[#create] [${e.type}] Creating decoder:`,n),new n(t)):new a_(t)}}class CI{#j;#U;#q;#V;constructor(e={}){this.#j=e.getActiveRenderPlacement,this.#U=e.getPlacementsActiveAtTime,this.#q=e.ensureDecodedForPlacementAtTime;const t=Number(e.lookaheadSeconds);this.#V=Number.isFinite(t)&&t>=0?t:1}handleTimeUpdate(e={}){const t=Number(null==e?void 0:e.time);if(!Number.isFinite(t))return;if("function"!=typeof this.#q)return;const n="function"==typeof this.#U?this.#U:()=>[],i=n(t),r=new Set;i.forEach((e=>{null!=e&&e.placementId&&r.add(e.placementId),this.#q(e,t)}));const o=this.#V;if(!(o>0))return;const s=t+o;n(s).forEach((e=>{const t=null==e?void 0:e.placementId;t&&!r.has(t)&&this.#q(e,s)}))}dispose(){}}class OI{#G;#H;#K;#X;#Y;#Q;constructor(e={}){this.#G=e.getNode,this.#H=e.getPlacementState,this.#K=e.getDecodeTracks,this.#X=e.getSegmentIdForTrackAtTime,this.#Y=e.decodeLoadedMediaSegment,this.#Q=e.decodeLoadedMediaSegmentsAfter}ensureDecodedForPlacementAtTime(e,t){if(!e||!Number.isFinite(t))return;const n=null==e?void 0:e.placementId,i=null==e?void 0:e.nodeId;if(!n||!i)return;const r="function"==typeof this.#G?this.#G(i):void 0;if(!r)return;const o="function"==typeof this.#H?this.#H(n):void 0,s=null==o?void 0:o.trackStates;s&&"function"==typeof s.get&&("function"==typeof this.#K?this.#K(r).filter((e=>"video"===(null==e?void 0:e.type)||"image"===(null==e?void 0:e.type)||"audio"===(null==e?void 0:e.type))):[]).forEach((n=>{var i;const r=s.get(n.id);if(!r)return;const o="function"==typeof this.#X?this.#X(n,e,t):null;if(!o)return;const a=null==n||null===(i=n.segments)||void 0===i?void 0:i.find((e=>(null==e?void 0:e.id)===o));a&&!a.isInit&&a.retainedByteLength>0&&a.arrayBuffer&&(r.segmentDecoders&&"function"==typeof r.segmentDecoders.has&&r.segmentDecoders.has(o)||"function"!=typeof this.#Y||this.#Y(e,n,a),"video"===(null==n?void 0:n.type)&&"function"==typeof this.#Q&&this.#Q(e,n,a))}))}dispose(){}}const PI=new Set(["video","audio","image"]);function RI(e){const t=Number(e);return Number.isFinite(t)?t:0}var DI=new WeakMap,LI=new WeakMap,BI=new WeakMap,zI=new WeakMap,WI=new WeakMap,$I=new WeakMap,jI=new WeakMap,UI=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,eS=new WeakMap,tS=new WeakSet;class nS extends od{constructor(...e){super(...e),O(this,tS),F(this,DI,void 0),F(this,LI,void 0),F(this,BI,void 0),F(this,zI,void 0),F(this,WI,void 0),F(this,$I,void 0),F(this,jI,void 0),F(this,UI,void 0),F(this,qI,void 0),F(this,VI,void 0),F(this,GI,void 0),F(this,HI,new Map),F(this,KI,new Map),F(this,XI,new Map),F(this,YI,new Map),F(this,QI,new Set),F(this,JI,0),F(this,ZI,!1),F(this,eS,null);const[t,n,i]=e;C(DI,this,t),C(LI,this,n),C(BI,this,i||new FI),C(zI,this,new OI({getNode:e=>A(tS,this,SS).call(this,e),getPlacementState:e=>M(HI,this).get(e),getDecodeTracks:e=>A(tS,this,xS).call(this,e),getSegmentIdForTrackAtTime:(e,t,n)=>A(tS,this,uS).call(this,e,t,n),decodeLoadedMediaSegment:(e,t,n)=>{A(tS,this,HS).call(this,e,t,n)},decodeLoadedMediaSegmentsAfter:(e,t,n)=>{A(tS,this,zS).call(this,e,t,n)}})),C(WI,this,new CI({getActiveRenderPlacement:e=>{var t,n;return null===(t=M(LI,this))||void 0===t||null===(n=t.getActiveRenderPlacement)||void 0===n?void 0:n.call(t,e)},getPlacementsActiveAtTime:e=>{var t,n;return(null===(t=M(LI,this))||void 0===t||null===(n=t.getPlacementsActiveAtTime)||void 0===n?void 0:n.call(t,e))||[]},ensureDecodedForPlacementAtTime:(e,t)=>{var n,i;null===(n=M(zI,this))||void 0===n||null===(i=n.ensureDecodedForPlacementAtTime)||void 0===i||i.call(n,e,t)}})),A(tS,this,iS).call(this),A(tS,this,bS).call(this)}get name(){return"DecodeCoordinator"}onDispose(){var e,t;M(LI,this)&&"function"==typeof M(LI,this).off&&M($I,this)&&M(LI,this).off(ud.PLACEMENT_ADDED,M($I,this)),M(LI,this)&&"function"==typeof M(LI,this).off&&M(jI,this)&&M(LI,this).off(ud.TIMELINE_SEEKING,M(jI,this)),M(LI,this)&&"function"==typeof M(LI,this).off&&M(UI,this)&&M(LI,this).off(ud.TIMELINE_SEEKED,M(UI,this)),M(LI,this)&&"function"==typeof M(LI,this).off&&M(qI,this)&&M(LI,this).off(ud.TIMELINE_TIME_UPDATE,M(qI,this)),M(LI,this)&&"function"==typeof M(LI,this).off&&M(VI,this)&&M(LI,this).off(ud.TIMELINE_RESET,M(VI,this)),A(tS,this,rS).call(this),C($I,this,null),C(jI,this,null),C(UI,this,null),C(qI,this,null),C(VI,this,null),null!==(e=M(zI,this))&&void 0!==e&&null!==(t=e.dispose)&&void 0!==t&&t.call(e),C(zI,this,null),M(WI,this)&&"function"==typeof M(WI,this).dispose&&M(WI,this).dispose(),C(WI,this,null),M(KI,this).forEach(((e,t)=>{const n=A(tS,this,SS).call(this,t);n&&"function"==typeof n.off&&n.off("node:loaded",e)})),M(KI,this).clear(),M(XI,this).forEach(((e,t)=>{const n=A(tS,this,SS).call(this,t);n&&"function"==typeof n.off&&n.off("segment:chunk",e)})),M(XI,this).clear(),M(YI,this).clear(),M(QI,this).clear(),A(tS,this,mS).call(this),M(HI,this).forEach((({trackStates:e})=>{e&&e.forEach((e=>{A(tS,this,FS).call(this,e)}))})),M(HI,this).clear()}}function iS(){M(LI,this)&&"function"==typeof M(LI,this).on&&(C($I,this,(e=>{A(tS,this,kS).call(this,e)})),M(LI,this).on(ud.PLACEMENT_ADDED,M($I,this)),C(jI,this,(e=>A(tS,this,oS).call(this,e))),M(LI,this).on(ud.TIMELINE_SEEKING,M(jI,this)),C(UI,this,(()=>A(tS,this,sS).call(this))),M(LI,this).on(ud.TIMELINE_SEEKED,M(UI,this)),C(qI,this,(e=>A(tS,this,aS).call(this,e))),M(LI,this).on(ud.TIMELINE_TIME_UPDATE,M(qI,this)),C(VI,this,(()=>A(tS,this,lS).call(this))),M(LI,this).on(ud.TIMELINE_RESET,M(VI,this))),(null==ld?void 0:ld.document)&&"function"==typeof ld.document.addEventListener&&(C(GI,this,(()=>{A(tS,this,vS).call(this)})),ld.document.addEventListener("visibilitychange",M(GI,this)))}function rS(){M(GI,this)&&null!=ld&&ld.document&&"function"==typeof ld.document.removeEventListener&&ld.document.removeEventListener("visibilitychange",M(GI,this)),C(GI,this,null)}function oS(e={}){const t=Number(null==e?void 0:e.targetTime);Number.isFinite(t)&&(M(HI,this).forEach((e=>{const n=null==e?void 0:e.trackStates;n&&n.forEach((n=>{var i;const r=null==n||null===(i=n.track)||void 0===i?void 0:i.type;"video"!==r&&"image"!==r&&"audio"!==r||(A(tS,this,cS).call(this,n,null==e?void 0:e.placement,t),n.seekSegmentId=null)}))})),(Array.isArray(null==e?void 0:e.placements)?e.placements:[]).forEach((e=>{const n=null==e?void 0:e.placementId,i=null==e?void 0:e.nodeId;if(!n||!i)return;const r=M(HI,this).get(n);if(!r||!r.trackStates)return;const o=A(tS,this,SS).call(this,i);o&&(r.trackStates.forEach((n=>{const i=null==n?void 0:n.track;!i||"video"!==i.type&&"image"!==i.type&&"audio"!==i.type||A(tS,this,cS).call(this,n,r.placement||e,t)})),A(tS,this,BS).call(this,r.placement||e,o))})))}function sS(){M(HI,this).forEach((e=>{const t=null==e?void 0:e.trackStates;t&&t.forEach((e=>{var t;const n=null==e||null===(t=e.track)||void 0===t?void 0:t.type;"video"!==n&&"image"!==n&&"audio"!==n||(e.seekSegmentId=null)}))}))}function aS(e={}){var t,n;A(tS,this,LS).call(this,null==e?void 0:e.time),null!==(t=M(WI,this))&&void 0!==t&&null!==(n=t.handleTimeUpdate)&&void 0!==n&&n.call(t,e),A(tS,this,vS).call(this),A(tS,this,CS).call(this,null==e?void 0:e.time)}function lS(){M(KI,this).forEach(((e,t)=>{const n=A(tS,this,SS).call(this,t);n&&"function"==typeof n.off&&n.off("node:loaded",e)})),M(KI,this).clear(),M(XI,this).forEach(((e,t)=>{const n=A(tS,this,SS).call(this,t);n&&"function"==typeof n.off&&n.off("segment:chunk",e)})),M(XI,this).clear(),M(YI,this).clear(),M(QI,this).clear(),M(HI,this).forEach((({trackStates:e})=>{e&&e.forEach((e=>{const t=null==e?void 0:e.segmentDecoders;t&&t.forEach((e=>{e&&"function"==typeof e.dispose&&e.dispose()}))}))})),M(HI,this).clear()}function cS(e,t,n){e&&(A(tS,this,FS).call(this,e),e.seekSegmentId=A(tS,this,uS).call(this,e.track,t,n))}function uS(e,t,n){if(!e||!t||!Array.isArray(e.segments))return null;const i=vm(t);if(!Number.isFinite(i))return null;const r=RI(null==t?void 0:t.nodeOffsetOverride),o=Math.max(0,n-i+r),s=RI(null==e?void 0:e.offset),a=Math.max(0,o-s),l="function"==typeof e.getMediaSegmentAtTime?e.getMediaSegmentAtTime(a,{preferRepresentationTime:!0}):pb(e.segments,a,{preferRepresentationTime:!0});return(null==l?void 0:l.id)||null}function dS(e){if(!e)return!1;const t=null==e?void 0:e.name;if("QuotaExceededError"===t)return!0;if("EncodingError"===t)return!0;const n="string"==typeof(null==e?void 0:e.message)?e.message:"";return!!n.includes("Decoder failure")||!!n.includes("Codec reclaimed due to inactivity")||!("OperationError"!==t||!n.includes("initialize after flush"))}function hS(){const e=null==ld?void 0:ld.document;return!e||"string"!=typeof e.visibilityState||"visible"===e.visibilityState}function fS(){var e;const t=M(LI,this);if(!t||"number"!=typeof t.currentTime)return!1;if(t.state===Sv)return!1;const n=Date.now();if(n<M(JI,this))return!1;const i=t.currentTime;if(!Number.isFinite(i))return!1;const r="function"==typeof t.getPlacementsActiveAtTime?t.getPlacementsActiveAtTime(i):[],o=Number(null==t||null===(e=t.settings)||void 0===e?void 0:e.snapToFps),s=Number.isFinite(o)&&o>0?1/o:1/60;let a;if(Array.isArray(r)&&r.length)a=i+s;else if(a=A(tS,this,pS).call(this,i),!Number.isFinite(a))return!1;return C(JI,this,n+1500),this.log.warn("[DecodeCoordinator] attempting decoder recovery seek"),t.currentTime=a,!0}function pS(e){var t;const n=M(LI,this);if(!n)return null;const i=Array.isArray(n.placements)?n.placements:[];if(!i.length)return null;const r=Number(e);if(!Number.isFinite(r))return null;const o=Number(null==n||null===(t=n.settings)||void 0===t?void 0:t.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((e=>{const t=vm(e);if(!Number.isFinite(t))return;(!Number.isFinite(d)||t<d)&&(d=t);const n=pm(e,M(DI,this)),i=Number.isFinite(n),o=i?t+n:t;(o>t||!i)&&((o>a||!Number.isFinite(a)&&Number.isFinite(o))&&(a=o,l=t),o<=r&&o>c&&(c=o,u=i?Math.max(t,o-s):t))})),Number.isFinite(l)&&Number.isFinite(a)&&r>=a-s?l:Number.isFinite(u)?u:Number.isFinite(d)?d:null}function mS(){C(ZI,this,!1),C(eS,this,null)}function vS(){M(ZI,this)&&A(tS,this,hS).call(this)&&A(tS,this,fS).call(this)}function gS(e){if(!A(tS,this,dS).call(this,e))return;const t=M(LI,this);t&&"number"==typeof t.currentTime&&(C(ZI,this,!0),C(eS,this,e),A(tS,this,hS).call(this)&&A(tS,this,fS).call(this))}function yS(e){var t;return!!e&&(Array.isArray(null===(t=M(LI,this))||void 0===t?void 0:t.placements)?M(LI,this).placements:[]).includes(e)}function bS(e){var t;(Array.isArray(null===(t=M(LI,this))||void 0===t?void 0:t.placements)?[...M(LI,this).placements]:[]).filter((t=>"function"!=typeof e||e(t))).sort(((e,t)=>{const n=vm(e),i=vm(t);return(Number.isFinite(n)?n:Number.POSITIVE_INFINITY)-(Number.isFinite(i)?i:Number.POSITIVE_INFINITY)})).forEach((e=>{A(tS,this,kS).call(this,e)}))}async function kS(e){if(!e||!e.placementId||M(HI,this).has(e.placementId))return;if(!A(tS,this,yS).call(this,e))return;const t=e.nodeId;if(!t||!M(DI,this)||"function"!=typeof M(DI,this).get)return;const n=A(tS,this,SS).call(this,t);if(n){if(n.state&&"ready"!==n.state){if("function"==typeof n.resolve)try{await n.resolve()}catch(n){if(!A(tS,this,yS).call(this,e))return;return void this.log.warn(`[#processPlacement] Failed to resolve node ${t}`,n)}if(!A(tS,this,yS).call(this,e))return;if("ready"!==n.state)return}if(A(tS,this,DS).call(this,e))return A(tS,this,RS).call(this,e,n),void M(QI,this).add(e.placementId);A(tS,this,PS).call(this,e,n)}}function wS(e){return A(tS,this,xS).call(this,e).every((e=>A(tS,this,OS).call(this,e)))}function xS(e){return(Array.isArray(null==e?void 0:e.tracks)?e.tracks:[]).filter((e=>PI.has(null==e?void 0:e.type)))}function _S(e){if(!e||!e.id||"function"!=typeof e.on)return;if(M(KI,this).has(e.id))return;const t=()=>{A(tS,this,WS).call(this,e.id)};e.on("node:loaded",t),M(KI,this).set(e.id,t)}function TS(e){if(!e||!e.id||"function"!=typeof e.on)return;if(M(XI,this).has(e.id))return;const t=e=>A(tS,this,$S).call(this,e);e.on("segment:chunk",t),M(XI,this).set(e.id,t)}function ES(e,t){if(!e||!t)return;const n=M(YI,this).get(e)||new Set;n.add(t),M(YI,this).set(e,n)}function IS(e){return M(YI,this).get(e)||new Set}function SS(e){if(e&&M(DI,this)&&"function"==typeof M(DI,this).get)return M(DI,this).get(e)}function AS(e){if(!e)return;const t=e.fullBufferRetryTimer;null!=t&&("function"==typeof(null==ld?void 0:ld.clearTimeout)?ld.clearTimeout.bind(ld):clearTimeout)(t),e.fullBufferRetryTimer=null,e.fullBufferDecodeScheduled=!1,e.fullBufferRetryAttempts=0}function NS(e){const t=null==e?void 0:e.segmentStates;t&&"function"==typeof t.forEach&&t.forEach((e=>{A(tS,this,AS).call(this,e)}))}function MS(e,t,n,i){var r,o;if(!(e&&t&&n&&i))return!1;const s=M(HI,this).get(e),a=null==s||null===(r=s.trackStates)||void 0===r?void 0:r.get(t);return(null==a||null===(o=a.segmentStates)||void 0===o?void 0:o.get(n))===i}function FS(e){if(!e)return;A(tS,this,NS).call(this,e);const t=e.segmentDecoders;t&&"function"==typeof t.forEach&&(t.forEach((e=>{if(e&&"function"==typeof e.dispose)try{e.dispose()}catch(e){}})),"function"==typeof t.clear&&t.clear()),e.segmentStates&&"function"==typeof e.segmentStates.clear&&e.segmentStates.clear(),e.ready=!1,e.seekSegmentId=null}function CS(e){const t=RI(e);if(!Number.isFinite(t))return;const n=t-2;Number.isFinite(n)&&M(HI,this).forEach((e=>{const t=null==e?void 0:e.placement;if(!t)return;const i=vm(t),r=pm(t,M(DI,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==e?void 0:e.trackStates;s&&"function"==typeof s.forEach&&s.forEach((e=>{var t;const n=null==e||null===(t=e.track)||void 0===t?void 0:t.type;"video"!==n&&"image"!==n&&"audio"!==n||A(tS,this,FS).call(this,e)}))}))}function OS(e){if(!e||!Array.isArray(e.segments))return!1;const t=e.segments.find((e=>null==e?void 0:e.isInit));if(t&&!(t.retainedByteLength>0))return!1;const n=e.segments.find((e=>e&&!e.isInit));return!n||n.retainedByteLength>0}function PS(e,t){if(this.log.debug(`[#startDecode] [${e.placementId}] [${t.id}] Starting decode`),A(tS,this,RS).call(this,e,t)){if(A(tS,this,ES).call(this,t.id,e.placementId),!A(tS,this,wS).call(this,t))return A(tS,this,_S).call(this,t),void A(tS,this,TS).call(this,t);A(tS,this,BS).call(this,e,t),A(tS,this,TS).call(this,t)}}function RS(e,t){if(!e||!e.placementId||!t)return;const n=M(HI,this).get(e.placementId);if(n)return n.placement=e,n;const i=A(tS,this,xS).call(this,t),r=new Map;i.forEach((n=>{try{const e=n.segments.some((e=>null==e?void 0:e.isInit));r.set(n.id,{hasInit:e,track:n,ready:!1,segmentDecoders:new Map,segmentStates:new Map})}catch(i){this.trigger(ud.DECODE_ERROR,fd({placementId:e.placementId,nodeId:t.id,trackId:null==n?void 0:n.id,trackType:null==n?void 0:n.type,error:i}))}}));const o={trackStates:r,nodeId:t.id,placement:e};return M(HI,this).set(e.placementId,o),o}function DS(e){var t;const n=vm(e),i=RI(null===(t=M(LI,this))||void 0===t?void 0:t.currentTime);return!Number.isFinite(n)||!!Number.isFinite(i)&&n-i>2}function LS(e){if(!M(QI,this).size)return;const t=RI(e);if(!Number.isFinite(t))return;const n=[];M(QI,this).forEach((e=>{const i=M(HI,this).get(e),r=null==i?void 0:i.placement;if(!r)return void n.push(e);const o=vm(r);Number.isFinite(o)&&o-t<=2&&n.push(e)})),n.forEach((e=>{M(QI,this).delete(e);const t=M(HI,this).get(e),n=null==t?void 0:t.placement;if(!n)return;const i=A(tS,this,SS).call(this,n.nodeId);i&&A(tS,this,PS).call(this,n,i)}))}function BS(e,t){const n=M(HI,this).get(e.placementId);n&&A(tS,this,xS).call(this,t).forEach((i=>{const r=n.trackStates.get(i.id);if(r&&!r.ready)try{let n;if(r.seekSegmentId&&(n=i.segments.find((e=>e&&!e.isInit&&e.id===r.seekSegmentId&&e.retainedByteLength>0)),!n))return;if(n||(n=i.segments.find((e=>e&&!e.isInit&&e.retainedByteLength>0))),!n)return;A(tS,this,HS).call(this,e,i,n),r.seekSegmentId&&"video"===(null==i?void 0:i.type)&&A(tS,this,zS).call(this,e,i,n),r.ready=!0,this.trigger(ud.DECODE_READY,hd({placementId:e.placementId,nodeId:t.id,trackId:i.id,trackType:i.type}))}catch(n){this.trigger(ud.DECODE_ERROR,fd({placementId:e.placementId,nodeId:t.id,trackId:null==i?void 0:i.id,trackType:null==i?void 0:i.type,error:n}))}}))}function zS(e,t,n){var i;if(!(e&&t&&n&&Array.isArray(t.segments)))return;const r=null==e?void 0:e.placementId,o=r?M(HI,this).get(r):void 0,s=null==o||null===(i=o.trackStates)||void 0===i?void 0:i.get(t.id),a=null==s?void 0:s.segmentDecoders;if(!a||"function"!=typeof a.has)return;const l=t.segments,c=l.findIndex((e=>(null==e?void 0:e.id)===n.id));if(c<0)return;let u=0;for(let n=c+1;n<l.length;n+=1){const i=l[n];if(!i||i.isInit)continue;if(a.has(i.id))continue;if(!(i.retainedByteLength>0))break;const r=i.arrayBuffer;if(!r||"number"!=typeof r.byteLength||r.byteLength<=0)break;if(A(tS,this,HS).call(this,e,t,i),u+=1,u>=2)break}}function WS(e){const t=A(tS,this,SS).call(this,e);t&&A(tS,this,wS).call(this,t)&&A(tS,this,IS).call(this,e).forEach((e=>{const n=M(HI,this).get(e);A(tS,this,BS).call(this,(null==n?void 0:n.placement)||{placementId:e},t)}))}function $S(e){e&&e.nodeId&&e.trackId&&e.chunk&&A(tS,this,IS).call(this,e.nodeId).forEach((t=>A(tS,this,jS).call(this,t,e)))}function jS(e,t){const n=M(HI,this).get(e);if(!n)return;const i=n.trackStates.get(t.trackId);if(i)try{var r,o;if(t.isInit)return;const s=i.track,a=null==s||null===(r=s.segments)||void 0===r?void 0:r.find((e=>(null==e?void 0:e.id)===t.segmentId));if(!a||a.isInit)return;if("image"===(null==s?void 0:s.type))return void(!i.ready&&a.retainedByteLength>0&&A(tS,this,HS).call(this,n.placement,s,a)&&(i.ready=!0,this.trigger(ud.DECODE_READY,hd({placementId:e,nodeId:t.nodeId,trackId:t.trackId,trackType:t.trackType}))));if((null===(o=M(LI,this))||void 0===o?void 0:o.state)===Sv&&i.seekSegmentId&&("video"===(null==s?void 0:s.type)||"audio"===(null==s?void 0:s.type))&&a.id!==i.seekSegmentId)return;const l=a.id,c=i.segmentStates.get(l)||{initSent:!1,pendingChunks:[],ended:!1,firstChunkObserved:!1,missedSegmentPrefix:!1,fullBufferDecodeScheduled:!1,fullBufferRetryTimer:null,fullBufferRetryAttempts:0};i.segmentStates.set(l,c);const u=A(tS,this,VS).call(this,n.placement,s,a);if(!u||"function"!=typeof u.decodeChunk)return;if(i.hasInit&&!c.initSent){const e=A(tS,this,GS).call(this,s,a);if(!e)return void c.pendingChunks.push({chunk:t.chunk,loaded:t.loaded,total:t.total});u.decodeChunk(e,{isInit:!0}),c.initSent=!0,c.pendingChunks.length&&(c.pendingChunks.forEach((e=>{u.decodeChunk(e.chunk,{isInit:!1,loaded:e.loaded,total:e.total})})),c.pendingChunks=[])}const d="number"==typeof t.loaded&&"number"==typeof t.total&&t.total>0&&t.loaded>=t.total;A(tS,this,US).call(this,c,t)?d&&!c.ended&&A(tS,this,qS).call(this,n.placement,s,a,c):(u.decodeChunk(t.chunk,{isInit:!1,loaded:t.loaded,total:t.total}),d&&!c.ended&&"function"==typeof u.endOfStream&&(c.ended=!0,u.endOfStream())),i.ready||(i.ready=!0,this.trigger(ud.DECODE_READY,hd({placementId:e,nodeId:t.nodeId,trackId:t.trackId,trackType:t.trackType})))}catch(n){this.trigger(ud.DECODE_ERROR,fd({placementId:e,nodeId:t.nodeId,trackId:t.trackId,trackType:t.trackType,error:n}))}}function US(e,t){var n;if(!e||e.missedSegmentPrefix)return!(null==e||!e.missedSegmentPrefix);if(e.firstChunkObserved)return!1;e.firstChunkObserved=!0;const i=Number(null==t?void 0:t.loaded),r=Number(null==t||null===(n=t.chunk)||void 0===n?void 0:n.byteLength);return!(!Number.isFinite(i)||!Number.isFinite(r)||r<=0)&&(e.missedSegmentPrefix=i>r,e.missedSegmentPrefix)}function qS(e,t,n,i){if(!e||!t||!n||!i||i.fullBufferDecodeScheduled)return;const r=null==e?void 0:e.placementId,o=null==t?void 0:t.id,s=null==n?void 0:n.id;if(!r||!o||!s)return;const a="function"==typeof(null==ld?void 0:ld.setTimeout)?ld.setTimeout.bind(ld):setTimeout;i.fullBufferDecodeScheduled=!0,i.fullBufferRetryAttempts=0;const l=()=>{if(!A(tS,this,MS).call(this,r,o,s,i)||i.ended)return void A(tS,this,AS).call(this,i);if(A(tS,this,HS).call(this,e,t,n))return void A(tS,this,AS).call(this,i);i.fullBufferRetryAttempts+=1;const c=i.fullBufferRetryAttempts<=8?0:50;i.fullBufferRetryTimer=a((()=>{l()}),c)};i.fullBufferRetryTimer=a((()=>{l()}),0)}function VS(e,t,n){var i,r;const o=null==e?void 0:e.placementId;if(!o||!t||!n)return;const s=M(HI,this).get(o),a=null==s||null===(i=s.trackStates)||void 0===i?void 0:i.get(t.id);if(!a)return;const l=a.segmentDecoders.get(n.id);if(l)return l;const c=M(BI,this).create(t);if(c&&"function"==typeof c.configure&&c.configure(t),c&&"function"==typeof c.setNodeId&&c.setNodeId(null==e?void 0:e.nodeId),c&&"function"==typeof c.setSegment&&c.setSegment(n),c&&"function"==typeof c.setCurrentTimeProvider&&c.setCurrentTimeProvider((()=>{var e;return"number"==typeof(null===(e=M(LI,this))||void 0===e?void 0:e.currentTime)?M(LI,this).currentTime:0})),c&&"function"==typeof c.setTimeOffsetSeconds){var u,d;const i=vm(e),r=RI(null==t?void 0:t.offset),o=RI(null!==(u=null==n||null===(d=n.chosenRepresentation)||void 0===d?void 0:d.segStart)&&void 0!==u?u:null==n?void 0:n.offset);Number.isFinite(i)&&c.setTimeOffsetSeconds(i+r+o)}return c&&"function"==typeof c.setSeekTargetTimeSeconds&&(null===(r=M(LI,this))||void 0===r?void 0:r.state)===Sv&&"video"===(null==t?void 0:t.type)&&c.setSeekTargetTimeSeconds(M(LI,this).currentTime),c&&"function"==typeof c.on&&(c.on(ud.DECODER_FRAME,(i=>{i&&(!M(ZI,this)||"video"!==(null==t?void 0:t.type)&&"image"!==(null==t?void 0:t.type)||(C(ZI,this,!1),C(eS,this,null)),M(LI,this)&&"function"==typeof M(LI,this).notifyDecodedFrame&&(i.frame||i.data)&&M(LI,this).notifyDecodedFrame({placementId:o,nodeId:null==e?void 0:e.nodeId,trackId:null==t?void 0:t.id,trackType:null==t?void 0:t.type,segmentId:null==n?void 0:n.id,pts:i.pts,duration:i.duration,frame:i.frame,data:i.data}))})),c.on(ud.DECODER_AUDIO,(i=>{i&&i.audioBuffer&&this.trigger(ud.DECODER_AUDIO,hd({placementId:o,nodeId:null==e?void 0:e.nodeId,trackId:null==t?void 0:t.id,trackType:null==t?void 0:t.type,segmentId:null==n?void 0:n.id,pts:i.pts,duration:i.duration,audioBuffer:i.audioBuffer}))})),c.on(ud.DECODER_ERROR,(i=>{const r=(null==i?void 0:i.error)||i;this.trigger(ud.DECODER_ERROR,fd({placementId:o,nodeId:null==e?void 0:e.nodeId,trackId:null==t?void 0:t.id,trackType:null==t?void 0:t.type,segmentId:null==n?void 0:n.id,error:r})),A(tS,this,gS).call(this,r)}))),a.segmentDecoders.set(n.id,c),c}function GS(e,t){var n,i;if(!e||!t||!Array.isArray(e.segments))return;const r=e.segments.find((e=>null==e?void 0:e.isInit));if(!r||"function"!=typeof r.getRepresentationBuffer)return;const o=(null==t||null===(n=t.chosenRepresentation)||void 0===n?void 0:n.id)||(null==t||null===(i=t.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 HS(e,t,n){var i;if(!e||!t||!n)return!1;const r=e.placementId,o=M(HI,this).get(r),s=null==o||null===(i=o.trackStates)||void 0===i?void 0:i.get(t.id);if(!s)return!1;const a=A(tS,this,VS).call(this,e,t,n);if(!a||"function"!=typeof a.decodeChunk)return!1;const l=s.segmentStates.get(n.id)||{initSent:!1,pendingChunks:[],ended:!1,firstChunkObserved:!1,missedSegmentPrefix:!1,fullBufferDecodeScheduled:!1,fullBufferRetryTimer:null,fullBufferRetryAttempts:0};if(s.segmentStates.set(n.id,l),l.ended)return A(tS,this,AS).call(this,l),!0;if(s.hasInit&&!l.initSent){const e=A(tS,this,GS).call(this,t,n);if(!e)return!1;a.decodeChunk(e,{isInit:!0}),l.initSent=!0}const c=n.arrayBuffer;return!(!c||"number"!=typeof c.byteLength||c.byteLength<=0||(a.decodeChunk(new Uint8Array(c),{isInit:!1,loaded:c.byteLength,total:c.byteLength}),l.ended||"function"!=typeof a.endOfStream||(l.ended=!0,a.endOfStream()),A(tS,this,AS).call(this,l),0))}const KS=1e-6;var XS=new WeakMap,YS=new WeakMap,QS=new WeakMap,JS=new WeakMap,ZS=new WeakMap,eA=new WeakMap,tA=new WeakMap,nA=new WeakMap,iA=new WeakSet;class rA extends od{get name(){return"TransitionManager"}get defaults(){return{durationSeconds:.5}}constructor(e,t,n){super(n),O(this,iA),F(this,XS,void 0),F(this,YS,void 0),F(this,QS,null),F(this,JS,null),F(this,ZS,null),F(this,eA,0),F(this,tA,[]),F(this,nA,null),C(XS,this,e),C(YS,this,t),M(XS,this)&&"function"==typeof M(XS,this).on&&(C(nA,this,(()=>A(iA,this,fA).call(this))),M(XS,this).on(ud.TIMELINE_RESET,M(nA,this)))}transitionTo(e,t={}){const n=Number(e);if(!Number.isFinite(n))throw new Error("TransitionManager.transitionTo requires a numeric time");A(iA,this,fA).call(this);const i=A(iA,this,oA).call(this),r=A(iA,this,cA).call(this,n,t);return r?A(iA,this,uA).call(this,n,t,i,r):Promise.resolve()}onDispose(){M(XS,this)&&"function"==typeof M(XS,this).off&&M(nA,this)&&M(XS,this).off(ud.TIMELINE_RESET,M(nA,this)),C(nA,this,null),A(iA,this,fA).call(this),C(YS,this,null),C(XS,this,null)}}function oA(){return C(eA,this,M(eA,this)+1),M(eA,this)}function sA(e={}){var t;const n=Number(null==e?void 0:e.duration),i=Number(null===(t=this.settings)||void 0===t?void 0:t.durationSeconds);return Number.isFinite(n)?n:i}function aA(e={},t){return{duration:t,filter:null==e?void 0:e.filter,color:null==e?void 0:e.color,filters:null==e?void 0:e.filters,reverseFilters:null==e?void 0:e.reverseFilters,transition:null==e?void 0:e.transition}}function lA(e,t){const n=1e3*e,i=Number.isFinite(Number(null==t?void 0:t.outDurationMs))&&t.outDurationMs>0?t.outDurationMs:n;return{outDurationMs:i,inDurationMs:Number.isFinite(Number(null==t?void 0:t.inDurationMs))&&t.inDurationMs>0?t.inDurationMs:i}}function cA(e,t={}){var n;const i=M(YS,this),r=A(iA,this,sA).call(this,t);if(!i||"function"!=typeof i.startTransition)return M(XS,this).currentTime=e,null;if(!(r>0))return M(XS,this).currentTime=e,null!==(n=i.resetTransition)&&void 0!==n&&n.call(i),null;const o=A(iA,this,aA).call(this,t,r);"function"==typeof(null==t?void 0:t.onTransitionInStart)&&t.onTransitionInStart();const s=i.startTransition(o),{outDurationMs:a,inDurationMs:l}=A(iA,this,lA).call(this,r,s);return{renderer:i,transitionOptions:o,outDurationMs:a,inDurationMs:l,shouldWaitForFrames:!1!==(null==t?void 0:t.waitForVisualFrames)}}function uA(e,t={},n,i){const{renderer:r,transitionOptions:o,outDurationMs:s,inDurationMs:a,shouldWaitForFrames:l}=i,c=A(iA,this,yA).call(this,e,t,n),u=l?A(iA,this,bA).call(this,e,n):Promise.resolve();let d=!1,h=!1,f=!1,p=!l;const m=()=>{var e;A(iA,this,pA).call(this,n)&&!f&&d&&h&&p&&(f=!0,"function"==typeof(null==t?void 0:t.onTransitionInEnd)&&t.onTransitionInEnd(),"function"==typeof(null==t?void 0:t.onTransitionOutStart)&&t.onTransitionOutStart(),null!==(e=r.beginTransitionIn)&&void 0!==e&&e.call(r,o),C(JS,this,setTimeout((()=>{var e;A(iA,this,pA).call(this,n)&&(null!==(e=r.resetTransition)&&void 0!==e&&e.call(r),"function"==typeof(null==t?void 0:t.onTransitionOutEnd)&&t.onTransitionOutEnd(),A(iA,this,dA).call(this))}),a)))};return C(QS,this,setTimeout((()=>{d=!0,m()}),s)),c.then((()=>{h=!0,m()})).catch((()=>{var e;A(iA,this,pA).call(this,n)&&(null!==(e=r.resetTransition)&&void 0!==e&&e.call(r),A(iA,this,dA).call(this))})),u.then((()=>{p=!0,m()})).catch((()=>{p=!0,m()})),M(XS,this).currentTime=e,new Promise((e=>{C(ZS,this,e)}))}function dA(){const e=M(ZS,this);C(ZS,this,null),A(iA,this,hA).call(this),A(iA,this,gA).call(this),e&&e()}function hA(){M(QS,this)&&clearTimeout(M(QS,this)),M(JS,this)&&clearTimeout(M(JS,this)),C(QS,this,null),C(JS,this,null)}function fA(){var e,t;M(YS,this)&&null!==(e=(t=M(YS,this)).resetTransition)&&void 0!==e&&e.call(t),A(iA,this,hA).call(this),A(iA,this,gA).call(this),M(ZS,this)&&(M(ZS,this).call(this),C(ZS,this,null))}function pA(e){return M(eA,this)===e}function mA(e,t){M(XS,this)&&"function"==typeof M(XS,this).on&&(M(XS,this).on(e,t),M(tA,this).push({eventName:e,handler:t}))}function vA(e,t){M(XS,this)&&"function"==typeof M(XS,this).off&&(M(XS,this).off(e,t),C(tA,this,M(tA,this).filter((n=>n.eventName!==e||n.handler!==t))))}function gA(){M(XS,this)&&"function"==typeof M(XS,this).off?(M(tA,this).forEach((e=>{M(XS,this).off(e.eventName,e.handler)})),C(tA,this,[])):C(tA,this,[])}function yA(e,t,n){const i=null==t?void 0:t.transitionOutPromise;if(i&&"function"==typeof i.then)return i;if("function"==typeof i)try{const e=i();if(e&&"function"==typeof e.then)return e}catch(e){return Promise.resolve()}if(!M(XS,this)||"function"!=typeof M(XS,this).on)return Promise.resolve();const r=A(iA,this,kA).call(this);return new Promise((t=>{let i=!1;const o=r?ud.TIMELINE_SEEKED:"nodestart";let s,a;const l=()=>{A(iA,this,vA).call(this,ud.TIMELINE_SEEKING,s),A(iA,this,vA).call(this,o,a),t()};s=(t={})=>{A(iA,this,pA).call(this,n)?A(iA,this,wA).call(this,t,e)&&(i=!0):l()},a=(t={})=>{A(iA,this,pA).call(this,n)?(o!==ud.TIMELINE_SEEKED||A(iA,this,wA).call(this,t,e))&&(o===ud.TIMELINE_SEEKED||i)&&l():l()},A(iA,this,mA).call(this,ud.TIMELINE_SEEKING,s),A(iA,this,mA).call(this,o,a)}))}function bA(e,t){if(!M(XS,this)||"function"!=typeof M(XS,this).on)return Promise.resolve();const n=Number(e);return new Promise((e=>{const i=(r={})=>{if(!A(iA,this,pA).call(this,t))return A(iA,this,vA).call(this,ud.VISUAL_FRAMES_AVAILABLE,i),void e();const o=Number(null==r?void 0:r.time);Number.isFinite(n)&&Number.isFinite(o)&&o+KS<n||(Array.isArray(null==r?void 0:r.frames)?r.frames:[]).length&&(A(iA,this,vA).call(this,ud.VISUAL_FRAMES_AVAILABLE,i),e())};A(iA,this,mA).call(this,ud.VISUAL_FRAMES_AVAILABLE,i)}))}function kA(){var e,t;const n=null===(e=M(XS,this))||void 0===e?void 0:e.state;if(n===Iv||n===xv)return!0;const i=null===(t=M(XS,this))||void 0===t?void 0:t.placements;return!Array.isArray(i)||0===i.length}function wA(e,t){const n=Number(null==e?void 0:e.targetTime);return!Number.isFinite(n)||Math.abs(n-t)<KS}function xA(e,t=0){const n=Number(e);return Number.isFinite(n)?n:t}var _A=new WeakMap,TA=new WeakMap,EA=new WeakMap,IA=new WeakMap,SA=new WeakMap,AA=new WeakMap,NA=new WeakMap,MA=new WeakMap,FA=new WeakMap,CA=new WeakMap,OA=new WeakMap,PA=new WeakMap,RA=new WeakMap,DA=new WeakMap,LA=new WeakSet;class BA extends od{get name(){return"AudioPlaybackManager"}get defaults(){return{muted:!1,volume:1,lookaheadSeconds:1}}constructor(e,t,n){super(n),O(this,LA),F(this,_A,void 0),F(this,TA,void 0),F(this,EA,null),F(this,IA,null),F(this,SA,[]),F(this,AA,new Set),F(this,NA,new Map),F(this,MA,!1),F(this,FA,1),F(this,CA,!0),F(this,OA,null),F(this,PA,null),F(this,RA,null),F(this,DA,null),C(_A,this,e),C(TA,this,t),C(MA,this,!!this.settings.muted),C(FA,this,hm(this.settings.volume));const i=Array.isArray(null==n?void 0:n.disabledTracks)?n.disabledTracks:[];C(CA,this,!i.includes("audio")),A(LA,this,zA).call(this)}get muted(){return M(MA,this)}set muted(e){C(MA,this,!!e),A(LA,this,YA).call(this)}get volume(){return M(FA,this)}set volume(e){C(FA,this,hm(e)),A(LA,this,YA).call(this)}handleDecodedAudio(e={}){if(!M(CA,this))return;const t=null==e?void 0:e.audioBuffer,n=null==e?void 0:e.placementId,i=null==e?void 0:e.segmentId,r=xA(null==e?void 0:e.pts,null);if(!(t&&n&&i&&Number.isFinite(r)))return;const o=Number.isFinite(null==e?void 0:e.duration)?e.duration:t.duration,s=`${n}:${i}`;M(AA,this).has(s)||(M(SA,this).push({key:s,placementId:n,pts:r,duration:o,audioBuffer:t}),M(SA,this).sort(((e,t)=>e.pts-t.pts)),A(LA,this,qA).call(this))}onDispose(){A(LA,this,WA).call(this),A(LA,this,KA).call(this,!0),M(EA,this)&&"function"==typeof M(EA,this).close&&M(EA,this).close(),C(EA,this,null),C(IA,this,null),C(_A,this,null),C(TA,this,null)}}function zA(){M(_A,this)&&"function"==typeof M(_A,this).on&&(C(OA,this,(e=>A(LA,this,$A).call(this,e))),M(_A,this).on(ud.TIMELINE_TIME_UPDATE,M(OA,this)),C(PA,this,(e=>A(LA,this,jA).call(this,e))),M(_A,this).on(ud.TIMELINE_STATE_CHANGE,M(PA,this)),C(DA,this,(()=>A(LA,this,UA).call(this))),M(_A,this).on(ud.TIMELINE_RESET,M(DA,this))),M(TA,this)&&"function"==typeof M(TA,this).on&&(C(RA,this,(e=>this.handleDecodedAudio(e))),M(TA,this).on(ud.DECODER_AUDIO,M(RA,this)))}function WA(){M(_A,this)&&"function"==typeof M(_A,this).off&&(M(OA,this)&&M(_A,this).off(ud.TIMELINE_TIME_UPDATE,M(OA,this)),M(PA,this)&&M(_A,this).off(ud.TIMELINE_STATE_CHANGE,M(PA,this)),M(DA,this)&&M(_A,this).off(ud.TIMELINE_RESET,M(DA,this))),M(TA,this)&&"function"==typeof M(TA,this).off&&M(RA,this)&&M(TA,this).off(ud.DECODER_AUDIO,M(RA,this)),C(OA,this,null),C(PA,this,null),C(RA,this,null),C(DA,this,null)}function $A(){A(LA,this,qA).call(this)}function jA(e={}){const t=null==e?void 0:e.to;if(t)return t===_v?(A(LA,this,QA).call(this),void A(LA,this,qA).call(this)):void(t!==Iv&&t!==Ev?t!==Sv&&t!==Av||A(LA,this,UA).call(this):A(LA,this,JA).call(this))}function UA(){A(LA,this,JA).call(this),A(LA,this,KA).call(this,!0),C(SA,this,[])}function qA(){if(!M(CA,this)||!M(_A,this))return;if(M(_A,this).state!==_v)return;const e=A(LA,this,XA).call(this);if(!e)return;const t=xA(M(_A,this).currentTime,0),n=t+Math.max(0,xA(this.settings.lookaheadSeconds,1)),i=[];for(let r=0;r<M(SA,this).length;r+=1){const o=M(SA,this)[r];o&&(o.pts>n?i.push(o):A(LA,this,VA).call(this,o)&&A(LA,this,HA).call(this,o,e,t))}C(SA,this,i)}function VA(e){if(!e||!M(_A,this))return!1;const t=A(LA,this,GA).call(this,e.pts);return!(!t||t!==e.placementId)}function GA(e){if(!M(_A,this)||"function"!=typeof M(_A,this).getPlacementsActiveAtTime)return null;const t=M(_A,this).getPlacementsActiveAtTime(e);if(!Array.isArray(t)||!t.length)return null;const n=t.find((e=>null==e?void 0:e.placementId));return n?n.placementId:null}function HA(e,t,n){const i=e.key;if(M(AA,this).has(i))return;const r=e.audioBuffer;if(!r)return;const o=Number.isFinite(e.duration)?e.duration:r.duration,s=e.pts;if(!Number.isFinite(s))return;const a=n-s;if(Number.isFinite(o)&&o>0&&a>=o)return;const l=t.createBufferSource();l.buffer=r,l.connect(M(IA,this));let c=t.currentTime,u=0;a>0?u=a:a<0&&(c=t.currentTime+Math.abs(a));try{l.start(c,u)}catch(e){return void this.log.warn("[AudioPlaybackManager] Failed to start audio buffer",e)}M(AA,this).add(i),M(NA,this).set(i,l),l.onended=()=>{M(NA,this).delete(i)}}function KA(e){M(NA,this).forEach(((e,t)=>{if(e&&"function"==typeof e.stop)try{e.stop()}catch(e){}M(NA,this).delete(t)})),e&&M(AA,this).clear()}function XA(){if(M(EA,this))return M(EA,this);const e=ld.AudioContext||ld.webkitAudioContext;if(!e)return this.log.warn("[AudioPlaybackManager] AudioContext is not available."),null;try{return C(EA,this,new e),C(IA,this,M(EA,this).createGain()),M(IA,this).connect(M(EA,this).destination),A(LA,this,YA).call(this),M(EA,this)}catch(e){return this.log.warn("[AudioPlaybackManager] Failed to initialize AudioContext",e),C(EA,this,null),C(IA,this,null),null}}function YA(){if(!M(IA,this))return;const e=M(MA,this)?0:M(FA,this);M(IA,this).gain.value=e}function QA(){M(EA,this)&&"function"==typeof M(EA,this).resume&&"suspended"===M(EA,this).state&&M(EA,this).resume().catch((()=>{}))}function JA(){M(EA,this)&&"function"==typeof M(EA,this).suspend&&"running"===M(EA,this).state&&M(EA,this).suspend().catch((()=>{}))}var ZA=new WeakMap,eN=new WeakMap,tN=new WeakMap,nN=new WeakMap,iN=new WeakMap,rN=new WeakSet;class oN extends od{constructor(...e){super(...e),O(this,rN),F(this,ZA,void 0),F(this,eN,void 0),F(this,tN,void 0),F(this,nN,void 0),F(this,iN,void 0),C(ZA,this,A(rN,this,aN).call(this,this.settings.currentTime)),C(eN,this,A(rN,this,lN).call(this,this.settings.playbackRate)),C(tN,this,null),C(nN,this,!1),C(iN,this,A(rN,this,sN).bind(this))}get name(){return"PlaybackClock"}get defaults(){return{currentTime:0,playbackRate:Hy("playbackRate")}}get currentTime(){return M(ZA,this)}get playbackRate(){return M(eN,this)}set playbackRate(e){C(eN,this,A(rN,this,lN).call(this,e))}play(){M(nN,this)||(C(nN,this,!0),C(tN,this,My()),fw(M(iN,this),0))}pause(){M(nN,this)&&(C(nN,this,!1),pw(M(iN,this)))}seek(e){C(ZA,this,A(rN,this,aN).call(this,e)),C(tN,this,My())}reset(){this.pause(),C(ZA,this,0),C(tN,this,null)}onDispose(){this.pause(),C(iN,this,null)}}function sN(){const e=My();if(null===M(tN,this))return C(tN,this,e),void this.trigger(ud.CLOCK_TICK,{currentTime:M(ZA,this)});const t=e-M(tN,this);C(tN,this,e);const n=t/1e3;C(ZA,this,M(ZA,this)+n*M(eN,this)),this.trigger(ud.CLOCK_TICK,{currentTime:M(ZA,this)})}function aN(e){return"number"!=typeof e||Number.isNaN(e)||!Number.isFinite(e)||e<0?0:e}function lN(e){return"number"!=typeof e||Number.isNaN(e)||!Number.isFinite(e)||e<=0?M(eN,this)||1:e}var cN=new WeakMap,uN=new WeakSet;class dN extends od{constructor(...e){super(...e),O(this,uN),F(this,cN,new Map)}get name(){return"TrackBuffers"}get defaults(){return{}}refreshNode(e){if(!e||!Array.isArray(e.tracks))return;const t=e.id,n=M(cN,this).get(t)||new Map;M(cN,this).set(t,n),e.tracks.forEach((e=>{const i=null==e?void 0:e.type;if(!i)return;const r=e.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(ud.TRACK_BUFFER_UPDATE,{nodeId:t,trackType:i,range:r})),!s&&a?this.trigger(ud.TRACK_READY,{nodeId:t,trackType:i,range:r}):s&&!a&&this.trigger(ud.TRACK_UNDERFLOW,{nodeId:t,trackType:i,range:r})}))}getTrackRange(e,t){const n=M(cN,this).get(e),i=null==n?void 0:n.get(t);return null==i?void 0:i.range}computeBuffered(e=[],t=0,n){if(!n||"function"!=typeof n.get)return;const i=Number.isFinite(t)?t:0;let r,o,s=!1;for(let t=0;t<e.length;t+=1){const a=A(uN,this,fN).call(this,n,e[t],i);if(!a||a.end<=i)continue;if(void 0===r){r=a.start,o=a.end,s=a.full;continue}const l=a.start<=o,c=s&&a.full;if(!l&&!c)break;o=Math.max(o,a.end),s=a.full}return void 0===r||void 0===o?{start:0,end:0}:{start:r,end:o}}get buffered(){return M(cN,this)}reset(){M(cN,this).clear()}onDispose(){M(cN,this).clear(),"function"==typeof this.off&&this.off()}}function hN(e,t=0){const n=Array.isArray(null==e?void 0:e.segments)?e.segments:[],i=[];for(let e=0;e<n.length;e+=1){const t=n[e];if(!t||t.isInit)continue;const r=Number(t.duration),o=Number(t.offset),s=Number(t.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(((e,t)=>e.start-t.start));const r=[i[0]];for(let e=1;e<i.length;e+=1){const t=i[e],n=r[r.length-1];t.start<=n.end+.001?n.end=Math.max(n.end,t.end):r.push({...t})}const o=Number.isFinite(t)?t:0;for(let e=0;e<r.length;e+=1){const t=r[e];if(t.end>o+.001)return t}}function fN(e,t,n=0){var i,r;const o=vm(t);if(!Number.isFinite(o))return;const s=e.get(t.nodeId);if(!s)return;const a=Array.isArray(s.tracks)?s.tracks:[];if(!a.length){const e=s.buffered;if(!e||!Number.isFinite(e.start)||!Number.isFinite(e.end))return;return A(uN,this,pN).call(this,s,e,o,t)}const l=s.mainTrackId,c=Number.isFinite(t.nodeOffsetOverride)?t.nodeOffsetOverride:0,u=Math.max(0,n-o+c);let d;l&&(d=a.find((e=>(null==e?void 0:e.id)===l))),(null===(i=d)||void 0===i?void 0:i.type)||(d=a.find((e=>null==e?void 0:e.type)));const h=A(uN,this,hN).call(this,d,u)||(null===(r=d)||void 0===r?void 0:r.buffered);return h&&Number.isFinite(h.start)&&Number.isFinite(h.end)?A(uN,this,pN).call(this,s,h,o,t):void 0}function pN(e,t,n,i){const r=Number.isFinite(i.nodeOffsetOverride)?i.nodeOffsetOverride:0;let o=t.start-r+n,s=t.end-r+n;const a=e.duration,l=Number.isFinite(i.nodeDurationOverride)?i.nodeDurationOverride:a;if(Number.isFinite(l)){const e=n+l;s=Math.min(s,e);const t=o<=n&&s>=e;if(o=Math.max(o,n),!(s>o))return;return{start:o,end:s,full:t}}if(o=Math.max(o,n),s>o)return{start:o,end:s,full:!1}}class mN{constructor(e={}){const{placementId:t,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}=e;if(!t)throw new Error("Placement requires placementId");if(!n)throw new Error("Placement requires nodeId");this.placementId=t,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 vN extends od{constructor(e,t){super(t),this.timeline=e}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"handleDecodedFrame","handleClockTick","handleMainTrackBufferUpdate"])}enter(){}exit(){}play(){this.timeline.transitionTo(_v)}pause(){this.timeline.transitionTo(Iv)}wait(){this.timeline.transitionTo(Ev)}reset(){this.timeline.transitionTo(Av)}seek(e){this.timeline.transitionTo(Sv,{targetTime:e,returnState:this.timeline.state})}getCurrentTime(){return this.timeline.currentTime}emitPlayerStateEvent(e,t={}){if(!e||!this.timeline||"function"!=typeof this.timeline.trigger)return;const n=Number.isFinite(null==t?void 0:t.time)?t.time:this.getCurrentTime(),i={...t,event:e};Number.isFinite(n)&&(i.time=n),this.timeline.trigger("player:state",i)}get buffered(){return this.timeline.computeBuffered(this.timeline.currentTime)}handleMainTrackUnderflow(e){this.wait()}handleMainTrackReady(e){const t=this.timeline.getLastStableState()||Iv;this.timeline.transitionTo(t)}handleMainTrackBufferUpdate(e){}handleDecodedFrame(e){}handleClockTick(e){}onDispose(){this.timeline=null}}const gN=24e3/1001;function yN(e,t=(null==e?void 0:e.currentTime)){return Number.isFinite(t)?t:Number.isFinite(null==e?void 0:e.currentTime)?e.currentTime:0}function bN(e){var t;const n=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.snapToFps);return Number.isFinite(n)&&n>0?.5/n:.001}function kN(e){var t;const n=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[];let i;if(null!=e&&e.mainTrackId){const t=n.find((t=>(null==t?void 0:t.id)===e.mainTrackId));i=null==t?void 0:t.type}if(i||(i=null===(t=n.find((e=>null==e?void 0:e.type)))||void 0===t?void 0:t.type),"video"===i||"audio"===i||"image"===i)return i}function wN(e){const t=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[];if(t.length){if(null!=e&&e.mainTrackId){const n=t.find((t=>(null==t?void 0:t.id)===e.mainTrackId));if("video"===(null==n?void 0:n.type)||"image"===(null==n?void 0:n.type))return n}return t.find((e=>"video"===(null==e?void 0:e.type)||"image"===(null==e?void 0:e.type)))}}function xN(e,t,n,i,r){var o,s;const a="function"==typeof(null==e?void 0:e.getDecodedVisualBuffer)?e.getDecodedVisualBuffer(t,n):void 0;if(!a)return"function"==typeof(null==e?void 0:e.hasDecodedFirstFrame)&&e.hasDecodedFirstFrame(t,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 e=0;e<l.length;e+=1){const t=l[e],n=Number(null==t?void 0:t.presentationTime);if(Number.isFinite(n)){if(!(n<=r)){c=n;break}u=t}}const d=Number(null===(s=u)||void 0===s?void 0:s.presentationTime);if(!Number.isFinite(d)||d>r)return!1;const h=function(e,t,n,i){const r=Number(null==n?void 0:n.duration);if(Number.isFinite(r)&&r>0)return t+r;const o=function(e,t){const n=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.snapToFps);return 2/(Number.isFinite(n)&&n>0?n:gN)}(e),s=Number.isFinite(i)&&i>t?i-t:o;return t+Math.min(s,o)}(e,d,u,c);return!!Number.isFinite(h)&&r<=h+bN(e)}function _N(e,t=(null==e?void 0:e.currentTime)){const n=yN(e,t),i="function"==typeof(null==e?void 0:e.getPlacementsActiveAtTime)?e.getPlacementsActiveAtTime(n):[];if(!i.length)return!1;for(let t=0;t<i.length;t+=1){const n=i[t],r=null==n?void 0:n.placementId;if(!r)return!0;const o="function"==typeof(null==e?void 0:e.getNode)?e.getNode(n.nodeId):void 0;if(!o)return!0;const s=kN(o);if(!s)return!0;if(!e.hasDecodedFirstFrame(r,s))return!0}return!1}function TN(e,t=(null==e?void 0:e.currentTime)){return _N(e,t)||function(e,t=(null==e?void 0:e.currentTime)){const n=yN(e,t),i="function"==typeof(null==e?void 0:e.getPlacementsActiveAtTime)?e.getPlacementsActiveAtTime(n):[];if(!i.length)return!1;for(let t=0;t<i.length;t+=1){const r=i[t],o=null==r?void 0:r.placementId;if(!o)return!0;const s="function"==typeof(null==e?void 0:e.getNode)?e.getNode(r.nodeId):void 0;if(!s)return!0;const a=wN(s);if(null!=a&&a.id&&!xN(e,o,a.id,a.type,n))return!0}return!1}(e,t)}function EN(e,t=(null==e?void 0:e.currentTime)){if("function"!=typeof(null==e?void 0:e.computeBuffered))return!1;const n=yN(e,t),i=e.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=bN(e);if(!(r<=n+s))return!1;return o-n>=function(e,t){const n=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.waitingBufferAheadSeconds);return!Number.isFinite(n)||n<0?3:n}(e)-s||function(e,t,n,i){const r=function(e){const t=Array.isArray(null==e?void 0:e.placements)?e.placements:[];let n;for(let i=0;i<t.length;i+=1){const r=t[i],o=vm(r);if(!Number.isFinite(o))continue;const s="function"==typeof(null==e?void 0:e.getPlacementDuration)?e.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}(e);return!!Number.isFinite(r)&&(t>=r-i||n>=r-i)}(e,n,o,s)}const IN={[xv]:class extends vN{get name(){return xv}get defaults(){return{autoplay:Hy("autoplay")}}enter(){this.timeline.recordStableState(Iv),this.timeline.stopPlaybackClock()}play(){const e=TN(this.timeline),t=e?Ev:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:t}),e)return this.timeline.recordStableState(_v),void this.timeline.transitionTo(Ev);this.timeline.transitionTo(t)}pause(){}handleDecodedFrame(e){if(!0!==this.settings.autoplay)return;if(!Array.isArray(this.timeline.placements)||!this.timeline.placements.length)return;if(TN(this.timeline))return;const t=this.timeline.getPlaybackStartState();this.log.info("[handleDecodedFrame] Autoplay enabled, starting playback!"),this.emitPlayerStateEvent("play",{from:this.timeline.state,to:t}),this.timeline.transitionTo(t)}},[Tv]:class extends vN{get name(){return Tv}enter(e={}){const{from:t,to:n}=e;this.timeline.recordStableState(_v),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("canplay",{from:t,to:n})}play(){}handleMainTrackUnderflow(){}pause(){this.timeline.transitionTo(Iv)}},[_v]:class extends vN{get name(){return _v}enter(e={}){const{from:t,to:n,fromFirstFramePending:i}=e;this.timeline.recordStableState(_v),this.timeline.startPlaybackClock(),!0!==i&&this.emitPlayerStateEvent("canplay",{from:t,to:n}),this.emitPlayerStateEvent("playing",{from:t,to:n})}play(){}pause(){this.timeline.transitionTo(Iv)}handleClockTick(e){const t=this.timeline.currentTime;TN(this.timeline,t)&&(this.timeline.recordStableState(_v),this.timeline.transitionTo(Ev))}},[Ev]:(Jt=new WeakMap,Zt=new WeakMap,en=new WeakSet,class extends vN{constructor(...e){super(...e),O(this,en),F(this,Jt,void 0),F(this,Zt,null)}get name(){return Ev}enter(e={}){const{from:t,to:n}=e;this.timeline.stopPlaybackClock(),A(en,this,SN).call(this),A(en,this,NN).call(this),this.emitPlayerStateEvent("waiting",{from:t,to:n}),A(en,this,CN).call(this)}exit(){A(en,this,AN).call(this),A(en,this,MN).call(this)}play(){this.timeline.recordStableState(_v);const e=A(en,this,FN).call(this),t=e?Ev:this.timeline.getPlaybackStartState();this.emitPlayerStateEvent("play",{from:this.timeline.state,to:t}),e||this.timeline.transitionTo(t)}pause(){this.timeline.transitionTo(Iv)}handleMainTrackReady(e){const t=this.timeline.getLastStableState()||Iv;t!==_v?this.timeline.transitionTo(t):A(en,this,CN).call(this)}handleDecodedFrame(e){A(en,this,CN).call(this)}handleMainTrackBufferUpdate(e){A(en,this,CN).call(this)}}),[Iv]:class extends vN{get name(){return Iv}enter(e={}){const{from:t,to:n}=e;this.timeline.recordStableState(Iv),this.timeline.stopPlaybackClock(),this.emitPlayerStateEvent("pause",{from:t,to:n})}play(){const e=TN(this.timeline),t=e?Ev:this.timeline.getPlaybackStartState();if(this.emitPlayerStateEvent("play",{from:this.timeline.state,to:t}),e)return this.timeline.recordStableState(_v),void this.timeline.transitionTo(Ev);this.timeline.transitionTo(t)}pause(){}},[Sv]:class extends vN{get name(){return Sv}enter(e={}){const{targetTime:t,returnState:n}=e;if(this.timeline&&"function"==typeof this.timeline.stopPlaybackClock&&this.timeline.stopPlaybackClock(),this.timeline&&"function"==typeof this.timeline.startSeeking)return void this.timeline.startSeeking(t,n);this.timeline.updateTime(t);const i=n===_v||n===Tv,r=i&&"function"==typeof this.timeline.getPlaybackStartState?this.timeline.getPlaybackStartState(t):i?_v:Iv;this.timeline.transitionTo(r,{fromSeeking:!0})}play(){var e;if(this.timeline&&"function"==typeof this.timeline.setSeekReturnState)return void this.timeline.setSeekReturnState(_v);const t="function"==typeof(null===(e=this.timeline)||void 0===e?void 0:e.getPlaybackStartState)?this.timeline.getPlaybackStartState():_v;this.timeline.transitionTo(t)}pause(){this.timeline&&"function"==typeof this.timeline.setSeekReturnState?this.timeline.setSeekReturnState(Iv):this.timeline.transitionTo(Iv)}handleDecodedFrame(e){this.timeline&&"function"==typeof this.timeline.maybeCompleteSeek&&this.timeline.maybeCompleteSeek(e)}},[Av]:class extends vN{get name(){return Av}enter(){this.timeline.resetClock(),this.timeline.transitionTo(xv,{fromReset:!0})}play(){}pause(){}get buffered(){return{start:0,end:0}}}};function SN(){var e;const t=null===(e=this.timeline)||void 0===e?void 0:e.trackBuffers;t&&"function"==typeof t.on&&(C(Jt,this,(e=>this.handleMainTrackBufferUpdate(e))),t.on(ud.TRACK_BUFFER_UPDATE,M(Jt,this)))}function AN(){var e;const t=null===(e=this.timeline)||void 0===e?void 0:e.trackBuffers;M(Jt,this)&&t&&"function"==typeof t.off?(t.off(ud.TRACK_BUFFER_UPDATE,M(Jt,this)),C(Jt,this,null)):C(Jt,this,null)}function NN(){if(null!==M(Zt,this))return;const e="function"==typeof(null==ld?void 0:ld.setInterval)?ld.setInterval.bind(ld):setInterval;C(Zt,this,e((()=>{var e;(null===(e=this.timeline)||void 0===e?void 0:e.state)===Ev&&A(en,this,CN).call(this)}),200))}function MN(){null!==M(Zt,this)&&(("function"==typeof(null==ld?void 0:ld.clearInterval)?ld.clearInterval.bind(ld):clearInterval)(M(Zt,this)),C(Zt,this,null))}function FN(e=(e=>null===(e=this.timeline)||void 0===e?void 0:e.currentTime)()){return function(e,t=(null==e?void 0:e.currentTime),n={}){return!!_N(e,t)||!0===n.skipBufferResume||!EN(e,t)}(this.timeline,e)}function CN(e=(e=>null===(e=this.timeline)||void 0===e?void 0:e.currentTime)()){return(this.timeline.getLastStableState()||Iv)===_v&&!A(en,this,FN).call(this,e)&&(this.timeline.transitionTo(this.timeline.getPlaybackStartState(e)),!0)}function ON(e){return e&&("string"!=typeof e.state||"ready"===e.state)}function PN(e){return(Array.isArray(null==e?void 0:e.tracks)?e.tracks:[]).some((e=>"video"===(null==e?void 0:e.type)))}function RN(e){return(Array.isArray(null==e?void 0:e.tracks)?e.tracks:[]).some((e=>"video"===(null==e?void 0:e.type)||"image"===(null==e?void 0:e.type)))}function DN(e){return e===_v||e===Tv}var LN=new WeakMap,BN=new WeakMap,zN=new WeakMap,WN=new WeakMap,$N=new WeakMap,jN=new WeakMap,UN=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 WeakSet;class JN{constructor(e={}){O(this,QN),F(this,LN,void 0),F(this,BN,void 0),F(this,zN,void 0),F(this,WN,void 0),F(this,$N,void 0),F(this,jN,void 0),F(this,UN,void 0),F(this,qN,void 0),F(this,VN,void 0),F(this,GN,null),F(this,HN,Iv),F(this,KN,[]),F(this,XN,new Set),F(this,YN,new Map),C(LN,this,e.getState),C(BN,this,e.getNode),C(zN,this,e.getPlacementsActiveAtTime),C(WN,this,e.getLastStableState),C($N,this,e.getPlaybackStartState),C(jN,this,e.clearVisualFrameBuffers),C(UN,this,e.updateTime),C(qN,this,e.transitionTo),C(VN,this,e.trigger)}start(e,t){const n=Number(e);if(!Number.isFinite(n))return;let i=t;i===Sv?i=M(HN,this):i===Ev&&"function"==typeof M(WN,this)&&(i=M(WN,this).call(this)),C(HN,this,DN(i)?_v:Iv),C(GN,this,n),M(XN,this).clear(),M(YN,this).clear(),C(KN,this,"function"==typeof M(zN,this)?M(zN,this).call(this,n):[]),"function"==typeof M(jN,this)&&M(jN,this).call(this),"function"==typeof M(UN,this)&&M(UN,this).call(this,n,{source:"seek"}),"function"==typeof M(VN,this)&&M(VN,this).call(this,ud.TIMELINE_SEEKING,{targetTime:n,placements:M(KN,this).slice()}),this.maybeComplete()}setReturnState(e){C(HN,this,DN(e)?_v:Iv)}maybeComplete(e){if(("function"==typeof M(LN,this)?M(LN,this).call(this):void 0)!==Sv)return;const t=M(GN,this);if(!Number.isFinite(t))return;const n=null==e?void 0:e.trackType,i=null==e?void 0:e.placementId;if(i&&"video"===n){const n=Number(null==e?void 0:e.pts);if(Number.isFinite(n)&&n>=t){M(XN,this).add(i);const e=M(YN,this).get(i);(!Number.isFinite(e)||n<e)&&M(YN,this).set(i,n)}}else i&&"image"===n&&function(e,t){const n=Number(null==e?void 0:e.pts),i=Number(null==e?void 0:e.duration);return!Number.isFinite(n)||(Number.isFinite(i)&&i>0?t>=n&&t<n+i:t>=n)}(e,t)&&M(XN,this).add(i);const r=Array.isArray(M(KN,this))?M(KN,this):[];if(r.length){if("function"==typeof M(BN,this)){for(let e=0;e<r.length;e+=1){const t=r[e],n=null==t?void 0:t.placementId;if(!n)return;const i=M(BN,this).call(this,t.nodeId);if(!ON(i))return;if(RN(i)&&!M(XN,this).has(n))return}A(QN,this,ZN).call(this,t,r)}}else A(QN,this,ZN).call(this,t,[])}dispose(){C(KN,this,[]),M(XN,this).clear(),M(YN,this).clear(),C(GN,this,null)}}function ZN(e,t){const n=A(QN,this,eM).call(this,e,t);if("function"==typeof M(UN,this)&&M(UN,this).call(this,n,{source:"seek"}),C(GN,this,null),C(KN,this,[]),M(XN,this).clear(),M(YN,this).clear(),"function"==typeof M(VN,this)&&M(VN,this).call(this,ud.TIMELINE_SEEKED,{targetTime:e,placements:Array.isArray(t)?t.slice():[]}),"function"==typeof M(qN,this)){const e=M(HN,this)===_v&&"function"==typeof M($N,this)?M($N,this).call(this,n):M(HN,this);M(qN,this).call(this,e,{fromSeeking:!0})}}function eM(e,t){const n=Number(e);if(!Number.isFinite(n))return e;if(!Array.isArray(t)||!t.length||"function"!=typeof M(BN,this))return n;let i=n;for(let e=0;e<t.length;e+=1){const n=t[e],r=null==n?void 0:n.placementId;if(!r)continue;if(!PN(M(BN,this).call(this,n.nodeId)))continue;const o=M(YN,this).get(r);Number.isFinite(o)&&o>i&&(i=o)}return i}function tM(e){if(e&&"function"==typeof e.close)try{e.close()}catch(e){}}function nM(e){if(!e)return;const t=Array.isArray(null==e?void 0:e.frames)?e.frames:[],n=null==e?void 0:e.current;(n?[n,...t]:t).forEach((e=>tM(null==e?void 0:e.frame)))}function iM(e){return vm(e)}function rM(e){return Number.isFinite(null==e?void 0:e.loopRootOffset)?e.loopRootOffset:iM(e)}function oM(e,t){return"string"==typeof(null==e?void 0:e.loopRootPlacementId)&&e.loopRootPlacementId?e.loopRootPlacementId:t}function sM(e){if("string"!=typeof e)return Number.NaN;const t=e.match(/(\d+)/);return t?Number(t[1]):Number.NaN}function aM(e){if(!e)return;const t=[[e.displayWidth,e.displayHeight],[e.codedWidth,e.codedHeight],[e.videoWidth,e.videoHeight],[e.naturalWidth,e.naturalHeight],[e.width,e.height]];for(let e=0;e<t.length;e+=1){const[n,i]=t[e],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}const lM=1e-6;function cM(e){return e&&("string"!=typeof e.state||"ready"===e.state)}function uM(e){const t=Number(e);return Number.isFinite(t)?t:0}function dM(e){return(Array.isArray(null==e?void 0:e.tracks)?e.tracks:[]).filter((e=>"cue"===(null==e?void 0:e.type)&&Array.isArray(null==e?void 0:e.cues)))}function hM(e){return e&&"cue"===e.type&&Array.isArray(e.cues)?e.cues:[]}var fM=new WeakMap,pM=new WeakMap,mM=new WeakMap,vM=new WeakMap,gM=new WeakMap,yM=new WeakMap,bM=new WeakMap,kM=new WeakMap,wM=new WeakSet;class xM{constructor(e={}){O(this,wM),F(this,fM,void 0),F(this,pM,void 0),F(this,mM,void 0),F(this,vM,void 0),F(this,gM,void 0),F(this,yM,void 0),F(this,bM,-1e-6),F(this,kM,null),C(fM,this,e.getPlacements),C(pM,this,e.getPlacementsActiveAtTime),C(mM,this,e.getPlacementDuration),C(vM,this,e.getNode),C(gM,this,e.triggerTimeline),C(yM,this,e.triggerNode)}handleSeeking(e,t){const n=uM(e);C(kM,this,n)}handleSeeked(e){const t=uM(e),n=M(kM,this);C(kM,this,null),Number.isFinite(n)?(A(wM,this,TM).call(this,n,t),C(bM,this,t)):C(bM,this,t)}handleTimeUpdate(e,t={}){const n=uM(e),i=M(bM,this);!0===(null==t?void 0:t.isSeeking)?C(bM,this,n):Number.isFinite(i)?n<=i?n<i&&C(bM,this,n-lM):(A(wM,this,_M).call(this,i,n),C(bM,this,n)):C(bM,this,n)}dispose(){C(kM,this,null),C(bM,this,-1e-6)}}function _M(e,t){const n="function"==typeof M(fM,this)?M(fM,this).call(this):[];A(wM,this,EM).call(this,n,e,t,{onlySticky:!1})}function TM(e,t){if("function"!=typeof M(pM,this))return;const n=M(pM,this).call(this,t);A(wM,this,EM).call(this,n,e,t,{onlySticky:!0})}function EM(e,t,n,i={}){if("function"!=typeof M(vM,this)||"function"!=typeof M(gM,this))return;if(!Array.isArray(e)||!e.length)return;const r=!0===i.onlySticky,o=[];for(let i=0;i<e.length;i+=1){const s=e[i],a=null==s?void 0:s.placementId,l=null==s?void 0:s.nodeId;if(!a||!l)continue;const c=M(vM,this).call(this,l);if(!cM(c))continue;const u=dM(c);if(!u.length)continue;const d=vm(s);if(!Number.isFinite(d))continue;const h=Number.isFinite(null==s?void 0:s.nodeOffsetOverride)?s.nodeOffsetOverride:0,f="function"==typeof M(mM,this)?M(mM,this).call(this,s):void 0,p="number"==typeof f&&Number.isFinite(f)?d+f:Number.POSITIVE_INFINITY,m=r?d-lM:t;for(let e=0;e<u.length;e+=1){const t=hM(u[e]);for(let i=0;i<t.length;i+=1){const s=t[i],c=uM(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:e,cueIndex:i}))}}}o.length&&(o.sort(((e,t)=>e.time!==t.time?e.time-t.time:e.placementOffset!==t.placementOffset?e.placementOffset-t.placementOffset:e.placementId!==t.placementId?e.placementId<t.placementId?-1:1:e.trackIndex!==t.trackIndex?e.trackIndex-t.trackIndex:e.cueIndex-t.cueIndex)),o.forEach((e=>{const t=e.cuepoint,n={time:e.time,nodeId:e.nodeId,placementId:e.placementId,cuepoint:t};M(gM,this).call(this,"cuepoint",n),M(gM,this).call(this,t.name,n),"function"==typeof M(yM,this)&&(M(yM,this).call(this,e.nodeId,"cuepoint",n),M(yM,this).call(this,e.nodeId,t.name,n))})))}let IM=class{#J;#Z=0;#ee=new Set;constructor(e){this.#J="string"==typeof e?e:""}claim(e){if(e)return this.#ee.add(e),e;let t;do{t=`${this.#J}${++this.#Z}`}while(this.#ee.has(t));return this.#ee.add(t),t}reset(){this.#Z=0,this.#ee.clear()}};const SM=24e3/1001;function AM(e){var t;const n=null==e?void 0:e.frame;if(!n||!0===n.__closed||!0===n.closed)return 0;if("function"==typeof n.allocationSize)try{const e=Number(n.allocationSize());if(Number.isFinite(e)&&e>0)return e}catch(e){}const i=Number(null==n?void 0:n.byteLength);if(Number.isFinite(i)&&i>0)return i;const r=Number(null==n||null===(t=n.data)||void 0===t?void 0:t.byteLength);if(Number.isFinite(r)&&r>0)return r;const o=function(e,t){const n=Number(null==e?void 0:e.width),i=Number(null==e?void 0:e.height);return Number.isFinite(n)&&Number.isFinite(i)&&n>0&&i>0?{width:n,height:i}:aM(t)}(e,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 NM=new WeakMap,MM=new WeakMap,FM=new WeakMap,CM=new WeakMap,OM=new WeakMap,PM=new WeakMap,RM=new WeakMap,DM=new WeakMap,LM=new WeakMap,BM=new WeakMap,zM=new WeakMap,WM=new WeakMap,$M=new WeakMap,jM=new WeakMap,UM=new WeakMap,qM=new WeakMap,VM=new WeakMap,GM=new WeakMap,HM=new WeakMap,KM=new WeakMap,XM=new WeakMap,YM=new WeakMap,QM=new WeakMap,JM=new WeakMap,ZM=new WeakMap,eF=new WeakMap,tF=new WeakMap,nF=new WeakMap,iF=new WeakMap,rF=new WeakMap,oF=new WeakMap,sF=new WeakMap,aF=new WeakMap,lF=new WeakSet;class cF extends od{constructor(...e){super(...e),O(this,lF),F(this,NM,void 0),F(this,MM,void 0),F(this,FM,void 0),F(this,CM,void 0),F(this,OM,void 0),F(this,PM,!1),F(this,RM,[]),F(this,DM,new IM("placement-")),F(this,LM,[]),F(this,BM,new IM("renderplacement-")),F(this,zM,void 0),F(this,WM,void 0),F(this,$M,void 0),F(this,jM,!1),F(this,UM,new Set),F(this,qM,new Set),F(this,VM,new Map),F(this,GM,[]),F(this,HM,0),F(this,KM,new Set),F(this,XM,new Set),F(this,YM,Number.NEGATIVE_INFINITY),F(this,QM,[]),F(this,JM,Number.NEGATIVE_INFINITY),F(this,ZM,0),F(this,eF,void 0),F(this,tF,void 0),F(this,nF,new Map),F(this,iF,null),F(this,rF,void 0),F(this,oF,void 0),F(this,sF,void 0),F(this,aF,void 0);const[t,n={}]=e;C(NM,this,t),C(eF,this,n),C(OM,this,new oN(n)),C(zM,this,new dN(n)),C(CM,this,Iv),A(lF,this,kF).call(this),A(lF,this,wF).call(this),C(rF,this,new JN({getState:()=>this.state,getNode:e=>M(NM,this)&&"function"==typeof M(NM,this).get?M(NM,this).get(e):void 0,getPlacementsActiveAtTime:e=>A(lF,this,eC).call(this,e,{endEpsilonSeconds:A(lF,this,cC).call(this)}),getLastStableState:()=>this.getLastStableState(),getPlaybackStartState:e=>this.getPlaybackStartState(e),clearVisualFrameBuffers:()=>A(lF,this,JF).call(this),updateTime:(e,t)=>this.updateTime(e,t),transitionTo:(e,t)=>this.transitionTo(e,t),trigger:(e,t)=>this.trigger(e,t)})),C(oF,this,new xM({getPlacements:()=>M(RM,this).slice(),getPlacementsActiveAtTime:e=>A(lF,this,eC).call(this,e),getPlacementDuration:e=>A(lF,this,RF).call(this,e),getNode:e=>M(NM,this)&&"function"==typeof M(NM,this).get?M(NM,this).get(e):void 0,triggerTimeline:(e,t)=>this.trigger(e,t),triggerNode:(e,t,n)=>{const i=M(NM,this)&&"function"==typeof M(NM,this).get?M(NM,this).get(e):void 0;i&&"function"==typeof i.trigger&&i.trigger(t,n)}})),C(sF,this,(()=>{var e,t;null===(e=M(oF,this))||void 0===e||null===(t=e.handleSeeked)||void 0===t||t.call(e,this.currentTime)})),this.on(ud.TIMELINE_SEEKED,M(sF,this)),C(aF,this,(e=>A(lF,this,AF).call(this,e))),this.on("nodestart",M(aF,this)),this.transitionTo(xv)}get name(){return"Timeline"}get defaults(){return{snapToFps:SM,maxBufferedVideoFrames:24}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"computeBuffered","notifyDecodedFrame","getDecodedFrameStats","getActiveRenderPlacement","maybeCompleteSeek","getPlacementsActiveAtTime","hasDecodedFirstFrame","getDecodedVisualBuffer","getPlacementDuration","getNode"])}transitionTo(e,t={}){const n=M(FM,this),i=function(e,t,n={}){const i=IN[e];return i?new i(t,n):null}(e,this,M(eF,this)),r=t&&"object"==typeof t&&!Array.isArray(t)?{...t,from:n,to:e}:{from:n,to:e};i?(M(MM,this)&&"function"==typeof M(MM,this).exit&&M(MM,this).exit(),C(MM,this,i),C(FM,this,e),"function"==typeof i.enter&&i.enter(r),this.trigger(ud.TIMELINE_STATE_CHANGE,{from:n,to:e,options:t})):this.log.warn(`Unknown state "${e}"`)}recordStableState(e){C(CM,this,e)}getLastStableState(){return M(CM,this)}enableFirstFrameRenderedGate(){C(PM,this,!0)}getPlaybackStartState(e=this.currentTime){return this.shouldWaitForFirstRenderedFrame(e)?Tv:_v}shouldWaitForFirstRenderedFrame(e=this.currentTime){if(!M(PM,this)||M(jM,this))return!1;const t=Number.isFinite(e)?e:this.currentTime,n=A(lF,this,eC).call(this,t);return Array.isArray(n)&&n.length>0}notifyFirstFrameRendered(){M(jM,this)||(C(jM,this,!0),this.state===Tv&&this.transitionTo(_v,{fromFirstFramePending:!0}))}get state(){return M(FM,this)}get paused(){return M(FM,this)===xv||M(FM,this)===Iv}get currentTime(){return M(OM,this).currentTime}set currentTime(e){M(MM,this).seek(e)}get playbackRate(){return M(OM,this).playbackRate}set playbackRate(e){M(OM,this).playbackRate=e}play(){M(MM,this).play()}pause(){M(MM,this).pause()}reset(){M(MM,this).reset()}seekToPlacement(e){if(!e)throw new Error("Timeline.seekToPlacement requires placement id");A(lF,this,FF).call(this);const t=A(lF,this,oC).call(this,e);if(!t)throw new Error("Timeline.seekToPlacement requires placement id");const n=vm(t);if(!Number.isFinite(n))throw new Error("Timeline.seekToPlacement requires resolved placement offset");return this.currentTime=n,n}updateTime(e,t={}){var n,i;A(lF,this,FF).call(this),A(lF,this,CF).call(this),M(OM,this).seek(e),A(lF,this,ZF).call(this,this.currentTime),A(lF,this,tC).call(this);const r="string"==typeof(null==t?void 0:t.source)?t.source:"set";null!==(n=M(oF,this))&&void 0!==n&&null!==(i=n.handleTimeUpdate)&&void 0!==i&&i.call(n,this.currentTime,{isSeeking:this.state===Sv}),A(lF,this,NF).call(this,this.currentTime),A(lF,this,HF).call(this,this.currentTime),this.trigger(ud.TIMELINE_TIME_UPDATE,dd(this.currentTime,r))}startSeeking(e,t){var n,i;null!==(n=M(oF,this))&&void 0!==n&&null!==(i=n.handleSeeking)&&void 0!==i&&i.call(n,this.currentTime,e),M(rF,this)&&"function"==typeof M(rF,this).start&&M(rF,this).start(e,t)}setSeekReturnState(e){M(rF,this)&&"function"==typeof M(rF,this).setReturnState&&M(rF,this).setReturnState(e)}maybeCompleteSeek(e){M(rF,this)&&"function"==typeof M(rF,this).maybeComplete&&M(rF,this).maybeComplete(e)}startPlaybackClock(){M(OM,this).play()}stopPlaybackClock(){M(OM,this).pause()}resetClock(){var e,t;C(jM,this,!1),M(OM,this).reset(),this.trigger(ud.TIMELINE_RESET,{reason:"reset"}),null===(e=M(oF,this))||void 0===e||null===(t=e.dispose)||void 0===t||t.call(e)}applyTimelineDefinition(e={}){const t=Array.isArray(null==e?void 0:e.placements)?e.placements:[],n=Array.isArray(null==e?void 0:e.renderPlacements)?e.renderPlacements:[];A(lF,this,uF).call(this),A(lF,this,dF).call(this,t),A(lF,this,hF).call(this,n),this.currentTime=0}placeOnTimeline(e,t,n={}){const i=e&&"object"==typeof e?e.id:e;if(!i)throw new Error("Timeline.placeOnTimeline requires node id");const r=M(DM,this).claim(n.placementId),o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=xm(t);if("string"==typeof t&&t.includes("@")&&!a)throw new Error("Timeline.placeOnTimeline requires valid placement reference");const{wantsEndOffset:l,endOffsetSeconds:c}=a?{wantsEndOffset:!1}:wm(t,n);let u,d,h,f=!1;const p=null!==a;if(A(lF,this,FF).call(this),a){const e=M(RM,this).find((e=>(null==e?void 0:e.placementId)===a.placementId));if(!e)throw new Error("Timeline.placeOnTimeline requires valid placement reference");d=e.placementId,h=a.anchor;const t=vm(e);if("start"===a.anchor)Number.isFinite(t)?u=A(lF,this,DF).call(this,t,{nodeOffsetOverride:o}):f=!0;else{const n=A(lF,this,RF).call(this,e);if(Number.isFinite(t)&&n>0){const e=t+n,i=A(lF,this,DF).call(this,e,{nodeOffsetOverride:o});u=Math.max(i,e)}else f=!0}}else if(l){const e=n.offsetAnchorPlacementId?M(RM,this).find((e=>(null==e?void 0:e.placementId)===n.offsetAnchorPlacementId)):M(RM,this).length?M(RM,this)[M(RM,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==e?void 0:e.placementId),d){const t=vm(e),n=A(lF,this,RF).call(this,e);Number.isFinite(t)&&n>0?u=A(lF,this,DF).call(this,t+n-c,{nodeOffsetOverride:o}):(f=!0,h="end")}else u=A(lF,this,DF).call(this,-c,{nodeOffsetOverride:o})}else u=km(t),u=A(lF,this,DF).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 mN({placementId:r,nodeId:i,offset:u,offsetPending:f,offsetAnchorPlacementId:f?d:void 0,offsetAnchorEdge:f?h:void 0,offsetAnchorIsReference:f?p:void 0,offsetEndSeconds:g,nodeOffsetOverride:o,nodeDurationOverride:s,loop:!0===n.loop,loopRootPlacementId:m,loopRootOffset:v});if(M(RM,this).push(y),ym(M(RM,this)),A(lF,this,VF).call(this,y),A(lF,this,UF).call(this),f&&d){const e=M(RM,this).find((e=>(null==e?void 0:e.placementId)===d));A(lF,this,BF).call(this,null==e?void 0:e.nodeId)}return this.trigger(ud.PLACEMENT_ADDED,y),r}placeRenderNodeOnTimeline(e,t,n,i={}){const r="string"==typeof e?e:null==e?void 0:e.type;if(!r||"string"!=typeof r)throw new Error("Timeline.placeRenderNodeOnTimeline requires render node type");const o=A(lF,this,LF).call(this,t,i),s=o.offset,a=!0===o.offsetPending,l=o.offsetAnchorPlacementId,c=o.offsetAnchorEdge,u=o.offsetAnchorIsReference,d=M(BM,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 e=s,t=s+p;_m(M(LM,this),e,t,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements")}if(M(LM,this).push(v),ym(M(LM,this)),a&&l){const e=M(RM,this).find((e=>(null==e?void 0:e.placementId)===l));A(lF,this,BF).call(this,null==e?void 0:e.nodeId)}return this.trigger(ud.RENDER_PLACEMENT_ADDED,v),d}get placements(){return M(RM,this).slice()}getPlacementsActiveAtTime(e){return A(lF,this,eC).call(this,e)}getNodesAtTime(e){const t=A(lF,this,sC).call(this,e);if(!Number.isFinite(t))return[];const n=A(lF,this,eC).call(this,t),i=[];return n.forEach((e=>{const t=this.getNode(null==e?void 0:e.nodeId);t&&i.push(t)})),i}getPlacementDuration(e){return A(lF,this,RF).call(this,e)}getNode(e){if(M(NM,this)&&"function"==typeof M(NM,this).get)return M(NM,this).get(e)}get renderPlacements(){return M(LM,this).slice()}get placementsAhead(){const e=this.currentTime;return M(RM,this).filter((t=>{const n=vm(t);if(!Number.isFinite(n))return!1;const i=A(lF,this,RF).call(this,t);return"number"==typeof i?n+i>e:n>=e}))}get buffered(){return M(MM,this)?M(MM,this).buffered:{start:0,end:0}}get trackBuffers(){return M(zM,this)}onDispose(){A(lF,this,yF).call(this),M(qM,this)&&M(qM,this).clear(),M(oF,this)&&"function"==typeof M(oF,this).dispose&&M(oF,this).dispose(),C(oF,this,null),A(lF,this,gF).call(this),A(lF,this,bF).call(this),M(rF,this)&&"function"==typeof M(rF,this).dispose&&M(rF,this).dispose(),C(rF,this,null),M(OM,this)&&"function"==typeof M(OM,this).dispose&&(M(tF,this)&&"function"==typeof M(OM,this).off&&(M(OM,this).off("tick",M(tF,this)),C(tF,this,null)),M(OM,this).dispose(),C(OM,this,null)),A(lF,this,$F).call(this),C(MM,this,null),C(FM,this,null),C(RM,this,[]),C(LM,this,[]),A(lF,this,jF).call(this),A(lF,this,UF).call(this),M(nF,this).clear(),C(iF,this,null)}notifyDecodedFrame(e={}){const t=null==e?void 0:e.placementId,n=null==e?void 0:e.trackType;if(!t||!n)return;const i=`${t}:${n}`;M(UM,this).add(i),A(lF,this,QF).call(this,e),A(lF,this,tC).call(this),M(MM,this)&&"function"==typeof M(MM,this).handleDecodedFrame&&M(MM,this).handleDecodedFrame(e)}getDecodedFrameStats(){return function(e){const t={totalBytes:0,frames:0,available:!1};if(!e||"function"!=typeof e.values)return t;for(const n of e.values()){const e=[];null!=n&&n.current&&e.push(n.current),Array.isArray(null==n?void 0:n.frames)&&e.push(...n.frames),e.forEach((e=>{const n=null==e?void 0:e.frame;if(!n||!0===n.__closed||!0===n.closed)return;t.frames+=1;const i=AM(e);Number.isFinite(i)&&i>0&&(t.totalBytes+=i)}))}return t.available=!0,t}(M(nF,this))}hasDecodedFirstFrame(e,t){return!(!e||!t)&&M(UM,this).has(`${e}:${t}`)}getDecodedVisualBuffer(e,t){if(e&&t)return M(nF,this).get(`${e}:${t}`)}computeBuffered(e){const t=M(NM,this);if(t&&"function"==typeof t.get)return M(zM,this).computeBuffered(M(RM,this),e,t)}getActiveRenderPlacement(e=this.currentTime){const t=Number.isFinite(e)?e:this.currentTime,n=Array.isArray(M(LM,this))?M(LM,this):[];if(!n.length)return;let i;for(let e=0;e<n.length;e+=1){const r=n[e];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?t>=o&&t<o+s:t>=o)&&(i=r)}return i}}function uF(){C(jM,this,!1),this.trigger(ud.TIMELINE_RESET,{reason:"switch"}),A(lF,this,JF).call(this),M(zM,this)&&"function"==typeof M(zM,this).reset&&M(zM,this).reset(),M(qM,this)&&M(qM,this).clear(),C(RM,this,[]),C(LM,this,[]),A(lF,this,jF).call(this),A(lF,this,UF).call(this),M(DM,this).reset(),M(BM,this).reset()}function dF(e=[]){for(let t=0;t<e.length;t+=1){const n=e[t];if(!n||!n.nodeId)continue;const i=A(lF,this,fF).call(this,n),r=A(lF,this,mF).call(this,n);this.placeOnTimeline(n.nodeId,r,i)}}function hF(e=[]){for(let t=0;t<e.length;t+=1){const n=e[t];if(!n||!n.type)continue;const i=A(lF,this,pF).call(this,n),r=A(lF,this,vF).call(this,n);this.placeRenderNodeOnTimeline(n.type,r,n.duration,i)}}function fF(e){const t={};return e.placementId&&(t.placementId=e.placementId),Number.isFinite(e.nodeOffsetOverride)&&(t.nodeOffsetOverride=e.nodeOffsetOverride),Number.isFinite(e.nodeDurationOverride)&&(t.nodeDurationOverride=e.nodeDurationOverride),!0===e.offsetPending&&(t.offsetPending=!0,e.offsetAnchorPlacementId&&(t.offsetAnchorPlacementId=e.offsetAnchorPlacementId),e.offsetAnchorEdge&&(t.offsetAnchorEdge=e.offsetAnchorEdge)),Number.isFinite(e.offsetEndSeconds)&&(t.offsetEndSeconds=e.offsetEndSeconds),!0===e.loop&&(t.loop=!0),e.loopRootPlacementId&&(t.loopRootPlacementId=e.loopRootPlacementId),Number.isFinite(e.loopRootOffset)&&(t.loopRootOffset=e.loopRootOffset),t}function pF(e){const t={};return e.renderPlacementId&&(t.renderPlacementId=e.renderPlacementId),e.params&&"object"==typeof e.params&&(t.params=e.params),t}function mF(e){if(!0===e.offsetPending&&e.offsetAnchorPlacementId&&e.offsetAnchorEdge){if(!0===e.offsetAnchorIsReference)return`${e.offsetAnchorPlacementId}@${e.offsetAnchorEdge}`;if("end"===e.offsetAnchorEdge)return Number.isFinite(e.offsetEndSeconds)&&e.offsetEndSeconds>0?-e.offsetEndSeconds:"end"}return"string"==typeof e.offset||Number.isFinite(e.offset)?e.offset:0}function vF(e){return!0===e.offsetPending&&e.offsetAnchorPlacementId&&e.offsetAnchorEdge&&!0===e.offsetAnchorIsReference?`${e.offsetAnchorPlacementId}@${e.offsetAnchorEdge}`:"string"==typeof e.offset||Number.isFinite(e.offset)?e.offset:0}function gF(){M(MM,this)&&"function"==typeof M(MM,this).exit&&M(MM,this).exit()}function yF(){M(sF,this)&&"function"==typeof this.off&&(this.off(ud.TIMELINE_SEEKED,M(sF,this)),C(sF,this,null)),M(aF,this)&&"function"==typeof this.off&&(this.off("nodestart",M(aF,this)),C(aF,this,null))}function bF(){M(zM,this)&&(M(WM,this)&&(M(zM,this).off("track:underflow",M(WM,this)),C(WM,this,null)),M($M,this)&&(M(zM,this).off("track:ready",M($M,this)),C($M,this,null)),"function"==typeof M(zM,this).dispose&&M(zM,this).dispose(),C(zM,this,null))}function kF(){M(zM,this)&&"function"==typeof M(zM,this).on&&(C(WM,this,(e=>A(lF,this,_F).call(this,e))),C($M,this,(e=>A(lF,this,TF).call(this,e))),M(zM,this).on(ud.TRACK_UNDERFLOW,M(WM,this)),M(zM,this).on(ud.TRACK_READY,M($M,this)))}function wF(){M(OM,this)&&"function"==typeof M(OM,this).on&&(C(tF,this,(e=>A(lF,this,xF).call(this,e))),M(OM,this).on(ud.CLOCK_TICK,M(tF,this)))}function xF(e){var t,n;A(lF,this,FF).call(this),A(lF,this,tC).call(this),null!==(t=M(oF,this))&&void 0!==t&&null!==(n=t.handleTimeUpdate)&&void 0!==n&&n.call(t,this.currentTime,{isSeeking:!1}),A(lF,this,NF).call(this,this.currentTime),this.trigger(ud.TIMELINE_TIME_UPDATE,dd(this.currentTime,"clock")),M(MM,this)&&"function"==typeof M(MM,this).handleClockTick&&M(MM,this).handleClockTick(e)}function _F(e){A(lF,this,FF).call(this);const t=A(lF,this,EF).call(this);t&&(null==e?void 0:e.trackType)===t.trackType&&(M(MM,this)&&"function"==typeof M(MM,this).handleMainTrackUnderflow?M(MM,this).handleMainTrackUnderflow(e):this.transitionTo(Ev))}function TF(e){if(A(lF,this,FF).call(this),this.state!==Ev)return;const t=A(lF,this,EF).call(this);if(!t)return;if((null==e?void 0:e.trackType)!==t.trackType)return;if(M(MM,this)&&"function"==typeof M(MM,this).handleMainTrackReady)return void M(MM,this).handleMainTrackReady(e);const n=this.getLastStableState()||Iv;this.transitionTo(n)}function EF(e=this.currentTime){const t=A(lF,this,SF).call(this,e);if(!t)return;const n=M(NM,this)&&"function"==typeof M(NM,this).get?M(NM,this).get(t.nodeId):void 0;if(!n)return;const i=A(lF,this,IF).call(this,n);return i?{placement:t,trackType:i}:void 0}function IF(e){var t;const n=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[];let i;if(null!=e&&e.mainTrackId){const t=n.find((t=>(null==t?void 0:t.id)===e.mainTrackId));i=null==t?void 0:t.type}if(i||(i=null===(t=n.find((e=>null==e?void 0:e.type)))||void 0===t?void 0:t.type),"video"===i||"audio"===i||"image"===i)return i}function SF(e=this.currentTime){const t=M(RM,this)||[];let n;for(let i=0;i<t.length;i+=1){const r=t[i],o=vm(r);if(!Number.isFinite(o))continue;const s=A(lF,this,RF).call(this,r);if(Number.isFinite(s)){if(e>=o&&e<o+s)return r}else if(e<=o)return r;!n&&e<o&&(n=r)}return n}function AF(e={}){if(this.state!==_v)return;const t=null==e?void 0:e.placementId;if(!t)return;const n=A(lF,this,oC).call(this,t);n&&A(lF,this,MF).call(this,n)}function NF(e=this.currentTime){if(this.state!==_v)return;const t=A(lF,this,eC).call(this,e);Array.isArray(t)&&t.length&&t.forEach((e=>A(lF,this,MF).call(this,e)))}function MF(e){const t=null==e?void 0:e.placementId;if(!t)return;if(M(qM,this).has(t))return;if(!e||!0!==e.loop)return;if(!e.nodeId)return;const n=A(lF,this,RF).call(this,e);if(!Number.isFinite(n)||n<=0)return;const i=vm(e);if(!Number.isFinite(i))return;const r=i+n;if(!Number.isFinite(r))return;const o=e.loopRootPlacementId||e.placementId,s=Number.isFinite(e.loopRootOffset)?e.loopRootOffset:i;M(qM,this).add(t),this.placeOnTimeline(e.nodeId,r,{nodeOffsetOverride:e.nodeOffsetOverride,nodeDurationOverride:e.nodeDurationOverride,loop:!0,loopRootPlacementId:o,loopRootOffset:s})}function FF(){const e=bm(M(RM,this),{getPlacementDuration:e=>A(lF,this,RF).call(this,e),snapPlacementOffset:(e,t)=>A(lF,this,DF).call(this,e,{nodeOffsetOverride:null==t?void 0:t.nodeOffsetOverride}),onResolvedPlacement:(e,t)=>{!0!==e.loop||Number.isFinite(e.loopRootOffset)||(e.loopRootOffset=e.offset),A(lF,this,zF).call(this,null==t?void 0:t.nodeId)}});return e.updated&&(A(lF,this,UF).call(this),e.resolvedPlacements.forEach((e=>{A(lF,this,VF).call(this,e),this.trigger(ud.PLACEMENT_ADDED,e)}))),e.updated}function CF(){if(!M(LM,this).length||!M(RM,this).length)return!1;const e=new Map;M(RM,this).forEach((t=>{(null==t?void 0:t.placementId)&&e.set(t.placementId,t)}));const t=M(LM,this).filter((e=>!0===(null==e?void 0:e.offsetPending)));if(!t.length)return!1;let n=!1;const i=[];for(let r=0;r<t.length;r+=1){const o=t[r];A(lF,this,OF).call(this,o,e)&&(n=!0,i.push(o))}return n&&(ym(M(LM,this)),i.forEach((e=>{this.trigger(ud.RENDER_PLACEMENT_ADDED,e)}))),n}function OF(e,t){const n=null==e?void 0:e.offsetAnchorPlacementId,i=null==e?void 0:e.offsetAnchorEdge;if(!n||!i)return!1;const r=t.get(n);if(!r||!0===r.offsetPending)return!1;const o=A(lF,this,PF).call(this,r,e);if(!Number.isFinite(o))return!1;e.offset=o,e.offsetPending=!1,e.offsetAnchorPlacementId=void 0,e.offsetAnchorEdge=void 0,e.offsetAnchorIsReference=void 0;const s=e.offset,a=e.offset+e.duration;return _m(M(LM,this).filter((t=>t!==e&&!0!==(null==t?void 0:t.offsetPending))),s,a,"Timeline.placeRenderNodeOnTimeline does not allow overlapping render node placements"),A(lF,this,zF).call(this,null==r?void 0:r.nodeId),!0}function PF(e,t){const n=vm(e);if(!Number.isFinite(n))return;if("start"===t.offsetAnchorEdge)return A(lF,this,DF).call(this,n);const i=A(lF,this,RF).call(this,e);if(!(i>0))return;const r=n+i;if(!Number.isFinite(r))return;const o=A(lF,this,DF).call(this,r);return!0===t.offsetAnchorIsReference?Math.max(o,r):o}function RF(e){return pm(e,M(NM,this))}function DF(e,t={}){var n;return function(e,t={},n){const i=Number(n);if(!(i>0))return e;const r=Number(e);if(!Number.isFinite(r))return e;const o=Number.isFinite(null==t?void 0:t.nodeOffsetOverride)?t.nodeOffsetOverride:0,s=r-o;return Math.round(s*i)/i+o}(e,t,null===(n=this.settings)||void 0===n?void 0:n.snapToFps)}function LF(e,t={}){const n=xm(e);if("string"==typeof e&&e.includes("@")&&!n)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");if(!n){const n=km(e);return{offset:A(lF,this,DF).call(this,n,t)}}const i=M(RM,this).find((e=>(null==e?void 0:e.placementId)===n.placementId));if(!i)throw new Error("Timeline.placeRenderNodeOnTimeline requires valid placement reference");const r=vm(i);if("start"===n.anchor)return Number.isFinite(r)?{offset:A(lF,this,DF).call(this,r,t)}:{offset:void 0,offsetPending:!0,offsetAnchorPlacementId:i.placementId,offsetAnchorEdge:"start",offsetAnchorIsReference:!0};const o=A(lF,this,RF).call(this,i);if(!(Number.isFinite(r)&&o>0))return{offset:void 0,offsetPending:!0,offsetAnchorPlacementId:i.placementId,offsetAnchorEdge:"end",offsetAnchorIsReference:!0};const s=r+o,a=A(lF,this,DF).call(this,s,t);return{offset:Math.max(a,s)}}function BF(e){if(!e||!M(NM,this)||"function"!=typeof M(NM,this).get)return;if(M(VM,this).has(e))return;let t;try{t=M(NM,this).get(e)}catch(e){return}if(!t||"function"!=typeof t.on)return;if("ready"===t.state&&t.duration>0)return void this.updateTime(this.currentTime);const n=()=>{this.updateTime(this.currentTime),A(lF,this,zF).call(this,e)};t.on(ud.NODE_LOADED,n),M(VM,this).set(e,n)}function zF(e){if(!e)return;if(A(lF,this,WF).call(this,e))return;const t=M(VM,this).get(e);if(!t)return;let n;try{n=M(NM,this).get(e)}catch(e){n=null}n&&"function"==typeof n.off&&n.off(ud.NODE_LOADED,t),M(VM,this).delete(e)}function WF(e){if(!e)return!1;const t=new Map;M(RM,this).forEach((e=>{(null==e?void 0:e.placementId)&&t.set(e.placementId,e)}));const n=n=>{if(null==n||!n.offsetPending||null==n||!n.offsetAnchorPlacementId)return!1;const i=t.get(n.offsetAnchorPlacementId);return(null==i?void 0:i.nodeId)===e};return!!M(RM,this).some((e=>n(e)))||!!M(LM,this).some((e=>n(e)))}function $F(){M(VM,this).size&&M(NM,this)?(M(VM,this).forEach(((e,t)=>{let n;try{n=M(NM,this).get(t)}catch(e){n=null}n&&"function"==typeof n.off&&n.off(ud.NODE_LOADED,e)})),M(VM,this).clear()):M(VM,this).clear()}function jF(){C(GM,this,[]),C(HM,this,0),M(KM,this).clear(),M(XM,this).clear(),C(YM,this,Number.NEGATIVE_INFINITY)}function UF(){C(QM,this,[]),C(ZM,this,0),C(JM,this,Number.NEGATIVE_INFINITY)}function qF(e,t){const n=M(GM,this),i={placementId:e,endTime:t};if(!n.length||t>=n[n.length-1].endTime)return void n.push(i);const r=n.findIndex((e=>t<e.endTime)),o=-1===r?n.length:r;n.splice(o,0,i),o<M(HM,this)&&C(HM,this,M(HM,this)+1)}function VF(e){const t=null==e?void 0:e.placementId;if(!t||M(KM,this).has(t))return;const n=vm(e),i=A(lF,this,RF).call(this,e);if(!Number.isFinite(n)||!Number.isFinite(i)||i<0)return void M(XM,this).add(t);const r=n+i;Number.isFinite(r)&&(M(KM,this).add(t),M(XM,this).delete(t),A(lF,this,qF).call(this,t,r))}function GF(){M(XM,this).size&&Array.from(M(XM,this)).forEach((e=>{const t=A(lF,this,oC).call(this,e);t?A(lF,this,VF).call(this,t):M(XM,this).delete(e)}))}function HF(e){const t=Number(e);if(!Number.isFinite(t))return;if(t<M(YM,this))return void C(YM,this,t);if(C(YM,this,t),A(lF,this,GF).call(this),!M(GM,this).length)return;const n=new Set;let i=M(HM,this);for(;i<M(GM,this).length;){const e=M(GM,this)[i];if(!e||!Number.isFinite(e.endTime)||e.endTime>t)break;e.placementId&&n.add(e.placementId),i+=1}i!==M(HM,this)&&(C(HM,this,i),n.size&&(A(lF,this,YF).call(this,n),A(lF,this,KF).call(this,n)))}function KF(e){if(e&&e.size)for(const t of M(UM,this)){const n=t.split(":")[0];e.has(n)&&M(UM,this).delete(t)}}function XF(e){const t=Array.isArray(null==e?void 0:e.frames)?e.frames:[],n=null==e?void 0:e.current;(n?[n,...t]:t).forEach((e=>{const t=null==e?void 0:e.frame;if(t&&"function"==typeof t.close)try{t.close()}catch(e){}}))}function YF(e){if(e&&e.size)for(const[t,n]of M(nF,this).entries())e.has(null==n?void 0:n.placementId)&&(A(lF,this,XF).call(this,n),M(nF,this).delete(t))}function QF(e={}){var t;const n=null==e?void 0:e.placementId,i=null==e?void 0:e.nodeId,r=null==e?void 0:e.trackId,o=null==e?void 0:e.segmentId,s=null==e?void 0:e.trackType;if(!(n&&i&&r&&o))return;if("video"!==s&&"image"!==s)return;const a=(null==e?void 0:e.frame)||(null==e?void 0:e.data);if(!a)return;"video"===s&&"object"==typeof a&&"function"==typeof a.close&&(a.__keepOpen=!0);const l=aM(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==e?void 0:e.pts)?e.pts:void 0;if(!Number.isFinite(d))return;const h=Number.isFinite(null==e?void 0:e.duration)?e.duration:void 0,f=`${n}:${r}`,p=M(nF,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 e=g.findIndex((e=>e.presentationTime>v.presentationTime));-1===e&&(e=g.length),g.splice(e,0,v)}const b=Number(null===(t=this.settings)||void 0===t?void 0:t.maxBufferedVideoFrames);if("video"===s&&Number.isFinite(b)&&b>0&&g.length>b){const e=g.length-b;for(let t=0;t<e;t+=1){const e=g.pop(),t=null==e?void 0:e.frame;if(t&&"function"==typeof t.close)try{t.close()}catch(e){}}}p||M(nF,this).set(f,m)}function JF(){for(const e of M(nF,this).values())A(lF,this,XF).call(this,e);M(nF,this).clear(),C(iF,this,null),M(UM,this).clear()}function ZF(e){const t=Number.isFinite(e)?e:this.currentTime;if(!Number.isFinite(t))return;t<M(JM,this)&&(C(QM,this,[]),C(ZM,this,0));const n=Array.isArray(M(RM,this))?M(RM,this):[],i=[],r=new Set;M(QM,this).forEach((e=>{A(lF,this,uC).call(this,e,t)&&(i.push(e),(null==e?void 0:e.placementId)&&r.add(e.placementId))}));let o=M(ZM,this);for(;o<n.length;){const e=n[o],s=vm(e);if(!Number.isFinite(s))break;if(s>t)break;if(A(lF,this,uC).call(this,e,t)){const t=null==e?void 0:e.placementId;t&&r.has(t)||(i.push(e),t&&r.add(t))}o+=1}C(QM,this,i),C(ZM,this,o),C(JM,this,t)}function eC(e,t={}){const n=Number.isFinite(e)?e:this.currentTime,i=Number.isFinite(null==t?void 0:t.endEpsilonSeconds)?t.endEpsilonSeconds:0;return 0===i&&n===this.currentTime&&n===M(JM,this)?M(QM,this).slice():(Array.isArray(M(RM,this))?M(RM,this):[]).filter((e=>A(lF,this,uC).call(this,e,n,i)))}function tC(){const e=this.currentTime,t=A(lF,this,iC).call(this,e);if(!t.length)return void C(iF,this,null);const n=this.getActiveRenderPlacement(e),i=A(lF,this,rC).call(this,t,n);(i!==M(iF,this)||A(lF,this,nC).call(this,e,n))&&(C(iF,this,i),this.trigger(ud.VISUAL_FRAMES_AVAILABLE,{time:e,frames:t}))}function nC(e,t){const n=t||this.getActiveRenderPlacement(e);if(!n)return!1;if(!Km.doesRenderNodeTypeRequireFrameCadence(null==n?void 0:n.type))return!1;const i=n.duration;return"number"==typeof i&&i>0}function iC(e){return function(e={}){const t=e.buffers,n=e.time,i=e.getPlacementById,r=e.isPlacementActiveAtTime,o=e.getPlacementDuration,s=[];if(!t||"function"!=typeof t.entries)return[];const a=[];for(const[e,c]of t.entries()){const t=null==c?void 0:c.placementId,u="function"==typeof i?i(t):void 0;if(!u){nM(c),a.push(e);continue}if("function"==typeof r&&!r(u,n)){const t=iM(u),i="function"==typeof o?o(u):void 0;Number.isFinite(i)&&Number.isFinite(t)&&n>=t+i&&(nM(c),a.push(e));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 e=c.current,t=d.shift();c.current=t,e&&e!==t&&tM(null==e?void 0:e.frame)}if(!c.current)continue;const h={placementId:t,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:t,placementOffset:iM(u),placementSortOffset:rM(u),placementSortId:oM(u,t)})}return a.forEach((e=>{t.delete(e)})),s.sort(((e,t)=>{const n=Number.isFinite(null==e?void 0:e.placementSortOffset)?e.placementSortOffset:Number.isFinite(null==e?void 0:e.placementOffset)?e.placementOffset:0,i=Number.isFinite(null==t?void 0:t.placementSortOffset)?t.placementSortOffset:Number.isFinite(null==t?void 0:t.placementOffset)?t.placementOffset:0;if(n!==i)return n-i;const r=(null==e?void 0:e.placementSortId)||(null==e?void 0:e.placementId),o=(null==t?void 0:t.placementSortId)||(null==t?void 0:t.placementId),s=sM(r),a=sM(o);return Number.isFinite(s)&&Number.isFinite(a)&&s!==a?s-a:r&&o&&r!==o?r<o?-1:1:function(e,t){const n=(null==e?void 0:e.frame)||{},i=(null==t?void 0:t.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)}(e,t)})),s.map((e=>e.frame))}({buffers:M(nF,this),time:e,getPlacementById:e=>A(lF,this,oC).call(this,e),isPlacementActiveAtTime:(e,t)=>A(lF,this,uC).call(this,e,t),getPlacementDuration:e=>A(lF,this,RF).call(this,e)})}function rC(e,t){return`${t?`render:${t.renderPlacementId||t.type||"unknown"}`:"render:default"}|${e.map((e=>`${e.nodeId}:${e.trackId}:${e.segmentId}@${e.presentationTime}`)).join("|")}`}function oC(e){if(e)return(M(RM,this)||[]).find((t=>(null==t?void 0:t.placementId)===e))}function sC(e){if("end"===e){const e=A(lF,this,aC).call(this);if(!Number.isFinite(e))return;const t=A(lF,this,lC).call(this);return Math.max(0,e-Math.min(e,t))}const t=Number(e);return Number.isFinite(t)?t:0}function aC(){let e;return(Array.isArray(M(RM,this))?M(RM,this):[]).forEach((t=>{const n=vm(t);if(!Number.isFinite(n))return;const i=A(lF,this,RF).call(this,t);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(e)||r>e)&&(e=r)})),e}function lC(){const e=A(lF,this,cC).call(this);return e>0?e:.001}function cC(){var e;const t=Number(null===(e=this.settings)||void 0===e?void 0:e.snapToFps);return!Number.isFinite(t)||t<=0?0:.5/t}function uC(e,t,n=0){if(!gm(e,t,M(NM,this)))return!1;const i=Number(n);if(!Number.isFinite(i)||i<=0)return!0;const r=A(lF,this,RF).call(this,e);if(!Number.isFinite(r))return!0;const o=vm(e);return!Number.isFinite(o)||t<o+r-i}var 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,wC=new WeakMap,xC=new WeakMap,_C=new WeakMap,TC=new WeakMap,EC=new WeakMap,IC=new WeakMap,SC=new WeakMap,AC=new WeakSet;class NC extends od{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(...e){super(...e),O(this,AC),F(this,dC,void 0),F(this,hC,void 0),F(this,fC,1),F(this,pC,1),F(this,mC,1),F(this,vC,""),F(this,gC,0),F(this,yC,[]),F(this,bC,null),F(this,kC,void 0),F(this,wC,[]),F(this,xC,null),F(this,_C,null),F(this,TC,0),F(this,EC,0),F(this,IC,0),F(this,SC,void 0);const[t]=e;C(dC,this,t),C(TC,this,My()),C(SC,this,A(AC,this,MC).call(this)),A(AC,this,FC).call(this),A(AC,this,CC).call(this),A(AC,this,LC).call(this),A(AC,this,RC).call(this)}get publicAPI(){return M(SC,this)}calcScore(){A(AC,this,GC).call(this)}onDispose(){M(dC,this)&&M(hC,this)&&"function"==typeof M(dC,this).off&&M(dC,this).off(ud.TIMELINE_PLAYER_STATE,M(hC,this)),C(hC,this,null),A(AC,this,DC).call(this),A(AC,this,BC).call(this),C(dC,this,null),C(wC,this,[]),C(yC,this,[]),C(SC,this,null)}}function MC(){const e=this;return{get score(){return M(fC,e)},get status(){return M(vC,e)},get streamQualityScore(){return M(pC,e)},get fpsScore(){return M(mC,e)},get browserFps(){return M(gC,e)},get waitingSeconds(){return M(EC,e)/1e3},get playingSeconds(){return M(IC,e)/1e3}}}function FC(){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 CC(){M(dC,this)&&"function"==typeof M(dC,this).on&&(C(hC,this,(e=>A(AC,this,OC).call(this,e))),M(dC,this).on(ud.TIMELINE_PLAYER_STATE,M(hC,this)))}function OC(e={}){const t="string"==typeof(null==e?void 0:e.event)?e.event:"";"playing"!==t?"waiting"!==t?"pause"!==t&&"seeking"!==t&&"seeked"!==t&&"reset"!==t||A(AC,this,PC).call(this,null):A(AC,this,PC).call(this,"waiting"):A(AC,this,PC).call(this,"playing")}function PC(e){if(e===M(xC,this))return;const t=My();M(xC,this)&&Number.isFinite(M(_C,this))&&M(wC,this).push({state:M(xC,this),startMs:M(_C,this),endMs:t}),C(xC,this,e),C(_C,this,e?t:null),A(AC,this,$C).call(this,t)}function RC(){const e=Number(this.settings.calcScoreInterval);!Number.isFinite(e)||e<=0||(C(kC,this,(()=>A(AC,this,GC).call(this))),fw(M(kC,this),1e3*e))}function DC(){M(kC,this)&&pw(M(kC,this)),C(kC,this,null)}function LC(){if("function"!=typeof iw)return;const e=()=>{if(this._disposed)return;const t=My();C(gC,this,A(AC,this,zC).call(this,M(yC,this),t)),C(bC,this,iw(e))};C(bC,this,iw(e))}function BC(){M(bC,this)&&"function"==typeof rw&&rw(M(bC,this)),C(bC,this,null)}function zC(e,t){const n=A(AC,this,WC).call(this);for(e.push(t);e.length&&t-e[0]>n;)e.shift();if(e.length<2)return 0;const i=e[e.length-1]-e[0];return i<=0?0:1e3*(e.length-1)/i}function WC(){const e=Number(this.settings.windowSeconds);return!Number.isFinite(e)||e<=0?3e4:1e3*e}function $C(e){const t=e-A(AC,this,WC).call(this);for(;M(wC,this).length&&M(wC,this)[0].endMs<=t;)M(wC,this).shift()}function jC(e){const t=e-A(AC,this,WC).call(this);let n=0,i=0;const r=(r,o,s)=>{const a=Math.max(o,t),l=Math.min(s,e);l<=a||("waiting"===r?n+=l-a:"playing"===r&&(i+=l-a))};return M(wC,this).forEach((e=>{r(e.state,e.startMs,e.endMs)})),M(xC,this)&&Number.isFinite(M(_C,this))&&r(M(xC,this),M(_C,this),e),C(EC,this,n),C(IC,this,i),{waitingMs:n,playingMs:i}}function UC(e,t){if(e<=0)return 1;if(e>t)return 0;const n=t||1;return hm(1-e*this.settings.waitingMultiplier/n)}function qC(){if(My()-M(TC,this)<=1e3*this.settings.fpsGracePeriod)return 1;const e=Number(M(gC,this)),t=kv.isDesktop()?this.settings.bestFpsDesktop:this.settings.bestFpsMobile,n=hm(t>0?e/t:0);return"quad"===this.settings.fpsMathFuncType?n*n:n}function VC(e,t){const n=this.settings.statusFloors||{};let i="";return e>=n.excellent?i="excellent":e>=n.good?i="good":e>=n.fair?i="fair":(i="poor",e<=this.settings.alertStatusCeil&&t>0&&(i="alert")),i}function GC(){const e=My(),{waitingMs:t,playingMs:n}=A(AC,this,jC).call(this,e),i=A(AC,this,UC).call(this,t,n),r=A(AC,this,qC).call(this),o=hm(i*this.settings.streamQualityWeight+r*this.settings.fpsWeight);o!==M(fC,this)&&(C(fC,this,o),this.trigger(ud.QOE_SCORE,o)),C(pC,this,i),C(mC,this,r);const s=A(AC,this,VC).call(this,o,t);s!==M(vC,this)&&(C(vC,this,s),this.trigger(ud.QOE_STATUS,s))}function HC(e,t=0){const n=Number(e);return Number.isFinite(n)?n:t}function KC(e){const t=Number(e);return!Number.isFinite(t)||t<0?0:t}var XC=new WeakMap,YC=new WeakMap,QC=new WeakMap,JC=new WeakMap,ZC=new WeakSet;class eO extends od{get name(){return"SegmentEvictionCoordinator"}get defaults(){return{enabled:Hy("segmentEvictionEnabled"),bufferBehindSeconds:Hy("segmentEvictionBufferBehindSeconds"),bufferAheadSeconds:Hy("segmentEvictionBufferAheadSeconds"),maxRetainedBytes:Hy("segmentEvictionMaxRetainedBytes")}}get methodsExcludedFromAutoLog(){return new Set([...super.methodsExcludedFromAutoLog,"evictAtTime"])}constructor(e,t,n={}){super(n),O(this,ZC),F(this,XC,void 0),F(this,YC,void 0),F(this,QC,void 0),F(this,JC,void 0),C(XC,this,e),C(YC,this,t),C(QC,this,(e=>A(ZC,this,tO).call(this,e))),C(JC,this,(e=>A(ZC,this,nO).call(this,e))),M(XC,this)&&"function"==typeof M(XC,this).on&&(M(XC,this).on(ud.TIMELINE_TIME_UPDATE,M(QC,this)),M(XC,this).on(ud.TIMELINE_SEEKED,M(JC,this)))}onDispose(){M(XC,this)&&"function"==typeof M(XC,this).off&&(M(XC,this).off(ud.TIMELINE_TIME_UPDATE,M(QC,this)),M(XC,this).off(ud.TIMELINE_SEEKED,M(JC,this))),C(XC,this,null),C(YC,this,null),C(QC,this,null),C(JC,this,null)}evictAtTime(e){if(!0!==this.settings.enabled)return;const t=Number(e);if(!Number.isFinite(t))return;const n=KC(this.settings.bufferBehindSeconds),i=KC(this.settings.bufferAheadSeconds),r=t-n,o=t+i,s=A(ZC,this,iO).call(this);if(!s.length)return;const a=Number(this.settings.maxRetainedBytes);if(Number.isFinite(a)&&a>0&&A(ZC,this,rO).call(this,s)<=a)return;const l=new Map;s.forEach((e=>{const t=null==e?void 0:e.nodeId;if(!t)return;const n=vm(e);if(!Number.isFinite(n))return;const i=l.get(t)||[];i.push(e),l.set(t,i)})),l.size&&l.forEach(((e,t)=>{const n=A(ZC,this,oO).call(this,t);if(!n)return;const i=e.filter((e=>A(ZC,this,sO).call(this,e,r,o)));i.length?A(ZC,this,aO).call(this,n,i,r,o):"function"==typeof n.evict&&n.evict()}))}}function tO(e){var t,n;if(!0!==this.settings.enabled)return;if((null===(t=M(XC,this))||void 0===t?void 0:t.state)===Sv)return;const i=Number(null==e?void 0:e.time),r=Number.isFinite(i)?i:Number(null===(n=M(XC,this))||void 0===n?void 0:n.currentTime);this.evictAtTime(r)}function nO(e){var t;if(!0!==this.settings.enabled)return;const n=Number(null==e?void 0:e.targetTime),i=Number.isFinite(n)?n:Number(null===(t=M(XC,this))||void 0===t?void 0:t.currentTime);this.evictAtTime(i)}function iO(){var e;const t=null===(e=M(XC,this))||void 0===e?void 0:e.placements;return Array.isArray(t)?t:[]}function rO(e){if(!Array.isArray(e)||!e.length)return 0;const t=new Set;let n=0;return e.forEach((e=>{const i=null==e?void 0:e.nodeId;if(!i||t.has(i))return;t.add(i);const r=A(ZC,this,oO).call(this,i),o=Number(null==r?void 0:r.retainedByteLength);ry(o)?n+=o:(Array.isArray(null==r?void 0:r.tracks)?r.tracks:[]).forEach((e=>{(Array.isArray(null==e?void 0:e.segments)?e.segments:[]).forEach((e=>{ry(null==e?void 0:e.retainedByteLength)&&(n+=e.retainedByteLength)}))}))})),n}function oO(e){if(M(YC,this)&&"function"==typeof M(YC,this).get)return M(YC,this).get(e)}function sO(e,t,n){const i=vm(e);if(!Number.isFinite(i))return!1;const r=pm(e,M(YC,this));return(Number.isFinite(r)?i+r:Number.POSITIVE_INFINITY)>t&&i<n}function aO(e,t,n,i){const r=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[];r.length&&r.forEach((e=>{const r=Array.isArray(null==e?void 0:e.segments)?e.segments:[],o=HC(null==e?void 0:e.offset,0);r.forEach((e=>{if(!e||!ry(null==(r=e)?void 0:r.retainedByteLength))return;var r;if(e.isInit)return;let s=!1;for(let r=0;r<t.length;r+=1){const a=t[r],l=vm(a);if(!Number.isFinite(l))continue;const c=HC(null==a?void 0:a.nodeOffsetOverride,0),u=HC(null==e?void 0:e.offset,NaN);if(!Number.isFinite(u))continue;const d=HC(null==e?void 0:e.duration,0),h=l+o+u-c,f=h+(d>0?d:0),p=pm(a,M(YC,this)),m=Number.isFinite(p)?l+p:Number.POSITIVE_INFINITY;if(!(f<=l||h>=m||f<=n||h>=i)){s=!0;break}}s||e.evict()}))}))}var lO=new WeakMap,cO=new WeakMap,uO=new WeakMap,dO=new WeakSet;class hO extends od{get name(){return"DocumentVisibility"}get defaults(){return{autoPauseOnVisibilityChange:!0,autoResumeOnVisibilityChange:!0}}constructor(e,t={}){super(t),O(this,dO),F(this,lO,void 0),F(this,cO,null),F(this,uO,!1),C(lO,this,e),A(dO,this,fO).call(this)}onDispose(){A(dO,this,pO).call(this),C(lO,this,null),C(uO,this,!1)}}function fO(){const e=null==ld?void 0:ld.document;e&&"function"==typeof e.addEventListener&&(C(cO,this,(()=>A(dO,this,mO).call(this))),e.addEventListener("visibilitychange",M(cO,this)))}function pO(){const e=null==ld?void 0:ld.document;M(cO,this)&&e&&"function"==typeof e.removeEventListener&&e.removeEventListener("visibilitychange",M(cO,this)),C(cO,this,null)}function mO(){const e=null==ld?void 0:ld.document,t=null==e?void 0:e.visibilityState;"string"==typeof t&&("hidden"!==t?"visible"===t&&A(dO,this,gO).call(this):A(dO,this,vO).call(this))}function vO(){var e;(null===(e=this.settings)||void 0===e?void 0:e.autoPauseOnVisibilityChange)&&M(lO,this)&&"function"==typeof M(lO,this).pause&&(M(lO,this).state===_v?(this.log.info("[#handleHidden] Pausing timeline due to document visibility change"),M(lO,this).pause(),C(uO,this,!0)):C(uO,this,!1))}function gO(){var e;M(uO,this)&&(null===(e=this.settings)||void 0===e?void 0:e.autoResumeOnVisibilityChange)&&M(lO,this)&&"function"==typeof M(lO,this).play&&(M(lO,this).state!==_v?(this.log.info("[#handleVisible] Resuming timeline due to document visibility change"),M(lO,this).play(),C(uO,this,!1)):C(uO,this,!1))}const yO=[{event:"canplay",once:!0,trackAs:"canplay"},{event:"playing",once:!0,trackAs:"startedplaying"},"seeked","canvas.webglcontextlost"];function bO(e,t=0){return Number.isFinite(e)?e:t}function kO(e){const t=null==e?void 0:e.exposedPlayerAPI;return t&&"object"==typeof t?t:e}const wO=[function(e){return{schema:"iglu:com.helloeko/player/jsonschema/1-0-7",match:/^.*$/,getData:()=>{var t,n,i;const r=function(e){const t=null==e?void 0:e.exposedPlayerAPI;return t&&"object"==typeof t?t:e}(e);return{playerversion:"string"==typeof(null==r?void 0:r.version)?r.version:"0.0.0",isautoplay:!(null==r||null===(t=r.options)||void 0===t||!t.autoplay),playerqoe:bO(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:bO(null==r?void 0:r.volume),playercontainerwidth:bO(null==r?void 0:r.containerWidth),playercontainerheight:bO(null==r?void 0:r.containerHeight)}}}},function(e){return{schema:"iglu:com.helloeko/currentnode/jsonschema/1-0-2",match:/^.*$/,getData:()=>{var t;const n=kO(e),i=function(e){const t=kO(e);if(!t||"function"!=typeof t.getNodesAtTime)return null;const n=Number.isFinite(t.currentTime)?t.currentTime:0,i=t.getNodesAtTime(n);return Array.isArray(i)&&0!==i.length&&i[0]||null}(e);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===(t=i.metadata)||void 0===t?void 0:t.profile)?i.metadata.profile:""}}}},function(e){let t=0,n=0;const i=()=>{t||(t=Date.now(),n=0)},r=()=>{t&&!n&&(n=Date.now())};return e&&"function"==typeof e.on&&(e.on("seeking",i),e.on("seeked",r)),{schema:"iglu:com.helloeko/seeked/jsonschema/1-0-0",match:"seeked",getData:()=>{r();const e=t&&n&&n>=t?(n-t)/1e3:0;return t=0,n=0,{seekduration:e}},dispose:()=>{e&&"function"==typeof e.off&&(e.off("seeking",i),e.off("seeked",r))}}},function(){return{schema:"iglu:com.helloeko/environment/jsonschema/1-0-0",match:/^.*$/,getData:()=>{var e;const t=null==ld||null===(e=ld.eko)||void 0===e||null===(e=e.environment)||void 0===e?void 0:e.embeddingApp;return t?{embeddingapp:t}:{}}}}],xO=Object.freeze({once:!1,trackAs:""});var _O=new WeakMap,TO=new WeakMap,EO=new WeakMap,IO=new WeakMap,SO=new WeakMap,AO=new WeakMap,NO=new WeakSet;class MO extends od{get name(){return"Tracker"}get defaults(){return{tag:null,trackingEnabled:Hy("trackingEnabled"),defaultForwarders:yO,defaultContextPackers:wO}}constructor(e,t={}){var n,i;super(t),O(this,NO),F(this,_O,void 0),F(this,TO,new Map),F(this,EO,[]),F(this,IO,!1),F(this,SO,void 0),F(this,AO,void 0),C(AO,this,!this.settings.tag),C(SO,this,this.settings.tag||(null===(n=crypto)||void 0===n||null===(i=n.randomUUID)||void 0===i?void 0:i.call(n))||`eko-player-${Date.now()}`),C(_O,this,e),A(NO,this,LO).call(this),A(NO,this,CO).call(this)}track(e,...t){if(!this.settings.trackingEnabled)return;if("string"!=typeof e||!e)return void this.log.warn("[track] Expected event to be a non-empty string.");const n=A(NO,this,zO).call(this);n&&n("track",e,...t,M(SO,this))}registerContextPacker(e){if(!e||"object"!=typeof e)return void this.log.warn("[registerContextPacker] Expected a packer object.");const t={tag:M(SO,this),schema:e.schema,match:e.match,getData:A(NO,this,FO).call(this,e.getData)};if("string"!=typeof t.schema||!t.schema)return void this.log.warn('[registerContextPacker] Expected "schema" to be a non-empty string.');if("function"!=typeof t.getData)return void this.log.warn('[registerContextPacker] Expected "getData" to be a function.');if(!this.settings.trackingEnabled)return;const n=A(NO,this,zO).call(this);n&&n("registerContextPacker",t)}onDispose(){if(A(NO,this,DO).call(this),A(NO,this,BO).call(this),C(_O,this,null),M(AO,this)){const e=A(NO,this,zO).call(this);e&&(e("reset",M(SO,this)),C(SO,this,null))}}}function FO(e){return"function"!=typeof e?null:(...t)=>t.pop()!==M(SO,this)?null:e(...t)}function CO(){(Array.isArray(this.settings.defaultForwarders)?this.settings.defaultForwarders:[]).forEach((e=>A(NO,this,OO).call(this,e)))}function OO(e){const t=A(NO,this,PO).call(this,e);if(!t)return void this.log.warn("[#addEventForwarder] Invalid forwarder input.",e);const n=M(_O,this);if(!n||"function"!=typeof n.on)return;const i=A(NO,this,RO).call(this,t);if(M(TO,this).has(i))return;const r=(...e)=>{t.once&&n&&"function"==typeof n.off&&n.off(t.event,r);const i=t.trackAs||t.event;this.track(i,...e)};n.on(t.event,r),M(TO,this).set(i,{event:t.event,listener:r})}function PO(e){return"string"==typeof e&&e?{event:e,...xO}:e&&"object"==typeof e&&"string"==typeof e.event&&e.event?{event:e.event,once:!!e.once,trackAs:"string"==typeof e.trackAs?e.trackAs:""}:null}function RO({event:e,once:t,trackAs:n}){return`${e}:${t}:${n}`}function DO(){const e=M(_O,this);e&&"function"==typeof e.off&&M(TO,this).forEach((({event:t,listener:n})=>{e.off(t,n)})),M(TO,this).clear()}function LO(){(Array.isArray(this.settings.defaultContextPackers)?this.settings.defaultContextPackers:[]).forEach((e=>{if("function"!=typeof e)return;const t=e(M(_O,this),this);t&&"object"==typeof t&&("function"==typeof t.dispose&&M(EO,this).push(t.dispose),t.disabled||this.registerContextPacker({schema:t.schema,match:t.match,getData:t.getData}))}))}function BO(){M(EO,this).forEach((e=>{try{e()}catch(e){this.log.warn("[#teardownContextPackers] Failed disposing context packer.",e)}})),C(EO,this,[])}function zO(){const e=null==ld?void 0:ld.EkoAnalytics;return"function"==typeof e?e:(A(NO,this,WO).call(this),null)}function WO(){this.settings.trackingEnabled&&!M(IO,this)&&(this.log.warn("EkoAnalytics not found on window."),C(IO,this,!0))}class $O{#te;#ne;#ie;#re;#oe;#se;#ae;#le;#ce;#ue;#de;#he;#fe;#pe;#me;#ve;#ge;#ye;#be;constructor(e,t={},n=null){this.#te=new xd(e,n,t),this.#ne=new Od(this.#te,t),this.#ie=new Xk(t),this.#re=new eb(t),this.#oe=new Mk(this.#re,t),this.#se=new Ek(this.#oe,this.#ie,t),this.#ae=new Bk(this.#se,t),this.#le=new cF(this.#se,t),this.#ce=new hO(this.#le,t),this.#ye=new eO(this.#le,this.#se,t),this.#ue=new Rw(this.#se,this.#ae,this.#ie,this.#le,t),this.#de=new wx(this.#se,this.#ae,this.#le,t),this.#he=new FI(t),this.#fe=new nS(this.#se,this.#le,this.#he,t),this.#me=new NC(this.#le,t),this.#be=new MO(n,t);const i=t&&"object"==typeof t?t.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.#ve=r?r({timeline:this.#le,canvas:this.#te,containerSize:this.#ne,options:t}):new gg(this.#le,this.#te,this.#ne,t),this.#pe=o?o({timeline:this.#le,decodeCoordinator:this.#fe,options:t}):new BA(this.#le,this.#fe,t),this.#ge=new rA(this.#le,this.#ve,t)}get canvas(){return this.#te}get containerSize(){return this.#ne}get assetsDeliveryService(){return this.#ie}get downloadSpeed(){return this.#re}get abrSelector(){return this.#oe}get nodeRepository(){return this.#se}get nodePrioritizer(){return this.#ae}get timeline(){return this.#le}get documentVisibility(){return this.#ce}get nodeResolver(){return this.#ue}get segmentLoadCoordinator(){return this.#de}get decoderFactory(){return this.#he}get parsingManager(){return this.#fe}get audioAdapter(){return this.#pe}get audioPlaybackManager(){return this.#pe}get qoe(){return this.#me}get renderAdapter(){return this.#ve}get renderer(){return this.#ve}get transitionManager(){return this.#ge}get tracker(){return this.#be}dispose(){[this.#be,this.#le,this.#ce,this.#de,this.#ue,this.#ae,this.#se,this.#ie,this.#oe,this.#re,this.#fe,this.#he,this.#pe,this.#me,this.#ve,this.#ge,this.#ye,this.#ne,this.#te].forEach((e=>{e&&"function"==typeof e.dispose&&e.dispose()})),this.#le=null,this.#ce=null,this.#de=null,this.#ue=null,this.#ae=null,this.#se=null,this.#ie=null,this.#oe=null,this.#re=null,this.#fe=null,this.#he=null,this.#pe=null,this.#me=null,this.#ve=null,this.#ge=null,this.#ye=null,this.#te=null,this.#be=null}}const jO="omer/upc-validation-workflow.1168411";var UO={isPlainObject:ed,deepMerge:td,get:Iy,set:Sy,ekoGlobalStore:Ay,download:Uy,isPositiveNumber:ry,clamp01:hm,root:ld,now:My,getFrameDimensions:aM,useragent:wv,requestAnimationFrame:iw,cancelAnimationFrame:rw,start:fw,stop:pw,isTicking:mw,predicator:function(e,t){const n=t||{};if("function"!=typeof e)return void ow.error("[predicator] Bad argument given to predicator, first argument must be a function.",arguments);if(e.apply())return ow.debug("[predicator] Invoking onFulfilled immediately."),void("function"==typeof n.onFulfilled&&n.onFulfilled.call(null,0));const i=n.timeout||1e4,r=n.interval,o=My();let s,a,l,c,u;c=function(){e.apply()&&l()},l=function(){pw(c),ld.clearTimeout(s),u=My()-o,ow.debug("[predicator] Invoking onFulfilled after "+u+" ms."),"function"==typeof n.onFulfilled&&n.onFulfilled.call(null,u)},a=function(){pw(c),u=My()-o,ow.debug("[predicator] Invoking onTimeout after "+u+" ms."),"function"==typeof n.onTimeout&&n.onTimeout.call(null,u)},s=ld.setTimeout(a,i),fw(c,r)},createThrottler:vw,scheduleExecution:gw},qO=new WeakMap,VO=new WeakMap,GO=new WeakMap,HO=new WeakMap,KO=new WeakMap,XO=new WeakMap,YO=new WeakMap,QO=new WeakSet;class JO{constructor(e){O(this,QO),F(this,qO,[]),F(this,VO,[]),F(this,GO,new IM("placement-")),F(this,HO,new IM("renderplacement-")),F(this,KO,void 0),F(this,XO,new Map),F(this,YO,void 0),C(KO,this,e),C(YO,this,{allowUnready:!0,getNode:e=>A(QO,this,ZO).call(this,e)})}get placements(){return M(qO,this).slice()}get renderPlacements(){return M(VO,this).slice()}getNodesAtTime(e){A(QO,this,eP).call(this);const t=A(QO,this,nP).call(this,e);if(!Number.isFinite(t))return[];const n=M(qO,this).filter((e=>gm(e,t,null,M(YO,this)))),i=[];return n.forEach((e=>{const t=A(QO,this,ZO).call(this,null==e?void 0:e.nodeId);t&&i.push(t)})),i}placeOnTimeline(e,t,n={}){const i=e&&"object"==typeof e?e:null,r=i?i.id:e;if(!r)throw new Error("TimelineDefinition.placeOnTimeline requires node id");i&&M(XO,this).set(r,i);const o=n.nodeOffsetOverride||n.offset,s=n.nodeDurationOverride||n.duration,a=xm(t);if("string"==typeof t&&t.includes("@")&&!a)throw new Error("TimelineDefinition.placeOnTimeline requires valid placement reference");const{wantsEndOffset:l,endOffsetSeconds:c}=a?{wantsEndOffset:!1}:wm(t,n);let u,d,h,f=!1;const p=null!==a;if(a){const e=M(qO,this).find((e=>(null==e?void 0:e.placementId)===a.placementId));if(!e)throw new Error("TimelineDefinition.placeOnTimeline requires valid placement reference");d=e.placementId,h=a.anchor;const t=vm(e);if("start"===a.anchor)Number.isFinite(t)?u=t:f=!0;else{const n=A(QO,this,tP).call(this,e);Number.isFinite(t)&&n>0?u=t+n:f=!0}}else if(l){const e=n.offsetAnchorPlacementId?M(qO,this).find((e=>(null==e?void 0:e.placementId)===n.offsetAnchorPlacementId)):M(qO,this).length?M(qO,this)[M(qO,this).length-1]:void 0;if(d=n.offsetAnchorPlacementId||(null==e?void 0:e.placementId),d){const t=vm(e),n=A(QO,this,tP).call(this,e);Number.isFinite(t)&&n>0?u=t+n-c:(f=!0,h="end")}else u=-c}else u=km(t);const m=M(GO,this).claim(n.placementId),v={placementId:m,nodeId:r,offset:u,offsetPending:f,offsetAnchorPlacementId:f?d:void 0,offsetAnchorEdge:f?h:void 0,offsetAnchorIsReference:f?p:void 0,offsetEndSeconds:l?c:a&&"end"===a.anchor?0:void 0,nodeOffsetOverride:o,nodeDurationOverride:s,loop:!0===n.loop};return M(qO,this).push(v),ym(M(qO,this)),m}placeRenderNodeOnTimeline(e,t,n,i={}){const r="string"==typeof e?e:null==e?void 0:e.type;if(!r||"string"!=typeof r)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires render node type");let o,s,a,l=!1;const c=xm(t);if("string"==typeof t&&t.includes("@")&&!c)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires valid placement reference");const u=null!==c;if(c){const e=M(qO,this).find((e=>(null==e?void 0:e.placementId)===c.placementId));if(!e)throw new Error("TimelineDefinition.placeRenderNodeOnTimeline requires valid placement reference");s=e.placementId,a=c.anchor;const t=vm(e);if("start"===c.anchor)Number.isFinite(t)?o=t:l=!0;else{const n=A(QO,this,tP).call(this,e);Number.isFinite(t)&&Number.isFinite(n)?o=t+n:l=!0}}else o=km(t);const d=M(HO,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 e=o,t=o+p;_m(M(VO,this),e,t,"TimelineDefinition.placeRenderNodeOnTimeline does not allow overlapping render nodes")}return M(VO,this).push(m),ym(M(VO,this)),d}}function ZO(e){if(e)return M(KO,this)&&"function"==typeof M(KO,this).get?M(KO,this).get(e):M(XO,this).get(e)}function eP(){return bm(M(qO,this),{getPlacementDuration:e=>A(QO,this,tP).call(this,e)}).updated}function tP(e){return pm(e,null,M(YO,this))}function nP(e){if("end"===e){const e=A(QO,this,iP).call(this);if(!Number.isFinite(e))return;return Math.max(0,e-Math.min(e,.001))}const t=Number(e);return Number.isFinite(t)?t:0}function iP(){let e;return M(qO,this).forEach((t=>{const n=vm(t);if(!Number.isFinite(n))return;const i=A(QO,this,tP).call(this,t);if(!Number.isFinite(i))return;const r=n+i;Number.isFinite(r)&&(!Number.isFinite(e)||r>e)&&(e=r)})),e}const rP=new Set(["canplay","play","playing","waiting","pause","seeking","seeked"]);var oP=new WeakMap,sP=new WeakMap,aP=new WeakMap,lP=new WeakMap,cP=new WeakMap,uP=new WeakMap,dP=new WeakMap,hP=new WeakMap,fP=new WeakMap,pP=new WeakMap,mP=new WeakMap,vP=new WeakMap,gP=new WeakMap,yP=new WeakMap,bP=new WeakMap,kP=new WeakMap,wP=new WeakMap,xP=new WeakMap,_P=new WeakMap,TP=new WeakMap,EP=new WeakMap,IP=new WeakMap,SP=new WeakMap,AP=new WeakMap,NP=new WeakMap,MP=new WeakSet;class FP extends od{get name(){return"EkoPlayer"}get exposedPlayerAPI(){return M(lP,this)}constructor(e,t={}){const{options:n,publicOptions:i}=function(e={}){const t=td({},Vy,e);Object.entries(qy).forEach((([e,{targetPaths:n}])=>{void 0!==t[e]&&n.forEach((n=>{void 0===Iy(t,n)&&Sy(t,n,t[e])}))}));const n=function(e){const t={};return Object.keys(qy).forEach((n=>{Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})),Object.freeze(t)}(t);return Gy.info("Processed options:",t),Gy.info("Public options:",n),{options:t,publicOptions:n}}(t);return super(n),O(this,MP),F(this,oP,void 0),F(this,sP,void 0),F(this,aP,void 0),F(this,lP,void 0),F(this,cP,void 0),F(this,uP,void 0),F(this,dP,void 0),F(this,hP,void 0),F(this,fP,void 0),F(this,pP,void 0),F(this,mP,void 0),F(this,vP,void 0),F(this,gP,void 0),F(this,yP,void 0),F(this,bP,void 0),F(this,kP,void 0),F(this,wP,void 0),F(this,xP,void 0),F(this,_P,void 0),F(this,TP,void 0),F(this,EP,void 0),F(this,IP,void 0),F(this,SP,void 0),F(this,AP,void 0),F(this,NP,0),C(aP,this,i),this.log.info("Initializing EkoPlayer with options:",i),C(vP,this,new $O(e,n,this)),A(MP,this,$P).call(this,M(vP,this)),C(bP,this,(e=>A(MP,this,CP).call(this,e))),M(sP,this)&&"function"==typeof M(sP,this).on&&M(sP,this).on(ud.TIMELINE_CUEPOINT,M(bP,this)),C(kP,this,null),C(xP,this,(e=>A(MP,this,OP).call(this,e))),C(_P,this,(e=>{const t=e&&"object"==typeof e?e:{};A(MP,this,OP).call(this,{...t,event:"seeking"})})),C(TP,this,(e=>{const t=e&&"object"==typeof e?e:{};A(MP,this,OP).call(this,{...t,event:"seeked"})})),M(sP,this)&&"function"==typeof M(sP,this).on&&(M(sP,this).on(ud.TIMELINE_PLAYER_STATE,M(xP,this)),M(sP,this).on(ud.TIMELINE_SEEKING,M(_P,this)),M(sP,this).on(ud.TIMELINE_SEEKED,M(TP,this))),C(SP,this,(e=>{const t=e&&"object"==typeof e?e:{};this.trigger(ud.CONTAINER_RESIZE,t)})),M(gP,this)&&"function"==typeof M(gP,this).on&&M(gP,this).on(ud.CONTAINER_RESIZE,M(SP,this)),A(MP,this,LP).call(this),A(MP,this,DP).call(this),C(lP,this,A(MP,this,WP).call(this)),M(lP,this)}onDispose(){M(sP,this)&&"function"==typeof M(sP,this).off&&M(bP,this)&&M(sP,this).off(ud.TIMELINE_CUEPOINT,M(bP,this)),C(bP,this,null),M(sP,this)&&"function"==typeof M(sP,this).off&&(M(xP,this)&&M(sP,this).off(ud.TIMELINE_PLAYER_STATE,M(xP,this)),M(_P,this)&&M(sP,this).off(ud.TIMELINE_SEEKING,M(_P,this)),M(TP,this)&&M(sP,this).off(ud.TIMELINE_SEEKED,M(TP,this))),C(xP,this,null),C(_P,this,null),C(TP,this,null),C(kP,this,null),M(gP,this)&&"function"==typeof M(gP,this).off&&M(SP,this)&&M(gP,this).off(ud.CONTAINER_RESIZE,M(SP,this)),C(SP,this,null),M(mP,this)&&"function"==typeof M(mP,this).off&&(M(EP,this)&&M(mP,this).off("qoescore",M(EP,this)),M(IP,this)&&M(mP,this).off("qoestatus",M(IP,this))),C(EP,this,null),C(IP,this,null),M(pP,this)&&"function"==typeof M(pP,this).off&&M(AP,this)&&M(pP,this).off(ud.DECODER_ERROR,M(AP,this)),C(AP,this,null),C(NP,this,0),M(yP,this)&&"function"==typeof M(yP,this).dispose&&M(yP,this).dispose(),C(yP,this,null),M(vP,this)&&"function"==typeof M(vP,this).dispose&&M(vP,this).dispose(),C(sP,this,null),C(oP,this,null),C(uP,this,null),C(dP,this,null),C(hP,this,null),C(fP,this,null),C(pP,this,null),C(mP,this,null),C(gP,this,null),C(cP,this,null),C(lP,this,null),C(vP,this,null)}}function CP(e={}){var t;this.trigger(ud.TIMELINE_CUEPOINT,e);const n="string"==typeof(null==e||null===(t=e.cuepoint)||void 0===t?void 0:t.name)?e.cuepoint.name:"";n&&this.trigger(n,e)}function OP(e={}){const t="string"==typeof(null==e?void 0:e.event)?e.event:"";if(!rP.has(t))return;if("playing"!==t||Number.isFinite(M(wP,this))||(C(wP,this,My()),this.log.info(`[#handlePlayerStateEvent] Playback started @ ${(M(wP,this)/1e3).toFixed(3)}s (${Date.now()})`)),M(kP,this)===t)return;C(kP,this,t);const n=Number.isFinite(null==e?void 0:e.time)?e.time:M(sP,this)&&Number.isFinite(M(sP,this).currentTime)?M(sP,this).currentTime:0,i={};Number.isFinite(n)&&(i.time=n),"string"==typeof(null==e?void 0:e.from)&&(i.from=e.from),"string"==typeof(null==e?void 0:e.to)&&(i.to=e.to),Number.isFinite(null==e?void 0:e.targetTime)&&(i.targetTime=e.targetTime),Array.isArray(null==e?void 0:e.placements)&&(i.placements=e.placements.slice()),this.trigger(t,i)}function PP(){return new JO(M(oP,this))}function RP(e){if(!e||"object"!=typeof e)throw new Error("EkoPlayer.switchTimeline requires a timeline definition");if(!M(sP,this)||"function"!=typeof M(sP,this).applyTimelineDefinition)throw new Error("EkoPlayer.switchTimeline requires an active timeline");M(sP,this).applyTimelineDefinition(e),"function"==typeof M(sP,this).play&&M(sP,this).play()}function DP(){M(mP,this)&&"function"==typeof M(mP,this).on&&(C(EP,this,(e=>{this.trigger(ud.QOE_SCORE,e)})),C(IP,this,(e=>{this.trigger(ud.QOE_STATUS,e)})),M(mP,this).on(ud.QOE_SCORE,M(EP,this)),M(mP,this).on(ud.QOE_STATUS,M(IP,this)))}function LP(){M(pP,this)&&"function"==typeof M(pP,this).on&&(C(AP,this,(e=>{const t=e&&"object"==typeof e?e:{error:e};this.trigger(ud.DECODER_ERROR,t),A(MP,this,BP).call(this,t)})),M(pP,this).on(ud.DECODER_ERROR,M(AP,this)))}function BP(e={}){var t;const n=M(sP,this);if(!n||"number"!=typeof n.currentTime)return;const i=Date.now();if(i<M(NP,this))return;const r=Number(n.currentTime);if(!Number.isFinite(r))return;const o=Number(null==n||null===(t=n.settings)||void 0===t?void 0:t.snapToFps),s=Number.isFinite(o)&&o>0?1/o:1/60;C(NP,this,i+1500),this.log.warn("[#attemptDecoderRecoverySeek] decoder:error received, attempting seek recovery",null==e?void 0:e.error),n.currentTime=r+s}async function zP(e={}){var t;if(M(yP,this))return M(yP,this);const n=e&&"object"==typeof e&&!Array.isArray(e)?{...e}:{},i=M(cP,this)&&M(cP,this).element?M(cP,this).element:null;if(!i)throw new Error("Debug overlay requires an initialized player canvas and mount element.");const r=function({canvasElement:e,containerElement:t}={}){const n=e&&e.parentNode?e.parentNode:null;if(null==t)return n;const i=function(e,t=(null==ld?void 0:ld.document)){if(cd(e))return e;if("string"!=typeof e)return null;let n=e.trim();if("#"===n.charAt(0)&&(n=n.slice(1)),!n||!t||"function"!=typeof t.getElementById)return null;const i=t.getElementById(n);return cd(i)?i:null}(t,e&&e.ownerDocument?e.ownerDocument:null);if(i)return i;if("string"==typeof t){const e=t.trim(),n="#"===e.charAt(0)?e.slice(1):e;if(!n)throw new Error("Debug overlay containerElement id cannot be empty.");throw new Error(`Debug overlay containerElement id "${n}" was not found.`)}throw new Error("Debug overlay containerElement must be an element id string or DOM element.")}({canvasElement:i,containerElement:n.containerElement});if(!r)throw new Error("Debug overlay requires an initialized player canvas and mount element.");Object.prototype.hasOwnProperty.call(n,"containerElement")&&delete n.containerElement;const o=await Promise.resolve().then((function(){return UD})),s=(null==o?void 0:o.createDebugOverlay)||(null==o?void 0:o.default);if("function"!=typeof s)throw new Error("Debug overlay bundle does not export createDebugOverlay().");return n.publicOptions=M(aP,this),n.playerVersion=jO,C(yP,this,s({mountElement:r,canvasElement:i,timeline:M(sP,this),assetsDeliveryServiceUrl:null===(t=M(vP,this))||void 0===t||null===(t=t.assetsDeliveryService)||void 0===t||null===(t=t.settings)||void 0===t?void 0:t.assetsDeliveryServiceUrl,getNode:e=>M(oP,this)&&"function"==typeof M(oP,this).get?M(oP,this).get(e):void 0,listNodes:()=>M(oP,this)&&"function"==typeof M(oP,this).list?M(oP,this).list():[],downloadSpeed:M(vP,this)?M(vP,this).downloadSpeed:void 0,downloadEvents:xy,qoe:M(mP,this)?M(mP,this).publicAPI:void 0,qoeEvents:this,options:n,playbackStartedAtMs:M(wP,this)})),M(yP,this)}function WP(){const e=this;return{createTimeline:()=>A(MP,e,PP).call(e),switchTimeline:t=>A(MP,e,RP).call(e,t),play:M(sP,this).play,pause:M(sP,this).pause,reset:M(sP,this).reset,placeOnTimeline:M(sP,this).placeOnTimeline,placeRenderNodeOnTimeline:M(sP,this).placeRenderNodeOnTimeline,addNode:M(oP,this).add,getNode:M(oP,this).get,listNodes:M(oP,this).list,getNodesAtTime:t=>M(sP,e).getNodesAtTime(t),dispose:this.dispose,on:e.on,off:e.off,once:e.once,trigger:e.trigger,transitionTo:(t,n)=>M(dP,e).transitionTo(t,n),track:(t,...n)=>{if(M(fP,e)&&"function"==typeof M(fP,e).track)return M(fP,e).track(t,...n)},seekToPlacement:t=>M(sP,e).seekToPlacement(t),get currentTime(){return M(sP,e).currentTime},set currentTime(t){M(sP,e).currentTime=t},get buffered(){return M(sP,e).buffered},get options(){return M(aP,e)},get containerWidth(){return M(gP,e)?M(gP,e).containerWidth:0},get containerHeight(){return M(gP,e)?M(gP,e).containerHeight:0},get playbackRate(){return M(sP,e).playbackRate},set playbackRate(t){M(sP,e).playbackRate=t},get paused(){return!!M(sP,e)&&!0===M(sP,e).paused},get muted(){return!!M(hP,e)&&M(hP,e).muted},set muted(t){M(hP,e)&&(M(hP,e).muted=t)},get volume(){return M(hP,e)?M(hP,e).volume:1},set volume(t){M(hP,e)&&(M(hP,e).volume=t)},get qoe(){return M(mP,e)?M(mP,e).publicAPI:void 0},get utils(){return UO},get version(){return jO},loadDebugOverlay:(...t)=>A(MP,e,zP).call(e,...t)}}function $P(e){e&&(C(cP,this,e.canvas),C(oP,this,e.nodeRepository),C(sP,this,e.timeline),C(hP,this,e.audioAdapter||e.audioPlaybackManager),C(fP,this,e.tracker),C(pP,this,e.parsingManager),C(mP,this,e.qoe),C(uP,this,e.renderAdapter||e.renderer),C(dP,this,e.transitionManager),C(gP,this,e.containerSize))}class jP{constructor({target:e,props:t}){if(!e)throw new Error("`options.target` is required");vo(this.#ke,t,!0),this.#ke.v.EkoPlayer=FP;const n=e.hasChildNodes()?ra:ia;this.#we=n(Pu,{target:e,props:this.#ke.v})}#we;#ke=Ii(po(xo({})),"EkoGallery.#props");destroy(e){if(this.#we)return la(this.#we,e)}get props(){return Rs(this.#ke)}}const UP=u("gallery-react");const qP=e.forwardRef(((t,n)=>{const{config:i,debug:r,ssrHtml:o,activeItem:s={index:0,step:0},forceMobile:a,videoAspectRatio:l,onEvent:c=()=>{}}=t,u=e.useRef(null),d=e.useRef({}),h=function(e){return void 0!==e}(i),f=e.useRef(s),p=e.useRef(o);d.current.initEventSent||(c("galleryinit"),d.current.initEventSent=!0);const m=e.useCallback((e=>{d.current.state=e,e.activeItemIndex===f.current.index&&e.activeModuleIndex===f.current.step||c("activeitemchanged",{index:e.activeItemIndex,step:e.activeModuleIndex})}),[]),v=e.useCallback((e=>{d.current.API=e,0===f.current.index&&0===f.current.step||e.selectItemAndStep(f.current.index,f.current.step),d.current.unsubscribe&&d.current.unsubscribe(),d.current.unsubscribe=e.subscribe(m)}),[]),g=e.useCallback(((e,t)=>{c(e,t)}),[c]);return e.useEffect((()=>(UP.setDataStorage("gallery-react",{config:i}),window.eko=window.eko||{},window.eko.config=i,window.eko.gallery={version:"omer-upc-validation-workflow/4.0.10"},()=>{window.eko.config=void 0})),[i]),e.useImperativeHandle(n,(()=>({prev:()=>{var e;null===(e=d.current.API)||void 0===e||e.prev()},next:()=>{var e;null===(e=d.current.API)||void 0===e||e.next()}}))),e.useEffect((()=>{if(null==u||!u.current)return;const e=u.current;return d.current.app=new jP({target:e,props:{config:i,forceMobile:a,videoAspectRatio:l,hideNav:!0,onGalleryReady:v,onEvent:g}}),()=>{var e;null===(e=d.current.app)||void 0===e||e.destroy()}}),[]),e.useEffect((()=>{d.current.app&&(d.current.app.props.config=i)}),[i]),e.useEffect((()=>{d.current.app&&(d.current.app.props.debug=r,d.current.app.props.forceMobile=a,d.current.app.props.videoAspectRatio=l,d.current.app.props.onEvent=g)}),[r,a,l,g]),e.useEffect((()=>{f.current=s,d.current.state&&(d.current.state.activeItemIndex===s.index&&d.current.state.activeModuleIndex===s.step||d.current.API.selectItemAndStep(s.index,s.step))}),[s]),h?e.createElement("div",R({style:{position:"relative",width:"100%",height:"100%"},ref:u},p.current?{dangerouslySetInnerHTML:{__html:p.current}}:{})):t.children}));qP.propTypes={className:Te.string,config:Te.object,variantId:Te.string,onEvent:Te.func,ssrHtml:Te.string,videoAspectRatio:Te.string,debug:Te.bool,activeItem:Te.shape({index:Te.number,step:Te.number}),forceMobile:Te.bool,instanceId:Te.string,children:Te.node},qP.displayName="EkoGallerySvelte";const VP=n("v2"),GP=n("v1"),HP="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||{},KP=HP&&HP.performance,XP=KP&&"function"==typeof KP.now?()=>KP.now():()=>Date.now(),YP=Object.freeze({NODE_ADD:"node:add",NODE_CHILDREN_CHANGED:"node:childrenchanged",NODE_LOADED:"node:loaded",NODE_LOAD_ERROR:"node:loaderror",PLACEMENT_ADDED:"placement:added",RENDER_PLACEMENT_ADDED:"renderplacement:added",TIMELINE_TIME_UPDATE:"timeline:timeupdate",TIMELINE_STATE_CHANGE:"statechange",TIMELINE_SEEKING:"seeking",TIMELINE_SEEKED:"seeked",TIMELINE_RESET:"timeline:reset",TIMELINE_PLAYER_STATE:"player:state",TIMELINE_CUEPOINT:"cuepoint",VISUAL_FRAMES_AVAILABLE:"visualframesavailable",TRACK_BUFFER_UPDATE:"track:bufferupdate",TRACK_READY:"track:ready",TRACK_UNDERFLOW:"track:underflow",CLOCK_TICK:"tick",DECODE_READY:"decode:ready",DECODE_ERROR:"decode:error",DECODER_AUDIO:"decoder:audio",DECODER_FRAME:"decoder:frame",DECODER_INIT:"decoder:init",DECODER_ERROR:"decoder:error",QOE_SCORE:"qoescore",QOE_STATUS:"qoestatus",CONTAINER_RESIZE:"containerresize",CANVAS_WEBGL_CONTEXT_LOST:"canvas.webglcontextlost",CANVAS_WEBGL_CONTEXT_RESTORED:"canvas.webglcontextrestored"}),QP=["ui-monospace,","SFMono-Regular,","Menlo,","Monaco,","Consolas,",'"Liberation Mono",','"Courier New",',"monospace"].join(" "),JP=`11px ${QP}`,ZP=`12px ${QP}`;function eR(e){return"number"==typeof e&&Number.isFinite(e)}function tR(e){return eR(e)&&e>0}function nR(e){return eR(e)?Math.min(1,Math.max(0,e)):0}function iR(e,t=3){return eR(e)?e.toFixed(t):String(e)}function rR(e,t){const n=Number(e),i=Number(t);return!Number.isFinite(n)||!Number.isFinite(i)||n<=0||i<=0?"n/a":`${Math.round(n)}x${Math.round(i)}`}var oR=new WeakMap,sR=new WeakMap,aR=new WeakMap,lR=new WeakMap,cR=new WeakMap,uR=new WeakMap,dR=new WeakMap,hR=new WeakSet;class fR{constructor({width:e=220,height:t=48,windowMs:n=6e4,maxValue:i=60,autoScale:r=!1,formatValue:o}={}){O(this,hR),F(this,oR,void 0),F(this,sR,void 0),F(this,aR,[]),F(this,lR,void 0),F(this,cR,void 0),F(this,uR,void 0),F(this,dR,void 0);const s=null==HP?void 0:HP.document;if(!s||"function"!=typeof s.createElement)throw new Error("Debug overlay graph requires document.createElement.");C(oR,this,s.createElement("canvas")),M(oR,this).width=e,M(oR,this).height=t,M(oR,this).style.width=`${e}px`,M(oR,this).style.height=`${t}px`,M(oR,this).style.borderRadius="6px",M(oR,this).style.background="#111",C(sR,this,M(oR,this).getContext("2d")),C(lR,this,n),C(cR,this,i),C(uR,this,!!r),C(dR,this,"function"==typeof o?o:null)}get element(){return M(oR,this)}push(e,t){if(M(oR,this)&&M(sR,this)&&Number.isFinite(e)&&Number.isFinite(t)){for(M(aR,this).push({t:t,v:e});M(aR,this).length&&t-M(aR,this)[0].t>M(lR,this);)M(aR,this).shift();A(hR,this,pR).call(this)}}dispose(){C(aR,this,[]),C(sR,this,null),C(oR,this,null)}}function pR(){const e=M(sR,this),t=M(oR,this);if(!e||!t)return;const n=t.width,i=t.height;if(!n||!i)return;if(e.clearRect(0,0,n,i),e.fillStyle="#111",e.fillRect(0,0,n,i),!M(aR,this).length)return;const r=M(aR,this)[0].t;if(!(M(aR,this)[M(aR,this).length-1].t>r))return;const o=M(uR,this)?M(aR,this).reduce(((e,t)=>t.v>e?t.v:e),0):M(cR,this),s=o>0?o:M(cR,this);e.strokeStyle="#0f0",e.lineWidth=2,e.beginPath();for(let t=0;t<M(aR,this).length;t+=1){const o=M(aR,this)[t],a=(o.t-r)/M(lR,this)*n,l=i-(s>0?Math.min(1,Math.max(0,o.v/s)):0)*i;0===t?e.moveTo(a,l):e.lineTo(a,l)}e.stroke();const a=M(aR,this).length?M(aR,this)[M(aR,this).length-1]:null,l=Number.isFinite(null==a?void 0:a.v)?a.v:null;if(null===l)return;const c=M(dR,this)?M(dR,this).call(this,l):l.toFixed(1);if("string"!=typeof c||!c)return;e.font=JP,e.textAlign="right",e.textBaseline="top";const u=e.measureText(c),d=Math.ceil(u.width)+8,h=n-d-2;e.fillStyle="rgba(0,0,0,0.55)",e.fillRect(h,2,d,14),e.fillStyle="#fff",e.fillText(c,n-2-4,4)}const mR=new Intl.NumberFormat("en-US");function vR(e,t){const n=(null==e?void 0:e.trackId)||"",i=(null==t?void 0:t.trackId)||"";if(n!==i)return n<i?-1:1;const r=(null==e?void 0:e.nodeId)||"",o=(null==t?void 0:t.nodeId)||"";if(r!==o)return r<o?-1:1;const s=(null==e?void 0:e.segmentId)||"",a=(null==t?void 0:t.segmentId)||"";return s!==a?s<a?-1:1:("number"==typeof(null==e?void 0:e.presentationTime)?e.presentationTime:0)-("number"==typeof(null==t?void 0:t.presentationTime)?t.presentationTime:0)}function gR(e,t){for(e.push(t);e.length&&t-e[0]>1e3;)e.shift();if(e.length<2)return 0;const n=e[e.length-1]-e[0];return n<=0?0:1e3*(e.length-1)/n}function yR(e,t){if("function"!=typeof e||!t)return;const n=e(t.nodeId),i=null==n?void 0:n.tracks;if(!Array.isArray(i))return;const r=i.find((e=>(null==e?void 0:e.id)===t.trackId)),o=null==r?void 0:r.segments;return Array.isArray(o)?o.find((e=>(null==e?void 0:e.id)===t.segmentId)):void 0}function bR(e,t){var n;const i=yR(e,t);return(null==i?void 0:i.abrDecision)||(null==i||null===(n=i.chosenRepresentation)||void 0===n?void 0:n.abrDecision)}function kR(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"n/a":`${mR.format(Math.round(t))}kbps`}function wR(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"n/a":`${mR.format(Math.round(t/1e3))}kbps`}function xR(e,t=3){const n=Number(e);return Number.isFinite(n)?n.toLocaleString("en-US",{minimumFractionDigits:t,maximumFractionDigits:t}):String(e)}function _R(e,t){var n;if("function"!=typeof e||!t)return;const i=e(t.nodeId),r=null==i||null===(n=i.manifestRef)||void 0===n?void 0:n.encodeProfile;return"string"==typeof r&&r?r:void 0}function TR(e,t){if("function"!=typeof e||!t)return;const n=e(t.nodeId);return!0===(null==n?void 0:n.imageFallbackActive)?"image":void 0}function ER(e,t){const n=function(e){if(!e)return;const t=[[e.displayWidth,e.displayHeight],[e.codedWidth,e.codedHeight],[e.videoWidth,e.videoHeight],[e.naturalWidth,e.naturalHeight],[e.width,e.height]];for(let e=0;e<t.length;e+=1){const[n,i]=t[e],r=Number(n),o=Number(i);if(Number.isFinite(r)&&Number.isFinite(o)&&r>0&&o>0)return{width:r,height:o}}}(null==t?void 0:t.frame)||{},i=Number.isFinite(null==t?void 0:t.width)?t.width:n.width,r=Number.isFinite(null==t?void 0:t.height)?t.height:n.height,o=function(e,t,n){return null===(n=yR(e,t))||void 0===n?void 0:n.chosenRepresentation}(e,t);if(!o)return eR(i)&&eR(r)?{width:i,height:r}:null;const s=o.width||o.codedWidth||i,a=o.height||o.codedHeight||r;return{id:o.id,codecs:o.codecs,mime:o.mime,bandwidth:o.bandwidth,width:s,height:a}}function IR(e){const t=Number(e);if(Number.isFinite(t)&&!(t<=0))return t/1e3}function SR(e,t){const n=Number(null==e?void 0:e.bandwidthKbps),i=Number(null==t?void 0:t.bandwidthKbps),r=Number.isFinite(n)&&n>0,o=Number.isFinite(i)&&i>0;if(r&&o&&n!==i)return n-i;if(r!==o)return r?-1:1;const s=(null==e?void 0:e.id)||"",a=(null==t?void 0:t.id)||"";return s===a?0:s<a?-1:1}function AR(e,t,n,i){const r=[];if(Array.isArray(null==i?void 0:i.availableRepresentations)&&i.availableRepresentations.forEach((e=>{const t="string"==typeof(null==e?void 0:e.id)&&e.id?e.id:void 0;if(!t)return;const n=Number(null==e?void 0:e.bandwidthKbps);r.push({id:t,bandwidthKbps:Number.isFinite(n)&&n>0?n:void 0})})),!r.length){const n=yR(e,t);(Array.isArray(null==n?void 0:n.representations)?n.representations:[]).forEach((e=>{const t="string"==typeof(null==e?void 0:e.id)&&e.id?e.id:void 0;t&&r.push({id:t,bandwidthKbps:IR(null==e?void 0:e.bandwidth)})}))}!r.length&&(null==n?void 0:n.id)&&r.push({id:n.id,bandwidthKbps:IR(n.bandwidth)});const o=new Map;return r.forEach((e=>{const t=null==e?void 0:e.id;t&&!o.has(t)&&o.set(t,e)})),Array.from(o.values()).sort(SR)}const NR=1024,MR=1048576,FR=1073741824;function CR(e){return eR(e)?e>=1e3?`${iR(e/1e3,1)} Mbps`:`${iR(e,1)} kbps`:"n/a"}function OR({downloadSpeed:e,downloadEvents:t}={}){const n=HP.document,i="function"==typeof(null==e?void 0:e.getKbps)?e.getKbps():void 0;let r=0;const{metricsRow:o,setInitial:s,setTotal:a}=function(e){const t=e.createElement("div");t.style.display="grid",t.style.gridTemplateColumns="1fr 1fr",t.style.gap="8px",t.style.font=ZP;const n=e.createElement("div"),i=e.createElement("div");return t.appendChild(n),t.appendChild(i),{metricsRow:t,setInitial:e=>{n.textContent=`initial=${CR(e)}`},setTotal:e=>{var t;i.textContent="total="+(eR(t=e)?t<NR?`${Math.round(t)} B`:t<MR?`${iR(t/NR,1)} KB`:t<FR?`${iR(t/MR,2)} MB`:`${iR(t/FR,2)} GB`:"n/a")}}}(n),{graphWrap:l,speedGraph:c}=function(e,t){const n=e.createElement("div");n.style.marginTop="10px";const i=e.createElement("div");i.textContent="download speed",i.style.font=JP,i.style.opacity="0.9";const r=eR(t)&&t>0?t:1,o=new fR({autoScale:!0,maxValue:r,formatValue:CR});return n.appendChild(i),n.appendChild(o.element),{graphWrap:n,speedGraph:o}}(n,i);s(i),a(r);const u=e=>{const t=Number(null==e?void 0:e.kbps);Number.isFinite(t)&&c.push(t,null!=HP&&HP.performance&&"function"==typeof HP.performance.now?HP.performance.now():Date.now())},d=e=>{const t=Number(null==e?void 0:e.bytes);Number.isFinite(t)&&(r+=t,a(r))};return e&&"function"==typeof e.on&&e.on("download:speed",u),t&&"function"==typeof t.on&&t.on("download:sample",d),{id:"downloads",title:"Downloads",render:e=>{e.appendChild(o),e.appendChild(l)},dispose:()=>{e&&"function"==typeof e.off&&e.off("download:speed",u),t&&"function"==typeof t.off&&t.off("download:sample",d),c.dispose()}}}function PR(e){return eR(e)?iR(e,3):"n/a"}function RR(){return null!=HP&&HP.performance&&"function"==typeof HP.performance.now?HP.performance.now():Date.now()}var DR,LR,BR,zR={exports:{}},WR=(DR||(DR=1,LR=zR,function(e,t){LR.exports?LR.exports=t():e.log=t()}(zR.exports,(function(){var e=function(){},t="undefined",n=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},o=null;function s(e,t){var n=e[t];if("function"==typeof n.bind)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(t){return function(){return Function.prototype.apply.apply(n,[e,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?e:this.methodFactory(o,n,this.name)}if(this.log=this.debug,typeof console===t&&n<this.levels.SILENT)return"No console available for logging"}function c(e){return function(){typeof console!==t&&(l.call(this),this[e].apply(this,arguments))}}function u(i,r,o){return"debug"===(l=i)&&(l="log"),typeof console!==t&&("trace"===l&&n?a:void 0!==console[l]?s(console,l):void 0!==console.log?s(console,"log"):e)||c.apply(this,arguments);var l}function d(e,n){var s,a,c,d=this,h="loglevel";function f(){var e;if(typeof window!==t&&h){try{e=window.localStorage[h]}catch(e){}if(typeof e===t)try{var n=window.document.cookie,i=encodeURIComponent(h),r=n.indexOf(i+"=");-1!==r&&(e=/^([^;]+)/.exec(n.slice(r+i.length+1))[1])}catch(e){}return void 0===d.levels[e]&&(e=void 0),e}}function p(e){var t=e;if("string"==typeof t&&void 0!==d.levels[t.toUpperCase()]&&(t=d.levels[t.toUpperCase()]),"number"==typeof t&&t>=0&&t<=d.levels.SILENT)return t;throw new TypeError("log.setLevel() called with invalid level: "+e)}"string"==typeof e?h+=":"+e:"symbol"==typeof e&&(h=void 0),d.name=e,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(e,n){return c=p(e),!1!==n&&function(e){var n=(i[e]||"silent").toUpperCase();if(typeof window!==t&&h){try{return void(window.localStorage[h]=n)}catch(e){}try{window.document.cookie=encodeURIComponent(h)+"="+n+";"}catch(e){}}}(c),l.call(d)},d.setDefaultLevel=function(e){a=p(e),f()||d.setLevel(e,!1)},d.resetLevel=function(){c=null,function(){if(typeof window!==t&&h){try{window.localStorage.removeItem(h)}catch(e){}try{window.document.cookie=encodeURIComponent(h)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}(),l.call(d)},d.enableAll=function(e){d.setLevel(d.levels.TRACE,e)},d.disableAll=function(e){d.setLevel(d.levels.SILENT,e)},d.rebuild=function(){if(o!==d&&(s=p(o.getLevel())),l.call(d),o===d)for(var e in r)r[e].rebuild()},s=p(o?o.getLevel():"WARN");var m=f();null!=m&&(c=p(m)),l.call(d)}(o=new d).getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=r[e];return t||(t=r[e]=new d(e,o.methodFactory)),t};var h=typeof window!==t?window.log:void 0;return o.noConflict=function(){return typeof window!==t&&window.log===o&&(window.log=h),o},o.getLoggers=function(){return r},o.default=o,o}))),zR.exports),$R=(BR=WR)&&BR.__esModule&&Object.prototype.hasOwnProperty.call(BR,"default")?BR.default:BR;const jR=()=>{},UR=["trace","log","debug","info","warn","error","getLevel","setLevel"],qR=["trace","debug","info","warn","error","silent"],VR={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;"},GR="undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global;let HR={level:"trace",appName:""},KR=[];const XR="object"==typeof GR&&GR.performance&&"function"==typeof GR.performance.now?GR.performance.now.bind(GR.performance):Date.now.bind(Date),YR=e=>e&&"string"==typeof e?e.toLowerCase().trim():"",QR=(()=>{try{const e=new URLSearchParams(document.location.search),t=[].concat(e.getAll("log")).concat(e.getAll("ekolog")).concat(e.getAll("ekologger")).join(",").split(",");if(0===t.length)return{};let n={};return t.forEach((e=>{const[t,i]=e.split(":");n[YR(t)]=YR(i)||"trace"})),n}catch(e){return{}}})(),JR=(e,t="")=>{const n=YR(e),i=$R.getLogger(n);if(i.__ekologger)return i.__ekologger;t||QR[n]||QR["*"]||(i.__noExplicitLevel=!0);const r=i.methodFactory;i.methodFactory=(t,n,i)=>{const o=r(t,n,i),s=t.toUpperCase();return(...t)=>{o(`[${((e,t=3)=>(XR()/1e3).toFixed(t))()}] %c[${s}] ${HR.appName?`[${HR.appName}] `:""}[${e}]`,VR[s],...t)}},t=QR[n]||QR["*"]||t||HR.level,i.setLevel(t,!1);const o=(...e)=>i.log(...e);return UR.forEach((e=>{o[e]=(...t)=>(KR.forEach((n=>{n[e](...t)})),i[e](...t))})),i.__ekologger=o,o};JR.setDefaults=({appName:e="",level:t})=>{e&&"string"==typeof e&&(HR.appName=e),(t=YR(t))&&qR.includes(t)&&(HR.level=t,Object.values($R.getLoggers()).filter((e=>e.__noExplicitLevel)).forEach((e=>e.setLevel(HR.level,!1))))},JR.installDriver=e=>{const t={...UR.reduce(((t,n)=>(t[n]="function"==typeof(null==e?void 0:e[n])?e[n]:jR,t)),{})};KR.push(t)},JR("download","warn");Object.freeze(Object.entries({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"]}}).reduce(((e,[t,n])=>(Object.prototype.hasOwnProperty.call(n,"default")&&(e[t]=n.default),e)),{})),JR("config","warn");const ZR=18,eD="rgba(83,170,255,0.9)",tD={pending:"rgba(255,255,255,0.55)",resolving:"rgba(255,200,87,0.9)",ready:"rgba(102,214,141,0.9)",failed:"rgba(255,92,92,0.9)",missing:"rgba(160,160,160,0.9)"},nD={border:"1px solid rgba(102,214,141,0.28)",background:"rgba(102,214,141,0.16)",color:"rgba(167,240,185,1)"},iD={border:"1px solid rgba(255,200,87,0.3)",background:"rgba(255,200,87,0.16)",color:"rgba(255,227,171,1)"},rD="noop",oD="seek",sD="copy-node-id",aD="copy-node-context",lD="copy-source-video-url",cD=[{value:rD,label:"NOOP"},{value:oD,label:"Seek"},{value:sD,label:"Copy Node ID"},{value:aD,label:"Copy Node Context"},{value:lD,label:"Copy Source Video URL"}],uD=["type","url","mimeType","assetId","assetRevision","encodeProfile","duration","width","height"],dD=["id","url","mime","codecs","baseCodec","bandwidth","timescale","sizeBytes","width","height","frameRate","segStart","segDuration"];function hD(e,t){if(tR(null==e?void 0:e.nodeDurationOverride))return e.nodeDurationOverride;if("function"!=typeof t)return null;const n=t(null==e?void 0:e.nodeId),i=null==n?void 0:n.duration;return tR(i)?i:null}function fD(e){const t=Number(null==e?void 0:e.duration);return t===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:tR(t)?t:null}function pD(e){return e===Number.POSITIVE_INFINITY}function mD(e){return eR(e)?String(e):""}function vD(e,t=[]){return t.reduce(((t,n)=>(void 0!==(null==e?void 0:e[n])&&(t[n]=e[n]),t)),{})}function gD(e){const t=cD.find((t=>t.value===e));return t?t.value:rD}function yD(e){return e?"string"==typeof(null==e?void 0:e.message)&&e.message?e.message:"string"==typeof e&&e?e:null:null}function bD(e){return e&&eR(e.start)&&eR(e.end)?{start:e.start,end:e.end}:null}function kD(e){return e?vD(e,dD):null}function wD(e,t){const n="string"==typeof(null==e?void 0:e.nodeId)?e.nodeId:"",i="function"==typeof t&&n?t(n):null,r=function(e){return e?"string"==typeof e?e:vD(e,uD):null}(null==i?void 0:i.manifestRef),o=r&&"object"==typeof r?r.assetId:void 0,s={placement:{placementId:"string"==typeof(null==e?void 0:e.placementId)?e.placementId:void 0,nodeId:n||void 0,offset:eR(null==e?void 0:e.offset)?e.offset:void 0,duration:hD(e,t),offsetPending:!0===(null==e?void 0:e.offsetPending),nodeOffsetOverride:eR(null==e?void 0:e.nodeOffsetOverride)?e.nodeOffsetOverride:void 0,nodeDurationOverride:eR(null==e?void 0:e.nodeDurationOverride)?e.nodeDurationOverride:void 0},node:i?{id:i.id||n||void 0,state:"string"==typeof i.state?i.state:void 0,duration:eR(i.duration)?i.duration:null,mainTrackId:"string"==typeof i.mainTrackId?i.mainTrackId:void 0,assetId:"string"==typeof o?o:void 0,manifestRef:r,buffered:bD(i.buffered),imageFallbackActive:!0===i.imageFallbackActive,retainedByteLength:eR(i.retainedByteLength)?i.retainedByteLength:0,children:Array.isArray(i.children)?i.children.map((e=>({nodeId:"string"==typeof(null==e?void 0:e.nodeId)?e.nodeId:void 0,weight:eR(null==e?void 0:e.weight)?e.weight:void 0}))):[],tracks:Array.isArray(i.tracks)?i.tracks.map((e=>function(e){return e?{id:e.id,type:e.type,offset:eR(e.offset)?e.offset:0,duration:eR(e.duration)?e.duration:null,endTime:eR(e.endTime)?e.endTime:null,buffered:bD(e.buffered),segments:Array.isArray(e.segments)?e.segments.map((e=>function(e){if(!e)return null;const t={id:e.id,isInit:!0===e.isInit,offset:eR(e.offset)?e.offset:0,duration:eR(e.duration)?e.duration:0,bufferedRatio:eR(e.bufferedRatio)?e.bufferedRatio:0,retainedByteLength:eR(e.retainedByteLength)?e.retainedByteLength:0,isLoaded:!0===e.isLoaded,loadAttempts:eR(Number(e.loadAttempts))?Number(e.loadAttempts):0,appliedFilters:Array.isArray(e.appliedFilters)?e.appliedFilters.slice():[],chosenRepresentation:kD(e.chosenRepresentation),representations:Array.isArray(e.representations)?e.representations.map((e=>kD(e))).filter(Boolean):[]},n=yD(e.loadError);return n&&(t.loadError=n),t}(e))).filter(Boolean):[]}:null}(e))).filter(Boolean):[]}:null};if(i){const e=Number(i.manifestLoadAttempts);eR(e)&&e>0&&(s.node.manifestLoadAttempts=e);const t=yD(i.manifestLoadError);t&&(s.node.manifestLoadError=t);const n=yD(i.error);n&&(s.node.error=n)}return s}function xD(e=[],t=[],n){const i=function(e=[],t){return Array.isArray(e)&&e.length?e.map((e=>e?["string"==typeof e.placementId?e.placementId:"","string"==typeof e.nodeId?e.nodeId:"",mD(e.offset),mD(hD(e,t)),!0===e.offsetPending?"1":"0",mD(e.nodeOffsetOverride),mD(e.nodeDurationOverride)].join("|"):"null")).join(";"):""}(e,n);return`${i}::${function(e=[]){return Array.isArray(e)&&e.length?e.map((e=>{if(!e)return"null";const t="string"==typeof e.renderPlacementId?e.renderPlacementId:"",n="string"==typeof e.type?e.type:"",i=mD(e.offset),r=fD(e);return[t,n,i,r===Number.POSITIVE_INFINITY?"inf":mD(r),!0===e.offsetPending?"1":"0"].join("|")})).join(";"):""}(t)}`}function _D(e=[],t){if(!Array.isArray(e)||!e.length)return!1;for(let n=0;n<e.length;n+=1){const i=e[n];if(!i||!0===i.offsetPending)continue;if(tR(i.nodeDurationOverride))continue;if("function"!=typeof t)return!0;const r=t(i.nodeId);if(!tR(null==r?void 0:r.duration))return!0}return!1}function TD(e=[]){return!(!Array.isArray(e)||!e.length)&&e.some((e=>!0===(null==e?void 0:e.offsetPending)))}function ED(e=[],t=[]){return TD(e)||TD(t)}function ID(e,t=[],n){if(!e||!Array.isArray(t)||!t.length)return;const i=e.querySelector('[data-segment-boundary="true"]');t.forEach((t=>{if(!t||!eR(t.startRatio)||!eR(t.endRatio))return;const r=nR(t.startRatio),o=nR(t.endRatio);if(!(o>r))return;const s=HP.document.createElement("div");s.dataset.bufferedSegment="true",s.style.position="absolute",s.style.top="0",s.style.bottom="0",s.style.left=100*r+"%",s.style.width=100*(o-r)+"%",s.style.background=n,s.style.opacity="0.8",s.style.pointerEvents="none",s.style.zIndex="0",i?e.insertBefore(s,i):e.appendChild(s)}))}function SD(e,t){if(!e)return;const n=e.querySelector('[data-active-highlight="true"]');if(!t)return void(n&&n.remove());if(n)return;const i=HP.document.createElement("div");i.dataset.activeHighlight="true",i.style.position="absolute",i.style.top="0",i.style.bottom="0",i.style.left="0",i.style.right="0",i.style.border="1px solid rgba(255,255,255,0.9)",i.style.borderRadius="4px",i.style.pointerEvents="none",i.style.zIndex="1",e.appendChild(i)}function AD({timeline:e,getNode:t,assetsDeliveryServiceUrl:n}={}){const i=null==HP?void 0:HP.document;if(!i||"function"!=typeof i.createElement)throw new Error("Debug overlay timeline tab requires document.createElement.");const r=i.createElement("div");r.style.display="flex",r.style.flexDirection="column",r.style.gap="8px",r.style.position="relative";const o=i.createElement("div");o.style.position="absolute",o.style.display="none",o.style.pointerEvents="none",o.style.zIndex="2",o.style.padding="4px 6px",o.style.borderRadius="6px",o.style.background="rgba(0,0,0,0.8)",o.style.border="1px solid rgba(255,255,255,0.2)",o.style.color="#fff",o.style.font=JP,o.style.maxWidth="220px",o.style.whiteSpace="nowrap",o.style.overflow="hidden",o.style.textOverflow="ellipsis";const s=i.createElement("div");s.dataset.timelineHoverDetails="true",s.style.position="absolute",s.style.display="none",s.style.pointerEvents="none",s.style.zIndex="3",s.style.padding="6px 8px",s.style.borderRadius="8px",s.style.background="rgba(0,0,0,0.85)",s.style.border="1px solid rgba(255,255,255,0.25)",s.style.color="#fff",s.style.font=JP,s.style.maxWidth="260px",s.style.flexDirection="column",s.style.gap="6px";const a=i.createElement("div");a.style.font=ZP,a.style.opacity="0.95";const l=i.createElement("div");l.style.font=JP,l.style.opacity="0.7",l.style.textTransform="uppercase",l.style.marginTop="4px";const c=i.createElement("div");c.style.display="flex",c.style.flexDirection="column",c.style.gap="4px",s.appendChild(a),s.appendChild(l),s.appendChild(c);const u=i.createElement("div");u.style.display="flex",u.style.justifyContent="space-between",u.style.alignItems="center";const d=i.createElement("div");d.style.display="flex",d.style.alignItems="baseline",d.style.gap="10px";const h=i.createElement("div");h.style.font=ZP,h.style.opacity="0.9";const f=i.createElement("div");f.style.font=JP,f.style.opacity="0.65",d.appendChild(h),d.appendChild(f);const p=i.createElement("label");p.style.display="inline-flex",p.style.alignItems="center",p.style.gap="6px",p.style.font=JP;const m=i.createElement("span");m.textContent="Click action";const v=i.createElement("select");v.style.font=JP,v.style.background="rgba(255,255,255,0.08)",v.style.color="#fff",v.style.border="1px solid rgba(255,255,255,0.2)",v.style.borderRadius="4px",v.style.padding="2px 6px",v.style.minHeight="24px",v.style.cursor="pointer",cD.forEach((e=>{const t=i.createElement("option");t.value=e.value,t.textContent=e.label,v.appendChild(t)})),v.value=rD;const g=i.createElement("div");g.dataset.timelineCopyStatus="true",g.setAttribute("role","status"),g.setAttribute("aria-live","polite"),g.style.display="none",g.style.position="absolute",g.style.right="0",g.style.bottom="calc(100% + 4px)",g.style.alignItems="center",g.style.padding="1px 6px",g.style.borderRadius="999px",g.style.border=nD.border,g.style.background=nD.background,g.style.color=nD.color,g.style.font=JP,g.style.whiteSpace="nowrap",g.style.pointerEvents="none",g.style.zIndex="4",g.style.opacity="0",g.style.transform="translateY(2px)",g.style.transition=["opacity 180ms ease","transform 180ms ease"].join(", "),p.appendChild(m),p.appendChild(v);const y=i.createElement("div");y.style.display="flex",y.style.alignItems="center",y.style.position="relative",y.style.flexShrink="0",y.appendChild(g),y.appendChild(p),u.appendChild(d),u.appendChild(y);const b=i.createElement("div");function k(e,t,{alignTop:n=!1}={}){const r=i.createElement("div");r.style.display="grid",r.style.gridTemplateColumns="64px 1fr",r.style.alignItems=n?"start":"center",r.style.gap="8px";const o=i.createElement("div");o.textContent=e,o.style.font=JP,o.style.opacity="0.8",n&&(o.style.paddingTop="2px");const s=i.createElement("div");s.style.position="relative",s.style.borderRadius="6px",s.style.background="rgba(255,255,255,0.08)",s.style.overflow="hidden",t&&(s.dataset.timelineLane=t);const a=i.createElement("div");return a.style.position="absolute",a.style.top="0",a.style.bottom="0",a.style.width="2px",a.style.background="rgba(255,255,255,0.8)",s.appendChild(a),r.appendChild(o),r.appendChild(s),b.appendChild(r),{track:s,indicator:a}}b.style.display="grid",b.style.gridTemplateRows="auto auto",b.style.gap="8px",r.appendChild(u),r.appendChild(b),r.appendChild(o),r.appendChild(s);const w=k("Nodes","nodes",{alignTop:!0}),x=k("Render","render");let _=[],T=[],E=0,I=rD,S=1;const A=new Map,N=new Map,M=new Map,F=new Map;let C=new Set,O=null,P=!1,R="",D=!1,L=0,B=0,z=null,W=null,$=null;function j(e){for(;e.childNodes.length>1;)e.removeChild(e.lastChild)}function U(){z&&(clearTimeout(z),z=null)}function q(){W&&(((null==HP?void 0:HP.clearTimeout)||clearTimeout)(W),W=null)}function V(){$&&(((null==HP?void 0:HP.clearTimeout)||clearTimeout)($),$=null)}function G(){g.style.display="none",g.style.opacity="0",g.style.transform="translateY(2px)",g.textContent=""}function H(){return!!D||!!e&&(Array.isArray(e.placements)||Array.isArray(e.renderPlacements))}function K(){if(!e)return!1;const t=Array.isArray(e.placements),n=Array.isArray(e.renderPlacements);if(!t&&!n)return!1;const i=t?e.placements:[],r=n?e.renderPlacements:[];return(i.length!==L||r.length!==B)&&(de(i,r),!0)}function X(){if(!D)return!1;const e=xD(_,T,t);return e!==R&&(R=e,ae(),ue(),!0)}function Y(){H()?z=function({shouldSchedule:e,isScheduled:t,intervalMs:n,onTick:i}){return t?null:setTimeout(i,n)}({shouldSchedule:!0,isScheduled:!!z,intervalMs:D?100:250,onTick:()=>{z=null,H()&&(K()||X()||Y())}}):U()}function Q(e,t){const n=t>0?E/t:0;e.style.left=100*nR(n)+"%",e.style.transform="translateX(-1px)"}function J(){o.style.display="none"}function Z(){q(),V(),G()}function ee(e,{tone:t="success"}={}){if(!e)return void Z();q(),V(),function(e="success"){const t=function(e="success"){return"warning"===e?iD:nD}(e);g.style.border=t.border,g.style.background=t.background,g.style.color=t.color}(t),g.textContent=e,g.style.display="inline-flex",g.style.opacity="0",g.style.transform="translateY(2px)","function"==typeof g.getBoundingClientRect&&g.getBoundingClientRect(),g.style.opacity="1",g.style.transform="translateY(0)";const n=(null==HP?void 0:HP.setTimeout)||setTimeout;W=n((()=>{W=null,function(){q(),V(),g.style.opacity="0",g.style.transform="translateY(-2px)";const e=(null==HP?void 0:HP.setTimeout)||setTimeout;$=e((()=>{$=null,G()}),180)}()}),1800)}function te(e,t){if(!e)return void J();o.textContent=e,o.style.display="block";const n=r.getBoundingClientRect(),i=o.getBoundingClientRect(),s=((null==t?void 0:t.clientX)||0)-n.left+12,a=((null==t?void 0:t.clientY)||0)-n.top+12,l=n.width-i.width-8,c=n.height-i.height-8,u=Math.max(8,Math.min(s,l)),d=Math.max(8,Math.min(a,c));o.style.left=`${u}px`,o.style.top=`${d}px`}function ne(){s.style.display="none"}function ie(e,n){const o="function"==typeof t&&e?t(e):null,u=Array.isArray(null==o?void 0:o.children)?o.children:[];if(!u.length)return void ne();if(a.textContent=e,l.textContent="children",function(){for(;c.firstChild;)c.removeChild(c.firstChild)}(),u.forEach((e=>{e&&e.nodeId&&c.appendChild(function(e){const n=i.createElement("div");n.style.display="grid",n.style.gridTemplateColumns="10px 1fr auto auto",n.style.alignItems="center",n.style.gap="6px";const r="string"==typeof(null==e?void 0:e.nodeId)?e.nodeId:"",o=tR(null==e?void 0:e.weight)?e.weight:1,s=function(e){if(!e||"function"!=typeof t)return"missing";const n=t(e);if(!n)return"missing";const i="string"==typeof n.state?n.state.trim().toLowerCase():"";return"pending"===i||"resolving"===i||"ready"===i||"failed"===i?i:"pending"}(r);n.dataset.childId=r,n.dataset.childStatus=s;const a=i.createElement("span");a.dataset.statusIndicator=s,a.style.width="8px",a.style.height="8px",a.style.borderRadius="999px",a.style.background=tD[s]||tD.pending,a.style.display="inline-block";const l=i.createElement("span");l.textContent=r||"unknown",l.style.overflow="hidden",l.style.textOverflow="ellipsis",l.style.whiteSpace="nowrap";const c=i.createElement("span");c.textContent=`w=${iR(o,0)}`,c.style.opacity="0.8";const u=i.createElement("span");return u.textContent=s,u.style.opacity="0.75",n.appendChild(a),n.appendChild(l),n.appendChild(c),n.appendChild(u),n}(e))})),!c.childNodes.length)return void ne();s.style.display="flex";const d=r.getBoundingClientRect(),h=s.getBoundingClientRect(),f=((null==n?void 0:n.clientX)||0)-d.left+12,p=((null==n?void 0:n.clientY)||0)-d.top+12,m=d.width-h.width-8,v=d.height-h.height-8,g=Math.max(8,Math.min(f,m)),y=Math.max(8,Math.min(p,v));s.style.left=`${g}px`,s.style.top=`${y}px`}function re(){const t=E;if(e&&"function"==typeof e.getPlacementsActiveAtTime){const n=e.getPlacementsActiveAtTime(t),i=new Set(n.map((e=>null==e?void 0:e.placementId)).filter((e=>"string"==typeof e&&e.length)));C.forEach((e=>{i.has(e)||SD(M.get(e),!1)})),i.forEach((e=>{C.has(e)||SD(M.get(e),!0)})),C=i}else w.track.querySelectorAll('[data-timeline-item="nodes"]').forEach((e=>{const n="true"===e.dataset.hasDuration,i=Number(e.dataset.start),r=Number(e.dataset.end);SD(e,n&&eR(t)&&t>=i&&t<r)}));if(e&&"function"==typeof e.getActiveRenderPlacement){const n=e.getActiveRenderPlacement(t),i=null==n?void 0:n.renderPlacementId;O&&O!==i&&SD(F.get(O),!1),i&&O!==i&&SD(F.get(i),!0),O=i||null}else x.track.querySelectorAll('[data-timeline-item="render"]').forEach((e=>{const n="true"===e.dataset.hasDuration,i=Number(e.dataset.start),r=Number(e.dataset.end);SD(e,n&&eR(t)&&t>=i&&t<r)}))}function oe(e){const n=hD(e,t);if(!tR(n)||"function"!=typeof t)return{boundaries:[],buffered:[]};const i=t(null==e?void 0:e.nodeId),r=function(e){const t=Array.isArray(null==e?void 0:e.tracks)?e.tracks:[];if(!t.length)return null;if(null!=e&&e.mainTrackId){const n=t.find((t=>(null==t?void 0:t.id)===e.mainTrackId));if(n)return n}return t.find((e=>Array.isArray(null==e?void 0:e.segments)&&e.segments.length))||null}(i);if(!r)return{boundaries:[],buffered:[]};const o=e=>{if(!e)return 0;const t=Number(null==e?void 0:e.bufferedRatio);if(Number.isFinite(t))return nR(t);const n=Number(null==e?void 0:e.retainedByteLength);if(!tR(n))return 0;const i=null==e?void 0:e.chosenRepresentation,r=tR(null==i?void 0:i.sizeBytes)?i.sizeBytes:null;return tR(r)?nR(n/r):1},s=Array.isArray(r.segments)?r.segments:[],a=eR(null==r?void 0:r.offset)?r.offset:0,l=eR(null==e?void 0:e.nodeOffsetOverride)?e.nodeOffsetOverride:0;if(!s.length){const e=null==i?void 0:i.buffered,t=eR(null==e?void 0:e.start)?e.start-l:0,r=eR(null==e?void 0:e.end)?e.end-l:0,o=Math.max(0,t),s=Math.min(n,r);return s>o?{boundaries:[],buffered:[{startRatio:o/n,endRatio:s/n}]}:{boundaries:[],buffered:[]}}if("image"===(null==r?void 0:r.type)){const e=s.find((e=>e&&!e.isInit))||s[0],t=e?o(e):0;return t>0?{boundaries:[],buffered:[{startRatio:0,endRatio:nR(t)}]}:{boundaries:[],buffered:[]}}return function(e,t,n,i,r){const o=[],s=[];let a=0;return e.forEach((e=>{if(null!=e&&e.isInit)return;eR(null==e?void 0:e.offset)&&(a=e.offset);const l=a;if(!eR(l))return;const c=eR(null==e?void 0:e.duration)?e.duration:0,u=n+l-i,d=n+(l+c)-i;u>0&&u<t&&o.push(u/t);const h="function"==typeof r?r(e):0;if(c>0&&d>0&&u<t&&h>0){const e=Math.max(0,u),n=Math.min(t,d);if(n>e){const i=e+(n-e)*nR(h);s.push({startRatio:e/t,endRatio:i/t})}}c>0&&(eR(null==e?void 0:e.offset)?a=e.offset+c:a+=c)})),{boundaries:o,buffered:s}}(s,n,a,l,o)}function se(){const e=Array.isArray(_)?_:[],t=new Map(e.map((e=>[null==e?void 0:e.placementId,e])));for(const[e,n]of M.entries()){if(!e)continue;const i=t.get(e);i&&(n.querySelectorAll('[data-buffered-segment="true"]').forEach((e=>e.remove())),ID(n,oe(i).buffered,eD))}}function ae(){const e=new Set(_.map((e=>null==e?void 0:e.nodeId)).filter((e=>"string"==typeof e&&e.length)));e.forEach((e=>{if(N.has(e))return;const n="function"==typeof t?t(e):null;if(!n||"function"!=typeof n.on)return;const i=e=>function(e={}){if(!e||e.isInit)return;const t=null==e?void 0:e.nodeId,n=null==e?void 0:e.segmentId,i=Number(null==e?void 0:e.loaded),r=Number(null==e?void 0:e.total);if(!t||!n||!eR(i))return;const o=`${t}:${n}`,s=A.get(o)||{},a={loaded:Math.max(eR(s.loaded)?s.loaded:0,i),total:tR(r)?r:s.total};A.set(o,a),function(){if(P)return;P=!0;const e=null==HP?void 0:HP.requestAnimationFrame;"function"!=typeof e?((null==HP?void 0:HP.setTimeout)||setTimeout)((()=>{P=!1,se()}),0):e((()=>{P=!1,se()}))}()}(e);n.on("segment:chunk",i),N.set(e,{node:n,handler:i})}));for(const[t,n]of N.entries())e.has(t)||(null!=n&&n.node&&"function"==typeof n.node.off&&n.node.off("segment:chunk",n.handler),N.delete(t))}function le({track:e,color:t,start:n,duration:r,startTime:o,durationSeconds:s,segmentRatios:a,bufferedSegments:l,placementId:c,nodeId:u,label:d,rowIndex:h=0,rowHeight:f=18,rowGap:p=0,laneId:m,isClickable:v,isActive:g,tooltip:y,hoverDetailsNodeId:b,showLabel:k,onClick:w}){const x=i.createElement("div");!function(e,t){e.style.position="absolute",e.style.borderRadius="4px",e.style.background=t,e.style.opacity="0.9",e.style.font=JP,e.style.color="#fff",e.style.display="flex",e.style.alignItems="center",e.style.whiteSpace="nowrap",e.style.overflow="hidden",e.style.textOverflow="ellipsis"}(x,t),function(e,{startRatio:t,durationRatio:n,rowIndex:i=0,rowHeight:r=18,rowGap:o=0}={}){const s=i*(r+o)+2,a=Math.max(1,r-4);e.style.top=`${s}px`,e.style.height=`${a}px`;const l=nR(t);if(tR(n)){const t=Math.max(0,Math.min(n,1-l));return e.style.left=100*l+"%",e.style.width=100*t+"%",void(e.style.padding="0 4px")}e.style.left=100*l+"%",e.style.width="2px",e.style.padding="0"}(x,{startRatio:n,durationRatio:r,rowIndex:h,rowHeight:f,rowGap:p}),function(e,{laneId:t,label:n,isClickable:i,shouldShowLabel:r,onClick:o}={}){if(t&&(e.dataset.timelineItem=t),r&&n){const t=HP.document.createElement("span");t.textContent=n,t.style.position="relative",t.style.zIndex="2",t.style.pointerEvents="none",e.appendChild(t)}i&&(e.style.cursor="pointer"),"function"==typeof o&&e.addEventListener("click",o)}(x,{laneId:m,label:d,isClickable:v,shouldShowLabel:"boolean"==typeof k?k:tR(r),onClick:w}),y&&(x.title=y),eR(o)&&(x.dataset.start=String(o)),tR(s)||pD(s)?(x.dataset.end=String(o+s),x.dataset.hasDuration="true"):(x.dataset.end="",x.dataset.hasDuration="false"),c&&(x.dataset.placementId=c),u&&(x.dataset.nodeId=u),x.style.pointerEvents="auto",ID(x,l,eD),function(e,t=[]){e&&Array.isArray(t)&&t.length&&t.forEach((t=>{if(!eR(t)||t<=0||t>=1)return;const n=HP.document.createElement("div");n.dataset.segmentBoundary="true",n.style.position="absolute",n.style.top="2px",n.style.bottom="2px",n.style.width="1px",n.style.left=100*nR(t)+"%",n.style.transform="translateX(-0.5px)",n.style.background="rgba(255,255,255,0.35)",n.style.pointerEvents="none",n.style.zIndex="1",e.appendChild(n)}))}(x,a),SD(x,g),y&&(x.addEventListener("mouseenter",(e=>te(y,e))),x.addEventListener("mousemove",(e=>te(y,e))),x.addEventListener("mouseleave",J)),b&&(x.addEventListener("mouseenter",(e=>ie(b,e))),x.addEventListener("mousemove",(e=>ie(b,e))),x.addEventListener("mouseleave",ne)),e.appendChild(x),"nodes"===m&&c?M.set(c,x):"render"===m&&c&&F.set(c,x)}async function ce({event:i,placement:r,rangeEnd:o,track:s}){const a=gD(I);if(a===rD)return;if(a===oD)return void function(t,n,i){if(!e)return;if(!tR(n)||!i)return;const r="function"==typeof i.getBoundingClientRect?i.getBoundingClientRect():null,o=tR(null==r?void 0:r.width)?r.width:i.clientWidth;if(!tR(o))return;const s=eR(null==r?void 0:r.left)?r.left:0,a=nR(((eR(null==t?void 0:t.clientX)?t.clientX:0)-s)/o)*n;eR(a)&&(e.currentTime=a)}(i,o,s);const l="string"==typeof(null==r?void 0:r.nodeId)?r.nodeId:"",c="function"==typeof t&&l?t(l):null,u=a===sD?l:a===aD?JSON.stringify(wD(r,t),null,2):function(e,t){return function(e,t){return function(e,t,n){const i=(e||"").replace(/\/$/,""),r=null==n?void 0:n.assetId,o=null==n?void 0:n.assetRevision;if(i&&"string"==typeof r&&"number"==typeof o)return`${i}/raw/${encodeURIComponent(r)}/${o}`}(e,0,t)}(t,null==e?void 0:e.manifestRef)}(c,n),d=a===sD?"Copied node ID":a===aD?"Copied node context":"Copied source video URL";if(u)try{await async function(e,t){const n=null==HP||null===(t=HP.navigator)||void 0===t?void 0:t.clipboard;if(!n||"function"!=typeof n.writeText)throw new Error("Clipboard API unavailable.");await n.writeText(e)}(u),ee(d)}catch(e){}else a===lD&&ee("Source video URL unavailable",{tone:"warning"})}function ue(){const n=function(){let e=0;const n=Array.isArray(_)?_:[],i=Array.isArray(T)?T.filter((e=>!0!==(null==e?void 0:e.offsetPending))):[];return n.forEach((n=>{if(!0===(null==n?void 0:n.offsetPending))return;const i=eR(null==n?void 0:n.offset)?n.offset:void 0;if(!eR(i))return;const r=hD(n,t);e=tR(r)?Math.max(e,i+r):Math.max(e,i)})),i.forEach((t=>{const n=eR(null==t?void 0:t.offset)?t.offset:0,i=fD(t);e=tR(i)?Math.max(e,n+i):Math.max(e,n)})),tR(e)?e:1}();S=n,h.textContent=`t=${iR(E)}s`,f.textContent=`range=0-${iR(n)}s`,J(),ne(),j(w.track),j(x.track),M.clear(),F.clear(),C=new Set,O=null,P=!1;const i=Array.isArray(_)?_:[],r=Array.isArray(T)?T:[],o=function(n){const i=(Array.isArray(n)?n.slice():[]).map((e=>{if(!0===(null==e?void 0:e.offsetPending))return null;const n=eR(null==e?void 0:e.offset)?e.offset:void 0;if(!eR(n))return null;const i=hD(e,t);return{placement:e,offset:n,duration:i,end:tR(i)?n+i:n,rowIndex:0}})).filter(Boolean).sort(((e,t)=>{var n,i,r,o;const s=e.offset-t.offset;if(0!==s)return s;const a="string"==typeof(null===(n=e.placement)||void 0===n?void 0:n.nodeId)?e.placement.nodeId:"",l="string"==typeof(null===(i=t.placement)||void 0===i?void 0:i.nodeId)?t.placement.nodeId:"";if(a!==l)return a.localeCompare(l);const c="string"==typeof(null===(r=e.placement)||void 0===r?void 0:r.placementId)?e.placement.placementId:"",u="string"==typeof(null===(o=t.placement)||void 0===o?void 0:o.placementId)?t.placement.placementId:"";return c.localeCompare(u)})),r=[],o=function(e,t){const n=Number(null==e||null===(t=e.settings)||void 0===t?void 0:t.snapToFps);return!Number.isFinite(n)||n<=0?0:.5/n}(e);return i.forEach((e=>{const t=e.offset,n=eR(e.end)?e.end:t;let i=-1;for(let e=0;e<r.length;e+=1)if(r[e]<=t+o){i=e;break}-1===i?(i=r.length,r.push(n)):r[i]=Math.max(r[i],n),e.rowIndex=i})),{items:i,rowCount:Math.max(1,r.length)}}(i);var s;!function(e){const t=e.rowCount*ZR+4*(e.rowCount-1);w.track.style.height=`${t}px`,x.track.style.height="18px",w.track.style.cursor="default",w.track.style.pointerEvents="auto",x.track.style.pointerEvents="auto"}(o),function(e,t){e.items.forEach((e=>{const n=e.placement,i=e.offset,r=e.duration,o=(null==n?void 0:n.nodeId)||(null==n?void 0:n.placementId)||"node",s=!!eR(E)&&E>=i&&(!tR(r)||E<i+r),a=oe(n),l=gD(I)!==rD;le({track:w.track,color:"rgba(255,255,255,0.16)",start:nR(i/t),duration:tR(r)?nR(r/t):null,startTime:i,durationSeconds:r,segmentRatios:a.boundaries,bufferedSegments:a.buffered,placementId:null==n?void 0:n.placementId,nodeId:null==n?void 0:n.nodeId,label:o,rowIndex:e.rowIndex,rowHeight:ZR,rowGap:4,laneId:"nodes",isClickable:l,isActive:s,tooltip:(null==n?void 0:n.nodeId)||(null==n?void 0:n.placementId),hoverDetailsNodeId:null==n?void 0:n.nodeId,onClick:l?e=>{ce({event:e,placement:n,rangeEnd:t,track:w.track})}:void 0})}))}(o,n),s=n,r.forEach((e=>{const t=eR(null==e?void 0:e.offset)?e.offset:void 0;if(!eR(t))return;const n=fD(e),i=pD(n),r=(null==e?void 0:e.type)||(null==e?void 0:e.renderPlacementId)||"render",o=function(e){const t="string"==typeof e?e.trim().toLowerCase():"";return"switch"===t||"switching"===t||"switchingrendernode"===t}(null==e?void 0:e.type),a=o?()=>{"function"==typeof(null==HP?void 0:HP.switchTo)&&HP.switchTo("next")}:void 0;let l=!1;eR(E)&&(i?l=E>=t:tR(n)&&(l=E>=t&&E<t+n));const c=i&&tR(s)?nR((s-t)/s):tR(n)?nR(n/s):null;le({track:x.track,color:"rgba(248,162,62,0.9)",start:nR(t/s),duration:c,startTime:t,durationSeconds:n,label:r,placementId:null==e?void 0:e.renderPlacementId,rowIndex:0,rowHeight:ZR,rowGap:0,laneId:"render",isClickable:!!o,isActive:l,tooltip:(null==e?void 0:e.type)||(null==e?void 0:e.renderPlacementId),showLabel:tR(n)||i,onClick:a})})),Q(w.indicator,n),Q(x.indicator,n),re(),se(),D=ED(_,T)||_D(_,t),R=D?xD(_,T,t):"",L=Array.isArray(_)?_.length:0,B=Array.isArray(T)?T.length:0,Y()}function de(e,n){_=Array.isArray(e)?e.slice():[],T=Array.isArray(n)?n.slice():[],D=ED(_,T)||_D(_,t),ae(),ue()}return v.addEventListener("change",(()=>{I=gD(v.value),v.value=I,ue()})),{id:"timeline",title:"Timeline",render:e=>{e.appendChild(r),ue()},updatePlacements:de,updateTime:function(e){if(E=eR(e)?e:E,K())return;if(D&&X())return;const t=S;eR(t)&&(h.textContent=`t=${iR(E)}s`,f.textContent=`range=0-${iR(t)}s`,Q(w.indicator,t),Q(x.indicator,t),re())},refresh:()=>ue(),dispose:()=>{U(),Z();for(const e of N.values())(null==e?void 0:e.node)&&"function"==typeof e.node.off&&e.node.off("segment:chunk",e.handler);N.clear(),A.clear()}}}const ND=1024,MD=1048576,FD=1073741824;function CD(e){return eR(e)?e<ND?`${Math.round(e)} B`:e<MD?`${iR(e/ND,1)} KB`:e<FD?`${iR(e/MD,2)} MB`:`${iR(e/FD,2)} GB`:"n/a"}const OD="ekoplayer-debug-overlay";var PD=new WeakMap,RD=new WeakMap,DD=new WeakMap,LD=new WeakMap,BD=new WeakSet;class zD{constructor({tabBarEl:e,contentEl:t}){O(this,BD),F(this,PD,[]),F(this,RD,void 0),F(this,DD,void 0),F(this,LD,void 0),C(DD,this,e),C(LD,this,t)}registerTab(e){e&&"string"==typeof e.id&&"string"==typeof e.title&&"function"==typeof e.render&&(M(PD,this).some((t=>t.id===e.id))||(M(PD,this).push(e),A(BD,this,WD).call(this),M(RD,this)||this.selectTab(e.id)))}selectTab(e){M(PD,this).find((t=>t.id===e))&&(C(RD,this,e),A(BD,this,WD).call(this),A(BD,this,$D).call(this))}dispose(){M(DD,this)&&(M(DD,this).innerHTML=""),M(LD,this)&&(M(LD,this).innerHTML=""),C(PD,this,[]),C(DD,this,null),C(LD,this,null)}}function WD(){const e=M(DD,this);e&&(e.innerHTML="",M(PD,this).forEach((t=>{const n=HP.document.createElement("button");n.type="button",n.textContent=t.title,n.style.cursor="pointer",n.style.padding="6px 10px",n.style.borderRadius="6px",n.style.border="1px solid rgba(255,255,255,0.2)",n.style.background=t.id===M(RD,this)?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.2)",n.style.color="#fff",n.style.font=ZP,n.addEventListener("click",(()=>this.selectTab(t.id))),e.appendChild(n)})))}function $D(){const e=M(LD,this);if(!e)return;e.innerHTML="";const t=M(PD,this).find((e=>e.id===M(RD,this)));t&&t.render(e)}function jD({mountElement:e,canvasElement:t,timeline:n,assetsDeliveryServiceUrl:i,getNode:r,listNodes:o,downloadSpeed:s,downloadEvents:a,qoe:l,qoeEvents:c,options:u={},playbackStartedAtMs:d,playerVersion:h}={}){if(!e)throw new Error("Debug overlay requires mountElement.");if(!n||"function"!=typeof n.on)throw new Error("Debug overlay requires a Timeline with .on/.off.");!function(e){if(!e||!e.style)return;const t=null==HP?void 0:HP.window,n=t&&"function"==typeof t.getComputedStyle?t.getComputedStyle(e):null,i=n?n.position:e.style.position;i&&"static"!==i||(e.style.position="relative")}(e);const f=HP.document.getElementById(OD);f&&f.parentNode&&f.parentNode.removeChild(f);const p=function({mountElement:e,playerVersion:t}){const n=null==HP?void 0:HP.document;if(!n||"function"!=typeof n.createElement)throw new Error("Debug overlay requires document.createElement.");const i=n.createElement("div");i.id=OD,i.style.position="absolute",i.style.inset="0",i.style.zIndex="999999",i.style.pointerEvents="none";const r=n.createElement("div");r.style.position="absolute",r.style.top="8px",r.style.left="8px",r.style.width="460px",r.style.maxWidth="calc(100% - 16px)",r.style.background="rgba(0,0,0,0.65)",r.style.border="1px solid rgba(255,255,255,0.18)",r.style.borderRadius="10px",r.style.padding="10px",r.style.color="#fff",r.style.pointerEvents="auto",r.style.backdropFilter="blur(6px)";const o=n.createElement("div");o.style.display="flex",o.style.justifyContent="space-between",o.style.alignItems="center",o.style.gap="10px";const s=n.createElement("div");s.textContent="EkoPlayer Debug",s.style.font="600 13px ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial";const a=n.createElement("button");a.type="button",a.textContent="Hide",a.style.cursor="pointer",a.style.padding="6px 10px",a.style.borderRadius="8px",a.style.border="1px solid rgba(255,255,255,0.2)",a.style.background="rgba(0,0,0,0.2)",a.style.color="#fff",o.appendChild(s),o.appendChild(a);const l=n.createElement("div");l.style.display="flex",l.style.gap="8px",l.style.marginTop="10px";const c=n.createElement("div");c.style.marginTop="10px";const u=n.createElement("div");u.style.marginTop="10px",u.style.font=JP,u.style.display="flex",u.style.justifyContent="space-between",u.style.alignItems="center",u.style.gap="10px";const d=n.createElement("div");d.style.color="rgba(140, 224, 255, 0.9)",d.textContent="Playback started @ --";const h=n.createElement("div");h.style.opacity="0.7",h.style.marginLeft="auto",h.textContent=t?`version ${t}`:"version n/a",u.appendChild(d),u.appendChild(h);const f=n.createElement("button");return f.type="button",f.textContent="Debug",f.style.position="absolute",f.style.top="8px",f.style.left="8px",f.style.cursor="pointer",f.style.padding="6px 10px",f.style.borderRadius="10px",f.style.border="1px solid rgba(255,255,255,0.25)",f.style.background="rgba(0,0,0,0.55)",f.style.color="#fff",f.style.pointerEvents="auto",f.style.display="none",r.appendChild(o),r.appendChild(l),r.appendChild(c),r.appendChild(u),i.appendChild(r),i.appendChild(f),e.appendChild(i),{overlayRoot:i,panel:r,tabBar:l,content:c,hideBtn:a,showBtn:f,footerPlayback:d}}({mountElement:e,playerVersion:h||(null==u?void 0:u.playerVersion)}),m=new zD({tabBarEl:p.tabBar,contentEl:p.content});let v=!0;function g(){v=!1,p.panel.style.display="none",p.showBtn.style.display="inline-block"}function y(){v=!0,p.panel.style.display="block",p.showBtn.style.display="none"}p.hideBtn.addEventListener("click",g),p.showBtn.addEventListener("click",y);const b=AD({timeline:n,getNode:r,assetsDeliveryServiceUrl:i}),k=function({getNode:e}){const t=HP.document,n=t.createElement("pre");n.style.margin="0",n.style.whiteSpace="pre-wrap",n.style.font=ZP,n.style.lineHeight="1.35";const i=t.createElement("div");i.style.display="flex",i.style.flexDirection="column",i.style.gap="8px",i.style.marginTop="6px";const r=t.createElement("div");r.style.display="flex",r.style.gap="10px",r.style.marginTop="10px",r.style.alignItems="center",r.style.flexWrap="wrap";const o=new fR({maxValue:60}),s=new fR({maxValue:60}),a=t.createElement("div"),l=t.createElement("div");l.textContent="browserfps",l.style.font=JP,l.style.opacity="0.9",a.appendChild(l),a.appendChild(o.element);const c=t.createElement("div"),u=t.createElement("div");return u.textContent="fps",u.style.font=l.style.font,u.style.opacity="0.9",c.appendChild(u),c.appendChild(s.element),r.appendChild(a),r.appendChild(c),{id:"frames",title:"Frames",render:e=>{e.appendChild(n),e.appendChild(i),e.appendChild(r)},pushBrowserFps:(e,t)=>o.push(e,t),pushVisualFps:(e,t)=>s.push(e,t),updateInfo:function({time:r,entries:o}){const s=Array.isArray(o)?o.slice().sort(vR):[];if(!s.length)return n.textContent="",void(i.innerHTML="");n.textContent=`t=${xR(r)}s tracks=${s.length}`,i.innerHTML="";for(let n=0;n<s.length;n+=1){const r=s[n],o=ER(e,r),a=(null==o?void 0:o.id)||"n/a",l=(null==o?void 0:o.codecs)||(null==o?void 0:o.mime)||"n/a",c=wR(null==o?void 0:o.bandwidth),u=rR(null==o?void 0:o.width,null==o?void 0:o.height),d=_R(e,r)||"n/a",h=TR(e,r),f=h?` fallback=${h}`:"",p=bR(e,r),m=(null==p?void 0:p.strategy)||"n/a",v=(null==p?void 0:p.decisionReason)||"n/a",g=kR(null==p?void 0:p.measuredDownloadSpeedKbps),y=kR(null==p?void 0:p.safeBandwidthKbps),b=t.createElement("div");b.style.display="flex",b.style.flexDirection="column",b.style.gap="2px";const k=t.createElement("pre");k.style.margin="0",k.style.whiteSpace="pre-wrap",k.style.font=ZP,k.style.lineHeight="1.35",k.textContent=[`${(null==r?void 0:r.nodeId)||"?"} ${(null==r?void 0:r.trackId)||"?"} ${(null==r?void 0:r.segmentId)||"?"} pts=${xR(null==r?void 0:r.presentationTime)}s`,`rep=${a} encodeProfile=${d}${f} res=${u} codec=${l} repBW=${c}`,`abr=strategy:${m} reason:${v} measuredBW:${g} safeBW:${y}`].join("\n"),b.appendChild(k);const w=(null==p?void 0:p.selectedRepresentationId)||(null==o?void 0:o.id),x=AR(e,r,o,p);if(x.length){const e=t.createElement("div");e.style.display="flex",e.style.alignItems="center",e.dataset.abrLadderRow="true",e.dataset.trackId=(null==r?void 0:r.trackId)||"",e.dataset.segmentId=(null==r?void 0:r.segmentId)||"";const n=t.createElement("div");n.style.display="inline-flex",n.style.alignItems="center",n.style.gap="2px",n.dataset.abrLadder="true",x.forEach((e=>{const i=t.createElement("span"),r=!!w&&e.id===w;i.dataset.abrLadderBlock="true",i.dataset.repId=e.id||"",i.dataset.selected=r?"true":"false",i.style.display="inline-block",i.style.width="10px",i.style.height="8px",i.style.borderRadius="2px",i.style.border="1px solid rgba(255,255,255,0.35)",i.style.background=r?"rgba(74, 222, 128, 0.95)":"rgba(156, 163, 175, 0.55)",i.title=`${e.id||"?"} ${kR(e.bandwidthKbps)}`,n.appendChild(i)})),e.appendChild(n),b.appendChild(e)}i.appendChild(b)}},dispose:()=>{o.dispose(),s.dispose()}}}({getNode:r}),w=OR({downloadSpeed:s,downloadEvents:a}),x=function({qoe:e,qoeEvents:t}={}){const n=null==HP?void 0:HP.document;if(!n||"function"!=typeof n.createElement)throw new Error("Debug overlay QoE tab requires document.createElement.");const i=n.createElement("pre");i.style.margin="0",i.style.whiteSpace="pre-wrap",i.style.font=ZP;const{graphWrap:r,graph:o}=function(e){const t=e.createElement("div");t.style.marginTop="10px";const n=e.createElement("div");n.textContent="qoe score",n.style.font=JP,n.style.opacity="0.9";const i=new fR({maxValue:1,windowMs:3e4,formatValue:e=>PR(e)});return t.appendChild(n),t.appendChild(i.element),{graphWrap:t,graph:i}}(n);let s=null;const a=()=>{i.textContent=function(e){if(!e)return"QoE unavailable";const t="string"==typeof e.status?e.status:"n/a";return[`score=${PR(e.score)}`,`status=${t}`,`streamQualityScore=${PR(e.streamQualityScore)}`,`fpsScore=${PR(e.fpsScore)}`,`browserFps=${PR(e.browserFps)}`,`waitingSeconds=${PR(e.waitingSeconds)}`,`playingSeconds=${PR(e.playingSeconds)}`].join("\n")}(e)},l=()=>{if(!e)return;const t=Number(e.score);Number.isFinite(t)&&o.push(t,RR())},c=e=>{const t=Number(e);Number.isFinite(t)&&o.push(t,RR()),a()},u=()=>{a()};if(a(),l(),t&&"function"==typeof t.on&&(t.on("qoescore",c),t.on("qoestatus",u)),e){const e="function"==typeof(null==HP?void 0:HP.setInterval)?HP.setInterval:setInterval;s=e((()=>{l(),a()}),1e3)}return{id:"qoe",title:"QoE",render:e=>{e.appendChild(i),e.appendChild(r)},dispose:()=>{t&&"function"==typeof t.off&&(t.off("qoescore",c),t.off("qoestatus",u)),s&&(("function"==typeof(null==HP?void 0:HP.clearInterval)?HP.clearInterval:clearInterval)(s),s=null),o.dispose()}}}({qoe:l,qoeEvents:c}),_=function({timeline:e,getNode:t,listNodes:n,options:i}={}){const r=null==HP?void 0:HP.document;if(!r||"function"!=typeof r.createElement)throw new Error("Debug overlay Memory tab requires document.createElement.");const o=r.createElement("pre");o.style.margin="0",o.style.whiteSpace="pre-wrap",o.style.font=ZP;const s=r.createElement("div");s.textContent="nodes",s.style.marginTop="10px",s.style.font=JP,s.style.opacity="0.9";const a=r.createElement("pre");a.style.margin="6px 0 0 0",a.style.whiteSpace="pre-wrap",a.style.font=ZP;let l=null;const c=()=>{const r=function({timeline:e,getNode:t,listNodes:n}){const i=[];let r=0;if("function"==typeof n){let e;try{e=n()}catch(t){e=null}if(Array.isArray(e))return e.forEach((e=>{const t=null==e?void 0:e.id;if("string"!=typeof t||!t.length)return;const n=Number(null==e?void 0:e.retainedByteLength);Number.isFinite(n)&&(r+=n,i.push({nodeId:t,bytes:n}))})),i.sort(((e,t)=>t.bytes-e.bytes)),{totalBytes:r,nodes:i,available:!0}}if(!e||"function"!=typeof t)return{totalBytes:0,nodes:[],available:!1};const o=Array.isArray(e.placements)?e.placements:[];return new Set(o.map((e=>null==e?void 0:e.nodeId)).filter((e=>"string"==typeof e&&e.length))).forEach((e=>{const n=t(e),o=Number(null==n?void 0:n.retainedByteLength);Number.isFinite(o)&&(r+=o,i.push({nodeId:e,bytes:o}))})),i.sort(((e,t)=>t.bytes-e.bytes)),{totalBytes:r,nodes:i,available:!0}}({timeline:e,getNode:t,listNodes:n}),s=function({timeline:e}){if(!e||"function"!=typeof e.getDecodedFrameStats)return{totalBytes:0,frames:0,available:!1};try{const t=e.getDecodedFrameStats(),n=Number(null==t?void 0:t.totalBytes),i=Number(null==t?void 0:t.frames);return{totalBytes:Number.isFinite(n)?n:0,frames:Number.isFinite(i)?i:0,available:!1!==(null==t?void 0:t.available)}}catch(e){return{totalBytes:0,frames:0,available:!1}}}({timeline:e}),l=function(e,t,n,i){const r=Number(null!==(n=null==e||null===(i=e.publicOptions)||void 0===i?void 0:i.segmentEvictionMaxRetainedBytes)&&void 0!==n?n:null==e?void 0:e.segmentEvictionMaxRetainedBytes),o=eR(r)&&r>=0,s=o?CD(r):"n/a";return{active:o&&eR(t)&&t>r,thresholdLabel:s}}(i,r.available?r.totalBytes:NaN),c=l.active?"on":"off",u=s.available?CD(s.totalBytes):"n/a",d=s.available?s.frames:"n/a";if(!r.available)return o.textContent=[`decoded=${u} decodedFrames=${d}`,`retained=n/a eviction=${c} threshold=${l.thresholdLabel}`].join("\n"),void(a.textContent="");if(o.textContent=[`decoded=${u} decodedFrames=${d}`,[`retained=${CD(r.totalBytes)}`,`nodes=${r.nodes.length}`,`eviction=${c}`,`threshold=${l.thresholdLabel}`].join(" ")].join("\n"),!r.nodes.length)return void(a.textContent="none");const h=r.nodes.slice(0,8).map((e=>`${e.nodeId}: ${CD(e.bytes)}`));a.textContent=h.join("\n")};c();const u="function"==typeof(null==HP?void 0:HP.setInterval)?HP.setInterval:setInterval;return l=u(c,1e3),{id:"memory",title:"Memory",render:e=>{e.appendChild(o),e.appendChild(s),e.appendChild(a)},refresh:c,dispose:()=>{l&&(("function"==typeof(null==HP?void 0:HP.clearInterval)?HP.clearInterval:clearInterval)(l),l=null)}}}({timeline:n,getNode:r,listNodes:o,options:u});m.registerTab(b),m.registerTab(k),m.registerTab(w),m.registerTab(x),m.registerTab(_),m.registerTab(function({options:e}={}){const t=null==HP?void 0:HP.document;if(!t||"function"!=typeof t.createElement)throw new Error("Debug overlay options tab requires document.createElement.");const n=t.createElement("pre");n.style.margin="0",n.style.font=ZP,n.style.whiteSpace="pre-wrap",n.style.wordBreak="break-word";const i=null==e?void 0:e.publicOptions,r=i&&"object"==typeof i?Object.keys(i):[];if(r.length){const e=r.map((e=>`${e}=${function(e){if(null===e)return"null";if(void 0===e)return"undefined";const t=typeof e;if("string"===t)return e;if("number"===t||"boolean"===t)return String(e);try{return JSON.stringify(e)}catch(t){return String(e)}}(i[e])}`));n.textContent=e.join("\n")}else n.textContent="publicOptions unavailable";return{id:"options",title:"Options",render:e=>{e.appendChild(n)}}}({options:u}));const T=[],E=[];let I=0,S=0,A=null,N=!1,M=0,F=null;function C(e){const t=Number(e);Number.isFinite(t)&&(t-M<250||(M=t,k.pushBrowserFps(I,t),k.pushVisualFps(S,t)))}HP.window&&"function"==typeof HP.window.requestAnimationFrame&&(A=HP.window.requestAnimationFrame((function e(t){N||(I=gR(T,t),C(t),A=HP.window.requestAnimationFrame(e))})));const O=(e={})=>{if(N||!v)return;const t=Array.isArray(e.frames)?e.frames:[];if(!t.length)return void(F=null);const n=null!=HP&&HP.performance&&"function"==typeof HP.performance.now?HP.performance.now():Date.now(),i=t.map((e=>`${null==e?void 0:e.nodeId}:${null==e?void 0:e.trackId}:${null==e?void 0:e.segmentId}@${null==e?void 0:e.presentationTime}`)).join("|");i!==F&&(S=gR(E,n),F=i),k.updateInfo({time:e.time,entries:t}),C(n)};let P=Number.isFinite(d)?d:void 0;if(Number.isFinite(P)&&p.footerPlayback){const e=P/1e3;p.footerPlayback.textContent=`Playback started @ ${iR(e)}s`}const R=(e={})=>{if(!N&&void 0===P&&"playing"===(null==e?void 0:e.event)&&(P=XP(),p.footerPlayback)){const e=P/1e3;p.footerPlayback.textContent=`Playback started @ ${iR(e)}s`}},D=()=>{const e=Array.isArray(null==n?void 0:n.placements)?n.placements:[],t=Array.isArray(null==n?void 0:n.renderPlacements)?n.renderPlacements:[];b.updatePlacements(e,t)},L=(e={})=>{if(N)return;const t=Number.isFinite(null==e?void 0:e.time)?e.time:null==n?void 0:n.currentTime;b.updateTime(t),_&&"function"==typeof _.refresh&&_.refresh()},B=()=>{N||D()},z=()=>{N||D()},W=null==n?void 0:n.trackBuffers,$=()=>{N||("function"==typeof b.refresh?b.refresh():D(),_&&"function"==typeof _.refresh&&_.refresh())};return n.on(YP.VISUAL_FRAMES_AVAILABLE,O),n.on(YP.TIMELINE_TIME_UPDATE,L),n.on(YP.PLACEMENT_ADDED,B),n.on(YP.RENDER_PLACEMENT_ADDED,z),n.on(YP.TIMELINE_PLAYER_STATE,R),W&&"function"==typeof W.on&&W.on("track:bufferupdate",$),D(),b.updateTime(null==n?void 0:n.currentTime),{show:y,hide:g,dispose:function(){N||(N=!0,A&&HP.window&&"function"==typeof HP.window.cancelAnimationFrame&&HP.window.cancelAnimationFrame(A),A=null,n&&"function"==typeof n.off&&(n.off(YP.VISUAL_FRAMES_AVAILABLE,O),n.off(YP.TIMELINE_TIME_UPDATE,L),n.off(YP.PLACEMENT_ADDED,B),n.off(YP.RENDER_PLACEMENT_ADDED,z),n.off(YP.TIMELINE_PLAYER_STATE,R)),W&&"function"==typeof W.off&&W.off("track:bufferupdate",$),k&&"function"==typeof k.dispose&&k.dispose(),b&&"function"==typeof b.dispose&&b.dispose(),w&&"function"==typeof w.dispose&&w.dispose(),x&&"function"==typeof x.dispose&&x.dispose(),_&&"function"==typeof _.dispose&&_.dispose(),m.dispose(),p.overlayRoot&&p.overlayRoot.parentNode&&p.overlayRoot.parentNode.removeChild(p.overlayRoot))},registerTab:function(e){m.registerTab(e)},selectTab:function(e){m.selectTab(e)}}}var UD=Object.freeze({__proto__:null,createDebugOverlay:jD,default:jD});exports.EkoGallery=qP,exports.EkoGalleryLegacy=tn,exports.ekoWebPixel=S,exports.getEkoAnalyticsSnippet=function(e){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: 'ekoGalleryReactV4',\n },\n },\n ekoEnv: '${e?"production":"development"}',\n env: 'website',\n });\n window.EkoAnalytics('track', 'PageView');\n }`},exports.getEkoProductConfigUrl=VP,exports.getEkoProductConfigUrlLegacy=GP;
|