@estjs/template 0.0.16-beta.7 → 0.0.16-beta.9
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-GXUTKBCN.js +1 -0
- package/dist/{chunk-OEKE4VTS.dev.esm.js → chunk-W5LMSADN.dev.js} +37 -27
- package/dist/chunk-W5LMSADN.dev.js.map +1 -0
- package/dist/internal.cjs +1 -0
- package/dist/{internal.dev.cjs.js → internal.dev.cjs} +23 -26
- package/dist/internal.dev.cjs.map +1 -0
- package/dist/internal.dev.js +3 -0
- package/dist/{internal.dev.esm.js.map → internal.dev.js.map} +1 -1
- package/dist/internal.js +1 -0
- package/dist/template.cjs +2 -0
- package/dist/template.d.cts +203 -64
- package/dist/template.d.ts +203 -64
- package/dist/{template.dev.cjs.js → template.dev.cjs} +1094 -201
- package/dist/template.dev.cjs.map +1 -0
- package/dist/{template.dev.esm.js → template.dev.js} +1050 -177
- package/dist/template.dev.js.map +1 -0
- package/dist/template.js +2 -0
- package/package.json +21 -22
- package/dist/chunk-IA4OZ7NW.esm.js +0 -1
- package/dist/chunk-OEKE4VTS.dev.esm.js.map +0 -1
- package/dist/internal.cjs.js +0 -1
- package/dist/internal.dev.cjs.js.map +0 -1
- package/dist/internal.dev.esm.js +0 -3
- package/dist/internal.esm.js +0 -1
- package/dist/template.cjs.js +0 -2
- package/dist/template.dev.cjs.js.map +0 -1
- package/dist/template.dev.esm.js.map +0 -1
- package/dist/template.esm.js +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import'@estjs/shared';import {setCurrentScope,effectScope}from'@estjs/signals';var s=Object.defineProperty;var u=Object.getOwnPropertySymbols;var a=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable;var p=(e,r,n)=>r in e?s(e,r,{enumerable:true,configurable:true,writable:true,value:n}):e[r]=n,x=(e,r)=>{for(var n in r||(r={}))a.call(r,n)&&p(e,n,r[n]);if(u)for(var n of u(r))S.call(r,n)&&p(e,n,r[n]);return e};var E=(e,r)=>{var n={};for(var o in e)a.call(e,o)&&r.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&u)for(var o of u(e))r.indexOf(o)<0&&S.call(e,o)&&(n[o]=e[o]);return n};var b=(e,r,n)=>new Promise((o,i)=>{var v=l=>{try{d(n.next(l));}catch(f){i(f);}},h=l=>{try{d(n.throw(l));}catch(f){i(f);}},d=l=>l.done?o(l.value):Promise.resolve(l.value).then(v,h);d((n=n.apply(e,r)).next());});var t=null,m=0;function C(){return t}function c(e){t=e,setCurrentScope(e==null?void 0:e.effectScope);}function I(e=t){let r=e?e.effectScope.run(()=>effectScope()):effectScope(true),n={id:++m,effectScope:r,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(n)),n}function P(e,r){let n=t;c(e);try{return e.effectScope.run(r)}finally{c(n);}}function D(e){var n;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,D(o));e.children.clear();}let r=t;if(c(e),e.onDestroy){for(let o=0;o<e.onDestroy.length;o++)try{e.onDestroy[o]();}catch(i){}e.onDestroy=null;}if(e.cleanup){for(let o=0;o<e.cleanup.length;o++)try{e.cleanup[o]();}catch(i){}e.cleanup=null;}c(r),e.effectScope.stop(),(n=e.parent)!=null&&n.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 U(e){let r=t;r&&(r.cleanup||(r.cleanup=[]),r.cleanup.push(e));}export{x as a,E as b,b as c,C as d,c as e,I as f,P as g,D as h,U as i};
|
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
import { error } from '@estjs/shared';
|
|
2
2
|
import { setCurrentScope, effectScope } from '@estjs/signals';
|
|
3
3
|
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
7
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __spreadValues = (a, b) => {
|
|
10
|
+
for (var prop in b || (b = {}))
|
|
11
|
+
if (__hasOwnProp.call(b, prop))
|
|
12
|
+
__defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols)
|
|
14
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
+
if (__propIsEnum.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
}
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
7
20
|
var __objRest = (source, exclude) => {
|
|
8
21
|
var target = {};
|
|
9
22
|
for (var prop in source)
|
|
@@ -76,11 +89,11 @@ function createScope(parent = activeScope) {
|
|
|
76
89
|
}
|
|
77
90
|
function runWithScope(scope, fn) {
|
|
78
91
|
const prevScope = activeScope;
|
|
79
|
-
|
|
92
|
+
setActiveScope(scope);
|
|
80
93
|
try {
|
|
81
94
|
return scope.effectScope.run(fn);
|
|
82
95
|
} finally {
|
|
83
|
-
|
|
96
|
+
setActiveScope(prevScope);
|
|
84
97
|
}
|
|
85
98
|
}
|
|
86
99
|
function disposeScope(scope) {
|
|
@@ -98,32 +111,29 @@ function disposeScope(scope) {
|
|
|
98
111
|
}
|
|
99
112
|
scope.children.clear();
|
|
100
113
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
}
|
|
114
|
+
const prevScope = activeScope;
|
|
115
|
+
setActiveScope(scope);
|
|
116
|
+
if (scope.onDestroy) {
|
|
117
|
+
for (let i = 0; i < scope.onDestroy.length; i++) {
|
|
118
|
+
try {
|
|
119
|
+
scope.onDestroy[i]();
|
|
120
|
+
} catch (error_) {
|
|
121
|
+
error(`Scope(${scope.id}): Error in destroy hook:`, error_);
|
|
111
122
|
}
|
|
112
|
-
scope.onDestroy = null;
|
|
113
123
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
124
|
+
scope.onDestroy = null;
|
|
125
|
+
}
|
|
126
|
+
if (scope.cleanup) {
|
|
127
|
+
for (let i = 0; i < scope.cleanup.length; i++) {
|
|
128
|
+
try {
|
|
129
|
+
scope.cleanup[i]();
|
|
130
|
+
} catch (error_) {
|
|
131
|
+
error(`Scope(${scope.id}): Error in cleanup:`, error_);
|
|
123
132
|
}
|
|
124
|
-
scope.cleanup = null;
|
|
125
133
|
}
|
|
126
|
-
|
|
134
|
+
scope.cleanup = null;
|
|
135
|
+
}
|
|
136
|
+
setActiveScope(prevScope);
|
|
127
137
|
scope.effectScope.stop();
|
|
128
138
|
if ((_a = scope.parent) == null ? void 0 : _a.children) {
|
|
129
139
|
scope.parent.children.delete(scope);
|
|
@@ -151,6 +161,6 @@ function onCleanup(fn) {
|
|
|
151
161
|
scope.cleanup.push(fn);
|
|
152
162
|
}
|
|
153
163
|
|
|
154
|
-
export { __async, __objRest, createScope, disposeScope, getActiveScope, onCleanup, runWithScope, setActiveScope };
|
|
155
|
-
//# sourceMappingURL=chunk-
|
|
156
|
-
//# sourceMappingURL=chunk-
|
|
164
|
+
export { __async, __objRest, __spreadValues, createScope, disposeScope, getActiveScope, onCleanup, runWithScope, setActiveScope };
|
|
165
|
+
//# sourceMappingURL=chunk-W5LMSADN.dev.js.map
|
|
166
|
+
//# sourceMappingURL=chunk-W5LMSADN.dev.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/scope.ts"],"names":[],"mappings":";;;;;;;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{ 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 // Dispose children first (depth-first)\n // Iterate directly safely by unlinking parent reference to prevent mutation during iteration\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 // Remove from parent's children\n if (scope.parent?.children) {\n scope.parent.children.delete(scope);\n }\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 // Break parent reference to prevent memory leaks\n scope.parent = 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"]}
|
|
@@ -0,0 +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(),(o=e.parent)!=null&&o.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;}exports.createScope=a;exports.disposeScope=c;exports.getActiveScope=S;exports.runWithScope=y;exports.setActiveScope=t;
|
|
@@ -44,11 +44,11 @@ function createScope(parent = activeScope) {
|
|
|
44
44
|
}
|
|
45
45
|
function runWithScope(scope, fn) {
|
|
46
46
|
const prevScope = activeScope;
|
|
47
|
-
|
|
47
|
+
setActiveScope(scope);
|
|
48
48
|
try {
|
|
49
49
|
return scope.effectScope.run(fn);
|
|
50
50
|
} finally {
|
|
51
|
-
|
|
51
|
+
setActiveScope(prevScope);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
function disposeScope(scope) {
|
|
@@ -66,32 +66,29 @@ function disposeScope(scope) {
|
|
|
66
66
|
}
|
|
67
67
|
scope.children.clear();
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
}
|
|
69
|
+
const prevScope = activeScope;
|
|
70
|
+
setActiveScope(scope);
|
|
71
|
+
if (scope.onDestroy) {
|
|
72
|
+
for (let i = 0; i < scope.onDestroy.length; i++) {
|
|
73
|
+
try {
|
|
74
|
+
scope.onDestroy[i]();
|
|
75
|
+
} catch (error_) {
|
|
76
|
+
shared.error(`Scope(${scope.id}): Error in destroy hook:`, error_);
|
|
79
77
|
}
|
|
80
|
-
scope.onDestroy = null;
|
|
81
78
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
79
|
+
scope.onDestroy = null;
|
|
80
|
+
}
|
|
81
|
+
if (scope.cleanup) {
|
|
82
|
+
for (let i = 0; i < scope.cleanup.length; i++) {
|
|
83
|
+
try {
|
|
84
|
+
scope.cleanup[i]();
|
|
85
|
+
} catch (error_) {
|
|
86
|
+
shared.error(`Scope(${scope.id}): Error in cleanup:`, error_);
|
|
91
87
|
}
|
|
92
|
-
scope.cleanup = null;
|
|
93
88
|
}
|
|
94
|
-
|
|
89
|
+
scope.cleanup = null;
|
|
90
|
+
}
|
|
91
|
+
setActiveScope(prevScope);
|
|
95
92
|
scope.effectScope.stop();
|
|
96
93
|
if ((_a = scope.parent) == null ? void 0 : _a.children) {
|
|
97
94
|
scope.parent.children.delete(scope);
|
|
@@ -111,5 +108,5 @@ exports.disposeScope = disposeScope;
|
|
|
111
108
|
exports.getActiveScope = getActiveScope;
|
|
112
109
|
exports.runWithScope = runWithScope;
|
|
113
110
|
exports.setActiveScope = setActiveScope;
|
|
114
|
-
//# sourceMappingURL=internal.dev.cjs.
|
|
115
|
-
//# sourceMappingURL=internal.dev.cjs.
|
|
111
|
+
//# sourceMappingURL=internal.dev.cjs.map
|
|
112
|
+
//# sourceMappingURL=internal.dev.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/scope.ts"],"names":["setCurrentScope","effectScope","error"],"mappings":";;;;;;AA4CA,IAAI,WAAA,GAA4B,IAAA;AAGhC,IAAI,OAAA,GAAU,CAAA;AAOP,SAAS,cAAA,GAA+B;AAC7C,EAAA,OAAO,WAAA;AACT;AAQO,SAAS,eAAe,KAAA,EAA2B;AACxD,EAAA,WAAA,GAAc,KAAA;AACd,EAAAA,uBAAA,CAAgB,+BAAO,WAAW,CAAA;AACpC;AASO,SAAS,WAAA,CAAY,SAAuB,WAAA,EAAoB;AACrE,EAAA,MAAM,aAAA,GAAgB,MAAA,GAAS,MAAA,CAAO,WAAA,CAAY,GAAA,CAAI,MAAMC,mBAAA,EAAa,CAAA,GAAKA,mBAAA,CAAY,IAAI,CAAA;AAC9F,EAAA,MAAM,KAAA,GAAe;AAAA,IACnB,IAAI,EAAE,OAAA;AAAA,IACN,WAAA,EAAa,aAAA;AAAA,IACb,MAAA;AAAA,IACA,QAAA,EAAU,IAAA;AAAA;AAAA,IACV,QAAA,EAAU,IAAA;AAAA;AAAA,IACV,OAAA,EAAS,IAAA;AAAA;AAAA,IACT,OAAA,E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AAA,GAAU,IAAA;AAChB,EAAA,KAAA,CAAM,QAAA,GAAW,IAAA;AACjB,EAAA,KAAA,CAAM,QAAA,GAAW,IAAA;AAGjB,EAAA,KAAA,CAAM,MAAA,GAAS,IAAA;AACjB","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 // Dispose children first (depth-first)\n // Iterate directly safely by unlinking parent reference to prevent mutation during iteration\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 // Remove from parent's children\n if (scope.parent?.children) {\n scope.parent.children.delete(scope);\n }\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 // Break parent reference to prevent memory leaks\n scope.parent = 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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"internal.dev.
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"internal.dev.js"}
|
package/dist/internal.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{f as createScope,h as disposeScope,d as getActiveScope,g as runWithScope,e as setActiveScope}from'./chunk-GXUTKBCN.js';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var shared=require('@estjs/shared'),signals=require('@estjs/signals');var st=Object.defineProperty;var Ee=Object.getOwnPropertySymbols;var mn=Object.prototype.hasOwnProperty,pn=Object.prototype.propertyIsEnumerable;var dn=(e,n,t)=>n in e?st(e,n,{enumerable:true,configurable:true,writable:true,value:t}):e[n]=t,yn=(e,n)=>{for(var t in n||(n={}))mn.call(n,t)&&dn(e,t,n[t]);if(Ee)for(var t of Ee(n))pn.call(n,t)&&dn(e,t,n[t]);return e};var hn=(e,n)=>{var t={};for(var o in e)mn.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(e!=null&&Ee)for(var o of Ee(e))n.indexOf(o)<0&&pn.call(e,o)&&(t[o]=e[o]);return t};var Ve=(e,n,t)=>new Promise((o,r)=>{var a=c=>{try{s(t.next(c));}catch(u){r(u);}},l=c=>{try{s(t.throw(c));}catch(u){r(u);}},s=c=>c.done?o(c.value):Promise.resolve(c.value).then(a,l);s((t=t.apply(e,n)).next());});var gn="ref",vn="key",En="http://www.w3.org/2000/svg",je="http://www.w3.org/2000/xlink",$e="http://www.w3.org/2000/xmlns/";var Ke=Symbol(""),de=Symbol(""),Be=Symbol(""),Cn=Symbol(""),Ue=Symbol(""),Ge=Symbol("");var Z=null,at=0;function M(){return Z}function Ne(e){Z=e,signals.setCurrentScope(e==null?void 0:e.effectScope);}function z(e=Z){let n=e?e.effectScope.run(()=>signals.effectScope()):signals.effectScope(true),t={id:++at,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 O(e,n){let t=Z;Ne(e);try{return e.effectScope.run(n)}finally{Ne(t);}}function j(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,j(o));e.children.clear();}let n=Z;if(Ne(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;}Ne(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 H(e){let n=Z;n&&(n.cleanup||(n.cleanup=[]),n.cleanup.push(e));}function ee(e,n,t,o){if(n===vn){o==null?e.removeAttribute(n):e.setAttribute(n,String(o));return}if(n===shared.SPREAD_NAME){let y=shared.isObject(t)?t:null,h=shared.isObject(o)?o:null;if(y)for(let N in y)N!==shared.SPREAD_NAME&&(!h||!(N in h))&&ee(e,N,y[N],null);if(h)for(let N in h)N!==shared.SPREAD_NAME&&ee(e,N,y==null?void 0:y[N],h[N]);return}let r=(e==null?void 0:e.namespaceURI)===En,a=r&&shared.startsWith(n,"xlink:"),l=r&&shared.startsWith(n,"xmlns:"),s=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(a)e.removeAttributeNS(je,n.slice(6));else if(l){let y=n.slice(6);e.removeAttributeNS($e,y);}else e.removeAttribute(n);return}if(s){shared.includeBooleanAttr(o)?e.setAttribute(n,""):e.removeAttribute(n);return}let u=shared.isSymbol(o)?String(o):o;if((c==="href"||c==="src"||c==="xlink:href"||c==="action"||c==="formaction"||c==="poster")&&shared.isString(u)){let y=u.trim().toLowerCase();if(shared.startsWith(y,"javascript:")||shared.startsWith(y,"data:"))return}if(a){e.setAttributeNS(je,n,String(u));return}if(l){e.setAttributeNS($e,n,String(u));return}if(r)e.setAttribute(n,String(u));else if(n in e)try{e[n]=u;}catch(y){e.setAttribute(n,String(u));}else e.setAttribute(n,String(u));}function Ae(e,n,t,o=false){if(n===t)return;let r=Te(t);if(!r){e.removeAttribute("class");return}(shared.isString(n)?n:Te(n))!==r&&(o?e.setAttribute("class",r):e.className=r);}var Te=shared.normalizeClassName;var Tn=/\s*!important$/,Nt=["Webkit","Moz","ms"],ze={};function we(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 a in r)(!t||t[a]==null)&&te(o,a,"");}else if(n&&shared.isString(n)){let r=/(?:^|;)\s*([a-z][a-z\d-]*)\s*:/gi,a;for(;(a=r.exec(n))!==null;){let l=a[1].trim();l&&t&&shared.isObject(t)&&t[l]==null&&te(o,l,"");}}if(t&&!shared.isString(t)){let r=t;for(let a in r){let l=r[a];(!n||shared.isString(n)||n[a]!==l)&&l!=null&&te(o,a,l);}}}function te(e,n,t){if(shared.isArray(t)){for(let a of t)te(e,n,a);return}(t==null||t==="")&&(t="");let o=shared.isString(t)&&Tn.test(t)?"important":"";if(o&&(t=t.replace(Tn,"")),shared.startsWith(n,"--")){o?e.setProperty(n,t,o):e.setProperty(n,t);return}let r=Tt(e,n);o?e.setProperty(St(r),t,o):e[r]=t;}function St(e){let n=shared.kebabCase(e);return shared.startsWith(e,"Webkit")||shared.startsWith(e,"Moz")||shared.startsWith(e,"ms")?`-${n}`:n}function Tt(e,n){let t=ze[n];if(t)return t;let o=shared.camelCase(n);if(o!=="filter"&&o in e)return ze[n]=o;o=shared.capitalize(o);for(let r of Nt){let a=r+o;if(a in e)return ze[n]=a}return n}var We=0;function An(){return String(We++)}function _t(){We=0;}var W=false;function re(){return W}var oe=new Map;function xt(e){let n=e.querySelectorAll("[data-hk]");for(let t of n){let o=t.dataset.hk;o!=null&&!oe.has(o)&&oe.set(o,t);}}var xe=[],me=new Map;function Pt(){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")xe.push(n);else if(t==="teleport-start"){let o=n.parentElement;if(!o)continue;let r=me.get(o);r||(r=[],me.set(o,r)),r.push(n);}}}function qe(){var e;return (e=xe.shift())!=null?e:null}function Xe(e){let n=me.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 Ye(e){W=true,We=0,oe.clear(),xe.length=0,me.clear(),xt(e),Pt();}function Je(){W=false,oe.clear(),xe.length=0,me.clear();}function bn(e,n,t){var a,l;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 s=n.length-1;s>=0;s--){if(!r)return null;let c=n[s],u=c.nodeType;if(u===Node.TEXT_NODE){let f=(a=c.textContent)!=null?a:"";if(!f||r.nodeType!==Node.TEXT_NODE)return null;let y=(l=r.textContent)!=null?l:"";if(y===f){o[s]=r,r=r.previousSibling;continue}if(!y.endsWith(f))return null;let h=y.slice(0,y.length-f.length);if(!h)return null;let N=document.createTextNode(h);e.insertBefore(N,r),r.textContent=f,o[s]=r,r=N;continue}if(r.nodeType!==u)return null;if(u===Node.ELEMENT_NODE){if(r.tagName!==c.tagName)return null}else if(u===Node.COMMENT_NODE&&r.data!==c.data)return null;o[s]=r,r=r.previousSibling;}return o}function wn(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 kt(e,n){if(!W||!e||n<0)return null;let t=e instanceof Element?wn(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 Rt(e,n){if(!W||!(e instanceof Element)||n<0)return null;let t=wn(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 Dt(e){if(!shared.isBrowser())return ()=>{throw new Error("[essor] getRenderedElement called in non-browser environment")};let n=null;return ()=>{if(!W)return n||(n=_e(e)),n();let t=An(),o=oe.get(t);return o?(oe.delete(t),o):(shared.warn(`[essor] hydration mismatch: no SSR element for key "${t}"`),n||(n=_e(e)),n())}}function Lt(e,n,t,o){W||Ae(e,n,t,o);}function Ft(e,n,t,o){W||ee(e,n,t,o);}function It(e,n,t){W||we(e,n,t);}function Qe(e,n){return n&&n.parentNode===e?n:null}function _n(e,n,t,o){let r=Qe(e,o),a=n.length,l=t.length;if(a===0&&l===0)return t;if(a===0){for(let f=0;f<l;f++)B(e,t[f],r);return t}if(l===0){for(let f=0;f<a;f++)X(n[f]);return []}let s=0,c=a-1,u=l-1;for(;s<=c&&s<=u&&n[s]===t[s];)s++;for(;c>=s&&u>=s&&n[c]===t[u];)c--,u--;if(s>c){if(s<=u){let f=u+1,y=Qe(e,f<l?t[f]:r);for(let h=s;h<=u;h++)B(e,t[h],y);}}else if(s>u)for(let f=s;f<=c;f++)X(n[f]);else Mt(e,n,t,s,c,u,r);return t}function Mt(e,n,t,o,r,a,l){let s=a-o+1,c=s<=4?S=>{for(let E=o;E<=a;E++)if(t[E]===S)return E}:(()=>{let S=new Map;for(let E=o;E<=a;E++)S.set(t[E],E);return E=>S.get(E)})(),u=new Int32Array(s),f=0,y=false,h=0;for(let S=o;S<=r;S++){let E=n[S];if(f>=s){X(E);continue}let p=c(E);p===void 0?X(E):(u[p-o]=S+1,p>=h?h=p:y=true,f++);}let N=y?Ze(u):[],w=N.length-1;for(let S=s-1;S>=0;S--){let E=o+S,p=t[E],T=Qe(e,E+1<t.length?t[E+1]:l);u[S]===0?B(e,p,T):y&&(w<0||S!==N[w]?B(e,p,T):w--);}}function Ze(e){let n=new Int32Array(e.length),t=[0],o=e.length,r,a,l,s,c;for(r=0;r<o;r++){let u=e[r];if(u!==0){if(a=t[t.length-1],e[a]<u){n[r]=a,t.push(r);continue}for(l=0,s=t.length-1;l<s;)c=l+s>>1,e[t[c]]<u?l=c+1:s=c;u<e[t[l]]&&(l>0&&(n[r]=t[l-1]),t[l]=r);}}for(l=t.length,s=t[l-1];l-- >0;)t[l]=s,s=n[s];return t}function X(e){if(e)if(K(e))e.destroy();else {let n=e;n.parentNode&&n.remove();}}function B(e,n,t){if(!e||!n)return;let o=K(t)?t.firstChild:t;if(K(n)){n.mount(e,o);return}o?e.insertBefore(n,o):e.appendChild(n);}function ie(e){if(e instanceof Node||K(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=[],a=true,l=c=>{if(c instanceof Node)return [c];if(K(c))return [c];let u=typeof c;return c==null||u==="string"||u==="number"||u==="boolean"?[ie(c)]:shared.coerceArray(c).map(f=>shared.isFunction(f)?f():f).flatMap(f=>f).map(ie)},s=signals.effect(()=>{let c=()=>{let u=shared.isFunction(n)?n():n,f=l(u);if(a&&re()&&f.every(y=>y instanceof Node&&y.parentNode===e)){r=f,a=false;return}if(a&&re()){let y=bn(e,f,t);if(y){r=y,a=false;return}}r=_n(e,r,f,t),a=false;};o&&!o.isDestroyed?O(o,c):c();});return H(()=>{s.stop();for(let c of r)X(c);r=[];}),r}function Vt(e){return (e==null?void 0:e.firstChild)||null}function jt(e,n=1){for(;e&&n>0;)e=e.nextSibling,n--;return e||null}function $t(e,n){if(!e||n<0)return null;let t=e.firstChild;for(;t&&n>0;)t=t.nextSibling,n--;return t||null}function se(e,n,t,o){if(!(o!=null&&o.delegate))return e.addEventListener(n,t,o),()=>e.removeEventListener(n,t,o);let r=o.delegate,a=u=>{let f=u.target;(f.matches(r)||f.closest(r))&&t.call(e,u);},c=o,{delegate:l}=c,s=hn(c,["delegate"]);return e.addEventListener(n,a,s),()=>{e.removeEventListener(n,a,s);}}function en(e,n,t){let o=e[n];o||(o=[],e[n]=o),o.push(t);}function kn(e,n,t){let o=e.length;if(o===0)return;let r;for(let a=0;a<o;a++)try{let l=e[a]();if(shared.isPromise(l)){let s=l.catch(c=>{});(r||(r=[])).push(s);}}catch(l){}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}en(n,"onMount",e);}}function Kt(e){let n=M();n&&en(n,"onUpdate",e);}function le(e){let n=M();n&&en(n,"onDestroy",e);}function Rn(e){if(e.isDestroyed)return;if(!e.onMount||e.onMount.length===0){e.isMounted=true;return}let n=e.onMount,t=O(e,()=>kn(n,e.id));return n.length=0,e.isMounted=true,t}function Dn(e){if(!(e.isDestroyed||!e.onUpdate||e.onUpdate.length===0))return O(e,()=>kn(e.onUpdate,e.id))}function Fn(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 In(e,n){let t=Object.getOwnPropertyDescriptor(e,n);return t.get?t.get.call(e):t.value}var Mn;Mn="normal";var ae=class{constructor(n,t={}){this.component=n;this.props=t;this[Mn]=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={};Fn(o,t),this.reactiveProps=signals.shallowReactive(o);}mount(n,t){var a;if(this.parentNode=n,this.beforeNode=t,this.state=1,this.renderedNodes.length>0){for(let l of this.renderedNodes)B(n,l,t);return this.state=2,this.renderedNodes}let o=z((a=this.parentScope)!=null?a:M());this.scope=o;let r=O(o,()=>{var s;let l=this.component(this.reactiveProps);return shared.isFunction(l)&&(l=l(this.reactiveProps)),(signals.isSignal(l)||signals.isComputed(l))&&(l=l.value),(s=Y(n,l,t))!=null?s:[]});return this.renderedNodes=r,this.firstChild=r[0],this.syncSpecialProps(this.props),this.state=2,Rn(o),this.renderedNodes}update(n){this.props=n;let t=this.scope;!t||t.isDestroyed||(Fn(this.reactiveProps,n!=null?n:{},true),this.syncSpecialProps(n),Dn(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(),j(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===gn){let r=In(n,o);this.rootRefCleanup=this.bindRootRef(r,t);continue}if(shared.isOn(o)){let r=In(n,o);if(!shared.isFunction(r))continue;let a=o.slice(2).toLowerCase(),l=t,s=`_$${a}`,c=l[s];if(shared.isFunction(c)){l[s]=r,this.rootEventCleanups.push(()=>{l[s]===r&&(l[s]=c);});continue}let u=r,f=y=>{l.disabled||u.call(l,y);};this.rootEventCleanups.push(se(l,a,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 K(e){return !!e&&!!e.normal}function nn(e,n){return K(e)?e:new ae(e,n)}function pe(e,n){let t=M();t&&(t.provides||(t.provides=new Map),t.provides.set(e,n));}function Q(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}var zt=typeof __VERSION__=="string"?__VERSION__:"",On={pre:0,default:1,post:2};function _e(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 Wt(e,n){return shared.isString(n)||n instanceof Element?tn(e).mount(n):tn(e,n)}function qt(e,n){return tn(e).hydrate(n)}function Xt(e){return e}function tn(e,n){var s,c;let t=(s=n==null?void 0:n.plugins)!=null?s:[],o=yn({},(c=n==null?void 0:n.config)!=null?c:{}),r=false;function a(u,f){if(r)return;r=true;let y=shared.isString(u)?document.querySelector(u):u;if(!y)return;!f&&y.innerHTML&&(y.innerHTML="");let h=z(),N=[],w=new Set,S=new Set,E,p;function T(v,L){if(o.errorHandler)o.errorHandler(L,v);else throw v}let d=t.map((v,L)=>({entry:v,index:L})).sort((v,L)=>{var m,k;let i=On[(m=Hn(v.entry).enforce)!=null?m:"default"],g=On[(k=Hn(L.entry).enforce)!=null?k:"default"];return i-g||v.index-L.index}).map(v=>v.entry);function b(v,L){if(!(S.has(v)||w.has(v.name))){S.add(v),w.add(v.name),E=v.name;try{let i=v.setup(R,L);if(i instanceof Promise){let g=v.name;return i.catch(m=>T(m,{phase:"install",plugin:g})).finally(()=>{E===g&&(E=void 0);})}return E=void 0,i}catch(i){E=void 0,T(i,{phase:"install",plugin:v.name});}}}let R={provide:pe,inject:Q,onMount:v=>{N.push(v);},onCleanup:H,warn(v){let L={plugin:E};o.warnHandler&&o.warnHandler(L,v);},error(v){throw new Error(v)},config:o,version:zt};function A(){f&&Ye(y);try{let v=nn(e);K(v)&&(p=v,(f?Y:B)(y,v));}finally{f&&Je();}for(let v of N)try{v();}catch(L){T(L,{phase:"mount"});}return {root:p,unmount(){j(h),p==null||p.destroy();}}}let P;try{O(h,()=>{for(let v of d){let[L,i]=Yt(v);if(P){P=P.then(()=>O(h,()=>{let m=b(L,i);return m instanceof Promise?m:void 0}));continue}let g=b(L,i);g instanceof Promise&&(P=g);}});}catch(v){throw j(h),v}if(P)return P.then(()=>O(h,A)).catch(v=>{throw j(h),v});try{return O(h,A)}catch(v){throw j(h),v}}return {config:o,mount:u=>a(u,false),hydrate:u=>a(u,true)}}function Hn(e){return Array.isArray(e)?e[0]:e}function Yt(e){return Array.isArray(e)?[e[0],e[1]]:[e,void 0]}function on(e,n){Object.defineProperty(e,"target",{configurable:true,value:n});}function $n(e){let n=e.target,t=e.type,o=e.target,r=e.currentTarget,a=()=>{let s=n[`_$${t}`];if(s&&shared.isFunction(s)&&!n.disabled){let c=n[`${t}Data`];if(c?s.call(n,c,e):s.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)&&on(e,n.host),true},l=()=>{for(;a()&&(n=n._$host||n.parentNode||n.host););};if(Object.defineProperty(e,"currentTarget",{configurable:true,get(){return n||document}}),e.composedPath){let s=e.composedPath();on(e,s[0]);for(let c=0;c<s.length-2&&(n=s[c],!!a());c++){if(n._$host){n=n._$host,l();break}if(n.parentNode===r)break}}else l();on(e,o);}var ke=Symbol("_$EVENTS");function Qt(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,$n));}function Zt(e=globalThis.document){let n=e,t=n[ke];if(t){for(let o of t.keys())e.removeEventListener(o,$n);delete n[ke];}}function ce(e,n,t,o){let r=se(e,n,t,o);M()&&H(r);}var oo=e=>e,ro=typeof DataTransfer!="undefined"?new DataTransfer().files:[];function Un(e,n){let t=e,o=n==null?"":String(n);t.value!==o&&(t.value=o);}var io={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);}},so={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);}},lo={event:"change",forceChange:true,read:e=>e.files,write(e,n){if(n==null)try{e.files=ro;}catch(t){}}},Kn={event:"input",ime:true,read:e=>e.value,write:Un},ao={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 Un(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 Bn(e){return {event:"input",read:n=>n[e],write(n,t){n[e]=t;}}}function co(e,n){switch(e.nodeName){case "INPUT":return n==="checked"?e.type==="radio"?so:io:n==="files"?lo:n==="value"?Kn:Bn(n);case "SELECT":return ao;case "TEXTAREA":return Kn;default:return Bn(n)}}function uo(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 a=Number(r);if(!Number.isNaN(a))return a}}return o}function fo(e){let n=e.getRootNode();return (n instanceof Document||n instanceof ShadowRoot)&&n.activeElement===e}function mo(e,n){if(n!=="value"||e.nodeName!=="INPUT")return false;let t=e.type;return t==="number"||t==="range"}function po(e,n,t,o,r={}){if(!e)return;let{event:a,read:l,write:s,forceChange:c,ime:u,checkboxArray:f}=co(e,n),y=r.trim===true,h=r.number===true||mo(e,n),N=r.lazy===true,w=(y||h)&&n!=="files",S=shared.isFunction(t)?t:()=>t,E=w?A=>uo(A,y,h):oo,p=f?A=>{let P=S();if(!shared.isArray(P))return E(A);let v=e.value,L=P.filter(i=>String(i)!==v);return A&&L.push(v),L}:E,T=false,d=N||c?"change":a,b=()=>{if(T)return;let A=l(e);if(A===void 0)return;let P=p(A);Object.is(S(),P)||o(P);};ce(e,d,b),!N&&w&&d!=="change"&&ce(e,"change",()=>s(e,E(l(e)))),u&&(ce(e,"compositionstart",()=>{T=true;}),ce(e,"compositionend",()=>{T=false,N||b();}));let R=signals.effect(()=>{let A=S();u&&T||u&&!N&&fo(e)&&Object.is(E(l(e)),A)||s(e,A);});M()&&H(()=>R.stop());}function Gn(e){let n=e;return Array.isArray(n)&&n.length===1&&(n=n[0]),typeof n=="function"?n():n}function zn(e){let n=Object.getOwnPropertyDescriptor(e,"children");return n!=null&&n.get?()=>Gn(n.get.call(e)):()=>Gn(e.children)}function yo(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 Wn(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}Wn[Ke]=true;function go(e){return !!e&&!!e[Ke]}function Re(e){let n=shared.isFunction(e.target)?e.target():e.target;return n==null?null:shared.isString(n)?document.querySelector(n):n}function De(e){return shared.isFunction(e.disabled)?!!e.disabled():!!e.disabled}function Xn(e){if(re()){let f=Co(e);if(f)return f}let n=document.createComment("portal");n[de]=true;let{children:t}=e;if(t==null)return n;let o=M(),r=null,a=(f,y)=>{r=z(o),O(r,()=>{Y(f,()=>t,y);});},l=()=>{r&&(j(r),r=null);},s=(f,y)=>{if(l(),f){let h=n.parentNode;if(!h)return;a(h,n);return}y&&a(y);},c=false,u=signals.effect(()=>{let f=De(e),y=f?null:Re(e);c&&s(f,y);});return J(()=>{c=!0;let f=De(e),y=f?null:Re(e);if(f||y){s(f,y);return}queueMicrotask(()=>{n.parentNode&&s(De(e),Re(e));});}),H(()=>{u.stop(),l();}),n}Xn[de]=true;function Co(e){if(De(e))return null;let n=qe();if(!n)return null;let t=Re(e);return !t||!Xe(t)?null:(n[de]=true,n)}function No(e){return !!e&&!!e[de]}function Fe(e){for(;e.firstChild;)e.removeChild(e.firstChild);}function Yn(e){let n=e;for(;shared.isFunction(n);)n=n();return signals.isSignal(n)||signals.isComputed(n)?Yn(n.value):n}var ye=Symbol("SuspenseContext");function Jn(e){var w;if(!shared.isBrowser())return (w=e.fallback)!=null?w:"";let n=document.createElement("div");n.style.display="contents";let t=true,o=0,r=false,a=null,l=S=>{let E=Yn(S);if(shared.isArray(E)){let p=[];for(let T of E){let d=l(T);shared.isArray(d)?p.push(...d):p.push(d);}return p}return ie(E)},s=S=>{let E=l(S),p=shared.isArray(E)?E:[E];for(let T of p)T!=null&&B(n,T);},c=()=>{Fe(n),e.fallback!=null&&s(e.fallback);},u=()=>{r||(r=true,c());},f=()=>{!r||!(a||e.children!=null&&!shared.isPromise(e.children))||(r=false,Fe(n),a?y(a):e.children!=null&&!shared.isPromise(e.children)&&y(e.children));},y=S=>{if(r||(Fe(n),S==null))return;let E=shared.isArray(S)?S:[S];for(let p of E)p!=null&&s(p);r&&c();},h={register:S=>{o++,u(),S.then(()=>{t&&(o--,o===0&&f());}).catch(E=>{t&&(o--,o===0&&f());});},increment:()=>{o++,u();},decrement:()=>{o=Math.max(0,o-1),o===0&&f();}};pe(ye,h);let N=e.children;return shared.isPromise(N)?(N.then(S=>{a=S;}).catch(()=>{}),h.register(N)):N!=null?y(N):u(),le(()=>{t=false,o=0,a=null,Fe(n),n.remove();}),n}Jn[Be]=true;function wo(e){return !!e&&!!e[Be]}function _o(e,n){let t=signals.signal(n==null?void 0:n.initialValue),o=signals.signal(true),r=signals.signal(null),a=signals.signal("pending"),l=0,s=null,c=false,u=Q(ye,null),f=()=>Ve(null,null,function*(){let N=++l;o.value=true,a.value="pending",r.value=null,c=false,u&&u.increment();try{let w=e();s=w,w.catch(()=>{});let S=yield w;N===l&&(t.value=S,a.value="ready",o.value=!1);}catch(w){N===l&&(r.value=w instanceof Error?w:new Error(String(w)),a.value="errored",o.value=false);}finally{u&&u.decrement();}});f();let y=(()=>(!c&&o.value&&s&&u&&(c=true,u.register(s)),t.value));return y.loading=o,y.error=r,y.state=a,[y,{mutate:N=>{t.value=N,a.value="ready",o.value=false,r.value=null;},refetch:()=>Ve(null,null,function*(){yield f();})}]}function Qn(e){return shared.isFunction(e)?e:e.default}function ln(e,n,t){let o=new ae(n,t);return o.mount(e),o}function Po(e,n={}){let{delay:t=200,timeout:o,ssr:r="blocking",onError:a}=n;if(typeof window=="undefined"){if(r==="client-only"){let E=()=>"";return E.__asyncLoader=e,E.__asyncResolved=()=>null,E}let h=null,N=null,w=()=>N||(N=e().then(E=>{h=Qn(E);}).catch(()=>{}),N);w();let S=E=>h?h(E):"";return S.__asyncLoader=w,S.__asyncResolved=()=>h,S}let l=null,s=null,c="pending",u=null;function f(){return u||(u=e().then(h=>{l=Qn(h),c="resolved";}).catch(h=>{s=h instanceof Error?h:new Error(String(h)),c="errored",u=null;}),u)}f();function y(h){var L;if(c==="resolved"&&l){let i=document.createElement("div");i.style.display="contents";let g=ln(i,l,h);return H(()=>g.destroy()),i}if(c==="errored"&&s){let i=document.createElement("div");if(i.style.display="contents",n.error){let g=true,m=null,k=(x,C)=>{g&&(m==null||m.destroy(),m=ln(i,x,C));},_=()=>{u=null,c="pending",s=null,n.loading&&k(n.loading),f().then(()=>{g&&(c==="resolved"&&l?k(l,h):c==="errored"&&s&&n.error&&k(n.error,{error:s,retry:_}));});};k(n.error,{error:s,retry:_}),le(()=>{g=false,m==null||m.destroy(),m=null;});}return i}let N=document.createElement("div");N.style.display="contents";let w=true,S=null,E=null,p=null,T=(i,g)=>{w&&(S==null||S.destroy(),S=ln(N,i,g));},d=i=>()=>{u=null,c="pending",s=null,n.loading&&T(n.loading),f().then(()=>{c==="resolved"&&l?T(l,i):c==="errored"&&s&&n.error&&T(n.error,{error:s,retry:d(i)});});};le(()=>{w=false,S==null||S.destroy(),S=null,E!=null&&clearTimeout(E),p!=null&&clearTimeout(p);});let b=(L=Q(ye))!=null?L:null,R=i=>T(i,h),A=i=>{n.error&&T(n.error,{error:i,retry:d(h)});},P=()=>{n.loading&&T(n.loading);},v=f().then(()=>{w&&(c==="resolved"&&l?R(l):c==="errored"&&s&&(A(s),a&&a(s,d(h))),E!=null&&clearTimeout(E),p!=null&&clearTimeout(p));});return b&&b.register(v),t>0?E=setTimeout(()=>{w&&c==="pending"&&P();},t):n.loading&&P(),o!=null&&(p=setTimeout(()=>{if(w&&c==="pending"){let i=new Error(`[defineAsyncComponent] Timeout after ${o}ms`);s=i,c="errored",A(i),a&&a(i,d(h));}},o)),N}return y.__asyncLoader=f,y.__asyncResolved=()=>l,y}function Zn(e){let n=document.createDocumentFragment(),t=document.createComment("");n.appendChild(t);let o=[],r=[],a=e.key,l=e.children,s=Array.isArray(l)&&l.length===1&&shared.isFunction(l[0])?l[0]:e.children;if(!shared.isFunction(s))throw new TypeError("<For> requires `children` to be a function (item, index) => Node");let c=()=>{var T,d;let p=e.each;return signals.isSignal(p)?(T=p.value)!=null?T:[]:shared.isFunction(p)?(d=p())!=null?d:[]:p!=null?p:[]},u=(p,T)=>a?a(p,T):p,f=(p,T,d)=>{if(p==null||p===false)return [];if(Array.isArray(p)){let R=[];for(let A of p)R.push(...f(A,T,d));return R}if(K(p))return B(T,p,d!=null?d:void 0),p.renderedNodes;let b=ie(p);return B(T,b,d!=null?d:void 0),[b]},y=(p,T)=>{if(!e.fallback)return;r=f(e.fallback(),p,T);},h=()=>{for(let p of r)p.parentNode&&p.parentNode.removeChild(p);r=[];},N=(p,T,d,b,R=u(p,T))=>{let A=M(),P=z(A),v=[];return O(P,()=>{v=f(s(p,T),d,b);}),{key:R,item:p,nodes:v,scope:P}},w=p=>{j(p.scope);for(let T of p.nodes)T.parentNode&&T.parentNode.removeChild(T);},S=signals.effect(()=>{let p=c(),T=t.parentNode;if(!T){if(p.length===0)y(n,t);else {o=new Array(p.length);let d=0;for(let b of p)o[d]=N(b,d,n,t),d++;}return}E(T,p);});function E(p,T){let d=o.length,b=T.length;if(b===0){for(let C=0;C<d;C++)w(o[C]);o=[],e.fallback&&r.length===0&&y(p,t);return}if(d===0||r.length>0){r.length>0&&h(),o=new Array(b);let C=document.createDocumentFragment();for(let D=0;D<b;D++)o[D]=N(T[D],D,C,null);p.insertBefore(C,t);return}let R=new Map;for(let C=0;C<d;C++){let D=o[C],I=R.get(D.key),$=[D,C];I?I.push($):R.set(D.key,[$]);}let A=new Array(b),P=[],v=null,L=new Int32Array(b),i=false,g=0,m=new Array(b);for(let C=0;C<b;C++)m[C]=u(T[C],C);for(let C=0;C<b;C++){let D=T[C],I=m[C],$=R.get(I);if($&&$.length>0){let[q,G]=$.shift();Object.is(q.item,D)?(q.item=D,A[C]=q,L[C]=G+1,G<g?i=true:g=G):(v||(v=document.createDocumentFragment()),w(q),A[C]=N(D,C,v,null,I));}else v||(v=document.createDocumentFragment()),A[C]=N(D,C,v,null,I);}for(let C of R.values())for(let[D]of C)P.push(D);for(let C of P)w(C);let k=i?Ze(L):[],_=k.length-1,x=t;for(let C=b-1;C>=0;C--){let I=A[C].nodes;if(!(L[C]===0)&&i&&_>=0&&C===k[_]){_--;for(let G=I.length-1;G>=0;G--)x=I[G];continue}for(let G=I.length-1;G>=0;G--){let He=I[G];He.nextSibling!==x&&p.insertBefore(He,x),x=He;}}o=A;}return H(()=>{S.stop();for(let p of o)w(p);o=[],h(),t.parentNode&&t.parentNode.removeChild(t);}),n}Zn[Cn]=true;function cn(e){var a,l,s,c,u,f,y,h,N,w;let n=(a=e.name)!=null?a:"v",t=(l=e.enterFromClass)!=null?l:`${n}-enter-from`,o=(s=e.enterActiveClass)!=null?s:`${n}-enter-active`,r=(c=e.enterToClass)!=null?c:`${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:(y=e.leaveToClass)!=null?y:`${n}-leave-to`,appearFrom:(h=e.appearFromClass)!=null?h:t,appearActive:(N=e.appearActiveClass)!=null?N:o,appearTo:(w=e.appearToClass)!=null?w:r}}var et=e=>e?e.endsWith("ms")?Number(e.slice(0,-2).replace(",",".")):Number(e.slice(0,-1).replace(",","."))*1e3:0;function nt(e,n){let t=e.split(", "),o=n.split(", "),r=0;for(let[a,l]of o.entries()){let s=et(l)+et(t[a%t.length]||"0s");s>r&&(r=s);}return r}function ot(e,n){let t=getComputedStyle(e),o=n!=="animation"?nt(t.transitionDelay,t.transitionDuration):0,r=n!=="transition"?nt(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 V(e,n){for(let t of n.split(/\s+/))t&&e.classList.remove(t);}function ge(e){requestAnimationFrame(()=>requestAnimationFrame(e));}function Oe(e){e.offsetHeight;}function ue(e,n,t,o){if(t!=null){setTimeout(o,t);return}let r=ot(e,n);if(!r){o();return}let a=false,l=()=>{a||(a=true,e.removeEventListener(r.event,s),o());},s=()=>l();e.addEventListener(r.event,s),setTimeout(l,r.timeout+1);}function fe(e,n){return e==null?null:typeof e=="number"?e:e[n]}function tt(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(K(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"),he=Symbol("leave_cb");function rt(e){let n=document.createComment(""),t=cn(e),o=e.css!==false,r=zn(e),a="idle",l=null,s=null,c=false,u,f=false,y=false,h=false,N=(d,b)=>{var g;let R=d[he];R&&R(true),a="entering";let A=b==="appear"?t.appearFrom:t.enterFrom,P=b==="appear"?t.appearActive:t.enterActive,v=b==="appear"?t.appearTo:t.enterTo;(g=e.onBeforeEnter)==null||g.call(e,d),o&&(U(d,A),U(d,P));let L=false,i=m=>{var k,_;L||(L=true,d[Me]=void 0,o&&(V(d,A),V(d,P),V(d,v)),m?(k=e.onEnterCancelled)==null||k.call(e,d):(a="entered",(_=e.onAfterEnter)==null||_.call(e,d)));};d[Me]=i,ge(()=>{if(!L)if(o&&(V(d,A),U(d,v)),e.onEnter)e.onEnter(d,()=>i(false));else if(o){let m=fe(e.duration,"enter");ue(d,e.type,m,()=>i(false));}else i(false);});},w=(d,b)=>{var i;let R=d[Me];R&&(R(true),Oe(d)),a="leaving",(i=e.onBeforeLeave)==null||i.call(e,d),o&&(U(d,t.leaveFrom),U(d,t.leaveActive));let A=false,P=g=>{var m,k;A||(A=true,d[he]=void 0,o&&(V(d,t.leaveFrom),V(d,t.leaveActive),V(d,t.leaveTo)),g?(m=e.onLeaveCancelled)==null||m.call(e,d):(a="idle",b(),(k=e.onAfterLeave)==null||k.call(e,d)));};d[he]=P;let v=fe(e.duration,"leave"),L=o&&!e.onLeave&&v==null?!!ot(d,e.type):false;if(!e.onLeave&&v==null&&!L){P(false);return}ge(()=>{A||(o&&(V(d,t.leaveFrom),U(d,t.leaveTo)),e.onLeave?e.onLeave(d,()=>P(false)):o?ue(d,e.type,v,()=>P(false)):P(false));});},S=(d,b)=>{if(d&&a==="leaving"&&s){let A=s,P=A[he];P&&P(true),s=null,l=A,N(A,"enter");return}if(d===l)return;let R=l;if(l=d,R){s=R;let A=R;w(A,()=>{A.parentNode&&A.parentNode.removeChild(A),s===A&&(s=null);});}d&&n.parentNode?(n.parentNode.insertBefore(d,n),b&&!e.appear?a="entered":N(d,b&&e.appear?"appear":"enter")):!R&&!d&&(a="idle");},E=()=>{if(y=false,h||!f)return;let d=u;f=false,u=void 0;try{S(tt(d),!1);}catch(b){}},p=d=>{u=d,f=true,!y&&(y=true,queueMicrotask(E));},T=signals.effect(()=>{let d=r();c?p(d):(u=d,f=true);});return J(()=>{c=!0;let d=f?tt(u):null;f=!1,u=void 0,S(d,!0);}),H(()=>{h=true,T.stop();for(let d of [l,s]){if(!d)continue;let b=d[Me],R=d[he];b==null||b(true),R==null||R(true),d.parentNode&&d.parentNode.removeChild(d);}l=null,s=null,a="idle";}),n}rt[Ue]=true;function Lo(e){return !!e&&!!e[Ue]}function fn(e,n){if(e==null||e===false)return {el:null,comp:null};if(Array.isArray(e)&&e.length===1)return fn(e[0],n);if(shared.isFunction(e))return fn(e(),n);if(e instanceof HTMLElement)return {el:e,comp:null};if(K(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 Mo(e){return {position:e.style.position,top:e.style.top,left:e.style.left,width:e.style.width,height:e.style.height}}function un(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 it(e){var P,v,L;let n=(P=e.tag)!=null?P:"div",t=document.createElement(n),o=cn(e),r=e.css!==false,a=(L=e.moveClass)!=null?L:`${(v=e.name)!=null?v:"v"}-move`,l=e.key,s=e.children,c=Array.isArray(s)&&s.length===1&&shared.isFunction(s[0])?s[0]:e.children;if(!shared.isFunction(c)||!shared.isFunction(l))throw new TypeError("<TransitionGroup> requires `children: (item, index) => Node` and `key: (item, index) => unknown`");let u=()=>{var g,m;let i=e.each;return signals.isSignal(i)?(g=i.value)!=null?g:[]:shared.isFunction(i)?(m=i())!=null?m:[]:i!=null?i:[]},f=[],y=false,h=(i,g)=>{let m=M(),k=z(m),_;O(k,()=>{_=c(i,g);});let{el:x,comp:C}=fn(_,t);return x?{key:l(i,g),item:i,el:x,comp:C,scope:k,state:"entering"}:(j(k),null)},N=i=>{if(i.comp){for(let g of i.comp.renderedNodes)g.parentNode===t&&t.removeChild(g);return}i.el.parentNode===t&&t.removeChild(i.el);},w=i=>{var g,m;(g=i.cancelEnter)==null||g.call(i,true),(m=i.cancelLeave)==null||m.call(i,true),i.comp&&i.comp.destroy(),N(i),j(i.scope);},S=i=>{var _,x,C;let g=i.el;if((_=i.cancelLeave)==null||_.call(i,true),!r){i.state="present",(x=e.onAfterEnter)==null||x.call(e,g);return}(C=e.onBeforeEnter)==null||C.call(e,g),U(g,o.enterFrom),U(g,o.enterActive);let m=false,k=D=>{var I,$;m||(m=true,i.cancelEnter=void 0,V(g,o.enterFrom),V(g,o.enterActive),V(g,o.enterTo),D?(I=e.onEnterCancelled)==null||I.call(e,g):(i.state="present",($=e.onAfterEnter)==null||$.call(e,g)));};i.cancelEnter=k,i.state="entering",ge(()=>{if(!m)if(V(g,o.enterFrom),U(g,o.enterTo),e.onEnter)e.onEnter(g,()=>k(false));else {let D=fe(e.duration,"enter");ue(g,e.type,D,()=>k(false));}});},E=(i,g)=>{var C,D;let m=i.el;i.cancelEnter&&(i.cancelEnter(true),Oe(m)),i.state="leaving",i.savedStyles=Mo(m);let k=t.getBoundingClientRect();if(m.style.position="absolute",m.style.top=`${g.top-k.top}px`,m.style.left=`${g.left-k.left}px`,m.style.width=`${g.width}px`,m.style.height=`${g.height}px`,!r){i.savedStyles&&un(m,i.savedStyles),N(i),j(i.scope),i.comp&&i.comp.destroy(),(C=e.onAfterLeave)==null||C.call(e,m);return}(D=e.onBeforeLeave)==null||D.call(e,m),U(m,o.leaveFrom),U(m,o.leaveActive);let _=false,x=I=>{var $,q;if(!_){if(_=true,i.cancelLeave=void 0,V(m,o.leaveFrom),V(m,o.leaveActive),V(m,o.leaveTo),I){i.savedStyles&&un(m,i.savedStyles),i.savedStyles=void 0,($=e.onLeaveCancelled)==null||$.call(e,m);return}i.savedStyles&&un(m,i.savedStyles),i.savedStyles=void 0,N(i),j(i.scope),i.comp&&i.comp.destroy(),(q=e.onAfterLeave)==null||q.call(e,m);}};i.cancelLeave=x,ge(()=>{if(!_)if(V(m,o.leaveFrom),U(m,o.leaveTo),e.onLeave)e.onLeave(m,()=>x(false));else {let I=fe(e.duration,"leave");ue(m,e.type,I,()=>x(false));}});},p=(i,g)=>{if(!r||i.state!=="present")return;let m=i.el,k=m.getBoundingClientRect(),_=g.left-k.left,x=g.top-k.top;if(!_&&!x)return;let C=m.style.transform,D=m.style.transitionDuration;m.style.transform=`translate(${_}px, ${x}px)`,m.style.transitionDuration="0s",U(m,a),Oe(m),m.style.transform=C,m.style.transitionDuration=D;let I=fe(e.duration,"enter");ue(m,e.type,I,()=>{V(m,a);});},T=()=>{for(let i of f)i.state!=="leaving"&&(i.prevRect=i.el.getBoundingClientRect());},d=i=>{let g=new Map;for(let x of f)g.set(x.key,x);let m=[];for(let[x,C]of i.entries()){let D=l(C,x),I=g.get(D);if(I)g.delete(D),I.item=C,m.push(I);else {let $=h(C,x);$&&m.push($);}}let k=[];for(let x of g.values())x.state!=="leaving"&&k.push(x);let _=null;for(let x=m.length-1;x>=0;x--){let C=m[x].el;(C.parentNode!==t||C.nextSibling!==_)&&t.insertBefore(C,_),_=C;}return {next:m,leaving:k}},b=(i,g)=>{if(g){let _=[];for(let[x,C]of i.entries()){let D=h(C,x);D&&(D.el.parentNode!==t&&t.appendChild(D.el),D.state="present",_.push(D));}f=_;return}T();let{next:m,leaving:k}=d(i);for(let _ of m)_.state!=="present"&&S(_);for(let _ of k){let x=_.prevRect;x&&E(_,x);}for(let _ of m)_.state!=="present"||!_.prevRect||(p(_,_.prevRect),_.prevRect=void 0);f=m.concat(k);},R=null,A=signals.effect(()=>{let i=u();if(!y){R=i;return}b(i,false);});return J(()=>{y=!0,R&&(b(R,!0),R=null);}),H(()=>{A.stop();for(let i of f)w(i);f=[],t.parentNode&&t.parentNode.removeChild(t);}),t}it[Ge]=true;function Oo(e){return !!e&&!!e[Ge]}
|
|
2
|
+
exports.Component=ae;exports.For=Zn;exports.Fragment=Wn;exports.Portal=Xn;exports.Suspense=Jn;exports.Transition=rt;exports.TransitionGroup=it;exports.addEvent=se;exports.addEventListener=ce;exports.beginHydration=Ye;exports.bindElement=po;exports.child=Vt;exports.clearDelegatedEvents=Zt;exports.consumeTeleportAnchor=qe;exports.consumeTeleportBlock=Xe;exports.createApp=Wt;exports.createComponent=nn;exports.createResource=_o;exports.defineAsyncComponent=Po;exports.definePlugin=Xt;exports.delegateEvents=Qt;exports.endHydration=Je;exports.getHydrationKey=An;exports.getRenderedElement=Dt;exports.hydrate=qt;exports.hydrationAnchor=Rt;exports.hydrationMarker=kt;exports.inject=Q;exports.insert=Y;exports.isComponent=K;exports.isFragment=go;exports.isHydrating=re;exports.isPortal=No;exports.isSuspense=wo;exports.isTransition=Lo;exports.isTransitionGroup=Oo;exports.next=jt;exports.normalizeClass=Te;exports.nthChild=$t;exports.omitProps=yo;exports.onDestroy=le;exports.onMount=J;exports.onUpdate=Kt;exports.patchAttr=ee;exports.patchAttrHydrate=Ft;exports.patchClass=Ae;exports.patchClassHydrate=Lt;exports.patchStyle=we;exports.patchStyleHydrate=It;exports.provide=pe;exports.resetHydrationKey=_t;exports.setStyle=te;exports.template=_e;
|