diff --git "a/src/demo/public/project-3.17.2.js" "b/src/demo/public/project-3.17.2.js" --- "a/src/demo/public/project-3.17.2.js" +++ "b/src/demo/public/project-3.17.2.js" @@ -1,13 +1,13 @@ -function au(n){return typeof n=="function"?n:()=>n}class cs{constructor(){this.subscribable=new vi(this),this.subscribers=new Set}subscribe(t){return this.subscribers.add(t),()=>this.unsubscribe(t)}unsubscribe(t){this.subscribers.delete(t)}clear(){this.subscribers.clear()}notifySubscribers(t){return[...this.subscribers].map(e=>e(t))}}class vi{constructor(t){this.dispatcher=t}subscribe(t){return this.dispatcher.subscribe(t)}unsubscribe(t){this.dispatcher.unsubscribe(t)}}class Ot extends cs{dispatch(t){this.notifySubscribers(t)}}class ou extends cs{constructor(){super(...arguments),this.value=!1}raise(){this.value||(this.value=!0,this.notifySubscribers())}reset(){this.value=!1}isRaised(){return this.value}subscribe(t){const e=super.subscribe(t);return this.value&&t(),e}}class re extends cs{get current(){return this.value}set current(t){this.value=t,this.notifySubscribers(t)}constructor(t){super(),this.value=t,this.subscribable=new lu(this)}subscribe(t,e=!0){const r=super.subscribe(t);return e&&t(this.value),r}}class lu extends vi{get current(){return this.dispatcher.current}subscribe(t,e=!0){return this.dispatcher.subscribe(t,e)}}class kt{get onChanged(){return this.value.subscribable}get onDisabled(){return this.disabled.subscribable}constructor(t,e){this.name=t,this.initial=e,this.type=void 0,this.spacing=!1,this.description="",this.disabled=new re(!1),this.value=new re(e)}get(){return this.value.current}set(t){this.value.current=this.parse(t)}parse(t){return t}serialize(){return this.value.current}clone(){return new this.constructor(this.name,this.get())}disable(t=!0){return this.disabled.current=t,this}space(t=!0){return this.spacing=t,this}describe(t){return this.description=t,this}}class hu extends kt{get onFieldsChanged(){return this.event.subscribable}constructor(t,e){const r=new Map(Object.entries(e));super(t,Object.fromEntries(Array.from(r,([i,a])=>[i,a.get()]))),this.type=Object,this.ignoreChange=!1,this.customFields={},this.handleChange=()=>{this.ignoreChange||(this.value.current={...this.transform("get"),...this.customFields})},this.event=new re([...r.values()]),this.fields=r;for(const[i,a]of this.fields)Object.defineProperty(this,i,{value:a}),a.onChanged.subscribe(this.handleChange)}set(t){this.ignoreChange=!0;for(const[e,r]of Object.entries(t)){const i=this.fields.get(e);i?i.set(r):this.customFields[e]=r}this.ignoreChange=!1,this.handleChange()}serialize(){return{...this.transform("serialize"),...this.customFields}}clone(){const t=new this.constructor(this.name,this.transform("clone"));return t.set(structuredClone(this.customFields)),t}transform(t){return Object.fromEntries(Array.from(this.fields,([r,i])=>[r,i[t]()]))}}const Gt=hu;class br extends kt{constructor(){super(...arguments),this.type=Boolean}parse(t){return!!t}}class mi extends Error{constructor(t,e){typeof t=="string"?(super(t),this.remarks=e):(super(t.message),this.remarks=t.remarks,this.object=t.object,this.durationMs=t.durationMs,this.inspect=t.inspect)}}class uu{constructor(){this.resolveCurrent=null,this.current=null}async acquire(){for(;this.current;)await this.current;this.current=new Promise(t=>{this.resolveCurrent=t})}release(){var t;this.current=null,(t=this.resolveCurrent)==null||t.call(this),this.resolveCurrent=null}}const wr=[];function fs(){const n=wr.at(-1);if(!n)throw new Error("The scene is not available in the current context.");return n}function cu(n){wr.push(n)}function fu(n){if(wr.pop()!==n)throw new Error("startScene/endScene were called out of order.")}function vt(){var n;return((n=wr.at(-1))==null?void 0:n.logger)??console}const ds=[];function xr(){const n=ds.at(-1);if(!n)throw new mi("The thread is not available in the current context.",`

useThread() can only be called from within generator functions. +function dc(n){return typeof n=="function"?n:()=>n}class vn{constructor(){this.subscribable=new wi(this),this.subscribers=new Set}subscribe(t){return this.subscribers.add(t),()=>this.unsubscribe(t)}unsubscribe(t){this.subscribers.delete(t)}clear(){this.subscribers.clear()}notifySubscribers(t){return[...this.subscribers].map(e=>e(t))}}class wi{constructor(t){this.dispatcher=t}subscribe(t){return this.dispatcher.subscribe(t)}unsubscribe(t){this.dispatcher.unsubscribe(t)}}class Ot extends vn{dispatch(t){this.notifySubscribers(t)}}class pc extends vn{constructor(){super(...arguments),this.value=!1}raise(){this.value||(this.value=!0,this.notifySubscribers())}reset(){this.value=!1}isRaised(){return this.value}subscribe(t){const e=super.subscribe(t);return this.value&&t(),e}}class ie extends vn{get current(){return this.value}set current(t){this.value=t,this.notifySubscribers(t)}constructor(t){super(),this.value=t,this.subscribable=new gc(this)}subscribe(t,e=!0){const r=super.subscribe(t);return e&&t(this.value),r}}class gc extends wi{get current(){return this.dispatcher.current}subscribe(t,e=!0){return this.dispatcher.subscribe(t,e)}}class Ct{get onChanged(){return this.value.subscribable}get onDisabled(){return this.disabled.subscribable}constructor(t,e){this.name=t,this.initial=e,this.type=void 0,this.spacing=!1,this.description="",this.disabled=new ie(!1),this.value=new ie(e)}get(){return this.value.current}set(t){this.value.current=this.parse(t)}parse(t){return t}serialize(){return this.value.current}clone(){return new this.constructor(this.name,this.get())}disable(t=!0){return this.disabled.current=t,this}space(t=!0){return this.spacing=t,this}describe(t){return this.description=t,this}}class vc extends Ct{get onFieldsChanged(){return this.event.subscribable}constructor(t,e){const r=new Map(Object.entries(e));super(t,Object.fromEntries(Array.from(r,([i,a])=>[i,a.get()]))),this.type=Object,this.ignoreChange=!1,this.customFields={},this.handleChange=()=>{this.ignoreChange||(this.value.current={...this.transform("get"),...this.customFields})},this.event=new ie([...r.values()]),this.fields=r;for(const[i,a]of this.fields)Object.defineProperty(this,i,{value:a}),a.onChanged.subscribe(this.handleChange)}set(t){this.ignoreChange=!0;for(const[e,r]of Object.entries(t)){const i=this.fields.get(e);i?i.set(r):this.customFields[e]=r}this.ignoreChange=!1,this.handleChange()}serialize(){return{...this.transform("serialize"),...this.customFields}}clone(){const t=new this.constructor(this.name,this.transform("clone"));return t.set(structuredClone(this.customFields)),t}transform(t){return Object.fromEntries(Array.from(this.fields,([r,i])=>[r,i[t]()]))}}const Xt=vc;class Cr extends Ct{constructor(){super(...arguments),this.type=Boolean}parse(t){return!!t}}class mn extends Error{constructor(t,e){typeof t=="string"?(super(t),this.remarks=e):(super(t.message),this.remarks=t.remarks,this.object=t.object,this.durationMs=t.durationMs,this.inspect=t.inspect)}}class mc{constructor(){this.resolveCurrent=null,this.current=null}async acquire(){for(;this.current;)await this.current;this.current=new Promise(t=>{this.resolveCurrent=t})}release(){var t;this.current=null,(t=this.resolveCurrent)==null||t.call(this),this.resolveCurrent=null}}const Rr=[];function bn(){const n=Rr.at(-1);if(!n)throw new Error("The scene is not available in the current context.");return n}function bc(n){Rr.push(n)}function yc(n){if(Rr.pop()!==n)throw new Error("startScene/endScene were called out of order.")}function it(){var n;return((n=Rr.at(-1))==null?void 0:n.logger)??console}const yn=[];function tr(){const n=yn.at(-1);if(!n)throw new mn("The thread is not available in the current context.",`

useThread() can only be called from within generator functions. It's not available during rendering.

-`);return n}function si(n){ds.push(n)}function ni(n){if(ds.pop()!==n)throw new Error("startThread/endThread was called out of order.")}function Ge(n){return n[0].toUpperCase()+n.slice(1)}function du(){let n;return e=>{if(e!==void 0)n=e;else return n}}function bi(n){return{message:n.message,stack:n.stack,remarks:n.remarks}}const ii=[{value:.25,text:"0.25x (Quarter)"},{value:.5,text:"0.5x (Half)"},{value:1,text:"1.0x (Full)"},{value:2,text:"2.0x (Double)"}],pu=[{value:"srgb",text:"sRGB"},{value:"display-p3",text:"DCI-P3"}],ai=[{value:30,text:"30 FPS"},{value:60,text:"60 FPS"}];var Lt;(function(n){n.Error="error",n.Warn="warn",n.Info="info",n.Http="http",n.Verbose="verbose",n.Debug="debug",n.Silly="silly"})(Lt||(Lt={}));class gu{constructor(){this.logged=new Ot,this.history=[],this.profilers={}}get onLogged(){return this.logged.subscribable}log(t){this.logged.dispatch(t),this.history.push(t)}error(t){this.logLevel(Lt.Error,t)}warn(t){this.logLevel(Lt.Warn,t)}info(t){this.logLevel(Lt.Info,t)}http(t){this.logLevel(Lt.Http,t)}verbose(t){this.logLevel(Lt.Verbose,t)}debug(t){this.logLevel(Lt.Debug,t)}silly(t){this.logLevel(Lt.Silly,t)}logLevel(t,e){const r=typeof e=="string"?{message:e}:e;r.level=t,this.log(r)}profile(t,e){const r=performance.now();if(this.profilers[t]){const i=this.profilers[t];delete this.profilers[t];const a=e??{message:t};a.level??(a.level=Lt.Debug),a.durationMs=r-i,this.log(a);return}this.profilers[t]=r}}var Ze;(function(n){n[n.Playing=0]="Playing",n[n.Rendering=1]="Rendering",n[n.Paused=2]="Paused",n[n.Presenting=3]="Presenting"})(Ze||(Ze={}));function vu(n){const t={version:new kt("version",1),shared:new Gt("General",{background:new as("background",null),range:new Sr("range",[0,1/0]),size:new Mi("resolution",new g(1920,1080)),audioOffset:new ns("audio offset",0)}),preview:new Gt("Preview",{fps:new ns("frame rate",30).setPresets(ai).setRange(1),resolutionScale:new ve("scale",ii,1)}),rendering:new Gt("Rendering",{fps:new ns("frame rate",60).setPresets(ai).setRange(1),resolutionScale:new ve("scale",ii,1),colorSpace:new ve("color space",pu),exporter:new Qu("exporter",n)})};return t.shared.audioOffset.disable(!n.audio),t}class mu extends Gt{constructor(t){super("project",vu(t))}getFullPreviewSettings(){return{...this.shared.get(),...this.preview.get()}}getFullRenderingSettings(){return{...this.shared.get(),...this.rendering.get()}}}function bu(){return new Gt("Application Settings",{version:new kt("version",1),appearance:new Gt("Appearance",{color:new as("accent color",new se("#33a6ff")).describe("The accent color for the user interface. (Leave empty to use the default color)"),font:new br("legacy font",!1).describe("Use the 'JetBrains Mono' font for the user interface."),coordinates:new br("coordinates",!0).describe("Display mouse coordinates within the preview window.")}),defaults:new Gt("Defaults",{background:new as("background",null).describe("The default background color used in new projects."),size:new Mi("resolution",new g(1920,1080)).describe("The default resolution used in new projects.")})})}function yu(n,t,e,r,i,a,h=r.logger??new gu){const c=bu();a.attach(c);const m={name:n,...r,plugins:e,versions:t,settings:c,logger:h};return m.meta=new mu(m),m.meta.shared.set(c.defaults.get()),m.experimentalFeatures??(m.experimentalFeatures=!1),i.attach(m.meta),m}function wu(n,t){return{level:Lt.Error,message:n,remarks:(t??"")+`

This feature requires enabling the experimentalFeatures flag in your project +`);return n}function li(n){yn.push(n)}function hi(n){if(yn.pop()!==n)throw new Error("startThread/endThread was called out of order.")}function He(n){return n[0].toUpperCase()+n.slice(1)}function Ge(){let n;return e=>{if(e!==void 0)n=e;else return n}}function xi(n){return{message:n.message,stack:n.stack,remarks:n.remarks}}const ci=[{value:.25,text:"0.25x (Quarter)"},{value:.5,text:"0.5x (Half)"},{value:1,text:"1.0x (Full)"},{value:2,text:"2.0x (Double)"}],wc=[{value:"srgb",text:"sRGB"},{value:"display-p3",text:"DCI-P3"}],ui=[{value:30,text:"30 FPS"},{value:60,text:"60 FPS"}];var It;(function(n){n.Error="error",n.Warn="warn",n.Info="info",n.Http="http",n.Verbose="verbose",n.Debug="debug",n.Silly="silly"})(It||(It={}));class xc{constructor(){this.logged=new Ot,this.history=[],this.profilers={}}get onLogged(){return this.logged.subscribable}log(t){this.logged.dispatch(t),this.history.push(t)}error(t){this.logLevel(It.Error,t)}warn(t){this.logLevel(It.Warn,t)}info(t){this.logLevel(It.Info,t)}http(t){this.logLevel(It.Http,t)}verbose(t){this.logLevel(It.Verbose,t)}debug(t){this.logLevel(It.Debug,t)}silly(t){this.logLevel(It.Silly,t)}logLevel(t,e){const r=typeof e=="string"?{message:e}:e;r.level=t,this.log(r)}profile(t,e){const r=performance.now();if(this.profilers[t]){const i=this.profilers[t];delete this.profilers[t];const a=e??{message:t};a.level??(a.level=It.Debug),a.durationMs=r-i,this.log(a);return}this.profilers[t]=r}}var Je;(function(n){n[n.Playing=0]="Playing",n[n.Rendering=1]="Rendering",n[n.Paused=2]="Paused",n[n.Presenting=3]="Presenting"})(Je||(Je={}));function Sc(n){const t={version:new Ct("version",1),shared:new Xt("General",{background:new fn("background",null),range:new Mr("range",[0,1/0]),size:new zi("resolution",new g(1920,1080)),audioOffset:new hn("audio offset",0)}),preview:new Xt("Preview",{fps:new hn("frame rate",30).setPresets(ui).setRange(1),resolutionScale:new be("scale",ci,1)}),rendering:new Xt("Rendering",{fps:new hn("frame rate",60).setPresets(ui).setRange(1),resolutionScale:new be("scale",ci,1),colorSpace:new be("color space",wc),exporter:new ou("exporter",n)})};return t.shared.audioOffset.disable(!n.audio),t}class kc extends Xt{constructor(t){super("project",Sc(t))}getFullPreviewSettings(){return{...this.shared.get(),...this.preview.get()}}getFullRenderingSettings(){return{...this.shared.get(),...this.rendering.get()}}}function Cc(){return new Xt("Application Settings",{version:new Ct("version",1),appearance:new Xt("Appearance",{color:new fn("accent color",new Yt("#33a6ff")).describe("The accent color for the user interface. (Leave empty to use the default color)"),font:new Cr("legacy font",!1).describe("Use the 'JetBrains Mono' font for the user interface."),coordinates:new Cr("coordinates",!0).describe("Display mouse coordinates within the preview window.")}),defaults:new Xt("Defaults",{background:new fn("background",null).describe("The default background color used in new projects."),size:new zi("resolution",new g(1920,1080)).describe("The default resolution used in new projects.")})})}function Tc(n,t,e,r,i,a,h=r.logger??new xc){const u=Cc();a.attach(u);const v={name:n,...r,plugins:e,versions:t,settings:u,logger:h};return v.meta=new kc(v),v.meta.shared.set(u.defaults.get()),v.experimentalFeatures??(v.experimentalFeatures=!1),i.attach(v.meta),v}function Rc(n,t){return{level:It.Error,message:n,remarks:(t??"")+`

This feature requires enabling the experimentalFeatures flag in your project configuration:

export default makeProject({
   experimentalFeatures: true,
   // ...
 });

Learn more about experimental features.

-`}}const xu=180/Math.PI,te=Math.PI/180;function oi(n,t,e){let r=0,i=n;t!==void 0&&(r=n,i=t),e=e===void 0?r=0;i--)t[i](e,n.name,r)}const li=Symbol.for("@motion-canvas/core/decorators/UNINITIALIZED");function gs(n){return(t,e)=>{let r=li;Object.defineProperty(t,e,{get(){return r===li&&(r=n.call(this)),r}})}}function ut(n){return function(t,e,r){r.value.prototype.name=n??e,r.value.prototype.threadable=!0}}ae(Fe,ut());function*Fe(...n){for(const t of n)yield t;yield*Si(...n)}ae(Tu,ut());function*Tu(n,t){yield*vs(Cu(n)),t&&(yield*t)}ae(vs,ut());function*vs(n=0,t){const e=xr(),r=yi().framesToSeconds(1),i=e.time()+n;for(;i-r>e.fixed;)yield;e.time(i),t&&(yield*t)}ae(wi,ut());function*wi(){}function hi(n,t){let e;return typeof n=="string"?(e=t(),yr(e,n)):(e=n(),yr(e,e)),e}function Pu(n){return n&&(typeof n=="object"||typeof n=="function")&&"toPromise"in n}function xi(n){return n!==null&&typeof n=="object"&&Symbol.iterator in n&&"next"in n}function yr(n,t){const e=Object.getPrototypeOf(n);e.threadable||(e.threadable=!0,e.name=typeof t=="string"?t:Ci(t))}function Ci(n){return Object.getPrototypeOf(n).name??null}class ss{get onDeferred(){return this.deferred.subscribable}get fixed(){return this.fixedTime}get canceled(){var t;return this.isCanceled||(((t=this.parent)==null?void 0:t.canceled)??!1)}get paused(){var t;return this.isPaused||(((t=this.parent)==null?void 0:t.paused)??!1)}get root(){var t;return((t=this.parent)==null?void 0:t.root)??this}constructor(t){this.runner=t,this.deferred=new Ot,this.children=[],this.time=De(0),this.parent=null,this.isCanceled=!1,this.isPaused=!1,this.fixedTime=0,this.queue=[],this.runner.task&&(vt().error({message:`The generator "${Ci(this.runner)}" is already being executed by another thread.`,remarks:`

This usually happens when you mistakenly reuse a generator that is already +`}}const Pc=180/Math.PI,cn=Math.PI/180;function Mc(n){if(!Si()||n.startsWith("/cors-proxy/"))return n;const t=new URL(window.location.toString());try{const e=new URL(n,t);if(!e.protocol.startsWith("http")||t.host===e.host||!Lc(e.host))return n}catch{return n}return`/cors-proxy/${encodeURIComponent(n)}`}function Lc(n){const t=$c();if(t.length===0)return!0;for(const e of t)if(e.toLowerCase().trim()===n)return!0;return!1}function Si(){return!1}let mr;function $c(){return{}.VITEST!=="true"&&mr?[...mr]:(mr=function(){if(!Si()||!{VITE_MC_PROXY_ENABLED:"false",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1})return[];const t={}.VITE_MC_PROXY_ALLOW_LIST??"[]",e=JSON.parse(t);Array.isArray(e)||it().error("Parsed Allow List expected to be an Array, but is "+typeof e);const r=[];for(const i of e){if(typeof i!="string"){it().warn("Unexpected Value in Allow List: "+i+". Expected a String. Skipping.");continue}r.push(i)}return r}(),[...mr])}function fi(n,t,e){let r=0,i=n;t!==void 0&&(r=n,i=t),e=e===void 0?r=0;i--)t[i](e,n.name,r)}const di=Symbol.for("@motion-canvas/core/decorators/UNINITIALIZED");function Ci(n){return(t,e)=>{let r=di;Object.defineProperty(t,e,{get(){return r===di&&(r=n.call(this)),r}})}}function ft(n){return function(t,e,r){r.value.prototype.name=n??e,r.value.prototype.threadable=!0}}Vt(ve,ft());function*ve(...n){for(const t of n)yield t;yield*Mi(...n)}Vt(zc,ft());function*zc(n,t){yield*Qe(Ic(n)),t&&(yield*t)}Vt(Qe,ft());function*Qe(n=0,t){const e=tr(),r=ki().framesToSeconds(1),i=e.time()+n;for(;i-r>e.fixed;)yield;e.time(i),t&&(yield*t)}Vt(Ti,ft());function*Ti(){}function pi(n,t){let e;return typeof n=="string"?(e=t(),Tr(e,n)):(e=n(),Tr(e,e)),e}function Ec(n){return n&&(typeof n=="object"||typeof n=="function")&&"toPromise"in n}function Ri(n){return n!==null&&typeof n=="object"&&Symbol.iterator in n&&"next"in n}function Tr(n,t){const e=Object.getPrototypeOf(n);e.threadable||(e.threadable=!0,e.name=typeof t=="string"?t:Pi(t))}function Pi(n){return Object.getPrototypeOf(n).name??null}class ln{get onDeferred(){return this.deferred.subscribable}get fixed(){return this.fixedTime}get canceled(){var t;return this.isCanceled||(((t=this.parent)==null?void 0:t.canceled)??!1)}get paused(){var t;return this.isPaused||(((t=this.parent)==null?void 0:t.paused)??!1)}get root(){var t;return((t=this.parent)==null?void 0:t.root)??this}constructor(t){this.runner=t,this.deferred=new Ot,this.children=[],this.time=je(0),this.parent=null,this.isCanceled=!1,this.isPaused=!1,this.fixedTime=0,this.queue=[],this.runner.task&&(it().error({message:`The generator "${Pi(this.runner)}" is already being executed by another thread.`,remarks:`

This usually happens when you mistakenly reuse a generator that is already running.

For example, using yield here will run the opacity generator concurrently and store it in the task variable (in case you want to cancel or await it later):

@@ -21,7 +21,7 @@ is reused in this way. Here's an example of a common mistake:

);
yield* all(
   rect().opacity(1, 1), 
   rect().x(200, 1),
-);
`}),this.runner=wi()),this.runner.task=this}next(){if(this.paused)return{value:null,done:!1};si(this);const t=this.runner.next(this.value);return ni(this),this.value=null,t}update(t){this.paused||(this.time(this.time()+t),this.fixedTime+=t),this.children=this.children.filter(e=>!e.canceled)}spawn(t){return xi(t)||(t=t()),this.queue.push(t),t}add(t){t.parent=this,t.isCanceled=!1,t.time(this.time()),t.fixedTime=this.fixedTime,this.children.push(t),yr(t.runner,`unknown ${this.children.length}`)}drain(t){this.queue.forEach(t),this.queue=[]}cancel(){this.deferred.clear(),this.runner.return(),this.isCanceled=!0,this.parent=null,this.drain(t=>t.return())}pause(t){this.isPaused=t}runDeferred(){si(this),this.deferred.dispatch(),ni(this)}}ae(Si,ut());function*Si(n,...t){let e=!0;typeof n=="boolean"?e=n:t.push(n);const r=xr(),i=t.map(c=>r.children.find(m=>m.runner===c)).filter(c=>c),a=r.time();let h;if(e){for(;i.find(c=>!c.canceled);)yield;h=Math.max(...i.map(c=>c.time()))}else{for(;!i.find(m=>m.canceled);)yield;const c=i.filter(m=>m.canceled);h=Math.min(...c.map(m=>m.time()))}r.time(Math.max(a,h))}function Ru(n){return typeof(n==null?void 0:n.then)=="function"}ae(ki,ut());function*ki(n,t){const e=yi(),r=n();yr(r,"root");const i=new ss(r);t==null||t(i);let a=[i];for(;a.length>0;){const h=[],c=[...a],m=e.deltaTime;for(;c.length>0;){const y=c.pop();if(!y||y.canceled)continue;const k=y.next();if(k.done){y.cancel();continue}if(xi(k.value)){const F=new ss(k.value);y.value=k.value,y.add(F),c.push(y),c.push(F)}else k.value?(y.value=yield k.value,c.push(y)):(y.update(m),y.drain(F=>{const X=new ss(F);y.add(X),h.unshift(X)}),h.unshift(y))}a=[];for(const y of h)y.canceled||(a.push(y),y.runDeferred());a.length>0&&(yield)}}var Dt;(function(n){n[n.BeforeRender=0]="BeforeRender",n[n.BeginRender=1]="BeginRender",n[n.FinishRender=2]="FinishRender",n[n.AfterRender=3]="AfterRender"})(Dt||(Dt={}));class Mu{get onBeforeRender(){return this.beforeRender.subscribable}get onBeginRender(){return this.beginRender.subscribable}get onFinishRender(){return this.finishRender.subscribable}get onAfterRender(){return this.afterRender.subscribable}constructor(t){this.scene=t,this.beforeRender=new Ot,this.beginRender=new Ot,this.finishRender=new Ot,this.afterRender=new Ot,this.scene.onRenderLifecycle.subscribe(([e,r])=>{switch(e){case Dt.BeforeRender:return this.beforeRender.dispatch(r);case Dt.BeginRender:return this.beginRender.dispatch(r);case Dt.FinishRender:return this.finishRender.dispatch(r);case Dt.AfterRender:return this.afterRender.dispatch(r)}}),this.scene.onReset.subscribe(()=>{this.beforeRender.clear(),this.beginRender.clear(),this.finishRender.clear(),this.afterRender.clear()})}}class Ve{constructor(t){this.state=t,this.nextGauss=null}static createSeed(){return Math.floor(Math.random()*4294967296)}nextFloat(t=0,e=1){return tt(t,e,this.next())}nextInt(t=0,e=4294967296){let r=Math.floor(tt(t,e,this.next()));return r===e&&(r=t),r}gauss(t=0,e=1){let r=this.nextGauss;if(this.nextGauss=null,r===null){const i=this.next()*2*Math.PI,a=Math.sqrt(-2*Math.log(1-this.next()));r=Math.cos(i)*a,this.nextGauss=Math.sin(i)*a}return t+r*e}floatArray(t,e=0,r=1){return oi(t).map(()=>this.nextFloat(e,r))}intArray(t,e=0,r=4294967296){return oi(t).map(()=>this.nextInt(e,r))}spawn(){return new Ve(this.nextInt())}next(){this.state|=0,this.state=this.state+1831565813|0;let t=Math.imul(this.state^this.state>>>15,1|this.state);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}var gt;(function(n){n[n.Initial=0]="Initial",n[n.AfterTransitionIn=1]="AfterTransitionIn",n[n.CanTransitionOut=2]="CanTransitionOut",n[n.Finished=3]="Finished"})(gt||(gt={}));const $u="resolution",Lu="destinationTexture",Au="sourceTexture",ui="time",Ou="deltaTime",zu="framerate",Iu="sourceMatrix",Fu="destinationMatrix",Eu=`#version 300 es +);`}),this.runner=Ti()),this.runner.task=this}next(){if(this.paused)return{value:null,done:!1};li(this);const t=this.runner.next(this.value);return hi(this),this.value=null,t}update(t){this.paused||(this.time(this.time()+t),this.fixedTime+=t),this.children=this.children.filter(e=>!e.canceled)}spawn(t){return Ri(t)||(t=t()),this.queue.push(t),t}add(t){t.parent=this,t.isCanceled=!1,t.time(this.time()),t.fixedTime=this.fixedTime,this.children.push(t),Tr(t.runner,`unknown ${this.children.length}`)}drain(t){this.queue.forEach(t),this.queue=[]}cancel(){this.deferred.clear(),this.runner.return(),this.isCanceled=!0,this.parent=null,this.drain(t=>t.return())}pause(t){this.isPaused=t}runDeferred(){li(this),this.deferred.dispatch(),hi(this)}}Vt(Mi,ft());function*Mi(n,...t){let e=!0;typeof n=="boolean"?e=n:t.push(n);const r=tr(),i=t.map(u=>r.children.find(v=>v.runner===u)).filter(u=>u),a=r.time();let h;if(e){for(;i.find(u=>!u.canceled);)yield;h=Math.max(...i.map(u=>u.time()))}else{for(;!i.find(v=>v.canceled);)yield;const u=i.filter(v=>v.canceled);h=Math.min(...u.map(v=>v.time()))}r.time(Math.max(a,h))}function Fc(n){return typeof(n==null?void 0:n.then)=="function"}Vt(Li,ft());function*Li(n,t){const e=ki(),r=n();Tr(r,"root");const i=new ln(r);t==null||t(i);let a=[i];for(;a.length>0;){const h=[],u=[...a],v=e.deltaTime;for(;u.length>0;){const y=u.pop();if(!y||y.canceled)continue;const C=y.next();if(C.done){y.cancel();continue}if(Ri(C.value)){const F=new ln(C.value);y.value=C.value,y.add(F),u.push(y),u.push(F)}else C.value?(y.value=yield C.value,u.push(y)):(y.update(v),y.drain(F=>{const H=new ln(F);y.add(H),h.unshift(H)}),h.unshift(y))}a=[];for(const y of h)y.canceled||(a.push(y),y.runDeferred());a.length>0&&(yield)}}var jt;(function(n){n[n.BeforeRender=0]="BeforeRender",n[n.BeginRender=1]="BeginRender",n[n.FinishRender=2]="FinishRender",n[n.AfterRender=3]="AfterRender"})(jt||(jt={}));class _c{get onBeforeRender(){return this.beforeRender.subscribable}get onBeginRender(){return this.beginRender.subscribable}get onFinishRender(){return this.finishRender.subscribable}get onAfterRender(){return this.afterRender.subscribable}constructor(t){this.scene=t,this.beforeRender=new Ot,this.beginRender=new Ot,this.finishRender=new Ot,this.afterRender=new Ot,this.scene.onRenderLifecycle.subscribe(([e,r])=>{switch(e){case jt.BeforeRender:return this.beforeRender.dispatch(r);case jt.BeginRender:return this.beginRender.dispatch(r);case jt.FinishRender:return this.finishRender.dispatch(r);case jt.AfterRender:return this.afterRender.dispatch(r)}}),this.scene.onReset.subscribe(()=>{this.beforeRender.clear(),this.beginRender.clear(),this.finishRender.clear(),this.afterRender.clear()})}}class Ke{constructor(t){this.state=t,this.nextGauss=null}static createSeed(){return Math.floor(Math.random()*4294967296)}nextFloat(t=0,e=1){return tt(t,e,this.next())}nextInt(t=0,e=4294967296){let r=Math.floor(tt(t,e,this.next()));return r===e&&(r=t),r}gauss(t=0,e=1){let r=this.nextGauss;if(this.nextGauss=null,r===null){const i=this.next()*2*Math.PI,a=Math.sqrt(-2*Math.log(1-this.next()));r=Math.cos(i)*a,this.nextGauss=Math.sin(i)*a}return t+r*e}floatArray(t,e=0,r=1){return fi(t).map(()=>this.nextFloat(e,r))}intArray(t,e=0,r=4294967296){return fi(t).map(()=>this.nextInt(e,r))}spawn(){return new Ke(this.nextInt())}next(){this.state|=0,this.state=this.state+1831565813|0;let t=Math.imul(this.state^this.state>>>15,1|this.state);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}var mt;(function(n){n[n.Initial=0]="Initial",n[n.AfterTransitionIn=1]="AfterTransitionIn",n[n.CanTransitionOut=2]="CanTransitionOut",n[n.Finished=3]="Finished"})(mt||(mt={}));const Dc="resolution",jc="destinationTexture",Nc="sourceTexture",gi="time",Bc="deltaTime",Uc="framerate",Wc="sourceMatrix",Gc="destinationMatrix",qc=`#version 300 es in vec2 position; @@ -42,8 +42,8 @@ void main() { gl_Position = (position_screen - 0.5) * 2.0; } -`;class _u{constructor(t,e){this.scene=t,this.sharedContext=e,this.gl=null,this.positionBuffer=null,this.sourceTexture=null,this.destinationTexture=null,this.positionLocation=0,this.quadPositions=new Float32Array([-1,1,-1,-1,1,1,1,-1]),this.handleReload=()=>{this.gl&&this.updateViewport()},t.onReloaded.subscribe(this.handleReload)}setup(t){this.gl=t,this.updateViewport(),this.positionBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,this.quadPositions,t.STATIC_DRAW),t.vertexAttribPointer(this.positionLocation,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(this.positionLocation),this.sourceTexture=t.createTexture(),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.sourceTexture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),this.destinationTexture=t.createTexture(),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,this.destinationTexture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)}teardown(t){t.deleteBuffer(this.positionBuffer),t.disableVertexAttribArray(this.positionLocation),t.deleteTexture(this.sourceTexture),t.deleteTexture(this.destinationTexture),this.positionBuffer=null,this.sourceTexture=null,this.destinationTexture=null,this.gl=null}updateViewport(){if(this.gl){const t=this.scene.getRealSize();this.gl.canvas.width=t.width,this.gl.canvas.height=t.height,this.gl.viewport(0,0,t.width,t.height)}}getGL(){return this.gl??this.sharedContext.borrow(this)}getProgram(t){const e=this.sharedContext.getProgram(t,Eu);if(!e)return null;const r=this.scene.getRealSize(),i=this.getGL();return i.useProgram(e),i.uniform1i(i.getUniformLocation(e,Au),0),i.uniform1i(i.getUniformLocation(e,Lu),1),i.uniform2f(i.getUniformLocation(e,$u),r.x,r.y),i.uniform1f(i.getUniformLocation(e,Ou),this.scene.playback.deltaTime),i.uniform1f(i.getUniformLocation(e,zu),this.scene.playback.fps),e}copyTextures(t,e){this.copyTexture(e,this.sourceTexture),this.copyTexture(t,this.destinationTexture)}clear(){const t=this.getGL();t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT)}render(){const t=this.getGL();t.drawArrays(t.TRIANGLE_STRIP,0,4)}copyTexture(t,e){const r=this.getGL();r.bindTexture(r.TEXTURE_2D,e),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t),r.generateMipmap(r.TEXTURE_2D)}}class Du{get onChanged(){return this.slides.subscribable}constructor(t){this.scene=t,this.slides=new re([]),this.lookup=new Map,this.collisionLookup=new Set,this.current=null,this.canResume=!1,this.waitsForId=null,this.targetId=null,this.handleReload=()=>{this.lookup.clear(),this.collisionLookup.clear(),this.current=null,this.waitsForId=null,this.targetId=null},this.handleReset=()=>{this.collisionLookup.clear(),this.current=null,this.waitsForId=null},this.handleRecalculated=()=>{this.slides.current=[...this.lookup.values()]},this.scene.onReloaded.subscribe(this.handleReload),this.scene.onReset.subscribe(this.handleReset),this.scene.onRecalculated.subscribe(this.handleRecalculated)}setTarget(t){this.targetId=t}resume(){this.canResume=!0}isWaitingFor(t){return this.waitsForId===t}isWaiting(){return this.waitsForId!==null}didHappen(t){var e;if(this.current===null)return!1;for(const r of this.lookup.keys()){if(r===t)return!0;if(r===((e=this.current)==null?void 0:e.id))return!1}return!1}getCurrent(){return this.current}register(t,e){if(this.waitsForId!==null)throw new Error(`The animation already waits for a slide: ${this.waitsForId}.`);const r=this.toId(t);this.scene.playback.state!==Ze.Presenting&&(this.lookup.has(r)||this.lookup.set(r,{id:r,name:t,time:e,scene:this.scene,stack:new Error().stack}),this.collisionLookup.has(t)?this.scene.logger.warn({message:`A slide named "${t}" already exists.`,stack:new Error().stack}):this.collisionLookup.add(t)),this.waitsForId=r,this.current=this.lookup.get(r)??null,this.canResume=!1}shouldWait(t){const e=this.toId(t);if(this.waitsForId!==e)throw new Error(`The animation waits for a different slide: ${this.waitsForId}.`);if(!this.lookup.get(e))throw new Error(`Could not find the "${t}" slide.`);let i=this.canResume;return this.scene.playback.state!==Ze.Presenting&&(i=e!==this.targetId),i&&(this.waitsForId=null),!i}toId(t){return`${this.scene.name}:${t}`}}class ju{constructor(t){this.scene=t,this.signals={},this.variables={},this.handleReset=()=>{this.signals={}},t.onReset.subscribe(this.handleReset)}get(t,e){var r;return(r=this.signals)[t]??(r[t]=De(this.variables[t]??e)),()=>this.signals[t]()}updateSignals(t){this.variables=t,Object.keys(t).map(e=>{e in this.signals&&this.signals[e](t[e])})}}class Bu{get firstFrame(){return this.cache.current.firstFrame}get lastFrame(){return this.firstFrame+this.cache.current.duration}get onCacheChanged(){return this.cache.subscribable}get onReloaded(){return this.reloaded.subscribable}get onRecalculated(){return this.recalculated.subscribable}get onThreadChanged(){return this.thread.subscribable}get onRenderLifecycle(){return this.renderLifecycle.subscribable}get onReset(){return this.afterReset.subscribable}get LifecycleEvents(){return this.logger.warn("LifecycleEvents is deprecated. Use lifecycleEvents instead."),this.lifecycleEvents}get previous(){return this.previousScene}constructor(t){this.cache=new re({firstFrame:0,transitionDuration:0,duration:0,lastFrame:0}),this.reloaded=new Ot,this.recalculated=new Ot,this.thread=new re(null),this.renderLifecycle=new Ot,this.afterReset=new Ot,this.lifecycleEvents=new Mu(this),this.previousScene=null,this.runner=null,this.state=gt.Initial,this.cached=!1,this.counters={},this.name=t.name,this.size=t.size,this.resolutionScale=t.resolutionScale,this.logger=t.logger,this.playback=t.playback,this.meta=t.meta,this.runnerFactory=t.config,this.creationStack=t.stack,this.experimentalFeatures=t.experimentalFeatures??!1,ae(this.runnerFactory,ut(this.name)),this.timeEvents=new t.timeEventsClass(this),this.variables=new ju(this),this.shaders=new _u(this,t.sharedWebGLContext),this.slides=new Du(this),this.random=new Ve(this.meta.seed.get()),this.previousOnTop=!1}update(){}async render(t){let e=0;do e++,await ht.consumePromises(),t.save(),t.clearRect(0,0,t.canvas.width,t.canvas.height),this.execute(()=>this.draw(t)),t.restore();while(ht.hasPromises()&&e<10);e>1&&this.logger.debug(`render iterations: ${e}`)}reload({config:t,size:e,stack:r,resolutionScale:i}={}){t&&(this.runnerFactory=t),e&&(this.size=e),i&&(this.resolutionScale=i),r&&(this.creationStack=r),this.cached=!1,this.reloaded.dispatch()}async recalculate(t){const e=this.cache.current;if(e.firstFrame=this.playback.frame,e.lastFrame=e.firstFrame+e.duration,this.isCached()){t(e.lastFrame),this.cache.current={...e};return}for(e.transitionDuration=-1,await this.reset();!this.canTransitionOut();)e.transitionDuration<0&&this.state===gt.AfterTransitionIn&&(e.transitionDuration=this.playback.frame-e.firstFrame),t(this.playback.frame+1),await this.next();e.transitionDuration===-1&&(e.transitionDuration=0),e.lastFrame=this.playback.frame,e.duration=e.lastFrame-e.firstFrame,await new Promise(r=>setTimeout(r,0)),this.cached=!0,this.cache.current={...e},this.recalculated.dispatch()}async next(){var e;if(!this.runner)return;let t=this.execute(()=>this.runner.next());for(this.update();t.value;){if(Pu(t.value)){const r=await t.value.toPromise();t=this.execute(()=>this.runner.next(r))}else if(Ru(t.value)){const r=await t.value;t=this.execute(()=>this.runner.next(r))}else this.logger.warn({message:"Invalid value yielded by the scene.",object:t.value}),t=this.execute(()=>this.runner.next(t.value));this.update()}if(ht.hasPromises()){const r=await ht.consumePromises();this.logger.error({message:"Tried to access an asynchronous property before the node was ready. Make sure to yield the node before accessing the property.",stack:r[0].stack,inspect:((e=r[0].owner)==null?void 0:e.key)??void 0})}t.done&&(this.state=gt.Finished)}async reset(t=null){this.counters={},this.previousScene=t,this.previousOnTop=!1,this.random=new Ve(this.meta.seed.get()),this.runner=ki(()=>this.runnerFactory(this.getView()),e=>{this.thread.current=e}),this.state=gt.AfterTransitionIn,this.afterReset.dispatch(),await this.next()}getSize(){return this.size}getRealSize(){return this.size.mul(this.resolutionScale)}isAfterTransitionIn(){return this.state===gt.AfterTransitionIn}canTransitionOut(){return this.state===gt.CanTransitionOut||this.state===gt.Finished}isFinished(){return this.state===gt.Finished}enterInitial(){this.state===gt.AfterTransitionIn?this.state=gt.Initial:this.logger.warn(`Scene ${this.name} entered initial in an unexpected state: ${this.state}`)}enterAfterTransitionIn(){this.state===gt.Initial?this.state=gt.AfterTransitionIn:this.logger.warn(`Scene ${this.name} transitioned in an unexpected state: ${this.state}`)}enterCanTransitionOut(){this.state===gt.AfterTransitionIn||this.state===gt.Initial?this.state=gt.CanTransitionOut:this.logger.warn(`Scene ${this.name} was marked as finished in an unexpected state: ${this.state}`)}isCached(){return this.cached}execute(t){let e;cu(this),Su(this.playback);try{e=t()}finally{ku(this.playback),fu(this)}return e}}function Nu(){return new Gt("scene",{version:new kt("version",1),timeEvents:new kt("time events",[]),seed:new kt("seed",Ve.createSeed())})}function Wu(n,t,e){const r=[...n],i=[...t];if(i.length>=r.length){const a=Math.floor(i.length*e),h=Math.floor(tt(r.length-1,i.length,e));let c="";for(let m=0;m=0;m--)m ${t} may result in unexpected behavior.`);return}if(typeof n=="number"&&typeof t=="number")return tt(n,t,e);if(typeof n=="string"&&typeof t=="string")return Wu(n,t,e);if(typeof n=="boolean"&&typeof t=="boolean")return e<.5?n:t;if("lerp"in n)return n.lerp(t,e);if(n&&t&&typeof n=="object"&&typeof t=="object")if(Array.isArray(n)&&Array.isArray(t)){if(n.length===t.length)return n.map((i,a)=>_e(i,t[a],e))}else{let i=!1;if(!(n instanceof Map)&&!(t instanceof Map)&&(i=!0,n=new Map(Object.entries(n)),t=new Map(Object.entries(t))),n instanceof Map&&t instanceof Map){const a=new Map;for(const h of new Set([...n.keys(),...t.keys()])){const c=_e(n.get(h),t.get(h),e,!0);c!==void 0&&a.set(h,c)}return i?Object.fromEntries(a):a}}return t}function Uu(n,t,e){return e<.5?n:t}function tt(n,t,e){return n+(t-n)*e}function qu(n,t,e,r,i){return e+(i-n)*(r-e)/(t-n)}function wt(n,t,e){return et?t:e}function Ti(n,t,e){let r=t;e>1?e=1/e:r=!r;const i=r?Math.acos(wt(-1,1,1-n)):Math.asin(n),a=tt(i,tt(0,Math.PI/2,n),e);let h=Math.sin(a),c=1-Math.cos(a);return t&&([h,c]=[c,h]),new g(h,c)}function Et(n,t=0,e=1){return n=n<.5?4*n*n*n:1-Math.pow(-2*n+2,3)/2,tt(t,e,n)}function Gu(n,t=0,e=1){return n=n===1?1:1-Math.pow(2,-10*n),tt(t,e,n)}function Xu(n,t=0,e=1){return tt(t,e,n)}ae(_t,ut());function*_t(n,t,e){const r=xr(),i=r.time(),a=r.time()+n;for(t(0,0);a>r.fixed;){const h=r.fixed-i,c=h/n;h>0&&t(c,h),yield}r.time(a),t(1,n),e==null||e(1,n)}class ht{static collectPromise(t,e=null){const r={promise:t,value:e,stack:new Error().stack},i=this.collectionStack.at(-1);return i&&(r.owner=i.owner),t.then(a=>{r.value=a,i==null||i.markDirty()}),this.promises.push(r),r}static hasPromises(){return this.promises.length>0}static async consumePromises(){const t=[...this.promises];return await Promise.all(t.map(e=>e.promise)),this.promises=this.promises.filter(e=>!t.includes(e)),t}constructor(t){this.owner=t,this.dependencies=new Set,this.event=new ou,this.markDirty=()=>this.event.raise(),this.invokable=this.invoke.bind(this),Object.defineProperty(this.invokable,"context",{value:this}),Object.defineProperty(this.invokable,"toPromise",{value:this.toPromise.bind(this)})}invoke(){}startCollecting(){if(ht.collectionSet.has(this))throw new mi("A circular dependency occurred between signals.",`This can happen when signals reference each other in a loop. - Try using the attached stack trace to locate said loop.`);ht.collectionSet.add(this),ht.collectionStack.push(this)}finishCollecting(){if(ht.collectionSet.delete(this),ht.collectionStack.pop()!==this)throw new Error("collectStart/collectEnd was called out of order.")}clearDependencies(){this.dependencies.forEach(t=>t.unsubscribe(this.markDirty)),this.dependencies.clear()}collect(){const t=ht.collectionStack.at(-1);t&&(t.dependencies.add(this.event.subscribable),this.event.subscribe(t.markDirty))}dispose(){this.clearDependencies(),this.event.clear(),this.owner=null}async toPromise(){do await ht.consumePromises(),this.invokable();while(ht.hasPromises());return this.invokable}}ht.collectionSet=new Set;ht.collectionStack=[];ht.promises=[];const Xe=Symbol.for("@motion-canvas/core/signals/default");function Xt(n){return typeof n=="function"}function ge(n,t){return Xt(n)?()=>t(n()):t(n)}function me(n){return Xt(n)?n():n}class be extends ht{constructor(t,e,r=void 0,i=h=>h,a={}){super(r),this.initial=t,this.interpolation=e,this.parser=i,this.tweening=!1,Object.defineProperty(this.invokable,"reset",{value:this.reset.bind(this)}),Object.defineProperty(this.invokable,"save",{value:this.save.bind(this)}),Object.defineProperty(this.invokable,"isInitial",{value:this.isInitial.bind(this)}),this.initial!==void 0&&(this.current=this.initial,this.markDirty(),Xt(this.initial)||(this.last=this.parse(this.initial))),this.extensions={getter:this.getter.bind(this),setter:this.setter.bind(this),tweener:this.tweener.bind(this),...a}}toSignal(){return this.invokable}parse(t){return this.parser(t)}set(t){return this.extensions.setter(t),this.owner}setter(t){return t===Xe&&(t=this.initial),this.current===t?this.owner:(this.current=t,this.clearDependencies(),Xt(t)||(this.last=this.parse(t)),this.markDirty(),this.owner)}get(){return this.extensions.getter()}getter(){var t;if(this.event.isRaised()&&Xt(this.current)){this.clearDependencies(),this.startCollecting();try{this.last=this.parse(this.current())}catch(e){vt().error({...bi(e),inspect:(t=this.owner)==null?void 0:t.key})}this.finishCollecting()}return this.event.reset(),this.collect(),this.last}invoke(t,e,r=Et,i=this.interpolation){return t===void 0?this.get():e===void 0?this.set(t):this.createQueue(r,i).to(t,e)}createQueue(t,e){const r=this.get(),i=[],a=hi("animation chain",function*(){for(;i.length>0;)yield*i.shift()});return a.to=(h,c,m=t,y=e)=>(t=m,e=y,i.push(this.tween(h,c,m,y)),a),a.back=(h,c=t,m=e)=>(t=c,e=m,i.push(this.tween(r,h,t,e)),a),a.wait=h=>(i.push(vs(h)),a),a.run=h=>(i.push(h),a),a.do=h=>(i.push(hi(function*(){h()})),a),a}*tween(t,e,r,i){t===Xe&&(t=this.initial),this.tweening=!0,yield*this.extensions.tweener(t,e,r,i),this.set(t),this.tweening=!1}*tweener(t,e,r,i){const a=this.get();yield*_t(e,h=>{this.set(i(a,this.parse(me(t)),r(h)))})}dispose(){super.dispose(),this.initial=void 0,this.current=void 0,this.last=void 0}reset(){return this.initial!==void 0&&this.set(this.initial),this.owner}save(){return this.set(this.get())}isInitial(){return this.collect(),this.current===this.initial}getInitial(){return this.initial}raw(){return this.current}isTweening(){return this.tweening}}class Cr extends be{constructor(t,e,r,i,a=void 0,h={}){var c;super(void 0,i,a,e,h),this.entries=t,this.signals=[],this.parser=e;for(const m of t){let y,k;Array.isArray(m)?([y,k]=m,(c=k.context).owner??(c.owner=this)):(y=m,k=new be(ge(r,F=>e(F)[m]),tt,a??this.invokable).toSignal()),this.signals.push([y,k]),Object.defineProperty(this.invokable,y,{value:k})}}toSignal(){return this.invokable}parse(t){return this.parser(t)}getter(){return this.parse(Object.fromEntries(this.signals.map(([t,e])=>[t,e()])))}setter(t){if(Xt(t))for(const[e,r]of this.signals)r(()=>this.parser(t())[e]);else{const e=this.parse(t);for(const[r,i]of this.signals)i(e[r])}return this.owner}reset(){for(const[,t]of this.signals)t.reset();return this.owner}save(){for(const[,t]of this.signals)t.save();return this.owner}isInitial(){for(const[,t]of this.signals)if(!t.isInitial())return!1;return!0}raw(){return Object.fromEntries(this.signals.map(([t,e])=>[t,e.context.raw()]))}}class Hu extends ht{constructor(t,e){super(e),this.factory=t,this.markDirty()}toSignal(){return this.invokable}dispose(){super.dispose(),this.last=void 0}invoke(...t){var e;if(this.event.isRaised()){this.clearDependencies(),this.startCollecting();try{this.last=this.factory(...t)}catch(r){vt().error({...bi(r),inspect:(e=this.owner)==null?void 0:e.key})}this.finishCollecting()}return this.event.reset(),this.collect(),this.last}}class Pi extends Cr{constructor(t,e,r,i,a=void 0,h={}){super(t,e,r,i,a,h),Object.defineProperty(this.invokable,"edit",{value:this.edit.bind(this)}),Object.defineProperty(this.invokable,"mul",{value:this.mul.bind(this)}),Object.defineProperty(this.invokable,"div",{value:this.div.bind(this)}),Object.defineProperty(this.invokable,"add",{value:this.add.bind(this)}),Object.defineProperty(this.invokable,"sub",{value:this.sub.bind(this)}),Object.defineProperty(this.invokable,"dot",{value:this.dot.bind(this)}),Object.defineProperty(this.invokable,"cross",{value:this.cross.bind(this)}),Object.defineProperty(this.invokable,"mod",{value:this.mod.bind(this)})}toSignal(){return this.invokable}edit(t,e,r,i){const a=t(this.get());return this.invoke(a,e,r,i)}mul(t,e,r,i){const a=h=>h.mul(t);return e===void 0?this.edit(a):this.edit(a,e,r,i)}div(t,e,r,i){const a=h=>h.div(t);return e===void 0?this.edit(a):this.edit(a,e,r,i)}add(t,e,r,i){const a=h=>h.add(t);return e===void 0?this.edit(a):this.edit(a,e,r,i)}sub(t,e,r,i){const a=h=>h.sub(t);return e===void 0?this.edit(a):this.edit(a,e,r,i)}dot(t,e,r,i){const a=h=>h.dot(t);return e===void 0?this.edit(a):this.edit(a,e,r,i)}cross(t,e,r,i){const a=h=>h.cross(t);return e===void 0?this.edit(a):this.edit(a,e,r,i)}mod(t,e,r,i){const a=h=>h.mod(t);return e===void 0?this.edit(a):this.edit(a,e,r,i)}}function Yu(n,t){return new Hu(n,t).toSignal()}function De(n,t=_e,e){return new be(n,t,e).toSignal()}class At{static createSignal(t,e=At.lerp){return new Cr(["top","right","bottom","left"],r=>new At(r),t,e).toSignal()}static lerp(t,e,r){return new At(tt(t.top,e.top,r),tt(t.right,e.right,r),tt(t.bottom,e.bottom,r),tt(t.left,e.left,r))}get x(){return this.left+this.right}get y(){return this.top+this.bottom}constructor(t=0,e,r,i){if(this.top=0,this.right=0,this.bottom=0,this.left=0,t!=null){if(Array.isArray(t)&&(i=t[3],r=t[2],e=t[1],t=t[0]),typeof t=="number"){this.top=t,this.right=e!==void 0?e:t,this.bottom=r!==void 0?r:t,this.left=i!==void 0?i:e!==void 0?e:t;return}this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left}}lerp(t,e){return At.lerp(this,t,e)}scale(t){return new At(this.top*t,this.right*t,this.bottom*t,this.left*t)}addScalar(t){return new At(this.top+t,this.right+t,this.bottom+t,this.left+t)}toSymbol(){return At.symbol}toString(){return`Spacing(${this.top}, ${this.right}, ${this.bottom}, ${this.left})`}toUniform(t,e){t.uniform4f(e,this.top,this.right,this.bottom,this.left)}serialize(){return{top:this.top,right:this.right,bottom:this.bottom,left:this.left}}}At.symbol=Symbol.for("@motion-canvas/core/types/Spacing");const He=1e-6;class rt{static fromRotation(t){return rt.identity.rotate(t)}static fromTranslation(t){return rt.identity.translate(new g(t))}static fromScaling(t){return rt.identity.scale(new g(t))}get x(){return new g(this.values[0],this.values[1])}get y(){return new g(this.values[2],this.values[3])}get scaleX(){return this.values[0]}set scaleX(t){this.values[0]=this.x.normalized.scale(t).x}get skewX(){return this.values[1]}set skewX(t){this.values[1]=t}get scaleY(){return this.values[3]}set scaleY(t){this.values[3]=this.y.normalized.scale(t).y}get skewY(){return this.values[2]}set skewY(t){this.values[2]=t}get translateX(){return this.values[4]}set translateX(t){this.values[4]=t}get translateY(){return this.values[5]}set translateY(t){this.values[5]=t}get rotation(){return g.degrees(this.values[0],this.values[1])}set rotation(t){const e=this.rotate(t-this.rotation);this.values[0]=e.values[0],this.values[1]=e.values[1],this.values[2]=e.values[2],this.values[3]=e.values[3]}get translation(){return new g(this.values[4],this.values[5])}set translation(t){const e=new g(t);this.values[4]=e.x,this.values[5]=e.y}get scaling(){return new g(this.values[0],this.values[3])}set scaling(t){const e=new g(t),r=new g(this.values[0],this.values[1]).normalized,i=new g(this.values[2],this.values[3]).normalized;this.values[0]=r.x*e.x,this.values[1]=r.y*e.y,this.values[2]=i.x*e.x,this.values[3]=i.y*e.y}get inverse(){const t=this.values[0],e=this.values[1],r=this.values[2],i=this.values[3],a=this.values[4],h=this.values[5];let c=t*i-e*r;return c?(c=1/c,new rt(i*c,-e*c,-r*c,t*c,(r*h-i*a)*c,(e*a-t*h)*c)):null}get determinant(){return this.values[0]*this.values[3]-this.values[1]*this.values[2]}get domMatrix(){return new DOMMatrix([this.values[0],this.values[1],this.values[2],this.values[3],this.values[4],this.values[5]])}constructor(t,e,r,i,a,h){if(this.values=new Float32Array(6),arguments.length===0){this.values=new Float32Array([1,0,0,1,0,0]);return}if(arguments.length===6){this.values[0]=t,this.values[1]=e,this.values[2]=r,this.values[3]=i,this.values[4]=a,this.values[5]=h;return}if(t instanceof DOMMatrix){this.values[0]=t.m11,this.values[1]=t.m12,this.values[2]=t.m21,this.values[3]=t.m22,this.values[4]=t.m41,this.values[5]=t.m42;return}if(t instanceof rt){this.values=t.values;return}if(Array.isArray(t)){if(t.length===2){this.values[0]=t[0],this.values[1]=t[1],this.values[2]=e[0],this.values[3]=e[1],this.values[4]=r[0],this.values[5]=r[1];return}if(t.length===3){const k=new g(t[0]),F=new g(t[1]),X=new g(t[2]);this.values[0]=k.x,this.values[1]=k.y,this.values[2]=F.x,this.values[3]=F.y,this.values[4]=X.x,this.values[5]=X.y;return}this.values[0]=t[0],this.values[1]=t[1],this.values[2]=t[2],this.values[3]=t[3],this.values[4]=t[4],this.values[5]=t[5];return}const c=new g(t),m=new g(e),y=new g(r);this.values[0]=c.x,this.values[1]=c.y,this.values[2]=m.x,this.values[3]=m.y,this.values[4]=y.x,this.values[5]=y.y}column(t){return new g(this.values[t*2],this.values[t*2+1])}row(t){return[this.values[t],this.values[t+2],this.values[t+4]]}mul(t){const e=this.values[0],r=this.values[1],i=this.values[2],a=this.values[3],h=this.values[4],c=this.values[5],m=t.values[0],y=t.values[1],k=t.values[2],F=t.values[3],X=t.values[4],Q=t.values[5];return new rt(e*m+i*y,r*m+a*y,e*k+i*F,r*k+a*F,e*X+i*Q+h,r*X+a*Q+c)}rotate(t,e=!0){e&&(t*=te);const r=this.values[0],i=this.values[1],a=this.values[2],h=this.values[3],c=this.values[4],m=this.values[5],y=Math.sin(t),k=Math.cos(t);return new rt(r*k+a*y,i*k+h*y,r*-y+a*k,i*-y+h*k,c,m)}scale(t){const e=new g(t);return new rt(this.values[0]*e.x,this.values[1]*e.x,this.values[2]*e.y,this.values[3]*e.y,this.values[4],this.values[5])}mulScalar(t){return new rt(this.values[0]*t,this.values[1]*t,this.values[2]*t,this.values[3]*t,this.values[4]*t,this.values[5]*t)}translate(t){const e=new g(t);return new rt(this.values[0],this.values[1],this.values[2],this.values[3],this.values[0]*e.x+this.values[2]*e.y+this.values[4],this.values[1]*e.x+this.values[3]*e.y+this.values[5])}add(t){return new rt(this.values[0]+t.values[0],this.values[1]+t.values[1],this.values[2]+t.values[2],this.values[3]+t.values[3],this.values[4]+t.values[4],this.values[5]+t.values[5])}sub(t){return new rt(this.values[0]-t.values[0],this.values[1]-t.values[1],this.values[2]-t.values[2],this.values[3]-t.values[3],this.values[4]-t.values[4],this.values[5]-t.values[5])}toSymbol(){return rt.symbol}toUniform(t,e){t.uniformMatrix3fv(e,!1,[this.values[0],this.values[1],0,this.values[2],this.values[3],0,this.values[4],this.values[5],1])}equals(t,e=He){return Math.abs(this.values[0]-t.values[0])<=e+Number.EPSILON&&Math.abs(this.values[1]-t.values[1])<=e+Number.EPSILON&&Math.abs(this.values[2]-t.values[2])<=e+Number.EPSILON&&Math.abs(this.values[3]-t.values[3])<=e+Number.EPSILON&&Math.abs(this.values[4]-t.values[4])<=e+Number.EPSILON&&Math.abs(this.values[5]-t.values[5])<=e+Number.EPSILON}exactlyEquals(t){return this.values[0]===t.values[0]&&this.values[1]===t.values[1]&&this.values[2]===t.values[2]&&this.values[3]===t.values[3]&&this.values[4]===t.values[4]&&this.values[5]===t.values[5]}}rt.symbol=Symbol.for("@motion-canvas/core/types/Matrix2D");rt.identity=new rt(1,0,0,1,0,0);rt.zero=new rt(0,0,0,0,0,0);var ci;(function(n){n[n.Vertical=1]="Vertical",n[n.Horizontal=2]="Horizontal"})(ci||(ci={}));var xt;(function(n){n[n.Top=4]="Top",n[n.Bottom=8]="Bottom",n[n.Left=16]="Left",n[n.Right=32]="Right"})(xt||(xt={}));var it;(function(n){n[n.Middle=3]="Middle",n[n.Top=5]="Top",n[n.Bottom=9]="Bottom",n[n.Left=18]="Left",n[n.Right=34]="Right",n[n.TopLeft=20]="TopLeft",n[n.TopRight=36]="TopRight",n[n.BottomLeft=24]="BottomLeft",n[n.BottomRight=40]="BottomRight"})(it||(it={}));function Zu(n){if(n===it.Middle)return g.zero;let t=0;n&xt.Left?t=-1:n&xt.Right&&(t=1);let e=0;return n&xt.Top?e=-1:n&xt.Bottom&&(e=1),new g(t,e)}class g{static createSignal(t,e=g.lerp,r){return new Pi(["x","y"],i=>new g(i),t,e,r).toSignal()}static lerp(t,e,r){let i,a;return typeof r=="number"?i=a=r:(i=r.x,a=r.y),new g(tt(t.x,e.x,i),tt(t.y,e.y,a))}static arcLerp(t,e,r,i=!1,a){return a??(a=t.sub(e).ctg),g.lerp(t,e,Ti(r,i,a))}static createArcLerp(t,e){return(r,i,a)=>g.arcLerp(r,i,a,t,e)}static polarLerp(t,e,r,i=!1,a=g.zero){t=t.sub(a),e=e.sub(a);const h=t.degrees;let c=e.degrees;h>c!==i&&(c=c+(i?-360:360));const y=tt(h,c,r)*te,k=tt(t.magnitude,e.magnitude,r);return new g(k*Math.cos(y)+a.x,k*Math.sin(y)+a.y)}static createPolarLerp(t=!1,e=g.zero){return(r,i,a)=>g.polarLerp(r,i,a,t,new g(e))}static fromOrigin(t){const e=new g;return t===it.Middle||(t&xt.Left?e.x=-1:t&xt.Right&&(e.x=1),t&xt.Top?e.y=-1:t&xt.Bottom&&(e.y=1)),e}static fromScalar(t){return new g(t,t)}static fromRadians(t){return new g(Math.cos(t),Math.sin(t))}static fromDegrees(t){return g.fromRadians(t*te)}static radians(t,e){return Math.atan2(e,t)}static degrees(t,e){return g.radians(t,e)*xu}static magnitude(t,e){return Math.sqrt(t*t+e*e)}static squaredMagnitude(t,e){return t*t+e*e}static angleBetween(t,e){return Math.acos(wt(-1,1,t.dot(e)/(t.magnitude*e.magnitude)))*(t.cross(e)>=0?1:-1)}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}get magnitude(){return g.magnitude(this.x,this.y)}get squaredMagnitude(){return g.squaredMagnitude(this.x,this.y)}get normalized(){return this.scale(1/g.magnitude(this.x,this.y))}get safe(){return new g(isNaN(this.x)?0:this.x,isNaN(this.y)?0:this.y)}get flipped(){return new g(-this.x,-this.y)}get floored(){return new g(Math.floor(this.x),Math.floor(this.y))}get rounded(){return new g(Math.round(this.x),Math.round(this.y))}get ceiled(){return new g(Math.ceil(this.x),Math.ceil(this.y))}get perpendicular(){return new g(this.y,-this.x)}get radians(){return g.radians(this.x,this.y)}get degrees(){return g.degrees(this.x,this.y)}get ctg(){return this.x/this.y}constructor(t,e){if(this.x=0,this.y=0,t!=null){if(typeof t!="object"){this.x=t,this.y=e??t;return}if(Array.isArray(t)){this.x=t[0],this.y=t[1];return}if("width"in t){this.x=t.width,this.y=t.height;return}this.x=t.x,this.y=t.y}}lerp(t,e){return g.lerp(this,t,e)}getOriginOffset(t){const e=g.fromOrigin(t);return e.x*=this.x/2,e.y*=this.y/2,e}scale(t){return new g(this.x*t,this.y*t)}transformAsPoint(t){const e=new rt(t);return new g(this.x*e.scaleX+this.y*e.skewY+e.translateX,this.x*e.skewX+this.y*e.scaleY+e.translateY)}transform(t){const e=new rt(t);return new g(this.x*e.scaleX+this.y*e.skewY,this.x*e.skewX+this.y*e.scaleY)}mul(t){const e=new g(t);return new g(this.x*e.x,this.y*e.y)}div(t){const e=new g(t);return new g(this.x/e.x,this.y/e.y)}add(t){const e=new g(t);return new g(this.x+e.x,this.y+e.y)}sub(t){const e=new g(t);return new g(this.x-e.x,this.y-e.y)}dot(t){const e=new g(t);return this.x*e.x+this.y*e.y}cross(t){const e=new g(t);return this.x*e.y-this.y*e.x}mod(t){const e=new g(t);return new g(this.x%e.x,this.y%e.y)}rotate(t,e=g.zero){const r=new g(e),i=rt.fromTranslation(r).rotate(t).translate(r.flipped);return this.transformAsPoint(i)}addX(t){return new g(this.x+t,this.y)}addY(t){return new g(this.x,this.y+t)}map(t){return new g(t(this.x,0),t(this.y,1))}toSymbol(){return g.symbol}toString(){return`Vector2(${this.x}, ${this.y})`}toArray(){return[this.x,this.y]}toUniform(t,e){t.uniform2f(e,this.x,this.y)}serialize(){return{x:this.x,y:this.y}}exactlyEquals(t){return this.x===t.x&&this.y===t.y}equals(t,e=He){return Math.abs(this.x-t.x)<=e+Number.EPSILON&&Math.abs(this.y-t.y)<=e+Number.EPSILON}*[Symbol.iterator](){yield this.x,yield this.y}}g.symbol=Symbol.for("@motion-canvas/core/types/Vector2");g.zero=new g;g.one=new g(1,1);g.right=new g(1,0);g.left=new g(-1,0);g.up=new g(0,1);g.down=new g(0,-1);g.top=new g(0,-1);g.bottom=new g(0,1);g.topLeft=new g(-1,-1);g.topRight=new g(1,-1);g.bottomLeft=new g(-1,1);g.bottomRight=new g(1,1);class Y{static createSignal(t,e=Y.lerp){return new Cr(["x","y","width","height"],r=>new Y(r),t,e).toSignal()}static lerp(t,e,r){let i,a,h,c;return typeof r=="number"?i=a=h=c=r:r instanceof g?(i=h=r.x,a=c=r.y):(i=r.x,a=r.y,h=r.width,c=r.height),new Y(tt(t.x,e.x,i),tt(t.y,e.y,a),tt(t.width,e.width,h),tt(t.height,e.height,c))}static arcLerp(t,e,r,i=!1,a){return a??(a=(t.position.sub(e.position).ctg+t.size.sub(e.size).ctg)/2),Y.lerp(t,e,Ti(r,i,a))}static fromSizeCentered(t){return new Y(-t.width/2,-t.height/2,t.width,t.height)}static fromPoints(...t){let e=1/0,r=1/0,i=-1/0,a=-1/0;for(const h of t)h.x>i&&(i=h.x),h.xa&&(a=h.y),h.yi&&(i=c),h.xa&&(a=m),h.ye.transformAsPoint(t))}expand(t){const e=new At(t),r=new Y(this);return r.left-=e.left,r.top-=e.top,r.right+=e.right,r.bottom+=e.bottom,r}addSpacing(t){return this.expand(t)}includes(t){return t.x>=this.x&&t.x<=this.x+this.width&&t.y>=this.y&&t.y<=this.y+this.height}intersects(t){return this.leftt.left&&this.topt.top}intersection(t){const e=new Y;return this.intersects(t)&&(e.left=Math.max(this.left,t.left),e.top=Math.max(this.top,t.top),e.right=Math.min(this.right,t.right),e.bottom=Math.min(this.bottom,t.bottom)),e}union(t){const e=new Y;return e.left=Math.min(this.left,t.left),e.top=Math.min(this.top,t.top),e.right=Math.max(this.right,t.right),e.bottom=Math.max(this.bottom,t.bottom),e}toSymbol(){return Y.symbol}toString(){return`BBox(${this.x}, ${this.y}, ${this.width}, ${this.height})`}toUniform(t,e){t.uniform4f(e,this.x,this.y,this.width,this.height)}serialize(){return{x:this.x,y:this.y,width:this.width,height:this.height}}}Y.symbol=Symbol.for("@motion-canvas/core/types/Rect");var Vu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ri={exports:{}};/** +`;class Xc{constructor(t,e){this.scene=t,this.sharedContext=e,this.gl=null,this.positionBuffer=null,this.sourceTexture=null,this.destinationTexture=null,this.positionLocation=0,this.quadPositions=new Float32Array([-1,1,-1,-1,1,1,1,-1]),this.handleReload=()=>{this.gl&&this.updateViewport()},t.onReloaded.subscribe(this.handleReload)}setup(t){this.gl=t,this.updateViewport(),this.positionBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,this.quadPositions,t.STATIC_DRAW),t.vertexAttribPointer(this.positionLocation,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(this.positionLocation),this.sourceTexture=t.createTexture(),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.sourceTexture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),this.destinationTexture=t.createTexture(),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,this.destinationTexture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)}teardown(t){t.deleteBuffer(this.positionBuffer),t.disableVertexAttribArray(this.positionLocation),t.deleteTexture(this.sourceTexture),t.deleteTexture(this.destinationTexture),this.positionBuffer=null,this.sourceTexture=null,this.destinationTexture=null,this.gl=null}updateViewport(){if(this.gl){const t=this.scene.getRealSize();this.gl.canvas.width=t.width,this.gl.canvas.height=t.height,this.gl.viewport(0,0,t.width,t.height)}}getGL(){return this.gl??this.sharedContext.borrow(this)}getProgram(t){const e=this.sharedContext.getProgram(t,qc);if(!e)return null;const r=this.scene.getRealSize(),i=this.getGL();return i.useProgram(e),i.uniform1i(i.getUniformLocation(e,Nc),0),i.uniform1i(i.getUniformLocation(e,jc),1),i.uniform2f(i.getUniformLocation(e,Dc),r.x,r.y),i.uniform1f(i.getUniformLocation(e,Bc),this.scene.playback.deltaTime),i.uniform1f(i.getUniformLocation(e,Uc),this.scene.playback.fps),e}copyTextures(t,e){this.copyTexture(e,this.sourceTexture),this.copyTexture(t,this.destinationTexture)}clear(){const t=this.getGL();t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT)}render(){const t=this.getGL();t.drawArrays(t.TRIANGLE_STRIP,0,4)}copyTexture(t,e){const r=this.getGL();r.bindTexture(r.TEXTURE_2D,e),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t),r.generateMipmap(r.TEXTURE_2D)}}class Hc{get onChanged(){return this.slides.subscribable}constructor(t){this.scene=t,this.slides=new ie([]),this.lookup=new Map,this.collisionLookup=new Set,this.current=null,this.canResume=!1,this.waitsForId=null,this.targetId=null,this.handleReload=()=>{this.lookup.clear(),this.collisionLookup.clear(),this.current=null,this.waitsForId=null,this.targetId=null},this.handleReset=()=>{this.collisionLookup.clear(),this.current=null,this.waitsForId=null},this.handleRecalculated=()=>{this.slides.current=[...this.lookup.values()]},this.scene.onReloaded.subscribe(this.handleReload),this.scene.onReset.subscribe(this.handleReset),this.scene.onRecalculated.subscribe(this.handleRecalculated)}setTarget(t){this.targetId=t}resume(){this.canResume=!0}isWaitingFor(t){return this.waitsForId===t}isWaiting(){return this.waitsForId!==null}didHappen(t){var e;if(this.current===null)return!1;for(const r of this.lookup.keys()){if(r===t)return!0;if(r===((e=this.current)==null?void 0:e.id))return!1}return!1}getCurrent(){return this.current}register(t,e){if(this.waitsForId!==null)throw new Error(`The animation already waits for a slide: ${this.waitsForId}.`);const r=this.toId(t);this.scene.playback.state!==Je.Presenting&&(this.lookup.has(r)||this.lookup.set(r,{id:r,name:t,time:e,scene:this.scene,stack:new Error().stack}),this.collisionLookup.has(t)?this.scene.logger.warn({message:`A slide named "${t}" already exists.`,stack:new Error().stack}):this.collisionLookup.add(t)),this.waitsForId=r,this.current=this.lookup.get(r)??null,this.canResume=!1}shouldWait(t){const e=this.toId(t);if(this.waitsForId!==e)throw new Error(`The animation waits for a different slide: ${this.waitsForId}.`);if(!this.lookup.get(e))throw new Error(`Could not find the "${t}" slide.`);let i=this.canResume;return this.scene.playback.state!==Je.Presenting&&(i=e!==this.targetId),i&&(this.waitsForId=null),!i}toId(t){return`${this.scene.name}:${t}`}}class Yc{constructor(t){this.scene=t,this.signals={},this.variables={},this.handleReset=()=>{this.signals={}},t.onReset.subscribe(this.handleReset)}get(t,e){var r;return(r=this.signals)[t]??(r[t]=je(this.variables[t]??e)),()=>this.signals[t]()}updateSignals(t){this.variables=t,Object.keys(t).map(e=>{e in this.signals&&this.signals[e](t[e])})}}class Zc{get firstFrame(){return this.cache.current.firstFrame}get lastFrame(){return this.firstFrame+this.cache.current.duration}get onCacheChanged(){return this.cache.subscribable}get onReloaded(){return this.reloaded.subscribable}get onRecalculated(){return this.recalculated.subscribable}get onThreadChanged(){return this.thread.subscribable}get onRenderLifecycle(){return this.renderLifecycle.subscribable}get onReset(){return this.afterReset.subscribable}get LifecycleEvents(){return this.logger.warn("LifecycleEvents is deprecated. Use lifecycleEvents instead."),this.lifecycleEvents}get previous(){return this.previousScene}constructor(t){this.cache=new ie({firstFrame:0,transitionDuration:0,duration:0,lastFrame:0}),this.reloaded=new Ot,this.recalculated=new Ot,this.thread=new ie(null),this.renderLifecycle=new Ot,this.afterReset=new Ot,this.lifecycleEvents=new _c(this),this.previousScene=null,this.runner=null,this.state=mt.Initial,this.cached=!1,this.counters={},this.name=t.name,this.size=t.size,this.resolutionScale=t.resolutionScale,this.logger=t.logger,this.playback=t.playback,this.meta=t.meta,this.runnerFactory=t.config,this.creationStack=t.stack,this.experimentalFeatures=t.experimentalFeatures??!1,Vt(this.runnerFactory,ft(this.name)),this.timeEvents=new t.timeEventsClass(this),this.variables=new Yc(this),this.shaders=new Xc(this,t.sharedWebGLContext),this.slides=new Hc(this),this.random=new Ke(this.meta.seed.get()),this.previousOnTop=!1}update(){}async render(t){let e=0;do e++,await lt.consumePromises(),t.save(),t.clearRect(0,0,t.canvas.width,t.canvas.height),this.execute(()=>this.draw(t)),t.restore();while(lt.hasPromises()&&e<10);e>1&&this.logger.debug(`render iterations: ${e}`)}reload({config:t,size:e,stack:r,resolutionScale:i}={}){t&&(this.runnerFactory=t),e&&(this.size=e),i&&(this.resolutionScale=i),r&&(this.creationStack=r),this.cached=!1,this.reloaded.dispatch()}async recalculate(t){const e=this.cache.current;if(e.firstFrame=this.playback.frame,e.lastFrame=e.firstFrame+e.duration,this.isCached()){t(e.lastFrame),this.cache.current={...e};return}for(e.transitionDuration=-1,await this.reset();!this.canTransitionOut();)e.transitionDuration<0&&this.state===mt.AfterTransitionIn&&(e.transitionDuration=this.playback.frame-e.firstFrame),t(this.playback.frame+1),await this.next();e.transitionDuration===-1&&(e.transitionDuration=0),e.lastFrame=this.playback.frame,e.duration=e.lastFrame-e.firstFrame,await new Promise(r=>setTimeout(r,0)),this.cached=!0,this.cache.current={...e},this.recalculated.dispatch()}async next(){var e;if(!this.runner)return;let t=this.execute(()=>this.runner.next());for(this.update();t.value;){if(Ec(t.value)){const r=await t.value.toPromise();t=this.execute(()=>this.runner.next(r))}else if(Fc(t.value)){const r=await t.value;t=this.execute(()=>this.runner.next(r))}else this.logger.warn({message:"Invalid value yielded by the scene.",object:t.value}),t=this.execute(()=>this.runner.next(t.value));this.update()}if(lt.hasPromises()){const r=await lt.consumePromises();this.logger.error({message:"Tried to access an asynchronous property before the node was ready. Make sure to yield the node before accessing the property.",stack:r[0].stack,inspect:((e=r[0].owner)==null?void 0:e.key)??void 0})}t.done&&(this.state=mt.Finished)}async reset(t=null){this.counters={},this.previousScene=t,this.previousOnTop=!1,this.random=new Ke(this.meta.seed.get()),this.runner=Li(()=>this.runnerFactory(this.getView()),e=>{this.thread.current=e}),this.state=mt.AfterTransitionIn,this.afterReset.dispatch(),await this.next()}getSize(){return this.size}getRealSize(){return this.size.mul(this.resolutionScale)}isAfterTransitionIn(){return this.state===mt.AfterTransitionIn}canTransitionOut(){return this.state===mt.CanTransitionOut||this.state===mt.Finished}isFinished(){return this.state===mt.Finished}enterInitial(){this.state===mt.AfterTransitionIn?this.state=mt.Initial:this.logger.warn(`Scene ${this.name} entered initial in an unexpected state: ${this.state}`)}enterAfterTransitionIn(){this.state===mt.Initial?this.state=mt.AfterTransitionIn:this.logger.warn(`Scene ${this.name} transitioned in an unexpected state: ${this.state}`)}enterCanTransitionOut(){this.state===mt.AfterTransitionIn||this.state===mt.Initial?this.state=mt.CanTransitionOut:this.logger.warn(`Scene ${this.name} was marked as finished in an unexpected state: ${this.state}`)}isCached(){return this.cached}execute(t){let e;bc(this),Ac(this.playback);try{e=t()}finally{Oc(this.playback),yc(this)}return e}}function Vc(){return new Xt("scene",{version:new Ct("version",1),timeEvents:new Ct("time events",[]),seed:new Ct("seed",Ke.createSeed())})}function Jc(n,t,e){const r=[...n],i=[...t];if(i.length>=r.length){const a=Math.floor(i.length*e),h=Math.floor(tt(r.length-1,i.length,e));let u="";for(let v=0;v=0;v--)v ${t} may result in unexpected behavior.`);return}if(typeof n=="number"&&typeof t=="number")return tt(n,t,e);if(typeof n=="string"&&typeof t=="string")return Jc(n,t,e);if(typeof n=="boolean"&&typeof t=="boolean")return e<.5?n:t;if("lerp"in n)return n.lerp(t,e);if(n&&t&&typeof n=="object"&&typeof t=="object")if(Array.isArray(n)&&Array.isArray(t)){if(n.length===t.length)return n.map((i,a)=>De(i,t[a],e))}else{let i=!1;if(!(n instanceof Map)&&!(t instanceof Map)&&(i=!0,n=new Map(Object.entries(n)),t=new Map(Object.entries(t))),n instanceof Map&&t instanceof Map){const a=new Map;for(const h of new Set([...n.keys(),...t.keys()])){const u=De(n.get(h),t.get(h),e,!0);u!==void 0&&a.set(h,u)}return i?Object.fromEntries(a):a}}return t}function Qc(n,t,e){return e<.5?n:t}function tt(n,t,e){return n+(t-n)*e}function Kc(n,t,e,r,i){return e+(i-n)*(r-e)/(t-n)}function xt(n,t,e){return et?t:e}function $i(n,t,e){let r=t;e>1?e=1/e:r=!r;const i=r?Math.acos(xt(-1,1,1-n)):Math.asin(n),a=tt(i,tt(0,Math.PI/2,n),e);let h=Math.sin(a),u=1-Math.cos(a);return t&&([h,u]=[u,h]),new g(h,u)}Vt(Ii,ft());function*Ii(n,t,e,r,i,a){const h=typeof r=="number"?r:.001;a=typeof r=="number"?a:i;const u=(ht,K)=>{typeof r=="function"?r(ht,K):typeof i=="function"&&i(ht,K)};if(n=n??{mass:.05,stiffness:10,damping:.5},n.mass<=0){it().error(new Error("Spring mass must be greater than 0."));return}if(n.stiffness<0){it().error(new Error("Spring stiffness must be greater or equal to 0."));return}if(n.damping<0){it().error(new Error("Spring damping must be greater or equal to 0."));return}const v=tr();let y=t,C=n.initialVelocity??0;const F=ht=>{if(n===null)return;const K=y-e,ce=-n.stiffness*K-n.damping*C;C+=ce/n.mass*ht,y+=C*ht},J=1/120;u(t,0);const et=v.time();let T=et,rt=!1;for(;!rt;){for(;Tht?(F(ht),T=v.fixed):(F(J),T+=J),Math.abs(e-y)r.fixed;){const h=r.fixed-i,u=h/n;h>0&&t(u,h),yield}r.time(a),t(1,n),e==null||e(1,n)}class lt{static collectPromise(t,e=null){const r={promise:t,value:e,stack:new Error().stack},i=this.collectionStack.at(-1);return i&&(r.owner=i.owner),t.then(a=>{r.value=a,i==null||i.markDirty()}),this.promises.push(r),r}static hasPromises(){return this.promises.length>0}static async consumePromises(){const t=[...this.promises];return await Promise.all(t.map(e=>e.promise)),this.promises=this.promises.filter(e=>!t.includes(e)),t}constructor(t){this.owner=t,this.dependencies=new Set,this.event=new pc,this.markDirty=()=>this.event.raise(),this.invokable=this.invoke.bind(this),Object.defineProperty(this.invokable,"context",{value:this}),Object.defineProperty(this.invokable,"toPromise",{value:this.toPromise.bind(this)})}invoke(){}startCollecting(){if(lt.collectionSet.has(this))throw new mn("A circular dependency occurred between signals.",`This can happen when signals reference each other in a loop. + Try using the attached stack trace to locate said loop.`);lt.collectionSet.add(this),lt.collectionStack.push(this)}finishCollecting(){if(lt.collectionSet.delete(this),lt.collectionStack.pop()!==this)throw new Error("collectStart/collectEnd was called out of order.")}clearDependencies(){this.dependencies.forEach(t=>t.unsubscribe(this.markDirty)),this.dependencies.clear()}collect(){const t=lt.collectionStack.at(-1);t&&(t.dependencies.add(this.event.subscribable),this.event.subscribe(t.markDirty))}dispose(){this.clearDependencies(),this.event.clear(),this.owner=null}async toPromise(){do await lt.consumePromises(),this.invokable();while(lt.hasPromises());return this.invokable}}lt.collectionSet=new Set;lt.collectionStack=[];lt.promises=[];const Ye=Symbol.for("@motion-canvas/core/signals/default");function Ht(n){return typeof n=="function"}function me(n,t){return Ht(n)?()=>t(n()):t(n)}function ye(n){return Ht(n)?n():n}class we extends lt{constructor(t,e,r=void 0,i=h=>h,a={}){super(r),this.initial=t,this.interpolation=e,this.parser=i,this.tweening=!1,Object.defineProperty(this.invokable,"reset",{value:this.reset.bind(this)}),Object.defineProperty(this.invokable,"save",{value:this.save.bind(this)}),Object.defineProperty(this.invokable,"isInitial",{value:this.isInitial.bind(this)}),this.initial!==void 0&&(this.current=this.initial,this.markDirty(),Ht(this.initial)||(this.last=this.parse(this.initial))),this.extensions={getter:this.getter.bind(this),setter:this.setter.bind(this),tweener:this.tweener.bind(this),...a}}toSignal(){return this.invokable}parse(t){return this.parser(t)}set(t){return this.extensions.setter(t),this.owner}setter(t){return t===Ye&&(t=this.initial),this.current===t?this.owner:(this.current=t,this.clearDependencies(),Ht(t)||(this.last=this.parse(t)),this.markDirty(),this.owner)}get(){return this.extensions.getter()}getter(){var t;if(this.event.isRaised()&&Ht(this.current)){this.clearDependencies(),this.startCollecting();try{this.last=this.parse(this.current())}catch(e){it().error({...xi(e),inspect:(t=this.owner)==null?void 0:t.key})}this.finishCollecting()}return this.event.reset(),this.collect(),this.last}invoke(t,e,r=_t,i=this.interpolation){return t===void 0?this.get():e===void 0?this.set(t):this.createQueue(r,i).to(t,e)}createQueue(t,e){const r=this.get(),i=[],a=pi("animation chain",function*(){for(;i.length>0;)yield*i.shift()});return a.to=(h,u,v=t,y=e)=>(t=v,e=y,i.push(this.tween(h,u,v,y)),a),a.back=(h,u=t,v=e)=>(t=u,e=v,i.push(this.tween(r,h,t,e)),a),a.wait=h=>(i.push(Qe(h)),a),a.run=h=>(i.push(h),a),a.do=h=>(i.push(pi(function*(){h()})),a),a}*tween(t,e,r,i){t===Ye&&(t=this.initial),this.tweening=!0,yield*this.extensions.tweener(t,e,r,i),this.set(t),this.tweening=!1}*tweener(t,e,r,i){const a=this.get();yield*Dt(e,h=>{this.set(i(a,this.parse(ye(t)),r(h)))})}dispose(){super.dispose(),this.initial=void 0,this.current=void 0,this.last=void 0}reset(){return this.initial!==void 0&&this.set(this.initial),this.owner}save(){return this.set(this.get())}isInitial(){return this.collect(),this.current===this.initial}getInitial(){return this.initial}raw(){return this.current}isTweening(){return this.tweening}}class Pr extends we{constructor(t,e,r,i,a=void 0,h={}){var u;super(void 0,i,a,e,h),this.entries=t,this.signals=[],this.parser=e;for(const v of t){let y,C;Array.isArray(v)?([y,C]=v,(u=C.context).owner??(u.owner=this)):(y=v,C=new we(me(r,F=>e(F)[v]),tt,a??this.invokable).toSignal()),this.signals.push([y,C]),Object.defineProperty(this.invokable,y,{value:C})}}toSignal(){return this.invokable}parse(t){return this.parser(t)}getter(){return this.parse(Object.fromEntries(this.signals.map(([t,e])=>[t,e()])))}setter(t){if(Ht(t))for(const[e,r]of this.signals)r(()=>this.parser(t())[e]);else{const e=this.parse(t);for(const[r,i]of this.signals)i(e[r])}return this.owner}reset(){for(const[,t]of this.signals)t.reset();return this.owner}save(){for(const[,t]of this.signals)t.save();return this.owner}isInitial(){for(const[,t]of this.signals)if(!t.isInitial())return!1;return!0}raw(){return Object.fromEntries(this.signals.map(([t,e])=>[t,e.context.raw()]))}}class ru extends lt{constructor(t,e){super(e),this.factory=t,this.markDirty()}toSignal(){return this.invokable}dispose(){super.dispose(),this.last=void 0}invoke(...t){var e;if(this.event.isRaised()){this.clearDependencies(),this.startCollecting();try{this.last=this.factory(...t)}catch(r){it().error({...xi(r),inspect:(e=this.owner)==null?void 0:e.key})}this.finishCollecting()}return this.event.reset(),this.collect(),this.last}}class Ai extends Pr{constructor(t,e,r,i,a=void 0,h={}){super(t,e,r,i,a,h),Object.defineProperty(this.invokable,"edit",{value:this.edit.bind(this)}),Object.defineProperty(this.invokable,"mul",{value:this.mul.bind(this)}),Object.defineProperty(this.invokable,"div",{value:this.div.bind(this)}),Object.defineProperty(this.invokable,"add",{value:this.add.bind(this)}),Object.defineProperty(this.invokable,"sub",{value:this.sub.bind(this)}),Object.defineProperty(this.invokable,"dot",{value:this.dot.bind(this)}),Object.defineProperty(this.invokable,"cross",{value:this.cross.bind(this)}),Object.defineProperty(this.invokable,"mod",{value:this.mod.bind(this)})}toSignal(){return this.invokable}edit(t,e,r,i){const a=t(this.get());return this.invoke(a,e,r,i)}mul(t,e,r,i){const a=h=>h.mul(t);return e===void 0?this.edit(a):this.edit(a,e,r,i)}div(t,e,r,i){const a=h=>h.div(t);return e===void 0?this.edit(a):this.edit(a,e,r,i)}add(t,e,r,i){const a=h=>h.add(t);return e===void 0?this.edit(a):this.edit(a,e,r,i)}sub(t,e,r,i){const a=h=>h.sub(t);return e===void 0?this.edit(a):this.edit(a,e,r,i)}dot(t,e,r,i){const a=h=>h.dot(t);return e===void 0?this.edit(a):this.edit(a,e,r,i)}cross(t,e,r,i){const a=h=>h.cross(t);return e===void 0?this.edit(a):this.edit(a,e,r,i)}mod(t,e,r,i){const a=h=>h.mod(t);return e===void 0?this.edit(a):this.edit(a,e,r,i)}}function nu(n,t){return new ru(n,t).toSignal()}function je(n,t=De,e){return new we(n,t,e).toSignal()}class At{static createSignal(t,e=At.lerp){return new Pr(["top","right","bottom","left"],r=>new At(r),t,e).toSignal()}static lerp(t,e,r){return new At(tt(t.top,e.top,r),tt(t.right,e.right,r),tt(t.bottom,e.bottom,r),tt(t.left,e.left,r))}get x(){return this.left+this.right}get y(){return this.top+this.bottom}constructor(t=0,e,r,i){if(this.top=0,this.right=0,this.bottom=0,this.left=0,t!=null){if(Array.isArray(t)&&(i=t[3],r=t[2],e=t[1],t=t[0]),typeof t=="number"){this.top=t,this.right=e!==void 0?e:t,this.bottom=r!==void 0?r:t,this.left=i!==void 0?i:e!==void 0?e:t;return}this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left}}lerp(t,e){return At.lerp(this,t,e)}scale(t){return new At(this.top*t,this.right*t,this.bottom*t,this.left*t)}addScalar(t){return new At(this.top+t,this.right+t,this.bottom+t,this.left+t)}toSymbol(){return At.symbol}toString(){return`Spacing(${this.top}, ${this.right}, ${this.bottom}, ${this.left})`}toUniform(t,e){t.uniform4f(e,this.top,this.right,this.bottom,this.left)}serialize(){return{top:this.top,right:this.right,bottom:this.bottom,left:this.left}}}At.symbol=Symbol.for("@motion-canvas/core/types/Spacing");const Ze=1e-6;class at{static fromRotation(t){return at.identity.rotate(t)}static fromTranslation(t){return at.identity.translate(new g(t))}static fromScaling(t){return at.identity.scale(new g(t))}get x(){return new g(this.values[0],this.values[1])}get y(){return new g(this.values[2],this.values[3])}get scaleX(){return this.values[0]}set scaleX(t){this.values[0]=this.x.normalized.scale(t).x}get skewX(){return this.values[1]}set skewX(t){this.values[1]=t}get scaleY(){return this.values[3]}set scaleY(t){this.values[3]=this.y.normalized.scale(t).y}get skewY(){return this.values[2]}set skewY(t){this.values[2]=t}get translateX(){return this.values[4]}set translateX(t){this.values[4]=t}get translateY(){return this.values[5]}set translateY(t){this.values[5]=t}get rotation(){return g.degrees(this.values[0],this.values[1])}set rotation(t){const e=this.rotate(t-this.rotation);this.values[0]=e.values[0],this.values[1]=e.values[1],this.values[2]=e.values[2],this.values[3]=e.values[3]}get translation(){return new g(this.values[4],this.values[5])}set translation(t){const e=new g(t);this.values[4]=e.x,this.values[5]=e.y}get scaling(){return new g(this.values[0],this.values[3])}set scaling(t){const e=new g(t),r=new g(this.values[0],this.values[1]).normalized,i=new g(this.values[2],this.values[3]).normalized;this.values[0]=r.x*e.x,this.values[1]=r.y*e.y,this.values[2]=i.x*e.x,this.values[3]=i.y*e.y}get inverse(){const t=this.values[0],e=this.values[1],r=this.values[2],i=this.values[3],a=this.values[4],h=this.values[5];let u=t*i-e*r;return u?(u=1/u,new at(i*u,-e*u,-r*u,t*u,(r*h-i*a)*u,(e*a-t*h)*u)):null}get determinant(){return this.values[0]*this.values[3]-this.values[1]*this.values[2]}get domMatrix(){return new DOMMatrix([this.values[0],this.values[1],this.values[2],this.values[3],this.values[4],this.values[5]])}constructor(t,e,r,i,a,h){if(this.values=new Float32Array(6),arguments.length===0){this.values=new Float32Array([1,0,0,1,0,0]);return}if(arguments.length===6){this.values[0]=t,this.values[1]=e,this.values[2]=r,this.values[3]=i,this.values[4]=a,this.values[5]=h;return}if(t instanceof DOMMatrix){this.values[0]=t.m11,this.values[1]=t.m12,this.values[2]=t.m21,this.values[3]=t.m22,this.values[4]=t.m41,this.values[5]=t.m42;return}if(t instanceof at){this.values=t.values;return}if(Array.isArray(t)){if(t.length===2){this.values[0]=t[0],this.values[1]=t[1],this.values[2]=e[0],this.values[3]=e[1],this.values[4]=r[0],this.values[5]=r[1];return}if(t.length===3){const C=new g(t[0]),F=new g(t[1]),H=new g(t[2]);this.values[0]=C.x,this.values[1]=C.y,this.values[2]=F.x,this.values[3]=F.y,this.values[4]=H.x,this.values[5]=H.y;return}this.values[0]=t[0],this.values[1]=t[1],this.values[2]=t[2],this.values[3]=t[3],this.values[4]=t[4],this.values[5]=t[5];return}const u=new g(t),v=new g(e),y=new g(r);this.values[0]=u.x,this.values[1]=u.y,this.values[2]=v.x,this.values[3]=v.y,this.values[4]=y.x,this.values[5]=y.y}column(t){return new g(this.values[t*2],this.values[t*2+1])}row(t){return[this.values[t],this.values[t+2],this.values[t+4]]}mul(t){const e=this.values[0],r=this.values[1],i=this.values[2],a=this.values[3],h=this.values[4],u=this.values[5],v=t.values[0],y=t.values[1],C=t.values[2],F=t.values[3],H=t.values[4],J=t.values[5];return new at(e*v+i*y,r*v+a*y,e*C+i*F,r*C+a*F,e*H+i*J+h,r*H+a*J+u)}rotate(t,e=!0){e&&(t*=cn);const r=this.values[0],i=this.values[1],a=this.values[2],h=this.values[3],u=this.values[4],v=this.values[5],y=Math.sin(t),C=Math.cos(t);return new at(r*C+a*y,i*C+h*y,r*-y+a*C,i*-y+h*C,u,v)}scale(t){const e=new g(t);return new at(this.values[0]*e.x,this.values[1]*e.x,this.values[2]*e.y,this.values[3]*e.y,this.values[4],this.values[5])}mulScalar(t){return new at(this.values[0]*t,this.values[1]*t,this.values[2]*t,this.values[3]*t,this.values[4]*t,this.values[5]*t)}translate(t){const e=new g(t);return new at(this.values[0],this.values[1],this.values[2],this.values[3],this.values[0]*e.x+this.values[2]*e.y+this.values[4],this.values[1]*e.x+this.values[3]*e.y+this.values[5])}add(t){return new at(this.values[0]+t.values[0],this.values[1]+t.values[1],this.values[2]+t.values[2],this.values[3]+t.values[3],this.values[4]+t.values[4],this.values[5]+t.values[5])}sub(t){return new at(this.values[0]-t.values[0],this.values[1]-t.values[1],this.values[2]-t.values[2],this.values[3]-t.values[3],this.values[4]-t.values[4],this.values[5]-t.values[5])}toSymbol(){return at.symbol}toUniform(t,e){t.uniformMatrix3fv(e,!1,[this.values[0],this.values[1],0,this.values[2],this.values[3],0,this.values[4],this.values[5],1])}equals(t,e=Ze){return Math.abs(this.values[0]-t.values[0])<=e+Number.EPSILON&&Math.abs(this.values[1]-t.values[1])<=e+Number.EPSILON&&Math.abs(this.values[2]-t.values[2])<=e+Number.EPSILON&&Math.abs(this.values[3]-t.values[3])<=e+Number.EPSILON&&Math.abs(this.values[4]-t.values[4])<=e+Number.EPSILON&&Math.abs(this.values[5]-t.values[5])<=e+Number.EPSILON}exactlyEquals(t){return this.values[0]===t.values[0]&&this.values[1]===t.values[1]&&this.values[2]===t.values[2]&&this.values[3]===t.values[3]&&this.values[4]===t.values[4]&&this.values[5]===t.values[5]}}at.symbol=Symbol.for("@motion-canvas/core/types/Matrix2D");at.identity=new at(1,0,0,1,0,0);at.zero=new at(0,0,0,0,0,0);var vi;(function(n){n[n.Vertical=1]="Vertical",n[n.Horizontal=2]="Horizontal"})(vi||(vi={}));var St;(function(n){n[n.Top=4]="Top",n[n.Bottom=8]="Bottom",n[n.Left=16]="Left",n[n.Right=32]="Right"})(St||(St={}));var ot;(function(n){n[n.Middle=3]="Middle",n[n.Top=5]="Top",n[n.Bottom=9]="Bottom",n[n.Left=18]="Left",n[n.Right=34]="Right",n[n.TopLeft=20]="TopLeft",n[n.TopRight=36]="TopRight",n[n.BottomLeft=24]="BottomLeft",n[n.BottomRight=40]="BottomRight"})(ot||(ot={}));function su(n){if(n===ot.Middle)return g.zero;let t=0;n&St.Left?t=-1:n&St.Right&&(t=1);let e=0;return n&St.Top?e=-1:n&St.Bottom&&(e=1),new g(t,e)}class g{static createSignal(t,e=g.lerp,r){return new Ai(["x","y"],i=>new g(i),t,e,r).toSignal()}static lerp(t,e,r){let i,a;return typeof r=="number"?i=a=r:(i=r.x,a=r.y),new g(tt(t.x,e.x,i),tt(t.y,e.y,a))}static arcLerp(t,e,r,i=!1,a){return a??(a=t.sub(e).ctg),g.lerp(t,e,$i(r,i,a))}static createArcLerp(t,e){return(r,i,a)=>g.arcLerp(r,i,a,t,e)}static polarLerp(t,e,r,i=!1,a=g.zero){t=t.sub(a),e=e.sub(a);const h=t.degrees;let u=e.degrees;h>u!==i&&(u=u+(i?-360:360));const y=tt(h,u,r)*cn,C=tt(t.magnitude,e.magnitude,r);return new g(C*Math.cos(y)+a.x,C*Math.sin(y)+a.y)}static createPolarLerp(t=!1,e=g.zero){return(r,i,a)=>g.polarLerp(r,i,a,t,new g(e))}static fromOrigin(t){const e=new g;return t===ot.Middle||(t&St.Left?e.x=-1:t&St.Right&&(e.x=1),t&St.Top?e.y=-1:t&St.Bottom&&(e.y=1)),e}static fromScalar(t){return new g(t,t)}static fromRadians(t){return new g(Math.cos(t),Math.sin(t))}static fromDegrees(t){return g.fromRadians(t*cn)}static radians(t,e){return Math.atan2(e,t)}static degrees(t,e){return g.radians(t,e)*Pc}static magnitude(t,e){return Math.sqrt(t*t+e*e)}static squaredMagnitude(t,e){return t*t+e*e}static angleBetween(t,e){return Math.acos(xt(-1,1,t.dot(e)/(t.magnitude*e.magnitude)))*(t.cross(e)>=0?1:-1)}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}get magnitude(){return g.magnitude(this.x,this.y)}get squaredMagnitude(){return g.squaredMagnitude(this.x,this.y)}get normalized(){return this.scale(1/g.magnitude(this.x,this.y))}get safe(){return new g(isNaN(this.x)?0:this.x,isNaN(this.y)?0:this.y)}get flipped(){return new g(-this.x,-this.y)}get floored(){return new g(Math.floor(this.x),Math.floor(this.y))}get rounded(){return new g(Math.round(this.x),Math.round(this.y))}get ceiled(){return new g(Math.ceil(this.x),Math.ceil(this.y))}get perpendicular(){return new g(this.y,-this.x)}get radians(){return g.radians(this.x,this.y)}get degrees(){return g.degrees(this.x,this.y)}get ctg(){return this.x/this.y}constructor(t,e){if(this.x=0,this.y=0,t!=null){if(typeof t!="object"){this.x=t,this.y=e??t;return}if(Array.isArray(t)){this.x=t[0],this.y=t[1];return}if("width"in t){this.x=t.width,this.y=t.height;return}this.x=t.x,this.y=t.y}}lerp(t,e){return g.lerp(this,t,e)}getOriginOffset(t){const e=g.fromOrigin(t);return e.x*=this.x/2,e.y*=this.y/2,e}scale(t){return new g(this.x*t,this.y*t)}transformAsPoint(t){const e=new at(t);return new g(this.x*e.scaleX+this.y*e.skewY+e.translateX,this.x*e.skewX+this.y*e.scaleY+e.translateY)}transform(t){const e=new at(t);return new g(this.x*e.scaleX+this.y*e.skewY,this.x*e.skewX+this.y*e.scaleY)}mul(t){const e=new g(t);return new g(this.x*e.x,this.y*e.y)}div(t){const e=new g(t);return new g(this.x/e.x,this.y/e.y)}add(t){const e=new g(t);return new g(this.x+e.x,this.y+e.y)}sub(t){const e=new g(t);return new g(this.x-e.x,this.y-e.y)}dot(t){const e=new g(t);return this.x*e.x+this.y*e.y}cross(t){const e=new g(t);return this.x*e.y-this.y*e.x}mod(t){const e=new g(t);return new g(this.x%e.x,this.y%e.y)}rotate(t,e=g.zero){const r=new g(e),i=at.fromTranslation(r).rotate(t).translate(r.flipped);return this.transformAsPoint(i)}addX(t){return new g(this.x+t,this.y)}addY(t){return new g(this.x,this.y+t)}map(t){return new g(t(this.x,0),t(this.y,1))}toSymbol(){return g.symbol}toString(){return`Vector2(${this.x}, ${this.y})`}toArray(){return[this.x,this.y]}toUniform(t,e){t.uniform2f(e,this.x,this.y)}serialize(){return{x:this.x,y:this.y}}exactlyEquals(t){return this.x===t.x&&this.y===t.y}equals(t,e=Ze){return Math.abs(this.x-t.x)<=e+Number.EPSILON&&Math.abs(this.y-t.y)<=e+Number.EPSILON}*[Symbol.iterator](){yield this.x,yield this.y}}g.symbol=Symbol.for("@motion-canvas/core/types/Vector2");g.zero=new g;g.one=new g(1,1);g.right=new g(1,0);g.left=new g(-1,0);g.up=new g(0,1);g.down=new g(0,-1);g.top=new g(0,-1);g.bottom=new g(0,1);g.topLeft=new g(-1,-1);g.topRight=new g(1,-1);g.bottomLeft=new g(-1,1);g.bottomRight=new g(1,1);class V{static createSignal(t,e=V.lerp){return new Pr(["x","y","width","height"],r=>new V(r),t,e).toSignal()}static lerp(t,e,r){let i,a,h,u;return typeof r=="number"?i=a=h=u=r:r instanceof g?(i=h=r.x,a=u=r.y):(i=r.x,a=r.y,h=r.width,u=r.height),new V(tt(t.x,e.x,i),tt(t.y,e.y,a),tt(t.width,e.width,h),tt(t.height,e.height,u))}static arcLerp(t,e,r,i=!1,a){return a??(a=(t.position.sub(e.position).ctg+t.size.sub(e.size).ctg)/2),V.lerp(t,e,$i(r,i,a))}static fromSizeCentered(t){return new V(-t.width/2,-t.height/2,t.width,t.height)}static fromPoints(...t){let e=1/0,r=1/0,i=-1/0,a=-1/0;for(const h of t)h.x>i&&(i=h.x),h.xa&&(a=h.y),h.yi&&(i=u),h.xa&&(a=v),h.ye.transformAsPoint(t))}expand(t){const e=new At(t),r=new V(this);return r.left-=e.left,r.top-=e.top,r.right+=e.right,r.bottom+=e.bottom,r}addSpacing(t){return this.expand(t)}includes(t){return t.x>=this.x&&t.x<=this.x+this.width&&t.y>=this.y&&t.y<=this.y+this.height}intersects(t){return this.leftt.left&&this.topt.top}intersection(t){const e=new V;return this.intersects(t)&&(e.left=Math.max(this.left,t.left),e.top=Math.max(this.top,t.top),e.right=Math.min(this.right,t.right),e.bottom=Math.min(this.bottom,t.bottom)),e}union(t){const e=new V;return e.left=Math.min(this.left,t.left),e.top=Math.min(this.top,t.top),e.right=Math.max(this.right,t.right),e.bottom=Math.max(this.bottom,t.bottom),e}toSymbol(){return V.symbol}toString(){return`BBox(${this.x}, ${this.y}, ${this.width}, ${this.height})`}toUniform(t,e){t.uniform4f(e,this.x,this.y,this.width,this.height)}serialize(){return{x:this.x,y:this.y,width:this.width,height:this.height}}}V.symbol=Symbol.for("@motion-canvas/core/types/Rect");var iu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Oi={exports:{}};/** * chroma.js - JavaScript library for color conversions * * Copyright (c) 2011-2019, Gregor Aisch @@ -98,4 +98,17 @@ void main() { * http://www.w3.org/TR/css3-color/#svg-color * * @preserve - */(function(n,t){(function(e,r){n.exports=r()})(Vu,function(){for(var e=function(s,o,l){return o===void 0&&(o=0),l===void 0&&(l=1),sl?l:s},r=e,i=function(s){s._clipped=!1,s._unclipped=s.slice(0);for(var o=0;o<=3;o++)o<3?((s[o]<0||s[o]>255)&&(s._clipped=!0),s[o]=r(s[o],0,255)):o===3&&(s[o]=r(s[o],0,1));return s},a={},h=0,c=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];h=3?Array.prototype.slice.call(s):k(s[0])=="object"&&o?o.split("").filter(function(l){return s[0][l]!==void 0}).map(function(l){return s[0][l]}):s[0]},X=y,Q=function(s){if(s.length<2)return null;var o=s.length-1;return X(s[o])=="string"?s[o].toLowerCase():null},at=Math.PI,T={clip_rgb:i,limit:e,type:y,unpack:F,last:Q,PI:at,TWOPI:at*2,PITHIRD:at/3,DEG2RAD:at/180,RAD2DEG:180/at},st={format:{},autodetect:[]},Pt=T.last,nt=T.clip_rgb,Be=T.type,Ft=st,ks=function(){for(var o=[],l=arguments.length;l--;)o[l]=arguments[l];var u=this;if(Be(o[0])==="object"&&o[0].constructor&&o[0].constructor===this.constructor)return o[0];var d=Pt(o),p=!1;if(!d){p=!0,Ft.sorted||(Ft.autodetect=Ft.autodetect.sort(function(x,R){return R.p-x.p}),Ft.sorted=!0);for(var f=0,v=Ft.autodetect;f4?s[4]:1;return p===1?[0,0,0,f]:[l>=1?0:255*(1-l)*(1-p),u>=1?0:255*(1-u)*(1-p),d>=1?0:255*(1-d)*(1-p),f]},Bi=ji,Ni=ot,Ps=D,Rs=st,Wi=T.unpack,Ui=T.type,qi=_i;Ps.prototype.cmyk=function(){return qi(this._rgb)},Ni.cmyk=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(Ps,[null].concat(s,["cmyk"])))},Rs.format.cmyk=Bi,Rs.autodetect.push({p:2,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=Wi(s,"cmyk"),Ui(s)==="array"&&s.length===4)return"cmyk"}});var Gi=T.unpack,Xi=T.last,Rr=function(s){return Math.round(s*100)/100},Hi=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=Gi(s,"hsla"),u=Xi(s)||"lsa";return l[0]=Rr(l[0]||0),l[1]=Rr(l[1]*100)+"%",l[2]=Rr(l[2]*100)+"%",u==="hsla"||l.length>3&&l[3]<1?(l[3]=l.length>3?l[3]:1,u="hsla"):l.length=3,u+"("+l.join(",")+")"},Yi=Hi,Zi=T.unpack,Vi=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];s=Zi(s,"rgba");var l=s[0],u=s[1],d=s[2];l/=255,u/=255,d/=255;var p=Math.min(l,u,d),f=Math.max(l,u,d),v=(f+p)/2,b,w;return f===p?(b=0,w=Number.NaN):b=v<.5?(f-p)/(f+p):(f-p)/(2-f-p),l==f?w=(u-d)/(f-p):u==f?w=2+(d-l)/(f-p):d==f&&(w=4+(l-u)/(f-p)),w*=60,w<0&&(w+=360),s.length>3&&s[3]!==void 0?[w,b,v,s[3]]:[w,b,v]},Ms=Vi,Ji=T.unpack,Qi=T.last,Ki=Yi,ta=Ms,Mr=Math.round,ea=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=Ji(s,"rgba"),u=Qi(s)||"rgb";return u.substr(0,3)=="hsl"?Ki(ta(l),u):(l[0]=Mr(l[0]),l[1]=Mr(l[1]),l[2]=Mr(l[2]),(u==="rgba"||l.length>3&&l[3]<1)&&(l[3]=l.length>3?l[3]:1,u="rgba"),u+"("+l.slice(0,u==="rgb"?3:4).join(",")+")")},ra=ea,sa=T.unpack,$r=Math.round,na=function(){for(var s,o=[],l=arguments.length;l--;)o[l]=arguments[l];o=sa(o,"hsl");var u=o[0],d=o[1],p=o[2],f,v,b;if(d===0)f=v=b=p*255;else{var w=[0,0,0],x=[0,0,0],R=p<.5?p*(1+d):p+d-p*d,C=2*p-R,$=u/360;w[0]=$+1/3,w[1]=$,w[2]=$-1/3;for(var M=0;M<3;M++)w[M]<0&&(w[M]+=1),w[M]>1&&(w[M]-=1),6*w[M]<1?x[M]=C+(R-C)*6*w[M]:2*w[M]<1?x[M]=R:3*w[M]<2?x[M]=C+(R-C)*(2/3-w[M])*6:x[M]=C;s=[$r(x[0]*255),$r(x[1]*255),$r(x[2]*255)],f=s[0],v=s[1],b=s[2]}return o.length>3?[f,v,b,o[3]]:[f,v,b,1]},$s=na,Ls=$s,As=st,Os=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,zs=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,Is=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,Fs=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,Es=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,_s=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,Ds=Math.round,js=function(s){s=s.toLowerCase().trim();var o;if(As.format.named)try{return As.format.named(s)}catch{}if(o=s.match(Os)){for(var l=o.slice(1,4),u=0;u<3;u++)l[u]=+l[u];return l[3]=1,l}if(o=s.match(zs)){for(var d=o.slice(1,5),p=0;p<4;p++)d[p]=+d[p];return d}if(o=s.match(Is)){for(var f=o.slice(1,4),v=0;v<3;v++)f[v]=Ds(f[v]*2.55);return f[3]=1,f}if(o=s.match(Fs)){for(var b=o.slice(1,5),w=0;w<3;w++)b[w]=Ds(b[w]*2.55);return b[3]=+b[3],b}if(o=s.match(Es)){var x=o.slice(1,4);x[1]*=.01,x[2]*=.01;var R=Ls(x);return R[3]=1,R}if(o=s.match(_s)){var C=o.slice(1,4);C[1]*=.01,C[2]*=.01;var $=Ls(C);return $[3]=+o[4],$}};js.test=function(s){return Os.test(s)||zs.test(s)||Is.test(s)||Fs.test(s)||Es.test(s)||_s.test(s)};var ia=js,aa=ot,Bs=D,Ns=st,oa=T.type,la=ra,Ws=ia;Bs.prototype.css=function(s){return la(this._rgb,s)},aa.css=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(Bs,[null].concat(s,["css"])))},Ns.format.css=Ws,Ns.autodetect.push({p:5,test:function(s){for(var o=[],l=arguments.length-1;l-- >0;)o[l]=arguments[l+1];if(!o.length&&oa(s)==="string"&&Ws.test(s))return"css"}});var Us=D,ha=ot,ua=st,ca=T.unpack;ua.format.gl=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=ca(s,"rgba");return l[0]*=255,l[1]*=255,l[2]*=255,l},ha.gl=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(Us,[null].concat(s,["gl"])))},Us.prototype.gl=function(){var s=this._rgb;return[s[0]/255,s[1]/255,s[2]/255,s[3]]};var fa=T.unpack,da=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=fa(s,"rgb"),u=l[0],d=l[1],p=l[2],f=Math.min(u,d,p),v=Math.max(u,d,p),b=v-f,w=b*100/255,x=f/(255-b)*100,R;return b===0?R=Number.NaN:(u===v&&(R=(d-p)/b),d===v&&(R=2+(p-u)/b),p===v&&(R=4+(u-d)/b),R*=60,R<0&&(R+=360)),[R,w,x]},pa=da,ga=T.unpack,va=Math.floor,ma=function(){for(var s,o,l,u,d,p,f=[],v=arguments.length;v--;)f[v]=arguments[v];f=ga(f,"hcg");var b=f[0],w=f[1],x=f[2],R,C,$;x=x*255;var M=w*255;if(w===0)R=C=$=x;else{b===360&&(b=0),b>360&&(b-=360),b<0&&(b+=360),b/=60;var j=va(b),W=b-j,q=x*(1-w),H=q+M*(1-W),dt=q+M*W,ft=q+M;switch(j){case 0:s=[ft,dt,q],R=s[0],C=s[1],$=s[2];break;case 1:o=[H,ft,q],R=o[0],C=o[1],$=o[2];break;case 2:l=[q,ft,dt],R=l[0],C=l[1],$=l[2];break;case 3:u=[q,H,ft],R=u[0],C=u[1],$=u[2];break;case 4:d=[dt,q,ft],R=d[0],C=d[1],$=d[2];break;case 5:p=[ft,q,H],R=p[0],C=p[1],$=p[2];break}}return[R,C,$,f.length>3?f[3]:1]},ba=ma,ya=T.unpack,wa=T.type,xa=ot,qs=D,Gs=st,Ca=pa;qs.prototype.hcg=function(){return Ca(this._rgb)},xa.hcg=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(qs,[null].concat(s,["hcg"])))},Gs.format.hcg=ba,Gs.autodetect.push({p:1,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=ya(s,"hcg"),wa(s)==="array"&&s.length===3)return"hcg"}});var Sa=T.unpack,ka=T.last,ir=Math.round,Ta=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=Sa(s,"rgba"),u=l[0],d=l[1],p=l[2],f=l[3],v=ka(s)||"auto";f===void 0&&(f=1),v==="auto"&&(v=f<1?"rgba":"rgb"),u=ir(u),d=ir(d),p=ir(p);var b=u<<16|d<<8|p,w="000000"+b.toString(16);w=w.substr(w.length-6);var x="0"+ir(f*255).toString(16);switch(x=x.substr(x.length-2),v.toLowerCase()){case"rgba":return"#"+w+x;case"argb":return"#"+x+w;default:return"#"+w}},Xs=Ta,Pa=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,Ra=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,Ma=function(s){if(s.match(Pa)){(s.length===4||s.length===7)&&(s=s.substr(1)),s.length===3&&(s=s.split(""),s=s[0]+s[0]+s[1]+s[1]+s[2]+s[2]);var o=parseInt(s,16),l=o>>16,u=o>>8&255,d=o&255;return[l,u,d,1]}if(s.match(Ra)){(s.length===5||s.length===9)&&(s=s.substr(1)),s.length===4&&(s=s.split(""),s=s[0]+s[0]+s[1]+s[1]+s[2]+s[2]+s[3]+s[3]);var p=parseInt(s,16),f=p>>24&255,v=p>>16&255,b=p>>8&255,w=Math.round((p&255)/255*100)/100;return[f,v,b,w]}throw new Error("unknown hex color: "+s)},Hs=Ma,$a=ot,Ys=D,La=T.type,Zs=st,Aa=Xs;Ys.prototype.hex=function(s){return Aa(this._rgb,s)},$a.hex=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(Ys,[null].concat(s,["hex"])))},Zs.format.hex=Hs,Zs.autodetect.push({p:4,test:function(s){for(var o=[],l=arguments.length-1;l-- >0;)o[l]=arguments[l+1];if(!o.length&&La(s)==="string"&&[3,4,5,6,7,8,9].indexOf(s.length)>=0)return"hex"}});var Oa=T.unpack,Vs=T.TWOPI,za=Math.min,Ia=Math.sqrt,Fa=Math.acos,Ea=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=Oa(s,"rgb"),u=l[0],d=l[1],p=l[2];u/=255,d/=255,p/=255;var f,v=za(u,d,p),b=(u+d+p)/3,w=b>0?1-v/b:0;return w===0?f=NaN:(f=(u-d+(u-p))/2,f/=Ia((u-d)*(u-d)+(u-p)*(d-p)),f=Fa(f),p>d&&(f=Vs-f),f/=Vs),[f*360,w,b]},_a=Ea,Da=T.unpack,Lr=T.limit,Se=T.TWOPI,Ar=T.PITHIRD,ke=Math.cos,ja=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];s=Da(s,"hsi");var l=s[0],u=s[1],d=s[2],p,f,v;return isNaN(l)&&(l=0),isNaN(u)&&(u=0),l>360&&(l-=360),l<0&&(l+=360),l/=360,l<1/3?(v=(1-u)/3,p=(1+u*ke(Se*l)/ke(Ar-Se*l))/3,f=1-(v+p)):l<2/3?(l-=1/3,p=(1-u)/3,f=(1+u*ke(Se*l)/ke(Ar-Se*l))/3,v=1-(p+f)):(l-=2/3,f=(1-u)/3,v=(1+u*ke(Se*l)/ke(Ar-Se*l))/3,p=1-(f+v)),p=Lr(d*p*3),f=Lr(d*f*3),v=Lr(d*v*3),[p*255,f*255,v*255,s.length>3?s[3]:1]},Ba=ja,Na=T.unpack,Wa=T.type,Ua=ot,Js=D,Qs=st,qa=_a;Js.prototype.hsi=function(){return qa(this._rgb)},Ua.hsi=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(Js,[null].concat(s,["hsi"])))},Qs.format.hsi=Ba,Qs.autodetect.push({p:2,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=Na(s,"hsi"),Wa(s)==="array"&&s.length===3)return"hsi"}});var Ga=T.unpack,Xa=T.type,Ha=ot,Ks=D,tn=st,Ya=Ms;Ks.prototype.hsl=function(){return Ya(this._rgb)},Ha.hsl=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(Ks,[null].concat(s,["hsl"])))},tn.format.hsl=$s,tn.autodetect.push({p:2,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=Ga(s,"hsl"),Xa(s)==="array"&&s.length===3)return"hsl"}});var Za=T.unpack,Va=Math.min,Ja=Math.max,Qa=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];s=Za(s,"rgb");var l=s[0],u=s[1],d=s[2],p=Va(l,u,d),f=Ja(l,u,d),v=f-p,b,w,x;return x=f/255,f===0?(b=Number.NaN,w=0):(w=v/f,l===f&&(b=(u-d)/v),u===f&&(b=2+(d-l)/v),d===f&&(b=4+(l-u)/v),b*=60,b<0&&(b+=360)),[b,w,x]},Ka=Qa,to=T.unpack,eo=Math.floor,ro=function(){for(var s,o,l,u,d,p,f=[],v=arguments.length;v--;)f[v]=arguments[v];f=to(f,"hsv");var b=f[0],w=f[1],x=f[2],R,C,$;if(x*=255,w===0)R=C=$=x;else{b===360&&(b=0),b>360&&(b-=360),b<0&&(b+=360),b/=60;var M=eo(b),j=b-M,W=x*(1-w),q=x*(1-w*j),H=x*(1-w*(1-j));switch(M){case 0:s=[x,H,W],R=s[0],C=s[1],$=s[2];break;case 1:o=[q,x,W],R=o[0],C=o[1],$=o[2];break;case 2:l=[W,x,H],R=l[0],C=l[1],$=l[2];break;case 3:u=[W,q,x],R=u[0],C=u[1],$=u[2];break;case 4:d=[H,W,x],R=d[0],C=d[1],$=d[2];break;case 5:p=[x,W,q],R=p[0],C=p[1],$=p[2];break}}return[R,C,$,f.length>3?f[3]:1]},so=ro,no=T.unpack,io=T.type,ao=ot,en=D,rn=st,oo=Ka;en.prototype.hsv=function(){return oo(this._rgb)},ao.hsv=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(en,[null].concat(s,["hsv"])))},rn.format.hsv=so,rn.autodetect.push({p:2,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=no(s,"hsv"),io(s)==="array"&&s.length===3)return"hsv"}});var ar={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},Te=ar,lo=T.unpack,sn=Math.pow,ho=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=lo(s,"rgb"),u=l[0],d=l[1],p=l[2],f=uo(u,d,p),v=f[0],b=f[1],w=f[2],x=116*b-16;return[x<0?0:x,500*(v-b),200*(b-w)]},Or=function(s){return(s/=255)<=.04045?s/12.92:sn((s+.055)/1.055,2.4)},zr=function(s){return s>Te.t3?sn(s,1/3):s/Te.t2+Te.t0},uo=function(s,o,l){s=Or(s),o=Or(o),l=Or(l);var u=zr((.4124564*s+.3575761*o+.1804375*l)/Te.Xn),d=zr((.2126729*s+.7151522*o+.072175*l)/Te.Yn),p=zr((.0193339*s+.119192*o+.9503041*l)/Te.Zn);return[u,d,p]},nn=ho,Pe=ar,co=T.unpack,fo=Math.pow,po=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];s=co(s,"lab");var l=s[0],u=s[1],d=s[2],p,f,v,b,w,x;return f=(l+16)/116,p=isNaN(u)?f:f+u/500,v=isNaN(d)?f:f-d/200,f=Pe.Yn*Fr(f),p=Pe.Xn*Fr(p),v=Pe.Zn*Fr(v),b=Ir(3.2404542*p-1.5371385*f-.4985314*v),w=Ir(-.969266*p+1.8760108*f+.041556*v),x=Ir(.0556434*p-.2040259*f+1.0572252*v),[b,w,x,s.length>3?s[3]:1]},Ir=function(s){return 255*(s<=.00304?12.92*s:1.055*fo(s,1/2.4)-.055)},Fr=function(s){return s>Pe.t1?s*s*s:Pe.t2*(s-Pe.t0)},an=po,go=T.unpack,vo=T.type,mo=ot,on=D,ln=st,bo=nn;on.prototype.lab=function(){return bo(this._rgb)},mo.lab=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(on,[null].concat(s,["lab"])))},ln.format.lab=an,ln.autodetect.push({p:2,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=go(s,"lab"),vo(s)==="array"&&s.length===3)return"lab"}});var yo=T.unpack,wo=T.RAD2DEG,xo=Math.sqrt,Co=Math.atan2,So=Math.round,ko=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=yo(s,"lab"),u=l[0],d=l[1],p=l[2],f=xo(d*d+p*p),v=(Co(p,d)*wo+360)%360;return So(f*1e4)===0&&(v=Number.NaN),[u,f,v]},hn=ko,To=T.unpack,Po=nn,Ro=hn,Mo=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=To(s,"rgb"),u=l[0],d=l[1],p=l[2],f=Po(u,d,p),v=f[0],b=f[1],w=f[2];return Ro(v,b,w)},$o=Mo,Lo=T.unpack,Ao=T.DEG2RAD,Oo=Math.sin,zo=Math.cos,Io=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=Lo(s,"lch"),u=l[0],d=l[1],p=l[2];return isNaN(p)&&(p=0),p=p*Ao,[u,zo(p)*d,Oo(p)*d]},un=Io,Fo=T.unpack,Eo=un,_o=an,Do=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];s=Fo(s,"lch");var l=s[0],u=s[1],d=s[2],p=Eo(l,u,d),f=p[0],v=p[1],b=p[2],w=_o(f,v,b),x=w[0],R=w[1],C=w[2];return[x,R,C,s.length>3?s[3]:1]},cn=Do,jo=T.unpack,Bo=cn,No=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=jo(s,"hcl").reverse();return Bo.apply(void 0,l)},Wo=No,Uo=T.unpack,qo=T.type,fn=ot,or=D,Er=st,dn=$o;or.prototype.lch=function(){return dn(this._rgb)},or.prototype.hcl=function(){return dn(this._rgb).reverse()},fn.lch=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(or,[null].concat(s,["lch"])))},fn.hcl=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(or,[null].concat(s,["hcl"])))},Er.format.lch=cn,Er.format.hcl=Wo,["lch","hcl"].forEach(function(s){return Er.autodetect.push({p:2,test:function(){for(var o=[],l=arguments.length;l--;)o[l]=arguments[l];if(o=Uo(o,s),qo(o)==="array"&&o.length===3)return s}})});var Go={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflower:"#6495ed",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},pn=Go,Xo=D,gn=st,Ho=T.type,Ne=pn,Yo=Hs,Zo=Xs;Xo.prototype.name=function(){for(var s=Zo(this._rgb,"rgb"),o=0,l=Object.keys(Ne);o0;)o[l]=arguments[l+1];if(!o.length&&Ho(s)==="string"&&Ne[s.toLowerCase()])return"named"}});var Vo=T.unpack,Jo=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=Vo(s,"rgb"),u=l[0],d=l[1],p=l[2];return(u<<16)+(d<<8)+p},Qo=Jo,Ko=T.type,tl=function(s){if(Ko(s)=="number"&&s>=0&&s<=16777215){var o=s>>16,l=s>>8&255,u=s&255;return[o,l,u,1]}throw new Error("unknown num color: "+s)},el=tl,rl=ot,vn=D,mn=st,sl=T.type,nl=Qo;vn.prototype.num=function(){return nl(this._rgb)},rl.num=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(vn,[null].concat(s,["num"])))},mn.format.num=el,mn.autodetect.push({p:5,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s.length===1&&sl(s[0])==="number"&&s[0]>=0&&s[0]<=16777215)return"num"}});var il=ot,_r=D,bn=st,yn=T.unpack,wn=T.type,xn=Math.round;_r.prototype.rgb=function(s){return s===void 0&&(s=!0),s===!1?this._rgb.slice(0,3):this._rgb.slice(0,3).map(xn)},_r.prototype.rgba=function(s){return s===void 0&&(s=!0),this._rgb.slice(0,4).map(function(o,l){return l<3?s===!1?o:xn(o):o})},il.rgb=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(_r,[null].concat(s,["rgb"])))},bn.format.rgb=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=yn(s,"rgba");return l[3]===void 0&&(l[3]=1),l},bn.autodetect.push({p:3,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=yn(s,"rgba"),wn(s)==="array"&&(s.length===3||s.length===4&&wn(s[3])=="number"&&s[3]>=0&&s[3]<=1))return"rgb"}});var lr=Math.log,al=function(s){var o=s/100,l,u,d;return o<66?(l=255,u=o<6?0:-155.25485562709179-.44596950469579133*(u=o-2)+104.49216199393888*lr(u),d=o<20?0:-254.76935184120902+.8274096064007395*(d=o-10)+115.67994401066147*lr(d)):(l=351.97690566805693+.114206453784165*(l=o-55)-40.25366309332127*lr(l),u=325.4494125711974+.07943456536662342*(u=o-50)-28.0852963507957*lr(u),d=255),[l,u,d,1]},Cn=al,ol=Cn,ll=T.unpack,hl=Math.round,ul=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];for(var l=ll(s,"rgb"),u=l[0],d=l[2],p=1e3,f=4e4,v=.4,b;f-p>v;){b=(f+p)*.5;var w=ol(b);w[2]/w[0]>=d/u?f=b:p=b}return hl(b)},cl=ul,Dr=ot,hr=D,jr=st,fl=cl;hr.prototype.temp=hr.prototype.kelvin=hr.prototype.temperature=function(){return fl(this._rgb)},Dr.temp=Dr.kelvin=Dr.temperature=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(hr,[null].concat(s,["temp"])))},jr.format.temp=jr.format.kelvin=jr.format.temperature=Cn;var dl=T.unpack,Br=Math.cbrt,pl=Math.pow,gl=Math.sign,vl=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=dl(s,"rgb"),u=l[0],d=l[1],p=l[2],f=[Nr(u/255),Nr(d/255),Nr(p/255)],v=f[0],b=f[1],w=f[2],x=Br(.4122214708*v+.5363325363*b+.0514459929*w),R=Br(.2119034982*v+.6806995451*b+.1073969566*w),C=Br(.0883024619*v+.2817188376*b+.6299787005*w);return[.2104542553*x+.793617785*R-.0040720468*C,1.9779984951*x-2.428592205*R+.4505937099*C,.0259040371*x+.7827717662*R-.808675766*C]},Sn=vl;function Nr(s){var o=Math.abs(s);return o<.04045?s/12.92:(gl(s)||1)*pl((o+.055)/1.055,2.4)}var ml=T.unpack,ur=Math.pow,bl=Math.sign,yl=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];s=ml(s,"lab");var l=s[0],u=s[1],d=s[2],p=ur(l+.3963377774*u+.2158037573*d,3),f=ur(l-.1055613458*u-.0638541728*d,3),v=ur(l-.0894841775*u-1.291485548*d,3);return[255*Wr(4.0767416621*p-3.3077115913*f+.2309699292*v),255*Wr(-1.2684380046*p+2.6097574011*f-.3413193965*v),255*Wr(-.0041960863*p-.7034186147*f+1.707614701*v),s.length>3?s[3]:1]},kn=yl;function Wr(s){var o=Math.abs(s);return o>.0031308?(bl(s)||1)*(1.055*ur(o,1/2.4)-.055):s*12.92}var wl=T.unpack,xl=T.type,Cl=ot,Tn=D,Pn=st,Sl=Sn;Tn.prototype.oklab=function(){return Sl(this._rgb)},Cl.oklab=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(Tn,[null].concat(s,["oklab"])))},Pn.format.oklab=kn,Pn.autodetect.push({p:3,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=wl(s,"oklab"),xl(s)==="array"&&s.length===3)return"oklab"}});var kl=T.unpack,Tl=Sn,Pl=hn,Rl=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=kl(s,"rgb"),u=l[0],d=l[1],p=l[2],f=Tl(u,d,p),v=f[0],b=f[1],w=f[2];return Pl(v,b,w)},Ml=Rl,$l=T.unpack,Ll=un,Al=kn,Ol=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];s=$l(s,"lch");var l=s[0],u=s[1],d=s[2],p=Ll(l,u,d),f=p[0],v=p[1],b=p[2],w=Al(f,v,b),x=w[0],R=w[1],C=w[2];return[x,R,C,s.length>3?s[3]:1]},zl=Ol,Il=T.unpack,Fl=T.type,El=ot,Rn=D,Mn=st,_l=Ml;Rn.prototype.oklch=function(){return _l(this._rgb)},El.oklch=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(Rn,[null].concat(s,["oklch"])))},Mn.format.oklch=zl,Mn.autodetect.push({p:3,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=Il(s,"oklch"),Fl(s)==="array"&&s.length===3)return"oklch"}});var $n=D,Dl=T.type;$n.prototype.alpha=function(s,o){return o===void 0&&(o=!1),s!==void 0&&Dl(s)==="number"?o?(this._rgb[3]=s,this):new $n([this._rgb[0],this._rgb[1],this._rgb[2],s],"rgb"):this._rgb[3]};var jl=D;jl.prototype.clipped=function(){return this._rgb._clipped||!1};var ue=D,Bl=ar;ue.prototype.darken=function(s){s===void 0&&(s=1);var o=this,l=o.lab();return l[0]-=Bl.Kn*s,new ue(l,"lab").alpha(o.alpha(),!0)},ue.prototype.brighten=function(s){return s===void 0&&(s=1),this.darken(-s)},ue.prototype.darker=ue.prototype.darken,ue.prototype.brighter=ue.prototype.brighten;var Nl=D;Nl.prototype.get=function(s){var o=s.split("."),l=o[0],u=o[1],d=this[l]();if(u){var p=l.indexOf(u)-(l.substr(0,2)==="ok"?2:0);if(p>-1)return d[p];throw new Error("unknown channel "+u+" in mode "+l)}else return d};var Re=D,Wl=T.type,Ul=Math.pow,ql=1e-7,Gl=20;Re.prototype.luminance=function(s){if(s!==void 0&&Wl(s)==="number"){if(s===0)return new Re([0,0,0,this._rgb[3]],"rgb");if(s===1)return new Re([255,255,255,this._rgb[3]],"rgb");var o=this.luminance(),l="rgb",u=Gl,d=function(f,v){var b=f.interpolate(v,.5,l),w=b.luminance();return Math.abs(s-w)s?d(f,b):d(b,v)},p=(o>s?d(new Re([0,0,0]),this):d(this,new Re([255,255,255]))).rgb();return new Re(p.concat([this._rgb[3]]))}return Xl.apply(void 0,this._rgb.slice(0,3))};var Xl=function(s,o,l){return s=Ur(s),o=Ur(o),l=Ur(l),.2126*s+.7152*o+.0722*l},Ur=function(s){return s/=255,s<=.03928?s/12.92:Ul((s+.055)/1.055,2.4)},St={},Ln=D,An=T.type,cr=St,On=function(s,o,l){l===void 0&&(l=.5);for(var u=[],d=arguments.length-3;d-- >0;)u[d]=arguments[d+3];var p=u[0]||"lrgb";if(!cr[p]&&!u.length&&(p=Object.keys(cr)[0]),!cr[p])throw new Error("interpolation mode "+p+" is not defined");return An(s)!=="object"&&(s=new Ln(s)),An(o)!=="object"&&(o=new Ln(o)),cr[p](s,o,l).alpha(s.alpha()+l*(o.alpha()-s.alpha()))},zn=D,Hl=On;zn.prototype.mix=zn.prototype.interpolate=function(s,o){o===void 0&&(o=.5);for(var l=[],u=arguments.length-2;u-- >0;)l[u]=arguments[u+2];return Hl.apply(void 0,[this,s,o].concat(l))};var In=D;In.prototype.premultiply=function(s){s===void 0&&(s=!1);var o=this._rgb,l=o[3];return s?(this._rgb=[o[0]*l,o[1]*l,o[2]*l,l],this):new In([o[0]*l,o[1]*l,o[2]*l,l],"rgb")};var qr=D,Yl=ar;qr.prototype.saturate=function(s){s===void 0&&(s=1);var o=this,l=o.lch();return l[1]+=Yl.Kn*s,l[1]<0&&(l[1]=0),new qr(l,"lch").alpha(o.alpha(),!0)},qr.prototype.desaturate=function(s){return s===void 0&&(s=1),this.saturate(-s)};var Fn=D,En=T.type;Fn.prototype.set=function(s,o,l){l===void 0&&(l=!1);var u=s.split("."),d=u[0],p=u[1],f=this[d]();if(p){var v=d.indexOf(p)-(d.substr(0,2)==="ok"?2:0);if(v>-1){if(En(o)=="string")switch(o.charAt(0)){case"+":f[v]+=+o;break;case"-":f[v]+=+o;break;case"*":f[v]*=+o.substr(1);break;case"/":f[v]/=+o.substr(1);break;default:f[v]=+o}else if(En(o)==="number")f[v]=o;else throw new Error("unsupported value for Color.set");var b=new Fn(f,d);return l?(this._rgb=b._rgb,this):b}throw new Error("unknown channel "+p+" in mode "+d)}else return f};var Zl=D,Vl=function(s,o,l){var u=s._rgb,d=o._rgb;return new Zl(u[0]+l*(d[0]-u[0]),u[1]+l*(d[1]-u[1]),u[2]+l*(d[2]-u[2]),"rgb")};St.rgb=Vl;var Jl=D,Gr=Math.sqrt,Me=Math.pow,Ql=function(s,o,l){var u=s._rgb,d=u[0],p=u[1],f=u[2],v=o._rgb,b=v[0],w=v[1],x=v[2];return new Jl(Gr(Me(d,2)*(1-l)+Me(b,2)*l),Gr(Me(p,2)*(1-l)+Me(w,2)*l),Gr(Me(f,2)*(1-l)+Me(x,2)*l),"rgb")};St.lrgb=Ql;var Kl=D,th=function(s,o,l){var u=s.lab(),d=o.lab();return new Kl(u[0]+l*(d[0]-u[0]),u[1]+l*(d[1]-u[1]),u[2]+l*(d[2]-u[2]),"lab")};St.lab=th;var _n=D,$e=function(s,o,l,u){var d,p,f,v;u==="hsl"?(f=s.hsl(),v=o.hsl()):u==="hsv"?(f=s.hsv(),v=o.hsv()):u==="hcg"?(f=s.hcg(),v=o.hcg()):u==="hsi"?(f=s.hsi(),v=o.hsi()):u==="lch"||u==="hcl"?(u="hcl",f=s.hcl(),v=o.hcl()):u==="oklch"&&(f=s.oklch().reverse(),v=o.oklch().reverse());var b,w,x,R,C,$;(u.substr(0,1)==="h"||u==="oklch")&&(d=f,b=d[0],x=d[1],C=d[2],p=v,w=p[0],R=p[1],$=p[2]);var M,j,W,q;return!isNaN(b)&&!isNaN(w)?(w>b&&w-b>180?q=w-(b+360):w180?q=w+360-b:q=w-b,j=b+l*q):isNaN(b)?isNaN(w)?j=Number.NaN:(j=w,(C==1||C==0)&&u!="hsv"&&(M=R)):(j=b,($==1||$==0)&&u!="hsv"&&(M=x)),M===void 0&&(M=x+l*(R-x)),W=C+l*($-C),u==="oklch"?new _n([W,M,j],u):new _n([j,M,W],u)},eh=$e,Dn=function(s,o,l){return eh(s,o,l,"lch")};St.lch=Dn,St.hcl=Dn;var rh=D,sh=function(s,o,l){var u=s.num(),d=o.num();return new rh(u+l*(d-u),"num")};St.num=sh;var nh=$e,ih=function(s,o,l){return nh(s,o,l,"hcg")};St.hcg=ih;var ah=$e,oh=function(s,o,l){return ah(s,o,l,"hsi")};St.hsi=oh;var lh=$e,hh=function(s,o,l){return lh(s,o,l,"hsl")};St.hsl=hh;var uh=$e,ch=function(s,o,l){return uh(s,o,l,"hsv")};St.hsv=ch;var fh=D,dh=function(s,o,l){var u=s.oklab(),d=o.oklab();return new fh(u[0]+l*(d[0]-u[0]),u[1]+l*(d[1]-u[1]),u[2]+l*(d[2]-u[2]),"oklab")};St.oklab=dh;var ph=$e,gh=function(s,o,l){return ph(s,o,l,"oklch")};St.oklch=gh;var Xr=D,vh=T.clip_rgb,Hr=Math.pow,Yr=Math.sqrt,Zr=Math.PI,jn=Math.cos,Bn=Math.sin,mh=Math.atan2,bh=function(s,o,l){o===void 0&&(o="lrgb"),l===void 0&&(l=null);var u=s.length;l||(l=Array.from(new Array(u)).map(function(){return 1}));var d=u/l.reduce(function(j,W){return j+W});if(l.forEach(function(j,W){l[W]*=d}),s=s.map(function(j){return new Xr(j)}),o==="lrgb")return yh(s,l);for(var p=s.shift(),f=p.get(o),v=[],b=0,w=0,x=0;x=360;)M-=360;f[$]=M}else f[$]=f[$]/v[$];return C/=u,new Xr(f,o).alpha(C>.99999?1:C,!0)},yh=function(s,o){for(var l=s.length,u=[0,0,0,0],d=0;d.9999999&&(u[3]=1),new Xr(vh(u))},Rt=ot,Le=T.type,wh=Math.pow,Vr=function(s){var o="rgb",l=Rt("#ccc"),u=0,d=[0,1],p=[],f=[0,0],v=!1,b=[],w=!1,x=0,R=1,C=!1,$={},M=!0,j=1,W=function(S){if(S=S||["#fff","#000"],S&&Le(S)==="string"&&Rt.brewer&&Rt.brewer[S.toLowerCase()]&&(S=Rt.brewer[S.toLowerCase()]),Le(S)==="array"){S.length===1&&(S=[S[0],S[0]]),S=S.slice(0);for(var z=0;z=v[N];)N++;return N-1}return 0},H=function(S){return S},dt=function(S){return S},ft=function(S,z){var N,B;if(z==null&&(z=!1),isNaN(S)||S===null)return l;if(z)B=S;else if(v&&v.length>2){var pt=q(S);B=pt/(v.length-2)}else R!==x?B=(S-x)/(R-x):B=1;B=dt(B),z||(B=H(B)),j!==1&&(B=wh(B,j)),B=f[0]+B*(1-f[0]-f[1]),B=Math.min(1,Math.max(0,B));var K=Math.floor(B*1e4);if(M&&$[K])N=$[K];else{if(Le(b)==="array")for(var G=0;G=Z&&G===p.length-1){N=b[G];break}if(B>Z&&B2){var G=S.map(function(V,J){return J/(S.length-1)}),Z=S.map(function(V){return(V-x)/(R-x)});Z.every(function(V,J){return G[J]===V})||(dt=function(V){if(V<=0||V>=1)return V;for(var J=0;V>=Z[J+1];)J++;var $t=(V-Z[J])/(Z[J+1]-Z[J]),Jt=G[J]+$t*(G[J+1]-G[J]);return Jt})}}return d=[x,R],U},U.mode=function(S){return arguments.length?(o=S,yt(),U):o},U.range=function(S,z){return W(S),U},U.out=function(S){return w=S,U},U.spread=function(S){return arguments.length?(u=S,U):u},U.correctLightness=function(S){return S==null&&(S=!0),C=S,yt(),C?H=function(z){for(var N=ft(0,!0).lab()[0],B=ft(1,!0).lab()[0],pt=N>B,K=ft(z,!0).lab()[0],G=N+(B-N)*z,Z=K-G,V=0,J=1,$t=20;Math.abs(Z)>.01&&$t-- >0;)(function(){return pt&&(Z*=-1),Z<0?(V=z,z+=(J-z)*.5):(J=z,z+=(V-z)*.5),K=ft(z,!0).lab()[0],Z=K-G})();return z}:H=function(z){return z},U},U.padding=function(S){return S!=null?(Le(S)==="number"&&(S=[S,S]),f=S,U):f},U.colors=function(S,z){arguments.length<2&&(z="hex");var N=[];if(arguments.length===0)N=b.slice(0);else if(S===1)N=[U(.5)];else if(S>1){var B=d[0],pt=d[1]-B;N=xh(0,S,!1).map(function(J){return U(B+J/(S-1)*pt)})}else{s=[];var K=[];if(v&&v.length>2)for(var G=1,Z=v.length,V=1<=Z;V?GZ;V?G++:G--)K.push((v[G-1]+v[G])*.5);else K=d;N=K.map(function(J){return U(J)})}return Rt[z]&&(N=N.map(function(J){return J[z]()})),N},U.cache=function(S){return S!=null?(M=S,U):M},U.gamma=function(S){return S!=null?(j=S,U):j},U.nodata=function(S){return S!=null?(l=Rt(S),U):l},U};function xh(s,o,l){for(var u=[],d=sp;d?f++:f--)u.push(f);return u}var We=D,Ch=Vr,Sh=function(s){for(var o=[1,1],l=1;l=5){var w,x,R;w=s.map(function(C){return C.lab()}),R=s.length-1,x=Sh(R),d=function(C){var $=1-C,M=[0,1,2].map(function(j){return w.reduce(function(W,q,H){return W+x[H]*Math.pow($,R-H)*Math.pow(C,H)*q[j]},0)});return new We(M,"lab")}}else throw new RangeError("No point in running bezier with only one color.");return d},Th=function(s){var o=kh(s);return o.scale=function(){return Ch(o)},o},Jr=ot,Mt=function(s,o,l){if(!Mt[l])throw new Error("unknown blend mode "+l);return Mt[l](s,o)},Zt=function(s){return function(o,l){var u=Jr(l).rgb(),d=Jr(o).rgb();return Jr.rgb(s(u,d))}},Vt=function(s){return function(o,l){var u=[];return u[0]=s(o[0],l[0]),u[1]=s(o[1],l[1]),u[2]=s(o[2],l[2]),u}},Ph=function(s){return s},Rh=function(s,o){return s*o/255},Mh=function(s,o){return s>o?o:s},$h=function(s,o){return s>o?s:o},Lh=function(s,o){return 255*(1-(1-s/255)*(1-o/255))},Ah=function(s,o){return o<128?2*s*o/255:255*(1-2*(1-s/255)*(1-o/255))},Oh=function(s,o){return 255*(1-(1-o/255)/(s/255))},zh=function(s,o){return s===255?255:(s=255*(o/255)/(1-s/255),s>255?255:s)};Mt.normal=Zt(Vt(Ph)),Mt.multiply=Zt(Vt(Rh)),Mt.screen=Zt(Vt(Lh)),Mt.overlay=Zt(Vt(Ah)),Mt.darken=Zt(Vt(Mh)),Mt.lighten=Zt(Vt($h)),Mt.dodge=Zt(Vt(zh)),Mt.burn=Zt(Vt(Oh));for(var Ih=Mt,Qr=T.type,Fh=T.clip_rgb,Eh=T.TWOPI,_h=Math.pow,Dh=Math.sin,jh=Math.cos,Nn=ot,Bh=function(s,o,l,u,d){s===void 0&&(s=300),o===void 0&&(o=-1.5),l===void 0&&(l=1),u===void 0&&(u=1),d===void 0&&(d=[0,1]);var p=0,f;Qr(d)==="array"?f=d[1]-d[0]:(f=0,d=[d,d]);var v=function(b){var w=Eh*((s+120)/360+o*b),x=_h(d[0]+f*b,u),R=p!==0?l[0]+b*p:l,C=R*x*(1-x)/2,$=jh(w),M=Dh(w),j=x+C*(-.14861*$+1.78277*M),W=x+C*(-.29227*$-.90649*M),q=x+C*(1.97294*$);return Nn(Fh([j*255,W*255,q*255,1]))};return v.start=function(b){return b==null?s:(s=b,v)},v.rotations=function(b){return b==null?o:(o=b,v)},v.gamma=function(b){return b==null?u:(u=b,v)},v.hue=function(b){return b==null?l:(l=b,Qr(l)==="array"?(p=l[1]-l[0],p===0&&(l=l[1])):p=0,v)},v.lightness=function(b){return b==null?d:(Qr(b)==="array"?(d=b,f=b[1]-b[0]):(d=[b,b],f=0),v)},v.scale=function(){return Nn.scale(v)},v.hue(l),v},Nh=D,Wh="0123456789abcdef",Uh=Math.floor,qh=Math.random,Gh=function(){for(var s="#",o=0;o<6;o++)s+=Wh.charAt(Uh(qh()*16));return new Nh(s,"hex")},Kr=y,Wn=Math.log,Xh=Math.pow,Hh=Math.floor,Yh=Math.abs,Un=function(s,o){o===void 0&&(o=null);var l={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return Kr(s)==="object"&&(s=Object.values(s)),s.forEach(function(u){o&&Kr(u)==="object"&&(u=u[o]),u!=null&&!isNaN(u)&&(l.values.push(u),l.sum+=u,ul.max&&(l.max=u),l.count+=1)}),l.domain=[l.min,l.max],l.limits=function(u,d){return qn(l,u,d)},l},qn=function(s,o,l){o===void 0&&(o="equal"),l===void 0&&(l=7),Kr(s)=="array"&&(s=Un(s));var u=s.min,d=s.max,p=s.values.sort(function(es,rs){return es-rs});if(l===1)return[u,d];var f=[];if(o.substr(0,1)==="c"&&(f.push(u),f.push(d)),o.substr(0,1)==="e"){f.push(u);for(var v=1;v 0");var b=Math.LOG10E*Wn(u),w=Math.LOG10E*Wn(d);f.push(u);for(var x=1;x200&&(dt=!1)}for(var Qt={},Ae=0;Aeu?(l+.05)/(u+.05):(u+.05)/(l+.05)},Hn=D,Bt=Math.sqrt,lt=Math.pow,Vh=Math.min,Jh=Math.max,Yn=Math.atan2,Zn=Math.abs,fr=Math.cos,Vn=Math.sin,Qh=Math.exp,Jn=Math.PI,Kh=function(s,o,l,u,d){l===void 0&&(l=1),u===void 0&&(u=1),d===void 0&&(d=1);var p=function(fe){return 360*fe/(2*Jn)},f=function(fe){return 2*Jn*fe/360};s=new Hn(s),o=new Hn(o);var v=Array.from(s.lab()),b=v[0],w=v[1],x=v[2],R=Array.from(o.lab()),C=R[0],$=R[1],M=R[2],j=(b+C)/2,W=Bt(lt(w,2)+lt(x,2)),q=Bt(lt($,2)+lt(M,2)),H=(W+q)/2,dt=.5*(1-Bt(lt(H,7)/(lt(H,7)+lt(25,7)))),ft=w*(1+dt),yt=$*(1+dt),U=Bt(lt(ft,2)+lt(x,2)),S=Bt(lt(yt,2)+lt(M,2)),z=(U+S)/2,N=p(Yn(x,ft)),B=p(Yn(M,yt)),pt=N>=0?N:N+360,K=B>=0?B:B+360,G=Zn(pt-K)>180?(pt+K+360)/2:(pt+K)/2,Z=1-.17*fr(f(G-30))+.24*fr(f(2*G))+.32*fr(f(3*G+6))-.2*fr(f(4*G-63)),V=K-pt;V=Zn(V)<=180?V:K<=pt?V+360:V-360,V=2*Bt(U*S)*Vn(f(V)/2);var J=C-b,$t=S-U,Jt=1+.015*lt(j-50,2)/Bt(20+lt(j-50,2)),Qt=1+.045*z,Ae=1+.015*z*Z,Oe=30*Qh(-lt((G-275)/25,2)),Nt=2*Bt(lt(z,7)/(lt(z,7)+lt(25,7))),ce=-Nt*Vn(2*f(Oe)),Ue=Bt(lt(J/(l*Jt),2)+lt($t/(u*Qt),2)+lt(V/(d*Ae),2)+ce*($t/(u*Qt))*(V/(d*Ae)));return Jh(0,Vh(100,Ue))},Qn=D,tu=function(s,o,l){l===void 0&&(l="lab"),s=new Qn(s),o=new Qn(o);var u=s.get(l),d=o.get(l),p=0;for(var f in u){var v=(u[f]||0)-(d[f]||0);p+=v*v}return Math.sqrt(p)},eu=D,ru=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];try{return new(Function.prototype.bind.apply(eu,[null].concat(s))),!0}catch{return!1}},Kn=ot,ti=Vr,su={cool:function(){return ti([Kn.hsl(180,1,.9),Kn.hsl(250,.7,.4)])},hot:function(){return ti(["#000","#f00","#ff0","#fff"]).mode("rgb")}},dr={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},ts=0,ei=Object.keys(dr);ts(et.Color.symbol=et.Color.prototype.symbol=Symbol.for("@motion-canvas/core/types/Color"),et.Color.lerp=et.Color.prototype.lerp=(n,t,e,r="lch")=>{typeof n=="string"&&(n=new et.Color(n)),typeof t=="string"&&(t=new et.Color(t));const i=n instanceof et.Color,a=t instanceof et.Color;return i||(n=a?t.alpha(0):new et.Color("rgba(0, 0, 0, 0)")),a||(t=i?n.alpha(0):new et.Color("rgba(0, 0, 0, 0)")),et.mix(n,t,e,r)},et.Color.createLerp=et.Color.prototype.createLerp=n=>(t,e,r)=>et.Color.lerp(t,e,r,n),et.Color.createSignal=(n,t=et.Color.lerp)=>new be(n,t,void 0,e=>new et.Color(e)).toSignal(),et.Color.prototype.toSymbol=()=>et.Color.symbol,et.Color.prototype.toUniform=function(n,t){n.uniform4fv(t,this.gl())},et.Color.prototype.serialize=function(){return this.css()},et.Color.prototype.lerp=function(n,t,e){return et.Color.lerp(this,n,t,e)},et.Color))();function Ju(n,t){return g.fromDegrees(n).transform(t).degrees}function is(n,t){return g.magnitude(t.m11,t.m12)*n}class as extends kt{constructor(){super(...arguments),this.type=se.symbol}parse(t){return t===null?null:new se(t)}serialize(){var t;return((t=this.value.current)==null?void 0:t.serialize())??null}}class ve extends kt{constructor(t,e,r=(i=>(i=e[0])==null?void 0:i.value)()){super(t,r),this.options=e,this.type=ve.symbol}set(t){var e;super.set((e=this.getOption(t))==null?void 0:e.value)}parse(t){var e;return(e=this.getOption(t))==null?void 0:e.value}getOption(t){return this.options.find(e=>e.value===t)??this.options[0]}}ve.symbol=Symbol.for("@motion-canvas/core/meta/EnumMetaField");class Qu extends kt{get onFieldsChanged(){return this.fields.subscribable}get options(){return this.optionFields[this.current]}constructor(t,e,r=0){var c,m;const i=e.plugins.flatMap(y=>{var k;return((k=y.exporters)==null?void 0:k.call(y,e))??[]}),a=i.map(y=>y.meta(e)),h=new ve("exporter",i.map(y=>({value:y.id,text:y.displayName})),(c=i[r])==null?void 0:c.id);super(t,{name:h.get(),options:(m=a[r])==null?void 0:m.get()}),this.current=r,this.type=Object,this.handleChange=()=>{var F,X,Q;const y=this.exporterField.get(),k=Math.max(this.exporters.findIndex(at=>at.id===y),0);this.current!==k&&((F=this.options)==null||F.onChanged.unsubscribe(this.handleChange),this.current=k,(X=this.options)==null||X.onChanged.subscribe(this.handleChange,!1),this.fields.current=this.options?[this.exporterField,this.options]:[this.exporterField]),this.value.current={name:this.exporterField.get(),options:((Q=this.options)==null?void 0:Q.get())??null}},this.exporters=i,this.exporterField=h,this.exporterField.onChanged.subscribe(this.handleChange,!1),this.exporterField.disable(a.length<2).space(),this.optionFields=a,this.fields=new re([this.exporterField]),this.options&&(this.options.onChanged.subscribe(this.handleChange,!1),this.fields.current=[this.exporterField,this.options])}set(t){var e;this.exporterField.set(t.name),(e=this.options)==null||e.set(t.options??{})}serialize(){var t;return{name:this.exporterField.serialize(),options:((t=this.options)==null?void 0:t.serialize())??null}}clone(){return new this.constructor(this.name,this.exporters,this.current)}}var qe;class Je{constructor(t,e=!1){this.name=t,this.source=e,this.lock=new uu,this.ignoreChange=!1,this.cache=null,this.metaField=null,this.handleChanged=async()=>{}}attach(t){var e;this.metaField||(this.metaField=t,this.cache&&this.metaField.set(this.cache),(e=this.metaField)==null||e.onChanged.subscribe(this.handleChanged))}async saveData(t){if(this.source===!1)return;if(!this.source)throw new Error(`The meta file for ${this.name} is missing.`);if(qe.sourceLookup[this.source])throw new Error(`Metadata for ${this.name} is already being updated`);const e=this.source;await new Promise((r,i)=>{setTimeout(()=>{delete qe.sourceLookup[e],i(`Connection timeout when updating metadata for ${this.name}`)},1e3),qe.sourceLookup[e]=()=>{delete qe.sourceLookup[e],r()},(void 0).send("motion-canvas:meta",{source:e,data:t})})}loadData(t){var e;this.ignoreChange=!0,this.cache=t,(e=this.metaField)==null||e.set(t),this.ignoreChange=!1}}qe=Je;Je.sourceLookup={};class ns extends kt{constructor(){super(...arguments),this.type=Number,this.presets=[]}parse(t){let e=parseFloat(t);return this.min!==void 0&&ethis.max&&(e=this.max),e}getPresets(){return this.presets}setPresets(t){return this.presets=t,this}setRange(t,e){return this.min=t,this.max=e,this}getMin(){return this.min??-1/0}getMax(){return this.max??1/0}}class Sr extends kt{constructor(){super(...arguments),this.type=Sr.symbol}parse(t){return this.parseRange(1/0,t[0],t[1]??1/0)}update(t,e,r,i){this.value.current=this.parseRange(r/i-He,t/i-He,e/i-He)}parseRange(t,e=this.value.current[0],r=this.value.current[1]){return e=wt(0,t,e),r=wt(0,t,r??1/0),e>r&&([e,r]=[r,e]),r>=t&&(r=1/0),[e,r]}}Sr.symbol=Symbol.for("@motion-canvas/core/meta/RangeMetaField");class Mi extends kt{constructor(){super(...arguments),this.type=g.symbol}parse(t){return new g(t)}serialize(){return this.value.current.serialize()}}class je{static meta(t){return new Gt(this.displayName,{fastStart:new br("fast start",!0),includeAudio:new br("include audio",!0).disable(!t.audio)})}static async create(t,e){return new je(t,e)}constructor(t,e){this.project=t,this.settings=e}async start(){const t=this.settings.exporter.options;await this.invoke("start",{...this.settings,...t,audio:this.project.audio,audioOffset:this.project.meta.shared.audioOffset.get()-this.settings.range[0]})}async handleFrame(t){await this.invoke("handleFrame",{data:t.toDataURL("image/png")})}async stop(t){await this.invoke("end",t)}invoke(t,e){throw new Error("FFmpegExporter can only be used locally.")}}je.id="@motion-canvas/ffmpeg";je.displayName="Video (FFmpeg)";je.response=new Ot;const Ku=au({name:"ffmpeg-plugin",exporters(){return[je]}});let ms;ms??(ms=new Je("project",!1));ms.loadData({version:0,shared:{background:"rgba(255,0,0,0)",range:[0,null],size:{x:1920,y:1080},audioOffset:0},preview:{fps:30,resolutionScale:1},rendering:{fps:60,resolutionScale:1,colorSpace:"srgb",exporter:{name:"@motion-canvas/core/image-sequence",options:{fileType:"image/png",quality:100,groupByScene:!1}}}});const tc=ms;let bs;bs??(bs=new Je("example",!1));bs.loadData({version:0,timeEvents:[],seed:3712781475});const ec=bs;function rc(n){var t;return!!((t=n.prototype)!=null&&t.isClass)}const sc=Symbol.for("@motion-canvas/2d/fragment");function nc(n,t,e){const{ref:r,children:i,...a}=t,h=Array.isArray(i)?i.flat():i;if(n===sc)return h;if(rc(n)){const c=new n({...a,children:h,key:e});return r==null||r(c),c}else return n({...a,ref:r,children:h,key:e})}const fi={invert:{name:"invert"},sepia:{name:"sepia"},grayscale:{name:"grayscale"},brightness:{name:"brightness",default:1},contrast:{name:"contrast",default:1},saturate:{name:"saturate",default:1},hue:{name:"hue-rotate",unit:"deg",scale:1},blur:{name:"blur",transform:!0,unit:"px",scale:1}};class ic{get name(){return this.props.name}get default(){return this.props.default}constructor(t){this.props={name:"invert",default:0,unit:"%",scale:100,transform:!1,...t,value:t.value??t.default??0},this.value=De(this.props.value,tt,this)}isActive(){return this.value()!==this.props.default}serialize(t){let e=this.value();return this.props.transform&&(e=is(e,t)),`${this.props.name}(${e*this.props.scale}${this.props.unit})`}}const Wt=Symbol.for("@motion-canvas/2d/decorators/initializers");function Qe(n,t){if(!n[Wt])n[Wt]=[];else if(n[Wt]&&!Object.prototype.hasOwnProperty.call(n,Wt)){const e=Object.getPrototypeOf(n);n[Wt]=[...e[Wt]]}n[Wt].push(t)}function ac(n,t){if(n[Wt])try{n[Wt].forEach(e=>e(n,t))}catch(e){throw e.inspect??(e.inspect=n.key),e}}function E(){return(n,t)=>{Qe(n,e=>{const r=Object.getPrototypeOf(e)[t];e[t]=Yu(r.bind(e),e)})}}function os(n={},t,e){const r={};if(e&&t){const i=n.setter??(t==null?void 0:t[`set${Ge(e)}`]);i&&(r.setter=i.bind(t));const a=n.getter??(t==null?void 0:t[`get${Ge(e)}`]);a&&(r.getter=a.bind(t));const h=n.tweener??(t==null?void 0:t[`tween${Ge(e)}`]);h&&(r.tweener=h.bind(t))}return r}const Ut=Symbol.for("@motion-canvas/2d/decorators/properties");function we(n,t){var e;return((e=n[Ut])==null?void 0:e[t])??null}function ys(n,t){let e;return n[Ut]?n[Ut]&&!Object.prototype.hasOwnProperty.call(n,Ut)?n[Ut]=e=Object.fromEntries(Object.entries(n[Ut]).map(([r,i])=>[r,{...i}])):e=n[Ut]:n[Ut]=e={},e[t]??(e[t]={cloneable:!0,inspectable:!0,compoundEntries:[]}),e[t]}function $i(n){return n&&typeof n=="object"?n[Ut]??{}:{}}function ws(n,t){ac(n);for(const[e,r]of Object.entries($i(n))){const i=n[e];if(i.reset(),t[e]!==void 0&&i(t[e]),r.compoundEntries!==void 0)for(const[a,h]of r.compoundEntries)h in t&&i[a](t[h])}}function P(){return(n,t)=>{const e=ys(n,t);Qe(n,r=>{var c;let i=e.default;const a=r[`getDefault${Ge(t)}`];a&&(i=()=>a.call(r,e.default));const h=new be(i,e.interpolationFunction??_e,r,(c=e.parser)==null?void 0:c.bind(r),os(e,r,t));r[t]=h.toSignal()})}}function A(n){return(t,e)=>{const r=we(t,e);if(!r){vt().error(`Missing property decorator for "${e.toString()}"`);return}r.default=n}}function Li(n){return(t,e)=>{const r=we(t,e);if(!r){vt().error(`Missing property decorator for "${e.toString()}"`);return}r.interpolationFunction=n}}function xs(n){return(t,e)=>{const r=we(t,e);if(!r){vt().error(`Missing property decorator for "${e.toString()}"`);return}r.parser=n}}function Ke(n){return(t,e)=>{const r=we(t,e);if(!r){vt().error(`Missing property decorator for "${e.toString()}"`);return}r.parser=i=>new n(i),"lerp"in n&&(r.interpolationFunction??(r.interpolationFunction=n.lerp))}}function xe(n=!0){return(t,e)=>{const r=we(t,e);if(!r){vt().error(`Missing property decorator for "${e.toString()}"`);return}r.cloneable=n}}function Ai(n=!0){return(t,e)=>{const r=we(t,e);if(!r){vt().error(`Missing property decorator for "${e.toString()}"`);return}r.inspectable=n}}function Oi(n,t=Cr){return(e,r)=>{const i=ys(e,r);i.compound=!0,i.compoundEntries=Object.entries(n),Qe(e,a=>{if(!i.parser){vt().error(`Missing parser decorator for "${r.toString()}"`);return}const h=i.default,c=i.parser.bind(a),m=new t(i.compoundEntries.map(([y,k])=>{const F=new be(ge(h,X=>c(X)[y]),tt,a,void 0,os(void 0,a,k)).toSignal();return[y,F]}),c,h,i.interpolationFunction??_e,a,os(i,a,r));a[r]=m.toSignal()})}}function Ht(n){return(t,e)=>{Oi(typeof n=="object"?n:{x:n?`${n}X`:"x",y:n?`${n}Y`:"y"},Pi)(t,e),Ke(g)(t,e)}}var oe=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var c=n.length-1;c>=0;c--)(h=n[c])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};class jt{constructor(t){ws(this,t)}canvasGradient(t){let e;switch(this.type()){case"linear":e=t.createLinearGradient(this.from.x(),this.from.y(),this.to.x(),this.to.y());break;case"conic":e=t.createConicGradient(this.angle(),this.from.x(),this.from.y());break;case"radial":e=t.createRadialGradient(this.from.x(),this.from.y(),this.fromRadius(),this.to.x(),this.to.y(),this.toRadius());break}for(const{offset:r,color:i}of this.stops())e.addColorStop(me(r),new se(me(i)).serialize());return e}}oe([A("linear"),P()],jt.prototype,"type",void 0);oe([Ht("from")],jt.prototype,"from",void 0);oe([Ht("to")],jt.prototype,"to",void 0);oe([A(0),P()],jt.prototype,"angle",void 0);oe([A(0),P()],jt.prototype,"fromRadius",void 0);oe([A(0),P()],jt.prototype,"toRadius",void 0);oe([A([]),P()],jt.prototype,"stops",void 0);oe([E()],jt.prototype,"canvasGradient",null);var Cs=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var c=n.length-1;c>=0;c--)(h=n[c])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};class tr{constructor(t){ws(this,t)}canvasPattern(t){return t.createPattern(this.image(),this.repetition())}}Cs([P()],tr.prototype,"image",void 0);Cs([A(null),P()],tr.prototype,"repetition",void 0);Cs([E()],tr.prototype,"canvasPattern",null);function oc(n){return n===null?null:n instanceof jt||n instanceof tr?n:new se(n)}function ls(n,t){return n===null?"":n instanceof se?n.serialize():n instanceof jt?n.canvasGradient(t):n instanceof tr?n.canvasPattern(t)??"":""}function di(n,t,e,r,i){if(e.top===0&&e.right===0&&e.bottom===0&&e.left===0){lc(n,t);return}const a=ee(e.top,e.right,e.left,t),h=ee(e.right,e.top,e.bottom,t),c=ee(e.bottom,e.left,e.right,t),m=ee(e.left,e.bottom,e.top,t);if(r){const y=k=>{const F=k*i;return k-F};n.moveTo(t.left+a,t.top),n.lineTo(t.right-h,t.top),n.bezierCurveTo(t.right-y(h),t.top,t.right,t.top+y(h),t.right,t.top+h),n.lineTo(t.right,t.bottom-c),n.bezierCurveTo(t.right,t.bottom-y(c),t.right-y(c),t.bottom,t.right-c,t.bottom),n.lineTo(t.left+m,t.bottom),n.bezierCurveTo(t.left+y(m),t.bottom,t.left,t.bottom-y(m),t.left,t.bottom-m),n.lineTo(t.left,t.top+a),n.bezierCurveTo(t.left,t.top+y(a),t.left+y(a),t.top,t.left+a,t.top);return}n.moveTo(t.left+a,t.top),n.arcTo(t.right,t.top,t.right,t.bottom,h),n.arcTo(t.right,t.bottom,t.left,t.bottom,c),n.arcTo(t.left,t.bottom,t.left,t.top,m),n.arcTo(t.left,t.top,t.right,t.top,a)}function ee(n,t,e,r){const i=n+t>r.width?r.width*(n/(n+t)):n,a=n+e>r.height?r.height*(n/(n+e)):n;return Math.min(i,a)}function lc(n,t){n.rect(t.x,t.y,t.width,t.height)}function kr(n,t){n.moveTo(t.x,t.y)}function qt(n,t){n.lineTo(t.x,t.y)}function de(n,t){if(!(t.length<2)){kr(n,t[0]);for(const e of t.slice(1))qt(n,e)}}function hc(n,t,e=8){qt(n,t.addY(-e)),qt(n,t.addY(e)),qt(n,t),qt(n,t.addX(-e)),uc(n,t,e)}function uc(n,t,e,r=0,i=Math.PI*2,a=!1){n.arc(t.x,t.y,e,r,i,a)}function cc(n,t,e,r){n.bezierCurveTo(t.x,t.y,e.x,e.y,r.x,r.y)}function zi(n){return t=>t instanceof n}function Ii(){return(n,t)=>{P()(n,t),xs(oc)(n,t),Li(se.lerp)(n,t),A(null)(n,t)}}function fc(){return(n,t)=>{P()(n,t),Ke(se)(n,t)}}function le(n,t=e=>e){return(e,r)=>{e[`getDefault${Ge(r)}`]=function(){this.requestLayoutUpdate();const i=this.element.style[n];this.element.style[n]="";const a=t.call(this,this.styles.getPropertyValue(n));return this.element.style[n]=i,a}}}class dc extends be{constructor(t,e){super(t,_e,e);for(const r in fi){const i=fi[r];Object.defineProperty(this.invokable,r,{value:(a,h,c=Et)=>{var y,k,F;if(a===void 0)return((k=(y=this.get())==null?void 0:y.find(X=>X.name===i.name))==null?void 0:k.value())??i.default??0;let m=(F=this.get())==null?void 0:F.find(X=>X.name===i.name);return m||(m=new ic(i),this.set([...this.get(),m])),h===void 0?(m.value(a),this.owner):m.value(a,h,c)}})}}*tweener(t,e,r){const i=this.get(),a=me(t);if(gc(i,a)){yield*Fe(...i.map((m,y)=>m.value(a[y].value(),e,r))),this.set(a);return}for(const m of a)m.value(m.default);const h=a.map(m=>m.value.context.raw()),c=i.length>0&&a.length>0?e/2:e;i.length>0&&(yield*Fe(...i.map(m=>m.value(m.default,c,r)))),this.set(a),a.length>0&&(yield*Fe(...a.map((m,y)=>m.value(h[y],c,r))))}}function pc(){return(n,t)=>{const e=ys(n,t);Qe(n,r=>{r[t]=new dc(e.default??[],r).toSignal()})}}function gc(n,t){if(n.length!==t.length)return!1;for(let e=0;e=e){const h=(e-a)/i.arcLength;return i.getPoint(wt(0,1,h))}}return{position:g.zero,tangent:g.up,normal:g.up}}function Tr(n){return(t,e)=>{Oi({top:n?`${n}Top`:"top",right:n?`${n}Right`:"right",bottom:n?`${n}Bottom`:"bottom",left:n?`${n}Left`:"left"})(t,e),Ke(At)(t,e)}}function mc(n){let t;return n?typeof n=="string"?t=[{fragment:n}]:Array.isArray(n)?t=n.map(e=>typeof e=="string"?{fragment:e}:e):t=[n]:t=[],!fs().experimentalFeatures&&t.length>0&&(t=[],vt().log({...wu("Node uses experimental shaders."),inspect:this.key})),t}function gr(){return fs()}var _=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var c=n.length-1;c>=0;c--)(h=n[c])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a},vr;let I=vr=class{get x(){return this.position.x}get y(){return this.position.y}getAbsolutePosition(){return new g(this.parentToWorld().transformPoint(this.position()))}setAbsolutePosition(t){this.position(ge(t,e=>new g(e).transformAsPoint(this.worldToParent())))}getAbsoluteRotation(){const t=this.localToWorld();return g.degrees(t.m11,t.m12)}setAbsoluteRotation(t){this.rotation(ge(t,e=>Ju(e,this.worldToParent())))}getAbsoluteScale(){const t=this.localToWorld();return new g(g.magnitude(t.m11,t.m12),g.magnitude(t.m21,t.m22))}setAbsoluteScale(t){this.scale(ge(t,e=>this.getRelativeScale(new g(e))))}getRelativeScale(t){var r;const e=((r=this.parent())==null?void 0:r.absoluteScale())??g.one;return t.div(e)}*tweenCompositeOperation(t,e,r){const i=me(t);i==="source-over"?(yield*this.compositeOverride(1,e,r),this.compositeOverride(0),this.compositeOperation(i)):(this.compositeOperation(i),this.compositeOverride(1),yield*this.compositeOverride(0,e,r))}absoluteOpacity(){var t;return(((t=this.parent())==null?void 0:t.absoluteOpacity())??1)*this.opacity()}hasFilters(){return!!this.filters().find(t=>t.isActive())}hasShadow(){return!!this.shadowColor()&&(this.shadowBlur()>0||this.shadowOffset.x()!==0||this.shadowOffset.y()!==0)}filterString(){let t="";const e=this.compositeToWorld();for(const r of this.filters())r.isActive()&&(t+=" "+r.serialize(e));return t}getSpawner(){return this.children()}setSpawner(t){this.children(t)}setChildren(t){if(this.children.context.raw()!==t){if(this.children.context.setter(t),!Xt(t))this.spawnChildren(!1,t);else if(!this.hasSpawnedChildren)for(const e of this.realChildren)e.parent(null)}}getChildren(){return this.children.context.getter(),this.spawnedChildren()}spawnedChildren(){const t=this.children.context.getter();return Xt(this.children.context.raw())&&this.spawnChildren(!0,t),this.realChildren}sortedChildren(){return[...this.children()].sort((t,e)=>Math.sign(t.zIndex()-e.zIndex()))}constructor({children:t,spawner:e,key:r,...i}){this.compositeOverride=De(0),this.stateStack=[],this.realChildren=[],this.hasSpawnedChildren=!1,this.parent=De(null),this.properties=$i(this);const a=gr();[this.key,this.unregister]=a.registerNode(this,r),this.view2D=a.getView(),this.creationStack=new Error().stack,ws(this,i),e&&vt().warn({message:"Node.spawner() has been deprecated.",remarks:"Use Node.children() instead.",inspect:this.key,stack:new Error().stack}),this.children(e??t)}localToWorld(){const t=this.parent();return t?t.localToWorld().multiply(this.localToParent()):this.localToParent()}worldToLocal(){return this.localToWorld().inverse()}worldToParent(){var t;return((t=this.parent())==null?void 0:t.worldToLocal())??new DOMMatrix}parentToWorld(){var t;return((t=this.parent())==null?void 0:t.localToWorld())??new DOMMatrix}localToParent(){const t=new DOMMatrix;return t.translateSelf(this.x(),this.y()),t.rotateSelf(0,0,this.rotation()),t.scaleSelf(this.scale.x(),this.scale.y()),t.skewXSelf(this.skew.x()),t.skewYSelf(this.skew.y()),t}compositeToWorld(){var t;return((t=this.compositeRoot())==null?void 0:t.localToWorld())??new DOMMatrix}compositeRoot(){var t;return this.composite()?this:((t=this.parent())==null?void 0:t.compositeRoot())??null}compositeToLocal(){const t=this.compositeRoot();if(t){const e=this.worldToLocal();return e.m44=1,t.localToWorld().multiply(e)}return new DOMMatrix}view(){return this.view2D}add(t){return this.insert(t,1/0)}insert(t,e=0){const r=Array.isArray(t)?t:[t];if(r.length===0)return this;const i=this.children(),a=i.slice(0,e);for(const h of r)h instanceof vr&&(a.push(h),h.remove(),h.parent(this));return a.push(...i.slice(e)),this.setParsedChildren(a),this}remove(){const t=this.parent();return t===null?this:(t.removeChild(this),this.parent(null),this)}move(t=1){const e=this.parent();if(t===0||!e)return this;const r=e.children(),i=[];if(t>0)for(let a=0;a=0;a--){const h=r[a];if(h===this){const c=a+t;for(;a>c&&a>0;a--)i[a]=r[a-1]}i[a]=h}return e.setParsedChildren(i),this}moveUp(){return this.move(1)}moveDown(){return this.move(-1)}moveToTop(){return this.move(1/0)}moveToBottom(){return this.move(-1/0)}moveTo(t){const e=this.parent();if(!e)return this;const r=e.children().indexOf(this),i=t-r;return this.move(i)}moveBelow(t,e=!1){const r=this.parent();if(!r)return this;if(t.parent()!==r)return vt().error("Cannot position nodes relative to each other if they don't belong to the same parent."),this;const i=r.children(),a=i.indexOf(this),h=i.indexOf(t);if(!e&&ah)return this;const c=h-a+1;return this.move(c)}reparent(t){const e=this.absolutePosition(),r=this.absoluteRotation(),i=this.absoluteScale();return t.add(this),this.absolutePosition(e),this.absoluteRotation(r),this.absoluteScale(i),this}removeChildren(){for(const t of this.realChildren)t.parent(null);return this.setParsedChildren([]),this}peekChildren(){return this.realChildren}findAll(t){const e=[],r=this.reversedChildren();for(;r.length>0;){const i=r.pop();t(i)&&e.push(i);const a=i.children();for(let h=a.length-1;h>=0;h--)r.push(a[h])}return e}findFirst(t){const e=this.reversedChildren();for(;e.length>0;){const r=e.pop();if(t(r))return r;const i=r.children();for(let a=i.length-1;a>=0;a--)e.push(i[a])}return null}findLast(t){const e=[],r=this.reversedChildren();for(;r.length>0;){const i=r.pop();e.push(i);const a=i.children();for(let h=a.length-1;h>=0;h--)r.push(a[h])}for(;e.length>0;){const i=e.pop();if(t(i))return i}return null}findAncestor(t){let e=this.parent();for(;e;){if(t(e))return e;e=e.parent()}return null}childAs(t){return this.children()[t]??null}childrenAs(){return this.children()}parentAs(){return this.parent()??null}dispose(){if(this.unregister){this.stateStack=[],this.unregister(),this.unregister=null;for(const{signal:t}of this)t==null||t.context.dispose();for(const t of this.realChildren)t.dispose()}}clone(t={}){const e={...t};Xt(this.children.context.raw())?e.children??(e.children=this.children.context.raw()):this.children().length>0&&(e.children??(e.children=this.children().map(r=>r.clone())));for(const{key:r,meta:i,signal:a}of this)if(!(!i.cloneable||r in e))if(i.compound)for(const[h,c]of i.compoundEntries){if(c in e)continue;const m=a[h];m.context.isInitial()||(e[c]=m.context.raw())}else a.context.isInitial()||(e[r]=a.context.raw());return this.instantiate(e)}snapshotClone(t={}){const e={...this.getState(),...t};return this.children().length>0&&(e.children??(e.children=this.children().map(r=>r.snapshotClone()))),this.instantiate(e)}reactiveClone(t={}){const e={...t};this.children().length>0&&(e.children??(e.children=this.children().map(r=>r.reactiveClone())));for(const{key:r,meta:i,signal:a}of this)!i.cloneable||r in e||(e[r]=()=>a());return this.instantiate(e)}instantiate(t={}){return new this.constructor(t)}setParsedChildren(t){this.children.context.setter(t),this.realChildren=t}spawnChildren(t,e){const r=this.parseChildren(e),i=new Set;for(const a of r){const h=a.parent.context.raw();h&&h!==this&&h.removeChild(a),i.add(a.key),a.parent(this)}for(const a of this.realChildren)i.has(a.key)||a.parent(null);this.hasSpawnedChildren=t,this.realChildren=r}parseChildren(t){const e=[],r=Array.isArray(t)?t:[t];for(const i of r)i instanceof vr&&e.push(i);return e}removeChild(t){this.setParsedChildren(this.children().filter(e=>e!==t))}requiresCache(){return this.cache()||this.opacity()<1||this.compositeOperation()!=="source-over"||this.hasFilters()||this.hasShadow()||this.shaders().length>0}cacheCanvas(){const t=document.createElement("canvas").getContext("2d");if(!t)throw new Error("Could not create a cache canvas");return t}cachedCanvas(){const t=this.cacheCanvas(),e=this.worldSpaceCacheBBox(),r=this.localToWorld();return t.canvas.width=e.width,t.canvas.height=e.height,t.setTransform(r.a,r.b,r.c,r.d,r.e-e.x,r.f-e.y),this.draw(t),t}getCacheBBox(){return new Y}cacheBBox(){const t=this.getCacheBBox(),e=this.children(),r=this.cachePadding();if(e.length===0)return t.addSpacing(r);const i=t.corners;for(const h of e){const c=h.fullCacheBBox(),m=h.localToParent();i.push(...c.corners.map(y=>y.transformAsPoint(m)))}return Y.fromPoints(...i).addSpacing(r)}fullCacheBBox(){const t=this.compositeToLocal(),e=this.shadowOffset().transform(t),r=is(this.shadowBlur(),t),i=this.cacheBBox().expand(this.filters.blur()*2+r);return e.x<0?(i.x+=e.x,i.width-=e.x):i.width+=e.x,e.y<0?(i.y+=e.y,i.height-=e.y):i.height+=e.y,i}worldSpaceCacheBBox(){const t=Y.fromSizeCentered(this.view().size()).expand(this.view().cachePadding()),e=Y.fromPoints(...t.transformCorners(this.view().localToWorld())),r=Y.fromPoints(...this.cacheBBox().transformCorners(this.localToWorld()));return e.intersection(r).pixelPerfect.expand(2)}parentWorldSpaceCacheBBox(){var t;return((t=this.findAncestor(e=>e.requiresCache()))==null?void 0:t.worldSpaceCacheBBox())??new Y(g.zero,gr().getRealSize())}setupDrawFromCache(t){if(t.globalCompositeOperation=this.compositeOperation(),t.globalAlpha*=this.opacity(),this.hasFilters()&&(t.filter=this.filterString()),this.hasShadow()){const r=this.compositeToWorld(),i=this.shadowOffset().transform(r),a=is(this.shadowBlur(),r);t.shadowColor=this.shadowColor().serialize(),t.shadowBlur=a,t.shadowOffsetX=i.x,t.shadowOffsetY=i.y}const e=this.worldToLocal();t.transform(e.a,e.b,e.c,e.d,e.e,e.f)}renderFromSource(t,e,r,i){this.setupDrawFromCache(t);const a=this.compositeOverride();t.drawImage(e,r,i),a>0&&(t.save(),t.globalAlpha*=a,t.globalCompositeOperation="source-over",t.drawImage(e,r,i),t.restore())}shaderCanvas(t,e){var F,X;const r=this.shaders();if(r.length===0)return null;const i=gr(),a=i.getRealSize(),h=this.parentWorldSpaceCacheBBox(),c=new DOMMatrix().scaleSelf(a.width/h.width,a.height/-h.height).translateSelf(h.x/-a.width,h.y/a.height-1),m=this.worldSpaceCacheBBox(),y=new DOMMatrix().scaleSelf(a.width/m.width,a.height/-m.height).translateSelf(m.x/-a.width,m.y/a.height-1).invertSelf(),k=i.shaders.getGL();i.shaders.copyTextures(t,e),i.shaders.clear();for(const Q of r){const at=i.shaders.getProgram(Q.fragment);if(at){if(Q.uniforms)for(const[T,st]of Object.entries(Q.uniforms)){const Pt=k.getUniformLocation(at,T);if(Pt===null)continue;const nt=me(st);typeof nt=="number"?k.uniform1f(Pt,nt):"toUniform"in nt?nt.toUniform(k,Pt):nt.length===1?k.uniform1f(Pt,nt[0]):nt.length===2?k.uniform2f(Pt,nt[0],nt[1]):nt.length===3?k.uniform3f(Pt,nt[0],nt[1],nt[2]):nt.length===4&&k.uniform4f(Pt,nt[0],nt[1],nt[2],nt[3])}k.uniform1f(k.getUniformLocation(at,ui),this.view2D.globalTime()),k.uniform1i(k.getUniformLocation(at,ui),i.playback.frame),k.uniformMatrix4fv(k.getUniformLocation(at,Iu),!1,y.toFloat32Array()),k.uniformMatrix4fv(k.getUniformLocation(at,Fu),!1,c.toFloat32Array()),(F=Q.setup)==null||F.call(Q,k,at),i.shaders.render(),(X=Q.teardown)==null||X.call(Q,k,at)}}return k.canvas}render(t){if(!(this.absoluteOpacity()<=0)){if(t.save(),this.transformContext(t),this.requiresCache()){const e=this.worldSpaceCacheBBox();if(e.width!==0&&e.height!==0){const r=this.cachedCanvas().canvas,i=this.shaderCanvas(t.canvas,r);i?this.renderFromSource(t,i,0,0):this.renderFromSource(t,r,e.position.x,e.position.y)}}else this.draw(t);t.restore()}}draw(t){this.drawChildren(t)}drawChildren(t){for(const e of this.sortedChildren())e.render(t)}drawOverlay(t,e){const r=this.cacheBBox().transformCorners(e),i=this.getCacheBBox().transformCorners(e);t.strokeStyle="white",t.lineWidth=1,t.beginPath(),de(t,r),t.closePath(),t.stroke(),t.strokeStyle="blue",t.beginPath(),de(t,i),t.closePath(),t.stroke()}transformContext(t){const e=this.localToParent();t.transform(e.a,e.b,e.c,e.d,e.e,e.f)}hit(t){let e=null;const r=t.transformAsPoint(this.localToParent().inverse()),i=this.children();for(let a=i.length-1;a>=0&&(e=i[a].hit(r),!e);a--);return e}collectAsyncResources(){for(const t of this.children())t.collectAsyncResources()}async toPromise(){do await ht.consumePromises(),this.collectAsyncResources();while(ht.hasPromises());return this}getState(){const t={};for(const{key:e,meta:r,signal:i}of this)!r.cloneable||e in t||(t[e]=i());return t}applyState(t,e,r=Et){if(e===void 0)for(const a in t){const h=this.signalByKey(a);h&&h(t[a])}const i=[];for(const a in t){const h=this.signalByKey(a);t[a]!==h.context.raw()&&i.push(h(t[a],e,r))}return Fe(...i)}save(){this.stateStack.push(this.getState())}restore(t,e=Et){const r=this.stateStack.pop();if(r!==void 0)return this.applyState(r,t,e)}*[Symbol.iterator](){for(const t in this.properties){const e=this.properties[t],r=this.signalByKey(t);yield{meta:e,signal:r,key:t}}}signalByKey(t){return this[t]}reversedChildren(){const t=this.children(),e=[];for(let r=t.length-1;r>=0;r--)e.push(t[r]);return e}};_([Ht()],I.prototype,"position",void 0);_([Ke(g),xe(!1),P()],I.prototype,"absolutePosition",void 0);_([A(0),P()],I.prototype,"rotation",void 0);_([xe(!1),P()],I.prototype,"absoluteRotation",void 0);_([A(g.one),Ht("scale")],I.prototype,"scale",void 0);_([A(g.zero),Ht("skew")],I.prototype,"skew",void 0);_([Ke(g),xe(!1),P()],I.prototype,"absoluteScale",void 0);_([A(0),P()],I.prototype,"zIndex",void 0);_([A(!1),P()],I.prototype,"cache",void 0);_([Tr("cachePadding")],I.prototype,"cachePadding",void 0);_([A(!1),P()],I.prototype,"composite",void 0);_([A("source-over"),P()],I.prototype,"compositeOperation",void 0);_([ut()],I.prototype,"tweenCompositeOperation",null);_([A(1),xs(n=>wt(0,1,n)),P()],I.prototype,"opacity",void 0);_([E()],I.prototype,"absoluteOpacity",null);_([pc()],I.prototype,"filters",void 0);_([A("#0000"),fc()],I.prototype,"shadowColor",void 0);_([A(0),P()],I.prototype,"shadowBlur",void 0);_([Ht("shadowOffset")],I.prototype,"shadowOffset",void 0);_([A([]),xs(mc),P()],I.prototype,"shaders",void 0);_([E()],I.prototype,"hasFilters",null);_([E()],I.prototype,"hasShadow",null);_([E()],I.prototype,"filterString",null);_([Ai(!1),xe(!1),P()],I.prototype,"spawner",void 0);_([Ai(!1),xe(!1),P()],I.prototype,"children",void 0);_([E()],I.prototype,"spawnedChildren",null);_([E()],I.prototype,"sortedChildren",null);_([E()],I.prototype,"localToWorld",null);_([E()],I.prototype,"worldToLocal",null);_([E()],I.prototype,"worldToParent",null);_([E()],I.prototype,"parentToWorld",null);_([E()],I.prototype,"localToParent",null);_([E()],I.prototype,"compositeToWorld",null);_([E()],I.prototype,"compositeRoot",null);_([E()],I.prototype,"compositeToLocal",null);_([E()],I.prototype,"cacheCanvas",null);_([E()],I.prototype,"cachedCanvas",null);_([E()],I.prototype,"cacheBBox",null);_([E()],I.prototype,"fullCacheBBox",null);_([E()],I.prototype,"worldSpaceCacheBBox",null);_([E()],I.prototype,"parentWorldSpaceCacheBBox",null);I=vr=_([Ce("Node")],I);I.prototype.isClass=!0;var O=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var c=n.length-1;c>=0;c--)(h=n[c])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a},mr;let L=mr=class extends I{get columnGap(){return this.gap.x}get rowGap(){return this.gap.y}getX(){return this.isLayoutRoot()?this.x.context.getter():this.computedPosition().x}setX(t){this.x.context.setter(t)}getY(){return this.isLayoutRoot()?this.y.context.getter():this.computedPosition().y}setY(t){this.y.context.setter(t)}get width(){return this.size.x}get height(){return this.size.y}getWidth(){return this.computedSize().width}setWidth(t){this.width.context.setter(t)}*tweenWidth(t,e,r,i){const a=this.desiredSize().x,h=typeof a!="number"||typeof t!="number";let c;h?c=this.size.x():c=a;let m;h?(this.size.x(t),m=this.size.x()):m=t,this.size.x(c),h&&this.lockSize(),yield*_t(e,y=>this.size.x(i(c,m,r(y)))),this.size.x(t),h&&this.releaseSize()}getHeight(){return this.computedSize().height}setHeight(t){this.height.context.setter(t)}*tweenHeight(t,e,r,i){const a=this.desiredSize().y,h=typeof a!="number"||typeof t!="number";let c;h?c=this.size.y():c=a;let m;h?(this.size.y(t),m=this.size.y()):m=t,this.size.y(c),h&&this.lockSize(),yield*_t(e,y=>this.size.y(i(c,m,r(y)))),this.size.y(t),h&&this.releaseSize()}desiredSize(){return{x:this.width.context.getter(),y:this.height.context.getter()}}*tweenSize(t,e,r,i){const a=this.desiredSize();let h;typeof a.x!="number"||typeof a.y!="number"?h=this.size():h=new g(a);let c;typeof t=="object"&&typeof t.x=="number"&&typeof t.y=="number"?c=new g(t):(this.size(t),c=this.size()),this.size(h),this.lockSize(),yield*_t(e,m=>this.size(i(h,c,r(m)))),this.releaseSize(),this.size(t)}cardinalPoint(t){switch(t){case it.TopLeft:return this.topLeft;case it.TopRight:return this.topRight;case it.BottomLeft:return this.bottomLeft;case it.BottomRight:return this.bottomRight;case it.Top:case xt.Top:return this.top;case it.Bottom:case xt.Bottom:return this.bottom;case it.Left:case xt.Left:return this.left;case it.Right:case xt.Right:return this.right;default:return this.middle}}constructor(t){super(t),this.element.dataset.motionCanvasKey=this.key}lockSize(){this.sizeLockCounter(this.sizeLockCounter()+1)}releaseSize(){this.sizeLockCounter(this.sizeLockCounter()-1)}parentTransform(){return this.findAncestor(zi(mr))}anchorPosition(){const t=this.computedSize(),e=this.offset();return t.scale(.5).mul(e)}layoutEnabled(){var t;return this.layout()??((t=this.parentTransform())==null?void 0:t.layoutEnabled())??!1}isLayoutRoot(){var t;return!this.layoutEnabled()||!((t=this.parentTransform())!=null&&t.layoutEnabled())}localToParent(){const t=super.localToParent(),e=this.offset();if(!e.exactlyEquals(g.zero)){const r=this.size().mul(e).scale(-.5);t.translateSelf(r.x,r.y)}return t}scalingRotationMatrix(){const t=new DOMMatrix;t.rotateSelf(0,0,this.rotation()),t.scaleSelf(this.scale.x(),this.scale.y());const e=this.offset();if(!e.exactlyEquals(g.zero)){const r=this.size().mul(e).scale(-.5);t.translateSelf(r.x,r.y)}return t}getComputedLayout(){return new Y(this.element.getBoundingClientRect())}computedPosition(){this.requestLayoutUpdate();const t=this.getComputedLayout(),e=new g(t.x+t.width/2*this.offset.x(),t.y+t.height/2*this.offset.y()),r=this.parentTransform();if(r){const i=r.getComputedLayout();e.x-=i.x+(i.width-t.width)/2,e.y-=i.y+(i.height-t.height)/2}return e}computedSize(){return this.requestLayoutUpdate(),this.getComputedLayout().size}requestLayoutUpdate(){const t=this.parentTransform();this.appendedToView()?(t==null||t.requestFontUpdate(),this.updateLayout()):t.requestLayoutUpdate()}appendedToView(){const t=this.isLayoutRoot();return t&&this.view().element.append(this.element),t}updateLayout(){if(this.applyFont(),this.applyFlex(),this.layoutEnabled()){const t=this.layoutChildren();for(const e of t)e.updateLayout()}}layoutChildren(){const t=[...this.children()],e=[],r=[];for(;t.length;){const i=t.shift();i instanceof mr?i.layoutEnabled()&&(e.push(i),r.push(i.element)):i&&t.unshift(...i.children())}return this.element.replaceChildren(...r),e}requestFontUpdate(){var t;this.appendedToView(),(t=this.parentTransform())==null||t.requestFontUpdate(),this.applyFont()}getCacheBBox(){return Y.fromSizeCentered(this.computedSize())}draw(t){if(this.clip()){const e=this.computedSize();if(e.width===0||e.height===0)return;t.beginPath(),t.rect(e.width/-2,e.height/-2,e.width,e.height),t.closePath(),t.clip()}this.drawChildren(t)}drawOverlay(t,e){const r=this.computedSize(),i=r.mul(this.offset()).scale(.5).transformAsPoint(e),a=Y.fromSizeCentered(r),h=a.transformCorners(e),c=a.addSpacing(this.padding().scale(-1)).transformCorners(e),m=a.addSpacing(this.margin()).transformCorners(e);t.beginPath(),de(t,m),de(t,h),t.closePath(),t.fillStyle="rgba(255,193,125,0.6)",t.fill("evenodd"),t.beginPath(),de(t,h),de(t,c),t.closePath(),t.fillStyle="rgba(180,255,147,0.6)",t.fill("evenodd"),t.beginPath(),de(t,h),t.closePath(),t.lineWidth=1,t.strokeStyle="white",t.stroke(),t.beginPath(),hc(t,i),t.stroke()}getOriginDelta(t){const e=this.computedSize().scale(.5),r=this.offset().mul(e);return t===it.Middle?r.flipped:Zu(t).mul(e).sub(r)}moveOffset(t){const e=this.computedSize().scale(.5),r=this.offset().mul(e),i=t.mul(e);this.offset(t),this.position(this.position().add(i).sub(r))}parsePixels(t){return t===null?"":`${t}px`}parseLength(t){return t===null?"":typeof t=="string"?t:`${t}px`}applyFlex(){this.element.style.position=this.isLayoutRoot()?"absolute":"relative";const t=this.desiredSize();this.element.style.width=this.parseLength(t.x),this.element.style.height=this.parseLength(t.y),this.element.style.maxWidth=this.parseLength(this.maxWidth()),this.element.style.minWidth=this.parseLength(this.minWidth()),this.element.style.maxHeight=this.parseLength(this.maxHeight()),this.element.style.minHeight=this.parseLength(this.minHeight()),this.element.style.aspectRatio=this.ratio()===null?"":this.ratio().toString(),this.element.style.marginTop=this.parsePixels(this.margin.top()),this.element.style.marginBottom=this.parsePixels(this.margin.bottom()),this.element.style.marginLeft=this.parsePixels(this.margin.left()),this.element.style.marginRight=this.parsePixels(this.margin.right()),this.element.style.paddingTop=this.parsePixels(this.padding.top()),this.element.style.paddingBottom=this.parsePixels(this.padding.bottom()),this.element.style.paddingLeft=this.parsePixels(this.padding.left()),this.element.style.paddingRight=this.parsePixels(this.padding.right()),this.element.style.flexDirection=this.direction(),this.element.style.flexBasis=this.parseLength(this.basis()),this.element.style.flexWrap=this.wrap(),this.element.style.justifyContent=this.justifyContent(),this.element.style.alignContent=this.alignContent(),this.element.style.alignItems=this.alignItems(),this.element.style.alignSelf=this.alignSelf(),this.element.style.columnGap=this.parseLength(this.gap.x()),this.element.style.rowGap=this.parseLength(this.gap.y()),this.sizeLockCounter()>0?(this.element.style.flexGrow="0",this.element.style.flexShrink="0"):(this.element.style.flexGrow=this.grow().toString(),this.element.style.flexShrink=this.shrink().toString())}applyFont(){if(this.element.style.fontFamily=this.fontFamily.isInitial()?"":this.fontFamily(),this.element.style.fontSize=this.fontSize.isInitial()?"":`${this.fontSize()}px`,this.element.style.fontStyle=this.fontStyle.isInitial()?"":this.fontStyle(),this.lineHeight.isInitial())this.element.style.lineHeight="";else{const t=this.lineHeight();this.element.style.lineHeight=typeof t=="string"?(parseFloat(t)/100).toString():`${t}px`}if(this.element.style.fontWeight=this.fontWeight.isInitial()?"":this.fontWeight().toString(),this.element.style.letterSpacing=this.letterSpacing.isInitial()?"":`${this.letterSpacing()}px`,this.element.style.textAlign=this.textAlign.isInitial()?"":this.textAlign(),this.textWrap.isInitial())this.element.style.whiteSpace="";else{const t=this.textWrap();typeof t=="boolean"?this.element.style.whiteSpace=t?"normal":"nowrap":this.element.style.whiteSpace=t}}dispose(){var t;super.dispose(),(t=this.sizeLockCounter)==null||t.context.dispose(),this.element&&(this.element.remove(),this.element.innerHTML=""),this.element=null,this.styles=null}hit(t){const e=t.transformAsPoint(this.localToParent().inverse());return this.cacheBBox().includes(e)?super.hit(t)??this:null}};O([A(null),Li(Uu),P()],L.prototype,"layout",void 0);O([A(null),P()],L.prototype,"maxWidth",void 0);O([A(null),P()],L.prototype,"maxHeight",void 0);O([A(null),P()],L.prototype,"minWidth",void 0);O([A(null),P()],L.prototype,"minHeight",void 0);O([A(null),P()],L.prototype,"ratio",void 0);O([Tr("margin")],L.prototype,"margin",void 0);O([Tr("padding")],L.prototype,"padding",void 0);O([A("row"),P()],L.prototype,"direction",void 0);O([A(null),P()],L.prototype,"basis",void 0);O([A(0),P()],L.prototype,"grow",void 0);O([A(1),P()],L.prototype,"shrink",void 0);O([A("nowrap"),P()],L.prototype,"wrap",void 0);O([A("start"),P()],L.prototype,"justifyContent",void 0);O([A("normal"),P()],L.prototype,"alignContent",void 0);O([A("stretch"),P()],L.prototype,"alignItems",void 0);O([A("auto"),P()],L.prototype,"alignSelf",void 0);O([A(0),Ht({x:"columnGap",y:"rowGap"})],L.prototype,"gap",void 0);O([le("font-family"),P()],L.prototype,"fontFamily",void 0);O([le("font-size",parseFloat),P()],L.prototype,"fontSize",void 0);O([le("font-style"),P()],L.prototype,"fontStyle",void 0);O([le("font-weight",parseInt),P()],L.prototype,"fontWeight",void 0);O([le("line-height",parseFloat),P()],L.prototype,"lineHeight",void 0);O([le("letter-spacing",n=>n==="normal"?0:parseFloat(n)),P()],L.prototype,"letterSpacing",void 0);O([le("white-space",n=>n==="pre"?"pre":n==="normal"),P()],L.prototype,"textWrap",void 0);O([A("inherit"),P()],L.prototype,"textDirection",void 0);O([le("text-align"),P()],L.prototype,"textAlign",void 0);O([A({x:null,y:null}),Ht({x:"width",y:"height"})],L.prototype,"size",void 0);O([ut()],L.prototype,"tweenWidth",null);O([ut()],L.prototype,"tweenHeight",null);O([E()],L.prototype,"desiredSize",null);O([ut()],L.prototype,"tweenSize",null);O([Ht("offset")],L.prototype,"offset",void 0);O([Yt(it.Middle)],L.prototype,"middle",void 0);O([Yt(it.Top)],L.prototype,"top",void 0);O([Yt(it.Bottom)],L.prototype,"bottom",void 0);O([Yt(it.Left)],L.prototype,"left",void 0);O([Yt(it.Right)],L.prototype,"right",void 0);O([Yt(it.TopLeft)],L.prototype,"topLeft",void 0);O([Yt(it.TopRight)],L.prototype,"topRight",void 0);O([Yt(it.BottomLeft)],L.prototype,"bottomLeft",void 0);O([Yt(it.BottomRight)],L.prototype,"bottomRight",void 0);O([A(!1),P()],L.prototype,"clip",void 0);O([A(0),P()],L.prototype,"sizeLockCounter",void 0);O([E()],L.prototype,"parentTransform",null);O([E()],L.prototype,"anchorPosition",null);O([E()],L.prototype,"layoutEnabled",null);O([E()],L.prototype,"isLayoutRoot",null);O([E()],L.prototype,"scalingRotationMatrix",null);O([E()],L.prototype,"computedPosition",null);O([E()],L.prototype,"computedSize",null);O([E()],L.prototype,"requestLayoutUpdate",null);O([E()],L.prototype,"appendedToView",null);O([E()],L.prototype,"updateLayout",null);O([E()],L.prototype,"layoutChildren",null);O([E()],L.prototype,"requestFontUpdate",null);O([E()],L.prototype,"applyFlex",null);O([E()],L.prototype,"applyFont",null);L=mr=O([Ce("Layout")],L);function Yt(n){return(t,e)=>{P()(t,e),xe(!1)(t,e);const r=we(t,e);r.parser=i=>new g(i),r.getter=function(){return this.computedSize().getOriginOffset(n).transformAsPoint(this.localToParent())},r.setter=function(i){return this.position(ge(i,a=>this.getOriginDelta(n).transform(this.scalingRotationMatrix()).flipped.add(a))),this}}}Qe(L.prototype,n=>{n.element=document.createElement("div"),n.element.style.display="flex",n.element.style.boxSizing="border-box",n.styles=getComputedStyle(n.element)});var Tt=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var c=n.length-1;c>=0;c--)(h=n[c])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};let bt=class extends L{rippleSize(){return Gu(this.rippleStrength(),0,50)}constructor(t){super(t),this.rippleStrength=De(0)}applyText(t){t.direction=this.textDirection(),this.element.dir=this.textDirection()}applyStyle(t){t.fillStyle=ls(this.fill(),t),t.strokeStyle=ls(this.stroke(),t),t.lineWidth=this.lineWidth(),t.lineJoin=this.lineJoin(),t.lineCap=this.lineCap(),t.setLineDash(this.lineDash()),t.lineDashOffset=this.lineDashOffset(),this.antialiased()||(t.filter="url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxmaWx0ZXIgaWQ9ImZpbHRlciIgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgY29sb3ItaW50ZXJwb2xhdGlvbi1maWx0ZXJzPSJzUkdCIj48ZmVDb21wb25lbnRUcmFuc2Zlcj48ZmVGdW5jUiB0eXBlPSJpZGVudGl0eSIvPjxmZUZ1bmNHIHR5cGU9ImlkZW50aXR5Ii8+PGZlRnVuY0IgdHlwZT0iaWRlbnRpdHkiLz48ZmVGdW5jQSB0eXBlPSJkaXNjcmV0ZSIgdGFibGVWYWx1ZXM9IjAgMSIvPjwvZmVDb21wb25lbnRUcmFuc2Zlcj48L2ZpbHRlcj48L3N2Zz4=#filter)")}draw(t){this.drawShape(t),this.clip()&&t.clip(this.getPath()),this.drawChildren(t)}drawShape(t){const e=this.getPath(),r=this.lineWidth()>0&&this.stroke()!==null,i=this.fill()!==null;t.save(),this.applyStyle(t),this.drawRipple(t),this.strokeFirst()?(r&&t.stroke(e),i&&t.fill(e)):(i&&t.fill(e),r&&t.stroke(e)),t.restore()}getCacheBBox(){return super.getCacheBBox().expand(this.lineWidth()/2)}getPath(){return new Path2D}getRipplePath(){return new Path2D}drawRipple(t){const e=this.rippleStrength();if(e>0){const r=this.getRipplePath();t.save(),t.globalAlpha*=tt(.54,0,e),t.fill(r),t.restore()}}*ripple(t=1){this.rippleStrength(0),yield*this.rippleStrength(1,t,Xu),this.rippleStrength(0)}};Tt([Ii()],bt.prototype,"fill",void 0);Tt([Ii()],bt.prototype,"stroke",void 0);Tt([A(!1),P()],bt.prototype,"strokeFirst",void 0);Tt([A(0),P()],bt.prototype,"lineWidth",void 0);Tt([A("miter"),P()],bt.prototype,"lineJoin",void 0);Tt([A("butt"),P()],bt.prototype,"lineCap",void 0);Tt([A([]),P()],bt.prototype,"lineDash",void 0);Tt([A(0),P()],bt.prototype,"lineDashOffset",void 0);Tt([A(!0),P()],bt.prototype,"antialiased",void 0);Tt([E()],bt.prototype,"rippleSize",null);Tt([E()],bt.prototype,"getPath",null);Tt([ut()],bt.prototype,"ripple",null);bt=Tt([Ce("Shape")],bt);var zt=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var c=n.length-1;c>=0;c--)(h=n[c])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};let Ct=class extends bt{desiredSize(){return this.childrenBBox().size}constructor(t){super(t),this.canHaveSubpath=!1}percentageToDistance(t){return wt(0,this.baseArcLength(),this.startOffset()+this.offsetArcLength()*t)}distanceToPercentage(t){return(t-this.startOffset())/this.offsetArcLength()}baseArcLength(){return this.profile().arcLength}offsetArcLength(){const t=this.startOffset(),e=this.endOffset(),r=this.baseArcLength();return wt(0,r,r-t-e)}arcLength(){return this.offsetArcLength()*Math.abs(this.start()-this.end())}completion(){return Math.abs(this.start()-this.end())}processSubpath(t,e,r){}curveDrawingInfo(){const t=new Path2D;let e=new Path2D;const r=this.profile();let i=this.percentageToDistance(this.start()),a=this.percentageToDistance(this.end());i>a&&([i,a]=[a,i]);const h=a-i,c=Math.min(h/2,this.arrowSize());this.startArrow()&&(i+=c/2),this.endArrow()&&(a-=c/2);let m=0,y=null,k=null,F=null,X=null;for(const Q of r.segments){const at=m;if(m+=Q.arcLength,ma)break}return this.closed()&&this.start.isInitial()&&this.end.isInitial()&&this.startOffset.isInitial()&&this.endOffset.isInitial()&&e.closePath(),this.processSubpath(e,y,F),t.addPath(e),{startPoint:y??g.zero,startTangent:k??g.right,endPoint:F??g.zero,endTangent:X??g.right,arrowSize:c,path:t,startOffset:i}}getPointAtDistance(t){return pi(this.profile(),t+this.startOffset())}getPointAtPercentage(t){return pi(this.profile(),this.percentageToDistance(t))}getComputedLayout(){return this.offsetComputedLayout(super.getComputedLayout())}offsetComputedLayout(t){return t.position=t.position.sub(this.childrenBBox().center),t}getPath(){return this.curveDrawingInfo().path}getCacheBBox(){const t=this.childrenBBox(),e=this.startArrow()||this.endArrow()?this.arrowSize():0,r=this.lineWidth(),i=this.lineWidthCoefficient();return t.expand(Math.max(0,e,r*i))}lineWidthCoefficient(){return this.lineCap()==="square"?.5*1.4143:.5}requiresProfile(){return!this.start.isInitial()||!this.startOffset.isInitial()||!this.startArrow.isInitial()||!this.end.isInitial()||!this.endOffset.isInitial()||!this.endArrow.isInitial()}drawShape(t){super.drawShape(t),(this.startArrow()||this.endArrow())&&this.drawArrows(t)}drawArrows(t){const{startPoint:e,startTangent:r,endPoint:i,endTangent:a,arrowSize:h}=this.curveDrawingInfo();h<.001||(t.save(),t.beginPath(),this.endArrow()&&this.drawArrow(t,i,a.flipped,h),this.startArrow()&&this.drawArrow(t,e,r,h),t.fillStyle=ls(this.stroke(),t),t.closePath(),t.fill(),t.restore())}drawArrow(t,e,r,i){const a=r.perpendicular,h=e.add(r.scale(-i/2));kr(t,h),qt(t,h.add(r.add(a).scale(i))),qt(t,h.add(r.sub(a).scale(i))),qt(t,h),t.closePath()}};zt([A(!1),P()],Ct.prototype,"closed",void 0);zt([A(0),P()],Ct.prototype,"start",void 0);zt([A(0),P()],Ct.prototype,"startOffset",void 0);zt([A(!1),P()],Ct.prototype,"startArrow",void 0);zt([A(1),P()],Ct.prototype,"end",void 0);zt([A(0),P()],Ct.prototype,"endOffset",void 0);zt([A(!1),P()],Ct.prototype,"endArrow",void 0);zt([A(24),P()],Ct.prototype,"arrowSize",void 0);zt([E()],Ct.prototype,"arcLength",null);zt([E()],Ct.prototype,"curveDrawingInfo",null);Ct=zt([Ce("Curve")],Ct);class Pr{}class bc extends Pr{constructor(t,e,r,i,a){super(),this.center=t,this.radius=e,this.from=r,this.to=i,this.counter=a,this.angle=Math.acos(wt(-1,1,r.dot(i))),this.length=Math.abs(this.angle*e);const h=new g(1,1).scale(e);this.points=[t.sub(h),t.add(h)]}get arcLength(){return this.length}draw(t,e,r){const i=this.counter?-1:1,a=this.from.radians+e*this.angle*i,h=this.to.radians-(1-r)*this.angle*i;Math.abs(this.angle)>1e-4&&t.arc(this.center.x,this.center.y,this.radius,a,h,this.counter);const c=g.fromRadians(a),m=g.fromRadians(h);return[{position:this.center.add(c.scale(this.radius)),tangent:this.counter?c:c.flipped,normal:this.counter?c.flipped:c},{position:this.center.add(m.scale(this.radius)),tangent:this.counter?m.flipped:m,normal:this.counter?m.flipped:m}]}getPoint(t){const e=this.counter?-1:1,r=this.from.radians+t*this.angle*e,i=g.fromRadians(r);return{position:this.center.add(i.scale(this.radius)),tangent:this.counter?i:i.flipped,normal:this.counter?i:i.flipped}}}class mt{static constant(t){return new mt(t)}static linear(t,e){return new mt(t,e)}static quadratic(t,e,r){return new mt(t,e,r)}static cubic(t,e,r,i){return new mt(t,e,r,i)}get degree(){return this.c3!==0?3:this.c2!==0?2:this.c1!==0?1:0}constructor(t,e,r,i){this.c0=t,this.c1=e??0,this.c2=r??0,this.c3=i??0}differentiate(t=1){switch(t){case 0:return this;case 1:return new mt(this.c1,2*this.c2,3*this.c3,0);case 2:return new mt(2*this.c2,6*this.c3,0,0);case 3:return new mt(6*this.c3,0,0,0);default:throw new Error("Unsupported derivative")}}eval(t,e=0){return e!==0?this.differentiate(e).eval(t):this.c3*(t*t*t)+this.c2*(t*t)+this.c1*t+this.c0}split(t){const e=1-t,r=new mt(this.c0,this.c1*t,this.c2*t*t,this.c3*t*t*t),i=new mt(this.eval(0),e*this.differentiate(1).eval(t),e*e/2*this.differentiate(2).eval(t),e*e*e/6*this.differentiate(3).eval(t));return[r,i]}roots(){switch(this.degree){case 3:return this.solveCubicRoots();case 2:return this.solveQuadraticRoots();case 1:return this.solveLinearRoot();case 0:return[];default:throw new Error(`Unsupported polynomial degree: ${this.degree}`)}}localExtrema(){return this.differentiate().roots()}localExtrema01(){const t=this.localExtrema(),e=[];for(let r=0;r=0&&i<=1&&e.push(t[r])}return e}outputRange01(){let t=[this.eval(0),this.eval(1)];const e=r=>{t[1]>t[0]?t=[Math.min(t[0],r),Math.max(t[1],r)]:t=[Math.min(t[1],r),Math.max(t[0],r)]};return this.localExtrema01().forEach(r=>e(this.eval(r))),t}solveCubicRoots(){const t=this.c0,e=this.c1,r=this.c2,i=this.c3,a=t*t,h=t*r,c=e*e,m=(3*h-c)/(3*a),y=(2*c*e-9*h*e+27*a*i)/(27*a*t),k=this.solveDepressedCubicRoots(m,y),F=X=>X-e/(3*t);switch(k.length){case 1:return[F(k[0])];case 2:return[F(k[0]),F(k[1])];case 3:return[F(k[0]),F(k[1]),F(k[2])];default:return[]}}solveDepressedCubicRoots(t,e){if(this.almostZero(t))return[Math.cbrt(-e)];const r=Math.PI*2,i=4*t*t*t+27*e*e;if(i<1e-5){const a=2*Math.sqrt(-t/3),h=3*e/(2*t)*Math.sqrt(-3/t),c=m=>a*Math.cos(1/3*Math.acos(wt(-1,1,h))-r/3*m);return h>=.9999?[c(0),c(2)]:h<=-.9999?[c(1),c(2)]:[c(0),c(1),c(2)]}if(i>0&&t<0){const a=.3333333333333333*Math.acosh(-3*Math.abs(e)/(2*t)*Math.sqrt(-3/t));return[-2*Math.sign(e)*Math.sqrt(-t/3)*Math.cosh(a)]}if(t>0){const a=.3333333333333333*Math.asinh(3*e/(2*t)*Math.sqrt(3/t));return[-2*Math.sqrt(t/3)*Math.sinh(a)]}return[]}solveQuadraticRoots(){const t=this.c2,e=this.c1,r=this.c0,i=e*e-4*t*r;if(this.almostZero(i))return[-e/(2*t)];if(i>=0){const a=Math.sqrt(i),h=(-e-a)/(2*t),c=(-e+a)/(2*t);return[Math.min(h,c),Math.max(h,c)]}return[]}solveLinearRoot(){return[-this.c0/this.c1]}almostZero(t){return Math.abs(0-t)<=Number.EPSILON}}class Ye{constructor(t,e,r,i){this.c0=t,this.c1=e,this.c2=r,this.c3=i,t instanceof mt?(this.x=t,this.y=e):i!==void 0?(this.x=new mt(t.x,e.x,r.x,i.x),this.y=new mt(t.y,e.y,r.y,i.y)):(this.x=new mt(t.x,e.x,r.x),this.y=new mt(t.y,e.y,r.y))}eval(t,e=0){return new g(this.x.differentiate(e).eval(t),this.y.differentiate(e).eval(t))}split(t){const[e,r]=this.x.split(t),[i,a]=this.y.split(t);return[new Ye(e,i),new Ye(r,a)]}differentiate(t=1){return new Ye(this.x.differentiate(t),this.y.differentiate(t))}evalDerivative(t){return this.differentiate().eval(t)}getBounds(){const t=this.x.outputRange01(),e=this.y.outputRange01();return Y.fromPoints(new g(Math.min(...t),Math.max(...e)),new g(Math.max(...t),Math.min(...e)))}}class yc{constructor(t,e=20){this.curve=t,this.sampledDistances=[],this.resample(e)}resample(t){this.sampledDistances=[0];let e=0,r=this.curve.eval(0).position;for(let i=1;i=i&&t<=a)return qu(i,a,r/(e-1),(r+1)/(e-1),t)}return 1}}class wc extends Pr{get arcLength(){return this.length}constructor(t,e){super(),this.curve=t,this.length=e,this.pointSampler=new yc(this)}getBBox(){return this.curve.getBounds()}eval(t){const e=this.tangent(t);return{position:this.curve.eval(t),tangent:e,normal:e.perpendicular}}getPoint(t){const e=this.pointSampler.pointAtDistance(this.arcLength*t);return{position:e.position,tangent:e.tangent,normal:e.tangent.perpendicular}}transformPoints(t){return this.points.map(e=>e.transformAsPoint(t))}tangent(t){return this.curve.evalDerivative(t).normalized}draw(t,e=0,r=1,i=!0){let a=null,h=e,c=r,m=this.points;if(e!==0||r!==1){const F=this.length*e,X=this.length*r;h=this.pointSampler.distanceToT(F),c=this.pointSampler.distanceToT(X);const Q=(c-h)/(1-h),[,at]=this.split(h);[a]=at.split(Q),m=a.points}i&&kr(t,m[0]),(a??this).doDraw(t);const y=this.tangent(h),k=this.tangent(c);return[{position:m[0],tangent:y,normal:y.perpendicular},{position:m.at(-1),tangent:k,normal:k.perpendicular}]}}var xc=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var c=n.length-1;c>=0;c--)(h=n[c])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};class Kt extends wc{get points(){return[this.p0,this.p1,this.p2,this.p3]}constructor(t,e,r,i){super(new Ye(t,t.flipped.add(e).scale(3),t.scale(3).sub(e.scale(6)).add(r.scale(3)),t.flipped.add(e.scale(3)).sub(r.scale(3)).add(i)),Kt.getLength(t,e,r,i)),this.p0=t,this.p1=e,this.p2=r,this.p3=i}split(t){const e=new g(this.p0.x+(this.p1.x-this.p0.x)*t,this.p0.y+(this.p1.y-this.p0.y)*t),r=new g(this.p1.x+(this.p2.x-this.p1.x)*t,this.p1.y+(this.p2.y-this.p1.y)*t),i=new g(this.p2.x+(this.p3.x-this.p2.x)*t,this.p2.y+(this.p3.y-this.p2.y)*t),a=new g(e.x+(r.x-e.x)*t,e.y+(r.y-e.y)*t),h=new g(r.x+(i.x-r.x)*t,r.y+(i.y-r.y)*t),c=new g(a.x+(h.x-a.x)*t,a.y+(h.y-a.y)*t),m=new Kt(this.p0,e,a,c),y=new Kt(c,h,i,this.p3);return[m,y]}doDraw(t){cc(t,this.p1,this.p2,this.p3)}static getLength(t,e,r,i){return Kt.el.setAttribute("d",`M ${t.x} ${t.y} C ${e.x} ${e.y} ${r.x} ${r.y} ${i.x} ${i.y}`),Kt.el.getTotalLength()}}xc([gs(()=>document.createElementNS("http://www.w3.org/2000/svg","path"))],Kt,"el",void 0);class ze extends Pr{constructor(t,e){super(),this.from=t,this.to=e,this.vector=e.sub(t),this.length=this.vector.magnitude,this.normal=this.vector.perpendicular.normalized.safe,this.points=[t,e]}get arcLength(){return this.length}draw(t,e=0,r=1,i=!1){const a=this.from.add(this.vector.scale(e)),h=this.from.add(this.vector.scale(r));return i&&kr(t,a),qt(t,h),[{position:a,tangent:this.normal.flipped,normal:this.normal},{position:h,tangent:this.normal,normal:this.normal}]}getPoint(t){return{position:this.from.add(this.vector.scale(t)),tangent:this.normal.flipped,normal:this.normal}}}function Cc(n,t,e,r){const i={arcLength:0,segments:[],minSin:1},a=ee(t.top,t.right,t.left,n),h=ee(t.right,t.top,t.bottom,n),c=ee(t.bottom,t.left,t.right,n),m=ee(t.left,t.bottom,t.top,n);let y=new g(n.left+a,n.top),k=new g(n.right-h,n.top);return Ie(i,new ze(y,k)),y=new g(n.right,n.top+h),k=new g(n.right,n.bottom-c),h>0&&pr(i,y.addX(-h),h,g.down,g.right,e,r),Ie(i,new ze(y,k)),y=new g(n.right-c,n.bottom),k=new g(n.left+m,n.bottom),c>0&&pr(i,y.addY(-c),c,g.right,g.up,e,r),Ie(i,new ze(y,k)),y=new g(n.left,n.bottom-m),k=new g(n.left,n.top+a),m>0&&pr(i,y.addX(m),m,g.up,g.left,e,r),Ie(i,new ze(y,k)),y=new g(n.left+a,n.top),a>0&&pr(i,y.addY(a),a,g.left,g.down,e,r),i}function Ie(n,t){n.segments.push(t),n.arcLength+=t.arcLength}function pr(n,t,e,r,i,a,h){const c=t.add(r.scale(e)),m=t.add(i.scale(e));a?Ie(n,new Kt(c,c.add(i.scale(h*e)),m.add(r.scale(h*e)),m)):Ie(n,new bc(t,e,r,i,!1))}var er=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var c=n.length-1;c>=0;c--)(h=n[c])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};let ne=class extends Ct{constructor(t){super(t)}profile(){return Cc(this.childrenBBox(),this.radius(),this.smoothCorners(),this.cornerSharpness())}desiredSize(){return{x:this.width.context.getter(),y:this.height.context.getter()}}offsetComputedLayout(t){return t}childrenBBox(){return Y.fromSizeCentered(this.computedSize())}getPath(){if(this.requiresProfile())return this.curveDrawingInfo().path;const t=new Path2D,e=this.radius(),r=this.smoothCorners(),i=this.cornerSharpness(),a=Y.fromSizeCentered(this.size());return di(t,a,e,r,i),t}getCacheBBox(){return super.getCacheBBox().expand(this.rippleSize())}getRipplePath(){const t=new Path2D,e=this.rippleSize(),r=this.radius().addScalar(e),i=this.smoothCorners(),a=this.cornerSharpness(),h=Y.fromSizeCentered(this.size()).expand(e);return di(t,h,r,i,a),t}};er([Tr("radius")],ne.prototype,"radius",void 0);er([A(!1),P()],ne.prototype,"smoothCorners",void 0);er([A(.6),P()],ne.prototype,"cornerSharpness",void 0);er([E()],ne.prototype,"profile",null);ne=er([Ce("Rect")],ne);var he=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var c=n.length-1;c>=0;c--)(h=n[c])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};class It extends I{constructor({children:t,...e}){super(e),this.scene()||this.scene(new I({})),t&&this.scene().add(t)}getZoom(){return 1/this.scale.x()}setZoom(t){this.scale(ge(t,e=>1/e))}getDefaultZoom(){return this.scale.x.context.getInitial()}*tweenZoom(t,e,r,i){const a=this.scale.x();yield*_t(e,h=>{this.zoom(1/i(a,1/me(t),r(h)))})}*reset(t,e=Et){yield*Fe(this.position(Xe,t,e),this.zoom(Xe,t,e),this.rotation(Xe,t,e))}*centerOn(t,e,r=Et,i=g.lerp){const a=t instanceof I?t.absolutePosition().transformAsPoint(this.scene().worldToLocal()):t;yield*this.position(a,e,r,i)}*followCurve(t,e,r=Et){yield*_t(e,i=>{const a=r(i),h=t.getPointAtPercentage(a).position.transformAsPoint(t.localToWorld());this.position(h)})}*followCurveReverse(t,e,r=Et){yield*_t(e,i=>{const a=1-r(i),h=t.getPointAtPercentage(a).position.transformAsPoint(t.localToWorld());this.position(h)})}*followCurveWithRotation(t,e,r=Et){yield*_t(e,i=>{const a=r(i),{position:h,normal:c}=t.getPointAtPercentage(a),m=h.transformAsPoint(t.localToWorld()),y=c.flipped.perpendicular.degrees;this.position(m),this.rotation(y)})}*followCurveWithRotationReverse(t,e,r=Et){yield*_t(e,i=>{const a=1-r(i),{position:h,normal:c}=t.getPointAtPercentage(a),m=h.transformAsPoint(t.localToWorld()),y=c.flipped.perpendicular.degrees;this.position(m),this.rotation(y)})}transformContext(t){const e=this.localToParent().inverse();t.transform(e.a,e.b,e.c,e.d,e.e,e.f)}hit(t){const e=t.transformAsPoint(this.localToParent());return this.scene().hit(e)}drawChildren(t){this.scene().drawChildren(t)}static Stage({children:t,cameraRef:e,scene:r,...i}){const a=new It({scene:r,children:t});return e==null||e(a),new ne({clip:!0,...i,children:[a]})}}he([P()],It.prototype,"scene",void 0);he([xe(!1),P()],It.prototype,"zoom",void 0);he([ut()],It.prototype,"reset",null);he([ut()],It.prototype,"centerOn",null);he([ut()],It.prototype,"followCurve",null);he([ut()],It.prototype,"followCurveReverse",null);he([ut()],It.prototype,"followCurveWithRotation",null);he([ut()],It.prototype,"followCurveWithRotationReverse",null);var rr=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var c=n.length-1;c>=0;c--)(h=n[c])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a},hs;let ie=hs=class extends ne{constructor(t){super({composite:!0,fontFamily:"Roboto",fontSize:48,lineHeight:"120%",textWrap:!1,fontStyle:"normal",...t}),this.view2D=this,hs.shadowRoot.append(this.element),this.applyFlex()}dispose(){this.removeChildren(),super.dispose()}render(t){this.computedSize(),this.computedPosition(),super.render(t)}findKey(t){return gr().getNode(t)??null}requestLayoutUpdate(){this.updateLayout()}requestFontUpdate(){this.applyFont()}view(){return this}};rr([A(Ze.Paused),P()],ie.prototype,"playbackState",void 0);rr([A(0),P()],ie.prototype,"globalTime",void 0);rr([P()],ie.prototype,"assetHash",void 0);rr([gs(()=>{const n="motion-canvas-2d-frame";let t=document.querySelector(`#${n}`);return t||(t=document.createElement("div"),t.id=n,t.style.position="absolute",t.style.pointerEvents="none",t.style.top="0",t.style.left="0",t.style.opacity="0",t.style.overflow="hidden",document.body.prepend(t)),t.shadowRoot??t.attachShadow({mode:"open"})})],ie,"shadowRoot",void 0);ie=hs=rr([Ce("View2D")],ie);var Sc=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var c=n.length-1;c>=0;c--)(h=n[c])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};class Ee extends Pr{constructor(t,e,r,i,a,h){super(),this.startPoint=t,this.radius=e,this.xAxisRotationDegree=r,this.largeArcFlag=i,this.sweepFlag=a,this.endPoint=h,this.xAxisRotation=this.xAxisRotationDegree*te,this.radius=new g(Math.abs(e.x),Math.abs(e.y));const c=t.sub(h).div(2).transform(rt.fromRotation(-r).domMatrix),m=c.x*c.x/(e.x*e.x)+c.y*c.y/(e.y*e.y);if(m>1){const Q=Math.sqrt(m);e.x=Q*e.x,e.y=Q*e.y}const y=new g(e.ctg*c.y,e.perpendicular.ctg*c.x).scale(Math.sqrt(1/(c.x*c.x/(e.x*e.x)+c.y*c.y/(e.y*e.y))-1)*(i===a?-1:1));this.xAxisRotationMatrix=rt.fromRotation(r).domMatrix,this.center=y.transform(this.xAxisRotationMatrix).add(t.add(h).div(2));const k=c.sub(y).div(e),F=c.scale(-1).sub(y).div(e);this.startAngle=k.radians,this.deltaAngle=g.angleBetween(k,F)%(Math.PI*2),this.sweepFlag===0&&this.deltaAngle>0&&(this.deltaAngle-=Math.PI*2),this.sweepFlag===1&&this.deltaAngle<0&&(this.deltaAngle+=Math.PI*2),Ee.el.setAttribute("d",`M ${this.startPoint.x} ${this.startPoint.y} A ${this.radius.x} ${this.radius.y} ${this.xAxisRotationDegree} ${this.largeArcFlag} ${this.sweepFlag} ${this.endPoint.x} ${this.endPoint.y}`),this.length=Ee.el.getTotalLength();const X=new Y(Ee.el.getBBox());this.points=[X.topLeft,X.bottomRight]}getAnglePosition(t){return this.radius.mul(g.fromRadians(t)).transform(this.xAxisRotationMatrix).add(this.center)}getAngleDerivative(t){return new g(-this.radius.x*Math.sin(t),this.radius.y*Math.cos(t)).transform(this.xAxisRotationMatrix)}draw(t,e,r,i){const a=this.startAngle+this.deltaAngle*e,h=this.startAngle+this.deltaAngle*r,c=this.getPoint(e),m=this.getPoint(r);return i&&t.moveTo(c.position.x,c.position.y),t.ellipse(this.center.x,this.center.y,this.radius.x,this.radius.y,this.xAxisRotation,a,h,this.sweepFlag===0),[c,m]}getPoint(t){const e=this.startAngle+t*this.deltaAngle,r=this.getAngleDerivative(e).normalized;return{position:t===0?this.startPoint:t===1?this.endPoint:this.getAnglePosition(e),tangent:r,normal:r.perpendicular}}get arcLength(){return this.length}}Sc([gs(()=>{const n=document.createElementNS("http://www.w3.org/2000/svg","svg"),t=document.createElementNS("http://www.w3.org/2000/svg","path");return n.appendChild(t),ie.shadowRoot.appendChild(n),t})],Ee,"el",void 0);function kc(n,t,e,r,i=!1){const a={arcLength:0,minSin:1,segments:[]};if(et+Math.PI*2){const k=Math.floor((e-t)/(Math.PI*2));e-=Math.PI*2*k}const h=(t+e)/2,c=n.mul(g.fromRadians(t)),m=n.mul(g.fromRadians(e)),y=n.mul(g.fromRadians(h)).scale(i?-1:1);return r&&us(a,new ze(g.zero,c)),gi(a,n,c,y,t,h,i),gi(a,n,y,m,h,e,i),r&&us(a,new ze(m,g.zero)),a}function us(n,t){n.segments.push(t),n.arcLength+=t.arcLength}function gi(n,t,e,r,i,a,h){const c=Math.abs(i-a)<=180?1:0,m=i>a?0:1,y=h?0:1;us(n,new Ee(e,t,0,0,c^y^m,r))}var sr=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var c=n.length-1;c>=0;c--)(h=n[c])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};let ye=class extends Ct{constructor(t){super(t)}profile(){return kc(this.size().scale(.5),this.startAngle()*te,this.endAngle()*te,this.closed(),this.counterclockwise())}desiredSize(){return{x:this.width.context.getter(),y:this.height.context.getter()}}offsetComputedLayout(t){return t}childrenBBox(){return Y.fromSizeCentered(this.computedSize())}getPath(){return this.requiresProfile()?this.curveDrawingInfo().path:this.createPath()}getRipplePath(){return this.createPath(this.rippleSize())}getCacheBBox(){return super.getCacheBBox().expand(this.rippleSize())}createPath(t=0){const e=new Path2D,r=this.startAngle()*te;let i=this.endAngle()*te;const a=this.size().scale(.5).add(t),h=this.closed();if(i>r+Math.PI*2){const c=Math.floor((i-r)/(Math.PI*2));i-=Math.PI*2*c}return h&&e.moveTo(0,0),e.ellipse(0,0,a.x,a.y,0,r,i,this.counterclockwise()),h&&e.closePath(),e}};sr([A(0),P()],ye.prototype,"startAngle",void 0);sr([A(360),P()],ye.prototype,"endAngle",void 0);sr([A(!1),P()],ye.prototype,"counterclockwise",void 0);sr([E()],ye.prototype,"profile",null);ye=sr([Ce("Circle")],ye);class Tc extends Bu{constructor(t){super(t),this.view=null,this.registeredNodes=new Map,this.nodeCounters=new Map,this.assetHash=Date.now().toString(),this.recreateView()}getView(){return this.view}next(){var t;return(t=this.getView())==null||t.playbackState(this.playback.state).globalTime(this.playback.time),super.next()}draw(t){t.save(),this.renderLifecycle.dispatch([Dt.BeforeRender,t]),t.save(),this.renderLifecycle.dispatch([Dt.BeginRender,t]),this.getView().playbackState(this.playback.state).globalTime(this.playback.time),this.getView().render(t),this.renderLifecycle.dispatch([Dt.FinishRender,t]),t.restore(),this.renderLifecycle.dispatch([Dt.AfterRender,t]),t.restore()}reset(t){for(const e of this.registeredNodes.keys())try{this.registeredNodes.get(e).dispose()}catch(r){this.logger.error(r)}return this.registeredNodes.clear(),this.registeredNodes=new Map,this.nodeCounters.clear(),this.recreateView(),super.reset(t)}inspectPosition(t,e){return this.execute(()=>{var r;return((r=this.getView().hit(new g(t,e)))==null?void 0:r.key)??null})}validateInspection(t){var e;return((e=this.getNode(t))==null?void 0:e.key)??null}inspectAttributes(t){const e=this.getNode(t);if(!e)return null;const r={stack:e.creationStack,key:e.key};for(const{key:i,meta:a,signal:h}of e)a.inspectable&&(r[i]=h());return r}drawOverlay(t,e,r){const i=this.getNode(t);i&&this.execute(()=>{const a=this.getView().findAll(zi(It)),h=[];for(const c of a){const m=c.scene();m&&(m===i||m.findFirst(y=>y===i))&&h.push(c)}if(h.length>0)for(const c of h){const m=c.parentToWorld(),y=c.localToParent().inverse(),k=i.localToWorld();i.drawOverlay(r,e.multiply(m).multiply(y).multiply(k))}else i.drawOverlay(r,e.multiply(i.localToWorld()))})}transformMousePosition(t,e){return new g(t,e).transformAsPoint(this.getView().localToParent().inverse())}registerNode(t,e){var h;const r=((h=t.constructor)==null?void 0:h.name)??"unknown",i=(this.nodeCounters.get(r)??0)+1;this.nodeCounters.set(r,i),e&&this.registeredNodes.has(e)&&(vt().error({message:`Duplicated node key: "${e}".`,inspect:e,stack:new Error().stack}),e=void 0),e??(e=`${this.name}/${r}[${i}]`),this.registeredNodes.set(e,t);const a=this.registeredNodes;return[e,()=>a.delete(e)]}getNode(t){return typeof t!="string"?null:this.registeredNodes.get(t)??null}*getDetachedNodes(){for(const t of this.registeredNodes.values())!t.parent()&&t!==this.view&&(yield t)}recreateView(){this.execute(()=>{const t=this.getSize();this.view=new ie({position:t.scale(this.resolutionScale/2),scale:this.resolutionScale,assetHash:this.assetHash,size:t})})}}function Pc(n){return{klass:Tc,config:n,stack:new Error().stack,meta:Nu(),plugins:["@motion-canvas/2d/editor"]}}const pe=Pc(function*(n){const t=du();n.add(nc(ye,{ref:t,size:320,fill:"lightseagreen"})),yield*t().scale(2,2).to(1,2)});pe.name="example";ec.attach(pe.meta);pe.onReplaced??(pe.onReplaced=new re(pe.config));const Rc={scenes:[pe]};let Ss;Ss??(Ss=new Je("\0virtual:settings",!1));Ss.loadData({version:1,appearance:{color:"rgb(0,144,255)",font:!1,coordinates:!0},defaults:{background:"rgba(255,0,0,0)",size:{x:1920,y:1080}}});const Mc=Ss,Ec=yu("project",{core:"3.17.2",two:"3.17.2",ui:"3.17.2",vitePlugin:"3.17.2"},[Ku()],Rc,tc,Mc);export{Ec as default}; + */(function(n,t){(function(e,r){n.exports=r()})(iu,function(){for(var e=function(s,o,l){return o===void 0&&(o=0),l===void 0&&(l=1),sl?l:s},r=e,i=function(s){s._clipped=!1,s._unclipped=s.slice(0);for(var o=0;o<=3;o++)o<3?((s[o]<0||s[o]>255)&&(s._clipped=!0),s[o]=r(s[o],0,255)):o===3&&(s[o]=r(s[o],0,1));return s},a={},h=0,u=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];h=3?Array.prototype.slice.call(s):C(s[0])=="object"&&o?o.split("").filter(function(l){return s[0][l]!==void 0}).map(function(l){return s[0][l]}):s[0]},H=y,J=function(s){if(s.length<2)return null;var o=s.length-1;return H(s[o])=="string"?s[o].toLowerCase():null},et=Math.PI,T={clip_rgb:i,limit:e,type:y,unpack:F,last:J,PI:et,TWOPI:et*2,PITHIRD:et/3,DEG2RAD:et/180,RAD2DEG:180/et},rt={format:{},autodetect:[]},ht=T.last,K=T.clip_rgb,ce=T.type,Ft=rt,$n=function(){for(var o=[],l=arguments.length;l--;)o[l]=arguments[l];var c=this;if(ce(o[0])==="object"&&o[0].constructor&&o[0].constructor===this.constructor)return o[0];var d=ht(o),p=!1;if(!d){p=!0,Ft.sorted||(Ft.autodetect=Ft.autodetect.sort(function(x,P){return P.p-x.p}),Ft.sorted=!0);for(var f=0,m=Ft.autodetect;f4?s[4]:1;return p===1?[0,0,0,f]:[l>=1?0:255*(1-l)*(1-p),c>=1?0:255*(1-c)*(1-p),d>=1?0:255*(1-d)*(1-p),f]},Hi=Xi,Yi=ct,An=D,On=rt,Zi=T.unpack,Vi=T.type,Ji=Gi;An.prototype.cmyk=function(){return Ji(this._rgb)},Yi.cmyk=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(An,[null].concat(s,["cmyk"])))},On.format.cmyk=Hi,On.autodetect.push({p:2,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=Zi(s,"cmyk"),Vi(s)==="array"&&s.length===4)return"cmyk"}});var Qi=T.unpack,Ki=T.last,Ir=function(s){return Math.round(s*100)/100},ta=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=Qi(s,"hsla"),c=Ki(s)||"lsa";return l[0]=Ir(l[0]||0),l[1]=Ir(l[1]*100)+"%",l[2]=Ir(l[2]*100)+"%",c==="hsla"||l.length>3&&l[3]<1?(l[3]=l.length>3?l[3]:1,c="hsla"):l.length=3,c+"("+l.join(",")+")"},ea=ta,ra=T.unpack,na=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];s=ra(s,"rgba");var l=s[0],c=s[1],d=s[2];l/=255,c/=255,d/=255;var p=Math.min(l,c,d),f=Math.max(l,c,d),m=(f+p)/2,b,w;return f===p?(b=0,w=Number.NaN):b=m<.5?(f-p)/(f+p):(f-p)/(2-f-p),l==f?w=(c-d)/(f-p):c==f?w=2+(d-l)/(f-p):d==f&&(w=4+(l-c)/(f-p)),w*=60,w<0&&(w+=360),s.length>3&&s[3]!==void 0?[w,b,m,s[3]]:[w,b,m]},zn=na,sa=T.unpack,ia=T.last,aa=ea,oa=zn,Ar=Math.round,la=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=sa(s,"rgba"),c=ia(s)||"rgb";return c.substr(0,3)=="hsl"?aa(oa(l),c):(l[0]=Ar(l[0]),l[1]=Ar(l[1]),l[2]=Ar(l[2]),(c==="rgba"||l.length>3&&l[3]<1)&&(l[3]=l.length>3?l[3]:1,c="rgba"),c+"("+l.slice(0,c==="rgb"?3:4).join(",")+")")},ha=la,ca=T.unpack,Or=Math.round,ua=function(){for(var s,o=[],l=arguments.length;l--;)o[l]=arguments[l];o=ca(o,"hsl");var c=o[0],d=o[1],p=o[2],f,m,b;if(d===0)f=m=b=p*255;else{var w=[0,0,0],x=[0,0,0],P=p<.5?p*(1+d):p+d-p*d,S=2*p-P,L=c/360;w[0]=L+1/3,w[1]=L,w[2]=L-1/3;for(var M=0;M<3;M++)w[M]<0&&(w[M]+=1),w[M]>1&&(w[M]-=1),6*w[M]<1?x[M]=S+(P-S)*6*w[M]:2*w[M]<1?x[M]=P:3*w[M]<2?x[M]=S+(P-S)*(2/3-w[M])*6:x[M]=S;s=[Or(x[0]*255),Or(x[1]*255),Or(x[2]*255)],f=s[0],m=s[1],b=s[2]}return o.length>3?[f,m,b,o[3]]:[f,m,b,1]},En=ua,Fn=En,_n=rt,Dn=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,jn=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,Nn=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,Bn=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,Un=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,Wn=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,Gn=Math.round,qn=function(s){s=s.toLowerCase().trim();var o;if(_n.format.named)try{return _n.format.named(s)}catch{}if(o=s.match(Dn)){for(var l=o.slice(1,4),c=0;c<3;c++)l[c]=+l[c];return l[3]=1,l}if(o=s.match(jn)){for(var d=o.slice(1,5),p=0;p<4;p++)d[p]=+d[p];return d}if(o=s.match(Nn)){for(var f=o.slice(1,4),m=0;m<3;m++)f[m]=Gn(f[m]*2.55);return f[3]=1,f}if(o=s.match(Bn)){for(var b=o.slice(1,5),w=0;w<3;w++)b[w]=Gn(b[w]*2.55);return b[3]=+b[3],b}if(o=s.match(Un)){var x=o.slice(1,4);x[1]*=.01,x[2]*=.01;var P=Fn(x);return P[3]=1,P}if(o=s.match(Wn)){var S=o.slice(1,4);S[1]*=.01,S[2]*=.01;var L=Fn(S);return L[3]=+o[4],L}};qn.test=function(s){return Dn.test(s)||jn.test(s)||Nn.test(s)||Bn.test(s)||Un.test(s)||Wn.test(s)};var fa=qn,da=ct,Xn=D,Hn=rt,pa=T.type,ga=ha,Yn=fa;Xn.prototype.css=function(s){return ga(this._rgb,s)},da.css=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(Xn,[null].concat(s,["css"])))},Hn.format.css=Yn,Hn.autodetect.push({p:5,test:function(s){for(var o=[],l=arguments.length-1;l-- >0;)o[l]=arguments[l+1];if(!o.length&&pa(s)==="string"&&Yn.test(s))return"css"}});var Zn=D,va=ct,ma=rt,ba=T.unpack;ma.format.gl=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=ba(s,"rgba");return l[0]*=255,l[1]*=255,l[2]*=255,l},va.gl=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(Zn,[null].concat(s,["gl"])))},Zn.prototype.gl=function(){var s=this._rgb;return[s[0]/255,s[1]/255,s[2]/255,s[3]]};var ya=T.unpack,wa=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=ya(s,"rgb"),c=l[0],d=l[1],p=l[2],f=Math.min(c,d,p),m=Math.max(c,d,p),b=m-f,w=b*100/255,x=f/(255-b)*100,P;return b===0?P=Number.NaN:(c===m&&(P=(d-p)/b),d===m&&(P=2+(p-c)/b),p===m&&(P=4+(c-d)/b),P*=60,P<0&&(P+=360)),[P,w,x]},xa=wa,Sa=T.unpack,ka=Math.floor,Ca=function(){for(var s,o,l,c,d,p,f=[],m=arguments.length;m--;)f[m]=arguments[m];f=Sa(f,"hcg");var b=f[0],w=f[1],x=f[2],P,S,L;x=x*255;var M=w*255;if(w===0)P=S=L=x;else{b===360&&(b=0),b>360&&(b-=360),b<0&&(b+=360),b/=60;var j=ka(b),U=b-j,G=x*(1-w),X=G+M*(1-U),gt=G+M*U,pt=G+M;switch(j){case 0:s=[pt,gt,G],P=s[0],S=s[1],L=s[2];break;case 1:o=[X,pt,G],P=o[0],S=o[1],L=o[2];break;case 2:l=[G,pt,gt],P=l[0],S=l[1],L=l[2];break;case 3:c=[G,X,pt],P=c[0],S=c[1],L=c[2];break;case 4:d=[gt,G,pt],P=d[0],S=d[1],L=d[2];break;case 5:p=[pt,G,X],P=p[0],S=p[1],L=p[2];break}}return[P,S,L,f.length>3?f[3]:1]},Ta=Ca,Ra=T.unpack,Pa=T.type,Ma=ct,Vn=D,Jn=rt,La=xa;Vn.prototype.hcg=function(){return La(this._rgb)},Ma.hcg=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(Vn,[null].concat(s,["hcg"])))},Jn.format.hcg=Ta,Jn.autodetect.push({p:1,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=Ra(s,"hcg"),Pa(s)==="array"&&s.length===3)return"hcg"}});var $a=T.unpack,Ia=T.last,lr=Math.round,Aa=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=$a(s,"rgba"),c=l[0],d=l[1],p=l[2],f=l[3],m=Ia(s)||"auto";f===void 0&&(f=1),m==="auto"&&(m=f<1?"rgba":"rgb"),c=lr(c),d=lr(d),p=lr(p);var b=c<<16|d<<8|p,w="000000"+b.toString(16);w=w.substr(w.length-6);var x="0"+lr(f*255).toString(16);switch(x=x.substr(x.length-2),m.toLowerCase()){case"rgba":return"#"+w+x;case"argb":return"#"+x+w;default:return"#"+w}},Qn=Aa,Oa=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,za=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,Ea=function(s){if(s.match(Oa)){(s.length===4||s.length===7)&&(s=s.substr(1)),s.length===3&&(s=s.split(""),s=s[0]+s[0]+s[1]+s[1]+s[2]+s[2]);var o=parseInt(s,16),l=o>>16,c=o>>8&255,d=o&255;return[l,c,d,1]}if(s.match(za)){(s.length===5||s.length===9)&&(s=s.substr(1)),s.length===4&&(s=s.split(""),s=s[0]+s[0]+s[1]+s[1]+s[2]+s[2]+s[3]+s[3]);var p=parseInt(s,16),f=p>>24&255,m=p>>16&255,b=p>>8&255,w=Math.round((p&255)/255*100)/100;return[f,m,b,w]}throw new Error("unknown hex color: "+s)},Kn=Ea,Fa=ct,ts=D,_a=T.type,es=rt,Da=Qn;ts.prototype.hex=function(s){return Da(this._rgb,s)},Fa.hex=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(ts,[null].concat(s,["hex"])))},es.format.hex=Kn,es.autodetect.push({p:4,test:function(s){for(var o=[],l=arguments.length-1;l-- >0;)o[l]=arguments[l+1];if(!o.length&&_a(s)==="string"&&[3,4,5,6,7,8,9].indexOf(s.length)>=0)return"hex"}});var ja=T.unpack,rs=T.TWOPI,Na=Math.min,Ba=Math.sqrt,Ua=Math.acos,Wa=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=ja(s,"rgb"),c=l[0],d=l[1],p=l[2];c/=255,d/=255,p/=255;var f,m=Na(c,d,p),b=(c+d+p)/3,w=b>0?1-m/b:0;return w===0?f=NaN:(f=(c-d+(c-p))/2,f/=Ba((c-d)*(c-d)+(c-p)*(d-p)),f=Ua(f),p>d&&(f=rs-f),f/=rs),[f*360,w,b]},Ga=Wa,qa=T.unpack,zr=T.limit,Te=T.TWOPI,Er=T.PITHIRD,Re=Math.cos,Xa=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];s=qa(s,"hsi");var l=s[0],c=s[1],d=s[2],p,f,m;return isNaN(l)&&(l=0),isNaN(c)&&(c=0),l>360&&(l-=360),l<0&&(l+=360),l/=360,l<1/3?(m=(1-c)/3,p=(1+c*Re(Te*l)/Re(Er-Te*l))/3,f=1-(m+p)):l<2/3?(l-=1/3,p=(1-c)/3,f=(1+c*Re(Te*l)/Re(Er-Te*l))/3,m=1-(p+f)):(l-=2/3,f=(1-c)/3,m=(1+c*Re(Te*l)/Re(Er-Te*l))/3,p=1-(f+m)),p=zr(d*p*3),f=zr(d*f*3),m=zr(d*m*3),[p*255,f*255,m*255,s.length>3?s[3]:1]},Ha=Xa,Ya=T.unpack,Za=T.type,Va=ct,ns=D,ss=rt,Ja=Ga;ns.prototype.hsi=function(){return Ja(this._rgb)},Va.hsi=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(ns,[null].concat(s,["hsi"])))},ss.format.hsi=Ha,ss.autodetect.push({p:2,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=Ya(s,"hsi"),Za(s)==="array"&&s.length===3)return"hsi"}});var Qa=T.unpack,Ka=T.type,to=ct,is=D,as=rt,eo=zn;is.prototype.hsl=function(){return eo(this._rgb)},to.hsl=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(is,[null].concat(s,["hsl"])))},as.format.hsl=En,as.autodetect.push({p:2,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=Qa(s,"hsl"),Ka(s)==="array"&&s.length===3)return"hsl"}});var ro=T.unpack,no=Math.min,so=Math.max,io=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];s=ro(s,"rgb");var l=s[0],c=s[1],d=s[2],p=no(l,c,d),f=so(l,c,d),m=f-p,b,w,x;return x=f/255,f===0?(b=Number.NaN,w=0):(w=m/f,l===f&&(b=(c-d)/m),c===f&&(b=2+(d-l)/m),d===f&&(b=4+(l-c)/m),b*=60,b<0&&(b+=360)),[b,w,x]},ao=io,oo=T.unpack,lo=Math.floor,ho=function(){for(var s,o,l,c,d,p,f=[],m=arguments.length;m--;)f[m]=arguments[m];f=oo(f,"hsv");var b=f[0],w=f[1],x=f[2],P,S,L;if(x*=255,w===0)P=S=L=x;else{b===360&&(b=0),b>360&&(b-=360),b<0&&(b+=360),b/=60;var M=lo(b),j=b-M,U=x*(1-w),G=x*(1-w*j),X=x*(1-w*(1-j));switch(M){case 0:s=[x,X,U],P=s[0],S=s[1],L=s[2];break;case 1:o=[G,x,U],P=o[0],S=o[1],L=o[2];break;case 2:l=[U,x,X],P=l[0],S=l[1],L=l[2];break;case 3:c=[U,G,x],P=c[0],S=c[1],L=c[2];break;case 4:d=[X,U,x],P=d[0],S=d[1],L=d[2];break;case 5:p=[x,U,G],P=p[0],S=p[1],L=p[2];break}}return[P,S,L,f.length>3?f[3]:1]},co=ho,uo=T.unpack,fo=T.type,po=ct,os=D,ls=rt,go=ao;os.prototype.hsv=function(){return go(this._rgb)},po.hsv=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(os,[null].concat(s,["hsv"])))},ls.format.hsv=co,ls.autodetect.push({p:2,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=uo(s,"hsv"),fo(s)==="array"&&s.length===3)return"hsv"}});var hr={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},Pe=hr,vo=T.unpack,hs=Math.pow,mo=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=vo(s,"rgb"),c=l[0],d=l[1],p=l[2],f=bo(c,d,p),m=f[0],b=f[1],w=f[2],x=116*b-16;return[x<0?0:x,500*(m-b),200*(b-w)]},Fr=function(s){return(s/=255)<=.04045?s/12.92:hs((s+.055)/1.055,2.4)},_r=function(s){return s>Pe.t3?hs(s,1/3):s/Pe.t2+Pe.t0},bo=function(s,o,l){s=Fr(s),o=Fr(o),l=Fr(l);var c=_r((.4124564*s+.3575761*o+.1804375*l)/Pe.Xn),d=_r((.2126729*s+.7151522*o+.072175*l)/Pe.Yn),p=_r((.0193339*s+.119192*o+.9503041*l)/Pe.Zn);return[c,d,p]},cs=mo,Me=hr,yo=T.unpack,wo=Math.pow,xo=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];s=yo(s,"lab");var l=s[0],c=s[1],d=s[2],p,f,m,b,w,x;return f=(l+16)/116,p=isNaN(c)?f:f+c/500,m=isNaN(d)?f:f-d/200,f=Me.Yn*jr(f),p=Me.Xn*jr(p),m=Me.Zn*jr(m),b=Dr(3.2404542*p-1.5371385*f-.4985314*m),w=Dr(-.969266*p+1.8760108*f+.041556*m),x=Dr(.0556434*p-.2040259*f+1.0572252*m),[b,w,x,s.length>3?s[3]:1]},Dr=function(s){return 255*(s<=.00304?12.92*s:1.055*wo(s,1/2.4)-.055)},jr=function(s){return s>Me.t1?s*s*s:Me.t2*(s-Me.t0)},us=xo,So=T.unpack,ko=T.type,Co=ct,fs=D,ds=rt,To=cs;fs.prototype.lab=function(){return To(this._rgb)},Co.lab=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(fs,[null].concat(s,["lab"])))},ds.format.lab=us,ds.autodetect.push({p:2,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=So(s,"lab"),ko(s)==="array"&&s.length===3)return"lab"}});var Ro=T.unpack,Po=T.RAD2DEG,Mo=Math.sqrt,Lo=Math.atan2,$o=Math.round,Io=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=Ro(s,"lab"),c=l[0],d=l[1],p=l[2],f=Mo(d*d+p*p),m=(Lo(p,d)*Po+360)%360;return $o(f*1e4)===0&&(m=Number.NaN),[c,f,m]},ps=Io,Ao=T.unpack,Oo=cs,zo=ps,Eo=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=Ao(s,"rgb"),c=l[0],d=l[1],p=l[2],f=Oo(c,d,p),m=f[0],b=f[1],w=f[2];return zo(m,b,w)},Fo=Eo,_o=T.unpack,Do=T.DEG2RAD,jo=Math.sin,No=Math.cos,Bo=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=_o(s,"lch"),c=l[0],d=l[1],p=l[2];return isNaN(p)&&(p=0),p=p*Do,[c,No(p)*d,jo(p)*d]},gs=Bo,Uo=T.unpack,Wo=gs,Go=us,qo=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];s=Uo(s,"lch");var l=s[0],c=s[1],d=s[2],p=Wo(l,c,d),f=p[0],m=p[1],b=p[2],w=Go(f,m,b),x=w[0],P=w[1],S=w[2];return[x,P,S,s.length>3?s[3]:1]},vs=qo,Xo=T.unpack,Ho=vs,Yo=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=Xo(s,"hcl").reverse();return Ho.apply(void 0,l)},Zo=Yo,Vo=T.unpack,Jo=T.type,ms=ct,cr=D,Nr=rt,bs=Fo;cr.prototype.lch=function(){return bs(this._rgb)},cr.prototype.hcl=function(){return bs(this._rgb).reverse()},ms.lch=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(cr,[null].concat(s,["lch"])))},ms.hcl=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(cr,[null].concat(s,["hcl"])))},Nr.format.lch=vs,Nr.format.hcl=Zo,["lch","hcl"].forEach(function(s){return Nr.autodetect.push({p:2,test:function(){for(var o=[],l=arguments.length;l--;)o[l]=arguments[l];if(o=Vo(o,s),Jo(o)==="array"&&o.length===3)return s}})});var Qo={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflower:"#6495ed",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},ys=Qo,Ko=D,ws=rt,tl=T.type,Be=ys,el=Kn,rl=Qn;Ko.prototype.name=function(){for(var s=rl(this._rgb,"rgb"),o=0,l=Object.keys(Be);o0;)o[l]=arguments[l+1];if(!o.length&&tl(s)==="string"&&Be[s.toLowerCase()])return"named"}});var nl=T.unpack,sl=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=nl(s,"rgb"),c=l[0],d=l[1],p=l[2];return(c<<16)+(d<<8)+p},il=sl,al=T.type,ol=function(s){if(al(s)=="number"&&s>=0&&s<=16777215){var o=s>>16,l=s>>8&255,c=s&255;return[o,l,c,1]}throw new Error("unknown num color: "+s)},ll=ol,hl=ct,xs=D,Ss=rt,cl=T.type,ul=il;xs.prototype.num=function(){return ul(this._rgb)},hl.num=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(xs,[null].concat(s,["num"])))},Ss.format.num=ll,Ss.autodetect.push({p:5,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s.length===1&&cl(s[0])==="number"&&s[0]>=0&&s[0]<=16777215)return"num"}});var fl=ct,Br=D,ks=rt,Cs=T.unpack,Ts=T.type,Rs=Math.round;Br.prototype.rgb=function(s){return s===void 0&&(s=!0),s===!1?this._rgb.slice(0,3):this._rgb.slice(0,3).map(Rs)},Br.prototype.rgba=function(s){return s===void 0&&(s=!0),this._rgb.slice(0,4).map(function(o,l){return l<3?s===!1?o:Rs(o):o})},fl.rgb=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(Br,[null].concat(s,["rgb"])))},ks.format.rgb=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=Cs(s,"rgba");return l[3]===void 0&&(l[3]=1),l},ks.autodetect.push({p:3,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=Cs(s,"rgba"),Ts(s)==="array"&&(s.length===3||s.length===4&&Ts(s[3])=="number"&&s[3]>=0&&s[3]<=1))return"rgb"}});var ur=Math.log,dl=function(s){var o=s/100,l,c,d;return o<66?(l=255,c=o<6?0:-155.25485562709179-.44596950469579133*(c=o-2)+104.49216199393888*ur(c),d=o<20?0:-254.76935184120902+.8274096064007395*(d=o-10)+115.67994401066147*ur(d)):(l=351.97690566805693+.114206453784165*(l=o-55)-40.25366309332127*ur(l),c=325.4494125711974+.07943456536662342*(c=o-50)-28.0852963507957*ur(c),d=255),[l,c,d,1]},Ps=dl,pl=Ps,gl=T.unpack,vl=Math.round,ml=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];for(var l=gl(s,"rgb"),c=l[0],d=l[2],p=1e3,f=4e4,m=.4,b;f-p>m;){b=(f+p)*.5;var w=pl(b);w[2]/w[0]>=d/c?f=b:p=b}return vl(b)},bl=ml,Ur=ct,fr=D,Wr=rt,yl=bl;fr.prototype.temp=fr.prototype.kelvin=fr.prototype.temperature=function(){return yl(this._rgb)},Ur.temp=Ur.kelvin=Ur.temperature=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(fr,[null].concat(s,["temp"])))},Wr.format.temp=Wr.format.kelvin=Wr.format.temperature=Ps;var wl=T.unpack,Gr=Math.cbrt,xl=Math.pow,Sl=Math.sign,kl=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=wl(s,"rgb"),c=l[0],d=l[1],p=l[2],f=[qr(c/255),qr(d/255),qr(p/255)],m=f[0],b=f[1],w=f[2],x=Gr(.4122214708*m+.5363325363*b+.0514459929*w),P=Gr(.2119034982*m+.6806995451*b+.1073969566*w),S=Gr(.0883024619*m+.2817188376*b+.6299787005*w);return[.2104542553*x+.793617785*P-.0040720468*S,1.9779984951*x-2.428592205*P+.4505937099*S,.0259040371*x+.7827717662*P-.808675766*S]},Ms=kl;function qr(s){var o=Math.abs(s);return o<.04045?s/12.92:(Sl(s)||1)*xl((o+.055)/1.055,2.4)}var Cl=T.unpack,dr=Math.pow,Tl=Math.sign,Rl=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];s=Cl(s,"lab");var l=s[0],c=s[1],d=s[2],p=dr(l+.3963377774*c+.2158037573*d,3),f=dr(l-.1055613458*c-.0638541728*d,3),m=dr(l-.0894841775*c-1.291485548*d,3);return[255*Xr(4.0767416621*p-3.3077115913*f+.2309699292*m),255*Xr(-1.2684380046*p+2.6097574011*f-.3413193965*m),255*Xr(-.0041960863*p-.7034186147*f+1.707614701*m),s.length>3?s[3]:1]},Ls=Rl;function Xr(s){var o=Math.abs(s);return o>.0031308?(Tl(s)||1)*(1.055*dr(o,1/2.4)-.055):s*12.92}var Pl=T.unpack,Ml=T.type,Ll=ct,$s=D,Is=rt,$l=Ms;$s.prototype.oklab=function(){return $l(this._rgb)},Ll.oklab=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply($s,[null].concat(s,["oklab"])))},Is.format.oklab=Ls,Is.autodetect.push({p:3,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=Pl(s,"oklab"),Ml(s)==="array"&&s.length===3)return"oklab"}});var Il=T.unpack,Al=Ms,Ol=ps,zl=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];var l=Il(s,"rgb"),c=l[0],d=l[1],p=l[2],f=Al(c,d,p),m=f[0],b=f[1],w=f[2];return Ol(m,b,w)},El=zl,Fl=T.unpack,_l=gs,Dl=Ls,jl=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];s=Fl(s,"lch");var l=s[0],c=s[1],d=s[2],p=_l(l,c,d),f=p[0],m=p[1],b=p[2],w=Dl(f,m,b),x=w[0],P=w[1],S=w[2];return[x,P,S,s.length>3?s[3]:1]},Nl=jl,Bl=T.unpack,Ul=T.type,Wl=ct,As=D,Os=rt,Gl=El;As.prototype.oklch=function(){return Gl(this._rgb)},Wl.oklch=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];return new(Function.prototype.bind.apply(As,[null].concat(s,["oklch"])))},Os.format.oklch=Nl,Os.autodetect.push({p:3,test:function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];if(s=Bl(s,"oklch"),Ul(s)==="array"&&s.length===3)return"oklch"}});var zs=D,ql=T.type;zs.prototype.alpha=function(s,o){return o===void 0&&(o=!1),s!==void 0&&ql(s)==="number"?o?(this._rgb[3]=s,this):new zs([this._rgb[0],this._rgb[1],this._rgb[2],s],"rgb"):this._rgb[3]};var Xl=D;Xl.prototype.clipped=function(){return this._rgb._clipped||!1};var ue=D,Hl=hr;ue.prototype.darken=function(s){s===void 0&&(s=1);var o=this,l=o.lab();return l[0]-=Hl.Kn*s,new ue(l,"lab").alpha(o.alpha(),!0)},ue.prototype.brighten=function(s){return s===void 0&&(s=1),this.darken(-s)},ue.prototype.darker=ue.prototype.darken,ue.prototype.brighter=ue.prototype.brighten;var Yl=D;Yl.prototype.get=function(s){var o=s.split("."),l=o[0],c=o[1],d=this[l]();if(c){var p=l.indexOf(c)-(l.substr(0,2)==="ok"?2:0);if(p>-1)return d[p];throw new Error("unknown channel "+c+" in mode "+l)}else return d};var Le=D,Zl=T.type,Vl=Math.pow,Jl=1e-7,Ql=20;Le.prototype.luminance=function(s){if(s!==void 0&&Zl(s)==="number"){if(s===0)return new Le([0,0,0,this._rgb[3]],"rgb");if(s===1)return new Le([255,255,255,this._rgb[3]],"rgb");var o=this.luminance(),l="rgb",c=Ql,d=function(f,m){var b=f.interpolate(m,.5,l),w=b.luminance();return Math.abs(s-w)s?d(f,b):d(b,m)},p=(o>s?d(new Le([0,0,0]),this):d(this,new Le([255,255,255]))).rgb();return new Le(p.concat([this._rgb[3]]))}return Kl.apply(void 0,this._rgb.slice(0,3))};var Kl=function(s,o,l){return s=Hr(s),o=Hr(o),l=Hr(l),.2126*s+.7152*o+.0722*l},Hr=function(s){return s/=255,s<=.03928?s/12.92:Vl((s+.055)/1.055,2.4)},kt={},Es=D,Fs=T.type,pr=kt,_s=function(s,o,l){l===void 0&&(l=.5);for(var c=[],d=arguments.length-3;d-- >0;)c[d]=arguments[d+3];var p=c[0]||"lrgb";if(!pr[p]&&!c.length&&(p=Object.keys(pr)[0]),!pr[p])throw new Error("interpolation mode "+p+" is not defined");return Fs(s)!=="object"&&(s=new Es(s)),Fs(o)!=="object"&&(o=new Es(o)),pr[p](s,o,l).alpha(s.alpha()+l*(o.alpha()-s.alpha()))},Ds=D,th=_s;Ds.prototype.mix=Ds.prototype.interpolate=function(s,o){o===void 0&&(o=.5);for(var l=[],c=arguments.length-2;c-- >0;)l[c]=arguments[c+2];return th.apply(void 0,[this,s,o].concat(l))};var js=D;js.prototype.premultiply=function(s){s===void 0&&(s=!1);var o=this._rgb,l=o[3];return s?(this._rgb=[o[0]*l,o[1]*l,o[2]*l,l],this):new js([o[0]*l,o[1]*l,o[2]*l,l],"rgb")};var Yr=D,eh=hr;Yr.prototype.saturate=function(s){s===void 0&&(s=1);var o=this,l=o.lch();return l[1]+=eh.Kn*s,l[1]<0&&(l[1]=0),new Yr(l,"lch").alpha(o.alpha(),!0)},Yr.prototype.desaturate=function(s){return s===void 0&&(s=1),this.saturate(-s)};var Ns=D,Bs=T.type;Ns.prototype.set=function(s,o,l){l===void 0&&(l=!1);var c=s.split("."),d=c[0],p=c[1],f=this[d]();if(p){var m=d.indexOf(p)-(d.substr(0,2)==="ok"?2:0);if(m>-1){if(Bs(o)=="string")switch(o.charAt(0)){case"+":f[m]+=+o;break;case"-":f[m]+=+o;break;case"*":f[m]*=+o.substr(1);break;case"/":f[m]/=+o.substr(1);break;default:f[m]=+o}else if(Bs(o)==="number")f[m]=o;else throw new Error("unsupported value for Color.set");var b=new Ns(f,d);return l?(this._rgb=b._rgb,this):b}throw new Error("unknown channel "+p+" in mode "+d)}else return f};var rh=D,nh=function(s,o,l){var c=s._rgb,d=o._rgb;return new rh(c[0]+l*(d[0]-c[0]),c[1]+l*(d[1]-c[1]),c[2]+l*(d[2]-c[2]),"rgb")};kt.rgb=nh;var sh=D,Zr=Math.sqrt,$e=Math.pow,ih=function(s,o,l){var c=s._rgb,d=c[0],p=c[1],f=c[2],m=o._rgb,b=m[0],w=m[1],x=m[2];return new sh(Zr($e(d,2)*(1-l)+$e(b,2)*l),Zr($e(p,2)*(1-l)+$e(w,2)*l),Zr($e(f,2)*(1-l)+$e(x,2)*l),"rgb")};kt.lrgb=ih;var ah=D,oh=function(s,o,l){var c=s.lab(),d=o.lab();return new ah(c[0]+l*(d[0]-c[0]),c[1]+l*(d[1]-c[1]),c[2]+l*(d[2]-c[2]),"lab")};kt.lab=oh;var Us=D,Ie=function(s,o,l,c){var d,p,f,m;c==="hsl"?(f=s.hsl(),m=o.hsl()):c==="hsv"?(f=s.hsv(),m=o.hsv()):c==="hcg"?(f=s.hcg(),m=o.hcg()):c==="hsi"?(f=s.hsi(),m=o.hsi()):c==="lch"||c==="hcl"?(c="hcl",f=s.hcl(),m=o.hcl()):c==="oklch"&&(f=s.oklch().reverse(),m=o.oklch().reverse());var b,w,x,P,S,L;(c.substr(0,1)==="h"||c==="oklch")&&(d=f,b=d[0],x=d[1],S=d[2],p=m,w=p[0],P=p[1],L=p[2]);var M,j,U,G;return!isNaN(b)&&!isNaN(w)?(w>b&&w-b>180?G=w-(b+360):w180?G=w+360-b:G=w-b,j=b+l*G):isNaN(b)?isNaN(w)?j=Number.NaN:(j=w,(S==1||S==0)&&c!="hsv"&&(M=P)):(j=b,(L==1||L==0)&&c!="hsv"&&(M=x)),M===void 0&&(M=x+l*(P-x)),U=S+l*(L-S),c==="oklch"?new Us([U,M,j],c):new Us([j,M,U],c)},lh=Ie,Ws=function(s,o,l){return lh(s,o,l,"lch")};kt.lch=Ws,kt.hcl=Ws;var hh=D,ch=function(s,o,l){var c=s.num(),d=o.num();return new hh(c+l*(d-c),"num")};kt.num=ch;var uh=Ie,fh=function(s,o,l){return uh(s,o,l,"hcg")};kt.hcg=fh;var dh=Ie,ph=function(s,o,l){return dh(s,o,l,"hsi")};kt.hsi=ph;var gh=Ie,vh=function(s,o,l){return gh(s,o,l,"hsl")};kt.hsl=vh;var mh=Ie,bh=function(s,o,l){return mh(s,o,l,"hsv")};kt.hsv=bh;var yh=D,wh=function(s,o,l){var c=s.oklab(),d=o.oklab();return new yh(c[0]+l*(d[0]-c[0]),c[1]+l*(d[1]-c[1]),c[2]+l*(d[2]-c[2]),"oklab")};kt.oklab=wh;var xh=Ie,Sh=function(s,o,l){return xh(s,o,l,"oklch")};kt.oklch=Sh;var Vr=D,kh=T.clip_rgb,Jr=Math.pow,Qr=Math.sqrt,Kr=Math.PI,Gs=Math.cos,qs=Math.sin,Ch=Math.atan2,Th=function(s,o,l){o===void 0&&(o="lrgb"),l===void 0&&(l=null);var c=s.length;l||(l=Array.from(new Array(c)).map(function(){return 1}));var d=c/l.reduce(function(j,U){return j+U});if(l.forEach(function(j,U){l[U]*=d}),s=s.map(function(j){return new Vr(j)}),o==="lrgb")return Rh(s,l);for(var p=s.shift(),f=p.get(o),m=[],b=0,w=0,x=0;x=360;)M-=360;f[L]=M}else f[L]=f[L]/m[L];return S/=c,new Vr(f,o).alpha(S>.99999?1:S,!0)},Rh=function(s,o){for(var l=s.length,c=[0,0,0,0],d=0;d.9999999&&(c[3]=1),new Vr(kh(c))},Mt=ct,Ae=T.type,Ph=Math.pow,tn=function(s){var o="rgb",l=Mt("#ccc"),c=0,d=[0,1],p=[],f=[0,0],m=!1,b=[],w=!1,x=0,P=1,S=!1,L={},M=!0,j=1,U=function(k){if(k=k||["#fff","#000"],k&&Ae(k)==="string"&&Mt.brewer&&Mt.brewer[k.toLowerCase()]&&(k=Mt.brewer[k.toLowerCase()]),Ae(k)==="array"){k.length===1&&(k=[k[0],k[0]]),k=k.slice(0);for(var O=0;O=m[B];)B++;return B-1}return 0},X=function(k){return k},gt=function(k){return k},pt=function(k,O){var B,N;if(O==null&&(O=!1),isNaN(k)||k===null)return l;if(O)N=k;else if(m&&m.length>2){var vt=G(k);N=vt/(m.length-2)}else P!==x?N=(k-x)/(P-x):N=1;N=gt(N),O||(N=X(N)),j!==1&&(N=Ph(N,j)),N=f[0]+N*(1-f[0]-f[1]),N=Math.min(1,Math.max(0,N));var nt=Math.floor(N*1e4);if(M&&L[nt])B=L[nt];else{if(Ae(b)==="array")for(var q=0;q=Y&&q===p.length-1){B=b[q];break}if(N>Y&&N2){var q=k.map(function(Z,Q){return Q/(k.length-1)}),Y=k.map(function(Z){return(Z-x)/(P-x)});Y.every(function(Z,Q){return q[Q]===Z})||(gt=function(Z){if(Z<=0||Z>=1)return Z;for(var Q=0;Z>=Y[Q+1];)Q++;var $t=(Z-Y[Q])/(Y[Q+1]-Y[Q]),ee=q[Q]+$t*(q[Q+1]-q[Q]);return ee})}}return d=[x,P],W},W.mode=function(k){return arguments.length?(o=k,wt(),W):o},W.range=function(k,O){return U(k),W},W.out=function(k){return w=k,W},W.spread=function(k){return arguments.length?(c=k,W):c},W.correctLightness=function(k){return k==null&&(k=!0),S=k,wt(),S?X=function(O){for(var B=pt(0,!0).lab()[0],N=pt(1,!0).lab()[0],vt=B>N,nt=pt(O,!0).lab()[0],q=B+(N-B)*O,Y=nt-q,Z=0,Q=1,$t=20;Math.abs(Y)>.01&&$t-- >0;)(function(){return vt&&(Y*=-1),Y<0?(Z=O,O+=(Q-O)*.5):(Q=O,O+=(Z-O)*.5),nt=pt(O,!0).lab()[0],Y=nt-q})();return O}:X=function(O){return O},W},W.padding=function(k){return k!=null?(Ae(k)==="number"&&(k=[k,k]),f=k,W):f},W.colors=function(k,O){arguments.length<2&&(O="hex");var B=[];if(arguments.length===0)B=b.slice(0);else if(k===1)B=[W(.5)];else if(k>1){var N=d[0],vt=d[1]-N;B=Mh(0,k,!1).map(function(Q){return W(N+Q/(k-1)*vt)})}else{s=[];var nt=[];if(m&&m.length>2)for(var q=1,Y=m.length,Z=1<=Y;Z?qY;Z?q++:q--)nt.push((m[q-1]+m[q])*.5);else nt=d;B=nt.map(function(Q){return W(Q)})}return Mt[O]&&(B=B.map(function(Q){return Q[O]()})),B},W.cache=function(k){return k!=null?(M=k,W):M},W.gamma=function(k){return k!=null?(j=k,W):j},W.nodata=function(k){return k!=null?(l=Mt(k),W):l},W};function Mh(s,o,l){for(var c=[],d=sp;d?f++:f--)c.push(f);return c}var Ue=D,Lh=tn,$h=function(s){for(var o=[1,1],l=1;l=5){var w,x,P;w=s.map(function(S){return S.lab()}),P=s.length-1,x=$h(P),d=function(S){var L=1-S,M=[0,1,2].map(function(j){return w.reduce(function(U,G,X){return U+x[X]*Math.pow(L,P-X)*Math.pow(S,X)*G[j]},0)});return new Ue(M,"lab")}}else throw new RangeError("No point in running bezier with only one color.");return d},Ah=function(s){var o=Ih(s);return o.scale=function(){return Lh(o)},o},en=ct,Lt=function(s,o,l){if(!Lt[l])throw new Error("unknown blend mode "+l);return Lt[l](s,o)},Kt=function(s){return function(o,l){var c=en(l).rgb(),d=en(o).rgb();return en.rgb(s(c,d))}},te=function(s){return function(o,l){var c=[];return c[0]=s(o[0],l[0]),c[1]=s(o[1],l[1]),c[2]=s(o[2],l[2]),c}},Oh=function(s){return s},zh=function(s,o){return s*o/255},Eh=function(s,o){return s>o?o:s},Fh=function(s,o){return s>o?s:o},_h=function(s,o){return 255*(1-(1-s/255)*(1-o/255))},Dh=function(s,o){return o<128?2*s*o/255:255*(1-2*(1-s/255)*(1-o/255))},jh=function(s,o){return 255*(1-(1-o/255)/(s/255))},Nh=function(s,o){return s===255?255:(s=255*(o/255)/(1-s/255),s>255?255:s)};Lt.normal=Kt(te(Oh)),Lt.multiply=Kt(te(zh)),Lt.screen=Kt(te(_h)),Lt.overlay=Kt(te(Dh)),Lt.darken=Kt(te(Eh)),Lt.lighten=Kt(te(Fh)),Lt.dodge=Kt(te(Nh)),Lt.burn=Kt(te(jh));for(var Bh=Lt,rn=T.type,Uh=T.clip_rgb,Wh=T.TWOPI,Gh=Math.pow,qh=Math.sin,Xh=Math.cos,Xs=ct,Hh=function(s,o,l,c,d){s===void 0&&(s=300),o===void 0&&(o=-1.5),l===void 0&&(l=1),c===void 0&&(c=1),d===void 0&&(d=[0,1]);var p=0,f;rn(d)==="array"?f=d[1]-d[0]:(f=0,d=[d,d]);var m=function(b){var w=Wh*((s+120)/360+o*b),x=Gh(d[0]+f*b,c),P=p!==0?l[0]+b*p:l,S=P*x*(1-x)/2,L=Xh(w),M=qh(w),j=x+S*(-.14861*L+1.78277*M),U=x+S*(-.29227*L-.90649*M),G=x+S*(1.97294*L);return Xs(Uh([j*255,U*255,G*255,1]))};return m.start=function(b){return b==null?s:(s=b,m)},m.rotations=function(b){return b==null?o:(o=b,m)},m.gamma=function(b){return b==null?c:(c=b,m)},m.hue=function(b){return b==null?l:(l=b,rn(l)==="array"?(p=l[1]-l[0],p===0&&(l=l[1])):p=0,m)},m.lightness=function(b){return b==null?d:(rn(b)==="array"?(d=b,f=b[1]-b[0]):(d=[b,b],f=0),m)},m.scale=function(){return Xs.scale(m)},m.hue(l),m},Yh=D,Zh="0123456789abcdef",Vh=Math.floor,Jh=Math.random,Qh=function(){for(var s="#",o=0;o<6;o++)s+=Zh.charAt(Vh(Jh()*16));return new Yh(s,"hex")},nn=y,Hs=Math.log,Kh=Math.pow,tc=Math.floor,ec=Math.abs,Ys=function(s,o){o===void 0&&(o=null);var l={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return nn(s)==="object"&&(s=Object.values(s)),s.forEach(function(c){o&&nn(c)==="object"&&(c=c[o]),c!=null&&!isNaN(c)&&(l.values.push(c),l.sum+=c,cl.max&&(l.max=c),l.count+=1)}),l.domain=[l.min,l.max],l.limits=function(c,d){return Zs(l,c,d)},l},Zs=function(s,o,l){o===void 0&&(o="equal"),l===void 0&&(l=7),nn(s)=="array"&&(s=Ys(s));var c=s.min,d=s.max,p=s.values.sort(function(an,on){return an-on});if(l===1)return[c,d];var f=[];if(o.substr(0,1)==="c"&&(f.push(c),f.push(d)),o.substr(0,1)==="e"){f.push(c);for(var m=1;m 0");var b=Math.LOG10E*Hs(c),w=Math.LOG10E*Hs(d);f.push(c);for(var x=1;x200&&(gt=!1)}for(var re={},Oe=0;Oec?(l+.05)/(c+.05):(c+.05)/(l+.05)},Qs=D,Bt=Math.sqrt,ut=Math.pow,nc=Math.min,sc=Math.max,Ks=Math.atan2,ti=Math.abs,gr=Math.cos,ei=Math.sin,ic=Math.exp,ri=Math.PI,ac=function(s,o,l,c,d){l===void 0&&(l=1),c===void 0&&(c=1),d===void 0&&(d=1);var p=function(de){return 360*de/(2*ri)},f=function(de){return 2*ri*de/360};s=new Qs(s),o=new Qs(o);var m=Array.from(s.lab()),b=m[0],w=m[1],x=m[2],P=Array.from(o.lab()),S=P[0],L=P[1],M=P[2],j=(b+S)/2,U=Bt(ut(w,2)+ut(x,2)),G=Bt(ut(L,2)+ut(M,2)),X=(U+G)/2,gt=.5*(1-Bt(ut(X,7)/(ut(X,7)+ut(25,7)))),pt=w*(1+gt),wt=L*(1+gt),W=Bt(ut(pt,2)+ut(x,2)),k=Bt(ut(wt,2)+ut(M,2)),O=(W+k)/2,B=p(Ks(x,pt)),N=p(Ks(M,wt)),vt=B>=0?B:B+360,nt=N>=0?N:N+360,q=ti(vt-nt)>180?(vt+nt+360)/2:(vt+nt)/2,Y=1-.17*gr(f(q-30))+.24*gr(f(2*q))+.32*gr(f(3*q+6))-.2*gr(f(4*q-63)),Z=nt-vt;Z=ti(Z)<=180?Z:nt<=vt?Z+360:Z-360,Z=2*Bt(W*k)*ei(f(Z)/2);var Q=S-b,$t=k-W,ee=1+.015*ut(j-50,2)/Bt(20+ut(j-50,2)),re=1+.045*O,Oe=1+.015*O*Y,ze=30*ic(-ut((q-275)/25,2)),Ut=2*Bt(ut(O,7)/(ut(O,7)+ut(25,7))),fe=-Ut*ei(2*f(ze)),We=Bt(ut(Q/(l*ee),2)+ut($t/(c*re),2)+ut(Z/(d*Oe),2)+fe*($t/(c*re))*(Z/(d*Oe)));return sc(0,nc(100,We))},ni=D,oc=function(s,o,l){l===void 0&&(l="lab"),s=new ni(s),o=new ni(o);var c=s.get(l),d=o.get(l),p=0;for(var f in c){var m=(c[f]||0)-(d[f]||0);p+=m*m}return Math.sqrt(p)},lc=D,hc=function(){for(var s=[],o=arguments.length;o--;)s[o]=arguments[o];try{return new(Function.prototype.bind.apply(lc,[null].concat(s))),!0}catch{return!1}},si=ct,ii=tn,cc={cool:function(){return ii([si.hsl(180,1,.9),si.hsl(250,.7,.4)])},hot:function(){return ii(["#000","#f00","#ff0","#fff"]).mode("rgb")}},vr={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},sn=0,ai=Object.keys(vr);sn(st.Color.symbol=st.Color.prototype.symbol=Symbol.for("@motion-canvas/core/types/Color"),st.Color.lerp=st.Color.prototype.lerp=(n,t,e,r="lch")=>{typeof n=="string"&&(n=new st.Color(n)),typeof t=="string"&&(t=new st.Color(t));const i=n instanceof st.Color,a=t instanceof st.Color;return i||(n=a?t.alpha(0):new st.Color("rgba(0, 0, 0, 0)")),a||(t=i?n.alpha(0):new st.Color("rgba(0, 0, 0, 0)")),st.mix(n,t,e,r)},st.Color.createLerp=st.Color.prototype.createLerp=n=>(t,e,r)=>st.Color.lerp(t,e,r,n),st.Color.createSignal=(n,t=st.Color.lerp)=>new we(n,t,void 0,e=>new st.Color(e)).toSignal(),st.Color.prototype.toSymbol=()=>st.Color.symbol,st.Color.prototype.toUniform=function(n,t){n.uniform4fv(t,this.gl())},st.Color.prototype.serialize=function(){return this.css()},st.Color.prototype.lerp=function(n,t,e){return st.Color.lerp(this,n,t,e)},st.Color))();function au(n,t){return g.fromDegrees(n).transform(t).degrees}function un(n,t){return g.magnitude(t.m11,t.m12)*n}class fn extends Ct{constructor(){super(...arguments),this.type=Yt.symbol}parse(t){return t===null?null:new Yt(t)}serialize(){var t;return((t=this.value.current)==null?void 0:t.serialize())??null}}class be extends Ct{constructor(t,e,r=(i=>(i=e[0])==null?void 0:i.value)()){super(t,r),this.options=e,this.type=be.symbol}set(t){var e;super.set((e=this.getOption(t))==null?void 0:e.value)}parse(t){var e;return(e=this.getOption(t))==null?void 0:e.value}getOption(t){return this.options.find(e=>e.value===t)??this.options[0]}}be.symbol=Symbol.for("@motion-canvas/core/meta/EnumMetaField");class ou extends Ct{get onFieldsChanged(){return this.fields.subscribable}get options(){return this.optionFields[this.current]}constructor(t,e,r=0){var u,v;const i=e.plugins.flatMap(y=>{var C;return((C=y.exporters)==null?void 0:C.call(y,e))??[]}),a=i.map(y=>y.meta(e)),h=new be("exporter",i.map(y=>({value:y.id,text:y.displayName})),(u=i[r])==null?void 0:u.id);super(t,{name:h.get(),options:(v=a[r])==null?void 0:v.get()}),this.current=r,this.type=Object,this.handleChange=()=>{var F,H,J;const y=this.exporterField.get(),C=Math.max(this.exporters.findIndex(et=>et.id===y),0);this.current!==C&&((F=this.options)==null||F.onChanged.unsubscribe(this.handleChange),this.current=C,(H=this.options)==null||H.onChanged.subscribe(this.handleChange,!1),this.fields.current=this.options?[this.exporterField,this.options]:[this.exporterField]),this.value.current={name:this.exporterField.get(),options:((J=this.options)==null?void 0:J.get())??null}},this.exporters=i,this.exporterField=h,this.exporterField.onChanged.subscribe(this.handleChange,!1),this.exporterField.disable(a.length<2).space(),this.optionFields=a,this.fields=new ie([this.exporterField]),this.options&&(this.options.onChanged.subscribe(this.handleChange,!1),this.fields.current=[this.exporterField,this.options])}set(t){var e;this.exporterField.set(t.name),(e=this.options)==null||e.set(t.options??{})}serialize(){var t;return{name:this.exporterField.serialize(),options:((t=this.options)==null?void 0:t.serialize())??null}}clone(){return new this.constructor(this.name,this.exporters,this.current)}}var Xe;class er{constructor(t,e=!1){this.name=t,this.source=e,this.lock=new mc,this.ignoreChange=!1,this.cache=null,this.metaField=null,this.handleChanged=async()=>{}}attach(t){var e;this.metaField||(this.metaField=t,this.cache&&this.metaField.set(this.cache),(e=this.metaField)==null||e.onChanged.subscribe(this.handleChanged))}async saveData(t){if(this.source===!1)return;if(!this.source)throw new Error(`The meta file for ${this.name} is missing.`);if(Xe.sourceLookup[this.source])throw new Error(`Metadata for ${this.name} is already being updated`);const e=this.source;await new Promise((r,i)=>{setTimeout(()=>{delete Xe.sourceLookup[e],i(`Connection timeout when updating metadata for ${this.name}`)},1e3),Xe.sourceLookup[e]=()=>{delete Xe.sourceLookup[e],r()},(void 0).send("motion-canvas:meta",{source:e,data:t})})}loadData(t){var e;this.ignoreChange=!0,this.cache=t,(e=this.metaField)==null||e.set(t),this.ignoreChange=!1}}Xe=er;er.sourceLookup={};class hn extends Ct{constructor(){super(...arguments),this.type=Number,this.presets=[]}parse(t){let e=parseFloat(t);return this.min!==void 0&&ethis.max&&(e=this.max),e}getPresets(){return this.presets}setPresets(t){return this.presets=t,this}setRange(t,e){return this.min=t,this.max=e,this}getMin(){return this.min??-1/0}getMax(){return this.max??1/0}}class Mr extends Ct{constructor(){super(...arguments),this.type=Mr.symbol}parse(t){return this.parseRange(1/0,t[0],t[1]??1/0)}update(t,e,r,i){this.value.current=this.parseRange(r/i-Ze,t/i-Ze,e/i-Ze)}parseRange(t,e=this.value.current[0],r=this.value.current[1]){return e=xt(0,t,e),r=xt(0,t,r??1/0),e>r&&([e,r]=[r,e]),r>=t&&(r=1/0),[e,r]}}Mr.symbol=Symbol.for("@motion-canvas/core/meta/RangeMetaField");class zi extends Ct{constructor(){super(...arguments),this.type=g.symbol}parse(t){return new g(t)}serialize(){return this.value.current.serialize()}}class Ne{static meta(t){return new Xt(this.displayName,{fastStart:new Cr("fast start",!0),includeAudio:new Cr("include audio",!0).disable(!t.audio)})}static async create(t,e){return new Ne(t,e)}constructor(t,e){this.project=t,this.settings=e}async start(){const t=this.settings.exporter.options;await this.invoke("start",{...this.settings,...t,audio:this.project.audio,audioOffset:this.project.meta.shared.audioOffset.get()-this.settings.range[0]})}async handleFrame(t){await this.invoke("handleFrame",{data:t.toDataURL("image/png")})}async stop(t){await this.invoke("end",t)}invoke(t,e){throw new Error("FFmpegExporter can only be used locally.")}}Ne.id="@motion-canvas/ffmpeg";Ne.displayName="Video (FFmpeg)";Ne.response=new Ot;const lu=dc({name:"ffmpeg-plugin",exporters(){return[Ne]}});let xn;xn??(xn=new er("project",!1));xn.loadData({version:0,shared:{background:"rgba(164,164,164,0)",range:[0,null],size:{x:1920,y:1080},audioOffset:0},preview:{fps:60,resolutionScale:2},rendering:{fps:60,resolutionScale:2,colorSpace:"srgb",exporter:{name:"@motion-canvas/ffmpeg",options:{fastStart:!0,includeAudio:!0}}}});const hu=xn;let Sn;Sn??(Sn=new er("example",!1));Sn.loadData({version:0,timeEvents:[],seed:4267500903});const cu=Sn;function uu(n){var t;return!!((t=n.prototype)!=null&&t.isClass)}const fu=Symbol.for("@motion-canvas/2d/fragment");function Ee(n,t,e){const{ref:r,children:i,...a}=t,h=Array.isArray(i)?i.flat():i;if(n===fu)return h;if(uu(n)){const u=new n({...a,children:h,key:e});return r==null||r(u),u}else return n({...a,ref:r,children:h,key:e})}const mi={invert:{name:"invert"},sepia:{name:"sepia"},grayscale:{name:"grayscale"},brightness:{name:"brightness",default:1},contrast:{name:"contrast",default:1},saturate:{name:"saturate",default:1},hue:{name:"hue-rotate",unit:"deg",scale:1},blur:{name:"blur",transform:!0,unit:"px",scale:1}};class du{get name(){return this.props.name}get default(){return this.props.default}constructor(t){this.props={name:"invert",default:0,unit:"%",scale:100,transform:!1,...t,value:t.value??t.default??0},this.value=je(this.props.value,tt,this)}isActive(){return this.value()!==this.props.default}serialize(t){let e=this.value();return this.props.transform&&(e=un(e,t)),`${this.props.name}(${e*this.props.scale}${this.props.unit})`}}const Wt=Symbol.for("@motion-canvas/2d/decorators/initializers");function rr(n,t){if(!n[Wt])n[Wt]=[];else if(n[Wt]&&!Object.prototype.hasOwnProperty.call(n,Wt)){const e=Object.getPrototypeOf(n);n[Wt]=[...e[Wt]]}n[Wt].push(t)}function pu(n,t){if(n[Wt])try{n[Wt].forEach(e=>e(n,t))}catch(e){throw e.inspect??(e.inspect=n.key),e}}function E(){return(n,t)=>{rr(n,e=>{const r=Object.getPrototypeOf(e)[t];e[t]=nu(r.bind(e),e)})}}function dn(n={},t,e){const r={};if(e&&t){const i=n.setter??(t==null?void 0:t[`set${He(e)}`]);i&&(r.setter=i.bind(t));const a=n.getter??(t==null?void 0:t[`get${He(e)}`]);a&&(r.getter=a.bind(t));const h=n.tweener??(t==null?void 0:t[`tween${He(e)}`]);h&&(r.tweener=h.bind(t))}return r}const Gt=Symbol.for("@motion-canvas/2d/decorators/properties");function Se(n,t){var e;return((e=n[Gt])==null?void 0:e[t])??null}function kn(n,t){let e;return n[Gt]?n[Gt]&&!Object.prototype.hasOwnProperty.call(n,Gt)?n[Gt]=e=Object.fromEntries(Object.entries(n[Gt]).map(([r,i])=>[r,{...i}])):e=n[Gt]:n[Gt]=e={},e[t]??(e[t]={cloneable:!0,inspectable:!0,compoundEntries:[]}),e[t]}function Ei(n){return n&&typeof n=="object"?n[Gt]??{}:{}}function Cn(n,t){pu(n);for(const[e,r]of Object.entries(Ei(n))){const i=n[e];if(i.reset(),t[e]!==void 0&&i(t[e]),r.compoundEntries!==void 0)for(const[a,h]of r.compoundEntries)h in t&&i[a](t[h])}}function R(){return(n,t)=>{const e=kn(n,t);rr(n,r=>{var u;let i=e.default;const a=r[`getDefault${He(t)}`];a&&(i=()=>a.call(r,e.default));const h=new we(i,e.interpolationFunction??De,r,(u=e.parser)==null?void 0:u.bind(r),dn(e,r,t));r[t]=h.toSignal()})}}function I(n){return(t,e)=>{const r=Se(t,e);if(!r){it().error(`Missing property decorator for "${e.toString()}"`);return}r.default=n}}function Fi(n){return(t,e)=>{const r=Se(t,e);if(!r){it().error(`Missing property decorator for "${e.toString()}"`);return}r.interpolationFunction=n}}function Tn(n){return(t,e)=>{const r=Se(t,e);if(!r){it().error(`Missing property decorator for "${e.toString()}"`);return}r.parser=n}}function nr(n){return(t,e)=>{const r=Se(t,e);if(!r){it().error(`Missing property decorator for "${e.toString()}"`);return}r.parser=i=>new n(i),"lerp"in n&&(r.interpolationFunction??(r.interpolationFunction=n.lerp))}}function ke(n=!0){return(t,e)=>{const r=Se(t,e);if(!r){it().error(`Missing property decorator for "${e.toString()}"`);return}r.cloneable=n}}function _i(n=!0){return(t,e)=>{const r=Se(t,e);if(!r){it().error(`Missing property decorator for "${e.toString()}"`);return}r.inspectable=n}}function Di(n,t=Pr){return(e,r)=>{const i=kn(e,r);i.compound=!0,i.compoundEntries=Object.entries(n),rr(e,a=>{if(!i.parser){it().error(`Missing parser decorator for "${r.toString()}"`);return}const h=i.default,u=i.parser.bind(a),v=new t(i.compoundEntries.map(([y,C])=>{const F=new we(me(h,H=>u(H)[y]),tt,a,void 0,dn(void 0,a,C)).toSignal();return[y,F]}),u,h,i.interpolationFunction??De,a,dn(i,a,r));a[r]=v.toSignal()})}}function Jt(n){return(t,e)=>{Di(typeof n=="object"?n:{x:n?`${n}X`:"x",y:n?`${n}Y`:"y"},Ai)(t,e),nr(g)(t,e)}}var ae=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var u=n.length-1;u>=0;u--)(h=n[u])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};class Nt{constructor(t){Cn(this,t)}canvasGradient(t){let e;switch(this.type()){case"linear":e=t.createLinearGradient(this.from.x(),this.from.y(),this.to.x(),this.to.y());break;case"conic":e=t.createConicGradient(this.angle(),this.from.x(),this.from.y());break;case"radial":e=t.createRadialGradient(this.from.x(),this.from.y(),this.fromRadius(),this.to.x(),this.to.y(),this.toRadius());break}for(const{offset:r,color:i}of this.stops())e.addColorStop(ye(r),new Yt(ye(i)).serialize());return e}}ae([I("linear"),R()],Nt.prototype,"type",void 0);ae([Jt("from")],Nt.prototype,"from",void 0);ae([Jt("to")],Nt.prototype,"to",void 0);ae([I(0),R()],Nt.prototype,"angle",void 0);ae([I(0),R()],Nt.prototype,"fromRadius",void 0);ae([I(0),R()],Nt.prototype,"toRadius",void 0);ae([I([]),R()],Nt.prototype,"stops",void 0);ae([E()],Nt.prototype,"canvasGradient",null);var Rn=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var u=n.length-1;u>=0;u--)(h=n[u])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};class sr{constructor(t){Cn(this,t)}canvasPattern(t){return t.createPattern(this.image(),this.repetition())}}Rn([R()],sr.prototype,"image",void 0);Rn([I(null),R()],sr.prototype,"repetition",void 0);Rn([E()],sr.prototype,"canvasPattern",null);function gu(n){return n===null?null:n instanceof Nt||n instanceof sr?n:new Yt(n)}function pn(n,t){return n===null?"":n instanceof Yt?n.serialize():n instanceof Nt?n.canvasGradient(t):n instanceof sr?n.canvasPattern(t)??"":""}function bi(n,t,e,r,i){if(e.top===0&&e.right===0&&e.bottom===0&&e.left===0){vu(n,t);return}const a=se(e.top,e.right,e.left,t),h=se(e.right,e.top,e.bottom,t),u=se(e.bottom,e.left,e.right,t),v=se(e.left,e.bottom,e.top,t);if(r){const y=C=>{const F=C*i;return C-F};n.moveTo(t.left+a,t.top),n.lineTo(t.right-h,t.top),n.bezierCurveTo(t.right-y(h),t.top,t.right,t.top+y(h),t.right,t.top+h),n.lineTo(t.right,t.bottom-u),n.bezierCurveTo(t.right,t.bottom-y(u),t.right-y(u),t.bottom,t.right-u,t.bottom),n.lineTo(t.left+v,t.bottom),n.bezierCurveTo(t.left+y(v),t.bottom,t.left,t.bottom-y(v),t.left,t.bottom-v),n.lineTo(t.left,t.top+a),n.bezierCurveTo(t.left,t.top+y(a),t.left+y(a),t.top,t.left+a,t.top);return}n.moveTo(t.left+a,t.top),n.arcTo(t.right,t.top,t.right,t.bottom,h),n.arcTo(t.right,t.bottom,t.left,t.bottom,u),n.arcTo(t.left,t.bottom,t.left,t.top,v),n.arcTo(t.left,t.top,t.right,t.top,a)}function se(n,t,e,r){const i=n+t>r.width?r.width*(n/(n+t)):n,a=n+e>r.height?r.height*(n/(n+e)):n;return Math.min(i,a)}function vu(n,t){n.rect(t.x,t.y,t.width,t.height)}function mu(n,t,e,r){r?n.drawImage(t,e.x,e.y,e.width,e.height,r.x,r.y,r.width,r.height):n.drawImage(t,e.x,e.y,e.width,e.height)}function Lr(n,t){n.moveTo(t.x,t.y)}function qt(n,t){n.lineTo(t.x,t.y)}function pe(n,t){if(!(t.length<2)){Lr(n,t[0]);for(const e of t.slice(1))qt(n,e)}}function bu(n,t,e=8){qt(n,t.addY(-e)),qt(n,t.addY(e)),qt(n,t),qt(n,t.addX(-e)),yu(n,t,e)}function yu(n,t,e,r=0,i=Math.PI*2,a=!1){n.arc(t.x,t.y,e,r,i,a)}function wu(n,t,e,r){n.bezierCurveTo(t.x,t.y,e.x,e.y,r.x,r.y)}function ji(n){return t=>t instanceof n}function Ni(){return(n,t)=>{R()(n,t),Tn(gu)(n,t),Fi(Yt.lerp)(n,t),I(null)(n,t)}}function Bi(){return(n,t)=>{R()(n,t),nr(Yt)(n,t)}}function oe(n,t=e=>e){return(e,r)=>{e[`getDefault${He(r)}`]=function(){this.requestLayoutUpdate();const i=this.element.style[n];this.element.style[n]="";const a=t.call(this,this.styles.getPropertyValue(n));return this.element.style[n]=i,a}}}class xu extends we{constructor(t,e){super(t,De,e);for(const r in mi){const i=mi[r];Object.defineProperty(this.invokable,r,{value:(a,h,u=_t)=>{var y,C,F;if(a===void 0)return((C=(y=this.get())==null?void 0:y.find(H=>H.name===i.name))==null?void 0:C.value())??i.default??0;let v=(F=this.get())==null?void 0:F.find(H=>H.name===i.name);return v||(v=new du(i),this.set([...this.get(),v])),h===void 0?(v.value(a),this.owner):v.value(a,h,u)}})}}*tweener(t,e,r){const i=this.get(),a=ye(t);if(ku(i,a)){yield*ve(...i.map((v,y)=>v.value(a[y].value(),e,r))),this.set(a);return}for(const v of a)v.value(v.default);const h=a.map(v=>v.value.context.raw()),u=i.length>0&&a.length>0?e/2:e;i.length>0&&(yield*ve(...i.map(v=>v.value(v.default,u,r)))),this.set(a),a.length>0&&(yield*ve(...a.map((v,y)=>v.value(h[y],u,r))))}}function Su(){return(n,t)=>{const e=kn(n,t);rr(n,r=>{r[t]=new xu(e.default??[],r).toSignal()})}}function ku(n,t){if(n.length!==t.length)return!1;for(let e=0;e=e){const h=(e-a)/i.arcLength;return i.getPoint(xt(0,1,h))}}return{position:g.zero,tangent:g.up,normal:g.up}}function $r(n){return(t,e)=>{Di({top:n?`${n}Top`:"top",right:n?`${n}Right`:"right",bottom:n?`${n}Bottom`:"bottom",left:n?`${n}Left`:"left"})(t,e),nr(At)(t,e)}}function Tu(n){let t;return n?typeof n=="string"?t=[{fragment:n}]:Array.isArray(n)?t=n.map(e=>typeof e=="string"?{fragment:e}:e):t=[n]:t=[],!bn().experimentalFeatures&&t.length>0&&(t=[],it().log({...Rc("Node uses experimental shaders."),inspect:this.key})),t}function wr(){return bn()}var _=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var u=n.length-1;u>=0;u--)(h=n[u])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a},xr;let z=xr=class{get x(){return this.position.x}get y(){return this.position.y}getAbsolutePosition(){return new g(this.parentToWorld().transformPoint(this.position()))}setAbsolutePosition(t){this.position(me(t,e=>new g(e).transformAsPoint(this.worldToParent())))}getAbsoluteRotation(){const t=this.localToWorld();return g.degrees(t.m11,t.m12)}setAbsoluteRotation(t){this.rotation(me(t,e=>au(e,this.worldToParent())))}getAbsoluteScale(){const t=this.localToWorld();return new g(g.magnitude(t.m11,t.m12),g.magnitude(t.m21,t.m22))}setAbsoluteScale(t){this.scale(me(t,e=>this.getRelativeScale(new g(e))))}getRelativeScale(t){var r;const e=((r=this.parent())==null?void 0:r.absoluteScale())??g.one;return t.div(e)}*tweenCompositeOperation(t,e,r){const i=ye(t);i==="source-over"?(yield*this.compositeOverride(1,e,r),this.compositeOverride(0),this.compositeOperation(i)):(this.compositeOperation(i),this.compositeOverride(1),yield*this.compositeOverride(0,e,r))}absoluteOpacity(){var t;return(((t=this.parent())==null?void 0:t.absoluteOpacity())??1)*this.opacity()}hasFilters(){return!!this.filters().find(t=>t.isActive())}hasShadow(){return!!this.shadowColor()&&(this.shadowBlur()>0||this.shadowOffset.x()!==0||this.shadowOffset.y()!==0)}filterString(){let t="";const e=this.compositeToWorld();for(const r of this.filters())r.isActive()&&(t+=" "+r.serialize(e));return t}getSpawner(){return this.children()}setSpawner(t){this.children(t)}setChildren(t){if(this.children.context.raw()!==t){if(this.children.context.setter(t),!Ht(t))this.spawnChildren(!1,t);else if(!this.hasSpawnedChildren)for(const e of this.realChildren)e.parent(null)}}getChildren(){return this.children.context.getter(),this.spawnedChildren()}spawnedChildren(){const t=this.children.context.getter();return Ht(this.children.context.raw())&&this.spawnChildren(!0,t),this.realChildren}sortedChildren(){return[...this.children()].sort((t,e)=>Math.sign(t.zIndex()-e.zIndex()))}constructor({children:t,spawner:e,key:r,...i}){this.compositeOverride=je(0),this.stateStack=[],this.realChildren=[],this.hasSpawnedChildren=!1,this.parent=je(null),this.properties=Ei(this);const a=wr();[this.key,this.unregister]=a.registerNode(this,r),this.view2D=a.getView(),this.creationStack=new Error().stack,Cn(this,i),e&&it().warn({message:"Node.spawner() has been deprecated.",remarks:"Use Node.children() instead.",inspect:this.key,stack:new Error().stack}),this.children(e??t)}localToWorld(){const t=this.parent();return t?t.localToWorld().multiply(this.localToParent()):this.localToParent()}worldToLocal(){return this.localToWorld().inverse()}worldToParent(){var t;return((t=this.parent())==null?void 0:t.worldToLocal())??new DOMMatrix}parentToWorld(){var t;return((t=this.parent())==null?void 0:t.localToWorld())??new DOMMatrix}localToParent(){const t=new DOMMatrix;return t.translateSelf(this.x(),this.y()),t.rotateSelf(0,0,this.rotation()),t.scaleSelf(this.scale.x(),this.scale.y()),t.skewXSelf(this.skew.x()),t.skewYSelf(this.skew.y()),t}compositeToWorld(){var t;return((t=this.compositeRoot())==null?void 0:t.localToWorld())??new DOMMatrix}compositeRoot(){var t;return this.composite()?this:((t=this.parent())==null?void 0:t.compositeRoot())??null}compositeToLocal(){const t=this.compositeRoot();if(t){const e=this.worldToLocal();return e.m44=1,t.localToWorld().multiply(e)}return new DOMMatrix}view(){return this.view2D}add(t){return this.insert(t,1/0)}insert(t,e=0){const r=Array.isArray(t)?t:[t];if(r.length===0)return this;const i=this.children(),a=i.slice(0,e);for(const h of r)h instanceof xr&&(a.push(h),h.remove(),h.parent(this));return a.push(...i.slice(e)),this.setParsedChildren(a),this}remove(){const t=this.parent();return t===null?this:(t.removeChild(this),this.parent(null),this)}move(t=1){const e=this.parent();if(t===0||!e)return this;const r=e.children(),i=[];if(t>0)for(let a=0;a=0;a--){const h=r[a];if(h===this){const u=a+t;for(;a>u&&a>0;a--)i[a]=r[a-1]}i[a]=h}return e.setParsedChildren(i),this}moveUp(){return this.move(1)}moveDown(){return this.move(-1)}moveToTop(){return this.move(1/0)}moveToBottom(){return this.move(-1/0)}moveTo(t){const e=this.parent();if(!e)return this;const r=e.children().indexOf(this),i=t-r;return this.move(i)}moveBelow(t,e=!1){const r=this.parent();if(!r)return this;if(t.parent()!==r)return it().error("Cannot position nodes relative to each other if they don't belong to the same parent."),this;const i=r.children(),a=i.indexOf(this),h=i.indexOf(t);if(!e&&ah)return this;const u=h-a+1;return this.move(u)}reparent(t){const e=this.absolutePosition(),r=this.absoluteRotation(),i=this.absoluteScale();return t.add(this),this.absolutePosition(e),this.absoluteRotation(r),this.absoluteScale(i),this}removeChildren(){for(const t of this.realChildren)t.parent(null);return this.setParsedChildren([]),this}peekChildren(){return this.realChildren}findAll(t){const e=[],r=this.reversedChildren();for(;r.length>0;){const i=r.pop();t(i)&&e.push(i);const a=i.children();for(let h=a.length-1;h>=0;h--)r.push(a[h])}return e}findFirst(t){const e=this.reversedChildren();for(;e.length>0;){const r=e.pop();if(t(r))return r;const i=r.children();for(let a=i.length-1;a>=0;a--)e.push(i[a])}return null}findLast(t){const e=[],r=this.reversedChildren();for(;r.length>0;){const i=r.pop();e.push(i);const a=i.children();for(let h=a.length-1;h>=0;h--)r.push(a[h])}for(;e.length>0;){const i=e.pop();if(t(i))return i}return null}findAncestor(t){let e=this.parent();for(;e;){if(t(e))return e;e=e.parent()}return null}childAs(t){return this.children()[t]??null}childrenAs(){return this.children()}parentAs(){return this.parent()??null}dispose(){if(this.unregister){this.stateStack=[],this.unregister(),this.unregister=null;for(const{signal:t}of this)t==null||t.context.dispose();for(const t of this.realChildren)t.dispose()}}clone(t={}){const e={...t};Ht(this.children.context.raw())?e.children??(e.children=this.children.context.raw()):this.children().length>0&&(e.children??(e.children=this.children().map(r=>r.clone())));for(const{key:r,meta:i,signal:a}of this)if(!(!i.cloneable||r in e))if(i.compound)for(const[h,u]of i.compoundEntries){if(u in e)continue;const v=a[h];v.context.isInitial()||(e[u]=v.context.raw())}else a.context.isInitial()||(e[r]=a.context.raw());return this.instantiate(e)}snapshotClone(t={}){const e={...this.getState(),...t};return this.children().length>0&&(e.children??(e.children=this.children().map(r=>r.snapshotClone()))),this.instantiate(e)}reactiveClone(t={}){const e={...t};this.children().length>0&&(e.children??(e.children=this.children().map(r=>r.reactiveClone())));for(const{key:r,meta:i,signal:a}of this)!i.cloneable||r in e||(e[r]=()=>a());return this.instantiate(e)}instantiate(t={}){return new this.constructor(t)}setParsedChildren(t){this.children.context.setter(t),this.realChildren=t}spawnChildren(t,e){const r=this.parseChildren(e),i=new Set;for(const a of r){const h=a.parent.context.raw();h&&h!==this&&h.removeChild(a),i.add(a.key),a.parent(this)}for(const a of this.realChildren)i.has(a.key)||a.parent(null);this.hasSpawnedChildren=t,this.realChildren=r}parseChildren(t){const e=[],r=Array.isArray(t)?t:[t];for(const i of r)i instanceof xr&&e.push(i);return e}removeChild(t){this.setParsedChildren(this.children().filter(e=>e!==t))}requiresCache(){return this.cache()||this.opacity()<1||this.compositeOperation()!=="source-over"||this.hasFilters()||this.hasShadow()||this.shaders().length>0}cacheCanvas(){const t=document.createElement("canvas").getContext("2d");if(!t)throw new Error("Could not create a cache canvas");return t}cachedCanvas(){const t=this.cacheCanvas(),e=this.worldSpaceCacheBBox(),r=this.localToWorld();return t.canvas.width=e.width,t.canvas.height=e.height,t.setTransform(r.a,r.b,r.c,r.d,r.e-e.x,r.f-e.y),this.draw(t),t}getCacheBBox(){return new V}cacheBBox(){const t=this.getCacheBBox(),e=this.children(),r=this.cachePadding();if(e.length===0)return t.addSpacing(r);const i=t.corners;for(const h of e){const u=h.fullCacheBBox(),v=h.localToParent();i.push(...u.corners.map(y=>y.transformAsPoint(v)))}return V.fromPoints(...i).addSpacing(r)}fullCacheBBox(){const t=this.compositeToLocal(),e=this.shadowOffset().transform(t),r=un(this.shadowBlur(),t),i=this.cacheBBox().expand(this.filters.blur()*2+r);return e.x<0?(i.x+=e.x,i.width-=e.x):i.width+=e.x,e.y<0?(i.y+=e.y,i.height-=e.y):i.height+=e.y,i}worldSpaceCacheBBox(){const t=V.fromSizeCentered(this.view().size()).expand(this.view().cachePadding()),e=V.fromPoints(...t.transformCorners(this.view().localToWorld())),r=V.fromPoints(...this.cacheBBox().transformCorners(this.localToWorld()));return e.intersection(r).pixelPerfect.expand(2)}parentWorldSpaceCacheBBox(){var t;return((t=this.findAncestor(e=>e.requiresCache()))==null?void 0:t.worldSpaceCacheBBox())??new V(g.zero,wr().getRealSize())}setupDrawFromCache(t){if(t.globalCompositeOperation=this.compositeOperation(),t.globalAlpha*=this.opacity(),this.hasFilters()&&(t.filter=this.filterString()),this.hasShadow()){const r=this.compositeToWorld(),i=this.shadowOffset().transform(r),a=un(this.shadowBlur(),r);t.shadowColor=this.shadowColor().serialize(),t.shadowBlur=a,t.shadowOffsetX=i.x,t.shadowOffsetY=i.y}const e=this.worldToLocal();t.transform(e.a,e.b,e.c,e.d,e.e,e.f)}renderFromSource(t,e,r,i){this.setupDrawFromCache(t);const a=this.compositeOverride();t.drawImage(e,r,i),a>0&&(t.save(),t.globalAlpha*=a,t.globalCompositeOperation="source-over",t.drawImage(e,r,i),t.restore())}shaderCanvas(t,e){var F,H;const r=this.shaders();if(r.length===0)return null;const i=wr(),a=i.getRealSize(),h=this.parentWorldSpaceCacheBBox(),u=new DOMMatrix().scaleSelf(a.width/h.width,a.height/-h.height).translateSelf(h.x/-a.width,h.y/a.height-1),v=this.worldSpaceCacheBBox(),y=new DOMMatrix().scaleSelf(a.width/v.width,a.height/-v.height).translateSelf(v.x/-a.width,v.y/a.height-1).invertSelf(),C=i.shaders.getGL();i.shaders.copyTextures(t,e),i.shaders.clear();for(const J of r){const et=i.shaders.getProgram(J.fragment);if(et){if(J.uniforms)for(const[T,rt]of Object.entries(J.uniforms)){const ht=C.getUniformLocation(et,T);if(ht===null)continue;const K=ye(rt);typeof K=="number"?C.uniform1f(ht,K):"toUniform"in K?K.toUniform(C,ht):K.length===1?C.uniform1f(ht,K[0]):K.length===2?C.uniform2f(ht,K[0],K[1]):K.length===3?C.uniform3f(ht,K[0],K[1],K[2]):K.length===4&&C.uniform4f(ht,K[0],K[1],K[2],K[3])}C.uniform1f(C.getUniformLocation(et,gi),this.view2D.globalTime()),C.uniform1i(C.getUniformLocation(et,gi),i.playback.frame),C.uniformMatrix4fv(C.getUniformLocation(et,Wc),!1,y.toFloat32Array()),C.uniformMatrix4fv(C.getUniformLocation(et,Gc),!1,u.toFloat32Array()),(F=J.setup)==null||F.call(J,C,et),i.shaders.render(),(H=J.teardown)==null||H.call(J,C,et)}}return C.canvas}render(t){if(!(this.absoluteOpacity()<=0)){if(t.save(),this.transformContext(t),this.requiresCache()){const e=this.worldSpaceCacheBBox();if(e.width!==0&&e.height!==0){const r=this.cachedCanvas().canvas,i=this.shaderCanvas(t.canvas,r);i?this.renderFromSource(t,i,0,0):this.renderFromSource(t,r,e.position.x,e.position.y)}}else this.draw(t);t.restore()}}draw(t){this.drawChildren(t)}drawChildren(t){for(const e of this.sortedChildren())e.render(t)}drawOverlay(t,e){const r=this.cacheBBox().transformCorners(e),i=this.getCacheBBox().transformCorners(e);t.strokeStyle="white",t.lineWidth=1,t.beginPath(),pe(t,r),t.closePath(),t.stroke(),t.strokeStyle="blue",t.beginPath(),pe(t,i),t.closePath(),t.stroke()}transformContext(t){const e=this.localToParent();t.transform(e.a,e.b,e.c,e.d,e.e,e.f)}hit(t){let e=null;const r=t.transformAsPoint(this.localToParent().inverse()),i=this.children();for(let a=i.length-1;a>=0&&(e=i[a].hit(r),!e);a--);return e}collectAsyncResources(){for(const t of this.children())t.collectAsyncResources()}async toPromise(){do await lt.consumePromises(),this.collectAsyncResources();while(lt.hasPromises());return this}getState(){const t={};for(const{key:e,meta:r,signal:i}of this)!r.cloneable||e in t||(t[e]=i());return t}applyState(t,e,r=_t){if(e===void 0)for(const a in t){const h=this.signalByKey(a);h&&h(t[a])}const i=[];for(const a in t){const h=this.signalByKey(a);t[a]!==h.context.raw()&&i.push(h(t[a],e,r))}return ve(...i)}save(){this.stateStack.push(this.getState())}restore(t,e=_t){const r=this.stateStack.pop();if(r!==void 0)return this.applyState(r,t,e)}*[Symbol.iterator](){for(const t in this.properties){const e=this.properties[t],r=this.signalByKey(t);yield{meta:e,signal:r,key:t}}}signalByKey(t){return this[t]}reversedChildren(){const t=this.children(),e=[];for(let r=t.length-1;r>=0;r--)e.push(t[r]);return e}};_([Jt()],z.prototype,"position",void 0);_([nr(g),ke(!1),R()],z.prototype,"absolutePosition",void 0);_([I(0),R()],z.prototype,"rotation",void 0);_([ke(!1),R()],z.prototype,"absoluteRotation",void 0);_([I(g.one),Jt("scale")],z.prototype,"scale",void 0);_([I(g.zero),Jt("skew")],z.prototype,"skew",void 0);_([nr(g),ke(!1),R()],z.prototype,"absoluteScale",void 0);_([I(0),R()],z.prototype,"zIndex",void 0);_([I(!1),R()],z.prototype,"cache",void 0);_([$r("cachePadding")],z.prototype,"cachePadding",void 0);_([I(!1),R()],z.prototype,"composite",void 0);_([I("source-over"),R()],z.prototype,"compositeOperation",void 0);_([ft()],z.prototype,"tweenCompositeOperation",null);_([I(1),Tn(n=>xt(0,1,n)),R()],z.prototype,"opacity",void 0);_([E()],z.prototype,"absoluteOpacity",null);_([Su()],z.prototype,"filters",void 0);_([I("#0000"),Bi()],z.prototype,"shadowColor",void 0);_([I(0),R()],z.prototype,"shadowBlur",void 0);_([Jt("shadowOffset")],z.prototype,"shadowOffset",void 0);_([I([]),Tn(Tu),R()],z.prototype,"shaders",void 0);_([E()],z.prototype,"hasFilters",null);_([E()],z.prototype,"hasShadow",null);_([E()],z.prototype,"filterString",null);_([_i(!1),ke(!1),R()],z.prototype,"spawner",void 0);_([_i(!1),ke(!1),R()],z.prototype,"children",void 0);_([E()],z.prototype,"spawnedChildren",null);_([E()],z.prototype,"sortedChildren",null);_([E()],z.prototype,"localToWorld",null);_([E()],z.prototype,"worldToLocal",null);_([E()],z.prototype,"worldToParent",null);_([E()],z.prototype,"parentToWorld",null);_([E()],z.prototype,"localToParent",null);_([E()],z.prototype,"compositeToWorld",null);_([E()],z.prototype,"compositeRoot",null);_([E()],z.prototype,"compositeToLocal",null);_([E()],z.prototype,"cacheCanvas",null);_([E()],z.prototype,"cachedCanvas",null);_([E()],z.prototype,"cacheBBox",null);_([E()],z.prototype,"fullCacheBBox",null);_([E()],z.prototype,"worldSpaceCacheBBox",null);_([E()],z.prototype,"parentWorldSpaceCacheBBox",null);z=xr=_([Ce("Node")],z);z.prototype.isClass=!0;var A=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var u=n.length-1;u>=0;u--)(h=n[u])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a},Sr;let $=Sr=class extends z{get columnGap(){return this.gap.x}get rowGap(){return this.gap.y}getX(){return this.isLayoutRoot()?this.x.context.getter():this.computedPosition().x}setX(t){this.x.context.setter(t)}getY(){return this.isLayoutRoot()?this.y.context.getter():this.computedPosition().y}setY(t){this.y.context.setter(t)}get width(){return this.size.x}get height(){return this.size.y}getWidth(){return this.computedSize().width}setWidth(t){this.width.context.setter(t)}*tweenWidth(t,e,r,i){const a=this.desiredSize().x,h=typeof a!="number"||typeof t!="number";let u;h?u=this.size.x():u=a;let v;h?(this.size.x(t),v=this.size.x()):v=t,this.size.x(u),h&&this.lockSize(),yield*Dt(e,y=>this.size.x(i(u,v,r(y)))),this.size.x(t),h&&this.releaseSize()}getHeight(){return this.computedSize().height}setHeight(t){this.height.context.setter(t)}*tweenHeight(t,e,r,i){const a=this.desiredSize().y,h=typeof a!="number"||typeof t!="number";let u;h?u=this.size.y():u=a;let v;h?(this.size.y(t),v=this.size.y()):v=t,this.size.y(u),h&&this.lockSize(),yield*Dt(e,y=>this.size.y(i(u,v,r(y)))),this.size.y(t),h&&this.releaseSize()}desiredSize(){return{x:this.width.context.getter(),y:this.height.context.getter()}}*tweenSize(t,e,r,i){const a=this.desiredSize();let h;typeof a.x!="number"||typeof a.y!="number"?h=this.size():h=new g(a);let u;typeof t=="object"&&typeof t.x=="number"&&typeof t.y=="number"?u=new g(t):(this.size(t),u=this.size()),this.size(h),this.lockSize(),yield*Dt(e,v=>this.size(i(h,u,r(v)))),this.releaseSize(),this.size(t)}cardinalPoint(t){switch(t){case ot.TopLeft:return this.topLeft;case ot.TopRight:return this.topRight;case ot.BottomLeft:return this.bottomLeft;case ot.BottomRight:return this.bottomRight;case ot.Top:case St.Top:return this.top;case ot.Bottom:case St.Bottom:return this.bottom;case ot.Left:case St.Left:return this.left;case ot.Right:case St.Right:return this.right;default:return this.middle}}constructor(t){super(t),this.element.dataset.motionCanvasKey=this.key}lockSize(){this.sizeLockCounter(this.sizeLockCounter()+1)}releaseSize(){this.sizeLockCounter(this.sizeLockCounter()-1)}parentTransform(){return this.findAncestor(ji(Sr))}anchorPosition(){const t=this.computedSize(),e=this.offset();return t.scale(.5).mul(e)}layoutEnabled(){var t;return this.layout()??((t=this.parentTransform())==null?void 0:t.layoutEnabled())??!1}isLayoutRoot(){var t;return!this.layoutEnabled()||!((t=this.parentTransform())!=null&&t.layoutEnabled())}localToParent(){const t=super.localToParent(),e=this.offset();if(!e.exactlyEquals(g.zero)){const r=this.size().mul(e).scale(-.5);t.translateSelf(r.x,r.y)}return t}scalingRotationMatrix(){const t=new DOMMatrix;t.rotateSelf(0,0,this.rotation()),t.scaleSelf(this.scale.x(),this.scale.y());const e=this.offset();if(!e.exactlyEquals(g.zero)){const r=this.size().mul(e).scale(-.5);t.translateSelf(r.x,r.y)}return t}getComputedLayout(){return new V(this.element.getBoundingClientRect())}computedPosition(){this.requestLayoutUpdate();const t=this.getComputedLayout(),e=new g(t.x+t.width/2*this.offset.x(),t.y+t.height/2*this.offset.y()),r=this.parentTransform();if(r){const i=r.getComputedLayout();e.x-=i.x+(i.width-t.width)/2,e.y-=i.y+(i.height-t.height)/2}return e}computedSize(){return this.requestLayoutUpdate(),this.getComputedLayout().size}requestLayoutUpdate(){const t=this.parentTransform();this.appendedToView()?(t==null||t.requestFontUpdate(),this.updateLayout()):t.requestLayoutUpdate()}appendedToView(){const t=this.isLayoutRoot();return t&&this.view().element.append(this.element),t}updateLayout(){if(this.applyFont(),this.applyFlex(),this.layoutEnabled()){const t=this.layoutChildren();for(const e of t)e.updateLayout()}}layoutChildren(){const t=[...this.children()],e=[],r=[];for(;t.length;){const i=t.shift();i instanceof Sr?i.layoutEnabled()&&(e.push(i),r.push(i.element)):i&&t.unshift(...i.children())}return this.element.replaceChildren(...r),e}requestFontUpdate(){var t;this.appendedToView(),(t=this.parentTransform())==null||t.requestFontUpdate(),this.applyFont()}getCacheBBox(){return V.fromSizeCentered(this.computedSize())}draw(t){if(this.clip()){const e=this.computedSize();if(e.width===0||e.height===0)return;t.beginPath(),t.rect(e.width/-2,e.height/-2,e.width,e.height),t.closePath(),t.clip()}this.drawChildren(t)}drawOverlay(t,e){const r=this.computedSize(),i=r.mul(this.offset()).scale(.5).transformAsPoint(e),a=V.fromSizeCentered(r),h=a.transformCorners(e),u=a.addSpacing(this.padding().scale(-1)).transformCorners(e),v=a.addSpacing(this.margin()).transformCorners(e);t.beginPath(),pe(t,v),pe(t,h),t.closePath(),t.fillStyle="rgba(255,193,125,0.6)",t.fill("evenodd"),t.beginPath(),pe(t,h),pe(t,u),t.closePath(),t.fillStyle="rgba(180,255,147,0.6)",t.fill("evenodd"),t.beginPath(),pe(t,h),t.closePath(),t.lineWidth=1,t.strokeStyle="white",t.stroke(),t.beginPath(),bu(t,i),t.stroke()}getOriginDelta(t){const e=this.computedSize().scale(.5),r=this.offset().mul(e);return t===ot.Middle?r.flipped:su(t).mul(e).sub(r)}moveOffset(t){const e=this.computedSize().scale(.5),r=this.offset().mul(e),i=t.mul(e);this.offset(t),this.position(this.position().add(i).sub(r))}parsePixels(t){return t===null?"":`${t}px`}parseLength(t){return t===null?"":typeof t=="string"?t:`${t}px`}applyFlex(){this.element.style.position=this.isLayoutRoot()?"absolute":"relative";const t=this.desiredSize();this.element.style.width=this.parseLength(t.x),this.element.style.height=this.parseLength(t.y),this.element.style.maxWidth=this.parseLength(this.maxWidth()),this.element.style.minWidth=this.parseLength(this.minWidth()),this.element.style.maxHeight=this.parseLength(this.maxHeight()),this.element.style.minHeight=this.parseLength(this.minHeight()),this.element.style.aspectRatio=this.ratio()===null?"":this.ratio().toString(),this.element.style.marginTop=this.parsePixels(this.margin.top()),this.element.style.marginBottom=this.parsePixels(this.margin.bottom()),this.element.style.marginLeft=this.parsePixels(this.margin.left()),this.element.style.marginRight=this.parsePixels(this.margin.right()),this.element.style.paddingTop=this.parsePixels(this.padding.top()),this.element.style.paddingBottom=this.parsePixels(this.padding.bottom()),this.element.style.paddingLeft=this.parsePixels(this.padding.left()),this.element.style.paddingRight=this.parsePixels(this.padding.right()),this.element.style.flexDirection=this.direction(),this.element.style.flexBasis=this.parseLength(this.basis()),this.element.style.flexWrap=this.wrap(),this.element.style.justifyContent=this.justifyContent(),this.element.style.alignContent=this.alignContent(),this.element.style.alignItems=this.alignItems(),this.element.style.alignSelf=this.alignSelf(),this.element.style.columnGap=this.parseLength(this.gap.x()),this.element.style.rowGap=this.parseLength(this.gap.y()),this.sizeLockCounter()>0?(this.element.style.flexGrow="0",this.element.style.flexShrink="0"):(this.element.style.flexGrow=this.grow().toString(),this.element.style.flexShrink=this.shrink().toString())}applyFont(){if(this.element.style.fontFamily=this.fontFamily.isInitial()?"":this.fontFamily(),this.element.style.fontSize=this.fontSize.isInitial()?"":`${this.fontSize()}px`,this.element.style.fontStyle=this.fontStyle.isInitial()?"":this.fontStyle(),this.lineHeight.isInitial())this.element.style.lineHeight="";else{const t=this.lineHeight();this.element.style.lineHeight=typeof t=="string"?(parseFloat(t)/100).toString():`${t}px`}if(this.element.style.fontWeight=this.fontWeight.isInitial()?"":this.fontWeight().toString(),this.element.style.letterSpacing=this.letterSpacing.isInitial()?"":`${this.letterSpacing()}px`,this.element.style.textAlign=this.textAlign.isInitial()?"":this.textAlign(),this.textWrap.isInitial())this.element.style.whiteSpace="";else{const t=this.textWrap();typeof t=="boolean"?this.element.style.whiteSpace=t?"normal":"nowrap":this.element.style.whiteSpace=t}}dispose(){var t;super.dispose(),(t=this.sizeLockCounter)==null||t.context.dispose(),this.element&&(this.element.remove(),this.element.innerHTML=""),this.element=null,this.styles=null}hit(t){const e=t.transformAsPoint(this.localToParent().inverse());return this.cacheBBox().includes(e)?super.hit(t)??this:null}};A([I(null),Fi(Qc),R()],$.prototype,"layout",void 0);A([I(null),R()],$.prototype,"maxWidth",void 0);A([I(null),R()],$.prototype,"maxHeight",void 0);A([I(null),R()],$.prototype,"minWidth",void 0);A([I(null),R()],$.prototype,"minHeight",void 0);A([I(null),R()],$.prototype,"ratio",void 0);A([$r("margin")],$.prototype,"margin",void 0);A([$r("padding")],$.prototype,"padding",void 0);A([I("row"),R()],$.prototype,"direction",void 0);A([I(null),R()],$.prototype,"basis",void 0);A([I(0),R()],$.prototype,"grow",void 0);A([I(1),R()],$.prototype,"shrink",void 0);A([I("nowrap"),R()],$.prototype,"wrap",void 0);A([I("start"),R()],$.prototype,"justifyContent",void 0);A([I("normal"),R()],$.prototype,"alignContent",void 0);A([I("stretch"),R()],$.prototype,"alignItems",void 0);A([I("auto"),R()],$.prototype,"alignSelf",void 0);A([I(0),Jt({x:"columnGap",y:"rowGap"})],$.prototype,"gap",void 0);A([oe("font-family"),R()],$.prototype,"fontFamily",void 0);A([oe("font-size",parseFloat),R()],$.prototype,"fontSize",void 0);A([oe("font-style"),R()],$.prototype,"fontStyle",void 0);A([oe("font-weight",parseInt),R()],$.prototype,"fontWeight",void 0);A([oe("line-height",parseFloat),R()],$.prototype,"lineHeight",void 0);A([oe("letter-spacing",n=>n==="normal"?0:parseFloat(n)),R()],$.prototype,"letterSpacing",void 0);A([oe("white-space",n=>n==="pre"?"pre":n==="normal"),R()],$.prototype,"textWrap",void 0);A([I("inherit"),R()],$.prototype,"textDirection",void 0);A([oe("text-align"),R()],$.prototype,"textAlign",void 0);A([I({x:null,y:null}),Jt({x:"width",y:"height"})],$.prototype,"size",void 0);A([ft()],$.prototype,"tweenWidth",null);A([ft()],$.prototype,"tweenHeight",null);A([E()],$.prototype,"desiredSize",null);A([ft()],$.prototype,"tweenSize",null);A([Jt("offset")],$.prototype,"offset",void 0);A([Qt(ot.Middle)],$.prototype,"middle",void 0);A([Qt(ot.Top)],$.prototype,"top",void 0);A([Qt(ot.Bottom)],$.prototype,"bottom",void 0);A([Qt(ot.Left)],$.prototype,"left",void 0);A([Qt(ot.Right)],$.prototype,"right",void 0);A([Qt(ot.TopLeft)],$.prototype,"topLeft",void 0);A([Qt(ot.TopRight)],$.prototype,"topRight",void 0);A([Qt(ot.BottomLeft)],$.prototype,"bottomLeft",void 0);A([Qt(ot.BottomRight)],$.prototype,"bottomRight",void 0);A([I(!1),R()],$.prototype,"clip",void 0);A([I(0),R()],$.prototype,"sizeLockCounter",void 0);A([E()],$.prototype,"parentTransform",null);A([E()],$.prototype,"anchorPosition",null);A([E()],$.prototype,"layoutEnabled",null);A([E()],$.prototype,"isLayoutRoot",null);A([E()],$.prototype,"scalingRotationMatrix",null);A([E()],$.prototype,"computedPosition",null);A([E()],$.prototype,"computedSize",null);A([E()],$.prototype,"requestLayoutUpdate",null);A([E()],$.prototype,"appendedToView",null);A([E()],$.prototype,"updateLayout",null);A([E()],$.prototype,"layoutChildren",null);A([E()],$.prototype,"requestFontUpdate",null);A([E()],$.prototype,"applyFlex",null);A([E()],$.prototype,"applyFont",null);$=Sr=A([Ce("Layout")],$);function Qt(n){return(t,e)=>{R()(t,e),ke(!1)(t,e);const r=Se(t,e);r.parser=i=>new g(i),r.getter=function(){return this.computedSize().getOriginOffset(n).transformAsPoint(this.localToParent())},r.setter=function(i){return this.position(me(i,a=>this.getOriginDelta(n).transform(this.scalingRotationMatrix()).flipped.add(a))),this}}}rr($.prototype,n=>{n.element=document.createElement("div"),n.element.style.display="flex",n.element.style.boxSizing="border-box",n.styles=getComputedStyle(n.element)});var Pt=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var u=n.length-1;u>=0;u--)(h=n[u])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};let yt=class extends ${rippleSize(){return tu(this.rippleStrength(),0,50)}constructor(t){super(t),this.rippleStrength=je(0)}applyText(t){t.direction=this.textDirection(),this.element.dir=this.textDirection()}applyStyle(t){t.fillStyle=pn(this.fill(),t),t.strokeStyle=pn(this.stroke(),t),t.lineWidth=this.lineWidth(),t.lineJoin=this.lineJoin(),t.lineCap=this.lineCap(),t.setLineDash(this.lineDash()),t.lineDashOffset=this.lineDashOffset(),this.antialiased()||(t.filter="url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxmaWx0ZXIgaWQ9ImZpbHRlciIgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgY29sb3ItaW50ZXJwb2xhdGlvbi1maWx0ZXJzPSJzUkdCIj48ZmVDb21wb25lbnRUcmFuc2Zlcj48ZmVGdW5jUiB0eXBlPSJpZGVudGl0eSIvPjxmZUZ1bmNHIHR5cGU9ImlkZW50aXR5Ii8+PGZlRnVuY0IgdHlwZT0iaWRlbnRpdHkiLz48ZmVGdW5jQSB0eXBlPSJkaXNjcmV0ZSIgdGFibGVWYWx1ZXM9IjAgMSIvPjwvZmVDb21wb25lbnRUcmFuc2Zlcj48L2ZpbHRlcj48L3N2Zz4=#filter)")}draw(t){this.drawShape(t),this.clip()&&t.clip(this.getPath()),this.drawChildren(t)}drawShape(t){const e=this.getPath(),r=this.lineWidth()>0&&this.stroke()!==null,i=this.fill()!==null;t.save(),this.applyStyle(t),this.drawRipple(t),this.strokeFirst()?(r&&t.stroke(e),i&&t.fill(e)):(i&&t.fill(e),r&&t.stroke(e)),t.restore()}getCacheBBox(){return super.getCacheBBox().expand(this.lineWidth()/2)}getPath(){return new Path2D}getRipplePath(){return new Path2D}drawRipple(t){const e=this.rippleStrength();if(e>0){const r=this.getRipplePath();t.save(),t.globalAlpha*=tt(.54,0,e),t.fill(r),t.restore()}}*ripple(t=1){this.rippleStrength(0),yield*this.rippleStrength(1,t,eu),this.rippleStrength(0)}};Pt([Ni()],yt.prototype,"fill",void 0);Pt([Ni()],yt.prototype,"stroke",void 0);Pt([I(!1),R()],yt.prototype,"strokeFirst",void 0);Pt([I(0),R()],yt.prototype,"lineWidth",void 0);Pt([I("miter"),R()],yt.prototype,"lineJoin",void 0);Pt([I("butt"),R()],yt.prototype,"lineCap",void 0);Pt([I([]),R()],yt.prototype,"lineDash",void 0);Pt([I(0),R()],yt.prototype,"lineDashOffset",void 0);Pt([I(!0),R()],yt.prototype,"antialiased",void 0);Pt([E()],yt.prototype,"rippleSize",null);Pt([E()],yt.prototype,"getPath",null);Pt([ft()],yt.prototype,"ripple",null);yt=Pt([Ce("Shape")],yt);var zt=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var u=n.length-1;u>=0;u--)(h=n[u])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};let Tt=class extends yt{desiredSize(){return this.childrenBBox().size}constructor(t){super(t),this.canHaveSubpath=!1}percentageToDistance(t){return xt(0,this.baseArcLength(),this.startOffset()+this.offsetArcLength()*t)}distanceToPercentage(t){return(t-this.startOffset())/this.offsetArcLength()}baseArcLength(){return this.profile().arcLength}offsetArcLength(){const t=this.startOffset(),e=this.endOffset(),r=this.baseArcLength();return xt(0,r,r-t-e)}arcLength(){return this.offsetArcLength()*Math.abs(this.start()-this.end())}completion(){return Math.abs(this.start()-this.end())}processSubpath(t,e,r){}curveDrawingInfo(){const t=new Path2D;let e=new Path2D;const r=this.profile();let i=this.percentageToDistance(this.start()),a=this.percentageToDistance(this.end());i>a&&([i,a]=[a,i]);const h=a-i,u=Math.min(h/2,this.arrowSize());this.startArrow()&&(i+=u/2),this.endArrow()&&(a-=u/2);let v=0,y=null,C=null,F=null,H=null;for(const J of r.segments){const et=v;if(v+=J.arcLength,va)break}return this.closed()&&this.start.isInitial()&&this.end.isInitial()&&this.startOffset.isInitial()&&this.endOffset.isInitial()&&e.closePath(),this.processSubpath(e,y,F),t.addPath(e),{startPoint:y??g.zero,startTangent:C??g.right,endPoint:F??g.zero,endTangent:H??g.right,arrowSize:u,path:t,startOffset:i}}getPointAtDistance(t){return yi(this.profile(),t+this.startOffset())}getPointAtPercentage(t){return yi(this.profile(),this.percentageToDistance(t))}getComputedLayout(){return this.offsetComputedLayout(super.getComputedLayout())}offsetComputedLayout(t){return t.position=t.position.sub(this.childrenBBox().center),t}getPath(){return this.curveDrawingInfo().path}getCacheBBox(){const t=this.childrenBBox(),e=this.startArrow()||this.endArrow()?this.arrowSize():0,r=this.lineWidth(),i=this.lineWidthCoefficient();return t.expand(Math.max(0,e,r*i))}lineWidthCoefficient(){return this.lineCap()==="square"?.5*1.4143:.5}requiresProfile(){return!this.start.isInitial()||!this.startOffset.isInitial()||!this.startArrow.isInitial()||!this.end.isInitial()||!this.endOffset.isInitial()||!this.endArrow.isInitial()}drawShape(t){super.drawShape(t),(this.startArrow()||this.endArrow())&&this.drawArrows(t)}drawArrows(t){const{startPoint:e,startTangent:r,endPoint:i,endTangent:a,arrowSize:h}=this.curveDrawingInfo();h<.001||(t.save(),t.beginPath(),this.endArrow()&&this.drawArrow(t,i,a.flipped,h),this.startArrow()&&this.drawArrow(t,e,r,h),t.fillStyle=pn(this.stroke(),t),t.closePath(),t.fill(),t.restore())}drawArrow(t,e,r,i){const a=r.perpendicular,h=e.add(r.scale(-i/2));Lr(t,h),qt(t,h.add(r.add(a).scale(i))),qt(t,h.add(r.sub(a).scale(i))),qt(t,h),t.closePath()}};zt([I(!1),R()],Tt.prototype,"closed",void 0);zt([I(0),R()],Tt.prototype,"start",void 0);zt([I(0),R()],Tt.prototype,"startOffset",void 0);zt([I(!1),R()],Tt.prototype,"startArrow",void 0);zt([I(1),R()],Tt.prototype,"end",void 0);zt([I(0),R()],Tt.prototype,"endOffset",void 0);zt([I(!1),R()],Tt.prototype,"endArrow",void 0);zt([I(24),R()],Tt.prototype,"arrowSize",void 0);zt([E()],Tt.prototype,"arcLength",null);zt([E()],Tt.prototype,"curveDrawingInfo",null);Tt=zt([Ce("Curve")],Tt);class Pn{}class Ru extends Pn{constructor(t,e,r,i,a){super(),this.center=t,this.radius=e,this.from=r,this.to=i,this.counter=a,this.angle=Math.acos(xt(-1,1,r.dot(i))),this.length=Math.abs(this.angle*e);const h=new g(1,1).scale(e);this.points=[t.sub(h),t.add(h)]}get arcLength(){return this.length}draw(t,e,r){const i=this.counter?-1:1,a=this.from.radians+e*this.angle*i,h=this.to.radians-(1-r)*this.angle*i;Math.abs(this.angle)>1e-4&&t.arc(this.center.x,this.center.y,this.radius,a,h,this.counter);const u=g.fromRadians(a),v=g.fromRadians(h);return[{position:this.center.add(u.scale(this.radius)),tangent:this.counter?u:u.flipped,normal:this.counter?u.flipped:u},{position:this.center.add(v.scale(this.radius)),tangent:this.counter?v.flipped:v,normal:this.counter?v.flipped:v}]}getPoint(t){const e=this.counter?-1:1,r=this.from.radians+t*this.angle*e,i=g.fromRadians(r);return{position:this.center.add(i.scale(this.radius)),tangent:this.counter?i:i.flipped,normal:this.counter?i:i.flipped}}}class bt{static constant(t){return new bt(t)}static linear(t,e){return new bt(t,e)}static quadratic(t,e,r){return new bt(t,e,r)}static cubic(t,e,r,i){return new bt(t,e,r,i)}get degree(){return this.c3!==0?3:this.c2!==0?2:this.c1!==0?1:0}constructor(t,e,r,i){this.c0=t,this.c1=e??0,this.c2=r??0,this.c3=i??0}differentiate(t=1){switch(t){case 0:return this;case 1:return new bt(this.c1,2*this.c2,3*this.c3,0);case 2:return new bt(2*this.c2,6*this.c3,0,0);case 3:return new bt(6*this.c3,0,0,0);default:throw new Error("Unsupported derivative")}}eval(t,e=0){return e!==0?this.differentiate(e).eval(t):this.c3*(t*t*t)+this.c2*(t*t)+this.c1*t+this.c0}split(t){const e=1-t,r=new bt(this.c0,this.c1*t,this.c2*t*t,this.c3*t*t*t),i=new bt(this.eval(0),e*this.differentiate(1).eval(t),e*e/2*this.differentiate(2).eval(t),e*e*e/6*this.differentiate(3).eval(t));return[r,i]}roots(){switch(this.degree){case 3:return this.solveCubicRoots();case 2:return this.solveQuadraticRoots();case 1:return this.solveLinearRoot();case 0:return[];default:throw new Error(`Unsupported polynomial degree: ${this.degree}`)}}localExtrema(){return this.differentiate().roots()}localExtrema01(){const t=this.localExtrema(),e=[];for(let r=0;r=0&&i<=1&&e.push(t[r])}return e}outputRange01(){let t=[this.eval(0),this.eval(1)];const e=r=>{t[1]>t[0]?t=[Math.min(t[0],r),Math.max(t[1],r)]:t=[Math.min(t[1],r),Math.max(t[0],r)]};return this.localExtrema01().forEach(r=>e(this.eval(r))),t}solveCubicRoots(){const t=this.c0,e=this.c1,r=this.c2,i=this.c3,a=t*t,h=t*r,u=e*e,v=(3*h-u)/(3*a),y=(2*u*e-9*h*e+27*a*i)/(27*a*t),C=this.solveDepressedCubicRoots(v,y),F=H=>H-e/(3*t);switch(C.length){case 1:return[F(C[0])];case 2:return[F(C[0]),F(C[1])];case 3:return[F(C[0]),F(C[1]),F(C[2])];default:return[]}}solveDepressedCubicRoots(t,e){if(this.almostZero(t))return[Math.cbrt(-e)];const r=Math.PI*2,i=4*t*t*t+27*e*e;if(i<1e-5){const a=2*Math.sqrt(-t/3),h=3*e/(2*t)*Math.sqrt(-3/t),u=v=>a*Math.cos(1/3*Math.acos(xt(-1,1,h))-r/3*v);return h>=.9999?[u(0),u(2)]:h<=-.9999?[u(1),u(2)]:[u(0),u(1),u(2)]}if(i>0&&t<0){const a=.3333333333333333*Math.acosh(-3*Math.abs(e)/(2*t)*Math.sqrt(-3/t));return[-2*Math.sign(e)*Math.sqrt(-t/3)*Math.cosh(a)]}if(t>0){const a=.3333333333333333*Math.asinh(3*e/(2*t)*Math.sqrt(3/t));return[-2*Math.sqrt(t/3)*Math.sinh(a)]}return[]}solveQuadraticRoots(){const t=this.c2,e=this.c1,r=this.c0,i=e*e-4*t*r;if(this.almostZero(i))return[-e/(2*t)];if(i>=0){const a=Math.sqrt(i),h=(-e-a)/(2*t),u=(-e+a)/(2*t);return[Math.min(h,u),Math.max(h,u)]}return[]}solveLinearRoot(){return[-this.c0/this.c1]}almostZero(t){return Math.abs(0-t)<=Number.EPSILON}}class Ve{constructor(t,e,r,i){this.c0=t,this.c1=e,this.c2=r,this.c3=i,t instanceof bt?(this.x=t,this.y=e):i!==void 0?(this.x=new bt(t.x,e.x,r.x,i.x),this.y=new bt(t.y,e.y,r.y,i.y)):(this.x=new bt(t.x,e.x,r.x),this.y=new bt(t.y,e.y,r.y))}eval(t,e=0){return new g(this.x.differentiate(e).eval(t),this.y.differentiate(e).eval(t))}split(t){const[e,r]=this.x.split(t),[i,a]=this.y.split(t);return[new Ve(e,i),new Ve(r,a)]}differentiate(t=1){return new Ve(this.x.differentiate(t),this.y.differentiate(t))}evalDerivative(t){return this.differentiate().eval(t)}getBounds(){const t=this.x.outputRange01(),e=this.y.outputRange01();return V.fromPoints(new g(Math.min(...t),Math.max(...e)),new g(Math.max(...t),Math.min(...e)))}}class Pu{constructor(t,e=20){this.curve=t,this.sampledDistances=[],this.resample(e)}resample(t){this.sampledDistances=[0];let e=0,r=this.curve.eval(0).position;for(let i=1;i=i&&t<=a)return Kc(i,a,r/(e-1),(r+1)/(e-1),t)}return 1}}class Mu extends Pn{get arcLength(){return this.length}constructor(t,e){super(),this.curve=t,this.length=e,this.pointSampler=new Pu(this)}getBBox(){return this.curve.getBounds()}eval(t){const e=this.tangent(t);return{position:this.curve.eval(t),tangent:e,normal:e.perpendicular}}getPoint(t){const e=this.pointSampler.pointAtDistance(this.arcLength*t);return{position:e.position,tangent:e.tangent,normal:e.tangent.perpendicular}}transformPoints(t){return this.points.map(e=>e.transformAsPoint(t))}tangent(t){return this.curve.evalDerivative(t).normalized}draw(t,e=0,r=1,i=!0){let a=null,h=e,u=r,v=this.points;if(e!==0||r!==1){const F=this.length*e,H=this.length*r;h=this.pointSampler.distanceToT(F),u=this.pointSampler.distanceToT(H);const J=(u-h)/(1-h),[,et]=this.split(h);[a]=et.split(J),v=a.points}i&&Lr(t,v[0]),(a??this).doDraw(t);const y=this.tangent(h),C=this.tangent(u);return[{position:v[0],tangent:y,normal:y.perpendicular},{position:v.at(-1),tangent:C,normal:C.perpendicular}]}}var Lu=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var u=n.length-1;u>=0;u--)(h=n[u])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};class ne extends Mu{get points(){return[this.p0,this.p1,this.p2,this.p3]}constructor(t,e,r,i){super(new Ve(t,t.flipped.add(e).scale(3),t.scale(3).sub(e.scale(6)).add(r.scale(3)),t.flipped.add(e.scale(3)).sub(r.scale(3)).add(i)),ne.getLength(t,e,r,i)),this.p0=t,this.p1=e,this.p2=r,this.p3=i}split(t){const e=new g(this.p0.x+(this.p1.x-this.p0.x)*t,this.p0.y+(this.p1.y-this.p0.y)*t),r=new g(this.p1.x+(this.p2.x-this.p1.x)*t,this.p1.y+(this.p2.y-this.p1.y)*t),i=new g(this.p2.x+(this.p3.x-this.p2.x)*t,this.p2.y+(this.p3.y-this.p2.y)*t),a=new g(e.x+(r.x-e.x)*t,e.y+(r.y-e.y)*t),h=new g(r.x+(i.x-r.x)*t,r.y+(i.y-r.y)*t),u=new g(a.x+(h.x-a.x)*t,a.y+(h.y-a.y)*t),v=new ne(this.p0,e,a,u),y=new ne(u,h,i,this.p3);return[v,y]}doDraw(t){wu(t,this.p1,this.p2,this.p3)}static getLength(t,e,r,i){return ne.el.setAttribute("d",`M ${t.x} ${t.y} C ${e.x} ${e.y} ${r.x} ${r.y} ${i.x} ${i.y}`),ne.el.getTotalLength()}}Lu([Ci(()=>document.createElementNS("http://www.w3.org/2000/svg","path"))],ne,"el",void 0);class br extends Pn{constructor(t,e){super(),this.from=t,this.to=e,this.vector=e.sub(t),this.length=this.vector.magnitude,this.normal=this.vector.perpendicular.normalized.safe,this.points=[t,e]}get arcLength(){return this.length}draw(t,e=0,r=1,i=!1){const a=this.from.add(this.vector.scale(e)),h=this.from.add(this.vector.scale(r));return i&&Lr(t,a),qt(t,h),[{position:a,tangent:this.normal.flipped,normal:this.normal},{position:h,tangent:this.normal,normal:this.normal}]}getPoint(t){return{position:this.from.add(this.vector.scale(t)),tangent:this.normal.flipped,normal:this.normal}}}function $u(n,t,e,r){const i={arcLength:0,segments:[],minSin:1},a=se(t.top,t.right,t.left,n),h=se(t.right,t.top,t.bottom,n),u=se(t.bottom,t.left,t.right,n),v=se(t.left,t.bottom,t.top,n);let y=new g(n.left+a,n.top),C=new g(n.right-h,n.top);return Fe(i,new br(y,C)),y=new g(n.right,n.top+h),C=new g(n.right,n.bottom-u),h>0&&yr(i,y.addX(-h),h,g.down,g.right,e,r),Fe(i,new br(y,C)),y=new g(n.right-u,n.bottom),C=new g(n.left+v,n.bottom),u>0&&yr(i,y.addY(-u),u,g.right,g.up,e,r),Fe(i,new br(y,C)),y=new g(n.left,n.bottom-v),C=new g(n.left,n.top+a),v>0&&yr(i,y.addX(v),v,g.up,g.left,e,r),Fe(i,new br(y,C)),y=new g(n.left+a,n.top),a>0&&yr(i,y.addY(a),a,g.left,g.down,e,r),i}function Fe(n,t){n.segments.push(t),n.arcLength+=t.arcLength}function yr(n,t,e,r,i,a,h){const u=t.add(r.scale(e)),v=t.add(i.scale(e));a?Fe(n,new ne(u,u.add(i.scale(h*e)),v.add(r.scale(h*e)),v)):Fe(n,new Ru(t,e,r,i,!1))}var ir=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var u=n.length-1;u>=0;u--)(h=n[u])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};let Zt=class extends Tt{constructor(t){super(t)}profile(){return $u(this.childrenBBox(),this.radius(),this.smoothCorners(),this.cornerSharpness())}desiredSize(){return{x:this.width.context.getter(),y:this.height.context.getter()}}offsetComputedLayout(t){return t}childrenBBox(){return V.fromSizeCentered(this.computedSize())}getPath(){if(this.requiresProfile())return this.curveDrawingInfo().path;const t=new Path2D,e=this.radius(),r=this.smoothCorners(),i=this.cornerSharpness(),a=V.fromSizeCentered(this.size());return bi(t,a,e,r,i),t}getCacheBBox(){return super.getCacheBBox().expand(this.rippleSize())}getRipplePath(){const t=new Path2D,e=this.rippleSize(),r=this.radius().addScalar(e),i=this.smoothCorners(),a=this.cornerSharpness(),h=V.fromSizeCentered(this.size()).expand(e);return bi(t,h,r,i,a),t}};ir([$r("radius")],Zt.prototype,"radius",void 0);ir([I(!1),R()],Zt.prototype,"smoothCorners",void 0);ir([I(.6),R()],Zt.prototype,"cornerSharpness",void 0);ir([E()],Zt.prototype,"profile",null);Zt=ir([Ce("Rect")],Zt);var le=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var u=n.length-1;u>=0;u--)(h=n[u])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};class Et extends z{constructor({children:t,...e}){super(e),this.scene()||this.scene(new z({})),t&&this.scene().add(t)}getZoom(){return 1/this.scale.x()}setZoom(t){this.scale(me(t,e=>1/e))}getDefaultZoom(){return this.scale.x.context.getInitial()}*tweenZoom(t,e,r,i){const a=this.scale.x();yield*Dt(e,h=>{this.zoom(1/i(a,1/ye(t),r(h)))})}*reset(t,e=_t){yield*ve(this.position(Ye,t,e),this.zoom(Ye,t,e),this.rotation(Ye,t,e))}*centerOn(t,e,r=_t,i=g.lerp){const a=t instanceof z?t.absolutePosition().transformAsPoint(this.scene().worldToLocal()):t;yield*this.position(a,e,r,i)}*followCurve(t,e,r=_t){yield*Dt(e,i=>{const a=r(i),h=t.getPointAtPercentage(a).position.transformAsPoint(t.localToWorld());this.position(h)})}*followCurveReverse(t,e,r=_t){yield*Dt(e,i=>{const a=1-r(i),h=t.getPointAtPercentage(a).position.transformAsPoint(t.localToWorld());this.position(h)})}*followCurveWithRotation(t,e,r=_t){yield*Dt(e,i=>{const a=r(i),{position:h,normal:u}=t.getPointAtPercentage(a),v=h.transformAsPoint(t.localToWorld()),y=u.flipped.perpendicular.degrees;this.position(v),this.rotation(y)})}*followCurveWithRotationReverse(t,e,r=_t){yield*Dt(e,i=>{const a=1-r(i),{position:h,normal:u}=t.getPointAtPercentage(a),v=h.transformAsPoint(t.localToWorld()),y=u.flipped.perpendicular.degrees;this.position(v),this.rotation(y)})}transformContext(t){const e=this.localToParent().inverse();t.transform(e.a,e.b,e.c,e.d,e.e,e.f)}hit(t){const e=t.transformAsPoint(this.localToParent());return this.scene().hit(e)}drawChildren(t){this.scene().drawChildren(t)}static Stage({children:t,cameraRef:e,scene:r,...i}){const a=new Et({scene:r,children:t});return e==null||e(a),new Zt({clip:!0,...i,children:[a]})}}le([R()],Et.prototype,"scene",void 0);le([ke(!1),R()],Et.prototype,"zoom",void 0);le([ft()],Et.prototype,"reset",null);le([ft()],Et.prototype,"centerOn",null);le([ft()],Et.prototype,"followCurve",null);le([ft()],Et.prototype,"followCurveReverse",null);le([ft()],Et.prototype,"followCurveWithRotation",null);le([ft()],Et.prototype,"followCurveWithRotationReverse",null);var ar=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var u=n.length-1;u>=0;u--)(h=n[u])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a},gn;let xe=gn=class extends Zt{constructor(t){super({composite:!0,fontFamily:"Roboto",fontSize:48,lineHeight:"120%",textWrap:!1,fontStyle:"normal",...t}),this.view2D=this,gn.shadowRoot.append(this.element),this.applyFlex()}dispose(){this.removeChildren(),super.dispose()}render(t){this.computedSize(),this.computedPosition(),super.render(t)}findKey(t){return wr().getNode(t)??null}requestLayoutUpdate(){this.updateLayout()}requestFontUpdate(){this.applyFont()}view(){return this}};ar([I(Je.Paused),R()],xe.prototype,"playbackState",void 0);ar([I(0),R()],xe.prototype,"globalTime",void 0);ar([R()],xe.prototype,"assetHash",void 0);ar([Ci(()=>{const n="motion-canvas-2d-frame";let t=document.querySelector(`#${n}`);return t||(t=document.createElement("div"),t.id=n,t.style.position="absolute",t.style.pointerEvents="none",t.style.top="0",t.style.left="0",t.style.opacity="0",t.style.overflow="hidden",document.body.prepend(t)),t.shadowRoot??t.attachShadow({mode:"open"})})],xe,"shadowRoot",void 0);xe=gn=ar([Ce("View2D")],xe);var he=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var u=n.length-1;u>=0;u--)(h=n[u])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a},kr;let Rt=kr=class extends Zt{constructor(t){super(t),"src"in t||it().warn({message:"No source specified for the image",remarks:`

The image won't be visible unless you specify a source:

+
import myImage from './example.png';
+// ...
+<Img src={myImage} />;

If you did this intentionally, and don't want to see this warning, set the src +property to null:

+
<Img src={null} />

Learn more about working with +images.

+`,inspect:this.key})}desiredSize(){const t=super.desiredSize();if(t.x===null&&t.y===null){const e=this.image();return{x:e.naturalWidth,y:e.naturalHeight}}return t}image(){const t=this.src();let e="",r="";if(t){r=Mc(t);const a=new URL(r,window.location.origin);if(a.origin===window.location.origin){const h=this.view().assetHash();a.searchParams.set("asset-hash",h)}e=a.toString()}let i=kr.pool[r];return i||(i=document.createElement("img"),i.crossOrigin="anonymous",i.src=e,kr.pool[r]=i),i.complete||lt.collectPromise(new Promise((a,h)=>{i.addEventListener("load",a),i.addEventListener("error",()=>h(new mn({message:"Failed to load an image",remarks:`The src property was set to: +
${t}
+...which resolved to the following url: +
${e}
+Make sure that source is correct and that the image exists.
+Learn more +about working with images.`,inspect:this.key})))})),i}imageCanvas(){const t=document.createElement("canvas").getContext("2d",{willReadFrequently:!0});if(!t)throw new Error("Could not create an image canvas");return t}filledImageCanvas(){const t=this.imageCanvas(),e=this.image();return t.canvas.width=e.naturalWidth,t.canvas.height=e.naturalHeight,t.imageSmoothingEnabled=this.smoothing(),t.drawImage(e,0,0),t}draw(t){this.drawShape(t);const e=this.alpha();if(e>0){const r=V.fromSizeCentered(this.computedSize());t.save(),t.clip(this.getPath()),e<1&&(t.globalAlpha*=e),t.imageSmoothingEnabled=this.smoothing(),mu(t,this.image(),r),t.restore()}this.clip()&&t.clip(this.getPath()),this.drawChildren(t)}applyFlex(){super.applyFlex();const t=this.image();this.element.style.aspectRatio=(this.ratio()??t.naturalWidth/t.naturalHeight).toString()}getColorAtPoint(t){const e=this.computedSize(),r=this.naturalSize(),i=new g(t).add(this.computedSize().scale(.5)).mul(r.div(e).safe);return this.getPixelColor(i)}naturalSize(){const t=this.image();return new g(t.naturalWidth,t.naturalHeight)}getPixelColor(t){const e=this.filledImageCanvas(),r=new g(t),i=e.getImageData(r.x,r.y,1,1).data;return new Yt({r:i[0],g:i[1],b:i[2],a:i[3]/255})}collectAsyncResources(){super.collectAsyncResources(),this.image()}};Rt.pool={};he([R()],Rt.prototype,"src",void 0);he([I(1),R()],Rt.prototype,"alpha",void 0);he([I(!0),R()],Rt.prototype,"smoothing",void 0);he([E()],Rt.prototype,"image",null);he([E()],Rt.prototype,"imageCanvas",null);he([E()],Rt.prototype,"filledImageCanvas",null);he([E()],Rt.prototype,"naturalSize",null);Rt=kr=he([Ce("Img")],Rt);var Mn=globalThis&&globalThis.__decorate||function(n,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,e,r);else for(var u=n.length-1;u>=0;u--)(h=n[u])&&(a=(i<3?h(a):i>3?h(t,e,a):h(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};class _e extends Rt{constructor(t){super({...t,src:null})}svgUrl(){const t=this.icon().replace(":","/"),e=encodeURIComponent(this.color().hex());return`https://api.iconify.design/${t}.svg?color=${e}`}getSrc(){return this.svgUrl()}setSrc(t){t!==null&&it().warn("The Icon Component does not accept setting the `src`. If you need access to `src`, use '` instead.")}}Mn([R()],_e.prototype,"icon",void 0);Mn([I("white"),Bi()],_e.prototype,"color",void 0);Mn([E()],_e.prototype,"svgUrl",null);class Iu extends Zc{constructor(t){super(t),this.view=null,this.registeredNodes=new Map,this.nodeCounters=new Map,this.assetHash=Date.now().toString(),this.recreateView()}getView(){return this.view}next(){var t;return(t=this.getView())==null||t.playbackState(this.playback.state).globalTime(this.playback.time),super.next()}draw(t){t.save(),this.renderLifecycle.dispatch([jt.BeforeRender,t]),t.save(),this.renderLifecycle.dispatch([jt.BeginRender,t]),this.getView().playbackState(this.playback.state).globalTime(this.playback.time),this.getView().render(t),this.renderLifecycle.dispatch([jt.FinishRender,t]),t.restore(),this.renderLifecycle.dispatch([jt.AfterRender,t]),t.restore()}reset(t){for(const e of this.registeredNodes.keys())try{this.registeredNodes.get(e).dispose()}catch(r){this.logger.error(r)}return this.registeredNodes.clear(),this.registeredNodes=new Map,this.nodeCounters.clear(),this.recreateView(),super.reset(t)}inspectPosition(t,e){return this.execute(()=>{var r;return((r=this.getView().hit(new g(t,e)))==null?void 0:r.key)??null})}validateInspection(t){var e;return((e=this.getNode(t))==null?void 0:e.key)??null}inspectAttributes(t){const e=this.getNode(t);if(!e)return null;const r={stack:e.creationStack,key:e.key};for(const{key:i,meta:a,signal:h}of e)a.inspectable&&(r[i]=h());return r}drawOverlay(t,e,r){const i=this.getNode(t);i&&this.execute(()=>{const a=this.getView().findAll(ji(Et)),h=[];for(const u of a){const v=u.scene();v&&(v===i||v.findFirst(y=>y===i))&&h.push(u)}if(h.length>0)for(const u of h){const v=u.parentToWorld(),y=u.localToParent().inverse(),C=i.localToWorld();i.drawOverlay(r,e.multiply(v).multiply(y).multiply(C))}else i.drawOverlay(r,e.multiply(i.localToWorld()))})}transformMousePosition(t,e){return new g(t,e).transformAsPoint(this.getView().localToParent().inverse())}registerNode(t,e){var h;const r=((h=t.constructor)==null?void 0:h.name)??"unknown",i=(this.nodeCounters.get(r)??0)+1;this.nodeCounters.set(r,i),e&&this.registeredNodes.has(e)&&(it().error({message:`Duplicated node key: "${e}".`,inspect:e,stack:new Error().stack}),e=void 0),e??(e=`${this.name}/${r}[${i}]`),this.registeredNodes.set(e,t);const a=this.registeredNodes;return[e,()=>a.delete(e)]}getNode(t){return typeof t!="string"?null:this.registeredNodes.get(t)??null}*getDetachedNodes(){for(const t of this.registeredNodes.values())!t.parent()&&t!==this.view&&(yield t)}recreateView(){this.execute(()=>{const t=this.getSize();this.view=new xe({position:t.scale(this.resolutionScale/2),scale:this.resolutionScale,assetHash:this.assetHash,size:t})})}}function Au(n){return{klass:Iu,config:n,stack:new Error().stack,meta:Vc(),plugins:["@motion-canvas/2d/editor"]}}let Ou="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='576'%20height='576'%20viewBox='0%200%20576%20576'%20fill='none'%3e%3cpath%20d='M287.5%20229L86%20344.5L287.5%20460L489%20344.5L287.5%20229Z'%20stroke='url(%23paint0_linear_102_7)'%20stroke-width='59'%20stroke-linejoin='round'/%3e%3cpath%20d='M287.5%20116L86%20231.5L287.5%20347L489%20231.5L287.5%20116Z'%20stroke='url(%23paint1_linear_102_7)'%20stroke-width='59'%20stroke-linejoin='round'/%3e%3cpath%20d='M86%20344L288%20229'%20stroke='url(%23paint2_linear_102_7)'%20stroke-width='59'%20stroke-linejoin='bevel'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_102_7'%20x1='60'%20y1='341'%20x2='429.5'%20y2='344'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F9D100'/%3e%3cstop%20offset='1'%20stop-color='%23F97700'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_102_7'%20x1='513.5'%20y1='231'%20x2='143.5'%20y2='231'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F9D100'/%3e%3cstop%20offset='1'%20stop-color='%23F97700'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_102_7'%20x1='60'%20y1='344'%20x2='428.987'%20y2='341.811'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F9D100'/%3e%3cstop%20offset='1'%20stop-color='%23F97700'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e";const ge=Au(function*(n){n.fill("white");const t=Ge(),e=Ge(),r=Ge(),i=Ge(),a=Ge();n.add(Ee($,{layout:!0,direction:"row",size:"100%",padding:100,gap:0,alignItems:"center",justifyContent:"center",children:[Ee(Rt,{ref:t,src:Ou,width:"25%",offset:[1,2]}),Ee(_e,{ref:e,icon:"material-symbols-light:add-2-rounded",color:"#404040",width:"20%",margin:-10}),Ee(Rt,{ref:r,src:"https://motioncanvas.io/img/logo.svg",width:"25%",margin:-10}),Ee(_e,{ref:i,icon:"material-symbols-light:equal",color:"#404040",width:"20%",margin:-30}),Ee(_e,{ref:a,icon:"material-symbols-light:favorite",color:"#ff6470",width:"25%"})]}));let h=n.size().y*1.5;t().margin.bottom(h),e().margin.bottom(h),r().margin.bottom(h),i().margin.bottom(h),a().margin.bottom(h);const u={mass:.04,stiffness:10,damping:.85,initialVelocity:8};let v=function(y){return Ii(u,h,0,5,C=>{y().margin.bottom(C)})};yield*v(t),yield*v(e),yield*v(r),yield*v(i),yield*v(a),yield*Qe(1),yield*ve(t().opacity(0,1,qe),e().opacity(0,1,qe),r().opacity(0,1,qe),i().opacity(0,1,qe),a().opacity(0,1,qe)),yield*Qe(1)});ge.name="example";cu.attach(ge.meta);ge.onReplaced??(ge.onReplaced=new ie(ge.config));const zu={scenes:[ge]};let Ln;Ln??(Ln=new er("\0virtual:settings",!1));Ln.loadData({version:1,appearance:{color:"rgb(0,144,255)",font:!1,coordinates:!0},defaults:{background:"rgb(157,157,157)",size:{x:1920,y:1080}}});const Eu=Ln,Wu=Tc("project",{core:"3.17.2",two:"3.17.2",ui:"3.17.2",vitePlugin:"3.17.2"},[lu()],zu,hu,Eu);export{Wu as default};