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

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