@spearwolf/shadow-objects 0.26.3 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,23 @@ All notable changes to [@spearwolf/shadow-objects](https://github.com/spearwolf/
5
5
  The format is loosely based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## unreleased
9
+
10
+ - sharpen the `EntityApi` type definitions
11
+
12
+ ## [0.27.0] - 2026-01-19
13
+
14
+ ### ⚠️ Breaking Changes
15
+
16
+ - **API Update:** `dispatchMessageToView` has been moved from the `entity` instance to the `ShadowObjectCreationAPI`.
17
+ - **Before:** `entity.dispatchMessageToView(...)`
18
+ - **After:** `dispatchMessageToView(...)` (available as an argument in the constructor/factory function)
19
+ - **Type Definitions:** Removed `dispatchMessageToView` from `EntityApi` interface.
20
+
21
+ ## [0.26.4] - 2026-01-15
22
+
23
+ - fix return type definitions for `provideContext()` and `provideGlobalContext()`
24
+
8
25
  ## [0.26.3] - 2026-01-15
9
26
 
10
27
  - fix type definitions for `provideContext()`, `provideGlobalContext()`, `useContext()`, `useParentContext()` and `useProperty()` when using the deprecated third argument as `isEqual` callback
package/README.md CHANGED
@@ -1,199 +1,51 @@
1
1
  # Shadow Objects Framework 🧛
2
2
 
3
- The **Shadow Objects Framework** is a reactive library designed to decouple business logic and state management from the UI rendering layer. It runs application logic "in the dark" (e.g., in a web worker), mirroring the view hierarchy of your application.
3
+ The **Shadow Objects Framework** is a reactive library designed to decouple business logic and state management from the UI rendering layer. It allows your application logic to run "in the dark" (typically in a Web Worker), mirroring the view hierarchy of your application.
4
4
 
5
5
  > [!WARNING]
6
6
  > 🚀 This is a highly experimental framework that is slowly maturing. Use at your own risk. 🔥
7
7
 
8
- ## Core Concepts
8
+ ## Documentation
9
9
 
10
- ### 1. Entities
11
- An **Entity** is the fundamental unit in the framework. It represents a node in the hierarchy, mirroring a view component (e.g., a Web Component or a DOM element).
12
- - **Hierarchy**: Entities have parents and children, forming a tree structure.
13
- - **Properties**: Entities hold reactive properties that sync with the view.
14
- - **Context**: Entities participate in a hierarchical context system (dependency injection).
10
+ **👉 The complete and authoritative documentation is located in the [docs/](./docs/) directory.**
15
11
 
16
- ### 2. Shadow Objects
17
- A **Shadow Object** is a functional unit of logic attached to an Entity.
18
- - **Logic Containers**: They contain the state, effects, and business logic for a specific feature.
19
- - **Lifecycle**: They are automatically created and destroyed by the **Kernel** based on the Entity's **Token**.
20
- - **Reactivity**: They use **Signals** and **Effects** (via `@spearwolf/signalize`) to react to changes in properties or context.
12
+ * [**Fundamentals**](./docs/01-fundamentals/): Understand the mental model, architecture, and lifecycle.
13
+ * [**Guides**](./docs/02-guides/): Step-by-step instructions for getting started and building with Shadow Objects.
14
+ * [**API Reference**](./docs/03-api/): Detailed API documentation for Shadow Objects and the Registry.
21
15
 
22
- ### 3. The Kernel
23
- The **Kernel** is the brain of the framework.
24
- - **Manages Entities**: Handles creation, destruction, and hierarchy updates of Entities.
25
- - **Orchestrates Shadow Objects**: Instantiates the correct Shadow Objects for each Entity based on its Token and the Registry.
26
- - **Message Dispatch**: Handles communication between the View (UI) and the Shadow World.
16
+ ## Overview
27
17
 
28
- ### 4. The Registry
29
- The **Registry** maps **Tokens** to **Shadow Object Constructors**.
30
- - **Tokens**: Strings that identify what logic an Entity should have (e.g., `"my-component"`).
31
- - **Routes**: Defines rules for composing multiple Shadow Objects. For example, a token can "route" to other tokens, causing multiple Shadow Objects to be instantiated for a single Entity.
32
- - **Conditional Routing**: Routes can be triggered based on the presence of specific "truthy" properties on the Entity (e.g., `@myProp` routes only if `myProp` is set).
18
+ ### What is it?
33
19
 
34
- ---
20
+ Shadow Objects creates a strict separation between the **View** (what the user sees) and the **Logic** (how the application behaves).
35
21
 
36
- ## Developer Guide
22
+ * **View (Browser Window):** Handles rendering and user input. It remains lightweight and "dumb".
23
+ * **Logic (Web Worker):** Manages state, side effects, and business rules. It is organized as "Shadow Objects" that are attached to abstract "Entities".
37
24
 
38
- ### 1. Defining Shadow Objects
25
+ ### Installation
39
26
 
40
- You can define a Shadow Object as a **Function** or a **Class**. Both receive a `ShadowObjectCreationAPI` object containing the API methods.
27
+ The framework is available as an npm package:
41
28
 
42
- #### Function-based (Recommended)
43
-
44
- ```typescript
45
- import { ShadowObjectCreationAPI } from "@spearwolf/shadow-objects";
46
-
47
- export function MyShadowObject({
48
- useProperty,
49
- createEffect,
50
- onDestroy
51
- }: ShadowObjectCreationAPI) {
52
-
53
- // Read Properties
54
- const title = useProperty("title");
55
-
56
- // React to changes
57
- createEffect(() => {
58
- console.log("Title is now:", title());
59
- });
60
-
61
- // Handle Lifecycle
62
- onDestroy(() => {
63
- console.log("Shadow Object destroyed");
64
- });
65
-
66
- // Return public methods (optional)
67
- // These can be called by events (more on that later)
68
- return {
69
- doSomething() { /* ... */ }
70
- };
71
- }
72
- ```
73
-
74
- #### Class-based
75
-
76
- ```typescript
77
- import { ShadowObjectCreationAPI } from "@spearwolf/shadow-objects";
78
-
79
- export class MyShadowObject {
80
- constructor({ useProperty, createEffect, onDestroy }: ShadowObjectCreationAPI) {
81
- const title = useProperty("title");
82
-
83
- createEffect(() => {
84
- console.log("Title is now:", title());
85
- });
86
-
87
- onDestroy(() => this.cleanup());
88
- }
89
-
90
- cleanup() {
91
- console.log("Shadow Object destroyed");
92
- }
93
- }
29
+ ```bash
30
+ npm install @spearwolf/shadow-objects
94
31
  ```
95
32
 
96
- ### 2. The Shadow Object Creation API
97
-
98
- The `ShadowObjectCreationAPI` object provides all necessary tools to interact with the Entity, the View, and the Context system.
99
-
100
- | Method | Description |
101
- | :--- | :--- |
102
- | **`useProperty(name)`** | Returns a signal reader for a specific property on the Entity. Updates when the view property changes. |
103
- | **`useProperties(map)`** | Returns an object of signal readers for multiple properties. |
104
- | **`useContext(name)`** | Consumes a context value provided by a parent Entity. |
105
- | **`useParentContext(name)`** | Skips the current Entity and consumes context directly from the parent. |
106
- | **`provideContext(name, value)`** | Provides a context value (or signal) to descendant Entities. |
107
- | **`provideGlobalContext(name, value)`** | Provides a context value globally to all Entities. |
108
- | **`createResource(factory, cleanup)`** | Manages an external resource (e.g., a Three.js object) with automatic cleanup when dependencies change. |
109
- | **`createEffect(callback)`** | Runs a side effect whenever accessed signals change. |
110
- | **`createSignal(initialValue)`** | Creates a local reactive state signal. |
111
- | **`createMemo(factory)`** | Creates a derived signal that updates only when dependencies change. |
112
- | **`on(target, event, callback)`** | Listens for events on the Entity or other event targets. |
113
- | **`once(target, event, callback)`** | Listens for an event exactly once. |
114
- | **`onDestroy(callback)`** | Registers a callback to be executed when the Shadow Object is destroyed. |
115
-
116
- ### 3. Registering Shadow Objects
117
-
118
- Shadow Objects are organized in **Modules**. A module defines which Tokens map to which Shadow Objects.
119
-
120
- ```typescript
121
- // my-module.ts
122
- import { MyShadowObject } from "./MyShadowObject";
123
-
124
- export default {
125
- // Map tokens to constructors
126
- define: {
127
- "my-component": MyShadowObject,
128
- },
129
- // Define routing rules
130
- routes: {
131
- "my-component": ["mixin-logger", "mixin-analytics"], // Composition
132
- "@debug": ["debug-overlay"], // Conditional routing based on 'debug' property
133
- }
134
- };
135
- ```
33
+ ### Integration
136
34
 
137
- ### 4. View Integration
35
+ To integrate Shadow Objects into your project, you connect the View to your Logic using tokens.
138
36
 
139
- In your HTML or View layer, you use the provided Web Components to create the Entity hierarchy.
37
+ 1. **Define Logic**: Write your Shadow Objects (logic units) using the functional API.
38
+ 2. **Register**: Map your Shadow Objects to **Tokens** in a module definition.
39
+ 3. **Connect View**: Use the provided Web Components to load your module and build your UI hierarchy.
140
40
 
141
41
  ```html
142
- <!-- 1. Initialize the Environment -->
143
- <shae-worker-env src="./my-module.js"></shae-worker-env>
42
+ <!-- 1. Initialize the Environment & Load Logic -->
43
+ <shae-worker src="./my-logic-module.js"></shae-worker>
144
44
 
145
- <!-- 2. Create Entities -->
146
- <shae-ent token="my-entity">
147
- <!-- Properties -->
148
- <shae-prop name="title" value="Hello World"></shae-prop>
149
-
150
- <!-- Nested Entities -->
151
- <shae-ent token="child-entity"></shae-ent>
45
+ <!-- 2. Create Entities in the View -->
46
+ <shae-ent token="my-feature">
47
+ <!-- The framework automatically instantiates the Shadow Object mapped to "my-feature" in the worker -->
152
48
  </shae-ent>
153
49
  ```
154
50
 
155
- ---
156
-
157
- ## Architecture & Internals
158
-
159
- ### Lifecycle
160
-
161
- 1. **Creation**: When an Entity is created (e.g., `<shae-ent>` connects to the document), the Kernel looks up its Token in the Registry.
162
- 2. **Instantiation**: The Kernel instantiates all Shadow Objects associated with that Token (and its routes).
163
- 3. **Execution**: The Shadow Object function runs, setting up signals, effects, and context providers.
164
- 4. **Updates**:
165
- * **Properties**: When view properties change, the Entity's signals update, triggering any dependent effects in the Shadow Object.
166
- * **Context**: If a parent Entity changes a provided context, child Shadow Objects consuming that context automatically update.
167
- 5. **Destruction**: When an Entity is removed or its Token changes, the Kernel destroys the associated Shadow Objects, cleaning up all signals and effects.
168
-
169
- ### Architecture Diagram
170
-
171
- ```mermaid
172
- graph TD
173
- View[View / DOM] -->|Messages| Kernel
174
- Kernel -->|Updates| EntityTree[Entity Tree]
175
-
176
- subgraph "Shadow World"
177
- EntityTree
178
- Entity[Entity]
179
- SO[Shadow Object]
180
-
181
- EntityTree --> Entity
182
- Entity -->|Has| SO
183
-
184
- SO -->|Reads| Props[Properties]
185
- SO -->|Reads/Writes| Context
186
- SO -->|Runs| Logic[Business Logic]
187
- end
188
-
189
- Logic -->|Updates| Signals
190
- Signals -->|Triggers| Effects
191
- ```
192
-
193
- ### Further Reading
194
-
195
- For deep dives into specific subsystems:
196
-
197
- - [**ShadowEnv**](src/view/README.md): The environment wrapper.
198
- - [**ComponentContext**](src/view/ComponentContext.md): Context implementation details.
199
- - [**ViewComponent**](src/view/ViewComponent.md): Base class for view components.
51
+ For detailed setup instructions, please refer to the [Getting Started](./docs/02-guides/01-getting-started.md) guide.
package/bundle.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  @file @spearwolf/shadow-objects - a reactive entity-component framework that feels at home in the shadows
3
3
  @author Wolfger Schramm <wolfger@spearwolf.de>
4
- @version 0.26.3+bundle.20260115
4
+ @version 0.27.0+bundle.20260119
5
5
 
6
6
  Copyright 2026 Wolfger Schramm
7
7
 
@@ -18,7 +18,7 @@ See the License for the specific language governing permissions and
18
18
  limitations under the License.
19
19
 
20
20
  */
21
- var ie="*",ts=1,At=2,Tt=4,U=Symbol.for("eventize"),Qs="[eventize]",ze=s=>s===ie,ss=s=>{switch(typeof s){case"string":case"symbol":return!0;default:return!1}},rs=typeof console<"u",Ys=rs?console[console.warn?"warn":"log"].bind(console,Qs):()=>{},Ks=(s,e,t)=>(Object.defineProperty(s,e,{value:t,configurable:!0}),s),Js=0,is=class{static publish(s){s.sort((e,t)=>e.order-t.order).forEach(e=>e.emit())}events=new Map;eventNames=new Set;add(s){Array.isArray(s)?s.forEach(e=>this.eventNames.add(e)):this.eventNames.add(s)}remove(s){Array.isArray(s)?s.forEach(e=>this.eventNames.delete(e)):this.eventNames.delete(s),this.clear(s)}clear(s){Array.isArray(s)?s.forEach(e=>this.events.delete(e)):this.events.delete(s)}retain(s,e){this.eventNames.has(s)&&this.events.set(s,{args:e,order:Js++})}isKnown(s){return this.eventNames.has(s)}emit(s,e,t=[]){if(ze(s))this.eventNames.forEach(r=>this.emit(r,e,t));else if(this.events.has(s)){let{order:r,args:i}=this.events.get(s);t.push({order:r,emit:()=>e.apply(s,i)})}return t}},xt=(s,e,t,r)=>{if(typeof e=="function"){let i=e.apply(s,t);i!=null&&r?.(i)}},Zs=(s,e,t,r)=>xt(e,e.emit,[s].concat(t),r),Xs=s=>{switch(typeof s){case"function":return ts;case"string":case"symbol":return At;case"object":return Tt}},er=0,tr=()=>++er,ns=class{id;eventName;isCatchEmAll;priority;listener;listenerObject;listenerType;callAfterApply;isRemoved;refCount;constructor(s,e,t,r=null){this.id=tr(),this.eventName=s,this.isCatchEmAll=ze(s),this.listener=t,this.listenerObject=r,this.priority=e,this.listenerType=Xs(t),this.callAfterApply=void 0,this.isRemoved=!1,this.refCount=1}isEqual(s,e=null){if(s===this)return!0;let t=typeof s;return t==="number"&&s===this.id?!0:e===null&&(t==="string"||t==="symbol")?s===ie||s===this.eventName:this.listener===s&&this.listenerObject===e}apply(s,e,t){if(this.isRemoved)return;let{listener:r,listenerObject:i}=this;switch(this.listenerType){case ts:xt(i,r,e,t),this.callAfterApply&&this.callAfterApply();break;case At:xt(i,i[r],e,t),this.callAfterApply&&this.callAfterApply();break;case Tt:{let n=r[s];if(this.isCatchEmAll||this.eventName===s){if(typeof n=="function"){let o=n.apply(r,e);o!=null&&t?.(o)}else Zs(s,r,e,t);this.callAfterApply&&this.callAfterApply()}break}}}},sr=(s,e)=>s.priority!==e.priority?e.priority-s.priority:s.id-e.id,Zt=s=>s?.slice(0),Xt=(s,e)=>{let t=s.indexOf(e);t>-1&&s.splice(t,1)},rr=s=>s===Tt||s===At,kt=(s,e,t)=>{let r=s.findIndex(i=>i.isEqual(e,t));r>-1&&(s[r].isRemoved=!0,s.splice(r,1))},Fe=(s,e,t)=>{let r=[];for(let i of s)(e==null&&i.listenerObject===t||i.eventName===e&&i.listener===t)&&r.push(i);for(let i of r)kt(s,i,void 0)},St=s=>{s&&(s.forEach(e=>{e.isRemoved=!0}),s.length=0)},ir=(s,e)=>s.listenerType===e.listenerType?s.priority===e.priority&&s.eventName===e.eventName&&s.listenerObject===e.listenerObject&&s.listener===e.listener:!1,nr=(s,e)=>{if(rr(s.listenerType))return e.find(t=>ir(s,t))},or=(s,e)=>{let t=nr(s,e);return t?(t.refCount+=1,t):(e.push(s),e.sort(sr),s)},ar=class{namedListeners;catchEmAllListeners;getListenersForEventName=s=>{let e=this.namedListeners.get(s);return e||(e=[],this.namedListeners.set(s,e)),e};constructor(){this.namedListeners=new Map,this.catchEmAllListeners=[]}add(s){return or(s,s.isCatchEmAll?this.catchEmAllListeners:this.getListenersForEventName(s.eventName))}remove(s,e,t=!1){e==null&&Array.isArray(s)?s.forEach(r=>this.remove(r,null,t)):s==null||e==null&&ze(s)?this.removeAllListeners():e==null&&ss(s)?St(this.namedListeners.get(s)):s instanceof ns?s.isRemoved||(s.refCount-=1,s.refCount<1&&(s.isRemoved=!0,this.namedListeners.forEach(r=>Xt(r,s)),Xt(this.catchEmAllListeners,s))):t?ze(s)&&typeof s=="object"?Fe(this.catchEmAllListeners,ie,s):this.namedListeners.forEach(r=>Fe(r,s,e)):(this.namedListeners.forEach(r=>{kt(r,s,e),typeof s=="object"&&Fe(r,void 0,s)}),kt(this.catchEmAllListeners,s,e),typeof s=="object"&&Fe(this.catchEmAllListeners,void 0,s))}removeAllListeners(){this.namedListeners.forEach(s=>St(s)),this.namedListeners.clear(),St(this.catchEmAllListeners)}forEach(s,e){let t=Zt(this.catchEmAllListeners),r=Zt(this.namedListeners.get(s));if(s===ie||!r||r.length===0)t.forEach(e);else if(t.length===0)r.forEach(e);else{let i=r.length,n=t.length,o=0,l=0;for(;o<i||l<n;){if(o<i){let a=r[o];if(l>=n||a.priority>=t[l].priority){e(a),++o;continue}}l<n&&(e(t[l]),++l)}}}getSubscriptionCount(){let s=this.catchEmAllListeners.length;for(let e of this.namedListeners.values())s+=e.length;return s}},ne=s=>!!(s&&s[U]);function Ee(s){if(ne(s))return s;let e=new ar,t=new is;return Ks(s,U,{keeper:t,store:e}),s}var V={Max:Number.POSITIVE_INFINITY,AAA:1e9,BB:1e6,C:1e3,Default:0,Low:-1e4,Min:Number.NEGATIVE_INFINITY},hr=(s,e,t,r,i,n,o)=>{let l=s.add(new ns(t,r,i,n));return e.emit(t,l,o),l},lr=(s,e,t,r)=>{let i=t.length,n=typeof t[0],o,l,a,c;if(i>=2&&i<=3&&n==="number"?(o=ie,[l,a,c]=t):i>=3&&i<=4&&typeof t[1]=="number"?[o,l,a,c]=t:(l=V.Default,n==="string"||n==="symbol"||Array.isArray(t[0])?[o,a,c]=t:(o=ie,[a,c]=t)),!a&&rs)throw Ys("called with insufficient arguments!",t),"subscribeTo() called with insufficient arguments!";let C=v=>u=>hr(s,e,u,v,a,c,r);return Array.isArray(o)?o.map(v=>Array.isArray(v)?C(v[1])(v[0]):C(l)(v)):C(l)(o)},os=(s,e,t)=>{let r=[],i=lr(s,e,t,r);return is.publish(r),i},es=s=>e=>{e.callAfterApply=()=>{s?.()}},as=(s,e)=>Object.assign(()=>x(s,e),Array.isArray(e)?{listeners:e}:{listener:e}),hs=(s,e,t,r)=>{let{store:i,keeper:n}=s[U];Array.isArray(e)?e.forEach(o=>{i.forEach(o,l=>l.apply(o,t,r)),n.retain(o,t)}):e!==ie&&(i.forEach(e,o=>{o.apply(e,t,r)}),n.retain(e,t))},m=(s,...e)=>{let t=Ee(s),{store:r,keeper:i}=t[U];return as(t,os(r,i,e))},S=(s,...e)=>{let t=Ee(s),{store:r,keeper:i}=t[U],n=os(r,i,e),o=as(t,n),l=!1,a=()=>{l||(o(),l=!0)};return Array.isArray(n)?n.forEach(es(a)):es(a)(n),a},fe=(s,e)=>new Promise(t=>{S(s,e,t)}),x=(s,e,t)=>{if(!ne(s))throw new Error("object is not eventized");let{store:r,keeper:i}=s[U],n=typeof e,o=t!=null&&(n==="string"||n==="symbol");r.remove(e,t,o),Array.isArray(e)?i.remove(e.filter(l=>typeof l=="string")):ss(e)&&i.remove(e)},f=(s,e,...t)=>{if(!ne(s))throw new Error("object is not eventized");hs(s,e,t)},ur=(s,e,...t)=>{if(!ne(s))throw new Error("object is not eventized");let r=[];return hs(s,e,t,i=>{r.push(i)}),r=r.map(i=>Array.isArray(i)?Promise.all(i):Promise.resolve(i)),r.length>0?Promise.all(r):Promise.resolve()},G=(s,e)=>{let t=Ee(s),{keeper:r}=t[U];r.add(e)},K=(s,e)=>{if(!ne(s))throw new Error("object is not eventized");let{keeper:t}=s[U];t.clear(e)},k=(()=>{let s=(e={})=>Ee(e);return s.inject=(e={})=>(e=Ee(e),Object.assign(e,{on:(...t)=>m(e,...t),once:(...t)=>S(e,...t),onceAsync:t=>fe(e,t),off:(t,r)=>x(e,t,r),emit:(t,...r)=>f(e,t,...r),emitAsync:(t,...r)=>ur(e,t,...r),retain:t=>G(e,t),retainClear:t=>K(e,t)}),e),s.is=ne,s})();var Ot=s=>ne(s)?s[U]?.store?.getSubscriptionCount()??0:0;var L=Symbol.for("signal"),oe=Symbol.for("effect"),Pt=Symbol.for("destroySignal"),Rt=Symbol.for("createEffect"),ls=Symbol.for("destroyEffect"),pe="value",Mt="mute",Lt="unmute",J="destroy",ae=Symbol.for("recall");var he=k(),W=k(),B=k(),Ue=k();var le=class{static current;delayedEffects=[];batch(e,t){let r=this.delayedEffects.length;for(let i=0;i<r;i++){let[n,o]=this.delayedEffects[i];if(!(n>t))if(n===t){o.add(e);return}else{this.delayedEffects.splice(i,0,[t,new Set([e])]);return}}this.delayedEffects.push([t,new Set([e])])}flush(){this.run(),this.delayedEffects.length=0}run(){let e=new Set,t=[m(B,(i,n)=>{n===ae&&e.add(i)}),m(Ue,i=>{e.add(i)})],r=this.delayedEffects.flatMap(([,i])=>Array.from(i));for(let i of r)e.has(i)||f(B,i,i,ae);t.forEach(i=>{i()})}},us=()=>le.current;function O(s){let e=le.current;e?e=void 0:e=le.current=new le;try{s()}finally{e&&(le.current=void 0,e.run())}}var jt=0;function Dt(s){jt++;try{s()}finally{jt--}}function Ve(){return jt>0}var Ge=class{[oe];constructor(e){this[oe]=e,S(e,ge.Destroy,()=>{this[oe]=void 0})}run=()=>this[oe]?.run();destroy=()=>{this[oe]?.destroy(),this[oe]=void 0}};var Z=new Map,j=class s{#e=new Set;#t=new Set;#s=new Map;#i=new WeakMap;#r=new Map;#n=new Set;#o=new Set;#a;#h;static get(e){if(e!=null)return e instanceof s?e:Z.get(e)}static findOrCreate(e){if(e==null)throw new Error("Cannot create a group with a null object");return new s(e)}static destroy(e){console.warn("SignalGroup.destroy(obj) is deprecated. Use SignalGroup.delete(obj) instead."),s.delete(e)}static delete(e){Z.get(e)?.clear()}static clear(){for(let e of Z.values())e.destroy();Z.clear()}constructor(e){if(e!=null&&e instanceof s)return e;if(e??=this,Z.has(e))return Z.get(e);this.#h=e,Z.set(e,this),k(this)}attachGroup(e){if(e===this)throw new Error("Cannot attach a group to itself");return this.#e.add(e),e.#a&&e.#a!==this&&e.#a.#e.delete(e),e.#a=this,e}detachGroup(e){return e!==this&&this.#e.has(e)&&(this.#e.delete(e),e.#a=void 0),e}attachSignal(e){let t=E(e);if(t?.destroyed)throw new Error("Cannot attach a destroyed signal to a group");return t&&this.#t.add(t),e}attachSignalByName(e,t){if(t){this.attachSignal(t);let r=E(t);this.#s.set(e,r),this.#r.has(e)?this.#r.get(e).push(r):this.#r.set(e,[r]),this.#i.has(r)?this.#i.get(r).add(e):this.#i.set(r,new Set([e]))}else this.#s.delete(e);return t}hasSignal(e){return this.#s.has(e)||!!this.#a?.hasSignal(e)}signal(e){return this.#s.get(e)?.object??this.#a?.signal(e)}detachSignal(e){let t=E(e);if(t&&(this.#t.delete(t),this.#i.has(t))){let r=this.#i.get(t);for(let i of r)if(this.#r.has(i)){let n=this.#r.get(i);n.splice(n.indexOf(t),1),n.length===0?(this.#s.delete(i),this.#r.delete(i)):this.#s.get(i)===t&&this.#s.set(i,n.at(-1))}r.clear(),this.#i.delete(t)}return e}attachEffect(e){return this.#n.add(e),e}runEffects(){for(let e of this.#n)e.run();for(let e of this.#e)e.runEffects()}attachLink(e){if(e?.isDestroyed)throw new Error("Cannot attach a destroyed link to a group");return e&&this.#o.add(e),e}detachLink(e){return e&&this.#o.delete(e),e}destroy(){console.warn("SignalGroup#destroy is deprecated. Use SignalGroup#clear instead."),this.clear()}clear(){f(this,J,this),x(this);for(let e of this.#e)e.destroy();for(let e of this.#n)e.destroy();for(let e of this.#t)A(e);for(let e of this.#o)e.destroy();this.#e.clear(),this.#t.clear(),this.#s.clear(),this.#r.clear(),this.#n.clear(),this.#o.clear(),this.#a?.detachGroup(this),this.#h&&(Z.delete(this.#h),this.#h=void 0)}};var ye=class{#e;#t;constructor(e="id",t=1){this.#e=e,this.#t=t}make(){return Symbol(`${this.#e}${this.#t++}`)}};var _t=[],Be=()=>_t.at(-1),cs=(s,e)=>{_t.push(s);try{return e()}finally{_t.pop()}};var cr=s=>s!=null&&typeof s.then=="function",ge=class s{static idGen=new ye("ef");static Destroy="destroy";static count=0;id;callback;#e;#t=new Set;#s=new Set;#i=new Map;#r=new Set;parentEffect;childEffects=[];curChildEffectSlot=0;autorun=!0;shouldRun=!0;priority;#n;#o=!1;constructor(e,t){k(this),this.callback=e;let r;t?.attach!=null&&(r=j.findOrCreate(t.attach),r.attachEffect(this)),this.autorun=t?.autorun??!0,this.#n=t?.dependencies?t.dependencies.map(i=>{switch(typeof i){case"string":case"symbol":return r.signal(i);default:return i}}):void 0,this.id=s.idGen.make(),this.priority=t?.priority??0,m(B,this.id,ae,this),++s.count}hasStaticDeps(){return this.#n!=null&&this.#n.length>0}saveSignalsFromDeps(){for(let e of this.#n)this.whenSignalIsRead(E(e).id)}static createEffect(e,t,r){let i=Array.isArray(t)?t:void 0,n=i?r??{dependencies:i}:t;n&&i&&(n.dependencies=i);let o,l=Be();return l!=null?(o=l.getCurrentChildEffect(),o==null&&(o=new s(e,n),l.attachChildEffect(o),f(B,Rt,o)),l.curChildEffectSlot++):(o=new s(e,n),f(B,Rt,o)),o.hasStaticDeps()?o.saveSignalsFromDeps():o.autorun&&o.run(),new Ge(o)}getCurrentChildEffect(){return this.childEffects[this.curChildEffectSlot]}attachChildEffect(e){this.childEffects.push(e),this.parentEffect=this}run=()=>{if(this.#o||!this.shouldRun)return;let e=us();e?e.batch(this.id,this.priority):(this.runCleanupCallback(),this.curChildEffectSlot=0,this.shouldRun=!1,f(Ue,this.id,this.id),this.hasStaticDeps()?this.#e=this.callback():(this.#s=new Set(this.#t),this.#e=cs(this,this.callback),this.cleanupLostSignals(),this.#r.clear()))};[ae](){this.shouldRun=!0,this.autorun&&this.run()}whenSignalIsRead(e){this.#s.delete(e),this.#t.has(e)||(this.#t.add(e),this.#i.set(e,[m(he,e,this.priority,ae,this),S(W,e,Pt,this)]))}[Pt](e){!this.#r.has(e)&&this.#t.has(e)&&(this.#r.add(e),this.unsubscribeSignal(e),this.#r.size===this.#t.size&&this.destroy())}cleanupLostSignals(){for(let e of this.#s)this.unsubscribeSignal(e),this.#t.delete(e)}unsubscribeSignal(e){this.#i.has(e)&&(this.#i.get(e).forEach(t=>{t()}),this.#i.delete(e))}runCleanupCallback(){if(this.#e!=null){let e=this.#e;this.#e=void 0,cr(e)?Promise.resolve(e).then(t=>{typeof t=="function"&&t()}):e()}}destroy=()=>{this.#o||(f(this,s.Destroy,this),x(this),f(B,ls,this),this.runCleanupCallback(),x(he,this),x(B,this),x(W,this),this.#o=!0,this.#t.clear(),this.#s.clear(),this.#i.clear(),this.#r.clear(),this.childEffects.forEach(e=>{e.destroy()}),this.childEffects.length=0,--s.count)}};var w=(...s)=>ge.createEffect(...s);var Se=new WeakMap,dr=s=>{let e=Se.get(s);return e||(e={},Se.set(s,e)),e},R=(s,e)=>Se.get(s)?.signals?.get(e);var ds=(s,e,t)=>{let r=dr(s);r.signals??=new Map,r.signals.set(e,t)};function xe(...s){for(let e of s)if(Se.has(e)){let t=Se.get(e);if(t.signals){for(let r of t.signals.values())A(r);t.signals.clear(),t.signals=void 0}}}function fs(s){let e=E(q(s)?s:R(...s));e!=null&&!e.muted&&!e.destroyed&&qe(e.id,e.value,{touch:!0})}function ue(s){return q(s)?E(s)?.value:E(R(...s))?.value}var He=class{[L];constructor(e){this[L]=e}get get(){return this[L].reader}get set(){return this[L].writer}get value(){return ue(this.get)}set value(e){this.set(e)}onChange(e){let{destroy:t}=w(()=>e(this.value),[this.get]);return t}get muted(){return this[L].muted}set muted(e){this[L].muted=e}touch(){fs(this)}destroy(){A(this)}};var fr=new ye("si");function ps(s){Ve()||Be()?.whenSignalIsRead(s)}function qe(s,e,t){Ve()||f(he,s,e,t)}var q=s=>s!=null&&s[L]!=null,pr=s=>{let e=t=>(t?w(()=>(s.destroyed||ps(s.id),t(s.value)),[e]):s.destroyed||(s.beforeRead?.(),ps(s.id)),s.value);return Object.defineProperty(e,L,{value:s}),e},Qe=class s{static instanceCount=0;id;lazy;get[L](){return this}compare;beforeRead;muted=!1;destroyed=!1;#e=void 0;get value(){return this.lazy&&(this.#e=this.valueFn(),this.valueFn=void 0,this.lazy=!1),this.#e}set value(e){this.#e=e}valueFn;reader;writer=(e,t)=>{let r=t?.lazy??!1,n=t?.compare??this.compare??((l,a)=>l===a);if((r!==this.lazy||r&&e!==this.valueFn||!r&&!n(e,this.#e))&&(r?(this.#e=void 0,this.valueFn=e,this.lazy=!0):(this.#e=e,this.valueFn=void 0,this.lazy=!1),!this.muted&&!this.destroyed)){qe(this.id,this.#e);return}(t?.touch??!1)&&qe(this.id,this.#e,{touch:!0})};object;constructor(e,t){this.id=fr.make(),++s.instanceCount,this.lazy=e,this.lazy?(this.value=void 0,this.valueFn=t):(this.value=t,this.valueFn=void 0),this.reader=pr(this),this.object=new He(this)}},E=s=>s?.[L];function d(s=void 0,e){let t;if(q(s))t=E(s);else{let r=e?.lazy??!1;t=new Qe(r,s),t.beforeRead=e?.beforeRead,t.compare=e?.compare}return e?.attach!=null&&j.findOrCreate(e.attach).attachSignal(t),t.object}var A=(...s)=>{for(let e of s){let t=E(e);t!=null&&!t.destroyed&&(t.destroyed=!0,t.beforeRead=void 0,--Qe.instanceCount,f(W,t.id,t.id))}};function Nt(s,e){let t=d(),r=e?.attach!=null?j.findOrCreate(e.attach):void 0;r!=null&&(e?.name?r.attachSignalByName(e.name,t):r.attachSignal(t));let i=w(()=>{O(()=>{t.set(s())})},{autorun:!(e?.lazy??!1),priority:e?.priority??V.C,attach:r}),n=E(t);return n.beforeRead=i.run,S(W,n.id,i.destroy),t.get}var Ye=class{#e=!1;#t;source;lastValue;isDestroyed=!1;constructor(e){k(this),this.source=E(e),this.#t=m(he,this.source.id,(t,r)=>{!this.#e&&!this.isDestroyed&&(r?.touch===!0?this.touch():this.write())}),S(W,this.source.id,()=>this.destroy())}attach(e){let t=j.findOrCreate(e);return t.attachLink(this),S(this,J,()=>{t.detachLink(this)}),t}nextValue(){return new Promise((e,t)=>{let r=[],i=()=>r.forEach(n=>{n()});r.push(S(this,pe,n=>{i(),e(n)}),S(this,J,()=>{i(),t()}))})}async*asyncValues(e){let t=0;for(;!this.isDestroyed;)try{let r=await this.nextValue();if(e&&e(r,t++))break;G(this,pe),yield r}catch{break}K(this,pe)}destroy(){this.isDestroyed||(this.#t?.(),this.#t=void 0,f(this,J,this),K(this,pe),x(this),this.lastValue=void 0,this.isDestroyed=!0,Object.freeze(this))}get isMuted(){return this.#e}mute(){return!this.isDestroyed&&!this.#e&&(this.#e=!0,f(this,Mt,this)),this}unmute(){return!this.isDestroyed&&this.#e&&(this.#e=!1,f(this,Lt,this)),this}toggleMute(){return this.isDestroyed||(this.#e=!this.#e,f(this,this.#e?Mt:Lt,this)),this.#e}updateValue(e){if(!this.#e&&!this.isDestroyed){let{value:t}=this.source;e(t),f(this,pe,t),this.lastValue=t}}},Ke=class extends Ye{target;constructor(e,t){super(e),this.target=E(t),S(W,this.target.id,()=>this.destroy()),this.touch()}touch(){return this.updateValue(e=>{this.target.writer(e,{touch:!0})}),this}write(){this.updateValue(e=>{this.target.writer(e)})}},Je=class extends Ye{target;constructor(e,t){super(e),this.target=t,this.touch()}touch(){return this.updateValue(e=>{this.target(e)}),this}write(){this.updateValue(e=>{this.target(e)})}};var Ze=new Map;function M(s,e,t){let r=E(s),i;if(Ze.has(r)){i=Ze.get(r);let c=E(e)??e;if(i.has(c))return i.get(c)}else i=new Map,Ze.set(r,i);let n=E(e),o=n!=null?new Ke(s,n):new Je(s,e),l=t?.attach;l&&o.attach(l);let a=n??e;return i.set(a,o),S(o,J,()=>{i.delete(a),i.size===0&&Ze.delete(r)}),o}var Xe=class s{static fromProps(e,t){let r=new s,i=t?t.map(n=>[n,e[n]]):Object.entries(e);for(let[n,o]of i)r.#e.set(n,d(o));return r}#e=new Map;keys(){return this.#e.keys()}signals(){return this.#e.values()}entries(){return this.#e.entries()}clear(){for(let e of this.#e.values())e.destroy();this.#e.clear()}has(e){return this.#e.has(e)}get(e){if(!this.#e.has(e)){let t=d();return this.#e.set(e,t),t}return this.#e.get(e)}update(e){e.size&&O(()=>{for(let[t,r]of e.entries())this.get(t).set(r)})}updateFromProps(e,t){O(()=>{let r=t?t.map(i=>[i,e[i]]):Object.entries(e);for(let[i,n]of r)this.get(i).set(n)})}};var I;(function(s){s[s.StructuralChanges=1]="StructuralChanges",s[s.ContentUpdates=2]="ContentUpdates",s[s.Removal=3]="Removal"})(I||(I={}));var b;(function(s){s[s.CreateEntities=1]="CreateEntities",s[s.DestroyEntities=2]="DestroyEntities",s[s.SetParent=3]="SetParent",s[s.UpdateOrder=4]="UpdateOrder",s[s.ChangeProperties=5]="ChangeProperties",s[s.ChangeToken=6]="ChangeToken",s[s.SendEvents=7]="SendEvents"})(b||(b={}));var ce=Symbol.for("ShadowEntsGlobalNS"),H="#void",gs="contextLost",ys="configure",ms="changeTrail",bs="destroy",vs="loaded",ws="appliedChangeTrail",Cs="importedModule",Es="destroyed",me="messageToView",Ss=6e4,xs=6e4,ks=5e3,As=5e3,$t="shadowObjects";function Ts(s,e){s.indexOf(e)===-1&&s.push(e)}function Wt(s,e){let t=s.indexOf(e);t!==-1&&s.splice(t,1),s.push(e)}function X(s,e){let t=s.indexOf(e);t!==-1&&s.splice(t,1)}var de=s=>typeof s=="string"?s.trim()||ce:typeof s=="symbol"?s:ce;var ke="#root",Ae=class{#e;get uuid(){return this.#e}#t=0;constructor(e){this.#e=e}#s=!0;#i=0;#r=0;hasChanges(){return this.#t>0}get isNew(){return this.#s}get isCreated(){return this.#i>0&&this.#i>this.#r}get isDestroyed(){return this.#r>0&&this.#r>=this.#i}#n=H;#o;#a=0;#h;#l;#u;create(e=H,t,r=0){this.#t++,this.#i++,this.#h=e,this.#l=t??ke,this.#u=r||void 0}destroy(){this.#r++,this.#t++}clear(){this.#t=0,this.#s=!1,this.#h=void 0,this.#l=void 0,this.#u=void 0,this.#d.clear(),this.#f.length=0,this.#g.length=0,this.#p.clear()}changeToken(e){e===this.#n?this.#h=void 0:(this.#h=e,this.#t++)}setParent(e){e===this.#o?this.#l=void 0:(this.#l=e??ke,this.#t++)}changeOrder(e){e===this.#a?this.#u=void 0:(this.#u=e,this.#t++)}#c=new Map;#d=new Map;#f=[];changeProperty(e,t,r){let i=this.#c.get(e);r==null&&t!==i||r!=null&&!r(t,i)?(this.#d.set(e,t),Wt(this.#f,e),this.#t++):(this.#d.delete(e),X(this.#f,e))}removeProperty(e){let t=this.#c.has(e);this.#d.has(e)?(this.#d.delete(e),t||X(this.#f,e)):t&&(Wt(this.#f,e),this.#t++)}#g=[];#p=new Set;createEvent(e,t,r){this.#g.push({type:e,data:t}),r?.forEach(i=>this.#p.add(i)),this.#t++}transferEventsTo(e){this.#g.length>0&&(e.#g.push(...this.#g),this.#g.length=0),this.#p.size>0&&(e.#p=new Set([...e.#p,...this.#p]),this.#p.clear())}buildChangeTrail(e,t){let{isNew:r,isCreated:i,isDestroyed:n}=this;if(!(r&&n))switch(t){case I.StructuralChanges:r?e.push(this.makeCreateEntityChange()):n||(this.#l!==void 0&&!(this.#l===ke&&this.#o===void 0)?e.push(this.makeSetParentChange()):this.#u!==void 0&&this.#u!==this.#a&&e.push(this.makeUpdateOrderChange()),this.#h!==void 0&&this.#h!==this.#n&&e.push(this.makeChangeToken()));break;case I.ContentUpdates:!r&&i&&this.#f.length>0&&e.push(this.makeChangePropertyChange()),this.#g.length>0&&e.push(this.makeEvents());break;case I.Removal:n&&e.push(this.makeDestroyEntityChange());break}}makeEvents(){let e={type:b.SendEvents,uuid:this.#e,events:this.#g.slice(0)};return this.#p.size>0&&(e.transferables=Array.from(this.#p)),e}makeCreateEntityChange(){let e={type:b.CreateEntities,uuid:this.#e,token:this.#h};if(this.#n=this.#h,this.#l!==void 0){let t=this.#l===ke?void 0:this.#l;this.#o=t,t!==void 0&&(e.parentUuid=t)}return this.#d.size>0&&(e.properties=Array.from(this.#d.entries()).filter(([,t])=>t!==void 0),e.properties.forEach(([t,r])=>this.#c.set(t,r))),this.#u!==void 0&&this.#u!==this.#a&&(e.order=this.#a=this.#u),e}makeDestroyEntityChange(){return{type:b.DestroyEntities,uuid:this.#e}}makeSetParentChange(){this.#o=this.#l===ke?void 0:this.#l;let e={type:b.SetParent,uuid:this.#e,parentUuid:this.#o};return this.#u!==void 0&&this.#u!==this.#a&&(e.order=this.#a=this.#u),e}makeUpdateOrderChange(){return this.#a=this.#u??0,{type:b.UpdateOrder,uuid:this.#e,order:this.#a}}makeChangeToken(){return this.#n=this.#h??H,{type:b.ChangeToken,uuid:this.#e,token:this.#n}}makeChangePropertyChange(){let e=this.#f.map(t=>{if(this.#d.has(t)){let r=this.#d.get(t);return this.#c.set(t,r),[t,r]}else return this.#c.delete(t),[t,void 0]});return{type:b.ChangeProperties,uuid:this.#e,properties:e}}};var Os=s=>{if(!(s===void 0||s.length===0))return s.filter(e=>e.length===1||e[1]!==void 0)},It=(s,e)=>{if(s===e||e===void 0)return s;if(s===void 0)return Os(e);for(let[t,r]of e){let i=s.find(([n])=>n===t);i===void 0?s.push([t,r]):i[1]=r}return Os(s)};var et=class{#e=new Map;get[Symbol.iterator](){return this.#e.entries.bind(this.#e)}clear(){this.#e.clear()}isEmpty(){return this.#e.size===0}hasComponentState(e){return this.#e.has(e)}getComponentState(e){return this.#e.get(e)}write(e){for(let t of e)if(t.type===b.CreateEntities)this.createEntity(t);else if(this.#e.has(t.uuid))switch(t.type){case b.DestroyEntities:this.destroyEntity(t);break;case b.SetParent:this.setParent(t);break;case b.UpdateOrder:this.updateOrder(t);break;case b.ChangeToken:this.changeToken(t);break;case b.ChangeProperties:this.changeProperties(t);break}}changeProperties({uuid:e,properties:t}){let r=this.getComponentState(e);r.properties=It(r.properties,t)}changeToken({uuid:e,token:t}){this.getComponentState(e).token=t||H}updateOrder({uuid:e,order:t}){this.getComponentState(e).order=t??0}setParent({uuid:e,parentUuid:t,order:r}){let i=this.getComponentState(e);i.parentUuid=t,i.order=r??0}destroyEntity({uuid:e}){this.#e.delete(e)}createEntity({uuid:e,token:t,parentUuid:r,order:i,properties:n}){this.#e.set(e,{token:t||H,parentUuid:r,order:i??0,properties:It(void 0,n)})}};var $=class s{static{this.ReRequestParentRoots="re-request-parent-roots"}static getContextsMap(){return globalThis.__shadowEntsContexts==null&&(globalThis.__shadowEntsContexts=new Map),globalThis.__shadowEntsContexts}static get(e){let t=de(e),r=s.getContextsMap();return r.has(t)?r.get(t):new s(t)}#e=new Map;#t=[];#s=new et;constructor(e=ce){let t=de(e),r=s.getContextsMap();if(r.has(t))return r.get(t);this.ns=t,r.set(t,this)}addComponent(e){let t;this.#e.has(e.uuid)?(t=this.#e.get(e.uuid),t.component=e,t.children=[]):(t={component:e,children:[],changes:new Ae(e.uuid),propIsEqual:void 0},this.#e.set(e.uuid,t)),t.changes.create(e.token,e.parent?.uuid,e.order),e.parent?(this.addToChildren(e.parent,e),t.changes.setParent(e.parent.uuid)):this.#n(e,this.#t),this.#o=void 0}hasComponent(e){return this.#e.has(e.uuid)}hasComponents(){return this.#e.size>0}isRootComponent(e){return this.#t.includes(e.uuid)}destroyComponent(e){if(this.hasComponent(e)){let t=this.#e.get(e.uuid);t.children.slice(0).forEach(r=>this.#e.get(r)?.component.removeFromParent()),t.changes.destroy(),this.#o=void 0}}getChildren(e){return this.#e.get(e.uuid)?.children.map(t=>this.#e.get(t).component)??[]}removeFromParent(e,t){if(this.hasComponent(t)){let r=this.#e.get(e),i=this.#e.get(t.uuid),n=i.children.indexOf(e);n!==-1&&(i.children.splice(n,1),r.changes.setParent(void 0)),this.#n(r.component,this.#t),this.#o=void 0}}moveToRoot(e){let t=this.#e.get(e);t&&(t.changes?.setParent(void 0),this.#n(t.component,this.#t)),this.#o=void 0}changeToken(e,t){this.#e.get(e.uuid)?.changes.changeToken(t)}isChildOf(e,t){return this.hasComponent(t)?this.#e.get(t.uuid).children.includes(e.uuid):!1}addToChildren(e,t){let r=this.#e.get(e.uuid);if(r)this.#n(t,r.children),this.#e.get(t.uuid)?.changes.setParent(e.uuid),X(this.#t,t.uuid),this.#o=void 0;else throw new Error(`the view component ${e.uuid} cannot have a child added to it because the component do not exist!`)}removeSubTree(e){let t=this.#e.get(e);t&&(t.children.slice(0).forEach(r=>this.removeSubTree(r)),this.destroyComponent(t.component),this.#i(e))}setProperty(e,t,r,i){let n=this.#e.get(e.uuid);return n!=null?(i!=null?(n.propIsEqual??=new Map,n.propIsEqual.set(t,i)):n.propIsEqual?.has(t)&&n.propIsEqual.delete(t),n.changes.changeProperty(t,r,i)):!1}removeProperty(e,t){this.#e.get(e.uuid)?.changes.removeProperty(t)}changeOrder(e){if(e.parent){let t=this.#e.get(e.parent.uuid);X(t.children,e.uuid),this.#n(e,t.children)}else X(this.#t,e.uuid),this.#n(e,this.#t);this.#e.get(e.uuid)?.changes.changeOrder(e.order),this.#o=void 0}traverseLevelOrderBFS(){return this.#a().map(e=>e.component)}dispatchShadowObjectsEvent(e,t,r,i){this.#e.get(e.uuid)?.changes.createEvent(t,r,i)}broadcastEvent(e,t=void 0){for(let r of this.traverseLevelOrderBFS())r.dispatchEvent(e,t,!1)}dispatchMessage(e,t,r=void 0,i=!1){this.#e.get(e)?.component.dispatchEvent(t,r,i)}dispatchReRequestParentRoots(){for(let e of this.#t)this.dispatchMessage(e,s.ReRequestParentRoots)}buildChangeTrails(e=!0){let t=[];if(!this.hasComponents())return t;let r=this.#r();for(let i of r)i.buildChangeTrail(t,I.StructuralChanges);for(let i of r)i.buildChangeTrail(t,I.ContentUpdates);for(let i of r)i.buildChangeTrail(t,I.Removal),(i.isDestroyed||i.isNew&&!i.isCreated)&&this.#i(i.uuid),e&&i.clear();return this.#s.write(t),t}reCreateChanges(){if(!this.#s.isEmpty()){this.buildChangeTrails(!1);for(let[e,t]of this.#s){let r=this.#e.get(e);if(r){let i=new Ae(e);if(i.create(t.token,t.parentUuid,t.order),t.properties)for(let[n,o]of t.properties)i.changeProperty(n,o,r.propIsEqual?.get(n));r.changes.transferEventsTo(i),r.changes.clear(),r.changes=i}}this.#s.clear(),this.broadcastEvent(gs)}}clear(){if(this.#o=void 0,this.#s.clear(),this.#t.slice(0).forEach(e=>this.removeSubTree(e)),this.#t.length!==0)throw new Error("component-context panic: #rootComponents is not empty!");if(this.#e.size!==0)throw new Error("component-context panic: #components is not empty!")}#i(e){this.#e.has(e)&&(this.#e.delete(e),X(this.#t,e),this.#o=void 0)}#r(){return this.#a().filter(e=>e.changes.hasChanges()).map(e=>e.changes)}#n(e,t){if(t.length===0){t.push(e.uuid);return}if(t.includes(e.uuid))return;let r=t.length,i=new Array(r);if(i[0]=this.#e.get(t[0]).component,e.order<i[0].order){t.unshift(e.uuid);return}if(r===1){t.push(e.uuid);return}let n=r-1;if(i[n]=this.#e.get(t[n]).component,e.order>=i[n].order){t.push(e.uuid);return}if(r===2){t.splice(1,0,e.uuid);return}for(let o=n-1;o>=1;o--)if(i[o]=this.#e.get(t[o]).component,e.order>=i[o].order){t.splice(o+1,0,e.uuid);return}}#o;#a(){if(this.#o)return this.#o;let e=new Map,t=(r,i)=>{let n=this.#e.get(r);if(n!=null){e.has(i)?e.get(i).push(n):e.set(i,[n]);for(let o of n.children)t(o,i+1)}};return this.#t.forEach(r=>t(r,0)),this.#o=Array.from(e.entries()).sort((r,i)=>r[0]-i[0]).map(([,r])=>r).flat(),this.#o}};function Te(s,e,t,r,i,n){function o(N){if(N!==void 0&&typeof N!="function")throw new TypeError("Function expected");return N}for(var l=r.kind,a=l==="getter"?"get":l==="setter"?"set":"value",c=!e&&s?r.static?s:s.prototype:null,C=e||(c?Object.getOwnPropertyDescriptor(c,r.name):{}),v,u=!1,h=t.length-1;h>=0;h--){var y={};for(var g in r)y[g]=g==="access"?{}:r[g];for(var g in r.access)y.access[g]=r.access[g];y.addInitializer=function(N){if(u)throw new TypeError("Cannot add initializers after decoration has completed");n.push(o(N||null))};var p=(0,t[h])(l==="accessor"?{get:C.get,set:C.set}:C[a],y);if(l==="accessor"){if(p===void 0)continue;if(p===null||typeof p!="object")throw new TypeError("Object expected");(v=o(p.get))&&(C.get=v),(v=o(p.set))&&(C.set=v),(v=o(p.init))&&i.unshift(v)}else(v=o(p))&&(l==="field"?i.unshift(v):C[a]=v)}c&&Object.defineProperty(c,r.name,C),u=!0}function ee(s,e,t){for(var r=arguments.length>2,i=0;i<e.length;i++)t=r?e[i].call(s,t):e[i].call(s);return r?t:void 0}function Oe(s){return function(e,t){let r=s?.name||t.name,i=!!(s?.readAsValue??!1);return{get(){let n=R(this,r);if(n)return i?n.value:n.get()},set(n){R(this,r)?.set(n)},init(n){let o=d(n,s);return ds(this,r,o),j.findOrCreate(this).attachSignalByName(r,o),o.value}}}}var _="ConsoleLogger",D=`${_}Storage`,gr=!!(globalThis.location?.host?.startsWith("localhost")??!1),Re="localStorage"in globalThis,tt=Symbol.for(_),Ps=!1,Rs=s=>{if(typeof s=="boolean")return s;switch(s.toLowerCase()){case"true":case"yes":case"on":return!0;default:return!1}},zt=s=>[Re?_:void 0,...Array.isArray(s)?s:[s]].filter(Boolean).join(".");function Ft(s,e=void 0,t){let r=zt(s),i=Re?localStorage.getItem(r):globalThis[D]?.[r];return i!=null?e(i):t}function Pe(s,e){Re?localStorage.setItem(zt(s),e):(globalThis[D]==null&&(globalThis[D]={},console.debug(`${_}: Initialize`,{[D]:globalThis[D]})),globalThis[D][zt(s)]=e)}var P=class s{static{this.sharedConfig={enable:gr,debug:!1,info:!0,warn:!0,"styles.debug":"color: #111; background: #999; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em","styles.info":"color: #020; background: #8a8; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em","styles.warn":"color: #fa0; background: #a98; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em","styles.error":"color: #ff0; background: #a00; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em"}}static get isEnabled(){return s.sharedConfig.enable}static get isDebug(){return s.sharedConfig.enable&&s.sharedConfig.debug}static{this.sharedStyles={get debug(){return s.sharedConfig["styles.debug"]},set debug(e){s.sharedConfig["styles.debug"]=e},get info(){return s.sharedConfig["styles.info"]},set info(e){s.sharedConfig["styles.info"]=e},get warn(){return s.sharedConfig["styles.warn"]},set warn(e){s.sharedConfig["styles.warn"]=e},get error(){return s.sharedConfig["styles.error"]},set error(e){s.sharedConfig["styles.error"]=e}}}static loadConfig(){Re?(["enable","debug","info","warn"].forEach(e=>{this.sharedConfig[e]=Ft(e,Rs,this.sharedConfig[e])}),["debug","info","warn","error"].forEach(e=>{this.sharedStyles[e]=Ft(["styles",e],void 0,this.sharedStyles[e])}),s.isDebug&&console.debug(`${_}: Load config from localStorage`,s.sharedConfig),globalThis[_]?.[tt]||(globalThis[_]??={[tt]:!0,get enable(){return s.sharedConfig.enable},set enable(e){s.sharedConfig.enable=e,Pe("enable",e?"true":"false")},get debug(){return s.sharedConfig.debug},set debug(e){s.sharedConfig.debug=e,Pe("debug",e?"true":"false")},get info(){return s.sharedConfig.info},set info(e){s.sharedConfig.info=e,Pe("info",e?"true":"false")},get warn(){return s.sharedConfig.warn},set warn(e){s.sharedConfig.warn=e,Pe("warn",e?"true":"false")}})):globalThis[D]?.[tt]||(globalThis[D]={[tt]:!0,...s.sharedConfig,...globalThis[D]},s.sharedConfig=globalThis[D],s.isDebug&&console.debug(`${_}: Load config from ${D}`,globalThis[D]))}constructor(e){this.enable=!0,this.namespace=(e||"").trim()||_,Ps||(s.loadConfig(),Ps=!0);let t=[this.namespace,"enable"];this.enable=Ft(t,Rs,this.enable),Pe(t,Re?this.enable?"true":"false":this.enable)}get isEnabled(){return this.enable&&s.sharedConfig.enable}get isDebug(){return this.isEnabled&&s.sharedConfig.debug}get isInfo(){return this.isEnabled&&s.sharedConfig.info}get isWarn(){return this.isEnabled&&s.sharedConfig.warn}debug(...e){this.#e("debug",s.sharedStyles.debug,e)}info(...e){this.#e("info",s.sharedStyles.info,e)}warn(...e){this.#e("warn",s.sharedStyles.warn,e)}error(...e){this.#e("error",s.sharedStyles.error,e)}#e(e,t,r){console[e](`%c${this.namespace}`,t,...r)}};var F=(()=>{var s;let e,t=[],r=[],i,n=[],o=[];return class Q{static{let a=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;e=[Oe()],i=[Oe()],Te(this,null,e,{kind:"accessor",name:"viewReady",static:!1,private:!1,access:{has:c=>"viewReady"in c,get:c=>c.viewReady,set:(c,C)=>{c.viewReady=C}},metadata:a},t,r),Te(this,null,i,{kind:"accessor",name:"proxyReady",static:!1,private:!1,access:{has:c=>"proxyReady"in c,get:c=>c.proxyReady,set:(c,C)=>{c.proxyReady=C}},metadata:a},n,o),a&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a})}static{this.AfterSync="afterSync"}static{this.ContextLost="contextLost"}static{this.ContextCreated="contextCreated"}static get(a){if(a!=null)return globalThis.__shadowEnvs?.get(a)}#e;#t;#s;#i;#r;#n;#o;get viewReady(){return this.#o}set viewReady(a){this.#o=a}#a;get proxyReady(){return this.#a}set proxyReady(a){this.#a=a}#h;get isDestroyed(){return this.#h}constructor(){this.#s=!1,this.#i=!1,this.#r=!1,this.logger=new P("ShadowEnv"),this.ns$=d(),this.#o=ee(this,t,!1),this.#a=(ee(this,r),ee(this,n,!1)),this.#h=(ee(this,o),!1),this.ready=async()=>this.isReady?this:fe(this,Q.ContextCreated),this.#l=()=>{this.#s&&this.#u()},G(this,Q.ContextCreated),m(this,Q.ContextLost,V.AAA,()=>{K(this,Q.ContextCreated)}),w(()=>{if(this.viewReady&&this.proxyReady)return this.view.reCreateChanges(),f(this,Q.ContextCreated,this),this.#i&&(this.#i=!1,this.#u()),()=>{f(this,Q.ContextLost,this)}},[R(this,"viewReady"),R(this,"proxyReady")])}get view(){return this.#e}set view(a){a!==this.#e&&(this.#e&&this.#e.ns&&globalThis.__shadowEnvs&&globalThis.__shadowEnvs.delete(this.#e.ns),this.#e=a??void 0,this.#e&&this.#e.ns&&(globalThis.__shadowEnvs??=new Map,globalThis.__shadowEnvs.has(this.#e.ns)&&globalThis.__shadowEnvs.get(this.#e.ns)!==this&&this.logger.isWarn&&this.logger.warn("overwrite a namespace already in use",this.#e.ns,globalThis.__shadowEnvs.get(this.#e.ns)),globalThis.__shadowEnvs.set(this.#e.ns,this)),this.viewReady=!!a)}get envProxy(){return this.#t}set envProxy(a){if(a!==this.#t){let c=this.#t;this.#t=a??void 0,this.#t&&(this.#t.onMessageToView=this.#c.bind(this)),c&&c.destroy(),this.proxyReady=!1,a?.start().then(()=>{this.proxyReady=!0}).catch(C=>{this.logger.error("failed to start envProxy",C),this.proxyReady=!1})}}get isReady(){return!!(this.#e&&this.#t&&this.proxyReady&&!this.isDestroyed)}sync(){if(!this.isReady){this.#i=!0;return}this.#s||(this.#s=!0,queueMicrotask(this.#l))}syncWait(){return this.#r=!0,this.sync(),this.#n?this.#n:(this.#n=fe(this,Q.AfterSync).then(a=>(this.#n=void 0,a)),this.#n)}destroy(){let a=this.#e?.ns;this.envProxy?.destroy(),this.envProxy=void 0,this.view=void 0,a&&globalThis.__shadowEnvs.has(a)&&globalThis.__shadowEnvs.get(a)===this&&globalThis.__shadowEnvs.delete(a),xe(this),x(this),this.#h=!0,Object.freeze(this)}#l;async#u(){if(this.#s=!1,this.isReady){let a=this.view.buildChangeTrails();if(a.length>0)try{let c=this.#r;this.#r=!1,await this.envProxy.applyChangeTrail(a,c)}catch(c){this.logger.error("failed to apply change trail",c)}finally{f(this,Q.AfterSync,a)}}}#c(a){this.logger.isDebug&&this.logger.debug("onMessageToView",a.type,a.data),this.view?.dispatchMessage(a.uuid,a.type,a.data,a.traverseChildren)}}})();var T=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],yr=()=>{let s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(T[s&255]+T[s>>8&255]+T[s>>16&255]+T[s>>24&255]+"-"+T[e&255]+T[e>>8&255]+"-"+T[e>>16&15|64]+T[e>>24&255]+"-"+T[t&63|128]+T[t>>8&255]+"-"+T[t>>16&255]+T[t>>24&255]+T[r&255]+T[r>>8&255]+T[r>>16&255]+T[r>>24&255]).toLowerCase()},Ms=()=>globalThis?.crypto?.randomUUID?.()??yr();var Me=class extends Error{constructor(e){super(e),this.name="ViewComponentError"}},st=class s{#e;#t;#s;#i;#r=0;get uuid(){return this.#e}get token(){return this.#t}set token(e){e??=H,e!==this.#t&&(this.#t=e,this.#s?.changeToken(this,e))}get parent(){return this.#i}set parent(e){if(e){if(e.#s!==this.#s)throw new Me("cannot set parent from different context");e.addChild(this)}else this.removeFromParent()}get context(){return this.#s}set context(e){this.#s!=e&&(this.#s&&this.destroy(),this.#s=e,e&&e.addComponent(this))}get order(){return this.#r}set order(e){let t=this.#r;this.#r=e??0,t!==this.#r&&this.#s.changeOrder(this)}constructor(e,t){k(this),t instanceof s&&(t={parent:t}),this.#e=t?.uuid??Ms(),this.#t=e,this.#r=t?.order??0,this.#i=t?.parent;let r=t?.context??$.get();if(this.#i&&this.#i.#s!==r)throw new Me("cannot set parent from different context");this.context=r}isChildOf(e){return this.#i===e}removeFromParent(){this.#i?(this.#s?.removeFromParent(this.uuid,this.#i),this.#i=void 0):this.#s?.moveToRoot(this.uuid)}addChild(e){if(e.#s!==this.#s)throw new Me("cannot add a child from another context");e.isChildOf(this)||(e.removeFromParent(),e.#i=this,this.#s.addToChildren(this,e))}setProperty(e,t,r){this.#s.setProperty(this,e,t,r)}removeProperty(e){this.#s.removeProperty(this,e)}dispatchShadowObjectsEvent(e,t,r){this.#s.dispatchShadowObjectsEvent(this,e,t,r)}dispatchEvent(e,t,r){if(f(this,e,t),r)for(let i of this.#s.getChildren(this))i.dispatchEvent(e,t,r)}destroy(){this.removeFromParent(),this.#s?.destroyComponent(this),this.#s=void 0}};var rt="shaeRequestEntParent",it="shaeReRequestEntParent",Ls="shae-worker",nt="shae-ent",js="shae-prop",te="token";var ot="local",Ds="no-autostart",at="no-structured-clone",z="auto-sync";var ht="name",lt="value",ut="type",ct="no-trim";var Le=new Set(["on","true","yes","local","1"]);var _s=s=>de(s.getAttribute("ns")),De=(s,e)=>{if(s.hasAttribute(e)){let t=s.getAttribute(e)?.trim()?.toLowerCase()||"1";return Le.has(t)}return!1};var Ns=(s,e)=>{e.set(_s(s))},Ut=new Set,Vt=!1,mr=s=>{Ut.add(s),Vt||(Vt=!0,queueMicrotask(()=>{Vt=!1;for(let e of Ut)F.get(e)?.sync();Ut.clear()}))},se=class extends HTMLElement{static{this.observedAttributes=["ns"]}get ns(){return this.ns$.value}set ns(e){typeof e=="symbol"?this.ns$.set(e):this.ns$.set(de(e))}constructor(){super(),this.isShaeElement=!0,this.ns$=d(ce),this.ns$.onChange(e=>{typeof e=="string"&&e.length>0?this.getAttribute("ns")!==e&&this.setAttribute("ns",e):this.removeAttribute("ns")}),Ns(this,this.ns$)}attributeChangedCallback(e){e==="ns"&&Ns(this,this.ns$)}syncShadowObjects(){mr(this.ns)}};var dt=class extends se{static{this.observedAttributes=[...se.observedAttributes,te]}get componentContext(){return this.componentContext$.value}get viewComponent(){return this.viewComponent$.value}get uuid(){return this.viewComponent?.uuid}get token(){return this.token$.value}set token(e){this.token$.set(e)}#e;constructor(){super(),this.isShaeEntElement=!0,this.componentContext$=d(),this.viewComponent$=d(),this.token$=d(),this.#n=!0,this.#d=()=>{let e=this.findShadowRootHost();e!=null&&this.dispatchEvent(new CustomEvent(it,{bubbles:!0,composed:!0,detail:{requester:this,shadowRootHost:e}}))},this.#f=e=>{let t=e.detail?.requester;if(t===this||!t?.isShaeEntElement||t.ns!==this.ns)return;e.detail?.shadowRootHost&&this.#l()},this.#g=e=>{let t=e.detail?.requester;t!==this&&t?.isShaeEntElement&&t.ns===this.ns&&(e.stopPropagation(),t.#c(this))},this.ns$.onChange(e=>{this.componentContext$.set($.get(e)),this.isConnected&&this.#l()}),this.#p(),this.token$.onChange(e=>{e==null?this.removeAttribute(te):this.getAttribute(te)!==e&&this.setAttribute(te,e)}),w(()=>{let e=this.viewComponent$.get();if(e){let t=m(e,$.ReRequestParentRoots,()=>this.#h()),r=e.context?.ns;return()=>{t(),e.destroy(),r&&r!==this.ns?F.get(r)?.sync():this.syncShadowObjects()}}}),this.token$.onChange(e=>{let t=this.viewComponent$.value;t&&(t.token=e,this.syncShadowObjects())}),this.style.display="contents"}#t;#s(){this.#t?.();let e=this.componentContext$.onChange(t=>{let r=this.token$.value,i=this.viewComponent$.value;i?i.context=t:t&&(i=new st(r,{context:t}),this.viewComponent$.set(i)),this.syncShadowObjects()});this.#t=()=>{e()}}#i(){this.#t?.(),this.#t=void 0}#r;#n;findShadowRootHost(){if(this.#n){this.#n=!1;let e=this;for(;e;){if(e.parentElement==null){let t=e.parentNode;t&&(this.#r=t.host);break}e=e.parentElement}}return this.#r}getParentNodeForObserver(){let e=this.parentNode;return e||(e.host??e)}connectedCallback(){this.#n=!0,this.addEventListener("slotchange",this.#d,{capture:!1,passive:!1}),this.addEventListener(rt,this.#g,{capture:!1,passive:!1}),this.#s(),Dt(()=>this.#p()),this.componentContext==null&&this.componentContext$.set($.get(this.ns)),this.#l(),this.componentContext?.dispatchReRequestParentRoots(),this.#o(),this.syncShadowObjects()}#o(){this.#a();let e=this.getParentNodeForObserver();e&&(this.#e=new MutationObserver((t,r)=>{for(let{target:i,removedNodes:n}of t)if(i===e){for(let o of n)if(o===this){this.#a(),this.onParentChanged(this.getParentNodeForObserver(),e);break}}}),this.#e.observe(e,{childList:!0,subtree:!1,attributes:!1}))}onParentChanged(e,t){this.#c(void 0),this.#l()}#a(){this.#e?.disconnect(),this.#e=void 0}attributeChangedCallback(e){super.attributeChangedCallback(e),e===te&&this.#p()}disconnectedCallback(){this.#n=!0,this.#a(),this.removeEventListener("slotchange",this.#d,{capture:!1}),this.removeEventListener(rt,this.#g,{capture:!1}),this.#c(void 0),this.componentContext$.set(void 0),this.syncShadowObjects(),this.#i()}#h(){this.isConnected&&(this.#c(void 0),this.#l())}#l(){this.dispatchEvent(new CustomEvent(rt,{bubbles:!0,composed:!0,detail:{requester:this}}))}#u;#c(e){if(this.entParentNode!==e)if(this.entParentNode&&this.entParentNode.removeEventListener(it,this.#f,{capture:!1}),this.entParentNode=e,this.entParentNode&&this.entParentNode.addEventListener(it,this.#f,{capture:!1,passive:!1}),this.#u?.(),this.#u=void 0,e){let t=w(()=>{let r=this.viewComponent$.get();if(r){let i=e.viewComponent$.get();r.parent=i&&i.context===r.context?i:void 0,r.parent==null&&queueMicrotask(()=>{this.#l()}),this.syncShadowObjects()}});this.#u=()=>t.destroy()}else{let t=this.viewComponent;t.parent&&(t.parent=void 0,this.syncShadowObjects())}}#d;#f;#g;#p(){if(this.hasAttribute(te)){let e=this.getAttribute(te)?.trim()||void 0;this.token$.set(e)}}};customElements.define(nt,dt);var br=s=>{let e=s.parentElement;for(;e;){if(e.isShaeEntElement)return e;e=e.parentElement}},vr=new Set(["string","text","number","bigint","float","int","integer","hex","hexadecimal","oct","octal","bin","binary","bool","boolean","[]","text[]","string[]","number[]","float[]","int[]","integer[]","hex[]","hexadecimal[]","oct[]","octal[]","bin[]","binary[]","bool[]","boolean[]","int8array","uint8array","uint8clampedarray","int16array","uint16array","int32array","uint32array","float32array","float64array","bigint64array","biguint64array","json"]),ft=class extends HTMLElement{static{this.observedAttributes=[ht,lt,ut,ct]}get name(){return this.name$.value}get value(){return this.valueOut$.value}set value(e){this.valueIn$.set(e)}get shouldTrim(){return this.shouldTrim$.value}get entNode(){return this.entNode$.value}set entNode(e){this.entNode$.set(e)}get viewComponent(){return this.viewComponent$.value}constructor(){super(),this.isShaeEntElement=!0,this.entNode$=d(),this.viewComponent$=d(),this.name$=d(),this.valueIn$=d(),this.valueOut$=d(),this.type$=d(),this.shouldTrim$=d(!0),this.logger=new P("ShaePropElement"),this.#e=()=>{this.entNode$.set(br(this))},this.#t=()=>{queueMicrotask(()=>{this.isConnected||this.entNode$.set(void 0)})},this.#s=()=>{this.name$.set(this.getAttribute(ht)?.trim()??void 0)},this.#i=()=>{this.valueIn$.set(this.getAttribute(lt))},this.#r=()=>{let e=this.getAttribute(ut)?.trim().toLowerCase();e&&!vr.has(e)&&(this.logger.isWarn&&this.logger.warn(`[${this.name}] unknown type "${e}"`,{shaeProp:this}),e=void 0),this.type$.set(e)},this.#n=()=>{this.shouldTrim$.set(!De(this,ct))},this.entNode$.onChange(e=>{if(e){let t=M(e.viewComponent$,this.viewComponent$);return()=>{t.destroy()}}else this.viewComponent$.set(void 0)}),w(()=>{let e=this.viewComponent$.get();if(e){let t=this.name$.get();if(t){let r=this.valueOut$.get();this.logger.isDebug&&this.logger.debug(`[${this.name}] view-component set-property`,t,r,e.uuid,{viewComponent:e,shaeProp:this}),e.setProperty(t,r),this.isConnected&&this.entNode?.syncShadowObjects()}}}),w(()=>{let e=this.type$.get(),t=this.shouldTrim$.get(),r=this.valueIn$.get();if(t&&typeof r=="string"&&(r=r.trim()),r=r||void 0,r!=null&&typeof r=="string"&&e)switch(e){case"string":case"text":break;case"number":r=Number(r);break;case"bigint":r=BigInt(r);break;case"float":r=parseFloat(r);break;case"int":case"integer":r=parseInt(r,10);break;case"hex":case"hexadecimal":r=parseInt(r,16);break;case"oct":case"octal":r=parseInt(r,8);break;case"bin":case"binary":r=parseInt(r,2);break;case"bool":case"boolean":r=Le.has(r.toLowerCase());break;case"[]":case"text[]":case"string[]":r=r.split(/\W+/);break;case"number[]":r=r.split(/\s+/).map(i=>Number(i));break;case"float[]":r=r.split(/\s+/).map(i=>parseFloat(i));break;case"int[]":case"integer[]":r=r.split(/\s+/).map(i=>parseInt(i));break;case"hex[]":case"hexadecimal[]":r=r.split(/\W+/).map(i=>parseInt(i,16));break;case"oct[]":case"octal[]":r=r.split(/\W+/).map(i=>parseInt(i,8));break;case"bin[]":case"binary[]":r=r.split(/\W+/).map(i=>parseInt(i,2));break;case"bool[]":case"boolean[]":r=r.split(/\W+/).map(i=>Le.has(i.toLowerCase()));break;case"int8array":r=new Int8Array(r.split(/\W+/).map(i=>Number(i)));break;case"uint8array":r=new Uint8Array(r.split(/\W+/).map(i=>Number(i)));break;case"uint8clampedarray":r=new Uint8ClampedArray(r.split(/\W+/).map(i=>Number(i)));break;case"int16array":r=new Int16Array(r.split(/\W+/).map(i=>Number(i)));break;case"uint16array":r=new Uint16Array(r.split(/\W+/).map(i=>Number(i)));break;case"int32array":r=new Int32Array(r.split(/\W+/).map(i=>Number(i)));break;case"uint32array":r=new Uint32Array(r.split(/\W+/).map(i=>Number(i)));break;case"float32array":r=new Float32Array(r.split(/\s+/).map(i=>Number(i)));break;case"float64array":r=new Float64Array(r.split(/\s+/).map(i=>Number(i)));break;case"bigint64array":r=new BigInt64Array(r.split(/\W+/).map(i=>BigInt(i)));break;case"biguint64array":r=new BigUint64Array(r.split(/\W+/).map(i=>BigInt(i)));break;case"json":r=JSON.parse(r);break;default:this.logger.isWarn&&this.logger.warn(`[${this.name}] unknown type "${e}"`,{value:r,shaeProp:this})}this.valueOut$.set(r)}),O(()=>{this.#s(),this.#i(),this.#r(),this.#n()}),this.style.display="contents"}connectedCallback(){O(()=>{this.#e(),this.#s(),this.#i(),this.#r(),this.#n()})}attributeChangedCallback(e){switch(e){case ht:this.#s();break;case lt:this.#i();break;case ut:this.#r();break;case ct:this.#n();break}}disconnectedCallback(){this.#t()}#e;#t;#s;#i;#r;#n};customElements.whenDefined(nt).then(()=>customElements.define(js,ft));var pt,Gt=null,be=class{static{this.OnFrame=Symbol("onFrame")}#e=0;#t=0;constructor(){if(Gt)return Gt;k(this),Gt=this}start(e){if(e!=null)return Ot(this)===0&&this.#i(),m(this,pt.OnFrame,e),this.#t++,()=>{this.stop(e)}}stop(e){x(this,pt.OnFrame,e),Ot(this)===0&&this.#r()}#s=e=>{f(this,pt.OnFrame,e),this.#i()};#i(){this.#e=requestAnimationFrame(this.#s)}#r(){cancelAnimationFrame(this.#e),this.#e=0}};pt=be;var gt=s=>s??void 0;var ve="value",_e=(()=>{let s,e=[],t=[];return class{static{let i=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;s=[Oe({name:ve})],Te(this,null,s,{kind:"accessor",name:"value",static:!1,private:!1,access:{has:n=>"value"in n,get:n=>n.value,set:(n,o)=>{n.value=o}},metadata:i},e,t),i&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})}static{this.Value=ve}#e;#t;#s;get value(){return this.#s}set value(i){this.#s=i}constructor(i){this.#e=[],this.#s=ee(this,e,void 0),this.value$=ee(this,t),G(this,ve),this.value$=R(this,ve),this.value$.onChange(n=>f(this,ve,n)),i&&this.add(...i)}add(...i){return this.#e.push(...i),this.#r(),this.#i(i)}unshift(...i){return this.#e.unshift(...i),this.#r(),this.#i(i)}remove(...i){this.#i(i)()}clear(){this.#e.length=0,this.#r()}dispose(){this.clear(),this.#t?.destroy(),this.#t=void 0,K(this,ve),x(this),this.value$.destroy(),xe(this)}#i(i){return()=>{for(let n of i){let o=this.#e.indexOf(n);o!==-1&&this.#e.splice(o,1)}this.#r()}}#r(){this.#t?.destroy(),this.#e.length===0?(this.#t=void 0,this.value=void 0):(this.#t=w(()=>{let i;for(let n of this.#e){let o=ue(n);if(o!=null){i=o;break}}this.value=i},this.#e),this.#t.run())}}})();var Bt="onCreate",re="onDestroy",$s="onParentChanged",Ws="onViewEvent";var qt=new Map,Ht=!1,wr=(s,e)=>{qt.set(s,e),Ht||(Ht=!0,queueMicrotask(()=>{Ht=!1;let t=Array.from(qt.entries());qt.clear();for(let[r,i]of t)r.set(i)}))},yt=class{#e;#t;#s=new Xe;#i=new Map;#r=new Map;#n;#o;#a=new Set;#h=[];#l=0;get kernel(){return this.#e}get uuid(){return this.#t}get order(){return this.#l}set order(e){this.#l!==e&&(this.#l=e,this.#n&&this.parent.resortChildren())}get parentUuid(){return this.#n||void 0}set parentUuid(e){this.#n!==e&&(this.removeFromParent(),this.#n=e||void 0,this.#o=e?this.#e.getEntity(e):void 0,this.#o&&this.#o.addChild(this))}get parent(){return!this.#o&&this.#n&&(this.#o=this.#e.getEntity(this.#n)),this.#o}set parent(e){this.parentUuid=e?.uuid}get hasParent(){return!!this.#n}get children(){return this.#h}constructor(e,t){this.#e=e,this.#t=t,S(this,re,V.Min,this)}traverse(e){e(this);for(let t of this.#h)t.traverse(e)}onDestroy(){this.#s.clear(),x(this);for(let e of this.#r.values())e.cleanup(),e.signal.destroy();this.#r.clear();for(let e of this.#i.values())e.context.set(void 0),e.unsubscribePathValue(),e.unsubscribeFromParent?.(),e.valuePath.dispose(),e.inherited.destroy(),e.provide.destroy(),e.context.destroy();this.#n=void 0,this.#o=void 0,this.#a.clear(),this.#h.length=0}addChild(e){if(this.#h.length===0){this.#a.add(e.uuid),this.#h.push(e);return}if(this.#a.has(e.uuid))throw new Error(`child with uuid: ${e.uuid} already exists! parentUuid: ${this.uuid}`);this.#a.add(e.uuid),this.#h.push(e),this.resortChildren();for(let[,t]of e.#i)e.#f(t)}resortChildren(){this.#h.sort((e,t)=>e.order-t.order)}removeChild(e){this.#a.has(e.uuid)&&(this.#a.delete(e.uuid),this.#h.splice(this.#h.indexOf(e),1))}removeFromParent(){if(this.#o){this.#o.removeChild(this),this.#o=void 0,this.#n=void 0;for(let[,e]of this.#i)e.unsubscribeFromParent&&(e.unsubscribeFromParent(),e.unsubscribeFromParent=void 0)}}reSubscribeToParentContexts(){for(let[,e]of this.#i)this.#f(e)}dispatchMessageToView(e,t,r,i=!1){this.#e.dispatchMessageToView({uuid:this.#t,type:e,data:t,transferables:r,traverseChildren:i})}dispatchViewEvents(e){for(let{type:t,data:r}of e)f(this,Ws,t,r)}dispatchViewEvent(e,t){this.dispatchViewEvents([{type:e,data:t}])}#u(e){return this.#s.get(e)}getPropertyReader(e){return this.#u(e).get}getPropertyWriter(e){return this.#u(e).set}setProperties(e){this.clearTruthyPropsCache(),O(()=>{for(let[t,r]of e)this.setProperty(t,r)})}setProperty(e,t){this.getPropertyWriter(e)(t)}getProperty(e){return ue(this.getPropertyReader(e))}propKeys(){return Array.from(this.#s.keys())}propEntries(){return Array.from(this.#s.entries()).map(([e,t])=>[e,t.value])}#c;clearTruthyPropsCache(){this.#c=void 0}truthyProps(){if(this.#c)return this.#c.size?this.#c:void 0;let e=new Set;for(let[t,r]of this.#s.entries())if(typeof t=="string"){let i=r.value;i!=null&&i!==!1&&i!==""&&e.add(t)}return this.#c=e,e.size?e:void 0}hasContext(e){return this.#i.has(e)}useContext(e){return this.#d(e).context.get}useParentContext(e){return this.#d(e).inherited.get}provideContext(e){return this.#d(e).provide}provideGlobalContext(e){if(this.#r.has(e))return this.#r.get(e).signal;let t=this.#e.findOrCreateRootContext(e),r=d(),i=t.add(r);return this.#r.set(e,{cleanup:i,signal:r}),r}#d(e){if(this.#i.has(e))return this.#i.get(e);let t=d(),r=d(),i=d(),n=new _e([r,t]),o=m(n,_e.Value,a=>{wr(i,a)}),l={name:e,inherited:t,provide:r,context:i,valuePath:n,unsubscribePathValue:o};return this.#i.set(e,l),this.#f(l),l}#f(e){if(e.unsubscribeFromParent?.(),e.unsubscribeFromParent=void 0,this.parent){let t=this.parent.#d(e.name),r=M(t.context,e.inherited);e.unsubscribeFromParent=r.destroy.bind(r)}else{let t=this.#e.findOrCreateRootContext(e.name),r=M(t.value$,e.inherited);e.unsubscribeFromParent=r.destroy.bind(r)}}};var Is=s=>{let e=s.split("@").map(t=>t.trim());if(e.length===2&&e[1])return e[0]?{key:`${e[0]}@${e[1]}`,prop:e[1],token:e[0]}:{key:e[1],prop:e[1]}},mt=(s,e)=>{for(let t of e)s.add(t)},Cr=(s,e)=>{if(s!=null)for(let t of s.constructors)e.add(t)},Ne=class{static get(e){return e??Er}#e=new Map;#t=new Map;#s=new Map;define(e,t){this.#e.has(e)?Ts(this.#e.get(e).constructors,t):this.#e.set(e,{token:e,constructors:[t]})}appendRoute(e,t){let r=Is(e);r?this.#s.has(r.key)?mt(this.#s.get(r.key).routes,t):this.#s.set(r.key,{routes:new Set(t),token:r.token}):this.#t.has(e)?mt(this.#t.get(e),t):this.#t.set(e,new Set(t))}clearRoute(e){let t=Is(e);t?this.#s.delete(t.key):this.#t.delete(e)}findTokensByRoute(e,t){let r=new Set([e]),i=this.#t.has(e)?[...this.#t.get(e)]:[];for(;i.length;){let n=i.shift();r.has(n)||(r.add(n),this.#t.has(n)&&i.push(...Array.from(this.#t.get(n)).filter(o=>!r.has(o))))}if(t){for(let o of t)this.#s.has(o)&&mt(r,this.#s.get(o).routes);let n;do{n=r.size;for(let o of new Set(r))for(let l of t){let a=`${o}@${l}`;this.#s.has(a)&&mt(r,this.#s.get(a).routes)}}while(n!==r.size)}return r}findConstructors(e,t){let r=this.findTokensByRoute(e,t),i=new Set;for(let n of r)Cr(this.#e.get(n),i);return i.size>0?Array.from(i):void 0}hasToken(e){return this.#e.has(e)}hasRoute(e){return this.#t.has(e)}clear(){this.#e.clear(),this.#t.clear()}},Er=new Ne;var Y;(function(s){s[s.CreateAndDestroy=0]="CreateAndDestroy",s[s.JustCreate=1]="JustCreate",s[s.DestroyOnly=2]="DestroyOnly"})(Y||(Y={}));var Fs=s=>s.displayName||s.name,zs=!1,Us=!1,Vs=!1,Gs=!1,Bs=!1,bt=class{#e;#t;#s;#i;#r;#n;constructor(e){this.logger=new P("Kernel"),this.#e=new Map,this.#t=new Set,this.#r=!0,this.#n=new Map,k(this),this.registry=Ne.get(e)}getEntity(e){let t=this.#e.get(e)?.entity;if(!t)throw new Error(`entity with uuid "${e}" not found!`);return t}hasEntity(e){return this.#e.has(e)}traverseLevelOrderBFS(e=!1){if(this.#r){let t=new Map,r=(i,n)=>{let o=this.getEntity(i);t.has(n)?t.get(n).push(o):t.set(n,[o]);for(let l of o.children)r(l.uuid,n+1)};this.#t.forEach(i=>{r(i,0)}),this.#s=Array.from(t.entries()).sort((i,n)=>i[0]-n[0]).flatMap(([,i])=>i),this.#i=this.#s.slice().reverse(),this.#r=!1}return e?this.#i:this.#s}getEntityGraph(){return Array.from(this.#t).map(e=>this.getEntityGraphNode(e))}getEntityGraphNode(e){if(!this.#e.has(e))return;let{token:t,entity:r}=this.#e.get(e);return{token:t,entity:r,props:Object.fromEntries(r.propEntries()),children:r.children.map(i=>this.getEntityGraphNode(i.uuid))}}upgradeEntities(){let e=new Map;for(let t of this.traverseLevelOrderBFS(!0))e.set(t.uuid,this.updateShadowObjects(t.uuid,Y.DestroyOnly));for(let t of this.traverseLevelOrderBFS(!1))this.updateShadowObjects(t.uuid,Y.JustCreate,e.get(t.uuid));e.clear()}run(e){this.logger.isDebug&&this.logger.debug("sync",e),O(()=>{for(let t of e.changeTrail)this.parse(t)})}parse(e){switch(e.type){case b.CreateEntities:this.createEntity(e.uuid,e.token,e.parentUuid,e.order,e.properties),this.#r=!0;break;case b.DestroyEntities:this.destroyEntity(e.uuid),this.#r=!0;break;case b.SetParent:this.setParent(e.uuid,e.parentUuid,e.order),this.#r=!0;break;case b.UpdateOrder:this.updateOrder(e.uuid,e.order),this.#r=!0;break;case b.ChangeProperties:this.changeProperties(e.uuid,e.properties);break;case b.ChangeToken:this.changeToken(e.uuid,e.token);break;case b.SendEvents:this.dispatchEventsToEntity(e.uuid,e.events);break}}createEntity(e,t,r,i=0,n){let o=new yt(this,e);o.order=i;let l={token:t,entity:o,usedConstructors:new Map};this.#e.set(e,l),r&&(o.parentUuid=r),o.hasParent||this.#t.add(e),n&&o.setProperties(n),this.createShadowObjects(e)}destroyEntity(e){if(!this.#e.has(e))return;let{entity:t,usedConstructors:r}=this.#e.get(e);t.removeFromParent(),f(t,re,this),r.clear(),this.#e.delete(t.uuid),this.#t.delete(t.uuid)}setParent(e,t,r=0){let i=this.getEntity(e);i.parentUuid===t&&i.order===r||(i.removeFromParent(),i.order=r,i.parentUuid=t,i.hasParent?this.#t.delete(e):this.#t.add(e),i.reSubscribeToParentContexts(),queueMicrotask(()=>{this.logger.isDebug&&this.logger.debug("entity.onParentChanged",{uuid:e,parentUuid:t,order:r,entity:i}),f(i,$s,i)}))}updateOrder(e,t){this.getEntity(e).order=t}dispatchEventsToEntity(e,t){this.getEntity(e)?.dispatchViewEvents(t)}changeProperties(e,t){this.getEntity(e).setProperties(t),this.updateShadowObjects(e)}changeToken(e,t){if(!this.#e.has(e))return;let r=this.#e.get(e);r.token!==t&&(r.token=t,this.updateShadowObjects(e))}dispatchMessageToView(e){queueMicrotask(()=>{f(this,me,e)})}updateShadowObjects(e,t=Y.CreateAndDestroy,r){let i=this.#e.get(e);r??=new Set(this.registry.findConstructors(i.token,i.entity.truthyProps()));let n=t===Y.CreateAndDestroy||t===Y.DestroyOnly,o=t===Y.CreateAndDestroy||t===Y.JustCreate;if(n){for(let[l,a]of i.usedConstructors)if(!r.has(l)){i.usedConstructors.delete(l);for(let c of a)this.destroyShadowObject(c,i.entity)}}if(o)for(let l of r)i.usedConstructors.has(l)||this.constructShadowObject(l,i);return r}constructShadowObject(e,t){let r=new Set,i=new Set,n=new Map,o=new Map,l=new Map,a=new Map,c=new Map,C=(u,h)=>{!Bs&&h!=null&&typeof h=="function"&&(console.warn('[shadow-objects] Deprecation Warning: The "isEqual" option of "useProperty()" is now passed as {compare} argument. Please update your code accordingly.'),Bs=!0);let y=typeof h=="function"?{compare:h}:h,g=c.get(u);if(g===void 0){g=d(void 0,y).get,c.set(u,g);let p=M(t.entity.getPropertyReader(u),g);i.add(p.destroy.bind(p))}return g},v=k(new e({entity:t.entity,provideContext(u,h,y){!zs&&y!=null&&typeof y=="function"&&(console.warn('[shadow-objects] Deprecation Warning: The "isEqual" option of "provideContext()" is now passed as {compare} argument. Please update your code accordingly.'),zs=!0);let g=typeof y=="function"?{compare:y}:y,p=l.get(u);if(p==null){let N=q(h),Et=N?void 0:gt(h);if(p=d(Et,g?.compare?{compare:g.compare}:void 0),N){let Ce=M(h,p);i.add(Ce.destroy.bind(Ce))}let we=M(p,t.entity.provideContext(u));i.add(we.destroy.bind(we)),l.set(u,p)}return p!=null&&(g?.clearOnDestroy??!0)&&i.add(()=>{p.set(void 0)}),p},provideGlobalContext(u,h,y){!Us&&y!=null&&typeof y=="function"&&(console.warn('[shadow-objects] Deprecation Warning: The "isEqual" option of "provideGlobalContext()" is now passed as {compare} argument. Please update your code accordingly.'),Us=!0);let g=typeof y=="function"?{compare:y}:y,p=a.get(u);if(p==null){let N=q(h),Et=N?void 0:gt(h);if(p=d(Et,g?.compare?{compare:g.compare}:void 0),N){let Ce=M(h,p);i.add(Ce.destroy.bind(Ce))}let we=M(p,t.entity.provideGlobalContext(u));i.add(we.destroy.bind(we)),a.set(u,p)}return p!=null&&(g?.clearOnDestroy??!0)&&i.add(()=>{p.set(void 0)}),p},useContext(u,h){!Vs&&h!=null&&typeof h=="function"&&(console.warn('[shadow-objects] Deprecation Warning: The "isEqual" option of "useContext()" is now passed as {compare} argument. Please update your code accordingly.'),Vs=!0);let y=typeof h=="function"?{compare:h}:h,g=n.get(u);if(g===void 0){g=d(void 0,y).get,n.set(u,g);let p=M(t.entity.useContext(u),g);i.add(p.destroy.bind(p))}return g},useParentContext(u,h){!Gs&&h!=null&&typeof h=="function"&&(console.warn('[shadow-objects] Deprecation Warning: The "isEqual" option of "useParentContext()" is now passed as {compare} argument. Please update your code accordingly.'),Gs=!0);let y=typeof h=="function"?{compare:h}:h,g=o.get(u);if(g===void 0){g=d(void 0,y).get,o.set(u,g);let p=M(t.entity.useParentContext(u),g);i.add(p.destroy.bind(p))}return g},useProperty:C,useProperties(u){let h={};for(let y in u)Object.hasOwn(u,y)&&(h[y]=C(u[y]));return h},createResource(u,h){let y=d(),g=w(()=>{let p=gt(u());return y.set(p),p!==void 0&&h?()=>{h(p),y.set(void 0)}:()=>{y.set(void 0)}});return i.add(()=>{g.destroy(),y.set(void 0),A(y)}),y},createEffect(...u){let h=w(...u);return i.add(h.destroy),h},createSignal(...u){let h=d(...u);return i.add(()=>{A(h)}),h},createMemo(...u){let h=Nt(...u);return i.add(()=>{A(h)}),h},on(...u){let h=m(...u);return i.add(h),h},once(...u){let h=S(...u);return i.add(h),h},onDestroy(u){r.add(u)}}));return this.logger.isInfo&&this.logger.info("create shadow-object",Fs(e),{shadowObject:v,entity:t.entity}),S(t.entity,re,V.Low,()=>{this.logger.isInfo&&this.logger.info("destroy shadow-object",Fs(e),{shadowObject:v,entity:t.entity});for(let h of r)h();for(let h of i)h();for(let h of n.values())A(h);for(let h of o.values())A(h);for(let h of c.values())A(h);for(let h of l.values())A(h);for(let h of a.values())A(h);r.clear(),i.clear(),n.clear(),o.clear(),c.clear(),l.clear(),a.clear();let u=t.usedConstructors.get(e);u&&(u.delete(v),u.size===0&&t.usedConstructors.delete(e))}),t.usedConstructors.has(e)?t.usedConstructors.get(e).add(v):t.usedConstructors.set(e,new Set([v])),this.attachShadowObject(v,t.entity),v}createShadowObjects(e){let t=this.#e.get(e);this.registry.findConstructors(t.token,t.entity.truthyProps())?.forEach(r=>{this.constructShadowObject(r,t)})}findShadowObjects(e){if(!this.#e.has(e))return[];let{usedConstructors:t}=this.#e.get(e);return Array.from(new Set(Array.from(t.values()).flatMap(r=>Array.from(r))))}attachShadowObject(e,t){m(t,e),typeof e[Bt]=="function"&&e[Bt](t)}destroyShadowObject(e,t){typeof e[re]=="function"&&e[re](t),f(e,re,t),x(t,e)}findOrCreateRootContext(e){let t=this.#n.get(e);return t||(t=new _e,this.#n.set(e,t)),t}destroy(){for(let e of this.#n.values())e.dispose();this.#n.clear();for(let e of this.traverseLevelOrderBFS().reverse())this.destroyEntity(e.uuid)}};async function Qt(s,e,t,r=!0){if(t.has(e)){console.warn("importModule: skipping already imported module",e);return}else t.add(e);e.extends&&await Promise.all(e.extends.map(n=>Qt(s,n,t,!1)));let{registry:i}=s;if(e.define)for(let[n,o]of Object.entries(e.define))i.define(n,o);if(e.routes)for(let[n,o]of Object.entries(e.routes))i.appendRoute(n,o);await(e.initialize?.({define:(n,o)=>i.define(n,o),kernel:s,registry:i})??Promise.resolve()),r&&s.upgradeEntities()}var vt=s=>(typeof s=="string"&&(s=new URL(s,globalThis.location.href)),s.toString());function qs(s){return s.map(e=>{if(e.transferables&&e.transferables.length>0){let{transferables:t,...r}=e;return structuredClone(r,{transfer:t})}else return structuredClone(e)})}var wt=class{#e;get registry(){return this.kernel.registry}constructor(e){this.#e=new Set,this.isLocalEnv=!0,this.disableStructuredClone=!1,this.kernel=new bt(e),m(this.kernel,me,t=>{if(this.onMessageToView!=null){let{type:r,uuid:i,traverseChildren:n}=t,o=structuredClone(t.data,{transfer:t.transferables});this.onMessageToView({type:r,uuid:i,data:o,traverseChildren:n})}})}start(){return Promise.resolve()}applyChangeTrail(e,t){let r={changeTrail:this.disableStructuredClone?e:qs(e)},i;try{this.kernel.run(r),i=Promise.resolve()}catch(n){i=Promise.reject(n)}return i}async importScript(e){let t=await import(vt(e));t[$t]&&await this.importModule(t[$t])}async importModule(e){return Qt(this.kernel,e,this.#e)}destroy(){this.kernel.destroy(),this.registry.clear(),this.#e.clear()}};function Yt(s){let e=new Blob([s],{type:"text/javascript"}),t=URL.createObjectURL(e),r=new Worker(t);return URL.revokeObjectURL(t),r}function Kt(){return Yt('var Ks=Object.defineProperty;var oe=Object.getOwnPropertySymbols;var Be=Object.prototype.hasOwnProperty,We=Object.prototype.propertyIsEnumerable;var Ys=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),qe=t=>{throw TypeError(t)};var me=(t,e,s)=>e in t?Ks(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,we=(t,e)=>{for(var s in e||(e={}))Be.call(e,s)&&me(t,s,e[s]);if(oe)for(var s of oe(e))We.call(e,s)&&me(t,s,e[s]);return t};var Je=(t,e)=>{var s={};for(var i in t)Be.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(t!=null&&oe)for(var i of oe(t))e.indexOf(i)<0&&We.call(t,i)&&(s[i]=t[i]);return s};var c=(t,e,s)=>me(t,typeof e!="symbol"?e+"":e,s),Ce=(t,e,s)=>e.has(t)||qe("Cannot "+s);var r=(t,e,s)=>(Ce(t,e,"read from private field"),s?s.call(t):e.get(t)),f=(t,e,s)=>e.has(t)?qe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),u=(t,e,s,i)=>(Ce(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s),C=(t,e,s)=>(Ce(t,e,"access private method"),s);var Ke=(t,e,s,i)=>({set _(a){u(t,e,a,s)},get _(){return r(t,e,i)}});var Ee=function(t,e){this[0]=t,this[1]=e},Ye=(t,e,s)=>{var i=(n,d,y,m)=>{try{var w=s[n](d),h=(d=w.value)instanceof Ee,l=w.done;Promise.resolve(h?d[0]:d).then(p=>h?i(n==="return"?n:"next",d[1]?{done:p.done,value:p.value}:p,y,m):y({value:p,done:l})).catch(p=>i("throw",p,y,m))}catch(p){m(p)}},a=n=>o[n]=d=>new Promise((y,m)=>i(n,d,y,m)),o={};return s=s.apply(t,e),o[Ys("asyncIterator")]=()=>o,a("next"),a("throw"),a("return"),o};var He;(function(t){t[t.StructuralChanges=1]="StructuralChanges",t[t.ContentUpdates=2]="ContentUpdates",t[t.Removal=3]="Removal"})(He||(He={}));var tt;(function(t){t[t.CreateEntities=1]="CreateEntities",t[t.DestroyEntities=2]="DestroyEntities",t[t.SetParent=3]="SetParent",t[t.UpdateOrder=4]="UpdateOrder",t[t.ChangeProperties=5]="ChangeProperties",t[t.ChangeToken=6]="ChangeToken",t[t.SendEvents=7]="SendEvents"})(tt||(tt={}));var Hs="configure",Qs="changeTrail",Xs="destroy",Zs="loaded",Qe="appliedChangeTrail",Se="importedModule",_s="destroyed",De="messageToView",ke="shadowObjects",N="ConsoleLogger",x=`${N}Storage`,ys,vs,bs,ti=!!((bs=(vs=(ys=globalThis.location)==null?void 0:ys.host)==null?void 0:vs.startsWith("localhost"))!=null&&bs),Qt="localStorage"in globalThis,he=Symbol.for(N),Xe=!1,Ze=t=>{if(typeof t=="boolean")return t;switch(t.toLowerCase()){case"true":case"yes":case"on":return!0;default:return!1}},Le=t=>[Qt?N:void 0,...Array.isArray(t)?t:[t]].filter(Boolean).join(".");function Ae(t,e=void 0,s){var o;let i=Le(t),a=Qt?localStorage.getItem(i):(o=globalThis[x])==null?void 0:o[i];return a!=null?e(a):s}function Ut(t,e){Qt?localStorage.setItem(Le(t),e):(globalThis[x]==null&&(globalThis[x]={},console.debug(`${N}: Initialize`,{[x]:globalThis[x]})),globalThis[x][Le(t)]=e)}var mt,Wt,v,ei=(v=class{constructor(e){f(this,mt);this.enable=!0,this.namespace=(e||"").trim()||N,Xe||(v.loadConfig(),Xe=!0);let s=[this.namespace,"enable"];this.enable=Ae(s,Ze,this.enable),Ut(s,Qt?this.enable?"true":"false":this.enable)}static get isEnabled(){return v.sharedConfig.enable}static get isDebug(){return v.sharedConfig.enable&&v.sharedConfig.debug}static loadConfig(){var e,s,i;Qt?(["enable","debug","info","warn"].forEach(a=>{this.sharedConfig[a]=Ae(a,Ze,this.sharedConfig[a])}),["debug","info","warn","error"].forEach(a=>{this.sharedStyles[a]=Ae(["styles",a],void 0,this.sharedStyles[a])}),v.isDebug&&console.debug(`${N}: Load config from localStorage`,v.sharedConfig),(e=globalThis[N])!=null&&e[he]||((s=globalThis[N])!=null||(globalThis[N]={[he]:!0,get enable(){return v.sharedConfig.enable},set enable(a){v.sharedConfig.enable=a,Ut("enable",a?"true":"false")},get debug(){return v.sharedConfig.debug},set debug(a){v.sharedConfig.debug=a,Ut("debug",a?"true":"false")},get info(){return v.sharedConfig.info},set info(a){v.sharedConfig.info=a,Ut("info",a?"true":"false")},get warn(){return v.sharedConfig.warn},set warn(a){v.sharedConfig.warn=a,Ut("warn",a?"true":"false")}}))):(i=globalThis[x])!=null&&i[he]||(globalThis[x]=we(we({[he]:!0},v.sharedConfig),globalThis[x]),v.sharedConfig=globalThis[x],v.isDebug&&console.debug(`${N}: Load config from ${x}`,globalThis[x]))}get isEnabled(){return this.enable&&v.sharedConfig.enable}get isDebug(){return this.isEnabled&&v.sharedConfig.debug}get isInfo(){return this.isEnabled&&v.sharedConfig.info}get isWarn(){return this.isEnabled&&v.sharedConfig.warn}debug(...e){C(this,mt,Wt).call(this,"debug",v.sharedStyles.debug,e)}info(...e){C(this,mt,Wt).call(this,"info",v.sharedStyles.info,e)}warn(...e){C(this,mt,Wt).call(this,"warn",v.sharedStyles.warn,e)}error(...e){C(this,mt,Wt).call(this,"error",v.sharedStyles.error,e)}},mt=new WeakSet,Wt=function(e,s,i){console[e](`%c${this.namespace}`,s,...i)},v.sharedConfig={enable:ti,debug:!1,info:!0,warn:!0,"styles.debug":"color: #111; background: #999; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em","styles.info":"color: #020; background: #8a8; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em","styles.warn":"color: #fa0; background: #a98; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em","styles.error":"color: #ff0; background: #a00; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em"},v.sharedStyles={get debug(){return v.sharedConfig["styles.debug"]},set debug(e){v.sharedConfig["styles.debug"]=e},get info(){return v.sharedConfig["styles.info"]},set info(e){v.sharedConfig["styles.info"]=e},get warn(){return v.sharedConfig["styles.warn"]},set warn(e){v.sharedConfig["styles.warn"]=e},get error(){return v.sharedConfig["styles.error"]},set error(e){v.sharedConfig["styles.error"]=e}},v),Ot="*",Os=1,$e=2,Ie=4,vt=Symbol.for("eventize"),si="[eventize]",pe=t=>t===Ot,js=t=>{switch(typeof t){case"string":case"symbol":return!0;default:return!1}},Ms=typeof console<"u",ii=Ms?console[console.warn?"warn":"log"].bind(console,si):()=>{},ri=(t,e,s)=>(Object.defineProperty(t,e,{value:s,configurable:!0}),t),ai=0,Ts=class{constructor(){c(this,"events",new Map);c(this,"eventNames",new Set)}static publish(t){t.sort((e,s)=>e.order-s.order).forEach(e=>e.emit())}add(t){Array.isArray(t)?t.forEach(e=>this.eventNames.add(e)):this.eventNames.add(t)}remove(t){Array.isArray(t)?t.forEach(e=>this.eventNames.delete(e)):this.eventNames.delete(t),this.clear(t)}clear(t){Array.isArray(t)?t.forEach(e=>this.events.delete(e)):this.events.delete(t)}retain(t,e){this.eventNames.has(t)&&this.events.set(t,{args:e,order:ai++})}isKnown(t){return this.eventNames.has(t)}emit(t,e,s=[]){if(pe(t))this.eventNames.forEach(i=>this.emit(i,e,s));else if(this.events.has(t)){let{order:i,args:a}=this.events.get(t);s.push({order:i,emit:()=>e.apply(t,a)})}return s}},Re=(t,e,s,i)=>{if(typeof e=="function"){let a=e.apply(t,s);a!=null&&(i==null||i(a))}},ni=(t,e,s,i)=>Re(e,e.emit,[t].concat(s),i),oi=t=>{switch(typeof t){case"function":return Os;case"string":case"symbol":return $e;case"object":return Ie}},hi=0,li=()=>++hi,Ds=class{constructor(t,e,s,i=null){c(this,"id");c(this,"eventName");c(this,"isCatchEmAll");c(this,"priority");c(this,"listener");c(this,"listenerObject");c(this,"listenerType");c(this,"callAfterApply");c(this,"isRemoved");c(this,"refCount");this.id=li(),this.eventName=t,this.isCatchEmAll=pe(t),this.listener=s,this.listenerObject=i,this.priority=e,this.listenerType=oi(s),this.callAfterApply=void 0,this.isRemoved=!1,this.refCount=1}isEqual(t,e=null){if(t===this)return!0;let s=typeof t;return s==="number"&&t===this.id?!0:e===null&&(s==="string"||s==="symbol")?t===Ot||t===this.eventName:this.listener===t&&this.listenerObject===e}apply(t,e,s){if(this.isRemoved)return;let{listener:i,listenerObject:a}=this;switch(this.listenerType){case Os:Re(a,i,e,s),this.callAfterApply&&this.callAfterApply();break;case $e:Re(a,a[i],e,s),this.callAfterApply&&this.callAfterApply();break;case Ie:{let o=i[t];if(this.isCatchEmAll||this.eventName===t){if(typeof o=="function"){let n=o.apply(i,e);n!=null&&(s==null||s(n))}else ni(t,i,e,s);this.callAfterApply&&this.callAfterApply()}break}}}},di=(t,e)=>t.priority!==e.priority?e.priority-t.priority:t.id-e.id,_e=t=>t==null?void 0:t.slice(0),ts=(t,e)=>{let s=t.indexOf(e);s>-1&&t.splice(s,1)},ui=t=>t===Ie||t===$e,xe=(t,e,s)=>{let i=t.findIndex(a=>a.isEqual(e,s));i>-1&&(t[i].isRemoved=!0,t.splice(i,1))},le=(t,e,s)=>{let i=[];for(let a of t)(e==null&&a.listenerObject===s||a.eventName===e&&a.listener===s)&&i.push(a);for(let a of i)xe(t,a,void 0)},Pe=t=>{t&&(t.forEach(e=>{e.isRemoved=!0}),t.length=0)},ci=(t,e)=>t.listenerType===e.listenerType?t.priority===e.priority&&t.eventName===e.eventName&&t.listenerObject===e.listenerObject&&t.listener===e.listener:!1,fi=(t,e)=>{if(ui(t.listenerType))return e.find(s=>ci(t,s))},pi=(t,e)=>{let s=fi(t,e);return s?(s.refCount+=1,s):(e.push(t),e.sort(di),t)},gi=class{constructor(){c(this,"namedListeners");c(this,"catchEmAllListeners");c(this,"getListenersForEventName",t=>{let e=this.namedListeners.get(t);return e||(e=[],this.namedListeners.set(t,e)),e});this.namedListeners=new Map,this.catchEmAllListeners=[]}add(t){return pi(t,t.isCatchEmAll?this.catchEmAllListeners:this.getListenersForEventName(t.eventName))}remove(t,e,s=!1){e==null&&Array.isArray(t)?t.forEach(i=>this.remove(i,null,s)):t==null||e==null&&pe(t)?this.removeAllListeners():e==null&&js(t)?Pe(this.namedListeners.get(t)):t instanceof Ds?t.isRemoved||(t.refCount-=1,t.refCount<1&&(t.isRemoved=!0,this.namedListeners.forEach(i=>ts(i,t)),ts(this.catchEmAllListeners,t))):s?pe(t)&&typeof t=="object"?le(this.catchEmAllListeners,Ot,t):this.namedListeners.forEach(i=>le(i,t,e)):(this.namedListeners.forEach(i=>{xe(i,t,e),typeof t=="object"&&le(i,void 0,t)}),xe(this.catchEmAllListeners,t,e),typeof t=="object"&&le(this.catchEmAllListeners,void 0,t))}removeAllListeners(){this.namedListeners.forEach(t=>Pe(t)),this.namedListeners.clear(),Pe(this.catchEmAllListeners)}forEach(t,e){let s=_e(this.catchEmAllListeners),i=_e(this.namedListeners.get(t));if(t===Ot||!i||i.length===0)s.forEach(e);else if(s.length===0)i.forEach(e);else{let a=i.length,o=s.length,n=0,d=0;for(;n<a||d<o;){if(n<a){let y=i[n];if(d>=o||y.priority>=s[d].priority){e(y),++n;continue}}d<o&&(e(s[d]),++d)}}}getSubscriptionCount(){let t=this.catchEmAllListeners.length;for(let e of this.namedListeners.values())t+=e.length;return t}},$t=t=>!!(t&&t[vt]);function Xt(t){if($t(t))return t;let e=new gi,s=new Ts;return ri(t,vt,{keeper:s,store:e}),t}var ve={Max:Number.POSITIVE_INFINITY,AAA:1e9,BB:1e6,C:1e3,Default:0,Low:-1e4,Min:Number.NEGATIVE_INFINITY},yi=(t,e,s,i,a,o,n)=>{let d=t.add(new Ds(s,i,a,o));return e.emit(s,d,n),d},vi=(t,e,s,i)=>{let a=s.length,o=typeof s[0],n,d,y,m;if(a>=2&&a<=3&&o==="number"?(n=Ot,[d,y,m]=s):a>=3&&a<=4&&typeof s[1]=="number"?[n,d,y,m]=s:(d=ve.Default,o==="string"||o==="symbol"||Array.isArray(s[0])?[n,y,m]=s:(n=Ot,[y,m]=s)),!y&&Ms)throw ii("called with insufficient arguments!",s),"subscribeTo() called with insufficient arguments!";let w=h=>l=>yi(t,e,l,h,y,m,i);return Array.isArray(n)?n.map(h=>Array.isArray(h)?w(h[1])(h[0]):w(d)(h)):w(d)(n)},Ls=(t,e,s)=>{let i=[],a=vi(t,e,s,i);return Ts.publish(i),a},es=t=>e=>{e.callAfterApply=()=>{t==null||t()}},Rs=(t,e)=>Object.assign(()=>V(t,e),Array.isArray(e)?{listeners:e}:{listener:e}),xs=(t,e,s,i)=>{let{store:a,keeper:o}=t[vt];Array.isArray(e)?e.forEach(n=>{a.forEach(n,d=>d.apply(n,s,i)),o.retain(n,s)}):e!==Ot&&(a.forEach(e,n=>{n.apply(e,s,i)}),o.retain(e,s))},_=(t,...e)=>{let s=Xt(t),{store:i,keeper:a}=s[vt];return Rs(s,Ls(i,a,e))},j=(t,...e)=>{let s=Xt(t),{store:i,keeper:a}=s[vt],o=Ls(i,a,e),n=Rs(s,o),d=!1,y=()=>{d||(n(),d=!0)};return Array.isArray(o)?o.forEach(es(y)):es(y)(o),y},bi=(t,e)=>new Promise(s=>{j(t,e,s)}),V=(t,e,s)=>{if(!$t(t))throw new Error("object is not eventized");let{store:i,keeper:a}=t[vt],o=typeof e,n=s!=null&&(o==="string"||o==="symbol");i.remove(e,s,n),Array.isArray(e)?a.remove(e.filter(d=>typeof d=="string")):js(e)&&a.remove(e)},E=(t,e,...s)=>{if(!$t(t))throw new Error("object is not eventized");xs(t,e,s)},mi=(t,e,...s)=>{if(!$t(t))throw new Error("object is not eventized");let i=[];return xs(t,e,s,a=>{i.push(a)}),i=i.map(a=>Array.isArray(a)?Promise.all(a):Promise.resolve(a)),i.length>0?Promise.all(i):Promise.resolve()},Ge=(t,e)=>{let s=Xt(t),{keeper:i}=s[vt];i.add(e)},ge=(t,e)=>{if(!$t(t))throw new Error("object is not eventized");let{keeper:s}=t[vt];s.clear(e)},ot=(()=>{let t=(e={})=>Xt(e);return t.inject=(e={})=>(e=Xt(e),Object.assign(e,{on:(...s)=>_(e,...s),once:(...s)=>j(e,...s),onceAsync:s=>bi(e,s),off:(s,i)=>V(e,s,i),emit:(s,...i)=>E(e,s,...i),emitAsync:(s,...i)=>mi(e,s,...i),retain:s=>Ge(e,s),retainClear:s=>ge(e,s)}),e),t.is=$t,t})(),Z=Symbol.for("signal"),jt=Symbol.for("effect"),ss=Symbol.for("destroySignal"),is=Symbol.for("createEffect"),wi=Symbol.for("destroyEffect"),Bt="value",rs="mute",as="unmute",Yt="destroy",Ht=Symbol.for("recall"),ye=ot(),Nt=ot(),bt=ot(),zs=ot(),Te,qt=(Te=class{constructor(){c(this,"delayedEffects",[])}batch(t,e){let s=this.delayedEffects.length;for(let i=0;i<s;i++){let[a,o]=this.delayedEffects[i];if(!(a>e))if(a===e){o.add(t);return}else{this.delayedEffects.splice(i,0,[e,new Set([t])]);return}}this.delayedEffects.push([e,new Set([t])])}flush(){this.run(),this.delayedEffects.length=0}run(){let t=new Set,e=[_(bt,(i,a)=>{a===Ht&&t.add(i)}),_(zs,i=>{t.add(i)})],s=this.delayedEffects.flatMap(([,i])=>Array.from(i));for(let i of s)t.has(i)||E(bt,i,i,Ht);e.forEach(i=>{i()})}},c(Te,"current"),Te),Ci=()=>qt.current;function Zt(t){let e=qt.current;e?e=void 0:e=qt.current=new qt;try{t()}finally{e&&(qt.current=void 0,e.run())}}var Ei=0;function Fs(){return Ei>0}var ms,Si=(ms=jt,class{constructor(t){c(this,ms);c(this,"run",()=>{var t;return(t=this[jt])==null?void 0:t.run()});c(this,"destroy",()=>{var t;(t=this[jt])==null||t.destroy(),this[jt]=void 0});this[jt]=t,j(t,$s.Destroy,()=>{this[jt]=void 0})}}),ht=new Map,J,wt,G,it,K,Ct,Et,U,St,nt,ne=(nt=class{constructor(e){f(this,J,new Set);f(this,wt,new Set);f(this,G,new Map);f(this,it,new WeakMap);f(this,K,new Map);f(this,Ct,new Set);f(this,Et,new Set);f(this,U);f(this,St);if(e!=null&&e instanceof nt)return e;if(e!=null||(e=this),ht.has(e))return ht.get(e);u(this,St,e),ht.set(e,this),ot(this)}static get(e){if(e!=null)return e instanceof nt?e:ht.get(e)}static findOrCreate(e){if(e==null)throw new Error("Cannot create a group with a null object");return new nt(e)}static destroy(e){console.warn("SignalGroup.destroy(obj) is deprecated. Use SignalGroup.delete(obj) instead."),nt.delete(e)}static delete(e){var s;(s=ht.get(e))==null||s.clear()}static clear(){for(let e of ht.values())e.destroy();ht.clear()}attachGroup(e){if(e===this)throw new Error("Cannot attach a group to itself");return r(this,J).add(e),r(e,U)&&r(e,U)!==this&&r(r(e,U),J).delete(e),u(e,U,this),e}detachGroup(e){return e!==this&&r(this,J).has(e)&&(r(this,J).delete(e),u(e,U,void 0)),e}attachSignal(e){let s=A(e);if(s!=null&&s.destroyed)throw new Error("Cannot attach a destroyed signal to a group");return s&&r(this,wt).add(s),e}attachSignalByName(e,s){if(s){this.attachSignal(s);let i=A(s);r(this,G).set(e,i),r(this,K).has(e)?r(this,K).get(e).push(i):r(this,K).set(e,[i]),r(this,it).has(i)?r(this,it).get(i).add(e):r(this,it).set(i,new Set([e]))}else r(this,G).delete(e);return s}hasSignal(e){var s;return r(this,G).has(e)||!!((s=r(this,U))!=null&&s.hasSignal(e))}signal(e){var s,i,a;return(a=(s=r(this,G).get(e))==null?void 0:s.object)!=null?a:(i=r(this,U))==null?void 0:i.signal(e)}detachSignal(e){let s=A(e);if(s&&(r(this,wt).delete(s),r(this,it).has(s))){let i=r(this,it).get(s);for(let a of i)if(r(this,K).has(a)){let o=r(this,K).get(a);o.splice(o.indexOf(s),1),o.length===0?(r(this,G).delete(a),r(this,K).delete(a)):r(this,G).get(a)===s&&r(this,G).set(a,o.at(-1))}i.clear(),r(this,it).delete(s)}return e}attachEffect(e){return r(this,Ct).add(e),e}runEffects(){for(let e of r(this,Ct))e.run();for(let e of r(this,J))e.runEffects()}attachLink(e){if(e!=null&&e.isDestroyed)throw new Error("Cannot attach a destroyed link to a group");return e&&r(this,Et).add(e),e}detachLink(e){return e&&r(this,Et).delete(e),e}destroy(){console.warn("SignalGroup#destroy is deprecated. Use SignalGroup#clear instead."),this.clear()}clear(){var e;E(this,Yt,this),V(this);for(let s of r(this,J))s.destroy();for(let s of r(this,Ct))s.destroy();for(let s of r(this,wt))I(s);for(let s of r(this,Et))s.destroy();r(this,J).clear(),r(this,wt).clear(),r(this,G).clear(),r(this,K).clear(),r(this,Ct).clear(),r(this,Et).clear(),(e=r(this,U))==null||e.detachGroup(this),r(this,St)&&(ht.delete(r(this,St)),u(this,St,void 0))}},J=new WeakMap,wt=new WeakMap,G=new WeakMap,it=new WeakMap,K=new WeakMap,Ct=new WeakMap,Et=new WeakMap,U=new WeakMap,St=new WeakMap,nt),se,ie,ws,Ns=(ws=class{constructor(t="id",e=1){f(this,se);f(this,ie);u(this,se,t),u(this,ie,e)}make(){return Symbol(`${r(this,se)}${Ke(this,ie)._++}`)}},se=new WeakMap,ie=new WeakMap,ws),ze=[],Vs=()=>ze.at(-1),ki=(t,e)=>{ze.push(t);try{return e()}finally{ze.pop()}},Ai=t=>t!=null&&typeof t.then=="function",O,lt,Y,kt,dt,ut,At,Dt,$s=(O=class{constructor(e,s){c(this,"id");c(this,"callback");f(this,lt);f(this,Y,new Set);f(this,kt,new Set);f(this,dt,new Map);f(this,ut,new Set);c(this,"parentEffect");c(this,"childEffects",[]);c(this,"curChildEffectSlot",0);c(this,"autorun",!0);c(this,"shouldRun",!0);c(this,"priority");f(this,At);f(this,Dt,!1);c(this,"run",()=>{if(r(this,Dt)||!this.shouldRun)return;let e=Ci();e?e.batch(this.id,this.priority):(this.runCleanupCallback(),this.curChildEffectSlot=0,this.shouldRun=!1,E(zs,this.id,this.id),this.hasStaticDeps()?u(this,lt,this.callback()):(u(this,kt,new Set(r(this,Y))),u(this,lt,ki(this,this.callback)),this.cleanupLostSignals(),r(this,ut).clear()))});c(this,"destroy",()=>{r(this,Dt)||(E(this,O.Destroy,this),V(this),E(bt,wi,this),this.runCleanupCallback(),V(ye,this),V(bt,this),V(Nt,this),u(this,Dt,!0),r(this,Y).clear(),r(this,kt).clear(),r(this,dt).clear(),r(this,ut).clear(),this.childEffects.forEach(e=>{e.destroy()}),this.childEffects.length=0,--O.count)});var a,o;ot(this),this.callback=e;let i;(s==null?void 0:s.attach)!=null&&(i=ne.findOrCreate(s.attach),i.attachEffect(this)),this.autorun=(a=s==null?void 0:s.autorun)!=null?a:!0,u(this,At,s!=null&&s.dependencies?s.dependencies.map(n=>{switch(typeof n){case"string":case"symbol":return i.signal(n);default:return n}}):void 0),this.id=O.idGen.make(),this.priority=(o=s==null?void 0:s.priority)!=null?o:0,_(bt,this.id,Ht,this),++O.count}hasStaticDeps(){return r(this,At)!=null&&r(this,At).length>0}saveSignalsFromDeps(){for(let e of r(this,At))this.whenSignalIsRead(A(e).id)}static createEffect(e,s,i){let a=Array.isArray(s)?s:void 0,o=a?i!=null?i:{dependencies:a}:s;o&&a&&(o.dependencies=a);let n,d=Vs();return d!=null?(n=d.getCurrentChildEffect(),n==null&&(n=new O(e,o),d.attachChildEffect(n),E(bt,is,n)),d.curChildEffectSlot++):(n=new O(e,o),E(bt,is,n)),n.hasStaticDeps()?n.saveSignalsFromDeps():n.autorun&&n.run(),new Si(n)}getCurrentChildEffect(){return this.childEffects[this.curChildEffectSlot]}attachChildEffect(e){this.childEffects.push(e),this.parentEffect=this}[Ht](){this.shouldRun=!0,this.autorun&&this.run()}whenSignalIsRead(e){r(this,kt).delete(e),r(this,Y).has(e)||(r(this,Y).add(e),r(this,dt).set(e,[_(ye,e,this.priority,Ht,this),j(Nt,e,ss,this)]))}[ss](e){!r(this,ut).has(e)&&r(this,Y).has(e)&&(r(this,ut).add(e),this.unsubscribeSignal(e),r(this,ut).size===r(this,Y).size&&this.destroy())}cleanupLostSignals(){for(let e of r(this,kt))this.unsubscribeSignal(e),r(this,Y).delete(e)}unsubscribeSignal(e){r(this,dt).has(e)&&(r(this,dt).get(e).forEach(s=>{s()}),r(this,dt).delete(e))}runCleanupCallback(){if(r(this,lt)!=null){let e=r(this,lt);u(this,lt,void 0),Ai(e)?Promise.resolve(e).then(s=>{typeof s=="function"&&s()}):e()}}},lt=new WeakMap,Y=new WeakMap,kt=new WeakMap,dt=new WeakMap,ut=new WeakMap,At=new WeakMap,Dt=new WeakMap,c(O,"idGen",new Ns("ef")),c(O,"Destroy","destroy"),c(O,"count",0),O),Vt=(...t)=>$s.createEffect(...t),_t=new WeakMap,Pi=t=>{let e=_t.get(t);return e||(e={},_t.set(t,e)),e},te=(t,e)=>{var s,i;return(i=(s=_t.get(t))==null?void 0:s.signals)==null?void 0:i.get(e)},Oi=(t,e,s)=>{var a;let i=Pi(t);(a=i.signals)!=null||(i.signals=new Map),i.signals.set(e,s)};function ji(...t){for(let e of t)if(_t.has(e)){let s=_t.get(e);if(s.signals){for(let i of s.signals.values())I(i);s.signals.clear(),s.signals=void 0}}}function Mi(t){let e=A(ee(t)?t:te(...t));e!=null&&!e.muted&&!e.destroyed&&Fe(e.id,e.value,{touch:!0})}function Ue(t){var e,s;return ee(t)?(e=A(t))==null?void 0:e.value:(s=A(te(...t)))==null?void 0:s.value}var Cs,Ti=(Cs=Z,class{constructor(t){c(this,Cs);this[Z]=t}get get(){return this[Z].reader}get set(){return this[Z].writer}get value(){return Ue(this.get)}set value(t){this.set(t)}onChange(t){let{destroy:e}=Vt(()=>t(this.value),[this.get]);return e}get muted(){return this[Z].muted}set muted(t){this[Z].muted=t}touch(){Mi(this)}destroy(){I(this)}}),Di=new Ns("si");function ns(t){var e;Fs()||((e=Vs())==null||e.whenSignalIsRead(t))}function Fe(t,e,s){Fs()||E(ye,t,e,s)}var ee=t=>t!=null&&t[Z]!=null,Li=t=>{let e=s=>{var i;return s?Vt(()=>(t.destroyed||ns(t.id),s(t.value)),[e]):t.destroyed||((i=t.beforeRead)==null||i.call(t),ns(t.id)),t.value};return Object.defineProperty(e,Z,{value:t}),e},Pt,B,Is=(Pt=class{constructor(e,s){c(this,"id");c(this,"lazy");c(this,"compare");c(this,"beforeRead");c(this,"muted",!1);c(this,"destroyed",!1);f(this,B);c(this,"valueFn");c(this,"reader");c(this,"writer",(e,s)=>{var o,n,d,y;let i=(o=s==null?void 0:s.lazy)!=null?o:!1,a=(d=(n=s==null?void 0:s.compare)!=null?n:this.compare)!=null?d:((m,w)=>m===w);if((i!==this.lazy||i&&e!==this.valueFn||!i&&!a(e,r(this,B)))&&(i?(u(this,B,void 0),this.valueFn=e,this.lazy=!0):(u(this,B,e),this.valueFn=void 0,this.lazy=!1),!this.muted&&!this.destroyed)){Fe(this.id,r(this,B));return}(y=s==null?void 0:s.touch)!=null&&y&&Fe(this.id,r(this,B),{touch:!0})});c(this,"object");this.id=Di.make(),++Pt.instanceCount,this.lazy=e,this.lazy?(this.value=void 0,this.valueFn=s):(this.value=s,this.valueFn=void 0),this.reader=Li(this),this.object=new Ti(this)}get[Z](){return this}get value(){return this.lazy&&(u(this,B,this.valueFn()),this.valueFn=void 0,this.lazy=!1),r(this,B)}set value(e){u(this,B,e)}},B=new WeakMap,c(Pt,"instanceCount",0),Pt),A=t=>t==null?void 0:t[Z];function k(t=void 0,e){var i;let s;if(ee(t))s=A(t);else{let a=(i=e==null?void 0:e.lazy)!=null?i:!1;s=new Is(a,t),s.beforeRead=e==null?void 0:e.beforeRead,s.compare=e==null?void 0:e.compare}return(e==null?void 0:e.attach)!=null&&ne.findOrCreate(e.attach).attachSignal(s),s.object}var I=(...t)=>{for(let e of t){let s=A(e);s!=null&&!s.destroyed&&(s.destroyed=!0,s.beforeRead=void 0,--Is.instanceCount,E(Nt,s.id,s.id))}};function Ri(t,e){var n,d;let s=k(),i=(e==null?void 0:e.attach)!=null?ne.findOrCreate(e.attach):void 0;i!=null&&(e!=null&&e.name?i.attachSignalByName(e.name,s):i.attachSignal(s));let a=Vt(()=>{Zt(()=>{s.set(t())})},{autorun:!((n=e==null?void 0:e.lazy)!=null&&n),priority:(d=e==null?void 0:e.priority)!=null?d:ve.C,attach:i}),o=A(s);return o.beforeRead=a.run,j(Nt,o.id,a.destroy),s.get}var P,Lt,Es,Gs=(Es=class{constructor(t){f(this,P,!1);f(this,Lt);c(this,"source");c(this,"lastValue");c(this,"isDestroyed",!1);ot(this),this.source=A(t),u(this,Lt,_(ye,this.source.id,(e,s)=>{!r(this,P)&&!this.isDestroyed&&((s==null?void 0:s.touch)===!0?this.touch():this.write())})),j(Nt,this.source.id,()=>this.destroy())}attach(t){let e=ne.findOrCreate(t);return e.attachLink(this),j(this,Yt,()=>{e.detachLink(this)}),e}nextValue(){return new Promise((t,e)=>{let s=[],i=()=>s.forEach(a=>{a()});s.push(j(this,Bt,a=>{i(),t(a)}),j(this,Yt,()=>{i(),e()}))})}asyncValues(t){return Ye(this,null,function*(){let e=0;for(;!this.isDestroyed;)try{let s=yield new Ee(this.nextValue());if(t&&t(s,e++))break;Ge(this,Bt),yield s}catch(s){break}ge(this,Bt)})}destroy(){var t;this.isDestroyed||((t=r(this,Lt))==null||t.call(this),u(this,Lt,void 0),E(this,Yt,this),ge(this,Bt),V(this),this.lastValue=void 0,this.isDestroyed=!0,Object.freeze(this))}get isMuted(){return r(this,P)}mute(){return!this.isDestroyed&&!r(this,P)&&(u(this,P,!0),E(this,rs,this)),this}unmute(){return!this.isDestroyed&&r(this,P)&&(u(this,P,!1),E(this,as,this)),this}toggleMute(){return this.isDestroyed||(u(this,P,!r(this,P)),E(this,r(this,P)?rs:as,this)),r(this,P)}updateValue(t){if(!r(this,P)&&!this.isDestroyed){let{value:e}=this.source;t(e),E(this,Bt,e),this.lastValue=e}}},P=new WeakMap,Lt=new WeakMap,Es),xi=class extends Gs{constructor(e,s){super(e);c(this,"target");this.target=A(s),j(Nt,this.target.id,()=>this.destroy()),this.touch()}touch(){return this.updateValue(e=>{this.target.writer(e,{touch:!0})}),this}write(){this.updateValue(e=>{this.target.writer(e)})}},zi=class extends Gs{constructor(e,s){super(e);c(this,"target");this.target=s,this.touch()}touch(){return this.updateValue(e=>{this.target(e)}),this}write(){this.updateValue(e=>{this.target(e)})}},de=new Map;function et(t,e,s){var m;let i=A(t),a;if(de.has(i)){a=de.get(i);let w=(m=A(e))!=null?m:e;if(a.has(w))return a.get(w)}else a=new Map,de.set(i,a);let o=A(e),n=o!=null?new xi(t,o):new zi(t,e),d=s==null?void 0:s.attach;d&&n.attach(d);let y=o!=null?o:e;return a.set(y,n),j(n,Yt,()=>{a.delete(y),a.size===0&&de.delete(i)}),n}var D,Rt,Fi=(Rt=class{constructor(){f(this,D,new Map)}static fromProps(e,s){let i=new Rt,a=s?s.map(o=>[o,e[o]]):Object.entries(e);for(let[o,n]of a)r(i,D).set(o,k(n));return i}keys(){return r(this,D).keys()}signals(){return r(this,D).values()}entries(){return r(this,D).entries()}clear(){for(let e of r(this,D).values())e.destroy();r(this,D).clear()}has(e){return r(this,D).has(e)}get(e){if(!r(this,D).has(e)){let s=k();return r(this,D).set(e,s),s}return r(this,D).get(e)}update(e){e.size&&Zt(()=>{for(let[s,i]of e.entries())this.get(s).set(i)})}updateFromProps(e,s){Zt(()=>{let i=s?s.map(a=>[a,e[a]]):Object.entries(e);for(let[a,o]of i)this.get(a).set(o)})}},D=new WeakMap,Rt),Oe=t=>t!=null?t:void 0;function Ni(t,e,s,i,a,o){function n($){if($!==void 0&&typeof $!="function")throw new TypeError("Function expected");return $}for(var d=i.kind,y=d==="getter"?"get":d==="setter"?"set":"value",m=!e&&t?i.static?t:t.prototype:null,w=e||(m?Object.getOwnPropertyDescriptor(m,i.name):{}),h,l=!1,p=s.length-1;p>=0;p--){var g={};for(var b in i)g[b]=b==="access"?{}:i[b];for(var b in i.access)g.access[b]=i.access[b];g.addInitializer=function($){if(l)throw new TypeError("Cannot add initializers after decoration has completed");o.push(n($||null))};var T=(0,s[p])(d==="accessor"?{get:w.get,set:w.set}:w[y],g);if(d==="accessor"){if(T===void 0)continue;if(T===null||typeof T!="object")throw new TypeError("Object expected");(h=n(T.get))&&(w.get=h),(h=n(T.set))&&(w.set=h),(h=n(T.init))&&a.unshift(h)}else(h=n(T))&&(d==="field"?a.unshift(h):w[y]=h)}m&&Object.defineProperty(m,i.name,w),l=!0}function os(t,e,s){for(var i=arguments.length>2,a=0;a<e.length;a++)s=i?e[a].call(t,s):e[a].call(t);return i?s:void 0}function Vi(t){return function(e,s){var o;let i=(t==null?void 0:t.name)||s.name,a=!!((o=t==null?void 0:t.readAsValue)!=null&&o);return{get(){let n=te(this,i);if(n)return a?n.value:n.get()},set(n){var d;(d=te(this,i))==null||d.set(n)},init(n){let d=k(n,t);return Oi(this,i,d),ne.findOrCreate(this).attachSignalByName(i,d),d.value}}}}var Mt="value",Ne=(()=>{var i,a,o,n,ce,Jt,m;let t,e=[],s=[];return m=class{constructor(h){f(this,n);f(this,i);f(this,a);f(this,o);u(this,i,[]),u(this,o,os(this,e,void 0)),this.value$=os(this,s),Ge(this,Mt),this.value$=te(this,Mt),this.value$.onChange(l=>E(this,Mt,l)),h&&this.add(...h)}get value(){return r(this,o)}set value(h){u(this,o,h)}add(...h){return r(this,i).push(...h),C(this,n,Jt).call(this),C(this,n,ce).call(this,h)}unshift(...h){return r(this,i).unshift(...h),C(this,n,Jt).call(this),C(this,n,ce).call(this,h)}remove(...h){C(this,n,ce).call(this,h)()}clear(){r(this,i).length=0,C(this,n,Jt).call(this)}dispose(){var h;this.clear(),(h=r(this,a))==null||h.destroy(),u(this,a,void 0),ge(this,Mt),V(this),this.value$.destroy(),ji(this)}},i=new WeakMap,a=new WeakMap,o=new WeakMap,n=new WeakSet,ce=function(h){return()=>{for(let l of h){let p=r(this,i).indexOf(l);p!==-1&&r(this,i).splice(p,1)}C(this,n,Jt).call(this)}},Jt=function(){var h;(h=r(this,a))==null||h.destroy(),r(this,i).length===0?(u(this,a,void 0),this.value=void 0):(u(this,a,Vt(()=>{let l;for(let p of r(this,i)){let g=Ue(p);if(g!=null){l=g;break}}this.value=l},r(this,i))),r(this,a).run())},(()=>{let h=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;t=[Vi({name:Mt})],Ni(m,null,t,{kind:"accessor",name:"value",static:!1,private:!1,access:{has:l=>"value"in l,get:l=>l.value,set:(l,p)=>{l.value=p}},metadata:h},e,s),h&&Object.defineProperty(m,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})})(),m.Value=Mt,m})(),hs="onCreate",Tt="onDestroy",$i="onParentChanged",Ii="onViewEvent",je=new Map,Me=!1,Gi=(t,e)=>{je.set(t,e),Me||(Me=!0,queueMicrotask(()=>{Me=!1;let s=Array.from(je.entries());je.clear();for(let[i,a]of s)i.set(a)}))},H,xt,ct,W,ft,z,L,rt,F,zt,M,Ve,pt,Kt,fe,Ss,Ui=(Ss=class{constructor(t,e){f(this,M);f(this,H);f(this,xt);f(this,ct,new Fi);f(this,W,new Map);f(this,ft,new Map);f(this,z);f(this,L);f(this,rt,new Set);f(this,F,[]);f(this,zt,0);f(this,pt);u(this,H,t),u(this,xt,e),j(this,Tt,ve.Min,this)}get kernel(){return r(this,H)}get uuid(){return r(this,xt)}get order(){return r(this,zt)}set order(t){r(this,zt)!==t&&(u(this,zt,t),r(this,z)&&this.parent.resortChildren())}get parentUuid(){return r(this,z)||void 0}set parentUuid(t){r(this,z)!==t&&(this.removeFromParent(),u(this,z,t||void 0),u(this,L,t?r(this,H).getEntity(t):void 0),r(this,L)&&r(this,L).addChild(this))}get parent(){return!r(this,L)&&r(this,z)&&u(this,L,r(this,H).getEntity(r(this,z))),r(this,L)}set parent(t){this.parentUuid=t==null?void 0:t.uuid}get hasParent(){return!!r(this,z)}get children(){return r(this,F)}traverse(t){t(this);for(let e of r(this,F))e.traverse(t)}onDestroy(){var t;r(this,ct).clear(),V(this);for(let e of r(this,ft).values())e.cleanup(),e.signal.destroy();r(this,ft).clear();for(let e of r(this,W).values())e.context.set(void 0),e.unsubscribePathValue(),(t=e.unsubscribeFromParent)==null||t.call(e),e.valuePath.dispose(),e.inherited.destroy(),e.provide.destroy(),e.context.destroy();u(this,z,void 0),u(this,L,void 0),r(this,rt).clear(),r(this,F).length=0}addChild(t){var e;if(r(this,F).length===0){r(this,rt).add(t.uuid),r(this,F).push(t);return}if(r(this,rt).has(t.uuid))throw new Error(`child with uuid: ${t.uuid} already exists! parentUuid: ${this.uuid}`);r(this,rt).add(t.uuid),r(this,F).push(t),this.resortChildren();for(let[,s]of r(t,W))C(e=t,M,fe).call(e,s)}resortChildren(){r(this,F).sort((t,e)=>t.order-e.order)}removeChild(t){r(this,rt).has(t.uuid)&&(r(this,rt).delete(t.uuid),r(this,F).splice(r(this,F).indexOf(t),1))}removeFromParent(){if(r(this,L)){r(this,L).removeChild(this),u(this,L,void 0),u(this,z,void 0);for(let[,t]of r(this,W))t.unsubscribeFromParent&&(t.unsubscribeFromParent(),t.unsubscribeFromParent=void 0)}}reSubscribeToParentContexts(){for(let[,t]of r(this,W))C(this,M,fe).call(this,t)}dispatchMessageToView(t,e,s,i=!1){r(this,H).dispatchMessageToView({uuid:r(this,xt),type:t,data:e,transferables:s,traverseChildren:i})}dispatchViewEvents(t){for(let{type:e,data:s}of t)E(this,Ii,e,s)}dispatchViewEvent(t,e){this.dispatchViewEvents([{type:t,data:e}])}getPropertyReader(t){return C(this,M,Ve).call(this,t).get}getPropertyWriter(t){return C(this,M,Ve).call(this,t).set}setProperties(t){this.clearTruthyPropsCache(),Zt(()=>{for(let[e,s]of t)this.setProperty(e,s)})}setProperty(t,e){this.getPropertyWriter(t)(e)}getProperty(t){return Ue(this.getPropertyReader(t))}propKeys(){return Array.from(r(this,ct).keys())}propEntries(){return Array.from(r(this,ct).entries()).map(([t,e])=>[t,e.value])}clearTruthyPropsCache(){u(this,pt,void 0)}truthyProps(){if(r(this,pt))return r(this,pt).size?r(this,pt):void 0;let t=new Set;for(let[e,s]of r(this,ct).entries())if(typeof e=="string"){let i=s.value;i!=null&&i!==!1&&i!==""&&t.add(e)}return u(this,pt,t),t.size?t:void 0}hasContext(t){return r(this,W).has(t)}useContext(t){return C(this,M,Kt).call(this,t).context.get}useParentContext(t){return C(this,M,Kt).call(this,t).inherited.get}provideContext(t){return C(this,M,Kt).call(this,t).provide}provideGlobalContext(t){if(r(this,ft).has(t))return r(this,ft).get(t).signal;let e=r(this,H).findOrCreateRootContext(t),s=k(),i=e.add(s);return r(this,ft).set(t,{cleanup:i,signal:s}),s}},H=new WeakMap,xt=new WeakMap,ct=new WeakMap,W=new WeakMap,ft=new WeakMap,z=new WeakMap,L=new WeakMap,rt=new WeakMap,F=new WeakMap,zt=new WeakMap,M=new WeakSet,Ve=function(t){return r(this,ct).get(t)},pt=new WeakMap,Kt=function(t){if(r(this,W).has(t))return r(this,W).get(t);let e=k(),s=k(),i=k(),a=new Ne([s,e]),o=_(a,Ne.Value,d=>{Gi(i,d)}),n={name:t,inherited:e,provide:s,context:i,valuePath:a,unsubscribePathValue:o};return r(this,W).set(t,n),C(this,M,fe).call(this,n),n},fe=function(t){var e,s;if((e=t.unsubscribeFromParent)==null||e.call(t),t.unsubscribeFromParent=void 0,this.parent){let i=C(s=this.parent,M,Kt).call(s,t.name),a=et(i.context,t.inherited);t.unsubscribeFromParent=a.destroy.bind(a)}else{let i=r(this,H).findOrCreateRootContext(t.name),a=et(i.value$,t.inherited);t.unsubscribeFromParent=a.destroy.bind(a)}},Ss);function Bi(t,e){t.indexOf(e)===-1&&t.push(e)}var ls=t=>{let e=t.split("@").map(s=>s.trim());if(e.length===2&&e[1])return e[0]?{key:`${e[0]}@${e[1]}`,prop:e[1],token:e[0]}:{key:e[1],prop:e[1]}},ue=(t,e)=>{for(let s of e)t.add(s)},Wi=(t,e)=>{if(t!=null)for(let s of t.constructors)e.add(s)},at,R,q,ks,Us=(ks=class{constructor(){f(this,at,new Map);f(this,R,new Map);f(this,q,new Map)}static get(t){return t!=null?t:qi}define(t,e){r(this,at).has(t)?Bi(r(this,at).get(t).constructors,e):r(this,at).set(t,{token:t,constructors:[e]})}appendRoute(t,e){let s=ls(t);s?r(this,q).has(s.key)?ue(r(this,q).get(s.key).routes,e):r(this,q).set(s.key,{routes:new Set(e),token:s.token}):r(this,R).has(t)?ue(r(this,R).get(t),e):r(this,R).set(t,new Set(e))}clearRoute(t){let e=ls(t);e?r(this,q).delete(e.key):r(this,R).delete(t)}findTokensByRoute(t,e){let s=new Set([t]),i=r(this,R).has(t)?[...r(this,R).get(t)]:[];for(;i.length;){let a=i.shift();s.has(a)||(s.add(a),r(this,R).has(a)&&i.push(...Array.from(r(this,R).get(a)).filter(o=>!s.has(o))))}if(e){for(let o of e)r(this,q).has(o)&&ue(s,r(this,q).get(o).routes);let a;do{a=s.size;for(let o of new Set(s))for(let n of e){let d=`${o}@${n}`;r(this,q).has(d)&&ue(s,r(this,q).get(d).routes)}}while(a!==s.size)}return s}findConstructors(t,e){let s=this.findTokensByRoute(t,e),i=new Set;for(let a of s)Wi(r(this,at).get(a),i);return i.size>0?Array.from(i):void 0}hasToken(t){return r(this,at).has(t)}hasRoute(t){return r(this,R).has(t)}clear(){r(this,at).clear(),r(this,R).clear()}},at=new WeakMap,R=new WeakMap,q=new WeakMap,ks),qi=new Us,st;(function(t){t[t.CreateAndDestroy=0]="CreateAndDestroy",t[t.JustCreate=1]="JustCreate",t[t.DestroyOnly=2]="DestroyOnly"})(st||(st={}));var ds=t=>t.displayName||t.name,us=!1,cs=!1,fs=!1,ps=!1,gs=!1,S,Q,Ft,re,X,gt,As,Ji=(As=class{constructor(t){f(this,S);f(this,Q);f(this,Ft);f(this,re);f(this,X);f(this,gt);this.logger=new ei("Kernel"),u(this,S,new Map),u(this,Q,new Set),u(this,X,!0),u(this,gt,new Map),ot(this),this.registry=Us.get(t)}getEntity(t){var s;let e=(s=r(this,S).get(t))==null?void 0:s.entity;if(!e)throw new Error(`entity with uuid "${t}" not found!`);return e}hasEntity(t){return r(this,S).has(t)}traverseLevelOrderBFS(t=!1){if(r(this,X)){let e=new Map,s=(i,a)=>{let o=this.getEntity(i);e.has(a)?e.get(a).push(o):e.set(a,[o]);for(let n of o.children)s(n.uuid,a+1)};r(this,Q).forEach(i=>{s(i,0)}),u(this,Ft,Array.from(e.entries()).sort((i,a)=>i[0]-a[0]).flatMap(([,i])=>i)),u(this,re,r(this,Ft).slice().reverse()),u(this,X,!1)}return t?r(this,re):r(this,Ft)}getEntityGraph(){return Array.from(r(this,Q)).map(t=>this.getEntityGraphNode(t))}getEntityGraphNode(t){if(!r(this,S).has(t))return;let{token:e,entity:s}=r(this,S).get(t);return{token:e,entity:s,props:Object.fromEntries(s.propEntries()),children:s.children.map(i=>this.getEntityGraphNode(i.uuid))}}upgradeEntities(){let t=new Map;for(let e of this.traverseLevelOrderBFS(!0))t.set(e.uuid,this.updateShadowObjects(e.uuid,st.DestroyOnly));for(let e of this.traverseLevelOrderBFS(!1))this.updateShadowObjects(e.uuid,st.JustCreate,t.get(e.uuid));t.clear()}run(t){this.logger.isDebug&&this.logger.debug("sync",t),Zt(()=>{for(let e of t.changeTrail)this.parse(e)})}parse(t){switch(t.type){case tt.CreateEntities:this.createEntity(t.uuid,t.token,t.parentUuid,t.order,t.properties),u(this,X,!0);break;case tt.DestroyEntities:this.destroyEntity(t.uuid),u(this,X,!0);break;case tt.SetParent:this.setParent(t.uuid,t.parentUuid,t.order),u(this,X,!0);break;case tt.UpdateOrder:this.updateOrder(t.uuid,t.order),u(this,X,!0);break;case tt.ChangeProperties:this.changeProperties(t.uuid,t.properties);break;case tt.ChangeToken:this.changeToken(t.uuid,t.token);break;case tt.SendEvents:this.dispatchEventsToEntity(t.uuid,t.events);break}}createEntity(t,e,s,i=0,a){let o=new Ui(this,t);o.order=i;let n={token:e,entity:o,usedConstructors:new Map};r(this,S).set(t,n),s&&(o.parentUuid=s),o.hasParent||r(this,Q).add(t),a&&o.setProperties(a),this.createShadowObjects(t)}destroyEntity(t){if(!r(this,S).has(t))return;let{entity:e,usedConstructors:s}=r(this,S).get(t);e.removeFromParent(),E(e,Tt,this),s.clear(),r(this,S).delete(e.uuid),r(this,Q).delete(e.uuid)}setParent(t,e,s=0){let i=this.getEntity(t);i.parentUuid===e&&i.order===s||(i.removeFromParent(),i.order=s,i.parentUuid=e,i.hasParent?r(this,Q).delete(t):r(this,Q).add(t),i.reSubscribeToParentContexts(),queueMicrotask(()=>{this.logger.isDebug&&this.logger.debug("entity.onParentChanged",{uuid:t,parentUuid:e,order:s,entity:i}),E(i,$i,i)}))}updateOrder(t,e){this.getEntity(t).order=e}dispatchEventsToEntity(t,e){var s;(s=this.getEntity(t))==null||s.dispatchViewEvents(e)}changeProperties(t,e){this.getEntity(t).setProperties(e),this.updateShadowObjects(t)}changeToken(t,e){if(!r(this,S).has(t))return;let s=r(this,S).get(t);s.token!==e&&(s.token=e,this.updateShadowObjects(t))}dispatchMessageToView(t){queueMicrotask(()=>{E(this,De,t)})}updateShadowObjects(t,e=st.CreateAndDestroy,s){let i=r(this,S).get(t);s!=null||(s=new Set(this.registry.findConstructors(i.token,i.entity.truthyProps())));let a=e===st.CreateAndDestroy||e===st.DestroyOnly,o=e===st.CreateAndDestroy||e===st.JustCreate;if(a){for(let[n,d]of i.usedConstructors)if(!s.has(n)){i.usedConstructors.delete(n);for(let y of d)this.destroyShadowObject(y,i.entity)}}if(o)for(let n of s)i.usedConstructors.has(n)||this.constructShadowObject(n,i);return s}constructShadowObject(t,e){let s=new Set,i=new Set,a=new Map,o=new Map,n=new Map,d=new Map,y=new Map,m=(h,l)=>{!gs&&l!=null&&typeof l=="function"&&(console.warn(\'[shadow-objects] Deprecation Warning: The "isEqual" option of "useProperty()" is now passed as {compare} argument. Please update your code accordingly.\'),gs=!0);let p=typeof l=="function"?{compare:l}:l,g=y.get(h);if(g===void 0){g=k(void 0,p).get,y.set(h,g);let b=et(e.entity.getPropertyReader(h),g);i.add(b.destroy.bind(b))}return g},w=ot(new t({entity:e.entity,provideContext(h,l,p){var T;!us&&p!=null&&typeof p=="function"&&(console.warn(\'[shadow-objects] Deprecation Warning: The "isEqual" option of "provideContext()" is now passed as {compare} argument. Please update your code accordingly.\'),us=!0);let g=typeof p=="function"?{compare:p}:p,b=n.get(h);if(b==null){let $=ee(l),be=$?void 0:Oe(l);if(b=k(be,g!=null&&g.compare?{compare:g.compare}:void 0),$){let Gt=et(l,b);i.add(Gt.destroy.bind(Gt))}let It=et(b,e.entity.provideContext(h));i.add(It.destroy.bind(It)),n.set(h,b)}return b!=null&&((T=g==null?void 0:g.clearOnDestroy)==null||T)&&i.add(()=>{b.set(void 0)}),b},provideGlobalContext(h,l,p){var T;!cs&&p!=null&&typeof p=="function"&&(console.warn(\'[shadow-objects] Deprecation Warning: The "isEqual" option of "provideGlobalContext()" is now passed as {compare} argument. Please update your code accordingly.\'),cs=!0);let g=typeof p=="function"?{compare:p}:p,b=d.get(h);if(b==null){let $=ee(l),be=$?void 0:Oe(l);if(b=k(be,g!=null&&g.compare?{compare:g.compare}:void 0),$){let Gt=et(l,b);i.add(Gt.destroy.bind(Gt))}let It=et(b,e.entity.provideGlobalContext(h));i.add(It.destroy.bind(It)),d.set(h,b)}return b!=null&&((T=g==null?void 0:g.clearOnDestroy)==null||T)&&i.add(()=>{b.set(void 0)}),b},useContext(h,l){!fs&&l!=null&&typeof l=="function"&&(console.warn(\'[shadow-objects] Deprecation Warning: The "isEqual" option of "useContext()" is now passed as {compare} argument. Please update your code accordingly.\'),fs=!0);let p=typeof l=="function"?{compare:l}:l,g=a.get(h);if(g===void 0){g=k(void 0,p).get,a.set(h,g);let b=et(e.entity.useContext(h),g);i.add(b.destroy.bind(b))}return g},useParentContext(h,l){!ps&&l!=null&&typeof l=="function"&&(console.warn(\'[shadow-objects] Deprecation Warning: The "isEqual" option of "useParentContext()" is now passed as {compare} argument. Please update your code accordingly.\'),ps=!0);let p=typeof l=="function"?{compare:l}:l,g=o.get(h);if(g===void 0){g=k(void 0,p).get,o.set(h,g);let b=et(e.entity.useParentContext(h),g);i.add(b.destroy.bind(b))}return g},useProperty:m,useProperties(h){let l={};for(let p in h)Object.hasOwn(h,p)&&(l[p]=m(h[p]));return l},createResource(h,l){let p=k(),g=Vt(()=>{let b=Oe(h());return p.set(b),b!==void 0&&l?()=>{l(b),p.set(void 0)}:()=>{p.set(void 0)}});return i.add(()=>{g.destroy(),p.set(void 0),I(p)}),p},createEffect(...h){let l=Vt(...h);return i.add(l.destroy),l},createSignal(...h){let l=k(...h);return i.add(()=>{I(l)}),l},createMemo(...h){let l=Ri(...h);return i.add(()=>{I(l)}),l},on(...h){let l=_(...h);return i.add(l),l},once(...h){let l=j(...h);return i.add(l),l},onDestroy(h){s.add(h)}}));return this.logger.isInfo&&this.logger.info("create shadow-object",ds(t),{shadowObject:w,entity:e.entity}),j(e.entity,Tt,ve.Low,()=>{this.logger.isInfo&&this.logger.info("destroy shadow-object",ds(t),{shadowObject:w,entity:e.entity});for(let l of s)l();for(let l of i)l();for(let l of a.values())I(l);for(let l of o.values())I(l);for(let l of y.values())I(l);for(let l of n.values())I(l);for(let l of d.values())I(l);s.clear(),i.clear(),a.clear(),o.clear(),y.clear(),n.clear(),d.clear();let h=e.usedConstructors.get(t);h&&(h.delete(w),h.size===0&&e.usedConstructors.delete(t))}),e.usedConstructors.has(t)?e.usedConstructors.get(t).add(w):e.usedConstructors.set(t,new Set([w])),this.attachShadowObject(w,e.entity),w}createShadowObjects(t){var s;let e=r(this,S).get(t);(s=this.registry.findConstructors(e.token,e.entity.truthyProps()))==null||s.forEach(i=>{this.constructShadowObject(i,e)})}findShadowObjects(t){if(!r(this,S).has(t))return[];let{usedConstructors:e}=r(this,S).get(t);return Array.from(new Set(Array.from(e.values()).flatMap(s=>Array.from(s))))}attachShadowObject(t,e){_(e,t),typeof t[hs]=="function"&&t[hs](e)}destroyShadowObject(t,e){typeof t[Tt]=="function"&&t[Tt](e),E(t,Tt,e),V(e,t)}findOrCreateRootContext(t){let e=r(this,gt).get(t);return e||(e=new Ne,r(this,gt).set(t,e)),e}destroy(){for(let t of r(this,gt).values())t.dispose();r(this,gt).clear();for(let t of this.traverseLevelOrderBFS().reverse())this.destroyEntity(t.uuid)}},S=new WeakMap,Q=new WeakMap,Ft=new WeakMap,re=new WeakMap,X=new WeakMap,gt=new WeakMap,As);async function Bs(t,e,s,i=!0){var o,n;if(s.has(e)){console.warn("importModule: skipping already imported module",e);return}else s.add(e);e.extends&&await Promise.all(e.extends.map(d=>Bs(t,d,s,!1)));let{registry:a}=t;if(e.define)for(let[d,y]of Object.entries(e.define))a.define(d,y);if(e.routes)for(let[d,y]of Object.entries(e.routes))a.appendRoute(d,y);await((n=(o=e.initialize)==null?void 0:o.call(e,{define:(d,y)=>a.define(d,y),kernel:t,registry:a}))!=null?n:Promise.resolve()),i&&t.upgradeEntities()}var Ki=t=>(typeof t=="string"&&(t=new URL(t,globalThis.location.href)),t.toString()),ae,yt,Ws,qs,Js,Ps,Yi=(Ps=class{constructor(t){f(this,yt);f(this,ae,new Set);var e,s;this.kernel=(e=t==null?void 0:t.kernel)!=null?e:new Ji,this.postMessage=(s=t==null?void 0:t.postMessage)!=null?s:self.postMessage.bind(self),_(this.kernel,De,"onMessageToView",this)}route(t){var e;switch(t.data.type){case Hs:C(this,yt,Ws).call(this,t.data);break;case Qs:C(this,yt,qs).call(this,t.data);break;case Xs:C(this,yt,Js).call(this,t.data);break;default:console.warn("[MessageRouter] unknown message",(e=t.data.type)!=null?e:t.data)}}onMessageToView(t){let i=t,{transferables:e}=i,s=Je(i,["transferables"]);this.postMessage({type:De,data:s},{transfer:e})}},ae=new WeakMap,yt=new WeakSet,Ws=async function(t){try{let e=await import(Ki(t.importModule));e[ke]?(await Bs(this.kernel,e[ke],r(this,ae)),this.postMessage({type:Se,url:t.importModule})):this.postMessage({type:Se,url:t.importModule,error:`module has no "${ke}" export`})}catch(e){console.error("[MessageRouter] failed to import module",e),this.postMessage({type:Se,url:t.importModule,error:`${e}`})}},qs=function(t){try{this.kernel.run(t)}catch(e){console.error("[MessageRouter] failed to apply change trail",e),this.postMessage({type:Qe,serial:t.serial,error:e.toString()})}t.serial&&this.postMessage({type:Qe,serial:t.serial})},Js=function(t){console.debug("[MessageRouter] on destroy",t),V(this.kernel,this),r(this,ae).clear(),this.postMessage({type:_s})},Ps),Hi=class{constructor(){this.onmessage=t=>{var e;t.data.type===N?globalThis[x]=t.data.config:((e=this.router)!=null||(this.router=new Yi),this.router.route(t))}}start(){self.addEventListener("message",this.onmessage),self.postMessage({type:Zs})}};console.debug("@spearwolf/shadow-objects/WorkerRuntime: hello!");var Qi=new Hi;Qi.start();\n/*! Bundled license information:\n\n@spearwolf/eventize/lib/index.mjs:\n (*!\n =============================================================================\n @spearwolf/eventize 4.0.2+build.20250807\n \u2014 https://github.com/spearwolf/eventize.git\n =============================================================================\n \n Copyright 2015-2025 Wolfger Schramm\n \n Licensed under the Apache License, Version 2.0 (the "License");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an "AS IS" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n *)\n*/\n')}var Hs=()=>new Kt;var $e=(s,e,t=1e3,r)=>new Promise((i,n)=>{let o,l,a=()=>{clearTimeout(o),s.removeEventListener("message",l)};t!==0&&t!==1/0&&(o=setTimeout(()=>{a(),n(new Error(`Timeout waiting for message of type: ${e}`))},t)),l=c=>{if(c.data.type===e)try{(!r||r(c.data))&&(a(),i())}catch(C){a(),n(C.toString())}},s.addEventListener("message",l)});var Sr=s=>{let e;if(s!=null&&Array.isArray(s))for(let t of s)t.transferables&&(e?e=[...e,...t.transferables]:e=t.transferables,delete t.transferables);return e},Ct=class s{static{this.WorkerLoaded="workerLoaded"}#e;#t;#s;get isDestroyed(){return this.#t}get workerLoaded(){return fe(this,s.WorkerLoaded)}constructor(){this.#t=!1,this.#s=0,this.logger=new P("RemoteWorkerEnv"),G(this,s.WorkerLoaded)}async start(){if(this.#e)return this.logger.isWarn&&this.logger.warn("already started"),this.workerLoaded.then(()=>{if(this.isDestroyed)throw"worker was destroyed"});let e=this.#e=Hs();this.configureConsoleLogger(e);try{if(await $e(e,vs,Ss),this.isDestroyed)throw"worker was destroyed";e.addEventListener("message",this.onMessageFromWorker.bind(this)),queueMicrotask(()=>{f(this,s.WorkerLoaded,this)})}catch(t){throw this.logger.error("failed to start",t),this.#e=void 0,t}}applyChangeTrail(e,t){let r=Sr(e),i={type:ms,changeTrail:e},n=++this.#s;return t&&(i.serial=n),this.#e.postMessage(i,r),t?$e(this.#e,ws,ks,o=>{if(o.error)throw o.error;return o.serial===n}):Promise.resolve()}importScript(e){return e=vt(e),this.#e.postMessage({type:ys,importModule:e}),$e(this.#e,Cs,xs,t=>{if(t.error)throw t.error;return t.url===e})}destroy(){if(!this.#e)return;let e=this.#e;this.#e=void 0,this.#t=!0,e.postMessage({type:bs}),$e(e,Es,As).finally(()=>{e.terminate()})}onMessageFromWorker(e){e.data?.type===me?this.onMessageToView?.(e.data.data):this.logger.isDebug&&this.logger.debug("message from worker",e)}configureConsoleLogger(e){let t=`${_}.RemoteWorkerEnv.workerConfig`,r=JSON.parse(localStorage.getItem(t)??"{}");this.logger.isInfo&&this.logger.info("load console-logger worker config",{localStorageKey:t,workerConfig:r}),e.postMessage({type:_,config:{...P.sharedConfig,enable:this.logger.isEnabled,...r,...P.isEnabled?{}:{enable:!1}}})}};var We,Ie=class extends se{static{this.observedAttributes=[...se.observedAttributes,ot,"src",at]}static{this.DefaultAutoSync="frame"}#e;#t;#s;#i;#r;constructor(){super(),this.isShaeWorkerElement=!0,this.shadowEnv=new F,this.logger=new P("ShaeWorkerElement"),this.autostart=!0,this.isConnected$=d(!1),this.autoSync$=d(We.DefaultAutoSync),this.src$=d(""),this.#e=!1,this.#t=!1,this.ns$.onChange(e=>{this.shadowEnv.view=$.get(e)}),m(this.shadowEnv,F.ContextCreated,()=>{this.#r?.run(),this.dispatchEvent(new CustomEvent(F.ContextCreated.toLowerCase(),{bubbles:!1,detail:{shadowEnv:this.shadowEnv}}))}),m(this.shadowEnv,F.ContextLost,()=>{this.dispatchEvent(new CustomEvent(F.ContextLost.toLowerCase(),{bubbles:!1,detail:{shadowEnv:this.shadowEnv}}))}),this.autoSync$.onChange(e=>{let t=this.hasAttribute(z),r=t?this.getAttribute(z):void 0;e===We.DefaultAutoSync?t&&r!==e&&this.setAttribute(z,e):r!==e&&this.setAttribute(z,e)}),this.#a(),this.#n(),this.style.display="contents"}#n(){this.#r=w(()=>{let e=this.src$.get();e&&this.importScript(e)},{autorun:!1})}get shouldAutostart(){return this.autostart&&!De(this,Ds)}get autoSync(){return this.autoSync$.value}set autoSync(e){typeof e!="string"&&(e=e?We.DefaultAutoSync:"no"),this.autoSync$.set(`${e}`.trim().toLowerCase())}get frameLoop(){return this.#s??=new be,this.#s}[be.OnFrame](){this.syncShadowObjects()}async importScript(e){if(!e)throw new Error("src is blank");let t=await this.shadowEnv.ready();return this.logger.isInfo&&this.logger.info("shadowEnv importScript:",e,{shadowEnv:t}),await t.envProxy.importScript(e),this}connectedCallback(){O(()=>{this.hasAttribute(z)&&this.autoSync$.set(this.getAttribute(z)),this.isConnected$.set(!0)}),this.shouldAutostart&&this.start()}disconnectedCallback(){this.isConnected$.set(!1),this.#o()}attributeChangedCallback(e){if(super.attributeChangedCallback(e),e===ot&&this.shadowEnv.envProxy!=null)throw new Error('Changing the "local" attribute after the shadowEnv has been created is not supported.');if(e===at&&this.#h(),e===z&&(this.autoSync=this.hasAttribute(z)?this.getAttribute(z):!0),e==="src"){let t=(this.getAttribute("src")||"").trim();this.src$.set(t),this.shadowEnv.isReady&&this.#r?.run()}}start(){if(!this.#t){if(this.#e=!1,this.shadowEnv.view??=$.get(this.ns),this.shadowEnv.envProxy==null){let e=De(this,ot)?new wt:new Ct;this.shadowEnv.envProxy=e,this.#h()}this.#t=!0}return this.shadowEnv.ready()}destroy(){this.#i?.destroy(),this.#r?.destroy(),A(this.isConnected$,this.autoSync$,this.src$),this.shadowEnv.envProxy=void 0,this.shadowEnv.destroy()}#o(){this.#e||(this.#e=!0,queueMicrotask(()=>{this.#e&&this.destroy()}))}#a(){this.#i=w(()=>{if(this.isConnected$.get()){let e=(this.autoSync$.get()||We.DefaultAutoSync).trim().toLowerCase(),t;if(["true","yes","on","frame","auto-sync"].includes(e))return this.logger.isDebug&&this.logger.debug("auto-sync",e,this),this.frameLoop.start(this),()=>{this.frameLoop.stop(this)};if(e.toLowerCase().endsWith("fps")){let r=parseInt(e,10);r>0?t=Math.floor(1e3/r):this.logger.isWarn&&this.logger.warn(`invalid auto-sync value: ${e}`)}else t=parseInt(e,10),isNaN(t)&&(t=void 0,["false","no","off"].includes(e)||this.logger.error(`invalid auto-sync value: ${e}`));if(t!==void 0&&t>0){this.logger.isDebug&&this.logger.debug("auto-sync interval (ms)",t,this);let r=setInterval(()=>{this.syncShadowObjects()},t);return()=>{clearInterval(r)}}else this.logger.isDebug&&this.logger.debug("auto-sync off",this)}},[this.autoSync$,this.isConnected$])}#h(){let e=this.shadowEnv.envProxy;e?.isLocalEnv&&(e.disableStructuredClone=this.hasAttribute(at))}};We=Ie;customElements.define(Ls,Ie);globalThis.SHADOW_ENTS_BUNDLE_LOADED=!0;
21
+ var ie="*",ts=1,At=2,Tt=4,V=Symbol.for("eventize"),Qs="[eventize]",ze=s=>s===ie,ss=s=>{switch(typeof s){case"string":case"symbol":return!0;default:return!1}},rs=typeof console<"u",Ys=rs?console[console.warn?"warn":"log"].bind(console,Qs):()=>{},Ks=(s,e,t)=>(Object.defineProperty(s,e,{value:t,configurable:!0}),s),Js=0,is=class{static publish(s){s.sort((e,t)=>e.order-t.order).forEach(e=>e.emit())}events=new Map;eventNames=new Set;add(s){Array.isArray(s)?s.forEach(e=>this.eventNames.add(e)):this.eventNames.add(s)}remove(s){Array.isArray(s)?s.forEach(e=>this.eventNames.delete(e)):this.eventNames.delete(s),this.clear(s)}clear(s){Array.isArray(s)?s.forEach(e=>this.events.delete(e)):this.events.delete(s)}retain(s,e){this.eventNames.has(s)&&this.events.set(s,{args:e,order:Js++})}isKnown(s){return this.eventNames.has(s)}emit(s,e,t=[]){if(ze(s))this.eventNames.forEach(r=>this.emit(r,e,t));else if(this.events.has(s)){let{order:r,args:i}=this.events.get(s);t.push({order:r,emit:()=>e.apply(s,i)})}return t}},xt=(s,e,t,r)=>{if(typeof e=="function"){let i=e.apply(s,t);i!=null&&r?.(i)}},Zs=(s,e,t,r)=>xt(e,e.emit,[s].concat(t),r),Xs=s=>{switch(typeof s){case"function":return ts;case"string":case"symbol":return At;case"object":return Tt}},er=0,tr=()=>++er,ns=class{id;eventName;isCatchEmAll;priority;listener;listenerObject;listenerType;callAfterApply;isRemoved;refCount;constructor(s,e,t,r=null){this.id=tr(),this.eventName=s,this.isCatchEmAll=ze(s),this.listener=t,this.listenerObject=r,this.priority=e,this.listenerType=Xs(t),this.callAfterApply=void 0,this.isRemoved=!1,this.refCount=1}isEqual(s,e=null){if(s===this)return!0;let t=typeof s;return t==="number"&&s===this.id?!0:e===null&&(t==="string"||t==="symbol")?s===ie||s===this.eventName:this.listener===s&&this.listenerObject===e}apply(s,e,t){if(this.isRemoved)return;let{listener:r,listenerObject:i}=this;switch(this.listenerType){case ts:xt(i,r,e,t),this.callAfterApply&&this.callAfterApply();break;case At:xt(i,i[r],e,t),this.callAfterApply&&this.callAfterApply();break;case Tt:{let n=r[s];if(this.isCatchEmAll||this.eventName===s){if(typeof n=="function"){let o=n.apply(r,e);o!=null&&t?.(o)}else Zs(s,r,e,t);this.callAfterApply&&this.callAfterApply()}break}}}},sr=(s,e)=>s.priority!==e.priority?e.priority-s.priority:s.id-e.id,Zt=s=>s?.slice(0),Xt=(s,e)=>{let t=s.indexOf(e);t>-1&&s.splice(t,1)},rr=s=>s===Tt||s===At,kt=(s,e,t)=>{let r=s.findIndex(i=>i.isEqual(e,t));r>-1&&(s[r].isRemoved=!0,s.splice(r,1))},Fe=(s,e,t)=>{let r=[];for(let i of s)(e==null&&i.listenerObject===t||i.eventName===e&&i.listener===t)&&r.push(i);for(let i of r)kt(s,i,void 0)},St=s=>{s&&(s.forEach(e=>{e.isRemoved=!0}),s.length=0)},ir=(s,e)=>s.listenerType===e.listenerType?s.priority===e.priority&&s.eventName===e.eventName&&s.listenerObject===e.listenerObject&&s.listener===e.listener:!1,nr=(s,e)=>{if(rr(s.listenerType))return e.find(t=>ir(s,t))},or=(s,e)=>{let t=nr(s,e);return t?(t.refCount+=1,t):(e.push(s),e.sort(sr),s)},ar=class{namedListeners;catchEmAllListeners;getListenersForEventName=s=>{let e=this.namedListeners.get(s);return e||(e=[],this.namedListeners.set(s,e)),e};constructor(){this.namedListeners=new Map,this.catchEmAllListeners=[]}add(s){return or(s,s.isCatchEmAll?this.catchEmAllListeners:this.getListenersForEventName(s.eventName))}remove(s,e,t=!1){e==null&&Array.isArray(s)?s.forEach(r=>this.remove(r,null,t)):s==null||e==null&&ze(s)?this.removeAllListeners():e==null&&ss(s)?St(this.namedListeners.get(s)):s instanceof ns?s.isRemoved||(s.refCount-=1,s.refCount<1&&(s.isRemoved=!0,this.namedListeners.forEach(r=>Xt(r,s)),Xt(this.catchEmAllListeners,s))):t?ze(s)&&typeof s=="object"?Fe(this.catchEmAllListeners,ie,s):this.namedListeners.forEach(r=>Fe(r,s,e)):(this.namedListeners.forEach(r=>{kt(r,s,e),typeof s=="object"&&Fe(r,void 0,s)}),kt(this.catchEmAllListeners,s,e),typeof s=="object"&&Fe(this.catchEmAllListeners,void 0,s))}removeAllListeners(){this.namedListeners.forEach(s=>St(s)),this.namedListeners.clear(),St(this.catchEmAllListeners)}forEach(s,e){let t=Zt(this.catchEmAllListeners),r=Zt(this.namedListeners.get(s));if(s===ie||!r||r.length===0)t.forEach(e);else if(t.length===0)r.forEach(e);else{let i=r.length,n=t.length,o=0,l=0;for(;o<i||l<n;){if(o<i){let a=r[o];if(l>=n||a.priority>=t[l].priority){e(a),++o;continue}}l<n&&(e(t[l]),++l)}}}getSubscriptionCount(){let s=this.catchEmAllListeners.length;for(let e of this.namedListeners.values())s+=e.length;return s}},ne=s=>!!(s&&s[V]);function Ee(s){if(ne(s))return s;let e=new ar,t=new is;return Ks(s,V,{keeper:t,store:e}),s}var U={Max:Number.POSITIVE_INFINITY,AAA:1e9,BB:1e6,C:1e3,Default:0,Low:-1e4,Min:Number.NEGATIVE_INFINITY},hr=(s,e,t,r,i,n,o)=>{let l=s.add(new ns(t,r,i,n));return e.emit(t,l,o),l},lr=(s,e,t,r)=>{let i=t.length,n=typeof t[0],o,l,a,c;if(i>=2&&i<=3&&n==="number"?(o=ie,[l,a,c]=t):i>=3&&i<=4&&typeof t[1]=="number"?[o,l,a,c]=t:(l=U.Default,n==="string"||n==="symbol"||Array.isArray(t[0])?[o,a,c]=t:(o=ie,[a,c]=t)),!a&&rs)throw Ys("called with insufficient arguments!",t),"subscribeTo() called with insufficient arguments!";let C=v=>u=>hr(s,e,u,v,a,c,r);return Array.isArray(o)?o.map(v=>Array.isArray(v)?C(v[1])(v[0]):C(l)(v)):C(l)(o)},os=(s,e,t)=>{let r=[],i=lr(s,e,t,r);return is.publish(r),i},es=s=>e=>{e.callAfterApply=()=>{s?.()}},as=(s,e)=>Object.assign(()=>x(s,e),Array.isArray(e)?{listeners:e}:{listener:e}),hs=(s,e,t,r)=>{let{store:i,keeper:n}=s[V];Array.isArray(e)?e.forEach(o=>{i.forEach(o,l=>l.apply(o,t,r)),n.retain(o,t)}):e!==ie&&(i.forEach(e,o=>{o.apply(e,t,r)}),n.retain(e,t))},m=(s,...e)=>{let t=Ee(s),{store:r,keeper:i}=t[V];return as(t,os(r,i,e))},S=(s,...e)=>{let t=Ee(s),{store:r,keeper:i}=t[V],n=os(r,i,e),o=as(t,n),l=!1,a=()=>{l||(o(),l=!0)};return Array.isArray(n)?n.forEach(es(a)):es(a)(n),a},fe=(s,e)=>new Promise(t=>{S(s,e,t)}),x=(s,e,t)=>{if(!ne(s))throw new Error("object is not eventized");let{store:r,keeper:i}=s[V],n=typeof e,o=t!=null&&(n==="string"||n==="symbol");r.remove(e,t,o),Array.isArray(e)?i.remove(e.filter(l=>typeof l=="string")):ss(e)&&i.remove(e)},f=(s,e,...t)=>{if(!ne(s))throw new Error("object is not eventized");hs(s,e,t)},ur=(s,e,...t)=>{if(!ne(s))throw new Error("object is not eventized");let r=[];return hs(s,e,t,i=>{r.push(i)}),r=r.map(i=>Array.isArray(i)?Promise.all(i):Promise.resolve(i)),r.length>0?Promise.all(r):Promise.resolve()},G=(s,e)=>{let t=Ee(s),{keeper:r}=t[V];r.add(e)},K=(s,e)=>{if(!ne(s))throw new Error("object is not eventized");let{keeper:t}=s[V];t.clear(e)},k=(()=>{let s=(e={})=>Ee(e);return s.inject=(e={})=>(e=Ee(e),Object.assign(e,{on:(...t)=>m(e,...t),once:(...t)=>S(e,...t),onceAsync:t=>fe(e,t),off:(t,r)=>x(e,t,r),emit:(t,...r)=>f(e,t,...r),emitAsync:(t,...r)=>ur(e,t,...r),retain:t=>G(e,t),retainClear:t=>K(e,t)}),e),s.is=ne,s})();var Ot=s=>ne(s)?s[V]?.store?.getSubscriptionCount()??0:0;var L=Symbol.for("signal"),oe=Symbol.for("effect"),Pt=Symbol.for("destroySignal"),Rt=Symbol.for("createEffect"),ls=Symbol.for("destroyEffect"),pe="value",Mt="mute",Lt="unmute",J="destroy",ae=Symbol.for("recall");var he=k(),W=k(),B=k(),Ve=k();var le=class{static current;delayedEffects=[];batch(e,t){let r=this.delayedEffects.length;for(let i=0;i<r;i++){let[n,o]=this.delayedEffects[i];if(!(n>t))if(n===t){o.add(e);return}else{this.delayedEffects.splice(i,0,[t,new Set([e])]);return}}this.delayedEffects.push([t,new Set([e])])}flush(){this.run(),this.delayedEffects.length=0}run(){let e=new Set,t=[m(B,(i,n)=>{n===ae&&e.add(i)}),m(Ve,i=>{e.add(i)})],r=this.delayedEffects.flatMap(([,i])=>Array.from(i));for(let i of r)e.has(i)||f(B,i,i,ae);t.forEach(i=>{i()})}},us=()=>le.current;function O(s){let e=le.current;e?e=void 0:e=le.current=new le;try{s()}finally{e&&(le.current=void 0,e.run())}}var jt=0;function Dt(s){jt++;try{s()}finally{jt--}}function Ue(){return jt>0}var Ge=class{[oe];constructor(e){this[oe]=e,S(e,ge.Destroy,()=>{this[oe]=void 0})}run=()=>this[oe]?.run();destroy=()=>{this[oe]?.destroy(),this[oe]=void 0}};var Z=new Map,j=class s{#e=new Set;#t=new Set;#s=new Map;#i=new WeakMap;#r=new Map;#n=new Set;#o=new Set;#a;#h;static get(e){if(e!=null)return e instanceof s?e:Z.get(e)}static findOrCreate(e){if(e==null)throw new Error("Cannot create a group with a null object");return new s(e)}static destroy(e){console.warn("SignalGroup.destroy(obj) is deprecated. Use SignalGroup.delete(obj) instead."),s.delete(e)}static delete(e){Z.get(e)?.clear()}static clear(){for(let e of Z.values())e.destroy();Z.clear()}constructor(e){if(e!=null&&e instanceof s)return e;if(e??=this,Z.has(e))return Z.get(e);this.#h=e,Z.set(e,this),k(this)}attachGroup(e){if(e===this)throw new Error("Cannot attach a group to itself");return this.#e.add(e),e.#a&&e.#a!==this&&e.#a.#e.delete(e),e.#a=this,e}detachGroup(e){return e!==this&&this.#e.has(e)&&(this.#e.delete(e),e.#a=void 0),e}attachSignal(e){let t=E(e);if(t?.destroyed)throw new Error("Cannot attach a destroyed signal to a group");return t&&this.#t.add(t),e}attachSignalByName(e,t){if(t){this.attachSignal(t);let r=E(t);this.#s.set(e,r),this.#r.has(e)?this.#r.get(e).push(r):this.#r.set(e,[r]),this.#i.has(r)?this.#i.get(r).add(e):this.#i.set(r,new Set([e]))}else this.#s.delete(e);return t}hasSignal(e){return this.#s.has(e)||!!this.#a?.hasSignal(e)}signal(e){return this.#s.get(e)?.object??this.#a?.signal(e)}detachSignal(e){let t=E(e);if(t&&(this.#t.delete(t),this.#i.has(t))){let r=this.#i.get(t);for(let i of r)if(this.#r.has(i)){let n=this.#r.get(i);n.splice(n.indexOf(t),1),n.length===0?(this.#s.delete(i),this.#r.delete(i)):this.#s.get(i)===t&&this.#s.set(i,n.at(-1))}r.clear(),this.#i.delete(t)}return e}attachEffect(e){return this.#n.add(e),e}runEffects(){for(let e of this.#n)e.run();for(let e of this.#e)e.runEffects()}attachLink(e){if(e?.isDestroyed)throw new Error("Cannot attach a destroyed link to a group");return e&&this.#o.add(e),e}detachLink(e){return e&&this.#o.delete(e),e}destroy(){console.warn("SignalGroup#destroy is deprecated. Use SignalGroup#clear instead."),this.clear()}clear(){f(this,J,this),x(this);for(let e of this.#e)e.destroy();for(let e of this.#n)e.destroy();for(let e of this.#t)A(e);for(let e of this.#o)e.destroy();this.#e.clear(),this.#t.clear(),this.#s.clear(),this.#r.clear(),this.#n.clear(),this.#o.clear(),this.#a?.detachGroup(this),this.#h&&(Z.delete(this.#h),this.#h=void 0)}};var ye=class{#e;#t;constructor(e="id",t=1){this.#e=e,this.#t=t}make(){return Symbol(`${this.#e}${this.#t++}`)}};var _t=[],Be=()=>_t.at(-1),cs=(s,e)=>{_t.push(s);try{return e()}finally{_t.pop()}};var cr=s=>s!=null&&typeof s.then=="function",ge=class s{static idGen=new ye("ef");static Destroy="destroy";static count=0;id;callback;#e;#t=new Set;#s=new Set;#i=new Map;#r=new Set;parentEffect;childEffects=[];curChildEffectSlot=0;autorun=!0;shouldRun=!0;priority;#n;#o=!1;constructor(e,t){k(this),this.callback=e;let r;t?.attach!=null&&(r=j.findOrCreate(t.attach),r.attachEffect(this)),this.autorun=t?.autorun??!0,this.#n=t?.dependencies?t.dependencies.map(i=>{switch(typeof i){case"string":case"symbol":return r.signal(i);default:return i}}):void 0,this.id=s.idGen.make(),this.priority=t?.priority??0,m(B,this.id,ae,this),++s.count}hasStaticDeps(){return this.#n!=null&&this.#n.length>0}saveSignalsFromDeps(){for(let e of this.#n)this.whenSignalIsRead(E(e).id)}static createEffect(e,t,r){let i=Array.isArray(t)?t:void 0,n=i?r??{dependencies:i}:t;n&&i&&(n.dependencies=i);let o,l=Be();return l!=null?(o=l.getCurrentChildEffect(),o==null&&(o=new s(e,n),l.attachChildEffect(o),f(B,Rt,o)),l.curChildEffectSlot++):(o=new s(e,n),f(B,Rt,o)),o.hasStaticDeps()?o.saveSignalsFromDeps():o.autorun&&o.run(),new Ge(o)}getCurrentChildEffect(){return this.childEffects[this.curChildEffectSlot]}attachChildEffect(e){this.childEffects.push(e),this.parentEffect=this}run=()=>{if(this.#o||!this.shouldRun)return;let e=us();e?e.batch(this.id,this.priority):(this.runCleanupCallback(),this.curChildEffectSlot=0,this.shouldRun=!1,f(Ve,this.id,this.id),this.hasStaticDeps()?this.#e=this.callback():(this.#s=new Set(this.#t),this.#e=cs(this,this.callback),this.cleanupLostSignals(),this.#r.clear()))};[ae](){this.shouldRun=!0,this.autorun&&this.run()}whenSignalIsRead(e){this.#s.delete(e),this.#t.has(e)||(this.#t.add(e),this.#i.set(e,[m(he,e,this.priority,ae,this),S(W,e,Pt,this)]))}[Pt](e){!this.#r.has(e)&&this.#t.has(e)&&(this.#r.add(e),this.unsubscribeSignal(e),this.#r.size===this.#t.size&&this.destroy())}cleanupLostSignals(){for(let e of this.#s)this.unsubscribeSignal(e),this.#t.delete(e)}unsubscribeSignal(e){this.#i.has(e)&&(this.#i.get(e).forEach(t=>{t()}),this.#i.delete(e))}runCleanupCallback(){if(this.#e!=null){let e=this.#e;this.#e=void 0,cr(e)?Promise.resolve(e).then(t=>{typeof t=="function"&&t()}):e()}}destroy=()=>{this.#o||(f(this,s.Destroy,this),x(this),f(B,ls,this),this.runCleanupCallback(),x(he,this),x(B,this),x(W,this),this.#o=!0,this.#t.clear(),this.#s.clear(),this.#i.clear(),this.#r.clear(),this.childEffects.forEach(e=>{e.destroy()}),this.childEffects.length=0,--s.count)}};var w=(...s)=>ge.createEffect(...s);var Se=new WeakMap,dr=s=>{let e=Se.get(s);return e||(e={},Se.set(s,e)),e},R=(s,e)=>Se.get(s)?.signals?.get(e);var ds=(s,e,t)=>{let r=dr(s);r.signals??=new Map,r.signals.set(e,t)};function xe(...s){for(let e of s)if(Se.has(e)){let t=Se.get(e);if(t.signals){for(let r of t.signals.values())A(r);t.signals.clear(),t.signals=void 0}}}function fs(s){let e=E(q(s)?s:R(...s));e!=null&&!e.muted&&!e.destroyed&&qe(e.id,e.value,{touch:!0})}function ue(s){return q(s)?E(s)?.value:E(R(...s))?.value}var He=class{[L];constructor(e){this[L]=e}get get(){return this[L].reader}get set(){return this[L].writer}get value(){return ue(this.get)}set value(e){this.set(e)}onChange(e){let{destroy:t}=w(()=>e(this.value),[this.get]);return t}get muted(){return this[L].muted}set muted(e){this[L].muted=e}touch(){fs(this)}destroy(){A(this)}};var fr=new ye("si");function ps(s){Ue()||Be()?.whenSignalIsRead(s)}function qe(s,e,t){Ue()||f(he,s,e,t)}var q=s=>s!=null&&s[L]!=null,pr=s=>{let e=t=>(t?w(()=>(s.destroyed||ps(s.id),t(s.value)),[e]):s.destroyed||(s.beforeRead?.(),ps(s.id)),s.value);return Object.defineProperty(e,L,{value:s}),e},Qe=class s{static instanceCount=0;id;lazy;get[L](){return this}compare;beforeRead;muted=!1;destroyed=!1;#e=void 0;get value(){return this.lazy&&(this.#e=this.valueFn(),this.valueFn=void 0,this.lazy=!1),this.#e}set value(e){this.#e=e}valueFn;reader;writer=(e,t)=>{let r=t?.lazy??!1,n=t?.compare??this.compare??((l,a)=>l===a);if((r!==this.lazy||r&&e!==this.valueFn||!r&&!n(e,this.#e))&&(r?(this.#e=void 0,this.valueFn=e,this.lazy=!0):(this.#e=e,this.valueFn=void 0,this.lazy=!1),!this.muted&&!this.destroyed)){qe(this.id,this.#e);return}(t?.touch??!1)&&qe(this.id,this.#e,{touch:!0})};object;constructor(e,t){this.id=fr.make(),++s.instanceCount,this.lazy=e,this.lazy?(this.value=void 0,this.valueFn=t):(this.value=t,this.valueFn=void 0),this.reader=pr(this),this.object=new He(this)}},E=s=>s?.[L];function d(s=void 0,e){let t;if(q(s))t=E(s);else{let r=e?.lazy??!1;t=new Qe(r,s),t.beforeRead=e?.beforeRead,t.compare=e?.compare}return e?.attach!=null&&j.findOrCreate(e.attach).attachSignal(t),t.object}var A=(...s)=>{for(let e of s){let t=E(e);t!=null&&!t.destroyed&&(t.destroyed=!0,t.beforeRead=void 0,--Qe.instanceCount,f(W,t.id,t.id))}};function Nt(s,e){let t=d(),r=e?.attach!=null?j.findOrCreate(e.attach):void 0;r!=null&&(e?.name?r.attachSignalByName(e.name,t):r.attachSignal(t));let i=w(()=>{O(()=>{t.set(s())})},{autorun:!(e?.lazy??!1),priority:e?.priority??U.C,attach:r}),n=E(t);return n.beforeRead=i.run,S(W,n.id,i.destroy),t.get}var Ye=class{#e=!1;#t;source;lastValue;isDestroyed=!1;constructor(e){k(this),this.source=E(e),this.#t=m(he,this.source.id,(t,r)=>{!this.#e&&!this.isDestroyed&&(r?.touch===!0?this.touch():this.write())}),S(W,this.source.id,()=>this.destroy())}attach(e){let t=j.findOrCreate(e);return t.attachLink(this),S(this,J,()=>{t.detachLink(this)}),t}nextValue(){return new Promise((e,t)=>{let r=[],i=()=>r.forEach(n=>{n()});r.push(S(this,pe,n=>{i(),e(n)}),S(this,J,()=>{i(),t()}))})}async*asyncValues(e){let t=0;for(;!this.isDestroyed;)try{let r=await this.nextValue();if(e&&e(r,t++))break;G(this,pe),yield r}catch{break}K(this,pe)}destroy(){this.isDestroyed||(this.#t?.(),this.#t=void 0,f(this,J,this),K(this,pe),x(this),this.lastValue=void 0,this.isDestroyed=!0,Object.freeze(this))}get isMuted(){return this.#e}mute(){return!this.isDestroyed&&!this.#e&&(this.#e=!0,f(this,Mt,this)),this}unmute(){return!this.isDestroyed&&this.#e&&(this.#e=!1,f(this,Lt,this)),this}toggleMute(){return this.isDestroyed||(this.#e=!this.#e,f(this,this.#e?Mt:Lt,this)),this.#e}updateValue(e){if(!this.#e&&!this.isDestroyed){let{value:t}=this.source;e(t),f(this,pe,t),this.lastValue=t}}},Ke=class extends Ye{target;constructor(e,t){super(e),this.target=E(t),S(W,this.target.id,()=>this.destroy()),this.touch()}touch(){return this.updateValue(e=>{this.target.writer(e,{touch:!0})}),this}write(){this.updateValue(e=>{this.target.writer(e)})}},Je=class extends Ye{target;constructor(e,t){super(e),this.target=t,this.touch()}touch(){return this.updateValue(e=>{this.target(e)}),this}write(){this.updateValue(e=>{this.target(e)})}};var Ze=new Map;function M(s,e,t){let r=E(s),i;if(Ze.has(r)){i=Ze.get(r);let c=E(e)??e;if(i.has(c))return i.get(c)}else i=new Map,Ze.set(r,i);let n=E(e),o=n!=null?new Ke(s,n):new Je(s,e),l=t?.attach;l&&o.attach(l);let a=n??e;return i.set(a,o),S(o,J,()=>{i.delete(a),i.size===0&&Ze.delete(r)}),o}var Xe=class s{static fromProps(e,t){let r=new s,i=t?t.map(n=>[n,e[n]]):Object.entries(e);for(let[n,o]of i)r.#e.set(n,d(o));return r}#e=new Map;keys(){return this.#e.keys()}signals(){return this.#e.values()}entries(){return this.#e.entries()}clear(){for(let e of this.#e.values())e.destroy();this.#e.clear()}has(e){return this.#e.has(e)}get(e){if(!this.#e.has(e)){let t=d();return this.#e.set(e,t),t}return this.#e.get(e)}update(e){e.size&&O(()=>{for(let[t,r]of e.entries())this.get(t).set(r)})}updateFromProps(e,t){O(()=>{let r=t?t.map(i=>[i,e[i]]):Object.entries(e);for(let[i,n]of r)this.get(i).set(n)})}};var I;(function(s){s[s.StructuralChanges=1]="StructuralChanges",s[s.ContentUpdates=2]="ContentUpdates",s[s.Removal=3]="Removal"})(I||(I={}));var b;(function(s){s[s.CreateEntities=1]="CreateEntities",s[s.DestroyEntities=2]="DestroyEntities",s[s.SetParent=3]="SetParent",s[s.UpdateOrder=4]="UpdateOrder",s[s.ChangeProperties=5]="ChangeProperties",s[s.ChangeToken=6]="ChangeToken",s[s.SendEvents=7]="SendEvents"})(b||(b={}));var ce=Symbol.for("ShadowEntsGlobalNS"),H="#void",gs="contextLost",ys="configure",ms="changeTrail",bs="destroy",vs="loaded",ws="appliedChangeTrail",Cs="importedModule",Es="destroyed",me="messageToView",Ss=6e4,xs=6e4,ks=5e3,As=5e3,$t="shadowObjects";function Ts(s,e){s.indexOf(e)===-1&&s.push(e)}function Wt(s,e){let t=s.indexOf(e);t!==-1&&s.splice(t,1),s.push(e)}function X(s,e){let t=s.indexOf(e);t!==-1&&s.splice(t,1)}var de=s=>typeof s=="string"?s.trim()||ce:typeof s=="symbol"?s:ce;var ke="#root",Ae=class{#e;get uuid(){return this.#e}#t=0;constructor(e){this.#e=e}#s=!0;#i=0;#r=0;hasChanges(){return this.#t>0}get isNew(){return this.#s}get isCreated(){return this.#i>0&&this.#i>this.#r}get isDestroyed(){return this.#r>0&&this.#r>=this.#i}#n=H;#o;#a=0;#h;#l;#u;create(e=H,t,r=0){this.#t++,this.#i++,this.#h=e,this.#l=t??ke,this.#u=r||void 0}destroy(){this.#r++,this.#t++}clear(){this.#t=0,this.#s=!1,this.#h=void 0,this.#l=void 0,this.#u=void 0,this.#d.clear(),this.#f.length=0,this.#g.length=0,this.#p.clear()}changeToken(e){e===this.#n?this.#h=void 0:(this.#h=e,this.#t++)}setParent(e){e===this.#o?this.#l=void 0:(this.#l=e??ke,this.#t++)}changeOrder(e){e===this.#a?this.#u=void 0:(this.#u=e,this.#t++)}#c=new Map;#d=new Map;#f=[];changeProperty(e,t,r){let i=this.#c.get(e);r==null&&t!==i||r!=null&&!r(t,i)?(this.#d.set(e,t),Wt(this.#f,e),this.#t++):(this.#d.delete(e),X(this.#f,e))}removeProperty(e){let t=this.#c.has(e);this.#d.has(e)?(this.#d.delete(e),t||X(this.#f,e)):t&&(Wt(this.#f,e),this.#t++)}#g=[];#p=new Set;createEvent(e,t,r){this.#g.push({type:e,data:t}),r?.forEach(i=>this.#p.add(i)),this.#t++}transferEventsTo(e){this.#g.length>0&&(e.#g.push(...this.#g),this.#g.length=0),this.#p.size>0&&(e.#p=new Set([...e.#p,...this.#p]),this.#p.clear())}buildChangeTrail(e,t){let{isNew:r,isCreated:i,isDestroyed:n}=this;if(!(r&&n))switch(t){case I.StructuralChanges:r?e.push(this.makeCreateEntityChange()):n||(this.#l!==void 0&&!(this.#l===ke&&this.#o===void 0)?e.push(this.makeSetParentChange()):this.#u!==void 0&&this.#u!==this.#a&&e.push(this.makeUpdateOrderChange()),this.#h!==void 0&&this.#h!==this.#n&&e.push(this.makeChangeToken()));break;case I.ContentUpdates:!r&&i&&this.#f.length>0&&e.push(this.makeChangePropertyChange()),this.#g.length>0&&e.push(this.makeEvents());break;case I.Removal:n&&e.push(this.makeDestroyEntityChange());break}}makeEvents(){let e={type:b.SendEvents,uuid:this.#e,events:this.#g.slice(0)};return this.#p.size>0&&(e.transferables=Array.from(this.#p)),e}makeCreateEntityChange(){let e={type:b.CreateEntities,uuid:this.#e,token:this.#h};if(this.#n=this.#h,this.#l!==void 0){let t=this.#l===ke?void 0:this.#l;this.#o=t,t!==void 0&&(e.parentUuid=t)}return this.#d.size>0&&(e.properties=Array.from(this.#d.entries()).filter(([,t])=>t!==void 0),e.properties.forEach(([t,r])=>this.#c.set(t,r))),this.#u!==void 0&&this.#u!==this.#a&&(e.order=this.#a=this.#u),e}makeDestroyEntityChange(){return{type:b.DestroyEntities,uuid:this.#e}}makeSetParentChange(){this.#o=this.#l===ke?void 0:this.#l;let e={type:b.SetParent,uuid:this.#e,parentUuid:this.#o};return this.#u!==void 0&&this.#u!==this.#a&&(e.order=this.#a=this.#u),e}makeUpdateOrderChange(){return this.#a=this.#u??0,{type:b.UpdateOrder,uuid:this.#e,order:this.#a}}makeChangeToken(){return this.#n=this.#h??H,{type:b.ChangeToken,uuid:this.#e,token:this.#n}}makeChangePropertyChange(){let e=this.#f.map(t=>{if(this.#d.has(t)){let r=this.#d.get(t);return this.#c.set(t,r),[t,r]}else return this.#c.delete(t),[t,void 0]});return{type:b.ChangeProperties,uuid:this.#e,properties:e}}};var Os=s=>{if(!(s===void 0||s.length===0))return s.filter(e=>e.length===1||e[1]!==void 0)},It=(s,e)=>{if(s===e||e===void 0)return s;if(s===void 0)return Os(e);for(let[t,r]of e){let i=s.find(([n])=>n===t);i===void 0?s.push([t,r]):i[1]=r}return Os(s)};var et=class{#e=new Map;get[Symbol.iterator](){return this.#e.entries.bind(this.#e)}clear(){this.#e.clear()}isEmpty(){return this.#e.size===0}hasComponentState(e){return this.#e.has(e)}getComponentState(e){return this.#e.get(e)}write(e){for(let t of e)if(t.type===b.CreateEntities)this.createEntity(t);else if(this.#e.has(t.uuid))switch(t.type){case b.DestroyEntities:this.destroyEntity(t);break;case b.SetParent:this.setParent(t);break;case b.UpdateOrder:this.updateOrder(t);break;case b.ChangeToken:this.changeToken(t);break;case b.ChangeProperties:this.changeProperties(t);break}}changeProperties({uuid:e,properties:t}){let r=this.getComponentState(e);r.properties=It(r.properties,t)}changeToken({uuid:e,token:t}){this.getComponentState(e).token=t||H}updateOrder({uuid:e,order:t}){this.getComponentState(e).order=t??0}setParent({uuid:e,parentUuid:t,order:r}){let i=this.getComponentState(e);i.parentUuid=t,i.order=r??0}destroyEntity({uuid:e}){this.#e.delete(e)}createEntity({uuid:e,token:t,parentUuid:r,order:i,properties:n}){this.#e.set(e,{token:t||H,parentUuid:r,order:i??0,properties:It(void 0,n)})}};var $=class s{static{this.ReRequestParentRoots="re-request-parent-roots"}static getContextsMap(){return globalThis.__shadowEntsContexts==null&&(globalThis.__shadowEntsContexts=new Map),globalThis.__shadowEntsContexts}static get(e){let t=de(e),r=s.getContextsMap();return r.has(t)?r.get(t):new s(t)}#e=new Map;#t=[];#s=new et;constructor(e=ce){let t=de(e),r=s.getContextsMap();if(r.has(t))return r.get(t);this.ns=t,r.set(t,this)}addComponent(e){let t;this.#e.has(e.uuid)?(t=this.#e.get(e.uuid),t.component=e,t.children=[]):(t={component:e,children:[],changes:new Ae(e.uuid),propIsEqual:void 0},this.#e.set(e.uuid,t)),t.changes.create(e.token,e.parent?.uuid,e.order),e.parent?(this.addToChildren(e.parent,e),t.changes.setParent(e.parent.uuid)):this.#n(e,this.#t),this.#o=void 0}hasComponent(e){return this.#e.has(e.uuid)}hasComponents(){return this.#e.size>0}isRootComponent(e){return this.#t.includes(e.uuid)}destroyComponent(e){if(this.hasComponent(e)){let t=this.#e.get(e.uuid);t.children.slice(0).forEach(r=>this.#e.get(r)?.component.removeFromParent()),t.changes.destroy(),this.#o=void 0}}getChildren(e){return this.#e.get(e.uuid)?.children.map(t=>this.#e.get(t).component)??[]}removeFromParent(e,t){if(this.hasComponent(t)){let r=this.#e.get(e),i=this.#e.get(t.uuid),n=i.children.indexOf(e);n!==-1&&(i.children.splice(n,1),r.changes.setParent(void 0)),this.#n(r.component,this.#t),this.#o=void 0}}moveToRoot(e){let t=this.#e.get(e);t&&(t.changes?.setParent(void 0),this.#n(t.component,this.#t)),this.#o=void 0}changeToken(e,t){this.#e.get(e.uuid)?.changes.changeToken(t)}isChildOf(e,t){return this.hasComponent(t)?this.#e.get(t.uuid).children.includes(e.uuid):!1}addToChildren(e,t){let r=this.#e.get(e.uuid);if(r)this.#n(t,r.children),this.#e.get(t.uuid)?.changes.setParent(e.uuid),X(this.#t,t.uuid),this.#o=void 0;else throw new Error(`the view component ${e.uuid} cannot have a child added to it because the component do not exist!`)}removeSubTree(e){let t=this.#e.get(e);t&&(t.children.slice(0).forEach(r=>this.removeSubTree(r)),this.destroyComponent(t.component),this.#i(e))}setProperty(e,t,r,i){let n=this.#e.get(e.uuid);return n!=null?(i!=null?(n.propIsEqual??=new Map,n.propIsEqual.set(t,i)):n.propIsEqual?.has(t)&&n.propIsEqual.delete(t),n.changes.changeProperty(t,r,i)):!1}removeProperty(e,t){this.#e.get(e.uuid)?.changes.removeProperty(t)}changeOrder(e){if(e.parent){let t=this.#e.get(e.parent.uuid);X(t.children,e.uuid),this.#n(e,t.children)}else X(this.#t,e.uuid),this.#n(e,this.#t);this.#e.get(e.uuid)?.changes.changeOrder(e.order),this.#o=void 0}traverseLevelOrderBFS(){return this.#a().map(e=>e.component)}dispatchShadowObjectsEvent(e,t,r,i){this.#e.get(e.uuid)?.changes.createEvent(t,r,i)}broadcastEvent(e,t=void 0){for(let r of this.traverseLevelOrderBFS())r.dispatchEvent(e,t,!1)}dispatchMessage(e,t,r=void 0,i=!1){this.#e.get(e)?.component.dispatchEvent(t,r,i)}dispatchReRequestParentRoots(){for(let e of this.#t)this.dispatchMessage(e,s.ReRequestParentRoots)}buildChangeTrails(e=!0){let t=[];if(!this.hasComponents())return t;let r=this.#r();for(let i of r)i.buildChangeTrail(t,I.StructuralChanges);for(let i of r)i.buildChangeTrail(t,I.ContentUpdates);for(let i of r)i.buildChangeTrail(t,I.Removal),(i.isDestroyed||i.isNew&&!i.isCreated)&&this.#i(i.uuid),e&&i.clear();return this.#s.write(t),t}reCreateChanges(){if(!this.#s.isEmpty()){this.buildChangeTrails(!1);for(let[e,t]of this.#s){let r=this.#e.get(e);if(r){let i=new Ae(e);if(i.create(t.token,t.parentUuid,t.order),t.properties)for(let[n,o]of t.properties)i.changeProperty(n,o,r.propIsEqual?.get(n));r.changes.transferEventsTo(i),r.changes.clear(),r.changes=i}}this.#s.clear(),this.broadcastEvent(gs)}}clear(){if(this.#o=void 0,this.#s.clear(),this.#t.slice(0).forEach(e=>this.removeSubTree(e)),this.#t.length!==0)throw new Error("component-context panic: #rootComponents is not empty!");if(this.#e.size!==0)throw new Error("component-context panic: #components is not empty!")}#i(e){this.#e.has(e)&&(this.#e.delete(e),X(this.#t,e),this.#o=void 0)}#r(){return this.#a().filter(e=>e.changes.hasChanges()).map(e=>e.changes)}#n(e,t){if(t.length===0){t.push(e.uuid);return}if(t.includes(e.uuid))return;let r=t.length,i=new Array(r);if(i[0]=this.#e.get(t[0]).component,e.order<i[0].order){t.unshift(e.uuid);return}if(r===1){t.push(e.uuid);return}let n=r-1;if(i[n]=this.#e.get(t[n]).component,e.order>=i[n].order){t.push(e.uuid);return}if(r===2){t.splice(1,0,e.uuid);return}for(let o=n-1;o>=1;o--)if(i[o]=this.#e.get(t[o]).component,e.order>=i[o].order){t.splice(o+1,0,e.uuid);return}}#o;#a(){if(this.#o)return this.#o;let e=new Map,t=(r,i)=>{let n=this.#e.get(r);if(n!=null){e.has(i)?e.get(i).push(n):e.set(i,[n]);for(let o of n.children)t(o,i+1)}};return this.#t.forEach(r=>t(r,0)),this.#o=Array.from(e.entries()).sort((r,i)=>r[0]-i[0]).map(([,r])=>r).flat(),this.#o}};function Te(s,e,t,r,i,n){function o(N){if(N!==void 0&&typeof N!="function")throw new TypeError("Function expected");return N}for(var l=r.kind,a=l==="getter"?"get":l==="setter"?"set":"value",c=!e&&s?r.static?s:s.prototype:null,C=e||(c?Object.getOwnPropertyDescriptor(c,r.name):{}),v,u=!1,h=t.length-1;h>=0;h--){var y={};for(var g in r)y[g]=g==="access"?{}:r[g];for(var g in r.access)y.access[g]=r.access[g];y.addInitializer=function(N){if(u)throw new TypeError("Cannot add initializers after decoration has completed");n.push(o(N||null))};var p=(0,t[h])(l==="accessor"?{get:C.get,set:C.set}:C[a],y);if(l==="accessor"){if(p===void 0)continue;if(p===null||typeof p!="object")throw new TypeError("Object expected");(v=o(p.get))&&(C.get=v),(v=o(p.set))&&(C.set=v),(v=o(p.init))&&i.unshift(v)}else(v=o(p))&&(l==="field"?i.unshift(v):C[a]=v)}c&&Object.defineProperty(c,r.name,C),u=!0}function ee(s,e,t){for(var r=arguments.length>2,i=0;i<e.length;i++)t=r?e[i].call(s,t):e[i].call(s);return r?t:void 0}function Oe(s){return function(e,t){let r=s?.name||t.name,i=!!(s?.readAsValue??!1);return{get(){let n=R(this,r);if(n)return i?n.value:n.get()},set(n){R(this,r)?.set(n)},init(n){let o=d(n,s);return ds(this,r,o),j.findOrCreate(this).attachSignalByName(r,o),o.value}}}}var _="ConsoleLogger",D=`${_}Storage`,gr=!!(globalThis.location?.host?.startsWith("localhost")??!1),Re="localStorage"in globalThis,tt=Symbol.for(_),Ps=!1,Rs=s=>{if(typeof s=="boolean")return s;switch(s.toLowerCase()){case"true":case"yes":case"on":return!0;default:return!1}},zt=s=>[Re?_:void 0,...Array.isArray(s)?s:[s]].filter(Boolean).join(".");function Ft(s,e=void 0,t){let r=zt(s),i=Re?localStorage.getItem(r):globalThis[D]?.[r];return i!=null?e(i):t}function Pe(s,e){Re?localStorage.setItem(zt(s),e):(globalThis[D]==null&&(globalThis[D]={},console.debug(`${_}: Initialize`,{[D]:globalThis[D]})),globalThis[D][zt(s)]=e)}var P=class s{static{this.sharedConfig={enable:gr,debug:!1,info:!0,warn:!0,"styles.debug":"color: #111; background: #999; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em","styles.info":"color: #020; background: #8a8; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em","styles.warn":"color: #fa0; background: #a98; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em","styles.error":"color: #ff0; background: #a00; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em"}}static get isEnabled(){return s.sharedConfig.enable}static get isDebug(){return s.sharedConfig.enable&&s.sharedConfig.debug}static{this.sharedStyles={get debug(){return s.sharedConfig["styles.debug"]},set debug(e){s.sharedConfig["styles.debug"]=e},get info(){return s.sharedConfig["styles.info"]},set info(e){s.sharedConfig["styles.info"]=e},get warn(){return s.sharedConfig["styles.warn"]},set warn(e){s.sharedConfig["styles.warn"]=e},get error(){return s.sharedConfig["styles.error"]},set error(e){s.sharedConfig["styles.error"]=e}}}static loadConfig(){Re?(["enable","debug","info","warn"].forEach(e=>{this.sharedConfig[e]=Ft(e,Rs,this.sharedConfig[e])}),["debug","info","warn","error"].forEach(e=>{this.sharedStyles[e]=Ft(["styles",e],void 0,this.sharedStyles[e])}),s.isDebug&&console.debug(`${_}: Load config from localStorage`,s.sharedConfig),globalThis[_]?.[tt]||(globalThis[_]??={[tt]:!0,get enable(){return s.sharedConfig.enable},set enable(e){s.sharedConfig.enable=e,Pe("enable",e?"true":"false")},get debug(){return s.sharedConfig.debug},set debug(e){s.sharedConfig.debug=e,Pe("debug",e?"true":"false")},get info(){return s.sharedConfig.info},set info(e){s.sharedConfig.info=e,Pe("info",e?"true":"false")},get warn(){return s.sharedConfig.warn},set warn(e){s.sharedConfig.warn=e,Pe("warn",e?"true":"false")}})):globalThis[D]?.[tt]||(globalThis[D]={[tt]:!0,...s.sharedConfig,...globalThis[D]},s.sharedConfig=globalThis[D],s.isDebug&&console.debug(`${_}: Load config from ${D}`,globalThis[D]))}constructor(e){this.enable=!0,this.namespace=(e||"").trim()||_,Ps||(s.loadConfig(),Ps=!0);let t=[this.namespace,"enable"];this.enable=Ft(t,Rs,this.enable),Pe(t,Re?this.enable?"true":"false":this.enable)}get isEnabled(){return this.enable&&s.sharedConfig.enable}get isDebug(){return this.isEnabled&&s.sharedConfig.debug}get isInfo(){return this.isEnabled&&s.sharedConfig.info}get isWarn(){return this.isEnabled&&s.sharedConfig.warn}debug(...e){this.#e("debug",s.sharedStyles.debug,e)}info(...e){this.#e("info",s.sharedStyles.info,e)}warn(...e){this.#e("warn",s.sharedStyles.warn,e)}error(...e){this.#e("error",s.sharedStyles.error,e)}#e(e,t,r){console[e](`%c${this.namespace}`,t,...r)}};var F=(()=>{var s;let e,t=[],r=[],i,n=[],o=[];return class Q{static{let a=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;e=[Oe()],i=[Oe()],Te(this,null,e,{kind:"accessor",name:"viewReady",static:!1,private:!1,access:{has:c=>"viewReady"in c,get:c=>c.viewReady,set:(c,C)=>{c.viewReady=C}},metadata:a},t,r),Te(this,null,i,{kind:"accessor",name:"proxyReady",static:!1,private:!1,access:{has:c=>"proxyReady"in c,get:c=>c.proxyReady,set:(c,C)=>{c.proxyReady=C}},metadata:a},n,o),a&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a})}static{this.AfterSync="afterSync"}static{this.ContextLost="contextLost"}static{this.ContextCreated="contextCreated"}static get(a){if(a!=null)return globalThis.__shadowEnvs?.get(a)}#e;#t;#s;#i;#r;#n;#o;get viewReady(){return this.#o}set viewReady(a){this.#o=a}#a;get proxyReady(){return this.#a}set proxyReady(a){this.#a=a}#h;get isDestroyed(){return this.#h}constructor(){this.#s=!1,this.#i=!1,this.#r=!1,this.logger=new P("ShadowEnv"),this.ns$=d(),this.#o=ee(this,t,!1),this.#a=(ee(this,r),ee(this,n,!1)),this.#h=(ee(this,o),!1),this.ready=async()=>this.isReady?this:fe(this,Q.ContextCreated),this.#l=()=>{this.#s&&this.#u()},G(this,Q.ContextCreated),m(this,Q.ContextLost,U.AAA,()=>{K(this,Q.ContextCreated)}),w(()=>{if(this.viewReady&&this.proxyReady)return this.view.reCreateChanges(),f(this,Q.ContextCreated,this),this.#i&&(this.#i=!1,this.#u()),()=>{f(this,Q.ContextLost,this)}},[R(this,"viewReady"),R(this,"proxyReady")])}get view(){return this.#e}set view(a){a!==this.#e&&(this.#e&&this.#e.ns&&globalThis.__shadowEnvs&&globalThis.__shadowEnvs.delete(this.#e.ns),this.#e=a??void 0,this.#e&&this.#e.ns&&(globalThis.__shadowEnvs??=new Map,globalThis.__shadowEnvs.has(this.#e.ns)&&globalThis.__shadowEnvs.get(this.#e.ns)!==this&&this.logger.isWarn&&this.logger.warn("overwrite a namespace already in use",this.#e.ns,globalThis.__shadowEnvs.get(this.#e.ns)),globalThis.__shadowEnvs.set(this.#e.ns,this)),this.viewReady=!!a)}get envProxy(){return this.#t}set envProxy(a){if(a!==this.#t){let c=this.#t;this.#t=a??void 0,this.#t&&(this.#t.onMessageToView=this.#c.bind(this)),c&&c.destroy(),this.proxyReady=!1,a?.start().then(()=>{this.proxyReady=!0}).catch(C=>{this.logger.error("failed to start envProxy",C),this.proxyReady=!1})}}get isReady(){return!!(this.#e&&this.#t&&this.proxyReady&&!this.isDestroyed)}sync(){if(!this.isReady){this.#i=!0;return}this.#s||(this.#s=!0,queueMicrotask(this.#l))}syncWait(){return this.#r=!0,this.sync(),this.#n?this.#n:(this.#n=fe(this,Q.AfterSync).then(a=>(this.#n=void 0,a)),this.#n)}destroy(){let a=this.#e?.ns;this.envProxy?.destroy(),this.envProxy=void 0,this.view=void 0,a&&globalThis.__shadowEnvs.has(a)&&globalThis.__shadowEnvs.get(a)===this&&globalThis.__shadowEnvs.delete(a),xe(this),x(this),this.#h=!0,Object.freeze(this)}#l;async#u(){if(this.#s=!1,this.isReady){let a=this.view.buildChangeTrails();if(a.length>0)try{let c=this.#r;this.#r=!1,await this.envProxy.applyChangeTrail(a,c)}catch(c){this.logger.error("failed to apply change trail",c)}finally{f(this,Q.AfterSync,a)}}}#c(a){this.logger.isDebug&&this.logger.debug("onMessageToView",a.type,a.data),this.view?.dispatchMessage(a.uuid,a.type,a.data,a.traverseChildren)}}})();var T=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],yr=()=>{let s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(T[s&255]+T[s>>8&255]+T[s>>16&255]+T[s>>24&255]+"-"+T[e&255]+T[e>>8&255]+"-"+T[e>>16&15|64]+T[e>>24&255]+"-"+T[t&63|128]+T[t>>8&255]+"-"+T[t>>16&255]+T[t>>24&255]+T[r&255]+T[r>>8&255]+T[r>>16&255]+T[r>>24&255]).toLowerCase()},Ms=()=>globalThis?.crypto?.randomUUID?.()??yr();var Me=class extends Error{constructor(e){super(e),this.name="ViewComponentError"}},st=class s{#e;#t;#s;#i;#r=0;get uuid(){return this.#e}get token(){return this.#t}set token(e){e??=H,e!==this.#t&&(this.#t=e,this.#s?.changeToken(this,e))}get parent(){return this.#i}set parent(e){if(e){if(e.#s!==this.#s)throw new Me("cannot set parent from different context");e.addChild(this)}else this.removeFromParent()}get context(){return this.#s}set context(e){this.#s!=e&&(this.#s&&this.destroy(),this.#s=e,e&&e.addComponent(this))}get order(){return this.#r}set order(e){let t=this.#r;this.#r=e??0,t!==this.#r&&this.#s.changeOrder(this)}constructor(e,t){k(this),t instanceof s&&(t={parent:t}),this.#e=t?.uuid??Ms(),this.#t=e,this.#r=t?.order??0,this.#i=t?.parent;let r=t?.context??$.get();if(this.#i&&this.#i.#s!==r)throw new Me("cannot set parent from different context");this.context=r}isChildOf(e){return this.#i===e}removeFromParent(){this.#i?(this.#s?.removeFromParent(this.uuid,this.#i),this.#i=void 0):this.#s?.moveToRoot(this.uuid)}addChild(e){if(e.#s!==this.#s)throw new Me("cannot add a child from another context");e.isChildOf(this)||(e.removeFromParent(),e.#i=this,this.#s.addToChildren(this,e))}setProperty(e,t,r){this.#s.setProperty(this,e,t,r)}removeProperty(e){this.#s.removeProperty(this,e)}dispatchShadowObjectsEvent(e,t,r){this.#s.dispatchShadowObjectsEvent(this,e,t,r)}dispatchEvent(e,t,r){if(f(this,e,t),r)for(let i of this.#s.getChildren(this))i.dispatchEvent(e,t,r)}destroy(){this.removeFromParent(),this.#s?.destroyComponent(this),this.#s=void 0}};var rt="shaeRequestEntParent",it="shaeReRequestEntParent",Ls="shae-worker",nt="shae-ent",js="shae-prop",te="token";var ot="local",Ds="no-autostart",at="no-structured-clone",z="auto-sync";var ht="name",lt="value",ut="type",ct="no-trim";var Le=new Set(["on","true","yes","local","1"]);var _s=s=>de(s.getAttribute("ns")),De=(s,e)=>{if(s.hasAttribute(e)){let t=s.getAttribute(e)?.trim()?.toLowerCase()||"1";return Le.has(t)}return!1};var Ns=(s,e)=>{e.set(_s(s))},Vt=new Set,Ut=!1,mr=s=>{Vt.add(s),Ut||(Ut=!0,queueMicrotask(()=>{Ut=!1;for(let e of Vt)F.get(e)?.sync();Vt.clear()}))},se=class extends HTMLElement{static{this.observedAttributes=["ns"]}get ns(){return this.ns$.value}set ns(e){typeof e=="symbol"?this.ns$.set(e):this.ns$.set(de(e))}constructor(){super(),this.isShaeElement=!0,this.ns$=d(ce),this.ns$.onChange(e=>{typeof e=="string"&&e.length>0?this.getAttribute("ns")!==e&&this.setAttribute("ns",e):this.removeAttribute("ns")}),Ns(this,this.ns$)}attributeChangedCallback(e){e==="ns"&&Ns(this,this.ns$)}syncShadowObjects(){mr(this.ns)}};var dt=class extends se{static{this.observedAttributes=[...se.observedAttributes,te]}get componentContext(){return this.componentContext$.value}get viewComponent(){return this.viewComponent$.value}get uuid(){return this.viewComponent?.uuid}get token(){return this.token$.value}set token(e){this.token$.set(e)}#e;constructor(){super(),this.isShaeEntElement=!0,this.componentContext$=d(),this.viewComponent$=d(),this.token$=d(),this.#n=!0,this.#d=()=>{let e=this.findShadowRootHost();e!=null&&this.dispatchEvent(new CustomEvent(it,{bubbles:!0,composed:!0,detail:{requester:this,shadowRootHost:e}}))},this.#f=e=>{let t=e.detail?.requester;if(t===this||!t?.isShaeEntElement||t.ns!==this.ns)return;e.detail?.shadowRootHost&&this.#l()},this.#g=e=>{let t=e.detail?.requester;t!==this&&t?.isShaeEntElement&&t.ns===this.ns&&(e.stopPropagation(),t.#c(this))},this.ns$.onChange(e=>{this.componentContext$.set($.get(e)),this.isConnected&&this.#l()}),this.#p(),this.token$.onChange(e=>{e==null?this.removeAttribute(te):this.getAttribute(te)!==e&&this.setAttribute(te,e)}),w(()=>{let e=this.viewComponent$.get();if(e){let t=m(e,$.ReRequestParentRoots,()=>this.#h()),r=e.context?.ns;return()=>{t(),e.destroy(),r&&r!==this.ns?F.get(r)?.sync():this.syncShadowObjects()}}}),this.token$.onChange(e=>{let t=this.viewComponent$.value;t&&(t.token=e,this.syncShadowObjects())}),this.style.display="contents"}#t;#s(){this.#t?.();let e=this.componentContext$.onChange(t=>{let r=this.token$.value,i=this.viewComponent$.value;i?i.context=t:t&&(i=new st(r,{context:t}),this.viewComponent$.set(i)),this.syncShadowObjects()});this.#t=()=>{e()}}#i(){this.#t?.(),this.#t=void 0}#r;#n;findShadowRootHost(){if(this.#n){this.#n=!1;let e=this;for(;e;){if(e.parentElement==null){let t=e.parentNode;t&&(this.#r=t.host);break}e=e.parentElement}}return this.#r}getParentNodeForObserver(){let e=this.parentNode;return e||(e.host??e)}connectedCallback(){this.#n=!0,this.addEventListener("slotchange",this.#d,{capture:!1,passive:!1}),this.addEventListener(rt,this.#g,{capture:!1,passive:!1}),this.#s(),Dt(()=>this.#p()),this.componentContext==null&&this.componentContext$.set($.get(this.ns)),this.#l(),this.componentContext?.dispatchReRequestParentRoots(),this.#o(),this.syncShadowObjects()}#o(){this.#a();let e=this.getParentNodeForObserver();e&&(this.#e=new MutationObserver((t,r)=>{for(let{target:i,removedNodes:n}of t)if(i===e){for(let o of n)if(o===this){this.#a(),this.onParentChanged(this.getParentNodeForObserver(),e);break}}}),this.#e.observe(e,{childList:!0,subtree:!1,attributes:!1}))}onParentChanged(e,t){this.#c(void 0),this.#l()}#a(){this.#e?.disconnect(),this.#e=void 0}attributeChangedCallback(e){super.attributeChangedCallback(e),e===te&&this.#p()}disconnectedCallback(){this.#n=!0,this.#a(),this.removeEventListener("slotchange",this.#d,{capture:!1}),this.removeEventListener(rt,this.#g,{capture:!1}),this.#c(void 0),this.componentContext$.set(void 0),this.syncShadowObjects(),this.#i()}#h(){this.isConnected&&(this.#c(void 0),this.#l())}#l(){this.dispatchEvent(new CustomEvent(rt,{bubbles:!0,composed:!0,detail:{requester:this}}))}#u;#c(e){if(this.entParentNode!==e)if(this.entParentNode&&this.entParentNode.removeEventListener(it,this.#f,{capture:!1}),this.entParentNode=e,this.entParentNode&&this.entParentNode.addEventListener(it,this.#f,{capture:!1,passive:!1}),this.#u?.(),this.#u=void 0,e){let t=w(()=>{let r=this.viewComponent$.get();if(r){let i=e.viewComponent$.get();r.parent=i&&i.context===r.context?i:void 0,r.parent==null&&queueMicrotask(()=>{this.#l()}),this.syncShadowObjects()}});this.#u=()=>t.destroy()}else{let t=this.viewComponent;t.parent&&(t.parent=void 0,this.syncShadowObjects())}}#d;#f;#g;#p(){if(this.hasAttribute(te)){let e=this.getAttribute(te)?.trim()||void 0;this.token$.set(e)}}};customElements.define(nt,dt);var br=s=>{let e=s.parentElement;for(;e;){if(e.isShaeEntElement)return e;e=e.parentElement}},vr=new Set(["string","text","number","bigint","float","int","integer","hex","hexadecimal","oct","octal","bin","binary","bool","boolean","[]","text[]","string[]","number[]","float[]","int[]","integer[]","hex[]","hexadecimal[]","oct[]","octal[]","bin[]","binary[]","bool[]","boolean[]","int8array","uint8array","uint8clampedarray","int16array","uint16array","int32array","uint32array","float32array","float64array","bigint64array","biguint64array","json"]),ft=class extends HTMLElement{static{this.observedAttributes=[ht,lt,ut,ct]}get name(){return this.name$.value}get value(){return this.valueOut$.value}set value(e){this.valueIn$.set(e)}get shouldTrim(){return this.shouldTrim$.value}get entNode(){return this.entNode$.value}set entNode(e){this.entNode$.set(e)}get viewComponent(){return this.viewComponent$.value}constructor(){super(),this.isShaeEntElement=!0,this.entNode$=d(),this.viewComponent$=d(),this.name$=d(),this.valueIn$=d(),this.valueOut$=d(),this.type$=d(),this.shouldTrim$=d(!0),this.logger=new P("ShaePropElement"),this.#e=()=>{this.entNode$.set(br(this))},this.#t=()=>{queueMicrotask(()=>{this.isConnected||this.entNode$.set(void 0)})},this.#s=()=>{this.name$.set(this.getAttribute(ht)?.trim()??void 0)},this.#i=()=>{this.valueIn$.set(this.getAttribute(lt))},this.#r=()=>{let e=this.getAttribute(ut)?.trim().toLowerCase();e&&!vr.has(e)&&(this.logger.isWarn&&this.logger.warn(`[${this.name}] unknown type "${e}"`,{shaeProp:this}),e=void 0),this.type$.set(e)},this.#n=()=>{this.shouldTrim$.set(!De(this,ct))},this.entNode$.onChange(e=>{if(e){let t=M(e.viewComponent$,this.viewComponent$);return()=>{t.destroy()}}else this.viewComponent$.set(void 0)}),w(()=>{let e=this.viewComponent$.get();if(e){let t=this.name$.get();if(t){let r=this.valueOut$.get();this.logger.isDebug&&this.logger.debug(`[${this.name}] view-component set-property`,t,r,e.uuid,{viewComponent:e,shaeProp:this}),e.setProperty(t,r),this.isConnected&&this.entNode?.syncShadowObjects()}}}),w(()=>{let e=this.type$.get(),t=this.shouldTrim$.get(),r=this.valueIn$.get();if(t&&typeof r=="string"&&(r=r.trim()),r=r||void 0,r!=null&&typeof r=="string"&&e)switch(e){case"string":case"text":break;case"number":r=Number(r);break;case"bigint":r=BigInt(r);break;case"float":r=parseFloat(r);break;case"int":case"integer":r=parseInt(r,10);break;case"hex":case"hexadecimal":r=parseInt(r,16);break;case"oct":case"octal":r=parseInt(r,8);break;case"bin":case"binary":r=parseInt(r,2);break;case"bool":case"boolean":r=Le.has(r.toLowerCase());break;case"[]":case"text[]":case"string[]":r=r.split(/\W+/);break;case"number[]":r=r.split(/\s+/).map(i=>Number(i));break;case"float[]":r=r.split(/\s+/).map(i=>parseFloat(i));break;case"int[]":case"integer[]":r=r.split(/\s+/).map(i=>parseInt(i));break;case"hex[]":case"hexadecimal[]":r=r.split(/\W+/).map(i=>parseInt(i,16));break;case"oct[]":case"octal[]":r=r.split(/\W+/).map(i=>parseInt(i,8));break;case"bin[]":case"binary[]":r=r.split(/\W+/).map(i=>parseInt(i,2));break;case"bool[]":case"boolean[]":r=r.split(/\W+/).map(i=>Le.has(i.toLowerCase()));break;case"int8array":r=new Int8Array(r.split(/\W+/).map(i=>Number(i)));break;case"uint8array":r=new Uint8Array(r.split(/\W+/).map(i=>Number(i)));break;case"uint8clampedarray":r=new Uint8ClampedArray(r.split(/\W+/).map(i=>Number(i)));break;case"int16array":r=new Int16Array(r.split(/\W+/).map(i=>Number(i)));break;case"uint16array":r=new Uint16Array(r.split(/\W+/).map(i=>Number(i)));break;case"int32array":r=new Int32Array(r.split(/\W+/).map(i=>Number(i)));break;case"uint32array":r=new Uint32Array(r.split(/\W+/).map(i=>Number(i)));break;case"float32array":r=new Float32Array(r.split(/\s+/).map(i=>Number(i)));break;case"float64array":r=new Float64Array(r.split(/\s+/).map(i=>Number(i)));break;case"bigint64array":r=new BigInt64Array(r.split(/\W+/).map(i=>BigInt(i)));break;case"biguint64array":r=new BigUint64Array(r.split(/\W+/).map(i=>BigInt(i)));break;case"json":r=JSON.parse(r);break;default:this.logger.isWarn&&this.logger.warn(`[${this.name}] unknown type "${e}"`,{value:r,shaeProp:this})}this.valueOut$.set(r)}),O(()=>{this.#s(),this.#i(),this.#r(),this.#n()}),this.style.display="contents"}connectedCallback(){O(()=>{this.#e(),this.#s(),this.#i(),this.#r(),this.#n()})}attributeChangedCallback(e){switch(e){case ht:this.#s();break;case lt:this.#i();break;case ut:this.#r();break;case ct:this.#n();break}}disconnectedCallback(){this.#t()}#e;#t;#s;#i;#r;#n};customElements.whenDefined(nt).then(()=>customElements.define(js,ft));var pt,Gt=null,be=class{static{this.OnFrame=Symbol("onFrame")}#e=0;#t=0;constructor(){if(Gt)return Gt;k(this),Gt=this}start(e){if(e!=null)return Ot(this)===0&&this.#i(),m(this,pt.OnFrame,e),this.#t++,()=>{this.stop(e)}}stop(e){x(this,pt.OnFrame,e),Ot(this)===0&&this.#r()}#s=e=>{f(this,pt.OnFrame,e),this.#i()};#i(){this.#e=requestAnimationFrame(this.#s)}#r(){cancelAnimationFrame(this.#e),this.#e=0}};pt=be;var gt=s=>s??void 0;var ve="value",_e=(()=>{let s,e=[],t=[];return class{static{let i=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;s=[Oe({name:ve})],Te(this,null,s,{kind:"accessor",name:"value",static:!1,private:!1,access:{has:n=>"value"in n,get:n=>n.value,set:(n,o)=>{n.value=o}},metadata:i},e,t),i&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})}static{this.Value=ve}#e;#t;#s;get value(){return this.#s}set value(i){this.#s=i}constructor(i){this.#e=[],this.#s=ee(this,e,void 0),this.value$=ee(this,t),G(this,ve),this.value$=R(this,ve),this.value$.onChange(n=>f(this,ve,n)),i&&this.add(...i)}add(...i){return this.#e.push(...i),this.#r(),this.#i(i)}unshift(...i){return this.#e.unshift(...i),this.#r(),this.#i(i)}remove(...i){this.#i(i)()}clear(){this.#e.length=0,this.#r()}dispose(){this.clear(),this.#t?.destroy(),this.#t=void 0,K(this,ve),x(this),this.value$.destroy(),xe(this)}#i(i){return()=>{for(let n of i){let o=this.#e.indexOf(n);o!==-1&&this.#e.splice(o,1)}this.#r()}}#r(){this.#t?.destroy(),this.#e.length===0?(this.#t=void 0,this.value=void 0):(this.#t=w(()=>{let i;for(let n of this.#e){let o=ue(n);if(o!=null){i=o;break}}this.value=i},this.#e),this.#t.run())}}})();var Bt="onCreate",re="onDestroy",$s="onParentChanged",Ws="onViewEvent";var qt=new Map,Ht=!1,wr=(s,e)=>{qt.set(s,e),Ht||(Ht=!0,queueMicrotask(()=>{Ht=!1;let t=Array.from(qt.entries());qt.clear();for(let[r,i]of t)r.set(i)}))},yt=class{#e;#t;#s=new Xe;#i=new Map;#r=new Map;#n;#o;#a=new Set;#h=[];#l=0;get kernel(){return this.#e}get uuid(){return this.#t}get order(){return this.#l}set order(e){this.#l!==e&&(this.#l=e,this.#n&&this.parent.resortChildren())}get parentUuid(){return this.#n||void 0}set parentUuid(e){this.#n!==e&&(this.removeFromParent(),this.#n=e||void 0,this.#o=e?this.#e.getEntity(e):void 0,this.#o&&this.#o.addChild(this))}get parent(){return!this.#o&&this.#n&&(this.#o=this.#e.getEntity(this.#n)),this.#o}set parent(e){this.parentUuid=e?.uuid}get hasParent(){return!!this.#n}get children(){return this.#h}constructor(e,t){this.#e=e,this.#t=t,S(this,re,U.Min,this)}traverse(e){e(this);for(let t of this.#h)t.traverse(e)}onDestroy(){this.#s.clear(),x(this);for(let e of this.#r.values())e.cleanup(),e.signal.destroy();this.#r.clear();for(let e of this.#i.values())e.context.set(void 0),e.unsubscribePathValue(),e.unsubscribeFromParent?.(),e.valuePath.dispose(),e.inherited.destroy(),e.provide.destroy(),e.context.destroy();this.#n=void 0,this.#o=void 0,this.#a.clear(),this.#h.length=0}addChild(e){if(this.#h.length===0){this.#a.add(e.uuid),this.#h.push(e);return}if(this.#a.has(e.uuid))throw new Error(`child with uuid: ${e.uuid} already exists! parentUuid: ${this.uuid}`);this.#a.add(e.uuid),this.#h.push(e),this.resortChildren();for(let[,t]of e.#i)e.#f(t)}resortChildren(){this.#h.sort((e,t)=>e.order-t.order)}removeChild(e){this.#a.has(e.uuid)&&(this.#a.delete(e.uuid),this.#h.splice(this.#h.indexOf(e),1))}removeFromParent(){if(this.#o){this.#o.removeChild(this),this.#o=void 0,this.#n=void 0;for(let[,e]of this.#i)e.unsubscribeFromParent&&(e.unsubscribeFromParent(),e.unsubscribeFromParent=void 0)}}reSubscribeToParentContexts(){for(let[,e]of this.#i)this.#f(e)}dispatchMessageToView(e,t,r,i=!1){this.#e.dispatchMessageToView({uuid:this.#t,type:e,data:t,transferables:r,traverseChildren:i})}dispatchViewEvents(e){for(let{type:t,data:r}of e)f(this,Ws,t,r)}dispatchViewEvent(e,t){this.dispatchViewEvents([{type:e,data:t}])}#u(e){return this.#s.get(e)}getPropertyReader(e){return this.#u(e).get}getPropertyWriter(e){return this.#u(e).set}setProperties(e){this.clearTruthyPropsCache(),O(()=>{for(let[t,r]of e)this.setProperty(t,r)})}setProperty(e,t){this.getPropertyWriter(e)(t)}getProperty(e){return ue(this.getPropertyReader(e))}propKeys(){return Array.from(this.#s.keys())}propEntries(){return Array.from(this.#s.entries()).map(([e,t])=>[e,t.value])}#c;clearTruthyPropsCache(){this.#c=void 0}truthyProps(){if(this.#c)return this.#c.size?this.#c:void 0;let e=new Set;for(let[t,r]of this.#s.entries())if(typeof t=="string"){let i=r.value;i!=null&&i!==!1&&i!==""&&e.add(t)}return this.#c=e,e.size?e:void 0}hasContext(e){return this.#i.has(e)}useContext(e){return this.#d(e).context.get}useParentContext(e){return this.#d(e).inherited.get}provideContext(e){return this.#d(e).provide}provideGlobalContext(e){if(this.#r.has(e))return this.#r.get(e).signal;let t=this.#e.findOrCreateRootContext(e),r=d(),i=t.add(r);return this.#r.set(e,{cleanup:i,signal:r}),r}#d(e){if(this.#i.has(e))return this.#i.get(e);let t=d(),r=d(),i=d(),n=new _e([r,t]),o=m(n,_e.Value,a=>{wr(i,a)}),l={name:e,inherited:t,provide:r,context:i,valuePath:n,unsubscribePathValue:o};return this.#i.set(e,l),this.#f(l),l}#f(e){if(e.unsubscribeFromParent?.(),e.unsubscribeFromParent=void 0,this.parent){let t=this.parent.#d(e.name),r=M(t.context,e.inherited);e.unsubscribeFromParent=r.destroy.bind(r)}else{let t=this.#e.findOrCreateRootContext(e.name),r=M(t.value$,e.inherited);e.unsubscribeFromParent=r.destroy.bind(r)}}};var Is=s=>{let e=s.split("@").map(t=>t.trim());if(e.length===2&&e[1])return e[0]?{key:`${e[0]}@${e[1]}`,prop:e[1],token:e[0]}:{key:e[1],prop:e[1]}},mt=(s,e)=>{for(let t of e)s.add(t)},Cr=(s,e)=>{if(s!=null)for(let t of s.constructors)e.add(t)},Ne=class{static get(e){return e??Er}#e=new Map;#t=new Map;#s=new Map;define(e,t){this.#e.has(e)?Ts(this.#e.get(e).constructors,t):this.#e.set(e,{token:e,constructors:[t]})}appendRoute(e,t){let r=Is(e);r?this.#s.has(r.key)?mt(this.#s.get(r.key).routes,t):this.#s.set(r.key,{routes:new Set(t),token:r.token}):this.#t.has(e)?mt(this.#t.get(e),t):this.#t.set(e,new Set(t))}clearRoute(e){let t=Is(e);t?this.#s.delete(t.key):this.#t.delete(e)}findTokensByRoute(e,t){let r=new Set([e]),i=this.#t.has(e)?[...this.#t.get(e)]:[];for(;i.length;){let n=i.shift();r.has(n)||(r.add(n),this.#t.has(n)&&i.push(...Array.from(this.#t.get(n)).filter(o=>!r.has(o))))}if(t){for(let o of t)this.#s.has(o)&&mt(r,this.#s.get(o).routes);let n;do{n=r.size;for(let o of new Set(r))for(let l of t){let a=`${o}@${l}`;this.#s.has(a)&&mt(r,this.#s.get(a).routes)}}while(n!==r.size)}return r}findConstructors(e,t){let r=this.findTokensByRoute(e,t),i=new Set;for(let n of r)Cr(this.#e.get(n),i);return i.size>0?Array.from(i):void 0}hasToken(e){return this.#e.has(e)}hasRoute(e){return this.#t.has(e)}clear(){this.#e.clear(),this.#t.clear()}},Er=new Ne;var Y;(function(s){s[s.CreateAndDestroy=0]="CreateAndDestroy",s[s.JustCreate=1]="JustCreate",s[s.DestroyOnly=2]="DestroyOnly"})(Y||(Y={}));var Fs=s=>s.displayName||s.name,zs=!1,Vs=!1,Us=!1,Gs=!1,Bs=!1,bt=class{#e;#t;#s;#i;#r;#n;constructor(e){this.logger=new P("Kernel"),this.#e=new Map,this.#t=new Set,this.#r=!0,this.#n=new Map,k(this),this.registry=Ne.get(e)}getEntity(e){let t=this.#e.get(e)?.entity;if(!t)throw new Error(`entity with uuid "${e}" not found!`);return t}hasEntity(e){return this.#e.has(e)}traverseLevelOrderBFS(e=!1){if(this.#r){let t=new Map,r=(i,n)=>{let o=this.getEntity(i);t.has(n)?t.get(n).push(o):t.set(n,[o]);for(let l of o.children)r(l.uuid,n+1)};this.#t.forEach(i=>{r(i,0)}),this.#s=Array.from(t.entries()).sort((i,n)=>i[0]-n[0]).flatMap(([,i])=>i),this.#i=this.#s.slice().reverse(),this.#r=!1}return e?this.#i:this.#s}getEntityGraph(){return Array.from(this.#t).map(e=>this.getEntityGraphNode(e))}getEntityGraphNode(e){if(!this.#e.has(e))return;let{token:t,entity:r}=this.#e.get(e);return{token:t,entity:r,props:Object.fromEntries(r.propEntries()),children:r.children.map(i=>this.getEntityGraphNode(i.uuid))}}upgradeEntities(){let e=new Map;for(let t of this.traverseLevelOrderBFS(!0))e.set(t.uuid,this.updateShadowObjects(t.uuid,Y.DestroyOnly));for(let t of this.traverseLevelOrderBFS(!1))this.updateShadowObjects(t.uuid,Y.JustCreate,e.get(t.uuid));e.clear()}run(e){this.logger.isDebug&&this.logger.debug("sync",e),O(()=>{for(let t of e.changeTrail)this.parse(t)})}parse(e){switch(e.type){case b.CreateEntities:this.createEntity(e.uuid,e.token,e.parentUuid,e.order,e.properties),this.#r=!0;break;case b.DestroyEntities:this.destroyEntity(e.uuid),this.#r=!0;break;case b.SetParent:this.setParent(e.uuid,e.parentUuid,e.order),this.#r=!0;break;case b.UpdateOrder:this.updateOrder(e.uuid,e.order),this.#r=!0;break;case b.ChangeProperties:this.changeProperties(e.uuid,e.properties);break;case b.ChangeToken:this.changeToken(e.uuid,e.token);break;case b.SendEvents:this.dispatchEventsToEntity(e.uuid,e.events);break}}createEntity(e,t,r,i=0,n){let o=new yt(this,e);o.order=i;let l={token:t,entity:o,usedConstructors:new Map};this.#e.set(e,l),r&&(o.parentUuid=r),o.hasParent||this.#t.add(e),n&&o.setProperties(n),this.createShadowObjects(e)}destroyEntity(e){if(!this.#e.has(e))return;let{entity:t,usedConstructors:r}=this.#e.get(e);t.removeFromParent(),f(t,re,this),r.clear(),this.#e.delete(t.uuid),this.#t.delete(t.uuid)}setParent(e,t,r=0){let i=this.getEntity(e);i.parentUuid===t&&i.order===r||(i.removeFromParent(),i.order=r,i.parentUuid=t,i.hasParent?this.#t.delete(e):this.#t.add(e),i.reSubscribeToParentContexts(),queueMicrotask(()=>{this.logger.isDebug&&this.logger.debug("entity.onParentChanged",{uuid:e,parentUuid:t,order:r,entity:i}),f(i,$s,i)}))}updateOrder(e,t){this.getEntity(e).order=t}dispatchEventsToEntity(e,t){this.getEntity(e)?.dispatchViewEvents(t)}changeProperties(e,t){this.getEntity(e).setProperties(t),this.updateShadowObjects(e)}changeToken(e,t){if(!this.#e.has(e))return;let r=this.#e.get(e);r.token!==t&&(r.token=t,this.updateShadowObjects(e))}dispatchMessageToView(e){queueMicrotask(()=>{f(this,me,e)})}updateShadowObjects(e,t=Y.CreateAndDestroy,r){let i=this.#e.get(e);r??=new Set(this.registry.findConstructors(i.token,i.entity.truthyProps()));let n=t===Y.CreateAndDestroy||t===Y.DestroyOnly,o=t===Y.CreateAndDestroy||t===Y.JustCreate;if(n){for(let[l,a]of i.usedConstructors)if(!r.has(l)){i.usedConstructors.delete(l);for(let c of a)this.destroyShadowObject(c,i.entity)}}if(o)for(let l of r)i.usedConstructors.has(l)||this.constructShadowObject(l,i);return r}constructShadowObject(e,t){let r=new Set,i=new Set,n=new Map,o=new Map,l=new Map,a=new Map,c=new Map,C=(u,h)=>{!Bs&&h!=null&&typeof h=="function"&&(console.warn('[shadow-objects] Deprecation Warning: The "isEqual" option of "useProperty()" is now passed as {compare} argument. Please update your code accordingly.'),Bs=!0);let y=typeof h=="function"?{compare:h}:h,g=c.get(u);if(g===void 0){g=d(void 0,y).get,c.set(u,g);let p=M(t.entity.getPropertyReader(u),g);i.add(p.destroy.bind(p))}return g},v=k(new e({entity:t.entity,provideContext(u,h,y){!zs&&y!=null&&typeof y=="function"&&(console.warn('[shadow-objects] Deprecation Warning: The "isEqual" option of "provideContext()" is now passed as {compare} argument. Please update your code accordingly.'),zs=!0);let g=typeof y=="function"?{compare:y}:y,p=l.get(u);if(p==null){let N=q(h),Et=N?void 0:gt(h);if(p=d(Et,g?.compare?{compare:g.compare}:void 0),N){let Ce=M(h,p);i.add(Ce.destroy.bind(Ce))}let we=M(p,t.entity.provideContext(u));i.add(we.destroy.bind(we)),l.set(u,p)}return p!=null&&(g?.clearOnDestroy??!0)&&i.add(()=>{p.set(void 0)}),p},provideGlobalContext(u,h,y){!Vs&&y!=null&&typeof y=="function"&&(console.warn('[shadow-objects] Deprecation Warning: The "isEqual" option of "provideGlobalContext()" is now passed as {compare} argument. Please update your code accordingly.'),Vs=!0);let g=typeof y=="function"?{compare:y}:y,p=a.get(u);if(p==null){let N=q(h),Et=N?void 0:gt(h);if(p=d(Et,g?.compare?{compare:g.compare}:void 0),N){let Ce=M(h,p);i.add(Ce.destroy.bind(Ce))}let we=M(p,t.entity.provideGlobalContext(u));i.add(we.destroy.bind(we)),a.set(u,p)}return p!=null&&(g?.clearOnDestroy??!0)&&i.add(()=>{p.set(void 0)}),p},useContext(u,h){!Us&&h!=null&&typeof h=="function"&&(console.warn('[shadow-objects] Deprecation Warning: The "isEqual" option of "useContext()" is now passed as {compare} argument. Please update your code accordingly.'),Us=!0);let y=typeof h=="function"?{compare:h}:h,g=n.get(u);if(g===void 0){g=d(void 0,y).get,n.set(u,g);let p=M(t.entity.useContext(u),g);i.add(p.destroy.bind(p))}return g},useParentContext(u,h){!Gs&&h!=null&&typeof h=="function"&&(console.warn('[shadow-objects] Deprecation Warning: The "isEqual" option of "useParentContext()" is now passed as {compare} argument. Please update your code accordingly.'),Gs=!0);let y=typeof h=="function"?{compare:h}:h,g=o.get(u);if(g===void 0){g=d(void 0,y).get,o.set(u,g);let p=M(t.entity.useParentContext(u),g);i.add(p.destroy.bind(p))}return g},dispatchMessageToView(u,h,y,g=!1){t.entity.dispatchMessageToView(u,h,y,g)},useProperty:C,useProperties(u){let h={};for(let y in u)Object.hasOwn(u,y)&&(h[y]=C(u[y]));return h},createResource(u,h){let y=d(),g=w(()=>{let p=gt(u());return y.set(p),p!==void 0&&h?()=>{h(p),y.set(void 0)}:()=>{y.set(void 0)}});return i.add(()=>{g.destroy(),y.set(void 0),A(y)}),y},createEffect(...u){let h=w(...u);return i.add(h.destroy),h},createSignal(...u){let h=d(...u);return i.add(()=>{A(h)}),h},createMemo(...u){let h=Nt(...u);return i.add(()=>{A(h)}),h},on(...u){let h=m(...u);return i.add(h),h},once(...u){let h=S(...u);return i.add(h),h},onDestroy(u){r.add(u)}}));return this.logger.isInfo&&this.logger.info("create shadow-object",Fs(e),{shadowObject:v,entity:t.entity}),S(t.entity,re,U.Low,()=>{this.logger.isInfo&&this.logger.info("destroy shadow-object",Fs(e),{shadowObject:v,entity:t.entity});for(let h of r)h();for(let h of i)h();for(let h of n.values())A(h);for(let h of o.values())A(h);for(let h of c.values())A(h);for(let h of l.values())A(h);for(let h of a.values())A(h);r.clear(),i.clear(),n.clear(),o.clear(),c.clear(),l.clear(),a.clear();let u=t.usedConstructors.get(e);u&&(u.delete(v),u.size===0&&t.usedConstructors.delete(e))}),t.usedConstructors.has(e)?t.usedConstructors.get(e).add(v):t.usedConstructors.set(e,new Set([v])),this.attachShadowObject(v,t.entity),v}createShadowObjects(e){let t=this.#e.get(e);this.registry.findConstructors(t.token,t.entity.truthyProps())?.forEach(r=>{this.constructShadowObject(r,t)})}findShadowObjects(e){if(!this.#e.has(e))return[];let{usedConstructors:t}=this.#e.get(e);return Array.from(new Set(Array.from(t.values()).flatMap(r=>Array.from(r))))}attachShadowObject(e,t){m(t,e),typeof e[Bt]=="function"&&e[Bt](t)}destroyShadowObject(e,t){typeof e[re]=="function"&&e[re](t),f(e,re,t),x(t,e)}findOrCreateRootContext(e){let t=this.#n.get(e);return t||(t=new _e,this.#n.set(e,t)),t}destroy(){for(let e of this.#n.values())e.dispose();this.#n.clear();for(let e of this.traverseLevelOrderBFS().reverse())this.destroyEntity(e.uuid)}};async function Qt(s,e,t,r=!0){if(t.has(e)){console.warn("importModule: skipping already imported module",e);return}else t.add(e);e.extends&&await Promise.all(e.extends.map(n=>Qt(s,n,t,!1)));let{registry:i}=s;if(e.define)for(let[n,o]of Object.entries(e.define))i.define(n,o);if(e.routes)for(let[n,o]of Object.entries(e.routes))i.appendRoute(n,o);await(e.initialize?.({define:(n,o)=>i.define(n,o),kernel:s,registry:i})??Promise.resolve()),r&&s.upgradeEntities()}var vt=s=>(typeof s=="string"&&(s=new URL(s,globalThis.location.href)),s.toString());function qs(s){return s.map(e=>{if(e.transferables&&e.transferables.length>0){let{transferables:t,...r}=e;return structuredClone(r,{transfer:t})}else return structuredClone(e)})}var wt=class{#e;get registry(){return this.kernel.registry}constructor(e){this.#e=new Set,this.isLocalEnv=!0,this.disableStructuredClone=!1,this.kernel=new bt(e),m(this.kernel,me,t=>{if(this.onMessageToView!=null){let{type:r,uuid:i,traverseChildren:n}=t,o=structuredClone(t.data,{transfer:t.transferables});this.onMessageToView({type:r,uuid:i,data:o,traverseChildren:n})}})}start(){return Promise.resolve()}applyChangeTrail(e,t){let r={changeTrail:this.disableStructuredClone?e:qs(e)},i;try{this.kernel.run(r),i=Promise.resolve()}catch(n){i=Promise.reject(n)}return i}async importScript(e){let t=await import(vt(e));t[$t]&&await this.importModule(t[$t])}async importModule(e){return Qt(this.kernel,e,this.#e)}destroy(){this.kernel.destroy(),this.registry.clear(),this.#e.clear()}};function Yt(s){let e=new Blob([s],{type:"text/javascript"}),t=URL.createObjectURL(e),r=new Worker(t);return URL.revokeObjectURL(t),r}function Kt(){return Yt('var Ks=Object.defineProperty;var oe=Object.getOwnPropertySymbols;var Be=Object.prototype.hasOwnProperty,We=Object.prototype.propertyIsEnumerable;var Ys=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),qe=t=>{throw TypeError(t)};var me=(t,e,s)=>e in t?Ks(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,we=(t,e)=>{for(var s in e||(e={}))Be.call(e,s)&&me(t,s,e[s]);if(oe)for(var s of oe(e))We.call(e,s)&&me(t,s,e[s]);return t};var Je=(t,e)=>{var s={};for(var i in t)Be.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(t!=null&&oe)for(var i of oe(t))e.indexOf(i)<0&&We.call(t,i)&&(s[i]=t[i]);return s};var c=(t,e,s)=>me(t,typeof e!="symbol"?e+"":e,s),Ce=(t,e,s)=>e.has(t)||qe("Cannot "+s);var r=(t,e,s)=>(Ce(t,e,"read from private field"),s?s.call(t):e.get(t)),f=(t,e,s)=>e.has(t)?qe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),u=(t,e,s,i)=>(Ce(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s),C=(t,e,s)=>(Ce(t,e,"access private method"),s);var Ke=(t,e,s,i)=>({set _(a){u(t,e,a,s)},get _(){return r(t,e,i)}});var Ee=function(t,e){this[0]=t,this[1]=e},Ye=(t,e,s)=>{var i=(n,d,y,m)=>{try{var w=s[n](d),h=(d=w.value)instanceof Ee,l=w.done;Promise.resolve(h?d[0]:d).then(p=>h?i(n==="return"?n:"next",d[1]?{done:p.done,value:p.value}:p,y,m):y({value:p,done:l})).catch(p=>i("throw",p,y,m))}catch(p){m(p)}},a=n=>o[n]=d=>new Promise((y,m)=>i(n,d,y,m)),o={};return s=s.apply(t,e),o[Ys("asyncIterator")]=()=>o,a("next"),a("throw"),a("return"),o};var He;(function(t){t[t.StructuralChanges=1]="StructuralChanges",t[t.ContentUpdates=2]="ContentUpdates",t[t.Removal=3]="Removal"})(He||(He={}));var tt;(function(t){t[t.CreateEntities=1]="CreateEntities",t[t.DestroyEntities=2]="DestroyEntities",t[t.SetParent=3]="SetParent",t[t.UpdateOrder=4]="UpdateOrder",t[t.ChangeProperties=5]="ChangeProperties",t[t.ChangeToken=6]="ChangeToken",t[t.SendEvents=7]="SendEvents"})(tt||(tt={}));var Hs="configure",Qs="changeTrail",Xs="destroy",Zs="loaded",Qe="appliedChangeTrail",Se="importedModule",_s="destroyed",De="messageToView",ke="shadowObjects",N="ConsoleLogger",x=`${N}Storage`,ys,vs,bs,ti=!!((bs=(vs=(ys=globalThis.location)==null?void 0:ys.host)==null?void 0:vs.startsWith("localhost"))!=null&&bs),Qt="localStorage"in globalThis,he=Symbol.for(N),Xe=!1,Ze=t=>{if(typeof t=="boolean")return t;switch(t.toLowerCase()){case"true":case"yes":case"on":return!0;default:return!1}},Le=t=>[Qt?N:void 0,...Array.isArray(t)?t:[t]].filter(Boolean).join(".");function Ae(t,e=void 0,s){var o;let i=Le(t),a=Qt?localStorage.getItem(i):(o=globalThis[x])==null?void 0:o[i];return a!=null?e(a):s}function Ut(t,e){Qt?localStorage.setItem(Le(t),e):(globalThis[x]==null&&(globalThis[x]={},console.debug(`${N}: Initialize`,{[x]:globalThis[x]})),globalThis[x][Le(t)]=e)}var mt,Wt,v,ei=(v=class{constructor(e){f(this,mt);this.enable=!0,this.namespace=(e||"").trim()||N,Xe||(v.loadConfig(),Xe=!0);let s=[this.namespace,"enable"];this.enable=Ae(s,Ze,this.enable),Ut(s,Qt?this.enable?"true":"false":this.enable)}static get isEnabled(){return v.sharedConfig.enable}static get isDebug(){return v.sharedConfig.enable&&v.sharedConfig.debug}static loadConfig(){var e,s,i;Qt?(["enable","debug","info","warn"].forEach(a=>{this.sharedConfig[a]=Ae(a,Ze,this.sharedConfig[a])}),["debug","info","warn","error"].forEach(a=>{this.sharedStyles[a]=Ae(["styles",a],void 0,this.sharedStyles[a])}),v.isDebug&&console.debug(`${N}: Load config from localStorage`,v.sharedConfig),(e=globalThis[N])!=null&&e[he]||((s=globalThis[N])!=null||(globalThis[N]={[he]:!0,get enable(){return v.sharedConfig.enable},set enable(a){v.sharedConfig.enable=a,Ut("enable",a?"true":"false")},get debug(){return v.sharedConfig.debug},set debug(a){v.sharedConfig.debug=a,Ut("debug",a?"true":"false")},get info(){return v.sharedConfig.info},set info(a){v.sharedConfig.info=a,Ut("info",a?"true":"false")},get warn(){return v.sharedConfig.warn},set warn(a){v.sharedConfig.warn=a,Ut("warn",a?"true":"false")}}))):(i=globalThis[x])!=null&&i[he]||(globalThis[x]=we(we({[he]:!0},v.sharedConfig),globalThis[x]),v.sharedConfig=globalThis[x],v.isDebug&&console.debug(`${N}: Load config from ${x}`,globalThis[x]))}get isEnabled(){return this.enable&&v.sharedConfig.enable}get isDebug(){return this.isEnabled&&v.sharedConfig.debug}get isInfo(){return this.isEnabled&&v.sharedConfig.info}get isWarn(){return this.isEnabled&&v.sharedConfig.warn}debug(...e){C(this,mt,Wt).call(this,"debug",v.sharedStyles.debug,e)}info(...e){C(this,mt,Wt).call(this,"info",v.sharedStyles.info,e)}warn(...e){C(this,mt,Wt).call(this,"warn",v.sharedStyles.warn,e)}error(...e){C(this,mt,Wt).call(this,"error",v.sharedStyles.error,e)}},mt=new WeakSet,Wt=function(e,s,i){console[e](`%c${this.namespace}`,s,...i)},v.sharedConfig={enable:ti,debug:!1,info:!0,warn:!0,"styles.debug":"color: #111; background: #999; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em","styles.info":"color: #020; background: #8a8; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em","styles.warn":"color: #fa0; background: #a98; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em","styles.error":"color: #ff0; background: #a00; display: inline-block; padding: 0 0.25em; margin: 0; border-radius: 0.25em"},v.sharedStyles={get debug(){return v.sharedConfig["styles.debug"]},set debug(e){v.sharedConfig["styles.debug"]=e},get info(){return v.sharedConfig["styles.info"]},set info(e){v.sharedConfig["styles.info"]=e},get warn(){return v.sharedConfig["styles.warn"]},set warn(e){v.sharedConfig["styles.warn"]=e},get error(){return v.sharedConfig["styles.error"]},set error(e){v.sharedConfig["styles.error"]=e}},v),Ot="*",Os=1,$e=2,Ie=4,vt=Symbol.for("eventize"),si="[eventize]",pe=t=>t===Ot,Ms=t=>{switch(typeof t){case"string":case"symbol":return!0;default:return!1}},js=typeof console<"u",ii=js?console[console.warn?"warn":"log"].bind(console,si):()=>{},ri=(t,e,s)=>(Object.defineProperty(t,e,{value:s,configurable:!0}),t),ai=0,Ts=class{constructor(){c(this,"events",new Map);c(this,"eventNames",new Set)}static publish(t){t.sort((e,s)=>e.order-s.order).forEach(e=>e.emit())}add(t){Array.isArray(t)?t.forEach(e=>this.eventNames.add(e)):this.eventNames.add(t)}remove(t){Array.isArray(t)?t.forEach(e=>this.eventNames.delete(e)):this.eventNames.delete(t),this.clear(t)}clear(t){Array.isArray(t)?t.forEach(e=>this.events.delete(e)):this.events.delete(t)}retain(t,e){this.eventNames.has(t)&&this.events.set(t,{args:e,order:ai++})}isKnown(t){return this.eventNames.has(t)}emit(t,e,s=[]){if(pe(t))this.eventNames.forEach(i=>this.emit(i,e,s));else if(this.events.has(t)){let{order:i,args:a}=this.events.get(t);s.push({order:i,emit:()=>e.apply(t,a)})}return s}},Re=(t,e,s,i)=>{if(typeof e=="function"){let a=e.apply(t,s);a!=null&&(i==null||i(a))}},ni=(t,e,s,i)=>Re(e,e.emit,[t].concat(s),i),oi=t=>{switch(typeof t){case"function":return Os;case"string":case"symbol":return $e;case"object":return Ie}},hi=0,li=()=>++hi,Ds=class{constructor(t,e,s,i=null){c(this,"id");c(this,"eventName");c(this,"isCatchEmAll");c(this,"priority");c(this,"listener");c(this,"listenerObject");c(this,"listenerType");c(this,"callAfterApply");c(this,"isRemoved");c(this,"refCount");this.id=li(),this.eventName=t,this.isCatchEmAll=pe(t),this.listener=s,this.listenerObject=i,this.priority=e,this.listenerType=oi(s),this.callAfterApply=void 0,this.isRemoved=!1,this.refCount=1}isEqual(t,e=null){if(t===this)return!0;let s=typeof t;return s==="number"&&t===this.id?!0:e===null&&(s==="string"||s==="symbol")?t===Ot||t===this.eventName:this.listener===t&&this.listenerObject===e}apply(t,e,s){if(this.isRemoved)return;let{listener:i,listenerObject:a}=this;switch(this.listenerType){case Os:Re(a,i,e,s),this.callAfterApply&&this.callAfterApply();break;case $e:Re(a,a[i],e,s),this.callAfterApply&&this.callAfterApply();break;case Ie:{let o=i[t];if(this.isCatchEmAll||this.eventName===t){if(typeof o=="function"){let n=o.apply(i,e);n!=null&&(s==null||s(n))}else ni(t,i,e,s);this.callAfterApply&&this.callAfterApply()}break}}}},di=(t,e)=>t.priority!==e.priority?e.priority-t.priority:t.id-e.id,_e=t=>t==null?void 0:t.slice(0),ts=(t,e)=>{let s=t.indexOf(e);s>-1&&t.splice(s,1)},ui=t=>t===Ie||t===$e,xe=(t,e,s)=>{let i=t.findIndex(a=>a.isEqual(e,s));i>-1&&(t[i].isRemoved=!0,t.splice(i,1))},le=(t,e,s)=>{let i=[];for(let a of t)(e==null&&a.listenerObject===s||a.eventName===e&&a.listener===s)&&i.push(a);for(let a of i)xe(t,a,void 0)},Pe=t=>{t&&(t.forEach(e=>{e.isRemoved=!0}),t.length=0)},ci=(t,e)=>t.listenerType===e.listenerType?t.priority===e.priority&&t.eventName===e.eventName&&t.listenerObject===e.listenerObject&&t.listener===e.listener:!1,fi=(t,e)=>{if(ui(t.listenerType))return e.find(s=>ci(t,s))},pi=(t,e)=>{let s=fi(t,e);return s?(s.refCount+=1,s):(e.push(t),e.sort(di),t)},gi=class{constructor(){c(this,"namedListeners");c(this,"catchEmAllListeners");c(this,"getListenersForEventName",t=>{let e=this.namedListeners.get(t);return e||(e=[],this.namedListeners.set(t,e)),e});this.namedListeners=new Map,this.catchEmAllListeners=[]}add(t){return pi(t,t.isCatchEmAll?this.catchEmAllListeners:this.getListenersForEventName(t.eventName))}remove(t,e,s=!1){e==null&&Array.isArray(t)?t.forEach(i=>this.remove(i,null,s)):t==null||e==null&&pe(t)?this.removeAllListeners():e==null&&Ms(t)?Pe(this.namedListeners.get(t)):t instanceof Ds?t.isRemoved||(t.refCount-=1,t.refCount<1&&(t.isRemoved=!0,this.namedListeners.forEach(i=>ts(i,t)),ts(this.catchEmAllListeners,t))):s?pe(t)&&typeof t=="object"?le(this.catchEmAllListeners,Ot,t):this.namedListeners.forEach(i=>le(i,t,e)):(this.namedListeners.forEach(i=>{xe(i,t,e),typeof t=="object"&&le(i,void 0,t)}),xe(this.catchEmAllListeners,t,e),typeof t=="object"&&le(this.catchEmAllListeners,void 0,t))}removeAllListeners(){this.namedListeners.forEach(t=>Pe(t)),this.namedListeners.clear(),Pe(this.catchEmAllListeners)}forEach(t,e){let s=_e(this.catchEmAllListeners),i=_e(this.namedListeners.get(t));if(t===Ot||!i||i.length===0)s.forEach(e);else if(s.length===0)i.forEach(e);else{let a=i.length,o=s.length,n=0,d=0;for(;n<a||d<o;){if(n<a){let y=i[n];if(d>=o||y.priority>=s[d].priority){e(y),++n;continue}}d<o&&(e(s[d]),++d)}}}getSubscriptionCount(){let t=this.catchEmAllListeners.length;for(let e of this.namedListeners.values())t+=e.length;return t}},$t=t=>!!(t&&t[vt]);function Xt(t){if($t(t))return t;let e=new gi,s=new Ts;return ri(t,vt,{keeper:s,store:e}),t}var ve={Max:Number.POSITIVE_INFINITY,AAA:1e9,BB:1e6,C:1e3,Default:0,Low:-1e4,Min:Number.NEGATIVE_INFINITY},yi=(t,e,s,i,a,o,n)=>{let d=t.add(new Ds(s,i,a,o));return e.emit(s,d,n),d},vi=(t,e,s,i)=>{let a=s.length,o=typeof s[0],n,d,y,m;if(a>=2&&a<=3&&o==="number"?(n=Ot,[d,y,m]=s):a>=3&&a<=4&&typeof s[1]=="number"?[n,d,y,m]=s:(d=ve.Default,o==="string"||o==="symbol"||Array.isArray(s[0])?[n,y,m]=s:(n=Ot,[y,m]=s)),!y&&js)throw ii("called with insufficient arguments!",s),"subscribeTo() called with insufficient arguments!";let w=h=>l=>yi(t,e,l,h,y,m,i);return Array.isArray(n)?n.map(h=>Array.isArray(h)?w(h[1])(h[0]):w(d)(h)):w(d)(n)},Ls=(t,e,s)=>{let i=[],a=vi(t,e,s,i);return Ts.publish(i),a},es=t=>e=>{e.callAfterApply=()=>{t==null||t()}},Rs=(t,e)=>Object.assign(()=>V(t,e),Array.isArray(e)?{listeners:e}:{listener:e}),xs=(t,e,s,i)=>{let{store:a,keeper:o}=t[vt];Array.isArray(e)?e.forEach(n=>{a.forEach(n,d=>d.apply(n,s,i)),o.retain(n,s)}):e!==Ot&&(a.forEach(e,n=>{n.apply(e,s,i)}),o.retain(e,s))},_=(t,...e)=>{let s=Xt(t),{store:i,keeper:a}=s[vt];return Rs(s,Ls(i,a,e))},M=(t,...e)=>{let s=Xt(t),{store:i,keeper:a}=s[vt],o=Ls(i,a,e),n=Rs(s,o),d=!1,y=()=>{d||(n(),d=!0)};return Array.isArray(o)?o.forEach(es(y)):es(y)(o),y},bi=(t,e)=>new Promise(s=>{M(t,e,s)}),V=(t,e,s)=>{if(!$t(t))throw new Error("object is not eventized");let{store:i,keeper:a}=t[vt],o=typeof e,n=s!=null&&(o==="string"||o==="symbol");i.remove(e,s,n),Array.isArray(e)?a.remove(e.filter(d=>typeof d=="string")):Ms(e)&&a.remove(e)},E=(t,e,...s)=>{if(!$t(t))throw new Error("object is not eventized");xs(t,e,s)},mi=(t,e,...s)=>{if(!$t(t))throw new Error("object is not eventized");let i=[];return xs(t,e,s,a=>{i.push(a)}),i=i.map(a=>Array.isArray(a)?Promise.all(a):Promise.resolve(a)),i.length>0?Promise.all(i):Promise.resolve()},Ge=(t,e)=>{let s=Xt(t),{keeper:i}=s[vt];i.add(e)},ge=(t,e)=>{if(!$t(t))throw new Error("object is not eventized");let{keeper:s}=t[vt];s.clear(e)},ot=(()=>{let t=(e={})=>Xt(e);return t.inject=(e={})=>(e=Xt(e),Object.assign(e,{on:(...s)=>_(e,...s),once:(...s)=>M(e,...s),onceAsync:s=>bi(e,s),off:(s,i)=>V(e,s,i),emit:(s,...i)=>E(e,s,...i),emitAsync:(s,...i)=>mi(e,s,...i),retain:s=>Ge(e,s),retainClear:s=>ge(e,s)}),e),t.is=$t,t})(),Z=Symbol.for("signal"),Mt=Symbol.for("effect"),ss=Symbol.for("destroySignal"),is=Symbol.for("createEffect"),wi=Symbol.for("destroyEffect"),Bt="value",rs="mute",as="unmute",Yt="destroy",Ht=Symbol.for("recall"),ye=ot(),Nt=ot(),bt=ot(),zs=ot(),Te,qt=(Te=class{constructor(){c(this,"delayedEffects",[])}batch(t,e){let s=this.delayedEffects.length;for(let i=0;i<s;i++){let[a,o]=this.delayedEffects[i];if(!(a>e))if(a===e){o.add(t);return}else{this.delayedEffects.splice(i,0,[e,new Set([t])]);return}}this.delayedEffects.push([e,new Set([t])])}flush(){this.run(),this.delayedEffects.length=0}run(){let t=new Set,e=[_(bt,(i,a)=>{a===Ht&&t.add(i)}),_(zs,i=>{t.add(i)})],s=this.delayedEffects.flatMap(([,i])=>Array.from(i));for(let i of s)t.has(i)||E(bt,i,i,Ht);e.forEach(i=>{i()})}},c(Te,"current"),Te),Ci=()=>qt.current;function Zt(t){let e=qt.current;e?e=void 0:e=qt.current=new qt;try{t()}finally{e&&(qt.current=void 0,e.run())}}var Ei=0;function Fs(){return Ei>0}var ms,Si=(ms=Mt,class{constructor(t){c(this,ms);c(this,"run",()=>{var t;return(t=this[Mt])==null?void 0:t.run()});c(this,"destroy",()=>{var t;(t=this[Mt])==null||t.destroy(),this[Mt]=void 0});this[Mt]=t,M(t,$s.Destroy,()=>{this[Mt]=void 0})}}),ht=new Map,J,wt,G,it,K,Ct,Et,U,St,nt,ne=(nt=class{constructor(e){f(this,J,new Set);f(this,wt,new Set);f(this,G,new Map);f(this,it,new WeakMap);f(this,K,new Map);f(this,Ct,new Set);f(this,Et,new Set);f(this,U);f(this,St);if(e!=null&&e instanceof nt)return e;if(e!=null||(e=this),ht.has(e))return ht.get(e);u(this,St,e),ht.set(e,this),ot(this)}static get(e){if(e!=null)return e instanceof nt?e:ht.get(e)}static findOrCreate(e){if(e==null)throw new Error("Cannot create a group with a null object");return new nt(e)}static destroy(e){console.warn("SignalGroup.destroy(obj) is deprecated. Use SignalGroup.delete(obj) instead."),nt.delete(e)}static delete(e){var s;(s=ht.get(e))==null||s.clear()}static clear(){for(let e of ht.values())e.destroy();ht.clear()}attachGroup(e){if(e===this)throw new Error("Cannot attach a group to itself");return r(this,J).add(e),r(e,U)&&r(e,U)!==this&&r(r(e,U),J).delete(e),u(e,U,this),e}detachGroup(e){return e!==this&&r(this,J).has(e)&&(r(this,J).delete(e),u(e,U,void 0)),e}attachSignal(e){let s=A(e);if(s!=null&&s.destroyed)throw new Error("Cannot attach a destroyed signal to a group");return s&&r(this,wt).add(s),e}attachSignalByName(e,s){if(s){this.attachSignal(s);let i=A(s);r(this,G).set(e,i),r(this,K).has(e)?r(this,K).get(e).push(i):r(this,K).set(e,[i]),r(this,it).has(i)?r(this,it).get(i).add(e):r(this,it).set(i,new Set([e]))}else r(this,G).delete(e);return s}hasSignal(e){var s;return r(this,G).has(e)||!!((s=r(this,U))!=null&&s.hasSignal(e))}signal(e){var s,i,a;return(a=(s=r(this,G).get(e))==null?void 0:s.object)!=null?a:(i=r(this,U))==null?void 0:i.signal(e)}detachSignal(e){let s=A(e);if(s&&(r(this,wt).delete(s),r(this,it).has(s))){let i=r(this,it).get(s);for(let a of i)if(r(this,K).has(a)){let o=r(this,K).get(a);o.splice(o.indexOf(s),1),o.length===0?(r(this,G).delete(a),r(this,K).delete(a)):r(this,G).get(a)===s&&r(this,G).set(a,o.at(-1))}i.clear(),r(this,it).delete(s)}return e}attachEffect(e){return r(this,Ct).add(e),e}runEffects(){for(let e of r(this,Ct))e.run();for(let e of r(this,J))e.runEffects()}attachLink(e){if(e!=null&&e.isDestroyed)throw new Error("Cannot attach a destroyed link to a group");return e&&r(this,Et).add(e),e}detachLink(e){return e&&r(this,Et).delete(e),e}destroy(){console.warn("SignalGroup#destroy is deprecated. Use SignalGroup#clear instead."),this.clear()}clear(){var e;E(this,Yt,this),V(this);for(let s of r(this,J))s.destroy();for(let s of r(this,Ct))s.destroy();for(let s of r(this,wt))I(s);for(let s of r(this,Et))s.destroy();r(this,J).clear(),r(this,wt).clear(),r(this,G).clear(),r(this,K).clear(),r(this,Ct).clear(),r(this,Et).clear(),(e=r(this,U))==null||e.detachGroup(this),r(this,St)&&(ht.delete(r(this,St)),u(this,St,void 0))}},J=new WeakMap,wt=new WeakMap,G=new WeakMap,it=new WeakMap,K=new WeakMap,Ct=new WeakMap,Et=new WeakMap,U=new WeakMap,St=new WeakMap,nt),se,ie,ws,Ns=(ws=class{constructor(t="id",e=1){f(this,se);f(this,ie);u(this,se,t),u(this,ie,e)}make(){return Symbol(`${r(this,se)}${Ke(this,ie)._++}`)}},se=new WeakMap,ie=new WeakMap,ws),ze=[],Vs=()=>ze.at(-1),ki=(t,e)=>{ze.push(t);try{return e()}finally{ze.pop()}},Ai=t=>t!=null&&typeof t.then=="function",O,lt,Y,kt,dt,ut,At,Dt,$s=(O=class{constructor(e,s){c(this,"id");c(this,"callback");f(this,lt);f(this,Y,new Set);f(this,kt,new Set);f(this,dt,new Map);f(this,ut,new Set);c(this,"parentEffect");c(this,"childEffects",[]);c(this,"curChildEffectSlot",0);c(this,"autorun",!0);c(this,"shouldRun",!0);c(this,"priority");f(this,At);f(this,Dt,!1);c(this,"run",()=>{if(r(this,Dt)||!this.shouldRun)return;let e=Ci();e?e.batch(this.id,this.priority):(this.runCleanupCallback(),this.curChildEffectSlot=0,this.shouldRun=!1,E(zs,this.id,this.id),this.hasStaticDeps()?u(this,lt,this.callback()):(u(this,kt,new Set(r(this,Y))),u(this,lt,ki(this,this.callback)),this.cleanupLostSignals(),r(this,ut).clear()))});c(this,"destroy",()=>{r(this,Dt)||(E(this,O.Destroy,this),V(this),E(bt,wi,this),this.runCleanupCallback(),V(ye,this),V(bt,this),V(Nt,this),u(this,Dt,!0),r(this,Y).clear(),r(this,kt).clear(),r(this,dt).clear(),r(this,ut).clear(),this.childEffects.forEach(e=>{e.destroy()}),this.childEffects.length=0,--O.count)});var a,o;ot(this),this.callback=e;let i;(s==null?void 0:s.attach)!=null&&(i=ne.findOrCreate(s.attach),i.attachEffect(this)),this.autorun=(a=s==null?void 0:s.autorun)!=null?a:!0,u(this,At,s!=null&&s.dependencies?s.dependencies.map(n=>{switch(typeof n){case"string":case"symbol":return i.signal(n);default:return n}}):void 0),this.id=O.idGen.make(),this.priority=(o=s==null?void 0:s.priority)!=null?o:0,_(bt,this.id,Ht,this),++O.count}hasStaticDeps(){return r(this,At)!=null&&r(this,At).length>0}saveSignalsFromDeps(){for(let e of r(this,At))this.whenSignalIsRead(A(e).id)}static createEffect(e,s,i){let a=Array.isArray(s)?s:void 0,o=a?i!=null?i:{dependencies:a}:s;o&&a&&(o.dependencies=a);let n,d=Vs();return d!=null?(n=d.getCurrentChildEffect(),n==null&&(n=new O(e,o),d.attachChildEffect(n),E(bt,is,n)),d.curChildEffectSlot++):(n=new O(e,o),E(bt,is,n)),n.hasStaticDeps()?n.saveSignalsFromDeps():n.autorun&&n.run(),new Si(n)}getCurrentChildEffect(){return this.childEffects[this.curChildEffectSlot]}attachChildEffect(e){this.childEffects.push(e),this.parentEffect=this}[Ht](){this.shouldRun=!0,this.autorun&&this.run()}whenSignalIsRead(e){r(this,kt).delete(e),r(this,Y).has(e)||(r(this,Y).add(e),r(this,dt).set(e,[_(ye,e,this.priority,Ht,this),M(Nt,e,ss,this)]))}[ss](e){!r(this,ut).has(e)&&r(this,Y).has(e)&&(r(this,ut).add(e),this.unsubscribeSignal(e),r(this,ut).size===r(this,Y).size&&this.destroy())}cleanupLostSignals(){for(let e of r(this,kt))this.unsubscribeSignal(e),r(this,Y).delete(e)}unsubscribeSignal(e){r(this,dt).has(e)&&(r(this,dt).get(e).forEach(s=>{s()}),r(this,dt).delete(e))}runCleanupCallback(){if(r(this,lt)!=null){let e=r(this,lt);u(this,lt,void 0),Ai(e)?Promise.resolve(e).then(s=>{typeof s=="function"&&s()}):e()}}},lt=new WeakMap,Y=new WeakMap,kt=new WeakMap,dt=new WeakMap,ut=new WeakMap,At=new WeakMap,Dt=new WeakMap,c(O,"idGen",new Ns("ef")),c(O,"Destroy","destroy"),c(O,"count",0),O),Vt=(...t)=>$s.createEffect(...t),_t=new WeakMap,Pi=t=>{let e=_t.get(t);return e||(e={},_t.set(t,e)),e},te=(t,e)=>{var s,i;return(i=(s=_t.get(t))==null?void 0:s.signals)==null?void 0:i.get(e)},Oi=(t,e,s)=>{var a;let i=Pi(t);(a=i.signals)!=null||(i.signals=new Map),i.signals.set(e,s)};function Mi(...t){for(let e of t)if(_t.has(e)){let s=_t.get(e);if(s.signals){for(let i of s.signals.values())I(i);s.signals.clear(),s.signals=void 0}}}function ji(t){let e=A(ee(t)?t:te(...t));e!=null&&!e.muted&&!e.destroyed&&Fe(e.id,e.value,{touch:!0})}function Ue(t){var e,s;return ee(t)?(e=A(t))==null?void 0:e.value:(s=A(te(...t)))==null?void 0:s.value}var Cs,Ti=(Cs=Z,class{constructor(t){c(this,Cs);this[Z]=t}get get(){return this[Z].reader}get set(){return this[Z].writer}get value(){return Ue(this.get)}set value(t){this.set(t)}onChange(t){let{destroy:e}=Vt(()=>t(this.value),[this.get]);return e}get muted(){return this[Z].muted}set muted(t){this[Z].muted=t}touch(){ji(this)}destroy(){I(this)}}),Di=new Ns("si");function ns(t){var e;Fs()||((e=Vs())==null||e.whenSignalIsRead(t))}function Fe(t,e,s){Fs()||E(ye,t,e,s)}var ee=t=>t!=null&&t[Z]!=null,Li=t=>{let e=s=>{var i;return s?Vt(()=>(t.destroyed||ns(t.id),s(t.value)),[e]):t.destroyed||((i=t.beforeRead)==null||i.call(t),ns(t.id)),t.value};return Object.defineProperty(e,Z,{value:t}),e},Pt,B,Is=(Pt=class{constructor(e,s){c(this,"id");c(this,"lazy");c(this,"compare");c(this,"beforeRead");c(this,"muted",!1);c(this,"destroyed",!1);f(this,B);c(this,"valueFn");c(this,"reader");c(this,"writer",(e,s)=>{var o,n,d,y;let i=(o=s==null?void 0:s.lazy)!=null?o:!1,a=(d=(n=s==null?void 0:s.compare)!=null?n:this.compare)!=null?d:((m,w)=>m===w);if((i!==this.lazy||i&&e!==this.valueFn||!i&&!a(e,r(this,B)))&&(i?(u(this,B,void 0),this.valueFn=e,this.lazy=!0):(u(this,B,e),this.valueFn=void 0,this.lazy=!1),!this.muted&&!this.destroyed)){Fe(this.id,r(this,B));return}(y=s==null?void 0:s.touch)!=null&&y&&Fe(this.id,r(this,B),{touch:!0})});c(this,"object");this.id=Di.make(),++Pt.instanceCount,this.lazy=e,this.lazy?(this.value=void 0,this.valueFn=s):(this.value=s,this.valueFn=void 0),this.reader=Li(this),this.object=new Ti(this)}get[Z](){return this}get value(){return this.lazy&&(u(this,B,this.valueFn()),this.valueFn=void 0,this.lazy=!1),r(this,B)}set value(e){u(this,B,e)}},B=new WeakMap,c(Pt,"instanceCount",0),Pt),A=t=>t==null?void 0:t[Z];function k(t=void 0,e){var i;let s;if(ee(t))s=A(t);else{let a=(i=e==null?void 0:e.lazy)!=null?i:!1;s=new Is(a,t),s.beforeRead=e==null?void 0:e.beforeRead,s.compare=e==null?void 0:e.compare}return(e==null?void 0:e.attach)!=null&&ne.findOrCreate(e.attach).attachSignal(s),s.object}var I=(...t)=>{for(let e of t){let s=A(e);s!=null&&!s.destroyed&&(s.destroyed=!0,s.beforeRead=void 0,--Is.instanceCount,E(Nt,s.id,s.id))}};function Ri(t,e){var n,d;let s=k(),i=(e==null?void 0:e.attach)!=null?ne.findOrCreate(e.attach):void 0;i!=null&&(e!=null&&e.name?i.attachSignalByName(e.name,s):i.attachSignal(s));let a=Vt(()=>{Zt(()=>{s.set(t())})},{autorun:!((n=e==null?void 0:e.lazy)!=null&&n),priority:(d=e==null?void 0:e.priority)!=null?d:ve.C,attach:i}),o=A(s);return o.beforeRead=a.run,M(Nt,o.id,a.destroy),s.get}var P,Lt,Es,Gs=(Es=class{constructor(t){f(this,P,!1);f(this,Lt);c(this,"source");c(this,"lastValue");c(this,"isDestroyed",!1);ot(this),this.source=A(t),u(this,Lt,_(ye,this.source.id,(e,s)=>{!r(this,P)&&!this.isDestroyed&&((s==null?void 0:s.touch)===!0?this.touch():this.write())})),M(Nt,this.source.id,()=>this.destroy())}attach(t){let e=ne.findOrCreate(t);return e.attachLink(this),M(this,Yt,()=>{e.detachLink(this)}),e}nextValue(){return new Promise((t,e)=>{let s=[],i=()=>s.forEach(a=>{a()});s.push(M(this,Bt,a=>{i(),t(a)}),M(this,Yt,()=>{i(),e()}))})}asyncValues(t){return Ye(this,null,function*(){let e=0;for(;!this.isDestroyed;)try{let s=yield new Ee(this.nextValue());if(t&&t(s,e++))break;Ge(this,Bt),yield s}catch(s){break}ge(this,Bt)})}destroy(){var t;this.isDestroyed||((t=r(this,Lt))==null||t.call(this),u(this,Lt,void 0),E(this,Yt,this),ge(this,Bt),V(this),this.lastValue=void 0,this.isDestroyed=!0,Object.freeze(this))}get isMuted(){return r(this,P)}mute(){return!this.isDestroyed&&!r(this,P)&&(u(this,P,!0),E(this,rs,this)),this}unmute(){return!this.isDestroyed&&r(this,P)&&(u(this,P,!1),E(this,as,this)),this}toggleMute(){return this.isDestroyed||(u(this,P,!r(this,P)),E(this,r(this,P)?rs:as,this)),r(this,P)}updateValue(t){if(!r(this,P)&&!this.isDestroyed){let{value:e}=this.source;t(e),E(this,Bt,e),this.lastValue=e}}},P=new WeakMap,Lt=new WeakMap,Es),xi=class extends Gs{constructor(e,s){super(e);c(this,"target");this.target=A(s),M(Nt,this.target.id,()=>this.destroy()),this.touch()}touch(){return this.updateValue(e=>{this.target.writer(e,{touch:!0})}),this}write(){this.updateValue(e=>{this.target.writer(e)})}},zi=class extends Gs{constructor(e,s){super(e);c(this,"target");this.target=s,this.touch()}touch(){return this.updateValue(e=>{this.target(e)}),this}write(){this.updateValue(e=>{this.target(e)})}},de=new Map;function et(t,e,s){var m;let i=A(t),a;if(de.has(i)){a=de.get(i);let w=(m=A(e))!=null?m:e;if(a.has(w))return a.get(w)}else a=new Map,de.set(i,a);let o=A(e),n=o!=null?new xi(t,o):new zi(t,e),d=s==null?void 0:s.attach;d&&n.attach(d);let y=o!=null?o:e;return a.set(y,n),M(n,Yt,()=>{a.delete(y),a.size===0&&de.delete(i)}),n}var D,Rt,Fi=(Rt=class{constructor(){f(this,D,new Map)}static fromProps(e,s){let i=new Rt,a=s?s.map(o=>[o,e[o]]):Object.entries(e);for(let[o,n]of a)r(i,D).set(o,k(n));return i}keys(){return r(this,D).keys()}signals(){return r(this,D).values()}entries(){return r(this,D).entries()}clear(){for(let e of r(this,D).values())e.destroy();r(this,D).clear()}has(e){return r(this,D).has(e)}get(e){if(!r(this,D).has(e)){let s=k();return r(this,D).set(e,s),s}return r(this,D).get(e)}update(e){e.size&&Zt(()=>{for(let[s,i]of e.entries())this.get(s).set(i)})}updateFromProps(e,s){Zt(()=>{let i=s?s.map(a=>[a,e[a]]):Object.entries(e);for(let[a,o]of i)this.get(a).set(o)})}},D=new WeakMap,Rt),Oe=t=>t!=null?t:void 0;function Ni(t,e,s,i,a,o){function n($){if($!==void 0&&typeof $!="function")throw new TypeError("Function expected");return $}for(var d=i.kind,y=d==="getter"?"get":d==="setter"?"set":"value",m=!e&&t?i.static?t:t.prototype:null,w=e||(m?Object.getOwnPropertyDescriptor(m,i.name):{}),h,l=!1,p=s.length-1;p>=0;p--){var g={};for(var b in i)g[b]=b==="access"?{}:i[b];for(var b in i.access)g.access[b]=i.access[b];g.addInitializer=function($){if(l)throw new TypeError("Cannot add initializers after decoration has completed");o.push(n($||null))};var T=(0,s[p])(d==="accessor"?{get:w.get,set:w.set}:w[y],g);if(d==="accessor"){if(T===void 0)continue;if(T===null||typeof T!="object")throw new TypeError("Object expected");(h=n(T.get))&&(w.get=h),(h=n(T.set))&&(w.set=h),(h=n(T.init))&&a.unshift(h)}else(h=n(T))&&(d==="field"?a.unshift(h):w[y]=h)}m&&Object.defineProperty(m,i.name,w),l=!0}function os(t,e,s){for(var i=arguments.length>2,a=0;a<e.length;a++)s=i?e[a].call(t,s):e[a].call(t);return i?s:void 0}function Vi(t){return function(e,s){var o;let i=(t==null?void 0:t.name)||s.name,a=!!((o=t==null?void 0:t.readAsValue)!=null&&o);return{get(){let n=te(this,i);if(n)return a?n.value:n.get()},set(n){var d;(d=te(this,i))==null||d.set(n)},init(n){let d=k(n,t);return Oi(this,i,d),ne.findOrCreate(this).attachSignalByName(i,d),d.value}}}}var jt="value",Ne=(()=>{var i,a,o,n,ce,Jt,m;let t,e=[],s=[];return m=class{constructor(h){f(this,n);f(this,i);f(this,a);f(this,o);u(this,i,[]),u(this,o,os(this,e,void 0)),this.value$=os(this,s),Ge(this,jt),this.value$=te(this,jt),this.value$.onChange(l=>E(this,jt,l)),h&&this.add(...h)}get value(){return r(this,o)}set value(h){u(this,o,h)}add(...h){return r(this,i).push(...h),C(this,n,Jt).call(this),C(this,n,ce).call(this,h)}unshift(...h){return r(this,i).unshift(...h),C(this,n,Jt).call(this),C(this,n,ce).call(this,h)}remove(...h){C(this,n,ce).call(this,h)()}clear(){r(this,i).length=0,C(this,n,Jt).call(this)}dispose(){var h;this.clear(),(h=r(this,a))==null||h.destroy(),u(this,a,void 0),ge(this,jt),V(this),this.value$.destroy(),Mi(this)}},i=new WeakMap,a=new WeakMap,o=new WeakMap,n=new WeakSet,ce=function(h){return()=>{for(let l of h){let p=r(this,i).indexOf(l);p!==-1&&r(this,i).splice(p,1)}C(this,n,Jt).call(this)}},Jt=function(){var h;(h=r(this,a))==null||h.destroy(),r(this,i).length===0?(u(this,a,void 0),this.value=void 0):(u(this,a,Vt(()=>{let l;for(let p of r(this,i)){let g=Ue(p);if(g!=null){l=g;break}}this.value=l},r(this,i))),r(this,a).run())},(()=>{let h=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;t=[Vi({name:jt})],Ni(m,null,t,{kind:"accessor",name:"value",static:!1,private:!1,access:{has:l=>"value"in l,get:l=>l.value,set:(l,p)=>{l.value=p}},metadata:h},e,s),h&&Object.defineProperty(m,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})})(),m.Value=jt,m})(),hs="onCreate",Tt="onDestroy",$i="onParentChanged",Ii="onViewEvent",Me=new Map,je=!1,Gi=(t,e)=>{Me.set(t,e),je||(je=!0,queueMicrotask(()=>{je=!1;let s=Array.from(Me.entries());Me.clear();for(let[i,a]of s)i.set(a)}))},H,xt,ct,W,ft,z,L,rt,F,zt,j,Ve,pt,Kt,fe,Ss,Ui=(Ss=class{constructor(t,e){f(this,j);f(this,H);f(this,xt);f(this,ct,new Fi);f(this,W,new Map);f(this,ft,new Map);f(this,z);f(this,L);f(this,rt,new Set);f(this,F,[]);f(this,zt,0);f(this,pt);u(this,H,t),u(this,xt,e),M(this,Tt,ve.Min,this)}get kernel(){return r(this,H)}get uuid(){return r(this,xt)}get order(){return r(this,zt)}set order(t){r(this,zt)!==t&&(u(this,zt,t),r(this,z)&&this.parent.resortChildren())}get parentUuid(){return r(this,z)||void 0}set parentUuid(t){r(this,z)!==t&&(this.removeFromParent(),u(this,z,t||void 0),u(this,L,t?r(this,H).getEntity(t):void 0),r(this,L)&&r(this,L).addChild(this))}get parent(){return!r(this,L)&&r(this,z)&&u(this,L,r(this,H).getEntity(r(this,z))),r(this,L)}set parent(t){this.parentUuid=t==null?void 0:t.uuid}get hasParent(){return!!r(this,z)}get children(){return r(this,F)}traverse(t){t(this);for(let e of r(this,F))e.traverse(t)}onDestroy(){var t;r(this,ct).clear(),V(this);for(let e of r(this,ft).values())e.cleanup(),e.signal.destroy();r(this,ft).clear();for(let e of r(this,W).values())e.context.set(void 0),e.unsubscribePathValue(),(t=e.unsubscribeFromParent)==null||t.call(e),e.valuePath.dispose(),e.inherited.destroy(),e.provide.destroy(),e.context.destroy();u(this,z,void 0),u(this,L,void 0),r(this,rt).clear(),r(this,F).length=0}addChild(t){var e;if(r(this,F).length===0){r(this,rt).add(t.uuid),r(this,F).push(t);return}if(r(this,rt).has(t.uuid))throw new Error(`child with uuid: ${t.uuid} already exists! parentUuid: ${this.uuid}`);r(this,rt).add(t.uuid),r(this,F).push(t),this.resortChildren();for(let[,s]of r(t,W))C(e=t,j,fe).call(e,s)}resortChildren(){r(this,F).sort((t,e)=>t.order-e.order)}removeChild(t){r(this,rt).has(t.uuid)&&(r(this,rt).delete(t.uuid),r(this,F).splice(r(this,F).indexOf(t),1))}removeFromParent(){if(r(this,L)){r(this,L).removeChild(this),u(this,L,void 0),u(this,z,void 0);for(let[,t]of r(this,W))t.unsubscribeFromParent&&(t.unsubscribeFromParent(),t.unsubscribeFromParent=void 0)}}reSubscribeToParentContexts(){for(let[,t]of r(this,W))C(this,j,fe).call(this,t)}dispatchMessageToView(t,e,s,i=!1){r(this,H).dispatchMessageToView({uuid:r(this,xt),type:t,data:e,transferables:s,traverseChildren:i})}dispatchViewEvents(t){for(let{type:e,data:s}of t)E(this,Ii,e,s)}dispatchViewEvent(t,e){this.dispatchViewEvents([{type:t,data:e}])}getPropertyReader(t){return C(this,j,Ve).call(this,t).get}getPropertyWriter(t){return C(this,j,Ve).call(this,t).set}setProperties(t){this.clearTruthyPropsCache(),Zt(()=>{for(let[e,s]of t)this.setProperty(e,s)})}setProperty(t,e){this.getPropertyWriter(t)(e)}getProperty(t){return Ue(this.getPropertyReader(t))}propKeys(){return Array.from(r(this,ct).keys())}propEntries(){return Array.from(r(this,ct).entries()).map(([t,e])=>[t,e.value])}clearTruthyPropsCache(){u(this,pt,void 0)}truthyProps(){if(r(this,pt))return r(this,pt).size?r(this,pt):void 0;let t=new Set;for(let[e,s]of r(this,ct).entries())if(typeof e=="string"){let i=s.value;i!=null&&i!==!1&&i!==""&&t.add(e)}return u(this,pt,t),t.size?t:void 0}hasContext(t){return r(this,W).has(t)}useContext(t){return C(this,j,Kt).call(this,t).context.get}useParentContext(t){return C(this,j,Kt).call(this,t).inherited.get}provideContext(t){return C(this,j,Kt).call(this,t).provide}provideGlobalContext(t){if(r(this,ft).has(t))return r(this,ft).get(t).signal;let e=r(this,H).findOrCreateRootContext(t),s=k(),i=e.add(s);return r(this,ft).set(t,{cleanup:i,signal:s}),s}},H=new WeakMap,xt=new WeakMap,ct=new WeakMap,W=new WeakMap,ft=new WeakMap,z=new WeakMap,L=new WeakMap,rt=new WeakMap,F=new WeakMap,zt=new WeakMap,j=new WeakSet,Ve=function(t){return r(this,ct).get(t)},pt=new WeakMap,Kt=function(t){if(r(this,W).has(t))return r(this,W).get(t);let e=k(),s=k(),i=k(),a=new Ne([s,e]),o=_(a,Ne.Value,d=>{Gi(i,d)}),n={name:t,inherited:e,provide:s,context:i,valuePath:a,unsubscribePathValue:o};return r(this,W).set(t,n),C(this,j,fe).call(this,n),n},fe=function(t){var e,s;if((e=t.unsubscribeFromParent)==null||e.call(t),t.unsubscribeFromParent=void 0,this.parent){let i=C(s=this.parent,j,Kt).call(s,t.name),a=et(i.context,t.inherited);t.unsubscribeFromParent=a.destroy.bind(a)}else{let i=r(this,H).findOrCreateRootContext(t.name),a=et(i.value$,t.inherited);t.unsubscribeFromParent=a.destroy.bind(a)}},Ss);function Bi(t,e){t.indexOf(e)===-1&&t.push(e)}var ls=t=>{let e=t.split("@").map(s=>s.trim());if(e.length===2&&e[1])return e[0]?{key:`${e[0]}@${e[1]}`,prop:e[1],token:e[0]}:{key:e[1],prop:e[1]}},ue=(t,e)=>{for(let s of e)t.add(s)},Wi=(t,e)=>{if(t!=null)for(let s of t.constructors)e.add(s)},at,R,q,ks,Us=(ks=class{constructor(){f(this,at,new Map);f(this,R,new Map);f(this,q,new Map)}static get(t){return t!=null?t:qi}define(t,e){r(this,at).has(t)?Bi(r(this,at).get(t).constructors,e):r(this,at).set(t,{token:t,constructors:[e]})}appendRoute(t,e){let s=ls(t);s?r(this,q).has(s.key)?ue(r(this,q).get(s.key).routes,e):r(this,q).set(s.key,{routes:new Set(e),token:s.token}):r(this,R).has(t)?ue(r(this,R).get(t),e):r(this,R).set(t,new Set(e))}clearRoute(t){let e=ls(t);e?r(this,q).delete(e.key):r(this,R).delete(t)}findTokensByRoute(t,e){let s=new Set([t]),i=r(this,R).has(t)?[...r(this,R).get(t)]:[];for(;i.length;){let a=i.shift();s.has(a)||(s.add(a),r(this,R).has(a)&&i.push(...Array.from(r(this,R).get(a)).filter(o=>!s.has(o))))}if(e){for(let o of e)r(this,q).has(o)&&ue(s,r(this,q).get(o).routes);let a;do{a=s.size;for(let o of new Set(s))for(let n of e){let d=`${o}@${n}`;r(this,q).has(d)&&ue(s,r(this,q).get(d).routes)}}while(a!==s.size)}return s}findConstructors(t,e){let s=this.findTokensByRoute(t,e),i=new Set;for(let a of s)Wi(r(this,at).get(a),i);return i.size>0?Array.from(i):void 0}hasToken(t){return r(this,at).has(t)}hasRoute(t){return r(this,R).has(t)}clear(){r(this,at).clear(),r(this,R).clear()}},at=new WeakMap,R=new WeakMap,q=new WeakMap,ks),qi=new Us,st;(function(t){t[t.CreateAndDestroy=0]="CreateAndDestroy",t[t.JustCreate=1]="JustCreate",t[t.DestroyOnly=2]="DestroyOnly"})(st||(st={}));var ds=t=>t.displayName||t.name,us=!1,cs=!1,fs=!1,ps=!1,gs=!1,S,Q,Ft,re,X,gt,As,Ji=(As=class{constructor(t){f(this,S);f(this,Q);f(this,Ft);f(this,re);f(this,X);f(this,gt);this.logger=new ei("Kernel"),u(this,S,new Map),u(this,Q,new Set),u(this,X,!0),u(this,gt,new Map),ot(this),this.registry=Us.get(t)}getEntity(t){var s;let e=(s=r(this,S).get(t))==null?void 0:s.entity;if(!e)throw new Error(`entity with uuid "${t}" not found!`);return e}hasEntity(t){return r(this,S).has(t)}traverseLevelOrderBFS(t=!1){if(r(this,X)){let e=new Map,s=(i,a)=>{let o=this.getEntity(i);e.has(a)?e.get(a).push(o):e.set(a,[o]);for(let n of o.children)s(n.uuid,a+1)};r(this,Q).forEach(i=>{s(i,0)}),u(this,Ft,Array.from(e.entries()).sort((i,a)=>i[0]-a[0]).flatMap(([,i])=>i)),u(this,re,r(this,Ft).slice().reverse()),u(this,X,!1)}return t?r(this,re):r(this,Ft)}getEntityGraph(){return Array.from(r(this,Q)).map(t=>this.getEntityGraphNode(t))}getEntityGraphNode(t){if(!r(this,S).has(t))return;let{token:e,entity:s}=r(this,S).get(t);return{token:e,entity:s,props:Object.fromEntries(s.propEntries()),children:s.children.map(i=>this.getEntityGraphNode(i.uuid))}}upgradeEntities(){let t=new Map;for(let e of this.traverseLevelOrderBFS(!0))t.set(e.uuid,this.updateShadowObjects(e.uuid,st.DestroyOnly));for(let e of this.traverseLevelOrderBFS(!1))this.updateShadowObjects(e.uuid,st.JustCreate,t.get(e.uuid));t.clear()}run(t){this.logger.isDebug&&this.logger.debug("sync",t),Zt(()=>{for(let e of t.changeTrail)this.parse(e)})}parse(t){switch(t.type){case tt.CreateEntities:this.createEntity(t.uuid,t.token,t.parentUuid,t.order,t.properties),u(this,X,!0);break;case tt.DestroyEntities:this.destroyEntity(t.uuid),u(this,X,!0);break;case tt.SetParent:this.setParent(t.uuid,t.parentUuid,t.order),u(this,X,!0);break;case tt.UpdateOrder:this.updateOrder(t.uuid,t.order),u(this,X,!0);break;case tt.ChangeProperties:this.changeProperties(t.uuid,t.properties);break;case tt.ChangeToken:this.changeToken(t.uuid,t.token);break;case tt.SendEvents:this.dispatchEventsToEntity(t.uuid,t.events);break}}createEntity(t,e,s,i=0,a){let o=new Ui(this,t);o.order=i;let n={token:e,entity:o,usedConstructors:new Map};r(this,S).set(t,n),s&&(o.parentUuid=s),o.hasParent||r(this,Q).add(t),a&&o.setProperties(a),this.createShadowObjects(t)}destroyEntity(t){if(!r(this,S).has(t))return;let{entity:e,usedConstructors:s}=r(this,S).get(t);e.removeFromParent(),E(e,Tt,this),s.clear(),r(this,S).delete(e.uuid),r(this,Q).delete(e.uuid)}setParent(t,e,s=0){let i=this.getEntity(t);i.parentUuid===e&&i.order===s||(i.removeFromParent(),i.order=s,i.parentUuid=e,i.hasParent?r(this,Q).delete(t):r(this,Q).add(t),i.reSubscribeToParentContexts(),queueMicrotask(()=>{this.logger.isDebug&&this.logger.debug("entity.onParentChanged",{uuid:t,parentUuid:e,order:s,entity:i}),E(i,$i,i)}))}updateOrder(t,e){this.getEntity(t).order=e}dispatchEventsToEntity(t,e){var s;(s=this.getEntity(t))==null||s.dispatchViewEvents(e)}changeProperties(t,e){this.getEntity(t).setProperties(e),this.updateShadowObjects(t)}changeToken(t,e){if(!r(this,S).has(t))return;let s=r(this,S).get(t);s.token!==e&&(s.token=e,this.updateShadowObjects(t))}dispatchMessageToView(t){queueMicrotask(()=>{E(this,De,t)})}updateShadowObjects(t,e=st.CreateAndDestroy,s){let i=r(this,S).get(t);s!=null||(s=new Set(this.registry.findConstructors(i.token,i.entity.truthyProps())));let a=e===st.CreateAndDestroy||e===st.DestroyOnly,o=e===st.CreateAndDestroy||e===st.JustCreate;if(a){for(let[n,d]of i.usedConstructors)if(!s.has(n)){i.usedConstructors.delete(n);for(let y of d)this.destroyShadowObject(y,i.entity)}}if(o)for(let n of s)i.usedConstructors.has(n)||this.constructShadowObject(n,i);return s}constructShadowObject(t,e){let s=new Set,i=new Set,a=new Map,o=new Map,n=new Map,d=new Map,y=new Map,m=(h,l)=>{!gs&&l!=null&&typeof l=="function"&&(console.warn(\'[shadow-objects] Deprecation Warning: The "isEqual" option of "useProperty()" is now passed as {compare} argument. Please update your code accordingly.\'),gs=!0);let p=typeof l=="function"?{compare:l}:l,g=y.get(h);if(g===void 0){g=k(void 0,p).get,y.set(h,g);let b=et(e.entity.getPropertyReader(h),g);i.add(b.destroy.bind(b))}return g},w=ot(new t({entity:e.entity,provideContext(h,l,p){var T;!us&&p!=null&&typeof p=="function"&&(console.warn(\'[shadow-objects] Deprecation Warning: The "isEqual" option of "provideContext()" is now passed as {compare} argument. Please update your code accordingly.\'),us=!0);let g=typeof p=="function"?{compare:p}:p,b=n.get(h);if(b==null){let $=ee(l),be=$?void 0:Oe(l);if(b=k(be,g!=null&&g.compare?{compare:g.compare}:void 0),$){let Gt=et(l,b);i.add(Gt.destroy.bind(Gt))}let It=et(b,e.entity.provideContext(h));i.add(It.destroy.bind(It)),n.set(h,b)}return b!=null&&((T=g==null?void 0:g.clearOnDestroy)==null||T)&&i.add(()=>{b.set(void 0)}),b},provideGlobalContext(h,l,p){var T;!cs&&p!=null&&typeof p=="function"&&(console.warn(\'[shadow-objects] Deprecation Warning: The "isEqual" option of "provideGlobalContext()" is now passed as {compare} argument. Please update your code accordingly.\'),cs=!0);let g=typeof p=="function"?{compare:p}:p,b=d.get(h);if(b==null){let $=ee(l),be=$?void 0:Oe(l);if(b=k(be,g!=null&&g.compare?{compare:g.compare}:void 0),$){let Gt=et(l,b);i.add(Gt.destroy.bind(Gt))}let It=et(b,e.entity.provideGlobalContext(h));i.add(It.destroy.bind(It)),d.set(h,b)}return b!=null&&((T=g==null?void 0:g.clearOnDestroy)==null||T)&&i.add(()=>{b.set(void 0)}),b},useContext(h,l){!fs&&l!=null&&typeof l=="function"&&(console.warn(\'[shadow-objects] Deprecation Warning: The "isEqual" option of "useContext()" is now passed as {compare} argument. Please update your code accordingly.\'),fs=!0);let p=typeof l=="function"?{compare:l}:l,g=a.get(h);if(g===void 0){g=k(void 0,p).get,a.set(h,g);let b=et(e.entity.useContext(h),g);i.add(b.destroy.bind(b))}return g},useParentContext(h,l){!ps&&l!=null&&typeof l=="function"&&(console.warn(\'[shadow-objects] Deprecation Warning: The "isEqual" option of "useParentContext()" is now passed as {compare} argument. Please update your code accordingly.\'),ps=!0);let p=typeof l=="function"?{compare:l}:l,g=o.get(h);if(g===void 0){g=k(void 0,p).get,o.set(h,g);let b=et(e.entity.useParentContext(h),g);i.add(b.destroy.bind(b))}return g},dispatchMessageToView(h,l,p,g=!1){e.entity.dispatchMessageToView(h,l,p,g)},useProperty:m,useProperties(h){let l={};for(let p in h)Object.hasOwn(h,p)&&(l[p]=m(h[p]));return l},createResource(h,l){let p=k(),g=Vt(()=>{let b=Oe(h());return p.set(b),b!==void 0&&l?()=>{l(b),p.set(void 0)}:()=>{p.set(void 0)}});return i.add(()=>{g.destroy(),p.set(void 0),I(p)}),p},createEffect(...h){let l=Vt(...h);return i.add(l.destroy),l},createSignal(...h){let l=k(...h);return i.add(()=>{I(l)}),l},createMemo(...h){let l=Ri(...h);return i.add(()=>{I(l)}),l},on(...h){let l=_(...h);return i.add(l),l},once(...h){let l=M(...h);return i.add(l),l},onDestroy(h){s.add(h)}}));return this.logger.isInfo&&this.logger.info("create shadow-object",ds(t),{shadowObject:w,entity:e.entity}),M(e.entity,Tt,ve.Low,()=>{this.logger.isInfo&&this.logger.info("destroy shadow-object",ds(t),{shadowObject:w,entity:e.entity});for(let l of s)l();for(let l of i)l();for(let l of a.values())I(l);for(let l of o.values())I(l);for(let l of y.values())I(l);for(let l of n.values())I(l);for(let l of d.values())I(l);s.clear(),i.clear(),a.clear(),o.clear(),y.clear(),n.clear(),d.clear();let h=e.usedConstructors.get(t);h&&(h.delete(w),h.size===0&&e.usedConstructors.delete(t))}),e.usedConstructors.has(t)?e.usedConstructors.get(t).add(w):e.usedConstructors.set(t,new Set([w])),this.attachShadowObject(w,e.entity),w}createShadowObjects(t){var s;let e=r(this,S).get(t);(s=this.registry.findConstructors(e.token,e.entity.truthyProps()))==null||s.forEach(i=>{this.constructShadowObject(i,e)})}findShadowObjects(t){if(!r(this,S).has(t))return[];let{usedConstructors:e}=r(this,S).get(t);return Array.from(new Set(Array.from(e.values()).flatMap(s=>Array.from(s))))}attachShadowObject(t,e){_(e,t),typeof t[hs]=="function"&&t[hs](e)}destroyShadowObject(t,e){typeof t[Tt]=="function"&&t[Tt](e),E(t,Tt,e),V(e,t)}findOrCreateRootContext(t){let e=r(this,gt).get(t);return e||(e=new Ne,r(this,gt).set(t,e)),e}destroy(){for(let t of r(this,gt).values())t.dispose();r(this,gt).clear();for(let t of this.traverseLevelOrderBFS().reverse())this.destroyEntity(t.uuid)}},S=new WeakMap,Q=new WeakMap,Ft=new WeakMap,re=new WeakMap,X=new WeakMap,gt=new WeakMap,As);async function Bs(t,e,s,i=!0){var o,n;if(s.has(e)){console.warn("importModule: skipping already imported module",e);return}else s.add(e);e.extends&&await Promise.all(e.extends.map(d=>Bs(t,d,s,!1)));let{registry:a}=t;if(e.define)for(let[d,y]of Object.entries(e.define))a.define(d,y);if(e.routes)for(let[d,y]of Object.entries(e.routes))a.appendRoute(d,y);await((n=(o=e.initialize)==null?void 0:o.call(e,{define:(d,y)=>a.define(d,y),kernel:t,registry:a}))!=null?n:Promise.resolve()),i&&t.upgradeEntities()}var Ki=t=>(typeof t=="string"&&(t=new URL(t,globalThis.location.href)),t.toString()),ae,yt,Ws,qs,Js,Ps,Yi=(Ps=class{constructor(t){f(this,yt);f(this,ae,new Set);var e,s;this.kernel=(e=t==null?void 0:t.kernel)!=null?e:new Ji,this.postMessage=(s=t==null?void 0:t.postMessage)!=null?s:self.postMessage.bind(self),_(this.kernel,De,"onMessageToView",this)}route(t){var e;switch(t.data.type){case Hs:C(this,yt,Ws).call(this,t.data);break;case Qs:C(this,yt,qs).call(this,t.data);break;case Xs:C(this,yt,Js).call(this,t.data);break;default:console.warn("[MessageRouter] unknown message",(e=t.data.type)!=null?e:t.data)}}onMessageToView(t){let i=t,{transferables:e}=i,s=Je(i,["transferables"]);this.postMessage({type:De,data:s},{transfer:e})}},ae=new WeakMap,yt=new WeakSet,Ws=async function(t){try{let e=await import(Ki(t.importModule));e[ke]?(await Bs(this.kernel,e[ke],r(this,ae)),this.postMessage({type:Se,url:t.importModule})):this.postMessage({type:Se,url:t.importModule,error:`module has no "${ke}" export`})}catch(e){console.error("[MessageRouter] failed to import module",e),this.postMessage({type:Se,url:t.importModule,error:`${e}`})}},qs=function(t){try{this.kernel.run(t)}catch(e){console.error("[MessageRouter] failed to apply change trail",e),this.postMessage({type:Qe,serial:t.serial,error:e.toString()})}t.serial&&this.postMessage({type:Qe,serial:t.serial})},Js=function(t){console.debug("[MessageRouter] on destroy",t),V(this.kernel,this),r(this,ae).clear(),this.postMessage({type:_s})},Ps),Hi=class{constructor(){this.onmessage=t=>{var e;t.data.type===N?globalThis[x]=t.data.config:((e=this.router)!=null||(this.router=new Yi),this.router.route(t))}}start(){self.addEventListener("message",this.onmessage),self.postMessage({type:Zs})}};console.debug("@spearwolf/shadow-objects/WorkerRuntime: hello!");var Qi=new Hi;Qi.start();\n/*! Bundled license information:\n\n@spearwolf/eventize/lib/index.mjs:\n (*!\n =============================================================================\n @spearwolf/eventize 4.0.2+build.20250807\n \u2014 https://github.com/spearwolf/eventize.git\n =============================================================================\n \n Copyright 2015-2025 Wolfger Schramm\n \n Licensed under the Apache License, Version 2.0 (the "License");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an "AS IS" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n *)\n*/\n')}var Hs=()=>new Kt;var $e=(s,e,t=1e3,r)=>new Promise((i,n)=>{let o,l,a=()=>{clearTimeout(o),s.removeEventListener("message",l)};t!==0&&t!==1/0&&(o=setTimeout(()=>{a(),n(new Error(`Timeout waiting for message of type: ${e}`))},t)),l=c=>{if(c.data.type===e)try{(!r||r(c.data))&&(a(),i())}catch(C){a(),n(C.toString())}},s.addEventListener("message",l)});var Sr=s=>{let e;if(s!=null&&Array.isArray(s))for(let t of s)t.transferables&&(e?e=[...e,...t.transferables]:e=t.transferables,delete t.transferables);return e},Ct=class s{static{this.WorkerLoaded="workerLoaded"}#e;#t;#s;get isDestroyed(){return this.#t}get workerLoaded(){return fe(this,s.WorkerLoaded)}constructor(){this.#t=!1,this.#s=0,this.logger=new P("RemoteWorkerEnv"),G(this,s.WorkerLoaded)}async start(){if(this.#e)return this.logger.isWarn&&this.logger.warn("already started"),this.workerLoaded.then(()=>{if(this.isDestroyed)throw"worker was destroyed"});let e=this.#e=Hs();this.configureConsoleLogger(e);try{if(await $e(e,vs,Ss),this.isDestroyed)throw"worker was destroyed";e.addEventListener("message",this.onMessageFromWorker.bind(this)),queueMicrotask(()=>{f(this,s.WorkerLoaded,this)})}catch(t){throw this.logger.error("failed to start",t),this.#e=void 0,t}}applyChangeTrail(e,t){let r=Sr(e),i={type:ms,changeTrail:e},n=++this.#s;return t&&(i.serial=n),this.#e.postMessage(i,r),t?$e(this.#e,ws,ks,o=>{if(o.error)throw o.error;return o.serial===n}):Promise.resolve()}importScript(e){return e=vt(e),this.#e.postMessage({type:ys,importModule:e}),$e(this.#e,Cs,xs,t=>{if(t.error)throw t.error;return t.url===e})}destroy(){if(!this.#e)return;let e=this.#e;this.#e=void 0,this.#t=!0,e.postMessage({type:bs}),$e(e,Es,As).finally(()=>{e.terminate()})}onMessageFromWorker(e){e.data?.type===me?this.onMessageToView?.(e.data.data):this.logger.isDebug&&this.logger.debug("message from worker",e)}configureConsoleLogger(e){let t=`${_}.RemoteWorkerEnv.workerConfig`,r=JSON.parse(localStorage.getItem(t)??"{}");this.logger.isInfo&&this.logger.info("load console-logger worker config",{localStorageKey:t,workerConfig:r}),e.postMessage({type:_,config:{...P.sharedConfig,enable:this.logger.isEnabled,...r,...P.isEnabled?{}:{enable:!1}}})}};var We,Ie=class extends se{static{this.observedAttributes=[...se.observedAttributes,ot,"src",at]}static{this.DefaultAutoSync="frame"}#e;#t;#s;#i;#r;constructor(){super(),this.isShaeWorkerElement=!0,this.shadowEnv=new F,this.logger=new P("ShaeWorkerElement"),this.autostart=!0,this.isConnected$=d(!1),this.autoSync$=d(We.DefaultAutoSync),this.src$=d(""),this.#e=!1,this.#t=!1,this.ns$.onChange(e=>{this.shadowEnv.view=$.get(e)}),m(this.shadowEnv,F.ContextCreated,()=>{this.#r?.run(),this.dispatchEvent(new CustomEvent(F.ContextCreated.toLowerCase(),{bubbles:!1,detail:{shadowEnv:this.shadowEnv}}))}),m(this.shadowEnv,F.ContextLost,()=>{this.dispatchEvent(new CustomEvent(F.ContextLost.toLowerCase(),{bubbles:!1,detail:{shadowEnv:this.shadowEnv}}))}),this.autoSync$.onChange(e=>{let t=this.hasAttribute(z),r=t?this.getAttribute(z):void 0;e===We.DefaultAutoSync?t&&r!==e&&this.setAttribute(z,e):r!==e&&this.setAttribute(z,e)}),this.#a(),this.#n(),this.style.display="contents"}#n(){this.#r=w(()=>{let e=this.src$.get();e&&this.importScript(e)},{autorun:!1})}get shouldAutostart(){return this.autostart&&!De(this,Ds)}get autoSync(){return this.autoSync$.value}set autoSync(e){typeof e!="string"&&(e=e?We.DefaultAutoSync:"no"),this.autoSync$.set(`${e}`.trim().toLowerCase())}get frameLoop(){return this.#s??=new be,this.#s}[be.OnFrame](){this.syncShadowObjects()}async importScript(e){if(!e)throw new Error("src is blank");let t=await this.shadowEnv.ready();return this.logger.isInfo&&this.logger.info("shadowEnv importScript:",e,{shadowEnv:t}),await t.envProxy.importScript(e),this}connectedCallback(){O(()=>{this.hasAttribute(z)&&this.autoSync$.set(this.getAttribute(z)),this.isConnected$.set(!0)}),this.shouldAutostart&&this.start()}disconnectedCallback(){this.isConnected$.set(!1),this.#o()}attributeChangedCallback(e){if(super.attributeChangedCallback(e),e===ot&&this.shadowEnv.envProxy!=null)throw new Error('Changing the "local" attribute after the shadowEnv has been created is not supported.');if(e===at&&this.#h(),e===z&&(this.autoSync=this.hasAttribute(z)?this.getAttribute(z):!0),e==="src"){let t=(this.getAttribute("src")||"").trim();this.src$.set(t),this.shadowEnv.isReady&&this.#r?.run()}}start(){if(!this.#t){if(this.#e=!1,this.shadowEnv.view??=$.get(this.ns),this.shadowEnv.envProxy==null){let e=De(this,ot)?new wt:new Ct;this.shadowEnv.envProxy=e,this.#h()}this.#t=!0}return this.shadowEnv.ready()}destroy(){this.#i?.destroy(),this.#r?.destroy(),A(this.isConnected$,this.autoSync$,this.src$),this.shadowEnv.envProxy=void 0,this.shadowEnv.destroy()}#o(){this.#e||(this.#e=!0,queueMicrotask(()=>{this.#e&&this.destroy()}))}#a(){this.#i=w(()=>{if(this.isConnected$.get()){let e=(this.autoSync$.get()||We.DefaultAutoSync).trim().toLowerCase(),t;if(["true","yes","on","frame","auto-sync"].includes(e))return this.logger.isDebug&&this.logger.debug("auto-sync",e,this),this.frameLoop.start(this),()=>{this.frameLoop.stop(this)};if(e.toLowerCase().endsWith("fps")){let r=parseInt(e,10);r>0?t=Math.floor(1e3/r):this.logger.isWarn&&this.logger.warn(`invalid auto-sync value: ${e}`)}else t=parseInt(e,10),isNaN(t)&&(t=void 0,["false","no","off"].includes(e)||this.logger.error(`invalid auto-sync value: ${e}`));if(t!==void 0&&t>0){this.logger.isDebug&&this.logger.debug("auto-sync interval (ms)",t,this);let r=setInterval(()=>{this.syncShadowObjects()},t);return()=>{clearInterval(r)}}else this.logger.isDebug&&this.logger.debug("auto-sync off",this)}},[this.autoSync$,this.isConnected$])}#h(){let e=this.shadowEnv.envProxy;e?.isLocalEnv&&(e.disableStructuredClone=this.hasAttribute(at))}};We=Ie;customElements.define(Ls,Ie);globalThis.SHADOW_ENTS_BUNDLE_LOADED=!0;
22
22
  /*! Bundled license information:
23
23
 
24
24
  @spearwolf/eventize/lib/index.mjs:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spearwolf/shadow-objects",
3
3
  "description": "a reactive entity-component framework that feels at home in the shadows",
4
- "version": "0.26.3",
4
+ "version": "0.27.0",
5
5
  "author": {
6
6
  "name": "Wolfger Schramm",
7
7
  "email": "wolfger@spearwolf.de",
@@ -1 +1 @@
1
- {"version":3,"file":"Kernel.d.ts","sourceRoot":"","sources":["../../../src/in-the-dark/Kernel.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAEV,eAAe,EAGf,gBAAgB,EAChB,SAAS,EAGV,MAAM,aAAa,CAAC;AACrB,OAAO,EAAC,aAAa,EAAC,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AACvC,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAE7C,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAQD,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,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gBAAgB,EAAE;IAQnD,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,mBAAmB;IAU3B,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW;IAS3D,OAAO,IAAI,IAAI;CAUhB"}
@@ -354,6 +354,9 @@ export class Kernel {
354
354
  }
355
355
  return ctxReader;
356
356
  },
357
+ dispatchMessageToView(type, data, transferables, traverseChildren = false) {
358
+ entry.entity.dispatchMessageToView(type, data, transferables, traverseChildren);
359
+ },
357
360
  useProperty: getUseProperty,
358
361
  useProperties(props) {
359
362
  const result = {};
@@ -1 +1 @@
1
- {"version":3,"file":"Kernel.js","sourceRoot":"","sources":["../../../src/in-the-dark/Kernel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EACL,KAAK,EAEL,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,IAAI,GAGL,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAC,mBAAmB,EAAE,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAWnE,OAAO,EAAC,aAAa,EAAC,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAC,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAgB,QAAQ,EAAkB,SAAS,EAAE,eAAe,EAAC,MAAM,aAAa,CAAC;AAChG,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AACvC,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAuB7C,IAAK,kBAIJ;AAJD,WAAK,kBAAkB;IACrB,mFAAoB,CAAA;IACpB,uEAAU,CAAA;IACV,yEAAW,CAAA;AACb,CAAC,EAJI,kBAAkB,KAAlB,kBAAkB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 @@ export interface AppliedChangeTrailEvent {
61
61
  serial?: number;
62
62
  error?: string;
63
63
  }
64
- export type EntityApi = Pick<Entity, 'hasParent' | 'children' | 'dispatchMessageToView' | 'setProperties' | 'setProperty' | 'propKeys' | 'propEntries'> & Readonly<Pick<Entity, 'uuid' | 'order' | 'parentUuid' | 'parent'>> & {
65
- traverse(callback: (entity: EntityApi) => any): void;
66
- };
64
+ export type EntityApi = Readonly<Pick<Entity, 'uuid' | 'order' | 'hasParent' | 'propKeys' | 'propEntries'> & {
65
+ parent?: EntityApi;
66
+ children: readonly EntityApi[];
67
+ traverse(callback: (entity: EntityApi) => unknown): void;
68
+ }>;
67
69
  export interface SignalValueOptions<T> {
68
70
  compare?: CompareFunc<T | undefined>;
69
71
  }
@@ -73,8 +75,9 @@ export interface ProvideContextOptions<T> extends SignalValueOptions<T> {
73
75
  export type Maybe<T = unknown> = NonNullable<T> | undefined;
74
76
  export interface ShadowObjectCreationAPI {
75
77
  entity: EntityApi;
76
- provideContext<T = unknown>(name: string | symbol, sourceOrInitialValue?: T | SignalReader<T | undefined>, options?: ProvideContextOptions<T> | CompareFunc<T | undefined>): Signal<T>;
77
- provideGlobalContext<T = unknown>(name: string | symbol, sourceOrInitialValue?: T | SignalReader<T | undefined>, options?: ProvideContextOptions<T> | CompareFunc<T | undefined>): Signal<T>;
78
+ dispatchMessageToView(type: string, data?: unknown, transferables?: TransferablesType, traverseChildren?: boolean): void;
79
+ provideContext<T = unknown>(name: string | symbol, sourceOrInitialValue?: T | SignalReader<T | undefined>, options?: ProvideContextOptions<T> | CompareFunc<T | undefined>): Signal<Maybe<T>>;
80
+ provideGlobalContext<T = unknown>(name: string | symbol, sourceOrInitialValue?: T | SignalReader<T | undefined>, options?: ProvideContextOptions<T> | CompareFunc<T | undefined>): Signal<Maybe<T>>;
78
81
  useContext<T = unknown>(name: string | symbol, options?: SignalValueOptions<T> | CompareFunc<T | undefined>): SignalReader<Maybe<T>>;
79
82
  useParentContext<T = unknown>(name: string | symbol, options?: SignalValueOptions<T> | CompareFunc<T | undefined>): SignalReader<Maybe<T>>;
80
83
  useProperty<T = unknown>(name: string, options?: SignalValueOptions<T> | CompareFunc<T | undefined>): SignalReader<Maybe<T>>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,eAAe,EAAE,EAAE,EAAE,IAAI,EAAC,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAC,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAC,MAAM,sBAAsB,CAAC;AACpH,OAAO,KAAK,EAAC,kBAAkB,EAAE,mBAAmB,EAAE,cAAc,EAAC,MAAM,gBAAgB,CAAC;AAC5F,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAE1D,MAAM,MAAM,eAAe,GAAG,oBAAoB,EAAE,CAAC;AAErD,MAAM,MAAM,iBAAiB,GAAG,YAAY,EAAE,CAAC;AAE/C,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,mBAAmB,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,iBAAiB,CAAC;CACnC;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,MAAM,uBAAuB,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;AAE1D,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC7D,IAAI,EAAE,mBAAmB,CAAC,cAAc,CAAC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAA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