@solidjs/signals 0.7.1 → 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.H.has(this))
103
- return ActiveTransition.H.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.H.has(this))
109
- return ActiveTransition.H.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
- I = /* @__PURE__ */ new Set();
162
- J = /* @__PURE__ */ new Set();
163
- E = false;
164
- g = [[], []];
165
- H = /* @__PURE__ */ new Map();
166
- K = [];
167
- f = [];
160
+ t = /* @__PURE__ */ new Set();
161
+ K = /* @__PURE__ */ new Set();
162
+ r = /* @__PURE__ */ new Set();
163
+ D = false;
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.H.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.K.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.K.length && runQueue(this.K, type);
188
- this.K = [];
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,52 +209,55 @@ 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.K.push.apply(this.K, queue.K);
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) {
255
- if (this.E) {
256
- if (this.E instanceof _Transition)
257
- return this.E.runTransition(fn, force);
258
+ if (this.D) {
259
+ if (this.D instanceof _Transition)
260
+ return this.D.runTransition(fn, force);
258
261
  if (!force)
259
262
  throw new Error("Transition already completed");
260
263
  fn();
@@ -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.I.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.I.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.I.add(result);
292
+ transition2.K.add(result);
289
293
  result.finally(() => {
290
294
  transition2 = latestTransition(transition2);
291
- transition2.I.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.J.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,27 +333,26 @@ function cloneGraph(node, optimistic) {
327
333
  m: null,
328
334
  c: null,
329
335
  a: node.a ? [...node.a] : null,
330
- d: node,
331
- J: !!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;
347
352
  }
348
353
  function latestTransition(t) {
349
- while (t.E instanceof Transition)
350
- t = t.E;
354
+ while (t.D instanceof Transition)
355
+ t = t.D;
351
356
  return t;
352
357
  }
353
358
  function replaceSourceObservers(node, transition2) {
@@ -368,7 +373,7 @@ 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);
@@ -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.H.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,21 +418,21 @@ function mergeTransitions(t1, t2) {
413
418
  key.j = t1;
414
419
  t1.a.set(key, value);
415
420
  });
416
- t2.J.forEach((c) => {
421
+ t2.r.forEach((c) => {
417
422
  c.j = t1;
418
- t1.J.add(c);
423
+ t1.r.add(c);
419
424
  });
420
- t2.I.forEach((p) => t1.I.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
- t2.E = t1;
428
+ t2.D = t1;
424
429
  }
425
430
  function getTransitionSource(input) {
426
431
  return ActiveTransition && ActiveTransition.a.get(input) || input;
427
432
  }
428
433
  function getQueue(node) {
429
434
  const transition2 = ActiveTransition || node.d?.j;
430
- return transition2 && transition2.H.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.E || transition2.Y || transition2.I.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.J) {
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,16 +468,16 @@ 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;
477
476
  }
478
477
  delete source.j;
479
478
  }
480
- transition2.E = true;
481
- for (const reset of transition2.J) {
479
+ transition2.D = true;
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;
@@ -544,16 +543,16 @@ var Owner = class {
544
543
  if (self)
545
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
550
  M() {
552
- if (this.y)
553
- this.y.m = null;
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
- F = false;
655
+ H = false;
657
656
  j;
658
657
  d;
659
- J = 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.D();
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.D();
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.F)
760
+ u(state, skipQueue) {
761
+ if (this.b >= state && !this.H)
763
762
  return;
764
- this.F = !!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.F)
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
- D() {
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.D();
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
  }
@@ -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.D();
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;
@@ -1068,18 +1067,18 @@ var Effect = class extends Computation {
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
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
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
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.D();
1128
+ !options?.defer && this.F();
1130
1129
  }
1131
- t(state, skipQueue) {
1132
- if (this.b >= state && !this.F)
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.F))
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.F)
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.F))
1151
- getQueue(this).enqueue(EFFECT_PURE, this.w.bind(this));
1152
- super.t(state, true);
1153
- this.F = !!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].D();
1172
+ ancestors[i].F();
1171
1173
  }
1172
1174
  }
1173
1175
 
@@ -1176,7 +1178,7 @@ function createSignal(first, second, third) {
1176
1178
  if (typeof first === "function") {
1177
1179
  const node2 = new Computation(second, first, third);
1178
1180
  return [node2.read.bind(node2), (v) => {
1179
- node2.D();
1181
+ node2.F();
1180
1182
  return node2.write(v);
1181
1183
  }];
1182
1184
  }
@@ -1203,7 +1205,7 @@ function createMemo(compute2, value, options) {
1203
1205
  return resolvedValue;
1204
1206
  }
1205
1207
  resolvedValue = node.wait();
1206
- 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)) {
1207
1209
  node.dispose();
1208
1210
  node = void 0;
1209
1211
  }
@@ -1282,7 +1284,7 @@ function createAsync(compute2, value, options) {
1282
1284
  }
1283
1285
  n.b = STATE_DIRTY;
1284
1286
  refreshing = true;
1285
- n.D();
1287
+ n.F();
1286
1288
  };
1287
1289
  return read;
1288
1290
  }
@@ -1348,16 +1350,21 @@ function resolve(fn) {
1348
1350
  });
1349
1351
  }
1350
1352
  function createOptimistic(first, second, third) {
1351
- 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;
1352
1360
  const reset = () => node.write(first);
1353
1361
  function write(v) {
1354
1362
  if (!ActiveTransition)
1355
1363
  throw new Error("createOptimistic can only be updated inside a transition");
1356
1364
  ActiveTransition.addOptimistic(reset);
1357
- cloneGraph(node, true);
1358
1365
  queueMicrotask(() => {
1359
1366
  if (reset.j) {
1360
- node.D();
1367
+ node.F();
1361
1368
  node.write(v);
1362
1369
  }
1363
1370
  });
@@ -1833,8 +1840,14 @@ function deep(store) {
1833
1840
  // src/store/optimistic.ts
1834
1841
  function createOptimisticStore(first, second, options) {
1835
1842
  const derived = typeof first === "function";
1836
- 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(() => {
1837
1849
  }, first);
1850
+ node.r = true;
1838
1851
  const reset = () => storeSetter(
1839
1852
  store,
1840
1853
  reconcile(
@@ -1847,7 +1860,6 @@ function createOptimisticStore(first, second, options) {
1847
1860
  if (!ActiveTransition)
1848
1861
  throw new Error("createOptimisticStore can only be updated inside a transition");
1849
1862
  ActiveTransition.addOptimistic(reset);
1850
- cloneGraph(node, true);
1851
1863
  queueMicrotask(() => reset.j && storeSetter(store, v));
1852
1864
  };
1853
1865
  return [store, write];
@@ -2060,9 +2072,9 @@ function mapArray(list, map, options) {
2060
2072
  U: new Owner(),
2061
2073
  o: 0,
2062
2074
  ia: list,
2063
- G: [],
2075
+ I: [],
2064
2076
  R: map,
2065
- h: [],
2077
+ i: [],
2066
2078
  e: [],
2067
2079
  S: keyFn,
2068
2080
  p: keyFn || options?.keyed === false ? [] : void 0,
@@ -2094,14 +2106,14 @@ function updateKeyedMap() {
2094
2106
  if (this.o !== 0) {
2095
2107
  this.U.dispose(false);
2096
2108
  this.e = [];
2097
- this.G = [];
2098
- this.h = [];
2109
+ this.I = [];
2110
+ this.i = [];
2099
2111
  this.o = 0;
2100
2112
  this.p && (this.p = []);
2101
2113
  this.q && (this.q = []);
2102
2114
  }
2103
- if (this.V && !this.h[0]) {
2104
- this.h[0] = compute(
2115
+ if (this.V && !this.i[0]) {
2116
+ this.i[0] = compute(
2105
2117
  this.e[0] = new Owner(),
2106
2118
  this.V,
2107
2119
  null
@@ -2110,20 +2122,20 @@ function updateKeyedMap() {
2110
2122
  } else if (this.o === 0) {
2111
2123
  if (this.e[0])
2112
2124
  this.e[0].dispose();
2113
- this.h = new Array(newLen);
2125
+ this.i = new Array(newLen);
2114
2126
  for (j = 0; j < newLen; j++) {
2115
- this.G[j] = newItems[j];
2116
- 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);
2117
2129
  }
2118
2130
  this.o = newLen;
2119
2131
  } else {
2120
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;
2121
- for (start = 0, end = Math.min(this.o, newLen); start < end && (this.G[start] === newItems[start] || this.p && compare(this.S, this.G[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++) {
2122
2134
  if (this.p)
2123
2135
  this.p[start].write(newItems[start]);
2124
2136
  }
2125
- for (end = this.o - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.G[end] === newItems[newEnd] || this.p && compare(this.S, this.G[end], newItems[newEnd])); end--, newEnd--) {
2126
- 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];
2127
2139
  tempNodes[newEnd] = this.e[end];
2128
2140
  tempRows && (tempRows[newEnd] = this.p[end]);
2129
2141
  tempIndexes && (tempIndexes[newEnd] = this.q[end]);
@@ -2138,11 +2150,11 @@ function updateKeyedMap() {
2138
2150
  newIndices.set(key, j);
2139
2151
  }
2140
2152
  for (i = start; i <= end; i++) {
2141
- item = this.G[i];
2153
+ item = this.I[i];
2142
2154
  key = this.S ? this.S(item) : item;
2143
2155
  j = newIndices.get(key);
2144
2156
  if (j !== void 0 && j !== -1) {
2145
- temp[j] = this.h[i];
2157
+ temp[j] = this.i[i];
2146
2158
  tempNodes[j] = this.e[i];
2147
2159
  tempRows && (tempRows[j] = this.p[i]);
2148
2160
  tempIndexes && (tempIndexes[j] = this.q[i]);
@@ -2153,7 +2165,7 @@ function updateKeyedMap() {
2153
2165
  }
2154
2166
  for (j = start; j < newLen; j++) {
2155
2167
  if (j in temp) {
2156
- this.h[j] = temp[j];
2168
+ this.i[j] = temp[j];
2157
2169
  this.e[j] = tempNodes[j];
2158
2170
  if (tempRows) {
2159
2171
  this.p[j] = tempRows[j];
@@ -2164,24 +2176,24 @@ function updateKeyedMap() {
2164
2176
  this.q[j].write(j);
2165
2177
  }
2166
2178
  } else {
2167
- this.h[j] = compute(this.e[j] = new Owner(), mapper, null);
2179
+ this.i[j] = compute(this.e[j] = new Owner(), mapper, null);
2168
2180
  }
2169
2181
  }
2170
- this.h = this.h.slice(0, this.o = newLen);
2171
- this.G = newItems.slice(0);
2182
+ this.i = this.i.slice(0, this.o = newLen);
2183
+ this.I = newItems.slice(0);
2172
2184
  }
2173
2185
  });
2174
- return this.h;
2186
+ return this.i;
2175
2187
  }
2176
2188
  function repeat(count, map, options) {
2177
2189
  return updateRepeat.bind({
2178
2190
  U: new Owner(),
2179
2191
  o: 0,
2180
- A: 0,
2192
+ B: 0,
2181
2193
  ja: count,
2182
2194
  R: map,
2183
2195
  e: [],
2184
- h: [],
2196
+ i: [],
2185
2197
  ka: options?.from,
2186
2198
  V: options?.fallback
2187
2199
  });
@@ -2194,11 +2206,11 @@ function updateRepeat() {
2194
2206
  if (this.o !== 0) {
2195
2207
  this.U.dispose(false);
2196
2208
  this.e = [];
2197
- this.h = [];
2209
+ this.i = [];
2198
2210
  this.o = 0;
2199
2211
  }
2200
- if (this.V && !this.h[0]) {
2201
- this.h[0] = compute(
2212
+ if (this.V && !this.i[0]) {
2213
+ this.i[0] = compute(
2202
2214
  this.e[0] = new Owner(),
2203
2215
  this.V,
2204
2216
  null
@@ -2207,28 +2219,28 @@ function updateRepeat() {
2207
2219
  return;
2208
2220
  }
2209
2221
  const to = from + newLen;
2210
- const prevTo = this.A + this.o;
2222
+ const prevTo = this.B + this.o;
2211
2223
  if (this.o === 0 && this.e[0])
2212
2224
  this.e[0].dispose();
2213
2225
  for (let i = to; i < prevTo; i++)
2214
- this.e[i - this.A].dispose();
2215
- if (this.A < from) {
2216
- let i = this.A;
2226
+ this.e[i - this.B].dispose();
2227
+ if (this.B < from) {
2228
+ let i = this.B;
2217
2229
  while (i < from && i < this.o)
2218
2230
  this.e[i++].dispose();
2219
- this.e.splice(0, from - this.A);
2220
- this.h.splice(0, from - this.A);
2221
- } else if (this.A > from) {
2222
- let i = prevTo - this.A - 1;
2223
- let difference = this.A - from;
2224
- 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;
2225
2237
  while (i >= difference) {
2226
2238
  this.e[i] = this.e[i - difference];
2227
- this.h[i] = this.h[i - difference];
2239
+ this.i[i] = this.i[i - difference];
2228
2240
  i--;
2229
2241
  }
2230
2242
  for (let i2 = 0; i2 < difference; i2++) {
2231
- this.h[i2] = compute(
2243
+ this.i[i2] = compute(
2232
2244
  this.e[i2] = new Owner(),
2233
2245
  () => this.R(i2 + from),
2234
2246
  null
@@ -2236,17 +2248,17 @@ function updateRepeat() {
2236
2248
  }
2237
2249
  }
2238
2250
  for (let i = prevTo; i < to; i++) {
2239
- this.h[i - from] = compute(
2251
+ this.i[i - from] = compute(
2240
2252
  this.e[i - from] = new Owner(),
2241
2253
  () => this.R(i),
2242
2254
  null
2243
2255
  );
2244
2256
  }
2245
- this.h = this.h.slice(0, newLen);
2246
- this.A = from;
2257
+ this.i = this.i.slice(0, newLen);
2258
+ this.B = from;
2247
2259
  this.o = newLen;
2248
2260
  });
2249
- return this.h;
2261
+ return this.i;
2250
2262
  }
2251
2263
  function compare(key, a, b) {
2252
2264
  return key ? key(a) === key(b) : true;
@@ -2261,7 +2273,7 @@ var BoundaryComputation = class extends EagerComputation {
2261
2273
  }
2262
2274
  write(value, flags) {
2263
2275
  super.write(value, flags & ~this.W);
2264
- if (this.W & LOADING_BIT && !(this.i & UNINITIALIZED_BIT || ActiveTransition)) {
2276
+ if (this.W & LOADING_BIT && !(this.h & UNINITIALIZED_BIT || ActiveTransition)) {
2265
2277
  flags &= ~LOADING_BIT;
2266
2278
  }
2267
2279
  getQueue(this).notify(this, this.W, flags);
@@ -2269,9 +2281,9 @@ var BoundaryComputation = class extends EagerComputation {
2269
2281
  }
2270
2282
  };
2271
2283
  function createBoundChildren(owner, fn, queue, mask) {
2272
- const parentQueue = owner.C;
2273
- parentQueue.addChild(owner.C = queue);
2274
- onCleanup(() => parentQueue.removeChild(owner.C));
2284
+ const parentQueue = owner.E;
2285
+ parentQueue.addChild(owner.E = queue);
2286
+ onCleanup(() => parentQueue.removeChild(owner.E));
2275
2287
  return compute(
2276
2288
  owner,
2277
2289
  () => {
@@ -2282,25 +2294,25 @@ function createBoundChildren(owner, fn, queue, mask) {
2282
2294
  );
2283
2295
  }
2284
2296
  var ConditionalQueue = class extends Queue {
2285
- x;
2297
+ y;
2286
2298
  X = /* @__PURE__ */ new Set();
2287
- s = /* @__PURE__ */ new Set();
2299
+ t = /* @__PURE__ */ new Set();
2288
2300
  constructor(disabled) {
2289
2301
  super();
2290
- this.x = disabled;
2302
+ this.y = disabled;
2291
2303
  }
2292
2304
  run(type) {
2293
- if (!type || this.x.read())
2305
+ if (!type || this.y.read())
2294
2306
  return;
2295
2307
  return super.run(type);
2296
2308
  }
2297
2309
  notify(node, type, flags) {
2298
- if (this.x.read()) {
2310
+ if (this.y.read()) {
2299
2311
  if (type & LOADING_BIT) {
2300
2312
  if (flags & LOADING_BIT) {
2301
- this.s.add(node);
2313
+ this.t.add(node);
2302
2314
  type &= ~LOADING_BIT;
2303
- } else if (this.s.delete(node))
2315
+ } else if (this.t.delete(node))
2304
2316
  type &= ~LOADING_BIT;
2305
2317
  }
2306
2318
  if (type & ERROR_BIT) {
@@ -2314,7 +2326,7 @@ var ConditionalQueue = class extends Queue {
2314
2326
  return type ? super.notify(node, type, flags) : true;
2315
2327
  }
2316
2328
  merge(queue) {
2317
- queue.s.forEach((n) => this.notify(n, LOADING_BIT, LOADING_BIT));
2329
+ queue.t.forEach((n) => this.notify(n, LOADING_BIT, LOADING_BIT));
2318
2330
  queue.X.forEach((n) => this.notify(n, ERROR_BIT, ERROR_BIT));
2319
2331
  super.merge(queue);
2320
2332
  }
@@ -2322,13 +2334,13 @@ var ConditionalQueue = class extends Queue {
2322
2334
  var CollectionQueue = class extends Queue {
2323
2335
  L;
2324
2336
  e = /* @__PURE__ */ new Set();
2325
- x = new Computation(false, null, { pureWrite: true });
2337
+ y = new Computation(false, null, { pureWrite: true });
2326
2338
  constructor(type) {
2327
2339
  super();
2328
2340
  this.L = type;
2329
2341
  }
2330
2342
  run(type) {
2331
- if (!type || this.x.read())
2343
+ if (!type || this.y.read())
2332
2344
  return;
2333
2345
  return super.run(type);
2334
2346
  }
@@ -2338,11 +2350,11 @@ var CollectionQueue = class extends Queue {
2338
2350
  if (flags & this.L) {
2339
2351
  this.e.add(node);
2340
2352
  if (this.e.size === 1)
2341
- this.x.write(true);
2353
+ this.y.write(true);
2342
2354
  } else if (this.e.size > 0) {
2343
2355
  this.e.delete(node);
2344
2356
  if (this.e.size === 0)
2345
- this.x.write(false);
2357
+ this.y.write(false);
2346
2358
  }
2347
2359
  type &= ~this.L;
2348
2360
  return type ? super.notify(node, type, flags) : true;
@@ -2359,25 +2371,25 @@ function createBoundary(fn, condition) {
2359
2371
  );
2360
2372
  const tree = createBoundChildren(owner, fn, queue, 0);
2361
2373
  new EagerComputation(void 0, () => {
2362
- const disabled = queue.x.read();
2374
+ const disabled = queue.y.read();
2363
2375
  tree.W = disabled ? ERROR_BIT | LOADING_BIT : 0;
2364
2376
  if (!disabled) {
2365
- queue.s.forEach((node) => queue.notify(node, LOADING_BIT, LOADING_BIT));
2377
+ queue.t.forEach((node) => queue.notify(node, LOADING_BIT, LOADING_BIT));
2366
2378
  queue.X.forEach((node) => queue.notify(node, ERROR_BIT, ERROR_BIT));
2367
- queue.s.clear();
2379
+ queue.t.clear();
2368
2380
  queue.X.clear();
2369
2381
  }
2370
2382
  });
2371
- return () => queue.x.read() ? void 0 : tree.read();
2383
+ return () => queue.y.read() ? void 0 : tree.read();
2372
2384
  }
2373
2385
  function createCollectionBoundary(type, fn, fallback) {
2374
2386
  const owner = new Owner();
2375
2387
  const queue = new CollectionQueue(type);
2376
2388
  const tree = createBoundChildren(owner, fn, queue, type);
2377
2389
  const decision = new Computation(void 0, () => {
2378
- if (!queue.x.read()) {
2390
+ if (!queue.y.read()) {
2379
2391
  const resolved = tree.read();
2380
- if (!untrack(() => queue.x.read()))
2392
+ if (!untrack(() => queue.y.read()))
2381
2393
  return resolved;
2382
2394
  }
2383
2395
  return fallback(queue);
@@ -2396,7 +2408,7 @@ function createErrorBoundary(fn, fallback) {
2396
2408
  if (ActiveTransition && !node2.d)
2397
2409
  node2 = cloneGraph(node2);
2398
2410
  node2.b = STATE_DIRTY;
2399
- getQueue(node2).enqueue(node2.r, node2.w.bind(node2));
2411
+ getQueue(node2).enqueue(node2.s, node2.x.bind(node2));
2400
2412
  }
2401
2413
  });
2402
2414
  });