@solidjs/signals 0.9.8 → 0.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/prod.js CHANGED
@@ -1,8 +1,15 @@
1
1
  class NotReadyError extends Error {
2
- cause;
2
+ t;
3
3
  constructor(e) {
4
4
  super();
5
- this.cause = e;
5
+ this.t = e;
6
+ }
7
+ }
8
+ class StatusError extends Error {
9
+ t;
10
+ constructor(e, t) {
11
+ super(t instanceof Error ? t.message : String(t), { cause: t });
12
+ this.t = e;
6
13
  }
7
14
  }
8
15
  class NoOwnerError extends Error {
@@ -24,7 +31,6 @@ const REACTIVE_IN_HEAP_HEIGHT = 1 << 4;
24
31
  const REACTIVE_ZOMBIE = 1 << 5;
25
32
  const REACTIVE_DISPOSED = 1 << 6;
26
33
  const REACTIVE_OPTIMISTIC_DIRTY = 1 << 7;
27
- const STATUS_NONE = 0;
28
34
  const STATUS_PENDING = 1 << 0;
29
35
  const STATUS_ERROR = 1 << 1;
30
36
  const STATUS_UNINITIALIZED = 1 << 2;
@@ -36,111 +42,180 @@ const SUPPORTS_PROXY = typeof Proxy === "function";
36
42
  const defaultContext = {};
37
43
  const $REFRESH = Symbol("refresh");
38
44
  function actualInsertIntoHeap(e, t) {
39
- const n = (e.i?.t ? e.i.u?.o : e.i?.o) ?? -1;
40
- if (n >= e.o) e.o = n + 1;
41
- const i = e.o;
42
- const r = t.l[i];
43
- if (r === undefined) t.l[i] = e;
45
+ const n = (e.o?.i ? e.o.l?.u : e.o?.u) ?? -1;
46
+ if (n >= e.u) e.u = n + 1;
47
+ const i = e.u;
48
+ const r = t.T[i];
49
+ if (r === undefined) t.T[i] = e;
44
50
  else {
45
- const t = r.T;
46
- t.R = e;
47
- e.T = t;
48
- r.T = e;
51
+ const t = r.R;
52
+ t.O = e;
53
+ e.R = t;
54
+ r.R = e;
49
55
  }
50
- if (i > t.O) t.O = i;
56
+ if (i > t.S) t.S = i;
51
57
  }
52
58
  function insertIntoHeap(e, t) {
53
- let n = e.S;
59
+ let n = e._;
54
60
  if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS)) return;
55
61
  if (n & REACTIVE_CHECK) {
56
- e.S = (n & -4) | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
57
- } else e.S = n | REACTIVE_IN_HEAP;
62
+ e._ = (n & -4) | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
63
+ } else e._ = n | REACTIVE_IN_HEAP;
58
64
  if (!(n & REACTIVE_IN_HEAP_HEIGHT)) actualInsertIntoHeap(e, t);
59
65
  }
60
66
  function insertIntoHeapHeight(e, t) {
61
- let n = e.S;
67
+ let n = e._;
62
68
  if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_IN_HEAP_HEIGHT)) return;
63
- e.S = n | REACTIVE_IN_HEAP_HEIGHT;
69
+ e._ = n | REACTIVE_IN_HEAP_HEIGHT;
64
70
  actualInsertIntoHeap(e, t);
65
71
  }
66
72
  function deleteFromHeap(e, t) {
67
- const n = e.S;
73
+ const n = e._;
68
74
  if (!(n & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT))) return;
69
- e.S = n & -25;
70
- const i = e.o;
71
- if (e.T === e) t.l[i] = undefined;
75
+ e._ = n & -25;
76
+ const i = e.u;
77
+ if (e.R === e) t.T[i] = undefined;
72
78
  else {
73
- const n = e.R;
74
- const r = t.l[i];
79
+ const n = e.O;
80
+ const r = t.T[i];
75
81
  const o = n ?? r;
76
- if (e === r) t.l[i] = n;
77
- else e.T.R = n;
78
- o.T = e.T;
82
+ if (e === r) t.T[i] = n;
83
+ else e.R.O = n;
84
+ o.R = e.R;
79
85
  }
80
- e.T = e;
81
- e.R = undefined;
86
+ e.R = e;
87
+ e.O = undefined;
82
88
  }
83
89
  function markHeap(e) {
84
- if (e._) return;
85
- e._ = true;
86
- for (let t = 0; t <= e.O; t++) {
87
- for (let n = e.l[t]; n !== undefined; n = n.R) {
88
- if (n.S & REACTIVE_IN_HEAP) markNode(n);
90
+ if (e.I) return;
91
+ e.I = true;
92
+ for (let t = 0; t <= e.S; t++) {
93
+ for (let n = e.T[t]; n !== undefined; n = n.O) {
94
+ if (n._ & REACTIVE_IN_HEAP) markNode(n);
89
95
  }
90
96
  }
91
97
  }
92
98
  function markNode(e, t = REACTIVE_DIRTY) {
93
- const n = e.S;
99
+ const n = e._;
94
100
  if ((n & (REACTIVE_CHECK | REACTIVE_DIRTY)) >= t) return;
95
- e.S = (n & -4) | t;
96
- for (let t = e.p; t !== null; t = t.I) {
97
- markNode(t.h, REACTIVE_CHECK);
98
- }
99
- if (e.A !== null) {
100
- for (let t = e.A; t !== null; t = t.P) {
101
- for (let e = t.p; e !== null; e = e.I) {
102
- markNode(e.h, REACTIVE_CHECK);
101
+ e._ = (n & -4) | t;
102
+ for (let t = e.p; t !== null; t = t.h) {
103
+ markNode(t.A, REACTIVE_CHECK);
104
+ }
105
+ if (e.P !== null) {
106
+ for (let t = e.P; t !== null; t = t.C) {
107
+ for (let e = t.p; e !== null; e = e.h) {
108
+ markNode(e.A, REACTIVE_CHECK);
103
109
  }
104
110
  }
105
111
  }
106
112
  }
107
113
  function runHeap(e, t) {
108
- e._ = false;
109
- for (e.N = 0; e.N <= e.O; e.N++) {
110
- let n = e.l[e.N];
114
+ e.I = false;
115
+ for (e.N = 0; e.N <= e.S; e.N++) {
116
+ let n = e.T[e.N];
111
117
  while (n !== undefined) {
112
- if (n.S & REACTIVE_IN_HEAP) t(n);
118
+ if (n._ & REACTIVE_IN_HEAP) t(n);
113
119
  else adjustHeight(n, e);
114
- n = e.l[e.N];
120
+ n = e.T[e.N];
115
121
  }
116
122
  }
117
- e.O = 0;
123
+ e.S = 0;
118
124
  }
119
125
  function adjustHeight(e, t) {
120
126
  deleteFromHeap(e, t);
121
- let n = e.o;
122
- for (let t = e.C; t; t = t.D) {
127
+ let n = e.u;
128
+ for (let t = e.D; t; t = t.m) {
123
129
  const e = t.V;
124
- const i = e.m || e;
125
- if (i.U && i.o >= n) n = i.o + 1;
130
+ const i = e.L || e;
131
+ if (i.U && i.u >= n) n = i.u + 1;
126
132
  }
127
- if (e.o !== n) {
128
- e.o = n;
129
- for (let n = e.p; n !== null; n = n.I) {
130
- insertIntoHeapHeight(n.h, t);
133
+ if (e.u !== n) {
134
+ e.u = n;
135
+ for (let n = e.p; n !== null; n = n.h) {
136
+ insertIntoHeapHeight(n.A, t);
131
137
  }
132
138
  }
133
139
  }
134
140
  const transitions = new Set();
135
- const dirtyQueue = { l: new Array(2e3).fill(undefined), _: false, N: 0, O: 0 };
136
- const zombieQueue = { l: new Array(2e3).fill(undefined), _: false, N: 0, O: 0 };
141
+ const dirtyQueue = { T: new Array(2e3).fill(undefined), I: false, N: 0, S: 0 };
142
+ const zombieQueue = { T: new Array(2e3).fill(undefined), I: false, N: 0, S: 0 };
137
143
  let clock = 0;
138
144
  let activeTransition = null;
139
145
  let scheduled = false;
140
- let optimisticReadActive = false;
141
146
  let projectionWriteActive = false;
142
- function setOptimisticReadActive(e) {
143
- optimisticReadActive = e;
147
+ const signalLanes = new WeakMap();
148
+ const activeLanes = new Set();
149
+ let currentOptimisticLane = null;
150
+ function setCurrentOptimisticLane(e) {
151
+ currentOptimisticLane = e;
152
+ }
153
+ function getOrCreateLane(e) {
154
+ let t = signalLanes.get(e);
155
+ if (t) {
156
+ return findLane(t);
157
+ }
158
+ t = { t: e, k: new Set(), W: [[], []], G: null, M: activeTransition };
159
+ signalLanes.set(e, t);
160
+ activeLanes.add(t);
161
+ e.F = e.$ || 0;
162
+ return t;
163
+ }
164
+ function findLane(e) {
165
+ while (e.G) e = e.G;
166
+ return e;
167
+ }
168
+ function mergeLanes(e, t) {
169
+ e = findLane(e);
170
+ t = findLane(t);
171
+ if (e === t) return e;
172
+ t.G = e;
173
+ for (const n of t.k) e.k.add(n);
174
+ e.W[0].push(...t.W[0]);
175
+ e.W[1].push(...t.W[1]);
176
+ return e;
177
+ }
178
+ function clearLaneEntry(e) {
179
+ signalLanes.delete(e);
180
+ }
181
+ function resolveLane(e) {
182
+ const t = e.H;
183
+ if (!t) return undefined;
184
+ const n = findLane(t);
185
+ if (activeLanes.has(n)) return n;
186
+ e.H = undefined;
187
+ return undefined;
188
+ }
189
+ function hasActiveOverride(e) {
190
+ return !!(e.j && e.K !== NOT_PENDING);
191
+ }
192
+ function assignOrMergeLane(e, t) {
193
+ const n = findLane(t);
194
+ const i = e.H;
195
+ if (i) {
196
+ if (i.G) {
197
+ e.H = t;
198
+ return;
199
+ }
200
+ const r = findLane(i);
201
+ if (activeLanes.has(r)) {
202
+ if (r !== n && !hasActiveOverride(e)) {
203
+ mergeLanes(n, r);
204
+ }
205
+ return;
206
+ }
207
+ }
208
+ e.H = t;
209
+ }
210
+ function runLaneEffects(e) {
211
+ for (const t of activeLanes) {
212
+ if (t.G || t.k.size > 0) continue;
213
+ const n = t.W[e - 1];
214
+ if (n.length) {
215
+ t.W[e - 1] = [];
216
+ runQueue(n, e);
217
+ }
218
+ }
144
219
  }
145
220
  function setProjectionWriteActive(e) {
146
221
  projectionWriteActive = e;
@@ -148,133 +223,129 @@ function setProjectionWriteActive(e) {
148
223
  function schedule() {
149
224
  if (scheduled) return;
150
225
  scheduled = true;
151
- if (!globalQueue.k) queueMicrotask(flush);
226
+ if (!globalQueue.Y) queueMicrotask(flush);
152
227
  }
153
228
  class Queue {
154
- i = null;
155
- W = [[], []];
156
- G = [[], []];
157
- M = [];
229
+ o = null;
230
+ B = [[], []];
231
+ X = [];
158
232
  created = clock;
159
233
  addChild(e) {
160
- this.M.push(e);
161
- e.i = this;
234
+ this.X.push(e);
235
+ e.o = this;
162
236
  }
163
237
  removeChild(e) {
164
- const t = this.M.indexOf(e);
238
+ const t = this.X.indexOf(e);
165
239
  if (t >= 0) {
166
- this.M.splice(t, 1);
167
- e.i = null;
240
+ this.X.splice(t, 1);
241
+ e.o = null;
168
242
  }
169
243
  }
170
- notify(e, t, n) {
171
- if (this.i) return this.i.notify(e, t, n);
244
+ notify(e, t, n, i) {
245
+ if (this.o) return this.o.notify(e, t, n, i);
172
246
  return false;
173
247
  }
174
- $(e, t, n) {
175
- if (t[e - 1].length) {
176
- const n = t[e - 1];
177
- t[e - 1] = [];
178
- runQueue(n, e);
179
- }
180
- for (let t = 0; t < this.M.length; t++) {
181
- this.M[t][n]?.(e);
182
- }
183
- }
184
248
  run(e) {
185
- this.$(e, this.W, "run");
186
- }
187
- runOptimistic(e) {
188
- this.$(e, this.G, "runOptimistic");
249
+ if (this.B[e - 1].length) {
250
+ const t = this.B[e - 1];
251
+ this.B[e - 1] = [];
252
+ runQueue(t, e);
253
+ }
254
+ for (let t = 0; t < this.X.length; t++) this.X[t].run?.(e);
189
255
  }
190
256
  enqueue(e, t) {
191
257
  if (e) {
192
- const n = optimisticReadActive ? this.G : this.W;
193
- n[e - 1].push(t);
258
+ if (currentOptimisticLane) {
259
+ const n = findLane(currentOptimisticLane);
260
+ n.W[e - 1].push(t);
261
+ } else {
262
+ this.B[e - 1].push(t);
263
+ }
194
264
  }
195
265
  schedule();
196
266
  }
197
267
  stashQueues(e) {
198
- e.W[0].push(...this.W[0]);
199
- e.W[1].push(...this.W[1]);
200
- this.W = [[], []];
201
- for (let t = 0; t < this.M.length; t++) {
202
- let n = this.M[t];
203
- let i = e.M[t];
268
+ e.B[0].push(...this.B[0]);
269
+ e.B[1].push(...this.B[1]);
270
+ this.B = [[], []];
271
+ for (let t = 0; t < this.X.length; t++) {
272
+ let n = this.X[t];
273
+ let i = e.X[t];
204
274
  if (!i) {
205
- i = { W: [[], []], M: [] };
206
- e.M[t] = i;
275
+ i = { B: [[], []], X: [] };
276
+ e.X[t] = i;
207
277
  }
208
278
  n.stashQueues(i);
209
279
  }
210
280
  }
211
281
  restoreQueues(e) {
212
- this.W[0].push(...e.W[0]);
213
- this.W[1].push(...e.W[1]);
214
- for (let t = 0; t < e.M.length; t++) {
215
- const n = e.M[t];
216
- let i = this.M[t];
282
+ this.B[0].push(...e.B[0]);
283
+ this.B[1].push(...e.B[1]);
284
+ for (let t = 0; t < e.X.length; t++) {
285
+ const n = e.X[t];
286
+ let i = this.X[t];
217
287
  if (i) i.restoreQueues(n);
218
288
  }
219
289
  }
220
290
  }
221
291
  class GlobalQueue extends Queue {
222
- k = false;
223
- L = [];
224
- H = [];
225
- F = new Set();
226
- static j;
227
- static K;
228
- static Y = null;
292
+ Y = false;
293
+ q = [];
294
+ Z = [];
295
+ J = new Set();
296
+ static ee;
297
+ static te;
298
+ static ne = null;
229
299
  flush() {
230
- if (this.k) return;
231
- this.k = true;
300
+ if (this.Y) return;
301
+ this.Y = true;
232
302
  try {
233
- runHeap(dirtyQueue, GlobalQueue.j);
303
+ runHeap(dirtyQueue, GlobalQueue.ee);
234
304
  if (activeTransition) {
235
305
  const e = transitionComplete(activeTransition);
236
306
  if (!e) {
237
307
  let e = activeTransition;
238
- runHeap(zombieQueue, GlobalQueue.j);
239
- this.L = [];
240
- this.H = [];
241
- this.F = new Set();
242
- this.runOptimistic(EFFECT_RENDER);
243
- this.runOptimistic(EFFECT_USER);
244
- this.stashQueues(activeTransition.queueStash);
308
+ runHeap(zombieQueue, GlobalQueue.ee);
309
+ this.q = [];
310
+ this.Z = [];
311
+ this.J = new Set();
312
+ runLaneEffects(EFFECT_RENDER);
313
+ runLaneEffects(EFFECT_USER);
314
+ this.stashQueues(activeTransition.ie);
245
315
  clock++;
246
- scheduled = false;
247
- runTransitionPending(activeTransition.pendingNodes);
316
+ scheduled = dirtyQueue.S >= dirtyQueue.N;
317
+ reassignPendingTransition(activeTransition.q);
248
318
  activeTransition = null;
249
319
  finalizePureQueue(null, true);
250
320
  return;
251
321
  }
252
- this.L !== activeTransition.pendingNodes && this.L.push(...activeTransition.pendingNodes);
253
- this.restoreQueues(activeTransition.queueStash);
322
+ this.q !== activeTransition.q && this.q.push(...activeTransition.q);
323
+ this.restoreQueues(activeTransition.ie);
254
324
  transitions.delete(activeTransition);
255
325
  const t = activeTransition;
256
326
  activeTransition = null;
257
- runTransitionPending(this.L);
327
+ reassignPendingTransition(this.q);
258
328
  finalizePureQueue(t);
259
329
  } else {
260
- if (transitions.size) runHeap(zombieQueue, GlobalQueue.j);
330
+ if (transitions.size) runHeap(zombieQueue, GlobalQueue.ee);
261
331
  finalizePureQueue();
262
332
  }
263
333
  clock++;
264
- scheduled = dirtyQueue.O >= dirtyQueue.N;
265
- this.runOptimistic(EFFECT_RENDER);
334
+ scheduled = dirtyQueue.S >= dirtyQueue.N;
335
+ runLaneEffects(EFFECT_RENDER);
266
336
  this.run(EFFECT_RENDER);
267
- this.runOptimistic(EFFECT_USER);
337
+ runLaneEffects(EFFECT_USER);
268
338
  this.run(EFFECT_USER);
269
339
  } finally {
270
- this.k = false;
340
+ this.Y = false;
271
341
  }
272
342
  }
273
- notify(e, t, n) {
343
+ notify(e, t, n, i) {
274
344
  if (t & STATUS_PENDING) {
275
345
  if (n & STATUS_PENDING) {
276
- if (activeTransition && e.B && !activeTransition.asyncNodes.includes(e.B.cause)) {
277
- activeTransition.asyncNodes.push(e.B.cause);
346
+ const t = i !== undefined ? i : e.re;
347
+ if (activeTransition && t && !activeTransition.oe.includes(t.t)) {
348
+ activeTransition.oe.push(t.t);
278
349
  schedule();
279
350
  }
280
351
  }
@@ -285,106 +356,143 @@ class GlobalQueue extends Queue {
285
356
  initTransition(e) {
286
357
  if (e) e = currentTransition(e);
287
358
  if (e && e === activeTransition) return;
288
- if (!e && activeTransition && activeTransition.time === clock) return;
359
+ if (!e && activeTransition && activeTransition.se === clock) return;
289
360
  if (!activeTransition) {
290
361
  activeTransition = e ?? {
291
- time: clock,
292
- pendingNodes: [],
293
- asyncNodes: [],
294
- optimisticNodes: [],
295
- optimisticStores: new Set(),
296
- actions: [],
297
- queueStash: { W: [[], []], M: [] },
298
- done: false
362
+ se: clock,
363
+ q: [],
364
+ oe: [],
365
+ Z: [],
366
+ J: new Set(),
367
+ ue: [],
368
+ ie: { B: [[], []], X: [] },
369
+ ce: false
299
370
  };
300
371
  } else if (e) {
301
- activeTransition.done = e;
302
- e.actions.push(...activeTransition.actions);
303
- transitions.delete(activeTransition);
372
+ const t = activeTransition;
373
+ t.ce = e;
374
+ e.ue.push(...t.ue);
375
+ for (const n of activeLanes) {
376
+ if (n.M === t) n.M = e;
377
+ }
378
+ e.Z.push(...t.Z);
379
+ for (const n of t.J) {
380
+ e.J.add(n);
381
+ }
382
+ transitions.delete(t);
304
383
  activeTransition = e;
305
384
  }
306
385
  transitions.add(activeTransition);
307
- activeTransition.time = clock;
308
- for (let e = 0; e < this.L.length; e++) {
309
- const t = this.L[e];
310
- t.X = activeTransition;
311
- activeTransition.pendingNodes.push(t);
386
+ activeTransition.se = clock;
387
+ for (let e = 0; e < this.q.length; e++) {
388
+ const t = this.q[e];
389
+ t.M = activeTransition;
390
+ activeTransition.q.push(t);
312
391
  }
313
- this.L = activeTransition.pendingNodes;
314
- for (let e = 0; e < this.H.length; e++) {
315
- const t = this.H[e];
316
- t.X = activeTransition;
317
- activeTransition.optimisticNodes.push(t);
392
+ this.q = activeTransition.q;
393
+ for (let e = 0; e < this.Z.length; e++) {
394
+ const t = this.Z[e];
395
+ t.M = activeTransition;
396
+ activeTransition.Z.push(t);
318
397
  }
319
- this.H = activeTransition.optimisticNodes;
320
- for (const e of this.F) {
321
- activeTransition.optimisticStores.add(e);
398
+ this.Z = activeTransition.Z;
399
+ for (const e of activeLanes) {
400
+ if (!e.M) e.M = activeTransition;
322
401
  }
323
- this.F = activeTransition.optimisticStores;
402
+ for (const e of this.J) activeTransition.J.add(e);
403
+ this.J = activeTransition.J;
324
404
  }
325
405
  }
326
406
  function insertSubs(e, t = false) {
327
- for (let n = e.p; n !== null; n = n.I) {
328
- if (t) n.h.S |= REACTIVE_OPTIMISTIC_DIRTY;
329
- const e = n.h;
330
- if (e.q === EFFECT_TRACKED) {
331
- if (!e.Z) {
332
- e.Z = true;
333
- e.J.enqueue(EFFECT_USER, e.ee);
407
+ const n = e.H || currentOptimisticLane;
408
+ for (let i = e.p; i !== null; i = i.h) {
409
+ if (t && n) {
410
+ i.A._ |= REACTIVE_OPTIMISTIC_DIRTY;
411
+ assignOrMergeLane(i.A, n);
412
+ } else if (t) {
413
+ i.A._ |= REACTIVE_OPTIMISTIC_DIRTY;
414
+ i.A.H = undefined;
415
+ }
416
+ const e = i.A;
417
+ if (e.le === EFFECT_TRACKED) {
418
+ if (!e.ae) {
419
+ e.ae = true;
420
+ e.fe.enqueue(EFFECT_USER, e.Ee);
334
421
  }
335
422
  continue;
336
423
  }
337
- const i = n.h.S & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
338
- if (i.N > n.h.o) i.N = n.h.o;
339
- insertIntoHeap(n.h, i);
424
+ const r = i.A._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
425
+ if (r.N > i.A.u) r.N = i.A.u;
426
+ insertIntoHeap(i.A, r);
340
427
  }
341
428
  }
342
429
  function finalizePureQueue(e = null, t = false) {
343
430
  let n = !t;
344
- if (dirtyQueue.O >= dirtyQueue.N) {
345
- runHeap(dirtyQueue, GlobalQueue.j);
346
- }
431
+ if (!t) checkBoundaryChildren(globalQueue);
432
+ if (dirtyQueue.S >= dirtyQueue.N) runHeap(dirtyQueue, GlobalQueue.ee);
347
433
  if (n) {
348
- const t = globalQueue.L;
434
+ const t = globalQueue.q;
349
435
  for (let e = 0; e < t.length; e++) {
350
436
  const n = t[e];
351
- if (n.te !== NOT_PENDING) {
352
- n.ne = n.te;
353
- n.te = NOT_PENDING;
354
- if (n.q && n.q !== EFFECT_TRACKED) n.Z = true;
437
+ if (n.K !== NOT_PENDING) {
438
+ n.Te = n.K;
439
+ n.K = NOT_PENDING;
440
+ if (n.le && n.le !== EFFECT_TRACKED) n.ae = true;
355
441
  }
356
- if (n.U) GlobalQueue.K(n, false, true);
442
+ n.de &= ~STATUS_UNINITIALIZED;
443
+ if (n.U) GlobalQueue.te(n, false, true);
357
444
  }
358
445
  t.length = 0;
359
- const n = e ? e.optimisticNodes : globalQueue.H;
446
+ const n = e ? e.Z : globalQueue.Z;
360
447
  for (let e = 0; e < n.length; e++) {
361
448
  const t = n[e];
362
- const i = t.te;
363
- if (i !== NOT_PENDING && t.ne !== i) {
364
- t.ne = i;
449
+ const i = t.K;
450
+ t.H = undefined;
451
+ if (i !== NOT_PENDING && t.Te !== i) {
452
+ t.Te = i;
365
453
  insertSubs(t, true);
366
454
  }
367
- t.te = NOT_PENDING;
368
- t.X = null;
455
+ t.K = NOT_PENDING;
456
+ t.M = null;
369
457
  }
370
458
  n.length = 0;
371
- const i = e ? e.optimisticStores : globalQueue.F;
372
- if (GlobalQueue.Y && i.size) {
459
+ const i = e ? e.J : globalQueue.J;
460
+ if (GlobalQueue.ne && i.size) {
373
461
  for (const e of i) {
374
- GlobalQueue.Y(e);
462
+ GlobalQueue.ne(e);
375
463
  }
376
464
  i.clear();
377
465
  schedule();
378
466
  }
467
+ for (const t of activeLanes) {
468
+ const n = e ? t.M === e : !t.M;
469
+ if (!n) continue;
470
+ if (!t.G) {
471
+ if (t.W[0].length) runQueue(t.W[0], EFFECT_RENDER);
472
+ if (t.W[1].length) runQueue(t.W[1], EFFECT_USER);
473
+ }
474
+ if (t.t.H === t) t.t.H = undefined;
475
+ t.k.clear();
476
+ t.W[0].length = 0;
477
+ t.W[1].length = 0;
478
+ activeLanes.delete(t);
479
+ signalLanes.delete(t.t);
480
+ }
481
+ }
482
+ }
483
+ function checkBoundaryChildren(e) {
484
+ for (const t of e.X) {
485
+ t.checkSources?.();
486
+ checkBoundaryChildren(t);
379
487
  }
380
488
  }
381
489
  function trackOptimisticStore(e) {
382
- globalQueue.F.add(e);
490
+ globalQueue.J.add(e);
383
491
  schedule();
384
492
  }
385
- function runTransitionPending(e) {
493
+ function reassignPendingTransition(e) {
386
494
  for (let t = 0; t < e.length; t++) {
387
- e[t].X = activeTransition;
495
+ e[t].M = activeTransition;
388
496
  }
389
497
  }
390
498
  const globalQueue = new GlobalQueue();
@@ -397,20 +505,20 @@ function runQueue(e, t) {
397
505
  for (let n = 0; n < e.length; n++) e[n](t);
398
506
  }
399
507
  function transitionComplete(e) {
400
- if (e.done) return true;
401
- if (e.actions.length) return false;
508
+ if (e.ce) return true;
509
+ if (e.ue.length) return false;
402
510
  let t = true;
403
- for (let n = 0; n < e.asyncNodes.length; n++) {
404
- if (e.asyncNodes[n].ie & STATUS_PENDING) {
511
+ for (let n = 0; n < e.oe.length; n++) {
512
+ if (e.oe[n].de & STATUS_PENDING) {
405
513
  t = false;
406
514
  break;
407
515
  }
408
516
  }
409
- t && (e.done = true);
517
+ t && (e.ce = true);
410
518
  return t;
411
519
  }
412
520
  function currentTransition(e) {
413
- while (e.done && typeof e.done === "object") e = e.done;
521
+ while (e.ce && typeof e.ce === "object") e = e.ce;
414
522
  return e;
415
523
  }
416
524
  function runInTransition(e, t) {
@@ -434,11 +542,11 @@ function action(e) {
434
542
  const r = e(...t);
435
543
  globalQueue.initTransition();
436
544
  let o = activeTransition;
437
- o.actions.push(r);
545
+ o.ue.push(r);
438
546
  const done = (e, t) => {
439
547
  o = currentTransition(o);
440
- const s = o.actions.indexOf(r);
441
- if (s >= 0) o.actions.splice(s, 1);
548
+ const s = o.ue.indexOf(r);
549
+ if (s >= 0) o.ue.splice(s, 1);
442
550
  activeTransition = o;
443
551
  schedule();
444
552
  t ? i(t) : n(e);
@@ -466,8 +574,8 @@ function action(e) {
466
574
  step();
467
575
  });
468
576
  }
469
- GlobalQueue.j = recompute;
470
- GlobalQueue.K = disposeChildren;
577
+ GlobalQueue.ee = recompute;
578
+ GlobalQueue.te = disposeChildren;
471
579
  let tracking = false;
472
580
  let stale = false;
473
581
  let refreshing = false;
@@ -476,105 +584,145 @@ let foundPending = false;
476
584
  let pendingReadActive = false;
477
585
  let context = null;
478
586
  function recompute(e, t = false) {
479
- const n = e.q;
587
+ const n = e.le;
480
588
  if (!t) {
481
- if (e.X && (!n || activeTransition) && activeTransition !== e.X)
482
- globalQueue.initTransition(e.X);
483
- deleteFromHeap(e, e.S & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
484
- if (e.X) disposeChildren(e);
589
+ if (e.M && (!n || activeTransition) && activeTransition !== e.M)
590
+ globalQueue.initTransition(e.M);
591
+ deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
592
+ if (e.M || n === EFFECT_TRACKED) disposeChildren(e);
485
593
  else {
486
594
  markDisposal(e);
487
- e.re = e.oe;
488
- e.se = e.ue;
489
- e.oe = null;
490
- e.ue = null;
595
+ e.Re = e.Oe;
596
+ e.Se = e._e;
597
+ e.Oe = null;
598
+ e._e = null;
491
599
  }
492
600
  }
493
- const i = !!(e.S & REACTIVE_OPTIMISTIC_DIRTY);
494
- const r = e.le && e.te !== NOT_PENDING;
495
- const o = context;
601
+ const i = !!(e._ & REACTIVE_OPTIMISTIC_DIRTY);
602
+ const r = hasActiveOverride(e);
603
+ const o = !!(e.de & STATUS_PENDING);
604
+ const s = context;
496
605
  context = e;
497
- e.ce = null;
498
- e.S = REACTIVE_RECOMPUTING_DEPS;
499
- e.ae = clock;
500
- let s = e.te === NOT_PENDING ? e.ne : e.te;
501
- let u = e.o;
606
+ e.Ie = null;
607
+ e._ = REACTIVE_RECOMPUTING_DEPS;
608
+ e.se = clock;
609
+ let u = e.K === NOT_PENDING ? e.Te : e.K;
610
+ let c = e.u;
502
611
  let l = tracking;
503
- let c = optimisticReadActive;
612
+ let a = currentOptimisticLane;
504
613
  tracking = true;
505
- if (i) setOptimisticReadActive(true);
614
+ if (i) {
615
+ const t = resolveLane(e);
616
+ if (t) setCurrentOptimisticLane(t);
617
+ }
506
618
  try {
507
- s = handleAsync(e, e.U(s));
619
+ u = handleAsync(e, e.U(u));
508
620
  clearStatus(e);
621
+ const t = resolveLane(e);
622
+ if (t) t.k.delete(e);
509
623
  } catch (t) {
510
- if (t instanceof NotReadyError) {
511
- if (t.cause !== e) link(t.cause, e);
512
- notifyStatus(e, STATUS_PENDING, t);
513
- } else notifyStatus(e, STATUS_ERROR, t);
624
+ if (t instanceof NotReadyError && currentOptimisticLane) {
625
+ const t = findLane(currentOptimisticLane);
626
+ if (t.t !== e) {
627
+ t.k.add(e);
628
+ e.H = t;
629
+ }
630
+ }
631
+ notifyStatus(
632
+ e,
633
+ t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
634
+ t,
635
+ undefined,
636
+ t instanceof NotReadyError ? e.H : undefined
637
+ );
514
638
  } finally {
515
639
  tracking = l;
516
- e.S = REACTIVE_NONE;
517
- context = o;
640
+ e._ = REACTIVE_NONE;
641
+ context = s;
518
642
  }
519
- if (!e.B) {
520
- const o = e.ce;
521
- let l = o !== null ? o.D : e.C;
643
+ if (!e.re) {
644
+ const s = e.Ie;
645
+ let l = s !== null ? s.m : e.D;
522
646
  if (l !== null) {
523
647
  do {
524
648
  l = unlinkSubs(l);
525
649
  } while (l !== null);
526
- if (o !== null) o.D = null;
527
- else e.C = null;
528
- }
529
- const c = !e.fe || !e.fe(e.te === NOT_PENDING ? e.ne : e.te, s);
530
- if (c) {
531
- if (t || (n && activeTransition !== e.X) || i) e.ne = s;
532
- else e.te = s;
533
- insertSubs(e, i || r);
534
- } else if (e.o != u) {
535
- for (let t = e.p; t !== null; t = t.I) {
536
- insertIntoHeapHeight(t.h, t.h.S & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
650
+ if (s !== null) s.m = null;
651
+ else e.D = null;
652
+ }
653
+ const a = r ? e.Te : e.K === NOT_PENDING ? e.Te : e.K;
654
+ const f = !e.pe || !e.pe(a, u);
655
+ if (f) {
656
+ const s = r ? e.Te : undefined;
657
+ if (t || (n && activeTransition !== e.M) || i) e.Te = u;
658
+ else e.K = u;
659
+ if (r && !i && o) {
660
+ const t = e.$ || 0;
661
+ const n = e.F || 0;
662
+ if (t <= n) e.Te = u;
663
+ }
664
+ if (!r || i || e.Te !== s) {
665
+ insertSubs(e, i || r);
666
+ }
667
+ } else if (r) {
668
+ e.K = u;
669
+ } else if (e.u != c) {
670
+ for (let t = e.p; t !== null; t = t.h) {
671
+ insertIntoHeapHeight(t.A, t.A._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
537
672
  }
538
673
  }
539
674
  }
540
- setOptimisticReadActive(c);
541
- (!t || e.ie & STATUS_PENDING) && !e.X && !(activeTransition && e.le) && globalQueue.L.push(e);
542
- e.X && n && activeTransition !== e.X && runInTransition(e.X, () => recompute(e));
675
+ setCurrentOptimisticLane(a);
676
+ (!t || e.de & STATUS_PENDING) && !e.M && !(activeTransition && e.j) && globalQueue.q.push(e);
677
+ e.M && n && activeTransition !== e.M && runInTransition(e.M, () => recompute(e));
543
678
  }
544
679
  function handleAsync(e, t, n) {
545
680
  const i = typeof t === "object" && t !== null;
546
681
  const r = i && untrack(() => t[Symbol.asyncIterator]);
547
682
  const o = !r && i && untrack(() => typeof t.then === "function");
548
683
  if (!o && !r) {
549
- e.Ee = null;
684
+ e.he = null;
550
685
  return t;
551
686
  }
552
- e.Ee = t;
687
+ e.he = t;
553
688
  let s;
554
689
  const handleError = n => {
555
- if (e.Ee !== t) return;
556
- globalQueue.initTransition(e.X);
557
- if (n instanceof NotReadyError) {
558
- if (n.cause !== e) link(n.cause, e);
559
- notifyStatus(e, STATUS_PENDING, n);
560
- } else notifyStatus(e, STATUS_ERROR, n);
561
- e.ae = clock;
690
+ if (e.he !== t) return;
691
+ globalQueue.initTransition(e.M);
692
+ notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
693
+ e.se = clock;
562
694
  };
563
695
  const asyncWrite = (i, r) => {
564
- if (e.Ee !== t) return;
565
- globalQueue.initTransition(e.X);
696
+ if (e.he !== t) return;
697
+ if (e._ & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
698
+ globalQueue.initTransition(e.M);
566
699
  clearStatus(e);
700
+ const o = resolveLane(e);
701
+ if (o) o.k.delete(e);
567
702
  if (n) n(i);
568
- else if (e.le) {
569
- const t = e.te !== NOT_PENDING;
570
- if (e.U) e.te = i;
703
+ else if (e.j) {
704
+ const t = e.K !== NOT_PENDING;
705
+ if (e.U) e.K = i;
571
706
  if (!t) {
572
- e.ne = i;
707
+ e.Te = i;
573
708
  insertSubs(e);
574
709
  }
575
- e.ae = clock;
576
- schedule();
577
- } else setSignal(e, () => i);
710
+ e.se = clock;
711
+ } else if (o) {
712
+ const t = e.Te;
713
+ const n = e.pe;
714
+ if (!n || !n(i, t)) {
715
+ e.Te = i;
716
+ e.se = clock;
717
+ if (e.Ae) {
718
+ setSignal(e.Ae, i);
719
+ }
720
+ insertSubs(e, true);
721
+ }
722
+ } else {
723
+ setSignal(e, () => i);
724
+ }
725
+ schedule();
578
726
  flush();
579
727
  r?.();
580
728
  };
@@ -594,7 +742,7 @@ function handleAsync(e, t, n) {
594
742
  );
595
743
  i = false;
596
744
  if (!n) {
597
- globalQueue.initTransition(e.X);
745
+ globalQueue.initTransition(e.M);
598
746
  throw new NotReadyError(context);
599
747
  }
600
748
  }
@@ -626,177 +774,191 @@ function handleAsync(e, t, n) {
626
774
  };
627
775
  const r = iterate();
628
776
  if (!i && !r) {
629
- globalQueue.initTransition(e.X);
777
+ globalQueue.initTransition(e.M);
630
778
  throw new NotReadyError(context);
631
779
  }
632
780
  }
633
781
  return s;
634
782
  }
635
783
  function clearStatus(e) {
636
- e.ie = STATUS_NONE;
637
- e.B = null;
784
+ e.de = e.de & STATUS_UNINITIALIZED;
785
+ e.re = null;
638
786
  updatePendingSignal(e);
639
- if (e.Te) {
640
- e.Te();
641
- } else {
642
- if (!e.X) {
643
- for (let t = e.p; t !== null; t = t.I) {
644
- if (t.h.ie & STATUS_PENDING) {
645
- insertIntoHeap(t.h, t.h.S & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
646
- }
647
- }
787
+ e.ge?.();
788
+ }
789
+ function notifyStatus(e, t, n, i, r) {
790
+ if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
791
+ n = new StatusError(e, n);
792
+ const o = n instanceof NotReadyError && n.t === e;
793
+ const s = t === STATUS_PENDING && e.j && !o;
794
+ const u = s && hasActiveOverride(e);
795
+ if (!i) {
796
+ e.de = t | (t !== STATUS_ERROR ? e.de & STATUS_UNINITIALIZED : 0);
797
+ e.re = n;
798
+ updatePendingSignal(e);
799
+ }
800
+ if (r && !i) {
801
+ assignOrMergeLane(e, r);
802
+ }
803
+ if (u && activeTransition && n instanceof NotReadyError) {
804
+ const e = n.t;
805
+ if (!activeTransition.oe.includes(e)) {
806
+ activeTransition.oe.push(e);
807
+ }
808
+ }
809
+ const c = i || u;
810
+ const l = i || s ? undefined : r;
811
+ if (e.ge) {
812
+ if (c) {
813
+ e.ge(t, n);
814
+ } else {
815
+ e.ge();
648
816
  }
649
- schedule();
817
+ return;
650
818
  }
651
- }
652
- function notifyStatus(e, t, n) {
653
- e.ie = t | (t !== STATUS_ERROR ? e.ie & STATUS_UNINITIALIZED : 0);
654
- e.B = n;
655
- updatePendingSignal(e);
656
- if (e.Te) return e.Te();
657
- for (let i = e.p; i !== null; i = i.I) {
658
- i.h.ae = clock;
659
- if (i.h.B !== n) {
660
- !i.h.X && globalQueue.L.push(i.h);
661
- notifyStatus(i.h, t, n);
819
+ for (let i = e.p; i !== null; i = i.h) {
820
+ i.A.se = clock;
821
+ if (i.A.re !== n) {
822
+ !i.A.M && globalQueue.q.push(i.A);
823
+ notifyStatus(i.A, t, n, c, l);
662
824
  }
663
825
  }
664
- for (let i = e.A; i !== null; i = i.P) {
665
- for (let e = i.p; e !== null; e = e.I) {
666
- e.h.ae = clock;
667
- if (e.h.B !== n) {
668
- !e.h.X && globalQueue.L.push(e.h);
669
- notifyStatus(e.h, t, n);
826
+ for (let i = e.P; i !== null; i = i.C) {
827
+ for (let e = i.p; e !== null; e = e.h) {
828
+ e.A.se = clock;
829
+ if (e.A.re !== n) {
830
+ !e.A.M && globalQueue.q.push(e.A);
831
+ notifyStatus(e.A, t, n, c, l);
670
832
  }
671
833
  }
672
834
  }
673
835
  }
674
836
  function updateIfNecessary(e) {
675
- if (e.S & REACTIVE_CHECK) {
676
- for (let t = e.C; t; t = t.D) {
837
+ if (e._ & REACTIVE_CHECK) {
838
+ for (let t = e.D; t; t = t.m) {
677
839
  const n = t.V;
678
- const i = n.m || n;
840
+ const i = n.L || n;
679
841
  if (i.U) {
680
842
  updateIfNecessary(i);
681
843
  }
682
- if (e.S & REACTIVE_DIRTY) {
844
+ if (e._ & REACTIVE_DIRTY) {
683
845
  break;
684
846
  }
685
847
  }
686
848
  }
687
- if (e.S & REACTIVE_DIRTY) {
849
+ if (e._ & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.re && e.se < clock)) {
688
850
  recompute(e);
689
851
  }
690
- e.S = REACTIVE_NONE;
852
+ e._ = REACTIVE_NONE;
691
853
  }
692
854
  function unlinkSubs(e) {
693
855
  const t = e.V;
694
- const n = e.D;
695
- const i = e.I;
696
- const r = e.Re;
697
- if (i !== null) i.Re = r;
698
- else t.de = r;
699
- if (r !== null) r.I = i;
856
+ const n = e.m;
857
+ const i = e.h;
858
+ const r = e.Pe;
859
+ if (i !== null) i.Pe = r;
860
+ else t.Ce = r;
861
+ if (r !== null) r.h = i;
700
862
  else {
701
863
  t.p = i;
702
864
  if (i === null) {
703
- t.Oe?.();
704
- t.U && !t.Se && unobserved(t);
865
+ t.Ne?.();
866
+ t.U && !t.ye && unobserved(t);
705
867
  }
706
868
  }
707
869
  return n;
708
870
  }
709
871
  function unobserved(e) {
710
- deleteFromHeap(e, e.S & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
711
- let t = e.C;
872
+ deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
873
+ let t = e.D;
712
874
  while (t !== null) {
713
875
  t = unlinkSubs(t);
714
876
  }
715
- e.C = null;
877
+ e.D = null;
716
878
  disposeChildren(e, true);
717
879
  }
718
880
  function link(e, t) {
719
- const n = t.ce;
881
+ const n = t.Ie;
720
882
  if (n !== null && n.V === e) return;
721
883
  let i = null;
722
- const r = t.S & REACTIVE_RECOMPUTING_DEPS;
884
+ const r = t._ & REACTIVE_RECOMPUTING_DEPS;
723
885
  if (r) {
724
- i = n !== null ? n.D : t.C;
886
+ i = n !== null ? n.m : t.D;
725
887
  if (i !== null && i.V === e) {
726
- t.ce = i;
888
+ t.Ie = i;
727
889
  return;
728
890
  }
729
891
  }
730
- const o = e.de;
731
- if (o !== null && o.h === t && (!r || isValidLink(o, t))) return;
732
- const s = (t.ce = e.de = { V: e, h: t, D: i, Re: o, I: null });
733
- if (n !== null) n.D = s;
734
- else t.C = s;
735
- if (o !== null) o.I = s;
892
+ const o = e.Ce;
893
+ if (o !== null && o.A === t && (!r || isValidLink(o, t))) return;
894
+ const s = (t.Ie = e.Ce = { V: e, A: t, m: i, Pe: o, h: null });
895
+ if (n !== null) n.m = s;
896
+ else t.D = s;
897
+ if (o !== null) o.h = s;
736
898
  else e.p = s;
737
899
  }
738
900
  function isValidLink(e, t) {
739
- const n = t.ce;
901
+ const n = t.Ie;
740
902
  if (n !== null) {
741
- let i = t.C;
903
+ let i = t.D;
742
904
  do {
743
905
  if (i === e) return true;
744
906
  if (i === n) break;
745
- i = i.D;
907
+ i = i.m;
746
908
  } while (i !== null);
747
909
  }
748
910
  return false;
749
911
  }
750
912
  function markDisposal(e) {
751
- let t = e.ue;
913
+ let t = e._e;
752
914
  while (t) {
753
- t.S |= REACTIVE_ZOMBIE;
754
- if (t.S & REACTIVE_IN_HEAP) {
915
+ t._ |= REACTIVE_ZOMBIE;
916
+ if (t._ & REACTIVE_IN_HEAP) {
755
917
  deleteFromHeap(t, dirtyQueue);
756
918
  insertIntoHeap(t, zombieQueue);
757
919
  }
758
920
  markDisposal(t);
759
- t = t._e;
921
+ t = t.De;
760
922
  }
761
923
  }
762
924
  function dispose(e) {
763
- let t = e.C || null;
925
+ let t = e.D || null;
764
926
  do {
765
927
  t = unlinkSubs(t);
766
928
  } while (t !== null);
767
- e.C = null;
768
- e.ce = null;
929
+ e.D = null;
930
+ e.Ie = null;
769
931
  disposeChildren(e, true);
770
932
  }
771
933
  function disposeChildren(e, t = false, n) {
772
- if (e.S & REACTIVE_DISPOSED) return;
773
- if (t) e.S = REACTIVE_DISPOSED;
774
- let i = n ? e.se : e.ue;
934
+ if (e._ & REACTIVE_DISPOSED) return;
935
+ if (t) e._ = REACTIVE_DISPOSED;
936
+ let i = n ? e.Se : e._e;
775
937
  while (i) {
776
- const e = i._e;
777
- if (i.C) {
938
+ const e = i.De;
939
+ if (i.D) {
778
940
  const e = i;
779
- deleteFromHeap(e, e.S & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
780
- let t = e.C;
941
+ deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
942
+ let t = e.D;
781
943
  do {
782
944
  t = unlinkSubs(t);
783
945
  } while (t !== null);
784
- e.C = null;
785
- e.ce = null;
946
+ e.D = null;
947
+ e.Ie = null;
786
948
  }
787
949
  disposeChildren(i, true);
788
950
  i = e;
789
951
  }
790
952
  if (n) {
791
- e.se = null;
953
+ e.Se = null;
792
954
  } else {
793
- e.ue = null;
794
955
  e._e = null;
956
+ e.De = null;
795
957
  }
796
958
  runDisposal(e, n);
797
959
  }
798
960
  function runDisposal(e, t) {
799
- let n = t ? e.re : e.oe;
961
+ let n = t ? e.Re : e.Oe;
800
962
  if (!n) return;
801
963
  if (Array.isArray(n)) {
802
964
  for (let e = 0; e < n.length; e++) {
@@ -806,10 +968,10 @@ function runDisposal(e, t) {
806
968
  } else {
807
969
  n.call(n);
808
970
  }
809
- t ? (e.re = null) : (e.oe = null);
971
+ t ? (e.Re = null) : (e.Oe = null);
810
972
  }
811
973
  function getNextChildId(e) {
812
- if (e.id != null) return formatId(e.id, e.pe++);
974
+ if (e.id != null) return formatId(e.id, e.ve++);
813
975
  throw new Error("Cannot get child id from owner without an id");
814
976
  }
815
977
  function formatId(e, t) {
@@ -820,102 +982,117 @@ function formatId(e, t) {
820
982
  function computed(e, t, n) {
821
983
  const i = {
822
984
  id: n?.id ?? (context?.id != null ? getNextChildId(context) : undefined),
823
- fe: n?.equals != null ? n.equals : isEqual,
824
- Ie: !!n?.pureWrite,
825
- Oe: n?.unobserved,
826
- oe: null,
827
- J: context?.J ?? globalQueue,
828
- he: context?.he ?? defaultContext,
829
- pe: 0,
985
+ pe: n?.equals != null ? n.equals : isEqual,
986
+ we: !!n?.pureWrite,
987
+ Ne: n?.unobserved,
988
+ Oe: null,
989
+ fe: context?.fe ?? globalQueue,
990
+ be: context?.be ?? defaultContext,
991
+ ve: 0,
830
992
  U: e,
831
- ne: t,
832
- o: 0,
833
- A: null,
834
- R: undefined,
835
- T: null,
836
- C: null,
837
- ce: null,
993
+ Te: t,
994
+ u: 0,
995
+ P: null,
996
+ O: undefined,
997
+ R: null,
998
+ D: null,
999
+ Ie: null,
838
1000
  p: null,
839
- de: null,
840
- i: context,
1001
+ Ce: null,
1002
+ o: context,
1003
+ De: null,
841
1004
  _e: null,
842
- ue: null,
843
- S: REACTIVE_NONE,
844
- ie: STATUS_UNINITIALIZED,
845
- ae: clock,
846
- te: NOT_PENDING,
847
- re: null,
848
- se: null,
849
- Ee: null,
850
- X: null
1005
+ _: REACTIVE_NONE,
1006
+ de: STATUS_UNINITIALIZED,
1007
+ se: clock,
1008
+ K: NOT_PENDING,
1009
+ Re: null,
1010
+ Se: null,
1011
+ he: null,
1012
+ M: null
851
1013
  };
852
- i.T = i;
853
- const r = context?.t ? context.u : context;
1014
+ i.R = i;
1015
+ const r = context?.i ? context.l : context;
854
1016
  if (context) {
855
- const e = context.ue;
1017
+ const e = context._e;
856
1018
  if (e === null) {
857
- context.ue = i;
1019
+ context._e = i;
858
1020
  } else {
859
- i._e = e;
860
- context.ue = i;
1021
+ i.De = e;
1022
+ context._e = i;
861
1023
  }
862
1024
  }
863
- if (r) i.o = r.o + 1;
1025
+ if (r) i.u = r.u + 1;
864
1026
  !n?.lazy && recompute(i, true);
865
1027
  return i;
866
1028
  }
867
1029
  function signal(e, t, n = null) {
868
1030
  const i = {
869
- fe: t?.equals != null ? t.equals : isEqual,
870
- Ie: !!t?.pureWrite,
871
- Oe: t?.unobserved,
872
- ne: e,
1031
+ pe: t?.equals != null ? t.equals : isEqual,
1032
+ we: !!t?.pureWrite,
1033
+ Ne: t?.unobserved,
1034
+ Te: e,
873
1035
  p: null,
874
- de: null,
875
- ae: clock,
876
- m: n,
877
- P: n?.A || null,
878
- te: NOT_PENDING
1036
+ Ce: null,
1037
+ se: clock,
1038
+ L: n,
1039
+ C: n?.P || null,
1040
+ K: NOT_PENDING
879
1041
  };
880
- n && (n.A = i);
1042
+ n && (n.P = i);
881
1043
  return i;
882
1044
  }
883
1045
  function optimisticSignal(e, t) {
884
1046
  const n = signal(e, t);
885
- n.le = true;
1047
+ n.j = true;
886
1048
  return n;
887
1049
  }
888
1050
  function optimisticComputed(e, t, n) {
889
1051
  const i = computed(e, t, n);
890
- i.le = true;
1052
+ i.j = true;
891
1053
  return i;
892
1054
  }
893
1055
  function getPendingSignal(e) {
894
- if (!e.Ae) {
895
- e.Ae = optimisticSignal(false, { pureWrite: true });
896
- if (computePendingState(e)) setSignal(e.Ae, true);
1056
+ if (!e.me) {
1057
+ e.me = optimisticSignal(false, { pureWrite: true });
1058
+ if (computePendingState(e)) setSignal(e.me, true);
897
1059
  }
898
- return e.Ae;
1060
+ return e.me;
899
1061
  }
900
1062
  function computePendingState(e) {
901
- if (e.te !== NOT_PENDING) return true;
902
1063
  const t = e;
903
- return !!(t.ie & STATUS_PENDING && !(t.ie & STATUS_UNINITIALIZED));
1064
+ if (e.K !== NOT_PENDING && !(t.de & STATUS_UNINITIALIZED)) return true;
1065
+ return !!(t.de & STATUS_PENDING && !(t.de & STATUS_UNINITIALIZED));
904
1066
  }
905
1067
  function getPendingValueComputed(e) {
906
- if (!e.ge) {
1068
+ if (!e.Ae) {
907
1069
  const t = pendingReadActive;
908
1070
  pendingReadActive = false;
909
1071
  const n = context;
910
1072
  context = null;
911
- e.ge = optimisticComputed(() => read(e));
1073
+ e.Ae = optimisticComputed(() => read(e));
912
1074
  context = n;
913
1075
  pendingReadActive = t;
914
1076
  }
915
- return e.ge;
1077
+ return e.Ae;
916
1078
  }
917
1079
  function updatePendingSignal(e) {
918
- if (e.Ae) setSignal(e.Ae, computePendingState(e));
1080
+ if (e.me) {
1081
+ const t = computePendingState(e);
1082
+ const n = e.me;
1083
+ setSignal(n, t);
1084
+ if (!t && n.H) {
1085
+ const t = resolveLane(e);
1086
+ if (t && t.k.size > 0) {
1087
+ const e = findLane(n.H);
1088
+ if (e !== t) {
1089
+ mergeLanes(t, e);
1090
+ }
1091
+ }
1092
+ clearLaneEntry(n);
1093
+ n.H = undefined;
1094
+ }
1095
+ }
919
1096
  }
920
1097
  function isEqual(e, t) {
921
1098
  return e === t;
@@ -931,7 +1108,7 @@ function untrack(e) {
931
1108
  }
932
1109
  function read(e) {
933
1110
  if (pendingCheckActive) {
934
- const t = e.m || e;
1111
+ const t = e.L || e;
935
1112
  const n = getPendingSignal(t);
936
1113
  const i = pendingCheckActive;
937
1114
  pendingCheckActive = false;
@@ -939,7 +1116,7 @@ function read(e) {
939
1116
  foundPending = true;
940
1117
  }
941
1118
  pendingCheckActive = i;
942
- return e.ne;
1119
+ return e.Te;
943
1120
  }
944
1121
  if (pendingReadActive) {
945
1122
  const t = getPendingValueComputed(e);
@@ -947,78 +1124,93 @@ function read(e) {
947
1124
  pendingReadActive = false;
948
1125
  const i = read(t);
949
1126
  pendingReadActive = n;
950
- if (t.ie & STATUS_PENDING) return e.ne;
1127
+ if (t.de & STATUS_PENDING) return e.Te;
951
1128
  return i;
952
1129
  }
953
1130
  let t = context;
954
- if (t?.t) t = t.u;
1131
+ if (t?.i) t = t.l;
955
1132
  if (refreshing && e.U) recompute(e);
956
1133
  if (t && tracking) {
957
- if (e.U && e.S & REACTIVE_DISPOSED) recompute(e);
1134
+ if (e.U && e._ & REACTIVE_DISPOSED) recompute(e);
958
1135
  link(e, t);
959
- const n = e.m || e;
1136
+ const n = e.L || e;
960
1137
  if (n.U) {
961
- const i = e.S & REACTIVE_ZOMBIE;
962
- if (n.o >= (i ? zombieQueue.N : dirtyQueue.N)) {
1138
+ const i = e._ & REACTIVE_ZOMBIE;
1139
+ if (n.u >= (i ? zombieQueue.N : dirtyQueue.N)) {
963
1140
  markNode(t);
964
1141
  markHeap(i ? zombieQueue : dirtyQueue);
965
1142
  updateIfNecessary(n);
966
1143
  }
967
- const r = n.o;
968
- if (r >= t.o && e.i !== t) {
969
- t.o = r + 1;
1144
+ const r = n.u;
1145
+ if (r >= t.u && e.o !== t) {
1146
+ t.u = r + 1;
1147
+ }
1148
+ }
1149
+ }
1150
+ const n = e.L || e;
1151
+ if (t && n.de & STATUS_PENDING && !(stale && n.M && activeTransition !== n.M)) {
1152
+ if (currentOptimisticLane) {
1153
+ const i = n.H;
1154
+ const r = findLane(currentOptimisticLane);
1155
+ if (i && findLane(i) === r && !hasActiveOverride(n)) {
1156
+ if (!tracking) link(e, t);
1157
+ throw n.re;
970
1158
  }
1159
+ } else {
1160
+ if (!tracking) link(e, t);
1161
+ throw n.re;
971
1162
  }
972
1163
  }
973
- const n = e.m || e;
974
- if (
975
- t &&
976
- !optimisticReadActive &&
977
- n.ie & STATUS_PENDING &&
978
- !(stale && n.X && activeTransition !== n.X)
979
- )
980
- throw n.B;
981
- if (e.U && e.ie & STATUS_ERROR) {
982
- if (e.ae < clock) {
1164
+ if (e.U && e.de & STATUS_ERROR) {
1165
+ if (e.se < clock) {
983
1166
  recompute(e, true);
984
1167
  return read(e);
985
- } else throw e.B;
1168
+ } else throw e.re;
986
1169
  }
987
1170
  return !t ||
988
- optimisticReadActive ||
989
- e.te === NOT_PENDING ||
990
- (stale && e.X && activeTransition !== e.X)
991
- ? e.ne
992
- : e.te;
1171
+ currentOptimisticLane !== null ||
1172
+ e.K === NOT_PENDING ||
1173
+ (stale && e.M && activeTransition !== e.M)
1174
+ ? e.Te
1175
+ : e.K;
993
1176
  }
994
1177
  function setSignal(e, t) {
995
- if (e.X && activeTransition !== e.X) globalQueue.initTransition(e.X);
996
- const n = e.le && !projectionWriteActive;
997
- const i = n ? e.ne : e.te === NOT_PENDING ? e.ne : e.te;
1178
+ if (e.M && activeTransition !== e.M) globalQueue.initTransition(e.M);
1179
+ const n = e.j && !projectionWriteActive;
1180
+ const i = n ? e.Te : e.K === NOT_PENDING ? e.Te : e.K;
998
1181
  if (typeof t === "function") t = t(i);
999
- const r = !e.fe || !e.fe(i, t);
1000
- if (!r) return t;
1182
+ const r = !e.pe || !e.pe(i, t);
1183
+ if (!r) {
1184
+ if (n && e.K !== NOT_PENDING && e.U) {
1185
+ insertSubs(e, true);
1186
+ schedule();
1187
+ }
1188
+ return t;
1189
+ }
1001
1190
  if (n) {
1002
- const n = globalQueue.H.includes(e);
1003
- if (e.X && n) {
1004
- globalQueue.initTransition(e.X);
1191
+ const n = globalQueue.Z.includes(e);
1192
+ if (e.M && n) {
1193
+ globalQueue.initTransition(e.M);
1005
1194
  }
1006
- if (e.te === NOT_PENDING) {
1007
- e.te = e.ne;
1195
+ if (e.K === NOT_PENDING) {
1196
+ e.K = e.Te;
1008
1197
  }
1009
1198
  if (!n) {
1010
- globalQueue.H.push(e);
1199
+ globalQueue.Z.push(e);
1011
1200
  }
1012
- e.ne = t;
1201
+ e.$ = (e.$ || 0) + 1;
1202
+ const i = getOrCreateLane(e);
1203
+ e.H = i;
1204
+ e.Te = t;
1013
1205
  } else {
1014
- if (e.te === NOT_PENDING) globalQueue.L.push(e);
1015
- e.te = t;
1206
+ if (e.K === NOT_PENDING) globalQueue.q.push(e);
1207
+ e.K = t;
1016
1208
  }
1017
1209
  updatePendingSignal(e);
1018
- if (e.ge) {
1019
- setSignal(e.ge, t);
1210
+ if (e.Ae) {
1211
+ setSignal(e.Ae, t);
1020
1212
  }
1021
- e.ae = clock;
1213
+ e.se = clock;
1022
1214
  insertSubs(e, n);
1023
1215
  schedule();
1024
1216
  return t;
@@ -1033,37 +1225,37 @@ function getOwner() {
1033
1225
  }
1034
1226
  function onCleanup(e) {
1035
1227
  if (!context) return e;
1036
- if (!context.oe) context.oe = e;
1037
- else if (Array.isArray(context.oe)) context.oe.push(e);
1038
- else context.oe = [context.oe, e];
1228
+ if (!context.Oe) context.Oe = e;
1229
+ else if (Array.isArray(context.Oe)) context.Oe.push(e);
1230
+ else context.Oe = [context.Oe, e];
1039
1231
  return e;
1040
1232
  }
1041
1233
  function createOwner(e) {
1042
1234
  const t = context;
1043
1235
  const n = {
1044
1236
  id: e?.id ?? (t?.id != null ? getNextChildId(t) : undefined),
1045
- t: true,
1046
- u: t?.t ? t.u : t,
1047
- ue: null,
1237
+ i: true,
1238
+ l: t?.i ? t.l : t,
1048
1239
  _e: null,
1049
- oe: null,
1050
- J: t?.J ?? globalQueue,
1051
- he: t?.he || defaultContext,
1052
- pe: 0,
1053
- re: null,
1054
- se: null,
1055
- i: t,
1240
+ De: null,
1241
+ Oe: null,
1242
+ fe: t?.fe ?? globalQueue,
1243
+ be: t?.be || defaultContext,
1244
+ ve: 0,
1245
+ Re: null,
1246
+ Se: null,
1247
+ o: t,
1056
1248
  dispose(e = true) {
1057
1249
  disposeChildren(n, e);
1058
1250
  }
1059
1251
  };
1060
1252
  if (t) {
1061
- const e = t.ue;
1253
+ const e = t._e;
1062
1254
  if (e === null) {
1063
- t.ue = n;
1255
+ t._e = n;
1064
1256
  } else {
1065
- n._e = e;
1066
- t.ue = n;
1257
+ n.De = e;
1258
+ t._e = n;
1067
1259
  }
1068
1260
  }
1069
1261
  return n;
@@ -1110,6 +1302,8 @@ function isPending(e) {
1110
1302
  try {
1111
1303
  e();
1112
1304
  return foundPending;
1305
+ } catch {
1306
+ return foundPending;
1113
1307
  } finally {
1114
1308
  pendingCheckActive = t;
1115
1309
  foundPending = n;
@@ -1141,7 +1335,7 @@ function getContext(e, t = getOwner()) {
1141
1335
  if (!t) {
1142
1336
  throw new NoOwnerError();
1143
1337
  }
1144
- const n = hasContext(e, t) ? t.he[e.id] : e.defaultValue;
1338
+ const n = hasContext(e, t) ? t.be[e.id] : e.defaultValue;
1145
1339
  if (isUndefined(n)) {
1146
1340
  throw new ContextNotFoundError();
1147
1341
  }
@@ -1151,10 +1345,10 @@ function setContext(e, t, n = getOwner()) {
1151
1345
  if (!n) {
1152
1346
  throw new NoOwnerError();
1153
1347
  }
1154
- n.he = { ...n.he, [e.id]: isUndefined(t) ? e.defaultValue : t };
1348
+ n.be = { ...n.be, [e.id]: isUndefined(t) ? e.defaultValue : t };
1155
1349
  }
1156
1350
  function hasContext(e, t) {
1157
- return !isUndefined(t?.he[e.id]);
1351
+ return !isUndefined(t?.be[e.id]);
1158
1352
  }
1159
1353
  function isUndefined(e) {
1160
1354
  return typeof e === "undefined";
@@ -1164,78 +1358,80 @@ function effect(e, t, n, i, r) {
1164
1358
  const s = computed(r?.render ? t => staleValues(() => e(t)) : e, i, {
1165
1359
  ...r,
1166
1360
  equals: () => {
1167
- s.Z = !s.B;
1168
- if (o) s.J.enqueue(s.q, runEffect.bind(s));
1361
+ s.ae = !s.re;
1362
+ if (o) s.fe.enqueue(s.le, runEffect.bind(s));
1169
1363
  return false;
1170
1364
  },
1171
1365
  lazy: true
1172
1366
  });
1173
- s.Pe = i;
1174
- s.Ne = t;
1175
- s.Ce = n;
1176
- s.ye = undefined;
1177
- s.q = r?.render ? EFFECT_RENDER : EFFECT_USER;
1178
- s.Te = () => {
1179
- if (s.ie & STATUS_ERROR) {
1180
- let e = s.B;
1181
- s.J.notify(s, STATUS_PENDING, 0);
1182
- if (s.q === EFFECT_USER) {
1367
+ s.Ve = i;
1368
+ s.Le = t;
1369
+ s.Ue = n;
1370
+ s.ke = undefined;
1371
+ s.le = r?.render ? EFFECT_RENDER : EFFECT_USER;
1372
+ s.ge = (e, t) => {
1373
+ const n = e !== undefined ? e : s.de;
1374
+ const i = t !== undefined ? t : s.re;
1375
+ if (n & STATUS_ERROR) {
1376
+ let e = i;
1377
+ s.fe.notify(s, STATUS_PENDING, 0);
1378
+ if (s.le === EFFECT_USER) {
1183
1379
  try {
1184
- return s.Ce
1185
- ? s.Ce(e, () => {
1186
- s.ye?.();
1187
- s.ye = undefined;
1380
+ return s.Ue
1381
+ ? s.Ue(e, () => {
1382
+ s.ke?.();
1383
+ s.ke = undefined;
1188
1384
  })
1189
1385
  : console.error(e);
1190
1386
  } catch (t) {
1191
1387
  e = t;
1192
1388
  }
1193
1389
  }
1194
- if (!s.J.notify(s, STATUS_ERROR, STATUS_ERROR)) throw e;
1195
- } else if (s.q === EFFECT_RENDER) s.J.notify(s, STATUS_PENDING | STATUS_ERROR, s.ie);
1390
+ if (!s.fe.notify(s, STATUS_ERROR, STATUS_ERROR)) throw e;
1391
+ } else if (s.le === EFFECT_RENDER) s.fe.notify(s, STATUS_PENDING | STATUS_ERROR, n, i);
1196
1392
  };
1197
1393
  recompute(s, true);
1198
- !r?.defer && (s.q === EFFECT_USER ? s.J.enqueue(s.q, runEffect.bind(s)) : runEffect.call(s));
1394
+ !r?.defer && (s.le === EFFECT_USER ? s.fe.enqueue(s.le, runEffect.bind(s)) : runEffect.call(s));
1199
1395
  o = true;
1200
- onCleanup(() => s.ye?.());
1396
+ onCleanup(() => s.ke?.());
1201
1397
  }
1202
1398
  function runEffect() {
1203
- if (!this.Z || this.S & REACTIVE_DISPOSED) return;
1204
- this.ye?.();
1205
- this.ye = undefined;
1399
+ if (!this.ae || this._ & REACTIVE_DISPOSED) return;
1400
+ this.ke?.();
1401
+ this.ke = undefined;
1206
1402
  try {
1207
- this.ye = this.Ne(this.ne, this.Pe);
1403
+ this.ke = this.Le(this.Te, this.Ve);
1208
1404
  } catch (e) {
1209
- if (!this.J.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
1405
+ if (!this.fe.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
1210
1406
  } finally {
1211
- this.Pe = this.ne;
1212
- this.Z = false;
1407
+ this.Ve = this.Te;
1408
+ this.ae = false;
1213
1409
  }
1214
1410
  }
1215
1411
  function trackedEffect(e, t) {
1216
1412
  const run = () => {
1217
- if (!n.Z || n.S & REACTIVE_DISPOSED) return;
1218
- n.Z = false;
1413
+ if (!n.ae || n._ & REACTIVE_DISPOSED) return;
1414
+ n.ae = false;
1219
1415
  recompute(n);
1220
1416
  };
1221
1417
  const n = computed(
1222
1418
  () => {
1223
1419
  try {
1224
- n.ye?.();
1225
- n.ye = undefined;
1226
- n.ye = staleValues(e) || undefined;
1420
+ n.ke?.();
1421
+ n.ke = undefined;
1422
+ n.ke = staleValues(e) || undefined;
1227
1423
  } finally {
1228
1424
  }
1229
1425
  },
1230
1426
  undefined,
1231
1427
  { ...t, lazy: true, pureWrite: true }
1232
1428
  );
1233
- n.ye = undefined;
1234
- n.Z = true;
1235
- n.q = EFFECT_TRACKED;
1236
- n.ee = run;
1237
- n.J.enqueue(EFFECT_USER, run);
1238
- onCleanup(() => n.ye?.());
1429
+ n.ke = undefined;
1430
+ n.ae = true;
1431
+ n.le = EFFECT_TRACKED;
1432
+ n.Ee = run;
1433
+ n.fe.enqueue(EFFECT_USER, run);
1434
+ onCleanup(() => n.ke?.());
1239
1435
  }
1240
1436
  function createSignal(e, t, n) {
1241
1437
  if (typeof e === "function") {
@@ -1328,26 +1524,26 @@ function applyState(e, t, n, i) {
1328
1524
  r[STORE_OVERRIDE] = undefined;
1329
1525
  if (Array.isArray(o)) {
1330
1526
  let t = false;
1331
- const l = getOverrideValue(o, s, u, "length");
1332
- if (e.length && l && e[0] && n(e[0]) != null) {
1333
- let c, a, f, E, T, R, d, O;
1527
+ const c = getOverrideValue(o, s, u, "length");
1528
+ if (e.length && c && e[0] && n(e[0]) != null) {
1529
+ let l, a, f, E, T, d, R, O;
1334
1530
  for (
1335
- f = 0, E = Math.min(l, e.length);
1336
- f < E && ((R = getOverrideValue(o, s, u, f)) === e[f] || (R && e[f] && n(R) === n(e[f])));
1531
+ f = 0, E = Math.min(c, e.length);
1532
+ f < E && ((d = getOverrideValue(o, s, u, f)) === e[f] || (d && e[f] && n(d) === n(e[f])));
1337
1533
  f++
1338
1534
  ) {
1339
- applyState(e[f], wrap(R, r), n, i);
1535
+ applyState(e[f], wrap(d, r), n, i);
1340
1536
  }
1341
1537
  const S = new Array(e.length),
1342
1538
  _ = new Map();
1343
1539
  for (
1344
- E = l - 1, T = e.length - 1;
1540
+ E = c - 1, T = e.length - 1;
1345
1541
  E >= f &&
1346
1542
  T >= f &&
1347
- ((R = getOverrideValue(o, s, u, E)) === e[T] || (R && e[T] && n(R) === n(e[T])));
1543
+ ((d = getOverrideValue(o, s, u, E)) === e[T] || (d && e[T] && n(d) === n(e[T])));
1348
1544
  E--, T--
1349
1545
  ) {
1350
- S[T] = R;
1546
+ S[T] = d;
1351
1547
  }
1352
1548
  if (f > T || f > E) {
1353
1549
  for (a = f; a <= T; a++) {
@@ -1361,24 +1557,24 @@ function applyState(e, t, n, i) {
1361
1557
  applyState(e[a], o, n, i);
1362
1558
  }
1363
1559
  t && r[STORE_NODE][$TRACK] && setSignal(r[STORE_NODE][$TRACK], void 0);
1364
- l !== e.length && r[STORE_NODE].length && setSignal(r[STORE_NODE].length, e.length);
1560
+ c !== e.length && r[STORE_NODE].length && setSignal(r[STORE_NODE].length, e.length);
1365
1561
  return;
1366
1562
  }
1367
- d = new Array(T + 1);
1563
+ R = new Array(T + 1);
1368
1564
  for (a = T; a >= f; a--) {
1369
- R = e[a];
1370
- O = R ? n(R) : R;
1371
- c = _.get(O);
1372
- d[a] = c === undefined ? -1 : c;
1565
+ d = e[a];
1566
+ O = d ? n(d) : d;
1567
+ l = _.get(O);
1568
+ R[a] = l === undefined ? -1 : l;
1373
1569
  _.set(O, a);
1374
1570
  }
1375
- for (c = f; c <= E; c++) {
1376
- R = getOverrideValue(o, s, u, c);
1377
- O = R ? n(R) : R;
1571
+ for (l = f; l <= E; l++) {
1572
+ d = getOverrideValue(o, s, u, l);
1573
+ O = d ? n(d) : d;
1378
1574
  a = _.get(O);
1379
1575
  if (a !== undefined && a !== -1) {
1380
- S[a] = R;
1381
- a = d[a];
1576
+ S[a] = d;
1577
+ a = R[a];
1382
1578
  _.set(O, a);
1383
1579
  }
1384
1580
  }
@@ -1391,14 +1587,14 @@ function applyState(e, t, n, i) {
1391
1587
  }
1392
1588
  if (f < e.length) t = true;
1393
1589
  } else if (e.length) {
1394
- for (let t = 0, l = e.length; t < l; t++) {
1395
- const l = getOverrideValue(o, s, u, t);
1396
- isWrappable(l)
1397
- ? applyState(e[t], wrap(l, r), n, i)
1590
+ for (let t = 0, c = e.length; t < c; t++) {
1591
+ const c = getOverrideValue(o, s, u, t);
1592
+ isWrappable(c)
1593
+ ? applyState(e[t], wrap(c, r), n, i)
1398
1594
  : r[STORE_NODE][t] && setSignal(r[STORE_NODE][t], e[t]);
1399
1595
  }
1400
1596
  }
1401
- if (l !== e.length) {
1597
+ if (c !== e.length) {
1402
1598
  t = true;
1403
1599
  r[STORE_NODE].length && setSignal(r[STORE_NODE].length, e.length);
1404
1600
  }
@@ -1407,9 +1603,9 @@ function applyState(e, t, n, i) {
1407
1603
  }
1408
1604
  if (u) {
1409
1605
  const t = u[$TRACK];
1410
- const l = t || i ? getAllKeys(o, s, e) : Object.keys(u);
1411
- for (let c = 0, a = l.length; c < a; c++) {
1412
- const a = l[c];
1606
+ const c = t || i ? getAllKeys(o, s, e) : Object.keys(u);
1607
+ for (let l = 0, a = c.length; l < a; l++) {
1608
+ const a = c[l];
1413
1609
  const f = u[a];
1414
1610
  const E = unwrap(getOverrideValue(o, s, u, a));
1415
1611
  let T = unwrap(e[a]);
@@ -1469,7 +1665,7 @@ function createProjectionInternal(e, t = {}, n) {
1469
1665
  r !== i && r !== undefined && reconcile(r, n?.key || "id", n?.all)(o);
1470
1666
  });
1471
1667
  });
1472
- i.Se = true;
1668
+ i.ye = true;
1473
1669
  return { store: o, node: i };
1474
1670
  }
1475
1671
  function createProjection(e, t = {}, n) {
@@ -1569,7 +1765,7 @@ function getNode(e, t, n, i, r = isEqual, o) {
1569
1765
  },
1570
1766
  i
1571
1767
  );
1572
- if (o) s.le = true;
1768
+ if (o) s.j = true;
1573
1769
  return (e[t] = s);
1574
1770
  }
1575
1771
  function trackSelf(e, t = $TRACK) {
@@ -1612,39 +1808,39 @@ const storeTraps = {
1612
1808
  const o = e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE];
1613
1809
  const s = o || (e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]);
1614
1810
  const u = !!e[STORE_VALUE][$TARGET];
1615
- const l = o
1811
+ const c = o
1616
1812
  ? e[STORE_OPTIMISTIC_OVERRIDE]
1617
1813
  : e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
1618
1814
  ? e[STORE_OVERRIDE]
1619
1815
  : e[STORE_VALUE];
1620
1816
  if (!r) {
1621
- const e = Object.getOwnPropertyDescriptor(l, t);
1817
+ const e = Object.getOwnPropertyDescriptor(c, t);
1622
1818
  if (e && e.get) return e.get.call(n);
1623
1819
  }
1624
1820
  if (writeOnly(n)) {
1625
- let n = r && (s || !u) ? (r.te !== NOT_PENDING ? (r.le ? r.ne : r.te) : r.ne) : l[t];
1821
+ let n = r && (s || !u) ? (r.K !== NOT_PENDING ? (r.j ? r.Te : r.K) : r.Te) : c[t];
1626
1822
  n === $DELETED && (n = undefined);
1627
1823
  if (!isWrappable(n)) return n;
1628
1824
  const i = wrap(n, e);
1629
1825
  Writing?.add(i);
1630
1826
  return i;
1631
1827
  }
1632
- let c = r ? (s || !u ? read(i[t]) : (read(i[t]), l[t])) : l[t];
1633
- c === $DELETED && (c = undefined);
1828
+ let l = r ? (s || !u ? read(i[t]) : (read(i[t]), c[t])) : c[t];
1829
+ l === $DELETED && (l = undefined);
1634
1830
  if (!r) {
1635
- if (!s && typeof c === "function" && !l.hasOwnProperty(t)) {
1831
+ if (!s && typeof l === "function" && !c.hasOwnProperty(t)) {
1636
1832
  let t;
1637
1833
  return !Array.isArray(e[STORE_VALUE]) &&
1638
1834
  (t = Object.getPrototypeOf(e[STORE_VALUE])) &&
1639
1835
  t !== Object.prototype
1640
- ? c.bind(l)
1641
- : c;
1836
+ ? l.bind(c)
1837
+ : l;
1642
1838
  } else if (getObserver()) {
1643
1839
  return read(
1644
1840
  getNode(
1645
1841
  i,
1646
1842
  t,
1647
- isWrappable(c) ? wrap(c, e) : c,
1843
+ isWrappable(l) ? wrap(l, e) : l,
1648
1844
  e[STORE_FIREWALL],
1649
1845
  isEqual,
1650
1846
  e[STORE_OPTIMISTIC]
@@ -1652,7 +1848,7 @@ const storeTraps = {
1652
1848
  );
1653
1849
  }
1654
1850
  }
1655
- return isWrappable(c) ? wrap(c, e) : c;
1851
+ return isWrappable(l) ? wrap(l, e) : l;
1656
1852
  },
1657
1853
  has(e, t) {
1658
1854
  if (t === $PROXY || t === $TRACK || t === "__proto__") return true;
@@ -1671,8 +1867,8 @@ const storeTraps = {
1671
1867
  if (writeOnly(i)) {
1672
1868
  if (e[STORE_OPTIMISTIC]) {
1673
1869
  const t = e[STORE_FIREWALL];
1674
- if (t?.X) {
1675
- globalQueue.initTransition(t.X);
1870
+ if (t?.M) {
1871
+ globalQueue.initTransition(t.M);
1676
1872
  }
1677
1873
  }
1678
1874
  untrack(() => {
@@ -1681,29 +1877,29 @@ const storeTraps = {
1681
1877
  const s = e[STORE_OPTIMISTIC] && !projectionWriteActive;
1682
1878
  const u = s ? STORE_OPTIMISTIC_OVERRIDE : STORE_OVERRIDE;
1683
1879
  if (s) trackOptimisticStore(i);
1684
- const l =
1880
+ const c =
1685
1881
  e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE]
1686
1882
  ? e[STORE_OPTIMISTIC_OVERRIDE][t]
1687
1883
  : e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
1688
1884
  ? e[STORE_OVERRIDE][t]
1689
1885
  : o;
1690
- const c = n?.[$TARGET]?.[STORE_VALUE] ?? n;
1691
- if (l === c) return true;
1886
+ const l = n?.[$TARGET]?.[STORE_VALUE] ?? n;
1887
+ if (c === l) return true;
1692
1888
  const a = e[STORE_OPTIMISTIC_OVERRIDE]?.length || e[STORE_OVERRIDE]?.length || r.length;
1693
- if (c !== undefined && c === o) delete e[u][t];
1694
- else (e[u] || (e[u] = Object.create(null)))[t] = c;
1695
- const f = isWrappable(c);
1696
- if (isWrappable(l)) {
1697
- const e = PARENTS.get(l);
1698
- e && (e instanceof Set ? e.delete(i) : PARENTS.delete(l));
1889
+ if (l !== undefined && l === o) delete e[u][t];
1890
+ else (e[u] || (e[u] = Object.create(null)))[t] = l;
1891
+ const f = isWrappable(l);
1892
+ if (isWrappable(c)) {
1893
+ const e = PARENTS.get(c);
1894
+ e && (e instanceof Set ? e.delete(i) : PARENTS.delete(c));
1699
1895
  }
1700
- if (recursivelyNotify(i, storeLookup) && f) recursivelyAddParent(c, i);
1896
+ if (recursivelyNotify(i, storeLookup) && f) recursivelyAddParent(l, i);
1701
1897
  e[STORE_HAS]?.[t] && setSignal(e[STORE_HAS][t], true);
1702
1898
  const E = getNodes(e, STORE_NODE);
1703
- E[t] && setSignal(E[t], () => (f ? wrap(c, e) : c));
1899
+ E[t] && setSignal(E[t], () => (f ? wrap(l, e) : l));
1704
1900
  if (Array.isArray(r)) {
1705
1901
  if (t === "length") {
1706
- E.length && setSignal(E.length, c);
1902
+ E.length && setSignal(E.length, l);
1707
1903
  } else {
1708
1904
  const e = parseInt(t) + 1;
1709
1905
  if (e > a) E.length && setSignal(E.length, e);
@@ -1861,7 +2057,7 @@ function deep(e) {
1861
2057
  return e[$DEEP];
1862
2058
  }
1863
2059
  function createOptimisticStore(e, t, n) {
1864
- GlobalQueue.Y ||= clearOptimisticStore;
2060
+ GlobalQueue.ne ||= clearOptimisticStore;
1865
2061
  const i = typeof e === "function";
1866
2062
  const r = (i ? t : e) ?? {};
1867
2063
  const o = i ? e : undefined;
@@ -1873,16 +2069,25 @@ function clearOptimisticStore(e) {
1873
2069
  if (!t || !t[STORE_OPTIMISTIC_OVERRIDE]) return;
1874
2070
  const n = t[STORE_OPTIMISTIC_OVERRIDE];
1875
2071
  const i = t[STORE_NODE];
1876
- if (i) {
1877
- for (const e of Reflect.ownKeys(n)) {
1878
- if (i[e]) {
1879
- const n =
1880
- t[STORE_OVERRIDE] && e in t[STORE_OVERRIDE] ? t[STORE_OVERRIDE][e] : t[STORE_VALUE][e];
1881
- const r = n === $DELETED ? undefined : n;
1882
- setSignal(i[e], isWrappable(r) ? wrap(r, t) : r);
2072
+ setProjectionWriteActive(true);
2073
+ try {
2074
+ if (i) {
2075
+ for (const e of Reflect.ownKeys(n)) {
2076
+ if (i[e]) {
2077
+ i[e].H = undefined;
2078
+ const n =
2079
+ t[STORE_OVERRIDE] && e in t[STORE_OVERRIDE] ? t[STORE_OVERRIDE][e] : t[STORE_VALUE][e];
2080
+ const r = n === $DELETED ? undefined : n;
2081
+ setSignal(i[e], isWrappable(r) ? wrap(r, t) : r);
2082
+ }
2083
+ }
2084
+ if (i[$TRACK]) {
2085
+ i[$TRACK].H = undefined;
2086
+ setSignal(i[$TRACK], undefined);
1883
2087
  }
1884
2088
  }
1885
- i[$TRACK] && setSignal(i[$TRACK], undefined);
2089
+ } finally {
2090
+ setProjectionWriteActive(false);
1886
2091
  }
1887
2092
  delete t[STORE_OPTIMISTIC_OVERRIDE];
1888
2093
  }
@@ -1928,12 +2133,12 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
1928
2133
  setProjectionWriteActive(false);
1929
2134
  }
1930
2135
  });
1931
- i.Se = true;
2136
+ i.ye = true;
1932
2137
  }
1933
2138
  return { store: o, node: i };
1934
2139
  }
1935
2140
  function snapshot(e, t, n) {
1936
- let i, r, o, s, u, l;
2141
+ let i, r, o, s, u, c;
1937
2142
  if (!isWrappable(e)) return e;
1938
2143
  if (t && t.has(e)) return t.get(e);
1939
2144
  if (!t) t = new Map();
@@ -1953,26 +2158,26 @@ function snapshot(e, t, n) {
1953
2158
  if (r) {
1954
2159
  const i = o?.length || e.length;
1955
2160
  for (let r = 0; r < i; r++) {
1956
- l = o && r in o ? o[r] : e[r];
1957
- if (l === $DELETED) continue;
1958
- if ((u = snapshot(l, t, n)) !== l || s) {
2161
+ c = o && r in o ? o[r] : e[r];
2162
+ if (c === $DELETED) continue;
2163
+ if ((u = snapshot(c, t, n)) !== c || s) {
1959
2164
  if (!s) t.set(e, (s = [...e]));
1960
2165
  s[r] = u;
1961
2166
  }
1962
2167
  }
1963
2168
  } else {
1964
2169
  const i = getKeys(e, o);
1965
- for (let r = 0, c = i.length; r < c; r++) {
1966
- let c = i[r];
1967
- const a = getPropertyDescriptor(e, o, c);
2170
+ for (let r = 0, l = i.length; r < l; r++) {
2171
+ let l = i[r];
2172
+ const a = getPropertyDescriptor(e, o, l);
1968
2173
  if (a.get) continue;
1969
- l = o && c in o ? o[c] : e[c];
1970
- if ((u = snapshot(l, t, n)) !== e[c] || s) {
2174
+ c = o && l in o ? o[l] : e[l];
2175
+ if ((u = snapshot(c, t, n)) !== e[l] || s) {
1971
2176
  if (!s) {
1972
2177
  s = Object.create(Object.getPrototypeOf(e));
1973
2178
  Object.assign(s, e);
1974
2179
  }
1975
- s[c] = u;
2180
+ s[l] = u;
1976
2181
  }
1977
2182
  }
1978
2183
  }
@@ -2112,281 +2317,289 @@ function mapArray(e, t, n) {
2112
2317
  const i = typeof n?.keyed === "function" ? n.keyed : undefined;
2113
2318
  return createMemo(
2114
2319
  updateKeyedMap.bind({
2115
- De: createOwner(),
2116
- we: 0,
2117
- be: e,
2118
- ve: [],
2119
- Ve: t,
2120
- me: [],
2121
- Ue: [],
2122
- ke: i,
2123
- We: i || n?.keyed === false ? [] : undefined,
2124
- Qe: t.length > 1 ? [] : undefined,
2125
- xe: n?.fallback
2320
+ We: createOwner(),
2321
+ Qe: 0,
2322
+ xe: e,
2323
+ Ge: [],
2324
+ Me: t,
2325
+ Fe: [],
2326
+ $e: [],
2327
+ He: i,
2328
+ je: i || n?.keyed === false ? [] : undefined,
2329
+ Ke: t.length > 1 ? [] : undefined,
2330
+ Ye: n?.fallback
2126
2331
  })
2127
2332
  );
2128
2333
  }
2129
2334
  const pureOptions = { pureWrite: true };
2130
2335
  function updateKeyedMap() {
2131
- const e = this.be() || [],
2336
+ const e = this.xe() || [],
2132
2337
  t = e.length;
2133
2338
  e[$TRACK];
2134
- runWithOwner(this.De, () => {
2339
+ runWithOwner(this.We, () => {
2135
2340
  let n,
2136
2341
  i,
2137
- r = this.We
2342
+ r = this.je
2138
2343
  ? () => {
2139
- this.We[i] = signal(e[i], pureOptions);
2140
- this.Qe && (this.Qe[i] = signal(i, pureOptions));
2141
- return this.Ve(
2142
- read.bind(null, this.We[i]),
2143
- this.Qe ? read.bind(null, this.Qe[i]) : undefined
2344
+ this.je[i] = signal(e[i], pureOptions);
2345
+ this.Ke && (this.Ke[i] = signal(i, pureOptions));
2346
+ return this.Me(
2347
+ read.bind(null, this.je[i]),
2348
+ this.Ke ? read.bind(null, this.Ke[i]) : undefined
2144
2349
  );
2145
2350
  }
2146
- : this.Qe
2351
+ : this.Ke
2147
2352
  ? () => {
2148
2353
  const t = e[i];
2149
- this.Qe[i] = signal(i, pureOptions);
2150
- return this.Ve(() => t, read.bind(null, this.Qe[i]));
2354
+ this.Ke[i] = signal(i, pureOptions);
2355
+ return this.Me(() => t, read.bind(null, this.Ke[i]));
2151
2356
  }
2152
2357
  : () => {
2153
2358
  const t = e[i];
2154
- return this.Ve(() => t);
2359
+ return this.Me(() => t);
2155
2360
  };
2156
2361
  if (t === 0) {
2157
- if (this.we !== 0) {
2158
- this.De.dispose(false);
2159
- this.Ue = [];
2160
- this.ve = [];
2161
- this.me = [];
2162
- this.we = 0;
2163
- this.We && (this.We = []);
2164
- this.Qe && (this.Qe = []);
2165
- }
2166
- if (this.xe && !this.me[0]) {
2167
- this.me[0] = runWithOwner((this.Ue[0] = createOwner()), this.xe);
2168
- }
2169
- } else if (this.we === 0) {
2170
- if (this.Ue[0]) this.Ue[0].dispose();
2171
- this.me = new Array(t);
2362
+ if (this.Qe !== 0) {
2363
+ this.We.dispose(false);
2364
+ this.$e = [];
2365
+ this.Ge = [];
2366
+ this.Fe = [];
2367
+ this.Qe = 0;
2368
+ this.je && (this.je = []);
2369
+ this.Ke && (this.Ke = []);
2370
+ }
2371
+ if (this.Ye && !this.Fe[0]) {
2372
+ this.Fe[0] = runWithOwner((this.$e[0] = createOwner()), this.Ye);
2373
+ }
2374
+ } else if (this.Qe === 0) {
2375
+ if (this.$e[0]) this.$e[0].dispose();
2376
+ this.Fe = new Array(t);
2172
2377
  for (i = 0; i < t; i++) {
2173
- this.ve[i] = e[i];
2174
- this.me[i] = runWithOwner((this.Ue[i] = createOwner()), r);
2378
+ this.Ge[i] = e[i];
2379
+ this.Fe[i] = runWithOwner((this.$e[i] = createOwner()), r);
2175
2380
  }
2176
- this.we = t;
2381
+ this.Qe = t;
2177
2382
  } else {
2178
2383
  let o,
2179
2384
  s,
2180
2385
  u,
2181
- l,
2182
2386
  c,
2387
+ l,
2183
2388
  a,
2184
2389
  f,
2185
2390
  E = new Array(t),
2186
2391
  T = new Array(t),
2187
- R = this.We ? new Array(t) : undefined,
2188
- d = this.Qe ? new Array(t) : undefined;
2392
+ d = this.je ? new Array(t) : undefined,
2393
+ R = this.Ke ? new Array(t) : undefined;
2189
2394
  for (
2190
- o = 0, s = Math.min(this.we, t);
2191
- o < s && (this.ve[o] === e[o] || (this.We && compare(this.ke, this.ve[o], e[o])));
2395
+ o = 0, s = Math.min(this.Qe, t);
2396
+ o < s && (this.Ge[o] === e[o] || (this.je && compare(this.He, this.Ge[o], e[o])));
2192
2397
  o++
2193
2398
  ) {
2194
- if (this.We) setSignal(this.We[o], e[o]);
2399
+ if (this.je) setSignal(this.je[o], e[o]);
2195
2400
  }
2196
2401
  for (
2197
- s = this.we - 1, u = t - 1;
2402
+ s = this.Qe - 1, u = t - 1;
2198
2403
  s >= o &&
2199
2404
  u >= o &&
2200
- (this.ve[s] === e[u] || (this.We && compare(this.ke, this.ve[s], e[u])));
2405
+ (this.Ge[s] === e[u] || (this.je && compare(this.He, this.Ge[s], e[u])));
2201
2406
  s--, u--
2202
2407
  ) {
2203
- E[u] = this.me[s];
2204
- T[u] = this.Ue[s];
2205
- R && (R[u] = this.We[s]);
2206
- d && (d[u] = this.Qe[s]);
2408
+ E[u] = this.Fe[s];
2409
+ T[u] = this.$e[s];
2410
+ d && (d[u] = this.je[s]);
2411
+ R && (R[u] = this.Ke[s]);
2207
2412
  }
2208
2413
  a = new Map();
2209
2414
  f = new Array(u + 1);
2210
2415
  for (i = u; i >= o; i--) {
2211
- l = e[i];
2212
- c = this.ke ? this.ke(l) : l;
2213
- n = a.get(c);
2416
+ c = e[i];
2417
+ l = this.He ? this.He(c) : c;
2418
+ n = a.get(l);
2214
2419
  f[i] = n === undefined ? -1 : n;
2215
- a.set(c, i);
2420
+ a.set(l, i);
2216
2421
  }
2217
2422
  for (n = o; n <= s; n++) {
2218
- l = this.ve[n];
2219
- c = this.ke ? this.ke(l) : l;
2220
- i = a.get(c);
2423
+ c = this.Ge[n];
2424
+ l = this.He ? this.He(c) : c;
2425
+ i = a.get(l);
2221
2426
  if (i !== undefined && i !== -1) {
2222
- E[i] = this.me[n];
2223
- T[i] = this.Ue[n];
2224
- R && (R[i] = this.We[n]);
2225
- d && (d[i] = this.Qe[n]);
2427
+ E[i] = this.Fe[n];
2428
+ T[i] = this.$e[n];
2429
+ d && (d[i] = this.je[n]);
2430
+ R && (R[i] = this.Ke[n]);
2226
2431
  i = f[i];
2227
- a.set(c, i);
2228
- } else this.Ue[n].dispose();
2432
+ a.set(l, i);
2433
+ } else this.$e[n].dispose();
2229
2434
  }
2230
2435
  for (i = o; i < t; i++) {
2231
2436
  if (i in E) {
2232
- this.me[i] = E[i];
2233
- this.Ue[i] = T[i];
2234
- if (R) {
2235
- this.We[i] = R[i];
2236
- setSignal(this.We[i], e[i]);
2237
- }
2437
+ this.Fe[i] = E[i];
2438
+ this.$e[i] = T[i];
2238
2439
  if (d) {
2239
- this.Qe[i] = d[i];
2240
- setSignal(this.Qe[i], i);
2440
+ this.je[i] = d[i];
2441
+ setSignal(this.je[i], e[i]);
2442
+ }
2443
+ if (R) {
2444
+ this.Ke[i] = R[i];
2445
+ setSignal(this.Ke[i], i);
2241
2446
  }
2242
2447
  } else {
2243
- this.me[i] = runWithOwner((this.Ue[i] = createOwner()), r);
2448
+ this.Fe[i] = runWithOwner((this.$e[i] = createOwner()), r);
2244
2449
  }
2245
2450
  }
2246
- this.me = this.me.slice(0, (this.we = t));
2247
- this.ve = e.slice(0);
2451
+ this.Fe = this.Fe.slice(0, (this.Qe = t));
2452
+ this.Ge = e.slice(0);
2248
2453
  }
2249
2454
  });
2250
- return this.me;
2455
+ return this.Fe;
2251
2456
  }
2252
2457
  function repeat(e, t, n) {
2253
2458
  return updateRepeat.bind({
2254
- De: createOwner(),
2255
- we: 0,
2256
- Ge: 0,
2257
- Me: e,
2258
- Ve: t,
2259
- Ue: [],
2260
- me: [],
2261
- $e: n?.from,
2262
- xe: n?.fallback
2459
+ We: createOwner(),
2460
+ Qe: 0,
2461
+ Be: 0,
2462
+ Xe: e,
2463
+ Me: t,
2464
+ $e: [],
2465
+ Fe: [],
2466
+ qe: n?.from,
2467
+ Ye: n?.fallback
2263
2468
  });
2264
2469
  }
2265
2470
  function updateRepeat() {
2266
- const e = this.Me();
2267
- const t = this.$e?.() || 0;
2268
- runWithOwner(this.De, () => {
2471
+ const e = this.Xe();
2472
+ const t = this.qe?.() || 0;
2473
+ runWithOwner(this.We, () => {
2269
2474
  if (e === 0) {
2270
- if (this.we !== 0) {
2271
- this.De.dispose(false);
2272
- this.Ue = [];
2273
- this.me = [];
2274
- this.we = 0;
2475
+ if (this.Qe !== 0) {
2476
+ this.We.dispose(false);
2477
+ this.$e = [];
2478
+ this.Fe = [];
2479
+ this.Qe = 0;
2275
2480
  }
2276
- if (this.xe && !this.me[0]) {
2277
- this.me[0] = runWithOwner((this.Ue[0] = createOwner()), this.xe);
2481
+ if (this.Ye && !this.Fe[0]) {
2482
+ this.Fe[0] = runWithOwner((this.$e[0] = createOwner()), this.Ye);
2278
2483
  }
2279
2484
  return;
2280
2485
  }
2281
2486
  const n = t + e;
2282
- const i = this.Ge + this.we;
2283
- if (this.we === 0 && this.Ue[0]) this.Ue[0].dispose();
2284
- for (let e = n; e < i; e++) this.Ue[e - this.Ge].dispose();
2285
- if (this.Ge < t) {
2286
- let e = this.Ge;
2287
- while (e < t && e < this.we) this.Ue[e++].dispose();
2288
- this.Ue.splice(0, t - this.Ge);
2289
- this.me.splice(0, t - this.Ge);
2290
- } else if (this.Ge > t) {
2291
- let n = i - this.Ge - 1;
2292
- let r = this.Ge - t;
2293
- this.Ue.length = this.me.length = e;
2487
+ const i = this.Be + this.Qe;
2488
+ if (this.Qe === 0 && this.$e[0]) this.$e[0].dispose();
2489
+ for (let e = n; e < i; e++) this.$e[e - this.Be].dispose();
2490
+ if (this.Be < t) {
2491
+ let e = this.Be;
2492
+ while (e < t && e < this.Qe) this.$e[e++].dispose();
2493
+ this.$e.splice(0, t - this.Be);
2494
+ this.Fe.splice(0, t - this.Be);
2495
+ } else if (this.Be > t) {
2496
+ let n = i - this.Be - 1;
2497
+ let r = this.Be - t;
2498
+ this.$e.length = this.Fe.length = e;
2294
2499
  while (n >= r) {
2295
- this.Ue[n] = this.Ue[n - r];
2296
- this.me[n] = this.me[n - r];
2500
+ this.$e[n] = this.$e[n - r];
2501
+ this.Fe[n] = this.Fe[n - r];
2297
2502
  n--;
2298
2503
  }
2299
2504
  for (let e = 0; e < r; e++) {
2300
- this.me[e] = runWithOwner((this.Ue[e] = createOwner()), () => this.Ve(e + t));
2505
+ this.Fe[e] = runWithOwner((this.$e[e] = createOwner()), () => this.Me(e + t));
2301
2506
  }
2302
2507
  }
2303
2508
  for (let e = i; e < n; e++) {
2304
- this.me[e - t] = runWithOwner((this.Ue[e - t] = createOwner()), () => this.Ve(e));
2509
+ this.Fe[e - t] = runWithOwner((this.$e[e - t] = createOwner()), () => this.Me(e));
2305
2510
  }
2306
- this.me = this.me.slice(0, e);
2307
- this.Ge = t;
2308
- this.we = e;
2511
+ this.Fe = this.Fe.slice(0, e);
2512
+ this.Be = t;
2513
+ this.Qe = e;
2309
2514
  });
2310
- return this.me;
2515
+ return this.Fe;
2311
2516
  }
2312
2517
  function compare(e, t, n) {
2313
2518
  return e ? e(t) === e(n) : true;
2314
2519
  }
2315
2520
  function boundaryComputed(e, t) {
2316
2521
  const n = computed(e, undefined, { lazy: true });
2317
- n.Te = () => {
2318
- const e = n.ie;
2319
- n.ie &= ~n.Le;
2320
- n.J.notify(n, n.Le, e);
2522
+ n.ge = (e, t) => {
2523
+ const i = e !== undefined ? e : n.de;
2524
+ const r = t !== undefined ? t : n.re;
2525
+ n.de &= ~n.ze;
2526
+ n.fe.notify(n, n.ze, i, r);
2321
2527
  };
2322
- n.Le = t;
2323
- n.Se = true;
2528
+ n.ze = t;
2529
+ n.ye = true;
2324
2530
  recompute(n, true);
2325
2531
  return n;
2326
2532
  }
2327
2533
  function createBoundChildren(e, t, n, i) {
2328
- const r = e.J;
2329
- r.addChild((e.J = n));
2330
- onCleanup(() => r.removeChild(e.J));
2534
+ const r = e.fe;
2535
+ r.addChild((e.fe = n));
2536
+ onCleanup(() => r.removeChild(e.fe));
2331
2537
  return runWithOwner(e, () => {
2332
2538
  const e = computed(t);
2333
2539
  return boundaryComputed(() => staleValues(() => flatten(read(e))), i);
2334
2540
  });
2335
2541
  }
2336
2542
  class ConditionalQueue extends Queue {
2337
- He;
2338
- Fe = new Set();
2339
- L = new Set();
2543
+ Ze;
2544
+ Je = new Set();
2545
+ q = new Set();
2340
2546
  constructor(e) {
2341
2547
  super();
2342
- this.He = e;
2548
+ this.Ze = e;
2343
2549
  }
2344
2550
  run(e) {
2345
- if (!e || read(this.He)) return;
2551
+ if (!e || read(this.Ze)) return;
2346
2552
  return super.run(e);
2347
2553
  }
2348
- notify(e, t, n) {
2349
- if (read(this.He)) {
2554
+ notify(e, t, n, i) {
2555
+ if (read(this.Ze)) {
2350
2556
  if (t & STATUS_PENDING) {
2351
2557
  if (n & STATUS_PENDING) {
2352
- this.L.add(e);
2558
+ this.q.add(e);
2353
2559
  t &= ~STATUS_PENDING;
2354
- } else if (this.L.delete(e)) t &= ~STATUS_PENDING;
2560
+ } else if (this.q.delete(e)) t &= ~STATUS_PENDING;
2355
2561
  }
2356
2562
  if (t & STATUS_ERROR) {
2357
2563
  if (n & STATUS_ERROR) {
2358
- this.Fe.add(e);
2564
+ this.Je.add(e);
2359
2565
  t &= ~STATUS_ERROR;
2360
- } else if (this.Fe.delete(e)) t &= ~STATUS_ERROR;
2566
+ } else if (this.Je.delete(e)) t &= ~STATUS_ERROR;
2361
2567
  }
2362
2568
  }
2363
- return t ? super.notify(e, t, n) : true;
2569
+ return t ? super.notify(e, t, n, i ?? e.re) : true;
2364
2570
  }
2365
2571
  }
2366
2572
  class CollectionQueue extends Queue {
2367
- je;
2368
- Ue = new Set();
2369
- He = signal(false, { pureWrite: true });
2370
- Ke = false;
2573
+ et;
2574
+ tt = new Set();
2575
+ Ze = signal(false, { pureWrite: true });
2576
+ nt = false;
2371
2577
  constructor(e) {
2372
2578
  super();
2373
- this.je = e;
2579
+ this.et = e;
2374
2580
  }
2375
2581
  run(e) {
2376
- if (!e || read(this.He)) return;
2582
+ if (!e || read(this.Ze)) return;
2377
2583
  return super.run(e);
2378
2584
  }
2379
- notify(e, t, n) {
2380
- if (!(t & this.je) || (this.je & STATUS_PENDING && this.Ke)) return super.notify(e, t, n);
2381
- if (n & this.je) {
2382
- this.Ue.add(e);
2383
- if (this.Ue.size === 1) setSignal(this.He, true);
2384
- } else if (this.Ue.size > 0) {
2385
- this.Ue.delete(e);
2386
- if (this.Ue.size === 0) setSignal(this.He, false);
2585
+ notify(e, t, n, i) {
2586
+ if (!(t & this.et) || (this.et & STATUS_PENDING && this.nt)) return super.notify(e, t, n, i);
2587
+ if (n & this.et) {
2588
+ const t = i?.t || e.re?.t;
2589
+ if (t) {
2590
+ const e = this.tt.size === 0;
2591
+ this.tt.add(t);
2592
+ if (e) setSignal(this.Ze, true);
2593
+ }
2594
+ }
2595
+ t &= ~this.et;
2596
+ return t ? super.notify(e, t, n, i) : true;
2597
+ }
2598
+ checkSources() {
2599
+ for (const e of this.tt) {
2600
+ if (!(e.de & this.et)) this.tt.delete(e);
2387
2601
  }
2388
- t &= ~this.je;
2389
- return t ? super.notify(e, t, n) : true;
2602
+ if (!this.tt.size) setSignal(this.Ze, false);
2390
2603
  }
2391
2604
  }
2392
2605
  var BoundaryMode;
@@ -2399,26 +2612,26 @@ function createBoundary(e, t) {
2399
2612
  const i = new ConditionalQueue(computed(() => t() === BoundaryMode.HIDDEN));
2400
2613
  const r = createBoundChildren(n, e, i, 0);
2401
2614
  computed(() => {
2402
- const e = read(i.He);
2403
- r.Le = e ? STATUS_ERROR | STATUS_PENDING : 0;
2615
+ const e = read(i.Ze);
2616
+ r.ze = e ? STATUS_ERROR | STATUS_PENDING : 0;
2404
2617
  if (!e) {
2405
- i.L.forEach(e => i.notify(e, STATUS_PENDING, STATUS_PENDING));
2406
- i.Fe.forEach(e => i.notify(e, STATUS_ERROR, STATUS_ERROR));
2407
- i.L.clear();
2408
- i.Fe.clear();
2618
+ i.q.forEach(e => i.notify(e, STATUS_PENDING, STATUS_PENDING, e.re));
2619
+ i.Je.forEach(e => i.notify(e, STATUS_ERROR, STATUS_ERROR, e.re));
2620
+ i.q.clear();
2621
+ i.Je.clear();
2409
2622
  }
2410
2623
  });
2411
- return () => (read(i.He) ? undefined : read(r));
2624
+ return () => (read(i.Ze) ? undefined : read(r));
2412
2625
  }
2413
2626
  function createCollectionBoundary(e, t, n) {
2414
2627
  const i = createOwner();
2415
2628
  const r = new CollectionQueue(e);
2416
2629
  const o = createBoundChildren(i, t, r, e);
2417
2630
  const s = computed(() => {
2418
- if (!read(r.He)) {
2631
+ if (!read(r.Ze)) {
2419
2632
  const e = read(o);
2420
- if (!untrack(() => read(r.He))) {
2421
- r.Ke = true;
2633
+ if (!untrack(() => read(r.Ze))) {
2634
+ r.nt = true;
2422
2635
  return e;
2423
2636
  }
2424
2637
  }
@@ -2429,26 +2642,12 @@ function createCollectionBoundary(e, t, n) {
2429
2642
  function createLoadBoundary(e, t) {
2430
2643
  return createCollectionBoundary(STATUS_PENDING, e, () => t());
2431
2644
  }
2432
- function collectErrorSources(e, t) {
2433
- let n = true;
2434
- let i = e.C;
2435
- while (i !== null) {
2436
- const e = i.V;
2437
- if (e.C && e.ie & STATUS_ERROR) {
2438
- n = false;
2439
- collectErrorSources(e, t);
2440
- }
2441
- i = i.D;
2442
- }
2443
- n && t.push(e);
2444
- }
2445
2645
  function createErrorBoundary(e, t) {
2446
2646
  return createCollectionBoundary(STATUS_ERROR, e, e => {
2447
- let n = e.Ue.values().next().value;
2448
- return t(n.B, () => {
2449
- const t = [];
2450
- for (const n of e.Ue) collectErrorSources(n, t);
2451
- for (const e of t) recompute(e);
2647
+ let n = e.tt.values().next().value;
2648
+ const i = n.re?.cause ?? n.re;
2649
+ return t(i, () => {
2650
+ for (const t of e.tt) recompute(t);
2452
2651
  schedule();
2453
2652
  });
2454
2653
  });