@estjs/template 0.0.17-beta.1 → 0.0.17-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-3SR36LGP.js → chunk-CBFQJ3PB.js} +1 -1
- package/dist/{chunk-R6JICOKI.dev.js → chunk-PYFF2HI3.dev.js} +6 -6
- package/dist/chunk-PYFF2HI3.dev.js.map +1 -0
- package/dist/internal.cjs +1 -1
- package/dist/internal.dev.cjs +4 -4
- package/dist/internal.dev.cjs.map +1 -1
- package/dist/internal.dev.js +1 -1
- package/dist/internal.js +1 -1
- package/dist/template.cjs +2 -2
- package/dist/template.d.cts +25 -52
- package/dist/template.d.ts +25 -52
- package/dist/template.dev.cjs +220 -266
- package/dist/template.dev.cjs.map +1 -1
- package/dist/template.dev.js +217 -263
- package/dist/template.dev.js.map +1 -1
- package/dist/template.js +2 -2
- package/package.json +4 -4
- package/dist/chunk-R6JICOKI.dev.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import'@estjs/shared';import {setCurrentScope,effectScope}from'@estjs/signals';var f=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var m=(e,o)=>{var r={};for(var n in e)y.call(e,n)&&o.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&f)for(var n of f(e))o.indexOf(n)<0&&v.call(e,n)&&(r[n]=e[n]);return r};var D=(e,o,r)=>new Promise((n,i)=>{var a=l=>{try{c(r.next(l));}catch(d){i(d);}},S=l=>{try{c(r.throw(l));}catch(d){i(d);}},c=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,S);c((r=r.apply(e,o)).next());});var t=null,s=0;function w(){return t}function u(e){t=e,setCurrentScope(e==null?void 0:e.effectScope);}function T(e=t){let o=e?e.effectScope.run(()=>effectScope()):effectScope(true),r={id:++s,effectScope:o,parent:e,children:null,provides:null,cleanup:null,onMount:null,onUpdate:null,onDestroy:null,isMounted:false,isDestroyed:false};return e&&(e.children||(e.children=new Set),e.children.add(r)),r}function k(e,o){let r=t;u(e);try{return e.effectScope.run(o)}finally{u(r);}}function _(e){var r;if(!e||e.isDestroyed)return;if(e.isDestroyed=true,e.children&&e.children.size>0){for(let n of e.children)n&&(n.parent=null,_(n));e.children.clear();}let o=t;if(u(e),e.onDestroy){for(let n=0;n<e.onDestroy.length;n++)try{e.onDestroy[n]();}catch(i){}e.onDestroy=null;}if(e.cleanup){for(let n=0;n<e.cleanup.length;n++)try{e.cleanup[n]();}catch(i){}e.cleanup=null;}u(o),e.effectScope.stop(),
|
|
1
|
+
import'@estjs/shared';import {setCurrentScope,effectScope}from'@estjs/signals';var f=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var m=(e,o)=>{var r={};for(var n in e)y.call(e,n)&&o.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&f)for(var n of f(e))o.indexOf(n)<0&&v.call(e,n)&&(r[n]=e[n]);return r};var D=(e,o,r)=>new Promise((n,i)=>{var a=l=>{try{c(r.next(l));}catch(d){i(d);}},S=l=>{try{c(r.throw(l));}catch(d){i(d);}},c=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,S);c((r=r.apply(e,o)).next());});var t=null,s=0;function w(){return t}function u(e){t=e,setCurrentScope(e==null?void 0:e.effectScope);}function T(e=t){let o=e?e.effectScope.run(()=>effectScope()):effectScope(true),r={id:++s,effectScope:o,parent:e,children:null,provides:null,cleanup:null,onMount:null,onUpdate:null,onDestroy:null,isMounted:false,isDestroyed:false};return e&&(e.children||(e.children=new Set),e.children.add(r)),r}function k(e,o){let r=t;u(e);try{return e.effectScope.run(o)}finally{u(r);}}function _(e){var r;if(!e||e.isDestroyed)return;if(e.isDestroyed=true,(r=e.parent)!=null&&r.children&&e.parent.children.delete(e),e.parent=null,e.children&&e.children.size>0){for(let n of e.children)n&&(n.parent=null,_(n));e.children.clear();}let o=t;if(u(e),e.onDestroy){for(let n=0;n<e.onDestroy.length;n++)try{e.onDestroy[n]();}catch(i){}e.onDestroy=null;}if(e.cleanup){for(let n=0;n<e.cleanup.length;n++)try{e.cleanup[n]();}catch(i){}e.cleanup=null;}u(o),e.effectScope.stop(),e.provides&&(e.provides.clear(),e.provides=null),e.onMount=null,e.onUpdate=null,e.children=null;}function C(e){let o=t;o&&(o.cleanup||(o.cleanup=[]),o.cleanup.push(e));}export{m as a,D as b,w as c,u as d,T as e,k as f,_ as g,C as h};
|
|
@@ -89,6 +89,10 @@ function disposeScope(scope) {
|
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
91
|
scope.isDestroyed = true;
|
|
92
|
+
if ((_a = scope.parent) == null ? void 0 : _a.children) {
|
|
93
|
+
scope.parent.children.delete(scope);
|
|
94
|
+
}
|
|
95
|
+
scope.parent = null;
|
|
92
96
|
if (scope.children && scope.children.size > 0) {
|
|
93
97
|
for (const child of scope.children) {
|
|
94
98
|
if (child) {
|
|
@@ -122,9 +126,6 @@ function disposeScope(scope) {
|
|
|
122
126
|
}
|
|
123
127
|
setActiveScope(prevScope);
|
|
124
128
|
scope.effectScope.stop();
|
|
125
|
-
if ((_a = scope.parent) == null ? void 0 : _a.children) {
|
|
126
|
-
scope.parent.children.delete(scope);
|
|
127
|
-
}
|
|
128
129
|
if (scope.provides) {
|
|
129
130
|
scope.provides.clear();
|
|
130
131
|
scope.provides = null;
|
|
@@ -132,7 +133,6 @@ function disposeScope(scope) {
|
|
|
132
133
|
scope.onMount = null;
|
|
133
134
|
scope.onUpdate = null;
|
|
134
135
|
scope.children = null;
|
|
135
|
-
scope.parent = null;
|
|
136
136
|
}
|
|
137
137
|
function onCleanup(fn) {
|
|
138
138
|
const scope = activeScope;
|
|
@@ -149,5 +149,5 @@ function onCleanup(fn) {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
export { __async, __objRest, createScope, disposeScope, getActiveScope, onCleanup, runWithScope, setActiveScope };
|
|
152
|
-
//# sourceMappingURL=chunk-
|
|
153
|
-
//# sourceMappingURL=chunk-
|
|
152
|
+
//# sourceMappingURL=chunk-PYFF2HI3.dev.js.map
|
|
153
|
+
//# sourceMappingURL=chunk-PYFF2HI3.dev.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/scope.ts"],"names":[],"mappings":"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","file":"chunk-PYFF2HI3.dev.js","sourcesContent":["import { error } from '@estjs/shared';\nimport { type EffectScope, effectScope, setCurrentScope } from '@estjs/signals';\nimport type { InjectionKey } from './provide';\n\n/**\n * Scope represents an execution context in the component tree.\n * It manages provides, cleanup functions, and lifecycle hooks.\n */\nexport interface Scope {\n /** Unique identifier for debugging */\n readonly id: number;\n\n /** Reactive effect scope tied to this template scope */\n readonly effectScope: EffectScope;\n\n /** Parent scope in the hierarchy */\n parent: Scope | null;\n\n /** Child scopes (lazy initialized) */\n children: Set<Scope> | null;\n\n /** Provided values (lazy initialized) */\n provides: Map<InjectionKey<unknown> | string | number | symbol, unknown> | null;\n\n /** Cleanup functions (lazy initialized) */\n cleanup: Array<() => void> | null;\n\n /** Mount lifecycle hooks (lazy initialized) */\n onMount: Array<() => void | Promise<void>> | null;\n\n /** Update lifecycle hooks (lazy initialized) */\n onUpdate: Array<() => void | Promise<void>> | null;\n\n /** Destroy lifecycle hooks (lazy initialized) */\n onDestroy: Array<() => void | Promise<void>> | null;\n\n /** Whether the scope has been mounted */\n isMounted: boolean;\n\n /** Whether the scope has been destroyed */\n isDestroyed: boolean;\n}\n\n/** Currently active scope */\nlet activeScope: Scope | null = null;\n\n/** Scope ID counter for unique identification */\nlet scopeId = 0;\n\n/**\n * Get the currently active scope.\n *\n * @returns The active scope or null if none is active.\n */\nexport function getActiveScope(): Scope | null {\n return activeScope;\n}\n\n/**\n * Set the active scope (internal use).\n *\n * @param scope - The scope to set as active.\n * @returns {void}\n */\nexport function setActiveScope(scope: Scope | null): void {\n activeScope = scope;\n setCurrentScope(scope?.effectScope);\n}\n\n/**\n * Create a new scope with optional parent.\n * If no parent is provided, uses the current active scope as parent.\n *\n * @param parent - Optional parent scope (defaults to active scope).\n * @returns A new scope instance.\n */\nexport function createScope(parent: Scope | null = activeScope): Scope {\n const reactiveScope = parent ? parent.effectScope.run(() => effectScope())! : effectScope(true);\n const scope: Scope = {\n id: ++scopeId,\n effectScope: reactiveScope,\n parent,\n children: null, // Lazy initialized\n provides: null, // Lazy initialized\n cleanup: null, // Lazy initialized\n onMount: null, // Lazy initialized\n onUpdate: null, // Lazy initialized\n onDestroy: null, // Lazy initialized\n isMounted: false,\n isDestroyed: false,\n };\n\n // Establish parent-child relationship\n if (parent) {\n if (!parent.children) {\n parent.children = new Set();\n }\n parent.children.add(scope);\n }\n\n return scope;\n}\n\n/**\n * Run a function within a scope, ensuring proper cleanup.\n * The previous active scope is restored even if the function throws.\n *\n * @param scope - The scope to run within.\n * @param fn - The function to execute.\n * @returns The return value of the function.\n */\nexport function runWithScope<T>(scope: Scope, fn: () => T): T {\n const prevScope = activeScope;\n setActiveScope(scope);\n try {\n return scope.effectScope.run(fn) as T;\n } finally {\n setActiveScope(prevScope);\n }\n}\n\n/**\n * Dispose a scope and all its children.\n * Children are disposed first (depth-first), then the scope itself.\n *\n * @param scope - The scope to dispose.\n * @returns {void}\n */\nexport function disposeScope(scope: Scope): void {\n // Idempotent: already destroyed\n if (!scope || scope.isDestroyed) {\n return;\n }\n\n // Mark destroyed immediately to block re-entrant disposeScope calls\n // (e.g. an onDestroy hook that accidentally disposes the same scope again).\n scope.isDestroyed = true;\n\n // Detach from parent BEFORE running destroy hooks so the scope hierarchy\n // is consistent if a destroy hook walks the scope tree or disposes the parent.\n if (scope.parent?.children) {\n scope.parent.children.delete(scope);\n }\n // Break parent reference early to prevent any hook from accidentally\n // re-traversing up to an already-disposing ancestor.\n scope.parent = null;\n\n // Dispose children first (depth-first). Null each child's parent before\n // recursing so the child's own detach step is a no-op — otherwise it would\n // delete itself from this Set while we're iterating it.\n if (scope.children && scope.children.size > 0) {\n for (const child of scope.children) {\n if (child) {\n child.parent = null;\n disposeScope(child);\n }\n }\n scope.children.clear();\n }\n\n // Execute destroy hooks with this scope active so inject/provide work in callbacks.\n const prevScope = activeScope;\n setActiveScope(scope);\n if (scope.onDestroy) {\n for (let i = 0; i < scope.onDestroy.length; i++) {\n try {\n scope.onDestroy[i]();\n } catch (error_) {\n if (__DEV__) error(`Scope(${scope.id}): Error in destroy hook:`, error_);\n }\n }\n scope.onDestroy = null;\n }\n if (scope.cleanup) {\n for (let i = 0; i < scope.cleanup.length; i++) {\n try {\n scope.cleanup[i]();\n } catch (error_) {\n if (__DEV__) error(`Scope(${scope.id}): Error in cleanup:`, error_);\n }\n }\n scope.cleanup = null;\n }\n setActiveScope(prevScope);\n\n scope.effectScope.stop();\n\n // Clear all internal collections to prevent memory leaks\n if (scope.provides) {\n scope.provides.clear();\n scope.provides = null;\n }\n scope.onMount = null;\n scope.onUpdate = null;\n scope.children = null;\n}\n\n/**\n * Register a cleanup function in the current scope.\n * The function will be called when the scope is disposed.\n *\n * @param fn - The cleanup function.\n */\nexport function onCleanup(fn: () => void): void {\n const scope = activeScope;\n\n if (!scope) {\n if (__DEV__) {\n error('onCleanup() must be called within a scope');\n }\n return;\n }\n\n // Lazy initialize cleanup array\n if (!scope.cleanup) {\n scope.cleanup = [];\n }\n\n scope.cleanup.push(fn);\n}\n"]}
|
package/dist/internal.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';require('@estjs/shared');var signals=require('@estjs/signals');var l=null,f=0;function S(){return l}function t(e){l=e,signals.setCurrentScope(e==null?void 0:e.effectScope);}function a(e=l){let n=e?e.effectScope.run(()=>signals.effectScope()):signals.effectScope(true),o={id:++f,effectScope:n,parent:e,children:null,provides:null,cleanup:null,onMount:null,onUpdate:null,onDestroy:null,isMounted:false,isDestroyed:false};return e&&(e.children||(e.children=new Set),e.children.add(o)),o}function y(e,n){let o=l;t(e);try{return e.effectScope.run(n)}finally{t(o);}}function c(e){var o;if(!e||e.isDestroyed)return;if(e.isDestroyed=true,e.children&&e.children.size>0){for(let r of e.children)r&&(r.parent=null,c(r));e.children.clear();}let n=l;if(t(e),e.onDestroy){for(let r=0;r<e.onDestroy.length;r++)try{e.onDestroy[r]();}catch(u){}e.onDestroy=null;}if(e.cleanup){for(let r=0;r<e.cleanup.length;r++)try{e.cleanup[r]();}catch(u){}e.cleanup=null;}t(n),e.effectScope.stop(),
|
|
1
|
+
'use strict';require('@estjs/shared');var signals=require('@estjs/signals');var l=null,f=0;function S(){return l}function t(e){l=e,signals.setCurrentScope(e==null?void 0:e.effectScope);}function a(e=l){let n=e?e.effectScope.run(()=>signals.effectScope()):signals.effectScope(true),o={id:++f,effectScope:n,parent:e,children:null,provides:null,cleanup:null,onMount:null,onUpdate:null,onDestroy:null,isMounted:false,isDestroyed:false};return e&&(e.children||(e.children=new Set),e.children.add(o)),o}function y(e,n){let o=l;t(e);try{return e.effectScope.run(n)}finally{t(o);}}function c(e){var o;if(!e||e.isDestroyed)return;if(e.isDestroyed=true,(o=e.parent)!=null&&o.children&&e.parent.children.delete(e),e.parent=null,e.children&&e.children.size>0){for(let r of e.children)r&&(r.parent=null,c(r));e.children.clear();}let n=l;if(t(e),e.onDestroy){for(let r=0;r<e.onDestroy.length;r++)try{e.onDestroy[r]();}catch(u){}e.onDestroy=null;}if(e.cleanup){for(let r=0;r<e.cleanup.length;r++)try{e.cleanup[r]();}catch(u){}e.cleanup=null;}t(n),e.effectScope.stop(),e.provides&&(e.provides.clear(),e.provides=null),e.onMount=null,e.onUpdate=null,e.children=null;}exports.createScope=a;exports.disposeScope=c;exports.getActiveScope=S;exports.runWithScope=y;exports.setActiveScope=t;
|
package/dist/internal.dev.cjs
CHANGED
|
@@ -57,6 +57,10 @@ function disposeScope(scope) {
|
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
59
|
scope.isDestroyed = true;
|
|
60
|
+
if ((_a = scope.parent) == null ? void 0 : _a.children) {
|
|
61
|
+
scope.parent.children.delete(scope);
|
|
62
|
+
}
|
|
63
|
+
scope.parent = null;
|
|
60
64
|
if (scope.children && scope.children.size > 0) {
|
|
61
65
|
for (const child of scope.children) {
|
|
62
66
|
if (child) {
|
|
@@ -90,9 +94,6 @@ function disposeScope(scope) {
|
|
|
90
94
|
}
|
|
91
95
|
setActiveScope(prevScope);
|
|
92
96
|
scope.effectScope.stop();
|
|
93
|
-
if ((_a = scope.parent) == null ? void 0 : _a.children) {
|
|
94
|
-
scope.parent.children.delete(scope);
|
|
95
|
-
}
|
|
96
97
|
if (scope.provides) {
|
|
97
98
|
scope.provides.clear();
|
|
98
99
|
scope.provides = null;
|
|
@@ -100,7 +101,6 @@ function disposeScope(scope) {
|
|
|
100
101
|
scope.onMount = null;
|
|
101
102
|
scope.onUpdate = null;
|
|
102
103
|
scope.children = null;
|
|
103
|
-
scope.parent = null;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
exports.createScope = createScope;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scope.ts"],"names":["setCurrentScope","effectScope","error"],"mappings":"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
|
|
1
|
+
{"version":3,"sources":["../src/scope.ts"],"names":["setCurrentScope","effectScope","error"],"mappings":"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","file":"internal.dev.cjs","sourcesContent":["import { error } from '@estjs/shared';\nimport { type EffectScope, effectScope, setCurrentScope } from '@estjs/signals';\nimport type { InjectionKey } from './provide';\n\n/**\n * Scope represents an execution context in the component tree.\n * It manages provides, cleanup functions, and lifecycle hooks.\n */\nexport interface Scope {\n /** Unique identifier for debugging */\n readonly id: number;\n\n /** Reactive effect scope tied to this template scope */\n readonly effectScope: EffectScope;\n\n /** Parent scope in the hierarchy */\n parent: Scope | null;\n\n /** Child scopes (lazy initialized) */\n children: Set<Scope> | null;\n\n /** Provided values (lazy initialized) */\n provides: Map<InjectionKey<unknown> | string | number | symbol, unknown> | null;\n\n /** Cleanup functions (lazy initialized) */\n cleanup: Array<() => void> | null;\n\n /** Mount lifecycle hooks (lazy initialized) */\n onMount: Array<() => void | Promise<void>> | null;\n\n /** Update lifecycle hooks (lazy initialized) */\n onUpdate: Array<() => void | Promise<void>> | null;\n\n /** Destroy lifecycle hooks (lazy initialized) */\n onDestroy: Array<() => void | Promise<void>> | null;\n\n /** Whether the scope has been mounted */\n isMounted: boolean;\n\n /** Whether the scope has been destroyed */\n isDestroyed: boolean;\n}\n\n/** Currently active scope */\nlet activeScope: Scope | null = null;\n\n/** Scope ID counter for unique identification */\nlet scopeId = 0;\n\n/**\n * Get the currently active scope.\n *\n * @returns The active scope or null if none is active.\n */\nexport function getActiveScope(): Scope | null {\n return activeScope;\n}\n\n/**\n * Set the active scope (internal use).\n *\n * @param scope - The scope to set as active.\n * @returns {void}\n */\nexport function setActiveScope(scope: Scope | null): void {\n activeScope = scope;\n setCurrentScope(scope?.effectScope);\n}\n\n/**\n * Create a new scope with optional parent.\n * If no parent is provided, uses the current active scope as parent.\n *\n * @param parent - Optional parent scope (defaults to active scope).\n * @returns A new scope instance.\n */\nexport function createScope(parent: Scope | null = activeScope): Scope {\n const reactiveScope = parent ? parent.effectScope.run(() => effectScope())! : effectScope(true);\n const scope: Scope = {\n id: ++scopeId,\n effectScope: reactiveScope,\n parent,\n children: null, // Lazy initialized\n provides: null, // Lazy initialized\n cleanup: null, // Lazy initialized\n onMount: null, // Lazy initialized\n onUpdate: null, // Lazy initialized\n onDestroy: null, // Lazy initialized\n isMounted: false,\n isDestroyed: false,\n };\n\n // Establish parent-child relationship\n if (parent) {\n if (!parent.children) {\n parent.children = new Set();\n }\n parent.children.add(scope);\n }\n\n return scope;\n}\n\n/**\n * Run a function within a scope, ensuring proper cleanup.\n * The previous active scope is restored even if the function throws.\n *\n * @param scope - The scope to run within.\n * @param fn - The function to execute.\n * @returns The return value of the function.\n */\nexport function runWithScope<T>(scope: Scope, fn: () => T): T {\n const prevScope = activeScope;\n setActiveScope(scope);\n try {\n return scope.effectScope.run(fn) as T;\n } finally {\n setActiveScope(prevScope);\n }\n}\n\n/**\n * Dispose a scope and all its children.\n * Children are disposed first (depth-first), then the scope itself.\n *\n * @param scope - The scope to dispose.\n * @returns {void}\n */\nexport function disposeScope(scope: Scope): void {\n // Idempotent: already destroyed\n if (!scope || scope.isDestroyed) {\n return;\n }\n\n // Mark destroyed immediately to block re-entrant disposeScope calls\n // (e.g. an onDestroy hook that accidentally disposes the same scope again).\n scope.isDestroyed = true;\n\n // Detach from parent BEFORE running destroy hooks so the scope hierarchy\n // is consistent if a destroy hook walks the scope tree or disposes the parent.\n if (scope.parent?.children) {\n scope.parent.children.delete(scope);\n }\n // Break parent reference early to prevent any hook from accidentally\n // re-traversing up to an already-disposing ancestor.\n scope.parent = null;\n\n // Dispose children first (depth-first). Null each child's parent before\n // recursing so the child's own detach step is a no-op — otherwise it would\n // delete itself from this Set while we're iterating it.\n if (scope.children && scope.children.size > 0) {\n for (const child of scope.children) {\n if (child) {\n child.parent = null;\n disposeScope(child);\n }\n }\n scope.children.clear();\n }\n\n // Execute destroy hooks with this scope active so inject/provide work in callbacks.\n const prevScope = activeScope;\n setActiveScope(scope);\n if (scope.onDestroy) {\n for (let i = 0; i < scope.onDestroy.length; i++) {\n try {\n scope.onDestroy[i]();\n } catch (error_) {\n if (__DEV__) error(`Scope(${scope.id}): Error in destroy hook:`, error_);\n }\n }\n scope.onDestroy = null;\n }\n if (scope.cleanup) {\n for (let i = 0; i < scope.cleanup.length; i++) {\n try {\n scope.cleanup[i]();\n } catch (error_) {\n if (__DEV__) error(`Scope(${scope.id}): Error in cleanup:`, error_);\n }\n }\n scope.cleanup = null;\n }\n setActiveScope(prevScope);\n\n scope.effectScope.stop();\n\n // Clear all internal collections to prevent memory leaks\n if (scope.provides) {\n scope.provides.clear();\n scope.provides = null;\n }\n scope.onMount = null;\n scope.onUpdate = null;\n scope.children = null;\n}\n\n/**\n * Register a cleanup function in the current scope.\n * The function will be called when the scope is disposed.\n *\n * @param fn - The cleanup function.\n */\nexport function onCleanup(fn: () => void): void {\n const scope = activeScope;\n\n if (!scope) {\n if (__DEV__) {\n error('onCleanup() must be called within a scope');\n }\n return;\n }\n\n // Lazy initialize cleanup array\n if (!scope.cleanup) {\n scope.cleanup = [];\n }\n\n scope.cleanup.push(fn);\n}\n"]}
|
package/dist/internal.dev.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { createScope, disposeScope, getActiveScope, runWithScope, setActiveScope } from './chunk-
|
|
1
|
+
export { createScope, disposeScope, getActiveScope, runWithScope, setActiveScope } from './chunk-PYFF2HI3.dev.js';
|
|
2
2
|
//# sourceMappingURL=internal.dev.js.map
|
|
3
3
|
//# sourceMappingURL=internal.dev.js.map
|
package/dist/internal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{e as createScope,g as disposeScope,c as getActiveScope,f as runWithScope,d as setActiveScope}from'./chunk-
|
|
1
|
+
export{e as createScope,g as disposeScope,c as getActiveScope,f as runWithScope,d as setActiveScope}from'./chunk-CBFQJ3PB.js';
|
package/dist/template.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var shared=require('@estjs/shared'),signals=require('@estjs/signals');var un=Object.getOwnPropertySymbols;var Zn=Object.prototype.hasOwnProperty,et=Object.prototype.propertyIsEnumerable;var fn=(e,n)=>{var t={};for(var o in e)Zn.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(e!=null&&un)for(var o of un(e))n.indexOf(o)<0&&et.call(e,o)&&(t[o]=e[o]);return t};var He=(e,n,t)=>new Promise((o,r)=>{var s=c=>{try{l(t.next(c));}catch(d){r(d);}},i=c=>{try{l(t.throw(c));}catch(d){r(d);}},l=c=>c.done?o(c.value):Promise.resolve(c.value).then(s,i);l((t=t.apply(e,n)).next());});var dn="ref",mn="key",pn="http://www.w3.org/2000/svg",Ve="http://www.w3.org/2000/xlink",je="http://www.w3.org/2000/xmlns/";var $e=Symbol(""),fe=Symbol(""),Ke=Symbol(""),yn=Symbol(""),Be=Symbol(""),Ue=Symbol("");var Q=null,tt=0;function M(){return Q}function Ee(e){Q=e,signals.setCurrentScope(e==null?void 0:e.effectScope);}function z(e=Q){let n=e?e.effectScope.run(()=>signals.effectScope()):signals.effectScope(true),t={id:++tt,effectScope:n,parent:e,children:null,provides:null,cleanup:null,onMount:null,onUpdate:null,onDestroy:null,isMounted:false,isDestroyed:false};return e&&(e.children||(e.children=new Set),e.children.add(t)),t}function $(e,n){let t=Q;Ee(e);try{return e.effectScope.run(n)}finally{Ee(t);}}function H(e){var t;if(!e||e.isDestroyed)return;if(e.isDestroyed=true,e.children&&e.children.size>0){for(let o of e.children)o&&(o.parent=null,H(o));e.children.clear();}let n=Q;if(Ee(e),e.onDestroy){for(let o=0;o<e.onDestroy.length;o++)try{e.onDestroy[o]();}catch(r){}e.onDestroy=null;}if(e.cleanup){for(let o=0;o<e.cleanup.length;o++)try{e.cleanup[o]();}catch(r){}e.cleanup=null;}Ee(n),e.effectScope.stop(),(t=e.parent)!=null&&t.children&&e.parent.children.delete(e),e.provides&&(e.provides.clear(),e.provides=null),e.onMount=null,e.onUpdate=null,e.children=null,e.parent=null;}function K(e){let n=Q;n&&(n.cleanup||(n.cleanup=[]),n.cleanup.push(e));}function Z(e,n,t,o){if(n===mn){o==null?e.removeAttribute(n):e.setAttribute(n,String(o));return}if(n===shared.SPREAD_NAME){let y=shared.isObject(t)?t:null,v=shared.isObject(o)?o:null;if(y)for(let E in y)E!==shared.SPREAD_NAME&&(!v||!(E in v))&&Z(e,E,y[E],null);if(v)for(let E in v)E!==shared.SPREAD_NAME&&Z(e,E,y==null?void 0:y[E],v[E]);return}let r=(e==null?void 0:e.namespaceURI)===pn,s=r&&shared.startsWith(n,"xlink:"),i=r&&shared.startsWith(n,"xmlns:"),l=shared.isSpecialBooleanAttr(n)||shared.isBooleanAttr(n);if(t===o||n.length>2&&n.charCodeAt(0)===111&&n.charCodeAt(1)===110)return;let c=n.toLowerCase();if(c==="innerhtml"||c==="srcdoc")return;if(o==null){if(s)e.removeAttributeNS(Ve,n.slice(6));else if(i){let y=n.slice(6);e.removeAttributeNS(je,y);}else e.removeAttribute(n);return}if(l){shared.includeBooleanAttr(o)?e.setAttribute(n,""):e.removeAttribute(n);return}let d=shared.isSymbol(o)?String(o):o;if((c==="href"||c==="src"||c==="xlink:href"||c==="action"||c==="formaction"||c==="poster")&&shared.isString(d)){let y=d.trim().toLowerCase();if(shared.startsWith(y,"javascript:")||shared.startsWith(y,"data:"))return}if(s){e.setAttributeNS(Ve,n,String(d));return}if(i){e.setAttributeNS(je,n,String(d));return}if(r)e.setAttribute(n,String(d));else if(n in e)try{e[n]=d;}catch(y){e.setAttribute(n,String(d));}else e.setAttribute(n,String(d));}function Se(e,n,t,o=false){if(n===t)return;let r=Ne(t);if(!r){e.removeAttribute("class");return}(shared.isString(n)?n:Ne(n))!==r&&(o?e.setAttribute("class",r):e.className=r);}var Ne=shared.normalizeClassName;var vn=/\s*!important$/,yt=["Webkit","Moz","ms"],Ge={};function be(e,n,t){let o=e.style;if(t&&shared.isString(t)){n!==t&&(o.cssText=t);return}if(!t){n&&e.removeAttribute("style");return}if(n&&!shared.isString(n)){let r=n;for(let s in r)(!t||t[s]==null)&&ne(o,s,"");}else if(n&&shared.isString(n)){let r=/(?:^|;)\s*([a-z][a-z\d-]*)\s*:/gi,s;for(;(s=r.exec(n))!==null;){let i=s[1].trim();i&&t&&shared.isObject(t)&&t[i]==null&&ne(o,i,"");}}if(t&&!shared.isString(t)){let r=t;for(let s in r){let i=r[s];(!n||shared.isString(n)||n[s]!==i)&&i!=null&&ne(o,s,i);}}}function ne(e,n,t){if(shared.isArray(t)){for(let s of t)ne(e,n,s);return}(t==null||t==="")&&(t="");let o=shared.isString(t)&&vn.test(t)?"important":"";if(o&&(t=t.replace(vn,"")),shared.startsWith(n,"--")){o?e.setProperty(n,t,o):e.setProperty(n,t);return}let r=gt(e,n);o?e.setProperty(ht(r),t,o):e[r]=t;}function ht(e){let n=shared.kebabCase(e);return shared.startsWith(e,"Webkit")||shared.startsWith(e,"Moz")||shared.startsWith(e,"ms")?`-${n}`:n}function gt(e,n){let t=Ge[n];if(t)return t;let o=shared.camelCase(n);if(o!=="filter"&&o in e)return Ge[n]=o;o=shared.capitalize(o);for(let r of yt){let s=r+o;if(s in e)return Ge[n]=s}return n}var ze=0;function En(){return String(ze++)}function Nt(){ze=0;}var W=false;function oe(){return W}var te=new Map;function St(e){let n=e.querySelectorAll("[data-hk]");for(let t of n){let o=t.dataset.hk;o!=null&&!te.has(o)&&te.set(o,t);}}var _e=[],de=new Map;function Tt(){if(typeof document=="undefined")return;let e=document.createNodeIterator(document.body,NodeFilter.SHOW_COMMENT),n;for(;n=e.nextNode();){let t=n.data;if(t==="teleport-anchor")_e.push(n);else if(t==="teleport-start"){let o=n.parentElement;if(!o)continue;let r=de.get(o);r||(r=[],de.set(o,r)),r.push(n);}}}function We(){var e;return (e=_e.shift())!=null?e:null}function qe(e){let n=de.get(e),t=n==null?void 0:n.shift();if(!t)return null;let o=[],r=t.nextSibling;for(;r;){if(r.nodeType===Node.COMMENT_NODE&&r.data==="teleport-end")return {start:t,end:r,nodes:o};o.push(r),r=r.nextSibling;}return null}function Xe(e){W=true,ze=0,te.clear(),_e.length=0,de.clear(),St(e),Tt();}function Ye(){W=false,te.clear(),_e.length=0,de.clear();}function Cn(e,n,t){var s,i;if(!W||t&&t.parentNode!==e)return null;if(n.length===0)return [];let o=new Array(n.length),r=t?t.previousSibling:e.lastChild;for(let l=n.length-1;l>=0;l--){if(!r)return null;let c=n[l],d=c.nodeType;if(d===Node.TEXT_NODE){let f=(s=c.textContent)!=null?s:"";if(!f||r.nodeType!==Node.TEXT_NODE)return null;let y=(i=r.textContent)!=null?i:"";if(y===f){o[l]=r,r=r.previousSibling;continue}if(!y.endsWith(f))return null;let v=y.slice(0,y.length-f.length);if(!v)return null;let E=document.createTextNode(v);e.insertBefore(E,r),r.textContent=f,o[l]=r,r=E;continue}if(r.nodeType!==d)return null;if(d===Node.ELEMENT_NODE){if(r.tagName!==c.tagName)return null}else if(d===Node.COMMENT_NODE&&r.data!==c.data)return null;o[l]=r,r=r.previousSibling;}return o}function Nn(e){var t,o,r;return (r=(o=e.dataset.hk)!=null?o:(t=e.closest("[data-hk]"))==null?void 0:t.dataset.hk)!=null?r:null}function bt(e,n){if(!W||!e||n<0)return null;let t=e instanceof Element?Nn(e):null,o=t?`${t}-${n}`:String(n),r=e.firstChild;for(;r;){if(r.nodeType===Node.COMMENT_NODE&&r.data===o)return r;r=r.nextSibling;}return null}function wt(e,n){if(!W||!(e instanceof Element)||n<0)return null;let t=Nn(e),o=t?`${t}-${n}`:String(n),r=e.firstChild;for(;r;){if(r instanceof Element&&r.getAttribute(shared.HYDRATION_ANCHOR_ATTR)===o)return r;r=r.nextSibling;}return null}function _t(e){if(!shared.isBrowser())return ()=>{throw new Error("[essor] getRenderedElement called in non-browser environment")};let n=null;return ()=>{if(!W)return n||(n=we(e)),n();let t=En(),o=te.get(t);return o?(te.delete(t),o):(shared.warn(`[essor] hydration mismatch: no SSR element for key "${t}"`),n||(n=we(e)),n())}}function At(e,n,t,o){W||Se(e,n,t,o);}function xt(e,n,t,o){W||Z(e,n,t,o);}function kt(e,n,t){W||be(e,n,t);}function Je(e,n){return n&&n.parentNode===e?n:null}function Sn(e,n,t,o){let r=Je(e,o),s=n.length,i=t.length;if(s===0&&i===0)return t;if(s===0){for(let f=0;f<i;f++)B(e,t[f],r);return t}if(i===0){for(let f=0;f<s;f++)X(n[f]);return []}let l=0,c=s-1,d=i-1;for(;l<=c&&l<=d&&n[l]===t[l];)l++;for(;c>=l&&d>=l&&n[c]===t[d];)c--,d--;if(l>c){if(l<=d){let f=d+1,y=Je(e,f<i?t[f]:r);for(let v=l;v<=d;v++)B(e,t[v],y);}}else if(l>d)for(let f=l;f<=c;f++)X(n[f]);else Pt(e,n,t,l,c,d,r);return t}function Pt(e,n,t,o,r,s,i){let l=s-o+1,c=l<=4?C=>{for(let N=o;N<=s;N++)if(t[N]===C)return N}:(()=>{let C=new Map;for(let N=o;N<=s;N++)C.set(t[N],N);return N=>C.get(N)})(),d=new Int32Array(l),f=0,y=false,v=0;for(let C=o;C<=r;C++){let N=n[C];if(f>=l){X(N);continue}let p=c(N);p===void 0?X(N):(d[p-o]=C+1,p>=v?v=p:y=true,f++);}let E=y?Qe(d):[],_=E.length-1;for(let C=l-1;C>=0;C--){let N=o+C,p=t[N],S=Je(e,N+1<t.length?t[N+1]:i);d[C]===0?B(e,p,S):y&&(_<0||C!==E[_]?B(e,p,S):_--);}}function Qe(e){let n=new Int32Array(e.length),t=[0],o=e.length,r,s,i,l,c;for(r=0;r<o;r++){let d=e[r];if(d!==0){if(s=t[t.length-1],e[s]<d){n[r]=s,t.push(r);continue}for(i=0,l=t.length-1;i<l;)c=i+l>>1,e[t[c]]<d?i=c+1:l=c;d<e[t[i]]&&(i>0&&(n[r]=t[i-1]),t[i]=r);}}for(i=t.length,l=t[i-1];i-- >0;)t[i]=l,l=n[l];return t}function X(e){if(e)if(V(e))e.destroy();else {let n=e;n.parentNode&&n.remove();}}function B(e,n,t){if(!e||!n)return;let o=V(t)?t.firstChild:t;if(V(n)){n.mount(e,o);return}o?e.insertBefore(n,o):e.appendChild(n);}function re(e){if(e instanceof Node||V(e))return e;let n=typeof e;return e==null||n==="string"||n==="number"||n==="boolean"||n==="symbol"?document.createTextNode(e===false||e==null?"":String(e)):document.createTextNode(String(e))}function Y(e,n,t){if(!e)return;let o=M(),r=[],s=true,i=c=>{if(c instanceof Node)return [c];if(V(c))return [c];let d=typeof c;return c==null||d==="string"||d==="number"||d==="boolean"?[re(c)]:shared.coerceArray(c).map(f=>shared.isFunction(f)?f():f).flatMap(f=>f).map(re)},l=signals.effect(()=>{let c=()=>{let d=shared.isFunction(n)?n():n,f=i(d);if(s&&oe()&&f.every(y=>y instanceof Node&&y.parentNode===e)){r=f,s=false;return}if(s&&oe()){let y=Cn(e,f,t);if(y){r=y,s=false;return}}r=Sn(e,r,f,t),s=false;};o&&!o.isDestroyed?$(o,c):c();});return K(()=>{l.stop();for(let c of r)X(c);r=[];}),r}function Lt(e){return (e==null?void 0:e.firstChild)||null}function Ft(e,n=1){for(;e&&n>0;)e=e.nextSibling,n--;return e||null}function Mt(e,n){if(!e||n<0)return null;let t=e.firstChild;for(;t&&n>0;)t=t.nextSibling,n--;return t||null}function ie(e,n,t,o){if(!(o!=null&&o.delegate))return e.addEventListener(n,t,o),()=>e.removeEventListener(n,t,o);let r=o.delegate,s=d=>{let f=d.target;(f.matches(r)||f.closest(r))&&t.call(e,d);},c=o,{delegate:i}=c,l=fn(c,["delegate"]);return e.addEventListener(n,s,l),()=>{e.removeEventListener(n,s,l);}}function Ze(e,n,t){let o=e[n];o||(o=[],e[n]=o),o.push(t);}function wn(e,n,t){let o=e.length;if(o===0)return;let r;for(let s=0;s<o;s++)try{let i=e[s]();if(shared.isPromise(i)){let l=i.catch(c=>{});(r||(r=[])).push(l);}}catch(i){}if(r)return Promise.all(r).then(()=>{})}function J(e){let n=M();if(n){if(n.isMounted){try{let t=e();shared.isPromise(t)&&t.catch(o=>{});}catch(t){}return}Ze(n,"onMount",e);}}function It(e){let n=M();n&&Ze(n,"onUpdate",e);}function se(e){let n=M();n&&Ze(n,"onDestroy",e);}function _n(e){if(e.isDestroyed)return;if(!e.onMount||e.onMount.length===0){e.isMounted=true;return}let n=e.onMount,t=$(e,()=>wn(n,e.id));return n.length=0,e.isMounted=true,t}function An(e){if(!(e.isDestroyed||!e.onUpdate||e.onUpdate.length===0))return $(e,()=>wn(e.onUpdate,e.id))}function kn(e,n,t=false){for(let o of Object.getOwnPropertyNames(n))Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o));if(t){let o=Object.getOwnPropertyNames(n);for(let r of Object.getOwnPropertyNames(e))o.includes(r)||delete e[r];}}function Pn(e,n){let t=Object.getOwnPropertyDescriptor(e,n);return t.get?t.get.call(e):t.value}var Rn;Rn="normal";var le=class{constructor(n,t={}){this.component=n;this.props=t;this[Rn]=true;this.scope=null;this.state=0;this.beforeNode=void 0;this.renderedNodes=[];this.firstChild=void 0;this.parentNode=void 0;this.rootEventCleanups=[];this.parentScope=M();let o={};kn(o,t),this.reactiveProps=signals.shallowReactive(o);}mount(n,t){var s;if(this.parentNode=n,this.beforeNode=t,this.state=1,this.renderedNodes.length>0){for(let i of this.renderedNodes)B(n,i,t);return this.state=2,this.renderedNodes}let o=z((s=this.parentScope)!=null?s:M());this.scope=o;let r=$(o,()=>{var l;let i=this.component(this.reactiveProps);return shared.isFunction(i)&&(i=i(this.reactiveProps)),(signals.isSignal(i)||signals.isComputed(i))&&(i=i.value),(l=Y(n,i,t))!=null?l:[]});return this.renderedNodes=r,this.firstChild=r[0],this.syncSpecialProps(this.props),this.state=2,_n(o),this.renderedNodes}update(n){this.props=n;let t=this.scope;!t||t.isDestroyed||(kn(this.reactiveProps,n!=null?n:{},true),this.syncSpecialProps(n),An(t));}forceUpdate(){if(!this.parentNode)return;let n=this.parentNode,t=this.beforeNode;this.destroy(),this.mount(n,t);}destroy(){let n=this.scope;if(!(!n||n.isDestroyed)){this.scope=null,this.releaseSpecialProps(),H(n);for(let t of this.renderedNodes)X(t);this.renderedNodes=[],this.firstChild=void 0,this.parentNode=void 0;for(let t of Object.getOwnPropertyNames(this.reactiveProps))delete this.reactiveProps[t];}}syncSpecialProps(n){if(!n)return;let t=this.firstChild;if(!(!t||!(t instanceof Element))){this.releaseSpecialProps();for(let o of Object.getOwnPropertyNames(n)){if(o===dn){let r=Pn(n,o);this.rootRefCleanup=this.bindRootRef(r,t);continue}if(shared.isOn(o)){let r=Pn(n,o);if(!shared.isFunction(r))continue;let s=o.slice(2).toLowerCase(),i=t,l=`_$${s}`,c=i[l];if(shared.isFunction(c)){i[l]=r,this.rootEventCleanups.push(()=>{i[l]===r&&(i[l]=c);});continue}let d=r,f=y=>{i.disabled||d.call(i,y);};this.rootEventCleanups.push(ie(i,s,f));}}}}releaseSpecialProps(){for(let n of this.rootEventCleanups)n();this.rootEventCleanups.length=0,this.rootRefCleanup&&(this.rootRefCleanup(),this.rootRefCleanup=void 0);}bindRootRef(n,t){if(shared.isFunction(n))return n(t),()=>n(null);if(signals.isSignal(n)){let o=n,r=o.value;return o.value=t,()=>{o.value===t&&(o.value=r);}}}};function V(e){return !!e&&!!e.normal}function xe(e,n){return V(e)?e:new le(e,n)}function we(e){let n,t=()=>{let o=document.createElement("template");o.innerHTML=e;let r=o.content.firstChild;if(!r)throw new Error("Invalid template: empty content");return r};return ()=>(n||(n=t())).cloneNode(true)}function jt(e,n){let t=shared.isString(n)?document.querySelector(n):n;if(!t)return;t.innerHTML&&(t.innerHTML="");let r=z(),s;try{$(r,()=>{let i=xe(e);V(i)&&(s=i,B(t,i));});}catch(i){throw H(r),i}return {root:s,unmount:()=>{H(r),s==null||s.destroy();}}}function $t(e,n){let t=shared.isString(n)?document.querySelector(n):n;if(!t)return;Xe(t);let o=z(),r;try{$(o,()=>{let s=xe(e);V(s)&&(r=s,Y(t,s));});}catch(s){throw H(o),s}finally{Ye();}return {root:r,unmount:()=>{H(o),r==null||r.destroy();}}}function en(e,n){let t=M();t&&(t.provides||(t.provides=new Map),t.provides.set(e,n));}function me(e,n){let t=M();if(!t)return n;let o=t;for(;o;){if(o.provides&&o.provides.has(e))return o.provides.get(e);o=o.parent;}return n}function nn(e,n){Object.defineProperty(e,"target",{configurable:true,value:n});}function Fn(e){let n=e.target,t=e.type,o=e.target,r=e.currentTarget,s=()=>{let l=n[`_$${t}`];if(l&&shared.isFunction(l)&&!n.disabled){let c=n[`${t}Data`];if(c?l.call(n,c,e):l.call(n,e),e.cancelBubble)return false}return n.host&&!shared.isString(n.host)&&!n.host._$host&&shared.isFunction(n.contains)&&n.contains(e.target)&&nn(e,n.host),true},i=()=>{for(;s()&&(n=n._$host||n.parentNode||n.host););};if(Object.defineProperty(e,"currentTarget",{configurable:true,get(){return n||document}}),e.composedPath){let l=e.composedPath();nn(e,l[0]);for(let c=0;c<l.length-2&&(n=l[c],!!s());c++){if(n._$host){n=n._$host,i();break}if(n.parentNode===r)break}}else i();nn(e,o);}var ke=Symbol("_$EVENTS");function Bt(e,n=globalThis.document){let t=n,o=t[ke]||(t[ke]=new Set);for(let r of e)o.has(r)||(o.add(r),n.addEventListener(r,Fn));}function Ut(e=globalThis.document){let n=e,t=n[ke];if(t){for(let o of t.keys())e.removeEventListener(o,Fn);delete n[ke];}}function ae(e,n,t,o){let r=ie(e,n,t,o);M()&&K(r);}var qt=e=>e,Xt=typeof DataTransfer!="undefined"?new DataTransfer().files:[];function On(e,n){let t=e,o=n==null?"":String(n);t.value!==o&&(t.value=o);}var Yt={event:"change",forceChange:true,checkboxArray:true,read:e=>e.checked,write(e,n){let t=e,o=shared.isArray(n)?n.map(String).includes(t.value):!!n;t.checked!==o&&(t.checked=o);}},Jt={event:"change",forceChange:true,read(e){let n=e;return n.checked?n.value:""},write(e,n){let t=e,o=String(n)===t.value;t.checked!==o&&(t.checked=o);}},Qt={event:"change",forceChange:true,read:e=>e.files,write(e,n){if(n==null)try{e.files=Xt;}catch(t){}}},Mn={event:"input",ime:true,read:e=>e.value,write:On},Zt={event:"change",forceChange:true,read(e){let n=e;return n.multiple?Array.from(n.selectedOptions,t=>t.value):n.value},write(e,n){let t=e;if(!t.multiple)return On(e,n);let o=new Set((shared.isArray(n)?n:[]).map(String));for(let r of Array.from(t.options))r.selected=o.has(r.value);}};function In(e){return {event:"input",read:n=>n[e],write(n,t){n[e]=t;}}}function eo(e,n){switch(e.nodeName){case "INPUT":return n==="checked"?e.type==="radio"?Jt:Yt:n==="files"?Qt:n==="value"?Mn:In(n);case "SELECT":return Zt;case "TEXTAREA":return Mn;default:return In(n)}}function no(e,n,t){if(!shared.isString(e))return e;let o=n?e.trim():e;if(t){let r=n?o:o.trim();if(r!==""){let s=Number(r);if(!Number.isNaN(s))return s}}return o}function to(e){let n=e.getRootNode();return (n instanceof Document||n instanceof ShadowRoot)&&n.activeElement===e}function oo(e,n){if(n!=="value"||e.nodeName!=="INPUT")return false;let t=e.type;return t==="number"||t==="range"}function ro(e,n,t,o,r={}){if(!e)return;let{event:s,read:i,write:l,forceChange:c,ime:d,checkboxArray:f}=eo(e,n),y=r.trim===true,v=r.number===true||oo(e,n),E=r.lazy===true,_=(y||v)&&n!=="files",C=shared.isFunction(t)?t:()=>t,N=_?T=>no(T,y,v):qt,p=f?T=>{let R=C();if(!shared.isArray(R))return N(T);let L=e.value,I=R.filter(a=>String(a)!==L);return T&&I.push(L),I}:N,S=false,u=E||c?"change":s,w=()=>{if(S)return;let T=i(e);if(T===void 0)return;let R=p(T);Object.is(C(),R)||o(R);};ae(e,u,w),!E&&_&&u!=="change"&&ae(e,"change",()=>l(e,N(i(e)))),d&&(ae(e,"compositionstart",()=>{S=true;}),ae(e,"compositionend",()=>{S=false,E||w();}));let k=signals.effect(()=>{let T=C();d&&S||d&&!E&&to(e)&&Object.is(N(i(e)),T)||l(e,T);});M()&&K(()=>k.stop());}function Hn(e){let n=e;return Array.isArray(n)&&n.length===1&&(n=n[0]),typeof n=="function"?n():n}function Vn(e){let n=Object.getOwnPropertyDescriptor(e,"children");return n!=null&&n.get?()=>Hn(n.get.call(e)):()=>Hn(e.children)}function io(e,n){let t=new Set(n);return new Proxy(e,{get(o,r){if(!t.has(r))return Reflect.get(o,r)},ownKeys(o){return Reflect.ownKeys(o).filter(r=>!t.has(r))},getOwnPropertyDescriptor(o,r){if(!t.has(r))return Reflect.getOwnPropertyDescriptor(o,r)},has(o,r){return t.has(r)?false:Reflect.has(o,r)}})}function jn(e){var t;if(e&&((t=Object.getOwnPropertyDescriptor(e,"children"))!=null&&t.get||signals.isReactive(e)))return [()=>e.children];let n=e==null?void 0:e.children;return n==null?null:n}jn[$e]=true;function lo(e){return !!e&&!!e[$e]}function Pe(e){let n=shared.isFunction(e.target)?e.target():e.target;return n==null?null:shared.isString(n)?document.querySelector(n):n}function Re(e){return shared.isFunction(e.disabled)?!!e.disabled():!!e.disabled}function Kn(e){if(oe()){let f=uo(e);if(f)return f}let n=document.createComment("portal");n[fe]=true;let{children:t}=e;if(t==null)return n;let o=M(),r=null,s=(f,y)=>{r=z(o),$(r,()=>{Y(f,()=>t,y);});},i=()=>{r&&(H(r),r=null);},l=(f,y)=>{if(i(),f){let v=n.parentNode;if(!v)return;s(v,n);return}y&&s(y);},c=false,d=signals.effect(()=>{let f=Re(e),y=f?null:Pe(e);c&&l(f,y);});return J(()=>{c=!0;let f=Re(e),y=f?null:Pe(e);if(f||y){l(f,y);return}queueMicrotask(()=>{n.parentNode&&l(Re(e),Pe(e));});}),K(()=>{d.stop(),i();}),n}Kn[fe]=true;function uo(e){if(Re(e))return null;let n=We();if(!n)return null;let t=Pe(e);return !t||!qe(t)?null:(n[fe]=true,n)}function fo(e){return !!e&&!!e[fe]}function Le(e){for(;e.firstChild;)e.removeChild(e.firstChild);}function Bn(e){let n=e;for(;shared.isFunction(n);)n=n();return signals.isSignal(n)||signals.isComputed(n)?Bn(n.value):n}var pe=Symbol("SuspenseContext");function Un(e){var _;if(!shared.isBrowser())return (_=e.fallback)!=null?_:"";let n=document.createElement("div");n.style.display="contents";let t=true,o=0,r=false,s=null,i=C=>{let N=Bn(C);if(shared.isArray(N)){let p=[];for(let S of N){let u=i(S);shared.isArray(u)?p.push(...u):p.push(u);}return p}return re(N)},l=C=>{let N=i(C),p=shared.isArray(N)?N:[N];for(let S of p)S!=null&&B(n,S);},c=()=>{Le(n),e.fallback!=null&&l(e.fallback);},d=()=>{r||(r=true,c());},f=()=>{!r||!(s||e.children!=null&&!shared.isPromise(e.children))||(r=false,Le(n),s?y(s):e.children!=null&&!shared.isPromise(e.children)&&y(e.children));},y=C=>{if(r||(Le(n),C==null))return;let N=shared.isArray(C)?C:[C];for(let p of N)p!=null&&l(p);r&&c();},v={register:C=>{o++,d(),C.then(()=>{t&&(o--,o===0&&f());}).catch(N=>{t&&(o--,o===0&&f());});},increment:()=>{o++,d();},decrement:()=>{o=Math.max(0,o-1),o===0&&f();}};en(pe,v);let E=e.children;return shared.isPromise(E)?(E.then(C=>{s=C;}).catch(()=>{}),v.register(E)):E!=null?y(E):d(),se(()=>{t=false,o=0,s=null,Le(n),n.remove();}),n}Un[Ke]=true;function go(e){return !!e&&!!e[Ke]}function vo(e,n){let t=signals.signal(n==null?void 0:n.initialValue),o=signals.signal(true),r=signals.signal(null),s=signals.signal("pending"),i=0,l=null,c=false,d=me(pe,null),f=()=>He(null,null,function*(){let E=++i;o.value=true,s.value="pending",r.value=null,c=false,d&&d.increment();try{let _=e();l=_,_.catch(()=>{});let C=yield _;E===i&&(t.value=C,s.value="ready",o.value=!1);}catch(_){E===i&&(r.value=_ instanceof Error?_:new Error(String(_)),s.value="errored",o.value=false);}finally{d&&d.decrement();}});f();let y=(()=>(!c&&o.value&&l&&d&&(c=true,d.register(l)),t.value));return y.loading=o,y.error=r,y.state=s,[y,{mutate:E=>{t.value=E,s.value="ready",o.value=false,r.value=null;},refetch:()=>He(null,null,function*(){yield f();})}]}function Gn(e){return shared.isFunction(e)?e:e.default}function rn(e,n,t){let o=new le(n,t);return o.mount(e),o}function Co(e,n={}){let{delay:t=200,timeout:o,ssr:r="blocking",onError:s}=n;if(typeof window=="undefined"){if(r==="client-only"){let N=()=>"";return N.__asyncLoader=e,N.__asyncResolved=()=>null,N}let v=null,E=null,_=()=>E||(E=e().then(N=>{v=Gn(N);}).catch(()=>{}),E);_();let C=N=>v?v(N):"";return C.__asyncLoader=_,C.__asyncResolved=()=>v,C}let i=null,l=null,c="pending",d=null;function f(){return d||(d=e().then(v=>{i=Gn(v),c="resolved";}).catch(v=>{l=v instanceof Error?v:new Error(String(v)),c="errored",d=null;}),d)}f();function y(v){var I;if(c==="resolved"&&i){let a=document.createElement("div");a.style.display="contents";let g=rn(a,i,v);return K(()=>g.destroy()),a}if(c==="errored"&&l){let a=document.createElement("div");if(a.style.display="contents",n.error){let g=true,m=null,P=(A,h)=>{g&&(m==null||m.destroy(),m=rn(a,A,h));},b=()=>{d=null,c="pending",l=null,n.loading&&P(n.loading),f().then(()=>{g&&(c==="resolved"&&i?P(i,v):c==="errored"&&l&&n.error&&P(n.error,{error:l,retry:b}));});};P(n.error,{error:l,retry:b}),se(()=>{g=false,m==null||m.destroy(),m=null;});}return a}let E=document.createElement("div");E.style.display="contents";let _=true,C=null,N=null,p=null,S=(a,g)=>{_&&(C==null||C.destroy(),C=rn(E,a,g));},u=a=>()=>{d=null,c="pending",l=null,n.loading&&S(n.loading),f().then(()=>{c==="resolved"&&i?S(i,a):c==="errored"&&l&&n.error&&S(n.error,{error:l,retry:u(a)});});};se(()=>{_=false,C==null||C.destroy(),C=null,N!=null&&clearTimeout(N),p!=null&&clearTimeout(p);});let w=(I=me(pe))!=null?I:null,k=a=>S(a,v),T=a=>{n.error&&S(n.error,{error:a,retry:u(v)});},R=()=>{n.loading&&S(n.loading);},L=f().then(()=>{_&&(c==="resolved"&&i?k(i):c==="errored"&&l&&(T(l),s&&s(l,u(v))),N!=null&&clearTimeout(N),p!=null&&clearTimeout(p));});return w&&w.register(L),t>0?N=setTimeout(()=>{_&&c==="pending"&&R();},t):n.loading&&R(),o!=null&&(p=setTimeout(()=>{if(_&&c==="pending"){let a=new Error(`[defineAsyncComponent] Timeout after ${o}ms`);l=a,c="errored",T(a),s&&s(a,u(v));}},o)),E}return y.__asyncLoader=f,y.__asyncResolved=()=>i,y}function zn(e){let n=document.createDocumentFragment(),t=document.createComment("");n.appendChild(t);let o=[],r=[],s=e.key,i=e.children,l=Array.isArray(i)&&i.length===1&&shared.isFunction(i[0])?i[0]:e.children;if(!shared.isFunction(l))throw new TypeError("<For> requires `children` to be a function (item, index) => Node");let c=()=>{var S,u;let p=e.each;return signals.isSignal(p)?(S=p.value)!=null?S:[]:shared.isFunction(p)?(u=p())!=null?u:[]:p!=null?p:[]},d=(p,S)=>s?s(p,S):p,f=(p,S,u)=>{if(p==null||p===false)return [];if(Array.isArray(p)){let k=[];for(let T of p)k.push(...f(T,S,u));return k}if(V(p))return B(S,p,u!=null?u:void 0),p.renderedNodes;let w=re(p);return B(S,w,u!=null?u:void 0),[w]},y=(p,S)=>{if(!e.fallback)return;r=f(e.fallback(),p,S);},v=()=>{for(let p of r)p.parentNode&&p.parentNode.removeChild(p);r=[];},E=(p,S,u,w,k=d(p,S))=>{let T=M(),R=z(T),L=[];return $(R,()=>{L=f(l(p,S),u,w);}),{key:k,item:p,nodes:L,scope:R}},_=p=>{H(p.scope);for(let S of p.nodes)S.parentNode&&S.parentNode.removeChild(S);},C=signals.effect(()=>{let p=c(),S=t.parentNode;if(!S){if(p.length===0)y(n,t);else {o=new Array(p.length);let u=0;for(let w of p)o[u]=E(w,u,n,t),u++;}return}N(S,p);});function N(p,S){let u=o.length,w=S.length;if(w===0){for(let h=0;h<u;h++)_(o[h]);o=[],e.fallback&&r.length===0&&y(p,t);return}if(u===0||r.length>0){r.length>0&&v(),o=new Array(w);let h=document.createDocumentFragment();for(let x=0;x<w;x++)o[x]=E(S[x],x,h,null);p.insertBefore(h,t);return}let k=new Map;for(let h=0;h<u;h++){let x=o[h],F=k.get(x.key),j=[x,h];F?F.push(j):k.set(x.key,[j]);}let T=new Array(w),R=[],L=null,I=new Int32Array(w),a=false,g=0,m=new Array(w);for(let h=0;h<w;h++)m[h]=d(S[h],h);for(let h=0;h<w;h++){let x=S[h],F=m[h],j=k.get(F);if(j&&j.length>0){let[q,G]=j.shift();Object.is(q.item,x)?(q.item=x,T[h]=q,I[h]=G+1,G<g?a=true:g=G):(L||(L=document.createDocumentFragment()),_(q),T[h]=E(x,h,L,null,F));}else L||(L=document.createDocumentFragment()),T[h]=E(x,h,L,null,F);}for(let h of k.values())for(let[x]of h)R.push(x);for(let h of R)_(h);let P=a?Qe(I):[],b=P.length-1,A=t;for(let h=w-1;h>=0;h--){let F=T[h].nodes;if(!(I[h]===0)&&a&&b>=0&&h===P[b]){b--;for(let G=F.length-1;G>=0;G--)A=F[G];continue}for(let G=F.length-1;G>=0;G--){let Oe=F[G];Oe.nextSibling!==A&&p.insertBefore(Oe,A),A=Oe;}}o=T;}return K(()=>{C.stop();for(let p of o)_(p);o=[],v(),t.parentNode&&t.parentNode.removeChild(t);}),n}zn[yn]=true;function ln(e){var s,i,l,c,d,f,y,v,E,_;let n=(s=e.name)!=null?s:"v",t=(i=e.enterFromClass)!=null?i:`${n}-enter-from`,o=(l=e.enterActiveClass)!=null?l:`${n}-enter-active`,r=(c=e.enterToClass)!=null?c:`${n}-enter-to`;return {enterFrom:t,enterActive:o,enterTo:r,leaveFrom:(d=e.leaveFromClass)!=null?d:`${n}-leave-from`,leaveActive:(f=e.leaveActiveClass)!=null?f:`${n}-leave-active`,leaveTo:(y=e.leaveToClass)!=null?y:`${n}-leave-to`,appearFrom:(v=e.appearFromClass)!=null?v:t,appearActive:(E=e.appearActiveClass)!=null?E:o,appearTo:(_=e.appearToClass)!=null?_:r}}var Wn=e=>e?e.endsWith("ms")?Number(e.slice(0,-2).replace(",",".")):Number(e.slice(0,-1).replace(",","."))*1e3:0;function qn(e,n){let t=e.split(", "),o=n.split(", "),r=0;for(let[s,i]of o.entries()){let l=Wn(i)+Wn(t[s%t.length]||"0s");l>r&&(r=l);}return r}function Yn(e,n){let t=getComputedStyle(e),o=n!=="animation"?qn(t.transitionDelay,t.transitionDuration):0,r=n!=="transition"?qn(t.animationDelay,t.animationDuration):0;return o===0&&r===0?null:o>=r?{event:"transitionend",timeout:o}:{event:"animationend",timeout:r}}function U(e,n){for(let t of n.split(/\s+/))t&&e.classList.add(t);}function O(e,n){for(let t of n.split(/\s+/))t&&e.classList.remove(t);}function he(e){requestAnimationFrame(()=>requestAnimationFrame(e));}function Ie(e){e.offsetHeight;}function ce(e,n,t,o){if(t!=null){setTimeout(o,t);return}let r=Yn(e,n);if(!r){o();return}let s=false,i=()=>{s||(s=true,e.removeEventListener(r.event,l),o());},l=()=>i();e.addEventListener(r.event,l),setTimeout(i,r.timeout+1);}function ue(e,n){return e==null?null:typeof e=="number"?e:e[n]}function Xn(e){if(e==null||e===false)return null;if(Array.isArray(e))return e[0]instanceof Element?e[0]:null;if(e instanceof Element)return e;if(V(e)){let n=e;if(n.scope==null){let o=document.createDocumentFragment();n.mount(o);}let t=n.firstChild;return t instanceof Element?t:null}return null}var Me=Symbol("enter_cb"),ye=Symbol("leave_cb");function Jn(e){let n=document.createComment(""),t=ln(e),o=e.css!==false,r=Vn(e),s="idle",i=null,l=null,c=false,d,f=false,y=false,v=false,E=(u,w)=>{var g;let k=u[ye];k&&k(true),s="entering";let T=w==="appear"?t.appearFrom:t.enterFrom,R=w==="appear"?t.appearActive:t.enterActive,L=w==="appear"?t.appearTo:t.enterTo;(g=e.onBeforeEnter)==null||g.call(e,u),o&&(U(u,T),U(u,R));let I=false,a=m=>{var P,b;I||(I=true,u[Me]=void 0,o&&(O(u,T),O(u,R),O(u,L)),m?(P=e.onEnterCancelled)==null||P.call(e,u):(s="entered",(b=e.onAfterEnter)==null||b.call(e,u)));};u[Me]=a,he(()=>{if(!I)if(o&&(O(u,T),U(u,L)),e.onEnter)e.onEnter(u,()=>a(false));else if(o){let m=ue(e.duration,"enter");ce(u,e.type,m,()=>a(false));}else a(false);});},_=(u,w)=>{var a;let k=u[Me];k&&(k(true),Ie(u)),s="leaving",(a=e.onBeforeLeave)==null||a.call(e,u),o&&(U(u,t.leaveFrom),U(u,t.leaveActive));let T=false,R=g=>{var m,P;T||(T=true,u[ye]=void 0,o&&(O(u,t.leaveFrom),O(u,t.leaveActive),O(u,t.leaveTo)),g?(m=e.onLeaveCancelled)==null||m.call(e,u):(s="idle",w(),(P=e.onAfterLeave)==null||P.call(e,u)));};u[ye]=R;let L=ue(e.duration,"leave"),I=o&&!e.onLeave&&L==null?!!Yn(u,e.type):false;if(!e.onLeave&&L==null&&!I){R(false);return}he(()=>{T||(o&&(O(u,t.leaveFrom),U(u,t.leaveTo)),e.onLeave?e.onLeave(u,()=>R(false)):o?ce(u,e.type,L,()=>R(false)):R(false));});},C=(u,w)=>{if(u&&s==="leaving"&&l){let T=l,R=T[ye];R&&R(true),l=null,i=T,E(T,"enter");return}if(u===i)return;let k=i;if(i=u,k){l=k;let T=k;_(T,()=>{T.parentNode&&T.parentNode.removeChild(T),l===T&&(l=null);});}u&&n.parentNode?(n.parentNode.insertBefore(u,n),w&&!e.appear?s="entered":E(u,w&&e.appear?"appear":"enter")):!k&&!u&&(s="idle");},N=()=>{if(y=false,v||!f)return;let u=d;f=false,d=void 0;try{C(Xn(u),!1);}catch(w){}},p=u=>{d=u,f=true,!y&&(y=true,queueMicrotask(N));},S=signals.effect(()=>{let u=r();c?p(u):(d=u,f=true);});return J(()=>{c=!0;let u=f?Xn(d):null;f=!1,d=void 0,C(u,!0);}),K(()=>{v=true,S.stop();for(let u of [i,l]){if(!u)continue;let w=u[Me],k=u[ye];w==null||w(true),k==null||k(true),u.parentNode&&u.parentNode.removeChild(u);}i=null,l=null,s="idle";}),n}Jn[Be]=true;function bo(e){return !!e&&!!e[Be]}function cn(e,n){if(e==null||e===false)return {el:null,comp:null};if(Array.isArray(e)&&e.length===1)return cn(e[0],n);if(shared.isFunction(e))return cn(e(),n);if(e instanceof HTMLElement)return {el:e,comp:null};if(V(e)){let t=e;t.scope==null&&t.mount(n);let o=t.firstChild;return o instanceof HTMLElement?{el:o,comp:t}:{el:null,comp:t}}return {el:null,comp:null}}function Ao(e){return {position:e.style.position,top:e.style.top,left:e.style.left,width:e.style.width,height:e.style.height}}function an(e,n){e.style.position=n.position,e.style.top=n.top,e.style.left=n.left,e.style.width=n.width,e.style.height=n.height;}function Qn(e){var R,L,I;let n=(R=e.tag)!=null?R:"div",t=document.createElement(n),o=ln(e),r=e.css!==false,s=(I=e.moveClass)!=null?I:`${(L=e.name)!=null?L:"v"}-move`,i=e.key,l=e.children,c=Array.isArray(l)&&l.length===1&&shared.isFunction(l[0])?l[0]:e.children;if(!shared.isFunction(c)||!shared.isFunction(i))throw new TypeError("<TransitionGroup> requires `children: (item, index) => Node` and `key: (item, index) => unknown`");let d=()=>{var g,m;let a=e.each;return signals.isSignal(a)?(g=a.value)!=null?g:[]:shared.isFunction(a)?(m=a())!=null?m:[]:a!=null?a:[]},f=[],y=false,v=(a,g)=>{let m=M(),P=z(m),b;$(P,()=>{b=c(a,g);});let{el:A,comp:h}=cn(b,t);return A?{key:i(a,g),item:a,el:A,comp:h,scope:P,state:"entering"}:(H(P),null)},E=a=>{if(a.comp){for(let g of a.comp.renderedNodes)g.parentNode===t&&t.removeChild(g);return}a.el.parentNode===t&&t.removeChild(a.el);},_=a=>{var g,m;(g=a.cancelEnter)==null||g.call(a,true),(m=a.cancelLeave)==null||m.call(a,true),a.comp&&a.comp.destroy(),E(a),H(a.scope);},C=a=>{var b,A,h;let g=a.el;if((b=a.cancelLeave)==null||b.call(a,true),!r){a.state="present",(A=e.onAfterEnter)==null||A.call(e,g);return}(h=e.onBeforeEnter)==null||h.call(e,g),U(g,o.enterFrom),U(g,o.enterActive);let m=false,P=x=>{var F,j;m||(m=true,a.cancelEnter=void 0,O(g,o.enterFrom),O(g,o.enterActive),O(g,o.enterTo),x?(F=e.onEnterCancelled)==null||F.call(e,g):(a.state="present",(j=e.onAfterEnter)==null||j.call(e,g)));};a.cancelEnter=P,a.state="entering",he(()=>{if(!m)if(O(g,o.enterFrom),U(g,o.enterTo),e.onEnter)e.onEnter(g,()=>P(false));else {let x=ue(e.duration,"enter");ce(g,e.type,x,()=>P(false));}});},N=(a,g)=>{var h,x;let m=a.el;a.cancelEnter&&(a.cancelEnter(true),Ie(m)),a.state="leaving",a.savedStyles=Ao(m);let P=t.getBoundingClientRect();if(m.style.position="absolute",m.style.top=`${g.top-P.top}px`,m.style.left=`${g.left-P.left}px`,m.style.width=`${g.width}px`,m.style.height=`${g.height}px`,!r){a.savedStyles&&an(m,a.savedStyles),E(a),H(a.scope),a.comp&&a.comp.destroy(),(h=e.onAfterLeave)==null||h.call(e,m);return}(x=e.onBeforeLeave)==null||x.call(e,m),U(m,o.leaveFrom),U(m,o.leaveActive);let b=false,A=F=>{var j,q;if(!b){if(b=true,a.cancelLeave=void 0,O(m,o.leaveFrom),O(m,o.leaveActive),O(m,o.leaveTo),F){a.savedStyles&&an(m,a.savedStyles),a.savedStyles=void 0,(j=e.onLeaveCancelled)==null||j.call(e,m);return}a.savedStyles&&an(m,a.savedStyles),a.savedStyles=void 0,E(a),H(a.scope),a.comp&&a.comp.destroy(),(q=e.onAfterLeave)==null||q.call(e,m);}};a.cancelLeave=A,he(()=>{if(!b)if(O(m,o.leaveFrom),U(m,o.leaveTo),e.onLeave)e.onLeave(m,()=>A(false));else {let F=ue(e.duration,"leave");ce(m,e.type,F,()=>A(false));}});},p=(a,g)=>{if(!r||a.state!=="present")return;let m=a.el,P=m.getBoundingClientRect(),b=g.left-P.left,A=g.top-P.top;if(!b&&!A)return;let h=m.style.transform,x=m.style.transitionDuration;m.style.transform=`translate(${b}px, ${A}px)`,m.style.transitionDuration="0s",U(m,s),Ie(m),m.style.transform=h,m.style.transitionDuration=x;let F=ue(e.duration,"enter");ce(m,e.type,F,()=>{O(m,s);});},S=()=>{for(let a of f)a.state!=="leaving"&&(a.prevRect=a.el.getBoundingClientRect());},u=a=>{let g=new Map;for(let A of f)g.set(A.key,A);let m=[];for(let[A,h]of a.entries()){let x=i(h,A),F=g.get(x);if(F)g.delete(x),F.item=h,m.push(F);else {let j=v(h,A);j&&m.push(j);}}let P=[];for(let A of g.values())A.state!=="leaving"&&P.push(A);let b=null;for(let A=m.length-1;A>=0;A--){let h=m[A].el;(h.parentNode!==t||h.nextSibling!==b)&&t.insertBefore(h,b),b=h;}return {next:m,leaving:P}},w=(a,g)=>{if(g){let b=[];for(let[A,h]of a.entries()){let x=v(h,A);x&&(x.el.parentNode!==t&&t.appendChild(x.el),x.state="present",b.push(x));}f=b;return}S();let{next:m,leaving:P}=u(a);for(let b of m)b.state!=="present"&&C(b);for(let b of P){let A=b.prevRect;A&&N(b,A);}for(let b of m)b.state!=="present"||!b.prevRect||(p(b,b.prevRect),b.prevRect=void 0);f=m.concat(P);},k=null,T=signals.effect(()=>{let a=d();if(!y){k=a;return}w(a,false);});return J(()=>{y=!0,k&&(w(k,!0),k=null);}),K(()=>{T.stop();for(let a of f)_(a);f=[],t.parentNode&&t.parentNode.removeChild(t);}),t}Qn[Ue]=true;function xo(e){return !!e&&!!e[Ue]}
|
|
2
|
-
exports.Component=
|
|
1
|
+
'use strict';var shared=require('@estjs/shared'),signals=require('@estjs/signals');var an=Object.getOwnPropertySymbols;var Jn=Object.prototype.hasOwnProperty,Qn=Object.prototype.propertyIsEnumerable;var cn=(e,n)=>{var t={};for(var o in e)Jn.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(e!=null&&an)for(var o of an(e))n.indexOf(o)<0&&Qn.call(e,o)&&(t[o]=e[o]);return t};var Oe=(e,n,t)=>new Promise((o,r)=>{var s=a=>{try{l(t.next(a));}catch(u){r(u);}},i=a=>{try{l(t.throw(a));}catch(u){r(u);}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(s,i);l((t=t.apply(e,n)).next());});var un="ref",fn="key",dn="http://www.w3.org/2000/svg",He="http://www.w3.org/2000/xlink",Ve="http://www.w3.org/2000/xmlns/";var je=Symbol(""),ue=Symbol(""),$e=Symbol(""),mn=Symbol(""),Ke=Symbol(""),Ue=Symbol("");var Q=null,et=0;function D(){return Q}function ve(e){Q=e,signals.setCurrentScope(e==null?void 0:e.effectScope);}function K(e=Q){let n=e?e.effectScope.run(()=>signals.effectScope()):signals.effectScope(true),t={id:++et,effectScope:n,parent:e,children:null,provides:null,cleanup:null,onMount:null,onUpdate:null,onDestroy:null,isMounted:false,isDestroyed:false};return e&&(e.children||(e.children=new Set),e.children.add(t)),t}function H(e,n){let t=Q;ve(e);try{return e.effectScope.run(n)}finally{ve(t);}}function I(e){var t;if(!e||e.isDestroyed)return;if(e.isDestroyed=true,(t=e.parent)!=null&&t.children&&e.parent.children.delete(e),e.parent=null,e.children&&e.children.size>0){for(let o of e.children)o&&(o.parent=null,I(o));e.children.clear();}let n=Q;if(ve(e),e.onDestroy){for(let o=0;o<e.onDestroy.length;o++)try{e.onDestroy[o]();}catch(r){}e.onDestroy=null;}if(e.cleanup){for(let o=0;o<e.cleanup.length;o++)try{e.cleanup[o]();}catch(r){}e.cleanup=null;}ve(n),e.effectScope.stop(),e.provides&&(e.provides.clear(),e.provides=null),e.onMount=null,e.onUpdate=null,e.children=null;}function U(e){let n=Q;n&&(n.cleanup||(n.cleanup=[]),n.cleanup.push(e));}var st=/^data:\s*(?:text\/html|text\/xml|application\/xhtml\+xml|image\/svg\+xml|application\/xml)/;function lt(e){let n=e.replaceAll(/[\u0000-\u0020]+/g,"").toLowerCase();return shared.startsWith(n,"javascript:")||shared.startsWith(n,"vbscript:")?true:st.test(n)}function Z(e,n,t,o){if(n===fn){o==null?e.removeAttribute(n):e.setAttribute(n,String(o));return}if(n===shared.SPREAD_NAME){let m=shared.isObject(t)?t:null,T=shared.isObject(o)?o:null;if(m)for(let S in m)S!==shared.SPREAD_NAME&&(!T||!(S in T))&&Z(e,S,m[S],null);if(T)for(let S in T)S!==shared.SPREAD_NAME&&Z(e,S,m==null?void 0:m[S],T[S]);return}let r=(e==null?void 0:e.namespaceURI)===dn,s=r&&shared.startsWith(n,"xlink:"),i=r&&shared.startsWith(n,"xmlns:"),l=shared.isSpecialBooleanAttr(n)||shared.isBooleanAttr(n);if(t===o||n.length>2&&n.charCodeAt(0)===111&&n.charCodeAt(1)===110)return;let a=n.toLowerCase();if(a==="innerhtml"||a==="srcdoc")return;if(o==null){if(s)e.removeAttributeNS(He,n.slice(6));else if(i){let m=n.slice(6);e.removeAttributeNS(Ve,m);}else e.removeAttribute(n);return}if(l){shared.includeBooleanAttr(o)?e.setAttribute(n,""):e.removeAttribute(n);return}let u=shared.isSymbol(o)?String(o):o;if(!((a==="href"||a==="src"||a==="xlink:href"||a==="action"||a==="formaction"||a==="poster")&&shared.isString(u)&<(u))){if(s){e.setAttributeNS(He,n,String(u));return}if(i){e.setAttributeNS(Ve,n,String(u));return}if(r)e.setAttribute(n,String(u));else if(n in e)try{e[n]=u;}catch(m){e.setAttribute(n,String(u));}else e.setAttribute(n,String(u));}}function Ce(e,n,t,o=false){if(n===t)return;let r=Se(t);if(!r){e.removeAttribute("class");return}(shared.isString(n)?n:Se(n))!==r&&(o?e.setAttribute("class",r):e.className=r);}var Se=shared.normalizeClassName;var hn=/\s*!important$/,yt=["Webkit","Moz","ms"],Be={};function Te(e,n,t){let o=e.style;if(t&&shared.isString(t)){n!==t&&(o.cssText=t);return}if(!t){n&&e.removeAttribute("style");return}if(n&&!shared.isString(n)){let r=n;for(let s in r)(!t||t[s]==null)&&ne(o,s,"");}else if(n&&shared.isString(n)){let r=/(?:^|;)\s*([a-z][a-z\d-]*)\s*:/gi,s;for(;(s=r.exec(n))!==null;){let i=s[1].trim();i&&t&&shared.isObject(t)&&t[i]==null&&ne(o,i,"");}}if(t&&!shared.isString(t)){let r=t;for(let s in r){let i=r[s];(!n||shared.isString(n)||n[s]!==i)&&i!=null&&ne(o,s,i);}}}function ne(e,n,t){if(shared.isArray(t)){for(let s of t)ne(e,n,s);return}(t==null||t==="")&&(t="");let o=shared.isString(t)&&hn.test(t)?"important":"";if(o&&(t=t.replace(hn,"")),shared.startsWith(n,"--")){o?e.setProperty(n,t,o):e.setProperty(n,t);return}let r=gt(e,n);o?e.setProperty(ht(r),t,o):e[r]=t;}function ht(e){let n=shared.kebabCase(e);return shared.startsWith(e,"Webkit")||shared.startsWith(e,"Moz")||shared.startsWith(e,"ms")?`-${n}`:n}function gt(e,n){let t=Be[n];if(t)return t;let o=shared.camelCase(n);if(o!=="filter"&&o in e)return Be[n]=o;o=shared.capitalize(o);for(let r of yt){let s=r+o;if(s in e)return Be[n]=s}return n}var Ge=0;function gn(){return String(Ge++)}function Ct(){Ge=0;}var X=false;function oe(){return X}var te=new Map;function Nt(e){let n=e.querySelectorAll("[data-hk]");for(let t of n){let o=t.dataset.hk;o!=null&&!te.has(o)&&te.set(o,t);}}var we=[],fe=new Map;function Tt(){if(typeof document=="undefined")return;let e=document.createNodeIterator(document.body,NodeFilter.SHOW_COMMENT),n;for(;n=e.nextNode();){let t=n.data;if(t==="teleport-anchor")we.push(n);else if(t==="teleport-start"){let o=n.parentElement;if(!o)continue;let r=fe.get(o);r||(r=[],fe.set(o,r)),r.push(n);}}}function We(){var e;return (e=we.shift())!=null?e:null}function ze(e){let n=fe.get(e),t=n==null?void 0:n.shift();if(!t)return null;let o=[],r=t.nextSibling;for(;r;){if(r.nodeType===Node.COMMENT_NODE&&r.data==="teleport-end")return {start:t,end:r,nodes:o};o.push(r),r=r.nextSibling;}return null}function qe(e){X=true,Ge=0,te.clear(),we.length=0,fe.clear(),Nt(e),Tt();}function Xe(){X=false,te.clear(),we.length=0,fe.clear();}function vn(e,n,t){var s,i;if(!X||t&&t.parentNode!==e)return null;if(n.length===0)return [];let o=new Array(n.length),r=t?t.previousSibling:e.lastChild;for(let l=n.length-1;l>=0;l--){if(!r)return null;let a=n[l],u=a.nodeType;if(u===Node.TEXT_NODE){let f=(s=a.textContent)!=null?s:"";if(!f||r.nodeType!==Node.TEXT_NODE)return null;let m=(i=r.textContent)!=null?i:"";if(m===f){o[l]=r,r=r.previousSibling;continue}if(!m.endsWith(f))return null;let T=m.slice(0,m.length-f.length);if(!T)return null;let S=document.createTextNode(T);e.insertBefore(S,r),r.textContent=f,o[l]=r,r=S;continue}if(r.nodeType!==u)return null;if(u===Node.ELEMENT_NODE){if(r.tagName!==a.tagName)return null}else if(u===Node.COMMENT_NODE&&r.data!==a.data)return null;o[l]=r,r=r.previousSibling;}return o}function En(e){var t,o,r;return (r=(o=e.dataset.hk)!=null?o:(t=e.closest("[data-hk]"))==null?void 0:t.dataset.hk)!=null?r:null}function bt(e,n){if(!X||!e||n<0)return null;let t=e instanceof Element?En(e):null,o=t?`${t}-${n}`:String(n),r=e.firstChild;for(;r;){if(r.nodeType===Node.COMMENT_NODE&&r.data===o)return r;r=r.nextSibling;}return null}function wt(e,n){if(!X||!(e instanceof Element)||n<0)return null;let t=En(e),o=t?`${t}-${n}`:String(n),r=e.firstChild;for(;r;){if(r instanceof Element&&r.getAttribute(shared.HYDRATION_ANCHOR_ATTR)===o)return r;r=r.nextSibling;}return null}function At(e){if(!shared.isBrowser())return ()=>{throw new Error("[essor] getRenderedElement called in non-browser environment")};let n=null;return ()=>{if(!X)return n||(n=be(e)),n();let t=gn(),o=te.get(t);return o?(te.delete(t),o):(shared.warn(`[essor] hydration mismatch: no SSR element for key "${t}"`),n||(n=be(e)),n())}}function _t(e,n,t,o){X||Ce(e,n,t,o);}function xt(e,n,t,o){X||Z(e,n,t,o);}function kt(e,n,t){X||Te(e,n,t);}function Ye(e,n){return n&&n.parentNode===e?n:null}function Sn(e,n,t,o){let r=Ye(e,o),s=n.length,i=t.length;if(s===0&&i===0)return t;if(s===0){for(let f=0;f<i;f++)G(e,t[f],r);return t}if(i===0){for(let f=0;f<s;f++)Y(n[f]);return []}let l=0,a=s-1,u=i-1;for(;l<=a&&l<=u&&n[l]===t[l];)l++;for(;a>=l&&u>=l&&n[a]===t[u];)a--,u--;if(l>a){if(l<=u){let f=u+1,m=Ye(e,f<i?t[f]:r);for(let T=l;T<=u;T++)G(e,t[T],m);}}else if(l>u)for(let f=l;f<=a;f++)Y(n[f]);else Pt(e,n,t,l,a,u,r);return t}function Pt(e,n,t,o,r,s,i){let l=s-o+1,a=l<=4?w=>{for(let b=o;b<=s;b++)if(t[b]===w)return b}:(()=>{let w=new Map;for(let b=o;b<=s;b++)w.set(t[b],b);return b=>w.get(b)})(),u=new Int32Array(l),f=0,m=false,T=0;for(let w=o;w<=r;w++){let b=n[w];if(f>=l){Y(b);continue}let L=a(b);L===void 0?Y(b):(u[L-o]=w+1,L>=T?T=L:m=true,f++);}let S=m?Je(u):[],x=S.length-1;for(let w=l-1;w>=0;w--){let b=o+w,L=t[b],y=Ye(e,b+1<t.length?t[b+1]:i);u[w]===0?G(e,L,y):m&&(x<0||w!==S[x]?G(e,L,y):x--);}}function Je(e){let n=new Int32Array(e.length),t=[0],o=e.length,r,s,i,l,a;for(r=0;r<o;r++){let u=e[r];if(u!==0){if(s=t[t.length-1],e[s]<u){n[r]=s,t.push(r);continue}for(i=0,l=t.length-1;i<l;)a=i+l>>1,e[t[a]]<u?i=a+1:l=a;u<e[t[i]]&&(i>0&&(n[r]=t[i-1]),t[i]=r);}}for(i=t.length,l=t[i-1];i-- >0;)t[i]=l,l=n[l];return t}function Y(e){if(e)if($(e))e.destroy();else {let n=e;n.parentNode&&n.remove();}}function G(e,n,t){if(!e||!n)return;let o=$(t)?t.firstChild:t;if($(n)){n.mount(e,o);return}o?e.insertBefore(n,o):e.appendChild(n);}function Ae(e){if(e instanceof Node||$(e))return e;let n=typeof e;return e==null||n==="string"||n==="number"||n==="boolean"||n==="symbol"?document.createTextNode(e===false||e==null?"":String(e)):document.createTextNode(String(e))}function W(e,n,t){if(!e)return;let o=D(),r=[],s=true,i=a=>{if(a instanceof Node)return [a];if($(a))return [a];let u=typeof a;return a==null||u==="string"||u==="number"||u==="boolean"?[Ae(a)]:shared.coerceArray(a).map(f=>shared.isFunction(f)?f():f).flatMap(f=>f).map(Ae)},l=signals.effect(()=>{let a=()=>{let u=shared.isFunction(n)?n():n,f=i(u);if(s&&oe()&&f.every(m=>m instanceof Node&&m.parentNode===e)){r=f,s=false;return}if(s&&oe()){let m=vn(e,f,t);if(m){r=m,s=false;return}}r=Sn(e,r,f,t),s=false;};o&&!o.isDestroyed?H(o,a):a();});return U(()=>{l.stop();for(let a of r)Y(a);r=[];}),r}function Lt(e){return (e==null?void 0:e.firstChild)||null}function Ft(e,n=1){for(;e&&n>0;)e=e.nextSibling,n--;return e||null}function Mt(e,n){if(!e||n<0)return null;let t=e.firstChild;for(;t&&n>0;)t=t.nextSibling,n--;return t||null}function re(e,n,t,o){if(!(o!=null&&o.delegate))return e.addEventListener(n,t,o),()=>e.removeEventListener(n,t,o);let r=o.delegate,s=u=>{let f=u.target;(f.matches(r)||f.closest(r))&&t.call(e,u);},a=o,{delegate:i}=a,l=cn(a,["delegate"]);return e.addEventListener(n,s,l),()=>{e.removeEventListener(n,s,l);}}function Qe(e,n,t){let o=e[n];o||(o=[],e[n]=o),o.push(t);}function Tn(e,n,t){let o=e.length;if(o===0)return;let r;for(let s=0;s<o;s++)try{let i=e[s]();if(shared.isPromise(i)){let l=i.catch(a=>{});(r||(r=[])).push(l);}}catch(i){}if(r)return Promise.all(r).then(()=>{})}function J(e){let n=D();if(n){if(n.isMounted){try{let t=e();shared.isPromise(t)&&t.catch(o=>{});}catch(t){}return}Qe(n,"onMount",e);}}function It(e){let n=D();n&&Qe(n,"onUpdate",e);}function Ze(e){let n=D();n&&Qe(n,"onDestroy",e);}function bn(e){if(e.isDestroyed)return;if(!e.onMount||e.onMount.length===0){e.isMounted=true;return}let n=e.onMount,t=H(e,()=>Tn(n,e.id));return n.length=0,e.isMounted=true,t}function wn(e){if(!(e.isDestroyed||!e.onUpdate||e.onUpdate.length===0))return H(e,()=>Tn(e.onUpdate,e.id))}function _n(e,n,t=false){for(let o of Object.getOwnPropertyNames(n))Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o));if(t){let o=Object.getOwnPropertyNames(n);for(let r of Object.getOwnPropertyNames(e))o.includes(r)||delete e[r];}}function xn(e,n){let t=Object.getOwnPropertyDescriptor(e,n);return t.get?t.get.call(e):t.value}var kn;kn="normal";var ie=class{constructor(n,t={}){this.component=n;this.props=t;this[kn]=true;this.scope=null;this.state=0;this.beforeNode=void 0;this.renderedNodes=[];this.firstChild=void 0;this.parentNode=void 0;this.rootEventCleanups=[];this.parentScope=D();let o={};_n(o,t),this.reactiveProps=signals.shallowReactive(o);}mount(n,t){var s;if(this.parentNode=n,this.beforeNode=t,this.state=1,this.renderedNodes.length>0){for(let i of this.renderedNodes)G(n,i,t);return this.state=2,this.renderedNodes}let o=K((s=this.parentScope)!=null?s:D());this.scope=o;let r=H(o,()=>{var l;let i=this.component(this.reactiveProps);return shared.isFunction(i)&&(i=i(this.reactiveProps)),(signals.isSignal(i)||signals.isComputed(i))&&(i=i.value),(l=W(n,i,t))!=null?l:[]});return this.renderedNodes=r,this.firstChild=r[0],this.syncSpecialProps(this.props),this.state=2,bn(o),this.renderedNodes}update(n){this.props=n;let t=this.scope;!t||t.isDestroyed||(_n(this.reactiveProps,n!=null?n:{},true),this.syncSpecialProps(n),wn(t));}forceUpdate(){if(!this.parentNode)return;let n=this.parentNode,t=this.beforeNode;this.destroy(),this.mount(n,t);}destroy(){let n=this.scope;if(!(!n||n.isDestroyed)){this.scope=null,this.releaseSpecialProps(),I(n);for(let t of this.renderedNodes)Y(t);this.renderedNodes=[],this.firstChild=void 0,this.parentNode=void 0;for(let t of Object.getOwnPropertyNames(this.reactiveProps))delete this.reactiveProps[t];this.state=0;}}syncSpecialProps(n){if(!n)return;let t=this.firstChild;if(!(!t||!(t instanceof Element))){this.releaseSpecialProps();for(let o of Object.getOwnPropertyNames(n)){if(o===un){let r=xn(n,o);this.rootRefCleanup=this.bindRootRef(r,t);continue}if(shared.isOn(o)){let r=xn(n,o);if(!shared.isFunction(r))continue;let s=o.slice(2).toLowerCase(),i=t,l=`_$${s}`,a=i[l];if(shared.isFunction(a)){i[l]=r,this.rootEventCleanups.push(()=>{i[l]===r&&(i[l]=a);});continue}let u=r,f=m=>{i.disabled||u.call(i,m);};this.rootEventCleanups.push(re(i,s,f));}}}}releaseSpecialProps(){for(let n of this.rootEventCleanups)n();this.rootEventCleanups.length=0,this.rootRefCleanup&&(this.rootRefCleanup(),this.rootRefCleanup=void 0);}bindRootRef(n,t){if(shared.isFunction(n))return n(t),()=>n(null);if(signals.isSignal(n)){let o=n,r=o.value;return o.value=t,()=>{o.value===t&&(o.value=r);}}}};function $(e){return !!e&&!!e.normal}function xe(e,n){return $(e)?e:new ie(e,n)}function be(e){let n,t=()=>{let o=document.createElement("template");o.innerHTML=e;let r=o.content.firstChild;if(!r)throw new Error("Invalid template: empty content");return r};return ()=>(n||(n=t())).cloneNode(true)}function jt(e,n){let t=shared.isString(n)?document.querySelector(n):n;if(!t)return;t.innerHTML&&(t.innerHTML="");let r=K(),s;try{H(r,()=>{let i=xe(e);$(i)&&(s=i,G(t,i));});}catch(i){throw I(r),i}return {root:s,unmount:()=>{s==null||s.destroy(),I(r);}}}function $t(e,n){let t=shared.isString(n)?document.querySelector(n):n;if(!t)return;qe(t);let o=K(),r;try{H(o,()=>{let s=xe(e);$(s)&&(r=s,W(t,s));});}catch(s){throw I(o),s}finally{Xe();}return {root:r,unmount:()=>{r==null||r.destroy(),I(o);}}}function en(e,n){let t=D();t&&(t.provides||(t.provides=new Map),t.provides.set(e,n));}function de(e,n){let t=D();if(!t)return n;let o=t;for(;o;){if(o.provides&&o.provides.has(e))return o.provides.get(e);o=o.parent;}return n}function nn(e,n){Object.defineProperty(e,"target",{configurable:true,value:n});}function Dn(e){let n=e.target,t=e.type,o=e.target,r=e.currentTarget,s=()=>{let l=n[`_$${t}`];if(l&&shared.isFunction(l)&&!n.disabled){let a=n[`${t}Data`];if(a?l.call(n,a,e):l.call(n,e),e.cancelBubble)return false}return n.host&&!shared.isString(n.host)&&!n.host._$host&&shared.isFunction(n.contains)&&n.contains(e.target)&&nn(e,n.host),true},i=()=>{for(;s()&&(n=n._$host||n.parentNode||n.host););};if(Object.defineProperty(e,"currentTarget",{configurable:true,get(){return n||document}}),e.composedPath){let l=e.composedPath();nn(e,l[0]);for(let a=0;a<l.length-2&&(n=l[a],!!s());a++){if(n._$host){n=n._$host,i();break}if(n.parentNode===r)break}}else i();nn(e,o);}var ke=Symbol("_$EVENTS");function Ut(e,n=globalThis.document){let t=n,o=t[ke]||(t[ke]=new Set);for(let r of e)o.has(r)||(o.add(r),n.addEventListener(r,Dn));}function Bt(e=globalThis.document){let n=e,t=n[ke];if(t){for(let o of t.keys())e.removeEventListener(o,Dn);delete n[ke];}}function se(e,n,t,o){let r=re(e,n,t,o);D()&&U(r);}var qt=e=>e,Xt=typeof DataTransfer!="undefined"?new DataTransfer().files:[];function Mn(e,n){let t=e,o=n==null?"":String(n);t.value!==o&&(t.value=o);}var Yt={event:"change",forceChange:true,checkboxArray:true,read:e=>e.checked,write(e,n){let t=e,o=shared.isArray(n)?n.map(String).includes(t.value):!!n;t.checked!==o&&(t.checked=o);}},Jt={event:"change",forceChange:true,read(e){let n=e;return n.checked?n.value:""},write(e,n){let t=e,o=String(n)===t.value;t.checked!==o&&(t.checked=o);}},Qt={event:"change",forceChange:true,read:e=>e.files,write(e,n){if(n==null)try{e.files=Xt;}catch(t){}}},Ln={event:"input",ime:true,read:e=>e.value,write:Mn},Zt={event:"change",forceChange:true,read(e){let n=e;return n.multiple?Array.from(n.selectedOptions,t=>t.value):n.value},write(e,n){let t=e;if(!t.multiple)return Mn(e,n);let o=new Set((shared.isArray(n)?n:[]).map(String));for(let r of Array.from(t.options))r.selected=o.has(r.value);}};function Fn(e){return {event:"input",read:n=>n[e],write(n,t){n[e]=t;}}}function eo(e,n){switch(e.nodeName){case "INPUT":return n==="checked"?e.type==="radio"?Jt:Yt:n==="files"?Qt:n==="value"?Ln:Fn(n);case "SELECT":return Zt;case "TEXTAREA":return Ln;default:return Fn(n)}}function no(e,n,t){if(!shared.isString(e))return e;let o=n?e.trim():e;if(t){let r=n?o:o.trim();if(r!==""){let s=Number(r);if(!Number.isNaN(s))return s}}return o}function to(e){let n=e.getRootNode();return (n instanceof Document||n instanceof ShadowRoot)&&n.activeElement===e}function oo(e,n){if(n!=="value"||e.nodeName!=="INPUT")return false;let t=e.type;return t==="number"||t==="range"}function ro(e,n,t,o,r={}){if(!e)return;let{event:s,read:i,write:l,forceChange:a,ime:u,checkboxArray:f}=eo(e,n),m=r.trim===true,T=r.number===true||oo(e,n),S=r.lazy===true,x=(m||T)&&n!=="files",w=shared.isFunction(t)?t:()=>t,b=x?E=>no(E,m,T):qt,L=f?E=>{let v=w();if(!shared.isArray(v))return b(E);let R=e.value,O=v.filter(c=>String(c)!==R);return E&&O.push(R),O}:b,y=false,d=S||a?"change":s,C=()=>{if(y)return;let E=i(e);if(E===void 0)return;let v=L(E);Object.is(w(),v)||o(v);};se(e,d,C),!S&&x&&d!=="change"&&se(e,"change",()=>l(e,b(i(e)))),u&&(se(e,"compositionstart",()=>{y=true;}),se(e,"compositionend",()=>{y=false,S||C();}));let N=signals.effect(()=>{let E=w();u&&y||u&&!S&&to(e)&&Object.is(b(i(e)),E)||l(e,E);});D()&&U(()=>N.stop());}function In(e){let n=e;return Array.isArray(n)&&n.length===1&&(n=n[0]),typeof n=="function"?n():n}function On(e){let n=Object.getOwnPropertyDescriptor(e,"children");return n!=null&&n.get?()=>In(n.get.call(e)):()=>In(e.children)}function io(e,n){let t=new Set(n);return new Proxy(e,{get(o,r){if(!t.has(r))return Reflect.get(o,r)},ownKeys(o){return Reflect.ownKeys(o).filter(r=>!t.has(r))},getOwnPropertyDescriptor(o,r){if(!t.has(r))return Reflect.getOwnPropertyDescriptor(o,r)},has(o,r){return t.has(r)?false:Reflect.has(o,r)}})}function Hn(e){var t;if(e&&((t=Object.getOwnPropertyDescriptor(e,"children"))!=null&&t.get||signals.isReactive(e)))return [()=>e.children];let n=e==null?void 0:e.children;return n==null?null:n}Hn[je]=true;function lo(e){return !!e&&!!e[je]}function Pe(e){let n=shared.isFunction(e.target)?e.target():e.target;return n==null?null:shared.isString(n)?document.querySelector(n):n}function Re(e){return shared.isFunction(e.disabled)?!!e.disabled():!!e.disabled}function jn(e){if(oe()){let f=uo(e);if(f)return f}let n=document.createComment("portal");n[ue]=true;let{children:t}=e;if(t==null)return n;let o=D(),r=null,s=(f,m)=>{r=K(o),H(r,()=>{W(f,()=>t,m);});},i=()=>{r&&(I(r),r=null);},l=(f,m)=>{if(i(),f){let T=n.parentNode;if(!T)return;s(T,n);return}m&&s(m);},a=false,u=signals.effect(()=>{let f=Re(e),m=f?null:Pe(e);a&&l(f,m);});return J(()=>{a=!0;let f=Re(e),m=f?null:Pe(e);if(f||m){l(f,m);return}queueMicrotask(()=>{n.parentNode&&l(Re(e),Pe(e));});}),U(()=>{u.stop(),i();}),n}jn[ue]=true;function uo(e){if(Re(e))return null;let n=We();if(!n)return null;let t=Pe(e);return !t||!ze(t)?null:(n[ue]=true,n)}function fo(e){return !!e&&!!e[ue]}function De(e){let n=e;for(;shared.isFunction(n);)n=n();return signals.isSignal(n)||signals.isComputed(n)?De(n.value):Array.isArray(n)?n.map(t=>De(t)):n}var me=Symbol("SuspenseContext");function Kn(e){var E;if(!shared.isBrowser())return (E=e.fallback)!=null?E:"";let n=D(),t=document.createComment("suspense"),o=document.createComment("/suspense"),r=document.createDocumentFragment();r.append(t,o);let s=true,i=0,l=false,a=null,u=null,f=null,m=null,T=()=>{let v=document.createDocumentFragment();for(;o.previousSibling&&o.previousSibling!==t;)v.prepend(o.previousSibling);u=v;},S=()=>{var R;if(!u)return;let v=(R=o.parentNode)!=null?R:r;for(;u.firstChild;)v.insertBefore(u.firstChild,o);u=null;},x=()=>{e.fallback==null||f||(f=K(n),H(f,()=>{var v;W((v=o.parentNode)!=null?v:r,()=>De(e.fallback),o);}));},w=()=>{f&&(I(f),f=null);},b=v=>{l=true,a=K(n),H(a,()=>{var R;W((R=o.parentNode)!=null?R:r,()=>De(v),o);}),l=false,i&&!u&&(T(),x());},L=()=>{u||l||(T(),x());},y=()=>{if(!u)return;let v=e.children!=null&&!shared.isPromise(e.children);a==null&&m==null&&!v||(w(),S(),a||(m?b(m):v&&b(e.children)));},d=()=>{s&&--i===0&&y();},C={register:v=>{i++,L(),v.then(d).catch(R=>{d();});},increment:()=>{i++,L();},decrement:()=>{i=Math.max(0,i-1),i===0&&y();}};en(me,C);let N=e.children;return shared.isPromise(N)?(N.then(v=>{m=v;}).catch(()=>{}),C.register(N)):N!=null?b(N):e.fallback!=null&&L(),U(()=>{s=false,i=0,m=null,a&&I(a),f&&I(f),a=f=null,u=null,t.remove(),o.remove();}),r}Kn[$e]=true;function go(e){return !!e&&!!e[$e]}function vo(e,n){let t=signals.signal(n==null?void 0:n.initialValue),o=signals.signal(true),r=signals.signal(null),s=signals.signal("pending"),i=0,l=null,a=false,u=de(me,null),f=()=>Oe(null,null,function*(){let S=++i;o.value=true,s.value="pending",r.value=null,a=false,u&&u.increment();try{let x=e();l=x,x.catch(()=>{});let w=yield x;S===i&&(t.value=w,s.value="ready",o.value=!1);}catch(x){S===i&&(r.value=x instanceof Error?x:new Error(String(x)),s.value="errored",o.value=false);}finally{u&&u.decrement();}});f();let m=(()=>(!a&&o.value&&l&&u&&(a=true,u.register(l)),t.value));return m.loading=o,m.error=r,m.state=s,[m,{mutate:S=>{t.value=S,s.value="ready",o.value=false,r.value=null;},refetch:()=>Oe(null,null,function*(){yield f();})}]}function Un(e){return shared.isFunction(e)?e:e.default}function So(e,n){if(n==="client-only"){let i=()=>"";return i.__asyncLoader=e,i.__asyncResolved=()=>null,i}let t=null,o=null,r=()=>o!=null?o:o=e().then(i=>{t=Un(i);}).catch(()=>{});r();let s=i=>t?t(i):"";return s.__asyncLoader=r,s.__asyncResolved=()=>t,s}function Co(e,n){let{loading:t,error:o,delay:r=200,timeout:s,onError:i}=n,l=null,a=null,u="pending",f=null,m=()=>f!=null?f:f=e().then(S=>{l=Un(S),u="resolved";}).catch(S=>{a=S instanceof Error?S:new Error(String(S)),u="errored",f=null;});m();function T(S){var c;let x=D(),w=document.createComment("async"),b=document.createDocumentFragment();b.appendChild(w);let L=true,y=null,d=null,C=null,N=()=>{d!=null&&clearTimeout(d),C!=null&&clearTimeout(C),d=C=null;},E=(h,p)=>{L&&(x&&x.isDestroyed||(y&&(I(y),y=null),h&&(y=K(x),H(y,()=>{var k;W((k=w.parentNode)!=null?k:b,()=>new ie(h,p),w);}))));};Ze(()=>{L=false,N(),y&&(I(y),y=null),w.remove();});let v=h=>()=>{f=null,u="pending",a=null,t&&E(t),m().then(()=>R(h));},R=h=>{L&&(N(),u==="resolved"&&l?E(l,h):u==="errored"&&a&&(o&&E(o,{error:a,retry:v(h)}),i&&i(a,v(h))));};if(u==="resolved"&&l)return E(l,S),b;if(u==="errored"&&a)return o&&E(o,{error:a,retry:v(S)}),b;let O=m().then(()=>R(S));return (c=de(me))==null||c.register(O),r>0?d=setTimeout(()=>{L&&u==="pending"&&t&&E(t);},r):t&&E(t),s!=null&&(C=setTimeout(()=>{!L||u!=="pending"||(a=new Error(`[defineAsyncComponent] Timeout after ${s}ms`),u="errored",o&&E(o,{error:a,retry:v(S)}),i&&i(a,v(S)));},s)),b}return T.__asyncLoader=m,T.__asyncResolved=()=>l,T}function No(e,n={}){var t;return typeof window=="undefined"?So(e,(t=n.ssr)!=null?t:"blocking"):Co(e,n)}function Bn(e){let n=document.createDocumentFragment(),t=document.createComment("");n.appendChild(t);let o=[],r=[],s=e.key,i=e.children,l=Array.isArray(i)&&i.length===1&&shared.isFunction(i[0])?i[0]:e.children;if(!shared.isFunction(l))throw new TypeError("<For> requires `children` to be a function (item, index) => Node");let a=()=>{var d,C;let y=e.each;return signals.isSignal(y)?(d=y.value)!=null?d:[]:shared.isFunction(y)?(C=y())!=null?C:[]:y!=null?y:[]},u=(y,d)=>s?s(y,d):y,f=(y,d,C)=>{if(y==null||y===false)return [];if(Array.isArray(y)){let E=[];for(let v of y)E.push(...f(v,d,C));return E}if($(y))return G(d,y,C!=null?C:void 0),y.renderedNodes;let N=Ae(y);return G(d,N,C!=null?C:void 0),[N]},m=(y,d)=>{if(!e.fallback)return;r=f(e.fallback(),y,d);},T=()=>{for(let y of r)Y(y);r=[];},S=D(),x=(y,d,C,N,E=u(y,d))=>{var c;let v=(c=D())!=null?c:S,R=K(v),O=[];return H(R,()=>{O=f(l(y,d),C,N);}),{key:E,item:y,nodes:O,scope:R}},w=y=>{I(y.scope);for(let d of y.nodes)d.parentNode&&d.parentNode.removeChild(d);},b=signals.effect(()=>{let y=a(),d=t.parentNode;if(!d){if(y.length===0)m(n,t);else {o=new Array(y.length);let C=0;for(let N of y)o[C]=x(N,C,n,t),C++;}return}L(d,y);});function L(y,d){let C=o.length,N=d.length;if(N===0){for(let g=0;g<C;g++)w(o[g]);o=[],e.fallback&&r.length===0&&m(y,t);return}if(C===0||r.length>0){r.length>0&&T(),o=new Array(N);let g=document.createDocumentFragment();for(let P=0;P<N;P++)o[P]=x(d[P],P,g,null);y.insertBefore(g,t);return}let E=new Map;for(let g=0;g<C;g++){let P=o[g],V=E.get(P.key),q=[P,g];V?V.push(q):E.set(P.key,[q]);}let v=new Array(N),R=[],O=null,c=new Int32Array(N),h=false,p=0,k=new Array(N);for(let g=0;g<N;g++)k[g]=u(d[g],g);for(let g=0;g<N;g++){let P=d[g],V=k[g],q=E.get(V);if(q&&q.length>0){let[ce,z]=q.shift();Object.is(ce.item,P)?(ce.item=P,v[g]=ce,c[g]=z+1,z<p?h=true:p=z):(O||(O=document.createDocumentFragment()),w(ce),v[g]=x(P,g,O,null,V));}else O||(O=document.createDocumentFragment()),v[g]=x(P,g,O,null,V);}for(let g of E.values())for(let[P]of g)R.push(P);for(let g of R)w(g);let A=h?Je(c):[],_=A.length-1,F=t;for(let g=N-1;g>=0;g--){let V=v[g].nodes;if(!(c[g]===0)&&h&&_>=0&&g===A[_]){_--;for(let z=V.length-1;z>=0;z--)F=V[z];continue}for(let z=V.length-1;z>=0;z--){let Ie=V[z];Ie.nextSibling!==F&&y.insertBefore(Ie,F),F=Ie;}}o=v;}return U(()=>{b.stop();for(let y of o)w(y);o=[],T(),t.parentNode&&t.parentNode.removeChild(t);}),n}Bn[mn]=true;function rn(e){var s,i,l,a,u,f,m,T,S,x;let n=(s=e.name)!=null?s:"v",t=(i=e.enterFromClass)!=null?i:`${n}-enter-from`,o=(l=e.enterActiveClass)!=null?l:`${n}-enter-active`,r=(a=e.enterToClass)!=null?a:`${n}-enter-to`;return {enterFrom:t,enterActive:o,enterTo:r,leaveFrom:(u=e.leaveFromClass)!=null?u:`${n}-leave-from`,leaveActive:(f=e.leaveActiveClass)!=null?f:`${n}-leave-active`,leaveTo:(m=e.leaveToClass)!=null?m:`${n}-leave-to`,appearFrom:(T=e.appearFromClass)!=null?T:t,appearActive:(S=e.appearActiveClass)!=null?S:o,appearTo:(x=e.appearToClass)!=null?x:r}}var Gn=e=>e?e.endsWith("ms")?Number(e.slice(0,-2).replace(",",".")):Number(e.slice(0,-1).replace(",","."))*1e3:0;function Wn(e,n){let t=e.split(", "),o=n.split(", "),r=0;for(let[s,i]of o.entries()){let l=Gn(i)+Gn(t[s%t.length]||"0s");l>r&&(r=l);}return r}function qn(e,n){let t=getComputedStyle(e),o=n!=="animation"?Wn(t.transitionDelay,t.transitionDuration):0,r=n!=="transition"?Wn(t.animationDelay,t.animationDuration):0;return o===0&&r===0?null:o>=r?{event:"transitionend",timeout:o}:{event:"animationend",timeout:r}}function B(e,n){for(let t of n.split(/\s+/))t&&e.classList.add(t);}function j(e,n){for(let t of n.split(/\s+/))t&&e.classList.remove(t);}function ye(e){requestAnimationFrame(()=>requestAnimationFrame(e));}function Me(e){e.offsetHeight;}function le(e,n,t,o){if(t!=null){setTimeout(o,t);return}let r=qn(e,n);if(!r){o();return}let s=false,i=()=>{s||(s=true,e.removeEventListener(r.event,l),o());},l=()=>i();e.addEventListener(r.event,l),setTimeout(i,r.timeout+1);}function ae(e,n){return e==null?null:typeof e=="number"?e:e[n]}function zn(e){if(e==null||e===false)return null;if(Array.isArray(e))return e[0]instanceof Element?e[0]:null;if(e instanceof Element)return e;if($(e)){let n=e;if(n.scope==null){let o=document.createDocumentFragment();n.mount(o);}let t=n.firstChild;return t instanceof Element?t:null}return null}var Fe=Symbol("enter_cb"),pe=Symbol("leave_cb");function Xn(e){let n=document.createComment(""),t=rn(e),o=e.css!==false,r=On(e),s="idle",i=null,l=null,a=false,u,f=false,m=false,T=false,S=(d,C)=>{var h;let N=d[pe];N&&N(true),s="entering";let E=C==="appear"?t.appearFrom:t.enterFrom,v=C==="appear"?t.appearActive:t.enterActive,R=C==="appear"?t.appearTo:t.enterTo;(h=e.onBeforeEnter)==null||h.call(e,d),o&&(B(d,E),B(d,v));let O=false,c=p=>{var k,A;O||(O=true,d[Fe]=void 0,o&&(j(d,E),j(d,v),j(d,R)),p?(k=e.onEnterCancelled)==null||k.call(e,d):(s="entered",(A=e.onAfterEnter)==null||A.call(e,d)));};d[Fe]=c,ye(()=>{if(!O)if(o&&(j(d,E),B(d,R)),e.onEnter)e.onEnter(d,()=>c(false));else if(o){let p=ae(e.duration,"enter");le(d,e.type,p,()=>c(false));}else c(false);});},x=(d,C)=>{var c;let N=d[Fe];N&&(N(true),Me(d)),s="leaving",(c=e.onBeforeLeave)==null||c.call(e,d),o&&(B(d,t.leaveFrom),B(d,t.leaveActive));let E=false,v=h=>{var p,k;E||(E=true,d[pe]=void 0,o&&(j(d,t.leaveFrom),j(d,t.leaveActive),j(d,t.leaveTo)),h?(p=e.onLeaveCancelled)==null||p.call(e,d):(s="idle",C(),(k=e.onAfterLeave)==null||k.call(e,d)));};d[pe]=v;let R=ae(e.duration,"leave"),O=o&&!e.onLeave&&R==null?!!qn(d,e.type):false;if(!e.onLeave&&R==null&&!O){v(false);return}ye(()=>{E||(o&&(j(d,t.leaveFrom),B(d,t.leaveTo)),e.onLeave?e.onLeave(d,()=>v(false)):o?le(d,e.type,R,()=>v(false)):v(false));});},w=(d,C)=>{if(d&&s==="leaving"&&l){let E=l,v=E[pe];v&&v(true),l=null,i=E,S(E,"enter");return}if(d===i)return;let N=i;if(i=d,N){l=N;let E=N;x(E,()=>{E.parentNode&&E.parentNode.removeChild(E),l===E&&(l=null);});}d&&n.parentNode?(n.parentNode.insertBefore(d,n),C&&!e.appear?s="entered":S(d,C&&e.appear?"appear":"enter")):!N&&!d&&(s="idle");},b=()=>{if(m=false,T||!f)return;let d=u;f=false,u=void 0;try{w(zn(d),!1);}catch(C){}},L=d=>{u=d,f=true,!m&&(m=true,queueMicrotask(b));},y=signals.effect(()=>{let d=r();a?L(d):(u=d,f=true);});return J(()=>{a=!0;let d=f?zn(u):null;f=!1,u=void 0,w(d,!0);}),U(()=>{T=true,y.stop();for(let d of [i,l]){if(!d)continue;let C=d[Fe],N=d[pe];C==null||C(true),N==null||N(true),d.parentNode&&d.parentNode.removeChild(d);}i=null,l=null,s="idle";}),n}Xn[Ke]=true;function Ao(e){return !!e&&!!e[Ke]}function ln(e,n){if(e==null||e===false)return {el:null,comp:null};if(Array.isArray(e)&&e.length===1)return ln(e[0],n);if(shared.isFunction(e))return ln(e(),n);if(e instanceof HTMLElement)return {el:e,comp:null};if($(e)){let t=e;t.scope==null&&t.mount(n);let o=t.firstChild;return o instanceof HTMLElement?{el:o,comp:t}:{el:null,comp:t}}return {el:null,comp:null}}function ko(e){return {position:e.style.position,top:e.style.top,left:e.style.left,width:e.style.width,height:e.style.height}}function sn(e,n){e.style.position=n.position,e.style.top=n.top,e.style.left=n.left,e.style.width=n.width,e.style.height=n.height;}function Yn(e){var v,R,O;let n=(v=e.tag)!=null?v:"div",t=document.createElement(n),o=rn(e),r=e.css!==false,s=(O=e.moveClass)!=null?O:`${(R=e.name)!=null?R:"v"}-move`,i=e.key,l=e.children,a=Array.isArray(l)&&l.length===1&&shared.isFunction(l[0])?l[0]:e.children;if(!shared.isFunction(a)||!shared.isFunction(i))throw new TypeError("<TransitionGroup> requires `children: (item, index) => Node` and `key: (item, index) => unknown`");let u=()=>{var h,p;let c=e.each;return signals.isSignal(c)?(h=c.value)!=null?h:[]:shared.isFunction(c)?(p=c())!=null?p:[]:c!=null?c:[]},f=[],m=false,T=(c,h)=>{let p=D(),k=K(p),A;H(k,()=>{A=a(c,h);});let{el:_,comp:F}=ln(A,t);return _?{key:i(c,h),item:c,el:_,comp:F,scope:k,state:"entering"}:(I(k),null)},S=c=>{if(c.comp){for(let h of c.comp.renderedNodes)h.parentNode===t&&t.removeChild(h);return}c.el.parentNode===t&&t.removeChild(c.el);},x=c=>{var h,p;(h=c.cancelEnter)==null||h.call(c,true),(p=c.cancelLeave)==null||p.call(c,true),c.comp&&c.comp.destroy(),S(c),I(c.scope);},w=c=>{var A,_,F;let h=c.el;if((A=c.cancelLeave)==null||A.call(c,true),!r){c.state="present",(_=e.onAfterEnter)==null||_.call(e,h);return}(F=e.onBeforeEnter)==null||F.call(e,h),B(h,o.enterFrom),B(h,o.enterActive);let p=false,k=g=>{var P,V;p||(p=true,c.cancelEnter=void 0,j(h,o.enterFrom),j(h,o.enterActive),j(h,o.enterTo),g?(P=e.onEnterCancelled)==null||P.call(e,h):(c.state="present",(V=e.onAfterEnter)==null||V.call(e,h)));};c.cancelEnter=k,c.state="entering",ye(()=>{if(!p)if(j(h,o.enterFrom),B(h,o.enterTo),e.onEnter)e.onEnter(h,()=>k(false));else {let g=ae(e.duration,"enter");le(h,e.type,g,()=>k(false));}});},b=(c,h)=>{var F,g;let p=c.el;c.cancelEnter&&(c.cancelEnter(true),Me(p)),c.state="leaving",c.savedStyles=ko(p);let k=t.getBoundingClientRect();if(p.style.position="absolute",p.style.top=`${h.top-k.top}px`,p.style.left=`${h.left-k.left}px`,p.style.width=`${h.width}px`,p.style.height=`${h.height}px`,!r){c.savedStyles&&sn(p,c.savedStyles),S(c),I(c.scope),c.comp&&c.comp.destroy(),(F=e.onAfterLeave)==null||F.call(e,p);return}(g=e.onBeforeLeave)==null||g.call(e,p),B(p,o.leaveFrom),B(p,o.leaveActive);let A=false,_=P=>{var V,q;if(!A){if(A=true,c.cancelLeave=void 0,j(p,o.leaveFrom),j(p,o.leaveActive),j(p,o.leaveTo),P){c.savedStyles&&sn(p,c.savedStyles),c.savedStyles=void 0,(V=e.onLeaveCancelled)==null||V.call(e,p);return}c.savedStyles&&sn(p,c.savedStyles),c.savedStyles=void 0,S(c),I(c.scope),c.comp&&c.comp.destroy(),(q=e.onAfterLeave)==null||q.call(e,p);}};c.cancelLeave=_,ye(()=>{if(!A)if(j(p,o.leaveFrom),B(p,o.leaveTo),e.onLeave)e.onLeave(p,()=>_(false));else {let P=ae(e.duration,"leave");le(p,e.type,P,()=>_(false));}});},L=(c,h)=>{if(!r||c.state!=="present")return;let p=c.el,k=p.getBoundingClientRect(),A=h.left-k.left,_=h.top-k.top;if(!A&&!_)return;let F=p.style.transform,g=p.style.transitionDuration;p.style.transform=`translate(${A}px, ${_}px)`,p.style.transitionDuration="0s",B(p,s),Me(p),p.style.transform=F,p.style.transitionDuration=g;let P=ae(e.duration,"enter");le(p,e.type,P,()=>{j(p,s);});},y=()=>{for(let c of f)c.state!=="leaving"&&(c.prevRect=c.el.getBoundingClientRect());},d=c=>{let h=new Map;for(let _ of f)h.set(_.key,_);let p=[];for(let[_,F]of c.entries()){let g=i(F,_),P=h.get(g);if(P)h.delete(g),P.item=F,p.push(P);else {let V=T(F,_);V&&p.push(V);}}let k=[];for(let _ of h.values())_.state!=="leaving"&&k.push(_);let A=null;for(let _=p.length-1;_>=0;_--){let F=p[_].el;(F.parentNode!==t||F.nextSibling!==A)&&t.insertBefore(F,A),A=F;}return {next:p,leaving:k}},C=(c,h)=>{if(h){let A=[];for(let[_,F]of c.entries()){let g=T(F,_);g&&(g.el.parentNode!==t&&t.appendChild(g.el),g.state="present",A.push(g));}f=A;return}y();let{next:p,leaving:k}=d(c);for(let A of p)A.state!=="present"&&w(A);for(let A of k){let _=A.prevRect;_&&b(A,_);}for(let A of p)A.state!=="present"||!A.prevRect||(L(A,A.prevRect),A.prevRect=void 0);f=p.concat(k);},N=null,E=signals.effect(()=>{let c=u();if(!m){N=c;return}C(c,false);});return J(()=>{m=!0,N&&(C(N,!0),N=null);}),U(()=>{E.stop();for(let c of f)x(c);f=[],t.parentNode&&t.parentNode.removeChild(t);}),t}Yn[Ue]=true;function Po(e){return !!e&&!!e[Ue]}
|
|
2
|
+
exports.Component=ie;exports.For=Bn;exports.Fragment=Hn;exports.Portal=jn;exports.Suspense=Kn;exports.Transition=Xn;exports.TransitionGroup=Yn;exports.addEvent=re;exports.addEventListener=se;exports.beginHydration=qe;exports.bindElement=ro;exports.child=Lt;exports.clearDelegatedEvents=Bt;exports.consumeTeleportAnchor=We;exports.consumeTeleportBlock=ze;exports.createApp=jt;exports.createComponent=xe;exports.createResource=vo;exports.defineAsyncComponent=No;exports.delegateEvents=Ut;exports.endHydration=Xe;exports.getHydrationKey=gn;exports.getRenderedElement=At;exports.hydrate=$t;exports.hydrationAnchor=wt;exports.hydrationMarker=bt;exports.inject=de;exports.insert=W;exports.isComponent=$;exports.isFragment=lo;exports.isHydrating=oe;exports.isPortal=fo;exports.isSuspense=go;exports.isTransition=Ao;exports.isTransitionGroup=Po;exports.next=Ft;exports.normalizeClass=Se;exports.nthChild=Mt;exports.omitProps=io;exports.onDestroy=Ze;exports.onMount=J;exports.onUpdate=It;exports.patchAttr=Z;exports.patchAttrHydrate=xt;exports.patchClass=Ce;exports.patchClassHydrate=_t;exports.patchStyle=Te;exports.patchStyleHydrate=kt;exports.provide=en;exports.resetHydrationKey=Ct;exports.setStyle=ne;exports.template=be;
|
package/dist/template.d.cts
CHANGED
|
@@ -536,16 +536,20 @@ interface SuspenseProps {
|
|
|
536
536
|
key?: string;
|
|
537
537
|
}
|
|
538
538
|
/**
|
|
539
|
-
* Suspense
|
|
539
|
+
* Suspense — handles async content with a fallback UI.
|
|
540
540
|
*
|
|
541
|
-
*
|
|
542
|
-
*
|
|
541
|
+
* Rendering model: content is built offscreen into the Suspense fragment
|
|
542
|
+
* first. If async resources register during
|
|
543
|
+
* that mount, the content nodes are parked in an offscreen fragment while
|
|
544
|
+
* fallback is shown. When all resources settle, content is moved back in one
|
|
545
|
+
* step. No "insert → remove → re-insert" dance — content is moved at most once.
|
|
546
|
+
*
|
|
547
|
+
* Wrapper-free: the boundary is a `<!--suspense-->…<!--/suspense-->` comment
|
|
548
|
+
* pair, not a `display:contents` div.
|
|
543
549
|
*
|
|
544
550
|
* @example
|
|
545
551
|
* ```tsx
|
|
546
|
-
* <Suspense fallback={<div>Loading...</div>}>
|
|
547
|
-
* {asyncContent}
|
|
548
|
-
* </Suspense>
|
|
552
|
+
* <Suspense fallback={<div>Loading...</div>}>{asyncContent}</Suspense>
|
|
549
553
|
* ```
|
|
550
554
|
*/
|
|
551
555
|
declare function Suspense(props: SuspenseProps): Node;
|
|
@@ -596,74 +600,43 @@ interface AsyncComponentOptions {
|
|
|
596
600
|
error: Error;
|
|
597
601
|
retry: () => void;
|
|
598
602
|
}>;
|
|
599
|
-
/**
|
|
600
|
-
* Delay in ms before showing the `loading` component (default: 200).
|
|
601
|
-
*/
|
|
603
|
+
/** Delay in ms before showing the `loading` component (default: 200). */
|
|
602
604
|
delay?: number;
|
|
603
|
-
/**
|
|
604
|
-
* Timeout in ms. If loading exceeds this, the error component is shown.
|
|
605
|
-
*/
|
|
605
|
+
/** Timeout in ms. If loading exceeds this, the error component is shown. */
|
|
606
606
|
timeout?: number;
|
|
607
607
|
/**
|
|
608
608
|
* SSR rendering strategy (default: `'blocking'`).
|
|
609
609
|
*
|
|
610
610
|
* - `'blocking'` — Pre-calls the loader at definition time. If the module
|
|
611
|
-
* resolves before the component body runs
|
|
612
|
-
* `renderToStringAsync`), the real component is inlined in the HTML.
|
|
611
|
+
* resolves before the component body runs, the real component is inlined.
|
|
613
612
|
* - `'client-only'` — Renders `null` on the server; loads only in browser.
|
|
614
613
|
*/
|
|
615
614
|
ssr?: 'blocking' | 'client-only';
|
|
616
|
-
/**
|
|
617
|
-
* Called when loading fails. Useful for logging or error tracking.
|
|
618
|
-
*/
|
|
615
|
+
/** Called when loading fails. Useful for logging or error tracking. */
|
|
619
616
|
onError?: (error: Error, retry: () => void) => void;
|
|
620
617
|
}
|
|
621
618
|
type LoaderResult<P> = {
|
|
622
619
|
default: ComponentFn<P>;
|
|
623
620
|
} | ComponentFn<P>;
|
|
621
|
+
type Loader<P> = () => Promise<LoaderResult<P>>;
|
|
624
622
|
/**
|
|
625
|
-
* Define an async (lazy-loaded) component.
|
|
626
|
-
*
|
|
627
|
-
* Compatible with client, SSR, and SSG. Integrates with `<Suspense>` via
|
|
628
|
-
* `SuspenseContext` when rendered inside a Suspense boundary.
|
|
629
|
-
*
|
|
623
|
+
* Define an async (lazy-loaded) component. Works on client, SSR, and SSG, and
|
|
624
|
+
* integrates with `<Suspense>` via `SuspenseContext` when nested in a boundary.
|
|
630
625
|
*
|
|
631
626
|
* @param loader - The async loader function.
|
|
632
627
|
* @param options - Configuration options.
|
|
633
|
-
* @returns {ComponentFn<P>} The async component wrapper function.
|
|
634
628
|
*
|
|
635
629
|
* @example
|
|
636
630
|
* ```tsx
|
|
637
|
-
*
|
|
638
|
-
*
|
|
639
|
-
*
|
|
640
|
-
*
|
|
641
|
-
*
|
|
642
|
-
*
|
|
643
|
-
* {
|
|
644
|
-
* loading: () => <Spinner />,
|
|
645
|
-
* error: ({ error, retry }) => (
|
|
646
|
-
* <div>
|
|
647
|
-
* <p>{error.message}</p>
|
|
648
|
-
* <button onClick={retry}>Retry</button>
|
|
649
|
-
* </div>
|
|
650
|
-
* ),
|
|
651
|
-
* delay: 200,
|
|
652
|
-
* timeout: 10_000,
|
|
653
|
-
* }
|
|
654
|
-
* );
|
|
655
|
-
*
|
|
656
|
-
* // Works standalone or inside Suspense
|
|
657
|
-
* function App() {
|
|
658
|
-
* return (
|
|
659
|
-
* <Suspense fallback={<div>Loading…</div>}>
|
|
660
|
-
* <Chart data={data} />
|
|
661
|
-
* </Suspense>
|
|
662
|
-
* );
|
|
663
|
-
* }
|
|
631
|
+
* const Chart = defineAsyncComponent(() => import('./Chart'), {
|
|
632
|
+
* loading: () => <Spinner />,
|
|
633
|
+
* error: ({ error, retry }) => <button onClick={retry}>{error.message}</button>,
|
|
634
|
+
* delay: 200,
|
|
635
|
+
* timeout: 10_000,
|
|
636
|
+
* });
|
|
664
637
|
* ```
|
|
665
638
|
*/
|
|
666
|
-
declare function defineAsyncComponent<P extends ComponentProps = ComponentProps>(loader:
|
|
639
|
+
declare function defineAsyncComponent<P extends ComponentProps = ComponentProps>(loader: Loader<P>, options?: AsyncComponentOptions): ComponentFn<P>;
|
|
667
640
|
|
|
668
641
|
interface ForProps<T> {
|
|
669
642
|
each: T[] | Signal<T[]> | (() => T[]);
|
|
@@ -772,4 +745,4 @@ declare function TransitionGroup<T>(props: TransitionGroupProps<T>): Element;
|
|
|
772
745
|
*/
|
|
773
746
|
declare function isTransitionGroup(node: unknown): boolean;
|
|
774
747
|
|
|
775
|
-
export { type AppInstance, type AsyncComponentOptions, Component, type ComponentFn, type ComponentProps, For, Fragment, Portal, Suspense, Transition, TransitionGroup, type TransitionGroupProps, type TransitionProps, addEvent, addEventListener, beginHydration, bindElement, child, clearDelegatedEvents, consumeTeleportAnchor, consumeTeleportBlock, createApp, createComponent, createResource, defineAsyncComponent, delegateEvents, endHydration, getHydrationKey, getRenderedElement, hydrate, hydrationAnchor, hydrationMarker, insert, isComponent, isFragment, isHydrating, isPortal, isSuspense, isTransition, isTransitionGroup, next, normalizeClass, nthChild, omitProps, onDestroy, onMount, onUpdate, patchAttr, patchAttrHydrate, patchClass, patchClassHydrate, patchStyle, patchStyleHydrate, resetHydrationKey, setStyle, template };
|
|
748
|
+
export { type AppInstance, type AsyncComponentOptions, type BindModifiers, Component, type ComponentFn, type ComponentProps, For, Fragment, Portal, Suspense, Transition, TransitionGroup, type TransitionGroupProps, type TransitionProps, addEvent, addEventListener, beginHydration, bindElement, child, clearDelegatedEvents, consumeTeleportAnchor, consumeTeleportBlock, createApp, createComponent, createResource, defineAsyncComponent, delegateEvents, endHydration, getHydrationKey, getRenderedElement, hydrate, hydrationAnchor, hydrationMarker, insert, isComponent, isFragment, isHydrating, isPortal, isSuspense, isTransition, isTransitionGroup, next, normalizeClass, nthChild, omitProps, onDestroy, onMount, onUpdate, patchAttr, patchAttrHydrate, patchClass, patchClassHydrate, patchStyle, patchStyleHydrate, resetHydrationKey, setStyle, template };
|
package/dist/template.d.ts
CHANGED
|
@@ -536,16 +536,20 @@ interface SuspenseProps {
|
|
|
536
536
|
key?: string;
|
|
537
537
|
}
|
|
538
538
|
/**
|
|
539
|
-
* Suspense
|
|
539
|
+
* Suspense — handles async content with a fallback UI.
|
|
540
540
|
*
|
|
541
|
-
*
|
|
542
|
-
*
|
|
541
|
+
* Rendering model: content is built offscreen into the Suspense fragment
|
|
542
|
+
* first. If async resources register during
|
|
543
|
+
* that mount, the content nodes are parked in an offscreen fragment while
|
|
544
|
+
* fallback is shown. When all resources settle, content is moved back in one
|
|
545
|
+
* step. No "insert → remove → re-insert" dance — content is moved at most once.
|
|
546
|
+
*
|
|
547
|
+
* Wrapper-free: the boundary is a `<!--suspense-->…<!--/suspense-->` comment
|
|
548
|
+
* pair, not a `display:contents` div.
|
|
543
549
|
*
|
|
544
550
|
* @example
|
|
545
551
|
* ```tsx
|
|
546
|
-
* <Suspense fallback={<div>Loading...</div>}>
|
|
547
|
-
* {asyncContent}
|
|
548
|
-
* </Suspense>
|
|
552
|
+
* <Suspense fallback={<div>Loading...</div>}>{asyncContent}</Suspense>
|
|
549
553
|
* ```
|
|
550
554
|
*/
|
|
551
555
|
declare function Suspense(props: SuspenseProps): Node;
|
|
@@ -596,74 +600,43 @@ interface AsyncComponentOptions {
|
|
|
596
600
|
error: Error;
|
|
597
601
|
retry: () => void;
|
|
598
602
|
}>;
|
|
599
|
-
/**
|
|
600
|
-
* Delay in ms before showing the `loading` component (default: 200).
|
|
601
|
-
*/
|
|
603
|
+
/** Delay in ms before showing the `loading` component (default: 200). */
|
|
602
604
|
delay?: number;
|
|
603
|
-
/**
|
|
604
|
-
* Timeout in ms. If loading exceeds this, the error component is shown.
|
|
605
|
-
*/
|
|
605
|
+
/** Timeout in ms. If loading exceeds this, the error component is shown. */
|
|
606
606
|
timeout?: number;
|
|
607
607
|
/**
|
|
608
608
|
* SSR rendering strategy (default: `'blocking'`).
|
|
609
609
|
*
|
|
610
610
|
* - `'blocking'` — Pre-calls the loader at definition time. If the module
|
|
611
|
-
* resolves before the component body runs
|
|
612
|
-
* `renderToStringAsync`), the real component is inlined in the HTML.
|
|
611
|
+
* resolves before the component body runs, the real component is inlined.
|
|
613
612
|
* - `'client-only'` — Renders `null` on the server; loads only in browser.
|
|
614
613
|
*/
|
|
615
614
|
ssr?: 'blocking' | 'client-only';
|
|
616
|
-
/**
|
|
617
|
-
* Called when loading fails. Useful for logging or error tracking.
|
|
618
|
-
*/
|
|
615
|
+
/** Called when loading fails. Useful for logging or error tracking. */
|
|
619
616
|
onError?: (error: Error, retry: () => void) => void;
|
|
620
617
|
}
|
|
621
618
|
type LoaderResult<P> = {
|
|
622
619
|
default: ComponentFn<P>;
|
|
623
620
|
} | ComponentFn<P>;
|
|
621
|
+
type Loader<P> = () => Promise<LoaderResult<P>>;
|
|
624
622
|
/**
|
|
625
|
-
* Define an async (lazy-loaded) component.
|
|
626
|
-
*
|
|
627
|
-
* Compatible with client, SSR, and SSG. Integrates with `<Suspense>` via
|
|
628
|
-
* `SuspenseContext` when rendered inside a Suspense boundary.
|
|
629
|
-
*
|
|
623
|
+
* Define an async (lazy-loaded) component. Works on client, SSR, and SSG, and
|
|
624
|
+
* integrates with `<Suspense>` via `SuspenseContext` when nested in a boundary.
|
|
630
625
|
*
|
|
631
626
|
* @param loader - The async loader function.
|
|
632
627
|
* @param options - Configuration options.
|
|
633
|
-
* @returns {ComponentFn<P>} The async component wrapper function.
|
|
634
628
|
*
|
|
635
629
|
* @example
|
|
636
630
|
* ```tsx
|
|
637
|
-
*
|
|
638
|
-
*
|
|
639
|
-
*
|
|
640
|
-
*
|
|
641
|
-
*
|
|
642
|
-
*
|
|
643
|
-
* {
|
|
644
|
-
* loading: () => <Spinner />,
|
|
645
|
-
* error: ({ error, retry }) => (
|
|
646
|
-
* <div>
|
|
647
|
-
* <p>{error.message}</p>
|
|
648
|
-
* <button onClick={retry}>Retry</button>
|
|
649
|
-
* </div>
|
|
650
|
-
* ),
|
|
651
|
-
* delay: 200,
|
|
652
|
-
* timeout: 10_000,
|
|
653
|
-
* }
|
|
654
|
-
* );
|
|
655
|
-
*
|
|
656
|
-
* // Works standalone or inside Suspense
|
|
657
|
-
* function App() {
|
|
658
|
-
* return (
|
|
659
|
-
* <Suspense fallback={<div>Loading…</div>}>
|
|
660
|
-
* <Chart data={data} />
|
|
661
|
-
* </Suspense>
|
|
662
|
-
* );
|
|
663
|
-
* }
|
|
631
|
+
* const Chart = defineAsyncComponent(() => import('./Chart'), {
|
|
632
|
+
* loading: () => <Spinner />,
|
|
633
|
+
* error: ({ error, retry }) => <button onClick={retry}>{error.message}</button>,
|
|
634
|
+
* delay: 200,
|
|
635
|
+
* timeout: 10_000,
|
|
636
|
+
* });
|
|
664
637
|
* ```
|
|
665
638
|
*/
|
|
666
|
-
declare function defineAsyncComponent<P extends ComponentProps = ComponentProps>(loader:
|
|
639
|
+
declare function defineAsyncComponent<P extends ComponentProps = ComponentProps>(loader: Loader<P>, options?: AsyncComponentOptions): ComponentFn<P>;
|
|
667
640
|
|
|
668
641
|
interface ForProps<T> {
|
|
669
642
|
each: T[] | Signal<T[]> | (() => T[]);
|
|
@@ -772,4 +745,4 @@ declare function TransitionGroup<T>(props: TransitionGroupProps<T>): Element;
|
|
|
772
745
|
*/
|
|
773
746
|
declare function isTransitionGroup(node: unknown): boolean;
|
|
774
747
|
|
|
775
|
-
export { type AppInstance, type AsyncComponentOptions, Component, type ComponentFn, type ComponentProps, For, Fragment, Portal, Suspense, Transition, TransitionGroup, type TransitionGroupProps, type TransitionProps, addEvent, addEventListener, beginHydration, bindElement, child, clearDelegatedEvents, consumeTeleportAnchor, consumeTeleportBlock, createApp, createComponent, createResource, defineAsyncComponent, delegateEvents, endHydration, getHydrationKey, getRenderedElement, hydrate, hydrationAnchor, hydrationMarker, insert, isComponent, isFragment, isHydrating, isPortal, isSuspense, isTransition, isTransitionGroup, next, normalizeClass, nthChild, omitProps, onDestroy, onMount, onUpdate, patchAttr, patchAttrHydrate, patchClass, patchClassHydrate, patchStyle, patchStyleHydrate, resetHydrationKey, setStyle, template };
|
|
748
|
+
export { type AppInstance, type AsyncComponentOptions, type BindModifiers, Component, type ComponentFn, type ComponentProps, For, Fragment, Portal, Suspense, Transition, TransitionGroup, type TransitionGroupProps, type TransitionProps, addEvent, addEventListener, beginHydration, bindElement, child, clearDelegatedEvents, consumeTeleportAnchor, consumeTeleportBlock, createApp, createComponent, createResource, defineAsyncComponent, delegateEvents, endHydration, getHydrationKey, getRenderedElement, hydrate, hydrationAnchor, hydrationMarker, insert, isComponent, isFragment, isHydrating, isPortal, isSuspense, isTransition, isTransitionGroup, next, normalizeClass, nthChild, omitProps, onDestroy, onMount, onUpdate, patchAttr, patchAttrHydrate, patchClass, patchClassHydrate, patchStyle, patchStyleHydrate, resetHydrationKey, setStyle, template };
|