@solidjs/signals 0.13.13 → 2.0.0-beta.10

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 (55) hide show
  1. package/README.md +8 -7
  2. package/dist/dev.js +502 -244
  3. package/dist/node.cjs +1501 -1308
  4. package/dist/prod.js +1134 -929
  5. package/dist/types/boundaries.d.ts +124 -3
  6. package/dist/types/core/action.d.ts +34 -0
  7. package/dist/types/core/constants.d.ts +24 -0
  8. package/dist/types/core/context.d.ts +10 -2
  9. package/dist/types/core/core.d.ts +108 -9
  10. package/dist/types/core/dev.d.ts +1 -1
  11. package/dist/types/core/effect.d.ts +3 -2
  12. package/dist/types/core/error.d.ts +24 -0
  13. package/dist/types/core/external.d.ts +19 -0
  14. package/dist/types/core/graph.d.ts +1 -0
  15. package/dist/types/core/owner.d.ts +93 -3
  16. package/dist/types/core/scheduler.d.ts +27 -2
  17. package/dist/types/core/types.d.ts +3 -6
  18. package/dist/types/index.d.ts +2 -2
  19. package/dist/types/map.d.ts +32 -3
  20. package/dist/types/signals.d.ts +338 -39
  21. package/dist/types/store/optimistic.d.ts +38 -12
  22. package/dist/types/store/projection.d.ts +55 -15
  23. package/dist/types/store/reconcile.d.ts +22 -0
  24. package/dist/types/store/store.d.ts +72 -15
  25. package/dist/types/store/storePath.d.ts +28 -0
  26. package/dist/types/store/utils.d.ts +78 -7
  27. package/dist/types-cjs/boundaries.d.cts +173 -0
  28. package/dist/types-cjs/core/action.d.cts +35 -0
  29. package/dist/types-cjs/core/async.d.cts +6 -0
  30. package/dist/types-cjs/core/constants.d.cts +49 -0
  31. package/dist/types-cjs/core/context.d.cts +36 -0
  32. package/dist/types-cjs/core/core.d.cts +153 -0
  33. package/dist/types-cjs/core/dev.d.cts +49 -0
  34. package/dist/types-cjs/core/effect.d.cts +31 -0
  35. package/dist/types-cjs/core/error.d.cts +38 -0
  36. package/dist/types-cjs/core/external.d.cts +45 -0
  37. package/dist/types-cjs/core/graph.d.cts +4 -0
  38. package/dist/types-cjs/core/heap.d.cts +14 -0
  39. package/dist/types-cjs/core/index.d.cts +12 -0
  40. package/dist/types-cjs/core/lanes.d.cts +54 -0
  41. package/dist/types-cjs/core/owner.d.cts +116 -0
  42. package/dist/types-cjs/core/scheduler.d.cts +106 -0
  43. package/dist/types-cjs/core/types.d.cts +83 -0
  44. package/dist/types-cjs/index.d.cts +9 -0
  45. package/dist/types-cjs/map.d.cts +53 -0
  46. package/dist/types-cjs/package.json +3 -0
  47. package/dist/types-cjs/signals.d.cts +491 -0
  48. package/dist/types-cjs/store/index.d.cts +9 -0
  49. package/dist/types-cjs/store/optimistic.d.cts +45 -0
  50. package/dist/types-cjs/store/projection.d.cts +66 -0
  51. package/dist/types-cjs/store/reconcile.d.cts +23 -0
  52. package/dist/types-cjs/store/store.d.cts +125 -0
  53. package/dist/types-cjs/store/storePath.d.cts +58 -0
  54. package/dist/types-cjs/store/utils.d.cts +114 -0
  55. package/package.json +32 -24
package/dist/prod.js CHANGED
@@ -33,6 +33,12 @@ const REACTIVE_DISPOSED = 1 << 6;
33
33
  const REACTIVE_OPTIMISTIC_DIRTY = 1 << 7;
34
34
  const REACTIVE_SNAPSHOT_STALE = 1 << 8;
35
35
  const REACTIVE_LAZY = 1 << 9;
36
+ const CONFIG_OWNED_WRITE = 1 << 0;
37
+ const CONFIG_NO_SNAPSHOT = 1 << 1;
38
+ const CONFIG_TRANSPARENT = 1 << 2;
39
+ const CONFIG_IN_SNAPSHOT_SCOPE = 1 << 3;
40
+ const CONFIG_CHILDREN_FORBIDDEN = 1 << 4;
41
+ const CONFIG_AUTO_DISPOSE = 1 << 5;
36
42
  const STATUS_PENDING = 1 << 0;
37
43
  const STATUS_ERROR = 1 << 1;
38
44
  const STATUS_UNINITIALIZED = 1 << 2;
@@ -57,26 +63,26 @@ function actualInsertIntoHeap(e, t) {
57
63
  e.T = t;
58
64
  r.T = e;
59
65
  }
60
- if (i > t.R) t.R = i;
66
+ if (i > t.O) t.O = i;
61
67
  }
62
68
  function insertIntoHeap(e, t) {
63
- let n = e.O;
69
+ let n = e.R;
64
70
  if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS)) return;
65
71
  if (n & REACTIVE_CHECK) {
66
- e.O = (n & -4) | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
67
- } else e.O = n | REACTIVE_IN_HEAP;
72
+ e.R = (n & -4) | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
73
+ } else e.R = n | REACTIVE_IN_HEAP;
68
74
  if (!(n & REACTIVE_IN_HEAP_HEIGHT)) actualInsertIntoHeap(e, t);
69
75
  }
70
76
  function insertIntoHeapHeight(e, t) {
71
- let n = e.O;
77
+ let n = e.R;
72
78
  if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_IN_HEAP_HEIGHT)) return;
73
- e.O = n | REACTIVE_IN_HEAP_HEIGHT;
79
+ e.R = n | REACTIVE_IN_HEAP_HEIGHT;
74
80
  actualInsertIntoHeap(e, t);
75
81
  }
76
82
  function deleteFromHeap(e, t) {
77
- const n = e.O;
83
+ const n = e.R;
78
84
  if (!(n & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT))) return;
79
- e.O = n & -25;
85
+ e.R = n & -25;
80
86
  const i = e.o;
81
87
  if (e.T === e) t.l[i] = undefined;
82
88
  else {
@@ -93,21 +99,21 @@ function deleteFromHeap(e, t) {
93
99
  function markHeap(e) {
94
100
  if (e._) return;
95
101
  e._ = true;
96
- for (let t = 0; t <= e.R; t++) {
102
+ for (let t = 0; t <= e.O; t++) {
97
103
  for (let n = e.l[t]; n !== undefined; n = n.S) {
98
- if (n.O & REACTIVE_IN_HEAP) markNode(n);
104
+ if (n.R & REACTIVE_IN_HEAP) markNode(n);
99
105
  }
100
106
  }
101
107
  }
102
108
  function markNode(e, t = REACTIVE_DIRTY) {
103
- const n = e.O;
109
+ const n = e.R;
104
110
  if ((n & (REACTIVE_CHECK | REACTIVE_DIRTY)) >= t) return;
105
- e.O = (n & -4) | t;
111
+ e.R = (n & -4) | t;
106
112
  for (let t = e.I; t !== null; t = t.h) {
107
113
  markNode(t.p, REACTIVE_CHECK);
108
114
  }
109
- if (e.A !== null) {
110
- for (let t = e.A; t !== null; t = t.N) {
115
+ if (e.N !== null) {
116
+ for (let t = e.N; t !== null; t = t.A) {
111
117
  for (let e = t.I; e !== null; e = e.h) {
112
118
  markNode(e.p, REACTIVE_CHECK);
113
119
  }
@@ -116,15 +122,15 @@ function markNode(e, t = REACTIVE_DIRTY) {
116
122
  }
117
123
  function runHeap(e, t) {
118
124
  e._ = false;
119
- for (e.P = 0; e.P <= e.R; e.P++) {
125
+ for (e.P = 0; e.P <= e.O; e.P++) {
120
126
  let n = e.l[e.P];
121
127
  while (n !== undefined) {
122
- if (n.O & REACTIVE_IN_HEAP) t(n);
128
+ if (n.R & REACTIVE_IN_HEAP) t(n);
123
129
  else adjustHeight(n, e);
124
130
  n = e.l[e.P];
125
131
  }
126
132
  }
127
- e.R = 0;
133
+ e.O = 0;
128
134
  }
129
135
  function adjustHeight(e, t) {
130
136
  deleteFromHeap(e, t);
@@ -143,23 +149,40 @@ function adjustHeight(e, t) {
143
149
  }
144
150
  const DEV$1 = undefined;
145
151
  const transitions = new Set();
146
- const dirtyQueue = { l: new Array(2e3).fill(undefined), _: false, P: 0, R: 0 };
147
- const zombieQueue = { l: new Array(2e3).fill(undefined), _: false, P: 0, R: 0 };
152
+ const dirtyQueue = { l: new Array(2e3).fill(undefined), _: false, P: 0, O: 0 };
153
+ const zombieQueue = { l: new Array(2e3).fill(undefined), _: false, P: 0, O: 0 };
148
154
  let clock = 0;
149
155
  let activeTransition = null;
150
156
  let scheduled = false;
151
157
  let projectionWriteActive = false;
152
158
  let stashedOptimisticReads = null;
159
+ const transientStoreNodes = new Set();
160
+ function registerTransientStoreNode(e) {
161
+ transientStoreNodes.add(e);
162
+ }
163
+ function sweepTransientStoreNodes() {
164
+ if (transientStoreNodes.size === 0) return;
165
+ for (const e of transientStoreNodes) {
166
+ if (e.I !== null) {
167
+ transientStoreNodes.delete(e);
168
+ continue;
169
+ }
170
+ if (e.U !== NOT_PENDING) continue;
171
+ if (e.G !== undefined && e.G !== NOT_PENDING) continue;
172
+ transientStoreNodes.delete(e);
173
+ e.k?.();
174
+ }
175
+ }
153
176
  function enforceLoadingBoundary(e) {}
154
177
  function shouldReadStashedOptimisticValue(e) {
155
178
  return !!stashedOptimisticReads?.has(e);
156
179
  }
157
180
  function runLaneEffects(e) {
158
181
  for (const t of activeLanes) {
159
- if (t.U || t.k.size > 0) continue;
160
- const n = t.G[e - 1];
182
+ if (t.F || t.W.size > 0) continue;
183
+ const n = t.H[e - 1];
161
184
  if (n.length) {
162
- t.G[e - 1] = [];
185
+ t.H[e - 1] = [];
163
186
  runQueue(n, e);
164
187
  }
165
188
  }
@@ -167,15 +190,15 @@ function runLaneEffects(e) {
167
190
  function queueStashedOptimisticEffects(e) {
168
191
  for (let t = e.I; t !== null; t = t.h) {
169
192
  const e = t.p;
170
- if (!e.W) continue;
171
- if (e.W === EFFECT_TRACKED) {
172
- if (!e.H) {
173
- e.H = true;
174
- e.F.enqueue(EFFECT_USER, e.M);
193
+ if (!e.M) continue;
194
+ if (e.M === EFFECT_TRACKED) {
195
+ if (!e.j) {
196
+ e.j = true;
197
+ e.$.enqueue(EFFECT_USER, e.K);
175
198
  }
176
199
  continue;
177
200
  }
178
- const n = e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
201
+ const n = e.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
179
202
  if (n.P > e.o) n.P = e.o;
180
203
  insertIntoHeap(e, n);
181
204
  }
@@ -184,66 +207,67 @@ function setProjectionWriteActive(e) {
184
207
  projectionWriteActive = e;
185
208
  }
186
209
  function mergeTransitionState(e, t) {
187
- t.j = e;
188
- e.$.push(...t.$);
189
- for (const n of activeLanes) if (n.K === t) n.K = e;
190
- e.Y.push(...t.Y);
191
- for (const n of t.Z) e.Z.add(n);
192
- for (const [n, i] of t.B) {
193
- let t = e.B.get(n);
194
- if (!t) e.B.set(n, (t = new Set()));
210
+ t.Y = e;
211
+ e.B.push(...t.B);
212
+ for (const n of activeLanes) if (n.Z === t) n.Z = e;
213
+ e.q.push(...t.q);
214
+ for (const n of t.X) e.X.add(n);
215
+ for (const [n, i] of t.J) {
216
+ let t = e.J.get(n);
217
+ if (!t) e.J.set(n, (t = new Set()));
195
218
  for (const e of i) t.add(e);
196
219
  }
220
+ for (const n of t.ee) e.ee.add(n);
197
221
  }
198
222
  function resolveOptimisticNodes(e) {
199
223
  for (let t = 0; t < e.length; t++) {
200
224
  const n = e[t];
201
- n.q = undefined;
202
- if (n.X !== NOT_PENDING) {
203
- n.J = n.X;
204
- n.X = NOT_PENDING;
225
+ n.te = undefined;
226
+ if (n.U !== NOT_PENDING) {
227
+ n.ne = n.U;
228
+ n.U = NOT_PENDING;
205
229
  }
206
- const i = n.ee;
207
- n.ee = NOT_PENDING;
208
- if (i !== NOT_PENDING && n.J !== i) insertSubs(n, true);
209
- n.K = null;
230
+ const i = n.G;
231
+ n.G = NOT_PENDING;
232
+ if (i !== NOT_PENDING && n.ne !== i) insertSubs(n, true);
233
+ n.Z = null;
210
234
  }
211
235
  e.length = 0;
212
236
  }
213
237
  function cleanupCompletedLanes(e) {
214
238
  for (const t of activeLanes) {
215
- const n = e ? t.K === e : !t.K;
239
+ const n = e ? t.Z === e : !t.Z;
216
240
  if (!n) continue;
217
- if (!t.U) {
218
- if (t.G[0].length) runQueue(t.G[0], EFFECT_RENDER);
219
- if (t.G[1].length) runQueue(t.G[1], EFFECT_USER);
220
- }
221
- if (t.te.q === t) t.te.q = undefined;
222
- t.k.clear();
223
- t.G[0].length = 0;
224
- t.G[1].length = 0;
241
+ if (!t.F) {
242
+ if (t.H[0].length) runQueue(t.H[0], EFFECT_RENDER);
243
+ if (t.H[1].length) runQueue(t.H[1], EFFECT_USER);
244
+ }
245
+ if (t.ie.te === t) t.ie.te = undefined;
246
+ t.W.clear();
247
+ t.H[0].length = 0;
248
+ t.H[1].length = 0;
225
249
  activeLanes.delete(t);
226
- signalLanes.delete(t.te);
250
+ signalLanes.delete(t.ie);
227
251
  }
228
252
  }
229
253
  function schedule() {
230
254
  if (scheduled) return;
231
255
  scheduled = true;
232
- if (!globalQueue.ne && !projectionWriteActive) queueMicrotask(flush);
256
+ if (!globalQueue.re && !projectionWriteActive) queueMicrotask(flush);
233
257
  }
234
258
  class Queue {
235
259
  i = null;
236
- ie = [[], []];
237
- re = [];
260
+ se = [[], []];
261
+ oe = [];
238
262
  created = clock;
239
263
  addChild(e) {
240
- this.re.push(e);
264
+ this.oe.push(e);
241
265
  e.i = this;
242
266
  }
243
267
  removeChild(e) {
244
- const t = this.re.indexOf(e);
268
+ const t = this.oe.indexOf(e);
245
269
  if (t >= 0) {
246
- this.re.splice(t, 1);
270
+ this.oe.splice(t, 1);
247
271
  e.i = null;
248
272
  }
249
273
  }
@@ -252,81 +276,81 @@ class Queue {
252
276
  return false;
253
277
  }
254
278
  run(e) {
255
- if (this.ie[e - 1].length) {
256
- const t = this.ie[e - 1];
257
- this.ie[e - 1] = [];
279
+ if (this.se[e - 1].length) {
280
+ const t = this.se[e - 1];
281
+ this.se[e - 1] = [];
258
282
  runQueue(t, e);
259
283
  }
260
- for (let t = 0; t < this.re.length; t++) this.re[t].run?.(e);
284
+ for (let t = 0; t < this.oe.length; t++) this.oe[t].run?.(e);
261
285
  }
262
286
  enqueue(e, t) {
263
287
  if (e) {
264
288
  if (currentOptimisticLane) {
265
289
  const n = findLane(currentOptimisticLane);
266
- n.G[e - 1].push(t);
290
+ n.H[e - 1].push(t);
267
291
  } else {
268
- this.ie[e - 1].push(t);
292
+ this.se[e - 1].push(t);
269
293
  }
270
294
  }
271
295
  schedule();
272
296
  }
273
297
  stashQueues(e) {
274
- e.ie[0].push(...this.ie[0]);
275
- e.ie[1].push(...this.ie[1]);
276
- this.ie = [[], []];
277
- for (let t = 0; t < this.re.length; t++) {
278
- let n = this.re[t];
279
- let i = e.re[t];
298
+ e.se[0].push(...this.se[0]);
299
+ e.se[1].push(...this.se[1]);
300
+ this.se = [[], []];
301
+ for (let t = 0; t < this.oe.length; t++) {
302
+ let n = this.oe[t];
303
+ let i = e.oe[t];
280
304
  if (!i) {
281
- i = { ie: [[], []], re: [] };
282
- e.re[t] = i;
305
+ i = { se: [[], []], oe: [] };
306
+ e.oe[t] = i;
283
307
  }
284
308
  n.stashQueues(i);
285
309
  }
286
310
  }
287
311
  restoreQueues(e) {
288
- this.ie[0].push(...e.ie[0]);
289
- this.ie[1].push(...e.ie[1]);
290
- for (let t = 0; t < e.re.length; t++) {
291
- const n = e.re[t];
292
- let i = this.re[t];
312
+ this.se[0].push(...e.se[0]);
313
+ this.se[1].push(...e.se[1]);
314
+ for (let t = 0; t < e.oe.length; t++) {
315
+ const n = e.oe[t];
316
+ let i = this.oe[t];
293
317
  if (i) i.restoreQueues(n);
294
318
  }
295
319
  }
296
320
  }
297
321
  class GlobalQueue extends Queue {
298
- ne = false;
299
- se = [];
300
- Y = [];
301
- Z = new Set();
302
- static oe;
303
- static ue;
304
- static ce = null;
322
+ re = false;
323
+ ue = [];
324
+ q = [];
325
+ X = new Set();
326
+ static ce;
327
+ static ae;
328
+ static le = null;
305
329
  flush() {
306
- if (this.ne) return;
307
- this.ne = true;
330
+ if (this.re) return;
331
+ this.re = true;
308
332
  try {
309
- runHeap(dirtyQueue, GlobalQueue.oe);
333
+ runHeap(dirtyQueue, GlobalQueue.ce);
310
334
  if (activeTransition) {
311
335
  const e = transitionComplete(activeTransition);
312
336
  if (!e) {
313
337
  const e = activeTransition;
314
- runHeap(zombieQueue, GlobalQueue.oe);
315
- this.se = [];
316
- this.Y = [];
317
- this.Z = new Set();
338
+ runHeap(zombieQueue, GlobalQueue.ce);
339
+ this.ue = [];
340
+ this.q = [];
341
+ this.X = new Set();
318
342
  runLaneEffects(EFFECT_RENDER);
319
343
  runLaneEffects(EFFECT_USER);
320
- this.stashQueues(e.ae);
344
+ this.stashQueues(e.fe);
321
345
  clock++;
322
- scheduled = dirtyQueue.R >= dirtyQueue.P;
323
- reassignPendingTransition(e.se);
346
+ scheduled = dirtyQueue.O >= dirtyQueue.P;
347
+ reassignPendingTransition(e.ue);
324
348
  activeTransition = null;
325
- if (!e.$.length && e.Y.length) {
349
+ if (!e.B.length && !e.J.size && e.q.length) {
326
350
  stashedOptimisticReads = new Set();
327
- for (let t = 0; t < e.Y.length; t++) {
328
- const n = e.Y[t];
329
- if (n.L || n.le) continue;
351
+ for (let t = 0; t < e.q.length; t++) {
352
+ const n = e.q[t];
353
+ if (n.L || n.Ee & CONFIG_OWNED_WRITE) continue;
330
354
  stashedOptimisticReads.add(n);
331
355
  queueStashedOptimisticEffects(n);
332
356
  }
@@ -338,36 +362,36 @@ class GlobalQueue extends Queue {
338
362
  }
339
363
  return;
340
364
  }
341
- this.se !== activeTransition.se && this.se.push(...activeTransition.se);
342
- this.restoreQueues(activeTransition.ae);
365
+ this.ue !== activeTransition.ue && this.ue.push(...activeTransition.ue);
366
+ this.restoreQueues(activeTransition.fe);
343
367
  transitions.delete(activeTransition);
344
368
  const t = activeTransition;
345
369
  activeTransition = null;
346
- reassignPendingTransition(this.se);
370
+ reassignPendingTransition(this.ue);
347
371
  finalizePureQueue(t);
348
372
  } else {
349
- if (transitions.size) runHeap(zombieQueue, GlobalQueue.oe);
373
+ if (transitions.size) runHeap(zombieQueue, GlobalQueue.ce);
350
374
  finalizePureQueue();
351
375
  }
352
376
  clock++;
353
- scheduled = dirtyQueue.R >= dirtyQueue.P;
377
+ scheduled = dirtyQueue.O >= dirtyQueue.P;
354
378
  runLaneEffects(EFFECT_RENDER);
355
379
  this.run(EFFECT_RENDER);
356
380
  runLaneEffects(EFFECT_USER);
357
381
  this.run(EFFECT_USER);
358
382
  if (false);
359
383
  } finally {
360
- this.ne = false;
384
+ this.re = false;
361
385
  }
362
386
  }
363
387
  notify(e, t, n, i) {
364
388
  if (t & STATUS_PENDING) {
365
389
  if (n & STATUS_PENDING) {
366
- const t = i !== undefined ? i : e.fe;
390
+ const t = i !== undefined ? i : e.Te;
367
391
  if (activeTransition && t) {
368
392
  const n = t.source;
369
- let i = activeTransition.B.get(n);
370
- if (!i) activeTransition.B.set(n, (i = new Set()));
393
+ let i = activeTransition.J.get(n);
394
+ if (!i) activeTransition.J.set(n, (i = new Set()));
371
395
  const r = i.size;
372
396
  i.add(e);
373
397
  if (i.size !== r) schedule();
@@ -380,17 +404,18 @@ class GlobalQueue extends Queue {
380
404
  initTransition(e) {
381
405
  if (e) e = currentTransition(e);
382
406
  if (e && e === activeTransition) return;
383
- if (!e && activeTransition && activeTransition.Ee === clock) return;
407
+ if (!e && activeTransition && activeTransition.Se === clock) return;
384
408
  if (!activeTransition) {
385
409
  activeTransition = e ?? {
386
- Ee: clock,
387
- se: [],
388
- B: new Map(),
389
- Y: [],
390
- Z: new Set(),
391
- $: [],
392
- ae: { ie: [[], []], re: [] },
393
- j: false
410
+ Se: clock,
411
+ ue: [],
412
+ J: new Map(),
413
+ q: [],
414
+ X: new Set(),
415
+ B: [],
416
+ fe: { se: [[], []], oe: [] },
417
+ Y: false,
418
+ ee: new Set()
394
419
  };
395
420
  } else if (e) {
396
421
  const t = activeTransition;
@@ -399,71 +424,71 @@ class GlobalQueue extends Queue {
399
424
  activeTransition = e;
400
425
  }
401
426
  transitions.add(activeTransition);
402
- activeTransition.Ee = clock;
403
- if (this.se !== activeTransition.se) {
404
- for (let e = 0; e < this.se.length; e++) {
405
- const t = this.se[e];
406
- t.K = activeTransition;
407
- activeTransition.se.push(t);
427
+ activeTransition.Se = clock;
428
+ if (this.ue !== activeTransition.ue) {
429
+ for (let e = 0; e < this.ue.length; e++) {
430
+ const t = this.ue[e];
431
+ t.Z = activeTransition;
432
+ activeTransition.ue.push(t);
408
433
  }
409
- this.se = activeTransition.se;
434
+ this.ue = activeTransition.ue;
410
435
  }
411
- if (this.Y !== activeTransition.Y) {
412
- for (let e = 0; e < this.Y.length; e++) {
413
- const t = this.Y[e];
414
- t.K = activeTransition;
415
- activeTransition.Y.push(t);
436
+ if (this.q !== activeTransition.q) {
437
+ for (let e = 0; e < this.q.length; e++) {
438
+ const t = this.q[e];
439
+ t.Z = activeTransition;
440
+ activeTransition.q.push(t);
416
441
  }
417
- this.Y = activeTransition.Y;
442
+ this.q = activeTransition.q;
418
443
  }
419
444
  for (const e of activeLanes) {
420
- if (!e.K) e.K = activeTransition;
445
+ if (!e.Z) e.Z = activeTransition;
421
446
  }
422
- if (this.Z !== activeTransition.Z) {
423
- for (const e of this.Z) activeTransition.Z.add(e);
424
- this.Z = activeTransition.Z;
447
+ if (this.X !== activeTransition.X) {
448
+ for (const e of this.X) activeTransition.X.add(e);
449
+ this.X = activeTransition.X;
425
450
  }
426
451
  }
427
452
  }
428
453
  function insertSubs(e, t = false) {
429
- const n = e.q || currentOptimisticLane;
454
+ const n = e.te || currentOptimisticLane;
430
455
  const i = e.de !== undefined;
431
456
  for (let r = e.I; r !== null; r = r.h) {
432
- if (i && r.p.Te) {
433
- r.p.O |= REACTIVE_SNAPSHOT_STALE;
457
+ if (i && r.p.Ee & CONFIG_IN_SNAPSHOT_SCOPE) {
458
+ r.p.R |= REACTIVE_SNAPSHOT_STALE;
434
459
  continue;
435
460
  }
436
461
  if (t && n) {
437
- r.p.O |= REACTIVE_OPTIMISTIC_DIRTY;
462
+ r.p.R |= REACTIVE_OPTIMISTIC_DIRTY;
438
463
  assignOrMergeLane(r.p, n);
439
464
  } else if (t) {
440
- r.p.O |= REACTIVE_OPTIMISTIC_DIRTY;
441
- r.p.q = undefined;
465
+ r.p.R |= REACTIVE_OPTIMISTIC_DIRTY;
466
+ r.p.te = undefined;
442
467
  }
443
468
  const e = r.p;
444
- if (e.W === EFFECT_TRACKED) {
445
- if (!e.H) {
446
- e.H = true;
447
- e.F.enqueue(EFFECT_USER, e.M);
469
+ if (e.M === EFFECT_TRACKED) {
470
+ if (!e.j) {
471
+ e.j = true;
472
+ e.$.enqueue(EFFECT_USER, e.K);
448
473
  }
449
474
  continue;
450
475
  }
451
- const s = r.p.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
476
+ const s = r.p.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
452
477
  if (s.P > r.p.o) s.P = r.p.o;
453
478
  insertIntoHeap(r.p, s);
454
479
  }
455
480
  }
456
481
  function commitPendingNodes() {
457
- const e = globalQueue.se;
482
+ const e = globalQueue.ue;
458
483
  for (let t = 0; t < e.length; t++) {
459
484
  const n = e[t];
460
- if (n.X !== NOT_PENDING) {
461
- n.J = n.X;
462
- n.X = NOT_PENDING;
463
- if (n.W && n.W !== EFFECT_TRACKED) n.H = true;
485
+ if (n.U !== NOT_PENDING) {
486
+ n.ne = n.U;
487
+ n.U = NOT_PENDING;
488
+ if (n.M && n.M !== EFFECT_TRACKED) n.j = true;
464
489
  }
465
- if (!(n.Se & STATUS_PENDING)) n.Se &= ~STATUS_UNINITIALIZED;
466
- if (n.L) GlobalQueue.ue(n, false, true);
490
+ if (!(n.Oe & STATUS_PENDING)) n.Oe &= ~STATUS_UNINITIALIZED;
491
+ if (n.L) GlobalQueue.ae(n, false, true);
467
492
  }
468
493
  e.length = 0;
469
494
  }
@@ -471,39 +496,56 @@ function finalizePureQueue(e = null, t = false) {
471
496
  const n = !t;
472
497
  if (n) commitPendingNodes();
473
498
  if (!t) checkBoundaryChildren(globalQueue);
474
- if (dirtyQueue.R >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.oe);
499
+ if (dirtyQueue.O >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.ce);
475
500
  if (n) {
476
501
  commitPendingNodes();
477
- resolveOptimisticNodes(e ? e.Y : globalQueue.Y);
478
- const t = e ? e.Z : globalQueue.Z;
479
- if (GlobalQueue.ce && t.size) {
502
+ resolveOptimisticNodes(e ? e.q : globalQueue.q);
503
+ if (e && e.ee.size) {
504
+ for (const t of e.ee) {
505
+ if (t.R & REACTIVE_DISPOSED) continue;
506
+ if (t.M === EFFECT_TRACKED) {
507
+ if (!t.j) {
508
+ t.j = true;
509
+ t.$.enqueue(EFFECT_USER, t.K);
510
+ }
511
+ continue;
512
+ }
513
+ const e = t.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
514
+ if (e.P > t.o) e.P = t.o;
515
+ insertIntoHeap(t, e);
516
+ }
517
+ e.ee.clear();
518
+ }
519
+ const t = e ? e.X : globalQueue.X;
520
+ if (GlobalQueue.le && t.size) {
480
521
  for (const e of t) {
481
- GlobalQueue.ce(e);
522
+ GlobalQueue.le(e);
482
523
  }
483
524
  t.clear();
484
525
  schedule();
485
526
  }
527
+ sweepTransientStoreNodes();
486
528
  cleanupCompletedLanes(e);
487
529
  }
488
530
  }
489
531
  function checkBoundaryChildren(e) {
490
- for (const t of e.re) {
532
+ for (const t of e.oe) {
491
533
  t.checkSources?.();
492
534
  checkBoundaryChildren(t);
493
535
  }
494
536
  }
495
537
  function trackOptimisticStore(e) {
496
- globalQueue.Z.add(e);
538
+ globalQueue.X.add(e);
497
539
  schedule();
498
540
  }
499
541
  function reassignPendingTransition(e) {
500
542
  for (let t = 0; t < e.length; t++) {
501
- e[t].K = activeTransition;
543
+ e[t].Z = activeTransition;
502
544
  }
503
545
  }
504
546
  const globalQueue = new GlobalQueue();
505
547
  function flush() {
506
- if (globalQueue.ne) {
548
+ if (globalQueue.re) {
507
549
  return;
508
550
  }
509
551
  while (scheduled || activeTransition) {
@@ -514,22 +556,22 @@ function runQueue(e, t) {
514
556
  for (let n = 0; n < e.length; n++) e[n](t);
515
557
  }
516
558
  function reporterBlocksSource(e, t) {
517
- if (e.O & (REACTIVE_ZOMBIE | REACTIVE_DISPOSED)) return false;
518
- if (e.Re === t || e.Oe?.has(t)) return true;
559
+ if (e.R & (REACTIVE_ZOMBIE | REACTIVE_DISPOSED)) return false;
560
+ if (e.Re === t || e._e?.has(t)) return true;
519
561
  for (let n = e.C; n; n = n.D) {
520
562
  let e = n.m;
521
563
  while (e) {
522
564
  if (e === t || e.V === t) return true;
523
- e = e._e;
565
+ e = e.Ie;
524
566
  }
525
567
  }
526
- return !!(e.Se & STATUS_PENDING && e.fe instanceof NotReadyError && e.fe.source === t);
568
+ return !!(e.Oe & STATUS_PENDING && e.Te instanceof NotReadyError && e.Te.source === t);
527
569
  }
528
570
  function transitionComplete(e) {
529
- if (e.j) return true;
530
- if (e.$.length) return false;
571
+ if (e.Y) return true;
572
+ if (e.B.length) return false;
531
573
  let t = true;
532
- for (const [n, i] of e.B) {
574
+ for (const [n, i] of e.J) {
533
575
  let r = false;
534
576
  for (const e of i) {
535
577
  if (reporterBlocksSource(e, n)) {
@@ -538,32 +580,32 @@ function transitionComplete(e) {
538
580
  }
539
581
  i.delete(e);
540
582
  }
541
- if (!r) e.B.delete(n);
542
- else if (n.Se & STATUS_PENDING && n.fe?.source === n) {
583
+ if (!r) e.J.delete(n);
584
+ else if (n.Oe & STATUS_PENDING && n.Te?.source === n) {
543
585
  t = false;
544
586
  break;
545
587
  }
546
588
  }
547
589
  if (t) {
548
- for (let n = 0; n < e.Y.length; n++) {
549
- const i = e.Y[n];
590
+ for (let n = 0; n < e.q.length; n++) {
591
+ const i = e.q[n];
550
592
  if (
551
593
  hasActiveOverride(i) &&
552
- "Se" in i &&
553
- i.Se & STATUS_PENDING &&
554
- i.fe instanceof NotReadyError &&
555
- i.fe.source !== i
594
+ "Oe" in i &&
595
+ i.Oe & STATUS_PENDING &&
596
+ i.Te instanceof NotReadyError &&
597
+ i.Te.source !== i
556
598
  ) {
557
599
  t = false;
558
600
  break;
559
601
  }
560
602
  }
561
603
  }
562
- t && (e.j = true);
604
+ t && (e.Y = true);
563
605
  return t;
564
606
  }
565
607
  function currentTransition(e) {
566
- while (e.j && typeof e.j === "object") e = e.j;
608
+ while (e.Y && typeof e.Y === "object") e = e.Y;
567
609
  return e;
568
610
  }
569
611
  function setActiveTransition(e) {
@@ -585,111 +627,113 @@ function getOrCreateLane(e) {
585
627
  if (t) {
586
628
  return findLane(t);
587
629
  }
588
- const n = e._e;
589
- const i = n?.q ? findLane(n.q) : null;
590
- t = { te: e, k: new Set(), G: [[], []], U: null, K: activeTransition, Ie: i };
630
+ const n = e.Ie;
631
+ const i = n?.te ? findLane(n.te) : null;
632
+ t = { ie: e, W: new Set(), H: [[], []], F: null, Z: activeTransition, he: i };
591
633
  signalLanes.set(e, t);
592
634
  activeLanes.add(t);
593
- e.he = false;
635
+ e.pe = false;
594
636
  return t;
595
637
  }
596
638
  function findLane(e) {
597
- while (e.U) e = e.U;
639
+ while (e.F) e = e.F;
598
640
  return e;
599
641
  }
600
642
  function mergeLanes(e, t) {
601
643
  e = findLane(e);
602
644
  t = findLane(t);
603
645
  if (e === t) return e;
604
- t.U = e;
605
- for (const n of t.k) e.k.add(n);
606
- e.G[0].push(...t.G[0]);
607
- e.G[1].push(...t.G[1]);
646
+ t.F = e;
647
+ for (const n of t.W) e.W.add(n);
648
+ e.H[0].push(...t.H[0]);
649
+ e.H[1].push(...t.H[1]);
608
650
  return e;
609
651
  }
610
652
  function resolveLane(e) {
611
- const t = e.q;
653
+ const t = e.te;
612
654
  if (!t) return undefined;
613
655
  const n = findLane(t);
614
656
  if (activeLanes.has(n)) return n;
615
- e.q = undefined;
657
+ e.te = undefined;
616
658
  return undefined;
617
659
  }
618
660
  function resolveTransition(e) {
619
- return resolveLane(e)?.K ?? e.K;
661
+ return resolveLane(e)?.Z ?? e.Z;
620
662
  }
621
663
  function hasActiveOverride(e) {
622
- return !!(e.ee !== undefined && e.ee !== NOT_PENDING);
664
+ return !!(e.G !== undefined && e.G !== NOT_PENDING);
623
665
  }
624
666
  function assignOrMergeLane(e, t) {
625
667
  const n = findLane(t);
626
- const i = e.q;
668
+ const i = e.te;
627
669
  if (i) {
628
- if (i.U) {
629
- e.q = t;
670
+ if (i.F) {
671
+ e.te = t;
630
672
  return;
631
673
  }
632
674
  const r = findLane(i);
633
675
  if (activeLanes.has(r)) {
634
676
  if (r !== n && !hasActiveOverride(e)) {
635
- if (n.Ie && findLane(n.Ie) === r) {
636
- e.q = t;
637
- } else if (r.Ie && findLane(r.Ie) === n);
677
+ if (n.he && findLane(n.he) === r) {
678
+ e.te = t;
679
+ } else if (r.he && findLane(r.he) === n);
638
680
  else mergeLanes(n, r);
639
681
  }
640
682
  return;
641
683
  }
642
684
  }
643
- e.q = t;
685
+ e.te = t;
644
686
  }
645
687
  function unlinkSubs(e) {
646
688
  const t = e.m;
647
689
  const n = e.D;
648
690
  const i = e.h;
649
- const r = e.pe;
650
- if (i !== null) i.pe = r;
691
+ const r = e.Ne;
692
+ if (i !== null) i.Ne = r;
651
693
  else t.Ae = r;
652
694
  if (r !== null) r.h = i;
653
695
  else {
654
696
  t.I = i;
655
697
  if (i === null) {
656
- t.Ne?.();
657
- t.L && !t.Pe && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
698
+ t.k?.();
699
+ const e = t;
700
+ e.L && e.Ee & CONFIG_AUTO_DISPOSE && !(e.R & REACTIVE_ZOMBIE) && unobserved(e);
658
701
  }
659
702
  }
660
703
  return n;
661
704
  }
662
705
  function unobserved(e) {
663
- deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
706
+ deleteFromHeap(e, e.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
664
707
  let t = e.C;
665
708
  while (t !== null) {
666
709
  t = unlinkSubs(t);
667
710
  }
668
711
  e.C = null;
712
+ e.Pe = null;
669
713
  disposeChildren(e, true);
670
714
  }
671
715
  function link(e, t) {
672
- const n = t.ge;
716
+ const n = t.Pe;
673
717
  if (n !== null && n.m === e) return;
674
718
  let i = null;
675
- const r = t.O & REACTIVE_RECOMPUTING_DEPS;
719
+ const r = t.R & REACTIVE_RECOMPUTING_DEPS;
676
720
  if (r) {
677
721
  i = n !== null ? n.D : t.C;
678
722
  if (i !== null && i.m === e) {
679
- t.ge = i;
723
+ t.Pe = i;
680
724
  return;
681
725
  }
682
726
  }
683
727
  const s = e.Ae;
684
728
  if (s !== null && s.p === t && (!r || isValidLink(s, t))) return;
685
- const o = (t.ge = e.Ae = { m: e, p: t, D: i, pe: s, h: null });
729
+ const o = (t.Pe = e.Ae = { m: e, p: t, D: i, Ne: s, h: null });
686
730
  if (n !== null) n.D = o;
687
731
  else t.C = o;
688
732
  if (s !== null) s.h = o;
689
733
  else e.I = o;
690
734
  }
691
735
  function isValidLink(e, t) {
692
- const n = t.ge;
736
+ const n = t.Pe;
693
737
  if (n !== null) {
694
738
  let i = t.C;
695
739
  do {
@@ -704,13 +748,13 @@ const PENDING_OWNER = {};
704
748
  function markDisposal(e) {
705
749
  let t = e.Ce;
706
750
  while (t) {
707
- t.O |= REACTIVE_ZOMBIE;
708
- if (t.O & REACTIVE_IN_HEAP) {
751
+ t.R |= REACTIVE_ZOMBIE;
752
+ if (t.R & REACTIVE_IN_HEAP) {
709
753
  deleteFromHeap(t, dirtyQueue);
710
754
  insertIntoHeap(t, zombieQueue);
711
755
  }
712
756
  markDisposal(t);
713
- t = t.De;
757
+ t = t.ge;
714
758
  }
715
759
  }
716
760
  function dispose(e) {
@@ -719,39 +763,39 @@ function dispose(e) {
719
763
  t = unlinkSubs(t);
720
764
  } while (t !== null);
721
765
  e.C = null;
722
- e.ge = null;
766
+ e.Pe = null;
723
767
  disposeChildren(e, true);
724
768
  }
725
769
  function disposeChildren(e, t = false, n) {
726
- if (e.O & REACTIVE_DISPOSED) return;
727
- if (t) e.O = REACTIVE_DISPOSED;
728
- if (t && e.L) e.ye = null;
729
- let i = n ? e.ve : e.Ce;
770
+ if (e.R & REACTIVE_DISPOSED) return;
771
+ if (t) e.R = REACTIVE_DISPOSED;
772
+ if (t && e.L) e.De = null;
773
+ let i = n ? e.ye : e.Ce;
730
774
  while (i) {
731
- const e = i.De;
775
+ const e = i.ge;
732
776
  if (i.C) {
733
777
  const e = i;
734
- deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
778
+ deleteFromHeap(e, e.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
735
779
  let t = e.C;
736
780
  do {
737
781
  t = unlinkSubs(t);
738
782
  } while (t !== null);
739
783
  e.C = null;
740
- e.ge = null;
784
+ e.Pe = null;
741
785
  }
742
786
  disposeChildren(i, true);
743
787
  i = e;
744
788
  }
745
789
  if (n) {
746
- e.ve = null;
790
+ e.ye = null;
747
791
  } else {
748
792
  e.Ce = null;
749
- e.me = 0;
793
+ e.ve = 0;
750
794
  }
751
795
  runDisposal(e, n);
752
796
  }
753
797
  function runDisposal(e, t) {
754
- let n = t ? e.we : e.Ve;
798
+ let n = t ? e.me : e.we;
755
799
  if (!n) return;
756
800
  if (Array.isArray(n)) {
757
801
  for (let e = 0; e < n.length; e++) {
@@ -761,12 +805,12 @@ function runDisposal(e, t) {
761
805
  } else {
762
806
  n.call(n);
763
807
  }
764
- t ? (e.we = null) : (e.Ve = null);
808
+ t ? (e.me = null) : (e.we = null);
765
809
  }
766
810
  function childId(e, t) {
767
811
  let n = e;
768
- while (n.be && n.i) n = n.i;
769
- if (n.id != null) return formatId(n.id, t ? n.me++ : n.me);
812
+ while (n.Ee & CONFIG_TRANSPARENT && n.i) n = n.i;
813
+ if (n.id != null) return formatId(n.id, t ? n.ve++ : n.ve);
770
814
  throw new Error("Cannot get child id from owner without an id");
771
815
  }
772
816
  function getNextChildId(e) {
@@ -789,30 +833,30 @@ function getOwner() {
789
833
  }
790
834
  function cleanup(e) {
791
835
  if (!context) return e;
792
- if (!context.Ve) context.Ve = e;
793
- else if (Array.isArray(context.Ve)) context.Ve.push(e);
794
- else context.Ve = [context.Ve, e];
836
+ if (!context.we) context.we = e;
837
+ else if (Array.isArray(context.we)) context.we.push(e);
838
+ else context.we = [context.we, e];
795
839
  return e;
796
840
  }
797
841
  function isDisposed(e) {
798
- return !!(e.O & (REACTIVE_DISPOSED | REACTIVE_ZOMBIE));
842
+ return !!(e.R & (REACTIVE_DISPOSED | REACTIVE_ZOMBIE));
799
843
  }
800
844
  function createOwner(e) {
801
845
  const t = context;
802
846
  const n = e?.transparent ?? false;
803
847
  const i = {
804
848
  id: e?.id ?? (n ? t?.id : t?.id != null ? getNextChildId(t) : undefined),
805
- be: n || undefined,
849
+ Ee: n ? CONFIG_TRANSPARENT : 0,
806
850
  t: true,
807
851
  u: t?.t ? t.u : t,
808
852
  Ce: null,
809
- De: null,
810
- Ve: null,
811
- F: t?.F ?? globalQueue,
812
- Le: t?.Le || defaultContext,
813
- me: 0,
853
+ ge: null,
814
854
  we: null,
815
- ve: null,
855
+ $: t?.$ ?? globalQueue,
856
+ Ve: t?.Ve || defaultContext,
857
+ ve: 0,
858
+ me: null,
859
+ ye: null,
816
860
  i: t,
817
861
  dispose(e = true) {
818
862
  disposeChildren(i, e);
@@ -823,7 +867,7 @@ function createOwner(e) {
823
867
  if (e === null) {
824
868
  t.Ce = i;
825
869
  } else {
826
- i.De = e;
870
+ i.ge = e;
827
871
  t.Ce = i;
828
872
  }
829
873
  }
@@ -834,15 +878,15 @@ function createRoot(e, t) {
834
878
  return runWithOwner(n, () => e(n.dispose));
835
879
  }
836
880
  function addPendingSource(e, t) {
837
- if (e.Re === t || e.Oe?.has(t)) return false;
881
+ if (e.Re === t || e._e?.has(t)) return false;
838
882
  if (!e.Re) {
839
883
  e.Re = t;
840
884
  return true;
841
885
  }
842
- if (!e.Oe) {
843
- e.Oe = new Set([e.Re, t]);
886
+ if (!e._e) {
887
+ e._e = new Set([e.Re, t]);
844
888
  } else {
845
- e.Oe.add(t);
889
+ e._e.add(t);
846
890
  }
847
891
  e.Re = undefined;
848
892
  return true;
@@ -853,37 +897,37 @@ function removePendingSource(e, t) {
853
897
  e.Re = undefined;
854
898
  return true;
855
899
  }
856
- if (!e.Oe?.delete(t)) return false;
857
- if (e.Oe.size === 1) {
858
- e.Re = e.Oe.values().next().value;
859
- e.Oe = undefined;
860
- } else if (e.Oe.size === 0) {
861
- e.Oe = undefined;
900
+ if (!e._e?.delete(t)) return false;
901
+ if (e._e.size === 1) {
902
+ e.Re = e._e.values().next().value;
903
+ e._e = undefined;
904
+ } else if (e._e.size === 0) {
905
+ e._e = undefined;
862
906
  }
863
907
  return true;
864
908
  }
865
909
  function clearPendingSources(e) {
866
910
  e.Re = undefined;
867
- e.Oe?.clear();
868
- e.Oe = undefined;
911
+ e._e?.clear();
912
+ e._e = undefined;
869
913
  }
870
914
  function setPendingError(e, t, n) {
871
915
  if (!t) {
872
- e.fe = null;
916
+ e.Te = null;
873
917
  return;
874
918
  }
875
919
  if (n instanceof NotReadyError && n.source === t) {
876
- e.fe = n;
920
+ e.Te = n;
877
921
  return;
878
922
  }
879
- const i = e.fe;
923
+ const i = e.Te;
880
924
  if (!(i instanceof NotReadyError) || i.source !== t) {
881
- e.fe = new NotReadyError(t);
925
+ e.Te = new NotReadyError(t);
882
926
  }
883
927
  }
884
928
  function forEachDependent(e, t) {
885
929
  for (let n = e.I; n !== null; n = n.h) t(n.p);
886
- for (let n = e.A; n !== null; n = n.N) {
930
+ for (let n = e.N; n !== null; n = n.A) {
887
931
  for (let e = n.I; e !== null; e = e.h) t(e.p);
888
932
  }
889
933
  }
@@ -893,30 +937,30 @@ function settlePendingSource(e) {
893
937
  const settle = i => {
894
938
  if (n.has(i) || !removePendingSource(i, e)) return;
895
939
  n.add(i);
896
- i.Ee = clock;
897
- const r = i.Re ?? i.Oe?.values().next().value;
940
+ i.Se = clock;
941
+ const r = i.Re ?? i._e?.values().next().value;
898
942
  if (r) {
899
943
  setPendingError(i, r);
900
944
  updatePendingSignal(i);
901
945
  } else {
902
- i.Se &= ~STATUS_PENDING;
946
+ i.Oe &= ~STATUS_PENDING;
903
947
  setPendingError(i);
904
948
  updatePendingSignal(i);
905
- if (i.Ue) {
906
- if (i.W === EFFECT_TRACKED) {
949
+ if (i.be) {
950
+ if (i.M === EFFECT_TRACKED) {
907
951
  const e = i;
908
- if (!e.H) {
909
- e.H = true;
910
- e.F.enqueue(EFFECT_USER, e.M);
952
+ if (!e.j) {
953
+ e.j = true;
954
+ e.$.enqueue(EFFECT_USER, e.K);
911
955
  }
912
956
  } else {
913
- const e = i.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
957
+ const e = i.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
914
958
  if (e.P > i.o) e.P = i.o;
915
959
  insertIntoHeap(i, e);
916
960
  }
917
961
  t = true;
918
962
  }
919
- i.Ue = false;
963
+ i.be = false;
920
964
  }
921
965
  forEachDependent(i, settle);
922
966
  };
@@ -928,42 +972,42 @@ function handleAsync(e, t, n) {
928
972
  const r = i && untrack(() => t[Symbol.asyncIterator]);
929
973
  const s = !r && i && untrack(() => typeof t.then === "function");
930
974
  if (!s && !r) {
931
- e.ye = null;
975
+ e.De = null;
932
976
  return t;
933
977
  }
934
- e.ye = t;
978
+ e.De = t;
935
979
  let o;
936
980
  const handleError = n => {
937
- if (e.ye !== t) return;
981
+ if (e.De !== t) return;
938
982
  globalQueue.initTransition(resolveTransition(e));
939
983
  notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
940
- e.Ee = clock;
984
+ e.Se = clock;
941
985
  };
942
986
  const asyncWrite = (i, r) => {
943
- if (e.ye !== t) return;
944
- if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
987
+ if (e.De !== t) return;
988
+ if (e.R & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
945
989
  globalQueue.initTransition(resolveTransition(e));
946
- const s = !!(e.Se & STATUS_UNINITIALIZED);
990
+ const s = !!(e.Oe & STATUS_UNINITIALIZED);
947
991
  clearStatus(e);
948
992
  const o = resolveLane(e);
949
- if (o) o.k.delete(e);
993
+ if (o) o.W.delete(e);
950
994
  if (n) n(i);
951
- else if (e.ee !== undefined) {
952
- if (e.ee !== undefined && e.ee !== NOT_PENDING) e.X = i;
995
+ else if (e.G !== undefined) {
996
+ if (e.G !== undefined && e.G !== NOT_PENDING) e.U = i;
953
997
  else {
954
- e.J = i;
998
+ e.ne = i;
955
999
  insertSubs(e);
956
1000
  }
957
- e.Ee = clock;
1001
+ e.Se = clock;
958
1002
  } else if (o) {
959
- const t = e.W;
960
- const n = e.J;
961
- const r = e.ke;
1003
+ const t = e.M;
1004
+ const n = e.ne;
1005
+ const r = e.Le;
962
1006
  if ((!t && s) || !r || !r(i, n)) {
963
- e.J = i;
964
- e.Ee = clock;
965
- if (e.xe) {
966
- setSignal(e.xe, i);
1007
+ e.ne = i;
1008
+ e.Se = clock;
1009
+ if (e.Ue) {
1010
+ setSignal(e.Ue, i);
967
1011
  }
968
1012
  insertSubs(e, true);
969
1013
  }
@@ -1019,7 +1063,7 @@ function handleAsync(e, t, n) {
1019
1063
  s = n;
1020
1064
  u = true;
1021
1065
  if (n.done) r = true;
1022
- } else if (e.ye !== t) {
1066
+ } else if (e.De !== t) {
1023
1067
  return;
1024
1068
  } else if (!n.done) asyncWrite(n.value, iterate);
1025
1069
  else {
@@ -1029,7 +1073,7 @@ function handleAsync(e, t, n) {
1029
1073
  }
1030
1074
  },
1031
1075
  n => {
1032
- if (!c && e.ye === t) {
1076
+ if (!c && e.De === t) {
1033
1077
  r = true;
1034
1078
  handleError(n);
1035
1079
  }
@@ -1053,8 +1097,8 @@ function handleAsync(e, t, n) {
1053
1097
  }
1054
1098
  function clearStatus(e, t = false) {
1055
1099
  clearPendingSources(e);
1056
- e.Ue = false;
1057
- e.Se = t ? 0 : e.Se & STATUS_UNINITIALIZED;
1100
+ e.be = false;
1101
+ e.Oe = t ? 0 : e.Oe & STATUS_UNINITIALIZED;
1058
1102
  setPendingError(e);
1059
1103
  updatePendingSignal(e);
1060
1104
  e.Ge?.();
@@ -1064,17 +1108,17 @@ function notifyStatus(e, t, n, i, r) {
1064
1108
  n = new StatusError(e, n);
1065
1109
  const s = t === STATUS_PENDING && n instanceof NotReadyError ? n.source : undefined;
1066
1110
  const o = s === e;
1067
- const u = t === STATUS_PENDING && e.ee !== undefined && !o;
1111
+ const u = t === STATUS_PENDING && e.G !== undefined && !o;
1068
1112
  const c = u && hasActiveOverride(e);
1069
1113
  if (!i) {
1070
1114
  if (t === STATUS_PENDING && s) {
1071
1115
  addPendingSource(e, s);
1072
- e.Se = STATUS_PENDING | (e.Se & STATUS_UNINITIALIZED);
1116
+ e.Oe = STATUS_PENDING | (e.Oe & STATUS_UNINITIALIZED);
1073
1117
  setPendingError(e, s, n);
1074
1118
  } else {
1075
1119
  clearPendingSources(e);
1076
- e.Se = t | (t !== STATUS_ERROR ? e.Se & STATUS_UNINITIALIZED : 0);
1077
- e.fe = n;
1120
+ e.Oe = t | (t !== STATUS_ERROR ? e.Oe & STATUS_UNINITIALIZED : 0);
1121
+ e.Te = n;
1078
1122
  }
1079
1123
  updatePendingSignal(e);
1080
1124
  }
@@ -1095,12 +1139,12 @@ function notifyStatus(e, t, n, i, r) {
1095
1139
  return;
1096
1140
  }
1097
1141
  forEachDependent(e, e => {
1098
- e.Ee = clock;
1142
+ e.Se = clock;
1099
1143
  if (
1100
- (t === STATUS_PENDING && s && e.Re !== s && !e.Oe?.has(s)) ||
1101
- (t !== STATUS_PENDING && (e.fe !== n || e.Re || e.Oe))
1144
+ (t === STATUS_PENDING && s && e.Re !== s && !e._e?.has(s)) ||
1145
+ (t !== STATUS_PENDING && (e.Te !== n || e.Re || e._e))
1102
1146
  ) {
1103
- if (!a && !e.K) globalQueue.se.push(e);
1147
+ if (!a && !e.Z) globalQueue.ue.push(e);
1104
1148
  notifyStatus(e, t, n, a, l);
1105
1149
  }
1106
1150
  });
@@ -1128,8 +1172,8 @@ function enableExternalSource(e) {
1128
1172
  externalSourceConfig = { factory: t, untrack: n };
1129
1173
  }
1130
1174
  }
1131
- GlobalQueue.oe = recompute;
1132
- GlobalQueue.ue = disposeChildren;
1175
+ GlobalQueue.ce = recompute;
1176
+ GlobalQueue.ae = disposeChildren;
1133
1177
  let tracking = false;
1134
1178
  let stale = false;
1135
1179
  let refreshing = false;
@@ -1142,7 +1186,7 @@ let snapshotCaptureActive = false;
1142
1186
  let snapshotSources = null;
1143
1187
  function ownerInSnapshotScope(e) {
1144
1188
  while (e) {
1145
- if (e.We) return true;
1189
+ if (e.ke) return true;
1146
1190
  e = e.i;
1147
1191
  }
1148
1192
  return false;
@@ -1152,32 +1196,32 @@ function setSnapshotCapture(e) {
1152
1196
  if (e && !snapshotSources) snapshotSources = new Set();
1153
1197
  }
1154
1198
  function markSnapshotScope(e) {
1155
- e.We = true;
1199
+ e.ke = true;
1156
1200
  }
1157
1201
  function releaseSnapshotScope(e) {
1158
- e.We = false;
1202
+ e.ke = false;
1159
1203
  releaseSubtree(e);
1160
1204
  schedule();
1161
1205
  }
1162
1206
  function releaseSubtree(e) {
1163
1207
  let t = e.Ce;
1164
1208
  while (t) {
1165
- if (t.We) {
1166
- t = t.De;
1209
+ if (t.ke) {
1210
+ t = t.ge;
1167
1211
  continue;
1168
1212
  }
1169
1213
  if (t.L) {
1170
1214
  const e = t;
1171
- e.Te = false;
1172
- if (e.O & REACTIVE_SNAPSHOT_STALE) {
1173
- e.O &= ~REACTIVE_SNAPSHOT_STALE;
1174
- e.O |= REACTIVE_DIRTY;
1215
+ e.Ee &= ~CONFIG_IN_SNAPSHOT_SCOPE;
1216
+ if (e.R & REACTIVE_SNAPSHOT_STALE) {
1217
+ e.R &= ~REACTIVE_SNAPSHOT_STALE;
1218
+ e.R |= REACTIVE_DIRTY;
1175
1219
  if (dirtyQueue.P > e.o) dirtyQueue.P = e.o;
1176
1220
  insertIntoHeap(e, dirtyQueue);
1177
1221
  }
1178
1222
  }
1179
1223
  releaseSubtree(t);
1180
- t = t.De;
1224
+ t = t.ge;
1181
1225
  }
1182
1226
  }
1183
1227
  function clearSnapshots() {
@@ -1191,32 +1235,32 @@ function clearSnapshots() {
1191
1235
  snapshotCaptureActive = false;
1192
1236
  }
1193
1237
  function recompute(e, t = false) {
1194
- const n = e.W;
1238
+ const n = e.M;
1195
1239
  if (!t) {
1196
- if (e.K && (!n || activeTransition) && activeTransition !== e.K)
1197
- globalQueue.initTransition(e.K);
1198
- deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1199
- e.ye = null;
1200
- if (e.K || n === EFFECT_TRACKED) disposeChildren(e);
1240
+ if (e.Z && (!n || activeTransition) && activeTransition !== e.Z)
1241
+ globalQueue.initTransition(e.Z);
1242
+ deleteFromHeap(e, e.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1243
+ e.De = null;
1244
+ if (e.Z || n === EFFECT_TRACKED) disposeChildren(e);
1201
1245
  else {
1202
1246
  markDisposal(e);
1203
- e.we = e.Ve;
1204
- e.ve = e.Ce;
1205
- e.Ve = null;
1247
+ e.me = e.we;
1248
+ e.ye = e.Ce;
1249
+ e.we = null;
1206
1250
  e.Ce = null;
1207
- e.me = 0;
1251
+ e.ve = 0;
1208
1252
  }
1209
1253
  }
1210
- const i = !!(e.O & REACTIVE_OPTIMISTIC_DIRTY);
1211
- const r = e.ee !== undefined && e.ee !== NOT_PENDING;
1212
- const s = !!(e.Se & STATUS_PENDING);
1213
- const o = !!(e.Se & STATUS_UNINITIALIZED);
1254
+ let i = !!(e.R & REACTIVE_OPTIMISTIC_DIRTY);
1255
+ const r = e.G !== undefined && e.G !== NOT_PENDING;
1256
+ const s = !!(e.Oe & STATUS_PENDING);
1257
+ const o = !!(e.Oe & STATUS_UNINITIALIZED);
1214
1258
  const u = context;
1215
1259
  context = e;
1216
- e.ge = null;
1217
- e.O = REACTIVE_RECOMPUTING_DEPS;
1218
- e.Ee = clock;
1219
- let c = e.X === NOT_PENDING ? e.J : e.X;
1260
+ e.Pe = null;
1261
+ e.R = REACTIVE_RECOMPUTING_DEPS;
1262
+ e.Se = clock;
1263
+ let c = e.U === NOT_PENDING ? e.ne : e.U;
1220
1264
  let a = e.o;
1221
1265
  let l = tracking;
1222
1266
  let f = currentOptimisticLane;
@@ -1224,39 +1268,55 @@ function recompute(e, t = false) {
1224
1268
  if (i) {
1225
1269
  const t = resolveLane(e);
1226
1270
  if (t) currentOptimisticLane = t;
1271
+ } else if (activeTransition && !t && activeTransition.q.length) {
1272
+ for (let t = e.C; t; t = t.D) {
1273
+ const n = t.m;
1274
+ if (n.R & REACTIVE_OPTIMISTIC_DIRTY) {
1275
+ const t = resolveLane(n);
1276
+ if (t) {
1277
+ i = true;
1278
+ currentOptimisticLane = t;
1279
+ e.R |= REACTIVE_OPTIMISTIC_DIRTY;
1280
+ assignOrMergeLane(e, t);
1281
+ break;
1282
+ }
1283
+ }
1284
+ }
1227
1285
  }
1228
1286
  try {
1229
- c = handleAsync(e, e.L(c));
1287
+ const n = e.De;
1288
+ const i = e.L(c);
1289
+ c = e.De !== n ? i : handleAsync(e, i);
1230
1290
  clearStatus(e, t);
1231
- const n = resolveLane(e);
1232
- if (n) {
1233
- n.k.delete(e);
1234
- updatePendingSignal(n.te);
1291
+ const r = resolveLane(e);
1292
+ if (r) {
1293
+ r.W.delete(e);
1294
+ updatePendingSignal(r.ie);
1235
1295
  }
1236
1296
  } catch (t) {
1237
1297
  if (t instanceof NotReadyError && currentOptimisticLane) {
1238
1298
  const t = findLane(currentOptimisticLane);
1239
- if (t.te !== e) {
1240
- t.k.add(e);
1241
- e.q = t;
1242
- updatePendingSignal(t.te);
1299
+ if (t.ie !== e) {
1300
+ t.W.add(e);
1301
+ e.te = t;
1302
+ updatePendingSignal(t.ie);
1243
1303
  }
1244
1304
  }
1245
- if (t instanceof NotReadyError) e.Ue = true;
1305
+ if (t instanceof NotReadyError) e.be = true;
1246
1306
  notifyStatus(
1247
1307
  e,
1248
1308
  t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
1249
1309
  t,
1250
1310
  undefined,
1251
- t instanceof NotReadyError ? e.q : undefined
1311
+ t instanceof NotReadyError ? e.te : undefined
1252
1312
  );
1253
1313
  } finally {
1254
1314
  tracking = l;
1255
- e.O = REACTIVE_NONE | (t ? e.O & REACTIVE_SNAPSHOT_STALE : 0);
1315
+ e.R = REACTIVE_NONE | (t ? e.R & REACTIVE_SNAPSHOT_STALE : 0);
1256
1316
  context = u;
1257
1317
  }
1258
- if (!e.fe) {
1259
- const u = e.ge;
1318
+ if (!e.Te) {
1319
+ const u = e.Pe;
1260
1320
  let l = u !== null ? u.D : e.C;
1261
1321
  if (l !== null) {
1262
1322
  do {
@@ -1265,132 +1325,133 @@ function recompute(e, t = false) {
1265
1325
  if (u !== null) u.D = null;
1266
1326
  else e.C = null;
1267
1327
  }
1268
- const f = r ? e.ee : e.X === NOT_PENDING ? e.J : e.X;
1269
- const E = (!n && o) || !e.ke || !e.ke(f, c);
1328
+ const f = r ? e.G : e.U === NOT_PENDING ? e.ne : e.U;
1329
+ const E = (!n && o) || !e.Le || !e.Le(f, c);
1270
1330
  if (E) {
1271
- const o = r ? e.ee : undefined;
1272
- if (t || (n && activeTransition !== e.K) || i) {
1273
- e.J = c;
1331
+ const o = r ? e.G : undefined;
1332
+ if (t || (n && activeTransition !== e.Z) || i) {
1333
+ e.ne = c;
1274
1334
  if (r && i) {
1275
- e.ee = c;
1276
- e.X = c;
1335
+ e.G = c;
1336
+ e.U = c;
1277
1337
  }
1278
- } else e.X = c;
1279
- if (r && !i && s && !e.he) e.ee = c;
1280
- if (!r || i || e.ee !== o) insertSubs(e, i || r);
1338
+ } else e.U = c;
1339
+ if (r && !i && s && !e.pe) e.G = c;
1340
+ if (!r || i || e.G !== o) insertSubs(e, i || r);
1281
1341
  } else if (r) {
1282
- e.X = c;
1342
+ e.U = c;
1283
1343
  } else if (e.o != a) {
1284
1344
  for (let t = e.I; t !== null; t = t.h) {
1285
- insertIntoHeapHeight(t.p, t.p.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1345
+ insertIntoHeapHeight(t.p, t.p.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1286
1346
  }
1287
1347
  }
1288
1348
  }
1289
1349
  currentOptimisticLane = f;
1290
- (!t || e.Se & STATUS_PENDING) && !e.K && !(activeTransition && r) && globalQueue.se.push(e);
1291
- e.K && n && activeTransition !== e.K && runInTransition(e.K, () => recompute(e));
1350
+ (!t || e.Oe & STATUS_PENDING) && !e.Z && !(activeTransition && r) && globalQueue.ue.push(e);
1351
+ e.Z && n && activeTransition !== e.Z && runInTransition(e.Z, () => recompute(e));
1292
1352
  }
1293
1353
  function updateIfNecessary(e) {
1294
- if (e.O & REACTIVE_CHECK) {
1354
+ if (e.R & REACTIVE_CHECK) {
1295
1355
  for (let t = e.C; t; t = t.D) {
1296
1356
  const n = t.m;
1297
1357
  const i = n.V || n;
1298
1358
  if (i.L) {
1299
1359
  updateIfNecessary(i);
1300
1360
  }
1301
- if (e.O & REACTIVE_DIRTY) {
1361
+ if (e.R & REACTIVE_DIRTY) {
1302
1362
  break;
1303
1363
  }
1304
1364
  }
1305
1365
  }
1306
- if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.fe && e.Ee < clock && !e.ye)) {
1366
+ if (e.R & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.Te && e.Se < clock && !e.De)) {
1307
1367
  recompute(e);
1308
1368
  }
1309
- e.O = e.O & (REACTIVE_SNAPSHOT_STALE | REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT);
1310
- }
1311
- function computed(e, t, n) {
1312
- const i = n?.transparent ?? false;
1313
- const r = {
1314
- id: n?.id ?? (i ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
1315
- be: i || undefined,
1316
- ke: n?.equals != null ? n.equals : isEqual,
1317
- le: !!n?.pureWrite,
1318
- Ne: n?.unobserved,
1319
- Ve: null,
1320
- F: context?.F ?? globalQueue,
1321
- Le: context?.Le ?? defaultContext,
1322
- me: 0,
1369
+ e.R = e.R & (REACTIVE_SNAPSHOT_STALE | REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT);
1370
+ }
1371
+ function computed(e, t) {
1372
+ const n = t?.transparent ?? false;
1373
+ const i = {
1374
+ id: t?.id ?? (n ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
1375
+ Ee:
1376
+ (n ? CONFIG_TRANSPARENT : 0) |
1377
+ (t?.ownedWrite ? CONFIG_OWNED_WRITE : 0) |
1378
+ (!context || t?.lazy ? CONFIG_AUTO_DISPOSE : 0) |
1379
+ (snapshotCaptureActive && ownerInSnapshotScope(context) ? CONFIG_IN_SNAPSHOT_SCOPE : 0),
1380
+ Le: t?.equals != null ? t.equals : isEqual,
1381
+ k: t?.unobserved,
1382
+ we: null,
1383
+ $: context?.$ ?? globalQueue,
1384
+ Ve: context?.Ve ?? defaultContext,
1385
+ ve: 0,
1323
1386
  L: e,
1324
- J: t,
1387
+ ne: undefined,
1325
1388
  o: 0,
1326
- A: null,
1389
+ N: null,
1327
1390
  S: undefined,
1328
1391
  T: null,
1329
1392
  C: null,
1330
- ge: null,
1393
+ Pe: null,
1331
1394
  I: null,
1332
1395
  Ae: null,
1333
1396
  i: context,
1334
- De: null,
1397
+ ge: null,
1335
1398
  Ce: null,
1336
- O: n?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
1337
- Se: STATUS_UNINITIALIZED,
1338
- Ee: clock,
1339
- X: NOT_PENDING,
1340
- we: null,
1341
- ve: null,
1399
+ R: t?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
1400
+ Oe: STATUS_UNINITIALIZED,
1401
+ Se: clock,
1402
+ U: NOT_PENDING,
1403
+ me: null,
1342
1404
  ye: null,
1343
- K: null
1405
+ De: null,
1406
+ Z: null
1344
1407
  };
1345
- r.T = r;
1346
- const s = context?.t ? context.u : context;
1408
+ i.T = i;
1409
+ const r = context?.t ? context.u : context;
1347
1410
  if (context) {
1348
1411
  const e = context.Ce;
1349
1412
  if (e === null) {
1350
- context.Ce = r;
1413
+ context.Ce = i;
1351
1414
  } else {
1352
- r.De = e;
1353
- context.Ce = r;
1415
+ i.ge = e;
1416
+ context.Ce = i;
1354
1417
  }
1355
1418
  }
1356
- if (s) r.o = s.o + 1;
1357
- if (snapshotCaptureActive && ownerInSnapshotScope(context)) r.Te = true;
1419
+ if (r) i.o = r.o + 1;
1358
1420
  if (externalSourceConfig) {
1359
- const e = signal(undefined, { equals: false, pureWrite: true });
1360
- const t = externalSourceConfig.factory(r.L, () => {
1421
+ const e = signal(undefined, { equals: false, ownedWrite: true });
1422
+ const t = externalSourceConfig.factory(i.L, () => {
1361
1423
  setSignal(e, undefined);
1362
1424
  });
1363
1425
  cleanup(() => t.dispose());
1364
- r.L = n => {
1426
+ i.L = n => {
1365
1427
  read(e);
1366
1428
  return t.track(n);
1367
1429
  };
1368
1430
  }
1369
- !n?.lazy && recompute(r, true);
1370
- if (snapshotCaptureActive && !n?.lazy) {
1371
- if (!(r.Se & STATUS_PENDING)) {
1372
- r.de = r.J === undefined ? NO_SNAPSHOT : r.J;
1373
- snapshotSources.add(r);
1431
+ !t?.lazy && recompute(i, true);
1432
+ if (snapshotCaptureActive && !t?.lazy) {
1433
+ if (!(i.Oe & STATUS_PENDING)) {
1434
+ i.de = i.ne === undefined ? NO_SNAPSHOT : i.ne;
1435
+ snapshotSources.add(i);
1374
1436
  }
1375
1437
  }
1376
- return r;
1438
+ return i;
1377
1439
  }
1378
1440
  function signal(e, t, n = null) {
1379
1441
  const i = {
1380
- ke: t?.equals != null ? t.equals : isEqual,
1381
- le: !!t?.pureWrite,
1382
- He: !!t?.He,
1383
- Ne: t?.unobserved,
1384
- J: e,
1442
+ Le: t?.equals != null ? t.equals : isEqual,
1443
+ Ee: (t?.ownedWrite ? CONFIG_OWNED_WRITE : 0) | (t?.Fe ? CONFIG_NO_SNAPSHOT : 0),
1444
+ k: t?.unobserved,
1445
+ ne: e,
1385
1446
  I: null,
1386
1447
  Ae: null,
1387
- Ee: clock,
1448
+ Se: clock,
1388
1449
  V: n,
1389
- N: n?.A || null,
1390
- X: NOT_PENDING
1450
+ A: n?.N || null,
1451
+ U: NOT_PENDING
1391
1452
  };
1392
- n && (n.A = i);
1393
- if (snapshotCaptureActive && !i.He && !((n?.Se ?? 0) & STATUS_PENDING)) {
1453
+ n && (n.N = i);
1454
+ if (snapshotCaptureActive && !(i.Ee & CONFIG_NO_SNAPSHOT) && !((n?.Oe ?? 0) & STATUS_PENDING)) {
1394
1455
  i.de = e === undefined ? NO_SNAPSHOT : e;
1395
1456
  snapshotSources.add(i);
1396
1457
  }
@@ -1398,13 +1459,13 @@ function signal(e, t, n = null) {
1398
1459
  }
1399
1460
  function optimisticSignal(e, t) {
1400
1461
  const n = signal(e, t);
1401
- n.ee = NOT_PENDING;
1462
+ n.G = NOT_PENDING;
1402
1463
  return n;
1403
1464
  }
1404
- function optimisticComputed(e, t, n) {
1405
- const i = computed(e, t, n);
1406
- i.ee = NOT_PENDING;
1407
- return i;
1465
+ function optimisticComputed(e, t) {
1466
+ const n = computed(e, t);
1467
+ n.G = NOT_PENDING;
1468
+ return n;
1408
1469
  }
1409
1470
  function isEqual(e, t) {
1410
1471
  return e === t;
@@ -1425,7 +1486,7 @@ function read(e) {
1425
1486
  const t = getLatestValueComputed(e);
1426
1487
  const n = latestReadActive;
1427
1488
  latestReadActive = false;
1428
- const i = e.ee !== undefined && e.ee !== NOT_PENDING ? e.ee : e.J;
1489
+ const i = e.G !== undefined && e.G !== NOT_PENDING ? e.G : e.ne;
1429
1490
  let r;
1430
1491
  try {
1431
1492
  r = read(t);
@@ -1435,11 +1496,11 @@ function read(e) {
1435
1496
  } finally {
1436
1497
  latestReadActive = n;
1437
1498
  }
1438
- if (t.Se & STATUS_PENDING) return i;
1439
- if (stale && currentOptimisticLane && t.q) {
1440
- const e = findLane(t.q);
1499
+ if (t.Oe & STATUS_PENDING) return i;
1500
+ if (stale && currentOptimisticLane && t.te) {
1501
+ const e = findLane(t.te);
1441
1502
  const n = findLane(currentOptimisticLane);
1442
- if (e !== n && e.k.size > 0) {
1503
+ if (e !== n && e.W.size > 0) {
1443
1504
  return i;
1444
1505
  }
1445
1506
  }
@@ -1449,8 +1510,8 @@ function read(e) {
1449
1510
  const t = e.V;
1450
1511
  const n = pendingCheckActive;
1451
1512
  pendingCheckActive = false;
1452
- if (t && e.ee !== undefined) {
1453
- if (e.ee !== NOT_PENDING && (t.ye || !!(t.Se & STATUS_PENDING))) {
1513
+ if (t && e.G !== undefined) {
1514
+ if (e.G !== NOT_PENDING && (t.De || !!(t.Oe & STATUS_PENDING))) {
1454
1515
  foundPending = true;
1455
1516
  }
1456
1517
  let n = context;
@@ -1463,86 +1524,115 @@ function read(e) {
1463
1524
  if (t && read(getPendingSignal(t))) foundPending = true;
1464
1525
  }
1465
1526
  pendingCheckActive = n;
1466
- return e.J;
1527
+ return e.ne;
1467
1528
  }
1468
1529
  let t = context;
1469
1530
  if (t?.t) t = t.u;
1470
- if (refreshing && e.L) recompute(e);
1471
- if (e.O & REACTIVE_LAZY) {
1472
- e.O &= ~REACTIVE_LAZY;
1473
- recompute(e, true);
1474
- }
1475
- const n = e.V || e;
1531
+ const n = e;
1532
+ if (typeof n.L === "function") {
1533
+ const t = e;
1534
+ if (refreshing && !(t.R & REACTIVE_DISPOSED)) recompute(t);
1535
+ if (t.R & REACTIVE_LAZY) {
1536
+ t.R &= ~REACTIVE_LAZY;
1537
+ recompute(t, true);
1538
+ } else if (t.R & REACTIVE_DISPOSED) {
1539
+ recompute(t, true);
1540
+ }
1541
+ }
1542
+ const i = e.V || e;
1476
1543
  if (t && tracking) {
1477
- if (e.L && e.O & REACTIVE_DISPOSED) recompute(e);
1478
1544
  link(e, t);
1479
- if (n.L) {
1480
- const i = e.O & REACTIVE_ZOMBIE;
1481
- if (n.o >= (i ? zombieQueue.P : dirtyQueue.P)) {
1545
+ if (i.L) {
1546
+ const n = e.R & REACTIVE_ZOMBIE;
1547
+ if (i.o >= (n ? zombieQueue.P : dirtyQueue.P)) {
1482
1548
  markNode(t);
1483
- markHeap(i ? zombieQueue : dirtyQueue);
1484
- updateIfNecessary(n);
1549
+ markHeap(n ? zombieQueue : dirtyQueue);
1550
+ updateIfNecessary(i);
1485
1551
  }
1486
- const r = n.o;
1552
+ const r = i.o;
1487
1553
  if (r >= t.o && e.i !== t) {
1488
1554
  t.o = r + 1;
1489
1555
  }
1490
1556
  }
1491
1557
  }
1492
- if (n.Se & STATUS_PENDING) {
1493
- if (t && !(stale && n.K && activeTransition !== n.K)) {
1558
+ if (i.Oe & STATUS_PENDING) {
1559
+ if (t && !(stale && i.Z && activeTransition !== i.Z)) {
1494
1560
  if (currentOptimisticLane) {
1495
- const i = n.q;
1561
+ const n = i.te;
1496
1562
  const r = findLane(currentOptimisticLane);
1497
- if (i && findLane(i) === r && !hasActiveOverride(n)) {
1563
+ if (n && findLane(n) === r && !hasActiveOverride(i)) {
1498
1564
  if (!tracking && e !== t) link(e, t);
1499
- throw n.fe;
1565
+ throw i.Te;
1500
1566
  }
1501
1567
  } else {
1502
1568
  if (!tracking && e !== t) link(e, t);
1503
- throw n.fe;
1569
+ throw i.Te;
1504
1570
  }
1505
- } else if (t && n !== e && n.Se & STATUS_UNINITIALIZED) {
1571
+ } else if (t && i !== e && i.Oe & STATUS_UNINITIALIZED) {
1506
1572
  if (!tracking && e !== t) link(e, t);
1507
- throw n.fe;
1508
- } else if (!t && n.Se & STATUS_UNINITIALIZED) {
1509
- throw n.fe;
1573
+ throw i.Te;
1574
+ } else if (!t && i.Oe & STATUS_UNINITIALIZED) {
1575
+ throw i.Te;
1510
1576
  }
1511
1577
  }
1512
- if (e.L && e.Se & STATUS_ERROR) {
1513
- if (e.Ee < clock) {
1578
+ if (e.L && e.Oe & STATUS_ERROR) {
1579
+ if (e.Se < clock) {
1514
1580
  recompute(e);
1515
1581
  return read(e);
1516
- } else throw e.fe;
1582
+ } else throw e.Te;
1517
1583
  }
1518
- if (snapshotCaptureActive && t && t.Te) {
1584
+ if (snapshotCaptureActive && t && t.Ee & CONFIG_IN_SNAPSHOT_SCOPE) {
1519
1585
  const n = e.de;
1520
1586
  if (n !== undefined) {
1521
1587
  const i = n === NO_SNAPSHOT ? undefined : n;
1522
- const r = e.X !== NOT_PENDING ? e.X : e.J;
1523
- if (r !== i) t.O |= REACTIVE_SNAPSHOT_STALE;
1588
+ const r = e.U !== NOT_PENDING ? e.U : e.ne;
1589
+ if (r !== i) t.R |= REACTIVE_SNAPSHOT_STALE;
1524
1590
  return i;
1525
1591
  }
1526
1592
  }
1527
- if (e.ee !== undefined && e.ee !== NOT_PENDING) {
1528
- if (t && stale && shouldReadStashedOptimisticValue(e)) return e.J;
1529
- return e.ee;
1593
+ if (e.G !== undefined && e.G !== NOT_PENDING) {
1594
+ if (t && stale && shouldReadStashedOptimisticValue(e)) return e.ne;
1595
+ return e.G;
1596
+ }
1597
+ if (
1598
+ activeTransition !== null &&
1599
+ currentOptimisticLane !== null &&
1600
+ !latestReadActive &&
1601
+ e.U !== NOT_PENDING &&
1602
+ i === e &&
1603
+ !e.L &&
1604
+ t
1605
+ ) {
1606
+ activeTransition.ee.add(t);
1607
+ return e.ne;
1530
1608
  }
1531
- return !t ||
1609
+ const r =
1610
+ !t ||
1532
1611
  (currentOptimisticLane !== null &&
1533
- (e.ee !== undefined || e.q || (n === e && stale) || !!(n.Se & STATUS_PENDING))) ||
1534
- e.X === NOT_PENDING ||
1535
- (stale && e.K && activeTransition !== e.K)
1536
- ? e.J
1537
- : e.X;
1612
+ (e.G !== undefined || e.te || (i === e && stale) || !!(i.Oe & STATUS_PENDING))) ||
1613
+ e.U === NOT_PENDING ||
1614
+ (stale && e.Z && activeTransition !== e.Z)
1615
+ ? e.ne
1616
+ : e.U;
1617
+ if (
1618
+ !t &&
1619
+ i === e &&
1620
+ typeof n.L === "function" &&
1621
+ e.Ee & CONFIG_AUTO_DISPOSE &&
1622
+ !(i.Oe & STATUS_PENDING) &&
1623
+ !e.I
1624
+ ) {
1625
+ unobserved(e);
1626
+ }
1627
+ return r;
1538
1628
  }
1539
1629
  function setSignal(e, t) {
1540
- if (e.K && activeTransition !== e.K) globalQueue.initTransition(e.K);
1541
- const n = e.ee !== undefined && !projectionWriteActive;
1542
- const i = e.ee !== undefined && e.ee !== NOT_PENDING;
1543
- const r = n ? (i ? e.ee : e.J) : e.X === NOT_PENDING ? e.J : e.X;
1630
+ if (e.Z && activeTransition !== e.Z) globalQueue.initTransition(e.Z);
1631
+ const n = e.G !== undefined && !projectionWriteActive;
1632
+ const i = e.G !== undefined && e.G !== NOT_PENDING;
1633
+ const r = n ? (i ? e.G : e.ne) : e.U === NOT_PENDING ? e.ne : e.U;
1544
1634
  if (typeof t === "function") t = t(r);
1545
- const s = !e.ke || !e.ke(r, t) || !!(e.Se & STATUS_UNINITIALIZED);
1635
+ const s = !e.Le || !e.Le(r, t) || !!(e.Oe & STATUS_UNINITIALIZED);
1546
1636
  if (!s) {
1547
1637
  if (n && i && e.L) {
1548
1638
  insertSubs(e, true);
@@ -1551,25 +1641,25 @@ function setSignal(e, t) {
1551
1641
  return t;
1552
1642
  }
1553
1643
  if (n) {
1554
- const n = e.ee === NOT_PENDING;
1644
+ const n = e.G === NOT_PENDING;
1555
1645
  if (!n) globalQueue.initTransition(resolveTransition(e));
1556
1646
  if (n) {
1557
- e.X = e.J;
1558
- globalQueue.Y.push(e);
1647
+ e.U = e.ne;
1648
+ globalQueue.q.push(e);
1559
1649
  }
1560
- e.he = true;
1650
+ e.pe = true;
1561
1651
  const i = getOrCreateLane(e);
1562
- e.q = i;
1563
- e.ee = t;
1652
+ e.te = i;
1653
+ e.G = t;
1564
1654
  } else {
1565
- if (e.X === NOT_PENDING) globalQueue.se.push(e);
1566
- e.X = t;
1655
+ if (e.U === NOT_PENDING) globalQueue.ue.push(e);
1656
+ e.U = t;
1567
1657
  }
1568
1658
  updatePendingSignal(e);
1569
- if (e.xe) {
1570
- setSignal(e.xe, t);
1659
+ if (e.Ue) {
1660
+ setSignal(e.Ue, t);
1571
1661
  }
1572
- e.Ee = clock;
1662
+ e.Se = clock;
1573
1663
  insertSubs(e, n);
1574
1664
  schedule();
1575
1665
  return t;
@@ -1587,68 +1677,68 @@ function runWithOwner(e, t) {
1587
1677
  }
1588
1678
  }
1589
1679
  function getPendingSignal(e) {
1590
- if (!e.Fe) {
1591
- e.Fe = optimisticSignal(false, { pureWrite: true });
1592
- if (e._e) {
1593
- e.Fe._e = e;
1680
+ if (!e.We) {
1681
+ e.We = optimisticSignal(false, { ownedWrite: true });
1682
+ if (e.Ie) {
1683
+ e.We.Ie = e;
1594
1684
  }
1595
- if (computePendingState(e)) setSignal(e.Fe, true);
1685
+ if (computePendingState(e)) setSignal(e.We, true);
1596
1686
  }
1597
- return e.Fe;
1687
+ return e.We;
1598
1688
  }
1599
1689
  function computePendingState(e) {
1600
1690
  const t = e;
1601
1691
  const n = e.V;
1602
- if (n && e.X !== NOT_PENDING) {
1603
- return !n.ye && !(n.Se & STATUS_PENDING);
1692
+ if (n && e.U !== NOT_PENDING) {
1693
+ return !n.De && !(n.Oe & STATUS_PENDING);
1604
1694
  }
1605
- if (e.ee !== undefined && e.ee !== NOT_PENDING) {
1606
- if (t.Se & STATUS_PENDING && !(t.Se & STATUS_UNINITIALIZED)) return true;
1607
- if (e._e) {
1608
- const t = e.q ? findLane(e.q) : null;
1609
- return !!(t && t.k.size > 0);
1695
+ if (e.G !== undefined && e.G !== NOT_PENDING) {
1696
+ if (t.Oe & STATUS_PENDING && !(t.Oe & STATUS_UNINITIALIZED)) return true;
1697
+ if (e.Ie) {
1698
+ const t = e.te ? findLane(e.te) : null;
1699
+ return !!(t && t.W.size > 0);
1610
1700
  }
1611
1701
  return true;
1612
1702
  }
1613
- if (e.ee !== undefined && e.ee === NOT_PENDING && !e._e) {
1703
+ if (e.G !== undefined && e.G === NOT_PENDING && !e.Ie) {
1614
1704
  return false;
1615
1705
  }
1616
- if (e.X !== NOT_PENDING && !(t.Se & STATUS_UNINITIALIZED)) return true;
1617
- return !!(t.Se & STATUS_PENDING && !(t.Se & STATUS_UNINITIALIZED));
1706
+ if (e.U !== NOT_PENDING && !(t.Oe & STATUS_UNINITIALIZED)) return true;
1707
+ return !!(t.Oe & STATUS_PENDING && !(t.Oe & STATUS_UNINITIALIZED));
1618
1708
  }
1619
1709
  function updatePendingSignal(e) {
1620
- if (e.Fe) {
1710
+ if (e.We) {
1621
1711
  const t = computePendingState(e);
1622
- const n = e.Fe;
1712
+ const n = e.We;
1623
1713
  setSignal(n, t);
1624
- if (!t && n.q) {
1714
+ if (!t && n.te) {
1625
1715
  const t = resolveLane(e);
1626
- if (t && t.k.size > 0) {
1627
- const e = findLane(n.q);
1716
+ if (t && t.W.size > 0) {
1717
+ const e = findLane(n.te);
1628
1718
  if (e !== t) {
1629
1719
  mergeLanes(t, e);
1630
1720
  }
1631
1721
  }
1632
1722
  signalLanes.delete(n);
1633
- n.q = undefined;
1723
+ n.te = undefined;
1634
1724
  }
1635
1725
  }
1636
1726
  }
1637
1727
  function getLatestValueComputed(e) {
1638
- if (!e.xe) {
1728
+ if (!e.Ue) {
1639
1729
  const t = latestReadActive;
1640
1730
  latestReadActive = false;
1641
1731
  const n = pendingCheckActive;
1642
1732
  pendingCheckActive = false;
1643
1733
  const i = context;
1644
1734
  context = null;
1645
- e.xe = optimisticComputed(() => read(e));
1646
- e.xe._e = e;
1735
+ e.Ue = optimisticComputed(() => read(e));
1736
+ e.Ue.Ie = e;
1647
1737
  context = i;
1648
1738
  pendingCheckActive = n;
1649
1739
  latestReadActive = t;
1650
1740
  }
1651
- return e.xe;
1741
+ return e.Ue;
1652
1742
  }
1653
1743
  function staleValues(e, t = true) {
1654
1744
  const n = stale;
@@ -1709,7 +1799,7 @@ function getContext(e, t = getOwner()) {
1709
1799
  if (!t) {
1710
1800
  throw new NoOwnerError();
1711
1801
  }
1712
- const n = hasContext(e, t) ? t.Le[e.id] : e.defaultValue;
1802
+ const n = hasContext(e, t) ? t.Ve[e.id] : e.defaultValue;
1713
1803
  if (isUndefined(n)) {
1714
1804
  throw new ContextNotFoundError();
1715
1805
  }
@@ -1719,109 +1809,111 @@ function setContext(e, t, n = getOwner()) {
1719
1809
  if (!n) {
1720
1810
  throw new NoOwnerError();
1721
1811
  }
1722
- n.Le = { ...n.Le, [e.id]: isUndefined(t) ? e.defaultValue : t };
1812
+ n.Ve = { ...n.Ve, [e.id]: isUndefined(t) ? e.defaultValue : t };
1723
1813
  }
1724
1814
  function hasContext(e, t) {
1725
- return !isUndefined(t?.Le[e.id]);
1815
+ return !isUndefined(t?.Ve[e.id]);
1726
1816
  }
1727
1817
  function isUndefined(e) {
1728
1818
  return typeof e === "undefined";
1729
1819
  }
1730
- function effect(e, t, n, i, r) {
1731
- let s = false;
1732
- const o = computed(r?.render ? t => staleValues(() => e(t)) : e, i, {
1733
- ...r,
1820
+ function effect(e, t, n, i) {
1821
+ let r = false;
1822
+ const s = !!i?.user;
1823
+ const o = computed(s ? e : t => staleValues(() => e(t)), {
1824
+ ...i,
1734
1825
  equals: () => {
1735
- o.H = !o.fe;
1736
- if (s) o.F.enqueue(o.W, runEffect.bind(o));
1826
+ o.j = !o.Te;
1827
+ if (r) o.$.enqueue(o.M, runEffect.bind(o));
1737
1828
  return false;
1738
1829
  },
1739
1830
  lazy: true
1740
1831
  });
1741
- o.Qe = i;
1742
- o.Me = t;
1743
- o.je = n;
1744
- o.$e = undefined;
1745
- o.W = r?.render ? EFFECT_RENDER : EFFECT_USER;
1832
+ o.Ee &= ~CONFIG_AUTO_DISPOSE;
1833
+ o.xe = undefined;
1834
+ o.He = t;
1835
+ o.Me = n;
1836
+ o.Qe = undefined;
1837
+ o.M = s ? EFFECT_USER : EFFECT_RENDER;
1746
1838
  o.Ge = (e, t) => {
1747
- const n = e !== undefined ? e : o.Se;
1748
- const i = t !== undefined ? t : o.fe;
1839
+ const n = e !== undefined ? e : o.Oe;
1840
+ const i = t !== undefined ? t : o.Te;
1749
1841
  if (n & STATUS_ERROR) {
1750
1842
  let e = i;
1751
- o.F.notify(o, STATUS_PENDING, 0);
1752
- if (o.W === EFFECT_USER) {
1843
+ o.$.notify(o, STATUS_PENDING, 0);
1844
+ if (o.M === EFFECT_USER) {
1753
1845
  try {
1754
- return o.je
1755
- ? o.je(e, () => {
1756
- o.$e?.();
1757
- o.$e = undefined;
1846
+ return o.Me
1847
+ ? o.Me(e, () => {
1848
+ o.Qe?.();
1849
+ o.Qe = undefined;
1758
1850
  })
1759
1851
  : console.error(e);
1760
1852
  } catch (t) {
1761
1853
  e = t;
1762
1854
  }
1763
1855
  }
1764
- if (!o.F.notify(o, STATUS_ERROR, STATUS_ERROR)) throw e;
1765
- } else if (o.W === EFFECT_RENDER) {
1766
- o.F.notify(o, STATUS_PENDING | STATUS_ERROR, n, i);
1856
+ if (!o.$.notify(o, STATUS_ERROR, STATUS_ERROR)) throw e;
1857
+ } else if (o.M === EFFECT_RENDER) {
1858
+ o.$.notify(o, STATUS_PENDING | STATUS_ERROR, n, i);
1767
1859
  }
1768
1860
  };
1769
1861
  recompute(o, true);
1770
- !r?.defer && (o.W === EFFECT_USER ? o.F.enqueue(o.W, runEffect.bind(o)) : runEffect.call(o));
1771
- s = true;
1772
- cleanup(() => o.$e?.());
1862
+ !i?.defer &&
1863
+ (o.M === EFFECT_USER || i?.schedule ? o.$.enqueue(o.M, runEffect.bind(o)) : runEffect.call(o));
1864
+ r = true;
1865
+ cleanup(() => o.Qe?.());
1773
1866
  }
1774
1867
  function runEffect() {
1775
- if (!this.H || this.O & REACTIVE_DISPOSED) return;
1776
- this.$e?.();
1777
- this.$e = undefined;
1868
+ if (!this.j || this.R & REACTIVE_DISPOSED) return;
1869
+ this.Qe?.();
1870
+ this.Qe = undefined;
1778
1871
  try {
1779
- const e = this.Me(this.J, this.Qe);
1872
+ const e = this.He(this.ne, this.xe);
1780
1873
  if (false && e !== undefined && typeof e !== "function");
1781
- this.$e = e;
1874
+ this.Qe = e;
1782
1875
  } catch (e) {
1783
- this.fe = new StatusError(this, e);
1784
- this.Se |= STATUS_ERROR;
1785
- if (!this.F.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
1876
+ this.Te = new StatusError(this, e);
1877
+ this.Oe |= STATUS_ERROR;
1878
+ if (!this.$.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
1786
1879
  } finally {
1787
- this.Qe = this.J;
1788
- this.H = false;
1880
+ this.xe = this.ne;
1881
+ this.j = false;
1789
1882
  }
1790
1883
  }
1791
1884
  function trackedEffect(e, t) {
1792
1885
  const run = () => {
1793
- if (!n.H || n.O & REACTIVE_DISPOSED) return;
1886
+ if (!n.j || n.R & REACTIVE_DISPOSED) return;
1794
1887
  try {
1795
- n.H = false;
1888
+ n.j = false;
1796
1889
  recompute(n);
1797
1890
  } finally {
1798
1891
  }
1799
1892
  };
1800
1893
  const n = computed(
1801
1894
  () => {
1802
- n.$e?.();
1803
- n.$e = undefined;
1895
+ n.Qe?.();
1896
+ n.Qe = undefined;
1804
1897
  const t = staleValues(e);
1805
- n.$e = t;
1898
+ n.Qe = t;
1806
1899
  },
1807
- undefined,
1808
1900
  { ...t, lazy: true }
1809
1901
  );
1810
- n.$e = undefined;
1811
- n.Ke = true;
1812
- n.H = true;
1813
- n.W = EFFECT_TRACKED;
1902
+ n.Qe = undefined;
1903
+ n.Ee = (n.Ee & ~CONFIG_AUTO_DISPOSE) | CONFIG_CHILDREN_FORBIDDEN;
1904
+ n.j = true;
1905
+ n.M = EFFECT_TRACKED;
1814
1906
  n.Ge = (e, t) => {
1815
- const i = e !== undefined ? e : n.Se;
1907
+ const i = e !== undefined ? e : n.Oe;
1816
1908
  if (i & STATUS_ERROR) {
1817
- n.F.notify(n, STATUS_PENDING, 0);
1818
- const e = t !== undefined ? t : n.fe;
1819
- if (!n.F.notify(n, STATUS_ERROR, STATUS_ERROR)) throw e;
1909
+ n.$.notify(n, STATUS_PENDING, 0);
1910
+ const e = t !== undefined ? t : n.Te;
1911
+ if (!n.$.notify(n, STATUS_ERROR, STATUS_ERROR)) throw e;
1820
1912
  }
1821
1913
  };
1822
- n.M = run;
1823
- n.F.enqueue(EFFECT_USER, run);
1824
- cleanup(() => n.$e?.());
1914
+ n.K = run;
1915
+ n.$.enqueue(EFFECT_USER, run);
1916
+ cleanup(() => n.Qe?.());
1825
1917
  }
1826
1918
  function restoreTransition(e, t) {
1827
1919
  globalQueue.initTransition(e);
@@ -1835,11 +1927,11 @@ function action(e) {
1835
1927
  const r = e(...t);
1836
1928
  globalQueue.initTransition();
1837
1929
  let s = activeTransition;
1838
- s.$.push(r);
1930
+ s.B.push(r);
1839
1931
  const done = (e, t) => {
1840
1932
  s = currentTransition(s);
1841
- const o = s.$.indexOf(r);
1842
- if (o >= 0) s.$.splice(o, 1);
1933
+ const o = s.B.indexOf(r);
1934
+ if (o >= 0) s.B.splice(o, 1);
1843
1935
  setActiveTransition(s);
1844
1936
  schedule();
1845
1937
  t ? i(t) : n(e);
@@ -1871,27 +1963,25 @@ function onCleanup(e) {
1871
1963
  return cleanup(e);
1872
1964
  }
1873
1965
  function accessor(e) {
1874
- const t = read.bind(null, e);
1875
- t.$r = true;
1876
- return t;
1966
+ return read.bind(null, e);
1877
1967
  }
1878
- function createSignal(e, t, n) {
1968
+ function createSignal(e, t) {
1879
1969
  if (typeof e === "function") {
1880
- const i = computed(e, t, n);
1881
- return [accessor(i), setSignal.bind(null, i)];
1970
+ const n = computed(e, t);
1971
+ n.Ee &= ~CONFIG_AUTO_DISPOSE;
1972
+ return [accessor(n), setSignal.bind(null, n)];
1882
1973
  }
1883
- const i = signal(e, t);
1884
- return [accessor(i), setSignal.bind(null, i)];
1974
+ const n = signal(e, t);
1975
+ return [accessor(n), setSignal.bind(null, n)];
1885
1976
  }
1886
- function createMemo(e, t, n) {
1887
- let i = computed(e, t, n);
1888
- return accessor(i);
1977
+ function createMemo(e, t) {
1978
+ return accessor(computed(e, t));
1889
1979
  }
1890
- function createEffect(e, t, n, i) {
1891
- effect(e, t.effect || t, t.error, n, i);
1980
+ function createEffect(e, t, n) {
1981
+ effect(e, t.effect || t, t.error, { user: true, ...n });
1892
1982
  }
1893
- function createRenderEffect(e, t, n, i) {
1894
- effect(e, t, undefined, n, { render: true, ...i });
1983
+ function createRenderEffect(e, t, n) {
1984
+ effect(e, t, undefined, n);
1895
1985
  }
1896
1986
  function createTrackedEffect(e, t) {
1897
1987
  trackedEffect(e, t);
@@ -1912,8 +2002,7 @@ function createReaction(e, t) {
1912
2002
  dispose(t);
1913
2003
  },
1914
2004
  e.error,
1915
- undefined,
1916
- { defer: true, ...(false ? { ...t, name: t?.name ?? "effect" } : t) }
2005
+ { ...(false ? { ...t, name: t?.name ?? "effect" } : t), user: true, defer: true }
1917
2006
  );
1918
2007
  });
1919
2008
  };
@@ -1933,17 +2022,18 @@ function resolve(e) {
1933
2022
  });
1934
2023
  });
1935
2024
  }
1936
- function createOptimistic(e, t, n) {
2025
+ function createOptimistic(e, t) {
1937
2026
  if (typeof e === "function") {
1938
- const i = optimisticComputed(e, t, n);
1939
- return [accessor(i), setSignal.bind(null, i)];
2027
+ const n = optimisticComputed(e, t);
2028
+ n.Ee &= ~CONFIG_AUTO_DISPOSE;
2029
+ return [accessor(n), setSignal.bind(null, n)];
1940
2030
  }
1941
- const i = optimisticSignal(e, t);
1942
- return [accessor(i), setSignal.bind(null, i)];
2031
+ const n = optimisticSignal(e, t);
2032
+ return [accessor(n), setSignal.bind(null, n)];
1943
2033
  }
1944
2034
  function onSettled(e) {
1945
2035
  const t = getOwner();
1946
- t && !t.Ke
2036
+ t && !(t.Ee & CONFIG_CHILDREN_FORBIDDEN)
1947
2037
  ? createTrackedEffect(() => untrack(e), undefined)
1948
2038
  : globalQueue.enqueue(EFFECT_USER, () => {
1949
2039
  const t = e();
@@ -1977,34 +2067,34 @@ function applyState(e, t, n) {
1977
2067
  let t = false;
1978
2068
  const c = getOverrideValue(r, s, u, "length", o);
1979
2069
  if (e.length && c && e[0] && n(e[0]) != null) {
1980
- let a, l, f, E, d, T, S, R;
2070
+ let a, l, f, E, T, S, d, O;
1981
2071
  for (
1982
2072
  f = 0, E = Math.min(c, e.length);
1983
2073
  f < E &&
1984
- ((T = getOverrideValue(r, s, u, f, o)) === e[f] || (T && e[f] && n(T) === n(e[f])));
2074
+ ((S = getOverrideValue(r, s, u, f, o)) === e[f] || (S && e[f] && n(S) === n(e[f])));
1985
2075
  f++
1986
2076
  ) {
1987
- applyState(e[f], wrap(T, i), n);
2077
+ applyState(e[f], wrap(S, i), n);
1988
2078
  }
1989
- const O = new Array(e.length),
2079
+ const R = new Array(e.length),
1990
2080
  _ = new Map();
1991
2081
  for (
1992
- E = c - 1, d = e.length - 1;
2082
+ E = c - 1, T = e.length - 1;
1993
2083
  E >= f &&
1994
- d >= f &&
1995
- ((T = getOverrideValue(r, s, u, E, o)) === e[d] || (T && e[d] && n(T) === n(e[d])));
1996
- E--, d--
2084
+ T >= f &&
2085
+ ((S = getOverrideValue(r, s, u, E, o)) === e[T] || (S && e[T] && n(S) === n(e[T])));
2086
+ E--, T--
1997
2087
  ) {
1998
- O[d] = T;
2088
+ R[T] = S;
1999
2089
  }
2000
- if (f > d || f > E) {
2001
- for (l = f; l <= d; l++) {
2090
+ if (f > T || f > E) {
2091
+ for (l = f; l <= T; l++) {
2002
2092
  t = true;
2003
2093
  i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], wrap(e[l], i));
2004
2094
  }
2005
2095
  for (; l < e.length; l++) {
2006
2096
  t = true;
2007
- const r = wrap(O[l], i);
2097
+ const r = wrap(R[l], i);
2008
2098
  i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], r);
2009
2099
  applyState(e[l], r, n);
2010
2100
  }
@@ -2012,27 +2102,27 @@ function applyState(e, t, n) {
2012
2102
  c !== e.length && i[STORE_NODE].length && setSignal(i[STORE_NODE].length, e.length);
2013
2103
  return;
2014
2104
  }
2015
- S = new Array(d + 1);
2016
- for (l = d; l >= f; l--) {
2017
- T = e[l];
2018
- R = T ? n(T) : T;
2019
- a = _.get(R);
2020
- S[l] = a === undefined ? -1 : a;
2021
- _.set(R, l);
2105
+ d = new Array(T + 1);
2106
+ for (l = T; l >= f; l--) {
2107
+ S = e[l];
2108
+ O = S ? n(S) : S;
2109
+ a = _.get(O);
2110
+ d[l] = a === undefined ? -1 : a;
2111
+ _.set(O, l);
2022
2112
  }
2023
2113
  for (a = f; a <= E; a++) {
2024
- T = getOverrideValue(r, s, u, a, o);
2025
- R = T ? n(T) : T;
2026
- l = _.get(R);
2114
+ S = getOverrideValue(r, s, u, a, o);
2115
+ O = S ? n(S) : S;
2116
+ l = _.get(O);
2027
2117
  if (l !== undefined && l !== -1) {
2028
- O[l] = T;
2029
- l = S[l];
2030
- _.set(R, l);
2118
+ R[l] = S;
2119
+ l = d[l];
2120
+ _.set(O, l);
2031
2121
  }
2032
2122
  }
2033
2123
  for (l = f; l < e.length; l++) {
2034
- if (l in O) {
2035
- const t = wrap(O[l], i);
2124
+ if (l in R) {
2125
+ const t = wrap(R[l], i);
2036
2126
  i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], t);
2037
2127
  applyState(e[l], t, n);
2038
2128
  } else i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], wrap(e[l], i));
@@ -2060,12 +2150,12 @@ function applyState(e, t, n) {
2060
2150
  const l = c[a];
2061
2151
  const f = u[l];
2062
2152
  const E = unwrap(getOverrideValue(r, s, u, l, o));
2063
- let d = unwrap(e[l]);
2064
- if (E === d) continue;
2065
- if (!E || !isWrappable(E) || !isWrappable(d) || (n(E) != null && n(E) !== n(d))) {
2153
+ let T = unwrap(e[l]);
2154
+ if (E === T) continue;
2155
+ if (!E || !isWrappable(E) || !isWrappable(T) || (n(E) != null && n(E) !== n(T))) {
2066
2156
  t && setSignal(t, void 0);
2067
- f && setSignal(f, isWrappable(d) ? wrap(d, i) : d);
2068
- } else applyState(d, wrap(E, i), n);
2157
+ f && setSignal(f, isWrappable(T) ? wrap(T, i) : T);
2158
+ } else applyState(T, wrap(E, i), n);
2069
2159
  }
2070
2160
  }
2071
2161
  if ((u = i[STORE_HAS])) {
@@ -2086,7 +2176,7 @@ function reconcile(e, t) {
2086
2176
  applyState(e, n, i);
2087
2177
  };
2088
2178
  }
2089
- function createProjectionInternal(e, t = {}, n) {
2179
+ function createProjectionInternal(e, t, n) {
2090
2180
  let i;
2091
2181
  const r = new WeakMap();
2092
2182
  const wrapper = e => {
@@ -2108,28 +2198,35 @@ function createProjectionInternal(e, t = {}, n) {
2108
2198
  };
2109
2199
  const s = wrapProjection(t);
2110
2200
  i = computed(() => {
2111
- const t = getOwner();
2112
- let i = false;
2113
- let r;
2114
- const o = new Proxy(
2115
- s,
2116
- createWriteTraps(() => !i || t.ye === r)
2117
- );
2118
- storeSetter(o, o => {
2119
- r = e(o);
2120
- i = true;
2121
- const u = handleAsync(t, r, e => {
2122
- e !== o && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id"));
2123
- });
2124
- u !== o && u !== undefined && reconcile(u, n?.key || "id")(s);
2125
- });
2126
- });
2127
- i.Pe = true;
2201
+ if (!i) i = getOwner();
2202
+ runProjectionComputed(s, e, n?.key || "id");
2203
+ }, undefined);
2204
+ i.Ee &= ~CONFIG_AUTO_DISPOSE;
2128
2205
  return { store: s, node: i };
2129
2206
  }
2130
- function createProjection(e, t = {}, n) {
2207
+ function createProjection(e, t, n) {
2131
2208
  return createProjectionInternal(e, t, n).store;
2132
2209
  }
2210
+ function runProjectionComputed(e, t, n, i) {
2211
+ const r = getOwner();
2212
+ let s = false;
2213
+ let o;
2214
+ const u = new Proxy(
2215
+ e,
2216
+ createWriteTraps(() => !s || r.De === o)
2217
+ );
2218
+ storeSetter(u, u => {
2219
+ o = t(u);
2220
+ s = true;
2221
+ const commit = t => {
2222
+ if (t === u || t === undefined) return;
2223
+ const write = () => storeSetter(e, reconcile(t, n));
2224
+ i ? i(write) : write();
2225
+ };
2226
+ commit(handleAsync(r, o, commit));
2227
+ });
2228
+ return r;
2229
+ }
2133
2230
  function createWriteTraps(e) {
2134
2231
  const t = {
2135
2232
  get(e, n) {
@@ -2192,6 +2289,7 @@ const STORE_VALUE = "v",
2192
2289
  STORE_OPTIMISTIC_OVERRIDE = "x",
2193
2290
  STORE_NODE = "n",
2194
2291
  STORE_HAS = "h",
2292
+ STORE_CUSTOM_PROTO = "c",
2195
2293
  STORE_WRAP = "w",
2196
2294
  STORE_LOOKUP = "l",
2197
2295
  STORE_FIREWALL = "f",
@@ -2202,6 +2300,7 @@ function createStoreProxy(e, t = storeTraps, n) {
2202
2300
  i = [];
2203
2301
  i.v = e;
2204
2302
  } else i = { v: e };
2303
+ i[STORE_CUSTOM_PROTO] = hasCustomPrototype(unwrapStoreValue(e));
2205
2304
  n && n(i);
2206
2305
  return (i[$PROXY] = new Proxy(i, t));
2207
2306
  }
@@ -2227,6 +2326,23 @@ function setWriteOverride(e) {
2227
2326
  function writeOnly(e) {
2228
2327
  return writeOverride || !!Writing?.has(e);
2229
2328
  }
2329
+ function unwrapStoreValue(e) {
2330
+ return e?.[$TARGET]?.[STORE_VALUE] ?? e;
2331
+ }
2332
+ function hasCustomPrototype(e) {
2333
+ if (Array.isArray(e)) return false;
2334
+ const t = Object.getPrototypeOf(e);
2335
+ return t !== null && t !== Object.prototype;
2336
+ }
2337
+ function hasInheritedAccessor(e, t) {
2338
+ let n = Object.getPrototypeOf(e);
2339
+ while (n && n !== Object.prototype) {
2340
+ const e = Reflect.getOwnPropertyDescriptor(n, t);
2341
+ if (e) return !!e.get;
2342
+ n = Object.getPrototypeOf(n);
2343
+ }
2344
+ return false;
2345
+ }
2230
2346
  function getNodes(e, t) {
2231
2347
  let n = e[t];
2232
2348
  if (!n) e[t] = n = Object.create(null);
@@ -2239,13 +2355,13 @@ function getNode(e, t, n, i, r = isEqual, s, o) {
2239
2355
  {
2240
2356
  equals: r,
2241
2357
  unobserved() {
2242
- delete e[t];
2358
+ if (e[t] === u) delete e[t];
2243
2359
  }
2244
2360
  },
2245
2361
  i
2246
2362
  );
2247
2363
  if (s) {
2248
- u.ee = NOT_PENDING;
2364
+ u.G = NOT_PENDING;
2249
2365
  }
2250
2366
  if (o && t in o) {
2251
2367
  const e = o[t];
@@ -2282,8 +2398,8 @@ function getPropertyDescriptor(e, t, n) {
2282
2398
  function prepareStoreWrite(e, t, n) {
2283
2399
  if (e[STORE_OPTIMISTIC]) {
2284
2400
  const t = e[STORE_FIREWALL];
2285
- if (t?.K) {
2286
- globalQueue.initTransition(t.K);
2401
+ if (t?.Z) {
2402
+ globalQueue.initTransition(t.Z);
2287
2403
  }
2288
2404
  }
2289
2405
  const i = e[STORE_VALUE];
@@ -2291,7 +2407,7 @@ function prepareStoreWrite(e, t, n) {
2291
2407
  if (
2292
2408
  snapshotCaptureActive &&
2293
2409
  typeof n !== "symbol" &&
2294
- !((e[STORE_FIREWALL]?.Se ?? 0) & STATUS_PENDING)
2410
+ !((e[STORE_FIREWALL]?.Oe ?? 0) & STATUS_PENDING)
2295
2411
  ) {
2296
2412
  if (!e[STORE_SNAPSHOT_PROPS]) {
2297
2413
  e[STORE_SNAPSHOT_PROPS] = Object.create(null);
@@ -2306,20 +2422,45 @@ function prepareStoreWrite(e, t, n) {
2306
2422
  if (s) trackOptimisticStore(t);
2307
2423
  return { base: r, overrideKey: o, state: i };
2308
2424
  }
2309
- function notifyStoreProperty(e, t, n, i) {
2310
- if (e[STORE_HAS]?.[t]) setSignal(e[STORE_HAS][t], n !== "delete");
2311
- const r = getNodes(e, STORE_NODE);
2425
+ function upsertStoreNode(e, t, n, i, r) {
2426
+ if (t[n]) return t[n];
2427
+ const s = isWrappable(i) ? wrap(i, e) : i;
2428
+ const o = getNode(t, n, s, e[STORE_FIREWALL], isEqual, e[STORE_OPTIMISTIC], r);
2429
+ registerTransientStoreNode(o);
2430
+ return o;
2431
+ }
2432
+ function notifyStoreProperty(e, t, n, i, r, s) {
2433
+ const o = projectionWriteActive || e[STORE_OPTIMISTIC];
2434
+ const u = n !== "delete";
2435
+ const c = e[STORE_HAS]?.[t];
2436
+ if (c) {
2437
+ setSignal(c, u);
2438
+ } else if (!o && n !== "invalidate" && s !== u) {
2439
+ const n = upsertStoreNode(e, getNodes(e, STORE_HAS), t, s);
2440
+ setSignal(n, u);
2441
+ }
2442
+ const a = getNodes(e, STORE_NODE);
2312
2443
  if (n === "set") {
2313
- r[t] && setSignal(r[t], () => (isWrappable(i) ? wrap(i, e) : i));
2444
+ if (a[t]) {
2445
+ setSignal(a[t], () => (isWrappable(i) ? wrap(i, e) : i));
2446
+ } else if (!o) {
2447
+ const n = upsertStoreNode(e, a, t, r, e[STORE_SNAPSHOT_PROPS]);
2448
+ setSignal(n, () => (isWrappable(i) ? wrap(i, e) : i));
2449
+ }
2314
2450
  } else if (n === "invalidate") {
2315
- if (r[t]) {
2316
- setSignal(r[t], {});
2317
- delete r[t];
2451
+ if (a[t]) {
2452
+ setSignal(a[t], {});
2453
+ delete a[t];
2318
2454
  }
2319
2455
  } else {
2320
- r[t] && setSignal(r[t], undefined);
2456
+ if (a[t]) {
2457
+ setSignal(a[t], undefined);
2458
+ } else if (!o) {
2459
+ const n = upsertStoreNode(e, a, t, r, e[STORE_SNAPSHOT_PROPS]);
2460
+ setSignal(n, undefined);
2461
+ }
2321
2462
  }
2322
- r[$TRACK] && setSignal(r[$TRACK], undefined);
2463
+ a[$TRACK] && setSignal(a[$TRACK], undefined);
2323
2464
  }
2324
2465
  let Writing = null;
2325
2466
  const storeTraps = {
@@ -2342,17 +2483,23 @@ const storeTraps = {
2342
2483
  ? e[STORE_OVERRIDE]
2343
2484
  : e[STORE_VALUE];
2344
2485
  if (!r) {
2345
- const e = Object.getOwnPropertyDescriptor(c, t);
2346
- if (e && e.get) return e.get.call(n);
2486
+ const i = Object.getOwnPropertyDescriptor(c, t);
2487
+ if (i && i.get) return i.get.call(n);
2488
+ if (!i && !o && e[STORE_CUSTOM_PROTO]) {
2489
+ const e = unwrapStoreValue(c);
2490
+ if (hasInheritedAccessor(e, t)) {
2491
+ return Reflect.get(c, t, n);
2492
+ }
2493
+ }
2347
2494
  }
2348
2495
  if (writeOnly(n)) {
2349
2496
  let n =
2350
2497
  r && (o || !u)
2351
- ? r.ee !== undefined && r.ee !== NOT_PENDING
2352
- ? r.ee
2353
- : r.X !== NOT_PENDING
2354
- ? r.X
2355
- : r.J
2498
+ ? r.G !== undefined && r.G !== NOT_PENDING
2499
+ ? r.G
2500
+ : r.U !== NOT_PENDING
2501
+ ? r.U
2502
+ : r.ne
2356
2503
  : c[t];
2357
2504
  n === $DELETED && (n = undefined);
2358
2505
  if (!isWrappable(n)) return n;
@@ -2394,11 +2541,11 @@ const storeTraps = {
2394
2541
  : e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
2395
2542
  ? e[STORE_OVERRIDE][t] !== $DELETED
2396
2543
  : t in e[STORE_VALUE];
2397
- if (!writeOnly(e[$PROXY])) {
2398
- getObserver() &&
2399
- read(
2400
- getNode(getNodes(e, STORE_HAS), t, n, e[STORE_FIREWALL], isEqual, e[STORE_OPTIMISTIC])
2401
- );
2544
+ if (writeOnly(e[$PROXY])) return n;
2545
+ const i = getNodes(e, STORE_HAS);
2546
+ if (i[t]) return read(i[t]);
2547
+ if (getObserver()) {
2548
+ return read(getNode(i, t, n, e[STORE_FIREWALL], isEqual, e[STORE_OPTIMISTIC]));
2402
2549
  }
2403
2550
  return n;
2404
2551
  },
@@ -2413,29 +2560,39 @@ const storeTraps = {
2413
2560
  : e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
2414
2561
  ? e[STORE_OVERRIDE][t]
2415
2562
  : r;
2416
- const c = n?.[$TARGET]?.[STORE_VALUE] ?? n;
2417
- const a = Array.isArray(o) && t !== "length";
2418
- const l = a ? parseInt(t) + 1 : 0;
2419
- const f =
2420
- a &&
2563
+ const c =
2564
+ e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE]
2565
+ ? e[STORE_OPTIMISTIC_OVERRIDE][t] !== $DELETED
2566
+ : e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
2567
+ ? e[STORE_OVERRIDE][t] !== $DELETED
2568
+ : t in e[STORE_VALUE];
2569
+ const a = unwrapStoreValue(n);
2570
+ const l = Array.isArray(o) && t !== "length";
2571
+ const f = l ? parseInt(t) + 1 : 0;
2572
+ const E =
2573
+ l &&
2421
2574
  (e[STORE_OPTIMISTIC_OVERRIDE] && "length" in e[STORE_OPTIMISTIC_OVERRIDE]
2422
2575
  ? e[STORE_OPTIMISTIC_OVERRIDE].length
2423
2576
  : e[STORE_OVERRIDE] && "length" in e[STORE_OVERRIDE]
2424
2577
  ? e[STORE_OVERRIDE].length
2425
2578
  : o.length);
2426
- const E = a && l > f ? l : undefined;
2427
- if (u === c && E === undefined) return true;
2428
- if (c !== undefined && c === r && E === undefined) delete e[s]?.[t];
2579
+ const T = l && f > E ? f : undefined;
2580
+ if (u === a && T === undefined) return true;
2581
+ if (a !== undefined && a === r && T === undefined) delete e[s]?.[t];
2429
2582
  else {
2430
2583
  const n = e[s] || (e[s] = Object.create(null));
2431
- n[t] = c;
2432
- if (E !== undefined) n.length = E;
2584
+ n[t] = a;
2585
+ if (T !== undefined) n.length = T;
2433
2586
  }
2434
- notifyStoreProperty(e, t, "set", c);
2435
- if (Array.isArray(o)) {
2436
- const n = getNodes(e, STORE_NODE);
2437
- const i = t === "length" ? c : E;
2438
- i !== undefined && n.length && setSignal(n.length, i);
2587
+ notifyStoreProperty(e, t, "set", a, u, c);
2588
+ if (Array.isArray(o) && t !== "length" && T !== undefined) {
2589
+ const t = getNodes(e, STORE_NODE);
2590
+ if (t.length) {
2591
+ setSignal(t.length, T);
2592
+ } else if (!projectionWriteActive && !e[STORE_OPTIMISTIC]) {
2593
+ const n = upsertStoreNode(e, t, "length", E, e[STORE_SNAPSHOT_PROPS]);
2594
+ setSignal(n, T);
2595
+ }
2439
2596
  }
2440
2597
  if (false);
2441
2598
  });
@@ -2447,7 +2604,7 @@ const storeTraps = {
2447
2604
  if (writeOnly(i)) {
2448
2605
  untrack(() => {
2449
2606
  const { base: r, overrideKey: s } = prepareStoreWrite(e, i, t);
2450
- const o = "value" in n ? { ...n, value: n.value?.[$TARGET]?.[STORE_VALUE] ?? n.value } : n;
2607
+ const o = "value" in n ? { ...n, value: unwrapStoreValue(n.value) } : n;
2451
2608
  Object.defineProperty(e[s] || (e[s] = Object.create(null)), t, o);
2452
2609
  notifyStoreProperty(e, t, "invalidate");
2453
2610
  if (false);
@@ -2474,7 +2631,7 @@ const storeTraps = {
2474
2631
  } else if (e[i] && t in e[i]) {
2475
2632
  delete e[i][t];
2476
2633
  } else return true;
2477
- notifyStoreProperty(e, t, "delete");
2634
+ notifyStoreProperty(e, t, "delete", undefined, r, true);
2478
2635
  });
2479
2636
  }
2480
2637
  return true;
@@ -2544,9 +2701,9 @@ function createStore(e, t, n) {
2544
2701
  return [r, e => storeSetter(r, e)];
2545
2702
  }
2546
2703
  function createOptimisticStore(e, t, n) {
2547
- GlobalQueue.ce ||= clearOptimisticStore;
2704
+ GlobalQueue.le ||= clearOptimisticStore;
2548
2705
  const i = typeof e === "function";
2549
- const r = (i ? t : e) ?? {};
2706
+ const r = i ? t : e;
2550
2707
  const s = i ? e : undefined;
2551
2708
  const { store: o } = createOptimisticProjectionInternal(s, r, n);
2552
2709
  return [o, e => storeSetter(o, e)];
@@ -2561,7 +2718,7 @@ function clearOptimisticStore(e) {
2561
2718
  if (i) {
2562
2719
  for (const e of Reflect.ownKeys(n)) {
2563
2720
  if (i[e]) {
2564
- i[e].q = undefined;
2721
+ i[e].te = undefined;
2565
2722
  const n =
2566
2723
  t[STORE_OVERRIDE] && e in t[STORE_OVERRIDE] ? t[STORE_OVERRIDE][e] : t[STORE_VALUE][e];
2567
2724
  const r = n === $DELETED ? undefined : n;
@@ -2569,7 +2726,7 @@ function clearOptimisticStore(e) {
2569
2726
  }
2570
2727
  }
2571
2728
  if (i[$TRACK]) {
2572
- i[$TRACK].q = undefined;
2729
+ i[$TRACK].te = undefined;
2573
2730
  setSignal(i[$TRACK], undefined);
2574
2731
  }
2575
2732
  }
@@ -2578,7 +2735,7 @@ function clearOptimisticStore(e) {
2578
2735
  }
2579
2736
  delete t[STORE_OPTIMISTIC_OVERRIDE];
2580
2737
  }
2581
- function createOptimisticProjectionInternal(e, t = {}, n) {
2738
+ function createOptimisticProjectionInternal(e, t, n) {
2582
2739
  let i;
2583
2740
  const r = new WeakMap();
2584
2741
  const wrapper = e => {
@@ -2601,38 +2758,30 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
2601
2758
  };
2602
2759
  const s = wrapProjection(t);
2603
2760
  if (e) {
2761
+ const wrapCommit = e => {
2762
+ setProjectionWriteActive(true);
2763
+ try {
2764
+ e();
2765
+ } finally {
2766
+ setProjectionWriteActive(false);
2767
+ }
2768
+ };
2604
2769
  i = computed(() => {
2605
- const t = getOwner();
2606
- let i = false;
2607
- let r;
2608
- const o = new Proxy(
2609
- s,
2610
- createWriteTraps(() => !i || t.ye === r)
2611
- );
2612
2770
  setProjectionWriteActive(true);
2613
2771
  try {
2614
- storeSetter(o, o => {
2615
- r = e(o);
2616
- i = true;
2617
- const u = handleAsync(t, r, e => {
2618
- setProjectionWriteActive(true);
2619
- try {
2620
- e !== o && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id"));
2621
- } finally {
2622
- setProjectionWriteActive(false);
2623
- }
2624
- });
2625
- u !== o && u !== undefined && reconcile(u, n?.key || "id")(s);
2626
- });
2772
+ runProjectionComputed(s, e, n?.key || "id", wrapCommit);
2627
2773
  } finally {
2628
2774
  setProjectionWriteActive(false);
2629
2775
  }
2630
- });
2631
- i.Pe = true;
2776
+ }, undefined);
2777
+ i.Ee &= ~CONFIG_AUTO_DISPOSE;
2632
2778
  }
2633
2779
  return { store: s, node: i };
2634
2780
  }
2635
2781
  const DELETE = Symbol(0);
2782
+ function isPrototypePollutionKey(e) {
2783
+ return e === "__proto__" || e === "constructor" || e === "prototype";
2784
+ }
2636
2785
  function updatePath(e, t, n = 0) {
2637
2786
  let i,
2638
2787
  r = e;
@@ -2640,6 +2789,7 @@ function updatePath(e, t, n = 0) {
2640
2789
  i = t[n];
2641
2790
  const s = typeof i;
2642
2791
  const o = Array.isArray(e);
2792
+ if (s === "string" && isPrototypePollutionKey(i)) return;
2643
2793
  if (Array.isArray(i)) {
2644
2794
  for (let r = 0; r < i.length; r++) {
2645
2795
  t[n] = i[r];
@@ -2683,6 +2833,7 @@ function updatePath(e, t, n = 0) {
2683
2833
  const n = Object.keys(s);
2684
2834
  for (let e = 0; e < n.length; e++) {
2685
2835
  const i = n[e];
2836
+ if (isPrototypePollutionKey(i)) continue;
2686
2837
  const r = Object.getOwnPropertyDescriptor(s, i);
2687
2838
  if (r.get || r.set) Object.defineProperty(t, i, r);
2688
2839
  else t[i] = r.value;
@@ -2888,67 +3039,69 @@ function mapArray(e, t, n) {
2888
3039
  const i = typeof n?.keyed === "function" ? n.keyed : undefined;
2889
3040
  const r = t.length > 1;
2890
3041
  const s = t;
2891
- return createMemo(
2892
- updateKeyedMap.bind({
2893
- Ye: createOwner(),
2894
- Ze: 0,
2895
- Be: e,
2896
- qe: [],
2897
- Xe: s,
2898
- ze: [],
2899
- Je: [],
2900
- et: i,
2901
- tt: i || n?.keyed === false ? [] : undefined,
2902
- nt: r ? [] : undefined,
2903
- it: n?.fallback
2904
- })
2905
- );
3042
+ const o = {
3043
+ je: createOwner(),
3044
+ $e: 0,
3045
+ Ke: e,
3046
+ Ye: [],
3047
+ Be: s,
3048
+ Ze: [],
3049
+ qe: [],
3050
+ ze: i,
3051
+ Xe: i || n?.keyed === false ? [] : undefined,
3052
+ Je: r ? [] : undefined,
3053
+ et: n?.fallback
3054
+ };
3055
+ const u = computed(updateKeyedMap.bind(o));
3056
+ o.je.u = u;
3057
+ u.Ee &= ~CONFIG_AUTO_DISPOSE;
3058
+ return accessor(u);
2906
3059
  }
2907
- const pureOptions = { pureWrite: true };
3060
+ const pureOptions = { ownedWrite: true };
2908
3061
  function updateKeyedMap() {
2909
- const e = this.Be() || [],
3062
+ const e = this.Ke() || [],
2910
3063
  t = e.length;
2911
3064
  e[$TRACK];
2912
- runWithOwner(this.Ye, () => {
3065
+ runWithOwner(this.je, () => {
2913
3066
  let n,
2914
3067
  i,
2915
- r = this.tt
3068
+ r = this.Xe
2916
3069
  ? () => {
2917
- this.tt[i] = signal(e[i], pureOptions);
2918
- this.nt && (this.nt[i] = signal(i, pureOptions));
2919
- return this.Xe(accessor(this.tt[i]), this.nt ? accessor(this.nt[i]) : undefined);
3070
+ this.Xe[i] = signal(e[i], pureOptions);
3071
+ this.Je && (this.Je[i] = signal(i, pureOptions));
3072
+ return this.Be(accessor(this.Xe[i]), this.Je ? accessor(this.Je[i]) : undefined);
2920
3073
  }
2921
- : this.nt
3074
+ : this.Je
2922
3075
  ? () => {
2923
3076
  const t = e[i];
2924
- this.nt[i] = signal(i, pureOptions);
2925
- return this.Xe(() => t, accessor(this.nt[i]));
3077
+ this.Je[i] = signal(i, pureOptions);
3078
+ return this.Be(() => t, accessor(this.Je[i]));
2926
3079
  }
2927
3080
  : () => {
2928
3081
  const t = e[i];
2929
- return this.Xe(() => t);
3082
+ return this.Be(() => t);
2930
3083
  };
2931
3084
  if (t === 0) {
2932
- if (this.Ze !== 0) {
2933
- this.Ye.dispose(false);
2934
- this.Je = [];
3085
+ if (this.$e !== 0) {
3086
+ this.je.dispose(false);
2935
3087
  this.qe = [];
2936
- this.ze = [];
2937
- this.Ze = 0;
2938
- this.tt && (this.tt = []);
2939
- this.nt && (this.nt = []);
2940
- }
2941
- if (this.it && !this.ze[0]) {
2942
- this.ze[0] = runWithOwner((this.Je[0] = createOwner()), this.it);
2943
- }
2944
- } else if (this.Ze === 0) {
2945
- if (this.Je[0]) this.Je[0].dispose();
2946
- this.ze = new Array(t);
3088
+ this.Ye = [];
3089
+ this.Ze = [];
3090
+ this.$e = 0;
3091
+ this.Xe && (this.Xe = []);
3092
+ this.Je && (this.Je = []);
3093
+ }
3094
+ if (this.et && !this.Ze[0]) {
3095
+ this.Ze[0] = runWithOwner((this.qe[0] = createOwner()), this.et);
3096
+ }
3097
+ } else if (this.$e === 0) {
3098
+ if (this.qe[0]) this.qe[0].dispose();
3099
+ this.Ze = new Array(t);
2947
3100
  for (i = 0; i < t; i++) {
2948
- this.qe[i] = e[i];
2949
- this.ze[i] = runWithOwner((this.Je[i] = createOwner()), r);
3101
+ this.Ye[i] = e[i];
3102
+ this.Ze[i] = runWithOwner((this.qe[i] = createOwner()), r);
2950
3103
  }
2951
- this.Ze = t;
3104
+ this.$e = t;
2952
3105
  } else {
2953
3106
  let s,
2954
3107
  o,
@@ -2958,153 +3111,157 @@ function updateKeyedMap() {
2958
3111
  l,
2959
3112
  f,
2960
3113
  E = new Array(t),
2961
- d = new Array(t),
2962
- T = this.tt ? new Array(t) : undefined,
2963
- S = this.nt ? new Array(t) : undefined;
3114
+ T = new Array(t),
3115
+ S = this.Xe ? new Array(t) : undefined,
3116
+ d = this.Je ? new Array(t) : undefined;
2964
3117
  for (
2965
- s = 0, o = Math.min(this.Ze, t);
2966
- s < o && (this.qe[s] === e[s] || (this.tt && compare(this.et, this.qe[s], e[s])));
3118
+ s = 0, o = Math.min(this.$e, t);
3119
+ s < o && (this.Ye[s] === e[s] || (this.Xe && compare(this.ze, this.Ye[s], e[s])));
2967
3120
  s++
2968
3121
  ) {
2969
- if (this.tt) setSignal(this.tt[s], e[s]);
3122
+ if (this.Xe) setSignal(this.Xe[s], e[s]);
2970
3123
  }
2971
3124
  for (
2972
- o = this.Ze - 1, u = t - 1;
3125
+ o = this.$e - 1, u = t - 1;
2973
3126
  o >= s &&
2974
3127
  u >= s &&
2975
- (this.qe[o] === e[u] || (this.tt && compare(this.et, this.qe[o], e[u])));
3128
+ (this.Ye[o] === e[u] || (this.Xe && compare(this.ze, this.Ye[o], e[u])));
2976
3129
  o--, u--
2977
3130
  ) {
2978
- E[u] = this.ze[o];
2979
- d[u] = this.Je[o];
2980
- T && (T[u] = this.tt[o]);
2981
- S && (S[u] = this.nt[o]);
3131
+ E[u] = this.Ze[o];
3132
+ T[u] = this.qe[o];
3133
+ S && (S[u] = this.Xe[o]);
3134
+ d && (d[u] = this.Je[o]);
2982
3135
  }
2983
3136
  l = new Map();
2984
3137
  f = new Array(u + 1);
2985
3138
  for (i = u; i >= s; i--) {
2986
3139
  c = e[i];
2987
- a = this.et ? this.et(c) : c;
3140
+ a = this.ze ? this.ze(c) : c;
2988
3141
  n = l.get(a);
2989
3142
  f[i] = n === undefined ? -1 : n;
2990
3143
  l.set(a, i);
2991
3144
  }
2992
3145
  for (n = s; n <= o; n++) {
2993
- c = this.qe[n];
2994
- a = this.et ? this.et(c) : c;
3146
+ c = this.Ye[n];
3147
+ a = this.ze ? this.ze(c) : c;
2995
3148
  i = l.get(a);
2996
3149
  if (i !== undefined && i !== -1) {
2997
- E[i] = this.ze[n];
2998
- d[i] = this.Je[n];
2999
- T && (T[i] = this.tt[n]);
3000
- S && (S[i] = this.nt[n]);
3150
+ E[i] = this.Ze[n];
3151
+ T[i] = this.qe[n];
3152
+ S && (S[i] = this.Xe[n]);
3153
+ d && (d[i] = this.Je[n]);
3001
3154
  i = f[i];
3002
3155
  l.set(a, i);
3003
- } else this.Je[n].dispose();
3156
+ } else this.qe[n].dispose();
3004
3157
  }
3005
3158
  for (i = s; i < t; i++) {
3006
3159
  if (i in E) {
3007
- this.ze[i] = E[i];
3008
- this.Je[i] = d[i];
3009
- if (T) {
3010
- this.tt[i] = T[i];
3011
- setSignal(this.tt[i], e[i]);
3012
- }
3160
+ this.Ze[i] = E[i];
3161
+ this.qe[i] = T[i];
3013
3162
  if (S) {
3014
- this.nt[i] = S[i];
3015
- setSignal(this.nt[i], i);
3163
+ this.Xe[i] = S[i];
3164
+ setSignal(this.Xe[i], e[i]);
3165
+ }
3166
+ if (d) {
3167
+ this.Je[i] = d[i];
3168
+ setSignal(this.Je[i], i);
3016
3169
  }
3017
3170
  } else {
3018
- this.ze[i] = runWithOwner((this.Je[i] = createOwner()), r);
3171
+ this.Ze[i] = runWithOwner((this.qe[i] = createOwner()), r);
3019
3172
  }
3020
3173
  }
3021
- this.ze = this.ze.slice(0, (this.Ze = t));
3022
- this.qe = e.slice(0);
3174
+ this.Ze = this.Ze.slice(0, (this.$e = t));
3175
+ this.Ye = e.slice(0);
3023
3176
  }
3024
3177
  });
3025
- return this.ze;
3178
+ return this.Ze;
3026
3179
  }
3027
3180
  function repeat(e, t, n) {
3028
3181
  const i = t;
3029
- return updateRepeat.bind({
3030
- Ye: createOwner(),
3031
- Ze: 0,
3032
- rt: 0,
3033
- st: e,
3034
- Xe: i,
3035
- Je: [],
3036
- ze: [],
3037
- ot: n?.from,
3038
- it: n?.fallback
3039
- });
3182
+ const r = computed(
3183
+ updateRepeat.bind({
3184
+ je: createOwner(),
3185
+ $e: 0,
3186
+ tt: 0,
3187
+ nt: e,
3188
+ Be: i,
3189
+ qe: [],
3190
+ Ze: [],
3191
+ it: n?.from,
3192
+ et: n?.fallback
3193
+ })
3194
+ );
3195
+ r.Ee &= ~CONFIG_AUTO_DISPOSE;
3196
+ return accessor(r);
3040
3197
  }
3041
3198
  function updateRepeat() {
3042
- const e = this.st();
3043
- const t = this.ot?.() || 0;
3044
- runWithOwner(this.Ye, () => {
3199
+ const e = this.nt();
3200
+ const t = this.it?.() || 0;
3201
+ runWithOwner(this.je, () => {
3045
3202
  if (e === 0) {
3046
- if (this.Ze !== 0) {
3047
- this.Ye.dispose(false);
3048
- this.Je = [];
3049
- this.ze = [];
3050
- this.Ze = 0;
3203
+ if (this.$e !== 0) {
3204
+ this.je.dispose(false);
3205
+ this.qe = [];
3206
+ this.Ze = [];
3207
+ this.$e = 0;
3051
3208
  }
3052
- if (this.it && !this.ze[0]) {
3053
- this.ze[0] = runWithOwner((this.Je[0] = createOwner()), this.it);
3209
+ if (this.et && !this.Ze[0]) {
3210
+ this.Ze[0] = runWithOwner((this.qe[0] = createOwner()), this.et);
3054
3211
  }
3055
3212
  return;
3056
3213
  }
3057
3214
  const n = t + e;
3058
- const i = this.rt + this.Ze;
3059
- if (this.Ze === 0 && this.Je[0]) this.Je[0].dispose();
3060
- for (let e = n; e < i; e++) this.Je[e - this.rt].dispose();
3061
- if (this.rt < t) {
3062
- let e = this.rt;
3063
- while (e < t && e < this.Ze) this.Je[e++].dispose();
3064
- this.Je.splice(0, t - this.rt);
3065
- this.ze.splice(0, t - this.rt);
3066
- } else if (this.rt > t) {
3067
- let n = i - this.rt - 1;
3068
- let r = this.rt - t;
3069
- this.Je.length = this.ze.length = e;
3215
+ const i = this.tt + this.$e;
3216
+ if (this.$e === 0 && this.qe[0]) this.qe[0].dispose();
3217
+ for (let e = n; e < i; e++) this.qe[e - this.tt].dispose();
3218
+ if (this.tt < t) {
3219
+ let e = this.tt;
3220
+ while (e < t && e < this.$e) this.qe[e++].dispose();
3221
+ this.qe.splice(0, t - this.tt);
3222
+ this.Ze.splice(0, t - this.tt);
3223
+ } else if (this.tt > t) {
3224
+ let n = i - this.tt - 1;
3225
+ let r = this.tt - t;
3226
+ this.qe.length = this.Ze.length = e;
3070
3227
  while (n >= r) {
3071
- this.Je[n] = this.Je[n - r];
3072
- this.ze[n] = this.ze[n - r];
3228
+ this.qe[n] = this.qe[n - r];
3229
+ this.Ze[n] = this.Ze[n - r];
3073
3230
  n--;
3074
3231
  }
3075
3232
  for (let e = 0; e < r; e++) {
3076
- this.ze[e] = runWithOwner((this.Je[e] = createOwner()), () => this.Xe(e + t));
3233
+ this.Ze[e] = runWithOwner((this.qe[e] = createOwner()), () => this.Be(e + t));
3077
3234
  }
3078
3235
  }
3079
3236
  for (let e = i; e < n; e++) {
3080
- this.ze[e - t] = runWithOwner((this.Je[e - t] = createOwner()), () => this.Xe(e));
3237
+ this.Ze[e - t] = runWithOwner((this.qe[e - t] = createOwner()), () => this.Be(e));
3081
3238
  }
3082
- this.ze = this.ze.slice(0, e);
3083
- this.rt = t;
3084
- this.Ze = e;
3239
+ this.Ze = this.Ze.slice(0, e);
3240
+ this.tt = t;
3241
+ this.$e = e;
3085
3242
  });
3086
- return this.ze;
3243
+ return this.Ze;
3087
3244
  }
3088
3245
  function compare(e, t, n) {
3089
3246
  return e ? e(t) === e(n) : true;
3090
3247
  }
3091
3248
  function boundaryComputed(e, t) {
3092
- const n = computed(e, undefined, { lazy: true });
3249
+ const n = computed(e, { lazy: true });
3093
3250
  n.Ge = (e, t) => {
3094
- const i = e !== undefined ? e : n.Se;
3095
- const r = t !== undefined ? t : n.fe;
3096
- n.Se &= ~n.ut;
3097
- n.F.notify(n, n.ut, i, r);
3251
+ const i = e !== undefined ? e : n.Oe;
3252
+ const r = t !== undefined ? t : n.Te;
3253
+ n.Oe &= ~n.rt;
3254
+ n.$.notify(n, n.rt, i, r);
3098
3255
  };
3099
- n.ut = t;
3100
- n.Pe = true;
3256
+ n.rt = t;
3257
+ n.Ee &= ~CONFIG_AUTO_DISPOSE;
3101
3258
  recompute(n, true);
3102
3259
  return n;
3103
3260
  }
3104
3261
  function createBoundChildren(e, t, n, i) {
3105
- const r = e.F;
3106
- r.addChild((e.F = n));
3107
- cleanup(() => r.removeChild(e.F));
3262
+ const r = e.$;
3263
+ r.addChild((e.$ = n));
3264
+ cleanup(() => r.removeChild(e.$));
3108
3265
  return runWithOwner(e, () => {
3109
3266
  const e = computed(t);
3110
3267
  return boundaryComputed(() => staleValues(() => flatten(read(e))), i);
@@ -3114,168 +3271,215 @@ const ON_INIT = Symbol();
3114
3271
  const RevealControllerContext = createContext(null);
3115
3272
  let _revealUsed = false;
3116
3273
  const FALSE_ACCESSOR = () => false;
3274
+ const SEQUENTIAL_ACCESSOR = () => "sequential";
3117
3275
  function isRevealController(e) {
3118
3276
  return e instanceof RevealController;
3119
3277
  }
3120
3278
  function isSlotReady(e) {
3121
- return isRevealController(e) ? e.isReady() : e.ct.size === 0 && !e.lt;
3279
+ return isRevealController(e) ? e.isReady() : e.st.size === 0 && !e.ot;
3280
+ }
3281
+ function isSlotMinimallyReady(e) {
3282
+ return isRevealController(e) ? e.isMinimallyReady() : isSlotReady(e);
3122
3283
  }
3123
3284
  function setSlotState(e, t, n, i) {
3124
- setSignal(e.ft, n);
3125
- setSignal(e.Et, i);
3285
+ setSignal(e.ut, n);
3286
+ setSignal(e.ct, i);
3126
3287
  if (isRevealController(e)) {
3127
- if (!n && e.dt === t) e.dt = undefined;
3288
+ if (!n && e.lt === t) e.lt = undefined;
3128
3289
  return e.evaluate(n, i);
3129
3290
  }
3130
- if (!n && e.Tt === t && e.St) e.Tt = undefined;
3291
+ if (!n && e.ft === t && e.Et) e.ft = undefined;
3131
3292
  }
3132
3293
  class RevealController {
3133
- Rt;
3134
- Ot;
3135
- _t = [];
3136
- dt;
3137
- ft = signal(false, { pureWrite: true, He: true });
3138
- Et = signal(false, { pureWrite: true, He: true });
3139
- It = true;
3140
- ht = false;
3294
+ Tt;
3295
+ St;
3296
+ dt = [];
3297
+ lt;
3298
+ ut = signal(false, { ownedWrite: true, Fe: true });
3299
+ ct = signal(false, { ownedWrite: true, Fe: true });
3300
+ Ot = true;
3301
+ Rt = true;
3302
+ _t = false;
3141
3303
  constructor(e, t) {
3142
- this.Rt = e;
3143
- this.Ot = t;
3304
+ this.Tt = e;
3305
+ this.St = t;
3144
3306
  }
3145
- At(e) {
3146
- for (let t = 0; t < this._t.length; t++) {
3147
- const n = this._t[t];
3148
- if ((isRevealController(n) ? n.dt : n.Tt) !== this) continue;
3307
+ It(e) {
3308
+ for (let t = 0; t < this.dt.length; t++) {
3309
+ const n = this.dt[t];
3310
+ if ((isRevealController(n) ? n.lt : n.ft) !== this) continue;
3149
3311
  if (e(n) === false) return false;
3150
3312
  }
3151
3313
  return true;
3152
3314
  }
3153
3315
  isReady() {
3154
- return this.At(isSlotReady);
3316
+ return this.It(isSlotReady);
3317
+ }
3318
+ isMinimallyReady() {
3319
+ const e = untrack(this.Tt);
3320
+ if (e === "together") return this.isReady();
3321
+ if (e === "natural") {
3322
+ let e = false;
3323
+ let t = false;
3324
+ this.It(n => {
3325
+ e = true;
3326
+ if (isSlotMinimallyReady(n)) {
3327
+ t = true;
3328
+ return false;
3329
+ }
3330
+ });
3331
+ return !e || t;
3332
+ }
3333
+ let t = true;
3334
+ this.It(e => {
3335
+ t = isSlotMinimallyReady(e);
3336
+ return false;
3337
+ });
3338
+ return t;
3155
3339
  }
3156
3340
  register(e) {
3157
- if (this._t.includes(e)) return;
3158
- this._t.push(e);
3159
- const t = !!untrack(this.Rt);
3160
- setSignal(e.ft, true), setSignal(e.Et, t ? false : !!untrack(this.Ot));
3341
+ if (this.dt.includes(e)) return;
3342
+ this.dt.push(e);
3343
+ const t = untrack(this.Tt);
3344
+ (setSignal(e.ut, true), setSignal(e.ct, t === "sequential" ? !!untrack(this.St) : false));
3161
3345
  untrack(() => this.evaluate());
3162
3346
  }
3163
3347
  unregister(e) {
3164
- const t = this._t.indexOf(e);
3165
- if (t >= 0) this._t.splice(t, 1);
3348
+ const t = this.dt.indexOf(e);
3349
+ if (t >= 0) this.dt.splice(t, 1);
3166
3350
  untrack(() => this.evaluate());
3167
3351
  }
3168
3352
  evaluate(e, t) {
3169
- if (this.ht) return;
3170
- this.ht = true;
3171
- const n = this.It;
3353
+ if (this._t) return;
3354
+ this._t = true;
3355
+ const n = this.Ot;
3356
+ const i = this.Rt;
3172
3357
  try {
3173
- const n = e ?? read(this.ft),
3174
- i = !!untrack(this.Ot),
3175
- r = t ?? i;
3176
- if (n && r) this.At(e => setSlotState(e, this, true, true));
3177
- else if (!!untrack(this.Rt)) {
3178
- const e = this.isReady();
3179
- this.At(t => setSlotState(t, this, !e, false));
3358
+ const n = e ?? read(this.ut),
3359
+ i = untrack(this.Tt),
3360
+ r = i === "sequential" && !!untrack(this.St),
3361
+ s = t ?? r;
3362
+ if (n) {
3363
+ this.It(e => setSlotState(e, this, true, s));
3364
+ } else if (i === "natural") {
3365
+ this.It(e => {
3366
+ if (isRevealController(e)) {
3367
+ setSignal(e.ct, false);
3368
+ setSignal(e.ut, false);
3369
+ e.evaluate(false, false);
3370
+ } else {
3371
+ setSlotState(e, this, !isSlotReady(e), false);
3372
+ }
3373
+ });
3374
+ } else if (i === "together") {
3375
+ const e = this.It(isSlotMinimallyReady);
3376
+ this.It(t => setSlotState(t, this, !e, false));
3180
3377
  } else {
3181
3378
  let e = false;
3182
- this.At(t => {
3183
- if (e) return setSlotState(t, this, true, i);
3379
+ this.It(t => {
3380
+ if (e) return setSlotState(t, this, true, r);
3184
3381
  if (isSlotReady(t)) return setSlotState(t, this, false, false);
3185
3382
  e = true;
3186
- setSlotState(t, this, true, false);
3383
+ if (isRevealController(t)) {
3384
+ setSignal(t.ct, false);
3385
+ setSignal(t.ut, false);
3386
+ t.evaluate(false, false);
3387
+ } else {
3388
+ setSlotState(t, this, true, false);
3389
+ }
3187
3390
  });
3188
3391
  }
3189
3392
  } finally {
3190
- this.It = this.isReady();
3191
- this.ht = false;
3393
+ this.Ot = this.isReady();
3394
+ this.Rt = this.isMinimallyReady();
3395
+ this._t = false;
3192
3396
  }
3193
- if (this.dt && n !== this.It) this.dt.evaluate();
3397
+ if (this.lt && (n !== this.Ot || i !== this.Rt)) this.lt.evaluate();
3194
3398
  }
3195
3399
  }
3196
3400
  class CollectionQueue extends Queue {
3401
+ ht;
3402
+ st = new Set();
3197
3403
  Nt;
3198
- ct = new Set();
3199
- Pt;
3200
- lt = true;
3201
- ft = signal(false, { pureWrite: true, He: true });
3202
- Et = signal(false, { pureWrite: true, He: true });
3203
- Tt;
3204
- St = false;
3205
- gt;
3206
- Ct = ON_INIT;
3404
+ ot = true;
3405
+ ut = signal(false, { ownedWrite: true, Fe: true });
3406
+ ct = signal(false, { ownedWrite: true, Fe: true });
3407
+ ft;
3408
+ Et = false;
3409
+ At;
3410
+ Pt = ON_INIT;
3207
3411
  constructor(e) {
3208
3412
  super();
3209
- this.Nt = e;
3413
+ this.ht = e;
3210
3414
  }
3211
3415
  run(e) {
3212
- if (!e || (read(this.ft) && (!_revealUsed || read(this.Et)))) return;
3416
+ if (!e || (read(this.ut) && (!_revealUsed || read(this.ct)))) return;
3213
3417
  return super.run(e);
3214
3418
  }
3215
3419
  notify(e, t, n, i) {
3216
- if (!(t & this.Nt)) return super.notify(e, t, n, i);
3217
- if (this.St && this.gt) {
3420
+ if (!(t & this.ht)) return super.notify(e, t, n, i);
3421
+ if (this.Et && this.At) {
3218
3422
  const e = untrack(() => {
3219
3423
  try {
3220
- return this.gt();
3424
+ return this.At();
3221
3425
  } catch {
3222
3426
  return ON_INIT;
3223
3427
  }
3224
3428
  });
3225
- if (e !== this.Ct) {
3226
- this.Ct = e;
3227
- this.St = false;
3228
- this.ct.clear();
3429
+ if (e !== this.Pt) {
3430
+ this.Pt = e;
3431
+ this.Et = false;
3432
+ this.st.clear();
3229
3433
  }
3230
3434
  }
3231
- if (this.Nt & STATUS_PENDING && this.St) return super.notify(e, t, n, i);
3232
- if (this.Nt & STATUS_PENDING && n & STATUS_ERROR) {
3435
+ if (this.ht & STATUS_PENDING && this.Et) return super.notify(e, t, n, i);
3436
+ if (this.ht & STATUS_PENDING && n & STATUS_ERROR) {
3233
3437
  return super.notify(e, STATUS_ERROR, n, i);
3234
3438
  }
3235
- if (n & this.Nt) {
3236
- this.lt = true;
3237
- const t = i?.source || e.fe?.source;
3439
+ if (n & this.ht) {
3440
+ this.ot = true;
3441
+ const t = i?.source || e.Te?.source;
3238
3442
  if (t) {
3239
- const e = this.ct.size === 0;
3240
- this.ct.add(t);
3241
- if (e) setSignal(this.ft, true);
3443
+ const e = this.st.size === 0;
3444
+ this.st.add(t);
3445
+ if (e) setSignal(this.ut, true);
3242
3446
  }
3243
3447
  }
3244
- t &= ~this.Nt;
3448
+ t &= ~this.ht;
3245
3449
  return t ? super.notify(e, t, n, i) : true;
3246
3450
  }
3247
3451
  checkSources() {
3248
- for (const e of this.ct) {
3452
+ for (const e of this.st) {
3249
3453
  if (
3250
- e.O & REACTIVE_DISPOSED ||
3251
- (!(e.Se & this.Nt) && !(this.Nt & STATUS_ERROR && e.Se & STATUS_PENDING))
3454
+ e.R & REACTIVE_DISPOSED ||
3455
+ (!(e.Oe & this.ht) && !(this.ht & STATUS_ERROR && e.Oe & STATUS_PENDING))
3252
3456
  )
3253
- this.ct.delete(e);
3457
+ this.st.delete(e);
3254
3458
  }
3255
- if (!this.ct.size) {
3256
- if (this.Nt & STATUS_PENDING && this.lt && !this.St && this.Pt) {
3257
- this.lt = !!(this.Pt.Se & this.Nt);
3459
+ if (!this.st.size) {
3460
+ if (this.ht & STATUS_PENDING && this.ot && !this.Et && this.Nt) {
3461
+ this.ot = !!(this.Nt.Oe & this.ht);
3258
3462
  } else {
3259
- this.lt = false;
3463
+ this.ot = false;
3260
3464
  }
3261
- if (!this.lt) {
3262
- setSignal(this.ft, false);
3263
- if (this.gt) {
3465
+ if (!this.ot) {
3466
+ setSignal(this.ut, false);
3467
+ if (this.At) {
3264
3468
  try {
3265
- this.Ct = untrack(() => this.gt());
3469
+ this.Pt = untrack(() => this.At());
3266
3470
  } catch {}
3267
3471
  }
3268
3472
  }
3269
3473
  }
3270
- if (_revealUsed) this.Tt?.evaluate();
3474
+ if (_revealUsed) this.ft?.evaluate();
3271
3475
  }
3272
3476
  }
3273
3477
  function createCollectionBoundary(e, t, n, i) {
3274
3478
  const r = createOwner();
3275
3479
  if (_revealUsed) setContext(RevealControllerContext, null, r);
3276
3480
  const s = new CollectionQueue(e);
3277
- if (i) s.gt = i;
3278
- const o = (s.Pt = createBoundChildren(r, t, s, e));
3481
+ if (i) s.At = i;
3482
+ const o = (s.Nt = createBoundChildren(r, t, s, e));
3279
3483
  untrack(() => {
3280
3484
  let t = false;
3281
3485
  try {
@@ -3284,33 +3488,34 @@ function createCollectionBoundary(e, t, n, i) {
3284
3488
  if (e instanceof NotReadyError) t = true;
3285
3489
  else throw e;
3286
3490
  }
3287
- s.lt = t || !!(o.Se & e) || o.fe instanceof NotReadyError;
3491
+ s.ot = t || !!(o.Oe & e) || o.Te instanceof NotReadyError;
3288
3492
  });
3289
3493
  const u = _revealUsed && e === STATUS_PENDING ? getContext(RevealControllerContext) : null;
3290
3494
  if (u) {
3291
- s.Tt = u;
3495
+ s.ft = u;
3292
3496
  u.register(s);
3293
3497
  cleanup(() => u.unregister(s));
3294
3498
  }
3295
- const c = computed(() => {
3296
- if (!read(s.ft)) {
3297
- const e = read(o);
3298
- if (!untrack(() => read(s.ft))) return (s.St = true), e;
3299
- }
3300
- if (_revealUsed && read(s.Et)) return undefined;
3301
- return n(s);
3302
- });
3303
- return accessor(c);
3499
+ return accessor(
3500
+ computed(() => {
3501
+ if (!read(s.ut)) {
3502
+ const e = read(o);
3503
+ if (!untrack(() => read(s.ut))) return ((s.Et = true), e);
3504
+ }
3505
+ if (_revealUsed && read(s.ct)) return undefined;
3506
+ return n(s);
3507
+ })
3508
+ );
3304
3509
  }
3305
3510
  function createLoadingBoundary(e, t, n) {
3306
3511
  return createCollectionBoundary(STATUS_PENDING, e, () => t(), n?.on);
3307
3512
  }
3308
3513
  function createErrorBoundary(e, t) {
3309
3514
  return createCollectionBoundary(STATUS_ERROR, e, e => {
3310
- let n = e.ct.values().next().value;
3311
- const i = n.fe?.cause ?? n.fe;
3515
+ let n = e.st.values().next().value;
3516
+ const i = n.Te?.cause ?? n.Te;
3312
3517
  return t(i, () => {
3313
- for (const t of e.ct) recompute(t);
3518
+ for (const t of e.st) recompute(t);
3314
3519
  schedule();
3315
3520
  });
3316
3521
  });
@@ -3319,7 +3524,7 @@ function createRevealOrder(e, t) {
3319
3524
  _revealUsed = true;
3320
3525
  const n = createOwner();
3321
3526
  const i = getContext(RevealControllerContext);
3322
- const r = t?.together || FALSE_ACCESSOR,
3527
+ const r = t?.order || SEQUENTIAL_ACCESSOR,
3323
3528
  s = t?.collapsed || FALSE_ACCESSOR;
3324
3529
  const o = new RevealController(r, s);
3325
3530
  setContext(RevealControllerContext, o, n);
@@ -3331,7 +3536,7 @@ function createRevealOrder(e, t) {
3331
3536
  o.evaluate();
3332
3537
  });
3333
3538
  if (i) {
3334
- o.dt = i;
3539
+ o.lt = i;
3335
3540
  i.register(o);
3336
3541
  cleanup(() => i.unregister(o));
3337
3542
  }