@solidjs/signals 0.13.2 → 0.13.4

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
@@ -148,38 +148,115 @@ let clock = 0;
148
148
  let activeTransition = null;
149
149
  let scheduled = false;
150
150
  let projectionWriteActive = false;
151
+ let stashedOptimisticReads = null;
151
152
  function enforceLoadingBoundary(e) {}
153
+ function shouldReadStashedOptimisticValue(e) {
154
+ return !!stashedOptimisticReads?.has(e);
155
+ }
152
156
  function runLaneEffects(e) {
153
157
  for (const t of activeLanes) {
154
- if (t.k || t.U.size > 0) continue;
155
- const n = t.W[e - 1];
158
+ if (t.U || t.k.size > 0) continue;
159
+ const n = t.G[e - 1];
156
160
  if (n.length) {
157
- t.W[e - 1] = [];
161
+ t.G[e - 1] = [];
158
162
  runQueue(n, e);
159
163
  }
160
164
  }
161
165
  }
166
+ function queueStashedOptimisticEffects(e) {
167
+ for (let t = e.I; t !== null; t = t.p) {
168
+ const e = t.h;
169
+ if (!e.H) continue;
170
+ if (e.H === EFFECT_TRACKED) {
171
+ if (!e.W) {
172
+ e.W = true;
173
+ e.F.enqueue(EFFECT_USER, e.M);
174
+ }
175
+ continue;
176
+ }
177
+ const n = e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
178
+ if (n.P > e.o) n.P = e.o;
179
+ insertIntoHeap(e, n);
180
+ }
181
+ }
162
182
  function setProjectionWriteActive(e) {
163
183
  projectionWriteActive = e;
164
184
  }
185
+ function mergeTransitionState(e, t) {
186
+ t.$ = e;
187
+ e.j.push(...t.j);
188
+ for (const n of activeLanes) {
189
+ if (n.K === t) n.K = e;
190
+ }
191
+ e.Y.push(...t.Y);
192
+ for (const n of t.B) e.B.add(n);
193
+ for (const n of t.Z) {
194
+ if (!e.Z.includes(n)) e.Z.push(n);
195
+ }
196
+ }
197
+ function resolveOptimisticNodes(e) {
198
+ for (let t = 0; t < e.length; t++) {
199
+ const n = e[t];
200
+ n.q = undefined;
201
+ if (n.X !== NOT_PENDING) {
202
+ n.J = n.X;
203
+ n.X = NOT_PENDING;
204
+ }
205
+ const i = n.ee;
206
+ n.ee = NOT_PENDING;
207
+ if (i !== NOT_PENDING && n.J !== i) insertSubs(n, true);
208
+ n.K = null;
209
+ }
210
+ e.length = 0;
211
+ }
212
+ function cleanupCompletedLanes(e) {
213
+ for (const t of activeLanes) {
214
+ const n = e ? t.K === e : !t.K;
215
+ if (!n) continue;
216
+ if (!t.U) {
217
+ if (t.G[0].length) runQueue(t.G[0], EFFECT_RENDER);
218
+ if (t.G[1].length) runQueue(t.G[1], EFFECT_USER);
219
+ }
220
+ if (t.te.q === t) t.te.q = undefined;
221
+ t.k.clear();
222
+ t.G[0].length = 0;
223
+ t.G[1].length = 0;
224
+ activeLanes.delete(t);
225
+ signalLanes.delete(t.te);
226
+ }
227
+ }
165
228
  function schedule() {
166
229
  if (scheduled) return;
167
230
  scheduled = true;
168
- if (!globalQueue.H && !projectionWriteActive) queueMicrotask(flush);
231
+ if (!globalQueue.ne && !projectionWriteActive) queueMicrotask(flush);
232
+ }
233
+ function addTransitionBlocker(e) {
234
+ if (activeTransition && !activeTransition.Z.includes(e)) {
235
+ activeTransition.Z.push(e);
236
+ }
237
+ }
238
+ function removeTransitionBlocker(e) {
239
+ const remove = t => {
240
+ if (!t) return;
241
+ const n = t.indexOf(e);
242
+ if (n >= 0) t.splice(n, 1);
243
+ };
244
+ remove(e.K?.Z);
245
+ remove(activeTransition?.Z);
169
246
  }
170
247
  class Queue {
171
248
  i = null;
172
- G = [[], []];
173
- F = [];
249
+ ie = [[], []];
250
+ re = [];
174
251
  created = clock;
175
252
  addChild(e) {
176
- this.F.push(e);
253
+ this.re.push(e);
177
254
  e.i = this;
178
255
  }
179
256
  removeChild(e) {
180
- const t = this.F.indexOf(e);
257
+ const t = this.re.indexOf(e);
181
258
  if (t >= 0) {
182
- this.F.splice(t, 1);
259
+ this.re.splice(t, 1);
183
260
  e.i = null;
184
261
  }
185
262
  }
@@ -188,88 +265,101 @@ class Queue {
188
265
  return false;
189
266
  }
190
267
  run(e) {
191
- if (this.G[e - 1].length) {
192
- const t = this.G[e - 1];
193
- this.G[e - 1] = [];
268
+ if (this.ie[e - 1].length) {
269
+ const t = this.ie[e - 1];
270
+ this.ie[e - 1] = [];
194
271
  runQueue(t, e);
195
272
  }
196
- for (let t = 0; t < this.F.length; t++) this.F[t].run?.(e);
273
+ for (let t = 0; t < this.re.length; t++) this.re[t].run?.(e);
197
274
  }
198
275
  enqueue(e, t) {
199
276
  if (e) {
200
277
  if (currentOptimisticLane) {
201
278
  const n = findLane(currentOptimisticLane);
202
- n.W[e - 1].push(t);
279
+ n.G[e - 1].push(t);
203
280
  } else {
204
- this.G[e - 1].push(t);
281
+ this.ie[e - 1].push(t);
205
282
  }
206
283
  }
207
284
  schedule();
208
285
  }
209
286
  stashQueues(e) {
210
- e.G[0].push(...this.G[0]);
211
- e.G[1].push(...this.G[1]);
212
- this.G = [[], []];
213
- for (let t = 0; t < this.F.length; t++) {
214
- let n = this.F[t];
215
- let i = e.F[t];
287
+ e.ie[0].push(...this.ie[0]);
288
+ e.ie[1].push(...this.ie[1]);
289
+ this.ie = [[], []];
290
+ for (let t = 0; t < this.re.length; t++) {
291
+ let n = this.re[t];
292
+ let i = e.re[t];
216
293
  if (!i) {
217
- i = { G: [[], []], F: [] };
218
- e.F[t] = i;
294
+ i = { ie: [[], []], re: [] };
295
+ e.re[t] = i;
219
296
  }
220
297
  n.stashQueues(i);
221
298
  }
222
299
  }
223
300
  restoreQueues(e) {
224
- this.G[0].push(...e.G[0]);
225
- this.G[1].push(...e.G[1]);
226
- for (let t = 0; t < e.F.length; t++) {
227
- const n = e.F[t];
228
- let i = this.F[t];
301
+ this.ie[0].push(...e.ie[0]);
302
+ this.ie[1].push(...e.ie[1]);
303
+ for (let t = 0; t < e.re.length; t++) {
304
+ const n = e.re[t];
305
+ let i = this.re[t];
229
306
  if (i) i.restoreQueues(n);
230
307
  }
231
308
  }
232
309
  }
233
310
  class GlobalQueue extends Queue {
234
- H = false;
235
- M = [];
236
- $ = [];
237
- j = new Set();
238
- static K;
239
- static Y;
240
- static B = null;
311
+ ne = false;
312
+ oe = [];
313
+ Y = [];
314
+ B = new Set();
315
+ static se;
316
+ static ue;
317
+ static ce = null;
241
318
  flush() {
242
- if (this.H) return;
243
- this.H = true;
319
+ if (this.ne) return;
320
+ this.ne = true;
244
321
  try {
245
- runHeap(dirtyQueue, GlobalQueue.K);
322
+ runHeap(dirtyQueue, GlobalQueue.se);
246
323
  if (activeTransition) {
247
324
  const e = transitionComplete(activeTransition);
248
325
  if (!e) {
249
- let e = activeTransition;
250
- runHeap(zombieQueue, GlobalQueue.K);
251
- this.M = [];
252
- this.$ = [];
253
- this.j = new Set();
326
+ const e = activeTransition;
327
+ runHeap(zombieQueue, GlobalQueue.se);
328
+ this.oe = [];
329
+ this.Y = [];
330
+ this.B = new Set();
254
331
  runLaneEffects(EFFECT_RENDER);
255
332
  runLaneEffects(EFFECT_USER);
256
- this.stashQueues(activeTransition.Z);
333
+ this.stashQueues(e.ae);
257
334
  clock++;
258
335
  scheduled = dirtyQueue.R >= dirtyQueue.P;
259
- reassignPendingTransition(activeTransition.M);
336
+ reassignPendingTransition(e.oe);
260
337
  activeTransition = null;
261
- finalizePureQueue(null, true);
338
+ if (!e.j.length && e.Y.length) {
339
+ stashedOptimisticReads = new Set();
340
+ for (let t = 0; t < e.Y.length; t++) {
341
+ const n = e.Y[t];
342
+ if (n.L || n.fe) continue;
343
+ stashedOptimisticReads.add(n);
344
+ queueStashedOptimisticEffects(n);
345
+ }
346
+ }
347
+ try {
348
+ finalizePureQueue(null, true);
349
+ } finally {
350
+ stashedOptimisticReads = null;
351
+ }
262
352
  return;
263
353
  }
264
- this.M !== activeTransition.M && this.M.push(...activeTransition.M);
265
- this.restoreQueues(activeTransition.Z);
354
+ this.oe !== activeTransition.oe && this.oe.push(...activeTransition.oe);
355
+ this.restoreQueues(activeTransition.ae);
266
356
  transitions.delete(activeTransition);
267
357
  const t = activeTransition;
268
358
  activeTransition = null;
269
- reassignPendingTransition(this.M);
359
+ reassignPendingTransition(this.oe);
270
360
  finalizePureQueue(t);
271
361
  } else {
272
- if (transitions.size) runHeap(zombieQueue, GlobalQueue.K);
362
+ if (transitions.size) runHeap(zombieQueue, GlobalQueue.se);
273
363
  finalizePureQueue();
274
364
  }
275
365
  clock++;
@@ -279,16 +369,19 @@ class GlobalQueue extends Queue {
279
369
  runLaneEffects(EFFECT_USER);
280
370
  this.run(EFFECT_USER);
281
371
  } finally {
282
- this.H = false;
372
+ this.ne = false;
283
373
  }
284
374
  }
285
375
  notify(e, t, n, i) {
286
376
  if (t & STATUS_PENDING) {
287
377
  if (n & STATUS_PENDING) {
288
- const t = i !== undefined ? i : e.q;
289
- if (activeTransition && t && !activeTransition.X.includes(t.source)) {
290
- activeTransition.X.push(t.source);
291
- schedule();
378
+ const t = i !== undefined ? i : e.le;
379
+ if (activeTransition && t) {
380
+ const e = t.source;
381
+ if (!activeTransition.Z.includes(e)) {
382
+ activeTransition.Z.push(e);
383
+ schedule();
384
+ }
292
385
  }
293
386
  }
294
387
  return true;
@@ -298,58 +391,56 @@ class GlobalQueue extends Queue {
298
391
  initTransition(e) {
299
392
  if (e) e = currentTransition(e);
300
393
  if (e && e === activeTransition) return;
301
- if (!e && activeTransition && activeTransition.J === clock) return;
394
+ if (!e && activeTransition && activeTransition.Ee === clock) return;
302
395
  if (!activeTransition) {
303
396
  activeTransition = e ?? {
304
- J: clock,
305
- M: [],
306
- X: [],
307
- $: [],
308
- j: new Set(),
309
- ee: [],
310
- Z: { G: [[], []], F: [] },
311
- te: false
397
+ Ee: clock,
398
+ oe: [],
399
+ Z: [],
400
+ Y: [],
401
+ B: new Set(),
402
+ j: [],
403
+ ae: { ie: [[], []], re: [] },
404
+ $: false
312
405
  };
313
406
  } else if (e) {
314
407
  const t = activeTransition;
315
- t.te = e;
316
- e.ee.push(...t.ee);
317
- for (const n of activeLanes) {
318
- if (n.ne === t) n.ne = e;
319
- }
320
- e.$.push(...t.$);
321
- for (const n of t.j) {
322
- e.j.add(n);
323
- }
408
+ mergeTransitionState(e, t);
324
409
  transitions.delete(t);
325
410
  activeTransition = e;
326
411
  }
327
412
  transitions.add(activeTransition);
328
- activeTransition.J = clock;
329
- for (let e = 0; e < this.M.length; e++) {
330
- const t = this.M[e];
331
- t.ne = activeTransition;
332
- activeTransition.M.push(t);
333
- }
334
- this.M = activeTransition.M;
335
- for (let e = 0; e < this.$.length; e++) {
336
- const t = this.$[e];
337
- t.ne = activeTransition;
338
- activeTransition.$.push(t);
339
- }
340
- this.$ = activeTransition.$;
413
+ activeTransition.Ee = clock;
414
+ if (this.oe !== activeTransition.oe) {
415
+ for (let e = 0; e < this.oe.length; e++) {
416
+ const t = this.oe[e];
417
+ t.K = activeTransition;
418
+ activeTransition.oe.push(t);
419
+ }
420
+ this.oe = activeTransition.oe;
421
+ }
422
+ if (this.Y !== activeTransition.Y) {
423
+ for (let e = 0; e < this.Y.length; e++) {
424
+ const t = this.Y[e];
425
+ t.K = activeTransition;
426
+ activeTransition.Y.push(t);
427
+ }
428
+ this.Y = activeTransition.Y;
429
+ }
341
430
  for (const e of activeLanes) {
342
- if (!e.ne) e.ne = activeTransition;
431
+ if (!e.K) e.K = activeTransition;
432
+ }
433
+ if (this.B !== activeTransition.B) {
434
+ for (const e of this.B) activeTransition.B.add(e);
435
+ this.B = activeTransition.B;
343
436
  }
344
- for (const e of this.j) activeTransition.j.add(e);
345
- this.j = activeTransition.j;
346
437
  }
347
438
  }
348
439
  function insertSubs(e, t = false) {
349
- const n = e.ie || currentOptimisticLane;
350
- const i = e.re !== undefined;
440
+ const n = e.q || currentOptimisticLane;
441
+ const i = e.Te !== undefined;
351
442
  for (let r = e.I; r !== null; r = r.p) {
352
- if (i && r.h.oe) {
443
+ if (i && r.h.de) {
353
444
  r.h.O |= REACTIVE_SNAPSHOT_STALE;
354
445
  continue;
355
446
  }
@@ -358,13 +449,13 @@ function insertSubs(e, t = false) {
358
449
  assignOrMergeLane(r.h, n);
359
450
  } else if (t) {
360
451
  r.h.O |= REACTIVE_OPTIMISTIC_DIRTY;
361
- r.h.ie = undefined;
452
+ r.h.q = undefined;
362
453
  }
363
454
  const e = r.h;
364
- if (e.se === EFFECT_TRACKED) {
365
- if (!e.ue) {
366
- e.ue = true;
367
- e.ce.enqueue(EFFECT_USER, e.ae);
455
+ if (e.H === EFFECT_TRACKED) {
456
+ if (!e.W) {
457
+ e.W = true;
458
+ e.F.enqueue(EFFECT_USER, e.M);
368
459
  }
369
460
  continue;
370
461
  }
@@ -374,88 +465,56 @@ function insertSubs(e, t = false) {
374
465
  }
375
466
  }
376
467
  function commitPendingNodes() {
377
- const e = globalQueue.M;
468
+ const e = globalQueue.oe;
378
469
  for (let t = 0; t < e.length; t++) {
379
470
  const n = e[t];
380
- if (n.le !== NOT_PENDING) {
381
- n.fe = n.le;
382
- n.le = NOT_PENDING;
383
- if (n.se && n.se !== EFFECT_TRACKED) n.ue = true;
471
+ if (n.X !== NOT_PENDING) {
472
+ n.J = n.X;
473
+ n.X = NOT_PENDING;
474
+ if (n.H && n.H !== EFFECT_TRACKED) n.W = true;
384
475
  }
385
- if (n.Ee & STATUS_PENDING) {
386
- const e = n.q?.source;
387
- if (e && !(e.Ee & STATUS_PENDING)) {
388
- n.Ee &= -6;
389
- n.q = null;
390
- }
391
- } else n.Ee &= ~STATUS_UNINITIALIZED;
392
- if (n.L) GlobalQueue.Y(n, false, true);
476
+ if (!(n.Se & STATUS_PENDING)) n.Se &= ~STATUS_UNINITIALIZED;
477
+ if (n.L) GlobalQueue.ue(n, false, true);
393
478
  }
394
479
  e.length = 0;
395
480
  }
396
481
  function finalizePureQueue(e = null, t = false) {
397
- let n = !t;
482
+ const n = !t;
398
483
  if (n) commitPendingNodes();
399
484
  if (!t) checkBoundaryChildren(globalQueue);
400
- if (dirtyQueue.R >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.K);
485
+ if (dirtyQueue.R >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.se);
401
486
  if (n) {
402
487
  commitPendingNodes();
403
- const t = e ? e.$ : globalQueue.$;
404
- for (let e = 0; e < t.length; e++) {
405
- const n = t[e];
406
- n.ie = undefined;
407
- if (n.le !== NOT_PENDING) {
408
- n.fe = n.le;
409
- n.le = NOT_PENDING;
410
- }
411
- const i = n.Te;
412
- n.Te = NOT_PENDING;
413
- if (i !== NOT_PENDING && n.fe !== i) insertSubs(n, true);
414
- n.ne = null;
415
- }
416
- t.length = 0;
417
- const n = e ? e.j : globalQueue.j;
418
- if (GlobalQueue.B && n.size) {
419
- for (const e of n) {
420
- GlobalQueue.B(e);
421
- }
422
- n.clear();
423
- schedule();
424
- }
425
- for (const t of activeLanes) {
426
- const n = e ? t.ne === e : !t.ne;
427
- if (!n) continue;
428
- if (!t.k) {
429
- if (t.W[0].length) runQueue(t.W[0], EFFECT_RENDER);
430
- if (t.W[1].length) runQueue(t.W[1], EFFECT_USER);
488
+ resolveOptimisticNodes(e ? e.Y : globalQueue.Y);
489
+ const t = e ? e.B : globalQueue.B;
490
+ if (GlobalQueue.ce && t.size) {
491
+ for (const e of t) {
492
+ GlobalQueue.ce(e);
431
493
  }
432
- if (t.de.ie === t) t.de.ie = undefined;
433
- t.U.clear();
434
- t.W[0].length = 0;
435
- t.W[1].length = 0;
436
- activeLanes.delete(t);
437
- signalLanes.delete(t.de);
494
+ t.clear();
495
+ schedule();
438
496
  }
497
+ cleanupCompletedLanes(e);
439
498
  }
440
499
  }
441
500
  function checkBoundaryChildren(e) {
442
- for (const t of e.F) {
501
+ for (const t of e.re) {
443
502
  t.checkSources?.();
444
503
  checkBoundaryChildren(t);
445
504
  }
446
505
  }
447
506
  function trackOptimisticStore(e) {
448
- globalQueue.j.add(e);
507
+ globalQueue.B.add(e);
449
508
  schedule();
450
509
  }
451
510
  function reassignPendingTransition(e) {
452
511
  for (let t = 0; t < e.length; t++) {
453
- e[t].ne = activeTransition;
512
+ e[t].K = activeTransition;
454
513
  }
455
514
  }
456
515
  const globalQueue = new GlobalQueue();
457
516
  function flush() {
458
- while (scheduled) {
517
+ while (scheduled || activeTransition) {
459
518
  globalQueue.flush();
460
519
  }
461
520
  }
@@ -463,21 +522,21 @@ function runQueue(e, t) {
463
522
  for (let n = 0; n < e.length; n++) e[n](t);
464
523
  }
465
524
  function transitionComplete(e) {
466
- if (e.te) return true;
467
- if (e.ee.length) return false;
525
+ if (e.$) return true;
526
+ if (e.j.length) return false;
468
527
  let t = true;
469
- for (let n = 0; n < e.X.length; n++) {
470
- const i = e.X[n];
471
- if (i.Ee & STATUS_PENDING && i.q?.source === i) {
528
+ for (let n = 0; n < e.Z.length; n++) {
529
+ const i = e.Z[n];
530
+ if (i.Se & STATUS_PENDING && i.le?.source === i) {
472
531
  t = false;
473
532
  break;
474
533
  }
475
534
  }
476
- t && (e.te = true);
535
+ t && (e.$ = true);
477
536
  return t;
478
537
  }
479
538
  function currentTransition(e) {
480
- while (e.te && typeof e.te === "object") e = e.te;
539
+ while (e.$ && typeof e.$ === "object") e = e.$;
481
540
  return e;
482
541
  }
483
542
  function setActiveTransition(e) {
@@ -499,105 +558,199 @@ function getOrCreateLane(e) {
499
558
  if (t) {
500
559
  return findLane(t);
501
560
  }
502
- const n = e.Se;
503
- const i = n?.ie ? findLane(n.ie) : null;
504
- t = { de: e, U: new Set(), W: [[], []], k: null, ne: activeTransition, Re: i };
561
+ const n = e.Re;
562
+ const i = n?.q ? findLane(n.q) : null;
563
+ t = { te: e, k: new Set(), G: [[], []], U: null, K: activeTransition, Oe: i };
505
564
  signalLanes.set(e, t);
506
565
  activeLanes.add(t);
507
- e.Oe = false;
566
+ e._e = false;
508
567
  return t;
509
568
  }
510
569
  function findLane(e) {
511
- while (e.k) e = e.k;
570
+ while (e.U) e = e.U;
512
571
  return e;
513
572
  }
514
573
  function mergeLanes(e, t) {
515
574
  e = findLane(e);
516
575
  t = findLane(t);
517
576
  if (e === t) return e;
518
- t.k = e;
519
- for (const n of t.U) e.U.add(n);
520
- e.W[0].push(...t.W[0]);
521
- e.W[1].push(...t.W[1]);
577
+ t.U = e;
578
+ for (const n of t.k) e.k.add(n);
579
+ e.G[0].push(...t.G[0]);
580
+ e.G[1].push(...t.G[1]);
522
581
  return e;
523
582
  }
524
583
  function resolveLane(e) {
525
- const t = e.ie;
584
+ const t = e.q;
526
585
  if (!t) return undefined;
527
586
  const n = findLane(t);
528
587
  if (activeLanes.has(n)) return n;
529
- e.ie = undefined;
588
+ e.q = undefined;
530
589
  return undefined;
531
590
  }
591
+ function resolveTransition(e) {
592
+ return resolveLane(e)?.K ?? e.K;
593
+ }
532
594
  function hasActiveOverride(e) {
533
- return !!(e.Te !== undefined && e.Te !== NOT_PENDING);
595
+ return !!(e.ee !== undefined && e.ee !== NOT_PENDING);
534
596
  }
535
597
  function assignOrMergeLane(e, t) {
536
598
  const n = findLane(t);
537
- const i = e.ie;
599
+ const i = e.q;
538
600
  if (i) {
539
- if (i.k) {
540
- e.ie = t;
601
+ if (i.U) {
602
+ e.q = t;
541
603
  return;
542
604
  }
543
605
  const r = findLane(i);
544
606
  if (activeLanes.has(r)) {
545
607
  if (r !== n && !hasActiveOverride(e)) {
546
- if (n.Re && findLane(n.Re) === r) {
547
- e.ie = t;
548
- } else if (r.Re && findLane(r.Re) === n);
608
+ if (n.Oe && findLane(n.Oe) === r) {
609
+ e.q = t;
610
+ } else if (r.Oe && findLane(r.Oe) === n);
549
611
  else mergeLanes(n, r);
550
612
  }
551
613
  return;
552
614
  }
553
615
  }
554
- e.ie = t;
616
+ e.q = t;
617
+ }
618
+ function addPendingSource(e, t) {
619
+ if (e.Ie === t || e.pe?.has(t)) return false;
620
+ if (!e.Ie) {
621
+ e.Ie = t;
622
+ return true;
623
+ }
624
+ if (!e.pe) {
625
+ e.pe = new Set([e.Ie, t]);
626
+ } else {
627
+ e.pe.add(t);
628
+ }
629
+ e.Ie = undefined;
630
+ return true;
631
+ }
632
+ function removePendingSource(e, t) {
633
+ if (e.Ie) {
634
+ if (e.Ie !== t) return false;
635
+ e.Ie = undefined;
636
+ return true;
637
+ }
638
+ if (!e.pe?.delete(t)) return false;
639
+ if (e.pe.size === 1) {
640
+ e.Ie = e.pe.values().next().value;
641
+ e.pe = undefined;
642
+ } else if (e.pe.size === 0) {
643
+ e.pe = undefined;
644
+ }
645
+ return true;
646
+ }
647
+ function clearPendingSources(e) {
648
+ e.Ie = undefined;
649
+ e.pe?.clear();
650
+ e.pe = undefined;
651
+ }
652
+ function setPendingError(e, t, n) {
653
+ if (!t) {
654
+ e.le = null;
655
+ return;
656
+ }
657
+ if (n instanceof NotReadyError && n.source === t) {
658
+ e.le = n;
659
+ return;
660
+ }
661
+ const i = e.le;
662
+ if (!(i instanceof NotReadyError) || i.source !== t) {
663
+ e.le = new NotReadyError(t);
664
+ }
665
+ }
666
+ function forEachDependent(e, t) {
667
+ for (let n = e.I; n !== null; n = n.p) t(n.h);
668
+ for (let n = e.A; n !== null; n = n.N) {
669
+ for (let e = n.I; e !== null; e = e.p) t(e.h);
670
+ }
671
+ }
672
+ function settlePendingSource(e) {
673
+ let t = false;
674
+ const n = new Set();
675
+ const settle = i => {
676
+ if (n.has(i) || !removePendingSource(i, e)) return;
677
+ n.add(i);
678
+ i.Ee = clock;
679
+ const r = i.Ie ?? i.pe?.values().next().value;
680
+ if (r) {
681
+ setPendingError(i, r);
682
+ updatePendingSignal(i);
683
+ } else {
684
+ i.Se &= ~STATUS_PENDING;
685
+ setPendingError(i);
686
+ updatePendingSignal(i);
687
+ if (i.he) {
688
+ if (i.H === EFFECT_TRACKED) {
689
+ const e = i;
690
+ if (!e.W) {
691
+ e.W = true;
692
+ e.F.enqueue(EFFECT_USER, e.M);
693
+ }
694
+ } else {
695
+ const e = i.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
696
+ if (e.P > i.o) e.P = i.o;
697
+ insertIntoHeap(i, e);
698
+ }
699
+ t = true;
700
+ }
701
+ i.he = false;
702
+ }
703
+ forEachDependent(i, settle);
704
+ };
705
+ forEachDependent(e, settle);
706
+ if (t) schedule();
555
707
  }
556
708
  function handleAsync(e, t, n) {
557
709
  const i = typeof t === "object" && t !== null;
558
710
  const r = i && untrack(() => t[Symbol.asyncIterator]);
559
711
  const o = !r && i && untrack(() => typeof t.then === "function");
560
712
  if (!o && !r) {
561
- e._e = null;
713
+ e.Ae = null;
562
714
  return t;
563
715
  }
564
- e._e = t;
716
+ e.Ae = t;
565
717
  let s;
566
718
  const handleError = n => {
567
- if (e._e !== t) return;
568
- globalQueue.initTransition(e.ne);
719
+ if (e.Ae !== t) return;
720
+ globalQueue.initTransition(resolveTransition(e));
569
721
  notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
570
- e.J = clock;
722
+ e.Ee = clock;
571
723
  };
572
724
  const asyncWrite = (i, r) => {
573
- if (e._e !== t) return;
725
+ if (e.Ae !== t) return;
574
726
  if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
575
- globalQueue.initTransition(e.ne);
727
+ globalQueue.initTransition(resolveTransition(e));
576
728
  clearStatus(e);
577
729
  const o = resolveLane(e);
578
- if (o) o.U.delete(e);
730
+ if (o) o.k.delete(e);
579
731
  if (n) n(i);
580
- else if (e.Te !== undefined) {
581
- if (e.Te !== undefined && e.Te !== NOT_PENDING) e.le = i;
732
+ else if (e.ee !== undefined) {
733
+ if (e.ee !== undefined && e.ee !== NOT_PENDING) e.X = i;
582
734
  else {
583
- e.fe = i;
735
+ e.J = i;
584
736
  insertSubs(e);
585
737
  }
586
- e.J = clock;
738
+ e.Ee = clock;
587
739
  } else if (o) {
588
- const t = e.fe;
589
- const n = e.Ie;
740
+ const t = e.J;
741
+ const n = e.Ne;
590
742
  if (!n || !n(i, t)) {
591
- e.fe = i;
592
- e.J = clock;
593
- if (e.pe) {
594
- setSignal(e.pe, i);
743
+ e.J = i;
744
+ e.Ee = clock;
745
+ if (e.Pe) {
746
+ setSignal(e.Pe, i);
595
747
  }
596
748
  insertSubs(e, true);
597
749
  }
598
750
  } else {
599
751
  setSignal(e, () => i);
600
752
  }
753
+ settlePendingSource(e);
601
754
  schedule();
602
755
  flush();
603
756
  r?.();
@@ -618,7 +771,7 @@ function handleAsync(e, t, n) {
618
771
  );
619
772
  i = false;
620
773
  if (!n) {
621
- globalQueue.initTransition(e.ne);
774
+ globalQueue.initTransition(resolveTransition(e));
622
775
  throw new NotReadyError(context);
623
776
  }
624
777
  }
@@ -654,126 +807,92 @@ function handleAsync(e, t, n) {
654
807
  };
655
808
  const r = iterate();
656
809
  if (!i && !r) {
657
- globalQueue.initTransition(e.ne);
810
+ globalQueue.initTransition(resolveTransition(e));
658
811
  throw new NotReadyError(context);
659
812
  }
660
813
  }
661
814
  return s;
662
815
  }
663
- function clearStatus(e) {
664
- e.Ee = e.Ee & STATUS_UNINITIALIZED;
665
- e.q = null;
816
+ function clearStatus(e, t = false) {
817
+ clearPendingSources(e);
818
+ removeTransitionBlocker(e);
819
+ e.he = false;
820
+ e.Se = t ? 0 : e.Se & STATUS_UNINITIALIZED;
821
+ setPendingError(e);
666
822
  updatePendingSignal(e);
667
- e.he?.();
823
+ e.ge?.();
668
824
  }
669
825
  function notifyStatus(e, t, n, i, r) {
670
826
  if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
671
827
  n = new StatusError(e, n);
672
- const o = n instanceof NotReadyError && n.source === e;
673
- const s = t === STATUS_PENDING && e.Te !== undefined && !o;
674
- const u = s && hasActiveOverride(e);
828
+ const o = t === STATUS_PENDING && n instanceof NotReadyError ? n.source : undefined;
829
+ const s = o === e;
830
+ const u = t === STATUS_PENDING && e.ee !== undefined && !s;
831
+ const c = u && hasActiveOverride(e);
675
832
  if (!i) {
676
- e.Ee = t | (t !== STATUS_ERROR ? e.Ee & STATUS_UNINITIALIZED : 0);
677
- e.q = n;
833
+ if (t === STATUS_PENDING && o) {
834
+ addPendingSource(e, o);
835
+ e.Se = STATUS_PENDING | (e.Se & STATUS_UNINITIALIZED);
836
+ setPendingError(e, e.Ie ?? e.pe?.values().next().value, n);
837
+ if (o === e) addTransitionBlocker(e);
838
+ } else {
839
+ clearPendingSources(e);
840
+ removeTransitionBlocker(e);
841
+ e.Se = t | (t !== STATUS_ERROR ? e.Se & STATUS_UNINITIALIZED : 0);
842
+ e.le = n;
843
+ }
678
844
  updatePendingSignal(e);
679
845
  }
680
846
  if (r && !i) {
681
847
  assignOrMergeLane(e, r);
682
848
  }
683
- if (u && activeTransition && n instanceof NotReadyError) {
684
- const e = n.source;
685
- if (!activeTransition.X.includes(e)) {
686
- activeTransition.X.push(e);
687
- }
688
- }
689
- const c = i || u;
690
- const a = i || s ? undefined : r;
691
- if (e.he) {
692
- if (c) {
693
- e.he(t, n);
849
+ const a = i || c;
850
+ const f = i || u ? undefined : r;
851
+ if (e.ge) {
852
+ if (a) {
853
+ e.ge(t, n);
694
854
  } else {
695
- e.he();
855
+ e.ge();
696
856
  }
697
857
  return;
698
858
  }
699
- for (let i = e.I; i !== null; i = i.p) {
700
- i.h.J = clock;
701
- if (i.h.q !== n) {
702
- !i.h.ne && globalQueue.M.push(i.h);
703
- notifyStatus(i.h, t, n, c, a);
704
- }
705
- }
706
- for (let i = e.A; i !== null; i = i.N) {
707
- for (let e = i.I; e !== null; e = e.p) {
708
- e.h.J = clock;
709
- if (e.h.q !== n) {
710
- !e.h.ne && globalQueue.M.push(e.h);
711
- notifyStatus(e.h, t, n, c, a);
712
- }
859
+ forEachDependent(e, e => {
860
+ e.Ee = clock;
861
+ if (
862
+ (t === STATUS_PENDING && o && e.Ie !== o && !e.pe?.has(o)) ||
863
+ (t !== STATUS_PENDING && (e.le !== n || e.Ie || e.pe))
864
+ ) {
865
+ !e.K && globalQueue.oe.push(e);
866
+ notifyStatus(e, t, n, a, f);
713
867
  }
714
- }
715
- }
716
- function unlinkSubs(e) {
717
- const t = e.m;
718
- const n = e.D;
719
- const i = e.p;
720
- const r = e.Ae;
721
- if (i !== null) i.Ae = r;
722
- else t.Ne = r;
723
- if (r !== null) r.p = i;
724
- else {
725
- t.I = i;
726
- if (i === null) {
727
- t.ge?.();
728
- t.L && !t.Pe && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
729
- }
730
- }
731
- return n;
732
- }
733
- function unobserved(e) {
734
- deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
735
- let t = e.C;
736
- while (t !== null) {
737
- t = unlinkSubs(t);
738
- }
739
- e.C = null;
740
- disposeChildren(e, true);
741
- }
742
- function link(e, t) {
743
- const n = t.Ce;
744
- if (n !== null && n.m === e) return;
745
- let i = null;
746
- const r = t.O & REACTIVE_RECOMPUTING_DEPS;
747
- if (r) {
748
- i = n !== null ? n.D : t.C;
749
- if (i !== null && i.m === e) {
750
- t.Ce = i;
751
- return;
752
- }
753
- }
754
- const o = e.Ne;
755
- if (o !== null && o.h === t && (!r || isValidLink(o, t))) return;
756
- const s = (t.Ce = e.Ne = { m: e, h: t, D: i, Ae: o, p: null });
757
- if (n !== null) n.D = s;
758
- else t.C = s;
759
- if (o !== null) o.p = s;
760
- else e.I = s;
868
+ });
761
869
  }
762
- function isValidLink(e, t) {
763
- const n = t.Ce;
764
- if (n !== null) {
765
- let i = t.C;
766
- do {
767
- if (i === e) return true;
768
- if (i === n) break;
769
- i = i.D;
770
- } while (i !== null);
870
+ let externalSourceConfig = null;
871
+ function enableExternalSource(e) {
872
+ const { factory: t, untrack: n = e => e() } = e;
873
+ if (externalSourceConfig) {
874
+ const { factory: e, untrack: i } = externalSourceConfig;
875
+ externalSourceConfig = {
876
+ factory: (n, i) => {
877
+ const r = e(n, i);
878
+ const o = t(e => r.track(e), i);
879
+ return {
880
+ track: e => o.track(e),
881
+ dispose() {
882
+ o.dispose();
883
+ r.dispose();
884
+ }
885
+ };
886
+ },
887
+ untrack: e => i(() => n(e))
888
+ };
889
+ } else {
890
+ externalSourceConfig = { factory: t, untrack: n };
771
891
  }
772
- return false;
773
892
  }
774
893
  const PENDING_OWNER = {};
775
894
  function markDisposal(e) {
776
- let t = e.De;
895
+ let t = e.Ce;
777
896
  while (t) {
778
897
  t.O |= REACTIVE_ZOMBIE;
779
898
  if (t.O & REACTIVE_IN_HEAP) {
@@ -781,7 +900,7 @@ function markDisposal(e) {
781
900
  insertIntoHeap(t, zombieQueue);
782
901
  }
783
902
  markDisposal(t);
784
- t = t.ye;
903
+ t = t.De;
785
904
  }
786
905
  }
787
906
  function dispose(e) {
@@ -790,15 +909,15 @@ function dispose(e) {
790
909
  t = unlinkSubs(t);
791
910
  } while (t !== null);
792
911
  e.C = null;
793
- e.Ce = null;
912
+ e.ye = null;
794
913
  disposeChildren(e, true);
795
914
  }
796
915
  function disposeChildren(e, t = false, n) {
797
916
  if (e.O & REACTIVE_DISPOSED) return;
798
917
  if (t) e.O = REACTIVE_DISPOSED;
799
- let i = n ? e.ve : e.De;
918
+ let i = n ? e.me : e.Ce;
800
919
  while (i) {
801
- const e = i.ye;
920
+ const e = i.De;
802
921
  if (i.C) {
803
922
  const e = i;
804
923
  deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
@@ -807,21 +926,21 @@ function disposeChildren(e, t = false, n) {
807
926
  t = unlinkSubs(t);
808
927
  } while (t !== null);
809
928
  e.C = null;
810
- e.Ce = null;
929
+ e.ye = null;
811
930
  }
812
931
  disposeChildren(i, true);
813
932
  i = e;
814
933
  }
815
934
  if (n) {
816
- e.ve = null;
935
+ e.me = null;
817
936
  } else {
818
- e.De = null;
819
- e.we = 0;
937
+ e.Ce = null;
938
+ e.ve = 0;
820
939
  }
821
940
  runDisposal(e, n);
822
941
  }
823
942
  function runDisposal(e, t) {
824
- let n = t ? e.be : e.me;
943
+ let n = t ? e.we : e.be;
825
944
  if (!n) return;
826
945
  if (Array.isArray(n)) {
827
946
  for (let e = 0; e < n.length; e++) {
@@ -831,12 +950,12 @@ function runDisposal(e, t) {
831
950
  } else {
832
951
  n.call(n);
833
952
  }
834
- t ? (e.be = null) : (e.me = null);
953
+ t ? (e.we = null) : (e.be = null);
835
954
  }
836
955
  function childId(e, t) {
837
956
  let n = e;
838
957
  while (n.Ve && n.i) n = n.i;
839
- if (n.id != null) return formatId(n.id, t ? n.we++ : n.we);
958
+ if (n.id != null) return formatId(n.id, t ? n.ve++ : n.ve);
840
959
  throw new Error("Cannot get child id from owner without an id");
841
960
  }
842
961
  function getNextChildId(e) {
@@ -858,10 +977,12 @@ function getOwner() {
858
977
  return context;
859
978
  }
860
979
  function onCleanup(e) {
861
- if (!context) return e;
862
- if (!context.me) context.me = e;
863
- else if (Array.isArray(context.me)) context.me.push(e);
864
- else context.me = [context.me, e];
980
+ if (!context) {
981
+ return e;
982
+ }
983
+ if (!context.be) context.be = e;
984
+ else if (Array.isArray(context.be)) context.be.push(e);
985
+ else context.be = [context.be, e];
865
986
  return e;
866
987
  }
867
988
  function isDisposed(e) {
@@ -875,26 +996,26 @@ function createOwner(e) {
875
996
  Ve: n || undefined,
876
997
  t: true,
877
998
  u: t?.t ? t.u : t,
999
+ Ce: null,
878
1000
  De: null,
879
- ye: null,
880
- me: null,
881
- ce: t?.ce ?? globalQueue,
882
- Le: t?.Le || defaultContext,
883
- we: 0,
884
1001
  be: null,
885
- ve: null,
1002
+ F: t?.F ?? globalQueue,
1003
+ Le: t?.Le || defaultContext,
1004
+ ve: 0,
1005
+ we: null,
1006
+ me: null,
886
1007
  i: t,
887
1008
  dispose(e = true) {
888
1009
  disposeChildren(i, e);
889
1010
  }
890
1011
  };
891
1012
  if (t) {
892
- const e = t.De;
1013
+ const e = t.Ce;
893
1014
  if (e === null) {
894
- t.De = i;
1015
+ t.Ce = i;
895
1016
  } else {
896
- i.ye = e;
897
- t.De = i;
1017
+ i.De = e;
1018
+ t.Ce = i;
898
1019
  }
899
1020
  }
900
1021
  return i;
@@ -903,115 +1024,66 @@ function createRoot(e, t) {
903
1024
  const n = createOwner(t);
904
1025
  return runWithOwner(n, () => e(n.dispose));
905
1026
  }
906
- function effect(e, t, n, i, r) {
907
- let o = false;
908
- const s = computed(r?.render ? t => staleValues(() => e(t)) : e, i, {
909
- ...r,
910
- equals: () => {
911
- s.ue = !s.q;
912
- if (o) s.ce.enqueue(s.se, runEffect.bind(s));
913
- return false;
914
- },
915
- lazy: true
916
- });
917
- s.ke = i;
918
- s.Ue = t;
919
- s.xe = n;
920
- s.We = undefined;
921
- s.se = r?.render ? EFFECT_RENDER : EFFECT_USER;
922
- s.he = (e, t) => {
923
- const n = e !== undefined ? e : s.Ee;
924
- const i = t !== undefined ? t : s.q;
925
- if (n & STATUS_ERROR) {
926
- let e = i;
927
- s.ce.notify(s, STATUS_PENDING, 0);
928
- if (s.se === EFFECT_USER) {
929
- try {
930
- return s.xe
931
- ? s.xe(e, () => {
932
- s.We?.();
933
- s.We = undefined;
934
- })
935
- : console.error(e);
936
- } catch (t) {
937
- e = t;
938
- }
939
- }
940
- if (!s.ce.notify(s, STATUS_ERROR, STATUS_ERROR)) throw e;
941
- } else if (s.se === EFFECT_RENDER) {
942
- s.ce.notify(s, STATUS_PENDING | STATUS_ERROR, n, i);
1027
+ function unlinkSubs(e) {
1028
+ const t = e.m;
1029
+ const n = e.D;
1030
+ const i = e.p;
1031
+ const r = e.Ue;
1032
+ if (i !== null) i.Ue = r;
1033
+ else t.ke = r;
1034
+ if (r !== null) r.p = i;
1035
+ else {
1036
+ t.I = i;
1037
+ if (i === null) {
1038
+ t.xe?.();
1039
+ t.L && !t.Ge && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
943
1040
  }
944
- };
945
- recompute(s, true);
946
- !r?.defer && (s.se === EFFECT_USER ? s.ce.enqueue(s.se, runEffect.bind(s)) : runEffect.call(s));
947
- o = true;
948
- onCleanup(() => s.We?.());
1041
+ }
1042
+ return n;
949
1043
  }
950
- function runEffect() {
951
- if (!this.ue || this.O & REACTIVE_DISPOSED) return;
952
- this.We?.();
953
- this.We = undefined;
954
- try {
955
- this.We = this.Ue(this.fe, this.ke);
956
- } catch (e) {
957
- this.q = new StatusError(this, e);
958
- this.Ee |= STATUS_ERROR;
959
- if (!this.ce.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
960
- } finally {
961
- this.ke = this.fe;
962
- this.ue = false;
1044
+ function unobserved(e) {
1045
+ deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1046
+ let t = e.C;
1047
+ while (t !== null) {
1048
+ t = unlinkSubs(t);
963
1049
  }
1050
+ e.C = null;
1051
+ disposeChildren(e, true);
964
1052
  }
965
- function trackedEffect(e, t) {
966
- const run = () => {
967
- if (!n.ue || n.O & REACTIVE_DISPOSED) return;
968
- n.ue = false;
969
- recompute(n);
970
- };
971
- const n = computed(
972
- () => {
973
- try {
974
- n.We?.();
975
- n.We = undefined;
976
- n.We = staleValues(e) || undefined;
977
- } finally {
978
- }
979
- },
980
- undefined,
981
- { ...t, lazy: true }
982
- );
983
- n.We = undefined;
984
- n.ue = true;
985
- n.se = EFFECT_TRACKED;
986
- n.ae = run;
987
- n.ce.enqueue(EFFECT_USER, run);
988
- onCleanup(() => n.We?.());
1053
+ function link(e, t) {
1054
+ const n = t.ye;
1055
+ if (n !== null && n.m === e) return;
1056
+ let i = null;
1057
+ const r = t.O & REACTIVE_RECOMPUTING_DEPS;
1058
+ if (r) {
1059
+ i = n !== null ? n.D : t.C;
1060
+ if (i !== null && i.m === e) {
1061
+ t.ye = i;
1062
+ return;
1063
+ }
1064
+ }
1065
+ const o = e.ke;
1066
+ if (o !== null && o.h === t && (!r || isValidLink(o, t))) return;
1067
+ const s = (t.ye = e.ke = { m: e, h: t, D: i, Ue: o, p: null });
1068
+ if (n !== null) n.D = s;
1069
+ else t.C = s;
1070
+ if (o !== null) o.p = s;
1071
+ else e.I = s;
989
1072
  }
990
- let externalSourceConfig = null;
991
- function enableExternalSource(e) {
992
- const { factory: t, untrack: n = e => e() } = e;
993
- if (externalSourceConfig) {
994
- const { factory: e, untrack: i } = externalSourceConfig;
995
- externalSourceConfig = {
996
- factory: (n, i) => {
997
- const r = e(n, i);
998
- const o = t(e => r.track(e), i);
999
- return {
1000
- track: e => o.track(e),
1001
- dispose() {
1002
- o.dispose();
1003
- r.dispose();
1004
- }
1005
- };
1006
- },
1007
- untrack: e => i(() => n(e))
1008
- };
1009
- } else {
1010
- externalSourceConfig = { factory: t, untrack: n };
1073
+ function isValidLink(e, t) {
1074
+ const n = t.ye;
1075
+ if (n !== null) {
1076
+ let i = t.C;
1077
+ do {
1078
+ if (i === e) return true;
1079
+ if (i === n) break;
1080
+ i = i.D;
1081
+ } while (i !== null);
1011
1082
  }
1083
+ return false;
1012
1084
  }
1013
- GlobalQueue.K = recompute;
1014
- GlobalQueue.Y = disposeChildren;
1085
+ GlobalQueue.se = recompute;
1086
+ GlobalQueue.ue = disposeChildren;
1015
1087
  let tracking = false;
1016
1088
  let stale = false;
1017
1089
  let refreshing = false;
@@ -1042,15 +1114,15 @@ function releaseSnapshotScope(e) {
1042
1114
  schedule();
1043
1115
  }
1044
1116
  function releaseSubtree(e) {
1045
- let t = e.De;
1117
+ let t = e.Ce;
1046
1118
  while (t) {
1047
1119
  if (t.He) {
1048
- t = t.ye;
1120
+ t = t.De;
1049
1121
  continue;
1050
1122
  }
1051
1123
  if (t.L) {
1052
1124
  const e = t;
1053
- e.oe = false;
1125
+ e.de = false;
1054
1126
  if (e.O & REACTIVE_SNAPSHOT_STALE) {
1055
1127
  e.O &= ~REACTIVE_SNAPSHOT_STALE;
1056
1128
  e.O |= REACTIVE_DIRTY;
@@ -1059,13 +1131,13 @@ function releaseSubtree(e) {
1059
1131
  }
1060
1132
  }
1061
1133
  releaseSubtree(t);
1062
- t = t.ye;
1134
+ t = t.De;
1063
1135
  }
1064
1136
  }
1065
1137
  function clearSnapshots() {
1066
1138
  if (snapshotSources) {
1067
1139
  for (const e of snapshotSources) {
1068
- delete e.re;
1140
+ delete e.Te;
1069
1141
  delete e[STORE_SNAPSHOT_PROPS];
1070
1142
  }
1071
1143
  snapshotSources = null;
@@ -1073,33 +1145,33 @@ function clearSnapshots() {
1073
1145
  snapshotCaptureActive = false;
1074
1146
  }
1075
1147
  function recompute(e, t = false) {
1076
- const n = e.se;
1148
+ const n = e.H;
1077
1149
  if (!t) {
1078
- if (e.ne && (!n || activeTransition) && activeTransition !== e.ne)
1079
- globalQueue.initTransition(e.ne);
1150
+ if (e.K && (!n || activeTransition) && activeTransition !== e.K)
1151
+ globalQueue.initTransition(e.K);
1080
1152
  deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1081
- if (e.ne || n === EFFECT_TRACKED) disposeChildren(e);
1153
+ if (e.K || n === EFFECT_TRACKED) disposeChildren(e);
1082
1154
  else {
1083
1155
  markDisposal(e);
1084
- e.be = e.me;
1085
- e.ve = e.De;
1086
- e.me = null;
1087
- e.De = null;
1088
- e.we = 0;
1156
+ e.we = e.be;
1157
+ e.me = e.Ce;
1158
+ e.be = null;
1159
+ e.Ce = null;
1160
+ e.ve = 0;
1089
1161
  }
1090
1162
  }
1091
1163
  const i = !!(e.O & REACTIVE_OPTIMISTIC_DIRTY);
1092
- const r = e.Te !== undefined && e.Te !== NOT_PENDING;
1093
- const o = !!(e.Ee & STATUS_PENDING);
1164
+ const r = e.ee !== undefined && e.ee !== NOT_PENDING;
1165
+ const o = !!(e.Se & STATUS_PENDING);
1094
1166
  const s = context;
1095
1167
  context = e;
1096
- e.Ce = null;
1168
+ e.ye = null;
1097
1169
  e.O = REACTIVE_RECOMPUTING_DEPS;
1098
- e.J = clock;
1099
- let u = e.le === NOT_PENDING ? e.fe : e.le;
1170
+ e.Ee = clock;
1171
+ let u = e.X === NOT_PENDING ? e.J : e.X;
1100
1172
  let c = e.o;
1101
1173
  let a = tracking;
1102
- let l = currentOptimisticLane;
1174
+ let f = currentOptimisticLane;
1103
1175
  tracking = true;
1104
1176
  if (i) {
1105
1177
  const t = resolveLane(e);
@@ -1107,35 +1179,36 @@ function recompute(e, t = false) {
1107
1179
  }
1108
1180
  try {
1109
1181
  u = handleAsync(e, e.L(u));
1110
- clearStatus(e);
1111
- const t = resolveLane(e);
1112
- if (t) {
1113
- t.U.delete(e);
1114
- updatePendingSignal(t.de);
1182
+ clearStatus(e, t);
1183
+ const n = resolveLane(e);
1184
+ if (n) {
1185
+ n.k.delete(e);
1186
+ updatePendingSignal(n.te);
1115
1187
  }
1116
1188
  } catch (t) {
1117
1189
  if (t instanceof NotReadyError && currentOptimisticLane) {
1118
1190
  const t = findLane(currentOptimisticLane);
1119
- if (t.de !== e) {
1120
- t.U.add(e);
1121
- e.ie = t;
1122
- updatePendingSignal(t.de);
1191
+ if (t.te !== e) {
1192
+ t.k.add(e);
1193
+ e.q = t;
1194
+ updatePendingSignal(t.te);
1123
1195
  }
1124
1196
  }
1197
+ if (t instanceof NotReadyError) e.he = true;
1125
1198
  notifyStatus(
1126
1199
  e,
1127
1200
  t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
1128
1201
  t,
1129
1202
  undefined,
1130
- t instanceof NotReadyError ? e.ie : undefined
1203
+ t instanceof NotReadyError ? e.q : undefined
1131
1204
  );
1132
1205
  } finally {
1133
1206
  tracking = a;
1134
1207
  e.O = REACTIVE_NONE | (t ? e.O & REACTIVE_SNAPSHOT_STALE : 0);
1135
1208
  context = s;
1136
1209
  }
1137
- if (!e.q) {
1138
- const s = e.Ce;
1210
+ if (!e.le) {
1211
+ const s = e.ye;
1139
1212
  let a = s !== null ? s.D : e.C;
1140
1213
  if (a !== null) {
1141
1214
  do {
@@ -1144,30 +1217,30 @@ function recompute(e, t = false) {
1144
1217
  if (s !== null) s.D = null;
1145
1218
  else e.C = null;
1146
1219
  }
1147
- const l = r ? e.Te : e.le === NOT_PENDING ? e.fe : e.le;
1148
- const f = !e.Ie || !e.Ie(l, u);
1149
- if (f) {
1150
- const s = r ? e.Te : undefined;
1151
- if (t || (n && activeTransition !== e.ne) || i) {
1152
- e.fe = u;
1220
+ const f = r ? e.ee : e.X === NOT_PENDING ? e.J : e.X;
1221
+ const l = !e.Ne || !e.Ne(f, u);
1222
+ if (l) {
1223
+ const s = r ? e.ee : undefined;
1224
+ if (t || (n && activeTransition !== e.K) || i) {
1225
+ e.J = u;
1153
1226
  if (r && i) {
1154
- e.Te = u;
1155
- e.le = u;
1227
+ e.ee = u;
1228
+ e.X = u;
1156
1229
  }
1157
- } else e.le = u;
1158
- if (r && !i && o && !e.Oe) e.Te = u;
1159
- if (!r || i || e.Te !== s) insertSubs(e, i || r);
1230
+ } else e.X = u;
1231
+ if (r && !i && o && !e._e) e.ee = u;
1232
+ if (!r || i || e.ee !== s) insertSubs(e, i || r);
1160
1233
  } else if (r) {
1161
- e.le = u;
1234
+ e.X = u;
1162
1235
  } else if (e.o != c) {
1163
1236
  for (let t = e.I; t !== null; t = t.p) {
1164
1237
  insertIntoHeapHeight(t.h, t.h.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1165
1238
  }
1166
1239
  }
1167
1240
  }
1168
- currentOptimisticLane = l;
1169
- (!t || e.Ee & STATUS_PENDING) && !e.ne && !(activeTransition && r) && globalQueue.M.push(e);
1170
- e.ne && n && activeTransition !== e.ne && runInTransition(e.ne, () => recompute(e));
1241
+ currentOptimisticLane = f;
1242
+ (!t || e.Se & STATUS_PENDING) && !e.K && !(activeTransition && r) && globalQueue.oe.push(e);
1243
+ e.K && n && activeTransition !== e.K && runInTransition(e.K, () => recompute(e));
1171
1244
  }
1172
1245
  function updateIfNecessary(e) {
1173
1246
  if (e.O & REACTIVE_CHECK) {
@@ -1182,7 +1255,7 @@ function updateIfNecessary(e) {
1182
1255
  }
1183
1256
  }
1184
1257
  }
1185
- if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.q && e.J < clock && !e._e)) {
1258
+ if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.le && e.Ee < clock && !e.Ae)) {
1186
1259
  recompute(e);
1187
1260
  }
1188
1261
  e.O = REACTIVE_NONE | (e.O & REACTIVE_SNAPSHOT_STALE);
@@ -1192,48 +1265,48 @@ function computed(e, t, n) {
1192
1265
  const r = {
1193
1266
  id: n?.id ?? (i ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
1194
1267
  Ve: i || undefined,
1195
- Ie: n?.equals != null ? n.equals : isEqual,
1196
- Ge: !!n?.pureWrite,
1197
- ge: n?.unobserved,
1198
- me: null,
1199
- ce: context?.ce ?? globalQueue,
1268
+ Ne: n?.equals != null ? n.equals : isEqual,
1269
+ fe: !!n?.pureWrite,
1270
+ xe: n?.unobserved,
1271
+ be: null,
1272
+ F: context?.F ?? globalQueue,
1200
1273
  Le: context?.Le ?? defaultContext,
1201
- we: 0,
1274
+ ve: 0,
1202
1275
  L: e,
1203
- fe: t,
1276
+ J: t,
1204
1277
  o: 0,
1205
1278
  A: null,
1206
1279
  S: undefined,
1207
1280
  T: null,
1208
1281
  C: null,
1209
- Ce: null,
1282
+ ye: null,
1210
1283
  I: null,
1211
- Ne: null,
1284
+ ke: null,
1212
1285
  i: context,
1213
- ye: null,
1214
1286
  De: null,
1287
+ Ce: null,
1215
1288
  O: n?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
1216
- Ee: STATUS_UNINITIALIZED,
1217
- J: clock,
1218
- le: NOT_PENDING,
1219
- be: null,
1220
- ve: null,
1221
- _e: null,
1222
- ne: null
1289
+ Se: STATUS_UNINITIALIZED,
1290
+ Ee: clock,
1291
+ X: NOT_PENDING,
1292
+ we: null,
1293
+ me: null,
1294
+ Ae: null,
1295
+ K: null
1223
1296
  };
1224
1297
  r.T = r;
1225
1298
  const o = context?.t ? context.u : context;
1226
1299
  if (context) {
1227
- const e = context.De;
1300
+ const e = context.Ce;
1228
1301
  if (e === null) {
1229
- context.De = r;
1302
+ context.Ce = r;
1230
1303
  } else {
1231
- r.ye = e;
1232
- context.De = r;
1304
+ r.De = e;
1305
+ context.Ce = r;
1233
1306
  }
1234
1307
  }
1235
1308
  if (o) r.o = o.o + 1;
1236
- if (snapshotCaptureActive && ownerInSnapshotScope(context)) r.oe = true;
1309
+ if (snapshotCaptureActive && ownerInSnapshotScope(context)) r.de = true;
1237
1310
  if (externalSourceConfig) {
1238
1311
  const e = signal(undefined, { equals: false, pureWrite: true });
1239
1312
  const t = externalSourceConfig.factory(r.L, () => {
@@ -1247,8 +1320,8 @@ function computed(e, t, n) {
1247
1320
  }
1248
1321
  !n?.lazy && recompute(r, true);
1249
1322
  if (snapshotCaptureActive && !n?.lazy) {
1250
- if (!(r.Ee & STATUS_PENDING)) {
1251
- r.re = r.fe === undefined ? NO_SNAPSHOT : r.fe;
1323
+ if (!(r.Se & STATUS_PENDING)) {
1324
+ r.Te = r.J === undefined ? NO_SNAPSHOT : r.J;
1252
1325
  snapshotSources.add(r);
1253
1326
  }
1254
1327
  }
@@ -1256,32 +1329,33 @@ function computed(e, t, n) {
1256
1329
  }
1257
1330
  function signal(e, t, n = null) {
1258
1331
  const i = {
1259
- Ie: t?.equals != null ? t.equals : isEqual,
1260
- Ge: !!t?.pureWrite,
1261
- ge: t?.unobserved,
1262
- fe: e,
1332
+ Ne: t?.equals != null ? t.equals : isEqual,
1333
+ fe: !!t?.pureWrite,
1334
+ We: !!t?.We,
1335
+ xe: t?.unobserved,
1336
+ J: e,
1263
1337
  I: null,
1264
- Ne: null,
1265
- J: clock,
1338
+ ke: null,
1339
+ Ee: clock,
1266
1340
  V: n,
1267
1341
  N: n?.A || null,
1268
- le: NOT_PENDING
1342
+ X: NOT_PENDING
1269
1343
  };
1270
1344
  n && (n.A = i);
1271
- if (snapshotCaptureActive && !i.Ge && !((n?.Ee ?? 0) & STATUS_PENDING)) {
1272
- i.re = e === undefined ? NO_SNAPSHOT : e;
1345
+ if (snapshotCaptureActive && !i.We && !((n?.Se ?? 0) & STATUS_PENDING)) {
1346
+ i.Te = e === undefined ? NO_SNAPSHOT : e;
1273
1347
  snapshotSources.add(i);
1274
1348
  }
1275
1349
  return i;
1276
1350
  }
1277
1351
  function optimisticSignal(e, t) {
1278
1352
  const n = signal(e, t);
1279
- n.Te = NOT_PENDING;
1353
+ n.ee = NOT_PENDING;
1280
1354
  return n;
1281
1355
  }
1282
1356
  function optimisticComputed(e, t, n) {
1283
1357
  const i = computed(e, t, n);
1284
- i.Te = NOT_PENDING;
1358
+ i.ee = NOT_PENDING;
1285
1359
  return i;
1286
1360
  }
1287
1361
  function isEqual(e, t) {
@@ -1303,7 +1377,7 @@ function read(e) {
1303
1377
  const t = getLatestValueComputed(e);
1304
1378
  const n = latestReadActive;
1305
1379
  latestReadActive = false;
1306
- const i = e.Te !== undefined && e.Te !== NOT_PENDING ? e.Te : e.fe;
1380
+ const i = e.ee !== undefined && e.ee !== NOT_PENDING ? e.ee : e.J;
1307
1381
  let r;
1308
1382
  try {
1309
1383
  r = read(t);
@@ -1313,26 +1387,24 @@ function read(e) {
1313
1387
  } finally {
1314
1388
  latestReadActive = n;
1315
1389
  }
1316
- if (t.Ee & STATUS_PENDING) return i;
1317
- if (stale && currentOptimisticLane && t.ie) {
1318
- const e = findLane(t.ie);
1390
+ if (t.Se & STATUS_PENDING) return i;
1391
+ if (stale && currentOptimisticLane && t.q) {
1392
+ const e = findLane(t.q);
1319
1393
  const n = findLane(currentOptimisticLane);
1320
- if (e !== n && e.U.size > 0) {
1394
+ if (e !== n && e.k.size > 0) {
1321
1395
  return i;
1322
1396
  }
1323
1397
  }
1324
1398
  return r;
1325
1399
  }
1326
1400
  if (pendingCheckActive) {
1327
- const t = e.V || e;
1328
- const n = getPendingSignal(t);
1329
- const i = pendingCheckActive;
1401
+ const t = e.V;
1402
+ const n = pendingCheckActive;
1330
1403
  pendingCheckActive = false;
1331
- if (read(n)) {
1332
- foundPending = true;
1333
- }
1334
- pendingCheckActive = i;
1335
- return e.fe;
1404
+ if (read(getPendingSignal(e))) foundPending = true;
1405
+ if (t && read(getPendingSignal(t))) foundPending = true;
1406
+ pendingCheckActive = n;
1407
+ return e.J;
1336
1408
  }
1337
1409
  let t = context;
1338
1410
  if (t?.t) t = t.u;
@@ -1358,56 +1430,57 @@ function read(e) {
1358
1430
  }
1359
1431
  }
1360
1432
  }
1361
- if (n.Ee & STATUS_PENDING) {
1362
- const i = n.q?.source;
1363
- if (i && !(i.Ee & STATUS_PENDING)) clearStatus(n);
1364
- else if (t && !(stale && n.ne && activeTransition !== n.ne)) {
1433
+ if (n.Se & STATUS_PENDING) {
1434
+ if (t && !(stale && n.K && activeTransition !== n.K)) {
1365
1435
  if (currentOptimisticLane) {
1366
- const i = n.ie;
1436
+ const i = n.q;
1367
1437
  const r = findLane(currentOptimisticLane);
1368
1438
  if (i && findLane(i) === r && !hasActiveOverride(n)) {
1369
1439
  if (!tracking && e !== t) link(e, t);
1370
- throw n.q;
1440
+ throw n.le;
1371
1441
  }
1372
1442
  } else {
1373
1443
  if (!tracking && e !== t) link(e, t);
1374
- throw n.q;
1444
+ throw n.le;
1375
1445
  }
1376
- } else if (!t && n.Ee & STATUS_UNINITIALIZED) {
1377
- throw n.q;
1446
+ } else if (!t && n.Se & STATUS_UNINITIALIZED) {
1447
+ throw n.le;
1378
1448
  }
1379
1449
  }
1380
- if (e.L && e.Ee & STATUS_ERROR) {
1381
- if (e.J < clock) {
1450
+ if (e.L && e.Se & STATUS_ERROR) {
1451
+ if (e.Ee < clock) {
1382
1452
  recompute(e, true);
1383
1453
  return read(e);
1384
- } else throw e.q;
1454
+ } else throw e.le;
1385
1455
  }
1386
- if (snapshotCaptureActive && t && t.oe) {
1387
- const n = e.re;
1456
+ if (snapshotCaptureActive && t && t.de) {
1457
+ const n = e.Te;
1388
1458
  if (n !== undefined) {
1389
1459
  const i = n === NO_SNAPSHOT ? undefined : n;
1390
- const r = e.le !== NOT_PENDING ? e.le : e.fe;
1460
+ const r = e.X !== NOT_PENDING ? e.X : e.J;
1391
1461
  if (r !== i) t.O |= REACTIVE_SNAPSHOT_STALE;
1392
1462
  return i;
1393
1463
  }
1394
1464
  }
1395
- if (e.Te !== undefined && e.Te !== NOT_PENDING) return e.Te;
1465
+ if (e.ee !== undefined && e.ee !== NOT_PENDING) {
1466
+ if (t && stale && shouldReadStashedOptimisticValue(e)) return e.J;
1467
+ return e.ee;
1468
+ }
1396
1469
  return !t ||
1397
1470
  (currentOptimisticLane !== null &&
1398
- (e.Te !== undefined || e.ie || (n === e && stale) || !!(n.Ee & STATUS_PENDING))) ||
1399
- e.le === NOT_PENDING ||
1400
- (stale && e.ne && activeTransition !== e.ne)
1401
- ? e.fe
1402
- : e.le;
1471
+ (e.ee !== undefined || e.q || (n === e && stale) || !!(n.Se & STATUS_PENDING))) ||
1472
+ e.X === NOT_PENDING ||
1473
+ (stale && e.K && activeTransition !== e.K)
1474
+ ? e.J
1475
+ : e.X;
1403
1476
  }
1404
1477
  function setSignal(e, t) {
1405
- if (e.ne && activeTransition !== e.ne) globalQueue.initTransition(e.ne);
1406
- const n = e.Te !== undefined && !projectionWriteActive;
1407
- const i = e.Te !== undefined && e.Te !== NOT_PENDING;
1408
- const r = n ? (i ? e.Te : e.fe) : e.le === NOT_PENDING ? e.fe : e.le;
1478
+ if (e.K && activeTransition !== e.K) globalQueue.initTransition(e.K);
1479
+ const n = e.ee !== undefined && !projectionWriteActive;
1480
+ const i = e.ee !== undefined && e.ee !== NOT_PENDING;
1481
+ const r = n ? (i ? e.ee : e.J) : e.X === NOT_PENDING ? e.J : e.X;
1409
1482
  if (typeof t === "function") t = t(r);
1410
- const o = !e.Ie || !e.Ie(r, t) || !!(e.Ee & STATUS_UNINITIALIZED);
1483
+ const o = !e.Ne || !e.Ne(r, t) || !!(e.Se & STATUS_UNINITIALIZED);
1411
1484
  if (!o) {
1412
1485
  if (n && i && e.L) {
1413
1486
  insertSubs(e, true);
@@ -1416,25 +1489,25 @@ function setSignal(e, t) {
1416
1489
  return t;
1417
1490
  }
1418
1491
  if (n) {
1419
- const n = e.Te === NOT_PENDING;
1420
- if (!n && e.ne) globalQueue.initTransition(e.ne);
1492
+ const n = e.ee === NOT_PENDING;
1493
+ if (!n) globalQueue.initTransition(resolveTransition(e));
1421
1494
  if (n) {
1422
- e.le = e.fe;
1423
- globalQueue.$.push(e);
1495
+ e.X = e.J;
1496
+ globalQueue.Y.push(e);
1424
1497
  }
1425
- e.Oe = true;
1498
+ e._e = true;
1426
1499
  const i = getOrCreateLane(e);
1427
- e.ie = i;
1428
- e.Te = t;
1500
+ e.q = i;
1501
+ e.ee = t;
1429
1502
  } else {
1430
- if (e.le === NOT_PENDING) globalQueue.M.push(e);
1431
- e.le = t;
1503
+ if (e.X === NOT_PENDING) globalQueue.oe.push(e);
1504
+ e.X = t;
1432
1505
  }
1433
1506
  updatePendingSignal(e);
1434
- if (e.pe) {
1435
- setSignal(e.pe, t);
1507
+ if (e.Pe) {
1508
+ setSignal(e.Pe, t);
1436
1509
  }
1437
- e.J = clock;
1510
+ e.Ee = clock;
1438
1511
  insertSubs(e, n);
1439
1512
  schedule();
1440
1513
  return t;
@@ -1454,8 +1527,8 @@ function runWithOwner(e, t) {
1454
1527
  function getPendingSignal(e) {
1455
1528
  if (!e.Qe) {
1456
1529
  e.Qe = optimisticSignal(false, { pureWrite: true });
1457
- if (e.Se) {
1458
- e.Qe.Se = e;
1530
+ if (e.Re) {
1531
+ e.Qe.Re = e;
1459
1532
  }
1460
1533
  if (computePendingState(e)) setSignal(e.Qe, true);
1461
1534
  }
@@ -1463,50 +1536,54 @@ function getPendingSignal(e) {
1463
1536
  }
1464
1537
  function computePendingState(e) {
1465
1538
  const t = e;
1466
- if (e.Te !== undefined && e.Te !== NOT_PENDING) {
1467
- if (t.Ee & STATUS_PENDING && !(t.Ee & STATUS_UNINITIALIZED)) return true;
1468
- if (e.Se) {
1469
- const t = e.ie ? findLane(e.ie) : null;
1470
- return !!(t && t.U.size > 0);
1539
+ const n = e.V;
1540
+ if (n && e.X !== NOT_PENDING) {
1541
+ return !n.Ae && !(n.Se & STATUS_PENDING);
1542
+ }
1543
+ if (e.ee !== undefined && e.ee !== NOT_PENDING) {
1544
+ if (t.Se & STATUS_PENDING && !(t.Se & STATUS_UNINITIALIZED)) return true;
1545
+ if (e.Re) {
1546
+ const t = e.q ? findLane(e.q) : null;
1547
+ return !!(t && t.k.size > 0);
1471
1548
  }
1472
1549
  return true;
1473
1550
  }
1474
- if (e.le !== NOT_PENDING && !(t.Ee & STATUS_UNINITIALIZED)) return true;
1475
- return !!(t.Ee & STATUS_PENDING && !(t.Ee & STATUS_UNINITIALIZED));
1551
+ if (e.X !== NOT_PENDING && !(t.Se & STATUS_UNINITIALIZED)) return true;
1552
+ return !!(t.Se & STATUS_PENDING && !(t.Se & STATUS_UNINITIALIZED));
1476
1553
  }
1477
1554
  function updatePendingSignal(e) {
1478
1555
  if (e.Qe) {
1479
1556
  const t = computePendingState(e);
1480
1557
  const n = e.Qe;
1481
1558
  setSignal(n, t);
1482
- if (!t && n.ie) {
1559
+ if (!t && n.q) {
1483
1560
  const t = resolveLane(e);
1484
- if (t && t.U.size > 0) {
1485
- const e = findLane(n.ie);
1561
+ if (t && t.k.size > 0) {
1562
+ const e = findLane(n.q);
1486
1563
  if (e !== t) {
1487
1564
  mergeLanes(t, e);
1488
1565
  }
1489
1566
  }
1490
1567
  signalLanes.delete(n);
1491
- n.ie = undefined;
1568
+ n.q = undefined;
1492
1569
  }
1493
1570
  }
1494
1571
  }
1495
1572
  function getLatestValueComputed(e) {
1496
- if (!e.pe) {
1573
+ if (!e.Pe) {
1497
1574
  const t = latestReadActive;
1498
1575
  latestReadActive = false;
1499
1576
  const n = pendingCheckActive;
1500
1577
  pendingCheckActive = false;
1501
1578
  const i = context;
1502
1579
  context = null;
1503
- e.pe = optimisticComputed(() => read(e));
1504
- e.pe.Se = e;
1580
+ e.Pe = optimisticComputed(() => read(e));
1581
+ e.Pe.Re = e;
1505
1582
  context = i;
1506
1583
  pendingCheckActive = n;
1507
1584
  latestReadActive = t;
1508
1585
  }
1509
- return e.pe;
1586
+ return e.Pe;
1510
1587
  }
1511
1588
  function staleValues(e, t = true) {
1512
1589
  const n = stale;
@@ -1585,6 +1662,96 @@ function hasContext(e, t) {
1585
1662
  function isUndefined(e) {
1586
1663
  return typeof e === "undefined";
1587
1664
  }
1665
+ function effect(e, t, n, i, r) {
1666
+ let o = false;
1667
+ const s = computed(r?.render ? t => staleValues(() => e(t)) : e, i, {
1668
+ ...r,
1669
+ equals: () => {
1670
+ s.W = !s.le;
1671
+ if (o) s.F.enqueue(s.H, runEffect.bind(s));
1672
+ return false;
1673
+ },
1674
+ lazy: true
1675
+ });
1676
+ s.Fe = i;
1677
+ s.Me = t;
1678
+ s.$e = n;
1679
+ s.je = undefined;
1680
+ s.H = r?.render ? EFFECT_RENDER : EFFECT_USER;
1681
+ s.ge = (e, t) => {
1682
+ const n = e !== undefined ? e : s.Se;
1683
+ const i = t !== undefined ? t : s.le;
1684
+ if (n & STATUS_ERROR) {
1685
+ let e = i;
1686
+ s.F.notify(s, STATUS_PENDING, 0);
1687
+ if (s.H === EFFECT_USER) {
1688
+ try {
1689
+ return s.$e
1690
+ ? s.$e(e, () => {
1691
+ s.je?.();
1692
+ s.je = undefined;
1693
+ })
1694
+ : console.error(e);
1695
+ } catch (t) {
1696
+ e = t;
1697
+ }
1698
+ }
1699
+ if (!s.F.notify(s, STATUS_ERROR, STATUS_ERROR)) throw e;
1700
+ } else if (s.H === EFFECT_RENDER) {
1701
+ s.F.notify(s, STATUS_PENDING | STATUS_ERROR, n, i);
1702
+ }
1703
+ };
1704
+ recompute(s, true);
1705
+ !r?.defer && (s.H === EFFECT_USER ? s.F.enqueue(s.H, runEffect.bind(s)) : runEffect.call(s));
1706
+ o = true;
1707
+ onCleanup(() => s.je?.());
1708
+ }
1709
+ function runEffect() {
1710
+ if (!this.W || this.O & REACTIVE_DISPOSED) return;
1711
+ this.je?.();
1712
+ this.je = undefined;
1713
+ try {
1714
+ this.je = this.Me(this.J, this.Fe);
1715
+ } catch (e) {
1716
+ this.le = new StatusError(this, e);
1717
+ this.Se |= STATUS_ERROR;
1718
+ if (!this.F.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
1719
+ } finally {
1720
+ this.Fe = this.J;
1721
+ this.W = false;
1722
+ }
1723
+ }
1724
+ function trackedEffect(e, t) {
1725
+ const run = () => {
1726
+ if (!n.W || n.O & REACTIVE_DISPOSED) return;
1727
+ n.W = false;
1728
+ recompute(n);
1729
+ };
1730
+ const n = computed(
1731
+ () => {
1732
+ n.je?.();
1733
+ n.je = undefined;
1734
+ n.je = staleValues(e) || undefined;
1735
+ },
1736
+ undefined,
1737
+ { ...t, lazy: true }
1738
+ );
1739
+ n.je = undefined;
1740
+ n.Ke = true;
1741
+ n.W = true;
1742
+ n.H = EFFECT_TRACKED;
1743
+ n.ge = (e, t) => {
1744
+ const i = e !== undefined ? e : n.Se;
1745
+ if (i & STATUS_ERROR) {
1746
+ n.F.notify(n, STATUS_PENDING, 0);
1747
+ const e = t !== undefined ? t : n.le;
1748
+ if (!n.F.notify(n, STATUS_ERROR, STATUS_ERROR)) throw e;
1749
+ }
1750
+ };
1751
+ n.M = run;
1752
+ n.F.enqueue(EFFECT_USER, run);
1753
+ onCleanup(() => n.je?.());
1754
+ }
1588
1755
  function restoreTransition(e, t) {
1589
1756
  globalQueue.initTransition(e);
1590
1757
  const n = t();
@@ -1597,11 +1764,11 @@ function action(e) {
1597
1764
  const r = e(...t);
1598
1765
  globalQueue.initTransition();
1599
1766
  let o = activeTransition;
1600
- o.ee.push(r);
1767
+ o.j.push(r);
1601
1768
  const done = (e, t) => {
1602
1769
  o = currentTransition(o);
1603
- const s = o.ee.indexOf(r);
1604
- if (s >= 0) o.ee.splice(s, 1);
1770
+ const s = o.j.indexOf(r);
1771
+ if (s >= 0) o.j.splice(s, 1);
1605
1772
  setActiveTransition(o);
1606
1773
  schedule();
1607
1774
  t ? i(t) : n(e);
@@ -1695,7 +1862,8 @@ function createOptimistic(e, t, n) {
1695
1862
  return [accessor(i), setSignal.bind(null, i)];
1696
1863
  }
1697
1864
  function onSettled(e) {
1698
- getOwner()
1865
+ const t = getOwner();
1866
+ t && !t.Ke
1699
1867
  ? createTrackedEffect(() => untrack(e))
1700
1868
  : globalQueue.enqueue(EFFECT_USER, () => {
1701
1869
  const t = e();
@@ -1729,67 +1897,67 @@ function applyState(e, t, n) {
1729
1897
  let t = false;
1730
1898
  const c = getOverrideValue(r, o, u, "length", s);
1731
1899
  if (e.length && c && e[0] && n(e[0]) != null) {
1732
- let a, l, f, E, T, d, S, R;
1900
+ let a, f, l, E, T, d, S, R;
1733
1901
  for (
1734
- f = 0, E = Math.min(c, e.length);
1735
- f < E &&
1736
- ((d = getOverrideValue(r, o, u, f, s)) === e[f] || (d && e[f] && n(d) === n(e[f])));
1737
- f++
1902
+ l = 0, E = Math.min(c, e.length);
1903
+ l < E &&
1904
+ ((d = getOverrideValue(r, o, u, l, s)) === e[l] || (d && e[l] && n(d) === n(e[l])));
1905
+ l++
1738
1906
  ) {
1739
- applyState(e[f], wrap(d, i), n);
1907
+ applyState(e[l], wrap(d, i), n);
1740
1908
  }
1741
1909
  const O = new Array(e.length),
1742
1910
  _ = new Map();
1743
1911
  for (
1744
1912
  E = c - 1, T = e.length - 1;
1745
- E >= f &&
1746
- T >= f &&
1913
+ E >= l &&
1914
+ T >= l &&
1747
1915
  ((d = getOverrideValue(r, o, u, E, s)) === e[T] || (d && e[T] && n(d) === n(e[T])));
1748
1916
  E--, T--
1749
1917
  ) {
1750
1918
  O[T] = d;
1751
1919
  }
1752
- if (f > T || f > E) {
1753
- for (l = f; l <= T; l++) {
1920
+ if (l > T || l > E) {
1921
+ for (f = l; f <= T; f++) {
1754
1922
  t = true;
1755
- i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], wrap(e[l], i));
1923
+ i[STORE_NODE][f] && setSignal(i[STORE_NODE][f], wrap(e[f], i));
1756
1924
  }
1757
- for (; l < e.length; l++) {
1925
+ for (; f < e.length; f++) {
1758
1926
  t = true;
1759
- const r = wrap(O[l], i);
1760
- i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], r);
1761
- applyState(e[l], r, n);
1927
+ const r = wrap(O[f], i);
1928
+ i[STORE_NODE][f] && setSignal(i[STORE_NODE][f], r);
1929
+ applyState(e[f], r, n);
1762
1930
  }
1763
1931
  t && i[STORE_NODE][$TRACK] && setSignal(i[STORE_NODE][$TRACK], void 0);
1764
1932
  c !== e.length && i[STORE_NODE].length && setSignal(i[STORE_NODE].length, e.length);
1765
1933
  return;
1766
1934
  }
1767
1935
  S = new Array(T + 1);
1768
- for (l = T; l >= f; l--) {
1769
- d = e[l];
1936
+ for (f = T; f >= l; f--) {
1937
+ d = e[f];
1770
1938
  R = d ? n(d) : d;
1771
1939
  a = _.get(R);
1772
- S[l] = a === undefined ? -1 : a;
1773
- _.set(R, l);
1940
+ S[f] = a === undefined ? -1 : a;
1941
+ _.set(R, f);
1774
1942
  }
1775
- for (a = f; a <= E; a++) {
1943
+ for (a = l; a <= E; a++) {
1776
1944
  d = getOverrideValue(r, o, u, a, s);
1777
1945
  R = d ? n(d) : d;
1778
- l = _.get(R);
1779
- if (l !== undefined && l !== -1) {
1780
- O[l] = d;
1781
- l = S[l];
1782
- _.set(R, l);
1946
+ f = _.get(R);
1947
+ if (f !== undefined && f !== -1) {
1948
+ O[f] = d;
1949
+ f = S[f];
1950
+ _.set(R, f);
1783
1951
  }
1784
1952
  }
1785
- for (l = f; l < e.length; l++) {
1786
- if (l in O) {
1787
- const t = wrap(O[l], i);
1788
- i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], t);
1789
- applyState(e[l], t, n);
1790
- } else i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], wrap(e[l], i));
1953
+ for (f = l; f < e.length; f++) {
1954
+ if (f in O) {
1955
+ const t = wrap(O[f], i);
1956
+ i[STORE_NODE][f] && setSignal(i[STORE_NODE][f], t);
1957
+ applyState(e[f], t, n);
1958
+ } else i[STORE_NODE][f] && setSignal(i[STORE_NODE][f], wrap(e[f], i));
1791
1959
  }
1792
- if (f < e.length) t = true;
1960
+ if (l < e.length) t = true;
1793
1961
  } else if (e.length) {
1794
1962
  for (let t = 0, c = e.length; t < c; t++) {
1795
1963
  const c = getOverrideValue(r, o, u, t, s);
@@ -1808,15 +1976,15 @@ function applyState(e, t, n) {
1808
1976
  if (u) {
1809
1977
  const t = u[$TRACK];
1810
1978
  const c = t ? getAllKeys(r, o, e) : Object.keys(u);
1811
- for (let a = 0, l = c.length; a < l; a++) {
1812
- const l = c[a];
1813
- const f = u[l];
1814
- const E = unwrap(getOverrideValue(r, o, u, l, s));
1815
- let T = unwrap(e[l]);
1979
+ for (let a = 0, f = c.length; a < f; a++) {
1980
+ const f = c[a];
1981
+ const l = u[f];
1982
+ const E = unwrap(getOverrideValue(r, o, u, f, s));
1983
+ let T = unwrap(e[f]);
1816
1984
  if (E === T) continue;
1817
1985
  if (!E || !isWrappable(E) || !isWrappable(T) || (n(E) != null && n(E) !== n(T))) {
1818
1986
  t && setSignal(t, void 0);
1819
- f && setSignal(f, isWrappable(T) ? wrap(T, i) : T);
1987
+ l && setSignal(l, isWrappable(T) ? wrap(T, i) : T);
1820
1988
  } else applyState(T, wrap(E, i), n);
1821
1989
  }
1822
1990
  }
@@ -1868,7 +2036,7 @@ function createProjectionInternal(e, t = {}, n) {
1868
2036
  r !== i && r !== undefined && reconcile(r, n?.key || "id")(o);
1869
2037
  });
1870
2038
  });
1871
- i.Pe = true;
2039
+ i.Ge = true;
1872
2040
  return { store: o, node: i };
1873
2041
  }
1874
2042
  function createProjection(e, t = {}, n) {
@@ -1967,11 +2135,11 @@ function getNode(e, t, n, i, r = isEqual, o, s) {
1967
2135
  i
1968
2136
  );
1969
2137
  if (o) {
1970
- u.Te = NOT_PENDING;
2138
+ u.ee = NOT_PENDING;
1971
2139
  }
1972
2140
  if (s && t in s) {
1973
2141
  const e = s[t];
1974
- u.re = e === undefined ? NO_SNAPSHOT : e;
2142
+ u.Te = e === undefined ? NO_SNAPSHOT : e;
1975
2143
  snapshotSources?.add(u);
1976
2144
  }
1977
2145
  return (e[t] = u);
@@ -2028,11 +2196,11 @@ const storeTraps = {
2028
2196
  if (writeOnly(n)) {
2029
2197
  let n =
2030
2198
  r && (s || !u)
2031
- ? r.Te !== undefined && r.Te !== NOT_PENDING
2032
- ? r.Te
2033
- : r.le !== NOT_PENDING
2034
- ? r.le
2035
- : r.fe
2199
+ ? r.ee !== undefined && r.ee !== NOT_PENDING
2200
+ ? r.ee
2201
+ : r.X !== NOT_PENDING
2202
+ ? r.X
2203
+ : r.J
2036
2204
  : c[t];
2037
2205
  n === $DELETED && (n = undefined);
2038
2206
  if (!isWrappable(n)) return n;
@@ -2083,8 +2251,8 @@ const storeTraps = {
2083
2251
  if (writeOnly(i)) {
2084
2252
  if (e[STORE_OPTIMISTIC]) {
2085
2253
  const t = e[STORE_FIREWALL];
2086
- if (t?.ne) {
2087
- globalQueue.initTransition(t.ne);
2254
+ if (t?.K) {
2255
+ globalQueue.initTransition(t.K);
2088
2256
  }
2089
2257
  }
2090
2258
  untrack(() => {
@@ -2093,7 +2261,7 @@ const storeTraps = {
2093
2261
  if (
2094
2262
  snapshotCaptureActive &&
2095
2263
  typeof t !== "symbol" &&
2096
- !((e[STORE_FIREWALL]?.Ee ?? 0) & STATUS_PENDING)
2264
+ !((e[STORE_FIREWALL]?.Se ?? 0) & STATUS_PENDING)
2097
2265
  ) {
2098
2266
  if (!e[STORE_SNAPSHOT_PROPS]) {
2099
2267
  e[STORE_SNAPSHOT_PROPS] = Object.create(null);
@@ -2114,19 +2282,19 @@ const storeTraps = {
2114
2282
  : o;
2115
2283
  const a = n?.[$TARGET]?.[STORE_VALUE] ?? n;
2116
2284
  if (c === a) return true;
2117
- const l = e[STORE_OPTIMISTIC_OVERRIDE]?.length || e[STORE_OVERRIDE]?.length || r.length;
2285
+ const f = e[STORE_OPTIMISTIC_OVERRIDE]?.length || e[STORE_OVERRIDE]?.length || r.length;
2118
2286
  if (a !== undefined && a === o) delete e[u][t];
2119
2287
  else (e[u] || (e[u] = Object.create(null)))[t] = a;
2120
- const f = isWrappable(a);
2288
+ const l = isWrappable(a);
2121
2289
  e[STORE_HAS]?.[t] && setSignal(e[STORE_HAS][t], true);
2122
2290
  const E = getNodes(e, STORE_NODE);
2123
- E[t] && setSignal(E[t], () => (f ? wrap(a, e) : a));
2291
+ E[t] && setSignal(E[t], () => (l ? wrap(a, e) : a));
2124
2292
  if (Array.isArray(r)) {
2125
2293
  if (t === "length") {
2126
2294
  E.length && setSignal(E.length, a);
2127
2295
  } else {
2128
2296
  const e = parseInt(t) + 1;
2129
- if (e > l) E.length && setSignal(E.length, e);
2297
+ if (e > f) E.length && setSignal(E.length, e);
2130
2298
  }
2131
2299
  }
2132
2300
  E[$TRACK] && setSignal(E[$TRACK], undefined);
@@ -2224,7 +2392,7 @@ function createStore(e, t, n) {
2224
2392
  return [r, e => storeSetter(r, e)];
2225
2393
  }
2226
2394
  function createOptimisticStore(e, t, n) {
2227
- GlobalQueue.B ||= clearOptimisticStore;
2395
+ GlobalQueue.ce ||= clearOptimisticStore;
2228
2396
  const i = typeof e === "function";
2229
2397
  const r = (i ? t : e) ?? {};
2230
2398
  const o = i ? e : undefined;
@@ -2241,7 +2409,7 @@ function clearOptimisticStore(e) {
2241
2409
  if (i) {
2242
2410
  for (const e of Reflect.ownKeys(n)) {
2243
2411
  if (i[e]) {
2244
- i[e].ie = undefined;
2412
+ i[e].q = undefined;
2245
2413
  const n =
2246
2414
  t[STORE_OVERRIDE] && e in t[STORE_OVERRIDE] ? t[STORE_OVERRIDE][e] : t[STORE_VALUE][e];
2247
2415
  const r = n === $DELETED ? undefined : n;
@@ -2249,7 +2417,7 @@ function clearOptimisticStore(e) {
2249
2417
  }
2250
2418
  }
2251
2419
  if (i[$TRACK]) {
2252
- i[$TRACK].ie = undefined;
2420
+ i[$TRACK].q = undefined;
2253
2421
  setSignal(i[$TRACK], undefined);
2254
2422
  }
2255
2423
  }
@@ -2300,7 +2468,7 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
2300
2468
  setProjectionWriteActive(false);
2301
2469
  }
2302
2470
  });
2303
- i.Pe = true;
2471
+ i.Ge = true;
2304
2472
  }
2305
2473
  return { store: o, node: i };
2306
2474
  }
@@ -2387,29 +2555,29 @@ function snapshotImpl(e, t, n, i) {
2387
2555
  }
2388
2556
  if (o) {
2389
2557
  const o = s?.length || e.length;
2390
- for (let l = 0; l < o; l++) {
2391
- a = s && l in s ? s[l] : e[l];
2558
+ for (let f = 0; f < o; f++) {
2559
+ a = s && f in s ? s[f] : e[f];
2392
2560
  if (a === $DELETED) continue;
2393
2561
  if (t && isWrappable(a)) wrap(a, r);
2394
2562
  if ((c = snapshotImpl(a, t, n, i)) !== a || u) {
2395
2563
  if (!u) n.set(e, (u = [...e]));
2396
- u[l] = c;
2564
+ u[f] = c;
2397
2565
  }
2398
2566
  }
2399
2567
  } else {
2400
2568
  const o = getKeys(e, s);
2401
- for (let l = 0, f = o.length; l < f; l++) {
2402
- let f = o[l];
2403
- const E = getPropertyDescriptor(e, s, f);
2569
+ for (let f = 0, l = o.length; f < l; f++) {
2570
+ let l = o[f];
2571
+ const E = getPropertyDescriptor(e, s, l);
2404
2572
  if (E.get) continue;
2405
- a = s && f in s ? s[f] : e[f];
2573
+ a = s && l in s ? s[l] : e[l];
2406
2574
  if (t && isWrappable(a)) wrap(a, r);
2407
- if ((c = snapshotImpl(a, t, n, i)) !== e[f] || u) {
2575
+ if ((c = snapshotImpl(a, t, n, i)) !== e[l] || u) {
2408
2576
  if (!u) {
2409
2577
  u = Object.create(Object.getPrototypeOf(e));
2410
2578
  Object.assign(u, e);
2411
2579
  }
2412
- u[f] = c;
2580
+ u[l] = c;
2413
2581
  }
2414
2582
  }
2415
2583
  }
@@ -2557,221 +2725,221 @@ function mapArray(e, t, n) {
2557
2725
  const o = t;
2558
2726
  return createMemo(
2559
2727
  updateKeyedMap.bind({
2560
- Fe: createOwner(),
2561
- Me: 0,
2562
- $e: e,
2563
- je: [],
2564
- Ke: o,
2565
- Ye: [],
2566
- Be: [],
2567
- Ze: i,
2568
- qe: i || n?.keyed === false ? [] : undefined,
2569
- Xe: r ? [] : undefined,
2570
- ze: n?.fallback
2728
+ Ye: createOwner(),
2729
+ Be: 0,
2730
+ Ze: e,
2731
+ qe: [],
2732
+ ze: o,
2733
+ Xe: [],
2734
+ Je: [],
2735
+ et: i,
2736
+ tt: i || n?.keyed === false ? [] : undefined,
2737
+ nt: r ? [] : undefined,
2738
+ it: n?.fallback
2571
2739
  })
2572
2740
  );
2573
2741
  }
2574
2742
  const pureOptions = { pureWrite: true };
2575
2743
  function updateKeyedMap() {
2576
- const e = this.$e() || [],
2744
+ const e = this.Ze() || [],
2577
2745
  t = e.length;
2578
2746
  e[$TRACK];
2579
- runWithOwner(this.Fe, () => {
2747
+ runWithOwner(this.Ye, () => {
2580
2748
  let n,
2581
2749
  i,
2582
- r = this.qe
2750
+ r = this.tt
2583
2751
  ? () => {
2584
- this.qe[i] = signal(e[i], pureOptions);
2585
- this.Xe && (this.Xe[i] = signal(i, pureOptions));
2586
- return this.Ke(accessor(this.qe[i]), this.Xe ? accessor(this.Xe[i]) : undefined);
2752
+ this.tt[i] = signal(e[i], pureOptions);
2753
+ this.nt && (this.nt[i] = signal(i, pureOptions));
2754
+ return this.ze(accessor(this.tt[i]), this.nt ? accessor(this.nt[i]) : undefined);
2587
2755
  }
2588
- : this.Xe
2756
+ : this.nt
2589
2757
  ? () => {
2590
2758
  const t = e[i];
2591
- this.Xe[i] = signal(i, pureOptions);
2592
- return this.Ke(() => t, accessor(this.Xe[i]));
2759
+ this.nt[i] = signal(i, pureOptions);
2760
+ return this.ze(() => t, accessor(this.nt[i]));
2593
2761
  }
2594
2762
  : () => {
2595
2763
  const t = e[i];
2596
- return this.Ke(() => t);
2764
+ return this.ze(() => t);
2597
2765
  };
2598
2766
  if (t === 0) {
2599
- if (this.Me !== 0) {
2600
- this.Fe.dispose(false);
2601
- this.Be = [];
2602
- this.je = [];
2603
- this.Ye = [];
2604
- this.Me = 0;
2605
- this.qe && (this.qe = []);
2606
- this.Xe && (this.Xe = []);
2607
- }
2608
- if (this.ze && !this.Ye[0]) {
2609
- this.Ye[0] = runWithOwner((this.Be[0] = createOwner()), this.ze);
2610
- }
2611
- } else if (this.Me === 0) {
2612
- if (this.Be[0]) this.Be[0].dispose();
2613
- this.Ye = new Array(t);
2767
+ if (this.Be !== 0) {
2768
+ this.Ye.dispose(false);
2769
+ this.Je = [];
2770
+ this.qe = [];
2771
+ this.Xe = [];
2772
+ this.Be = 0;
2773
+ this.tt && (this.tt = []);
2774
+ this.nt && (this.nt = []);
2775
+ }
2776
+ if (this.it && !this.Xe[0]) {
2777
+ this.Xe[0] = runWithOwner((this.Je[0] = createOwner()), this.it);
2778
+ }
2779
+ } else if (this.Be === 0) {
2780
+ if (this.Je[0]) this.Je[0].dispose();
2781
+ this.Xe = new Array(t);
2614
2782
  for (i = 0; i < t; i++) {
2615
- this.je[i] = e[i];
2616
- this.Ye[i] = runWithOwner((this.Be[i] = createOwner()), r);
2783
+ this.qe[i] = e[i];
2784
+ this.Xe[i] = runWithOwner((this.Je[i] = createOwner()), r);
2617
2785
  }
2618
- this.Me = t;
2786
+ this.Be = t;
2619
2787
  } else {
2620
2788
  let o,
2621
2789
  s,
2622
2790
  u,
2623
2791
  c,
2624
2792
  a,
2625
- l,
2626
2793
  f,
2794
+ l,
2627
2795
  E = new Array(t),
2628
2796
  T = new Array(t),
2629
- d = this.qe ? new Array(t) : undefined,
2630
- S = this.Xe ? new Array(t) : undefined;
2797
+ d = this.tt ? new Array(t) : undefined,
2798
+ S = this.nt ? new Array(t) : undefined;
2631
2799
  for (
2632
- o = 0, s = Math.min(this.Me, t);
2633
- o < s && (this.je[o] === e[o] || (this.qe && compare(this.Ze, this.je[o], e[o])));
2800
+ o = 0, s = Math.min(this.Be, t);
2801
+ o < s && (this.qe[o] === e[o] || (this.tt && compare(this.et, this.qe[o], e[o])));
2634
2802
  o++
2635
2803
  ) {
2636
- if (this.qe) setSignal(this.qe[o], e[o]);
2804
+ if (this.tt) setSignal(this.tt[o], e[o]);
2637
2805
  }
2638
2806
  for (
2639
- s = this.Me - 1, u = t - 1;
2807
+ s = this.Be - 1, u = t - 1;
2640
2808
  s >= o &&
2641
2809
  u >= o &&
2642
- (this.je[s] === e[u] || (this.qe && compare(this.Ze, this.je[s], e[u])));
2810
+ (this.qe[s] === e[u] || (this.tt && compare(this.et, this.qe[s], e[u])));
2643
2811
  s--, u--
2644
2812
  ) {
2645
- E[u] = this.Ye[s];
2646
- T[u] = this.Be[s];
2647
- d && (d[u] = this.qe[s]);
2648
- S && (S[u] = this.Xe[s]);
2813
+ E[u] = this.Xe[s];
2814
+ T[u] = this.Je[s];
2815
+ d && (d[u] = this.tt[s]);
2816
+ S && (S[u] = this.nt[s]);
2649
2817
  }
2650
- l = new Map();
2651
- f = new Array(u + 1);
2818
+ f = new Map();
2819
+ l = new Array(u + 1);
2652
2820
  for (i = u; i >= o; i--) {
2653
2821
  c = e[i];
2654
- a = this.Ze ? this.Ze(c) : c;
2655
- n = l.get(a);
2656
- f[i] = n === undefined ? -1 : n;
2657
- l.set(a, i);
2822
+ a = this.et ? this.et(c) : c;
2823
+ n = f.get(a);
2824
+ l[i] = n === undefined ? -1 : n;
2825
+ f.set(a, i);
2658
2826
  }
2659
2827
  for (n = o; n <= s; n++) {
2660
- c = this.je[n];
2661
- a = this.Ze ? this.Ze(c) : c;
2662
- i = l.get(a);
2828
+ c = this.qe[n];
2829
+ a = this.et ? this.et(c) : c;
2830
+ i = f.get(a);
2663
2831
  if (i !== undefined && i !== -1) {
2664
- E[i] = this.Ye[n];
2665
- T[i] = this.Be[n];
2666
- d && (d[i] = this.qe[n]);
2667
- S && (S[i] = this.Xe[n]);
2668
- i = f[i];
2669
- l.set(a, i);
2670
- } else this.Be[n].dispose();
2832
+ E[i] = this.Xe[n];
2833
+ T[i] = this.Je[n];
2834
+ d && (d[i] = this.tt[n]);
2835
+ S && (S[i] = this.nt[n]);
2836
+ i = l[i];
2837
+ f.set(a, i);
2838
+ } else this.Je[n].dispose();
2671
2839
  }
2672
2840
  for (i = o; i < t; i++) {
2673
2841
  if (i in E) {
2674
- this.Ye[i] = E[i];
2675
- this.Be[i] = T[i];
2842
+ this.Xe[i] = E[i];
2843
+ this.Je[i] = T[i];
2676
2844
  if (d) {
2677
- this.qe[i] = d[i];
2678
- setSignal(this.qe[i], e[i]);
2845
+ this.tt[i] = d[i];
2846
+ setSignal(this.tt[i], e[i]);
2679
2847
  }
2680
2848
  if (S) {
2681
- this.Xe[i] = S[i];
2682
- setSignal(this.Xe[i], i);
2849
+ this.nt[i] = S[i];
2850
+ setSignal(this.nt[i], i);
2683
2851
  }
2684
2852
  } else {
2685
- this.Ye[i] = runWithOwner((this.Be[i] = createOwner()), r);
2853
+ this.Xe[i] = runWithOwner((this.Je[i] = createOwner()), r);
2686
2854
  }
2687
2855
  }
2688
- this.Ye = this.Ye.slice(0, (this.Me = t));
2689
- this.je = e.slice(0);
2856
+ this.Xe = this.Xe.slice(0, (this.Be = t));
2857
+ this.qe = e.slice(0);
2690
2858
  }
2691
2859
  });
2692
- return this.Ye;
2860
+ return this.Xe;
2693
2861
  }
2694
2862
  function repeat(e, t, n) {
2695
2863
  const i = t;
2696
2864
  return updateRepeat.bind({
2697
- Fe: createOwner(),
2698
- Me: 0,
2699
- Je: 0,
2700
- et: e,
2701
- Ke: i,
2702
- Be: [],
2703
- Ye: [],
2704
- tt: n?.from,
2705
- ze: n?.fallback
2865
+ Ye: createOwner(),
2866
+ Be: 0,
2867
+ rt: 0,
2868
+ ot: e,
2869
+ ze: i,
2870
+ Je: [],
2871
+ Xe: [],
2872
+ st: n?.from,
2873
+ it: n?.fallback
2706
2874
  });
2707
2875
  }
2708
2876
  function updateRepeat() {
2709
- const e = this.et();
2710
- const t = this.tt?.() || 0;
2711
- runWithOwner(this.Fe, () => {
2877
+ const e = this.ot();
2878
+ const t = this.st?.() || 0;
2879
+ runWithOwner(this.Ye, () => {
2712
2880
  if (e === 0) {
2713
- if (this.Me !== 0) {
2714
- this.Fe.dispose(false);
2715
- this.Be = [];
2716
- this.Ye = [];
2717
- this.Me = 0;
2881
+ if (this.Be !== 0) {
2882
+ this.Ye.dispose(false);
2883
+ this.Je = [];
2884
+ this.Xe = [];
2885
+ this.Be = 0;
2718
2886
  }
2719
- if (this.ze && !this.Ye[0]) {
2720
- this.Ye[0] = runWithOwner((this.Be[0] = createOwner()), this.ze);
2887
+ if (this.it && !this.Xe[0]) {
2888
+ this.Xe[0] = runWithOwner((this.Je[0] = createOwner()), this.it);
2721
2889
  }
2722
2890
  return;
2723
2891
  }
2724
2892
  const n = t + e;
2725
- const i = this.Je + this.Me;
2726
- if (this.Me === 0 && this.Be[0]) this.Be[0].dispose();
2727
- for (let e = n; e < i; e++) this.Be[e - this.Je].dispose();
2728
- if (this.Je < t) {
2729
- let e = this.Je;
2730
- while (e < t && e < this.Me) this.Be[e++].dispose();
2731
- this.Be.splice(0, t - this.Je);
2732
- this.Ye.splice(0, t - this.Je);
2733
- } else if (this.Je > t) {
2734
- let n = i - this.Je - 1;
2735
- let r = this.Je - t;
2736
- this.Be.length = this.Ye.length = e;
2893
+ const i = this.rt + this.Be;
2894
+ if (this.Be === 0 && this.Je[0]) this.Je[0].dispose();
2895
+ for (let e = n; e < i; e++) this.Je[e - this.rt].dispose();
2896
+ if (this.rt < t) {
2897
+ let e = this.rt;
2898
+ while (e < t && e < this.Be) this.Je[e++].dispose();
2899
+ this.Je.splice(0, t - this.rt);
2900
+ this.Xe.splice(0, t - this.rt);
2901
+ } else if (this.rt > t) {
2902
+ let n = i - this.rt - 1;
2903
+ let r = this.rt - t;
2904
+ this.Je.length = this.Xe.length = e;
2737
2905
  while (n >= r) {
2738
- this.Be[n] = this.Be[n - r];
2739
- this.Ye[n] = this.Ye[n - r];
2906
+ this.Je[n] = this.Je[n - r];
2907
+ this.Xe[n] = this.Xe[n - r];
2740
2908
  n--;
2741
2909
  }
2742
2910
  for (let e = 0; e < r; e++) {
2743
- this.Ye[e] = runWithOwner((this.Be[e] = createOwner()), () => this.Ke(e + t));
2911
+ this.Xe[e] = runWithOwner((this.Je[e] = createOwner()), () => this.ze(e + t));
2744
2912
  }
2745
2913
  }
2746
2914
  for (let e = i; e < n; e++) {
2747
- this.Ye[e - t] = runWithOwner((this.Be[e - t] = createOwner()), () => this.Ke(e));
2915
+ this.Xe[e - t] = runWithOwner((this.Je[e - t] = createOwner()), () => this.ze(e));
2748
2916
  }
2749
- this.Ye = this.Ye.slice(0, e);
2750
- this.Je = t;
2751
- this.Me = e;
2917
+ this.Xe = this.Xe.slice(0, e);
2918
+ this.rt = t;
2919
+ this.Be = e;
2752
2920
  });
2753
- return this.Ye;
2921
+ return this.Xe;
2754
2922
  }
2755
2923
  function compare(e, t, n) {
2756
2924
  return e ? e(t) === e(n) : true;
2757
2925
  }
2758
2926
  function boundaryComputed(e, t) {
2759
2927
  const n = computed(e, undefined, { lazy: true });
2760
- n.he = (e, t) => {
2761
- const i = e !== undefined ? e : n.Ee;
2762
- const r = t !== undefined ? t : n.q;
2763
- n.Ee &= ~n.nt;
2764
- n.ce.notify(n, n.nt, i, r);
2928
+ n.ge = (e, t) => {
2929
+ const i = e !== undefined ? e : n.Se;
2930
+ const r = t !== undefined ? t : n.le;
2931
+ n.Se &= ~n.ut;
2932
+ n.F.notify(n, n.ut, i, r);
2765
2933
  };
2766
- n.nt = t;
2767
- n.Pe = true;
2934
+ n.ut = t;
2935
+ n.Ge = true;
2768
2936
  recompute(n, true);
2769
2937
  return n;
2770
2938
  }
2771
2939
  function createBoundChildren(e, t, n, i) {
2772
- const r = e.ce;
2773
- r.addChild((e.ce = n));
2774
- onCleanup(() => r.removeChild(e.ce));
2940
+ const r = e.F;
2941
+ r.addChild((e.F = n));
2942
+ onCleanup(() => r.removeChild(e.F));
2775
2943
  return runWithOwner(e, () => {
2776
2944
  const e = computed(t);
2777
2945
  return boundaryComputed(() => staleValues(() => flatten(read(e))), i);
@@ -2779,57 +2947,61 @@ function createBoundChildren(e, t, n, i) {
2779
2947
  }
2780
2948
  const ON_INIT = Symbol();
2781
2949
  class CollectionQueue extends Queue {
2782
- it;
2783
- rt = new Set();
2784
- ot = signal(false, { pureWrite: true });
2785
- st = false;
2786
- ut;
2787
- ct = ON_INIT;
2950
+ ct;
2951
+ ft = new Set();
2952
+ lt = signal(false, { pureWrite: true, We: true });
2953
+ Et = false;
2954
+ Tt;
2955
+ dt = ON_INIT;
2788
2956
  constructor(e) {
2789
2957
  super();
2790
- this.it = e;
2958
+ this.ct = e;
2791
2959
  }
2792
2960
  run(e) {
2793
- if (!e || read(this.ot)) return;
2961
+ if (!e || read(this.lt)) return;
2794
2962
  return super.run(e);
2795
2963
  }
2796
2964
  notify(e, t, n, i) {
2797
- if (!(t & this.it)) return super.notify(e, t, n, i);
2798
- if (this.st && this.ut) {
2965
+ if (!(t & this.ct)) return super.notify(e, t, n, i);
2966
+ if (this.Et && this.Tt) {
2799
2967
  const e = untrack(() => {
2800
2968
  try {
2801
- return this.ut();
2969
+ return this.Tt();
2802
2970
  } catch {
2803
2971
  return ON_INIT;
2804
2972
  }
2805
2973
  });
2806
- if (e !== this.ct) {
2807
- this.ct = e;
2808
- this.st = false;
2809
- this.rt.clear();
2974
+ if (e !== this.dt) {
2975
+ this.dt = e;
2976
+ this.Et = false;
2977
+ this.ft.clear();
2810
2978
  }
2811
2979
  }
2812
- if (this.it & STATUS_PENDING && this.st) return super.notify(e, t, n, i);
2813
- if (n & this.it) {
2814
- const t = i?.source || e.q?.source;
2980
+ if (this.ct & STATUS_PENDING && this.Et) return super.notify(e, t, n, i);
2981
+ if (this.ct & STATUS_PENDING && n & STATUS_ERROR) {
2982
+ return super.notify(e, STATUS_ERROR, n, i);
2983
+ }
2984
+ if (n & this.ct) {
2985
+ const t = i?.source || e.le?.source;
2815
2986
  if (t) {
2816
- const e = this.rt.size === 0;
2817
- this.rt.add(t);
2818
- if (e) setSignal(this.ot, true);
2987
+ const e = this.ft.size === 0;
2988
+ this.ft.add(t);
2989
+ if (e) setSignal(this.lt, true);
2819
2990
  }
2820
2991
  }
2821
- t &= ~this.it;
2992
+ t &= ~this.ct;
2822
2993
  return t ? super.notify(e, t, n, i) : true;
2823
2994
  }
2824
2995
  checkSources() {
2825
- for (const e of this.rt) {
2826
- if (!(e.Ee & this.it)) this.rt.delete(e);
2996
+ for (const e of this.ft) {
2997
+ if (!(e.Se & this.ct) && !(this.ct & STATUS_ERROR && e.Se & STATUS_PENDING))
2998
+ this.ft.delete(e);
2827
2999
  }
2828
- if (!this.rt.size) {
2829
- setSignal(this.ot, false);
2830
- if (this.ut) {
3000
+ if (!this.ft.size) {
3001
+ setSignal(this.lt, false);
3002
+ if (this.Tt) {
2831
3003
  try {
2832
- this.ct = untrack(() => this.ut());
3004
+ this.dt = untrack(() => this.Tt());
2833
3005
  } catch {}
2834
3006
  }
2835
3007
  }
@@ -2838,13 +3010,13 @@ class CollectionQueue extends Queue {
2838
3010
  function createCollectionBoundary(e, t, n, i) {
2839
3011
  const r = createOwner();
2840
3012
  const o = new CollectionQueue(e);
2841
- if (i) o.ut = i;
3013
+ if (i) o.Tt = i;
2842
3014
  const s = createBoundChildren(r, t, o, e);
2843
3015
  const u = computed(() => {
2844
- if (!read(o.ot)) {
3016
+ if (!read(o.lt)) {
2845
3017
  const e = read(s);
2846
- if (!untrack(() => read(o.ot))) {
2847
- o.st = true;
3018
+ if (!untrack(() => read(o.lt))) {
3019
+ o.Et = true;
2848
3020
  return e;
2849
3021
  }
2850
3022
  }
@@ -2857,10 +3029,10 @@ function createLoadingBoundary(e, t, n) {
2857
3029
  }
2858
3030
  function createErrorBoundary(e, t) {
2859
3031
  return createCollectionBoundary(STATUS_ERROR, e, e => {
2860
- let n = e.rt.values().next().value;
2861
- const i = n.q?.cause ?? n.q;
3032
+ let n = e.ft.values().next().value;
3033
+ const i = n.le?.cause ?? n.le;
2862
3034
  return t(i, () => {
2863
- for (const t of e.rt) recompute(t);
3035
+ for (const t of e.ft) recompute(t);
2864
3036
  schedule();
2865
3037
  });
2866
3038
  });