mutts 1.0.6 → 1.0.7
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/README.md +1 -1
- package/dist/browser.d.ts +2 -0
- package/dist/browser.esm.js +70 -0
- package/dist/browser.esm.js.map +1 -0
- package/dist/browser.js +161 -0
- package/dist/browser.js.map +1 -0
- package/dist/chunks/{index-CDCOjzTy.js → index-BFYK02LG.js} +5760 -4338
- package/dist/chunks/index-BFYK02LG.js.map +1 -0
- package/dist/chunks/{index-DiP0RXoZ.esm.js → index-CNR6QRUl.esm.js} +5440 -4054
- package/dist/chunks/index-CNR6QRUl.esm.js.map +1 -0
- package/dist/devtools/panel.js.map +1 -1
- package/dist/mutts.umd.js +1 -1
- package/dist/mutts.umd.js.map +1 -1
- package/dist/mutts.umd.min.js +1 -1
- package/dist/mutts.umd.min.js.map +1 -1
- package/dist/node.d.ts +2 -0
- package/dist/node.esm.js +45 -0
- package/dist/node.esm.js.map +1 -0
- package/dist/node.js +136 -0
- package/dist/node.js.map +1 -0
- package/docs/ai/api-reference.md +0 -2
- package/docs/reactive/advanced.md +2 -5
- package/docs/reactive/collections.md +0 -125
- package/docs/reactive/core.md +27 -24
- package/docs/reactive/debugging.md +12 -2
- package/docs/reactive/project.md +1 -1
- package/docs/reactive/scan.md +78 -0
- package/docs/reactive.md +2 -1
- package/docs/std-decorators.md +1 -0
- package/docs/zone.md +88 -0
- package/package.json +42 -10
- package/src/async/browser.ts +87 -0
- package/src/async/index.ts +8 -0
- package/src/async/node.ts +46 -0
- package/src/decorator.ts +5 -1
- package/src/destroyable.ts +1 -1
- package/src/index.ts +22 -14
- package/src/indexable.ts +42 -0
- package/src/mixins.ts +2 -2
- package/src/reactive/array.ts +149 -141
- package/src/reactive/buffer.ts +168 -0
- package/src/reactive/change.ts +2 -2
- package/src/reactive/effect-context.ts +15 -91
- package/src/reactive/effects.ts +119 -179
- package/src/reactive/index.ts +10 -13
- package/src/reactive/interface.ts +19 -33
- package/src/reactive/map.ts +48 -61
- package/src/reactive/memoize.ts +19 -9
- package/src/reactive/project.ts +43 -22
- package/src/reactive/proxy.ts +16 -41
- package/src/reactive/record.ts +3 -3
- package/src/reactive/register.ts +5 -7
- package/src/reactive/registry.ts +9 -17
- package/src/reactive/set.ts +42 -56
- package/src/reactive/tracking.ts +1 -29
- package/src/reactive/types.ts +46 -23
- package/src/utils.ts +80 -37
- package/src/zone.ts +127 -0
- package/dist/chunks/_tslib-BgjropY9.js +0 -81
- package/dist/chunks/_tslib-BgjropY9.js.map +0 -1
- package/dist/chunks/_tslib-MCKDzsSq.esm.js +0 -75
- package/dist/chunks/_tslib-MCKDzsSq.esm.js.map +0 -1
- package/dist/chunks/decorator-BGILvPtN.esm.js +0 -627
- package/dist/chunks/decorator-BGILvPtN.esm.js.map +0 -1
- package/dist/chunks/decorator-BQ2eBTCj.js +0 -651
- package/dist/chunks/decorator-BQ2eBTCj.js.map +0 -1
- package/dist/chunks/index-CDCOjzTy.js.map +0 -1
- package/dist/chunks/index-DiP0RXoZ.esm.js.map +0 -1
- package/dist/decorator.d.ts +0 -107
- package/dist/decorator.esm.js +0 -2
- package/dist/decorator.esm.js.map +0 -1
- package/dist/decorator.js +0 -11
- package/dist/decorator.js.map +0 -1
- package/dist/destroyable.d.ts +0 -90
- package/dist/destroyable.esm.js +0 -109
- package/dist/destroyable.esm.js.map +0 -1
- package/dist/destroyable.js +0 -116
- package/dist/destroyable.js.map +0 -1
- package/dist/eventful.d.ts +0 -20
- package/dist/eventful.esm.js +0 -66
- package/dist/eventful.esm.js.map +0 -1
- package/dist/eventful.js +0 -68
- package/dist/eventful.js.map +0 -1
- package/dist/index.d.ts +0 -19
- package/dist/index.esm.js +0 -53
- package/dist/index.esm.js.map +0 -1
- package/dist/index.js +0 -139
- package/dist/index.js.map +0 -1
- package/dist/indexable.d.ts +0 -243
- package/dist/indexable.esm.js +0 -285
- package/dist/indexable.esm.js.map +0 -1
- package/dist/indexable.js +0 -291
- package/dist/indexable.js.map +0 -1
- package/dist/promiseChain.d.ts +0 -21
- package/dist/promiseChain.esm.js +0 -78
- package/dist/promiseChain.esm.js.map +0 -1
- package/dist/promiseChain.js +0 -80
- package/dist/promiseChain.js.map +0 -1
- package/dist/reactive.d.ts +0 -910
- package/dist/reactive.esm.js +0 -5
- package/dist/reactive.esm.js.map +0 -1
- package/dist/reactive.js +0 -59
- package/dist/reactive.js.map +0 -1
- package/dist/std-decorators.d.ts +0 -52
- package/dist/std-decorators.esm.js +0 -196
- package/dist/std-decorators.esm.js.map +0 -1
- package/dist/std-decorators.js +0 -204
- package/dist/std-decorators.js.map +0 -1
- package/src/reactive/mapped.ts +0 -129
- package/src/reactive/zone.ts +0 -208
package/dist/mutts.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Mutts={})}(this,function(exports){"use strict";const nativeReactive=Symbol("native-reactive"),nonReactiveMark=Symbol("non-reactive"),unreactiveProperties=Symbol("unreactive-properties"),prototypeForwarding=Symbol("prototype-forwarding"),allProps=Symbol("all-props"),projectionInfo=Symbol("projection-info"),stopped=Symbol("stopped"),cleanup$1=Symbol("cleanup"),rootFunction=Symbol("root-function");var ReactiveErrorCode;!function(e){e.CycleDetected="CYCLE_DETECTED",e.MaxDepthExceeded="MAX_DEPTH_EXCEEDED",e.MaxReactionExceeded="MAX_REACTION_EXCEEDED",e.WriteInComputed="WRITE_IN_COMPUTED",e.TrackingError="TRACKING_ERROR"}(ReactiveErrorCode||(ReactiveErrorCode={}));class ReactiveError extends Error{constructor(e,t){super(e),this.debugInfo=t,this.name="ReactiveError"}}const options={enter:e=>{},leave:e=>{},chain:(e,t)=>{},beginChain:e=>{},endChain:()=>{},garbageCollected:e=>{},touched:(e,t,r,n)=>{},skipRunningEffect:(e,t)=>{},maxEffectChain:100,maxTriggerPerBatch:10,maxEffectReaction:"throw",onMemoizationDiscrepancy:void 0,cycleHandling:"throw",isVerificationRun:!1,maxDeepWatchDepth:100,instanceMembers:!0,ignoreAccessors:!0,recursiveTouching:!0,asyncMode:"cancel",warn:(...e)=>{},introspection:{enableHistory:!1,historySize:50},zones:{setTimeout:!0,setInterval:!0,requestAnimationFrame:!0,queueMicrotask:!0}};function zip(...e){if(!e.length)return[];const t=Math.min(...e.map(e=>e.length)),r=[];for(let n=0;n<t;n++){const t=e.map(e=>e[n]);r.push(t)}return r}function arrayEquals(e,t){if(e===t)return!0;if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}const nativeConstructors=new Set([Object,Array,Date,Function,Set,Map,WeakMap,WeakSet,Promise,Error,TypeError,ReferenceError,SyntaxError,RangeError,URIError,EvalError,Reflect,Proxy,RegExp,String,Number,Boolean]);function isConstructor(e){return e&&"function"==typeof e&&(nativeConstructors.has(e)||e.toString?.().startsWith("class "))}function renamed(e,t){return Object.defineProperties(e,{name:{value:t}})}function ReflectGet(e,t,r){return"undefined"!=typeof Node&&e instanceof Node?e[t]:Reflect.get(e,t,r)}function ReflectSet(e,t,r,n){return"undefined"!=typeof Node&&e instanceof Node?(e[t]=r,!0):e instanceof Object||Reflect.has(e,t)?Reflect.set(e,t,r,n):(Object.defineProperty(e,t,{value:r,configurable:!0,writable:!0,enumerable:!0}),!0)}function isOwnAccessor(e,t){const r=Object.getOwnPropertyDescriptor(e,t);return!(!r?.get&&!r?.set)}function deepCompare(e,t,r=new Map){for(;e&&"object"==typeof e&&prototypeForwarding in e;)e=e[prototypeForwarding];for(;t&&"object"==typeof t&&prototypeForwarding in t;)t=t[prototypeForwarding];if(e===t)return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return e===t;if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;let n=r.get(e);if(n?.has(t))return!0;if(n||(n=new Set,r.set(e,n)),n.add(t),Array.isArray(e)){if(!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!deepCompare(e[n],t[n],r))return!1;return!0}if(e instanceof Date){const r=t instanceof Date&&e.getTime()===t.getTime();return r}if(e instanceof RegExp){const r=t instanceof RegExp&&e.toString()===t.toString();return r}if(e instanceof Set){if(!(t instanceof Set)||e.size!==t.size)return!1;for(const n of e){let e=!1;for(const o of t)if(deepCompare(n,o,r)){e=!0;break}if(!e)return!1}return!0}if(e instanceof Map){if(!(t instanceof Map)||e.size!==t.size)return!1;for(const[n,o]of e)if(t.has(n)){if(!deepCompare(o,t.get(n),r))return!1}else{let e=!1;for(const[i,s]of t)if(deepCompare(n,i,r)&&deepCompare(o,s,r)){e=!0;break}if(!e)return!1}return!0}const o=Object.keys(e),i=Object.keys(t);if(o.length!==i.length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;if(!deepCompare(e[n],t[n],r))return!1}return!0}class DecoratorError extends Error{constructor(e){super(e),this.name="DecoratorException"}}function legacyDecorator(e){return function(t,r,n,...o){if(void 0===r){if(isConstructor(t)){if(!("class"in e))throw new Error("Decorator cannot be applied to a class");return e.class(t)}}else if("object"==typeof t&&["string","symbol"].includes(typeof r)){if(!n)throw new Error("Decorator cannot be applied to a field");if("object"==typeof n&&"configurable"in n){if("get"in n||"set"in n){if(!("getter"in e)&&!("setter"in e))throw new Error("Decorator cannot be applied to a getter or setter");if("getter"in e){const o=e.getter(n.get,t,r);o&&(n.get=o)}if("setter"in e){const o=e.setter(n.set,t,r);o&&(n.set=o)}return n}if("function"==typeof n.value){if(!("method"in e))throw new Error("Decorator cannot be applied to a method");const o=e.method(n.value,t,r);return o&&(n.value=o),n}}}if(!("default"in e))throw new Error("Decorator do not have a default implementation");return e.default.call(this,t,r,n,...o)}}function modernDecorator(e){return function(t,r,...n){if(!r?.kind||"string"!=typeof r.kind){if(!("default"in e))throw new Error("Decorator do not have a default implementation");return e.default.call(this,t,r,...n)}switch(r.kind){case"class":if(!("class"in e))throw new Error("Decorator cannot be applied to a class");return e.class(t);case"field":throw new Error("Decorator cannot be applied to a field");case"getter":if(!("getter"in e))throw new Error("Decorator cannot be applied to a getter");return e.getter(t,t,r.name);case"setter":if(!("setter"in e))throw new Error("Decorator cannot be applied to a setter");return e.setter(t,t,r.name);case"method":if(!("method"in e))throw new Error("Decorator cannot be applied to a method");return e.method(t,t,r.name);case"accessor":{if(!("getter"in e)&&!("setter"in e))throw new Error("Decorator cannot be applied to a getter or setter");const n={};if("getter"in e){const o=e.getter(t.get,t,r.name);o&&(n.get=o)}if("setter"in e){const o=e.setter(t.set,t,r.name);o&&(n.set=o)}return n}}}}function detectDecoratorMode(e,t,r){return"object"==typeof t&&null!==t&&"string"==typeof t.kind?"modern":"legacy"}const decorator=e=>{const t=modernDecorator(e),r=legacyDecorator(e);return(e,n,...o)=>"modern"===detectDecoratorMode(e,n,o[0])?t(e,n,...o):r(e,n,...o)},fr$1=new FinalizationRegistry(e=>e()),destructor=Symbol("destructor"),allocatedValues=Symbol("allocated");class DestructionError extends Error{static throw(e){return()=>{throw new DestructionError(e)}}constructor(e){super(`Object is destroyed. ${e}`),this.name="DestroyedAccessError"}}const destroyedHandler={[Symbol.toStringTag]:"MutTs Destroyable",get:DestructionError.throw("Cannot access destroyed object"),set:DestructionError.throw("Cannot access destroyed object")};function Destroyable(e,t){var r;return e&&"function"!=typeof e&&(t=e,e=void 0),e||(e=class{}),r=class extends e{static destroy(e){const t=r.destructors.get(e);if(!t)return!1;fr$1.unregister(e[allocatedValues]),r.destructors.delete(e),Object.setPrototypeOf(e,new Proxy({},destroyedHandler));for(const t of Object.getOwnPropertyNames(e))delete e[t];return t(),!0}static isDestroyable(e){return r.destructors.has(e)}constructor(...e){super(...e);const n={};this[allocatedValues]=n;const o=t?.destructor??this[destructor];if(!o)throw new DestructionError("Destructor is not defined");function i(){o(n)}r.destructors.set(this,i),fr$1.register(this,i,n)}},r.destructors=new WeakMap,r}const allocated=decorator({setter:(e,t,r)=>function(t){return this[allocatedValues][r]=t,e.call(this,t)}});function callOnGC(e){let t=!1;const r=()=>{t||(t=!0,e())};return fr$1.register(r,e,e),r}function __esDecorate(e,t,r,n,o,i){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,c=n.kind,l="getter"===c?"get":"setter"===c?"set":"value",f=!t&&e?n.static?e:e.prototype:null,u=t||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),d=!1,h=r.length-1;h>=0;h--){var p={};for(var g in n)p[g]="access"===g?{}:n[g];for(var g in n.access)p.access[g]=n.access[g];p.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");i.push(s(e||null))};var y=(0,r[h])("accessor"===c?{get:u.get,set:u.set}:u[l],p);if("accessor"===c){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(a=s(y.get))&&(u.get=a),(a=s(y.set))&&(u.set=a),(a=s(y.init))&&o.unshift(a)}else(a=s(y))&&("field"===c?o.unshift(a):u[l]=a)}f&&Object.defineProperty(f,n.name,u),d=!0}function __runInitializers(e,t,r){for(var n=arguments.length>2,o=0;o<t.length;o++)r=n?t[o].call(e,r):t[o].call(e);return n?r:void 0}function __setFunctionName(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function __classPrivateFieldGet(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function __classPrivateFieldSet(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r}var _Eventful_events,_Eventful_hooks;"function"==typeof SuppressedError&&SuppressedError;class Eventful{constructor(){_Eventful_events.set(this,new Map),_Eventful_hooks.set(this,[])}hook(e){return __classPrivateFieldGet(this,_Eventful_hooks,"f").includes(e)||__classPrivateFieldGet(this,_Eventful_hooks,"f").push(e),()=>{__classPrivateFieldGet(this,_Eventful_hooks,"f").splice(__classPrivateFieldGet(this,_Eventful_hooks,"f").indexOf(e),1)}}on(e,t){if("object"==typeof e)for(const t of Object.keys(e))this.on(t,e[t]);else if(void 0!==t){let r=__classPrivateFieldGet(this,_Eventful_events,"f").get(e);r||(r=[],__classPrivateFieldGet(this,_Eventful_events,"f").set(e,r)),r.push(t)}return()=>this.off(e,t)}off(e,t){if("object"==typeof e)for(const t of Object.keys(e))this.off(t,e[t]);else if(null!=t){const r=__classPrivateFieldGet(this,_Eventful_events,"f").get(e);r&&__classPrivateFieldGet(this,_Eventful_events,"f").set(e,r.filter(e=>e!==t))}else __classPrivateFieldGet(this,_Eventful_events,"f").delete(e)}emit(e,...t){const r=__classPrivateFieldGet(this,_Eventful_events,"f").get(e);if(r)for(const e of r)e.apply(this,t);for(const r of __classPrivateFieldGet(this,_Eventful_hooks,"f"))r.call(this,e,...t)}}_Eventful_events=new WeakMap,_Eventful_hooks=new WeakMap;const getAt=Symbol("getAt"),setAt=Symbol("setAt");function Indexable(e,t){e&&"function"!=typeof e&&(t=e,e=void 0),e||(e=class{}),t||(t={get(e){if("function"!=typeof this[getAt])throw new Error("Indexable class must have an [getAt] method");return this[getAt](e)},set(e,t){if("function"!=typeof this[setAt])throw new Error("Indexable class has read-only numeric index access");this[setAt](e,t)}});class r extends e{}return Object.setPrototypeOf(r.prototype,new Proxy(e.prototype,{[Symbol.toStringTag]:"MutTs Indexable",get(e,r,n){if(r in e){const t=Object.getOwnPropertyDescriptor(e,r)?.get;return t?t.call(n):e[r]}if("string"==typeof r){if("length"===r&&t.getLength)return t.getLength.call(n);const e=Number(r);if(!Number.isNaN(e))return t.get.call(n,e)}},set(e,r,n,o){if(r in e){const t=Object.getOwnPropertyDescriptor(e,r)?.set;return t?t.call(o,n):e[r]=n,!0}if("string"==typeof r){if("length"===r&&t.setLength)return t.setLength.call(o,n),!0;const e=Number(r);if(!Number.isNaN(e)){if(!t.set)throw new Error("Indexable class has read-only numeric index access");return t.set.call(o,e,n),!0}}return Object.defineProperty(o,r,{value:n,writable:!0,enumerable:!0,configurable:!0}),!0}})),r}const forwardArray=Symbol("forwardArray");class ArrayReadForward{get[forwardArray](){throw new Error("ArrayReadForward is not implemented")}get length(){return this[forwardArray].length}[Symbol.iterator](){return this[forwardArray][Symbol.iterator]()}map(e,t){return this[forwardArray].map(e,t)}filter(e,t){return this[forwardArray].filter(e,t)}reduce(e,t){return void 0!==t?this[forwardArray].reduce(e,t):this[forwardArray].reduce(e)}reduceRight(e,t){return void 0!==t?this[forwardArray].reduceRight(e,t):this[forwardArray].reduceRight(e)}forEach(e,t){this[forwardArray].forEach(e,t)}find(e,t){return this[forwardArray].find(e,t)}findIndex(e,t){return this[forwardArray].findIndex(e,t)}findLast(e,t){return this[forwardArray].findLast(e,t)}findLastIndex(e,t){return this[forwardArray].findLastIndex(e,t)}includes(e,t){return this[forwardArray].includes(e,t)}indexOf(e,t){return this[forwardArray].indexOf(e,t)}lastIndexOf(e,t){return this[forwardArray].lastIndexOf(e,t)}slice(e,t){return this[forwardArray].slice(e,t)}concat(...e){return this[forwardArray].concat(...e)}every(e,t){return this[forwardArray].every(e,t)}some(e,t){return this[forwardArray].some(e,t)}join(e){return this[forwardArray].join(e)}keys(){return this[forwardArray].keys()}values(){return this[forwardArray].values()}entries(){return this[forwardArray].entries()}toString(){return this[forwardArray].toString()}toLocaleString(e,t){return this[forwardArray].toLocaleString(e,t)}at(e){return this[forwardArray].at(e)}flat(e){return this[forwardArray].flat(e)}flatMap(e,t){return this[forwardArray].flatMap(e,t)}toReversed(){return this[forwardArray].toReversed?.()??[...this[forwardArray]].reverse()}toSorted(e){return this[forwardArray].toSorted?.(e)??[...this[forwardArray]].sort(e)}toSpliced(e,t,...r){return void 0===t?this[forwardArray].toSpliced(e):this[forwardArray].toSpliced(e,t,...r)}with(e,t){return this[forwardArray].with(e,t)}get[Symbol.unscopables](){return this[forwardArray][Symbol.unscopables]}}var _a,_b;class IterableWeakMap{constructor(e){if(this.uuids=new WeakMap,this.refs={},this[_a]="IterableWeakMap",this.registry=new FinalizationRegistry(e=>{delete this.refs[e]}),e)for(const[t,r]of e)this.set(t,r)}createIterator(e){const{refs:t}=this;return function*(){for(const r of Object.keys(t)){const[n,o]=t[r],i=n.deref();i?yield e(i,o):delete t[r]}}()}clear(){for(const e of Object.keys(this.refs)){const t=this.refs[e][0].deref();t&&this.registry.unregister(t)}this.uuids=new WeakMap,this.refs={}}delete(e){const t=this.uuids.get(e);return!!t&&(delete this.refs[t],this.uuids.delete(e),this.registry.unregister(e),!0)}forEach(e,t){for(const[r,n]of this)e.call(t??this,n,r,t??this)}get(e){const t=this.uuids.get(e);if(t)return this.refs[t][1]}has(e){return this.uuids.has(e)}set(e,t){let r=this.uuids.get(e);return r?this.refs[r][1]=t:(r=crypto.randomUUID(),this.uuids.set(e,r),this.refs[r]=[new WeakRef(e),t],this.registry.register(e,r,e)),this}get size(){return[...this].length}entries(){return this.createIterator((e,t)=>[e,t])}keys(){return this.createIterator((e,t)=>e)}values(){return this.createIterator((e,t)=>t)}[Symbol.iterator](){return this.entries()}}_a=Symbol.toStringTag;class IterableWeakSet{constructor(e){if(this.uuids=new WeakMap,this.refs={},this[_b]="IterableWeakSet",this.registry=new FinalizationRegistry(e=>{delete this.refs[e]}),e)for(const t of e)this.add(t)}createIterator(e){const{refs:t}=this;return function*(){for(const r of Object.keys(t)){const n=t[r].deref();n?yield e(n):delete t[r]}}()}clear(){for(const e of Object.keys(this.refs)){const t=this.refs[e].deref();t&&this.registry.unregister(t)}this.uuids=new WeakMap,this.refs={}}add(e){let t=this.uuids.get(e);return t||(t=crypto.randomUUID(),this.uuids.set(e,t),this.refs[t]=new WeakRef(e),this.registry.register(e,t,e)),this}delete(e){const t=this.uuids.get(e);return!!t&&(delete this.refs[t],this.uuids.delete(e),this.registry.unregister(e),!0)}forEach(e,t){for(const r of this)e.call(t??this,r,r,t??this)}has(e){return this.uuids.has(e)}get size(){return[...this].length}entries(){return this.createIterator(e=>[e,e])}keys(){return this.createIterator(e=>e)}values(){return this.createIterator(e=>e)}[Symbol.iterator](){return this.keys()}union(e){const t={[Symbol.iterator]:()=>e.keys()},r=this;return new Set(function*(){yield*r;for(const e of t)r.has(e)||(yield e)}())}intersection(e){const t=this;return new Set(function*(){for(const r of t)e.has(r)&&(yield r)}())}difference(e){const t=this;return new Set(function*(){for(const r of t)e.has(r)||(yield r)}())}symmetricDifference(e){const t={[Symbol.iterator]:()=>e.keys()},r=this;return new Set(function*(){for(const t of r)e.has(t)||(yield t);for(const e of t)r.has(e)||(yield e)}())}isSubsetOf(e){for(const t of this)if(!e.has(t))return!1;return!0}isSupersetOf(e){const t={[Symbol.iterator]:()=>e.keys()};for(const e of t)if(!this.has(e))return!1;return!0}isDisjointFrom(e){for(const t of this)if(e.has(t))return!1;return!0}}function mixin(e,t){const r=new WeakMap,n=e(Object);return r.set(Object,n),new Proxy(n,{apply(n,o,i){if(0===i.length)throw new Error("Mixin requires a base class");const s=i[0];if("function"!=typeof s)throw new Error("Mixin requires a constructor function");if(!(isConstructor(s)||s&&"function"==typeof s&&s.prototype))throw new Error("Mixin requires a valid constructor");const a=r.get(s);if(a)return a;let c=s;if(t){const e=class extends s{},r=s.prototype,n=new Proxy(r,{get(e,r,n){const o=ReflectGet(e,r,n);return"function"!=typeof o||"string"!=typeof r||["constructor","toString","valueOf"].includes(r)?o:function(...e){const r=t(this);return o.apply(r,e)}}});Object.setPrototypeOf(e.prototype,n),c=e}const l=e(c);return r.set(s,l),l}})}_b=Symbol.toStringTag;const effectToReactiveObjects=new WeakMap,watchers=new WeakMap,effectChildren=new WeakMap,effectParent=new WeakMap,reverseRoots=new WeakMap;function markWithRoot(e,t){const r=reverseRoots.get(t),n=r?.deref();if(n&&n!==e){const r=t.name||"anonymous",o=n.name||"anonymous",i=e.name||"anonymous";throw new Error(`[reactive] Abusive Shared Root detected: Root '${r}' is already identifying function '${o}'. Cannot reuse it for '${i}'. Shared roots cause lost updates and broken identity logic.`)}return reverseRoots.set(t,new WeakRef(e)),Object.defineProperty(e,rootFunction,{value:getRoot(t),writable:!1})}function getRoot(e){for(;e&&rootFunction in e;)e=e[rootFunction];return e}const trackingDisabledEffects=new WeakSet;let globalTrackingDisabled=!1;function setGlobalTrackingDisabled(e){globalTrackingDisabled=e}const EXTERNAL_SOURCE=Symbol("external-source");let devtoolsEnabled=!1;const debugEffectRegistry=new Set,debugObjectRegistry=new Set,effectNames=new WeakMap,objectNames=new WeakMap;let effectCounter=0,objectCounter=0;const triggerGraph=new Map;function ensureEffectName(e){let t=effectNames.get(e);if(!t){const r=getRoot(e);t=r?.name?.trim()||"effect_"+ ++effectCounter,effectNames.set(e,t)}return t}function ensureObjectName(e){let t=objectNames.get(e);if(!t){const r=e?.constructor?.name;t=`${r&&"Object"!==r?r:"object"}_${++objectCounter}`,objectNames.set(e,t)}return t}function describeProp(e,t){const r=ensureObjectName(e);return t===allProps?`${r}.*`:"symbol"==typeof t?`${r}.${t.description??t.toString()}`:`${r}.${String(t)}`}function addEffectToRegistry(e){if(!e||debugEffectRegistry.has(e))return;debugEffectRegistry.add(e);const t=effectToReactiveObjects.get(e);if(t)for(const e of t)documentObject(e)}function documentObject(e){debugObjectRegistry.has(e)||dbRegisterObject(e)}function dbRegisterObject(e){debugObjectRegistry.add(e),ensureObjectName(e)}function ensureParentChains(e){const t=Array.from(e);for(let r=0;r<t.length;r++){const n=t[r],o=effectParent.get(n);o&&!e.has(o)&&(e.add(o),t.push(o))}}function ensureTriggerContainers(e){let t=triggerGraph.get(e);return t||(t=new Map,triggerGraph.set(e,t)),t}function ensureTriggerRecord(e,t,r,n,o,i){const s=ensureTriggerContainers(e);let a=s.get(t);a||(a=new Map,s.set(t,a));let c=a.get(r);return c||(c={label:r,object:n,prop:o,evolution:i,count:0,lastTriggered:Date.now()},a.set(r,c)),c}function setEffectName(e,t){effectNames.set(e,t)}function setObjectName(e,t){objectNames.set(e,t),debugObjectRegistry.add(e)}function registerEffectForDebug(e){e&&devtoolsEnabled&&addEffectToRegistry(e)}function registerObjectForDebug(e){devtoolsEnabled&&documentObject(e)}function recordTriggerLink(e,t,r,n,o){if(options.introspection.enableHistory&&addToMutationHistory(e,t,r,n,o),!devtoolsEnabled)return;addEffectToRegistry(t),e&&addEffectToRegistry(e);const i=describeProp(r,n),s=ensureTriggerRecord(e??EXTERNAL_SOURCE,t,i,r,n,o);s.count+=1,s.lastTriggered=Date.now(),documentObject(r)}function getTriggerChain(e,t=5){const r=[];let n=e;for(let e=0;e<t;e++){let e,t="";e:for(const[r,o]of triggerGraph)for(const[i,s]of o)if(i===n){let n=0;for(const o of s.values())o.lastTriggered>n&&(n=o.lastTriggered,t=o.label,e=r===EXTERNAL_SOURCE?void 0:r);if(e||t)break e}if(!e){if(t){r.push(`External -> (${t}) -> ${ensureEffectName(n)}`);break}break}r.push(`${ensureEffectName(e)} -> (${t}) -> ${ensureEffectName(n)}`),n=e}return r.reverse()}function buildEffectNodes(e){const t=[],r=new Map,n=Array.from(e);for(const e of n){const n=ensureEffectName(e),o={id:`effect_${t.length}`,label:n,type:"effect",depth:0,debugName:n};t.push(o),r.set(e,o)}const o=new Map,i=e=>{if(!e)return 0;const t=o.get(e);if(void 0!==t)return t;const r=effectParent.get(e),n=i(r)+(r?1:0);return o.set(e,n),n};for(const[e,t]of r){t.depth=i(e);const n=effectParent.get(e);if(n){const e=r.get(n);e&&(t.parentId=e.id)}}return{nodes:t,nodeByEffect:r}}function buildReactivityGraph(){const e=[],t=[],r=new Map,n=new Set(debugEffectRegistry);ensureParentChains(n);const{nodes:o,nodeByEffect:i}=buildEffectNodes(n);for(const t of o)e.push(t);for(const[e,t]of i)r.set(e,t.id);for(const t of debugObjectRegistry){const n=`object_${e.length}`;e.push({id:n,label:ensureObjectName(t),type:"state",debugName:objectNames.get(t)}),r.set(t,n)}if(triggerGraph.has(EXTERNAL_SOURCE)){const t="effect_external";e.push({id:t,label:"External",type:"external",depth:0}),r.set(EXTERNAL_SOURCE,t)}for(const e of n){const n=r.get(e);if(!n)continue;const o=effectToReactiveObjects.get(e);if(o)for(const e of o){const o=r.get(e);o&&t.push({id:`${n}->${o}`,source:n,target:o,type:"dependency",label:"depends"})}}for(const[e,n]of triggerGraph)for(const[o,i]of n){const n=r.get(o);if(!n)continue;const s=r.get(e);if(s)for(const e of i.values())t.push({id:`${s}->${n}:${e.label}`,source:s,target:n,type:"cause",label:e.count>1?`${e.label} (${e.count})`:e.label,count:e.count})}return{nodes:e,edges:t,meta:{generatedAt:Date.now(),devtoolsEnabled:devtoolsEnabled}}}function enableDevTools(){"undefined"!=typeof window&&(devtoolsEnabled||(devtoolsEnabled=!0,window.__MUTTS_DEVTOOLS__={getGraph:buildReactivityGraph,setEffectName:setEffectName,setObjectName:setObjectName,registerEffect:registerEffectForDebug,registerObject:registerObjectForDebug}))}function isDevtoolsEnabled(){return devtoolsEnabled}const mutationHistory=[];let mutationCounter=0;function addToMutationHistory(e,t,r,n,o){const i={id:++mutationCounter,timestamp:Date.now(),source:e?ensureEffectName(e):"External",target:ensureEffectName(t),objectName:ensureObjectName(r),prop:String(n),type:o.type};mutationHistory.push(i),mutationHistory.length>options.introspection.historySize&&mutationHistory.shift()}const stack=[];function captureEffectStack(){return stack.slice()}function isRunning(e){const t=getRoot(e),r=stack.indexOf(t);if(-1!==r)return stack.slice(0,r+1).reverse();for(let e=0;e<stack.length;e++){let r=stack[e];const n=new WeakSet,o=[];for(;r&&!n.has(r);){n.add(r);const i=getRoot(r);if(o.push(i),i===t){const r=o.reverse();r[0]!==t&&r.unshift(t);const n=stack.slice(0,e+1).reverse();return r.length>0&&n.length>0&&n.shift(),[...r,...n]}r=effectParent.get(r)}}return!1}function withEffectStack(e,t){const r=stack.slice();assignStack(e);try{return t()}finally{assignStack(r)}}function getActiveEffect(){return stack[0]}function withEffect(e,t){if(getRoot(e)===getRoot(getActiveEffect()))return t();stack.unshift(e);try{return t()}finally{if(stack.shift()!==e)throw new ReactiveError("[reactive] Effect stack mismatch")}}function assignStack(e){stack.length=0,stack.push(...e)}const objectToProxy=new WeakMap,proxyToObject=new WeakMap;function storeProxyRelationship(e,t){objectToProxy.set(e,t),proxyToObject.set(t,e)}function getExistingProxy(e){return objectToProxy.get(e)}function trackProxyObject(e,t){proxyToObject.set(e,t)}function unwrap(e){let t=e;for(;t&&"object"==typeof t&&null!==t&&proxyToObject.has(t);)t=proxyToObject.get(t);return t}function isReactive(e){return proxyToObject.has(e)}function getTrackingDisabled(){const e=getActiveEffect();return e?trackingDisabledEffects.has(getRoot(e)):globalTrackingDisabled}function setTrackingDisabled(e){const t=getActiveEffect();if(!t)return void setGlobalTrackingDisabled(e);const r=getRoot(t);e?trackingDisabledEffects.add(r):trackingDisabledEffects.delete(r)}function dependant(e,t=allProps){e=unwrap(e);const r=getActiveEffect();!r||getTrackingDisabled()||"symbol"==typeof t&&t!==allProps||registerDependency(e,t,r)}function registerDependency(e,t,r){let n=watchers.get(e);n||(n=new Map,watchers.set(e,n));let o=n.get(t);o||(o=new Set,n.set(t,o)),o.add(r);const i=effectToReactiveObjects.get(r);i?i.add(e):effectToReactiveObjects.set(r,new Set([e]))}let zoneHooked=!1;const originalPromiseThen=Object.getOwnPropertyDescriptor(Promise.prototype,"then")?.value||Promise.prototype.then,originalPromiseCatch=Object.getOwnPropertyDescriptor(Promise.prototype,"catch")?.value||Promise.prototype.catch,originalPromiseFinally=Object.getOwnPropertyDescriptor(Promise.prototype,"finally")?.value||Promise.prototype.finally,originalSetTimeout=globalThis.setTimeout,originalSetInterval=globalThis.setInterval,originalRequestAnimationFrame=void 0!==globalThis.requestAnimationFrame?globalThis.requestAnimationFrame:void 0,originalQueueMicrotask=void 0!==globalThis.queueMicrotask?globalThis.queueMicrotask:void 0;let batchFn,activationRegistry;function ensureZoneHooked(e){e&&(batchFn=e),!zoneHooked&&options.asyncMode&&(hookZone(),zoneHooked=!0)}function hookZone(){Promise.prototype.then=function(e,t){const r=captureEffectStack();return originalPromiseThen.call(this,wrapCallback(e,r),wrapCallback(t,r))},Promise.prototype.catch=function(e){const t=captureEffectStack();return originalPromiseCatch.call(this,wrapCallback(e,t))},Promise.prototype.finally=function(e){const t=captureEffectStack();return originalPromiseFinally.call(this,wrapCallback(e,t))};const e=(e,t,...r)=>{const n=options.zones.setTimeout?captureEffectStack():void 0;return originalSetTimeout.apply(globalThis,[wrapCallback(e,n),t,...r])};Object.assign(e,originalSetTimeout),globalThis.setTimeout=e;const t=(e,t,...r)=>{const n=options.zones.setInterval?captureEffectStack():void 0;return originalSetInterval.apply(globalThis,[wrapCallback(e,n),t,...r])};Object.assign(t,originalSetInterval),globalThis.setInterval=t,originalRequestAnimationFrame&&(globalThis.requestAnimationFrame=e=>{const t=options.zones.requestAnimationFrame?captureEffectStack():void 0;return originalRequestAnimationFrame.call(globalThis,wrapCallback(e,t))}),originalQueueMicrotask&&(globalThis.queueMicrotask=e=>{const t=options.zones.queueMicrotask?captureEffectStack():void 0;originalQueueMicrotask.call(globalThis,wrapCallback(e,t))})}function wrapCallback(e,t){if(e)return t&&t.length||batchFn?(...r)=>{const n=()=>t?.length?withEffectStack(t,()=>e(...r)):e(...r);return batchFn?batchFn(n,"immediate"):n()}:e}function setZoneEnabled(e){e&&!zoneHooked?(hookZone(),zoneHooked=!0):!e&&zoneHooked&&(Promise.prototype.then=originalPromiseThen,Promise.prototype.catch=originalPromiseCatch,Promise.prototype.finally=originalPromiseFinally,globalThis.setTimeout=originalSetTimeout,globalThis.setInterval=originalSetInterval,originalRequestAnimationFrame&&(globalThis.requestAnimationFrame=originalRequestAnimationFrame),originalQueueMicrotask&&(globalThis.queueMicrotask=originalQueueMicrotask),zoneHooked=!1)}function isZoneEnabled(){return zoneHooked}function findCycleInChain(e){const t=new Map;for(let r=0;r<e.length;r++){const n=e[r];if(t.has(n))return e.slice(t.get(n));t.set(n,r)}return null}function formatRoots(e,t=20){const r=e.map(e=>e.name||"<anonymous>");if(r.length<=t)return r.join(" → ");const n=r.slice(0,5),o=r.slice(-10);return`${n.join(" → ")} ... (${r.length-15} more) ... ${o.join(" → ")}`}const activationLog=new Array(100);function getActivationLog(){return activationLog}function recordActivation(e,t,r,n){const o=getRoot(e);if(!activationRegistry)return;let i=activationRegistry.get(o);i||(i=new Map,activationRegistry.set(o,i));let s=i.get(t);s||(s=new Map,i.set(t,s));const a=(s.get(n)??0)+1;if(s.set(n,a),activationLog.unshift({effect:e,obj:t,evolution:r,prop:n}),activationLog.pop(),a>=options.maxTriggerPerBatch){const e=o?.name||"anonymous",t=`Aggressive trigger detected: effect "${e}" triggered ${a} times in the batch by the same cause.`;if("throw"===options.maxEffectReaction)throw new ReactiveError(t,{code:ReactiveErrorCode.MaxReactionExceeded,count:a,effect:e});options.warn(`[reactive] ${t}`)}}function trackEffect(e){const t=getActiveEffect();if(!t)throw new Error("Not in an effect");effectTrackers.has(t)?effectTrackers.get(t).add(e):effectTrackers.set(t,new Set([e]))}const effectTrackers=new WeakMap,opaqueEffects=new WeakSet,effectTriggers=new WeakMap,effectTriggeredBy=new WeakMap,causesClosure=new WeakMap,consequencesClosure=new WeakMap,effectCreationStacks=new WeakMap;function getOrCreateClosure(e,t){let r=e.get(t);return r||(r=new IterableWeakSet,e.set(t,r)),r}function addGraphEdge(e,t){const r=effectTriggers.get(e);if(r?.has(t))return;if(r)r.add(t);else{const r=new IterableWeakSet;r.add(t),effectTriggers.set(e,r)}let n=effectTriggeredBy.get(t);if(n||(n=new IterableWeakSet,effectTriggeredBy.set(t,n)),n.add(e),e===t)return;const o=getOrCreateClosure(consequencesClosure,e),i=getOrCreateClosure(causesClosure,t);o.add(t),i.add(e);const s=causesClosure.get(e);if(s)for(const e of s){if(e===t)continue;getOrCreateClosure(consequencesClosure,e).add(t),i.add(e)}const a=consequencesClosure.get(t);if(a)for(const t of a){if(t===e)continue;getOrCreateClosure(causesClosure,t).add(e),o.add(t)}if(s&&a)for(const e of s){const t=getOrCreateClosure(consequencesClosure,e);for(const r of a){if(e===r)continue;t.add(r);getOrCreateClosure(causesClosure,r).add(e)}}}function hasPathExcluding(e,t,r){if(e===t)return!0;if(e===r)return!1;const n=new Set,o=[e];for(n.add(e),n.add(r);o.length>0;){const e=o.shift(),r=effectTriggers.get(e);if(r)for(const e of r){if(e===t)return!0;n.has(e)||(n.add(e),o.push(e))}}return!1}function cleanupEffectFromGraph(e){const t=getRoot(e),r=causesClosure.get(t),n=consequencesClosure.get(t),o=effectTriggers.get(t);if(o){for(const e of o){const r=effectTriggeredBy.get(e);r?.delete(t)}effectTriggers.delete(t)}const i=effectTriggeredBy.get(t);if(i){for(const e of i){const r=effectTriggers.get(e);r?.delete(t)}effectTriggeredBy.delete(t)}if(r)for(const e of r){const r=consequencesClosure.get(e);if(r&&(r.delete(t),n))for(const o of n)hasPathExcluding(e,o,t)||r.delete(o)}if(n)for(const e of n){const n=causesClosure.get(e);if(n&&(n.delete(t),r))for(const o of r)hasPathExcluding(o,e,t)||n.delete(o)}if(r&&n)for(const e of r){const r=consequencesClosure.get(e);if(r)for(const o of n)if(!hasPathExcluding(e,o,t)){r.delete(o);const t=causesClosure.get(o);t?.delete(e)}}causesClosure.delete(t),consequencesClosure.delete(t)}let batchQueue;function hasBatched(e){return batchQueue?.all.has(getRoot(e))}const batchCleanups=new Set;function computeAllInDegrees(e){const t=getActiveEffect(),r=t?getRoot(t):null;e.inDegrees.clear();for(const[t]of e.all){let n=0;const o=causesClosure.get(t);if(o)for(const i of o)e.all.has(i)&&i!==r&&i!==t&&n++;e.inDegrees.set(t,n)}}function decrementInDegreesForExecuted(e,t){const r=consequencesClosure.get(t);if(r)for(const t of r)if(e.all.has(t)){const r=e.inDegrees.get(t)??0;r>0&&e.inDegrees.set(t,r-1)}}function findPath(e,t,r=new Set,n=[]){if(e===t)return[...n,t];if(r.has(e))return[];r.add(e);const o=[...n,e],i=effectTriggers.get(e);if(i)for(const e of i){const n=findPath(e,t,r,o);if(n.length>0)return n}return[]}function getCyclePathForEdge(e,t){const r=findPath(t,e);return r.length>0?[e,...r]:[]}function wouldCreateCycle(e,t){if(e===t)return!1;const r=consequencesClosure.get(t);return!!r?.has(e)}function addToBatch(e,t,r){const n=e[cleanup$1];if(n&&n(),e[stopped])return;if(!batchQueue)return;const o=getRoot(e);if(batchQueue.all.set(o,e),t&&!r){const r=getRoot(t);if(wouldCreateCycle(r,o)){const t=getCyclePathForEdge(r,o),n=t.length>0?`Cycle detected: ${t.map(e=>e.name||e.toString()).join(" → ")}`:`Cycle detected: ${r.name||r.toString()} → ${o.name||o.toString()} (and back)`,i=options.cycleHandling;if("strict"===i){batchQueue.all.delete(o);const r=getTriggerChain(e),i=effectCreationStacks.get(o);throw new ReactiveError(`[reactive] Strict Cycle Prevention: ${n}`,{code:ReactiveErrorCode.CycleDetected,cycle:t.map(e=>e.name||e.toString()),details:n,causalChain:r,creationStack:i})}switch(i){case"throw":{batchQueue.all.delete(o);const r=getTriggerChain(e),i=effectCreationStacks.get(o);throw new ReactiveError(`[reactive] ${n}`,{code:ReactiveErrorCode.CycleDetected,cycle:t.map(e=>e.name||e.toString()),details:n,causalChain:r,creationStack:i})}case"warn":return options.warn(`[reactive] ${n}`),void batchQueue.all.delete(o);case"break":return void batchQueue.all.delete(o)}}addGraphEdge(r,o)}}function addBatchCleanup(e){batchQueue?batchCleanups.add(e):e()}const defer=addBatchCleanup;function getCyclePath(e){const t=new Set,r=new Set,n=[];for(const[o]of e.all){if(t.has(o))continue;const i=findCycle(o,t,r,n,e);if(i.length>0)return i}return[]}function findCycle(e,t,r,n,o){if(r.has(e)){const t=n.indexOf(e);return n.slice(t).concat([e])}if(t.has(e))return[];t.add(e),r.add(e),n.push(e);const i=effectTriggers.get(e);if(i)for(const e of i)if(o.all.has(e)){const i=findCycle(e,t,r,n,o);if(i.length>0)return i}return n.pop(),r.delete(e),[]}function executeNext(e){let t=null,r=null;for(const[e,n]of batchQueue.all){if(0===(batchQueue.inDegrees.get(e)??0)){t=n,r=e;break}}if(!t){if(batchQueue.all.size>0){let e=getCyclePath(batchQueue);if(0===e.length)for(const[t]of batchQueue.all){const r=consequencesClosure.get(t);if(r){for(const n of r)if(n!==t&&batchQueue.all.has(n)){const r=consequencesClosure.get(n);if(r?.has(t)){e=[t,n,t];break}}if(e.length>0)break}}const t=e.length>0?`Cycle detected: ${e.map(e=>e.name||"<anonymous>").join(" → ")}`:"Cycle detected in effect batch - all effects have dependencies that prevent execution";switch(options.cycleHandling){case"throw":throw new ReactiveError(`[reactive] ${t}`);case"warn":{options.warn(`[reactive] ${t}`);const e=batchQueue.all.values().next().value;if(e){const t=getRoot(e);return batchQueue.all.delete(t),batchQueue.inDegrees.delete(t),e()}break}case"break":{const e=batchQueue.all.values().next().value;if(e){const t=getRoot(e);return batchQueue.all.delete(t),batchQueue.inDegrees.delete(t),e()}break}}}return null}e.push(getRoot(t));const n=t();return batchQueue.all.delete(r),batchQueue.inDegrees.delete(r),decrementInDegreesForExecuted(batchQueue,r),n}function batch(e,t){Array.isArray(e)||(e=[e]);const r=e.map(getRoot);if(batchQueue){options?.chain(r,getRoot(getActiveEffect()));const n=getActiveEffect();for(let r=0;r<e.length;r++)addToBatch(e[r],n,"immediate"===t);if(t){const t={};for(let r=0;r<e.length;r++)try{const n=e[r]();void 0===n||"value"in t||(t.value=n)}finally{const t=getRoot(e[r]);batchQueue.all.delete(t)}return t.value}}else{if(activationRegistry)throw new Error("Batch already in progress");activationRegistry=new Map,options.beginChain(r),batchQueue={all:new Map,inDegrees:new Map};const n=getActiveEffect();for(let r=0;r<e.length;r++)addToBatch(e[r],n,"immediate"===t);const o=[];if(computeAllInDegrees(batchQueue),t){const t={};try{for(let r=0;r<e.length;r++)try{const n=e[r]();void 0===n||"value"in t||(t.value=n)}finally{const t=getRoot(e[r]);batchQueue.all.delete(t)}for(;batchQueue.all.size>0;){if(o.length>options.maxEffectChain){const e=findCycleInChain(o),t=formatRoots(o),r=e?`Max effect chain reached (cycle detected: ${formatRoots(e)})`:`Max effect chain reached (trace: ${t})`,n=(batchQueue?Array.from(batchQueue.all.keys()):[]).map(e=>e.name||"<anonymous>"),i={code:ReactiveErrorCode.MaxDepthExceeded,effectuatedRoots:o,cycle:e,trace:t,maxEffectChain:options.maxEffectChain,queued:n.slice(0,50),queuedCount:n.length,causalChain:o.length>0?getTriggerChain(batchQueue.all.get(o[o.length-1])):[]};switch(options.maxEffectReaction){case"throw":case"debug":throw new ReactiveError(`[reactive] ${r}`,i);case"warn":options.warn(`[reactive] ${r} (queued: ${n.slice(0,10).join(", ")}${n.length>10?", …":""})`)}}if(!batchQueue||0===batchQueue.all.size)break;const e=executeNext(o);void 0===e||"value"in t||(t.value=e)}const r=Array.from(batchCleanups);batchCleanups.clear();for(const e of r)e();return t.value}finally{activationRegistry=void 0,batchQueue=void 0,options.endChain()}}else{const e={};try{for(;batchQueue.all.size>0||batchCleanups.size>0;){for(;batchQueue.all.size>0;){if(o.length>options.maxEffectChain){const e=findCycleInChain(o),t=formatRoots(o),r=e?`Max effect chain reached (cycle detected: ${formatRoots(e)})`:`Max effect chain reached (trace: ${t})`,n=(batchQueue?Array.from(batchQueue.all.keys()):[]).map(e=>e.name||"<anonymous>"),i={code:ReactiveErrorCode.MaxDepthExceeded,effectuatedRoots:o,cycle:e,trace:t,maxEffectChain:options.maxEffectChain,queued:n.slice(0,50),queuedCount:n.length,causalChain:o.length>0?getTriggerChain(batchQueue.all.get(o[o.length-1])):[]};switch(options.maxEffectReaction){case"throw":case"debug":throw new ReactiveError(`[reactive] ${r}`,i);case"warn":options.warn(`[reactive] ${r} (queued: ${n.slice(0,10).join(", ")}${n.length>10?", …":""})`)}}const t=executeNext(o);if(0===batchQueue.all.size)break;void 0===t||"value"in e||(e.value=t)}if(batchCleanups.size>0){const e=Array.from(batchCleanups);batchCleanups.clear();for(const t of e)t()}}return e.value}finally{activationRegistry=void 0,batchQueue=void 0,options.endChain()}}}}const atomic=decorator({method:e=>function(...t){const r=()=>e.apply(this,t);return Object.defineProperty(r,"name",{value:`atomic(${e.name})`}),batch(r,"immediate")},default:e=>function(...t){const r=()=>e.apply(this,t);return Object.defineProperty(r,"name",{value:`atomic(${e.name})`}),batch(r,"immediate")}}),fr=new FinalizationRegistry(e=>e());function effect(e,t){ensureZoneHooked(batch);const r=t?.asyncMode??options.asyncMode??"cancel";if(options.introspection.enableHistory){const t=(new Error).stack;if(t){const r=t.split("\n").slice(2).join("\n");effectCreationStacks.set(getRoot(e),r)}}let n=null;const o=captureEffectStack(),i=e=>withEffect(u,e),s=e=>withEffectStack(o,e);let a=!1,c=!1,l=null,f=null;function u(){if(n){const e=n;n=null,withEffect(void 0,()=>e())}if(l)if("cancel"===r&&f)f(),f=null,l=null;else if("ignore"===r)return;if(a)return;let t,o;options.enter(getRoot(e));try{if(o=withEffect(u,()=>e({tracked:i,ascend:s,reaction:c})),o&&"function"!=typeof o&&("object"!=typeof o||!("then"in o)))throw new ReactiveError(`[reactive] Effect returned a non-function value: ${o}`);if(o&&"object"==typeof o&&"function"==typeof o.then){const e=o;let t=null;const r=new Promise((e,r)=>{t=r}),n=new ReactiveError("[reactive] Effect canceled due to dependency change");l=Promise.race([e,r]),f=()=>{t&&t(n)}}else t=o}finally{c=!0,options.leave(e)}n=()=>{n=null,t?.();const e=effectToReactiveObjects.get(u);if(e){for(const t of e){const e=watchers.get(t);if(e){for(const[t,r]of e.entries())r.delete(u),0===r.size&&e.delete(t);0===e.size&&watchers.delete(t)}}effectToReactiveObjects.delete(u)}const r=effectChildren.get(u);if(r){for(const e of r)e();effectChildren.delete(u)}}}markWithRoot(u,e),t?.opaque&&opaqueEffects.add(u),isDevtoolsEnabled()&®isterEffectForDebug(u),batch(u,"immediate");const d=o[0];effectParent.set(u,d);const h=()=>{a||(a=!0,f&&(f(),f=null,l=null),n?.(),cleanupEffectFromGraph(u),fr.unregister(h))};function p(e){return Object.defineProperty(e,stopped,{get:()=>a}),Object.defineProperty(e,cleanup$1,{value:()=>{if(n){const e=n;n=null,withEffect(void 0,()=>e())}}}),e}if(!d){const t=p(()=>h());return fr.register(t,()=>{h(),options.garbageCollected(e)},h),t}let g=effectChildren.get(d);g||(g=new Set,effectChildren.set(d,g));const y=p(()=>{g.delete(y),0===g.size&&effectChildren.delete(d),h()});return g.add(y),y}function untracked(e){const t=getTrackingDisabled();setTrackingDisabled(!0);try{return e()}finally{setTrackingDisabled(t)}}function root(e){let t;return withEffect(void 0,()=>{t=e()}),t}function biDi(e,t,r){"function"!=typeof t&&(r=t.set,t=t.get);const n=getRoot(e);return effect(markWithRoot(()=>{e(t())},n)),atomic(e=>{r(e),batchQueue?.all.has(n)&&batchQueue.all.delete(n)})}const objectParents=new WeakMap,objectsWithDeepWatchers=new WeakSet,deepWatchers=new WeakMap,effectToDeepWatchedObjects=new WeakMap;function addBackReference(e,t,r){let n=objectParents.get(e);n||(n=new Set,objectParents.set(e,n)),n.add({parent:t,prop:r})}function removeBackReference(e,t,r){const n=objectParents.get(e);if(n){for(const e of n)if(e.parent===t&&e.prop===r){n.delete(e);break}0===n.size&&objectParents.delete(e)}}function needsBackReferences(e){return!!objectsWithDeepWatchers.has(e)||hasParentWithDeepWatchers(e)}function bubbleUpChange(e,t){const r=objectParents.get(e);if(r)for(const{parent:e}of r){const t=deepWatchers.get(e);if(t)for(const e of t)batch(e);bubbleUpChange(e)}}function hasParentWithDeepWatchers(e){const t=objectParents.get(e);if(!t)return!1;for(const{parent:e}of t){if(objectsWithDeepWatchers.has(e))return!0;if(hasParentWithDeepWatchers(e))return!0}return!1}const states=new WeakMap;function addState(e,t){const r={},n=getState(e=unwrap(e));n&&Object.assign(n,{evolution:t,next:r}),states.set(e,r)}function getState(e){e=unwrap(e);let t=states.get(e);return t||(t={},states.set(e,t)),t}function collectEffects(e,t,r,n,...o){const i=getActiveEffect();for(const s of o)for(const o of s){const s=n.get(o);if(s)for(const n of s){const s=isRunning(n);if(s){options.skipRunningEffect(n,s);continue}r.has(n)||(r.add(n),hasBatched(n)||recordActivation(n,e,t,o));const a=effectTrackers.get(n);if(recordTriggerLink(i,n,e,o,t),a){for(const r of a)r(e,t,o);a.delete(n)}}}}function touched1(e,t,r){touched(e,t,[r])}function touched(e,t,r){addState(e=unwrap(e),t);const n=watchers.get(e);if(n){const o=new Set;r?collectEffects(e,t,o,n,[allProps],r):collectEffects(e,t,o,n,n.keys()),options.touched(e,t,r,o),batch(Array.from(o))}objectsWithDeepWatchers.has(e)&&bubbleUpChange(e)}function touchedOpaque(e,t,r){e=unwrap(e);const n=watchers.get(e);if(!n)return;const o=n.get(r);if(!o)return;const i=new Set,s=getActiveEffect();for(const n of o){if(!opaqueEffects.has(n))continue;const o=isRunning(n);if(o){options.skipRunningEffect(n,o);continue}i.add(n),recordActivation(n,e,t,r);const a=effectTrackers.get(n);if(recordTriggerLink(s,n,e,r,t),a){for(const n of a)n(e,t,r);a.delete(n)}}i.size>0&&(options.touched(e,t,[r],i),batch(Array.from(i)))}const nonReactiveObjects=new WeakSet,immutables=new Set,absent=Symbol("absent");function markNonReactive(...e){for(const t of e){try{Object.defineProperty(t,nonReactiveMark,{value:!0,writable:!1,enumerable:!1,configurable:!1})}catch{}nonReactiveMark in t||nonReactiveObjects.add(t)}return e[0]}function nonReactiveClass(...e){for(const t of e)t&&(t.prototype[nonReactiveMark]=!0);return e[0]}function isNonReactive(e){if(null===e||"object"!=typeof e)return!0;if(nonReactiveObjects.has(e))return!0;if(e[nonReactiveMark])return!0;for(const t of immutables)if(t(e))return!0;return!1}function registerNativeReactivity(e,t){e.prototype[nativeReactive]=t,nonReactiveClass(t)}function isObject$1(e){return"object"==typeof e&&null!==e}function isObjectLike(e){return isObject$1(e)}function getPrototypeToken(e){if(isObjectLike(e)){if(Array.isArray(e))return Array.prototype;try{return e.constructor}catch{return}}}function shouldRecurseTouch(e,t){return e!==t&&(!(!isObjectLike(e)||!isObjectLike(t))&&(!isNonReactive(e)&&!isNonReactive(t)&&getPrototypeToken(e)===getPrototypeToken(t)))}function notifyPropertyChange(e,t,r,n,o){const i={type:o?"set":"add",prop:t};if(options.recursiveTouching&&void 0!==r&&shouldRecurseTouch(r,n)){const o={obj:unwrap(e),prop:t};dispatchNotifications(recursiveTouch(r,n,new WeakMap,[],o)),touchedOpaque(e,i,t)}else touched1(e,i,t)}function hasVisitedPair(e,t,r){let n=e.get(t);return n||(n=new WeakSet,e.set(t,n)),!!n.has(r)||(n.add(r),!1)}function collectObjectKeys(e){const t=new Set(Reflect.ownKeys(e));let r=Object.getPrototypeOf(e);for(;r&&!Object.hasOwn(r,"constructor");){for(const e of Reflect.ownKeys(r))t.add(e);r=Object.getPrototypeOf(r)}return t}function recursiveTouch(e,t,r=new WeakMap,n=[],o){return shouldRecurseTouch(e,t)&&isObjectLike(e)&&isObjectLike(t)?hasVisitedPair(r,e,t)?n:Array.isArray(e)&&Array.isArray(t)?(diffArrayElements(e,t,r,n,o),n):(diffObjectProperties(e,t,r,n,o),n):n}function diffArrayElements(e,t,r,n,o){const i=[],s=e.length,a=t.length,c=Math.max(s,a);for(let r=0;r<c;r++){const n=r<s,c=r<a;if(n&&!c){i.push({target:e,evolution:{type:"del",prop:r},prop:r,origin:o});continue}if(!n&&c){i.push({target:e,evolution:{type:"add",prop:r},prop:r,origin:o});continue}if(!n||!c)continue;const l=unwrap(e[r]),f=unwrap(t[r]);Object.is(l,f)||i.push({target:e,evolution:{type:"set",prop:r},prop:r,origin:o})}s!==a&&i.push({target:e,evolution:{type:"set",prop:"length"},prop:"length",origin:o}),n.push(...i)}function diffObjectProperties(e,t,r,n,o){const i=collectObjectKeys(e),s=collectObjectKeys(t),a=[];for(const t of i)s.has(t)||a.push({target:e,evolution:{type:"del",prop:t},prop:t,origin:o});for(const t of s)i.has(t)||a.push({target:e,evolution:{type:"add",prop:t},prop:t,origin:o});for(const c of s){if(!i.has(c))continue;const s=unwrap(e[c]),l=unwrap(t[c]);shouldRecurseTouch(s,l)?recursiveTouch(s,l,r,n,o):Object.is(s,l)||a.push({target:e,evolution:{type:"set",prop:c},prop:c,origin:o})}n.push(...a)}function hasAncestorInSet(e,t){let r=e;const n=new WeakSet;for(;r&&!n.has(r);){if(n.add(r),t.has(r))return!0;r=effectParent.get(r)}return!1}function dispatchNotifications(e){if(!e.length)return;const t=new Set,r=e[0]?.origin;let n;if(r){n=new Set;const e=watchers.get(r.obj);if(e){const t=new Set;collectEffects(r.obj,{type:"set",prop:r.prop},t,e,[allProps],[r.prop]);for(const e of t)n.add(e)}if(0===n.size)return}for(const{target:o,evolution:i,prop:s}of e){if(!isObjectLike(o))continue;const e=unwrap(o);addState(e,i);const a=watchers.get(e);let c;const l=[s];if(a){if(c=new Set,collectEffects(e,i,c,a,[allProps],l),r&&n){const e=new Set;for(const t of c)(n.has(t)||hasAncestorInSet(t,n))&&e.add(t);c=e}for(const e of c)t.add(e)}options.touched(e,i,l,c),objectsWithDeepWatchers.has(e)&&bubbleUpChange(e)}t.size&&batch([...t])}nonReactiveClass(Date,RegExp,Error,Promise,Function),"undefined"!=typeof window&&(markNonReactive(window,document),nonReactiveClass(Node,Element,HTMLElement,EventTarget));const hasReentry=[],reactiveHandlers={[Symbol.toStringTag]:"MutTs Reactive",get(e,t,r){if(t===nonReactiveMark)return!1;const n=unwrap(e);if(n[unreactiveProperties]?.has(t)||"symbol"==typeof t)return ReflectGet(e,t,r);prototypeForwarding in e&&e[prototypeForwarding]instanceof Array&&"string"==typeof t&&("length"===t||!Number.isNaN(Number(t)))&&dependant(e,"length"===t?"length":Number(t));const o=Reflect.has(r,t),i=o&&Object.hasOwn(r,t),s=o&&!i,a=options.ignoreAccessors&&i&&(isOwnAccessor(r,t)||isOwnAccessor(n,t));if(o&&(options.instanceMembers&&s&&e instanceof Object||a)||dependant(e,t),s&&(!options.instanceMembers||!(e instanceof Object))){let r=reactiveObject(Object.getPrototypeOf(e));for(;r&&r!==Object.prototype&&(dependant(r,t),!Object.hasOwn(r,t));){let e=reactiveObject(Object.getPrototypeOf(r));e===r&&(e=reactiveObject(Object.getPrototypeOf(unwrap(r)))),r=e}}const c=ReflectGet(e,t,r);if("object"==typeof c&&null!==c){const r=reactiveObject(c);return needsBackReferences(e)&&addBackReference(r,e,t),r}return c},set(e,t,r,n){const o=unwrap(e),i=unwrap(n);if(o[unreactiveProperties]?.has(t)||o!==i)return ReflectSet(e,t,r,n);const s=prototypeForwarding in e&&e[prototypeForwarding]instanceof Array&&(!Number.isNaN(Number(t))||"length"===t),a=unwrap(r);if(s)return e[t]=a,!0;let c=absent;if(Reflect.has(i,t)){Object.getOwnPropertyDescriptor(i,t),Object.getOwnPropertyDescriptor(o,t);c=withEffect(void 0,()=>Reflect.get(o,t,n))}if(objectsWithDeepWatchers.has(e)&&("object"==typeof c&&null!==c&&removeBackReference(c,e,t),"object"==typeof a&&null!==a)){addBackReference(reactiveObject(a),e,t)}return c!==a&&ReflectSet(e,t,a,n)&¬ifyPropertyChange(e,t,c,a,c!==absent),!0},has(e,t){if(hasReentry.includes(e))throw new ReactiveError(`[reactive] Circular dependency detected in 'has' check for property '${String(t)}'`,{code:ReactiveErrorCode.CycleDetected,cycle:[]});hasReentry.push(e),dependant(e,t);const r=Reflect.has(e,t);return hasReentry.pop(),r},deleteProperty(e,t){if(!Object.hasOwn(e,t))return!1;const r=e[t];return objectsWithDeepWatchers.has(e)&&"object"==typeof r&&null!==r&&removeBackReference(r,e,t),delete e[t],touched1(e,{type:"del",prop:t},t),objectsWithDeepWatchers.has(e)&&bubbleUpChange(e),!0},getPrototypeOf:e=>prototypeForwarding in e?e[prototypeForwarding]:Object.getPrototypeOf(e),setPrototypeOf:(e,t)=>!(prototypeForwarding in e)&&(Object.setPrototypeOf(e,t),!0),ownKeys:e=>(dependant(e,allProps),Reflect.ownKeys(e))},reactiveClasses=new WeakSet,ReactiveBase=mixin(e=>class extends e{constructor(...e){return super(...e),reactiveClasses.has(new.target)?reactive(this):this}});function reactiveObject(e){if(!e||"object"!=typeof e)return e;const t=e;if(isNonReactive(t))return t;if(proxyToObject.has(t))return t;const r=getExistingProxy(t);if(void 0!==r)return r;const n=!(nativeReactive in t)||t instanceof t[nativeReactive]?t:new t[nativeReactive](t);n!==t&&trackProxyObject(n,t);const o=new Proxy(n,reactiveHandlers);return storeProxyRelationship(t,o),o}const reactive=decorator({class(e){if(e.prototype instanceof ReactiveBase)return reactiveClasses.add(e),e;class t extends e{constructor(...r){return super(...r),new.target===t||reactiveClasses.has(new.target)||options.warn(`${e.name} has been inherited by ${this.constructor.name} that is not reactive.\n@reactive decorator must be applied to the leaf class OR classes have to extend ReactiveBase.`),reactive(this)}}return Object.defineProperty(t,"name",{value:`Reactive<${e.name}>`}),t},get:e=>reactiveObject(e),default:reactiveObject});function isObject(e){return"object"==typeof e&&null!==e}function deepWatch(e,t,{immediate:r=!1}={}){if(null==e)return;if("object"!=typeof e)throw new Error("Target of deep watching must be an object");const n=markWithRoot(()=>t(e),t);return effect(()=>{objectsWithDeepWatchers.add(e);let o=effectToDeepWatchedObjects.get(n);o||(o=new Set,effectToDeepWatchedObjects.set(n,o)),o.add(e);const i=new WeakSet;return function e(t,r=0){if(t&&!i.has(t)&&isObject(t)&&!(r>options.maxDeepWatchDepth)&&!isNonReactive(t)){i.add(t),objectsWithDeepWatchers.add(t),o.add(t);for(const n in unwrap(t))if(Object.hasOwn(t,n)){const o=t[n];e("object"==typeof o&&null!==o?reactive(o):o,r+1)}if(Array.isArray(t)||t instanceof Array){const n=t.length;for(let o=0;o<n;o++){const n=t[o];e("object"==typeof n&&null!==n?reactive(n):n,r+1)}}else if(t instanceof Set)for(const n of t){e("object"==typeof n&&null!==n?reactive(n):n,r+1)}else if(t instanceof Map)for(const[n,o]of t){e("object"==typeof o&&null!==o?reactive(o):o,r+1)}}}(e),r&&t(e),r=!0,()=>{const e=effectToDeepWatchedObjects.get(n);if(e){for(const t of e){const e=deepWatchers.get(t);e?(e.delete(n),0===e.size&&(deepWatchers.delete(t),objectsWithDeepWatchers.delete(t))):objectsWithDeepWatchers.delete(t)}effectToDeepWatchedObjects.delete(n)}}})}const cleanup=Symbol("cleanup"),unsetYet=Symbol("unset-yet");function watch(e,t,r={}){return"function"==typeof e?watchCallBack(e,t,r):"object"==typeof e&&null!==e?watchObject(e,t,r):(()=>{throw new Error("watch: value must be a function or an object")})()}function watchObject(e,t,{immediate:r=!1,deep:n=!1}={}){const o=getActiveEffect();return n?deepWatch(e,t,{immediate:r}):effect(function(){dependant(e),r&&withEffect(o,()=>t(e)),r=!0})}function watchCallBack(e,t,{immediate:r=!1,deep:n=!1}={}){const o=getActiveEffect();let i,s=unsetYet;const a=effect(markWithRoot(function(a){const c=e(a);s!==c&&withEffect(o,()=>{s===unsetYet?r&&t(c):t(c,s),s=c,n&&(i&&i(),i=deepWatch(c,e=>t(e,e)))})},e));return()=>{a(),i&&i()}}function deepNonReactive(e){if(isNonReactive(e=unwrap(e)))return e;try{Object.defineProperty(e,nonReactiveMark,{value:!0,writable:!1,enumerable:!1,configurable:!0})}catch{}return nonReactiveMark in e||nonReactiveObjects.add(e),e}function unreactiveApplication(e,...t){return"object"==typeof e?deepNonReactive(e):r=>{r.prototype[unreactiveProperties]=new Set(r.prototype[unreactiveProperties]||[]),r.prototype[unreactiveProperties].add(e);for(const e of t)r.prototype[unreactiveProperties].add(e);return r}}const unreactive=decorator({class(e){nonReactiveClass(e)},default:unreactiveApplication});function cleanedBy(e,t){return Object.defineProperty(e,cleanup,{value:t,writable:!1,enumerable:!1,configurable:!0})}function derived(e){const t={value:void 0};return cleanedBy(t,untracked(()=>effect(function(r){t.value=e(r)})))}function*makeReactiveIterator(e){let t=e.next();for(;!t.done;)yield reactive(t.value),t=e.next()}function*makeReactiveEntriesIterator(e){let t=e.next();for(;!t.done;){const[r,n]=t.value;yield[reactive(r),reactive(n)],t=e.next()}}const native$2=Symbol("native"),isArray=Array.isArray;Array.isArray=e=>isArray(e)||e&&"object"==typeof e&&prototypeForwarding in e&&Array.isArray(e[prototypeForwarding]);class ReactiveBaseArray{at(e){const t=e<0?this[native$2].length+e:e;if(dependant(this,t),!(t<0||t>=this[native$2].length))return reactive(this[native$2][t])}toReversed(){return dependant(this),reactive(this[native$2].toReversed())}toSorted(e){return dependant(this),reactive(this[native$2].toSorted(e))}toSpliced(e,t,...r){return dependant(this),void 0===t?this[native$2].toSpliced(e):this[native$2].toSpliced(e,t,...r)}with(e,t){return dependant(this),reactive(this[native$2].with(e,t))}entries(){return dependant(this),makeReactiveEntriesIterator(this[native$2].entries())}keys(){return dependant(this,"length"),this[native$2].keys()}values(){return dependant(this),makeReactiveIterator(this[native$2].values())}[Symbol.iterator](){dependant(this);const e=this[native$2][Symbol.iterator]();return{next(){const t=e.next();return t.done?t:{value:reactive(t.value),done:!1}}}}indexOf(e,t){dependant(this);const r=unwrap(e),n=this[native$2].indexOf(r,t);return-1!==n?n:this[native$2].indexOf(e,t)}lastIndexOf(e,t){dependant(this);const r=unwrap(e),n=this[native$2].lastIndexOf(r,t);return-1!==n?n:this[native$2].lastIndexOf(e,t)}includes(e,t){dependant(this);const r=unwrap(e);return this[native$2].includes(r,t)||this[native$2].includes(e,t)}find(e,t){if(dependant(this),"function"==typeof e){const r=e;return reactive(this[native$2].find((e,n,o)=>r.call(t,reactive(e),n,o),t))}const r="number"==typeof t?t:void 0,n=this[native$2].indexOf(e,r);if(-1!==n)return reactive(this[native$2][n])}findIndex(e,t){if(dependant(this),"function"==typeof e){const r=e;return this[native$2].findIndex((e,n,o)=>r.call(t,reactive(e),n,o),t)}const r="number"==typeof t?t:void 0;return this[native$2].indexOf(e,r)}flat(){return dependant(this),reactive(this[native$2].flat())}flatMap(e,t){return dependant(this),reactive(this[native$2].flatMap(e,t))}filter(e,t){return dependant(this),reactive(this[native$2].filter((t,r,n)=>e(reactive(t),r,n),t))}map(e,t){return dependant(this),reactive(this[native$2].map((t,r,n)=>e(reactive(t),r,n),t))}reduce(e,t){dependant(this);const r=void 0===t?this[native$2].reduce(e):this[native$2].reduce(e,t);return reactive(r)}reduceRight(e,t){dependant(this);const r=void 0!==t?this[native$2].reduceRight(e,t):this[native$2].reduceRight(e);return reactive(r)}slice(e,t){for(const r of range(e||0,t||this[native$2].length-1))dependant(this,r);return void 0===e?this[native$2].slice():void 0===t?this[native$2].slice(e):this[native$2].slice(e,t)}concat(...e){return dependant(this),reactive(this[native$2].concat(...e))}join(e){return dependant(this),this[native$2].join(e)}forEach(e,t){dependant(this),this[native$2].forEach((r,n,o)=>{e.call(t,reactive(r),n,o)})}every(e,t){return dependant(this),this[native$2].every((r,n,o)=>e.call(t,reactive(r),n,o),t)}some(e,t){return dependant(this),this[native$2].some((r,n,o)=>e.call(t,reactive(r),n,o),t)}}function*index(e,{length:t=!0}={}){t&&(yield"length"),yield e}function*range(e,t,{length:r=!1}={}){const n=Math.min(e,t),o=Math.max(e,t);r&&(yield"length");for(let e=n;e<=o;e++)yield e}class ReactiveArray extends(Indexable(ReactiveBaseArray,{get(e){return dependant(this,e),reactive(this[native$2][e])},set(e,t){const r=e>=this[native$2].length;this[native$2][e]=t,touched(this,{type:"set",prop:e},index(e,{length:r}))},getLength(){return dependant(this,"length"),this[native$2].length},setLength(e){const t=this[native$2].length;try{this[native$2].length=e}finally{touched(this,{type:"set",prop:"length"},range(t,e,{length:!0}))}}})){constructor(e){super(),Object.defineProperties(this,{[native$2]:{value:e},[prototypeForwarding]:{value:e}})}push(...e){const t=this[native$2].length;try{return this[native$2].push(...e)}finally{touched(this,{type:"bunch",method:"push"},range(t,t+e.length-1,{length:!0}))}}pop(){if(0!==this[native$2].length)try{return reactive(this[native$2].pop())}finally{touched(this,{type:"bunch",method:"pop"},index(this[native$2].length))}}shift(){if(0!==this[native$2].length)try{return reactive(this[native$2].shift())}finally{touched(this,{type:"bunch",method:"shift"},range(0,this[native$2].length+1,{length:!0}))}}unshift(...e){try{return this[native$2].unshift(...e)}finally{touched(this,{type:"bunch",method:"unshift"},range(0,this[native$2].length-e.length,{length:!0}))}}splice(e,t,...r){const n=this[native$2].length;void 0===t&&(t=n-e);try{return reactive(void 0===t?this[native$2].splice(e):this[native$2].splice(e,t,...r))}finally{touched(this,{type:"bunch",method:"splice"},t===r.length?range(e,e+t):range(e,n+Math.max(r.length-t,0),{length:!0}))}}reverse(){try{return this[native$2].reverse()}finally{touched(this,{type:"bunch",method:"reverse"},range(0,this[native$2].length-1))}}sort(e){e=e||((e,t)=>e.toString().localeCompare(t.toString()));try{return this[native$2].sort((t,r)=>e(reactive(t),reactive(r)))}finally{touched(this,{type:"bunch",method:"sort"},range(0,this[native$2].length-1))}}fill(e,t,r){try{return void 0===t?this[native$2].fill(e):void 0===r?this[native$2].fill(e,t):this[native$2].fill(e,t,r)}finally{touched(this,{type:"bunch",method:"fill"},range(0,this[native$2].length-1))}}copyWithin(e,t,r){try{return void 0===r?this[native$2].copyWithin(e,t):this[native$2].copyWithin(e,t,r)}finally{touched(this,{type:"bunch",method:"copyWithin"},range(0,this[native$2].length-1))}}}class ReadOnlyError extends Error{}class ReactiveReadOnlyArrayClass extends(Indexable(ReactiveBaseArray,{get(e){return dependant(this,e),reactive(this[native$2][e])},set(e,t){throw new ReadOnlyError(`Setting index ${e} on a read-only array`)},getLength(){return dependant(this,"length"),this[native$2].length},setLength(e){throw new ReadOnlyError(`Setting length to ${e} on a read-only array`)}})){constructor(e){super(),Object.defineProperties(this,{[native$2]:{value:e},[prototypeForwarding]:{value:e}})}push(...e){throw new ReadOnlyError("Pushing items to a read-only array")}pop(){throw new ReadOnlyError("Popping from a read-only array")}shift(){throw new ReadOnlyError("Shifting from a read-only array")}unshift(...e){throw new ReadOnlyError("Unshifting items to a read-only array")}splice(e,t,...r){throw new ReadOnlyError("Splice from a read-only array")}reverse(){throw new ReadOnlyError("Reversing a read-only array")}sort(e){throw new ReadOnlyError("Sorting a read-only array")}fill(e,t,r){throw new ReadOnlyError("Filling a read-only array")}copyWithin(e,t,r){throw new ReadOnlyError("Copying within a read-only array")}}const ReactiveReadOnlyArray=reactive(ReactiveReadOnlyArrayClass);function mapped(e,t,r){const n=[],o=new ReactiveReadOnlyArray(n),i=[];function s(r){return effect(function(){n[r]=t(e[r],r,o),touched1(o,{type:"set",prop:r},r)})}const a=effect(function({ascend:t}){const a=e.length,c=untracked(()=>n.length);if(r?.(a,c),touched1(o,{type:"set",prop:"length"},"length"),a<c){const e=i.splice(a);for(const t of e)t();n.length=a}else a>c&&t(function(){for(let e=c;e<a;e++)i.push(s(e))})});return cleanedBy(o,()=>{for(const e of i)e();i.length=0,a()})}function reduced(e,t){const r=[],n=new ReactiveReadOnlyArray(r),o=effect(function(){const o={};r.length=0;for(const n of e)r.push(...t(n,o));touched(n,{type:"invalidate",prop:"reduced"})});return cleanedBy(n,o)}const memoizedRegistry=new WeakMap,wrapperRegistry=new WeakMap;function getBranch(e,t){e.branches??(e.branches=new WeakMap);let r=e.branches.get(t);return r||(r={},e.branches.set(t,r)),r}function memoizeFunction(e){const t=getRoot(e),r=memoizedRegistry.get(t);if(r)return r;const n={},o=markWithRoot((...t)=>{const r=t;if(r.some(e=>!(e&&["object","symbol","function"].includes(typeof e))))throw new Error("memoize expects non-null object arguments");let o=n;for(const e of r)o=getBranch(o,e);if(dependant(o,"memoize"),"result"in o){if(options.onMemoizationDiscrepancy){const t=options.isVerificationRun;options.isVerificationRun=!0;try{const t=untracked(()=>e(...r));deepCompare(o.result,t)||options.onMemoizationDiscrepancy(o.result,t,e,r,"calculation")}finally{options.isVerificationRun=t}}return o.result}if(o.cleanup=root(()=>effect(()=>(o.result=e(...r),()=>{delete o.result,touched1(o,{type:"invalidate",prop:r},"memoize"),o.cleanup&&(o.cleanup(),o.cleanup=void 0)}),{opaque:!0})),options.onMemoizationDiscrepancy){const t=options.isVerificationRun;options.isVerificationRun=!0;try{const t=untracked(()=>e(...r));deepCompare(o.result,t)||options.onMemoizationDiscrepancy(o.result,t,e,r,"comparison")}finally{options.isVerificationRun=t}}return o.result},e);return memoizedRegistry.set(t,o),memoizedRegistry.set(o,o),o}const memoize=decorator({getter:(e,t,r)=>function(){let n=wrapperRegistry.get(e);n||(n=markWithRoot(renamed(t=>e.call(t),`${String(t?.constructor?.name??t?.name??"Object")}.${String(r)}`),{method:e,propertyKey:r,...e[rootFunction]?{[rootFunction]:e[rootFunction]}:{}}),wrapperRegistry.set(e,n));return memoizeFunction(n)(this)},method:(e,t,r)=>function(...n){let o=wrapperRegistry.get(e);o||(o=markWithRoot(renamed((t,...r)=>e.call(t,...r),`${String(t?.constructor?.name??t?.name??"Object")}.${String(r)}`),{method:e,propertyKey:r,...e[rootFunction]?{[rootFunction]:e[rootFunction]}:{}}),wrapperRegistry.set(e,o));return memoizeFunction(o)(this,...n)},default:memoizeFunction});function getRegisterBase(){class e extends(Indexable(ArrayReadForward,{get(e){return this[getAt](e)},set(e,t){this[setAt](e,t)},getLength(){return this.length},setLength(e){this.length=e}})){toArray(){return Array.from(this)}}return e}let RegisterClass=(()=>{var e,t,r,n,o,i,s,a,c;let l,f,u=[unreactive],d=[],h=getRegisterBase();return f=class extends h{get[(t=new WeakMap,r=new WeakMap,n=new WeakMap,o=new WeakMap,i=new WeakMap,s=new WeakMap,a=new WeakMap,e=new WeakSet,forwardArray)](){return this.toArray()}constructor(c,l){let f;if(super(),e.add(this),t.set(this,void 0),r.set(this,void 0),n.set(this,void 0),o.set(this,new Map),i.set(this,new Map),s.set(this,new Set),a.set(this,void 0),effect(({ascend:e})=>{f=e}),__classPrivateFieldSet(this,a,f,"f"),"function"!=typeof c)throw new Error("Register requires a key function");__classPrivateFieldSet(this,t,c,"f"),__classPrivateFieldSet(this,r,reactive([]),"f"),__classPrivateFieldSet(this,n,reactive(new Map),"f"),Object.defineProperties(this,{[prototypeForwarding]:{value:__classPrivateFieldGet(this,r,"f")}}),l&&this.push(...l)}ensureKey(r){let n=__classPrivateFieldGet(this,i,"f").get(r);if(n)return n.key;if(n={key:void 0},__classPrivateFieldGet(this,i,"f").set(r,n),__classPrivateFieldGet(this,a,"f").call(this,()=>{const o=effect(({reaction:o})=>{const i=__classPrivateFieldGet(this,t,"f").call(this,r);this.assertValidKey(i);const s=n.key;o&&void 0!==s&&!Object.is(i,s)&&__classPrivateFieldGet(this,e,"m",c).call(this,r,s,i),n.key=i});n.stop=o,__classPrivateFieldGet(this,s,"f").add(o)}),void 0===n.key)throw new Error("Register key function must return a property key");return n.key}assertValidKey(e){const t=typeof e;if("string"!==t&&"number"!==t&&"symbol"!==t)throw new Error("Register key function must return a property key")}setKeyValue(e,t){const r=__classPrivateFieldGet(this,n,"f").get(e);void 0!==r&&r!==t&&this.cleanupValue(r),__classPrivateFieldGet(this,n,"f").set(e,t)}cleanupValue(e){const t=__classPrivateFieldGet(this,i,"f").get(e);if(!t)return;const r=t.stop;r&&(t.stop=void 0,__classPrivateFieldGet(this,s,"f").delete(r),r()),__classPrivateFieldGet(this,i,"f").delete(e)}disposeKeyEffects(){for(const e of Array.from(__classPrivateFieldGet(this,i,"f").keys()))this.cleanupValue(e);__classPrivateFieldGet(this,s,"f").clear()}incrementUsage(e){const t=__classPrivateFieldGet(this,o,"f").get(e)??0;__classPrivateFieldGet(this,o,"f").set(e,t+1)}decrementUsage(e){const t=__classPrivateFieldGet(this,o,"f").get(e);if(t)if(t<=1){const t=__classPrivateFieldGet(this,n,"f").get(e);__classPrivateFieldGet(this,o,"f").delete(e),__classPrivateFieldGet(this,n,"f").delete(e),void 0!==t&&this.cleanupValue(t)}else __classPrivateFieldGet(this,o,"f").set(e,t-1)}normalizeIndex(e,t=!1){const r=this.length;let n=e;if(n<0&&(n=Math.max(r+n,0)),n>r){if(!t)throw new RangeError("Index out of bounds");n=r}if(!t&&n===r)throw new RangeError("Index out of bounds");return n}assignAt(e,t,n){const o=__classPrivateFieldGet(this,r,"f")[e];void 0!==o&&Object.is(o,t)||(void 0!==o&&this.decrementUsage(o),__classPrivateFieldGet(this,r,"f")[e]=t,this.incrementUsage(t)),this.setKeyValue(t,n)}insertKeyValue(e,t,n){__classPrivateFieldGet(this,r,"f").splice(e,0,t),this.incrementUsage(t),this.setKeyValue(t,n)}rebuildFrom(e){this.disposeKeyEffects(),__classPrivateFieldGet(this,r,"f").splice(0,__classPrivateFieldGet(this,r,"f").length),__classPrivateFieldGet(this,o,"f").clear(),__classPrivateFieldGet(this,n,"f").clear();for(const t of e){const e=this.ensureKey(t);__classPrivateFieldGet(this,r,"f").push(e),this.incrementUsage(e),__classPrivateFieldGet(this,n,"f").set(e,t)}}get length(){return __classPrivateFieldGet(this,r,"f").length}[(c=function(e,t,s){if(Object.is(t,s))return;const a=__classPrivateFieldGet(this,n,"f").get(s);if(void 0!==a&&a!==e)throw new Error(`Register key collision for key ${String(s)}`);const c=__classPrivateFieldGet(this,o,"f").get(t);if(!c)return;const l=__classPrivateFieldGet(this,o,"f").get(s)??0;this.setKeyValue(s,e);for(let e=0;e<__classPrivateFieldGet(this,r,"f").length;e++)Object.is(__classPrivateFieldGet(this,r,"f")[e],t)&&(__classPrivateFieldGet(this,r,"f")[e]=s);__classPrivateFieldGet(this,o,"f").set(s,l+c),__classPrivateFieldGet(this,o,"f").delete(t),__classPrivateFieldGet(this,n,"f").delete(t);const f=__classPrivateFieldGet(this,i,"f").get(e);f&&(f.key=s)},getAt)](e){const t=__classPrivateFieldGet(this,r,"f")[e];return void 0===t?void 0:__classPrivateFieldGet(this,n,"f").get(t)}[setAt](e,t){const r=this.ensureKey(t);if(e===this.length)return void this.insertKeyValue(e,r,t);const n=this.normalizeIndex(e);this.assignAt(n,r,t)}push(...e){for(const t of e){const e=this.ensureKey(t);this.insertKeyValue(this.length,e,t)}return this.length}pop(){if(this.length)return this.removeAt(this.length-1)}shift(){if(this.length)return this.removeAt(0)}unshift(...e){let t=0;for(const r of e){const e=this.ensureKey(r);this.insertKeyValue(t++,e,r)}return this.length}splice(e,t,...o){const i=this.normalizeIndex(e,!0),s=this.length-i,a=Math.min(void 0===t?s:Math.max(t,0),s),c=[];for(const e of o)c.push(this.ensureKey(e));const l=__classPrivateFieldGet(this,r,"f").splice(i,a,...c),f=[];for(const e of l){if(void 0===e)continue;const t=__classPrivateFieldGet(this,n,"f").get(e);this.decrementUsage(e),f.push(t)}for(let e=0;e<c.length;e++){const t=c[e],r=o[e];this.incrementUsage(t),this.setKeyValue(t,r)}return f}clear(){__classPrivateFieldGet(this,r,"f").length=0,__classPrivateFieldGet(this,o,"f").clear(),__classPrivateFieldGet(this,n,"f").clear(),this.disposeKeyEffects()}get(e){return __classPrivateFieldGet(this,n,"f").get(e)}set(e,t){__classPrivateFieldGet(this,n,"f").has(e)&&this.setKeyValue(e,t)}remove(e){let t=this.indexOfKey(e);for(;-1!==t;)this.removeAt(t),t=this.indexOfKey(e)}removeAt(e){const[t]=__classPrivateFieldGet(this,r,"f").splice(e,1);if(void 0===t)return;const o=__classPrivateFieldGet(this,n,"f").get(t);return this.decrementUsage(t),o}keep(e){const t=new Map;for(const[o,i]of __classPrivateFieldGet(this,r,"f").entries()){if(t.has(i)){t.get(i)||this.removeAt(o);continue}const r=e(__classPrivateFieldGet(this,n,"f").get(i));t.set(i,r),r||this.removeAt(o)}}hasKey(e){return __classPrivateFieldGet(this,o,"f").has(e)}indexOfKey(e){return __classPrivateFieldGet(this,r,"f").indexOf(e)}mapKeys(){return __classPrivateFieldGet(this,n,"f").keys()}update(...e){for(const t of e){const e=this.ensureKey(t);__classPrivateFieldGet(this,n,"f").has(e)&&this.setKeyValue(e,t)}}upsert(e,...t){for(const r of t){const t=this.ensureKey(r);__classPrivateFieldGet(this,n,"f").has(t)?this.setKeyValue(t,r):e(r)}}entries(){const e=this;return function*(){for(let t=0;t<__classPrivateFieldGet(e,r,"f").length;t++){const o=__classPrivateFieldGet(e,n,"f").get(__classPrivateFieldGet(e,r,"f")[t]);void 0!==o&&(yield[t,o])}}()}[Symbol.iterator](){const e=this;return function*(){for(const t of __classPrivateFieldGet(e,r,"f")){const r=__classPrivateFieldGet(e,n,"f").get(t);void 0!==r&&(yield r)}}()}toString(){return`[Register length=${this.length}]`}at(e){const t=e<0?this.length+e:e;if(!(t<0||t>=this.length))return this[getAt](t)}reverse(){return __classPrivateFieldGet(this,r,"f").reverse(),this}sort(e){const t=e?(t,r)=>e(__classPrivateFieldGet(this,n,"f").get(t),__classPrivateFieldGet(this,n,"f").get(r)):void 0;return __classPrivateFieldGet(this,r,"f").sort(t),this}fill(e,t=0,r=this.length){const n=this.toArray();return n.fill(e,t,r),this.rebuildFrom(n),this}copyWithin(e,t,r){const n=this.toArray();return n.copyWithin(e,t,r),this.rebuildFrom(n),this}},__setFunctionName(f,"RegisterClass"),(()=>{const e="function"==typeof Symbol&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;__esDecorate(null,l={value:f},u,{kind:"class",name:f.name,metadata:e},null,d),f=l.value,e&&Object.defineProperty(f,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e}),__runInitializers(f,d)})(),f})();const Register=RegisterClass;function register(e,t){return new RegisterClass(e,t)}const effectProjectionMetadata=new WeakMap;function getActiveProjection(){const e=getActiveEffect();return e?effectProjectionMetadata.get(e):void 0}function defineAccessValue(e){Object.defineProperty(e,"value",{get:e.get,set:e.set,configurable:!0,enumerable:!0})}function makeCleanup(e,t,r,n){return n&&Object.defineProperty(e,projectionInfo,{value:n,writable:!1,enumerable:!1,configurable:!0}),cleanedBy(e,()=>{r();for(const e of t.values())e?.();t.clear()})}function projectArray(e,t){const r=reactive(e),n=reactive([]),o=new Map;function i(e){const t=o.get(e);t&&(o.delete(e),t(),Reflect.deleteProperty(n,e))}const s=getActiveProjection(),a=s?s.depth+1:0,c=effect(function({ascend:e}){const c=r.length;!function(e){ReflectSet(n,"length",e,n)}(c);const l=Array.from(o.keys());for(let i=0;i<c;i++)o.has(i)||e(()=>{const e=i,c=effect(function(){const o=untracked(()=>n[e]),i={key:e,source:r,get:()=>ReflectGet(r,e,r),set:t=>ReflectSet(r,e,t,r),old:o};defineAccessValue(i);const s=t(i,n);n[e]=s});setEffectName(c,`project[${a}]:${e}`),effectProjectionMetadata.set(c,{source:r,key:e,target:n,depth:a,parent:s}),o.set(i,c)});for(const e of l)e>=c&&i(e)});return makeCleanup(n,o,()=>c(),{source:r,target:n,apply:t,depth:a,parent:s})}function projectRegister(e,t){const r=reactive(e),n=new Map,o=reactive(n),i=new Map;function s(e){const t=i.get(e);t&&(t(),i.delete(e),o.delete(e))}const a=getActiveProjection(),c=a?a.depth+1:0,l=effect(function({ascend:e}){const n=new Set;for(const e of r.mapKeys())n.add(e);for(const s of n)i.has(s)||e(()=>{const e=effect(function(){const e=untracked(()=>o.get(s)),n={key:s,source:r,get:()=>r.get(s),set:e=>(r.set(s,e),!0),old:e};defineAccessValue(n);const i=t(n,o);o.set(s,i)});setEffectName(e,`project[${c}]:${String(s)}`),effectProjectionMetadata.set(e,{source:r,key:s,target:o,depth:c,parent:a}),i.set(s,e)});for(const e of Array.from(i.keys()))n.has(e)||s(e)});return makeCleanup(o,i,()=>l(),{source:r,target:o,apply:t,depth:c,parent:a})}function projectRecord(e,t){const r=reactive(e),n=reactive({}),o=new Map;function i(e){const t=o.get(e);t&&(t(),o.delete(e),Reflect.deleteProperty(n,e))}const s=getActiveProjection(),a=s?s.depth+1:0,c=effect(function({ascend:e}){const c=new Set;for(const e in r)c.add(e);const l=Reflect.ownKeys(r);for(const e of l)c.add(e);for(const i of c)o.has(i)||e(()=>{const e=effect(function(){const e=i,o=untracked(()=>n[i]),s={key:e,source:r,get:()=>ReflectGet(r,e,r),set:t=>ReflectSet(r,e,t,r),old:o};defineAccessValue(s);const a=t(s,n);n[e]=a});setEffectName(e,`project[${a}]:${String(i)}`),effectProjectionMetadata.set(e,{source:r,key:i,target:n,depth:a,parent:s}),o.set(i,e)});for(const e of Array.from(o.keys()))c.has(e)||i(e)});return makeCleanup(n,o,()=>c(),{source:r,target:n,apply:t,depth:a,parent:s})}function projectMap(e,t){const r=reactive(e),n=new Map,o=reactive(n),i=new Map;function s(e){const t=i.get(e);t&&(t(),i.delete(e),o.delete(e))}const a=getActiveProjection(),c=a?a.depth+1:0,l=effect(function({ascend:e}){const n=new Set;for(const e of r.keys())n.add(e);for(const s of n)i.has(s)||e(()=>{const e=effect(function(){const e=untracked(()=>o.get(s)),n={key:s,source:r,get:()=>r.get(s),set:e=>(r.set(s,e),!0),old:e};defineAccessValue(n);const i=t(n,o);o.set(s,i)});setEffectName(e,`project[${c}]:${String(s)}`),effectProjectionMetadata.set(e,{source:r,key:s,target:o,depth:c,parent:a}),i.set(s,e)});for(const e of Array.from(i.keys()))n.has(e)||s(e)});return makeCleanup(o,i,()=>l(),{source:r,target:o,apply:t,depth:c,parent:a})}function projectCore(e,t){if(Array.isArray(e))return projectArray(e,t);if(e instanceof Map)return projectMap(e,t);if(e instanceof Register)return projectRegister(e,t);if(e&&(e.constructor===Object||void 0===e.constructor))return projectRecord(e,t);throw new Error("Unsupported source type")}const project=Object.assign(projectCore,{array:projectArray,register:projectRegister,record:projectRecord,map:projectMap});function organized(e,t,r={}){const n=reactive(e),o=reactive(r),i=new Map;function s(e){const t=i.get(e);t&&(i.delete(e),t())}const a=effect(function({ascend:e}){const r=new Set;for(const e in n)r.add(e);for(const s of r)i.has(s)||e(()=>{const e=effect(function(){const e=s,r={key:e,get:()=>ReflectGet(n,e,n),set:t=>ReflectSet(n,e,t,n)};return Object.defineProperty(r,"value",{get:r.get,set:r.set,configurable:!0,enumerable:!0}),t(r,o)});i.set(s,e)});for(const e of Array.from(i.keys()))r.has(e)||s(e)});return cleanedBy(o,()=>{a();for(const e of Array.from(i.keys()))s(e)})}function organize(e,t,r){return Object.defineProperty(e,t,{get:r.get,set:r.set,configurable:!0,enumerable:!0}),touched1(e,{type:"set",prop:t},t),()=>delete e[t]}const native$1=Symbol("native");class ReactiveWeakMap{constructor(e){Object.defineProperties(this,{[native$1]:{value:e},[prototypeForwarding]:{value:e},content:{value:Symbol("WeakMapContent")},[Symbol.toStringTag]:{value:"ReactiveWeakMap"}})}delete(e){const t=this[native$1].has(e),r=this[native$1].delete(e);return t&&touched1(this.content,{type:"del",prop:e},e),r}get(e){return dependant(this.content,e),reactive(this[native$1].get(e))}has(e){return dependant(this.content,e),this[native$1].has(e)}set(e,t){const r=this[native$1].has(e),n=this[native$1].get(e),o=reactive(t);return this[native$1].set(e,o),r&&n===o||notifyPropertyChange(this.content,e,n,o,r),this}}class ReactiveMap{constructor(e){Object.defineProperties(this,{[native$1]:{value:e},[prototypeForwarding]:{value:e},content:{value:Symbol("MapContent")},[Symbol.toStringTag]:{value:"ReactiveMap"}})}get size(){return dependant(this,"size"),this[native$1].size}clear(){const e=this[native$1].size>0;if(this[native$1].clear(),e){const e={type:"bunch",method:"clear"};touched1(this,e,"size"),touched(this.content,e)}}entries(){return dependant(this.content),makeReactiveEntriesIterator(this[native$1].entries())}forEach(e,t){dependant(this.content),this[native$1].forEach(e,t)}keys(){return dependant(this.content),this[native$1].keys()}values(){return dependant(this.content),makeReactiveIterator(this[native$1].values())}[Symbol.iterator](){dependant(this.content);const e=this[native$1][Symbol.iterator]();return{next(){const t=e.next();return t.done?t:{value:[t.value[0],reactive(t.value[1])],done:!1}}}}delete(e){const t=this[native$1].has(e),r=this[native$1].delete(e);if(t){const t={type:"del",prop:e};touched1(this.content,t,e),touched1(this,t,"size")}return r}get(e){return dependant(this.content,e),reactive(this[native$1].get(e))}has(e){return dependant(this.content,e),this[native$1].has(e)}set(e,t){const r=this[native$1].has(e),n=this[native$1].get(e),o=reactive(t);if(this[native$1].set(e,o),!r||n!==o){notifyPropertyChange(this.content,e,n,o,r);touched1(this,{type:r?"set":"add",prop:e},"size")}return this}}const native=Symbol("native");class ReactiveWeakSet{constructor(e){Object.defineProperties(this,{[native]:{value:e},[prototypeForwarding]:{value:e},content:{value:Symbol("WeakSetContent")},[Symbol.toStringTag]:{value:"ReactiveWeakSet"}})}add(e){const t=this[native].has(e);return this[native].add(e),t||touched1(this.content,{type:"add",prop:e},e),this}delete(e){const t=this[native].has(e),r=this[native].delete(e);return t&&touched1(this.content,{type:"del",prop:e},e),r}has(e){return dependant(this.content,e),this[native].has(e)}}class ReactiveSet{constructor(e){Object.defineProperties(this,{[native]:{value:e},[prototypeForwarding]:{value:e},content:{value:Symbol("SetContent")},[Symbol.toStringTag]:{value:"ReactiveSet"}})}get size(){return dependant(this,"size"),this[native].size}add(e){const t=this[native].has(e),r=reactive(e);if(this[native].add(r),!t){const e={type:"add",prop:r};touched1(this.content,e,r),touched1(this,e,"size")}return this}clear(){const e=this[native].size>0;if(this[native].clear(),e){const e={type:"bunch",method:"clear"};touched1(this,e,"size"),touched(this.content,e)}}delete(e){const t=this[native].has(e),r=this[native].delete(e);if(t){const t={type:"del",prop:e};touched1(this.content,t,e),touched1(this,t,"size")}return r}has(e){return dependant(this.content,e),this[native].has(e)}entries(){return dependant(this.content),makeReactiveEntriesIterator(this[native].entries())}forEach(e,t){dependant(this.content),this[native].forEach(e,t)}keys(){return dependant(this.content),makeReactiveIterator(this[native].keys())}values(){return dependant(this.content),makeReactiveIterator(this[native].values())}[Symbol.iterator](){dependant(this.content);const e=this[native][Symbol.iterator]();return{next(){const t=e.next();return t.done?t:{value:reactive(t.value),done:!1}}}}}registerNativeReactivity(WeakMap,ReactiveWeakMap),registerNativeReactivity(Map,ReactiveMap),registerNativeReactivity(WeakSet,ReactiveWeakSet),registerNativeReactivity(Set,ReactiveSet),registerNativeReactivity(Array,ReactiveArray);const profileInfo={objectToProxy:objectToProxy,proxyToObject:proxyToObject,effectToReactiveObjects:effectToReactiveObjects,watchers:watchers,objectParents:objectParents,objectsWithDeepWatchers:objectsWithDeepWatchers,deepWatchers:deepWatchers,effectToDeepWatchedObjects:effectToDeepWatchedObjects,nonReactiveObjects:nonReactiveObjects},syncCalculating=[],cached=decorator({getter:(e,t,r)=>function(){const t=syncCalculating.findIndex(e=>e.object===this&&e.prop===r);if(t>-1)throw new Error(`Circular dependency detected: ${syncCalculating.slice(t).map(e=>`${e.object.constructor.name}.${String(e.prop)}`).join(" -> ")} -> again`);syncCalculating.push({object:this,prop:r});try{const t=e.call(this);return cache(this,r,t),t}finally{syncCalculating.pop()}}});function isCached(e,t){return!!Object.getOwnPropertyDescriptor(e,t)}function cache(e,t,r){Object.defineProperty(e,t,{value:r})}function describe(e){return(...t)=>r=>class extends r{constructor(...r){super(...r);for(const r of t)Object.defineProperty(this,r,{...Object.getOwnPropertyDescriptor(this,r),...e})}}}const deprecated=Object.assign(decorator({method:(e,t,r)=>function(...t){return deprecated.warn(this,r),e.apply(this,t)},getter:(e,t,r)=>function(){return deprecated.warn(this,r),e.call(this)},setter:(e,t,r)=>function(t){return deprecated.warn(this,r),e.call(this,t)},class:e=>class extends e{constructor(...e){super(...e),deprecated.warn(this,"constructor")}},default:e=>decorator({method:(t,r,n)=>function(...r){return deprecated.warn(this,n,e),t.apply(this,r)},getter:(t,r,n)=>function(){return deprecated.warn(this,n,e),t.call(this)},setter:(t,r,n)=>function(r){return deprecated.warn(this,n,e),t.call(this,r)},class:t=>class extends t{constructor(...t){super(...t),deprecated.warn(this,"constructor",e)}}})}),{warn:(e,t,r)=>{}});function debounce(e){return decorator({method(t,r,n){let o=null;return function(...r){o&&clearTimeout(o),o=setTimeout(()=>{t.apply(this,r),o=null},e)}}})}function throttle(e){return decorator({method(t,r,n){let o=0,i=null;return function(...r){const n=Date.now();if(n-o>=e)return i&&(clearTimeout(i),i=null),o=n,t.apply(this,r);if(!i){const s=e-(n-o),a=[...r];i=setTimeout(()=>{o=Date.now(),t.apply(this,a),i=null},s)}}}})}var version$1="1.0.6",pkg={version:version$1};const{version:version}=pkg,GLOBAL_MUTTS_KEY="__MUTTS_INSTANCE__",globalScope="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global&&global;if(globalScope){let source="mutts/index";try{if("undefined"!=typeof __filename)source=__filename;else{const meta=eval("import.meta");meta&&meta.url&&(source=meta.url)}}catch(e){}const currentSourceInfo={version:version,source:source,timestamp:Date.now()};if(globalScope[GLOBAL_MUTTS_KEY]){const e=globalScope[GLOBAL_MUTTS_KEY];throw new Error(`[Mutts] Multiple instances detected!\nExisting instance: ${JSON.stringify(e,null,2)}\nNew instance: ${JSON.stringify(currentSourceInfo,null,2)}\nThis usually happens when 'mutts' is both installed as a dependency and bundled, or when different versions are loaded. Please check your build configuration (aliases, externals) to ensure a single source of truth.`)}globalScope[GLOBAL_MUTTS_KEY]=currentSourceInfo}exports.ArrayReadForward=ArrayReadForward,exports.DecoratorError=DecoratorError,exports.Destroyable=Destroyable,exports.DestructionError=DestructionError,exports.Eventful=Eventful,exports.Indexable=Indexable,exports.IterableWeakMap=IterableWeakMap,exports.IterableWeakSet=IterableWeakSet,exports.ReactiveBase=ReactiveBase,exports.ReactiveError=ReactiveError,exports.ReadOnlyError=ReadOnlyError,exports.ReflectGet=ReflectGet,exports.ReflectSet=ReflectSet,exports.Register=Register,exports.addBatchCleanup=addBatchCleanup,exports.allocated=allocated,exports.allocatedValues=allocatedValues,exports.arrayEquals=arrayEquals,exports.atomic=atomic,exports.batch=batch,exports.biDi=biDi,exports.buildReactivityGraph=buildReactivityGraph,exports.cache=cache,exports.cached=cached,exports.callOnGC=callOnGC,exports.cleanedBy=cleanedBy,exports.cleanup=cleanup,exports.debounce=debounce,exports.decorator=decorator,exports.deepCompare=deepCompare,exports.deepWatch=deepWatch,exports.defer=defer,exports.deprecated=deprecated,exports.derived=derived,exports.describe=describe,exports.destructor=destructor,exports.effect=effect,exports.enableDevTools=enableDevTools,exports.forwardArray=forwardArray,exports.getActivationLog=getActivationLog,exports.getActiveEffect=getActiveEffect,exports.getActiveProjection=getActiveProjection,exports.getAt=getAt,exports.getState=getState,exports.immutables=immutables,exports.isCached=isCached,exports.isConstructor=isConstructor,exports.isDevtoolsEnabled=isDevtoolsEnabled,exports.isNonReactive=isNonReactive,exports.isOwnAccessor=isOwnAccessor,exports.isReactive=isReactive,exports.isZoneEnabled=isZoneEnabled,exports.legacyDecorator=legacyDecorator,exports.mapped=mapped,exports.memoize=memoize,exports.mixin=mixin,exports.modernDecorator=modernDecorator,exports.organize=organize,exports.organized=organized,exports.profileInfo=profileInfo,exports.project=project,exports.reactive=reactive,exports.reactiveOptions=options,exports.reduced=reduced,exports.register=register,exports.registerEffectForDebug=registerEffectForDebug,exports.registerNativeReactivity=registerNativeReactivity,exports.registerObjectForDebug=registerObjectForDebug,exports.renamed=renamed,exports.root=root,exports.setAt=setAt,exports.setEffectName=setEffectName,exports.setObjectName=setObjectName,exports.setZoneEnabled=setZoneEnabled,exports.throttle=throttle,exports.touched=touched,exports.touched1=touched1,exports.trackEffect=trackEffect,exports.unreactive=unreactive,exports.untracked=untracked,exports.unwrap=unwrap,exports.watch=watch,exports.zip=zip});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Mutts={})}(this,function(e){"use strict";const t={addHook(e){throw"One must import the library from the server or the client side"}};const n=new Set([Object,Array,Date,Function,Set,Map,WeakMap,WeakSet,Promise,Error,TypeError,ReferenceError,SyntaxError,RangeError,URIError,EvalError,Reflect,Proxy,RegExp,String,Number,Boolean]);function r(e){return e&&"function"==typeof e&&(n.has(e)||e.toString?.().startsWith("class "))}function o(e,t){return Object.defineProperties(e,{name:{value:t}})}const s={get:(e,t,n)=>"undefined"!=typeof Node&&e instanceof Node?e[t]:Reflect.get(e,t,n),set:(e,t,n,r)=>"undefined"!=typeof Node&&e instanceof Node?(e[t]=n,!0):e instanceof Object||Reflect.has(e,t)?Reflect.set(e,t,n,r):(Object.defineProperty(e,t,{value:n,configurable:!0,writable:!0,enumerable:!0}),!0)};function i(e,t){const n=Object.getOwnPropertyDescriptor(e,t);return!(!n?.get&&!n?.set)}function c(e,t,n=new Map){if(e===t)return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return e===t;if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;let r=n.get(e);if(r?.has(t))return!0;if(r||(r=new Set,n.set(e,r)),r.add(t),Array.isArray(e)){if(!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!c(e[r],t[r],n))return!1;return!0}if(e instanceof Date){const n=t instanceof Date&&e.getTime()===t.getTime();return n}if(e instanceof RegExp){const n=t instanceof RegExp&&e.toString()===t.toString();return n}if(e instanceof Set){if(!(t instanceof Set)||e.size!==t.size)return!1;for(const r of e){let e=!1;for(const o of t)if(c(r,o,n)){e=!0;break}if(!e)return!1}return!0}if(e instanceof Map){if(!(t instanceof Map)||e.size!==t.size)return!1;for(const[r,o]of e)if(t.has(r)){if(!c(o,t.get(r),n))return!1}else{let e=!1;for(const[s,i]of t)if(c(r,s,n)&&c(o,i,n)){e=!0;break}if(!e)return!1}return!0}const o=Object.keys(e),s=Object.keys(t);if(o.length!==s.length)return!1;for(const r of o){if(!Object.hasOwn(t,r))return!1;if(!c(e[r],t[r],n))return!1}return!0}const a=new WeakMap;function f(e){return a.has(e)||a.set(e,Object.seal(Object.create(null,{contentOf:{value:e,writable:!1,configurable:!1}}))),a.get(e)}function l(e,t){return Object.defineProperties(e,{[Symbol.toStringTag]:{value:t,writable:!1,configurable:!1},toString:{value:()=>t,writable:!1,configurable:!1}}),e}function u(e,t){return Object.defineProperty(t,"name",{value:t.name?`${t.name}::${e}`:e,writable:!1,configurable:!1}),t}class h extends Error{constructor(e){super(e),this.name="DecoratorException"}}function d(e){return function(t,n,o,...s){if(void 0===n){if(r(t)){if(!("class"in e))throw new Error("Decorator cannot be applied to a class");return e.class(t)}}else if("object"==typeof t&&["string","symbol"].includes(typeof n)){if(!o)throw new Error("Decorator cannot be applied to a field");if("object"==typeof o&&"configurable"in o){if("get"in o||"set"in o){if(!("getter"in e)&&!("setter"in e))throw new Error("Decorator cannot be applied to a getter or setter");if("getter"in e){const r=e.getter(o.get,t,n);r&&(o.get=r)}if("setter"in e){const r=e.setter(o.set,t,n);r&&(o.set=r)}return o}if("function"==typeof o.value){if(!("method"in e))throw new Error("Decorator cannot be applied to a method");const r=e.method(o.value,t,n);return r&&(o.value=r),o}}}if(!("default"in e))throw new Error("Decorator do not have a default implementation");return e.default.call(this,t,n,o,...s)}}function p(e){return function(t,n,...r){if(!n?.kind||"string"!=typeof n.kind){if(!("default"in e))throw new Error("Decorator do not have a default implementation");return e.default.call(this,t,n,...r)}switch(n.kind){case"class":if(!("class"in e))throw new Error("Decorator cannot be applied to a class");return e.class(t);case"field":throw new Error("Decorator cannot be applied to a field");case"getter":if(!("getter"in e))throw new Error("Decorator cannot be applied to a getter");return e.getter(t,t,n.name);case"setter":if(!("setter"in e))throw new Error("Decorator cannot be applied to a setter");return e.setter(t,t,n.name);case"method":if(!("method"in e))throw new Error("Decorator cannot be applied to a method");return e.method(t,t,n.name);case"accessor":{if(!("getter"in e)&&!("setter"in e))throw new Error("Decorator cannot be applied to a getter or setter");const r={};if("getter"in e){const o=e.getter(t.get,t,n.name);o&&(r.get=o)}if("setter"in e){const o=e.setter(t.set,t,n.name);o&&(r.set=o)}return r}}}}const g=e=>{const t=p(e),n=d(e);return(e,r,...o)=>{const s=function(e,t){return"object"==typeof t&&null!==t&&"string"==typeof t.kind?"modern":"legacy"}(0,r,o[0]);return"modern"===s?t(e,r,...o):n(e,r,...o)}},y=new FinalizationRegistry(e=>e()),m=Symbol("destructor"),b=Symbol("allocated");class w extends Error{static throw(e){return()=>{throw new w(e)}}constructor(e){super(`Object is destroyed. ${e}`),this.name="DestroyedAccessError"}}const v={[Symbol.toStringTag]:"MutTs Destroyable",get:w.throw("Cannot access destroyed object"),set:w.throw("Cannot access destroyed object")};const S=g({setter:(e,t,n)=>function(t){return this[b][n]=t,e.call(this,t)}});function k(e,t,n,r,o,s){function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var c,a=r.kind,f="getter"===a?"get":"setter"===a?"set":"value",l=!t&&e?r.static?e:e.prototype:null,u=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),h=!1,d=n.length-1;d>=0;d--){var p={};for(var g in r)p[g]="access"===g?{}:r[g];for(var g in r.access)p.access[g]=r.access[g];p.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(i(e||null))};var y=(0,n[d])("accessor"===a?{get:u.get,set:u.set}:u[f],p);if("accessor"===a){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(c=i(y.get))&&(u.get=c),(c=i(y.set))&&(u.set=c),(c=i(y.init))&&o.unshift(c)}else(c=i(y))&&("field"===a?o.unshift(c):u[f]=c)}l&&Object.defineProperty(l,r.name,u),h=!0}function j(e,t,n){for(var r=arguments.length>2,o=0;o<t.length;o++)n=r?t[o].call(e,n):t[o].call(e);return r?n:void 0}function O(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function E(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n}var M,x;"function"==typeof SuppressedError&&SuppressedError;M=new WeakMap,x=new WeakMap;const R=Symbol("getAt"),D=Symbol("setAt");function T(e,t){e&&"function"!=typeof e&&(t=e,e=void 0),e||(e=class{}),t||(t={get(e){if("function"!=typeof this[R])throw new Error("Indexable class must have an [getAt] method");return this[R](e)},set(e,t){if("function"!=typeof this[D])throw new Error("Indexable class has read-only numeric index access");this[D](e,t)}});class n extends e{}return Object.setPrototypeOf(n.prototype,new Proxy(e.prototype,{[Symbol.toStringTag]:"MutTs Indexable",get(e,n,r){if(n in e){const t=Object.getOwnPropertyDescriptor(e,n)?.get;return t?t.call(r):e[n]}if("string"==typeof n){if("length"===n&&t.getLength)return t.getLength.call(r);const e=Number(n);if(!Number.isNaN(e))return t.get.call(r,e)}},set(e,n,r,o){if(n in e){const t=Object.getOwnPropertyDescriptor(e,n)?.set;return t?t.call(o,r):e[n]=r,!0}if("string"==typeof n){if("length"===n&&t.setLength)return t.setLength.call(o,r),!0;const e=Number(n);if(!Number.isNaN(e)){if(!t.set)throw new Error("Indexable class has read-only numeric index access");return t.set.call(o,e,r),!0}}return Object.defineProperty(o,n,{value:r,writable:!0,enumerable:!0,configurable:!0}),!0},has(e,n){if(n in e)return!0;if("string"==typeof n){if("length"===n&&t.getLength)return!0;const e=Number(n);if(!Number.isNaN(e))return!0}return!1},ownKeys(e){const n=Reflect.ownKeys(e);if(t.getLength){n.push("length");const e=t.getLength.call(this);for(let t=0;t<e;t++)n.push(String(t))}return n},getOwnPropertyDescriptor(e,n){if(n in e)return Object.getOwnPropertyDescriptor(e,n);if("string"==typeof n){if("length"===n&&t.getLength)return{enumerable:!1,configurable:!0,get:()=>t.getLength.call(this)};const e=Number(n);if(!Number.isNaN(e))return{enumerable:!0,configurable:!0,get:()=>t.get.call(this,e),set:t.set?n=>t.set.call(this,e,n):void 0}}}})),n}const A=Symbol("forwardArray");class P{get[A](){throw new Error("ArrayReadForward is not implemented")}get length(){return this[A].length}[Symbol.iterator](){return this[A][Symbol.iterator]()}map(e,t){return this[A].map(e,t)}filter(e,t){return this[A].filter(e,t)}reduce(e,t){return void 0!==t?this[A].reduce(e,t):this[A].reduce(e)}reduceRight(e,t){return void 0!==t?this[A].reduceRight(e,t):this[A].reduceRight(e)}forEach(e,t){this[A].forEach(e,t)}find(e,t){return this[A].find(e,t)}findIndex(e,t){return this[A].findIndex(e,t)}findLast(e,t){return this[A].findLast(e,t)}findLastIndex(e,t){return this[A].findLastIndex(e,t)}includes(e,t){return this[A].includes(e,t)}indexOf(e,t){return this[A].indexOf(e,t)}lastIndexOf(e,t){return this[A].lastIndexOf(e,t)}slice(e,t){return this[A].slice(e,t)}concat(...e){return this[A].concat(...e)}every(e,t){return this[A].every(e,t)}some(e,t){return this[A].some(e,t)}join(e){return this[A].join(e)}keys(){return this[A].keys()}values(){return this[A].values()}entries(){return this[A].entries()}toString(){return this[A].toString()}toLocaleString(e,t){return this[A].toLocaleString(e,t)}at(e){return this[A].at(e)}flat(e){return this[A].flat(e)}flatMap(e,t){return this[A].flatMap(e,t)}toReversed(){return this[A].toReversed?.()??[...this[A]].reverse()}toSorted(e){return this[A].toSorted?.(e)??[...this[A]].sort(e)}toSpliced(e,t,...n){return void 0===t?this[A].toSpliced(e):this[A].toSpliced(e,t,...n)}with(e,t){return this[A].with(e,t)}get[Symbol.unscopables](){return this[A][Symbol.unscopables]}}var W,$;class I{constructor(e){if(this.uuids=new WeakMap,this.refs={},this[W]="IterableWeakMap",this.registry=new FinalizationRegistry(e=>{delete this.refs[e]}),e)for(const[t,n]of e)this.set(t,n)}createIterator(e){const{refs:t}=this;return function*(){for(const n of Object.keys(t)){const[r,o]=t[n],s=r.deref();s?yield e(s,o):delete t[n]}}()}clear(){for(const e of Object.keys(this.refs)){const t=this.refs[e][0].deref();t&&this.registry.unregister(t)}this.uuids=new WeakMap,this.refs={}}delete(e){const t=this.uuids.get(e);return!!t&&(delete this.refs[t],this.uuids.delete(e),this.registry.unregister(e),!0)}forEach(e,t){for(const[n,r]of this)e.call(t??this,r,n,t??this)}get(e){const t=this.uuids.get(e);if(t)return this.refs[t][1]}has(e){return this.uuids.has(e)}set(e,t){let n=this.uuids.get(e);return n?this.refs[n][1]=t:(n=crypto.randomUUID(),this.uuids.set(e,n),this.refs[n]=[new WeakRef(e),t],this.registry.register(e,n,e)),this}get size(){return[...this].length}entries(){return this.createIterator((e,t)=>[e,t])}keys(){return this.createIterator((e,t)=>e)}values(){return this.createIterator((e,t)=>t)}[Symbol.iterator](){return this.entries()}}W=Symbol.toStringTag;class z{constructor(e){if(this.uuids=new WeakMap,this.refs={},this[$]="IterableWeakSet",this.registry=new FinalizationRegistry(e=>{delete this.refs[e]}),e)for(const t of e)this.add(t)}createIterator(e){const{refs:t}=this;return function*(){for(const n of Object.keys(t)){const r=t[n].deref();r?yield e(r):delete t[n]}}()}clear(){for(const e of Object.keys(this.refs)){const t=this.refs[e].deref();t&&this.registry.unregister(t)}this.uuids=new WeakMap,this.refs={}}add(e){let t=this.uuids.get(e);return t||(t=crypto.randomUUID(),this.uuids.set(e,t),this.refs[t]=new WeakRef(e),this.registry.register(e,t,e)),this}delete(e){const t=this.uuids.get(e);return!!t&&(delete this.refs[t],this.uuids.delete(e),this.registry.unregister(e),!0)}forEach(e,t){for(const n of this)e.call(t??this,n,n,t??this)}has(e){return this.uuids.has(e)}get size(){return[...this].length}entries(){return this.createIterator(e=>[e,e])}keys(){return this.createIterator(e=>e)}values(){return this.createIterator(e=>e)}[Symbol.iterator](){return this.keys()}union(e){const t={[Symbol.iterator]:()=>e.keys()},n=this;return new Set(function*(){yield*n;for(const e of t)n.has(e)||(yield e)}())}intersection(e){const t=this;return new Set(function*(){for(const n of t)e.has(n)&&(yield n)}())}difference(e){const t=this;return new Set(function*(){for(const n of t)e.has(n)||(yield n)}())}symmetricDifference(e){const t={[Symbol.iterator]:()=>e.keys()},n=this;return new Set(function*(){for(const t of n)e.has(t)||(yield t);for(const e of t)n.has(e)||(yield e)}())}isSubsetOf(e){for(const t of this)if(!e.has(t))return!1;return!0}isSupersetOf(e){const t={[Symbol.iterator]:()=>e.keys()};for(const e of t)if(!this.has(e))return!1;return!0}isDisjointFrom(e){for(const t of this)if(e.has(t))return!1;return!0}}function C(e,t){const n=new WeakMap,o=e(Object);return n.set(Object,o),new Proxy(o,{apply(o,i,c){if(0===c.length)throw new Error("Mixin requires a base class");const a=c[0];if("function"!=typeof a)throw new Error("Mixin requires a constructor function");if(!(r(a)||a&&"function"==typeof a&&a.prototype))throw new Error("Mixin requires a valid constructor");const f=n.get(a);if(f)return f;let l=a;if(t){const e=class extends a{},n=a.prototype,r=new Proxy(n,{get(e,n,r){const o=s.get(e,n,r);return"function"!=typeof o||"string"!=typeof n||["constructor","toString","valueOf"].includes(n)?o:function(...e){const n=t(this);return o.apply(n,e)}}});Object.setPrototypeOf(e.prototype,r),l=e}const u=e(l);return n.set(a,u),u}})}$=Symbol.toStringTag;const N=(e,t)=>(...n)=>t[e](...n),K=new WeakMap,_=new WeakMap;function V(e,t){_.set(t,e),K.set(e,t)}const L={[Symbol.toStringTag]:"MutTs PromiseChain function",get:(e,t)=>t===Symbol.toStringTag?"PromiseProxy":"string"==typeof t&&["then","catch","finally"].includes(t)?e[t]:B(e.then(e=>e[t]))},F=e=>({then:N("then",e),catch:N("catch",e),finally:N("finally",e)}),q={[Symbol.toStringTag]:"MutTs PromiseChain object",get(e,t,n){const r=Object.getOwnPropertyDescriptor(e,t)?.get,o=r?r.call(n):e[t];return"function"==typeof e?o:B(o)},apply:(e,t,n)=>B(e.apply(t,n))};function H(e){const t=new Proxy(e,q);return V(e,t),t}function U(e){return e&&["function","object"].includes(typeof e)}function B(e){if(!U(e))return e;if(K.has(e))return K.get(e);if(!(e instanceof Promise))return H(e);e=e.then(e=>U(e)?H(e):e);const t=Object.assign(function(...t){return B(e.then(e=>this?.then?this.then(n=>e.apply(n,t)):e.apply(this,t)))},F(e)),n=new Proxy(t,L);return V(e,n),n}const Z=Symbol("native-reactive"),G=Symbol("non-reactive"),X=Symbol("unreactive-properties"),J=Symbol("all-props"),Y=Symbol("projection-info"),Q=Symbol("stopped"),ee=Symbol("cleanup"),te=Symbol("root-function");var ne;e.ReactiveErrorCode=void 0,(ne=e.ReactiveErrorCode||(e.ReactiveErrorCode={})).CycleDetected="CYCLE_DETECTED",ne.MaxDepthExceeded="MAX_DEPTH_EXCEEDED",ne.MaxReactionExceeded="MAX_REACTION_EXCEEDED",ne.WriteInComputed="WRITE_IN_COMPUTED",ne.TrackingError="TRACKING_ERROR",ne.BrokenEffects="BROKEN_EFFECTS";class re extends Error{constructor(e,t){super(e),this.debugInfo=t,this.name="ReactiveError"}get code(){return this.debugInfo?.code}get cause(){return this.debugInfo?.cause}}const oe={enter:e=>{},leave:e=>{},chain:(e,t)=>{},beginChain:e=>{},endChain:()=>{},garbageCollected:e=>{},touched:(e,t,n,r)=>{},skipRunningEffect:e=>{},maxEffectChain:100,maxTriggerPerBatch:10,maxEffectReaction:"throw",onMemoizationDiscrepancy:void 0,cycleHandling:"none",isVerificationRun:!1,maxDeepWatchDepth:100,instanceMembers:!0,ignoreAccessors:!0,recursiveTouching:!0,asyncMode:"cancel",warn:(...e)=>{},introspection:{enableHistory:!1,historySize:50},zones:{setTimeout:!0,setInterval:!0,requestAnimationFrame:!0,queueMicrotask:!0}},se=new WeakMap,ie=new WeakMap,ce=new WeakMap,ae=new WeakMap,fe=new WeakMap;function le(e,t){const n=fe.get(t),r=n?.deref();if(r&&r!==e){const n=t.name||"anonymous",o=r.name||"anonymous",s=e.name||"anonymous";throw new Error(`[reactive] Abusive Shared Root detected: Root '${n}' is already identifying function '${o}'. Cannot reuse it for '${s}'. Shared roots cause lost updates and broken identity logic.`)}return fe.set(t,new WeakRef(e)),Object.defineProperty(e,te,{value:ue(t),writable:!1})}function ue(e){for(;e&&te in e;)e=e[te];return e}const he=Symbol("external-source");let de=!1;const pe=new Set,ge=new Set,ye=new WeakMap,me=new WeakMap;let be=0,we=0;const ve=new Map;function Se(e){let t=ye.get(e);if(!t){const n=ue(e);t=n?.name?.trim()||"effect_"+ ++be,ye.set(e,t)}return t}function ke(e){let t=me.get(e);if(!t){const n=e?.constructor?.name;t=`${n&&"Object"!==n?n:"object"}_${++we}`,me.set(e,t)}return t}function je(e){if(!e||pe.has(e))return;pe.add(e);const t=se.get(e);if(t)for(const e of t)Oe(e)}function Oe(e){ge.has(e)||function(e){ge.add(e),ke(e)}(e)}function Ee(e,t,n,r,o,s){const i=function(e){let t=ve.get(e);return t||(t=new Map,ve.set(e,t)),t}(e);let c=i.get(t);c||(c=new Map,i.set(t,c));let a=c.get(n);return a||(a={label:n,object:r,prop:o,evolution:s,count:0,lastTriggered:Date.now()},c.set(n,a)),a}function Me(e,t){ye.set(e,t)}function xe(e,t){me.set(e,t),ge.add(e)}function Re(e){e&&de&&je(e)}function De(e){de&&Oe(e)}function Te(e,t,n,r,o){if(oe.introspection.enableHistory&&function(e,t,n,r,o){const s={id:++Ie,timestamp:Date.now(),source:e?Se(e):"External",target:Se(t),objectName:ke(n),prop:String(r),type:o.type};$e.push(s),$e.length>oe.introspection.historySize&&$e.shift()}(e,t,n,r,o),!de)return;je(t),e&&je(e);const s=function(e,t){const n=ke(e);return t===J?`${n}.*`:"symbol"==typeof t?`${n}.${t.description??t.toString()}`:`${n}.${String(t)}`}(n,r),i=Ee(e??he,t,s,n,r,o);i.count+=1,i.lastTriggered=Date.now(),Oe(n)}function Ae(e,t=5){const n=[];let r=e;for(let e=0;e<t;e++){let e,t="";e:for(const[n,o]of ve)for(const[s,i]of o)if(s===r){let r=0;for(const o of i.values())o.lastTriggered>r&&(r=o.lastTriggered,t=o.label,e=n===he?void 0:n);if(e||t)break e}if(!e){if(t){n.push(`External -> (${t}) -> ${Se(r)}`);break}break}n.push(`${Se(e)} -> (${t}) -> ${Se(r)}`),r=e}return n.reverse()}function Pe(){const e=[],t=[],n=new Map,r=new Set(pe);!function(e){const t=Array.from(e);for(let n=0;n<t.length;n++){const r=t[n],o=ae.get(r);o&&!e.has(o)&&(e.add(o),t.push(o))}}(r);const{nodes:o,nodeByEffect:s}=function(e){const t=[],n=new Map,r=Array.from(e);for(const e of r){const r=Se(e),o={id:`effect_${t.length}`,label:r,type:"effect",depth:0,debugName:r};t.push(o),n.set(e,o)}const o=new Map,s=e=>{if(!e)return 0;const t=o.get(e);if(void 0!==t)return t;const n=ae.get(e),r=s(n)+(n?1:0);return o.set(e,r),r};for(const[e,t]of n){t.depth=s(e);const r=ae.get(e);if(r){const e=n.get(r);e&&(t.parentId=e.id)}}return{nodes:t,nodeByEffect:n}}(r);for(const t of o)e.push(t);for(const[e,t]of s)n.set(e,t.id);for(const t of ge){const r=`object_${e.length}`;e.push({id:r,label:ke(t),type:"state",debugName:me.get(t)}),n.set(t,r)}if(ve.has(he)){const t="effect_external";e.push({id:t,label:"External",type:"external",depth:0}),n.set(he,t)}for(const e of r){const r=n.get(e);if(!r)continue;const o=se.get(e);if(o)for(const e of o){const o=n.get(e);o&&t.push({id:`${r}->${o}`,source:r,target:o,type:"dependency",label:"depends"})}}for(const[e,r]of ve)for(const[o,s]of r){const r=n.get(o);if(!r)continue;const i=n.get(e);if(i)for(const e of s.values())t.push({id:`${i}->${r}:${e.label}`,source:i,target:r,type:"cause",label:e.count>1?`${e.label} (${e.count})`:e.label,count:e.count})}return{nodes:e,edges:t,meta:{generatedAt:Date.now(),devtoolsEnabled:de}}}function We(){return de}const $e=[];let Ie=0;var ze;class Ce{enter(e){const t=this.active;return this.active=e,t}leave(e){this.active=e}with(e,t){const n=this.enter(e);try{return t()}finally{this.leave(n)}}root(e){let t=this.enter();try{return e()}finally{this.leave(t)}}get zoned(){const e=this.active;return u(`${this}@${e}`,t=>this.with(e,t))}}class Ne extends Ce{}class Ke extends Ce{has(e){return this.history.has(e)}some(e){for(const t of this.history)if(e(t))return!0;return!1}constructor(e=new Ne){super(),this.controlled=e,this.history=new Set;const t=this;this.present=Object.create(e,Object.getOwnPropertyDescriptors({get active(){return e.active},set active(t){e.active=t},enter(n){if(n&&t.history.has(n))throw new Error("ZoneHistory: re-entering historical zone");return void 0!==n&&t.history.add(n),{added:n,entered:e.enter(n)}},leave:n=>(void 0!==n.added&&t.history.delete(n.added),e.leave(n.entered))}))}get active(){return{present:this.controlled.active,history:new Set(this.history)}}set active(e){this.history=this.history&&new Set(this.history),this.controlled.active=e?.present}}class _e extends Ce{constructor(...e){super(),ze.set(this,new Set);for(const t of e)O(this,ze,"f").add(t)}get active(){const e=new Map;for(const t of O(this,ze,"f"))void 0!==t.active&&e.set(t,t.active);return e}set active(e){for(const t of O(this,ze,"f"))t.active=e?.get(t)}enter(e){const t=new Map;for(const n of O(this,ze,"f")){const r=e?.get(n);t.set(n,n.enter(r))}return t}leave(e){for(const t of O(this,ze,"f"))t.leave(e.get(t))}add(e){O(this,ze,"f").add(e)}delete(e){O(this,ze,"f").delete(e)}clear(){O(this,ze,"f").clear()}}ze=new WeakMap;const Ve=l(new _e,"async");t.addHook(()=>{const e=Ve.active;return()=>{const t=Ve.active;return Ve.active=e,()=>Ve.active=t}});const Le=l(new Ke,"effectHistory");l(Le.present,"effectHistory.present"),Ve.add(Le);const Fe=l(new _e(Le.present),"effectAggregator");function qe(e){const t=ue(e);return Le.some(e=>ue(e)===t)}function He(){return Le.present.active}const Ue=new WeakMap,Be=new WeakMap;function Ze(e){let t=e;for(;t&&"object"==typeof t&&null!==t&&Be.has(t);)t=Be.get(t);return t}function Ge(e){const t=new Map;for(let n=0;n<e.length;n++){const r=e[n];if(t.has(r))return e.slice(t.get(r));t.set(r,n)}return null}function Xe(e,t=20){const n=e.map(e=>e.name||"<anonymous>");if(n.length<=t)return n.join(" → ");const r=n.slice(0,5),o=n.slice(-10);return`${r.join(" → ")} ... (${n.length-15} more) ... ${o.join(" → ")}`}let Je;const Ye=new Array(100);function Qe(t,n,r,o){const s=ue(t);if(!Je)return;let i=Je.get(s);i||(i=new Map,Je.set(s,i));let c=i.get(n);c||(c=new Map,i.set(n,c));const a=(c.get(o)??0)+1;if(c.set(o,a),Ye.unshift({effect:t,obj:n,evolution:r,prop:o}),Ye.pop(),a>=oe.maxTriggerPerBatch){const t=s?.name||"anonymous",n=`Aggressive trigger detected: effect "${t}" triggered ${a} times in the batch by the same cause.`;if("throw"===oe.maxEffectReaction)throw new re(n,{code:e.ReactiveErrorCode.MaxReactionExceeded,count:a,effect:t});oe.warn(`[reactive] ${n}`)}}const et=new WeakMap,tt=new WeakSet,nt=new WeakMap,rt=new WeakMap,ot=new WeakMap,st=new WeakMap,it=new WeakMap;function ct(e,t){let n=e.get(t);return n||(n=new z,e.set(t,n)),n}function at(e,t,n){if(e===t)return!0;if(e===n)return!1;const r=new Set,o=[e];for(r.add(e),r.add(n);o.length>0;){const e=o.shift(),n=nt.get(e);if(n)for(const e of n){if(e===t)return!0;r.has(e)||(r.add(e),o.push(e))}}return!1}let ft;function lt(e){return ft?.all.has(ue(e))}const ut=new Set;function ht(e,t,n=new Set,r=[]){if(e===t)return[...r,t];if(n.has(e))return[];n.add(e);const o=[...r,e],s=nt.get(e);if(s)for(const e of s){const r=ht(e,t,n,o);if(r.length>0)return r}return[]}function dt(e,t){const n=ht(t,e);return n.length>0?[e,...n]:[]}function pt(t,n,r){if(t[ee]?.(),t[Q])return;if(!ft)return;const o=ue(t);if("none"===oe.cycleHandling&&ft.all.has(o)&&ft.all.delete(o),ft.all.set(o,t),n&&!r&&"none"!==oe.cycleHandling){const r=ue(n);if(function(e,t){if(e===t)return!1;const n=st.get(t);return!!n?.has(e)}(r,o)){const n=dt(r,o),s=n.length>0?`Cycle detected: ${n.map(e=>e.name||e.toString()).join(" → ")}`:`Cycle detected: ${r.name||r.toString()} → ${o.name||o.toString()} (and back)`,i=oe.cycleHandling;if("strict"===i){ft.all.delete(o);const r=Ae(t),i=it.get(o);throw new re(`[reactive] Strict Cycle Prevention: ${s}`,{code:e.ReactiveErrorCode.CycleDetected,cycle:n.map(e=>e.name||e.toString()),details:s,causalChain:r,creationStack:i})}switch(i){case"throw":{ft.all.delete(o);const r=Ae(t),i=it.get(o);throw new re(`[reactive] ${s}`,{code:e.ReactiveErrorCode.CycleDetected,cycle:n.map(e=>e.name||e.toString()),details:s,causalChain:r,creationStack:i})}case"warn":return oe.warn(`[reactive] ${s}`),void ft.all.delete(o);case"break":return void ft.all.delete(o)}}!function(e,t){if("none"===oe.cycleHandling)return;const n=nt.get(e);if(n?.has(t))return;if(n)n.add(t);else{const n=new z;n.add(t),nt.set(e,n)}let r=rt.get(t);if(r||(r=new z,rt.set(t,r)),r.add(e),e===t)return;const o=ct(st,e),s=ct(ot,t);o.add(t),s.add(e);const i=ot.get(e);if(i)for(const e of i)e!==t&&(ct(st,e).add(t),s.add(e));const c=st.get(t);if(c)for(const t of c)t!==e&&(ct(ot,t).add(e),o.add(t));if(i&&c)for(const e of i){const t=ct(st,e);for(const n of c)e!==n&&(t.add(n),ct(ot,n).add(e))}}(r,o)}}function gt(e){ft?ut.add(e):e()}const yt=gt;function mt(e,t,n,r,o){if(n.has(e)){const t=r.indexOf(e);return r.slice(t).concat([e])}if(t.has(e))return[];t.add(e),n.add(e),r.push(e);const s=nt.get(e);if(s)for(const e of s)if(o.all.has(e)){const s=mt(e,t,n,r,o);if(s.length>0)return s}return r.pop(),n.delete(e),[]}function bt(e){let t=null,n=null;if("none"===oe.cycleHandling){const e=ft.all.entries().next().value;e&&([n,t]=e)}else for(const[e,r]of ft.all){if(0===(ft.inDegrees.get(e)??0)){t=r,n=e;break}}if(!t){if(ft.all.size>0){let e=function(e){const t=new Set,n=new Set,r=[];for(const[o]of e.all){if(t.has(o))continue;const s=mt(o,t,n,r,e);if(s.length>0)return s}return[]}(ft);if(0===e.length)for(const[t]of ft.all){const n=st.get(t);if(n){for(const r of n)if(r!==t&&ft.all.has(r)){const n=st.get(r);if(n?.has(t)){e=[t,r,t];break}}if(e.length>0)break}}const t=e.length>0?`Cycle detected: ${e.map(e=>e.name||"<anonymous>").join(" → ")}`:"Cycle detected in effect batch - all effects have dependencies that prevent execution";switch(oe.cycleHandling){case"throw":throw new re(`[reactive] ${t}`);case"warn":{oe.warn(`[reactive] ${t}`);const e=ft.all.values().next().value;if(e){const t=ue(e);return ft.all.delete(t),ft.inDegrees.delete(t),e()}break}case"break":{const e=ft.all.values().next().value;if(e){const t=ue(e);return ft.all.delete(t),ft.inDegrees.delete(t),e()}break}}}return null}e.push(ue(t));const r=t();return ft.all.delete(n),ft.inDegrees.delete(n),function(e,t){const n=st.get(t);if(n)for(const t of n)if(e.all.has(t)){const n=e.inDegrees.get(t)??0;n>0&&e.inDegrees.set(t,n-1)}}(ft,n),r}function wt(t,n){Array.isArray(t)||(t=[t]);const r=t.map(ue);if(ft){oe?.chain(r,ue(He()));const e=He();for(let r=0;r<t.length;r++)pt(t[r],e,"immediate"===n);if(n){const e={};for(let n=0;n<t.length;n++)try{const r=t[n]();void 0===r||"value"in e||(e.value=r)}finally{const e=ue(t[n]);ft.all.delete(e)}return e.value}}else{if(Je)throw new Error("Batch already in progress");Je=new Map,oe.beginChain(r),ft={all:new Map,inDegrees:new Map};const o=He(),s=[],i={};try{if(n)for(let e=0;e<t.length;e++)try{const n=t[e]();void 0===n||"value"in i||(i.value=n)}finally{ft.all.delete(ue(t[e]))}else{for(let e=0;e<t.length;e++)pt(t[e],o,!1);!function(e){if("none"===oe.cycleHandling)return;const t=He(),n=t?ue(t):null;e.inDegrees.clear();for(const[t]of e.all){let r=0;const o=ot.get(t);if(o)for(const s of o)e.all.has(s)&&s!==n&&s!==t&&r++;e.inDegrees.set(t,r)}}(ft)}for(;ft.all.size>0||ut.size>0;)if(ft.all.size>0){if(s.length>oe.maxEffectChain){const t=Ge(s),n=Xe(s),r=t?`Max effect chain reached (cycle detected: ${Xe(t)})`:`Max effect chain reached (trace: ${n})`,o=(ft?Array.from(ft.all.keys()):[]).map(e=>e.name||"<anonymous>"),i={code:e.ReactiveErrorCode.MaxDepthExceeded,effectuatedRoots:s,cycle:t,trace:n,maxEffectChain:oe.maxEffectChain,queued:o.slice(0,50),queuedCount:o.length,causalChain:s.length>0?Ae(ft.all.get(s[s.length-1])):[]};switch(oe.maxEffectReaction){case"throw":case"debug":throw new re(`[reactive] ${r}`,i);case"warn":oe.warn(`[reactive] ${r} (queued: ${o.slice(0,10).join(", ")}${o.length>10?", …":""})`)}}const t=bt(s);void 0===t||"value"in i||(i.value=t)}else{const e=Array.from(ut);ut.clear();for(const t of e)t()}return i.value}catch(t){throw t instanceof re?t:new re("Effects are broken",{code:e.ReactiveErrorCode.BrokenEffects,cause:t})}finally{Je=void 0,ft=void 0,oe.endChain()}}}const vt=g({method:e=>function(...t){const n=()=>e.apply(this,t);return Object.defineProperty(n,"name",{value:`atomic(${e.name})`}),wt(n,"immediate")},default:e=>function(...t){const n=()=>e.apply(this,t);return Object.defineProperty(n,"name",{value:`atomic(${e.name})`}),wt(n,"immediate")}}),St=new FinalizationRegistry(e=>e());function kt(e,t){const n=t?.asyncMode??oe.asyncMode??"cancel";if(oe.introspection.enableHistory){const t=(new Error).stack;if(t){const n=t.split("\n").slice(2).join("\n");it.set(ue(e),n)}}let r=null;const o=Le.present.with(u,()=>Fe.zoned),s=Le.zoned;let i=Le.present.active,c=!1,a=!1,f=null,l=null;function u(){if(r){const e=r;r=null,jt(()=>e())}if(f)if("cancel"===n&&l)l(),l=null,f=null;else if("ignore"===n)return;if(c)return;let t,i;oe.enter(ue(e));try{if(i=o(()=>e({tracked:o,ascend:s,reaction:a})),i&&"function"!=typeof i&&("object"!=typeof i||!("then"in i)))throw new re(`[reactive] Effect returned a non-function value: ${i}`);if(i&&"object"==typeof i&&"function"==typeof i.then){const e=i;let t=null;const n=new Promise((e,n)=>{t=n}),r=new re("[reactive] Effect canceled due to dependency change");f=Promise.race([e,n]),l=()=>{t&&t(r)}}else t=i}finally{a=!0,oe.leave(e)}r=()=>{r=null,t?.();const e=se.get(u);if(e){for(const t of e){const e=ie.get(t);if(e){for(const[t,n]of e.entries())n.delete(u),0===n.size&&e.delete(t);0===e.size&&ie.delete(t)}}se.delete(u)}const n=ce.get(u);if(n){for(const e of n)e();ce.delete(u)}}}function h(e){return Object.defineProperties(e,{[Q]:{get:()=>c},[ee]:{value:()=>{if(r){const e=r;r=null,jt(()=>e())}}}})}le(u,e),h(u),t?.opaque&&tt.add(u),We()&&Re(u),wt(u,"immediate"),ae.set(u,i);const d=()=>{c||(c=!0,l&&(l(),l=null,f=null),r?.(),function(e){if("none"===oe.cycleHandling)return;const t=ue(e),n=ot.get(t),r=st.get(t),o=nt.get(t);if(o){for(const e of o){const n=rt.get(e);n?.delete(t)}nt.delete(t)}const s=rt.get(t);if(s){for(const e of s){const n=nt.get(e);n?.delete(t)}rt.delete(t)}if(n)for(const e of n){const n=st.get(e);if(n&&(n.delete(t),r))for(const o of r)at(e,o,t)||n.delete(o)}if(r)for(const e of r){const r=ot.get(e);if(r&&(r.delete(t),n))for(const o of n)at(o,e,t)||r.delete(o)}if(n&&r)for(const e of n){const n=st.get(e);if(n)for(const o of r)if(!at(e,o,t)){n.delete(o);const t=ot.get(o);t?.delete(e)}}ot.delete(t),st.delete(t)}(u),St.unregister(d))};if(!i){const t=h(()=>d());return St.register(t,()=>{d(),oe.garbageCollected(e)},d),t}let p=ce.get(i);p||(p=new Set,ce.set(i,p));const g=h(()=>{p.delete(g),0===p.size&&ce.delete(i),d()});return p.add(g),g}function jt(e){return Le.present.root(e)}function Ot(e){return Le.root(e)}const Et=new WeakMap,Mt=new WeakSet,xt=new WeakMap,Rt=new WeakMap;function Dt(e,t,n){let r=Et.get(e);r||(r=new Set,Et.set(e,r)),r.add({parent:t,prop:n})}function Tt(e,t,n){const r=Et.get(e);if(r){for(const e of r)if(e.parent===t&&e.prop===n){r.delete(e);break}0===r.size&&Et.delete(e)}}function At(e){return!!Mt.has(e)||Wt(e)}function Pt(e,t){const n=Et.get(e);if(n)for(const{parent:e}of n){const t=xt.get(e);if(t)for(const e of t)wt(e);Pt(e)}}function Wt(e){const t=Et.get(e);if(!t)return!1;for(const{parent:e}of t){if(Mt.has(e))return!0;if(Wt(e))return!0}return!1}const $t=new WeakMap;function It(e,t){const n={},r=zt(e=Ze(e));r&&Object.assign(r,{evolution:t,next:n}),$t.set(e,n)}function zt(e){e=Ze(e);let t=$t.get(e);return t||(t={},$t.set(e,t)),t}function Ct(e,t,n,r,...o){const s=He();for(const i of o)for(const o of i){const i=r.get(o);if(i)for(const r of i){if(qe(r)){oe.skipRunningEffect(r);continue}n.has(r)||(n.add(r),lt(r)||Qe(r,e,t,o));const i=et.get(r);if(Te(s,r,e,o,t),i){for(const n of i)n(e,t,o);i.delete(r)}}}}function Nt(e,t,n){Kt(e,t,[n])}function Kt(e,t,n){It(e=Ze(e),t);const r=ie.get(e);if(r){const o=new Set;n?Ct(e,t,o,r,[J],n):Ct(e,t,o,r,r.keys()),oe.touched(e,t,n,o),wt(Array.from(o))}Mt.has(e)&&Pt(e)}const _t=new WeakSet,Vt=new Set,Lt=Symbol("absent");function Ft(...e){for(const t of e)t&&(t.prototype[G]=!0);return e[0]}function qt(e){if(null===e||"object"!=typeof e)return!0;if(_t.has(e))return!0;if(e[G])return!0;for(const t of Vt)if(t(e))return!0;return!1}function Ht(e){return function(e){return"object"==typeof e&&null!==e}(e)}function Ut(e){if(Ht(e)){if(Array.isArray(e))return Array.prototype;try{return e.constructor}catch{return}}}function Bt(e,t){return e!==t&&(!(!Ht(e)||!Ht(t))&&(!qt(e)&&!qt(t)&&Ut(e)===Ut(t)))}function Zt(e,t,n,r,o){const s={type:o?"set":"add",prop:t};if(oe.recursiveTouching&&void 0!==n&&Bt(n,r)){const o={obj:Ze(e),prop:t};!function(e){if(!e.length)return;const t=new Set,n=e[0]?.origin;let r;if(n){r=new Set;const e=ie.get(n.obj);if(e){const t=new Set;Ct(n.obj,{type:"set",prop:n.prop},t,e,[J],[n.prop]);for(const e of t)r.add(e)}if(0===r.size)return}for(const{target:o,evolution:s,prop:i}of e){if(!Ht(o))continue;const e=Ze(o);It(e,s);const c=ie.get(e);let a;const f=[i];if(c){if(a=new Set,Ct(e,s,a,c,[J],f),n&&r){const e=new Set;for(const t of a)(r.has(t)||Jt(t,r))&&e.add(t);a=e}for(const e of a)t.add(e)}oe.touched(e,s,f,a),Mt.has(e)&&Pt(e)}t.size&&wt([...t])}(Xt(n,r,new WeakMap,[],o)),function(e,t,n){e=Ze(e);const r=ie.get(e);if(!r)return;const o=r.get(n);if(!o)return;const s=new Set,i=He();for(const r of o){if(!tt.has(r))continue;if(qe(r)){oe.skipRunningEffect(r);continue}s.add(r),Qe(r,e,t,n);const o=et.get(r);if(Te(i,r,e,n,t),o){for(const r of o)r(e,t,n);o.delete(r)}}s.size>0&&(oe.touched(e,t,[n],s),wt(Array.from(s)))}(e,s,t)}else Nt(e,s,t)}function Gt(e){const t=new Set(Reflect.ownKeys(e));let n=Object.getPrototypeOf(e);for(;n&&!Object.hasOwn(n,"constructor");){for(const e of Reflect.ownKeys(n))t.add(e);n=Object.getPrototypeOf(n)}return t}function Xt(e,t,n=new WeakMap,r=[],o){return Bt(e,t)&&Ht(e)&&Ht(t)?function(e,t,n){let r=e.get(t);return r||(r=new WeakSet,e.set(t,r)),!!r.has(n)||(r.add(n),!1)}(n,e,t)?r:Array.isArray(e)&&Array.isArray(t)?(function(e,t,n,r,o){const s=[],i=e.length,c=t.length,a=Math.max(i,c);for(let n=0;n<a;n++){const r=n<i,a=n<c;if(r&&!a){s.push({target:e,evolution:{type:"del",prop:n},prop:n,origin:o});continue}if(!r&&a){s.push({target:e,evolution:{type:"add",prop:n},prop:n,origin:o});continue}if(!r||!a)continue;const f=Ze(e[n]),l=Ze(t[n]);Object.is(f,l)||s.push({target:e,evolution:{type:"set",prop:n},prop:n,origin:o})}i!==c&&s.push({target:e,evolution:{type:"set",prop:"length"},prop:"length",origin:o});r.push(...s)}(e,t,0,r,o),r):(function(e,t,n,r,o){const s=Gt(e),i=Gt(t),c=[];for(const t of s)i.has(t)||c.push({target:e,evolution:{type:"del",prop:t},prop:t,origin:o});for(const t of i)s.has(t)||c.push({target:e,evolution:{type:"add",prop:t},prop:t,origin:o});for(const a of i){if(!s.has(a))continue;const i=Ze(e[a]),f=Ze(t[a]);Bt(i,f)?Xt(i,f,n,r,o):Object.is(i,f)||c.push({target:e,evolution:{type:"set",prop:a},prop:a,origin:o})}r.push(...c)}(e,t,n,r,o),r):r}function Jt(e,t){let n=e;const r=new WeakSet;for(;n&&!r.has(n);){if(r.add(n),t.has(n))return!0;n=ae.get(n)}return!1}function Yt(e,t=J){e=Ze(e);const n=He();if(!n||"symbol"==typeof t&&t!==J)return;let r=ie.get(e);r||(r=new Map,ie.set(e,r));let o=r.get(t);o||(o=new Set,r.set(t,o)),o.add(n);const s=se.get(n);s?s.add(e):se.set(n,new Set([e]))}Ft(Date,RegExp,Error,Promise,Function),"undefined"!=typeof window&&(!function(...e){for(const t of e){try{Object.defineProperty(t,G,{value:!0,writable:!1,enumerable:!1,configurable:!1})}catch{}G in t||_t.add(t)}e[0]}(window,document),Ft(Node,Element,HTMLElement,EventTarget));const Qt=new WeakMap,en=[],tn={[Symbol.toStringTag]:"MutTs Reactive",get(e,t,n){if(e&&"object"==typeof e&&!Object.hasOwn(e,t)){const n=Qt.get(e.constructor);if(n&&t in n){const r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(e):(...t)=>r.value.apply(e,t)}}if(t===G)return!1;const r=Ze(e);if(r[X]?.has(t)||"symbol"==typeof t)return s.get(e,t,n);const o=Reflect.has(n,t),c=o&&Object.hasOwn(n,t),a=o&&!c,f=oe.ignoreAccessors&&c&&(i(n,t)||i(r,t));if(o&&(oe.instanceMembers&&a&&e instanceof Object||f)||Yt(e,t),a&&(!oe.instanceMembers||!(e instanceof Object))){let n=on(Object.getPrototypeOf(e));for(;n&&n!==Object.prototype&&(Yt(n,t),!Object.hasOwn(n,t));){let e=on(Object.getPrototypeOf(n));e===n&&(e=on(Object.getPrototypeOf(Ze(n)))),n=e}}const l=s.get(e,t,n);if("object"==typeof l&&null!==l){const n=on(l);return At(e)&&Dt(n,e,t),n}return l},set(e,t,n,r){const o=Ze(e),i=Ze(r);if(o[X]?.has(t)||o!==i)return s.set(e,t,n,r);const c=Ze(n);let a=Lt;if(Reflect.has(i,t)){Object.getOwnPropertyDescriptor(i,t),Object.getOwnPropertyDescriptor(o,t);a=jt(()=>Reflect.get(o,t,r))}if(Mt.has(e)&&("object"==typeof a&&null!==a&&Tt(a,e,t),"object"==typeof c&&null!==c)){Dt(on(c),e,t)}return a!==c&&s.set(e,t,c,r)&&Zt(e,t,a,c,a!==Lt),!0},has(t,n){if(en.includes(t))throw new re(`[reactive] Circular dependency detected in 'has' check for property '${String(n)}'`,{code:e.ReactiveErrorCode.CycleDetected,cycle:[]});en.push(t),Yt(t,n);const r=Reflect.has(t,n);return en.pop(),r},deleteProperty(e,t){if(!Object.hasOwn(e,t))return!1;const n=e[t];return Mt.has(e)&&"object"==typeof n&&null!==n&&Tt(n,e,t),delete e[t],Nt(e,{type:"del",prop:t},t),Mt.has(e)&&Pt(e),!0},ownKeys:e=>(Yt(e,J),Reflect.ownKeys(e))},nn=new WeakSet,rn=C(e=>class extends e{constructor(...e){return super(...e),nn.has(new.target)?sn(this):this}});function on(e){if(!e||"object"!=typeof e)return e;const t=e;if(qt(t))return t;if(Be.has(t))return t;const n=function(e){return Ue.get(e)}(t);if(void 0!==n)return n;const r=!(Z in t)||t instanceof t[Z]?t:new t[Z](t);r!==t&&function(e,t){Be.set(e,t)}(r,t);const o=new Proxy(r,tn);return function(e,t){Ue.set(e,t),Be.set(t,e)}(t,o),o}const sn=g({class(e){if(e.prototype instanceof rn)return nn.add(e),e;class t extends e{constructor(...n){return super(...n),new.target===t||nn.has(new.target)||oe.warn(`${e.name} has been inherited by ${this.constructor.name} that is not reactive.\n@reactive decorator must be applied to the leaf class OR classes have to extend ReactiveBase.`),sn(this)}}return Object.defineProperty(t,"name",{value:`Reactive<${e.name}>`}),t},get:e=>on(e),default:on});function cn(e,t,{immediate:n=!1}={}){if(null==e)return;if("object"!=typeof e)throw new Error("Target of deep watching must be an object");const r=le(()=>t(e),t);return kt(()=>{Mt.add(e);let o=Rt.get(r);o||(o=new Set,Rt.set(r,o)),o.add(e);const s=new WeakSet;return function e(t,n=0){var r;if(!(!t||s.has(t)||(r=t,"object"!=typeof r||null===r)||n>oe.maxDeepWatchDepth||qt(t))){s.add(t),Mt.add(t),o.add(t);for(const r in Ze(t))if(Object.hasOwn(t,r)){const o=t[r];e("object"==typeof o&&null!==o?sn(o):o,n+1)}if(Array.isArray(t)||t instanceof Array){const r=t.length;for(let o=0;o<r;o++){const r=t[o];e("object"==typeof r&&null!==r?sn(r):r,n+1)}}else if(t instanceof Set)for(const r of t){e("object"==typeof r&&null!==r?sn(r):r,n+1)}else if(t instanceof Map)for(const[r,o]of t){e("object"==typeof o&&null!==o?sn(o):o,n+1)}}}(e),n&&t(e),n=!0,()=>{const e=Rt.get(r);if(e){for(const t of e){const e=xt.get(t);e?(e.delete(r),0===e.size&&(xt.delete(t),Mt.delete(t))):Mt.delete(t)}Rt.delete(r)}}})}const an=Symbol("cleanup"),fn=Symbol("unset-yet");const ln=g({class(e){Ft(e)},default:function(e,...t){return"object"==typeof e?function(e){if(qt(e=Ze(e)))return e;try{Object.defineProperty(e,G,{value:!0,writable:!1,enumerable:!1,configurable:!0})}catch{}return G in e||_t.add(e),e}(e):n=>{n.prototype[X]=new Set(n.prototype[X]||[]),n.prototype[X].add(e);for(const e of t)n.prototype[X].add(e);return n}}});function un(e,t){return Object.defineProperty(e,an,{value:t,writable:!1,enumerable:!1,configurable:!0})}const hn=new WeakMap,dn=new WeakMap;function pn(e,t){e.branches??(e.branches=new WeakMap);let n=e.branches.get(t);return n||(n={},e.branches.set(t,n)),n}function gn(e){const t=ue(e),n=hn.get(t);if(n)return n;const r={},o=le((...t)=>{const n=t;if(n.some(e=>!(e&&["object","symbol","function"].includes(typeof e))))throw new Error("memoize expects non-null object arguments");let o=r;for(const e of n)o=pn(o,e);if(Yt(o,"memoize"),"result"in o){if(oe.onMemoizationDiscrepancy){const t=oe.isVerificationRun;oe.isVerificationRun=!0;try{const t=jt(()=>e(...n));c(o.result,t)||oe.onMemoizationDiscrepancy(o.result,t,e,n,"calculation")}finally{oe.isVerificationRun=t}}return o.result}if(o.cleanup=Ot(()=>kt(()=>(o.result=e(...n),()=>{delete o.result,Nt(o,{type:"invalidate",prop:n},"memoize"),o.cleanup&&(o.cleanup(),o.cleanup=void 0)}),{opaque:!0})),oe.onMemoizationDiscrepancy){const t=oe.isVerificationRun;oe.isVerificationRun=!0;try{const t=jt(()=>e(...n));c(o.result,t)||oe.onMemoizationDiscrepancy(o.result,t,e,n,"comparison")}finally{oe.isVerificationRun=t}}return o.result},e);return hn.set(t,o),hn.set(o,o),o}const yn=g({getter:(e,t,n)=>function(){let r=dn.get(e);r||(r=le(o(t=>e.call(t),`${String(t?.constructor?.name??t?.name??"Object")}.${String(n)}`),{method:e,propertyKey:n,...e[te]?{[te]:e[te]}:{}}),dn.set(e,r));return gn(r)(this)},method:(e,t,n)=>function(...r){let s=dn.get(e);s||(s=le(o((t,...n)=>e.call(t,...n),`${String(t?.constructor?.name??t?.name??"Object")}.${String(n)}`),{method:e,propertyKey:n,...e[te]?{[te]:e[te]}:{}}),dn.set(e,s));return gn(s)(this,...r)},default:gn});function*mn(e){let t=e.next();for(;!t.done;)yield sn(t.value),t=e.next()}function*bn(e){let t=e.next();for(;!t.done;){const[n,r]=t.value;yield[sn(n),sn(r)],t=e.next()}}let wn=(()=>{var e,t,n,r,o,s,i,c,a;let f,l,u=[ln],h=[],d=function(){class e extends(T(P,{get(e){return this[R](e)},set(e,t){this[D](e,t)},getLength(){return this.length},setLength(e){this.length=e}})){toArray(){return Array.from(this)}}return e}();var p,g,y;return l=class extends d{get[(t=new WeakMap,n=new WeakMap,r=new WeakMap,o=new WeakMap,s=new WeakMap,i=new WeakMap,c=new WeakMap,e=new WeakSet,A)](){return this.toArray()}constructor(a,f){let l;if(super(),e.add(this),t.set(this,void 0),n.set(this,void 0),r.set(this,void 0),o.set(this,new Map),s.set(this,new Map),i.set(this,new Set),c.set(this,void 0),kt(({ascend:e})=>{l=e}),E(this,c,l,"f"),"function"!=typeof a)throw new Error("Register requires a key function");E(this,t,a,"f"),E(this,n,sn([]),"f"),E(this,r,sn(new Map),"f"),f&&this.push(...f)}ensureKey(n){let r=O(this,s,"f").get(n);if(r)return r.key;if(r={key:void 0},O(this,s,"f").set(n,r),O(this,c,"f").call(this,()=>{const o=kt(({reaction:o})=>{const s=O(this,t,"f").call(this,n);this.assertValidKey(s);const i=r.key;o&&void 0!==i&&!Object.is(s,i)&&O(this,e,"m",a).call(this,n,i,s),r.key=s});r.stop=o,O(this,i,"f").add(o)}),void 0===r.key)throw new Error("Register key function must return a property key");return r.key}assertValidKey(e){const t=typeof e;if("string"!==t&&"number"!==t&&"symbol"!==t)throw new Error("Register key function must return a property key")}setKeyValue(e,t){const n=O(this,r,"f").get(e);void 0!==n&&n!==t&&this.cleanupValue(n),O(this,r,"f").set(e,t)}cleanupValue(e){const t=O(this,s,"f").get(e);if(!t)return;const n=t.stop;n&&(t.stop=void 0,O(this,i,"f").delete(n),n()),O(this,s,"f").delete(e)}disposeKeyEffects(){for(const e of Array.from(O(this,s,"f").keys()))this.cleanupValue(e);O(this,i,"f").clear()}incrementUsage(e){const t=O(this,o,"f").get(e)??0;O(this,o,"f").set(e,t+1)}decrementUsage(e){const t=O(this,o,"f").get(e);if(t)if(t<=1){const t=O(this,r,"f").get(e);O(this,o,"f").delete(e),O(this,r,"f").delete(e),void 0!==t&&this.cleanupValue(t)}else O(this,o,"f").set(e,t-1)}normalizeIndex(e,t=!1){const n=this.length;let r=e;if(r<0&&(r=Math.max(n+r,0)),r>n){if(!t)throw new RangeError("Index out of bounds");r=n}if(!t&&r===n)throw new RangeError("Index out of bounds");return r}assignAt(e,t,r){const o=O(this,n,"f")[e];void 0!==o&&Object.is(o,t)||(void 0!==o&&this.decrementUsage(o),O(this,n,"f")[e]=t,this.incrementUsage(t)),this.setKeyValue(t,r)}insertKeyValue(e,t,r){O(this,n,"f").splice(e,0,t),this.incrementUsage(t),this.setKeyValue(t,r)}rebuildFrom(e){this.disposeKeyEffects(),O(this,n,"f").splice(0,O(this,n,"f").length),O(this,o,"f").clear(),O(this,r,"f").clear();for(const t of e){const e=this.ensureKey(t);O(this,n,"f").push(e),this.incrementUsage(e),O(this,r,"f").set(e,t)}}get length(){return O(this,n,"f").length}[(a=function(e,t,i){if(Object.is(t,i))return;const c=O(this,r,"f").get(i);if(void 0!==c&&c!==e)throw new Error(`Register key collision for key ${String(i)}`);const a=O(this,o,"f").get(t);if(!a)return;const f=O(this,o,"f").get(i)??0;this.setKeyValue(i,e);for(let e=0;e<O(this,n,"f").length;e++)Object.is(O(this,n,"f")[e],t)&&(O(this,n,"f")[e]=i);O(this,o,"f").set(i,f+a),O(this,o,"f").delete(t),O(this,r,"f").delete(t);const l=O(this,s,"f").get(e);l&&(l.key=i)},R)](e){const t=O(this,n,"f")[e];return void 0===t?void 0:O(this,r,"f").get(t)}[D](e,t){const n=this.ensureKey(t);if(e===this.length)return void this.insertKeyValue(e,n,t);const r=this.normalizeIndex(e);this.assignAt(r,n,t)}push(...e){for(const t of e){const e=this.ensureKey(t);this.insertKeyValue(this.length,e,t)}return this.length}pop(){if(this.length)return this.removeAt(this.length-1)}shift(){if(this.length)return this.removeAt(0)}unshift(...e){let t=0;for(const n of e){const e=this.ensureKey(n);this.insertKeyValue(t++,e,n)}return this.length}splice(e,t,...o){const s=this.normalizeIndex(e,!0),i=this.length-s,c=Math.min(void 0===t?i:Math.max(t,0),i),a=[];for(const e of o)a.push(this.ensureKey(e));const f=O(this,n,"f").splice(s,c,...a),l=[];for(const e of f){if(void 0===e)continue;const t=O(this,r,"f").get(e);this.decrementUsage(e),l.push(t)}for(let e=0;e<a.length;e++){const t=a[e],n=o[e];this.incrementUsage(t),this.setKeyValue(t,n)}return l}clear(){O(this,n,"f").length=0,O(this,o,"f").clear(),O(this,r,"f").clear(),this.disposeKeyEffects()}get(e){return O(this,r,"f").get(e)}set(e,t){O(this,r,"f").has(e)&&this.setKeyValue(e,t)}remove(e){let t=this.indexOfKey(e);for(;-1!==t;)this.removeAt(t),t=this.indexOfKey(e)}removeAt(e){const[t]=O(this,n,"f").splice(e,1);if(void 0===t)return;const o=O(this,r,"f").get(t);return this.decrementUsage(t),o}keep(e){const t=new Map;for(const[o,s]of O(this,n,"f").entries()){if(t.has(s)){t.get(s)||this.removeAt(o);continue}const n=e(O(this,r,"f").get(s));t.set(s,n),n||this.removeAt(o)}}hasKey(e){return O(this,o,"f").has(e)}indexOfKey(e){return O(this,n,"f").indexOf(e)}mapKeys(){return O(this,r,"f").keys()}update(...e){for(const t of e){const e=this.ensureKey(t);O(this,r,"f").has(e)&&this.setKeyValue(e,t)}}upsert(e,...t){for(const n of t){const t=this.ensureKey(n);O(this,r,"f").has(t)?this.setKeyValue(t,n):e(n)}}entries(){const e=this;return function*(){for(let t=0;t<O(e,n,"f").length;t++){const o=O(e,r,"f").get(O(e,n,"f")[t]);void 0!==o&&(yield[t,o])}}()}[Symbol.iterator](){const e=this;return function*(){for(const t of O(e,n,"f")){const n=O(e,r,"f").get(t);void 0!==n&&(yield n)}}()}toString(){return`[Register length=${this.length}]`}at(e){const t=e<0?this.length+e:e;if(!(t<0||t>=this.length))return this[R](t)}reverse(){return O(this,n,"f").reverse(),this}sort(e){const t=e?(t,n)=>e(O(this,r,"f").get(t),O(this,r,"f").get(n)):void 0;return O(this,n,"f").sort(t),this}fill(e,t=0,n=this.length){const r=this.toArray();return r.fill(e,t,n),this.rebuildFrom(r),this}copyWithin(e,t,n){const r=this.toArray();return r.copyWithin(e,t,n),this.rebuildFrom(r),this}},p=l,"symbol"==typeof(g="RegisterClass")&&(g=g.description?"[".concat(g.description,"]"):""),Object.defineProperty(p,"name",{configurable:!0,value:y?"".concat(y," ",g):g}),(()=>{const e="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;k(null,f={value:l},u,{kind:"class",name:l.name,metadata:e},null,h),l=f.value,e&&Object.defineProperty(l,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e}),j(l,h)})(),l})();const vn=wn;const Sn=new WeakMap;function kn(){const e=He();return e?Sn.get(e):void 0}function jn(e){Object.defineProperty(e,"value",{get:e.get,set:e.set,configurable:!0,enumerable:!0})}function On(e,t,n,r){return r&&Object.defineProperty(e,Y,{value:r,writable:!1,enumerable:!1,configurable:!0}),un(e,()=>{n();for(const e of t.values())e?.();t.clear()})}function En(e,t){e=sn(e);const n=sn([]),r=new Map;function o(e){const t=r.get(e);t&&(r.delete(e),t(),Reflect.deleteProperty(n,e))}const i=kn(),c=i?i.depth+1:0,a=kt(function({ascend:a}){const f=e.length;!function(e){s.set(n,"length",e,n)}(f);const l=Array.from(r.keys());for(let o=0;o<f;o++)r.has(o)||a(()=>{const a=o,f=kt(function(){const r=jt(()=>n[a]),o={key:a,source:e,get:()=>s.get(e,a,e),set:t=>s.set(e,a,t,e),old:r};jn(o);const i=t(o,n);n[a]=i});Me(f,`project[${c}]:${a}`),Sn.set(f,{source:e,key:a,target:n,depth:c,parent:i}),r.set(o,f)});for(const e of l)e>=f&&o(e)});return On(n,r,()=>a(),{source:e,target:n,apply:t,depth:c,parent:i})}function Mn(e,t){const n=sn(e),r=new Map,o=sn(r),s=new Map;function i(e){const t=s.get(e);t&&(t(),s.delete(e),o.delete(e))}const c=kn(),a=c?c.depth+1:0,f=kt(function({ascend:e}){const r=new Set;for(const e of n.mapKeys())r.add(e);for(const i of r)s.has(i)||e(()=>{const e=kt(function(){const e=jt(()=>o.get(i)),r={key:i,source:n,get:()=>n.get(i),set:e=>(n.set(i,e),!0),old:e};jn(r);const s=t(r,o);o.set(i,s)});Me(e,`project[${a}]:${String(i)}`),Sn.set(e,{source:n,key:i,target:o,depth:a,parent:c}),s.set(i,e)});for(const e of Array.from(s.keys()))r.has(e)||i(e)});return On(o,s,()=>f(),{source:n,target:o,apply:t,depth:a,parent:c})}function xn(e,t){const n=sn(e),r=sn({}),o=new Map;function i(e){const t=o.get(e);t&&(t(),o.delete(e),Reflect.deleteProperty(r,e))}const c=kn(),a=c?c.depth+1:0,f=kt(function({ascend:e}){const f=new Set;for(const e in n)f.add(e);const l=Reflect.ownKeys(n);for(const e of l)f.add(e);for(const i of f)o.has(i)||e(()=>{const e=kt(function(){const e=i,o=jt(()=>r[i]),c={key:e,source:n,get:()=>s.get(n,e,n),set:t=>s.set(n,e,t,n),old:o};jn(c);const a=t(c,r);r[e]=a});Me(e,`project[${a}]:${String(i)}`),Sn.set(e,{source:n,key:i,target:r,depth:a,parent:c}),o.set(i,e)});for(const e of Array.from(o.keys()))f.has(e)||i(e)});return On(r,o,()=>f(),{source:n,target:r,apply:t,depth:a,parent:c})}function Rn(e,t){const n=sn(e),r=new Map,o=sn(r),s=new Map;function i(e){const t=s.get(e);t&&(t(),s.delete(e),o.delete(e))}const c=kn(),a=c?c.depth+1:0,f=kt(function({ascend:e}){const r=new Set;for(const e of n.keys())r.add(e);for(const i of r)s.has(i)||e(()=>{const e=kt(function(){const e=jt(()=>o.get(i)),r={key:i,source:n,get:()=>n.get(i),set:e=>(n.set(i,e),!0),old:e};jn(r);const s=t(r,o);o.set(i,s)});Me(e,`project[${a}]:${String(i)}`),Sn.set(e,{source:n,key:i,target:o,depth:a,parent:c}),s.set(i,e)});for(const e of Array.from(s.keys()))r.has(e)||i(e)});return On(o,s,()=>f(),{source:n,target:o,apply:t,depth:a,parent:c})}const Dn=Object.assign(function(e,t){if(Array.isArray(e))return En(e,t);if(e instanceof Map)return Rn(e,t);if(e instanceof vn)return Mn(e,t);if(e&&(e.constructor===Object||void 0===e.constructor))return xn(e,t);throw new Error("Unsupported source type")},{array:En,register:Mn,record:xn,map:Rn});function*Tn(e,{length:t=!0}={}){t&&(yield"length"),yield e}function*An(e,t,{length:n=!1}={}){const r=Math.min(e,t),o=Math.max(e,t);n&&(yield"length");for(let e=r;e<=o;e++)yield e}class Pn extends Array{get(e){return Yt(this,e),sn(this[e])}set(e,t){const n=e>=this.length;this[e]=t,Kt(this,{type:"set",prop:e},Tn(e,{length:n}))}getLength(){return Yt(this,"length"),this.length}setLength(e){const t=this.length;try{this.length=e}finally{Kt(this,{type:"set",prop:"length"},An(t,e,{length:!0}))}}}const Wn={get:s.get,set:s.set};Object.assign(s,{get(e,t,n){if(e instanceof Array&&"string"==typeof t){if("length"===t)return Pn.prototype.getLength.call(e);const n=parseInt(t);if(!Number.isNaN(n))return Pn.prototype.get.call(e,n)}return Wn.get(e,t,n)},set(e,t,n,r){if(e instanceof Array&&"string"==typeof t){if("length"===t)return Pn.prototype.setLength.call(e,n);const r=parseInt(t);if(!Number.isNaN(r))return Pn.prototype.set.call(e,r,n)}return Wn.set(e,t,n,r)}});class $n extends Array{toJSON(){return this}get[Symbol.toStringTag](){return"ReactiveArray"}at(e){const t=e<0?this.length+e:e;if(Yt(this,t),!(t<0||t>=this.length))return sn(this[t])}toReversed(){return Yt(this),sn(this.toReversed())}toSorted(e){return Yt(this),sn(this.toSorted(e))}toSpliced(e,t,...n){return Yt(this),void 0===t?this.toSpliced(e):this.toSpliced(e,t,...n)}with(e,t){return Yt(this),sn(this.with(e,t))}entries(){return Yt(this),bn(this.entries())}keys(){return Yt(this,"length"),this.keys()}values(){return Yt(this),mn(this.values())}[Symbol.iterator](){Yt(this);const e=this[Symbol.iterator]();return{next(){const t=e.next();return t.done?t:{value:sn(t.value),done:!1}},[Symbol.iterator](){return this},[Symbol.dispose](){}}}indexOf(e,t){Yt(this);const n=Ze(e),r=this.indexOf(n,t);return-1!==r?r:this.indexOf(e,t)}lastIndexOf(e,t){Yt(this);const n=Ze(e),r=this.lastIndexOf(n,t);return-1!==r?r:this.lastIndexOf(e,t)}includes(e,t){Yt(this);const n=Ze(e);return this.includes(n,t)||this.includes(e,t)}find(e,t){if(Yt(this),"function"==typeof e){const n=e;return sn(this.find((e,r,o)=>n.call(t,sn(e),r,o),t))}const n="number"==typeof t?t:void 0,r=this.indexOf(e,n);if(-1!==r)return sn(this[r])}findIndex(e,t){if(Yt(this),"function"==typeof e){const n=e;return this.findIndex((e,r,o)=>n.call(t,sn(e),r,o),t)}const n="number"==typeof t?t:void 0;return this.indexOf(e,n)}flat(e){return Yt(this),sn(void 0===e?this.flat():this.flat(e))}flatMap(e,t){return Yt(this),sn(this.flatMap((n,r,o)=>e.call(t,sn(n),r,o),t))}filter(e,t){return Yt(this),sn(this.filter((t,n,r)=>e(sn(t),n,r),t))}map(e,t){return Yt(this),sn(this.map((t,n,r)=>e(sn(t),n,r),t))}reduce(e,t){Yt(this);const n=void 0===t?this.reduce(e):this.reduce(e,t);return sn(n)}reduceRight(e,t){Yt(this);const n=void 0!==t?this.reduceRight(e,t):this.reduceRight(e);return sn(n)}slice(e,t){for(const n of An(e||0,t||this.length-1))Yt(this,n);return void 0===e?this.slice():void 0===t?this.slice(e):this.slice(e,t)}concat(...e){return Yt(this),sn(this.concat(...e))}join(e){return Yt(this),this.join(e)}forEach(e,t){Yt(this),this.forEach((n,r,o)=>{e.call(t,sn(n),r,o)})}every(e,t){return Yt(this),this.every((n,r,o)=>e.call(t,sn(n),r,o),t)}some(e,t){return Yt(this),this.some((n,r,o)=>e.call(t,sn(n),r,o),t)}push(...e){const t=this.length;try{return this.push(...e)}finally{Kt(this,{type:"bunch",method:"push"},An(t,t+e.length-1,{length:!0}))}}pop(){if(0!==this.length)try{return sn(this.pop())}finally{Kt(this,{type:"bunch",method:"pop"},Tn(this.length))}}shift(){if(0!==this.length)try{return sn(this.shift())}finally{Kt(this,{type:"bunch",method:"shift"},An(0,this.length+1,{length:!0}))}}unshift(...e){try{return this.unshift(...e)}finally{Kt(this,{type:"bunch",method:"unshift"},An(0,this.length-e.length,{length:!0}))}}splice(e,t,...n){const r=this.length;void 0===t&&(t=r-e);try{return sn(void 0===t?this.splice(e):this.splice(e,t,...n))}finally{Kt(this,{type:"bunch",method:"splice"},t===n.length?An(e,e+t):An(e,r+Math.max(n.length-t,0),{length:!0}))}}reverse(){try{return this.reverse()}finally{Kt(this,{type:"bunch",method:"reverse"},An(0,this.length-1))}}sort(e){e=e||((e,t)=>e.toString().localeCompare(t.toString()));try{return this.sort((t,n)=>e(sn(t),sn(n)))}finally{Kt(this,{type:"bunch",method:"sort"},An(0,this.length-1))}}fill(e,t,n){try{return void 0===t?this.fill(e):void 0===n?this.fill(e,t):this.fill(e,t,n)}finally{Kt(this,{type:"bunch",method:"fill"},An(0,this.length-1))}}copyWithin(e,t,n){try{return void 0===n?this.copyWithin(e,t):this.copyWithin(e,t,n)}finally{Kt(this,{type:"bunch",method:"copyWithin"},An(0,this.length-1))}}}class In extends WeakMap{get[Symbol.toStringTag](){return"ReactiveWeakMap"}delete(e){const t=this.has(e),n=this.delete(e);return t&&Nt(f(this),{type:"del",prop:e},e),n}get(e){return Yt(f(this),e),sn(this.get(e))}has(e){return Yt(f(this),e),this.has(e)}set(e,t){const n=this.has(e),r=this.get(e),o=sn(t);return this.set(e,o),n&&r===o||Zt(f(this),e,r,o,n),this}}class zn extends Map{get[Symbol.toStringTag](){return"ReactiveMap"}get size(){return Yt(this,"size"),this.size}clear(){const e=this.size>0;if(this.clear(),e){const e={type:"bunch",method:"clear"};Nt(this,e,"size"),Kt(f(this),e)}}entries(){return Yt(f(this)),bn(this.entries())}forEach(e,t){Yt(f(this)),this.forEach(e,t)}keys(){return Yt(f(this)),this.keys()}values(){return Yt(f(this)),mn(this.values())}[Symbol.iterator](){Yt(f(this));const e=this[Symbol.iterator]();return{next(){const t=e.next();return t.done?t:{value:[t.value[0],sn(t.value[1])],done:!1}},[Symbol.iterator](){return this},[Symbol.dispose](){}}}delete(e){const t=this.has(e),n=this.delete(e);if(t){const t={type:"del",prop:e};Nt(f(this),t,e),Nt(this,t,"size")}return n}get(e){return Yt(f(this),e),sn(this.get(e))}has(e){return Yt(f(this),e),this.has(e)}set(e,t){const n=this.has(e),r=this.get(e),o=sn(t);if(this.set(e,o),!n||r!==o){Zt(f(this),e,r,o,n);Nt(this,{type:n?"set":"add",prop:e},"size")}return this}}class Cn extends WeakSet{get[Symbol.toStringTag](){return"ReactiveWeakSet"}add(e){const t=this.has(e);return this.add(e),t||Nt(f(this),{type:"add",prop:e},e),this}delete(e){const t=this.has(e),n=this.delete(e);return t&&Nt(f(this),{type:"del",prop:e},e),n}has(e){return Yt(f(this),e),this.has(e)}}class Nn extends Set{get[Symbol.toStringTag](){return"ReactiveSet"}get size(){return Yt(this,"size"),this.size}add(e){const t=this.has(e),n=sn(e);if(this.add(n),!t){const e={type:"add",prop:n};Nt(f(this),e,n),Nt(this,e,"size")}return this}clear(){const e=this.size>0;if(this.clear(),e){const e={type:"bunch",method:"clear"};Nt(this,e,"size"),Kt(f(this),e)}}delete(e){const t=this.has(e),n=this.delete(e);if(t){const t={type:"del",prop:e};Nt(f(this),t,e),Nt(this,t,"size")}return n}has(e){return Yt(f(this),e),this.has(e)}entries(){return Yt(f(this)),bn(this.entries())}forEach(e,t){Yt(f(this)),this.forEach(e,t)}keys(){return Yt(f(this)),mn(this.keys())}values(){return Yt(f(this)),mn(this.values())}[Symbol.iterator](){Yt(f(this));const e=this[Symbol.iterator]();return{next(){const t=e.next();return t.done?t:{value:sn(t.value),done:!1}},[Symbol.iterator](){return this},[Symbol.dispose](){}}}}Qt.set(Array,$n.prototype),Qt.set(Set,Nn.prototype),Qt.set(WeakSet,Cn.prototype),Qt.set(Map,zn.prototype),Qt.set(WeakMap,In.prototype);const Kn={objectToProxy:Ue,proxyToObject:Be,effectToReactiveObjects:se,watchers:ie,objectParents:Et,objectsWithDeepWatchers:Mt,deepWatchers:xt,effectToDeepWatchedObjects:Rt,nonReactiveObjects:_t},_n=[],Vn=g({getter:(e,t,n)=>function(){const t=_n.findIndex(e=>e.object===this&&e.prop===n);if(t>-1)throw new Error(`Circular dependency detected: ${_n.slice(t).map(e=>`${e.object.constructor.name}.${String(e.prop)}`).join(" -> ")} -> again`);_n.push({object:this,prop:n});try{const t=e.call(this);return Ln(this,n,t),t}finally{_n.pop()}}});function Ln(e,t,n){Object.defineProperty(e,t,{value:n})}const Fn=Object.assign(g({method:(e,t,n)=>function(...t){return Fn.warn(this,n),e.apply(this,t)},getter:(e,t,n)=>function(){return Fn.warn(this,n),e.call(this)},setter:(e,t,n)=>function(t){return Fn.warn(this,n),e.call(this,t)},class:e=>class extends e{constructor(...e){super(...e),Fn.warn(this,"constructor")}},default:e=>g({method:(t,n,r)=>function(...n){return Fn.warn(this,r,e),t.apply(this,n)},getter:(t,n,r)=>function(){return Fn.warn(this,r,e),t.call(this)},setter:(t,n,r)=>function(n){return Fn.warn(this,r,e),t.call(this,n)},class:t=>class extends t{constructor(...t){super(...t),Fn.warn(this,"constructor",e)}}})}),{warn:(e,t,n)=>{}});var qn={version:"1.0.7"};const{version:Hn}=qn,Un="__MUTTS_INSTANCE__",Bn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global&&global;if(Bn){let e="mutts/index";const t=eval;try{if("undefined"!=typeof __filename)e=__filename;else{const n=t("import.meta");n&&n.url&&(e=n.url)}}catch(e){}const n={version:Hn,source:e,timestamp:Date.now()};if(Bn[Un]){const e=Bn[Un];throw new Error(`[Mutts] Multiple instances detected!\nExisting instance: ${JSON.stringify(e,null,2)}\nNew instance: ${JSON.stringify(n,null,2)}\nThis usually happens when 'mutts' is both installed as a dependency and bundled, or when different versions are loaded. Please check your build configuration (aliases, externals) to ensure a single source of truth.`)}Bn[Un]=n}const Zn=new Set;function Gn(e){if("function"!=typeof e)return e;const t=new Set;for(const e of Zn)t.add(e());return function(...n){const r=new Set;for(const e of t)r.add(e());try{return e.apply(this,n)}finally{for(const e of r)e()}}}t.addHook=function(e){return Zn.add(e),()=>{Zn.delete(e)}};const Xn={then:Promise.prototype.then,catch:Promise.prototype.catch,finally:Promise.prototype.finally,setTimeout:globalThis.setTimeout,setInterval:globalThis.setInterval,setImmediate:globalThis.setImmediate,requestAnimationFrame:globalThis.requestAnimationFrame,queueMicrotask:globalThis.queueMicrotask};Promise.prototype.then=function(e,t){return Xn.then.call(this,Gn(e),Gn(t))},Promise.prototype.catch=function(e){return Xn.catch.call(this,Gn(e))},Promise.prototype.finally=function(e){return Xn.finally.call(this,Gn(e))},globalThis.setTimeout=(e,...t)=>Xn.setTimeout.call(globalThis,Gn(e),...t),globalThis.setInterval=(e,...t)=>Xn.setInterval.call(globalThis,Gn(e),...t),Xn.setImmediate&&(globalThis.setImmediate=(e,...t)=>Xn.setImmediate.call(globalThis,Gn(e),...t)),Xn.requestAnimationFrame&&(globalThis.requestAnimationFrame=e=>Xn.requestAnimationFrame.call(globalThis,Gn(e))),Xn.queueMicrotask&&(globalThis.queueMicrotask=e=>{Xn.queueMicrotask.call(globalThis,Gn(e))}),e.AZone=Ce,e.ArrayReadForward=P,e.DecoratorError=h,e.Destroyable=function(e,t){var n;return e&&"function"!=typeof e&&(t=e,e=void 0),e||(e=class{}),n=class extends e{static destroy(e){const t=n.destructors.get(e);if(!t)return!1;y.unregister(e[b]),n.destructors.delete(e),Object.setPrototypeOf(e,new Proxy({},v));for(const t of Object.getOwnPropertyNames(e))delete e[t];return t(),!0}static isDestroyable(e){return n.destructors.has(e)}constructor(...e){super(...e);const r={};this[b]=r;const o=t?.destructor??this[m];if(!o)throw new w("Destructor is not defined");function s(){o(r)}n.destructors.set(this,s),y.register(this,s,r)}},n.destructors=new WeakMap,n},e.DestructionError=w,e.Eventful=class{constructor(){M.set(this,new Map),x.set(this,[])}hook(e){return O(this,x,"f").includes(e)||O(this,x,"f").push(e),()=>{O(this,x,"f").splice(O(this,x,"f").indexOf(e),1)}}on(e,t){if("object"==typeof e)for(const t of Object.keys(e))this.on(t,e[t]);else if(void 0!==t){let n=O(this,M,"f").get(e);n||(n=[],O(this,M,"f").set(e,n)),n.push(t)}return()=>this.off(e,t)}off(e,t){if("object"==typeof e)for(const t of Object.keys(e))this.off(t,e[t]);else if(null!=t){const n=O(this,M,"f").get(e);n&&O(this,M,"f").set(e,n.filter(e=>e!==t))}else O(this,M,"f").delete(e)}emit(e,...t){const n=O(this,M,"f").get(e);if(n)for(const e of n)e.apply(this,t);for(const n of O(this,x,"f"))n.call(this,e,...t)}},e.FoolProof=s,e.Indexable=T,e.IterableWeakMap=I,e.IterableWeakSet=z,e.ReactiveBase=rn,e.ReactiveError=re,e.Register=vn,e.Zone=Ne,e.ZoneAggregator=_e,e.ZoneHistory=Ke,e.addBatchCleanup=gt,e.allocated=S,e.allocatedValues=b,e.arrayEquals=function(e,t){if(e===t)return!0;if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},e.asyncZone=Ve,e.atomic=vt,e.biDi=function(e,t,n){"function"!=typeof t&&(n=t.set,t=t.get);let r=Symbol();return kt(le(()=>{const n=t();Ze(n)!==r&&e(n)},e)),n?vt(e=>{r=Ze(e),n(e)}):()=>{}},e.buildReactivityGraph=Pe,e.cache=Ln,e.cached=Vn,e.callOnGC=function(e){let t=!1;const n=()=>{t||(t=!0,e())};return y.register(n,e,e),n},e.chainPromise=B,e.cleanedBy=un,e.cleanup=an,e.contentRef=f,e.debounce=function(e){return g({method(t,n,r){let o=null;return function(...n){o&&clearTimeout(o),o=setTimeout(()=>{t.apply(this,n),o=null},e)}}})},e.decorator=g,e.deepCompare=c,e.deepWatch=cn,e.defer=yt,e.deprecated=Fn,e.derived=function(e){const t={value:void 0};return un(t,jt(()=>kt(function(n){t.value=e(n)})))},e.describe=function(e){return(...t)=>n=>class extends n{constructor(...n){super(...n);for(const n of t)Object.defineProperty(this,n,{...Object.getOwnPropertyDescriptor(this,n),...e})}}},e.destructor=m,e.effect=kt,e.enableDevTools=function(){"undefined"!=typeof window&&(de||(de=!0,window.__MUTTS_DEVTOOLS__={getGraph:Pe,setEffectName:Me,setObjectName:xe,registerEffect:Re,registerObject:De}))},e.forwardArray=A,e.getActivationLog=function(){return Ye},e.getActiveProjection=kn,e.getAt=R,e.getState=zt,e.immutables=Vt,e.isCached=function(e,t){return!!Object.getOwnPropertyDescriptor(e,t)},e.isConstructor=r,e.isDevtoolsEnabled=We,e.isNonReactive=qt,e.isOwnAccessor=i,e.isReactive=function(e){return Be.has(e)},e.legacyDecorator=d,e.memoize=yn,e.mixin=C,e.modernDecorator=p,e.named=u,e.organize=function(e,t,n){return Object.defineProperty(e,t,{get:n.get,set:n.set,configurable:!0,enumerable:!0}),Nt(e,{type:"set",prop:t},t),()=>delete e[t]},e.organized=function(e,t,n={}){const r=sn(e),o=sn(n),i=new Map;function c(e){const t=i.get(e);t&&(i.delete(e),t())}const a=kt(function({ascend:e}){const n=new Set;for(const e in r)n.add(e);for(const c of n)i.has(c)||e(()=>{const e=kt(function(){const e=c,n={key:e,get:()=>s.get(r,e,r),set:t=>s.set(r,e,t,r)};return Object.defineProperty(n,"value",{get:n.get,set:n.set,configurable:!0,enumerable:!0}),t(n,o)});i.set(c,e)});for(const e of Array.from(i.keys()))n.has(e)||c(e)});return un(o,()=>{a();for(const e of Array.from(i.keys()))c(e)})},e.profileInfo=Kn,e.project=Dn,e.reactive=sn,e.reactiveOptions=oe,e.register=function(e,t){return new wn(e,t)},e.registerEffectForDebug=Re,e.registerNativeReactivity=function(e,t){e.prototype[Z]=t,Ft(t)},e.registerObjectForDebug=De,e.renamed=o,e.root=Ot,e.scan=function(e,t,n){const r=sn(e),o=sn([]),i=new Map,c=sn([]),a=new WeakMap;let f=(()=>{var e;let r,o=[];return e=class{constructor(e,t){this.val=(j(this,o),e),this.prev=t}get acc(){const e=this.prev?this.prev.acc:n;return t(e,this.val)}},(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[yn],k(e,null,r,{kind:"getter",name:"acc",static:!1,private:!1,access:{has:e=>"acc"in e,get:e=>e.acc},metadata:t},null,o),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();function l(e){const t=i.get(e);t&&(t(),i.delete(e),jt(()=>{Reflect.deleteProperty(c,e),Reflect.deleteProperty(o,e)}))}const u=kt(function({ascend:e}){const t=r.length,n=new Map;let u;for(let l=0;l<t;l++){const t=s.get(r,l,r);if(!t||"object"!=typeof t&&"function"!=typeof t&&"symbol"!=typeof t)throw new Error("scan: items must be objects (WeakKey) for intermediate caching");const h=n.get(t)??0;n.set(t,h+1);let d=a.get(t);d||(d=[],a.set(t,d));let p=d[h];p?jt(()=>p.prev)!==u&&(p.prev=u):(p=sn(new f(t,u)),d[h]=p),c[l]!==p&&(c[l]=p),i.has(l)||e(()=>{const e=l,t=kt(function(){const t=c[e];if(t){const n=t.acc;jt(()=>{o[e]=n})}});i.set(e,t)}),u=p}for(const e of Array.from(i.keys()))e>=t&&l(e);jt(()=>{o.length!==t&&s.set(o,"length",t,o)})});return un(o,()=>{u();for(const e of i.values())e();i.clear()})},e.setAt=D,e.setEffectName=Me,e.setObjectName=xe,e.tag=l,e.throttle=function(e){return g({method(t,n,r){let o=0,s=null;return function(...n){const r=Date.now();if(r-o>=e)return s&&(clearTimeout(s),s=null),o=r,t.apply(this,n);if(!s){const i=e-(r-o),c=[...n];s=setTimeout(()=>{o=Date.now(),t.apply(this,c),s=null},i)}}}})},e.touched=Kt,e.touched1=Nt,e.trackEffect=function(e){const t=He();if(!t)throw new Error("Not in an effect");et.has(t)?et.get(t).add(e):et.set(t,new Set([e]))},e.unreactive=ln,e.untracked=jt,e.unwrap=Ze,e.watch=function(e,t,n={}){return"function"==typeof e?function(e,t,{immediate:n=!1,deep:r=!1}={}){let o,s=fn;const i=kt(le(function(i){const c=e(i);s!==c&&(s===fn?n&&t(c):t(c,s)),s=c,r&&(o&&o(),o=cn(c,e=>t(e,e)))},e));return()=>{i(),o&&o()}}(e,t,n):"object"==typeof e&&null!==e?function(e,t,{immediate:n=!1,deep:r=!1}={}){return r?cn(e,t,{immediate:n}):kt(function(){Yt(e),n&&t(e),n=!0})}(e,t,n):(()=>{throw new Error("watch: value must be a function or an object")})()},e.zip=function(...e){if(!e.length)return[];const t=Math.min(...e.map(e=>e.length)),n=[];for(let r=0;r<t;r++){const t=e.map(e=>e[r]);n.push(t)}return n}});
|
|
2
2
|
//# sourceMappingURL=mutts.umd.js.map
|