@solidjs/signals 0.7.0 → 0.7.2

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,7 +45,7 @@ function schedule() {
45
45
  if (scheduled)
46
46
  return;
47
47
  scheduled = true;
48
- if (!globalQueue.B)
48
+ if (!globalQueue.C)
49
49
  queueMicrotask(flush);
50
50
  }
51
51
  function notifyUnobserved() {
@@ -59,14 +59,14 @@ function notifyUnobserved() {
59
59
  var pureQueue = [];
60
60
  var Queue = class {
61
61
  k = null;
62
- B = false;
63
- g = [[], []];
64
- f = [];
62
+ C = false;
63
+ f = [[], []];
64
+ g = [];
65
65
  created = clock;
66
66
  enqueue(type, fn) {
67
67
  pureQueue.push(fn);
68
68
  if (type)
69
- this.g[type - 1].push(fn);
69
+ this.f[type - 1].push(fn);
70
70
  schedule();
71
71
  }
72
72
  run(type) {
@@ -74,19 +74,19 @@ var Queue = class {
74
74
  pureQueue.length && runQueue(pureQueue, type);
75
75
  pureQueue = [];
76
76
  return;
77
- } else if (this.g[type - 1].length) {
78
- const effects = this.g[type - 1];
79
- this.g[type - 1] = [];
77
+ } else if (this.f[type - 1].length) {
78
+ const effects = this.f[type - 1];
79
+ this.f[type - 1] = [];
80
80
  runQueue(effects, type);
81
81
  }
82
- for (let i = 0; i < this.f.length; i++) {
83
- this.f[i].run(type);
82
+ for (let i = 0; i < this.g.length; i++) {
83
+ this.g[i].run(type);
84
84
  }
85
85
  }
86
86
  flush() {
87
- if (this.B)
87
+ if (this.C)
88
88
  return;
89
- this.B = true;
89
+ this.C = true;
90
90
  try {
91
91
  this.run(EFFECT_PURE);
92
92
  incrementClock();
@@ -94,22 +94,22 @@ var Queue = class {
94
94
  this.run(EFFECT_RENDER);
95
95
  this.run(EFFECT_USER);
96
96
  } finally {
97
- this.B = false;
97
+ this.C = false;
98
98
  Unobserved.length && notifyUnobserved();
99
99
  }
100
100
  }
101
101
  addChild(child) {
102
- if (ActiveTransition && ActiveTransition.G.has(this))
103
- return ActiveTransition.G.get(this).addChild(child);
104
- this.f.push(child);
102
+ if (ActiveTransition && ActiveTransition.J.has(this))
103
+ return ActiveTransition.J.get(this).addChild(child);
104
+ this.g.push(child);
105
105
  child.k = this;
106
106
  }
107
107
  removeChild(child) {
108
- if (ActiveTransition && ActiveTransition.G.has(this))
109
- return ActiveTransition.G.get(this).removeChild(child);
110
- const index = this.f.indexOf(child);
108
+ if (ActiveTransition && ActiveTransition.J.has(this))
109
+ return ActiveTransition.J.get(this).removeChild(child);
110
+ const index = this.g.indexOf(child);
111
111
  if (index >= 0) {
112
- this.f.splice(index, 1);
112
+ this.g.splice(index, 1);
113
113
  child.k = null;
114
114
  }
115
115
  }
@@ -119,14 +119,14 @@ var Queue = class {
119
119
  return false;
120
120
  }
121
121
  merge(queue) {
122
- this.g[0].push.apply(this.g[0], queue.g[0]);
123
- this.g[1].push.apply(this.g[1], queue.g[1]);
124
- for (let i = 0; i < queue.f.length; i++) {
125
- const og = this.f.find((c) => c.d === queue.f[i].d);
122
+ this.f[0].push.apply(this.f[0], queue.f[0]);
123
+ this.f[1].push.apply(this.f[1], queue.f[1]);
124
+ for (let i = 0; i < queue.g.length; i++) {
125
+ const og = this.g.find((c) => c.d === queue.g[i].d);
126
126
  if (og)
127
- og.merge(queue.f[i]);
127
+ og.merge(queue.g[i]);
128
128
  else
129
- this.addChild(queue.f[i]);
129
+ this.addChild(queue.g[i]);
130
130
  }
131
131
  }
132
132
  };
@@ -157,49 +157,49 @@ function runQueue(queue, type) {
157
157
  }
158
158
  var Transition = class _Transition {
159
159
  a = /* @__PURE__ */ new Map();
160
- s = /* @__PURE__ */ new Set();
161
- H = /* @__PURE__ */ new Set();
162
- I = /* @__PURE__ */ new Set();
160
+ t = /* @__PURE__ */ new Set();
161
+ K = /* @__PURE__ */ new Set();
162
+ r = /* @__PURE__ */ new Set();
163
163
  D = false;
164
- g = [[], []];
165
- G = /* @__PURE__ */ new Map();
166
- J = [];
167
- f = [];
164
+ f = [[], []];
165
+ J = /* @__PURE__ */ new Map();
166
+ G = [];
167
+ g = [];
168
168
  k = null;
169
- B = false;
169
+ C = false;
170
170
  Y = false;
171
171
  d = globalQueue;
172
172
  created = clock;
173
173
  constructor() {
174
- this.G.set(globalQueue, this);
175
- for (const child of globalQueue.f) {
174
+ this.J.set(globalQueue, this);
175
+ for (const child of globalQueue.g) {
176
176
  cloneQueue(child, this, this);
177
177
  }
178
178
  }
179
179
  enqueue(type, fn) {
180
- this.J.push(fn);
180
+ this.G.push(fn);
181
181
  if (type)
182
- this.g[type - 1].push(fn);
182
+ this.f[type - 1].push(fn);
183
183
  this.schedule();
184
184
  }
185
185
  run(type) {
186
186
  if (type === EFFECT_PURE) {
187
- this.J.length && runQueue(this.J, type);
188
- this.J = [];
187
+ this.G.length && runQueue(this.G, type);
188
+ this.G = [];
189
189
  return;
190
- } else if (this.g[type - 1].length) {
191
- const effects = this.g[type - 1];
192
- this.g[type - 1] = [];
190
+ } else if (this.f[type - 1].length) {
191
+ const effects = this.f[type - 1];
192
+ this.f[type - 1] = [];
193
193
  runQueue(effects, type);
194
194
  }
195
- for (let i = 0; i < this.f.length; i++) {
196
- this.f[i].run(type);
195
+ for (let i = 0; i < this.g.length; i++) {
196
+ this.g[i].run(type);
197
197
  }
198
198
  }
199
199
  flush() {
200
- if (this.B)
200
+ if (this.C || this.D)
201
201
  return;
202
- this.B = true;
202
+ this.C = true;
203
203
  let currentTransition = ActiveTransition;
204
204
  ActiveTransition = this;
205
205
  try {
@@ -209,46 +209,49 @@ var Transition = class _Transition {
209
209
  ActiveTransition = currentTransition;
210
210
  finishTransition(this);
211
211
  } finally {
212
- this.B = false;
212
+ this.C = false;
213
213
  ActiveTransition = currentTransition;
214
214
  }
215
215
  }
216
216
  addChild(child) {
217
- this.f.push(child);
217
+ this.g.push(child);
218
218
  child.k = this;
219
219
  }
220
220
  removeChild(child) {
221
- const index = this.f.indexOf(child);
221
+ const index = this.g.indexOf(child);
222
222
  if (index >= 0)
223
- this.f.splice(index, 1);
223
+ this.g.splice(index, 1);
224
224
  }
225
225
  notify(node, type, flags) {
226
226
  if (!(type & LOADING_BIT))
227
227
  return false;
228
228
  if (flags & LOADING_BIT) {
229
- this.s.add(node);
229
+ this.t.add(node);
230
230
  } else {
231
- this.s.delete(node);
231
+ this.t.delete(node);
232
232
  }
233
233
  return true;
234
234
  }
235
235
  merge(queue) {
236
- this.g[0].push.apply(this.g[0], queue.g[0]);
237
- this.g[1].push.apply(this.g[1], queue.g[1]);
238
- this.J.push.apply(this.J, queue.J);
239
- for (let i = 0; i < queue.f.length; i++) {
240
- const og = this.f.find((c) => c.d === queue.f[i].d);
236
+ this.f[0].push.apply(this.f[0], queue.f[0]);
237
+ this.f[1].push.apply(this.f[1], queue.f[1]);
238
+ this.G.push.apply(this.G, queue.G);
239
+ queue.f[0].length = 0;
240
+ queue.f[1].length = 0;
241
+ queue.G.length = 0;
242
+ for (let i = 0; i < queue.g.length; i++) {
243
+ const og = this.g.find((c) => c.d === queue.g[i].d);
241
244
  if (og)
242
- og.merge(queue.f[i]);
245
+ og.merge(queue.g[i]);
243
246
  else
244
- this.addChild(queue.f[i]);
247
+ this.addChild(queue.g[i]);
245
248
  }
246
249
  }
247
250
  schedule() {
248
251
  if (this.Y)
249
252
  return;
250
253
  this.Y = true;
251
- if (!this.B)
254
+ if (!this.C)
252
255
  queueMicrotask(() => this.flush());
253
256
  }
254
257
  runTransition(fn, force = false) {
@@ -268,13 +271,14 @@ var Transition = class _Transition {
268
271
  (async function() {
269
272
  let temp, value;
270
273
  while (!(temp = result.next(value)).done) {
274
+ transition2 = ActiveTransition;
271
275
  if (temp.value instanceof Promise) {
272
- transition2.H.add(temp.value);
276
+ transition2.K.add(temp.value);
273
277
  try {
274
278
  value = await temp.value;
275
279
  } finally {
276
280
  transition2 = latestTransition(transition2);
277
- transition2.H.delete(temp.value);
281
+ transition2.K.delete(temp.value);
278
282
  }
279
283
  ActiveTransition = transition2;
280
284
  } else
@@ -285,10 +289,10 @@ var Transition = class _Transition {
285
289
  })();
286
290
  }
287
291
  if (result instanceof Promise) {
288
- transition2.H.add(result);
292
+ transition2.K.add(result);
289
293
  result.finally(() => {
290
294
  transition2 = latestTransition(transition2);
291
- transition2.H.delete(result);
295
+ transition2.K.delete(result);
292
296
  ActiveTransition = null;
293
297
  finishTransition(transition2);
294
298
  });
@@ -306,14 +310,16 @@ var Transition = class _Transition {
306
310
  return;
307
311
  }
308
312
  fn.j = this;
309
- this.I.add(fn);
313
+ this.r.add(fn);
310
314
  }
311
315
  };
312
316
  function transition(fn) {
313
317
  let t = new Transition();
314
318
  queueMicrotask(() => t.runTransition(() => fn((fn2) => t.runTransition(fn2))));
315
319
  }
316
- function cloneGraph(node, optimistic) {
320
+ function cloneGraph(node) {
321
+ if (node.r)
322
+ return node;
317
323
  if (node.j) {
318
324
  if (node.j !== ActiveTransition) {
319
325
  mergeTransitions(node.j, ActiveTransition);
@@ -327,20 +333,19 @@ function cloneGraph(node, optimistic) {
327
333
  m: null,
328
334
  c: null,
329
335
  a: node.a ? [...node.a] : null,
330
- d: node,
331
- I: !!optimistic
336
+ d: node
332
337
  });
333
338
  delete clone.T;
334
339
  ActiveTransition.a.set(node, clone);
335
340
  node.j = ActiveTransition;
336
- if (!optimistic && node.a) {
341
+ if (node.a) {
337
342
  for (let i = 0; i < node.a.length; i++)
338
343
  node.a[i].c.push(clone);
339
344
  }
340
345
  if (node.c) {
341
346
  clone.c = [];
342
347
  for (let i = 0, length = node.c.length; i < length; i++) {
343
- !node.c[i].d && clone.c.push(cloneGraph(node.c[i], optimistic));
348
+ !node.c[i].d && clone.c.push(cloneGraph(node.c[i]));
344
349
  }
345
350
  }
346
351
  return clone;
@@ -368,14 +373,14 @@ function cloneQueue(queue, parent, transition2) {
368
373
  Object.assign(clone, queue, {
369
374
  d: queue,
370
375
  k: parent,
371
- f: [],
376
+ g: [],
372
377
  enqueue(type, fn) {
373
378
  transition2 = latestTransition(transition2);
374
379
  transition2.enqueue(type, fn);
375
380
  },
376
381
  notify(node, type, flags) {
377
382
  node = node.d || node;
378
- if (!clone.K || type & LOADING_BIT) {
383
+ if (!clone.L || type & LOADING_BIT) {
379
384
  type &= ~LOADING_BIT;
380
385
  transition2 = latestTransition(transition2);
381
386
  transition2.notify(node, LOADING_BIT, flags);
@@ -385,9 +390,9 @@ function cloneQueue(queue, parent, transition2) {
385
390
  return queue.notify.call(this, node, type, flags);
386
391
  }
387
392
  });
388
- parent.f.push(clone);
389
- transition2.G.set(queue, clone);
390
- for (const child of queue.f) {
393
+ parent.g.push(clone);
394
+ transition2.J.set(queue, clone);
395
+ for (const child of queue.g) {
391
396
  cloneQueue(child, clone, transition2);
392
397
  }
393
398
  }
@@ -395,11 +400,11 @@ function resolveQueues(children) {
395
400
  for (const child of children) {
396
401
  const og = child.d;
397
402
  if (og) {
398
- const clonedChildren = child.f;
403
+ const clonedChildren = child.g;
399
404
  delete child.enqueue;
400
405
  delete child.notify;
401
406
  delete child.k;
402
- delete child.f;
407
+ delete child.g;
403
408
  Object.assign(og, child);
404
409
  delete og.d;
405
410
  resolveQueues(clonedChildren);
@@ -413,12 +418,12 @@ function mergeTransitions(t1, t2) {
413
418
  key.j = t1;
414
419
  t1.a.set(key, value);
415
420
  });
416
- t2.I.forEach((c) => {
421
+ t2.r.forEach((c) => {
417
422
  c.j = t1;
418
- t1.I.add(c);
423
+ t1.r.add(c);
419
424
  });
420
- t2.H.forEach((p) => t1.H.add(p));
421
- t2.s.forEach((n) => t1.s.add(n));
425
+ t2.K.forEach((p) => t1.K.add(p));
426
+ t2.t.forEach((n) => t1.t.add(n));
422
427
  t1.merge(t2);
423
428
  t2.D = t1;
424
429
  }
@@ -427,7 +432,7 @@ function getTransitionSource(input) {
427
432
  }
428
433
  function getQueue(node) {
429
434
  const transition2 = ActiveTransition || node.d?.j;
430
- return transition2 && transition2.G.get(node.C) || node.C;
435
+ return transition2 && transition2.J.get(node.E) || node.E;
431
436
  }
432
437
  function initialDispose(node) {
433
438
  let current = node.m;
@@ -440,11 +445,11 @@ function initialDispose(node) {
440
445
  }
441
446
  }
442
447
  function finishTransition(transition2) {
443
- if (transition2.D || transition2.Y || transition2.H.size || transition2.s.size)
448
+ if (transition2.D || transition2.Y || transition2.K.size || transition2.t.size)
444
449
  return;
445
- globalQueue.g[0].push.apply(globalQueue.g[0], transition2.g[0]);
446
- globalQueue.g[1].push.apply(globalQueue.g[1], transition2.g[1]);
447
- resolveQueues(transition2.f);
450
+ globalQueue.f[0].push.apply(globalQueue.f[0], transition2.f[0]);
451
+ globalQueue.f[1].push.apply(globalQueue.f[1], transition2.f[1]);
452
+ resolveQueues(transition2.g);
448
453
  for (const [source, clone] of transition2.a) {
449
454
  if (source === clone || source.j !== transition2) {
450
455
  delete source.j;
@@ -452,12 +457,6 @@ function finishTransition(transition2) {
452
457
  }
453
458
  if (clone.a)
454
459
  replaceSourceObservers(clone, transition2);
455
- if (clone.I) {
456
- clone.dispose();
457
- clone.emptyDisposal();
458
- delete source.j;
459
- continue;
460
- }
461
460
  if (clone.Z || clone.b === STATE_DISPOSED) {
462
461
  source.dispose(clone.b === STATE_DISPOSED);
463
462
  source.emptyDisposal();
@@ -469,8 +468,8 @@ function finishTransition(transition2) {
469
468
  Object.assign(source, clone);
470
469
  delete source.d;
471
470
  let current = clone.m;
472
- if (current?.y === clone)
473
- current.y = source;
471
+ if (current?.z === clone)
472
+ current.z = source;
474
473
  while (current?.k === clone) {
475
474
  current.k = source;
476
475
  current = current.m;
@@ -478,7 +477,7 @@ function finishTransition(transition2) {
478
477
  delete source.j;
479
478
  }
480
479
  transition2.D = true;
481
- for (const reset of transition2.I) {
480
+ for (const reset of transition2.r) {
482
481
  delete reset.j;
483
482
  reset();
484
483
  }
@@ -502,11 +501,11 @@ var Owner = class {
502
501
  // See comment at the top of the file for an example of the _nextSibling traversal
503
502
  k = null;
504
503
  m = null;
505
- y = null;
504
+ z = null;
506
505
  b = STATE_CLEAN;
507
506
  n = null;
508
- z = defaultContext;
509
- C = globalQueue;
507
+ A = defaultContext;
508
+ E = globalQueue;
510
509
  fa = 0;
511
510
  id = null;
512
511
  constructor(id = null, skipAppend = false) {
@@ -517,23 +516,23 @@ var Owner = class {
517
516
  }
518
517
  append(child) {
519
518
  child.k = this;
520
- child.y = this;
519
+ child.z = this;
521
520
  if (this.m)
522
- this.m.y = child;
521
+ this.m.z = child;
523
522
  child.m = this.m;
524
523
  this.m = child;
525
524
  if (this.id != null && child.id == null)
526
525
  child.id = this.getNextChildId();
527
- if (child.z !== this.z) {
528
- child.z = { ...this.z, ...child.z };
526
+ if (child.A !== this.A) {
527
+ child.A = { ...this.A, ...child.A };
529
528
  }
530
- if (this.C)
531
- child.C = this.C;
529
+ if (this.E)
530
+ child.E = this.E;
532
531
  }
533
532
  dispose(self = true) {
534
533
  if (this.b === STATE_DISPOSED)
535
534
  return;
536
- let head = self ? this.y || this.k : this, current = this.m, next = null;
535
+ let head = self ? this.z || this.k : this, current = this.m, next = null;
537
536
  while (current && current.k === this) {
538
537
  current.dispose(true);
539
538
  next = current.m;
@@ -542,18 +541,18 @@ var Owner = class {
542
541
  }
543
542
  this.fa = 0;
544
543
  if (self)
545
- this.L();
544
+ this.M();
546
545
  if (current)
547
- current.y = !self ? this : this.y;
546
+ current.z = !self ? this : this.z;
548
547
  if (head)
549
548
  head.m = current;
550
549
  }
551
- L() {
552
- if (this.y)
553
- this.y.m = null;
550
+ M() {
551
+ if (this.z)
552
+ this.z.m = null;
554
553
  this.k = null;
555
- this.y = null;
556
- this.z = defaultContext;
554
+ this.z = null;
555
+ this.A = defaultContext;
557
556
  this.b = STATE_DISPOSED;
558
557
  this.emptyDisposal();
559
558
  }
@@ -583,7 +582,7 @@ function getContext(context, owner = currentOwner) {
583
582
  if (!owner) {
584
583
  throw new NoOwnerError();
585
584
  }
586
- const value = hasContext(context, owner) ? owner.z[context.id] : context.defaultValue;
585
+ const value = hasContext(context, owner) ? owner.A[context.id] : context.defaultValue;
587
586
  if (isUndefined(value)) {
588
587
  throw new ContextNotFoundError();
589
588
  }
@@ -593,13 +592,13 @@ function setContext(context, value, owner = currentOwner) {
593
592
  if (!owner) {
594
593
  throw new NoOwnerError();
595
594
  }
596
- owner.z = {
597
- ...owner.z,
595
+ owner.A = {
596
+ ...owner.A,
598
597
  [context.id]: isUndefined(value) ? context.defaultValue : value
599
598
  };
600
599
  }
601
600
  function hasContext(context, owner = currentOwner) {
602
- return !isUndefined(owner?.z[context.id]);
601
+ return !isUndefined(owner?.A[context.id]);
603
602
  }
604
603
  function onCleanup(fn) {
605
604
  if (!currentOwner)
@@ -649,19 +648,19 @@ var Computation = class extends Owner {
649
648
  ea;
650
649
  ha = false;
651
650
  /** Whether the computation is an error or has ancestors that are unresolved */
652
- i = 0;
651
+ h = 0;
653
652
  /** Which flags raised by sources are handled, vs. being passed through. */
654
653
  ba = DEFAULT_FLAGS;
655
654
  Q = -1;
656
- E = false;
655
+ H = false;
657
656
  j;
658
657
  d;
659
- I = false;
658
+ r = false;
660
659
  constructor(initialValue, compute2, options) {
661
660
  super(options?.id, compute2 === null);
662
661
  this.P = compute2;
663
662
  this.b = compute2 ? STATE_DIRTY : STATE_CLEAN;
664
- this.i = compute2 && initialValue === void 0 ? UNINITIALIZED_BIT : 0;
663
+ this.h = compute2 && initialValue === void 0 ? UNINITIALIZED_BIT : 0;
665
664
  this.l = initialValue;
666
665
  if (options?.equals !== void 0)
667
666
  this.aa = options.equals;
@@ -674,8 +673,8 @@ var Computation = class extends Owner {
674
673
  }
675
674
  ga() {
676
675
  track(this);
677
- newFlags |= this.i & ~currentMask;
678
- if (this.i & ERROR_BIT) {
676
+ newFlags |= this.h & ~currentMask;
677
+ if (this.h & ERROR_BIT) {
679
678
  throw this.O;
680
679
  } else {
681
680
  return this.l;
@@ -686,16 +685,16 @@ var Computation = class extends Owner {
686
685
  * Automatically re-executes the surrounding computation when the value changes
687
686
  */
688
687
  read() {
689
- if (ActiveTransition && (ActiveTransition.a.has(this) || !this.d && this.i & (UNINITIALIZED_BIT | ERROR_BIT))) {
688
+ if (ActiveTransition && (ActiveTransition.a.has(this) || !this.d && this.h & (UNINITIALIZED_BIT | ERROR_BIT))) {
690
689
  const clone = ActiveTransition.a.get(this) || cloneGraph(this);
691
690
  if (clone !== this)
692
691
  return clone.read();
693
692
  }
694
693
  if (this.P) {
695
- if (this.i & ERROR_BIT && this.Q <= clock)
694
+ if (this.h & ERROR_BIT && this.Q <= clock)
696
695
  update(this);
697
696
  else
698
- this.M();
697
+ this.F();
699
698
  }
700
699
  return this.ga();
701
700
  }
@@ -707,22 +706,22 @@ var Computation = class extends Owner {
707
706
  * before continuing
708
707
  */
709
708
  wait() {
710
- if (ActiveTransition && (ActiveTransition.a.has(this) || !this.d && this.i & (UNINITIALIZED_BIT | ERROR_BIT))) {
709
+ if (ActiveTransition && (ActiveTransition.a.has(this) || !this.d && this.h & (UNINITIALIZED_BIT | ERROR_BIT))) {
711
710
  const clone = ActiveTransition.a.get(this) || cloneGraph(this);
712
711
  if (clone !== this)
713
712
  return clone.wait();
714
713
  }
715
714
  if (this.P) {
716
- if (this.i & ERROR_BIT && this.Q <= clock)
715
+ if (this.h & ERROR_BIT && this.Q <= clock)
717
716
  update(this);
718
717
  else
719
- this.M();
718
+ this.F();
720
719
  }
721
- if ((notStale || this.i & UNINITIALIZED_BIT) && this.i & LOADING_BIT) {
720
+ if ((notStale || this.h & UNINITIALIZED_BIT) && this.h & LOADING_BIT) {
722
721
  track(this);
723
722
  throw new NotReadyError();
724
723
  }
725
- if (staleCheck && this.i & LOADING_BIT) {
724
+ if (staleCheck && this.h & LOADING_BIT) {
726
725
  staleCheck.l = true;
727
726
  }
728
727
  return this.ga();
@@ -735,19 +734,19 @@ var Computation = class extends Owner {
735
734
  return clone.write(value, flags, raw);
736
735
  }
737
736
  const newValue = !raw && typeof value === "function" ? value(this.l) : value;
738
- const valueChanged = newValue !== UNCHANGED && (!!(this.i & UNINITIALIZED_BIT) || // this._stateFlags & LOADING_BIT & ~flags ||
737
+ const valueChanged = newValue !== UNCHANGED && (!!(this.h & UNINITIALIZED_BIT) || // this._stateFlags & LOADING_BIT & ~flags ||
739
738
  this.aa === false || !this.aa(this.l, newValue));
740
739
  if (valueChanged) {
741
740
  this.l = newValue;
742
741
  this.O = void 0;
743
742
  }
744
- const changedFlagsMask = this.i ^ flags, changedFlags = changedFlagsMask & flags;
745
- this.i = flags;
743
+ const changedFlagsMask = this.h ^ flags, changedFlags = changedFlagsMask & flags;
744
+ this.h = flags;
746
745
  this.Q = clock + 1;
747
- if (this.c) {
746
+ if (this.c && !(this.r && ActiveTransition)) {
748
747
  for (let i = 0; i < this.c.length; i++) {
749
748
  if (valueChanged) {
750
- this.c[i].t(STATE_DIRTY);
749
+ this.c[i].u(STATE_DIRTY);
751
750
  } else if (changedFlagsMask) {
752
751
  this.c[i]._(changedFlagsMask, changedFlags);
753
752
  }
@@ -758,14 +757,14 @@ var Computation = class extends Owner {
758
757
  /**
759
758
  * Set the current node's state, and recursively mark all of this node's observers as STATE_CHECK
760
759
  */
761
- t(state, skipQueue) {
762
- if (this.b >= state && !this.E)
760
+ u(state, skipQueue) {
761
+ if (this.b >= state && !this.H)
763
762
  return;
764
- this.E = !!skipQueue;
763
+ this.H = !!skipQueue;
765
764
  this.b = state;
766
- if (this.c) {
765
+ if (this.c && !(this.r && ActiveTransition)) {
767
766
  for (let i = 0; i < this.c.length; i++) {
768
- this.c[i].t(STATE_CHECK, skipQueue);
767
+ this.c[i].u(STATE_CHECK, skipQueue);
769
768
  }
770
769
  }
771
770
  }
@@ -778,18 +777,18 @@ var Computation = class extends Owner {
778
777
  _(mask, newFlags2) {
779
778
  if (this.b >= STATE_DIRTY)
780
779
  return;
781
- if (mask & this.ba) {
782
- this.t(STATE_DIRTY);
780
+ if (mask & this.ba || this.r && ActiveTransition) {
781
+ this.u(STATE_DIRTY);
783
782
  return;
784
783
  }
785
- if (this.b >= STATE_CHECK && !this.E)
784
+ if (this.b >= STATE_CHECK && !this.H)
786
785
  return;
787
- const prevFlags = this.i & mask;
786
+ const prevFlags = this.h & mask;
788
787
  const deltaFlags = prevFlags ^ newFlags2;
789
788
  if (newFlags2 === prevFlags) ; else if (deltaFlags & prevFlags & mask) {
790
- this.t(STATE_CHECK);
789
+ this.u(STATE_CHECK);
791
790
  } else {
792
- this.i ^= deltaFlags;
791
+ this.h ^= deltaFlags;
793
792
  if (this.c) {
794
793
  for (let i = 0; i < this.c.length; i++) {
795
794
  this.c[i]._(mask, newFlags2);
@@ -804,7 +803,7 @@ var Computation = class extends Owner {
804
803
  return clone.N(error);
805
804
  }
806
805
  this.O = error;
807
- this.write(UNCHANGED, this.i & ~LOADING_BIT | ERROR_BIT | UNINITIALIZED_BIT);
806
+ this.write(UNCHANGED, this.h & ~LOADING_BIT | ERROR_BIT | UNINITIALIZED_BIT);
808
807
  }
809
808
  /**
810
809
  * This is the core part of the reactivity system, which makes sure that the values are updated
@@ -813,7 +812,7 @@ var Computation = class extends Owner {
813
812
  *
814
813
  * This function will ensure that the value and states we read from the computation are up to date
815
814
  */
816
- M() {
815
+ F() {
817
816
  if (!this.P) {
818
817
  return;
819
818
  }
@@ -827,8 +826,8 @@ var Computation = class extends Owner {
827
826
  if (this.b === STATE_CHECK) {
828
827
  for (let i = 0; i < this.a.length; i++) {
829
828
  const source = getTransitionSource(this.a[i]);
830
- source.M();
831
- observerFlags |= source.i & ~UNINITIALIZED_BIT;
829
+ source.F();
830
+ observerFlags |= source.h & ~UNINITIALIZED_BIT;
832
831
  if (this.b === STATE_DIRTY) {
833
832
  break;
834
833
  }
@@ -844,12 +843,12 @@ var Computation = class extends Owner {
844
843
  /**
845
844
  * Remove ourselves from the owner graph and the computation graph
846
845
  */
847
- L() {
846
+ M() {
848
847
  if (this.b === STATE_DISPOSED)
849
848
  return;
850
849
  if (this.a)
851
850
  removeSourceObservers(this, 0);
852
- super.L();
851
+ super.M();
853
852
  }
854
853
  };
855
854
  function track(computation) {
@@ -884,7 +883,7 @@ function update(node) {
884
883
  node.write(result, newFlags, true);
885
884
  } catch (error) {
886
885
  if (error instanceof NotReadyError) {
887
- node.write(UNCHANGED, newFlags | LOADING_BIT | node.i & UNINITIALIZED_BIT);
886
+ node.write(UNCHANGED, newFlags | LOADING_BIT | node.h & UNINITIALIZED_BIT);
888
887
  } else {
889
888
  node.N(error);
890
889
  }
@@ -995,29 +994,29 @@ function compute(owner, fn, observer) {
995
994
  var Effect = class extends Computation {
996
995
  ca;
997
996
  $;
998
- u;
997
+ w;
999
998
  da = false;
1000
999
  T;
1001
- r;
1000
+ s;
1002
1001
  constructor(initialValue, compute2, effect, error, options) {
1003
1002
  super(initialValue, compute2, options);
1004
1003
  this.ca = effect;
1005
1004
  this.$ = error;
1006
1005
  this.T = initialValue;
1007
- this.r = options?.render ? EFFECT_RENDER : EFFECT_USER;
1008
- if (this.r === EFFECT_RENDER) {
1006
+ this.s = options?.render ? EFFECT_RENDER : EFFECT_USER;
1007
+ if (this.s === EFFECT_RENDER) {
1009
1008
  this.P = function(p) {
1010
- return !this.d && clock > this.C.created && !(this.i & ERROR_BIT) ? latest(() => compute2(p)) : compute2(p);
1009
+ return !this.d && clock > this.E.created && !(this.h & ERROR_BIT) ? latest(() => compute2(p)) : compute2(p);
1011
1010
  };
1012
1011
  }
1013
- this.M();
1014
- !options?.defer && (this.r === EFFECT_USER ? getQueue(this).enqueue(this.r, this.w.bind(this)) : this.w(this.r));
1012
+ this.F();
1013
+ !options?.defer && (this.s === EFFECT_USER ? getQueue(this).enqueue(this.s, this.x.bind(this)) : this.x(this.s));
1015
1014
  }
1016
1015
  write(value, flags = 0) {
1017
1016
  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);
1017
+ this.h = flags;
1018
+ if (this.s === EFFECT_RENDER) {
1019
+ getQueue(this).notify(this, LOADING_BIT | ERROR_BIT, this.h);
1021
1020
  }
1022
1021
  }
1023
1022
  if (value === UNCHANGED)
@@ -1027,11 +1026,11 @@ var Effect = class extends Computation {
1027
1026
  this.O = void 0;
1028
1027
  return value;
1029
1028
  }
1030
- t(state, skipQueue) {
1029
+ u(state, skipQueue) {
1031
1030
  if (this.b >= state || skipQueue)
1032
1031
  return;
1033
1032
  if (this.b === STATE_CLEAN || this.d && !ActiveTransition)
1034
- getQueue(this).enqueue(this.r, this.w.bind(this));
1033
+ getQueue(this).enqueue(this.s, this.x.bind(this));
1035
1034
  this.b = state;
1036
1035
  }
1037
1036
  _(mask, newFlags2) {
@@ -1039,7 +1038,7 @@ var Effect = class extends Computation {
1039
1038
  if (this.b >= STATE_DIRTY)
1040
1039
  return;
1041
1040
  if (mask & 3) {
1042
- this.t(STATE_DIRTY);
1041
+ this.u(STATE_DIRTY);
1043
1042
  return;
1044
1043
  }
1045
1044
  }
@@ -1048,12 +1047,12 @@ var Effect = class extends Computation {
1048
1047
  N(error) {
1049
1048
  this.O = error;
1050
1049
  getQueue(this).notify(this, LOADING_BIT, 0);
1051
- this.i = ERROR_BIT;
1052
- if (this.r === EFFECT_USER) {
1050
+ this.h = ERROR_BIT;
1051
+ if (this.s === EFFECT_USER) {
1053
1052
  try {
1054
1053
  return this.$ ? this.$(error, () => {
1055
- this.u?.();
1056
- this.u = void 0;
1054
+ this.w?.();
1055
+ this.w = void 0;
1057
1056
  }) : console.error(error);
1058
1057
  } catch (e) {
1059
1058
  error = e;
@@ -1062,24 +1061,24 @@ var Effect = class extends Computation {
1062
1061
  if (!getQueue(this).notify(this, ERROR_BIT, ERROR_BIT))
1063
1062
  throw error;
1064
1063
  }
1065
- L() {
1064
+ M() {
1066
1065
  if (this.b === STATE_DISPOSED)
1067
1066
  return;
1068
1067
  this.ca = void 0;
1069
1068
  this.T = void 0;
1070
1069
  this.$ = void 0;
1071
- this.u?.();
1072
- this.u = void 0;
1070
+ this.w?.();
1071
+ this.w = void 0;
1073
1072
  getQueue(this).notify(this, ERROR_BIT | LOADING_BIT, 0);
1074
- super.L();
1073
+ super.M();
1075
1074
  }
1076
- w(type) {
1075
+ x(type) {
1077
1076
  if (type) {
1078
1077
  const effect = this.d || this;
1079
1078
  if (effect.da && effect.b !== STATE_DISPOSED) {
1080
- effect.u?.();
1079
+ effect.w?.();
1081
1080
  try {
1082
- effect.u = effect.ca(effect.l, effect.T);
1081
+ effect.w = effect.ca(effect.l, effect.T);
1083
1082
  } catch (e) {
1084
1083
  if (!getQueue(effect).notify(effect, ERROR_BIT, ERROR_BIT))
1085
1084
  throw e;
@@ -1093,32 +1092,32 @@ var Effect = class extends Computation {
1093
1092
  }
1094
1093
  };
1095
1094
  var TrackedEffect = class extends Computation {
1096
- r = EFFECT_USER;
1097
- u;
1095
+ s = EFFECT_USER;
1096
+ w;
1098
1097
  constructor(compute2, options) {
1099
1098
  super(void 0, () => {
1100
- this.u?.();
1101
- this.u = latest(compute2);
1099
+ this.w?.();
1100
+ this.w = latest(compute2);
1102
1101
  return void 0;
1103
1102
  }, options);
1104
- getQueue(this).enqueue(this.r, this.w.bind(this));
1103
+ getQueue(this).enqueue(this.s, this.x.bind(this));
1105
1104
  }
1106
- t(state, skipQueue) {
1105
+ u(state, skipQueue) {
1107
1106
  if (this.b >= state || skipQueue)
1108
1107
  return;
1109
1108
  if (this.b === STATE_CLEAN || this.d && !ActiveTransition)
1110
- getQueue(this).enqueue(this.r, this.w.bind(this));
1109
+ getQueue(this).enqueue(this.s, this.x.bind(this));
1111
1110
  this.b = state;
1112
1111
  }
1113
- L() {
1112
+ M() {
1114
1113
  if (this.b === STATE_DISPOSED)
1115
1114
  return;
1116
- this.u?.();
1117
- this.u = void 0;
1115
+ this.w?.();
1116
+ this.w = void 0;
1118
1117
  getQueue(this).notify(this, ERROR_BIT | LOADING_BIT, 0);
1119
- super.L();
1118
+ super.M();
1120
1119
  }
1121
- w(type) {
1120
+ x(type) {
1122
1121
  if (type)
1123
1122
  this.b !== STATE_CLEAN && runTop(this);
1124
1123
  }
@@ -1126,16 +1125,16 @@ var TrackedEffect = class extends Computation {
1126
1125
  var EagerComputation = class extends Computation {
1127
1126
  constructor(initialValue, compute2, options) {
1128
1127
  super(initialValue, compute2, options);
1129
- !options?.defer && this.M();
1128
+ !options?.defer && this.F();
1130
1129
  }
1131
- t(state, skipQueue) {
1132
- if (this.b >= state && !this.E)
1130
+ u(state, skipQueue) {
1131
+ if (this.b >= state && !this.H)
1133
1132
  return;
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);
1133
+ if (!skipQueue && (this.b === STATE_CLEAN || this.b === STATE_CHECK && this.H))
1134
+ getQueue(this).enqueue(EFFECT_PURE, this.x.bind(this));
1135
+ super.u(state, skipQueue);
1137
1136
  }
1138
- w() {
1137
+ x() {
1139
1138
  this.b !== STATE_CLEAN && runTop(this);
1140
1139
  }
1141
1140
  };
@@ -1144,16 +1143,19 @@ var FirewallComputation = class extends Computation {
1144
1143
  constructor(compute2) {
1145
1144
  super(void 0, compute2);
1146
1145
  }
1147
- t(state, skipQueue) {
1148
- if (this.b >= state && !this.E)
1146
+ u(state, skipQueue) {
1147
+ if (this.b >= state && !this.H)
1149
1148
  return;
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;
1149
+ if (!skipQueue && (this.b === STATE_CLEAN || this.b === STATE_CHECK && this.H))
1150
+ getQueue(this).enqueue(EFFECT_PURE, this.x.bind(this));
1151
+ super.u(state, true);
1152
+ this.H = !!skipQueue;
1154
1153
  }
1155
- w() {
1154
+ x() {
1155
+ const prevFlags = this.h;
1156
1156
  this.b !== STATE_CLEAN && runTop(this);
1157
+ if (ActiveTransition && this.r && this.h !== prevFlags)
1158
+ getQueue(this).notify(this, LOADING_BIT | ERROR_BIT, this.h);
1157
1159
  }
1158
1160
  };
1159
1161
  function runTop(node) {
@@ -1167,7 +1169,7 @@ function runTop(node) {
1167
1169
  }
1168
1170
  for (let i = ancestors.length - 1; i >= 0; i--) {
1169
1171
  if (ancestors[i].b !== STATE_DISPOSED)
1170
- ancestors[i].M();
1172
+ ancestors[i].F();
1171
1173
  }
1172
1174
  }
1173
1175
 
@@ -1175,7 +1177,10 @@ function runTop(node) {
1175
1177
  function createSignal(first, second, third) {
1176
1178
  if (typeof first === "function") {
1177
1179
  const node2 = new Computation(second, first, third);
1178
- return [node2.read.bind(node2), node2.write.bind(node2)];
1180
+ return [node2.read.bind(node2), (v) => {
1181
+ node2.F();
1182
+ return node2.write(v);
1183
+ }];
1179
1184
  }
1180
1185
  const o = getOwner();
1181
1186
  const needsId = o?.id != null;
@@ -1200,7 +1205,7 @@ function createMemo(compute2, value, options) {
1200
1205
  return resolvedValue;
1201
1206
  }
1202
1207
  resolvedValue = node.wait();
1203
- if (!node.a?.length && node.m?.k !== node && !(node.i & UNINITIALIZED_BIT)) {
1208
+ if (!node.a?.length && node.m?.k !== node && !(node.h & UNINITIALIZED_BIT)) {
1204
1209
  node.dispose();
1205
1210
  node = void 0;
1206
1211
  }
@@ -1279,7 +1284,7 @@ function createAsync(compute2, value, options) {
1279
1284
  }
1280
1285
  n.b = STATE_DIRTY;
1281
1286
  refreshing = true;
1282
- n.M();
1287
+ n.F();
1283
1288
  };
1284
1289
  return read;
1285
1290
  }
@@ -1345,14 +1350,24 @@ function resolve(fn) {
1345
1350
  });
1346
1351
  }
1347
1352
  function createOptimistic(first, second, third) {
1348
- const node = typeof first === "function" ? new Computation(second, first, third) : new Computation(first, null, second);
1353
+ const node = typeof first === "function" ? new Computation(second, (prev) => {
1354
+ const res = first(prev);
1355
+ if (reset.j)
1356
+ return prev;
1357
+ return res;
1358
+ }, third) : new Computation(first, null, second);
1359
+ node.r = true;
1349
1360
  const reset = () => node.write(first);
1350
1361
  function write(v) {
1351
1362
  if (!ActiveTransition)
1352
1363
  throw new Error("createOptimistic can only be updated inside a transition");
1353
1364
  ActiveTransition.addOptimistic(reset);
1354
- cloneGraph(node, true);
1355
- queueMicrotask(() => reset.j && node.write(v));
1365
+ queueMicrotask(() => {
1366
+ if (reset.j) {
1367
+ node.F();
1368
+ node.write(v);
1369
+ }
1370
+ });
1356
1371
  }
1357
1372
  return [node.read.bind(node), write];
1358
1373
  }
@@ -1825,8 +1840,14 @@ function deep(store) {
1825
1840
  // src/store/optimistic.ts
1826
1841
  function createOptimisticStore(first, second, options) {
1827
1842
  const derived = typeof first === "function";
1828
- const { store, node } = derived ? createProjectionInternal(first, second, options) : createProjectionInternal(() => {
1843
+ const { store, node } = derived ? createProjectionInternal((draft) => {
1844
+ const res = first(draft);
1845
+ if (reset.j)
1846
+ return draft;
1847
+ return res;
1848
+ }, second, options) : createProjectionInternal(() => {
1829
1849
  }, first);
1850
+ node.r = true;
1830
1851
  const reset = () => storeSetter(
1831
1852
  store,
1832
1853
  reconcile(
@@ -1839,7 +1860,6 @@ function createOptimisticStore(first, second, options) {
1839
1860
  if (!ActiveTransition)
1840
1861
  throw new Error("createOptimisticStore can only be updated inside a transition");
1841
1862
  ActiveTransition.addOptimistic(reset);
1842
- cloneGraph(node, true);
1843
1863
  queueMicrotask(() => reset.j && storeSetter(store, v));
1844
1864
  };
1845
1865
  return [store, write];
@@ -2052,9 +2072,9 @@ function mapArray(list, map, options) {
2052
2072
  U: new Owner(),
2053
2073
  o: 0,
2054
2074
  ia: list,
2055
- F: [],
2075
+ I: [],
2056
2076
  R: map,
2057
- h: [],
2077
+ i: [],
2058
2078
  e: [],
2059
2079
  S: keyFn,
2060
2080
  p: keyFn || options?.keyed === false ? [] : void 0,
@@ -2086,14 +2106,14 @@ function updateKeyedMap() {
2086
2106
  if (this.o !== 0) {
2087
2107
  this.U.dispose(false);
2088
2108
  this.e = [];
2089
- this.F = [];
2090
- this.h = [];
2109
+ this.I = [];
2110
+ this.i = [];
2091
2111
  this.o = 0;
2092
2112
  this.p && (this.p = []);
2093
2113
  this.q && (this.q = []);
2094
2114
  }
2095
- if (this.V && !this.h[0]) {
2096
- this.h[0] = compute(
2115
+ if (this.V && !this.i[0]) {
2116
+ this.i[0] = compute(
2097
2117
  this.e[0] = new Owner(),
2098
2118
  this.V,
2099
2119
  null
@@ -2102,20 +2122,20 @@ function updateKeyedMap() {
2102
2122
  } else if (this.o === 0) {
2103
2123
  if (this.e[0])
2104
2124
  this.e[0].dispose();
2105
- this.h = new Array(newLen);
2125
+ this.i = new Array(newLen);
2106
2126
  for (j = 0; j < newLen; j++) {
2107
- this.F[j] = newItems[j];
2108
- this.h[j] = compute(this.e[j] = new Owner(), mapper, null);
2127
+ this.I[j] = newItems[j];
2128
+ this.i[j] = compute(this.e[j] = new Owner(), mapper, null);
2109
2129
  }
2110
2130
  this.o = newLen;
2111
2131
  } else {
2112
2132
  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;
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++) {
2133
+ for (start = 0, end = Math.min(this.o, newLen); start < end && (this.I[start] === newItems[start] || this.p && compare(this.S, this.I[start], newItems[start])); start++) {
2114
2134
  if (this.p)
2115
2135
  this.p[start].write(newItems[start]);
2116
2136
  }
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];
2137
+ for (end = this.o - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.I[end] === newItems[newEnd] || this.p && compare(this.S, this.I[end], newItems[newEnd])); end--, newEnd--) {
2138
+ temp[newEnd] = this.i[end];
2119
2139
  tempNodes[newEnd] = this.e[end];
2120
2140
  tempRows && (tempRows[newEnd] = this.p[end]);
2121
2141
  tempIndexes && (tempIndexes[newEnd] = this.q[end]);
@@ -2130,11 +2150,11 @@ function updateKeyedMap() {
2130
2150
  newIndices.set(key, j);
2131
2151
  }
2132
2152
  for (i = start; i <= end; i++) {
2133
- item = this.F[i];
2153
+ item = this.I[i];
2134
2154
  key = this.S ? this.S(item) : item;
2135
2155
  j = newIndices.get(key);
2136
2156
  if (j !== void 0 && j !== -1) {
2137
- temp[j] = this.h[i];
2157
+ temp[j] = this.i[i];
2138
2158
  tempNodes[j] = this.e[i];
2139
2159
  tempRows && (tempRows[j] = this.p[i]);
2140
2160
  tempIndexes && (tempIndexes[j] = this.q[i]);
@@ -2145,7 +2165,7 @@ function updateKeyedMap() {
2145
2165
  }
2146
2166
  for (j = start; j < newLen; j++) {
2147
2167
  if (j in temp) {
2148
- this.h[j] = temp[j];
2168
+ this.i[j] = temp[j];
2149
2169
  this.e[j] = tempNodes[j];
2150
2170
  if (tempRows) {
2151
2171
  this.p[j] = tempRows[j];
@@ -2156,24 +2176,24 @@ function updateKeyedMap() {
2156
2176
  this.q[j].write(j);
2157
2177
  }
2158
2178
  } else {
2159
- this.h[j] = compute(this.e[j] = new Owner(), mapper, null);
2179
+ this.i[j] = compute(this.e[j] = new Owner(), mapper, null);
2160
2180
  }
2161
2181
  }
2162
- this.h = this.h.slice(0, this.o = newLen);
2163
- this.F = newItems.slice(0);
2182
+ this.i = this.i.slice(0, this.o = newLen);
2183
+ this.I = newItems.slice(0);
2164
2184
  }
2165
2185
  });
2166
- return this.h;
2186
+ return this.i;
2167
2187
  }
2168
2188
  function repeat(count, map, options) {
2169
2189
  return updateRepeat.bind({
2170
2190
  U: new Owner(),
2171
2191
  o: 0,
2172
- A: 0,
2192
+ B: 0,
2173
2193
  ja: count,
2174
2194
  R: map,
2175
2195
  e: [],
2176
- h: [],
2196
+ i: [],
2177
2197
  ka: options?.from,
2178
2198
  V: options?.fallback
2179
2199
  });
@@ -2186,11 +2206,11 @@ function updateRepeat() {
2186
2206
  if (this.o !== 0) {
2187
2207
  this.U.dispose(false);
2188
2208
  this.e = [];
2189
- this.h = [];
2209
+ this.i = [];
2190
2210
  this.o = 0;
2191
2211
  }
2192
- if (this.V && !this.h[0]) {
2193
- this.h[0] = compute(
2212
+ if (this.V && !this.i[0]) {
2213
+ this.i[0] = compute(
2194
2214
  this.e[0] = new Owner(),
2195
2215
  this.V,
2196
2216
  null
@@ -2199,28 +2219,28 @@ function updateRepeat() {
2199
2219
  return;
2200
2220
  }
2201
2221
  const to = from + newLen;
2202
- const prevTo = this.A + this.o;
2222
+ const prevTo = this.B + this.o;
2203
2223
  if (this.o === 0 && this.e[0])
2204
2224
  this.e[0].dispose();
2205
2225
  for (let i = to; i < prevTo; i++)
2206
- this.e[i - this.A].dispose();
2207
- if (this.A < from) {
2208
- let i = this.A;
2226
+ this.e[i - this.B].dispose();
2227
+ if (this.B < from) {
2228
+ let i = this.B;
2209
2229
  while (i < from && i < this.o)
2210
2230
  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;
2231
+ this.e.splice(0, from - this.B);
2232
+ this.i.splice(0, from - this.B);
2233
+ } else if (this.B > from) {
2234
+ let i = prevTo - this.B - 1;
2235
+ let difference = this.B - from;
2236
+ this.e.length = this.i.length = newLen;
2217
2237
  while (i >= difference) {
2218
2238
  this.e[i] = this.e[i - difference];
2219
- this.h[i] = this.h[i - difference];
2239
+ this.i[i] = this.i[i - difference];
2220
2240
  i--;
2221
2241
  }
2222
2242
  for (let i2 = 0; i2 < difference; i2++) {
2223
- this.h[i2] = compute(
2243
+ this.i[i2] = compute(
2224
2244
  this.e[i2] = new Owner(),
2225
2245
  () => this.R(i2 + from),
2226
2246
  null
@@ -2228,17 +2248,17 @@ function updateRepeat() {
2228
2248
  }
2229
2249
  }
2230
2250
  for (let i = prevTo; i < to; i++) {
2231
- this.h[i - from] = compute(
2251
+ this.i[i - from] = compute(
2232
2252
  this.e[i - from] = new Owner(),
2233
2253
  () => this.R(i),
2234
2254
  null
2235
2255
  );
2236
2256
  }
2237
- this.h = this.h.slice(0, newLen);
2238
- this.A = from;
2257
+ this.i = this.i.slice(0, newLen);
2258
+ this.B = from;
2239
2259
  this.o = newLen;
2240
2260
  });
2241
- return this.h;
2261
+ return this.i;
2242
2262
  }
2243
2263
  function compare(key, a, b) {
2244
2264
  return key ? key(a) === key(b) : true;
@@ -2253,7 +2273,7 @@ var BoundaryComputation = class extends EagerComputation {
2253
2273
  }
2254
2274
  write(value, flags) {
2255
2275
  super.write(value, flags & ~this.W);
2256
- if (this.W & LOADING_BIT && !(this.i & UNINITIALIZED_BIT || ActiveTransition)) {
2276
+ if (this.W & LOADING_BIT && !(this.h & UNINITIALIZED_BIT || ActiveTransition)) {
2257
2277
  flags &= ~LOADING_BIT;
2258
2278
  }
2259
2279
  getQueue(this).notify(this, this.W, flags);
@@ -2261,9 +2281,9 @@ var BoundaryComputation = class extends EagerComputation {
2261
2281
  }
2262
2282
  };
2263
2283
  function createBoundChildren(owner, fn, queue, mask) {
2264
- const parentQueue = owner.C;
2265
- parentQueue.addChild(owner.C = queue);
2266
- onCleanup(() => parentQueue.removeChild(owner.C));
2284
+ const parentQueue = owner.E;
2285
+ parentQueue.addChild(owner.E = queue);
2286
+ onCleanup(() => parentQueue.removeChild(owner.E));
2267
2287
  return compute(
2268
2288
  owner,
2269
2289
  () => {
@@ -2274,25 +2294,25 @@ function createBoundChildren(owner, fn, queue, mask) {
2274
2294
  );
2275
2295
  }
2276
2296
  var ConditionalQueue = class extends Queue {
2277
- x;
2297
+ y;
2278
2298
  X = /* @__PURE__ */ new Set();
2279
- s = /* @__PURE__ */ new Set();
2299
+ t = /* @__PURE__ */ new Set();
2280
2300
  constructor(disabled) {
2281
2301
  super();
2282
- this.x = disabled;
2302
+ this.y = disabled;
2283
2303
  }
2284
2304
  run(type) {
2285
- if (!type || this.x.read())
2305
+ if (!type || this.y.read())
2286
2306
  return;
2287
2307
  return super.run(type);
2288
2308
  }
2289
2309
  notify(node, type, flags) {
2290
- if (this.x.read()) {
2310
+ if (this.y.read()) {
2291
2311
  if (type & LOADING_BIT) {
2292
2312
  if (flags & LOADING_BIT) {
2293
- this.s.add(node);
2313
+ this.t.add(node);
2294
2314
  type &= ~LOADING_BIT;
2295
- } else if (this.s.delete(node))
2315
+ } else if (this.t.delete(node))
2296
2316
  type &= ~LOADING_BIT;
2297
2317
  }
2298
2318
  if (type & ERROR_BIT) {
@@ -2306,41 +2326,41 @@ var ConditionalQueue = class extends Queue {
2306
2326
  return type ? super.notify(node, type, flags) : true;
2307
2327
  }
2308
2328
  merge(queue) {
2309
- queue.s.forEach((n) => this.notify(n, LOADING_BIT, LOADING_BIT));
2329
+ queue.t.forEach((n) => this.notify(n, LOADING_BIT, LOADING_BIT));
2310
2330
  queue.X.forEach((n) => this.notify(n, ERROR_BIT, ERROR_BIT));
2311
2331
  super.merge(queue);
2312
2332
  }
2313
2333
  };
2314
2334
  var CollectionQueue = class extends Queue {
2315
- K;
2335
+ L;
2316
2336
  e = /* @__PURE__ */ new Set();
2317
- x = new Computation(false, null, { pureWrite: true });
2337
+ y = new Computation(false, null, { pureWrite: true });
2318
2338
  constructor(type) {
2319
2339
  super();
2320
- this.K = type;
2340
+ this.L = type;
2321
2341
  }
2322
2342
  run(type) {
2323
- if (!type || this.x.read())
2343
+ if (!type || this.y.read())
2324
2344
  return;
2325
2345
  return super.run(type);
2326
2346
  }
2327
2347
  notify(node, type, flags) {
2328
- if (!(type & this.K))
2348
+ if (!(type & this.L))
2329
2349
  return super.notify(node, type, flags);
2330
- if (flags & this.K) {
2350
+ if (flags & this.L) {
2331
2351
  this.e.add(node);
2332
2352
  if (this.e.size === 1)
2333
- this.x.write(true);
2353
+ this.y.write(true);
2334
2354
  } else if (this.e.size > 0) {
2335
2355
  this.e.delete(node);
2336
2356
  if (this.e.size === 0)
2337
- this.x.write(false);
2357
+ this.y.write(false);
2338
2358
  }
2339
- type &= ~this.K;
2359
+ type &= ~this.L;
2340
2360
  return type ? super.notify(node, type, flags) : true;
2341
2361
  }
2342
2362
  merge(queue) {
2343
- queue.e.forEach((n) => this.notify(n, this.K, this.K));
2363
+ queue.e.forEach((n) => this.notify(n, this.L, this.L));
2344
2364
  super.merge(queue);
2345
2365
  }
2346
2366
  };
@@ -2351,25 +2371,25 @@ function createBoundary(fn, condition) {
2351
2371
  );
2352
2372
  const tree = createBoundChildren(owner, fn, queue, 0);
2353
2373
  new EagerComputation(void 0, () => {
2354
- const disabled = queue.x.read();
2374
+ const disabled = queue.y.read();
2355
2375
  tree.W = disabled ? ERROR_BIT | LOADING_BIT : 0;
2356
2376
  if (!disabled) {
2357
- queue.s.forEach((node) => queue.notify(node, LOADING_BIT, LOADING_BIT));
2377
+ queue.t.forEach((node) => queue.notify(node, LOADING_BIT, LOADING_BIT));
2358
2378
  queue.X.forEach((node) => queue.notify(node, ERROR_BIT, ERROR_BIT));
2359
- queue.s.clear();
2379
+ queue.t.clear();
2360
2380
  queue.X.clear();
2361
2381
  }
2362
2382
  });
2363
- return () => queue.x.read() ? void 0 : tree.read();
2383
+ return () => queue.y.read() ? void 0 : tree.read();
2364
2384
  }
2365
2385
  function createCollectionBoundary(type, fn, fallback) {
2366
2386
  const owner = new Owner();
2367
2387
  const queue = new CollectionQueue(type);
2368
2388
  const tree = createBoundChildren(owner, fn, queue, type);
2369
2389
  const decision = new Computation(void 0, () => {
2370
- if (!queue.x.read()) {
2390
+ if (!queue.y.read()) {
2371
2391
  const resolved = tree.read();
2372
- if (!untrack(() => queue.x.read()))
2392
+ if (!untrack(() => queue.y.read()))
2373
2393
  return resolved;
2374
2394
  }
2375
2395
  return fallback(queue);
@@ -2388,7 +2408,7 @@ function createErrorBoundary(fn, fallback) {
2388
2408
  if (ActiveTransition && !node2.d)
2389
2409
  node2 = cloneGraph(node2);
2390
2410
  node2.b = STATE_DIRTY;
2391
- getQueue(node2).enqueue(node2.r, node2.w.bind(node2));
2411
+ getQueue(node2).enqueue(node2.s, node2.x.bind(node2));
2392
2412
  }
2393
2413
  });
2394
2414
  });