@solidjs/signals 2.0.0-beta.15 → 2.0.0-beta.17

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 (88) hide show
  1. package/dist/dev.js +782 -413
  2. package/dist/node.cjs +1927 -1625
  3. package/dist/prod.js +1525 -1227
  4. package/dist/types/boundaries.d.ts +3 -3
  5. package/dist/types/core/async.d.ts +1 -0
  6. package/dist/types/core/core.d.ts +25 -1
  7. package/dist/types/core/dev.d.ts +10 -2
  8. package/dist/types/core/effect.d.ts +1 -3
  9. package/dist/types/core/error.d.ts +2 -0
  10. package/dist/types/core/graph.d.ts +1 -1
  11. package/dist/types/core/index.d.ts +2 -2
  12. package/dist/types/core/invariants.d.ts +49 -0
  13. package/dist/types/core/scheduler.d.ts +8 -0
  14. package/dist/types/core/types.d.ts +19 -0
  15. package/dist/types/index.d.ts +1 -1
  16. package/dist/types/signals.d.ts +39 -2
  17. package/dist/types/store/projection.d.ts +2 -2
  18. package/dist/types/store/store.d.ts +28 -1
  19. package/dist/types-cjs/boundaries.d.cts +3 -3
  20. package/dist/types-cjs/core/async.d.cts +1 -0
  21. package/dist/types-cjs/core/core.d.cts +25 -1
  22. package/dist/types-cjs/core/dev.d.cts +10 -2
  23. package/dist/types-cjs/core/effect.d.cts +1 -3
  24. package/dist/types-cjs/core/error.d.cts +2 -0
  25. package/dist/types-cjs/core/graph.d.cts +1 -1
  26. package/dist/types-cjs/core/index.d.cts +2 -2
  27. package/dist/types-cjs/core/invariants.d.cts +49 -0
  28. package/dist/types-cjs/core/scheduler.d.cts +8 -0
  29. package/dist/types-cjs/core/types.d.cts +19 -0
  30. package/dist/types-cjs/index.d.cts +1 -1
  31. package/dist/types-cjs/signals.d.cts +39 -2
  32. package/dist/types-cjs/store/projection.d.cts +2 -2
  33. package/dist/types-cjs/store/store.d.cts +28 -1
  34. package/package.json +1 -1
  35. package/dist/types/src/boundaries.d.ts +0 -173
  36. package/dist/types/src/core/action.d.ts +0 -35
  37. package/dist/types/src/core/async.d.ts +0 -6
  38. package/dist/types/src/core/constants.d.ts +0 -51
  39. package/dist/types/src/core/context.d.ts +0 -36
  40. package/dist/types/src/core/core.d.ts +0 -174
  41. package/dist/types/src/core/dev.d.ts +0 -49
  42. package/dist/types/src/core/effect.d.ts +0 -32
  43. package/dist/types/src/core/error.d.ts +0 -38
  44. package/dist/types/src/core/external.d.ts +0 -45
  45. package/dist/types/src/core/graph.d.ts +0 -5
  46. package/dist/types/src/core/heap.d.ts +0 -14
  47. package/dist/types/src/core/index.d.ts +0 -12
  48. package/dist/types/src/core/lanes.d.ts +0 -54
  49. package/dist/types/src/core/owner.d.ts +0 -116
  50. package/dist/types/src/core/scheduler.d.ts +0 -122
  51. package/dist/types/src/core/types.d.ts +0 -85
  52. package/dist/types/src/index.d.ts +0 -9
  53. package/dist/types/src/map.d.ts +0 -53
  54. package/dist/types/src/signals.d.ts +0 -512
  55. package/dist/types/src/store/index.d.ts +0 -9
  56. package/dist/types/src/store/optimistic.d.ts +0 -45
  57. package/dist/types/src/store/projection.d.ts +0 -66
  58. package/dist/types/src/store/reconcile.d.ts +0 -23
  59. package/dist/types/src/store/store.d.ts +0 -125
  60. package/dist/types/src/store/storePath.d.ts +0 -58
  61. package/dist/types/src/store/utils.d.ts +0 -114
  62. package/dist/types-cjs/src/boundaries.d.cts +0 -173
  63. package/dist/types-cjs/src/core/action.d.cts +0 -35
  64. package/dist/types-cjs/src/core/async.d.cts +0 -6
  65. package/dist/types-cjs/src/core/constants.d.cts +0 -51
  66. package/dist/types-cjs/src/core/context.d.cts +0 -36
  67. package/dist/types-cjs/src/core/core.d.cts +0 -174
  68. package/dist/types-cjs/src/core/dev.d.cts +0 -49
  69. package/dist/types-cjs/src/core/effect.d.cts +0 -32
  70. package/dist/types-cjs/src/core/error.d.cts +0 -38
  71. package/dist/types-cjs/src/core/external.d.cts +0 -45
  72. package/dist/types-cjs/src/core/graph.d.cts +0 -5
  73. package/dist/types-cjs/src/core/heap.d.cts +0 -14
  74. package/dist/types-cjs/src/core/index.d.cts +0 -12
  75. package/dist/types-cjs/src/core/lanes.d.cts +0 -54
  76. package/dist/types-cjs/src/core/owner.d.cts +0 -116
  77. package/dist/types-cjs/src/core/scheduler.d.cts +0 -122
  78. package/dist/types-cjs/src/core/types.d.cts +0 -85
  79. package/dist/types-cjs/src/index.d.cts +0 -9
  80. package/dist/types-cjs/src/map.d.cts +0 -53
  81. package/dist/types-cjs/src/signals.d.cts +0 -512
  82. package/dist/types-cjs/src/store/index.d.cts +0 -9
  83. package/dist/types-cjs/src/store/optimistic.d.cts +0 -45
  84. package/dist/types-cjs/src/store/projection.d.cts +0 -66
  85. package/dist/types-cjs/src/store/reconcile.d.cts +0 -23
  86. package/dist/types-cjs/src/store/store.d.cts +0 -125
  87. package/dist/types-cjs/src/store/storePath.d.cts +0 -58
  88. package/dist/types-cjs/src/store/utils.d.cts +0 -114
package/dist/prod.js CHANGED
@@ -12,6 +12,9 @@ class StatusError extends Error {
12
12
  this.source = e;
13
13
  }
14
14
  }
15
+ function unwrapStatusError(e) {
16
+ return e instanceof StatusError ? e.cause : e;
17
+ }
15
18
  class NoOwnerError extends Error {
16
19
  constructor() {
17
20
  super("");
@@ -54,6 +57,19 @@ const SUPPORTS_PROXY = typeof Proxy === "function";
54
57
  const defaultContext = {};
55
58
  const $REFRESH = Symbol("refresh");
56
59
  const DEV$1 = undefined;
60
+ function devCheckActiveOverrides(e) {
61
+ return;
62
+ }
63
+ function devCheckFlushStart() {
64
+ return;
65
+ }
66
+ typeof globalThis !== "undefined" && !!globalThis.process?.env?.COMPANION_CENSUS;
67
+ function devCensusCompanions(e) {
68
+ return;
69
+ }
70
+ function devCheckQuiescent(e) {
71
+ return;
72
+ }
57
73
  const signalLanes = new WeakMap();
58
74
  const activeLanes = new Set();
59
75
  function getOrCreateLane(e) {
@@ -66,7 +82,6 @@ function getOrCreateLane(e) {
66
82
  t = { o: e, u: new Set(), l: [[], []], T: null, S: activeTransition, _: i };
67
83
  signalLanes.set(e, t);
68
84
  activeLanes.add(t);
69
- e.O = false;
70
85
  return t;
71
86
  }
72
87
  function findLane(e) {
@@ -79,8 +94,11 @@ function mergeLanes(e, t) {
79
94
  if (e === t) return e;
80
95
  t.T = e;
81
96
  for (const n of t.u) e.u.add(n);
97
+ t.u.clear();
82
98
  e.l[0].push(...t.l[0]);
83
99
  e.l[1].push(...t.l[1]);
100
+ t.l[0].length = 0;
101
+ t.l[1].length = 0;
84
102
  return e;
85
103
  }
86
104
  function resolveLane(e) {
@@ -95,7 +113,7 @@ function resolveTransition(e) {
95
113
  return resolveLane(e)?.S ?? e.S;
96
114
  }
97
115
  function hasActiveOverride(e) {
98
- return !!(e.R !== undefined && e.R !== NOT_PENDING);
116
+ return !!(e.O !== undefined && e.O !== NOT_PENDING);
99
117
  }
100
118
  function assignOrMergeLane(e, t) {
101
119
  const n = findLane(t);
@@ -119,11 +137,13 @@ function assignOrMergeLane(e, t) {
119
137
  e.i = t;
120
138
  }
121
139
  const transitions = new Set();
122
- const dirtyQueue = { I: new Array(2e3).fill(undefined), p: false, h: 0, N: 0 };
123
- const zombieQueue = { I: new Array(2e3).fill(undefined), p: false, h: 0, N: 0 };
140
+ const dirtyQueue = { R: new Array(2e3).fill(undefined), p: false, I: 0, h: 0 };
141
+ const zombieQueue = { R: new Array(2e3).fill(undefined), p: false, I: 0, h: 0 };
124
142
  let clock = 0;
125
143
  let activeTransition = null;
126
144
  let scheduled = false;
145
+ let halted = false;
146
+ let haltNotified = false;
127
147
  let syncDepth = 0;
128
148
  let projectionWriteActive = false;
129
149
  let stashedOptimisticReads = null;
@@ -136,7 +156,7 @@ function canUseSimpleSyncFlush(e) {
136
156
  transitions.size === 0 &&
137
157
  activeLanes.size === 0 &&
138
158
  e.A.length === 0 &&
139
- e.P.length === 0 &&
159
+ e.N.length === 0 &&
140
160
  e.C.size === 0 &&
141
161
  transientStoreNodes.size === 0
142
162
  );
@@ -144,14 +164,14 @@ function canUseSimpleSyncFlush(e) {
144
164
  function sweepTransientStoreNodes() {
145
165
  if (transientStoreNodes.size === 0) return;
146
166
  for (const e of transientStoreNodes) {
147
- if (e.D !== null) {
167
+ if (e.P !== null) {
148
168
  transientStoreNodes.delete(e);
149
169
  continue;
150
170
  }
151
- if (e.m !== NOT_PENDING) continue;
152
- if (e.R !== undefined && e.R !== NOT_PENDING) continue;
171
+ if (e.D !== NOT_PENDING) continue;
172
+ if (e.O !== undefined && e.O !== NOT_PENDING) continue;
153
173
  transientStoreNodes.delete(e);
154
- e.V?.();
174
+ e.m?.();
155
175
  }
156
176
  }
157
177
  function enforceLoadingBoundary(e) {}
@@ -169,18 +189,18 @@ function runLaneEffects(e) {
169
189
  }
170
190
  }
171
191
  function queueStashedOptimisticEffects(e) {
172
- for (let t = e.D; t !== null; t = t.L) {
192
+ for (let t = e.P; t !== null; t = t.L) {
173
193
  const e = t.U;
174
- if (!e.G) continue;
175
- if (e.G === EFFECT_TRACKED) {
176
- if (!e.k) {
177
- e.k = true;
178
- e.F.enqueue(EFFECT_USER, e.W);
194
+ if (!e.V) continue;
195
+ if (e.V === EFFECT_TRACKED) {
196
+ if (!e.G) {
197
+ e.G = true;
198
+ e.F.enqueue(EFFECT_USER, e.k);
179
199
  }
180
200
  continue;
181
201
  }
182
- const n = e.M & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
183
- if (n.h > e.H) n.h = e.H;
202
+ const n = e.W & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
203
+ if (n.I > e.H) n.I = e.H;
184
204
  insertIntoHeap(e, n);
185
205
  }
186
206
  }
@@ -188,32 +208,36 @@ function setProjectionWriteActive(e) {
188
208
  projectionWriteActive = e;
189
209
  }
190
210
  function mergeTransitionState(e, t) {
191
- t.j = e;
192
- e.$.push(...t.$);
211
+ t.M = e;
212
+ e.j.push(...t.j);
193
213
  for (const n of activeLanes) if (n.S === t) n.S = e;
194
- e.P.push(...t.P);
214
+ e.N.push(...t.N);
195
215
  for (const n of t.C) e.C.add(n);
196
- for (const [n, i] of t.K) {
197
- let t = e.K.get(n);
198
- if (!t) e.K.set(n, (t = new Set()));
216
+ for (const [n, i] of t.$) {
217
+ let t = e.$.get(n);
218
+ if (!t) e.$.set(n, (t = new Set()));
199
219
  for (const e of i) t.add(e);
200
220
  }
201
- for (const n of t.Y) e.Y.add(n);
221
+ for (const n of t.K) e.K.add(n);
202
222
  }
203
223
  function resolveOptimisticNodes(e) {
204
- for (let t = 0; t < e.length; t++) {
205
- const n = e[t];
206
- n.i = undefined;
207
- if (n.m !== NOT_PENDING) {
208
- n.Z = n.m;
209
- n.m = NOT_PENDING;
210
- }
211
- const i = n.R;
212
- n.R = NOT_PENDING;
213
- if (i !== NOT_PENDING && n.Z !== i) insertSubs(n, true);
214
- n.S = null;
215
- }
216
- e.length = 0;
224
+ const t = e.length;
225
+ for (let n = 0; n < t; n++) {
226
+ const t = e[n];
227
+ t.i = undefined;
228
+ if (!(t.Y & STATUS_PENDING)) t.Y &= ~STATUS_UNINITIALIZED;
229
+ const i = t.O;
230
+ t.O = NOT_PENDING;
231
+ if (i !== NOT_PENDING && t.Z !== i) insertSubs(t, true);
232
+ t.S = null;
233
+ }
234
+ for (let n = 0; n < t; n++) {
235
+ const t = e[n];
236
+ if (t.B || t.q) snapCompanionsToState(t);
237
+ const i = t.t;
238
+ if (i && (i.B === t || i.q === t)) snapCompanionsToState(i);
239
+ }
240
+ e.splice(0, t);
217
241
  }
218
242
  function cleanupCompletedLanes(e) {
219
243
  for (const t of activeLanes) {
@@ -232,34 +256,53 @@ function cleanupCompletedLanes(e) {
232
256
  }
233
257
  }
234
258
  function schedule() {
259
+ if (halted) {
260
+ notifyHalted();
261
+ return;
262
+ }
235
263
  if (scheduled) return;
236
264
  scheduled = true;
237
- if (!syncDepth && !globalQueue.B && !projectionWriteActive) queueMicrotask(flush);
265
+ if (!syncDepth && !globalQueue.X && !projectionWriteActive) queueMicrotask(flush);
266
+ }
267
+ function haltReactivity() {
268
+ if (halted) return;
269
+ halted = true;
270
+ let e = "[REACTIVITY_HALTED] An uncaught error halted the reactive system.";
271
+ console.error(e);
272
+ }
273
+ function notifyHalted() {
274
+ if (haltNotified) return;
275
+ haltNotified = true;
276
+ console.error("[REACTIVITY_HALTED] Update ignored.");
277
+ }
278
+ function resetErrorHalt() {
279
+ halted = false;
280
+ haltNotified = false;
238
281
  }
239
282
  class Queue {
240
- q = null;
241
- X = [[], []];
283
+ J = null;
284
+ ee = [[], []];
242
285
  A = [];
243
286
  created = clock;
244
287
  addChild(e) {
245
288
  this.A.push(e);
246
- e.q = this;
289
+ e.J = this;
247
290
  }
248
291
  removeChild(e) {
249
292
  const t = this.A.indexOf(e);
250
293
  if (t >= 0) {
251
294
  this.A.splice(t, 1);
252
- e.q = null;
295
+ e.J = null;
253
296
  }
254
297
  }
255
298
  notify(e, t, n, i) {
256
- if (this.q) return this.q.notify(e, t, n, i);
299
+ if (this.J) return this.J.notify(e, t, n, i);
257
300
  return false;
258
301
  }
259
302
  run(e) {
260
- if (this.X[e - 1].length) {
261
- const t = this.X[e - 1];
262
- this.X[e - 1] = [];
303
+ if (this.ee[e - 1].length) {
304
+ const t = this.ee[e - 1];
305
+ this.ee[e - 1] = [];
263
306
  runQueue(t, e);
264
307
  }
265
308
  for (let t = 0; t < this.A.length; t++) this.A[t].run?.(e);
@@ -270,28 +313,28 @@ class Queue {
270
313
  const n = findLane(currentOptimisticLane);
271
314
  n.l[e - 1].push(t);
272
315
  } else {
273
- this.X[e - 1].push(t);
316
+ this.ee[e - 1].push(t);
274
317
  }
275
318
  }
276
319
  schedule();
277
320
  }
278
321
  stashQueues(e) {
279
- e.X[0].push(...this.X[0]);
280
- e.X[1].push(...this.X[1]);
281
- this.X = [[], []];
322
+ e.ee[0].push(...this.ee[0]);
323
+ e.ee[1].push(...this.ee[1]);
324
+ this.ee = [[], []];
282
325
  for (let t = 0; t < this.A.length; t++) {
283
326
  let n = this.A[t];
284
327
  let i = e.A[t];
285
328
  if (!i) {
286
- i = { X: [[], []], A: [] };
329
+ i = { ee: [[], []], A: [] };
287
330
  e.A[t] = i;
288
331
  }
289
332
  n.stashQueues(i);
290
333
  }
291
334
  }
292
335
  restoreQueues(e) {
293
- this.X[0].push(...e.X[0]);
294
- this.X[1].push(...e.X[1]);
336
+ this.ee[0].push(...e.ee[0]);
337
+ this.ee[1].push(...e.ee[1]);
295
338
  for (let t = 0; t < e.A.length; t++) {
296
339
  const n = e.A[t];
297
340
  let i = this.A[t];
@@ -300,41 +343,42 @@ class Queue {
300
343
  }
301
344
  }
302
345
  class GlobalQueue extends Queue {
303
- B = false;
304
- J = null;
305
- ee = [];
306
- P = [];
346
+ X = false;
347
+ te = null;
348
+ ne = [];
349
+ N = [];
307
350
  C = new Set();
308
- static te;
309
- static ne;
310
351
  static ie;
311
- static re = null;
352
+ static re;
353
+ static oe;
354
+ static se = null;
312
355
  flush() {
313
- if (this.B) return;
314
- this.B = true;
356
+ if (this.X) return;
357
+ this.X = true;
315
358
  try {
316
- runHeap(dirtyQueue, GlobalQueue.te);
359
+ if (false);
360
+ runHeap(dirtyQueue, GlobalQueue.ie);
317
361
  if (activeTransition) {
318
362
  const e = transitionComplete(activeTransition);
319
363
  if (!e) {
320
364
  const e = activeTransition;
321
- runHeap(zombieQueue, GlobalQueue.te);
322
- this.J = null;
323
- this.ee = [];
324
- this.P = [];
365
+ runHeap(zombieQueue, GlobalQueue.ie);
366
+ this.te = null;
367
+ this.ne = [];
368
+ this.N = [];
325
369
  this.C = new Set();
326
370
  runLaneEffects(EFFECT_RENDER);
327
371
  runLaneEffects(EFFECT_USER);
328
- this.stashQueues(e.oe);
372
+ this.stashQueues(e.ue);
329
373
  clock++;
330
- scheduled = dirtyQueue.N >= dirtyQueue.h;
331
- reassignPendingTransition(e.ee);
374
+ scheduled = dirtyQueue.h >= dirtyQueue.I;
375
+ reassignPendingTransition(e.ne);
332
376
  activeTransition = null;
333
- if (!e.$.length && !e.K.size && e.P.length) {
377
+ if (!e.j.length && !e.$.size && e.N.length) {
334
378
  stashedOptimisticReads = new Set();
335
- for (let t = 0; t < e.P.length; t++) {
336
- const n = e.P[t];
337
- if (n.se || n.ue & CONFIG_OWNED_WRITE) continue;
379
+ for (let t = 0; t < e.N.length; t++) {
380
+ const n = e.N[t];
381
+ if (n.ce || n.le & CONFIG_OWNED_WRITE) continue;
338
382
  stashedOptimisticReads.add(n);
339
383
  queueStashedOptimisticEffects(n);
340
384
  }
@@ -346,44 +390,52 @@ class GlobalQueue extends Queue {
346
390
  }
347
391
  return;
348
392
  }
349
- this.ee !== activeTransition.ee && this.ee.push(...activeTransition.ee);
350
- this.restoreQueues(activeTransition.oe);
393
+ this.ne !== activeTransition.ne && this.ne.push(...activeTransition.ne);
394
+ this.restoreQueues(activeTransition.ue);
351
395
  transitions.delete(activeTransition);
352
396
  const t = activeTransition;
353
397
  activeTransition = null;
354
- reassignPendingTransition(this.ee);
398
+ reassignPendingTransition(this.ne);
355
399
  finalizePureQueue(t);
356
400
  } else {
357
401
  if (canUseSimpleSyncFlush(this)) {
358
402
  commitPendingNodes();
359
- if (dirtyQueue.N >= dirtyQueue.h) {
360
- runHeap(dirtyQueue, GlobalQueue.te);
403
+ if (dirtyQueue.h >= dirtyQueue.I) {
404
+ runHeap(dirtyQueue, GlobalQueue.ie);
361
405
  commitPendingNodes();
362
406
  }
363
407
  } else {
364
- if (transitions.size) runHeap(zombieQueue, GlobalQueue.te);
408
+ if (transitions.size) runHeap(zombieQueue, GlobalQueue.ie);
365
409
  finalizePureQueue();
366
410
  }
367
411
  }
368
412
  clock++;
369
- scheduled = dirtyQueue.N >= dirtyQueue.h;
413
+ scheduled = dirtyQueue.h >= dirtyQueue.I;
370
414
  activeLanes.size && runLaneEffects(EFFECT_RENDER);
371
415
  this.run(EFFECT_RENDER);
372
416
  activeLanes.size && runLaneEffects(EFFECT_USER);
373
417
  this.run(EFFECT_USER);
374
418
  if (false);
419
+ if (
420
+ false &&
421
+ !scheduled &&
422
+ !activeTransition &&
423
+ transitions.size === 0 &&
424
+ activeLanes.size === 0
425
+ );
426
+ if (false);
375
427
  } finally {
376
- this.B = false;
428
+ this.X = false;
377
429
  }
378
430
  }
379
431
  notify(e, t, n, i) {
380
432
  if (t & STATUS_PENDING) {
381
433
  if (n & STATUS_PENDING) {
382
- const t = i !== undefined ? i : e.ce;
434
+ const t = i !== undefined ? i : e.ae;
383
435
  if (activeTransition && t) {
384
436
  const n = t.source;
385
- let i = activeTransition.K.get(n);
386
- if (!i) activeTransition.K.set(n, (i = new Set()));
437
+ let i = activeTransition.$.get(n);
438
+ if (!i) activeTransition.$.set(n, (i = new Set()));
387
439
  const r = i.size;
388
440
  i.add(e);
389
441
  if (i.size !== r) schedule();
@@ -396,18 +448,18 @@ class GlobalQueue extends Queue {
396
448
  initTransition(e) {
397
449
  if (e) e = currentTransition(e);
398
450
  if (e && e === activeTransition) return;
399
- if (!e && activeTransition && activeTransition.le === clock) return;
451
+ if (!e && activeTransition && activeTransition.fe === clock) return;
400
452
  if (!activeTransition) {
401
453
  activeTransition = e ?? {
402
- le: clock,
403
- ee: [],
404
- K: new Map(),
405
- P: [],
454
+ fe: clock,
455
+ ne: [],
456
+ $: new Map(),
457
+ N: [],
406
458
  C: new Set(),
407
- $: [],
408
- oe: { X: [[], []], A: [] },
409
- j: false,
410
- Y: new Set()
459
+ j: [],
460
+ ue: { ee: [[], []], A: [] },
461
+ M: false,
462
+ K: new Set()
411
463
  };
412
464
  } else if (e) {
413
465
  const t = activeTransition;
@@ -416,27 +468,27 @@ class GlobalQueue extends Queue {
416
468
  activeTransition = e;
417
469
  }
418
470
  transitions.add(activeTransition);
419
- activeTransition.le = clock;
420
- if (this.J !== null) {
421
- this.J.S = activeTransition;
422
- activeTransition.ee.push(this.J);
423
- this.J = null;
424
- }
425
- if (this.ee !== activeTransition.ee) {
426
- for (let e = 0; e < this.ee.length; e++) {
427
- const t = this.ee[e];
471
+ activeTransition.fe = clock;
472
+ if (this.te !== null) {
473
+ this.te.S = activeTransition;
474
+ activeTransition.ne.push(this.te);
475
+ this.te = null;
476
+ }
477
+ if (this.ne !== activeTransition.ne) {
478
+ for (let e = 0; e < this.ne.length; e++) {
479
+ const t = this.ne[e];
428
480
  t.S = activeTransition;
429
- activeTransition.ee.push(t);
481
+ activeTransition.ne.push(t);
430
482
  }
431
- this.ee = activeTransition.ee;
483
+ this.ne = activeTransition.ne;
432
484
  }
433
- if (this.P !== activeTransition.P) {
434
- for (let e = 0; e < this.P.length; e++) {
435
- const t = this.P[e];
485
+ if (this.N !== activeTransition.N) {
486
+ for (let e = 0; e < this.N.length; e++) {
487
+ const t = this.N[e];
436
488
  t.S = activeTransition;
437
- activeTransition.P.push(t);
489
+ activeTransition.N.push(t);
438
490
  }
439
- this.P = activeTransition.P;
491
+ this.N = activeTransition.N;
440
492
  }
441
493
  for (const e of activeLanes) {
442
494
  if (!e.S) e.S = activeTransition;
@@ -449,71 +501,73 @@ class GlobalQueue extends Queue {
449
501
  }
450
502
  function queuePendingNode(e) {
451
503
  if (activeTransition) {
452
- globalQueue.ee.push(e);
504
+ globalQueue.ne.push(e);
453
505
  return;
454
506
  }
455
- if (globalQueue.J === null && globalQueue.ee.length === 0) {
456
- globalQueue.J = e;
507
+ if (globalQueue.te === null && globalQueue.ne.length === 0) {
508
+ globalQueue.te = e;
457
509
  return;
458
510
  }
459
- if (globalQueue.J !== null) {
460
- globalQueue.ee.push(globalQueue.J);
461
- globalQueue.J = null;
511
+ if (globalQueue.te !== null) {
512
+ globalQueue.ne.push(globalQueue.te);
513
+ globalQueue.te = null;
462
514
  }
463
- globalQueue.ee.push(e);
515
+ globalQueue.ne.push(e);
464
516
  }
465
517
  function insertSubs(e, t = false) {
466
518
  const n = e.i || currentOptimisticLane;
467
- const i = e.ae !== undefined;
468
- for (let r = e.D; r !== null; r = r.L) {
469
- if (i && r.U.ue & CONFIG_IN_SNAPSHOT_SCOPE) {
470
- r.U.M |= REACTIVE_SNAPSHOT_STALE;
519
+ const i = e.Ee !== undefined;
520
+ for (let r = e.P; r !== null; r = r.L) {
521
+ if (i && r.U.le & CONFIG_IN_SNAPSHOT_SCOPE) {
522
+ r.U.W |= REACTIVE_SNAPSHOT_STALE;
471
523
  continue;
472
524
  }
473
525
  if (t && n) {
474
- r.U.M |= REACTIVE_OPTIMISTIC_DIRTY;
526
+ r.U.W |= REACTIVE_OPTIMISTIC_DIRTY;
475
527
  assignOrMergeLane(r.U, n);
476
528
  } else if (t) {
477
- r.U.M |= REACTIVE_OPTIMISTIC_DIRTY;
529
+ r.U.W |= REACTIVE_OPTIMISTIC_DIRTY;
478
530
  r.U.i = undefined;
479
531
  }
480
532
  const e = r.U;
481
- if (e.G === EFFECT_TRACKED) {
482
- if (!e.k) {
483
- e.k = true;
484
- e.F.enqueue(EFFECT_USER, e.W);
533
+ if (e.V === EFFECT_TRACKED) {
534
+ if (!e.G) {
535
+ e.G = true;
536
+ e.F.enqueue(EFFECT_USER, e.k);
485
537
  }
486
538
  continue;
487
539
  }
488
- const o = r.U.M & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
489
- if (o.h > r.U.H) o.h = r.U.H;
540
+ const o = r.U.W & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
541
+ if (o.I > r.U.H) o.I = r.U.H;
490
542
  insertIntoHeap(r.U, o);
491
543
  }
492
544
  }
493
545
  function commitPendingNode(e) {
494
546
  const t = e;
495
- if (!t.se) {
496
- if (e.m !== NOT_PENDING) {
497
- e.Z = e.m;
498
- e.m = NOT_PENDING;
547
+ if (!t.ce) {
548
+ if (e.D !== NOT_PENDING) {
549
+ e.Z = e.D;
550
+ e.D = NOT_PENDING;
499
551
  }
552
+ if (e.B || e.q) snapCompanionsToState(e);
500
553
  return;
501
554
  }
502
- if (e.m !== NOT_PENDING) {
503
- e.Z = e.m;
504
- e.m = NOT_PENDING;
505
- if (e.G && e.G !== EFFECT_TRACKED) e.k = true;
555
+ if (e.D !== NOT_PENDING) {
556
+ e.Z = e.D;
557
+ e.D = NOT_PENDING;
558
+ if (e.V && e.V !== EFFECT_TRACKED) e.G = true;
506
559
  }
507
- t.M &= ~REACTIVE_MANUAL_WRITE;
508
- if (!(t.fe & STATUS_PENDING)) t.fe &= ~STATUS_UNINITIALIZED;
509
- if (t.Ee !== null || t.Te !== null) GlobalQueue.ne(t, false, true);
560
+ t.W &= ~REACTIVE_MANUAL_WRITE;
561
+ if (!(t.Y & STATUS_PENDING)) t.Y &= ~STATUS_UNINITIALIZED;
562
+ if (t.de !== null || t.Te !== null) GlobalQueue.re(t, false, true);
563
+ if (e.B || e.q) snapCompanionsToState(e);
510
564
  }
511
565
  function commitPendingNodes() {
512
- if (globalQueue.J !== null) {
513
- commitPendingNode(globalQueue.J);
514
- globalQueue.J = null;
566
+ if (globalQueue.te !== null) {
567
+ commitPendingNode(globalQueue.te);
568
+ globalQueue.te = null;
515
569
  }
516
- const e = globalQueue.ee;
570
+ const e = globalQueue.ne;
517
571
  for (let t = 0; t < e.length; t++) {
518
572
  commitPendingNode(e[t]);
519
573
  }
@@ -523,31 +577,31 @@ function finalizePureQueue(e = null, t = false) {
523
577
  const n = !t;
524
578
  if (n) commitPendingNodes();
525
579
  if (!t && globalQueue.A.length) checkBoundaryChildren(globalQueue);
526
- const i = dirtyQueue.N >= dirtyQueue.h;
527
- if (i) runHeap(dirtyQueue, GlobalQueue.te);
580
+ const i = dirtyQueue.h >= dirtyQueue.I;
581
+ if (i) runHeap(dirtyQueue, GlobalQueue.ie);
528
582
  if (n) {
529
583
  if (i) commitPendingNodes();
530
- resolveOptimisticNodes(e ? e.P : globalQueue.P);
531
- if (e && e.Y.size) {
532
- for (const t of e.Y) {
533
- if (t.M & REACTIVE_DISPOSED) continue;
534
- if (t.G === EFFECT_TRACKED) {
535
- if (!t.k) {
536
- t.k = true;
537
- t.F.enqueue(EFFECT_USER, t.W);
584
+ resolveOptimisticNodes(e ? e.N : globalQueue.N);
585
+ if (e && e.K.size) {
586
+ for (const t of e.K) {
587
+ if (t.W & REACTIVE_DISPOSED) continue;
588
+ if (t.V === EFFECT_TRACKED) {
589
+ if (!t.G) {
590
+ t.G = true;
591
+ t.F.enqueue(EFFECT_USER, t.k);
538
592
  }
539
593
  continue;
540
594
  }
541
- const e = t.M & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
542
- if (e.h > t.H) e.h = t.H;
595
+ const e = t.W & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
596
+ if (e.I > t.H) e.I = t.H;
543
597
  insertIntoHeap(t, e);
544
598
  }
545
- e.Y.clear();
599
+ e.K.clear();
546
600
  }
547
601
  const t = e ? e.C : globalQueue.C;
548
- if (GlobalQueue.re && t.size) {
602
+ if (GlobalQueue.se && t.size) {
549
603
  for (const e of t) {
550
- GlobalQueue.re(e);
604
+ GlobalQueue.se(e);
551
605
  }
552
606
  t.clear();
553
607
  schedule();
@@ -585,9 +639,10 @@ function flush(e) {
585
639
  }
586
640
  }
587
641
  }
588
- if (globalQueue.B) {
642
+ if (globalQueue.X) {
589
643
  return;
590
644
  }
645
+ if (halted) return;
591
646
  while (scheduled || activeTransition) {
592
647
  globalQueue.flush();
593
648
  }
@@ -596,22 +651,22 @@ function runQueue(e, t) {
596
651
  for (let n = 0; n < e.length; n++) e[n](t);
597
652
  }
598
653
  function reporterBlocksSource(e, t) {
599
- if (e.M & (REACTIVE_ZOMBIE | REACTIVE_DISPOSED)) return false;
600
- if (e.Se === t || e.de?.has(t)) return true;
601
- for (let n = e._e; n; n = n.Oe) {
602
- let e = n.Re;
654
+ if (e.W & (REACTIVE_ZOMBIE | REACTIVE_DISPOSED)) return false;
655
+ if (e.Se === t || e._e?.has(t)) return true;
656
+ for (let n = e.Oe; n; n = n.Re) {
657
+ let e = n.pe;
603
658
  while (e) {
604
659
  if (e === t || e.Ie === t) return true;
605
660
  e = e.t;
606
661
  }
607
662
  }
608
- return !!(e.fe & STATUS_PENDING && e.ce instanceof NotReadyError && e.ce.source === t);
663
+ return !!(e.Y & STATUS_PENDING && e.ae instanceof NotReadyError && e.ae.source === t);
609
664
  }
610
665
  function transitionComplete(e) {
611
- if (e.j) return true;
612
- if (e.$.length) return false;
666
+ if (e.M) return true;
667
+ if (e.j.length) return false;
613
668
  let t = true;
614
- for (const [n, i] of e.K) {
669
+ for (const [n, i] of e.$) {
615
670
  let r = false;
616
671
  for (const e of i) {
617
672
  if (reporterBlocksSource(e, n)) {
@@ -620,32 +675,31 @@ function transitionComplete(e) {
620
675
  }
621
676
  i.delete(e);
622
677
  }
623
- if (!r) e.K.delete(n);
624
- else if (n.fe & STATUS_PENDING && n.ce?.source === n) {
678
+ if (!r) e.$.delete(n);
679
+ else if (n.Y & STATUS_PENDING && n.ae?.source === n) {
625
680
  t = false;
626
681
  break;
627
682
  }
628
683
  }
629
684
  if (t) {
630
- for (let n = 0; n < e.P.length; n++) {
631
- const i = e.P[n];
685
+ for (let n = 0; n < e.N.length; n++) {
686
+ const i = e.N[n];
632
687
  if (
633
688
  hasActiveOverride(i) &&
634
- "fe" in i &&
635
- i.fe & STATUS_PENDING &&
636
- i.ce instanceof NotReadyError &&
637
- i.ce.source !== i
689
+ "Y" in i &&
690
+ i.Y & STATUS_PENDING &&
691
+ i.ae instanceof NotReadyError
638
692
  ) {
639
693
  t = false;
640
694
  break;
641
695
  }
642
696
  }
643
697
  }
644
- t && (e.j = true);
698
+ t && (e.M = true);
645
699
  return t;
646
700
  }
647
701
  function currentTransition(e) {
648
- while (e.j && typeof e.j === "object") e = e.j;
702
+ while (e.M && typeof e.M === "object") e = e.M;
649
703
  return e;
650
704
  }
651
705
  function setActiveTransition(e) {
@@ -661,73 +715,73 @@ function runInTransition(e, t) {
661
715
  }
662
716
  }
663
717
  function actualInsertIntoHeap(e, t) {
664
- const n = (e.q?.pe ? e.q.he?.H : e.q?.H) ?? -1;
718
+ const n = (e.J?.he ? e.J.Ae?.H : e.J?.H) ?? -1;
665
719
  if (n >= e.H) e.H = n + 1;
666
720
  const i = e.H;
667
- const r = t.I[i];
668
- if (r === undefined) t.I[i] = e;
721
+ const r = t.R[i];
722
+ if (r === undefined) t.R[i] = e;
669
723
  else {
670
724
  const t = r.Ne;
671
- t.Ae = e;
725
+ t.Ce = e;
672
726
  e.Ne = t;
673
727
  r.Ne = e;
674
728
  }
675
- if (i > t.N) t.N = i;
729
+ if (i > t.h) t.h = i;
676
730
  }
677
731
  function insertIntoHeap(e, t) {
678
- let n = e.M;
732
+ let n = e.W;
679
733
  if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_MANUAL_WRITE)) return;
680
734
  if (n & REACTIVE_CHECK) {
681
- e.M = (n & -4) | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
682
- } else e.M = n | REACTIVE_IN_HEAP;
735
+ e.W = (n & -4) | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
736
+ } else e.W = n | REACTIVE_IN_HEAP;
683
737
  if (!(n & REACTIVE_IN_HEAP_HEIGHT)) actualInsertIntoHeap(e, t);
684
738
  }
685
739
  function insertIntoHeapHeight(e, t) {
686
- let n = e.M;
740
+ let n = e.W;
687
741
  if (
688
742
  n &
689
743
  (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_IN_HEAP_HEIGHT | REACTIVE_MANUAL_WRITE)
690
744
  )
691
745
  return;
692
- e.M = n | REACTIVE_IN_HEAP_HEIGHT;
746
+ e.W = n | REACTIVE_IN_HEAP_HEIGHT;
693
747
  actualInsertIntoHeap(e, t);
694
748
  }
695
749
  function deleteFromHeap(e, t) {
696
- const n = e.M;
750
+ const n = e.W;
697
751
  if (!(n & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT))) return;
698
- e.M = n & -25;
752
+ e.W = n & -25;
699
753
  const i = e.H;
700
- if (e.Ne === e) t.I[i] = undefined;
754
+ if (e.Ne === e) t.R[i] = undefined;
701
755
  else {
702
- const n = e.Ae;
703
- const r = t.I[i];
756
+ const n = e.Ce;
757
+ const r = t.R[i];
704
758
  const o = n ?? r;
705
- if (e === r) t.I[i] = n;
706
- else e.Ne.Ae = n;
759
+ if (e === r) t.R[i] = n;
760
+ else e.Ne.Ce = n;
707
761
  o.Ne = e.Ne;
708
762
  }
709
763
  e.Ne = e;
710
- e.Ae = undefined;
764
+ e.Ce = undefined;
711
765
  }
712
766
  function markHeap(e) {
713
767
  if (e.p) return;
714
768
  e.p = true;
715
- for (let t = 0; t <= e.N; t++) {
716
- for (let n = e.I[t]; n !== undefined; n = n.Ae) {
717
- if (n.M & REACTIVE_IN_HEAP) markNode(n);
769
+ for (let t = 0; t <= e.h; t++) {
770
+ for (let n = e.R[t]; n !== undefined; n = n.Ce) {
771
+ if (n.W & REACTIVE_IN_HEAP) markNode(n);
718
772
  }
719
773
  }
720
774
  }
721
775
  function markNode(e, t = REACTIVE_DIRTY) {
722
- const n = e.M;
776
+ const n = e.W;
723
777
  if ((n & (REACTIVE_CHECK | REACTIVE_DIRTY)) >= t) return;
724
- e.M = (n & -4) | t;
725
- for (let t = e.D; t !== null; t = t.L) {
778
+ e.W = (n & -4) | t;
779
+ for (let t = e.P; t !== null; t = t.L) {
726
780
  markNode(t.U, REACTIVE_CHECK);
727
781
  }
728
- if (e.Pe !== null) {
729
- for (let t = e.Pe; t !== null; t = t.Ce) {
730
- for (let e = t.D; e !== null; e = e.L) {
782
+ if (e.ye !== null) {
783
+ for (let t = e.ye; t !== null; t = t.Pe) {
784
+ for (let e = t.P; e !== null; e = e.L) {
731
785
  markNode(e.U, REACTIVE_CHECK);
732
786
  }
733
787
  }
@@ -735,28 +789,28 @@ function markNode(e, t = REACTIVE_DIRTY) {
735
789
  }
736
790
  function runHeap(e, t) {
737
791
  e.p = false;
738
- for (e.h = 0; e.h <= e.N; e.h++) {
739
- let n = e.I[e.h];
792
+ for (e.I = 0; e.I <= e.h; e.I++) {
793
+ let n = e.R[e.I];
740
794
  while (n !== undefined) {
741
- if (n.M & REACTIVE_IN_HEAP) t(n);
795
+ if (n.W & REACTIVE_IN_HEAP) t(n);
742
796
  else adjustHeight(n, e);
743
- n = e.I[e.h];
797
+ n = e.R[e.I];
744
798
  }
745
799
  }
746
- e.N = 0;
800
+ e.h = 0;
747
801
  }
748
802
  function adjustHeight(e, t) {
749
803
  deleteFromHeap(e, t);
750
804
  let n = e.H;
751
- for (let t = e._e; t; t = t.Oe) {
752
- const e = t.Re;
805
+ for (let t = e.Oe; t; t = t.Re) {
806
+ const e = t.pe;
753
807
  const i = e.Ie || e;
754
- if (i.se && i.H >= n) n = i.H + 1;
808
+ if (i.ce && i.H >= n) n = i.H + 1;
755
809
  }
756
810
  if (e.H !== n) {
757
811
  e.H = n;
758
- for (let t = e.D; t !== null; t = t.L) {
759
- insertIntoHeapHeight(t.U, t.U.M & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
812
+ for (let t = e.P; t !== null; t = t.L) {
813
+ insertIntoHeapHeight(t.U, t.U.W & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
760
814
  }
761
815
  }
762
816
  }
@@ -764,8 +818,8 @@ const PENDING_OWNER = {};
764
818
  function markDisposal(e) {
765
819
  let t = e.ge;
766
820
  while (t) {
767
- const e = t.M;
768
- t.M = e | REACTIVE_ZOMBIE;
821
+ const e = t.W;
822
+ t.W = e | REACTIVE_ZOMBIE;
769
823
  if (e & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT)) {
770
824
  deleteFromHeap(t, e & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
771
825
  if (e & REACTIVE_IN_HEAP) insertIntoHeap(t, zombieQueue);
@@ -776,53 +830,62 @@ function markDisposal(e) {
776
830
  }
777
831
  }
778
832
  function dispose(e) {
779
- let t = e._e;
833
+ let t = e.Oe;
780
834
  while (t !== null) {
781
835
  t = unlinkSubs(t);
782
836
  }
783
- e._e = null;
784
- e.ye = null;
837
+ e.Oe = null;
838
+ e.me = null;
785
839
  disposeChildren(e, true);
786
840
  }
787
841
  function disposeChildren(e, t = false, n) {
788
- const i = e.M;
842
+ const i = e.W;
789
843
  if (i & REACTIVE_DISPOSED) return;
790
- if (t) e.M = i | REACTIVE_DISPOSED;
791
- if (t && e.se) e.ve = null;
792
- let r = n ? e.Ee : e.ge;
844
+ if (t) {
845
+ e.W = i | REACTIVE_DISPOSED;
846
+ const t = e;
847
+ if (t.B || t.q) snapCompanionsToState(t);
848
+ }
849
+ if (t && e.ce) e.be = null;
850
+ let r = n ? e.de : e.ge;
793
851
  while (r) {
794
852
  const e = r.De;
795
- if (r._e) {
853
+ if (r.Oe) {
796
854
  const e = r;
797
- deleteFromHeap(e, e.M & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
798
- let t = e._e;
855
+ deleteFromHeap(e, e.W & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
856
+ let t = e.Oe;
799
857
  do {
800
858
  t = unlinkSubs(t);
801
859
  } while (t !== null);
802
- e._e = null;
803
- e.ye = null;
860
+ e.Oe = null;
861
+ e.me = null;
804
862
  }
805
863
  disposeChildren(r, true);
806
864
  r = e;
807
865
  }
808
866
  if (n) {
809
- e.Ee = null;
867
+ e.de = null;
810
868
  } else {
811
869
  e.ge = null;
812
- e.me = 0;
870
+ e.ve = 0;
813
871
  }
814
- if (t && !n && !(i & REACTIVE_ZOMBIE) && e.q !== null && !(e.q.M & REACTIVE_DISPOSED)) {
815
- const t = e.be;
872
+ if (t && !n && !(i & REACTIVE_ZOMBIE) && e.J !== null && !(e.J.W & REACTIVE_DISPOSED)) {
873
+ const t = e.we;
816
874
  const n = e.De;
817
875
  if (t !== null) t.De = n;
818
- else e.q.ge = n;
819
- if (n !== null) n.be = t;
820
- e.be = null;
876
+ else e.J.ge = n;
877
+ if (n !== null) n.we = t;
878
+ e.we = null;
821
879
  }
822
880
  runDisposal(e, n);
881
+ if (t && e.Le) {
882
+ const t = e.Le;
883
+ e.Le = undefined;
884
+ t();
885
+ }
823
886
  }
824
887
  function runDisposal(e, t) {
825
- let n = t ? e.Te : e.Ve;
888
+ let n = t ? e.Te : e.Ue;
826
889
  if (!n) return;
827
890
  if (Array.isArray(n)) {
828
891
  for (let e = 0; e < n.length; e++) {
@@ -832,12 +895,12 @@ function runDisposal(e, t) {
832
895
  } else {
833
896
  n.call(n);
834
897
  }
835
- t ? (e.Te = null) : (e.Ve = null);
898
+ t ? (e.Te = null) : (e.Ue = null);
836
899
  }
837
900
  function childId(e, t) {
838
901
  let n = e;
839
- while (n.ue & CONFIG_TRANSPARENT && n.q) n = n.q;
840
- if (n.id != null) return formatId(n.id, t ? n.me++ : n.me);
902
+ while (n.le & CONFIG_TRANSPARENT && n.J) n = n.J;
903
+ if (n.id != null) return formatId(n.id, t ? n.ve++ : n.ve);
841
904
  throw new Error("Cannot get child id from owner without an id");
842
905
  }
843
906
  function getNextChildId(e) {
@@ -860,13 +923,13 @@ function getOwner() {
860
923
  }
861
924
  function cleanup(e) {
862
925
  if (!context) return e;
863
- if (!context.Ve) context.Ve = e;
864
- else if (Array.isArray(context.Ve)) context.Ve.push(e);
865
- else context.Ve = [context.Ve, e];
926
+ if (!context.Ue) context.Ue = e;
927
+ else if (Array.isArray(context.Ue)) context.Ue.push(e);
928
+ else context.Ue = [context.Ue, e];
866
929
  return e;
867
930
  }
868
931
  function isDisposed(e) {
869
- return !!(e.M & (REACTIVE_DISPOSED | REACTIVE_ZOMBIE));
932
+ return !!(e.W & (REACTIVE_DISPOSED | REACTIVE_ZOMBIE));
870
933
  }
871
934
  function disposeRootSelf(e = true) {
872
935
  disposeChildren(this, e);
@@ -876,19 +939,19 @@ function createOwner(e) {
876
939
  const n = e?.transparent ?? false;
877
940
  const i = {
878
941
  id: e?.id ?? (n ? t?.id : t?.id != null ? getNextChildId(t) : undefined),
879
- ue: n ? CONFIG_TRANSPARENT : 0,
880
- pe: true,
881
- he: t?.pe ? t.he : t,
942
+ le: n ? CONFIG_TRANSPARENT : 0,
943
+ he: true,
944
+ Ae: t?.he ? t.Ae : t,
882
945
  ge: null,
883
946
  De: null,
884
- be: null,
885
- Ve: null,
947
+ we: null,
948
+ Ue: null,
886
949
  F: t?.F ?? globalQueue,
887
- we: t?.we || defaultContext,
888
- me: 0,
950
+ Ve: t?.Ve || defaultContext,
951
+ ve: 0,
889
952
  Te: null,
890
- Ee: null,
891
- q: t,
953
+ de: null,
954
+ J: t,
892
955
  dispose: disposeRootSelf
893
956
  };
894
957
  if (t) {
@@ -897,7 +960,7 @@ function createOwner(e) {
897
960
  t.ge = i;
898
961
  } else {
899
962
  i.De = e;
900
- e.be = i;
963
+ e.we = i;
901
964
  t.ge = i;
902
965
  }
903
966
  }
@@ -908,86 +971,82 @@ function createRoot(e, t) {
908
971
  return runWithOwner(n, () => e(() => n.dispose()));
909
972
  }
910
973
  function unlinkSubs(e) {
911
- const t = e.Re;
912
- const n = e.Oe;
974
+ const t = e.pe;
975
+ const n = e.Re;
913
976
  const i = e.L;
914
- const r = e.Le;
915
- if (i !== null) i.Le = r;
916
- else t.Ue = r;
977
+ const r = e.Ge;
978
+ if (i !== null) i.Ge = r;
979
+ else t.Fe = r;
917
980
  if (r !== null) r.L = i;
918
981
  else {
919
- t.D = i;
982
+ t.P = i;
920
983
  if (i === null) {
921
- t.V?.();
984
+ t.m?.();
922
985
  const e = t;
923
- e.se && e.ue & CONFIG_AUTO_DISPOSE && !(e.M & REACTIVE_ZOMBIE) && unobserved(e);
986
+ e.ce && e.le & CONFIG_AUTO_DISPOSE && !(e.W & REACTIVE_ZOMBIE) && unobserved(e);
924
987
  }
925
988
  }
926
989
  return n;
927
990
  }
928
991
  function trimStaleDeps(e) {
929
- const t = e.ye;
930
- let n = t !== null ? t.Oe : e._e;
992
+ const t = e.me;
993
+ let n = t !== null ? t.Re : e.Oe;
931
994
  if (n !== null) {
932
995
  do {
933
996
  n = unlinkSubs(n);
934
997
  } while (n !== null);
935
- if (t !== null) t.Oe = null;
936
- else e._e = null;
998
+ if (t !== null) t.Re = null;
999
+ else e.Oe = null;
937
1000
  }
938
1001
  }
939
1002
  function unobserved(e) {
940
- deleteFromHeap(e, e.M & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
941
- let t = e._e;
1003
+ deleteFromHeap(e, e.W & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1004
+ let t = e.Oe;
942
1005
  while (t !== null) {
943
1006
  t = unlinkSubs(t);
944
1007
  }
945
- e._e = null;
946
- e.ye = null;
1008
+ e.Oe = null;
1009
+ e.me = null;
947
1010
  disposeChildren(e, true);
948
1011
  }
949
- function link(e, t) {
950
- const n = t.ye;
951
- if (n !== null && n.Re === e) return;
952
- let i = null;
953
- const r = t.M & REACTIVE_RECOMPUTING_DEPS;
954
- if (r) {
955
- i = n !== null ? n.Oe : t._e;
956
- if (i !== null && i.Re === e) {
957
- t.ye = i;
1012
+ function link(e, t, n = false) {
1013
+ const i = t.me;
1014
+ if (i !== null && i.pe === e) {
1015
+ i.ke = n;
1016
+ return;
1017
+ }
1018
+ let r = null;
1019
+ const o = t.W & REACTIVE_RECOMPUTING_DEPS;
1020
+ if (o) {
1021
+ r = i !== null ? i.Re : t.Oe;
1022
+ if (r !== null && r.pe === e) {
1023
+ r.We = t.He;
1024
+ t.me = r;
1025
+ r.ke = n;
958
1026
  return;
959
1027
  }
960
1028
  }
961
- const o = e.Ue;
962
- if (o !== null && o.U === t && (!r || isValidLink(o, t))) return;
963
- const s = (t.ye = e.Ue = { Re: e, U: t, Oe: i, Le: o, L: null });
964
- if (n !== null) n.Oe = s;
965
- else t._e = s;
966
- if (o !== null) o.L = s;
967
- else e.D = s;
968
- }
969
- function isValidLink(e, t) {
970
- const n = t.ye;
971
- if (n !== null) {
972
- let i = t._e;
973
- do {
974
- if (i === e) return true;
975
- if (i === n) break;
976
- i = i.Oe;
977
- } while (i !== null);
1029
+ const s = e.Fe;
1030
+ if (s !== null && s.U === t && (!o || s.We === t.He)) {
1031
+ s.ke = n;
1032
+ return;
978
1033
  }
979
- return false;
1034
+ const u = (t.me = e.Fe = { pe: e, U: t, Re: r, Ge: s, L: null, We: t.He, ke: n });
1035
+ if (i !== null) i.Re = u;
1036
+ else t.Oe = u;
1037
+ if (s !== null) s.L = u;
1038
+ else e.P = u;
980
1039
  }
981
1040
  function addPendingSource(e, t) {
982
- if (e.Se === t || e.de?.has(t)) return false;
1041
+ if (e.Se === t || e._e?.has(t)) return false;
983
1042
  if (!e.Se) {
984
1043
  e.Se = t;
985
1044
  return true;
986
1045
  }
987
- if (!e.de) {
988
- e.de = new Set([e.Se, t]);
1046
+ if (!e._e) {
1047
+ e._e = new Set([e.Se, t]);
989
1048
  } else {
990
- e.de.add(t);
1049
+ e._e.add(t);
991
1050
  }
992
1051
  e.Se = undefined;
993
1052
  return true;
@@ -998,38 +1057,51 @@ function removePendingSource(e, t) {
998
1057
  e.Se = undefined;
999
1058
  return true;
1000
1059
  }
1001
- if (!e.de?.delete(t)) return false;
1002
- if (e.de.size === 1) {
1003
- e.Se = e.de.values().next().value;
1004
- e.de = undefined;
1005
- } else if (e.de.size === 0) {
1006
- e.de = undefined;
1060
+ if (!e._e?.delete(t)) return false;
1061
+ if (e._e.size === 1) {
1062
+ e.Se = e._e.values().next().value;
1063
+ e._e = undefined;
1064
+ } else if (e._e.size === 0) {
1065
+ e._e = undefined;
1007
1066
  }
1008
1067
  return true;
1009
1068
  }
1010
1069
  function clearPendingSources(e) {
1011
1070
  e.Se = undefined;
1012
- e.de?.clear();
1013
- e.de = undefined;
1071
+ e._e?.clear();
1072
+ e._e = undefined;
1014
1073
  }
1015
1074
  function setPendingError(e, t, n) {
1016
1075
  if (!t) {
1017
- e.ce = null;
1076
+ e.ae = null;
1018
1077
  return;
1019
1078
  }
1020
1079
  if (n instanceof NotReadyError && n.source === t) {
1021
- e.ce = n;
1080
+ e.ae = n;
1022
1081
  return;
1023
1082
  }
1024
- const i = e.ce;
1083
+ const i = e.ae;
1025
1084
  if (!(i instanceof NotReadyError) || i.source !== t) {
1026
- e.ce = new NotReadyError(t);
1085
+ e.ae = new NotReadyError(t);
1027
1086
  }
1028
1087
  }
1029
1088
  function forEachDependent(e, t) {
1030
- for (let n = e.D; n !== null; n = n.L) t(n.U);
1031
- for (let n = e.Pe; n !== null; n = n.Ce) {
1032
- for (let e = n.D; e !== null; e = e.L) t(e.U);
1089
+ for (let n = e.P; n !== null; n = n.L) t(n.U, n);
1090
+ for (let n = e.ye; n !== null; n = n.Pe) {
1091
+ for (let e = n.P; e !== null; e = e.L) t(e.U, e);
1092
+ }
1093
+ }
1094
+ function enqueueForRerun(e) {
1095
+ if (e.V === EFFECT_TRACKED) {
1096
+ const t = e;
1097
+ if (!t.G) {
1098
+ t.G = true;
1099
+ t.F.enqueue(EFFECT_USER, t.k);
1100
+ }
1101
+ } else {
1102
+ const t = e.W & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
1103
+ if (t.I > e.H) t.I = e.H;
1104
+ insertIntoHeap(e, t);
1033
1105
  }
1034
1106
  }
1035
1107
  function settlePendingSource(e) {
@@ -1038,62 +1110,55 @@ function settlePendingSource(e) {
1038
1110
  const settle = i => {
1039
1111
  if (n.has(i) || !removePendingSource(i, e)) return;
1040
1112
  n.add(i);
1041
- i.le = clock;
1042
- const r = i.Se ?? i.de?.values().next().value;
1113
+ i.fe = clock;
1114
+ const r = i.Se ?? i._e?.values().next().value;
1043
1115
  if (r) {
1044
1116
  setPendingError(i, r);
1045
1117
  updatePendingSignal(i);
1046
1118
  } else {
1047
- i.fe &= ~STATUS_PENDING;
1119
+ i.Y &= ~STATUS_PENDING;
1048
1120
  setPendingError(i);
1049
1121
  updatePendingSignal(i);
1050
- if (i.Ge) {
1051
- if (i.G === EFFECT_TRACKED) {
1052
- const e = i;
1053
- if (!e.k) {
1054
- e.k = true;
1055
- e.F.enqueue(EFFECT_USER, e.W);
1056
- }
1057
- } else {
1058
- const e = i.M & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
1059
- if (e.h > i.H) e.h = i.H;
1060
- insertIntoHeap(i, e);
1061
- }
1122
+ if (i.Me) {
1123
+ enqueueForRerun(i);
1062
1124
  t = true;
1063
1125
  }
1064
- i.Ge = false;
1126
+ i.Me = false;
1065
1127
  }
1066
1128
  forEachDependent(i, settle);
1067
1129
  };
1068
1130
  forEachDependent(e, settle);
1069
1131
  if (t) schedule();
1070
1132
  }
1133
+ function isThenable(e) {
1134
+ return e != null && typeof e === "object" && typeof e.then === "function";
1135
+ }
1071
1136
  function handleAsync(e, t, n) {
1072
1137
  let i = false;
1073
1138
  let r = false;
1074
1139
  if (typeof t === "object" && t !== null) {
1075
1140
  untrack(() => {
1076
1141
  i = t[Symbol.asyncIterator];
1077
- r = !i && typeof t.then === "function";
1142
+ r = !i && isThenable(t);
1078
1143
  });
1079
1144
  }
1080
1145
  if (!r && !i) {
1081
- e.ve = null;
1146
+ e.be = null;
1082
1147
  return t;
1083
1148
  }
1084
- e.ve = t;
1149
+ e.be = t;
1085
1150
  let o;
1086
1151
  const handleError = n => {
1087
- if (e.ve !== t) return;
1152
+ if (e.be !== t) return;
1088
1153
  globalQueue.initTransition(resolveTransition(e));
1089
1154
  notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
1090
- e.le = clock;
1155
+ e.fe = clock;
1091
1156
  };
1092
1157
  const asyncWrite = (i, r) => {
1093
- if (e.ve !== t) return;
1094
- if (e.M & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
1158
+ if (e.be !== t) return;
1159
+ if (e.W & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
1095
1160
  globalQueue.initTransition(resolveTransition(e));
1096
- const o = !!(e.fe & STATUS_UNINITIALIZED);
1161
+ const o = !!(e.Y & STATUS_UNINITIALIZED);
1097
1162
  trimStaleDeps(e);
1098
1163
  clearStatus(e);
1099
1164
  const s = resolveLane(e);
@@ -1101,27 +1166,32 @@ function handleAsync(e, t, n) {
1101
1166
  if (n) {
1102
1167
  n(i);
1103
1168
  if (o) clearStatus(e, true);
1104
- } else if (e.R !== undefined) {
1105
- if (e.R !== undefined && e.R !== NOT_PENDING) e.m = i;
1106
- else {
1107
- e.Z = i;
1108
- insertSubs(e);
1109
- }
1110
- e.le = clock;
1169
+ } else if (e.O !== undefined) {
1170
+ if (e.D === NOT_PENDING) queuePendingNode(e);
1171
+ e.D = i;
1172
+ syncCompanions(e, i);
1173
+ if (!hasActiveOverride(e)) insertSubs(e);
1174
+ e.fe = clock;
1111
1175
  } else if (s) {
1112
- const t = e.G;
1176
+ const t = e.V;
1113
1177
  const n = e.Z;
1114
- const r = e.ke;
1115
- if ((!t && o) || !r || !r(i, n)) {
1116
- e.Z = i;
1117
- e.le = clock;
1118
- if (e.Fe) {
1119
- setSignal(e.Fe, i);
1178
+ const r = e.xe;
1179
+ try {
1180
+ if ((!t && o) || !r || !r(i, n)) {
1181
+ e.Z = i;
1182
+ e.fe = clock;
1183
+ syncCompanions(e, i);
1184
+ insertSubs(e, true);
1120
1185
  }
1121
- insertSubs(e, true);
1186
+ } catch (t) {
1187
+ notifyStatus(e, STATUS_ERROR, t);
1122
1188
  }
1123
1189
  } else {
1124
- setSignal(e, () => i);
1190
+ try {
1191
+ setSignal(e, () => i);
1192
+ } catch (t) {
1193
+ notifyStatus(e, STATUS_ERROR, t);
1194
+ }
1125
1195
  }
1126
1196
  settlePendingSource(e);
1127
1197
  schedule();
@@ -1130,20 +1200,28 @@ function handleAsync(e, t, n) {
1130
1200
  };
1131
1201
  if (r) {
1132
1202
  let n = false,
1133
- i = true;
1203
+ i = false,
1204
+ r,
1205
+ s = true;
1134
1206
  t.then(
1135
1207
  e => {
1136
- if (i) {
1208
+ if (s) {
1137
1209
  o = e;
1138
1210
  n = true;
1139
1211
  } else asyncWrite(e);
1140
1212
  },
1141
1213
  e => {
1142
- if (!i) handleError(e);
1214
+ if (s) {
1215
+ r = e;
1216
+ i = true;
1217
+ } else handleError(e);
1143
1218
  }
1144
1219
  );
1145
- i = false;
1146
- if (!n) {
1220
+ s = false;
1221
+ if (i) {
1222
+ handleError(r);
1223
+ throw r;
1224
+ } else if (!n) {
1147
1225
  globalQueue.initTransition(resolveTransition(e));
1148
1226
  throw new NotReadyError(context);
1149
1227
  }
@@ -1152,52 +1230,69 @@ function handleAsync(e, t, n) {
1152
1230
  const n = t[Symbol.asyncIterator]();
1153
1231
  let i = false;
1154
1232
  let r = false;
1233
+ let s = true;
1155
1234
  cleanup(() => {
1156
1235
  if (r) return;
1157
1236
  r = true;
1158
1237
  try {
1159
1238
  const e = n.return?.();
1160
- if (e && typeof e.then === "function") {
1161
- e.then(undefined, () => {});
1162
- }
1239
+ if (isThenable(e)) e.then(undefined, () => {});
1163
1240
  } catch {}
1164
1241
  });
1165
1242
  const iterate = () => {
1166
- let s,
1167
- u = false,
1168
- c = true;
1243
+ let u,
1244
+ c,
1245
+ l = false,
1246
+ a = false,
1247
+ f = true;
1169
1248
  n.next().then(
1170
1249
  n => {
1171
- if (c) {
1172
- s = n;
1173
- u = true;
1250
+ if (f) {
1251
+ u = n;
1252
+ l = true;
1174
1253
  if (n.done) r = true;
1175
- } else if (e.ve !== t) {
1254
+ } else if (e.be !== t) {
1176
1255
  return;
1177
- } else if (!n.done) asyncWrite(n.value, iterate);
1178
- else {
1256
+ } else if (!n.done) {
1257
+ i = true;
1258
+ asyncWrite(n.value, iterate);
1259
+ } else {
1179
1260
  r = true;
1180
- schedule();
1181
- flush();
1261
+ if (i) {
1262
+ schedule();
1263
+ flush();
1264
+ } else {
1265
+ asyncWrite(undefined);
1266
+ }
1182
1267
  }
1183
1268
  },
1184
1269
  n => {
1185
- if (!c && e.ve === t) {
1270
+ if (f) {
1271
+ c = n;
1272
+ a = true;
1273
+ } else if (e.be === t) {
1186
1274
  r = true;
1187
1275
  handleError(n);
1188
1276
  }
1189
1277
  }
1190
1278
  );
1191
- c = false;
1192
- if (u && !s.done) {
1193
- o = s.value;
1279
+ f = false;
1280
+ if (a) {
1281
+ r = true;
1282
+ handleError(c);
1283
+ if (s) throw c;
1284
+ return true;
1285
+ }
1286
+ if (l && !u.done) {
1287
+ o = u.value;
1194
1288
  i = true;
1195
1289
  return iterate();
1196
1290
  }
1197
- return u && s.done;
1291
+ return l && u.done;
1198
1292
  };
1199
- const s = iterate();
1200
- if (!i && !s) {
1293
+ const u = iterate();
1294
+ s = false;
1295
+ if (!i && !u) {
1201
1296
  globalQueue.initTransition(resolveTransition(e));
1202
1297
  throw new NotReadyError(context);
1203
1298
  }
@@ -1205,54 +1300,61 @@ function handleAsync(e, t, n) {
1205
1300
  return o;
1206
1301
  }
1207
1302
  function clearStatus(e, t = false) {
1208
- if (e.Se || e.de) clearPendingSources(e);
1209
- if (e.Ge) e.Ge = false;
1210
- e.fe = t ? 0 : e.fe & STATUS_UNINITIALIZED;
1211
- if (e.ce) setPendingError(e);
1212
- if (e.We) updatePendingSignal(e);
1213
- if (e.Me) e.Me();
1303
+ if (e.Se || e._e) clearPendingSources(e);
1304
+ if (e.Me) e.Me = false;
1305
+ e.Y = t ? 0 : e.Y & STATUS_UNINITIALIZED;
1306
+ if (e.ae) setPendingError(e);
1307
+ if (e.B || e.q) updatePendingSignal(e);
1308
+ if (e.ye) updateChildCompanions(e);
1309
+ if (e.Qe) e.Qe();
1214
1310
  }
1215
1311
  function notifyStatus(e, t, n, i, r) {
1216
1312
  if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
1217
1313
  n = new StatusError(e, n);
1218
1314
  const o = t === STATUS_PENDING && n instanceof NotReadyError ? n.source : undefined;
1219
1315
  const s = o === e;
1220
- const u = t === STATUS_PENDING && e.R !== undefined && !s;
1316
+ const u = t === STATUS_PENDING && e.O !== undefined && !s;
1221
1317
  const c = u && hasActiveOverride(e);
1222
1318
  if (!i) {
1223
1319
  if (t === STATUS_PENDING && o) {
1224
1320
  addPendingSource(e, o);
1225
- e.fe = STATUS_PENDING | (e.fe & STATUS_UNINITIALIZED);
1321
+ e.Y = STATUS_PENDING | (e.Y & STATUS_UNINITIALIZED);
1226
1322
  setPendingError(e, o, n);
1227
1323
  } else {
1228
1324
  clearPendingSources(e);
1229
- e.fe = t | (t !== STATUS_ERROR ? e.fe & STATUS_UNINITIALIZED : 0);
1230
- e.ce = n;
1325
+ e.Y = t | (t !== STATUS_ERROR ? e.Y & STATUS_UNINITIALIZED : 0);
1326
+ e.ae = n;
1231
1327
  }
1232
1328
  updatePendingSignal(e);
1329
+ if (e.ye) updateChildCompanions(e);
1233
1330
  }
1234
1331
  if (r && !i) {
1235
1332
  assignOrMergeLane(e, r);
1236
1333
  }
1237
1334
  const l = i || c;
1238
1335
  const a = i || u ? undefined : r;
1239
- if (e.Me) {
1336
+ if (e.Qe) {
1240
1337
  if (i && t === STATUS_PENDING) {
1241
1338
  return;
1242
1339
  }
1243
1340
  if (l) {
1244
- e.Me(t, n);
1341
+ e.Qe(t, n);
1245
1342
  } else {
1246
- e.Me();
1343
+ e.Qe();
1247
1344
  }
1248
1345
  return;
1249
1346
  }
1250
- forEachDependent(e, e => {
1251
- e.le = clock;
1347
+ forEachDependent(e, (e, i) => {
1348
+ e.fe = clock;
1252
1349
  if (
1253
- (t === STATUS_PENDING && o && e.Se !== o && !e.de?.has(o)) ||
1254
- (t !== STATUS_PENDING && (e.ce !== n || e.Se || e.de))
1350
+ (t === STATUS_PENDING && o && e.Se !== o && !e._e?.has(o)) ||
1351
+ (t !== STATUS_PENDING && (e.ae !== n || e.Se || e._e))
1255
1352
  ) {
1353
+ if (i.ke && t !== STATUS_PENDING && !(n instanceof NotReadyError)) {
1354
+ enqueueForRerun(e);
1355
+ schedule();
1356
+ return;
1357
+ }
1256
1358
  if (!l && !e.S) queuePendingNode(e);
1257
1359
  notifyStatus(e, t, n, l, a);
1258
1360
  }
@@ -1281,22 +1383,21 @@ function enableExternalSource(e) {
1281
1383
  externalSourceConfig = { factory: t, untrack: n };
1282
1384
  }
1283
1385
  }
1284
- GlobalQueue.te = recompute;
1285
- GlobalQueue.ne = disposeChildren;
1386
+ GlobalQueue.ie = recompute;
1387
+ GlobalQueue.re = disposeChildren;
1286
1388
  let tracking = false;
1287
1389
  let stale = false;
1288
1390
  let pendingCheckActive = false;
1289
- let foundPending = false;
1290
1391
  let latestReadActive = false;
1291
1392
  let context = null;
1292
1393
  let currentOptimisticLane = null;
1293
- let pendingCheckSources = null;
1394
+ let pendingProbe = null;
1294
1395
  let snapshotCaptureActive = false;
1295
1396
  let snapshotSources = null;
1296
1397
  function ownerInSnapshotScope(e) {
1297
1398
  while (e) {
1298
- if (e.He) return true;
1299
- e = e.q;
1399
+ if (e.je) return true;
1400
+ e = e.J;
1300
1401
  }
1301
1402
  return false;
1302
1403
  }
@@ -1305,27 +1406,27 @@ function setSnapshotCapture(e) {
1305
1406
  if (e && !snapshotSources) snapshotSources = new Set();
1306
1407
  }
1307
1408
  function markSnapshotScope(e) {
1308
- e.He = true;
1409
+ e.je = true;
1309
1410
  }
1310
1411
  function releaseSnapshotScope(e) {
1311
- e.He = false;
1412
+ e.je = false;
1312
1413
  releaseSubtree(e);
1313
1414
  schedule();
1314
1415
  }
1315
1416
  function releaseSubtree(e) {
1316
1417
  let t = e.ge;
1317
1418
  while (t) {
1318
- if (t.He) {
1419
+ if (t.je) {
1319
1420
  t = t.De;
1320
1421
  continue;
1321
1422
  }
1322
- if (t.se) {
1423
+ if (t.ce) {
1323
1424
  const e = t;
1324
- e.ue &= ~CONFIG_IN_SNAPSHOT_SCOPE;
1325
- if (e.M & REACTIVE_SNAPSHOT_STALE) {
1326
- e.M &= ~REACTIVE_SNAPSHOT_STALE;
1327
- e.M |= REACTIVE_DIRTY;
1328
- if (dirtyQueue.h > e.H) dirtyQueue.h = e.H;
1425
+ e.le &= ~CONFIG_IN_SNAPSHOT_SCOPE;
1426
+ if (e.W & REACTIVE_SNAPSHOT_STALE) {
1427
+ e.W &= ~REACTIVE_SNAPSHOT_STALE;
1428
+ e.W |= REACTIVE_DIRTY;
1429
+ if (dirtyQueue.I > e.H) dirtyQueue.I = e.H;
1329
1430
  insertIntoHeap(e, dirtyQueue);
1330
1431
  }
1331
1432
  }
@@ -1336,7 +1437,7 @@ function releaseSubtree(e) {
1336
1437
  function clearSnapshots() {
1337
1438
  if (snapshotSources) {
1338
1439
  for (const e of snapshotSources) {
1339
- delete e.ae;
1440
+ delete e.Ee;
1340
1441
  delete e[STORE_SNAPSHOT_PROPS];
1341
1442
  }
1342
1443
  snapshotSources = null;
@@ -1344,68 +1445,69 @@ function clearSnapshots() {
1344
1445
  snapshotCaptureActive = false;
1345
1446
  }
1346
1447
  function recompute(e, t = false) {
1347
- const n = e.G;
1448
+ const n = e.V;
1348
1449
  if (!t) {
1349
1450
  if (e.S && (!n || activeTransition) && activeTransition !== e.S)
1350
1451
  globalQueue.initTransition(e.S);
1351
- deleteFromHeap(e, e.M & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1352
- e.ve = null;
1452
+ deleteFromHeap(e, e.W & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1453
+ e.be = null;
1353
1454
  if (e.S || n === EFFECT_TRACKED) disposeChildren(e);
1354
- else if (e.ge !== null || e.Ve !== null) {
1455
+ else if (e.ge !== null || e.Ue !== null) {
1355
1456
  markDisposal(e);
1356
- e.Te = e.Ve;
1357
- e.Ee = e.ge;
1358
- e.Ve = null;
1457
+ e.Te = e.Ue;
1458
+ e.de = e.ge;
1459
+ e.Ue = null;
1359
1460
  e.ge = null;
1360
- e.me = 0;
1461
+ e.ve = 0;
1361
1462
  } else;
1362
1463
  }
1363
- let i = !!(e.M & REACTIVE_OPTIMISTIC_DIRTY);
1364
- const r = e.R !== undefined && e.R !== NOT_PENDING;
1365
- const o = !!(e.fe & STATUS_PENDING);
1366
- const s = !!(e.fe & STATUS_UNINITIALIZED);
1367
- const u = context;
1464
+ let i = !!(e.W & REACTIVE_OPTIMISTIC_DIRTY);
1465
+ const r = e.O !== undefined && e.O !== NOT_PENDING;
1466
+ !!(e.Y & STATUS_PENDING);
1467
+ const o = !!(e.Y & STATUS_UNINITIALIZED);
1468
+ const s = context;
1368
1469
  context = e;
1369
- e.ye = null;
1370
- e.M = REACTIVE_RECOMPUTING_DEPS;
1371
- e.le = clock;
1372
- let c = e.m === NOT_PENDING ? e.Z : e.m;
1373
- let l = e.H;
1374
- let a = tracking;
1375
- let f = currentOptimisticLane;
1470
+ e.me = null;
1471
+ e.He++;
1472
+ e.W = REACTIVE_RECOMPUTING_DEPS;
1473
+ e.fe = clock;
1474
+ let u = e.D === NOT_PENDING ? e.Z : e.D;
1475
+ let c = e.H;
1476
+ let l = tracking;
1477
+ let a = currentOptimisticLane;
1376
1478
  tracking = true;
1377
1479
  if (i) {
1378
1480
  const t = resolveLane(e);
1379
1481
  if (t) currentOptimisticLane = t;
1380
- } else if (activeTransition && !t && activeTransition.P.length) {
1381
- for (let t = e._e; t; t = t.Oe) {
1382
- const n = t.Re;
1383
- if (n.M & REACTIVE_OPTIMISTIC_DIRTY) {
1482
+ } else if (activeTransition && !t && activeTransition.N.length) {
1483
+ for (let t = e.Oe; t; t = t.Re) {
1484
+ const n = t.pe;
1485
+ if (n.W & REACTIVE_OPTIMISTIC_DIRTY) {
1384
1486
  const t = resolveLane(n);
1385
1487
  if (t) {
1386
1488
  i = true;
1387
1489
  currentOptimisticLane = t;
1388
- e.M |= REACTIVE_OPTIMISTIC_DIRTY;
1490
+ e.W |= REACTIVE_OPTIMISTIC_DIRTY;
1389
1491
  assignOrMergeLane(e, t);
1390
1492
  break;
1391
1493
  }
1392
1494
  }
1393
1495
  }
1394
1496
  }
1395
- const E = n && n !== EFFECT_USER;
1396
- const T = stale;
1397
- if (E) stale = true;
1497
+ const f = n && n !== EFFECT_USER;
1498
+ const E = stale;
1499
+ if (f) stale = true;
1398
1500
  try {
1399
- if (!false && e.ue & CONFIG_SYNC) {
1400
- c = e.se(c);
1401
- e.ve = null;
1501
+ if (!false && e.le & CONFIG_SYNC) {
1502
+ u = e.ce(u);
1503
+ e.be = null;
1402
1504
  } else {
1403
- const t = e.ve;
1404
- const n = e.se(c);
1505
+ const t = e.be;
1506
+ const n = e.ce(u);
1405
1507
  const i = typeof n === "object" && n !== null;
1406
- const r = e.ve !== t;
1407
- c = r || !i ? n : handleAsync(e, n);
1408
- if (!r && !i) e.ve = null;
1508
+ const r = e.be !== t;
1509
+ u = r || !i ? n : handleAsync(e, n);
1510
+ if (!r && !i) e.be = null;
1409
1511
  }
1410
1512
  clearStatus(e, t);
1411
1513
  if (e.i) {
@@ -1424,7 +1526,7 @@ function recompute(e, t = false) {
1424
1526
  updatePendingSignal(t.o);
1425
1527
  }
1426
1528
  }
1427
- if (t instanceof NotReadyError) e.Ge = true;
1529
+ if (t instanceof NotReadyError) e.Me = true;
1428
1530
  notifyStatus(
1429
1531
  e,
1430
1532
  t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
@@ -1433,102 +1535,113 @@ function recompute(e, t = false) {
1433
1535
  t instanceof NotReadyError ? e.i : undefined
1434
1536
  );
1435
1537
  } finally {
1436
- tracking = a;
1437
- if (E) stale = T;
1438
- e.M = REACTIVE_NONE | (t ? e.M & REACTIVE_SNAPSHOT_STALE : 0);
1439
- context = u;
1538
+ tracking = l;
1539
+ if (f) stale = E;
1540
+ e.W = REACTIVE_NONE | (t ? e.W & REACTIVE_SNAPSHOT_STALE : 0);
1541
+ context = s;
1440
1542
  }
1441
- if (!e.ce) {
1543
+ if (!e.ae) {
1442
1544
  trimStaleDeps(e);
1443
- const u = r ? e.R : e.m === NOT_PENDING ? e.Z : e.m;
1444
- const a = (!n && s) || !e.ke || !e.ke(u, c);
1445
- if (n && a) {
1446
- e.k = !e.ce;
1447
- if (!t) e.F.enqueue(n, GlobalQueue.ie.bind(null, e));
1448
- }
1449
- if (a) {
1450
- const s = r ? e.R : undefined;
1545
+ const s = r ? e.O : e.D === NOT_PENDING ? e.Z : e.D;
1546
+ let l = false;
1547
+ try {
1548
+ l = (!n && o) || !e.xe || !e.xe(s, u);
1549
+ } catch (t) {
1550
+ notifyStatus(e, STATUS_ERROR, t);
1551
+ }
1552
+ if (n && l) {
1553
+ e.G = !e.ae;
1554
+ if (!t) e.F.enqueue(n, (e.$e ??= GlobalQueue.oe.bind(null, e)));
1555
+ }
1556
+ if (e.ae);
1557
+ else if (l) {
1558
+ const o = r ? e.O : undefined;
1451
1559
  if (t || (n && activeTransition !== e.S) || i) {
1452
- e.Z = c;
1560
+ e.Z = u;
1453
1561
  if (r && i) {
1454
- e.R = c;
1455
- e.m = c;
1562
+ e.O = u;
1563
+ e.D = NOT_PENDING;
1456
1564
  }
1457
- } else e.m = c;
1458
- if (r && !i && o && !e.O) e.R = c;
1459
- if (!r || i || e.R !== s) insertSubs(e, i || r);
1565
+ } else {
1566
+ e.D = u;
1567
+ if (activeTransition || e.S) syncCompanions(e, u);
1568
+ }
1569
+ if (!r || i || e.O !== o) insertSubs(e, i || r);
1460
1570
  } else if (r) {
1461
- e.m = c;
1462
- } else if (e.H != l) {
1463
- for (let t = e.D; t !== null; t = t.L) {
1464
- insertIntoHeapHeight(t.U, t.U.M & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1571
+ if (e.D === NOT_PENDING) queuePendingNode(e);
1572
+ e.D = u;
1573
+ } else if (e.H != c) {
1574
+ for (let t = e.P; t !== null; t = t.L) {
1575
+ insertIntoHeapHeight(t.U, t.U.W & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1465
1576
  }
1466
1577
  }
1467
1578
  }
1468
- currentOptimisticLane = f;
1469
- const S =
1470
- e.m !== NOT_PENDING ||
1471
- e.Ee !== null ||
1579
+ currentOptimisticLane = a;
1580
+ const d =
1581
+ e.D !== NOT_PENDING ||
1582
+ e.de !== null ||
1472
1583
  e.Te !== null ||
1473
- !!(e.fe & (STATUS_PENDING | STATUS_UNINITIALIZED));
1474
- S && (!t || e.fe & STATUS_PENDING) && !e.S && !(activeTransition && r) && queuePendingNode(e);
1584
+ !!(e.Y & (STATUS_PENDING | STATUS_UNINITIALIZED));
1585
+ d && (!t || e.Y & STATUS_PENDING) && (!e.S || r) && queuePendingNode(e);
1475
1586
  e.S && n && activeTransition !== e.S && runInTransition(e.S, () => recompute(e));
1476
1587
  }
1477
1588
  function updateIfNecessary(e) {
1478
- if (e.M & REACTIVE_CHECK) {
1479
- for (let t = e._e; t; t = t.Oe) {
1480
- const n = t.Re;
1589
+ if (e.W & REACTIVE_CHECK) {
1590
+ for (let t = e.Oe; t; t = t.Re) {
1591
+ const n = t.pe;
1481
1592
  const i = n.Ie || n;
1482
- if (i.se) {
1593
+ if (i.ce) {
1483
1594
  updateIfNecessary(i);
1484
1595
  }
1485
- if (e.M & REACTIVE_DIRTY) {
1596
+ if (e.W & REACTIVE_DIRTY) {
1486
1597
  break;
1487
1598
  }
1488
1599
  }
1489
1600
  }
1490
- if (e.M & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.ce && e.le < clock && !e.ve)) {
1601
+ if (e.W & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.ae && e.fe < clock && !e.be)) {
1491
1602
  recompute(e);
1492
1603
  }
1493
- e.M = e.M & (REACTIVE_SNAPSHOT_STALE | REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT);
1604
+ e.W = e.W & (REACTIVE_SNAPSHOT_STALE | REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT);
1494
1605
  }
1495
1606
  function computed(e, t) {
1496
1607
  const n = t?.transparent ?? false;
1497
1608
  const i = {
1498
1609
  id: t?.id ?? (n ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
1499
- ue:
1610
+ le:
1500
1611
  (n ? CONFIG_TRANSPARENT : 0) |
1501
1612
  (t?.ownedWrite ? CONFIG_OWNED_WRITE : 0) |
1502
1613
  (!context || t?.lazy ? CONFIG_AUTO_DISPOSE : 0) |
1503
1614
  (t?.sync ? CONFIG_SYNC : 0) |
1615
+ (t?.Ke ? CONFIG_NO_SNAPSHOT : 0) |
1504
1616
  (snapshotCaptureActive && ownerInSnapshotScope(context) ? CONFIG_IN_SNAPSHOT_SCOPE : 0),
1505
- ke: t?.equals != null ? t.equals : isEqual,
1506
- V: t?.unobserved,
1507
- Ve: null,
1617
+ xe: t?.equals != null ? t.equals : isEqual,
1618
+ m: t?.unobserved,
1619
+ Ue: null,
1508
1620
  F: context?.F ?? globalQueue,
1509
- we: context?.we ?? defaultContext,
1510
- me: 0,
1511
- se: e,
1621
+ Ve: context?.Ve ?? defaultContext,
1622
+ ve: 0,
1623
+ ce: e,
1512
1624
  Z: undefined,
1513
1625
  H: 0,
1514
- Pe: null,
1515
- Ae: undefined,
1516
- Ne: null,
1517
- _e: null,
1518
1626
  ye: null,
1519
- D: null,
1520
- Ue: null,
1521
- q: context,
1627
+ Ce: undefined,
1628
+ Ne: null,
1629
+ Oe: null,
1630
+ me: null,
1631
+ He: 0,
1632
+ P: null,
1633
+ Fe: null,
1634
+ J: context,
1522
1635
  De: null,
1523
- be: null,
1636
+ we: null,
1524
1637
  ge: null,
1525
- M: t?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
1526
- fe: STATUS_UNINITIALIZED,
1527
- le: clock,
1528
- m: NOT_PENDING,
1638
+ W: t?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
1639
+ Y: STATUS_UNINITIALIZED,
1640
+ fe: clock,
1641
+ D: NOT_PENDING,
1529
1642
  Te: null,
1530
- Ee: null,
1531
- ve: null,
1643
+ de: null,
1644
+ be: null,
1532
1645
  S: null
1533
1646
  };
1534
1647
  setupComputedNode(i, t);
@@ -1538,47 +1651,47 @@ function createEffectNode(e, t, n, i, r, o) {
1538
1651
  const s = o?.transparent ?? false;
1539
1652
  const u = {
1540
1653
  id: o?.id ?? (s ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
1541
- ue:
1654
+ le:
1542
1655
  (s ? CONFIG_TRANSPARENT : 0) |
1543
1656
  (o?.ownedWrite ? CONFIG_OWNED_WRITE : 0) |
1544
1657
  (o?.sync ? CONFIG_SYNC : 0) |
1545
1658
  (snapshotCaptureActive && ownerInSnapshotScope(context) ? CONFIG_IN_SNAPSHOT_SCOPE : 0),
1546
- ke: false,
1547
- V: o?.unobserved,
1548
- Ve: null,
1659
+ xe: false,
1660
+ m: o?.unobserved,
1661
+ Ue: null,
1549
1662
  F: context?.F ?? globalQueue,
1550
- we: context?.we ?? defaultContext,
1551
- me: 0,
1552
- se: e,
1663
+ Ve: context?.Ve ?? defaultContext,
1664
+ ve: 0,
1665
+ ce: e,
1553
1666
  Z: undefined,
1554
1667
  H: 0,
1555
- Pe: null,
1556
- Ae: undefined,
1557
- Ne: null,
1558
- _e: null,
1559
1668
  ye: null,
1560
- D: null,
1561
- Ue: null,
1562
- q: context,
1669
+ Ce: undefined,
1670
+ Ne: null,
1671
+ Oe: null,
1672
+ me: null,
1673
+ He: 0,
1674
+ P: null,
1675
+ Fe: null,
1676
+ J: context,
1563
1677
  De: null,
1564
- be: null,
1678
+ we: null,
1565
1679
  ge: null,
1566
- M: REACTIVE_LAZY,
1567
- fe: STATUS_UNINITIALIZED,
1568
- le: clock,
1569
- m: NOT_PENDING,
1680
+ W: REACTIVE_LAZY,
1681
+ Y: STATUS_UNINITIALIZED,
1682
+ fe: clock,
1683
+ D: NOT_PENDING,
1570
1684
  Te: null,
1571
- Ee: null,
1572
- ve: null,
1685
+ de: null,
1686
+ be: null,
1573
1687
  S: null,
1574
- k: false,
1575
- xe: undefined,
1576
- Qe: t,
1577
- je: n,
1578
- $e: undefined,
1579
- Ke: false,
1580
- G: i,
1581
- Me: r
1688
+ G: false,
1689
+ Ye: undefined,
1690
+ Ze: t,
1691
+ Be: n,
1692
+ Le: undefined,
1693
+ V: i,
1694
+ Qe: r
1582
1695
  };
1583
1696
  setupComputedNode(u, lazyOptions);
1584
1697
  return u;
@@ -1586,65 +1699,65 @@ function createEffectNode(e, t, n, i, r, o) {
1586
1699
  const lazyOptions = { lazy: true };
1587
1700
  function setupComputedNode(e, t) {
1588
1701
  e.Ne = e;
1589
- const n = context?.pe ? context.he : context;
1702
+ const n = context?.he ? context.Ae : context;
1590
1703
  if (context) {
1591
1704
  const t = context.ge;
1592
1705
  if (t === null) {
1593
1706
  context.ge = e;
1594
1707
  } else {
1595
1708
  e.De = t;
1596
- t.be = e;
1709
+ t.we = e;
1597
1710
  context.ge = e;
1598
1711
  }
1599
1712
  }
1600
1713
  if (n) e.H = n.H + 1;
1601
1714
  if (externalSourceConfig) {
1602
1715
  const t = signal(undefined, { equals: false, ownedWrite: true });
1603
- const n = externalSourceConfig.factory(e.se, () => {
1716
+ const n = externalSourceConfig.factory(e.ce, () => {
1604
1717
  setSignal(t, undefined);
1605
1718
  });
1606
1719
  cleanup(() => n.dispose());
1607
- e.se = e => {
1720
+ e.ce = e => {
1608
1721
  read(t);
1609
1722
  return n.track(e);
1610
1723
  };
1611
1724
  }
1612
1725
  !t?.lazy && recompute(e, true);
1613
1726
  if (snapshotCaptureActive && !t?.lazy) {
1614
- if (!(e.fe & STATUS_PENDING)) {
1615
- e.ae = e.Z === undefined ? NO_SNAPSHOT : e.Z;
1727
+ if (!(e.Y & STATUS_PENDING) && !(e.le & CONFIG_NO_SNAPSHOT)) {
1728
+ e.Ee = e.Z === undefined ? NO_SNAPSHOT : e.Z;
1616
1729
  snapshotSources.add(e);
1617
1730
  }
1618
1731
  }
1619
1732
  }
1620
1733
  function signal(e, t, n = null) {
1621
1734
  const i = {
1622
- ke: t?.equals != null ? t.equals : isEqual,
1623
- ue: (t?.ownedWrite ? CONFIG_OWNED_WRITE : 0) | (t?.Ye ? CONFIG_NO_SNAPSHOT : 0),
1624
- V: t?.unobserved,
1735
+ xe: t?.equals != null ? t.equals : isEqual,
1736
+ le: (t?.ownedWrite ? CONFIG_OWNED_WRITE : 0) | (t?.Ke ? CONFIG_NO_SNAPSHOT : 0),
1737
+ m: t?.unobserved,
1625
1738
  Z: e,
1626
- D: null,
1627
- Ue: null,
1628
- le: clock,
1739
+ P: null,
1740
+ Fe: null,
1741
+ fe: clock,
1629
1742
  Ie: n,
1630
- Ce: n?.Pe || null,
1631
- m: NOT_PENDING
1743
+ Pe: n?.ye || null,
1744
+ D: NOT_PENDING
1632
1745
  };
1633
- n && (n.Pe = i);
1634
- if (snapshotCaptureActive && !(i.ue & CONFIG_NO_SNAPSHOT) && !((n?.fe ?? 0) & STATUS_PENDING)) {
1635
- i.ae = e === undefined ? NO_SNAPSHOT : e;
1746
+ n && (n.ye = i);
1747
+ if (snapshotCaptureActive && !(i.le & CONFIG_NO_SNAPSHOT) && !((n?.Y ?? 0) & STATUS_PENDING)) {
1748
+ i.Ee = e === undefined ? NO_SNAPSHOT : e;
1636
1749
  snapshotSources.add(i);
1637
1750
  }
1638
1751
  return i;
1639
1752
  }
1640
1753
  function optimisticSignal(e, t) {
1641
1754
  const n = signal(e, t);
1642
- n.R = NOT_PENDING;
1755
+ n.O = NOT_PENDING;
1643
1756
  return n;
1644
1757
  }
1645
1758
  function optimisticComputed(e, t) {
1646
1759
  const n = computed(e, t);
1647
- n.R = NOT_PENDING;
1760
+ n.O = NOT_PENDING;
1648
1761
  return n;
1649
1762
  }
1650
1763
  function isEqual(e, t) {
@@ -1661,22 +1774,32 @@ function untrack(e, t) {
1661
1774
  tracking = n;
1662
1775
  }
1663
1776
  }
1777
+ function prepareComputed(e, t) {
1778
+ if (e.W & REACTIVE_LAZY) {
1779
+ e.W &= ~REACTIVE_LAZY;
1780
+ recompute(e, true);
1781
+ } else if (e.W & REACTIVE_DISPOSED) {
1782
+ recompute(e, true);
1783
+ } else if (t) {
1784
+ updateIfNecessary(e);
1785
+ }
1786
+ }
1664
1787
  function read(e) {
1665
1788
  if (latestReadActive) {
1666
1789
  const t = getLatestValueComputed(e);
1667
1790
  const n = latestReadActive;
1668
1791
  latestReadActive = false;
1669
- const i = e.R !== undefined && e.R !== NOT_PENDING ? e.R : e.Z;
1792
+ const i = e.O !== undefined && e.O !== NOT_PENDING ? e.O : e.Z;
1670
1793
  let r;
1671
1794
  try {
1672
1795
  r = read(t);
1673
- } catch (e) {
1674
- if (!context && e instanceof NotReadyError) return i;
1675
- throw e;
1796
+ } catch (t) {
1797
+ if (t instanceof NotReadyError && (!context || !(e.Y & STATUS_UNINITIALIZED))) return i;
1798
+ throw t;
1676
1799
  } finally {
1677
1800
  latestReadActive = n;
1678
1801
  }
1679
- if (t.fe & STATUS_PENDING) return i;
1802
+ if (t.Y & STATUS_PENDING) return i;
1680
1803
  if (stale && currentOptimisticLane && t.i) {
1681
1804
  const e = findLane(t.i);
1682
1805
  const n = findLane(currentOptimisticLane);
@@ -1686,204 +1809,164 @@ function read(e) {
1686
1809
  }
1687
1810
  return r;
1688
1811
  }
1689
- if (pendingCheckActive) {
1690
- const t = e.Ie;
1691
- const n = pendingCheckActive;
1692
- pendingCheckActive = false;
1693
- let i = context;
1694
- if (i?.pe) i = i.he;
1695
- const r = t || e;
1696
- const o = e;
1697
- if (typeof o.se === "function") {
1698
- const t = e;
1699
- if (t.M & REACTIVE_LAZY) {
1700
- t.M &= ~REACTIVE_LAZY;
1701
- recompute(t, true);
1702
- } else if (t.M & REACTIVE_DISPOSED) {
1703
- recompute(t, true);
1704
- } else {
1705
- updateIfNecessary(t);
1706
- }
1707
- }
1708
- if (i && r.fe & STATUS_PENDING && r.fe & STATUS_UNINITIALIZED) {
1709
- if (tracking && e !== i) link(e, i);
1710
- pendingCheckActive = n;
1711
- throw r.ce;
1712
- }
1713
- if (t && e.R !== undefined) {
1714
- if (e.R !== NOT_PENDING && (t.ve || !!(t.fe & STATUS_PENDING))) {
1715
- foundPending = true;
1716
- }
1717
- collectPendingSources(e);
1718
- collectPendingSources(t);
1719
- if (i && tracking) link(e, i);
1720
- } else {
1721
- collectPendingSources(e);
1722
- if (t) collectPendingSources(t);
1723
- }
1724
- pendingCheckActive = n;
1725
- }
1726
1812
  let t = context;
1727
- if (t?.pe) t = t.he;
1813
+ if (t?.he) t = t.Ae;
1728
1814
  const n = e;
1729
- if (typeof n.se === "function") {
1730
- const t = e;
1731
- if (t.M & REACTIVE_LAZY) {
1732
- t.M &= ~REACTIVE_LAZY;
1733
- recompute(t, true);
1734
- } else if (t.M & REACTIVE_DISPOSED) {
1735
- recompute(t, true);
1815
+ const i = e.Ie;
1816
+ const r = i || e;
1817
+ if (pendingCheckActive) {
1818
+ pendingCheckActive = false;
1819
+ if (typeof n.ce === "function") prepareComputed(e, true);
1820
+ if (t && r.Y & STATUS_PENDING && r.Y & STATUS_UNINITIALIZED) {
1821
+ if (tracking && e !== t) link(e, t);
1822
+ pendingCheckActive = true;
1823
+ throw r.ae;
1736
1824
  }
1825
+ collectPendingSources(e);
1826
+ if (i) collectPendingSources(i);
1827
+ pendingCheckActive = true;
1828
+ } else if (typeof n.ce === "function") {
1829
+ prepareComputed(e, false);
1737
1830
  }
1738
- const i = e.Ie || e;
1739
1831
  if (
1740
- !n.se &&
1741
- i === e &&
1742
- e.R === undefined &&
1743
- e.ae === undefined &&
1832
+ !n.ce &&
1833
+ r === e &&
1834
+ e.O === undefined &&
1835
+ e.Ee === undefined &&
1744
1836
  activeTransition === null &&
1745
1837
  currentOptimisticLane === null &&
1746
1838
  !snapshotCaptureActive &&
1747
1839
  true
1748
1840
  ) {
1749
1841
  if (t && tracking) link(e, t);
1750
- return !t || e.m === NOT_PENDING ? e.Z : e.m;
1842
+ return !t || e.D === NOT_PENDING ? e.Z : e.D;
1751
1843
  }
1752
1844
  if (t && tracking) {
1753
- link(e, t);
1754
- if (i.se) {
1755
- const n = e.M & REACTIVE_ZOMBIE;
1756
- if (i.H >= (n ? zombieQueue.h : dirtyQueue.h)) {
1845
+ link(e, t, pendingCheckActive);
1846
+ if (r.ce) {
1847
+ const n = e.W & REACTIVE_ZOMBIE;
1848
+ if (r.H >= (n ? zombieQueue.I : dirtyQueue.I)) {
1757
1849
  markNode(t);
1758
1850
  markHeap(n ? zombieQueue : dirtyQueue);
1759
- updateIfNecessary(i);
1851
+ updateIfNecessary(r);
1760
1852
  }
1761
- const r = i.H;
1762
- if (r >= t.H && e.q !== t) {
1763
- t.H = r + 1;
1853
+ const i = r.H;
1854
+ if (i >= t.H && e.J !== t) {
1855
+ t.H = i + 1;
1764
1856
  }
1765
1857
  }
1766
1858
  }
1767
- if (i.fe & STATUS_PENDING) {
1768
- if (t && !(stale && i.S && activeTransition !== i.S)) {
1859
+ if (r.Y & STATUS_PENDING) {
1860
+ if (t && !(stale && r.S && activeTransition !== r.S)) {
1769
1861
  if (currentOptimisticLane) {
1770
- const n = i.i;
1771
- const r = findLane(currentOptimisticLane);
1772
- if (n && findLane(n) === r && !hasActiveOverride(i)) {
1862
+ const n = r.i;
1863
+ const i = findLane(currentOptimisticLane);
1864
+ if (n && findLane(n) === i && !hasActiveOverride(r)) {
1773
1865
  if (!tracking && e !== t) link(e, t);
1774
- throw i.ce;
1866
+ throw r.ae;
1775
1867
  }
1776
1868
  } else {
1777
1869
  if (!tracking && e !== t) link(e, t);
1778
- throw i.ce;
1870
+ throw r.ae;
1779
1871
  }
1780
- } else if (t && i !== e && i.fe & STATUS_UNINITIALIZED) {
1872
+ } else if (t && r !== e && r.Y & STATUS_UNINITIALIZED) {
1781
1873
  if (!tracking && e !== t) link(e, t);
1782
- throw i.ce;
1783
- } else if (!t && i.fe & STATUS_UNINITIALIZED) {
1784
- throw i.ce;
1874
+ throw r.ae;
1875
+ } else if (!t && r.Y & STATUS_UNINITIALIZED) {
1876
+ throw r.ae;
1785
1877
  }
1786
1878
  }
1787
- if (e.se && e.fe & STATUS_ERROR) {
1788
- if (e.le < clock) {
1879
+ if (e.ce && e.Y & STATUS_ERROR) {
1880
+ if (tracking && !pendingCheckActive && e.fe < clock) {
1789
1881
  recompute(e);
1790
1882
  return read(e);
1791
- } else throw e.ce;
1883
+ } else throw e.ae;
1792
1884
  }
1793
- if (snapshotCaptureActive && t && t.ue & CONFIG_IN_SNAPSHOT_SCOPE) {
1794
- const n = e.ae;
1885
+ if (snapshotCaptureActive && t && t.le & CONFIG_IN_SNAPSHOT_SCOPE) {
1886
+ const n = e.Ee;
1795
1887
  if (n !== undefined) {
1796
1888
  const i = n === NO_SNAPSHOT ? undefined : n;
1797
- const r = e.m !== NOT_PENDING ? e.m : e.Z;
1798
- if (r !== i) t.M |= REACTIVE_SNAPSHOT_STALE;
1889
+ const r = e.D !== NOT_PENDING ? e.D : e.Z;
1890
+ if (r !== i) t.W |= REACTIVE_SNAPSHOT_STALE;
1799
1891
  return i;
1800
1892
  }
1801
1893
  }
1802
- if (e.R !== undefined && e.R !== NOT_PENDING) {
1894
+ if (e.O !== undefined && e.O !== NOT_PENDING) {
1803
1895
  if (t && stale && shouldReadStashedOptimisticValue(e)) return e.Z;
1804
- return e.R;
1896
+ return e.O;
1805
1897
  }
1806
1898
  if (
1807
1899
  activeTransition !== null &&
1808
1900
  currentOptimisticLane !== null &&
1809
1901
  !latestReadActive &&
1810
- e.m !== NOT_PENDING &&
1811
- (i === e || !!(i.M & REACTIVE_MANUAL_WRITE)) &&
1812
- !e.se &&
1902
+ e.D !== NOT_PENDING &&
1903
+ (r === e || !!(r.W & REACTIVE_MANUAL_WRITE)) &&
1904
+ !e.ce &&
1813
1905
  t
1814
1906
  ) {
1815
- activeTransition.Y.add(t);
1907
+ activeTransition.K.add(t);
1816
1908
  return e.Z;
1817
1909
  }
1818
- const r =
1910
+ const o =
1819
1911
  !t ||
1820
1912
  (currentOptimisticLane !== null &&
1821
- (e.R !== undefined || e.i || (i === e && stale) || !!(i.fe & STATUS_PENDING))) ||
1822
- e.m === NOT_PENDING ||
1913
+ (e.O !== undefined || e.i || (r === e && stale && t.t !== e) || !!(r.Y & STATUS_PENDING))) ||
1914
+ e.D === NOT_PENDING ||
1823
1915
  (stale && e.S && activeTransition !== e.S)
1824
1916
  ? e.Z
1825
- : e.m;
1917
+ : e.D;
1918
+ if (pendingCheckActive && pendingProbe !== null && e.D !== NOT_PENDING && o === e.D)
1919
+ pendingProbe.freshReads.add(e);
1826
1920
  if (
1827
1921
  !t &&
1828
- i === e &&
1829
- typeof n.se === "function" &&
1830
- e.ue & CONFIG_AUTO_DISPOSE &&
1831
- !(i.fe & STATUS_PENDING) &&
1832
- !e.D
1922
+ r === e &&
1923
+ typeof n.ce === "function" &&
1924
+ e.le & CONFIG_AUTO_DISPOSE &&
1925
+ !(r.Y & STATUS_PENDING) &&
1926
+ !e.P
1833
1927
  ) {
1834
1928
  unobserved(e);
1835
1929
  }
1836
- return r;
1930
+ return o;
1837
1931
  }
1838
1932
  function setSignal(e, t) {
1839
1933
  if (e.S && activeTransition !== e.S) globalQueue.initTransition(e.S);
1840
- const n = e.R !== undefined && !projectionWriteActive;
1841
- const i = e.R !== undefined && e.R !== NOT_PENDING;
1842
- const r = n ? (i ? e.R : e.Z) : e.m === NOT_PENDING ? e.Z : e.m;
1934
+ const n = e.O !== undefined && !projectionWriteActive;
1935
+ const i = e.O !== undefined && e.O !== NOT_PENDING;
1936
+ const r = n ? (i ? e.O : e.Z) : e.D === NOT_PENDING ? e.Z : e.D;
1843
1937
  if (typeof t === "function") t = t(r);
1844
- const o = !e.ke || !e.ke(r, t) || !!(e.fe & STATUS_UNINITIALIZED);
1938
+ const o = !!(e.Y & STATUS_UNINITIALIZED) || !e.xe || !e.xe(r, t);
1845
1939
  if (!o) {
1846
1940
  if (n && i) {
1847
1941
  const t = resolveTransition(e);
1848
1942
  if (t && activeTransition !== t) globalQueue.initTransition(t);
1849
- if (e.se) {
1850
- insertSubs(e, true);
1851
- schedule();
1852
- }
1853
1943
  }
1854
1944
  return t;
1855
1945
  }
1856
1946
  if (n) {
1857
- const n = e.R === NOT_PENDING;
1947
+ const n = e.O === NOT_PENDING;
1858
1948
  if (!n) globalQueue.initTransition(resolveTransition(e));
1859
- if (n) {
1860
- e.m = e.Z;
1861
- globalQueue.P.push(e);
1862
- }
1863
- e.O = true;
1949
+ if (n) globalQueue.N.push(e);
1864
1950
  const i = getOrCreateLane(e);
1865
1951
  e.i = i;
1866
- e.R = t;
1952
+ e.O = t;
1867
1953
  } else {
1868
- if (e.m === NOT_PENDING) queuePendingNode(e);
1869
- e.m = t;
1954
+ if (e.D === NOT_PENDING) queuePendingNode(e);
1955
+ e.D = t;
1870
1956
  }
1871
- if (e.We) updatePendingSignal(e);
1872
- if (e.Fe) {
1873
- setSignal(e.Fe, t);
1874
- }
1875
- e.le = clock;
1957
+ syncCompanions(e, t);
1958
+ e.fe = clock;
1876
1959
  insertSubs(e, n);
1877
1960
  schedule();
1878
1961
  return t;
1879
1962
  }
1880
1963
  function suppressComputedRecompute(e) {
1881
- deleteFromHeap(e, e.M & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1882
- if (!(e.M & REACTIVE_MANUAL_WRITE) && e.m === NOT_PENDING) {
1964
+ deleteFromHeap(e, e.W & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1965
+ if (!(e.W & REACTIVE_MANUAL_WRITE) && e.D === NOT_PENDING) {
1883
1966
  queuePendingNode(e);
1884
1967
  schedule();
1885
1968
  }
1886
- e.M = (e.M & -4) | REACTIVE_MANUAL_WRITE;
1969
+ e.W = (e.W & -4) | REACTIVE_MANUAL_WRITE;
1887
1970
  }
1888
1971
  function setMemo(e, t) {
1889
1972
  const n = setSignal(e, t);
@@ -1903,78 +1986,96 @@ function runWithOwner(e, t) {
1903
1986
  }
1904
1987
  }
1905
1988
  function getPendingSignal(e) {
1906
- if (!e.We) {
1907
- e.We = optimisticSignal(false, { ownedWrite: true });
1908
- if (e.t) {
1909
- e.We.t = e;
1910
- }
1911
- if (computePendingState(e)) setSignal(e.We, true);
1989
+ if (!e.B) {
1990
+ e.B = optimisticSignal(false, { ownedWrite: true });
1991
+ e.B.t = e;
1992
+ if (computePendingState(e)) setSignal(e.B, true);
1912
1993
  }
1913
- return e.We;
1994
+ return e.B;
1914
1995
  }
1915
1996
  function collectPendingSources(e) {
1916
- pendingCheckSources?.add(e);
1997
+ if (!pendingProbe) return;
1998
+ pendingProbe.sources.add(e);
1917
1999
  const t = e.Ie || e;
1918
- if (t !== e) pendingCheckSources?.add(t);
2000
+ if (t !== e) pendingProbe.sources.add(t);
1919
2001
  }
1920
2002
  function computePendingState(e) {
1921
2003
  const t = e;
2004
+ if (t.W & REACTIVE_DISPOSED) return false;
1922
2005
  const n = e.Ie;
2006
+ if ((n || t).qe) return false;
1923
2007
  if (e.t) {
1924
- const n = e.t;
1925
- if (n.fe & STATUS_PENDING && !(n.fe & STATUS_UNINITIALIZED)) return true;
1926
- return e.m !== NOT_PENDING && !(t.fe & STATUS_UNINITIALIZED);
2008
+ const t = e.t;
2009
+ if (hasActiveOverride(t)) return false;
2010
+ const n = t.Ie || t;
2011
+ if (n.qe) return false;
2012
+ return !!(n.Y & STATUS_PENDING && !(n.Y & STATUS_UNINITIALIZED));
1927
2013
  }
1928
- if (n && e.m !== NOT_PENDING) {
1929
- return !!(n.M & REACTIVE_MANUAL_WRITE) || (!n.ve && !(n.fe & STATUS_PENDING));
2014
+ if (hasActiveOverride(e)) return false;
2015
+ if (n && e.D !== NOT_PENDING) {
2016
+ return !!(n.W & REACTIVE_MANUAL_WRITE) || (!n.be && !(n.Y & STATUS_PENDING));
1930
2017
  }
1931
- if (e.R !== undefined && e.R !== NOT_PENDING) {
1932
- if (t.fe & STATUS_PENDING && !(t.fe & STATUS_UNINITIALIZED)) return true;
1933
- if (e.t) {
1934
- const t = e.i ? findLane(e.i) : null;
1935
- return !!(t && t.u.size > 0);
1936
- }
1937
- return true;
2018
+ if (e.D !== NOT_PENDING && !(t.Y & STATUS_UNINITIALIZED)) return true;
2019
+ return !!(t.Y & STATUS_PENDING && !(t.Y & STATUS_UNINITIALIZED));
2020
+ }
2021
+ function syncCompanions(e, t) {
2022
+ if (e.B) updatePendingSignal(e);
2023
+ if (e.q) setSignal(e.q, t);
2024
+ }
2025
+ function updatePendingSignal(e) {
2026
+ if (e.B) {
2027
+ setSignal(e.B, computePendingState(e));
1938
2028
  }
1939
- if (e.R !== undefined && e.R === NOT_PENDING && !e.t) {
1940
- return false;
2029
+ if (e.q) updatePendingSignal(e.q);
2030
+ }
2031
+ function updateChildCompanions(e) {
2032
+ for (let t = e.ye; t !== null; t = t.Pe) {
2033
+ if (t.B || t.q) updatePendingSignal(t);
1941
2034
  }
1942
- if (e.m !== NOT_PENDING && !(t.fe & STATUS_UNINITIALIZED)) return true;
1943
- return !!(t.fe & STATUS_PENDING && !(t.fe & STATUS_UNINITIALIZED));
1944
2035
  }
1945
- function updatePendingSignal(e) {
1946
- if (e.We) {
1947
- const t = computePendingState(e);
1948
- const n = e.We;
1949
- setSignal(n, t);
1950
- if (!t && n.i) {
1951
- const t = resolveLane(e);
1952
- if (t && t.u.size > 0) {
1953
- const e = findLane(n.i);
1954
- if (e !== t) {
1955
- mergeLanes(t, e);
1956
- }
1957
- }
1958
- signalLanes.delete(n);
1959
- n.i = undefined;
2036
+ function snapCompanionsToState(e) {
2037
+ const t = e.B;
2038
+ if (t && (t.O === undefined || t.O === NOT_PENDING)) {
2039
+ const n = computePendingState(e);
2040
+ if (t.Z !== n || t.D !== NOT_PENDING) {
2041
+ t.Z = n;
2042
+ t.D = NOT_PENDING;
2043
+ t.fe = clock;
2044
+ insertSubs(t);
2045
+ schedule();
1960
2046
  }
1961
2047
  }
2048
+ const n = e.q;
2049
+ if (n && !(n.W & REACTIVE_DISPOSED)) {
2050
+ if (
2051
+ (n.O === undefined || n.O === NOT_PENDING) &&
2052
+ n.D === NOT_PENDING &&
2053
+ !Object.is(n.Z, e.Z) &&
2054
+ !(n.W & (REACTIVE_DIRTY | REACTIVE_CHECK))
2055
+ ) {
2056
+ n.W |= REACTIVE_DIRTY;
2057
+ insertIntoHeap(n, n.W & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
2058
+ insertSubs(n);
2059
+ schedule();
2060
+ }
2061
+ snapCompanionsToState(n);
2062
+ }
1962
2063
  }
1963
2064
  function getLatestValueComputed(e) {
1964
- if (!e.Fe) {
2065
+ if (!e.q) {
1965
2066
  const t = latestReadActive;
1966
2067
  latestReadActive = false;
1967
2068
  const n = pendingCheckActive;
1968
2069
  pendingCheckActive = false;
1969
2070
  const i = context;
1970
2071
  context = null;
1971
- e.Fe = optimisticComputed(() => read(e));
1972
- e.Fe.t = e;
2072
+ e.q = optimisticComputed(() => read(e));
2073
+ e.q.t = e;
1973
2074
  context = i;
1974
2075
  pendingCheckActive = n;
1975
2076
  latestReadActive = t;
1976
2077
  }
1977
- return e.Fe;
2078
+ return e.q;
1978
2079
  }
1979
2080
  function staleValues(e, t = true) {
1980
2081
  const n = stale;
@@ -1996,16 +2097,14 @@ function latest(e) {
1996
2097
  }
1997
2098
  function isPending(e) {
1998
2099
  const t = pendingCheckActive;
1999
- const n = foundPending;
2000
- const i = pendingCheckSources;
2100
+ const n = pendingProbe;
2001
2101
  pendingCheckActive = true;
2002
- foundPending = false;
2003
- pendingCheckSources = new Set();
2102
+ const i = (pendingProbe = { found: false, sources: new Set(), freshReads: new Set() });
2004
2103
  const collectPending = () => {
2005
2104
  pendingCheckActive = false;
2006
2105
  try {
2007
- pendingCheckSources.forEach(e => {
2008
- if (read(getPendingSignal(e))) foundPending = true;
2106
+ i.sources.forEach(e => {
2107
+ if (read(getPendingSignal(e)) && !i.freshReads.has(e)) i.found = true;
2009
2108
  });
2010
2109
  } finally {
2011
2110
  pendingCheckActive = true;
@@ -2014,18 +2113,17 @@ function isPending(e) {
2014
2113
  try {
2015
2114
  e();
2016
2115
  collectPending();
2017
- return foundPending;
2116
+ return i.found;
2018
2117
  } catch (e) {
2019
2118
  collectPending();
2020
2119
  if (e instanceof NotReadyError) {
2021
- if (foundPending && !(e.source?.fe & STATUS_UNINITIALIZED)) return true;
2120
+ if (i.found && !(e.source?.Y & STATUS_UNINITIALIZED)) return true;
2022
2121
  if (context) throw e;
2023
2122
  }
2024
- return foundPending;
2123
+ return i.found;
2025
2124
  } finally {
2026
2125
  pendingCheckActive = t;
2027
- foundPending = n;
2028
- pendingCheckSources = i;
2126
+ pendingProbe = n;
2029
2127
  }
2030
2128
  }
2031
2129
  function refresh(e) {
@@ -2033,9 +2131,9 @@ function refresh(e) {
2033
2131
  if (!t) {
2034
2132
  return;
2035
2133
  }
2036
- if (typeof t.se === "function" && !(t.M & (REACTIVE_DISPOSED | REACTIVE_MANUAL_WRITE))) {
2037
- t.M = (t.M & ~REACTIVE_CHECK) | REACTIVE_DIRTY;
2038
- insertIntoHeap(t, t.M & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
2134
+ if (typeof t.ce === "function" && !(t.W & (REACTIVE_DISPOSED | REACTIVE_MANUAL_WRITE))) {
2135
+ t.W = (t.W & ~REACTIVE_CHECK) | REACTIVE_DIRTY;
2136
+ insertIntoHeap(t, t.W & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
2039
2137
  schedule();
2040
2138
  }
2041
2139
  }
@@ -2046,7 +2144,7 @@ function getContext(e, t = getOwner()) {
2046
2144
  if (!t) {
2047
2145
  throw new NoOwnerError();
2048
2146
  }
2049
- const n = hasContext(e, t) ? t.we[e.id] : e.defaultValue;
2147
+ const n = hasContext(e, t) ? t.Ve[e.id] : e.defaultValue;
2050
2148
  if (isUndefined(n)) {
2051
2149
  throw new ContextNotFoundError();
2052
2150
  }
@@ -2056,10 +2154,10 @@ function setContext(e, t, n = getOwner()) {
2056
2154
  if (!n) {
2057
2155
  throw new NoOwnerError();
2058
2156
  }
2059
- n.we = { ...n.we, [e.id]: isUndefined(t) ? e.defaultValue : t };
2157
+ n.Ve = { ...n.Ve, [e.id]: isUndefined(t) ? e.defaultValue : t };
2060
2158
  }
2061
2159
  function hasContext(e, t) {
2062
- return !isUndefined(t?.we[e.id]);
2160
+ return !isUndefined(t?.Ve[e.id]);
2063
2161
  }
2064
2162
  function isUndefined(e) {
2065
2163
  return typeof e === "undefined";
@@ -2069,86 +2167,106 @@ function effect(e, t, n, i) {
2069
2167
  const o = createEffectNode(e, t, n, r ? EFFECT_USER : EFFECT_RENDER, notifyEffectStatus, i);
2070
2168
  recompute(o, true);
2071
2169
  !i?.defer &&
2072
- (o.G === EFFECT_USER || i?.schedule ? o.F.enqueue(o.G, runEffect.bind(null, o)) : runEffect(o));
2170
+ (o.V === EFFECT_USER || i?.schedule ? o.F.enqueue(o.V, runEffect.bind(null, o)) : runEffect(o));
2073
2171
  }
2074
2172
  function notifyEffectStatus(e, t) {
2075
- const n = e !== undefined ? e : this.fe;
2076
- const i = t !== undefined ? t : this.ce;
2173
+ const n = e !== undefined ? e : this.Y;
2174
+ const i = t !== undefined ? t : this.ae;
2077
2175
  if (n & STATUS_ERROR) {
2078
- let e = i;
2079
2176
  this.F.notify(this, STATUS_PENDING, 0);
2080
- if (this.G === EFFECT_USER) {
2081
- try {
2082
- return this.je
2083
- ? this.je(e, () => {
2084
- this.$e?.();
2085
- this.$e = undefined;
2086
- })
2087
- : console.error(e);
2088
- } catch (t) {
2089
- e = t;
2177
+ if (this.V === EFFECT_USER) {
2178
+ if (this.Y & STATUS_ERROR) {
2179
+ this.G = true;
2180
+ this.F.enqueue(this.V, (this.$e ??= runEffect.bind(null, this)));
2090
2181
  }
2182
+ return;
2091
2183
  }
2092
- if (!this.F.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
2093
- } else if (this.G === EFFECT_RENDER) {
2184
+ if (!this.F.notify(this, STATUS_ERROR, STATUS_ERROR)) {
2185
+ haltReactivity();
2186
+ throw i;
2187
+ }
2188
+ } else if (this.V === EFFECT_RENDER) {
2094
2189
  this.F.notify(this, STATUS_PENDING | STATUS_ERROR, n, i);
2095
2190
  }
2096
2191
  }
2097
2192
  function runEffect(e) {
2098
- if (!e.k || e.M & REACTIVE_DISPOSED) return;
2099
- e.$e?.();
2100
- e.$e = undefined;
2101
- try {
2102
- const t = e.Qe(e.Z, e.xe);
2103
- if (false && t !== undefined && typeof t !== "function");
2104
- e.$e = t;
2105
- if (e.$e && !e.Ke) {
2106
- e.Ke = true;
2107
- runWithOwner(e.q, () => cleanup(() => e.$e?.()));
2193
+ if (!e.G || e.W & REACTIVE_DISPOSED) return;
2194
+ if (e.Y & STATUS_ERROR && e.V === EFFECT_USER) {
2195
+ const t = unwrapStatusError(e.ae);
2196
+ e.Ye = e.Z;
2197
+ e.G = false;
2198
+ try {
2199
+ e.Be
2200
+ ? e.Be(t, () => {
2201
+ const t = e.Le;
2202
+ e.Le = undefined;
2203
+ t?.();
2204
+ })
2205
+ : console.error(t);
2206
+ } catch (t) {
2207
+ if (!e.F.notify(e, STATUS_ERROR, STATUS_ERROR)) {
2208
+ haltReactivity();
2209
+ throw t;
2210
+ }
2108
2211
  }
2212
+ return;
2213
+ }
2214
+ const t = e.Le;
2215
+ e.Le = undefined;
2216
+ try {
2217
+ t?.();
2218
+ const n = e.Ze(e.Z, e.Ye);
2219
+ if (false && n !== undefined && typeof n !== "function");
2220
+ e.Le = n;
2109
2221
  } catch (t) {
2110
- e.ce = new StatusError(e, t);
2111
- e.fe |= STATUS_ERROR;
2112
- if (!e.F.notify(e, STATUS_ERROR, STATUS_ERROR)) throw t;
2222
+ e.ae = new StatusError(e, t);
2223
+ e.Y |= STATUS_ERROR;
2224
+ if (!e.F.notify(e, STATUS_ERROR, STATUS_ERROR)) {
2225
+ haltReactivity();
2226
+ throw t;
2227
+ }
2113
2228
  } finally {
2114
- e.xe = e.Z;
2115
- e.k = false;
2229
+ e.Ye = e.Z;
2230
+ e.G = false;
2116
2231
  }
2117
2232
  }
2118
- GlobalQueue.ie = runEffect;
2233
+ GlobalQueue.oe = runEffect;
2119
2234
  function trackedEffect(e, t) {
2120
2235
  const run = () => {
2121
- if (!n.k || n.M & REACTIVE_DISPOSED) return;
2236
+ if (!n.G || n.W & REACTIVE_DISPOSED) return;
2122
2237
  try {
2123
- n.k = false;
2238
+ n.G = false;
2124
2239
  recompute(n);
2125
2240
  } finally {
2126
2241
  }
2127
2242
  };
2128
2243
  const n = computed(
2129
2244
  () => {
2130
- n.$e?.();
2131
- n.$e = undefined;
2132
- const t = staleValues(e);
2133
- n.$e = t;
2245
+ const t = n.Le;
2246
+ n.Le = undefined;
2247
+ t?.();
2248
+ const i = staleValues(e);
2249
+ n.Le = i;
2134
2250
  },
2135
2251
  { ...t, lazy: true }
2136
2252
  );
2137
- n.$e = undefined;
2138
- n.ue = (n.ue & ~CONFIG_AUTO_DISPOSE) | CONFIG_CHILDREN_FORBIDDEN;
2139
- n.k = true;
2140
- n.G = EFFECT_TRACKED;
2141
- n.Me = (e, t) => {
2142
- const i = e !== undefined ? e : n.fe;
2253
+ n.Le = undefined;
2254
+ n.le = (n.le & ~CONFIG_AUTO_DISPOSE) | CONFIG_CHILDREN_FORBIDDEN;
2255
+ n.G = true;
2256
+ n.V = EFFECT_TRACKED;
2257
+ n.Qe = (e, t) => {
2258
+ const i = e !== undefined ? e : n.Y;
2143
2259
  if (i & STATUS_ERROR) {
2144
2260
  n.F.notify(n, STATUS_PENDING, 0);
2145
- const e = t !== undefined ? t : n.ce;
2146
- if (!n.F.notify(n, STATUS_ERROR, STATUS_ERROR)) throw e;
2261
+ const e = t !== undefined ? t : n.ae;
2262
+ if (!n.F.notify(n, STATUS_ERROR, STATUS_ERROR)) {
2263
+ haltReactivity();
2264
+ throw e;
2265
+ }
2147
2266
  }
2148
2267
  };
2149
- n.W = run;
2268
+ n.k = run;
2150
2269
  n.F.enqueue(EFFECT_USER, run);
2151
- cleanup(() => n.$e?.());
2152
2270
  }
2153
2271
  function restoreTransition(e, t) {
2154
2272
  globalQueue.initTransition(e);
@@ -2162,29 +2280,28 @@ function action(e) {
2162
2280
  const r = e(...t);
2163
2281
  globalQueue.initTransition();
2164
2282
  let o = activeTransition;
2165
- o.$.push(r);
2166
- const done = (e, t) => {
2283
+ o.j.push(r);
2284
+ const done = (e, t, s = false) => {
2167
2285
  o = currentTransition(o);
2168
- const s = o.$.indexOf(r);
2169
- if (s >= 0) o.$.splice(s, 1);
2286
+ const u = o.j.indexOf(r);
2287
+ if (u >= 0) o.j.splice(u, 1);
2170
2288
  setActiveTransition(o);
2171
2289
  schedule();
2172
- t ? i(t) : n(e);
2290
+ s ? i(t) : n(e);
2173
2291
  };
2174
2292
  const step = (e, t) => {
2175
2293
  let n;
2176
2294
  try {
2177
2295
  n = t ? r.throw(e) : r.next(e);
2178
2296
  } catch (e) {
2179
- return done(undefined, e);
2297
+ return done(undefined, e, true);
2180
2298
  }
2181
- if (n instanceof Promise)
2182
- return void n.then(run, e => restoreTransition(o, () => step(e, true)));
2299
+ if (isThenable(n)) return void n.then(run, e => done(undefined, e, true));
2183
2300
  run(n);
2184
2301
  };
2185
2302
  const run = e => {
2186
2303
  if (e.done) return done(e.value);
2187
- if (e.value instanceof Promise)
2304
+ if (isThenable(e.value))
2188
2305
  return void e.value.then(
2189
2306
  e => restoreTransition(o, () => step(e)),
2190
2307
  e => restoreTransition(o, () => step(e, true))
@@ -2205,7 +2322,7 @@ function accessor(e) {
2205
2322
  function createSignal(e, t) {
2206
2323
  if (typeof e === "function") {
2207
2324
  const n = computed(e, t);
2208
- n.ue &= ~CONFIG_AUTO_DISPOSE;
2325
+ n.le &= ~CONFIG_AUTO_DISPOSE;
2209
2326
  return [accessor(n), setMemo.bind(null, n)];
2210
2327
  }
2211
2328
  const n = signal(e, t);
@@ -2227,11 +2344,17 @@ function createReaction(e, t) {
2227
2344
  let n = undefined;
2228
2345
  cleanup(() => n?.());
2229
2346
  const i = getOwner();
2230
- return r => {
2347
+ let r;
2348
+ return o => {
2349
+ if (r) {
2350
+ dispose(r);
2351
+ r = undefined;
2352
+ }
2231
2353
  runWithOwner(i, () => {
2232
2354
  effect(
2233
- () => (r(), getOwner()),
2355
+ () => (o(), (r = getOwner())),
2234
2356
  t => {
2357
+ r = undefined;
2235
2358
  n?.();
2236
2359
  const i = (e.effect || e)?.();
2237
2360
  if (false && i !== undefined && typeof i !== "function");
@@ -2247,22 +2370,25 @@ function createReaction(e, t) {
2247
2370
  function resolve(e) {
2248
2371
  return new Promise((t, n) => {
2249
2372
  createRoot(i => {
2250
- computed(() => {
2251
- try {
2252
- t(e());
2253
- } catch (e) {
2254
- if (e instanceof NotReadyError) throw e;
2373
+ effect(
2374
+ e,
2375
+ e => {
2376
+ t(e);
2377
+ i();
2378
+ },
2379
+ e => {
2255
2380
  n(e);
2256
- }
2257
- i();
2258
- });
2381
+ i();
2382
+ },
2383
+ { user: true }
2384
+ );
2259
2385
  });
2260
2386
  });
2261
2387
  }
2262
2388
  function createOptimistic(e, t) {
2263
2389
  if (typeof e === "function") {
2264
2390
  const n = optimisticComputed(e, t);
2265
- n.ue &= ~CONFIG_AUTO_DISPOSE;
2391
+ n.le &= ~CONFIG_AUTO_DISPOSE;
2266
2392
  return [accessor(n), setSignal.bind(null, n)];
2267
2393
  }
2268
2394
  const n = optimisticSignal(e, t);
@@ -2270,26 +2396,103 @@ function createOptimistic(e, t) {
2270
2396
  }
2271
2397
  function onSettled(e) {
2272
2398
  const t = getOwner();
2273
- t && !(t.ue & CONFIG_CHILDREN_FORBIDDEN)
2399
+ t && !(t.le & CONFIG_CHILDREN_FORBIDDEN)
2274
2400
  ? createTrackedEffect(() => untrack(e), undefined)
2275
2401
  : globalQueue.enqueue(EFFECT_USER, () => {
2276
- const t = e();
2277
- t?.();
2402
+ e();
2278
2403
  });
2279
2404
  }
2405
+ function nodeKeys(e) {
2406
+ const t = Object.keys(e);
2407
+ if (symbolKeyedRecords.has(e)) {
2408
+ const n = Object.getOwnPropertySymbols(e);
2409
+ for (let e = 0, i = n.length; e < i; e++) {
2410
+ if (n[e] !== $TRACK) t.push(n[e]);
2411
+ }
2412
+ }
2413
+ return t;
2414
+ }
2280
2415
  function unwrap(e) {
2281
- return e?.[$TARGET]?.[STORE_NODE] ?? e;
2416
+ if (e === null || typeof e !== "object") return e;
2417
+ return e[$TARGET]?.[STORE_VALUE] ?? e;
2282
2418
  }
2283
2419
  function getOverrideValue(e, t, n, i) {
2284
2420
  if (i && n in i) return i[n];
2285
2421
  return t && n in t ? t[n] : e[n];
2286
2422
  }
2423
+ function addEnumSymbols(e, t, n) {
2424
+ for (let i = 0, r = t.length; i < r; i++) {
2425
+ if (Object.prototype.propertyIsEnumerable.call(e, t[i])) n.add(t[i]);
2426
+ }
2427
+ }
2287
2428
  function getAllKeys(e, t, n) {
2288
2429
  const i = getKeys(e, t);
2289
2430
  const r = Object.keys(n);
2290
- return Array.from(new Set([...i, ...r]));
2431
+ const o = e[$TARGET]
2432
+ ? untrack(() => Object.getOwnPropertySymbols(e))
2433
+ : Object.getOwnPropertySymbols(e);
2434
+ const s = Object.getOwnPropertySymbols(n);
2435
+ if (o.length === 0 && s.length === 0) {
2436
+ if (i.length === r.length) {
2437
+ let e = true;
2438
+ for (let t = 0; t < i.length; t++) {
2439
+ if (i[t] !== r[t]) {
2440
+ e = false;
2441
+ break;
2442
+ }
2443
+ }
2444
+ if (e) return i;
2445
+ }
2446
+ const e = new Set(i);
2447
+ for (let t = 0; t < r.length; t++) e.add(r[t]);
2448
+ return Array.from(e);
2449
+ }
2450
+ const u = new Set(i);
2451
+ addEnumSymbols(e, o, u);
2452
+ if (t) {
2453
+ for (const e of Reflect.ownKeys(t)) {
2454
+ t[e] === $DELETED ? u.delete(e) : u.add(e);
2455
+ }
2456
+ }
2457
+ for (let e = 0; e < r.length; e++) u.add(r[e]);
2458
+ addEnumSymbols(n, s, u);
2459
+ return Array.from(u);
2460
+ }
2461
+ function wrapValue(e, t) {
2462
+ return isWrappable(e) ? wrap(e, t) : e;
2463
+ }
2464
+ function itemKey(e, t) {
2465
+ return isWrappable(e) ? t(e) : e;
2466
+ }
2467
+ function keyedMatch(e, t, n) {
2468
+ return e === t || (isWrappable(e) && isWrappable(t) && n(e) === n(t));
2469
+ }
2470
+ function syncArrayNodeMembership(e, t) {
2471
+ let n = e[STORE_NODE];
2472
+ if (n) {
2473
+ const e = nodeKeys(n);
2474
+ for (let i = 0, r = e.length; i < r; i++) {
2475
+ const r = e[i];
2476
+ r in t || setSignal(n[r], undefined);
2477
+ }
2478
+ }
2479
+ if ((n = e[STORE_HAS])) {
2480
+ const e = nodeKeys(n);
2481
+ for (let i = 0, r = e.length; i < r; i++) {
2482
+ const r = e[i];
2483
+ setSignal(n[r], r in t);
2484
+ }
2485
+ }
2486
+ }
2487
+ function applyArrayItem(e, t, n, i, r) {
2488
+ if (isWrappable(e) && isWrappable(t)) {
2489
+ const o = wrap(t, n);
2490
+ i && setSignal(i, o);
2491
+ applyState(e, o, r);
2492
+ } else i && setSignal(i, wrapValue(e, n));
2291
2493
  }
2292
2494
  function applyState(e, t, n) {
2495
+ e = unwrap(e);
2293
2496
  const i = t?.[$TARGET];
2294
2497
  if (!i) return;
2295
2498
  if (i[STORE_OVERRIDE] || i[STORE_OPTIMISTIC_OVERRIDE]) {
@@ -2307,75 +2510,69 @@ function applyStateFast(e, t, n) {
2307
2510
  if (Array.isArray(i)) {
2308
2511
  let o = false;
2309
2512
  const s = i.length;
2310
- if (e.length && s && e[0] && n(e[0]) != null) {
2311
- let u, c, l, a, f, E, T, S;
2312
- for (
2313
- l = 0, a = Math.min(s, e.length);
2314
- l < a && ((E = i[l]) === e[l] || (E && e[l] && n(E) === n(e[l])));
2315
- l++
2316
- ) {
2317
- applyState(e[l], wrap(E, t), n);
2513
+ if (e.length && s && isWrappable(e[0]) && n(e[0]) != null) {
2514
+ let u, c, l, a, f, E, d, T;
2515
+ for (l = 0, a = Math.min(s, e.length); l < a && keyedMatch((E = i[l]), e[l], n); l++) {
2516
+ isWrappable(E) && isWrappable(e[l]) && applyState(e[l], wrap(E, t), n);
2318
2517
  }
2319
- const d = new Array(e.length),
2518
+ const S = new Array(e.length),
2320
2519
  _ = new Map();
2321
2520
  for (
2322
2521
  a = s - 1, f = e.length - 1;
2323
- a >= l && f >= l && ((E = i[a]) === e[f] || (E && e[f] && n(E) === n(e[f])));
2522
+ a >= l && f >= l && keyedMatch((E = i[a]), e[f], n);
2324
2523
  a--, f--
2325
2524
  ) {
2326
- d[f] = E;
2525
+ S[f] = E;
2327
2526
  }
2328
2527
  if (l > f || l > a) {
2329
2528
  for (c = l; c <= f; c++) {
2330
2529
  o = true;
2331
- r?.[c] && setSignal(r[c], wrap(e[c], t));
2530
+ r?.[c] && setSignal(r[c], wrapValue(e[c], t));
2332
2531
  }
2333
2532
  for (; c < e.length; c++) {
2334
2533
  o = true;
2335
- const i = wrap(d[c], t);
2336
- r?.[c] && setSignal(r[c], i);
2337
- applyState(e[c], i, n);
2534
+ applyArrayItem(e[c], S[c], t, r?.[c], n);
2338
2535
  }
2339
- o && notifySelf(t);
2536
+ syncArrayNodeMembership(t, e);
2537
+ (o || s !== e.length) && notifySelf(t);
2340
2538
  s !== e.length && r?.length && setSignal(r.length, e.length);
2341
2539
  return;
2342
2540
  }
2343
- T = new Array(f + 1);
2541
+ d = new Array(f + 1);
2344
2542
  for (c = f; c >= l; c--) {
2345
2543
  E = e[c];
2346
- S = E ? n(E) : E;
2347
- u = _.get(S);
2348
- T[c] = u === undefined ? -1 : u;
2349
- _.set(S, c);
2544
+ T = itemKey(E, n);
2545
+ u = _.get(T);
2546
+ d[c] = u === undefined ? -1 : u;
2547
+ _.set(T, c);
2350
2548
  }
2351
2549
  for (u = l; u <= a; u++) {
2352
2550
  E = i[u];
2353
- S = E ? n(E) : E;
2354
- c = _.get(S);
2551
+ T = itemKey(E, n);
2552
+ c = _.get(T);
2355
2553
  if (c !== undefined && c !== -1) {
2356
- d[c] = E;
2357
- c = T[c];
2358
- _.set(S, c);
2554
+ S[c] = E;
2555
+ c = d[c];
2556
+ _.set(T, c);
2359
2557
  }
2360
2558
  }
2361
2559
  for (c = l; c < e.length; c++) {
2362
- if (c in d) {
2363
- const i = wrap(d[c], t);
2364
- r?.[c] && setSignal(r[c], i);
2365
- applyState(e[c], i, n);
2366
- } else r?.[c] && setSignal(r[c], wrap(e[c], t));
2560
+ if (c in S) {
2561
+ applyArrayItem(e[c], S[c], t, r?.[c], n);
2562
+ } else r?.[c] && setSignal(r[c], wrapValue(e[c], t));
2367
2563
  }
2368
2564
  if (l < e.length) o = true;
2369
2565
  } else if (e.length) {
2370
2566
  for (let s = 0, u = e.length; s < u; s++) {
2371
2567
  const u = i[s];
2372
- if (isWrappable(u)) applyState(e[s], wrap(u, t), n);
2568
+ if (isWrappable(u) && isWrappable(e[s])) applyState(e[s], wrap(u, t), n);
2373
2569
  else {
2374
2570
  if (u !== e[s]) o = true;
2375
- r?.[s] && setSignal(r[s], e[s]);
2571
+ r?.[s] && setSignal(r[s], wrapValue(e[s], t));
2376
2572
  }
2377
2573
  }
2378
2574
  }
2575
+ syncArrayNodeMembership(t, e);
2379
2576
  if (s !== e.length) {
2380
2577
  o = true;
2381
2578
  r?.length && setSignal(r.length, e.length);
@@ -2386,21 +2583,27 @@ function applyStateFast(e, t, n) {
2386
2583
  let o = t[STORE_NODE];
2387
2584
  if (o) {
2388
2585
  const r = o[$TRACK];
2389
- const s = r ? getAllKeys(i, undefined, e) : Object.keys(o);
2586
+ const s = r ? getAllKeys(i, undefined, e) : nodeKeys(o);
2390
2587
  for (let u = 0, c = s.length; u < c; u++) {
2391
2588
  const c = s[u];
2392
2589
  const l = o[c];
2393
2590
  const a = unwrap(i[c]);
2394
2591
  let f = unwrap(e[c]);
2395
2592
  if (a === f) continue;
2396
- if (!a || !isWrappable(a) || !isWrappable(f) || (n(a) != null && n(a) !== n(f))) {
2593
+ if (
2594
+ !a ||
2595
+ !isWrappable(a) ||
2596
+ !isWrappable(f) ||
2597
+ Array.isArray(a) !== Array.isArray(f) ||
2598
+ (n(a) != null && n(a) !== n(f))
2599
+ ) {
2397
2600
  r && setSignal(r, void 0);
2398
2601
  l && setSignal(l, isWrappable(f) ? wrap(f, t) : f);
2399
2602
  } else applyState(f, wrap(a, t), n);
2400
2603
  }
2401
2604
  }
2402
2605
  if ((o = t[STORE_HAS])) {
2403
- const t = Object.keys(o);
2606
+ const t = nodeKeys(o);
2404
2607
  for (let n = 0, i = t.length; n < i; n++) {
2405
2608
  const i = t[n];
2406
2609
  setSignal(o[i], i in e);
@@ -2418,79 +2621,75 @@ function applyStateSlow(e, t, n) {
2418
2621
  if (Array.isArray(i)) {
2419
2622
  let u = false;
2420
2623
  const c = getOverrideValue(i, r, "length", o);
2421
- if (e.length && c && e[0] && n(e[0]) != null) {
2422
- let l, a, f, E, T, S, d, _;
2624
+ if (e.length && c && isWrappable(e[0]) && n(e[0]) != null) {
2625
+ let l, a, f, E, d, T, S, _;
2423
2626
  for (
2424
2627
  f = 0, E = Math.min(c, e.length);
2425
- f < E && ((S = getOverrideValue(i, r, f, o)) === e[f] || (S && e[f] && n(S) === n(e[f])));
2628
+ f < E && keyedMatch((T = getOverrideValue(i, r, f, o)), e[f], n);
2426
2629
  f++
2427
2630
  ) {
2428
- applyState(e[f], wrap(S, t), n);
2631
+ isWrappable(T) && isWrappable(e[f]) && applyState(e[f], wrap(T, t), n);
2429
2632
  }
2430
2633
  const O = new Array(e.length),
2431
2634
  R = new Map();
2432
2635
  for (
2433
- E = c - 1, T = e.length - 1;
2434
- E >= f &&
2435
- T >= f &&
2436
- ((S = getOverrideValue(i, r, E, o)) === e[T] || (S && e[T] && n(S) === n(e[T])));
2437
- E--, T--
2636
+ E = c - 1, d = e.length - 1;
2637
+ E >= f && d >= f && keyedMatch((T = getOverrideValue(i, r, E, o)), e[d], n);
2638
+ E--, d--
2438
2639
  ) {
2439
- O[T] = S;
2640
+ O[d] = T;
2440
2641
  }
2441
- if (f > T || f > E) {
2442
- for (a = f; a <= T; a++) {
2642
+ if (f > d || f > E) {
2643
+ for (a = f; a <= d; a++) {
2443
2644
  u = true;
2444
- s?.[a] && setSignal(s[a], wrap(e[a], t));
2645
+ s?.[a] && setSignal(s[a], wrapValue(e[a], t));
2445
2646
  }
2446
2647
  for (; a < e.length; a++) {
2447
2648
  u = true;
2448
- const i = wrap(O[a], t);
2449
- s?.[a] && setSignal(s[a], i);
2450
- applyState(e[a], i, n);
2649
+ applyArrayItem(e[a], O[a], t, s?.[a], n);
2451
2650
  }
2452
2651
  const i = e.length;
2453
- u && notifySelf(t);
2652
+ syncArrayNodeMembership(t, e);
2653
+ (u || c !== i) && notifySelf(t);
2454
2654
  c !== i && s?.length && setSignal(s.length, i);
2455
2655
  return;
2456
2656
  }
2457
- d = new Array(T + 1);
2458
- for (a = T; a >= f; a--) {
2459
- S = e[a];
2460
- _ = S ? n(S) : S;
2657
+ S = new Array(d + 1);
2658
+ for (a = d; a >= f; a--) {
2659
+ T = e[a];
2660
+ _ = itemKey(T, n);
2461
2661
  l = R.get(_);
2462
- d[a] = l === undefined ? -1 : l;
2662
+ S[a] = l === undefined ? -1 : l;
2463
2663
  R.set(_, a);
2464
2664
  }
2465
2665
  for (l = f; l <= E; l++) {
2466
- S = getOverrideValue(i, r, l, o);
2467
- _ = S ? n(S) : S;
2666
+ T = getOverrideValue(i, r, l, o);
2667
+ _ = itemKey(T, n);
2468
2668
  a = R.get(_);
2469
2669
  if (a !== undefined && a !== -1) {
2470
- O[a] = S;
2471
- a = d[a];
2670
+ O[a] = T;
2671
+ a = S[a];
2472
2672
  R.set(_, a);
2473
2673
  }
2474
2674
  }
2475
2675
  for (a = f; a < e.length; a++) {
2476
2676
  if (a in O) {
2477
- const i = wrap(O[a], t);
2478
- s?.[a] && setSignal(s[a], i);
2479
- applyState(e[a], i, n);
2480
- } else s?.[a] && setSignal(s[a], wrap(e[a], t));
2677
+ applyArrayItem(e[a], O[a], t, s?.[a], n);
2678
+ } else s?.[a] && setSignal(s[a], wrapValue(e[a], t));
2481
2679
  }
2482
2680
  if (f < e.length) u = true;
2483
2681
  } else if (e.length) {
2484
2682
  for (let c = 0, l = e.length; c < l; c++) {
2485
2683
  const l = getOverrideValue(i, r, c, o);
2486
- if (isWrappable(l)) applyState(e[c], wrap(l, t), n);
2684
+ if (isWrappable(l) && isWrappable(e[c])) applyState(e[c], wrap(l, t), n);
2487
2685
  else {
2488
2686
  if (l !== e[c]) u = true;
2489
- s?.[c] && setSignal(s[c], e[c]);
2687
+ s?.[c] && setSignal(s[c], wrapValue(e[c], t));
2490
2688
  }
2491
2689
  }
2492
2690
  }
2493
2691
  const l = e.length;
2692
+ syncArrayNodeMembership(t, e);
2494
2693
  if (c !== l) {
2495
2694
  u = true;
2496
2695
  s?.length && setSignal(s.length, l);
@@ -2500,21 +2699,27 @@ function applyStateSlow(e, t, n) {
2500
2699
  }
2501
2700
  if (s) {
2502
2701
  const u = s[$TRACK];
2503
- const c = u ? getAllKeys(i, r, e) : Object.keys(s);
2702
+ const c = u ? getAllKeys(i, r, e) : nodeKeys(s);
2504
2703
  for (let l = 0, a = c.length; l < a; l++) {
2505
2704
  const a = c[l];
2506
2705
  const f = s[a];
2507
2706
  const E = unwrap(getOverrideValue(i, r, a, o));
2508
- let T = unwrap(e[a]);
2509
- if (E === T) continue;
2510
- if (!E || !isWrappable(E) || !isWrappable(T) || (n(E) != null && n(E) !== n(T))) {
2707
+ let d = unwrap(e[a]);
2708
+ if (E === d) continue;
2709
+ if (
2710
+ !E ||
2711
+ !isWrappable(E) ||
2712
+ !isWrappable(d) ||
2713
+ Array.isArray(E) !== Array.isArray(d) ||
2714
+ (n(E) != null && n(E) !== n(d))
2715
+ ) {
2511
2716
  u && setSignal(u, void 0);
2512
- f && setSignal(f, isWrappable(T) ? wrap(T, t) : T);
2513
- } else applyState(T, wrap(E, t), n);
2717
+ f && setSignal(f, isWrappable(d) ? wrap(d, t) : d);
2718
+ } else applyState(d, wrap(E, t), n);
2514
2719
  }
2515
2720
  }
2516
2721
  if ((s = t[STORE_HAS])) {
2517
- const t = Object.keys(s);
2722
+ const t = nodeKeys(s);
2518
2723
  for (let n = 0, i = t.length; n < i; n++) {
2519
2724
  const i = t[n];
2520
2725
  setSignal(s[i], i in e);
@@ -2556,7 +2761,7 @@ function createProjectionInternal(e, t, n) {
2556
2761
  if (!i) i = getOwner();
2557
2762
  runProjectionComputed(o, e, n?.key || "id");
2558
2763
  }, undefined);
2559
- i.ue &= ~CONFIG_AUTO_DISPOSE;
2764
+ i.le &= ~CONFIG_AUTO_DISPOSE;
2560
2765
  return { store: o, node: i };
2561
2766
  }
2562
2767
  function createProjection(e, t, n) {
@@ -2568,7 +2773,7 @@ function runProjectionComputed(e, t, n, i, r) {
2568
2773
  let u;
2569
2774
  const c = new Proxy(
2570
2775
  e,
2571
- createWriteTraps(() => !s || o.ve === u, r)
2776
+ createWriteTraps(() => !s || o.be === u, r)
2572
2777
  );
2573
2778
  storeSetter(c, r => {
2574
2779
  u = t(r);
@@ -2651,7 +2856,8 @@ const STORE_VALUE = "v",
2651
2856
  STORE_WRAP = "w",
2652
2857
  STORE_LOOKUP = "l",
2653
2858
  STORE_FIREWALL = "f",
2654
- STORE_OPTIMISTIC = "p";
2859
+ STORE_OPTIMISTIC = "p",
2860
+ STORE_MASKED = "m";
2655
2861
  const STORE_SELF_PENDING = Symbol(0);
2656
2862
  function createStoreProxy(e, t = storeTraps, n) {
2657
2863
  let i;
@@ -2670,6 +2876,7 @@ function createStoreProxy(e, t = storeTraps, n) {
2670
2876
  return (i[$PROXY] = new Proxy(i, t));
2671
2877
  }
2672
2878
  const storeLookup = new WeakMap();
2879
+ const symbolKeyedRecords = new WeakSet();
2673
2880
  function wrap(e, t) {
2674
2881
  if (t?.[STORE_WRAP]) return t[STORE_WRAP](e, t);
2675
2882
  let n = e[$PROXY] || storeLookup.get(e);
@@ -2710,11 +2917,22 @@ function unwrapStoreValue(e, t, n) {
2710
2917
  function isPrototypePollutionKey$1(e) {
2711
2918
  return e === "__proto__" || e === "constructor" || e === "prototype";
2712
2919
  }
2713
- function hasOwnStoreProperty(e, t) {
2920
+ function ownEnumerableKeys(e) {
2921
+ return Reflect.ownKeys(e).filter(t => Object.prototype.propertyIsEnumerable.call(e, t));
2922
+ }
2923
+ function getOverlayLayer(e, t) {
2714
2924
  const n = e[STORE_OPTIMISTIC_OVERRIDE];
2715
- if (n && Object.prototype.hasOwnProperty.call(n, t) && n[t] !== $DELETED) return true;
2925
+ if (n && t in n) return n;
2716
2926
  const i = e[STORE_OVERRIDE];
2717
- if (i && Object.prototype.hasOwnProperty.call(i, t) && i[t] !== $DELETED) return true;
2927
+ if (i && t in i) return i;
2928
+ return undefined;
2929
+ }
2930
+ function visibleNodeValue(e) {
2931
+ return e.O !== undefined && e.O !== NOT_PENDING ? e.O : e.D !== NOT_PENDING ? e.D : e.Z;
2932
+ }
2933
+ function hasOwnStoreProperty(e, t) {
2934
+ const n = getOverlayLayer(e, t);
2935
+ if (n) return n[t] !== $DELETED;
2718
2936
  return Object.prototype.hasOwnProperty.call(unwrapStoreValue(e[STORE_VALUE]), t);
2719
2937
  }
2720
2938
  function hasInheritedAccessor(e, t) {
@@ -2738,33 +2956,58 @@ function getNode(e, t, n, i, r = isEqual, o, s) {
2738
2956
  {
2739
2957
  equals: r,
2740
2958
  unobserved() {
2741
- if (e[t] === u) delete e[t];
2959
+ if (e[t] === u) {
2960
+ delete e[t];
2961
+ if (typeof t === "symbol" && t !== $TRACK && symbolKeyedRecords.has(e)) {
2962
+ const t = Object.getOwnPropertySymbols(e);
2963
+ let n = false;
2964
+ for (let e = 0, i = t.length; e < i; e++) {
2965
+ if (t[e] !== $TRACK) {
2966
+ n = true;
2967
+ break;
2968
+ }
2969
+ }
2970
+ if (!n) symbolKeyedRecords.delete(e);
2971
+ }
2972
+ }
2742
2973
  }
2743
2974
  },
2744
2975
  i
2745
2976
  );
2746
2977
  if (o) {
2747
- u.R = NOT_PENDING;
2978
+ u.O = NOT_PENDING;
2748
2979
  }
2749
2980
  if (s && t in s) {
2750
2981
  const e = s[t];
2751
- u.ae = e === undefined ? NO_SNAPSHOT : e;
2982
+ u.Ee = e === undefined ? NO_SNAPSHOT : e;
2752
2983
  snapshotSources?.add(u);
2753
2984
  }
2985
+ if (typeof t === "symbol" && t !== $TRACK) symbolKeyedRecords.add(e);
2754
2986
  return (e[t] = u);
2755
2987
  }
2756
2988
  function trackSelf(e, t = $TRACK) {
2757
- getObserver() &&
2758
- read(
2759
- getNode(getNodes(e, STORE_NODE), t, undefined, e[STORE_FIREWALL], false, e[STORE_OPTIMISTIC])
2760
- );
2989
+ if (!getObserver()) return;
2990
+ read(
2991
+ getNode(getNodes(e, STORE_NODE), t, undefined, e[STORE_FIREWALL], false, e[STORE_OPTIMISTIC])
2992
+ );
2993
+ if (
2994
+ t === $TRACK &&
2995
+ !e[STORE_OVERRIDE] &&
2996
+ !e[STORE_OPTIMISTIC_OVERRIDE] &&
2997
+ e[STORE_VALUE][$TARGET]
2998
+ )
2999
+ e[STORE_VALUE][$TRACK];
2761
3000
  }
2762
3001
  function notifySelf(e) {
2763
3002
  const t = e[STORE_NODE]?.[$TRACK];
2764
3003
  t && setSignal(t, e[STORE_OPTIMISTIC] && !projectionWriteActive ? STORE_SELF_PENDING : undefined);
2765
3004
  }
2766
3005
  function getKeys(e, t, n = true) {
2767
- const i = untrack(() => (n ? Object.keys(e) : Reflect.ownKeys(e)));
3006
+ const i = e[$TARGET]
3007
+ ? untrack(() => (n ? Object.keys(e) : Reflect.ownKeys(e)))
3008
+ : n
3009
+ ? Object.keys(e)
3010
+ : Reflect.ownKeys(e);
2768
3011
  if (!t) return i;
2769
3012
  const r = new Set(i);
2770
3013
  const o = Reflect.ownKeys(t);
@@ -2778,10 +3021,26 @@ function getPropertyDescriptor(e, t, n) {
2778
3021
  if (t && n in t) {
2779
3022
  if (t[n] === $DELETED) return void 0;
2780
3023
  const i = Reflect.getOwnPropertyDescriptor(t, n);
2781
- if (i?.get || i?.set || !(n in e)) return i;
3024
+ if (i?.get || i?.set) return i;
3025
+ const r = Reflect.getOwnPropertyDescriptor(e, n);
3026
+ if (!r) return i;
3027
+ if (r.get || r.set) return r;
3028
+ r.value = t[n];
3029
+ return r;
2782
3030
  }
2783
3031
  return Reflect.getOwnPropertyDescriptor(e, n);
2784
3032
  }
3033
+ function maskStoreTarget(e, t) {
3034
+ const n = e[STORE_FIREWALL];
3035
+ if (!n) return;
3036
+ if (!!e[STORE_MASKED] === t) return;
3037
+ e[STORE_MASKED] = t;
3038
+ const i = (n.qe = (n.qe || 0) + (t ? 1 : -1));
3039
+ if ((t && i === 1) || (!t && i === 0)) {
3040
+ updatePendingSignal(n);
3041
+ updateChildCompanions(n);
3042
+ }
3043
+ }
2785
3044
  function prepareStoreWrite(e, t, n) {
2786
3045
  if (e[STORE_OPTIMISTIC]) {
2787
3046
  const t = e[STORE_FIREWALL];
@@ -2794,7 +3053,7 @@ function prepareStoreWrite(e, t, n) {
2794
3053
  if (
2795
3054
  snapshotCaptureActive &&
2796
3055
  typeof n !== "symbol" &&
2797
- !((e[STORE_FIREWALL]?.fe ?? 0) & STATUS_PENDING)
3056
+ !((e[STORE_FIREWALL]?.Y ?? 0) & STATUS_PENDING)
2798
3057
  ) {
2799
3058
  if (!e[STORE_SNAPSHOT_PROPS]) {
2800
3059
  e[STORE_SNAPSHOT_PROPS] = Object.create(null);
@@ -2806,9 +3065,14 @@ function prepareStoreWrite(e, t, n) {
2806
3065
  }
2807
3066
  const o = e[STORE_OPTIMISTIC] && !projectionWriteActive;
2808
3067
  const s = o ? STORE_OPTIMISTIC_OVERRIDE : STORE_OVERRIDE;
2809
- if (o) trackOptimisticStore(t);
2810
3068
  return { base: r, overrideKey: s, state: i };
2811
3069
  }
3070
+ function armOptimisticStoreWrite(e, t) {
3071
+ if (e[STORE_OPTIMISTIC] && !projectionWriteActive) {
3072
+ trackOptimisticStore(t);
3073
+ maskStoreTarget(e, true);
3074
+ }
3075
+ }
2812
3076
  function upsertStoreNode(e, t, n, i, r) {
2813
3077
  if (t[n]) return t[n];
2814
3078
  const o = isWrappable(i) ? wrap(i, e) : i;
@@ -2878,14 +3142,10 @@ const storeTraps = {
2878
3142
  ) {
2879
3143
  return read(getNode(r, t, undefined, e[STORE_FIREWALL]));
2880
3144
  }
2881
- const u = e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE];
2882
- const c = u || (e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]);
3145
+ const u = getOverlayLayer(e, t);
3146
+ const c = !!u;
2883
3147
  const l = !!e[STORE_VALUE][$TARGET];
2884
- const a = u
2885
- ? e[STORE_OPTIMISTIC_OVERRIDE]
2886
- : e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
2887
- ? e[STORE_OVERRIDE]
2888
- : e[STORE_VALUE];
3148
+ const a = u ?? e[STORE_VALUE];
2889
3149
  if (!o) {
2890
3150
  const i = Object.getOwnPropertyDescriptor(a, t);
2891
3151
  if (i && i.get) return i.get.call(n);
@@ -2898,14 +3158,7 @@ const storeTraps = {
2898
3158
  }
2899
3159
  if (writeOnly(n)) {
2900
3160
  if (isPrototypePollutionKey$1(t) && !hasOwnStoreProperty(e, t)) return undefined;
2901
- let n =
2902
- o && (c || !l)
2903
- ? o.R !== undefined && o.R !== NOT_PENDING
2904
- ? o.R
2905
- : o.m !== NOT_PENDING
2906
- ? o.m
2907
- : o.Z
2908
- : a[t];
3161
+ let n = o && (c || !l) ? visibleNodeValue(o) : a[t];
2909
3162
  n === $DELETED && (n = undefined);
2910
3163
  if (!isWrappable(n)) return n;
2911
3164
  const i = wrap(n, e);
@@ -2915,7 +3168,7 @@ const storeTraps = {
2915
3168
  let f = o ? (c || !l ? read(r[t]) : (read(r[t]), a[t])) : a[t];
2916
3169
  f === $DELETED && (f = undefined);
2917
3170
  if (!o) {
2918
- if (!c && typeof f === "function" && !a.hasOwnProperty(t)) {
3171
+ if (!c && typeof f === "function" && !Object.prototype.hasOwnProperty.call(a, t)) {
2919
3172
  let t;
2920
3173
  return !Array.isArray(e[STORE_VALUE]) &&
2921
3174
  (t = Object.getPrototypeOf(e[STORE_VALUE])) &&
@@ -2940,19 +3193,15 @@ const storeTraps = {
2940
3193
  },
2941
3194
  has(e, t) {
2942
3195
  if (t === $PROXY || t === $TRACK || t === "__proto__") return true;
2943
- const n =
2944
- e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE]
2945
- ? e[STORE_OPTIMISTIC_OVERRIDE][t] !== $DELETED
2946
- : e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
2947
- ? e[STORE_OVERRIDE][t] !== $DELETED
2948
- : t in e[STORE_VALUE];
2949
- if (writeOnly(e[$PROXY]) || getObserver() === e[STORE_FIREWALL]) return n;
2950
- const i = getNodes(e, STORE_HAS);
2951
- if (i[t]) return read(i[t]);
3196
+ const n = getOverlayLayer(e, t);
3197
+ const i = n ? n[t] !== $DELETED : t in e[STORE_VALUE];
3198
+ if (writeOnly(e[$PROXY]) || getObserver() === e[STORE_FIREWALL]) return i;
3199
+ const r = getNodes(e, STORE_HAS);
3200
+ if (r[t]) return read(r[t]);
2952
3201
  if (getObserver()) {
2953
- return read(getNode(i, t, n, e[STORE_FIREWALL], isEqual, e[STORE_OPTIMISTIC]));
3202
+ return read(getNode(r, t, i, e[STORE_FIREWALL], isEqual, e[STORE_OPTIMISTIC]));
2954
3203
  }
2955
- return n;
3204
+ return i;
2956
3205
  },
2957
3206
  set(e, t, n) {
2958
3207
  if (t === "__proto__") return true;
@@ -2960,44 +3209,48 @@ const storeTraps = {
2960
3209
  if (writeOnly(i)) {
2961
3210
  untrack(() => {
2962
3211
  const { base: r, overrideKey: o, state: s } = prepareStoreWrite(e, i, t);
2963
- const u =
2964
- e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE]
2965
- ? e[STORE_OPTIMISTIC_OVERRIDE][t]
2966
- : e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
2967
- ? e[STORE_OVERRIDE][t]
2968
- : r;
2969
- const c =
2970
- e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE]
2971
- ? e[STORE_OPTIMISTIC_OVERRIDE][t] !== $DELETED
2972
- : e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
2973
- ? e[STORE_OVERRIDE][t] !== $DELETED
2974
- : t in e[STORE_VALUE];
2975
- const l = unwrapStoreValue(n);
2976
- const a = Array.isArray(s) && t !== "length";
2977
- const f = a ? parseInt(t) + 1 : 0;
3212
+ const u = getOverlayLayer(e, t);
3213
+ const c = u ? u[t] : r;
3214
+ const l = u ? u[t] !== $DELETED : t in e[STORE_VALUE];
3215
+ const a = unwrapStoreValue(n);
3216
+ const f = typeof t === "string" ? Number(t) : -1;
2978
3217
  const E =
2979
- a &&
2980
- (e[STORE_OPTIMISTIC_OVERRIDE] && "length" in e[STORE_OPTIMISTIC_OVERRIDE]
2981
- ? e[STORE_OPTIMISTIC_OVERRIDE].length
2982
- : e[STORE_OVERRIDE] && "length" in e[STORE_OVERRIDE]
2983
- ? e[STORE_OVERRIDE].length
2984
- : s.length);
2985
- const T = a && f > E ? f : undefined;
2986
- if (u === l && T === undefined) return true;
2987
- if (l !== undefined && l === r && T === undefined) delete e[o]?.[t];
3218
+ Array.isArray(s) && Number.isInteger(f) && f >= 0 && f < 4294967295 && String(f) === t;
3219
+ const d = E ? f + 1 : 0;
3220
+ const T = E && (getOverlayLayer(e, "length") ?? s).length;
3221
+ const S = E && d > T ? d : undefined;
3222
+ if (c === a && S === undefined) return true;
3223
+ armOptimisticStoreWrite(e, i);
3224
+ if (a !== undefined && a === r && S === undefined) delete e[o]?.[t];
2988
3225
  else {
2989
3226
  const n = e[o] || (e[o] = Object.create(null));
2990
- n[t] = l;
2991
- if (T !== undefined) n.length = T;
3227
+ n[t] = a;
3228
+ if (S !== undefined) n.length = S;
3229
+ }
3230
+ notifyStoreProperty(e, t, "set", a, c, l);
3231
+ if (
3232
+ Array.isArray(s) &&
3233
+ t === "length" &&
3234
+ typeof a === "number" &&
3235
+ typeof c === "number" &&
3236
+ a < c
3237
+ ) {
3238
+ const t = e[o] || (e[o] = Object.create(null));
3239
+ for (let n = a; n < c; n++) {
3240
+ if (t[n] === $DELETED) continue;
3241
+ const i = n in t ? t[n] : s[n];
3242
+ if (!(n in t) && !(n in s)) continue;
3243
+ t[n] = $DELETED;
3244
+ notifyStoreProperty(e, n, "delete", undefined, i, true);
3245
+ }
2992
3246
  }
2993
- notifyStoreProperty(e, t, "set", l, u, c);
2994
- if (Array.isArray(s) && t !== "length" && T !== undefined) {
3247
+ if (Array.isArray(s) && t !== "length" && S !== undefined) {
2995
3248
  const t = getNodes(e, STORE_NODE);
2996
3249
  if (t.length) {
2997
- setSignal(t.length, T);
3250
+ setSignal(t.length, S);
2998
3251
  } else if (!projectionWriteActive && !e[STORE_OPTIMISTIC]) {
2999
- const n = upsertStoreNode(e, t, "length", E, e[STORE_SNAPSHOT_PROPS]);
3000
- setSignal(n, T);
3252
+ const n = upsertStoreNode(e, t, "length", T, e[STORE_SNAPSHOT_PROPS]);
3253
+ setSignal(n, S);
3001
3254
  }
3002
3255
  }
3003
3256
  if (false);
@@ -3011,6 +3264,7 @@ const storeTraps = {
3011
3264
  if (writeOnly(i)) {
3012
3265
  untrack(() => {
3013
3266
  const { base: r, overrideKey: o } = prepareStoreWrite(e, i, t);
3267
+ armOptimisticStoreWrite(e, i);
3014
3268
  const s = "value" in n ? { ...n, value: unwrapStoreValue(n.value) } : n;
3015
3269
  Object.defineProperty(e[o] || (e[o] = Object.create(null)), t, s);
3016
3270
  notifyStoreProperty(e, t, "invalidate");
@@ -3027,19 +3281,16 @@ const storeTraps = {
3027
3281
  untrack(() => {
3028
3282
  const n = e[STORE_OPTIMISTIC] && !projectionWriteActive;
3029
3283
  const i = n ? STORE_OPTIMISTIC_OVERRIDE : STORE_OVERRIDE;
3030
- if (n) trackOptimisticStore(e[$PROXY]);
3031
- const r =
3032
- e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE]
3033
- ? e[STORE_OPTIMISTIC_OVERRIDE][t]
3034
- : e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
3035
- ? e[STORE_OVERRIDE][t]
3036
- : e[STORE_VALUE][t];
3284
+ const r = getOverlayLayer(e, t);
3285
+ const o = r ? r[t] : e[STORE_VALUE][t];
3037
3286
  if (t in e[STORE_VALUE] || (e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE])) {
3287
+ armOptimisticStoreWrite(e, e[$PROXY]);
3038
3288
  (e[i] || (e[i] = Object.create(null)))[t] = $DELETED;
3039
3289
  } else if (e[i] && t in e[i]) {
3290
+ armOptimisticStoreWrite(e, e[$PROXY]);
3040
3291
  delete e[i][t];
3041
3292
  } else return true;
3042
- notifyStoreProperty(e, t, "delete", undefined, r, true);
3293
+ notifyStoreProperty(e, t, "delete", undefined, o, true);
3043
3294
  });
3044
3295
  }
3045
3296
  return true;
@@ -3065,7 +3316,9 @@ const storeTraps = {
3065
3316
  if (n?.get || n?.set || !(t in e[STORE_VALUE])) return n;
3066
3317
  const i = getPropertyDescriptor(e[STORE_VALUE], e[STORE_OVERRIDE], t);
3067
3318
  if (i) {
3068
- return { ...i, value: e[STORE_OPTIMISTIC_OVERRIDE][t] };
3319
+ const n = Reflect.getOwnPropertyDescriptor(e, t);
3320
+ const r = !n || n.configurable ? true : i.configurable;
3321
+ return { ...i, configurable: r, value: e[STORE_OPTIMISTIC_OVERRIDE][t] };
3069
3322
  }
3070
3323
  return {
3071
3324
  value: e[STORE_OPTIMISTIC_OVERRIDE][t],
@@ -3074,7 +3327,12 @@ const storeTraps = {
3074
3327
  configurable: true
3075
3328
  };
3076
3329
  }
3077
- return getPropertyDescriptor(e[STORE_VALUE], e[STORE_OVERRIDE], t);
3330
+ const n = getPropertyDescriptor(e[STORE_VALUE], e[STORE_OVERRIDE], t);
3331
+ if (n && !n.configurable) {
3332
+ const i = Reflect.getOwnPropertyDescriptor(e, t);
3333
+ if (!i || i.configurable) return { ...n, configurable: true };
3334
+ }
3335
+ return n;
3078
3336
  },
3079
3337
  getPrototypeOf(e) {
3080
3338
  return Object.getPrototypeOf(e[STORE_VALUE]);
@@ -3091,7 +3349,7 @@ function storeSetter(e, t) {
3091
3349
  for (let t = 0, i = n.length; t < i; t++) e[t] = n[t];
3092
3350
  e.length = n.length;
3093
3351
  } else {
3094
- const t = new Set([...Object.keys(e), ...Object.keys(n)]);
3352
+ const t = new Set([...ownEnumerableKeys(e), ...ownEnumerableKeys(n)]);
3095
3353
  t.forEach(t => {
3096
3354
  if (t in n) e[t] = n[t];
3097
3355
  else delete e[t];
@@ -3117,7 +3375,7 @@ function createStore(e, t, n) {
3117
3375
  ];
3118
3376
  }
3119
3377
  function createOptimisticStore(e, t, n) {
3120
- GlobalQueue.re ||= clearOptimisticStore;
3378
+ GlobalQueue.se ||= clearOptimisticStore;
3121
3379
  const i = typeof e === "function";
3122
3380
  const r = i ? t : e;
3123
3381
  const o = i ? e : undefined;
@@ -3126,12 +3384,15 @@ function createOptimisticStore(e, t, n) {
3126
3384
  }
3127
3385
  function clearOptimisticStore(e) {
3128
3386
  const t = e[$TARGET];
3129
- if (!t || !t[STORE_OPTIMISTIC_OVERRIDE]) return;
3387
+ if (!t) return;
3388
+ maskStoreTarget(t, false);
3389
+ if (!t[STORE_OPTIMISTIC_OVERRIDE]) return;
3130
3390
  clearOptimisticOverride(t);
3131
3391
  }
3132
3392
  function clearOptimisticOverride(e) {
3133
3393
  const t = e[STORE_OPTIMISTIC_OVERRIDE];
3134
3394
  if (!t) return;
3395
+ maskStoreTarget(e, false);
3135
3396
  const n = e[STORE_NODE];
3136
3397
  delete e[STORE_OPTIMISTIC_OVERRIDE];
3137
3398
  const i = projectionWriteActive;
@@ -3142,16 +3403,15 @@ function clearOptimisticOverride(e) {
3142
3403
  if (n[i]) {
3143
3404
  const t = n[i];
3144
3405
  t.i = undefined;
3145
- const r =
3146
- e[STORE_OVERRIDE] && i in e[STORE_OVERRIDE] ? e[STORE_OVERRIDE][i] : e[STORE_VALUE][i];
3147
- const o = r === $DELETED ? undefined : r;
3148
- const s = isWrappable(o) ? wrap(o, e) : o;
3149
- const u =
3150
- t.R !== undefined && t.R !== NOT_PENDING ? t.R : t.m !== NOT_PENDING ? t.m : t.Z;
3151
- t.R = NOT_PENDING;
3152
- t.m = NOT_PENDING;
3153
- t.Z = s;
3154
- if (!t.ke || !t.ke(u, s)) {
3406
+ const r = getOverlayLayer(e, i);
3407
+ const o = r ? r[i] : e[STORE_VALUE][i];
3408
+ const s = o === $DELETED ? undefined : o;
3409
+ const u = isWrappable(s) ? wrap(s, e) : s;
3410
+ const c = visibleNodeValue(t);
3411
+ t.O = NOT_PENDING;
3412
+ t.D = NOT_PENDING;
3413
+ t.Z = u;
3414
+ if (!t.xe || !t.xe(c, u)) {
3155
3415
  insertSubs(t, true);
3156
3416
  schedule();
3157
3417
  }
@@ -3211,7 +3471,7 @@ function createOptimisticProjectionInternal(e, t, n) {
3211
3471
  setProjectionWriteActive(false);
3212
3472
  }
3213
3473
  }, undefined);
3214
- i.ue &= ~CONFIG_AUTO_DISPOSE;
3474
+ i.le &= ~CONFIG_AUTO_DISPOSE;
3215
3475
  }
3216
3476
  return { store: o, node: i };
3217
3477
  }
@@ -3267,10 +3527,10 @@ function updatePath(e, t, n = 0) {
3267
3527
  delete e[i];
3268
3528
  } else if (i === undefined || (isWrappable(r) && isWrappable(o) && !Array.isArray(o))) {
3269
3529
  const t = i !== undefined ? e[i] : e;
3270
- const n = Object.keys(o);
3530
+ const n = ownEnumerableKeys(o);
3271
3531
  for (let e = 0; e < n.length; e++) {
3272
3532
  const i = n[e];
3273
- if (isPrototypePollutionKey(i)) continue;
3533
+ if (typeof i === "string" && isPrototypePollutionKey(i)) continue;
3274
3534
  const r = Object.getOwnPropertyDescriptor(o, i);
3275
3535
  if (r.get || r.set) Object.defineProperty(t, i, r);
3276
3536
  else t[i] = r.value;
@@ -3287,6 +3547,11 @@ const storePath = Object.assign(
3287
3547
  },
3288
3548
  { DELETE: DELETE }
3289
3549
  );
3550
+ function mergedOverlay(e) {
3551
+ const t = e[STORE_OVERRIDE];
3552
+ const n = e[STORE_OPTIMISTIC_OVERRIDE];
3553
+ return t && n ? { ...t, ...n } : (n ?? t);
3554
+ }
3290
3555
  function snapshotImpl(e, t, n, i) {
3291
3556
  let r, o, s, u, c, l;
3292
3557
  if (!isWrappable(e)) return e;
@@ -3294,7 +3559,7 @@ function snapshotImpl(e, t, n, i) {
3294
3559
  if (!n) n = new Map();
3295
3560
  if ((r = e[$TARGET] || i?.get(e)?.[$TARGET])) {
3296
3561
  if (t) trackSelf(r, $TRACK);
3297
- s = r[STORE_OVERRIDE];
3562
+ s = mergedOverlay(r);
3298
3563
  o = Array.isArray(r[STORE_VALUE]);
3299
3564
  n.set(
3300
3565
  e,
@@ -3317,13 +3582,30 @@ function snapshotImpl(e, t, n, i) {
3317
3582
  u[a] = c;
3318
3583
  }
3319
3584
  }
3585
+ if (u) u.length = o;
3586
+ } else if (!s) {
3587
+ const o = getKeys(e, undefined);
3588
+ for (let s = 0, a = o.length; s < a; s++) {
3589
+ const a = o[s];
3590
+ const f = Object.getOwnPropertyDescriptor(e, a);
3591
+ if (f.get) continue;
3592
+ l = f.value;
3593
+ if (t && isWrappable(l)) wrap(l, r);
3594
+ if ((c = snapshotImpl(l, t, n, i)) !== l || u) {
3595
+ if (!u) {
3596
+ u = Object.create(Object.getPrototypeOf(e));
3597
+ Object.assign(u, e);
3598
+ }
3599
+ u[a] = c;
3600
+ }
3601
+ }
3320
3602
  } else {
3321
3603
  const o = getKeys(e, s);
3322
3604
  for (let a = 0, f = o.length; a < f; a++) {
3323
3605
  let f = o[a];
3324
3606
  const E = getPropertyDescriptor(e, s, f);
3325
3607
  if (E.get) continue;
3326
- l = s && f in s ? s[f] : e[f];
3608
+ l = f in s ? s[f] : e[f];
3327
3609
  if (t && isWrappable(l)) wrap(l, r);
3328
3610
  if ((c = snapshotImpl(l, t, n, i)) !== e[f] || u) {
3329
3611
  if (!u) {
@@ -3406,7 +3688,7 @@ function merge(...e) {
3406
3688
  keys() {
3407
3689
  const e = new Set();
3408
3690
  for (let t = 0; t < n.length; t++) {
3409
- const i = Object.keys(resolveSource(n[t]));
3691
+ const i = ownEnumerableKeys(resolveSource(n[t]));
3410
3692
  for (let t = 0; t < i.length; t++) e.add(i[t]);
3411
3693
  }
3412
3694
  return [...e];
@@ -3458,7 +3740,7 @@ function omit(e, ...t) {
3458
3740
  return !t.includes(n) && n in e;
3459
3741
  },
3460
3742
  keys() {
3461
- return Object.keys(e).filter(e => !t.includes(e));
3743
+ return ownEnumerableKeys(e).filter(e => !t.includes(e));
3462
3744
  }
3463
3745
  },
3464
3746
  propTraps
@@ -3482,74 +3764,74 @@ function mapArray(e, t, n) {
3482
3764
  const r = t.length > 1;
3483
3765
  const o = t;
3484
3766
  const s = {
3485
- Ze: createOwner(),
3486
- Be: 0,
3487
- qe: e,
3488
- ze: [],
3489
- Xe: o,
3490
- Je: [],
3767
+ ze: createOwner(),
3768
+ Xe: 0,
3769
+ Je: e,
3491
3770
  et: [],
3492
- tt: i,
3493
- nt: i || n?.keyed === false ? [] : undefined,
3494
- it: r && n?.keyed !== false ? [] : undefined,
3495
- rt: n?.keyed === false,
3496
- ot: n?.fallback
3771
+ tt: o,
3772
+ nt: [],
3773
+ it: [],
3774
+ rt: i,
3775
+ ot: i || n?.keyed === false ? [] : undefined,
3776
+ st: r && n?.keyed !== false ? [] : undefined,
3777
+ ut: n?.keyed === false,
3778
+ ct: n?.fallback
3497
3779
  };
3498
3780
  const u = computed(updateKeyedMap.bind(s));
3499
- s.Ze.he = u;
3500
- u.ue &= ~CONFIG_AUTO_DISPOSE;
3781
+ s.ze.Ae = u;
3782
+ u.le &= ~CONFIG_AUTO_DISPOSE;
3501
3783
  return accessor(u);
3502
3784
  }
3503
3785
  const pureOptions = { ownedWrite: true };
3504
3786
  function updateKeyedMap() {
3505
- const e = this.qe() || [],
3787
+ const e = this.Je() || [],
3506
3788
  t = e.length;
3507
3789
  e[$TRACK];
3508
- runWithOwner(this.Ze, () => {
3790
+ runWithOwner(this.ze, () => {
3509
3791
  let n,
3510
3792
  i,
3511
- r = this.nt
3512
- ? this.rt
3793
+ r = this.ot
3794
+ ? this.ut
3513
3795
  ? () => {
3514
- this.nt[i] = signal(e[i], pureOptions);
3515
- return this.Xe(accessor(this.nt[i]), i);
3796
+ this.ot[i] = signal(e[i], pureOptions);
3797
+ return this.tt(accessor(this.ot[i]), i);
3516
3798
  }
3517
3799
  : () => {
3518
- this.nt[i] = signal(e[i], pureOptions);
3519
- this.it && (this.it[i] = signal(i, pureOptions));
3520
- return this.Xe(accessor(this.nt[i]), this.it ? accessor(this.it[i]) : undefined);
3800
+ this.ot[i] = signal(e[i], pureOptions);
3801
+ this.st && (this.st[i] = signal(i, pureOptions));
3802
+ return this.tt(accessor(this.ot[i]), this.st ? accessor(this.st[i]) : undefined);
3521
3803
  }
3522
- : this.it
3804
+ : this.st
3523
3805
  ? () => {
3524
3806
  const t = e[i];
3525
- this.it[i] = signal(i, pureOptions);
3526
- return this.Xe(t, accessor(this.it[i]));
3807
+ this.st[i] = signal(i, pureOptions);
3808
+ return this.tt(t, accessor(this.st[i]));
3527
3809
  }
3528
3810
  : () => {
3529
3811
  const t = e[i];
3530
- return this.Xe(t);
3812
+ return this.tt(t);
3531
3813
  };
3532
3814
  if (t === 0) {
3533
- if (this.Be !== 0) {
3534
- this.Ze.dispose(false);
3815
+ if (this.Xe !== 0) {
3816
+ this.ze.dispose(false);
3817
+ this.it = [];
3535
3818
  this.et = [];
3536
- this.ze = [];
3537
- this.Je = [];
3538
- this.Be = 0;
3539
- this.nt && (this.nt = []);
3540
- this.it && (this.it = []);
3819
+ this.nt = [];
3820
+ this.Xe = 0;
3821
+ this.ot && (this.ot = []);
3822
+ this.st && (this.st = []);
3541
3823
  }
3542
- if (this.ot && !this.Je[0]) {
3543
- this.Je[0] = runWithOwner((this.et[0] = createOwner()), this.ot);
3824
+ if (this.ct && !this.nt[0]) {
3825
+ this.nt[0] = runWithOwner((this.it[0] = createOwner()), this.ct);
3544
3826
  }
3545
- } else if (this.Be === 0) {
3546
- if (this.et[0]) this.et[0].dispose();
3547
- this.Je = new Array(t);
3827
+ } else if (this.Xe === 0) {
3828
+ if (this.it[0]) this.it[0].dispose();
3829
+ this.nt = new Array(t);
3548
3830
  for (i = 0; i < t; i++) {
3549
- this.ze[i] = e[i];
3550
- this.Je[i] = runWithOwner((this.et[i] = createOwner()), r);
3831
+ this.et[i] = e[i];
3832
+ this.nt[i] = runWithOwner((this.it[i] = createOwner()), r);
3551
3833
  }
3552
- this.Be = t;
3834
+ this.Xe = t;
3553
3835
  } else {
3554
3836
  let o,
3555
3837
  s,
@@ -3559,151 +3841,166 @@ function updateKeyedMap() {
3559
3841
  a,
3560
3842
  f,
3561
3843
  E = new Array(t),
3562
- T = new Array(t),
3563
- S = this.nt ? new Array(t) : undefined,
3564
- d = this.it ? new Array(t) : undefined;
3844
+ d = new Array(t),
3845
+ T = this.ot ? new Array(t) : undefined,
3846
+ S = this.st ? new Array(t) : undefined;
3565
3847
  for (
3566
- o = 0, s = Math.min(this.Be, t);
3567
- o < s && (this.ze[o] === e[o] || (this.nt && compare(this.tt, this.ze[o], e[o])));
3848
+ o = 0, s = Math.min(this.Xe, t);
3849
+ o < s && (this.et[o] === e[o] || (this.ot && compare(this.rt, this.et[o], e[o])));
3568
3850
  o++
3569
3851
  ) {
3570
- if (this.nt) setSignal(this.nt[o], e[o]);
3852
+ if (this.ot) setSignal(this.ot[o], e[o]);
3571
3853
  }
3572
3854
  for (
3573
- s = this.Be - 1, u = t - 1;
3855
+ s = this.Xe - 1, u = t - 1;
3574
3856
  s >= o &&
3575
3857
  u >= o &&
3576
- (this.ze[s] === e[u] || (this.nt && compare(this.tt, this.ze[s], e[u])));
3858
+ (this.et[s] === e[u] || (this.ot && compare(this.rt, this.et[s], e[u])));
3577
3859
  s--, u--
3578
3860
  ) {
3579
- E[u] = this.Je[s];
3580
- T[u] = this.et[s];
3581
- S && (S[u] = this.nt[s]);
3582
- d && (d[u] = this.it[s]);
3861
+ E[u] = this.nt[s];
3862
+ d[u] = this.it[s];
3863
+ T && (T[u] = this.ot[s]);
3864
+ S && (S[u] = this.st[s]);
3583
3865
  }
3584
3866
  a = new Map();
3585
3867
  f = new Array(u + 1);
3586
3868
  for (i = u; i >= o; i--) {
3587
3869
  c = e[i];
3588
- l = this.tt ? this.tt(c) : c;
3870
+ l = this.rt ? this.rt(c) : c;
3589
3871
  n = a.get(l);
3590
3872
  f[i] = n === undefined ? -1 : n;
3591
3873
  a.set(l, i);
3592
3874
  }
3593
3875
  for (n = o; n <= s; n++) {
3594
- c = this.ze[n];
3595
- l = this.tt ? this.tt(c) : c;
3876
+ c = this.et[n];
3877
+ l = this.rt ? this.rt(c) : c;
3596
3878
  i = a.get(l);
3597
3879
  if (i !== undefined && i !== -1) {
3598
- E[i] = this.Je[n];
3599
- T[i] = this.et[n];
3600
- S && (S[i] = this.nt[n]);
3601
- d && (d[i] = this.it[n]);
3880
+ E[i] = this.nt[n];
3881
+ d[i] = this.it[n];
3882
+ T && (T[i] = this.ot[n]);
3883
+ S && (S[i] = this.st[n]);
3602
3884
  i = f[i];
3603
3885
  a.set(l, i);
3604
- } else this.et[n].dispose();
3886
+ } else this.it[n].dispose();
3605
3887
  }
3606
3888
  for (i = o; i < t; i++) {
3607
3889
  if (i in E) {
3608
- this.Je[i] = E[i];
3609
- this.et[i] = T[i];
3610
- if (S) {
3611
- this.nt[i] = S[i];
3612
- setSignal(this.nt[i], e[i]);
3890
+ this.nt[i] = E[i];
3891
+ this.it[i] = d[i];
3892
+ if (T) {
3893
+ this.ot[i] = T[i];
3894
+ setSignal(this.ot[i], e[i]);
3613
3895
  }
3614
- if (d) {
3615
- this.it[i] = d[i];
3616
- setSignal(this.it[i], i);
3896
+ if (S) {
3897
+ this.st[i] = S[i];
3898
+ setSignal(this.st[i], i);
3617
3899
  }
3618
3900
  } else {
3619
- this.Je[i] = runWithOwner((this.et[i] = createOwner()), r);
3901
+ this.nt[i] = runWithOwner((this.it[i] = createOwner()), r);
3620
3902
  }
3621
3903
  }
3622
- this.Je = this.Je.slice(0, (this.Be = t));
3623
- this.ze = e.slice(0);
3904
+ this.nt = this.nt.slice(0, (this.Xe = t));
3905
+ this.et = e.slice(0);
3624
3906
  }
3625
3907
  });
3626
- return this.Je;
3908
+ return this.nt;
3627
3909
  }
3628
3910
  function repeat(e, t, n) {
3629
3911
  const i = t;
3630
3912
  const r = computed(
3631
3913
  updateRepeat.bind({
3632
- Ze: createOwner(),
3633
- Be: 0,
3634
- st: 0,
3635
- ut: e,
3636
- Xe: i,
3637
- et: [],
3638
- Je: [],
3639
- ct: n?.from,
3640
- ot: n?.fallback
3914
+ ze: createOwner(),
3915
+ Xe: 0,
3916
+ lt: 0,
3917
+ ft: e,
3918
+ tt: i,
3919
+ it: [],
3920
+ nt: [],
3921
+ Et: n?.from,
3922
+ ct: n?.fallback
3641
3923
  })
3642
3924
  );
3643
- r.ue &= ~CONFIG_AUTO_DISPOSE;
3925
+ r.le &= ~CONFIG_AUTO_DISPOSE;
3644
3926
  return accessor(r);
3645
3927
  }
3646
3928
  function updateRepeat() {
3647
- const e = this.ut();
3648
- const t = this.ct?.() || 0;
3649
- runWithOwner(this.Ze, () => {
3929
+ const e = this.ft();
3930
+ const t = this.Et?.() || 0;
3931
+ runWithOwner(this.ze, () => {
3650
3932
  if (e === 0) {
3651
- if (this.Be !== 0) {
3652
- this.Ze.dispose(false);
3653
- this.et = [];
3654
- this.Je = [];
3655
- this.Be = 0;
3656
- this.st = 0;
3933
+ if (this.Xe !== 0) {
3934
+ this.ze.dispose(false);
3935
+ this.it = [];
3936
+ this.nt = [];
3937
+ this.Xe = 0;
3938
+ this.lt = 0;
3657
3939
  }
3658
- if (this.ot && !this.Je[0]) {
3659
- this.Je[0] = runWithOwner((this.et[0] = createOwner()), this.ot);
3940
+ if (this.ct && !this.nt[0]) {
3941
+ this.nt[0] = runWithOwner((this.it[0] = createOwner()), this.ct);
3660
3942
  }
3661
3943
  return;
3662
3944
  }
3663
3945
  const n = t + e;
3664
- const i = this.st + this.Be;
3665
- if (this.Be === 0 && this.et[0]) this.et[0].dispose();
3666
- for (let e = n; e < i; e++) this.et[e - this.st].dispose();
3667
- if (this.st < t) {
3668
- const e = t - this.st;
3669
- for (let t = 0; t < e && t < this.Be; t++) this.et[t].dispose();
3670
- this.et.splice(0, e);
3671
- this.Je.splice(0, e);
3672
- } else if (this.st > t) {
3673
- let n = i - this.st - 1;
3674
- let r = this.st - t;
3675
- this.et.length = this.Je.length = e;
3946
+ const i = this.lt + this.Xe;
3947
+ if (this.Xe === 0 && this.it[0]) this.it[0].dispose();
3948
+ if (t >= i || n <= this.lt) {
3949
+ for (let e = 0; e < this.Xe; e++) this.it[e].dispose();
3950
+ this.it = new Array(e);
3951
+ this.nt = new Array(e);
3952
+ for (let n = 0; n < e; n++)
3953
+ this.nt[n] = runWithOwner((this.it[n] = createOwner()), () => this.tt(t + n));
3954
+ this.lt = t;
3955
+ this.Xe = e;
3956
+ return;
3957
+ }
3958
+ for (let e = n; e < i; e++) this.it[e - this.lt].dispose();
3959
+ if (this.lt < t) {
3960
+ const e = t - this.lt;
3961
+ for (let t = 0; t < e && t < this.Xe; t++) this.it[t].dispose();
3962
+ this.it.splice(0, e);
3963
+ this.nt.splice(0, e);
3964
+ } else if (this.lt > t) {
3965
+ let n = i - this.lt - 1;
3966
+ let r = this.lt - t;
3967
+ this.it.length = this.nt.length = e;
3676
3968
  while (n >= r) {
3677
- this.et[n] = this.et[n - r];
3678
- this.Je[n] = this.Je[n - r];
3969
+ this.it[n] = this.it[n - r];
3970
+ this.nt[n] = this.nt[n - r];
3679
3971
  n--;
3680
3972
  }
3681
3973
  for (let e = 0; e < r; e++) {
3682
- this.Je[e] = runWithOwner((this.et[e] = createOwner()), () => this.Xe(e + t));
3974
+ this.nt[e] = runWithOwner((this.it[e] = createOwner()), () => this.tt(e + t));
3683
3975
  }
3684
3976
  }
3685
3977
  for (let e = i; e < n; e++) {
3686
- this.Je[e - t] = runWithOwner((this.et[e - t] = createOwner()), () => this.Xe(e));
3978
+ this.nt[e - t] = runWithOwner((this.it[e - t] = createOwner()), () => this.tt(e));
3687
3979
  }
3688
- this.Je = this.Je.slice(0, e);
3689
- this.st = t;
3690
- this.Be = e;
3980
+ this.nt = this.nt.slice(0, e);
3981
+ this.lt = t;
3982
+ this.Xe = e;
3691
3983
  });
3692
- return this.Je;
3984
+ return this.nt;
3693
3985
  }
3694
3986
  function compare(e, t, n) {
3695
3987
  return e ? e(t) === e(n) : true;
3696
3988
  }
3697
3989
  function boundaryComputed(e, t) {
3698
3990
  const n = computed(e, { lazy: true });
3699
- n.Me = (e, t) => {
3700
- const i = e !== undefined ? e : n.fe;
3701
- const r = t !== undefined ? t : n.ce;
3702
- n.fe &= ~n.lt;
3703
- n.F.notify(n, n.lt, i, r);
3991
+ n.Qe = (e, t) => {
3992
+ const i = e !== undefined ? e : n.Y;
3993
+ const r = t !== undefined ? t : n.ae;
3994
+ n.Y &= ~n.dt;
3995
+ n.F.notify(n, STATUS_PENDING | STATUS_ERROR, i, r);
3996
+ const o = i & ~n.dt & (STATUS_PENDING | STATUS_ERROR);
3997
+ if (o) {
3998
+ n.Y &= ~o;
3999
+ if (n.ae === r && !(n.Y & (STATUS_PENDING | STATUS_ERROR))) n.ae = undefined;
4000
+ }
3704
4001
  };
3705
- n.lt = t;
3706
- n.ue &= ~CONFIG_AUTO_DISPOSE;
4002
+ n.dt = t;
4003
+ n.le &= ~CONFIG_AUTO_DISPOSE;
3707
4004
  recompute(n, true);
3708
4005
  return n;
3709
4006
  }
@@ -3725,52 +4022,52 @@ function isRevealController(e) {
3725
4022
  return e instanceof RevealController;
3726
4023
  }
3727
4024
  function isSlotReady(e) {
3728
- return isRevealController(e) ? e.isReady() : e.ft.size === 0 && !e.Et;
4025
+ return isRevealController(e) ? e.isReady() : e.Tt.size === 0 && !e.St;
3729
4026
  }
3730
4027
  function isSlotMinimallyReady(e) {
3731
4028
  return isRevealController(e) ? e.isMinimallyReady() : isSlotReady(e);
3732
4029
  }
3733
4030
  function setSlotState(e, t, n, i) {
3734
- setSignal(e.Tt, n);
3735
- setSignal(e.St, i);
4031
+ setSignal(e._t, n);
4032
+ setSignal(e.Ot, i);
3736
4033
  if (isRevealController(e)) {
3737
- if (!n && e.dt === t) e.dt = undefined;
4034
+ if (!n && e.Rt === t) e.Rt = undefined;
3738
4035
  return e.evaluate(n, i);
3739
4036
  }
3740
- if (!n && e._t === t && e.Ot) e._t = undefined;
4037
+ if (!n && e.It === t && e.ht) e.It = undefined;
3741
4038
  }
3742
4039
  class RevealController {
4040
+ At;
4041
+ Nt;
4042
+ Ct = [];
3743
4043
  Rt;
3744
- It;
3745
- ht = [];
3746
- dt;
3747
- Tt = signal(false, { ownedWrite: true, Ye: true });
3748
- St = signal(false, { ownedWrite: true, Ye: true });
3749
- Nt = true;
3750
- At = true;
3751
- Pt = false;
4044
+ _t = signal(false, { ownedWrite: true, Ke: true });
4045
+ Ot = signal(false, { ownedWrite: true, Ke: true });
4046
+ yt = true;
4047
+ Pt = true;
4048
+ gt = false;
3752
4049
  constructor(e, t) {
3753
- this.Rt = e;
3754
- this.It = t;
4050
+ this.At = e;
4051
+ this.Nt = t;
3755
4052
  }
3756
- Ct(e) {
3757
- for (let t = 0; t < this.ht.length; t++) {
3758
- const n = this.ht[t];
3759
- if ((isRevealController(n) ? n.dt : n._t) !== this) continue;
4053
+ Dt(e) {
4054
+ for (let t = 0; t < this.Ct.length; t++) {
4055
+ const n = this.Ct[t];
4056
+ if ((isRevealController(n) ? n.Rt : n.It) !== this) continue;
3760
4057
  if (e(n) === false) return false;
3761
4058
  }
3762
4059
  return true;
3763
4060
  }
3764
4061
  isReady() {
3765
- return this.Ct(isSlotReady);
4062
+ return this.Dt(isSlotReady);
3766
4063
  }
3767
4064
  isMinimallyReady() {
3768
- const e = untrack(this.Rt);
4065
+ const e = untrack(this.At);
3769
4066
  if (e === "together") return this.isReady();
3770
4067
  if (e === "natural") {
3771
4068
  let e = false;
3772
4069
  let t = false;
3773
- this.Ct(n => {
4070
+ this.Dt(n => {
3774
4071
  e = true;
3775
4072
  if (isSlotMinimallyReady(n)) {
3776
4073
  t = true;
@@ -3780,58 +4077,58 @@ class RevealController {
3780
4077
  return !e || t;
3781
4078
  }
3782
4079
  let t = true;
3783
- this.Ct(e => {
4080
+ this.Dt(e => {
3784
4081
  t = isSlotMinimallyReady(e);
3785
4082
  return false;
3786
4083
  });
3787
4084
  return t;
3788
4085
  }
3789
4086
  register(e) {
3790
- if (this.ht.includes(e)) return;
3791
- this.ht.push(e);
3792
- const t = untrack(this.Rt);
3793
- (setSignal(e.Tt, true), setSignal(e.St, t === "sequential" ? !!untrack(this.It) : false));
4087
+ if (this.Ct.includes(e)) return;
4088
+ this.Ct.push(e);
4089
+ const t = untrack(this.At);
4090
+ (setSignal(e._t, true), setSignal(e.Ot, t === "sequential" ? !!untrack(this.Nt) : false));
3794
4091
  untrack(() => this.evaluate());
3795
4092
  }
3796
4093
  unregister(e) {
3797
- const t = this.ht.indexOf(e);
3798
- if (t >= 0) this.ht.splice(t, 1);
4094
+ const t = this.Ct.indexOf(e);
4095
+ if (t >= 0) this.Ct.splice(t, 1);
3799
4096
  untrack(() => this.evaluate());
3800
4097
  }
3801
4098
  evaluate(e, t) {
3802
- if (this.Pt) return;
3803
- this.Pt = true;
3804
- const n = this.Nt;
3805
- const i = this.At;
4099
+ if (this.gt) return;
4100
+ this.gt = true;
4101
+ const n = this.yt;
4102
+ const i = this.Pt;
3806
4103
  try {
3807
- const n = e ?? read(this.Tt),
3808
- i = untrack(this.Rt),
3809
- r = i === "sequential" && !!untrack(this.It),
4104
+ const n = e ?? read(this._t),
4105
+ i = untrack(this.At),
4106
+ r = i === "sequential" && !!untrack(this.Nt),
3810
4107
  o = t ?? r;
3811
4108
  if (n) {
3812
- this.Ct(e => setSlotState(e, this, true, o));
4109
+ this.Dt(e => setSlotState(e, this, true, o));
3813
4110
  } else if (i === "natural") {
3814
- this.Ct(e => {
4111
+ this.Dt(e => {
3815
4112
  if (isRevealController(e)) {
3816
- setSignal(e.St, false);
3817
- setSignal(e.Tt, false);
4113
+ setSignal(e.Ot, false);
4114
+ setSignal(e._t, false);
3818
4115
  e.evaluate(false, false);
3819
4116
  } else {
3820
4117
  setSlotState(e, this, !isSlotReady(e), false);
3821
4118
  }
3822
4119
  });
3823
4120
  } else if (i === "together") {
3824
- const e = this.Ct(isSlotMinimallyReady);
3825
- this.Ct(t => setSlotState(t, this, !e, false));
4121
+ const e = this.Dt(isSlotMinimallyReady);
4122
+ this.Dt(t => setSlotState(t, this, !e, false));
3826
4123
  } else {
3827
4124
  let e = false;
3828
- this.Ct(t => {
4125
+ this.Dt(t => {
3829
4126
  if (e) return setSlotState(t, this, true, r);
3830
4127
  if (isSlotReady(t)) return setSlotState(t, this, false, false);
3831
4128
  e = true;
3832
4129
  if (isRevealController(t)) {
3833
- setSignal(t.St, false);
3834
- setSignal(t.Tt, false);
4130
+ setSignal(t.Ot, false);
4131
+ setSignal(t._t, false);
3835
4132
  t.evaluate(false, false);
3836
4133
  } else {
3837
4134
  setSlotState(t, this, true, false);
@@ -3839,101 +4136,98 @@ class RevealController {
3839
4136
  });
3840
4137
  }
3841
4138
  } finally {
3842
- this.Nt = this.isReady();
3843
- this.At = this.isMinimallyReady();
3844
- this.Pt = false;
4139
+ this.yt = this.isReady();
4140
+ this.Pt = this.isMinimallyReady();
4141
+ this.gt = false;
3845
4142
  }
3846
- if (this.dt && (n !== this.Nt || i !== this.At)) this.dt.evaluate();
4143
+ if (this.Rt && (n !== this.yt || i !== this.Pt)) this.Rt.evaluate();
3847
4144
  }
3848
4145
  }
3849
4146
  class CollectionQueue extends Queue {
3850
- gt;
3851
- ft = new Set();
3852
- Dt;
3853
- Et = true;
3854
- Tt = signal(false, { ownedWrite: true, Ye: true });
3855
- ce;
3856
- St = signal(false, { ownedWrite: true, Ye: true });
3857
- _t;
3858
- Ot = false;
3859
- yt;
3860
- vt = ON_INIT;
4147
+ bt;
4148
+ Tt = new Set();
4149
+ vt;
4150
+ St = true;
4151
+ _t = signal(false, { ownedWrite: true, Ke: true });
4152
+ ae;
4153
+ Ot = signal(false, { ownedWrite: true, Ke: true });
4154
+ It;
4155
+ ht = false;
4156
+ wt;
4157
+ Lt = ON_INIT;
3861
4158
  constructor(e) {
3862
4159
  super();
3863
- this.gt = e;
4160
+ this.bt = e;
3864
4161
  }
3865
4162
  run(e) {
3866
- if (!e || (read(this.Tt) && (!_revealUsed || read(this.St)))) return;
4163
+ if (!e || (read(this._t) && (!_revealUsed || read(this.Ot)))) return;
3867
4164
  return super.run(e);
3868
4165
  }
3869
4166
  notify(e, t, n, i) {
3870
- if (!(t & this.gt)) return super.notify(e, t, n, i);
3871
- if (this.Ot && this.yt) {
4167
+ if (!(t & this.bt)) return super.notify(e, t, n, i);
4168
+ if (this.ht && this.wt) {
3872
4169
  const e = untrack(() => {
3873
4170
  try {
3874
- return this.yt();
4171
+ return this.wt();
3875
4172
  } catch {
3876
4173
  return ON_INIT;
3877
4174
  }
3878
4175
  });
3879
- if (e !== this.vt) {
3880
- this.vt = e;
3881
- this.Ot = false;
3882
- this.ft.clear();
4176
+ if (e !== this.Lt) {
4177
+ this.Lt = e;
4178
+ this.ht = false;
4179
+ this.Tt.clear();
3883
4180
  }
3884
4181
  }
3885
- if (this.gt & STATUS_PENDING && this.Ot) return super.notify(e, t, n, i);
3886
- if (this.gt & STATUS_PENDING && n & STATUS_ERROR) {
3887
- return super.notify(e, STATUS_ERROR, n, i);
3888
- }
3889
- if (n & this.gt) {
3890
- this.Et = true;
3891
- const t = i?.source || e.ce?.source;
4182
+ if (this.bt & STATUS_PENDING && this.ht) return super.notify(e, t, n, i);
4183
+ if (n & this.bt) {
4184
+ this.St = true;
4185
+ const t = i?.source || e.ae?.source;
3892
4186
  if (t) {
3893
- const e = this.ft.size === 0;
3894
- this.ft.add(t);
3895
- if (e) setSignal(this.Tt, true);
3896
- if (this.gt & STATUS_ERROR) {
3897
- setSignal(this.ce, t.ce?.cause ?? t.ce);
4187
+ const e = this.Tt.size === 0;
4188
+ this.Tt.add(t);
4189
+ if (e) setSignal(this._t, true);
4190
+ if (this.bt & STATUS_ERROR) {
4191
+ setSignal(this.ae, unwrapStatusError(t.ae));
3898
4192
  }
3899
4193
  }
3900
4194
  }
3901
- t &= ~this.gt;
4195
+ t &= ~this.bt;
3902
4196
  return t ? super.notify(e, t, n, i) : true;
3903
4197
  }
3904
4198
  checkSources() {
3905
- for (const e of this.ft) {
4199
+ for (const e of this.Tt) {
3906
4200
  if (
3907
- e.M & REACTIVE_DISPOSED ||
3908
- (!(e.fe & this.gt) && !(this.gt & STATUS_ERROR && e.fe & STATUS_PENDING))
4201
+ e.W & REACTIVE_DISPOSED ||
4202
+ (!(e.Y & this.bt) && !(this.bt & STATUS_ERROR && e.Y & STATUS_PENDING))
3909
4203
  )
3910
- this.ft.delete(e);
4204
+ this.Tt.delete(e);
3911
4205
  }
3912
- if (!this.ft.size) {
3913
- if (this.gt & STATUS_PENDING && this.Et && !this.Ot && this.Dt) {
3914
- this.Et = !!(this.Dt.fe & this.gt);
4206
+ if (!this.Tt.size) {
4207
+ if (this.bt & STATUS_PENDING && this.St && !this.ht && this.vt) {
4208
+ this.St = !!(this.vt.Y & this.bt);
3915
4209
  } else {
3916
- this.Et = false;
4210
+ this.St = false;
3917
4211
  }
3918
- if (!this.Et) {
3919
- setSignal(this.Tt, false);
3920
- if (this.yt) {
4212
+ if (!this.St) {
4213
+ setSignal(this._t, false);
4214
+ if (this.wt) {
3921
4215
  try {
3922
- this.vt = untrack(() => this.yt());
4216
+ this.Lt = untrack(() => this.wt());
3923
4217
  } catch {}
3924
4218
  }
3925
4219
  }
3926
4220
  }
3927
- if (_revealUsed) this._t?.evaluate();
4221
+ if (_revealUsed) this.It?.evaluate();
3928
4222
  }
3929
4223
  }
3930
4224
  function createCollectionBoundary(e, t, n, i) {
3931
4225
  const r = createOwner();
3932
4226
  if (_revealUsed) setContext(RevealControllerContext, null, r);
3933
4227
  const o = new CollectionQueue(e);
3934
- if (e === STATUS_ERROR) o.ce = signal(undefined, { ownedWrite: true, Ye: true });
3935
- if (i) o.yt = i;
3936
- const s = (o.Dt = createBoundChildren(r, t, o, e));
4228
+ if (e === STATUS_ERROR) o.ae = signal(undefined, { ownedWrite: true, Ke: true });
4229
+ if (i) o.wt = i;
4230
+ const s = (o.vt = createBoundChildren(r, t, o, e));
3937
4231
  untrack(() => {
3938
4232
  let t = false;
3939
4233
  try {
@@ -3942,23 +4236,26 @@ function createCollectionBoundary(e, t, n, i) {
3942
4236
  if (e instanceof NotReadyError) t = true;
3943
4237
  else throw e;
3944
4238
  }
3945
- o.Et = t || !!(s.fe & e) || s.ce instanceof NotReadyError;
4239
+ o.St = t || !!(s.Y & e) || s.ae instanceof NotReadyError;
3946
4240
  });
3947
4241
  const u = _revealUsed && e === STATUS_PENDING ? getContext(RevealControllerContext) : null;
3948
4242
  if (u) {
3949
- o._t = u;
4243
+ o.It = u;
3950
4244
  u.register(o);
3951
4245
  cleanup(() => u.unregister(o));
3952
4246
  }
3953
4247
  return accessor(
3954
- computed(() => {
3955
- if (!read(o.Tt)) {
3956
- const e = read(s);
3957
- if (!untrack(() => read(o.Tt))) return ((o.Ot = true), e);
3958
- }
3959
- if (_revealUsed && read(o.St)) return undefined;
3960
- return n(o);
3961
- })
4248
+ computed(
4249
+ () => {
4250
+ if (!read(o._t)) {
4251
+ const e = read(s);
4252
+ if (!untrack(() => read(o._t))) return ((o.ht = true), e);
4253
+ }
4254
+ if (_revealUsed && read(o.Ot)) return undefined;
4255
+ return n(o);
4256
+ },
4257
+ { Ke: true }
4258
+ )
3962
4259
  );
3963
4260
  }
3964
4261
  function createLoadingBoundary(e, t, n) {
@@ -3966,8 +4263,8 @@ function createLoadingBoundary(e, t, n) {
3966
4263
  }
3967
4264
  function createErrorBoundary(e, t) {
3968
4265
  return createCollectionBoundary(STATUS_ERROR, e, e =>
3969
- t(accessor(e.ce), () => {
3970
- for (const t of e.ft) recompute(t);
4266
+ t(accessor(e.ae), () => {
4267
+ for (const t of e.Tt) recompute(t);
3971
4268
  schedule();
3972
4269
  })
3973
4270
  );
@@ -3988,7 +4285,7 @@ function createRevealOrder(e, t) {
3988
4285
  s.evaluate();
3989
4286
  });
3990
4287
  if (i) {
3991
- s.dt = i;
4288
+ s.Rt = i;
3992
4289
  i.register(s);
3993
4290
  cleanup(() => i.unregister(s));
3994
4291
  }
@@ -4098,6 +4395,7 @@ export {
4098
4395
  refresh,
4099
4396
  releaseSnapshotScope,
4100
4397
  repeat,
4398
+ resetErrorHalt,
4101
4399
  resolve,
4102
4400
  runWithOwner,
4103
4401
  setContext,