@solidjs/signals 0.7.1 → 0.7.3

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,9 +59,9 @@ function notifyUnobserved() {
59
59
  var pureQueue = [];
60
60
  var Queue = class {
61
61
  k = null;
62
- B = false;
62
+ C = false;
63
63
  g = [[], []];
64
- f = [];
64
+ h = [];
65
65
  created = clock;
66
66
  enqueue(type, fn) {
67
67
  pureQueue.push(fn);
@@ -79,14 +79,14 @@ var Queue = class {
79
79
  this.g[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.h.length; i++) {
83
+ this.h[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.h.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.h.indexOf(child);
111
111
  if (index >= 0) {
112
- this.f.splice(index, 1);
112
+ this.h.splice(index, 1);
113
113
  child.k = null;
114
114
  }
115
115
  }
@@ -121,12 +121,12 @@ var Queue = class {
121
121
  merge(queue) {
122
122
  this.g[0].push.apply(this.g[0], queue.g[0]);
123
123
  this.g[1].push.apply(this.g[1], queue.g[1]);
124
- for (let i = 0; i < queue.f.length; i++) {
125
- const og = this.f.find((c) => c.d === queue.f[i].d);
124
+ for (let i = 0; i < queue.h.length; i++) {
125
+ const og = this.h.find((c) => c.d === queue.h[i].d);
126
126
  if (og)
127
- og.merge(queue.f[i]);
127
+ og.merge(queue.h[i]);
128
128
  else
129
- this.addChild(queue.f[i]);
129
+ this.addChild(queue.h[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;
160
+ t = /* @__PURE__ */ new Set();
161
+ K = /* @__PURE__ */ new Set();
162
+ m = /* @__PURE__ */ new Set();
163
+ D = false;
164
164
  g = [[], []];
165
- H = /* @__PURE__ */ new Map();
166
- K = [];
167
- f = [];
165
+ J = /* @__PURE__ */ new Map();
166
+ G = [];
167
+ h = [];
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.h) {
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
182
  this.g[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
190
  } else if (this.g[type - 1].length) {
191
191
  const effects = this.g[type - 1];
192
192
  this.g[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.h.length; i++) {
196
+ this.h[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.h.push(child);
218
218
  child.k = this;
219
219
  }
220
220
  removeChild(child) {
221
- const index = this.f.indexOf(child);
221
+ const index = this.h.indexOf(child);
222
222
  if (index >= 0)
223
- this.f.splice(index, 1);
223
+ this.h.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
236
  this.g[0].push.apply(this.g[0], queue.g[0]);
237
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);
238
+ this.G.push.apply(this.G, queue.G);
239
+ queue.g[0].length = 0;
240
+ queue.g[1].length = 0;
241
+ queue.G.length = 0;
242
+ for (let i = 0; i < queue.h.length; i++) {
243
+ const og = this.h.find((c) => c.d === queue.h[i].d);
241
244
  if (og)
242
- og.merge(queue.f[i]);
245
+ og.merge(queue.h[i]);
243
246
  else
244
- this.addChild(queue.f[i]);
247
+ this.addChild(queue.h[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,18 @@ var Transition = class _Transition {
306
310
  return;
307
311
  }
308
312
  fn.j = this;
309
- this.J.add(fn);
313
+ this.m.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.m) {
322
+ ActiveTransition.addOptimistic(node.m);
323
+ return node;
324
+ }
317
325
  if (node.j) {
318
326
  if (node.j !== ActiveTransition) {
319
327
  mergeTransitions(node.j, ActiveTransition);
@@ -323,31 +331,30 @@ function cloneGraph(node, optimistic) {
323
331
  }
324
332
  const clone = Object.create(Object.getPrototypeOf(node));
325
333
  Object.assign(clone, node, {
334
+ o: null,
326
335
  n: null,
327
- m: null,
328
336
  c: null,
329
337
  a: node.a ? [...node.a] : null,
330
- d: node,
331
- J: !!optimistic
338
+ d: node
332
339
  });
333
340
  delete clone.T;
334
341
  ActiveTransition.a.set(node, clone);
335
342
  node.j = ActiveTransition;
336
- if (!optimistic && node.a) {
343
+ if (node.a) {
337
344
  for (let i = 0; i < node.a.length; i++)
338
345
  node.a[i].c.push(clone);
339
346
  }
340
347
  if (node.c) {
341
348
  clone.c = [];
342
349
  for (let i = 0, length = node.c.length; i < length; i++) {
343
- !node.c[i].d && clone.c.push(cloneGraph(node.c[i], optimistic));
350
+ !node.c[i].d && clone.c.push(cloneGraph(node.c[i]));
344
351
  }
345
352
  }
346
353
  return clone;
347
354
  }
348
355
  function latestTransition(t) {
349
- while (t.E instanceof Transition)
350
- t = t.E;
356
+ while (t.D instanceof Transition)
357
+ t = t.D;
351
358
  return t;
352
359
  }
353
360
  function replaceSourceObservers(node, transition2) {
@@ -368,7 +375,7 @@ function cloneQueue(queue, parent, transition2) {
368
375
  Object.assign(clone, queue, {
369
376
  d: queue,
370
377
  k: parent,
371
- f: [],
378
+ h: [],
372
379
  enqueue(type, fn) {
373
380
  transition2 = latestTransition(transition2);
374
381
  transition2.enqueue(type, fn);
@@ -385,9 +392,9 @@ function cloneQueue(queue, parent, transition2) {
385
392
  return queue.notify.call(this, node, type, flags);
386
393
  }
387
394
  });
388
- parent.f.push(clone);
389
- transition2.H.set(queue, clone);
390
- for (const child of queue.f) {
395
+ parent.h.push(clone);
396
+ transition2.J.set(queue, clone);
397
+ for (const child of queue.h) {
391
398
  cloneQueue(child, clone, transition2);
392
399
  }
393
400
  }
@@ -395,11 +402,11 @@ function resolveQueues(children) {
395
402
  for (const child of children) {
396
403
  const og = child.d;
397
404
  if (og) {
398
- const clonedChildren = child.f;
405
+ const clonedChildren = child.h;
399
406
  delete child.enqueue;
400
407
  delete child.notify;
401
408
  delete child.k;
402
- delete child.f;
409
+ delete child.h;
403
410
  Object.assign(og, child);
404
411
  delete og.d;
405
412
  resolveQueues(clonedChildren);
@@ -413,38 +420,38 @@ function mergeTransitions(t1, t2) {
413
420
  key.j = t1;
414
421
  t1.a.set(key, value);
415
422
  });
416
- t2.J.forEach((c) => {
423
+ t2.m.forEach((c) => {
417
424
  c.j = t1;
418
- t1.J.add(c);
425
+ t1.m.add(c);
419
426
  });
420
- t2.I.forEach((p) => t1.I.add(p));
421
- t2.s.forEach((n) => t1.s.add(n));
427
+ t2.K.forEach((p) => t1.K.add(p));
428
+ t2.t.forEach((n) => t1.t.add(n));
422
429
  t1.merge(t2);
423
- t2.E = t1;
430
+ t2.D = t1;
424
431
  }
425
432
  function getTransitionSource(input) {
426
433
  return ActiveTransition && ActiveTransition.a.get(input) || input;
427
434
  }
428
435
  function getQueue(node) {
429
436
  const transition2 = ActiveTransition || node.d?.j;
430
- return transition2 && transition2.H.get(node.C) || node.C;
437
+ return transition2 && transition2.J.get(node.E) || node.E;
431
438
  }
432
439
  function initialDispose(node) {
433
- let current = node.m;
440
+ let current = node.n;
434
441
  while (current !== null && current.k === node) {
435
442
  initialDispose(current);
436
443
  const clone = ActiveTransition.a.get(current);
437
444
  if (clone && !clone.Z)
438
445
  clone.dispose(true);
439
- current = current.m;
446
+ current = current.n;
440
447
  }
441
448
  }
442
449
  function finishTransition(transition2) {
443
- if (transition2.E || transition2.Y || transition2.I.size || transition2.s.size)
450
+ if (transition2.D || transition2.Y || transition2.K.size || transition2.t.size)
444
451
  return;
445
452
  globalQueue.g[0].push.apply(globalQueue.g[0], transition2.g[0]);
446
453
  globalQueue.g[1].push.apply(globalQueue.g[1], transition2.g[1]);
447
- resolveQueues(transition2.f);
454
+ resolveQueues(transition2.h);
448
455
  for (const [source, clone] of transition2.a) {
449
456
  if (source === clone || source.j !== transition2) {
450
457
  delete source.j;
@@ -452,33 +459,27 @@ function finishTransition(transition2) {
452
459
  }
453
460
  if (clone.a)
454
461
  replaceSourceObservers(clone, transition2);
455
- if (clone.J) {
456
- clone.dispose();
457
- clone.emptyDisposal();
458
- delete source.j;
459
- continue;
460
- }
461
462
  if (clone.Z || clone.b === STATE_DISPOSED) {
462
463
  source.dispose(clone.b === STATE_DISPOSED);
463
464
  source.emptyDisposal();
464
465
  delete clone.Z;
465
466
  } else {
466
- delete clone.m;
467
467
  delete clone.n;
468
+ delete clone.o;
468
469
  }
469
470
  Object.assign(source, clone);
470
471
  delete source.d;
471
- let current = clone.m;
472
- if (current?.y === clone)
473
- current.y = source;
472
+ let current = clone.n;
473
+ if (current?.z === clone)
474
+ current.z = source;
474
475
  while (current?.k === clone) {
475
476
  current.k = source;
476
- current = current.m;
477
+ current = current.n;
477
478
  }
478
479
  delete source.j;
479
480
  }
480
- transition2.E = true;
481
- for (const reset of transition2.J) {
481
+ transition2.D = true;
482
+ for (const reset of transition2.m) {
482
483
  delete reset.j;
483
484
  reset();
484
485
  }
@@ -501,12 +502,12 @@ var Owner = class {
501
502
  // However, the children are actually added in reverse creation order
502
503
  // See comment at the top of the file for an example of the _nextSibling traversal
503
504
  k = null;
504
- m = null;
505
- y = null;
506
- b = STATE_CLEAN;
507
505
  n = null;
508
- z = defaultContext;
509
- C = globalQueue;
506
+ z = null;
507
+ b = STATE_CLEAN;
508
+ o = null;
509
+ A = defaultContext;
510
+ E = globalQueue;
510
511
  fa = 0;
511
512
  id = null;
512
513
  constructor(id = null, skipAppend = false) {
@@ -517,58 +518,58 @@ var Owner = class {
517
518
  }
518
519
  append(child) {
519
520
  child.k = this;
520
- child.y = this;
521
- if (this.m)
522
- this.m.y = child;
523
- child.m = this.m;
524
- this.m = child;
521
+ child.z = this;
522
+ if (this.n)
523
+ this.n.z = child;
524
+ child.n = this.n;
525
+ this.n = child;
525
526
  if (this.id != null && child.id == null)
526
527
  child.id = this.getNextChildId();
527
- if (child.z !== this.z) {
528
- child.z = { ...this.z, ...child.z };
528
+ if (child.A !== this.A) {
529
+ child.A = { ...this.A, ...child.A };
529
530
  }
530
- if (this.C)
531
- child.C = this.C;
531
+ if (this.E)
532
+ child.E = this.E;
532
533
  }
533
534
  dispose(self = true) {
534
535
  if (this.b === STATE_DISPOSED)
535
536
  return;
536
- let head = self ? this.y || this.k : this, current = this.m, next = null;
537
+ let head = self ? this.z || this.k : this, current = this.n, next = null;
537
538
  while (current && current.k === this) {
538
539
  current.dispose(true);
539
- next = current.m;
540
- current.m = null;
540
+ next = current.n;
541
+ current.n = null;
541
542
  current = next;
542
543
  }
543
544
  this.fa = 0;
544
545
  if (self)
545
546
  this.M();
546
547
  if (current)
547
- current.y = !self ? this : this.y;
548
+ current.z = !self ? this : this.z;
548
549
  if (head)
549
- head.m = current;
550
+ head.n = current;
550
551
  }
551
552
  M() {
552
- if (this.y)
553
- this.y.m = null;
553
+ if (this.z)
554
+ this.z.n = null;
554
555
  this.k = null;
555
- this.y = null;
556
- this.z = defaultContext;
556
+ this.z = null;
557
+ this.A = defaultContext;
557
558
  this.b = STATE_DISPOSED;
558
559
  this.emptyDisposal();
559
560
  }
560
561
  emptyDisposal() {
561
- if (!this.n)
562
+ if (!this.o)
562
563
  return;
563
- if (Array.isArray(this.n)) {
564
- for (let i = 0; i < this.n.length; i++) {
565
- const callable = this.n[i];
564
+ if (Array.isArray(this.o)) {
565
+ for (let i = 0; i < this.o.length; i++) {
566
+ const callable = this.o[i];
566
567
  callable.call(callable);
567
568
  }
568
569
  } else {
569
- this.n.call(this.n);
570
+ this.o.call(this.o);
570
571
  }
571
- this.n = null;
572
+ this.o = null;
572
573
  }
573
574
  getNextChildId() {
574
575
  if (this.id != null)
@@ -583,7 +584,7 @@ function getContext(context, owner = currentOwner) {
583
584
  if (!owner) {
584
585
  throw new NoOwnerError();
585
586
  }
586
- const value = hasContext(context, owner) ? owner.z[context.id] : context.defaultValue;
587
+ const value = hasContext(context, owner) ? owner.A[context.id] : context.defaultValue;
587
588
  if (isUndefined(value)) {
588
589
  throw new ContextNotFoundError();
589
590
  }
@@ -593,24 +594,24 @@ function setContext(context, value, owner = currentOwner) {
593
594
  if (!owner) {
594
595
  throw new NoOwnerError();
595
596
  }
596
- owner.z = {
597
- ...owner.z,
597
+ owner.A = {
598
+ ...owner.A,
598
599
  [context.id]: isUndefined(value) ? context.defaultValue : value
599
600
  };
600
601
  }
601
602
  function hasContext(context, owner = currentOwner) {
602
- return !isUndefined(owner?.z[context.id]);
603
+ return !isUndefined(owner?.A[context.id]);
603
604
  }
604
605
  function onCleanup(fn) {
605
606
  if (!currentOwner)
606
607
  return fn;
607
608
  const node = currentOwner;
608
- if (!node.n) {
609
- node.n = fn;
610
- } else if (Array.isArray(node.n)) {
611
- node.n.push(fn);
609
+ if (!node.o) {
610
+ node.o = fn;
611
+ } else if (Array.isArray(node.o)) {
612
+ node.o.push(fn);
612
613
  } else {
613
- node.n = [node.n, fn];
614
+ node.o = [node.o, fn];
614
615
  }
615
616
  return fn;
616
617
  }
@@ -649,19 +650,19 @@ var Computation = class extends Owner {
649
650
  ea;
650
651
  ha = false;
651
652
  /** Whether the computation is an error or has ancestors that are unresolved */
652
- i = 0;
653
+ f = 0;
653
654
  /** Which flags raised by sources are handled, vs. being passed through. */
654
655
  ba = DEFAULT_FLAGS;
655
656
  Q = -1;
656
- F = false;
657
+ H = false;
657
658
  j;
658
659
  d;
659
- J = false;
660
+ m;
660
661
  constructor(initialValue, compute2, options) {
661
662
  super(options?.id, compute2 === null);
662
663
  this.P = compute2;
663
664
  this.b = compute2 ? STATE_DIRTY : STATE_CLEAN;
664
- this.i = compute2 && initialValue === void 0 ? UNINITIALIZED_BIT : 0;
665
+ this.f = compute2 && initialValue === void 0 ? UNINITIALIZED_BIT : 0;
665
666
  this.l = initialValue;
666
667
  if (options?.equals !== void 0)
667
668
  this.aa = options.equals;
@@ -674,8 +675,8 @@ var Computation = class extends Owner {
674
675
  }
675
676
  ga() {
676
677
  track(this);
677
- newFlags |= this.i & ~currentMask;
678
- if (this.i & ERROR_BIT) {
678
+ newFlags |= this.f & ~currentMask;
679
+ if (this.f & ERROR_BIT) {
679
680
  throw this.O;
680
681
  } else {
681
682
  return this.l;
@@ -686,16 +687,16 @@ var Computation = class extends Owner {
686
687
  * Automatically re-executes the surrounding computation when the value changes
687
688
  */
688
689
  read() {
689
- if (ActiveTransition && (ActiveTransition.a.has(this) || !this.d && this.i & (UNINITIALIZED_BIT | ERROR_BIT))) {
690
+ if (ActiveTransition && (ActiveTransition.a.has(this) || !this.d && this.f & (UNINITIALIZED_BIT | ERROR_BIT))) {
690
691
  const clone = ActiveTransition.a.get(this) || cloneGraph(this);
691
692
  if (clone !== this)
692
693
  return clone.read();
693
694
  }
694
695
  if (this.P) {
695
- if (this.i & ERROR_BIT && this.Q <= clock)
696
+ if (this.f & ERROR_BIT && this.Q <= clock)
696
697
  update(this);
697
698
  else
698
- this.D();
699
+ this.F();
699
700
  }
700
701
  return this.ga();
701
702
  }
@@ -707,22 +708,22 @@ var Computation = class extends Owner {
707
708
  * before continuing
708
709
  */
709
710
  wait() {
710
- if (ActiveTransition && (ActiveTransition.a.has(this) || !this.d && this.i & (UNINITIALIZED_BIT | ERROR_BIT))) {
711
+ if (ActiveTransition && (ActiveTransition.a.has(this) || !this.d && this.f & (UNINITIALIZED_BIT | ERROR_BIT))) {
711
712
  const clone = ActiveTransition.a.get(this) || cloneGraph(this);
712
713
  if (clone !== this)
713
714
  return clone.wait();
714
715
  }
715
716
  if (this.P) {
716
- if (this.i & ERROR_BIT && this.Q <= clock)
717
+ if (this.f & ERROR_BIT && this.Q <= clock)
717
718
  update(this);
718
719
  else
719
- this.D();
720
+ this.F();
720
721
  }
721
- if ((notStale || this.i & UNINITIALIZED_BIT) && this.i & LOADING_BIT) {
722
+ if ((notStale || this.f & UNINITIALIZED_BIT) && this.f & LOADING_BIT) {
722
723
  track(this);
723
724
  throw new NotReadyError();
724
725
  }
725
- if (staleCheck && this.i & LOADING_BIT) {
726
+ if (staleCheck && this.f & LOADING_BIT) {
726
727
  staleCheck.l = true;
727
728
  }
728
729
  return this.ga();
@@ -735,19 +736,19 @@ var Computation = class extends Owner {
735
736
  return clone.write(value, flags, raw);
736
737
  }
737
738
  const newValue = !raw && typeof value === "function" ? value(this.l) : value;
738
- const valueChanged = newValue !== UNCHANGED && (!!(this.i & UNINITIALIZED_BIT) || // this._stateFlags & LOADING_BIT & ~flags ||
739
+ const valueChanged = newValue !== UNCHANGED && (!!(this.f & UNINITIALIZED_BIT) || // this._stateFlags & LOADING_BIT & ~flags ||
739
740
  this.aa === false || !this.aa(this.l, newValue));
740
741
  if (valueChanged) {
741
742
  this.l = newValue;
742
743
  this.O = void 0;
743
744
  }
744
- const changedFlagsMask = this.i ^ flags, changedFlags = changedFlagsMask & flags;
745
- this.i = flags;
745
+ const changedFlagsMask = this.f ^ flags, changedFlags = changedFlagsMask & flags;
746
+ this.f = flags;
746
747
  this.Q = clock + 1;
747
- if (this.c) {
748
+ if (this.c && !(this.m && ActiveTransition)) {
748
749
  for (let i = 0; i < this.c.length; i++) {
749
750
  if (valueChanged) {
750
- this.c[i].t(STATE_DIRTY);
751
+ this.c[i].u(STATE_DIRTY);
751
752
  } else if (changedFlagsMask) {
752
753
  this.c[i]._(changedFlagsMask, changedFlags);
753
754
  }
@@ -758,14 +759,14 @@ var Computation = class extends Owner {
758
759
  /**
759
760
  * Set the current node's state, and recursively mark all of this node's observers as STATE_CHECK
760
761
  */
761
- t(state, skipQueue) {
762
- if (this.b >= state && !this.F)
762
+ u(state, skipQueue) {
763
+ if (this.b >= state && !this.H)
763
764
  return;
764
- this.F = !!skipQueue;
765
+ this.H = !!skipQueue;
765
766
  this.b = state;
766
- if (this.c) {
767
+ if (this.c && !(this.m && ActiveTransition)) {
767
768
  for (let i = 0; i < this.c.length; i++) {
768
- this.c[i].t(STATE_CHECK, skipQueue);
769
+ this.c[i].u(STATE_CHECK, skipQueue);
769
770
  }
770
771
  }
771
772
  }
@@ -778,18 +779,18 @@ var Computation = class extends Owner {
778
779
  _(mask, newFlags2) {
779
780
  if (this.b >= STATE_DIRTY)
780
781
  return;
781
- if (mask & this.ba) {
782
- this.t(STATE_DIRTY);
782
+ if (mask & this.ba || this.m && ActiveTransition) {
783
+ this.u(STATE_DIRTY);
783
784
  return;
784
785
  }
785
- if (this.b >= STATE_CHECK && !this.F)
786
+ if (this.b >= STATE_CHECK && !this.H)
786
787
  return;
787
- const prevFlags = this.i & mask;
788
+ const prevFlags = this.f & mask;
788
789
  const deltaFlags = prevFlags ^ newFlags2;
789
790
  if (newFlags2 === prevFlags) ; else if (deltaFlags & prevFlags & mask) {
790
- this.t(STATE_CHECK);
791
+ this.u(STATE_CHECK);
791
792
  } else {
792
- this.i ^= deltaFlags;
793
+ this.f ^= deltaFlags;
793
794
  if (this.c) {
794
795
  for (let i = 0; i < this.c.length; i++) {
795
796
  this.c[i]._(mask, newFlags2);
@@ -804,7 +805,7 @@ var Computation = class extends Owner {
804
805
  return clone.N(error);
805
806
  }
806
807
  this.O = error;
807
- this.write(UNCHANGED, this.i & ~LOADING_BIT | ERROR_BIT | UNINITIALIZED_BIT);
808
+ this.write(UNCHANGED, this.f & ~LOADING_BIT | ERROR_BIT | UNINITIALIZED_BIT);
808
809
  }
809
810
  /**
810
811
  * This is the core part of the reactivity system, which makes sure that the values are updated
@@ -813,7 +814,7 @@ var Computation = class extends Owner {
813
814
  *
814
815
  * This function will ensure that the value and states we read from the computation are up to date
815
816
  */
816
- D() {
817
+ F() {
817
818
  if (!this.P) {
818
819
  return;
819
820
  }
@@ -827,8 +828,8 @@ var Computation = class extends Owner {
827
828
  if (this.b === STATE_CHECK) {
828
829
  for (let i = 0; i < this.a.length; i++) {
829
830
  const source = getTransitionSource(this.a[i]);
830
- source.D();
831
- observerFlags |= source.i & ~UNINITIALIZED_BIT;
831
+ source.F();
832
+ observerFlags |= source.f & ~UNINITIALIZED_BIT;
832
833
  if (this.b === STATE_DIRTY) {
833
834
  break;
834
835
  }
@@ -884,7 +885,7 @@ function update(node) {
884
885
  node.write(result, newFlags, true);
885
886
  } catch (error) {
886
887
  if (error instanceof NotReadyError) {
887
- node.write(UNCHANGED, newFlags | LOADING_BIT | node.i & UNINITIALIZED_BIT);
888
+ node.write(UNCHANGED, newFlags | LOADING_BIT | node.f & UNINITIALIZED_BIT);
888
889
  } else {
889
890
  node.N(error);
890
891
  }
@@ -958,7 +959,7 @@ function isPending(fn, loadingValue) {
958
959
  return pendingCheck(fn, loadingValue);
959
960
  const c = new Computation(void 0, () => pendingCheck(fn, loadingValue));
960
961
  c.ba |= LOADING_BIT;
961
- return c.read();
962
+ return c.wait();
962
963
  }
963
964
  function latest(fn, fallback) {
964
965
  const argLength = arguments.length;
@@ -995,29 +996,29 @@ function compute(owner, fn, observer) {
995
996
  var Effect = class extends Computation {
996
997
  ca;
997
998
  $;
998
- u;
999
+ w;
999
1000
  da = false;
1000
1001
  T;
1001
- r;
1002
+ s;
1002
1003
  constructor(initialValue, compute2, effect, error, options) {
1003
1004
  super(initialValue, compute2, options);
1004
1005
  this.ca = effect;
1005
1006
  this.$ = error;
1006
1007
  this.T = initialValue;
1007
- this.r = options?.render ? EFFECT_RENDER : EFFECT_USER;
1008
- if (this.r === EFFECT_RENDER) {
1008
+ this.s = options?.render ? EFFECT_RENDER : EFFECT_USER;
1009
+ if (this.s === EFFECT_RENDER) {
1009
1010
  this.P = function(p) {
1010
- return !this.d && clock > this.C.created && !(this.i & ERROR_BIT) ? latest(() => compute2(p)) : compute2(p);
1011
+ return !this.d && clock > this.E.created && !(this.f & ERROR_BIT) ? latest(() => compute2(p)) : compute2(p);
1011
1012
  };
1012
1013
  }
1013
- this.D();
1014
- !options?.defer && (this.r === EFFECT_USER ? getQueue(this).enqueue(this.r, this.w.bind(this)) : this.w(this.r));
1014
+ this.F();
1015
+ !options?.defer && (this.s === EFFECT_USER ? getQueue(this).enqueue(this.s, this.x.bind(this)) : this.x(this.s));
1015
1016
  }
1016
1017
  write(value, flags = 0) {
1017
1018
  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);
1019
+ this.f = flags;
1020
+ if (this.s === EFFECT_RENDER) {
1021
+ getQueue(this).notify(this, LOADING_BIT | ERROR_BIT, this.f);
1021
1022
  }
1022
1023
  }
1023
1024
  if (value === UNCHANGED)
@@ -1027,11 +1028,11 @@ var Effect = class extends Computation {
1027
1028
  this.O = void 0;
1028
1029
  return value;
1029
1030
  }
1030
- t(state, skipQueue) {
1031
+ u(state, skipQueue) {
1031
1032
  if (this.b >= state || skipQueue)
1032
1033
  return;
1033
1034
  if (this.b === STATE_CLEAN || this.d && !ActiveTransition)
1034
- getQueue(this).enqueue(this.r, this.w.bind(this));
1035
+ getQueue(this).enqueue(this.s, this.x.bind(this));
1035
1036
  this.b = state;
1036
1037
  }
1037
1038
  _(mask, newFlags2) {
@@ -1039,7 +1040,7 @@ var Effect = class extends Computation {
1039
1040
  if (this.b >= STATE_DIRTY)
1040
1041
  return;
1041
1042
  if (mask & 3) {
1042
- this.t(STATE_DIRTY);
1043
+ this.u(STATE_DIRTY);
1043
1044
  return;
1044
1045
  }
1045
1046
  }
@@ -1048,12 +1049,12 @@ var Effect = class extends Computation {
1048
1049
  N(error) {
1049
1050
  this.O = error;
1050
1051
  getQueue(this).notify(this, LOADING_BIT, 0);
1051
- this.i = ERROR_BIT;
1052
- if (this.r === EFFECT_USER) {
1052
+ this.f = ERROR_BIT;
1053
+ if (this.s === EFFECT_USER) {
1053
1054
  try {
1054
1055
  return this.$ ? this.$(error, () => {
1055
- this.u?.();
1056
- this.u = void 0;
1056
+ this.w?.();
1057
+ this.w = void 0;
1057
1058
  }) : console.error(error);
1058
1059
  } catch (e) {
1059
1060
  error = e;
@@ -1068,18 +1069,18 @@ var Effect = class extends Computation {
1068
1069
  this.ca = void 0;
1069
1070
  this.T = void 0;
1070
1071
  this.$ = void 0;
1071
- this.u?.();
1072
- this.u = void 0;
1072
+ this.w?.();
1073
+ this.w = void 0;
1073
1074
  getQueue(this).notify(this, ERROR_BIT | LOADING_BIT, 0);
1074
1075
  super.M();
1075
1076
  }
1076
- w(type) {
1077
+ x(type) {
1077
1078
  if (type) {
1078
1079
  const effect = this.d || this;
1079
1080
  if (effect.da && effect.b !== STATE_DISPOSED) {
1080
- effect.u?.();
1081
+ effect.w?.();
1081
1082
  try {
1082
- effect.u = effect.ca(effect.l, effect.T);
1083
+ effect.w = effect.ca(effect.l, effect.T);
1083
1084
  } catch (e) {
1084
1085
  if (!getQueue(effect).notify(effect, ERROR_BIT, ERROR_BIT))
1085
1086
  throw e;
@@ -1093,32 +1094,32 @@ var Effect = class extends Computation {
1093
1094
  }
1094
1095
  };
1095
1096
  var TrackedEffect = class extends Computation {
1096
- r = EFFECT_USER;
1097
- u;
1097
+ s = EFFECT_USER;
1098
+ w;
1098
1099
  constructor(compute2, options) {
1099
1100
  super(void 0, () => {
1100
- this.u?.();
1101
- this.u = latest(compute2);
1101
+ this.w?.();
1102
+ this.w = latest(compute2);
1102
1103
  return void 0;
1103
1104
  }, options);
1104
- getQueue(this).enqueue(this.r, this.w.bind(this));
1105
+ getQueue(this).enqueue(this.s, this.x.bind(this));
1105
1106
  }
1106
- t(state, skipQueue) {
1107
+ u(state, skipQueue) {
1107
1108
  if (this.b >= state || skipQueue)
1108
1109
  return;
1109
1110
  if (this.b === STATE_CLEAN || this.d && !ActiveTransition)
1110
- getQueue(this).enqueue(this.r, this.w.bind(this));
1111
+ getQueue(this).enqueue(this.s, this.x.bind(this));
1111
1112
  this.b = state;
1112
1113
  }
1113
1114
  M() {
1114
1115
  if (this.b === STATE_DISPOSED)
1115
1116
  return;
1116
- this.u?.();
1117
- this.u = void 0;
1117
+ this.w?.();
1118
+ this.w = void 0;
1118
1119
  getQueue(this).notify(this, ERROR_BIT | LOADING_BIT, 0);
1119
1120
  super.M();
1120
1121
  }
1121
- w(type) {
1122
+ x(type) {
1122
1123
  if (type)
1123
1124
  this.b !== STATE_CLEAN && runTop(this);
1124
1125
  }
@@ -1126,16 +1127,16 @@ var TrackedEffect = class extends Computation {
1126
1127
  var EagerComputation = class extends Computation {
1127
1128
  constructor(initialValue, compute2, options) {
1128
1129
  super(initialValue, compute2, options);
1129
- !options?.defer && this.D();
1130
+ !options?.defer && this.F();
1130
1131
  }
1131
- t(state, skipQueue) {
1132
- if (this.b >= state && !this.F)
1132
+ u(state, skipQueue) {
1133
+ if (this.b >= state && !this.H)
1133
1134
  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);
1135
+ if (!skipQueue && (this.b === STATE_CLEAN || this.b === STATE_CHECK && this.H))
1136
+ getQueue(this).enqueue(EFFECT_PURE, this.x.bind(this));
1137
+ super.u(state, skipQueue);
1137
1138
  }
1138
- w() {
1139
+ x() {
1139
1140
  this.b !== STATE_CLEAN && runTop(this);
1140
1141
  }
1141
1142
  };
@@ -1144,16 +1145,22 @@ var FirewallComputation = class extends Computation {
1144
1145
  constructor(compute2) {
1145
1146
  super(void 0, compute2);
1146
1147
  }
1147
- t(state, skipQueue) {
1148
- if (this.b >= state && !this.F)
1148
+ u(state, skipQueue) {
1149
+ if (this.b >= state && !this.H)
1149
1150
  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;
1151
+ if (!skipQueue && (this.b === STATE_CLEAN || this.b === STATE_CHECK && this.H))
1152
+ getQueue(this).enqueue(EFFECT_PURE, this.x.bind(this));
1153
+ super.u(state, true);
1154
+ this.H = !!skipQueue;
1154
1155
  }
1155
- w() {
1156
+ x() {
1157
+ const prevFlags = this.f;
1156
1158
  this.b !== STATE_CLEAN && runTop(this);
1159
+ if (ActiveTransition && this.m && (this.f !== prevFlags || this.f !== this.m.flags)) {
1160
+ getQueue(this).notify(this, LOADING_BIT | ERROR_BIT, this.f);
1161
+ this.m.flags = this.f;
1162
+ this.f = prevFlags;
1163
+ }
1157
1164
  }
1158
1165
  };
1159
1166
  function runTop(node) {
@@ -1167,7 +1174,7 @@ function runTop(node) {
1167
1174
  }
1168
1175
  for (let i = ancestors.length - 1; i >= 0; i--) {
1169
1176
  if (ancestors[i].b !== STATE_DISPOSED)
1170
- ancestors[i].D();
1177
+ ancestors[i].F();
1171
1178
  }
1172
1179
  }
1173
1180
 
@@ -1176,7 +1183,7 @@ function createSignal(first, second, third) {
1176
1183
  if (typeof first === "function") {
1177
1184
  const node2 = new Computation(second, first, third);
1178
1185
  return [node2.read.bind(node2), (v) => {
1179
- node2.D();
1186
+ node2.F();
1180
1187
  return node2.write(v);
1181
1188
  }];
1182
1189
  }
@@ -1203,7 +1210,7 @@ function createMemo(compute2, value, options) {
1203
1210
  return resolvedValue;
1204
1211
  }
1205
1212
  resolvedValue = node.wait();
1206
- if (!node.a?.length && node.m?.k !== node && !(node.i & UNINITIALIZED_BIT)) {
1213
+ if (!node.a?.length && node.n?.k !== node && !(node.f & UNINITIALIZED_BIT)) {
1207
1214
  node.dispose();
1208
1215
  node = void 0;
1209
1216
  }
@@ -1282,7 +1289,7 @@ function createAsync(compute2, value, options) {
1282
1289
  }
1283
1290
  n.b = STATE_DIRTY;
1284
1291
  refreshing = true;
1285
- n.D();
1292
+ n.F();
1286
1293
  };
1287
1294
  return read;
1288
1295
  }
@@ -1348,16 +1355,20 @@ function resolve(fn) {
1348
1355
  });
1349
1356
  }
1350
1357
  function createOptimistic(first, second, third) {
1351
- const node = typeof first === "function" ? new Computation(second, first, third) : new Computation(first, null, second);
1352
- const reset = () => node.write(first);
1358
+ const node = typeof first === "function" ? new Computation(second, (prev) => {
1359
+ const res = first(prev);
1360
+ if (node.m.j)
1361
+ return prev;
1362
+ return res;
1363
+ }, third) : new Computation(first, null, second);
1364
+ node.m = () => node.write(first);
1353
1365
  function write(v) {
1354
1366
  if (!ActiveTransition)
1355
1367
  throw new Error("createOptimistic can only be updated inside a transition");
1356
- ActiveTransition.addOptimistic(reset);
1357
- cloneGraph(node, true);
1368
+ ActiveTransition.addOptimistic(node.m);
1358
1369
  queueMicrotask(() => {
1359
- if (reset.j) {
1360
- node.D();
1370
+ if (node.m.j) {
1371
+ node.F();
1361
1372
  node.write(v);
1362
1373
  }
1363
1374
  });
@@ -1833,7 +1844,12 @@ function deep(store) {
1833
1844
  // src/store/optimistic.ts
1834
1845
  function createOptimisticStore(first, second, options) {
1835
1846
  const derived = typeof first === "function";
1836
- const { store, node } = derived ? createProjectionInternal(first, second, options) : createProjectionInternal(() => {
1847
+ const { store, node } = derived ? createProjectionInternal((draft) => {
1848
+ const res = first(draft);
1849
+ if (reset.j)
1850
+ return draft;
1851
+ return res;
1852
+ }, second, options) : createProjectionInternal(() => {
1837
1853
  }, first);
1838
1854
  const reset = () => storeSetter(
1839
1855
  store,
@@ -1847,9 +1863,9 @@ function createOptimisticStore(first, second, options) {
1847
1863
  if (!ActiveTransition)
1848
1864
  throw new Error("createOptimisticStore can only be updated inside a transition");
1849
1865
  ActiveTransition.addOptimistic(reset);
1850
- cloneGraph(node, true);
1851
1866
  queueMicrotask(() => reset.j && storeSetter(store, v));
1852
1867
  };
1868
+ node.m = reset;
1853
1869
  return [store, write];
1854
1870
  }
1855
1871
 
@@ -2058,15 +2074,15 @@ function mapArray(list, map, options) {
2058
2074
  const keyFn = typeof options?.keyed === "function" ? options.keyed : void 0;
2059
2075
  return updateKeyedMap.bind({
2060
2076
  U: new Owner(),
2061
- o: 0,
2077
+ p: 0,
2062
2078
  ia: list,
2063
- G: [],
2079
+ I: [],
2064
2080
  R: map,
2065
- h: [],
2081
+ i: [],
2066
2082
  e: [],
2067
2083
  S: keyFn,
2068
- p: keyFn || options?.keyed === false ? [] : void 0,
2069
- q: map.length > 1 ? [] : void 0,
2084
+ q: keyFn || options?.keyed === false ? [] : void 0,
2085
+ r: map.length > 1 ? [] : void 0,
2070
2086
  V: options?.fallback
2071
2087
  });
2072
2088
  }
@@ -2075,58 +2091,58 @@ function updateKeyedMap() {
2075
2091
  const newItems = this.ia() || [], newLen = newItems.length;
2076
2092
  newItems[$TRACK];
2077
2093
  runWithOwner(this.U, () => {
2078
- let i, j, mapper = this.p ? () => {
2079
- this.p[j] = new Computation(newItems[j], null, pureOptions);
2080
- this.q && (this.q[j] = new Computation(j, null, pureOptions));
2094
+ let i, j, mapper = this.q ? () => {
2095
+ this.q[j] = new Computation(newItems[j], null, pureOptions);
2096
+ this.r && (this.r[j] = new Computation(j, null, pureOptions));
2081
2097
  return this.R(
2082
- Computation.prototype.read.bind(this.p[j]),
2083
- this.q ? Computation.prototype.read.bind(this.q[j]) : void 0
2098
+ Computation.prototype.read.bind(this.q[j]),
2099
+ this.r ? Computation.prototype.read.bind(this.r[j]) : void 0
2084
2100
  );
2085
- } : this.q ? () => {
2101
+ } : this.r ? () => {
2086
2102
  const item = newItems[j];
2087
- this.q[j] = new Computation(j, null, pureOptions);
2088
- return this.R(() => item, Computation.prototype.read.bind(this.q[j]));
2103
+ this.r[j] = new Computation(j, null, pureOptions);
2104
+ return this.R(() => item, Computation.prototype.read.bind(this.r[j]));
2089
2105
  } : () => {
2090
2106
  const item = newItems[j];
2091
2107
  return this.R(() => item);
2092
2108
  };
2093
2109
  if (newLen === 0) {
2094
- if (this.o !== 0) {
2110
+ if (this.p !== 0) {
2095
2111
  this.U.dispose(false);
2096
2112
  this.e = [];
2097
- this.G = [];
2098
- this.h = [];
2099
- this.o = 0;
2100
- this.p && (this.p = []);
2113
+ this.I = [];
2114
+ this.i = [];
2115
+ this.p = 0;
2101
2116
  this.q && (this.q = []);
2117
+ this.r && (this.r = []);
2102
2118
  }
2103
- if (this.V && !this.h[0]) {
2104
- this.h[0] = compute(
2119
+ if (this.V && !this.i[0]) {
2120
+ this.i[0] = compute(
2105
2121
  this.e[0] = new Owner(),
2106
2122
  this.V,
2107
2123
  null
2108
2124
  );
2109
2125
  }
2110
- } else if (this.o === 0) {
2126
+ } else if (this.p === 0) {
2111
2127
  if (this.e[0])
2112
2128
  this.e[0].dispose();
2113
- this.h = new Array(newLen);
2129
+ this.i = new Array(newLen);
2114
2130
  for (j = 0; j < newLen; j++) {
2115
- this.G[j] = newItems[j];
2116
- this.h[j] = compute(this.e[j] = new Owner(), mapper, null);
2131
+ this.I[j] = newItems[j];
2132
+ this.i[j] = compute(this.e[j] = new Owner(), mapper, null);
2117
2133
  }
2118
- this.o = newLen;
2134
+ this.p = newLen;
2119
2135
  } else {
2120
- 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++) {
2122
- if (this.p)
2123
- this.p[start].write(newItems[start]);
2136
+ let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.q ? new Array(newLen) : void 0, tempIndexes = this.r ? new Array(newLen) : void 0;
2137
+ for (start = 0, end = Math.min(this.p, newLen); start < end && (this.I[start] === newItems[start] || this.q && compare(this.S, this.I[start], newItems[start])); start++) {
2138
+ if (this.q)
2139
+ this.q[start].write(newItems[start]);
2124
2140
  }
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];
2141
+ for (end = this.p - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.I[end] === newItems[newEnd] || this.q && compare(this.S, this.I[end], newItems[newEnd])); end--, newEnd--) {
2142
+ temp[newEnd] = this.i[end];
2127
2143
  tempNodes[newEnd] = this.e[end];
2128
- tempRows && (tempRows[newEnd] = this.p[end]);
2129
- tempIndexes && (tempIndexes[newEnd] = this.q[end]);
2144
+ tempRows && (tempRows[newEnd] = this.q[end]);
2145
+ tempIndexes && (tempIndexes[newEnd] = this.r[end]);
2130
2146
  }
2131
2147
  newIndices = /* @__PURE__ */ new Map();
2132
2148
  newIndicesNext = new Array(newEnd + 1);
@@ -2138,14 +2154,14 @@ function updateKeyedMap() {
2138
2154
  newIndices.set(key, j);
2139
2155
  }
2140
2156
  for (i = start; i <= end; i++) {
2141
- item = this.G[i];
2157
+ item = this.I[i];
2142
2158
  key = this.S ? this.S(item) : item;
2143
2159
  j = newIndices.get(key);
2144
2160
  if (j !== void 0 && j !== -1) {
2145
- temp[j] = this.h[i];
2161
+ temp[j] = this.i[i];
2146
2162
  tempNodes[j] = this.e[i];
2147
- tempRows && (tempRows[j] = this.p[i]);
2148
- tempIndexes && (tempIndexes[j] = this.q[i]);
2163
+ tempRows && (tempRows[j] = this.q[i]);
2164
+ tempIndexes && (tempIndexes[j] = this.r[i]);
2149
2165
  j = newIndicesNext[j];
2150
2166
  newIndices.set(key, j);
2151
2167
  } else
@@ -2153,35 +2169,35 @@ function updateKeyedMap() {
2153
2169
  }
2154
2170
  for (j = start; j < newLen; j++) {
2155
2171
  if (j in temp) {
2156
- this.h[j] = temp[j];
2172
+ this.i[j] = temp[j];
2157
2173
  this.e[j] = tempNodes[j];
2158
2174
  if (tempRows) {
2159
- this.p[j] = tempRows[j];
2160
- this.p[j].write(newItems[j]);
2175
+ this.q[j] = tempRows[j];
2176
+ this.q[j].write(newItems[j]);
2161
2177
  }
2162
2178
  if (tempIndexes) {
2163
- this.q[j] = tempIndexes[j];
2164
- this.q[j].write(j);
2179
+ this.r[j] = tempIndexes[j];
2180
+ this.r[j].write(j);
2165
2181
  }
2166
2182
  } else {
2167
- this.h[j] = compute(this.e[j] = new Owner(), mapper, null);
2183
+ this.i[j] = compute(this.e[j] = new Owner(), mapper, null);
2168
2184
  }
2169
2185
  }
2170
- this.h = this.h.slice(0, this.o = newLen);
2171
- this.G = newItems.slice(0);
2186
+ this.i = this.i.slice(0, this.p = newLen);
2187
+ this.I = newItems.slice(0);
2172
2188
  }
2173
2189
  });
2174
- return this.h;
2190
+ return this.i;
2175
2191
  }
2176
2192
  function repeat(count, map, options) {
2177
2193
  return updateRepeat.bind({
2178
2194
  U: new Owner(),
2179
- o: 0,
2180
- A: 0,
2195
+ p: 0,
2196
+ B: 0,
2181
2197
  ja: count,
2182
2198
  R: map,
2183
2199
  e: [],
2184
- h: [],
2200
+ i: [],
2185
2201
  ka: options?.from,
2186
2202
  V: options?.fallback
2187
2203
  });
@@ -2191,14 +2207,14 @@ function updateRepeat() {
2191
2207
  const from = this.ka?.() || 0;
2192
2208
  runWithOwner(this.U, () => {
2193
2209
  if (newLen === 0) {
2194
- if (this.o !== 0) {
2210
+ if (this.p !== 0) {
2195
2211
  this.U.dispose(false);
2196
2212
  this.e = [];
2197
- this.h = [];
2198
- this.o = 0;
2213
+ this.i = [];
2214
+ this.p = 0;
2199
2215
  }
2200
- if (this.V && !this.h[0]) {
2201
- this.h[0] = compute(
2216
+ if (this.V && !this.i[0]) {
2217
+ this.i[0] = compute(
2202
2218
  this.e[0] = new Owner(),
2203
2219
  this.V,
2204
2220
  null
@@ -2207,28 +2223,28 @@ function updateRepeat() {
2207
2223
  return;
2208
2224
  }
2209
2225
  const to = from + newLen;
2210
- const prevTo = this.A + this.o;
2211
- if (this.o === 0 && this.e[0])
2226
+ const prevTo = this.B + this.p;
2227
+ if (this.p === 0 && this.e[0])
2212
2228
  this.e[0].dispose();
2213
2229
  for (let i = to; i < prevTo; i++)
2214
- this.e[i - this.A].dispose();
2215
- if (this.A < from) {
2216
- let i = this.A;
2217
- while (i < from && i < this.o)
2230
+ this.e[i - this.B].dispose();
2231
+ if (this.B < from) {
2232
+ let i = this.B;
2233
+ while (i < from && i < this.p)
2218
2234
  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;
2235
+ this.e.splice(0, from - this.B);
2236
+ this.i.splice(0, from - this.B);
2237
+ } else if (this.B > from) {
2238
+ let i = prevTo - this.B - 1;
2239
+ let difference = this.B - from;
2240
+ this.e.length = this.i.length = newLen;
2225
2241
  while (i >= difference) {
2226
2242
  this.e[i] = this.e[i - difference];
2227
- this.h[i] = this.h[i - difference];
2243
+ this.i[i] = this.i[i - difference];
2228
2244
  i--;
2229
2245
  }
2230
2246
  for (let i2 = 0; i2 < difference; i2++) {
2231
- this.h[i2] = compute(
2247
+ this.i[i2] = compute(
2232
2248
  this.e[i2] = new Owner(),
2233
2249
  () => this.R(i2 + from),
2234
2250
  null
@@ -2236,17 +2252,17 @@ function updateRepeat() {
2236
2252
  }
2237
2253
  }
2238
2254
  for (let i = prevTo; i < to; i++) {
2239
- this.h[i - from] = compute(
2255
+ this.i[i - from] = compute(
2240
2256
  this.e[i - from] = new Owner(),
2241
2257
  () => this.R(i),
2242
2258
  null
2243
2259
  );
2244
2260
  }
2245
- this.h = this.h.slice(0, newLen);
2246
- this.A = from;
2247
- this.o = newLen;
2261
+ this.i = this.i.slice(0, newLen);
2262
+ this.B = from;
2263
+ this.p = newLen;
2248
2264
  });
2249
- return this.h;
2265
+ return this.i;
2250
2266
  }
2251
2267
  function compare(key, a, b) {
2252
2268
  return key ? key(a) === key(b) : true;
@@ -2261,7 +2277,7 @@ var BoundaryComputation = class extends EagerComputation {
2261
2277
  }
2262
2278
  write(value, flags) {
2263
2279
  super.write(value, flags & ~this.W);
2264
- if (this.W & LOADING_BIT && !(this.i & UNINITIALIZED_BIT || ActiveTransition)) {
2280
+ if (this.W & LOADING_BIT && !(this.f & UNINITIALIZED_BIT || ActiveTransition)) {
2265
2281
  flags &= ~LOADING_BIT;
2266
2282
  }
2267
2283
  getQueue(this).notify(this, this.W, flags);
@@ -2269,9 +2285,9 @@ var BoundaryComputation = class extends EagerComputation {
2269
2285
  }
2270
2286
  };
2271
2287
  function createBoundChildren(owner, fn, queue, mask) {
2272
- const parentQueue = owner.C;
2273
- parentQueue.addChild(owner.C = queue);
2274
- onCleanup(() => parentQueue.removeChild(owner.C));
2288
+ const parentQueue = owner.E;
2289
+ parentQueue.addChild(owner.E = queue);
2290
+ onCleanup(() => parentQueue.removeChild(owner.E));
2275
2291
  return compute(
2276
2292
  owner,
2277
2293
  () => {
@@ -2282,25 +2298,25 @@ function createBoundChildren(owner, fn, queue, mask) {
2282
2298
  );
2283
2299
  }
2284
2300
  var ConditionalQueue = class extends Queue {
2285
- x;
2301
+ y;
2286
2302
  X = /* @__PURE__ */ new Set();
2287
- s = /* @__PURE__ */ new Set();
2303
+ t = /* @__PURE__ */ new Set();
2288
2304
  constructor(disabled) {
2289
2305
  super();
2290
- this.x = disabled;
2306
+ this.y = disabled;
2291
2307
  }
2292
2308
  run(type) {
2293
- if (!type || this.x.read())
2309
+ if (!type || this.y.read())
2294
2310
  return;
2295
2311
  return super.run(type);
2296
2312
  }
2297
2313
  notify(node, type, flags) {
2298
- if (this.x.read()) {
2314
+ if (this.y.read()) {
2299
2315
  if (type & LOADING_BIT) {
2300
2316
  if (flags & LOADING_BIT) {
2301
- this.s.add(node);
2317
+ this.t.add(node);
2302
2318
  type &= ~LOADING_BIT;
2303
- } else if (this.s.delete(node))
2319
+ } else if (this.t.delete(node))
2304
2320
  type &= ~LOADING_BIT;
2305
2321
  }
2306
2322
  if (type & ERROR_BIT) {
@@ -2314,7 +2330,7 @@ var ConditionalQueue = class extends Queue {
2314
2330
  return type ? super.notify(node, type, flags) : true;
2315
2331
  }
2316
2332
  merge(queue) {
2317
- queue.s.forEach((n) => this.notify(n, LOADING_BIT, LOADING_BIT));
2333
+ queue.t.forEach((n) => this.notify(n, LOADING_BIT, LOADING_BIT));
2318
2334
  queue.X.forEach((n) => this.notify(n, ERROR_BIT, ERROR_BIT));
2319
2335
  super.merge(queue);
2320
2336
  }
@@ -2322,13 +2338,13 @@ var ConditionalQueue = class extends Queue {
2322
2338
  var CollectionQueue = class extends Queue {
2323
2339
  L;
2324
2340
  e = /* @__PURE__ */ new Set();
2325
- x = new Computation(false, null, { pureWrite: true });
2341
+ y = new Computation(false, null, { pureWrite: true });
2326
2342
  constructor(type) {
2327
2343
  super();
2328
2344
  this.L = type;
2329
2345
  }
2330
2346
  run(type) {
2331
- if (!type || this.x.read())
2347
+ if (!type || this.y.read())
2332
2348
  return;
2333
2349
  return super.run(type);
2334
2350
  }
@@ -2338,11 +2354,11 @@ var CollectionQueue = class extends Queue {
2338
2354
  if (flags & this.L) {
2339
2355
  this.e.add(node);
2340
2356
  if (this.e.size === 1)
2341
- this.x.write(true);
2357
+ this.y.write(true);
2342
2358
  } else if (this.e.size > 0) {
2343
2359
  this.e.delete(node);
2344
2360
  if (this.e.size === 0)
2345
- this.x.write(false);
2361
+ this.y.write(false);
2346
2362
  }
2347
2363
  type &= ~this.L;
2348
2364
  return type ? super.notify(node, type, flags) : true;
@@ -2359,25 +2375,25 @@ function createBoundary(fn, condition) {
2359
2375
  );
2360
2376
  const tree = createBoundChildren(owner, fn, queue, 0);
2361
2377
  new EagerComputation(void 0, () => {
2362
- const disabled = queue.x.read();
2378
+ const disabled = queue.y.read();
2363
2379
  tree.W = disabled ? ERROR_BIT | LOADING_BIT : 0;
2364
2380
  if (!disabled) {
2365
- queue.s.forEach((node) => queue.notify(node, LOADING_BIT, LOADING_BIT));
2381
+ queue.t.forEach((node) => queue.notify(node, LOADING_BIT, LOADING_BIT));
2366
2382
  queue.X.forEach((node) => queue.notify(node, ERROR_BIT, ERROR_BIT));
2367
- queue.s.clear();
2383
+ queue.t.clear();
2368
2384
  queue.X.clear();
2369
2385
  }
2370
2386
  });
2371
- return () => queue.x.read() ? void 0 : tree.read();
2387
+ return () => queue.y.read() ? void 0 : tree.read();
2372
2388
  }
2373
2389
  function createCollectionBoundary(type, fn, fallback) {
2374
2390
  const owner = new Owner();
2375
2391
  const queue = new CollectionQueue(type);
2376
2392
  const tree = createBoundChildren(owner, fn, queue, type);
2377
2393
  const decision = new Computation(void 0, () => {
2378
- if (!queue.x.read()) {
2394
+ if (!queue.y.read()) {
2379
2395
  const resolved = tree.read();
2380
- if (!untrack(() => queue.x.read()))
2396
+ if (!untrack(() => queue.y.read()))
2381
2397
  return resolved;
2382
2398
  }
2383
2399
  return fallback(queue);
@@ -2396,7 +2412,7 @@ function createErrorBoundary(fn, fallback) {
2396
2412
  if (ActiveTransition && !node2.d)
2397
2413
  node2 = cloneGraph(node2);
2398
2414
  node2.b = STATE_DIRTY;
2399
- getQueue(node2).enqueue(node2.r, node2.w.bind(node2));
2415
+ getQueue(node2).enqueue(node2.s, node2.x.bind(node2));
2400
2416
  }
2401
2417
  });
2402
2418
  });