mutts 1.0.7 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/README.md +72 -17
  2. package/dist/browser.cjs +3111 -0
  3. package/dist/browser.cjs.map +1 -0
  4. package/dist/browser.d.ts +1391 -1
  5. package/dist/browser.esm.js +264 -35
  6. package/dist/browser.esm.js.map +1 -1
  7. package/dist/chunks/async-browser-lvzLOCgk.cjs +297 -0
  8. package/dist/chunks/async-browser-lvzLOCgk.cjs.map +1 -0
  9. package/dist/chunks/async-core-CRLKP3l-.cjs +29 -0
  10. package/dist/chunks/async-core-CRLKP3l-.cjs.map +1 -0
  11. package/dist/chunks/async-node-C3DeIb0y.cjs +96 -0
  12. package/dist/chunks/async-node-C3DeIb0y.cjs.map +1 -0
  13. package/dist/chunks/index-2vea86wD.esm.js +3011 -0
  14. package/dist/chunks/index-2vea86wD.esm.js.map +1 -0
  15. package/dist/chunks/index-CtA2AWl3.esm.js +4376 -0
  16. package/dist/chunks/index-CtA2AWl3.esm.js.map +1 -0
  17. package/dist/chunks/index-VTO-b2vR.cjs +4461 -0
  18. package/dist/chunks/index-VTO-b2vR.cjs.map +1 -0
  19. package/dist/debug/debug.d.ts +122 -0
  20. package/dist/debug/debug.d.ts.map +1 -0
  21. package/dist/debug/index.d.ts +4 -0
  22. package/dist/debug/index.d.ts.map +1 -0
  23. package/dist/debug/lineage-panel.d.ts +5 -0
  24. package/dist/debug/lineage-panel.d.ts.map +1 -0
  25. package/dist/debug/lineage.d.ts +79 -0
  26. package/dist/debug/lineage.d.ts.map +1 -0
  27. package/dist/debug.cjs +35 -0
  28. package/dist/debug.cjs.map +1 -0
  29. package/dist/debug.d.ts +209 -0
  30. package/dist/debug.esm.js +2 -0
  31. package/dist/debug.esm.js.map +1 -0
  32. package/dist/devtools/devtool/devtools.d.ts +1 -0
  33. package/dist/devtools/devtool/devtools.d.ts.map +1 -0
  34. package/dist/devtools/devtool/panel.d.ts +2 -0
  35. package/dist/devtools/devtool/panel.d.ts.map +1 -0
  36. package/dist/index.d.ts +1 -0
  37. package/dist/mutts.umd.js +1 -1
  38. package/dist/mutts.umd.js.map +1 -1
  39. package/dist/mutts.umd.min.js +1 -1
  40. package/dist/mutts.umd.min.js.map +1 -1
  41. package/dist/node.cjs +107 -0
  42. package/dist/node.cjs.map +1 -0
  43. package/dist/node.d.ts +2 -2
  44. package/dist/node.esm.js +86 -33
  45. package/dist/node.esm.js.map +1 -1
  46. package/dist/src/async/browser.d.ts +2 -0
  47. package/dist/src/async/browser.d.ts.map +1 -0
  48. package/dist/src/async/index.d.ts +19 -0
  49. package/dist/src/async/index.d.ts.map +1 -0
  50. package/dist/src/async/node.d.ts +2 -0
  51. package/dist/src/async/node.d.ts.map +1 -0
  52. package/dist/src/decorator.d.ts +106 -0
  53. package/dist/src/decorator.d.ts.map +1 -0
  54. package/dist/src/destroyable.d.ts +87 -0
  55. package/dist/src/destroyable.d.ts.map +1 -0
  56. package/dist/src/entry-browser.d.ts +3 -0
  57. package/dist/src/entry-browser.d.ts.map +1 -0
  58. package/dist/src/entry-node.d.ts +3 -0
  59. package/dist/src/entry-node.d.ts.map +1 -0
  60. package/dist/src/eventful.d.ts +20 -0
  61. package/dist/src/eventful.d.ts.map +1 -0
  62. package/dist/src/flavored.d.ts +33 -0
  63. package/dist/src/flavored.d.ts.map +1 -0
  64. package/dist/src/index.d.ts +14 -0
  65. package/dist/src/index.d.ts.map +1 -0
  66. package/dist/src/indexable.d.ts +243 -0
  67. package/dist/src/indexable.d.ts.map +1 -0
  68. package/dist/src/introspection.d.ts +27 -0
  69. package/dist/src/introspection.d.ts.map +1 -0
  70. package/dist/src/iterableWeak.d.ts +53 -0
  71. package/dist/src/iterableWeak.d.ts.map +1 -0
  72. package/dist/src/mixins.d.ts +25 -0
  73. package/dist/src/mixins.d.ts.map +1 -0
  74. package/dist/src/promiseChain.d.ts +20 -0
  75. package/dist/src/promiseChain.d.ts.map +1 -0
  76. package/dist/src/reactive/array.d.ts +48 -0
  77. package/dist/src/reactive/array.d.ts.map +1 -0
  78. package/dist/src/reactive/buffer.d.ts +120 -0
  79. package/dist/src/reactive/buffer.d.ts.map +1 -0
  80. package/dist/src/reactive/change.d.ts +29 -0
  81. package/dist/src/reactive/change.d.ts.map +1 -0
  82. package/dist/src/reactive/deep-touch.d.ts +28 -0
  83. package/dist/src/reactive/deep-touch.d.ts.map +1 -0
  84. package/dist/src/reactive/deep-watch-state.d.ts +25 -0
  85. package/dist/src/reactive/deep-watch-state.d.ts.map +1 -0
  86. package/dist/src/reactive/deep-watch.d.ts +20 -0
  87. package/dist/src/reactive/deep-watch.d.ts.map +1 -0
  88. package/dist/src/reactive/describe.d.ts +12 -0
  89. package/dist/src/reactive/describe.d.ts.map +1 -0
  90. package/dist/src/reactive/effect-context.d.ts +34 -0
  91. package/dist/src/reactive/effect-context.d.ts.map +1 -0
  92. package/dist/src/reactive/effects.d.ts +164 -0
  93. package/dist/src/reactive/effects.d.ts.map +1 -0
  94. package/dist/src/reactive/index.d.ts +19 -0
  95. package/dist/src/reactive/index.d.ts.map +1 -0
  96. package/dist/src/reactive/map.d.ts +28 -0
  97. package/dist/src/reactive/map.d.ts.map +1 -0
  98. package/dist/src/reactive/memoize.d.ts +28 -0
  99. package/dist/src/reactive/memoize.d.ts.map +1 -0
  100. package/dist/src/reactive/non-reactive-state.d.ts +9 -0
  101. package/dist/src/reactive/non-reactive-state.d.ts.map +1 -0
  102. package/dist/src/reactive/non-reactive.d.ts +11 -0
  103. package/dist/src/reactive/non-reactive.d.ts.map +1 -0
  104. package/dist/src/reactive/project.d.ts +40 -0
  105. package/dist/src/reactive/project.d.ts.map +1 -0
  106. package/dist/src/reactive/proxy-state.d.ts +8 -0
  107. package/dist/src/reactive/proxy-state.d.ts.map +1 -0
  108. package/dist/src/reactive/proxy.d.ts +23 -0
  109. package/dist/src/reactive/proxy.d.ts.map +1 -0
  110. package/dist/src/reactive/record.d.ts +115 -0
  111. package/dist/src/reactive/record.d.ts.map +1 -0
  112. package/dist/src/reactive/register.d.ts +125 -0
  113. package/dist/src/reactive/register.d.ts.map +1 -0
  114. package/dist/src/reactive/registry.d.ts +21 -0
  115. package/dist/src/reactive/registry.d.ts.map +1 -0
  116. package/dist/src/reactive/set.d.ts +26 -0
  117. package/dist/src/reactive/set.d.ts.map +1 -0
  118. package/dist/src/reactive/tracking.d.ts +7 -0
  119. package/dist/src/reactive/tracking.d.ts.map +1 -0
  120. package/dist/src/reactive/types.d.ts +424 -0
  121. package/dist/src/reactive/types.d.ts.map +1 -0
  122. package/dist/src/reactive/watch.d.ts +48 -0
  123. package/dist/src/reactive/watch.d.ts.map +1 -0
  124. package/dist/src/std-decorators.d.ts +45 -0
  125. package/dist/src/std-decorators.d.ts.map +1 -0
  126. package/dist/src/utils.d.ts +49 -0
  127. package/dist/src/utils.d.ts.map +1 -0
  128. package/dist/src/zone.d.ts +40 -0
  129. package/dist/src/zone.d.ts.map +1 -0
  130. package/dist/types-DaHFfhlN.d.ts +414 -0
  131. package/docs/ai/api-reference.md +1 -1
  132. package/docs/ai/manual.md +443 -17
  133. package/docs/events.md +57 -2
  134. package/docs/flavored.md +210 -0
  135. package/docs/reactive/advanced.md +2 -3
  136. package/docs/reactive/attend.md +143 -0
  137. package/docs/reactive/collections.md +55 -0
  138. package/docs/reactive/core.md +120 -4
  139. package/docs/reactive/debugging.md +8 -10
  140. package/docs/reactive/describe.md +85 -0
  141. package/docs/reactive/error-handling.md +121 -0
  142. package/docs/reactive/project.md +1 -1
  143. package/docs/reactive/scan.md +215 -0
  144. package/docs/reactive.md +2 -0
  145. package/docs/std-decorators.md +171 -52
  146. package/docs/zone.md +9 -6
  147. package/package.json +44 -27
  148. package/src/async/browser.ts +277 -41
  149. package/src/async/index.ts +23 -4
  150. package/src/async/node.ts +78 -32
  151. package/src/entry-browser.ts +5 -0
  152. package/src/entry-node.ts +5 -0
  153. package/src/eventful.ts +82 -49
  154. package/src/flavored.ts +106 -0
  155. package/src/index.d.ts +12 -9
  156. package/src/index.ts +2 -1
  157. package/src/introspection.ts +1 -1
  158. package/src/reactive/array.ts +160 -80
  159. package/src/reactive/buffer.ts +187 -27
  160. package/src/reactive/change.ts +16 -23
  161. package/src/reactive/deep-touch.ts +19 -14
  162. package/src/reactive/deep-watch-state.ts +3 -3
  163. package/src/reactive/deep-watch.ts +7 -4
  164. package/src/reactive/describe.ts +39 -0
  165. package/src/reactive/effect-context.ts +71 -6
  166. package/src/reactive/effects.ts +445 -393
  167. package/src/reactive/index.ts +12 -14
  168. package/src/reactive/map.ts +8 -24
  169. package/src/reactive/memoize.ts +26 -3
  170. package/src/reactive/project.md +107 -0
  171. package/src/reactive/project.ts +48 -71
  172. package/src/reactive/proxy.ts +21 -3
  173. package/src/reactive/record.ts +30 -45
  174. package/src/reactive/register.ts +138 -19
  175. package/src/reactive/registry.ts +22 -9
  176. package/src/reactive/set.ts +7 -20
  177. package/src/reactive/tracking.ts +9 -12
  178. package/src/reactive/types.ts +104 -24
  179. package/src/reactive/{interface.ts → watch.ts} +29 -59
  180. package/src/std-decorators.ts +56 -17
  181. package/src/utils.ts +3 -4
  182. package/src/zone.ts +43 -28
  183. package/dist/browser.js +0 -161
  184. package/dist/browser.js.map +0 -1
  185. package/dist/chunks/index-BFYK02LG.js +0 -6378
  186. package/dist/chunks/index-BFYK02LG.js.map +0 -1
  187. package/dist/chunks/index-CNR6QRUl.esm.js +0 -6291
  188. package/dist/chunks/index-CNR6QRUl.esm.js.map +0 -1
  189. package/dist/node.js +0 -136
  190. package/dist/node.js.map +0 -1
  191. package/src/reactive/debug.ts +0 -517
@@ -0,0 +1,424 @@
1
+ import type { FunctionWrapper } from '../zone';
2
+ export type EffectAccessEvents = {
3
+ triggered(event: string, ...args: any[]): void;
4
+ };
5
+ /**
6
+ * Effect access passed to user callbacks within effects/watch
7
+ * Provides functions to track dependencies and information about the effect execution
8
+ */
9
+ export interface EffectAccess {
10
+ /**
11
+ * Tracks dependencies in the current effect context
12
+ * Use this for normal dependency tracking within the effect
13
+ * @example
14
+ * ```typescript
15
+ * effect(({ tracked }) => {
16
+ * // In async context, use tracked to restore dependency tracking
17
+ * await someAsyncOperation()
18
+ * const value = tracked(() => state.count) // Tracks state.count in this effect
19
+ * })
20
+ * ```
21
+ */
22
+ tracked: FunctionWrapper;
23
+ /**
24
+ * Tracks dependencies in the parent effect context
25
+ * Use this when child effects should track dependencies in the parent,
26
+ * allowing parent cleanup to manage child effects while dependencies trigger the parent
27
+ * @example
28
+ * ```typescript
29
+ * effect(({ ascend }) => {
30
+ * const length = inputs.length
31
+ * if (length > 0) {
32
+ * ascend(() => {
33
+ * // Dependencies here are tracked in the parent effect
34
+ * inputs.forEach(item => console.log(item))
35
+ * })
36
+ * }
37
+ * })
38
+ * ```
39
+ */
40
+ ascend: FunctionWrapper;
41
+ /**
42
+ * Indicates whether the effect is running as a reaction (i.e. not the first call)
43
+ * - `false`: First execution when the effect is created
44
+ * - `true`: Subsequent executions triggered by dependency changes
45
+ * @example
46
+ * ```typescript
47
+ * effect(({ reaction }) => {
48
+ * if (!reaction) {
49
+ * console.log('Effect initialized')
50
+ * // Setup code that should only run once
51
+ * } else {
52
+ * console.log('Effect re-ran due to dependency change')
53
+ * // Code that runs on every update
54
+ * }
55
+ * })
56
+ * ```
57
+ */
58
+ reaction: boolean;
59
+ }
60
+ /**
61
+ * Base type for effect callbacks - simple function without additional properties
62
+ */
63
+ export type ScopedCallback = () => void;
64
+ /**
65
+ * Type for effect cleanup functions with stopped state tracking
66
+ */
67
+ export type EffectCleanup = ScopedCallback & {
68
+ [stopped]: boolean;
69
+ };
70
+ export type StackFrame = {
71
+ functionName: string;
72
+ fileName: string;
73
+ lineNumber: number;
74
+ columnNumber: number;
75
+ raw: string;
76
+ };
77
+ export type EffectTracking = (obj: any, evolution: Evolution, prop: any, effect: EffectTrigger) => void;
78
+ /**
79
+ * Centralized node for all effect metadata and relationships
80
+ */
81
+ export interface EffectNode {
82
+ parent?: EffectTrigger;
83
+ children?: Set<EffectCleanup>;
84
+ cleanup?: ScopedCallback;
85
+ stopped?: boolean;
86
+ forwardThrow?: CatchFunction;
87
+ catchers?: CatchFunction[];
88
+ creationStack?: StackFrame[];
89
+ dependencyHook?: (obj: any, prop: any) => void;
90
+ trackers?: EffectTracking[];
91
+ isOpaque?: boolean;
92
+ }
93
+ /**
94
+ * Type for the `runEffect` function of an effect - argument-less function to call to trigger the effect
95
+ */
96
+ export type EffectTrigger = ScopedCallback;
97
+ /**
98
+ * Async execution mode for effects
99
+ * - `cancel`: Cancel previous async execution when dependencies change (default)
100
+ * - `queue`: Queue next execution to run after current completes
101
+ * - `ignore`: Ignore new executions while async work is running
102
+ */
103
+ export type AsyncExecutionMode = 'cancel' | 'queue' | 'ignore';
104
+ /**
105
+ * Options for effect creation
106
+ */
107
+ export interface EffectOptions {
108
+ /**
109
+ * How to handle async effect executions when dependencies change
110
+ * @default 'cancel'
111
+ */
112
+ asyncMode?: AsyncExecutionMode;
113
+ /**
114
+ * If true, this effect is "opaque" to deep optimizations: it sees the object reference itself
115
+ * and must be notified when it changes, regardless of deep content similarity.
116
+ * Use this for effects that depend on object identity (like memoize).
117
+ */
118
+ opaque?: boolean;
119
+ /**
120
+ * Used for debugging purpose. Provides a callback to be called every time a dependency is created.
121
+ */
122
+ dependencyHook?: (obj: any, prop: any) => void;
123
+ /**
124
+ * Used for debugging purpose. Provides a name for the effect.
125
+ */
126
+ name?: string;
127
+ }
128
+ /**
129
+ * Type for property evolution events
130
+ */
131
+ export type PropEvolution = {
132
+ type: 'set' | 'del' | 'add' | 'invalidate';
133
+ prop: any;
134
+ };
135
+ /**
136
+ * Type for collection operation evolution events
137
+ */
138
+ export type BunchEvolution = {
139
+ type: 'bunch';
140
+ method: string;
141
+ };
142
+ export type Evolution = PropEvolution | BunchEvolution;
143
+ type State = {
144
+ evolution: Evolution;
145
+ next: State;
146
+ } | {};
147
+ declare const nativeReactive: unique symbol;
148
+ /**
149
+ * Symbol to mark individual objects as non-reactive
150
+ */
151
+ export declare const nonReactiveMark: unique symbol;
152
+ /**
153
+ * Symbol to mark class properties as non-reactive
154
+ */
155
+ export declare const unreactiveProperties: unique symbol;
156
+ /**
157
+ * Symbol representing all properties in reactive tracking
158
+ */
159
+ export declare const allProps: unique symbol;
160
+ /**
161
+ * Symbol for accessing projection information on reactive objects
162
+ */
163
+ export declare const projectionInfo: unique symbol;
164
+ /**
165
+ * Symbol to check if an effect is stopped
166
+ */
167
+ export declare const stopped: unique symbol;
168
+ /**
169
+ * Symbol to access effect cleanup function
170
+ */
171
+ export declare const cleanup: unique symbol;
172
+ export declare const forwardThrow: unique symbol;
173
+ export type EffectCloser = (error?: any) => void;
174
+ export type CatchFunction = (error: any) => EffectCloser | undefined | void;
175
+ /**
176
+ * Context for a running projection item effect
177
+ */
178
+ export interface ProjectionContext {
179
+ source: any;
180
+ key?: any;
181
+ target: any;
182
+ depth: number;
183
+ parent?: ProjectionContext;
184
+ }
185
+ declare const rootFunction: unique symbol;
186
+ /**
187
+ * Structured error codes for machine-readable diagnosis
188
+ */
189
+ export declare enum ReactiveErrorCode {
190
+ CycleDetected = "CYCLE_DETECTED",
191
+ MaxDepthExceeded = "MAX_DEPTH_EXCEEDED",
192
+ MaxReactionExceeded = "MAX_REACTION_EXCEEDED",
193
+ WriteInComputed = "WRITE_IN_COMPUTED",
194
+ TrackingError = "TRACKING_ERROR",
195
+ BrokenEffects = "BROKEN_EFFECTS"
196
+ }
197
+ export type CycleDebugInfo = {
198
+ code: ReactiveErrorCode.CycleDetected;
199
+ cycle: string[];
200
+ details?: string;
201
+ };
202
+ export type MaxDepthDebugInfo = {
203
+ code: ReactiveErrorCode.MaxDepthExceeded;
204
+ depth: number;
205
+ chain: string[];
206
+ };
207
+ export type MaxReactionDebugInfo = {
208
+ code: ReactiveErrorCode.MaxReactionExceeded;
209
+ count: number;
210
+ effect: string;
211
+ };
212
+ export type GenericDebugInfo = {
213
+ code: ReactiveErrorCode;
214
+ causalChain?: string[];
215
+ creationStack?: string | any[];
216
+ lineage?: any[];
217
+ [key: string]: any;
218
+ };
219
+ export type ReactiveDebugInfo = CycleDebugInfo | MaxDepthDebugInfo | MaxReactionDebugInfo | GenericDebugInfo;
220
+ /**
221
+ * Error class for reactive system errors
222
+ */
223
+ export declare class ReactiveError extends Error {
224
+ debugInfo?: ReactiveDebugInfo;
225
+ constructor(message: string, debugInfo?: ReactiveDebugInfo);
226
+ get code(): ReactiveErrorCode | undefined;
227
+ get cause(): any;
228
+ }
229
+ /**
230
+ * Global options for the reactive system
231
+ */
232
+ export declare const options: {
233
+ /**
234
+ * Debug purpose: called when an effect is entered
235
+ * @param effect - The effect that is entered
236
+ */
237
+ enter: (_effect: Function) => void;
238
+ /**
239
+ * Debug purpose: called when an effect is left
240
+ * @param effect - The effect that is left
241
+ */
242
+ leave: (_effect: Function) => void;
243
+ /**
244
+ * Debug purpose: called when an effect is chained
245
+ * @param target - The effect that is being triggered
246
+ * @param caller - The effect that is calling the target
247
+ */
248
+ chain: (_targets: Function[], _caller?: Function) => void;
249
+ /**
250
+ * Debug purpose: called when an effect chain is started
251
+ * @param target - The effect that is being triggered
252
+ */
253
+ beginChain: (_targets: Function[]) => void;
254
+ /**
255
+ * Debug purpose: called when an effect chain is ended
256
+ */
257
+ endChain: () => void;
258
+ garbageCollected: (_fn: Function) => void;
259
+ /**
260
+ * Debug purpose: called when an object is touched
261
+ * @param obj - The object that is touched
262
+ * @param evolution - The type of change
263
+ * @param props - The properties that changed
264
+ * @param deps - The dependencies that changed
265
+ */
266
+ touched: (_obj: any, _evolution: Evolution, _props?: any[], _deps?: Set<EffectTrigger>) => void;
267
+ /**
268
+ * Debug purpose: called when an effect is skipped because it's already running
269
+ * @param effect - The effect that is already running
270
+ * @param runningChain - The array of effects from the detected one to the currently running one
271
+ */
272
+ skipRunningEffect: (_effect: EffectTrigger) => void;
273
+ /**
274
+ * Debug purpose: maximum effect chain (like call stack max depth)
275
+ * Used to prevent infinite loops
276
+ * @default 100
277
+ */
278
+ maxEffectChain: number;
279
+ /**
280
+ * Maximum number of times an effect can be triggered by the same cause in a single batch
281
+ * Used to detect aggressive re-computation or infinite loops
282
+ * @default 10
283
+ */
284
+ maxTriggerPerBatch: number;
285
+ /**
286
+ * Debug purpose: maximum effect reaction (like call stack max depth)
287
+ * Used to prevent infinite loops
288
+ * @default 'throw'
289
+ */
290
+ maxEffectReaction: "throw" | "debug" | "warn";
291
+ /**
292
+ * Callback called when a memoization discrepancy is detected (debug only)
293
+ * When defined, memoized functions will run a second time (untracked) to verify consistency.
294
+ * If the untracked run returns a different value than the cached one, this callback is triggered.
295
+ *
296
+ * This is the primary tool for detecting missing reactive dependencies in computed values.
297
+ *
298
+ * @param cached - The value currently in the memoization cache
299
+ * @param fresh - The value obtained by re-running the function untracked
300
+ * @param fn - The memoized function itself
301
+ * @param args - Arguments passed to the function
302
+ *
303
+ * @example
304
+ * ```typescript
305
+ * reactiveOptions.onMemoizationDiscrepancy = (cached, fresh, fn, args) => {
306
+ * throw new Error(`Memoization discrepancy in ${fn.name}!`);
307
+ * };
308
+ * ```
309
+ */
310
+ onMemoizationDiscrepancy: ((cached: any, fresh: any, fn: Function, args: any[], cause: "calculation" | "comparison") => void) | undefined;
311
+ /**
312
+ * How to handle cycles detected in effect batches.
313
+ *
314
+ * - `'production'` (Default): High-performance mode. Disables dependency graph maintenance and
315
+ * Topological Sorting in favor of a simple FIFO queue. Use this for trustworthy, acyclic UI code.
316
+ * Cycle detection is heuristic (uses maxEffectChain execution counts).
317
+ *
318
+ * - `'development'`: Maintains direct dependency graph for early cycle detection during edge creation.
319
+ * Catches cycles before effects execute via DFS check when adding edges. Throws immediately with
320
+ * basic path information. Good balance of debugging help with moderate overhead.
321
+ *
322
+ * - `'debug'`: Full diagnostic mode with transitive closures and topological sorting.
323
+ * Provides detailed cycle path reporting. Highest overhead but most informative for bug hunting.
324
+ *
325
+ * @default 'production'
326
+ */
327
+ cycleHandling: "production" | "development" | "debug";
328
+ /**
329
+ * Internal flag used by memoization discrepancy detector to avoid counting calls in tests
330
+ * @warning Do not modify this flag manually, this flag is given by the engine
331
+ */
332
+ isVerificationRun: boolean;
333
+ /**
334
+ * Maximum depth for deep watching traversal
335
+ * Used to prevent infinite recursion in circular references
336
+ * @default 100
337
+ */
338
+ maxDeepWatchDepth: number;
339
+ /**
340
+ * Only react on instance members modification (not inherited properties)
341
+ * For instance, do not track class methods
342
+ * @default true
343
+ */
344
+ instanceMembers: boolean;
345
+ /**
346
+ * Ignore accessors (getters and setters) and only track direct properties
347
+ * @default true
348
+ */
349
+ ignoreAccessors: boolean;
350
+ /**
351
+ * Enable recursive touching when objects with the same prototype are replaced
352
+ * When enabled, replacing an object with another of the same prototype triggers
353
+ * recursive diffing instead of notifying parent effects
354
+ * @default true
355
+ */
356
+ recursiveTouching: boolean;
357
+ /**
358
+ * Default async execution mode for effects that return Promises
359
+ * - 'cancel': Cancel previous async execution when dependencies change (default, enables async zone)
360
+ * - 'queue': Queue next execution to run after current completes (enables async zone)
361
+ * - 'ignore': Ignore new executions while async work is running (enables async zone)
362
+ * - false: Disable async zone and async mode handling (effects run concurrently)
363
+ *
364
+ * **When truthy:** Enables async zone (Promise.prototype wrapping) for automatic context
365
+ * preservation in Promise callbacks. Warning: This modifies Promise.prototype globally.
366
+ * Only enable if no other library modifies Promise.prototype.
367
+ *
368
+ * **When false:** Async zone is disabled. Use `tracked()` manually in Promise callbacks.
369
+ *
370
+ * Can be overridden per-effect via EffectOptions
371
+ * @default 'cancel'
372
+ */
373
+ asyncMode: AsyncExecutionMode | false;
374
+ warn: (...args: any[]) => void;
375
+ /**
376
+ * Configuration for the introspection system
377
+ */
378
+ introspection: {
379
+ /**
380
+ * Whether to keep a history of mutations for debugging
381
+ * @default false
382
+ */
383
+ enableHistory: boolean;
384
+ /**
385
+ * Number of mutations to keep in history
386
+ * @default 50
387
+ */
388
+ historySize: number;
389
+ };
390
+ /**
391
+ * Configuration for zone hooks - control which async APIs are hooked
392
+ * Each option controls whether the corresponding async API is wrapped to preserve effect context
393
+ * Only applies when asyncMode is enabled (truthy)
394
+ * @deprecated Should take all when we made sure PIXI.create, Game.create, ... are -> .root()
395
+ */
396
+ zones: {
397
+ /**
398
+ * Hook setTimeout to preserve effect context
399
+ * @default true
400
+ */
401
+ setTimeout: boolean;
402
+ /**
403
+ * Hook setInterval to preserve effect context
404
+ * @default true
405
+ */
406
+ setInterval: boolean;
407
+ /**
408
+ * Hook requestAnimationFrame (runs in untracked context when hooked)
409
+ * @default true
410
+ */
411
+ requestAnimationFrame: boolean;
412
+ /**
413
+ * Hook queueMicrotask to preserve effect context
414
+ * @default true
415
+ */
416
+ queueMicrotask: boolean;
417
+ };
418
+ };
419
+ type CallableOption = {
420
+ [K in keyof typeof options]: (typeof options)[K] extends ((...args: any[]) => any) | undefined ? K : never;
421
+ }[keyof typeof options];
422
+ export declare function optionCall<K extends CallableOption>(name: K, ...args: NonNullable<(typeof options)[K]> extends (...a: infer A) => unknown ? A : never): void;
423
+ export { type State, nativeReactive, rootFunction };
424
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/reactive/types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,MAAM,MAAM,kBAAkB,GAAG;IAChC,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;CAC9C,CAAA;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC5B;;;;;;;;;;;OAWG;IACH,OAAO,EAAE,eAAe,CAAA;IACxB;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,EAAE,eAAe,CAAA;IACvB;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,EAAE,OAAO,CAAA;CACjB;AAID;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,IAAI,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CAAC,SAAS,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,GAAG,SAAS,GAC3F,CAAC,GACD,KAAK;CACR,CAAC,MAAM,OAAO,OAAO,CAAC,CAAA;AAEvB,wBAAgB,UAAU,CAAC,CAAC,SAAS,cAAc,EAClD,IAAI,EAAE,CAAC,EACP,GAAG,IAAI,EAAE,WAAW,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,KAAK,OAAO,GAAG,CAAC,GAAG,KAAK,GACtF,IAAI,CAQN;AAED,OAAO,EAAE,KAAK,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,CAAA"}
@@ -0,0 +1,48 @@
1
+ import { type GenericClassDecorator } from '../decorator';
2
+ import { type EffectAccess, type EffectCleanup } from './types';
3
+ /**
4
+ * Options for the watch function
5
+ */
6
+ export interface WatchOptions {
7
+ /** Whether to call the callback immediately */
8
+ immediate?: boolean;
9
+ /** Whether to watch nested properties */
10
+ deep?: boolean;
11
+ }
12
+ /**
13
+ * Watches a reactive value and calls a callback when it changes
14
+ * @param value - Function that returns the value to watch
15
+ * @param changed - Callback to call when the value changes
16
+ * @param options - Watch options
17
+ * @returns Cleanup function to stop watching
18
+ */
19
+ export declare function watch<T>(value: (dep: EffectAccess) => T, changed: (value: T, oldValue?: T) => void, options?: Omit<WatchOptions, 'deep'> & {
20
+ deep?: false;
21
+ }): EffectCleanup;
22
+ /**
23
+ * Watches a reactive value with deep watching enabled
24
+ * @param value - Function that returns the value to watch
25
+ * @param changed - Callback to call when the value changes
26
+ * @param options - Watch options with deep watching enabled
27
+ * @returns Cleanup function to stop watching
28
+ */
29
+ export declare function watch<T extends object | any[]>(value: (dep: EffectAccess) => T, changed: (value: T, oldValue?: T) => void, options?: Omit<WatchOptions, 'deep'> & {
30
+ deep: true;
31
+ }): EffectCleanup;
32
+ /**
33
+ * Watches a reactive object directly
34
+ * @param value - The reactive object to watch
35
+ * @param changed - Callback to call when the object changes
36
+ * @param options - Watch options
37
+ * @returns Cleanup function to stop watching
38
+ */
39
+ export declare function watch<T extends object | any[]>(value: T, changed: (value: T) => void, options?: WatchOptions): EffectCleanup;
40
+ declare function unreactiveApplication<T extends object>(...args: (keyof T)[]): GenericClassDecorator<T>;
41
+ declare function unreactiveApplication<T extends object>(obj: T): T;
42
+ /**
43
+ * Decorator that marks classes or properties as non-reactive
44
+ * Prevents objects from being made reactive
45
+ */
46
+ export declare const unreactive: import("../decorator").LegacyClassDecorator<new (...args: any[]) => any> & import("../decorator").ModernClassDecorator<new (...args: any[]) => any> & typeof unreactiveApplication;
47
+ export {};
48
+ //# sourceMappingURL=watch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../src/reactive/watch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAOpE,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,aAAa,EAIlB,MAAM,SAAS,CAAA;AAKhB;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,+CAA+C;IAC/C,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,yCAAyC;IACzC,IAAI,CAAC,EAAE,OAAO,CAAA;CACd;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,CAAC,EACtB,KAAK,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,CAAC,EAC/B,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC,KAAK,IAAI,EACzC,OAAO,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,KAAK,CAAA;CAAE,GACrD,aAAa,CAAA;AAChB;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,GAAG,EAAE,EAC7C,KAAK,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,CAAC,EAC/B,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC,KAAK,IAAI,EACzC,OAAO,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,GAAG;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,GACnD,aAAa,CAAA;AAChB;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,GAAG,EAAE,EAC7C,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,EAC3B,OAAO,CAAC,EAAE,YAAY,GACpB,aAAa,CAAA;AAqFhB,iBAAS,qBAAqB,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAA;AAChG,iBAAS,qBAAqB,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAkB3D;;;GAGG;AACH,eAAO,MAAM,UAAU,oLAMrB,CAAA"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Decorator that caches the result of a getter method and only recomputes when dependencies change
3
+ * Prevents circular dependencies and provides automatic cache invalidation
4
+ */
5
+ export declare const cached: import("./decorator").LegacyPropertyDecorator<any> & import("./decorator").ModernGetterDecorator<any> & import("./decorator").ModernAccessorDecorator<any>;
6
+ /**
7
+ * Checks if a property is cached (has a cached value)
8
+ * @param object - The object to check
9
+ * @param propertyKey - The property key to check
10
+ * @returns True if the property has a cached value
11
+ */
12
+ export declare function isCached(object: Object, propertyKey: PropertyKey): boolean;
13
+ /**
14
+ * Caches a value for a property on an object
15
+ * @param object - The object to cache the value on
16
+ * @param propertyKey - The property key to cache
17
+ * @param value - The value to cache
18
+ */
19
+ export declare function cache(object: Object, propertyKey: PropertyKey, value: any): void;
20
+ /**
21
+ * Creates a decorator that modifies property descriptors for specified properties
22
+ * @param descriptor - The descriptor properties to apply
23
+ * @returns A class decorator that applies the descriptor to specified properties
24
+ */
25
+ export declare const descriptor: any;
26
+ /**
27
+ * Decorator that marks methods, properties, or classes as deprecated
28
+ * Provides warning messages when deprecated items are used
29
+ */
30
+ export declare const deprecated: import("./decorator").LegacyPropertyDecorator<any> & import("./decorator").ModernMethodDecorator<any> & import("./decorator").LegacyClassDecorator<new (...args: any[]) => any> & import("./decorator").ModernClassDecorator<new (...args: any[]) => any> & import("./decorator").ModernGetterDecorator<any> & import("./decorator").ModernAccessorDecorator<any> & import("./decorator").ModernSetterDecorator<any> & ((message: string) => import("./decorator").LegacyPropertyDecorator<any> & import("./decorator").ModernMethodDecorator<any> & import("./decorator").LegacyClassDecorator<new (...args: any[]) => any> & import("./decorator").ModernClassDecorator<new (...args: any[]) => any> & import("./decorator").ModernGetterDecorator<any> & import("./decorator").ModernAccessorDecorator<any> & import("./decorator").ModernSetterDecorator<any>) & {
31
+ warn: (target: any, propertyKey: PropertyKey, message?: string) => void;
32
+ };
33
+ /**
34
+ * Creates a debounced method decorator that delays execution until after the delay period has passed
35
+ * @param delay - The delay in milliseconds
36
+ * @returns A method decorator that debounces method calls
37
+ */
38
+ export declare function debounce(delay: number): import("./decorator").LegacyPropertyDecorator<any> & import("./decorator").ModernMethodDecorator<any>;
39
+ /**
40
+ * Creates a throttled method decorator that limits execution to once per delay period
41
+ * @param delay - The delay in milliseconds
42
+ * @returns A method decorator that throttles method calls
43
+ */
44
+ export declare function throttle(delay: number): import("./decorator").LegacyPropertyDecorator<any> & import("./decorator").ModernMethodDecorator<any>;
45
+ //# sourceMappingURL=std-decorators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"std-decorators.d.ts","sourceRoot":"","sources":["../../src/std-decorators.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,eAAO,MAAM,MAAM,4JAuBjB,CAAA;AAEF;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,WAEhE;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,QAEzE;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU,KAyDtB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,oaA4BJ,MAAM;mBAgCR,GAAG,eAAe,WAAW,YAAY,MAAM;CAO/D,CAAA;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,yGAmBrC;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,yGAiCrC"}
@@ -0,0 +1,49 @@
1
+ type ElementTypes<T extends readonly unknown[]> = {
2
+ [K in keyof T]: T[K] extends readonly (infer U)[] ? U : T[K];
3
+ };
4
+ /**
5
+ * Combines multiple arrays into an array of tuples, stopping at the shortest array length
6
+ * @param args - Arrays to zip together
7
+ * @returns Array of tuples containing elements from each input array
8
+ */
9
+ export declare function zip<T extends (readonly unknown[])[]>(...args: T): ElementTypes<T>[];
10
+ /**
11
+ * Checks if two arrays are strictly equal (shallow comparison)
12
+ * @param a - First value
13
+ * @param b - Second value
14
+ * @returns True if arrays are equal or values are strictly equal
15
+ */
16
+ export declare function arrayEquals(a: any, b: any): boolean;
17
+ /**
18
+ * Checks if a function is a constructor (class or constructor function)
19
+ * @param fn - The function to check
20
+ * @returns True if the function is a constructor
21
+ */
22
+ export declare function isConstructor(fn: Function): boolean;
23
+ /**
24
+ * Renames a function with a new name
25
+ * @param fct - The function to rename
26
+ * @param name - The new name for the function
27
+ * @returns The function with the new name
28
+ */
29
+ export declare function renamed<F extends Function>(fct: F, name: string): F;
30
+ export declare const FoolProof: {
31
+ get(obj: any, prop: any, receiver: any): any;
32
+ set(obj: any, prop: any, value: any, receiver: any): boolean;
33
+ };
34
+ export declare function isOwnAccessor(obj: any, prop: any): boolean;
35
+ /**
36
+ * Deeply compares two values.
37
+ * For objects, compares prototypes with === and then own properties recursively.
38
+ * Uses a cache to handle circular references.
39
+ * @param a - First value
40
+ * @param b - Second value
41
+ * @param cache - Map for circular reference protection (internal use)
42
+ * @returns True if values are deeply equal
43
+ */
44
+ export declare function deepCompare(a: any, b: any, cache?: Map<object, Set<object>>): boolean;
45
+ export declare function contentRef(container: object): any;
46
+ export declare function tag<T extends object>(name: string, obj: T): T;
47
+ export declare function named<T extends Function>(name: string, fn: T): T;
48
+ export {};
49
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,IAAI;KAChD,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAC5D,CAAA;AAED;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,CAAC,SAAS,CAAC,SAAS,OAAO,EAAE,CAAC,EAAE,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,EAAE,CAWnF;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,CAQnD;AA0BD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAMnD;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAMnE;AACD,eAAO,MAAM,SAAS;aACZ,GAAG,QAAQ,GAAG,YAAY,GAAG;aAK7B,GAAG,QAAQ,GAAG,SAAS,GAAG,YAAY,GAAG;CAiBlD,CAAA;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,WAGhD;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,2BAAiC,GAAG,OAAO,CAqI3F;AAGD,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,OAW3C;AAED,wBAAgB,GAAG,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAc7D;AAED,wBAAgB,KAAK,CAAC,CAAC,SAAS,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAOhE"}
@@ -0,0 +1,40 @@
1
+ export declare abstract class AZone<T> {
2
+ abstract active?: T;
3
+ protected enter(value?: T): unknown;
4
+ protected leave(entered: unknown): void;
5
+ with<R>(value: T | undefined, fn: () => R): R;
6
+ root<R>(fn: () => R): R;
7
+ get zoned(): FunctionWrapper;
8
+ }
9
+ export type FunctionWrapper = <R>(fn: () => R) => R;
10
+ export declare class Zone<T> extends AZone<T> {
11
+ active: T | undefined;
12
+ }
13
+ type HistoryValue<T> = {
14
+ present: T | undefined;
15
+ history: Set<T>;
16
+ };
17
+ export declare class ZoneHistory<T> extends AZone<HistoryValue<T>> {
18
+ private controlled;
19
+ private history;
20
+ readonly present: AZone<T>;
21
+ has(value: T): boolean;
22
+ some(predicate: (value: T) => boolean): boolean;
23
+ constructor(controlled?: AZone<T>);
24
+ get active(): HistoryValue<T> | undefined;
25
+ set active(value: HistoryValue<T> | undefined);
26
+ }
27
+ export declare class ZoneAggregator extends AZone<Map<AZone<unknown>, unknown>> {
28
+ #private;
29
+ constructor(...zones: AZone<unknown>[]);
30
+ get active(): Map<AZone<unknown>, unknown> | undefined;
31
+ set active(value: Map<AZone<unknown>, unknown> | undefined);
32
+ enter(value?: Map<AZone<unknown>, unknown> | undefined): Map<AZone<unknown>, unknown>;
33
+ leave(entered: Map<AZone<unknown>, unknown>): void;
34
+ add(z: AZone<unknown>): void;
35
+ delete(z: AZone<unknown>): void;
36
+ clear(): void;
37
+ }
38
+ export declare const asyncZone: ZoneAggregator;
39
+ export {};
40
+ //# sourceMappingURL=zone.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zone.d.ts","sourceRoot":"","sources":["../../src/zone.ts"],"names":[],"mappings":"AAUA,8BAAsB,KAAK,CAAC,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IACnB,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,OAAO;IAKnC,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAGvC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC;IAY7C,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC;IAQvB,IAAI,KAAK,IAAI,eAAe,CAG3B;CACD;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAA;AAEnD,qBAAa,IAAI,CAAC,CAAC,CAAE,SAAQ,KAAK,CAAC,CAAC,CAAC;IACpC,MAAM,EAAE,CAAC,GAAG,SAAS,CAAA;CACrB;AAED,KAAK,YAAY,CAAC,CAAC,IAAI;IAAE,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC;IAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,CAAA;CAAE,CAAA;AAClE,qBAAa,WAAW,CAAC,CAAC,CAAE,SAAQ,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAU7C,OAAO,CAAC,UAAU;IAT9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