@solidjs/signals 0.6.4 → 0.7.0

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
@@ -45,13 +45,13 @@ function schedule() {
45
45
  if (scheduled)
46
46
  return;
47
47
  scheduled = true;
48
- if (!globalQueue.y)
48
+ if (!globalQueue.B)
49
49
  queueMicrotask(flush);
50
50
  }
51
51
  function notifyUnobserved() {
52
52
  for (let i = 0; i < Unobserved.length; i++) {
53
53
  const source = Unobserved[i];
54
- if (!source.b || !source.b.length)
54
+ if (!source.c || !source.c.length)
55
55
  Unobserved[i].ea?.();
56
56
  }
57
57
  Unobserved = [];
@@ -59,7 +59,7 @@ function notifyUnobserved() {
59
59
  var pureQueue = [];
60
60
  var Queue = class {
61
61
  k = null;
62
- y = false;
62
+ B = false;
63
63
  g = [[], []];
64
64
  f = [];
65
65
  created = clock;
@@ -84,9 +84,9 @@ var Queue = class {
84
84
  }
85
85
  }
86
86
  flush() {
87
- if (this.y)
87
+ if (this.B)
88
88
  return;
89
- this.y = true;
89
+ this.B = true;
90
90
  try {
91
91
  this.run(EFFECT_PURE);
92
92
  incrementClock();
@@ -94,7 +94,7 @@ var Queue = class {
94
94
  this.run(EFFECT_RENDER);
95
95
  this.run(EFFECT_USER);
96
96
  } finally {
97
- this.y = false;
97
+ this.B = false;
98
98
  Unobserved.length && notifyUnobserved();
99
99
  }
100
100
  }
@@ -122,7 +122,7 @@ var Queue = class {
122
122
  this.g[0].push.apply(this.g[0], queue.g[0]);
123
123
  this.g[1].push.apply(this.g[1], queue.g[1]);
124
124
  for (let i = 0; i < queue.f.length; i++) {
125
- const og = this.f.find((c) => c.e === queue.f[i].e);
125
+ const og = this.f.find((c) => c.d === queue.f[i].d);
126
126
  if (og)
127
127
  og.merge(queue.f[i]);
128
128
  else
@@ -141,12 +141,12 @@ function removeSourceObservers(node, index) {
141
141
  let swap;
142
142
  for (let i = index; i < node.a.length; i++) {
143
143
  source = getTransitionSource(node.a[i]);
144
- if (source.b) {
145
- if ((swap = source.b.indexOf(node)) !== -1) {
146
- source.b[swap] = source.b[source.b.length - 1];
147
- source.b.pop();
144
+ if (source.c) {
145
+ if ((swap = source.c.indexOf(node)) !== -1) {
146
+ source.c[swap] = source.c[source.c.length - 1];
147
+ source.c.pop();
148
148
  }
149
- if (!source.b.length)
149
+ if (!source.c.length)
150
150
  Unobserved.push(source);
151
151
  }
152
152
  }
@@ -157,18 +157,18 @@ function runQueue(queue, type) {
157
157
  }
158
158
  var Transition = class _Transition {
159
159
  a = /* @__PURE__ */ new Map();
160
- r = /* @__PURE__ */ new Set();
160
+ s = /* @__PURE__ */ new Set();
161
161
  H = /* @__PURE__ */ new Set();
162
162
  I = /* @__PURE__ */ new Set();
163
- B = false;
163
+ D = false;
164
164
  g = [[], []];
165
165
  G = /* @__PURE__ */ new Map();
166
166
  J = [];
167
167
  f = [];
168
168
  k = null;
169
- y = false;
169
+ B = false;
170
170
  Y = false;
171
- e = globalQueue;
171
+ d = globalQueue;
172
172
  created = clock;
173
173
  constructor() {
174
174
  this.G.set(globalQueue, this);
@@ -197,9 +197,9 @@ var Transition = class _Transition {
197
197
  }
198
198
  }
199
199
  flush() {
200
- if (this.y)
200
+ if (this.B)
201
201
  return;
202
- this.y = true;
202
+ this.B = true;
203
203
  let currentTransition = ActiveTransition;
204
204
  ActiveTransition = this;
205
205
  try {
@@ -209,7 +209,7 @@ var Transition = class _Transition {
209
209
  ActiveTransition = currentTransition;
210
210
  finishTransition(this);
211
211
  } finally {
212
- this.y = false;
212
+ this.B = false;
213
213
  ActiveTransition = currentTransition;
214
214
  }
215
215
  }
@@ -226,9 +226,9 @@ var Transition = class _Transition {
226
226
  if (!(type & LOADING_BIT))
227
227
  return false;
228
228
  if (flags & LOADING_BIT) {
229
- this.r.add(node);
229
+ this.s.add(node);
230
230
  } else {
231
- this.r.delete(node);
231
+ this.s.delete(node);
232
232
  }
233
233
  return true;
234
234
  }
@@ -237,7 +237,7 @@ var Transition = class _Transition {
237
237
  this.g[1].push.apply(this.g[1], queue.g[1]);
238
238
  this.J.push.apply(this.J, queue.J);
239
239
  for (let i = 0; i < queue.f.length; i++) {
240
- const og = this.f.find((c) => c.e === queue.f[i].e);
240
+ const og = this.f.find((c) => c.d === queue.f[i].d);
241
241
  if (og)
242
242
  og.merge(queue.f[i]);
243
243
  else
@@ -248,13 +248,13 @@ var Transition = class _Transition {
248
248
  if (this.Y)
249
249
  return;
250
250
  this.Y = true;
251
- if (!this.y)
251
+ if (!this.B)
252
252
  queueMicrotask(() => this.flush());
253
253
  }
254
254
  runTransition(fn, force = false) {
255
- if (this.B) {
256
- if (this.B instanceof _Transition)
257
- return this.B.runTransition(fn, force);
255
+ if (this.D) {
256
+ if (this.D instanceof _Transition)
257
+ return this.D.runTransition(fn, force);
258
258
  if (!force)
259
259
  throw new Error("Transition already completed");
260
260
  fn();
@@ -325,29 +325,29 @@ function cloneGraph(node, optimistic) {
325
325
  Object.assign(clone, node, {
326
326
  n: null,
327
327
  m: null,
328
- b: null,
328
+ c: null,
329
329
  a: node.a ? [...node.a] : null,
330
- e: node,
330
+ d: node,
331
331
  I: !!optimistic
332
332
  });
333
- delete clone.S;
333
+ delete clone.T;
334
334
  ActiveTransition.a.set(node, clone);
335
335
  node.j = ActiveTransition;
336
336
  if (!optimistic && node.a) {
337
337
  for (let i = 0; i < node.a.length; i++)
338
- node.a[i].b.push(clone);
338
+ node.a[i].c.push(clone);
339
339
  }
340
- if (node.b) {
341
- clone.b = [];
342
- for (let i = 0, length = node.b.length; i < length; i++) {
343
- !node.b[i].e && clone.b.push(cloneGraph(node.b[i], optimistic));
340
+ if (node.c) {
341
+ clone.c = [];
342
+ for (let i = 0, length = node.c.length; i < length; i++) {
343
+ !node.c[i].d && clone.c.push(cloneGraph(node.c[i], optimistic));
344
344
  }
345
345
  }
346
346
  return clone;
347
347
  }
348
348
  function latestTransition(t) {
349
- while (t.B instanceof Transition)
350
- t = t.B;
349
+ while (t.D instanceof Transition)
350
+ t = t.D;
351
351
  return t;
352
352
  }
353
353
  function replaceSourceObservers(node, transition2) {
@@ -357,16 +357,16 @@ function replaceSourceObservers(node, transition2) {
357
357
  for (let i = 0; i < node.a.length; i++) {
358
358
  transitionSource = transition2.a.get(node.a[i]);
359
359
  source = transitionSource || node.a[i];
360
- if (source.b && (swap = source.b.indexOf(node)) !== -1) {
361
- source.b[swap] = transitionSource ? node.e : source.b[source.b.length - 1];
362
- !transitionSource && source.b.pop();
360
+ if (source.c && (swap = source.c.indexOf(node)) !== -1) {
361
+ source.c[swap] = transitionSource ? node.d : source.c[source.c.length - 1];
362
+ !transitionSource && source.c.pop();
363
363
  }
364
364
  }
365
365
  }
366
366
  function cloneQueue(queue, parent, transition2) {
367
367
  const clone = Object.create(Object.getPrototypeOf(queue));
368
368
  Object.assign(clone, queue, {
369
- e: queue,
369
+ d: queue,
370
370
  k: parent,
371
371
  f: [],
372
372
  enqueue(type, fn) {
@@ -374,7 +374,7 @@ function cloneQueue(queue, parent, transition2) {
374
374
  transition2.enqueue(type, fn);
375
375
  },
376
376
  notify(node, type, flags) {
377
- node = node.e || node;
377
+ node = node.d || node;
378
378
  if (!clone.K || type & LOADING_BIT) {
379
379
  type &= ~LOADING_BIT;
380
380
  transition2 = latestTransition(transition2);
@@ -393,7 +393,7 @@ function cloneQueue(queue, parent, transition2) {
393
393
  }
394
394
  function resolveQueues(children) {
395
395
  for (const child of children) {
396
- const og = child.e;
396
+ const og = child.d;
397
397
  if (og) {
398
398
  const clonedChildren = child.f;
399
399
  delete child.enqueue;
@@ -401,10 +401,10 @@ function resolveQueues(children) {
401
401
  delete child.k;
402
402
  delete child.f;
403
403
  Object.assign(og, child);
404
- delete og.e;
404
+ delete og.d;
405
405
  resolveQueues(clonedChildren);
406
- } else if (child.k.e) {
407
- child.k.e.addChild(child);
406
+ } else if (child.k.d) {
407
+ child.k.d.addChild(child);
408
408
  }
409
409
  }
410
410
  }
@@ -418,16 +418,16 @@ function mergeTransitions(t1, t2) {
418
418
  t1.I.add(c);
419
419
  });
420
420
  t2.H.forEach((p) => t1.H.add(p));
421
- t2.r.forEach((n) => t1.r.add(n));
421
+ t2.s.forEach((n) => t1.s.add(n));
422
422
  t1.merge(t2);
423
- t2.B = t1;
423
+ t2.D = t1;
424
424
  }
425
425
  function getTransitionSource(input) {
426
426
  return ActiveTransition && ActiveTransition.a.get(input) || input;
427
427
  }
428
428
  function getQueue(node) {
429
- const transition2 = ActiveTransition || node.e?.j;
430
- return transition2 && transition2.G.get(node.z) || node.z;
429
+ const transition2 = ActiveTransition || node.d?.j;
430
+ return transition2 && transition2.G.get(node.C) || node.C;
431
431
  }
432
432
  function initialDispose(node) {
433
433
  let current = node.m;
@@ -440,7 +440,7 @@ function initialDispose(node) {
440
440
  }
441
441
  }
442
442
  function finishTransition(transition2) {
443
- if (transition2.B || transition2.Y || transition2.H.size || transition2.r.size)
443
+ if (transition2.D || transition2.Y || transition2.H.size || transition2.s.size)
444
444
  return;
445
445
  globalQueue.g[0].push.apply(globalQueue.g[0], transition2.g[0]);
446
446
  globalQueue.g[1].push.apply(globalQueue.g[1], transition2.g[1]);
@@ -458,8 +458,8 @@ function finishTransition(transition2) {
458
458
  delete source.j;
459
459
  continue;
460
460
  }
461
- if (clone.Z || clone.c === STATE_DISPOSED) {
462
- source.dispose(clone.c === STATE_DISPOSED);
461
+ if (clone.Z || clone.b === STATE_DISPOSED) {
462
+ source.dispose(clone.b === STATE_DISPOSED);
463
463
  source.emptyDisposal();
464
464
  delete clone.Z;
465
465
  } else {
@@ -467,17 +467,17 @@ function finishTransition(transition2) {
467
467
  delete clone.n;
468
468
  }
469
469
  Object.assign(source, clone);
470
- delete source.e;
470
+ delete source.d;
471
471
  let current = clone.m;
472
- if (current?.t === clone)
473
- current.t = source;
472
+ if (current?.y === clone)
473
+ current.y = source;
474
474
  while (current?.k === clone) {
475
475
  current.k = source;
476
476
  current = current.m;
477
477
  }
478
478
  delete source.j;
479
479
  }
480
- transition2.B = true;
480
+ transition2.D = true;
481
481
  for (const reset of transition2.I) {
482
482
  delete reset.j;
483
483
  reset();
@@ -502,11 +502,11 @@ var Owner = class {
502
502
  // See comment at the top of the file for an example of the _nextSibling traversal
503
503
  k = null;
504
504
  m = null;
505
- t = null;
506
- c = STATE_CLEAN;
505
+ y = null;
506
+ b = STATE_CLEAN;
507
507
  n = null;
508
- u = defaultContext;
509
- z = globalQueue;
508
+ z = defaultContext;
509
+ C = globalQueue;
510
510
  fa = 0;
511
511
  id = null;
512
512
  constructor(id = null, skipAppend = false) {
@@ -517,23 +517,23 @@ var Owner = class {
517
517
  }
518
518
  append(child) {
519
519
  child.k = this;
520
- child.t = this;
520
+ child.y = this;
521
521
  if (this.m)
522
- this.m.t = child;
522
+ this.m.y = child;
523
523
  child.m = this.m;
524
524
  this.m = child;
525
525
  if (this.id != null && child.id == null)
526
526
  child.id = this.getNextChildId();
527
- if (child.u !== this.u) {
528
- child.u = { ...this.u, ...child.u };
527
+ if (child.z !== this.z) {
528
+ child.z = { ...this.z, ...child.z };
529
529
  }
530
- if (this.z)
531
- child.z = this.z;
530
+ if (this.C)
531
+ child.C = this.C;
532
532
  }
533
533
  dispose(self = true) {
534
- if (this.c === STATE_DISPOSED)
534
+ if (this.b === STATE_DISPOSED)
535
535
  return;
536
- let head = self ? this.t || this.k : this, current = this.m, next = null;
536
+ let head = self ? this.y || this.k : this, current = this.m, next = null;
537
537
  while (current && current.k === this) {
538
538
  current.dispose(true);
539
539
  next = current.m;
@@ -542,19 +542,19 @@ var Owner = class {
542
542
  }
543
543
  this.fa = 0;
544
544
  if (self)
545
- this.T();
545
+ this.L();
546
546
  if (current)
547
- current.t = !self ? this : this.t;
547
+ current.y = !self ? this : this.y;
548
548
  if (head)
549
549
  head.m = current;
550
550
  }
551
- T() {
552
- if (this.t)
553
- this.t.m = null;
551
+ L() {
552
+ if (this.y)
553
+ this.y.m = null;
554
554
  this.k = null;
555
- this.t = null;
556
- this.u = defaultContext;
557
- this.c = STATE_DISPOSED;
555
+ this.y = null;
556
+ this.z = defaultContext;
557
+ this.b = STATE_DISPOSED;
558
558
  this.emptyDisposal();
559
559
  }
560
560
  emptyDisposal() {
@@ -583,7 +583,7 @@ function getContext(context, owner = currentOwner) {
583
583
  if (!owner) {
584
584
  throw new NoOwnerError();
585
585
  }
586
- const value = hasContext(context, owner) ? owner.u[context.id] : context.defaultValue;
586
+ const value = hasContext(context, owner) ? owner.z[context.id] : context.defaultValue;
587
587
  if (isUndefined(value)) {
588
588
  throw new ContextNotFoundError();
589
589
  }
@@ -593,13 +593,13 @@ function setContext(context, value, owner = currentOwner) {
593
593
  if (!owner) {
594
594
  throw new NoOwnerError();
595
595
  }
596
- owner.u = {
597
- ...owner.u,
596
+ owner.z = {
597
+ ...owner.z,
598
598
  [context.id]: isUndefined(value) ? context.defaultValue : value
599
599
  };
600
600
  }
601
601
  function hasContext(context, owner = currentOwner) {
602
- return !isUndefined(owner?.u[context.id]);
602
+ return !isUndefined(owner?.z[context.id]);
603
603
  }
604
604
  function onCleanup(fn) {
605
605
  if (!currentOwner)
@@ -637,10 +637,10 @@ function getObserver() {
637
637
  var UNCHANGED = Symbol(0);
638
638
  var Computation = class extends Owner {
639
639
  a = null;
640
- b = null;
640
+ c = null;
641
641
  l;
642
- M;
643
- N;
642
+ O;
643
+ P;
644
644
  // Used in __DEV__ mode, hopefully removed in production
645
645
  la;
646
646
  // Using false is an optimization as an alternative to _equals: () => false
@@ -649,19 +649,19 @@ var Computation = class extends Owner {
649
649
  ea;
650
650
  ha = false;
651
651
  /** Whether the computation is an error or has ancestors that are unresolved */
652
- h = 0;
652
+ i = 0;
653
653
  /** Which flags raised by sources are handled, vs. being passed through. */
654
654
  ba = DEFAULT_FLAGS;
655
- O = -1;
656
- C = false;
655
+ Q = -1;
656
+ E = false;
657
657
  j;
658
- e;
658
+ d;
659
659
  I = false;
660
660
  constructor(initialValue, compute2, options) {
661
661
  super(options?.id, compute2 === null);
662
- this.N = compute2;
663
- this.c = compute2 ? STATE_DIRTY : STATE_CLEAN;
664
- this.h = compute2 && initialValue === void 0 ? UNINITIALIZED_BIT : 0;
662
+ this.P = compute2;
663
+ this.b = compute2 ? STATE_DIRTY : STATE_CLEAN;
664
+ this.i = compute2 && initialValue === void 0 ? UNINITIALIZED_BIT : 0;
665
665
  this.l = initialValue;
666
666
  if (options?.equals !== void 0)
667
667
  this.aa = options.equals;
@@ -674,9 +674,9 @@ var Computation = class extends Owner {
674
674
  }
675
675
  ga() {
676
676
  track(this);
677
- newFlags |= this.h & ~currentMask;
678
- if (this.h & ERROR_BIT) {
679
- throw this.M;
677
+ newFlags |= this.i & ~currentMask;
678
+ if (this.i & ERROR_BIT) {
679
+ throw this.O;
680
680
  } else {
681
681
  return this.l;
682
682
  }
@@ -686,16 +686,16 @@ var Computation = class extends Owner {
686
686
  * Automatically re-executes the surrounding computation when the value changes
687
687
  */
688
688
  read() {
689
- if (ActiveTransition && (ActiveTransition.a.has(this) || !this.e && this.h & (UNINITIALIZED_BIT | ERROR_BIT))) {
689
+ if (ActiveTransition && (ActiveTransition.a.has(this) || !this.d && this.i & (UNINITIALIZED_BIT | ERROR_BIT))) {
690
690
  const clone = ActiveTransition.a.get(this) || cloneGraph(this);
691
691
  if (clone !== this)
692
692
  return clone.read();
693
693
  }
694
- if (this.N) {
695
- if (this.h & ERROR_BIT && this.O <= clock)
694
+ if (this.P) {
695
+ if (this.i & ERROR_BIT && this.Q <= clock)
696
696
  update(this);
697
697
  else
698
- this.L();
698
+ this.M();
699
699
  }
700
700
  return this.ga();
701
701
  }
@@ -707,49 +707,49 @@ var Computation = class extends Owner {
707
707
  * before continuing
708
708
  */
709
709
  wait() {
710
- if (ActiveTransition && (ActiveTransition.a.has(this) || !this.e && this.h & (UNINITIALIZED_BIT | ERROR_BIT))) {
710
+ if (ActiveTransition && (ActiveTransition.a.has(this) || !this.d && this.i & (UNINITIALIZED_BIT | ERROR_BIT))) {
711
711
  const clone = ActiveTransition.a.get(this) || cloneGraph(this);
712
712
  if (clone !== this)
713
713
  return clone.wait();
714
714
  }
715
- if (this.N) {
716
- if (this.h & ERROR_BIT && this.O <= clock)
715
+ if (this.P) {
716
+ if (this.i & ERROR_BIT && this.Q <= clock)
717
717
  update(this);
718
718
  else
719
- this.L();
719
+ this.M();
720
720
  }
721
- if ((notStale || this.h & UNINITIALIZED_BIT) && this.h & LOADING_BIT) {
721
+ if ((notStale || this.i & UNINITIALIZED_BIT) && this.i & LOADING_BIT) {
722
722
  track(this);
723
723
  throw new NotReadyError();
724
724
  }
725
- if (staleCheck && this.h & LOADING_BIT) {
725
+ if (staleCheck && this.i & LOADING_BIT) {
726
726
  staleCheck.l = true;
727
727
  }
728
728
  return this.ga();
729
729
  }
730
730
  /** Update the computation with a new value. */
731
731
  write(value, flags = 0, raw = false) {
732
- if (ActiveTransition && !this.e) {
732
+ if (ActiveTransition && !this.d) {
733
733
  const clone = cloneGraph(this);
734
734
  if (clone !== this)
735
735
  return clone.write(value, flags, raw);
736
736
  }
737
737
  const newValue = !raw && typeof value === "function" ? value(this.l) : value;
738
- const valueChanged = newValue !== UNCHANGED && (!!(this.h & UNINITIALIZED_BIT) || // this._stateFlags & LOADING_BIT & ~flags ||
738
+ const valueChanged = newValue !== UNCHANGED && (!!(this.i & UNINITIALIZED_BIT) || // this._stateFlags & LOADING_BIT & ~flags ||
739
739
  this.aa === false || !this.aa(this.l, newValue));
740
740
  if (valueChanged) {
741
741
  this.l = newValue;
742
- this.M = void 0;
742
+ this.O = void 0;
743
743
  }
744
- const changedFlagsMask = this.h ^ flags, changedFlags = changedFlagsMask & flags;
745
- this.h = flags;
746
- this.O = clock + 1;
747
- if (this.b) {
748
- for (let i = 0; i < this.b.length; i++) {
744
+ const changedFlagsMask = this.i ^ flags, changedFlags = changedFlagsMask & flags;
745
+ this.i = flags;
746
+ this.Q = clock + 1;
747
+ if (this.c) {
748
+ for (let i = 0; i < this.c.length; i++) {
749
749
  if (valueChanged) {
750
- this.b[i].w(STATE_DIRTY);
750
+ this.c[i].t(STATE_DIRTY);
751
751
  } else if (changedFlagsMask) {
752
- this.b[i]._(changedFlagsMask, changedFlags);
752
+ this.c[i]._(changedFlagsMask, changedFlags);
753
753
  }
754
754
  }
755
755
  }
@@ -758,14 +758,14 @@ var Computation = class extends Owner {
758
758
  /**
759
759
  * Set the current node's state, and recursively mark all of this node's observers as STATE_CHECK
760
760
  */
761
- w(state, skipQueue) {
762
- if (this.c >= state && !this.C)
761
+ t(state, skipQueue) {
762
+ if (this.b >= state && !this.E)
763
763
  return;
764
- this.C = !!skipQueue;
765
- this.c = state;
766
- if (this.b) {
767
- for (let i = 0; i < this.b.length; i++) {
768
- this.b[i].w(STATE_CHECK, skipQueue);
764
+ this.E = !!skipQueue;
765
+ this.b = state;
766
+ if (this.c) {
767
+ for (let i = 0; i < this.c.length; i++) {
768
+ this.c[i].t(STATE_CHECK, skipQueue);
769
769
  }
770
770
  }
771
771
  }
@@ -776,35 +776,35 @@ var Computation = class extends Owner {
776
776
  * @param newFlags The source's new flags, masked to just the changed ones.
777
777
  */
778
778
  _(mask, newFlags2) {
779
- if (this.c >= STATE_DIRTY)
779
+ if (this.b >= STATE_DIRTY)
780
780
  return;
781
781
  if (mask & this.ba) {
782
- this.w(STATE_DIRTY);
782
+ this.t(STATE_DIRTY);
783
783
  return;
784
784
  }
785
- if (this.c >= STATE_CHECK && !this.C)
785
+ if (this.b >= STATE_CHECK && !this.E)
786
786
  return;
787
- const prevFlags = this.h & mask;
787
+ const prevFlags = this.i & mask;
788
788
  const deltaFlags = prevFlags ^ newFlags2;
789
789
  if (newFlags2 === prevFlags) ; else if (deltaFlags & prevFlags & mask) {
790
- this.w(STATE_CHECK);
790
+ this.t(STATE_CHECK);
791
791
  } else {
792
- this.h ^= deltaFlags;
793
- if (this.b) {
794
- for (let i = 0; i < this.b.length; i++) {
795
- this.b[i]._(mask, newFlags2);
792
+ this.i ^= deltaFlags;
793
+ if (this.c) {
794
+ for (let i = 0; i < this.c.length; i++) {
795
+ this.c[i]._(mask, newFlags2);
796
796
  }
797
797
  }
798
798
  }
799
799
  }
800
- D(error) {
801
- if (ActiveTransition && !this.e) {
800
+ N(error) {
801
+ if (ActiveTransition && !this.d) {
802
802
  const clone = cloneGraph(this);
803
803
  if (clone !== this)
804
- return clone.D(error);
804
+ return clone.N(error);
805
805
  }
806
- this.M = error;
807
- this.write(UNCHANGED, this.h & ~LOADING_BIT | ERROR_BIT | UNINITIALIZED_BIT);
806
+ this.O = error;
807
+ this.write(UNCHANGED, this.i & ~LOADING_BIT | ERROR_BIT | UNINITIALIZED_BIT);
808
808
  }
809
809
  /**
810
810
  * This is the core part of the reactivity system, which makes sure that the values are updated
@@ -813,48 +813,48 @@ var Computation = class extends Owner {
813
813
  *
814
814
  * This function will ensure that the value and states we read from the computation are up to date
815
815
  */
816
- L() {
817
- if (!this.N) {
816
+ M() {
817
+ if (!this.P) {
818
818
  return;
819
819
  }
820
- if (this.c === STATE_DISPOSED) {
820
+ if (this.b === STATE_DISPOSED) {
821
821
  return;
822
822
  }
823
- if (this.c === STATE_CLEAN) {
823
+ if (this.b === STATE_CLEAN) {
824
824
  return;
825
825
  }
826
826
  let observerFlags = 0;
827
- if (this.c === STATE_CHECK) {
827
+ if (this.b === STATE_CHECK) {
828
828
  for (let i = 0; i < this.a.length; i++) {
829
829
  const source = getTransitionSource(this.a[i]);
830
- source.L();
831
- observerFlags |= source.h & ~UNINITIALIZED_BIT;
832
- if (this.c === STATE_DIRTY) {
830
+ source.M();
831
+ observerFlags |= source.i & ~UNINITIALIZED_BIT;
832
+ if (this.b === STATE_DIRTY) {
833
833
  break;
834
834
  }
835
835
  }
836
836
  }
837
- if (this.c === STATE_DIRTY) {
837
+ if (this.b === STATE_DIRTY) {
838
838
  update(this);
839
839
  } else {
840
840
  this.write(UNCHANGED, observerFlags);
841
- this.c = STATE_CLEAN;
841
+ this.b = STATE_CLEAN;
842
842
  }
843
843
  }
844
844
  /**
845
845
  * Remove ourselves from the owner graph and the computation graph
846
846
  */
847
- T() {
848
- if (this.c === STATE_DISPOSED)
847
+ L() {
848
+ if (this.b === STATE_DISPOSED)
849
849
  return;
850
850
  if (this.a)
851
851
  removeSourceObservers(this, 0);
852
- super.T();
852
+ super.L();
853
853
  }
854
854
  };
855
855
  function track(computation) {
856
- if (ActiveTransition && computation.e)
857
- computation = computation.e;
856
+ if (ActiveTransition && computation.d)
857
+ computation = computation.d;
858
858
  if (currentObserver) {
859
859
  if (!newSources && currentObserver.a && currentObserver.a[newSourcesIndex] === computation) {
860
860
  newSourcesIndex++;
@@ -864,7 +864,7 @@ function track(computation) {
864
864
  newSources.push(computation);
865
865
  }
866
866
  if (updateCheck) {
867
- updateCheck.l = computation.O > currentObserver.O;
867
+ updateCheck.l = computation.Q > currentObserver.Q;
868
868
  }
869
869
  }
870
870
  }
@@ -874,19 +874,19 @@ function update(node) {
874
874
  newSourcesIndex = 0;
875
875
  newFlags = 0;
876
876
  try {
877
- if (ActiveTransition && node.e && !node.Z) {
878
- initialDispose(node.e);
877
+ if (ActiveTransition && node.d && !node.Z) {
878
+ initialDispose(node.d);
879
879
  node.Z = true;
880
880
  }
881
881
  node.dispose(false);
882
882
  node.emptyDisposal();
883
- const result = compute(node, node.N, node);
883
+ const result = compute(node, node.P, node);
884
884
  node.write(result, newFlags, true);
885
885
  } catch (error) {
886
886
  if (error instanceof NotReadyError) {
887
- node.write(UNCHANGED, newFlags | LOADING_BIT | node.h & UNINITIALIZED_BIT);
887
+ node.write(UNCHANGED, newFlags | LOADING_BIT | node.i & UNINITIALIZED_BIT);
888
888
  } else {
889
- node.D(error);
889
+ node.N(error);
890
890
  }
891
891
  } finally {
892
892
  if (newSources) {
@@ -903,10 +903,10 @@ function update(node) {
903
903
  let source;
904
904
  for (let i = newSourcesIndex; i < node.a.length; i++) {
905
905
  source = getTransitionSource(node.a[i]);
906
- if (!source.b)
907
- source.b = [node];
906
+ if (!source.c)
907
+ source.c = [node];
908
908
  else
909
- source.b.push(node);
909
+ source.c.push(node);
910
910
  }
911
911
  } else if (node.a && newSourcesIndex < node.a.length) {
912
912
  removeSourceObservers(node, newSourcesIndex);
@@ -915,8 +915,8 @@ function update(node) {
915
915
  newSources = prevSources;
916
916
  newSourcesIndex = prevSourcesIndex;
917
917
  newFlags = prevFlags;
918
- node.O = clock + 1;
919
- node.c = STATE_CLEAN;
918
+ node.Q = clock + 1;
919
+ node.b = STATE_CLEAN;
920
920
  }
921
921
  }
922
922
  function isEqual(a, b) {
@@ -976,46 +976,6 @@ function latest(fn, fallback) {
976
976
  notStale = prevNotStale;
977
977
  }
978
978
  }
979
- function runWithObserver(observer, run) {
980
- const prevSources = newSources, prevSourcesIndex = newSourcesIndex, prevFlags = newFlags;
981
- newSources = null;
982
- newSourcesIndex = observer.a ? observer.a.length : 0;
983
- newFlags = 0;
984
- try {
985
- return compute(observer, run, observer);
986
- } catch (error) {
987
- if (error instanceof NotReadyError) {
988
- observer.write(
989
- UNCHANGED,
990
- newFlags | LOADING_BIT | observer.h & UNINITIALIZED_BIT
991
- );
992
- } else {
993
- observer.D(error);
994
- }
995
- } finally {
996
- if (newSources) {
997
- if (newSourcesIndex > 0) {
998
- observer.a.length = newSourcesIndex + newSources.length;
999
- for (let i = 0; i < newSources.length; i++) {
1000
- observer.a[newSourcesIndex + i] = newSources[i];
1001
- }
1002
- } else {
1003
- observer.a = newSources;
1004
- }
1005
- let source;
1006
- for (let i = newSourcesIndex; i < observer.a.length; i++) {
1007
- source = observer.a[i];
1008
- if (!source.b)
1009
- source.b = [observer];
1010
- else
1011
- source.b.push(observer);
1012
- }
1013
- }
1014
- newSources = prevSources;
1015
- newSourcesIndex = prevSourcesIndex;
1016
- newFlags = prevFlags;
1017
- }
1018
- }
1019
979
  function compute(owner, fn, observer) {
1020
980
  const prevOwner = setOwner(owner), prevObserver = currentObserver, prevMask = currentMask, prevNotStale = notStale;
1021
981
  currentObserver = observer;
@@ -1035,65 +995,65 @@ function compute(owner, fn, observer) {
1035
995
  var Effect = class extends Computation {
1036
996
  ca;
1037
997
  $;
1038
- P;
998
+ u;
1039
999
  da = false;
1040
- S;
1041
- A;
1000
+ T;
1001
+ r;
1042
1002
  constructor(initialValue, compute2, effect, error, options) {
1043
1003
  super(initialValue, compute2, options);
1044
1004
  this.ca = effect;
1045
1005
  this.$ = error;
1046
- this.S = initialValue;
1047
- this.A = options?.render ? EFFECT_RENDER : EFFECT_USER;
1048
- if (this.A === EFFECT_RENDER) {
1049
- this.N = function(p) {
1050
- return !this.e && clock > this.z.created && !(this.h & ERROR_BIT) ? latest(() => compute2(p)) : compute2(p);
1006
+ this.T = initialValue;
1007
+ this.r = options?.render ? EFFECT_RENDER : EFFECT_USER;
1008
+ if (this.r === EFFECT_RENDER) {
1009
+ this.P = function(p) {
1010
+ return !this.d && clock > this.C.created && !(this.i & ERROR_BIT) ? latest(() => compute2(p)) : compute2(p);
1051
1011
  };
1052
1012
  }
1053
- this.L();
1054
- !options?.defer && (this.A === EFFECT_USER ? getQueue(this).enqueue(this.A, this.E.bind(this)) : this.E(this.A));
1013
+ this.M();
1014
+ !options?.defer && (this.r === EFFECT_USER ? getQueue(this).enqueue(this.r, this.w.bind(this)) : this.w(this.r));
1055
1015
  }
1056
1016
  write(value, flags = 0) {
1057
- if (this.c == STATE_DIRTY) {
1058
- this.h = flags;
1059
- if (this.A === EFFECT_RENDER) {
1060
- getQueue(this).notify(this, LOADING_BIT | ERROR_BIT, this.h);
1017
+ if (this.b == STATE_DIRTY) {
1018
+ this.i = flags;
1019
+ if (this.r === EFFECT_RENDER) {
1020
+ getQueue(this).notify(this, LOADING_BIT | ERROR_BIT, this.i);
1061
1021
  }
1062
1022
  }
1063
1023
  if (value === UNCHANGED)
1064
1024
  return this.l;
1065
1025
  this.l = value;
1066
1026
  this.da = true;
1067
- this.M = void 0;
1027
+ this.O = void 0;
1068
1028
  return value;
1069
1029
  }
1070
- w(state, skipQueue) {
1071
- if (this.c >= state || skipQueue)
1030
+ t(state, skipQueue) {
1031
+ if (this.b >= state || skipQueue)
1072
1032
  return;
1073
- if (this.c === STATE_CLEAN || this.e && !ActiveTransition)
1074
- getQueue(this).enqueue(this.A, this.E.bind(this));
1075
- this.c = state;
1033
+ if (this.b === STATE_CLEAN || this.d && !ActiveTransition)
1034
+ getQueue(this).enqueue(this.r, this.w.bind(this));
1035
+ this.b = state;
1076
1036
  }
1077
1037
  _(mask, newFlags2) {
1078
- if (this.e) {
1079
- if (this.c >= STATE_DIRTY)
1038
+ if (this.d) {
1039
+ if (this.b >= STATE_DIRTY)
1080
1040
  return;
1081
1041
  if (mask & 3) {
1082
- this.w(STATE_DIRTY);
1042
+ this.t(STATE_DIRTY);
1083
1043
  return;
1084
1044
  }
1085
1045
  }
1086
1046
  super._(mask, newFlags2);
1087
1047
  }
1088
- D(error) {
1089
- this.M = error;
1048
+ N(error) {
1049
+ this.O = error;
1090
1050
  getQueue(this).notify(this, LOADING_BIT, 0);
1091
- this.h = ERROR_BIT;
1092
- if (this.A === EFFECT_USER) {
1051
+ this.i = ERROR_BIT;
1052
+ if (this.r === EFFECT_USER) {
1093
1053
  try {
1094
1054
  return this.$ ? this.$(error, () => {
1095
- this.P?.();
1096
- this.P = void 0;
1055
+ this.u?.();
1056
+ this.u = void 0;
1097
1057
  }) : console.error(error);
1098
1058
  } catch (e) {
1099
1059
  error = e;
@@ -1102,50 +1062,81 @@ var Effect = class extends Computation {
1102
1062
  if (!getQueue(this).notify(this, ERROR_BIT, ERROR_BIT))
1103
1063
  throw error;
1104
1064
  }
1105
- T() {
1106
- if (this.c === STATE_DISPOSED)
1065
+ L() {
1066
+ if (this.b === STATE_DISPOSED)
1107
1067
  return;
1108
1068
  this.ca = void 0;
1109
- this.S = void 0;
1069
+ this.T = void 0;
1110
1070
  this.$ = void 0;
1111
- this.P?.();
1112
- this.P = void 0;
1071
+ this.u?.();
1072
+ this.u = void 0;
1113
1073
  getQueue(this).notify(this, ERROR_BIT | LOADING_BIT, 0);
1114
- super.T();
1074
+ super.L();
1115
1075
  }
1116
- E(type) {
1076
+ w(type) {
1117
1077
  if (type) {
1118
- const effect = this.e || this;
1119
- if (effect.da && effect.c !== STATE_DISPOSED) {
1120
- effect.P?.();
1078
+ const effect = this.d || this;
1079
+ if (effect.da && effect.b !== STATE_DISPOSED) {
1080
+ effect.u?.();
1121
1081
  try {
1122
- effect.P = effect.ca(effect.l, effect.S);
1082
+ effect.u = effect.ca(effect.l, effect.T);
1123
1083
  } catch (e) {
1124
1084
  if (!getQueue(effect).notify(effect, ERROR_BIT, ERROR_BIT))
1125
1085
  throw e;
1126
1086
  } finally {
1127
- effect.S = effect.l;
1087
+ effect.T = effect.l;
1128
1088
  effect.da = false;
1129
1089
  }
1130
1090
  }
1131
1091
  } else
1132
- this.c !== STATE_CLEAN && runTop(this);
1092
+ this.b !== STATE_CLEAN && runTop(this);
1093
+ }
1094
+ };
1095
+ var TrackedEffect = class extends Computation {
1096
+ r = EFFECT_USER;
1097
+ u;
1098
+ constructor(compute2, options) {
1099
+ super(void 0, () => {
1100
+ this.u?.();
1101
+ this.u = latest(compute2);
1102
+ return void 0;
1103
+ }, options);
1104
+ getQueue(this).enqueue(this.r, this.w.bind(this));
1105
+ }
1106
+ t(state, skipQueue) {
1107
+ if (this.b >= state || skipQueue)
1108
+ return;
1109
+ if (this.b === STATE_CLEAN || this.d && !ActiveTransition)
1110
+ getQueue(this).enqueue(this.r, this.w.bind(this));
1111
+ this.b = state;
1112
+ }
1113
+ L() {
1114
+ if (this.b === STATE_DISPOSED)
1115
+ return;
1116
+ this.u?.();
1117
+ this.u = void 0;
1118
+ getQueue(this).notify(this, ERROR_BIT | LOADING_BIT, 0);
1119
+ super.L();
1120
+ }
1121
+ w(type) {
1122
+ if (type)
1123
+ this.b !== STATE_CLEAN && runTop(this);
1133
1124
  }
1134
1125
  };
1135
1126
  var EagerComputation = class extends Computation {
1136
1127
  constructor(initialValue, compute2, options) {
1137
1128
  super(initialValue, compute2, options);
1138
- !options?.defer && this.L();
1129
+ !options?.defer && this.M();
1139
1130
  }
1140
- w(state, skipQueue) {
1141
- if (this.c >= state && !this.C)
1131
+ t(state, skipQueue) {
1132
+ if (this.b >= state && !this.E)
1142
1133
  return;
1143
- if (!skipQueue && (this.c === STATE_CLEAN || this.c === STATE_CHECK && this.C))
1144
- getQueue(this).enqueue(EFFECT_PURE, this.E.bind(this));
1145
- super.w(state, skipQueue);
1134
+ if (!skipQueue && (this.b === STATE_CLEAN || this.b === STATE_CHECK && this.E))
1135
+ getQueue(this).enqueue(EFFECT_PURE, this.w.bind(this));
1136
+ super.t(state, skipQueue);
1146
1137
  }
1147
- E() {
1148
- this.c !== STATE_CLEAN && runTop(this);
1138
+ w() {
1139
+ this.b !== STATE_CLEAN && runTop(this);
1149
1140
  }
1150
1141
  };
1151
1142
  var FirewallComputation = class extends Computation {
@@ -1153,16 +1144,16 @@ var FirewallComputation = class extends Computation {
1153
1144
  constructor(compute2) {
1154
1145
  super(void 0, compute2);
1155
1146
  }
1156
- w(state, skipQueue) {
1157
- if (this.c >= state && !this.C)
1147
+ t(state, skipQueue) {
1148
+ if (this.b >= state && !this.E)
1158
1149
  return;
1159
- if (!skipQueue && (this.c === STATE_CLEAN || this.c === STATE_CHECK && this.C))
1160
- getQueue(this).enqueue(EFFECT_PURE, this.E.bind(this));
1161
- super.w(state, true);
1162
- this.C = !!skipQueue;
1150
+ if (!skipQueue && (this.b === STATE_CLEAN || this.b === STATE_CHECK && this.E))
1151
+ getQueue(this).enqueue(EFFECT_PURE, this.w.bind(this));
1152
+ super.t(state, true);
1153
+ this.E = !!skipQueue;
1163
1154
  }
1164
- E() {
1165
- this.c !== STATE_CLEAN && runTop(this);
1155
+ w() {
1156
+ this.b !== STATE_CLEAN && runTop(this);
1166
1157
  }
1167
1158
  };
1168
1159
  function runTop(node) {
@@ -1170,28 +1161,21 @@ function runTop(node) {
1170
1161
  for (let current = node; current !== null; current = current.k) {
1171
1162
  if (ActiveTransition && current.j)
1172
1163
  current = ActiveTransition.a.get(current);
1173
- if (current.c !== STATE_CLEAN) {
1164
+ if (current.b !== STATE_CLEAN) {
1174
1165
  ancestors.push(current);
1175
1166
  }
1176
1167
  }
1177
1168
  for (let i = ancestors.length - 1; i >= 0; i--) {
1178
- if (ancestors[i].c !== STATE_DISPOSED)
1179
- ancestors[i].L();
1169
+ if (ancestors[i].b !== STATE_DISPOSED)
1170
+ ancestors[i].M();
1180
1171
  }
1181
1172
  }
1182
1173
 
1183
1174
  // src/signals.ts
1184
1175
  function createSignal(first, second, third) {
1185
1176
  if (typeof first === "function") {
1186
- const memo = createMemo((p) => {
1187
- const node2 = new Computation(
1188
- first(p ? untrack(p[0]) : second),
1189
- null,
1190
- third
1191
- );
1192
- return [node2.read.bind(node2), node2.write.bind(node2)];
1193
- });
1194
- return [() => memo()[0](), (value) => memo()[1](value)];
1177
+ const node2 = new Computation(second, first, third);
1178
+ return [node2.read.bind(node2), node2.write.bind(node2)];
1195
1179
  }
1196
1180
  const o = getOwner();
1197
1181
  const needsId = o?.id != null;
@@ -1211,12 +1195,12 @@ function createMemo(compute2, value, options) {
1211
1195
  let resolvedValue;
1212
1196
  return () => {
1213
1197
  if (node) {
1214
- if (node.c === STATE_DISPOSED) {
1198
+ if (node.b === STATE_DISPOSED) {
1215
1199
  node = void 0;
1216
1200
  return resolvedValue;
1217
1201
  }
1218
1202
  resolvedValue = node.wait();
1219
- if (!node.a?.length && node.m?.k !== node && !(node.h & UNINITIALIZED_BIT)) {
1203
+ if (!node.a?.length && node.m?.k !== node && !(node.i & UNINITIALIZED_BIT)) {
1220
1204
  node.dispose();
1221
1205
  node = void 0;
1222
1206
  }
@@ -1254,8 +1238,8 @@ function createAsync(compute2, value, options) {
1254
1238
  if (abort)
1255
1239
  return;
1256
1240
  if (transition2)
1257
- return transition2.runTransition(() => node.D(error), true);
1258
- node.D(error);
1241
+ return transition2.runTransition(() => node.N(error), true);
1242
+ node.N(error);
1259
1243
  }
1260
1244
  );
1261
1245
  } else {
@@ -1276,10 +1260,10 @@ function createAsync(compute2, value, options) {
1276
1260
  return;
1277
1261
  if (transition2)
1278
1262
  return transition2.runTransition(() => {
1279
- node.D(error);
1263
+ node.N(error);
1280
1264
  transition2 = null;
1281
1265
  }, true);
1282
- node.D(error);
1266
+ node.N(error);
1283
1267
  }
1284
1268
  })();
1285
1269
  }
@@ -1290,12 +1274,12 @@ function createAsync(compute2, value, options) {
1290
1274
  const read = node.wait.bind(node);
1291
1275
  read.refresh = () => {
1292
1276
  let n = node;
1293
- if (ActiveTransition && !node.e) {
1277
+ if (ActiveTransition && !node.d) {
1294
1278
  n = cloneGraph(node);
1295
1279
  }
1296
- n.c = STATE_DIRTY;
1280
+ n.b = STATE_DIRTY;
1297
1281
  refreshing = true;
1298
- n.L();
1282
+ n.M();
1299
1283
  };
1300
1284
  return read;
1301
1285
  }
@@ -1303,7 +1287,7 @@ function createEffect(compute2, effect, value, options) {
1303
1287
  void new Effect(
1304
1288
  value,
1305
1289
  compute2,
1306
- effect.effect ? effect.effect : effect,
1290
+ effect.effect || effect,
1307
1291
  effect.error,
1308
1292
  options
1309
1293
  );
@@ -1314,6 +1298,29 @@ function createRenderEffect(compute2, effect, value, options) {
1314
1298
  ...options
1315
1299
  });
1316
1300
  }
1301
+ function createTrackedEffect(compute2, options) {
1302
+ void new TrackedEffect(compute2, options);
1303
+ }
1304
+ function createReaction(effect, options) {
1305
+ let cleanup = void 0;
1306
+ onCleanup(() => cleanup?.());
1307
+ return (tracking) => {
1308
+ const node = new Effect(
1309
+ void 0,
1310
+ tracking,
1311
+ () => {
1312
+ cleanup?.();
1313
+ cleanup = (effect.effect || effect)?.();
1314
+ node.dispose(true);
1315
+ },
1316
+ effect.error,
1317
+ {
1318
+ defer: true,
1319
+ ...options
1320
+ }
1321
+ );
1322
+ };
1323
+ }
1317
1324
  function createRoot(init, options) {
1318
1325
  const owner = new Owner(options?.id);
1319
1326
  return compute(owner, !init.length ? init : () => init(() => owner.dispose()), null);
@@ -1337,23 +1344,20 @@ function resolve(fn) {
1337
1344
  });
1338
1345
  });
1339
1346
  }
1340
- function createPending() {
1341
- const node = new Computation(false, null);
1342
- const reset = () => node.write(false);
1343
- function write() {
1347
+ function createOptimistic(first, second, third) {
1348
+ const node = typeof first === "function" ? new Computation(second, first, third) : new Computation(first, null, second);
1349
+ const reset = () => node.write(first);
1350
+ function write(v) {
1344
1351
  if (!ActiveTransition)
1345
- return false;
1352
+ throw new Error("createOptimistic can only be updated inside a transition");
1346
1353
  ActiveTransition.addOptimistic(reset);
1347
- queueMicrotask(() => reset.j && node.write(true));
1348
- }
1349
- function read() {
1350
- const v = node.read();
1351
- return ActiveTransition ? false : v;
1354
+ cloneGraph(node, true);
1355
+ queueMicrotask(() => reset.j && node.write(v));
1352
1356
  }
1353
- return [read, write];
1357
+ return [node.read.bind(node), write];
1354
1358
  }
1355
1359
  function useTransition() {
1356
- const [pending, setPending] = createPending();
1360
+ const [pending, setPending] = createOptimistic(false);
1357
1361
  function start(fn) {
1358
1362
  transition((resume) => {
1359
1363
  setPending(true);
@@ -1819,7 +1823,7 @@ function deep(store) {
1819
1823
  }
1820
1824
 
1821
1825
  // src/store/optimistic.ts
1822
- function createOptimistic(first, second, options) {
1826
+ function createOptimisticStore(first, second, options) {
1823
1827
  const derived = typeof first === "function";
1824
1828
  const { store, node } = derived ? createProjectionInternal(first, second, options) : createProjectionInternal(() => {
1825
1829
  }, first);
@@ -1833,7 +1837,7 @@ function createOptimistic(first, second, options) {
1833
1837
  );
1834
1838
  const write = (v) => {
1835
1839
  if (!ActiveTransition)
1836
- throw new Error("createOptimistic can only be updated inside a transition");
1840
+ throw new Error("createOptimisticStore can only be updated inside a transition");
1837
1841
  ActiveTransition.addOptimistic(reset);
1838
1842
  cloneGraph(node, true);
1839
1843
  queueMicrotask(() => reset.j && storeSetter(store, v));
@@ -2049,10 +2053,10 @@ function mapArray(list, map, options) {
2049
2053
  o: 0,
2050
2054
  ia: list,
2051
2055
  F: [],
2052
- Q: map,
2053
- i: [],
2054
- d: [],
2055
- R: keyFn,
2056
+ R: map,
2057
+ h: [],
2058
+ e: [],
2059
+ S: keyFn,
2056
2060
  p: keyFn || options?.keyed === false ? [] : void 0,
2057
2061
  q: map.length > 1 ? [] : void 0,
2058
2062
  V: options?.fallback
@@ -2066,53 +2070,53 @@ function updateKeyedMap() {
2066
2070
  let i, j, mapper = this.p ? () => {
2067
2071
  this.p[j] = new Computation(newItems[j], null, pureOptions);
2068
2072
  this.q && (this.q[j] = new Computation(j, null, pureOptions));
2069
- return this.Q(
2073
+ return this.R(
2070
2074
  Computation.prototype.read.bind(this.p[j]),
2071
2075
  this.q ? Computation.prototype.read.bind(this.q[j]) : void 0
2072
2076
  );
2073
2077
  } : this.q ? () => {
2074
2078
  const item = newItems[j];
2075
2079
  this.q[j] = new Computation(j, null, pureOptions);
2076
- return this.Q(() => item, Computation.prototype.read.bind(this.q[j]));
2080
+ return this.R(() => item, Computation.prototype.read.bind(this.q[j]));
2077
2081
  } : () => {
2078
2082
  const item = newItems[j];
2079
- return this.Q(() => item);
2083
+ return this.R(() => item);
2080
2084
  };
2081
2085
  if (newLen === 0) {
2082
2086
  if (this.o !== 0) {
2083
2087
  this.U.dispose(false);
2084
- this.d = [];
2088
+ this.e = [];
2085
2089
  this.F = [];
2086
- this.i = [];
2090
+ this.h = [];
2087
2091
  this.o = 0;
2088
2092
  this.p && (this.p = []);
2089
2093
  this.q && (this.q = []);
2090
2094
  }
2091
- if (this.V && !this.i[0]) {
2092
- this.i[0] = compute(
2093
- this.d[0] = new Owner(),
2095
+ if (this.V && !this.h[0]) {
2096
+ this.h[0] = compute(
2097
+ this.e[0] = new Owner(),
2094
2098
  this.V,
2095
2099
  null
2096
2100
  );
2097
2101
  }
2098
2102
  } else if (this.o === 0) {
2099
- if (this.d[0])
2100
- this.d[0].dispose();
2101
- this.i = new Array(newLen);
2103
+ if (this.e[0])
2104
+ this.e[0].dispose();
2105
+ this.h = new Array(newLen);
2102
2106
  for (j = 0; j < newLen; j++) {
2103
2107
  this.F[j] = newItems[j];
2104
- this.i[j] = compute(this.d[j] = new Owner(), mapper, null);
2108
+ this.h[j] = compute(this.e[j] = new Owner(), mapper, null);
2105
2109
  }
2106
2110
  this.o = newLen;
2107
2111
  } else {
2108
2112
  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;
2109
- for (start = 0, end = Math.min(this.o, newLen); start < end && (this.F[start] === newItems[start] || this.p && compare(this.R, this.F[start], newItems[start])); start++) {
2113
+ for (start = 0, end = Math.min(this.o, newLen); start < end && (this.F[start] === newItems[start] || this.p && compare(this.S, this.F[start], newItems[start])); start++) {
2110
2114
  if (this.p)
2111
2115
  this.p[start].write(newItems[start]);
2112
2116
  }
2113
- for (end = this.o - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.F[end] === newItems[newEnd] || this.p && compare(this.R, this.F[end], newItems[newEnd])); end--, newEnd--) {
2114
- temp[newEnd] = this.i[end];
2115
- tempNodes[newEnd] = this.d[end];
2117
+ for (end = this.o - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.F[end] === newItems[newEnd] || this.p && compare(this.S, this.F[end], newItems[newEnd])); end--, newEnd--) {
2118
+ temp[newEnd] = this.h[end];
2119
+ tempNodes[newEnd] = this.e[end];
2116
2120
  tempRows && (tempRows[newEnd] = this.p[end]);
2117
2121
  tempIndexes && (tempIndexes[newEnd] = this.q[end]);
2118
2122
  }
@@ -2120,29 +2124,29 @@ function updateKeyedMap() {
2120
2124
  newIndicesNext = new Array(newEnd + 1);
2121
2125
  for (j = newEnd; j >= start; j--) {
2122
2126
  item = newItems[j];
2123
- key = this.R ? this.R(item) : item;
2127
+ key = this.S ? this.S(item) : item;
2124
2128
  i = newIndices.get(key);
2125
2129
  newIndicesNext[j] = i === void 0 ? -1 : i;
2126
2130
  newIndices.set(key, j);
2127
2131
  }
2128
2132
  for (i = start; i <= end; i++) {
2129
2133
  item = this.F[i];
2130
- key = this.R ? this.R(item) : item;
2134
+ key = this.S ? this.S(item) : item;
2131
2135
  j = newIndices.get(key);
2132
2136
  if (j !== void 0 && j !== -1) {
2133
- temp[j] = this.i[i];
2134
- tempNodes[j] = this.d[i];
2137
+ temp[j] = this.h[i];
2138
+ tempNodes[j] = this.e[i];
2135
2139
  tempRows && (tempRows[j] = this.p[i]);
2136
2140
  tempIndexes && (tempIndexes[j] = this.q[i]);
2137
2141
  j = newIndicesNext[j];
2138
2142
  newIndices.set(key, j);
2139
2143
  } else
2140
- this.d[i].dispose();
2144
+ this.e[i].dispose();
2141
2145
  }
2142
2146
  for (j = start; j < newLen; j++) {
2143
2147
  if (j in temp) {
2144
- this.i[j] = temp[j];
2145
- this.d[j] = tempNodes[j];
2148
+ this.h[j] = temp[j];
2149
+ this.e[j] = tempNodes[j];
2146
2150
  if (tempRows) {
2147
2151
  this.p[j] = tempRows[j];
2148
2152
  this.p[j].write(newItems[j]);
@@ -2152,24 +2156,24 @@ function updateKeyedMap() {
2152
2156
  this.q[j].write(j);
2153
2157
  }
2154
2158
  } else {
2155
- this.i[j] = compute(this.d[j] = new Owner(), mapper, null);
2159
+ this.h[j] = compute(this.e[j] = new Owner(), mapper, null);
2156
2160
  }
2157
2161
  }
2158
- this.i = this.i.slice(0, this.o = newLen);
2162
+ this.h = this.h.slice(0, this.o = newLen);
2159
2163
  this.F = newItems.slice(0);
2160
2164
  }
2161
2165
  });
2162
- return this.i;
2166
+ return this.h;
2163
2167
  }
2164
2168
  function repeat(count, map, options) {
2165
2169
  return updateRepeat.bind({
2166
2170
  U: new Owner(),
2167
2171
  o: 0,
2168
- x: 0,
2172
+ A: 0,
2169
2173
  ja: count,
2170
- Q: map,
2171
- d: [],
2172
- i: [],
2174
+ R: map,
2175
+ e: [],
2176
+ h: [],
2173
2177
  ka: options?.from,
2174
2178
  V: options?.fallback
2175
2179
  });
@@ -2181,13 +2185,13 @@ function updateRepeat() {
2181
2185
  if (newLen === 0) {
2182
2186
  if (this.o !== 0) {
2183
2187
  this.U.dispose(false);
2184
- this.d = [];
2185
- this.i = [];
2188
+ this.e = [];
2189
+ this.h = [];
2186
2190
  this.o = 0;
2187
2191
  }
2188
- if (this.V && !this.i[0]) {
2189
- this.i[0] = compute(
2190
- this.d[0] = new Owner(),
2192
+ if (this.V && !this.h[0]) {
2193
+ this.h[0] = compute(
2194
+ this.e[0] = new Owner(),
2191
2195
  this.V,
2192
2196
  null
2193
2197
  );
@@ -2195,46 +2199,46 @@ function updateRepeat() {
2195
2199
  return;
2196
2200
  }
2197
2201
  const to = from + newLen;
2198
- const prevTo = this.x + this.o;
2199
- if (this.o === 0 && this.d[0])
2200
- this.d[0].dispose();
2202
+ const prevTo = this.A + this.o;
2203
+ if (this.o === 0 && this.e[0])
2204
+ this.e[0].dispose();
2201
2205
  for (let i = to; i < prevTo; i++)
2202
- this.d[i - this.x].dispose();
2203
- if (this.x < from) {
2204
- let i = this.x;
2206
+ this.e[i - this.A].dispose();
2207
+ if (this.A < from) {
2208
+ let i = this.A;
2205
2209
  while (i < from && i < this.o)
2206
- this.d[i++].dispose();
2207
- this.d.splice(0, from - this.x);
2208
- this.i.splice(0, from - this.x);
2209
- } else if (this.x > from) {
2210
- let i = prevTo - this.x - 1;
2211
- let difference = this.x - from;
2212
- this.d.length = this.i.length = newLen;
2210
+ this.e[i++].dispose();
2211
+ this.e.splice(0, from - this.A);
2212
+ this.h.splice(0, from - this.A);
2213
+ } else if (this.A > from) {
2214
+ let i = prevTo - this.A - 1;
2215
+ let difference = this.A - from;
2216
+ this.e.length = this.h.length = newLen;
2213
2217
  while (i >= difference) {
2214
- this.d[i] = this.d[i - difference];
2215
- this.i[i] = this.i[i - difference];
2218
+ this.e[i] = this.e[i - difference];
2219
+ this.h[i] = this.h[i - difference];
2216
2220
  i--;
2217
2221
  }
2218
2222
  for (let i2 = 0; i2 < difference; i2++) {
2219
- this.i[i2] = compute(
2220
- this.d[i2] = new Owner(),
2221
- () => this.Q(i2 + from),
2223
+ this.h[i2] = compute(
2224
+ this.e[i2] = new Owner(),
2225
+ () => this.R(i2 + from),
2222
2226
  null
2223
2227
  );
2224
2228
  }
2225
2229
  }
2226
2230
  for (let i = prevTo; i < to; i++) {
2227
- this.i[i - from] = compute(
2228
- this.d[i - from] = new Owner(),
2229
- () => this.Q(i),
2231
+ this.h[i - from] = compute(
2232
+ this.e[i - from] = new Owner(),
2233
+ () => this.R(i),
2230
2234
  null
2231
2235
  );
2232
2236
  }
2233
- this.i = this.i.slice(0, newLen);
2234
- this.x = from;
2237
+ this.h = this.h.slice(0, newLen);
2238
+ this.A = from;
2235
2239
  this.o = newLen;
2236
2240
  });
2237
- return this.i;
2241
+ return this.h;
2238
2242
  }
2239
2243
  function compare(key, a, b) {
2240
2244
  return key ? key(a) === key(b) : true;
@@ -2249,7 +2253,7 @@ var BoundaryComputation = class extends EagerComputation {
2249
2253
  }
2250
2254
  write(value, flags) {
2251
2255
  super.write(value, flags & ~this.W);
2252
- if (this.W & LOADING_BIT && !(this.h & UNINITIALIZED_BIT || ActiveTransition)) {
2256
+ if (this.W & LOADING_BIT && !(this.i & UNINITIALIZED_BIT || ActiveTransition)) {
2253
2257
  flags &= ~LOADING_BIT;
2254
2258
  }
2255
2259
  getQueue(this).notify(this, this.W, flags);
@@ -2257,9 +2261,9 @@ var BoundaryComputation = class extends EagerComputation {
2257
2261
  }
2258
2262
  };
2259
2263
  function createBoundChildren(owner, fn, queue, mask) {
2260
- const parentQueue = owner.z;
2261
- parentQueue.addChild(owner.z = queue);
2262
- onCleanup(() => parentQueue.removeChild(owner.z));
2264
+ const parentQueue = owner.C;
2265
+ parentQueue.addChild(owner.C = queue);
2266
+ onCleanup(() => parentQueue.removeChild(owner.C));
2263
2267
  return compute(
2264
2268
  owner,
2265
2269
  () => {
@@ -2270,25 +2274,25 @@ function createBoundChildren(owner, fn, queue, mask) {
2270
2274
  );
2271
2275
  }
2272
2276
  var ConditionalQueue = class extends Queue {
2273
- s;
2277
+ x;
2274
2278
  X = /* @__PURE__ */ new Set();
2275
- r = /* @__PURE__ */ new Set();
2279
+ s = /* @__PURE__ */ new Set();
2276
2280
  constructor(disabled) {
2277
2281
  super();
2278
- this.s = disabled;
2282
+ this.x = disabled;
2279
2283
  }
2280
2284
  run(type) {
2281
- if (!type || this.s.read())
2285
+ if (!type || this.x.read())
2282
2286
  return;
2283
2287
  return super.run(type);
2284
2288
  }
2285
2289
  notify(node, type, flags) {
2286
- if (this.s.read()) {
2290
+ if (this.x.read()) {
2287
2291
  if (type & LOADING_BIT) {
2288
2292
  if (flags & LOADING_BIT) {
2289
- this.r.add(node);
2293
+ this.s.add(node);
2290
2294
  type &= ~LOADING_BIT;
2291
- } else if (this.r.delete(node))
2295
+ } else if (this.s.delete(node))
2292
2296
  type &= ~LOADING_BIT;
2293
2297
  }
2294
2298
  if (type & ERROR_BIT) {
@@ -2302,21 +2306,21 @@ var ConditionalQueue = class extends Queue {
2302
2306
  return type ? super.notify(node, type, flags) : true;
2303
2307
  }
2304
2308
  merge(queue) {
2305
- queue.r.forEach((n) => this.notify(n, LOADING_BIT, LOADING_BIT));
2309
+ queue.s.forEach((n) => this.notify(n, LOADING_BIT, LOADING_BIT));
2306
2310
  queue.X.forEach((n) => this.notify(n, ERROR_BIT, ERROR_BIT));
2307
2311
  super.merge(queue);
2308
2312
  }
2309
2313
  };
2310
2314
  var CollectionQueue = class extends Queue {
2311
2315
  K;
2312
- d = /* @__PURE__ */ new Set();
2313
- s = new Computation(false, null, { pureWrite: true });
2316
+ e = /* @__PURE__ */ new Set();
2317
+ x = new Computation(false, null, { pureWrite: true });
2314
2318
  constructor(type) {
2315
2319
  super();
2316
2320
  this.K = type;
2317
2321
  }
2318
2322
  run(type) {
2319
- if (!type || this.s.read())
2323
+ if (!type || this.x.read())
2320
2324
  return;
2321
2325
  return super.run(type);
2322
2326
  }
@@ -2324,19 +2328,19 @@ var CollectionQueue = class extends Queue {
2324
2328
  if (!(type & this.K))
2325
2329
  return super.notify(node, type, flags);
2326
2330
  if (flags & this.K) {
2327
- this.d.add(node);
2328
- if (this.d.size === 1)
2329
- this.s.write(true);
2330
- } else if (this.d.size > 0) {
2331
- this.d.delete(node);
2332
- if (this.d.size === 0)
2333
- this.s.write(false);
2331
+ this.e.add(node);
2332
+ if (this.e.size === 1)
2333
+ this.x.write(true);
2334
+ } else if (this.e.size > 0) {
2335
+ this.e.delete(node);
2336
+ if (this.e.size === 0)
2337
+ this.x.write(false);
2334
2338
  }
2335
2339
  type &= ~this.K;
2336
2340
  return type ? super.notify(node, type, flags) : true;
2337
2341
  }
2338
2342
  merge(queue) {
2339
- queue.d.forEach((n) => this.notify(n, this.K, this.K));
2343
+ queue.e.forEach((n) => this.notify(n, this.K, this.K));
2340
2344
  super.merge(queue);
2341
2345
  }
2342
2346
  };
@@ -2347,25 +2351,25 @@ function createBoundary(fn, condition) {
2347
2351
  );
2348
2352
  const tree = createBoundChildren(owner, fn, queue, 0);
2349
2353
  new EagerComputation(void 0, () => {
2350
- const disabled = queue.s.read();
2354
+ const disabled = queue.x.read();
2351
2355
  tree.W = disabled ? ERROR_BIT | LOADING_BIT : 0;
2352
2356
  if (!disabled) {
2353
- queue.r.forEach((node) => queue.notify(node, LOADING_BIT, LOADING_BIT));
2357
+ queue.s.forEach((node) => queue.notify(node, LOADING_BIT, LOADING_BIT));
2354
2358
  queue.X.forEach((node) => queue.notify(node, ERROR_BIT, ERROR_BIT));
2355
- queue.r.clear();
2359
+ queue.s.clear();
2356
2360
  queue.X.clear();
2357
2361
  }
2358
2362
  });
2359
- return () => queue.s.read() ? void 0 : tree.read();
2363
+ return () => queue.x.read() ? void 0 : tree.read();
2360
2364
  }
2361
2365
  function createCollectionBoundary(type, fn, fallback) {
2362
2366
  const owner = new Owner();
2363
2367
  const queue = new CollectionQueue(type);
2364
2368
  const tree = createBoundChildren(owner, fn, queue, type);
2365
2369
  const decision = new Computation(void 0, () => {
2366
- if (!queue.s.read()) {
2370
+ if (!queue.x.read()) {
2367
2371
  const resolved = tree.read();
2368
- if (!untrack(() => queue.s.read()))
2372
+ if (!untrack(() => queue.x.read()))
2369
2373
  return resolved;
2370
2374
  }
2371
2375
  return fallback(queue);
@@ -2377,14 +2381,14 @@ function createSuspense(fn, fallback) {
2377
2381
  }
2378
2382
  function createErrorBoundary(fn, fallback) {
2379
2383
  return createCollectionBoundary(ERROR_BIT, fn, (queue) => {
2380
- let node = getTransitionSource(queue.d.values().next().value);
2381
- return fallback(node.M, () => {
2384
+ let node = getTransitionSource(queue.e.values().next().value);
2385
+ return fallback(node.O, () => {
2382
2386
  incrementClock();
2383
- for (let node2 of queue.d) {
2384
- if (ActiveTransition && !node2.e)
2387
+ for (let node2 of queue.e) {
2388
+ if (ActiveTransition && !node2.d)
2385
2389
  node2 = cloneGraph(node2);
2386
- node2.c = STATE_DIRTY;
2387
- getQueue(node2).enqueue(node2.A, node2.E.bind(node2));
2390
+ node2.b = STATE_DIRTY;
2391
+ getQueue(node2).enqueue(node2.r, node2.w.bind(node2));
2388
2392
  }
2389
2393
  });
2390
2394
  });
@@ -2444,4 +2448,4 @@ function flattenArray(children, results = [], options) {
2444
2448
  return needsUnwrap;
2445
2449
  }
2446
2450
 
2447
- export { $PROXY, $TARGET, $TRACK, Computation, ContextNotFoundError, NoOwnerError, NotReadyError, Owner, Queue, SUPPORTS_PROXY, createAsync, createBoundary, createContext, createEffect, createErrorBoundary, createMemo, createOptimistic, createProjection, createRenderEffect, createRoot, createSignal, createStore, createSuspense, deep, flatten, flush, getContext, getObserver, getOwner, hasContext, hasUpdated, isEqual, isPending, isWrappable, latest, mapArray, merge, omit, onCleanup, reconcile, repeat, resolve, runWithObserver, runWithOwner, setContext, snapshot, transition, untrack, useTransition };
2451
+ export { $PROXY, $TARGET, $TRACK, Computation, ContextNotFoundError, NoOwnerError, NotReadyError, Owner, Queue, SUPPORTS_PROXY, createAsync, createBoundary, createContext, createEffect, createErrorBoundary, createMemo, createOptimistic, createOptimisticStore, createProjection, createReaction, createRenderEffect, createRoot, createSignal, createStore, createSuspense, createTrackedEffect, deep, flatten, flush, getContext, getObserver, getOwner, hasContext, hasUpdated, isEqual, isPending, isWrappable, latest, mapArray, merge, omit, onCleanup, reconcile, repeat, resolve, runWithOwner, setContext, snapshot, transition, untrack, useTransition };