mutts 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{decorator-BXsign4Z.js → decorator-8qjFb7dw.js} +2 -2
- package/dist/chunks/decorator-8qjFb7dw.js.map +1 -0
- package/dist/chunks/{decorator-CPbZNnsX.esm.js → decorator-AbRkXM5O.esm.js} +2 -2
- package/dist/chunks/decorator-AbRkXM5O.esm.js.map +1 -0
- package/dist/decorator.d.ts +1 -1
- package/dist/decorator.esm.js +1 -1
- package/dist/decorator.js +1 -1
- package/dist/destroyable.esm.js +1 -1
- package/dist/destroyable.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/index.js +2 -1
- package/dist/index.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/reactive.d.ts +4 -3
- package/dist/reactive.esm.js +61 -57
- package/dist/reactive.esm.js.map +1 -1
- package/dist/reactive.js +61 -56
- package/dist/reactive.js.map +1 -1
- package/dist/std-decorators.esm.js +1 -1
- package/dist/std-decorators.js +1 -1
- package/docs/reactive.md +616 -0
- package/package.json +1 -2
- package/dist/chunks/decorator-BXsign4Z.js.map +0 -1
- package/dist/chunks/decorator-CPbZNnsX.esm.js.map +0 -1
- package/src/decorator.test.ts +0 -495
- package/src/decorator.ts +0 -205
- package/src/destroyable.test.ts +0 -155
- package/src/destroyable.ts +0 -158
- package/src/eventful.test.ts +0 -380
- package/src/eventful.ts +0 -69
- package/src/index.ts +0 -7
- package/src/indexable.test.ts +0 -388
- package/src/indexable.ts +0 -124
- package/src/promiseChain.test.ts +0 -201
- package/src/promiseChain.ts +0 -99
- package/src/reactive/array.test.ts +0 -923
- package/src/reactive/array.ts +0 -352
- package/src/reactive/core.test.ts +0 -1663
- package/src/reactive/core.ts +0 -866
- package/src/reactive/index.ts +0 -28
- package/src/reactive/interface.test.ts +0 -1477
- package/src/reactive/interface.ts +0 -231
- package/src/reactive/map.test.ts +0 -866
- package/src/reactive/map.ts +0 -162
- package/src/reactive/set.test.ts +0 -289
- package/src/reactive/set.ts +0 -142
- package/src/std-decorators.test.ts +0 -679
- package/src/std-decorators.ts +0 -182
- package/src/utils.ts +0 -52
package/dist/mutts.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutts.umd.js","sources":["../src/utils.ts","../src/decorator.ts","../src/destroyable.ts","../src/indexable.ts","../src/reactive/core.ts","../src/reactive/interface.ts","../src/reactive/array.ts","../src/reactive/map.ts","../src/reactive/set.ts","../src/reactive/index.ts","../src/std-decorators.ts","../src/eventful.ts"],"sourcesContent":["type ElementTypes<T extends readonly unknown[]> = {\n\t[K in keyof T]: T[K] extends readonly (infer U)[] ? U : T[K]\n}\n\nexport function zip<T extends (readonly unknown[])[]>(...args: T): ElementTypes<T>[] {\n\tif (!args.length) return []\n\tconst minLength = Math.min(...args.map((arr) => arr.length))\n\tconst result: ElementTypes<T>[] = []\n\n\tfor (let i = 0; i < minLength; i++) {\n\t\tconst tuple = args.map((arr) => arr[i]) as ElementTypes<T>\n\t\tresult.push(tuple)\n\t}\n\n\treturn result\n}\n\nconst nativeConstructors = new Set<Function>([\n\tObject,\n\tArray,\n\tDate,\n\tFunction,\n\tSet,\n\tMap,\n\tWeakMap,\n\tWeakSet,\n\tPromise,\n\tError,\n\tTypeError,\n\tReferenceError,\n\tSyntaxError,\n\tRangeError,\n\tURIError,\n\tEvalError,\n\tReflect,\n\tProxy,\n\tRegExp,\n\tString,\n\tNumber,\n\tBoolean,\n] as Function[])\nexport function isConstructor(fn: Function): boolean {\n\treturn fn && (nativeConstructors.has(fn) || fn.toString().startsWith('class '))\n}\n\nexport function renamed<F extends Function>(fct: F, name: string): F {\n\treturn Object.defineProperties(fct, {\n\t\tname: {\n\t\t\tvalue: name,\n\t\t},\n\t})\n}\n","// biome-ignore-all lint/suspicious/noConfusingVoidType: We *love* voids\n// Standardized decorator system that works with both Legacy and Modern decorators\n\nimport { isConstructor } from './utils'\n\nexport class DecoratorError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message)\n\t\tthis.name = 'DecoratorException'\n\t}\n}\n//#region all decorator types\n\n// Used for get/set and method decorators\nexport type LegacyPropertyDecorator<T> = (\n\ttarget: T,\n\tname: string | symbol,\n\tdescriptor: PropertyDescriptor\n) => any\n\nexport type LegacyClassDecorator<T> = (target: T) => any\n\nexport type ModernMethodDecorator<T> = (target: T, context: ClassMethodDecoratorContext) => any\n\nexport type ModernGetterDecorator<T> = (target: T, context: ClassGetterDecoratorContext) => any\n\nexport type ModernSetterDecorator<T> = (target: T, context: ClassSetterDecoratorContext) => any\n\nexport type ModernAccessorDecorator<T> = (target: T, context: ClassAccessorDecoratorContext) => any\n\nexport type ModernClassDecorator<T> = (target: T, context: ClassDecoratorContext) => any\n\n//#endregion\n\ntype DDMethod<T> = (\n\toriginal: (this: T, ...args: any[]) => any,\n\tname: PropertyKey\n) => ((this: T, ...args: any[]) => any) | void\n\ntype DDGetter<T> = (original: (this: T) => any, name: PropertyKey) => ((this: T) => any) | void\n\ntype DDSetter<T> = (\n\toriginal: (this: T, value: any) => void,\n\tname: PropertyKey\n) => ((this: T, value: any) => void) | void\n\ntype DDClass<T> = <Ctor extends new (...args: any[]) => T = new (...args: any[]) => T>(\n\ttarget: Ctor\n) => Ctor | void\nexport interface DecoratorDescription<T> {\n\tmethod?: DDMethod<T>\n\tclass?: DDClass<T>\n\tgetter?: DDGetter<T>\n\tsetter?: DDSetter<T>\n\tdefault?: (...args: any[]) => any\n}\n\nexport type Decorator<T, Description extends DecoratorDescription<T>> = (Description extends {\n\tmethod: DDMethod<T>\n}\n\t? LegacyPropertyDecorator<T> & ModernMethodDecorator<T>\n\t: unknown) &\n\t(Description extends { class: DDClass<new (...args: any[]) => T> }\n\t\t? LegacyClassDecorator<new (...args: any[]) => T> &\n\t\t\t\tModernClassDecorator<new (...args: any[]) => T>\n\t\t: unknown) &\n\t(Description extends { getter: DDGetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernGetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { setter: DDSetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernSetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { default: infer Signature } ? Signature : unknown)\n\nexport type DecoratorFactory<T> = <Description extends DecoratorDescription<T>>(\n\tdescription: Description\n) => (Description extends { method: DDMethod<T> }\n\t? LegacyPropertyDecorator<T> & ModernMethodDecorator<T>\n\t: unknown) &\n\t(Description extends { class: DDClass<new (...args: any[]) => T> }\n\t\t? LegacyClassDecorator<new (...args: any[]) => T> &\n\t\t\t\tModernClassDecorator<new (...args: any[]) => T>\n\t\t: unknown) &\n\t(Description extends { getter: DDGetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernGetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { setter: DDSetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernSetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { default: infer Signature } ? Signature : unknown)\n\nexport function legacyDecorator<T = any>(description: DecoratorDescription<T>): any {\n\treturn function (\n\t\ttarget: any,\n\t\tpropertyKey?: PropertyKey,\n\t\tdescriptor?: PropertyDescriptor,\n\t\t...args: any[]\n\t) {\n\t\tif (propertyKey === undefined) {\n\t\t\tif (isConstructor(target)) {\n\t\t\t\tif (!('class' in description)) throw new Error('Decorator cannot be applied to a class')\n\t\t\t\treturn description.class?.(target)\n\t\t\t}\n\t\t} else if (typeof target === 'object' && ['string', 'symbol'].includes(typeof propertyKey)) {\n\t\t\tif (!descriptor) throw new Error('Decorator cannot be applied to a field')\n\t\t\telse if (typeof descriptor === 'object' && 'configurable' in descriptor) {\n\t\t\t\tif ('get' in descriptor || 'set' in descriptor) {\n\t\t\t\t\tif (!('getter' in description || 'setter' in description))\n\t\t\t\t\t\tthrow new Error('Decorator cannot be applied to a getter or setter')\n\t\t\t\t\tif ('getter' in description) {\n\t\t\t\t\t\tconst newGetter = description.getter?.(descriptor.get, propertyKey)\n\t\t\t\t\t\tif (newGetter) descriptor.get = newGetter\n\t\t\t\t\t}\n\t\t\t\t\tif ('setter' in description) {\n\t\t\t\t\t\tconst newSetter = description.setter?.(descriptor.set, propertyKey)\n\t\t\t\t\t\tif (newSetter) descriptor.set = newSetter\n\t\t\t\t\t}\n\t\t\t\t\treturn descriptor\n\t\t\t\t} else if (typeof descriptor.value === 'function') {\n\t\t\t\t\tif (!('method' in description)) throw new Error('Decorator cannot be applied to a method')\n\t\t\t\t\tconst newMethod = description.method?.(descriptor.value, propertyKey)\n\t\t\t\t\tif (newMethod) descriptor.value = newMethod\n\t\t\t\t\treturn descriptor\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (!('default' in description))\n\t\t\tthrow new Error('Decorator do not have a default implementation')\n\t\treturn description.default.call(this, target, propertyKey, descriptor, ...args)\n\t}\n}\n\nexport function modernDecorator<T = any>(description: DecoratorDescription<T>): any {\n\treturn function (target: any, context?: DecoratorContext, ...args: any[]) {\n\t\tif (!context?.kind || typeof context.kind !== 'string') {\n\t\t\tif (!('default' in description))\n\t\t\t\tthrow new Error('Decorator do not have a default implementation')\n\t\t\treturn description.default.call(this, target, context, ...args)\n\t\t}\n\t\tswitch (context.kind) {\n\t\t\tcase 'class':\n\t\t\t\tif (!('class' in description)) throw new Error('Decorator cannot be applied to a class')\n\t\t\t\treturn description.class?.(target)\n\t\t\tcase 'field':\n\t\t\t\tthrow new Error('Decorator cannot be applied to a field')\n\t\t\tcase 'getter':\n\t\t\t\tif (!('getter' in description)) throw new Error('Decorator cannot be applied to a getter')\n\t\t\t\treturn description.getter?.(target, context.name)\n\t\t\tcase 'setter':\n\t\t\t\tif (!('setter' in description)) throw new Error('Decorator cannot be applied to a setter')\n\t\t\t\treturn description.setter?.(target, context.name)\n\t\t\tcase 'method':\n\t\t\t\tif (!('method' in description)) throw new Error('Decorator cannot be applied to a method')\n\t\t\t\treturn description.method?.(target, context.name)\n\t\t\tcase 'accessor': {\n\t\t\t\tif (!('getter' in description || 'setter' in description))\n\t\t\t\t\tthrow new Error('Decorator cannot be applied to a getter or setter')\n\t\t\t\tconst rv: Partial<ClassAccessorDecoratorResult<any, any>> = {}\n\t\t\t\tif ('getter' in description) {\n\t\t\t\t\tconst newGetter = description.getter?.(target.get, context.name)\n\t\t\t\t\tif (newGetter) rv.get = newGetter\n\t\t\t\t}\n\t\t\t\tif ('setter' in description) {\n\t\t\t\t\tconst newSetter = description.setter?.(target.set, context.name)\n\t\t\t\t\tif (newSetter) rv.set = newSetter\n\t\t\t\t}\n\t\t\t\treturn rv\n\t\t\t}\n\t\t\t//return description.accessor?.(target, context.name, target)\n\t\t}\n\t}\n}\n\n/**\n * Detects if the decorator is being called in modern (Modern) or legacy (Legacy) mode\n * based on the arguments passed to the decorator function\n */\nfunction detectDecoratorMode(\n\t_target: any,\n\tcontextOrKey?: any,\n\t_descriptor?: any\n): 'modern' | 'legacy' {\n\t// Modern decorators have a context object as the second parameter\n\t// Legacy decorators have a string/symbol key as the second parameter\n\tif (\n\t\ttypeof contextOrKey === 'object' &&\n\t\tcontextOrKey !== null &&\n\t\ttypeof contextOrKey.kind === 'string'\n\t) {\n\t\treturn 'modern'\n\t}\n\treturn 'legacy'\n}\n\nexport const decorator: DecoratorFactory<any> = (description: DecoratorDescription<any>) => {\n\treturn ((target: any, contextOrKey?: any, ...args: any[]) => {\n\t\tconst mode = detectDecoratorMode(target, contextOrKey, args[0])\n\t\treturn mode === 'modern'\n\t\t\t? modernDecorator(description)(target, contextOrKey, ...args)\n\t\t\t: legacyDecorator(description)(target, contextOrKey, ...args)\n\t}) as any\n}\n\nexport type GenericClassDecorator<T> = LegacyClassDecorator<new (...args: any[]) => T> &\n\tModernClassDecorator<new (...args: any[]) => T>\n","import { decorator } from './decorator'\n\n// Integrated with `using` statement via Symbol.dispose\nconst fr = new FinalizationRegistry<() => void>((f) => f())\nexport const destructor = Symbol('destructor')\nexport const allocatedValues = Symbol('allocated')\nexport class DestructionError extends Error {\n\tstatic throw<_T = void>(msg: string) {\n\t\treturn () => {\n\t\t\tthrow new DestructionError(msg)\n\t\t}\n\t}\n\tconstructor(msg: string) {\n\t\tsuper(`Object is destroyed. ${msg}`)\n\t\tthis.name = 'DestroyedAccessError'\n\t}\n}\nconst destroyedHandler = {\n\t[Symbol.toStringTag]: 'MutTs Destroyable',\n\tget: DestructionError.throw('Cannot access destroyed object'),\n\tset: DestructionError.throw('Cannot access destroyed object'),\n} as const\n\nabstract class AbstractDestroyable<Allocated> {\n\tabstract [destructor](allocated: Allocated): void\n\t[Symbol.dispose](): void {\n\t\tthis[destructor](this as unknown as Allocated)\n\t}\n}\n\ninterface Destructor<Allocated> {\n\tdestructor(allocated: Allocated): void\n}\n\nexport function Destroyable<\n\tT extends new (\n\t\t...args: any[]\n\t) => any,\n\tAllocated extends Partial<typeof this>,\n>(\n\tbase: T,\n\tdestructorObj: Destructor<Allocated>\n): (new (\n\t...args: ConstructorParameters<T>\n) => InstanceType<T> & { [allocatedValues]: Allocated }) & {\n\tdestroy(obj: InstanceType<T>): boolean\n\tisDestroyable(obj: InstanceType<T>): boolean\n}\n\nexport function Destroyable<Allocated extends Record<PropertyKey, any> = Record<PropertyKey, any>>(\n\tdestructorObj: Destructor<Allocated>\n): (new () => { [allocatedValues]: Allocated }) & {\n\tdestroy(obj: any): boolean\n\tisDestroyable(obj: any): boolean\n}\n\nexport function Destroyable<\n\tT extends new (\n\t\t...args: any[]\n\t) => any,\n\tAllocated extends Record<PropertyKey, any> = Record<PropertyKey, any>,\n>(\n\tbase: T\n): (new (\n\t...args: ConstructorParameters<T>\n) => AbstractDestroyable<Allocated> & InstanceType<T> & { [allocatedValues]: Allocated }) & {\n\tdestroy(obj: InstanceType<T>): boolean\n\tisDestroyable(obj: InstanceType<T>): boolean\n}\n\nexport function Destroyable<\n\tAllocated extends Record<PropertyKey, any> = Record<PropertyKey, any>,\n>(): abstract new () => (AbstractDestroyable<Allocated> & {\n\t[allocatedValues]: Allocated\n}) & {\n\tdestroy(obj: any): boolean\n\tisDestroyable(obj: any): boolean\n}\n\nexport function Destroyable<\n\tT extends new (\n\t\t...args: any[]\n\t) => any,\n\tAllocated extends Record<PropertyKey, any> = Record<PropertyKey, any>,\n>(base?: T | Destructor<Allocated>, destructorObj?: Destructor<Allocated>) {\n\tif (base && typeof base !== 'function') {\n\t\tdestructorObj = base as Destructor<Allocated>\n\t\tbase = undefined\n\t}\n\tif (!base) {\n\t\tbase = class {} as T\n\t}\n\n\treturn class Destroyable extends (base as T) {\n\t\tstatic readonly destructors = new WeakMap<any, () => void>()\n\t\tstatic destroy(obj: Destroyable) {\n\t\t\tconst destructor = Destroyable.destructors.get(obj)\n\t\t\tif (!destructor) return false\n\t\t\tfr.unregister(obj)\n\t\t\tDestroyable.destructors.delete(obj)\n\t\t\tObject.setPrototypeOf(obj, new Proxy({}, destroyedHandler))\n\t\t\t// Clear all own properties\n\t\t\tfor (const key of Object.getOwnPropertyNames(obj)) {\n\t\t\t\tdelete (obj as any)[key]\n\t\t\t}\n\t\t\tdestructor()\n\t\t\treturn true\n\t\t}\n\t\tstatic isDestroyable(obj: Destroyable) {\n\t\t\treturn Destroyable.destructors.has(obj)\n\t\t}\n\n\t\tdeclare [forwardProperties]: PropertyKey[]\n\t\treadonly [allocatedValues]: Allocated\n\t\tconstructor(...args: any[]) {\n\t\t\tsuper(...args)\n\t\t\tconst allocated = {} as Allocated\n\t\t\tthis[allocatedValues] = allocated\n\t\t\t// @ts-expect-error `this` is an AbstractDestroyable\n\t\t\tconst myDestructor = destructorObj?.destructor ?? this[destructor]\n\t\t\tif (!myDestructor) {\n\t\t\t\tthrow new DestructionError('Destructor is not defined')\n\t\t\t}\n\t\t\tfunction destruction() {\n\t\t\t\tmyDestructor(allocated)\n\t\t\t}\n\t\t\tDestroyable.destructors.set(this, destruction)\n\t\t\tfr.register(this, destruction, this)\n\t\t}\n\t}\n}\n\nconst forwardProperties = Symbol('forwardProperties')\nexport const allocated = decorator({\n\tsetter(original, propertyKey) {\n\t\treturn function (value) {\n\t\t\tthis[allocatedValues][propertyKey] = value\n\t\t\treturn original.call(this, value)\n\t\t}\n\t},\n})\n\nexport function callOnGC(cb: () => void) {\n\tlet called = false\n\tconst forward = () => {\n\t\tif (called) return\n\t\tcalled = true\n\t\tcb()\n\t}\n\tfr.register(forward, cb, cb)\n\treturn forward\n}\n\n// Context Manager Protocol for `with` statement integration\nexport interface ContextManager<T = any> {\n\t[Symbol.dispose](): void\n\tvalue?: T\n}\n","export const getAt = Symbol('getAt')\nexport const setAt = Symbol('setAt')\n\ninterface IndexingAt<Items = any> {\n\t[getAt](index: number): Items\n}\n\ninterface Accessor<T, Items> {\n\tget(this: T, index: number): Items\n\tset?(this: T, index: number, value: Items): void\n\tgetLength?(this: T): number\n\tsetLength?(this: T, value: number): void\n}\n\nabstract class AbstractGetAt<Items = any> {\n\tabstract [getAt](index: number): Items\n}\n\nexport function Indexable<Items, Base extends abstract new (...args: any[]) => any>(\n\tbase: Base,\n\taccessor: Accessor<InstanceType<Base>, Items>\n): new (\n\t...args: ConstructorParameters<Base>\n) => InstanceType<Base> & { [x: number]: Items }\n\nexport function Indexable<Items>(accessor: Accessor<any, Items>): new () => { [x: number]: Items }\n\nexport function Indexable<Base extends new (...args: any[]) => IndexingAt>(\n\tbase: Base\n): new (\n\t...args: ConstructorParameters<Base>\n) => InstanceType<Base> & { [x: number]: AtReturnType<InstanceType<Base>> }\n\nexport function Indexable<Items>(): abstract new (\n\t...args: any[]\n) => AbstractGetAt & { [x: number]: Items }\n\nexport function Indexable<Items, Base extends abstract new (...args: any[]) => any>(\n\tbase?: Base | Accessor<Base, Items>,\n\taccessor?: Accessor<Base, Items>\n) {\n\tif (base && typeof base !== 'function') {\n\t\taccessor = base as Accessor<Base, Items>\n\t\tbase = undefined\n\t}\n\tif (!base) {\n\t\t//@ts-expect-error\n\t\tbase = class {} as Base\n\t}\n\tif (!accessor) {\n\t\taccessor = {\n\t\t\tget(this: any, index: number) {\n\t\t\t\tif (typeof this[getAt] !== 'function') {\n\t\t\t\t\tthrow new Error('Indexable class must have an [getAt] method')\n\t\t\t\t}\n\t\t\t\treturn this[getAt](index)\n\t\t\t},\n\t\t\tset(this: any, index: number, value: Items) {\n\t\t\t\tif (typeof this[setAt] !== 'function') {\n\t\t\t\t\tthrow new Error('Indexable class has read-only numeric index access')\n\t\t\t\t}\n\t\t\t\tthis[setAt](index, value)\n\t\t\t},\n\t\t}\n\t}\n\n\tabstract class Indexable extends (base as Base) {\n\t\t[x: number]: Items\n\t}\n\n\tObject.setPrototypeOf(\n\t\tIndexable.prototype,\n\t\tnew Proxy((base as Base).prototype, {\n\t\t\t//@ts-expect-error\n\t\t\t[Symbol.toStringTag]: 'MutTs Indexable',\n\t\t\tget(target, prop, receiver) {\n\t\t\t\tif (prop in target) {\n\t\t\t\t\tconst getter = Object.getOwnPropertyDescriptor(target, prop)?.get\n\t\t\t\t\treturn getter ? getter.call(receiver) : target[prop]\n\t\t\t\t}\n\t\t\t\tif (typeof prop === 'string') {\n\t\t\t\t\tif (prop === 'length' && accessor.getLength) return accessor.getLength.call(receiver)\n\t\t\t\t\tconst numProp = Number(prop)\n\t\t\t\t\tif (!Number.isNaN(numProp)) {\n\t\t\t\t\t\treturn accessor.get!.call(receiver, numProp) as Items\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn undefined\n\t\t\t},\n\t\t\tset(target, prop, value, receiver) {\n\t\t\t\tif (prop in target) {\n\t\t\t\t\tconst setter = Object.getOwnPropertyDescriptor(target, prop)?.set\n\t\t\t\t\tif (setter) setter.call(receiver, value)\n\t\t\t\t\telse target[prop] = value\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t\tif (typeof prop === 'string') {\n\t\t\t\t\tif (prop === 'length' && accessor.setLength) {\n\t\t\t\t\t\taccessor.setLength.call(receiver, value)\n\t\t\t\t\t\treturn true\n\t\t\t\t\t}\n\t\t\t\t\tconst numProp = Number(prop)\n\t\t\t\t\tif (!Number.isNaN(numProp)) {\n\t\t\t\t\t\tif (!accessor.set) {\n\t\t\t\t\t\t\tthrow new Error('Indexable class has read-only numeric index access')\n\t\t\t\t\t\t}\n\t\t\t\t\t\taccessor.set!.call(receiver, numProp, value)\n\t\t\t\t\t\treturn true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tObject.defineProperty(receiver, prop, {\n\t\t\t\t\tvalue,\n\t\t\t\t\twritable: true,\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t})\n\t\t\t\treturn true\n\t\t\t},\n\t\t})\n\t)\n\treturn Indexable\n}\n\ntype AtReturnType<T> = T extends { [getAt](index: number): infer R } ? R : never\n","// biome-ignore-all lint/suspicious/noConfusingVoidType: Type 'void' is not assignable to type 'ScopedCallback | undefined'.\n// Argument of type '() => void' is not assignable to parameter of type '(dep: DependencyFunction) => ScopedCallback | undefined'.\n\nimport { decorator } from '../decorator'\n\nexport type DependencyFunction = <T>(cb: () => T) => T\n// TODO: proper async management, read when fn returns a promise and let the effect as \"running\",\n// either to cancel the running one or to avoid running 2 in \"parallel\" and debounce the second one\n\n// TODO: generic \"batch\" forcing even if not in an effect (perhaps when calling a reactive' function ?)\n// example: storage will make 2 modifications (add slot, modify count), they could raise 2 effects\nexport type ScopedCallback = () => void\n\nexport type PropEvolution = {\n\ttype: 'set' | 'del' | 'add'\n\tprop: any\n}\n\nexport type BunchEvolution = {\n\ttype: 'bunch'\n\tmethod: string\n}\ntype Evolution = PropEvolution | BunchEvolution\n\ntype State =\n\t| {\n\t\t\tevolution: Evolution\n\t\t\tnext: State\n\t }\n\t| {}\n// Track which effects are watching which reactive objects for cleanup\nconst effectToReactiveObjects = new WeakMap<ScopedCallback, Set<object>>()\n\n// Track object -> proxy and proxy -> object relationships\nconst objectToProxy = new WeakMap<object, object>()\nconst proxyToObject = new WeakMap<object, object>()\n// Deep watching data structures\n// Track which objects contain which other objects (back-references)\nconst objectParents = new WeakMap<object, Set<{ parent: object; prop: PropertyKey }>>()\n\n// Track which objects have deep watchers\nconst objectsWithDeepWatchers = new WeakSet<object>()\n\n// Track deep watchers per object\nconst deepWatchers = new WeakMap<object, Set<ScopedCallback>>()\n\n// Track which effects are doing deep watching\nconst effectToDeepWatchedObjects = new WeakMap<ScopedCallback, Set<object>>()\n\n// Track objects that should never be reactive and cannot be modified\nexport const nonReactiveObjects = new WeakSet<object>()\n\n/**\n * Converts an iterator to a generator that yields reactive values\n */\nexport function* makeReactiveIterator<T>(iterator: Iterator<T>): Generator<T> {\n\tlet result = iterator.next()\n\twhile (!result.done) {\n\t\tyield reactive(result.value)\n\t\tresult = iterator.next()\n\t}\n}\n\n/**\n * Converts an iterator of key-value pairs to a generator that yields reactive key-value pairs\n */\nexport function* makeReactiveEntriesIterator<K, V>(iterator: Iterator<[K, V]>): Generator<[K, V]> {\n\tlet result = iterator.next()\n\twhile (!result.done) {\n\t\tconst [key, value] = result.value\n\t\tyield [reactive(key), reactive(value)]\n\t\tresult = iterator.next()\n\t}\n}\n\n// Track effects per reactive object and property\nconst watchers = new WeakMap<object, Map<any, Set<ScopedCallback>>>()\n\nexport const profileInfo: any = {\n\tobjectToProxy,\n\tproxyToObject,\n\teffectToReactiveObjects,\n\twatchers,\n\tobjectParents,\n\tobjectsWithDeepWatchers,\n\tdeepWatchers,\n\teffectToDeepWatchedObjects,\n\tnonReactiveObjects,\n}\n// Track native reactivity\nconst nativeReactive = Symbol('native-reactive')\n\n// Symbol to mark individual objects as non-reactive\nexport const nonReactiveMark = Symbol('non-reactive')\n// Symbol to mark class properties as non-reactive\nexport const unreactiveProperties = Symbol('unreactive-properties')\nexport const prototypeForwarding: unique symbol = Symbol('prototype-forwarding')\n\nexport const allProps = Symbol('all-props')\n\n// Symbol to mark functions with their root function\nconst rootFunction = Symbol('root-function')\n\n/**\n * Mark a function with its root function. If the function already has a root,\n * the root becomes the root of the new root (transitive root tracking).\n * @param fn - The function to mark\n * @param root - The root function to associate with fn\n */\nexport function markWithRoot<T extends Function>(fn: T, root: Function): T {\n\t// Mark fn with the new root\n\treturn Object.defineProperty(fn, rootFunction, {\n\t\tvalue: getRoot(root),\n\t\twritable: false,\n\t})\n}\n\n/**\n * Retrieve the root function from a callback. Returns the function itself if it has no root.\n * @param fn - The function to get the root from\n * @returns The root function, or the function itself if no root exists\n */\nexport function getRoot<T extends Function | undefined>(fn: T): T {\n\treturn (fn as any)?.[rootFunction] || fn\n}\n\nexport class ReactiveError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message)\n\t\tthis.name = 'ReactiveError'\n\t}\n}\n\n// biome-ignore-start lint/correctness/noUnusedFunctionParameters: Interface declaration with empty defaults\n/**\n * Options for the reactive system, can be configured at runtime\n */\nexport const options = {\n\t/**\n\t * Debug purpose: called when an effect is entered\n\t * @param effect - The effect that is entered\n\t */\n\tenter: (effect: Function) => {},\n\t/**\n\t * Debug purpose: called when an effect is left\n\t * @param effect - The effect that is left\n\t */\n\tleave: (effect: Function) => {},\n\t/**\n\t * Debug purpose: called when an effect is chained\n\t * @param target - The effect that is being triggered\n\t * @param caller - The effect that is calling the target\n\t */\n\tchain: (target: Function, caller?: Function) => {},\n\t/**\n\t * Debug purpose: maximum effect chain (like call stack max depth)\n\t * Used to prevent infinite loops\n\t * @default 100\n\t */\n\tmaxEffectChain: 100,\n\t/**\n\t * Maximum depth for deep watching traversal\n\t * Used to prevent infinite recursion in circular references\n\t * @default 100\n\t */\n\tmaxDeepWatchDepth: 100,\n\t/**\n\t * Only react on instance members modification (not inherited properties)\n\t * For instance, do not track class methods\n\t * @default true\n\t */\n\tinstanceMembers: true,\n\t// biome-ignore lint/suspicious/noConsole: This is the whole point here\n\twarn: (...args: any[]) => console.warn(...args),\n}\n// biome-ignore-end lint/correctness/noUnusedFunctionParameters: Interface declaration with empty defaults\n\n//#region evolution\n\nfunction raiseDeps(objectWatchers: Map<any, Set<ScopedCallback>>, ...keyChains: Iterable<any>[]) {\n\tfor (const keys of keyChains)\n\t\tfor (const key of keys) {\n\t\t\tconst deps = objectWatchers.get(key)\n\t\t\tif (deps) for (const effect of Array.from(deps)) hasEffect(effect)\n\t\t}\n}\n\nexport function touched1(obj: any, evolution: Evolution, prop: any) {\n\ttouched(obj, evolution, [prop])\n}\n\nexport function touched(obj: any, evolution: Evolution, props?: Iterable<any>) {\n\tobj = unwrap(obj)\n\taddState(obj, evolution)\n\tconst objectWatchers = watchers.get(obj)\n\tif (objectWatchers) {\n\t\tif (props) raiseDeps(objectWatchers, [allProps], props)\n\t\telse raiseDeps(objectWatchers, objectWatchers.keys())\n\t}\n\n\t// Bubble up changes if this object has deep watchers\n\tif (objectsWithDeepWatchers.has(obj)) {\n\t\tbubbleUpChange(obj, evolution)\n\t}\n}\n\nconst states = new WeakMap<object, State>()\n\nfunction addState(obj: any, evolution: Evolution) {\n\tobj = unwrap(obj)\n\tconst next = {}\n\tconst state = getState(obj)\n\tif (state) Object.assign(state, { evolution, next })\n\tstates.set(obj, next)\n}\n\nexport function getState(obj: any) {\n\tobj = unwrap(obj)\n\tlet state = states.get(obj)\n\tif (!state) {\n\t\tstate = {}\n\t\tstates.set(obj, state)\n\t}\n\treturn state\n}\n\nexport function dependant(obj: any, prop: any = allProps) {\n\t// TODO: avoid depending on property get?\n\tobj = unwrap(obj)\n\tif (activeEffect && (typeof prop !== 'symbol' || prop === allProps)) {\n\t\tlet objectWatchers = watchers.get(obj)\n\t\tif (!objectWatchers) {\n\t\t\tobjectWatchers = new Map<PropertyKey, Set<ScopedCallback>>()\n\t\t\twatchers.set(obj, objectWatchers)\n\t\t}\n\t\tlet deps = objectWatchers.get(prop)\n\t\tif (!deps) {\n\t\t\tdeps = new Set<ScopedCallback>()\n\t\t\tobjectWatchers.set(prop, deps)\n\t\t}\n\t\tdeps.add(activeEffect)\n\n\t\t// Track which reactive objects this effect is watching\n\t\tlet effectObjects = effectToReactiveObjects.get(activeEffect)\n\t\tif (!effectObjects) {\n\t\t\teffectObjects = new Set<object>()\n\t\t\teffectToReactiveObjects.set(activeEffect, effectObjects)\n\t\t}\n\t\teffectObjects.add(obj)\n\t}\n}\n\n// Stack of active effects to handle nested effects\nlet activeEffect: ScopedCallback | undefined\n// Parent effect used for lifecycle/cleanup relationships (can diverge later)\nlet parentEffect: ScopedCallback | undefined\n\n// Track currently executing effects to prevent re-execution\n// These are all the effects triggered under `activeEffect`\nlet batchedEffects: Map<Function, ScopedCallback> | undefined\n\n// Track which sub-effects have been executed to prevent infinite loops\n// These are all the effects triggered under `activeEffect` and all their sub-effects\nfunction hasEffect(effect: ScopedCallback) {\n\tconst root = getRoot(effect)\n\n\toptions?.chain(getRoot(effect), getRoot(activeEffect))\n\tif (batchedEffects) batchedEffects.set(root, effect)\n\telse {\n\t\tconst runEffects: any[] = []\n\t\tbatchedEffects = new Map<Function, ScopedCallback>([[root, effect]])\n\t\ttry {\n\t\t\twhile (batchedEffects.size) {\n\t\t\t\tif (runEffects.length > options.maxEffectChain)\n\t\t\t\t\tthrow new ReactiveError('[reactive] Max effect chain reached')\n\t\t\t\tconst [root, effect] = batchedEffects.entries().next().value!\n\t\t\t\trunEffects.push(root)\n\t\t\t\teffect()\n\t\t\t\tbatchedEffects.delete(root)\n\t\t\t}\n\t\t} finally {\n\t\t\tbatchedEffects = undefined\n\t\t}\n\t}\n}\n\nexport function withEffect<T>(\n\teffect: ScopedCallback | undefined,\n\tfn: () => T,\n\tkeepParent?: true\n): T {\n\tif (getRoot(effect) === getRoot(activeEffect)) return fn()\n\tconst oldActiveEffect = activeEffect\n\tconst oldParentEffect = parentEffect\n\tactiveEffect = effect\n\tif (!keepParent) parentEffect = effect\n\ttry {\n\t\treturn fn()\n\t} finally {\n\t\tactiveEffect = oldActiveEffect\n\t\tparentEffect = oldParentEffect\n\t}\n}\n\n//#endregion\n\n//#region deep watching\n\n/**\n * Add a back-reference from child to parent\n */\nfunction addBackReference(child: object, parent: object, prop: any) {\n\tlet parents = objectParents.get(child)\n\tif (!parents) {\n\t\tparents = new Set()\n\t\tobjectParents.set(child, parents)\n\t}\n\tparents.add({ parent, prop })\n}\n\n/**\n * Remove a back-reference from child to parent\n */\nfunction removeBackReference(child: object, parent: object, prop: any) {\n\tconst parents = objectParents.get(child)\n\tif (parents) {\n\t\tparents.delete({ parent, prop })\n\t\tif (parents.size === 0) {\n\t\t\tobjectParents.delete(child)\n\t\t}\n\t}\n}\n\n/**\n * Check if an object needs back-references (has deep watchers or parents with deep watchers)\n */\nfunction needsBackReferences(obj: object): boolean {\n\treturn objectsWithDeepWatchers.has(obj) || hasParentWithDeepWatchers(obj)\n}\n\n/**\n * Check if an object has any parent with deep watchers\n */\nfunction hasParentWithDeepWatchers(obj: object): boolean {\n\tconst parents = objectParents.get(obj)\n\tif (!parents) return false\n\n\tfor (const { parent } of parents) {\n\t\tif (objectsWithDeepWatchers.has(parent)) return true\n\t\tif (hasParentWithDeepWatchers(parent)) return true\n\t}\n\treturn false\n}\n\n/**\n * Bubble up changes through the back-reference chain\n */\nfunction bubbleUpChange(changedObject: object, evolution: Evolution) {\n\tconst parents = objectParents.get(changedObject)\n\tif (!parents) return\n\n\tfor (const { parent } of parents) {\n\t\t// Trigger deep watchers on parent\n\t\tconst parentDeepWatchers = deepWatchers.get(parent)\n\t\tif (parentDeepWatchers) for (const watcher of parentDeepWatchers) hasEffect(watcher)\n\n\t\t// Continue bubbling up\n\t\tbubbleUpChange(parent, evolution)\n\t}\n}\n\nexport function track1(obj: object, prop: any, oldVal: any, newValue: any) {\n\t// Manage back-references if this object has deep watchers\n\tif (objectsWithDeepWatchers.has(obj)) {\n\t\t// Remove old back-references\n\t\tif (typeof oldVal === 'object' && oldVal !== null) {\n\t\t\tremoveBackReference(oldVal, obj, prop)\n\t\t}\n\n\t\t// Add new back-references\n\t\tif (typeof newValue === 'object' && newValue !== null) {\n\t\t\tconst reactiveValue = reactive(newValue)\n\t\t\taddBackReference(reactiveValue, obj, prop)\n\t\t}\n\t}\n\treturn newValue\n}\n\n//#endregion\n\nconst reactiveHandlers = {\n\t[Symbol.toStringTag]: 'MutTs Reactive',\n\tget(obj: any, prop: PropertyKey, receiver: any) {\n\t\tif (prop === nonReactiveMark) return false\n\t\t// Check if this property is marked as unreactive\n\t\tif (obj[unreactiveProperties]?.has(prop) || typeof prop === 'symbol')\n\t\t\treturn Reflect.get(obj, prop, receiver)\n\t\tconst absent = !(prop in obj)\n\t\t// Depend if...\n\t\tif (!options.instanceMembers || Object.hasOwn(receiver, prop) || absent) dependant(obj, prop)\n\n\t\tconst value = Reflect.get(obj, prop, receiver)\n\t\tif (typeof value === 'object' && value !== null) {\n\t\t\tconst reactiveValue = reactive(value)\n\n\t\t\t// Only create back-references if this object needs them\n\t\t\tif (needsBackReferences(obj)) {\n\t\t\t\taddBackReference(reactiveValue, obj, prop)\n\t\t\t}\n\n\t\t\treturn reactiveValue\n\t\t}\n\t\treturn value\n\t},\n\tset(obj: any, prop: PropertyKey, value: any, receiver: any): boolean {\n\t\t// Check if this property is marked as unreactive\n\t\tif (obj[unreactiveProperties]?.has(prop)) return Reflect.set(obj, prop, value, receiver)\n\t\t// Really specific case for when Array is forwarder, in order to let it manage the reactivity\n\t\tconst isArrayCase =\n\t\t\tprototypeForwarding in obj &&\n\t\t\t// biome-ignore lint/suspicious/useIsArray: This is the whole point here\n\t\t\tobj[prototypeForwarding] instanceof Array &&\n\t\t\t(!Number.isNaN(Number(prop)) || prop === 'length')\n\t\tconst newValue = unwrap(value)\n\n\t\tif (isArrayCase) {\n\t\t\t;(obj as any)[prop] = newValue\n\t\t\treturn true\n\t\t}\n\n\t\tconst oldVal = (obj as any)[prop]\n\t\tconst oldPresent = prop in obj\n\t\ttrack1(obj, prop, oldVal, newValue)\n\n\t\tif (oldVal !== newValue) {\n\t\t\tReflect.set(obj, prop, newValue, receiver)\n\t\t\t// try to find a \"generic\" way to express that\n\t\t\ttouched1(obj, { type: oldPresent ? 'set' : 'add', prop }, prop)\n\t\t}\n\t\treturn true\n\t},\n\tdeleteProperty(obj: any, prop: PropertyKey): boolean {\n\t\tif (!Object.hasOwn(obj, prop)) return false\n\n\t\tconst oldVal = (obj as any)[prop]\n\n\t\t// Remove back-references if this object has deep watchers\n\t\tif (objectsWithDeepWatchers.has(obj) && typeof oldVal === 'object' && oldVal !== null) {\n\t\t\tremoveBackReference(oldVal, obj, prop)\n\t\t}\n\n\t\tdelete (obj as any)[prop]\n\t\ttouched1(obj, { type: 'del', prop }, prop)\n\n\t\t// Bubble up changes if this object has deep watchers\n\t\tif (objectsWithDeepWatchers.has(obj)) {\n\t\t\tbubbleUpChange(obj, { type: 'del', prop })\n\t\t}\n\n\t\treturn true\n\t},\n\tgetPrototypeOf(obj: any): object | null {\n\t\tif (prototypeForwarding in obj) return obj[prototypeForwarding]\n\t\treturn Object.getPrototypeOf(obj)\n\t},\n\tsetPrototypeOf(obj: any, proto: object | null): boolean {\n\t\tif (prototypeForwarding in obj) return false\n\t\tObject.setPrototypeOf(obj, proto)\n\t\treturn true\n\t},\n\townKeys(obj: any): (string | symbol)[] {\n\t\tdependant(obj, allProps)\n\t\treturn Reflect.ownKeys(obj)\n\t},\n} as const\n\nconst reactiveClasses = new WeakSet<Function>()\nexport class ReactiveBase {\n\tconstructor() {\n\t\t// biome-ignore lint/correctness/noConstructorReturn: This is the whole point here\n\t\treturn reactiveClasses.has(new.target) ? reactive(this) : this\n\t}\n}\n\nfunction reactiveObject<T>(anyTarget: T): T {\n\tif (!anyTarget || typeof anyTarget !== 'object') return anyTarget\n\tconst target = anyTarget as any\n\t// If target is already a proxy, return it\n\tif (proxyToObject.has(target) || isNonReactive(target)) return target as T\n\n\t// If we already have a proxy for this object, return it\n\tif (objectToProxy.has(target)) return objectToProxy.get(target) as T\n\n\tconst proxied =\n\t\tnativeReactive in target && !(target instanceof target[nativeReactive])\n\t\t\t? new target[nativeReactive](target)\n\t\t\t: target\n\tif (proxied !== target) proxyToObject.set(proxied, target)\n\tconst proxy = new Proxy(proxied, reactiveHandlers)\n\n\t// Store the relationships\n\tobjectToProxy.set(target, proxy)\n\tproxyToObject.set(proxy, target)\n\treturn proxy as T\n}\n\nexport const reactive = decorator({\n\tclass(original) {\n\t\tif (original.prototype instanceof ReactiveBase) {\n\t\t\treactiveClasses.add(original)\n\t\t\treturn original\n\t\t}\n\t\tclass Reactive extends original {\n\t\t\tconstructor(...args: any[]) {\n\t\t\t\tsuper(...args)\n\t\t\t\tif (new.target !== Reactive && !reactiveClasses.has(new.target))\n\t\t\t\t\toptions.warn(\n\t\t\t\t\t\t`${(original as any).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.`\n\t\t\t\t\t)\n\t\t\t\t// biome-ignore lint/correctness/noConstructorReturn: This is the whole point here\n\t\t\t\treturn reactive(this)\n\t\t\t}\n\t\t}\n\t\tObject.defineProperty(Reactive, 'name', {\n\t\t\tvalue: `Reactive<${original.name}>`,\n\t\t})\n\t\treturn Reactive as any\n\t},\n\tget(original) {\n\t\treturn reactiveObject(original)\n\t},\n\tdefault: reactiveObject,\n})\n\nexport function unwrap<T>(proxy: T): T {\n\t// Return the original object\n\treturn (proxyToObject.get(proxy as any) as T) ?? proxy\n}\n\nexport function isReactive(obj: any): boolean {\n\treturn proxyToObject.has(obj)\n}\nexport function untracked(fn: () => ScopedCallback | undefined | void) {\n\twithEffect(undefined, fn, true)\n}\n\n// runEffect -> set<cleanup>\nconst effectChildren = new WeakMap<ScopedCallback, Set<ScopedCallback>>()\nconst fr = new FinalizationRegistry<() => void>((f) => f())\n\n/**\n * @param fn - The effect function to run - provides the cleaner\n * @returns The cleanup function\n */\nexport function effect<Args extends any[]>(\n\tfn: (dep: DependencyFunction, ...args: Args) => ScopedCallback | undefined | void,\n\t...args: Args\n): ScopedCallback {\n\tlet cleanup: (() => void) | null = null\n\tconst dep = markWithRoot(<T>(cb: () => T) => withEffect(runEffect, cb), fn)\n\tlet effectStopped = false\n\n\tfunction runEffect() {\n\t\t// Clear previous dependencies\n\t\tcleanup?.()\n\n\t\toptions.enter(fn)\n\t\tconst reactionCleanup = withEffect(effectStopped ? undefined : runEffect, () =>\n\t\t\tfn(dep, ...args)\n\t\t) as undefined | ScopedCallback\n\t\toptions.leave(fn)\n\n\t\t// Create cleanup function for next run\n\t\tcleanup = () => {\n\t\t\tcleanup = null\n\t\t\treactionCleanup?.()\n\t\t\t// Remove this effect from all reactive objects it's watching\n\t\t\tconst effectObjects = effectToReactiveObjects.get(runEffect)\n\t\t\tif (effectObjects) {\n\t\t\t\tfor (const reactiveObj of effectObjects) {\n\t\t\t\t\tconst objectWatchers = watchers.get(reactiveObj)\n\t\t\t\t\tif (objectWatchers) {\n\t\t\t\t\t\tfor (const [prop, deps] of objectWatchers.entries()) {\n\t\t\t\t\t\t\tdeps.delete(runEffect)\n\t\t\t\t\t\t\tif (deps.size === 0) {\n\t\t\t\t\t\t\t\tobjectWatchers.delete(prop)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (objectWatchers.size === 0) {\n\t\t\t\t\t\t\twatchers.delete(reactiveObj)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\teffectToReactiveObjects.delete(runEffect)\n\t\t\t}\n\t\t}\n\t}\n\t// Mark the runEffect callback with the original function as its root\n\tmarkWithRoot(runEffect, fn)\n\n\t// Run the effect immediately\n\tif (!batchedEffects) {\n\t\thasEffect(runEffect)\n\t} else {\n\t\tconst oldBatchedEffects = batchedEffects\n\t\ttry {\n\t\t\t// Simulate a hasEffect who batches, but do not execute the batch, give it back to the parent batch,\n\t\t\t// Only the immediate effect has to be executed, the sub-effects will be executed by the parent batch\n\t\t\tbatchedEffects = new Map([[fn, runEffect]])\n\t\t\trunEffect()\n\t\t\tbatchedEffects.delete(fn)\n\t\t\tfor (const [root, effect] of batchedEffects!) oldBatchedEffects.set(root, effect)\n\t\t} finally {\n\t\t\tbatchedEffects = oldBatchedEffects\n\t\t}\n\t}\n\n\tconst mainCleanup = (): void => {\n\t\tif (effectStopped) return\n\t\teffectStopped = true\n\t\tcleanup?.()\n\t\t// Invoke all child cleanups (recursive via subEffectCleanup calling its own mainCleanup)\n\t\tconst children = effectChildren.get(runEffect)\n\t\tif (children) {\n\t\t\tfor (const childCleanup of children) childCleanup()\n\t\t\teffectChildren.delete(runEffect)\n\t\t}\n\n\t\tfr.unregister(mainCleanup)\n\t}\n\n\t// Only ROOT effects are registered for GC cleanup\n\tif (!parentEffect) {\n\t\tconst callIfCollected = () => mainCleanup()\n\t\tfr.register(callIfCollected, mainCleanup, callIfCollected)\n\t\treturn callIfCollected\n\t}\n\t// TODO: parentEffect = last non-undefined activeEffect\n\t// Register this effect to be cleaned up with the parent effect\n\tlet children = effectChildren.get(parentEffect)\n\tif (!children) {\n\t\tchildren = new Set()\n\t\teffectChildren.set(parentEffect, children)\n\t}\n\tconst parent = parentEffect\n\tconst subEffectCleanup = (): void => {\n\t\tchildren.delete(subEffectCleanup)\n\t\tif (children.size === 0) {\n\t\t\teffectChildren.delete(parent)\n\t\t}\n\t\t// Execute this child effect cleanup (which triggers its own mainCleanup)\n\t\tmainCleanup()\n\t}\n\tchildren.add(subEffectCleanup)\n\treturn subEffectCleanup\n}\n\n/**\n * Mark an object as non-reactive. This object and all its properties will never be made reactive.\n * @param obj - The object to mark as non-reactive\n */\nfunction nonReactive<T extends object[]>(...obj: T): T[0] {\n\tfor (const o of obj) {\n\t\ttry {\n\t\t\tObject.defineProperty(o, nonReactiveMark, {\n\t\t\t\tvalue: true,\n\t\t\t\twritable: false,\n\t\t\t\tenumerable: false,\n\t\t\t\tconfigurable: false,\n\t\t\t})\n\t\t} catch {}\n\t\tif (!(nonReactiveMark in (o as object))) nonReactiveObjects.add(o as object)\n\t}\n\treturn obj[0]\n}\n\n/**\n * Set of functions to test if an object is immutable\n */\nexport const immutables = new Set<(tested: any) => boolean>()\n\n/**\n * Check if an object is marked as non-reactive (for testing purposes)\n * @param obj - The object to check\n * @returns true if the object is marked as non-reactive\n */\nexport function isNonReactive(obj: any): boolean {\n\t// Don't make primitives reactive\n\tif (obj === null || typeof obj !== 'object') return true\n\n\t// Check if the object itself is marked as non-reactive\n\tif (nonReactiveObjects.has(obj)) return true\n\n\t// Check if the object has the non-reactive symbol\n\tif (obj[nonReactiveMark]) return true\n\n\t// Check if the object is immutable\n\tif (Array.from(immutables).some((fn) => fn(obj))) return true\n\n\treturn false\n}\n\n/**\n * Mark a class as non-reactive. All instances of this class will automatically be non-reactive.\n * @param cls - The class constructor to mark as non-reactive\n */\nexport function nonReactiveClass<T extends (new (...args: any[]) => any)[]>(...cls: T): T[0] {\n\tfor (const c of cls) if (c) (c.prototype as any)[nonReactiveMark] = true\n\treturn cls[0]\n}\n\nnonReactiveClass(Date, RegExp, Error, Promise, Function)\nif (typeof window !== 'undefined') nonReactive(window, document)\nif (typeof Element !== 'undefined') nonReactiveClass(Element, Node)\n\nexport function registerNativeReactivity(\n\toriginalClass: new (...args: any[]) => any,\n\treactiveClass: new (...args: any[]) => any\n) {\n\toriginalClass.prototype[nativeReactive] = reactiveClass\n\tnonReactiveClass(reactiveClass)\n}\n\n/**\n * Deep watch an object and all its nested properties\n * @param target - The object to watch deeply\n * @param callback - The callback to call when any nested property changes\n * @param options - Options for the deep watch\n * @returns A cleanup function to stop watching\n */\nexport function deepWatch<T extends object>(\n\ttarget: T,\n\tcallback: (value: T) => void,\n\t{ immediate = false } = {}\n): (() => void) | undefined {\n\tif (target === null || target === undefined) return undefined\n\tif (typeof target !== 'object') throw new Error('Target of deep watching must be an object')\n\t// Create a wrapper callback that matches ScopedCallback signature\n\tconst wrappedCallback: ScopedCallback = markWithRoot(() => callback(target), callback)\n\n\t// Use the existing effect system to register dependencies\n\treturn effect(() => {\n\t\t// Mark the target object as having deep watchers\n\t\tobjectsWithDeepWatchers.add(target)\n\n\t\t// Track which objects this effect is watching for cleanup\n\t\tlet effectObjects = effectToDeepWatchedObjects.get(wrappedCallback)\n\t\tif (!effectObjects) {\n\t\t\teffectObjects = new Set()\n\t\t\teffectToDeepWatchedObjects.set(wrappedCallback, effectObjects)\n\t\t}\n\t\teffectObjects!.add(target)\n\n\t\t// Traverse the object graph and register dependencies\n\t\t// This will re-run every time the effect runs, ensuring we catch all changes\n\t\tconst visited = new WeakSet()\n\t\tfunction traverseAndTrack(obj: any, depth = 0) {\n\t\t\t// Prevent infinite recursion and excessive depth\n\t\t\tif (visited.has(obj) || !isObject(obj) || depth > options.maxDeepWatchDepth) return\n\t\t\t// Do not traverse into unreactive objects\n\t\t\tif (isNonReactive(obj)) return\n\t\t\tvisited.add(obj)\n\n\t\t\t// Mark this object as having deep watchers\n\t\t\tobjectsWithDeepWatchers.add(obj)\n\t\t\teffectObjects!.add(obj)\n\n\t\t\t// Traverse all properties to register dependencies\n\t\t\t// unwrap to avoid kicking dependency\n\t\t\tfor (const key in unwrap(obj)) {\n\t\t\t\tif (Object.hasOwn(obj, key)) {\n\t\t\t\t\t// Access the property to register dependency\n\t\t\t\t\tconst value = (obj as any)[key]\n\t\t\t\t\t// Make the value reactive if it's an object\n\t\t\t\t\tconst reactiveValue =\n\t\t\t\t\t\ttypeof value === 'object' && value !== null ? reactive(value) : value\n\t\t\t\t\ttraverseAndTrack(reactiveValue, depth + 1)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Also handle array indices and length\n\t\t\t// biome-ignore lint/suspicious/useIsArray: Check for both native arrays and reactive arrays\n\t\t\tif (Array.isArray(obj) || obj instanceof Array) {\n\t\t\t\t// Access array length to register dependency on length changes\n\t\t\t\tconst length = obj.length\n\n\t\t\t\t// Access all current array elements to register dependencies\n\t\t\t\tfor (let i = 0; i < length; i++) {\n\t\t\t\t\t// Access the array element to register dependency\n\t\t\t\t\tconst value = obj[i]\n\t\t\t\t\t// Make the value reactive if it's an object\n\t\t\t\t\tconst reactiveValue =\n\t\t\t\t\t\ttypeof value === 'object' && value !== null ? reactive(value) : value\n\t\t\t\t\ttraverseAndTrack(reactiveValue, depth + 1)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Handle Set values (deep watch values only, not keys since Sets don't have separate keys)\n\t\t\telse if (obj instanceof Set) {\n\t\t\t\t// Access all Set values to register dependencies\n\t\t\t\tfor (const value of obj) {\n\t\t\t\t\t// Make the value reactive if it's an object\n\t\t\t\t\tconst reactiveValue =\n\t\t\t\t\t\ttypeof value === 'object' && value !== null ? reactive(value) : value\n\t\t\t\t\ttraverseAndTrack(reactiveValue, depth + 1)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Handle Map values (deep watch values only, not keys)\n\t\t\telse if (obj instanceof Map) {\n\t\t\t\t// Access all Map values to register dependencies\n\t\t\t\tfor (const [_key, value] of obj) {\n\t\t\t\t\t// Make the value reactive if it's an object\n\t\t\t\t\tconst reactiveValue =\n\t\t\t\t\t\ttypeof value === 'object' && value !== null ? reactive(value) : value\n\t\t\t\t\ttraverseAndTrack(reactiveValue, depth + 1)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Note: WeakSet and WeakMap cannot be iterated, so we can't deep watch their contents\n\t\t\t// They will only trigger when the collection itself is replaced\n\t\t}\n\n\t\t// Traverse the target object to register all dependencies\n\t\t// This will register dependencies on all current properties and array elements\n\t\ttraverseAndTrack(target)\n\n\t\t// Only call the callback if immediate is true or if it's not the first run\n\t\tif (immediate) callback(target)\n\t\timmediate = true\n\n\t\t// Return a cleanup function that properly removes deep watcher tracking\n\t\treturn () => {\n\t\t\t// Get the objects this effect was watching\n\t\t\tconst effectObjects = effectToDeepWatchedObjects.get(wrappedCallback)\n\t\t\tif (effectObjects) {\n\t\t\t\t// Remove deep watcher tracking from all objects this effect was watching\n\t\t\t\tfor (const obj of effectObjects) {\n\t\t\t\t\t// Check if this object still has other deep watchers\n\t\t\t\t\tconst watchers = deepWatchers.get(obj)\n\t\t\t\t\tif (watchers) {\n\t\t\t\t\t\t// Remove this effect's callback from the watchers\n\t\t\t\t\t\twatchers.delete(wrappedCallback)\n\n\t\t\t\t\t\t// If no more watchers, remove the object from deep watchers tracking\n\t\t\t\t\t\tif (watchers.size === 0) {\n\t\t\t\t\t\t\tdeepWatchers.delete(obj)\n\t\t\t\t\t\t\tobjectsWithDeepWatchers.delete(obj)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// No watchers found, remove from deep watchers tracking\n\t\t\t\t\t\tobjectsWithDeepWatchers.delete(obj)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Clean up the tracking data\n\t\t\t\teffectToDeepWatchedObjects.delete(wrappedCallback)\n\t\t\t}\n\t\t}\n\t})\n}\n\n/**\n * Check if an object is an object (not null, not primitive)\n */\nfunction isObject(obj: any): obj is object {\n\treturn obj !== null && typeof obj === 'object'\n}\n","import { decorator, GenericClassDecorator } from '../decorator'\nimport { renamed } from '../utils'\nimport {\n\ttype DependencyFunction,\n\tdeepWatch,\n\tdependant,\n\teffect,\n\tgetRoot,\n\tisNonReactive,\n\tmarkWithRoot,\n\tnonReactiveClass,\n\tnonReactiveMark,\n\tnonReactiveObjects,\n\toptions,\n\ttype ScopedCallback,\n\ttouched1,\n\tunreactiveProperties,\n\tuntracked,\n\tunwrap,\n\twithEffect,\n} from './core'\n\n//#region computed\nlet computedInvalidations: (() => void)[] | undefined\n/**\n * When used in a computed property computation, it will register the callback to be called when the computed property is invalidated\n * @param cb - The callback to register\n * @param warn - Whether to warn if used outside of a computed property\n */\nexport function invalidateComputed(cb: () => void, warn = true) {\n\tif (computedInvalidations) computedInvalidations.push(cb)\n\telse if (warn) options.warn('Using `invalidateComputed` outside of a computed property')\n}\ntype ComputedFunction<T> = (dep: DependencyFunction) => T\nconst computedCache = new WeakMap<ComputedFunction<any>, any>()\nfunction computedFunction<T>(getter: ComputedFunction<T>): T {\n\tconst key = getRoot(getter)\n\tlet invalidations: (() => void)[] = []\n\tdependant(computedCache, key)\n\tif (computedCache.has(key)) return computedCache.get(key)\n\twithEffect(undefined, () => {\n\t\tconst stop = effect(\n\t\t\tmarkWithRoot((dep) => {\n\t\t\t\tconst oldCI = computedInvalidations\n\t\t\t\tif (computedCache.has(key)) {\n\t\t\t\t\t// This should *not* be called in the cleanup chain, as its effects would be lost and cleaned-up\n\t\t\t\t\tfor (const cb of invalidations) cb()\n\t\t\t\t\tinvalidations = []\n\t\t\t\t\tcomputedCache.delete(key)\n\t\t\t\t\ttouched1(computedCache, { type: 'set', prop: key }, key)\n\t\t\t\t\tstop()\n\t\t\t\t} else\n\t\t\t\t\ttry {\n\t\t\t\t\t\tcomputedInvalidations = invalidations\n\t\t\t\t\t\tcomputedCache.set(key, getter(dep))\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tcomputedInvalidations = oldCI\n\t\t\t\t\t}\n\t\t\t}, getter)\n\t\t)\n\t})\n\treturn computedCache.get(key)\n}\n\n/**\n * Get the cached value of a computed function - cache is invalidated when the dependencies change\n */\nexport const computed = decorator({\n\tgetter(original, propertyKey) {\n\t\tconst computers = new WeakMap<any, () => any>()\n\t\treturn function (this: any) {\n\t\t\tif (!computers.has(this)) {\n\t\t\t\tcomputers.set(\n\t\t\t\t\tthis,\n\t\t\t\t\trenamed(\n\t\t\t\t\t\t() => original.call(this),\n\t\t\t\t\t\t`${String(this.constructor.name)}.${String(propertyKey)}`\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn computedFunction(computers.get(this)!)\n\t\t}\n\t},\n\tdefault<T>(getter: ComputedFunction<T>): T {\n\t\treturn computedFunction(getter)\n\t},\n})\n\n//#endregion\n\n//#region watch\n\nconst unsetYet = Symbol('unset-yet')\nexport interface WatchOptions {\n\timmediate?: boolean\n\tdeep?: boolean\n}\nexport function watch<T>(\n\tvalue: (dep: DependencyFunction) => T,\n\tchanged: (value: T, oldValue?: T) => void,\n\toptions?: Omit<WatchOptions, 'deep'> & { deep?: false }\n): ScopedCallback\nexport function watch<T extends object | any[]>(\n\tvalue: (dep: DependencyFunction) => T,\n\tchanged: (value: T, oldValue?: T) => void,\n\toptions?: Omit<WatchOptions, 'deep'> & { deep: true }\n): ScopedCallback\nexport function watch<T extends object | any[]>(\n\tvalue: T,\n\tchanged: (value: T) => void,\n\toptions?: WatchOptions\n): ScopedCallback\n\nexport function watch(\n\tvalue: any, //object | ((dep: DependencyFunction) => object),\n\tchanged: (value?: object, oldValue?: object) => void,\n\toptions: any = {}\n) {\n\treturn typeof value === 'function'\n\t\t? watchCallBack(value, changed, options)\n\t\t: typeof value === 'object'\n\t\t\t? watchObject(value, changed, options)\n\t\t\t: (() => {\n\t\t\t\t\tthrow new Error('watch: value must be a function or an object')\n\t\t\t\t})()\n}\n\nfunction watchObject(\n\tvalue: object,\n\tchanged: (value: object) => void,\n\t{ immediate = false, deep = false } = {}\n): ScopedCallback {\n\tif (deep) return deepWatch(value, changed, { immediate })\n\treturn effect(\n\t\tmarkWithRoot(() => {\n\t\t\tdependant(value)\n\t\t\tif (immediate) untracked(() => changed(value))\n\t\t\timmediate = true\n\t\t}, changed)\n\t)\n}\n\nfunction watchCallBack<T>(\n\tvalue: (dep: DependencyFunction) => T,\n\tchanged: (value: T, oldValue?: T) => void,\n\t{ immediate = false, deep = false } = {}\n): ScopedCallback {\n\tlet oldValue: T | typeof unsetYet = unsetYet\n\tlet deepCleanup: ScopedCallback | undefined\n\tconst cbCleanup = effect(\n\t\tmarkWithRoot((dep) => {\n\t\t\tconst newValue = value(dep)\n\t\t\tif (oldValue !== newValue)\n\t\t\t\tuntracked(\n\t\t\t\t\tmarkWithRoot(() => {\n\t\t\t\t\t\tif (oldValue === unsetYet) {\n\t\t\t\t\t\t\tif (immediate) changed(newValue)\n\t\t\t\t\t\t} else changed(newValue, oldValue)\n\t\t\t\t\t\toldValue = newValue\n\t\t\t\t\t\tif (deep) {\n\t\t\t\t\t\t\tif (deepCleanup) deepCleanup()\n\t\t\t\t\t\t\tdeepCleanup = deepWatch(\n\t\t\t\t\t\t\t\tnewValue as object,\n\t\t\t\t\t\t\t\tmarkWithRoot((value) => changed(value as T, value as T), changed)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t}, changed)\n\t\t\t\t)\n\t\t}, value)\n\t)\n\treturn () => {\n\t\tcbCleanup()\n\t\tif (deepCleanup) deepCleanup()\n\t}\n}\n\n//#endregion\n\n//#region nonReactive\n\n/**\n * Mark an object as non-reactive. This object and all its properties will never be made reactive.\n * @param obj - The object to mark as non-reactive\n */\nfunction deepNonReactive<T>(obj: T): T {\n\tobj = unwrap(obj)\n\tif (isNonReactive(obj)) return obj\n\ttry {\n\t\tObject.defineProperty(obj as object, nonReactiveMark, {\n\t\t\tvalue: true,\n\t\t\twritable: false,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: true,\n\t\t})\n\t} catch {}\n\tif (!(nonReactiveMark in (obj as object))) nonReactiveObjects.add(obj as object)\n\tfor (const key in obj) deepNonReactive(obj[key])\n\treturn obj\n}\nfunction unreactiveApplication<T extends object>(...args: (keyof T)[]): GenericClassDecorator<T>\nfunction unreactiveApplication<T extends object>(obj: T): T\nfunction unreactiveApplication<T extends object>(\n\targ1: T | keyof T,\n\t...args: (keyof T)[]\n): GenericClassDecorator<T> | T {\n\treturn typeof arg1 === 'object'\n\t\t? deepNonReactive(arg1)\n\t\t: (((original) => {\n\t\t\t\t// Copy the parent's unreactive properties if they exist\n\t\t\t\toriginal.prototype[unreactiveProperties] = new Set<PropertyKey>(\n\t\t\t\t\toriginal.prototype[unreactiveProperties] || []\n\t\t\t\t)\n\t\t\t\t// Add all arguments (including the first one)\n\t\t\t\toriginal.prototype[unreactiveProperties].add(arg1)\n\t\t\t\tfor (const arg of args) original.prototype[unreactiveProperties].add(arg)\n\t\t\t\treturn original // Return the class\n\t\t\t}) as GenericClassDecorator<T>)\n}\nexport const unreactive = decorator({\n\tclass(original) {\n\t\t// Called without arguments, mark entire class as non-reactive\n\t\tnonReactiveClass(original)\n\t},\n\tdefault: unreactiveApplication,\n})\n\n//#endregion\n\nimport { profileInfo } from './core'\n\nObject.assign(profileInfo, { computedCache })\n","import { Indexable } from '../indexable'\nimport {\n\tdependant,\n\tmakeReactiveEntriesIterator,\n\tmakeReactiveIterator,\n\tprototypeForwarding,\n\treactive,\n\ttouched,\n} from './core'\n\nconst native = Symbol('native')\nconst isArray = Array.isArray\nArray.isArray = ((value: any) =>\n\t// biome-ignore lint/suspicious/useIsArray: We are defining it\n\tisArray(value) || (value instanceof Array && native in value)) as any\nclass ReactiveBaseArray {\n\tdeclare readonly [native]: any[]\n}\nfunction* index(i: number, { length = true } = {}): IterableIterator<number | 'length'> {\n\tyield i\n\tif (length) yield 'length'\n}\n\nfunction* range(\n\ta: number,\n\tb: number,\n\t{ length = false } = {}\n): IterableIterator<number | 'length'> {\n\tconst start = Math.min(a, b)\n\tconst end = Math.max(a, b)\n\tfor (let i = start; i <= end; i++) yield i\n\tif (length) yield 'length'\n}\nexport class ReactiveArray extends Indexable(ReactiveBaseArray, {\n\tget(i: number): any {\n\t\tdependant(this[native], i)\n\t\treturn reactive(this[native][i])\n\t},\n\tset(i: number, value: any) {\n\t\tconst added = i >= this[native].length\n\t\tthis[native][i] = value\n\t\ttouched(this[native], { type: 'bunch', method: 'set' }, index(i, { length: added }))\n\t},\n\tgetLength() {\n\t\tdependant(this[native], 'length')\n\t\treturn this[native].length\n\t},\n\tsetLength(value: number) {\n\t\tconst oldLength = this[native].length\n\t\ttry {\n\t\t\tthis[native].length = value\n\t\t} finally {\n\t\t\ttouched(\n\t\t\t\tthis[native],\n\t\t\t\t{ type: 'set', prop: 'length' },\n\t\t\t\trange(oldLength, value, { length: true })\n\t\t\t)\n\t\t}\n\t},\n}) {\n\tdeclare length: number\n\tconstructor(original: any[]) {\n\t\tsuper()\n\t\tObject.defineProperties(this, {\n\t\t\t// We have to make it double, as [native] must be `unique symbol` - impossible through import\n\t\t\t[native]: { value: original },\n\t\t\t[prototypeForwarding]: { value: original },\n\t\t})\n\t}\n\n\t// Safe array access with negative indices\n\tat(index: number): any {\n\t\tconst actualIndex = index < 0 ? this[native].length + index : index\n\t\tdependant(this, actualIndex)\n\t\tif (actualIndex < 0 || actualIndex >= this[native].length) return undefined\n\t\treturn reactive(this[native][actualIndex])\n\t}\n\n\tpush(...items: any[]) {\n\t\tconst oldLength = this[native].length\n\t\ttry {\n\t\t\treturn this[native].push(...items)\n\t\t} finally {\n\t\t\ttouched(\n\t\t\t\tthis,\n\t\t\t\t{ type: 'bunch', method: 'push' },\n\t\t\t\trange(oldLength, oldLength + items.length - 1, { length: true })\n\t\t\t)\n\t\t}\n\t}\n\n\tpop() {\n\t\tif (this[native].length === 0) return undefined\n\t\ttry {\n\t\t\treturn reactive(this[native].pop())\n\t\t} finally {\n\t\t\ttouched(this, { type: 'bunch', method: 'pop' }, index(this[native].length))\n\t\t}\n\t}\n\n\tshift() {\n\t\tif (this[native].length === 0) return undefined\n\t\ttry {\n\t\t\treturn reactive(this[native].shift())\n\t\t} finally {\n\t\t\ttouched(\n\t\t\t\tthis,\n\t\t\t\t{ type: 'bunch', method: 'shift' },\n\t\t\t\trange(0, this[native].length + 1, { length: true })\n\t\t\t)\n\t\t}\n\t}\n\n\tunshift(...items: any[]) {\n\t\ttry {\n\t\t\treturn this[native].unshift(...items)\n\t\t} finally {\n\t\t\ttouched(\n\t\t\t\tthis,\n\t\t\t\t{ type: 'bunch', method: 'unshift' },\n\t\t\t\trange(0, this[native].length - items.length, { length: true })\n\t\t\t)\n\t\t}\n\t}\n\n\tsplice(start: number, deleteCount?: number, ...items: any[]) {\n\t\tconst oldLength = this[native].length\n\t\tif (deleteCount === undefined) deleteCount = oldLength - start\n\t\ttry {\n\t\t\tif (deleteCount === undefined) return reactive(this[native].splice(start))\n\t\t\treturn reactive(this[native].splice(start, deleteCount, ...items))\n\t\t} finally {\n\t\t\ttouched(\n\t\t\t\tthis,\n\t\t\t\t{ type: 'bunch', method: 'splice' },\n\t\t\t\t// TODO: edge cases\n\t\t\t\tdeleteCount === items.length\n\t\t\t\t\t? range(start, start + deleteCount)\n\t\t\t\t\t: range(start, oldLength + Math.max(items.length - deleteCount, 0), {\n\t\t\t\t\t\t\tlength: true,\n\t\t\t\t\t\t})\n\t\t\t)\n\t\t}\n\t}\n\n\treverse() {\n\t\ttry {\n\t\t\treturn this[native].reverse()\n\t\t} finally {\n\t\t\ttouched(this, { type: 'bunch', method: 'reverse' }, range(0, this[native].length - 1))\n\t\t}\n\t}\n\n\tsort(compareFn?: (a: any, b: any) => number) {\n\t\ttry {\n\t\t\treturn this[native].sort(compareFn) as any\n\t\t} finally {\n\t\t\ttouched(this, { type: 'bunch', method: 'sort' }, range(0, this[native].length - 1))\n\t\t}\n\t}\n\n\tfill(value: any, start?: number, end?: number) {\n\t\ttry {\n\t\t\tif (start === undefined) return this[native].fill(value) as any\n\t\t\tif (end === undefined) return this[native].fill(value, start) as any\n\t\t\treturn this[native].fill(value, start, end) as any\n\t\t} finally {\n\t\t\ttouched(this, { type: 'bunch', method: 'fill' }, range(0, this[native].length - 1))\n\t\t}\n\t}\n\n\tcopyWithin(target: number, start: number, end?: number) {\n\t\ttry {\n\t\t\tif (end === undefined) return this[native].copyWithin(target, start) as any\n\t\t\treturn this[native].copyWithin(target, start, end) as any\n\t\t} finally {\n\t\t\ttouched(\n\t\t\t\tthis,\n\t\t\t\t{ type: 'bunch', method: 'copyWithin' },\n\t\t\t\t// TODO: calculate the range properly\n\t\t\t\trange(0, this[native].length - 1)\n\t\t\t)\n\t\t}\n\t\t// Touch all affected indices with a single allProps call\n\t}\n\n\t// Immutable versions of mutator methods\n\ttoReversed(): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].toReversed())\n\t}\n\n\ttoSorted(compareFn?: (a: any, b: any) => number): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].toSorted(compareFn))\n\t}\n\n\ttoSpliced(start: number, deleteCount?: number, ...items: any[]): any[] {\n\t\tdependant(this)\n\t\treturn deleteCount === undefined\n\t\t\t? this[native].toSpliced(start)\n\t\t\t: this[native].toSpliced(start, deleteCount, ...items)\n\t}\n\n\twith(index: number, value: any): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].with(index, value))\n\t}\n\n\t// Iterator methods with reactivity tracking\n\tentries() {\n\t\tdependant(this)\n\t\treturn makeReactiveEntriesIterator(this[native].entries())\n\t}\n\n\tkeys() {\n\t\tdependant(this)\n\t\treturn this[native].keys()\n\t}\n\n\tvalues() {\n\t\tdependant(this)\n\t\treturn makeReactiveIterator(this[native].values())\n\t}\n\n\t[Symbol.iterator]() {\n\t\tdependant(this)\n\t\tconst nativeIterator = this[native][Symbol.iterator]()\n\t\treturn {\n\t\t\tnext() {\n\t\t\t\tconst result = nativeIterator.next()\n\t\t\t\tif (result.done) {\n\t\t\t\t\treturn result\n\t\t\t\t}\n\t\t\t\treturn { value: reactive(result.value), done: false }\n\t\t\t},\n\t\t}\n\t}\n\n\tindexOf(searchElement: any, fromIndex?: number): number {\n\t\tdependant(this)\n\t\treturn this[native].indexOf(searchElement, fromIndex)\n\t}\n\n\tlastIndexOf(searchElement: any, fromIndex?: number): number {\n\t\tdependant(this)\n\t\treturn this[native].lastIndexOf(searchElement, fromIndex)\n\t}\n\n\tincludes(searchElement: any, fromIndex?: number): boolean {\n\t\tdependant(this)\n\t\treturn this[native].includes(searchElement, fromIndex)\n\t}\n\n\tfind(\n\t\tpredicate: (this: any, value: any, index: number, obj: any[]) => boolean,\n\t\tthisArg?: any\n\t): any {\n\t\tdependant(this)\n\t\treturn reactive(this[native].find(predicate, thisArg))\n\t}\n\n\tfindIndex(\n\t\tpredicate: (this: any, value: any, index: number, obj: any[]) => boolean,\n\t\tthisArg?: any\n\t): number {\n\t\tdependant(this)\n\t\treturn this[native].findIndex(predicate, thisArg)\n\t}\n\n\tflat(): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].flat())\n\t}\n\n\tflatMap(\n\t\tcallbackfn: (this: any, value: any, index: number, array: any[]) => any[],\n\t\tthisArg?: any\n\t): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].flatMap(callbackfn, thisArg))\n\t}\n\n\tfilter(callbackfn: (value: any, index: number, array: any[]) => boolean, thisArg?: any): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].filter(callbackfn as any, thisArg))\n\t}\n\n\tmap(callbackfn: (value: any, index: number, array: any[]) => any, thisArg?: any): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].map(callbackfn as any, thisArg))\n\t}\n\n\treduce(\n\t\tcallbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any,\n\t\tinitialValue?: any\n\t): any {\n\t\tdependant(this)\n\t\tconst result =\n\t\t\tinitialValue === undefined\n\t\t\t\t? this[native].reduce(callbackfn as any)\n\t\t\t\t: this[native].reduce(callbackfn as any, initialValue)\n\t\treturn reactive(result)\n\t}\n\n\treduceRight(\n\t\tcallbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any,\n\t\tinitialValue?: any\n\t): any {\n\t\tdependant(this)\n\t\tconst result =\n\t\t\tinitialValue !== undefined\n\t\t\t\t? this[native].reduceRight(callbackfn as any, initialValue)\n\t\t\t\t: (this[native] as any).reduceRight(callbackfn as any)\n\t\treturn reactive(result)\n\t}\n\n\tslice(start?: number, end?: number): any[] {\n\t\tfor (const i of range(start || 0, end || this[native].length - 1)) dependant(this, i)\n\t\treturn start === undefined\n\t\t\t? this[native].slice()\n\t\t\t: end === undefined\n\t\t\t\t? this[native].slice(start)\n\t\t\t\t: this[native].slice(start, end)\n\t}\n\n\tconcat(...items: any[]): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].concat(...items))\n\t}\n\n\tjoin(separator?: string): string {\n\t\tdependant(this)\n\t\treturn this[native].join(separator as any)\n\t}\n\n\tforEach(callbackfn: (value: any, index: number, array: any[]) => void, thisArg?: any): void {\n\t\tdependant(this)\n\t\tthis[native].forEach(callbackfn as any, thisArg)\n\t}\n\n\t// TODO: re-implement for fun dependencies? (eg - every only check the first ones until it find some)\n\tevery(callbackfn: (value: any, index: number, array: any[]) => boolean, thisArg?: any): boolean {\n\t\tdependant(this)\n\t\treturn this[native].every(callbackfn as any, thisArg)\n\t}\n\n\tsome(callbackfn: (value: any, index: number, array: any[]) => boolean, thisArg?: any): boolean {\n\t\tdependant(this)\n\t\treturn this[native].some(callbackfn as any, thisArg)\n\t}\n}\n","import {\n\tdependant,\n\tmakeReactiveEntriesIterator,\n\tmakeReactiveIterator,\n\tprototypeForwarding,\n\treactive,\n\ttouched,\n\ttouched1,\n} from './core'\n\nconst native = Symbol('native')\n\n// TODO: [prototypeForwarding]\n\nexport class ReactiveWeakMap<K extends object, V> {\n\tdeclare readonly [native]: WeakMap<K, V>\n\tdeclare readonly content: symbol\n\tconstructor(original: WeakMap<K, V>) {\n\t\tObject.defineProperties(this, {\n\t\t\t[native]: { value: original },\n\t\t\t[prototypeForwarding]: { value: original },\n\t\t\tcontent: { value: Symbol('content') },\n\t\t\t[Symbol.toStringTag]: { value: 'ReactiveWeakMap' },\n\t\t})\n\t}\n\n\t// Implement WeakMap interface methods with reactivity\n\tdelete(key: K): boolean {\n\t\tconst hadKey = this[native].has(key)\n\t\tconst result = this[native].delete(key)\n\n\t\tif (hadKey) touched1(this.content, { type: 'del', prop: key }, key)\n\n\t\treturn result\n\t}\n\n\tget(key: K): V | undefined {\n\t\tdependant(this.content, key)\n\t\treturn reactive(this[native].get(key))\n\t}\n\n\thas(key: K): boolean {\n\t\tdependant(this.content, key)\n\t\treturn this[native].has(key)\n\t}\n\n\tset(key: K, value: V): this {\n\t\t// Trigger effects for the specific key\n\t\ttouched1(this.content, { type: this[native].has(key) ? 'set' : 'add', prop: key }, key)\n\t\tthis[native].set(key, value)\n\n\t\treturn this\n\t}\n}\n\nexport class ReactiveMap<K, V> {\n\tdeclare readonly [native]: Map<K, V>\n\tdeclare readonly content: symbol\n\n\tconstructor(original: Map<K, V>) {\n\t\tObject.defineProperties(this, {\n\t\t\t[native]: { value: original },\n\t\t\t[prototypeForwarding]: { value: original },\n\t\t\tcontent: { value: Symbol('content') },\n\t\t\t[Symbol.toStringTag]: { value: 'ReactiveMap' },\n\t\t})\n\t}\n\n\t// Implement Map interface methods with reactivity\n\tget size(): number {\n\t\tdependant(this, 'size') // The ReactiveMap instance still goes through proxy\n\t\treturn this[native].size\n\t}\n\n\tclear(): void {\n\t\tconst hadEntries = this[native].size > 0\n\t\tthis[native].clear()\n\n\t\tif (hadEntries) {\n\t\t\tconst evolution = { type: 'bunch', method: 'clear' } as const\n\t\t\t// Clear triggers all effects since all keys are affected\n\t\t\ttouched1(this, evolution, 'size')\n\t\t\ttouched(this.content, evolution)\n\t\t}\n\t}\n\n\tentries(): Generator<[K, V]> {\n\t\tdependant(this.content)\n\t\treturn makeReactiveEntriesIterator(this[native].entries())\n\t}\n\n\tforEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void {\n\t\tdependant(this.content)\n\t\tthis[native].forEach(callbackfn, thisArg)\n\t}\n\n\tkeys(): MapIterator<K> {\n\t\tdependant(this.content)\n\t\treturn this[native].keys()\n\t}\n\n\tvalues(): Generator<V> {\n\t\tdependant(this.content)\n\t\treturn makeReactiveIterator(this[native].values())\n\t}\n\n\t[Symbol.iterator](): Iterator<[K, V]> {\n\t\tdependant(this.content)\n\t\tconst nativeIterator = this[native][Symbol.iterator]()\n\t\treturn {\n\t\t\tnext() {\n\t\t\t\tconst result = nativeIterator.next()\n\t\t\t\tif (result.done) {\n\t\t\t\t\treturn result\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tvalue: [result.value[0], reactive(result.value[1])],\n\t\t\t\t\tdone: false,\n\t\t\t\t}\n\t\t\t},\n\t\t}\n\t}\n\n\t// Implement Map methods with reactivity\n\tdelete(key: K): boolean {\n\t\tconst hadKey = this[native].has(key)\n\t\tconst result = this[native].delete(key)\n\n\t\tif (hadKey) {\n\t\t\tconst evolution = { type: 'del', prop: key } as const\n\t\t\ttouched1(this.content, evolution, key)\n\t\t\ttouched1(this, evolution, 'size')\n\t\t}\n\n\t\treturn result\n\t}\n\n\tget(key: K): V | undefined {\n\t\tdependant(this.content, key)\n\t\treturn reactive(this[native].get(key))\n\t}\n\n\thas(key: K): boolean {\n\t\tdependant(this.content, key)\n\t\treturn this[native].has(key)\n\t}\n\n\tset(key: K, value: V): this {\n\t\tconst hadKey = this[native].has(key)\n\t\tconst oldValue = this[native].get(key)\n\t\tconst reactiveValue = reactive(value)\n\t\tthis[native].set(key, reactiveValue)\n\n\t\tif (!hadKey || oldValue !== reactiveValue) {\n\t\t\tconst evolution = { type: hadKey ? 'set' : 'add', prop: key } as const\n\t\t\ttouched1(this.content, evolution, key)\n\t\t\ttouched1(this, evolution, 'size')\n\t\t}\n\n\t\treturn this\n\t}\n}\n","import {\n\tdependant,\n\tmakeReactiveEntriesIterator,\n\tmakeReactiveIterator,\n\tprototypeForwarding,\n\treactive,\n\ttouched,\n\ttouched1,\n} from './core'\n\nconst native = Symbol('native')\n\n// TODO: [prototypeForwarding]\n\nexport class ReactiveWeakSet<T extends object> {\n\tdeclare readonly [native]: WeakSet<T>\n\tdeclare readonly content: symbol\n\n\tconstructor(original: WeakSet<T>) {\n\t\tObject.defineProperties(this, {\n\t\t\t[native]: { value: original },\n\t\t\t[prototypeForwarding]: { value: original },\n\t\t\tcontent: { value: Symbol('content') },\n\t\t\t[Symbol.toStringTag]: { value: 'ReactiveWeakSet' },\n\t\t})\n\t}\n\n\tadd(value: T): this {\n\t\tconst had = this[native].has(value)\n\t\tthis[native].add(value)\n\t\tif (!had) {\n\t\t\t// touch the specific value and the collection view\n\t\t\ttouched1(this.content, { type: 'add', prop: value }, value)\n\t\t\t// no size/allProps for WeakSet\n\t\t}\n\t\treturn this\n\t}\n\n\tdelete(value: T): boolean {\n\t\tconst had = this[native].has(value)\n\t\tconst res = this[native].delete(value)\n\t\tif (had) touched1(this.content, { type: 'del', prop: value }, value)\n\t\treturn res\n\t}\n\n\thas(value: T): boolean {\n\t\tdependant(this.content, value)\n\t\treturn this[native].has(value)\n\t}\n}\n\nexport class ReactiveSet<T> {\n\tdeclare readonly [native]: Set<T>\n\tdeclare readonly content: symbol\n\tconstructor(original: Set<T>) {\n\t\tObject.defineProperties(this, {\n\t\t\t[native]: { value: original },\n\t\t\t[prototypeForwarding]: { value: original },\n\t\t\tcontent: { value: Symbol('content') },\n\t\t\t[Symbol.toStringTag]: { value: 'ReactiveSet' },\n\t\t})\n\t}\n\n\tget size(): number {\n\t\t// size depends on the wrapper instance, like Map counterpart\n\t\tdependant(this, 'size')\n\t\treturn this[native].size\n\t}\n\n\tadd(value: T): this {\n\t\tconst had = this[native].has(value)\n\t\tconst reactiveValue = reactive(value)\n\t\tthis[native].add(reactiveValue)\n\t\tif (!had) {\n\t\t\tconst evolution = { type: 'add', prop: reactiveValue } as const\n\t\t\t// touch for value-specific and aggregate dependencies\n\t\t\ttouched1(this.content, evolution, reactiveValue)\n\t\t\ttouched1(this, evolution, 'size')\n\t\t}\n\t\treturn this\n\t}\n\n\tclear(): void {\n\t\tconst hadEntries = this[native].size > 0\n\t\tthis[native].clear()\n\t\tif (hadEntries) {\n\t\t\tconst evolution = { type: 'bunch', method: 'clear' } as const\n\t\t\ttouched1(this, evolution, 'size')\n\t\t\ttouched(this.content, evolution)\n\t\t}\n\t}\n\n\tdelete(value: T): boolean {\n\t\tconst had = this[native].has(value)\n\t\tconst res = this[native].delete(value)\n\t\tif (had) {\n\t\t\tconst evolution = { type: 'del', prop: value } as const\n\t\t\ttouched1(this.content, evolution, value)\n\t\t\ttouched1(this, evolution, 'size')\n\t\t}\n\t\treturn res\n\t}\n\n\thas(value: T): boolean {\n\t\tdependant(this.content, value)\n\t\treturn this[native].has(value)\n\t}\n\n\tentries(): Generator<[T, T]> {\n\t\tdependant(this.content)\n\t\treturn makeReactiveEntriesIterator(this[native].entries())\n\t}\n\n\tforEach(callbackfn: (value: T, value2: T, set: Set<T>) => void, thisArg?: any): void {\n\t\tdependant(this.content)\n\t\tthis[native].forEach(callbackfn, thisArg)\n\t}\n\n\tkeys(): Generator<T> {\n\t\tdependant(this.content)\n\t\treturn makeReactiveIterator(this[native].keys())\n\t}\n\n\tvalues(): Generator<T> {\n\t\tdependant(this.content)\n\t\treturn makeReactiveIterator(this[native].values())\n\t}\n\n\t[Symbol.iterator](): Iterator<T> {\n\t\tdependant(this.content)\n\t\tconst nativeIterator = this[native][Symbol.iterator]()\n\t\treturn {\n\t\t\tnext() {\n\t\t\t\tconst result = nativeIterator.next()\n\t\t\t\tif (result.done) {\n\t\t\t\t\treturn result\n\t\t\t\t}\n\t\t\t\treturn { value: reactive(result.value), done: false }\n\t\t\t},\n\t\t}\n\t}\n}\n","export {\n\teffect,\n\tgetState,\n\timmutables,\n\tisNonReactive,\n\tisReactive,\n\toptions as reactiveOptions,\n\tprofileInfo,\n\tReactiveBase,\n\tReactiveError,\n\treactive,\n\ttype ScopedCallback,\n\tuntracked,\n\tunwrap,\n} from './core'\nexport { computed, invalidateComputed, unreactive, watch } from './interface'\n\nimport { ReactiveArray } from './array'\nimport { registerNativeReactivity } from './core'\nimport { ReactiveMap, ReactiveWeakMap } from './map'\nimport { ReactiveSet, ReactiveWeakSet } from './set'\n\n// Register native collection types to use specialized reactive wrappers\nregisterNativeReactivity(WeakMap, ReactiveWeakMap)\nregisterNativeReactivity(Map, ReactiveMap)\nregisterNativeReactivity(WeakSet, ReactiveWeakSet)\nregisterNativeReactivity(Set, ReactiveSet)\nregisterNativeReactivity(Array, ReactiveArray)\n","import { decorator, GenericClassDecorator } from './decorator'\n\n// In order to avoid async re-entrance, we could use zone.js or something like that.\nconst syncCalculating: { object: object; prop: PropertyKey }[] = []\nexport const cached = decorator({\n\tgetter(original, propertyKey) {\n\t\treturn function (this: any) {\n\t\t\tconst alreadyCalculating = syncCalculating.findIndex(\n\t\t\t\t(c) => c.object === this && c.prop === propertyKey\n\t\t\t)\n\t\t\tif (alreadyCalculating > -1)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Circular dependency detected: ${syncCalculating\n\t\t\t\t\t\t.slice(alreadyCalculating)\n\t\t\t\t\t\t.map((c) => `${c.object.constructor.name}.${String(c.prop)}`)\n\t\t\t\t\t\t.join(' -> ')} -> again`\n\t\t\t\t)\n\t\t\tsyncCalculating.push({ object: this, prop: propertyKey })\n\t\t\ttry {\n\t\t\t\tconst rv = original.call(this)\n\t\t\t\tcache(this, propertyKey, rv)\n\t\t\t\treturn rv\n\t\t\t} finally {\n\t\t\t\tsyncCalculating.pop()\n\t\t\t}\n\t\t}\n\t},\n})\n\nexport function isCached(object: Object, propertyKey: PropertyKey) {\n\treturn !!Object.getOwnPropertyDescriptor(object, propertyKey)\n}\n\nexport function cache(object: Object, propertyKey: PropertyKey, value: any) {\n\tObject.defineProperty(object, propertyKey, { value })\n}\n\nexport function describe(descriptor: {\n\tenumerable?: boolean\n\tconfigurable?: boolean // Not modifiable once the property has been defined ?\n\twritable?: boolean\n}) {\n\treturn <T>(...properties: (keyof T)[]): GenericClassDecorator<T> =>\n\t\t(Base) => {\n\t\t\treturn class extends Base {\n\t\t\t\tconstructor(...args: any[]) {\n\t\t\t\t\tsuper(...args)\n\t\t\t\t\tfor (const key of properties) {\n\t\t\t\t\t\tObject.defineProperty(this, key, {\n\t\t\t\t\t\t\t...Object.getOwnPropertyDescriptor(this, key),\n\t\t\t\t\t\t\t...descriptor,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n}\n\nexport const deprecated = Object.assign(\n\tdecorator({\n\t\tmethod(original, propertyKey) {\n\t\t\treturn function (this: any, ...args: any[]) {\n\t\t\t\tdeprecated.warn(this, propertyKey)\n\t\t\t\treturn original.apply(this, args)\n\t\t\t}\n\t\t},\n\t\tgetter(original, propertyKey) {\n\t\t\treturn function (this: any) {\n\t\t\t\tdeprecated.warn(this, propertyKey)\n\t\t\t\treturn original.call(this)\n\t\t\t}\n\t\t},\n\t\tsetter(original, propertyKey) {\n\t\t\treturn function (this: any, value: any) {\n\t\t\t\tdeprecated.warn(this, propertyKey)\n\t\t\t\treturn original.call(this, value)\n\t\t\t}\n\t\t},\n\t\tclass(original) {\n\t\t\treturn class extends original {\n\t\t\t\tconstructor(...args: any[]) {\n\t\t\t\t\tsuper(...args)\n\t\t\t\t\tdeprecated.warn(this, 'constructor')\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tdefault(message: string) {\n\t\t\treturn decorator({\n\t\t\t\tmethod(original, propertyKey) {\n\t\t\t\t\treturn function (this: any, ...args: any[]) {\n\t\t\t\t\t\tdeprecated.warn(this, propertyKey, message)\n\t\t\t\t\t\treturn original.apply(this, args)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tgetter(original, propertyKey) {\n\t\t\t\t\treturn function (this: any) {\n\t\t\t\t\t\tdeprecated.warn(this, propertyKey, message)\n\t\t\t\t\t\treturn original.call(this)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tsetter(original, propertyKey) {\n\t\t\t\t\treturn function (this: any, value: any) {\n\t\t\t\t\t\tdeprecated.warn(this, propertyKey, message)\n\t\t\t\t\t\treturn original.call(this, value)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tclass(original) {\n\t\t\t\t\treturn class extends original {\n\t\t\t\t\t\tconstructor(...args: any[]) {\n\t\t\t\t\t\t\tsuper(...args)\n\t\t\t\t\t\t\tdeprecated.warn(this, 'constructor', message)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t})\n\t\t},\n\t}),\n\t{\n\t\twarn: (target: any, propertyKey: PropertyKey, message?: string) => {\n\t\t\t// biome-ignore lint/suspicious/noConsole: To be overridden\n\t\t\tconsole.warn(\n\t\t\t\t`${target.constructor.name}.${String(propertyKey)} is deprecated${message ? `: ${message}` : ''}`\n\t\t\t)\n\t\t},\n\t}\n)\n\nexport function debounce(delay: number) {\n\treturn decorator({\n\t\tmethod(original, _propertyKey) {\n\t\t\tlet timeoutId: ReturnType<typeof setTimeout> | null = null\n\n\t\t\treturn function (this: any, ...args: any[]) {\n\t\t\t\t// Clear existing timeout\n\t\t\t\tif (timeoutId) {\n\t\t\t\t\tclearTimeout(timeoutId)\n\t\t\t\t}\n\n\t\t\t\t// Set new timeout\n\t\t\t\ttimeoutId = setTimeout(() => {\n\t\t\t\t\toriginal.apply(this, args)\n\t\t\t\t\ttimeoutId = null\n\t\t\t\t}, delay)\n\t\t\t}\n\t\t},\n\t})\n}\n\nexport function throttle(delay: number) {\n\treturn decorator({\n\t\tmethod(original, _propertyKey) {\n\t\t\tlet lastCallTime = 0\n\t\t\tlet timeoutId: ReturnType<typeof setTimeout> | null = null\n\n\t\t\treturn function (this: any, ...args: any[]) {\n\t\t\t\tconst now = Date.now()\n\n\t\t\t\t// If enough time has passed since last call, execute immediately\n\t\t\t\tif (now - lastCallTime >= delay) {\n\t\t\t\t\t// Clear any pending timeout since we're executing now\n\t\t\t\t\tif (timeoutId) {\n\t\t\t\t\t\tclearTimeout(timeoutId)\n\t\t\t\t\t\ttimeoutId = null\n\t\t\t\t\t}\n\t\t\t\t\tlastCallTime = now\n\t\t\t\t\treturn original.apply(this, args)\n\t\t\t\t}\n\n\t\t\t\t// Otherwise, schedule execution for when the delay period ends\n\t\t\t\tif (!timeoutId) {\n\t\t\t\t\tconst remainingTime = delay - (now - lastCallTime)\n\t\t\t\t\tconst scheduledArgs = [...args] // Capture args at scheduling time\n\t\t\t\t\ttimeoutId = setTimeout(() => {\n\t\t\t\t\t\tlastCallTime = Date.now()\n\t\t\t\t\t\toriginal.apply(this, scheduledArgs)\n\t\t\t\t\t\ttimeoutId = null\n\t\t\t\t\t}, remainingTime)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t})\n}\n","export class Eventful<Events extends Record<string, (...args: any[]) => void>> {\n\treadonly #events = new Map<keyof Events, ((...args: any[]) => void)[]>()\n\treadonly #hooks = [] as ((...args: any[]) => void)[]\n\n\tpublic hook(\n\t\tcb: <EventType extends keyof Events>(\n\t\t\tevent: EventType,\n\t\t\t...args: Parameters<Events[EventType]>\n\t\t) => void\n\t): () => void {\n\t\tif (!this.#hooks.includes(cb)) this.#hooks.push(cb)\n\t\treturn () => {\n\t\t\tthis.#hooks.splice(this.#hooks.indexOf(cb), 1)\n\t\t}\n\t}\n\n\tpublic on(events: Partial<Events>): void\n\tpublic on<EventType extends keyof Events>(event: EventType, cb: Events[EventType]): () => void\n\tpublic on<EventType extends keyof Events>(\n\t\teventOrEvents: EventType | Partial<Events>,\n\t\tcb?: Events[EventType]\n\t): () => void {\n\t\tif (typeof eventOrEvents === 'object') {\n\t\t\tfor (const e of Object.keys(eventOrEvents) as (keyof Events)[]) {\n\t\t\t\tthis.on(e, eventOrEvents[e]!)\n\t\t\t}\n\t\t} else if (cb !== undefined) {\n\t\t\tlet callbacks = this.#events.get(eventOrEvents)\n\t\t\tif (!callbacks) {\n\t\t\t\tcallbacks = []\n\t\t\t\tthis.#events.set(eventOrEvents, callbacks)\n\t\t\t}\n\t\t\tcallbacks.push(cb)\n\t\t}\n\t\t// @ts-expect-error Generic case leads to generic case\n\t\treturn () => this.off(eventOrEvents, cb)\n\t}\n\tpublic off(events: Partial<Events>): void\n\tpublic off<EventType extends keyof Events>(event: EventType, cb?: Events[EventType]): void\n\tpublic off<EventType extends keyof Events>(\n\t\teventOrEvents: EventType | Partial<Events>,\n\t\tcb?: Events[EventType]\n\t): void {\n\t\tif (typeof eventOrEvents === 'object') {\n\t\t\tfor (const e of Object.keys(eventOrEvents) as (keyof Events)[]) {\n\t\t\t\tthis.off(e, eventOrEvents[e])\n\t\t\t}\n\t\t} else if (cb !== null && cb !== undefined) {\n\t\t\tconst callbacks = this.#events.get(eventOrEvents)\n\t\t\tif (callbacks) {\n\t\t\t\tthis.#events.set(\n\t\t\t\t\teventOrEvents,\n\t\t\t\t\tcallbacks.filter((c) => c !== cb)\n\t\t\t\t)\n\t\t\t}\n\t\t} else {\n\t\t\t// Remove all listeners for this event\n\t\t\tthis.#events.delete(eventOrEvents)\n\t\t}\n\t}\n\tpublic emit<EventType extends keyof Events>(\n\t\tevent: EventType,\n\t\t...args: Parameters<Events[EventType]>\n\t) {\n\t\tconst callbacks = this.#events.get(event)\n\t\tif (callbacks) for (const cb of callbacks) cb.apply(this, args)\n\t\tfor (const cb of this.#hooks) cb.call(this, event, ...args)\n\t}\n}\n"],"names":["nativeConstructors","Set","Object","Array","Date","Function","Map","WeakMap","WeakSet","Promise","Error","TypeError","ReferenceError","SyntaxError","RangeError","URIError","EvalError","Reflect","Proxy","RegExp","String","Number","Boolean","isConstructor","fn","has","toString","startsWith","renamed","fct","name","defineProperties","value","DecoratorError","constructor","message","super","this","legacyDecorator","description","target","propertyKey","descriptor","args","undefined","class","includes","newGetter","getter","get","newSetter","setter","set","newMethod","method","default","call","modernDecorator","context","kind","rv","decorator","contextOrKey","mode","_target","detectDecoratorMode","fr","FinalizationRegistry","f","destructor","Symbol","allocatedValues","DestructionError","msg","destroyedHandler","toStringTag","throw","allocated","original","getAt","setAt","Indexable","base","accessor","index","setPrototypeOf","prototype","prop","receiver","getOwnPropertyDescriptor","getLength","numProp","isNaN","setLength","defineProperty","writable","enumerable","configurable","effectToReactiveObjects","objectToProxy","proxyToObject","objectParents","objectsWithDeepWatchers","deepWatchers","effectToDeepWatchedObjects","nonReactiveObjects","makeReactiveIterator","iterator","result","next","done","reactive","makeReactiveEntriesIterator","key","watchers","profileInfo","nativeReactive","nonReactiveMark","unreactiveProperties","prototypeForwarding","allProps","rootFunction","markWithRoot","root","getRoot","ReactiveError","options","enter","effect","leave","chain","caller","maxEffectChain","maxDeepWatchDepth","instanceMembers","warn","raiseDeps","objectWatchers","keyChains","keys","deps","from","hasEffect","touched1","obj","evolution","touched","props","unwrap","state","getState","assign","states","addState","bubbleUpChange","dependant","activeEffect","add","effectObjects","parentEffect","batchedEffects","runEffects","size","length","entries","push","delete","withEffect","keepParent","oldActiveEffect","oldParentEffect","addBackReference","child","parent","parents","removeBackReference","needsBackReferences","hasParentWithDeepWatchers","changedObject","parentDeepWatchers","watcher","reactiveHandlers","absent","hasOwn","reactiveValue","isArrayCase","newValue","oldVal","oldPresent","track1","type","deleteProperty","getPrototypeOf","proto","ownKeys","reactiveClasses","ReactiveBase","reactiveObject","anyTarget","isNonReactive","proxied","proxy","Reactive","untracked","effectChildren","cleanup","dep","cb","runEffect","effectStopped","reactionCleanup","reactiveObj","oldBatchedEffects","mainCleanup","children","childCleanup","unregister","callIfCollected","register","subEffectCleanup","immutables","some","nonReactiveClass","cls","c","registerNativeReactivity","originalClass","reactiveClass","deepWatch","callback","immediate","wrappedCallback","visited","traverseAndTrack","depth","isObject","isArray","i","_key","computedInvalidations","window","o","nonReactive","document","Element","Node","computedCache","computedFunction","invalidations","stop","oldCI","computed","computers","unsetYet","deepNonReactive","unreactive","arg1","arg","native","ReactiveBaseArray","range","a","b","start","Math","min","end","max","ReactiveArray","added","oldLength","native$2","at","actualIndex","items","pop","shift","unshift","splice","deleteCount","reverse","sort","compareFn","fill","copyWithin","toReversed","toSorted","toSpliced","with","values","nativeIterator","indexOf","searchElement","fromIndex","lastIndexOf","find","predicate","thisArg","findIndex","flat","flatMap","callbackfn","filter","map","reduce","initialValue","reduceRight","slice","concat","join","separator","forEach","every","ReactiveMap","native$1","content","clear","hadEntries","hadKey","oldValue","ReactiveSet","had","res","syncCalculating","cached","alreadyCalculating","object","cache","deprecated","apply","destructorObj","_a","destroy","destructors","getOwnPropertyNames","isDestroyable","myDestructor","destruction","_Eventful_events","_Eventful_hooks","hook","__classPrivateFieldGet","on","eventOrEvents","e","callbacks","off","emit","event","called","forward","delay","_propertyKey","timeoutId","clearTimeout","setTimeout","properties","Base","lastCallTime","now","remainingTime","scheduledArgs","changed","deep","deepCleanup","cbCleanup","watchCallBack","watchObject","minLength","arr","tuple"],"mappings":"4OAiBA,MAAMA,EAAqB,IAAIC,IAAc,CAC5CC,OACAC,MACAC,KACAC,SACA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CA,EACA0U,GACApI,UAAEA,GAAY,EAAKqI,KAAEA,GAAO,GAAU,IAEtC,OAAIA,EAAavI,GAAUpM,EAAO0U,EAAS,CAAEpI,cACtCtG,GACNN,EAAa,KACZiC,EAAU3H,GACNsM,GAAW3B,GAAU,IAAM+J,EAAQ1U,IACvCsM,GAAY,GACVoI,GAEL,CAnBKK,CAAY/U,EAAO0U,EAAS5O,GAC5B,MACA,MAAM,IAAIpH,MAAM,+CAChB,EAFA,EAGL,QLzHM,YAAmDiC,GACxD,IAAKA,EAAKwH,OAAQ,MAAO,GACzB,MAAM6M,EAAYxG,KAAKC,OAAO9N,EAAKoQ,IAAKkE,GAAQA,EAAI9M,SAC9CvD,EAA4B,GAElC,IAAK,IAAIiI,EAAI,EAAGA,EAAImI,EAAWnI,IAAK,CACnC,MAAMqI,EAAQvU,EAAKoQ,IAAKkE,GAAQA,EAAIpI,IACpCjI,EAAOyD,KAAK6M,EACb,CAEA,OAAOtQ,CACR"}
|
|
1
|
+
{"version":3,"file":"mutts.umd.js","sources":["../src/utils.ts","../src/decorator.ts","../src/destroyable.ts","../src/indexable.ts","../src/reactive/core.ts","../src/reactive/interface.ts","../src/reactive/array.ts","../src/reactive/map.ts","../src/reactive/set.ts","../src/reactive/index.ts","../src/std-decorators.ts","../src/eventful.ts"],"sourcesContent":["type ElementTypes<T extends readonly unknown[]> = {\n\t[K in keyof T]: T[K] extends readonly (infer U)[] ? U : T[K]\n}\n\nexport function zip<T extends (readonly unknown[])[]>(...args: T): ElementTypes<T>[] {\n\tif (!args.length) return []\n\tconst minLength = Math.min(...args.map((arr) => arr.length))\n\tconst result: ElementTypes<T>[] = []\n\n\tfor (let i = 0; i < minLength; i++) {\n\t\tconst tuple = args.map((arr) => arr[i]) as ElementTypes<T>\n\t\tresult.push(tuple)\n\t}\n\n\treturn result\n}\n\nconst nativeConstructors = new Set<Function>([\n\tObject,\n\tArray,\n\tDate,\n\tFunction,\n\tSet,\n\tMap,\n\tWeakMap,\n\tWeakSet,\n\tPromise,\n\tError,\n\tTypeError,\n\tReferenceError,\n\tSyntaxError,\n\tRangeError,\n\tURIError,\n\tEvalError,\n\tReflect,\n\tProxy,\n\tRegExp,\n\tString,\n\tNumber,\n\tBoolean,\n] as Function[])\nexport function isConstructor(fn: Function): boolean {\n\treturn fn && (nativeConstructors.has(fn) || fn.toString?.().startsWith('class '))\n}\n\nexport function renamed<F extends Function>(fct: F, name: string): F {\n\treturn Object.defineProperties(fct, {\n\t\tname: {\n\t\t\tvalue: name,\n\t\t},\n\t})\n}\n","// biome-ignore-all lint/suspicious/noConfusingVoidType: We *love* voids\n// Standardized decorator system that works with both Legacy and Modern decorators\n\nimport { isConstructor } from './utils'\n\nexport class DecoratorError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message)\n\t\tthis.name = 'DecoratorException'\n\t}\n}\n//#region all decorator types\n\n// Used for get/set and method decorators\nexport type LegacyPropertyDecorator<T> = (\n\ttarget: T,\n\tname: string | symbol,\n\tdescriptor: PropertyDescriptor\n) => any\n\nexport type LegacyClassDecorator<T> = (target: T) => any\n\nexport type ModernMethodDecorator<T> = (target: T, context: ClassMethodDecoratorContext) => any\n\nexport type ModernGetterDecorator<T> = (target: T, context: ClassGetterDecoratorContext) => any\n\nexport type ModernSetterDecorator<T> = (target: T, context: ClassSetterDecoratorContext) => any\n\nexport type ModernAccessorDecorator<T> = (target: T, context: ClassAccessorDecoratorContext) => any\n\nexport type ModernClassDecorator<T> = (target: T, context: ClassDecoratorContext) => any\n\n//#endregion\n\ntype DDMethod<T> = (\n\toriginal: (this: T, ...args: any[]) => any,\n\tname: PropertyKey\n) => ((this: T, ...args: any[]) => any) | void\n\ntype DDGetter<T> = (original: (this: T) => any, name: PropertyKey) => ((this: T) => any) | void\n\ntype DDSetter<T> = (\n\toriginal: (this: T, value: any) => void,\n\tname: PropertyKey\n) => ((this: T, value: any) => void) | void\n\ntype DDClass<T> = <Ctor extends new (...args: any[]) => T = new (...args: any[]) => T>(\n\ttarget: Ctor\n) => Ctor | void\nexport interface DecoratorDescription<T> {\n\tmethod?: DDMethod<T>\n\tclass?: DDClass<T>\n\tgetter?: DDGetter<T>\n\tsetter?: DDSetter<T>\n\tdefault?: (...args: any[]) => any\n}\n\nexport type Decorator<T, Description extends DecoratorDescription<T>> = (Description extends {\n\tmethod: DDMethod<T>\n}\n\t? LegacyPropertyDecorator<T> & ModernMethodDecorator<T>\n\t: unknown) &\n\t(Description extends { class: DDClass<new (...args: any[]) => T> }\n\t\t? LegacyClassDecorator<new (...args: any[]) => T> &\n\t\t\t\tModernClassDecorator<new (...args: any[]) => T>\n\t\t: unknown) &\n\t(Description extends { getter: DDGetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernGetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { setter: DDSetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernSetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { default: infer Signature } ? Signature : unknown)\n\nexport type DecoratorFactory<T> = <Description extends DecoratorDescription<T>>(\n\tdescription: Description\n) => (Description extends { method: DDMethod<T> }\n\t? LegacyPropertyDecorator<T> & ModernMethodDecorator<T>\n\t: unknown) &\n\t(Description extends { class: DDClass<new (...args: any[]) => T> }\n\t\t? LegacyClassDecorator<new (...args: any[]) => T> &\n\t\t\t\tModernClassDecorator<new (...args: any[]) => T>\n\t\t: unknown) &\n\t(Description extends { getter: DDGetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernGetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { setter: DDSetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernSetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { default: infer Signature } ? Signature : unknown)\n\nexport function legacyDecorator<T = any>(description: DecoratorDescription<T>): any {\n\treturn function (\n\t\ttarget: any,\n\t\tpropertyKey?: PropertyKey,\n\t\tdescriptor?: PropertyDescriptor,\n\t\t...args: any[]\n\t) {\n\t\tif (propertyKey === undefined) {\n\t\t\tif (isConstructor(target)) {\n\t\t\t\tif (!('class' in description)) throw new Error('Decorator cannot be applied to a class')\n\t\t\t\treturn description.class?.(target)\n\t\t\t}\n\t\t} else if (typeof target === 'object' && ['string', 'symbol'].includes(typeof propertyKey)) {\n\t\t\tif (!descriptor) throw new Error('Decorator cannot be applied to a field')\n\t\t\telse if (typeof descriptor === 'object' && 'configurable' in descriptor) {\n\t\t\t\tif ('get' in descriptor || 'set' in descriptor) {\n\t\t\t\t\tif (!('getter' in description || 'setter' in description))\n\t\t\t\t\t\tthrow new Error('Decorator cannot be applied to a getter or setter')\n\t\t\t\t\tif ('getter' in description) {\n\t\t\t\t\t\tconst newGetter = description.getter?.(descriptor.get, propertyKey)\n\t\t\t\t\t\tif (newGetter) descriptor.get = newGetter\n\t\t\t\t\t}\n\t\t\t\t\tif ('setter' in description) {\n\t\t\t\t\t\tconst newSetter = description.setter?.(descriptor.set, propertyKey)\n\t\t\t\t\t\tif (newSetter) descriptor.set = newSetter\n\t\t\t\t\t}\n\t\t\t\t\treturn descriptor\n\t\t\t\t} else if (typeof descriptor.value === 'function') {\n\t\t\t\t\tif (!('method' in description)) throw new Error('Decorator cannot be applied to a method')\n\t\t\t\t\tconst newMethod = description.method?.(descriptor.value, propertyKey)\n\t\t\t\t\tif (newMethod) descriptor.value = newMethod\n\t\t\t\t\treturn descriptor\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (!('default' in description))\n\t\t\tthrow new Error('Decorator do not have a default implementation')\n\t\treturn description.default.call(this, target, propertyKey, descriptor, ...args)\n\t}\n}\n\nexport function modernDecorator<T = any>(description: DecoratorDescription<T>): any {\n\treturn function (target: any, context?: DecoratorContext, ...args: any[]) {\n\t\tif (!context?.kind || typeof context.kind !== 'string') {\n\t\t\tif (!('default' in description))\n\t\t\t\tthrow new Error('Decorator do not have a default implementation')\n\t\t\treturn description.default.call(this, target, context, ...args)\n\t\t}\n\t\tswitch (context.kind) {\n\t\t\tcase 'class':\n\t\t\t\tif (!('class' in description)) throw new Error('Decorator cannot be applied to a class')\n\t\t\t\treturn description.class?.(target)\n\t\t\tcase 'field':\n\t\t\t\tthrow new Error('Decorator cannot be applied to a field')\n\t\t\tcase 'getter':\n\t\t\t\tif (!('getter' in description)) throw new Error('Decorator cannot be applied to a getter')\n\t\t\t\treturn description.getter?.(target, context.name)\n\t\t\tcase 'setter':\n\t\t\t\tif (!('setter' in description)) throw new Error('Decorator cannot be applied to a setter')\n\t\t\t\treturn description.setter?.(target, context.name)\n\t\t\tcase 'method':\n\t\t\t\tif (!('method' in description)) throw new Error('Decorator cannot be applied to a method')\n\t\t\t\treturn description.method?.(target, context.name)\n\t\t\tcase 'accessor': {\n\t\t\t\tif (!('getter' in description || 'setter' in description))\n\t\t\t\t\tthrow new Error('Decorator cannot be applied to a getter or setter')\n\t\t\t\tconst rv: Partial<ClassAccessorDecoratorResult<any, any>> = {}\n\t\t\t\tif ('getter' in description) {\n\t\t\t\t\tconst newGetter = description.getter?.(target.get, context.name)\n\t\t\t\t\tif (newGetter) rv.get = newGetter\n\t\t\t\t}\n\t\t\t\tif ('setter' in description) {\n\t\t\t\t\tconst newSetter = description.setter?.(target.set, context.name)\n\t\t\t\t\tif (newSetter) rv.set = newSetter\n\t\t\t\t}\n\t\t\t\treturn rv\n\t\t\t}\n\t\t\t//return description.accessor?.(target, context.name, target)\n\t\t}\n\t}\n}\n\n/**\n * Detects if the decorator is being called in modern (Modern) or legacy (Legacy) mode\n * based on the arguments passed to the decorator function\n */\nfunction detectDecoratorMode(\n\t_target: any,\n\tcontextOrKey?: any,\n\t_descriptor?: any\n): 'modern' | 'legacy' {\n\t// Modern decorators have a context object as the second parameter\n\t// Legacy decorators have a string/symbol key as the second parameter\n\tif (\n\t\ttypeof contextOrKey === 'object' &&\n\t\tcontextOrKey !== null &&\n\t\ttypeof contextOrKey.kind === 'string'\n\t) {\n\t\treturn 'modern'\n\t}\n\treturn 'legacy'\n}\n\nexport const decorator: DecoratorFactory<any> = (description: DecoratorDescription<any>) => {\n\treturn ((target: any, contextOrKey?: any, ...args: any[]) => {\n\t\tconst mode = detectDecoratorMode(target, contextOrKey, args[0])\n\t\treturn mode === 'modern'\n\t\t\t? modernDecorator(description)(target, contextOrKey, ...args)\n\t\t\t: legacyDecorator(description)(target, contextOrKey, ...args)\n\t}) as any\n}\n\nexport type GenericClassDecorator<T> = LegacyClassDecorator<abstract new (...args: any[]) => T> &\n\tModernClassDecorator<abstract new (...args: any[]) => T>\n","import { decorator } from './decorator'\n\n// Integrated with `using` statement via Symbol.dispose\nconst fr = new FinalizationRegistry<() => void>((f) => f())\nexport const destructor = Symbol('destructor')\nexport const allocatedValues = Symbol('allocated')\nexport class DestructionError extends Error {\n\tstatic throw<_T = void>(msg: string) {\n\t\treturn () => {\n\t\t\tthrow new DestructionError(msg)\n\t\t}\n\t}\n\tconstructor(msg: string) {\n\t\tsuper(`Object is destroyed. ${msg}`)\n\t\tthis.name = 'DestroyedAccessError'\n\t}\n}\nconst destroyedHandler = {\n\t[Symbol.toStringTag]: 'MutTs Destroyable',\n\tget: DestructionError.throw('Cannot access destroyed object'),\n\tset: DestructionError.throw('Cannot access destroyed object'),\n} as const\n\nabstract class AbstractDestroyable<Allocated> {\n\tabstract [destructor](allocated: Allocated): void\n\t[Symbol.dispose](): void {\n\t\tthis[destructor](this as unknown as Allocated)\n\t}\n}\n\ninterface Destructor<Allocated> {\n\tdestructor(allocated: Allocated): void\n}\n\nexport function Destroyable<\n\tT extends new (\n\t\t...args: any[]\n\t) => any,\n\tAllocated extends Partial<typeof this>,\n>(\n\tbase: T,\n\tdestructorObj: Destructor<Allocated>\n): (new (\n\t...args: ConstructorParameters<T>\n) => InstanceType<T> & { [allocatedValues]: Allocated }) & {\n\tdestroy(obj: InstanceType<T>): boolean\n\tisDestroyable(obj: InstanceType<T>): boolean\n}\n\nexport function Destroyable<Allocated extends Record<PropertyKey, any> = Record<PropertyKey, any>>(\n\tdestructorObj: Destructor<Allocated>\n): (new () => { [allocatedValues]: Allocated }) & {\n\tdestroy(obj: any): boolean\n\tisDestroyable(obj: any): boolean\n}\n\nexport function Destroyable<\n\tT extends new (\n\t\t...args: any[]\n\t) => any,\n\tAllocated extends Record<PropertyKey, any> = Record<PropertyKey, any>,\n>(\n\tbase: T\n): (new (\n\t...args: ConstructorParameters<T>\n) => AbstractDestroyable<Allocated> & InstanceType<T> & { [allocatedValues]: Allocated }) & {\n\tdestroy(obj: InstanceType<T>): boolean\n\tisDestroyable(obj: InstanceType<T>): boolean\n}\n\nexport function Destroyable<\n\tAllocated extends Record<PropertyKey, any> = Record<PropertyKey, any>,\n>(): abstract new () => (AbstractDestroyable<Allocated> & {\n\t[allocatedValues]: Allocated\n}) & {\n\tdestroy(obj: any): boolean\n\tisDestroyable(obj: any): boolean\n}\n\nexport function Destroyable<\n\tT extends new (\n\t\t...args: any[]\n\t) => any,\n\tAllocated extends Record<PropertyKey, any> = Record<PropertyKey, any>,\n>(base?: T | Destructor<Allocated>, destructorObj?: Destructor<Allocated>) {\n\tif (base && typeof base !== 'function') {\n\t\tdestructorObj = base as Destructor<Allocated>\n\t\tbase = undefined\n\t}\n\tif (!base) {\n\t\tbase = class {} as T\n\t}\n\n\treturn class Destroyable extends (base as T) {\n\t\tstatic readonly destructors = new WeakMap<any, () => void>()\n\t\tstatic destroy(obj: Destroyable) {\n\t\t\tconst destructor = Destroyable.destructors.get(obj)\n\t\t\tif (!destructor) return false\n\t\t\tfr.unregister(obj)\n\t\t\tDestroyable.destructors.delete(obj)\n\t\t\tObject.setPrototypeOf(obj, new Proxy({}, destroyedHandler))\n\t\t\t// Clear all own properties\n\t\t\tfor (const key of Object.getOwnPropertyNames(obj)) {\n\t\t\t\tdelete (obj as any)[key]\n\t\t\t}\n\t\t\tdestructor()\n\t\t\treturn true\n\t\t}\n\t\tstatic isDestroyable(obj: Destroyable) {\n\t\t\treturn Destroyable.destructors.has(obj)\n\t\t}\n\n\t\tdeclare [forwardProperties]: PropertyKey[]\n\t\treadonly [allocatedValues]: Allocated\n\t\tconstructor(...args: any[]) {\n\t\t\tsuper(...args)\n\t\t\tconst allocated = {} as Allocated\n\t\t\tthis[allocatedValues] = allocated\n\t\t\t// @ts-expect-error `this` is an AbstractDestroyable\n\t\t\tconst myDestructor = destructorObj?.destructor ?? this[destructor]\n\t\t\tif (!myDestructor) {\n\t\t\t\tthrow new DestructionError('Destructor is not defined')\n\t\t\t}\n\t\t\tfunction destruction() {\n\t\t\t\tmyDestructor(allocated)\n\t\t\t}\n\t\t\tDestroyable.destructors.set(this, destruction)\n\t\t\tfr.register(this, destruction, this)\n\t\t}\n\t}\n}\n\nconst forwardProperties = Symbol('forwardProperties')\nexport const allocated = decorator({\n\tsetter(original, propertyKey) {\n\t\treturn function (value) {\n\t\t\tthis[allocatedValues][propertyKey] = value\n\t\t\treturn original.call(this, value)\n\t\t}\n\t},\n})\n\nexport function callOnGC(cb: () => void) {\n\tlet called = false\n\tconst forward = () => {\n\t\tif (called) return\n\t\tcalled = true\n\t\tcb()\n\t}\n\tfr.register(forward, cb, cb)\n\treturn forward\n}\n\n// Context Manager Protocol for `with` statement integration\nexport interface ContextManager<T = any> {\n\t[Symbol.dispose](): void\n\tvalue?: T\n}\n","export const getAt = Symbol('getAt')\nexport const setAt = Symbol('setAt')\n\ninterface IndexingAt<Items = any> {\n\t[getAt](index: number): Items\n}\n\ninterface Accessor<T, Items> {\n\tget(this: T, index: number): Items\n\tset?(this: T, index: number, value: Items): void\n\tgetLength?(this: T): number\n\tsetLength?(this: T, value: number): void\n}\n\nabstract class AbstractGetAt<Items = any> {\n\tabstract [getAt](index: number): Items\n}\n\nexport function Indexable<Items, Base extends abstract new (...args: any[]) => any>(\n\tbase: Base,\n\taccessor: Accessor<InstanceType<Base>, Items>\n): new (\n\t...args: ConstructorParameters<Base>\n) => InstanceType<Base> & { [x: number]: Items }\n\nexport function Indexable<Items>(accessor: Accessor<any, Items>): new () => { [x: number]: Items }\n\nexport function Indexable<Base extends new (...args: any[]) => IndexingAt>(\n\tbase: Base\n): new (\n\t...args: ConstructorParameters<Base>\n) => InstanceType<Base> & { [x: number]: AtReturnType<InstanceType<Base>> }\n\nexport function Indexable<Items>(): abstract new (\n\t...args: any[]\n) => AbstractGetAt & { [x: number]: Items }\n\nexport function Indexable<Items, Base extends abstract new (...args: any[]) => any>(\n\tbase?: Base | Accessor<Base, Items>,\n\taccessor?: Accessor<Base, Items>\n) {\n\tif (base && typeof base !== 'function') {\n\t\taccessor = base as Accessor<Base, Items>\n\t\tbase = undefined\n\t}\n\tif (!base) {\n\t\t//@ts-expect-error\n\t\tbase = class {} as Base\n\t}\n\tif (!accessor) {\n\t\taccessor = {\n\t\t\tget(this: any, index: number) {\n\t\t\t\tif (typeof this[getAt] !== 'function') {\n\t\t\t\t\tthrow new Error('Indexable class must have an [getAt] method')\n\t\t\t\t}\n\t\t\t\treturn this[getAt](index)\n\t\t\t},\n\t\t\tset(this: any, index: number, value: Items) {\n\t\t\t\tif (typeof this[setAt] !== 'function') {\n\t\t\t\t\tthrow new Error('Indexable class has read-only numeric index access')\n\t\t\t\t}\n\t\t\t\tthis[setAt](index, value)\n\t\t\t},\n\t\t}\n\t}\n\n\tabstract class Indexable extends (base as Base) {\n\t\t[x: number]: Items\n\t}\n\n\tObject.setPrototypeOf(\n\t\tIndexable.prototype,\n\t\tnew Proxy((base as Base).prototype, {\n\t\t\t//@ts-expect-error\n\t\t\t[Symbol.toStringTag]: 'MutTs Indexable',\n\t\t\tget(target, prop, receiver) {\n\t\t\t\tif (prop in target) {\n\t\t\t\t\tconst getter = Object.getOwnPropertyDescriptor(target, prop)?.get\n\t\t\t\t\treturn getter ? getter.call(receiver) : target[prop]\n\t\t\t\t}\n\t\t\t\tif (typeof prop === 'string') {\n\t\t\t\t\tif (prop === 'length' && accessor.getLength) return accessor.getLength.call(receiver)\n\t\t\t\t\tconst numProp = Number(prop)\n\t\t\t\t\tif (!Number.isNaN(numProp)) {\n\t\t\t\t\t\treturn accessor.get!.call(receiver, numProp) as Items\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn undefined\n\t\t\t},\n\t\t\tset(target, prop, value, receiver) {\n\t\t\t\tif (prop in target) {\n\t\t\t\t\tconst setter = Object.getOwnPropertyDescriptor(target, prop)?.set\n\t\t\t\t\tif (setter) setter.call(receiver, value)\n\t\t\t\t\telse target[prop] = value\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t\tif (typeof prop === 'string') {\n\t\t\t\t\tif (prop === 'length' && accessor.setLength) {\n\t\t\t\t\t\taccessor.setLength.call(receiver, value)\n\t\t\t\t\t\treturn true\n\t\t\t\t\t}\n\t\t\t\t\tconst numProp = Number(prop)\n\t\t\t\t\tif (!Number.isNaN(numProp)) {\n\t\t\t\t\t\tif (!accessor.set) {\n\t\t\t\t\t\t\tthrow new Error('Indexable class has read-only numeric index access')\n\t\t\t\t\t\t}\n\t\t\t\t\t\taccessor.set!.call(receiver, numProp, value)\n\t\t\t\t\t\treturn true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tObject.defineProperty(receiver, prop, {\n\t\t\t\t\tvalue,\n\t\t\t\t\twritable: true,\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t})\n\t\t\t\treturn true\n\t\t\t},\n\t\t})\n\t)\n\treturn Indexable\n}\n\ntype AtReturnType<T> = T extends { [getAt](index: number): infer R } ? R : never\n","// biome-ignore-all lint/suspicious/noConfusingVoidType: Type 'void' is not assignable to type 'ScopedCallback | undefined'.\n// Argument of type '() => void' is not assignable to parameter of type '(dep: DependencyFunction) => ScopedCallback | undefined'.\n\nimport { decorator } from '../decorator'\n\nexport type DependencyFunction = <T>(cb: () => T) => T\n// TODO: proper async management, read when fn returns a promise and let the effect as \"running\",\n// either to cancel the running one or to avoid running 2 in \"parallel\" and debounce the second one\n\n// TODO: generic \"batch\" forcing even if not in an effect (perhaps when calling a reactive' function ?)\n// example: storage will make 2 modifications (add slot, modify count), they could raise 2 effects\nexport type ScopedCallback = () => void\n\nexport type PropEvolution = {\n\ttype: 'set' | 'del' | 'add' | 'invalidate'\n\tprop: any\n}\n\nexport type BunchEvolution = {\n\ttype: 'bunch'\n\tmethod: string\n}\ntype Evolution = PropEvolution | BunchEvolution\n\ntype State =\n\t| {\n\t\t\tevolution: Evolution\n\t\t\tnext: State\n\t }\n\t| {}\n// Track which effects are watching which reactive objects for cleanup\nconst effectToReactiveObjects = new WeakMap<ScopedCallback, Set<object>>()\n\n// Track object -> proxy and proxy -> object relationships\nconst objectToProxy = new WeakMap<object, object>()\nconst proxyToObject = new WeakMap<object, object>()\n// Deep watching data structures\n// Track which objects contain which other objects (back-references)\nconst objectParents = new WeakMap<object, Set<{ parent: object; prop: PropertyKey }>>()\n\n// Track which objects have deep watchers\nconst objectsWithDeepWatchers = new WeakSet<object>()\n\n// Track deep watchers per object\nconst deepWatchers = new WeakMap<object, Set<ScopedCallback>>()\n\n// Track which effects are doing deep watching\nconst effectToDeepWatchedObjects = new WeakMap<ScopedCallback, Set<object>>()\n\n// Track objects that should never be reactive and cannot be modified\nexport const nonReactiveObjects = new WeakSet<object>()\nconst absent = Symbol('absent')\n/**\n * Converts an iterator to a generator that yields reactive values\n */\nexport function* makeReactiveIterator<T>(iterator: Iterator<T>): Generator<T> {\n\tlet result = iterator.next()\n\twhile (!result.done) {\n\t\tyield reactive(result.value)\n\t\tresult = iterator.next()\n\t}\n}\n\n/**\n * Converts an iterator of key-value pairs to a generator that yields reactive key-value pairs\n */\nexport function* makeReactiveEntriesIterator<K, V>(iterator: Iterator<[K, V]>): Generator<[K, V]> {\n\tlet result = iterator.next()\n\twhile (!result.done) {\n\t\tconst [key, value] = result.value\n\t\tyield [reactive(key), reactive(value)]\n\t\tresult = iterator.next()\n\t}\n}\n\n// Track effects per reactive object and property\nconst watchers = new WeakMap<object, Map<any, Set<ScopedCallback>>>()\n\nexport const profileInfo: any = {\n\tobjectToProxy,\n\tproxyToObject,\n\teffectToReactiveObjects,\n\twatchers,\n\tobjectParents,\n\tobjectsWithDeepWatchers,\n\tdeepWatchers,\n\teffectToDeepWatchedObjects,\n\tnonReactiveObjects,\n}\n// Track native reactivity\nconst nativeReactive = Symbol('native-reactive')\n\n// Symbol to mark individual objects as non-reactive\nexport const nonReactiveMark = Symbol('non-reactive')\n// Symbol to mark class properties as non-reactive\nexport const unreactiveProperties = Symbol('unreactive-properties')\nexport const prototypeForwarding: unique symbol = Symbol('prototype-forwarding')\n\nexport const allProps = Symbol('all-props')\n\n// Symbol to mark functions with their root function\nconst rootFunction = Symbol('root-function')\n\n/**\n * Mark a function with its root function. If the function already has a root,\n * the root becomes the root of the new root (transitive root tracking).\n * @param fn - The function to mark\n * @param root - The root function to associate with fn\n */\nexport function markWithRoot<T extends Function>(fn: T, root: Function): T {\n\t// Mark fn with the new root\n\treturn Object.defineProperty(fn, rootFunction, {\n\t\tvalue: getRoot(root),\n\t\twritable: false,\n\t})\n}\n\n/**\n * Retrieve the root function from a callback. Returns the function itself if it has no root.\n * @param fn - The function to get the root from\n * @returns The root function, or the function itself if no root exists\n */\nexport function getRoot<T extends Function | undefined>(fn: T): T {\n\treturn (fn as any)?.[rootFunction] || fn\n}\n\nexport class ReactiveError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message)\n\t\tthis.name = 'ReactiveError'\n\t}\n}\n\n// biome-ignore-start lint/correctness/noUnusedFunctionParameters: Interface declaration with empty defaults\n/**\n * Options for the reactive system, can be configured at runtime\n */\nexport const options = {\n\t/**\n\t * Debug purpose: called when an effect is entered\n\t * @param effect - The effect that is entered\n\t */\n\tenter: (effect: Function) => {},\n\t/**\n\t * Debug purpose: called when an effect is left\n\t * @param effect - The effect that is left\n\t */\n\tleave: (effect: Function) => {},\n\t/**\n\t * Debug purpose: called when an effect is chained\n\t * @param target - The effect that is being triggered\n\t * @param caller - The effect that is calling the target\n\t */\n\tchain: (target: Function, caller?: Function) => {},\n\t/**\n\t * Debug purpose: maximum effect chain (like call stack max depth)\n\t * Used to prevent infinite loops\n\t * @default 100\n\t */\n\tmaxEffectChain: 100,\n\t/**\n\t * Maximum depth for deep watching traversal\n\t * Used to prevent infinite recursion in circular references\n\t * @default 100\n\t */\n\tmaxDeepWatchDepth: 100,\n\t/**\n\t * Only react on instance members modification (not inherited properties)\n\t * For instance, do not track class methods\n\t * @default true\n\t */\n\tinstanceMembers: true,\n\t// biome-ignore lint/suspicious/noConsole: This is the whole point here\n\twarn: (...args: any[]) => console.warn(...args),\n}\n// biome-ignore-end lint/correctness/noUnusedFunctionParameters: Interface declaration with empty defaults\n\n//#region evolution\n\nfunction raiseDeps(objectWatchers: Map<any, Set<ScopedCallback>>, ...keyChains: Iterable<any>[]) {\n\tfor (const keys of keyChains)\n\t\tfor (const key of keys) {\n\t\t\tconst deps = objectWatchers.get(key)\n\t\t\tif (deps) for (const effect of Array.from(deps)) atomicEffect(effect)\n\t\t}\n}\n\nexport function touched1(obj: any, evolution: Evolution, prop: any) {\n\ttouched(obj, evolution, [prop])\n}\n\nexport function touched(obj: any, evolution: Evolution, props?: Iterable<any>) {\n\tobj = unwrap(obj)\n\taddState(obj, evolution)\n\tconst objectWatchers = watchers.get(obj)\n\tif (objectWatchers) {\n\t\tif (props) raiseDeps(objectWatchers, [allProps], props)\n\t\telse raiseDeps(objectWatchers, objectWatchers.keys())\n\t}\n\n\t// Bubble up changes if this object has deep watchers\n\tif (objectsWithDeepWatchers.has(obj)) {\n\t\tbubbleUpChange(obj, evolution)\n\t}\n}\n\nconst states = new WeakMap<object, State>()\n\nfunction addState(obj: any, evolution: Evolution) {\n\tobj = unwrap(obj)\n\tconst next = {}\n\tconst state = getState(obj)\n\tif (state) Object.assign(state, { evolution, next })\n\tstates.set(obj, next)\n}\n\nexport function getState(obj: any) {\n\tobj = unwrap(obj)\n\tlet state = states.get(obj)\n\tif (!state) {\n\t\tstate = {}\n\t\tstates.set(obj, state)\n\t}\n\treturn state\n}\n\nexport function dependant(obj: any, prop: any = allProps) {\n\tobj = unwrap(obj)\n\tif (activeEffect && (typeof prop !== 'symbol' || prop === allProps)) {\n\t\tlet objectWatchers = watchers.get(obj)\n\t\tif (!objectWatchers) {\n\t\t\tobjectWatchers = new Map<PropertyKey, Set<ScopedCallback>>()\n\t\t\twatchers.set(obj, objectWatchers)\n\t\t}\n\t\tlet deps = objectWatchers.get(prop)\n\t\tif (!deps) {\n\t\t\tdeps = new Set<ScopedCallback>()\n\t\t\tobjectWatchers.set(prop, deps)\n\t\t}\n\t\tdeps.add(activeEffect)\n\n\t\t// Track which reactive objects this effect is watching\n\t\tlet effectObjects = effectToReactiveObjects.get(activeEffect)\n\t\tif (!effectObjects) {\n\t\t\teffectObjects = new Set<object>()\n\t\t\teffectToReactiveObjects.set(activeEffect, effectObjects)\n\t\t}\n\t\teffectObjects.add(obj)\n\t}\n}\n\n// Stack of active effects to handle nested effects\nlet activeEffect: ScopedCallback | undefined\n// Parent effect used for lifecycle/cleanup relationships (can diverge later)\nlet parentEffect: ScopedCallback | undefined\n\n// Track currently executing effects to prevent re-execution\n// These are all the effects triggered under `activeEffect`\nlet batchedEffects: Map<Function, ScopedCallback> | undefined\n\n// Track which sub-effects have been executed to prevent infinite loops\n// These are all the effects triggered under `activeEffect` and all their sub-effects\nfunction atomicEffect(effect: ScopedCallback, immediate?: 'immediate') {\n\tconst root = getRoot(effect)\n\n\toptions?.chain(getRoot(effect), getRoot(activeEffect))\n\tif (batchedEffects) {\n\t\tbatchedEffects.set(root, effect)\n\t\tif (immediate)\n\t\t\ttry {\n\t\t\t\treturn effect()\n\t\t\t} finally {\n\t\t\t\tbatchedEffects.delete(root)\n\t\t\t}\n\t} else {\n\t\tconst runEffects: any[] = []\n\t\tbatchedEffects = new Map<Function, ScopedCallback>([[root, effect]])\n\t\tconst firstReturn: { value?: any } = {}\n\t\ttry {\n\t\t\twhile (batchedEffects.size) {\n\t\t\t\tif (runEffects.length > options.maxEffectChain)\n\t\t\t\t\tthrow new ReactiveError('[reactive] Max effect chain reached')\n\t\t\t\tconst [root, effect] = batchedEffects.entries().next().value!\n\t\t\t\trunEffects.push(root)\n\t\t\t\tconst rv = effect()\n\t\t\t\tif (!('value' in firstReturn)) firstReturn.value = rv\n\t\t\t\tbatchedEffects.delete(root)\n\t\t\t}\n\t\t\treturn firstReturn.value\n\t\t} finally {\n\t\t\tbatchedEffects = undefined\n\t\t}\n\t}\n}\n\nexport const atomic = decorator({\n\tmethod(original) {\n\t\treturn function (...args: any[]) {\n\t\t\treturn atomicEffect(\n\t\t\t\tmarkWithRoot(() => original.apply(this, args), original),\n\t\t\t\t'immediate'\n\t\t\t)\n\t\t}\n\t},\n\tdefault<Args extends any[], Return>(\n\t\toriginal: (...args: Args) => Return\n\t): (...args: Args) => Return {\n\t\treturn function (...args: Args) {\n\t\t\treturn atomicEffect(\n\t\t\t\tmarkWithRoot(() => original.apply(this, args), original),\n\t\t\t\t'immediate'\n\t\t\t)\n\t\t}\n\t},\n})\n\nexport function withEffect<T>(\n\teffect: ScopedCallback | undefined,\n\tfn: () => T,\n\tkeepParent?: true\n): T {\n\tif (getRoot(effect) === getRoot(activeEffect)) return fn()\n\tconst oldActiveEffect = activeEffect\n\tconst oldParentEffect = parentEffect\n\tactiveEffect = effect\n\tif (!keepParent) parentEffect = effect\n\ttry {\n\t\treturn fn()\n\t} finally {\n\t\tactiveEffect = oldActiveEffect\n\t\tparentEffect = oldParentEffect\n\t}\n}\n\n//#endregion\n\n//#region deep watching\n\n/**\n * Add a back-reference from child to parent\n */\nfunction addBackReference(child: object, parent: object, prop: any) {\n\tlet parents = objectParents.get(child)\n\tif (!parents) {\n\t\tparents = new Set()\n\t\tobjectParents.set(child, parents)\n\t}\n\tparents.add({ parent, prop })\n}\n\n/**\n * Remove a back-reference from child to parent\n */\nfunction removeBackReference(child: object, parent: object, prop: any) {\n\tconst parents = objectParents.get(child)\n\tif (parents) {\n\t\tparents.delete({ parent, prop })\n\t\tif (parents.size === 0) {\n\t\t\tobjectParents.delete(child)\n\t\t}\n\t}\n}\n\n/**\n * Check if an object needs back-references (has deep watchers or parents with deep watchers)\n */\nfunction needsBackReferences(obj: object): boolean {\n\treturn objectsWithDeepWatchers.has(obj) || hasParentWithDeepWatchers(obj)\n}\n\n/**\n * Check if an object has any parent with deep watchers\n */\nfunction hasParentWithDeepWatchers(obj: object): boolean {\n\tconst parents = objectParents.get(obj)\n\tif (!parents) return false\n\n\tfor (const { parent } of parents) {\n\t\tif (objectsWithDeepWatchers.has(parent)) return true\n\t\tif (hasParentWithDeepWatchers(parent)) return true\n\t}\n\treturn false\n}\n\n/**\n * Bubble up changes through the back-reference chain\n */\nfunction bubbleUpChange(changedObject: object, evolution: Evolution) {\n\tconst parents = objectParents.get(changedObject)\n\tif (!parents) return\n\n\tfor (const { parent } of parents) {\n\t\t// Trigger deep watchers on parent\n\t\tconst parentDeepWatchers = deepWatchers.get(parent)\n\t\tif (parentDeepWatchers) for (const watcher of parentDeepWatchers) atomicEffect(watcher)\n\n\t\t// Continue bubbling up\n\t\tbubbleUpChange(parent, evolution)\n\t}\n}\n\nexport function track1(obj: object, prop: any, oldVal: any, newValue: any) {\n\t// Manage back-references if this object has deep watchers\n\tif (objectsWithDeepWatchers.has(obj)) {\n\t\t// Remove old back-references\n\t\tif (typeof oldVal === 'object' && oldVal !== null) {\n\t\t\tremoveBackReference(oldVal, obj, prop)\n\t\t}\n\n\t\t// Add new back-references\n\t\tif (typeof newValue === 'object' && newValue !== null) {\n\t\t\tconst reactiveValue = reactive(newValue)\n\t\t\taddBackReference(reactiveValue, obj, prop)\n\t\t}\n\t}\n\treturn newValue\n}\n\n//#endregion\n\nconst reactiveHandlers = {\n\t[Symbol.toStringTag]: 'MutTs Reactive',\n\tget(obj: any, prop: PropertyKey, receiver: any) {\n\t\tif (prop === nonReactiveMark) return false\n\t\t// Check if this property is marked as unreactive\n\t\tif (obj[unreactiveProperties]?.has(prop) || typeof prop === 'symbol')\n\t\t\treturn Reflect.get(obj, prop, receiver)\n\t\t// Depend if...\n\t\tif (!options.instanceMembers || Object.hasOwn(receiver, prop) || !Reflect.has(receiver, prop))\n\t\t\tdependant(obj, prop)\n\n\t\tconst value = Reflect.get(obj, prop, receiver)\n\t\tif (typeof value === 'object' && value !== null) {\n\t\t\tconst reactiveValue = reactive(value)\n\n\t\t\t// Only create back-references if this object needs them\n\t\t\tif (needsBackReferences(obj)) {\n\t\t\t\taddBackReference(reactiveValue, obj, prop)\n\t\t\t}\n\n\t\t\treturn reactiveValue\n\t\t}\n\t\treturn value\n\t},\n\tset(obj: any, prop: PropertyKey, value: any, receiver: any): boolean {\n\t\t// Check if this property is marked as unreactive\n\t\tif (obj[unreactiveProperties]?.has(prop)) return Reflect.set(obj, prop, value, receiver)\n\t\t// Really specific case for when Array is forwarder, in order to let it manage the reactivity\n\t\tconst isArrayCase =\n\t\t\tprototypeForwarding in obj &&\n\t\t\t// biome-ignore lint/suspicious/useIsArray: This is the whole point here\n\t\t\tobj[prototypeForwarding] instanceof Array &&\n\t\t\t(!Number.isNaN(Number(prop)) || prop === 'length')\n\t\tconst newValue = unwrap(value)\n\n\t\tif (isArrayCase) {\n\t\t\t;(obj as any)[prop] = newValue\n\t\t\treturn true\n\t\t}\n\n\t\tconst oldVal = Reflect.has(receiver, prop) ? Reflect.get(obj, prop, receiver) : absent\n\t\ttrack1(obj, prop, oldVal, newValue)\n\n\t\tif (oldVal !== newValue) {\n\t\t\tReflect.set(obj, prop, newValue, receiver)\n\t\t\t// try to find a \"generic\" way to express that\n\t\t\ttouched1(obj, { type: oldVal !== absent ? 'set' : 'add', prop }, prop)\n\t\t}\n\t\treturn true\n\t},\n\tdeleteProperty(obj: any, prop: PropertyKey): boolean {\n\t\tif (!Object.hasOwn(obj, prop)) return false\n\n\t\tconst oldVal = (obj as any)[prop]\n\n\t\t// Remove back-references if this object has deep watchers\n\t\tif (objectsWithDeepWatchers.has(obj) && typeof oldVal === 'object' && oldVal !== null) {\n\t\t\tremoveBackReference(oldVal, obj, prop)\n\t\t}\n\n\t\tdelete (obj as any)[prop]\n\t\ttouched1(obj, { type: 'del', prop }, prop)\n\n\t\t// Bubble up changes if this object has deep watchers\n\t\tif (objectsWithDeepWatchers.has(obj)) {\n\t\t\tbubbleUpChange(obj, { type: 'del', prop })\n\t\t}\n\n\t\treturn true\n\t},\n\tgetPrototypeOf(obj: any): object | null {\n\t\tif (prototypeForwarding in obj) return obj[prototypeForwarding]\n\t\treturn Object.getPrototypeOf(obj)\n\t},\n\tsetPrototypeOf(obj: any, proto: object | null): boolean {\n\t\tif (prototypeForwarding in obj) return false\n\t\tObject.setPrototypeOf(obj, proto)\n\t\treturn true\n\t},\n\townKeys(obj: any): (string | symbol)[] {\n\t\tdependant(obj, allProps)\n\t\treturn Reflect.ownKeys(obj)\n\t},\n} as const\n\nconst reactiveClasses = new WeakSet<Function>()\nexport class ReactiveBase {\n\tconstructor() {\n\t\t// biome-ignore lint/correctness/noConstructorReturn: This is the whole point here\n\t\treturn reactiveClasses.has(new.target) ? reactive(this) : this\n\t}\n}\n\nfunction reactiveObject<T>(anyTarget: T): T {\n\tif (!anyTarget || typeof anyTarget !== 'object') return anyTarget\n\tconst target = anyTarget as any\n\t// If target is already a proxy, return it\n\tif (proxyToObject.has(target) || isNonReactive(target)) return target as T\n\n\t// If we already have a proxy for this object, return it\n\tif (objectToProxy.has(target)) return objectToProxy.get(target) as T\n\n\tconst proxied =\n\t\tnativeReactive in target && !(target instanceof target[nativeReactive])\n\t\t\t? new target[nativeReactive](target)\n\t\t\t: target\n\tif (proxied !== target) proxyToObject.set(proxied, target)\n\tconst proxy = new Proxy(proxied, reactiveHandlers)\n\n\t// Store the relationships\n\tobjectToProxy.set(target, proxy)\n\tproxyToObject.set(proxy, target)\n\treturn proxy as T\n}\n\nexport const reactive = decorator({\n\tclass(original) {\n\t\tif (original.prototype instanceof ReactiveBase) {\n\t\t\treactiveClasses.add(original)\n\t\t\treturn original\n\t\t}\n\t\tclass Reactive extends original {\n\t\t\tconstructor(...args: any[]) {\n\t\t\t\tsuper(...args)\n\t\t\t\tif (new.target !== Reactive && !reactiveClasses.has(new.target))\n\t\t\t\t\toptions.warn(\n\t\t\t\t\t\t`${(original as any).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.`\n\t\t\t\t\t)\n\t\t\t\t// biome-ignore lint/correctness/noConstructorReturn: This is the whole point here\n\t\t\t\treturn reactive(this)\n\t\t\t}\n\t\t}\n\t\tObject.defineProperty(Reactive, 'name', {\n\t\t\tvalue: `Reactive<${original.name}>`,\n\t\t})\n\t\treturn Reactive as any\n\t},\n\tget(original) {\n\t\treturn reactiveObject(original)\n\t},\n\tdefault: reactiveObject,\n})\n\nexport function unwrap<T>(proxy: T): T {\n\t// Return the original object\n\treturn (proxyToObject.get(proxy as any) as T) ?? proxy\n}\n\nexport function isReactive(obj: any): boolean {\n\treturn proxyToObject.has(obj)\n}\nexport function untracked(fn: () => ScopedCallback | undefined | void) {\n\twithEffect(undefined, fn, true)\n}\n\n// runEffect -> set<cleanup>\nconst effectChildren = new WeakMap<ScopedCallback, Set<ScopedCallback>>()\nconst fr = new FinalizationRegistry<() => void>((f) => f())\n\n/**\n * @param fn - The effect function to run - provides the cleaner\n * @returns The cleanup function\n */\nexport function effect<Args extends any[]>(\n\tfn: (dep: DependencyFunction, ...args: Args) => ScopedCallback | undefined | void,\n\t...args: Args\n): ScopedCallback {\n\tlet cleanup: (() => void) | null = null\n\tconst dep = markWithRoot(<T>(cb: () => T) => withEffect(runEffect, cb), fn)\n\tlet effectStopped = false\n\n\tfunction runEffect() {\n\t\t// Clear previous dependencies\n\t\tcleanup?.()\n\n\t\toptions.enter(fn)\n\t\tconst reactionCleanup = withEffect(effectStopped ? undefined : runEffect, () =>\n\t\t\tfn(dep, ...args)\n\t\t) as undefined | ScopedCallback\n\t\toptions.leave(fn)\n\n\t\t// Create cleanup function for next run\n\t\tcleanup = () => {\n\t\t\tcleanup = null\n\t\t\treactionCleanup?.()\n\t\t\t// Remove this effect from all reactive objects it's watching\n\t\t\tconst effectObjects = effectToReactiveObjects.get(runEffect)\n\t\t\tif (effectObjects) {\n\t\t\t\tfor (const reactiveObj of effectObjects) {\n\t\t\t\t\tconst objectWatchers = watchers.get(reactiveObj)\n\t\t\t\t\tif (objectWatchers) {\n\t\t\t\t\t\tfor (const [prop, deps] of objectWatchers.entries()) {\n\t\t\t\t\t\t\tdeps.delete(runEffect)\n\t\t\t\t\t\t\tif (deps.size === 0) {\n\t\t\t\t\t\t\t\tobjectWatchers.delete(prop)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (objectWatchers.size === 0) {\n\t\t\t\t\t\t\twatchers.delete(reactiveObj)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\teffectToReactiveObjects.delete(runEffect)\n\t\t\t}\n\t\t}\n\t}\n\t// Mark the runEffect callback with the original function as its root\n\tmarkWithRoot(runEffect, fn)\n\n\tatomicEffect(runEffect, 'immediate')\n\n\tconst mainCleanup = (): void => {\n\t\tif (effectStopped) return\n\t\teffectStopped = true\n\t\tcleanup?.()\n\t\t// Invoke all child cleanups (recursive via subEffectCleanup calling its own mainCleanup)\n\t\tconst children = effectChildren.get(runEffect)\n\t\tif (children) {\n\t\t\tfor (const childCleanup of children) childCleanup()\n\t\t\teffectChildren.delete(runEffect)\n\t\t}\n\n\t\tfr.unregister(mainCleanup)\n\t}\n\n\t// Only ROOT effects are registered for GC cleanup\n\tif (!parentEffect) {\n\t\tconst callIfCollected = () => mainCleanup()\n\t\tfr.register(callIfCollected, mainCleanup, callIfCollected)\n\t\treturn callIfCollected\n\t}\n\t// Register this effect to be cleaned up with the parent effect\n\tlet children = effectChildren.get(parentEffect)\n\tif (!children) {\n\t\tchildren = new Set()\n\t\teffectChildren.set(parentEffect, children)\n\t}\n\tconst parent = parentEffect\n\tconst subEffectCleanup = (): void => {\n\t\tchildren.delete(subEffectCleanup)\n\t\tif (children.size === 0) {\n\t\t\teffectChildren.delete(parent)\n\t\t}\n\t\t// Execute this child effect cleanup (which triggers its own mainCleanup)\n\t\tmainCleanup()\n\t}\n\tchildren.add(subEffectCleanup)\n\treturn subEffectCleanup\n}\n\n/**\n * Mark an object as non-reactive. This object and all its properties will never be made reactive.\n * @param obj - The object to mark as non-reactive\n */\nfunction nonReactive<T extends object[]>(...obj: T): T[0] {\n\tfor (const o of obj) {\n\t\ttry {\n\t\t\tObject.defineProperty(o, nonReactiveMark, {\n\t\t\t\tvalue: true,\n\t\t\t\twritable: false,\n\t\t\t\tenumerable: false,\n\t\t\t\tconfigurable: false,\n\t\t\t})\n\t\t} catch {}\n\t\tif (!(nonReactiveMark in (o as object))) nonReactiveObjects.add(o as object)\n\t}\n\treturn obj[0]\n}\n\n/**\n * Set of functions to test if an object is immutable\n */\nexport const immutables = new Set<(tested: any) => boolean>()\n\n/**\n * Check if an object is marked as non-reactive (for testing purposes)\n * @param obj - The object to check\n * @returns true if the object is marked as non-reactive\n */\nexport function isNonReactive(obj: any): boolean {\n\t// Don't make primitives reactive\n\tif (obj === null || typeof obj !== 'object') return true\n\n\t// Check if the object itself is marked as non-reactive\n\tif (nonReactiveObjects.has(obj)) return true\n\n\t// Check if the object has the non-reactive symbol\n\tif (obj[nonReactiveMark]) return true\n\n\t// Check if the object is immutable\n\tif (Array.from(immutables).some((fn) => fn(obj))) return true\n\n\treturn false\n}\n\n/**\n * Mark a class as non-reactive. All instances of this class will automatically be non-reactive.\n * @param cls - The class constructor to mark as non-reactive\n */\nexport function nonReactiveClass<T extends (new (...args: any[]) => any)[]>(...cls: T): T[0] {\n\tfor (const c of cls) if (c) (c.prototype as any)[nonReactiveMark] = true\n\treturn cls[0]\n}\n\nnonReactiveClass(Date, RegExp, Error, Promise, Function)\nif (typeof window !== 'undefined') nonReactive(window, document)\nif (typeof Element !== 'undefined') nonReactiveClass(Element, Node)\n\nexport function registerNativeReactivity(\n\toriginalClass: new (...args: any[]) => any,\n\treactiveClass: new (...args: any[]) => any\n) {\n\toriginalClass.prototype[nativeReactive] = reactiveClass\n\tnonReactiveClass(reactiveClass)\n}\n\n/**\n * Deep watch an object and all its nested properties\n * @param target - The object to watch deeply\n * @param callback - The callback to call when any nested property changes\n * @param options - Options for the deep watch\n * @returns A cleanup function to stop watching\n */\nexport function deepWatch<T extends object>(\n\ttarget: T,\n\tcallback: (value: T) => void,\n\t{ immediate = false } = {}\n): (() => void) | undefined {\n\tif (target === null || target === undefined) return undefined\n\tif (typeof target !== 'object') throw new Error('Target of deep watching must be an object')\n\t// Create a wrapper callback that matches ScopedCallback signature\n\tconst wrappedCallback: ScopedCallback = markWithRoot(() => callback(target), callback)\n\n\t// Use the existing effect system to register dependencies\n\treturn effect(() => {\n\t\t// Mark the target object as having deep watchers\n\t\tobjectsWithDeepWatchers.add(target)\n\n\t\t// Track which objects this effect is watching for cleanup\n\t\tlet effectObjects = effectToDeepWatchedObjects.get(wrappedCallback)\n\t\tif (!effectObjects) {\n\t\t\teffectObjects = new Set()\n\t\t\teffectToDeepWatchedObjects.set(wrappedCallback, effectObjects)\n\t\t}\n\t\teffectObjects!.add(target)\n\n\t\t// Traverse the object graph and register dependencies\n\t\t// This will re-run every time the effect runs, ensuring we catch all changes\n\t\tconst visited = new WeakSet()\n\t\tfunction traverseAndTrack(obj: any, depth = 0) {\n\t\t\t// Prevent infinite recursion and excessive depth\n\t\t\tif (visited.has(obj) || !isObject(obj) || depth > options.maxDeepWatchDepth) return\n\t\t\t// Do not traverse into unreactive objects\n\t\t\tif (isNonReactive(obj)) return\n\t\t\tvisited.add(obj)\n\n\t\t\t// Mark this object as having deep watchers\n\t\t\tobjectsWithDeepWatchers.add(obj)\n\t\t\teffectObjects!.add(obj)\n\n\t\t\t// Traverse all properties to register dependencies\n\t\t\t// unwrap to avoid kicking dependency\n\t\t\tfor (const key in unwrap(obj)) {\n\t\t\t\tif (Object.hasOwn(obj, key)) {\n\t\t\t\t\t// Access the property to register dependency\n\t\t\t\t\tconst value = (obj as any)[key]\n\t\t\t\t\t// Make the value reactive if it's an object\n\t\t\t\t\tconst reactiveValue =\n\t\t\t\t\t\ttypeof value === 'object' && value !== null ? reactive(value) : value\n\t\t\t\t\ttraverseAndTrack(reactiveValue, depth + 1)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Also handle array indices and length\n\t\t\t// biome-ignore lint/suspicious/useIsArray: Check for both native arrays and reactive arrays\n\t\t\tif (Array.isArray(obj) || obj instanceof Array) {\n\t\t\t\t// Access array length to register dependency on length changes\n\t\t\t\tconst length = obj.length\n\n\t\t\t\t// Access all current array elements to register dependencies\n\t\t\t\tfor (let i = 0; i < length; i++) {\n\t\t\t\t\t// Access the array element to register dependency\n\t\t\t\t\tconst value = obj[i]\n\t\t\t\t\t// Make the value reactive if it's an object\n\t\t\t\t\tconst reactiveValue =\n\t\t\t\t\t\ttypeof value === 'object' && value !== null ? reactive(value) : value\n\t\t\t\t\ttraverseAndTrack(reactiveValue, depth + 1)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Handle Set values (deep watch values only, not keys since Sets don't have separate keys)\n\t\t\telse if (obj instanceof Set) {\n\t\t\t\t// Access all Set values to register dependencies\n\t\t\t\tfor (const value of obj) {\n\t\t\t\t\t// Make the value reactive if it's an object\n\t\t\t\t\tconst reactiveValue =\n\t\t\t\t\t\ttypeof value === 'object' && value !== null ? reactive(value) : value\n\t\t\t\t\ttraverseAndTrack(reactiveValue, depth + 1)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Handle Map values (deep watch values only, not keys)\n\t\t\telse if (obj instanceof Map) {\n\t\t\t\t// Access all Map values to register dependencies\n\t\t\t\tfor (const [_key, value] of obj) {\n\t\t\t\t\t// Make the value reactive if it's an object\n\t\t\t\t\tconst reactiveValue =\n\t\t\t\t\t\ttypeof value === 'object' && value !== null ? reactive(value) : value\n\t\t\t\t\ttraverseAndTrack(reactiveValue, depth + 1)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Note: WeakSet and WeakMap cannot be iterated, so we can't deep watch their contents\n\t\t\t// They will only trigger when the collection itself is replaced\n\t\t}\n\n\t\t// Traverse the target object to register all dependencies\n\t\t// This will register dependencies on all current properties and array elements\n\t\ttraverseAndTrack(target)\n\n\t\t// Only call the callback if immediate is true or if it's not the first run\n\t\tif (immediate) callback(target)\n\t\timmediate = true\n\n\t\t// Return a cleanup function that properly removes deep watcher tracking\n\t\treturn () => {\n\t\t\t// Get the objects this effect was watching\n\t\t\tconst effectObjects = effectToDeepWatchedObjects.get(wrappedCallback)\n\t\t\tif (effectObjects) {\n\t\t\t\t// Remove deep watcher tracking from all objects this effect was watching\n\t\t\t\tfor (const obj of effectObjects) {\n\t\t\t\t\t// Check if this object still has other deep watchers\n\t\t\t\t\tconst watchers = deepWatchers.get(obj)\n\t\t\t\t\tif (watchers) {\n\t\t\t\t\t\t// Remove this effect's callback from the watchers\n\t\t\t\t\t\twatchers.delete(wrappedCallback)\n\n\t\t\t\t\t\t// If no more watchers, remove the object from deep watchers tracking\n\t\t\t\t\t\tif (watchers.size === 0) {\n\t\t\t\t\t\t\tdeepWatchers.delete(obj)\n\t\t\t\t\t\t\tobjectsWithDeepWatchers.delete(obj)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// No watchers found, remove from deep watchers tracking\n\t\t\t\t\t\tobjectsWithDeepWatchers.delete(obj)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Clean up the tracking data\n\t\t\t\teffectToDeepWatchedObjects.delete(wrappedCallback)\n\t\t\t}\n\t\t}\n\t})\n}\n\n/**\n * Check if an object is an object (not null, not primitive)\n */\nfunction isObject(obj: any): obj is object {\n\treturn obj !== null && typeof obj === 'object'\n}\n","import { decorator, GenericClassDecorator } from '../decorator'\nimport { renamed } from '../utils'\nimport {\n\ttype DependencyFunction,\n\tdeepWatch,\n\tdependant,\n\teffect,\n\tgetRoot,\n\tisNonReactive,\n\tmarkWithRoot,\n\tnonReactiveClass,\n\tnonReactiveMark,\n\tnonReactiveObjects,\n\toptions,\n\ttype ScopedCallback,\n\ttouched1,\n\tunreactiveProperties,\n\tuntracked,\n\tunwrap,\n} from './core'\n\n//#region computed\nlet computedInvalidations: (() => void)[] | undefined\n/**\n * When used in a computed property computation, it will register the callback to be called when the computed property is invalidated\n * @param cb - The callback to register\n * @param warn - Whether to warn if used outside of a computed property\n */\nexport function invalidateComputed(cb: () => void, warn = true) {\n\tif (computedInvalidations) computedInvalidations.push(cb)\n\telse if (warn) options.warn('Using `invalidateComputed` outside of a computed property')\n}\ntype ComputedFunction<T> = (dep: DependencyFunction) => T\nconst computedCache = new WeakMap<ComputedFunction<any>, any>()\nfunction computedFunction<T>(getter: ComputedFunction<T>): T {\n\tconst key = getRoot(getter)\n\tlet invalidations: (() => void)[] = []\n\tdependant(computedCache, key)\n\tif (computedCache.has(key)) return computedCache.get(key)\n\tlet stopped = false\n\tconst stop = effect(\n\t\tmarkWithRoot((dep) => {\n\t\t\tif (stopped) return\n\t\t\tconst oldCI = computedInvalidations\n\t\t\tif (computedCache.has(key)) {\n\t\t\t\t// This should *not* be called in the cleanup chain, as its effects would be lost and cleaned-up\n\t\t\t\tfor (const cb of invalidations) cb()\n\t\t\t\tinvalidations = []\n\t\t\t\tcomputedCache.delete(key)\n\t\t\t\ttouched1(computedCache, { type: 'invalidate', prop: key }, key)\n\t\t\t\tstop()\n\t\t\t\tstopped = true\n\t\t\t} else\n\t\t\t\ttry {\n\t\t\t\t\tcomputedInvalidations = invalidations\n\t\t\t\t\tcomputedCache.set(key, getter(dep))\n\t\t\t\t} finally {\n\t\t\t\t\tcomputedInvalidations = oldCI\n\t\t\t\t}\n\t\t}, getter)\n\t)\n\treturn computedCache.get(key)\n}\n\n/**\n * Get the cached value of a computed function - cache is invalidated when the dependencies change\n */\nexport const computed = decorator({\n\tgetter(original, propertyKey) {\n\t\tconst computers = new WeakMap<any, () => any>()\n\t\treturn function (this: any) {\n\t\t\tif (!computers.has(this)) {\n\t\t\t\tcomputers.set(\n\t\t\t\t\tthis,\n\t\t\t\t\trenamed(\n\t\t\t\t\t\t() => original.call(this),\n\t\t\t\t\t\t`${String(this.constructor.name)}.${String(propertyKey)}`\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn computedFunction(computers.get(this)!)\n\t\t}\n\t},\n\tdefault<T>(getter: ComputedFunction<T>): T {\n\t\treturn computedFunction(getter)\n\t},\n})\n\n//#endregion\n\n//#region watch\n\nconst unsetYet = Symbol('unset-yet')\nexport interface WatchOptions {\n\timmediate?: boolean\n\tdeep?: boolean\n}\nexport function watch<T>(\n\tvalue: (dep: DependencyFunction) => T,\n\tchanged: (value: T, oldValue?: T) => void,\n\toptions?: Omit<WatchOptions, 'deep'> & { deep?: false }\n): ScopedCallback\nexport function watch<T extends object | any[]>(\n\tvalue: (dep: DependencyFunction) => T,\n\tchanged: (value: T, oldValue?: T) => void,\n\toptions?: Omit<WatchOptions, 'deep'> & { deep: true }\n): ScopedCallback\nexport function watch<T extends object | any[]>(\n\tvalue: T,\n\tchanged: (value: T) => void,\n\toptions?: WatchOptions\n): ScopedCallback\n\nexport function watch(\n\tvalue: any, //object | ((dep: DependencyFunction) => object),\n\tchanged: (value?: object, oldValue?: object) => void,\n\toptions: any = {}\n) {\n\treturn typeof value === 'function'\n\t\t? watchCallBack(value, changed, options)\n\t\t: typeof value === 'object'\n\t\t\t? watchObject(value, changed, options)\n\t\t\t: (() => {\n\t\t\t\t\tthrow new Error('watch: value must be a function or an object')\n\t\t\t\t})()\n}\n\nfunction watchObject(\n\tvalue: object,\n\tchanged: (value: object) => void,\n\t{ immediate = false, deep = false } = {}\n): ScopedCallback {\n\tif (deep) return deepWatch(value, changed, { immediate })\n\treturn effect(\n\t\tmarkWithRoot(() => {\n\t\t\tdependant(value)\n\t\t\tif (immediate) untracked(() => changed(value))\n\t\t\timmediate = true\n\t\t}, changed)\n\t)\n}\n\nfunction watchCallBack<T>(\n\tvalue: (dep: DependencyFunction) => T,\n\tchanged: (value: T, oldValue?: T) => void,\n\t{ immediate = false, deep = false } = {}\n): ScopedCallback {\n\tlet oldValue: T | typeof unsetYet = unsetYet\n\tlet deepCleanup: ScopedCallback | undefined\n\tconst cbCleanup = effect(\n\t\tmarkWithRoot((dep) => {\n\t\t\tconst newValue = value(dep)\n\t\t\tif (oldValue !== newValue)\n\t\t\t\tuntracked(\n\t\t\t\t\tmarkWithRoot(() => {\n\t\t\t\t\t\tif (oldValue === unsetYet) {\n\t\t\t\t\t\t\tif (immediate) changed(newValue)\n\t\t\t\t\t\t} else changed(newValue, oldValue)\n\t\t\t\t\t\toldValue = newValue\n\t\t\t\t\t\tif (deep) {\n\t\t\t\t\t\t\tif (deepCleanup) deepCleanup()\n\t\t\t\t\t\t\tdeepCleanup = deepWatch(\n\t\t\t\t\t\t\t\tnewValue as object,\n\t\t\t\t\t\t\t\tmarkWithRoot((value) => changed(value as T, value as T), changed)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t}, changed)\n\t\t\t\t)\n\t\t}, value)\n\t)\n\treturn () => {\n\t\tcbCleanup()\n\t\tif (deepCleanup) deepCleanup()\n\t}\n}\n\n//#endregion\n\n//#region nonReactive\n\n/**\n * Mark an object as non-reactive. This object and all its properties will never be made reactive.\n * @param obj - The object to mark as non-reactive\n */\nfunction deepNonReactive<T>(obj: T): T {\n\tobj = unwrap(obj)\n\tif (isNonReactive(obj)) return obj\n\ttry {\n\t\tObject.defineProperty(obj as object, nonReactiveMark, {\n\t\t\tvalue: true,\n\t\t\twritable: false,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: true,\n\t\t})\n\t} catch {}\n\tif (!(nonReactiveMark in (obj as object))) nonReactiveObjects.add(obj as object)\n\tfor (const key in obj) deepNonReactive(obj[key])\n\treturn obj\n}\nfunction unreactiveApplication<T extends object>(...args: (keyof T)[]): GenericClassDecorator<T>\nfunction unreactiveApplication<T extends object>(obj: T): T\nfunction unreactiveApplication<T extends object>(\n\targ1: T | keyof T,\n\t...args: (keyof T)[]\n): GenericClassDecorator<T> | T {\n\treturn typeof arg1 === 'object'\n\t\t? deepNonReactive(arg1)\n\t\t: (((original) => {\n\t\t\t\t// Copy the parent's unreactive properties if they exist\n\t\t\t\toriginal.prototype[unreactiveProperties] = new Set<PropertyKey>(\n\t\t\t\t\toriginal.prototype[unreactiveProperties] || []\n\t\t\t\t)\n\t\t\t\t// Add all arguments (including the first one)\n\t\t\t\toriginal.prototype[unreactiveProperties].add(arg1)\n\t\t\t\tfor (const arg of args) original.prototype[unreactiveProperties].add(arg)\n\t\t\t\treturn original // Return the class\n\t\t\t}) as GenericClassDecorator<T>)\n}\nexport const unreactive = decorator({\n\tclass(original) {\n\t\t// Called without arguments, mark entire class as non-reactive\n\t\tnonReactiveClass(original)\n\t},\n\tdefault: unreactiveApplication,\n})\n\n//#endregion\n\nimport { profileInfo } from './core'\n\nObject.assign(profileInfo, { computedCache })\n","import { Indexable } from '../indexable'\nimport {\n\tdependant,\n\tmakeReactiveEntriesIterator,\n\tmakeReactiveIterator,\n\tprototypeForwarding,\n\treactive,\n\ttouched,\n} from './core'\n\nconst native = Symbol('native')\nconst isArray = Array.isArray\nArray.isArray = ((value: any) =>\n\t// biome-ignore lint/suspicious/useIsArray: We are defining it\n\tisArray(value) || (value instanceof Array && native in value)) as any\nclass ReactiveBaseArray {\n\tdeclare readonly [native]: any[]\n}\nfunction* index(i: number, { length = true } = {}): IterableIterator<number | 'length'> {\n\tyield i\n\tif (length) yield 'length'\n}\n\nfunction* range(\n\ta: number,\n\tb: number,\n\t{ length = false } = {}\n): IterableIterator<number | 'length'> {\n\tconst start = Math.min(a, b)\n\tconst end = Math.max(a, b)\n\tfor (let i = start; i <= end; i++) yield i\n\tif (length) yield 'length'\n}\nexport class ReactiveArray extends Indexable(ReactiveBaseArray, {\n\tget(i: number): any {\n\t\tdependant(this[native], i)\n\t\treturn reactive(this[native][i])\n\t},\n\tset(i: number, value: any) {\n\t\tconst added = i >= this[native].length\n\t\tthis[native][i] = value\n\t\ttouched(this[native], { type: 'bunch', method: 'set' }, index(i, { length: added }))\n\t},\n\tgetLength() {\n\t\tdependant(this[native], 'length')\n\t\treturn this[native].length\n\t},\n\tsetLength(value: number) {\n\t\tconst oldLength = this[native].length\n\t\ttry {\n\t\t\tthis[native].length = value\n\t\t} finally {\n\t\t\ttouched(\n\t\t\t\tthis[native],\n\t\t\t\t{ type: 'set', prop: 'length' },\n\t\t\t\trange(oldLength, value, { length: true })\n\t\t\t)\n\t\t}\n\t},\n}) {\n\tdeclare length: number\n\tconstructor(original: any[]) {\n\t\tsuper()\n\t\tObject.defineProperties(this, {\n\t\t\t// We have to make it double, as [native] must be `unique symbol` - impossible through import\n\t\t\t[native]: { value: original },\n\t\t\t[prototypeForwarding]: { value: original },\n\t\t})\n\t}\n\n\t// Safe array access with negative indices\n\tat(index: number): any {\n\t\tconst actualIndex = index < 0 ? this[native].length + index : index\n\t\tdependant(this, actualIndex)\n\t\tif (actualIndex < 0 || actualIndex >= this[native].length) return undefined\n\t\treturn reactive(this[native][actualIndex])\n\t}\n\n\tpush(...items: any[]) {\n\t\tconst oldLength = this[native].length\n\t\ttry {\n\t\t\treturn this[native].push(...items)\n\t\t} finally {\n\t\t\ttouched(\n\t\t\t\tthis,\n\t\t\t\t{ type: 'bunch', method: 'push' },\n\t\t\t\trange(oldLength, oldLength + items.length - 1, { length: true })\n\t\t\t)\n\t\t}\n\t}\n\n\tpop() {\n\t\tif (this[native].length === 0) return undefined\n\t\ttry {\n\t\t\treturn reactive(this[native].pop())\n\t\t} finally {\n\t\t\ttouched(this, { type: 'bunch', method: 'pop' }, index(this[native].length))\n\t\t}\n\t}\n\n\tshift() {\n\t\tif (this[native].length === 0) return undefined\n\t\ttry {\n\t\t\treturn reactive(this[native].shift())\n\t\t} finally {\n\t\t\ttouched(\n\t\t\t\tthis,\n\t\t\t\t{ type: 'bunch', method: 'shift' },\n\t\t\t\trange(0, this[native].length + 1, { length: true })\n\t\t\t)\n\t\t}\n\t}\n\n\tunshift(...items: any[]) {\n\t\ttry {\n\t\t\treturn this[native].unshift(...items)\n\t\t} finally {\n\t\t\ttouched(\n\t\t\t\tthis,\n\t\t\t\t{ type: 'bunch', method: 'unshift' },\n\t\t\t\trange(0, this[native].length - items.length, { length: true })\n\t\t\t)\n\t\t}\n\t}\n\n\tsplice(start: number, deleteCount?: number, ...items: any[]) {\n\t\tconst oldLength = this[native].length\n\t\tif (deleteCount === undefined) deleteCount = oldLength - start\n\t\ttry {\n\t\t\tif (deleteCount === undefined) return reactive(this[native].splice(start))\n\t\t\treturn reactive(this[native].splice(start, deleteCount, ...items))\n\t\t} finally {\n\t\t\ttouched(\n\t\t\t\tthis,\n\t\t\t\t{ type: 'bunch', method: 'splice' },\n\t\t\t\t// TODO: edge cases\n\t\t\t\tdeleteCount === items.length\n\t\t\t\t\t? range(start, start + deleteCount)\n\t\t\t\t\t: range(start, oldLength + Math.max(items.length - deleteCount, 0), {\n\t\t\t\t\t\t\tlength: true,\n\t\t\t\t\t\t})\n\t\t\t)\n\t\t}\n\t}\n\n\treverse() {\n\t\ttry {\n\t\t\treturn this[native].reverse()\n\t\t} finally {\n\t\t\ttouched(this, { type: 'bunch', method: 'reverse' }, range(0, this[native].length - 1))\n\t\t}\n\t}\n\n\tsort(compareFn?: (a: any, b: any) => number) {\n\t\ttry {\n\t\t\treturn this[native].sort(compareFn) as any\n\t\t} finally {\n\t\t\ttouched(this, { type: 'bunch', method: 'sort' }, range(0, this[native].length - 1))\n\t\t}\n\t}\n\n\tfill(value: any, start?: number, end?: number) {\n\t\ttry {\n\t\t\tif (start === undefined) return this[native].fill(value) as any\n\t\t\tif (end === undefined) return this[native].fill(value, start) as any\n\t\t\treturn this[native].fill(value, start, end) as any\n\t\t} finally {\n\t\t\ttouched(this, { type: 'bunch', method: 'fill' }, range(0, this[native].length - 1))\n\t\t}\n\t}\n\n\tcopyWithin(target: number, start: number, end?: number) {\n\t\ttry {\n\t\t\tif (end === undefined) return this[native].copyWithin(target, start) as any\n\t\t\treturn this[native].copyWithin(target, start, end) as any\n\t\t} finally {\n\t\t\ttouched(\n\t\t\t\tthis,\n\t\t\t\t{ type: 'bunch', method: 'copyWithin' },\n\t\t\t\t// TODO: calculate the range properly\n\t\t\t\trange(0, this[native].length - 1)\n\t\t\t)\n\t\t}\n\t\t// Touch all affected indices with a single allProps call\n\t}\n\n\t// Immutable versions of mutator methods\n\ttoReversed(): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].toReversed())\n\t}\n\n\ttoSorted(compareFn?: (a: any, b: any) => number): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].toSorted(compareFn))\n\t}\n\n\ttoSpliced(start: number, deleteCount?: number, ...items: any[]): any[] {\n\t\tdependant(this)\n\t\treturn deleteCount === undefined\n\t\t\t? this[native].toSpliced(start)\n\t\t\t: this[native].toSpliced(start, deleteCount, ...items)\n\t}\n\n\twith(index: number, value: any): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].with(index, value))\n\t}\n\n\t// Iterator methods with reactivity tracking\n\tentries() {\n\t\tdependant(this)\n\t\treturn makeReactiveEntriesIterator(this[native].entries())\n\t}\n\n\tkeys() {\n\t\tdependant(this)\n\t\treturn this[native].keys()\n\t}\n\n\tvalues() {\n\t\tdependant(this)\n\t\treturn makeReactiveIterator(this[native].values())\n\t}\n\n\t[Symbol.iterator]() {\n\t\tdependant(this)\n\t\tconst nativeIterator = this[native][Symbol.iterator]()\n\t\treturn {\n\t\t\tnext() {\n\t\t\t\tconst result = nativeIterator.next()\n\t\t\t\tif (result.done) {\n\t\t\t\t\treturn result\n\t\t\t\t}\n\t\t\t\treturn { value: reactive(result.value), done: false }\n\t\t\t},\n\t\t}\n\t}\n\n\tindexOf(searchElement: any, fromIndex?: number): number {\n\t\tdependant(this)\n\t\treturn this[native].indexOf(searchElement, fromIndex)\n\t}\n\n\tlastIndexOf(searchElement: any, fromIndex?: number): number {\n\t\tdependant(this)\n\t\treturn this[native].lastIndexOf(searchElement, fromIndex)\n\t}\n\n\tincludes(searchElement: any, fromIndex?: number): boolean {\n\t\tdependant(this)\n\t\treturn this[native].includes(searchElement, fromIndex)\n\t}\n\n\tfind(\n\t\tpredicate: (this: any, value: any, index: number, obj: any[]) => boolean,\n\t\tthisArg?: any\n\t): any {\n\t\tdependant(this)\n\t\treturn reactive(this[native].find(predicate, thisArg))\n\t}\n\n\tfindIndex(\n\t\tpredicate: (this: any, value: any, index: number, obj: any[]) => boolean,\n\t\tthisArg?: any\n\t): number {\n\t\tdependant(this)\n\t\treturn this[native].findIndex(predicate, thisArg)\n\t}\n\n\tflat(): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].flat())\n\t}\n\n\tflatMap(\n\t\tcallbackfn: (this: any, value: any, index: number, array: any[]) => any[],\n\t\tthisArg?: any\n\t): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].flatMap(callbackfn, thisArg))\n\t}\n\n\tfilter(callbackfn: (value: any, index: number, array: any[]) => boolean, thisArg?: any): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].filter(callbackfn as any, thisArg))\n\t}\n\n\tmap(callbackfn: (value: any, index: number, array: any[]) => any, thisArg?: any): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].map(callbackfn as any, thisArg))\n\t}\n\n\treduce(\n\t\tcallbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any,\n\t\tinitialValue?: any\n\t): any {\n\t\tdependant(this)\n\t\tconst result =\n\t\t\tinitialValue === undefined\n\t\t\t\t? this[native].reduce(callbackfn as any)\n\t\t\t\t: this[native].reduce(callbackfn as any, initialValue)\n\t\treturn reactive(result)\n\t}\n\n\treduceRight(\n\t\tcallbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any,\n\t\tinitialValue?: any\n\t): any {\n\t\tdependant(this)\n\t\tconst result =\n\t\t\tinitialValue !== undefined\n\t\t\t\t? this[native].reduceRight(callbackfn as any, initialValue)\n\t\t\t\t: (this[native] as any).reduceRight(callbackfn as any)\n\t\treturn reactive(result)\n\t}\n\n\tslice(start?: number, end?: number): any[] {\n\t\tfor (const i of range(start || 0, end || this[native].length - 1)) dependant(this, i)\n\t\treturn start === undefined\n\t\t\t? this[native].slice()\n\t\t\t: end === undefined\n\t\t\t\t? this[native].slice(start)\n\t\t\t\t: this[native].slice(start, end)\n\t}\n\n\tconcat(...items: any[]): any[] {\n\t\tdependant(this)\n\t\treturn reactive(this[native].concat(...items))\n\t}\n\n\tjoin(separator?: string): string {\n\t\tdependant(this)\n\t\treturn this[native].join(separator as any)\n\t}\n\n\tforEach(callbackfn: (value: any, index: number, array: any[]) => void, thisArg?: any): void {\n\t\tdependant(this)\n\t\tthis[native].forEach(callbackfn as any, thisArg)\n\t}\n\n\t// TODO: re-implement for fun dependencies? (eg - every only check the first ones until it find some),\n\t// no need to make it dependant on indexes after the found one\n\tevery(callbackfn: (value: any, index: number, array: any[]) => boolean, thisArg?: any): boolean {\n\t\tdependant(this)\n\t\treturn this[native].every(callbackfn as any, thisArg)\n\t}\n\n\tsome(callbackfn: (value: any, index: number, array: any[]) => boolean, thisArg?: any): boolean {\n\t\tdependant(this)\n\t\treturn this[native].some(callbackfn as any, thisArg)\n\t}\n}\n","import {\n\tdependant,\n\tmakeReactiveEntriesIterator,\n\tmakeReactiveIterator,\n\tprototypeForwarding,\n\treactive,\n\ttouched,\n\ttouched1,\n} from './core'\n\nconst native = Symbol('native')\n\nexport class ReactiveWeakMap<K extends object, V> {\n\tdeclare readonly [native]: WeakMap<K, V>\n\tdeclare readonly content: symbol\n\tconstructor(original: WeakMap<K, V>) {\n\t\tObject.defineProperties(this, {\n\t\t\t[native]: { value: original },\n\t\t\t[prototypeForwarding]: { value: original },\n\t\t\tcontent: { value: Symbol('content') },\n\t\t\t[Symbol.toStringTag]: { value: 'ReactiveWeakMap' },\n\t\t})\n\t}\n\n\t// Implement WeakMap interface methods with reactivity\n\tdelete(key: K): boolean {\n\t\tconst hadKey = this[native].has(key)\n\t\tconst result = this[native].delete(key)\n\n\t\tif (hadKey) touched1(this.content, { type: 'del', prop: key }, key)\n\n\t\treturn result\n\t}\n\n\tget(key: K): V | undefined {\n\t\tdependant(this.content, key)\n\t\treturn reactive(this[native].get(key))\n\t}\n\n\thas(key: K): boolean {\n\t\tdependant(this.content, key)\n\t\treturn this[native].has(key)\n\t}\n\n\tset(key: K, value: V): this {\n\t\t// Trigger effects for the specific key\n\t\ttouched1(this.content, { type: this[native].has(key) ? 'set' : 'add', prop: key }, key)\n\t\tthis[native].set(key, value)\n\n\t\treturn this\n\t}\n}\n\nexport class ReactiveMap<K, V> {\n\tdeclare readonly [native]: Map<K, V>\n\tdeclare readonly content: symbol\n\n\tconstructor(original: Map<K, V>) {\n\t\tObject.defineProperties(this, {\n\t\t\t[native]: { value: original },\n\t\t\t[prototypeForwarding]: { value: original },\n\t\t\tcontent: { value: Symbol('content') },\n\t\t\t[Symbol.toStringTag]: { value: 'ReactiveMap' },\n\t\t})\n\t}\n\n\t// Implement Map interface methods with reactivity\n\tget size(): number {\n\t\tdependant(this, 'size') // The ReactiveMap instance still goes through proxy\n\t\treturn this[native].size\n\t}\n\n\tclear(): void {\n\t\tconst hadEntries = this[native].size > 0\n\t\tthis[native].clear()\n\n\t\tif (hadEntries) {\n\t\t\tconst evolution = { type: 'bunch', method: 'clear' } as const\n\t\t\t// Clear triggers all effects since all keys are affected\n\t\t\ttouched1(this, evolution, 'size')\n\t\t\ttouched(this.content, evolution)\n\t\t}\n\t}\n\n\tentries(): Generator<[K, V]> {\n\t\tdependant(this.content)\n\t\treturn makeReactiveEntriesIterator(this[native].entries())\n\t}\n\n\tforEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void {\n\t\tdependant(this.content)\n\t\tthis[native].forEach(callbackfn, thisArg)\n\t}\n\n\tkeys(): MapIterator<K> {\n\t\tdependant(this.content)\n\t\treturn this[native].keys()\n\t}\n\n\tvalues(): Generator<V> {\n\t\tdependant(this.content)\n\t\treturn makeReactiveIterator(this[native].values())\n\t}\n\n\t[Symbol.iterator](): Iterator<[K, V]> {\n\t\tdependant(this.content)\n\t\tconst nativeIterator = this[native][Symbol.iterator]()\n\t\treturn {\n\t\t\tnext() {\n\t\t\t\tconst result = nativeIterator.next()\n\t\t\t\tif (result.done) {\n\t\t\t\t\treturn result\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tvalue: [result.value[0], reactive(result.value[1])],\n\t\t\t\t\tdone: false,\n\t\t\t\t}\n\t\t\t},\n\t\t}\n\t}\n\n\t// Implement Map methods with reactivity\n\tdelete(key: K): boolean {\n\t\tconst hadKey = this[native].has(key)\n\t\tconst result = this[native].delete(key)\n\n\t\tif (hadKey) {\n\t\t\tconst evolution = { type: 'del', prop: key } as const\n\t\t\ttouched1(this.content, evolution, key)\n\t\t\ttouched1(this, evolution, 'size')\n\t\t}\n\n\t\treturn result\n\t}\n\n\tget(key: K): V | undefined {\n\t\tdependant(this.content, key)\n\t\treturn reactive(this[native].get(key))\n\t}\n\n\thas(key: K): boolean {\n\t\tdependant(this.content, key)\n\t\treturn this[native].has(key)\n\t}\n\n\tset(key: K, value: V): this {\n\t\tconst hadKey = this[native].has(key)\n\t\tconst oldValue = this[native].get(key)\n\t\tconst reactiveValue = reactive(value)\n\t\tthis[native].set(key, reactiveValue)\n\n\t\tif (!hadKey || oldValue !== reactiveValue) {\n\t\t\tconst evolution = { type: hadKey ? 'set' : 'add', prop: key } as const\n\t\t\ttouched1(this.content, evolution, key)\n\t\t\ttouched1(this, evolution, 'size')\n\t\t}\n\n\t\treturn this\n\t}\n}\n","import {\n\tdependant,\n\tmakeReactiveEntriesIterator,\n\tmakeReactiveIterator,\n\tprototypeForwarding,\n\treactive,\n\ttouched,\n\ttouched1,\n} from './core'\n\nconst native = Symbol('native')\n\nexport class ReactiveWeakSet<T extends object> {\n\tdeclare readonly [native]: WeakSet<T>\n\tdeclare readonly content: symbol\n\n\tconstructor(original: WeakSet<T>) {\n\t\tObject.defineProperties(this, {\n\t\t\t[native]: { value: original },\n\t\t\t[prototypeForwarding]: { value: original },\n\t\t\tcontent: { value: Symbol('content') },\n\t\t\t[Symbol.toStringTag]: { value: 'ReactiveWeakSet' },\n\t\t})\n\t}\n\n\tadd(value: T): this {\n\t\tconst had = this[native].has(value)\n\t\tthis[native].add(value)\n\t\tif (!had) {\n\t\t\t// touch the specific value and the collection view\n\t\t\ttouched1(this.content, { type: 'add', prop: value }, value)\n\t\t\t// no size/allProps for WeakSet\n\t\t}\n\t\treturn this\n\t}\n\n\tdelete(value: T): boolean {\n\t\tconst had = this[native].has(value)\n\t\tconst res = this[native].delete(value)\n\t\tif (had) touched1(this.content, { type: 'del', prop: value }, value)\n\t\treturn res\n\t}\n\n\thas(value: T): boolean {\n\t\tdependant(this.content, value)\n\t\treturn this[native].has(value)\n\t}\n}\n\nexport class ReactiveSet<T> {\n\tdeclare readonly [native]: Set<T>\n\tdeclare readonly content: symbol\n\tconstructor(original: Set<T>) {\n\t\tObject.defineProperties(this, {\n\t\t\t[native]: { value: original },\n\t\t\t[prototypeForwarding]: { value: original },\n\t\t\tcontent: { value: Symbol('content') },\n\t\t\t[Symbol.toStringTag]: { value: 'ReactiveSet' },\n\t\t})\n\t}\n\n\tget size(): number {\n\t\t// size depends on the wrapper instance, like Map counterpart\n\t\tdependant(this, 'size')\n\t\treturn this[native].size\n\t}\n\n\tadd(value: T): this {\n\t\tconst had = this[native].has(value)\n\t\tconst reactiveValue = reactive(value)\n\t\tthis[native].add(reactiveValue)\n\t\tif (!had) {\n\t\t\tconst evolution = { type: 'add', prop: reactiveValue } as const\n\t\t\t// touch for value-specific and aggregate dependencies\n\t\t\ttouched1(this.content, evolution, reactiveValue)\n\t\t\ttouched1(this, evolution, 'size')\n\t\t}\n\t\treturn this\n\t}\n\n\tclear(): void {\n\t\tconst hadEntries = this[native].size > 0\n\t\tthis[native].clear()\n\t\tif (hadEntries) {\n\t\t\tconst evolution = { type: 'bunch', method: 'clear' } as const\n\t\t\ttouched1(this, evolution, 'size')\n\t\t\ttouched(this.content, evolution)\n\t\t}\n\t}\n\n\tdelete(value: T): boolean {\n\t\tconst had = this[native].has(value)\n\t\tconst res = this[native].delete(value)\n\t\tif (had) {\n\t\t\tconst evolution = { type: 'del', prop: value } as const\n\t\t\ttouched1(this.content, evolution, value)\n\t\t\ttouched1(this, evolution, 'size')\n\t\t}\n\t\treturn res\n\t}\n\n\thas(value: T): boolean {\n\t\tdependant(this.content, value)\n\t\treturn this[native].has(value)\n\t}\n\n\tentries(): Generator<[T, T]> {\n\t\tdependant(this.content)\n\t\treturn makeReactiveEntriesIterator(this[native].entries())\n\t}\n\n\tforEach(callbackfn: (value: T, value2: T, set: Set<T>) => void, thisArg?: any): void {\n\t\tdependant(this.content)\n\t\tthis[native].forEach(callbackfn, thisArg)\n\t}\n\n\tkeys(): Generator<T> {\n\t\tdependant(this.content)\n\t\treturn makeReactiveIterator(this[native].keys())\n\t}\n\n\tvalues(): Generator<T> {\n\t\tdependant(this.content)\n\t\treturn makeReactiveIterator(this[native].values())\n\t}\n\n\t[Symbol.iterator](): Iterator<T> {\n\t\tdependant(this.content)\n\t\tconst nativeIterator = this[native][Symbol.iterator]()\n\t\treturn {\n\t\t\tnext() {\n\t\t\t\tconst result = nativeIterator.next()\n\t\t\t\tif (result.done) {\n\t\t\t\t\treturn result\n\t\t\t\t}\n\t\t\t\treturn { value: reactive(result.value), done: false }\n\t\t\t},\n\t\t}\n\t}\n}\n","export {\n\tatomic,\n\teffect,\n\tgetState,\n\timmutables,\n\tisNonReactive,\n\tisReactive,\n\toptions as reactiveOptions,\n\tprofileInfo,\n\tReactiveBase,\n\tReactiveError,\n\treactive,\n\ttype ScopedCallback,\n\tuntracked,\n\tunwrap,\n} from './core'\nexport { computed, invalidateComputed, unreactive, watch } from './interface'\n\nimport { ReactiveArray } from './array'\nimport { registerNativeReactivity } from './core'\nimport { ReactiveMap, ReactiveWeakMap } from './map'\nimport { ReactiveSet, ReactiveWeakSet } from './set'\n\n// Register native collection types to use specialized reactive wrappers\nregisterNativeReactivity(WeakMap, ReactiveWeakMap)\nregisterNativeReactivity(Map, ReactiveMap)\nregisterNativeReactivity(WeakSet, ReactiveWeakSet)\nregisterNativeReactivity(Set, ReactiveSet)\nregisterNativeReactivity(Array, ReactiveArray)\n","import { decorator, GenericClassDecorator } from './decorator'\n\n// In order to avoid async re-entrance, we could use zone.js or something like that.\nconst syncCalculating: { object: object; prop: PropertyKey }[] = []\nexport const cached = decorator({\n\tgetter(original, propertyKey) {\n\t\treturn function (this: any) {\n\t\t\tconst alreadyCalculating = syncCalculating.findIndex(\n\t\t\t\t(c) => c.object === this && c.prop === propertyKey\n\t\t\t)\n\t\t\tif (alreadyCalculating > -1)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Circular dependency detected: ${syncCalculating\n\t\t\t\t\t\t.slice(alreadyCalculating)\n\t\t\t\t\t\t.map((c) => `${c.object.constructor.name}.${String(c.prop)}`)\n\t\t\t\t\t\t.join(' -> ')} -> again`\n\t\t\t\t)\n\t\t\tsyncCalculating.push({ object: this, prop: propertyKey })\n\t\t\ttry {\n\t\t\t\tconst rv = original.call(this)\n\t\t\t\tcache(this, propertyKey, rv)\n\t\t\t\treturn rv\n\t\t\t} finally {\n\t\t\t\tsyncCalculating.pop()\n\t\t\t}\n\t\t}\n\t},\n})\n\nexport function isCached(object: Object, propertyKey: PropertyKey) {\n\treturn !!Object.getOwnPropertyDescriptor(object, propertyKey)\n}\n\nexport function cache(object: Object, propertyKey: PropertyKey, value: any) {\n\tObject.defineProperty(object, propertyKey, { value })\n}\n\nexport function describe(descriptor: {\n\tenumerable?: boolean\n\tconfigurable?: boolean // Not modifiable once the property has been defined ?\n\twritable?: boolean\n}) {\n\treturn <T>(...properties: (keyof T)[]): GenericClassDecorator<T> =>\n\t\t(Base) => {\n\t\t\treturn class extends Base {\n\t\t\t\tconstructor(...args: any[]) {\n\t\t\t\t\tsuper(...args)\n\t\t\t\t\tfor (const key of properties) {\n\t\t\t\t\t\tObject.defineProperty(this, key, {\n\t\t\t\t\t\t\t...Object.getOwnPropertyDescriptor(this, key),\n\t\t\t\t\t\t\t...descriptor,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n}\n\nexport const deprecated = Object.assign(\n\tdecorator({\n\t\tmethod(original, propertyKey) {\n\t\t\treturn function (this: any, ...args: any[]) {\n\t\t\t\tdeprecated.warn(this, propertyKey)\n\t\t\t\treturn original.apply(this, args)\n\t\t\t}\n\t\t},\n\t\tgetter(original, propertyKey) {\n\t\t\treturn function (this: any) {\n\t\t\t\tdeprecated.warn(this, propertyKey)\n\t\t\t\treturn original.call(this)\n\t\t\t}\n\t\t},\n\t\tsetter(original, propertyKey) {\n\t\t\treturn function (this: any, value: any) {\n\t\t\t\tdeprecated.warn(this, propertyKey)\n\t\t\t\treturn original.call(this, value)\n\t\t\t}\n\t\t},\n\t\tclass(original) {\n\t\t\treturn class extends original {\n\t\t\t\tconstructor(...args: any[]) {\n\t\t\t\t\tsuper(...args)\n\t\t\t\t\tdeprecated.warn(this, 'constructor')\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tdefault(message: string) {\n\t\t\treturn decorator({\n\t\t\t\tmethod(original, propertyKey) {\n\t\t\t\t\treturn function (this: any, ...args: any[]) {\n\t\t\t\t\t\tdeprecated.warn(this, propertyKey, message)\n\t\t\t\t\t\treturn original.apply(this, args)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tgetter(original, propertyKey) {\n\t\t\t\t\treturn function (this: any) {\n\t\t\t\t\t\tdeprecated.warn(this, propertyKey, message)\n\t\t\t\t\t\treturn original.call(this)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tsetter(original, propertyKey) {\n\t\t\t\t\treturn function (this: any, value: any) {\n\t\t\t\t\t\tdeprecated.warn(this, propertyKey, message)\n\t\t\t\t\t\treturn original.call(this, value)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tclass(original) {\n\t\t\t\t\treturn class extends original {\n\t\t\t\t\t\tconstructor(...args: any[]) {\n\t\t\t\t\t\t\tsuper(...args)\n\t\t\t\t\t\t\tdeprecated.warn(this, 'constructor', message)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t})\n\t\t},\n\t}),\n\t{\n\t\twarn: (target: any, propertyKey: PropertyKey, message?: string) => {\n\t\t\t// biome-ignore lint/suspicious/noConsole: To be overridden\n\t\t\tconsole.warn(\n\t\t\t\t`${target.constructor.name}.${String(propertyKey)} is deprecated${message ? `: ${message}` : ''}`\n\t\t\t)\n\t\t},\n\t}\n)\n\nexport function debounce(delay: number) {\n\treturn decorator({\n\t\tmethod(original, _propertyKey) {\n\t\t\tlet timeoutId: ReturnType<typeof setTimeout> | null = null\n\n\t\t\treturn function (this: any, ...args: any[]) {\n\t\t\t\t// Clear existing timeout\n\t\t\t\tif (timeoutId) {\n\t\t\t\t\tclearTimeout(timeoutId)\n\t\t\t\t}\n\n\t\t\t\t// Set new timeout\n\t\t\t\ttimeoutId = setTimeout(() => {\n\t\t\t\t\toriginal.apply(this, args)\n\t\t\t\t\ttimeoutId = null\n\t\t\t\t}, delay)\n\t\t\t}\n\t\t},\n\t})\n}\n\nexport function throttle(delay: number) {\n\treturn decorator({\n\t\tmethod(original, _propertyKey) {\n\t\t\tlet lastCallTime = 0\n\t\t\tlet timeoutId: ReturnType<typeof setTimeout> | null = null\n\n\t\t\treturn function (this: any, ...args: any[]) {\n\t\t\t\tconst now = Date.now()\n\n\t\t\t\t// If enough time has passed since last call, execute immediately\n\t\t\t\tif (now - lastCallTime >= delay) {\n\t\t\t\t\t// Clear any pending timeout since we're executing now\n\t\t\t\t\tif (timeoutId) {\n\t\t\t\t\t\tclearTimeout(timeoutId)\n\t\t\t\t\t\ttimeoutId = null\n\t\t\t\t\t}\n\t\t\t\t\tlastCallTime = now\n\t\t\t\t\treturn original.apply(this, args)\n\t\t\t\t}\n\n\t\t\t\t// Otherwise, schedule execution for when the delay period ends\n\t\t\t\tif (!timeoutId) {\n\t\t\t\t\tconst remainingTime = delay - (now - lastCallTime)\n\t\t\t\t\tconst scheduledArgs = [...args] // Capture args at scheduling time\n\t\t\t\t\ttimeoutId = setTimeout(() => {\n\t\t\t\t\t\tlastCallTime = Date.now()\n\t\t\t\t\t\toriginal.apply(this, scheduledArgs)\n\t\t\t\t\t\ttimeoutId = null\n\t\t\t\t\t}, remainingTime)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t})\n}\n","export class Eventful<Events extends Record<string, (...args: any[]) => void>> {\n\treadonly #events = new Map<keyof Events, ((...args: any[]) => void)[]>()\n\treadonly #hooks = [] as ((...args: any[]) => void)[]\n\n\tpublic hook(\n\t\tcb: <EventType extends keyof Events>(\n\t\t\tevent: EventType,\n\t\t\t...args: Parameters<Events[EventType]>\n\t\t) => void\n\t): () => void {\n\t\tif (!this.#hooks.includes(cb)) this.#hooks.push(cb)\n\t\treturn () => {\n\t\t\tthis.#hooks.splice(this.#hooks.indexOf(cb), 1)\n\t\t}\n\t}\n\n\tpublic on(events: Partial<Events>): void\n\tpublic on<EventType extends keyof Events>(event: EventType, cb: Events[EventType]): () => void\n\tpublic on<EventType extends keyof Events>(\n\t\teventOrEvents: EventType | Partial<Events>,\n\t\tcb?: Events[EventType]\n\t): () => void {\n\t\tif (typeof eventOrEvents === 'object') {\n\t\t\tfor (const e of Object.keys(eventOrEvents) as (keyof Events)[]) {\n\t\t\t\tthis.on(e, eventOrEvents[e]!)\n\t\t\t}\n\t\t} else if (cb !== undefined) {\n\t\t\tlet callbacks = this.#events.get(eventOrEvents)\n\t\t\tif (!callbacks) {\n\t\t\t\tcallbacks = []\n\t\t\t\tthis.#events.set(eventOrEvents, callbacks)\n\t\t\t}\n\t\t\tcallbacks.push(cb)\n\t\t}\n\t\t// @ts-expect-error Generic case leads to generic case\n\t\treturn () => this.off(eventOrEvents, cb)\n\t}\n\tpublic off(events: Partial<Events>): void\n\tpublic off<EventType extends keyof Events>(event: EventType, cb?: Events[EventType]): void\n\tpublic off<EventType extends keyof Events>(\n\t\teventOrEvents: EventType | Partial<Events>,\n\t\tcb?: Events[EventType]\n\t): void {\n\t\tif (typeof eventOrEvents === 'object') {\n\t\t\tfor (const e of Object.keys(eventOrEvents) as (keyof Events)[]) {\n\t\t\t\tthis.off(e, eventOrEvents[e])\n\t\t\t}\n\t\t} else if (cb !== null && cb !== undefined) {\n\t\t\tconst callbacks = this.#events.get(eventOrEvents)\n\t\t\tif (callbacks) {\n\t\t\t\tthis.#events.set(\n\t\t\t\t\teventOrEvents,\n\t\t\t\t\tcallbacks.filter((c) => c !== cb)\n\t\t\t\t)\n\t\t\t}\n\t\t} else {\n\t\t\t// Remove all listeners for this event\n\t\t\tthis.#events.delete(eventOrEvents)\n\t\t}\n\t}\n\tpublic emit<EventType extends keyof Events>(\n\t\tevent: EventType,\n\t\t...args: Parameters<Events[EventType]>\n\t) {\n\t\tconst callbacks = this.#events.get(event)\n\t\tif (callbacks) for (const cb of callbacks) cb.apply(this, args)\n\t\tfor (const cb of this.#hooks) cb.call(this, event, ...args)\n\t}\n}\n"],"names":["nativeConstructors","Set","Object","Array","Date","Function","Map","WeakMap","WeakSet","Promise","Error","TypeError","ReferenceError","SyntaxError","RangeError","URIError","EvalError","Reflect","Proxy","RegExp","String","Number","Boolean","isConstructor","fn","has","toString","startsWith","renamed","fct","name","defineProperties","value","DecoratorError","constructor","message","super","this","legacyDecorator","description","target","propertyKey","descriptor","args","undefined","class","includes","newGetter","getter","get","newSetter","setter","set","newMethod","method","default","call","modernDecorator","context","kind","rv","decorator","contextOrKey","mode","_target","detectDecoratorMode","fr","FinalizationRegistry","f","destructor","Symbol","allocatedValues","DestructionError","msg","destroyedHandler","toStringTag","throw","allocated","original","getAt","setAt","Indexable","base","accessor","index","setPrototypeOf","prototype","prop","receiver","getOwnPropertyDescriptor","getLength","numProp","isNaN","setLength","defineProperty","writable","enumerable","configurable","effectToReactiveObjects","objectToProxy","proxyToObject","objectParents","objectsWithDeepWatchers","deepWatchers","effectToDeepWatchedObjects","nonReactiveObjects","absent","makeReactiveIterator","iterator","result","next","done","reactive","makeReactiveEntriesIterator","key","watchers","profileInfo","nativeReactive","nonReactiveMark","unreactiveProperties","prototypeForwarding","allProps","rootFunction","markWithRoot","root","getRoot","ReactiveError","options","enter","effect","leave","chain","caller","maxEffectChain","maxDeepWatchDepth","instanceMembers","warn","raiseDeps","objectWatchers","keyChains","keys","deps","from","atomicEffect","touched1","obj","evolution","touched","props","unwrap","state","getState","assign","states","addState","bubbleUpChange","dependant","activeEffect","add","effectObjects","parentEffect","batchedEffects","immediate","delete","runEffects","firstReturn","size","length","entries","push","atomic","apply","withEffect","keepParent","oldActiveEffect","oldParentEffect","addBackReference","child","parent","parents","removeBackReference","needsBackReferences","hasParentWithDeepWatchers","changedObject","parentDeepWatchers","watcher","reactiveHandlers","hasOwn","reactiveValue","isArrayCase","newValue","oldVal","track1","type","deleteProperty","getPrototypeOf","proto","ownKeys","reactiveClasses","ReactiveBase","reactiveObject","anyTarget","isNonReactive","proxied","proxy","Reactive","untracked","effectChildren","cleanup","dep","cb","runEffect","effectStopped","reactionCleanup","reactiveObj","mainCleanup","children","childCleanup","unregister","callIfCollected","register","subEffectCleanup","immutables","some","nonReactiveClass","cls","c","registerNativeReactivity","originalClass","reactiveClass","deepWatch","callback","wrappedCallback","visited","traverseAndTrack","depth","isObject","isArray","i","_key","computedInvalidations","window","o","nonReactive","document","Element","Node","computedCache","computedFunction","invalidations","stopped","stop","oldCI","computed","computers","unsetYet","deepNonReactive","unreactive","arg1","arg","native","ReactiveBaseArray","range","a","b","start","Math","min","end","max","ReactiveArray","added","oldLength","native$2","at","actualIndex","items","pop","shift","unshift","splice","deleteCount","reverse","sort","compareFn","fill","copyWithin","toReversed","toSorted","toSpliced","with","values","nativeIterator","indexOf","searchElement","fromIndex","lastIndexOf","find","predicate","thisArg","findIndex","flat","flatMap","callbackfn","filter","map","reduce","initialValue","reduceRight","slice","concat","join","separator","forEach","every","ReactiveMap","native$1","content","clear","hadEntries","hadKey","oldValue","ReactiveSet","had","res","syncCalculating","cached","alreadyCalculating","object","cache","deprecated","destructorObj","_a","destroy","destructors","getOwnPropertyNames","isDestroyable","myDestructor","destruction","_Eventful_events","_Eventful_hooks","hook","__classPrivateFieldGet","on","eventOrEvents","e","callbacks","off","emit","event","called","forward","delay","_propertyKey","timeoutId","clearTimeout","setTimeout","properties","Base","lastCallTime","now","remainingTime","scheduledArgs","changed","deep","deepCleanup","cbCleanup","watchCallBack","watchObject","minLength","arr","tuple"],"mappings":"4OAiBA,MAAMA,EAAqB,IAAIC,IAAc,CAC5CC,OACAC,MACAC,KACAC,SACAJ,IACAK,IACAC,QACAC,QACAC,QACAC,MACAC,UACAC,eACAC,YACAC,WACAC,SACAC,UACAC,QACAC,MACAC,OACAC,OACAC,OACAC,UAEK,SAAUC,EAAcC,GAC7B,OAAOA,IAAOxB,EAAmByB,IAAID,IAAOA,EAAGE,aAAaC,WAAW,UACxE,CAEM,SAAUC,EAA4BC,EAAQC,GACnD,OAAO5B,OAAO6B,iBAAiBF,EAAK,CACnCC,KAAM,CACLE,MAAOF,IAGV,CC9CM,MAAOG,UAAuBvB,MACnC,WAAAwB,CAAYC,GACXC,MAAMD,GACNE,KAAKP,KAAO,oBACb,EAkFK,SAAUQ,EAAyBC,GACxC,OAAO,SACNC,EACAC,EACAC,KACGC,GAEH,QAAoBC,IAAhBH,GACH,GAAIlB,EAAciB,GAAS,CAC1B,KAAM,UAAWD,GAAc,MAAM,IAAI7B,MAAM,0CAC/C,OAAO6B,EAAYM,QAAQL,EAC5B,OACM,GAAsB,iBAAXA,GAAuB,CAAC,SAAU,UAAUM,gBAAgBL,GAAc,CAC3F,IAAKC,EAAY,MAAM,IAAIhC,MAAM,0CAC5B,GAA0B,iBAAfgC,GAA2B,iBAAkBA,EAAY,CACxE,GAAI,QAAS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