@solidjs/signals 0.4.4 → 0.4.5

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
@@ -39,7 +39,7 @@ function incrementClock() {
39
39
  clock++;
40
40
  }
41
41
  var ActiveTransition = null;
42
- var unobserved = [];
42
+ var Unobserved = [];
43
43
  var scheduled = false;
44
44
  function schedule() {
45
45
  if (scheduled)
@@ -49,12 +49,12 @@ function schedule() {
49
49
  queueMicrotask(flush);
50
50
  }
51
51
  function notifyUnobserved() {
52
- for (let i = 0; i < unobserved.length; i++) {
53
- const source = unobserved[i];
54
- if (!source.d || !source.d.length)
55
- unobserved[i].da?.();
52
+ for (let i = 0; i < Unobserved.length; i++) {
53
+ const source = Unobserved[i];
54
+ if (!source.b || !source.b.length)
55
+ Unobserved[i].da?.();
56
56
  }
57
- unobserved = [];
57
+ Unobserved = [];
58
58
  }
59
59
  var pureQueue = [];
60
60
  var Queue = class {
@@ -64,8 +64,8 @@ var Queue = class {
64
64
  e = [];
65
65
  created = clock;
66
66
  enqueue(type, fn) {
67
- if (ActiveTransition && ActiveTransition.w.has(this))
68
- return ActiveTransition.w.get(this).enqueue(type, fn);
67
+ if (ActiveTransition && ActiveTransition.u.has(this))
68
+ return ActiveTransition.u.get(this).enqueue(type, fn);
69
69
  pureQueue.push(fn);
70
70
  if (type)
71
71
  this.f[type - 1].push(fn);
@@ -97,7 +97,7 @@ var Queue = class {
97
97
  this.run(EFFECT_USER);
98
98
  } finally {
99
99
  this.z = false;
100
- unobserved.length && notifyUnobserved();
100
+ Unobserved.length && notifyUnobserved();
101
101
  }
102
102
  }
103
103
  addChild(child) {
@@ -110,8 +110,8 @@ var Queue = class {
110
110
  this.e.splice(index, 1);
111
111
  }
112
112
  notify(...args) {
113
- if (ActiveTransition && ActiveTransition.w.has(this))
114
- return ActiveTransition.w.get(this).notify(...args);
113
+ if (ActiveTransition && ActiveTransition.u.has(this))
114
+ return ActiveTransition.u.get(this).notify(...args);
115
115
  if (this.m)
116
116
  return this.m.notify(...args);
117
117
  return false;
@@ -120,7 +120,7 @@ var Queue = class {
120
120
  this.f[0].push.apply(this.f[0], queue.f[0]);
121
121
  this.f[1].push.apply(this.f[1], queue.f[1]);
122
122
  for (let i = 0; i < queue.e.length; i++) {
123
- const og = this.e.find((c) => c.j === queue.e[i].j);
123
+ const og = this.e.find((c) => c.g === queue.e[i].g);
124
124
  if (og)
125
125
  og.merge(queue.e[i]);
126
126
  else
@@ -140,12 +140,12 @@ function runQueue(queue, type) {
140
140
  }
141
141
  var Transition = class _Transition {
142
142
  a = /* @__PURE__ */ new Map();
143
- t = /* @__PURE__ */ new Set();
144
- Q = /* @__PURE__ */ new Set();
143
+ s = /* @__PURE__ */ new Set();
144
+ R = /* @__PURE__ */ new Set();
145
145
  W = /* @__PURE__ */ new Set();
146
146
  I = false;
147
147
  f = [[], []];
148
- w = /* @__PURE__ */ new Map();
148
+ u = /* @__PURE__ */ new Map();
149
149
  E = [];
150
150
  e = [];
151
151
  m = null;
@@ -153,9 +153,9 @@ var Transition = class _Transition {
153
153
  X = false;
154
154
  created = clock;
155
155
  constructor() {
156
- this.w.set(globalQueue, this);
156
+ this.u.set(globalQueue, this);
157
157
  for (const child of globalQueue.e) {
158
- cloneQueue(child, this, this.w);
158
+ cloneQueue(child, this, this.u);
159
159
  }
160
160
  }
161
161
  enqueue(type, fn) {
@@ -208,9 +208,9 @@ var Transition = class _Transition {
208
208
  if (!(type & LOADING_BIT))
209
209
  return false;
210
210
  if (flags & LOADING_BIT) {
211
- this.t.add(node);
211
+ this.s.add(node);
212
212
  } else {
213
- this.t.delete(node);
213
+ this.s.delete(node);
214
214
  }
215
215
  return true;
216
216
  }
@@ -219,7 +219,7 @@ var Transition = class _Transition {
219
219
  this.f[1].push.apply(this.f[1], queue.f[1]);
220
220
  this.E.push.apply(this.E, queue.E);
221
221
  for (let i = 0; i < queue.e.length; i++) {
222
- const og = this.e.find((c) => c.j === queue.e[i].j);
222
+ const og = this.e.find((c) => c.g === queue.e[i].g);
223
223
  if (og)
224
224
  og.merge(queue.e[i]);
225
225
  else
@@ -247,9 +247,9 @@ var Transition = class _Transition {
247
247
  const result = fn();
248
248
  const transition2 = ActiveTransition;
249
249
  if (result instanceof Promise) {
250
- transition2.Q.add(result);
250
+ transition2.R.add(result);
251
251
  result.finally(() => {
252
- transition2.Q.delete(result);
252
+ transition2.R.delete(result);
253
253
  finishTransition(transition2);
254
254
  });
255
255
  }
@@ -282,43 +282,51 @@ function cloneGraph(node) {
282
282
  return node.k.a.get(node);
283
283
  }
284
284
  const clone = Object.create(Object.getPrototypeOf(node));
285
- Object.assign(clone, node, { n: null, s: null, j: node });
285
+ Object.assign(clone, node, {
286
+ n: null,
287
+ r: null,
288
+ b: null,
289
+ a: node.a ? [...node.a] : null,
290
+ g: node
291
+ });
286
292
  ActiveTransition.a.set(node, clone);
287
293
  node.k = ActiveTransition;
288
- if (node.d) {
289
- for (let i = 0, length = node.d.length; i < length; i++) {
290
- const o = node.d[i];
291
- node.d.push(cloneGraph(o));
294
+ if (node.a) {
295
+ for (let i = 0; i < node.a.length; i++)
296
+ node.a[i].b.push(clone);
297
+ }
298
+ if (node.b) {
299
+ clone.b = [];
300
+ for (let i = 0, length = node.b.length; i < length; i++) {
301
+ !node.b[i].g && clone.b.push(cloneGraph(node.b[i]));
292
302
  }
293
303
  }
294
304
  return clone;
295
305
  }
296
- function removeSourceObservers(node, index) {
306
+ function replaceSourceObservers(node, transition2) {
297
307
  let source;
308
+ let transitionSource;
298
309
  let swap;
299
- for (let i = index; i < node.a.length; i++) {
300
- source = ActiveTransition && ActiveTransition.a.get(node.a[i]) || node.a[i];
301
- if (source.d) {
302
- if ((swap = source.d.indexOf(node)) !== -1) {
303
- source.d[swap] = source.d[source.d.length - 1];
304
- source.d.pop();
305
- }
306
- if (!source.d.length)
307
- unobserved.push(source);
310
+ for (let i = 0; i < node.a.length; i++) {
311
+ transitionSource = transition2.a.get(node.a[i]);
312
+ source = transitionSource || node.a[i];
313
+ if (source.b && (swap = source.b.indexOf(node)) !== -1) {
314
+ source.b[swap] = transitionSource ? node.g : source.b[source.b.length - 1];
315
+ !transitionSource && source.b.pop();
308
316
  }
309
317
  }
310
318
  }
311
319
  function cloneQueue(queue, parent, clonedQueues) {
312
320
  const clone = Object.create(Object.getPrototypeOf(queue));
313
321
  Object.assign(clone, queue, {
314
- j: queue,
322
+ g: queue,
315
323
  m: parent,
316
324
  e: [],
317
325
  enqueue(type, fn) {
318
326
  ActiveTransition?.enqueue(type, fn);
319
327
  },
320
328
  notify(node, type, flags) {
321
- node = node.j || node;
329
+ node = node.g || node;
322
330
  if (!clone.F || type & LOADING_BIT) {
323
331
  type &= ~LOADING_BIT;
324
332
  ActiveTransition?.notify(node, LOADING_BIT, flags);
@@ -336,7 +344,7 @@ function cloneQueue(queue, parent, clonedQueues) {
336
344
  }
337
345
  function resolveQueues(children) {
338
346
  for (const child of children) {
339
- const og = child.j;
347
+ const og = child.g;
340
348
  if (og) {
341
349
  const clonedChildren = child.e;
342
350
  delete child.enqueue;
@@ -344,10 +352,10 @@ function resolveQueues(children) {
344
352
  delete child.m;
345
353
  delete child.e;
346
354
  Object.assign(og, child);
347
- delete og.j;
355
+ delete og.g;
348
356
  resolveQueues(clonedChildren);
349
- } else if (child.m.j) {
350
- child.m.j.addChild(child);
357
+ } else if (child.m.g) {
358
+ child.m.g.addChild(child);
351
359
  }
352
360
  }
353
361
  }
@@ -360,34 +368,34 @@ function mergeTransitions(t1, t2) {
360
368
  c.k = t1;
361
369
  t1.W.add(c);
362
370
  });
363
- t2.Q.forEach((p) => t1.Q.add(p));
364
- t2.t.forEach((n) => t1.t.add(n));
371
+ t2.R.forEach((p) => t1.R.add(p));
372
+ t2.s.forEach((n) => t1.s.add(n));
365
373
  t1.merge(t2);
366
374
  t2.I = t1;
367
375
  }
368
376
  function finishTransition(transition2) {
369
- if (transition2.I || transition2.X || transition2.Q.size || transition2.t.size)
377
+ if (transition2.I || transition2.X || transition2.R.size || transition2.s.size)
370
378
  return;
371
379
  for (const [source, clone] of transition2.a) {
372
380
  if (source === clone || source.k !== transition2)
373
381
  continue;
374
382
  if (clone.a)
375
- removeSourceObservers(clone, 0);
383
+ replaceSourceObservers(clone, transition2);
376
384
  source.dispose(false);
377
385
  source.emptyDisposal();
378
386
  Object.assign(source, clone);
379
- delete source.j;
387
+ delete source.g;
380
388
  delete source.k;
381
389
  }
382
390
  globalQueue.f[0].push.apply(globalQueue.f[0], transition2.f[0]);
383
391
  globalQueue.f[1].push.apply(globalQueue.f[1], transition2.f[1]);
384
392
  resolveQueues(transition2.e);
385
393
  transition2.I = true;
386
- globalQueue.flush();
387
394
  for (const reset of transition2.W) {
388
395
  delete reset.k;
389
396
  reset();
390
397
  }
398
+ globalQueue.flush();
391
399
  }
392
400
 
393
401
  // src/core/owner.ts
@@ -406,11 +414,11 @@ var Owner = class {
406
414
  // However, the children are actually added in reverse creation order
407
415
  // See comment at the top of the file for an example of the _nextSibling traversal
408
416
  m = null;
409
- s = null;
417
+ r = null;
410
418
  B = null;
411
- b = STATE_CLEAN;
419
+ c = STATE_CLEAN;
412
420
  n = null;
413
- x = defaultContext;
421
+ w = defaultContext;
414
422
  l = globalQueue;
415
423
  ea = 0;
416
424
  id = null;
@@ -423,27 +431,27 @@ var Owner = class {
423
431
  append(child) {
424
432
  child.m = this;
425
433
  child.B = this;
426
- if (this.s)
427
- this.s.B = child;
428
- child.s = this.s;
429
- this.s = child;
434
+ if (this.r)
435
+ this.r.B = child;
436
+ child.r = this.r;
437
+ this.r = child;
430
438
  if (this.id != null && child.id == null)
431
439
  child.id = this.getNextChildId();
432
- if (child.x !== this.x) {
433
- child.x = { ...this.x, ...child.x };
440
+ if (child.w !== this.w) {
441
+ child.w = { ...this.w, ...child.w };
434
442
  }
435
443
  if (this.l)
436
444
  child.l = this.l;
437
445
  }
438
446
  dispose(self = true) {
439
- if (this.b === STATE_DISPOSED)
447
+ if (this.c === STATE_DISPOSED)
440
448
  return;
441
- let head = self ? this.B || this.m : this, current = this.s, next = null;
449
+ let head = self ? this.B || this.m : this, current = this.r, next = null;
442
450
  while (current && current.m === this) {
443
451
  current.dispose(true);
444
452
  current.J();
445
- next = current.s;
446
- current.s = null;
453
+ next = current.r;
454
+ current.r = null;
447
455
  current = next;
448
456
  }
449
457
  this.ea = 0;
@@ -452,15 +460,15 @@ var Owner = class {
452
460
  if (current)
453
461
  current.B = !self ? this : this.B;
454
462
  if (head)
455
- head.s = current;
463
+ head.r = current;
456
464
  }
457
465
  J() {
458
466
  if (this.B)
459
- this.B.s = null;
467
+ this.B.r = null;
460
468
  this.m = null;
461
469
  this.B = null;
462
- this.x = defaultContext;
463
- this.b = STATE_DISPOSED;
470
+ this.w = defaultContext;
471
+ this.c = STATE_DISPOSED;
464
472
  this.emptyDisposal();
465
473
  }
466
474
  emptyDisposal() {
@@ -489,7 +497,7 @@ function getContext(context, owner = currentOwner) {
489
497
  if (!owner) {
490
498
  throw new NoOwnerError();
491
499
  }
492
- const value = hasContext(context, owner) ? owner.x[context.id] : context.defaultValue;
500
+ const value = hasContext(context, owner) ? owner.w[context.id] : context.defaultValue;
493
501
  if (isUndefined(value)) {
494
502
  throw new ContextNotFoundError();
495
503
  }
@@ -499,13 +507,13 @@ function setContext(context, value, owner = currentOwner) {
499
507
  if (!owner) {
500
508
  throw new NoOwnerError();
501
509
  }
502
- owner.x = {
503
- ...owner.x,
510
+ owner.w = {
511
+ ...owner.w,
504
512
  [context.id]: isUndefined(value) ? context.defaultValue : value
505
513
  };
506
514
  }
507
515
  function hasContext(context, owner = currentOwner) {
508
- return !isUndefined(owner?.x[context.id]);
516
+ return !isUndefined(owner?.w[context.id]);
509
517
  }
510
518
  function onCleanup(fn) {
511
519
  if (!currentOwner)
@@ -543,10 +551,10 @@ function getObserver() {
543
551
  var UNCHANGED = Symbol(0);
544
552
  var Computation = class extends Owner {
545
553
  a = null;
546
- d = null;
547
- i;
548
- R;
554
+ b = null;
555
+ j;
549
556
  K;
557
+ L;
550
558
  // Used in __DEV__ mode, hopefully removed in production
551
559
  ka;
552
560
  // Using false is an optimization as an alternative to _equals: () => false
@@ -558,16 +566,16 @@ var Computation = class extends Owner {
558
566
  h = 0;
559
567
  /** Which flags raised by sources are handled, vs. being passed through. */
560
568
  aa = DEFAULT_FLAGS;
561
- L = -1;
569
+ M = -1;
562
570
  G = false;
563
571
  k;
564
- j;
572
+ g;
565
573
  constructor(initialValue, compute2, options) {
566
574
  super(options?.id, compute2 === null);
567
- this.K = compute2;
568
- this.b = compute2 ? STATE_DIRTY : STATE_CLEAN;
575
+ this.L = compute2;
576
+ this.c = compute2 ? STATE_DIRTY : STATE_CLEAN;
569
577
  this.h = compute2 && initialValue === void 0 ? UNINITIALIZED_BIT : 0;
570
- this.i = initialValue;
578
+ this.j = initialValue;
571
579
  if (options?.equals !== void 0)
572
580
  this.$ = options.equals;
573
581
  if (options?.pureWrite)
@@ -583,9 +591,9 @@ var Computation = class extends Owner {
583
591
  track(this);
584
592
  newFlags |= this.h & ~currentMask;
585
593
  if (this.h & ERROR_BIT) {
586
- throw this.R;
594
+ throw this.K;
587
595
  } else {
588
- return this.i;
596
+ return this.j;
589
597
  }
590
598
  }
591
599
  /**
@@ -593,13 +601,13 @@ var Computation = class extends Owner {
593
601
  * Automatically re-executes the surrounding computation when the value changes
594
602
  */
595
603
  read() {
596
- if (ActiveTransition && ActiveTransition.a.has(this)) {
597
- const clone = ActiveTransition.a.get(this);
604
+ if (ActiveTransition && (ActiveTransition.a.has(this) || !this.g && this.h & UNINITIALIZED_BIT)) {
605
+ const clone = ActiveTransition.a.get(this) || cloneGraph(this);
598
606
  if (clone !== this)
599
607
  return clone.read();
600
608
  }
601
- if (this.K) {
602
- if (this.h & ERROR_BIT && this.L <= clock)
609
+ if (this.L) {
610
+ if (this.h & ERROR_BIT && this.M <= clock)
603
611
  update(this);
604
612
  else
605
613
  this.H();
@@ -614,13 +622,13 @@ var Computation = class extends Owner {
614
622
  * before continuing
615
623
  */
616
624
  wait() {
617
- if (ActiveTransition && ActiveTransition.a.has(this)) {
618
- const clone = ActiveTransition.a.get(this);
625
+ if (ActiveTransition && (ActiveTransition.a.has(this) || !this.g && this.h & UNINITIALIZED_BIT)) {
626
+ const clone = ActiveTransition.a.get(this) || cloneGraph(this);
619
627
  if (clone !== this)
620
628
  return clone.wait();
621
629
  }
622
- if (this.K) {
623
- if (this.h & ERROR_BIT && this.L <= clock)
630
+ if (this.L) {
631
+ if (this.h & ERROR_BIT && this.M <= clock)
624
632
  update(this);
625
633
  else
626
634
  this.H();
@@ -630,54 +638,49 @@ var Computation = class extends Owner {
630
638
  throw new NotReadyError();
631
639
  }
632
640
  if (staleCheck && this.h & LOADING_BIT) {
633
- staleCheck.i = true;
641
+ staleCheck.j = true;
634
642
  }
635
643
  return this.fa();
636
644
  }
637
645
  /** Update the computation with a new value. */
638
646
  write(value, flags = 0, raw = false) {
639
- if (ActiveTransition && !this.j) {
647
+ if (ActiveTransition && !this.g) {
640
648
  const clone = cloneGraph(this);
641
649
  if (clone !== this)
642
650
  return clone.write(value, flags, raw);
643
651
  }
644
- const newValue = !raw && typeof value === "function" ? value(this.i) : value;
652
+ const newValue = !raw && typeof value === "function" ? value(this.j) : value;
645
653
  const valueChanged = newValue !== UNCHANGED && (!!(this.h & UNINITIALIZED_BIT) || // this._stateFlags & LOADING_BIT & ~flags ||
646
- this.$ === false || !this.$(this.i, newValue));
654
+ this.$ === false || !this.$(this.j, newValue));
647
655
  if (valueChanged) {
648
- this.i = newValue;
649
- this.R = void 0;
656
+ this.j = newValue;
657
+ this.K = void 0;
650
658
  }
651
659
  const changedFlagsMask = this.h ^ flags, changedFlags = changedFlagsMask & flags;
652
660
  this.h = flags;
653
- this.L = clock + 1;
654
- if (this.d) {
655
- for (let i = 0; i < this.d.length; i++) {
661
+ this.M = clock + 1;
662
+ if (this.b) {
663
+ for (let i = 0; i < this.b.length; i++) {
656
664
  if (valueChanged) {
657
- this.d[i].o(STATE_DIRTY);
665
+ this.b[i].x(STATE_DIRTY);
658
666
  } else if (changedFlagsMask) {
659
- this.d[i].Y(changedFlagsMask, changedFlags);
667
+ this.b[i].Y(changedFlagsMask, changedFlags);
660
668
  }
661
669
  }
662
670
  }
663
- return this.i;
671
+ return this.j;
664
672
  }
665
673
  /**
666
674
  * Set the current node's state, and recursively mark all of this node's observers as STATE_CHECK
667
675
  */
668
- o(state, skipQueue) {
669
- if (ActiveTransition && ActiveTransition.a.has(this)) {
670
- const clone = ActiveTransition.a.get(this);
671
- if (clone !== this)
672
- return clone.o(state, skipQueue);
673
- }
674
- if (this.b >= state && !this.G)
676
+ x(state, skipQueue) {
677
+ if (this.c >= state && !this.G)
675
678
  return;
676
679
  this.G = !!skipQueue;
677
- this.b = state;
678
- if (this.d) {
679
- for (let i = 0; i < this.d.length; i++) {
680
- this.d[i].o(STATE_CHECK, skipQueue);
680
+ this.c = state;
681
+ if (this.b) {
682
+ for (let i = 0; i < this.b.length; i++) {
683
+ this.b[i].x(STATE_CHECK, skipQueue);
681
684
  }
682
685
  }
683
686
  }
@@ -688,34 +691,34 @@ var Computation = class extends Owner {
688
691
  * @param newFlags The source's new flags, masked to just the changed ones.
689
692
  */
690
693
  Y(mask, newFlags2) {
691
- if (this.b >= STATE_DIRTY)
694
+ if (this.c >= STATE_DIRTY)
692
695
  return;
693
696
  if (mask & this.aa) {
694
- this.o(STATE_DIRTY);
697
+ this.x(STATE_DIRTY);
695
698
  return;
696
699
  }
697
- if (this.b >= STATE_CHECK)
700
+ if (this.c >= STATE_CHECK)
698
701
  return;
699
702
  const prevFlags = this.h & mask;
700
703
  const deltaFlags = prevFlags ^ newFlags2;
701
704
  if (newFlags2 === prevFlags) ; else if (deltaFlags & prevFlags & mask) {
702
- this.o(STATE_CHECK);
705
+ this.x(STATE_CHECK);
703
706
  } else {
704
707
  this.h ^= deltaFlags;
705
- if (this.d) {
706
- for (let i = 0; i < this.d.length; i++) {
707
- this.d[i].Y(mask, newFlags2);
708
+ if (this.b) {
709
+ for (let i = 0; i < this.b.length; i++) {
710
+ this.b[i].Y(mask, newFlags2);
708
711
  }
709
712
  }
710
713
  }
711
714
  }
712
- M(error) {
713
- if (ActiveTransition && !this.j) {
715
+ N(error) {
716
+ if (ActiveTransition && !this.g) {
714
717
  const clone = cloneGraph(this);
715
718
  if (clone !== this)
716
- return clone.M(error);
719
+ return clone.N(error);
717
720
  }
718
- this.R = error;
721
+ this.K = error;
719
722
  this.write(UNCHANGED, this.h & ~LOADING_BIT | ERROR_BIT | UNINITIALIZED_BIT);
720
723
  }
721
724
  /**
@@ -726,38 +729,38 @@ var Computation = class extends Owner {
726
729
  * This function will ensure that the value and states we read from the computation are up to date
727
730
  */
728
731
  H() {
729
- if (!this.K) {
732
+ if (!this.L) {
730
733
  return;
731
734
  }
732
- if (this.b === STATE_DISPOSED) {
735
+ if (this.c === STATE_DISPOSED) {
733
736
  return;
734
737
  }
735
- if (this.b === STATE_CLEAN) {
738
+ if (this.c === STATE_CLEAN) {
736
739
  return;
737
740
  }
738
741
  let observerFlags = 0;
739
- if (this.b === STATE_CHECK) {
742
+ if (this.c === STATE_CHECK) {
740
743
  for (let i = 0; i < this.a.length; i++) {
741
744
  const source = ActiveTransition && ActiveTransition.a.get(this.a[i]) || this.a[i];
742
745
  source.H();
743
- observerFlags |= source.h;
744
- if (this.b === STATE_DIRTY) {
746
+ observerFlags |= source.h & ~UNINITIALIZED_BIT;
747
+ if (this.c === STATE_DIRTY) {
745
748
  break;
746
749
  }
747
750
  }
748
751
  }
749
- if (this.b === STATE_DIRTY) {
752
+ if (this.c === STATE_DIRTY) {
750
753
  update(this);
751
754
  } else {
752
755
  this.write(UNCHANGED, observerFlags);
753
- this.b = STATE_CLEAN;
756
+ this.c = STATE_CLEAN;
754
757
  }
755
758
  }
756
759
  /**
757
760
  * Remove ourselves from the owner graph and the computation graph
758
761
  */
759
762
  J() {
760
- if (this.b === STATE_DISPOSED)
763
+ if (this.c === STATE_DISPOSED)
761
764
  return;
762
765
  if (this.a)
763
766
  removeSourceObservers(this, 0);
@@ -765,8 +768,8 @@ var Computation = class extends Owner {
765
768
  }
766
769
  };
767
770
  function track(computation) {
768
- if (ActiveTransition && computation.j)
769
- computation = computation.j;
771
+ if (ActiveTransition && computation.g)
772
+ computation = computation.g;
770
773
  if (currentObserver) {
771
774
  if (!newSources && currentObserver.a && currentObserver.a[newSourcesIndex] === computation) {
772
775
  newSourcesIndex++;
@@ -776,7 +779,7 @@ function track(computation) {
776
779
  newSources.push(computation);
777
780
  }
778
781
  if (updateCheck) {
779
- updateCheck.i = computation.L > currentObserver.L;
782
+ updateCheck.j = computation.M > currentObserver.M;
780
783
  }
781
784
  }
782
785
  }
@@ -788,13 +791,13 @@ function update(node) {
788
791
  try {
789
792
  node.dispose(false);
790
793
  node.emptyDisposal();
791
- const result = compute(node, node.K, node);
794
+ const result = compute(node, node.L, node);
792
795
  node.write(result, newFlags, true);
793
796
  } catch (error) {
794
797
  if (error instanceof NotReadyError) {
795
798
  node.write(UNCHANGED, newFlags | LOADING_BIT | node.h & UNINITIALIZED_BIT);
796
799
  } else {
797
- node.M(error);
800
+ node.N(error);
798
801
  }
799
802
  } finally {
800
803
  if (newSources) {
@@ -810,11 +813,11 @@ function update(node) {
810
813
  }
811
814
  let source;
812
815
  for (let i = newSourcesIndex; i < node.a.length; i++) {
813
- source = node.a[i];
814
- if (!source.d)
815
- source.d = [node];
816
+ source = ActiveTransition && ActiveTransition.a.get(node.a[i]) || node.a[i];
817
+ if (!source.b)
818
+ source.b = [node];
816
819
  else
817
- source.d.push(node);
820
+ source.b.push(node);
818
821
  }
819
822
  } else if (node.a && newSourcesIndex < node.a.length) {
820
823
  removeSourceObservers(node, newSourcesIndex);
@@ -823,8 +826,23 @@ function update(node) {
823
826
  newSources = prevSources;
824
827
  newSourcesIndex = prevSourcesIndex;
825
828
  newFlags = prevFlags;
826
- node.L = clock + 1;
827
- node.b = STATE_CLEAN;
829
+ node.M = clock + 1;
830
+ node.c = STATE_CLEAN;
831
+ }
832
+ }
833
+ function removeSourceObservers(node, index) {
834
+ let source;
835
+ let swap;
836
+ for (let i = index; i < node.a.length; i++) {
837
+ source = ActiveTransition && ActiveTransition.a.get(node.a[i]) || node.a[i];
838
+ if (source.b) {
839
+ if ((swap = source.b.indexOf(node)) !== -1) {
840
+ source.b[swap] = source.b[source.b.length - 1];
841
+ source.b.pop();
842
+ }
843
+ if (!source.b.length)
844
+ Unobserved.push(source);
845
+ }
828
846
  }
829
847
  }
830
848
  function isEqual(a, b) {
@@ -837,20 +855,20 @@ function untrack(fn) {
837
855
  }
838
856
  function hasUpdated(fn) {
839
857
  const current = updateCheck;
840
- updateCheck = { i: false };
858
+ updateCheck = { j: false };
841
859
  try {
842
860
  fn();
843
- return updateCheck.i;
861
+ return updateCheck.j;
844
862
  } finally {
845
863
  updateCheck = current;
846
864
  }
847
865
  }
848
866
  function pendingCheck(fn, loadingValue) {
849
867
  const current = staleCheck;
850
- staleCheck = { i: false };
868
+ staleCheck = { j: false };
851
869
  try {
852
870
  latest(fn);
853
- return staleCheck.i;
871
+ return staleCheck.j;
854
872
  } catch (err) {
855
873
  if (!(err instanceof NotReadyError))
856
874
  return false;
@@ -898,7 +916,7 @@ function runWithObserver(observer, run) {
898
916
  newFlags | LOADING_BIT | observer.h & UNINITIALIZED_BIT
899
917
  );
900
918
  } else {
901
- observer.M(error);
919
+ observer.N(error);
902
920
  }
903
921
  } finally {
904
922
  if (newSources) {
@@ -913,10 +931,10 @@ function runWithObserver(observer, run) {
913
931
  let source;
914
932
  for (let i = newSourcesIndex; i < observer.a.length; i++) {
915
933
  source = observer.a[i];
916
- if (!source.d)
917
- source.d = [observer];
934
+ if (!source.b)
935
+ source.b = [observer];
918
936
  else
919
- source.d.push(observer);
937
+ source.b.push(observer);
920
938
  }
921
939
  }
922
940
  newSources = prevSources;
@@ -930,7 +948,7 @@ function compute(owner, fn, observer) {
930
948
  currentMask = observer?.aa ?? DEFAULT_FLAGS;
931
949
  notStale = true;
932
950
  try {
933
- return fn(observer ? observer.i : void 0);
951
+ return fn.call(observer, observer ? observer.j : void 0);
934
952
  } finally {
935
953
  setOwner(prevOwner);
936
954
  currentObserver = prevObserver;
@@ -943,7 +961,7 @@ function compute(owner, fn, observer) {
943
961
  var Effect = class extends Computation {
944
962
  ba;
945
963
  Z;
946
- N;
964
+ O;
947
965
  ca = false;
948
966
  _;
949
967
  A;
@@ -954,54 +972,54 @@ var Effect = class extends Computation {
954
972
  this._ = initialValue;
955
973
  this.A = options?.render ? EFFECT_RENDER : EFFECT_USER;
956
974
  if (this.A === EFFECT_RENDER) {
957
- this.K = (p) => !ActiveTransition && clock > this.l.created && !(this.h & ERROR_BIT) ? latest(() => compute2(p)) : compute2(p);
975
+ this.L = function(p) {
976
+ return !this.g && clock > this.l.created && !(this.h & ERROR_BIT) ? latest(() => compute2(p)) : compute2(p);
977
+ };
958
978
  }
959
979
  this.H();
960
980
  !options?.defer && (this.A === EFFECT_USER ? this.l.enqueue(this.A, this.C.bind(this)) : this.C(this.A));
961
981
  }
962
982
  write(value, flags = 0) {
963
- if (this.b == STATE_DIRTY) {
983
+ if (this.c == STATE_DIRTY) {
964
984
  this.h = flags;
965
985
  if (this.A === EFFECT_RENDER) {
966
- this.l.notify(this, LOADING_BIT | ERROR_BIT, flags);
986
+ this.l.notify(this, LOADING_BIT | ERROR_BIT, this.h);
967
987
  }
968
988
  }
969
989
  if (value === UNCHANGED)
970
- return this.i;
971
- this.i = value;
990
+ return this.j;
991
+ this.j = value;
972
992
  this.ca = true;
993
+ this.K = void 0;
973
994
  return value;
974
995
  }
975
- o(state, skipQueue) {
976
- if (ActiveTransition && ActiveTransition.a.has(this)) {
977
- return ActiveTransition.a.get(this).o(state, skipQueue);
978
- }
979
- if (this.b >= state || skipQueue)
996
+ x(state, skipQueue) {
997
+ if (this.c >= state || skipQueue)
980
998
  return;
981
- if (this.b === STATE_CLEAN)
999
+ if (this.c === STATE_CLEAN)
982
1000
  this.l.enqueue(this.A, this.C.bind(this));
983
- this.b = state;
1001
+ this.c = state;
984
1002
  }
985
1003
  Y(mask, newFlags2) {
986
- if (ActiveTransition && ActiveTransition.a.has(this)) {
987
- if (this.b >= STATE_CHECK)
1004
+ if (this.g) {
1005
+ if (this.c >= STATE_DIRTY)
988
1006
  return;
989
1007
  if (mask & 3) {
990
- this.o(STATE_DIRTY);
1008
+ this.x(STATE_DIRTY);
991
1009
  return;
992
1010
  }
993
1011
  }
994
1012
  super.Y(mask, newFlags2);
995
1013
  }
996
- M(error) {
997
- this.R = error;
1014
+ N(error) {
1015
+ this.K = error;
998
1016
  this.l.notify(this, LOADING_BIT, 0);
999
1017
  this.h = ERROR_BIT;
1000
1018
  if (this.A === EFFECT_USER) {
1001
1019
  try {
1002
1020
  return this.Z ? this.Z(error, () => {
1003
- this.N?.();
1004
- this.N = void 0;
1021
+ this.O?.();
1022
+ this.O = void 0;
1005
1023
  }) : console.error(error);
1006
1024
  } catch (e) {
1007
1025
  error = e;
@@ -1011,32 +1029,32 @@ var Effect = class extends Computation {
1011
1029
  throw error;
1012
1030
  }
1013
1031
  J() {
1014
- if (this.b === STATE_DISPOSED)
1032
+ if (this.c === STATE_DISPOSED)
1015
1033
  return;
1016
1034
  this.ba = void 0;
1017
1035
  this._ = void 0;
1018
1036
  this.Z = void 0;
1019
- this.N?.();
1020
- this.N = void 0;
1037
+ this.O?.();
1038
+ this.O = void 0;
1021
1039
  super.J();
1022
1040
  }
1023
1041
  C(type) {
1024
1042
  if (type) {
1025
- const effect = this.j || this;
1026
- if (effect.ca && effect.b !== STATE_DISPOSED) {
1027
- effect.N?.();
1043
+ const effect = this.g || this;
1044
+ if (effect.ca && effect.c !== STATE_DISPOSED) {
1045
+ effect.O?.();
1028
1046
  try {
1029
- effect.N = effect.ba(effect.i, effect._);
1047
+ effect.O = effect.ba(effect.j, effect._);
1030
1048
  } catch (e) {
1031
1049
  if (!effect.l.notify(effect, ERROR_BIT, ERROR_BIT))
1032
1050
  throw e;
1033
1051
  } finally {
1034
- effect._ = effect.i;
1052
+ effect._ = effect.j;
1035
1053
  effect.ca = false;
1036
1054
  }
1037
1055
  }
1038
1056
  } else
1039
- this.b !== STATE_CLEAN && runTop(this);
1057
+ this.c !== STATE_CLEAN && runTop(this);
1040
1058
  }
1041
1059
  };
1042
1060
  var EagerComputation = class extends Computation {
@@ -1044,18 +1062,15 @@ var EagerComputation = class extends Computation {
1044
1062
  super(initialValue, compute2, options);
1045
1063
  !options?.defer && this.H();
1046
1064
  }
1047
- o(state, skipQueue) {
1048
- if (ActiveTransition && ActiveTransition.a.has(this)) {
1049
- return ActiveTransition.a.get(this).o(state, skipQueue);
1050
- }
1051
- if (this.b >= state && !this.G)
1065
+ x(state, skipQueue) {
1066
+ if (this.c >= state && !this.G)
1052
1067
  return;
1053
- if (!skipQueue && (this.b === STATE_CLEAN || this.b === STATE_CHECK && this.G))
1068
+ if (!skipQueue && (this.c === STATE_CLEAN || this.c === STATE_CHECK && this.G))
1054
1069
  this.l.enqueue(EFFECT_PURE, this.C.bind(this));
1055
- super.o(state, skipQueue);
1070
+ super.x(state, skipQueue);
1056
1071
  }
1057
1072
  C() {
1058
- this.b !== STATE_CLEAN && runTop(this);
1073
+ this.c !== STATE_CLEAN && runTop(this);
1059
1074
  }
1060
1075
  };
1061
1076
  var FirewallComputation = class extends Computation {
@@ -1063,30 +1078,27 @@ var FirewallComputation = class extends Computation {
1063
1078
  constructor(compute2) {
1064
1079
  super(void 0, compute2);
1065
1080
  }
1066
- o(state, skipQueue) {
1067
- if (ActiveTransition && ActiveTransition.a.has(this)) {
1068
- return ActiveTransition.a.get(this).o(state, skipQueue);
1069
- }
1070
- if (this.b >= state && !this.G)
1081
+ x(state, skipQueue) {
1082
+ if (this.c >= state && !this.G)
1071
1083
  return;
1072
- if (!skipQueue && (this.b === STATE_CLEAN || this.b === STATE_CHECK && this.G))
1084
+ if (!skipQueue && (this.c === STATE_CLEAN || this.c === STATE_CHECK && this.G))
1073
1085
  this.l.enqueue(EFFECT_PURE, this.C.bind(this));
1074
- super.o(state, true);
1086
+ super.x(state, true);
1075
1087
  this.G = !!skipQueue;
1076
1088
  }
1077
1089
  C() {
1078
- this.b !== STATE_CLEAN && runTop(this);
1090
+ this.c !== STATE_CLEAN && runTop(this);
1079
1091
  }
1080
1092
  };
1081
1093
  function runTop(node) {
1082
1094
  const ancestors = [];
1083
1095
  for (let current = node; current !== null; current = current.m) {
1084
- if (current.b !== STATE_CLEAN) {
1096
+ if (current.c !== STATE_CLEAN) {
1085
1097
  ancestors.push(current);
1086
1098
  }
1087
1099
  }
1088
1100
  for (let i = ancestors.length - 1; i >= 0; i--) {
1089
- if (ancestors[i].b !== STATE_DISPOSED)
1101
+ if (ancestors[i].c !== STATE_DISPOSED)
1090
1102
  ancestors[i].H();
1091
1103
  }
1092
1104
  }
@@ -1221,7 +1233,7 @@ var storeTraps = {
1221
1233
  return desc.get.call(receiver);
1222
1234
  }
1223
1235
  if (Writing?.has(receiver)) {
1224
- let value2 = tracked && (overridden || !proxySource) ? tracked.i : storeValue[property];
1236
+ let value2 = tracked && (overridden || !proxySource) ? tracked.j : storeValue[property];
1225
1237
  value2 === $DELETED && (value2 = void 0);
1226
1238
  if (!isWrappable(value2))
1227
1239
  return value2;
@@ -1512,6 +1524,8 @@ function applyState(next, state, keyFn, all) {
1512
1524
  }
1513
1525
  function reconcile(value, key, all = false) {
1514
1526
  return (state) => {
1527
+ if (state == null)
1528
+ throw new Error("Cannot reconcile null or undefined state");
1515
1529
  const keyFn = typeof key === "string" ? (item) => item[key] : key;
1516
1530
  const eq = keyFn(state);
1517
1531
  if (eq !== void 0 && keyFn(value) !== keyFn(state))
@@ -1751,12 +1765,12 @@ function createMemo(compute2, value, options) {
1751
1765
  let resolvedValue;
1752
1766
  return () => {
1753
1767
  if (node) {
1754
- if (node.b === STATE_DISPOSED) {
1768
+ if (node.c === STATE_DISPOSED) {
1755
1769
  node = void 0;
1756
1770
  return resolvedValue;
1757
1771
  }
1758
1772
  resolvedValue = node.wait();
1759
- if (!node.a?.length && node.s?.m !== node) {
1773
+ if (!node.a?.length && node.r?.m !== node && !(node.h & UNINITIALIZED_BIT)) {
1760
1774
  node.dispose();
1761
1775
  node = void 0;
1762
1776
  }
@@ -1792,8 +1806,8 @@ function createAsync(compute2, value, options) {
1792
1806
  if (abort)
1793
1807
  return;
1794
1808
  if (transition2)
1795
- return transition2.runTransition(() => node.M(error), true);
1796
- node.M(error);
1809
+ return transition2.runTransition(() => node.N(error), true);
1810
+ node.N(error);
1797
1811
  }
1798
1812
  );
1799
1813
  } else {
@@ -1817,9 +1831,13 @@ function createAsync(compute2, value, options) {
1817
1831
  );
1818
1832
  const read = node.wait.bind(node);
1819
1833
  read.refresh = () => {
1820
- node.b = STATE_DIRTY;
1834
+ let n = node;
1835
+ if (ActiveTransition && !node.g) {
1836
+ n = cloneGraph(node);
1837
+ }
1838
+ n.c = STATE_DIRTY;
1821
1839
  refreshing = true;
1822
- node.H();
1840
+ n.H();
1823
1841
  };
1824
1842
  return read;
1825
1843
  }
@@ -1900,7 +1918,7 @@ function createOptimistic(initial, compute2, key) {
1900
1918
  (s) => {
1901
1919
  const value = initial();
1902
1920
  if (!ActiveTransition)
1903
- s.value = value;
1921
+ reconcile({ value }, key)(s);
1904
1922
  },
1905
1923
  { value: void 0 }
1906
1924
  );
@@ -1908,9 +1926,9 @@ function createOptimistic(initial, compute2, key) {
1908
1926
  [store, setStore] = createStore({ value: initial });
1909
1927
  const reset = () => setStore(
1910
1928
  (s) => reconcile(
1911
- typeof initial === "function" ? initial() : initial,
1929
+ { value: typeof initial === "function" ? initial() : initial },
1912
1930
  key
1913
- )(s.value)
1931
+ )(s)
1914
1932
  );
1915
1933
  let lastChange = void 0;
1916
1934
  function write(v) {
@@ -1932,15 +1950,15 @@ function mapArray(list, map, options) {
1932
1950
  const keyFn = typeof options?.keyed === "function" ? options.keyed : void 0;
1933
1951
  return updateKeyedMap.bind({
1934
1952
  S: new Owner(),
1935
- p: 0,
1953
+ o: 0,
1936
1954
  ha: list,
1937
1955
  D: [],
1938
- O: map,
1939
- g: [],
1940
- c: [],
1941
- P: keyFn,
1942
- q: keyFn || options?.keyed === false ? [] : void 0,
1943
- r: map.length > 1 ? [] : void 0,
1956
+ P: map,
1957
+ i: [],
1958
+ d: [],
1959
+ Q: keyFn,
1960
+ p: keyFn || options?.keyed === false ? [] : void 0,
1961
+ q: map.length > 1 ? [] : void 0,
1944
1962
  T: options?.fallback
1945
1963
  });
1946
1964
  }
@@ -1949,113 +1967,113 @@ function updateKeyedMap() {
1949
1967
  const newItems = this.ha() || [], newLen = newItems.length;
1950
1968
  newItems[$TRACK];
1951
1969
  runWithOwner(this.S, () => {
1952
- let i, j, mapper = this.q ? () => {
1953
- this.q[j] = new Computation(newItems[j], null, pureOptions);
1954
- this.r && (this.r[j] = new Computation(j, null, pureOptions));
1955
- return this.O(
1956
- Computation.prototype.read.bind(this.q[j]),
1957
- this.r ? Computation.prototype.read.bind(this.r[j]) : void 0
1970
+ let i, j, mapper = this.p ? () => {
1971
+ this.p[j] = new Computation(newItems[j], null, pureOptions);
1972
+ this.q && (this.q[j] = new Computation(j, null, pureOptions));
1973
+ return this.P(
1974
+ Computation.prototype.read.bind(this.p[j]),
1975
+ this.q ? Computation.prototype.read.bind(this.q[j]) : void 0
1958
1976
  );
1959
- } : this.r ? () => {
1977
+ } : this.q ? () => {
1960
1978
  const item = newItems[j];
1961
- this.r[j] = new Computation(j, null, pureOptions);
1962
- return this.O(() => item, Computation.prototype.read.bind(this.r[j]));
1979
+ this.q[j] = new Computation(j, null, pureOptions);
1980
+ return this.P(() => item, Computation.prototype.read.bind(this.q[j]));
1963
1981
  } : () => {
1964
1982
  const item = newItems[j];
1965
- return this.O(() => item);
1983
+ return this.P(() => item);
1966
1984
  };
1967
1985
  if (newLen === 0) {
1968
- if (this.p !== 0) {
1986
+ if (this.o !== 0) {
1969
1987
  this.S.dispose(false);
1970
- this.c = [];
1988
+ this.d = [];
1971
1989
  this.D = [];
1972
- this.g = [];
1973
- this.p = 0;
1990
+ this.i = [];
1991
+ this.o = 0;
1992
+ this.p && (this.p = []);
1974
1993
  this.q && (this.q = []);
1975
- this.r && (this.r = []);
1976
1994
  }
1977
- if (this.T && !this.g[0]) {
1978
- this.g[0] = compute(
1979
- this.c[0] = new Owner(),
1995
+ if (this.T && !this.i[0]) {
1996
+ this.i[0] = compute(
1997
+ this.d[0] = new Owner(),
1980
1998
  this.T,
1981
1999
  null
1982
2000
  );
1983
2001
  }
1984
- } else if (this.p === 0) {
1985
- if (this.c[0])
1986
- this.c[0].dispose();
1987
- this.g = new Array(newLen);
2002
+ } else if (this.o === 0) {
2003
+ if (this.d[0])
2004
+ this.d[0].dispose();
2005
+ this.i = new Array(newLen);
1988
2006
  for (j = 0; j < newLen; j++) {
1989
2007
  this.D[j] = newItems[j];
1990
- this.g[j] = compute(this.c[j] = new Owner(), mapper, null);
2008
+ this.i[j] = compute(this.d[j] = new Owner(), mapper, null);
1991
2009
  }
1992
- this.p = newLen;
2010
+ this.o = newLen;
1993
2011
  } else {
1994
- let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.q ? new Array(newLen) : void 0, tempIndexes = this.r ? new Array(newLen) : void 0;
1995
- for (start = 0, end = Math.min(this.p, newLen); start < end && (this.D[start] === newItems[start] || this.q && compare(this.P, this.D[start], newItems[start])); start++) {
1996
- if (this.q)
1997
- this.q[start].write(newItems[start]);
2012
+ let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.p ? new Array(newLen) : void 0, tempIndexes = this.q ? new Array(newLen) : void 0;
2013
+ for (start = 0, end = Math.min(this.o, newLen); start < end && (this.D[start] === newItems[start] || this.p && compare(this.Q, this.D[start], newItems[start])); start++) {
2014
+ if (this.p)
2015
+ this.p[start].write(newItems[start]);
1998
2016
  }
1999
- for (end = this.p - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.D[end] === newItems[newEnd] || this.q && compare(this.P, this.D[end], newItems[newEnd])); end--, newEnd--) {
2000
- temp[newEnd] = this.g[end];
2001
- tempNodes[newEnd] = this.c[end];
2002
- tempRows && (tempRows[newEnd] = this.q[end]);
2003
- tempIndexes && (tempIndexes[newEnd] = this.r[end]);
2017
+ for (end = this.o - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.D[end] === newItems[newEnd] || this.p && compare(this.Q, this.D[end], newItems[newEnd])); end--, newEnd--) {
2018
+ temp[newEnd] = this.i[end];
2019
+ tempNodes[newEnd] = this.d[end];
2020
+ tempRows && (tempRows[newEnd] = this.p[end]);
2021
+ tempIndexes && (tempIndexes[newEnd] = this.q[end]);
2004
2022
  }
2005
2023
  newIndices = /* @__PURE__ */ new Map();
2006
2024
  newIndicesNext = new Array(newEnd + 1);
2007
2025
  for (j = newEnd; j >= start; j--) {
2008
2026
  item = newItems[j];
2009
- key = this.P ? this.P(item) : item;
2027
+ key = this.Q ? this.Q(item) : item;
2010
2028
  i = newIndices.get(key);
2011
2029
  newIndicesNext[j] = i === void 0 ? -1 : i;
2012
2030
  newIndices.set(key, j);
2013
2031
  }
2014
2032
  for (i = start; i <= end; i++) {
2015
2033
  item = this.D[i];
2016
- key = this.P ? this.P(item) : item;
2034
+ key = this.Q ? this.Q(item) : item;
2017
2035
  j = newIndices.get(key);
2018
2036
  if (j !== void 0 && j !== -1) {
2019
- temp[j] = this.g[i];
2020
- tempNodes[j] = this.c[i];
2021
- tempRows && (tempRows[j] = this.q[i]);
2022
- tempIndexes && (tempIndexes[j] = this.r[i]);
2037
+ temp[j] = this.i[i];
2038
+ tempNodes[j] = this.d[i];
2039
+ tempRows && (tempRows[j] = this.p[i]);
2040
+ tempIndexes && (tempIndexes[j] = this.q[i]);
2023
2041
  j = newIndicesNext[j];
2024
2042
  newIndices.set(key, j);
2025
2043
  } else
2026
- this.c[i].dispose();
2044
+ this.d[i].dispose();
2027
2045
  }
2028
2046
  for (j = start; j < newLen; j++) {
2029
2047
  if (j in temp) {
2030
- this.g[j] = temp[j];
2031
- this.c[j] = tempNodes[j];
2048
+ this.i[j] = temp[j];
2049
+ this.d[j] = tempNodes[j];
2032
2050
  if (tempRows) {
2033
- this.q[j] = tempRows[j];
2034
- this.q[j].write(newItems[j]);
2051
+ this.p[j] = tempRows[j];
2052
+ this.p[j].write(newItems[j]);
2035
2053
  }
2036
2054
  if (tempIndexes) {
2037
- this.r[j] = tempIndexes[j];
2038
- this.r[j].write(j);
2055
+ this.q[j] = tempIndexes[j];
2056
+ this.q[j].write(j);
2039
2057
  }
2040
2058
  } else {
2041
- this.g[j] = compute(this.c[j] = new Owner(), mapper, null);
2059
+ this.i[j] = compute(this.d[j] = new Owner(), mapper, null);
2042
2060
  }
2043
2061
  }
2044
- this.g = this.g.slice(0, this.p = newLen);
2062
+ this.i = this.i.slice(0, this.o = newLen);
2045
2063
  this.D = newItems.slice(0);
2046
2064
  }
2047
2065
  });
2048
- return this.g;
2066
+ return this.i;
2049
2067
  }
2050
2068
  function repeat(count, map, options) {
2051
2069
  return updateRepeat.bind({
2052
2070
  S: new Owner(),
2053
- p: 0,
2071
+ o: 0,
2054
2072
  y: 0,
2055
2073
  ia: count,
2056
- O: map,
2057
- c: [],
2058
- g: [],
2074
+ P: map,
2075
+ d: [],
2076
+ i: [],
2059
2077
  ja: options?.from,
2060
2078
  T: options?.fallback
2061
2079
  });
@@ -2065,15 +2083,15 @@ function updateRepeat() {
2065
2083
  const from = this.ja?.() || 0;
2066
2084
  runWithOwner(this.S, () => {
2067
2085
  if (newLen === 0) {
2068
- if (this.p !== 0) {
2086
+ if (this.o !== 0) {
2069
2087
  this.S.dispose(false);
2070
- this.c = [];
2071
- this.g = [];
2072
- this.p = 0;
2088
+ this.d = [];
2089
+ this.i = [];
2090
+ this.o = 0;
2073
2091
  }
2074
- if (this.T && !this.g[0]) {
2075
- this.g[0] = compute(
2076
- this.c[0] = new Owner(),
2092
+ if (this.T && !this.i[0]) {
2093
+ this.i[0] = compute(
2094
+ this.d[0] = new Owner(),
2077
2095
  this.T,
2078
2096
  null
2079
2097
  );
@@ -2081,46 +2099,46 @@ function updateRepeat() {
2081
2099
  return;
2082
2100
  }
2083
2101
  const to = from + newLen;
2084
- const prevTo = this.y + this.p;
2085
- if (this.p === 0 && this.c[0])
2086
- this.c[0].dispose();
2102
+ const prevTo = this.y + this.o;
2103
+ if (this.o === 0 && this.d[0])
2104
+ this.d[0].dispose();
2087
2105
  for (let i = to; i < prevTo; i++)
2088
- this.c[i - this.y].dispose();
2106
+ this.d[i - this.y].dispose();
2089
2107
  if (this.y < from) {
2090
2108
  let i = this.y;
2091
- while (i < from && i < this.p)
2092
- this.c[i++].dispose();
2093
- this.c.splice(0, from - this.y);
2094
- this.g.splice(0, from - this.y);
2109
+ while (i < from && i < this.o)
2110
+ this.d[i++].dispose();
2111
+ this.d.splice(0, from - this.y);
2112
+ this.i.splice(0, from - this.y);
2095
2113
  } else if (this.y > from) {
2096
2114
  let i = prevTo - this.y - 1;
2097
2115
  let difference = this.y - from;
2098
- this.c.length = this.g.length = newLen;
2116
+ this.d.length = this.i.length = newLen;
2099
2117
  while (i >= difference) {
2100
- this.c[i] = this.c[i - difference];
2101
- this.g[i] = this.g[i - difference];
2118
+ this.d[i] = this.d[i - difference];
2119
+ this.i[i] = this.i[i - difference];
2102
2120
  i--;
2103
2121
  }
2104
2122
  for (let i2 = 0; i2 < difference; i2++) {
2105
- this.g[i2] = compute(
2106
- this.c[i2] = new Owner(),
2107
- () => this.O(i2 + from),
2123
+ this.i[i2] = compute(
2124
+ this.d[i2] = new Owner(),
2125
+ () => this.P(i2 + from),
2108
2126
  null
2109
2127
  );
2110
2128
  }
2111
2129
  }
2112
2130
  for (let i = prevTo; i < to; i++) {
2113
- this.g[i - from] = compute(
2114
- this.c[i - from] = new Owner(),
2115
- () => this.O(i),
2131
+ this.i[i - from] = compute(
2132
+ this.d[i - from] = new Owner(),
2133
+ () => this.P(i),
2116
2134
  null
2117
2135
  );
2118
2136
  }
2119
- this.g = this.g.slice(0, newLen);
2137
+ this.i = this.i.slice(0, newLen);
2120
2138
  this.y = from;
2121
- this.p = newLen;
2139
+ this.o = newLen;
2122
2140
  });
2123
- return this.g;
2141
+ return this.i;
2124
2142
  }
2125
2143
  function compare(key, a, b) {
2126
2144
  return key ? key(a) === key(b) : true;
@@ -2139,7 +2157,7 @@ var BoundaryComputation = class extends EagerComputation {
2139
2157
  flags &= ~LOADING_BIT;
2140
2158
  }
2141
2159
  this.l.notify(this, this.U, flags);
2142
- return this.i;
2160
+ return this.j;
2143
2161
  }
2144
2162
  };
2145
2163
  function createBoundChildren(owner, fn, queue, mask) {
@@ -2156,27 +2174,27 @@ function createBoundChildren(owner, fn, queue, mask) {
2156
2174
  );
2157
2175
  }
2158
2176
  var ConditionalQueue = class extends Queue {
2159
- u;
2177
+ t;
2160
2178
  V = /* @__PURE__ */ new Set();
2161
- t = /* @__PURE__ */ new Set();
2179
+ s = /* @__PURE__ */ new Set();
2162
2180
  constructor(disabled) {
2163
2181
  super();
2164
- this.u = disabled;
2182
+ this.t = disabled;
2165
2183
  }
2166
2184
  run(type) {
2167
- if (!type || this.u.read())
2185
+ if (!type || this.t.read())
2168
2186
  return;
2169
2187
  return super.run(type);
2170
2188
  }
2171
2189
  notify(node, type, flags) {
2172
- if (ActiveTransition && ActiveTransition.w.has(this))
2173
- return ActiveTransition.w.get(this).notify(node, type, flags);
2174
- if (this.u.read()) {
2190
+ if (ActiveTransition && ActiveTransition.u.has(this))
2191
+ return ActiveTransition.u.get(this).notify(node, type, flags);
2192
+ if (this.t.read()) {
2175
2193
  if (type & LOADING_BIT) {
2176
2194
  if (flags & LOADING_BIT) {
2177
- this.t.add(node);
2195
+ this.s.add(node);
2178
2196
  type &= ~LOADING_BIT;
2179
- } else if (this.t.delete(node))
2197
+ } else if (this.s.delete(node))
2180
2198
  type &= ~LOADING_BIT;
2181
2199
  }
2182
2200
  if (type & ERROR_BIT) {
@@ -2190,43 +2208,43 @@ var ConditionalQueue = class extends Queue {
2190
2208
  return type ? super.notify(node, type, flags) : true;
2191
2209
  }
2192
2210
  merge(queue) {
2193
- queue.t.forEach((n) => this.notify(n, LOADING_BIT, LOADING_BIT));
2211
+ queue.s.forEach((n) => this.notify(n, LOADING_BIT, LOADING_BIT));
2194
2212
  queue.V.forEach((n) => this.notify(n, ERROR_BIT, ERROR_BIT));
2195
2213
  super.merge(queue);
2196
2214
  }
2197
2215
  };
2198
2216
  var CollectionQueue = class extends Queue {
2199
2217
  F;
2200
- c = /* @__PURE__ */ new Set();
2201
- u = new Computation(false, null, { pureWrite: true });
2218
+ d = /* @__PURE__ */ new Set();
2219
+ t = new Computation(false, null, { pureWrite: true });
2202
2220
  constructor(type) {
2203
2221
  super();
2204
2222
  this.F = type;
2205
2223
  }
2206
2224
  run(type) {
2207
- if (!type || this.u.read())
2225
+ if (!type || this.t.read())
2208
2226
  return;
2209
2227
  return super.run(type);
2210
2228
  }
2211
2229
  notify(node, type, flags) {
2212
- if (ActiveTransition && ActiveTransition.w.has(this))
2213
- return ActiveTransition.w.get(this).notify(node, type, flags);
2230
+ if (ActiveTransition && ActiveTransition.u.has(this))
2231
+ return ActiveTransition.u.get(this).notify(node, type, flags);
2214
2232
  if (!(type & this.F))
2215
2233
  return super.notify(node, type, flags);
2216
2234
  if (flags & this.F) {
2217
- this.c.add(node);
2218
- if (this.c.size === 1)
2219
- this.u.write(true);
2235
+ this.d.add(node);
2236
+ if (this.d.size === 1)
2237
+ this.t.write(true);
2220
2238
  } else {
2221
- this.c.delete(node);
2222
- if (this.c.size === 0)
2223
- this.u.write(false);
2239
+ this.d.delete(node);
2240
+ if (this.d.size === 0)
2241
+ this.t.write(false);
2224
2242
  }
2225
2243
  type &= ~this.F;
2226
2244
  return type ? super.notify(node, type, flags) : true;
2227
2245
  }
2228
2246
  merge(queue) {
2229
- queue.c.forEach((n) => this.notify(n, this.F, this.F));
2247
+ queue.d.forEach((n) => this.notify(n, this.F, this.F));
2230
2248
  super.merge(queue);
2231
2249
  }
2232
2250
  };
@@ -2237,25 +2255,25 @@ function createBoundary(fn, condition) {
2237
2255
  );
2238
2256
  const tree = createBoundChildren(owner, fn, queue, 0);
2239
2257
  new EagerComputation(void 0, () => {
2240
- const disabled = queue.u.read();
2258
+ const disabled = queue.t.read();
2241
2259
  tree.U = disabled ? ERROR_BIT | LOADING_BIT : 0;
2242
2260
  if (!disabled) {
2243
- queue.t.forEach((node) => queue.notify(node, LOADING_BIT, LOADING_BIT));
2261
+ queue.s.forEach((node) => queue.notify(node, LOADING_BIT, LOADING_BIT));
2244
2262
  queue.V.forEach((node) => queue.notify(node, ERROR_BIT, ERROR_BIT));
2245
- queue.t.clear();
2263
+ queue.s.clear();
2246
2264
  queue.V.clear();
2247
2265
  }
2248
2266
  });
2249
- return () => queue.u.read() ? void 0 : tree.read();
2267
+ return () => queue.t.read() ? void 0 : tree.read();
2250
2268
  }
2251
2269
  function createCollectionBoundary(type, fn, fallback) {
2252
2270
  const owner = new Owner();
2253
2271
  const queue = new CollectionQueue(type);
2254
2272
  const tree = createBoundChildren(owner, fn, queue, type);
2255
2273
  const decision = new Computation(void 0, () => {
2256
- if (!queue.u.read()) {
2274
+ if (!queue.t.read()) {
2257
2275
  const resolved = tree.read();
2258
- if (!queue.u.read())
2276
+ if (!queue.t.read())
2259
2277
  return resolved;
2260
2278
  }
2261
2279
  return fallback(queue);
@@ -2267,12 +2285,14 @@ function createSuspense(fn, fallback) {
2267
2285
  }
2268
2286
  function createErrorBoundary(fn, fallback) {
2269
2287
  return createCollectionBoundary(ERROR_BIT, fn, (queue) => {
2270
- let node = queue.c.values().next().value;
2288
+ let node = queue.d.values().next().value;
2271
2289
  ActiveTransition && ActiveTransition.a.has(node) && (node = ActiveTransition.a.get(node));
2272
- return fallback(node.R, () => {
2290
+ return fallback(node.K, () => {
2273
2291
  incrementClock();
2274
- for (let node2 of queue.c) {
2275
- node2.b = STATE_DIRTY;
2292
+ for (let node2 of queue.d) {
2293
+ if (ActiveTransition && !node2.g)
2294
+ node2 = cloneGraph(node2);
2295
+ node2.c = STATE_DIRTY;
2276
2296
  node2.l?.enqueue(node2.A, node2.C.bind(node2));
2277
2297
  }
2278
2298
  });