@spearwolf/shadow-objects 0.25.0 → 0.26.1

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,17 @@ 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
+ ## [0.26.1] - 2026-01-08
9
+
10
+ - automatic clearing of the context value is now performed by default _after_ the user-defined `onDestroy()` hooks
11
+
12
+ ## [0.26.0] - 2026-01-08
13
+
14
+ - `provideContext()` and `provideGlobalContext()` expect as third argument now an option object `{compare?, clearOnDestroy?}`
15
+ - the old way (third argument as `isEqual` callback) will continue to work but is now deprecated!
16
+ - both `provide*Context()` features will now clear the context value to _undefined_ on shadow-object destruction by default
17
+ - opt out via `{clearOnDestroy: false}`
18
+
8
19
  ## [0.25.0] - 2025-12-31
9
20
 
10
21
  - use `display: contents` style for all shadow object host elements to avoid layout issues
@@ -20,4 +31,3 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
20
31
  - added the `useProperties()` function
21
32
  - added the `useResource()` function
22
33
  - added lots of new tests and improved code coverage
23
-
package/bundle.js CHANGED
@@ -1,9 +1,9 @@
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.25.0+bundle.20251231
4
+ @version 0.26.1+bundle.20260108
5
5
 
6
- Copyright 2025 Wolfger Schramm
6
+ Copyright 2026 Wolfger Schramm
7
7
 
8
8
  Licensed under the Apache License, Version 2.0 (the "License");
9
9
  you may not use this file except in compliance with the License.
@@ -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 it="*",Xe=1,xe=2,ke=4,z=Symbol.for("eventize"),zs="[eventize]",zt=s=>s===it,ts=s=>{switch(typeof s){case"string":case"symbol":return!0;default:return!1}},es=typeof console<"u",Vs=es?console[console.warn?"warn":"log"].bind(console,zs):()=>{},Us=(s,t,e)=>(Object.defineProperty(s,t,{value:e,configurable:!0}),s),Bs=0,ss=class{static publish(s){s.sort((t,e)=>t.order-e.order).forEach(t=>t.emit())}events=new Map;eventNames=new Set;add(s){Array.isArray(s)?s.forEach(t=>this.eventNames.add(t)):this.eventNames.add(s)}remove(s){Array.isArray(s)?s.forEach(t=>this.eventNames.delete(t)):this.eventNames.delete(s),this.clear(s)}clear(s){Array.isArray(s)?s.forEach(t=>this.events.delete(t)):this.events.delete(s)}retain(s,t){this.eventNames.has(s)&&this.events.set(s,{args:t,order:Bs++})}isKnown(s){return this.eventNames.has(s)}emit(s,t,e=[]){if(zt(s))this.eventNames.forEach(r=>this.emit(r,t,e));else if(this.events.has(s)){let{order:r,args:i}=this.events.get(s);e.push({order:r,emit:()=>t.apply(s,i)})}return e}},Ee=(s,t,e,r)=>{if(typeof t=="function"){let i=t.apply(s,e);i!=null&&r?.(i)}},Gs=(s,t,e,r)=>Ee(t,t.emit,[s].concat(e),r),qs=s=>{switch(typeof s){case"function":return Xe;case"string":case"symbol":return xe;case"object":return ke}},Hs=0,Qs=()=>++Hs,rs=class{id;eventName;isCatchEmAll;priority;listener;listenerObject;listenerType;callAfterApply;isRemoved;refCount;constructor(s,t,e,r=null){this.id=Qs(),this.eventName=s,this.isCatchEmAll=zt(s),this.listener=e,this.listenerObject=r,this.priority=t,this.listenerType=qs(e),this.callAfterApply=void 0,this.isRemoved=!1,this.refCount=1}isEqual(s,t=null){if(s===this)return!0;let e=typeof s;return e==="number"&&s===this.id?!0:t===null&&(e==="string"||e==="symbol")?s===it||s===this.eventName:this.listener===s&&this.listenerObject===t}apply(s,t,e){if(this.isRemoved)return;let{listener:r,listenerObject:i}=this;switch(this.listenerType){case Xe:Ee(i,r,t,e),this.callAfterApply&&this.callAfterApply();break;case xe:Ee(i,i[r],t,e),this.callAfterApply&&this.callAfterApply();break;case ke:{let n=r[s];if(this.isCatchEmAll||this.eventName===s){if(typeof n=="function"){let o=n.apply(r,t);o!=null&&e?.(o)}else Gs(s,r,t,e);this.callAfterApply&&this.callAfterApply()}break}}}},Ys=(s,t)=>s.priority!==t.priority?t.priority-s.priority:s.id-t.id,Ke=s=>s?.slice(0),Je=(s,t)=>{let e=s.indexOf(t);e>-1&&s.splice(e,1)},Ks=s=>s===ke||s===xe,Se=(s,t,e)=>{let r=s.findIndex(i=>i.isEqual(t,e));r>-1&&(s[r].isRemoved=!0,s.splice(r,1))},Wt=(s,t,e)=>{let r=[];for(let i of s)(t==null&&i.listenerObject===e||i.eventName===t&&i.listener===e)&&r.push(i);for(let i of r)Se(s,i,void 0)},Ce=s=>{s&&(s.forEach(t=>{t.isRemoved=!0}),s.length=0)},Js=(s,t)=>s.listenerType===t.listenerType?s.priority===t.priority&&s.eventName===t.eventName&&s.listenerObject===t.listenerObject&&s.listener===t.listener:!1,Zs=(s,t)=>{if(Ks(s.listenerType))return t.find(e=>Js(s,e))},Xs=(s,t)=>{let e=Zs(s,t);return e?(e.refCount+=1,e):(t.push(s),t.sort(Ys),s)},tr=class{namedListeners;catchEmAllListeners;getListenersForEventName=s=>{let t=this.namedListeners.get(s);return t||(t=[],this.namedListeners.set(s,t)),t};constructor(){this.namedListeners=new Map,this.catchEmAllListeners=[]}add(s){return Xs(s,s.isCatchEmAll?this.catchEmAllListeners:this.getListenersForEventName(s.eventName))}remove(s,t,e=!1){t==null&&Array.isArray(s)?s.forEach(r=>this.remove(r,null,e)):s==null||t==null&&zt(s)?this.removeAllListeners():t==null&&ts(s)?Ce(this.namedListeners.get(s)):s instanceof rs?s.isRemoved||(s.refCount-=1,s.refCount<1&&(s.isRemoved=!0,this.namedListeners.forEach(r=>Je(r,s)),Je(this.catchEmAllListeners,s))):e?zt(s)&&typeof s=="object"?Wt(this.catchEmAllListeners,it,s):this.namedListeners.forEach(r=>Wt(r,s,t)):(this.namedListeners.forEach(r=>{Se(r,s,t),typeof s=="object"&&Wt(r,void 0,s)}),Se(this.catchEmAllListeners,s,t),typeof s=="object"&&Wt(this.catchEmAllListeners,void 0,s))}removeAllListeners(){this.namedListeners.forEach(s=>Ce(s)),this.namedListeners.clear(),Ce(this.catchEmAllListeners)}forEach(s,t){let e=Ke(this.catchEmAllListeners),r=Ke(this.namedListeners.get(s));if(s===it||!r||r.length===0)e.forEach(t);else if(e.length===0)r.forEach(t);else{let i=r.length,n=e.length,o=0,h=0;for(;o<i||h<n;){if(o<i){let a=r[o];if(h>=n||a.priority>=e[h].priority){t(a),++o;continue}}h<n&&(t(e[h]),++h)}}}getSubscriptionCount(){let s=this.catchEmAllListeners.length;for(let t of this.namedListeners.values())s+=t.length;return s}},nt=s=>!!(s&&s[z]);function Et(s){if(nt(s))return s;let t=new tr,e=new ss;return Us(s,z,{keeper:e,store:t}),s}var V={Max:Number.POSITIVE_INFINITY,AAA:1e9,BB:1e6,C:1e3,Default:0,Low:-1e4,Min:Number.NEGATIVE_INFINITY},er=(s,t,e,r,i,n,o)=>{let h=s.add(new rs(e,r,i,n));return t.emit(e,h,o),h},sr=(s,t,e,r)=>{let i=e.length,n=typeof e[0],o,h,a,c;if(i>=2&&i<=3&&n==="number"?(o=it,[h,a,c]=e):i>=3&&i<=4&&typeof e[1]=="number"?[o,h,a,c]=e:(h=V.Default,n==="string"||n==="symbol"||Array.isArray(e[0])?[o,a,c]=e:(o=it,[a,c]=e)),!a&&es)throw Vs("called with insufficient arguments!",e),"subscribeTo() called with insufficient arguments!";let w=b=>u=>er(s,t,u,b,a,c,r);return Array.isArray(o)?o.map(b=>Array.isArray(b)?w(b[1])(b[0]):w(h)(b)):w(h)(o)},is=(s,t,e)=>{let r=[],i=sr(s,t,e,r);return ss.publish(r),i},Ze=s=>t=>{t.callAfterApply=()=>{s?.()}},ns=(s,t)=>Object.assign(()=>S(s,t),Array.isArray(t)?{listeners:t}:{listener:t}),os=(s,t,e,r)=>{let{store:i,keeper:n}=s[z];Array.isArray(t)?t.forEach(o=>{i.forEach(o,h=>h.apply(o,e,r)),n.retain(o,e)}):t!==it&&(i.forEach(t,o=>{o.apply(t,e,r)}),n.retain(t,e))},y=(s,...t)=>{let e=Et(s),{store:r,keeper:i}=e[z];return ns(e,is(r,i,t))},E=(s,...t)=>{let e=Et(s),{store:r,keeper:i}=e[z],n=is(r,i,t),o=ns(e,n),h=!1,a=()=>{h||(o(),h=!0)};return Array.isArray(n)?n.forEach(Ze(a)):Ze(a)(n),a},ft=(s,t)=>new Promise(e=>{E(s,t,e)}),S=(s,t,e)=>{if(!nt(s))throw new Error("object is not eventized");let{store:r,keeper:i}=s[z],n=typeof t,o=e!=null&&(n==="string"||n==="symbol");r.remove(t,e,o),Array.isArray(t)?i.remove(t.filter(h=>typeof h=="string")):ts(t)&&i.remove(t)},f=(s,t,...e)=>{if(!nt(s))throw new Error("object is not eventized");os(s,t,e)},rr=(s,t,...e)=>{if(!nt(s))throw new Error("object is not eventized");let r=[];return os(s,t,e,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()},U=(s,t)=>{let e=Et(s),{keeper:r}=e[z];r.add(t)},Y=(s,t)=>{if(!nt(s))throw new Error("object is not eventized");let{keeper:e}=s[z];e.clear(t)},x=(()=>{let s=(t={})=>Et(t);return s.inject=(t={})=>(t=Et(t),Object.assign(t,{on:(...e)=>y(t,...e),once:(...e)=>E(t,...e),onceAsync:e=>ft(t,e),off:(e,r)=>S(t,e,r),emit:(e,...r)=>f(t,e,...r),emitAsync:(e,...r)=>rr(t,e,...r),retain:e=>U(t,e),retainClear:e=>Y(t,e)}),t),s.is=nt,s})();var Ae=s=>nt(s)?s[z]?.store?.getSubscriptionCount()??0:0;var L=Symbol.for("signal"),ot=Symbol.for("effect"),Te=Symbol.for("destroySignal"),Oe=Symbol.for("createEffect"),as=Symbol.for("destroyEffect"),pt="value",Pe="mute",Re="unmute",K="destroy",at=Symbol.for("recall");var ht=x(),$=x(),B=x(),Vt=x();var lt=class{static current;delayedEffects=[];batch(t,e){let r=this.delayedEffects.length;for(let i=0;i<r;i++){let[n,o]=this.delayedEffects[i];if(!(n>e))if(n===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=[y(B,(i,n)=>{n===at&&t.add(i)}),y(Vt,i=>{t.add(i)})],r=this.delayedEffects.flatMap(([,i])=>Array.from(i));for(let i of r)t.has(i)||f(B,i,i,at);e.forEach(i=>{i()})}},hs=()=>lt.current;function O(s){let t=lt.current;t?t=void 0:t=lt.current=new lt;try{s()}finally{t&&(lt.current=void 0,t.run())}}var Me=0;function Le(s){Me++;try{s()}finally{Me--}}function Ut(){return Me>0}var Bt=class{[ot];constructor(t){this[ot]=t,E(t,gt.Destroy,()=>{this[ot]=void 0})}run=()=>this[ot]?.run();destroy=()=>{this[ot]?.destroy(),this[ot]=void 0}};var J=new Map,j=class s{#t=new Set;#e=new Set;#s=new Map;#i=new WeakMap;#r=new Map;#n=new Set;#o=new Set;#a;#h;static get(t){if(t!=null)return t instanceof s?t:J.get(t)}static findOrCreate(t){if(t==null)throw new Error("Cannot create a group with a null object");return new s(t)}static destroy(t){console.warn("SignalGroup.destroy(obj) is deprecated. Use SignalGroup.delete(obj) instead."),s.delete(t)}static delete(t){J.get(t)?.clear()}static clear(){for(let t of J.values())t.destroy();J.clear()}constructor(t){if(t!=null&&t instanceof s)return t;if(t??=this,J.has(t))return J.get(t);this.#h=t,J.set(t,this),x(this)}attachGroup(t){if(t===this)throw new Error("Cannot attach a group to itself");return this.#t.add(t),t.#a&&t.#a!==this&&t.#a.#t.delete(t),t.#a=this,t}detachGroup(t){return t!==this&&this.#t.has(t)&&(this.#t.delete(t),t.#a=void 0),t}attachSignal(t){let e=C(t);if(e?.destroyed)throw new Error("Cannot attach a destroyed signal to a group");return e&&this.#e.add(e),t}attachSignalByName(t,e){if(e){this.attachSignal(e);let r=C(e);this.#s.set(t,r),this.#r.has(t)?this.#r.get(t).push(r):this.#r.set(t,[r]),this.#i.has(r)?this.#i.get(r).add(t):this.#i.set(r,new Set([t]))}else this.#s.delete(t);return e}hasSignal(t){return this.#s.has(t)||!!this.#a?.hasSignal(t)}signal(t){return this.#s.get(t)?.object??this.#a?.signal(t)}detachSignal(t){let e=C(t);if(e&&(this.#e.delete(e),this.#i.has(e))){let r=this.#i.get(e);for(let i of r)if(this.#r.has(i)){let n=this.#r.get(i);n.splice(n.indexOf(e),1),n.length===0?(this.#s.delete(i),this.#r.delete(i)):this.#s.get(i)===e&&this.#s.set(i,n.at(-1))}r.clear(),this.#i.delete(e)}return t}attachEffect(t){return this.#n.add(t),t}runEffects(){for(let t of this.#n)t.run();for(let t of this.#t)t.runEffects()}attachLink(t){if(t?.isDestroyed)throw new Error("Cannot attach a destroyed link to a group");return t&&this.#o.add(t),t}detachLink(t){return t&&this.#o.delete(t),t}destroy(){console.warn("SignalGroup#destroy is deprecated. Use SignalGroup#clear instead."),this.clear()}clear(){f(this,K,this),S(this);for(let t of this.#t)t.destroy();for(let t of this.#n)t.destroy();for(let t of this.#e)k(t);for(let t of this.#o)t.destroy();this.#t.clear(),this.#e.clear(),this.#s.clear(),this.#r.clear(),this.#n.clear(),this.#o.clear(),this.#a?.detachGroup(this),this.#h&&(J.delete(this.#h),this.#h=void 0)}};var yt=class{#t;#e;constructor(t="id",e=1){this.#t=t,this.#e=e}make(){return Symbol(`${this.#t}${this.#e++}`)}};var je=[],Gt=()=>je.at(-1),ls=(s,t)=>{je.push(s);try{return t()}finally{je.pop()}};var ir=s=>s!=null&&typeof s.then=="function",gt=class s{static idGen=new yt("ef");static Destroy="destroy";static count=0;id;callback;#t;#e=new Set;#s=new Set;#i=new Map;#r=new Set;parentEffect;childEffects=[];curChildEffectSlot=0;autorun=!0;shouldRun=!0;priority;#n;#o=!1;constructor(t,e){x(this),this.callback=t;let r;e?.attach!=null&&(r=j.findOrCreate(e.attach),r.attachEffect(this)),this.autorun=e?.autorun??!0,this.#n=e?.dependencies?e.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=e?.priority??0,y(B,this.id,at,this),++s.count}hasStaticDeps(){return this.#n!=null&&this.#n.length>0}saveSignalsFromDeps(){for(let t of this.#n)this.whenSignalIsRead(C(t).id)}static createEffect(t,e,r){let i=Array.isArray(e)?e:void 0,n=i?r??{dependencies:i}:e;n&&i&&(n.dependencies=i);let o,h=Gt();return h!=null?(o=h.getCurrentChildEffect(),o==null&&(o=new s(t,n),h.attachChildEffect(o),f(B,Oe,o)),h.curChildEffectSlot++):(o=new s(t,n),f(B,Oe,o)),o.hasStaticDeps()?o.saveSignalsFromDeps():o.autorun&&o.run(),new Bt(o)}getCurrentChildEffect(){return this.childEffects[this.curChildEffectSlot]}attachChildEffect(t){this.childEffects.push(t),this.parentEffect=this}run=()=>{if(this.#o||!this.shouldRun)return;let t=hs();t?t.batch(this.id,this.priority):(this.runCleanupCallback(),this.curChildEffectSlot=0,this.shouldRun=!1,f(Vt,this.id,this.id),this.hasStaticDeps()?this.#t=this.callback():(this.#s=new Set(this.#e),this.#t=ls(this,this.callback),this.cleanupLostSignals(),this.#r.clear()))};[at](){this.shouldRun=!0,this.autorun&&this.run()}whenSignalIsRead(t){this.#s.delete(t),this.#e.has(t)||(this.#e.add(t),this.#i.set(t,[y(ht,t,this.priority,at,this),E($,t,Te,this)]))}[Te](t){!this.#r.has(t)&&this.#e.has(t)&&(this.#r.add(t),this.unsubscribeSignal(t),this.#r.size===this.#e.size&&this.destroy())}cleanupLostSignals(){for(let t of this.#s)this.unsubscribeSignal(t),this.#e.delete(t)}unsubscribeSignal(t){this.#i.has(t)&&(this.#i.get(t).forEach(e=>{e()}),this.#i.delete(t))}runCleanupCallback(){if(this.#t!=null){let t=this.#t;this.#t=void 0,ir(t)?Promise.resolve(t).then(e=>{typeof e=="function"&&e()}):t()}}destroy=()=>{this.#o||(f(this,s.Destroy,this),S(this),f(B,as,this),this.runCleanupCallback(),S(ht,this),S(B,this),S($,this),this.#o=!0,this.#e.clear(),this.#s.clear(),this.#i.clear(),this.#r.clear(),this.childEffects.forEach(t=>{t.destroy()}),this.childEffects.length=0,--s.count)}};var v=(...s)=>gt.createEffect(...s);var St=new WeakMap,nr=s=>{let t=St.get(s);return t||(t={},St.set(s,t)),t},R=(s,t)=>St.get(s)?.signals?.get(t);var us=(s,t,e)=>{let r=nr(s);r.signals??=new Map,r.signals.set(t,e)};function xt(...s){for(let t of s)if(St.has(t)){let e=St.get(t);if(e.signals){for(let r of e.signals.values())k(r);e.signals.clear(),e.signals=void 0}}}function cs(s){let t=C(G(s)?s:R(...s));t!=null&&!t.muted&&!t.destroyed&&qt(t.id,t.value,{touch:!0})}function ut(s){return G(s)?C(s)?.value:C(R(...s))?.value}var Ht=class{[L];constructor(t){this[L]=t}get get(){return this[L].reader}get set(){return this[L].writer}get value(){return ut(this.get)}set value(t){this.set(t)}onChange(t){let{destroy:e}=v(()=>t(this.value),[this.get]);return e}get muted(){return this[L].muted}set muted(t){this[L].muted=t}touch(){cs(this)}destroy(){k(this)}};var or=new yt("si");function ds(s){Ut()||Gt()?.whenSignalIsRead(s)}function qt(s,t,e){Ut()||f(ht,s,t,e)}var G=s=>s!=null&&s[L]!=null,ar=s=>{let t=e=>(e?v(()=>(s.destroyed||ds(s.id),e(s.value)),[t]):s.destroyed||(s.beforeRead?.(),ds(s.id)),s.value);return Object.defineProperty(t,L,{value:s}),t},Qt=class s{static instanceCount=0;id;lazy;get[L](){return this}compare;beforeRead;muted=!1;destroyed=!1;#t=void 0;get value(){return this.lazy&&(this.#t=this.valueFn(),this.valueFn=void 0,this.lazy=!1),this.#t}set value(t){this.#t=t}valueFn;reader;writer=(t,e)=>{let r=e?.lazy??!1,n=e?.compare??this.compare??((h,a)=>h===a);if((r!==this.lazy||r&&t!==this.valueFn||!r&&!n(t,this.#t))&&(r?(this.#t=void 0,this.valueFn=t,this.lazy=!0):(this.#t=t,this.valueFn=void 0,this.lazy=!1),!this.muted&&!this.destroyed)){qt(this.id,this.#t);return}(e?.touch??!1)&&qt(this.id,this.#t,{touch:!0})};object;constructor(t,e){this.id=or.make(),++s.instanceCount,this.lazy=t,this.lazy?(this.value=void 0,this.valueFn=e):(this.value=e,this.valueFn=void 0),this.reader=ar(this),this.object=new Ht(this)}},C=s=>s?.[L];function d(s=void 0,t){let e;if(G(s))e=C(s);else{let r=t?.lazy??!1;e=new Qt(r,s),e.beforeRead=t?.beforeRead,e.compare=t?.compare}return t?.attach!=null&&j.findOrCreate(t.attach).attachSignal(e),e.object}var k=(...s)=>{for(let t of s){let e=C(t);e!=null&&!e.destroyed&&(e.destroyed=!0,e.beforeRead=void 0,--Qt.instanceCount,f($,e.id,e.id))}};function _e(s,t){let e=d(),r=t?.attach!=null?j.findOrCreate(t.attach):void 0;r!=null&&(t?.name?r.attachSignalByName(t.name,e):r.attachSignal(e));let i=v(()=>{O(()=>{e.set(s())})},{autorun:!(t?.lazy??!1),priority:t?.priority??V.C,attach:r}),n=C(e);return n.beforeRead=i.run,E($,n.id,i.destroy),e.get}var Yt=class{#t=!1;#e;source;lastValue;isDestroyed=!1;constructor(t){x(this),this.source=C(t),this.#e=y(ht,this.source.id,(e,r)=>{!this.#t&&!this.isDestroyed&&(r?.touch===!0?this.touch():this.write())}),E($,this.source.id,()=>this.destroy())}attach(t){let e=j.findOrCreate(t);return e.attachLink(this),E(this,K,()=>{e.detachLink(this)}),e}nextValue(){return new Promise((t,e)=>{let r=[],i=()=>r.forEach(n=>{n()});r.push(E(this,pt,n=>{i(),t(n)}),E(this,K,()=>{i(),e()}))})}async*asyncValues(t){let e=0;for(;!this.isDestroyed;)try{let r=await this.nextValue();if(t&&t(r,e++))break;U(this,pt),yield r}catch{break}Y(this,pt)}destroy(){this.isDestroyed||(this.#e?.(),this.#e=void 0,f(this,K,this),Y(this,pt),S(this),this.lastValue=void 0,this.isDestroyed=!0,Object.freeze(this))}get isMuted(){return this.#t}mute(){return!this.isDestroyed&&!this.#t&&(this.#t=!0,f(this,Pe,this)),this}unmute(){return!this.isDestroyed&&this.#t&&(this.#t=!1,f(this,Re,this)),this}toggleMute(){return this.isDestroyed||(this.#t=!this.#t,f(this,this.#t?Pe:Re,this)),this.#t}updateValue(t){if(!this.#t&&!this.isDestroyed){let{value:e}=this.source;t(e),f(this,pt,e),this.lastValue=e}}},Kt=class extends Yt{target;constructor(t,e){super(t),this.target=C(e),E($,this.target.id,()=>this.destroy()),this.touch()}touch(){return this.updateValue(t=>{this.target.writer(t,{touch:!0})}),this}write(){this.updateValue(t=>{this.target.writer(t)})}},Jt=class extends Yt{target;constructor(t,e){super(t),this.target=e,this.touch()}touch(){return this.updateValue(t=>{this.target(t)}),this}write(){this.updateValue(t=>{this.target(t)})}};var Zt=new Map;function M(s,t,e){let r=C(s),i;if(Zt.has(r)){i=Zt.get(r);let c=C(t)??t;if(i.has(c))return i.get(c)}else i=new Map,Zt.set(r,i);let n=C(t),o=n!=null?new Kt(s,n):new Jt(s,t),h=e?.attach;h&&o.attach(h);let a=n??t;return i.set(a,o),E(o,K,()=>{i.delete(a),i.size===0&&Zt.delete(r)}),o}var Xt=class s{static fromProps(t,e){let r=new s,i=e?e.map(n=>[n,t[n]]):Object.entries(t);for(let[n,o]of i)r.#t.set(n,d(o));return r}#t=new Map;keys(){return this.#t.keys()}signals(){return this.#t.values()}entries(){return this.#t.entries()}clear(){for(let t of this.#t.values())t.destroy();this.#t.clear()}has(t){return this.#t.has(t)}get(t){if(!this.#t.has(t)){let e=d();return this.#t.set(t,e),e}return this.#t.get(t)}update(t){t.size&&O(()=>{for(let[e,r]of t.entries())this.get(e).set(r)})}updateFromProps(t,e){O(()=>{let r=e?e.map(i=>[i,t[i]]):Object.entries(t);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 m;(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"})(m||(m={}));var ct=Symbol.for("ShadowEntsGlobalNS"),q="#void",fs="contextLost",ps="configure",gs="changeTrail",ys="destroy",ms="loaded",bs="appliedChangeTrail",vs="importedModule",ws="destroyed",mt="messageToView",Cs=6e4,Es=6e4,Ss=5e3,xs=5e3,Ne="shadowObjects";function ks(s,t){s.indexOf(t)===-1&&s.push(t)}function De(s,t){let e=s.indexOf(t);e!==-1&&s.splice(e,1),s.push(t)}function Z(s,t){let e=s.indexOf(t);e!==-1&&s.splice(e,1)}var dt=s=>typeof s=="string"?s.trim()||ct:typeof s=="symbol"?s:ct;var kt="#root",At=class{#t;get uuid(){return this.#t}#e=0;constructor(t){this.#t=t}#s=!0;#i=0;#r=0;hasChanges(){return this.#e>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=q;#o;#a=0;#h;#l;#u;create(t=q,e,r=0){this.#e++,this.#i++,this.#h=t,this.#l=e??kt,this.#u=r||void 0}destroy(){this.#r++,this.#e++}clear(){this.#e=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(t){t===this.#n?this.#h=void 0:(this.#h=t,this.#e++)}setParent(t){t===this.#o?this.#l=void 0:(this.#l=t??kt,this.#e++)}changeOrder(t){t===this.#a?this.#u=void 0:(this.#u=t,this.#e++)}#c=new Map;#d=new Map;#f=[];changeProperty(t,e,r){let i=this.#c.get(t);r==null&&e!==i||r!=null&&!r(e,i)?(this.#d.set(t,e),De(this.#f,t),this.#e++):(this.#d.delete(t),Z(this.#f,t))}removeProperty(t){let e=this.#c.has(t);this.#d.has(t)?(this.#d.delete(t),e||Z(this.#f,t)):e&&(De(this.#f,t),this.#e++)}#g=[];#p=new Set;createEvent(t,e,r){this.#g.push({type:t,data:e}),r?.forEach(i=>this.#p.add(i)),this.#e++}transferEventsTo(t){this.#g.length>0&&(t.#g.push(...this.#g),this.#g.length=0),this.#p.size>0&&(t.#p=new Set([...t.#p,...this.#p]),this.#p.clear())}buildChangeTrail(t,e){let{isNew:r,isCreated:i,isDestroyed:n}=this;if(!(r&&n))switch(e){case I.StructuralChanges:r?t.push(this.makeCreateEntityChange()):n||(this.#l!==void 0&&!(this.#l===kt&&this.#o===void 0)?t.push(this.makeSetParentChange()):this.#u!==void 0&&this.#u!==this.#a&&t.push(this.makeUpdateOrderChange()),this.#h!==void 0&&this.#h!==this.#n&&t.push(this.makeChangeToken()));break;case I.ContentUpdates:!r&&i&&this.#f.length>0&&t.push(this.makeChangePropertyChange()),this.#g.length>0&&t.push(this.makeEvents());break;case I.Removal:n&&t.push(this.makeDestroyEntityChange());break}}makeEvents(){let t={type:m.SendEvents,uuid:this.#t,events:this.#g.slice(0)};return this.#p.size>0&&(t.transferables=Array.from(this.#p)),t}makeCreateEntityChange(){let t={type:m.CreateEntities,uuid:this.#t,token:this.#h};if(this.#n=this.#h,this.#l!==void 0){let e=this.#l===kt?void 0:this.#l;this.#o=e,e!==void 0&&(t.parentUuid=e)}return this.#d.size>0&&(t.properties=Array.from(this.#d.entries()).filter(([,e])=>e!==void 0),t.properties.forEach(([e,r])=>this.#c.set(e,r))),this.#u!==void 0&&this.#u!==this.#a&&(t.order=this.#a=this.#u),t}makeDestroyEntityChange(){return{type:m.DestroyEntities,uuid:this.#t}}makeSetParentChange(){this.#o=this.#l===kt?void 0:this.#l;let t={type:m.SetParent,uuid:this.#t,parentUuid:this.#o};return this.#u!==void 0&&this.#u!==this.#a&&(t.order=this.#a=this.#u),t}makeUpdateOrderChange(){return this.#a=this.#u??0,{type:m.UpdateOrder,uuid:this.#t,order:this.#a}}makeChangeToken(){return this.#n=this.#h??q,{type:m.ChangeToken,uuid:this.#t,token:this.#n}}makeChangePropertyChange(){let t=this.#f.map(e=>{if(this.#d.has(e)){let r=this.#d.get(e);return this.#c.set(e,r),[e,r]}else return this.#c.delete(e),[e,void 0]});return{type:m.ChangeProperties,uuid:this.#t,properties:t}}};var As=s=>{if(!(s===void 0||s.length===0))return s.filter(t=>t.length===1||t[1]!==void 0)},$e=(s,t)=>{if(s===t||t===void 0)return s;if(s===void 0)return As(t);for(let[e,r]of t){let i=s.find(([n])=>n===e);i===void 0?s.push([e,r]):i[1]=r}return As(s)};var te=class{#t=new Map;get[Symbol.iterator](){return this.#t.entries.bind(this.#t)}clear(){this.#t.clear()}isEmpty(){return this.#t.size===0}hasComponentState(t){return this.#t.has(t)}getComponentState(t){return this.#t.get(t)}write(t){for(let e of t)if(e.type===m.CreateEntities)this.createEntity(e);else if(this.#t.has(e.uuid))switch(e.type){case m.DestroyEntities:this.destroyEntity(e);break;case m.SetParent:this.setParent(e);break;case m.UpdateOrder:this.updateOrder(e);break;case m.ChangeToken:this.changeToken(e);break;case m.ChangeProperties:this.changeProperties(e);break}}changeProperties({uuid:t,properties:e}){let r=this.getComponentState(t);r.properties=$e(r.properties,e)}changeToken({uuid:t,token:e}){this.getComponentState(t).token=e||q}updateOrder({uuid:t,order:e}){this.getComponentState(t).order=e??0}setParent({uuid:t,parentUuid:e,order:r}){let i=this.getComponentState(t);i.parentUuid=e,i.order=r??0}destroyEntity({uuid:t}){this.#t.delete(t)}createEntity({uuid:t,token:e,parentUuid:r,order:i,properties:n}){this.#t.set(t,{token:e||q,parentUuid:r,order:i??0,properties:$e(void 0,n)})}};var D=class s{static{this.ReRequestParentRoots="re-request-parent-roots"}static getContextsMap(){return globalThis.__shadowEntsContexts==null&&(globalThis.__shadowEntsContexts=new Map),globalThis.__shadowEntsContexts}static get(t){let e=dt(t),r=s.getContextsMap();return r.has(e)?r.get(e):new s(e)}#t=new Map;#e=[];#s=new te;constructor(t=ct){let e=dt(t),r=s.getContextsMap();if(r.has(e))return r.get(e);this.ns=e,r.set(e,this)}addComponent(t){let e;this.#t.has(t.uuid)?(e=this.#t.get(t.uuid),e.component=t,e.children=[]):(e={component:t,children:[],changes:new At(t.uuid),propIsEqual:void 0},this.#t.set(t.uuid,e)),e.changes.create(t.token,t.parent?.uuid,t.order),t.parent?(this.addToChildren(t.parent,t),e.changes.setParent(t.parent.uuid)):this.#n(t,this.#e),this.#o=void 0}hasComponent(t){return this.#t.has(t.uuid)}hasComponents(){return this.#t.size>0}isRootComponent(t){return this.#e.includes(t.uuid)}destroyComponent(t){if(this.hasComponent(t)){let e=this.#t.get(t.uuid);e.children.slice(0).forEach(r=>this.#t.get(r)?.component.removeFromParent()),e.changes.destroy(),this.#o=void 0}}getChildren(t){return this.#t.get(t.uuid)?.children.map(e=>this.#t.get(e).component)??[]}removeFromParent(t,e){if(this.hasComponent(e)){let r=this.#t.get(t),i=this.#t.get(e.uuid),n=i.children.indexOf(t);n!==-1&&(i.children.splice(n,1),r.changes.setParent(void 0)),this.#n(r.component,this.#e),this.#o=void 0}}moveToRoot(t){let e=this.#t.get(t);e&&(e.changes?.setParent(void 0),this.#n(e.component,this.#e)),this.#o=void 0}changeToken(t,e){this.#t.get(t.uuid)?.changes.changeToken(e)}isChildOf(t,e){return this.hasComponent(e)?this.#t.get(e.uuid).children.includes(t.uuid):!1}addToChildren(t,e){let r=this.#t.get(t.uuid);if(r)this.#n(e,r.children),this.#t.get(e.uuid)?.changes.setParent(t.uuid),Z(this.#e,e.uuid),this.#o=void 0;else throw new Error(`the view component ${t.uuid} cannot have a child added to it because the component do not exist!`)}removeSubTree(t){let e=this.#t.get(t);e&&(e.children.slice(0).forEach(r=>this.removeSubTree(r)),this.destroyComponent(e.component),this.#i(t))}setProperty(t,e,r,i){let n=this.#t.get(t.uuid);return n!=null?(i!=null?(n.propIsEqual??=new Map,n.propIsEqual.set(e,i)):n.propIsEqual?.has(e)&&n.propIsEqual.delete(e),n.changes.changeProperty(e,r,i)):!1}removeProperty(t,e){this.#t.get(t.uuid)?.changes.removeProperty(e)}changeOrder(t){if(t.parent){let e=this.#t.get(t.parent.uuid);Z(e.children,t.uuid),this.#n(t,e.children)}else Z(this.#e,t.uuid),this.#n(t,this.#e);this.#t.get(t.uuid)?.changes.changeOrder(t.order),this.#o=void 0}traverseLevelOrderBFS(){return this.#a().map(t=>t.component)}dispatchShadowObjectsEvent(t,e,r,i){this.#t.get(t.uuid)?.changes.createEvent(e,r,i)}broadcastEvent(t,e=void 0){for(let r of this.traverseLevelOrderBFS())r.dispatchEvent(t,e,!1)}dispatchMessage(t,e,r=void 0,i=!1){this.#t.get(t)?.component.dispatchEvent(e,r,i)}dispatchReRequestParentRoots(){for(let t of this.#e)this.dispatchMessage(t,s.ReRequestParentRoots)}buildChangeTrails(t=!0){let e=[];if(!this.hasComponents())return e;let r=this.#r();for(let i of r)i.buildChangeTrail(e,I.StructuralChanges);for(let i of r)i.buildChangeTrail(e,I.ContentUpdates);for(let i of r)i.buildChangeTrail(e,I.Removal),(i.isDestroyed||i.isNew&&!i.isCreated)&&this.#i(i.uuid),t&&i.clear();return this.#s.write(e),e}reCreateChanges(){if(!this.#s.isEmpty()){this.buildChangeTrails(!1);for(let[t,e]of this.#s){let r=this.#t.get(t);if(r){let i=new At(t);if(i.create(e.token,e.parentUuid,e.order),e.properties)for(let[n,o]of e.properties)i.changeProperty(n,o,r.propIsEqual?.get(n));r.changes.transferEventsTo(i),r.changes.clear(),r.changes=i}}this.#s.clear(),this.broadcastEvent(fs)}}clear(){if(this.#o=void 0,this.#s.clear(),this.#e.slice(0).forEach(t=>this.removeSubTree(t)),this.#e.length!==0)throw new Error("component-context panic: #rootComponents is not empty!");if(this.#t.size!==0)throw new Error("component-context panic: #components is not empty!")}#i(t){this.#t.has(t)&&(this.#t.delete(t),Z(this.#e,t),this.#o=void 0)}#r(){return this.#a().filter(t=>t.changes.hasChanges()).map(t=>t.changes)}#n(t,e){if(e.length===0){e.push(t.uuid);return}if(e.includes(t.uuid))return;let r=e.length,i=new Array(r);if(i[0]=this.#t.get(e[0]).component,t.order<i[0].order){e.unshift(t.uuid);return}if(r===1){e.push(t.uuid);return}let n=r-1;if(i[n]=this.#t.get(e[n]).component,t.order>=i[n].order){e.push(t.uuid);return}if(r===2){e.splice(1,0,t.uuid);return}for(let o=n-1;o>=1;o--)if(i[o]=this.#t.get(e[o]).component,t.order>=i[o].order){e.splice(o+1,0,t.uuid);return}}#o;#a(){if(this.#o)return this.#o;let t=new Map,e=(r,i)=>{let n=this.#t.get(r);if(n!=null){t.has(i)?t.get(i).push(n):t.set(i,[n]);for(let o of n.children)e(o,i+1)}};return this.#e.forEach(r=>e(r,0)),this.#o=Array.from(t.entries()).sort((r,i)=>r[0]-i[0]).map(([,r])=>r).flat(),this.#o}};function Tt(s,t,e,r,i,n){function o(rt){if(rt!==void 0&&typeof rt!="function")throw new TypeError("Function expected");return rt}for(var h=r.kind,a=h==="getter"?"get":h==="setter"?"set":"value",c=!t&&s?r.static?s:s.prototype:null,w=t||(c?Object.getOwnPropertyDescriptor(c,r.name):{}),b,u=!1,l=e.length-1;l>=0;l--){var p={};for(var g in r)p[g]=g==="access"?{}:r[g];for(var g in r.access)p.access[g]=r.access[g];p.addInitializer=function(rt){if(u)throw new TypeError("Cannot add initializers after decoration has completed");n.push(o(rt||null))};var A=(0,e[l])(h==="accessor"?{get:w.get,set:w.set}:w[a],p);if(h==="accessor"){if(A===void 0)continue;if(A===null||typeof A!="object")throw new TypeError("Object expected");(b=o(A.get))&&(w.get=b),(b=o(A.set))&&(w.set=b),(b=o(A.init))&&i.unshift(b)}else(b=o(A))&&(h==="field"?i.unshift(b):w[a]=b)}c&&Object.defineProperty(c,r.name,w),u=!0}function X(s,t,e){for(var r=arguments.length>2,i=0;i<t.length;i++)e=r?t[i].call(s,e):t[i].call(s);return r?e:void 0}function Ot(s){return function(t,e){let r=s?.name||e.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 us(this,r,o),j.findOrCreate(this).attachSignalByName(r,o),o.value}}}}var N="ConsoleLogger",_=`${N}Storage`,hr=!!(globalThis.location?.host?.startsWith("localhost")??!1),Rt="localStorage"in globalThis,ee=Symbol.for(N),Ts=!1,Os=s=>{if(typeof s=="boolean")return s;switch(s.toLowerCase()){case"true":case"yes":case"on":return!0;default:return!1}},Fe=s=>[Rt?N:void 0,...Array.isArray(s)?s:[s]].filter(Boolean).join(".");function Ie(s,t=void 0,e){let r=Fe(s),i=Rt?localStorage.getItem(r):globalThis[_]?.[r];return i!=null?t(i):e}function Pt(s,t){Rt?localStorage.setItem(Fe(s),t):(globalThis[_]==null&&(globalThis[_]={},console.debug(`${N}: Initialize`,{[_]:globalThis[_]})),globalThis[_][Fe(s)]=t)}var P=class s{static{this.sharedConfig={enable:hr,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(t){s.sharedConfig["styles.debug"]=t},get info(){return s.sharedConfig["styles.info"]},set info(t){s.sharedConfig["styles.info"]=t},get warn(){return s.sharedConfig["styles.warn"]},set warn(t){s.sharedConfig["styles.warn"]=t},get error(){return s.sharedConfig["styles.error"]},set error(t){s.sharedConfig["styles.error"]=t}}}static loadConfig(){Rt?(["enable","debug","info","warn"].forEach(t=>{this.sharedConfig[t]=Ie(t,Os,this.sharedConfig[t])}),["debug","info","warn","error"].forEach(t=>{this.sharedStyles[t]=Ie(["styles",t],void 0,this.sharedStyles[t])}),s.isDebug&&console.debug(`${N}: Load config from localStorage`,s.sharedConfig),globalThis[N]?.[ee]||(globalThis[N]??={[ee]:!0,get enable(){return s.sharedConfig.enable},set enable(t){s.sharedConfig.enable=t,Pt("enable",t?"true":"false")},get debug(){return s.sharedConfig.debug},set debug(t){s.sharedConfig.debug=t,Pt("debug",t?"true":"false")},get info(){return s.sharedConfig.info},set info(t){s.sharedConfig.info=t,Pt("info",t?"true":"false")},get warn(){return s.sharedConfig.warn},set warn(t){s.sharedConfig.warn=t,Pt("warn",t?"true":"false")}})):globalThis[_]?.[ee]||(globalThis[_]={[ee]:!0,...s.sharedConfig,...globalThis[_]},s.sharedConfig=globalThis[_],s.isDebug&&console.debug(`${N}: Load config from ${_}`,globalThis[_]))}constructor(t){this.enable=!0,this.namespace=(t||"").trim()||N,Ts||(s.loadConfig(),Ts=!0);let e=[this.namespace,"enable"];this.enable=Ie(e,Os,this.enable),Pt(e,Rt?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(...t){this.#t("debug",s.sharedStyles.debug,t)}info(...t){this.#t("info",s.sharedStyles.info,t)}warn(...t){this.#t("warn",s.sharedStyles.warn,t)}error(...t){this.#t("error",s.sharedStyles.error,t)}#t(t,e,r){console[t](`%c${this.namespace}`,e,...r)}};var F=(()=>{var s;let t,e=[],r=[],i,n=[],o=[];return class H{static{let a=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;t=[Ot()],i=[Ot()],Tt(this,null,t,{kind:"accessor",name:"viewReady",static:!1,private:!1,access:{has:c=>"viewReady"in c,get:c=>c.viewReady,set:(c,w)=>{c.viewReady=w}},metadata:a},e,r),Tt(this,null,i,{kind:"accessor",name:"proxyReady",static:!1,private:!1,access:{has:c=>"proxyReady"in c,get:c=>c.proxyReady,set:(c,w)=>{c.proxyReady=w}},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)}#t;#e;#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=X(this,e,!1),this.#a=(X(this,r),X(this,n,!1)),this.#h=(X(this,o),!1),this.ready=async()=>this.isReady?this:ft(this,H.ContextCreated),this.#l=()=>{this.#s&&this.#u()},U(this,H.ContextCreated),y(this,H.ContextLost,V.AAA,()=>{Y(this,H.ContextCreated)}),v(()=>{if(this.viewReady&&this.proxyReady)return this.view.reCreateChanges(),f(this,H.ContextCreated,this),this.#i&&(this.#i=!1,this.#u()),()=>{f(this,H.ContextLost,this)}},[R(this,"viewReady"),R(this,"proxyReady")])}get view(){return this.#t}set view(a){a!==this.#t&&(this.#t&&this.#t.ns&&globalThis.__shadowEnvs&&globalThis.__shadowEnvs.delete(this.#t.ns),this.#t=a??void 0,this.#t&&this.#t.ns&&(globalThis.__shadowEnvs??=new Map,globalThis.__shadowEnvs.has(this.#t.ns)&&globalThis.__shadowEnvs.get(this.#t.ns)!==this&&this.logger.isWarn&&this.logger.warn("overwrite a namespace already in use",this.#t.ns,globalThis.__shadowEnvs.get(this.#t.ns)),globalThis.__shadowEnvs.set(this.#t.ns,this)),this.viewReady=!!a)}get envProxy(){return this.#e}set envProxy(a){if(a!==this.#e){let c=this.#e;this.#e=a??void 0,this.#e&&(this.#e.onMessageToView=this.#c.bind(this)),c&&c.destroy(),this.proxyReady=!1,a?.start().then(()=>{this.proxyReady=!0}).catch(w=>{this.logger.error("failed to start envProxy",w),this.proxyReady=!1})}}get isReady(){return!!(this.#t&&this.#e&&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=ft(this,H.AfterSync).then(a=>(this.#n=void 0,a)),this.#n)}destroy(){let a=this.#t?.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),xt(this),S(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,H.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"],lr=()=>{let s=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=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[t&255]+T[t>>8&255]+"-"+T[t>>16&15|64]+T[t>>24&255]+"-"+T[e&63|128]+T[e>>8&255]+"-"+T[e>>16&255]+T[e>>24&255]+T[r&255]+T[r>>8&255]+T[r>>16&255]+T[r>>24&255]).toLowerCase()},Ps=()=>globalThis?.crypto?.randomUUID?.()??lr();var Mt=class extends Error{constructor(t){super(t),this.name="ViewComponentError"}},se=class s{#t;#e;#s;#i;#r=0;get uuid(){return this.#t}get token(){return this.#e}set token(t){t??=q,t!==this.#e&&(this.#e=t,this.#s?.changeToken(this,t))}get parent(){return this.#i}set parent(t){if(t){if(t.#s!==this.#s)throw new Mt("cannot set parent from different context");t.addChild(this)}else this.removeFromParent()}get context(){return this.#s}set context(t){this.#s!=t&&(this.#s&&this.destroy(),this.#s=t,t&&t.addComponent(this))}get order(){return this.#r}set order(t){let e=this.#r;this.#r=t??0,e!==this.#r&&this.#s.changeOrder(this)}constructor(t,e){x(this),e instanceof s&&(e={parent:e}),this.#t=e?.uuid??Ps(),this.#e=t,this.#r=e?.order??0,this.#i=e?.parent;let r=e?.context??D.get();if(this.#i&&this.#i.#s!==r)throw new Mt("cannot set parent from different context");this.context=r}isChildOf(t){return this.#i===t}removeFromParent(){this.#i?(this.#s?.removeFromParent(this.uuid,this.#i),this.#i=void 0):this.#s?.moveToRoot(this.uuid)}addChild(t){if(t.#s!==this.#s)throw new Mt("cannot add a child from another context");t.isChildOf(this)||(t.removeFromParent(),t.#i=this,this.#s.addToChildren(this,t))}setProperty(t,e,r){this.#s.setProperty(this,t,e,r)}removeProperty(t){this.#s.removeProperty(this,t)}dispatchShadowObjectsEvent(t,e,r){this.#s.dispatchShadowObjectsEvent(this,t,e,r)}dispatchEvent(t,e,r){if(f(this,t,e),r)for(let i of this.#s.getChildren(this))i.dispatchEvent(t,e,r)}destroy(){this.removeFromParent(),this.#s?.destroyComponent(this),this.#s=void 0}};var re="shaeRequestEntParent",ie="shaeReRequestEntParent",Rs="shae-worker",ne="shae-ent",Ms="shae-prop",tt="token";var oe="local",Ls="no-autostart",ae="no-structured-clone",W="auto-sync";var he="name",le="value",ue="type",ce="no-trim";var Lt=new Set(["on","true","yes","local","1"]);var js=s=>dt(s.getAttribute("ns")),_t=(s,t)=>{if(s.hasAttribute(t)){let e=s.getAttribute(t)?.trim()?.toLowerCase()||"1";return Lt.has(e)}return!1};var _s=(s,t)=>{t.set(js(s))},We=new Set,ze=!1,ur=s=>{We.add(s),ze||(ze=!0,queueMicrotask(()=>{ze=!1;for(let t of We)F.get(t)?.sync();We.clear()}))},et=class extends HTMLElement{static{this.observedAttributes=["ns"]}get ns(){return this.ns$.value}set ns(t){typeof t=="symbol"?this.ns$.set(t):this.ns$.set(dt(t))}constructor(){super(),this.isShaeElement=!0,this.ns$=d(ct),this.ns$.onChange(t=>{typeof t=="string"&&t.length>0?this.getAttribute("ns")!==t&&this.setAttribute("ns",t):this.removeAttribute("ns")}),_s(this,this.ns$)}attributeChangedCallback(t){t==="ns"&&_s(this,this.ns$)}syncShadowObjects(){ur(this.ns)}};var de=class extends et{static{this.observedAttributes=[...et.observedAttributes,tt]}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(t){this.token$.set(t)}#t;constructor(){super(),this.isShaeEntElement=!0,this.componentContext$=d(),this.viewComponent$=d(),this.token$=d(),this.#n=!0,this.#d=()=>{let t=this.findShadowRootHost();t!=null&&this.dispatchEvent(new CustomEvent(ie,{bubbles:!0,composed:!0,detail:{requester:this,shadowRootHost:t}}))},this.#f=t=>{let e=t.detail?.requester;if(e===this||!e?.isShaeEntElement||e.ns!==this.ns)return;t.detail?.shadowRootHost&&this.#l()},this.#g=t=>{let e=t.detail?.requester;e!==this&&e?.isShaeEntElement&&e.ns===this.ns&&(t.stopPropagation(),e.#c(this))},this.ns$.onChange(t=>{this.componentContext$.set(D.get(t)),this.isConnected&&this.#l()}),this.#p(),this.token$.onChange(t=>{t==null?this.removeAttribute(tt):this.getAttribute(tt)!==t&&this.setAttribute(tt,t)}),v(()=>{let t=this.viewComponent$.get();if(t){let e=y(t,D.ReRequestParentRoots,()=>this.#h()),r=t.context?.ns;return()=>{e(),t.destroy(),r&&r!==this.ns?F.get(r)?.sync():this.syncShadowObjects()}}}),this.token$.onChange(t=>{let e=this.viewComponent$.value;e&&(e.token=t,this.syncShadowObjects())}),this.style.display="contents"}#e;#s(){this.#e?.();let t=this.componentContext$.onChange(e=>{let r=this.token$.value,i=this.viewComponent$.value;i?i.context=e:e&&(i=new se(r,{context:e}),this.viewComponent$.set(i)),this.syncShadowObjects()});this.#e=()=>{t()}}#i(){this.#e?.(),this.#e=void 0}#r;#n;findShadowRootHost(){if(this.#n){this.#n=!1;let t=this;for(;t;){if(t.parentElement==null){let e=t.parentNode;e&&(this.#r=e.host);break}t=t.parentElement}}return this.#r}getParentNodeForObserver(){let t=this.parentNode;return t||(t.host??t)}connectedCallback(){this.#n=!0,this.addEventListener("slotchange",this.#d,{capture:!1,passive:!1}),this.addEventListener(re,this.#g,{capture:!1,passive:!1}),this.#s(),Le(()=>this.#p()),this.componentContext==null&&this.componentContext$.set(D.get(this.ns)),this.#l(),this.componentContext?.dispatchReRequestParentRoots(),this.#o(),this.syncShadowObjects()}#o(){this.#a();let t=this.getParentNodeForObserver();t&&(this.#t=new MutationObserver((e,r)=>{for(let{target:i,removedNodes:n}of e)if(i===t){for(let o of n)if(o===this){this.#a(),this.onParentChanged(this.getParentNodeForObserver(),t);break}}}),this.#t.observe(t,{childList:!0,subtree:!1,attributes:!1}))}onParentChanged(t,e){this.#c(void 0),this.#l()}#a(){this.#t?.disconnect(),this.#t=void 0}attributeChangedCallback(t){super.attributeChangedCallback(t),t===tt&&this.#p()}disconnectedCallback(){this.#n=!0,this.#a(),this.removeEventListener("slotchange",this.#d,{capture:!1}),this.removeEventListener(re,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(re,{bubbles:!0,composed:!0,detail:{requester:this}}))}#u;#c(t){if(this.entParentNode!==t)if(this.entParentNode&&this.entParentNode.removeEventListener(ie,this.#f,{capture:!1}),this.entParentNode=t,this.entParentNode&&this.entParentNode.addEventListener(ie,this.#f,{capture:!1,passive:!1}),this.#u?.(),this.#u=void 0,t){let e=v(()=>{let r=this.viewComponent$.get();if(r){let i=t.viewComponent$.get();r.parent=i&&i.context===r.context?i:void 0,r.parent==null&&queueMicrotask(()=>{this.#l()}),this.syncShadowObjects()}});this.#u=()=>e.destroy()}else{let e=this.viewComponent;e.parent&&(e.parent=void 0,this.syncShadowObjects())}}#d;#f;#g;#p(){if(this.hasAttribute(tt)){let t=this.getAttribute(tt)?.trim()||void 0;this.token$.set(t)}}};customElements.define(ne,de);var cr=s=>{let t=s.parentElement;for(;t;){if(t.isShaeEntElement)return t;t=t.parentElement}},dr=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"]),fe=class extends HTMLElement{static{this.observedAttributes=[he,le,ue,ce]}get name(){return this.name$.value}get value(){return this.valueOut$.value}set value(t){this.valueIn$.set(t)}get shouldTrim(){return this.shouldTrim$.value}get entNode(){return this.entNode$.value}set entNode(t){this.entNode$.set(t)}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.#t=()=>{this.entNode$.set(cr(this))},this.#e=()=>{queueMicrotask(()=>{this.isConnected||this.entNode$.set(void 0)})},this.#s=()=>{this.name$.set(this.getAttribute(he)?.trim()??void 0)},this.#i=()=>{this.valueIn$.set(this.getAttribute(le))},this.#r=()=>{let t=this.getAttribute(ue)?.trim().toLowerCase();t&&!dr.has(t)&&(this.logger.isWarn&&this.logger.warn(`[${this.name}] unknown type "${t}"`,{shaeProp:this}),t=void 0),this.type$.set(t)},this.#n=()=>{this.shouldTrim$.set(!_t(this,ce))},this.entNode$.onChange(t=>{if(t){let e=M(t.viewComponent$,this.viewComponent$);return()=>{e.destroy()}}else this.viewComponent$.set(void 0)}),v(()=>{let t=this.viewComponent$.get();if(t){let e=this.name$.get();if(e){let r=this.valueOut$.get();this.logger.isDebug&&this.logger.debug(`[${this.name}] view-component set-property`,e,r,t.uuid,{viewComponent:t,shaeProp:this}),t.setProperty(e,r),this.isConnected&&this.entNode?.syncShadowObjects()}}}),v(()=>{let t=this.type$.get(),e=this.shouldTrim$.get(),r=this.valueIn$.get();if(e&&typeof r=="string"&&(r=r.trim()),r=r||void 0,r!=null&&typeof r=="string"&&t)switch(t){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=Lt.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=>Lt.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 "${t}"`,{value:r,shaeProp:this})}this.valueOut$.set(r)}),O(()=>{this.#s(),this.#i(),this.#r(),this.#n()}),this.style.display="contents"}connectedCallback(){O(()=>{this.#t(),this.#s(),this.#i(),this.#r(),this.#n()})}attributeChangedCallback(t){switch(t){case he:this.#s();break;case le:this.#i();break;case ue:this.#r();break;case ce:this.#n();break}}disconnectedCallback(){this.#e()}#t;#e;#s;#i;#r;#n};customElements.whenDefined(ne).then(()=>customElements.define(Ms,fe));var pe,Ve=null,bt=class{static{this.OnFrame=Symbol("onFrame")}#t=0;#e=0;constructor(){if(Ve)return Ve;x(this),Ve=this}start(t){if(t!=null)return Ae(this)===0&&this.#i(),y(this,pe.OnFrame,t),this.#e++,()=>{this.stop(t)}}stop(t){S(this,pe.OnFrame,t),Ae(this)===0&&this.#r()}#s=t=>{f(this,pe.OnFrame,t),this.#i()};#i(){this.#t=requestAnimationFrame(this.#s)}#r(){cancelAnimationFrame(this.#t),this.#t=0}};pe=bt;var vt="value",Nt=(()=>{let s,t=[],e=[];return class{static{let i=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;s=[Ot({name:vt})],Tt(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},t,e),i&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})}static{this.Value=vt}#t;#e;#s;get value(){return this.#s}set value(i){this.#s=i}constructor(i){this.#t=[],this.#s=X(this,t,void 0),this.value$=X(this,e),U(this,vt),this.value$=R(this,vt),this.value$.onChange(n=>f(this,vt,n)),i&&this.add(...i)}add(...i){return this.#t.push(...i),this.#r(),this.#i(i)}unshift(...i){return this.#t.unshift(...i),this.#r(),this.#i(i)}remove(...i){this.#i(i)()}clear(){this.#t.length=0,this.#r()}dispose(){this.clear(),this.#e?.destroy(),this.#e=void 0,Y(this,vt),S(this),this.value$.destroy(),xt(this)}#i(i){return()=>{for(let n of i){let o=this.#t.indexOf(n);o!==-1&&this.#t.splice(o,1)}this.#r()}}#r(){this.#e?.destroy(),this.#t.length===0?(this.#e=void 0,this.value=void 0):(this.#e=v(()=>{let i;for(let n of this.#t){let o=ut(n);if(o!=null){i=o;break}}this.value=i},this.#t),this.#e.run())}}})();var Ue="onCreate",st="onDestroy",Ns="onParentChanged",Ds="onViewEvent";var Be=new Map,Ge=!1,fr=(s,t)=>{Be.set(s,t),Ge||(Ge=!0,queueMicrotask(()=>{Ge=!1;let e=Array.from(Be.entries());Be.clear();for(let[r,i]of e)r.set(i)}))},ge=class{#t;#e;#s=new Xt;#i=new Map;#r=new Map;#n;#o;#a=new Set;#h=[];#l=0;get kernel(){return this.#t}get uuid(){return this.#e}get order(){return this.#l}set order(t){this.#l!==t&&(this.#l=t,this.#n&&this.parent.resortChildren())}get parentUuid(){return this.#n||void 0}set parentUuid(t){this.#n!==t&&(this.removeFromParent(),this.#n=t||void 0,this.#o=t?this.#t.getEntity(t):void 0,this.#o&&this.#o.addChild(this))}get parent(){return!this.#o&&this.#n&&(this.#o=this.#t.getEntity(this.#n)),this.#o}set parent(t){this.parentUuid=t?.uuid}get hasParent(){return!!this.#n}get children(){return this.#h}constructor(t,e){this.#t=t,this.#e=e,E(this,st,V.Min,this)}traverse(t){t(this);for(let e of this.#h)e.traverse(t)}onDestroy(){this.#s.clear(),S(this);for(let t of this.#r.values())t.cleanup(),t.signal.destroy();this.#r.clear();for(let t of this.#i.values())t.context.set(void 0),t.unsubscribePathValue(),t.unsubscribeFromParent?.(),t.valuePath.dispose(),t.inherited.destroy(),t.provide.destroy(),t.context.destroy();this.#n=void 0,this.#o=void 0,this.#a.clear(),this.#h.length=0}addChild(t){if(this.#h.length===0){this.#a.add(t.uuid),this.#h.push(t);return}if(this.#a.has(t.uuid))throw new Error(`child with uuid: ${t.uuid} already exists! parentUuid: ${this.uuid}`);this.#a.add(t.uuid),this.#h.push(t),this.resortChildren();for(let[,e]of t.#i)t.#f(e)}resortChildren(){this.#h.sort((t,e)=>t.order-e.order)}removeChild(t){this.#a.has(t.uuid)&&(this.#a.delete(t.uuid),this.#h.splice(this.#h.indexOf(t),1))}removeFromParent(){if(this.#o){this.#o.removeChild(this),this.#o=void 0,this.#n=void 0;for(let[,t]of this.#i)t.unsubscribeFromParent&&(t.unsubscribeFromParent(),t.unsubscribeFromParent=void 0)}}reSubscribeToParentContexts(){for(let[,t]of this.#i)this.#f(t)}dispatchMessageToView(t,e,r,i=!1){this.#t.dispatchMessageToView({uuid:this.#e,type:t,data:e,transferables:r,traverseChildren:i})}dispatchViewEvents(t){for(let{type:e,data:r}of t)f(this,Ds,e,r)}dispatchViewEvent(t,e){this.dispatchViewEvents([{type:t,data:e}])}#u(t){return this.#s.get(t)}getPropertyReader(t){return this.#u(t).get}getPropertyWriter(t){return this.#u(t).set}setProperties(t){this.clearTruthyPropsCache(),O(()=>{for(let[e,r]of t)this.setProperty(e,r)})}setProperty(t,e){this.getPropertyWriter(t)(e)}getProperty(t){return ut(this.getPropertyReader(t))}propKeys(){return Array.from(this.#s.keys())}propEntries(){return Array.from(this.#s.entries()).map(([t,e])=>[t,e.value])}#c;clearTruthyPropsCache(){this.#c=void 0}truthyProps(){if(this.#c)return this.#c.size?this.#c:void 0;let t=new Set;for(let[e,r]of this.#s.entries())if(typeof e=="string"){let i=r.value;i!=null&&i!==!1&&i!==""&&t.add(e)}return this.#c=t,t.size?t:void 0}hasContext(t){return this.#i.has(t)}useContext(t){return this.#d(t).context.get}useParentContext(t){return this.#d(t).inherited.get}provideContext(t){return this.#d(t).provide}provideGlobalContext(t){if(this.#r.has(t))return this.#r.get(t).signal;let e=this.#t.findOrCreateRootContext(t),r=d(),i=e.add(r);return this.#r.set(t,{cleanup:i,signal:r}),r}#d(t){if(this.#i.has(t))return this.#i.get(t);let e=d(),r=d(),i=d(),n=new Nt([r,e]),o=y(n,Nt.Value,a=>{fr(i,a)}),h={name:t,inherited:e,provide:r,context:i,valuePath:n,unsubscribePathValue:o};return this.#i.set(t,h),this.#f(h),h}#f(t){if(t.unsubscribeFromParent?.(),t.unsubscribeFromParent=void 0,this.parent){let e=this.parent.#d(t.name),r=M(e.context,t.inherited);t.unsubscribeFromParent=r.destroy.bind(r)}else{let e=this.#t.findOrCreateRootContext(t.name),r=M(e.value$,t.inherited);t.unsubscribeFromParent=r.destroy.bind(r)}}};var $s=s=>{let t=s.split("@").map(e=>e.trim());if(t.length===2&&t[1])return t[0]?{key:`${t[0]}@${t[1]}`,prop:t[1],token:t[0]}:{key:t[1],prop:t[1]}},ye=(s,t)=>{for(let e of t)s.add(e)},pr=(s,t)=>{if(s!=null)for(let e of s.constructors)t.add(e)},Dt=class{static get(t){return t??gr}#t=new Map;#e=new Map;#s=new Map;define(t,e){this.#t.has(t)?ks(this.#t.get(t).constructors,e):this.#t.set(t,{token:t,constructors:[e]})}appendRoute(t,e){let r=$s(t);r?this.#s.has(r.key)?ye(this.#s.get(r.key).routes,e):this.#s.set(r.key,{routes:new Set(e),token:r.token}):this.#e.has(t)?ye(this.#e.get(t),e):this.#e.set(t,new Set(e))}clearRoute(t){let e=$s(t);e?this.#s.delete(e.key):this.#e.delete(t)}findTokensByRoute(t,e){let r=new Set([t]),i=this.#e.has(t)?[...this.#e.get(t)]:[];for(;i.length;){let n=i.shift();r.has(n)||(r.add(n),this.#e.has(n)&&i.push(...Array.from(this.#e.get(n)).filter(o=>!r.has(o))))}if(e){for(let o of e)this.#s.has(o)&&ye(r,this.#s.get(o).routes);let n;do{n=r.size;for(let o of new Set(r))for(let h of e){let a=`${o}@${h}`;this.#s.has(a)&&ye(r,this.#s.get(a).routes)}}while(n!==r.size)}return r}findConstructors(t,e){let r=this.findTokensByRoute(t,e),i=new Set;for(let n of r)pr(this.#t.get(n),i);return i.size>0?Array.from(i):void 0}hasToken(t){return this.#t.has(t)}hasRoute(t){return this.#e.has(t)}clear(){this.#t.clear(),this.#e.clear()}},gr=new Dt;var Q;(function(s){s[s.CreateAndDestroy=0]="CreateAndDestroy",s[s.JustCreate=1]="JustCreate",s[s.DestroyOnly=2]="DestroyOnly"})(Q||(Q={}));var Is=s=>s.displayName||s.name,me=class{#t;#e;#s;#i;#r;#n;constructor(t){this.logger=new P("Kernel"),this.#t=new Map,this.#e=new Set,this.#r=!0,this.#n=new Map,x(this),this.registry=Dt.get(t)}getEntity(t){let e=this.#t.get(t)?.entity;if(!e)throw new Error(`entity with uuid "${t}" not found!`);return e}hasEntity(t){return this.#t.has(t)}traverseLevelOrderBFS(t=!1){if(this.#r){let e=new Map,r=(i,n)=>{let o=this.getEntity(i);e.has(n)?e.get(n).push(o):e.set(n,[o]);for(let h of o.children)r(h.uuid,n+1)};this.#e.forEach(i=>r(i,0)),this.#s=Array.from(e.entries()).sort((i,n)=>i[0]-n[0]).map(([,i])=>i).flat(),this.#i=this.#s.slice().reverse(),this.#r=!1}return t?this.#i:this.#s}getEntityGraph(){return Array.from(this.#e).map(t=>this.getEntityGraphNode(t))}getEntityGraphNode(t){if(!this.#t.has(t))return;let{token:e,entity:r}=this.#t.get(t);return{token:e,entity:r,props:Object.fromEntries(r.propEntries()),children:r.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,Q.DestroyOnly));for(let e of this.traverseLevelOrderBFS(!1))this.updateShadowObjects(e.uuid,Q.JustCreate,t.get(e.uuid));t.clear()}run(t){this.logger.isDebug&&this.logger.debug("sync",t),O(()=>{for(let e of t.changeTrail)this.parse(e)})}parse(t){switch(t.type){case m.CreateEntities:this.createEntity(t.uuid,t.token,t.parentUuid,t.order,t.properties),this.#r=!0;break;case m.DestroyEntities:this.destroyEntity(t.uuid),this.#r=!0;break;case m.SetParent:this.setParent(t.uuid,t.parentUuid,t.order),this.#r=!0;break;case m.UpdateOrder:this.updateOrder(t.uuid,t.order),this.#r=!0;break;case m.ChangeProperties:this.changeProperties(t.uuid,t.properties);break;case m.ChangeToken:this.changeToken(t.uuid,t.token);break;case m.SendEvents:this.dispatchEventsToEntity(t.uuid,t.events);break}}createEntity(t,e,r,i=0,n){let o=new ge(this,t);o.order=i;let h={token:e,entity:o,usedConstructors:new Map};this.#t.set(t,h),r&&(o.parentUuid=r),o.hasParent||this.#e.add(t),n&&o.setProperties(n),this.createShadowObjects(t)}destroyEntity(t){if(!this.#t.has(t))return;let{entity:e,usedConstructors:r}=this.#t.get(t);e.removeFromParent(),f(e,st,this),r.clear(),this.#t.delete(e.uuid),this.#e.delete(e.uuid)}setParent(t,e,r=0){let i=this.getEntity(t);i.parentUuid===e&&i.order===r||(i.removeFromParent(),i.order=r,i.parentUuid=e,i.hasParent?this.#e.delete(t):this.#e.add(t),i.reSubscribeToParentContexts(),queueMicrotask(()=>{this.logger.isDebug&&this.logger.debug("entity.onParentChanged",{uuid:t,parentUuid:e,order:r,entity:i}),f(i,Ns,i)}))}updateOrder(t,e){this.getEntity(t).order=e}dispatchEventsToEntity(t,e){this.getEntity(t)?.dispatchViewEvents(e)}changeProperties(t,e){this.getEntity(t).setProperties(e),this.updateShadowObjects(t)}changeToken(t,e){if(!this.#t.has(t))return;let r=this.#t.get(t);r.token!==e&&(r.token=e,this.updateShadowObjects(t))}dispatchMessageToView(t){queueMicrotask(()=>{f(this,mt,t)})}updateShadowObjects(t,e=Q.CreateAndDestroy,r){let i=this.#t.get(t);r??=new Set(this.registry.findConstructors(i.token,i.entity.truthyProps()));let n=e===Q.CreateAndDestroy||e===Q.DestroyOnly,o=e===Q.CreateAndDestroy||e===Q.JustCreate;if(n){for(let[h,a]of i.usedConstructors)if(!r.has(h)){i.usedConstructors.delete(h);for(let c of a)this.destroyShadowObject(c,i.entity)}}if(o)for(let h of r)i.usedConstructors.has(h)||this.constructShadowObject(h,i);return r}constructShadowObject(t,e){let r=new Set,i=new Set,n=new Map,o=new Map,h=new Map,a=new Map,c=new Map,w=(u,l)=>{let p=c.get(u);if(p===void 0){p=d(void 0,l?{compare:l}:void 0).get,c.set(u,p);let g=M(e.entity.getPropertyReader(u),p);i.add(g.destroy.bind(g))}return p},b=x(new t({entity:e.entity,provideContext(u,l,p){let g=h.get(u);if(g==null){let A=G(l);if(g=d(A?void 0:l,p?{compare:p}:void 0),A){let Ct=M(l,g);i.add(Ct.destroy.bind(Ct))}let wt=M(g,e.entity.provideContext(u));i.add(wt.destroy.bind(wt)),h.set(u,g)}return g},provideGlobalContext(u,l,p){let g=a.get(u);if(g==null){let A=G(l);if(g=d(A?void 0:l,p?{compare:p}:void 0),A){let Ct=M(l,g);i.add(Ct.destroy.bind(Ct))}let wt=M(g,e.entity.provideGlobalContext(u));i.add(wt.destroy.bind(wt)),a.set(u,g)}return g},useContext(u,l){let p=n.get(u);if(p===void 0){p=d(void 0,l?{compare:l}:void 0).get,n.set(u,p);let g=M(e.entity.useContext(u),p);i.add(g.destroy.bind(g))}return p},useParentContext(u,l){let p=o.get(u);if(p===void 0){p=d(void 0,l?{compare:l}:void 0).get,o.set(u,p);let g=M(e.entity.useParentContext(u),p);i.add(g.destroy.bind(g))}return p},useProperty:w,useProperties(u){let l={};for(let p in u)Object.prototype.hasOwnProperty.call(u,p)&&(l[p]=w(u[p]));return l},createResource(u,l){let p=d(void 0);i.add(()=>k(p));let g=v(()=>{let A=u();return p.set(A),A!==void 0&&l?()=>{l(A),p.set(void 0)}:()=>{p.set(void 0)}});return i.add(g.destroy),p},createEffect(...u){let l=v(...u);return i.add(l.destroy),l},createSignal(...u){let l=d(...u);return i.add(()=>{k(l)}),l},createMemo(...u){let l=_e(...u);return i.add(()=>{k(l)}),l},on(...u){let l=y(...u);return i.add(l),l},once(...u){let l=E(...u);return i.add(l),l},onDestroy(u){r.add(u)}}));return this.logger.isInfo&&this.logger.info("create shadow-object",Is(t),{shadowObject:b,entity:e.entity}),E(e.entity,st,V.Low,()=>{this.logger.isInfo&&this.logger.info("destroy shadow-object",Is(t),{shadowObject:b,entity:e.entity});for(let l of r)l();for(let l of i)l();for(let l of n.values())k(l);for(let l of o.values())k(l);for(let l of c.values())k(l);for(let l of h.values())k(l);for(let l of a.values())k(l);r.clear(),i.clear(),n.clear(),o.clear(),c.clear(),h.clear(),a.clear();let u=e.usedConstructors.get(t);u&&(u.delete(b),u.size===0&&e.usedConstructors.delete(t))}),e.usedConstructors.has(t)?e.usedConstructors.get(t).add(b):e.usedConstructors.set(t,new Set([b])),this.attachShadowObject(b,e.entity),b}createShadowObjects(t){let e=this.#t.get(t);this.registry.findConstructors(e.token,e.entity.truthyProps())?.forEach(r=>{this.constructShadowObject(r,e)})}findShadowObjects(t){if(!this.#t.has(t))return[];let{usedConstructors:e}=this.#t.get(t);return Array.from(new Set(Array.from(e.values()).map(r=>Array.from(r)).flat()))}attachShadowObject(t,e){y(e,t),typeof t[Ue]=="function"&&t[Ue](e)}destroyShadowObject(t,e){typeof t[st]=="function"&&t[st](e),f(t,st,e),S(e,t)}findOrCreateRootContext(t){let e=this.#n.get(t);return e||(e=new Nt,this.#n.set(t,e)),e}destroy(){for(let t of this.#n.values())t.dispose();this.#n.clear();for(let t of this.traverseLevelOrderBFS().reverse())this.destroyEntity(t.uuid)}};async function qe(s,t,e,r=!0){if(e.has(t)){console.warn("importModule: skipping already imported module",t);return}else e.add(t);t.extends&&await Promise.all(t.extends.map(n=>qe(s,n,e,!1)));let{registry:i}=s;if(t.define)for(let[n,o]of Object.entries(t.define))i.define(n,o);if(t.routes)for(let[n,o]of Object.entries(t.routes))i.appendRoute(n,o);await(t.initialize?.({define:(n,o)=>i.define(n,o),kernel:s,registry:i})??Promise.resolve()),r&&s.upgradeEntities()}var be=s=>(typeof s=="string"&&(s=new URL(s,globalThis.location.href)),s.toString());function Fs(s){return s.map(t=>{if(t.transferables&&t.transferables.length>0){let{transferables:e,...r}=t;return structuredClone(r,{transfer:e})}else return structuredClone(t)})}var ve=class{#t;get registry(){return this.kernel.registry}constructor(t){this.#t=new Set,this.isLocalEnv=!0,this.disableStructuredClone=!1,this.kernel=new me(t),y(this.kernel,mt,e=>{if(this.onMessageToView!=null){let{type:r,uuid:i,traverseChildren:n}=e,o=structuredClone(e.data,{transfer:e.transferables});this.onMessageToView({type:r,uuid:i,data:o,traverseChildren:n})}})}start(){return Promise.resolve()}applyChangeTrail(t,e){let r={changeTrail:this.disableStructuredClone?t:Fs(t)},i;try{this.kernel.run(r),i=Promise.resolve()}catch(n){i=Promise.reject(n)}return i}async importScript(t){let e=await import(be(t));e[Ne]&&await this.importModule(e[Ne])}async importModule(t){return qe(this.kernel,t,this.#t)}destroy(){this.kernel.destroy(),this.registry.clear(),this.#t.clear()}};function He(s){let t=new Blob([s],{type:"text/javascript"}),e=URL.createObjectURL(t),r=new Worker(e);return URL.revokeObjectURL(e),r}function Qe(){return He('var Vs=Object.defineProperty;var ae=Object.getOwnPropertySymbols;var Ie=Object.prototype.hasOwnProperty,$e=Object.prototype.propertyIsEnumerable;var Is=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Ue=e=>{throw TypeError(e)};var pe=(e,t,s)=>t in e?Vs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,ve=(e,t)=>{for(var s in t||(t={}))Ie.call(t,s)&&pe(e,s,t[s]);if(ae)for(var s of ae(t))$e.call(t,s)&&pe(e,s,t[s]);return e};var Ge=(e,t)=>{var s={};for(var i in e)Ie.call(e,i)&&t.indexOf(i)<0&&(s[i]=e[i]);if(e!=null&&ae)for(var i of ae(e))t.indexOf(i)<0&&$e.call(e,i)&&(s[i]=e[i]);return s};var f=(e,t,s)=>pe(e,typeof t!="symbol"?t+"":t,s),be=(e,t,s)=>t.has(e)||Ue("Cannot "+s);var r=(e,t,s)=>(be(e,t,"read from private field"),s?s.call(e):t.get(e)),g=(e,t,s)=>t.has(e)?Ue("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),c=(e,t,s,i)=>(be(e,t,"write to private field"),i?i.call(e,s):t.set(e,s),s),w=(e,t,s)=>(be(e,t,"access private method"),s);var Be=(e,t,s,i)=>({set _(a){c(e,t,a,s)},get _(){return r(e,t,i)}});var me=function(e,t){this[0]=e,this[1]=t},We=(e,t,s)=>{var i=(n,l,y,v)=>{try{var m=s[n](l),h=(l=m.value)instanceof me,d=m.done;Promise.resolve(h?l[0]:l).then(u=>h?i(n==="return"?n:"next",l[1]?{done:u.done,value:u.value}:u,y,v):y({value:u,done:d})).catch(u=>i("throw",u,y,v))}catch(u){v(u)}},a=n=>o[n]=l=>new Promise((y,v)=>i(n,l,y,v)),o={};return s=s.apply(e,t),o[Is("asyncIterator")]=()=>o,a("next"),a("throw"),a("return"),o};var qe;(function(e){e[e.StructuralChanges=1]="StructuralChanges",e[e.ContentUpdates=2]="ContentUpdates",e[e.Removal=3]="Removal"})(qe||(qe={}));var tt;(function(e){e[e.CreateEntities=1]="CreateEntities",e[e.DestroyEntities=2]="DestroyEntities",e[e.SetParent=3]="SetParent",e[e.UpdateOrder=4]="UpdateOrder",e[e.ChangeProperties=5]="ChangeProperties",e[e.ChangeToken=6]="ChangeToken",e[e.SendEvents=7]="SendEvents"})(tt||(tt={}));var $s="configure",Us="changeTrail",Gs="destroy",Bs="loaded",Je="appliedChangeTrail",we="importedModule",Ws="destroyed",Oe="messageToView",Ce="shadowObjects",N="ConsoleLogger",x=`${N}Storage`,os,hs,ls,qs=!!((ls=(hs=(os=globalThis.location)==null?void 0:os.host)==null?void 0:hs.startsWith("localhost"))!=null&&ls),Yt="localStorage"in globalThis,ne=Symbol.for(N),Ke=!1,Ye=e=>{if(typeof e=="boolean")return e;switch(e.toLowerCase()){case"true":case"yes":case"on":return!0;default:return!1}},Me=e=>[Yt?N:void 0,...Array.isArray(e)?e:[e]].filter(Boolean).join(".");function Ee(e,t=void 0,s){var o;let i=Me(e),a=Yt?localStorage.getItem(i):(o=globalThis[x])==null?void 0:o[i];return a!=null?t(a):s}function $t(e,t){Yt?localStorage.setItem(Me(e),t):(globalThis[x]==null&&(globalThis[x]={},console.debug(`${N}: Initialize`,{[x]:globalThis[x]})),globalThis[x][Me(e)]=t)}var mt,Gt,p,Js=(p=class{constructor(t){g(this,mt);this.enable=!0,this.namespace=(t||"").trim()||N,Ke||(p.loadConfig(),Ke=!0);let s=[this.namespace,"enable"];this.enable=Ee(s,Ye,this.enable),$t(s,Yt?this.enable?"true":"false":this.enable)}static get isEnabled(){return p.sharedConfig.enable}static get isDebug(){return p.sharedConfig.enable&&p.sharedConfig.debug}static loadConfig(){var t,s,i;Yt?(["enable","debug","info","warn"].forEach(a=>{this.sharedConfig[a]=Ee(a,Ye,this.sharedConfig[a])}),["debug","info","warn","error"].forEach(a=>{this.sharedStyles[a]=Ee(["styles",a],void 0,this.sharedStyles[a])}),p.isDebug&&console.debug(`${N}: Load config from localStorage`,p.sharedConfig),(t=globalThis[N])!=null&&t[ne]||((s=globalThis[N])!=null||(globalThis[N]={[ne]:!0,get enable(){return p.sharedConfig.enable},set enable(a){p.sharedConfig.enable=a,$t("enable",a?"true":"false")},get debug(){return p.sharedConfig.debug},set debug(a){p.sharedConfig.debug=a,$t("debug",a?"true":"false")},get info(){return p.sharedConfig.info},set info(a){p.sharedConfig.info=a,$t("info",a?"true":"false")},get warn(){return p.sharedConfig.warn},set warn(a){p.sharedConfig.warn=a,$t("warn",a?"true":"false")}}))):(i=globalThis[x])!=null&&i[ne]||(globalThis[x]=ve(ve({[ne]:!0},p.sharedConfig),globalThis[x]),p.sharedConfig=globalThis[x],p.isDebug&&console.debug(`${N}: Load config from ${x}`,globalThis[x]))}get isEnabled(){return this.enable&&p.sharedConfig.enable}get isDebug(){return this.isEnabled&&p.sharedConfig.debug}get isInfo(){return this.isEnabled&&p.sharedConfig.info}get isWarn(){return this.isEnabled&&p.sharedConfig.warn}debug(...t){w(this,mt,Gt).call(this,"debug",p.sharedStyles.debug,t)}info(...t){w(this,mt,Gt).call(this,"info",p.sharedStyles.info,t)}warn(...t){w(this,mt,Gt).call(this,"warn",p.sharedStyles.warn,t)}error(...t){w(this,mt,Gt).call(this,"error",p.sharedStyles.error,t)}},mt=new WeakSet,Gt=function(t,s,i){console[t](`%c${this.namespace}`,s,...i)},p.sharedConfig={enable:qs,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"},p.sharedStyles={get debug(){return p.sharedConfig["styles.debug"]},set debug(t){p.sharedConfig["styles.debug"]=t},get info(){return p.sharedConfig["styles.info"]},set info(t){p.sharedConfig["styles.info"]=t},get warn(){return p.sharedConfig["styles.warn"]},set warn(t){p.sharedConfig["styles.warn"]=t},get error(){return p.sharedConfig["styles.error"]},set error(t){p.sharedConfig["styles.error"]=t}},p),Ot="*",bs=1,ze=2,Fe=4,vt=Symbol.for("eventize"),Ks="[eventize]",ce=e=>e===Ot,ms=e=>{switch(typeof e){case"string":case"symbol":return!0;default:return!1}},ws=typeof console<"u",Ys=ws?console[console.warn?"warn":"log"].bind(console,Ks):()=>{},Hs=(e,t,s)=>(Object.defineProperty(e,t,{value:s,configurable:!0}),e),Qs=0,Cs=class{constructor(){f(this,"events",new Map);f(this,"eventNames",new Set)}static publish(e){e.sort((t,s)=>t.order-s.order).forEach(t=>t.emit())}add(e){Array.isArray(e)?e.forEach(t=>this.eventNames.add(t)):this.eventNames.add(e)}remove(e){Array.isArray(e)?e.forEach(t=>this.eventNames.delete(t)):this.eventNames.delete(e),this.clear(e)}clear(e){Array.isArray(e)?e.forEach(t=>this.events.delete(t)):this.events.delete(e)}retain(e,t){this.eventNames.has(e)&&this.events.set(e,{args:t,order:Qs++})}isKnown(e){return this.eventNames.has(e)}emit(e,t,s=[]){if(ce(e))this.eventNames.forEach(i=>this.emit(i,t,s));else if(this.events.has(e)){let{order:i,args:a}=this.events.get(e);s.push({order:i,emit:()=>t.apply(e,a)})}return s}},je=(e,t,s,i)=>{if(typeof t=="function"){let a=t.apply(e,s);a!=null&&(i==null||i(a))}},Xs=(e,t,s,i)=>je(t,t.emit,[e].concat(s),i),Zs=e=>{switch(typeof e){case"function":return bs;case"string":case"symbol":return ze;case"object":return Fe}},_s=0,ti=()=>++_s,Es=class{constructor(e,t,s,i=null){f(this,"id");f(this,"eventName");f(this,"isCatchEmAll");f(this,"priority");f(this,"listener");f(this,"listenerObject");f(this,"listenerType");f(this,"callAfterApply");f(this,"isRemoved");f(this,"refCount");this.id=ti(),this.eventName=e,this.isCatchEmAll=ce(e),this.listener=s,this.listenerObject=i,this.priority=t,this.listenerType=Zs(s),this.callAfterApply=void 0,this.isRemoved=!1,this.refCount=1}isEqual(e,t=null){if(e===this)return!0;let s=typeof e;return s==="number"&&e===this.id?!0:t===null&&(s==="string"||s==="symbol")?e===Ot||e===this.eventName:this.listener===e&&this.listenerObject===t}apply(e,t,s){if(this.isRemoved)return;let{listener:i,listenerObject:a}=this;switch(this.listenerType){case bs:je(a,i,t,s),this.callAfterApply&&this.callAfterApply();break;case ze:je(a,a[i],t,s),this.callAfterApply&&this.callAfterApply();break;case Fe:{let o=i[e];if(this.isCatchEmAll||this.eventName===e){if(typeof o=="function"){let n=o.apply(i,t);n!=null&&(s==null||s(n))}else Xs(e,i,t,s);this.callAfterApply&&this.callAfterApply()}break}}}},ei=(e,t)=>e.priority!==t.priority?t.priority-e.priority:e.id-t.id,He=e=>e==null?void 0:e.slice(0),Qe=(e,t)=>{let s=e.indexOf(t);s>-1&&e.splice(s,1)},si=e=>e===Fe||e===ze,Te=(e,t,s)=>{let i=e.findIndex(a=>a.isEqual(t,s));i>-1&&(e[i].isRemoved=!0,e.splice(i,1))},oe=(e,t,s)=>{let i=[];for(let a of e)(t==null&&a.listenerObject===s||a.eventName===t&&a.listener===s)&&i.push(a);for(let a of i)Te(e,a,void 0)},Se=e=>{e&&(e.forEach(t=>{t.isRemoved=!0}),e.length=0)},ii=(e,t)=>e.listenerType===t.listenerType?e.priority===t.priority&&e.eventName===t.eventName&&e.listenerObject===t.listenerObject&&e.listener===t.listener:!1,ri=(e,t)=>{if(si(e.listenerType))return t.find(s=>ii(e,s))},ai=(e,t)=>{let s=ri(e,t);return s?(s.refCount+=1,s):(t.push(e),t.sort(ei),e)},ni=class{constructor(){f(this,"namedListeners");f(this,"catchEmAllListeners");f(this,"getListenersForEventName",e=>{let t=this.namedListeners.get(e);return t||(t=[],this.namedListeners.set(e,t)),t});this.namedListeners=new Map,this.catchEmAllListeners=[]}add(e){return ai(e,e.isCatchEmAll?this.catchEmAllListeners:this.getListenersForEventName(e.eventName))}remove(e,t,s=!1){t==null&&Array.isArray(e)?e.forEach(i=>this.remove(i,null,s)):e==null||t==null&&ce(e)?this.removeAllListeners():t==null&&ms(e)?Se(this.namedListeners.get(e)):e instanceof Es?e.isRemoved||(e.refCount-=1,e.refCount<1&&(e.isRemoved=!0,this.namedListeners.forEach(i=>Qe(i,e)),Qe(this.catchEmAllListeners,e))):s?ce(e)&&typeof e=="object"?oe(this.catchEmAllListeners,Ot,e):this.namedListeners.forEach(i=>oe(i,e,t)):(this.namedListeners.forEach(i=>{Te(i,e,t),typeof e=="object"&&oe(i,void 0,e)}),Te(this.catchEmAllListeners,e,t),typeof e=="object"&&oe(this.catchEmAllListeners,void 0,e))}removeAllListeners(){this.namedListeners.forEach(e=>Se(e)),this.namedListeners.clear(),Se(this.catchEmAllListeners)}forEach(e,t){let s=He(this.catchEmAllListeners),i=He(this.namedListeners.get(e));if(e===Ot||!i||i.length===0)s.forEach(t);else if(s.length===0)i.forEach(t);else{let a=i.length,o=s.length,n=0,l=0;for(;n<a||l<o;){if(n<a){let y=i[n];if(l>=o||y.priority>=s[l].priority){t(y),++n;continue}}l<o&&(t(s[l]),++l)}}}getSubscriptionCount(){let e=this.catchEmAllListeners.length;for(let t of this.namedListeners.values())e+=t.length;return e}},It=e=>!!(e&&e[vt]);function Ht(e){if(It(e))return e;let t=new ni,s=new Cs;return Hs(e,vt,{keeper:s,store:t}),e}var ye={Max:Number.POSITIVE_INFINITY,AAA:1e9,BB:1e6,C:1e3,Default:0,Low:-1e4,Min:Number.NEGATIVE_INFINITY},oi=(e,t,s,i,a,o,n)=>{let l=e.add(new Es(s,i,a,o));return t.emit(s,l,n),l},hi=(e,t,s,i)=>{let a=s.length,o=typeof s[0],n,l,y,v;if(a>=2&&a<=3&&o==="number"?(n=Ot,[l,y,v]=s):a>=3&&a<=4&&typeof s[1]=="number"?[n,l,y,v]=s:(l=ye.Default,o==="string"||o==="symbol"||Array.isArray(s[0])?[n,y,v]=s:(n=Ot,[y,v]=s)),!y&&ws)throw Ys("called with insufficient arguments!",s),"subscribeTo() called with insufficient arguments!";let m=h=>d=>oi(e,t,d,h,y,v,i);return Array.isArray(n)?n.map(h=>Array.isArray(h)?m(h[1])(h[0]):m(l)(h)):m(l)(n)},Ss=(e,t,s)=>{let i=[],a=hi(e,t,s,i);return Cs.publish(i),a},Xe=e=>t=>{t.callAfterApply=()=>{e==null||e()}},ks=(e,t)=>Object.assign(()=>V(e,t),Array.isArray(t)?{listeners:t}:{listener:t}),As=(e,t,s,i)=>{let{store:a,keeper:o}=e[vt];Array.isArray(t)?t.forEach(n=>{a.forEach(n,l=>l.apply(n,s,i)),o.retain(n,s)}):t!==Ot&&(a.forEach(t,n=>{n.apply(t,s,i)}),o.retain(t,s))},_=(e,...t)=>{let s=Ht(e),{store:i,keeper:a}=s[vt];return ks(s,Ss(i,a,t))},M=(e,...t)=>{let s=Ht(e),{store:i,keeper:a}=s[vt],o=Ss(i,a,t),n=ks(s,o),l=!1,y=()=>{l||(n(),l=!0)};return Array.isArray(o)?o.forEach(Xe(y)):Xe(y)(o),y},li=(e,t)=>new Promise(s=>{M(e,t,s)}),V=(e,t,s)=>{if(!It(e))throw new Error("object is not eventized");let{store:i,keeper:a}=e[vt],o=typeof t,n=s!=null&&(o==="string"||o==="symbol");i.remove(t,s,n),Array.isArray(t)?a.remove(t.filter(l=>typeof l=="string")):ms(t)&&a.remove(t)},C=(e,t,...s)=>{if(!It(e))throw new Error("object is not eventized");As(e,t,s)},di=(e,t,...s)=>{if(!It(e))throw new Error("object is not eventized");let i=[];return As(e,t,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()},Ne=(e,t)=>{let s=Ht(e),{keeper:i}=s[vt];i.add(t)},fe=(e,t)=>{if(!It(e))throw new Error("object is not eventized");let{keeper:s}=e[vt];s.clear(t)},ot=(()=>{let e=(t={})=>Ht(t);return e.inject=(t={})=>(t=Ht(t),Object.assign(t,{on:(...s)=>_(t,...s),once:(...s)=>M(t,...s),onceAsync:s=>li(t,s),off:(s,i)=>V(t,s,i),emit:(s,...i)=>C(t,s,...i),emitAsync:(s,...i)=>di(t,s,...i),retain:s=>Ne(t,s),retainClear:s=>fe(t,s)}),t),e.is=It,e})(),Z=Symbol.for("signal"),Mt=Symbol.for("effect"),Ze=Symbol.for("destroySignal"),_e=Symbol.for("createEffect"),ui=Symbol.for("destroyEffect"),Ut="value",ts="mute",es="unmute",Jt="destroy",Kt=Symbol.for("recall"),ge=ot(),Nt=ot(),bt=ot(),Ps=ot(),Pe,Bt=(Pe=class{constructor(){f(this,"delayedEffects",[])}batch(e,t){let s=this.delayedEffects.length;for(let i=0;i<s;i++){let[a,o]=this.delayedEffects[i];if(!(a>t))if(a===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=[_(bt,(i,a)=>{a===Kt&&e.add(i)}),_(Ps,i=>{e.add(i)})],s=this.delayedEffects.flatMap(([,i])=>Array.from(i));for(let i of s)e.has(i)||C(bt,i,i,Kt);t.forEach(i=>{i()})}},f(Pe,"current"),Pe),ci=()=>Bt.current;function Qt(e){let t=Bt.current;t?t=void 0:t=Bt.current=new Bt;try{e()}finally{t&&(Bt.current=void 0,t.run())}}var fi=0;function Os(){return fi>0}var ds,gi=(ds=Mt,class{constructor(e){f(this,ds);f(this,"run",()=>{var e;return(e=this[Mt])==null?void 0:e.run()});f(this,"destroy",()=>{var e;(e=this[Mt])==null||e.destroy(),this[Mt]=void 0});this[Mt]=e,M(e,Ts.Destroy,()=>{this[Mt]=void 0})}}),ht=new Map,J,wt,U,it,K,Ct,Et,G,St,nt,re=(nt=class{constructor(t){g(this,J,new Set);g(this,wt,new Set);g(this,U,new Map);g(this,it,new WeakMap);g(this,K,new Map);g(this,Ct,new Set);g(this,Et,new Set);g(this,G);g(this,St);if(t!=null&&t instanceof nt)return t;if(t!=null||(t=this),ht.has(t))return ht.get(t);c(this,St,t),ht.set(t,this),ot(this)}static get(t){if(t!=null)return t instanceof nt?t:ht.get(t)}static findOrCreate(t){if(t==null)throw new Error("Cannot create a group with a null object");return new nt(t)}static destroy(t){console.warn("SignalGroup.destroy(obj) is deprecated. Use SignalGroup.delete(obj) instead."),nt.delete(t)}static delete(t){var s;(s=ht.get(t))==null||s.clear()}static clear(){for(let t of ht.values())t.destroy();ht.clear()}attachGroup(t){if(t===this)throw new Error("Cannot attach a group to itself");return r(this,J).add(t),r(t,G)&&r(t,G)!==this&&r(r(t,G),J).delete(t),c(t,G,this),t}detachGroup(t){return t!==this&&r(this,J).has(t)&&(r(this,J).delete(t),c(t,G,void 0)),t}attachSignal(t){let s=A(t);if(s!=null&&s.destroyed)throw new Error("Cannot attach a destroyed signal to a group");return s&&r(this,wt).add(s),t}attachSignalByName(t,s){if(s){this.attachSignal(s);let i=A(s);r(this,U).set(t,i),r(this,K).has(t)?r(this,K).get(t).push(i):r(this,K).set(t,[i]),r(this,it).has(i)?r(this,it).get(i).add(t):r(this,it).set(i,new Set([t]))}else r(this,U).delete(t);return s}hasSignal(t){var s;return r(this,U).has(t)||!!((s=r(this,G))!=null&&s.hasSignal(t))}signal(t){var s,i,a;return(a=(s=r(this,U).get(t))==null?void 0:s.object)!=null?a:(i=r(this,G))==null?void 0:i.signal(t)}detachSignal(t){let s=A(t);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,U).delete(a),r(this,K).delete(a)):r(this,U).get(a)===s&&r(this,U).set(a,o.at(-1))}i.clear(),r(this,it).delete(s)}return t}attachEffect(t){return r(this,Ct).add(t),t}runEffects(){for(let t of r(this,Ct))t.run();for(let t of r(this,J))t.runEffects()}attachLink(t){if(t!=null&&t.isDestroyed)throw new Error("Cannot attach a destroyed link to a group");return t&&r(this,Et).add(t),t}detachLink(t){return t&&r(this,Et).delete(t),t}destroy(){console.warn("SignalGroup#destroy is deprecated. Use SignalGroup#clear instead."),this.clear()}clear(){var t;C(this,Jt,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))$(s);for(let s of r(this,Et))s.destroy();r(this,J).clear(),r(this,wt).clear(),r(this,U).clear(),r(this,K).clear(),r(this,Ct).clear(),r(this,Et).clear(),(t=r(this,G))==null||t.detachGroup(this),r(this,St)&&(ht.delete(r(this,St)),c(this,St,void 0))}},J=new WeakMap,wt=new WeakMap,U=new WeakMap,it=new WeakMap,K=new WeakMap,Ct=new WeakMap,Et=new WeakMap,G=new WeakMap,St=new WeakMap,nt),te,ee,us,Ms=(us=class{constructor(e="id",t=1){g(this,te);g(this,ee);c(this,te,e),c(this,ee,t)}make(){return Symbol(`${r(this,te)}${Be(this,ee)._++}`)}},te=new WeakMap,ee=new WeakMap,us),Le=[],js=()=>Le.at(-1),yi=(e,t)=>{Le.push(e);try{return t()}finally{Le.pop()}},pi=e=>e!=null&&typeof e.then=="function",O,lt,Y,kt,dt,ut,At,Lt,Ts=(O=class{constructor(t,s){f(this,"id");f(this,"callback");g(this,lt);g(this,Y,new Set);g(this,kt,new Set);g(this,dt,new Map);g(this,ut,new Set);f(this,"parentEffect");f(this,"childEffects",[]);f(this,"curChildEffectSlot",0);f(this,"autorun",!0);f(this,"shouldRun",!0);f(this,"priority");g(this,At);g(this,Lt,!1);f(this,"run",()=>{if(r(this,Lt)||!this.shouldRun)return;let t=ci();t?t.batch(this.id,this.priority):(this.runCleanupCallback(),this.curChildEffectSlot=0,this.shouldRun=!1,C(Ps,this.id,this.id),this.hasStaticDeps()?c(this,lt,this.callback()):(c(this,kt,new Set(r(this,Y))),c(this,lt,yi(this,this.callback)),this.cleanupLostSignals(),r(this,ut).clear()))});f(this,"destroy",()=>{r(this,Lt)||(C(this,O.Destroy,this),V(this),C(bt,ui,this),this.runCleanupCallback(),V(ge,this),V(bt,this),V(Nt,this),c(this,Lt,!0),r(this,Y).clear(),r(this,kt).clear(),r(this,dt).clear(),r(this,ut).clear(),this.childEffects.forEach(t=>{t.destroy()}),this.childEffects.length=0,--O.count)});var a,o;ot(this),this.callback=t;let i;(s==null?void 0:s.attach)!=null&&(i=re.findOrCreate(s.attach),i.attachEffect(this)),this.autorun=(a=s==null?void 0:s.autorun)!=null?a:!0,c(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,Kt,this),++O.count}hasStaticDeps(){return r(this,At)!=null&&r(this,At).length>0}saveSignalsFromDeps(){for(let t of r(this,At))this.whenSignalIsRead(A(t).id)}static createEffect(t,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,l=js();return l!=null?(n=l.getCurrentChildEffect(),n==null&&(n=new O(t,o),l.attachChildEffect(n),C(bt,_e,n)),l.curChildEffectSlot++):(n=new O(t,o),C(bt,_e,n)),n.hasStaticDeps()?n.saveSignalsFromDeps():n.autorun&&n.run(),new gi(n)}getCurrentChildEffect(){return this.childEffects[this.curChildEffectSlot]}attachChildEffect(t){this.childEffects.push(t),this.parentEffect=this}[Kt](){this.shouldRun=!0,this.autorun&&this.run()}whenSignalIsRead(t){r(this,kt).delete(t),r(this,Y).has(t)||(r(this,Y).add(t),r(this,dt).set(t,[_(ge,t,this.priority,Kt,this),M(Nt,t,Ze,this)]))}[Ze](t){!r(this,ut).has(t)&&r(this,Y).has(t)&&(r(this,ut).add(t),this.unsubscribeSignal(t),r(this,ut).size===r(this,Y).size&&this.destroy())}cleanupLostSignals(){for(let t of r(this,kt))this.unsubscribeSignal(t),r(this,Y).delete(t)}unsubscribeSignal(t){r(this,dt).has(t)&&(r(this,dt).get(t).forEach(s=>{s()}),r(this,dt).delete(t))}runCleanupCallback(){if(r(this,lt)!=null){let t=r(this,lt);c(this,lt,void 0),pi(t)?Promise.resolve(t).then(s=>{typeof s=="function"&&s()}):t()}}},lt=new WeakMap,Y=new WeakMap,kt=new WeakMap,dt=new WeakMap,ut=new WeakMap,At=new WeakMap,Lt=new WeakMap,f(O,"idGen",new Ms("ef")),f(O,"Destroy","destroy"),f(O,"count",0),O),Vt=(...e)=>Ts.createEffect(...e),Xt=new WeakMap,vi=e=>{let t=Xt.get(e);return t||(t={},Xt.set(e,t)),t},Zt=(e,t)=>{var s,i;return(i=(s=Xt.get(e))==null?void 0:s.signals)==null?void 0:i.get(t)},bi=(e,t,s)=>{var a;let i=vi(e);(a=i.signals)!=null||(i.signals=new Map),i.signals.set(t,s)};function mi(...e){for(let t of e)if(Xt.has(t)){let s=Xt.get(t);if(s.signals){for(let i of s.signals.values())$(i);s.signals.clear(),s.signals=void 0}}}function wi(e){let t=A(_t(e)?e:Zt(...e));t!=null&&!t.muted&&!t.destroyed&&De(t.id,t.value,{touch:!0})}function Ve(e){var t,s;return _t(e)?(t=A(e))==null?void 0:t.value:(s=A(Zt(...e)))==null?void 0:s.value}var cs,Ci=(cs=Z,class{constructor(e){f(this,cs);this[Z]=e}get get(){return this[Z].reader}get set(){return this[Z].writer}get value(){return Ve(this.get)}set value(e){this.set(e)}onChange(e){let{destroy:t}=Vt(()=>e(this.value),[this.get]);return t}get muted(){return this[Z].muted}set muted(e){this[Z].muted=e}touch(){wi(this)}destroy(){$(this)}}),Ei=new Ms("si");function ss(e){var t;Os()||((t=js())==null||t.whenSignalIsRead(e))}function De(e,t,s){Os()||C(ge,e,t,s)}var _t=e=>e!=null&&e[Z]!=null,Si=e=>{let t=s=>{var i;return s?Vt(()=>(e.destroyed||ss(e.id),s(e.value)),[t]):e.destroyed||((i=e.beforeRead)==null||i.call(e),ss(e.id)),e.value};return Object.defineProperty(t,Z,{value:e}),t},Pt,B,Ls=(Pt=class{constructor(t,s){f(this,"id");f(this,"lazy");f(this,"compare");f(this,"beforeRead");f(this,"muted",!1);f(this,"destroyed",!1);g(this,B);f(this,"valueFn");f(this,"reader");f(this,"writer",(t,s)=>{var o,n,l,y;let i=(o=s==null?void 0:s.lazy)!=null?o:!1,a=(l=(n=s==null?void 0:s.compare)!=null?n:this.compare)!=null?l:((v,m)=>v===m);if((i!==this.lazy||i&&t!==this.valueFn||!i&&!a(t,r(this,B)))&&(i?(c(this,B,void 0),this.valueFn=t,this.lazy=!0):(c(this,B,t),this.valueFn=void 0,this.lazy=!1),!this.muted&&!this.destroyed)){De(this.id,r(this,B));return}(y=s==null?void 0:s.touch)!=null&&y&&De(this.id,r(this,B),{touch:!0})});f(this,"object");this.id=Ei.make(),++Pt.instanceCount,this.lazy=t,this.lazy?(this.value=void 0,this.valueFn=s):(this.value=s,this.valueFn=void 0),this.reader=Si(this),this.object=new Ci(this)}get[Z](){return this}get value(){return this.lazy&&(c(this,B,this.valueFn()),this.valueFn=void 0,this.lazy=!1),r(this,B)}set value(t){c(this,B,t)}},B=new WeakMap,f(Pt,"instanceCount",0),Pt),A=e=>e==null?void 0:e[Z];function k(e=void 0,t){var i;let s;if(_t(e))s=A(e);else{let a=(i=t==null?void 0:t.lazy)!=null?i:!1;s=new Ls(a,e),s.beforeRead=t==null?void 0:t.beforeRead,s.compare=t==null?void 0:t.compare}return(t==null?void 0:t.attach)!=null&&re.findOrCreate(t.attach).attachSignal(s),s.object}var $=(...e)=>{for(let t of e){let s=A(t);s!=null&&!s.destroyed&&(s.destroyed=!0,s.beforeRead=void 0,--Ls.instanceCount,C(Nt,s.id,s.id))}};function ki(e,t){var n,l;let s=k(),i=(t==null?void 0:t.attach)!=null?re.findOrCreate(t.attach):void 0;i!=null&&(t!=null&&t.name?i.attachSignalByName(t.name,s):i.attachSignal(s));let a=Vt(()=>{Qt(()=>{s.set(e())})},{autorun:!((n=t==null?void 0:t.lazy)!=null&&n),priority:(l=t==null?void 0:t.priority)!=null?l:ye.C,attach:i}),o=A(s);return o.beforeRead=a.run,M(Nt,o.id,a.destroy),s.get}var P,Dt,fs,Ds=(fs=class{constructor(e){g(this,P,!1);g(this,Dt);f(this,"source");f(this,"lastValue");f(this,"isDestroyed",!1);ot(this),this.source=A(e),c(this,Dt,_(ge,this.source.id,(t,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(e){let t=re.findOrCreate(e);return t.attachLink(this),M(this,Jt,()=>{t.detachLink(this)}),t}nextValue(){return new Promise((e,t)=>{let s=[],i=()=>s.forEach(a=>{a()});s.push(M(this,Ut,a=>{i(),e(a)}),M(this,Jt,()=>{i(),t()}))})}asyncValues(e){return We(this,null,function*(){let t=0;for(;!this.isDestroyed;)try{let s=yield new me(this.nextValue());if(e&&e(s,t++))break;Ne(this,Ut),yield s}catch(s){break}fe(this,Ut)})}destroy(){var e;this.isDestroyed||((e=r(this,Dt))==null||e.call(this),c(this,Dt,void 0),C(this,Jt,this),fe(this,Ut),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)&&(c(this,P,!0),C(this,ts,this)),this}unmute(){return!this.isDestroyed&&r(this,P)&&(c(this,P,!1),C(this,es,this)),this}toggleMute(){return this.isDestroyed||(c(this,P,!r(this,P)),C(this,r(this,P)?ts:es,this)),r(this,P)}updateValue(e){if(!r(this,P)&&!this.isDestroyed){let{value:t}=this.source;e(t),C(this,Ut,t),this.lastValue=t}}},P=new WeakMap,Dt=new WeakMap,fs),Ai=class extends Ds{constructor(t,s){super(t);f(this,"target");this.target=A(s),M(Nt,this.target.id,()=>this.destroy()),this.touch()}touch(){return this.updateValue(t=>{this.target.writer(t,{touch:!0})}),this}write(){this.updateValue(t=>{this.target.writer(t)})}},Pi=class extends Ds{constructor(t,s){super(t);f(this,"target");this.target=s,this.touch()}touch(){return this.updateValue(t=>{this.target(t)}),this}write(){this.updateValue(t=>{this.target(t)})}},he=new Map;function et(e,t,s){var v;let i=A(e),a;if(he.has(i)){a=he.get(i);let m=(v=A(t))!=null?v:t;if(a.has(m))return a.get(m)}else a=new Map,he.set(i,a);let o=A(t),n=o!=null?new Ai(e,o):new Pi(e,t),l=s==null?void 0:s.attach;l&&n.attach(l);let y=o!=null?o:t;return a.set(y,n),M(n,Jt,()=>{a.delete(y),a.size===0&&he.delete(i)}),n}var L,Rt,Oi=(Rt=class{constructor(){g(this,L,new Map)}static fromProps(t,s){let i=new Rt,a=s?s.map(o=>[o,t[o]]):Object.entries(t);for(let[o,n]of a)r(i,L).set(o,k(n));return i}keys(){return r(this,L).keys()}signals(){return r(this,L).values()}entries(){return r(this,L).entries()}clear(){for(let t of r(this,L).values())t.destroy();r(this,L).clear()}has(t){return r(this,L).has(t)}get(t){if(!r(this,L).has(t)){let s=k();return r(this,L).set(t,s),s}return r(this,L).get(t)}update(t){t.size&&Qt(()=>{for(let[s,i]of t.entries())this.get(s).set(i)})}updateFromProps(t,s){Qt(()=>{let i=s?s.map(a=>[a,t[a]]):Object.entries(t);for(let[a,o]of i)this.get(a).set(o)})}},L=new WeakMap,Rt);function Mi(e,t,s,i,a,o){function n(I){if(I!==void 0&&typeof I!="function")throw new TypeError("Function expected");return I}for(var l=i.kind,y=l==="getter"?"get":l==="setter"?"set":"value",v=!t&&e?i.static?e:e.prototype:null,m=t||(v?Object.getOwnPropertyDescriptor(v,i.name):{}),h,d=!1,u=s.length-1;u>=0;u--){var b={};for(var S in i)b[S]=S==="access"?{}:i[S];for(var S in i.access)b.access[S]=i.access[S];b.addInitializer=function(I){if(d)throw new TypeError("Cannot add initializers after decoration has completed");o.push(n(I||null))};var T=(0,s[u])(l==="accessor"?{get:m.get,set:m.set}:m[y],b);if(l==="accessor"){if(T===void 0)continue;if(T===null||typeof T!="object")throw new TypeError("Object expected");(h=n(T.get))&&(m.get=h),(h=n(T.set))&&(m.set=h),(h=n(T.init))&&a.unshift(h)}else(h=n(T))&&(l==="field"?a.unshift(h):m[y]=h)}v&&Object.defineProperty(v,i.name,m),d=!0}function is(e,t,s){for(var i=arguments.length>2,a=0;a<t.length;a++)s=i?t[a].call(e,s):t[a].call(e);return i?s:void 0}function ji(e){return function(t,s){var o;let i=(e==null?void 0:e.name)||s.name,a=!!((o=e==null?void 0:e.readAsValue)!=null&&o);return{get(){let n=Zt(this,i);if(n)return a?n.value:n.get()},set(n){var l;(l=Zt(this,i))==null||l.set(n)},init(n){let l=k(n,e);return bi(this,i,l),re.findOrCreate(this).attachSignalByName(i,l),l.value}}}}var jt="value",Re=(()=>{var i,a,o,n,de,Wt,v;let e,t=[],s=[];return v=class{constructor(h){g(this,n);g(this,i);g(this,a);g(this,o);c(this,i,[]),c(this,o,is(this,t,void 0)),this.value$=is(this,s),Ne(this,jt),this.value$=Zt(this,jt),this.value$.onChange(d=>C(this,jt,d)),h&&this.add(...h)}get value(){return r(this,o)}set value(h){c(this,o,h)}add(...h){return r(this,i).push(...h),w(this,n,Wt).call(this),w(this,n,de).call(this,h)}unshift(...h){return r(this,i).unshift(...h),w(this,n,Wt).call(this),w(this,n,de).call(this,h)}remove(...h){w(this,n,de).call(this,h)()}clear(){r(this,i).length=0,w(this,n,Wt).call(this)}dispose(){var h;this.clear(),(h=r(this,a))==null||h.destroy(),c(this,a,void 0),fe(this,jt),V(this),this.value$.destroy(),mi(this)}},i=new WeakMap,a=new WeakMap,o=new WeakMap,n=new WeakSet,de=function(h){return()=>{for(let d of h){let u=r(this,i).indexOf(d);u!==-1&&r(this,i).splice(u,1)}w(this,n,Wt).call(this)}},Wt=function(){var h;(h=r(this,a))==null||h.destroy(),r(this,i).length===0?(c(this,a,void 0),this.value=void 0):(c(this,a,Vt(()=>{let d;for(let u of r(this,i)){let b=Ve(u);if(b!=null){d=b;break}}this.value=d},r(this,i))),r(this,a).run())},(()=>{let h=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;e=[ji({name:jt})],Mi(v,null,e,{kind:"accessor",name:"value",static:!1,private:!1,access:{has:d=>"value"in d,get:d=>d.value,set:(d,u)=>{d.value=u}},metadata:h},t,s),h&&Object.defineProperty(v,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})})(),v.Value=jt,v})(),rs="onCreate",Tt="onDestroy",Ti="onParentChanged",Li="onViewEvent",ke=new Map,Ae=!1,Di=(e,t)=>{ke.set(e,t),Ae||(Ae=!0,queueMicrotask(()=>{Ae=!1;let s=Array.from(ke.entries());ke.clear();for(let[i,a]of s)i.set(a)}))},H,xt,ct,W,ft,z,D,rt,F,zt,j,xe,gt,qt,ue,gs,Ri=(gs=class{constructor(e,t){g(this,j);g(this,H);g(this,xt);g(this,ct,new Oi);g(this,W,new Map);g(this,ft,new Map);g(this,z);g(this,D);g(this,rt,new Set);g(this,F,[]);g(this,zt,0);g(this,gt);c(this,H,e),c(this,xt,t),M(this,Tt,ye.Min,this)}get kernel(){return r(this,H)}get uuid(){return r(this,xt)}get order(){return r(this,zt)}set order(e){r(this,zt)!==e&&(c(this,zt,e),r(this,z)&&this.parent.resortChildren())}get parentUuid(){return r(this,z)||void 0}set parentUuid(e){r(this,z)!==e&&(this.removeFromParent(),c(this,z,e||void 0),c(this,D,e?r(this,H).getEntity(e):void 0),r(this,D)&&r(this,D).addChild(this))}get parent(){return!r(this,D)&&r(this,z)&&c(this,D,r(this,H).getEntity(r(this,z))),r(this,D)}set parent(e){this.parentUuid=e==null?void 0:e.uuid}get hasParent(){return!!r(this,z)}get children(){return r(this,F)}traverse(e){e(this);for(let t of r(this,F))t.traverse(e)}onDestroy(){var e;r(this,ct).clear(),V(this);for(let t of r(this,ft).values())t.cleanup(),t.signal.destroy();r(this,ft).clear();for(let t of r(this,W).values())t.context.set(void 0),t.unsubscribePathValue(),(e=t.unsubscribeFromParent)==null||e.call(t),t.valuePath.dispose(),t.inherited.destroy(),t.provide.destroy(),t.context.destroy();c(this,z,void 0),c(this,D,void 0),r(this,rt).clear(),r(this,F).length=0}addChild(e){var t;if(r(this,F).length===0){r(this,rt).add(e.uuid),r(this,F).push(e);return}if(r(this,rt).has(e.uuid))throw new Error(`child with uuid: ${e.uuid} already exists! parentUuid: ${this.uuid}`);r(this,rt).add(e.uuid),r(this,F).push(e),this.resortChildren();for(let[,s]of r(e,W))w(t=e,j,ue).call(t,s)}resortChildren(){r(this,F).sort((e,t)=>e.order-t.order)}removeChild(e){r(this,rt).has(e.uuid)&&(r(this,rt).delete(e.uuid),r(this,F).splice(r(this,F).indexOf(e),1))}removeFromParent(){if(r(this,D)){r(this,D).removeChild(this),c(this,D,void 0),c(this,z,void 0);for(let[,e]of r(this,W))e.unsubscribeFromParent&&(e.unsubscribeFromParent(),e.unsubscribeFromParent=void 0)}}reSubscribeToParentContexts(){for(let[,e]of r(this,W))w(this,j,ue).call(this,e)}dispatchMessageToView(e,t,s,i=!1){r(this,H).dispatchMessageToView({uuid:r(this,xt),type:e,data:t,transferables:s,traverseChildren:i})}dispatchViewEvents(e){for(let{type:t,data:s}of e)C(this,Li,t,s)}dispatchViewEvent(e,t){this.dispatchViewEvents([{type:e,data:t}])}getPropertyReader(e){return w(this,j,xe).call(this,e).get}getPropertyWriter(e){return w(this,j,xe).call(this,e).set}setProperties(e){this.clearTruthyPropsCache(),Qt(()=>{for(let[t,s]of e)this.setProperty(t,s)})}setProperty(e,t){this.getPropertyWriter(e)(t)}getProperty(e){return Ve(this.getPropertyReader(e))}propKeys(){return Array.from(r(this,ct).keys())}propEntries(){return Array.from(r(this,ct).entries()).map(([e,t])=>[e,t.value])}clearTruthyPropsCache(){c(this,gt,void 0)}truthyProps(){if(r(this,gt))return r(this,gt).size?r(this,gt):void 0;let e=new Set;for(let[t,s]of r(this,ct).entries())if(typeof t=="string"){let i=s.value;i!=null&&i!==!1&&i!==""&&e.add(t)}return c(this,gt,e),e.size?e:void 0}hasContext(e){return r(this,W).has(e)}useContext(e){return w(this,j,qt).call(this,e).context.get}useParentContext(e){return w(this,j,qt).call(this,e).inherited.get}provideContext(e){return w(this,j,qt).call(this,e).provide}provideGlobalContext(e){if(r(this,ft).has(e))return r(this,ft).get(e).signal;let t=r(this,H).findOrCreateRootContext(e),s=k(),i=t.add(s);return r(this,ft).set(e,{cleanup:i,signal:s}),s}},H=new WeakMap,xt=new WeakMap,ct=new WeakMap,W=new WeakMap,ft=new WeakMap,z=new WeakMap,D=new WeakMap,rt=new WeakMap,F=new WeakMap,zt=new WeakMap,j=new WeakSet,xe=function(e){return r(this,ct).get(e)},gt=new WeakMap,qt=function(e){if(r(this,W).has(e))return r(this,W).get(e);let t=k(),s=k(),i=k(),a=new Re([s,t]),o=_(a,Re.Value,l=>{Di(i,l)}),n={name:e,inherited:t,provide:s,context:i,valuePath:a,unsubscribePathValue:o};return r(this,W).set(e,n),w(this,j,ue).call(this,n),n},ue=function(e){var t,s;if((t=e.unsubscribeFromParent)==null||t.call(e),e.unsubscribeFromParent=void 0,this.parent){let i=w(s=this.parent,j,qt).call(s,e.name),a=et(i.context,e.inherited);e.unsubscribeFromParent=a.destroy.bind(a)}else{let i=r(this,H).findOrCreateRootContext(e.name),a=et(i.value$,e.inherited);e.unsubscribeFromParent=a.destroy.bind(a)}},gs);function xi(e,t){e.indexOf(t)===-1&&e.push(t)}var as=e=>{let t=e.split("@").map(s=>s.trim());if(t.length===2&&t[1])return t[0]?{key:`${t[0]}@${t[1]}`,prop:t[1],token:t[0]}:{key:t[1],prop:t[1]}},le=(e,t)=>{for(let s of t)e.add(s)},zi=(e,t)=>{if(e!=null)for(let s of e.constructors)t.add(s)},at,R,q,ys,Rs=(ys=class{constructor(){g(this,at,new Map);g(this,R,new Map);g(this,q,new Map)}static get(e){return e!=null?e:Fi}define(e,t){r(this,at).has(e)?xi(r(this,at).get(e).constructors,t):r(this,at).set(e,{token:e,constructors:[t]})}appendRoute(e,t){let s=as(e);s?r(this,q).has(s.key)?le(r(this,q).get(s.key).routes,t):r(this,q).set(s.key,{routes:new Set(t),token:s.token}):r(this,R).has(e)?le(r(this,R).get(e),t):r(this,R).set(e,new Set(t))}clearRoute(e){let t=as(e);t?r(this,q).delete(t.key):r(this,R).delete(e)}findTokensByRoute(e,t){let s=new Set([e]),i=r(this,R).has(e)?[...r(this,R).get(e)]:[];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(t){for(let o of t)r(this,q).has(o)&&le(s,r(this,q).get(o).routes);let a;do{a=s.size;for(let o of new Set(s))for(let n of t){let l=`${o}@${n}`;r(this,q).has(l)&&le(s,r(this,q).get(l).routes)}}while(a!==s.size)}return s}findConstructors(e,t){let s=this.findTokensByRoute(e,t),i=new Set;for(let a of s)zi(r(this,at).get(a),i);return i.size>0?Array.from(i):void 0}hasToken(e){return r(this,at).has(e)}hasRoute(e){return r(this,R).has(e)}clear(){r(this,at).clear(),r(this,R).clear()}},at=new WeakMap,R=new WeakMap,q=new WeakMap,ys),Fi=new Rs,st;(function(e){e[e.CreateAndDestroy=0]="CreateAndDestroy",e[e.JustCreate=1]="JustCreate",e[e.DestroyOnly=2]="DestroyOnly"})(st||(st={}));var ns=e=>e.displayName||e.name,E,Q,Ft,se,X,yt,ps,Ni=(ps=class{constructor(e){g(this,E);g(this,Q);g(this,Ft);g(this,se);g(this,X);g(this,yt);this.logger=new Js("Kernel"),c(this,E,new Map),c(this,Q,new Set),c(this,X,!0),c(this,yt,new Map),ot(this),this.registry=Rs.get(e)}getEntity(e){var s;let t=(s=r(this,E).get(e))==null?void 0:s.entity;if(!t)throw new Error(`entity with uuid "${e}" not found!`);return t}hasEntity(e){return r(this,E).has(e)}traverseLevelOrderBFS(e=!1){if(r(this,X)){let t=new Map,s=(i,a)=>{let o=this.getEntity(i);t.has(a)?t.get(a).push(o):t.set(a,[o]);for(let n of o.children)s(n.uuid,a+1)};r(this,Q).forEach(i=>s(i,0)),c(this,Ft,Array.from(t.entries()).sort((i,a)=>i[0]-a[0]).map(([,i])=>i).flat()),c(this,se,r(this,Ft).slice().reverse()),c(this,X,!1)}return e?r(this,se):r(this,Ft)}getEntityGraph(){return Array.from(r(this,Q)).map(e=>this.getEntityGraphNode(e))}getEntityGraphNode(e){if(!r(this,E).has(e))return;let{token:t,entity:s}=r(this,E).get(e);return{token:t,entity:s,props:Object.fromEntries(s.propEntries()),children:s.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,st.DestroyOnly));for(let t of this.traverseLevelOrderBFS(!1))this.updateShadowObjects(t.uuid,st.JustCreate,e.get(t.uuid));e.clear()}run(e){this.logger.isDebug&&this.logger.debug("sync",e),Qt(()=>{for(let t of e.changeTrail)this.parse(t)})}parse(e){switch(e.type){case tt.CreateEntities:this.createEntity(e.uuid,e.token,e.parentUuid,e.order,e.properties),c(this,X,!0);break;case tt.DestroyEntities:this.destroyEntity(e.uuid),c(this,X,!0);break;case tt.SetParent:this.setParent(e.uuid,e.parentUuid,e.order),c(this,X,!0);break;case tt.UpdateOrder:this.updateOrder(e.uuid,e.order),c(this,X,!0);break;case tt.ChangeProperties:this.changeProperties(e.uuid,e.properties);break;case tt.ChangeToken:this.changeToken(e.uuid,e.token);break;case tt.SendEvents:this.dispatchEventsToEntity(e.uuid,e.events);break}}createEntity(e,t,s,i=0,a){let o=new Ri(this,e);o.order=i;let n={token:t,entity:o,usedConstructors:new Map};r(this,E).set(e,n),s&&(o.parentUuid=s),o.hasParent||r(this,Q).add(e),a&&o.setProperties(a),this.createShadowObjects(e)}destroyEntity(e){if(!r(this,E).has(e))return;let{entity:t,usedConstructors:s}=r(this,E).get(e);t.removeFromParent(),C(t,Tt,this),s.clear(),r(this,E).delete(t.uuid),r(this,Q).delete(t.uuid)}setParent(e,t,s=0){let i=this.getEntity(e);i.parentUuid===t&&i.order===s||(i.removeFromParent(),i.order=s,i.parentUuid=t,i.hasParent?r(this,Q).delete(e):r(this,Q).add(e),i.reSubscribeToParentContexts(),queueMicrotask(()=>{this.logger.isDebug&&this.logger.debug("entity.onParentChanged",{uuid:e,parentUuid:t,order:s,entity:i}),C(i,Ti,i)}))}updateOrder(e,t){this.getEntity(e).order=t}dispatchEventsToEntity(e,t){var s;(s=this.getEntity(e))==null||s.dispatchViewEvents(t)}changeProperties(e,t){this.getEntity(e).setProperties(t),this.updateShadowObjects(e)}changeToken(e,t){if(!r(this,E).has(e))return;let s=r(this,E).get(e);s.token!==t&&(s.token=t,this.updateShadowObjects(e))}dispatchMessageToView(e){queueMicrotask(()=>{C(this,Oe,e)})}updateShadowObjects(e,t=st.CreateAndDestroy,s){let i=r(this,E).get(e);s!=null||(s=new Set(this.registry.findConstructors(i.token,i.entity.truthyProps())));let a=t===st.CreateAndDestroy||t===st.DestroyOnly,o=t===st.CreateAndDestroy||t===st.JustCreate;if(a){for(let[n,l]of i.usedConstructors)if(!s.has(n)){i.usedConstructors.delete(n);for(let y of l)this.destroyShadowObject(y,i.entity)}}if(o)for(let n of s)i.usedConstructors.has(n)||this.constructShadowObject(n,i);return s}constructShadowObject(e,t){let s=new Set,i=new Set,a=new Map,o=new Map,n=new Map,l=new Map,y=new Map,v=(h,d)=>{let u=y.get(h);if(u===void 0){u=k(void 0,d?{compare:d}:void 0).get,y.set(h,u);let b=et(t.entity.getPropertyReader(h),u);i.add(b.destroy.bind(b))}return u},m=ot(new e({entity:t.entity,provideContext(h,d,u){let b=n.get(h);if(b==null){let S=_t(d);if(b=k(S?void 0:d,u?{compare:u}:void 0),S){let I=et(d,b);i.add(I.destroy.bind(I))}let T=et(b,t.entity.provideContext(h));i.add(T.destroy.bind(T)),n.set(h,b)}return b},provideGlobalContext(h,d,u){let b=l.get(h);if(b==null){let S=_t(d);if(b=k(S?void 0:d,u?{compare:u}:void 0),S){let I=et(d,b);i.add(I.destroy.bind(I))}let T=et(b,t.entity.provideGlobalContext(h));i.add(T.destroy.bind(T)),l.set(h,b)}return b},useContext(h,d){let u=a.get(h);if(u===void 0){u=k(void 0,d?{compare:d}:void 0).get,a.set(h,u);let b=et(t.entity.useContext(h),u);i.add(b.destroy.bind(b))}return u},useParentContext(h,d){let u=o.get(h);if(u===void 0){u=k(void 0,d?{compare:d}:void 0).get,o.set(h,u);let b=et(t.entity.useParentContext(h),u);i.add(b.destroy.bind(b))}return u},useProperty:v,useProperties(h){let d={};for(let u in h)Object.prototype.hasOwnProperty.call(h,u)&&(d[u]=v(h[u]));return d},createResource(h,d){let u=k(void 0);i.add(()=>$(u));let b=Vt(()=>{let S=h();return u.set(S),S!==void 0&&d?()=>{d(S),u.set(void 0)}:()=>{u.set(void 0)}});return i.add(b.destroy),u},createEffect(...h){let d=Vt(...h);return i.add(d.destroy),d},createSignal(...h){let d=k(...h);return i.add(()=>{$(d)}),d},createMemo(...h){let d=ki(...h);return i.add(()=>{$(d)}),d},on(...h){let d=_(...h);return i.add(d),d},once(...h){let d=M(...h);return i.add(d),d},onDestroy(h){s.add(h)}}));return this.logger.isInfo&&this.logger.info("create shadow-object",ns(e),{shadowObject:m,entity:t.entity}),M(t.entity,Tt,ye.Low,()=>{this.logger.isInfo&&this.logger.info("destroy shadow-object",ns(e),{shadowObject:m,entity:t.entity});for(let d of s)d();for(let d of i)d();for(let d of a.values())$(d);for(let d of o.values())$(d);for(let d of y.values())$(d);for(let d of n.values())$(d);for(let d of l.values())$(d);s.clear(),i.clear(),a.clear(),o.clear(),y.clear(),n.clear(),l.clear();let h=t.usedConstructors.get(e);h&&(h.delete(m),h.size===0&&t.usedConstructors.delete(e))}),t.usedConstructors.has(e)?t.usedConstructors.get(e).add(m):t.usedConstructors.set(e,new Set([m])),this.attachShadowObject(m,t.entity),m}createShadowObjects(e){var s;let t=r(this,E).get(e);(s=this.registry.findConstructors(t.token,t.entity.truthyProps()))==null||s.forEach(i=>{this.constructShadowObject(i,t)})}findShadowObjects(e){if(!r(this,E).has(e))return[];let{usedConstructors:t}=r(this,E).get(e);return Array.from(new Set(Array.from(t.values()).map(s=>Array.from(s)).flat()))}attachShadowObject(e,t){_(t,e),typeof e[rs]=="function"&&e[rs](t)}destroyShadowObject(e,t){typeof e[Tt]=="function"&&e[Tt](t),C(e,Tt,t),V(t,e)}findOrCreateRootContext(e){let t=r(this,yt).get(e);return t||(t=new Re,r(this,yt).set(e,t)),t}destroy(){for(let e of r(this,yt).values())e.dispose();r(this,yt).clear();for(let e of this.traverseLevelOrderBFS().reverse())this.destroyEntity(e.uuid)}},E=new WeakMap,Q=new WeakMap,Ft=new WeakMap,se=new WeakMap,X=new WeakMap,yt=new WeakMap,ps);async function xs(e,t,s,i=!0){var o,n;if(s.has(t)){console.warn("importModule: skipping already imported module",t);return}else s.add(t);t.extends&&await Promise.all(t.extends.map(l=>xs(e,l,s,!1)));let{registry:a}=e;if(t.define)for(let[l,y]of Object.entries(t.define))a.define(l,y);if(t.routes)for(let[l,y]of Object.entries(t.routes))a.appendRoute(l,y);await((n=(o=t.initialize)==null?void 0:o.call(t,{define:(l,y)=>a.define(l,y),kernel:e,registry:a}))!=null?n:Promise.resolve()),i&&e.upgradeEntities()}var Vi=e=>(typeof e=="string"&&(e=new URL(e,globalThis.location.href)),e.toString()),ie,pt,zs,Fs,Ns,vs,Ii=(vs=class{constructor(e){g(this,pt);g(this,ie,new Set);var t,s;this.kernel=(t=e==null?void 0:e.kernel)!=null?t:new Ni,this.postMessage=(s=e==null?void 0:e.postMessage)!=null?s:self.postMessage.bind(self),_(this.kernel,Oe,"onMessageToView",this)}route(e){var t;switch(e.data.type){case $s:w(this,pt,zs).call(this,e.data);break;case Us:w(this,pt,Fs).call(this,e.data);break;case Gs:w(this,pt,Ns).call(this,e.data);break;default:console.warn("[MessageRouter] unknown message",(t=e.data.type)!=null?t:e.data)}}onMessageToView(e){let i=e,{transferables:t}=i,s=Ge(i,["transferables"]);this.postMessage({type:Oe,data:s},{transfer:t})}},ie=new WeakMap,pt=new WeakSet,zs=async function(e){try{let t=await import(Vi(e.importModule));t[Ce]?(await xs(this.kernel,t[Ce],r(this,ie)),this.postMessage({type:we,url:e.importModule})):this.postMessage({type:we,url:e.importModule,error:`module has no "${Ce}" export`})}catch(t){console.error("[MessageRouter] failed to import module",t),this.postMessage({type:we,url:e.importModule,error:`${t}`})}},Fs=function(e){try{this.kernel.run(e)}catch(t){console.error("[MessageRouter] failed to apply change trail",t),this.postMessage({type:Je,serial:e.serial,error:t.toString()})}e.serial&&this.postMessage({type:Je,serial:e.serial})},Ns=function(e){console.debug("[MessageRouter] on destroy",e),V(this.kernel,this),r(this,ie).clear(),this.postMessage({type:Ws})},vs),$i=class{constructor(){this.onmessage=e=>{var t;e.data.type===N?globalThis[x]=e.data.config:((t=this.router)!=null||(this.router=new Ii),this.router.route(e))}}start(){self.addEventListener("message",this.onmessage),self.postMessage({type:Bs})}};console.debug("@spearwolf/shadow-objects/WorkerRuntime: hello!");var Ui=new $i;Ui.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 Ws=()=>new Qe;var $t=(s,t,e=1e3,r)=>new Promise((i,n)=>{let o,h,a=()=>{clearTimeout(o),s.removeEventListener("message",h)};e!==0&&e!==1/0&&(o=setTimeout(()=>{a(),n(new Error(`Timeout waiting for message of type: ${t}`))},e)),h=c=>{if(c.data.type===t)try{(!r||r(c.data))&&(a(),i())}catch(w){a(),n(w.toString())}},s.addEventListener("message",h)});var yr=s=>{let t;if(s!=null&&Array.isArray(s))for(let e of s)e.transferables&&(t?t=[...t,...e.transferables]:t=e.transferables,delete e.transferables);return t},we=class s{static{this.WorkerLoaded="workerLoaded"}#t;#e;#s;get isDestroyed(){return this.#e}get workerLoaded(){return ft(this,s.WorkerLoaded)}constructor(){this.#e=!1,this.#s=0,this.logger=new P("RemoteWorkerEnv"),U(this,s.WorkerLoaded)}async start(){if(this.#t)return this.logger.isWarn&&this.logger.warn("already started"),this.workerLoaded.then(()=>{if(this.isDestroyed)throw"worker was destroyed"});let t=this.#t=Ws();this.configureConsoleLogger(t);try{if(await $t(t,ms,Cs),this.isDestroyed)throw"worker was destroyed";t.addEventListener("message",this.onMessageFromWorker.bind(this)),queueMicrotask(()=>{f(this,s.WorkerLoaded,this)})}catch(e){throw this.logger.error("failed to start",e),this.#t=void 0,e}}applyChangeTrail(t,e){let r=yr(t),i={type:gs,changeTrail:t},n=++this.#s;return e&&(i.serial=n),this.#t.postMessage(i,r),e?$t(this.#t,bs,Ss,o=>{if(o.error)throw o.error;return o.serial===n}):Promise.resolve()}importScript(t){return t=be(t),this.#t.postMessage({type:ps,importModule:t}),$t(this.#t,vs,Es,e=>{if(e.error)throw e.error;return e.url===t})}destroy(){if(!this.#t)return;let t=this.#t;this.#t=void 0,this.#e=!0,t.postMessage({type:ys}),$t(t,ws,xs).finally(()=>{t.terminate()})}onMessageFromWorker(t){t.data?.type===mt?this.onMessageToView?.(t.data.data):this.logger.isDebug&&this.logger.debug("message from worker",t)}configureConsoleLogger(t){let e=`${N}.RemoteWorkerEnv.workerConfig`,r=JSON.parse(localStorage.getItem(e)??"{}");this.logger.isInfo&&this.logger.info("load console-logger worker config",{localStorageKey:e,workerConfig:r}),t.postMessage({type:N,config:{...P.sharedConfig,enable:this.logger.isEnabled,...r,...P.isEnabled?{}:{enable:!1}}})}};var It,Ft=class extends et{static{this.observedAttributes=[...et.observedAttributes,oe,"src",ae]}static{this.DefaultAutoSync="frame"}#t;#e;#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(It.DefaultAutoSync),this.src$=d(""),this.#t=!1,this.#e=!1,this.ns$.onChange(t=>{this.shadowEnv.view=D.get(t)}),y(this.shadowEnv,F.ContextCreated,()=>{this.#r?.run(),this.dispatchEvent(new CustomEvent(F.ContextCreated.toLowerCase(),{bubbles:!1,detail:{shadowEnv:this.shadowEnv}}))}),y(this.shadowEnv,F.ContextLost,()=>{this.dispatchEvent(new CustomEvent(F.ContextLost.toLowerCase(),{bubbles:!1,detail:{shadowEnv:this.shadowEnv}}))}),this.autoSync$.onChange(t=>{let e=this.hasAttribute(W),r=e?this.getAttribute(W):void 0;t===It.DefaultAutoSync?e&&r!==t&&this.setAttribute(W,t):r!==t&&this.setAttribute(W,t)}),this.#a(),this.#n(),this.style.display="contents"}#n(){this.#r=v(()=>{let t=this.src$.get();t&&this.importScript(t)},{autorun:!1})}get shouldAutostart(){return this.autostart&&!_t(this,Ls)}get autoSync(){return this.autoSync$.value}set autoSync(t){typeof t!="string"&&(t=t?It.DefaultAutoSync:"no"),this.autoSync$.set(`${t}`.trim().toLowerCase())}get frameLoop(){return this.#s??=new bt,this.#s}[bt.OnFrame](){this.syncShadowObjects()}async importScript(t){if(!t)throw new Error("src is blank");let e=await this.shadowEnv.ready();return this.logger.isInfo&&this.logger.info("shadowEnv importScript:",t,{shadowEnv:e}),await e.envProxy.importScript(t),this}connectedCallback(){O(()=>{this.hasAttribute(W)&&this.autoSync$.set(this.getAttribute(W)),this.isConnected$.set(!0)}),this.shouldAutostart&&this.start()}disconnectedCallback(){this.isConnected$.set(!1),this.#o()}attributeChangedCallback(t){if(super.attributeChangedCallback(t),t===oe&&this.shadowEnv.envProxy!=null)throw new Error('Changing the "local" attribute after the shadowEnv has been created is not supported.');if(t===ae&&this.#h(),t===W&&(this.autoSync=this.hasAttribute(W)?this.getAttribute(W):!0),t==="src"){let e=(this.getAttribute("src")||"").trim();this.src$.set(e),this.shadowEnv.isReady&&this.#r?.run()}}start(){if(!this.#e){if(this.#t=!1,this.shadowEnv.view??=D.get(this.ns),this.shadowEnv.envProxy==null){let t=_t(this,oe)?new ve:new we;this.shadowEnv.envProxy=t,this.#h()}this.#e=!0}return this.shadowEnv.ready()}destroy(){this.#i?.destroy(),this.#r?.destroy(),k(this.isConnected$,this.autoSync$,this.src$),this.shadowEnv.envProxy=void 0,this.shadowEnv.destroy()}#o(){this.#t||(this.#t=!0,queueMicrotask(()=>{this.#t&&this.destroy()}))}#a(){this.#i=v(()=>{if(this.isConnected$.get()){let t=(this.autoSync$.get()||It.DefaultAutoSync).trim().toLowerCase(),e;if(["true","yes","on","frame","auto-sync"].includes(t))return this.logger.isDebug&&this.logger.debug("auto-sync",t,this),this.frameLoop.start(this),()=>{this.frameLoop.stop(this)};if(t.toLowerCase().endsWith("fps")){let r=parseInt(t,10);r>0?e=Math.floor(1e3/r):this.logger.isWarn&&this.logger.warn(`invalid auto-sync value: ${t}`)}else e=parseInt(t,10),isNaN(e)&&(e=void 0,["false","no","off"].includes(t)||this.logger.error(`invalid auto-sync value: ${t}`));if(e!==void 0&&e>0){this.logger.isDebug&&this.logger.debug("auto-sync interval (ms)",e,this);let r=setInterval(()=>{this.syncShadowObjects()},e);return()=>{clearInterval(r)}}else this.logger.isDebug&&this.logger.debug("auto-sync off",this)}},[this.autoSync$,this.isConnected$])}#h(){let t=this.shadowEnv.envProxy;t?.isLocalEnv&&(t.disableStructuredClone=this.hasAttribute(ae))}};It=Ft;customElements.define(Rs,Ft);globalThis.SHADOW_ENTS_BUNDLE_LOADED=!0;
21
+ var it="*",ts=1,ke=2,Ae=4,V=Symbol.for("eventize"),Us="[eventize]",zt=s=>s===it,es=s=>{switch(typeof s){case"string":case"symbol":return!0;default:return!1}},ss=typeof console<"u",Gs=ss?console[console.warn?"warn":"log"].bind(console,Us):()=>{},Bs=(s,t,e)=>(Object.defineProperty(s,t,{value:e,configurable:!0}),s),qs=0,rs=class{static publish(s){s.sort((t,e)=>t.order-e.order).forEach(t=>t.emit())}events=new Map;eventNames=new Set;add(s){Array.isArray(s)?s.forEach(t=>this.eventNames.add(t)):this.eventNames.add(s)}remove(s){Array.isArray(s)?s.forEach(t=>this.eventNames.delete(t)):this.eventNames.delete(s),this.clear(s)}clear(s){Array.isArray(s)?s.forEach(t=>this.events.delete(t)):this.events.delete(s)}retain(s,t){this.eventNames.has(s)&&this.events.set(s,{args:t,order:qs++})}isKnown(s){return this.eventNames.has(s)}emit(s,t,e=[]){if(zt(s))this.eventNames.forEach(r=>this.emit(r,t,e));else if(this.events.has(s)){let{order:r,args:i}=this.events.get(s);e.push({order:r,emit:()=>t.apply(s,i)})}return e}},Se=(s,t,e,r)=>{if(typeof t=="function"){let i=t.apply(s,e);i!=null&&r?.(i)}},Hs=(s,t,e,r)=>Se(t,t.emit,[s].concat(e),r),Qs=s=>{switch(typeof s){case"function":return ts;case"string":case"symbol":return ke;case"object":return Ae}},Ys=0,Ks=()=>++Ys,is=class{id;eventName;isCatchEmAll;priority;listener;listenerObject;listenerType;callAfterApply;isRemoved;refCount;constructor(s,t,e,r=null){this.id=Ks(),this.eventName=s,this.isCatchEmAll=zt(s),this.listener=e,this.listenerObject=r,this.priority=t,this.listenerType=Qs(e),this.callAfterApply=void 0,this.isRemoved=!1,this.refCount=1}isEqual(s,t=null){if(s===this)return!0;let e=typeof s;return e==="number"&&s===this.id?!0:t===null&&(e==="string"||e==="symbol")?s===it||s===this.eventName:this.listener===s&&this.listenerObject===t}apply(s,t,e){if(this.isRemoved)return;let{listener:r,listenerObject:i}=this;switch(this.listenerType){case ts:Se(i,r,t,e),this.callAfterApply&&this.callAfterApply();break;case ke:Se(i,i[r],t,e),this.callAfterApply&&this.callAfterApply();break;case Ae:{let n=r[s];if(this.isCatchEmAll||this.eventName===s){if(typeof n=="function"){let o=n.apply(r,t);o!=null&&e?.(o)}else Hs(s,r,t,e);this.callAfterApply&&this.callAfterApply()}break}}}},Js=(s,t)=>s.priority!==t.priority?t.priority-s.priority:s.id-t.id,Je=s=>s?.slice(0),Ze=(s,t)=>{let e=s.indexOf(t);e>-1&&s.splice(e,1)},Zs=s=>s===Ae||s===ke,xe=(s,t,e)=>{let r=s.findIndex(i=>i.isEqual(t,e));r>-1&&(s[r].isRemoved=!0,s.splice(r,1))},Ft=(s,t,e)=>{let r=[];for(let i of s)(t==null&&i.listenerObject===e||i.eventName===t&&i.listener===e)&&r.push(i);for(let i of r)xe(s,i,void 0)},Ee=s=>{s&&(s.forEach(t=>{t.isRemoved=!0}),s.length=0)},Xs=(s,t)=>s.listenerType===t.listenerType?s.priority===t.priority&&s.eventName===t.eventName&&s.listenerObject===t.listenerObject&&s.listener===t.listener:!1,tr=(s,t)=>{if(Zs(s.listenerType))return t.find(e=>Xs(s,e))},er=(s,t)=>{let e=tr(s,t);return e?(e.refCount+=1,e):(t.push(s),t.sort(Js),s)},sr=class{namedListeners;catchEmAllListeners;getListenersForEventName=s=>{let t=this.namedListeners.get(s);return t||(t=[],this.namedListeners.set(s,t)),t};constructor(){this.namedListeners=new Map,this.catchEmAllListeners=[]}add(s){return er(s,s.isCatchEmAll?this.catchEmAllListeners:this.getListenersForEventName(s.eventName))}remove(s,t,e=!1){t==null&&Array.isArray(s)?s.forEach(r=>this.remove(r,null,e)):s==null||t==null&&zt(s)?this.removeAllListeners():t==null&&es(s)?Ee(this.namedListeners.get(s)):s instanceof is?s.isRemoved||(s.refCount-=1,s.refCount<1&&(s.isRemoved=!0,this.namedListeners.forEach(r=>Ze(r,s)),Ze(this.catchEmAllListeners,s))):e?zt(s)&&typeof s=="object"?Ft(this.catchEmAllListeners,it,s):this.namedListeners.forEach(r=>Ft(r,s,t)):(this.namedListeners.forEach(r=>{xe(r,s,t),typeof s=="object"&&Ft(r,void 0,s)}),xe(this.catchEmAllListeners,s,t),typeof s=="object"&&Ft(this.catchEmAllListeners,void 0,s))}removeAllListeners(){this.namedListeners.forEach(s=>Ee(s)),this.namedListeners.clear(),Ee(this.catchEmAllListeners)}forEach(s,t){let e=Je(this.catchEmAllListeners),r=Je(this.namedListeners.get(s));if(s===it||!r||r.length===0)e.forEach(t);else if(e.length===0)r.forEach(t);else{let i=r.length,n=e.length,o=0,h=0;for(;o<i||h<n;){if(o<i){let a=r[o];if(h>=n||a.priority>=e[h].priority){t(a),++o;continue}}h<n&&(t(e[h]),++h)}}}getSubscriptionCount(){let s=this.catchEmAllListeners.length;for(let t of this.namedListeners.values())s+=t.length;return s}},nt=s=>!!(s&&s[V]);function Et(s){if(nt(s))return s;let t=new sr,e=new rs;return Bs(s,V,{keeper:e,store:t}),s}var U={Max:Number.POSITIVE_INFINITY,AAA:1e9,BB:1e6,C:1e3,Default:0,Low:-1e4,Min:Number.NEGATIVE_INFINITY},rr=(s,t,e,r,i,n,o)=>{let h=s.add(new is(e,r,i,n));return t.emit(e,h,o),h},ir=(s,t,e,r)=>{let i=e.length,n=typeof e[0],o,h,a,c;if(i>=2&&i<=3&&n==="number"?(o=it,[h,a,c]=e):i>=3&&i<=4&&typeof e[1]=="number"?[o,h,a,c]=e:(h=U.Default,n==="string"||n==="symbol"||Array.isArray(e[0])?[o,a,c]=e:(o=it,[a,c]=e)),!a&&ss)throw Gs("called with insufficient arguments!",e),"subscribeTo() called with insufficient arguments!";let w=b=>u=>rr(s,t,u,b,a,c,r);return Array.isArray(o)?o.map(b=>Array.isArray(b)?w(b[1])(b[0]):w(h)(b)):w(h)(o)},ns=(s,t,e)=>{let r=[],i=ir(s,t,e,r);return rs.publish(r),i},Xe=s=>t=>{t.callAfterApply=()=>{s?.()}},os=(s,t)=>Object.assign(()=>S(s,t),Array.isArray(t)?{listeners:t}:{listener:t}),as=(s,t,e,r)=>{let{store:i,keeper:n}=s[V];Array.isArray(t)?t.forEach(o=>{i.forEach(o,h=>h.apply(o,e,r)),n.retain(o,e)}):t!==it&&(i.forEach(t,o=>{o.apply(t,e,r)}),n.retain(t,e))},y=(s,...t)=>{let e=Et(s),{store:r,keeper:i}=e[V];return os(e,ns(r,i,t))},E=(s,...t)=>{let e=Et(s),{store:r,keeper:i}=e[V],n=ns(r,i,t),o=os(e,n),h=!1,a=()=>{h||(o(),h=!0)};return Array.isArray(n)?n.forEach(Xe(a)):Xe(a)(n),a},ft=(s,t)=>new Promise(e=>{E(s,t,e)}),S=(s,t,e)=>{if(!nt(s))throw new Error("object is not eventized");let{store:r,keeper:i}=s[V],n=typeof t,o=e!=null&&(n==="string"||n==="symbol");r.remove(t,e,o),Array.isArray(t)?i.remove(t.filter(h=>typeof h=="string")):es(t)&&i.remove(t)},p=(s,t,...e)=>{if(!nt(s))throw new Error("object is not eventized");as(s,t,e)},nr=(s,t,...e)=>{if(!nt(s))throw new Error("object is not eventized");let r=[];return as(s,t,e,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,t)=>{let e=Et(s),{keeper:r}=e[V];r.add(t)},K=(s,t)=>{if(!nt(s))throw new Error("object is not eventized");let{keeper:e}=s[V];e.clear(t)},k=(()=>{let s=(t={})=>Et(t);return s.inject=(t={})=>(t=Et(t),Object.assign(t,{on:(...e)=>y(t,...e),once:(...e)=>E(t,...e),onceAsync:e=>ft(t,e),off:(e,r)=>S(t,e,r),emit:(e,...r)=>p(t,e,...r),emitAsync:(e,...r)=>nr(t,e,...r),retain:e=>G(t,e),retainClear:e=>K(t,e)}),t),s.is=nt,s})();var Te=s=>nt(s)?s[V]?.store?.getSubscriptionCount()??0:0;var L=Symbol.for("signal"),ot=Symbol.for("effect"),Oe=Symbol.for("destroySignal"),Pe=Symbol.for("createEffect"),hs=Symbol.for("destroyEffect"),pt="value",Re="mute",Me="unmute",J="destroy",at=Symbol.for("recall");var ht=k(),I=k(),B=k(),Vt=k();var lt=class{static current;delayedEffects=[];batch(t,e){let r=this.delayedEffects.length;for(let i=0;i<r;i++){let[n,o]=this.delayedEffects[i];if(!(n>e))if(n===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=[y(B,(i,n)=>{n===at&&t.add(i)}),y(Vt,i=>{t.add(i)})],r=this.delayedEffects.flatMap(([,i])=>Array.from(i));for(let i of r)t.has(i)||p(B,i,i,at);e.forEach(i=>{i()})}},ls=()=>lt.current;function O(s){let t=lt.current;t?t=void 0:t=lt.current=new lt;try{s()}finally{t&&(lt.current=void 0,t.run())}}var Le=0;function je(s){Le++;try{s()}finally{Le--}}function Ut(){return Le>0}var Gt=class{[ot];constructor(t){this[ot]=t,E(t,gt.Destroy,()=>{this[ot]=void 0})}run=()=>this[ot]?.run();destroy=()=>{this[ot]?.destroy(),this[ot]=void 0}};var Z=new Map,j=class s{#t=new Set;#e=new Set;#s=new Map;#i=new WeakMap;#r=new Map;#n=new Set;#o=new Set;#a;#h;static get(t){if(t!=null)return t instanceof s?t:Z.get(t)}static findOrCreate(t){if(t==null)throw new Error("Cannot create a group with a null object");return new s(t)}static destroy(t){console.warn("SignalGroup.destroy(obj) is deprecated. Use SignalGroup.delete(obj) instead."),s.delete(t)}static delete(t){Z.get(t)?.clear()}static clear(){for(let t of Z.values())t.destroy();Z.clear()}constructor(t){if(t!=null&&t instanceof s)return t;if(t??=this,Z.has(t))return Z.get(t);this.#h=t,Z.set(t,this),k(this)}attachGroup(t){if(t===this)throw new Error("Cannot attach a group to itself");return this.#t.add(t),t.#a&&t.#a!==this&&t.#a.#t.delete(t),t.#a=this,t}detachGroup(t){return t!==this&&this.#t.has(t)&&(this.#t.delete(t),t.#a=void 0),t}attachSignal(t){let e=C(t);if(e?.destroyed)throw new Error("Cannot attach a destroyed signal to a group");return e&&this.#e.add(e),t}attachSignalByName(t,e){if(e){this.attachSignal(e);let r=C(e);this.#s.set(t,r),this.#r.has(t)?this.#r.get(t).push(r):this.#r.set(t,[r]),this.#i.has(r)?this.#i.get(r).add(t):this.#i.set(r,new Set([t]))}else this.#s.delete(t);return e}hasSignal(t){return this.#s.has(t)||!!this.#a?.hasSignal(t)}signal(t){return this.#s.get(t)?.object??this.#a?.signal(t)}detachSignal(t){let e=C(t);if(e&&(this.#e.delete(e),this.#i.has(e))){let r=this.#i.get(e);for(let i of r)if(this.#r.has(i)){let n=this.#r.get(i);n.splice(n.indexOf(e),1),n.length===0?(this.#s.delete(i),this.#r.delete(i)):this.#s.get(i)===e&&this.#s.set(i,n.at(-1))}r.clear(),this.#i.delete(e)}return t}attachEffect(t){return this.#n.add(t),t}runEffects(){for(let t of this.#n)t.run();for(let t of this.#t)t.runEffects()}attachLink(t){if(t?.isDestroyed)throw new Error("Cannot attach a destroyed link to a group");return t&&this.#o.add(t),t}detachLink(t){return t&&this.#o.delete(t),t}destroy(){console.warn("SignalGroup#destroy is deprecated. Use SignalGroup#clear instead."),this.clear()}clear(){p(this,J,this),S(this);for(let t of this.#t)t.destroy();for(let t of this.#n)t.destroy();for(let t of this.#e)A(t);for(let t of this.#o)t.destroy();this.#t.clear(),this.#e.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 yt=class{#t;#e;constructor(t="id",e=1){this.#t=t,this.#e=e}make(){return Symbol(`${this.#t}${this.#e++}`)}};var _e=[],Bt=()=>_e.at(-1),us=(s,t)=>{_e.push(s);try{return t()}finally{_e.pop()}};var or=s=>s!=null&&typeof s.then=="function",gt=class s{static idGen=new yt("ef");static Destroy="destroy";static count=0;id;callback;#t;#e=new Set;#s=new Set;#i=new Map;#r=new Set;parentEffect;childEffects=[];curChildEffectSlot=0;autorun=!0;shouldRun=!0;priority;#n;#o=!1;constructor(t,e){k(this),this.callback=t;let r;e?.attach!=null&&(r=j.findOrCreate(e.attach),r.attachEffect(this)),this.autorun=e?.autorun??!0,this.#n=e?.dependencies?e.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=e?.priority??0,y(B,this.id,at,this),++s.count}hasStaticDeps(){return this.#n!=null&&this.#n.length>0}saveSignalsFromDeps(){for(let t of this.#n)this.whenSignalIsRead(C(t).id)}static createEffect(t,e,r){let i=Array.isArray(e)?e:void 0,n=i?r??{dependencies:i}:e;n&&i&&(n.dependencies=i);let o,h=Bt();return h!=null?(o=h.getCurrentChildEffect(),o==null&&(o=new s(t,n),h.attachChildEffect(o),p(B,Pe,o)),h.curChildEffectSlot++):(o=new s(t,n),p(B,Pe,o)),o.hasStaticDeps()?o.saveSignalsFromDeps():o.autorun&&o.run(),new Gt(o)}getCurrentChildEffect(){return this.childEffects[this.curChildEffectSlot]}attachChildEffect(t){this.childEffects.push(t),this.parentEffect=this}run=()=>{if(this.#o||!this.shouldRun)return;let t=ls();t?t.batch(this.id,this.priority):(this.runCleanupCallback(),this.curChildEffectSlot=0,this.shouldRun=!1,p(Vt,this.id,this.id),this.hasStaticDeps()?this.#t=this.callback():(this.#s=new Set(this.#e),this.#t=us(this,this.callback),this.cleanupLostSignals(),this.#r.clear()))};[at](){this.shouldRun=!0,this.autorun&&this.run()}whenSignalIsRead(t){this.#s.delete(t),this.#e.has(t)||(this.#e.add(t),this.#i.set(t,[y(ht,t,this.priority,at,this),E(I,t,Oe,this)]))}[Oe](t){!this.#r.has(t)&&this.#e.has(t)&&(this.#r.add(t),this.unsubscribeSignal(t),this.#r.size===this.#e.size&&this.destroy())}cleanupLostSignals(){for(let t of this.#s)this.unsubscribeSignal(t),this.#e.delete(t)}unsubscribeSignal(t){this.#i.has(t)&&(this.#i.get(t).forEach(e=>{e()}),this.#i.delete(t))}runCleanupCallback(){if(this.#t!=null){let t=this.#t;this.#t=void 0,or(t)?Promise.resolve(t).then(e=>{typeof e=="function"&&e()}):t()}}destroy=()=>{this.#o||(p(this,s.Destroy,this),S(this),p(B,hs,this),this.runCleanupCallback(),S(ht,this),S(B,this),S(I,this),this.#o=!0,this.#e.clear(),this.#s.clear(),this.#i.clear(),this.#r.clear(),this.childEffects.forEach(t=>{t.destroy()}),this.childEffects.length=0,--s.count)}};var v=(...s)=>gt.createEffect(...s);var St=new WeakMap,ar=s=>{let t=St.get(s);return t||(t={},St.set(s,t)),t},R=(s,t)=>St.get(s)?.signals?.get(t);var cs=(s,t,e)=>{let r=ar(s);r.signals??=new Map,r.signals.set(t,e)};function xt(...s){for(let t of s)if(St.has(t)){let e=St.get(t);if(e.signals){for(let r of e.signals.values())A(r);e.signals.clear(),e.signals=void 0}}}function ds(s){let t=C(q(s)?s:R(...s));t!=null&&!t.muted&&!t.destroyed&&qt(t.id,t.value,{touch:!0})}function ut(s){return q(s)?C(s)?.value:C(R(...s))?.value}var Ht=class{[L];constructor(t){this[L]=t}get get(){return this[L].reader}get set(){return this[L].writer}get value(){return ut(this.get)}set value(t){this.set(t)}onChange(t){let{destroy:e}=v(()=>t(this.value),[this.get]);return e}get muted(){return this[L].muted}set muted(t){this[L].muted=t}touch(){ds(this)}destroy(){A(this)}};var hr=new yt("si");function fs(s){Ut()||Bt()?.whenSignalIsRead(s)}function qt(s,t,e){Ut()||p(ht,s,t,e)}var q=s=>s!=null&&s[L]!=null,lr=s=>{let t=e=>(e?v(()=>(s.destroyed||fs(s.id),e(s.value)),[t]):s.destroyed||(s.beforeRead?.(),fs(s.id)),s.value);return Object.defineProperty(t,L,{value:s}),t},Qt=class s{static instanceCount=0;id;lazy;get[L](){return this}compare;beforeRead;muted=!1;destroyed=!1;#t=void 0;get value(){return this.lazy&&(this.#t=this.valueFn(),this.valueFn=void 0,this.lazy=!1),this.#t}set value(t){this.#t=t}valueFn;reader;writer=(t,e)=>{let r=e?.lazy??!1,n=e?.compare??this.compare??((h,a)=>h===a);if((r!==this.lazy||r&&t!==this.valueFn||!r&&!n(t,this.#t))&&(r?(this.#t=void 0,this.valueFn=t,this.lazy=!0):(this.#t=t,this.valueFn=void 0,this.lazy=!1),!this.muted&&!this.destroyed)){qt(this.id,this.#t);return}(e?.touch??!1)&&qt(this.id,this.#t,{touch:!0})};object;constructor(t,e){this.id=hr.make(),++s.instanceCount,this.lazy=t,this.lazy?(this.value=void 0,this.valueFn=e):(this.value=e,this.valueFn=void 0),this.reader=lr(this),this.object=new Ht(this)}},C=s=>s?.[L];function f(s=void 0,t){let e;if(q(s))e=C(s);else{let r=t?.lazy??!1;e=new Qt(r,s),e.beforeRead=t?.beforeRead,e.compare=t?.compare}return t?.attach!=null&&j.findOrCreate(t.attach).attachSignal(e),e.object}var A=(...s)=>{for(let t of s){let e=C(t);e!=null&&!e.destroyed&&(e.destroyed=!0,e.beforeRead=void 0,--Qt.instanceCount,p(I,e.id,e.id))}};function De(s,t){let e=f(),r=t?.attach!=null?j.findOrCreate(t.attach):void 0;r!=null&&(t?.name?r.attachSignalByName(t.name,e):r.attachSignal(e));let i=v(()=>{O(()=>{e.set(s())})},{autorun:!(t?.lazy??!1),priority:t?.priority??U.C,attach:r}),n=C(e);return n.beforeRead=i.run,E(I,n.id,i.destroy),e.get}var Yt=class{#t=!1;#e;source;lastValue;isDestroyed=!1;constructor(t){k(this),this.source=C(t),this.#e=y(ht,this.source.id,(e,r)=>{!this.#t&&!this.isDestroyed&&(r?.touch===!0?this.touch():this.write())}),E(I,this.source.id,()=>this.destroy())}attach(t){let e=j.findOrCreate(t);return e.attachLink(this),E(this,J,()=>{e.detachLink(this)}),e}nextValue(){return new Promise((t,e)=>{let r=[],i=()=>r.forEach(n=>{n()});r.push(E(this,pt,n=>{i(),t(n)}),E(this,J,()=>{i(),e()}))})}async*asyncValues(t){let e=0;for(;!this.isDestroyed;)try{let r=await this.nextValue();if(t&&t(r,e++))break;G(this,pt),yield r}catch{break}K(this,pt)}destroy(){this.isDestroyed||(this.#e?.(),this.#e=void 0,p(this,J,this),K(this,pt),S(this),this.lastValue=void 0,this.isDestroyed=!0,Object.freeze(this))}get isMuted(){return this.#t}mute(){return!this.isDestroyed&&!this.#t&&(this.#t=!0,p(this,Re,this)),this}unmute(){return!this.isDestroyed&&this.#t&&(this.#t=!1,p(this,Me,this)),this}toggleMute(){return this.isDestroyed||(this.#t=!this.#t,p(this,this.#t?Re:Me,this)),this.#t}updateValue(t){if(!this.#t&&!this.isDestroyed){let{value:e}=this.source;t(e),p(this,pt,e),this.lastValue=e}}},Kt=class extends Yt{target;constructor(t,e){super(t),this.target=C(e),E(I,this.target.id,()=>this.destroy()),this.touch()}touch(){return this.updateValue(t=>{this.target.writer(t,{touch:!0})}),this}write(){this.updateValue(t=>{this.target.writer(t)})}},Jt=class extends Yt{target;constructor(t,e){super(t),this.target=e,this.touch()}touch(){return this.updateValue(t=>{this.target(t)}),this}write(){this.updateValue(t=>{this.target(t)})}};var Zt=new Map;function M(s,t,e){let r=C(s),i;if(Zt.has(r)){i=Zt.get(r);let c=C(t)??t;if(i.has(c))return i.get(c)}else i=new Map,Zt.set(r,i);let n=C(t),o=n!=null?new Kt(s,n):new Jt(s,t),h=e?.attach;h&&o.attach(h);let a=n??t;return i.set(a,o),E(o,J,()=>{i.delete(a),i.size===0&&Zt.delete(r)}),o}var Xt=class s{static fromProps(t,e){let r=new s,i=e?e.map(n=>[n,t[n]]):Object.entries(t);for(let[n,o]of i)r.#t.set(n,f(o));return r}#t=new Map;keys(){return this.#t.keys()}signals(){return this.#t.values()}entries(){return this.#t.entries()}clear(){for(let t of this.#t.values())t.destroy();this.#t.clear()}has(t){return this.#t.has(t)}get(t){if(!this.#t.has(t)){let e=f();return this.#t.set(t,e),e}return this.#t.get(t)}update(t){t.size&&O(()=>{for(let[e,r]of t.entries())this.get(e).set(r)})}updateFromProps(t,e){O(()=>{let r=e?e.map(i=>[i,t[i]]):Object.entries(t);for(let[i,n]of r)this.get(i).set(n)})}};var W;(function(s){s[s.StructuralChanges=1]="StructuralChanges",s[s.ContentUpdates=2]="ContentUpdates",s[s.Removal=3]="Removal"})(W||(W={}));var m;(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"})(m||(m={}));var ct=Symbol.for("ShadowEntsGlobalNS"),H="#void",ps="contextLost",gs="configure",ys="changeTrail",ms="destroy",bs="loaded",vs="appliedChangeTrail",ws="importedModule",Cs="destroyed",mt="messageToView",Es=6e4,Ss=6e4,xs=5e3,ks=5e3,Ne="shadowObjects";function As(s,t){s.indexOf(t)===-1&&s.push(t)}function $e(s,t){let e=s.indexOf(t);e!==-1&&s.splice(e,1),s.push(t)}function X(s,t){let e=s.indexOf(t);e!==-1&&s.splice(e,1)}var dt=s=>typeof s=="string"?s.trim()||ct:typeof s=="symbol"?s:ct;var kt="#root",At=class{#t;get uuid(){return this.#t}#e=0;constructor(t){this.#t=t}#s=!0;#i=0;#r=0;hasChanges(){return this.#e>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(t=H,e,r=0){this.#e++,this.#i++,this.#h=t,this.#l=e??kt,this.#u=r||void 0}destroy(){this.#r++,this.#e++}clear(){this.#e=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(t){t===this.#n?this.#h=void 0:(this.#h=t,this.#e++)}setParent(t){t===this.#o?this.#l=void 0:(this.#l=t??kt,this.#e++)}changeOrder(t){t===this.#a?this.#u=void 0:(this.#u=t,this.#e++)}#c=new Map;#d=new Map;#f=[];changeProperty(t,e,r){let i=this.#c.get(t);r==null&&e!==i||r!=null&&!r(e,i)?(this.#d.set(t,e),$e(this.#f,t),this.#e++):(this.#d.delete(t),X(this.#f,t))}removeProperty(t){let e=this.#c.has(t);this.#d.has(t)?(this.#d.delete(t),e||X(this.#f,t)):e&&($e(this.#f,t),this.#e++)}#g=[];#p=new Set;createEvent(t,e,r){this.#g.push({type:t,data:e}),r?.forEach(i=>this.#p.add(i)),this.#e++}transferEventsTo(t){this.#g.length>0&&(t.#g.push(...this.#g),this.#g.length=0),this.#p.size>0&&(t.#p=new Set([...t.#p,...this.#p]),this.#p.clear())}buildChangeTrail(t,e){let{isNew:r,isCreated:i,isDestroyed:n}=this;if(!(r&&n))switch(e){case W.StructuralChanges:r?t.push(this.makeCreateEntityChange()):n||(this.#l!==void 0&&!(this.#l===kt&&this.#o===void 0)?t.push(this.makeSetParentChange()):this.#u!==void 0&&this.#u!==this.#a&&t.push(this.makeUpdateOrderChange()),this.#h!==void 0&&this.#h!==this.#n&&t.push(this.makeChangeToken()));break;case W.ContentUpdates:!r&&i&&this.#f.length>0&&t.push(this.makeChangePropertyChange()),this.#g.length>0&&t.push(this.makeEvents());break;case W.Removal:n&&t.push(this.makeDestroyEntityChange());break}}makeEvents(){let t={type:m.SendEvents,uuid:this.#t,events:this.#g.slice(0)};return this.#p.size>0&&(t.transferables=Array.from(this.#p)),t}makeCreateEntityChange(){let t={type:m.CreateEntities,uuid:this.#t,token:this.#h};if(this.#n=this.#h,this.#l!==void 0){let e=this.#l===kt?void 0:this.#l;this.#o=e,e!==void 0&&(t.parentUuid=e)}return this.#d.size>0&&(t.properties=Array.from(this.#d.entries()).filter(([,e])=>e!==void 0),t.properties.forEach(([e,r])=>this.#c.set(e,r))),this.#u!==void 0&&this.#u!==this.#a&&(t.order=this.#a=this.#u),t}makeDestroyEntityChange(){return{type:m.DestroyEntities,uuid:this.#t}}makeSetParentChange(){this.#o=this.#l===kt?void 0:this.#l;let t={type:m.SetParent,uuid:this.#t,parentUuid:this.#o};return this.#u!==void 0&&this.#u!==this.#a&&(t.order=this.#a=this.#u),t}makeUpdateOrderChange(){return this.#a=this.#u??0,{type:m.UpdateOrder,uuid:this.#t,order:this.#a}}makeChangeToken(){return this.#n=this.#h??H,{type:m.ChangeToken,uuid:this.#t,token:this.#n}}makeChangePropertyChange(){let t=this.#f.map(e=>{if(this.#d.has(e)){let r=this.#d.get(e);return this.#c.set(e,r),[e,r]}else return this.#c.delete(e),[e,void 0]});return{type:m.ChangeProperties,uuid:this.#t,properties:t}}};var Ts=s=>{if(!(s===void 0||s.length===0))return s.filter(t=>t.length===1||t[1]!==void 0)},Ie=(s,t)=>{if(s===t||t===void 0)return s;if(s===void 0)return Ts(t);for(let[e,r]of t){let i=s.find(([n])=>n===e);i===void 0?s.push([e,r]):i[1]=r}return Ts(s)};var te=class{#t=new Map;get[Symbol.iterator](){return this.#t.entries.bind(this.#t)}clear(){this.#t.clear()}isEmpty(){return this.#t.size===0}hasComponentState(t){return this.#t.has(t)}getComponentState(t){return this.#t.get(t)}write(t){for(let e of t)if(e.type===m.CreateEntities)this.createEntity(e);else if(this.#t.has(e.uuid))switch(e.type){case m.DestroyEntities:this.destroyEntity(e);break;case m.SetParent:this.setParent(e);break;case m.UpdateOrder:this.updateOrder(e);break;case m.ChangeToken:this.changeToken(e);break;case m.ChangeProperties:this.changeProperties(e);break}}changeProperties({uuid:t,properties:e}){let r=this.getComponentState(t);r.properties=Ie(r.properties,e)}changeToken({uuid:t,token:e}){this.getComponentState(t).token=e||H}updateOrder({uuid:t,order:e}){this.getComponentState(t).order=e??0}setParent({uuid:t,parentUuid:e,order:r}){let i=this.getComponentState(t);i.parentUuid=e,i.order=r??0}destroyEntity({uuid:t}){this.#t.delete(t)}createEntity({uuid:t,token:e,parentUuid:r,order:i,properties:n}){this.#t.set(t,{token:e||H,parentUuid:r,order:i??0,properties:Ie(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(t){let e=dt(t),r=s.getContextsMap();return r.has(e)?r.get(e):new s(e)}#t=new Map;#e=[];#s=new te;constructor(t=ct){let e=dt(t),r=s.getContextsMap();if(r.has(e))return r.get(e);this.ns=e,r.set(e,this)}addComponent(t){let e;this.#t.has(t.uuid)?(e=this.#t.get(t.uuid),e.component=t,e.children=[]):(e={component:t,children:[],changes:new At(t.uuid),propIsEqual:void 0},this.#t.set(t.uuid,e)),e.changes.create(t.token,t.parent?.uuid,t.order),t.parent?(this.addToChildren(t.parent,t),e.changes.setParent(t.parent.uuid)):this.#n(t,this.#e),this.#o=void 0}hasComponent(t){return this.#t.has(t.uuid)}hasComponents(){return this.#t.size>0}isRootComponent(t){return this.#e.includes(t.uuid)}destroyComponent(t){if(this.hasComponent(t)){let e=this.#t.get(t.uuid);e.children.slice(0).forEach(r=>this.#t.get(r)?.component.removeFromParent()),e.changes.destroy(),this.#o=void 0}}getChildren(t){return this.#t.get(t.uuid)?.children.map(e=>this.#t.get(e).component)??[]}removeFromParent(t,e){if(this.hasComponent(e)){let r=this.#t.get(t),i=this.#t.get(e.uuid),n=i.children.indexOf(t);n!==-1&&(i.children.splice(n,1),r.changes.setParent(void 0)),this.#n(r.component,this.#e),this.#o=void 0}}moveToRoot(t){let e=this.#t.get(t);e&&(e.changes?.setParent(void 0),this.#n(e.component,this.#e)),this.#o=void 0}changeToken(t,e){this.#t.get(t.uuid)?.changes.changeToken(e)}isChildOf(t,e){return this.hasComponent(e)?this.#t.get(e.uuid).children.includes(t.uuid):!1}addToChildren(t,e){let r=this.#t.get(t.uuid);if(r)this.#n(e,r.children),this.#t.get(e.uuid)?.changes.setParent(t.uuid),X(this.#e,e.uuid),this.#o=void 0;else throw new Error(`the view component ${t.uuid} cannot have a child added to it because the component do not exist!`)}removeSubTree(t){let e=this.#t.get(t);e&&(e.children.slice(0).forEach(r=>this.removeSubTree(r)),this.destroyComponent(e.component),this.#i(t))}setProperty(t,e,r,i){let n=this.#t.get(t.uuid);return n!=null?(i!=null?(n.propIsEqual??=new Map,n.propIsEqual.set(e,i)):n.propIsEqual?.has(e)&&n.propIsEqual.delete(e),n.changes.changeProperty(e,r,i)):!1}removeProperty(t,e){this.#t.get(t.uuid)?.changes.removeProperty(e)}changeOrder(t){if(t.parent){let e=this.#t.get(t.parent.uuid);X(e.children,t.uuid),this.#n(t,e.children)}else X(this.#e,t.uuid),this.#n(t,this.#e);this.#t.get(t.uuid)?.changes.changeOrder(t.order),this.#o=void 0}traverseLevelOrderBFS(){return this.#a().map(t=>t.component)}dispatchShadowObjectsEvent(t,e,r,i){this.#t.get(t.uuid)?.changes.createEvent(e,r,i)}broadcastEvent(t,e=void 0){for(let r of this.traverseLevelOrderBFS())r.dispatchEvent(t,e,!1)}dispatchMessage(t,e,r=void 0,i=!1){this.#t.get(t)?.component.dispatchEvent(e,r,i)}dispatchReRequestParentRoots(){for(let t of this.#e)this.dispatchMessage(t,s.ReRequestParentRoots)}buildChangeTrails(t=!0){let e=[];if(!this.hasComponents())return e;let r=this.#r();for(let i of r)i.buildChangeTrail(e,W.StructuralChanges);for(let i of r)i.buildChangeTrail(e,W.ContentUpdates);for(let i of r)i.buildChangeTrail(e,W.Removal),(i.isDestroyed||i.isNew&&!i.isCreated)&&this.#i(i.uuid),t&&i.clear();return this.#s.write(e),e}reCreateChanges(){if(!this.#s.isEmpty()){this.buildChangeTrails(!1);for(let[t,e]of this.#s){let r=this.#t.get(t);if(r){let i=new At(t);if(i.create(e.token,e.parentUuid,e.order),e.properties)for(let[n,o]of e.properties)i.changeProperty(n,o,r.propIsEqual?.get(n));r.changes.transferEventsTo(i),r.changes.clear(),r.changes=i}}this.#s.clear(),this.broadcastEvent(ps)}}clear(){if(this.#o=void 0,this.#s.clear(),this.#e.slice(0).forEach(t=>this.removeSubTree(t)),this.#e.length!==0)throw new Error("component-context panic: #rootComponents is not empty!");if(this.#t.size!==0)throw new Error("component-context panic: #components is not empty!")}#i(t){this.#t.has(t)&&(this.#t.delete(t),X(this.#e,t),this.#o=void 0)}#r(){return this.#a().filter(t=>t.changes.hasChanges()).map(t=>t.changes)}#n(t,e){if(e.length===0){e.push(t.uuid);return}if(e.includes(t.uuid))return;let r=e.length,i=new Array(r);if(i[0]=this.#t.get(e[0]).component,t.order<i[0].order){e.unshift(t.uuid);return}if(r===1){e.push(t.uuid);return}let n=r-1;if(i[n]=this.#t.get(e[n]).component,t.order>=i[n].order){e.push(t.uuid);return}if(r===2){e.splice(1,0,t.uuid);return}for(let o=n-1;o>=1;o--)if(i[o]=this.#t.get(e[o]).component,t.order>=i[o].order){e.splice(o+1,0,t.uuid);return}}#o;#a(){if(this.#o)return this.#o;let t=new Map,e=(r,i)=>{let n=this.#t.get(r);if(n!=null){t.has(i)?t.get(i).push(n):t.set(i,[n]);for(let o of n.children)e(o,i+1)}};return this.#e.forEach(r=>e(r,0)),this.#o=Array.from(t.entries()).sort((r,i)=>r[0]-i[0]).map(([,r])=>r).flat(),this.#o}};function Tt(s,t,e,r,i,n){function o(N){if(N!==void 0&&typeof N!="function")throw new TypeError("Function expected");return N}for(var h=r.kind,a=h==="getter"?"get":h==="setter"?"set":"value",c=!t&&s?r.static?s:s.prototype:null,w=t||(c?Object.getOwnPropertyDescriptor(c,r.name):{}),b,u=!1,l=e.length-1;l>=0;l--){var d={};for(var g in r)d[g]=g==="access"?{}:r[g];for(var g in r.access)d.access[g]=r.access[g];d.addInitializer=function(N){if(u)throw new TypeError("Cannot add initializers after decoration has completed");n.push(o(N||null))};var x=(0,e[l])(h==="accessor"?{get:w.get,set:w.set}:w[a],d);if(h==="accessor"){if(x===void 0)continue;if(x===null||typeof x!="object")throw new TypeError("Object expected");(b=o(x.get))&&(w.get=b),(b=o(x.set))&&(w.set=b),(b=o(x.init))&&i.unshift(b)}else(b=o(x))&&(h==="field"?i.unshift(b):w[a]=b)}c&&Object.defineProperty(c,r.name,w),u=!0}function tt(s,t,e){for(var r=arguments.length>2,i=0;i<t.length;i++)e=r?t[i].call(s,e):t[i].call(s);return r?e:void 0}function Ot(s){return function(t,e){let r=s?.name||e.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=f(n,s);return cs(this,r,o),j.findOrCreate(this).attachSignalByName(r,o),o.value}}}}var D="ConsoleLogger",_=`${D}Storage`,ur=!!(globalThis.location?.host?.startsWith("localhost")??!1),Rt="localStorage"in globalThis,ee=Symbol.for(D),Os=!1,Ps=s=>{if(typeof s=="boolean")return s;switch(s.toLowerCase()){case"true":case"yes":case"on":return!0;default:return!1}},Fe=s=>[Rt?D:void 0,...Array.isArray(s)?s:[s]].filter(Boolean).join(".");function We(s,t=void 0,e){let r=Fe(s),i=Rt?localStorage.getItem(r):globalThis[_]?.[r];return i!=null?t(i):e}function Pt(s,t){Rt?localStorage.setItem(Fe(s),t):(globalThis[_]==null&&(globalThis[_]={},console.debug(`${D}: Initialize`,{[_]:globalThis[_]})),globalThis[_][Fe(s)]=t)}var P=class s{static{this.sharedConfig={enable:ur,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(t){s.sharedConfig["styles.debug"]=t},get info(){return s.sharedConfig["styles.info"]},set info(t){s.sharedConfig["styles.info"]=t},get warn(){return s.sharedConfig["styles.warn"]},set warn(t){s.sharedConfig["styles.warn"]=t},get error(){return s.sharedConfig["styles.error"]},set error(t){s.sharedConfig["styles.error"]=t}}}static loadConfig(){Rt?(["enable","debug","info","warn"].forEach(t=>{this.sharedConfig[t]=We(t,Ps,this.sharedConfig[t])}),["debug","info","warn","error"].forEach(t=>{this.sharedStyles[t]=We(["styles",t],void 0,this.sharedStyles[t])}),s.isDebug&&console.debug(`${D}: Load config from localStorage`,s.sharedConfig),globalThis[D]?.[ee]||(globalThis[D]??={[ee]:!0,get enable(){return s.sharedConfig.enable},set enable(t){s.sharedConfig.enable=t,Pt("enable",t?"true":"false")},get debug(){return s.sharedConfig.debug},set debug(t){s.sharedConfig.debug=t,Pt("debug",t?"true":"false")},get info(){return s.sharedConfig.info},set info(t){s.sharedConfig.info=t,Pt("info",t?"true":"false")},get warn(){return s.sharedConfig.warn},set warn(t){s.sharedConfig.warn=t,Pt("warn",t?"true":"false")}})):globalThis[_]?.[ee]||(globalThis[_]={[ee]:!0,...s.sharedConfig,...globalThis[_]},s.sharedConfig=globalThis[_],s.isDebug&&console.debug(`${D}: Load config from ${_}`,globalThis[_]))}constructor(t){this.enable=!0,this.namespace=(t||"").trim()||D,Os||(s.loadConfig(),Os=!0);let e=[this.namespace,"enable"];this.enable=We(e,Ps,this.enable),Pt(e,Rt?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(...t){this.#t("debug",s.sharedStyles.debug,t)}info(...t){this.#t("info",s.sharedStyles.info,t)}warn(...t){this.#t("warn",s.sharedStyles.warn,t)}error(...t){this.#t("error",s.sharedStyles.error,t)}#t(t,e,r){console[t](`%c${this.namespace}`,e,...r)}};var F=(()=>{var s;let t,e=[],r=[],i,n=[],o=[];return class Q{static{let a=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;t=[Ot()],i=[Ot()],Tt(this,null,t,{kind:"accessor",name:"viewReady",static:!1,private:!1,access:{has:c=>"viewReady"in c,get:c=>c.viewReady,set:(c,w)=>{c.viewReady=w}},metadata:a},e,r),Tt(this,null,i,{kind:"accessor",name:"proxyReady",static:!1,private:!1,access:{has:c=>"proxyReady"in c,get:c=>c.proxyReady,set:(c,w)=>{c.proxyReady=w}},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)}#t;#e;#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$=f(),this.#o=tt(this,e,!1),this.#a=(tt(this,r),tt(this,n,!1)),this.#h=(tt(this,o),!1),this.ready=async()=>this.isReady?this:ft(this,Q.ContextCreated),this.#l=()=>{this.#s&&this.#u()},G(this,Q.ContextCreated),y(this,Q.ContextLost,U.AAA,()=>{K(this,Q.ContextCreated)}),v(()=>{if(this.viewReady&&this.proxyReady)return this.view.reCreateChanges(),p(this,Q.ContextCreated,this),this.#i&&(this.#i=!1,this.#u()),()=>{p(this,Q.ContextLost,this)}},[R(this,"viewReady"),R(this,"proxyReady")])}get view(){return this.#t}set view(a){a!==this.#t&&(this.#t&&this.#t.ns&&globalThis.__shadowEnvs&&globalThis.__shadowEnvs.delete(this.#t.ns),this.#t=a??void 0,this.#t&&this.#t.ns&&(globalThis.__shadowEnvs??=new Map,globalThis.__shadowEnvs.has(this.#t.ns)&&globalThis.__shadowEnvs.get(this.#t.ns)!==this&&this.logger.isWarn&&this.logger.warn("overwrite a namespace already in use",this.#t.ns,globalThis.__shadowEnvs.get(this.#t.ns)),globalThis.__shadowEnvs.set(this.#t.ns,this)),this.viewReady=!!a)}get envProxy(){return this.#e}set envProxy(a){if(a!==this.#e){let c=this.#e;this.#e=a??void 0,this.#e&&(this.#e.onMessageToView=this.#c.bind(this)),c&&c.destroy(),this.proxyReady=!1,a?.start().then(()=>{this.proxyReady=!0}).catch(w=>{this.logger.error("failed to start envProxy",w),this.proxyReady=!1})}}get isReady(){return!!(this.#t&&this.#e&&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=ft(this,Q.AfterSync).then(a=>(this.#n=void 0,a)),this.#n)}destroy(){let a=this.#t?.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),xt(this),S(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{p(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"],cr=()=>{let s=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=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[t&255]+T[t>>8&255]+"-"+T[t>>16&15|64]+T[t>>24&255]+"-"+T[e&63|128]+T[e>>8&255]+"-"+T[e>>16&255]+T[e>>24&255]+T[r&255]+T[r>>8&255]+T[r>>16&255]+T[r>>24&255]).toLowerCase()},Rs=()=>globalThis?.crypto?.randomUUID?.()??cr();var Mt=class extends Error{constructor(t){super(t),this.name="ViewComponentError"}},se=class s{#t;#e;#s;#i;#r=0;get uuid(){return this.#t}get token(){return this.#e}set token(t){t??=H,t!==this.#e&&(this.#e=t,this.#s?.changeToken(this,t))}get parent(){return this.#i}set parent(t){if(t){if(t.#s!==this.#s)throw new Mt("cannot set parent from different context");t.addChild(this)}else this.removeFromParent()}get context(){return this.#s}set context(t){this.#s!=t&&(this.#s&&this.destroy(),this.#s=t,t&&t.addComponent(this))}get order(){return this.#r}set order(t){let e=this.#r;this.#r=t??0,e!==this.#r&&this.#s.changeOrder(this)}constructor(t,e){k(this),e instanceof s&&(e={parent:e}),this.#t=e?.uuid??Rs(),this.#e=t,this.#r=e?.order??0,this.#i=e?.parent;let r=e?.context??$.get();if(this.#i&&this.#i.#s!==r)throw new Mt("cannot set parent from different context");this.context=r}isChildOf(t){return this.#i===t}removeFromParent(){this.#i?(this.#s?.removeFromParent(this.uuid,this.#i),this.#i=void 0):this.#s?.moveToRoot(this.uuid)}addChild(t){if(t.#s!==this.#s)throw new Mt("cannot add a child from another context");t.isChildOf(this)||(t.removeFromParent(),t.#i=this,this.#s.addToChildren(this,t))}setProperty(t,e,r){this.#s.setProperty(this,t,e,r)}removeProperty(t){this.#s.removeProperty(this,t)}dispatchShadowObjectsEvent(t,e,r){this.#s.dispatchShadowObjectsEvent(this,t,e,r)}dispatchEvent(t,e,r){if(p(this,t,e),r)for(let i of this.#s.getChildren(this))i.dispatchEvent(t,e,r)}destroy(){this.removeFromParent(),this.#s?.destroyComponent(this),this.#s=void 0}};var re="shaeRequestEntParent",ie="shaeReRequestEntParent",Ms="shae-worker",ne="shae-ent",Ls="shae-prop",et="token";var oe="local",js="no-autostart",ae="no-structured-clone",z="auto-sync";var he="name",le="value",ue="type",ce="no-trim";var Lt=new Set(["on","true","yes","local","1"]);var _s=s=>dt(s.getAttribute("ns")),_t=(s,t)=>{if(s.hasAttribute(t)){let e=s.getAttribute(t)?.trim()?.toLowerCase()||"1";return Lt.has(e)}return!1};var Ds=(s,t)=>{t.set(_s(s))},ze=new Set,Ve=!1,dr=s=>{ze.add(s),Ve||(Ve=!0,queueMicrotask(()=>{Ve=!1;for(let t of ze)F.get(t)?.sync();ze.clear()}))},st=class extends HTMLElement{static{this.observedAttributes=["ns"]}get ns(){return this.ns$.value}set ns(t){typeof t=="symbol"?this.ns$.set(t):this.ns$.set(dt(t))}constructor(){super(),this.isShaeElement=!0,this.ns$=f(ct),this.ns$.onChange(t=>{typeof t=="string"&&t.length>0?this.getAttribute("ns")!==t&&this.setAttribute("ns",t):this.removeAttribute("ns")}),Ds(this,this.ns$)}attributeChangedCallback(t){t==="ns"&&Ds(this,this.ns$)}syncShadowObjects(){dr(this.ns)}};var de=class extends st{static{this.observedAttributes=[...st.observedAttributes,et]}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(t){this.token$.set(t)}#t;constructor(){super(),this.isShaeEntElement=!0,this.componentContext$=f(),this.viewComponent$=f(),this.token$=f(),this.#n=!0,this.#d=()=>{let t=this.findShadowRootHost();t!=null&&this.dispatchEvent(new CustomEvent(ie,{bubbles:!0,composed:!0,detail:{requester:this,shadowRootHost:t}}))},this.#f=t=>{let e=t.detail?.requester;if(e===this||!e?.isShaeEntElement||e.ns!==this.ns)return;t.detail?.shadowRootHost&&this.#l()},this.#g=t=>{let e=t.detail?.requester;e!==this&&e?.isShaeEntElement&&e.ns===this.ns&&(t.stopPropagation(),e.#c(this))},this.ns$.onChange(t=>{this.componentContext$.set($.get(t)),this.isConnected&&this.#l()}),this.#p(),this.token$.onChange(t=>{t==null?this.removeAttribute(et):this.getAttribute(et)!==t&&this.setAttribute(et,t)}),v(()=>{let t=this.viewComponent$.get();if(t){let e=y(t,$.ReRequestParentRoots,()=>this.#h()),r=t.context?.ns;return()=>{e(),t.destroy(),r&&r!==this.ns?F.get(r)?.sync():this.syncShadowObjects()}}}),this.token$.onChange(t=>{let e=this.viewComponent$.value;e&&(e.token=t,this.syncShadowObjects())}),this.style.display="contents"}#e;#s(){this.#e?.();let t=this.componentContext$.onChange(e=>{let r=this.token$.value,i=this.viewComponent$.value;i?i.context=e:e&&(i=new se(r,{context:e}),this.viewComponent$.set(i)),this.syncShadowObjects()});this.#e=()=>{t()}}#i(){this.#e?.(),this.#e=void 0}#r;#n;findShadowRootHost(){if(this.#n){this.#n=!1;let t=this;for(;t;){if(t.parentElement==null){let e=t.parentNode;e&&(this.#r=e.host);break}t=t.parentElement}}return this.#r}getParentNodeForObserver(){let t=this.parentNode;return t||(t.host??t)}connectedCallback(){this.#n=!0,this.addEventListener("slotchange",this.#d,{capture:!1,passive:!1}),this.addEventListener(re,this.#g,{capture:!1,passive:!1}),this.#s(),je(()=>this.#p()),this.componentContext==null&&this.componentContext$.set($.get(this.ns)),this.#l(),this.componentContext?.dispatchReRequestParentRoots(),this.#o(),this.syncShadowObjects()}#o(){this.#a();let t=this.getParentNodeForObserver();t&&(this.#t=new MutationObserver((e,r)=>{for(let{target:i,removedNodes:n}of e)if(i===t){for(let o of n)if(o===this){this.#a(),this.onParentChanged(this.getParentNodeForObserver(),t);break}}}),this.#t.observe(t,{childList:!0,subtree:!1,attributes:!1}))}onParentChanged(t,e){this.#c(void 0),this.#l()}#a(){this.#t?.disconnect(),this.#t=void 0}attributeChangedCallback(t){super.attributeChangedCallback(t),t===et&&this.#p()}disconnectedCallback(){this.#n=!0,this.#a(),this.removeEventListener("slotchange",this.#d,{capture:!1}),this.removeEventListener(re,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(re,{bubbles:!0,composed:!0,detail:{requester:this}}))}#u;#c(t){if(this.entParentNode!==t)if(this.entParentNode&&this.entParentNode.removeEventListener(ie,this.#f,{capture:!1}),this.entParentNode=t,this.entParentNode&&this.entParentNode.addEventListener(ie,this.#f,{capture:!1,passive:!1}),this.#u?.(),this.#u=void 0,t){let e=v(()=>{let r=this.viewComponent$.get();if(r){let i=t.viewComponent$.get();r.parent=i&&i.context===r.context?i:void 0,r.parent==null&&queueMicrotask(()=>{this.#l()}),this.syncShadowObjects()}});this.#u=()=>e.destroy()}else{let e=this.viewComponent;e.parent&&(e.parent=void 0,this.syncShadowObjects())}}#d;#f;#g;#p(){if(this.hasAttribute(et)){let t=this.getAttribute(et)?.trim()||void 0;this.token$.set(t)}}};customElements.define(ne,de);var fr=s=>{let t=s.parentElement;for(;t;){if(t.isShaeEntElement)return t;t=t.parentElement}},pr=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"]),fe=class extends HTMLElement{static{this.observedAttributes=[he,le,ue,ce]}get name(){return this.name$.value}get value(){return this.valueOut$.value}set value(t){this.valueIn$.set(t)}get shouldTrim(){return this.shouldTrim$.value}get entNode(){return this.entNode$.value}set entNode(t){this.entNode$.set(t)}get viewComponent(){return this.viewComponent$.value}constructor(){super(),this.isShaeEntElement=!0,this.entNode$=f(),this.viewComponent$=f(),this.name$=f(),this.valueIn$=f(),this.valueOut$=f(),this.type$=f(),this.shouldTrim$=f(!0),this.logger=new P("ShaePropElement"),this.#t=()=>{this.entNode$.set(fr(this))},this.#e=()=>{queueMicrotask(()=>{this.isConnected||this.entNode$.set(void 0)})},this.#s=()=>{this.name$.set(this.getAttribute(he)?.trim()??void 0)},this.#i=()=>{this.valueIn$.set(this.getAttribute(le))},this.#r=()=>{let t=this.getAttribute(ue)?.trim().toLowerCase();t&&!pr.has(t)&&(this.logger.isWarn&&this.logger.warn(`[${this.name}] unknown type "${t}"`,{shaeProp:this}),t=void 0),this.type$.set(t)},this.#n=()=>{this.shouldTrim$.set(!_t(this,ce))},this.entNode$.onChange(t=>{if(t){let e=M(t.viewComponent$,this.viewComponent$);return()=>{e.destroy()}}else this.viewComponent$.set(void 0)}),v(()=>{let t=this.viewComponent$.get();if(t){let e=this.name$.get();if(e){let r=this.valueOut$.get();this.logger.isDebug&&this.logger.debug(`[${this.name}] view-component set-property`,e,r,t.uuid,{viewComponent:t,shaeProp:this}),t.setProperty(e,r),this.isConnected&&this.entNode?.syncShadowObjects()}}}),v(()=>{let t=this.type$.get(),e=this.shouldTrim$.get(),r=this.valueIn$.get();if(e&&typeof r=="string"&&(r=r.trim()),r=r||void 0,r!=null&&typeof r=="string"&&t)switch(t){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=Lt.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=>Lt.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 "${t}"`,{value:r,shaeProp:this})}this.valueOut$.set(r)}),O(()=>{this.#s(),this.#i(),this.#r(),this.#n()}),this.style.display="contents"}connectedCallback(){O(()=>{this.#t(),this.#s(),this.#i(),this.#r(),this.#n()})}attributeChangedCallback(t){switch(t){case he:this.#s();break;case le:this.#i();break;case ue:this.#r();break;case ce:this.#n();break}}disconnectedCallback(){this.#e()}#t;#e;#s;#i;#r;#n};customElements.whenDefined(ne).then(()=>customElements.define(Ls,fe));var pe,Ue=null,bt=class{static{this.OnFrame=Symbol("onFrame")}#t=0;#e=0;constructor(){if(Ue)return Ue;k(this),Ue=this}start(t){if(t!=null)return Te(this)===0&&this.#i(),y(this,pe.OnFrame,t),this.#e++,()=>{this.stop(t)}}stop(t){S(this,pe.OnFrame,t),Te(this)===0&&this.#r()}#s=t=>{p(this,pe.OnFrame,t),this.#i()};#i(){this.#t=requestAnimationFrame(this.#s)}#r(){cancelAnimationFrame(this.#t),this.#t=0}};pe=bt;var vt="value",Dt=(()=>{let s,t=[],e=[];return class{static{let i=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;s=[Ot({name:vt})],Tt(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},t,e),i&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})}static{this.Value=vt}#t;#e;#s;get value(){return this.#s}set value(i){this.#s=i}constructor(i){this.#t=[],this.#s=tt(this,t,void 0),this.value$=tt(this,e),G(this,vt),this.value$=R(this,vt),this.value$.onChange(n=>p(this,vt,n)),i&&this.add(...i)}add(...i){return this.#t.push(...i),this.#r(),this.#i(i)}unshift(...i){return this.#t.unshift(...i),this.#r(),this.#i(i)}remove(...i){this.#i(i)()}clear(){this.#t.length=0,this.#r()}dispose(){this.clear(),this.#e?.destroy(),this.#e=void 0,K(this,vt),S(this),this.value$.destroy(),xt(this)}#i(i){return()=>{for(let n of i){let o=this.#t.indexOf(n);o!==-1&&this.#t.splice(o,1)}this.#r()}}#r(){this.#e?.destroy(),this.#t.length===0?(this.#e=void 0,this.value=void 0):(this.#e=v(()=>{let i;for(let n of this.#t){let o=ut(n);if(o!=null){i=o;break}}this.value=i},this.#t),this.#e.run())}}})();var Ge="onCreate",rt="onDestroy",Ns="onParentChanged",$s="onViewEvent";var Be=new Map,qe=!1,gr=(s,t)=>{Be.set(s,t),qe||(qe=!0,queueMicrotask(()=>{qe=!1;let e=Array.from(Be.entries());Be.clear();for(let[r,i]of e)r.set(i)}))},ge=class{#t;#e;#s=new Xt;#i=new Map;#r=new Map;#n;#o;#a=new Set;#h=[];#l=0;get kernel(){return this.#t}get uuid(){return this.#e}get order(){return this.#l}set order(t){this.#l!==t&&(this.#l=t,this.#n&&this.parent.resortChildren())}get parentUuid(){return this.#n||void 0}set parentUuid(t){this.#n!==t&&(this.removeFromParent(),this.#n=t||void 0,this.#o=t?this.#t.getEntity(t):void 0,this.#o&&this.#o.addChild(this))}get parent(){return!this.#o&&this.#n&&(this.#o=this.#t.getEntity(this.#n)),this.#o}set parent(t){this.parentUuid=t?.uuid}get hasParent(){return!!this.#n}get children(){return this.#h}constructor(t,e){this.#t=t,this.#e=e,E(this,rt,U.Min,this)}traverse(t){t(this);for(let e of this.#h)e.traverse(t)}onDestroy(){this.#s.clear(),S(this);for(let t of this.#r.values())t.cleanup(),t.signal.destroy();this.#r.clear();for(let t of this.#i.values())t.context.set(void 0),t.unsubscribePathValue(),t.unsubscribeFromParent?.(),t.valuePath.dispose(),t.inherited.destroy(),t.provide.destroy(),t.context.destroy();this.#n=void 0,this.#o=void 0,this.#a.clear(),this.#h.length=0}addChild(t){if(this.#h.length===0){this.#a.add(t.uuid),this.#h.push(t);return}if(this.#a.has(t.uuid))throw new Error(`child with uuid: ${t.uuid} already exists! parentUuid: ${this.uuid}`);this.#a.add(t.uuid),this.#h.push(t),this.resortChildren();for(let[,e]of t.#i)t.#f(e)}resortChildren(){this.#h.sort((t,e)=>t.order-e.order)}removeChild(t){this.#a.has(t.uuid)&&(this.#a.delete(t.uuid),this.#h.splice(this.#h.indexOf(t),1))}removeFromParent(){if(this.#o){this.#o.removeChild(this),this.#o=void 0,this.#n=void 0;for(let[,t]of this.#i)t.unsubscribeFromParent&&(t.unsubscribeFromParent(),t.unsubscribeFromParent=void 0)}}reSubscribeToParentContexts(){for(let[,t]of this.#i)this.#f(t)}dispatchMessageToView(t,e,r,i=!1){this.#t.dispatchMessageToView({uuid:this.#e,type:t,data:e,transferables:r,traverseChildren:i})}dispatchViewEvents(t){for(let{type:e,data:r}of t)p(this,$s,e,r)}dispatchViewEvent(t,e){this.dispatchViewEvents([{type:t,data:e}])}#u(t){return this.#s.get(t)}getPropertyReader(t){return this.#u(t).get}getPropertyWriter(t){return this.#u(t).set}setProperties(t){this.clearTruthyPropsCache(),O(()=>{for(let[e,r]of t)this.setProperty(e,r)})}setProperty(t,e){this.getPropertyWriter(t)(e)}getProperty(t){return ut(this.getPropertyReader(t))}propKeys(){return Array.from(this.#s.keys())}propEntries(){return Array.from(this.#s.entries()).map(([t,e])=>[t,e.value])}#c;clearTruthyPropsCache(){this.#c=void 0}truthyProps(){if(this.#c)return this.#c.size?this.#c:void 0;let t=new Set;for(let[e,r]of this.#s.entries())if(typeof e=="string"){let i=r.value;i!=null&&i!==!1&&i!==""&&t.add(e)}return this.#c=t,t.size?t:void 0}hasContext(t){return this.#i.has(t)}useContext(t){return this.#d(t).context.get}useParentContext(t){return this.#d(t).inherited.get}provideContext(t){return this.#d(t).provide}provideGlobalContext(t){if(this.#r.has(t))return this.#r.get(t).signal;let e=this.#t.findOrCreateRootContext(t),r=f(),i=e.add(r);return this.#r.set(t,{cleanup:i,signal:r}),r}#d(t){if(this.#i.has(t))return this.#i.get(t);let e=f(),r=f(),i=f(),n=new Dt([r,e]),o=y(n,Dt.Value,a=>{gr(i,a)}),h={name:t,inherited:e,provide:r,context:i,valuePath:n,unsubscribePathValue:o};return this.#i.set(t,h),this.#f(h),h}#f(t){if(t.unsubscribeFromParent?.(),t.unsubscribeFromParent=void 0,this.parent){let e=this.parent.#d(t.name),r=M(e.context,t.inherited);t.unsubscribeFromParent=r.destroy.bind(r)}else{let e=this.#t.findOrCreateRootContext(t.name),r=M(e.value$,t.inherited);t.unsubscribeFromParent=r.destroy.bind(r)}}};var Is=s=>{let t=s.split("@").map(e=>e.trim());if(t.length===2&&t[1])return t[0]?{key:`${t[0]}@${t[1]}`,prop:t[1],token:t[0]}:{key:t[1],prop:t[1]}},ye=(s,t)=>{for(let e of t)s.add(e)},yr=(s,t)=>{if(s!=null)for(let e of s.constructors)t.add(e)},Nt=class{static get(t){return t??mr}#t=new Map;#e=new Map;#s=new Map;define(t,e){this.#t.has(t)?As(this.#t.get(t).constructors,e):this.#t.set(t,{token:t,constructors:[e]})}appendRoute(t,e){let r=Is(t);r?this.#s.has(r.key)?ye(this.#s.get(r.key).routes,e):this.#s.set(r.key,{routes:new Set(e),token:r.token}):this.#e.has(t)?ye(this.#e.get(t),e):this.#e.set(t,new Set(e))}clearRoute(t){let e=Is(t);e?this.#s.delete(e.key):this.#e.delete(t)}findTokensByRoute(t,e){let r=new Set([t]),i=this.#e.has(t)?[...this.#e.get(t)]:[];for(;i.length;){let n=i.shift();r.has(n)||(r.add(n),this.#e.has(n)&&i.push(...Array.from(this.#e.get(n)).filter(o=>!r.has(o))))}if(e){for(let o of e)this.#s.has(o)&&ye(r,this.#s.get(o).routes);let n;do{n=r.size;for(let o of new Set(r))for(let h of e){let a=`${o}@${h}`;this.#s.has(a)&&ye(r,this.#s.get(a).routes)}}while(n!==r.size)}return r}findConstructors(t,e){let r=this.findTokensByRoute(t,e),i=new Set;for(let n of r)yr(this.#t.get(n),i);return i.size>0?Array.from(i):void 0}hasToken(t){return this.#t.has(t)}hasRoute(t){return this.#e.has(t)}clear(){this.#t.clear(),this.#e.clear()}},mr=new Nt;var Y;(function(s){s[s.CreateAndDestroy=0]="CreateAndDestroy",s[s.JustCreate=1]="JustCreate",s[s.DestroyOnly=2]="DestroyOnly"})(Y||(Y={}));var Ws=s=>s.displayName||s.name,me=!1,be=class{#t;#e;#s;#i;#r;#n;constructor(t){this.logger=new P("Kernel"),this.#t=new Map,this.#e=new Set,this.#r=!0,this.#n=new Map,k(this),this.registry=Nt.get(t)}getEntity(t){let e=this.#t.get(t)?.entity;if(!e)throw new Error(`entity with uuid "${t}" not found!`);return e}hasEntity(t){return this.#t.has(t)}traverseLevelOrderBFS(t=!1){if(this.#r){let e=new Map,r=(i,n)=>{let o=this.getEntity(i);e.has(n)?e.get(n).push(o):e.set(n,[o]);for(let h of o.children)r(h.uuid,n+1)};this.#e.forEach(i=>{r(i,0)}),this.#s=Array.from(e.entries()).sort((i,n)=>i[0]-n[0]).flatMap(([,i])=>i),this.#i=this.#s.slice().reverse(),this.#r=!1}return t?this.#i:this.#s}getEntityGraph(){return Array.from(this.#e).map(t=>this.getEntityGraphNode(t))}getEntityGraphNode(t){if(!this.#t.has(t))return;let{token:e,entity:r}=this.#t.get(t);return{token:e,entity:r,props:Object.fromEntries(r.propEntries()),children:r.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,Y.DestroyOnly));for(let e of this.traverseLevelOrderBFS(!1))this.updateShadowObjects(e.uuid,Y.JustCreate,t.get(e.uuid));t.clear()}run(t){this.logger.isDebug&&this.logger.debug("sync",t),O(()=>{for(let e of t.changeTrail)this.parse(e)})}parse(t){switch(t.type){case m.CreateEntities:this.createEntity(t.uuid,t.token,t.parentUuid,t.order,t.properties),this.#r=!0;break;case m.DestroyEntities:this.destroyEntity(t.uuid),this.#r=!0;break;case m.SetParent:this.setParent(t.uuid,t.parentUuid,t.order),this.#r=!0;break;case m.UpdateOrder:this.updateOrder(t.uuid,t.order),this.#r=!0;break;case m.ChangeProperties:this.changeProperties(t.uuid,t.properties);break;case m.ChangeToken:this.changeToken(t.uuid,t.token);break;case m.SendEvents:this.dispatchEventsToEntity(t.uuid,t.events);break}}createEntity(t,e,r,i=0,n){let o=new ge(this,t);o.order=i;let h={token:e,entity:o,usedConstructors:new Map};this.#t.set(t,h),r&&(o.parentUuid=r),o.hasParent||this.#e.add(t),n&&o.setProperties(n),this.createShadowObjects(t)}destroyEntity(t){if(!this.#t.has(t))return;let{entity:e,usedConstructors:r}=this.#t.get(t);e.removeFromParent(),p(e,rt,this),r.clear(),this.#t.delete(e.uuid),this.#e.delete(e.uuid)}setParent(t,e,r=0){let i=this.getEntity(t);i.parentUuid===e&&i.order===r||(i.removeFromParent(),i.order=r,i.parentUuid=e,i.hasParent?this.#e.delete(t):this.#e.add(t),i.reSubscribeToParentContexts(),queueMicrotask(()=>{this.logger.isDebug&&this.logger.debug("entity.onParentChanged",{uuid:t,parentUuid:e,order:r,entity:i}),p(i,Ns,i)}))}updateOrder(t,e){this.getEntity(t).order=e}dispatchEventsToEntity(t,e){this.getEntity(t)?.dispatchViewEvents(e)}changeProperties(t,e){this.getEntity(t).setProperties(e),this.updateShadowObjects(t)}changeToken(t,e){if(!this.#t.has(t))return;let r=this.#t.get(t);r.token!==e&&(r.token=e,this.updateShadowObjects(t))}dispatchMessageToView(t){queueMicrotask(()=>{p(this,mt,t)})}updateShadowObjects(t,e=Y.CreateAndDestroy,r){let i=this.#t.get(t);r??=new Set(this.registry.findConstructors(i.token,i.entity.truthyProps()));let n=e===Y.CreateAndDestroy||e===Y.DestroyOnly,o=e===Y.CreateAndDestroy||e===Y.JustCreate;if(n){for(let[h,a]of i.usedConstructors)if(!r.has(h)){i.usedConstructors.delete(h);for(let c of a)this.destroyShadowObject(c,i.entity)}}if(o)for(let h of r)i.usedConstructors.has(h)||this.constructShadowObject(h,i);return r}constructShadowObject(t,e){let r=new Set,i=new Set,n=new Map,o=new Map,h=new Map,a=new Map,c=new Map,w=(u,l)=>{let d=c.get(u);if(d===void 0){d=f(void 0,l?{compare:l}:void 0).get,c.set(u,d);let g=M(e.entity.getPropertyReader(u),d);i.add(g.destroy.bind(g))}return d},b=k(new t({entity:e.entity,provideContext(u,l,d){let g=h.get(u);!me&&typeof d!="function"&&(console.warn('[shadow-objects] Deprecation Warning: The "isEqual" option of "provideContext()" and "provideGlobalContext()" is now passed as {compare} argument. Please update your code accordingly.'),me=!0);let x=typeof d=="function"?{compare:d}:d;if(g==null){let N=q(l);if(g=f(N?void 0:l,x?.compare?{compare:x.compare}:void 0),N){let Ct=M(l,g);i.add(Ct.destroy.bind(Ct))}let wt=M(g,e.entity.provideContext(u));i.add(wt.destroy.bind(wt)),h.set(u,g)}return g!=null&&(x?.clearOnDestroy??!0)&&i.add(()=>{g.set(void 0)}),g},provideGlobalContext(u,l,d){let g=a.get(u);!me&&typeof d!="function"&&(console.warn('[shadow-objects] Deprecation Warning: The "isEqual" option of "provideContext()" and "provideGlobalContext()" is now passed as {compare} argument. Please update your code accordingly.'),me=!0);let x=typeof d=="function"?{compare:d}:d;if(g==null){let N=q(l);if(g=f(N?void 0:l,x?.compare?{compare:x.compare}:void 0),N){let Ct=M(l,g);i.add(Ct.destroy.bind(Ct))}let wt=M(g,e.entity.provideGlobalContext(u));i.add(wt.destroy.bind(wt)),a.set(u,g)}return g!=null&&(x?.clearOnDestroy??!0)&&i.add(()=>{g.set(void 0)}),g},useContext(u,l){let d=n.get(u);if(d===void 0){d=f(void 0,l?{compare:l}:void 0).get,n.set(u,d);let g=M(e.entity.useContext(u),d);i.add(g.destroy.bind(g))}return d},useParentContext(u,l){let d=o.get(u);if(d===void 0){d=f(void 0,l?{compare:l}:void 0).get,o.set(u,d);let g=M(e.entity.useParentContext(u),d);i.add(g.destroy.bind(g))}return d},useProperty:w,useProperties(u){let l={};for(let d in u)Object.hasOwn(u,d)&&(l[d]=w(u[d]));return l},createResource(u,l){let d=f(void 0);i.add(()=>A(d));let g=v(()=>{let x=u();return d.set(x),x!==void 0&&l?()=>{l(x),d.set(void 0)}:()=>{d.set(void 0)}});return i.add(g.destroy),d},createEffect(...u){let l=v(...u);return i.add(l.destroy),l},createSignal(...u){let l=f(...u);return i.add(()=>{A(l)}),l},createMemo(...u){let l=De(...u);return i.add(()=>{A(l)}),l},on(...u){let l=y(...u);return i.add(l),l},once(...u){let l=E(...u);return i.add(l),l},onDestroy(u){r.add(u)}}));return this.logger.isInfo&&this.logger.info("create shadow-object",Ws(t),{shadowObject:b,entity:e.entity}),E(e.entity,rt,U.Low,()=>{this.logger.isInfo&&this.logger.info("destroy shadow-object",Ws(t),{shadowObject:b,entity:e.entity});for(let l of r)l();for(let l of i)l();for(let l of n.values())A(l);for(let l of o.values())A(l);for(let l of c.values())A(l);for(let l of h.values())A(l);for(let l of a.values())A(l);r.clear(),i.clear(),n.clear(),o.clear(),c.clear(),h.clear(),a.clear();let u=e.usedConstructors.get(t);u&&(u.delete(b),u.size===0&&e.usedConstructors.delete(t))}),e.usedConstructors.has(t)?e.usedConstructors.get(t).add(b):e.usedConstructors.set(t,new Set([b])),this.attachShadowObject(b,e.entity),b}createShadowObjects(t){let e=this.#t.get(t);this.registry.findConstructors(e.token,e.entity.truthyProps())?.forEach(r=>{this.constructShadowObject(r,e)})}findShadowObjects(t){if(!this.#t.has(t))return[];let{usedConstructors:e}=this.#t.get(t);return Array.from(new Set(Array.from(e.values()).flatMap(r=>Array.from(r))))}attachShadowObject(t,e){y(e,t),typeof t[Ge]=="function"&&t[Ge](e)}destroyShadowObject(t,e){typeof t[rt]=="function"&&t[rt](e),p(t,rt,e),S(e,t)}findOrCreateRootContext(t){let e=this.#n.get(t);return e||(e=new Dt,this.#n.set(t,e)),e}destroy(){for(let t of this.#n.values())t.dispose();this.#n.clear();for(let t of this.traverseLevelOrderBFS().reverse())this.destroyEntity(t.uuid)}};async function He(s,t,e,r=!0){if(e.has(t)){console.warn("importModule: skipping already imported module",t);return}else e.add(t);t.extends&&await Promise.all(t.extends.map(n=>He(s,n,e,!1)));let{registry:i}=s;if(t.define)for(let[n,o]of Object.entries(t.define))i.define(n,o);if(t.routes)for(let[n,o]of Object.entries(t.routes))i.appendRoute(n,o);await(t.initialize?.({define:(n,o)=>i.define(n,o),kernel:s,registry:i})??Promise.resolve()),r&&s.upgradeEntities()}var ve=s=>(typeof s=="string"&&(s=new URL(s,globalThis.location.href)),s.toString());function Fs(s){return s.map(t=>{if(t.transferables&&t.transferables.length>0){let{transferables:e,...r}=t;return structuredClone(r,{transfer:e})}else return structuredClone(t)})}var we=class{#t;get registry(){return this.kernel.registry}constructor(t){this.#t=new Set,this.isLocalEnv=!0,this.disableStructuredClone=!1,this.kernel=new be(t),y(this.kernel,mt,e=>{if(this.onMessageToView!=null){let{type:r,uuid:i,traverseChildren:n}=e,o=structuredClone(e.data,{transfer:e.transferables});this.onMessageToView({type:r,uuid:i,data:o,traverseChildren:n})}})}start(){return Promise.resolve()}applyChangeTrail(t,e){let r={changeTrail:this.disableStructuredClone?t:Fs(t)},i;try{this.kernel.run(r),i=Promise.resolve()}catch(n){i=Promise.reject(n)}return i}async importScript(t){let e=await import(ve(t));e[Ne]&&await this.importModule(e[Ne])}async importModule(t){return He(this.kernel,t,this.#t)}destroy(){this.kernel.destroy(),this.registry.clear(),this.#t.clear()}};function Qe(s){let t=new Blob([s],{type:"text/javascript"}),e=URL.createObjectURL(t),r=new Worker(e);return URL.revokeObjectURL(e),r}function Ye(){return Qe('var Gs=Object.defineProperty;var oe=Object.getOwnPropertySymbols;var Ue=Object.prototype.hasOwnProperty,Be=Object.prototype.propertyIsEnumerable;var Us=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),We=e=>{throw TypeError(e)};var me=(e,t,s)=>t in e?Gs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,we=(e,t)=>{for(var s in t||(t={}))Ue.call(t,s)&&me(e,s,t[s]);if(oe)for(var s of oe(t))Be.call(t,s)&&me(e,s,t[s]);return e};var qe=(e,t)=>{var s={};for(var i in e)Ue.call(e,i)&&t.indexOf(i)<0&&(s[i]=e[i]);if(e!=null&&oe)for(var i of oe(e))t.indexOf(i)<0&&Be.call(e,i)&&(s[i]=e[i]);return s};var f=(e,t,s)=>me(e,typeof t!="symbol"?t+"":t,s),Ce=(e,t,s)=>t.has(e)||We("Cannot "+s);var r=(e,t,s)=>(Ce(e,t,"read from private field"),s?s.call(e):t.get(e)),g=(e,t,s)=>t.has(e)?We("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),c=(e,t,s,i)=>(Ce(e,t,"write to private field"),i?i.call(e,s):t.set(e,s),s),C=(e,t,s)=>(Ce(e,t,"access private method"),s);var Je=(e,t,s,i)=>({set _(a){c(e,t,a,s)},get _(){return r(e,t,i)}});var Ee=function(e,t){this[0]=e,this[1]=t},Ke=(e,t,s)=>{var i=(n,l,p,b)=>{try{var m=s[n](l),h=(l=m.value)instanceof Ee,d=m.done;Promise.resolve(h?l[0]:l).then(u=>h?i(n==="return"?n:"next",l[1]?{done:u.done,value:u.value}:u,p,b):p({value:u,done:d})).catch(u=>i("throw",u,p,b))}catch(u){b(u)}},a=n=>o[n]=l=>new Promise((p,b)=>i(n,l,p,b)),o={};return s=s.apply(e,t),o[Us("asyncIterator")]=()=>o,a("next"),a("throw"),a("return"),o};var Ye;(function(e){e[e.StructuralChanges=1]="StructuralChanges",e[e.ContentUpdates=2]="ContentUpdates",e[e.Removal=3]="Removal"})(Ye||(Ye={}));var tt;(function(e){e[e.CreateEntities=1]="CreateEntities",e[e.DestroyEntities=2]="DestroyEntities",e[e.SetParent=3]="SetParent",e[e.UpdateOrder=4]="UpdateOrder",e[e.ChangeProperties=5]="ChangeProperties",e[e.ChangeToken=6]="ChangeToken",e[e.SendEvents=7]="SendEvents"})(tt||(tt={}));var Bs="configure",Ws="changeTrail",qs="destroy",Js="loaded",He="appliedChangeTrail",Se="importedModule",Ks="destroyed",Te="messageToView",ke="shadowObjects",N="ConsoleLogger",x=`${N}Storage`,ds,us,cs,Ys=!!((cs=(us=(ds=globalThis.location)==null?void 0:ds.host)==null?void 0:us.startsWith("localhost"))!=null&&cs),Qt="localStorage"in globalThis,he=Symbol.for(N),Qe=!1,Xe=e=>{if(typeof e=="boolean")return e;switch(e.toLowerCase()){case"true":case"yes":case"on":return!0;default:return!1}},De=e=>[Qt?N:void 0,...Array.isArray(e)?e:[e]].filter(Boolean).join(".");function Ae(e,t=void 0,s){var o;let i=De(e),a=Qt?localStorage.getItem(i):(o=globalThis[x])==null?void 0:o[i];return a!=null?t(a):s}function Ut(e,t){Qt?localStorage.setItem(De(e),t):(globalThis[x]==null&&(globalThis[x]={},console.debug(`${N}: Initialize`,{[x]:globalThis[x]})),globalThis[x][De(e)]=t)}var mt,Wt,y,Hs=(y=class{constructor(t){g(this,mt);this.enable=!0,this.namespace=(t||"").trim()||N,Qe||(y.loadConfig(),Qe=!0);let s=[this.namespace,"enable"];this.enable=Ae(s,Xe,this.enable),Ut(s,Qt?this.enable?"true":"false":this.enable)}static get isEnabled(){return y.sharedConfig.enable}static get isDebug(){return y.sharedConfig.enable&&y.sharedConfig.debug}static loadConfig(){var t,s,i;Qt?(["enable","debug","info","warn"].forEach(a=>{this.sharedConfig[a]=Ae(a,Xe,this.sharedConfig[a])}),["debug","info","warn","error"].forEach(a=>{this.sharedStyles[a]=Ae(["styles",a],void 0,this.sharedStyles[a])}),y.isDebug&&console.debug(`${N}: Load config from localStorage`,y.sharedConfig),(t=globalThis[N])!=null&&t[he]||((s=globalThis[N])!=null||(globalThis[N]={[he]:!0,get enable(){return y.sharedConfig.enable},set enable(a){y.sharedConfig.enable=a,Ut("enable",a?"true":"false")},get debug(){return y.sharedConfig.debug},set debug(a){y.sharedConfig.debug=a,Ut("debug",a?"true":"false")},get info(){return y.sharedConfig.info},set info(a){y.sharedConfig.info=a,Ut("info",a?"true":"false")},get warn(){return y.sharedConfig.warn},set warn(a){y.sharedConfig.warn=a,Ut("warn",a?"true":"false")}}))):(i=globalThis[x])!=null&&i[he]||(globalThis[x]=we(we({[he]:!0},y.sharedConfig),globalThis[x]),y.sharedConfig=globalThis[x],y.isDebug&&console.debug(`${N}: Load config from ${x}`,globalThis[x]))}get isEnabled(){return this.enable&&y.sharedConfig.enable}get isDebug(){return this.isEnabled&&y.sharedConfig.debug}get isInfo(){return this.isEnabled&&y.sharedConfig.info}get isWarn(){return this.isEnabled&&y.sharedConfig.warn}debug(...t){C(this,mt,Wt).call(this,"debug",y.sharedStyles.debug,t)}info(...t){C(this,mt,Wt).call(this,"info",y.sharedStyles.info,t)}warn(...t){C(this,mt,Wt).call(this,"warn",y.sharedStyles.warn,t)}error(...t){C(this,mt,Wt).call(this,"error",y.sharedStyles.error,t)}},mt=new WeakSet,Wt=function(t,s,i){console[t](`%c${this.namespace}`,s,...i)},y.sharedConfig={enable:Ys,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"},y.sharedStyles={get debug(){return y.sharedConfig["styles.debug"]},set debug(t){y.sharedConfig["styles.debug"]=t},get info(){return y.sharedConfig["styles.info"]},set info(t){y.sharedConfig["styles.info"]=t},get warn(){return y.sharedConfig["styles.warn"]},set warn(t){y.sharedConfig["styles.warn"]=t},get error(){return y.sharedConfig["styles.error"]},set error(t){y.sharedConfig["styles.error"]=t}},y),Pt="*",Cs=1,Ve=2,$e=4,vt=Symbol.for("eventize"),Qs="[eventize]",pe=e=>e===Pt,Es=e=>{switch(typeof e){case"string":case"symbol":return!0;default:return!1}},Ss=typeof console<"u",Xs=Ss?console[console.warn?"warn":"log"].bind(console,Qs):()=>{},Zs=(e,t,s)=>(Object.defineProperty(e,t,{value:s,configurable:!0}),e),_s=0,ks=class{constructor(){f(this,"events",new Map);f(this,"eventNames",new Set)}static publish(e){e.sort((t,s)=>t.order-s.order).forEach(t=>t.emit())}add(e){Array.isArray(e)?e.forEach(t=>this.eventNames.add(t)):this.eventNames.add(e)}remove(e){Array.isArray(e)?e.forEach(t=>this.eventNames.delete(t)):this.eventNames.delete(e),this.clear(e)}clear(e){Array.isArray(e)?e.forEach(t=>this.events.delete(t)):this.events.delete(e)}retain(e,t){this.eventNames.has(e)&&this.events.set(e,{args:t,order:_s++})}isKnown(e){return this.eventNames.has(e)}emit(e,t,s=[]){if(pe(e))this.eventNames.forEach(i=>this.emit(i,t,s));else if(this.events.has(e)){let{order:i,args:a}=this.events.get(e);s.push({order:i,emit:()=>t.apply(e,a)})}return s}},Le=(e,t,s,i)=>{if(typeof t=="function"){let a=t.apply(e,s);a!=null&&(i==null||i(a))}},ti=(e,t,s,i)=>Le(t,t.emit,[e].concat(s),i),ei=e=>{switch(typeof e){case"function":return Cs;case"string":case"symbol":return Ve;case"object":return $e}},si=0,ii=()=>++si,As=class{constructor(e,t,s,i=null){f(this,"id");f(this,"eventName");f(this,"isCatchEmAll");f(this,"priority");f(this,"listener");f(this,"listenerObject");f(this,"listenerType");f(this,"callAfterApply");f(this,"isRemoved");f(this,"refCount");this.id=ii(),this.eventName=e,this.isCatchEmAll=pe(e),this.listener=s,this.listenerObject=i,this.priority=t,this.listenerType=ei(s),this.callAfterApply=void 0,this.isRemoved=!1,this.refCount=1}isEqual(e,t=null){if(e===this)return!0;let s=typeof e;return s==="number"&&e===this.id?!0:t===null&&(s==="string"||s==="symbol")?e===Pt||e===this.eventName:this.listener===e&&this.listenerObject===t}apply(e,t,s){if(this.isRemoved)return;let{listener:i,listenerObject:a}=this;switch(this.listenerType){case Cs:Le(a,i,t,s),this.callAfterApply&&this.callAfterApply();break;case Ve:Le(a,a[i],t,s),this.callAfterApply&&this.callAfterApply();break;case $e:{let o=i[e];if(this.isCatchEmAll||this.eventName===e){if(typeof o=="function"){let n=o.apply(i,t);n!=null&&(s==null||s(n))}else ti(e,i,t,s);this.callAfterApply&&this.callAfterApply()}break}}}},ri=(e,t)=>e.priority!==t.priority?t.priority-e.priority:e.id-t.id,Ze=e=>e==null?void 0:e.slice(0),_e=(e,t)=>{let s=e.indexOf(t);s>-1&&e.splice(s,1)},ai=e=>e===$e||e===Ve,Re=(e,t,s)=>{let i=e.findIndex(a=>a.isEqual(t,s));i>-1&&(e[i].isRemoved=!0,e.splice(i,1))},le=(e,t,s)=>{let i=[];for(let a of e)(t==null&&a.listenerObject===s||a.eventName===t&&a.listener===s)&&i.push(a);for(let a of i)Re(e,a,void 0)},Oe=e=>{e&&(e.forEach(t=>{t.isRemoved=!0}),e.length=0)},ni=(e,t)=>e.listenerType===t.listenerType?e.priority===t.priority&&e.eventName===t.eventName&&e.listenerObject===t.listenerObject&&e.listener===t.listener:!1,oi=(e,t)=>{if(ai(e.listenerType))return t.find(s=>ni(e,s))},hi=(e,t)=>{let s=oi(e,t);return s?(s.refCount+=1,s):(t.push(e),t.sort(ri),e)},li=class{constructor(){f(this,"namedListeners");f(this,"catchEmAllListeners");f(this,"getListenersForEventName",e=>{let t=this.namedListeners.get(e);return t||(t=[],this.namedListeners.set(e,t)),t});this.namedListeners=new Map,this.catchEmAllListeners=[]}add(e){return hi(e,e.isCatchEmAll?this.catchEmAllListeners:this.getListenersForEventName(e.eventName))}remove(e,t,s=!1){t==null&&Array.isArray(e)?e.forEach(i=>this.remove(i,null,s)):e==null||t==null&&pe(e)?this.removeAllListeners():t==null&&Es(e)?Oe(this.namedListeners.get(e)):e instanceof As?e.isRemoved||(e.refCount-=1,e.refCount<1&&(e.isRemoved=!0,this.namedListeners.forEach(i=>_e(i,e)),_e(this.catchEmAllListeners,e))):s?pe(e)&&typeof e=="object"?le(this.catchEmAllListeners,Pt,e):this.namedListeners.forEach(i=>le(i,e,t)):(this.namedListeners.forEach(i=>{Re(i,e,t),typeof e=="object"&&le(i,void 0,e)}),Re(this.catchEmAllListeners,e,t),typeof e=="object"&&le(this.catchEmAllListeners,void 0,e))}removeAllListeners(){this.namedListeners.forEach(e=>Oe(e)),this.namedListeners.clear(),Oe(this.catchEmAllListeners)}forEach(e,t){let s=Ze(this.catchEmAllListeners),i=Ze(this.namedListeners.get(e));if(e===Pt||!i||i.length===0)s.forEach(t);else if(s.length===0)i.forEach(t);else{let a=i.length,o=s.length,n=0,l=0;for(;n<a||l<o;){if(n<a){let p=i[n];if(l>=o||p.priority>=s[l].priority){t(p),++n;continue}}l<o&&(t(s[l]),++l)}}}getSubscriptionCount(){let e=this.catchEmAllListeners.length;for(let t of this.namedListeners.values())e+=t.length;return e}},$t=e=>!!(e&&e[vt]);function Xt(e){if($t(e))return e;let t=new li,s=new ks;return Zs(e,vt,{keeper:s,store:t}),e}var be={Max:Number.POSITIVE_INFINITY,AAA:1e9,BB:1e6,C:1e3,Default:0,Low:-1e4,Min:Number.NEGATIVE_INFINITY},di=(e,t,s,i,a,o,n)=>{let l=e.add(new As(s,i,a,o));return t.emit(s,l,n),l},ui=(e,t,s,i)=>{let a=s.length,o=typeof s[0],n,l,p,b;if(a>=2&&a<=3&&o==="number"?(n=Pt,[l,p,b]=s):a>=3&&a<=4&&typeof s[1]=="number"?[n,l,p,b]=s:(l=be.Default,o==="string"||o==="symbol"||Array.isArray(s[0])?[n,p,b]=s:(n=Pt,[p,b]=s)),!p&&Ss)throw Xs("called with insufficient arguments!",s),"subscribeTo() called with insufficient arguments!";let m=h=>d=>di(e,t,d,h,p,b,i);return Array.isArray(n)?n.map(h=>Array.isArray(h)?m(h[1])(h[0]):m(l)(h)):m(l)(n)},Os=(e,t,s)=>{let i=[],a=ui(e,t,s,i);return ks.publish(i),a},ts=e=>t=>{t.callAfterApply=()=>{e==null||e()}},Ps=(e,t)=>Object.assign(()=>V(e,t),Array.isArray(t)?{listeners:t}:{listener:t}),Ms=(e,t,s,i)=>{let{store:a,keeper:o}=e[vt];Array.isArray(t)?t.forEach(n=>{a.forEach(n,l=>l.apply(n,s,i)),o.retain(n,s)}):t!==Pt&&(a.forEach(t,n=>{n.apply(t,s,i)}),o.retain(t,s))},_=(e,...t)=>{let s=Xt(e),{store:i,keeper:a}=s[vt];return Ps(s,Os(i,a,t))},M=(e,...t)=>{let s=Xt(e),{store:i,keeper:a}=s[vt],o=Os(i,a,t),n=Ps(s,o),l=!1,p=()=>{l||(n(),l=!0)};return Array.isArray(o)?o.forEach(ts(p)):ts(p)(o),p},ci=(e,t)=>new Promise(s=>{M(e,t,s)}),V=(e,t,s)=>{if(!$t(e))throw new Error("object is not eventized");let{store:i,keeper:a}=e[vt],o=typeof t,n=s!=null&&(o==="string"||o==="symbol");i.remove(t,s,n),Array.isArray(t)?a.remove(t.filter(l=>typeof l=="string")):Es(t)&&a.remove(t)},E=(e,t,...s)=>{if(!$t(e))throw new Error("object is not eventized");Ms(e,t,s)},fi=(e,t,...s)=>{if(!$t(e))throw new Error("object is not eventized");let i=[];return Ms(e,t,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()},Ie=(e,t)=>{let s=Xt(e),{keeper:i}=s[vt];i.add(t)},ye=(e,t)=>{if(!$t(e))throw new Error("object is not eventized");let{keeper:s}=e[vt];s.clear(t)},ot=(()=>{let e=(t={})=>Xt(t);return e.inject=(t={})=>(t=Xt(t),Object.assign(t,{on:(...s)=>_(t,...s),once:(...s)=>M(t,...s),onceAsync:s=>ci(t,s),off:(s,i)=>V(t,s,i),emit:(s,...i)=>E(t,s,...i),emitAsync:(s,...i)=>fi(t,s,...i),retain:s=>Ie(t,s),retainClear:s=>ye(t,s)}),t),e.is=$t,e})(),Z=Symbol.for("signal"),Mt=Symbol.for("effect"),es=Symbol.for("destroySignal"),ss=Symbol.for("createEffect"),gi=Symbol.for("destroyEffect"),Bt="value",is="mute",rs="unmute",Yt="destroy",Ht=Symbol.for("recall"),ve=ot(),Nt=ot(),bt=ot(),js=ot(),je,qt=(je=class{constructor(){f(this,"delayedEffects",[])}batch(e,t){let s=this.delayedEffects.length;for(let i=0;i<s;i++){let[a,o]=this.delayedEffects[i];if(!(a>t))if(a===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=[_(bt,(i,a)=>{a===Ht&&e.add(i)}),_(js,i=>{e.add(i)})],s=this.delayedEffects.flatMap(([,i])=>Array.from(i));for(let i of s)e.has(i)||E(bt,i,i,Ht);t.forEach(i=>{i()})}},f(je,"current"),je),pi=()=>qt.current;function Zt(e){let t=qt.current;t?t=void 0:t=qt.current=new qt;try{e()}finally{t&&(qt.current=void 0,t.run())}}var yi=0;function Ts(){return yi>0}var fs,vi=(fs=Mt,class{constructor(e){f(this,fs);f(this,"run",()=>{var e;return(e=this[Mt])==null?void 0:e.run()});f(this,"destroy",()=>{var e;(e=this[Mt])==null||e.destroy(),this[Mt]=void 0});this[Mt]=e,M(e,Rs.Destroy,()=>{this[Mt]=void 0})}}),ht=new Map,J,wt,G,it,K,Ct,Et,U,St,nt,ne=(nt=class{constructor(t){g(this,J,new Set);g(this,wt,new Set);g(this,G,new Map);g(this,it,new WeakMap);g(this,K,new Map);g(this,Ct,new Set);g(this,Et,new Set);g(this,U);g(this,St);if(t!=null&&t instanceof nt)return t;if(t!=null||(t=this),ht.has(t))return ht.get(t);c(this,St,t),ht.set(t,this),ot(this)}static get(t){if(t!=null)return t instanceof nt?t:ht.get(t)}static findOrCreate(t){if(t==null)throw new Error("Cannot create a group with a null object");return new nt(t)}static destroy(t){console.warn("SignalGroup.destroy(obj) is deprecated. Use SignalGroup.delete(obj) instead."),nt.delete(t)}static delete(t){var s;(s=ht.get(t))==null||s.clear()}static clear(){for(let t of ht.values())t.destroy();ht.clear()}attachGroup(t){if(t===this)throw new Error("Cannot attach a group to itself");return r(this,J).add(t),r(t,U)&&r(t,U)!==this&&r(r(t,U),J).delete(t),c(t,U,this),t}detachGroup(t){return t!==this&&r(this,J).has(t)&&(r(this,J).delete(t),c(t,U,void 0)),t}attachSignal(t){let s=A(t);if(s!=null&&s.destroyed)throw new Error("Cannot attach a destroyed signal to a group");return s&&r(this,wt).add(s),t}attachSignalByName(t,s){if(s){this.attachSignal(s);let i=A(s);r(this,G).set(t,i),r(this,K).has(t)?r(this,K).get(t).push(i):r(this,K).set(t,[i]),r(this,it).has(i)?r(this,it).get(i).add(t):r(this,it).set(i,new Set([t]))}else r(this,G).delete(t);return s}hasSignal(t){var s;return r(this,G).has(t)||!!((s=r(this,U))!=null&&s.hasSignal(t))}signal(t){var s,i,a;return(a=(s=r(this,G).get(t))==null?void 0:s.object)!=null?a:(i=r(this,U))==null?void 0:i.signal(t)}detachSignal(t){let s=A(t);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 t}attachEffect(t){return r(this,Ct).add(t),t}runEffects(){for(let t of r(this,Ct))t.run();for(let t of r(this,J))t.runEffects()}attachLink(t){if(t!=null&&t.isDestroyed)throw new Error("Cannot attach a destroyed link to a group");return t&&r(this,Et).add(t),t}detachLink(t){return t&&r(this,Et).delete(t),t}destroy(){console.warn("SignalGroup#destroy is deprecated. Use SignalGroup#clear instead."),this.clear()}clear(){var t;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(),(t=r(this,U))==null||t.detachGroup(this),r(this,St)&&(ht.delete(r(this,St)),c(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,gs,Ds=(gs=class{constructor(e="id",t=1){g(this,se);g(this,ie);c(this,se,e),c(this,ie,t)}make(){return Symbol(`${r(this,se)}${Je(this,ie)._++}`)}},se=new WeakMap,ie=new WeakMap,gs),xe=[],Ls=()=>xe.at(-1),bi=(e,t)=>{xe.push(e);try{return t()}finally{xe.pop()}},mi=e=>e!=null&&typeof e.then=="function",P,lt,Y,kt,dt,ut,At,Dt,Rs=(P=class{constructor(t,s){f(this,"id");f(this,"callback");g(this,lt);g(this,Y,new Set);g(this,kt,new Set);g(this,dt,new Map);g(this,ut,new Set);f(this,"parentEffect");f(this,"childEffects",[]);f(this,"curChildEffectSlot",0);f(this,"autorun",!0);f(this,"shouldRun",!0);f(this,"priority");g(this,At);g(this,Dt,!1);f(this,"run",()=>{if(r(this,Dt)||!this.shouldRun)return;let t=pi();t?t.batch(this.id,this.priority):(this.runCleanupCallback(),this.curChildEffectSlot=0,this.shouldRun=!1,E(js,this.id,this.id),this.hasStaticDeps()?c(this,lt,this.callback()):(c(this,kt,new Set(r(this,Y))),c(this,lt,bi(this,this.callback)),this.cleanupLostSignals(),r(this,ut).clear()))});f(this,"destroy",()=>{r(this,Dt)||(E(this,P.Destroy,this),V(this),E(bt,gi,this),this.runCleanupCallback(),V(ve,this),V(bt,this),V(Nt,this),c(this,Dt,!0),r(this,Y).clear(),r(this,kt).clear(),r(this,dt).clear(),r(this,ut).clear(),this.childEffects.forEach(t=>{t.destroy()}),this.childEffects.length=0,--P.count)});var a,o;ot(this),this.callback=t;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,c(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=P.idGen.make(),this.priority=(o=s==null?void 0:s.priority)!=null?o:0,_(bt,this.id,Ht,this),++P.count}hasStaticDeps(){return r(this,At)!=null&&r(this,At).length>0}saveSignalsFromDeps(){for(let t of r(this,At))this.whenSignalIsRead(A(t).id)}static createEffect(t,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,l=Ls();return l!=null?(n=l.getCurrentChildEffect(),n==null&&(n=new P(t,o),l.attachChildEffect(n),E(bt,ss,n)),l.curChildEffectSlot++):(n=new P(t,o),E(bt,ss,n)),n.hasStaticDeps()?n.saveSignalsFromDeps():n.autorun&&n.run(),new vi(n)}getCurrentChildEffect(){return this.childEffects[this.curChildEffectSlot]}attachChildEffect(t){this.childEffects.push(t),this.parentEffect=this}[Ht](){this.shouldRun=!0,this.autorun&&this.run()}whenSignalIsRead(t){r(this,kt).delete(t),r(this,Y).has(t)||(r(this,Y).add(t),r(this,dt).set(t,[_(ve,t,this.priority,Ht,this),M(Nt,t,es,this)]))}[es](t){!r(this,ut).has(t)&&r(this,Y).has(t)&&(r(this,ut).add(t),this.unsubscribeSignal(t),r(this,ut).size===r(this,Y).size&&this.destroy())}cleanupLostSignals(){for(let t of r(this,kt))this.unsubscribeSignal(t),r(this,Y).delete(t)}unsubscribeSignal(t){r(this,dt).has(t)&&(r(this,dt).get(t).forEach(s=>{s()}),r(this,dt).delete(t))}runCleanupCallback(){if(r(this,lt)!=null){let t=r(this,lt);c(this,lt,void 0),mi(t)?Promise.resolve(t).then(s=>{typeof s=="function"&&s()}):t()}}},lt=new WeakMap,Y=new WeakMap,kt=new WeakMap,dt=new WeakMap,ut=new WeakMap,At=new WeakMap,Dt=new WeakMap,f(P,"idGen",new Ds("ef")),f(P,"Destroy","destroy"),f(P,"count",0),P),Vt=(...e)=>Rs.createEffect(...e),_t=new WeakMap,wi=e=>{let t=_t.get(e);return t||(t={},_t.set(e,t)),t},te=(e,t)=>{var s,i;return(i=(s=_t.get(e))==null?void 0:s.signals)==null?void 0:i.get(t)},Ci=(e,t,s)=>{var a;let i=wi(e);(a=i.signals)!=null||(i.signals=new Map),i.signals.set(t,s)};function Ei(...e){for(let t of e)if(_t.has(t)){let s=_t.get(t);if(s.signals){for(let i of s.signals.values())I(i);s.signals.clear(),s.signals=void 0}}}function Si(e){let t=A(ee(e)?e:te(...e));t!=null&&!t.muted&&!t.destroyed&&ze(t.id,t.value,{touch:!0})}function Ge(e){var t,s;return ee(e)?(t=A(e))==null?void 0:t.value:(s=A(te(...e)))==null?void 0:s.value}var ps,ki=(ps=Z,class{constructor(e){f(this,ps);this[Z]=e}get get(){return this[Z].reader}get set(){return this[Z].writer}get value(){return Ge(this.get)}set value(e){this.set(e)}onChange(e){let{destroy:t}=Vt(()=>e(this.value),[this.get]);return t}get muted(){return this[Z].muted}set muted(e){this[Z].muted=e}touch(){Si(this)}destroy(){I(this)}}),Ai=new Ds("si");function as(e){var t;Ts()||((t=Ls())==null||t.whenSignalIsRead(e))}function ze(e,t,s){Ts()||E(ve,e,t,s)}var ee=e=>e!=null&&e[Z]!=null,Oi=e=>{let t=s=>{var i;return s?Vt(()=>(e.destroyed||as(e.id),s(e.value)),[t]):e.destroyed||((i=e.beforeRead)==null||i.call(e),as(e.id)),e.value};return Object.defineProperty(t,Z,{value:e}),t},Ot,B,xs=(Ot=class{constructor(t,s){f(this,"id");f(this,"lazy");f(this,"compare");f(this,"beforeRead");f(this,"muted",!1);f(this,"destroyed",!1);g(this,B);f(this,"valueFn");f(this,"reader");f(this,"writer",(t,s)=>{var o,n,l,p;let i=(o=s==null?void 0:s.lazy)!=null?o:!1,a=(l=(n=s==null?void 0:s.compare)!=null?n:this.compare)!=null?l:((b,m)=>b===m);if((i!==this.lazy||i&&t!==this.valueFn||!i&&!a(t,r(this,B)))&&(i?(c(this,B,void 0),this.valueFn=t,this.lazy=!0):(c(this,B,t),this.valueFn=void 0,this.lazy=!1),!this.muted&&!this.destroyed)){ze(this.id,r(this,B));return}(p=s==null?void 0:s.touch)!=null&&p&&ze(this.id,r(this,B),{touch:!0})});f(this,"object");this.id=Ai.make(),++Ot.instanceCount,this.lazy=t,this.lazy?(this.value=void 0,this.valueFn=s):(this.value=s,this.valueFn=void 0),this.reader=Oi(this),this.object=new ki(this)}get[Z](){return this}get value(){return this.lazy&&(c(this,B,this.valueFn()),this.valueFn=void 0,this.lazy=!1),r(this,B)}set value(t){c(this,B,t)}},B=new WeakMap,f(Ot,"instanceCount",0),Ot),A=e=>e==null?void 0:e[Z];function k(e=void 0,t){var i;let s;if(ee(e))s=A(e);else{let a=(i=t==null?void 0:t.lazy)!=null?i:!1;s=new xs(a,e),s.beforeRead=t==null?void 0:t.beforeRead,s.compare=t==null?void 0:t.compare}return(t==null?void 0:t.attach)!=null&&ne.findOrCreate(t.attach).attachSignal(s),s.object}var I=(...e)=>{for(let t of e){let s=A(t);s!=null&&!s.destroyed&&(s.destroyed=!0,s.beforeRead=void 0,--xs.instanceCount,E(Nt,s.id,s.id))}};function Pi(e,t){var n,l;let s=k(),i=(t==null?void 0:t.attach)!=null?ne.findOrCreate(t.attach):void 0;i!=null&&(t!=null&&t.name?i.attachSignalByName(t.name,s):i.attachSignal(s));let a=Vt(()=>{Zt(()=>{s.set(e())})},{autorun:!((n=t==null?void 0:t.lazy)!=null&&n),priority:(l=t==null?void 0:t.priority)!=null?l:be.C,attach:i}),o=A(s);return o.beforeRead=a.run,M(Nt,o.id,a.destroy),s.get}var O,Lt,ys,zs=(ys=class{constructor(e){g(this,O,!1);g(this,Lt);f(this,"source");f(this,"lastValue");f(this,"isDestroyed",!1);ot(this),this.source=A(e),c(this,Lt,_(ve,this.source.id,(t,s)=>{!r(this,O)&&!this.isDestroyed&&((s==null?void 0:s.touch)===!0?this.touch():this.write())})),M(Nt,this.source.id,()=>this.destroy())}attach(e){let t=ne.findOrCreate(e);return t.attachLink(this),M(this,Yt,()=>{t.detachLink(this)}),t}nextValue(){return new Promise((e,t)=>{let s=[],i=()=>s.forEach(a=>{a()});s.push(M(this,Bt,a=>{i(),e(a)}),M(this,Yt,()=>{i(),t()}))})}asyncValues(e){return Ke(this,null,function*(){let t=0;for(;!this.isDestroyed;)try{let s=yield new Ee(this.nextValue());if(e&&e(s,t++))break;Ie(this,Bt),yield s}catch(s){break}ye(this,Bt)})}destroy(){var e;this.isDestroyed||((e=r(this,Lt))==null||e.call(this),c(this,Lt,void 0),E(this,Yt,this),ye(this,Bt),V(this),this.lastValue=void 0,this.isDestroyed=!0,Object.freeze(this))}get isMuted(){return r(this,O)}mute(){return!this.isDestroyed&&!r(this,O)&&(c(this,O,!0),E(this,is,this)),this}unmute(){return!this.isDestroyed&&r(this,O)&&(c(this,O,!1),E(this,rs,this)),this}toggleMute(){return this.isDestroyed||(c(this,O,!r(this,O)),E(this,r(this,O)?is:rs,this)),r(this,O)}updateValue(e){if(!r(this,O)&&!this.isDestroyed){let{value:t}=this.source;e(t),E(this,Bt,t),this.lastValue=t}}},O=new WeakMap,Lt=new WeakMap,ys),Mi=class extends zs{constructor(t,s){super(t);f(this,"target");this.target=A(s),M(Nt,this.target.id,()=>this.destroy()),this.touch()}touch(){return this.updateValue(t=>{this.target.writer(t,{touch:!0})}),this}write(){this.updateValue(t=>{this.target.writer(t)})}},ji=class extends zs{constructor(t,s){super(t);f(this,"target");this.target=s,this.touch()}touch(){return this.updateValue(t=>{this.target(t)}),this}write(){this.updateValue(t=>{this.target(t)})}},de=new Map;function et(e,t,s){var b;let i=A(e),a;if(de.has(i)){a=de.get(i);let m=(b=A(t))!=null?b:t;if(a.has(m))return a.get(m)}else a=new Map,de.set(i,a);let o=A(t),n=o!=null?new Mi(e,o):new ji(e,t),l=s==null?void 0:s.attach;l&&n.attach(l);let p=o!=null?o:t;return a.set(p,n),M(n,Yt,()=>{a.delete(p),a.size===0&&de.delete(i)}),n}var D,Rt,Ti=(Rt=class{constructor(){g(this,D,new Map)}static fromProps(t,s){let i=new Rt,a=s?s.map(o=>[o,t[o]]):Object.entries(t);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 t of r(this,D).values())t.destroy();r(this,D).clear()}has(t){return r(this,D).has(t)}get(t){if(!r(this,D).has(t)){let s=k();return r(this,D).set(t,s),s}return r(this,D).get(t)}update(t){t.size&&Zt(()=>{for(let[s,i]of t.entries())this.get(s).set(i)})}updateFromProps(t,s){Zt(()=>{let i=s?s.map(a=>[a,t[a]]):Object.entries(t);for(let[a,o]of i)this.get(a).set(o)})}},D=new WeakMap,Rt);function Di(e,t,s,i,a,o){function n($){if($!==void 0&&typeof $!="function")throw new TypeError("Function expected");return $}for(var l=i.kind,p=l==="getter"?"get":l==="setter"?"set":"value",b=!t&&e?i.static?e:e.prototype:null,m=t||(b?Object.getOwnPropertyDescriptor(b,i.name):{}),h,d=!1,u=s.length-1;u>=0;u--){var v={};for(var w in i)v[w]=w==="access"?{}:i[w];for(var w in i.access)v.access[w]=i.access[w];v.addInitializer=function($){if(d)throw new TypeError("Cannot add initializers after decoration has completed");o.push(n($||null))};var T=(0,s[u])(l==="accessor"?{get:m.get,set:m.set}:m[p],v);if(l==="accessor"){if(T===void 0)continue;if(T===null||typeof T!="object")throw new TypeError("Object expected");(h=n(T.get))&&(m.get=h),(h=n(T.set))&&(m.set=h),(h=n(T.init))&&a.unshift(h)}else(h=n(T))&&(l==="field"?a.unshift(h):m[p]=h)}b&&Object.defineProperty(b,i.name,m),d=!0}function ns(e,t,s){for(var i=arguments.length>2,a=0;a<t.length;a++)s=i?t[a].call(e,s):t[a].call(e);return i?s:void 0}function Li(e){return function(t,s){var o;let i=(e==null?void 0:e.name)||s.name,a=!!((o=e==null?void 0:e.readAsValue)!=null&&o);return{get(){let n=te(this,i);if(n)return a?n.value:n.get()},set(n){var l;(l=te(this,i))==null||l.set(n)},init(n){let l=k(n,e);return Ci(this,i,l),ne.findOrCreate(this).attachSignalByName(i,l),l.value}}}}var jt="value",Fe=(()=>{var i,a,o,n,fe,Jt,b;let e,t=[],s=[];return b=class{constructor(h){g(this,n);g(this,i);g(this,a);g(this,o);c(this,i,[]),c(this,o,ns(this,t,void 0)),this.value$=ns(this,s),Ie(this,jt),this.value$=te(this,jt),this.value$.onChange(d=>E(this,jt,d)),h&&this.add(...h)}get value(){return r(this,o)}set value(h){c(this,o,h)}add(...h){return r(this,i).push(...h),C(this,n,Jt).call(this),C(this,n,fe).call(this,h)}unshift(...h){return r(this,i).unshift(...h),C(this,n,Jt).call(this),C(this,n,fe).call(this,h)}remove(...h){C(this,n,fe).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(),c(this,a,void 0),ye(this,jt),V(this),this.value$.destroy(),Ei(this)}},i=new WeakMap,a=new WeakMap,o=new WeakMap,n=new WeakSet,fe=function(h){return()=>{for(let d of h){let u=r(this,i).indexOf(d);u!==-1&&r(this,i).splice(u,1)}C(this,n,Jt).call(this)}},Jt=function(){var h;(h=r(this,a))==null||h.destroy(),r(this,i).length===0?(c(this,a,void 0),this.value=void 0):(c(this,a,Vt(()=>{let d;for(let u of r(this,i)){let v=Ge(u);if(v!=null){d=v;break}}this.value=d},r(this,i))),r(this,a).run())},(()=>{let h=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;e=[Li({name:jt})],Di(b,null,e,{kind:"accessor",name:"value",static:!1,private:!1,access:{has:d=>"value"in d,get:d=>d.value,set:(d,u)=>{d.value=u}},metadata:h},t,s),h&&Object.defineProperty(b,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})})(),b.Value=jt,b})(),os="onCreate",Tt="onDestroy",Ri="onParentChanged",xi="onViewEvent",Pe=new Map,Me=!1,zi=(e,t)=>{Pe.set(e,t),Me||(Me=!0,queueMicrotask(()=>{Me=!1;let s=Array.from(Pe.entries());Pe.clear();for(let[i,a]of s)i.set(a)}))},H,xt,ct,W,ft,z,L,rt,F,zt,j,Ne,gt,Kt,ge,vs,Fi=(vs=class{constructor(e,t){g(this,j);g(this,H);g(this,xt);g(this,ct,new Ti);g(this,W,new Map);g(this,ft,new Map);g(this,z);g(this,L);g(this,rt,new Set);g(this,F,[]);g(this,zt,0);g(this,gt);c(this,H,e),c(this,xt,t),M(this,Tt,be.Min,this)}get kernel(){return r(this,H)}get uuid(){return r(this,xt)}get order(){return r(this,zt)}set order(e){r(this,zt)!==e&&(c(this,zt,e),r(this,z)&&this.parent.resortChildren())}get parentUuid(){return r(this,z)||void 0}set parentUuid(e){r(this,z)!==e&&(this.removeFromParent(),c(this,z,e||void 0),c(this,L,e?r(this,H).getEntity(e):void 0),r(this,L)&&r(this,L).addChild(this))}get parent(){return!r(this,L)&&r(this,z)&&c(this,L,r(this,H).getEntity(r(this,z))),r(this,L)}set parent(e){this.parentUuid=e==null?void 0:e.uuid}get hasParent(){return!!r(this,z)}get children(){return r(this,F)}traverse(e){e(this);for(let t of r(this,F))t.traverse(e)}onDestroy(){var e;r(this,ct).clear(),V(this);for(let t of r(this,ft).values())t.cleanup(),t.signal.destroy();r(this,ft).clear();for(let t of r(this,W).values())t.context.set(void 0),t.unsubscribePathValue(),(e=t.unsubscribeFromParent)==null||e.call(t),t.valuePath.dispose(),t.inherited.destroy(),t.provide.destroy(),t.context.destroy();c(this,z,void 0),c(this,L,void 0),r(this,rt).clear(),r(this,F).length=0}addChild(e){var t;if(r(this,F).length===0){r(this,rt).add(e.uuid),r(this,F).push(e);return}if(r(this,rt).has(e.uuid))throw new Error(`child with uuid: ${e.uuid} already exists! parentUuid: ${this.uuid}`);r(this,rt).add(e.uuid),r(this,F).push(e),this.resortChildren();for(let[,s]of r(e,W))C(t=e,j,ge).call(t,s)}resortChildren(){r(this,F).sort((e,t)=>e.order-t.order)}removeChild(e){r(this,rt).has(e.uuid)&&(r(this,rt).delete(e.uuid),r(this,F).splice(r(this,F).indexOf(e),1))}removeFromParent(){if(r(this,L)){r(this,L).removeChild(this),c(this,L,void 0),c(this,z,void 0);for(let[,e]of r(this,W))e.unsubscribeFromParent&&(e.unsubscribeFromParent(),e.unsubscribeFromParent=void 0)}}reSubscribeToParentContexts(){for(let[,e]of r(this,W))C(this,j,ge).call(this,e)}dispatchMessageToView(e,t,s,i=!1){r(this,H).dispatchMessageToView({uuid:r(this,xt),type:e,data:t,transferables:s,traverseChildren:i})}dispatchViewEvents(e){for(let{type:t,data:s}of e)E(this,xi,t,s)}dispatchViewEvent(e,t){this.dispatchViewEvents([{type:e,data:t}])}getPropertyReader(e){return C(this,j,Ne).call(this,e).get}getPropertyWriter(e){return C(this,j,Ne).call(this,e).set}setProperties(e){this.clearTruthyPropsCache(),Zt(()=>{for(let[t,s]of e)this.setProperty(t,s)})}setProperty(e,t){this.getPropertyWriter(e)(t)}getProperty(e){return Ge(this.getPropertyReader(e))}propKeys(){return Array.from(r(this,ct).keys())}propEntries(){return Array.from(r(this,ct).entries()).map(([e,t])=>[e,t.value])}clearTruthyPropsCache(){c(this,gt,void 0)}truthyProps(){if(r(this,gt))return r(this,gt).size?r(this,gt):void 0;let e=new Set;for(let[t,s]of r(this,ct).entries())if(typeof t=="string"){let i=s.value;i!=null&&i!==!1&&i!==""&&e.add(t)}return c(this,gt,e),e.size?e:void 0}hasContext(e){return r(this,W).has(e)}useContext(e){return C(this,j,Kt).call(this,e).context.get}useParentContext(e){return C(this,j,Kt).call(this,e).inherited.get}provideContext(e){return C(this,j,Kt).call(this,e).provide}provideGlobalContext(e){if(r(this,ft).has(e))return r(this,ft).get(e).signal;let t=r(this,H).findOrCreateRootContext(e),s=k(),i=t.add(s);return r(this,ft).set(e,{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,Ne=function(e){return r(this,ct).get(e)},gt=new WeakMap,Kt=function(e){if(r(this,W).has(e))return r(this,W).get(e);let t=k(),s=k(),i=k(),a=new Fe([s,t]),o=_(a,Fe.Value,l=>{zi(i,l)}),n={name:e,inherited:t,provide:s,context:i,valuePath:a,unsubscribePathValue:o};return r(this,W).set(e,n),C(this,j,ge).call(this,n),n},ge=function(e){var t,s;if((t=e.unsubscribeFromParent)==null||t.call(e),e.unsubscribeFromParent=void 0,this.parent){let i=C(s=this.parent,j,Kt).call(s,e.name),a=et(i.context,e.inherited);e.unsubscribeFromParent=a.destroy.bind(a)}else{let i=r(this,H).findOrCreateRootContext(e.name),a=et(i.value$,e.inherited);e.unsubscribeFromParent=a.destroy.bind(a)}},vs);function Ni(e,t){e.indexOf(t)===-1&&e.push(t)}var hs=e=>{let t=e.split("@").map(s=>s.trim());if(t.length===2&&t[1])return t[0]?{key:`${t[0]}@${t[1]}`,prop:t[1],token:t[0]}:{key:t[1],prop:t[1]}},ue=(e,t)=>{for(let s of t)e.add(s)},Vi=(e,t)=>{if(e!=null)for(let s of e.constructors)t.add(s)},at,R,q,bs,Fs=(bs=class{constructor(){g(this,at,new Map);g(this,R,new Map);g(this,q,new Map)}static get(e){return e!=null?e:$i}define(e,t){r(this,at).has(e)?Ni(r(this,at).get(e).constructors,t):r(this,at).set(e,{token:e,constructors:[t]})}appendRoute(e,t){let s=hs(e);s?r(this,q).has(s.key)?ue(r(this,q).get(s.key).routes,t):r(this,q).set(s.key,{routes:new Set(t),token:s.token}):r(this,R).has(e)?ue(r(this,R).get(e),t):r(this,R).set(e,new Set(t))}clearRoute(e){let t=hs(e);t?r(this,q).delete(t.key):r(this,R).delete(e)}findTokensByRoute(e,t){let s=new Set([e]),i=r(this,R).has(e)?[...r(this,R).get(e)]:[];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(t){for(let o of t)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 t){let l=`${o}@${n}`;r(this,q).has(l)&&ue(s,r(this,q).get(l).routes)}}while(a!==s.size)}return s}findConstructors(e,t){let s=this.findTokensByRoute(e,t),i=new Set;for(let a of s)Vi(r(this,at).get(a),i);return i.size>0?Array.from(i):void 0}hasToken(e){return r(this,at).has(e)}hasRoute(e){return r(this,R).has(e)}clear(){r(this,at).clear(),r(this,R).clear()}},at=new WeakMap,R=new WeakMap,q=new WeakMap,bs),$i=new Fs,st;(function(e){e[e.CreateAndDestroy=0]="CreateAndDestroy",e[e.JustCreate=1]="JustCreate",e[e.DestroyOnly=2]="DestroyOnly"})(st||(st={}));var ls=e=>e.displayName||e.name,ce=!1,S,Q,Ft,re,X,pt,ms,Ii=(ms=class{constructor(e){g(this,S);g(this,Q);g(this,Ft);g(this,re);g(this,X);g(this,pt);this.logger=new Hs("Kernel"),c(this,S,new Map),c(this,Q,new Set),c(this,X,!0),c(this,pt,new Map),ot(this),this.registry=Fs.get(e)}getEntity(e){var s;let t=(s=r(this,S).get(e))==null?void 0:s.entity;if(!t)throw new Error(`entity with uuid "${e}" not found!`);return t}hasEntity(e){return r(this,S).has(e)}traverseLevelOrderBFS(e=!1){if(r(this,X)){let t=new Map,s=(i,a)=>{let o=this.getEntity(i);t.has(a)?t.get(a).push(o):t.set(a,[o]);for(let n of o.children)s(n.uuid,a+1)};r(this,Q).forEach(i=>{s(i,0)}),c(this,Ft,Array.from(t.entries()).sort((i,a)=>i[0]-a[0]).flatMap(([,i])=>i)),c(this,re,r(this,Ft).slice().reverse()),c(this,X,!1)}return e?r(this,re):r(this,Ft)}getEntityGraph(){return Array.from(r(this,Q)).map(e=>this.getEntityGraphNode(e))}getEntityGraphNode(e){if(!r(this,S).has(e))return;let{token:t,entity:s}=r(this,S).get(e);return{token:t,entity:s,props:Object.fromEntries(s.propEntries()),children:s.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,st.DestroyOnly));for(let t of this.traverseLevelOrderBFS(!1))this.updateShadowObjects(t.uuid,st.JustCreate,e.get(t.uuid));e.clear()}run(e){this.logger.isDebug&&this.logger.debug("sync",e),Zt(()=>{for(let t of e.changeTrail)this.parse(t)})}parse(e){switch(e.type){case tt.CreateEntities:this.createEntity(e.uuid,e.token,e.parentUuid,e.order,e.properties),c(this,X,!0);break;case tt.DestroyEntities:this.destroyEntity(e.uuid),c(this,X,!0);break;case tt.SetParent:this.setParent(e.uuid,e.parentUuid,e.order),c(this,X,!0);break;case tt.UpdateOrder:this.updateOrder(e.uuid,e.order),c(this,X,!0);break;case tt.ChangeProperties:this.changeProperties(e.uuid,e.properties);break;case tt.ChangeToken:this.changeToken(e.uuid,e.token);break;case tt.SendEvents:this.dispatchEventsToEntity(e.uuid,e.events);break}}createEntity(e,t,s,i=0,a){let o=new Fi(this,e);o.order=i;let n={token:t,entity:o,usedConstructors:new Map};r(this,S).set(e,n),s&&(o.parentUuid=s),o.hasParent||r(this,Q).add(e),a&&o.setProperties(a),this.createShadowObjects(e)}destroyEntity(e){if(!r(this,S).has(e))return;let{entity:t,usedConstructors:s}=r(this,S).get(e);t.removeFromParent(),E(t,Tt,this),s.clear(),r(this,S).delete(t.uuid),r(this,Q).delete(t.uuid)}setParent(e,t,s=0){let i=this.getEntity(e);i.parentUuid===t&&i.order===s||(i.removeFromParent(),i.order=s,i.parentUuid=t,i.hasParent?r(this,Q).delete(e):r(this,Q).add(e),i.reSubscribeToParentContexts(),queueMicrotask(()=>{this.logger.isDebug&&this.logger.debug("entity.onParentChanged",{uuid:e,parentUuid:t,order:s,entity:i}),E(i,Ri,i)}))}updateOrder(e,t){this.getEntity(e).order=t}dispatchEventsToEntity(e,t){var s;(s=this.getEntity(e))==null||s.dispatchViewEvents(t)}changeProperties(e,t){this.getEntity(e).setProperties(t),this.updateShadowObjects(e)}changeToken(e,t){if(!r(this,S).has(e))return;let s=r(this,S).get(e);s.token!==t&&(s.token=t,this.updateShadowObjects(e))}dispatchMessageToView(e){queueMicrotask(()=>{E(this,Te,e)})}updateShadowObjects(e,t=st.CreateAndDestroy,s){let i=r(this,S).get(e);s!=null||(s=new Set(this.registry.findConstructors(i.token,i.entity.truthyProps())));let a=t===st.CreateAndDestroy||t===st.DestroyOnly,o=t===st.CreateAndDestroy||t===st.JustCreate;if(a){for(let[n,l]of i.usedConstructors)if(!s.has(n)){i.usedConstructors.delete(n);for(let p of l)this.destroyShadowObject(p,i.entity)}}if(o)for(let n of s)i.usedConstructors.has(n)||this.constructShadowObject(n,i);return s}constructShadowObject(e,t){let s=new Set,i=new Set,a=new Map,o=new Map,n=new Map,l=new Map,p=new Map,b=(h,d)=>{let u=p.get(h);if(u===void 0){u=k(void 0,d?{compare:d}:void 0).get,p.set(h,u);let v=et(t.entity.getPropertyReader(h),u);i.add(v.destroy.bind(v))}return u},m=ot(new e({entity:t.entity,provideContext(h,d,u){var T;let v=n.get(h);!ce&&typeof u!="function"&&(console.warn(\'[shadow-objects] Deprecation Warning: The "isEqual" option of "provideContext()" and "provideGlobalContext()" is now passed as {compare} argument. Please update your code accordingly.\'),ce=!0);let w=typeof u=="function"?{compare:u}:u;if(v==null){let $=ee(d);if(v=k($?void 0:d,w!=null&&w.compare?{compare:w.compare}:void 0),$){let Gt=et(d,v);i.add(Gt.destroy.bind(Gt))}let It=et(v,t.entity.provideContext(h));i.add(It.destroy.bind(It)),n.set(h,v)}return v!=null&&((T=w==null?void 0:w.clearOnDestroy)==null||T)&&i.add(()=>{v.set(void 0)}),v},provideGlobalContext(h,d,u){var T;let v=l.get(h);!ce&&typeof u!="function"&&(console.warn(\'[shadow-objects] Deprecation Warning: The "isEqual" option of "provideContext()" and "provideGlobalContext()" is now passed as {compare} argument. Please update your code accordingly.\'),ce=!0);let w=typeof u=="function"?{compare:u}:u;if(v==null){let $=ee(d);if(v=k($?void 0:d,w!=null&&w.compare?{compare:w.compare}:void 0),$){let Gt=et(d,v);i.add(Gt.destroy.bind(Gt))}let It=et(v,t.entity.provideGlobalContext(h));i.add(It.destroy.bind(It)),l.set(h,v)}return v!=null&&((T=w==null?void 0:w.clearOnDestroy)==null||T)&&i.add(()=>{v.set(void 0)}),v},useContext(h,d){let u=a.get(h);if(u===void 0){u=k(void 0,d?{compare:d}:void 0).get,a.set(h,u);let v=et(t.entity.useContext(h),u);i.add(v.destroy.bind(v))}return u},useParentContext(h,d){let u=o.get(h);if(u===void 0){u=k(void 0,d?{compare:d}:void 0).get,o.set(h,u);let v=et(t.entity.useParentContext(h),u);i.add(v.destroy.bind(v))}return u},useProperty:b,useProperties(h){let d={};for(let u in h)Object.hasOwn(h,u)&&(d[u]=b(h[u]));return d},createResource(h,d){let u=k(void 0);i.add(()=>I(u));let v=Vt(()=>{let w=h();return u.set(w),w!==void 0&&d?()=>{d(w),u.set(void 0)}:()=>{u.set(void 0)}});return i.add(v.destroy),u},createEffect(...h){let d=Vt(...h);return i.add(d.destroy),d},createSignal(...h){let d=k(...h);return i.add(()=>{I(d)}),d},createMemo(...h){let d=Pi(...h);return i.add(()=>{I(d)}),d},on(...h){let d=_(...h);return i.add(d),d},once(...h){let d=M(...h);return i.add(d),d},onDestroy(h){s.add(h)}}));return this.logger.isInfo&&this.logger.info("create shadow-object",ls(e),{shadowObject:m,entity:t.entity}),M(t.entity,Tt,be.Low,()=>{this.logger.isInfo&&this.logger.info("destroy shadow-object",ls(e),{shadowObject:m,entity:t.entity});for(let d of s)d();for(let d of i)d();for(let d of a.values())I(d);for(let d of o.values())I(d);for(let d of p.values())I(d);for(let d of n.values())I(d);for(let d of l.values())I(d);s.clear(),i.clear(),a.clear(),o.clear(),p.clear(),n.clear(),l.clear();let h=t.usedConstructors.get(e);h&&(h.delete(m),h.size===0&&t.usedConstructors.delete(e))}),t.usedConstructors.has(e)?t.usedConstructors.get(e).add(m):t.usedConstructors.set(e,new Set([m])),this.attachShadowObject(m,t.entity),m}createShadowObjects(e){var s;let t=r(this,S).get(e);(s=this.registry.findConstructors(t.token,t.entity.truthyProps()))==null||s.forEach(i=>{this.constructShadowObject(i,t)})}findShadowObjects(e){if(!r(this,S).has(e))return[];let{usedConstructors:t}=r(this,S).get(e);return Array.from(new Set(Array.from(t.values()).flatMap(s=>Array.from(s))))}attachShadowObject(e,t){_(t,e),typeof e[os]=="function"&&e[os](t)}destroyShadowObject(e,t){typeof e[Tt]=="function"&&e[Tt](t),E(e,Tt,t),V(t,e)}findOrCreateRootContext(e){let t=r(this,pt).get(e);return t||(t=new Fe,r(this,pt).set(e,t)),t}destroy(){for(let e of r(this,pt).values())e.dispose();r(this,pt).clear();for(let e of this.traverseLevelOrderBFS().reverse())this.destroyEntity(e.uuid)}},S=new WeakMap,Q=new WeakMap,Ft=new WeakMap,re=new WeakMap,X=new WeakMap,pt=new WeakMap,ms);async function Ns(e,t,s,i=!0){var o,n;if(s.has(t)){console.warn("importModule: skipping already imported module",t);return}else s.add(t);t.extends&&await Promise.all(t.extends.map(l=>Ns(e,l,s,!1)));let{registry:a}=e;if(t.define)for(let[l,p]of Object.entries(t.define))a.define(l,p);if(t.routes)for(let[l,p]of Object.entries(t.routes))a.appendRoute(l,p);await((n=(o=t.initialize)==null?void 0:o.call(t,{define:(l,p)=>a.define(l,p),kernel:e,registry:a}))!=null?n:Promise.resolve()),i&&e.upgradeEntities()}var Gi=e=>(typeof e=="string"&&(e=new URL(e,globalThis.location.href)),e.toString()),ae,yt,Vs,$s,Is,ws,Ui=(ws=class{constructor(e){g(this,yt);g(this,ae,new Set);var t,s;this.kernel=(t=e==null?void 0:e.kernel)!=null?t:new Ii,this.postMessage=(s=e==null?void 0:e.postMessage)!=null?s:self.postMessage.bind(self),_(this.kernel,Te,"onMessageToView",this)}route(e){var t;switch(e.data.type){case Bs:C(this,yt,Vs).call(this,e.data);break;case Ws:C(this,yt,$s).call(this,e.data);break;case qs:C(this,yt,Is).call(this,e.data);break;default:console.warn("[MessageRouter] unknown message",(t=e.data.type)!=null?t:e.data)}}onMessageToView(e){let i=e,{transferables:t}=i,s=qe(i,["transferables"]);this.postMessage({type:Te,data:s},{transfer:t})}},ae=new WeakMap,yt=new WeakSet,Vs=async function(e){try{let t=await import(Gi(e.importModule));t[ke]?(await Ns(this.kernel,t[ke],r(this,ae)),this.postMessage({type:Se,url:e.importModule})):this.postMessage({type:Se,url:e.importModule,error:`module has no "${ke}" export`})}catch(t){console.error("[MessageRouter] failed to import module",t),this.postMessage({type:Se,url:e.importModule,error:`${t}`})}},$s=function(e){try{this.kernel.run(e)}catch(t){console.error("[MessageRouter] failed to apply change trail",t),this.postMessage({type:He,serial:e.serial,error:t.toString()})}e.serial&&this.postMessage({type:He,serial:e.serial})},Is=function(e){console.debug("[MessageRouter] on destroy",e),V(this.kernel,this),r(this,ae).clear(),this.postMessage({type:Ks})},ws),Bi=class{constructor(){this.onmessage=e=>{var t;e.data.type===N?globalThis[x]=e.data.config:((t=this.router)!=null||(this.router=new Ui),this.router.route(e))}}start(){self.addEventListener("message",this.onmessage),self.postMessage({type:Js})}};console.debug("@spearwolf/shadow-objects/WorkerRuntime: hello!");var Wi=new Bi;Wi.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 zs=()=>new Ye;var $t=(s,t,e=1e3,r)=>new Promise((i,n)=>{let o,h,a=()=>{clearTimeout(o),s.removeEventListener("message",h)};e!==0&&e!==1/0&&(o=setTimeout(()=>{a(),n(new Error(`Timeout waiting for message of type: ${t}`))},e)),h=c=>{if(c.data.type===t)try{(!r||r(c.data))&&(a(),i())}catch(w){a(),n(w.toString())}},s.addEventListener("message",h)});var br=s=>{let t;if(s!=null&&Array.isArray(s))for(let e of s)e.transferables&&(t?t=[...t,...e.transferables]:t=e.transferables,delete e.transferables);return t},Ce=class s{static{this.WorkerLoaded="workerLoaded"}#t;#e;#s;get isDestroyed(){return this.#e}get workerLoaded(){return ft(this,s.WorkerLoaded)}constructor(){this.#e=!1,this.#s=0,this.logger=new P("RemoteWorkerEnv"),G(this,s.WorkerLoaded)}async start(){if(this.#t)return this.logger.isWarn&&this.logger.warn("already started"),this.workerLoaded.then(()=>{if(this.isDestroyed)throw"worker was destroyed"});let t=this.#t=zs();this.configureConsoleLogger(t);try{if(await $t(t,bs,Es),this.isDestroyed)throw"worker was destroyed";t.addEventListener("message",this.onMessageFromWorker.bind(this)),queueMicrotask(()=>{p(this,s.WorkerLoaded,this)})}catch(e){throw this.logger.error("failed to start",e),this.#t=void 0,e}}applyChangeTrail(t,e){let r=br(t),i={type:ys,changeTrail:t},n=++this.#s;return e&&(i.serial=n),this.#t.postMessage(i,r),e?$t(this.#t,vs,xs,o=>{if(o.error)throw o.error;return o.serial===n}):Promise.resolve()}importScript(t){return t=ve(t),this.#t.postMessage({type:gs,importModule:t}),$t(this.#t,ws,Ss,e=>{if(e.error)throw e.error;return e.url===t})}destroy(){if(!this.#t)return;let t=this.#t;this.#t=void 0,this.#e=!0,t.postMessage({type:ms}),$t(t,Cs,ks).finally(()=>{t.terminate()})}onMessageFromWorker(t){t.data?.type===mt?this.onMessageToView?.(t.data.data):this.logger.isDebug&&this.logger.debug("message from worker",t)}configureConsoleLogger(t){let e=`${D}.RemoteWorkerEnv.workerConfig`,r=JSON.parse(localStorage.getItem(e)??"{}");this.logger.isInfo&&this.logger.info("load console-logger worker config",{localStorageKey:e,workerConfig:r}),t.postMessage({type:D,config:{...P.sharedConfig,enable:this.logger.isEnabled,...r,...P.isEnabled?{}:{enable:!1}}})}};var It,Wt=class extends st{static{this.observedAttributes=[...st.observedAttributes,oe,"src",ae]}static{this.DefaultAutoSync="frame"}#t;#e;#s;#i;#r;constructor(){super(),this.isShaeWorkerElement=!0,this.shadowEnv=new F,this.logger=new P("ShaeWorkerElement"),this.autostart=!0,this.isConnected$=f(!1),this.autoSync$=f(It.DefaultAutoSync),this.src$=f(""),this.#t=!1,this.#e=!1,this.ns$.onChange(t=>{this.shadowEnv.view=$.get(t)}),y(this.shadowEnv,F.ContextCreated,()=>{this.#r?.run(),this.dispatchEvent(new CustomEvent(F.ContextCreated.toLowerCase(),{bubbles:!1,detail:{shadowEnv:this.shadowEnv}}))}),y(this.shadowEnv,F.ContextLost,()=>{this.dispatchEvent(new CustomEvent(F.ContextLost.toLowerCase(),{bubbles:!1,detail:{shadowEnv:this.shadowEnv}}))}),this.autoSync$.onChange(t=>{let e=this.hasAttribute(z),r=e?this.getAttribute(z):void 0;t===It.DefaultAutoSync?e&&r!==t&&this.setAttribute(z,t):r!==t&&this.setAttribute(z,t)}),this.#a(),this.#n(),this.style.display="contents"}#n(){this.#r=v(()=>{let t=this.src$.get();t&&this.importScript(t)},{autorun:!1})}get shouldAutostart(){return this.autostart&&!_t(this,js)}get autoSync(){return this.autoSync$.value}set autoSync(t){typeof t!="string"&&(t=t?It.DefaultAutoSync:"no"),this.autoSync$.set(`${t}`.trim().toLowerCase())}get frameLoop(){return this.#s??=new bt,this.#s}[bt.OnFrame](){this.syncShadowObjects()}async importScript(t){if(!t)throw new Error("src is blank");let e=await this.shadowEnv.ready();return this.logger.isInfo&&this.logger.info("shadowEnv importScript:",t,{shadowEnv:e}),await e.envProxy.importScript(t),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(t){if(super.attributeChangedCallback(t),t===oe&&this.shadowEnv.envProxy!=null)throw new Error('Changing the "local" attribute after the shadowEnv has been created is not supported.');if(t===ae&&this.#h(),t===z&&(this.autoSync=this.hasAttribute(z)?this.getAttribute(z):!0),t==="src"){let e=(this.getAttribute("src")||"").trim();this.src$.set(e),this.shadowEnv.isReady&&this.#r?.run()}}start(){if(!this.#e){if(this.#t=!1,this.shadowEnv.view??=$.get(this.ns),this.shadowEnv.envProxy==null){let t=_t(this,oe)?new we:new Ce;this.shadowEnv.envProxy=t,this.#h()}this.#e=!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.#t||(this.#t=!0,queueMicrotask(()=>{this.#t&&this.destroy()}))}#a(){this.#i=v(()=>{if(this.isConnected$.get()){let t=(this.autoSync$.get()||It.DefaultAutoSync).trim().toLowerCase(),e;if(["true","yes","on","frame","auto-sync"].includes(t))return this.logger.isDebug&&this.logger.debug("auto-sync",t,this),this.frameLoop.start(this),()=>{this.frameLoop.stop(this)};if(t.toLowerCase().endsWith("fps")){let r=parseInt(t,10);r>0?e=Math.floor(1e3/r):this.logger.isWarn&&this.logger.warn(`invalid auto-sync value: ${t}`)}else e=parseInt(t,10),isNaN(e)&&(e=void 0,["false","no","off"].includes(t)||this.logger.error(`invalid auto-sync value: ${t}`));if(e!==void 0&&e>0){this.logger.isDebug&&this.logger.debug("auto-sync interval (ms)",e,this);let r=setInterval(()=>{this.syncShadowObjects()},e);return()=>{clearInterval(r)}}else this.logger.isDebug&&this.logger.debug("auto-sync off",this)}},[this.autoSync$,this.isConnected$])}#h(){let t=this.shadowEnv.envProxy;t?.isLocalEnv&&(t.disableStructuredClone=this.hasAttribute(ae))}};It=Wt;customElements.define(Ms,Wt);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.25.0",
4
+ "version": "0.26.1",
5
5
  "author": {
6
6
  "name": "Wolfger Schramm",
7
7
  "email": "wolfger@spearwolf.de",
@@ -1 +1 @@
1
- {"version":3,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SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,KAAK,SAAI,GAAG,IAAI;IA0B7D,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAI9C,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI;IAIrE,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,IAAI;IAKrE,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAY9C,qBAAqB,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI;IAMxD;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAqC3B,OAAO,CAAC,qBAAqB;IAmR7B,OAAO,CAAC,mBAAmB;IAQ3B,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,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"}
@@ -1,5 +1,5 @@
1
1
  import { emit, eventize, off, on, once, Priority } from '@spearwolf/eventize';
2
- import { batch, createEffect, createMemo, createSignal, destroySignal, isSignal, link, Signal, } from '@spearwolf/signalize';
2
+ import { batch, createEffect, createMemo, createSignal, destroySignal, isSignal, link, } from '@spearwolf/signalize';
3
3
  import { ComponentChangeType, MessageToView } from '../constants.js';
4
4
  import { ConsoleLogger } from '../utils/ConsoleLogger.js';
5
5
  import { Entity } from './Entity.js';
@@ -12,7 +12,8 @@ var ShadowObjectAction;
12
12
  ShadowObjectAction[ShadowObjectAction["JustCreate"] = 1] = "JustCreate";
13
13
  ShadowObjectAction[ShadowObjectAction["DestroyOnly"] = 2] = "DestroyOnly";
14
14
  })(ShadowObjectAction || (ShadowObjectAction = {}));
15
- const getDisplayName = (constructor) => constructor.displayName || constructor.name;
15
+ const getDisplayName = (construct) => construct.displayName || construct.name;
16
+ let provideContextOptionsDeprecatedShown = false;
16
17
  /**
17
18
  * The entity kernel manages the lifecycle of all entities and shadow-objects.
18
19
  *
@@ -64,11 +65,12 @@ export class Kernel {
64
65
  traverse(child.uuid, depth + 1);
65
66
  }
66
67
  };
67
- this.#rootEntities.forEach((uuid) => traverse(uuid, 0));
68
+ this.#rootEntities.forEach((uuid) => {
69
+ traverse(uuid, 0);
70
+ });
68
71
  this.#allEntities = Array.from(lvl.entries())
69
72
  .sort((a, b) => a[0] - b[0])
70
- .map(([, entities]) => entities)
71
- .flat();
73
+ .flatMap(([, entities]) => entities);
72
74
  this.#allEntitiesReversed = this.#allEntities.slice().reverse();
73
75
  this.#allEntitiesNeedUpdate = false;
74
76
  }
@@ -220,9 +222,9 @@ export class Kernel {
220
222
  // destroy all shadow-objects created by constructors no longer in the list
221
223
  //
222
224
  if (shouldDestroy) {
223
- for (const [constructor, shadowObjects] of entry.usedConstructors) {
224
- if (!nextConstructors.has(constructor)) {
225
- entry.usedConstructors.delete(constructor);
225
+ for (const [construct, shadowObjects] of entry.usedConstructors) {
226
+ if (!nextConstructors.has(construct)) {
227
+ entry.usedConstructors.delete(construct);
226
228
  for (const obj of shadowObjects) {
227
229
  this.destroyShadowObject(obj, entry.entity);
228
230
  }
@@ -232,15 +234,15 @@ export class Kernel {
232
234
  // shadow-objects for new constructors are now created using the updated constructor list
233
235
  //
234
236
  if (shouldCreate) {
235
- for (const constructor of nextConstructors) {
236
- if (!entry.usedConstructors.has(constructor)) {
237
- this.constructShadowObject(constructor, entry);
237
+ for (const construct of nextConstructors) {
238
+ if (!entry.usedConstructors.has(construct)) {
239
+ this.constructShadowObject(construct, entry);
238
240
  }
239
241
  }
240
242
  }
241
243
  return nextConstructors;
242
244
  }
243
- constructShadowObject(constructor, entry) {
245
+ constructShadowObject(construct, entry) {
244
246
  const unsubscribePrimary = new Set();
245
247
  const unsubscribeSecondary = new Set();
246
248
  const contextReaders = new Map();
@@ -258,14 +260,19 @@ export class Kernel {
258
260
  }
259
261
  return propReader;
260
262
  };
261
- const shadowObject = eventize(new constructor({
263
+ const shadowObject = eventize(new construct({
262
264
  entity: entry.entity,
263
- provideContext(name, sourceOrInitialValue, isEqual) {
265
+ provideContext(name, sourceOrInitialValue, options) {
264
266
  let ctxProvider = contextProviders.get(name);
267
+ if (!provideContextOptionsDeprecatedShown && typeof options !== 'function') {
268
+ console.warn('[shadow-objects] Deprecation Warning: The "isEqual" option of "provideContext()" and "provideGlobalContext()" is now passed as {compare} argument. Please update your code accordingly.');
269
+ provideContextOptionsDeprecatedShown = true;
270
+ }
271
+ const opts = typeof options === 'function' ? { compare: options } : options;
265
272
  if (ctxProvider == null) {
266
273
  const isSig = isSignal(sourceOrInitialValue);
267
274
  const initialValue = isSig ? undefined : sourceOrInitialValue;
268
- ctxProvider = createSignal(initialValue, isEqual ? { compare: isEqual } : undefined);
275
+ ctxProvider = createSignal(initialValue, opts?.compare ? { compare: opts.compare } : undefined);
269
276
  if (isSig) {
270
277
  const ln = link(sourceOrInitialValue, ctxProvider);
271
278
  unsubscribeSecondary.add(ln.destroy.bind(ln));
@@ -274,14 +281,24 @@ export class Kernel {
274
281
  unsubscribeSecondary.add(ln.destroy.bind(ln));
275
282
  contextProviders.set(name, ctxProvider);
276
283
  }
284
+ if (ctxProvider != null && (opts?.clearOnDestroy ?? true)) {
285
+ unsubscribeSecondary.add(() => {
286
+ ctxProvider.set(undefined);
287
+ });
288
+ }
277
289
  return ctxProvider;
278
290
  },
279
- provideGlobalContext(name, sourceOrInitialValue, isEqual) {
291
+ provideGlobalContext(name, sourceOrInitialValue, options) {
280
292
  let ctxProvider = contextRootProviders.get(name);
293
+ if (!provideContextOptionsDeprecatedShown && typeof options !== 'function') {
294
+ console.warn('[shadow-objects] Deprecation Warning: The "isEqual" option of "provideContext()" and "provideGlobalContext()" is now passed as {compare} argument. Please update your code accordingly.');
295
+ provideContextOptionsDeprecatedShown = true;
296
+ }
297
+ const opts = typeof options === 'function' ? { compare: options } : options;
281
298
  if (ctxProvider == null) {
282
299
  const isSig = isSignal(sourceOrInitialValue);
283
300
  const initialValue = isSig ? undefined : sourceOrInitialValue;
284
- ctxProvider = createSignal(initialValue, isEqual ? { compare: isEqual } : undefined);
301
+ ctxProvider = createSignal(initialValue, opts?.compare ? { compare: opts.compare } : undefined);
285
302
  if (isSig) {
286
303
  const ln = link(sourceOrInitialValue, ctxProvider);
287
304
  unsubscribeSecondary.add(ln.destroy.bind(ln));
@@ -290,6 +307,11 @@ export class Kernel {
290
307
  unsubscribeSecondary.add(ln.destroy.bind(ln));
291
308
  contextRootProviders.set(name, ctxProvider);
292
309
  }
310
+ if (ctxProvider != null && (opts?.clearOnDestroy ?? true)) {
311
+ unsubscribeSecondary.add(() => {
312
+ ctxProvider.set(undefined);
313
+ });
314
+ }
293
315
  return ctxProvider;
294
316
  },
295
317
  useContext(name, compare) {
@@ -316,7 +338,7 @@ export class Kernel {
316
338
  useProperties(props) {
317
339
  const result = {};
318
340
  for (const key in props) {
319
- if (Object.prototype.hasOwnProperty.call(props, key)) {
341
+ if (Object.hasOwn(props, key)) {
320
342
  result[key] = getUseProperty(props[key]);
321
343
  }
322
344
  }
@@ -377,11 +399,11 @@ export class Kernel {
377
399
  },
378
400
  }));
379
401
  if (this.logger.isInfo) {
380
- this.logger.info('create shadow-object', getDisplayName(constructor), { shadowObject, entity: entry.entity });
402
+ this.logger.info('create shadow-object', getDisplayName(construct), { shadowObject, entity: entry.entity });
381
403
  }
382
404
  once(entry.entity, onDestroy, Priority.Low, () => {
383
405
  if (this.logger.isInfo) {
384
- this.logger.info('destroy shadow-object', getDisplayName(constructor), { shadowObject, entity: entry.entity });
406
+ this.logger.info('destroy shadow-object', getDisplayName(construct), { shadowObject, entity: entry.entity });
385
407
  }
386
408
  for (const callback of unsubscribePrimary) {
387
409
  callback();
@@ -411,39 +433,37 @@ export class Kernel {
411
433
  propertyReaders.clear();
412
434
  contextProviders.clear();
413
435
  contextRootProviders.clear();
414
- const otherShadowObjects = entry.usedConstructors.get(constructor);
436
+ const otherShadowObjects = entry.usedConstructors.get(construct);
415
437
  if (otherShadowObjects) {
416
438
  otherShadowObjects.delete(shadowObject);
417
439
  if (otherShadowObjects.size === 0) {
418
- entry.usedConstructors.delete(constructor);
440
+ entry.usedConstructors.delete(construct);
419
441
  }
420
442
  }
421
443
  });
422
444
  // We want to keep track which shadow-objects are created by which constructors.
423
445
  // This will all
424
446
  //
425
- if (entry.usedConstructors.has(constructor)) {
426
- entry.usedConstructors.get(constructor).add(shadowObject);
447
+ if (entry.usedConstructors.has(construct)) {
448
+ entry.usedConstructors.get(construct).add(shadowObject);
427
449
  }
428
450
  else {
429
- entry.usedConstructors.set(constructor, new Set([shadowObject]));
451
+ entry.usedConstructors.set(construct, new Set([shadowObject]));
430
452
  }
431
453
  this.attachShadowObject(shadowObject, entry.entity);
432
454
  return shadowObject;
433
455
  }
434
456
  createShadowObjects(uuid) {
435
457
  const entry = this.#entities.get(uuid);
436
- this.registry.findConstructors(entry.token, entry.entity.truthyProps())?.forEach((constructor) => {
437
- this.constructShadowObject(constructor, entry);
458
+ this.registry.findConstructors(entry.token, entry.entity.truthyProps())?.forEach((construct) => {
459
+ this.constructShadowObject(construct, entry);
438
460
  });
439
461
  }
440
462
  findShadowObjects(uuid) {
441
463
  if (!this.#entities.has(uuid))
442
464
  return [];
443
465
  const { usedConstructors } = this.#entities.get(uuid);
444
- return Array.from(new Set(Array.from(usedConstructors.values())
445
- .map((objs) => Array.from(objs))
446
- .flat()));
466
+ return Array.from(new Set(Array.from(usedConstructors.values()).flatMap((objs) => Array.from(objs))));
447
467
  }
448
468
  attachShadowObject(shadowObject, entity) {
449
469
  // Like all other objects, the new shadow-object should be able to respond to the events that the entity receives.
@@ -1 +1 @@
1
- {"version":3,"file":"Kernel.js","sourceRo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AC;IAEO,mBAAmB,CAAC,YAAoB,EAAE,MAAc;QAC9D,IAAI,OAAQ,YAA0B,CAAC,SAAS,CAAC,KAAK,UAAU,EAAE,CAAC;YAChE,YAA0B,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;QACjD,CAAC;QAED,IAAI,CAAC,YAAY,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAEtC,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAC5B,CAAC;IAED,uBAAuB,CAAC,IAAqB;QAC3C,IAAI,GAAG,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,GAAG,GAAG,IAAI,WAAW,EAAE,CAAC;YACxB,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAED,OAAO;QACL,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC;YAC9C,GAAG,CAAC,OAAO,EAAE,CAAC;QAChB,CAAC;QACD,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;QAE3B,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC;YAC5D,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;CACF"}
package/src/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { EventizedObject, on, once } from '@spearwolf/eventize';
2
2
  import type { CompareFunc, createEffect, createMemo, createSignal, Signal, SignalReader } from '@spearwolf/signalize';
3
- import { AppliedChangeTrail, ImportedModule, type ComponentChangeType } from './constants.js';
3
+ import type { AppliedChangeTrail, ComponentChangeType, ImportedModule } from './constants.js';
4
4
  import type { Entity } from './in-the-dark/Entity.js';
5
5
  import type { Kernel, Registry } from './shadow-objects.js';
6
6
  export type ChangeTrailType = IComponentChangeType[];
@@ -64,10 +64,14 @@ export interface AppliedChangeTrailEvent {
64
64
  export type EntityApi = Pick<Entity, 'hasParent' | 'children' | 'dispatchMessageToView' | 'setProperties' | 'setProperty' | 'propKeys' | 'propEntries'> & Readonly<Pick<Entity, 'uuid' | 'order' | 'parentUuid' | 'parent'>> & {
65
65
  traverse(callback: (entity: EntityApi) => any): void;
66
66
  };
67
+ export interface ProvideContextOptions<T> {
68
+ compare?: CompareFunc<T>;
69
+ clearOnDestroy?: boolean;
70
+ }
67
71
  export interface ShadowObjectCreationAPI {
68
72
  entity: EntityApi;
69
- provideContext<T = unknown>(name: string | symbol, sourceOrInitialValue?: T | SignalReader<T>, isEqual?: CompareFunc<T>): Signal<T>;
70
- provideGlobalContext<T = unknown>(name: string | symbol, sourceOrInitialValue?: T | SignalReader<T>, isEqual?: CompareFunc<T>): Signal<T>;
73
+ provideContext<T = unknown>(name: string | symbol, sourceOrInitialValue?: T | SignalReader<T>, isEqual?: ProvideContextOptions<T> | CompareFunc<T>): Signal<T>;
74
+ provideGlobalContext<T = unknown>(name: string | symbol, sourceOrInitialValue?: T | SignalReader<T>, isEqual?: ProvideContextOptions<T> | CompareFunc<T>): Signal<T>;
71
75
  useContext<T = any>(name: string | symbol, isEqual?: CompareFunc<T>): SignalReader<T>;
72
76
  useParentContext<T = any>(name: string | symbol, isEqual?: CompareFunc<T>): SignalReader<T>;
73
77
  useProperty<T = any>(name: string, isEqual?: CompareFunc<T>): SignalReader<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,Y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AC,CAAC;IAC/E,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,UAAU,CAAC,EAAE,8BAA8B,CAAC;CAC7C"}
package/src/types.js CHANGED
@@ -1,2 +1,2 @@
1
- import { AppliedChangeTrail, ImportedModule } from './constants.js';
1
+ export {};
2
2
  //# sourceMappingURL=types.js.map
package/src/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,kBAAkB,EAAE,cAAc,EAA2B,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}